@jetthai/cuora 1.0.180 → 1.0.182
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/bundle.mjs +709 -898
- package/package.json +1 -1
- package/src/api/auth.js +15 -0
- package/src/index.js +2 -2
- package/src/machine/auth.js +36 -17
- package/src/machine/common.js +5 -6
- package/src/machine/user_sign_up.js +4 -5
- package/src/machine/welcome.js +3 -5
- package/src/request/request.js +5 -5
- package/src/util/index.js +3 -1
- package/src/util/storage.js +37 -0
- package/src/request/cookie.js +0 -52
package/dist/bundle.mjs
CHANGED
|
@@ -345,77 +345,77 @@ var form = {
|
|
|
345
345
|
|
|
346
346
|
var index$2 = { activity: activity$2, auth: auth$1, common: common$1, game: game$1, mailbox, payment, user, form };
|
|
347
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$
|
|
364
|
-
__assign$
|
|
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$
|
|
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;
|
|
348
|
+
/*! *****************************************************************************
|
|
349
|
+
Copyright (c) Microsoft Corporation.
|
|
350
|
+
|
|
351
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
352
|
+
purpose with or without fee is hereby granted.
|
|
353
|
+
|
|
354
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
355
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
356
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
357
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
358
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
359
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
360
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
361
|
+
***************************************************************************** */
|
|
362
|
+
|
|
363
|
+
var __assign$1 = function() {
|
|
364
|
+
__assign$1 = Object.assign || function __assign(t) {
|
|
365
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
366
|
+
s = arguments[i];
|
|
367
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
368
|
+
}
|
|
369
|
+
return t;
|
|
370
|
+
};
|
|
371
|
+
return __assign$1.apply(this, arguments);
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
function __rest$1(s, e) {
|
|
375
|
+
var t = {};
|
|
376
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
377
|
+
t[p] = s[p];
|
|
378
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
379
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
380
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
381
|
+
t[p[i]] = s[p[i]];
|
|
382
|
+
}
|
|
383
|
+
return t;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function __values(o) {
|
|
387
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
388
|
+
if (m) return m.call(o);
|
|
389
|
+
if (o && typeof o.length === "number") return {
|
|
390
|
+
next: function () {
|
|
391
|
+
if (o && i >= o.length) o = void 0;
|
|
392
|
+
return { value: o && o[i++], done: !o };
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
function __read(o, n) {
|
|
399
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
400
|
+
if (!m) return o;
|
|
401
|
+
var i = m.call(o), r, ar = [], e;
|
|
402
|
+
try {
|
|
403
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
404
|
+
}
|
|
405
|
+
catch (error) { e = { error: error }; }
|
|
406
|
+
finally {
|
|
407
|
+
try {
|
|
408
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
409
|
+
}
|
|
410
|
+
finally { if (e) throw e.error; }
|
|
411
|
+
}
|
|
412
|
+
return ar;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function __spreadArray(to, from) {
|
|
416
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
417
|
+
to[j] = from[i];
|
|
418
|
+
return to;
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
var STATE_DELIMITER = '.';
|
|
@@ -552,9 +552,9 @@ function mapFilterValues(collection, iteratee, predicate) {
|
|
|
552
552
|
|
|
553
553
|
return result;
|
|
554
554
|
}
|
|
555
|
-
/**
|
|
556
|
-
* Retrieves a value at the given path.
|
|
557
|
-
* @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
|
|
558
558
|
*/
|
|
559
559
|
|
|
560
560
|
var path = function (props) {
|
|
@@ -583,9 +583,9 @@ var path = function (props) {
|
|
|
583
583
|
return result;
|
|
584
584
|
};
|
|
585
585
|
};
|
|
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
|
|
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
|
|
589
589
|
*/
|
|
590
590
|
|
|
591
591
|
function nestedPath(props, accessorProp) {
|
|
@@ -842,7 +842,7 @@ function isMachine(value) {
|
|
|
842
842
|
function toEventObject(event, payload // id?: TEvent['type']
|
|
843
843
|
) {
|
|
844
844
|
if (isString(event) || typeof event === 'number') {
|
|
845
|
-
return __assign$
|
|
845
|
+
return __assign$1({
|
|
846
846
|
type: event
|
|
847
847
|
}, payload);
|
|
848
848
|
}
|
|
@@ -855,7 +855,7 @@ function toSCXMLEvent(event, scxmlEvent) {
|
|
|
855
855
|
}
|
|
856
856
|
|
|
857
857
|
var eventObject = toEventObject(event);
|
|
858
|
-
return __assign$
|
|
858
|
+
return __assign$1({
|
|
859
859
|
name: eventObject.type,
|
|
860
860
|
data: eventObject,
|
|
861
861
|
$$type: 'scxml',
|
|
@@ -871,7 +871,7 @@ function toTransitionConfigArray(event, configLike) {
|
|
|
871
871
|
};
|
|
872
872
|
}
|
|
873
873
|
|
|
874
|
-
return __assign$
|
|
874
|
+
return __assign$1(__assign$1({}, transitionLike), {
|
|
875
875
|
event: event
|
|
876
876
|
});
|
|
877
877
|
});
|
|
@@ -1000,12 +1000,12 @@ function toActionObject(action, actionFunctionMap) {
|
|
|
1000
1000
|
var exec = getActionFunction(action.type, actionFunctionMap);
|
|
1001
1001
|
|
|
1002
1002
|
if (isFunction$3(exec)) {
|
|
1003
|
-
actionObject = __assign$
|
|
1003
|
+
actionObject = __assign$1(__assign$1({}, action), {
|
|
1004
1004
|
exec: exec
|
|
1005
1005
|
});
|
|
1006
1006
|
} else if (exec) {
|
|
1007
1007
|
var actionType = exec.type || action.type;
|
|
1008
|
-
actionObject = __assign$
|
|
1008
|
+
actionObject = __assign$1(__assign$1(__assign$1({}, exec), action), {
|
|
1009
1009
|
type: actionType
|
|
1010
1010
|
});
|
|
1011
1011
|
} else {
|
|
@@ -1027,17 +1027,17 @@ var toActionObjects = function (action, actionFunctionMap) {
|
|
|
1027
1027
|
};
|
|
1028
1028
|
function toActivityDefinition(action) {
|
|
1029
1029
|
var actionObject = toActionObject(action);
|
|
1030
|
-
return __assign$
|
|
1030
|
+
return __assign$1(__assign$1({
|
|
1031
1031
|
id: isString(action) ? action : actionObject.id
|
|
1032
1032
|
}, actionObject), {
|
|
1033
1033
|
type: actionObject.type
|
|
1034
1034
|
});
|
|
1035
1035
|
}
|
|
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.
|
|
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.
|
|
1041
1041
|
*/
|
|
1042
1042
|
|
|
1043
1043
|
function raise(event) {
|
|
@@ -1058,15 +1058,15 @@ function resolveRaise(action) {
|
|
|
1058
1058
|
_event: toSCXMLEvent(action.event)
|
|
1059
1059
|
};
|
|
1060
1060
|
}
|
|
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).
|
|
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).
|
|
1070
1070
|
*/
|
|
1071
1071
|
|
|
1072
1072
|
function send(event, options) {
|
|
@@ -1094,7 +1094,7 @@ function resolveSend(action, ctx, _event, delaysMap) {
|
|
|
1094
1094
|
}
|
|
1095
1095
|
|
|
1096
1096
|
var resolvedTarget = isFunction$3(action.to) ? action.to(ctx, _event.data, meta) : action.to;
|
|
1097
|
-
return __assign$
|
|
1097
|
+
return __assign$1(__assign$1({}, action), {
|
|
1098
1098
|
to: resolvedTarget,
|
|
1099
1099
|
_event: resolvedEvent,
|
|
1100
1100
|
event: resolvedEvent.data,
|
|
@@ -1102,18 +1102,18 @@ function resolveSend(action, ctx, _event, delaysMap) {
|
|
|
1102
1102
|
});
|
|
1103
1103
|
}
|
|
1104
1104
|
var resolveLog = function (action, ctx, _event) {
|
|
1105
|
-
return __assign$
|
|
1105
|
+
return __assign$1(__assign$1({}, action), {
|
|
1106
1106
|
value: isString(action.expr) ? action.expr : action.expr(ctx, _event.data, {
|
|
1107
1107
|
_event: _event
|
|
1108
1108
|
})
|
|
1109
1109
|
});
|
|
1110
1110
|
};
|
|
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.
|
|
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.
|
|
1117
1117
|
*/
|
|
1118
1118
|
|
|
1119
1119
|
var cancel = function (sendId) {
|
|
@@ -1122,10 +1122,10 @@ var cancel = function (sendId) {
|
|
|
1122
1122
|
sendId: sendId
|
|
1123
1123
|
};
|
|
1124
1124
|
};
|
|
1125
|
-
/**
|
|
1126
|
-
* Starts an activity.
|
|
1127
|
-
*
|
|
1128
|
-
* @param activity The activity to start.
|
|
1125
|
+
/**
|
|
1126
|
+
* Starts an activity.
|
|
1127
|
+
*
|
|
1128
|
+
* @param activity The activity to start.
|
|
1129
1129
|
*/
|
|
1130
1130
|
|
|
1131
1131
|
function start(activity) {
|
|
@@ -1136,10 +1136,10 @@ function start(activity) {
|
|
|
1136
1136
|
exec: undefined
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
|
-
/**
|
|
1140
|
-
* Stops an activity.
|
|
1141
|
-
*
|
|
1142
|
-
* @param actorRef The activity to stop.
|
|
1139
|
+
/**
|
|
1140
|
+
* Stops an activity.
|
|
1141
|
+
*
|
|
1142
|
+
* @param actorRef The activity to stop.
|
|
1143
1143
|
*/
|
|
1144
1144
|
|
|
1145
1145
|
function stop(actorRef) {
|
|
@@ -1161,10 +1161,10 @@ function resolveStop(action, context, _event) {
|
|
|
1161
1161
|
};
|
|
1162
1162
|
return actionObject;
|
|
1163
1163
|
}
|
|
1164
|
-
/**
|
|
1165
|
-
* Updates the current context of the machine.
|
|
1166
|
-
*
|
|
1167
|
-
* @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.
|
|
1168
1168
|
*/
|
|
1169
1169
|
|
|
1170
1170
|
var assign = function (assignment) {
|
|
@@ -1173,24 +1173,24 @@ var assign = function (assignment) {
|
|
|
1173
1173
|
assignment: assignment
|
|
1174
1174
|
};
|
|
1175
1175
|
};
|
|
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
|
|
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
|
|
1182
1182
|
*/
|
|
1183
1183
|
|
|
1184
1184
|
function after(delayRef, id) {
|
|
1185
1185
|
var idSuffix = id ? "#" + id : '';
|
|
1186
1186
|
return ActionTypes.After + "(" + delayRef + ")" + idSuffix;
|
|
1187
1187
|
}
|
|
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
|
|
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
|
|
1194
1194
|
*/
|
|
1195
1195
|
|
|
1196
1196
|
function done(id, data) {
|
|
@@ -1206,14 +1206,14 @@ function done(id, data) {
|
|
|
1206
1206
|
|
|
1207
1207
|
return eventObject;
|
|
1208
1208
|
}
|
|
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
|
|
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
|
|
1217
1217
|
*/
|
|
1218
1218
|
|
|
1219
1219
|
function doneInvoke(id, data) {
|
|
@@ -1326,7 +1326,7 @@ function resolveActions(machine, currentState, currentContext, _event, actions,
|
|
|
1326
1326
|
|
|
1327
1327
|
if (exec_1 && preservedContexts) {
|
|
1328
1328
|
var contextIndex_1 = preservedContexts.length - 1;
|
|
1329
|
-
resolvedActionObject = __assign$
|
|
1329
|
+
resolvedActionObject = __assign$1(__assign$1({}, resolvedActionObject), {
|
|
1330
1330
|
exec: function (_ctx) {
|
|
1331
1331
|
var args = [];
|
|
1332
1332
|
|
|
@@ -1624,17 +1624,17 @@ var State =
|
|
|
1624
1624
|
|
|
1625
1625
|
/** @class */
|
|
1626
1626
|
function () {
|
|
1627
|
-
/**
|
|
1628
|
-
* Creates a new State instance.
|
|
1629
|
-
* @param value The state value
|
|
1630
|
-
* @param context The extended state
|
|
1631
|
-
* @param historyValue The tree representing historical values of the state nodes
|
|
1632
|
-
* @param history The previous state
|
|
1633
|
-
* @param actions An array of action objects to execute as side-effects
|
|
1634
|
-
* @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).
|
|
1635
|
-
* @param meta
|
|
1636
|
-
* @param events Internal event queue. Should be empty with run-to-completion semantics.
|
|
1637
|
-
* @param configuration
|
|
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
|
|
1638
1638
|
*/
|
|
1639
1639
|
function State(config) {
|
|
1640
1640
|
var _this = this;
|
|
@@ -1670,10 +1670,10 @@ function () {
|
|
|
1670
1670
|
}
|
|
1671
1671
|
});
|
|
1672
1672
|
}
|
|
1673
|
-
/**
|
|
1674
|
-
* Creates a new State instance for the given `stateValue` and `context`.
|
|
1675
|
-
* @param stateValue
|
|
1676
|
-
* @param context
|
|
1673
|
+
/**
|
|
1674
|
+
* Creates a new State instance for the given `stateValue` and `context`.
|
|
1675
|
+
* @param stateValue
|
|
1676
|
+
* @param context
|
|
1677
1677
|
*/
|
|
1678
1678
|
|
|
1679
1679
|
|
|
@@ -1717,19 +1717,19 @@ function () {
|
|
|
1717
1717
|
children: {}
|
|
1718
1718
|
});
|
|
1719
1719
|
};
|
|
1720
|
-
/**
|
|
1721
|
-
* Creates a new State instance for the given `config`.
|
|
1722
|
-
* @param config The state config
|
|
1720
|
+
/**
|
|
1721
|
+
* Creates a new State instance for the given `config`.
|
|
1722
|
+
* @param config The state config
|
|
1723
1723
|
*/
|
|
1724
1724
|
|
|
1725
1725
|
|
|
1726
1726
|
State.create = function (config) {
|
|
1727
1727
|
return new State(config);
|
|
1728
1728
|
};
|
|
1729
|
-
/**
|
|
1730
|
-
* Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).
|
|
1731
|
-
* @param stateValue
|
|
1732
|
-
* @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
|
|
1733
1733
|
*/
|
|
1734
1734
|
|
|
1735
1735
|
|
|
@@ -1756,10 +1756,10 @@ function () {
|
|
|
1756
1756
|
|
|
1757
1757
|
return State.from(stateValue, context);
|
|
1758
1758
|
};
|
|
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.
|
|
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.
|
|
1763
1763
|
*/
|
|
1764
1764
|
|
|
1765
1765
|
|
|
@@ -1794,32 +1794,32 @@ function () {
|
|
|
1794
1794
|
_a.machine;
|
|
1795
1795
|
var jsonValues = __rest$1(_a, ["configuration", "transitions", "tags", "machine"]);
|
|
1796
1796
|
|
|
1797
|
-
return __assign$
|
|
1797
|
+
return __assign$1(__assign$1({}, jsonValues), {
|
|
1798
1798
|
tags: Array.from(tags)
|
|
1799
1799
|
});
|
|
1800
1800
|
};
|
|
1801
|
-
/**
|
|
1802
|
-
* Whether the current state value is a subset of the given parent state value.
|
|
1803
|
-
* @param parentStateValue
|
|
1801
|
+
/**
|
|
1802
|
+
* Whether the current state value is a subset of the given parent state value.
|
|
1803
|
+
* @param parentStateValue
|
|
1804
1804
|
*/
|
|
1805
1805
|
|
|
1806
1806
|
|
|
1807
1807
|
State.prototype.matches = function (parentStateValue) {
|
|
1808
1808
|
return matchesState(parentStateValue, this.value);
|
|
1809
1809
|
};
|
|
1810
|
-
/**
|
|
1811
|
-
* Whether the current state configuration has a state node with the specified `tag`.
|
|
1812
|
-
* @param tag
|
|
1810
|
+
/**
|
|
1811
|
+
* Whether the current state configuration has a state node with the specified `tag`.
|
|
1812
|
+
* @param tag
|
|
1813
1813
|
*/
|
|
1814
1814
|
|
|
1815
1815
|
|
|
1816
1816
|
State.prototype.hasTag = function (tag) {
|
|
1817
1817
|
return this.tags.has(tag);
|
|
1818
1818
|
};
|
|
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
|
|
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
|
|
1823
1823
|
*/
|
|
1824
1824
|
|
|
1825
1825
|
|
|
@@ -1836,9 +1836,9 @@ function () {
|
|
|
1836
1836
|
return State;
|
|
1837
1837
|
}();
|
|
1838
1838
|
|
|
1839
|
-
/**
|
|
1840
|
-
* Maintains a stack of the current service in scope.
|
|
1841
|
-
* 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().
|
|
1842
1842
|
*/
|
|
1843
1843
|
var provide = function (service, fn) {
|
|
1844
1844
|
var result = fn(service);
|
|
@@ -1868,11 +1868,11 @@ function createNullActor(id) {
|
|
|
1868
1868
|
}
|
|
1869
1869
|
};
|
|
1870
1870
|
}
|
|
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.
|
|
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.
|
|
1876
1876
|
*/
|
|
1877
1877
|
|
|
1878
1878
|
function createInvocableActor(invokeDefinition, machine, context, _event) {
|
|
@@ -1922,7 +1922,7 @@ function toInvokeSource(src) {
|
|
|
1922
1922
|
return src;
|
|
1923
1923
|
}
|
|
1924
1924
|
function toInvokeDefinition(invokeConfig) {
|
|
1925
|
-
return __assign$
|
|
1925
|
+
return __assign$1(__assign$1({
|
|
1926
1926
|
type: invoke
|
|
1927
1927
|
}, invokeConfig), {
|
|
1928
1928
|
toJSON: function () {
|
|
@@ -1930,7 +1930,7 @@ function toInvokeDefinition(invokeConfig) {
|
|
|
1930
1930
|
invokeConfig.onError;
|
|
1931
1931
|
var invokeDef = __rest$1(invokeConfig, ["onDone", "onError"]);
|
|
1932
1932
|
|
|
1933
|
-
return __assign$
|
|
1933
|
+
return __assign$1(__assign$1({}, invokeDef), {
|
|
1934
1934
|
type: invoke,
|
|
1935
1935
|
src: toInvokeSource(invokeConfig.src)
|
|
1936
1936
|
});
|
|
@@ -1963,12 +1963,12 @@ var StateNode =
|
|
|
1963
1963
|
/** @class */
|
|
1964
1964
|
function () {
|
|
1965
1965
|
function StateNode(
|
|
1966
|
-
/**
|
|
1967
|
-
* The raw config used to create the machine.
|
|
1966
|
+
/**
|
|
1967
|
+
* The raw config used to create the machine.
|
|
1968
1968
|
*/
|
|
1969
1969
|
config, options,
|
|
1970
|
-
/**
|
|
1971
|
-
* The initial extended state
|
|
1970
|
+
/**
|
|
1971
|
+
* The initial extended state
|
|
1972
1972
|
*/
|
|
1973
1973
|
_context // TODO: this is unsafe, but we're removing it in v5 anyway
|
|
1974
1974
|
) {
|
|
@@ -1982,8 +1982,8 @@ function () {
|
|
|
1982
1982
|
|
|
1983
1983
|
this.config = config;
|
|
1984
1984
|
this._context = _context;
|
|
1985
|
-
/**
|
|
1986
|
-
* 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.
|
|
1987
1987
|
*/
|
|
1988
1988
|
|
|
1989
1989
|
this.order = -1;
|
|
@@ -2019,7 +2019,7 @@ function () {
|
|
|
2019
2019
|
_parent: _this,
|
|
2020
2020
|
_key: key
|
|
2021
2021
|
});
|
|
2022
|
-
Object.assign(_this.idMap, __assign$
|
|
2022
|
+
Object.assign(_this.idMap, __assign$1((_a = {}, _a[stateNode.id] = stateNode, _a), stateNode.idMap));
|
|
2023
2023
|
return stateNode;
|
|
2024
2024
|
}) : EMPTY_OBJECT; // Document order
|
|
2025
2025
|
|
|
@@ -2070,28 +2070,28 @@ function () {
|
|
|
2070
2070
|
var _a, _b;
|
|
2071
2071
|
|
|
2072
2072
|
if (isMachine(invokeConfig)) {
|
|
2073
|
-
_this.machine.options.services = __assign$
|
|
2073
|
+
_this.machine.options.services = __assign$1((_a = {}, _a[invokeConfig.id] = invokeConfig, _a), _this.machine.options.services);
|
|
2074
2074
|
return toInvokeDefinition({
|
|
2075
2075
|
src: invokeConfig.id,
|
|
2076
2076
|
id: invokeConfig.id
|
|
2077
2077
|
});
|
|
2078
2078
|
} else if (isString(invokeConfig.src)) {
|
|
2079
|
-
return toInvokeDefinition(__assign$
|
|
2079
|
+
return toInvokeDefinition(__assign$1(__assign$1({}, invokeConfig), {
|
|
2080
2080
|
id: invokeConfig.id || invokeConfig.src,
|
|
2081
2081
|
src: invokeConfig.src
|
|
2082
2082
|
}));
|
|
2083
2083
|
} else if (isMachine(invokeConfig.src) || isFunction$3(invokeConfig.src)) {
|
|
2084
2084
|
var invokeSrc = _this.id + ":invocation[" + i + "]"; // TODO: util function
|
|
2085
2085
|
|
|
2086
|
-
_this.machine.options.services = __assign$
|
|
2087
|
-
return toInvokeDefinition(__assign$
|
|
2086
|
+
_this.machine.options.services = __assign$1((_b = {}, _b[invokeSrc] = invokeConfig.src, _b), _this.machine.options.services);
|
|
2087
|
+
return toInvokeDefinition(__assign$1(__assign$1({
|
|
2088
2088
|
id: invokeSrc
|
|
2089
2089
|
}, invokeConfig), {
|
|
2090
2090
|
src: invokeSrc
|
|
2091
2091
|
}));
|
|
2092
2092
|
} else {
|
|
2093
2093
|
var invokeSource = invokeConfig.src;
|
|
2094
|
-
return toInvokeDefinition(__assign$
|
|
2094
|
+
return toInvokeDefinition(__assign$1(__assign$1({
|
|
2095
2095
|
id: invokeSource.type
|
|
2096
2096
|
}, invokeConfig), {
|
|
2097
2097
|
src: invokeSource
|
|
@@ -2118,11 +2118,11 @@ function () {
|
|
|
2118
2118
|
return stateNode.on;
|
|
2119
2119
|
});
|
|
2120
2120
|
};
|
|
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)
|
|
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)
|
|
2126
2126
|
*/
|
|
2127
2127
|
|
|
2128
2128
|
|
|
@@ -2134,17 +2134,17 @@ function () {
|
|
|
2134
2134
|
services = _a.services,
|
|
2135
2135
|
delays = _a.delays;
|
|
2136
2136
|
return new StateNode(this.config, {
|
|
2137
|
-
actions: __assign$
|
|
2138
|
-
activities: __assign$
|
|
2139
|
-
guards: __assign$
|
|
2140
|
-
services: __assign$
|
|
2141
|
-
delays: __assign$
|
|
2137
|
+
actions: __assign$1(__assign$1({}, actions), options.actions),
|
|
2138
|
+
activities: __assign$1(__assign$1({}, activities), options.activities),
|
|
2139
|
+
guards: __assign$1(__assign$1({}, guards), options.guards),
|
|
2140
|
+
services: __assign$1(__assign$1({}, services), options.services),
|
|
2141
|
+
delays: __assign$1(__assign$1({}, delays), options.delays)
|
|
2142
2142
|
}, context !== null && context !== void 0 ? context : this.context);
|
|
2143
2143
|
};
|
|
2144
|
-
/**
|
|
2145
|
-
* Clones this state machine with custom context.
|
|
2146
|
-
*
|
|
2147
|
-
* @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)
|
|
2148
2148
|
*/
|
|
2149
2149
|
|
|
2150
2150
|
|
|
@@ -2160,8 +2160,8 @@ function () {
|
|
|
2160
2160
|
configurable: true
|
|
2161
2161
|
});
|
|
2162
2162
|
Object.defineProperty(StateNode.prototype, "definition", {
|
|
2163
|
-
/**
|
|
2164
|
-
* The well-structured state node definition.
|
|
2163
|
+
/**
|
|
2164
|
+
* The well-structured state node definition.
|
|
2165
2165
|
*/
|
|
2166
2166
|
get: function () {
|
|
2167
2167
|
return {
|
|
@@ -2195,8 +2195,8 @@ function () {
|
|
|
2195
2195
|
};
|
|
2196
2196
|
|
|
2197
2197
|
Object.defineProperty(StateNode.prototype, "on", {
|
|
2198
|
-
/**
|
|
2199
|
-
* The mapping of events to transitions.
|
|
2198
|
+
/**
|
|
2199
|
+
* The mapping of events to transitions.
|
|
2200
2200
|
*/
|
|
2201
2201
|
get: function () {
|
|
2202
2202
|
if (this.__cache.on) {
|
|
@@ -2221,8 +2221,8 @@ function () {
|
|
|
2221
2221
|
configurable: true
|
|
2222
2222
|
});
|
|
2223
2223
|
Object.defineProperty(StateNode.prototype, "transitions", {
|
|
2224
|
-
/**
|
|
2225
|
-
* All the transitions that can be taken from this state node.
|
|
2224
|
+
/**
|
|
2225
|
+
* All the transitions that can be taken from this state node.
|
|
2226
2226
|
*/
|
|
2227
2227
|
get: function () {
|
|
2228
2228
|
return this.__cache.transitions || (this.__cache.transitions = this.formatTransitions(), this.__cache.transitions);
|
|
@@ -2245,8 +2245,8 @@ function () {
|
|
|
2245
2245
|
this.__cache.candidates[eventName] = candidates;
|
|
2246
2246
|
return candidates;
|
|
2247
2247
|
};
|
|
2248
|
-
/**
|
|
2249
|
-
* All delayed transitions from the config.
|
|
2248
|
+
/**
|
|
2249
|
+
* All delayed transitions from the config.
|
|
2250
2250
|
*/
|
|
2251
2251
|
|
|
2252
2252
|
|
|
@@ -2274,7 +2274,7 @@ function () {
|
|
|
2274
2274
|
|
|
2275
2275
|
var delayedTransitions = isArray$9(afterConfig) ? afterConfig.map(function (transition, i) {
|
|
2276
2276
|
var eventType = mutateEntryExit(transition.delay, i);
|
|
2277
|
-
return __assign$
|
|
2277
|
+
return __assign$1(__assign$1({}, transition), {
|
|
2278
2278
|
event: eventType
|
|
2279
2279
|
});
|
|
2280
2280
|
}) : flatten(keys$3(afterConfig).map(function (delay, i) {
|
|
@@ -2285,7 +2285,7 @@ function () {
|
|
|
2285
2285
|
var resolvedDelay = !isNaN(+delay) ? +delay : delay;
|
|
2286
2286
|
var eventType = mutateEntryExit(resolvedDelay, i);
|
|
2287
2287
|
return toArray(resolvedTransition).map(function (transition) {
|
|
2288
|
-
return __assign$
|
|
2288
|
+
return __assign$1(__assign$1({}, transition), {
|
|
2289
2289
|
event: eventType,
|
|
2290
2290
|
delay: resolvedDelay
|
|
2291
2291
|
});
|
|
@@ -2293,15 +2293,15 @@ function () {
|
|
|
2293
2293
|
}));
|
|
2294
2294
|
return delayedTransitions.map(function (delayedTransition) {
|
|
2295
2295
|
var delay = delayedTransition.delay;
|
|
2296
|
-
return __assign$
|
|
2296
|
+
return __assign$1(__assign$1({}, _this.formatTransition(delayedTransition)), {
|
|
2297
2297
|
delay: delay
|
|
2298
2298
|
});
|
|
2299
2299
|
});
|
|
2300
2300
|
};
|
|
2301
|
-
/**
|
|
2302
|
-
* Returns the state nodes represented by the current state value.
|
|
2303
|
-
*
|
|
2304
|
-
* @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
|
|
2305
2305
|
*/
|
|
2306
2306
|
|
|
2307
2307
|
|
|
@@ -2332,10 +2332,10 @@ function () {
|
|
|
2332
2332
|
return allSubStateNodes.concat(subStateNode);
|
|
2333
2333
|
}, []));
|
|
2334
2334
|
};
|
|
2335
|
-
/**
|
|
2336
|
-
* Returns `true` if this state node explicitly handles the given event.
|
|
2337
|
-
*
|
|
2338
|
-
* @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
|
|
2339
2339
|
*/
|
|
2340
2340
|
|
|
2341
2341
|
|
|
@@ -2343,18 +2343,18 @@ function () {
|
|
|
2343
2343
|
var eventType = getEventType(event);
|
|
2344
2344
|
return this.events.includes(eventType);
|
|
2345
2345
|
};
|
|
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
|
|
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
|
|
2352
2352
|
*/
|
|
2353
2353
|
|
|
2354
2354
|
|
|
2355
2355
|
StateNode.prototype.resolveState = function (state) {
|
|
2356
2356
|
var configuration = Array.from(getConfiguration([], this.getStateNodes(state.value)));
|
|
2357
|
-
return new State(__assign$
|
|
2357
|
+
return new State(__assign$1(__assign$1({}, state), {
|
|
2358
2358
|
value: this.resolve(state.value),
|
|
2359
2359
|
configuration: configuration,
|
|
2360
2360
|
done: isInFinalState(configuration, this)
|
|
@@ -2566,9 +2566,9 @@ function () {
|
|
|
2566
2566
|
|
|
2567
2567
|
return nodes;
|
|
2568
2568
|
};
|
|
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.
|
|
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.
|
|
2572
2572
|
*/
|
|
2573
2573
|
|
|
2574
2574
|
|
|
@@ -2693,12 +2693,12 @@ function () {
|
|
|
2693
2693
|
var actions = toActionObjects(exitActions.concat(transition.actions).concat(entryActions), this.machine.options.actions);
|
|
2694
2694
|
return actions;
|
|
2695
2695
|
};
|
|
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
|
|
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
|
|
2702
2702
|
*/
|
|
2703
2703
|
|
|
2704
2704
|
|
|
@@ -2776,7 +2776,7 @@ function () {
|
|
|
2776
2776
|
var historyValue = currentState ? currentState.historyValue ? currentState.historyValue : stateTransition.source ? this.machine.historyValue(currentState.value) : undefined : undefined;
|
|
2777
2777
|
var currentContext = currentState ? currentState.context : context;
|
|
2778
2778
|
var actions = this.getActions(stateTransition, currentContext, _event, currentState);
|
|
2779
|
-
var activities = currentState ? __assign$
|
|
2779
|
+
var activities = currentState ? __assign$1({}, currentState.activities) : {};
|
|
2780
2780
|
|
|
2781
2781
|
try {
|
|
2782
2782
|
for (var actions_1 = __values(actions), actions_1_1 = actions_1.next(); !actions_1_1.done; actions_1_1 = actions_1.next()) {
|
|
@@ -2818,7 +2818,7 @@ function () {
|
|
|
2818
2818
|
var children = invokeActions.reduce(function (acc, action) {
|
|
2819
2819
|
acc[action.activity.id] = createInvocableActor(action.activity, _this.machine, updatedContext, _event);
|
|
2820
2820
|
return acc;
|
|
2821
|
-
}, currentState ? __assign$
|
|
2821
|
+
}, currentState ? __assign$1({}, currentState.children) : {});
|
|
2822
2822
|
var resolvedConfiguration = resolvedStateValue ? stateTransition.configuration : currentState ? currentState.configuration : [];
|
|
2823
2823
|
var isDone = isInFinalState(resolvedConfiguration, this);
|
|
2824
2824
|
var nextState = new State({
|
|
@@ -2891,8 +2891,8 @@ function () {
|
|
|
2891
2891
|
})));
|
|
2892
2892
|
return maybeNextState;
|
|
2893
2893
|
};
|
|
2894
|
-
/**
|
|
2895
|
-
* Returns the child state node from its relative `stateKey`, or throws.
|
|
2894
|
+
/**
|
|
2895
|
+
* Returns the child state node from its relative `stateKey`, or throws.
|
|
2896
2896
|
*/
|
|
2897
2897
|
|
|
2898
2898
|
|
|
@@ -2913,10 +2913,10 @@ function () {
|
|
|
2913
2913
|
|
|
2914
2914
|
return result;
|
|
2915
2915
|
};
|
|
2916
|
-
/**
|
|
2917
|
-
* Returns the state node with the given `stateId`, or throws.
|
|
2918
|
-
*
|
|
2919
|
-
* @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.
|
|
2920
2920
|
*/
|
|
2921
2921
|
|
|
2922
2922
|
|
|
@@ -2935,10 +2935,10 @@ function () {
|
|
|
2935
2935
|
|
|
2936
2936
|
return stateNode;
|
|
2937
2937
|
};
|
|
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.
|
|
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.
|
|
2942
2942
|
*/
|
|
2943
2943
|
|
|
2944
2944
|
|
|
@@ -2966,10 +2966,10 @@ function () {
|
|
|
2966
2966
|
|
|
2967
2967
|
return currentStateNode;
|
|
2968
2968
|
};
|
|
2969
|
-
/**
|
|
2970
|
-
* Resolves a partial state value with its full representation in this machine.
|
|
2971
|
-
*
|
|
2972
|
-
* @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.
|
|
2973
2973
|
*/
|
|
2974
2974
|
|
|
2975
2975
|
|
|
@@ -3073,9 +3073,9 @@ function () {
|
|
|
3073
3073
|
};
|
|
3074
3074
|
|
|
3075
3075
|
Object.defineProperty(StateNode.prototype, "initialState", {
|
|
3076
|
-
/**
|
|
3077
|
-
* The initial State instance, which includes all actions to be executed from
|
|
3078
|
-
* entering the initial state.
|
|
3076
|
+
/**
|
|
3077
|
+
* The initial State instance, which includes all actions to be executed from
|
|
3078
|
+
* entering the initial state.
|
|
3079
3079
|
*/
|
|
3080
3080
|
get: function () {
|
|
3081
3081
|
this._init(); // TODO: this should be in the constructor (see note in constructor)
|
|
@@ -3093,9 +3093,9 @@ function () {
|
|
|
3093
3093
|
configurable: true
|
|
3094
3094
|
});
|
|
3095
3095
|
Object.defineProperty(StateNode.prototype, "target", {
|
|
3096
|
-
/**
|
|
3097
|
-
* The target state value of the history state node, if it exists. This represents the
|
|
3098
|
-
* default state value to transition to if no history value exists yet.
|
|
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.
|
|
3099
3099
|
*/
|
|
3100
3100
|
get: function () {
|
|
3101
3101
|
var target;
|
|
@@ -3115,12 +3115,12 @@ function () {
|
|
|
3115
3115
|
enumerable: false,
|
|
3116
3116
|
configurable: true
|
|
3117
3117
|
});
|
|
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
|
|
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
|
|
3124
3124
|
*/
|
|
3125
3125
|
|
|
3126
3126
|
StateNode.prototype.getRelativeStateNodes = function (relativeStateId, historyValue, resolve) {
|
|
@@ -3153,11 +3153,11 @@ function () {
|
|
|
3153
3153
|
enumerable: false,
|
|
3154
3154
|
configurable: true
|
|
3155
3155
|
});
|
|
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
|
|
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
|
|
3161
3161
|
*/
|
|
3162
3162
|
|
|
3163
3163
|
StateNode.prototype.getFromRelativePath = function (relativePath) {
|
|
@@ -3205,11 +3205,11 @@ function () {
|
|
|
3205
3205
|
})
|
|
3206
3206
|
};
|
|
3207
3207
|
};
|
|
3208
|
-
/**
|
|
3209
|
-
* Resolves to the historical value(s) of the parent state node,
|
|
3210
|
-
* represented by state nodes.
|
|
3211
|
-
*
|
|
3212
|
-
* @param historyValue
|
|
3208
|
+
/**
|
|
3209
|
+
* Resolves to the historical value(s) of the parent state node,
|
|
3210
|
+
* represented by state nodes.
|
|
3211
|
+
*
|
|
3212
|
+
* @param historyValue
|
|
3213
3213
|
*/
|
|
3214
3214
|
|
|
3215
3215
|
|
|
@@ -3241,8 +3241,8 @@ function () {
|
|
|
3241
3241
|
};
|
|
3242
3242
|
|
|
3243
3243
|
Object.defineProperty(StateNode.prototype, "stateIds", {
|
|
3244
|
-
/**
|
|
3245
|
-
* 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.
|
|
3246
3246
|
*/
|
|
3247
3247
|
get: function () {
|
|
3248
3248
|
var _this = this;
|
|
@@ -3256,8 +3256,8 @@ function () {
|
|
|
3256
3256
|
configurable: true
|
|
3257
3257
|
});
|
|
3258
3258
|
Object.defineProperty(StateNode.prototype, "events", {
|
|
3259
|
-
/**
|
|
3260
|
-
* 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.
|
|
3261
3261
|
*/
|
|
3262
3262
|
get: function () {
|
|
3263
3263
|
var e_7, _a, e_8, _b;
|
|
@@ -3313,10 +3313,10 @@ function () {
|
|
|
3313
3313
|
configurable: true
|
|
3314
3314
|
});
|
|
3315
3315
|
Object.defineProperty(StateNode.prototype, "ownEvents", {
|
|
3316
|
-
/**
|
|
3317
|
-
* All the events that have transitions directly from this state node.
|
|
3318
|
-
*
|
|
3319
|
-
* Excludes any inert events.
|
|
3316
|
+
/**
|
|
3317
|
+
* All the events that have transitions directly from this state node.
|
|
3318
|
+
*
|
|
3319
|
+
* Excludes any inert events.
|
|
3320
3320
|
*/
|
|
3321
3321
|
get: function () {
|
|
3322
3322
|
var events = new Set(this.transitions.filter(function (transition) {
|
|
@@ -3376,7 +3376,7 @@ function () {
|
|
|
3376
3376
|
var guards = this.machine.options.guards;
|
|
3377
3377
|
var target = this.resolveTarget(normalizedTarget);
|
|
3378
3378
|
|
|
3379
|
-
var transition = __assign$
|
|
3379
|
+
var transition = __assign$1(__assign$1({}, transitionConfig), {
|
|
3380
3380
|
actions: toActionObjects(toArray(transitionConfig.actions)),
|
|
3381
3381
|
cond: toGuard(transitionConfig.cond, guards),
|
|
3382
3382
|
target: target,
|
|
@@ -3384,7 +3384,7 @@ function () {
|
|
|
3384
3384
|
internal: internal,
|
|
3385
3385
|
eventType: transitionConfig.event,
|
|
3386
3386
|
toJSON: function () {
|
|
3387
|
-
return __assign$
|
|
3387
|
+
return __assign$1(__assign$1({}, transition), {
|
|
3388
3388
|
target: transition.target ? transition.target.map(function (t) {
|
|
3389
3389
|
return "#" + t.id;
|
|
3390
3390
|
}) : undefined,
|
|
@@ -7576,414 +7576,127 @@ var urlJoin = {exports: {}};
|
|
|
7576
7576
|
|
|
7577
7577
|
var urljoin = urlJoin.exports;
|
|
7578
7578
|
|
|
7579
|
-
|
|
7580
|
-
* cookie
|
|
7581
|
-
* Copyright(c) 2012-2014 Roman Shtylman
|
|
7582
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
7583
|
-
* MIT Licensed
|
|
7584
|
-
*/
|
|
7585
|
-
|
|
7586
|
-
/**
|
|
7587
|
-
* Module exports.
|
|
7588
|
-
* @public
|
|
7589
|
-
*/
|
|
7590
|
-
|
|
7591
|
-
var parse_1 = parse;
|
|
7592
|
-
var serialize_1 = serialize;
|
|
7593
|
-
|
|
7594
|
-
/**
|
|
7595
|
-
* Module variables.
|
|
7596
|
-
* @private
|
|
7597
|
-
*/
|
|
7598
|
-
|
|
7599
|
-
var decode = decodeURIComponent;
|
|
7600
|
-
var encode = encodeURIComponent;
|
|
7601
|
-
var pairSplitRegExp = /; */;
|
|
7602
|
-
|
|
7603
|
-
/**
|
|
7604
|
-
* RegExp to match field-content in RFC 7230 sec 3.2
|
|
7605
|
-
*
|
|
7606
|
-
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
|
|
7607
|
-
* field-vchar = VCHAR / obs-text
|
|
7608
|
-
* obs-text = %x80-FF
|
|
7609
|
-
*/
|
|
7610
|
-
|
|
7611
|
-
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
7612
|
-
|
|
7613
|
-
/**
|
|
7614
|
-
* Parse a cookie header.
|
|
7615
|
-
*
|
|
7616
|
-
* Parse the given cookie header string into an object
|
|
7617
|
-
* The object has the various cookies as keys(names) => values
|
|
7618
|
-
*
|
|
7619
|
-
* @param {string} str
|
|
7620
|
-
* @param {object} [options]
|
|
7621
|
-
* @return {object}
|
|
7622
|
-
* @public
|
|
7623
|
-
*/
|
|
7624
|
-
|
|
7625
|
-
function parse(str, options) {
|
|
7626
|
-
if (typeof str !== 'string') {
|
|
7627
|
-
throw new TypeError('argument str must be a string');
|
|
7628
|
-
}
|
|
7629
|
-
|
|
7630
|
-
var obj = {};
|
|
7631
|
-
var opt = options || {};
|
|
7632
|
-
var pairs = str.split(pairSplitRegExp);
|
|
7633
|
-
var dec = opt.decode || decode;
|
|
7634
|
-
|
|
7635
|
-
for (var i = 0; i < pairs.length; i++) {
|
|
7636
|
-
var pair = pairs[i];
|
|
7637
|
-
var eq_idx = pair.indexOf('=');
|
|
7638
|
-
|
|
7639
|
-
// skip things that don't look like key=value
|
|
7640
|
-
if (eq_idx < 0) {
|
|
7641
|
-
continue;
|
|
7642
|
-
}
|
|
7643
|
-
|
|
7644
|
-
var key = pair.substr(0, eq_idx).trim();
|
|
7645
|
-
var val = pair.substr(++eq_idx, pair.length).trim();
|
|
7646
|
-
|
|
7647
|
-
// quoted values
|
|
7648
|
-
if ('"' == val[0]) {
|
|
7649
|
-
val = val.slice(1, -1);
|
|
7650
|
-
}
|
|
7651
|
-
|
|
7652
|
-
// only assign once
|
|
7653
|
-
if (undefined == obj[key]) {
|
|
7654
|
-
obj[key] = tryDecode(val, dec);
|
|
7655
|
-
}
|
|
7656
|
-
}
|
|
7657
|
-
|
|
7658
|
-
return obj;
|
|
7659
|
-
}
|
|
7660
|
-
|
|
7661
|
-
/**
|
|
7662
|
-
* Serialize data into a cookie header.
|
|
7663
|
-
*
|
|
7664
|
-
* Serialize the a name value pair into a cookie string suitable for
|
|
7665
|
-
* http headers. An optional options object specified cookie parameters.
|
|
7666
|
-
*
|
|
7667
|
-
* serialize('foo', 'bar', { httpOnly: true })
|
|
7668
|
-
* => "foo=bar; httpOnly"
|
|
7669
|
-
*
|
|
7670
|
-
* @param {string} name
|
|
7671
|
-
* @param {string} val
|
|
7672
|
-
* @param {object} [options]
|
|
7673
|
-
* @return {string}
|
|
7674
|
-
* @public
|
|
7675
|
-
*/
|
|
7676
|
-
|
|
7677
|
-
function serialize(name, val, options) {
|
|
7678
|
-
var opt = options || {};
|
|
7679
|
-
var enc = opt.encode || encode;
|
|
7680
|
-
|
|
7681
|
-
if (typeof enc !== 'function') {
|
|
7682
|
-
throw new TypeError('option encode is invalid');
|
|
7683
|
-
}
|
|
7684
|
-
|
|
7685
|
-
if (!fieldContentRegExp.test(name)) {
|
|
7686
|
-
throw new TypeError('argument name is invalid');
|
|
7687
|
-
}
|
|
7688
|
-
|
|
7689
|
-
var value = enc(val);
|
|
7690
|
-
|
|
7691
|
-
if (value && !fieldContentRegExp.test(value)) {
|
|
7692
|
-
throw new TypeError('argument val is invalid');
|
|
7693
|
-
}
|
|
7694
|
-
|
|
7695
|
-
var str = name + '=' + value;
|
|
7696
|
-
|
|
7697
|
-
if (null != opt.maxAge) {
|
|
7698
|
-
var maxAge = opt.maxAge - 0;
|
|
7699
|
-
|
|
7700
|
-
if (isNaN(maxAge) || !isFinite(maxAge)) {
|
|
7701
|
-
throw new TypeError('option maxAge is invalid')
|
|
7702
|
-
}
|
|
7703
|
-
|
|
7704
|
-
str += '; Max-Age=' + Math.floor(maxAge);
|
|
7705
|
-
}
|
|
7706
|
-
|
|
7707
|
-
if (opt.domain) {
|
|
7708
|
-
if (!fieldContentRegExp.test(opt.domain)) {
|
|
7709
|
-
throw new TypeError('option domain is invalid');
|
|
7710
|
-
}
|
|
7711
|
-
|
|
7712
|
-
str += '; Domain=' + opt.domain;
|
|
7713
|
-
}
|
|
7714
|
-
|
|
7715
|
-
if (opt.path) {
|
|
7716
|
-
if (!fieldContentRegExp.test(opt.path)) {
|
|
7717
|
-
throw new TypeError('option path is invalid');
|
|
7718
|
-
}
|
|
7719
|
-
|
|
7720
|
-
str += '; Path=' + opt.path;
|
|
7721
|
-
}
|
|
7722
|
-
|
|
7723
|
-
if (opt.expires) {
|
|
7724
|
-
if (typeof opt.expires.toUTCString !== 'function') {
|
|
7725
|
-
throw new TypeError('option expires is invalid');
|
|
7726
|
-
}
|
|
7727
|
-
|
|
7728
|
-
str += '; Expires=' + opt.expires.toUTCString();
|
|
7729
|
-
}
|
|
7730
|
-
|
|
7731
|
-
if (opt.httpOnly) {
|
|
7732
|
-
str += '; HttpOnly';
|
|
7733
|
-
}
|
|
7734
|
-
|
|
7735
|
-
if (opt.secure) {
|
|
7736
|
-
str += '; Secure';
|
|
7737
|
-
}
|
|
7738
|
-
|
|
7739
|
-
if (opt.sameSite) {
|
|
7740
|
-
var sameSite = typeof opt.sameSite === 'string'
|
|
7741
|
-
? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
7742
|
-
|
|
7743
|
-
switch (sameSite) {
|
|
7744
|
-
case true:
|
|
7745
|
-
str += '; SameSite=Strict';
|
|
7746
|
-
break;
|
|
7747
|
-
case 'lax':
|
|
7748
|
-
str += '; SameSite=Lax';
|
|
7749
|
-
break;
|
|
7750
|
-
case 'strict':
|
|
7751
|
-
str += '; SameSite=Strict';
|
|
7752
|
-
break;
|
|
7753
|
-
case 'none':
|
|
7754
|
-
str += '; SameSite=None';
|
|
7755
|
-
break;
|
|
7756
|
-
default:
|
|
7757
|
-
throw new TypeError('option sameSite is invalid');
|
|
7758
|
-
}
|
|
7759
|
-
}
|
|
7760
|
-
|
|
7761
|
-
return str;
|
|
7762
|
-
}
|
|
7763
|
-
|
|
7764
|
-
/**
|
|
7765
|
-
* Try decoding a string using a decoding function.
|
|
7766
|
-
*
|
|
7767
|
-
* @param {string} str
|
|
7768
|
-
* @param {function} decode
|
|
7769
|
-
* @private
|
|
7770
|
-
*/
|
|
7771
|
-
|
|
7772
|
-
function tryDecode(str, decode) {
|
|
7773
|
-
try {
|
|
7774
|
-
return decode(str);
|
|
7775
|
-
} catch (e) {
|
|
7776
|
-
return str;
|
|
7777
|
-
}
|
|
7778
|
-
}
|
|
7579
|
+
// import Cookies from 'universal-cookie'
|
|
7779
7580
|
|
|
7780
|
-
|
|
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
|
-
}
|
|
7581
|
+
// const cookies = new Cookies()
|
|
7825
7582
|
|
|
7826
|
-
var
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
}
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
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;
|
|
7902
|
-
}());
|
|
7583
|
+
var storage = {
|
|
7584
|
+
get(name, options) {
|
|
7585
|
+
//return cookies.get(name, options)
|
|
7586
|
+
|
|
7587
|
+
const itemStr = localStorage.getItem(name);
|
|
7588
|
+
|
|
7589
|
+
if (!itemStr) {
|
|
7590
|
+
return null
|
|
7591
|
+
}
|
|
7592
|
+
|
|
7593
|
+
const item = JSON.parse(itemStr);
|
|
7594
|
+
if (new Date().getTime() > item.expiry) {
|
|
7595
|
+
localStorage.removeItem(name);
|
|
7596
|
+
return null
|
|
7597
|
+
}
|
|
7598
|
+
|
|
7599
|
+
return item.value
|
|
7600
|
+
},
|
|
7601
|
+
set(name, value, options) {
|
|
7602
|
+
// cookies.set(name, value, options)
|
|
7903
7603
|
|
|
7904
|
-
|
|
7905
|
-
|
|
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;
|
|
7604
|
+
const item = {
|
|
7605
|
+
value,
|
|
7606
|
+
expiry: new Date().getTime() + (options.maxAge || 0)*1000
|
|
7926
7607
|
};
|
|
7927
|
-
|
|
7608
|
+
localStorage.setItem(name, JSON.stringify(item));
|
|
7609
|
+
},
|
|
7610
|
+
remove(name, options) {
|
|
7611
|
+
// cookies.remove(name, options)
|
|
7612
|
+
|
|
7613
|
+
localStorage.removeItem(name);
|
|
7614
|
+
}
|
|
7928
7615
|
};
|
|
7929
7616
|
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
}
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
function
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7617
|
+
/*! *****************************************************************************
|
|
7618
|
+
Copyright (c) Microsoft Corporation.
|
|
7619
|
+
|
|
7620
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
7621
|
+
purpose with or without fee is hereby granted.
|
|
7622
|
+
|
|
7623
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
7624
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
7625
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
7626
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
7627
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
7628
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
7629
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
7630
|
+
***************************************************************************** */
|
|
7631
|
+
|
|
7632
|
+
var __assign = function() {
|
|
7633
|
+
__assign = Object.assign || function __assign(t) {
|
|
7634
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7635
|
+
s = arguments[i];
|
|
7636
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7637
|
+
}
|
|
7638
|
+
return t;
|
|
7639
|
+
};
|
|
7640
|
+
return __assign.apply(this, arguments);
|
|
7641
|
+
};
|
|
7642
|
+
|
|
7643
|
+
function __rest(s, e) {
|
|
7644
|
+
var t = {};
|
|
7645
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
7646
|
+
t[p] = s[p];
|
|
7647
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7648
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7649
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
7650
|
+
t[p[i]] = s[p[i]];
|
|
7651
|
+
}
|
|
7652
|
+
return t;
|
|
7653
|
+
}
|
|
7654
|
+
|
|
7655
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
7656
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7657
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7658
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7659
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7660
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7661
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7662
|
+
});
|
|
7663
|
+
}
|
|
7664
|
+
|
|
7665
|
+
function __generator(thisArg, body) {
|
|
7666
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
7667
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
7668
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
7669
|
+
function step(op) {
|
|
7670
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
7671
|
+
while (_) try {
|
|
7672
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
7673
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
7674
|
+
switch (op[0]) {
|
|
7675
|
+
case 0: case 1: t = op; break;
|
|
7676
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
7677
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
7678
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
7679
|
+
default:
|
|
7680
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
7681
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
7682
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
7683
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
7684
|
+
if (t[2]) _.ops.pop();
|
|
7685
|
+
_.trys.pop(); continue;
|
|
7686
|
+
}
|
|
7687
|
+
op = body.call(thisArg, _);
|
|
7688
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
7689
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
7690
|
+
}
|
|
7691
|
+
}
|
|
7692
|
+
|
|
7693
|
+
/** @deprecated */
|
|
7694
|
+
function __spreadArrays() {
|
|
7695
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
7696
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
7697
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
7698
|
+
r[k] = a[j];
|
|
7699
|
+
return r;
|
|
7987
7700
|
}
|
|
7988
7701
|
|
|
7989
7702
|
/**
|
|
@@ -10392,9 +10105,9 @@ function auth (request) {
|
|
|
10392
10105
|
const { clientId, fpToken, sentry, defaultChannel, defaultSubchannel } = request.config;
|
|
10393
10106
|
const tokenKey = `cuora_${clientId}`;
|
|
10394
10107
|
const userKey = `cuora_tempuser`;
|
|
10108
|
+
const phoneCountryCode = 'phone_countrycode';
|
|
10395
10109
|
const accountPhoneKey = 'account_phone';
|
|
10396
10110
|
const accountEmailKey = 'account_email';
|
|
10397
|
-
const cookies = new Cookies();
|
|
10398
10111
|
|
|
10399
10112
|
return createMachine(
|
|
10400
10113
|
{
|
|
@@ -10412,6 +10125,7 @@ function auth (request) {
|
|
|
10412
10125
|
username: null,
|
|
10413
10126
|
password: null,
|
|
10414
10127
|
},
|
|
10128
|
+
countryAbbr: null,
|
|
10415
10129
|
userInfo: {},
|
|
10416
10130
|
redirectURL: null,
|
|
10417
10131
|
reCaptchaToken: null,
|
|
@@ -10420,23 +10134,6 @@ function auth (request) {
|
|
|
10420
10134
|
idle: {
|
|
10421
10135
|
entry: 'fetchToken',
|
|
10422
10136
|
always: [{ target: 'authenticated', cond: 'hasToken' }],
|
|
10423
|
-
on: {
|
|
10424
|
-
LOGIN_GUEST: {
|
|
10425
|
-
target: 'authenticationGuest',
|
|
10426
|
-
},
|
|
10427
|
-
LOGIN_PHONE: {
|
|
10428
|
-
target: 'authentication',
|
|
10429
|
-
actions: ['setReCaptchaToken', 'setLoginPhone'],
|
|
10430
|
-
},
|
|
10431
|
-
LOGIN_EMAIL: {
|
|
10432
|
-
target: 'authentication',
|
|
10433
|
-
actions: ['setReCaptchaToken', 'setLoginEmail'],
|
|
10434
|
-
},
|
|
10435
|
-
LOGIN_LOCAL: {
|
|
10436
|
-
target: 'authentication',
|
|
10437
|
-
actions: 'setLoginLocal',
|
|
10438
|
-
},
|
|
10439
|
-
},
|
|
10440
10137
|
},
|
|
10441
10138
|
authentication: {
|
|
10442
10139
|
invoke: {
|
|
@@ -10558,6 +10255,21 @@ function auth (request) {
|
|
|
10558
10255
|
CLEAR: {
|
|
10559
10256
|
target: '.logout',
|
|
10560
10257
|
},
|
|
10258
|
+
LOGIN_GUEST: {
|
|
10259
|
+
target: '.authenticationGuest',
|
|
10260
|
+
},
|
|
10261
|
+
LOGIN_PHONE: {
|
|
10262
|
+
target: '.authentication',
|
|
10263
|
+
actions: ['setReCaptchaToken', 'setLoginPhone'],
|
|
10264
|
+
},
|
|
10265
|
+
LOGIN_EMAIL: {
|
|
10266
|
+
target: '.authentication',
|
|
10267
|
+
actions: ['setReCaptchaToken', 'setLoginEmail'],
|
|
10268
|
+
},
|
|
10269
|
+
LOGIN_LOCAL: {
|
|
10270
|
+
target: '.authentication',
|
|
10271
|
+
actions: 'setLoginLocal',
|
|
10272
|
+
},
|
|
10561
10273
|
LOGIN_3PARTY: {
|
|
10562
10274
|
actions: 'redirectTo3Party',
|
|
10563
10275
|
},
|
|
@@ -10592,7 +10304,7 @@ function auth (request) {
|
|
|
10592
10304
|
}
|
|
10593
10305
|
}),
|
|
10594
10306
|
setLoginPhone: assign((context, event) => {
|
|
10595
|
-
const { countryCode, phone, password } = event.data;
|
|
10307
|
+
const { countryCode, countryAbbr, phone, password } = event.data;
|
|
10596
10308
|
return {
|
|
10597
10309
|
loginData: {
|
|
10598
10310
|
provider: 'phone',
|
|
@@ -10600,6 +10312,7 @@ function auth (request) {
|
|
|
10600
10312
|
phone,
|
|
10601
10313
|
password,
|
|
10602
10314
|
},
|
|
10315
|
+
countryAbbr,
|
|
10603
10316
|
}
|
|
10604
10317
|
}),
|
|
10605
10318
|
setLoginEmail: assign((context, event) => {
|
|
@@ -10614,7 +10327,7 @@ function auth (request) {
|
|
|
10614
10327
|
}),
|
|
10615
10328
|
setLoginLocal: assign((context, event) => {
|
|
10616
10329
|
const { username, password } = event.data;
|
|
10617
|
-
|
|
10330
|
+
storage.set(userKey, username, {
|
|
10618
10331
|
path: '/',
|
|
10619
10332
|
maxAge: 60 * 60 * 24,
|
|
10620
10333
|
});
|
|
@@ -10627,13 +10340,13 @@ function auth (request) {
|
|
|
10627
10340
|
}
|
|
10628
10341
|
}),
|
|
10629
10342
|
fetchToken: assign((context, event) => {
|
|
10630
|
-
const token =
|
|
10343
|
+
const token = storage.get(tokenKey);
|
|
10631
10344
|
return {
|
|
10632
10345
|
token,
|
|
10633
10346
|
}
|
|
10634
10347
|
}),
|
|
10635
10348
|
setToken: assign((context, event) => {
|
|
10636
|
-
|
|
10349
|
+
storage.set(tokenKey, event.data, {
|
|
10637
10350
|
path: '/',
|
|
10638
10351
|
maxAge: 300,
|
|
10639
10352
|
});
|
|
@@ -10643,29 +10356,34 @@ function auth (request) {
|
|
|
10643
10356
|
}),
|
|
10644
10357
|
setAccount: assign((context, event) => {
|
|
10645
10358
|
if (context.loginData.phone) {
|
|
10646
|
-
|
|
10647
|
-
|
|
10359
|
+
storage.remove(accountEmailKey);
|
|
10360
|
+
storage.set(accountPhoneKey, `${context.loginData.phone}`, {
|
|
10361
|
+
path: '/',
|
|
10362
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
10363
|
+
});
|
|
10364
|
+
storage.set(phoneCountryCode, `${context.countryAbbr}_${context.loginData.countryCode}`, {
|
|
10648
10365
|
path: '/',
|
|
10649
10366
|
maxAge: 60 * 60 * 24 * 7,
|
|
10650
10367
|
});
|
|
10651
10368
|
} else if (context.loginData.email) {
|
|
10652
|
-
|
|
10653
|
-
|
|
10369
|
+
storage.remove(accountPhoneKey);
|
|
10370
|
+
storage.remove(phoneCountryCode);
|
|
10371
|
+
storage.set(accountEmailKey, context.loginData.email, {
|
|
10654
10372
|
path: '/',
|
|
10655
10373
|
maxAge: 60 * 60 * 24 * 7,
|
|
10656
10374
|
});
|
|
10657
10375
|
}
|
|
10658
10376
|
}),
|
|
10659
10377
|
removeToken: assign((context, event) => {
|
|
10660
|
-
|
|
10378
|
+
storage.remove(tokenKey, {
|
|
10661
10379
|
path: '/',
|
|
10662
10380
|
maxAge: 300,
|
|
10663
10381
|
});
|
|
10664
10382
|
return { token: null }
|
|
10665
10383
|
}),
|
|
10666
10384
|
extendToken: assign((context, event) => {
|
|
10667
|
-
const token =
|
|
10668
|
-
|
|
10385
|
+
const token = storage.get(tokenKey);
|
|
10386
|
+
storage.set(tokenKey, token, {
|
|
10669
10387
|
path: '/',
|
|
10670
10388
|
maxAge: 300,
|
|
10671
10389
|
});
|
|
@@ -10679,7 +10397,7 @@ function auth (request) {
|
|
|
10679
10397
|
const messages = {
|
|
10680
10398
|
url: window.location.href,
|
|
10681
10399
|
list: [
|
|
10682
|
-
{ channel:
|
|
10400
|
+
{ channel: storage.get('channel'), subchannel: storage.get('subchannel') },
|
|
10683
10401
|
{ channel: defaultChannel, subchannel: defaultSubchannel },
|
|
10684
10402
|
{ channel: channel, subchannel: subchannel },
|
|
10685
10403
|
],
|
|
@@ -10689,14 +10407,14 @@ function auth (request) {
|
|
|
10689
10407
|
const redirectURL = urljoin(
|
|
10690
10408
|
request.config.fullURL,
|
|
10691
10409
|
'login?' +
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10410
|
+
new URLSearchParams({
|
|
10411
|
+
provider,
|
|
10412
|
+
redirectURI: `${window.location.protocol}//${window.location.host}`,
|
|
10413
|
+
channel: storage.get('channel') || channel || defaultChannel || 'official',
|
|
10414
|
+
subchannel: storage.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
|
|
10415
|
+
// dt,
|
|
10416
|
+
platform: 'pwa',
|
|
10417
|
+
}).toString()
|
|
10700
10418
|
);
|
|
10701
10419
|
window.location.href = redirectURL;
|
|
10702
10420
|
},
|
|
@@ -10932,8 +10650,6 @@ function auth_otp (request) {
|
|
|
10932
10650
|
)
|
|
10933
10651
|
}
|
|
10934
10652
|
|
|
10935
|
-
const cookies$2 = new Cookies();
|
|
10936
|
-
|
|
10937
10653
|
function welcome (request) {
|
|
10938
10654
|
return createMachine(
|
|
10939
10655
|
{
|
|
@@ -11000,7 +10716,7 @@ function welcome (request) {
|
|
|
11000
10716
|
const { bank_account, bank_setting_status, topup, verification_status, uid } = context.userInfo || {};
|
|
11001
10717
|
// const hasBankAccount = bank_account || bank_setting_status === 1 // sabai
|
|
11002
10718
|
const isComplete = topup === 1 || verification_status === 1;
|
|
11003
|
-
const isSent =
|
|
10719
|
+
const isSent = storage.get(`welcome_${uid}`);
|
|
11004
10720
|
return !(isSent || isComplete)
|
|
11005
10721
|
},
|
|
11006
10722
|
isFilled: (context, event) => {
|
|
@@ -11015,7 +10731,7 @@ function welcome (request) {
|
|
|
11015
10731
|
}
|
|
11016
10732
|
}),
|
|
11017
10733
|
setInfo: (context, event) => {
|
|
11018
|
-
|
|
10734
|
+
storage.set(`welcome_${context.userInfo.uid}`, 'done', {
|
|
11019
10735
|
path: '/',
|
|
11020
10736
|
maxAge: 60 * 60 * 24 * 365,
|
|
11021
10737
|
});
|
|
@@ -13042,7 +12758,6 @@ var pickBy_1 = pickBy;
|
|
|
13042
12758
|
|
|
13043
12759
|
// const pickBy = require('lodash/pickBy')
|
|
13044
12760
|
// const UAParser = require('ua-parser-js')
|
|
13045
|
-
const cookies$1 = new Cookies();
|
|
13046
12761
|
|
|
13047
12762
|
function common (request) {
|
|
13048
12763
|
const { appSecret, defaultChannel, defaultSubchannel } = request.config;
|
|
@@ -13191,14 +12906,14 @@ function common (request) {
|
|
|
13191
12906
|
return
|
|
13192
12907
|
} else {
|
|
13193
12908
|
let urlParams = new URLSearchParams(window.location.search);
|
|
13194
|
-
const channel = urlParams.get('channel') ||
|
|
13195
|
-
const subchannel = urlParams.get('subchannel') ||
|
|
12909
|
+
const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official';
|
|
12910
|
+
const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa';
|
|
13196
12911
|
|
|
13197
|
-
|
|
12912
|
+
storage.set('channel', channel, {
|
|
13198
12913
|
path: '/',
|
|
13199
12914
|
maxAge: 60 * 60 * 24 * 7,
|
|
13200
12915
|
});
|
|
13201
|
-
|
|
12916
|
+
storage.set('subchannel', subchannel, {
|
|
13202
12917
|
path: '/',
|
|
13203
12918
|
maxAge: 60 * 60 * 24 * 7,
|
|
13204
12919
|
});
|
|
@@ -13613,10 +13328,12 @@ function game (request) {
|
|
|
13613
13328
|
}
|
|
13614
13329
|
|
|
13615
13330
|
const MY_FAVORITE = 'MyFavorite';
|
|
13331
|
+
const GAME_SEARCH = 'GameSearch';
|
|
13616
13332
|
|
|
13617
13333
|
var constant = /*#__PURE__*/Object.freeze({
|
|
13618
13334
|
__proto__: null,
|
|
13619
|
-
MY_FAVORITE: MY_FAVORITE
|
|
13335
|
+
MY_FAVORITE: MY_FAVORITE,
|
|
13336
|
+
GAME_SEARCH: GAME_SEARCH
|
|
13620
13337
|
});
|
|
13621
13338
|
|
|
13622
13339
|
function game_v2 (request) {
|
|
@@ -13633,7 +13350,6 @@ function game_v2 (request) {
|
|
|
13633
13350
|
parentCategoryId: null,
|
|
13634
13351
|
totalPage: 1,
|
|
13635
13352
|
},
|
|
13636
|
-
favoriteList: [],
|
|
13637
13353
|
// play params
|
|
13638
13354
|
game: {
|
|
13639
13355
|
providerId: null,
|
|
@@ -13645,6 +13361,7 @@ function game_v2 (request) {
|
|
|
13645
13361
|
lang: 'en_US',
|
|
13646
13362
|
isMobile: new UAParser().getResult().device.type,
|
|
13647
13363
|
gameURL: null,
|
|
13364
|
+
...oldContext
|
|
13648
13365
|
},
|
|
13649
13366
|
states: {
|
|
13650
13367
|
flow: {
|
|
@@ -13667,16 +13384,6 @@ function game_v2 (request) {
|
|
|
13667
13384
|
target: 'connecting',
|
|
13668
13385
|
actions: ['setGameInfo', 'setLang'],
|
|
13669
13386
|
},
|
|
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
13387
|
},
|
|
13681
13388
|
},
|
|
13682
13389
|
loading: {
|
|
@@ -13721,72 +13428,90 @@ function game_v2 (request) {
|
|
|
13721
13428
|
},
|
|
13722
13429
|
},
|
|
13723
13430
|
},
|
|
13724
|
-
|
|
13725
|
-
|
|
13726
|
-
|
|
13727
|
-
|
|
13728
|
-
|
|
13729
|
-
|
|
13730
|
-
|
|
13731
|
-
|
|
13732
|
-
|
|
13733
|
-
|
|
13431
|
+
},
|
|
13432
|
+
},
|
|
13433
|
+
timer: {
|
|
13434
|
+
initial: 'pending',
|
|
13435
|
+
states: {
|
|
13436
|
+
pending: {
|
|
13437
|
+
after: {
|
|
13438
|
+
20000: [
|
|
13439
|
+
{
|
|
13440
|
+
target: 'updating',
|
|
13441
|
+
cond: 'hasRoom',
|
|
13442
|
+
},
|
|
13443
|
+
{
|
|
13444
|
+
target: 'pending',
|
|
13445
|
+
},
|
|
13446
|
+
],
|
|
13734
13447
|
},
|
|
13735
13448
|
},
|
|
13736
|
-
|
|
13449
|
+
updating: {
|
|
13737
13450
|
invoke: {
|
|
13738
|
-
src: '
|
|
13451
|
+
src: 'updatePageContent',
|
|
13739
13452
|
onDone: {
|
|
13740
|
-
target: '
|
|
13453
|
+
target: 'pending',
|
|
13454
|
+
actions: 'swapContent',
|
|
13741
13455
|
},
|
|
13742
13456
|
onError: {
|
|
13743
|
-
target: '
|
|
13744
|
-
actions: 'addToFavoriteList',
|
|
13457
|
+
target: 'pending',
|
|
13745
13458
|
},
|
|
13746
13459
|
},
|
|
13747
13460
|
},
|
|
13748
13461
|
},
|
|
13749
13462
|
},
|
|
13750
|
-
|
|
13751
|
-
initial: '
|
|
13463
|
+
oldTimer: {
|
|
13464
|
+
initial: 'fetchingGameSHA',
|
|
13752
13465
|
states: {
|
|
13753
|
-
|
|
13466
|
+
fetchingGameSHA: {
|
|
13754
13467
|
invoke: {
|
|
13755
|
-
src: '
|
|
13468
|
+
src: 'fetchGameSHA',
|
|
13756
13469
|
onDone: {
|
|
13757
|
-
target: '
|
|
13758
|
-
actions: '
|
|
13470
|
+
target: 'checking',
|
|
13471
|
+
actions: 'setGameSHA',
|
|
13759
13472
|
},
|
|
13760
13473
|
onError: {
|
|
13761
13474
|
target: 'pending',
|
|
13762
13475
|
},
|
|
13763
13476
|
},
|
|
13764
13477
|
},
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13478
|
+
checking: {
|
|
13479
|
+
always: [
|
|
13480
|
+
{ target: 'updatingStatus', cond: 'isStatusChanged' },
|
|
13481
|
+
{ target: 'pending' },
|
|
13482
|
+
],
|
|
13483
|
+
},
|
|
13484
|
+
updatingStatus: {
|
|
13485
|
+
invoke: {
|
|
13486
|
+
src: 'fetchStatus',
|
|
13487
|
+
onDone: {
|
|
13488
|
+
target: 'updatingOption',
|
|
13489
|
+
actions: ['setStatus'],
|
|
13490
|
+
},
|
|
13491
|
+
onError: {
|
|
13492
|
+
target: 'pending',
|
|
13493
|
+
},
|
|
13776
13494
|
},
|
|
13777
13495
|
},
|
|
13778
|
-
|
|
13496
|
+
updatingOption: {
|
|
13779
13497
|
invoke: {
|
|
13780
|
-
src: '
|
|
13498
|
+
src: 'fetchOption',
|
|
13781
13499
|
onDone: {
|
|
13782
13500
|
target: 'pending',
|
|
13783
|
-
actions: '
|
|
13501
|
+
actions: 'mergeOption',
|
|
13784
13502
|
},
|
|
13785
13503
|
onError: {
|
|
13786
13504
|
target: 'pending',
|
|
13787
13505
|
},
|
|
13788
13506
|
},
|
|
13789
13507
|
},
|
|
13508
|
+
pending: {
|
|
13509
|
+
after: {
|
|
13510
|
+
20000: {
|
|
13511
|
+
target: 'fetchingGameSHA',
|
|
13512
|
+
},
|
|
13513
|
+
},
|
|
13514
|
+
},
|
|
13790
13515
|
},
|
|
13791
13516
|
},
|
|
13792
13517
|
},
|
|
@@ -13816,21 +13541,23 @@ function game_v2 (request) {
|
|
|
13816
13541
|
}),
|
|
13817
13542
|
appendContent: assign((context, event) => {
|
|
13818
13543
|
const { room, favoriteList } = context;
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13544
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
13545
|
+
return
|
|
13546
|
+
} else {
|
|
13547
|
+
const { data, ...rest } = event.data;
|
|
13548
|
+
return {
|
|
13549
|
+
content: {
|
|
13550
|
+
...context.content,
|
|
13551
|
+
...rest,
|
|
13552
|
+
data: context.content.data.concat(data),
|
|
13553
|
+
},
|
|
13554
|
+
}
|
|
13827
13555
|
}
|
|
13828
13556
|
}),
|
|
13829
13557
|
swapContent: assign((context, event) => {
|
|
13830
|
-
const
|
|
13831
|
-
if (
|
|
13558
|
+
const item = event.data;
|
|
13559
|
+
if (item.data?.length) {
|
|
13832
13560
|
return {
|
|
13833
|
-
favoriteList: room.categoryId === MY_FAVORITE ? event.data.data : favoriteList,
|
|
13834
13561
|
content: event.data,
|
|
13835
13562
|
}
|
|
13836
13563
|
}
|
|
@@ -13856,39 +13583,28 @@ function game_v2 (request) {
|
|
|
13856
13583
|
const lang = event.data.locale.replace('-', '_');
|
|
13857
13584
|
return { lang }
|
|
13858
13585
|
}),
|
|
13859
|
-
|
|
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
|
-
}),
|
|
13586
|
+
...oldActions
|
|
13869
13587
|
},
|
|
13870
13588
|
guards: {
|
|
13871
13589
|
isDifferentRoom: (context, event) => context.room?.categoryId !== event.data?.categoryId,
|
|
13872
13590
|
hasNext: (context, event) => context.index < context?.content?.totalPage - 1,
|
|
13873
13591
|
hasRoom: (context, event) => context.room?.categoryId,
|
|
13874
|
-
|
|
13875
|
-
isNotFavorite: (context, event) => !context.favoriteList.some((item) => item.gameCode === event.data.gameCode),
|
|
13592
|
+
...oldGuards
|
|
13876
13593
|
},
|
|
13877
13594
|
services: {
|
|
13878
|
-
getFavorite: async (context, event) => {
|
|
13879
|
-
return await request.send(game$1.getListMyFavorite())
|
|
13880
|
-
},
|
|
13881
13595
|
getPageContent: async (context, event) => {
|
|
13882
13596
|
const { room, index } = context;
|
|
13883
|
-
if (room.categoryId ===
|
|
13884
|
-
return
|
|
13597
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
13598
|
+
return
|
|
13885
13599
|
} else {
|
|
13886
13600
|
return await request.send(game$1.getListCategory({ categoryId: room.categoryId, index }))
|
|
13887
13601
|
}
|
|
13888
13602
|
},
|
|
13889
13603
|
updatePageContent: async (context, event) => {
|
|
13890
13604
|
const { room, content, index } = context;
|
|
13891
|
-
if (room.categoryId ===
|
|
13605
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
13606
|
+
return
|
|
13607
|
+
} else {
|
|
13892
13608
|
return await request.send(
|
|
13893
13609
|
game$1.getListCategoryByRange({
|
|
13894
13610
|
categoryId: room.categoryId,
|
|
@@ -13919,27 +13635,59 @@ function game_v2 (request) {
|
|
|
13919
13635
|
const provider_id = context.game.providerId;
|
|
13920
13636
|
return await request.send(game$1.logoutGame({ uid_site, provider_id }))
|
|
13921
13637
|
},
|
|
13922
|
-
|
|
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
|
-
},
|
|
13638
|
+
...oldServices(request)
|
|
13938
13639
|
},
|
|
13939
13640
|
}
|
|
13940
13641
|
)
|
|
13941
13642
|
}
|
|
13942
13643
|
|
|
13644
|
+
const oldContext = {
|
|
13645
|
+
sha: {
|
|
13646
|
+
status: null,
|
|
13647
|
+
},
|
|
13648
|
+
isStatusChanged: false,
|
|
13649
|
+
statusMap: {},
|
|
13650
|
+
optionMap: {},
|
|
13651
|
+
};
|
|
13652
|
+
|
|
13653
|
+
const oldActions = {
|
|
13654
|
+
setGameSHA: assign((context, event) => {
|
|
13655
|
+
const { sha } = context;
|
|
13656
|
+
const newSha = event.data;
|
|
13657
|
+
return {
|
|
13658
|
+
sha: newSha,
|
|
13659
|
+
isStatusChanged: !sha.status || sha.status !== newSha.status,
|
|
13660
|
+
}
|
|
13661
|
+
}),
|
|
13662
|
+
setStatus: assign((context, event) => {
|
|
13663
|
+
return {
|
|
13664
|
+
statusMap: event.data,
|
|
13665
|
+
}
|
|
13666
|
+
}),
|
|
13667
|
+
mergeOption: assign((context, event) => {
|
|
13668
|
+
const { optionMap } = context;
|
|
13669
|
+
return {
|
|
13670
|
+
optionMap: { ...optionMap, ...event.data },
|
|
13671
|
+
}
|
|
13672
|
+
}),
|
|
13673
|
+
};
|
|
13674
|
+
|
|
13675
|
+
const oldGuards = {
|
|
13676
|
+
isStatusChanged: (context, event) => context.isStatusChanged,
|
|
13677
|
+
};
|
|
13678
|
+
|
|
13679
|
+
const oldServices = (request) => ({
|
|
13680
|
+
fetchOption: async (context, event) => {
|
|
13681
|
+
return await request.send(game$1.getOptionMap())
|
|
13682
|
+
},
|
|
13683
|
+
fetchGameSHA: async (context, event) => {
|
|
13684
|
+
return await request.send(game$1.getGameSHA())
|
|
13685
|
+
},
|
|
13686
|
+
fetchStatus: async (context, event) => {
|
|
13687
|
+
return await request.send(game$1.getGameStatus())
|
|
13688
|
+
},
|
|
13689
|
+
});
|
|
13690
|
+
|
|
13943
13691
|
function game_favorite (request) {
|
|
13944
13692
|
return createMachine(
|
|
13945
13693
|
{
|
|
@@ -14061,6 +13809,118 @@ function game_favorite (request) {
|
|
|
14061
13809
|
)
|
|
14062
13810
|
}
|
|
14063
13811
|
|
|
13812
|
+
function game_favorite_v2 (request) {
|
|
13813
|
+
return createMachine(
|
|
13814
|
+
{
|
|
13815
|
+
id: 'favorite',
|
|
13816
|
+
type: 'parallel',
|
|
13817
|
+
context: {
|
|
13818
|
+
list: [],
|
|
13819
|
+
},
|
|
13820
|
+
states: {
|
|
13821
|
+
fetching: {
|
|
13822
|
+
invoke: {
|
|
13823
|
+
src: 'fetchList',
|
|
13824
|
+
onDone: {
|
|
13825
|
+
actions: 'setList',
|
|
13826
|
+
},
|
|
13827
|
+
onError: {
|
|
13828
|
+
actions: assign({ list: [] }),
|
|
13829
|
+
},
|
|
13830
|
+
},
|
|
13831
|
+
},
|
|
13832
|
+
adding: {
|
|
13833
|
+
initial: 'disable',
|
|
13834
|
+
states: {
|
|
13835
|
+
disable: {},
|
|
13836
|
+
enable: {
|
|
13837
|
+
invoke: {
|
|
13838
|
+
src: 'add',
|
|
13839
|
+
onDone: {},
|
|
13840
|
+
onError: {
|
|
13841
|
+
actions: 'removeFromList',
|
|
13842
|
+
},
|
|
13843
|
+
},
|
|
13844
|
+
},
|
|
13845
|
+
},
|
|
13846
|
+
},
|
|
13847
|
+
removing: {
|
|
13848
|
+
initial: 'disable',
|
|
13849
|
+
states: {
|
|
13850
|
+
disable: {},
|
|
13851
|
+
enable: {
|
|
13852
|
+
invoke: {
|
|
13853
|
+
src: 'remove',
|
|
13854
|
+
onDone: {},
|
|
13855
|
+
onError: {
|
|
13856
|
+
actions: 'addToList',
|
|
13857
|
+
},
|
|
13858
|
+
},
|
|
13859
|
+
},
|
|
13860
|
+
},
|
|
13861
|
+
},
|
|
13862
|
+
},
|
|
13863
|
+
on: {
|
|
13864
|
+
ADD: {
|
|
13865
|
+
target: 'adding.enable',
|
|
13866
|
+
actions: 'addToList',
|
|
13867
|
+
cond: 'isNotExist',
|
|
13868
|
+
},
|
|
13869
|
+
REMOVE: {
|
|
13870
|
+
target: 'removing.enable',
|
|
13871
|
+
actions: 'removeFromList',
|
|
13872
|
+
cond: 'isExist',
|
|
13873
|
+
},
|
|
13874
|
+
},
|
|
13875
|
+
},
|
|
13876
|
+
{
|
|
13877
|
+
actions: {
|
|
13878
|
+
setList: assign((context, event) => {
|
|
13879
|
+
return {
|
|
13880
|
+
list: event.data,
|
|
13881
|
+
}
|
|
13882
|
+
}),
|
|
13883
|
+
addToList: assign((context, event) => {
|
|
13884
|
+
return {
|
|
13885
|
+
list: [...context.list, event.data],
|
|
13886
|
+
}
|
|
13887
|
+
}),
|
|
13888
|
+
removeFromList: assign((context, event) => {
|
|
13889
|
+
return {
|
|
13890
|
+
list: context.list.filter((item) => item.gameCode !== event.data.gameCode),
|
|
13891
|
+
}
|
|
13892
|
+
}),
|
|
13893
|
+
},
|
|
13894
|
+
guards: {
|
|
13895
|
+
isExist: (context, event) => context.list.some((item) => item.gameCode === event.data.gameCode),
|
|
13896
|
+
isNotExist: (context, event) => !context.list.some((item) => item.gameCode === event.data.gameCode)
|
|
13897
|
+
},
|
|
13898
|
+
services: {
|
|
13899
|
+
add: async (context, event) => {
|
|
13900
|
+
try {
|
|
13901
|
+
await request.send(game$1.addListFavorite(event.data.gameCode));
|
|
13902
|
+
return event.data
|
|
13903
|
+
} catch (error) {
|
|
13904
|
+
throw event.data
|
|
13905
|
+
}
|
|
13906
|
+
},
|
|
13907
|
+
remove: async (context, event) => {
|
|
13908
|
+
try {
|
|
13909
|
+
await request.send(game$1.removeListFavorite(event.data.gameCode));
|
|
13910
|
+
return event.data
|
|
13911
|
+
} catch (error) {
|
|
13912
|
+
throw event.data
|
|
13913
|
+
}
|
|
13914
|
+
},
|
|
13915
|
+
fetchList: async (context, event) => {
|
|
13916
|
+
const { data } = await request.send(game$1.getListMyFavorite());
|
|
13917
|
+
return data
|
|
13918
|
+
},
|
|
13919
|
+
},
|
|
13920
|
+
}
|
|
13921
|
+
)
|
|
13922
|
+
}
|
|
13923
|
+
|
|
14064
13924
|
function game_search (request) {
|
|
14065
13925
|
return createMachine(
|
|
14066
13926
|
{
|
|
@@ -15236,8 +15096,11 @@ function side_v2 (request) {
|
|
|
15236
15096
|
return { menu }
|
|
15237
15097
|
}),
|
|
15238
15098
|
setDefaultMenuItemStack: assign((context, event) => {
|
|
15239
|
-
const
|
|
15240
|
-
|
|
15099
|
+
const menu = event.data;
|
|
15100
|
+
if (menu.data.length > 0) {
|
|
15101
|
+
const menuItemStack = getDefaultItem(menu.data[0]);
|
|
15102
|
+
return { menuItemStack }
|
|
15103
|
+
}
|
|
15241
15104
|
}),
|
|
15242
15105
|
setMenuItemStack: assign((context, event) => {
|
|
15243
15106
|
const { menuItemStack } = context;
|
|
@@ -15414,8 +15277,6 @@ function user_info (request) {
|
|
|
15414
15277
|
)
|
|
15415
15278
|
}
|
|
15416
15279
|
|
|
15417
|
-
const cookies = new Cookies();
|
|
15418
|
-
|
|
15419
15280
|
function user_sign_up (request) {
|
|
15420
15281
|
const { fpToken, sentry, defaultChannel, defaultSubchannel } = request.config;
|
|
15421
15282
|
return createMachine(
|
|
@@ -15519,7 +15380,7 @@ function user_sign_up (request) {
|
|
|
15519
15380
|
const messages = {
|
|
15520
15381
|
url: window.location.href,
|
|
15521
15382
|
list: [
|
|
15522
|
-
{ channel:
|
|
15383
|
+
{ channel: storage.get('channel'), subchannel: storage.get('subchannel') },
|
|
15523
15384
|
{ channel: defaultChannel, subchannel: defaultSubchannel },
|
|
15524
15385
|
{ channel: channel, subchannel: subchannel },
|
|
15525
15386
|
],
|
|
@@ -15529,8 +15390,8 @@ function user_sign_up (request) {
|
|
|
15529
15390
|
return await request.send(
|
|
15530
15391
|
auth$1.register({
|
|
15531
15392
|
...signUpData,
|
|
15532
|
-
channel:
|
|
15533
|
-
subchannel:
|
|
15393
|
+
channel: storage.get('channel') || defaultChannel || channel,
|
|
15394
|
+
subchannel: storage.get('subchannel') || defaultSubchannel || subchannel,
|
|
15534
15395
|
dt,
|
|
15535
15396
|
reCaptchaToken: context.reCaptchaToken,
|
|
15536
15397
|
})
|
|
@@ -20046,6 +19907,7 @@ var index$1 = {
|
|
|
20046
19907
|
game,
|
|
20047
19908
|
game_v2,
|
|
20048
19909
|
game_favorite,
|
|
19910
|
+
game_favorite_v2,
|
|
20049
19911
|
game_search,
|
|
20050
19912
|
game_hot_new,
|
|
20051
19913
|
inbox,
|
|
@@ -20071,57 +19933,6 @@ var index$1 = {
|
|
|
20071
19933
|
vip_table,
|
|
20072
19934
|
};
|
|
20073
19935
|
|
|
20074
|
-
class Cookie {
|
|
20075
|
-
constructor(tokenKey) {
|
|
20076
|
-
this.cookies = new Cookies();
|
|
20077
|
-
this.tokenKey = tokenKey;
|
|
20078
|
-
}
|
|
20079
|
-
|
|
20080
|
-
setToken(token) {
|
|
20081
|
-
this.cookies.set(this.tokenKey, token, {
|
|
20082
|
-
path: '/',
|
|
20083
|
-
maxAge: 300,
|
|
20084
|
-
});
|
|
20085
|
-
}
|
|
20086
|
-
|
|
20087
|
-
prolongToken() {
|
|
20088
|
-
const token = this.getToken();
|
|
20089
|
-
if (token) {
|
|
20090
|
-
this.setToken(token);
|
|
20091
|
-
}
|
|
20092
|
-
}
|
|
20093
|
-
|
|
20094
|
-
getToken() {
|
|
20095
|
-
return this.cookies.get(this.tokenKey)
|
|
20096
|
-
}
|
|
20097
|
-
|
|
20098
|
-
removeToken() {
|
|
20099
|
-
this.cookies.remove(this.tokenKey, {
|
|
20100
|
-
path: '/',
|
|
20101
|
-
maxAge: 300,
|
|
20102
|
-
});
|
|
20103
|
-
}
|
|
20104
|
-
|
|
20105
|
-
setUser(user) {
|
|
20106
|
-
this.cookies.set('cuora_tempuser', user, {
|
|
20107
|
-
path: '/',
|
|
20108
|
-
maxAge: 60 * 60 * 24,
|
|
20109
|
-
});
|
|
20110
|
-
}
|
|
20111
|
-
|
|
20112
|
-
getUser() {
|
|
20113
|
-
return this.cookies.get('cuora_tempuser')
|
|
20114
|
-
}
|
|
20115
|
-
|
|
20116
|
-
set(name, value, options) {
|
|
20117
|
-
this.cookies.set(name, value, options);
|
|
20118
|
-
}
|
|
20119
|
-
|
|
20120
|
-
get(name, options) {
|
|
20121
|
-
return this.cookies.get(name, options)
|
|
20122
|
-
}
|
|
20123
|
-
}
|
|
20124
|
-
|
|
20125
19936
|
// const pickBy = require('lodash/pickBy')
|
|
20126
19937
|
|
|
20127
19938
|
function isValid(value) {
|
|
@@ -20133,7 +19944,7 @@ class Request {
|
|
|
20133
19944
|
this.axios = axios;
|
|
20134
19945
|
this.source = axios.CancelToken.source();
|
|
20135
19946
|
this.config = config;
|
|
20136
|
-
this.
|
|
19947
|
+
this.key = `cuora_${config.clientId}`;
|
|
20137
19948
|
this.errorHandler = null;
|
|
20138
19949
|
this.initialize();
|
|
20139
19950
|
}
|
|
@@ -20142,8 +19953,8 @@ class Request {
|
|
|
20142
19953
|
this.axios.interceptors.request.use((axiosConfig) => {
|
|
20143
19954
|
axiosConfig.headers['X-TH1GAMES-VERSION'] = this.config.version;
|
|
20144
19955
|
axiosConfig.headers['X-TH1GAMES-PLATFORM'] = this.config.platform;
|
|
20145
|
-
if (this.
|
|
20146
|
-
axiosConfig.headers.Authorization = this.
|
|
19956
|
+
if (storage.get(this.key)) {
|
|
19957
|
+
axiosConfig.headers.Authorization = storage.get(this.key);
|
|
20147
19958
|
}
|
|
20148
19959
|
return axiosConfig
|
|
20149
19960
|
});
|
|
@@ -20171,7 +19982,7 @@ class Request {
|
|
|
20171
19982
|
async send(req, customToken) {
|
|
20172
19983
|
try {
|
|
20173
19984
|
const cancelToken = customToken || this.source.token;
|
|
20174
|
-
this._checkToken(req, this.
|
|
19985
|
+
this._checkToken(req, storage.get(this.key));
|
|
20175
19986
|
const requestConfig = this._createConfig(req, cancelToken);
|
|
20176
19987
|
const { data } = await this.axios.request(requestConfig);
|
|
20177
19988
|
return data
|
|
@@ -20250,4 +20061,4 @@ class Config {
|
|
|
20250
20061
|
|
|
20251
20062
|
var index = { getDeviceToken };
|
|
20252
20063
|
|
|
20253
|
-
export { Config, Request, index$2 as api, constant, index$1 as machine, index as util };
|
|
20064
|
+
export { Config, Request, index$2 as api, constant, index$1 as machine, storage, index as util };
|