@jetthai/cuora 1.0.188 → 1.0.190

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,22 @@
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.0.190](https://github.com/jetthai/cuora-module/compare/v1.0.184-2...v1.0.190) (2022-10-18)
6
+
7
+ ### [1.0.189](https://github.com/jetthai/cuora-module/compare/v1.0.188...v1.0.189) (2022-10-17)
8
+
9
+ ### [1.0.188](https://github.com/jetthai/cuora-module/compare/v1.0.187...v1.0.188) (2022-10-17)
10
+
11
+ ### [1.0.187](https://github.com/jetthai/cuora-module/compare/v1.0.186...v1.0.187) (2022-10-07)
12
+
13
+ ### [1.0.186](https://github.com/jetthai/cuora-module/compare/v1.0.185...v1.0.186) (2022-10-07)
14
+
15
+ ### [1.0.185](https://github.com/jetthai/cuora-module/compare/v1.0.184-1.1...v1.0.185) (2022-10-07)
16
+
17
+ ### [1.0.184-1.1](https://github.com/jetthai/cuora-module/compare/v1.0.184-1...v1.0.184-1.1) (2022-10-07)
18
+
19
+ ### [1.0.189](https://github.com/jetthai/cuora-module/compare/v1.0.188...v1.0.189) (2022-10-17)
20
+
5
21
  ### [1.0.188](https://github.com/jetthai/cuora-module/compare/v1.0.187...v1.0.188) (2022-10-17)
6
22
 
7
23
  ### [1.0.187](https://github.com/jetthai/cuora-module/compare/v1.0.186...v1.0.187) (2022-10-07)
@@ -14,6 +30,10 @@ All notable changes to this project will be documented in this file. See [standa
14
30
 
15
31
  ### [1.0.184-1.1](https://github.com/jetthai/cuora-module/compare/v1.0.184...v1.0.184-1.1) (2022-10-07)
16
32
 
33
+ ### [1.0.184-2](https://github.com/jetthai/cuora-module/compare/v1.0.184-1...v1.0.184-2) (2022-10-18)
34
+
35
+ ### [1.0.184-1](https://github.com/jetthai/cuora-module/compare/v1.0.184...v1.0.184-1) (2022-10-07)
36
+
17
37
  ### [1.0.184](https://github.com/jetthai/cuora-module/compare/v1.0.183...v1.0.184) (2022-10-03)
18
38
 
19
39
  ### [1.0.183](https://github.com/jetthai/cuora-module/compare/v1.0.182...v1.0.183) (2022-10-03)
package/dist/bundle.mjs CHANGED
@@ -364,77 +364,77 @@ var form = {
364
364
 
365
365
  var index$2 = { activity: activity$2, auth: auth$1, common: common$1, game: game$1, mailbox, payment, user, form };
366
366
 
367
- /*! *****************************************************************************
368
- Copyright (c) Microsoft Corporation.
369
-
370
- Permission to use, copy, modify, and/or distribute this software for any
371
- purpose with or without fee is hereby granted.
372
-
373
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
374
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
375
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
376
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
377
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
378
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
379
- PERFORMANCE OF THIS SOFTWARE.
380
- ***************************************************************************** */
381
-
382
- var __assign$1 = function() {
383
- __assign$1 = Object.assign || function __assign(t) {
384
- for (var s, i = 1, n = arguments.length; i < n; i++) {
385
- s = arguments[i];
386
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
387
- }
388
- return t;
389
- };
390
- return __assign$1.apply(this, arguments);
391
- };
392
-
393
- function __rest$1(s, e) {
394
- var t = {};
395
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
396
- t[p] = s[p];
397
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
398
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
399
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
400
- t[p[i]] = s[p[i]];
401
- }
402
- return t;
403
- }
404
-
405
- function __values(o) {
406
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
407
- if (m) return m.call(o);
408
- if (o && typeof o.length === "number") return {
409
- next: function () {
410
- if (o && i >= o.length) o = void 0;
411
- return { value: o && o[i++], done: !o };
412
- }
413
- };
414
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
415
- }
416
-
417
- function __read(o, n) {
418
- var m = typeof Symbol === "function" && o[Symbol.iterator];
419
- if (!m) return o;
420
- var i = m.call(o), r, ar = [], e;
421
- try {
422
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
423
- }
424
- catch (error) { e = { error: error }; }
425
- finally {
426
- try {
427
- if (r && !r.done && (m = i["return"])) m.call(i);
428
- }
429
- finally { if (e) throw e.error; }
430
- }
431
- return ar;
432
- }
433
-
434
- function __spreadArray(to, from) {
435
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
436
- to[j] = from[i];
437
- return to;
367
+ /*! *****************************************************************************
368
+ Copyright (c) Microsoft Corporation.
369
+
370
+ Permission to use, copy, modify, and/or distribute this software for any
371
+ purpose with or without fee is hereby granted.
372
+
373
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
374
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
375
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
376
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
377
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
378
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
379
+ PERFORMANCE OF THIS SOFTWARE.
380
+ ***************************************************************************** */
381
+
382
+ var __assign$1 = function() {
383
+ __assign$1 = Object.assign || function __assign(t) {
384
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
385
+ s = arguments[i];
386
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
387
+ }
388
+ return t;
389
+ };
390
+ return __assign$1.apply(this, arguments);
391
+ };
392
+
393
+ function __rest$1(s, e) {
394
+ var t = {};
395
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
396
+ t[p] = s[p];
397
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
398
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
399
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
400
+ t[p[i]] = s[p[i]];
401
+ }
402
+ return t;
403
+ }
404
+
405
+ function __values(o) {
406
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
407
+ if (m) return m.call(o);
408
+ if (o && typeof o.length === "number") return {
409
+ next: function () {
410
+ if (o && i >= o.length) o = void 0;
411
+ return { value: o && o[i++], done: !o };
412
+ }
413
+ };
414
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
415
+ }
416
+
417
+ function __read(o, n) {
418
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
419
+ if (!m) return o;
420
+ var i = m.call(o), r, ar = [], e;
421
+ try {
422
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
423
+ }
424
+ catch (error) { e = { error: error }; }
425
+ finally {
426
+ try {
427
+ if (r && !r.done && (m = i["return"])) m.call(i);
428
+ }
429
+ finally { if (e) throw e.error; }
430
+ }
431
+ return ar;
432
+ }
433
+
434
+ function __spreadArray(to, from) {
435
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
436
+ to[j] = from[i];
437
+ return to;
438
438
  }
439
439
 
440
440
  var STATE_DELIMITER = '.';
@@ -571,9 +571,9 @@ function mapFilterValues(collection, iteratee, predicate) {
571
571
 
572
572
  return result;
573
573
  }
574
- /**
575
- * Retrieves a value at the given path.
576
- * @param props The deep path to the prop of the desired value
574
+ /**
575
+ * Retrieves a value at the given path.
576
+ * @param props The deep path to the prop of the desired value
577
577
  */
578
578
 
579
579
  var path = function (props) {
@@ -602,9 +602,9 @@ var path = function (props) {
602
602
  return result;
603
603
  };
604
604
  };
605
- /**
606
- * Retrieves a value at the given path via the nested accessor prop.
607
- * @param props The deep path to the prop of the desired value
605
+ /**
606
+ * Retrieves a value at the given path via the nested accessor prop.
607
+ * @param props The deep path to the prop of the desired value
608
608
  */
609
609
 
610
610
  function nestedPath(props, accessorProp) {
@@ -1052,11 +1052,11 @@ function toActivityDefinition(action) {
1052
1052
  type: actionObject.type
1053
1053
  });
1054
1054
  }
