npm.io
0.0.6 • Published 3 years ago

@membergetmember/integration

Licence
ISC
Version
0.0.6
Deps
0
Size
211 kB
Vulns
0
Weekly
0

Member get member advertiser integration

Installation

Using yarn

yarn add @membergetmember/integration
Using npm
npm install @membergetmember/integration
Setup integration

To set up an integration first you need to start an IntegrationService

  • Replace the demo shop ID (XXX) with your actual shop ID provided to you by MemberGetMember
import {IntegrationConfigInterface, IntegrationService, LanguageEnum} from '@membergetmember/integration';

const shopId: string = '053227a2-1036-11ee-be56-0242ac120002';

const integrationService: IntegrationService = new IntegrationService(<IntegrationConfigInterface>{
	shopId,
	language: LanguageEnum.ENGLISH,
});
Inline integration
integrationService.showInContainer(
	document.querySelector('#myUniqueElementReference')
);
Popup on button
<button onclick="integrationService.showAsPopup()" type="button">Click me</button>
Popup on load
document.addEventListener('DOMContentLoaded', () => integrationService.showAsPopup());

Alternate usage (commonjs)

Setup integration
const memberGetMember = require('@membergetmember/integration');
const shopId: string = '053227a2-1036-11ee-be56-0242ac120002';

const integrationService: memberGetMember.IntegrationService = new memberGetMember.IntegrationService({shopId});

Alternate usage manual import

Storing incoming requests

Add the following piece of code to the root of your app so that it loads on every page and stores any received dci.

<script src="/path/to/build/mgm-integration-bundle.min.js"></script>
Registering sale/lead
async await method
const shopId = '053227a2-1036-11ee-be56-0242ac120002';

const integrationService = new memberGetMember({shopId: shopId});

Keywords