npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aurocx-sdk

v1.0.24

Published

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 p

Downloads

264

Readme

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

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'
    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.

    • 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
    middleName?:string,
    email?:string,
    mobileNumber?:string,
    phoneNumber?:string,
    address?:string,
    avatarUrl?:string,

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",
    middleName: "A",
    lastName: "Doe",
    phoneNumber: "+12323342443",
    mobileNumber: "+12323342443",
    email: "[email protected]",
    address: "addres",
    avatarUrl: "url",
    });

Instance Methods

const auroCXInstane = new AuroCx(config);

// connect with specific customer
auroCXInstane.connectCX({
    id:"1",
    firstName: "John",
    middleName: "A",
    lastName: "Doe",
    phoneNumber: "+12323342443",
    mobileNumber: "+12323342443",
    email: "[email protected]",
    address: "addres",
    avatarUrl: "url",
});

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

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

  • Below will take effect if config.float is not set to false.
// Minimizes the floating widget 
auroCXInstane.minimize();

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

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": "[email protected]",
    "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");