1055
- /**
1056
- * Raises an event. This places the event in the internal event queue, so that
1057
- * the event is immediately consumed by the machine in the current step.
1058
- *
1059
- * @param eventType The event to raise.
1055
+ /**
1056
+ * Raises an event. This places the event in the internal event queue, so that
1057
+ * the event is immediately consumed by the machine in the current step.
1058
+ *
1059
+ * @param eventType The event to raise.
1060
1060
  */
1061
1061
 
1062
1062
  function raise(event) {
@@ -1077,15 +1077,15 @@ function resolveRaise(action) {
1077
1077
  _event: toSCXMLEvent(action.event)
1078
1078
  };
1079
1079
  }
1080
- /**
1081
- * Sends an event. This returns an action that will be read by an interpreter to
1082
- * send the event in the next step, after the current step is finished executing.
1083
- *
1084
- * @param event The event to send.
1085
- * @param options Options to pass into the send event:
1086
- * - `id` - The unique send event identifier (used with `cancel()`).
1087
- * - `delay` - The number of milliseconds to delay the sending of the event.
1088
- * - `to` - The target of this event (by default, the machine the event was sent from).
1080
+ /**
1081
+ * Sends an event. This returns an action that will be read by an interpreter to
1082
+ * send the event in the next step, after the current step is finished executing.
1083
+ *
1084
+ * @param event The event to send.
1085
+ * @param options Options to pass into the send event:
1086
+ * - `id` - The unique send event identifier (used with `cancel()`).
1087
+ * - `delay` - The number of milliseconds to delay the sending of the event.
1088
+ * - `to` - The target of this event (by default, the machine the event was sent from).
1089
1089
  */
1090
1090
 
1091
1091
  function send(event, options) {
@@ -1127,12 +1127,12 @@ var resolveLog = function (action, ctx, _event) {
1127
1127
  })
1128
1128
  });
1129
1129
  };
1130
- /**
1131
- * Cancels an in-flight `send(...)` action. A canceled sent action will not
1132
- * be executed, nor will its event be sent, unless it has already been sent
1133
- * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`).
1134
- *
1135
- * @param sendId The `id` of the `send(...)` action to cancel.
1130
+ /**
1131
+ * Cancels an in-flight `send(...)` action. A canceled sent action will not
1132
+ * be executed, nor will its event be sent, unless it has already been sent
1133
+ * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`).
1134
+ *
1135
+ * @param sendId The `id` of the `send(...)` action to cancel.
1136
1136
  */
1137
1137
 
1138
1138
  var cancel = function (sendId) {
@@ -1141,10 +1141,10 @@ var cancel = function (sendId) {
1141
1141
  sendId: sendId
1142
1142
  };
1143
1143
  };
1144
- /**
1145
- * Starts an activity.
1146
- *
1147
- * @param activity The activity to start.
1144
+ /**
1145
+ * Starts an activity.
1146
+ *
1147
+ * @param activity The activity to start.
1148
1148
  */
1149
1149
 
1150
1150
  function start(activity) {
@@ -1155,10 +1155,10 @@ function start(activity) {
1155
1155
  exec: undefined
1156
1156
  };
1157
1157
  }
1158
- /**
1159
- * Stops an activity.
1160
- *
1161
- * @param actorRef The activity to stop.
1158
+ /**
1159
+ * Stops an activity.
1160
+ *
1161
+ * @param actorRef The activity to stop.
1162
1162
  */
1163
1163
 
