@jetthai/cuora 1.1.48 → 1.1.50

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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.50](https://github.com/jetthai/cuora-module/compare/v1.1.49...v1.1.50) (2023-02-16)
6
+
7
+ ### [1.1.49](https://github.com/jetthai/cuora-module/compare/v1.1.48...v1.1.49) (2023-02-15)
8
+
5
9
  ### [1.1.48](https://github.com/jetthai/cuora-module/compare/v1.1.47...v1.1.48) (2023-02-10)
6
10
 
7
11
  ### [1.1.47](https://github.com/jetthai/cuora-module/compare/v1.1.45-1...v1.1.47) (2023-02-08)
package/dist/bundle.mjs CHANGED
@@ -1021,7 +1021,7 @@ var ListCache$1 = _ListCache,
1021
1021
  MapCache$2 = _MapCache;
1022
1022
 
1023
1023
  /** Used as the size to enable large array optimizations. */
1024
- var LARGE_ARRAY_SIZE = 200;
1024
+ var LARGE_ARRAY_SIZE$1 = 200;
1025
1025
 
1026
1026
  /**
1027
1027
  * Sets the stack `key` to `value`.
@@ -1037,7 +1037,7 @@ function stackSet$1(key, value) {
1037
1037
  var data = this.__data__;
1038
1038
  if (data instanceof ListCache$1) {
1039
1039
  var pairs = data.__data__;
1040
- if (!Map$2 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
1040
+ if (!Map$2 || (pairs.length < LARGE_ARRAY_SIZE$1 - 1)) {
1041
1041
  pairs.push([key, value]);
1042
1042
  this.size = ++data.size;
1043
1043
  return this;
@@ -1128,7 +1128,7 @@ var MapCache$1 = _MapCache,
1128
1128
  * @constructor
1129
1129
  * @param {Array} [values] The values to cache.
1130
1130
  */
1131
- function SetCache$1(values) {
1131
+ function SetCache$2(values) {
1132
1132
  var index = -1,
1133
1133
  length = values == null ? 0 : values.length;
1134
1134
 
@@ -1139,10 +1139,10 @@ function SetCache$1(values) {
1139
1139
  }
1140
1140
 
1141
1141
  // Add methods to `SetCache`.
1142
- SetCache$1.prototype.add = SetCache$1.prototype.push = setCacheAdd;
1143
- SetCache$1.prototype.has = setCacheHas;
1142
+ SetCache$2.prototype.add = SetCache$2.prototype.push = setCacheAdd;
1143
+ SetCache$2.prototype.has = setCacheHas;
1144
1144
 
1145
- var _SetCache = SetCache$1;
1145
+ var _SetCache = SetCache$2;
1146
1146
 
1147
1147
  /**
1148
1148
  * A specialized version of `_.some` for arrays without support for iteratee
@@ -1178,15 +1178,15 @@ var _arraySome = arraySome$1;
1178
1178
  * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1179
1179
  */
1180
1180
 
1181
- function cacheHas$1(cache, key) {
1181
+ function cacheHas$2(cache, key) {
1182
1182
  return cache.has(key);
1183
1183
  }
1184
1184
 
1185
- var _cacheHas = cacheHas$1;
1185
+ var _cacheHas = cacheHas$2;
1186
1186
 
1187
- var SetCache = _SetCache,
1187
+ var SetCache$1 = _SetCache,
1188
1188
  arraySome = _arraySome,
1189
- cacheHas = _cacheHas;
1189
+ cacheHas$1 = _cacheHas;
1190
1190
 
1191
1191
  /** Used to compose bitmasks for value comparisons. */
1192
1192
  var COMPARE_PARTIAL_FLAG$5 = 1,
@@ -1221,7 +1221,7 @@ function equalArrays$2(array, other, bitmask, customizer, equalFunc, stack) {
1221
1221
  }
1222
1222
  var index = -1,
1223
1223
  result = true,
1224
- seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new SetCache : undefined;
1224
+ seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new SetCache$1 : undefined;
1225
1225
 
1226
1226
  stack.set(array, other);
1227
1227
  stack.set(other, array);
@@ -1246,7 +1246,7 @@ function equalArrays$2(array, other, bitmask, customizer, equalFunc, stack) {
1246
1246
  // Recursively compare arrays (susceptible to call stack limits).
1247
1247
  if (seen) {
1248
1248
  if (!arraySome(other, function(othValue, othIndex) {
1249
- if (!cacheHas(seen, othIndex) &&
1249
+ if (!cacheHas$1(seen, othIndex) &&
1250
1250
  (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1251
1251
  return seen.push(othIndex);
1252
1252
  }
@@ -1304,7 +1304,7 @@ var _mapToArray = mapToArray$1;
1304
1304
  * @returns {Array} Returns the values.
1305
1305
  */
1306
1306
 
1307
- function setToArray$1(set) {
1307
+ function setToArray$3(set) {
1308
1308
  var index = -1,
1309
1309
  result = Array(set.size);
1310
1310
 
@@ -1314,14 +1314,14 @@ function setToArray$1(set) {
1314
1314
  return result;
1315
1315
  }
1316
1316
 
1317
- var _setToArray = setToArray$1;
1317
+ var _setToArray = setToArray$3;
1318
1318
 
1319
1319
  var Symbol$2 = _Symbol,
1320
1320
  Uint8Array = _Uint8Array,
1321
1321
  eq$1 = eq_1,
1322
1322
  equalArrays$1 = _equalArrays,
1323
1323
  mapToArray = _mapToArray,
1324
- setToArray = _setToArray;
1324
+ setToArray$2 = _setToArray;
1325
1325
 
1326
1326
  /** Used to compose bitmasks for value comparisons. */
1327
1327
  var COMPARE_PARTIAL_FLAG$4 = 1,
@@ -1401,7 +1401,7 @@ function equalByTag$1(object, other, tag, bitmask, customizer, equalFunc, stack)
1401
1401
 
1402
1402
  case setTag$2:
1403
1403
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
1404
- convert || (convert = setToArray);
1404
+ convert || (convert = setToArray$2);
1405
1405
 
1406
1406
  if (object.size != other.size && !isPartial) {
1407
1407
  return false;
@@ -2284,9 +2284,9 @@ var getNative$2 = _getNative,
2284
2284
  root$1 = _root;
2285
2285
 
2286
2286
  /* Built-in method references that are verified to be native. */
2287
- var Set$2 = getNative$2(root$1, 'Set');
2287
+ var Set$3 = getNative$2(root$1, 'Set');
2288
2288
 
2289
- var _Set = Set$2;
2289
+ var _Set = Set$3;
2290
2290
 
2291
2291
  var getNative$1 = _getNative,
2292
2292
  root = _root;
@@ -2299,7 +2299,7 @@ var _WeakMap = WeakMap$1;
2299
2299
  var DataView = _DataView,
2300
2300
  Map$1 = _Map,
2301
2301
  Promise$1 = _Promise,
2302
- Set$1 = _Set,
2302
+ Set$2 = _Set,
2303
2303
  WeakMap = _WeakMap,
2304
2304
  baseGetTag$1 = _baseGetTag,
2305
2305
  toSource = _toSource;
@@ -2317,7 +2317,7 @@ var dataViewTag = '[object DataView]';
2317
2317
  var dataViewCtorString = toSource(DataView),
2318
2318
  mapCtorString = toSource(Map$1),
2319
2319
  promiseCtorString = toSource(Promise$1),
2320
- setCtorString = toSource(Set$1),
2320
+ setCtorString = toSource(Set$2),
2321
2321
  weakMapCtorString = toSource(WeakMap);
2322
2322
 
2323
2323
  /**
@@ -2333,7 +2333,7 @@ var getTag$1 = baseGetTag$1;
2333
2333
  if ((DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
2334
2334
  (Map$1 && getTag$1(new Map$1) != mapTag) ||
2335
2335
  (Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag) ||
2336
- (Set$1 && getTag$1(new Set$1) != setTag) ||
2336
+ (Set$2 && getTag$1(new Set$2) != setTag) ||
2337
2337
  (WeakMap && getTag$1(new WeakMap) != weakMapTag)) {
2338
2338
  getTag$1 = function(value) {
2339
2339
  var result = baseGetTag$1(value),
@@ -2812,7 +2812,7 @@ var Symbol$1 = _Symbol,
2812
2812
  isSymbol$2 = isSymbol_1;
2813
2813
 
2814
2814
  /** Used as references for various `Number` constants. */
2815
- var INFINITY$2 = 1 / 0;
2815
+ var INFINITY$3 = 1 / 0;
2816
2816
 
2817
2817
  /** Used to convert symbols to primitives and strings. */
2818
2818
  var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
@@ -2839,7 +2839,7 @@ function baseToString$2(value) {
2839
2839
  return symbolToString ? symbolToString.call(value) : '';
2840
2840
  }
2841
2841
  var result = (value + '');
2842
- return (result == '0' && (1 / value) == -INFINITY$2) ? '-0' : result;
2842
+ return (result == '0' && (1 / value) == -INFINITY$3) ? '-0' : result;
2843
2843
  }
2844
2844
 
2845
2845
  var _baseToString = baseToString$2;
@@ -2898,7 +2898,7 @@ var _castPath = castPath$4;
2898
2898
  var isSymbol$1 = isSymbol_1;
2899
2899
 
2900
2900
  /** Used as references for various `Number` constants. */
2901
- var INFINITY$1 = 1 / 0;
2901
+ var INFINITY$2 = 1 / 0;
2902
2902
 
2903
2903
  /**
2904
2904
  * Converts `value` to a string key if it's not a string or symbol.
@@ -2912,7 +2912,7 @@ function toKey$5(value) {
2912
2912
  return value;
2913
2913
  }
2914
2914
  var result = (value + '');
2915
- return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
2915
+ return (result == '0' && (1 / value) == -INFINITY$2) ? '-0' : result;
2916
2916
  }
2917
2917
 
2918
2918
  var _toKey = toKey$5;
@@ -3202,7 +3202,7 @@ var baseMatches = _baseMatches,
3202
3202
  * @param {*} [value=_.identity] The value to convert to an iteratee.
3203
3203
  * @returns {Function} Returns the iteratee.
3204
3204
  */
3205
- function baseIteratee$2(value) {
3205
+ function baseIteratee$3(value) {
3206
3206
  // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
3207
3207
  // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
3208
3208
  if (typeof value == 'function') {
@@ -3219,7 +3219,7 @@ function baseIteratee$2(value) {
3219
3219
  return property(value);
3220
3220
  }
3221
3221
 
3222
- var _baseIteratee = baseIteratee$2;
3222
+ var _baseIteratee = baseIteratee$3;
3223
3223
 
3224
3224
  var getNative = _getNative;
3225
3225
 
@@ -3512,7 +3512,7 @@ function getAllKeysIn$1(object) {
3512
3512
  var _getAllKeysIn = getAllKeysIn$1;
3513
3513
 
3514
3514
  var arrayMap = _arrayMap,
3515
- baseIteratee$1 = _baseIteratee,
3515
+ baseIteratee$2 = _baseIteratee,
3516
3516
  basePickBy = _basePickBy,
3517
3517
  getAllKeysIn = _getAllKeysIn;
3518
3518
 
@@ -3541,7 +3541,7 @@ function pickBy(object, predicate) {
3541
3541
  var props = arrayMap(getAllKeysIn(object), function(prop) {
3542
3542
  return [prop];
3543
3543
  });
3544
- predicate = baseIteratee$1(predicate);
3544
+ predicate = baseIteratee$2(predicate);
3545
3545
  return basePickBy(object, props, function(value, path) {
3546
3546
  return predicate(value, path[0]);
3547
3547
  });
@@ -9372,14 +9372,289 @@ function __spreadArrays() {
9372
9372
  */
9373
9373
  function n(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}function o(e){for(var t="",r=0;r<e.length;++r)if(r>0){var n=e[r].toLowerCase();n!==e[r]?t+=" "+n:t+=e[r];}else t+=e[r].toUpperCase();return t}var i={default:"endpoint"},u={default:"tlsEndpoint"},l=/*#__PURE__*/o("WrongRegion"),f=/*#__PURE__*/o("SubscriptionNotActive"),E=/*#__PURE__*/o("UnsupportedVersion"),p=/*#__PURE__*/o("InstallationMethodRestricted"),_=/*#__PURE__*/o("HostnameRestricted");function k(t,r){var n=[];return function(t,r){var n=5,o=(d=t,s=__spreadArrays(d),{current:function(){return s[0]},postpone:function(){var e=s.shift();void 0!==e&&s.push(e);},exclude:function(){s.shift();}}),i=(a=100,R=3e3,c=0,function(){return Math.random()*Math.min(R,a*Math.pow(2,c++))}),u=o.current();var a,R,c;var d,s;if(void 0===u)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var l=function(e,t){return r(e).catch((function(e){if(t+1>=n)throw e;!function(e){if(!(e instanceof Error))return !1;var t=e.message;return "Blocked by CSP"===t||"9319"===t}(e)?o.postpone():o.exclude();var r,u=o.current();if(void 0===u)throw e;return (r=i(),new Promise((function(e){return setTimeout(e,r)}))).then((function(){return l(u,t+1)}))}))};return l(u,0)}(t,(function(e){var t=new Date,o=function(){return n.push({url:e,startedAt:t,finishedAt:new Date})},i=r(e);return i.then(o,o),i})).then((function(e){return [e,{attempts:n}]}))}var b="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",D=b,C="Failed to load the JS script of the agent";function U(e){var o;e.scriptUrlPattern;var i=e.token,u=e.apiKey,a=void 0===u?i:u,R=__rest(e,["scriptUrlPattern","token","apiKey"]),c=null!==(o=n(e,"scriptUrlPattern"))&&void 0!==o?o:b;return Promise.resolve().then((function(){if(!a||"string"!=typeof a)throw new Error("API key required");return k(function(e,t){return (Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var r=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return "<version>"===e?"3":"<apiKey>"===e?r(t):"<loaderVersion>"===e?r("3.8.0"):e}))}(String(e),t)}))}(c,a),g).catch(q)})).then((function(e){var t=e[0],n=e[1];return t.load(__assign(__assign({},R),{ldi:n}))}))}function g(e){return function(e,t,r,n){var o,i=document,u="securitypolicyviolation",a=function(t){var r=new URL(e,location.href),n=t.blockedURI;n!==r.href&&n!==r.protocol.slice(0,-1)&&n!==r.origin||(o=t,R());};i.addEventListener(u,a);var R=function(){return i.removeEventListener(u,a)};return null==n||n.then(R,R),Promise.resolve().then(t).then((function(e){return R(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(R(),o)return r(o);throw e}))}))}(e,(function(){return function(e){return new Promise((function(t,r){var n=document.createElement("script"),o=function(){var e;return null===(e=n.parentNode)||void 0===e?void 0:e.removeChild(n)},i=document.head||document.getElementsByTagName("head")[0];n.onload=function(){o(),t();},n.onerror=function(){o(),r(new Error(C));},n.async=!0,n.src=e,i.appendChild(n);}))}(e)}),(function(){throw new Error("Blocked by CSP")})).then(L)}function L(){var e=window,t="__fpjs_p_l_b",r=e[t];if(function(e,t){var r,n=null===(r=Object.getOwnPropertyDescriptor)||void 0===r?void 0:r.call(Object,e,t);(null==n?void 0:n.configurable)?delete e[t]:n&&!n.writable||(e[t]=void 0);}(e,t),"function"!=typeof(null==r?void 0:r.load))throw new Error("9319");return r}function q(e){throw e instanceof Error&&"9319"===e.message?new Error(C):e}var B={load:U,defaultScriptUrlPattern:D,ERROR_SCRIPT_LOAD_FAIL:C,ERROR_API_KEY_EXPIRED:"API key expired",ERROR_API_KEY_INVALID:"API key not found",ERROR_API_KEY_MISSING:"API key required",ERROR_BAD_REQUEST_FORMAT:"Request cannot be parsed",ERROR_BAD_RESPONSE_FORMAT:"Response cannot be parsed",ERROR_CLIENT_TIMEOUT:"Client timeout",ERROR_CSP_BLOCK:"Blocked by CSP",ERROR_FORBIDDEN_ENDPOINT:_,ERROR_FORBIDDEN_HEADER:"Not available with restricted header",ERROR_FORBIDDEN_ORIGIN:"Not available for this origin",ERROR_GENERAL_SERVER_FAILURE:"Request failed",ERROR_INSTALLATION_METHOD_RESTRICTED:p,ERROR_NETWORK_ABORT:"Network request aborted",ERROR_NETWORK_CONNECTION:"Network connection error",ERROR_RATE_LIMIT:"Too many requests, rate limit exceeded",ERROR_SERVER_TIMEOUT:"Request failed to process",ERROR_SUBSCRIPTION_NOT_ACTIVE:f,ERROR_TOKEN_EXPIRED:"API key expired",ERROR_TOKEN_INVALID:"API key not found",ERROR_TOKEN_MISSING:"API key required",ERROR_UNSUPPORTED_VERSION:E,ERROR_WRONG_REGION:l,defaultEndpoint:i,defaultTlsEndpoint:u};
9374
9374
 
9375
+ /**
9376
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
9377
+ * support for iteratee shorthands.
9378
+ *
9379
+ * @private
9380
+ * @param {Array} array The array to inspect.
9381
+ * @param {Function} predicate The function invoked per iteration.
9382
+ * @param {number} fromIndex The index to search from.
9383
+ * @param {boolean} [fromRight] Specify iterating from right to left.
9384
+ * @returns {number} Returns the index of the matched value, else `-1`.
9385
+ */
9386
+
9387
+ function baseFindIndex$2(array, predicate, fromIndex, fromRight) {
9388
+ var length = array.length,
9389
+ index = fromIndex + (fromRight ? 1 : -1);
9390
+
9391
+ while ((fromRight ? index-- : ++index < length)) {
9392
+ if (predicate(array[index], index, array)) {
9393
+ return index;
9394
+ }
9395
+ }
9396
+ return -1;
9397
+ }
9398
+
9399
+ var _baseFindIndex = baseFindIndex$2;
9400
+
9401
+ /**
9402
+ * The base implementation of `_.isNaN` without support for number objects.
9403
+ *
9404
+ * @private
9405
+ * @param {*} value The value to check.
9406
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
9407
+ */
9408
+
9409
+ function baseIsNaN$1(value) {
9410
+ return value !== value;
9411
+ }
9412
+
9413
+ var _baseIsNaN = baseIsNaN$1;
9414
+
9415
+ /**
9416
+ * A specialized version of `_.indexOf` which performs strict equality
9417
+ * comparisons of values, i.e. `===`.
9418
+ *
9419
+ * @private
9420
+ * @param {Array} array The array to inspect.
9421
+ * @param {*} value The value to search for.
9422
+ * @param {number} fromIndex The index to search from.
9423
+ * @returns {number} Returns the index of the matched value, else `-1`.
9424
+ */
9425
+
9426
+ function strictIndexOf$1(array, value, fromIndex) {
9427
+ var index = fromIndex - 1,
9428
+ length = array.length;
9429
+
9430
+ while (++index < length) {
9431
+ if (array[index] === value) {
9432
+ return index;
9433
+ }
9434
+ }
9435
+ return -1;
9436
+ }
9437
+
9438
+ var _strictIndexOf = strictIndexOf$1;
9439
+
9440
+ var baseFindIndex$1 = _baseFindIndex,
9441
+ baseIsNaN = _baseIsNaN,
9442
+ strictIndexOf = _strictIndexOf;
9443
+
9444
+ /**
9445
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
9446
+ *
9447
+ * @private
9448
+ * @param {Array} array The array to inspect.
9449
+ * @param {*} value The value to search for.
9450
+ * @param {number} fromIndex The index to search from.
9451
+ * @returns {number} Returns the index of the matched value, else `-1`.
9452
+ */
9453
+ function baseIndexOf$1(array, value, fromIndex) {
9454
+ return value === value
9455
+ ? strictIndexOf(array, value, fromIndex)
9456
+ : baseFindIndex$1(array, baseIsNaN, fromIndex);
9457
+ }
9458
+
9459
+ var _baseIndexOf = baseIndexOf$1;
9460
+
9461
+ var baseIndexOf = _baseIndexOf;
9462
+
9463
+ /**
9464
+ * A specialized version of `_.includes` for arrays without support for
9465
+ * specifying an index to search from.
9466
+ *
9467
+ * @private
9468
+ * @param {Array} [array] The array to inspect.
9469
+ * @param {*} target The value to search for.
9470
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
9471
+ */
9472
+ function arrayIncludes$1(array, value) {
9473
+ var length = array == null ? 0 : array.length;
9474
+ return !!length && baseIndexOf(array, value, 0) > -1;
9475
+ }
9476
+
9477
+ var _arrayIncludes = arrayIncludes$1;
9478
+
9479
+ /**
9480
+ * This function is like `arrayIncludes` except that it accepts a comparator.
9481
+ *
9482
+ * @private
9483
+ * @param {Array} [array] The array to inspect.
9484
+ * @param {*} target The value to search for.
9485
+ * @param {Function} comparator The comparator invoked per element.
9486
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
9487
+ */
9488
+
9489
+ function arrayIncludesWith$1(array, value, comparator) {
9490
+ var index = -1,
9491
+ length = array == null ? 0 : array.length;
9492
+
9493
+ while (++index < length) {
9494
+ if (comparator(value, array[index])) {
9495
+ return true;
9496
+ }
9497
+ }
9498
+ return false;
9499
+ }
9500
+
9501
+ var _arrayIncludesWith = arrayIncludesWith$1;
9502
+
9503
+ /**
9504
+ * This method returns `undefined`.
9505
+ *
9506
+ * @static
9507
+ * @memberOf _
9508
+ * @since 2.3.0
9509
+ * @category Util
9510
+ * @example
9511
+ *
9512
+ * _.times(2, _.noop);
9513
+ * // => [undefined, undefined]
9514
+ */
9515
+
9516
+ function noop$1() {
9517
+ // No operation performed.
9518
+ }
9519
+
9520
+ var noop_1 = noop$1;
9521
+
9522
+ var Set$1 = _Set,
9523
+ noop = noop_1,
9524
+ setToArray$1 = _setToArray;
9525
+
9526
+ /** Used as references for various `Number` constants. */
9527
+ var INFINITY$1 = 1 / 0;
9528
+
9529
+ /**
9530
+ * Creates a set object of `values`.
9531
+ *
9532
+ * @private
9533
+ * @param {Array} values The values to add to the set.
9534
+ * @returns {Object} Returns the new set.
9535
+ */
9536
+ var createSet$1 = !(Set$1 && (1 / setToArray$1(new Set$1([,-0]))[1]) == INFINITY$1) ? noop : function(values) {
9537
+ return new Set$1(values);
9538
+ };
9539
+
9540
+ var _createSet = createSet$1;
9541
+
9542
+ var SetCache = _SetCache,
9543
+ arrayIncludes = _arrayIncludes,
9544
+ arrayIncludesWith = _arrayIncludesWith,
9545
+ cacheHas = _cacheHas,
9546
+ createSet = _createSet,
9547
+ setToArray = _setToArray;
9548
+
9549
+ /** Used as the size to enable large array optimizations. */
9550
+ var LARGE_ARRAY_SIZE = 200;
9551
+
9552
+ /**
9553
+ * The base implementation of `_.uniqBy` without support for iteratee shorthands.
9554
+ *
9555
+ * @private
9556
+ * @param {Array} array The array to inspect.
9557
+ * @param {Function} [iteratee] The iteratee invoked per element.
9558
+ * @param {Function} [comparator] The comparator invoked per element.
9559
+ * @returns {Array} Returns the new duplicate free array.
9560
+ */
9561
+ function baseUniq$1(array, iteratee, comparator) {
9562
+ var index = -1,
9563
+ includes = arrayIncludes,
9564
+ length = array.length,
9565
+ isCommon = true,
9566
+ result = [],
9567
+ seen = result;
9568
+
9569
+ if (comparator) {
9570
+ isCommon = false;
9571
+ includes = arrayIncludesWith;
9572
+ }
9573
+ else if (length >= LARGE_ARRAY_SIZE) {
9574
+ var set = iteratee ? null : createSet(array);
9575
+ if (set) {
9576
+ return setToArray(set);
9577
+ }
9578
+ isCommon = false;
9579
+ includes = cacheHas;
9580
+ seen = new SetCache;
9581
+ }
9582
+ else {
9583
+ seen = iteratee ? [] : result;
9584
+ }
9585
+ outer:
9586
+ while (++index < length) {
9587
+ var value = array[index],
9588
+ computed = iteratee ? iteratee(value) : value;
9589
+
9590
+ value = (comparator || value !== 0) ? value : 0;
9591
+ if (isCommon && computed === computed) {
9592
+ var seenIndex = seen.length;
9593
+ while (seenIndex--) {
9594
+ if (seen[seenIndex] === computed) {
9595
+ continue outer;
9596
+ }
9597
+ }
9598
+ if (iteratee) {
9599
+ seen.push(computed);
9600
+ }
9601
+ result.push(value);
9602
+ }
9603
+ else if (!includes(seen, computed, comparator)) {
9604
+ if (seen !== result) {
9605
+ seen.push(computed);
9606
+ }
9607
+ result.push(value);
9608
+ }
9609
+ }
9610
+ return result;
9611
+ }
9612
+
9613
+ var _baseUniq = baseUniq$1;
9614
+
9615
+ var baseIteratee$1 = _baseIteratee,
9616
+ baseUniq = _baseUniq;
9617
+
9618
+ /**
9619
+ * This method is like `_.uniq` except that it accepts `iteratee` which is
9620
+ * invoked for each element in `array` to generate the criterion by which
9621
+ * uniqueness is computed. The order of result values is determined by the
9622
+ * order they occur in the array. The iteratee is invoked with one argument:
9623
+ * (value).
9624
+ *
9625
+ * @static
9626
+ * @memberOf _
9627
+ * @since 4.0.0
9628
+ * @category Array
9629
+ * @param {Array} array The array to inspect.
9630
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
9631
+ * @returns {Array} Returns the new duplicate free array.
9632
+ * @example
9633
+ *
9634
+ * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
9635
+ * // => [2.1, 1.2]
9636
+ *
9637
+ * // The `_.property` iteratee shorthand.
9638
+ * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
9639
+ * // => [{ 'x': 1 }, { 'x': 2 }]
9640
+ */
9641
+ function uniqBy(array, iteratee) {
9642
+ return (array && array.length) ? baseUniq(array, baseIteratee$1(iteratee)) : [];
9643
+ }
9644
+
9645
+ var uniqBy_1 = uniqBy;
9646
+
9375
9647
  const reg = /fnapi\d*/;
9376
9648
  // const reg = /(?<=https:\/\/)\w+(?=(\.\w+\.\w+))/
9377
9649
 
9378
- const getDeviceToken = async ({ fpToken, sentry, apiURL }) => {
9379
- let dt, endpoint;
9650
+ const getDeviceToken = async ({ fpToken, sentry, hosts }) => {
9651
+ let dt, endpoints;
9380
9652
  try {
9381
- endpoint = apiURL.replace(reg, 'fp');
9382
- const fp = await B.load({ apiKey: fpToken, endpoint });
9653
+ endpoints = uniqBy_1(
9654
+ hosts.map((host) => host.replace(reg, 'fp')),
9655
+ (url) => url
9656
+ );
9657
+ const fp = await B.load({ apiKey: fpToken, endpoint: endpoints });
9383
9658
  const result = await fp.get({ timeout: 30000 });
9384
9659
  dt = result.visitorId;
9385
9660
 
@@ -9387,9 +9662,9 @@ const getDeviceToken = async ({ fpToken, sentry, apiURL }) => {
9387
9662
  throw new Error('[Device Token] No token from FingerprintJS.')
9388
9663
  }
9389
9664
 
9390
- console.log('[Device Token]', `${dt} from ${endpoint}`);
9665
+ console.log('[Device Token]', `${dt} from ${endpoints}`);
9391
9666
  } catch (error) {
9392
- console.error('[Device Token]', `${dt} from ${endpoint}`);
9667
+ console.error('[Device Token]', `${dt} from ${endpoints}`, error);
9393
9668
  sentry?.captureException(error);
9394
9669
  } finally {
9395
9670
  return dt
@@ -9714,7 +9989,11 @@ function auth (request) {
9714
9989
  redirectTo3Party: async (context, event) => {
9715
9990
  const { provider, channel, subchannel, affiliate } = event.data;
9716
9991
 
9717
- const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL });
9992
+ const dt = await getDeviceToken({
9993
+ fpToken,
9994
+ sentry,
9995
+ hosts: request.hosts,
9996
+ });
9718
9997
  sentry.setTag('dt', dt);
9719
9998
 
9720
9999
  const referralCode = storage.get('referralCode');
@@ -13652,6 +13931,7 @@ function reward (request) {
13652
13931
  on: {
13653
13932
  RECEIVE_REWARD: {
13654
13933
  target: 'receiving',
13934
+ actions: 'setCallback',
13655
13935
  },
13656
13936
  BACK: {
13657
13937
  target: 'idle',
@@ -14303,7 +14583,7 @@ function user_sign_up (request) {
14303
14583
  services: {
14304
14584
  authenticate: async (context, event) => {
14305
14585
  const { channel, subchannel, signUpData } = context;
14306
- const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL });
14586
+ const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts });
14307
14587
  sentry.setTag('dt', dt);
14308
14588
 
14309
14589
  const referralCode = storage.get('referralCode');
@@ -15072,32 +15352,6 @@ function withdraw_fc (request) {
15072
15352
  )
15073
15353
  }
15074
15354
 
15075
- /**
15076
- * The base implementation of `_.findIndex` and `_.findLastIndex` without
15077
- * support for iteratee shorthands.
15078
- *
15079
- * @private
15080
- * @param {Array} array The array to inspect.
15081
- * @param {Function} predicate The function invoked per iteration.
15082
- * @param {number} fromIndex The index to search from.
15083
- * @param {boolean} [fromRight] Specify iterating from right to left.
15084
- * @returns {number} Returns the index of the matched value, else `-1`.
15085
- */
15086
-
15087
- function baseFindIndex$1(array, predicate, fromIndex, fromRight) {
15088
- var length = array.length,
15089
- index = fromIndex + (fromRight ? 1 : -1);
15090
-
15091
- while ((fromRight ? index-- : ++index < length)) {
15092
- if (predicate(array[index], index, array)) {
15093
- return index;
15094
- }
15095
- }
15096
- return -1;
15097
- }
15098
-
15099
- var _baseFindIndex = baseFindIndex$1;
15100
-
15101
15355
  /** Used to match a single whitespace character. */
15102
15356
 
15103
15357
  var reWhitespace = /\s/;
@@ -21007,6 +21261,7 @@ function promotions (request) {
21007
21261
  withdrawRule: {},
21008
21262
  promotionsList: [],
21009
21263
  selectedPromo: {},
21264
+ callback: () => {},
21010
21265
  },
21011
21266
  states: {
21012
21267
  loading: {
@@ -21051,6 +21306,7 @@ function promotions (request) {
21051
21306
  on: {
21052
21307
  CONFIRM: {
21053
21308
  target: 'applying',
21309
+ actions: 'setCallback',
21054
21310
  },
21055
21311
  BACK: {
21056
21312
  target: 'loaded',
@@ -21068,7 +21324,9 @@ function promotions (request) {
21068
21324
  },
21069
21325
  },
21070
21326
  },
21071
- applied: {},
21327
+ applied: {
21328
+ entry: 'doCallback',
21329
+ },
21072
21330
  fail: {},
21073
21331
  },
21074
21332
  },
@@ -21119,6 +21377,14 @@ function promotions (request) {
21119
21377
  withdrawRule: event.data,
21120
21378
  }
21121
21379
  }),
21380
+ setCallback: assign((context, event) => {
21381
+ return {
21382
+ callback: event.data?.callback || (() => {}),
21383
+ }
21384
+ }),
21385
+ doCallback: (context, event) => {
21386
+ context.callback();
21387
+ },
21122
21388
  reset: assign((context, event) => {
21123
21389
  return {
21124
21390
  amount: null,
@@ -21475,6 +21741,7 @@ class Request {
21475
21741
  this.config = config;
21476
21742
  this.key = `cuora_${config.clientId}`;
21477
21743
  this.errorHandler = null;
21744
+ this.hosts = [];
21478
21745
  this.initialize();
21479
21746
  }
21480
21747
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.48",
3
+ "version": "1.1.50",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -323,7 +323,11 @@ export default function (request) {
323
323
  redirectTo3Party: async (context, event) => {
324
324
  const { provider, channel, subchannel, affiliate } = event.data
325
325
 
326
- const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL })
326
+ const dt = await getDeviceToken({
327
+ fpToken,
328
+ sentry,
329
+ hosts: request.hosts,
330
+ })
327
331
  sentry.setTag('dt', dt)
328
332
 
329
333
  const referralCode = storage.get('referralCode')
@@ -13,6 +13,7 @@ export default function (request) {
13
13
  withdrawRule: {},
14
14
  promotionsList: [],
15
15
  selectedPromo: {},
16
+ callback: () => {},
16
17
  },
17
18
  states: {
18
19
  loading: {
@@ -57,6 +58,7 @@ export default function (request) {
57
58
  on: {
58
59
  CONFIRM: {
59
60
  target: 'applying',
61
+ actions: 'setCallback',
60
62
  },
61
63
  BACK: {
62
64
  target: 'loaded',
@@ -74,7 +76,9 @@ export default function (request) {
74
76
  },
75
77
  },
76
78
  },
77
- applied: {},
79
+ applied: {
80
+ entry: 'doCallback',
81
+ },
78
82
  fail: {},
79
83
  },
80
84
  },
@@ -125,6 +129,14 @@ export default function (request) {
125
129
  withdrawRule: event.data,
126
130
  }
127
131
  }),
132
+ setCallback: assign((context, event) => {
133
+ return {
134
+ callback: event.data?.callback || (() => {}),
135
+ }
136
+ }),
137
+ doCallback: (context, event) => {
138
+ context.callback()
139
+ },
128
140
  reset: assign((context, event) => {
129
141
  return {
130
142
  amount: null,
@@ -80,6 +80,7 @@ export default function (request) {
80
80
  on: {
81
81
  RECEIVE_REWARD: {
82
82
  target: 'receiving',
83
+ actions: 'setCallback',
83
84
  },
84
85
  BACK: {
85
86
  target: 'idle',
@@ -109,7 +109,7 @@ export default function (request) {
109
109
  services: {
110
110
  authenticate: async (context, event) => {
111
111
  const { channel, subchannel, signUpData } = context
112
- const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL })
112
+ const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts })
113
113
  sentry.setTag('dt', dt)
114
114
 
115
115
  const referralCode = storage.get('referralCode')
@@ -14,6 +14,7 @@ export default class Request {
14
14
  this.config = config
15
15
  this.key = `cuora_${config.clientId}`
16
16
  this.errorHandler = null
17
+ this.hosts = []
17
18
  this.initialize()
18
19
  }
19
20
 
@@ -1,12 +1,17 @@
1
1
  import FingerprintJS from '@fingerprintjs/fingerprintjs-pro'
2
+ import uniqBy from 'lodash/uniqBy'
3
+
2
4
  const reg = /fnapi\d*/
3
5
  // const reg = /(?<=https:\/\/)\w+(?=(\.\w+\.\w+))/
4
6
 
5
- const getDeviceToken = async ({ fpToken, sentry, apiURL }) => {
6
- let dt, endpoint
7
+ const getDeviceToken = async ({ fpToken, sentry, hosts }) => {
8
+ let dt, endpoints
7
9
  try {
8
- endpoint = apiURL.replace(reg, 'fp')
9
- const fp = await FingerprintJS.load({ apiKey: fpToken, endpoint })
10
+ endpoints = uniqBy(
11
+ hosts.map((host) => host.replace(reg, 'fp')),
12
+ (url) => url
13
+ )
14
+ const fp = await FingerprintJS.load({ apiKey: fpToken, endpoint: endpoints })
10
15
  const result = await fp.get({ timeout: 30000 })
11
16
  dt = result.visitorId
12
17
 
@@ -14,9 +19,9 @@ const getDeviceToken = async ({ fpToken, sentry, apiURL }) => {
14
19
  throw new Error('[Device Token] No token from FingerprintJS.')
15
20
  }
16
21
 
17
- console.log('[Device Token]', `${dt} from ${endpoint}`)
22
+ console.log('[Device Token]', `${dt} from ${endpoints}`)
18
23
  } catch (error) {
19
- console.error('[Device Token]', `${dt} from ${endpoint}`)
24
+ console.error('[Device Token]', `${dt} from ${endpoints}`, error)
20
25
  sentry?.captureException(error)
21
26
  } finally {
22
27
  return dt