@goodgamestudios/cxf-webshop 7.1.2 → 7.1.4-qa.0
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.
|
@@ -0,0 +1,1554 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
12
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
13
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
|
|
32
|
+
// <define:process>
|
|
33
|
+
var define_process_default;
|
|
34
|
+
var init_define_process = __esm({
|
|
35
|
+
"<define:process>"() {
|
|
36
|
+
define_process_default = { env: { BASE_URL: { "12": "https://ef-canvas-test.public.ggs-ep.com", "15": "https://canvas-test.goodgamestudios.com", "16": "https://ef-canvas-test.public.ggs-ep.com", default: "https://canvas-test.goodgamestudios.com" }, CANVAS_AGENT_URL: "https://app.canvas.stillfront.com/agent.js", CANVAS_APP_ID_BY_GAME: { "12": "81199abb-592e-465c-b926-8656628a64c7", "15": { google: "25facd0c-e850-4ebf-b6c4-8c60240e4cf8", stillpay: "bec451f9-8db4-4ca1-8a5a-54494429ff5e" }, "16": "18f5521d-7df2-4bb3-88a3-c162ba072d73" }, CUSTOMIZATION_URL_TEMPLATE: "https://cdn.jsdelivr.net/npm/@lemonstand.org/config-goodgamestudios@{1}/dist/goodgamestudios-{0}.json", CUSTOMIZATION_URL: "https://cdn.jsdelivr.net/npm/@lemonstand.org/config-goodgamestudios@qa/dist/goodgamestudios-{0}.json" } };
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// node_modules/debug/node_modules/ms/index.js
|
|
41
|
+
var require_ms = __commonJS({
|
|
42
|
+
"node_modules/debug/node_modules/ms/index.js"(exports, module) {
|
|
43
|
+
init_define_process();
|
|
44
|
+
var s = 1e3;
|
|
45
|
+
var m = s * 60;
|
|
46
|
+
var h = m * 60;
|
|
47
|
+
var d = h * 24;
|
|
48
|
+
var w = d * 7;
|
|
49
|
+
var y = d * 365.25;
|
|
50
|
+
module.exports = function(val, options) {
|
|
51
|
+
options = options || {};
|
|
52
|
+
var type = typeof val;
|
|
53
|
+
if (type === "string" && val.length > 0) {
|
|
54
|
+
return parse(val);
|
|
55
|
+
} else if (type === "number" && isFinite(val)) {
|
|
56
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
57
|
+
}
|
|
58
|
+
throw new Error(
|
|
59
|
+
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
function parse(str) {
|
|
63
|
+
str = String(str);
|
|
64
|
+
if (str.length > 100) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
68
|
+
str
|
|
69
|
+
);
|
|
70
|
+
if (!match) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
var n = parseFloat(match[1]);
|
|
74
|
+
var type = (match[2] || "ms").toLowerCase();
|
|
75
|
+
switch (type) {
|
|
76
|
+
case "years":
|
|
77
|
+
case "year":
|
|
78
|
+
case "yrs":
|
|
79
|
+
case "yr":
|
|
80
|
+
case "y":
|
|
81
|
+
return n * y;
|
|
82
|
+
case "weeks":
|
|
83
|
+
case "week":
|
|
84
|
+
case "w":
|
|
85
|
+
return n * w;
|
|
86
|
+
case "days":
|
|
87
|
+
case "day":
|
|
88
|
+
case "d":
|
|
89
|
+
return n * d;
|
|
90
|
+
case "hours":
|
|
91
|
+
case "hour":
|
|
92
|
+
case "hrs":
|
|
93
|
+
case "hr":
|
|
94
|
+
case "h":
|
|
95
|
+
return n * h;
|
|
96
|
+
case "minutes":
|
|
97
|
+
case "minute":
|
|
98
|
+
case "mins":
|
|
99
|
+
case "min":
|
|
100
|
+
case "m":
|
|
101
|
+
return n * m;
|
|
102
|
+
case "seconds":
|
|
103
|
+
case "second":
|
|
104
|
+
case "secs":
|
|
105
|
+
case "sec":
|
|
106
|
+
case "s":
|
|
107
|
+
return n * s;
|
|
108
|
+
case "milliseconds":
|
|
109
|
+
case "millisecond":
|
|
110
|
+
case "msecs":
|
|
111
|
+
case "msec":
|
|
112
|
+
case "ms":
|
|
113
|
+
return n;
|
|
114
|
+
default:
|
|
115
|
+
return void 0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function fmtShort(ms) {
|
|
119
|
+
var msAbs = Math.abs(ms);
|
|
120
|
+
if (msAbs >= d) {
|
|
121
|
+
return Math.round(ms / d) + "d";
|
|
122
|
+
}
|
|
123
|
+
if (msAbs >= h) {
|
|
124
|
+
return Math.round(ms / h) + "h";
|
|
125
|
+
}
|
|
126
|
+
if (msAbs >= m) {
|
|
127
|
+
return Math.round(ms / m) + "m";
|
|
128
|
+
}
|
|
129
|
+
if (msAbs >= s) {
|
|
130
|
+
return Math.round(ms / s) + "s";
|
|
131
|
+
}
|
|
132
|
+
return ms + "ms";
|
|
133
|
+
}
|
|
134
|
+
function fmtLong(ms) {
|
|
135
|
+
var msAbs = Math.abs(ms);
|
|
136
|
+
if (msAbs >= d) {
|
|
137
|
+
return plural(ms, msAbs, d, "day");
|
|
138
|
+
}
|
|
139
|
+
if (msAbs >= h) {
|
|
140
|
+
return plural(ms, msAbs, h, "hour");
|
|
141
|
+
}
|
|
142
|
+
if (msAbs >= m) {
|
|
143
|
+
return plural(ms, msAbs, m, "minute");
|
|
144
|
+
}
|
|
145
|
+
if (msAbs >= s) {
|
|
146
|
+
return plural(ms, msAbs, s, "second");
|
|
147
|
+
}
|
|
148
|
+
return ms + " ms";
|
|
149
|
+
}
|
|
150
|
+
function plural(ms, msAbs, n, name) {
|
|
151
|
+
var isPlural = msAbs >= n * 1.5;
|
|
152
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// node_modules/debug/src/common.js
|
|
158
|
+
var require_common = __commonJS({
|
|
159
|
+
"node_modules/debug/src/common.js"(exports, module) {
|
|
160
|
+
init_define_process();
|
|
161
|
+
function setup(env) {
|
|
162
|
+
createDebug.debug = createDebug;
|
|
163
|
+
createDebug.default = createDebug;
|
|
164
|
+
createDebug.coerce = coerce;
|
|
165
|
+
createDebug.disable = disable;
|
|
166
|
+
createDebug.enable = enable;
|
|
167
|
+
createDebug.enabled = enabled;
|
|
168
|
+
createDebug.humanize = require_ms();
|
|
169
|
+
createDebug.destroy = destroy;
|
|
170
|
+
Object.keys(env).forEach((key) => {
|
|
171
|
+
createDebug[key] = env[key];
|
|
172
|
+
});
|
|
173
|
+
createDebug.names = [];
|
|
174
|
+
createDebug.skips = [];
|
|
175
|
+
createDebug.formatters = {};
|
|
176
|
+
function selectColor(namespace) {
|
|
177
|
+
let hash = 0;
|
|
178
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
179
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
180
|
+
hash |= 0;
|
|
181
|
+
}
|
|
182
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
183
|
+
}
|
|
184
|
+
createDebug.selectColor = selectColor;
|
|
185
|
+
function createDebug(namespace) {
|
|
186
|
+
let prevTime;
|
|
187
|
+
let enableOverride = null;
|
|
188
|
+
let namespacesCache;
|
|
189
|
+
let enabledCache;
|
|
190
|
+
function debug2(...args) {
|
|
191
|
+
if (!debug2.enabled) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const self = debug2;
|
|
195
|
+
const curr = Number(/* @__PURE__ */ new Date());
|
|
196
|
+
const ms = curr - (prevTime || curr);
|
|
197
|
+
self.diff = ms;
|
|
198
|
+
self.prev = prevTime;
|
|
199
|
+
self.curr = curr;
|
|
200
|
+
prevTime = curr;
|
|
201
|
+
args[0] = createDebug.coerce(args[0]);
|
|
202
|
+
if (typeof args[0] !== "string") {
|
|
203
|
+
args.unshift("%O");
|
|
204
|
+
}
|
|
205
|
+
let index = 0;
|
|
206
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
207
|
+
if (match === "%%") {
|
|
208
|
+
return "%";
|
|
209
|
+
}
|
|
210
|
+
index++;
|
|
211
|
+
const formatter = createDebug.formatters[format];
|
|
212
|
+
if (typeof formatter === "function") {
|
|
213
|
+
const val = args[index];
|
|
214
|
+
match = formatter.call(self, val);
|
|
215
|
+
args.splice(index, 1);
|
|
216
|
+
index--;
|
|
217
|
+
}
|
|
218
|
+
return match;
|
|
219
|
+
});
|
|
220
|
+
createDebug.formatArgs.call(self, args);
|
|
221
|
+
const logFn = self.log || createDebug.log;
|
|
222
|
+
logFn.apply(self, args);
|
|
223
|
+
}
|
|
224
|
+
debug2.namespace = namespace;
|
|
225
|
+
debug2.useColors = createDebug.useColors();
|
|
226
|
+
debug2.color = createDebug.selectColor(namespace);
|
|
227
|
+
debug2.extend = extend;
|
|
228
|
+
debug2.destroy = createDebug.destroy;
|
|
229
|
+
Object.defineProperty(debug2, "enabled", {
|
|
230
|
+
enumerable: true,
|
|
231
|
+
configurable: false,
|
|
232
|
+
get: () => {
|
|
233
|
+
if (enableOverride !== null) {
|
|
234
|
+
return enableOverride;
|
|
235
|
+
}
|
|
236
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
237
|
+
namespacesCache = createDebug.namespaces;
|
|
238
|
+
enabledCache = createDebug.enabled(namespace);
|
|
239
|
+
}
|
|
240
|
+
return enabledCache;
|
|
241
|
+
},
|
|
242
|
+
set: (v) => {
|
|
243
|
+
enableOverride = v;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
if (typeof createDebug.init === "function") {
|
|
247
|
+
createDebug.init(debug2);
|
|
248
|
+
}
|
|
249
|
+
return debug2;
|
|
250
|
+
}
|
|
251
|
+
function extend(namespace, delimiter) {
|
|
252
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
253
|
+
newDebug.log = this.log;
|
|
254
|
+
return newDebug;
|
|
255
|
+
}
|
|
256
|
+
function enable(namespaces) {
|
|
257
|
+
createDebug.save(namespaces);
|
|
258
|
+
createDebug.namespaces = namespaces;
|
|
259
|
+
createDebug.names = [];
|
|
260
|
+
createDebug.skips = [];
|
|
261
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
262
|
+
for (const ns of split) {
|
|
263
|
+
if (ns[0] === "-") {
|
|
264
|
+
createDebug.skips.push(ns.slice(1));
|
|
265
|
+
} else {
|
|
266
|
+
createDebug.names.push(ns);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function matchesTemplate(search, template) {
|
|
271
|
+
let searchIndex = 0;
|
|
272
|
+
let templateIndex = 0;
|
|
273
|
+
let starIndex = -1;
|
|
274
|
+
let matchIndex = 0;
|
|
275
|
+
while (searchIndex < search.length) {
|
|
276
|
+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
277
|
+
if (template[templateIndex] === "*") {
|
|
278
|
+
starIndex = templateIndex;
|
|
279
|
+
matchIndex = searchIndex;
|
|
280
|
+
templateIndex++;
|
|
281
|
+
} else {
|
|
282
|
+
searchIndex++;
|
|
283
|
+
templateIndex++;
|
|
284
|
+
}
|
|
285
|
+
} else if (starIndex !== -1) {
|
|
286
|
+
templateIndex = starIndex + 1;
|
|
287
|
+
matchIndex++;
|
|
288
|
+
searchIndex = matchIndex;
|
|
289
|
+
} else {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
294
|
+
templateIndex++;
|
|
295
|
+
}
|
|
296
|
+
return templateIndex === template.length;
|
|
297
|
+
}
|
|
298
|
+
function disable() {
|
|
299
|
+
const namespaces = [
|
|
300
|
+
...createDebug.names,
|
|
301
|
+
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
302
|
+
].join(",");
|
|
303
|
+
createDebug.enable("");
|
|
304
|
+
return namespaces;
|
|
305
|
+
}
|
|
306
|
+
function enabled(name) {
|
|
307
|
+
for (const skip of createDebug.skips) {
|
|
308
|
+
if (matchesTemplate(name, skip)) {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
for (const ns of createDebug.names) {
|
|
313
|
+
if (matchesTemplate(name, ns)) {
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
function coerce(val) {
|
|
320
|
+
if (val instanceof Error) {
|
|
321
|
+
return val.stack || val.message;
|
|
322
|
+
}
|
|
323
|
+
return val;
|
|
324
|
+
}
|
|
325
|
+
function destroy() {
|
|
326
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
327
|
+
}
|
|
328
|
+
createDebug.enable(createDebug.load());
|
|
329
|
+
return createDebug;
|
|
330
|
+
}
|
|
331
|
+
module.exports = setup;
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
// node_modules/debug/src/browser.js
|
|
336
|
+
var require_browser = __commonJS({
|
|
337
|
+
"node_modules/debug/src/browser.js"(exports, module) {
|
|
338
|
+
init_define_process();
|
|
339
|
+
exports.formatArgs = formatArgs;
|
|
340
|
+
exports.save = save;
|
|
341
|
+
exports.load = load;
|
|
342
|
+
exports.useColors = useColors;
|
|
343
|
+
exports.storage = localstorage();
|
|
344
|
+
exports.destroy = /* @__PURE__ */ (() => {
|
|
345
|
+
let warned = false;
|
|
346
|
+
return () => {
|
|
347
|
+
if (!warned) {
|
|
348
|
+
warned = true;
|
|
349
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
})();
|
|
353
|
+
exports.colors = [
|
|
354
|
+
"#0000CC",
|
|
355
|
+
"#0000FF",
|
|
356
|
+
"#0033CC",
|
|
357
|
+
"#0033FF",
|
|
358
|
+
"#0066CC",
|
|
359
|
+
"#0066FF",
|
|
360
|
+
"#0099CC",
|
|
361
|
+
"#0099FF",
|
|
362
|
+
"#00CC00",
|
|
363
|
+
"#00CC33",
|
|
364
|
+
"#00CC66",
|
|
365
|
+
"#00CC99",
|
|
366
|
+
"#00CCCC",
|
|
367
|
+
"#00CCFF",
|
|
368
|
+
"#3300CC",
|
|
369
|
+
"#3300FF",
|
|
370
|
+
"#3333CC",
|
|
371
|
+
"#3333FF",
|
|
372
|
+
"#3366CC",
|
|
373
|
+
"#3366FF",
|
|
374
|
+
"#3399CC",
|
|
375
|
+
"#3399FF",
|
|
376
|
+
"#33CC00",
|
|
377
|
+
"#33CC33",
|
|
378
|
+
"#33CC66",
|
|
379
|
+
"#33CC99",
|
|
380
|
+
"#33CCCC",
|
|
381
|
+
"#33CCFF",
|
|
382
|
+
"#6600CC",
|
|
383
|
+
"#6600FF",
|
|
384
|
+
"#6633CC",
|
|
385
|
+
"#6633FF",
|
|
386
|
+
"#66CC00",
|
|
387
|
+
"#66CC33",
|
|
388
|
+
"#9900CC",
|
|
389
|
+
"#9900FF",
|
|
390
|
+
"#9933CC",
|
|
391
|
+
"#9933FF",
|
|
392
|
+
"#99CC00",
|
|
393
|
+
"#99CC33",
|
|
394
|
+
"#CC0000",
|
|
395
|
+
"#CC0033",
|
|
396
|
+
"#CC0066",
|
|
397
|
+
"#CC0099",
|
|
398
|
+
"#CC00CC",
|
|
399
|
+
"#CC00FF",
|
|
400
|
+
"#CC3300",
|
|
401
|
+
"#CC3333",
|
|
402
|
+
"#CC3366",
|
|
403
|
+
"#CC3399",
|
|
404
|
+
"#CC33CC",
|
|
405
|
+
"#CC33FF",
|
|
406
|
+
"#CC6600",
|
|
407
|
+
"#CC6633",
|
|
408
|
+
"#CC9900",
|
|
409
|
+
"#CC9933",
|
|
410
|
+
"#CCCC00",
|
|
411
|
+
"#CCCC33",
|
|
412
|
+
"#FF0000",
|
|
413
|
+
"#FF0033",
|
|
414
|
+
"#FF0066",
|
|
415
|
+
"#FF0099",
|
|
416
|
+
"#FF00CC",
|
|
417
|
+
"#FF00FF",
|
|
418
|
+
"#FF3300",
|
|
419
|
+
"#FF3333",
|
|
420
|
+
"#FF3366",
|
|
421
|
+
"#FF3399",
|
|
422
|
+
"#FF33CC",
|
|
423
|
+
"#FF33FF",
|
|
424
|
+
"#FF6600",
|
|
425
|
+
"#FF6633",
|
|
426
|
+
"#FF9900",
|
|
427
|
+
"#FF9933",
|
|
428
|
+
"#FFCC00",
|
|
429
|
+
"#FFCC33"
|
|
430
|
+
];
|
|
431
|
+
function useColors() {
|
|
432
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
let m;
|
|
439
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
440
|
+
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
441
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
442
|
+
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
443
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
444
|
+
}
|
|
445
|
+
function formatArgs(args) {
|
|
446
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
447
|
+
if (!this.useColors) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
const c = "color: " + this.color;
|
|
451
|
+
args.splice(1, 0, c, "color: inherit");
|
|
452
|
+
let index = 0;
|
|
453
|
+
let lastC = 0;
|
|
454
|
+
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
455
|
+
if (match === "%%") {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
index++;
|
|
459
|
+
if (match === "%c") {
|
|
460
|
+
lastC = index;
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
args.splice(lastC, 0, c);
|
|
464
|
+
}
|
|
465
|
+
exports.log = console.debug || console.log || (() => {
|
|
466
|
+
});
|
|
467
|
+
function save(namespaces) {
|
|
468
|
+
try {
|
|
469
|
+
if (namespaces) {
|
|
470
|
+
exports.storage.setItem("debug", namespaces);
|
|
471
|
+
} else {
|
|
472
|
+
exports.storage.removeItem("debug");
|
|
473
|
+
}
|
|
474
|
+
} catch (error) {
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function load() {
|
|
478
|
+
let r;
|
|
479
|
+
try {
|
|
480
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
481
|
+
} catch (error) {
|
|
482
|
+
}
|
|
483
|
+
if (!r && typeof define_process_default !== "undefined" && "env" in define_process_default) {
|
|
484
|
+
r = define_process_default.env.DEBUG;
|
|
485
|
+
}
|
|
486
|
+
return r;
|
|
487
|
+
}
|
|
488
|
+
function localstorage() {
|
|
489
|
+
try {
|
|
490
|
+
return localStorage;
|
|
491
|
+
} catch (error) {
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
module.exports = require_common()(exports);
|
|
495
|
+
var { formatters } = module.exports;
|
|
496
|
+
formatters.j = function(v) {
|
|
497
|
+
try {
|
|
498
|
+
return JSON.stringify(v);
|
|
499
|
+
} catch (error) {
|
|
500
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
// node_modules/@goodgamestudios/cxf-ready/dist/index.js
|
|
507
|
+
var require_dist = __commonJS({
|
|
508
|
+
"node_modules/@goodgamestudios/cxf-ready/dist/index.js"(exports, module) {
|
|
509
|
+
"use strict";
|
|
510
|
+
init_define_process();
|
|
511
|
+
var cxf = window && window.CXF;
|
|
512
|
+
module.exports = new Promise(function(resolve, reject) {
|
|
513
|
+
if (!window) {
|
|
514
|
+
reject();
|
|
515
|
+
}
|
|
516
|
+
if (cxf) {
|
|
517
|
+
return resolve(cxf);
|
|
518
|
+
}
|
|
519
|
+
window.addEventListener("cxf.initialized", function(event) {
|
|
520
|
+
cxf = event.cxf;
|
|
521
|
+
resolve(cxf);
|
|
522
|
+
}, {
|
|
523
|
+
capture: true,
|
|
524
|
+
once: true,
|
|
525
|
+
passive: true
|
|
526
|
+
});
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
// node_modules/@goodgamestudios/game-alias/dist/index.js
|
|
532
|
+
var require_dist2 = __commonJS({
|
|
533
|
+
"node_modules/@goodgamestudios/game-alias/dist/index.js"(exports, module) {
|
|
534
|
+
init_define_process();
|
|
535
|
+
(function() {
|
|
536
|
+
var b = {};
|
|
537
|
+
function f(r, $) {
|
|
538
|
+
return h(r) || g(r, $) || e();
|
|
539
|
+
}
|
|
540
|
+
function e() {
|
|
541
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
542
|
+
}
|
|
543
|
+
function g(r, $) {
|
|
544
|
+
var a2 = [], o2 = true, e2 = false, n2 = void 0;
|
|
545
|
+
try {
|
|
546
|
+
for (var c2, i2 = r[Symbol.iterator](); !(o2 = (c2 = i2.next()).done) && (a2.push(c2.value), !$ || a2.length !== $); o2 = true) ;
|
|
547
|
+
} catch (m2) {
|
|
548
|
+
e2 = true, n2 = m2;
|
|
549
|
+
} finally {
|
|
550
|
+
try {
|
|
551
|
+
o2 || null == i2.return || i2.return();
|
|
552
|
+
} finally {
|
|
553
|
+
if (e2) throw n2;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return a2;
|
|
557
|
+
}
|
|
558
|
+
function h(r) {
|
|
559
|
+
if (Array.isArray(r)) return r;
|
|
560
|
+
}
|
|
561
|
+
var i = 0, j = 1, k = 2, c = { 1: ["poker", "poker2", "poker"], 12: ["empire", "castle", "em"], 15: ["bigfarm", "ranch", "bf"], 16: ["empirefourkingdoms", "fourkingdoms", "e4k"], 23: ["legendsofhonor", void 0, "loh"], 41: ["empiremillenniumwars", void 0, "emmw"] }, d = Object.entries(c).reduce(function(r, $) {
|
|
562
|
+
var a2 = f($, 2), o2 = a2[0], e2 = a2[1];
|
|
563
|
+
return o2 = parseInt(o2, 10), r[o2] = o2, e2.forEach(function($2) {
|
|
564
|
+
r[$2] = o2;
|
|
565
|
+
}), r;
|
|
566
|
+
}, {}), l = function(r) {
|
|
567
|
+
r = r.toString().toLowerCase();
|
|
568
|
+
var $ = d[r];
|
|
569
|
+
return $ && 0 | $;
|
|
570
|
+
}, a = function(r, $) {
|
|
571
|
+
return ($ = d[$]) && c[$][r];
|
|
572
|
+
}, m = a.bind(null, i), n = a.bind(null, j), o = a.bind(null, k);
|
|
573
|
+
b = { id: l, name: m, codename: n, acronym: o };
|
|
574
|
+
if (typeof exports === "object" && typeof module !== "undefined") {
|
|
575
|
+
module.exports = b;
|
|
576
|
+
} else if (typeof define === "function" && define.amd) {
|
|
577
|
+
define(function() {
|
|
578
|
+
return b;
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
})();
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
// node_modules/@goodgamestudios/cxf-events/dist/typings.js
|
|
586
|
+
var require_typings = __commonJS({
|
|
587
|
+
"node_modules/@goodgamestudios/cxf-events/dist/typings.js"(exports) {
|
|
588
|
+
"use strict";
|
|
589
|
+
init_define_process();
|
|
590
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
591
|
+
exports.CxfEvents = void 0;
|
|
592
|
+
var CxfEvents3;
|
|
593
|
+
(function(CxfEvents4) {
|
|
594
|
+
CxfEvents4["Token"] = "cxf.token";
|
|
595
|
+
CxfEvents4["Login"] = "cxf.login";
|
|
596
|
+
CxfEvents4["Signup"] = "cxf.signup";
|
|
597
|
+
CxfEvents4["GameEventUpdate"] = "cxf.gameEvent.update";
|
|
598
|
+
CxfEvents4["GameEventAdd"] = "cxf.gameEvent.add";
|
|
599
|
+
CxfEvents4["GameEventRemove"] = "cxf.gameEvent.remove";
|
|
600
|
+
CxfEvents4["XpChanged"] = "cxf.xp.changed";
|
|
601
|
+
CxfEvents4["LevelChanged"] = "cxf.level.changed";
|
|
602
|
+
CxfEvents4["LegendLevelChanged"] = "cxf.legendLevel.changed";
|
|
603
|
+
CxfEvents4["Push"] = "cxf.push";
|
|
604
|
+
CxfEvents4["OpenIGS"] = "cxf.igs.open";
|
|
605
|
+
CxfEvents4["JoinTempServer"] = "cxf.join.temp.server";
|
|
606
|
+
CxfEvents4["Subscription"] = "cxf.subscription";
|
|
607
|
+
CxfEvents4["RewardedAdStart"] = "cxf.rewardedad.start";
|
|
608
|
+
CxfEvents4["RewardedAdDone"] = "cxf.rewardedad.done";
|
|
609
|
+
})(CxfEvents3 = exports.CxfEvents || (exports.CxfEvents = {}));
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
// src/index.ts
|
|
614
|
+
init_define_process();
|
|
615
|
+
|
|
616
|
+
// src/app.ts
|
|
617
|
+
init_define_process();
|
|
618
|
+
|
|
619
|
+
// src/globalState.ts
|
|
620
|
+
init_define_process();
|
|
621
|
+
|
|
622
|
+
// src/fetch.ts
|
|
623
|
+
init_define_process();
|
|
624
|
+
|
|
625
|
+
// src/store.ts
|
|
626
|
+
init_define_process();
|
|
627
|
+
function initializeStore(cxf) {
|
|
628
|
+
return {
|
|
629
|
+
isCanvas: false,
|
|
630
|
+
playerId: cxf.playerId,
|
|
631
|
+
instanceId: cxf.instanceId,
|
|
632
|
+
networkId: cxf.networkId,
|
|
633
|
+
gameId: cxf.gameId,
|
|
634
|
+
gameApi: cxf.gameApi,
|
|
635
|
+
language: cxf.language,
|
|
636
|
+
token: cxf.token,
|
|
637
|
+
zoneId: cxf.zoneId,
|
|
638
|
+
gameEvents: [],
|
|
639
|
+
xp: 0,
|
|
640
|
+
level: 0,
|
|
641
|
+
legendLevel: void 0,
|
|
642
|
+
countryCode: "",
|
|
643
|
+
lastPurchaseTab: "",
|
|
644
|
+
subscriptionDisabled: false,
|
|
645
|
+
isTempServer: false,
|
|
646
|
+
customizationSuffix: "",
|
|
647
|
+
resolvedCustomizationUrl: "",
|
|
648
|
+
sourceId: "unknown",
|
|
649
|
+
unreadOfferNotifsCountUrl: ""
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
function criteriaSelector({ legendLevel, level }) {
|
|
653
|
+
return {
|
|
654
|
+
legendLevel,
|
|
655
|
+
level
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// src/utils/index.ts
|
|
660
|
+
init_define_process();
|
|
661
|
+
|
|
662
|
+
// src/utils/domain.ts
|
|
663
|
+
init_define_process();
|
|
664
|
+
var parentDomain = (referrer) => {
|
|
665
|
+
const matches = referrer.match(/^https?:\/\/([^#/?]+)(?:[#/?]|$)/i);
|
|
666
|
+
if (!matches || !matches[1]) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
const result = matches[1].match(/[^.]+\.[^.]+$/);
|
|
670
|
+
if (!result) {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
return result[0];
|
|
674
|
+
};
|
|
675
|
+
var getDomain = (referrer) => {
|
|
676
|
+
return parentDomain(referrer);
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
// src/utils/error-handling.ts
|
|
680
|
+
init_define_process();
|
|
681
|
+
|
|
682
|
+
// src/utils/logging.ts
|
|
683
|
+
init_define_process();
|
|
684
|
+
var import_debug = __toESM(require_browser());
|
|
685
|
+
var logger = (0, import_debug.default)("CXF-WEBSHOP");
|
|
686
|
+
var log = (argument0, ...rest) => logger(argument0, ...rest);
|
|
687
|
+
var logError = (...arguments_) => (
|
|
688
|
+
// tslint:disable-next-line:no-console
|
|
689
|
+
console.error("%c CXF-WEBSHOP ->", "background: #ff0000; color: #fff", ...arguments_)
|
|
690
|
+
);
|
|
691
|
+
|
|
692
|
+
// src/utils/error-handling.ts
|
|
693
|
+
var tryCatch = (fn) => (...args) => {
|
|
694
|
+
try {
|
|
695
|
+
return fn(...args);
|
|
696
|
+
} catch (error) {
|
|
697
|
+
logError(error);
|
|
698
|
+
throwCxfError(error);
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
var throwCxfError = (e) => {
|
|
702
|
+
const config = globalState.getConfig();
|
|
703
|
+
const cxf = globalState.getCxf();
|
|
704
|
+
cxf.emit(config.CXF_ERROR, e);
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
// src/utils/loaders.ts
|
|
708
|
+
init_define_process();
|
|
709
|
+
var startTimer = (function_, time) => {
|
|
710
|
+
const id = setTimeout(function_, time);
|
|
711
|
+
return () => clearTimeout(id);
|
|
712
|
+
};
|
|
713
|
+
var timeout = (function_, time) => (a) => {
|
|
714
|
+
return new Promise((resolve, reject) => {
|
|
715
|
+
const stopTimer = startTimer(() => {
|
|
716
|
+
reject(new Error(`Timeout has exceeded ${time}`));
|
|
717
|
+
}, time);
|
|
718
|
+
function_(a).then((value) => {
|
|
719
|
+
resolve(value);
|
|
720
|
+
stopTimer();
|
|
721
|
+
}).catch(reject);
|
|
722
|
+
});
|
|
723
|
+
};
|
|
724
|
+
var loadScript = (src) => new Promise((resolve, reject) => {
|
|
725
|
+
const script = document.createElement("script");
|
|
726
|
+
script.type = "text/javascript";
|
|
727
|
+
script.type = "module";
|
|
728
|
+
script.async = true;
|
|
729
|
+
script.src = src;
|
|
730
|
+
script.addEventListener("load", resolve);
|
|
731
|
+
script.addEventListener("error", reject);
|
|
732
|
+
document.body.append(script);
|
|
733
|
+
});
|
|
734
|
+
var loadCxf = timeout(() => require_dist(), 1e4);
|
|
735
|
+
|
|
736
|
+
// src/utils/payment.ts
|
|
737
|
+
init_define_process();
|
|
738
|
+
var transformPaymentContractIdsToNativePriceEvent = (ids) => (
|
|
739
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
740
|
+
ids.reduce(
|
|
741
|
+
(prev, cur, idx) => {
|
|
742
|
+
prev.offers.push({
|
|
743
|
+
id: cur,
|
|
744
|
+
tier: 0,
|
|
745
|
+
productIds: {
|
|
746
|
+
googleplay: cur
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
return prev;
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
category: "all",
|
|
753
|
+
offers: [],
|
|
754
|
+
eventName: "lemonstand.nativePrice",
|
|
755
|
+
eventType: "bubble"
|
|
756
|
+
}
|
|
757
|
+
)
|
|
758
|
+
);
|
|
759
|
+
|
|
760
|
+
// src/utils/platform.ts
|
|
761
|
+
init_define_process();
|
|
762
|
+
var userAgentToDistribPlatformMatrix = {
|
|
763
|
+
itunes: "apple",
|
|
764
|
+
Android: "google",
|
|
765
|
+
googleplay: "google",
|
|
766
|
+
amazonmobile: "amazon",
|
|
767
|
+
facebook: "facebook",
|
|
768
|
+
samsung: "samsung",
|
|
769
|
+
huawei: "huawei"
|
|
770
|
+
};
|
|
771
|
+
var detectPlatform = (defaultPlatform = "stillpay") => {
|
|
772
|
+
const nativePlatform = navigator.userAgent.match(
|
|
773
|
+
/(itunes)|(googleplay)|(Android)|(amazonmobile)|(facebook)|(samsung)|(huawei)/g
|
|
774
|
+
);
|
|
775
|
+
if (!nativePlatform) return defaultPlatform;
|
|
776
|
+
const activePlatform = nativePlatform[0];
|
|
777
|
+
return Object.prototype.hasOwnProperty.call(userAgentToDistribPlatformMatrix, activePlatform) ? userAgentToDistribPlatformMatrix[activePlatform] : defaultPlatform;
|
|
778
|
+
};
|
|
779
|
+
var distribPlatformToProviderMatrix = {
|
|
780
|
+
apple: "itunes",
|
|
781
|
+
google: "googleplay",
|
|
782
|
+
amazon: "amazonmobile",
|
|
783
|
+
facebook: "facebook",
|
|
784
|
+
samsung: "samsung",
|
|
785
|
+
huawei: "huawei"
|
|
786
|
+
};
|
|
787
|
+
var createProductIdsForPlatform = (platform, id) => {
|
|
788
|
+
if (!Object.prototype.hasOwnProperty.call(distribPlatformToProviderMatrix, platform))
|
|
789
|
+
throw new Error(`Platform ${platform} is not supported`);
|
|
790
|
+
const res = /* @__PURE__ */ Object.create(null);
|
|
791
|
+
res[distribPlatformToProviderMatrix[platform]] = id;
|
|
792
|
+
return res;
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
// src/utils/query-params.ts
|
|
796
|
+
init_define_process();
|
|
797
|
+
function formatQueryString(object) {
|
|
798
|
+
return Object.entries(object).filter(([key, value]) => value !== null && value !== void 0).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join("&");
|
|
799
|
+
}
|
|
800
|
+
var ggsGetQueryParams = () => {
|
|
801
|
+
return ggsGetQueryParameters();
|
|
802
|
+
};
|
|
803
|
+
var ggsGetReferrerValue = () => {
|
|
804
|
+
return ggsGetReferrer();
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
// src/utils/session.ts
|
|
808
|
+
init_define_process();
|
|
809
|
+
|
|
810
|
+
// node_modules/@lukeed/uuid/dist/index.mjs
|
|
811
|
+
init_define_process();
|
|
812
|
+
var IDX = 256;
|
|
813
|
+
var HEX = [];
|
|
814
|
+
var BUFFER;
|
|
815
|
+
while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
|
|
816
|
+
function v4() {
|
|
817
|
+
var i = 0, num, out = "";
|
|
818
|
+
if (!BUFFER || IDX + 16 > 256) {
|
|
819
|
+
BUFFER = Array(i = 256);
|
|
820
|
+
while (i--) BUFFER[i] = 256 * Math.random() | 0;
|
|
821
|
+
i = IDX = 0;
|
|
822
|
+
}
|
|
823
|
+
for (; i < 16; i++) {
|
|
824
|
+
num = BUFFER[IDX + i];
|
|
825
|
+
if (i == 6) out += HEX[num & 15 | 64];
|
|
826
|
+
else if (i == 8) out += HEX[num & 63 | 128];
|
|
827
|
+
else out += HEX[num];
|
|
828
|
+
if (i & 1 && i > 1 && i < 11) out += "-";
|
|
829
|
+
}
|
|
830
|
+
IDX++;
|
|
831
|
+
return out;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// src/ArgumentNullError.ts
|
|
835
|
+
init_define_process();
|
|
836
|
+
var ArgumentNullError = class extends Error {
|
|
837
|
+
constructor(parameterName, parameterValue) {
|
|
838
|
+
super(`${parameterName} has null value: ${parameterValue}`);
|
|
839
|
+
this.name = "ArgumentNullError";
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
// src/types/models.ts
|
|
844
|
+
init_define_process();
|
|
845
|
+
function encodeGnip({ gameId, networkId, instanceId, playerId }) {
|
|
846
|
+
return [gameId, networkId, instanceId, playerId].join("-");
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// src/utils/session.ts
|
|
850
|
+
var createSessionId = () => v4();
|
|
851
|
+
var getTokenAndLanguage = (store) => {
|
|
852
|
+
const { playerId, token, zoneId, language } = store;
|
|
853
|
+
if (!playerId) {
|
|
854
|
+
throw new ArgumentNullError("playerId", playerId);
|
|
855
|
+
}
|
|
856
|
+
return {
|
|
857
|
+
token,
|
|
858
|
+
zoneId,
|
|
859
|
+
locale: language,
|
|
860
|
+
ping: encodeGnip({ ...store, playerId })
|
|
861
|
+
};
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
// src/utils/time.ts
|
|
865
|
+
init_define_process();
|
|
866
|
+
function msToSec(value) {
|
|
867
|
+
return Math.floor(value / 1e3);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// src/utils/url.ts
|
|
871
|
+
init_define_process();
|
|
872
|
+
var import_game_alias = __toESM(require_dist2());
|
|
873
|
+
|
|
874
|
+
// src/config.ts
|
|
875
|
+
init_define_process();
|
|
876
|
+
var import_cxf_events = __toESM(require_typings());
|
|
877
|
+
|
|
878
|
+
// src/types/index.ts
|
|
879
|
+
init_define_process();
|
|
880
|
+
|
|
881
|
+
// src/types/config.ts
|
|
882
|
+
init_define_process();
|
|
883
|
+
|
|
884
|
+
// src/types/store.ts
|
|
885
|
+
init_define_process();
|
|
886
|
+
var entityProvider = (initial) => {
|
|
887
|
+
let element = initial;
|
|
888
|
+
return {
|
|
889
|
+
get: () => element,
|
|
890
|
+
set: (value) => {
|
|
891
|
+
element = value;
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
// src/config.ts
|
|
897
|
+
var parseBaseUrl = (value) => {
|
|
898
|
+
if (typeof value === "string") {
|
|
899
|
+
try {
|
|
900
|
+
return JSON.parse(value);
|
|
901
|
+
} catch {
|
|
902
|
+
return { default: value };
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
return value || { default: "" };
|
|
906
|
+
};
|
|
907
|
+
var COMMON_CONFIG = {
|
|
908
|
+
CANVAS_AGENT_URL: define_process_default.env.CANVAS_AGENT_URL,
|
|
909
|
+
CANVAS_APP_ID_BY_GAME: define_process_default.env.CANVAS_APP_ID_BY_GAME,
|
|
910
|
+
CUSTOMIZATION_URL: define_process_default.env.CUSTOMIZATION_URL,
|
|
911
|
+
CUSTOMIZATION_URL_TEMPLATE: define_process_default.env.CUSTOMIZATION_URL_TEMPLATE,
|
|
912
|
+
BASE_URL: parseBaseUrl(define_process_default.env.BASE_URL),
|
|
913
|
+
CXF_DIALOG_OPEN: "cxf.dialog.open",
|
|
914
|
+
CXF_DIALOG_CLOSE: "cxf.dialog.close",
|
|
915
|
+
CXF_TRACK_MSG: "cxf.tracking.message",
|
|
916
|
+
CXF_BTN_CLICK_MSG: import_cxf_events.CxfEvents.OpenIGS,
|
|
917
|
+
CXF_OPEN_SALES_MSG: "cxf.webshop.sales.open" /* CXF_OPEN_SALES_MSG */,
|
|
918
|
+
WEB_SHOP_CALL_TRACK_ID: 1181,
|
|
919
|
+
CXF_ERROR: "cxf.error",
|
|
920
|
+
CXF_PUSH: "cxf.push",
|
|
921
|
+
CXF_AD_STATUS: "cxf.adBanner.status"
|
|
922
|
+
};
|
|
923
|
+
var GAME_SPECIFIC_CONFIG = {
|
|
924
|
+
12: {
|
|
925
|
+
LEGEND_LEVEL_IS_USED: true
|
|
926
|
+
},
|
|
927
|
+
15: {
|
|
928
|
+
LEGEND_LEVEL_IS_USED: false
|
|
929
|
+
},
|
|
930
|
+
16: {
|
|
931
|
+
LEGEND_LEVEL_IS_USED: true
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
var createConfig = (gameId) => {
|
|
935
|
+
return {
|
|
936
|
+
...COMMON_CONFIG,
|
|
937
|
+
...GAME_SPECIFIC_CONFIG[gameId]
|
|
938
|
+
};
|
|
939
|
+
};
|
|
940
|
+
var getBaseUrlForGame = (gameId) => {
|
|
941
|
+
const baseUrl = COMMON_CONFIG.BASE_URL;
|
|
942
|
+
const gameIdKey = String(gameId);
|
|
943
|
+
return baseUrl[gameIdKey] || baseUrl.default || "";
|
|
944
|
+
};
|
|
945
|
+
|
|
946
|
+
// src/utils/validation.ts
|
|
947
|
+
init_define_process();
|
|
948
|
+
var validateForNull = (properties) => {
|
|
949
|
+
for (const key of Object.keys(properties)) {
|
|
950
|
+
const value = properties[key];
|
|
951
|
+
if (value === void 0 || value === null || Number.isNaN(value)) {
|
|
952
|
+
throw new ArgumentNullError(key, value);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
// src/utils/url.ts
|
|
958
|
+
var createIframeUrl = ({ page, route, sid, config: igsConfig = {} }) => {
|
|
959
|
+
const store = globalState.getStore();
|
|
960
|
+
const { token, zoneId, locale } = getTokenAndLanguage(store);
|
|
961
|
+
const parameters = {
|
|
962
|
+
token,
|
|
963
|
+
zoneId,
|
|
964
|
+
locale,
|
|
965
|
+
sid: sid || createSessionId()
|
|
966
|
+
};
|
|
967
|
+
if (Object.keys(igsConfig).length > 0) {
|
|
968
|
+
parameters.config = JSON.stringify(igsConfig);
|
|
969
|
+
}
|
|
970
|
+
validateForNull(parameters);
|
|
971
|
+
const urlParameters = new URLSearchParams(ggsGetQueryParams());
|
|
972
|
+
const queryParameters = {
|
|
973
|
+
...parameters,
|
|
974
|
+
"lemonstand.customization.url": store.resolvedCustomizationUrl || createCustomizationUrl(),
|
|
975
|
+
domain: getDomain(ggsGetReferrerValue()),
|
|
976
|
+
websiteId: urlParameters.get("w"),
|
|
977
|
+
criteria: JSON.stringify(criteriaSelector(store)),
|
|
978
|
+
level: store.level
|
|
979
|
+
};
|
|
980
|
+
const network = urlParameters.get("network");
|
|
981
|
+
if (urlParameters.get("usekeybaselogin") === "false" && Number(network) > 0) {
|
|
982
|
+
queryParameters.network = network;
|
|
983
|
+
}
|
|
984
|
+
if (store.adStatus?.areBannersAvailable) {
|
|
985
|
+
queryParameters.ads = true;
|
|
986
|
+
}
|
|
987
|
+
const baseUrl = getBaseUrlForGame(store.gameId);
|
|
988
|
+
return `${baseUrl}/?${formatQueryString(queryParameters)}${page ? `#${page}` : ""}${route ? `--${route}--${Date.now()}` : ""}`;
|
|
989
|
+
};
|
|
990
|
+
var createCustomizationUrl = () => {
|
|
991
|
+
const config = globalState.getConfig();
|
|
992
|
+
const store = globalState.getStore();
|
|
993
|
+
const cxf = globalState.getCxf();
|
|
994
|
+
const configBase = (0, import_game_alias.acronym)(store.gameId);
|
|
995
|
+
const configVariance = store.customizationSuffix ? `-${store.customizationSuffix}` : "";
|
|
996
|
+
const configBranch = `${configBase}${configVariance}`;
|
|
997
|
+
if (cxf.env === "test") {
|
|
998
|
+
const configVersion = new URLSearchParams(window.location.search).get("configGGS");
|
|
999
|
+
if (configVersion !== null) {
|
|
1000
|
+
return config.CUSTOMIZATION_URL_TEMPLATE.replace("{0}", configBranch).replace("{1}", configVersion);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
return config.CUSTOMIZATION_URL.replace("{0}", configBranch);
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
// src/fetch.ts
|
|
1007
|
+
var fetchUnreadOfferNotificationsCount = async () => {
|
|
1008
|
+
const config = globalState.getConfig();
|
|
1009
|
+
const store = globalState.getStore();
|
|
1010
|
+
if (config.LEGEND_LEVEL_IS_USED && store.legendLevel === void 0) {
|
|
1011
|
+
log("Skip fetchUnreadOfferNotificationsCount due to legendLevel is undefined");
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
if (!store.isCanvas && store.token && store.unreadOfferNotifsCountUrl) {
|
|
1015
|
+
log("fetchUnreadOfferNotificationsCount");
|
|
1016
|
+
let unreadCount = 0;
|
|
1017
|
+
const headers = {
|
|
1018
|
+
Authorization: `Bearer ${store.token}`
|
|
1019
|
+
};
|
|
1020
|
+
const url = store.unreadOfferNotifsCountUrl.replace("{locale}", store.language || "").replace("{zoneId}", store.zoneId || "").replace("{criteria}", encodeURIComponent(JSON.stringify(criteriaSelector(store))));
|
|
1021
|
+
try {
|
|
1022
|
+
log("fetch", url);
|
|
1023
|
+
const resp = await fetch(url, {
|
|
1024
|
+
headers
|
|
1025
|
+
});
|
|
1026
|
+
if (resp.ok) {
|
|
1027
|
+
const data = await resp.json();
|
|
1028
|
+
unreadCount = Number(data?.notifCount);
|
|
1029
|
+
}
|
|
1030
|
+
} catch (error) {
|
|
1031
|
+
logError(`cannot fetch ${url}`, error);
|
|
1032
|
+
}
|
|
1033
|
+
log("setUnseenOffersCounter", unreadCount);
|
|
1034
|
+
store.gameApi.invokeFn("setUnseenOffersCounter", unreadCount).catch((error) => {
|
|
1035
|
+
logError("setUnseenOffersCounter error:", error);
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
// src/messages/ShopMessageBus.ts
|
|
1041
|
+
init_define_process();
|
|
1042
|
+
var ShopMessageBus = class {
|
|
1043
|
+
post(message) {
|
|
1044
|
+
const element = document.querySelector("#dialog");
|
|
1045
|
+
if (element && element.tagName.toLocaleLowerCase() === "iframe") {
|
|
1046
|
+
element.contentWindow?.postMessage(message, "*");
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
// src/preFetch.ts
|
|
1052
|
+
init_define_process();
|
|
1053
|
+
var preResolveConfig = () => {
|
|
1054
|
+
if (typeof fetch !== "function") {
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
const originalCustomUrl = createCustomizationUrl();
|
|
1058
|
+
let resolvedUrl = "";
|
|
1059
|
+
fetch(originalCustomUrl).then((resp) => {
|
|
1060
|
+
const currentCustomUrl = createCustomizationUrl();
|
|
1061
|
+
if (currentCustomUrl === originalCustomUrl) {
|
|
1062
|
+
resolvedUrl = resp.url;
|
|
1063
|
+
log("parsed customization url is " + resolvedUrl);
|
|
1064
|
+
globalState.updateStore({
|
|
1065
|
+
resolvedCustomizationUrl: resolvedUrl
|
|
1066
|
+
});
|
|
1067
|
+
return resp.json();
|
|
1068
|
+
}
|
|
1069
|
+
}).then((config) => {
|
|
1070
|
+
if (config) {
|
|
1071
|
+
globalState.updateStore({
|
|
1072
|
+
unreadOfferNotifsCountUrl: config.unreadOfferNotifsCountUrl || ""
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1078
|
+
// src/globalState.ts
|
|
1079
|
+
var GlobalState = class {
|
|
1080
|
+
constructor() {
|
|
1081
|
+
this.config = void 0;
|
|
1082
|
+
this.cxfProvider = entityProvider();
|
|
1083
|
+
this.dialogProvider = entityProvider();
|
|
1084
|
+
this.storeProvider = entityProvider();
|
|
1085
|
+
this.shopMessageBus = new ShopMessageBus();
|
|
1086
|
+
this.fetchUnreadOfferNotificationsCount = fetchUnreadOfferNotificationsCount;
|
|
1087
|
+
this.preResolveConfig = preResolveConfig;
|
|
1088
|
+
}
|
|
1089
|
+
setConfig(config) {
|
|
1090
|
+
this.config = config;
|
|
1091
|
+
}
|
|
1092
|
+
getConfig() {
|
|
1093
|
+
if (this.config === void 0) {
|
|
1094
|
+
throw new Error("Config is not initialized");
|
|
1095
|
+
}
|
|
1096
|
+
return this.config;
|
|
1097
|
+
}
|
|
1098
|
+
setCxf(cxf) {
|
|
1099
|
+
this.cxfProvider.set(cxf);
|
|
1100
|
+
}
|
|
1101
|
+
getCxf() {
|
|
1102
|
+
const cxf = this.cxfProvider.get();
|
|
1103
|
+
if (!cxf) {
|
|
1104
|
+
throw new Error("CXF is not loaded");
|
|
1105
|
+
}
|
|
1106
|
+
return cxf;
|
|
1107
|
+
}
|
|
1108
|
+
setStore(store) {
|
|
1109
|
+
this.storeProvider.set(store);
|
|
1110
|
+
}
|
|
1111
|
+
getStore() {
|
|
1112
|
+
const store = this.storeProvider.get();
|
|
1113
|
+
if (!store) {
|
|
1114
|
+
throw new Error("Store is not initialized");
|
|
1115
|
+
}
|
|
1116
|
+
return store;
|
|
1117
|
+
}
|
|
1118
|
+
updateStore(data) {
|
|
1119
|
+
const currentStore = this.getStore();
|
|
1120
|
+
this.setStore({
|
|
1121
|
+
...currentStore,
|
|
1122
|
+
...data
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
var globalState = new GlobalState();
|
|
1127
|
+
|
|
1128
|
+
// src/handlers/cxfEventHandlers.ts
|
|
1129
|
+
init_define_process();
|
|
1130
|
+
var import_cxf_events2 = __toESM(require_typings());
|
|
1131
|
+
|
|
1132
|
+
// src/dialog.ts
|
|
1133
|
+
init_define_process();
|
|
1134
|
+
var createDialog = (url) => {
|
|
1135
|
+
const config = globalState.getConfig();
|
|
1136
|
+
const cxf = globalState.getCxf();
|
|
1137
|
+
cxf.emit(config.CXF_DIALOG_OPEN, url);
|
|
1138
|
+
};
|
|
1139
|
+
|
|
1140
|
+
// src/track.ts
|
|
1141
|
+
init_define_process();
|
|
1142
|
+
var trackOpenAction = (sid) => {
|
|
1143
|
+
const config = globalState.getConfig();
|
|
1144
|
+
const store = globalState.getStore();
|
|
1145
|
+
const now = Date.now();
|
|
1146
|
+
const parameters = getTokenAndLanguage(store);
|
|
1147
|
+
const { zoneId } = parameters;
|
|
1148
|
+
const sessionId = sid;
|
|
1149
|
+
const { playerId, gameId, networkId, instanceId, sourceId } = store;
|
|
1150
|
+
trackAction({
|
|
1151
|
+
eventId: config.WEB_SHOP_CALL_TRACK_ID,
|
|
1152
|
+
date: msToSec(now),
|
|
1153
|
+
unixtimeMS: now,
|
|
1154
|
+
sessionId,
|
|
1155
|
+
zoneId: zoneId ? Number.parseInt(zoneId, 10) : void 0,
|
|
1156
|
+
playerId: Number.parseInt(playerId, 10),
|
|
1157
|
+
gameId: Number.parseInt(gameId, 10),
|
|
1158
|
+
networkId: Number.parseInt(networkId, 10),
|
|
1159
|
+
instanceId: Number.parseInt(instanceId, 10),
|
|
1160
|
+
sourceId
|
|
1161
|
+
});
|
|
1162
|
+
};
|
|
1163
|
+
var trackAction = (payload) => {
|
|
1164
|
+
const config = globalState.getConfig();
|
|
1165
|
+
const cxf = globalState.getCxf();
|
|
1166
|
+
cxf.emit(config.CXF_TRACK_MSG, payload);
|
|
1167
|
+
};
|
|
1168
|
+
|
|
1169
|
+
// src/whitelist.ts
|
|
1170
|
+
init_define_process();
|
|
1171
|
+
var whitelistedZones = /* @__PURE__ */ new Set([218, 316, 318, 460, 461, 768, 802, 814, 830, 877]);
|
|
1172
|
+
|
|
1173
|
+
// src/handlers/pushHandlers.ts
|
|
1174
|
+
init_define_process();
|
|
1175
|
+
var onReward = (payload) => {
|
|
1176
|
+
log("OnReward: payload", payload);
|
|
1177
|
+
const { isCanvas } = globalState.getStore();
|
|
1178
|
+
if (isCanvas) {
|
|
1179
|
+
window.CanvasAgent?.instance?.hide();
|
|
1180
|
+
window.CanvasAgent?.instance?.navigate();
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
const url = createIframeUrl({
|
|
1184
|
+
route: encodeURIComponent(payload.successUrl),
|
|
1185
|
+
...payload
|
|
1186
|
+
});
|
|
1187
|
+
globalState.updateStore({
|
|
1188
|
+
lastPurchaseTab: payload.page,
|
|
1189
|
+
sourceId: "successfulPayoutReward"
|
|
1190
|
+
});
|
|
1191
|
+
trackOpenAction(payload.sid);
|
|
1192
|
+
createDialog(url);
|
|
1193
|
+
};
|
|
1194
|
+
var onLemonstandCategoryUpdate = ({ target, action, data }) => {
|
|
1195
|
+
globalState.shopMessageBus.post({
|
|
1196
|
+
eventName: "lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */,
|
|
1197
|
+
target,
|
|
1198
|
+
data: { action, data }
|
|
1199
|
+
});
|
|
1200
|
+
};
|
|
1201
|
+
var onLemonstandNotificationsCreated = ({ notifCount }) => {
|
|
1202
|
+
log("onLemonstandNotificationsCreated -> notifCount:", notifCount);
|
|
1203
|
+
const store = globalState.getStore();
|
|
1204
|
+
if (notifCount > 0) {
|
|
1205
|
+
const randomDelayMs = Math.floor(Math.random() * (Number(store.networkId) < 250 ? 12e4 : 15e3));
|
|
1206
|
+
setTimeout(() => {
|
|
1207
|
+
fetchUnreadOfferNotificationsCount();
|
|
1208
|
+
}, randomDelayMs);
|
|
1209
|
+
} else {
|
|
1210
|
+
store.gameApi.invokeFn("setUnseenOffersCounter", 0).catch((error) => {
|
|
1211
|
+
logError("setUnseenOffersCounter error:", error);
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
var createPushHandlers = () => {
|
|
1216
|
+
return {
|
|
1217
|
+
reward: onReward,
|
|
1218
|
+
reward_received: onReward,
|
|
1219
|
+
["lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */]: onLemonstandCategoryUpdate,
|
|
1220
|
+
["lemonstand.notifs.created" /* LEMONSTAND_NOTIFICATIONS_CREATED */]: onLemonstandNotificationsCreated
|
|
1221
|
+
};
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
// src/handlers/cxfEventHandlers.ts
|
|
1225
|
+
var isWindowMessageListenerAttached = false;
|
|
1226
|
+
var eventListener = (event) => {
|
|
1227
|
+
log(`Canvas event "${event.eventType}" received:`, event);
|
|
1228
|
+
switch (event.eventType) {
|
|
1229
|
+
case "native_catalog_request" /* NATIVE_CATALOG_REQUEST */: {
|
|
1230
|
+
if (event?.paymentContractIds?.length > 0) {
|
|
1231
|
+
if (!isWindowMessageListenerAttached) {
|
|
1232
|
+
window.addEventListener("message", ({ data }) => {
|
|
1233
|
+
if (data?.eventName === "lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */ && data?.data?.action === "nativePriceUpdate") {
|
|
1234
|
+
log(`${"lemonstand.category.update" /* LEMONSTAND_CATEGORY_UPDATE */} event`, data.data);
|
|
1235
|
+
if (!data.data.data) return;
|
|
1236
|
+
const nativeCatalog = {};
|
|
1237
|
+
for (const key in data.data.data) {
|
|
1238
|
+
const { priceString, ...rest } = data.data.data[key];
|
|
1239
|
+
nativeCatalog[key] = rest;
|
|
1240
|
+
}
|
|
1241
|
+
log("nativeCatalog:", nativeCatalog);
|
|
1242
|
+
window.CanvasAgent?.instance?.setNativeCatalog(nativeCatalog);
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
isWindowMessageListenerAttached = true;
|
|
1246
|
+
}
|
|
1247
|
+
const msg = transformPaymentContractIdsToNativePriceEvent(event.paymentContractIds);
|
|
1248
|
+
window.postMessage(msg, "*");
|
|
1249
|
+
log("Event `lemonstand.nativePrice` sent");
|
|
1250
|
+
}
|
|
1251
|
+
break;
|
|
1252
|
+
}
|
|
1253
|
+
case "native_checkout_request" /* NATIVE_CHECKOUT_REQUEST */: {
|
|
1254
|
+
const { paymentContract, sessionId, offerId, distributionPlatform } = event;
|
|
1255
|
+
const { zoneId } = globalState.getStore();
|
|
1256
|
+
window.postMessage(
|
|
1257
|
+
{
|
|
1258
|
+
eventName: "lemonstand.nativePay",
|
|
1259
|
+
eventType: "bubble",
|
|
1260
|
+
nativePayInfo: {
|
|
1261
|
+
pkg: {
|
|
1262
|
+
price: paymentContract?.price?.amount,
|
|
1263
|
+
productIdMS: "",
|
|
1264
|
+
productIds: createProductIdsForPlatform(distributionPlatform, paymentContract?.id),
|
|
1265
|
+
tier: Number(paymentContract?.id?.split("_")?.at(-1))
|
|
1266
|
+
},
|
|
1267
|
+
meta: {
|
|
1268
|
+
criteria: window.CanvasAgent?.instance?.getState()?.appConfig?.canvasAppId,
|
|
1269
|
+
lemonstand: true,
|
|
1270
|
+
offerId,
|
|
1271
|
+
sid: sessionId,
|
|
1272
|
+
type: "canvas",
|
|
1273
|
+
// IMPORTANT: type must be 'canvas'
|
|
1274
|
+
zoneId,
|
|
1275
|
+
successUrl: window.location.href
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
},
|
|
1279
|
+
"*"
|
|
1280
|
+
);
|
|
1281
|
+
log("Event `lemonstand.nativePay` sent");
|
|
1282
|
+
break;
|
|
1283
|
+
}
|
|
1284
|
+
default: {
|
|
1285
|
+
break;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
var onOpen = (payload = {}) => {
|
|
1290
|
+
log(import_cxf_events2.CxfEvents.OpenIGS, "payload:", payload);
|
|
1291
|
+
if (payload.sourceId) {
|
|
1292
|
+
globalState.updateStore({
|
|
1293
|
+
sourceId: payload.sourceId
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
const { isCanvas, lastPurchaseTab, gameApi } = globalState.getStore();
|
|
1297
|
+
if (isCanvas) {
|
|
1298
|
+
if (payload.page) {
|
|
1299
|
+
window.CanvasAgent?.instance?.navigate(payload.page);
|
|
1300
|
+
}
|
|
1301
|
+
window.CanvasAgent?.instance?.show();
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
const sid = createSessionId();
|
|
1305
|
+
trackOpenAction(sid);
|
|
1306
|
+
const url = createIframeUrl({
|
|
1307
|
+
sid,
|
|
1308
|
+
page: lastPurchaseTab,
|
|
1309
|
+
...payload
|
|
1310
|
+
});
|
|
1311
|
+
createDialog(url);
|
|
1312
|
+
setTimeout(() => {
|
|
1313
|
+
gameApi.invokeFn("setUnseenOffersCounter", 0);
|
|
1314
|
+
}, 1e3);
|
|
1315
|
+
};
|
|
1316
|
+
var subscribeToCommonCxfEvents = (cxf) => {
|
|
1317
|
+
const pushHandlers = createPushHandlers();
|
|
1318
|
+
cxf.on(import_cxf_events2.CxfEvents.OpenIGS, tryCatch(onOpen));
|
|
1319
|
+
cxf.on(
|
|
1320
|
+
import_cxf_events2.CxfEvents.Push,
|
|
1321
|
+
tryCatch(({ id, payload }) => {
|
|
1322
|
+
log(import_cxf_events2.CxfEvents.Push, id, payload);
|
|
1323
|
+
const handler = pushHandlers[id];
|
|
1324
|
+
handler && handler(payload);
|
|
1325
|
+
})
|
|
1326
|
+
);
|
|
1327
|
+
};
|
|
1328
|
+
var subscribeToGameEvents = (cxf) => {
|
|
1329
|
+
cxf.on(import_cxf_events2.CxfEvents.Login, (e) => {
|
|
1330
|
+
const { gameEvents: eventsInLogin, language, token, zoneId } = e;
|
|
1331
|
+
if (whitelistedZones.has(Number(zoneId))) {
|
|
1332
|
+
globalState.updateStore({
|
|
1333
|
+
isCanvas: true
|
|
1334
|
+
});
|
|
1335
|
+
} else {
|
|
1336
|
+
globalState.updateStore({
|
|
1337
|
+
isCanvas: false
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1341
|
+
const eventNotExistPredicateGenerator = (existingEvents) => (event) => !existingEvents.map((event_) => event_.type).includes(event.type);
|
|
1342
|
+
globalState.updateStore({
|
|
1343
|
+
...e,
|
|
1344
|
+
gameEvents: [...gameEvents.filter(eventNotExistPredicateGenerator(eventsInLogin)), ...eventsInLogin]
|
|
1345
|
+
});
|
|
1346
|
+
log(import_cxf_events2.CxfEvents.Login, globalState.getStore());
|
|
1347
|
+
if (!isCanvas) {
|
|
1348
|
+
globalState.fetchUnreadOfferNotificationsCount();
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
if (typeof window.CanvasAgent?.create === "function") {
|
|
1352
|
+
const { CANVAS_APP_ID_BY_GAME } = globalState.getConfig();
|
|
1353
|
+
const platform = detectPlatform();
|
|
1354
|
+
const canvasApps = CANVAS_APP_ID_BY_GAME[cxf.gameId];
|
|
1355
|
+
const canvasAppId = typeof canvasApps === "string" ? canvasApps : canvasApps[platform];
|
|
1356
|
+
if (!canvasAppId) {
|
|
1357
|
+
logError("Canvas app id not found for platform", { platform, canvasApps });
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1360
|
+
window.CanvasAgent.create({
|
|
1361
|
+
authClientId: "lemonstand",
|
|
1362
|
+
canvasAppId,
|
|
1363
|
+
eventListener,
|
|
1364
|
+
locale: language,
|
|
1365
|
+
token
|
|
1366
|
+
}).then((res) => {
|
|
1367
|
+
window.CanvasAgent.instance = res;
|
|
1368
|
+
log(import_cxf_events2.CxfEvents.Login, "Canvas created");
|
|
1369
|
+
}).catch((error) => {
|
|
1370
|
+
logError("Cannot create instance of Canvas", error);
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
cxf.on(import_cxf_events2.CxfEvents.GameEventUpdate, (e) => {
|
|
1375
|
+
log(import_cxf_events2.CxfEvents.GameEventUpdate, e);
|
|
1376
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1377
|
+
const updatedEventTypes = new Set(e.map((event) => event.type));
|
|
1378
|
+
globalState.updateStore({
|
|
1379
|
+
gameEvents: [...gameEvents.filter((event) => !updatedEventTypes.has(event.type)), ...e]
|
|
1380
|
+
});
|
|
1381
|
+
if (isCanvas) {
|
|
1382
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1383
|
+
}
|
|
1384
|
+
log(import_cxf_events2.CxfEvents.GameEventUpdate, "reducer", globalState.getStore());
|
|
1385
|
+
});
|
|
1386
|
+
cxf.on(import_cxf_events2.CxfEvents.GameEventAdd, (e) => {
|
|
1387
|
+
log(import_cxf_events2.CxfEvents.GameEventAdd, e);
|
|
1388
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1389
|
+
globalState.updateStore({
|
|
1390
|
+
gameEvents: [...gameEvents, e]
|
|
1391
|
+
});
|
|
1392
|
+
if (isCanvas) {
|
|
1393
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1394
|
+
}
|
|
1395
|
+
log(import_cxf_events2.CxfEvents.GameEventAdd, "reducer", globalState.getStore());
|
|
1396
|
+
});
|
|
1397
|
+
cxf.on(import_cxf_events2.CxfEvents.GameEventRemove, (e) => {
|
|
1398
|
+
log(import_cxf_events2.CxfEvents.GameEventRemove, e);
|
|
1399
|
+
const { gameEvents, isCanvas } = globalState.getStore();
|
|
1400
|
+
globalState.updateStore({
|
|
1401
|
+
gameEvents: gameEvents.filter(({ type }) => type !== e)
|
|
1402
|
+
});
|
|
1403
|
+
if (isCanvas) {
|
|
1404
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1405
|
+
}
|
|
1406
|
+
log(import_cxf_events2.CxfEvents.GameEventRemove, "reducer", globalState.getStore());
|
|
1407
|
+
});
|
|
1408
|
+
cxf.on(import_cxf_events2.CxfEvents.LevelChanged, (level) => {
|
|
1409
|
+
log(import_cxf_events2.CxfEvents.LevelChanged, level);
|
|
1410
|
+
const { isCanvas } = globalState.getStore();
|
|
1411
|
+
globalState.updateStore({
|
|
1412
|
+
level
|
|
1413
|
+
});
|
|
1414
|
+
log(import_cxf_events2.CxfEvents.LevelChanged, "reducer", globalState.getStore());
|
|
1415
|
+
if (isCanvas) {
|
|
1416
|
+
window.CanvasAgent?.instance?.refresh();
|
|
1417
|
+
} else {
|
|
1418
|
+
globalState.fetchUnreadOfferNotificationsCount();
|
|
1419
|
+
}
|
|
1420
|
+
});
|
|
1421
|
+
cxf.on(import_cxf_events2.CxfEvents.LegendLevelChanged, (legendLevel) => {
|
|
1422
|
+
log(import_cxf_events2.CxfEvents.LegendLevelChanged, `legendLevel: ${legendLevel}`);
|
|
1423
|
+
globalState.updateStore({
|
|
1424
|
+
legendLevel
|
|
1425
|
+
});
|
|
1426
|
+
const store = globalState.getStore();
|
|
1427
|
+
log(import_cxf_events2.CxfEvents.LegendLevelChanged, "reducer", store);
|
|
1428
|
+
globalState.fetchUnreadOfferNotificationsCount();
|
|
1429
|
+
});
|
|
1430
|
+
};
|
|
1431
|
+
var subscribeToNativeSubscriptionEnable = (cxf) => {
|
|
1432
|
+
cxf.on("cxf.native.subscription.enable" /* CXF_NATIVE_SUBSCRIPTION_ENABLE */, (enabled) => {
|
|
1433
|
+
globalState.updateStore({
|
|
1434
|
+
subscriptionDisabled: enabled === 0,
|
|
1435
|
+
customizationSuffix: enabled === 0 ? "no-subscription" : ""
|
|
1436
|
+
});
|
|
1437
|
+
globalState.preResolveConfig();
|
|
1438
|
+
});
|
|
1439
|
+
};
|
|
1440
|
+
var subscribeToCustomizationSuffix = (cxf) => {
|
|
1441
|
+
cxf.on("cxf.set.customization.surfix" /* CXF_SET_CUSTOMIZATION_SUFFIX */, (suffix) => {
|
|
1442
|
+
const { customizationSuffix } = globalState.getStore();
|
|
1443
|
+
if (suffix === customizationSuffix) {
|
|
1444
|
+
return;
|
|
1445
|
+
}
|
|
1446
|
+
globalState.updateStore({
|
|
1447
|
+
customizationSuffix: suffix || ""
|
|
1448
|
+
});
|
|
1449
|
+
globalState.preResolveConfig();
|
|
1450
|
+
});
|
|
1451
|
+
};
|
|
1452
|
+
var subscribeToAdStatus = (cxf) => {
|
|
1453
|
+
const config = globalState.getConfig();
|
|
1454
|
+
cxf.on(config.CXF_AD_STATUS, ({ areBannersAvailable, bannersDetails }) => {
|
|
1455
|
+
globalState.updateStore({
|
|
1456
|
+
adStatus: {
|
|
1457
|
+
areBannersAvailable,
|
|
1458
|
+
bannersDetails
|
|
1459
|
+
}
|
|
1460
|
+
});
|
|
1461
|
+
});
|
|
1462
|
+
};
|
|
1463
|
+
var subscribeToTempServerContext = (cxf) => {
|
|
1464
|
+
cxf.on("cxf.join.temp.server" /* CXF_JOIN_TEMP_SERVER */, (isTemp) => {
|
|
1465
|
+
const store = globalState.getStore();
|
|
1466
|
+
globalState.updateStore({
|
|
1467
|
+
isTempServer: Boolean(isTemp)
|
|
1468
|
+
});
|
|
1469
|
+
if (store.customizationSuffix === "" || store.customizationSuffix === "temp") {
|
|
1470
|
+
globalState.updateStore({
|
|
1471
|
+
customizationSuffix: isTemp ? "temp" : ""
|
|
1472
|
+
});
|
|
1473
|
+
globalState.preResolveConfig();
|
|
1474
|
+
}
|
|
1475
|
+
});
|
|
1476
|
+
};
|
|
1477
|
+
var createCxfEventHandlers = () => {
|
|
1478
|
+
return [
|
|
1479
|
+
subscribeToCommonCxfEvents,
|
|
1480
|
+
subscribeToGameEvents,
|
|
1481
|
+
subscribeToAdStatus,
|
|
1482
|
+
subscribeToTempServerContext,
|
|
1483
|
+
subscribeToNativeSubscriptionEnable,
|
|
1484
|
+
subscribeToCustomizationSuffix
|
|
1485
|
+
];
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
// src/handlers/postMessageHandlers.ts
|
|
1489
|
+
init_define_process();
|
|
1490
|
+
var onSalesPageOpen = () => {
|
|
1491
|
+
log("OnOpenSalesOffersPage");
|
|
1492
|
+
const { isCanvas } = globalState.getStore();
|
|
1493
|
+
if (isCanvas) {
|
|
1494
|
+
window.CanvasAgent?.instance?.navigate("supersale");
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
const sid = createSessionId();
|
|
1498
|
+
const url = createIframeUrl({
|
|
1499
|
+
page: "sale-offers",
|
|
1500
|
+
sid
|
|
1501
|
+
});
|
|
1502
|
+
createDialog(url);
|
|
1503
|
+
};
|
|
1504
|
+
var onLemonstandClose = () => {
|
|
1505
|
+
const store = globalState.getStore();
|
|
1506
|
+
log("onLemonstandClose", store);
|
|
1507
|
+
fetchUnreadOfferNotificationsCount();
|
|
1508
|
+
};
|
|
1509
|
+
var createPostMessageHandlers = () => {
|
|
1510
|
+
return {
|
|
1511
|
+
["cxf.webshop.sales.open" /* CXF_OPEN_SALES_MSG */]: onSalesPageOpen,
|
|
1512
|
+
["cxf.dialog.close" /* CXF_DIALOG_CLOSE */]: onLemonstandClose
|
|
1513
|
+
};
|
|
1514
|
+
};
|
|
1515
|
+
|
|
1516
|
+
// src/app.ts
|
|
1517
|
+
var app = (cxf) => {
|
|
1518
|
+
const postMessageHandlers = createPostMessageHandlers();
|
|
1519
|
+
const subscribeCxf = createCxfEventHandlers();
|
|
1520
|
+
window.addEventListener(
|
|
1521
|
+
"message",
|
|
1522
|
+
tryCatch(({ data }) => {
|
|
1523
|
+
if (data) {
|
|
1524
|
+
const handler = postMessageHandlers[data.name];
|
|
1525
|
+
if (handler) {
|
|
1526
|
+
log("POST MESSAGE", data);
|
|
1527
|
+
handler(data.payload);
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
})
|
|
1531
|
+
);
|
|
1532
|
+
for (const handler of subscribeCxf) {
|
|
1533
|
+
handler(cxf);
|
|
1534
|
+
}
|
|
1535
|
+
globalState.preResolveConfig();
|
|
1536
|
+
log("App has started");
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
// src/index.ts
|
|
1540
|
+
require_dist().then((cxf) => {
|
|
1541
|
+
const config = createConfig(cxf.gameId);
|
|
1542
|
+
globalState.setConfig(config);
|
|
1543
|
+
globalState.setCxf(cxf);
|
|
1544
|
+
const store = initializeStore(cxf);
|
|
1545
|
+
globalState.setStore(store);
|
|
1546
|
+
loadScript(config.CANVAS_AGENT_URL).then(() => {
|
|
1547
|
+
log(`Canvas agent loaded: ${config.CANVAS_AGENT_URL}`);
|
|
1548
|
+
}).catch((error) => {
|
|
1549
|
+
logError("Canvas agent load error", error);
|
|
1550
|
+
});
|
|
1551
|
+
app(cxf);
|
|
1552
|
+
});
|
|
1553
|
+
})();
|
|
1554
|
+
|