1164
1164
  function stop(actorRef) {
@@ -1180,10 +1180,10 @@ function resolveStop(action, context, _event) {
1180
1180
  };
1181
1181
  return actionObject;
1182
1182
  }
1183
- /**
1184
- * Updates the current context of the machine.
1185
- *
1186
- * @param assignment An object that represents the partial context to update.
1183
+ /**
1184
+ * Updates the current context of the machine.
1185
+ *
1186
+ * @param assignment An object that represents the partial context to update.
1187
1187
  */
1188
1188
 
1189
1189
  var assign = function (assignment) {
@@ -1192,24 +1192,24 @@ var assign = function (assignment) {
1192
1192
  assignment: assignment
1193
1193
  };
1194
1194
  };
1195
- /**
1196
- * Returns an event type that represents an implicit event that
1197
- * is sent after the specified `delay`.
1198
- *
1199
- * @param delayRef The delay in milliseconds
1200
- * @param id The state node ID where this event is handled
1195
+ /**
1196
+ * Returns an event type that represents an implicit event that
1197
+ * is sent after the specified `delay`.
1198
+ *
1199
+ * @param delayRef The delay in milliseconds
1200
+ * @param id The state node ID where this event is handled
1201
1201
  */
1202
1202
 
1203
1203
  function after(delayRef, id) {
1204
1204
  var idSuffix = id ? "#" + id : '';
1205
1205
  return ActionTypes.After + "(" + delayRef + ")" + idSuffix;
1206
1206
  }
1207
- /**
1208
- * Returns an event that represents that a final state node
1209
- * has been reached in the parent state node.
1210
- *
1211
- * @param id The final state node's parent state node `id`
1212
- * @param data The data to pass into the event
1207
+ /**
1208
+ * Returns an event that represents that a final state node
1209
+ * has been reached in the parent state node.
1210
+ *
1211
+ * @param id The final state node's parent state node `id`
1212
+ * @param data The data to pass into the event
1213
1213
  */
1214
1214
 
1215
1215
  function done(id, data) {
@@ -1225,14 +1225,14 @@ function done(id, data) {
1225
1225
 
1226
1226
  return eventObject;
1227
1227
  }
1228
- /**
1229
- * Returns an event that represents that an invoked service has terminated.
1230
- *
1231
- * An invoked service is terminated when it has reached a top-level final state node,
1232
- * but not when it is canceled.
1233
- *
1234
- * @param id The final state node ID
1235
- * @param data The data to pass into the event
1228
+ /**
1229
+ * Returns an event that represents that an invoked service has terminated.
1230
+ *
1231
+ * An invoked service is terminated when it has reached a top-level final state node,
1232
+ * but not when it is canceled.
1233
+ *
1234
+ * @param id The final state node ID
1235
+ * @param data The data to pass into the event
1236
1236
  */
1237
1237
 
1238
1238
  function doneInvoke(id, data) {
@@ -1643,17 +1643,17 @@ var State =
1643
1643
 
1644
1644
  /** @class */
1645
1645
  function () {
1646
- /**
1647
- * Creates a new State instance.
1648
- * @param value The state value
1649
- * @param context The extended state
1650
- * @param historyValue The tree representing historical values of the state nodes
1651
- * @param history The previous state
1652
- * @param actions An array of action objects to execute as side-effects
1653
- * @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).
1654
- * @param meta
1655
- * @param events Internal event queue. Should be empty with run-to-completion semantics.
1656
- * @param configuration
1646
+ /**
1647
+ * Creates a new State instance.
1648
+ * @param value The state value
1649
+ * @param context The extended state
1650
+ * @param historyValue The tree representing historical values of the state nodes
1651
+ * @param history The previous state
1652
+ * @param actions An array of action objects to execute as side-effects
1653
+ * @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).
1654
+ * @param meta
1655
+ * @param events Internal event queue. Should be empty with run-to-completion semantics.
1656
+ * @param configuration
1657
1657
  */
1658
1658
  function State(config) {
1659
1659
  var _this = this;
@@ -1689,10 +1689,10 @@ function () {
1689
1689
  }
1690
1690
  });
1691
1691
  }
1692
- /**
1693
- * Creates a new State instance for the given `stateValue` and `context`.
1694
- * @param stateValue
1695
- * @param context
1692
+ /**
1693
+ * Creates a new State instance for the given `stateValue` and `context`.
1694
+ * @param stateValue
1695
+ * @param context
1696
1696
  */
1697
1697
 
1698
1698
 
@@ -1736,19 +1736,19 @@ function () {
1736
1736
  children: {}
1737
1737
  });
1738
1738
  };
1739
- /**
1740
- * Creates a new State instance for the given `config`.
1741
- * @param config The state config
1739
+ /**
1740
+ * Creates a new State instance for the given `config`.
1741
+ * @param config The state config
1742
1742
  */
1743
1743
 
1744
1744
 
1745
1745
  State.create = function (config) {
1746
1746
  return new State(config);
1747
1747
  };
1748
- /**
1749
- * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).
1750
- * @param stateValue
1751
- * @param context
1748
+ /**
1749
+ * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).
1750
+ * @param stateValue
1751
+ * @param context
1752
1752
  */
1753
1753
 
1754
1754
 
@@ -1775,10 +1775,10 @@ function () {
1775
1775
 
1776
1776
  return State.from(stateValue, context);
1777
1777
  };
