@jetthai/cuora 1.0.174 → 1.0.175

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/dist/bundle.mjs CHANGED
@@ -1,9 +1,12 @@
1
+ import payment$1 from '@jetthai/cuora/src/api/payment.js';
2
+
1
3
  var activity$2 = {
2
4
  getActivityTypes: ({ appSecret }) => ({ url: 'activities/types', method: 'get', params: { appSecret } }),
3
5
  getActivityList: ({ appSecret, include = 'cl' }) => ({
4
6
  url: 'activities/list',
5
7
  method: 'get',
6
8
  params: { appSecret, include },
9
+ isPublic: true
7
10
  }),
8
11
  getActivityDetail: ({ activityNo, appSecret }) => ({
9
12
  url: 'activities',
@@ -88,11 +91,11 @@ var common$1 = {
88
91
  getAnnouncements: () => ({ url: 'getAnnouncements', method: 'get', isPublic: true }),
89
92
  };
90
93
 
91
- var api = {
94
+ var game$1 = {
92
95
  getGameSHA: () => ({ method: 'get', url: 'game/list/v2/sha' }),
93
96
  getOptionMap: (code) => ({ method: 'get', url: 'game/list/v2/options', params: { code } }),
94
97
  getGameStatus: () => ({ method: 'get', url: 'game/list/v2/status' }),
95
- getGameCategory: ({ id, first }) => ({ method: 'get', url: 'game/list/v2/category', params: { id, first } }),
98
+ getGameCategory: ({ id, first } = {}) => ({ method: 'get', url: 'game/list/v2/category', params: { id, first } }),
96
99
  addFavoriteGame: (code) => ({ method: 'post', url: 'game/myfavorite/add', params: { games: [code] } }),
97
100
  removeFavoriteGame: (code) => ({ method: 'post', url: 'game/myfavorite/remove', params: { games: [code] } }),
98
101
  getStatements: () => ({ url: 'game/statements', method: 'get' }),
@@ -133,6 +136,38 @@ var api = {
133
136
  url: 'game/history/options',
134
137
  method: 'get',
135
138
  }),
139
+ getListRoot: ({ timestamp } = {}) => ({
140
+ url: 'game/list/v3/root',
141
+ method: 'get',
142
+ params: { timestamp },
143
+ }),
144
+ getListCategory: ({ categoryId, timestamp, index }) => ({
145
+ url: 'game/list/v3/category',
146
+ method: 'get',
147
+ params: { categoryId, timestamp, index },
148
+ }),
149
+ getListAddition: ({ categoryId, timestamp, index }) => ({
150
+ url: 'game/list/v3/addition',
151
+ method: 'get',
152
+ params: { categoryId, timestamp, index },
153
+ }),
154
+ getListCategoryByRange: ({ categoryId, timestamp, end }) => ({
155
+ url: 'game/list/v3/categoryByRange',
156
+ method: 'get',
157
+ params: { categoryId, timestamp, end },
158
+ }),
159
+ getListAdditionByRange: ({ categoryId, timestamp, end }) => ({
160
+ url: 'game/list/v3/additionByRange',
161
+ method: 'get',
162
+ params: { categoryId, timestamp, end },
163
+ }),
164
+ getListMyFavorite: ({ timestamp } = {}) => ({
165
+ url: 'game/list/v3/myFavorite',
166
+ method: 'get',
167
+ params: { timestamp },
168
+ }),
169
+ addListFavorite: (code) => ({ method: 'post', url: 'game/list/v3/addMyFavorite', params: { games: [code] } }),
170
+ removeListFavorite: (code) => ({ method: 'post', url: 'game/list/v3/removeMyFavorite', params: { games: [code] } }),
136
171
  };
137
172
 
138
173
  var mailbox = {
@@ -308,79 +343,79 @@ var form = {
308
343
  upload: (formData) => ({ url: 'upload', method: 'post', params: formData, isFormData: true }),
309
344
  };
310
345
 
311
- var index$2 = { activity: activity$2, auth: auth$1, common: common$1, game: api, mailbox, payment, user, form };
312
-
313
- /*! *****************************************************************************
314
- Copyright (c) Microsoft Corporation.
315
-
316
- Permission to use, copy, modify, and/or distribute this software for any
317
- purpose with or without fee is hereby granted.
318
-
319
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
320
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
321
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
322
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
323
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
324
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
325
- PERFORMANCE OF THIS SOFTWARE.
326
- ***************************************************************************** */
327
-
328
- var __assign$2 = function() {
329
- __assign$2 = Object.assign || function __assign(t) {
330
- for (var s, i = 1, n = arguments.length; i < n; i++) {
331
- s = arguments[i];
332
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
333
- }
334
- return t;
335
- };
336
- return __assign$2.apply(this, arguments);
337
- };
338
-
339
- function __rest$1(s, e) {
340
- var t = {};
341
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
342
- t[p] = s[p];
343
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
344
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
345
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
346
- t[p[i]] = s[p[i]];
347
- }
348
- return t;
349
- }
350
-
351
- function __values(o) {
352
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
353
- if (m) return m.call(o);
354
- if (o && typeof o.length === "number") return {
355
- next: function () {
356
- if (o && i >= o.length) o = void 0;
357
- return { value: o && o[i++], done: !o };
358
- }
359
- };
360
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
361
- }
362
-
363
- function __read(o, n) {
364
- var m = typeof Symbol === "function" && o[Symbol.iterator];
365
- if (!m) return o;
366
- var i = m.call(o), r, ar = [], e;
367
- try {
368
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
369
- }
370
- catch (error) { e = { error: error }; }
371
- finally {
372
- try {
373
- if (r && !r.done && (m = i["return"])) m.call(i);
374
- }
375
- finally { if (e) throw e.error; }
376
- }
377
- return ar;
378
- }
379
-
380
- function __spreadArray(to, from) {
381
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
382
- to[j] = from[i];
383
- return to;
346
+ var index$2 = { activity: activity$2, auth: auth$1, common: common$1, game: game$1, mailbox, payment, user, form };
347
+
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$2 = function() {
364
+ __assign$2 = 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$2.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;
384
419
  }
385
420
 
386
421
  var STATE_DELIMITER = '.';
@@ -517,9 +552,9 @@ function mapFilterValues(collection, iteratee, predicate) {
517
552
 
518
553
  return result;
519
554
  }
520
- /**
521
- * Retrieves a value at the given path.
522
- * @param props The deep path to the prop of the desired value
555
+ /**
556
+ * Retrieves a value at the given path.
557
+ * @param props The deep path to the prop of the desired value
523
558
  */
524
559
 
525
560
  var path = function (props) {
@@ -548,9 +583,9 @@ var path = function (props) {
548
583
  return result;
549
584
  };
550
585
  };
551
- /**
552
- * Retrieves a value at the given path via the nested accessor prop.
553
- * @param props The deep path to the prop of the desired value
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
554
589
  */
555
590
 
556
591
  function nestedPath(props, accessorProp) {
@@ -998,11 +1033,11 @@ function toActivityDefinition(action) {
998
1033
  type: actionObject.type
999
1034
  });
1000
1035
  }
1001
- /**
1002
- * Raises an event. This places the event in the internal event queue, so that
1003
- * the event is immediately consumed by the machine in the current step.
1004
- *
1005
- * @param eventType The event to raise.
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.
1006
1041
  */
1007
1042
 
1008
1043
  function raise(event) {
@@ -1023,15 +1058,15 @@ function resolveRaise(action) {
1023
1058
  _event: toSCXMLEvent(action.event)
1024
1059
  };
1025
1060
  }
1026
- /**
1027
- * Sends an event. This returns an action that will be read by an interpreter to
1028
- * send the event in the next step, after the current step is finished executing.
1029
- *
1030
- * @param event The event to send.
1031
- * @param options Options to pass into the send event:
1032
- * - `id` - The unique send event identifier (used with `cancel()`).
1033
- * - `delay` - The number of milliseconds to delay the sending of the event.
1034
- * - `to` - The target of this event (by default, the machine the event was sent from).
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).
1035
1070
  */
1036
1071
 
1037
1072
  function send(event, options) {
@@ -1073,12 +1108,12 @@ var resolveLog = function (action, ctx, _event) {
1073
1108
  })
1074
1109
  });
1075
1110
  };
1076
- /**
1077
- * Cancels an in-flight `send(...)` action. A canceled sent action will not
1078
- * be executed, nor will its event be sent, unless it has already been sent
1079
- * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`).
1080
- *
1081
- * @param sendId The `id` of the `send(...)` action to cancel.
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.
1082
1117
  */
1083
1118
 
1084
1119
  var cancel = function (sendId) {
@@ -1087,10 +1122,10 @@ var cancel = function (sendId) {
1087
1122
  sendId: sendId
1088
1123
  };
1089
1124
  };
1090
- /**
1091
- * Starts an activity.
1092
- *
1093
- * @param activity The activity to start.
1125
+ /**
1126
+ * Starts an activity.
1127
+ *
1128
+ * @param activity The activity to start.
1094
1129
  */
1095
1130
 
1096
1131
  function start(activity) {
@@ -1101,10 +1136,10 @@ function start(activity) {
1101
1136
  exec: undefined
1102
1137
  };
1103
1138
  }
1104
- /**
1105
- * Stops an activity.
1106
- *
1107
- * @param actorRef The activity to stop.
1139
+ /**
1140
+ * Stops an activity.
1141
+ *
1142
+ * @param actorRef The activity to stop.
1108
1143
  */
1109
1144
 
1110
1145
  function stop(actorRef) {
@@ -1126,10 +1161,10 @@ function resolveStop(action, context, _event) {
1126
1161
  };
1127
1162
  return actionObject;
1128
1163
  }
1129
- /**
1130
- * Updates the current context of the machine.
1131
- *
1132
- * @param assignment An object that represents the partial context to update.
1164
+ /**
1165
+ * Updates the current context of the machine.
1166
+ *
1167
+ * @param assignment An object that represents the partial context to update.
1133
1168
  */
1134
1169
 
1135
1170
  var assign = function (assignment) {
@@ -1138,24 +1173,24 @@ var assign = function (assignment) {
1138
1173
  assignment: assignment
1139
1174
  };
1140
1175
  };
1141
- /**
1142
- * Returns an event type that represents an implicit event that
1143
- * is sent after the specified `delay`.
1144
- *
1145
- * @param delayRef The delay in milliseconds
1146
- * @param id The state node ID where this event is handled
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
1147
1182
  */
1148
1183
 
1149
1184
  function after(delayRef, id) {
1150
1185
  var idSuffix = id ? "#" + id : '';
1151
1186
  return ActionTypes.After + "(" + delayRef + ")" + idSuffix;
1152
1187
  }
1153
- /**
1154
- * Returns an event that represents that a final state node
1155
- * has been reached in the parent state node.
1156
- *
1157
- * @param id The final state node's parent state node `id`
1158
- * @param data The data to pass into the event
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
1159
1194
  */
1160
1195
 
1161
1196
  function done(id, data) {
@@ -1171,14 +1206,14 @@ function done(id, data) {
1171
1206
 
1172
1207
  return eventObject;
1173
1208
  }
1174
- /**
1175
- * Returns an event that represents that an invoked service has terminated.
1176
- *
1177
- * An invoked service is terminated when it has reached a top-level final state node,
1178
- * but not when it is canceled.
1179
- *
1180
- * @param id The final state node ID
1181
- * @param data The data to pass into the event
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
1182
1217
  */
1183
1218
 
1184
1219
  function doneInvoke(id, data) {
@@ -1589,17 +1624,17 @@ var State =
1589
1624
 
1590
1625
  /** @class */
1591
1626
  function () {
1592
- /**
1593
- * Creates a new State instance.
1594
- * @param value The state value
1595
- * @param context The extended state
1596
- * @param historyValue The tree representing historical values of the state nodes
1597
- * @param history The previous state
1598
- * @param actions An array of action objects to execute as side-effects
1599
- * @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).
1600
- * @param meta
1601
- * @param events Internal event queue. Should be empty with run-to-completion semantics.
1602
- * @param configuration
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
1603
1638
  */
1604
1639
  function State(config) {
1605
1640
  var _this = this;
@@ -1635,10 +1670,10 @@ function () {
1635
1670
  }
1636
1671
  });
1637
1672
  }
1638
- /**
1639
- * Creates a new State instance for the given `stateValue` and `context`.
1640
- * @param stateValue
1641
- * @param context
1673
+ /**
1674
+ * Creates a new State instance for the given `stateValue` and `context`.
1675
+ * @param stateValue
1676
+ * @param context
1642
1677
  */
1643
1678
 
1644
1679
 
@@ -1682,19 +1717,19 @@ function () {
1682
1717
  children: {}
1683
1718
  });
1684
1719
  };
1685
- /**
1686
- * Creates a new State instance for the given `config`.
1687
- * @param config The state config
1720
+ /**
1721
+ * Creates a new State instance for the given `config`.
1722
+ * @param config The state config
1688
1723
  */
1689
1724
 
1690
1725
 
1691
1726
  State.create = function (config) {
1692
1727
  return new State(config);
1693
1728
  };
1694
- /**
1695
- * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).
1696
- * @param stateValue
1697
- * @param context
1729
+ /**
1730
+ * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).
1731
+ * @param stateValue
1732
+ * @param context
1698
1733
  */
1699
1734
 
1700
1735
 
@@ -1721,10 +1756,10 @@ function () {
1721
1756
 
1722
1757
  return State.from(stateValue, context);
1723
1758
  };
1724
- /**
1725
- * Returns an array of all the string leaf state node paths.
1726
- * @param stateValue
1727
- * @param delimiter The character(s) that separate each subpath in the string state node path.
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.
1728
1763
  */
1729
1764
 
1730
1765
 
@@ -1763,28 +1798,28 @@ function () {
1763
1798
  tags: Array.from(tags)
1764
1799
  });
1765
1800
  };
1766
- /**
1767
- * Whether the current state value is a subset of the given parent state value.
1768
- * @param parentStateValue
1801
+ /**
1802
+ * Whether the current state value is a subset of the given parent state value.
1803
+ * @param parentStateValue
1769
1804
  */
1770
1805
 
1771
1806
 
1772
1807
  State.prototype.matches = function (parentStateValue) {
1773
1808
  return matchesState(parentStateValue, this.value);
1774
1809
  };
1775
- /**
1776
- * Whether the current state configuration has a state node with the specified `tag`.
1777
- * @param tag
1810
+ /**
1811
+ * Whether the current state configuration has a state node with the specified `tag`.
1812
+ * @param tag
1778
1813
  */
1779
1814
 
1780
1815
 
1781
1816
  State.prototype.hasTag = function (tag) {
1782
1817
  return this.tags.has(tag);
1783
1818
  };
1784
- /**
1785
- * Determines whether sending the `event` will cause a transition.
1786
- * @param event The event to test
1787
- * @returns Whether the event will cause a transition
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
1788
1823
  */
1789
1824
 
1790
1825
 
@@ -1801,9 +1836,9 @@ function () {
1801
1836
  return State;
1802
1837
  }();
1803
1838
 
1804
- /**
1805
- * Maintains a stack of the current service in scope.
1806
- * This is used to provide the correct service to spawn().
1839
+ /**
1840
+ * Maintains a stack of the current service in scope.
1841
+ * This is used to provide the correct service to spawn().
1807
1842
  */
1808
1843
  var provide = function (service, fn) {
1809
1844
  var result = fn(service);
@@ -1833,11 +1868,11 @@ function createNullActor(id) {
1833
1868
  }
1834
1869
  };
1835
1870
  }
1836
- /**
1837
- * Creates a deferred actor that is able to be invoked given the provided
1838
- * invocation information in its `.meta` value.
1839
- *
1840
- * @param invokeDefinition The meta information needed to invoke the actor.
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.
1841
1876
  */
1842
1877
 
1843
1878
  function createInvocableActor(invokeDefinition, machine, context, _event) {
@@ -1928,12 +1963,12 @@ var StateNode =
1928
1963
  /** @class */
1929
1964
  function () {
1930
1965
  function StateNode(
1931
- /**
1932
- * The raw config used to create the machine.
1966
+ /**
1967
+ * The raw config used to create the machine.
1933
1968
  */
1934
1969
  config, options,
1935
- /**
1936
- * The initial extended state
1970
+ /**
1971
+ * The initial extended state
1937
1972
  */
1938
1973
  _context // TODO: this is unsafe, but we're removing it in v5 anyway
1939
1974
  ) {
@@ -1947,8 +1982,8 @@ function () {
1947
1982
 
1948
1983
  this.config = config;
1949
1984
  this._context = _context;
1950
- /**
1951
- * The order this state node appears. Corresponds to the implicit SCXML document order.
1985
+ /**
1986
+ * The order this state node appears. Corresponds to the implicit SCXML document order.
1952
1987
  */
1953
1988
 
1954
1989
  this.order = -1;
@@ -2083,11 +2118,11 @@ function () {
2083
2118
  return stateNode.on;
2084
2119
  });
2085
2120
  };
2086
- /**
2087
- * Clones this state machine with custom options and context.
2088
- *
2089
- * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.
2090
- * @param context Custom context (will override predefined context)
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)
2091
2126
  */
2092
2127
 
2093
2128
 
@@ -2106,10 +2141,10 @@ function () {
2106
2141
  delays: __assign$2(__assign$2({}, delays), options.delays)
2107
2142
  }, context !== null && context !== void 0 ? context : this.context);
2108
2143
  };
2109
- /**
2110
- * Clones this state machine with custom context.
2111
- *
2112
- * @param context Custom context (will override predefined context, not recursive)
2144
+ /**
2145
+ * Clones this state machine with custom context.
2146
+ *
2147
+ * @param context Custom context (will override predefined context, not recursive)
2113
2148
  */
2114
2149
 
2115
2150
 
@@ -2125,8 +2160,8 @@ function () {
2125
2160
  configurable: true
2126
2161
  });
2127
2162
  Object.defineProperty(StateNode.prototype, "definition", {
2128
- /**
2129
- * The well-structured state node definition.
2163
+ /**
2164
+ * The well-structured state node definition.
2130
2165
  */
2131
2166
  get: function () {
2132
2167
  return {
@@ -2160,8 +2195,8 @@ function () {
2160
2195
  };
2161
2196
 
2162
2197
  Object.defineProperty(StateNode.prototype, "on", {
2163
- /**
2164
- * The mapping of events to transitions.
2198
+ /**
2199
+ * The mapping of events to transitions.
2165
2200
  */
2166
2201
  get: function () {
2167
2202
  if (this.__cache.on) {
@@ -2186,8 +2221,8 @@ function () {
2186
2221
  configurable: true
2187
2222
  });
2188
2223
  Object.defineProperty(StateNode.prototype, "transitions", {
2189
- /**
2190
- * All the transitions that can be taken from this state node.
2224
+ /**
2225
+ * All the transitions that can be taken from this state node.
2191
2226
  */
2192
2227
  get: function () {
2193
2228
  return this.__cache.transitions || (this.__cache.transitions = this.formatTransitions(), this.__cache.transitions);
@@ -2210,8 +2245,8 @@ function () {
2210
2245
  this.__cache.candidates[eventName] = candidates;
2211
2246
  return candidates;
2212
2247
  };
2213
- /**
2214
- * All delayed transitions from the config.
2248
+ /**
2249
+ * All delayed transitions from the config.
2215
2250
  */
2216
2251
 
2217
2252
 
@@ -2263,10 +2298,10 @@ function () {
2263
2298
  });
2264
2299
  });
2265
2300
  };
2266
- /**
2267
- * Returns the state nodes represented by the current state value.
2268
- *
2269
- * @param state The state value or State instance
2301
+ /**
2302
+ * Returns the state nodes represented by the current state value.
2303
+ *
2304
+ * @param state The state value or State instance
2270
2305
  */
2271
2306
 
2272
2307
 
@@ -2297,10 +2332,10 @@ function () {
2297
2332
  return allSubStateNodes.concat(subStateNode);
2298
2333
  }, []));
2299
2334
  };
2300
- /**
2301
- * Returns `true` if this state node explicitly handles the given event.
2302
- *
2303
- * @param event The event in question
2335
+ /**
2336
+ * Returns `true` if this state node explicitly handles the given event.
2337
+ *
2338
+ * @param event The event in question
2304
2339
  */
2305
2340
 
2306
2341
 
@@ -2308,12 +2343,12 @@ function () {
2308
2343
  var eventType = getEventType(event);
2309
2344
  return this.events.includes(eventType);
2310
2345
  };
2311
- /**
2312
- * Resolves the given `state` to a new `State` instance relative to this machine.
2313
- *
2314
- * This ensures that `.events` and `.nextEvents` represent the correct values.
2315
- *
2316
- * @param state The state to resolve
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
2317
2352
  */
2318
2353
 
2319
2354
 
@@ -2531,9 +2566,9 @@ function () {
2531
2566
 
2532
2567
  return nodes;
2533
2568
  };
2534
- /**
2535
- * Whether the given state node "escapes" this state node. If the `stateNode` is equal to or the parent of
2536
- * this state node, it does not escape.
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.
2537
2572
  */
2538
2573
 
2539
2574
 
@@ -2658,12 +2693,12 @@ function () {
2658
2693
  var actions = toActionObjects(exitActions.concat(transition.actions).concat(entryActions), this.machine.options.actions);
2659
2694
  return actions;
2660
2695
  };
2661
- /**
2662
- * Determines the next state given the current `state` and sent `event`.
2663
- *
2664
- * @param state The current State instance or state value
2665
- * @param event The event that was sent at the current state
2666
- * @param context The current context (extended state) of the current state
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
2667
2702
  */
2668
2703
 
2669
2704
 
@@ -2856,8 +2891,8 @@ function () {
2856
2891
  })));
2857
2892
  return maybeNextState;
2858
2893
  };
2859
- /**
2860
- * Returns the child state node from its relative `stateKey`, or throws.
2894
+ /**
2895
+ * Returns the child state node from its relative `stateKey`, or throws.
2861
2896
  */
2862
2897
 
2863
2898
 
@@ -2878,10 +2913,10 @@ function () {
2878
2913
 
2879
2914
  return result;
2880
2915
  };
2881
- /**
2882
- * Returns the state node with the given `stateId`, or throws.
2883
- *
2884
- * @param stateId The state ID. The prefix "#" is removed.
2916
+ /**
2917
+ * Returns the state node with the given `stateId`, or throws.
2918
+ *
2919
+ * @param stateId The state ID. The prefix "#" is removed.
2885
2920
  */
2886
2921
 
2887
2922
 
@@ -2900,10 +2935,10 @@ function () {
2900
2935
 
2901
2936
  return stateNode;
2902
2937
  };
2903
- /**
2904
- * Returns the relative state node from the given `statePath`, or throws.
2905
- *
2906
- * @param statePath The string or string array relative path to the state node.
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.
2907
2942
  */
