@expressms/smartapp-sdk 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/umd/index.js +9 -17
- package/package.json +2 -2
package/build/umd/index.js
CHANGED
|
@@ -1404,13 +1404,11 @@
|
|
|
1404
1404
|
hasCommunicationObject;
|
|
1405
1405
|
logsEnabled;
|
|
1406
1406
|
isRenameParamsEnabledForBotx;
|
|
1407
|
-
handler;
|
|
1408
1407
|
constructor() {
|
|
1409
1408
|
this.hasCommunicationObject = typeof window.express !== 'undefined' && !!window.express.handleSmartAppEvent;
|
|
1410
1409
|
this.eventEmitter = new ExtendedEventEmitter();
|
|
1411
1410
|
this.logsEnabled = false;
|
|
1412
1411
|
this.isRenameParamsEnabledForBotx = true;
|
|
1413
|
-
this.handler = null;
|
|
1414
1412
|
if (!this.hasCommunicationObject) {
|
|
1415
1413
|
log('No method "express.handleSmartAppEvent", cannot send message to Android');
|
|
1416
1414
|
return;
|
|
@@ -1421,13 +1419,13 @@
|
|
|
1421
1419
|
console.log('Bridge ~ Incoming event', JSON.stringify({ ref, data, files }, null, 2));
|
|
1422
1420
|
const { type, ...payload } = data;
|
|
1423
1421
|
const emitterType = ref || EVENT_TYPE.RECEIVE;
|
|
1424
|
-
const isRenameParamsEnabled =
|
|
1425
|
-
const eventFiles =
|
|
1422
|
+
// const isRenameParamsEnabled = data.handler === HANDLER.BOTX ? this.isRenameParamsEnabledForBotx : true // TODO uncomment when client is ready
|
|
1423
|
+
const eventFiles = this.isRenameParamsEnabledForBotx ?
|
|
1426
1424
|
files?.map((file) => snakeCaseToCamelCase(file)) : files;
|
|
1427
1425
|
const event = {
|
|
1428
1426
|
ref,
|
|
1429
1427
|
type,
|
|
1430
|
-
payload:
|
|
1428
|
+
payload: this.isRenameParamsEnabledForBotx ? snakeCaseToCamelCase(payload) : payload,
|
|
1431
1429
|
files: eventFiles,
|
|
1432
1430
|
};
|
|
1433
1431
|
this.eventEmitter.emit(emitterType, event);
|
|
@@ -1589,7 +1587,6 @@
|
|
|
1589
1587
|
hasCommunicationObject;
|
|
1590
1588
|
logsEnabled;
|
|
1591
1589
|
isRenameParamsEnabledForBotx;
|
|
1592
|
-
handler;
|
|
1593
1590
|
constructor() {
|
|
1594
1591
|
this.hasCommunicationObject =
|
|
1595
1592
|
window.webkit &&
|
|
@@ -1599,7 +1596,6 @@
|
|
|
1599
1596
|
this.eventEmitter = new ExtendedEventEmitter();
|
|
1600
1597
|
this.logsEnabled = false;
|
|
1601
1598
|
this.isRenameParamsEnabledForBotx = true;
|
|
1602
|
-
this.handler = null;
|
|
1603
1599
|
if (!this.hasCommunicationObject) {
|
|
1604
1600
|
log('No method "express.postMessage", cannot send message to iOS');
|
|
1605
1601
|
return;
|
|
@@ -1610,13 +1606,13 @@
|
|
|
1610
1606
|
console.log('Bridge ~ Incoming event', JSON.stringify({ ref, data, files }, null, 2));
|
|
1611
1607
|
const { type, ...payload } = data;
|
|
1612
1608
|
const emitterType = ref || EVENT_TYPE.RECEIVE;
|
|
1613
|
-
const isRenameParamsEnabled =
|
|
1614
|
-
const eventFiles =
|
|
1609
|
+
// const isRenameParamsEnabled = data.handler === HANDLER.BOTX ? this.isRenameParamsEnabledForBotx : true // TODO uncomment when client is ready
|
|
1610
|
+
const eventFiles = this.isRenameParamsEnabledForBotx ?
|
|
1615
1611
|
files?.map((file) => snakeCaseToCamelCase(file)) : files;
|
|
1616
1612
|
const event = {
|
|
1617
1613
|
ref,
|
|
1618
1614
|
type,
|
|
1619
|
-
payload:
|
|
1615
|
+
payload: this.isRenameParamsEnabledForBotx ? snakeCaseToCamelCase(payload) : payload,
|
|
1620
1616
|
files: eventFiles,
|
|
1621
1617
|
};
|
|
1622
1618
|
this.eventEmitter.emit(emitterType, event);
|
|
@@ -1640,7 +1636,6 @@
|
|
|
1640
1636
|
if (!this.hasCommunicationObject)
|
|
1641
1637
|
return Promise.reject();
|
|
1642
1638
|
const ref = v4(); // UUID to detect express response.
|
|
1643
|
-
this.handler = handler;
|
|
1644
1639
|
const isRenameParamsEnabled = handler === HANDLER.BOTX ? this.isRenameParamsEnabledForBotx : true;
|
|
1645
1640
|
const eventProps = {
|
|
1646
1641
|
ref,
|
|
@@ -1780,13 +1775,11 @@
|
|
|
1780
1775
|
eventEmitter;
|
|
1781
1776
|
logsEnabled;
|
|
1782
1777
|
isRenameParamsEnabledForBotx;
|
|
1783
|
-
handler;
|
|
1784
1778
|
constructor() {
|
|
1785
1779
|
this.eventEmitter = new ExtendedEventEmitter();
|
|
1786
1780
|
this.addGlobalListener();
|
|
1787
1781
|
this.logsEnabled = false;
|
|
1788
1782
|
this.isRenameParamsEnabledForBotx = true;
|
|
1789
|
-
this.handler = null;
|
|
1790
1783
|
}
|
|
1791
1784
|
addGlobalListener() {
|
|
1792
1785
|
window.addEventListener('message', (event) => {
|
|
@@ -1795,7 +1788,7 @@
|
|
|
1795
1788
|
typeof event.data.data.type !== 'string')
|
|
1796
1789
|
return;
|
|
1797
1790
|
const { ref, data: { type, ...payload }, files, } = event.data;
|
|
1798
|
-
const isRenameParamsEnabled = this.
|
|
1791
|
+
const isRenameParamsEnabled = this.isRenameParamsEnabledForBotx; // TODO fix when handler is passed
|
|
1799
1792
|
if (this.logsEnabled)
|
|
1800
1793
|
console.log('Bridge ~ Incoming event', event.data);
|
|
1801
1794
|
const emitterType = ref || EVENT_TYPE.RECEIVE;
|
|
@@ -1804,7 +1797,7 @@
|
|
|
1804
1797
|
this.eventEmitter.emit(emitterType, {
|
|
1805
1798
|
ref,
|
|
1806
1799
|
type,
|
|
1807
|
-
payload:
|
|
1800
|
+
payload: this.isRenameParamsEnabledForBotx ? snakeCaseToCamelCase(payload) : payload,
|
|
1808
1801
|
files: eventFiles,
|
|
1809
1802
|
});
|
|
1810
1803
|
});
|
|
@@ -1826,7 +1819,6 @@
|
|
|
1826
1819
|
sendEvent({ handler, method, params, files, timeout = RESPONSE_TIMEOUT, guaranteed_delivery_required = false, }) {
|
|
1827
1820
|
const isRenameParamsEnabled = handler === HANDLER.BOTX ? this.isRenameParamsEnabledForBotx : false;
|
|
1828
1821
|
const ref = v4(); // UUID to detect express response.
|
|
1829
|
-
this.handler = handler;
|
|
1830
1822
|
const payload = {
|
|
1831
1823
|
ref,
|
|
1832
1824
|
type: WEB_COMMAND_TYPE_RPC,
|
|
@@ -1956,7 +1948,7 @@
|
|
|
1956
1948
|
}
|
|
1957
1949
|
}
|
|
1958
1950
|
|
|
1959
|
-
const LIB_VERSION = "1.
|
|
1951
|
+
const LIB_VERSION = "1.2.0";
|
|
1960
1952
|
|
|
1961
1953
|
const getBridge = () => {
|
|
1962
1954
|
if (process.env.NODE_ENV === 'test')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressms/smartapp-sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "Smartapp SDK",
|
|
5
5
|
"main": "build/main/index.js",
|
|
6
6
|
"typings": "build/main/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"typescript": "^4.0.2"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@expressms/smartapp-bridge": "^1.
|
|
41
|
+
"@expressms/smartapp-bridge": "^1.2.0",
|
|
42
42
|
"webpack-manifest-plugin": "2.2.0",
|
|
43
43
|
"workbox-cacheable-response": "^6.5.4",
|
|
44
44
|
"workbox-expiration": "^6.5.4",
|