@ticketapp-dev/shop-sdk 1.0.26 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -60,22 +60,22 @@ function et(e) {
|
|
|
60
60
|
}
|
|
61
61
|
function Re(e, t) {
|
|
62
62
|
const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, u = t.line === 1 ? n : 0, h = t.column + u, p = `${e.name}:${o}:${h}
|
|
63
|
-
`, c = r.split(/\r\n|[\n\r]/g),
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
for (let T = 0; T <
|
|
67
|
-
I.push(
|
|
63
|
+
`, c = r.split(/\r\n|[\n\r]/g), g = c[i];
|
|
64
|
+
if (g.length > 120) {
|
|
65
|
+
const m = Math.floor(h / 80), y = h % 80, I = [];
|
|
66
|
+
for (let T = 0; T < g.length; T += 80)
|
|
67
|
+
I.push(g.slice(T, T + 80));
|
|
68
68
|
return p + he([
|
|
69
69
|
[`${o} |`, I[0]],
|
|
70
|
-
...I.slice(1,
|
|
70
|
+
...I.slice(1, m + 1).map((T) => ["|", T]),
|
|
71
71
|
["|", "^".padStart(y)],
|
|
72
|
-
["|", I[
|
|
72
|
+
["|", I[m + 1]]
|
|
73
73
|
]);
|
|
74
74
|
}
|
|
75
75
|
return p + he([
|
|
76
76
|
// Lines specified like this: ["prefix", "string"],
|
|
77
77
|
[`${o - 1} |`, c[i - 1]],
|
|
78
|
-
[`${o} |`,
|
|
78
|
+
[`${o} |`, g],
|
|
79
79
|
["|", "^".padStart(h)],
|
|
80
80
|
[`${o + 1} |`, c[i + 1]]
|
|
81
81
|
]);
|
|
@@ -137,18 +137,18 @@ class ue extends Error {
|
|
|
137
137
|
*/
|
|
138
138
|
constructor(t, ...n) {
|
|
139
139
|
var r, i, s;
|
|
140
|
-
const { nodes: o, source: u, positions: h, path: p, originalError: c, extensions:
|
|
140
|
+
const { nodes: o, source: u, positions: h, path: p, originalError: c, extensions: g } = tt(n);
|
|
141
141
|
super(t), this.name = "GraphQLError", this.path = p ?? void 0, this.originalError = c ?? void 0, this.nodes = fe(
|
|
142
142
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
143
143
|
);
|
|
144
|
-
const
|
|
144
|
+
const m = fe(
|
|
145
145
|
(r = this.nodes) === null || r === void 0 ? void 0 : r.map((I) => I.loc).filter((I) => I != null)
|
|
146
146
|
);
|
|
147
|
-
this.source = u ?? (
|
|
147
|
+
this.source = u ?? (m == null || (i = m[0]) === null || i === void 0 ? void 0 : i.source), this.positions = h ?? m?.map((I) => I.start), this.locations = h && u ? h.map((I) => se(u, I)) : m?.map((I) => se(I.source, I.start));
|
|
148
148
|
const y = Ke(
|
|
149
149
|
c?.extensions
|
|
150
150
|
) ? c?.extensions : void 0;
|
|
151
|
-
this.extensions = (s =
|
|
151
|
+
this.extensions = (s = g ?? y) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
152
152
|
message: {
|
|
153
153
|
writable: !0,
|
|
154
154
|
enumerable: !0
|
|
@@ -370,7 +370,7 @@ const we = {
|
|
|
370
370
|
DirectiveCoordinate: ["name"],
|
|
371
371
|
DirectiveArgumentCoordinate: ["name", "argumentName"]
|
|
372
372
|
}, rt = new Set(Object.keys(we));
|
|
373
|
-
function
|
|
373
|
+
function ge(e) {
|
|
374
374
|
const t = e?.kind;
|
|
375
375
|
return typeof t == "string" && rt.has(t);
|
|
376
376
|
}
|
|
@@ -426,11 +426,11 @@ function at(e, t) {
|
|
|
426
426
|
// add leading and trailing new lines only if it improves readability
|
|
427
427
|
!i || e.length > 70 || p || s || o
|
|
428
428
|
);
|
|
429
|
-
let
|
|
430
|
-
const
|
|
431
|
-
return (c && !
|
|
432
|
-
`),
|
|
433
|
-
`), '"""' +
|
|
429
|
+
let g = "";
|
|
430
|
+
const m = i && ae(e.charCodeAt(0));
|
|
431
|
+
return (c && !m || s) && (g += `
|
|
432
|
+
`), g += n, (c || p) && (g += `
|
|
433
|
+
`), '"""' + g + '"""';
|
|
434
434
|
}
|
|
435
435
|
var a;
|
|
436
436
|
(function(e) {
|
|
@@ -684,7 +684,7 @@ function ht(e, t) {
|
|
|
684
684
|
return o += n.slice(s, i), v(e, a.STRING, t, i + 1, o);
|
|
685
685
|
if (u === 92) {
|
|
686
686
|
o += n.slice(s, i);
|
|
687
|
-
const h = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? ft(e, i) :
|
|
687
|
+
const h = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? ft(e, i) : gt(e, i) : mt(e, i);
|
|
688
688
|
o += h.value, i += h.size, s = i;
|
|
689
689
|
continue;
|
|
690
690
|
}
|
|
@@ -731,15 +731,15 @@ function ft(e, t) {
|
|
|
731
731
|
)}".`
|
|
732
732
|
);
|
|
733
733
|
}
|
|
734
|
-
function
|
|
735
|
-
const n = e.source.body, r =
|
|
734
|
+
function gt(e, t) {
|
|
735
|
+
const n = e.source.body, r = me(n, t + 2);
|
|
736
736
|
if ($(r))
|
|
737
737
|
return {
|
|
738
738
|
value: String.fromCodePoint(r),
|
|
739
739
|
size: 6
|
|
740
740
|
};
|
|
741
741
|
if (Ve(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
742
|
-
const i =
|
|
742
|
+
const i = me(n, t + 8);
|
|
743
743
|
if (Ue(i))
|
|
744
744
|
return {
|
|
745
745
|
value: String.fromCodePoint(r, i),
|
|
@@ -752,13 +752,13 @@ function mt(e, t) {
|
|
|
752
752
|
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
|
|
753
753
|
);
|
|
754
754
|
}
|
|
755
|
-
function
|
|
755
|
+
function me(e, t) {
|
|
756
756
|
return U(e.charCodeAt(t)) << 12 | U(e.charCodeAt(t + 1)) << 8 | U(e.charCodeAt(t + 2)) << 4 | U(e.charCodeAt(t + 3));
|
|
757
757
|
}
|
|
758
758
|
function U(e) {
|
|
759
759
|
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function mt(e, t) {
|
|
762
762
|
const n = e.source.body;
|
|
763
763
|
switch (n.charCodeAt(t + 1)) {
|
|
764
764
|
case 34:
|
|
@@ -2333,62 +2333,62 @@ function Ft(e, t, n = we) {
|
|
|
2333
2333
|
const r = /* @__PURE__ */ new Map();
|
|
2334
2334
|
for (const O of Object.values(l))
|
|
2335
2335
|
r.set(O, wt(t, O));
|
|
2336
|
-
let i, s = Array.isArray(e), o = [e], u = -1, h = [], p = e, c,
|
|
2337
|
-
const
|
|
2336
|
+
let i, s = Array.isArray(e), o = [e], u = -1, h = [], p = e, c, g;
|
|
2337
|
+
const m = [], y = [];
|
|
2338
2338
|
do {
|
|
2339
2339
|
u++;
|
|
2340
2340
|
const O = u === o.length, L = O && h.length !== 0;
|
|
2341
2341
|
if (O) {
|
|
2342
|
-
if (c = y.length === 0 ? void 0 :
|
|
2342
|
+
if (c = y.length === 0 ? void 0 : m[m.length - 1], p = g, g = y.pop(), L)
|
|
2343
2343
|
if (s) {
|
|
2344
2344
|
p = p.slice();
|
|
2345
|
-
let
|
|
2346
|
-
for (const [D,
|
|
2347
|
-
const
|
|
2348
|
-
|
|
2345
|
+
let P = 0;
|
|
2346
|
+
for (const [D, b] of h) {
|
|
2347
|
+
const S = D - P;
|
|
2348
|
+
b === null ? (p.splice(S, 1), P++) : p[S] = b;
|
|
2349
2349
|
}
|
|
2350
2350
|
} else {
|
|
2351
2351
|
p = { ...p };
|
|
2352
|
-
for (const [
|
|
2353
|
-
p[
|
|
2352
|
+
for (const [P, D] of h)
|
|
2353
|
+
p[P] = D;
|
|
2354
2354
|
}
|
|
2355
2355
|
u = i.index, o = i.keys, h = i.edits, s = i.inArray, i = i.prev;
|
|
2356
|
-
} else if (
|
|
2357
|
-
if (c = s ? u : o[u], p =
|
|
2356
|
+
} else if (g) {
|
|
2357
|
+
if (c = s ? u : o[u], p = g[c], p == null)
|
|
2358
2358
|
continue;
|
|
2359
|
-
|
|
2359
|
+
m.push(c);
|
|
2360
2360
|
}
|
|
2361
2361
|
let k;
|
|
2362
2362
|
if (!Array.isArray(p)) {
|
|
2363
2363
|
var I, T;
|
|
2364
|
-
|
|
2365
|
-
const
|
|
2366
|
-
if (k =
|
|
2364
|
+
ge(p) || G(!1, `Invalid AST Node: ${le(p)}.`);
|
|
2365
|
+
const P = O ? (I = r.get(p.kind)) === null || I === void 0 ? void 0 : I.leave : (T = r.get(p.kind)) === null || T === void 0 ? void 0 : T.enter;
|
|
2366
|
+
if (k = P?.call(t, p, c, g, m, y), k === Rt)
|
|
2367
2367
|
break;
|
|
2368
2368
|
if (k === !1) {
|
|
2369
2369
|
if (!O) {
|
|
2370
|
-
|
|
2370
|
+
m.pop();
|
|
2371
2371
|
continue;
|
|
2372
2372
|
}
|
|
2373
2373
|
} else if (k !== void 0 && (h.push([c, k]), !O))
|
|
2374
|
-
if (
|
|
2374
|
+
if (ge(k))
|
|
2375
2375
|
p = k;
|
|
2376
2376
|
else {
|
|
2377
|
-
|
|
2377
|
+
m.pop();
|
|
2378
2378
|
continue;
|
|
2379
2379
|
}
|
|
2380
2380
|
}
|
|
2381
2381
|
if (k === void 0 && L && h.push([c, p]), O)
|
|
2382
|
-
|
|
2382
|
+
m.pop();
|
|
2383
2383
|
else {
|
|
2384
|
-
var
|
|
2384
|
+
var N;
|
|
2385
2385
|
i = {
|
|
2386
2386
|
inArray: s,
|
|
2387
2387
|
index: u,
|
|
2388
2388
|
keys: o,
|
|
2389
2389
|
edits: h,
|
|
2390
2390
|
prev: i
|
|
2391
|
-
}, s = Array.isArray(p), o = s ? p : (
|
|
2391
|
+
}, s = Array.isArray(p), o = s ? p : (N = n[p.kind]) !== null && N !== void 0 ? N : [], u = -1, h = [], g && y.push(g), g = p;
|
|
2392
2392
|
}
|
|
2393
2393
|
} while (i !== void 0);
|
|
2394
2394
|
return h.length !== 0 ? h[h.length - 1][1] : e;
|
|
@@ -2441,7 +2441,7 @@ const Bt = 80, Vt = {
|
|
|
2441
2441
|
`) + e + ": " + t + f(" = ", n) + f(" ", d(r, " "))
|
|
2442
2442
|
},
|
|
2443
2443
|
SelectionSet: {
|
|
2444
|
-
leave: ({ selections: e }) =>
|
|
2444
|
+
leave: ({ selections: e }) => C(e)
|
|
2445
2445
|
},
|
|
2446
2446
|
Field: {
|
|
2447
2447
|
leave({ alias: e, name: t, arguments: n, directives: r, selectionSet: i }) {
|
|
@@ -2529,7 +2529,7 @@ const Bt = 80, Vt = {
|
|
|
2529
2529
|
// Type System Definitions
|
|
2530
2530
|
SchemaDefinition: {
|
|
2531
2531
|
leave: ({ description: e, directives: t, operationTypes: n }) => f("", e, `
|
|
2532
|
-
`) + d(["schema", d(t, " "),
|
|
2532
|
+
`) + d(["schema", d(t, " "), C(n)], " ")
|
|
2533
2533
|
},
|
|
2534
2534
|
OperationTypeDefinition: {
|
|
2535
2535
|
leave: ({ operation: e, type: t }) => e + ": " + t
|
|
@@ -2546,7 +2546,7 @@ const Bt = 80, Vt = {
|
|
|
2546
2546
|
t,
|
|
2547
2547
|
f("implements ", d(n, " & ")),
|
|
2548
2548
|
d(r, " "),
|
|
2549
|
-
|
|
2549
|
+
C(i)
|
|
2550
2550
|
],
|
|
2551
2551
|
" "
|
|
2552
2552
|
)
|
|
@@ -2573,7 +2573,7 @@ const Bt = 80, Vt = {
|
|
|
2573
2573
|
t,
|
|
2574
2574
|
f("implements ", d(n, " & ")),
|
|
2575
2575
|
d(r, " "),
|
|
2576
|
-
|
|
2576
|
+
C(i)
|
|
2577
2577
|
],
|
|
2578
2578
|
" "
|
|
2579
2579
|
)
|
|
@@ -2587,7 +2587,7 @@ const Bt = 80, Vt = {
|
|
|
2587
2587
|
},
|
|
2588
2588
|
EnumTypeDefinition: {
|
|
2589
2589
|
leave: ({ description: e, name: t, directives: n, values: r }) => f("", e, `
|
|
2590
|
-
`) + d(["enum", t, d(n, " "),
|
|
2590
|
+
`) + d(["enum", t, d(n, " "), C(r)], " ")
|
|
2591
2591
|
},
|
|
2592
2592
|
EnumValueDefinition: {
|
|
2593
2593
|
leave: ({ description: e, name: t, directives: n }) => f("", e, `
|
|
@@ -2595,7 +2595,7 @@ const Bt = 80, Vt = {
|
|
|
2595
2595
|
},
|
|
2596
2596
|
InputObjectTypeDefinition: {
|
|
2597
2597
|
leave: ({ description: e, name: t, directives: n, fields: r }) => f("", e, `
|
|
2598
|
-
`) + d(["input", t, d(n, " "),
|
|
2598
|
+
`) + d(["input", t, d(n, " "), C(r)], " ")
|
|
2599
2599
|
},
|
|
2600
2600
|
DirectiveDefinition: {
|
|
2601
2601
|
leave: ({ description: e, name: t, arguments: n, repeatable: r, locations: i }) => f("", e, `
|
|
@@ -2606,7 +2606,7 @@ const Bt = 80, Vt = {
|
|
|
2606
2606
|
},
|
|
2607
2607
|
SchemaExtension: {
|
|
2608
2608
|
leave: ({ directives: e, operationTypes: t }) => d(
|
|
2609
|
-
["extend schema", d(e, " "),
|
|
2609
|
+
["extend schema", d(e, " "), C(t)],
|
|
2610
2610
|
" "
|
|
2611
2611
|
)
|
|
2612
2612
|
},
|
|
@@ -2620,7 +2620,7 @@ const Bt = 80, Vt = {
|
|
|
2620
2620
|
e,
|
|
2621
2621
|
f("implements ", d(t, " & ")),
|
|
2622
2622
|
d(n, " "),
|
|
2623
|
-
|
|
2623
|
+
C(r)
|
|
2624
2624
|
],
|
|
2625
2625
|
" "
|
|
2626
2626
|
)
|
|
@@ -2632,7 +2632,7 @@ const Bt = 80, Vt = {
|
|
|
2632
2632
|
e,
|
|
2633
2633
|
f("implements ", d(t, " & ")),
|
|
2634
2634
|
d(n, " "),
|
|
2635
|
-
|
|
2635
|
+
C(r)
|
|
2636
2636
|
],
|
|
2637
2637
|
" "
|
|
2638
2638
|
)
|
|
@@ -2649,10 +2649,10 @@ const Bt = 80, Vt = {
|
|
|
2649
2649
|
)
|
|
2650
2650
|
},
|
|
2651
2651
|
EnumTypeExtension: {
|
|
2652
|
-
leave: ({ name: e, directives: t, values: n }) => d(["extend enum", e, d(t, " "),
|
|
2652
|
+
leave: ({ name: e, directives: t, values: n }) => d(["extend enum", e, d(t, " "), C(n)], " ")
|
|
2653
2653
|
},
|
|
2654
2654
|
InputObjectTypeExtension: {
|
|
2655
|
-
leave: ({ name: e, directives: t, fields: n }) => d(["extend input", e, d(t, " "),
|
|
2655
|
+
leave: ({ name: e, directives: t, fields: n }) => d(["extend input", e, d(t, " "), C(n)], " ")
|
|
2656
2656
|
},
|
|
2657
2657
|
// Schema Coordinates
|
|
2658
2658
|
TypeCoordinate: {
|
|
@@ -2675,7 +2675,7 @@ function d(e, t = "") {
|
|
|
2675
2675
|
var n;
|
|
2676
2676
|
return (n = e?.filter((r) => r).join(t)) !== null && n !== void 0 ? n : "";
|
|
2677
2677
|
}
|
|
2678
|
-
function
|
|
2678
|
+
function C(e) {
|
|
2679
2679
|
return f(`{
|
|
2680
2680
|
`, Y(d(e, `
|
|
2681
2681
|
`)), `
|
|
@@ -3090,7 +3090,7 @@ const Ie = {
|
|
|
3090
3090
|
clearBasket: () => Ie
|
|
3091
3091
|
}
|
|
3092
3092
|
}), {
|
|
3093
|
-
setProcessing:
|
|
3093
|
+
setProcessing: x,
|
|
3094
3094
|
initializeOrder: j,
|
|
3095
3095
|
addProduct: Ee,
|
|
3096
3096
|
removeProduct: sn,
|
|
@@ -3118,6 +3118,9 @@ class cn {
|
|
|
3118
3118
|
subscribe(t) {
|
|
3119
3119
|
return this.store.subscribe(t);
|
|
3120
3120
|
}
|
|
3121
|
+
getProcessing() {
|
|
3122
|
+
return this.getState().processing;
|
|
3123
|
+
}
|
|
3121
3124
|
getCurrentOrder() {
|
|
3122
3125
|
const t = this.getState();
|
|
3123
3126
|
if (!t.order)
|
|
@@ -3133,7 +3136,7 @@ class cn {
|
|
|
3133
3136
|
}
|
|
3134
3137
|
// Basket update functions
|
|
3135
3138
|
async addProduct(t) {
|
|
3136
|
-
this.store.dispatch(
|
|
3139
|
+
this.store.dispatch(x(!0));
|
|
3137
3140
|
try {
|
|
3138
3141
|
const r = this.getState().order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3139
3142
|
this.debugLog("Adding product", {
|
|
@@ -3175,13 +3178,13 @@ class cn {
|
|
|
3175
3178
|
} catch (n) {
|
|
3176
3179
|
throw this.debugLog("Error adding product", n), this.handleError(n), n;
|
|
3177
3180
|
} finally {
|
|
3178
|
-
this.store.dispatch(
|
|
3181
|
+
this.store.dispatch(x(!1));
|
|
3179
3182
|
}
|
|
3180
3183
|
}
|
|
3181
3184
|
async removeProduct(t) {
|
|
3182
3185
|
const r = this.getState().order;
|
|
3183
3186
|
if (r) {
|
|
3184
|
-
this.store.dispatch(
|
|
3187
|
+
this.store.dispatch(x(!0));
|
|
3185
3188
|
try {
|
|
3186
3189
|
this.debugLog("Removing product", {
|
|
3187
3190
|
productId: t.id,
|
|
@@ -3214,12 +3217,12 @@ class cn {
|
|
|
3214
3217
|
} catch (i) {
|
|
3215
3218
|
throw this.debugLog("Error removing product", i), this.handleError(i), i;
|
|
3216
3219
|
} finally {
|
|
3217
|
-
this.store.dispatch(
|
|
3220
|
+
this.store.dispatch(x(!1));
|
|
3218
3221
|
}
|
|
3219
3222
|
}
|
|
3220
3223
|
}
|
|
3221
3224
|
async configurePackage(t) {
|
|
3222
|
-
this.store.dispatch(
|
|
3225
|
+
this.store.dispatch(x(!0));
|
|
3223
3226
|
try {
|
|
3224
3227
|
const r = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId(), i = t.items.map((o) => ({
|
|
3225
3228
|
packageItemId: o.packageItemId,
|
|
@@ -3260,17 +3263,17 @@ class cn {
|
|
|
3260
3263
|
} catch (n) {
|
|
3261
3264
|
return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
|
|
3262
3265
|
} finally {
|
|
3263
|
-
this.store.dispatch(
|
|
3266
|
+
this.store.dispatch(x(!1));
|
|
3264
3267
|
}
|
|
3265
3268
|
}
|
|
3266
3269
|
async configureDelivery(t) {
|
|
3267
|
-
this.store.dispatch(
|
|
3270
|
+
this.store.dispatch(x(!0));
|
|
3268
3271
|
try {
|
|
3269
3272
|
this.store.dispatch(on(t));
|
|
3270
3273
|
} catch (n) {
|
|
3271
3274
|
throw this.debugLog("Error setting delivery", n), this.handleError(n), n;
|
|
3272
3275
|
} finally {
|
|
3273
|
-
this.store.dispatch(
|
|
3276
|
+
this.store.dispatch(x(!1));
|
|
3274
3277
|
}
|
|
3275
3278
|
}
|
|
3276
3279
|
async configureCustomer(t) {
|
|
@@ -3289,7 +3292,7 @@ class cn {
|
|
|
3289
3292
|
}
|
|
3290
3293
|
}
|
|
3291
3294
|
async reserveAdditionalPackageItem(t) {
|
|
3292
|
-
this.store.dispatch(
|
|
3295
|
+
this.store.dispatch(x(!0));
|
|
3293
3296
|
try {
|
|
3294
3297
|
const r = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3295
3298
|
this.debugLog("reserve additional packageItem", {
|
|
@@ -3326,7 +3329,7 @@ class cn {
|
|
|
3326
3329
|
} catch (n) {
|
|
3327
3330
|
return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
|
|
3328
3331
|
} finally {
|
|
3329
|
-
this.store.dispatch(
|
|
3332
|
+
this.store.dispatch(x(!1));
|
|
3330
3333
|
}
|
|
3331
3334
|
}
|
|
3332
3335
|
// Cancel and clear order functions
|
|
@@ -3340,10 +3343,10 @@ class cn {
|
|
|
3340
3343
|
// Private functions for fetching the current order from a session
|
|
3341
3344
|
async restoreOrderFromSession() {
|
|
3342
3345
|
const t = sessionStorage.getItem(this.orderIdKey);
|
|
3343
|
-
if (t) {
|
|
3346
|
+
if (this.store.dispatch(x(!0)), t) {
|
|
3344
3347
|
this.debugLog("Found existing order ID in session, restoring...", { orderId: t });
|
|
3345
3348
|
try {
|
|
3346
|
-
await this.fetchOrder(t), this.debugLog("Order restored successfully");
|
|
3349
|
+
await this.fetchOrder(t), this.debugLog("Order restored successfully"), this.store.dispatch(x(!1));
|
|
3347
3350
|
} catch (n) {
|
|
3348
3351
|
this.debugLog("Failed to restore order, clearing session", n), this.clearOrderFromSession();
|
|
3349
3352
|
}
|
|
@@ -3360,10 +3363,10 @@ class cn {
|
|
|
3360
3363
|
const r = n.findOrder;
|
|
3361
3364
|
this.debugLog("Order fetched successfully", r);
|
|
3362
3365
|
const i = r.items, s = i.filter((c) => c.product != null && c.amount > 0).map((c) => {
|
|
3363
|
-
let
|
|
3364
|
-
return c.product.type === "PROMOTER" ?
|
|
3366
|
+
let g = _.PRODUCT;
|
|
3367
|
+
return c.product.type === "PROMOTER" ? g = _.ADD_ONS : c.product.type === "PICKUP" ? g = _.PICKUP : c.product.type === "DELIVERY" && (g = _.DELIVERY), {
|
|
3365
3368
|
id: c.product.id,
|
|
3366
|
-
type:
|
|
3369
|
+
type: g,
|
|
3367
3370
|
name: c.product.name,
|
|
3368
3371
|
icon: c.product.icon,
|
|
3369
3372
|
description: c.product.description,
|
|
@@ -3372,42 +3375,42 @@ class cn {
|
|
|
3372
3375
|
depositPrice: c.depositPrice ?? 0,
|
|
3373
3376
|
originalPrice: c.originalPrice ?? 0,
|
|
3374
3377
|
serviceFee: c.serviceFee ?? 0,
|
|
3375
|
-
seats: c.seats?.map((
|
|
3376
|
-
id:
|
|
3377
|
-
label:
|
|
3378
|
+
seats: c.seats?.map((m) => ({
|
|
3379
|
+
id: m.id,
|
|
3380
|
+
label: m.label
|
|
3378
3381
|
}))
|
|
3379
3382
|
};
|
|
3380
|
-
}), o = i.filter((c) => c.packageItem != null && c.amount > 0).reduce((c,
|
|
3383
|
+
}), o = i.filter((c) => c.packageItem != null && c.amount > 0).reduce((c, g) => {
|
|
3381
3384
|
const {
|
|
3382
|
-
packageItem:
|
|
3385
|
+
packageItem: m,
|
|
3383
3386
|
event: y,
|
|
3384
3387
|
amount: I,
|
|
3385
3388
|
price: T,
|
|
3386
|
-
serviceFee:
|
|
3389
|
+
serviceFee: N,
|
|
3387
3390
|
depositPrice: O,
|
|
3388
3391
|
originalPrice: L
|
|
3389
|
-
} =
|
|
3390
|
-
c[k] ? (c[k].price += T ?? 0, c[k].serviceFee +=
|
|
3392
|
+
} = g, k = m.package.id;
|
|
3393
|
+
c[k] ? (c[k].price += T ?? 0, c[k].serviceFee += N ?? 0, c[k].originalPrice += L ?? 0, c[k].depositPrice += O ?? T ?? 0) : c[k] = {
|
|
3391
3394
|
id: k,
|
|
3392
3395
|
type: _.PACKAGE,
|
|
3393
|
-
name:
|
|
3396
|
+
name: m.package.name,
|
|
3394
3397
|
amount: I,
|
|
3395
3398
|
price: T ?? 0,
|
|
3396
|
-
serviceFee:
|
|
3399
|
+
serviceFee: N ?? 0,
|
|
3397
3400
|
depositPrice: O ?? T ?? 0,
|
|
3398
3401
|
originalPrice: L ?? 0,
|
|
3399
3402
|
packageItems: []
|
|
3400
3403
|
};
|
|
3401
|
-
const
|
|
3404
|
+
const P = R.fromISO(y.startAt, {
|
|
3402
3405
|
zone: y.timezone
|
|
3403
3406
|
}), D = R.fromISO(y.endAt, {
|
|
3404
3407
|
zone: y.timezone
|
|
3405
3408
|
});
|
|
3406
3409
|
return c[k].packageItems.push({
|
|
3407
|
-
packageItemId:
|
|
3410
|
+
packageItemId: m.id,
|
|
3408
3411
|
eventId: y.id,
|
|
3409
3412
|
name: y.name,
|
|
3410
|
-
startAt:
|
|
3413
|
+
startAt: P.toJSDate().toISOString(),
|
|
3411
3414
|
endAt: D.toJSDate().toISOString()
|
|
3412
3415
|
}), c;
|
|
3413
3416
|
}, {}), u = [
|
|
@@ -3622,7 +3625,7 @@ function fn(e) {
|
|
|
3622
3625
|
const n = t[1], r = t[2];
|
|
3623
3626
|
return { type: n, name: r };
|
|
3624
3627
|
}
|
|
3625
|
-
async function
|
|
3628
|
+
async function gn(e) {
|
|
3626
3629
|
if (typeof globalThis < "u" && globalThis.crypto?.subtle) {
|
|
3627
3630
|
const n = new TextEncoder().encode(e), r = await globalThis.crypto.subtle.digest("SHA-256", n);
|
|
3628
3631
|
return Array.from(new Uint8Array(r)).map((i) => i.toString(16).padStart(2, "0")).join("");
|
|
@@ -3634,7 +3637,7 @@ async function mn(e) {
|
|
|
3634
3637
|
throw new Error("SHA-256 is not available in this environment");
|
|
3635
3638
|
}
|
|
3636
3639
|
}
|
|
3637
|
-
function
|
|
3640
|
+
function mn(e) {
|
|
3638
3641
|
const t = { "content-type": "application/json" };
|
|
3639
3642
|
if (e)
|
|
3640
3643
|
for (const [n, r] of Object.entries(e))
|
|
@@ -3659,20 +3662,20 @@ class ee extends de {
|
|
|
3659
3662
|
async request(t, ...n) {
|
|
3660
3663
|
let r = t, i, s, o;
|
|
3661
3664
|
t && typeof t == "object" && "document" in t ? (r = t.document, i = t.variables, s = t.requestHeaders, o = t.signal) : (i = n[0], s = n[1]);
|
|
3662
|
-
const u = typeof r == "string" ? r : $t(r), { type: h, name: p } = fn(u), c = await
|
|
3663
|
-
const
|
|
3664
|
-
let
|
|
3665
|
+
const u = typeof r == "string" ? r : $t(r), { type: h, name: p } = fn(u), c = await gn(u), g = i ?? {}, m = this.url ?? this.endpoint ?? "", y = mn(s), I = async (D) => {
|
|
3666
|
+
const b = await fetch(m, { method: "POST", headers: y, body: JSON.stringify(D), signal: o });
|
|
3667
|
+
let S = null;
|
|
3665
3668
|
try {
|
|
3666
|
-
|
|
3669
|
+
S = await b.json();
|
|
3667
3670
|
} catch {
|
|
3668
|
-
|
|
3671
|
+
S = null;
|
|
3669
3672
|
}
|
|
3670
|
-
return { status:
|
|
3673
|
+
return { status: b.status, json: S };
|
|
3671
3674
|
}, T = async (D) => {
|
|
3672
|
-
const
|
|
3675
|
+
const b = new URLSearchParams();
|
|
3673
3676
|
for (const [He, q] of Object.entries(D))
|
|
3674
|
-
typeof q > "u" ||
|
|
3675
|
-
const
|
|
3677
|
+
typeof q > "u" || b.set(He, typeof q == "string" ? q : JSON.stringify(q));
|
|
3678
|
+
const S = m.includes("?") ? "&" : "?", B = `${m}${S}${b.toString()}`, pe = await fetch(B, { method: "GET", headers: y, signal: o });
|
|
3676
3679
|
let te = null;
|
|
3677
3680
|
try {
|
|
3678
3681
|
te = await pe.json();
|
|
@@ -3680,27 +3683,27 @@ class ee extends de {
|
|
|
3680
3683
|
te = null;
|
|
3681
3684
|
}
|
|
3682
3685
|
return { status: pe.status, json: te };
|
|
3683
|
-
},
|
|
3686
|
+
}, N = {
|
|
3684
3687
|
operationName: p,
|
|
3685
|
-
variables:
|
|
3688
|
+
variables: g,
|
|
3686
3689
|
extensions: { persistedQuery: { version: 1, sha256Hash: c } }
|
|
3687
|
-
}, O = async (D,
|
|
3690
|
+
}, O = async (D, b, S) => {
|
|
3688
3691
|
if (ke(D.json?.errors, ["PERSISTED_QUERY_NOT_FOUND", "PersistedQueryNotFound"])) {
|
|
3689
|
-
const B = await
|
|
3690
|
-
return ie("APQ register", u,
|
|
3692
|
+
const B = await b();
|
|
3693
|
+
return ie("APQ register", u, g, p, B);
|
|
3691
3694
|
}
|
|
3692
3695
|
if (ke(D.json?.errors, ["PERSISTED_QUERY_NOT_SUPPORTED"])) {
|
|
3693
|
-
const B = await
|
|
3694
|
-
return ie("no APQ support", u,
|
|
3696
|
+
const B = await S();
|
|
3697
|
+
return ie("no APQ support", u, g, p, B);
|
|
3695
3698
|
}
|
|
3696
|
-
return ie("", u,
|
|
3699
|
+
return ie("", u, g, p, D);
|
|
3697
3700
|
};
|
|
3698
3701
|
if (h === "query") {
|
|
3699
|
-
const D = await T(
|
|
3700
|
-
return O(D, () => I({ ...
|
|
3702
|
+
const D = await T(N);
|
|
3703
|
+
return O(D, () => I({ ...N, query: u }), () => I({ operationName: p, variables: g, query: u }));
|
|
3701
3704
|
}
|
|
3702
|
-
const L = await I(
|
|
3703
|
-
return O(L, () => I({ ...
|
|
3705
|
+
const L = await I(N);
|
|
3706
|
+
return O(L, () => I({ ...N, query: u }), () => I({ operationName: p, variables: g, query: u }));
|
|
3704
3707
|
}
|
|
3705
3708
|
}
|
|
3706
3709
|
class In {
|
|
@@ -12,6 +12,7 @@ export declare class BasketService {
|
|
|
12
12
|
private store;
|
|
13
13
|
constructor(config: BasketServiceConfig);
|
|
14
14
|
subscribe(listener: () => void): import("redux").Unsubscribe;
|
|
15
|
+
getProcessing(): boolean;
|
|
15
16
|
getCurrentOrder(): CurrentOrder | null;
|
|
16
17
|
getSelectedPackageEvent(): string[];
|
|
17
18
|
addProduct(input: ProductInput): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basket.service.d.ts","sourceRoot":"","sources":["../../../lib/services/basket/basket.service.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EAItB,iCAAiC,EAAE,YAAY,EAChD,MAAM,SAAS,CAAA;AAYhB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,GAAG,CAA4B;IACvC,OAAO,CAAC,KAAK,CAAoC;gBAErC,MAAM,EAAE,mBAAmB;IAgBhC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI;
|
|
1
|
+
{"version":3,"file":"basket.service.d.ts","sourceRoot":"","sources":["../../../lib/services/basket/basket.service.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EAItB,iCAAiC,EAAE,YAAY,EAChD,MAAM,SAAS,CAAA;AAYhB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,GAAG,CAA4B;IACvC,OAAO,CAAC,KAAK,CAAoC;gBAErC,MAAM,EAAE,mBAAmB;IAgBhC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI;IAI9B,aAAa,IAAI,OAAO;IAIxB,eAAe,IAAI,YAAY,GAAG,IAAI;IAiBtC,uBAAuB,IAAI,MAAM,EAAE;IAO7B,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA6D9C,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAwDjD,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAyElF,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAY3E,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB/D,4BAA4B,CAAC,KAAK,EAAE,iCAAiC,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAkE1G,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IASlC,qBAAqB,IAAI,IAAI;YAOtB,uBAAuB;YAgBvB,UAAU;IAwMxB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,WAAW;IAwBnB,OAAO,CAAC,QAAQ;CAGjB"}
|