1778
- /**
1779
- * Returns an array of all the string leaf state node paths.
1780
- * @param stateValue
1781
- * @param delimiter The character(s) that separate each subpath in the string state node path.
1778
+ /**
1779
+ * Returns an array of all the string leaf state node paths.
1780
+ * @param stateValue
1781
+ * @param delimiter The character(s) that separate each subpath in the string state node path.
1782
1782
  */
1783
1783
 
1784
1784
 
@@ -1817,28 +1817,28 @@ function () {
1817
1817
  tags: Array.from(tags)
1818
1818
  });
1819
1819
  };
1820
- /**
1821
- * Whether the current state value is a subset of the given parent state value.
1822
- * @param parentStateValue
1820
+ /**
1821
+ * Whether the current state value is a subset of the given parent state value.
1822
+ * @param parentStateValue
1823
1823
  */
1824
1824
 
1825
1825
 
1826
1826
  State.prototype.matches = function (parentStateValue) {
1827
1827
  return matchesState(parentStateValue, this.value);
1828
1828
  };
1829
- /**
1830
- * Whether the current state configuration has a state node with the specified `tag`.
1831
- * @param tag
1829
+ /**
1830
+ * Whether the current state configuration has a state node with the specified `tag`.
1831
+ * @param tag
1832
1832
  */
1833
1833
 
1834
1834
 
1835
1835
  State.prototype.hasTag = function (tag) {
1836
1836
  return this.tags.has(tag);
1837
1837
  };
1838
- /**
1839
- * Determines whether sending the `event` will cause a transition.
1840
- * @param event The event to test
1841
- * @returns Whether the event will cause a transition
1838
+ /**
1839
+ * Determines whether sending the `event` will cause a transition.
1840
+ * @param event The event to test
1841
+ * @returns Whether the event will cause a transition
1842
1842
  */
1843
1843
 
1844
1844
 
@@ -1855,9 +1855,9 @@ function () {
1855
1855
  return State;
1856
1856
  }();
1857
1857
 
1858
- /**
1859
- * Maintains a stack of the current service in scope.
1860
- * This is used to provide the correct service to spawn().
1858
+ /**
1859
+ * Maintains a stack of the current service in scope.
1860
+ * This is used to provide the correct service to spawn().
1861
1861
  */
1862
1862
  var provide = function (service, fn) {
1863
1863
  var result = fn(service);
@@ -1887,11 +1887,11 @@ function createNullActor(id) {
1887
1887
  }
1888
1888
  };
1889
1889
  }
1890
- /**
1891
- * Creates a deferred actor that is able to be invoked given the provided
1892
- * invocation information in its `.meta` value.
1893
- *
1894
- * @param invokeDefinition The meta information needed to invoke the actor.
1890
+ /**
1891
+ * Creates a deferred actor that is able to be invoked given the provided
1892
+ * invocation information in its `.meta` value.
1893
+ *
1894
+ * @param invokeDefinition The meta information needed to invoke the actor.
1895
1895
  */
1896
1896
 
1897
1897
  function createInvocableActor(invokeDefinition, machine, context, _event) {
@@ -1982,12 +1982,12 @@ var StateNode =
1982
1982
  /** @class */
1983
1983
  function () {
1984
1984
  function StateNode(
1985
- /**
1986
- * The raw config used to create the machine.
1985
+ /**
1986
+ * The raw config used to create the machine.
1987
1987
  */
1988
1988
  config, options,
1989
- /**
1990
- * The initial extended state
1989
+ /**
1990
+ * The initial extended state
1991
1991
  */
1992
1992
  _context // TODO: this is unsafe, but we're removing it in v5 anyway
1993
1993
  ) {
@@ -2001,8 +2001,8 @@ function () {
2001
2001
 
2002
2002
  this.config = config;
2003
2003
  this._context = _context;
2004
- /**
2005
- * The order this state node appears. Corresponds to the implicit SCXML document order.
2004
+ /**
2005
+ * The order this state node appears. Corresponds to the implicit SCXML document order.
2006
2006
  */
2007
2007
 
2008
2008
  this.order = -1;
@@ -2137,11 +2137,11 @@ function () {
2137
2137
  return stateNode.on;
2138
2138
  });
2139
2139
  };
2140
- /**
2141
- * Clones this state machine with custom options and context.
2142
- *
2143
- * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.
2144
- * @param context Custom context (will override predefined context)
2140
+ /**
2141
+ * Clones this state machine with custom options and context.
2142
+ *
2143
+ * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.
2144
+ * @param context Custom context (will override predefined context)
2145
2145
  */
2146
2146
 
2147
2147
 
@@ -2160,10 +2160,10 @@ function () {
2160
2160
  delays: __assign$1(__assign$1({}, delays), options.delays)
2161
2161
  }, context !== null && context !== void 0 ? context : this.context);
2162
2162
  };
2163
- /**
2164
- * Clones this state machine with custom context.
2165
- *
2166
- * @param context Custom context (will override predefined context, not recursive)
2163
+ /**
2164
+ * Clones this state machine with custom context.
2165
+ *
2166
+ * @param context Custom context (will override predefined context, not recursive)
2167
2167
  */
2168
2168
 
2169
2169
 
@@ -2179,8 +2179,8 @@ function () {
2179
2179
  configurable: true
2180
2180
  });
