1.0.43 • Published 1 year ago

aurocx-sdk v1.0.43

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

AuroCX SDK

The AuroCX SDK package enables AuroCX products to be added to your applications. Through this package, an AuroCX product is exported as a wrapped classes that is responsible for initializing shared cross-product functionalities and using specific AuroCX products.

Installation

npm install aurocx-sdk@1.0.41

Usage

Prerequisite:

  1. Create AuroCx connect instance by signing up with Aurocx
  2. API key received while onboarding merchant.
  3. Adding your origin URL to the list of approved origins.

Use the following steps to add AuroCX widget to your application:

  1. Import AuroCx from the AuroCX SDK and init a instance.
import { AuroCx } from "aurocx-sdk";

const config={
    apiKey: "your-api-key",         // Api key
    env: "dev",                     // Environment, default 'dev'
    usePortal: false                 // Flag for opening portal window, default false
    themeOptions:{
        colors:{
            primary:"#004CFC",      // primary color for widget
            accent:"#ffffff"        // Accent of the widget
        },
        fontFamily:"'Roboto', sans-serif"  // font family
    },
    mountOptions: {
      float: true,                          // Default 'true'
      containerId: "<your-html-div-id>",   // Container to mount widget in, 
                                        // if not provided it would be mounted to body.
      defaultWidgetSize: "DOCKED"       // Default "DOCKED"
    },
    onLoad: ()=>{ console.log("Initiated...") } // Callback Function when loaded.
    onTerminate: ()=>{ console.log("Terminated") } // Callback Function when terminated.
}

const auroCXInstane = new AuroCx(config);
  1. Defining the config of AuroCx.

    • apiKey (required) - Use the api key received while onboarding a new merchant in AuroCX.
    • env: "prod" | "uat"| "qa" | "dev" (required) - Environment to be used for api key.
    • usePortal : Boolean (Optional) - Defines the initializing behaviour as if to initialize widget in your application keep this falg as false, otheriwse when this flag is true the current widget do not initiates to connet with.
    • mountOptions (Optional) - The integration options to display widget in your app.

      • float: Boolean (Optional) - Defines the behaviour of the widget either to display in a specific location of always visible on screen when initiated, Default true.

      • containerId: String (Optional) - Use this option to mount widget in specified div container, if not specified the widget will be mounted in body tag.

      • defaultWidgetSize: "DOCKED" | "HIDDEN" (Optional) - Defines the default view size of widget after init if hidden widget will only appear on connect events(chat/call), Default "DOCKED".

    • themeOptions (Optional) - The theme color options to display widget in your app.

      • colors: Object (Optional)

        • primary: string - Primary widget color to match your brand
        • accent : string - accent color to match with your brand.
      • fontFamily: String (Optional) - Use this option to pass your font family to widget.

    • onLoad: Function (Optional) - This is the callback function which will be called after widget is initiated.
    • onTerminate: Function (Optional) - This is the callback function which will be called after widget is terminated.

Interact with auroCX instance

Connect with contact

Attributes

    // Required attributes
    id:string, 
    firstName:string,
    lastName:string,

    // Optional attributes
    email?:string,
    mobileNumber?:string,
    phoneNumber?:string,
    avatarUrl?:string,
    addressLine1?: string,
    addressLine2?: string,
    country?: string,
    state?: string,
    city?: string,
    postalCode?: number

To connect to specific customer use the connectCX method provided by SDK to initiate a connection.

import { connectCX } from "aurocx-sdk";

connectCX({
    id:"1",
    firstName: "John",
    lastName: "Doe",
    phoneNumber: "+12323342443",
    mobileNumber: "+12323342443",
    email: "john@example.com",
    address: "addres",
    avatarUrl: "https://example.com/img",
    addressLine1: "123/4 Streets",
    addressLine2: "Wall of Fame",
    country: "US",
    state: "NY",
    city: "Torento",
    postalCode: "12401"
    });

Instance Methods

Connect with specific customer

Note: If contact syncing source is any CRM (e.g Salesforce, Zoho) then it's important to pass the CRM unique "id" as the "customer.id" to connectCX method else SDK would ask to sync contacts, if not sure use alternate method to connect.

const auroCXInstane = new AuroCx(config);

// connect with specific customer
auroCXInstane.connectCX({
    id:"1",
    firstName: "John",
    lastName: "Doe",
    phoneNumber: "+12323342443",
    mobileNumber: "+12323342443",
    email: "john@example.com",
    avatarUrl: "https://example.com/img",
    addressLine1: "123/4 Streets",
    addressLine2: "Wall of Fame",
    country: "US",
    state: "NY",
    city: "Torento",
    postalCode: "12401"
});

// Terminate method will end the connection with AuroCx widget instance.
auroCXInstane.terminate();

Note: Multiple initiation of auroCx instance should be avoided.

Open workspace without specifying a customer

const auroCXInstane = new AuroCx(config);

// connect method to open workspace as floating modal.
auroCXInstane.connect();

Note: Please make sure to terminate instance when user access is revoked

Below will take effect if config.float is set to true.

// Minimizes the floating widget 
auroCXInstane.minimize();

// Maximizes the floating widget 
auroCXInstane.minimize();

auroCx Portal window.

Note : auroCx portal window would be used only for detailed access of your activity, setting, & enhance features.

Opening auroCx Portal window

  • set the usePortal flag in config as true to launch the portal window.
import { AuroCx } from "aurocx-sdk";

const config={
    apiKey: "your-api-key",         
    env: "dev",
    usePortal: true                 // Flag for opening portal window, default false
                                    // Set to true for launching portal window.
}

const auroCXInstane = new AuroCx(config);

Api Client

  1. Import ApiClient from the AuroCX SDK and init a instance.
import { ApiClient } from "aurocx-sdk";

const config={
    apiKey: "your-api-key",         // Api key
    env: "dev",                     // Environment, default 'dev'
}

const apiClient = new ApiClient(config)
  1. Defining the config of AuroCx.
    • apiKey (required) - Use the api key received while from AuroCX.
    • env: "prod" | "uat"| "qa" | "dev" (required) - Environment to be used for api.

Create Merchant

Attributes

// Required attributes
firstName: string,
lastName: string,
email: string,
companyPhone: string,
companyName: string,
timeZone: string,

// Optional attributes
addressLine1?: string,
addressLine2?: string,
country?: string,
state?: string,
city?: string,
postalCode?: number

Use createMerchant method provided in ApiClient instance to create new merchant in AuroCX.

await apiClient.createMerchant("resellerId", {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@gmail.com",
    "companyPhone": "+919191919191",
    "companyName": "AuroCX",
    "timeZone": "Asia/Calcutta",
    "addressLine1": "address line 1",
    "addressLine2": "address line 1",
    "country": "country name",
    "state": "state name",
    "city": "ity name",
    "postalCode": 12345
});

Note: method will return merchant id and api key

Get Merchant API key

Fetch merchant api key using getMerchantKey method provided in ApiClient instance.

await apiClient.getMerchantKey("resellerId", "merchantId");

Get merchant details

Get merchant details using the getMerchantDetails method provided in ApiClient instance.

await apiClient.getMerchantDetails("resellerId", "merchantId");
1.0.43

1 year ago

1.0.42

1 year ago

1.0.41

1 year ago

1.0.40

1 year ago

1.0.39

1 year ago

1.0.38

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago