emarsys-integration-client
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -13,19 +13,26 @@ 'use strict'; | ||
var createInstance = function createInstance(options) { | ||
var transmitter = new Transmitter(options); | ||
var receiver = new Receiver(options.global); | ||
return Object.assign({ | ||
messageToEmarsys: transmitter.messageToEmarsys.bind(transmitter), | ||
messageToService: transmitter.messageToService.bind(transmitter), | ||
addMessageHandler: receiver.addMessageHandler.bind(receiver) | ||
}, MiscApi.create(transmitter, receiver), { | ||
alert: AlertApi.create(transmitter), | ||
dialog: DialogApi.create(transmitter, receiver), | ||
updateHash: UpdateHashApi.create(transmitter), | ||
unload: UnloadApi.create(transmitter), | ||
intercom: IntercomApi.create(transmitter) | ||
}); | ||
}; | ||
module.exports = { | ||
init: function init(options) { | ||
var transmitter = new Transmitter(options); | ||
var receiver = new Receiver(options.global); | ||
return Object.assign({ | ||
messageToEmarsys: transmitter.messageToEmarsys.bind(transmitter), | ||
messageToService: transmitter.messageToService.bind(transmitter), | ||
addMessageHandler: receiver.addMessageHandler.bind(receiver) | ||
}, MiscApi.create(transmitter, receiver), { | ||
alert: AlertApi.create(transmitter), | ||
dialog: DialogApi.create(transmitter, receiver), | ||
updateHash: UpdateHashApi.create(transmitter), | ||
unload: UnloadApi.create(transmitter), | ||
intercom: IntercomApi.create(transmitter) | ||
}); | ||
}, | ||
integrationClient: createInstance({ | ||
global: window, | ||
integrationId: 'DEFAULT', | ||
integrationInstanceId: 'DEFAULT' | ||
}), | ||
init: createInstance, | ||
comm: { | ||
@@ -32,0 +39,0 @@ Transmitter: Transmitter, |
@@ -51,3 +51,3 @@ { | ||
"homepage": "https://github.com/emartech/emarsys-integration-client-js#readme", | ||
"version": "2.3.0" | ||
"version": "2.4.0" | ||
} |
@@ -19,4 +19,18 @@ # Build status | ||
```javascript | ||
var ClientApi = require('emarsys-integration-client'); | ||
var clientApi = ClientApi.init({ | ||
const { integrationClient } = require('emarsys-integration-client'); | ||
const result = await itegrationClient.getUrl({ target: 'email_analysis/list' }); | ||
const href = result.data.url; | ||
``` | ||
# Legacy usage | ||
Earlier versions of this package required you to create an instance with custom config. | ||
Most methods now work without this, but if you are using `messageToService` explicitly, | ||
you might still need to instantiate like this: | ||
```javascript | ||
var IntegrationClient = require('emarsys-integration-client'); | ||
var integrationClient = IntegrationClient.init({ | ||
global: window, | ||
@@ -23,0 +37,0 @@ integrationId: 'my-integration', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34440
544
158