2181
2181
  Object.defineProperty(StateNode.prototype, "definition", {
2182
- /**
2183
- * The well-structured state node definition.
2182
+ /**
2183
+ * The well-structured state node definition.
2184
2184
  */
2185
2185
  get: function () {
2186
2186
  return {
@@ -2214,8 +2214,8 @@ function () {
2214
2214
  };
2215
2215
 
2216
2216
  Object.defineProperty(StateNode.prototype, "on", {
2217
- /**
2218
- * The mapping of events to transitions.
2217
+ /**
2218
+ * The mapping of events to transitions.
2219
2219
  */
2220
2220
  get: function () {
2221
2221
  if (this.__cache.on) {
@@ -2240,8 +2240,8 @@ function () {
2240
2240
  configurable: true
2241
2241
  });
2242
2242
  Object.defineProperty(StateNode.prototype, "transitions", {
2243
- /**
2244
- * All the transitions that can be taken from this state node.
2243
+ /**
2244
+ * All the transitions that can be taken from this state node.
2245
2245
  */
2246
2246
  get: function () {
2247
2247
  return this.__cache.transitions || (this.__cache.transitions = this.formatTransitions(), this.__cache.transitions);
@@ -2264,8 +2264,8 @@ function () {
2264
2264
  this.__cache.candidates[eventName] = candidates;
2265
2265
  return candidates;
2266
2266
  };
2267
- /**
2268
- * All delayed transitions from the config.
2267
+ /**
2268
+ * All delayed transitions from the config.
2269
2269
  */
2270
2270
 
2271
2271
 
@@ -2317,10 +2317,10 @@ function () {
2317
2317
  });
2318
2318
  });
2319
2319
  };
2320
- /**
2321
- * Returns the state nodes represented by the current state value.
2322
- *
2323
- * @param state The state value or State instance
2320
+ /**
2321
+ * Returns the state nodes represented by the current state value.
2322
+ *
2323
+ * @param state The state value or State instance
2324
2324
  */
2325
2325
 
2326
2326
 
@@ -2351,10 +2351,10 @@ function () {
2351
2351
  return allSubStateNodes.concat(subStateNode);
2352
2352
  }, []));
2353
2353
  };
2354
- /**
2355
- * Returns `true` if this state node explicitly handles the given event.
2356
- *
2357
- * @param event The event in question
2354
+ /**
2355
+ * Returns `true` if this state node explicitly handles the given event.
2356
+ *
2357
+ * @param event The event in question
2358
2358
  */
2359
2359
 
2360
2360
 
@@ -2362,12 +2362,12 @@ function () {
2362
2362
  var eventType = getEventType(event);
2363
2363
  return this.events.includes(eventType);
2364
2364
  };
2365
- /**
2366
- * Resolves the given `state` to a new `State` instance relative to this machine.
2367
- *
2368
- * This ensures that `.events` and `.nextEvents` represent the correct values.
2369
- *
2370
- * @param state The state to resolve
2365
+ /**
2366
+ * Resolves the given `state` to a new `State` instance relative to this machine.
2367
+ *
2368
+ * This ensures that `.events` and `.nextEvents` represent the correct values.
2369
+ *
2370
+ * @param state The state to resolve
2371
2371
  */
2372
2372
 
2373
2373
 
@@ -2585,9 +2585,9 @@ function () {
2585
2585
 
2586
2586
  return nodes;
2587
2587
  };
2588
- /**
2589
- * Whether the given state node "escapes" this state node. If the `stateNode` is equal to or the parent of
2590
- * this state node, it does not escape.
2588
+ /**
2589
+ * Whether the given state node "escapes" this state node. If the `stateNode` is equal to or the parent of
2590
+ * this state node, it does not escape.
2591
2591
  */
2592
2592
 
2593
2593
 
@@ -2712,12 +2712,12 @@ function () {
2712
2712
  var actions = toActionObjects(exitActions.concat(transition.actions).concat(entryActions), this.machine.options.actions);
2713
2713
  return actions;
2714
2714
  };
2715
- /**
2716
- * Determines the next state given the current `state` and sent `event`.
2717
- *
2718
- * @param state The current State instance or state value
2719
- * @param event The event that was sent at the current state
2720
- * @param context The current context (extended state) of the current state
2715
+ /**
2716
+ * Determines the next state given the current `state` and sent `event`.
2717
+ *
2718
+ * @param state The current State instance or state value
2719
+ * @param event The event that was sent at the current state
2720
+ * @param context The current context (extended state) of the current state
2721
2721
  */
2722
2722
 
2723
2723
 
@@ -2910,8 +2910,8 @@ function () {
2910
2910
  })));
2911
2911
  return maybeNextState;
2912
2912
  };
2913
- /**
2914
- * Returns the child state node from its relative `stateKey`, or throws.
2913
+ /**
2914
+ * Returns the child state node from its relative `stateKey`, or throws.
2915
2915
  */
2916
2916
 
2917
2917
 
@@ -2932,10 +2932,10 @@ function () {
2932
2932
 
2933
2933
  return result;
2934
2934
  };
2935
- /**
2936
- * Returns the state node with the given `stateId`, or throws.
2937
- *
2938
- * @param stateId The state ID. The prefix "#" is removed.
2935
+ /**
2936
+ * Returns the state node with the given `stateId`, or throws.
2937
+ *
2938
+ * @param stateId The state ID. The prefix "#" is removed.
2939
2939
  */
2940
2940
 
2941
2941
 
@@ -2954,10 +2954,10 @@ function () {
2954
2954
 
2955
2955
  return stateNode;
2956
2956
  };
2957
- /**
2958
- * Returns the relative state node from the given `statePath`, or throws.
2959
- *
2960
- * @param statePath The string or string array relative path to the state node.
2957
+ /**
2958
+ * Returns the relative state node from the given `statePath`, or throws.
2959
+ *
2960
+ * @param statePath The string or string array relative path to the state node.
2961
2961
  */
2962
2962
 
