@jetthai/cuora 1.0.182 → 1.0.184-1

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,12 @@
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.184-1](https://github.com/jetthai/cuora-module/compare/v1.0.184...v1.0.184-1) (2022-10-07)
6
+
7
+ ### [1.0.184](https://github.com/jetthai/cuora-module/compare/v1.0.183...v1.0.184) (2022-10-03)
8
+
9
+ ### [1.0.183](https://github.com/jetthai/cuora-module/compare/v1.0.182...v1.0.183) (2022-10-03)
10
+
5
11
  ### [1.0.182](https://github.com/jetthai/cuora-module/compare/v1.0.181...v1.0.182) (2022-10-03)
6
12
 
7
13
  ### [1.0.181](https://github.com/jetthai/cuora-module/compare/v1.0.180...v1.0.181) (2022-09-29)
package/dist/bundle.mjs CHANGED
@@ -67,6 +67,25 @@ var auth$1 = {
67
67
  isPublic: true,
68
68
  headers: { 'x-access-captcha': reCaptchaToken },
69
69
  }),
70
+ loginApp: ({ provider, accessToken, channel, subchannel, dt, from, id, name, picture }) => ({
71
+ url: 'appLogin',
72
+ method: 'post',
73
+ params: {
74
+ provider,
75
+ data: {
76
+ accessToken,
77
+ channel,
78
+ subchannel,
79
+ dt,
80
+ from,
81
+ id,
82
+ name,
83
+ picture,
84
+ provider,
85
+ },
86
+ },
87
+ isPublic: true,
88
+ }),
70
89
  register: ({ channel = 'official', subchannel = 'pwa', reCaptchaToken, dt, ...rest }) => ({
71
90
  url: `register?channel=${channel}&subchannel=${subchannel}`,
72
91
  method: 'post',
@@ -345,77 +364,77 @@ var form = {
345
364
 
346
365
  var index$2 = { activity: activity$2, auth: auth$1, common: common$1, game: game$1, mailbox, payment, user, form };
347
366
 
348
- /*! *****************************************************************************
349
- Copyright (c) Microsoft Corporation.
350
-
351
- Permission to use, copy, modify, and/or distribute this software for any
352
- purpose with or without fee is hereby granted.
353
-
354
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
355
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
356
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
357
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
358
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
359
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
360
- PERFORMANCE OF THIS SOFTWARE.
361
- ***************************************************************************** */
362
-
363
- var __assign$1 = function() {
364
- __assign$1 = Object.assign || function __assign(t) {
365
- for (var s, i = 1, n = arguments.length; i < n; i++) {
366
- s = arguments[i];
367
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
368
- }
369
- return t;
370
- };
371
- return __assign$1.apply(this, arguments);
372
- };
373
-
374
- function __rest$1(s, e) {
375
- var t = {};
376
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
377
- t[p] = s[p];
378
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
379
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
380
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
381
- t[p[i]] = s[p[i]];
382
- }
383
- return t;
384
- }
385
-
386
- function __values(o) {
387
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
388
- if (m) return m.call(o);
389
- if (o && typeof o.length === "number") return {
390
- next: function () {
391
- if (o && i >= o.length) o = void 0;
392
- return { value: o && o[i++], done: !o };
393
- }
394
- };
395
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
396
- }
397
-
398
- function __read(o, n) {
399
- var m = typeof Symbol === "function" && o[Symbol.iterator];
400
- if (!m) return o;
401
- var i = m.call(o), r, ar = [], e;
402
- try {
403
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
404
- }
405
- catch (error) { e = { error: error }; }
406
- finally {
407
- try {
408
- if (r && !r.done && (m = i["return"])) m.call(i);
409
- }
410
- finally { if (e) throw e.error; }
411
- }
412
- return ar;
413
- }
414
-
415
- function __spreadArray(to, from) {
416
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
417
- to[j] = from[i];
418
- 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;
419
438
  }
420
439
 
421
440
  var STATE_DELIMITER = '.';
@@ -552,9 +571,9 @@ function mapFilterValues(collection, iteratee, predicate) {
552
571
 
553
572
  return result;
554
573
  }
555
- /**
556
- * Retrieves a value at the given path.
557
- * @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
558
577
  */
559
578
 
560
579
  var path = function (props) {
@@ -583,9 +602,9 @@ var path = function (props) {
583
602
  return result;
584
603
  };
585
604
  };
586
- /**
587
- * Retrieves a value at the given path via the nested accessor prop.
588
- * @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
589
608
  */
590
609
 
591
610
  function nestedPath(props, accessorProp) {
@@ -1033,11 +1052,11 @@ function toActivityDefinition(action) {
1033
1052
  type: actionObject.type
1034
1053
  });
1035
1054
  }
1036
- /**
1037
- * Raises an event. This places the event in the internal event queue, so that
1038
- * the event is immediately consumed by the machine in the current step.
1039
- *
1040
- * @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.
1041
1060
  */
1042
1061
 
1043
1062
  function raise(event) {
@@ -1058,15 +1077,15 @@ function resolveRaise(action) {
1058
1077
  _event: toSCXMLEvent(action.event)
1059
1078
  };
1060
1079
  }
1061
- /**
1062
- * Sends an event. This returns an action that will be read by an interpreter to
1063
- * send the event in the next step, after the current step is finished executing.
1064
- *
1065
- * @param event The event to send.
1066
- * @param options Options to pass into the send event:
1067
- * - `id` - The unique send event identifier (used with `cancel()`).
1068
- * - `delay` - The number of milliseconds to delay the sending of the event.
1069
- * - `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).
1070
1089
  */
1071
1090
 
1072
1091
  function send(event, options) {
@@ -1108,12 +1127,12 @@ var resolveLog = function (action, ctx, _event) {
1108
1127
  })
1109
1128
  });
1110
1129
  };
1111
- /**
1112
- * Cancels an in-flight `send(...)` action. A canceled sent action will not
1113
- * be executed, nor will its event be sent, unless it has already been sent
1114
- * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`).
1115
- *
1116
- * @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.
1117
1136
  */
1118
1137
 
1119
1138
  var cancel = function (sendId) {
@@ -1122,10 +1141,10 @@ var cancel = function (sendId) {
1122
1141
  sendId: sendId
1123
1142
  };
1124
1143
  };
1125
- /**
1126
- * Starts an activity.
1127
- *
1128
- * @param activity The activity to start.
1144
+ /**
1145
+ * Starts an activity.
1146
+ *
1147
+ * @param activity The activity to start.
1129
1148
  */
1130
1149
 
1131
1150
  function start(activity) {
@@ -1136,10 +1155,10 @@ function start(activity) {
1136
1155
  exec: undefined
1137
1156
  };
1138
1157
  }
1139
- /**
1140
- * Stops an activity.
1141
- *
1142
- * @param actorRef The activity to stop.
1158
+ /**
1159
+ * Stops an activity.
1160
+ *
1161
+ * @param actorRef The activity to stop.
1143
1162
  */
1144
1163
 
1145
1164
  function stop(actorRef) {
@@ -1161,10 +1180,10 @@ function resolveStop(action, context, _event) {
1161
1180
  };
1162
1181
  return actionObject;
1163
1182
  }
1164
- /**
1165
- * Updates the current context of the machine.
1166
- *
1167
- * @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.
1168
1187
  */
1169
1188
 
1170
1189
  var assign = function (assignment) {
@@ -1173,24 +1192,24 @@ var assign = function (assignment) {
1173
1192
  assignment: assignment
1174
1193
  };
1175
1194
  };
1176
- /**
1177
- * Returns an event type that represents an implicit event that
1178
- * is sent after the specified `delay`.
1179
- *
1180
- * @param delayRef The delay in milliseconds
1181
- * @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
1182
1201
  */
1183
1202
 
1184
1203
  function after(delayRef, id) {
1185
1204
  var idSuffix = id ? "#" + id : '';
1186
1205
  return ActionTypes.After + "(" + delayRef + ")" + idSuffix;
1187
1206
  }
1188
- /**
1189
- * Returns an event that represents that a final state node
1190
- * has been reached in the parent state node.
1191
- *
1192
- * @param id The final state node's parent state node `id`
1193
- * @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
1194
1213
  */
1195
1214
 