2908
2943
 
2909
2944
 
@@ -2931,10 +2966,10 @@ function () {
2931
2966
 
2932
2967
  return currentStateNode;
2933
2968
  };
2934
- /**
2935
- * Resolves a partial state value with its full representation in this machine.
2936
- *
2937
- * @param stateValue The partial state value to resolve.
2969
+ /**
2970
+ * Resolves a partial state value with its full representation in this machine.
2971
+ *
2972
+ * @param stateValue The partial state value to resolve.
2938
2973
  */
2939
2974
 
2940
2975
 
@@ -3038,9 +3073,9 @@ function () {
3038
3073
  };
3039
3074
 
3040
3075
  Object.defineProperty(StateNode.prototype, "initialState", {
3041
- /**
3042
- * The initial State instance, which includes all actions to be executed from
3043
- * entering the initial state.
3076
+ /**
3077
+ * The initial State instance, which includes all actions to be executed from
3078
+ * entering the initial state.
3044
3079
  */
3045
3080
  get: function () {
3046
3081
  this._init(); // TODO: this should be in the constructor (see note in constructor)
@@ -3058,9 +3093,9 @@ function () {
3058
3093
  configurable: true
3059
3094
  });
3060
3095
  Object.defineProperty(StateNode.prototype, "target", {
3061
- /**
3062
- * The target state value of the history state node, if it exists. This represents the
3063
- * default state value to transition to if no history value exists yet.
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.
3064
3099
  */
3065
3100
  get: function () {
3066
3101
  var target;
@@ -3080,12 +3115,12 @@ function () {
3080
3115
  enumerable: false,
3081
3116
  configurable: true
3082
3117
  });
3083
- /**
3084
- * Returns the leaf nodes from a state path relative to this state node.
3085
- *
3086
- * @param relativeStateId The relative state path to retrieve the state nodes
3087
- * @param history The previous state to retrieve history
3088
- * @param resolve Whether state nodes should resolve to initial child state nodes
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
3089
3124
  */
3090
3125
 
3091
3126
  StateNode.prototype.getRelativeStateNodes = function (relativeStateId, historyValue, resolve) {
@@ -3118,11 +3153,11 @@ function () {
3118
3153
  enumerable: false,
3119
3154
  configurable: true
3120
3155
  });
3121
- /**
3122
- * Retrieves state nodes from a relative path to this state node.
3123
- *
3124
- * @param relativePath The relative path from this state node
3125
- * @param historyValue
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
3126
3161
  */
3127
3162
 
3128
3163
  StateNode.prototype.getFromRelativePath = function (relativePath) {
@@ -3170,11 +3205,11 @@ function () {
3170
3205
  })
3171
3206
  };
3172
3207
  };
3173
- /**
3174
- * Resolves to the historical value(s) of the parent state node,
3175
- * represented by state nodes.
3176
- *
3177
- * @param historyValue
3208
+ /**
3209
+ * Resolves to the historical value(s) of the parent state node,
3210
+ * represented by state nodes.
3211
+ *
3212
+ * @param historyValue
3178
3213
  */
3179
3214
 
3180
3215
 
@@ -3206,8 +3241,8 @@ function () {
3206
3241
  };
3207
3242
 
3208
3243
  Object.defineProperty(StateNode.prototype, "stateIds", {
3209
- /**
3210
- * All the state node IDs of this state node and its descendant state nodes.
3244
+ /**
3245
+ * All the state node IDs of this state node and its descendant state nodes.
3211
3246
  */
3212
3247
  get: function () {
3213
3248
  var _this = this;
@@ -3221,8 +3256,8 @@ function () {
3221
3256
  configurable: true
3222
3257
  });
3223
3258
  Object.defineProperty(StateNode.prototype, "events", {
3224
- /**
3225
- * All the event types accepted by this state node and its descendants.
3259
+ /**
3260
+ * All the event types accepted by this state node and its descendants.
3226
3261
  */
3227
3262
  get: function () {
3228
3263
  var e_7, _a, e_8, _b;
@@ -3278,10 +3313,10 @@ function () {
3278
3313
  configurable: true
3279
3314
  });
3280
3315
  Object.defineProperty(StateNode.prototype, "ownEvents", {
3281
- /**
3282
- * All the events that have transitions directly from this state node.
3283
- *
3284
- * Excludes any inert events.
3316
+ /**
3317
+ * All the events that have transitions directly from this state node.
3318
+ *
3319
+ * Excludes any inert events.
3285
3320
  */
3286
3321
  get: function () {
3287
3322
  var events = new Set(this.transitions.filter(function (transition) {
@@ -7742,213 +7777,213 @@ function tryDecode(str, decode) {
7742
7777
  }
7743
7778
  }
7744
7779
 
7745
- function hasDocumentCookie() {
7746
- // Can we get/set cookies on document.cookie?
7747
- return typeof document === 'object' && typeof document.cookie === 'string';
7748
- }
7749
- function parseCookies(cookies, options) {
7750
- if (typeof cookies === 'string') {
7751
- return parse_1(cookies, options);
7752
- }
7753
- else if (typeof cookies === 'object' && cookies !== null) {
7754
- return cookies;
7755
- }
7756
- else {
7757
- return {};
7758
- }
7759
- }
7760
- function isParsingCookie(value, doNotParse) {
7761
- if (typeof doNotParse === 'undefined') {
7762
- // We guess if the cookie start with { or [, it has been serialized
7763
- doNotParse =
7764
- !value || (value[0] !== '{' && value[0] !== '[' && value[0] !== '"');
7765
- }
7766
- return !doNotParse;
7767
- }
7768
- function readCookie(value, options) {
7769
- if (options === void 0) { options = {}; }
7770
- var cleanValue = cleanupCookieValue(value);
7771
- if (isParsingCookie(cleanValue, options.doNotParse)) {
7772
- try {
7773
- return JSON.parse(cleanValue);
7774
- }
7775
- catch (e) {
7776
- // At least we tried
7777
- }
7778
- }
7779
- // Ignore clean value if we failed the deserialization
7780
- // It is not relevant anymore to trim those values
7781
- return value;
7782
- }
7783
- function cleanupCookieValue(value) {
7784
- // express prepend j: before serializing a cookie
7785
- if (value && value[0] === 'j' && value[1] === ':') {
7786
- return value.substr(2);
7787
- }
7788
- return value;
7789
- }
7790
-
7791
- var __assign$1 = (undefined && undefined.__assign) || function () {
7792
- __assign$1 = Object.assign || function(t) {
7793
- for (var s, i = 1, n = arguments.length; i < n; i++) {
7794
- s = arguments[i];
7795
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7796
- t[p] = s[p];
7797
- }
7798
- return t;
7799
- };
7800
- return __assign$1.apply(this, arguments);
7801
- };
7802
- var Cookies = /** @class */ (function () {
7803
- function Cookies(cookies, options) {
7804
- var _this = this;
7805
- this.changeListeners = [];
7806
- this.HAS_DOCUMENT_COOKIE = false;
7807
- this.cookies = parseCookies(cookies, options);
7808
- new Promise(function () {
7809
- _this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
7810
- }).catch(function () { });
7811
- }
7812
- Cookies.prototype._updateBrowserValues = function (parseOptions) {
7813
- if (!this.HAS_DOCUMENT_COOKIE) {
7814
- return;
7815
- }
7816
- this.cookies = parse_1(document.cookie, parseOptions);
7817
- };
7818
- Cookies.prototype._emitChange = function (params) {
7819
- for (var i = 0; i < this.changeListeners.length; ++i) {
7820
- this.changeListeners[i](params);
7821
- }
7822
- };
7823
- Cookies.prototype.get = function (name, options, parseOptions) {
7824
- if (options === void 0) { options = {}; }
7825
- this._updateBrowserValues(parseOptions);
7826
- return readCookie(this.cookies[name], options);
7827
- };
7828
- Cookies.prototype.getAll = function (options, parseOptions) {
7829
- if (options === void 0) { options = {}; }
7830
- this._updateBrowserValues(parseOptions);
7831
- var result = {};
7832
- for (var name_1 in this.cookies) {
7833
- result[name_1] = readCookie(this.cookies[name_1], options);
7834
- }
7835
- return result;
7836
- };
7837
- Cookies.prototype.set = function (name, value, options) {
7838
- var _a;
7839
- if (typeof value === 'object') {
7840
- value = JSON.stringify(value);
7841
- }
7842
- this.cookies = __assign$1(__assign$1({}, this.cookies), (_a = {}, _a[name] = value, _a));
7843
- if (this.HAS_DOCUMENT_COOKIE) {
7844
- document.cookie = serialize_1(name, value, options);
7845
- }
7846
- this._emitChange({ name: name, value: value, options: options });
7847
- };
7848
- Cookies.prototype.remove = function (name, options) {
7849
- var finalOptions = (options = __assign$1(__assign$1({}, options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));
7850
- this.cookies = __assign$1({}, this.cookies);
7851
- delete this.cookies[name];
7852
- if (this.HAS_DOCUMENT_COOKIE) {
7853
- document.cookie = serialize_1(name, '', finalOptions);
7854
- }
7855
- this._emitChange({ name: name, value: undefined, options: options });
7856
- };
7857
- Cookies.prototype.addChangeListener = function (callback) {
7858
- this.changeListeners.push(callback);
7859
- };
7860
- Cookies.prototype.removeChangeListener = function (callback) {
7861
- var idx = this.changeListeners.indexOf(callback);
7862
- if (idx >= 0) {
7863
- this.changeListeners.splice(idx, 1);
7864
- }
7865
- };
7866
- return Cookies;
7780
+ function hasDocumentCookie() {
7781
+ // Can we get/set cookies on document.cookie?
7782
+ return typeof document === 'object' && typeof document.cookie === 'string';
7783
+ }
7784
+ function parseCookies(cookies, options) {
7785
+ if (typeof cookies === 'string') {
7786
+ return parse_1(cookies, options);
7787
+ }
7788
+ else if (typeof cookies === 'object' && cookies !== null) {
7789
+ return cookies;
7790
+ }
7791
+ else {
7792
+ return {};
7793
+ }
7794
+ }
7795
+ function isParsingCookie(value, doNotParse) {
7796
+ if (typeof doNotParse === 'undefined') {
7797
+ // We guess if the cookie start with { or [, it has been serialized
7798
+ doNotParse =
7799
+ !value || (value[0] !== '{' && value[0] !== '[' && value[0] !== '"');
7800
+ }
7801
+ return !doNotParse;
7802
+ }
7803
+ function readCookie(value, options) {
7804
+ if (options === void 0) { options = {}; }
7805
+ var cleanValue = cleanupCookieValue(value);
7806
+ if (isParsingCookie(cleanValue, options.doNotParse)) {
7807
+ try {
7808
+ return JSON.parse(cleanValue);
7809
+ }
7810
+ catch (e) {
7811
+ // At least we tried
7812
+ }
7813
+ }
7814
+ // Ignore clean value if we failed the deserialization
7815
+ // It is not relevant anymore to trim those values
7816
+ return value;
7817
+ }
7818
+ function cleanupCookieValue(value) {
7819
+ // express prepend j: before serializing a cookie
7820
+ if (value && value[0] === 'j' && value[1] === ':') {
7821
+ return value.substr(2);
7822
+ }
7823
+ return value;
7824
+ }
7825
+
7826
+ var __assign$1 = (undefined && undefined.__assign) || function () {
7827
+ __assign$1 = Object.assign || function(t) {
7828
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7829
+ s = arguments[i];
7830
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7831
+ t[p] = s[p];
7832
+ }
7833
+ return t;
7834
+ };
7835
+ return __assign$1.apply(this, arguments);
7836
+ };
7837
+ var Cookies = /** @class */ (function () {
7838
+ function Cookies(cookies, options) {
7839
+ var _this = this;
7840
+ this.changeListeners = [];
7841
+ this.HAS_DOCUMENT_COOKIE = false;
7842
+ this.cookies = parseCookies(cookies, options);
7843
+ new Promise(function () {
7844
+ _this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
7845
+ }).catch(function () { });
7846
+ }
7847
+ Cookies.prototype._updateBrowserValues = function (parseOptions) {
7848
+ if (!this.HAS_DOCUMENT_COOKIE) {
7849
+ return;
7850
+ }
7851
+ this.cookies = parse_1(document.cookie, parseOptions);
7852
+ };
7853
+ Cookies.prototype._emitChange = function (params) {
7854
+ for (var i = 0; i < this.changeListeners.length; ++i) {
7855
+ this.changeListeners[i](params);
7856
+ }
7857
+ };
7858
+ Cookies.prototype.get = function (name, options, parseOptions) {
7859
+ if (options === void 0) { options = {}; }
7860
+ this._updateBrowserValues(parseOptions);
7861
+ return readCookie(this.cookies[name], options);
7862
+ };
7863
+ Cookies.prototype.getAll = function (options, parseOptions) {
7864
+ if (options === void 0) { options = {}; }
7865
+ this._updateBrowserValues(parseOptions);
7866
+ var result = {};
7867
+ for (var name_1 in this.cookies) {
7868
+ result[name_1] = readCookie(this.cookies[name_1], options);
7869
+ }
7870
+ return result;
7871
+ };
7872
+ Cookies.prototype.set = function (name, value, options) {
7873
+ var _a;
7874
+ if (typeof value === 'object') {
7875
+ value = JSON.stringify(value);
7876
+ }
7877
+ this.cookies = __assign$1(__assign$1({}, this.cookies), (_a = {}, _a[name] = value, _a));
7878
+ if (this.HAS_DOCUMENT_COOKIE) {
7879
+ document.cookie = serialize_1(name, value, options);
7880
+ }
7881
+ this._emitChange({ name: name, value: value, options: options });
7882
+ };
7883
+ Cookies.prototype.remove = function (name, options) {
7884
+ var finalOptions = (options = __assign$1(__assign$1({}, options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));
7885
+ this.cookies = __assign$1({}, this.cookies);
7886
+ delete this.cookies[name];
7887
+ if (this.HAS_DOCUMENT_COOKIE) {
7888
+ document.cookie = serialize_1(name, '', finalOptions);
7889
+ }
7890
+ this._emitChange({ name: name, value: undefined, options: options });
7891
+ };
7892
+ Cookies.prototype.addChangeListener = function (callback) {
7893
+ this.changeListeners.push(callback);
7894
+ };
7895
+ Cookies.prototype.removeChangeListener = function (callback) {
7896
+ var idx = this.changeListeners.indexOf(callback);
7897
+ if (idx >= 0) {
7898
+ this.changeListeners.splice(idx, 1);
7899
+ }
7900
+ };
7901
+ return Cookies;
7867
7902
  }());
7868
7903
 
7869
- /*! *****************************************************************************
7870
- Copyright (c) Microsoft Corporation.
7871
-
7872
- Permission to use, copy, modify, and/or distribute this software for any
7873
- purpose with or without fee is hereby granted.
7874
-
7875
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7876
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
7877
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
7878
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
7879
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
7880
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
7881
- PERFORMANCE OF THIS SOFTWARE.
7882
- ***************************************************************************** */
7883
-
7884
- var __assign = function() {
7885
- __assign = Object.assign || function __assign(t) {
7886
- for (var s, i = 1, n = arguments.length; i < n; i++) {
7887
- s = arguments[i];
7888
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
7889
- }
7890
- return t;
7891
- };
7892
- return __assign.apply(this, arguments);
7893
- };
7894
-
7895
- function __rest(s, e) {
7896
- var t = {};
7897
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
7898
- t[p] = s[p];
7899
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7900
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7901
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
7902
- t[p[i]] = s[p[i]];
7903
- }
7904
- return t;
7905
- }
7906
-
7907
- function __awaiter(thisArg, _arguments, P, generator) {
7908
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7909
- return new (P || (P = Promise))(function (resolve, reject) {
7910
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7911
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7912
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7913
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7914
- });
7915
- }
7916
-
7917
- function __generator(thisArg, body) {
7918
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
7919
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
7920
- function verb(n) { return function (v) { return step([n, v]); }; }
7921
- function step(op) {
7922
- if (f) throw new TypeError("Generator is already executing.");
7923
- while (_) try {
7924
- 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;
7925
- if (y = 0, t) op = [op[0] & 2, t.value];
7926
- switch (op[0]) {
7927
- case 0: case 1: t = op; break;
7928
- case 4: _.label++; return { value: op[1], done: false };
7929
- case 5: _.label++; y = op[1]; op = [0]; continue;
7930
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
7931
- default:
7932
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
7933
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
7934
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
7935
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
7936
- if (t[2]) _.ops.pop();
7937
- _.trys.pop(); continue;
7938
- }
7939
- op = body.call(thisArg, _);
7940
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
7941
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7942
- }
7943
- }
7944
-
7945
- /** @deprecated */
7946
- function __spreadArrays() {
7947
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
7948
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
7949
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
7950
- r[k] = a[j];
7951
- return r;
7904
+ /*! *****************************************************************************
7905
+ Copyright (c) Microsoft Corporation.
7906
+
7907
+ Permission to use, copy, modify, and/or distribute this software for any
7908
+ purpose with or without fee is hereby granted.
7909
+
7910
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7911
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
7912
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
7913
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
7914
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
7915
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
7916
+ PERFORMANCE OF THIS SOFTWARE.
7917
+ ***************************************************************************** */
7918
+
7919
+ var __assign = function() {
7920
+ __assign = Object.assign || function __assign(t) {
7921
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7922
+ s = arguments[i];
7923
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
7924
+ }
7925
+ return t;
7926
+ };
7927
+ return __assign.apply(this, arguments);
7928
+ };
7929
+
7930
+ function __rest(s, e) {
7931
+ var t = {};
7932
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
7933
+ t[p] = s[p];
7934
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7935
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7936
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
7937
+ t[p[i]] = s[p[i]];
7938
+ }
7939
+ return t;
7940
+ }
7941
+
7942
+ function __awaiter(thisArg, _arguments, P, generator) {
7943
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7944
+ return new (P || (P = Promise))(function (resolve, reject) {
7945
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7946
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7947
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7948
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
7949
+ });
7950
+ }
7951
+
7952
+ function __generator(thisArg, body) {
7953
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
7954
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
7955
+ function verb(n) { return function (v) { return step([n, v]); }; }
7956
+ function step(op) {
7957
+ if (f) throw new TypeError("Generator is already executing.");
7958
+ while (_) try {
7959
+ 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;
7960
+ if (y = 0, t) op = [op[0] & 2, t.value];
7961
+ switch (op[0]) {
7962
+ case 0: case 1: t = op; break;
7963
+ case 4: _.label++; return { value: op[1], done: false };
7964
+ case 5: _.label++; y = op[1]; op = [0]; continue;
7965
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
7966
+ default:
7967
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
7968
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
7969
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
7970
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
7971
+ if (t[2]) _.ops.pop();
7972
+ _.trys.pop(); continue;
7973
+ }
7974
+ op = body.call(thisArg, _);
7975
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
7976
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7977
+ }
7978
+ }
7979
+
7980
+ /** @deprecated */
7981
+ function __spreadArrays() {
7982
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
7983
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
7984
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
7985
+ r[k] = a[j];
7986
+ return r;
7952
7987
  }
7953
7988
 
7954
7989
  /**
@@ -10608,11 +10643,13 @@ function auth (request) {
10608
10643
  }),
10609
10644
  setAccount: assign((context, event) => {
10610
10645
  if (context.loginData.phone) {
10646
+ cookies.remove(accountEmailKey);
10611
10647
  cookies.set(accountPhoneKey, `0${context.loginData.phone}`, {
10612
10648
  path: '/',
10613
10649
  maxAge: 60 * 60 * 24 * 7,
10614
10650
  });
10615
10651
  } else if (context.loginData.email) {
10652
+ cookies.remove(accountPhoneKey);
10616
10653
  cookies.set(accountEmailKey, context.loginData.email, {
10617
10654
  path: '/',
10618
10655
  maxAge: 60 * 60 * 24 * 7,
@@ -13149,22 +13186,27 @@ function common (request) {
13149
13186
  }
13150
13187
  }),
13151
13188
  setAgent: assign((context, event) => {
13152
- let urlParams = new URLSearchParams(window.location.search);
13153
- const channel = urlParams.get('channel') || cookies$1.get('channel') || defaultChannel || 'official';
13154
- const subchannel = urlParams.get('subchannel') || cookies$1.get('subchannel') || defaultSubchannel || 'pwa';
13189
+ if (window.CC_JSB === true) {
13190
+ // is cocos native app
13191
+ return
13192
+ } else {
13193
+ let urlParams = new URLSearchParams(window.location.search);
13194
+ const channel = urlParams.get('channel') || cookies$1.get('channel') || defaultChannel || 'official';
13195
+ const subchannel = urlParams.get('subchannel') || cookies$1.get('subchannel') || defaultSubchannel || 'pwa';
13155
13196
 
13156
- cookies$1.set('channel', channel, {
13157
- path: '/',
13158
- maxAge: 60 * 60 * 24 * 7,
13159
- });
13160
- cookies$1.set('subchannel', subchannel, {
13161
- path: '/',
13162
- maxAge: 60 * 60 * 24 * 7,
13163
- });
13197
+ cookies$1.set('channel', channel, {
13198
+ path: '/',
13199
+ maxAge: 60 * 60 * 24 * 7,
13200
+ });
13201
+ cookies$1.set('subchannel', subchannel, {
13202
+ path: '/',
13203
+ maxAge: 60 * 60 * 24 * 7,
13204
+ });
13164
13205
 
13165
- return {
13166
- channel,
13167
- subchannel,
13206
+ return {
13207
+ channel,
13208
+ subchannel,
13209
+ }
13168
13210
  }
13169
13211
  }),
13170
13212
  setFeeds: assign((context, event) => {
@@ -13534,7 +13576,7 @@ function game (request) {
13534
13576
  },
13535
13577
  services: {
13536
13578
  getRoomItems: async (context, event) => {
13537
- return await request.send(api.getGameCategory({ id: context.roomId }))
13579
+ return await request.send(game$1.getGameCategory({ id: context.roomId }))
13538
13580
  },
13539
13581
  connectGame: async (context, event) => {
13540
13582
  const { lang, isMobile } = context;
@@ -13549,93 +13591,421 @@ function game (request) {
13549
13591
  lang,
13550
13592
  return_url: window.location.href,
13551
13593
  };
13552
- const { redirect_url } = await request.send(api.playGame(params));
13594
+ const { redirect_url } = await request.send(game$1.playGame(params));
13553
13595
  return { gameURL: redirect_url }
13554
13596
  },
13555
13597
  disconnectGame: async (context, event) => {
13556
13598
  const uid_site = event.data;
13557
- return await request.send(api.logoutGame({ uid_site, provider_id: context.game.provider }))
13599
+ return await request.send(game$1.logoutGame({ uid_site, provider_id: context.game.provider }))
13558
13600
  },
13559
13601
  fetchOption: async (context, event) => {
13560
- return await request.send(api.getOptionMap())
13602
+ return await request.send(game$1.getOptionMap())
13561
13603
  },
13562
13604
  fetchGameSHA: async (context, event) => {
13563
- return await request.send(api.getGameSHA())
13605
+ return await request.send(game$1.getGameSHA())
13564
13606
  },
13565
13607
  fetchStatus: async (context, event) => {
13566
- return await request.send(api.getGameStatus())
13608
+ return await request.send(game$1.getGameStatus())
13567
13609
  },
13568
13610
  },
13569
13611
  }
13570
13612
  )
13571
13613
  }
13572
13614
 
13573
- function game_favorite (request) {
13615
+ const MY_FAVORITE = 'MyFavorite';
13616
+
13617
+ var constant = /*#__PURE__*/Object.freeze({
13618
+ __proto__: null,
13619
+ MY_FAVORITE: MY_FAVORITE
13620
+ });
13621
+
13622
+ function game_v2 (request) {
13574
13623
  return createMachine(
13575
13624
  {
13576
- id: 'favorite',
13625
+ id: 'game',
13577
13626
  type: 'parallel',
13578
13627
  context: {
13579
- list: [],
13628
+ room: null,
13629
+ index: 0,
13630
+ content: {
13631
+ data: [],
13632
+ timestamp: null,
13633
+ parentCategoryId: null,
13634
+ totalPage: 1,
13635
+ },
13636
+ favoriteList: [],
13637
+ // play params
13638
+ game: {
13639
+ providerId: null,
13640
+ gameId: null,
13641
+ gameTypeId: null,
13642
+ mappingId: null,
13643
+ portrait: null,
13644
+ },
13645
+ lang: 'en_US',
13646
+ isMobile: new UAParser().getResult().device.type,
13647
+ gameURL: null,
13580
13648
  },
13581
13649
  states: {
13582
- fetching: {
13583
- initial: 'disable',
13650
+ flow: {
13651
+ initial: 'idle',
13584
13652
  states: {
13585
- disable: {},
13586
- enable: {
13653
+ idle: {
13654
+ enter: 'clearGameInfo',
13655
+ on: {
13656
+ ENTER_ROOM: {
13657
+ target: 'loading',
13658
+ cond: 'isDifferentRoom',
13659
+ actions: ['setRoom', 'resetContent'],
13660
+ },
13661
+ NEXT_PAGE: {
13662
+ target: 'loading',
13663
+ cond: 'hasNext',
13664
+ actions: 'increaseIndex',
13665
+ },
13666
+ ENTER_GAME: {
13667
+ target: 'connecting',
13668
+ actions: ['setGameInfo', 'setLang'],
13669
+ },
13670
+ ADD_FAVORITE: {
13671
+ target: 'adding',
13672
+ cond: 'isNotFavorite',
13673
+ actions: 'addToFavoriteList',
13674
+ },
13675
+ REMOVE_FAVORITE: {
13676
+ target: 'removing',
13677
+ cond: 'isFavorite',
13678
+ actions: 'removeFromFavoriteList',
13679
+ },
13680
+ },
13681
+ },
13682
+ loading: {
13587
13683
  invoke: {
13588
- src: 'fetchList',
13684
+ src: 'getPageContent',
13589
13685
  onDone: {
13590
- actions: 'setList',
13686
+ target: 'idle',
13687
+ actions: 'appendContent',
13591
13688
  },
13592
13689
  onError: {
13593
- actions: assign({ list: [] }),
13690
+ target: 'idle',
13594
13691
  },
13595
13692
  },
13596
13693
  },
13597
- },
13598
- },
13599
- adding: {
13600
- initial: 'disable',
13601
- states: {
13602
- disable: {},
13603
- enable: {
13694
+ connecting: {
13604
13695
  invoke: {
13605
- src: 'add',
13606
- onDone: {},
13696
+ src: 'connectGame',
13697
+ onDone: {
13698
+ target: 'playing',
13699
+ actions: 'setGameURL',
13700
+ },
13607
13701
  onError: {
13608
- actions: 'removeFromList',
13702
+ target: 'idle',
13703
+ },
13704
+ },
13705
+ },
13706
+ playing: {
13707
+ on: {
13708
+ EXIT_GAME: {
13709
+ target: 'disconnect',
13710
+ },
13711
+ },
13712
+ },
13713
+ disconnect: {
13714
+ invoke: {
13715
+ src: 'disconnectGame',
13716
+ onDone: {
13717
+ target: 'idle',
13718
+ },
13719
+ onError: {
13720
+ target: 'idle',
13721
+ },
13722
+ },
13723
+ },
13724
+ adding: {
13725
+ invoke: {
13726
+ src: 'addFavorite',
13727
+ onDone: {
13728
+ target: 'idle',
13729
+ },
13730
+ onError: {
13731
+ target: 'idle',
13732
+ actions: 'removeFromFavoriteList',
13733
+ },
13734
+ },
13735
+ },
13736
+ removing: {
13737
+ invoke: {
13738
+ src: 'removeFavorite',
13739
+ onDone: {
13740
+ target: 'idle',
13741
+ },
13742
+ onError: {
13743
+ target: 'idle',
13744
+ actions: 'addToFavoriteList',
13609
13745
  },
13610
13746
  },
13611
13747
  },
13612
13748
  },
13613
13749
  },
13614
- removing: {
13615
- initial: 'disable',
13750
+ timer: {
13751
+ initial: 'favorite',
13616
13752
  states: {
13617
- disable: {},
13618
- enable: {
13753
+ favorite: {
13619
13754
  invoke: {
13620
- src: 'remove',
13621
- onDone: {},
13755
+ src: 'getFavorite',
13756
+ onDone: {
13757
+ target: 'pending',
13758
+ actions: 'setFavoriteList',
13759
+ },
13622
13760
  onError: {
13623
- actions: 'addToList',
13761
+ target: 'pending',
13624
13762
  },
13625
13763
  },
13626
13764
  },
13627
- },
13628
- },
13629
- },
13630
- on: {
13631
- FETCH_LIST: {
13632
- target: 'fetching.enable',
13633
- },
13634
- ADD: {
13635
- target: 'adding.enable',
13636
- actions: 'addToList',
13637
- cond: 'isNotExist',
13638
- },
13765
+ pending: {
13766
+ after: {
13767
+ 20000: [
13768
+ {
13769
+ target: 'updating',
13770
+ cond: 'hasRoom',
13771
+ },
13772
+ {
13773
+ target: 'pending',
13774
+ },
13775
+ ],
13776
+ },
13777
+ },
13778
+ updating: {
13779
+ invoke: {
13780
+ src: 'updatePageContent',
13781
+ onDone: {
13782
+ target: 'pending',
13783
+ actions: 'swapContent',
13784
+ },
13785
+ onError: {
13786
+ target: 'pending',
13787
+ },
13788
+ },
13789
+ },
13790
+ },
13791
+ },
13792
+ },
13793
+ },
13794
+ {
13795
+ actions: {
13796
+ setFavoriteList: assign((context, event) => {
13797
+ return {
13798
+ favoriteList: event.data.data || [],
13799
+ }
13800
+ }),
13801
+ setRoom: assign((context, event) => {
13802
+ return {
13803
+ room: event.data,
13804
+ }
13805
+ }),
13806
+ resetContent: assign((context, event) => {
13807
+ return {
13808
+ index: 0,
13809
+ content: {
13810
+ data: [],
13811
+ timestamp: null,
13812
+ parentCategoryId: null,
13813
+ totalPage: 1,
13814
+ },
13815
+ }
13816
+ }),
13817
+ appendContent: assign((context, event) => {
13818
+ const { room, favoriteList } = context;
13819
+ const { data, ...rest } = event.data;
13820
+ return {
13821
+ favoriteList: room.categoryId === MY_FAVORITE ? data : favoriteList,
13822
+ content: {
13823
+ ...context.content,
13824
+ ...rest,
13825
+ data: context.content.data.concat(data),
13826
+ },
13827
+ }
13828
+ }),
13829
+ swapContent: assign((context, event) => {
13830
+ const { room, favoriteList } = context;
13831
+ if (event.data.data.length) {
13832
+ return {
13833
+ favoriteList: room.categoryId === MY_FAVORITE ? event.data.data : favoriteList,
13834
+ content: event.data,
13835
+ }
13836
+ }
13837
+ }),
13838
+ increaseIndex: assign((context, event) => {
13839
+ return {
13840
+ index: context.index + 1,
13841
+ }
13842
+ }),
13843
+ setGameURL: assign({
13844
+ gameURL: (context, event) => {
13845
+ return event.data.gameURL
13846
+ },
13847
+ }),
13848
+ clearGameInfo: assign((context, event) => {
13849
+ return { game: { providerId: null, gameId: null, gameTypeId: null, mappingId: null } }
13850
+ }),
13851
+ setGameInfo: assign((context, event) => {
13852
+ const { providerId, gameId, gameTypeId, mappingId, portrait } = event.data.game;
13853
+ return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0 } }
13854
+ }),
13855
+ setLang: assign((context, event) => {
13856
+ const lang = event.data.locale.replace('-', '_');
13857
+ return { lang }
13858
+ }),
13859
+ addToFavoriteList: assign((context, event) => {
13860
+ return {
13861
+ favoriteList: [...context.favoriteList, event.data],
13862
+ }
13863
+ }),
13864
+ removeFromFavoriteList: assign((context, event) => {
13865
+ return {
13866
+ favoriteList: context.favoriteList.filter((item) => item.gameCode !== event.data.gameCode),
13867
+ }
13868
+ }),
13869
+ },
13870
+ guards: {
13871
+ isDifferentRoom: (context, event) => context.room?.categoryId !== event.data?.categoryId,
13872
+ hasNext: (context, event) => context.index < context?.content?.totalPage - 1,
13873
+ hasRoom: (context, event) => context.room?.categoryId,
13874
+ isFavorite: (context, event) => context.favoriteList.some((item) => item.gameCode === event.data.gameCode),
13875
+ isNotFavorite: (context, event) => !context.favoriteList.some((item) => item.gameCode === event.data.gameCode),
13876
+ },
13877
+ services: {
13878
+ getFavorite: async (context, event) => {
13879
+ return await request.send(game$1.getListMyFavorite())
13880
+ },
13881
+ getPageContent: async (context, event) => {
13882
+ const { room, index } = context;
13883
+ if (room.categoryId === MY_FAVORITE) {
13884
+ return await request.send(game$1.getListMyFavorite())
13885
+ } else {
13886
+ return await request.send(game$1.getListCategory({ categoryId: room.categoryId, index }))
13887
+ }
13888
+ },
13889
+ updatePageContent: async (context, event) => {
13890
+ const { room, content, index } = context;
13891
+ if (room.categoryId === MY_FAVORITE) ; else {
13892
+ return await request.send(
13893
+ game$1.getListCategoryByRange({
13894
+ categoryId: room.categoryId,
13895
+ end: index,
13896
+ timestamp: content.timestamp,
13897
+ })
13898
+ )
13899
+ }
13900
+ },
13901
+ connectGame: async (context, event) => {
13902
+ const { lang, isMobile } = context;
13903
+ const { providerId, gameId, gameTypeId, mappingId } = context.game;
13904
+ const params = {
13905
+ provider_id: providerId,
13906
+ game_id: gameId,
13907
+ gametype_id: gameTypeId,
13908
+ mapping_id: mappingId,
13909
+ is_demo: false,
13910
+ is_mobile: isMobile,
13911
+ lang,
13912
+ return_url: window.location.href,
13913
+ };
13914
+ const { redirect_url } = await request.send(game$1.playGame(params));
13915
+ return { gameURL: redirect_url }
13916
+ },
13917
+ disconnectGame: async (context, event) => {
13918
+ const uid_site = event.data;
13919
+ const provider_id = context.game.providerId;
13920
+ return await request.send(game$1.logoutGame({ uid_site, provider_id }))
13921
+ },
13922
+ addFavorite: async (context, event) => {
13923
+ try {
13924
+ await request.send(game$1.addListFavorite(event.data.gameCode));
13925
+ return event.data
13926
+ } catch (error) {
13927
+ throw event.data
13928
+ }
13929
+ },
13930
+ removeFavorite: async (context, event) => {
13931
+ try {
13932
+ await request.send(game$1.removeListFavorite(event.data.gameCode));
13933
+ return event.data
13934
+ } catch (error) {
13935
+ throw event.data
13936
+ }
13937
+ },
13938
+ },
13939
+ }
13940
+ )
13941
+ }
13942
+
13943
+ function game_favorite (request) {
13944
+ return createMachine(
13945
+ {
13946
+ id: 'favorite',
13947
+ type: 'parallel',
13948
+ context: {
13949
+ list: [],
13950
+ },
13951
+ states: {
13952
+ fetching: {
13953
+ initial: 'disable',
13954
+ states: {
13955
+ disable: {},
13956
+ enable: {
13957
+ invoke: {
13958
+ src: 'fetchList',
13959
+ onDone: {
13960
+ actions: 'setList',
13961
+ },
13962
+ onError: {
13963
+ actions: assign({ list: [] }),
13964
+ },
13965
+ },
13966
+ },
13967
+ },
13968
+ },
13969
+ adding: {
13970
+ initial: 'disable',
13971
+ states: {
13972
+ disable: {},
13973
+ enable: {
13974
+ invoke: {
13975
+ src: 'add',
13976
+ onDone: {},
13977
+ onError: {
13978
+ actions: 'removeFromList',
13979
+ },
13980
+ },
13981
+ },
13982
+ },
13983
+ },
13984
+ removing: {
13985
+ initial: 'disable',
13986
+ states: {
13987
+ disable: {},
13988
+ enable: {
13989
+ invoke: {
13990
+ src: 'remove',
13991
+ onDone: {},
13992
+ onError: {
13993
+ actions: 'addToList',
13994
+ },
13995
+ },
13996
+ },
13997
+ },
13998
+ },
13999
+ },
14000
+ on: {
14001
+ FETCH_LIST: {
14002
+ target: 'fetching.enable',
14003
+ },
14004
+ ADD: {
14005
+ target: 'adding.enable',
14006
+ actions: 'addToList',
14007
+ cond: 'isNotExist',
14008
+ },
13639
14009
  REMOVE: {
13640
14010
  target: 'removing.enable',
13641
14011
  actions: 'removeFromList',
@@ -13668,22 +14038,22 @@ function game_favorite (request) {
13668
14038
  services: {
13669
14039
  add: async (context, event) => {
13670
14040
  try {
13671
- return await request.send(api.addFavoriteGame(event.data))
14041
+ return await request.send(game$1.addFavoriteGame(event.data))
13672
14042
  } catch (error) {
13673
14043
  throw event.data
13674
14044
  }
13675
14045
  },
13676
14046
  remove: async (context, event) => {
13677
14047
  try {
13678
- return await request.send(api.removeFavoriteGame(event.data))
14048
+ return await request.send(game$1.removeFavoriteGame(event.data))
13679
14049
  } catch (error) {
13680
14050
  throw event.data
13681
14051
  }
13682
14052
  },
13683
14053
  fetchList: async (context, event) => {
13684
- const main = await request.send(api.getGameCategory({}));
14054
+ const main = await request.send(game$1.getGameCategory({}));
13685
14055
  const room = main.list.find((item) => item.category === 'SYSTEM_MY_FAVORITE');
13686
- const favorite = await request.send(api.getGameCategory({ id: room.id }));
14056
+ const favorite = await request.send(game$1.getGameCategory({ id: room.id }));
13687
14057
  return favorite.list.map((item) => item.g)
13688
14058
  },
13689
14059
  },
@@ -13916,17 +14286,17 @@ function game_search (request) {
13916
14286
  services: {
13917
14287
  fetchTags: async (context, event) => {
13918
14288
  const { keyword } = context;
13919
- const { result } = await request.send(api.getGameTags({ q: keyword }));
14289
+ const { result } = await request.send(game$1.getGameTags({ q: keyword }));
13920
14290
  return result
13921
14291
  },
13922
14292
  fetchGames: async (context, event) => {
13923
14293
  const { tagId, tagIndex, keyword, click, clickDefault } = context;
13924
- const { traceId, result } = await request.send(api.getGameSearchList({ id: tagId, index: tagIndex, q: keyword, click, clickDefault }));
14294
+ const { traceId, result } = await request.send(game$1.getGameSearchList({ id: tagId, index: tagIndex, q: keyword, click, clickDefault }));
13925
14295
  return { traceId, result }
13926
14296
  },
13927
14297
  sendTrace: async (context, event) => {
13928
14298
  const { traceId, tagId, tagIndex, gameCode, gameCodeIndex, keyword: query, click, clickDefault } = context;
13929
- return await request.send(api.setGameSearchTrace({ traceId, tagId, tagIndex, gameCode, gameCodeIndex, query, click, clickDefault }))
14299
+ return await request.send(game$1.setGameSearchTrace({ traceId, tagId, tagIndex, gameCode, gameCodeIndex, query, click, clickDefault }))
13930
14300
  },
13931
14301
  },
13932
14302
  }
@@ -13994,12 +14364,12 @@ function game_hot_new (request) {
13994
14364
  },
13995
14365
  services: {
13996
14366
  getRoomItems: async (context, event) => {
13997
- return await request.send(api.getGameCategory({ id: context.roomId }))
14367
+ return await request.send(game$1.getGameCategory({ id: context.roomId }))
13998
14368
  },
13999
14369
  getGames: async (context, event) => {
14000
14370
  const [resHot, resNew] = await Promise.all([
14001
- request.send(api.getGameCategory({ id: context.hot.id })),
14002
- request.send(api.getGameCategory({ id: context.new.id })),
14371
+ request.send(game$1.getGameCategory({ id: context.hot.id })),
14372
+ request.send(game$1.getGameCategory({ id: context.new.id })),
14003
14373
  ]);
14004
14374
  const hotGames = resHot?.list?.map?.((item) => item.g);
14005
14375
  const newGames = resNew?.list?.map?.((item) => item.g);
@@ -14779,7 +15149,7 @@ function side (request) {
14779
15149
  },
14780
15150
  services: {
14781
15151
  getRoomItems: async (context, event) => {
14782
- return await request.send(api.getGameCategory({ id: context.room?.id }))
15152
+ return await request.send(game$1.getGameCategory({ id: context.room?.id }))
14783
15153
  },
14784
15154
  },
14785
15155
  }
@@ -14794,71 +15164,259 @@ function createSideAction(name) {
14794
15164
  })
14795
15165
  }
14796
15166
 
14797
- function user_info (request) {
15167
+ function side_v2 (request) {
14798
15168
  return createMachine(
14799
15169
  {
14800
- id: 'user_info',
14801
- initial: 'fetching',
15170
+ id: 'side',
15171
+ initial: 'loading',
14802
15172
  context: {
14803
- userInfo: {},
15173
+ menu: null,
15174
+ menuItemStack: [],
15175
+ previousMenuItemStack: [],
15176
+ historyStack: [],
14804
15177
  },
14805
15178
  states: {
14806
- fetching: {
15179
+ loading: {
14807
15180
  invoke: {
14808
- src: 'fetchUserInfo',
15181
+ src: 'getMenu',
14809
15182
  onDone: {
14810
15183
  target: 'idle',
14811
- actions: 'setUserInfo',
14812
- },
14813
- onError: {
14814
- target: 'idle',
15184
+ actions: ['setMenu', 'setDefaultMenuItemStack'],
14815
15185
  },
14816
15186
  },
14817
15187
  },
14818
15188
  idle: {
14819
- on: {
14820
- UPDATE_USER_INFO: {
14821
- target: 'updating',
15189
+ initial: 'pending',
15190
+ states: {
15191
+ pending: {
15192
+ after: {
15193
+ 20000: [
15194
+ {
15195
+ target: 'updating',
15196
+ cond: 'isInMenu'
15197
+ },
15198
+ {
15199
+ target: 'pending',
15200
+ },
15201
+ ]
15202
+ }
15203
+ },
15204
+ updating: {
15205
+ invoke: {
15206
+ src: 'fetchUpdateMenu',
15207
+ onDone: {
15208
+ target: 'pending',
15209
+ actions: 'updateMenu',
15210
+ },
15211
+ },
14822
15212
  },
14823
15213
  },
14824
- },
14825
- updating: {
14826
- invoke: {
14827
- src: 'updateUserInfo',
14828
- onDone: {
14829
- target: 'idle',
14830
- // target: 'fetching', // 因為更新 userInfo 後 get self 還是拿到舊資料
15214
+ on: {
15215
+ SELECT: {
15216
+ actions: 'setMenuItemStack',
14831
15217
  },
14832
- onError: {
14833
- target: 'idle',
15218
+ CANCEL: {
15219
+ actions: 'restoreMenuItemStack',
14834
15220
  },
15221
+ PUSH: {
15222
+ actions: 'pushHistoryStack'
15223
+ },
15224
+ POP: {
15225
+ actions: 'popHistoryStack'
15226
+ }
14835
15227
  },
14836
15228
  },
14837
15229
  },
14838
15230
  },
14839
15231
  {
14840
15232
  actions: {
14841
- setUserInfo: assign((context, event) => {
15233
+ setMenu: assign((context, event) => {
15234
+ const menu = event.data;
15235
+ addLevelProperty(menu.data, 0);
15236
+ return { menu }
15237
+ }),
15238
+ setDefaultMenuItemStack: assign((context, event) => {
15239
+ const menuItemStack = getDefaultItem(event.data.data[0]);
15240
+ return { menuItemStack }
15241
+ }),
15242
+ setMenuItemStack: assign((context, event) => {
15243
+ const { menuItemStack } = context;
15244
+ const inputItem = event.data;
15245
+ const isTopItem = inputItem.level === 0;
15246
+ const hasSubMenu = inputItem.sub.length;
15247
+
15248
+ if (isTopItem) {
15249
+ if (hasSubMenu) {
15250
+ const isSameBranch = menuItemStack[0].categoryId === inputItem.categoryId;
15251
+ if (isSameBranch) {
15252
+ return {
15253
+ previousMenuItemStack: menuItemStack,
15254
+ }
15255
+ } else {
15256
+ return {
15257
+ previousMenuItemStack: menuItemStack,
15258
+ menuItemStack: [event.data],
15259
+ }
15260
+ }
15261
+ } else {
15262
+ return {
15263
+ previousMenuItemStack: [],
15264
+ menuItemStack: [event.data],
15265
+ historyStack: []
15266
+ }
15267
+ }
15268
+ } else {
15269
+ const slicedStack = menuItemStack.slice(0, inputItem.level);
15270
+ return {
15271
+ menuItemStack: [...slicedStack, event.data],
15272
+ historyStack: []
15273
+ }
15274
+ }
15275
+ }),
15276
+ restoreMenuItemStack: assign((context, event) => {
15277
+ const { previousMenuItemStack } = context;
14842
15278
  return {
14843
- userInfo: event.data,
15279
+ previousMenuItemStack: [],
15280
+ menuItemStack: previousMenuItemStack,
15281
+ }
15282
+ }),
15283
+ updateMenu: assign((context, event) => {
15284
+ const menu = event.data;
15285
+ if (menu.data.length) {
15286
+ addLevelProperty(menu.data, 0);
15287
+ return { menu }
15288
+ }
15289
+ }),
15290
+ pushHistoryStack: assign((context, event) => {
15291
+ const { menuItemStack, historyStack } = context;
15292
+ return {
15293
+ historyStack: historyStack.concat(menuItemStack.slice(-1)),
14844
15294
  }
14845
15295
  }),
15296
+ popHistoryStack: assign((context, event) => {
15297
+ const { historyStack } = context;
15298
+ return {
15299
+ historyStack: historyStack.slice(0, -1),
15300
+ }
15301
+ }),
15302
+ },
15303
+ guards: {
15304
+ isInMenu: ((context, event) => {
15305
+ const {menuItemStack, menu} = context;
15306
+ const menuItem = menuItemStack.slice(-1)[0];
15307
+ return isItemInMenu(menuItem, menu.data)
15308
+ })
14846
15309
  },
14847
15310
  services: {
14848
- fetchUserInfo: async (context, event) => {
14849
- return await request.send(user.getUserInfo())
15311
+ getMenu: async (context, event) => {
15312
+ return await request.send(game$1.getListRoot())
14850
15313
  },
14851
- updateUserInfo: async (context, event) => {
14852
- return await request.send(user.updateUserInfo(event.data))
15314
+ fetchUpdateMenu: async (context, event) => {
15315
+ return await request.send(game$1.getListRoot({ timestamp: context.menu.timestamp }))
14853
15316
  },
14854
15317
  },
14855
15318
  }
14856
15319
  )
14857
15320
  }
14858
15321
 
14859
- const cookies = new Cookies();
15322
+ function isItemInMenu(targetItem, menuList) {
15323
+ return menuList.reduce((result, currentItem) => {
15324
+ if (result) {
15325
+ return true
15326
+ } else {
15327
+ if (currentItem.categoryId === targetItem.categoryId) {
15328
+ return true
15329
+ } else if (currentItem.sub.length) {
15330
+ return isItemInMenu(targetItem, currentItem.sub)
15331
+ } else {
15332
+ return false
15333
+ }
15334
+ }
15335
+ }, false)
15336
+ }
14860
15337
 
14861
- function user_sign_up (request) {
15338
+ function getDefaultItem(node) {
15339
+ if (node.sub.length > 0) {
15340
+ const stack = getDefaultItem(node.sub[0]);
15341
+ return [node, ...stack]
15342
+ } else {
15343
+ return [node]
15344
+ }
15345
+ }
15346
+
15347
+ function addLevelProperty(list, level) {
15348
+ const nextLevel = level + 1;
15349
+ for (let i = 0; i < list.length; i++) {
15350
+ list[i].level = level;
15351
+ addLevelProperty(list[i].sub, nextLevel);
15352
+ }
15353
+ }
15354
+
15355
+ function user_info (request) {
15356
+ return createMachine(
15357
+ {
15358
+ id: 'user_info',
15359
+ initial: 'fetching',
15360
+ context: {
15361
+ userInfo: {},
15362
+ },
15363
+ states: {
15364
+ fetching: {
15365
+ invoke: {
15366
+ src: 'fetchUserInfo',
15367
+ onDone: {
15368
+ target: 'idle',
15369
+ actions: 'setUserInfo',
15370
+ },
15371
+ onError: {
15372
+ target: 'idle',
15373
+ },
15374
+ },
15375
+ },
15376
+ idle: {
15377
+ on: {
15378
+ UPDATE_USER_INFO: {
15379
+ target: 'updating',
15380
+ },
15381
+ },
15382
+ },
15383
+ updating: {
15384
+ invoke: {
15385
+ src: 'updateUserInfo',
15386
+ onDone: {
15387
+ target: 'idle',
15388
+ // target: 'fetching', // 因為更新 userInfo 後 get self 還是拿到舊資料
15389
+ },
15390
+ onError: {
15391
+ target: 'idle',
15392
+ },
15393
+ },
15394
+ },
15395
+ },
15396
+ },
15397
+ {
15398
+ actions: {
15399
+ setUserInfo: assign((context, event) => {
15400
+ return {
15401
+ userInfo: event.data,
15402
+ }
15403
+ }),
15404
+ },
15405
+ services: {
15406
+ fetchUserInfo: async (context, event) => {
15407
+ return await request.send(user.getUserInfo())
15408
+ },
15409
+ updateUserInfo: async (context, event) => {
15410
+ return await request.send(user.updateUserInfo(event.data))
15411
+ },
15412
+ },
15413
+ }
15414
+ )
15415
+ }
15416
+
15417
+ const cookies = new Cookies();
15418
+
15419
+ function user_sign_up (request) {
14862
15420
  const { fpToken, sentry, defaultChannel, defaultSubchannel } = request.config;
14863
15421
  return createMachine(
14864
15422
  {
@@ -15215,6 +15773,7 @@ function bank_binding (request) {
15215
15773
  id: 'bank_binding',
15216
15774
  initial: 'fetching',
15217
15775
  context: {
15776
+ hasAnyAccount: false,
15218
15777
  bankList: [],
15219
15778
  bank: null,
15220
15779
  branch: null,
@@ -15288,8 +15847,10 @@ function bank_binding (request) {
15288
15847
  actions: {
15289
15848
  setBanks: assign((context, event) => {
15290
15849
  const { bankList = [], paymentInfo = {} } = event.data;
15850
+ const { bankInfo = [] } = paymentInfo;
15291
15851
  return {
15292
- holderName: paymentInfo.bankInfo[0]?.holderName,
15852
+ hasAnyAccount: bankInfo.length > 0,
15853
+ holderName: bankInfo[0]?.holderName,
15293
15854
  bankList,
15294
15855
  bank: bankList[0],
15295
15856
  }
@@ -15463,9 +16024,9 @@ function withdraw_fc (request) {
15463
16024
  return {
15464
16025
  crypto: method,
15465
16026
  networks:
15466
- method?.optional?.map?.((value, i) => {
16027
+ method?.networkName?.map?.((value, i) => {
15467
16028
  return {
15468
- label: method?.originalItem?.[i],
16029
+ label: method?.networkOptional?.[i],
15469
16030
  value,
15470
16031
  icon: value,
15471
16032
  }
@@ -16318,9 +16879,9 @@ function withdraw_crypto (request) {
16318
16879
  paymentDetail: event.data.paymentDetail,
16319
16880
  crypto: method,
16320
16881
  networks:
16321
- method?.optional?.map?.((value, i) => {
16882
+ method?.networkName?.map?.((value, i) => {
16322
16883
  return {
16323
- label: method?.originalItem?.[i],
16884
+ label: method?.networkOptional?.[i],
16324
16885
  value,
16325
16886
  icon: value,
16326
16887
  }
@@ -17607,9 +18168,9 @@ function deposit_fc (request) {
17607
18168
  const { cryptos, currentNetwork } = context;
17608
18169
  const method = cryptos.find((crypto) => crypto.method === event.data.value);
17609
18170
  const networks =
17610
- method?.optional.map((value, i) => {
18171
+ method?.networkName.map((value, i) => {
17611
18172
  return {
17612
- label: method?.originalItem?.[i],
18173
+ label: method?.networkOptional?.[i],
17613
18174
  value,
17614
18175
  icon: value,
17615
18176
  }
@@ -18182,9 +18743,9 @@ function crypto (request) {
18182
18743
  const currentPayment = cryptos.find((element) => element.category === context.currentCategory);
18183
18744
  const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart_1(String(i + 1), 2, '0')}`, icon: 'channel' }));
18184
18745
  const defaultNetworks =
18185
- cryptos[0].optional.map((value, i) => {
18746
+ cryptos[0].networkName.map((value, i) => {
18186
18747
  return {
18187
- label: cryptos[0].originalItem?.[i],
18748
+ label: cryptos[0].networkOptional?.[i],
18188
18749
  value,
18189
18750
  icon: value,
18190
18751
  }
@@ -18203,9 +18764,9 @@ function crypto (request) {
18203
18764
  const { cryptos } = context;
18204
18765
  const selectedCrypto = cryptos.find((crypto) => crypto.method === event.data.value);
18205
18766
  const networks =
18206
- selectedCrypto?.optional.map((value, i) => {
18767
+ selectedCrypto?.networkName.map((value, i) => {
18207
18768
  return {
18208
- label: selectedCrypto?.originalItem?.[i],
18769
+ label: selectedCrypto?.networkOptional?.[i],
18209
18770
  value,
18210
18771
  icon: value,
18211
18772
  }
@@ -18223,9 +18784,9 @@ function crypto (request) {
18223
18784
  const { cryptos, selectedNetwork } = context;
18224
18785
  const method = cryptos.find((crypto) => crypto.method === event.data.value);
18225
18786
  const networks =
18226
- method?.optional.map((value, i) => {
18787
+ method?.networkName.map((value, i) => {
18227
18788
  return {
18228
- label: method?.originalItem?.[i],
18789
+ label: method?.networkOptional?.[i],
18229
18790
  value,
18230
18791
  icon: value,
18231
18792
  }
@@ -18290,18 +18851,312 @@ function crypto (request) {
18290
18851
  },
18291
18852
  services: {
18292
18853
  fetchPayments: async (context, event) => {
18293
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
18854
+ return await request.send(payment$1.getPaymentDetail({ transferType: 'DEPOSIT' }))
18294
18855
  },
18295
18856
  fetchCalculation: async (context, event) => {
18296
18857
  const { selectedCrypto, amount } = context;
18297
18858
  return await request.send(
18298
- payment.getDepositExpectedResult({
18859
+ payment$1.getDepositExpectedResult({
18299
18860
  method: selectedCrypto.method,
18300
18861
  amount,
18301
18862
  cryptoCurrency: selectedCrypto.channel,
18302
18863
  })
18303
18864
  )
18304
18865
  },
18866
+ submitDeposit: async (context, event) => {
18867
+ const { selectedCrypto, selectedNetwork, calculation, sourceAddress } = context;
18868
+ return await request.send(
18869
+ payment$1.submitDepositTransaction({
18870
+ method: selectedCrypto.method,
18871
+ amount: calculation.actualAmount,
18872
+ cryptoCurrency: selectedCrypto.channel,
18873
+ cryptoNetwork: selectedNetwork.value,
18874
+ sourceAddress: sourceAddress,
18875
+ })
18876
+ )
18877
+ },
18878
+ },
18879
+ }
18880
+ )
18881
+ }
18882
+
18883
+ function crypto_button (request) {
18884
+ return createMachine(
18885
+ {
18886
+ id: 'crypro_button',
18887
+ initial: 'loading',
18888
+ context: {
18889
+ paymentDetails: [],
18890
+
18891
+ channels: [],
18892
+ cryptos: [],
18893
+ networks: [],
18894
+ options: [],
18895
+ sourceAddress: '',
18896
+
18897
+ selectedAmount: null,
18898
+ selectedCrypto: null,
18899
+ selectedNetwork: null,
18900
+
18901
+ currentCategory: 'crypto',
18902
+ currentPayment: null,
18903
+
18904
+ calculation: null,
18905
+ result: null,
18906
+ },
18907
+ states: {
18908
+ loading: {
18909
+ invoke: {
18910
+ src: 'fetchPayments',
18911
+ onDone: {
18912
+ target: 'loaded',
18913
+ actions: 'setCryptos',
18914
+ },
18915
+ onError: {
18916
+ target: 'fail',
18917
+ },
18918
+ },
18919
+ },
18920
+ loaded: {
18921
+ on: {
18922
+ SET_CHANNEL: {
18923
+ actions: 'setChannel',
18924
+ },
18925
+ SET_CRYPTO: {
18926
+ actions: 'setCrypto',
18927
+ },
18928
+ SET_NETWORK: {
18929
+ actions: 'setNetwork',
18930
+ },
18931
+ SET_ADDRESS: {
18932
+ actions: 'setAddress',
18933
+ },
18934
+ CONFIRM: {
18935
+ target: 'selecting',
18936
+ cond: 'isConfirmable'
18937
+ },
18938
+ },
18939
+ },
18940
+ fail: {},
18941
+ selecting: {
18942
+ entry: 'reset',
18943
+ on: {
18944
+ SELECT_AMOUNT: {
18945
+ target: 'debouncing',
18946
+ actions: 'addAmount'
18947
+ },
18948
+ KEY_IN: {
18949
+ target: 'debouncing',
18950
+ actions: 'setAmount'
18951
+ },
18952
+ BACK: {
18953
+ target: 'loaded'
18954
+ }
18955
+ }
18956
+ },
18957
+ debouncing: {
18958
+ on: {
18959
+ SELECT_AMOUNT: {
18960
+ target: 'debouncing',
18961
+ actions: 'addAmount',
18962
+ },
18963
+ KEY_IN: {
18964
+ target: 'debouncing',
18965
+ actions: 'setAmount',
18966
+ },
18967
+ },
18968
+ after: {
18969
+ 1000: {
18970
+ target: 'calculating',
18971
+ },
18972
+ },
18973
+ },
18974
+ calculating: {
18975
+ invoke: {
18976
+ src: 'fetchCalculation',
18977
+ onDone: {
18978
+ target: 'calculated',
18979
+ actions: 'setCalculation',
18980
+ },
18981
+ onError: {
18982
+ target: 'selecting',
18983
+ actions: 'reset'
18984
+ },
18985
+ },
18986
+ },
18987
+ calculated: {
18988
+ on: {
18989
+ SELECT_AMOUNT: {
18990
+ target: 'debouncing',
18991
+ actions: 'addAmount',
18992
+ },
18993
+ KEY_IN: {
18994
+ target: 'debouncing',
18995
+ actions: 'setAmount',
18996
+ },
18997
+ SUBMIT: {
18998
+ target: 'submitting',
18999
+ cond: 'isSubmittable'
19000
+ },
19001
+ CLEAR_CALCULATION: {
19002
+ target: 'debouncing',
19003
+ actions: 'clearCalculation',
19004
+ },
19005
+ CLEAR_ALL: {
19006
+ target: 'selecting',
19007
+ actions: 'reset',
19008
+ },
19009
+ },
19010
+ },
19011
+ submitting: {
19012
+ invoke: {
19013
+ src: 'submitDeposit',
19014
+ onDone: {
19015
+ target: 'submitted',
19016
+ actions: 'setResult',
19017
+ },
19018
+ onError: {
19019
+ target: 'calculated',
19020
+ },
19021
+ },
19022
+ },
19023
+ submitted: {
19024
+ },
19025
+ },
19026
+ },
19027
+ {
19028
+ actions: {
19029
+ reset: assign((context, event) => {
19030
+ return {
19031
+ selectedAmount: null,
19032
+ calculation: null,
19033
+ }
19034
+ }),
19035
+ setCryptos: assign((context, event) => {
19036
+ const cryptos = event.data?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || [];
19037
+ const currentPayment = cryptos.find((element) => element.category === context.currentCategory);
19038
+ const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart_1(String(i + 1), 2, '0')}`, icon: 'channel' }));
19039
+ const defaultNetworks =
19040
+ cryptos[0].networkName.map((value, i) => {
19041
+ return {
19042
+ label: cryptos[0].networkOptional?.[i],
19043
+ value,
19044
+ icon: value,
19045
+ }
19046
+ }) || [];
19047
+ const options = cryptos[0].optional;
19048
+ return {
19049
+ channels,
19050
+ cryptos,
19051
+ networks: defaultNetworks,
19052
+ selectedChannel: channels[0],
19053
+ selectedCrypto: cryptos[0],
19054
+ selectedNetwork: defaultNetworks[0],
19055
+ currentPayment,
19056
+ options
19057
+ }
19058
+ }),
19059
+ setChannel: assign((context, event) => {
19060
+ const { cryptos } = context;
19061
+ const selectedCrypto = cryptos.find((crypto) => crypto.method === event.data.value);
19062
+ const networks =
19063
+ selectedCrypto?.networkName.map((value, i) => {
19064
+ return {
19065
+ label: selectedCrypto?.networkOptional?.[i],
19066
+ value,
19067
+ icon: value,
19068
+ }
19069
+ }) || [];
19070
+ const options = selectedCrypto.optional;
19071
+ return {
19072
+ networks,
19073
+ selectedChannel: event.data,
19074
+ selectedCrypto: selectedCrypto,
19075
+ selectedNetwork: networks[0],
19076
+ selectedAmount: null,
19077
+ calculation: null,
19078
+ options
19079
+ }
19080
+ }),
19081
+ setCrypto: assign((context, event) => {
19082
+ const { cryptos, selectedNetwork } = context;
19083
+ const method = cryptos.find((crypto) => crypto.method === event.data.value);
19084
+ const networks =
19085
+ method?.networkName.map((value, i) => {
19086
+ return {
19087
+ label: method?.networkOptional?.[i],
19088
+ value,
19089
+ icon: value,
19090
+ }
19091
+ }) || [];
19092
+
19093
+ const properties = {
19094
+ selectedCrypto: event.data,
19095
+ networks,
19096
+ };
19097
+
19098
+ if (!networks.includes(selectedNetwork)) {
19099
+ properties.selectedNetwork = null;
19100
+ properties.selectedAmount = null;
19101
+ properties.calculation = null;
19102
+ }
19103
+
19104
+ return properties
19105
+ }),
19106
+ setNetwork: assign((context, event) => {
19107
+ return { selectedNetwork: event.data }
19108
+ }),
19109
+ addAmount: assign((context, event) => {
19110
+ return { selectedAmount: (context.selectedAmount || 0) + event.data }
19111
+ }),
19112
+ setAmount: assign((context, event) => {
19113
+ return { selectedAmount: event.data }
19114
+ }),
19115
+ setAddress: assign((context, event) => {
19116
+ return {
19117
+ sourceAddress: event.data,
19118
+ }
19119
+ }),
19120
+ setCalculation: assign((context, event) => {
19121
+ return {
19122
+ calculation: event.data,
19123
+ }
19124
+ }),
19125
+ clearCalculation: assign((context, event) => {
19126
+ return {
19127
+ calculation: null,
19128
+ }
19129
+ }),
19130
+ setResult: assign((context, event) => {
19131
+ return {
19132
+ result: event.data,
19133
+ }
19134
+ }),
19135
+ },
19136
+ guards: {
19137
+ isConfirmable: (context, event) => {
19138
+ const { selectedCrypto, selectedNetwork } = context;
19139
+ return selectedCrypto && selectedNetwork
19140
+ },
19141
+ isSubmittable: (context, event) => {
19142
+ const { selectedCrypto, selectedNetwork, selectedAmount } = context;
19143
+ return selectedCrypto && selectedNetwork && selectedAmount
19144
+ },
19145
+ },
19146
+ services: {
19147
+ fetchPayments: async (context, event) => {
19148
+ return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
19149
+ },
19150
+ fetchCalculation: async (context, event) => {
19151
+ const { selectedCrypto, selectedAmount } = context;
19152
+ return await request.send(
19153
+ payment.getDepositExpectedResult({
19154
+ method: selectedCrypto.method,
19155
+ amount: selectedAmount,
19156
+ cryptoCurrency: selectedCrypto.channel,
19157
+ })
19158
+ )
19159
+ },
18305
19160
  submitDeposit: async (context, event) => {
18306
19161
  const { selectedCrypto, selectedNetwork, calculation, sourceAddress } = context;
18307
19162
  return await request.send(
@@ -18338,13 +19193,13 @@ function direct (request) {
18338
19193
  },
18339
19194
  states: {
18340
19195
  loading: {
18341
- initial: 'step1',
19196
+ initial: 'init',
18342
19197
  states: {
18343
- step1: {
19198
+ init: {
18344
19199
  invoke: {
18345
19200
  src: 'fetchInitData',
18346
19201
  onDone: {
18347
- target: 'step2',
19202
+ target: 'fetching',
18348
19203
  actions: 'setInitData',
18349
19204
  },
18350
19205
  onError: {
@@ -18352,7 +19207,7 @@ function direct (request) {
18352
19207
  },
18353
19208
  },
18354
19209
  },
18355
- step2: {
19210
+ fetching: {
18356
19211
  invoke: {
18357
19212
  src: 'fetchBanksList',
18358
19213
  onDone: {
@@ -18370,6 +19225,7 @@ function direct (request) {
18370
19225
  on: {
18371
19226
  SELECT_DIRECT: {
18372
19227
  actions: ['setDirect', 'reset'],
19228
+ target: 'loading.fetching',
18373
19229
  },
18374
19230
  SELECT_BANK: {
18375
19231
  actions: 'setSelectedBank',
@@ -18498,8 +19354,8 @@ function direct (request) {
18498
19354
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
18499
19355
  },
18500
19356
  fetchBanksList: async (context, event) => {
18501
- const { paymentDetails } = context;
18502
- const method = paymentDetails.find((item) => item.category === 'manual')?.method;
19357
+ const { currentDirect } = context;
19358
+ const method = currentDirect.method;
18503
19359
  return await request.send(payment.getBankList(method))
18504
19360
  },
18505
19361
  fetchCalculation: async (context, event) => {
@@ -18527,7 +19383,7 @@ function direct (request) {
18527
19383
  )
18528
19384
  }
18529
19385
 
18530
- var deposit = { manual_vn, loadcard_vn, qrcode_vn, qrcode_v2, deposit_fc, crypto, direct };
19386
+ var deposit = { manual_vn, loadcard_vn, qrcode_vn, qrcode_v2, deposit_fc, crypto, crypto_button, direct };
18531
19387
 
18532
19388
  function bonus (request) {
18533
19389
  return createMachine(
@@ -19188,6 +20044,7 @@ var index$1 = {
19188
20044
  deposit,
19189
20045
  error,
19190
20046
  game,
20047
+ game_v2,
19191
20048
  game_favorite,
19192
20049
  game_search,
19193
20050
  game_hot_new,
@@ -19198,6 +20055,7 @@ var index$1 = {
19198
20055
  reward_fc,
19199
20056
  setting,
19200
20057
  side,
20058
+ side_v2,
19201
20059
  user_info,
19202
20060
  user_sign_up,
19203
20061
  user_reset_password,
@@ -19392,4 +20250,4 @@ class Config {
19392
20250
 
19393
20251
  var index = { getDeviceToken };
19394
20252
 
19395
- export { Config, Request, index$2 as api, index$1 as machine, index as util };
20253
+ export { Config, Request, index$2 as api, constant, index$1 as machine, index as util };