Socket
Socket
Sign inDemoInstall

elarian

Package Overview
Dependencies
Maintainers
3
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elarian - npm Package Compare versions

Comparing version 0.5.5 to 0.5.6

tmp/test.js

24

docs/README.md

@@ -95,2 +95,4 @@ ## Classes

* [.updateAppState(data)](#Elarian+updateAppState) ⇒ <code>AppState</code>
* [.sendMessage(message)](#Elarian+sendMessage) ⇒ <code>Response</code>
* [.collectPayment(amount)](#Elarian+collectPayment) ⇒ <code>Response</code>
* [.connect()](#Client+connect) ⇒ [<code>Elarian</code>](#Elarian)

@@ -134,2 +136,24 @@ * [.isConnected()](#Client+isConnected) ⇒ <code>boolean</code>

<a name="Elarian+sendMessage"></a>
### elarian.sendMessage(message) ⇒ <code>Response</code>
<p>Send user a message</p>
**Kind**: instance method of [<code>Elarian</code>](#Elarian)
| Param | Type |
| --- | --- |
| message | <code>string</code> |
<a name="Elarian+collectPayment"></a>
### elarian.collectPayment(amount) ⇒ <code>Response</code>
<p>Initiale payment collection from user</p>
**Kind**: instance method of [<code>Elarian</code>](#Elarian)
| Param | Type |
| --- | --- |
| amount | <code>Cash</code> |
<a name="Client+connect"></a>

@@ -136,0 +160,0 @@

60

lib/elarian.js

@@ -60,8 +60,6 @@ /* eslint-disable max-len */

if (!data) {
throw new Error('id and data are required');
throw new Error('data is required');
}
const { appId, token } = this.config;
const service = this._getAppStateService();
return new Promise((resolve, reject) => {

@@ -85,2 +83,58 @@ const params = {

/**
* Send user a message
* @param {string} message
* @returns {Response}
* @memberof Elarian
*/
Elarian.prototype.sendMessage = function sendMessage(message) {
if (!message) {
throw new Error('message is required');
}
const { appId, token } = this.config;
const service = this._getSocialService();
return new Promise((resolve, reject) => {
const params = {
appId,
token,
message,
};
service.SendMessage(params, (error, result) => {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
};
/**
* Initiale payment collection from user
* @param {Cash} amount
* @returns {Response}
* @memberof Elarian
*/
Elarian.prototype.collectPayment = function sendMessage(amount) {
if (!amount || !amount.value || !amount.currency) {
throw new Error('A valid amount is required');
}
const { appId, token } = this.config;
const service = this._getSocialService();
return new Promise((resolve, reject) => {
const params = {
appId,
token,
amount,
};
service.CollectPayment(params, (error, result) => {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
};
module.exports = Elarian;

@@ -20,2 +20,16 @@ /* eslint-disable max-len */

/**
* An object representing a response
* @typedef {Object} Response
* @property {boolean} success
* @property {string} message
*/
/**
* An object representing cash
* @typedef {Object} Cash
* @property {double} value
* @property {string} currency
*/
/**
* A function that reacts to events

@@ -22,0 +36,0 @@ * @typedef {function} NotificationHandler

2

package.json
{
"name": "elarian",
"version": "0.5.5",
"version": "0.5.6",
"description": "Elarian JavaScript SDK",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -38,5 +38,9 @@ # Elarian

const { state } = await elarian.fetchAppState();
const data = JSON.parse(state.toString());
await elarian.updateAppState(Buffer.from(JSON.stringify({ ...data, status: 'good boy' })));
await elarian.updateAppState(Buffer.from('abc'));
await elarian.sendMessage('Hello test');
await elarian.collectPayment({ amount: 10, currency: 'UGX' });
```

@@ -46,3 +50,3 @@

Take a look at the [product documentation](https://developers.elarian.com/). For detailed info on this SDK, see the [reference](https://elarianltd.github.io/javascript-sdk/index.html).
For detailed info on this SDK, see the [reference](https://elarianltd.github.io/javascript-sdk/index.html).

@@ -75,1 +79,2 @@ ## Development

- Missing consent event notifications
- Missing sendMessage() and collectPayment() implementations

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc