@jolibox/sdk 1.1.48 → 1.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/package-deps_build.json +6 -5
- package/dist/api/call-host-method.d.ts +5 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.js +217 -178
- package/dist/sdks/task.d.ts +4 -0
- package/package.json +3 -3
- package/sdk.build.log +4 -4
- package/src/api/call-host-method.ts +15 -0
- package/src/api/index.ts +1 -0
- package/src/index.ts +11 -1
- package/src/sdks/router.ts +5 -1
- package/src/sdks/task.ts +10 -4
package/dist/index.js
CHANGED
|
@@ -3,36 +3,36 @@
|
|
|
3
3
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
4
4
|
(_JoliboxSDK2 => {
|
|
5
5
|
// ../common/dist/index.es.js
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
6
|
+
var D = Object.defineProperty;
|
|
7
|
+
var be = Object.defineProperties;
|
|
8
|
+
var Ie = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var Ce = Object.getOwnPropertyDescriptors;
|
|
10
|
+
var $ = Object.getOwnPropertySymbols;
|
|
11
|
+
var Ae = Object.prototype.hasOwnProperty;
|
|
12
|
+
var we = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var B = (n, e, t) => e in n ? D(n, e, {
|
|
14
14
|
enumerable: true,
|
|
15
15
|
configurable: true,
|
|
16
16
|
writable: true,
|
|
17
17
|
value: t
|
|
18
18
|
}) : n[e] = t;
|
|
19
19
|
var h = (n, e) => {
|
|
20
|
-
for (var t in e || (e = {}))
|
|
21
|
-
if (
|
|
20
|
+
for (var t in e || (e = {})) Ae.call(e, t) && B(n, t, e[t]);
|
|
21
|
+
if ($) for (var t of $(e)) we.call(e, t) && B(n, t, e[t]);
|
|
22
22
|
return n;
|
|
23
23
|
};
|
|
24
|
-
var N = (n, e) =>
|
|
24
|
+
var N = (n, e) => be(n, Ce(e));
|
|
25
25
|
var Ne = (n, e) => {
|
|
26
|
-
for (var t in e)
|
|
26
|
+
for (var t in e) D(n, t, {
|
|
27
27
|
get: e[t],
|
|
28
28
|
enumerable: true
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
-
var
|
|
32
|
-
for (var o = r > 1 ? void 0 : r ?
|
|
33
|
-
return r && o &&
|
|
31
|
+
var O = (n, e, t, r) => {
|
|
32
|
+
for (var o = r > 1 ? void 0 : r ? Ie(e, t) : e, i = n.length - 1, s; i >= 0; i--) (s = n[i]) && (o = (r ? s(e, t, o) : s(o)) || o);
|
|
33
|
+
return r && o && D(e, t, o), o;
|
|
34
34
|
};
|
|
35
|
-
var
|
|
35
|
+
var P = (n, e, t) => new Promise((r, o) => {
|
|
36
36
|
var i = a => {
|
|
37
37
|
try {
|
|
38
38
|
l(t.next(a));
|
|
@@ -76,29 +76,29 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
76
76
|
if (this._eventListeners[t.type]) for (let r of this._eventListeners[t.type]) r.call(this, t);
|
|
77
77
|
}, window.AbortController = n, window.AbortSignal = e;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function Q(n) {
|
|
80
80
|
return new Promise(e => {
|
|
81
81
|
setTimeout(() => {
|
|
82
82
|
e();
|
|
83
83
|
}, n);
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function V(n) {
|
|
87
87
|
return typeof n == "string";
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function Oe(n) {
|
|
90
90
|
return typeof n == "object" && n !== null && !Array.isArray(n) && !(n instanceof RegExp) && !(n instanceof Date);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function Pe(n) {
|
|
93
93
|
return typeof n == "undefined";
|
|
94
94
|
}
|
|
95
|
-
function V(n) {
|
|
96
|
-
return Oe(n) || n === null;
|
|
97
|
-
}
|
|
98
95
|
function F(n) {
|
|
96
|
+
return Pe(n) || n === null;
|
|
97
|
+
}
|
|
98
|
+
function j(n) {
|
|
99
99
|
return typeof n == "function";
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function S(n) {
|
|
102
102
|
let e = n,
|
|
103
103
|
t = null,
|
|
104
104
|
r = function () {
|
|
@@ -109,8 +109,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
109
109
|
};
|
|
110
110
|
return r.prototype = e.prototype, r;
|
|
111
111
|
}
|
|
112
|
-
var
|
|
113
|
-
var
|
|
112
|
+
var Se = (a => (a[a.DEVELOPER_FILE_NOT_FOUND = 0] = "DEVELOPER_FILE_NOT_FOUND", a[a.INTERNAL_IOS_CAN_NOT_FOUND_PKG = 1] = "INTERNAL_IOS_CAN_NOT_FOUND_PKG", a[a.USER_IOS_LOAD_TIMEOUT = 2] = "USER_IOS_LOAD_TIMEOUT", a[a.INTERNAL_IOS_PKG_LOAD_ERROR = 3] = "INTERNAL_IOS_PKG_LOAD_ERROR", a[a.INTERNAL_IOS_PKG_PARSE_FAIL = 4] = "INTERNAL_IOS_PKG_PARSE_FAIL", a[a.USER_IOS_GET_EMPTY_DATA = 5] = "USER_IOS_GET_EMPTY_DATA", a[a.USER_ANDROID_GET_PKG_FAIL = 6] = "USER_ANDROID_GET_PKG_FAIL", a[a.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE = 7] = "DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE", a))(Se || {});
|
|
113
|
+
var I = class extends Error {
|
|
114
114
|
constructor(e) {
|
|
115
115
|
if (typeof e == "string") {
|
|
116
116
|
super(e), this.priority = "P1";
|
|
@@ -119,27 +119,27 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
119
119
|
super(e.message), this.priority = "P1", this.stack = e.stack, this.raw = e;
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
var p = class extends
|
|
122
|
+
var p = class extends I {
|
|
123
123
|
constructor() {
|
|
124
124
|
super(...arguments);
|
|
125
125
|
this.kind = "INTERNAL_ERROR";
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
var
|
|
128
|
+
var re = class extends p {
|
|
129
129
|
constructor() {
|
|
130
130
|
super(...arguments);
|
|
131
131
|
this.name = "INTERNAL_JS_MODULE_FETCH_ERROR";
|
|
132
132
|
this.priority = "P0";
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
|
-
var
|
|
135
|
+
var oe = class extends p {
|
|
136
136
|
constructor() {
|
|
137
137
|
super(...arguments);
|
|
138
138
|
this.name = "INTERNAL_JS_MODULE_EVAL_ERROR";
|
|
139
139
|
this.priority = "P0";
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
|
-
var
|
|
142
|
+
var pe = class extends I {
|
|
143
143
|
constructor(t, r, o, i, s) {
|
|
144
144
|
super(t);
|
|
145
145
|
this.message = t;
|
|
@@ -158,34 +158,34 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
|
-
function
|
|
161
|
+
function C(n) {
|
|
162
162
|
return function () {
|
|
163
163
|
var r, o;
|
|
164
164
|
((o = (r = globalThis.VConsole) == null ? void 0 : r[n]) != null ? o : globalThis.console[n])(...arguments);
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
|
-
var
|
|
168
|
-
log:
|
|
169
|
-
warn:
|
|
170
|
-
info:
|
|
171
|
-
error:
|
|
172
|
-
debug:
|
|
167
|
+
var ye = {
|
|
168
|
+
log: C("log"),
|
|
169
|
+
warn: C("warn"),
|
|
170
|
+
info: C("info"),
|
|
171
|
+
error: C("error"),
|
|
172
|
+
debug: C("debug")
|
|
173
173
|
};
|
|
174
174
|
Object.assign(globalThis, {
|
|
175
|
-
logger:
|
|
175
|
+
logger: ye
|
|
176
176
|
});
|
|
177
|
-
var
|
|
178
|
-
var
|
|
179
|
-
globalThis[
|
|
180
|
-
var
|
|
177
|
+
var H = Symbol.for("Jolibox.canIUseMap");
|
|
178
|
+
var ke = {};
|
|
179
|
+
globalThis[H] || (globalThis[H] = ke);
|
|
180
|
+
var $n = {
|
|
181
181
|
get config() {
|
|
182
|
-
return globalThis[
|
|
182
|
+
return globalThis[H];
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
|
-
var
|
|
186
|
-
var
|
|
187
|
-
globalThis[
|
|
188
|
-
function
|
|
185
|
+
var K = Symbol.for("Jolibox.canIUseMap.native");
|
|
186
|
+
var Me = {};
|
|
187
|
+
globalThis[K] || (globalThis[K] = Me);
|
|
188
|
+
function qn(n, e, t) {
|
|
189
189
|
let r = 0;
|
|
190
190
|
if (n !== e) {
|
|
191
191
|
let o = n.split("."),
|
|
@@ -219,13 +219,13 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
219
219
|
return false;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
var
|
|
223
|
-
var
|
|
224
|
-
var
|
|
225
|
-
var
|
|
226
|
-
var
|
|
227
|
-
var
|
|
228
|
-
function
|
|
222
|
+
var Ue = (d => (d[d.Other = 0] = "Other", d[d.Route = 1] = "Route", d[d.Click = 2] = "Click", d[d.View = 3] = "View", d[d.Expose = 4] = "Expose", d[d.Swipe = 5] = "Swipe", d[d.Input = 6] = "Input", d[d.Select = 7] = "Select", d[d.SwitchOn = 8] = "SwitchOn", d[d.SwitchOff = 9] = "SwitchOff", d[d.Submit = 10] = "Submit", d[d.Scroll = 11] = "Scroll", d[d.Hide = 12] = "Hide", d[d.System = 1e3] = "System", d[d.ErrorTrace = 1001] = "ErrorTrace", d[d.UserDefined = 1002] = "UserDefined", d))(Ue || {});
|
|
223
|
+
var De = (i => (i.MiniGame = "mini-game", i.MiniDrama = "mini-drama", i.App = "app", i.WebSDK = "web-sdk", i.AppSDK = "app-sdk", i))(De || {});
|
|
224
|
+
var Ve = (c => (c[c.App = 0] = "App", c[c.H5 = 1] = "H5", c[c.Weapp = 2] = "Weapp", c[c.Alipay = 3] = "Alipay", c[c.Gcash = 4] = "Gcash", c[c.Dana = 5] = "Dana", c[c.Umma = 6] = "Umma", c[c.WebSDK = 1e3] = "WebSDK", c[c.AppSDK = 1001] = "AppSDK", c[c.Other = 9999] = "Other", c))(Ve || {});
|
|
225
|
+
var xe = ["name", "params"];
|
|
226
|
+
var Fe = ["name", "type", "location", "target", "extra", "timestamp", "userId"];
|
|
227
|
+
var je = ["platform", "os", "appVersion", "appId", "model", "brand", "uuid", "jsSdkVersion", "extra"];
|
|
228
|
+
function k(n, e) {
|
|
229
229
|
return e.map(t => {
|
|
230
230
|
if (t === "params" && n[t]) {
|
|
231
231
|
let r = n[t];
|
|
@@ -234,24 +234,32 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
234
234
|
return n[t];
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
let e = n.location ?
|
|
239
|
-
t = n.target ?
|
|
240
|
-
return
|
|
237
|
+
function He(n) {
|
|
238
|
+
let e = n.location ? k(n.location, xe) : null,
|
|
239
|
+
t = n.target ? k(n.target, xe) : null;
|
|
240
|
+
return k(N(h({}, n), {
|
|
241
241
|
location: e,
|
|
242
242
|
target: t
|
|
243
|
-
}),
|
|
243
|
+
}), Fe);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
let e = n.events.map(r =>
|
|
247
|
-
t =
|
|
245
|
+
function et(n) {
|
|
246
|
+
let e = n.events.map(r => He(r)),
|
|
247
|
+
t = k(n.device, je);
|
|
248
248
|
return [n.protocolVersion, e, t, n.project];
|
|
249
249
|
}
|
|
250
|
-
var
|
|
250
|
+
var _e = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, n => {
|
|
251
251
|
let e = Math.random() * 16 | 0;
|
|
252
252
|
return (n === "x" ? e : e & 3 | 8).toString(16);
|
|
253
253
|
});
|
|
254
|
-
function
|
|
254
|
+
function he() {
|
|
255
|
+
if (typeof window == "undefined") return {
|
|
256
|
+
getItem: () => null,
|
|
257
|
+
setItem: () => {},
|
|
258
|
+
removeItem: () => {},
|
|
259
|
+
clear: () => {},
|
|
260
|
+
length: 0,
|
|
261
|
+
key: () => null
|
|
262
|
+
};
|
|
255
263
|
try {
|
|
256
264
|
if (window.__joliboxLocalStorage__) return window.__joliboxLocalStorage__;
|
|
257
265
|
let n = Object.getOwnPropertyDescriptor(window, "localStorage");
|
|
@@ -271,54 +279,55 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
271
279
|
return console.warn("Failed to get original localStorage, fallback to default implementation", n), localStorage;
|
|
272
280
|
}
|
|
273
281
|
}
|
|
274
|
-
|
|
275
|
-
var
|
|
276
|
-
var
|
|
277
|
-
|
|
282
|
+
he();
|
|
283
|
+
var E = typeof window == "undefined";
|
|
284
|
+
var Ke = () => !E && !!(navigator.userAgent || "").includes("JoliboxPlatformSDK");
|
|
285
|
+
var M = {
|
|
286
|
+
isiOS: !E && (navigator.userAgent.includes("iPhone") || navigator.userAgent.includes("iPod") || navigator.userAgent.includes("iPad") || navigator.userAgent.includes("iPhone OS")),
|
|
278
287
|
iosVersion: () => {
|
|
279
288
|
let n = navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);
|
|
280
289
|
return [parseInt(n[1], 10), parseInt(n[2], 10), parseInt(n[3] || "0", 10)];
|
|
281
290
|
},
|
|
282
|
-
isAndroid: navigator.userAgent.includes("Android"),
|
|
283
|
-
isMac: navigator.userAgent.includes("Mac"),
|
|
284
|
-
isFacebook: navigator.userAgent.includes("FB_IAB"),
|
|
285
|
-
isPC: !navigator.userAgent.includes("iPhone") && !navigator.userAgent.includes("Android")
|
|
291
|
+
isAndroid: !E && navigator.userAgent.includes("Android"),
|
|
292
|
+
isMac: !E && navigator.userAgent.includes("Mac"),
|
|
293
|
+
isFacebook: !E && navigator.userAgent.includes("FB_IAB"),
|
|
294
|
+
isPC: !E && !navigator.userAgent.includes("iPhone") && !navigator.userAgent.includes("Android")
|
|
286
295
|
};
|
|
287
|
-
var
|
|
288
|
-
var
|
|
289
|
-
var
|
|
290
|
-
var
|
|
291
|
-
var
|
|
296
|
+
var Ge = () => M.isiOS ? "iOS" : M.isAndroid ? "Android" : M.isMac ? "Mac" : M.isFacebook ? "Facebook" : "PC";
|
|
297
|
+
var Je = "device_id";
|
|
298
|
+
var ze = "advertising_id";
|
|
299
|
+
var Ee = n => (window.__joliboxLocalStorage__.getItem(n) || window.__joliboxLocalStorage__.setItem(n, _e()), window.__joliboxLocalStorage__.getItem(n));
|
|
300
|
+
var $e = () => {
|
|
292
301
|
let e = new URLSearchParams(window.location.search).get("deviceId");
|
|
293
|
-
return e ||
|
|
302
|
+
return e || Ee(Je);
|
|
294
303
|
};
|
|
295
|
-
var
|
|
304
|
+
var Be = () => {
|
|
296
305
|
let e = new URLSearchParams(window.location.search).get("advertisingId");
|
|
297
|
-
return e ||
|
|
306
|
+
return e || Ee(ze);
|
|
298
307
|
};
|
|
299
|
-
var
|
|
300
|
-
var
|
|
308
|
+
var We = n => n.charAt(0).toUpperCase() + n.slice(1);
|
|
309
|
+
var Qe = () => {
|
|
301
310
|
var e;
|
|
302
311
|
let n = new URLSearchParams(window.location.search);
|
|
303
|
-
return
|
|
312
|
+
return We((e = n.get("utm_source")) != null ? e : "") || "JoliboxSDK";
|
|
304
313
|
};
|
|
305
|
-
var
|
|
306
|
-
if (
|
|
314
|
+
var mt = n => {
|
|
315
|
+
if (Ke()) return window.navigator.userAgent;
|
|
307
316
|
let e = "JoliboxWebSDK",
|
|
308
|
-
t =
|
|
317
|
+
t = Ge(),
|
|
309
318
|
r = navigator.language,
|
|
310
|
-
o =
|
|
311
|
-
i =
|
|
312
|
-
return `${e} (${
|
|
319
|
+
o = $e(),
|
|
320
|
+
i = Be();
|
|
321
|
+
return `${e} (${Qe()}${t}; UnknownModel; UnknownSystemVersion; ${r}) uuid/${o} adid/${i} version/${n || ""}`;
|
|
313
322
|
};
|
|
314
|
-
var
|
|
323
|
+
var R = class R2 {
|
|
315
324
|
constructor(e) {
|
|
316
|
-
this.element = e, this.next =
|
|
325
|
+
this.element = e, this.next = R2.Undefined, this.prev = R2.Undefined;
|
|
317
326
|
}
|
|
318
327
|
};
|
|
319
|
-
|
|
320
|
-
var m =
|
|
321
|
-
var
|
|
328
|
+
R.Undefined = new R(void 0);
|
|
329
|
+
var m = R;
|
|
330
|
+
var U = class {
|
|
322
331
|
constructor() {
|
|
323
332
|
this._first = m.Undefined;
|
|
324
333
|
this._last = m.Undefined;
|
|
@@ -383,11 +392,11 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
383
392
|
for (; e !== m.Undefined;) yield e.element, e = e.next;
|
|
384
393
|
}
|
|
385
394
|
};
|
|
386
|
-
var
|
|
395
|
+
var Ye = 0;
|
|
387
396
|
var x = class {
|
|
388
397
|
constructor(e) {
|
|
389
398
|
this.value = e;
|
|
390
|
-
this.id =
|
|
399
|
+
this.id = Ye++;
|
|
391
400
|
}
|
|
392
401
|
};
|
|
393
402
|
var f = class {
|
|
@@ -409,11 +418,11 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
409
418
|
r && (t = t.bind(r));
|
|
410
419
|
let o = new x(t);
|
|
411
420
|
return this._listeners ? this._listeners instanceof x ? this._listeners = [this._listeners, o] : this._listeners.push(o) : ((s = (i = this.options) == null ? void 0 : i.onWillAddFirstListener) == null || s.call(i, this), this._listeners = o, (a = (l = this.options) == null ? void 0 : l.onDidFirstListener) == null || a.call(l, this)), (c = (u = this.options) == null ? void 0 : u.onDidAddListener) == null || c.call(u, this), this._size++, () => {
|
|
412
|
-
var _,
|
|
421
|
+
var _, b, w, J;
|
|
413
422
|
if (!this._disposed) {
|
|
414
|
-
if (this._listeners instanceof x) this._listeners.id === o.id && (this._listeners = void 0, this._size = 0, (
|
|
415
|
-
let
|
|
416
|
-
|
|
423
|
+
if (this._listeners instanceof x) this._listeners.id === o.id && (this._listeners = void 0, this._size = 0, (b = (_ = this.options) == null ? void 0 : _.onDidRemoveLastListener) == null || b.call(_));else if (this._listeners) {
|
|
424
|
+
let z = this._listeners.indexOf(o);
|
|
425
|
+
z >= 0 && (this._listeners.splice(z, 1), this._size--, this._size === 0 && ((J = (w = this.options) == null ? void 0 : w.onDidRemoveLastListener) == null || J.call(w)));
|
|
417
426
|
}
|
|
418
427
|
}
|
|
419
428
|
};
|
|
@@ -440,7 +449,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
440
449
|
return this._size > 0;
|
|
441
450
|
}
|
|
442
451
|
};
|
|
443
|
-
var
|
|
452
|
+
var A = class {
|
|
444
453
|
constructor() {
|
|
445
454
|
this.listeners = /* @__PURE__ */new Map();
|
|
446
455
|
this.listerHandlerMap = /* @__PURE__ */new WeakMap();
|
|
@@ -472,7 +481,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
472
481
|
for (var _len2 = arguments.length, t = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
473
482
|
t[_key2 - 1] = arguments[_key2];
|
|
474
483
|
}
|
|
475
|
-
o || (o = new
|
|
484
|
+
o || (o = new U(), this.cachedEventQueue.set(e, o)), o.push({
|
|
476
485
|
args: t
|
|
477
486
|
}), r && r.fire({
|
|
478
487
|
event: e,
|
|
@@ -487,20 +496,20 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
487
496
|
this.on(e, r, false);
|
|
488
497
|
}
|
|
489
498
|
};
|
|
490
|
-
var
|
|
491
|
-
Ne(
|
|
492
|
-
None: () =>
|
|
493
|
-
filter: () =>
|
|
494
|
-
once: () =>
|
|
495
|
-
toPromise: () =>
|
|
499
|
+
var T = {};
|
|
500
|
+
Ne(T, {
|
|
501
|
+
None: () => qe,
|
|
502
|
+
filter: () => Ze,
|
|
503
|
+
once: () => Re,
|
|
504
|
+
toPromise: () => Xe
|
|
496
505
|
});
|
|
497
|
-
var
|
|
506
|
+
var qe = () => (console.log("[Jolibox SDK] None Event"), () => {
|
|
498
507
|
console.log("[Jolibox SDK] None Event dispose");
|
|
499
508
|
});
|
|
500
|
-
function
|
|
501
|
-
return new Promise(e =>
|
|
509
|
+
function Xe(n) {
|
|
510
|
+
return new Promise(e => Re(n)(e));
|
|
502
511
|
}
|
|
503
|
-
function
|
|
512
|
+
function Re(n) {
|
|
504
513
|
return function (e) {
|
|
505
514
|
let t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
506
515
|
let r = false;
|
|
@@ -509,7 +518,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
509
518
|
}, null);
|
|
510
519
|
};
|
|
511
520
|
}
|
|
512
|
-
function
|
|
521
|
+
function Ze(n, e) {
|
|
513
522
|
return (r => {
|
|
514
523
|
let o,
|
|
515
524
|
i = {
|
|
@@ -524,29 +533,29 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
524
533
|
return n(i => e(i) && r.call(o, i), null);
|
|
525
534
|
});
|
|
526
535
|
}
|
|
527
|
-
var
|
|
528
|
-
var
|
|
529
|
-
let n = new
|
|
530
|
-
return globalThis[
|
|
536
|
+
var G = Symbol.for("Jolibox.hostEmitter");
|
|
537
|
+
var en = () => {
|
|
538
|
+
let n = new A();
|
|
539
|
+
return globalThis[G] || (globalThis[G] = {
|
|
531
540
|
on: n.on.bind(n),
|
|
532
541
|
off: n.off.bind(n),
|
|
533
542
|
emit: n.emit.bind(n),
|
|
534
543
|
once: n.once.bind(n)
|
|
535
|
-
}), globalThis[
|
|
544
|
+
}), globalThis[G];
|
|
536
545
|
};
|
|
537
|
-
var
|
|
538
|
-
function
|
|
546
|
+
var jt = en();
|
|
547
|
+
function Te(n, e) {
|
|
539
548
|
let t = Math.min(n.length, e.length);
|
|
540
|
-
for (let r = 0; r < t; r++)
|
|
549
|
+
for (let r = 0; r < t; r++) nn(n[r], e[r]);
|
|
541
550
|
}
|
|
542
|
-
function
|
|
543
|
-
if (
|
|
551
|
+
function nn(n, e) {
|
|
552
|
+
if (V(e)) {
|
|
544
553
|
if (typeof n !== e) throw new Error(`argument does not match constraint: typeof ${e}`);
|
|
545
|
-
} else if (
|
|
554
|
+
} else if (j(e)) {
|
|
546
555
|
try {
|
|
547
556
|
if (n instanceof e) return;
|
|
548
557
|
} catch (t) {}
|
|
549
|
-
if (!
|
|
558
|
+
if (!F(n) && n.constructor === e || e.length === 1 && e.call(void 0, n) === true) return;
|
|
550
559
|
throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true");
|
|
551
560
|
}
|
|
552
561
|
}
|
|
@@ -567,7 +576,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
567
576
|
for (var _len3 = arguments.length, s = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
568
577
|
s[_key3] = arguments[_key3];
|
|
569
578
|
}
|
|
570
|
-
return
|
|
579
|
+
return Te(s, o), i(...s);
|
|
571
580
|
};
|
|
572
581
|
}
|
|
573
582
|
let {
|
|
@@ -587,8 +596,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
587
596
|
return e;
|
|
588
597
|
}
|
|
589
598
|
};
|
|
590
|
-
y =
|
|
591
|
-
var
|
|
599
|
+
y = O([S], y);
|
|
600
|
+
var v = class {
|
|
592
601
|
constructor() {
|
|
593
602
|
this._onWillExecuteCommand = new f();
|
|
594
603
|
this.onWillExecuteCommand = this._onWillExecuteCommand.event;
|
|
@@ -598,14 +607,14 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
598
607
|
this._starActivation = null;
|
|
599
608
|
}
|
|
600
609
|
_activateStar() {
|
|
601
|
-
return this._starActivation || (this._starActivation =
|
|
610
|
+
return this._starActivation || (this._starActivation = Q(3e4)), this._starActivation;
|
|
602
611
|
}
|
|
603
612
|
executeCommand(e) {
|
|
604
613
|
for (var _len4 = arguments.length, t = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
605
614
|
t[_key4 - 1] = arguments[_key4];
|
|
606
615
|
}
|
|
607
|
-
return
|
|
608
|
-
return this.registry.getCommand(e) ? this._tryExecuteCommand(e, t) : (yield Promise.all([Promise.race([this._activateStar(),
|
|
616
|
+
return P(this, null, function* () {
|
|
617
|
+
return this.registry.getCommand(e) ? this._tryExecuteCommand(e, t) : (yield Promise.all([Promise.race([this._activateStar(), T.toPromise(T.filter(this.registry.onDidRegisterCommand, o => o === e))])]), this._tryExecuteCommand(e, t));
|
|
609
618
|
});
|
|
610
619
|
}
|
|
611
620
|
executeCommandThowErr(e) {
|
|
@@ -653,20 +662,20 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
653
662
|
}
|
|
654
663
|
}
|
|
655
664
|
};
|
|
656
|
-
|
|
657
|
-
var
|
|
658
|
-
function
|
|
659
|
-
return typeof globalThis != "undefined" ? globalThis[
|
|
665
|
+
v = O([S], v);
|
|
666
|
+
var ve = Symbol.for("Jolibox.commands");
|
|
667
|
+
function tn() {
|
|
668
|
+
return typeof globalThis != "undefined" ? globalThis[ve] : void 0;
|
|
660
669
|
}
|
|
661
|
-
function
|
|
662
|
-
typeof globalThis != "undefined" && (globalThis[
|
|
670
|
+
function rn(n) {
|
|
671
|
+
typeof globalThis != "undefined" && (globalThis[ve] = n);
|
|
663
672
|
}
|
|
664
|
-
function
|
|
673
|
+
function gr() {
|
|
665
674
|
let n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
666
|
-
let e =
|
|
675
|
+
let e = tn();
|
|
667
676
|
if (!n && e) return e;
|
|
668
677
|
let t = new y(),
|
|
669
|
-
r = new
|
|
678
|
+
r = new v(),
|
|
670
679
|
o = {
|
|
671
680
|
registerCommand(i, s, l) {
|
|
672
681
|
t.registerCommand({
|
|
@@ -688,7 +697,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
688
697
|
return r.executeCommandThowErr(i, ...s);
|
|
689
698
|
}
|
|
690
699
|
};
|
|
691
|
-
return
|
|
700
|
+
return rn(o), o;
|
|
692
701
|
}
|
|
693
702
|
|
|
694
703
|
// src/utils/env.ts
|
|
@@ -755,7 +764,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
755
764
|
try {
|
|
756
765
|
const reporterHost = API_BASE_URL;
|
|
757
766
|
const url = `${reporterHost}/report`;
|
|
758
|
-
const xua =
|
|
767
|
+
const xua = mt("__JOLIBOX_LOCAL_SDK_VERSION__");
|
|
759
768
|
const joliSource = JOLI_SOURCE;
|
|
760
769
|
const headers = {
|
|
761
770
|
"Content-Type": "application/json"
|
|
@@ -778,7 +787,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
778
787
|
try {
|
|
779
788
|
const errEvent = {
|
|
780
789
|
name: "globalJsError",
|
|
781
|
-
type:
|
|
790
|
+
type: Ue.ErrorTrace,
|
|
782
791
|
location: getLocation(),
|
|
783
792
|
target: null,
|
|
784
793
|
extra: errorData,
|
|
@@ -791,9 +800,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
791
800
|
protocolVersion: "1.0.0",
|
|
792
801
|
events,
|
|
793
802
|
device,
|
|
794
|
-
project:
|
|
803
|
+
project: De.WebSDK
|
|
795
804
|
};
|
|
796
|
-
const serializedEventPackage =
|
|
805
|
+
const serializedEventPackage = et(eventPackage);
|
|
797
806
|
await postToReporter(serializedEventPackage);
|
|
798
807
|
} catch (error) {
|
|
799
808
|
console.error("Failed to track error:", error);
|
|
@@ -801,7 +810,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
801
810
|
}
|
|
802
811
|
|
|
803
812
|
// src/events.ts
|
|
804
|
-
document.addEventListener("DOMContentLoaded", () =>
|
|
813
|
+
document.addEventListener("DOMContentLoaded", () => jt.emit("onDocumentReady", timeline.startTime));
|
|
805
814
|
var timelineFactory = () => {
|
|
806
815
|
let _beginLoad = 0;
|
|
807
816
|
return {
|
|
@@ -814,7 +823,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
814
823
|
};
|
|
815
824
|
};
|
|
816
825
|
var timeline = timelineFactory();
|
|
817
|
-
var commands =
|
|
826
|
+
var commands = gr();
|
|
818
827
|
var rejectHandler = event => {
|
|
819
828
|
let errorInfo;
|
|
820
829
|
if (event instanceof ErrorEvent) {
|
|
@@ -832,7 +841,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
832
841
|
stack: reason instanceof Error ? reason.stack : null,
|
|
833
842
|
type: "unhandledrejection"
|
|
834
843
|
};
|
|
835
|
-
} else if (event instanceof
|
|
844
|
+
} else if (event instanceof I) {
|
|
836
845
|
errorInfo = {
|
|
837
846
|
message: event.message,
|
|
838
847
|
name: event.name,
|
|
@@ -931,7 +940,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
931
940
|
};
|
|
932
941
|
|
|
933
942
|
// src/utils/report.ts
|
|
934
|
-
var commands2 =
|
|
943
|
+
var commands2 = gr();
|
|
935
944
|
var track = (event, info) => {
|
|
936
945
|
commands2.executeCommand("ReportSDK.traceSystem", {
|
|
937
946
|
event,
|
|
@@ -947,7 +956,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
947
956
|
};
|
|
948
957
|
|
|
949
958
|
// src/loader/h5.ts
|
|
950
|
-
|
|
959
|
+
he();
|
|
951
960
|
var LOCAL_STORE_KEY = "jolibox-sdk-loadermeta";
|
|
952
961
|
var CURRENT_VERSION_STORE = JSON.parse(window.__joliboxLocalStorage__.getItem(LOCAL_STORE_KEY) ?? "{}");
|
|
953
962
|
var now = Date.now();
|
|
@@ -1023,7 +1032,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1023
1032
|
type: "fetch_from_cdn"
|
|
1024
1033
|
};
|
|
1025
1034
|
} catch (e) {
|
|
1026
|
-
const internalError = new
|
|
1035
|
+
const internalError = new re(`Bootstrap module faile to fetch ${e}`);
|
|
1027
1036
|
trackError({
|
|
1028
1037
|
err: `${internalError}`
|
|
1029
1038
|
});
|
|
@@ -1077,7 +1086,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1077
1086
|
loadRemoteImplement();
|
|
1078
1087
|
fetchCurrentRemoteScript();
|
|
1079
1088
|
} catch (e) {
|
|
1080
|
-
const internalError = new
|
|
1089
|
+
const internalError = new oe(`module evaluate error: ${e}`);
|
|
1081
1090
|
trackError({
|
|
1082
1091
|
err: `${internalError}`
|
|
1083
1092
|
});
|
|
@@ -1107,7 +1116,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1107
1116
|
URL.revokeObjectURL(blobUrl);
|
|
1108
1117
|
return module;
|
|
1109
1118
|
} catch (error) {
|
|
1110
|
-
reportError(new
|
|
1119
|
+
reportError(new oe(`implement module evaluate error in native:${error} `));
|
|
1111
1120
|
}
|
|
1112
1121
|
};
|
|
1113
1122
|
evalJS(code);
|
|
@@ -1135,7 +1144,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1135
1144
|
});
|
|
1136
1145
|
} catch (e) {
|
|
1137
1146
|
console.error(`native load script error: ${e}`);
|
|
1138
|
-
reportError(new
|
|
1147
|
+
reportError(new oe(`module load failed ${e}`));
|
|
1139
1148
|
}
|
|
1140
1149
|
};
|
|
1141
1150
|
};
|
|
@@ -1191,14 +1200,14 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1191
1200
|
loadImplement();
|
|
1192
1201
|
|
|
1193
1202
|
// src/api/get-system-info.ts
|
|
1194
|
-
var commands3 =
|
|
1203
|
+
var commands3 = gr();
|
|
1195
1204
|
function getSystemInfoSync() {
|
|
1196
1205
|
return commands3.excuteCommandSync("API.getSystemInfoSync");
|
|
1197
1206
|
}
|
|
1198
1207
|
|
|
1199
1208
|
// src/utils/can-i-use.ts
|
|
1200
1209
|
function getCanIUseConfig(platform, key) {
|
|
1201
|
-
return
|
|
1210
|
+
return $n.config[platform]?.[key];
|
|
1202
1211
|
}
|
|
1203
1212
|
function get(obj, path, defaultValue) {
|
|
1204
1213
|
const pathArray = Array.isArray(path) ? path : path.replace(/\[(\d+)\]/g, ".$1").split(".");
|
|
@@ -1217,25 +1226,25 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1217
1226
|
var __VERSION__ = "__JOLIBOX_LOCAL_SDK_VERSION__";
|
|
1218
1227
|
function canIUse(schema) {
|
|
1219
1228
|
const [name, ...rest] = schema.split(":");
|
|
1220
|
-
const api = getCanIUseConfig(
|
|
1229
|
+
const api = getCanIUseConfig(Ke() ? "native" : "h5", name);
|
|
1221
1230
|
if (!api) return false;
|
|
1222
1231
|
const apiVersion = api["version"];
|
|
1223
1232
|
if (typeof apiVersion !== "string") return false;
|
|
1224
|
-
if (
|
|
1233
|
+
if (qn(__VERSION__, apiVersion, "<")) return false;
|
|
1225
1234
|
if (rest.length === 0) return true;
|
|
1226
1235
|
return checkRest(api, rest) || checkRest(api["properties"], rest);
|
|
1227
1236
|
}
|
|
1228
1237
|
function checkRest(info, paths) {
|
|
1229
1238
|
if (!info) return false;
|
|
1230
|
-
const
|
|
1231
|
-
if (!
|
|
1232
|
-
if (
|
|
1233
|
-
if (
|
|
1239
|
+
const v2 = get(info, paths);
|
|
1240
|
+
if (!v2) return false;
|
|
1241
|
+
if (Oe(v2)) return true;
|
|
1242
|
+
if (V(v2)) return qn(__VERSION__, v2, ">=");
|
|
1234
1243
|
return false;
|
|
1235
1244
|
}
|
|
1236
1245
|
|
|
1237
1246
|
// src/api/login.ts
|
|
1238
|
-
var commands4 =
|
|
1247
|
+
var commands4 = gr();
|
|
1239
1248
|
async function login() {
|
|
1240
1249
|
if (!canIUse("login")) {
|
|
1241
1250
|
return {
|
|
@@ -1256,7 +1265,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1256
1265
|
}
|
|
1257
1266
|
|
|
1258
1267
|
// src/api/request.ts
|
|
1259
|
-
var commands5 =
|
|
1268
|
+
var commands5 = gr();
|
|
1260
1269
|
async function request(params) {
|
|
1261
1270
|
if (!canIUse("request")) {
|
|
1262
1271
|
return {
|
|
@@ -1271,28 +1280,28 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1271
1280
|
var supportedEvents = ["onI18nChanged", "onBackPress"];
|
|
1272
1281
|
var onCustomEvent = (event, callback) => {
|
|
1273
1282
|
if (!supportedEvents.includes(event)) {
|
|
1274
|
-
reportError(new
|
|
1283
|
+
reportError(new pe(`[onCustomEvent] Unsupported event: ${event}`, 2e3));
|
|
1275
1284
|
return;
|
|
1276
1285
|
}
|
|
1277
|
-
|
|
1286
|
+
jt.on(event, callback);
|
|
1278
1287
|
};
|
|
1279
1288
|
var offCustomEvent = (event, callback) => {
|
|
1280
1289
|
if (!supportedEvents.includes(event)) {
|
|
1281
|
-
reportError(new
|
|
1290
|
+
reportError(new pe(`[offCustomEvent] Unsupported event: ${event}`, 2e3));
|
|
1282
1291
|
return;
|
|
1283
1292
|
}
|
|
1284
|
-
|
|
1293
|
+
jt.off(event, callback);
|
|
1285
1294
|
};
|
|
1286
1295
|
var onceCustomEvent = (event, callback) => {
|
|
1287
1296
|
if (!supportedEvents.includes(event)) {
|
|
1288
|
-
reportError(new
|
|
1297
|
+
reportError(new pe(`[onceCustomEvent] Unsupported event: ${event}`, 2e3));
|
|
1289
1298
|
return;
|
|
1290
1299
|
}
|
|
1291
|
-
|
|
1300
|
+
jt.once(event, callback);
|
|
1292
1301
|
};
|
|
1293
1302
|
|
|
1294
1303
|
// src/api/is-native-support.ts
|
|
1295
|
-
var commands6 =
|
|
1304
|
+
var commands6 = gr();
|
|
1296
1305
|
async function isNativeSupport(params) {
|
|
1297
1306
|
if (!canIUse("isNativeSupport")) {
|
|
1298
1307
|
return {
|
|
@@ -1303,6 +1312,18 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1303
1312
|
return await commands6.executeCommand("API.isNativeSupport", params);
|
|
1304
1313
|
}
|
|
1305
1314
|
|
|
1315
|
+
// src/api/call-host-method.ts
|
|
1316
|
+
var commands7 = gr();
|
|
1317
|
+
async function callHostMethod(params) {
|
|
1318
|
+
if (!canIUse("callHostMethod")) {
|
|
1319
|
+
return {
|
|
1320
|
+
code: "FAILURE",
|
|
1321
|
+
message: "[Jolibox SDK] callHostMethod is not supported in this platform"
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
return await commands7.executeCommand("API.callHostMethod", params);
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1306
1327
|
// src/sdks/sdk.ts
|
|
1307
1328
|
var BaseSDK = class {
|
|
1308
1329
|
constructor() {
|
|
@@ -1310,12 +1331,12 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1310
1331
|
* @private
|
|
1311
1332
|
* Instance for executing commands. Intended for internal SDK use.
|
|
1312
1333
|
*/
|
|
1313
|
-
this.commands =
|
|
1334
|
+
this.commands = gr();
|
|
1314
1335
|
/**
|
|
1315
1336
|
* @private
|
|
1316
1337
|
* Event emitter instance for handling internal events. Intended for internal SDK use.
|
|
1317
1338
|
*/
|
|
1318
|
-
this._emitter = new
|
|
1339
|
+
this._emitter = new A();
|
|
1319
1340
|
}
|
|
1320
1341
|
addEventListener(event, callback) {
|
|
1321
1342
|
this._emitter.on(event, function () {
|
|
@@ -1551,6 +1572,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1551
1572
|
* @param params.duration - Optional time spent in the level (milliseconds)
|
|
1552
1573
|
* @param params.rating - Optional user rating for the level
|
|
1553
1574
|
* @param params.score - Optional final score achieved in the level
|
|
1575
|
+
* @param params.variation - Optional variation
|
|
1554
1576
|
* @returns Promise resolving to TaskResponse or error message if validation fails
|
|
1555
1577
|
* @throws {Promise} Rejects with error if params is not an object
|
|
1556
1578
|
*/
|
|
@@ -1565,7 +1587,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1565
1587
|
levelId,
|
|
1566
1588
|
duration,
|
|
1567
1589
|
rating,
|
|
1568
|
-
score
|
|
1590
|
+
score,
|
|
1591
|
+
variation
|
|
1569
1592
|
} = params;
|
|
1570
1593
|
const errMsg = this.canIUseIfThrow("TaskTrackerSDK.onLevelFinished");
|
|
1571
1594
|
if (errMsg) {
|
|
@@ -1575,7 +1598,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1575
1598
|
levelId,
|
|
1576
1599
|
duration,
|
|
1577
1600
|
rating,
|
|
1578
|
-
score
|
|
1601
|
+
score,
|
|
1602
|
+
variation
|
|
1579
1603
|
});
|
|
1580
1604
|
}
|
|
1581
1605
|
/**
|
|
@@ -1585,6 +1609,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1585
1609
|
* @param params.duration - Optional total time spent in gameplay (milliseconds)
|
|
1586
1610
|
* @param params.rating - Optional user rating for the gameplay session
|
|
1587
1611
|
* @param params.score - Mandatory final score achieved during gameplay
|
|
1612
|
+
* @param params.variation - Optional variation
|
|
1588
1613
|
* @returns Promise resolving to TaskResponse or error message if validation fails
|
|
1589
1614
|
* @throws {Promise} Rejects with error if params is not an object
|
|
1590
1615
|
*/
|
|
@@ -1598,7 +1623,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1598
1623
|
const {
|
|
1599
1624
|
duration,
|
|
1600
1625
|
rating,
|
|
1601
|
-
score
|
|
1626
|
+
score,
|
|
1627
|
+
variation
|
|
1602
1628
|
} = params;
|
|
1603
1629
|
const errMsg = this.canIUseIfThrow("TaskTrackerSDK.onGamePlayEnded");
|
|
1604
1630
|
if (errMsg) {
|
|
@@ -1607,7 +1633,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1607
1633
|
return await this.commands.executeCommand("TaskTrackerSDK.gamePlayEnded", {
|
|
1608
1634
|
duration,
|
|
1609
1635
|
rating,
|
|
1610
|
-
score
|
|
1636
|
+
score,
|
|
1637
|
+
variation
|
|
1611
1638
|
});
|
|
1612
1639
|
}
|
|
1613
1640
|
/**
|
|
@@ -1715,7 +1742,11 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1715
1742
|
message: "invalid path"
|
|
1716
1743
|
};
|
|
1717
1744
|
}
|
|
1718
|
-
|
|
1745
|
+
await this.commands.executeCommand("RouterSDK.navigateToNativePage", path, params);
|
|
1746
|
+
return {
|
|
1747
|
+
code: "SUCCESS",
|
|
1748
|
+
message: `navigate to ${path} success`
|
|
1749
|
+
};
|
|
1719
1750
|
}
|
|
1720
1751
|
};
|
|
1721
1752
|
|
|
@@ -1854,6 +1885,14 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
1854
1885
|
* @private
|
|
1855
1886
|
*/
|
|
1856
1887
|
this.isNativeSupport = isNativeSupport.bind(this);
|
|
1888
|
+
/**
|
|
1889
|
+
* @private
|
|
1890
|
+
* Calls a host method.
|
|
1891
|
+
* @see {@link callHostMethod} for more details.
|
|
1892
|
+
* @param {ICallHostMethodParams} params - Parameters for the host method.
|
|
1893
|
+
* @returns {Promise<void>} A promise that resolves with the host method response.
|
|
1894
|
+
*/
|
|
1895
|
+
this.callHostMethod = callHostMethod.bind(this);
|
|
1857
1896
|
if (_JoliboxSDK.instance) {
|
|
1858
1897
|
return _JoliboxSDK.instance;
|
|
1859
1898
|
}
|