Comparing version 0.1.19 to 0.1.20
@@ -19,37 +19,34 @@ ## Classes | ||
* [new Elarian(config)](#new_Elarian_new) | ||
* _instance_ | ||
* [.Customer](#Elarian+Customer) | ||
* [new this.Customer()](#new_Elarian+Customer_new) | ||
* [.generateAuthToken()](#Elarian+generateAuthToken) ⇒ <code>AuthToken</code> | ||
* [.connect()](#Elarian+connect) | ||
* [.isConnected()](#Elarian+isConnected) | ||
* [.disconnect()](#Elarian+disconnect) | ||
* [.sendMessage(customer, channelNumber, message)](#Elarian+sendMessage) ⇒ <code>MessageStatus</code> | ||
* [.sendMessageByTag(tag, channelNumber, body)](#Elarian+sendMessageByTag) ⇒ <code>WorkStatus</code> | ||
* [.replyToMessage(customer, replyToMessageId, body)](#Elarian+replyToMessage) ⇒ <code>MessageStatus</code> | ||
* [.updateMessagingConsent(customer, channelNumber, action)](#Elarian+updateMessagingConsent) ⇒ <code>ConsentStatus</code> | ||
* [.registerListerner(event, listener)](#Elarian+registerListerner) | ||
* [.on(event, listener)](#Elarian+on) | ||
* [.removeListener(event)](#Elarian+removeListener) | ||
* [.off(event)](#Elarian+off) | ||
* [.initiatePayment(debitParty, creditParty, value)](#Elarian+initiatePayment) ⇒ <code>PaymentStatus</code> | ||
* [.getCustomerState(customer)](#Elarian+getCustomerState) ⇒ <code>CustomerState</code> | ||
* [.adoptCustomerState(customer, otherCustomer)](#Elarian+adoptCustomerState) ⇒ <code>UpdateStatus</code> | ||
* [.updateCustomerTag(customer, tags)](#Elarian+updateCustomerTag) ⇒ <code>UpdateStatus</code> | ||
* [.deleteCustomerTag(customer, tags)](#Elarian+deleteCustomerTag) ⇒ <code>UpdateStatus</code> | ||
* [.updateCustomerSecondaryId(customer, secondaryIds)](#Elarian+updateCustomerSecondaryId) ⇒ <code>UpdateStatus</code> | ||
* [.deleteCustomerSecondaryId(customer, secondaryIds)](#Elarian+deleteCustomerSecondaryId) ⇒ <code>UpdateStatus</code> | ||
* [.addCustomerReminder(customer, reminder)](#Elarian+addCustomerReminder) ⇒ <code>UpdateStatus</code> | ||
* [.cancelCustomerReminder(customer, key)](#Elarian+cancelCustomerReminder) ⇒ <code>UpdateStatus</code> | ||
* [.addCustomerReminderByTag(tag, reminder)](#Elarian+addCustomerReminderByTag) ⇒ <code>WorkStatus</code> | ||
* [.cancelCustomerReminderByTag(tag, key)](#Elarian+cancelCustomerReminderByTag) ⇒ <code>WorkStatus</code> | ||
* [.updateCustomerMetadata(customer, metadata)](#Elarian+updateCustomerMetadata) ⇒ <code>UpdateStatus</code> | ||
* [.deleteCustomerMetadata(customer, keys)](#Elarian+deleteCustomerMetadata) ⇒ <code>UpdateStatus</code> | ||
* [.updateCustomerAppData(customer, data)](#Elarian+updateCustomerAppData) ⇒ <code>UpdateStatus</code> | ||
* [.leaseCustomerAppData(customer)](#Elarian+leaseCustomerAppData) ⇒ <code>LeasedAppData</code> | ||
* [.deleteCustomerAppData(customer)](#Elarian+deleteCustomerAppData) ⇒ <code>UpdateStatus</code> | ||
* [.updateCustomerActivity(customerNumber, channelNumber, activity)](#Elarian+updateCustomerActivity) ⇒ <code>UpdateStatus</code> | ||
* [.makeVoiceCall(customer, channelNumber, actions)](#Elarian+makeVoiceCall) ⇒ <code>VoiceStatus</code> | ||
* _static_ | ||
* [.newInstance(config)](#Elarian.newInstance) | ||
* [.Customer](#Elarian+Customer) | ||
* [new this.Customer()](#new_Elarian+Customer_new) | ||
* [.generateAuthToken()](#Elarian+generateAuthToken) ⇒ <code>AuthToken</code> | ||
* [.connect()](#Elarian+connect) | ||
* [.isConnected()](#Elarian+isConnected) | ||
* [.disconnect()](#Elarian+disconnect) | ||
* [.sendMessage(customer, channelNumber, message)](#Elarian+sendMessage) ⇒ <code>MessageStatus</code> | ||
* [.sendMessageByTag(tag, channelNumber, body)](#Elarian+sendMessageByTag) ⇒ <code>WorkStatus</code> | ||
* [.replyToMessage(customer, replyToMessageId, body)](#Elarian+replyToMessage) ⇒ <code>MessageStatus</code> | ||
* [.updateMessagingConsent(customer, channelNumber, action)](#Elarian+updateMessagingConsent) ⇒ <code>ConsentStatus</code> | ||
* [.registerListerner(event, listener)](#Elarian+registerListerner) | ||
* [.on(event, listener)](#Elarian+on) | ||
* [.removeListener(event)](#Elarian+removeListener) | ||
* [.off(event)](#Elarian+off) | ||
* [.initiatePayment(debitParty, creditParty, value)](#Elarian+initiatePayment) ⇒ <code>PaymentStatus</code> | ||
* [.getCustomerState(customer)](#Elarian+getCustomerState) ⇒ <code>CustomerState</code> | ||
* [.adoptCustomerState(customer, otherCustomer)](#Elarian+adoptCustomerState) ⇒ <code>UpdateStatus</code> | ||
* [.updateCustomerTag(customer, tags)](#Elarian+updateCustomerTag) ⇒ <code>UpdateStatus</code> | ||
* [.deleteCustomerTag(customer, tags)](#Elarian+deleteCustomerTag) ⇒ <code>UpdateStatus</code> | ||
* [.updateCustomerSecondaryId(customer, secondaryIds)](#Elarian+updateCustomerSecondaryId) ⇒ <code>UpdateStatus</code> | ||
* [.deleteCustomerSecondaryId(customer, secondaryIds)](#Elarian+deleteCustomerSecondaryId) ⇒ <code>UpdateStatus</code> | ||
* [.addCustomerReminder(customer, reminder)](#Elarian+addCustomerReminder) ⇒ <code>UpdateStatus</code> | ||
* [.cancelCustomerReminder(customer, key)](#Elarian+cancelCustomerReminder) ⇒ <code>UpdateStatus</code> | ||
* [.addCustomerReminderByTag(tag, reminder)](#Elarian+addCustomerReminderByTag) ⇒ <code>WorkStatus</code> | ||
* [.cancelCustomerReminderByTag(tag, key)](#Elarian+cancelCustomerReminderByTag) ⇒ <code>WorkStatus</code> | ||
* [.updateCustomerMetadata(customer, metadata)](#Elarian+updateCustomerMetadata) ⇒ <code>UpdateStatus</code> | ||
* [.deleteCustomerMetadata(customer, keys)](#Elarian+deleteCustomerMetadata) ⇒ <code>UpdateStatus</code> | ||
* [.updateCustomerAppData(customer, data)](#Elarian+updateCustomerAppData) ⇒ <code>UpdateStatus</code> | ||
* [.leaseCustomerAppData(customer)](#Elarian+leaseCustomerAppData) ⇒ <code>LeasedAppData</code> | ||
* [.deleteCustomerAppData(customer)](#Elarian+deleteCustomerAppData) ⇒ <code>UpdateStatus</code> | ||
* [.updateCustomerActivity(customerNumber, channelNumber, activity)](#Elarian+updateCustomerActivity) ⇒ <code>UpdateStatus</code> | ||
* [.makeVoiceCall(customer, channelNumber, actions)](#Elarian+makeVoiceCall) ⇒ <code>VoiceStatus</code> | ||
@@ -418,13 +415,2 @@ <a name="new_Elarian_new"></a> | ||
<a name="Elarian.newInstance"></a> | ||
### Elarian.newInstance(config) | ||
<p>Instantiate and connect an elarian client</p> | ||
**Kind**: static method of [<code>Elarian</code>](#Elarian) | ||
| Param | Type | | ||
| --- | --- | | ||
| config | <code>ElarianConfig</code> | | ||
<a name="Customer"></a> | ||
@@ -674,8 +660,5 @@ | ||
* [new Simulator(config)](#new_Simulator_new) | ||
* _instance_ | ||
* [.receiveMessage(customerNumber, channelNumber, sessionId, messageParts)](#Simulator+receiveMessage) | ||
* [.receivePayment(transactionId, customerNumber, channelNumber, value, status)](#Simulator+receivePayment) | ||
* [.updatePaymentStatus(transactionId, status)](#Simulator+updatePaymentStatus) | ||
* _static_ | ||
* [.newInstance(config)](#Simulator.newInstance) | ||
* [.receiveMessage(customerNumber, channelNumber, sessionId, messageParts)](#Simulator+receiveMessage) | ||
* [.receivePayment(transactionId, customerNumber, channelNumber, value, status)](#Simulator+receivePayment) | ||
* [.updatePaymentStatus(transactionId, status)](#Simulator+updatePaymentStatus) | ||
@@ -733,12 +716,1 @@ <a name="new_Simulator_new"></a> | ||
<a name="Simulator.newInstance"></a> | ||
### Simulator.newInstance(config) | ||
<p>Instantiate and connect an elarian simulator client</p> | ||
**Kind**: static method of [<code>Simulator</code>](#Simulator) | ||
| Param | Type | | ||
| --- | --- | | ||
| config | <code>ElarianConfig</code> | | ||
@@ -211,12 +211,2 @@ /* global window */ | ||
/** | ||
* Instantiate and connect an elarian client | ||
* @param {ElarianConfig} config | ||
*/ | ||
Elarian.newInstance = async (config) => { | ||
const client = new Elarian(config); | ||
await client.connect(); | ||
return client; | ||
}; | ||
module.exports = Elarian; |
@@ -46,12 +46,2 @@ const Elarian = require('./client'); | ||
/** | ||
* Instantiate and connect an elarian simulator client | ||
* @param {ElarianConfig} config | ||
*/ | ||
Simulator.newInstance = async (config) => { | ||
const client = new Simulator(config); | ||
await client.connect(); | ||
return client; | ||
}; | ||
/** | ||
* Initiate a message request | ||
@@ -58,0 +48,0 @@ * @param {string} customerNumber |
{ | ||
"name": "elarian", | ||
"version": "0.1.19", | ||
"version": "0.1.20", | ||
"description": "Elrian JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -36,9 +36,8 @@ # Elarian | ||
client.on('ussdSession', async ({ data, customer}, callback) => { | ||
client.on('ussdSession', async ({ notification, customer, appData }, callback) => { | ||
const { | ||
input, | ||
sessionId, | ||
} = data; | ||
} = notification; | ||
const appData = await customer.leaseAppData(); | ||
let { | ||
@@ -65,3 +64,3 @@ name, | ||
{ number: 'Elarian', provider: 'telco' }, | ||
{ text: `Hey ${name}! Thank you for trying out Elarian` }, | ||
{ text: { body: `Hey ${name}! Thank you for trying out Elarian` } }, | ||
); | ||
@@ -77,5 +76,3 @@ } | ||
} | ||
await customer.updateAppData({ state, name }); | ||
callback(null, menu); | ||
callback(null, menu, { state, name }); | ||
}); | ||
@@ -85,6 +82,12 @@ | ||
.connect() | ||
.then(() => console.log('App is running!')) | ||
.catch(console.error); | ||
.on('connected', () => { | ||
console.log('App is running!') | ||
}) | ||
.on('error', (error) => { | ||
console.error(error); | ||
}); | ||
``` | ||
See [example](example/) for a full sample app. | ||
## Documentation | ||
@@ -91,0 +94,0 @@ |
@@ -23,6 +23,2 @@ /** | ||
/** | ||
* <p>Instantiate and connect an elarian client</p> | ||
*/ | ||
static newInstance(config: ElarianConfig): void; | ||
/** | ||
* <p>Send a message</p> | ||
@@ -248,6 +244,2 @@ */ | ||
/** | ||
* <p>Instantiate and connect an elarian simulator client</p> | ||
*/ | ||
static newInstance(config: ElarianConfig): void; | ||
/** | ||
* <p>Initiate a message request</p> | ||
@@ -254,0 +246,0 @@ */ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
105
9765373
172017