@expressms/smartapp-sdk 1.2.9 → 1.4.0-alpha
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/README.md +82 -52
- package/build/main/index.d.ts +2 -2
- package/build/main/index.js +6 -2
- package/build/main/lib/client/events.d.ts +20 -0
- package/build/main/lib/client/events.js +78 -0
- package/build/main/lib/client/index.d.ts +18 -2
- package/build/main/lib/client/index.js +47 -2
- package/build/main/lib/logging/index.js +5 -2
- package/build/main/types/bridge.d.ts +14 -2
- package/build/main/types/bridge.js +16 -2
- package/build/main/types/client.d.ts +19 -0
- package/build/main/types/client.js +8 -0
- package/build/main/types/index.d.ts +2 -0
- package/build/main/types/index.js +3 -1
- package/build/module/index.d.ts +2 -2
- package/build/module/index.js +3 -3
- package/build/module/lib/client/events.d.ts +20 -0
- package/build/module/lib/client/events.js +71 -0
- package/build/module/lib/client/index.d.ts +18 -2
- package/build/module/lib/client/index.js +32 -3
- package/build/module/lib/logging/index.js +5 -2
- package/build/module/types/bridge.d.ts +14 -2
- package/build/module/types/bridge.js +15 -1
- package/build/module/types/client.d.ts +19 -0
- package/build/module/types/client.js +5 -0
- package/build/module/types/index.d.ts +2 -0
- package/build/module/types/index.js +3 -1
- package/build/umd/index.js +215 -145
- package/package.json +13 -21
- package/workers/workbox.js +0 -80
package/build/umd/index.js
CHANGED
|
@@ -130,80 +130,23 @@
|
|
|
130
130
|
return stringify(rnds);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
134
|
-
|
|
135
|
-
function createCommonjsModule(fn) {
|
|
136
|
-
var module = { exports: {} };
|
|
137
|
-
return fn(module, module.exports), module.exports;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
133
|
/** Detect free variable `global` from Node.js. */
|
|
134
|
+
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
141
135
|
|
|
142
|
-
var freeGlobal =
|
|
143
|
-
|
|
144
|
-
var _freeGlobal = freeGlobal;
|
|
136
|
+
var freeGlobal$1 = freeGlobal;
|
|
145
137
|
|
|
146
138
|
/** Detect free variable `self`. */
|
|
147
139
|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
148
140
|
|
|
149
141
|
/** Used as a reference to the global object. */
|
|
150
|
-
var root =
|
|
142
|
+
var root = freeGlobal$1 || freeSelf || Function('return this')();
|
|
151
143
|
|
|
152
|
-
var
|
|
144
|
+
var root$1 = root;
|
|
153
145
|
|
|
154
146
|
/** Built-in value references. */
|
|
155
|
-
var Symbol =
|
|
156
|
-
|
|
157
|
-
var _Symbol = Symbol;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* A specialized version of `_.map` for arrays without support for iteratee
|
|
161
|
-
* shorthands.
|
|
162
|
-
*
|
|
163
|
-
* @private
|
|
164
|
-
* @param {Array} [array] The array to iterate over.
|
|
165
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
166
|
-
* @returns {Array} Returns the new mapped array.
|
|
167
|
-
*/
|
|
168
|
-
function arrayMap(array, iteratee) {
|
|
169
|
-
var index = -1,
|
|
170
|
-
length = array == null ? 0 : array.length,
|
|
171
|
-
result = Array(length);
|
|
172
|
-
|
|
173
|
-
while (++index < length) {
|
|
174
|
-
result[index] = iteratee(array[index], index, array);
|
|
175
|
-
}
|
|
176
|
-
return result;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
var _arrayMap = arrayMap;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Checks if `value` is classified as an `Array` object.
|
|
183
|
-
*
|
|
184
|
-
* @static
|
|
185
|
-
* @memberOf _
|
|
186
|
-
* @since 0.1.0
|
|
187
|
-
* @category Lang
|
|
188
|
-
* @param {*} value The value to check.
|
|
189
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
190
|
-
* @example
|
|
191
|
-
*
|
|
192
|
-
* _.isArray([1, 2, 3]);
|
|
193
|
-
* // => true
|
|
194
|
-
*
|
|
195
|
-
* _.isArray(document.body.children);
|
|
196
|
-
* // => false
|
|
197
|
-
*
|
|
198
|
-
* _.isArray('abc');
|
|
199
|
-
* // => false
|
|
200
|
-
*
|
|
201
|
-
* _.isArray(_.noop);
|
|
202
|
-
* // => false
|
|
203
|
-
*/
|
|
204
|
-
var isArray = Array.isArray;
|
|
147
|
+
var Symbol = root$1.Symbol;
|
|
205
148
|
|
|
206
|
-
var
|
|
149
|
+
var Symbol$1 = Symbol;
|
|
207
150
|
|
|
208
151
|
/** Used for built-in method references. */
|
|
209
152
|
var objectProto$1 = Object.prototype;
|
|
@@ -219,7 +162,7 @@
|
|
|
219
162
|
var nativeObjectToString$1 = objectProto$1.toString;
|
|
220
163
|
|
|
221
164
|
/** Built-in value references. */
|
|
222
|
-
var symToStringTag$1 =
|
|
165
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
223
166
|
|
|
224
167
|
/**
|
|
225
168
|
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
@@ -248,8 +191,6 @@
|
|
|
248
191
|
return result;
|
|
249
192
|
}
|
|
250
193
|
|
|
251
|
-
var _getRawTag = getRawTag;
|
|
252
|
-
|
|
253
194
|
/** Used for built-in method references. */
|
|
254
195
|
var objectProto = Object.prototype;
|
|
255
196
|
|
|
@@ -271,14 +212,12 @@
|
|
|
271
212
|
return nativeObjectToString.call(value);
|
|
272
213
|
}
|
|
273
214
|
|
|
274
|
-
var _objectToString = objectToString;
|
|
275
|
-
|
|
276
215
|
/** `Object#toString` result references. */
|
|
277
216
|
var nullTag = '[object Null]',
|
|
278
217
|
undefinedTag = '[object Undefined]';
|
|
279
218
|
|
|
280
219
|
/** Built-in value references. */
|
|
281
|
-
var symToStringTag =
|
|
220
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
282
221
|
|
|
283
222
|
/**
|
|
284
223
|
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
@@ -292,12 +231,10 @@
|
|
|
292
231
|
return value === undefined ? undefinedTag : nullTag;
|
|
293
232
|
}
|
|
294
233
|
return (symToStringTag && symToStringTag in Object(value))
|
|
295
|
-
?
|
|
296
|
-
:
|
|
234
|
+
? getRawTag(value)
|
|
235
|
+
: objectToString(value);
|
|
297
236
|
}
|
|
298
237
|
|
|
299
|
-
var _baseGetTag = baseGetTag;
|
|
300
|
-
|
|
301
238
|
/**
|
|
302
239
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
303
240
|
* and has a `typeof` result of "object".
|
|
@@ -326,8 +263,6 @@
|
|
|
326
263
|
return value != null && typeof value == 'object';
|
|
327
264
|
}
|
|
328
265
|
|
|
329
|
-
var isObjectLike_1 = isObjectLike;
|
|
330
|
-
|
|
331
266
|
/** `Object#toString` result references. */
|
|
332
267
|
var symbolTag = '[object Symbol]';
|
|
333
268
|
|
|
@@ -350,16 +285,61 @@
|
|
|
350
285
|
*/
|
|
351
286
|
function isSymbol(value) {
|
|
352
287
|
return typeof value == 'symbol' ||
|
|
353
|
-
(
|
|
288
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
354
289
|
}
|
|
355
290
|
|
|
356
|
-
|
|
291
|
+
/**
|
|
292
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
293
|
+
* shorthands.
|
|
294
|
+
*
|
|
295
|
+
* @private
|
|
296
|
+
* @param {Array} [array] The array to iterate over.
|
|
297
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
298
|
+
* @returns {Array} Returns the new mapped array.
|
|
299
|
+
*/
|
|
300
|
+
function arrayMap(array, iteratee) {
|
|
301
|
+
var index = -1,
|
|
302
|
+
length = array == null ? 0 : array.length,
|
|
303
|
+
result = Array(length);
|
|
304
|
+
|
|
305
|
+
while (++index < length) {
|
|
306
|
+
result[index] = iteratee(array[index], index, array);
|
|
307
|
+
}
|
|
308
|
+
return result;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Checks if `value` is classified as an `Array` object.
|
|
313
|
+
*
|
|
314
|
+
* @static
|
|
315
|
+
* @memberOf _
|
|
316
|
+
* @since 0.1.0
|
|
317
|
+
* @category Lang
|
|
318
|
+
* @param {*} value The value to check.
|
|
319
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
320
|
+
* @example
|
|
321
|
+
*
|
|
322
|
+
* _.isArray([1, 2, 3]);
|
|
323
|
+
* // => true
|
|
324
|
+
*
|
|
325
|
+
* _.isArray(document.body.children);
|
|
326
|
+
* // => false
|
|
327
|
+
*
|
|
328
|
+
* _.isArray('abc');
|
|
329
|
+
* // => false
|
|
330
|
+
*
|
|
331
|
+
* _.isArray(_.noop);
|
|
332
|
+
* // => false
|
|
333
|
+
*/
|
|
334
|
+
var isArray = Array.isArray;
|
|
335
|
+
|
|
336
|
+
var isArray$1 = isArray;
|
|
357
337
|
|
|
358
338
|
/** Used as references for various `Number` constants. */
|
|
359
339
|
var INFINITY = 1 / 0;
|
|
360
340
|
|
|
361
341
|
/** Used to convert symbols to primitives and strings. */
|
|
362
|
-
var symbolProto =
|
|
342
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
|
|
363
343
|
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
364
344
|
|
|
365
345
|
/**
|
|
@@ -375,19 +355,17 @@
|
|
|
375
355
|
if (typeof value == 'string') {
|
|
376
356
|
return value;
|
|
377
357
|
}
|
|
378
|
-
if (
|
|
358
|
+
if (isArray$1(value)) {
|
|
379
359
|
// Recursively convert values (susceptible to call stack limits).
|
|
380
|
-
return
|
|
360
|
+
return arrayMap(value, baseToString) + '';
|
|
381
361
|
}
|
|
382
|
-
if (
|
|
362
|
+
if (isSymbol(value)) {
|
|
383
363
|
return symbolToString ? symbolToString.call(value) : '';
|
|
384
364
|
}
|
|
385
365
|
var result = (value + '');
|
|
386
366
|
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
387
367
|
}
|
|
388
368
|
|
|
389
|
-
var _baseToString = baseToString;
|
|
390
|
-
|
|
391
369
|
/**
|
|
392
370
|
* Converts `value` to a string. An empty string is returned for `null`
|
|
393
371
|
* and `undefined` values. The sign of `-0` is preserved.
|
|
@@ -410,11 +388,9 @@
|
|
|
410
388
|
* // => '1,2,3'
|
|
411
389
|
*/
|
|
412
390
|
function toString(value) {
|
|
413
|
-
return value == null ? '' :
|
|
391
|
+
return value == null ? '' : baseToString(value);
|
|
414
392
|
}
|
|
415
393
|
|
|
416
|
-
var toString_1 = toString;
|
|
417
|
-
|
|
418
394
|
/**
|
|
419
395
|
* The base implementation of `_.slice` without an iteratee call guard.
|
|
420
396
|
*
|
|
@@ -445,8 +421,6 @@
|
|
|
445
421
|
return result;
|
|
446
422
|
}
|
|
447
423
|
|
|
448
|
-
var _baseSlice = baseSlice;
|
|
449
|
-
|
|
450
424
|
/**
|
|
451
425
|
* Casts `array` to a slice if it's needed.
|
|
452
426
|
*
|
|
@@ -459,11 +433,9 @@
|
|
|
459
433
|
function castSlice(array, start, end) {
|
|
460
434
|
var length = array.length;
|
|
461
435
|
end = end === undefined ? length : end;
|
|
462
|
-
return (!start && end >= length) ? array :
|
|
436
|
+
return (!start && end >= length) ? array : baseSlice(array, start, end);
|
|
463
437
|
}
|
|
464
438
|
|
|
465
|
-
var _castSlice = castSlice;
|
|
466
|
-
|
|
467
439
|
/** Used to compose unicode character classes. */
|
|
468
440
|
var rsAstralRange$2 = '\\ud800-\\udfff',
|
|
469
441
|
rsComboMarksRange$3 = '\\u0300-\\u036f',
|
|
@@ -489,8 +461,6 @@
|
|
|
489
461
|
return reHasUnicode.test(string);
|
|
490
462
|
}
|
|
491
463
|
|
|
492
|
-
var _hasUnicode = hasUnicode;
|
|
493
|
-
|
|
494
464
|
/**
|
|
495
465
|
* Converts an ASCII `string` to an array.
|
|
496
466
|
*
|
|
@@ -502,8 +472,6 @@
|
|
|
502
472
|
return string.split('');
|
|
503
473
|
}
|
|
504
474
|
|
|
505
|
-
var _asciiToArray = asciiToArray;
|
|
506
|
-
|
|
507
475
|
/** Used to compose unicode character classes. */
|
|
508
476
|
var rsAstralRange$1 = '\\ud800-\\udfff',
|
|
509
477
|
rsComboMarksRange$2 = '\\u0300-\\u036f',
|
|
@@ -543,8 +511,6 @@
|
|
|
543
511
|
return string.match(reUnicode) || [];
|
|
544
512
|
}
|
|
545
513
|
|
|
546
|
-
var _unicodeToArray = unicodeToArray;
|
|
547
|
-
|
|
548
514
|
/**
|
|
549
515
|
* Converts `string` to an array.
|
|
550
516
|
*
|
|
@@ -553,13 +519,11 @@
|
|
|
553
519
|
* @returns {Array} Returns the converted array.
|
|
554
520
|
*/
|
|
555
521
|
function stringToArray(string) {
|
|
556
|
-
return
|
|
557
|
-
?
|
|
558
|
-
:
|
|
522
|
+
return hasUnicode(string)
|
|
523
|
+
? unicodeToArray(string)
|
|
524
|
+
: asciiToArray(string);
|
|
559
525
|
}
|
|
560
526
|
|
|
561
|
-
var _stringToArray = stringToArray;
|
|
562
|
-
|
|
563
527
|
/**
|
|
564
528
|
* Creates a function like `_.lowerFirst`.
|
|
565
529
|
*
|
|
@@ -569,10 +533,10 @@
|
|
|
569
533
|
*/
|
|
570
534
|
function createCaseFirst(methodName) {
|
|
571
535
|
return function(string) {
|
|
572
|
-
string =
|
|
536
|
+
string = toString(string);
|
|
573
537
|
|
|
574
|
-
var strSymbols =
|
|
575
|
-
?
|
|
538
|
+
var strSymbols = hasUnicode(string)
|
|
539
|
+
? stringToArray(string)
|
|
576
540
|
: undefined;
|
|
577
541
|
|
|
578
542
|
var chr = strSymbols
|
|
@@ -580,15 +544,13 @@
|
|
|
580
544
|
: string.charAt(0);
|
|
581
545
|
|
|
582
546
|
var trailing = strSymbols
|
|
583
|
-
?
|
|
547
|
+
? castSlice(strSymbols, 1).join('')
|
|
584
548
|
: string.slice(1);
|
|
585
549
|
|
|
586
550
|
return chr[methodName]() + trailing;
|
|
587
551
|
};
|
|
588
552
|
}
|
|
589
553
|
|
|
590
|
-
var _createCaseFirst = createCaseFirst;
|
|
591
|
-
|
|
592
554
|
/**
|
|
593
555
|
* Converts the first character of `string` to upper case.
|
|
594
556
|
*
|
|
@@ -606,9 +568,9 @@
|
|
|
606
568
|
* _.upperFirst('FRED');
|
|
607
569
|
* // => 'FRED'
|
|
608
570
|
*/
|
|
609
|
-
var upperFirst =
|
|
571
|
+
var upperFirst = createCaseFirst('toUpperCase');
|
|
610
572
|
|
|
611
|
-
var
|
|
573
|
+
var upperFirst$1 = upperFirst;
|
|
612
574
|
|
|
613
575
|
/**
|
|
614
576
|
* Converts the first character of `string` to upper case and the remaining
|
|
@@ -626,11 +588,9 @@
|
|
|
626
588
|
* // => 'Fred'
|
|
627
589
|
*/
|
|
628
590
|
function capitalize(string) {
|
|
629
|
-
return
|
|
591
|
+
return upperFirst$1(toString(string).toLowerCase());
|
|
630
592
|
}
|
|
631
593
|
|
|
632
|
-
var capitalize_1 = capitalize;
|
|
633
|
-
|
|
634
594
|
/**
|
|
635
595
|
* A specialized version of `_.reduce` for arrays without support for
|
|
636
596
|
* iteratee shorthands.
|
|
@@ -656,8 +616,6 @@
|
|
|
656
616
|
return accumulator;
|
|
657
617
|
}
|
|
658
618
|
|
|
659
|
-
var _arrayReduce = arrayReduce;
|
|
660
|
-
|
|
661
619
|
/**
|
|
662
620
|
* The base implementation of `_.propertyOf` without support for deep paths.
|
|
663
621
|
*
|
|
@@ -671,8 +629,6 @@
|
|
|
671
629
|
};
|
|
672
630
|
}
|
|
673
631
|
|
|
674
|
-
var _basePropertyOf = basePropertyOf;
|
|
675
|
-
|
|
676
632
|
/** Used to map Latin Unicode letters to basic Latin letters. */
|
|
677
633
|
var deburredLetters = {
|
|
678
634
|
// Latin-1 Supplement block.
|
|
@@ -739,9 +695,9 @@
|
|
|
739
695
|
* @param {string} letter The matched letter to deburr.
|
|
740
696
|
* @returns {string} Returns the deburred letter.
|
|
741
697
|
*/
|
|
742
|
-
var deburrLetter =
|
|
698
|
+
var deburrLetter = basePropertyOf(deburredLetters);
|
|
743
699
|
|
|
744
|
-
var
|
|
700
|
+
var deburrLetter$1 = deburrLetter;
|
|
745
701
|
|
|
746
702
|
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
|
747
703
|
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
@@ -780,12 +736,10 @@
|
|
|
780
736
|
* // => 'deja vu'
|
|
781
737
|
*/
|
|
782
738
|
function deburr(string) {
|
|
783
|
-
string =
|
|
784
|
-
return string && string.replace(reLatin,
|
|
739
|
+
string = toString(string);
|
|
740
|
+
return string && string.replace(reLatin, deburrLetter$1).replace(reComboMark, '');
|
|
785
741
|
}
|
|
786
742
|
|
|
787
|
-
var deburr_1 = deburr;
|
|
788
|
-
|
|
789
743
|
/** Used to match words composed of alphanumeric characters. */
|
|
790
744
|
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
791
745
|
|
|
@@ -800,8 +754,6 @@
|
|
|
800
754
|
return string.match(reAsciiWord) || [];
|
|
801
755
|
}
|
|
802
756
|
|
|
803
|
-
var _asciiWords = asciiWords;
|
|
804
|
-
|
|
805
757
|
/** Used to detect strings that need a more robust regexp to match words. */
|
|
806
758
|
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
|
807
759
|
|
|
@@ -816,8 +768,6 @@
|
|
|
816
768
|
return reHasUnicodeWord.test(string);
|
|
817
769
|
}
|
|
818
770
|
|
|
819
|
-
var _hasUnicodeWord = hasUnicodeWord;
|
|
820
|
-
|
|
821
771
|
/** Used to compose unicode character classes. */
|
|
822
772
|
var rsAstralRange = '\\ud800-\\udfff',
|
|
823
773
|
rsComboMarksRange = '\\u0300-\\u036f',
|
|
@@ -886,8 +836,6 @@
|
|
|
886
836
|
return string.match(reUnicodeWord) || [];
|
|
887
837
|
}
|
|
888
838
|
|
|
889
|
-
var _unicodeWords = unicodeWords;
|
|
890
|
-
|
|
891
839
|
/**
|
|
892
840
|
* Splits `string` into an array of its words.
|
|
893
841
|
*
|
|
@@ -908,17 +856,15 @@
|
|
|
908
856
|
* // => ['fred', 'barney', '&', 'pebbles']
|
|
909
857
|
*/
|
|
910
858
|
function words(string, pattern, guard) {
|
|
911
|
-
string =
|
|
859
|
+
string = toString(string);
|
|
912
860
|
pattern = guard ? undefined : pattern;
|
|
913
861
|
|
|
914
862
|
if (pattern === undefined) {
|
|
915
|
-
return
|
|
863
|
+
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
|
916
864
|
}
|
|
917
865
|
return string.match(pattern) || [];
|
|
918
866
|
}
|
|
919
867
|
|
|
920
|
-
var words_1 = words;
|
|
921
|
-
|
|
922
868
|
/** Used to compose unicode capture groups. */
|
|
923
869
|
var rsApos = "['\u2019]";
|
|
924
870
|
|
|
@@ -934,12 +880,10 @@
|
|
|
934
880
|
*/
|
|
935
881
|
function createCompounder(callback) {
|
|
936
882
|
return function(string) {
|
|
937
|
-
return
|
|
883
|
+
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
|
938
884
|
};
|
|
939
885
|
}
|
|
940
886
|
|
|
941
|
-
var _createCompounder = createCompounder;
|
|
942
|
-
|
|
943
887
|
/**
|
|
944
888
|
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
|
945
889
|
*
|
|
@@ -960,12 +904,12 @@
|
|
|
960
904
|
* _.camelCase('__FOO_BAR__');
|
|
961
905
|
* // => 'fooBar'
|
|
962
906
|
*/
|
|
963
|
-
var camelCase =
|
|
907
|
+
var camelCase = createCompounder(function(result, word, index) {
|
|
964
908
|
word = word.toLowerCase();
|
|
965
|
-
return result + (index ?
|
|
909
|
+
return result + (index ? capitalize(word) : word);
|
|
966
910
|
});
|
|
967
911
|
|
|
968
|
-
var
|
|
912
|
+
var camelCase$1 = camelCase;
|
|
969
913
|
|
|
970
914
|
/**
|
|
971
915
|
* Converts `string` to
|
|
@@ -988,11 +932,11 @@
|
|
|
988
932
|
* _.snakeCase('--FOO-BAR--');
|
|
989
933
|
* // => 'foo_bar'
|
|
990
934
|
*/
|
|
991
|
-
var snakeCase =
|
|
935
|
+
var snakeCase = createCompounder(function(result, word, index) {
|
|
992
936
|
return result + (index ? '_' : '') + word.toLowerCase();
|
|
993
937
|
});
|
|
994
938
|
|
|
995
|
-
var
|
|
939
|
+
var snakeCase$1 = snakeCase;
|
|
996
940
|
|
|
997
941
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
998
942
|
const isUuid = (value) => {
|
|
@@ -1005,7 +949,7 @@
|
|
|
1005
949
|
return data;
|
|
1006
950
|
return Object.keys(data).reduce((result, key) => {
|
|
1007
951
|
const value = snakeCaseToCamelCase(data[key]);
|
|
1008
|
-
const keyValue = isUuid(key) ? key :
|
|
952
|
+
const keyValue = isUuid(key) ? key : camelCase$1(key);
|
|
1009
953
|
return { ...result, [keyValue]: value };
|
|
1010
954
|
}, {});
|
|
1011
955
|
};
|
|
@@ -1016,10 +960,15 @@
|
|
|
1016
960
|
return data;
|
|
1017
961
|
return Object.keys(data).reduce((result, key) => {
|
|
1018
962
|
const value = camelCaseToSnakeCase(data[key]);
|
|
1019
|
-
return { ...result, [
|
|
963
|
+
return { ...result, [snakeCase$1(key)]: value };
|
|
1020
964
|
}, {});
|
|
1021
965
|
};
|
|
1022
966
|
|
|
967
|
+
function createCommonjsModule(fn) {
|
|
968
|
+
var module = { exports: {} };
|
|
969
|
+
return fn(module, module.exports), module.exports;
|
|
970
|
+
}
|
|
971
|
+
|
|
1023
972
|
var eventemitter3 = createCommonjsModule(function (module) {
|
|
1024
973
|
|
|
1025
974
|
var has = Object.prototype.hasOwnProperty
|
|
@@ -1948,7 +1897,7 @@
|
|
|
1948
1897
|
}
|
|
1949
1898
|
}
|
|
1950
1899
|
|
|
1951
|
-
const LIB_VERSION = "1.2.
|
|
1900
|
+
const LIB_VERSION = "1.2.3";
|
|
1952
1901
|
|
|
1953
1902
|
const getBridge = () => {
|
|
1954
1903
|
if (process.env.NODE_ENV === 'test')
|
|
@@ -1992,7 +1941,21 @@
|
|
|
1992
1941
|
METHODS["REQUEST_SELF_PROFILE"] = "request_self_profile";
|
|
1993
1942
|
METHODS["CLOSE_SMART_APP"] = "close_smart_app";
|
|
1994
1943
|
METHODS["OPEN_FILE"] = "open_file";
|
|
1944
|
+
METHODS["SUBSCRIBE_CLIENT_EVENTS"] = "subscribe_client_events";
|
|
1945
|
+
METHODS["UNSUBSCRIBE_CLIENT_EVENTS"] = "unsubscribe_client_events";
|
|
1946
|
+
METHODS["GET_CONNECTION_STATUS"] = "get_connection_status";
|
|
1947
|
+
METHODS["CREATE_DEEPLINK"] = "create_deeplink";
|
|
1995
1948
|
})(METHODS || (METHODS = {}));
|
|
1949
|
+
var STATUS;
|
|
1950
|
+
(function (STATUS) {
|
|
1951
|
+
STATUS["SUCCESS"] = "success";
|
|
1952
|
+
STATUS["ERROR"] = "error";
|
|
1953
|
+
})(STATUS || (STATUS = {}));
|
|
1954
|
+
var ERROR_CODES;
|
|
1955
|
+
(function (ERROR_CODES) {
|
|
1956
|
+
ERROR_CODES["NO_BRIDGE"] = "no_bridge";
|
|
1957
|
+
ERROR_CODES["SUBSCRIPTION_NOT_FOUND"] = "subscription_not_found";
|
|
1958
|
+
})(ERROR_CODES || (ERROR_CODES = {}));
|
|
1996
1959
|
|
|
1997
1960
|
var LOCATION;
|
|
1998
1961
|
(function (LOCATION) {
|
|
@@ -2000,6 +1963,79 @@
|
|
|
2000
1963
|
LOCATION["NESTED"] = "nested";
|
|
2001
1964
|
})(LOCATION || (LOCATION = {}));
|
|
2002
1965
|
|
|
1966
|
+
var SubscriptionEventType;
|
|
1967
|
+
(function (SubscriptionEventType) {
|
|
1968
|
+
SubscriptionEventType["CONNECTION_STATUS"] = "connection_status";
|
|
1969
|
+
})(SubscriptionEventType || (SubscriptionEventType = {}));
|
|
1970
|
+
|
|
1971
|
+
const subscriptions = [];
|
|
1972
|
+
let bridgeEventListenerInstalled = false;
|
|
1973
|
+
const isAnySubscriptionsOfType = (eventType) => {
|
|
1974
|
+
return subscriptions.some(sub => sub.eventType == eventType);
|
|
1975
|
+
};
|
|
1976
|
+
const installBridgeEventListener = () => {
|
|
1977
|
+
if (bridgeEventListenerInstalled || !bridge)
|
|
1978
|
+
return;
|
|
1979
|
+
bridgeEventListenerInstalled = true;
|
|
1980
|
+
bridge.onReceive(event => {
|
|
1981
|
+
subscriptions.filter(sub => sub.eventType === event.type).map(sub => sub.callback(event));
|
|
1982
|
+
});
|
|
1983
|
+
};
|
|
1984
|
+
/**
|
|
1985
|
+
* Subscribe to special client events
|
|
1986
|
+
* @param eventType Event from SubscriptionEventType enum to be subscribed
|
|
1987
|
+
* @param callback Function to be handled when event is coming
|
|
1988
|
+
* @returns Promise that'll be fullfilled on successful subscription, otherwise rejected with reason
|
|
1989
|
+
*/
|
|
1990
|
+
const subscribeClientEvents = (eventType, callback) => {
|
|
1991
|
+
const successResponse = { status: STATUS.SUCCESS };
|
|
1992
|
+
// No need to subscribe event twice on client
|
|
1993
|
+
if (isAnySubscriptionsOfType(eventType)) {
|
|
1994
|
+
subscriptions.push({ eventType, callback });
|
|
1995
|
+
return Promise.resolve(successResponse);
|
|
1996
|
+
}
|
|
1997
|
+
if (!bridge)
|
|
1998
|
+
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
1999
|
+
return bridge
|
|
2000
|
+
.sendClientEvent({
|
|
2001
|
+
method: METHODS.SUBSCRIBE_CLIENT_EVENTS,
|
|
2002
|
+
params: {
|
|
2003
|
+
event: eventType,
|
|
2004
|
+
},
|
|
2005
|
+
})
|
|
2006
|
+
.then(() => {
|
|
2007
|
+
installBridgeEventListener();
|
|
2008
|
+
subscriptions.push({ eventType, callback });
|
|
2009
|
+
return successResponse;
|
|
2010
|
+
});
|
|
2011
|
+
};
|
|
2012
|
+
/**
|
|
2013
|
+
* Unsubscribe from previously subscribed client events
|
|
2014
|
+
* @param eventType Event from SubscriptionEventType enum to be unsubscribed
|
|
2015
|
+
* @param callback Function to be unsibscribed
|
|
2016
|
+
* @returns Promise that'll be fullfilled on successful unsubscription, otherwise rejected with reason
|
|
2017
|
+
*/
|
|
2018
|
+
const unsubscribeClientEvents = (eventType, callback) => {
|
|
2019
|
+
const successResponse = { status: STATUS.SUCCESS };
|
|
2020
|
+
const index = subscriptions.findIndex(sub => sub.eventType == eventType && sub.callback == callback);
|
|
2021
|
+
if (!bridge)
|
|
2022
|
+
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2023
|
+
if (index == -1)
|
|
2024
|
+
return Promise.reject(ERROR_CODES.SUBSCRIPTION_NOT_FOUND);
|
|
2025
|
+
subscriptions.splice(index, 1);
|
|
2026
|
+
// Send unsubscribe to client only at last subscription
|
|
2027
|
+
if (isAnySubscriptionsOfType(eventType))
|
|
2028
|
+
return Promise.resolve(successResponse);
|
|
2029
|
+
return bridge
|
|
2030
|
+
.sendClientEvent({
|
|
2031
|
+
method: METHODS.UNSUBSCRIBE_CLIENT_EVENTS,
|
|
2032
|
+
params: {
|
|
2033
|
+
event: eventType,
|
|
2034
|
+
},
|
|
2035
|
+
})
|
|
2036
|
+
.then(() => successResponse);
|
|
2037
|
+
};
|
|
2038
|
+
|
|
2003
2039
|
const openClientSettings = () => {
|
|
2004
2040
|
return bridge?.sendClientEvent({
|
|
2005
2041
|
method: METHODS.OPEN_CLIENT_SETTINGS,
|
|
@@ -2050,6 +2086,34 @@
|
|
|
2050
2086
|
params: {},
|
|
2051
2087
|
});
|
|
2052
2088
|
};
|
|
2089
|
+
/**
|
|
2090
|
+
* Get client current connection status. It's based on client's WebSocket connection state.
|
|
2091
|
+
* @returns Promise that'll be fullfilled with status data on success, otherwise rejected with reason
|
|
2092
|
+
*/
|
|
2093
|
+
const getConnectionStatus = async () => {
|
|
2094
|
+
if (!bridge)
|
|
2095
|
+
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2096
|
+
const response = await bridge.sendClientEvent({
|
|
2097
|
+
method: METHODS.GET_CONNECTION_STATUS,
|
|
2098
|
+
params: {},
|
|
2099
|
+
});
|
|
2100
|
+
return response;
|
|
2101
|
+
};
|
|
2102
|
+
/**
|
|
2103
|
+
* Create deeplink URL to open SmartApp
|
|
2104
|
+
* @param appId ID of SmartApp
|
|
2105
|
+
* @param meta Array of params to be included in deeplink
|
|
2106
|
+
* @returns Promise that'll be fullfilled with deeplink data on success, otherwise rejected with reason
|
|
2107
|
+
*/
|
|
2108
|
+
const createDeeplink = async (appId, meta) => {
|
|
2109
|
+
if (!bridge)
|
|
2110
|
+
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2111
|
+
const response = await bridge.sendClientEvent({
|
|
2112
|
+
method: METHODS.CREATE_DEEPLINK,
|
|
2113
|
+
params: { appId, meta },
|
|
2114
|
+
});
|
|
2115
|
+
return response;
|
|
2116
|
+
};
|
|
2053
2117
|
|
|
2054
2118
|
const addContact = ({ phone, name }) => {
|
|
2055
2119
|
return bridge?.sendClientEvent({
|
|
@@ -2116,8 +2180,10 @@
|
|
|
2116
2180
|
const ready = async (timeout) => {
|
|
2117
2181
|
const response = await bridgeSendReady(timeout);
|
|
2118
2182
|
const isLogsEnabled = response?.payload?.logsEnabled;
|
|
2183
|
+
if (!bridge)
|
|
2184
|
+
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2119
2185
|
if (isLogsEnabled)
|
|
2120
|
-
bridge
|
|
2186
|
+
bridge.enableLogs?.();
|
|
2121
2187
|
return response;
|
|
2122
2188
|
};
|
|
2123
2189
|
|
|
@@ -2175,9 +2241,11 @@
|
|
|
2175
2241
|
exports.Bridge = bridge;
|
|
2176
2242
|
exports.addContact = addContact;
|
|
2177
2243
|
exports.closeSmartApp = closeSmartApp;
|
|
2244
|
+
exports.createDeeplink = createDeeplink;
|
|
2178
2245
|
exports.createPersonalChat = createPersonalChat;
|
|
2179
2246
|
exports.exitSmartAppToCatalog = exitSmartAppToCatalog;
|
|
2180
2247
|
exports.getChats = getChats;
|
|
2248
|
+
exports.getConnectionStatus = getConnectionStatus;
|
|
2181
2249
|
exports.getContact = getContact;
|
|
2182
2250
|
exports.onBackPressed = onBackPressed;
|
|
2183
2251
|
exports.onMoveToRoot = onMoveToRoot;
|
|
@@ -2194,6 +2262,8 @@
|
|
|
2194
2262
|
exports.searchCorporatePhonebook = searchCorporatePhonebook;
|
|
2195
2263
|
exports.sendBotCommand = sendBotCommand;
|
|
2196
2264
|
exports.sendMessage = sendMessage;
|
|
2265
|
+
exports.subscribeClientEvents = subscribeClientEvents;
|
|
2266
|
+
exports.unsubscribeClientEvents = unsubscribeClientEvents;
|
|
2197
2267
|
exports.useQuery = useQuery;
|
|
2198
2268
|
|
|
2199
2269
|
Object.defineProperty(exports, '__esModule', { value: true });
|