1196
1215
  function done(id, data) {
@@ -1206,14 +1225,14 @@ function done(id, data) {
1206
1225
 
1207
1226
  return eventObject;
1208
1227
  }
1209
- /**
1210
- * Returns an event that represents that an invoked service has terminated.
1211
- *
1212
- * An invoked service is terminated when it has reached a top-level final state node,
1213
- * but not when it is canceled.
1214
- *
1215
- * @param id The final state node ID
1216
- * @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
1217
1236
  */
1218
1237
 
1219
1238
  function doneInvoke(id, data) {
@@ -1624,17 +1643,17 @@ var State =
1624
1643
 
1625
1644
  /** @class */
1626
1645
  function () {
1627
- /**
1628
- * Creates a new State instance.
1629
- * @param value The state value
1630
- * @param context The extended state
1631
- * @param historyValue The tree representing historical values of the state nodes
1632
- * @param history The previous state
1633
- * @param actions An array of action objects to execute as side-effects
1634
- * @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).
1635
- * @param meta
1636
- * @param events Internal event queue. Should be empty with run-to-completion semantics.
1637
- * @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
1638
1657
  */
1639
1658
  function State(config) {
1640
1659
  var _this = this;
@@ -1670,10 +1689,10 @@ function () {
1670
1689
  }
1671
1690
  });
1672
1691
  }
1673
- /**
1674
- * Creates a new State instance for the given `stateValue` and `context`.
1675
- * @param stateValue
1676
- * @param context
1692
+ /**
1693
+ * Creates a new State instance for the given `stateValue` and `context`.
1694
+ * @param stateValue
1695
+ * @param context
1677
1696
  */
1678
1697
 
1679
1698
 
@@ -1717,19 +1736,19 @@ function () {
1717
1736
  children: {}
1718
1737
  });
1719
1738
  };
1720
- /**
1721
- * Creates a new State instance for the given `config`.
1722
- * @param config The state config
1739
+ /**
1740
+ * Creates a new State instance for the given `config`.
1741
+ * @param config The state config
1723
1742
  */
1724
1743
 
1725
1744
 
1726
1745
  State.create = function (config) {
1727
1746
  return new State(config);
1728
1747
  };
1729
- /**
1730
- * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).
1731
- * @param stateValue
1732
- * @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
1733
1752
  */
1734
1753
 
1735
1754
 
@@ -1756,10 +1775,10 @@ function () {
1756
1775
 
1757
1776
  return State.from(stateValue, context);
1758
1777
  };
1759
- /**
1760
- * Returns an array of all the string leaf state node paths.
1761
- * @param stateValue
1762
- * @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.
1763
1782
  */
1764
1783
 
1765
1784
 
@@ -1798,28 +1817,28 @@ function () {
1798
1817
  tags: Array.from(tags)
1799
1818
  });
1800
1819
  };
1801
- /**
1802
- * Whether the current state value is a subset of the given parent state value.
1803
- * @param parentStateValue
1820
+ /**
1821
+ * Whether the current state value is a subset of the given parent state value.
1822
+ * @param parentStateValue
1804
1823
  */
1805
1824
 
1806
1825
 
1807
1826
  State.prototype.matches = function (parentStateValue) {
1808
1827
  return matchesState(parentStateValue, this.value);
1809
1828
  };
1810
- /**
1811
- * Whether the current state configuration has a state node with the specified `tag`.
1812
- * @param tag
1829
+ /**
1830
+ * Whether the current state configuration has a state node with the specified `tag`.
1831
+ * @param tag
1813
1832
  */
1814
1833
 
1815
1834
 
1816
1835
  State.prototype.hasTag = function (tag) {
1817
1836
  return this.tags.has(tag);
1818
1837
  };
1819
- /**
1820
- * Determines whether sending the `event` will cause a transition.
1821
- * @param event The event to test
1822
- * @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
1823
1842
  */
1824
1843
 
1825
1844
 
@@ -1836,9 +1855,9 @@ function () {
1836
1855
  return State;
1837
1856
  }();
1838
1857
 
1839
- /**
1840
- * Maintains a stack of the current service in scope.
1841
- * 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().
1842
1861
  */
1843
1862
  var provide = function (service, fn) {
1844
1863
  var result = fn(service);
@@ -1868,11 +1887,11 @@ function createNullActor(id) {
1868
1887
  }
1869
1888
  };
1870
1889
  }
1871
- /**
1872
- * Creates a deferred actor that is able to be invoked given the provided
1873
- * invocation information in its `.meta` value.
1874
- *
1875
- * @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.
1876
1895
  */
1877
1896
 
1878
1897
  function createInvocableActor(invokeDefinition, machine, context, _event) {
@@ -1963,12 +1982,12 @@ var StateNode =
1963
1982
  /** @class */
1964
1983
  function () {
1965
1984
  function StateNode(
1966
- /**
1967
- * The raw config used to create the machine.
1985
+ /**
1986
+ * The raw config used to create the machine.
1968
1987
  */
1969
1988
  config, options,
1970
- /**
1971
- * The initial extended state
1989
+ /**
1990
+ * The initial extended state
1972
1991
  */
1973
1992
  _context // TODO: this is unsafe, but we're removing it in v5 anyway
1974
1993
  ) {
@@ -1982,8 +2001,8 @@ function () {
1982
2001
 
1983
2002
  this.config = config;
1984
2003
  this._context = _context;
1985
- /**
1986
- * 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.
1987
2006
  */
1988
2007
 
1989
2008
  this.order = -1;
@@ -2118,11 +2137,11 @@ function () {
2118
2137
  return stateNode.on;
2119
2138
  });
2120
2139
  };
2121
- /**
2122
- * Clones this state machine with custom options and context.
2123
- *
2124
- * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.
2125
- * @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)
2126
2145
  */
2127
2146
 
2128
2147
 
@@ -2141,10 +2160,10 @@ function () {
2141
2160
  delays: __assign$1(__assign$1({}, delays), options.delays)
2142
2161
  }, context !== null && context !== void 0 ? context : this.context);
2143
2162
  };
2144
- /**
2145
- * Clones this state machine with custom context.
2146
- *
2147
- * @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)
2148
2167
  */
2149
2168
 
2150
2169
 
@@ -2160,8 +2179,8 @@ function () {
2160
2179
  configurable: true
2161
2180
  });
2162
2181
  Object.defineProperty(StateNode.prototype, "definition", {
2163
- /**
2164
- * The well-structured state node definition.
2182
+ /**
2183
+ * The well-structured state node definition.
2165
2184
  */
2166
2185
  get: function () {
2167
2186
  return {
@@ -2195,8 +2214,8 @@ function () {
2195
2214
  };
2196
2215
 
2197
2216
  Object.defineProperty(StateNode.prototype, "on", {
2198
- /**
2199
- * The mapping of events to transitions.
2217
+ /**
2218
+ * The mapping of events to transitions.
2200
2219
  */
2201
2220
  get: function () {
2202
2221
  if (this.__cache.on) {
@@ -2221,8 +2240,8 @@ function () {
2221
2240
  configurable: true
2222
2241
  });
2223
2242
  Object.defineProperty(StateNode.prototype, "transitions", {
2224
- /**
2225
- * All the transitions that can be taken from this state node.
2243
+ /**
2244
+ * All the transitions that can be taken from this state node.
2226
2245
  */
2227
2246
  get: function () {
2228
2247
  return this.__cache.transitions || (this.__cache.transitions = this.formatTransitions(), this.__cache.transitions);
@@ -2245,8 +2264,8 @@ function () {
2245
2264
  this.__cache.candidates[eventName] = candidates;
2246
2265
  return candidates;
2247
2266
  };
2248
- /**
2249
- * All delayed transitions from the config.
2267
+ /**
2268
+ * All delayed transitions from the config.
2250
2269
  */
2251
2270
 
2252
2271
 
@@ -2298,10 +2317,10 @@ function () {
2298
2317
  });
2299
2318
  });
2300
2319
  };
2301
- /**
2302
- * Returns the state nodes represented by the current state value.
2303
- *
2304
- * @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
2305
2324
  */
2306
2325
 
2307
2326
 
@@ -2332,10 +2351,10 @@ function () {
2332
2351
  return allSubStateNodes.concat(subStateNode);
2333
2352
  }, []));
2334
2353
  };
2335
- /**
2336
- * Returns `true` if this state node explicitly handles the given event.
2337
- *
2338
- * @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
2339
2358
  */
2340
2359
 
2341
2360
 
@@ -2343,12 +2362,12 @@ function () {
2343
2362
  var eventType = getEventType(event);
2344
2363
  return this.events.includes(eventType);
2345
2364
  };
2346
- /**
2347
- * Resolves the given `state` to a new `State` instance relative to this machine.
2348
- *
2349
- * This ensures that `.events` and `.nextEvents` represent the correct values.
2350
- *
2351
- * @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
2352
2371
  */
2353
2372
 
2354
2373
 
@@ -2566,9 +2585,9 @@ function () {
2566
2585
 
2567
2586
  return nodes;
2568
2587
  };
2569
- /**
2570
- * Whether the given state node "escapes" this state node. If the `stateNode` is equal to or the parent of
2571
- * 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.
2572
2591
  */
2573
2592
 
2574
2593
 
@@ -2693,12 +2712,12 @@ function () {
2693
2712
  var actions = toActionObjects(exitActions.concat(transition.actions).concat(entryActions), this.machine.options.actions);
2694
2713
  return actions;
2695
2714
  };
2696
- /**
2697
- * Determines the next state given the current `state` and sent `event`.
2698
- *
2699
- * @param state The current State instance or state value
2700
- * @param event The event that was sent at the current state
2701
- * @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
2702
2721
  */
2703
2722
 
2704
2723
 
@@ -2891,8 +2910,8 @@ function () {
2891
2910
  })));
2892
2911
  return maybeNextState;
2893
2912
  };
2894
- /**
2895
- * Returns the child state node from its relative `stateKey`, or throws.
2913
+ /**
2914
+ * Returns the child state node from its relative `stateKey`, or throws.
2896
2915
  */
2897
2916
 
2898
2917
 
@@ -2913,10 +2932,10 @@ function () {
2913
2932
 
2914
2933
  return result;
2915
2934
  };
2916
- /**
2917
- * Returns the state node with the given `stateId`, or throws.
2918
- *
2919
- * @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.
2920
2939
  */
2921
2940
 
2922
2941
 
@@ -2935,10 +2954,10 @@ function () {
2935
2954
 
2936
2955
  return stateNode;
2937
2956
  };
2938
- /**
2939
- * Returns the relative state node from the given `statePath`, or throws.
2940
- *
2941
- * @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.
2942
2961
  */
2943
2962
 
2944
2963
 
@@ -2966,10 +2985,10 @@ function () {
2966
2985
 
2967
2986
  return currentStateNode;
2968
2987
  };
2969
- /**
2970
- * Resolves a partial state value with its full representation in this machine.
2971
- *
2972
- * @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.
2973
2992
  */
2974
2993
 
2975
2994
 
@@ -3073,9 +3092,9 @@ function () {
3073
3092
  };
3074
3093
 
3075
3094
  Object.defineProperty(StateNode.prototype, "initialState", {
3076
- /**
3077
- * The initial State instance, which includes all actions to be executed from
3078
- * entering the initial state.
3095
+ /**
3096
+ * The initial State instance, which includes all actions to be executed from
3097
+ * entering the initial state.
3079
3098
  */
3080
3099
  get: function () {
3081
3100
  this._init(); // TODO: this should be in the constructor (see note in constructor)
@@ -3093,9 +3112,9 @@ function () {
3093
3112
  configurable: true
3094
3113
  });
3095
3114
  Object.defineProperty(StateNode.prototype, "target", {
3096
- /**
3097
- * The target state value of the history state node, if it exists. This represents the
3098
- * 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.
3099
3118
  */
3100
3119
  get: function () {
3101
3120
  var target;
@@ -3115,12 +3134,12 @@ function () {
3115
3134
  enumerable: false,
3116
3135
  configurable: true
3117
3136
  });
3118
- /**
3119
- * Returns the leaf nodes from a state path relative to this state node.
3120
- *
3121
- * @param relativeStateId The relative state path to retrieve the state nodes
3122
- * @param history The previous state to retrieve history
3123
- * @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
3124
3143
  */
3125
3144
 
3126
3145
  StateNode.prototype.getRelativeStateNodes = function (relativeStateId, historyValue, resolve) {
@@ -3153,11 +3172,11 @@ function () {
3153
3172
  enumerable: false,
3154
3173
  configurable: true
3155
3174
  });
3156
- /**
3157
- * Retrieves state nodes from a relative path to this state node.
3158
- *
3159
- * @param relativePath The relative path from this state node
3160
- * @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
3161
3180
  */
3162
3181
 
3163
3182
  StateNode.prototype.getFromRelativePath = function (relativePath) {
@@ -3205,11 +3224,11 @@ function () {
3205
3224
  })
3206
3225
  };
3207
3226
  };
3208
- /**
3209
- * Resolves to the historical value(s) of the parent state node,
3210
- * represented by state nodes.
3211
- *
3212
- * @param historyValue
3227
+ /**
3228
+ * Resolves to the historical value(s) of the parent state node,
3229
+ * represented by state nodes.
3230
+ *
3231
+ * @param historyValue
3213
3232
  */
3214
3233
 
3215
3234
 
@@ -3241,8 +3260,8 @@ function () {
3241
3260
  };
3242
3261
 
3243
3262
  Object.defineProperty(StateNode.prototype, "stateIds", {
3244
- /**
3245
- * 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.
3246
3265
  */
3247
3266
  get: function () {
3248
3267
  var _this = this;
@@ -3256,8 +3275,8 @@ function () {
3256
3275
  configurable: true
3257
3276
  });
3258
3277
  Object.defineProperty(StateNode.prototype, "events", {
3259
- /**
3260
- * 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.
3261
3280
  */
3262
3281
  get: function () {
3263
3282
  var e_7, _a, e_8, _b;
@@ -3313,10 +3332,10 @@ function () {
3313
3332
  configurable: true
3314
3333
  });
3315
3334
  Object.defineProperty(StateNode.prototype, "ownEvents", {
3316
- /**
3317
- * All the events that have transitions directly from this state node.
3318
- *
3319
- * Excludes any inert events.
3335
+ /**
3336
+ * All the events that have transitions directly from this state node.
3337
+ *
3338
+ * Excludes any inert events.
3320
3339
  */
3321
3340
  get: function () {
3322
3341
  var events = new Set(this.transitions.filter(function (transition) {
@@ -7614,89 +7633,89 @@ var storage = {
7614
7633
  }
7615
7634
  };
7616
7635
 
7617
- /*! *****************************************************************************
7618
- Copyright (c) Microsoft Corporation.
7619
-
7620
- Permission to use, copy, modify, and/or distribute this software for any
7621
- purpose with or without fee is hereby granted.
7622
-
7623
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7624
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
7625
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
7626
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
7627
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
7628
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
7629
- PERFORMANCE OF THIS SOFTWARE.
7630
- ***************************************************************************** */
7631
-
7632
- var __assign = function() {
7633
- __assign = Object.assign || function __assign(t) {
7634
- for (var s, i = 1, n = arguments.length; i < n; i++) {
7635
- s = arguments[i];
7636
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
7637
- }
7638
- return t;
7639
- };
7640
- return __assign.apply(this, arguments);
7641
- };
7642
-
7643
- function __rest(s, e) {
7644
- var t = {};
7645
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
7646
- t[p] = s[p];
7647
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7648
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7649
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
7650
- t[p[i]] = s[p[i]];
7651
- }
7652
- return t;
7653
- }
7654
-
7655
- function __awaiter(thisArg, _arguments, P, generator) {
7656
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7657
- return new (P || (P = Promise))(function (resolve, reject) {
7658
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7659
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7660
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7661
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7662
- });
7663
- }
7664
-
7665
- function __generator(thisArg, body) {
7666
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
7667
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
7668
- function verb(n) { return function (v) { return step([n, v]); }; }
7669
- function step(op) {
7670
- if (f) throw new TypeError("Generator is already executing.");
7671
- while (_) try {
7672
- 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;
7673
- if (y = 0, t) op = [op[0] & 2, t.value];
7674
- switch (op[0]) {
7675
- case 0: case 1: t = op; break;
7676
- case 4: _.label++; return { value: op[1], done: false };
7677
- case 5: _.label++; y = op[1]; op = [0]; continue;
7678
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
7679
- default:
7680
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
7681
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
7682
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
7683
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
7684
- if (t[2]) _.ops.pop();
7685
- _.trys.pop(); continue;
7686
- }
7687
- op = body.call(thisArg, _);
7688
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
7689
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7690
- }
7691
- }
7692
-
7693
- /** @deprecated */
7694
- function __spreadArrays() {
7695
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
7696
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
7697
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
7698
- r[k] = a[j];
7699
- 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;
7700
7719
  }
7701
7720
 
7702
7721
  /**
@@ -10161,6 +10180,19 @@ function auth (request) {
10161
10180
  },
10162
10181
  },
10163
10182
  },
10183
+ authenticationApp: {
10184
+ invoke: {
10185
+ src: 'authenticateApp',
10186
+ onDone: {
10187
+ target: 'authenticated',
10188
+ actions: ['setToken'],
10189
+ },
10190
+ onError: {
10191
+ target: 'idle',
10192
+ actions: 'removeToken',
10193
+ },
10194
+ },
10195
+ },
10164
10196
  authenticated: {
10165
10197
  invoke: {
10166
10198
  src: 'fetchUserInfo',
@@ -10273,6 +10305,9 @@ function auth (request) {
10273
10305
  LOGIN_3PARTY: {
10274
10306
  actions: 'redirectTo3Party',
10275
10307
  },
10308
+ LOGIN_APP: {
10309
+ target: '.authenticationApp'
10310
+ },
10276
10311
  SET_PLAY: {
10277
10312
  actions: 'setPlay',
10278
10313
  },
@@ -10431,6 +10466,10 @@ function auth (request) {
10431
10466
  }),
10432
10467
  },
10433
10468
  services: {
10469
+ authenticateApp: async (context, event) => {
10470
+ const { token } = await request.send(auth$1.loginApp(event.data));
10471
+ return token
10472
+ },
10434
10473
  authenticate: async (context, event) => {
10435
10474
  const data = { ...context.loginData, reCaptchaToken: context.reCaptchaToken };
10436
10475
  const { token } = await request.send(auth$1.login(data));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.182",
3
+ "version": "1.0.184-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/auth.js CHANGED
@@ -11,17 +11,21 @@ export default {
11
11
  isPublic: true,
12
12
  headers: { 'x-access-captcha': reCaptchaToken },
13
13
  }),
14
- loginApp: ({ id, provider, displayName, pictureUrl, accessToken }) => ({
14
+ loginApp: ({ provider, accessToken, channel, subchannel, dt, from, id, name, picture }) => ({
15
15
  url: 'appLogin',
16
16
  method: 'post',
17
17
  params: {
18
18
  provider,
19
19
  data: {
20
+ accessToken,
21
+ channel,
22
+ subchannel,
23
+ dt,
24
+ from,
20
25
  id,
26
+ name,
27
+ picture,
21
28
  provider,
22
- displayName,
23
- pictureUrl,
24
- accessToken,
25
29
  },
26
30
  },
27
31
  isPublic: true,
@@ -193,7 +193,7 @@ export default function (request) {
193
193
  actions: 'redirectTo3Party',
194
194
  },
195
195
  LOGIN_APP: {
196
- actions: '.authenticationApp'
196
+ target: '.authenticationApp'
197
197
  },
198
198
  SET_PLAY: {
199
199
  actions: 'setPlay',
@@ -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,7 +42,7 @@ export default function (request) {
50
42
  actions: 'setCard',
51
43
  },
52
44
  SELECT_AMOUNT: {
53
- target: 'calculable',
45
+ target: 'calculating',
54
46
  actions: 'setAmount',
55
47
  },
56
48
  },
@@ -85,7 +77,7 @@ export default function (request) {
85
77
  calculated: {
86
78
  on: {
87
79
  SELECT_AMOUNT: {
88
- target: 'calculable',
80
+ target: 'calculating',
89
81
  actions: 'setAmount',
90
82
  },
91
83
  CONFIRM: {
@@ -95,7 +87,7 @@ export default function (request) {
95
87
  target: 'loaded',
96
88
  },
97
89
  CLEAR_CALCULATION: {
98
- target: 'calculable',
90
+ target: 'calculating',
99
91
  actions: 'clearCalculation',
100
92
  },
101
93
  },
@@ -150,18 +142,20 @@ export default function (request) {
150
142
  }),
151
143
  setInitData: assign((context, event) => {
152
144
  const paymentDetails = event.data
153
- const currentPayment = paymentDetails.find((element) => element.category === context.currentCategory)
145
+ const cards = paymentDetails.filter((element) => element.category === context.currentCategory)
154
146
  return {
155
147
  paymentDetails,
156
- currentPayment,
157
- currentMethod: currentPayment.method,
158
- options: currentPayment.optional,
159
- selectedCard: context.cards[0],
148
+ cards,
149
+ selectedCard: cards[0],
150
+ currentMethod: cards[0].method,
151
+ options: cards[0].optional
160
152
  }
161
153
  }),
162
154
  setCard: assign((context, event) => {
163
155
  return {
164
156
  selectedCard: event.data,
157
+ currentMethod: event.data.method,
158
+ options: event.data.optional,
165
159
  }
166
160
  }),
167
161
  setCardNumber: assign((context, event) => {
@@ -198,11 +192,6 @@ export default function (request) {
198
192
  fetchInitData: async (context, event) => {
199
193
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
200
194
  },
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
195
  fetchCalculation: async (context, event) => {
207
196
  const { currentMethod, selectedAmount } = context
208
197
  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(