2963
2963
 
@@ -2985,10 +2985,10 @@ function () {
2985
2985
 
2986
2986
  return currentStateNode;
2987
2987
  };
2988
- /**
2989
- * Resolves a partial state value with its full representation in this machine.
2990
- *
2991
- * @param stateValue The partial state value to resolve.
2988
+ /**
2989
+ * Resolves a partial state value with its full representation in this machine.
2990
+ *
2991
+ * @param stateValue The partial state value to resolve.
2992
2992
  */
2993
2993
 
2994
2994
 
@@ -3092,9 +3092,9 @@ function () {
3092
3092
  };
3093
3093
 
3094
3094
  Object.defineProperty(StateNode.prototype, "initialState", {
3095
- /**
3096
- * The initial State instance, which includes all actions to be executed from
3097
- * entering the initial state.
3095
+ /**
3096
+ * The initial State instance, which includes all actions to be executed from
3097
+ * entering the initial state.
3098
3098
  */
3099
3099
  get: function () {
3100
3100
  this._init(); // TODO: this should be in the constructor (see note in constructor)
@@ -3112,9 +3112,9 @@ function () {
3112
3112
  configurable: true
3113
3113
  });
3114
3114
  Object.defineProperty(StateNode.prototype, "target", {
3115
- /**
3116
- * The target state value of the history state node, if it exists. This represents the
3117
- * default state value to transition to if no history value exists yet.
3115
+ /**
3116
+ * The target state value of the history state node, if it exists. This represents the
3117
+ * default state value to transition to if no history value exists yet.
3118
3118
  */
3119
3119
  get: function () {
3120
3120
  var target;
@@ -3134,12 +3134,12 @@ function () {
3134
3134
  enumerable: false,
3135
3135
  configurable: true
3136
3136
  });
3137
- /**
3138
- * Returns the leaf nodes from a state path relative to this state node.
3139
- *
3140
- * @param relativeStateId The relative state path to retrieve the state nodes
3141
- * @param history The previous state to retrieve history
3142
- * @param resolve Whether state nodes should resolve to initial child state nodes
3137
+ /**
3138
+ * Returns the leaf nodes from a state path relative to this state node.
3139
+ *
3140
+ * @param relativeStateId The relative state path to retrieve the state nodes
3141
+ * @param history The previous state to retrieve history
3142
+ * @param resolve Whether state nodes should resolve to initial child state nodes
3143
3143
  */
3144
3144
 
3145
3145
  StateNode.prototype.getRelativeStateNodes = function (relativeStateId, historyValue, resolve) {
@@ -3172,11 +3172,11 @@ function () {
3172
3172
  enumerable: false,
3173
3173
  configurable: true
3174
3174
  });
3175
- /**
3176
- * Retrieves state nodes from a relative path to this state node.
3177
- *
3178
- * @param relativePath The relative path from this state node
3179
- * @param historyValue
3175
+ /**
3176
+ * Retrieves state nodes from a relative path to this state node.
3177
+ *
3178
+ * @param relativePath The relative path from this state node
3179
+ * @param historyValue
3180
3180
  */
3181
3181
 
3182
3182
  StateNode.prototype.getFromRelativePath = function (relativePath) {
@@ -3224,11 +3224,11 @@ function () {
3224
3224
  })
3225
3225
  };
3226
3226
  };
3227
- /**
3228
- * Resolves to the historical value(s) of the parent state node,
3229
- * represented by state nodes.
3230
- *
3231
- * @param historyValue
3227
+ /**
3228
+ * Resolves to the historical value(s) of the parent state node,
3229
+ * represented by state nodes.
3230
+ *
3231
+ * @param historyValue
3232
3232
  */
3233
3233
 
3234
3234
 
@@ -3260,8 +3260,8 @@ function () {
3260
3260
  };
3261
3261
 
3262
3262
  Object.defineProperty(StateNode.prototype, "stateIds", {
3263
- /**
3264
- * All the state node IDs of this state node and its descendant state nodes.
3263
+ /**
3264
+ * All the state node IDs of this state node and its descendant state nodes.
3265
3265
  */
3266
3266
  get: function () {
3267
3267
  var _this = this;
@@ -3275,8 +3275,8 @@ function () {
3275
3275
  configurable: true
3276
3276
  });
3277
3277
  Object.defineProperty(StateNode.prototype, "events", {
3278
- /**
3279
- * All the event types accepted by this state node and its descendants.
3278
+ /**
3279
+ * All the event types accepted by this state node and its descendants.
3280
3280
  */
3281
3281
  get: function () {
3282
3282
  var e_7, _a, e_8, _b;
@@ -3332,10 +3332,10 @@ function () {
3332
3332
  configurable: true
3333
3333
  });
3334
3334
  Object.defineProperty(StateNode.prototype, "ownEvents", {
3335
- /**
3336
- * All the events that have transitions directly from this state node.
3337
- *
3338
- * Excludes any inert events.
3335
+ /**
3336
+ * All the events that have transitions directly from this state node.
3337
+ *
3338
+ * Excludes any inert events.
3339
3339
  */
3340
3340
  get: function () {
3341
3341
  var events = new Set(this.transitions.filter(function (transition) {
@@ -7633,89 +7633,89 @@ var storage = {
7633
7633
  }
7634
7634
  };
7635
7635
 
7636
- /*! *****************************************************************************
7637
- Copyright (c) Microsoft Corporation.
7638
-
7639
- Permission to use, copy, modify, and/or distribute this software for any
7640
- purpose with or without fee is hereby granted.
7641
-
7642
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7643
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
7644
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
7645
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
7646
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
7647
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
7648
- PERFORMANCE OF THIS SOFTWARE.
7649
- ***************************************************************************** */
7650
-
7651
- var __assign = function() {
7652
- __assign = Object.assign || function __assign(t) {
7653
- for (var s, i = 1, n = arguments.length; i < n; i++) {
7654
- s = arguments[i];
7655
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
7656
- }
7657
- return t;
7658
- };
7659
- return __assign.apply(this, arguments);
7660
- };
7661
-
7662
- function __rest(s, e) {
7663
- var t = {};
7664
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
7665
- t[p] = s[p];
7666
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7667
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7668
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
7669
- t[p[i]] = s[p[i]];
7670
- }
7671
- return t;
7672
- }
7673
-
7674
- function __awaiter(thisArg, _arguments, P, generator) {
7675
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7676
- return new (P || (P = Promise))(function (resolve, reject) {
7677
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7678
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7679
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7680
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7681
- });
7682
- }
7683
-
7684
- function __generator(thisArg, body) {
7685
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
7686
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
7687
- function verb(n) { return function (v) { return step([n, v]); }; }
7688
- function step(op) {
7689
- if (f) throw new TypeError("Generator is already executing.");
7690
- while (_) try {
7691
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
7692
- if (y = 0, t) op = [op[0] & 2, t.value];
7693
- switch (op[0]) {
7694
- case 0: case 1: t = op; break;
7695
- case 4: _.label++; return { value: op[1], done: false };
7696
- case 5: _.label++; y = op[1]; op = [0]; continue;
7697
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
7698
- default:
7699
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
7700
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
7701
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
7702
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
7703
- if (t[2]) _.ops.pop();
7704
- _.trys.pop(); continue;
7705
- }
7706
- op = body.call(thisArg, _);
7707
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
7708
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7709
- }
7710
- }
7711
-
7712
- /** @deprecated */
7713
- function __spreadArrays() {
7714
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
7715
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
7716
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
7717
- r[k] = a[j];
7718
- return r;
7636
+ /*! *****************************************************************************
7637
+ Copyright (c) Microsoft Corporation.
7638
+
7639
+ Permission to use, copy, modify, and/or distribute this software for any
7640
+ purpose with or without fee is hereby granted.
7641
+
7642
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7643
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
7644
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
7645
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
7646
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
7647
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
7648
+ PERFORMANCE OF THIS SOFTWARE.
7649
+ ***************************************************************************** */
7650
+
7651
+ var __assign = function() {
7652
+ __assign = Object.assign || function __assign(t) {
7653
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7654
+ s = arguments[i];
7655
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
7656
+ }
7657
+ return t;
7658
+ };
7659
+ return __assign.apply(this, arguments);
7660
+ };
7661
+
7662
+ function __rest(s, e) {
7663
+ var t = {};
7664
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
7665
+ t[p] = s[p];
7666
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7667
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7668
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
7669
+ t[p[i]] = s[p[i]];
7670
+ }
7671
+ return t;
7672
+ }
7673
+
7674
+ function __awaiter(thisArg, _arguments, P, generator) {
7675
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7676
+ return new (P || (P = Promise))(function (resolve, reject) {
7677
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7678
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7679
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7680
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
7681
+ });
7682
+ }
7683
+
7684
+ function __generator(thisArg, body) {
7685
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
7686
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
7687
+ function verb(n) { return function (v) { return step([n, v]); }; }
7688
+ function step(op) {
7689
+ if (f) throw new TypeError("Generator is already executing.");
7690
+ while (_) try {
7691
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
7692
+ if (y = 0, t) op = [op[0] & 2, t.value];
7693
+ switch (op[0]) {
7694
+ case 0: case 1: t = op; break;
7695
+ case 4: _.label++; return { value: op[1], done: false };
7696
+ case 5: _.label++; y = op[1]; op = [0]; continue;
7697
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
7698
+ default:
7699
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
7700
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
7701
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
7702
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
7703
+ if (t[2]) _.ops.pop();
7704
+ _.trys.pop(); continue;
7705
+ }
7706
+ op = body.call(thisArg, _);
7707
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
7708
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7709
+ }
7710
+ }
7711
+
7712
+ /** @deprecated */
7713
+ function __spreadArrays() {
7714
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
7715
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
7716
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
7717
+ r[k] = a[j];
7718
+ return r;
7719
7719
  }
7720
7720
 
7721
7721
  /**
@@ -18566,7 +18566,7 @@ function crypto (request) {
18566
18566
  },
18567
18567
  },
18568
18568
  idle: {
18569
- always: [{ target: 'calculable', cond: 'isCalculable' }],
18569
+ always: [{ target: 'debouncing', cond: 'isCalculable' }],
18570
18570
  },
18571
18571
  debouncing: {
18572
18572
  after: {
@@ -18575,13 +18575,13 @@ function crypto (request) {
18575
18575
  },
18576
18576
  },
18577
18577
  },
18578
- calculable: {
18579
- on: {
18580
- CALCULATE: {
18581
- target: 'calculating',
18582
- },
18583
- },
18584
- },
18578
+ // calculable: {
18579
+ // on: {
18580
+ // CALCULATE: {
18581
+ // target: 'calculating',
18582
+ // },
18583
+ // },
18584
+ // },
18585
18585
  calculating: {
18586
18586
  invoke: {
18587
18587
  src: 'fetchCalculation',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.188",
3
+ "version": "1.0.190",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -41,7 +41,7 @@ export default function (request) {
41
41
  },
42
42
  },
43
43
  idle: {
44
- always: [{ target: 'calculable', cond: 'isCalculable' }],
44
+ always: [{ target: 'debouncing', cond: 'isCalculable' }],
45
45
  },
46
46
  debouncing: {
47
47
  after: {
@@ -50,13 +50,13 @@ export default function (request) {
50
50
  },
51
51
  },
52
52
  },
53
- calculable: {
54
- on: {
55
- CALCULATE: {
56
- target: 'calculating',
57
- },
58
- },
59
- },
53
+ // calculable: {
54
+ // on: {
55
+ // CALCULATE: {
56
+ // target: 'calculating',
57
+ // },
58
+ // },
59
+ // },
60
60
  calculating: {
61
61
  invoke: {
62
62
  src: 'fetchCalculation',
@@ -7,15 +7,7 @@ export default function (request) {
7
7
  id: 'loadcard',
8
8
  initial: 'loading',
9
9
  context: {
10
- cards: [
11
- { name: 'mobifone', code: 'VMS', category: 'loadcard', methodDescription: 'MOBIFONE' },
12
- { name: 'viettel', code: 'VTT', category: 'loadcard', methodDescription: 'VIETTEL' },
13
- { name: 'vinaphone', code: 'VNP', category: 'loadcard', methodDescription: 'VINAPHONE' },
14
- // { name: 'vietnam mobile', code: 'VNM' },
15
- // { name: 'thẻ zing', code: 'ZING' },
16
- // { name: 'thẻ gate', code: 'GATE' },
17
- // { name: 'thẻ garena', code: 'GARENA' },
18
- ],
10
+ cards: [],
19
11
  options: [],
20
12
 
21
13
  selectedCard: null,
@@ -50,20 +42,37 @@ export default function (request) {
50
42
  actions: 'setCard',
51
43
  },
52
44
  SELECT_AMOUNT: {
53
- target: 'calculable',
45
+ target: 'debouncing',
54
46
  actions: 'setAmount',
55
47
  },
56
48
  },
57
49
  },
50
+ debouncing: {
51
+ on: {
52
+ SELECT_AMOUNT: {
53
+ target: 'debouncing',
54
+ actions: 'setAmount',
55
+ },
56
+ BACK: {
57
+ target: 'loaded',
58
+ },
59
+ },
60
+ after: {
61
+ 1000: {
62
+ target: 'calculating',
63
+ },
64
+ },
65
+ },
58
66
  fail: {},
59
67
  calculable: {
60
68
  entry: 'clearCalculation',
61
69
  on: {
62
70
  SELECT_AMOUNT: {
71
+ target: 'debouncing',
63
72
  actions: 'setAmount',
64
73
  },
65
74
  CALCULATE: {
66
- target: 'calculating',
75
+ target: 'debouncing',
67
76
  },
68
77
  BACK: {
69
78
  target: 'loaded',
@@ -85,7 +94,7 @@ export default function (request) {
85
94
  calculated: {
86
95
  on: {
87
96
  SELECT_AMOUNT: {
88
- target: 'calculable',
97
+ target: 'debouncing',
89
98
  actions: 'setAmount',
90
99
  },
91
100
  CONFIRM: {
@@ -95,7 +104,7 @@ export default function (request) {
95
104
  target: 'loaded',
96
105
  },
97
106
  CLEAR_CALCULATION: {
98
- target: 'calculable',
107
+ target: 'debouncing',
99
108
  actions: 'clearCalculation',
100
109
  },
101
110
  },
@@ -150,18 +159,20 @@ export default function (request) {
150
159
  }),
151
160
  setInitData: assign((context, event) => {
152
161
  const paymentDetails = event.data
153
- const currentPayment = paymentDetails.find((element) => element.category === context.currentCategory)
162
+ const cards = paymentDetails.filter((element) => element.category === context.currentCategory)
154
163
  return {
155
164
  paymentDetails,
156
- currentPayment,
157
- currentMethod: currentPayment.method,
158
- options: currentPayment.optional,
159
- selectedCard: context.cards[0],
165
+ cards,
166
+ selectedCard: cards[0],
167
+ currentMethod: cards[0].method,
168
+ options: cards[0].optional
160
169
  }
161
170
  }),
162
171
  setCard: assign((context, event) => {
163
172
  return {
164
173
  selectedCard: event.data,
174
+ currentMethod: event.data.method,
175
+ options: event.data.optional,
165
176
  }
166
177
  }),
167
178
  setCardNumber: assign((context, event) => {
@@ -198,11 +209,6 @@ export default function (request) {
198
209
  fetchInitData: async (context, event) => {
199
210
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
200
211
  },
201
- fetchBanksList: async (context, event) => {
202
- const { paymentDetails, currentCategory } = context
203
- const method = paymentDetails.find((item) => item.category === currentCategory)?.method
204
- return await request.send(payment.getBankList(method))
205
- },
206
212
  fetchCalculation: async (context, event) => {
207
213
  const { currentMethod, selectedAmount } = context
208
214
  return await request.send(
@@ -199,11 +199,6 @@ export default function (request) {
199
199
  fetchInitData: async (context, event) => {
200
200
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
201
201
  },
202
- fetchBanksList: async (context, event) => {
203
- const { paymentDetails, currentCategory } = context
204
- const method = paymentDetails.find((item) => item.category === currentCategory)?.method
205
- return await request.send(payment.getBankList(method))
206
- },
207
202
  fetchCalculation: async (context, event) => {
208
203
  const { currentMethod, selectedAmount } = context
209
204
  return await request.send(