1.0.2 • Published 5 months ago

fcx-minddale-ts v1.0.2

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

Minddale

Minddale

Minddale is a suite of services provided by Firecodex to help you build your brands digitally immortal!

Library

This fcx-mindale-ts (v1) is a TypeScript client library for Minddale, i.e. an npm library to get your TypeScript client connected to the platform and get the services done.

Setup

This library is a very simple module added to your TypeScript project to use the service.

Install

Run cd your-app & npm i fcx-minddale-ts --save

Use

Once a client is registered with Minddale, it will be provided with a Client ID and Client Secret to connect with the platform, along with the registered domain.

Note: Make sure you keep the Client ID and Secret securely in environment file or any other secure methods.

In case you are not making the request from your registered domain (website), make sure you are setting the registered client domain as well in the request header x-mdl-domain.

In order to publish either Newsletter or Contact JSON data, use the service methods as follows.

// Import Service and Models
import { MinddaleClient, MinddaleService, Newsletter, Contact } from 'fcx-minddale-ts';
  ...
  private minddaleClient: MinddaleClient;
  private minddaleService: MinddaleService;
  // Prepare Client & Service
  constructor() {
    this.minddaleClient = {
      id: environment.clientId, 
      secret: environment.clientSecret,
      domain: environment.clientDomain // Required only if from locahost or unregistered domain
    } as MinddaleClient;
    this.minddaleService =new MinddaleService();
  }
  ...
  // Publish Newsletter
  public async publishNewsletter() {
    if(this.email) {
      let message = await this.minddaleService.publishNewsletter(this.minddaleClient, {email: this.email} as Newsletter);
      alert(message);
    }else {
      alert('Please enter valid email to subscribe!');
    }
  }
  ...
  // Publish Contact
  public async publishContact() {
    if(this.email && this.subject && this.message) {
      let status = await this.minddaleService.publishContact(this.minddaleClient, {email: this.email, subject: this.subject, message: this.message} as Contact);
      alert(status);
    }else {
      alert('Please enter valid contact info to post!');
    }
  }

Support

We, at Firecodex, would like to support anybody with queries or suggestions. Please feel free to reach out to us:

contact@firecodex.com

Happy Coding!

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago