Comparing version 0.0.12 to 0.0.13
@@ -104,3 +104,2 @@ /* eslint-disable no-underscore-dangle */ | ||
setupMessagingMethods(this, { getSocket }); | ||
setupNotificationMethods(this, { getSocket }); | ||
setupAuthenticationMethods(this, { getSocket }); | ||
@@ -112,2 +111,3 @@ setupCustomerMethods(this, { | ||
}); | ||
setupNotificationMethods(this, { getSocket, log: platform.log }); | ||
} | ||
@@ -114,0 +114,0 @@ |
@@ -30,7 +30,11 @@ /* eslint-disable max-len */ | ||
let notifOptions; | ||
const notificationHandler = (incomingPayload) => { | ||
let event; | ||
const { log } = notifOptions; | ||
const handlePayload = async () => { | ||
const notif = ServerToAppNotification.deserializeBinary(incomingPayload.data).toObject(); | ||
const events = Object.keys(notif); | ||
const event = events.find((i) => !['orgId', 'appId', 'createdAt'].includes(i) && notif[i]); | ||
event = events.find((i) => !['orgId', 'appId', 'createdAt'].includes(i) && notif[i]); | ||
const data = notif[event]; | ||
@@ -93,3 +97,3 @@ const listener = eventListeners[event]; | ||
.catch((error) => { | ||
console.log(error, ServerToAppNotification.deserializeBinary(incomingPayload.data).toObject()); | ||
log.error(`${event}: `, error); | ||
subscriber.onError(error); | ||
@@ -140,3 +144,4 @@ }); | ||
notificationHandler, | ||
setup: (client) => { | ||
setup: (client, options) => { | ||
notifOptions = options; | ||
/* eslint-disable no-param-reassign */ | ||
@@ -143,0 +148,0 @@ client.on = on; |
{ | ||
"name": "elarian", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Elrian JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
10554599
175080