@ucp-npm/mx-adapter
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

MX Adapter for the UCW

npm version

This is the adapter that makes it possible to connect with MX via the Universal Connect Widget.

Installation

This package is meant to be used with the Universal Connect Widget. If you have forked the UCW project, you can install it as a dependency of the widget.

Navigate to your forked project and, from the root of the project, run:

npm i @ucp-npm/mx-adapter --workspace apps/server

Usage

Once you have the npm package installed, you can set up the ucw to use it.

In the ./apps/server/adapterSetup.ts file, do the following:

Import getMxAdapterMapObject from the MX adapter package:

import { getMxAdapterMapObject } from "@ucp-npm/mx-adapter";

Import the logger and cache client (redis) dependencies:

import * as logger from "./infra/logger";
import { get, set } from "./services/storageClient/redis";

Next, look for the line that starts with export const adapterMap = {, and add the adapter map as follows:

const mxAdapterMapObject = getMxAdapterMapObject({
  cacheClient: {
    set: set,
    get: get,
  },
  logClient: logger,
  aggregatorCredentials: {
    mxInt: {
      username: config.MX_CLIENT_ID,
      password: config.MX_API_SECRET,
    },
    mxProd: {
      username: config.MX_CLIENT_ID_PROD,
      password: config.MX_API_SECRET_PROD,
    },
  },
  envConfig: {
    HOSTURL: config.HOST_URL,
  },
});

export const adapterMap = {
  ...mxAdapterMapObject,
  ...testAdapterMapObject,
};

The logClient and cacheClient dependencies are provided by the Universal Connect Widget.

Published NPM Package

https://www.npmjs.com/package/@ucp-npm/mx-adapter

More Info

See https://universalconnectproject.org/ for more information.

Readme

Keywords

none

Package Sidebar

Install

npm i @ucp-npm/mx-adapter

Weekly Downloads

215

Version

2.1.1

License

Apache-2.0

Unpacked Size

62.3 kB

Total Files

34

Last publish

Collaborators

  • wesrisenmay-mx
  • tphalpmx
  • craigtingey
  • emilysallstrom
  • universalconnectproject