@expressms/smartapp-sdk 1.2.8 → 1.3.2
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 +33 -0
- package/build/main/index.d.ts +2 -2
- package/build/main/index.js +7 -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 +19 -1
- package/build/main/lib/client/index.js +54 -2
- package/build/main/lib/contacts/index.d.ts +2 -1
- package/build/main/lib/contacts/index.js +1 -1
- package/build/main/lib/index.d.ts +4 -1
- package/build/main/lib/index.js +4 -1
- package/build/main/lib/logging/index.d.ts +2 -2
- package/build/main/lib/logging/index.js +6 -3
- package/build/main/lib/notification/index.d.ts +3 -0
- package/build/main/lib/notification/index.js +4 -1
- package/build/main/types/bridge.d.ts +31 -3
- package/build/main/types/bridge.js +17 -2
- package/build/main/types/client.d.ts +19 -0
- package/build/main/types/client.js +8 -0
- package/build/main/types/contacts.d.ts +2 -2
- package/build/main/types/index.d.ts +4 -2
- 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 +19 -1
- package/build/module/lib/client/index.js +38 -3
- package/build/module/lib/contacts/index.d.ts +2 -1
- package/build/module/lib/contacts/index.js +1 -1
- package/build/module/lib/index.d.ts +4 -1
- package/build/module/lib/index.js +6 -3
- package/build/module/lib/logging/index.d.ts +2 -2
- package/build/module/lib/logging/index.js +7 -4
- package/build/module/lib/notification/index.d.ts +3 -0
- package/build/module/lib/notification/index.js +6 -3
- package/build/module/lib/routing/index.js +1 -1
- package/build/module/types/bridge.d.ts +31 -3
- package/build/module/types/bridge.js +16 -1
- package/build/module/types/client.d.ts +19 -0
- package/build/module/types/client.js +5 -0
- package/build/module/types/contacts.d.ts +2 -2
- package/build/module/types/index.d.ts +4 -2
- package/build/module/types/index.js +5 -3
- package/build/umd/index.js +152 -871
- package/package.json +2 -2
package/build/umd/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SmartAppBridge = {}));
|
|
5
|
-
})(this, (function (exports) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash/camelCase'), require('lodash/snakeCase')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'lodash/camelCase', 'lodash/snakeCase'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SmartAppBridge = {}, global.camelCase, global.snakeCase));
|
|
5
|
+
})(this, (function (exports, camelCase, snakeCase) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var camelCase__default = /*#__PURE__*/_interopDefaultLegacy(camelCase);
|
|
10
|
+
var snakeCase__default = /*#__PURE__*/_interopDefaultLegacy(snakeCase);
|
|
6
11
|
|
|
7
12
|
var PLATFORM;
|
|
8
13
|
(function (PLATFORM) {
|
|
@@ -130,870 +135,6 @@
|
|
|
130
135
|
return stringify(rnds);
|
|
131
136
|
}
|
|
132
137
|
|
|
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
|
-
/** Detect free variable `global` from Node.js. */
|
|
141
|
-
|
|
142
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
143
|
-
|
|
144
|
-
var _freeGlobal = freeGlobal;
|
|
145
|
-
|
|
146
|
-
/** Detect free variable `self`. */
|
|
147
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
148
|
-
|
|
149
|
-
/** Used as a reference to the global object. */
|
|
150
|
-
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
151
|
-
|
|
152
|
-
var _root = root;
|
|
153
|
-
|
|
154
|
-
/** Built-in value references. */
|
|
155
|
-
var Symbol = _root.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;
|
|
205
|
-
|
|
206
|
-
var isArray_1 = isArray;
|
|
207
|
-
|
|
208
|
-
/** Used for built-in method references. */
|
|
209
|
-
var objectProto$1 = Object.prototype;
|
|
210
|
-
|
|
211
|
-
/** Used to check objects for own properties. */
|
|
212
|
-
var hasOwnProperty = objectProto$1.hasOwnProperty;
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Used to resolve the
|
|
216
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
217
|
-
* of values.
|
|
218
|
-
*/
|
|
219
|
-
var nativeObjectToString$1 = objectProto$1.toString;
|
|
220
|
-
|
|
221
|
-
/** Built-in value references. */
|
|
222
|
-
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
226
|
-
*
|
|
227
|
-
* @private
|
|
228
|
-
* @param {*} value The value to query.
|
|
229
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
230
|
-
*/
|
|
231
|
-
function getRawTag(value) {
|
|
232
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag$1),
|
|
233
|
-
tag = value[symToStringTag$1];
|
|
234
|
-
|
|
235
|
-
try {
|
|
236
|
-
value[symToStringTag$1] = undefined;
|
|
237
|
-
var unmasked = true;
|
|
238
|
-
} catch (e) {}
|
|
239
|
-
|
|
240
|
-
var result = nativeObjectToString$1.call(value);
|
|
241
|
-
if (unmasked) {
|
|
242
|
-
if (isOwn) {
|
|
243
|
-
value[symToStringTag$1] = tag;
|
|
244
|
-
} else {
|
|
245
|
-
delete value[symToStringTag$1];
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return result;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
var _getRawTag = getRawTag;
|
|
252
|
-
|
|
253
|
-
/** Used for built-in method references. */
|
|
254
|
-
var objectProto = Object.prototype;
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Used to resolve the
|
|
258
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
259
|
-
* of values.
|
|
260
|
-
*/
|
|
261
|
-
var nativeObjectToString = objectProto.toString;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
265
|
-
*
|
|
266
|
-
* @private
|
|
267
|
-
* @param {*} value The value to convert.
|
|
268
|
-
* @returns {string} Returns the converted string.
|
|
269
|
-
*/
|
|
270
|
-
function objectToString(value) {
|
|
271
|
-
return nativeObjectToString.call(value);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
var _objectToString = objectToString;
|
|
275
|
-
|
|
276
|
-
/** `Object#toString` result references. */
|
|
277
|
-
var nullTag = '[object Null]',
|
|
278
|
-
undefinedTag = '[object Undefined]';
|
|
279
|
-
|
|
280
|
-
/** Built-in value references. */
|
|
281
|
-
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
285
|
-
*
|
|
286
|
-
* @private
|
|
287
|
-
* @param {*} value The value to query.
|
|
288
|
-
* @returns {string} Returns the `toStringTag`.
|
|
289
|
-
*/
|
|
290
|
-
function baseGetTag(value) {
|
|
291
|
-
if (value == null) {
|
|
292
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
293
|
-
}
|
|
294
|
-
return (symToStringTag && symToStringTag in Object(value))
|
|
295
|
-
? _getRawTag(value)
|
|
296
|
-
: _objectToString(value);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
var _baseGetTag = baseGetTag;
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
303
|
-
* and has a `typeof` result of "object".
|
|
304
|
-
*
|
|
305
|
-
* @static
|
|
306
|
-
* @memberOf _
|
|
307
|
-
* @since 4.0.0
|
|
308
|
-
* @category Lang
|
|
309
|
-
* @param {*} value The value to check.
|
|
310
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
311
|
-
* @example
|
|
312
|
-
*
|
|
313
|
-
* _.isObjectLike({});
|
|
314
|
-
* // => true
|
|
315
|
-
*
|
|
316
|
-
* _.isObjectLike([1, 2, 3]);
|
|
317
|
-
* // => true
|
|
318
|
-
*
|
|
319
|
-
* _.isObjectLike(_.noop);
|
|
320
|
-
* // => false
|
|
321
|
-
*
|
|
322
|
-
* _.isObjectLike(null);
|
|
323
|
-
* // => false
|
|
324
|
-
*/
|
|
325
|
-
function isObjectLike(value) {
|
|
326
|
-
return value != null && typeof value == 'object';
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
var isObjectLike_1 = isObjectLike;
|
|
330
|
-
|
|
331
|
-
/** `Object#toString` result references. */
|
|
332
|
-
var symbolTag = '[object Symbol]';
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
336
|
-
*
|
|
337
|
-
* @static
|
|
338
|
-
* @memberOf _
|
|
339
|
-
* @since 4.0.0
|
|
340
|
-
* @category Lang
|
|
341
|
-
* @param {*} value The value to check.
|
|
342
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
343
|
-
* @example
|
|
344
|
-
*
|
|
345
|
-
* _.isSymbol(Symbol.iterator);
|
|
346
|
-
* // => true
|
|
347
|
-
*
|
|
348
|
-
* _.isSymbol('abc');
|
|
349
|
-
* // => false
|
|
350
|
-
*/
|
|
351
|
-
function isSymbol(value) {
|
|
352
|
-
return typeof value == 'symbol' ||
|
|
353
|
-
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
var isSymbol_1 = isSymbol;
|
|
357
|
-
|
|
358
|
-
/** Used as references for various `Number` constants. */
|
|
359
|
-
var INFINITY = 1 / 0;
|
|
360
|
-
|
|
361
|
-
/** Used to convert symbols to primitives and strings. */
|
|
362
|
-
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
363
|
-
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* The base implementation of `_.toString` which doesn't convert nullish
|
|
367
|
-
* values to empty strings.
|
|
368
|
-
*
|
|
369
|
-
* @private
|
|
370
|
-
* @param {*} value The value to process.
|
|
371
|
-
* @returns {string} Returns the string.
|
|
372
|
-
*/
|
|
373
|
-
function baseToString(value) {
|
|
374
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
375
|
-
if (typeof value == 'string') {
|
|
376
|
-
return value;
|
|
377
|
-
}
|
|
378
|
-
if (isArray_1(value)) {
|
|
379
|
-
// Recursively convert values (susceptible to call stack limits).
|
|
380
|
-
return _arrayMap(value, baseToString) + '';
|
|
381
|
-
}
|
|
382
|
-
if (isSymbol_1(value)) {
|
|
383
|
-
return symbolToString ? symbolToString.call(value) : '';
|
|
384
|
-
}
|
|
385
|
-
var result = (value + '');
|
|
386
|
-
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
var _baseToString = baseToString;
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Converts `value` to a string. An empty string is returned for `null`
|
|
393
|
-
* and `undefined` values. The sign of `-0` is preserved.
|
|
394
|
-
*
|
|
395
|
-
* @static
|
|
396
|
-
* @memberOf _
|
|
397
|
-
* @since 4.0.0
|
|
398
|
-
* @category Lang
|
|
399
|
-
* @param {*} value The value to convert.
|
|
400
|
-
* @returns {string} Returns the converted string.
|
|
401
|
-
* @example
|
|
402
|
-
*
|
|
403
|
-
* _.toString(null);
|
|
404
|
-
* // => ''
|
|
405
|
-
*
|
|
406
|
-
* _.toString(-0);
|
|
407
|
-
* // => '-0'
|
|
408
|
-
*
|
|
409
|
-
* _.toString([1, 2, 3]);
|
|
410
|
-
* // => '1,2,3'
|
|
411
|
-
*/
|
|
412
|
-
function toString(value) {
|
|
413
|
-
return value == null ? '' : _baseToString(value);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
var toString_1 = toString;
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* The base implementation of `_.slice` without an iteratee call guard.
|
|
420
|
-
*
|
|
421
|
-
* @private
|
|
422
|
-
* @param {Array} array The array to slice.
|
|
423
|
-
* @param {number} [start=0] The start position.
|
|
424
|
-
* @param {number} [end=array.length] The end position.
|
|
425
|
-
* @returns {Array} Returns the slice of `array`.
|
|
426
|
-
*/
|
|
427
|
-
function baseSlice(array, start, end) {
|
|
428
|
-
var index = -1,
|
|
429
|
-
length = array.length;
|
|
430
|
-
|
|
431
|
-
if (start < 0) {
|
|
432
|
-
start = -start > length ? 0 : (length + start);
|
|
433
|
-
}
|
|
434
|
-
end = end > length ? length : end;
|
|
435
|
-
if (end < 0) {
|
|
436
|
-
end += length;
|
|
437
|
-
}
|
|
438
|
-
length = start > end ? 0 : ((end - start) >>> 0);
|
|
439
|
-
start >>>= 0;
|
|
440
|
-
|
|
441
|
-
var result = Array(length);
|
|
442
|
-
while (++index < length) {
|
|
443
|
-
result[index] = array[index + start];
|
|
444
|
-
}
|
|
445
|
-
return result;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
var _baseSlice = baseSlice;
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* Casts `array` to a slice if it's needed.
|
|
452
|
-
*
|
|
453
|
-
* @private
|
|
454
|
-
* @param {Array} array The array to inspect.
|
|
455
|
-
* @param {number} start The start position.
|
|
456
|
-
* @param {number} [end=array.length] The end position.
|
|
457
|
-
* @returns {Array} Returns the cast slice.
|
|
458
|
-
*/
|
|
459
|
-
function castSlice(array, start, end) {
|
|
460
|
-
var length = array.length;
|
|
461
|
-
end = end === undefined ? length : end;
|
|
462
|
-
return (!start && end >= length) ? array : _baseSlice(array, start, end);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
var _castSlice = castSlice;
|
|
466
|
-
|
|
467
|
-
/** Used to compose unicode character classes. */
|
|
468
|
-
var rsAstralRange$2 = '\\ud800-\\udfff',
|
|
469
|
-
rsComboMarksRange$3 = '\\u0300-\\u036f',
|
|
470
|
-
reComboHalfMarksRange$3 = '\\ufe20-\\ufe2f',
|
|
471
|
-
rsComboSymbolsRange$3 = '\\u20d0-\\u20ff',
|
|
472
|
-
rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3,
|
|
473
|
-
rsVarRange$2 = '\\ufe0e\\ufe0f';
|
|
474
|
-
|
|
475
|
-
/** Used to compose unicode capture groups. */
|
|
476
|
-
var rsZWJ$2 = '\\u200d';
|
|
477
|
-
|
|
478
|
-
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
479
|
-
var reHasUnicode = RegExp('[' + rsZWJ$2 + rsAstralRange$2 + rsComboRange$3 + rsVarRange$2 + ']');
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* Checks if `string` contains Unicode symbols.
|
|
483
|
-
*
|
|
484
|
-
* @private
|
|
485
|
-
* @param {string} string The string to inspect.
|
|
486
|
-
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
|
487
|
-
*/
|
|
488
|
-
function hasUnicode(string) {
|
|
489
|
-
return reHasUnicode.test(string);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
var _hasUnicode = hasUnicode;
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* Converts an ASCII `string` to an array.
|
|
496
|
-
*
|
|
497
|
-
* @private
|
|
498
|
-
* @param {string} string The string to convert.
|
|
499
|
-
* @returns {Array} Returns the converted array.
|
|
500
|
-
*/
|
|
501
|
-
function asciiToArray(string) {
|
|
502
|
-
return string.split('');
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
var _asciiToArray = asciiToArray;
|
|
506
|
-
|
|
507
|
-
/** Used to compose unicode character classes. */
|
|
508
|
-
var rsAstralRange$1 = '\\ud800-\\udfff',
|
|
509
|
-
rsComboMarksRange$2 = '\\u0300-\\u036f',
|
|
510
|
-
reComboHalfMarksRange$2 = '\\ufe20-\\ufe2f',
|
|
511
|
-
rsComboSymbolsRange$2 = '\\u20d0-\\u20ff',
|
|
512
|
-
rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2,
|
|
513
|
-
rsVarRange$1 = '\\ufe0e\\ufe0f';
|
|
514
|
-
|
|
515
|
-
/** Used to compose unicode capture groups. */
|
|
516
|
-
var rsAstral = '[' + rsAstralRange$1 + ']',
|
|
517
|
-
rsCombo$2 = '[' + rsComboRange$2 + ']',
|
|
518
|
-
rsFitz$1 = '\\ud83c[\\udffb-\\udfff]',
|
|
519
|
-
rsModifier$1 = '(?:' + rsCombo$2 + '|' + rsFitz$1 + ')',
|
|
520
|
-
rsNonAstral$1 = '[^' + rsAstralRange$1 + ']',
|
|
521
|
-
rsRegional$1 = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
522
|
-
rsSurrPair$1 = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
523
|
-
rsZWJ$1 = '\\u200d';
|
|
524
|
-
|
|
525
|
-
/** Used to compose unicode regexes. */
|
|
526
|
-
var reOptMod$1 = rsModifier$1 + '?',
|
|
527
|
-
rsOptVar$1 = '[' + rsVarRange$1 + ']?',
|
|
528
|
-
rsOptJoin$1 = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*',
|
|
529
|
-
rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1,
|
|
530
|
-
rsSymbol = '(?:' + [rsNonAstral$1 + rsCombo$2 + '?', rsCombo$2, rsRegional$1, rsSurrPair$1, rsAstral].join('|') + ')';
|
|
531
|
-
|
|
532
|
-
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
533
|
-
var reUnicode = RegExp(rsFitz$1 + '(?=' + rsFitz$1 + ')|' + rsSymbol + rsSeq$1, 'g');
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* Converts a Unicode `string` to an array.
|
|
537
|
-
*
|
|
538
|
-
* @private
|
|
539
|
-
* @param {string} string The string to convert.
|
|
540
|
-
* @returns {Array} Returns the converted array.
|
|
541
|
-
*/
|
|
542
|
-
function unicodeToArray(string) {
|
|
543
|
-
return string.match(reUnicode) || [];
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
var _unicodeToArray = unicodeToArray;
|
|
547
|
-
|
|
548
|
-
/**
|
|
549
|
-
* Converts `string` to an array.
|
|
550
|
-
*
|
|
551
|
-
* @private
|
|
552
|
-
* @param {string} string The string to convert.
|
|
553
|
-
* @returns {Array} Returns the converted array.
|
|
554
|
-
*/
|
|
555
|
-
function stringToArray(string) {
|
|
556
|
-
return _hasUnicode(string)
|
|
557
|
-
? _unicodeToArray(string)
|
|
558
|
-
: _asciiToArray(string);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
var _stringToArray = stringToArray;
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Creates a function like `_.lowerFirst`.
|
|
565
|
-
*
|
|
566
|
-
* @private
|
|
567
|
-
* @param {string} methodName The name of the `String` case method to use.
|
|
568
|
-
* @returns {Function} Returns the new case function.
|
|
569
|
-
*/
|
|
570
|
-
function createCaseFirst(methodName) {
|
|
571
|
-
return function(string) {
|
|
572
|
-
string = toString_1(string);
|
|
573
|
-
|
|
574
|
-
var strSymbols = _hasUnicode(string)
|
|
575
|
-
? _stringToArray(string)
|
|
576
|
-
: undefined;
|
|
577
|
-
|
|
578
|
-
var chr = strSymbols
|
|
579
|
-
? strSymbols[0]
|
|
580
|
-
: string.charAt(0);
|
|
581
|
-
|
|
582
|
-
var trailing = strSymbols
|
|
583
|
-
? _castSlice(strSymbols, 1).join('')
|
|
584
|
-
: string.slice(1);
|
|
585
|
-
|
|
586
|
-
return chr[methodName]() + trailing;
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
var _createCaseFirst = createCaseFirst;
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Converts the first character of `string` to upper case.
|
|
594
|
-
*
|
|
595
|
-
* @static
|
|
596
|
-
* @memberOf _
|
|
597
|
-
* @since 4.0.0
|
|
598
|
-
* @category String
|
|
599
|
-
* @param {string} [string=''] The string to convert.
|
|
600
|
-
* @returns {string} Returns the converted string.
|
|
601
|
-
* @example
|
|
602
|
-
*
|
|
603
|
-
* _.upperFirst('fred');
|
|
604
|
-
* // => 'Fred'
|
|
605
|
-
*
|
|
606
|
-
* _.upperFirst('FRED');
|
|
607
|
-
* // => 'FRED'
|
|
608
|
-
*/
|
|
609
|
-
var upperFirst = _createCaseFirst('toUpperCase');
|
|
610
|
-
|
|
611
|
-
var upperFirst_1 = upperFirst;
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Converts the first character of `string` to upper case and the remaining
|
|
615
|
-
* to lower case.
|
|
616
|
-
*
|
|
617
|
-
* @static
|
|
618
|
-
* @memberOf _
|
|
619
|
-
* @since 3.0.0
|
|
620
|
-
* @category String
|
|
621
|
-
* @param {string} [string=''] The string to capitalize.
|
|
622
|
-
* @returns {string} Returns the capitalized string.
|
|
623
|
-
* @example
|
|
624
|
-
*
|
|
625
|
-
* _.capitalize('FRED');
|
|
626
|
-
* // => 'Fred'
|
|
627
|
-
*/
|
|
628
|
-
function capitalize(string) {
|
|
629
|
-
return upperFirst_1(toString_1(string).toLowerCase());
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
var capitalize_1 = capitalize;
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
* A specialized version of `_.reduce` for arrays without support for
|
|
636
|
-
* iteratee shorthands.
|
|
637
|
-
*
|
|
638
|
-
* @private
|
|
639
|
-
* @param {Array} [array] The array to iterate over.
|
|
640
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
641
|
-
* @param {*} [accumulator] The initial value.
|
|
642
|
-
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
|
643
|
-
* the initial value.
|
|
644
|
-
* @returns {*} Returns the accumulated value.
|
|
645
|
-
*/
|
|
646
|
-
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
647
|
-
var index = -1,
|
|
648
|
-
length = array == null ? 0 : array.length;
|
|
649
|
-
|
|
650
|
-
if (initAccum && length) {
|
|
651
|
-
accumulator = array[++index];
|
|
652
|
-
}
|
|
653
|
-
while (++index < length) {
|
|
654
|
-
accumulator = iteratee(accumulator, array[index], index, array);
|
|
655
|
-
}
|
|
656
|
-
return accumulator;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
var _arrayReduce = arrayReduce;
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
* The base implementation of `_.propertyOf` without support for deep paths.
|
|
663
|
-
*
|
|
664
|
-
* @private
|
|
665
|
-
* @param {Object} object The object to query.
|
|
666
|
-
* @returns {Function} Returns the new accessor function.
|
|
667
|
-
*/
|
|
668
|
-
function basePropertyOf(object) {
|
|
669
|
-
return function(key) {
|
|
670
|
-
return object == null ? undefined : object[key];
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
var _basePropertyOf = basePropertyOf;
|
|
675
|
-
|
|
676
|
-
/** Used to map Latin Unicode letters to basic Latin letters. */
|
|
677
|
-
var deburredLetters = {
|
|
678
|
-
// Latin-1 Supplement block.
|
|
679
|
-
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
|
680
|
-
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
|
681
|
-
'\xc7': 'C', '\xe7': 'c',
|
|
682
|
-
'\xd0': 'D', '\xf0': 'd',
|
|
683
|
-
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
|
|
684
|
-
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
|
|
685
|
-
'\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
|
|
686
|
-
'\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
|
|
687
|
-
'\xd1': 'N', '\xf1': 'n',
|
|
688
|
-
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
|
|
689
|
-
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
|
|
690
|
-
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
|
|
691
|
-
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
|
|
692
|
-
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
|
693
|
-
'\xc6': 'Ae', '\xe6': 'ae',
|
|
694
|
-
'\xde': 'Th', '\xfe': 'th',
|
|
695
|
-
'\xdf': 'ss',
|
|
696
|
-
// Latin Extended-A block.
|
|
697
|
-
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
|
|
698
|
-
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
|
|
699
|
-
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
|
|
700
|
-
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
|
|
701
|
-
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
|
|
702
|
-
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
|
|
703
|
-
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
|
|
704
|
-
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
|
|
705
|
-
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
|
|
706
|
-
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
|
|
707
|
-
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
|
|
708
|
-
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
|
|
709
|
-
'\u0134': 'J', '\u0135': 'j',
|
|
710
|
-
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
|
|
711
|
-
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
|
|
712
|
-
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
|
|
713
|
-
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
|
|
714
|
-
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
|
|
715
|
-
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
|
|
716
|
-
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
|
|
717
|
-
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
|
|
718
|
-
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
|
|
719
|
-
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
|
|
720
|
-
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
|
|
721
|
-
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
|
|
722
|
-
'\u0163': 't', '\u0165': 't', '\u0167': 't',
|
|
723
|
-
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
|
|
724
|
-
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
|
|
725
|
-
'\u0174': 'W', '\u0175': 'w',
|
|
726
|
-
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
|
|
727
|
-
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
|
|
728
|
-
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
|
|
729
|
-
'\u0132': 'IJ', '\u0133': 'ij',
|
|
730
|
-
'\u0152': 'Oe', '\u0153': 'oe',
|
|
731
|
-
'\u0149': "'n", '\u017f': 's'
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
/**
|
|
735
|
-
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
|
|
736
|
-
* letters to basic Latin letters.
|
|
737
|
-
*
|
|
738
|
-
* @private
|
|
739
|
-
* @param {string} letter The matched letter to deburr.
|
|
740
|
-
* @returns {string} Returns the deburred letter.
|
|
741
|
-
*/
|
|
742
|
-
var deburrLetter = _basePropertyOf(deburredLetters);
|
|
743
|
-
|
|
744
|
-
var _deburrLetter = deburrLetter;
|
|
745
|
-
|
|
746
|
-
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
|
747
|
-
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
748
|
-
|
|
749
|
-
/** Used to compose unicode character classes. */
|
|
750
|
-
var rsComboMarksRange$1 = '\\u0300-\\u036f',
|
|
751
|
-
reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
|
|
752
|
-
rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
|
|
753
|
-
rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
|
|
754
|
-
|
|
755
|
-
/** Used to compose unicode capture groups. */
|
|
756
|
-
var rsCombo$1 = '[' + rsComboRange$1 + ']';
|
|
757
|
-
|
|
758
|
-
/**
|
|
759
|
-
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
|
760
|
-
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
|
761
|
-
*/
|
|
762
|
-
var reComboMark = RegExp(rsCombo$1, 'g');
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* Deburrs `string` by converting
|
|
766
|
-
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
|
767
|
-
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
|
768
|
-
* letters to basic Latin letters and removing
|
|
769
|
-
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
|
770
|
-
*
|
|
771
|
-
* @static
|
|
772
|
-
* @memberOf _
|
|
773
|
-
* @since 3.0.0
|
|
774
|
-
* @category String
|
|
775
|
-
* @param {string} [string=''] The string to deburr.
|
|
776
|
-
* @returns {string} Returns the deburred string.
|
|
777
|
-
* @example
|
|
778
|
-
*
|
|
779
|
-
* _.deburr('déjà vu');
|
|
780
|
-
* // => 'deja vu'
|
|
781
|
-
*/
|
|
782
|
-
function deburr(string) {
|
|
783
|
-
string = toString_1(string);
|
|
784
|
-
return string && string.replace(reLatin, _deburrLetter).replace(reComboMark, '');
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
var deburr_1 = deburr;
|
|
788
|
-
|
|
789
|
-
/** Used to match words composed of alphanumeric characters. */
|
|
790
|
-
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* Splits an ASCII `string` into an array of its words.
|
|
794
|
-
*
|
|
795
|
-
* @private
|
|
796
|
-
* @param {string} The string to inspect.
|
|
797
|
-
* @returns {Array} Returns the words of `string`.
|
|
798
|
-
*/
|
|
799
|
-
function asciiWords(string) {
|
|
800
|
-
return string.match(reAsciiWord) || [];
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
var _asciiWords = asciiWords;
|
|
804
|
-
|
|
805
|
-
/** Used to detect strings that need a more robust regexp to match words. */
|
|
806
|
-
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
|
-
|
|
808
|
-
/**
|
|
809
|
-
* Checks if `string` contains a word composed of Unicode symbols.
|
|
810
|
-
*
|
|
811
|
-
* @private
|
|
812
|
-
* @param {string} string The string to inspect.
|
|
813
|
-
* @returns {boolean} Returns `true` if a word is found, else `false`.
|
|
814
|
-
*/
|
|
815
|
-
function hasUnicodeWord(string) {
|
|
816
|
-
return reHasUnicodeWord.test(string);
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
var _hasUnicodeWord = hasUnicodeWord;
|
|
820
|
-
|
|
821
|
-
/** Used to compose unicode character classes. */
|
|
822
|
-
var rsAstralRange = '\\ud800-\\udfff',
|
|
823
|
-
rsComboMarksRange = '\\u0300-\\u036f',
|
|
824
|
-
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
|
825
|
-
rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
|
826
|
-
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
|
827
|
-
rsDingbatRange = '\\u2700-\\u27bf',
|
|
828
|
-
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
|
829
|
-
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
|
830
|
-
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
|
831
|
-
rsPunctuationRange = '\\u2000-\\u206f',
|
|
832
|
-
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
|
|
833
|
-
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
|
834
|
-
rsVarRange = '\\ufe0e\\ufe0f',
|
|
835
|
-
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
|
836
|
-
|
|
837
|
-
/** Used to compose unicode capture groups. */
|
|
838
|
-
var rsApos$1 = "['\u2019]",
|
|
839
|
-
rsBreak = '[' + rsBreakRange + ']',
|
|
840
|
-
rsCombo = '[' + rsComboRange + ']',
|
|
841
|
-
rsDigits = '\\d+',
|
|
842
|
-
rsDingbat = '[' + rsDingbatRange + ']',
|
|
843
|
-
rsLower = '[' + rsLowerRange + ']',
|
|
844
|
-
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
|
845
|
-
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
|
846
|
-
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
|
847
|
-
rsNonAstral = '[^' + rsAstralRange + ']',
|
|
848
|
-
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
849
|
-
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
850
|
-
rsUpper = '[' + rsUpperRange + ']',
|
|
851
|
-
rsZWJ = '\\u200d';
|
|
852
|
-
|
|
853
|
-
/** Used to compose unicode regexes. */
|
|
854
|
-
var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
|
|
855
|
-
rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
|
|
856
|
-
rsOptContrLower = '(?:' + rsApos$1 + '(?:d|ll|m|re|s|t|ve))?',
|
|
857
|
-
rsOptContrUpper = '(?:' + rsApos$1 + '(?:D|LL|M|RE|S|T|VE))?',
|
|
858
|
-
reOptMod = rsModifier + '?',
|
|
859
|
-
rsOptVar = '[' + rsVarRange + ']?',
|
|
860
|
-
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
|
861
|
-
rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
|
|
862
|
-
rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
|
|
863
|
-
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
|
864
|
-
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
|
|
865
|
-
|
|
866
|
-
/** Used to match complex or compound words. */
|
|
867
|
-
var reUnicodeWord = RegExp([
|
|
868
|
-
rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
|
869
|
-
rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
|
|
870
|
-
rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
|
|
871
|
-
rsUpper + '+' + rsOptContrUpper,
|
|
872
|
-
rsOrdUpper,
|
|
873
|
-
rsOrdLower,
|
|
874
|
-
rsDigits,
|
|
875
|
-
rsEmoji
|
|
876
|
-
].join('|'), 'g');
|
|
877
|
-
|
|
878
|
-
/**
|
|
879
|
-
* Splits a Unicode `string` into an array of its words.
|
|
880
|
-
*
|
|
881
|
-
* @private
|
|
882
|
-
* @param {string} The string to inspect.
|
|
883
|
-
* @returns {Array} Returns the words of `string`.
|
|
884
|
-
*/
|
|
885
|
-
function unicodeWords(string) {
|
|
886
|
-
return string.match(reUnicodeWord) || [];
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
var _unicodeWords = unicodeWords;
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* Splits `string` into an array of its words.
|
|
893
|
-
*
|
|
894
|
-
* @static
|
|
895
|
-
* @memberOf _
|
|
896
|
-
* @since 3.0.0
|
|
897
|
-
* @category String
|
|
898
|
-
* @param {string} [string=''] The string to inspect.
|
|
899
|
-
* @param {RegExp|string} [pattern] The pattern to match words.
|
|
900
|
-
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
901
|
-
* @returns {Array} Returns the words of `string`.
|
|
902
|
-
* @example
|
|
903
|
-
*
|
|
904
|
-
* _.words('fred, barney, & pebbles');
|
|
905
|
-
* // => ['fred', 'barney', 'pebbles']
|
|
906
|
-
*
|
|
907
|
-
* _.words('fred, barney, & pebbles', /[^, ]+/g);
|
|
908
|
-
* // => ['fred', 'barney', '&', 'pebbles']
|
|
909
|
-
*/
|
|
910
|
-
function words(string, pattern, guard) {
|
|
911
|
-
string = toString_1(string);
|
|
912
|
-
pattern = guard ? undefined : pattern;
|
|
913
|
-
|
|
914
|
-
if (pattern === undefined) {
|
|
915
|
-
return _hasUnicodeWord(string) ? _unicodeWords(string) : _asciiWords(string);
|
|
916
|
-
}
|
|
917
|
-
return string.match(pattern) || [];
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
var words_1 = words;
|
|
921
|
-
|
|
922
|
-
/** Used to compose unicode capture groups. */
|
|
923
|
-
var rsApos = "['\u2019]";
|
|
924
|
-
|
|
925
|
-
/** Used to match apostrophes. */
|
|
926
|
-
var reApos = RegExp(rsApos, 'g');
|
|
927
|
-
|
|
928
|
-
/**
|
|
929
|
-
* Creates a function like `_.camelCase`.
|
|
930
|
-
*
|
|
931
|
-
* @private
|
|
932
|
-
* @param {Function} callback The function to combine each word.
|
|
933
|
-
* @returns {Function} Returns the new compounder function.
|
|
934
|
-
*/
|
|
935
|
-
function createCompounder(callback) {
|
|
936
|
-
return function(string) {
|
|
937
|
-
return _arrayReduce(words_1(deburr_1(string).replace(reApos, '')), callback, '');
|
|
938
|
-
};
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
var _createCompounder = createCompounder;
|
|
942
|
-
|
|
943
|
-
/**
|
|
944
|
-
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
|
945
|
-
*
|
|
946
|
-
* @static
|
|
947
|
-
* @memberOf _
|
|
948
|
-
* @since 3.0.0
|
|
949
|
-
* @category String
|
|
950
|
-
* @param {string} [string=''] The string to convert.
|
|
951
|
-
* @returns {string} Returns the camel cased string.
|
|
952
|
-
* @example
|
|
953
|
-
*
|
|
954
|
-
* _.camelCase('Foo Bar');
|
|
955
|
-
* // => 'fooBar'
|
|
956
|
-
*
|
|
957
|
-
* _.camelCase('--foo-bar--');
|
|
958
|
-
* // => 'fooBar'
|
|
959
|
-
*
|
|
960
|
-
* _.camelCase('__FOO_BAR__');
|
|
961
|
-
* // => 'fooBar'
|
|
962
|
-
*/
|
|
963
|
-
var camelCase = _createCompounder(function(result, word, index) {
|
|
964
|
-
word = word.toLowerCase();
|
|
965
|
-
return result + (index ? capitalize_1(word) : word);
|
|
966
|
-
});
|
|
967
|
-
|
|
968
|
-
var camelCase_1 = camelCase;
|
|
969
|
-
|
|
970
|
-
/**
|
|
971
|
-
* Converts `string` to
|
|
972
|
-
* [snake case](https://en.wikipedia.org/wiki/Snake_case).
|
|
973
|
-
*
|
|
974
|
-
* @static
|
|
975
|
-
* @memberOf _
|
|
976
|
-
* @since 3.0.0
|
|
977
|
-
* @category String
|
|
978
|
-
* @param {string} [string=''] The string to convert.
|
|
979
|
-
* @returns {string} Returns the snake cased string.
|
|
980
|
-
* @example
|
|
981
|
-
*
|
|
982
|
-
* _.snakeCase('Foo Bar');
|
|
983
|
-
* // => 'foo_bar'
|
|
984
|
-
*
|
|
985
|
-
* _.snakeCase('fooBar');
|
|
986
|
-
* // => 'foo_bar'
|
|
987
|
-
*
|
|
988
|
-
* _.snakeCase('--FOO-BAR--');
|
|
989
|
-
* // => 'foo_bar'
|
|
990
|
-
*/
|
|
991
|
-
var snakeCase = _createCompounder(function(result, word, index) {
|
|
992
|
-
return result + (index ? '_' : '') + word.toLowerCase();
|
|
993
|
-
});
|
|
994
|
-
|
|
995
|
-
var snakeCase_1 = snakeCase;
|
|
996
|
-
|
|
997
138
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
998
139
|
const isUuid = (value) => {
|
|
999
140
|
return /[0-9a-fA-F-]{32}/.test(value);
|
|
@@ -1005,7 +146,7 @@
|
|
|
1005
146
|
return data;
|
|
1006
147
|
return Object.keys(data).reduce((result, key) => {
|
|
1007
148
|
const value = snakeCaseToCamelCase(data[key]);
|
|
1008
|
-
const keyValue = isUuid(key) ? key :
|
|
149
|
+
const keyValue = isUuid(key) ? key : camelCase__default["default"](key);
|
|
1009
150
|
return { ...result, [keyValue]: value };
|
|
1010
151
|
}, {});
|
|
1011
152
|
};
|
|
@@ -1016,10 +157,15 @@
|
|
|
1016
157
|
return data;
|
|
1017
158
|
return Object.keys(data).reduce((result, key) => {
|
|
1018
159
|
const value = camelCaseToSnakeCase(data[key]);
|
|
1019
|
-
return { ...result, [
|
|
160
|
+
return { ...result, [snakeCase__default["default"](key)]: value };
|
|
1020
161
|
}, {});
|
|
1021
162
|
};
|
|
1022
163
|
|
|
164
|
+
function createCommonjsModule(fn) {
|
|
165
|
+
var module = { exports: {} };
|
|
166
|
+
return fn(module, module.exports), module.exports;
|
|
167
|
+
}
|
|
168
|
+
|
|
1023
169
|
var eventemitter3 = createCommonjsModule(function (module) {
|
|
1024
170
|
|
|
1025
171
|
var has = Object.prototype.hasOwnProperty
|
|
@@ -1991,7 +1137,22 @@
|
|
|
1991
1137
|
METHODS["REQUEST_LOCATION"] = "request_location";
|
|
1992
1138
|
METHODS["REQUEST_SELF_PROFILE"] = "request_self_profile";
|
|
1993
1139
|
METHODS["CLOSE_SMART_APP"] = "close_smart_app";
|
|
1140
|
+
METHODS["OPEN_FILE"] = "open_file";
|
|
1141
|
+
METHODS["SUBSCRIBE_CLIENT_EVENTS"] = "subscribe_client_events";
|
|
1142
|
+
METHODS["UNSUBSCRIBE_CLIENT_EVENTS"] = "unsubscribe_client_events";
|
|
1143
|
+
METHODS["GET_CONNECTION_STATUS"] = "get_connection_status";
|
|
1144
|
+
METHODS["CREATE_DEEPLINK"] = "create_deeplink";
|
|
1994
1145
|
})(METHODS || (METHODS = {}));
|
|
1146
|
+
var STATUS;
|
|
1147
|
+
(function (STATUS) {
|
|
1148
|
+
STATUS["SUCCESS"] = "success";
|
|
1149
|
+
STATUS["ERROR"] = "error";
|
|
1150
|
+
})(STATUS || (STATUS = {}));
|
|
1151
|
+
var ERROR_CODES;
|
|
1152
|
+
(function (ERROR_CODES) {
|
|
1153
|
+
ERROR_CODES["NO_BRIDGE"] = "no_bridge";
|
|
1154
|
+
ERROR_CODES["SUBSCRIPTION_NOT_FOUND"] = "subscription_not_found";
|
|
1155
|
+
})(ERROR_CODES || (ERROR_CODES = {}));
|
|
1995
1156
|
|
|
1996
1157
|
var LOCATION;
|
|
1997
1158
|
(function (LOCATION) {
|
|
@@ -1999,6 +1160,79 @@
|
|
|
1999
1160
|
LOCATION["NESTED"] = "nested";
|
|
2000
1161
|
})(LOCATION || (LOCATION = {}));
|
|
2001
1162
|
|
|
1163
|
+
var SubscriptionEventType;
|
|
1164
|
+
(function (SubscriptionEventType) {
|
|
1165
|
+
SubscriptionEventType["CONNECTION_STATUS"] = "connection_status";
|
|
1166
|
+
})(SubscriptionEventType || (SubscriptionEventType = {}));
|
|
1167
|
+
|
|
1168
|
+
const subscriptions = [];
|
|
1169
|
+
let bridgeEventListenerInstalled = false;
|
|
1170
|
+
const isAnySubscriptionsOfType = (eventType) => {
|
|
1171
|
+
return subscriptions.some(sub => sub.eventType == eventType);
|
|
1172
|
+
};
|
|
1173
|
+
const installBridgeEventListener = () => {
|
|
1174
|
+
if (bridgeEventListenerInstalled || !bridge)
|
|
1175
|
+
return;
|
|
1176
|
+
bridgeEventListenerInstalled = true;
|
|
1177
|
+
bridge.onReceive(event => {
|
|
1178
|
+
subscriptions.filter(sub => sub.eventType === event.type).map(sub => sub.callback(event));
|
|
1179
|
+
});
|
|
1180
|
+
};
|
|
1181
|
+
/**
|
|
1182
|
+
* Subscribe to special client events
|
|
1183
|
+
* @param eventType Event from SubscriptionEventType enum to be subscribed
|
|
1184
|
+
* @param callback Function to be handled when event is coming
|
|
1185
|
+
* @returns Promise that'll be fullfilled on successful subscription, otherwise rejected with reason
|
|
1186
|
+
*/
|
|
1187
|
+
const subscribeClientEvents = (eventType, callback) => {
|
|
1188
|
+
const successResponse = { status: STATUS.SUCCESS };
|
|
1189
|
+
// No need to subscribe event twice on client
|
|
1190
|
+
if (isAnySubscriptionsOfType(eventType)) {
|
|
1191
|
+
subscriptions.push({ eventType, callback });
|
|
1192
|
+
return Promise.resolve(successResponse);
|
|
1193
|
+
}
|
|
1194
|
+
if (!bridge)
|
|
1195
|
+
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
1196
|
+
return bridge
|
|
1197
|
+
.sendClientEvent({
|
|
1198
|
+
method: METHODS.SUBSCRIBE_CLIENT_EVENTS,
|
|
1199
|
+
params: {
|
|
1200
|
+
event: eventType,
|
|
1201
|
+
},
|
|
1202
|
+
})
|
|
1203
|
+
.then(() => {
|
|
1204
|
+
installBridgeEventListener();
|
|
1205
|
+
subscriptions.push({ eventType, callback });
|
|
1206
|
+
return successResponse;
|
|
1207
|
+
});
|
|
1208
|
+
};
|
|
1209
|
+
/**
|
|
1210
|
+
* Unsubscribe from previously subscribed client events
|
|
1211
|
+
* @param eventType Event from SubscriptionEventType enum to be unsubscribed
|
|
1212
|
+
* @param callback Function to be unsibscribed
|
|
1213
|
+
* @returns Promise that'll be fullfilled on successful unsubscription, otherwise rejected with reason
|
|
1214
|
+
*/
|
|
1215
|
+
const unsubscribeClientEvents = (eventType, callback) => {
|
|
1216
|
+
const successResponse = { status: STATUS.SUCCESS };
|
|
1217
|
+
const index = subscriptions.findIndex(sub => sub.eventType == eventType && sub.callback == callback);
|
|
1218
|
+
if (!bridge)
|
|
1219
|
+
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
1220
|
+
if (index == -1)
|
|
1221
|
+
return Promise.reject(ERROR_CODES.SUBSCRIPTION_NOT_FOUND);
|
|
1222
|
+
subscriptions.splice(index, 1);
|
|
1223
|
+
// Send unsubscribe to client only at last subscription
|
|
1224
|
+
if (isAnySubscriptionsOfType(eventType))
|
|
1225
|
+
return Promise.resolve(successResponse);
|
|
1226
|
+
return bridge
|
|
1227
|
+
.sendClientEvent({
|
|
1228
|
+
method: METHODS.UNSUBSCRIBE_CLIENT_EVENTS,
|
|
1229
|
+
params: {
|
|
1230
|
+
event: eventType,
|
|
1231
|
+
},
|
|
1232
|
+
})
|
|
1233
|
+
.then(() => successResponse);
|
|
1234
|
+
};
|
|
1235
|
+
|
|
2002
1236
|
const openClientSettings = () => {
|
|
2003
1237
|
return bridge?.sendClientEvent({
|
|
2004
1238
|
method: METHODS.OPEN_CLIENT_SETTINGS,
|
|
@@ -2023,6 +1257,12 @@
|
|
|
2023
1257
|
params: { groupChatId },
|
|
2024
1258
|
});
|
|
2025
1259
|
};
|
|
1260
|
+
const openFile = (file) => {
|
|
1261
|
+
return bridge?.sendClientEvent({
|
|
1262
|
+
method: METHODS.OPEN_FILE,
|
|
1263
|
+
params: file,
|
|
1264
|
+
});
|
|
1265
|
+
};
|
|
2026
1266
|
const sendBotCommand = ({ userHuid, body, data, }) => {
|
|
2027
1267
|
if (typeof data !== 'object')
|
|
2028
1268
|
return;
|
|
@@ -2043,6 +1283,34 @@
|
|
|
2043
1283
|
params: {},
|
|
2044
1284
|
});
|
|
2045
1285
|
};
|
|
1286
|
+
/**
|
|
1287
|
+
* Get client current connection status. It's based on client's WebSocket connection state.
|
|
1288
|
+
* @returns Promise that'll be fullfilled with status data on success, otherwise rejected with reason
|
|
1289
|
+
*/
|
|
1290
|
+
const getConnectionStatus = async () => {
|
|
1291
|
+
if (!bridge)
|
|
1292
|
+
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
1293
|
+
const response = await bridge.sendClientEvent({
|
|
1294
|
+
method: METHODS.GET_CONNECTION_STATUS,
|
|
1295
|
+
params: {},
|
|
1296
|
+
});
|
|
1297
|
+
return response;
|
|
1298
|
+
};
|
|
1299
|
+
/**
|
|
1300
|
+
* Create deeplink URL to open SmartApp
|
|
1301
|
+
* @param appId ID of SmartApp
|
|
1302
|
+
* @param meta Array of params to be included in deeplink
|
|
1303
|
+
* @returns Promise that'll be fullfilled with deeplink data on success, otherwise rejected with reason
|
|
1304
|
+
*/
|
|
1305
|
+
const createDeeplink = async (appId, meta) => {
|
|
1306
|
+
if (!bridge)
|
|
1307
|
+
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
1308
|
+
const response = await bridge.sendClientEvent({
|
|
1309
|
+
method: METHODS.CREATE_DEEPLINK,
|
|
1310
|
+
params: { appId, meta },
|
|
1311
|
+
});
|
|
1312
|
+
return response;
|
|
1313
|
+
};
|
|
2046
1314
|
|
|
2047
1315
|
const addContact = ({ phone, name }) => {
|
|
2048
1316
|
return bridge?.sendClientEvent({
|
|
@@ -2098,6 +1366,9 @@
|
|
|
2098
1366
|
return Object.fromEntries(urlSearchParams.entries());
|
|
2099
1367
|
};
|
|
2100
1368
|
|
|
1369
|
+
/**
|
|
1370
|
+
* @param timeout
|
|
1371
|
+
*/
|
|
2101
1372
|
const bridgeSendReady = (timeout) => {
|
|
2102
1373
|
const event = {
|
|
2103
1374
|
method: METHODS.READY,
|
|
@@ -2109,11 +1380,16 @@
|
|
|
2109
1380
|
const ready = async (timeout) => {
|
|
2110
1381
|
const response = await bridgeSendReady(timeout);
|
|
2111
1382
|
const isLogsEnabled = response?.payload?.logsEnabled;
|
|
1383
|
+
if (!bridge)
|
|
1384
|
+
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2112
1385
|
if (isLogsEnabled)
|
|
2113
|
-
bridge
|
|
1386
|
+
bridge.enableLogs?.();
|
|
2114
1387
|
return response;
|
|
2115
1388
|
};
|
|
2116
1389
|
|
|
1390
|
+
/**
|
|
1391
|
+
* @param handleNotification
|
|
1392
|
+
*/
|
|
2117
1393
|
const onNotification = async (handleNotification) => {
|
|
2118
1394
|
const response = await bridge?.sendClientEvent({
|
|
2119
1395
|
method: METHODS.NOTIFICATION,
|
|
@@ -2168,15 +1444,18 @@
|
|
|
2168
1444
|
exports.Bridge = bridge;
|
|
2169
1445
|
exports.addContact = addContact;
|
|
2170
1446
|
exports.closeSmartApp = closeSmartApp;
|
|
1447
|
+
exports.createDeeplink = createDeeplink;
|
|
2171
1448
|
exports.createPersonalChat = createPersonalChat;
|
|
2172
1449
|
exports.exitSmartAppToCatalog = exitSmartAppToCatalog;
|
|
2173
1450
|
exports.getChats = getChats;
|
|
1451
|
+
exports.getConnectionStatus = getConnectionStatus;
|
|
2174
1452
|
exports.getContact = getContact;
|
|
2175
1453
|
exports.onBackPressed = onBackPressed;
|
|
2176
1454
|
exports.onMoveToRoot = onMoveToRoot;
|
|
2177
1455
|
exports.onNotification = onNotification;
|
|
2178
1456
|
exports.openClientSettings = openClientSettings;
|
|
2179
1457
|
exports.openContactCard = openContactCard;
|
|
1458
|
+
exports.openFile = openFile;
|
|
2180
1459
|
exports.openGroupChat = openGroupChat;
|
|
2181
1460
|
exports.openSmartApp = openSmartApp;
|
|
2182
1461
|
exports.ready = ready;
|
|
@@ -2186,6 +1465,8 @@
|
|
|
2186
1465
|
exports.searchCorporatePhonebook = searchCorporatePhonebook;
|
|
2187
1466
|
exports.sendBotCommand = sendBotCommand;
|
|
2188
1467
|
exports.sendMessage = sendMessage;
|
|
1468
|
+
exports.subscribeClientEvents = subscribeClientEvents;
|
|
1469
|
+
exports.unsubscribeClientEvents = unsubscribeClientEvents;
|
|
2189
1470
|
exports.useQuery = useQuery;
|
|
2190
1471
|
|
|
2191
1472
|
Object.defineProperty(exports, '__esModule', { value: true });
|