@ticketapp-dev/shop-sdk 1.0.17 → 1.0.20
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 +88 -85
- package/dist/services/basket/basket.service.d.ts.map +1 -1
- package/dist/store/store.d.ts +38 -2769
- package/dist/store/store.d.ts.map +1 -1
- package/dist/types/index.d.ts +9 -10
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/persisted-query/persisted-query-client.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphQLClient as ae } from "graphql-request";
|
|
2
2
|
import { createSlice as We, configureStore as Ze } from "@reduxjs/toolkit";
|
|
3
|
-
import { DateTime as
|
|
3
|
+
import { DateTime as R } from "luxon";
|
|
4
4
|
var Q = function() {
|
|
5
5
|
return Q = Object.assign || function(t) {
|
|
6
6
|
for (var n, i = 1, r = arguments.length; i < r; i++) {
|
|
@@ -2321,20 +2321,20 @@ function Bt(e, t, n = xe) {
|
|
|
2321
2321
|
const g = [], y = [];
|
|
2322
2322
|
do {
|
|
2323
2323
|
u++;
|
|
2324
|
-
const k = u === o.length,
|
|
2324
|
+
const k = u === o.length, L = k && h.length !== 0;
|
|
2325
2325
|
if (k) {
|
|
2326
|
-
if (c = y.length === 0 ? void 0 : g[g.length - 1], p = m, m = y.pop(),
|
|
2326
|
+
if (c = y.length === 0 ? void 0 : g[g.length - 1], p = m, m = y.pop(), L)
|
|
2327
2327
|
if (s) {
|
|
2328
2328
|
p = p.slice();
|
|
2329
|
-
let
|
|
2330
|
-
for (const [D,
|
|
2331
|
-
const
|
|
2332
|
-
|
|
2329
|
+
let N = 0;
|
|
2330
|
+
for (const [D, b] of h) {
|
|
2331
|
+
const P = D - N;
|
|
2332
|
+
b === null ? (p.splice(P, 1), N++) : p[P] = b;
|
|
2333
2333
|
}
|
|
2334
2334
|
} else {
|
|
2335
2335
|
p = { ...p };
|
|
2336
|
-
for (const [
|
|
2337
|
-
p[
|
|
2336
|
+
for (const [N, D] of h)
|
|
2337
|
+
p[N] = D;
|
|
2338
2338
|
}
|
|
2339
2339
|
u = r.index, o = r.keys, h = r.edits, s = r.inArray, r = r.prev;
|
|
2340
2340
|
} else if (m) {
|
|
@@ -2346,8 +2346,8 @@ function Bt(e, t, n = xe) {
|
|
|
2346
2346
|
if (!Array.isArray(p)) {
|
|
2347
2347
|
var I, O;
|
|
2348
2348
|
fe(p) || G(!1, `Invalid AST Node: ${de(p)}.`);
|
|
2349
|
-
const
|
|
2350
|
-
if (T =
|
|
2349
|
+
const N = k ? (I = i.get(p.kind)) === null || I === void 0 ? void 0 : I.leave : (O = i.get(p.kind)) === null || O === void 0 ? void 0 : O.enter;
|
|
2350
|
+
if (T = N?.call(t, p, c, m, g, y), T === $t)
|
|
2351
2351
|
break;
|
|
2352
2352
|
if (T === !1) {
|
|
2353
2353
|
if (!k) {
|
|
@@ -2362,17 +2362,17 @@ function Bt(e, t, n = xe) {
|
|
|
2362
2362
|
continue;
|
|
2363
2363
|
}
|
|
2364
2364
|
}
|
|
2365
|
-
if (T === void 0 &&
|
|
2365
|
+
if (T === void 0 && L && h.push([c, p]), k)
|
|
2366
2366
|
g.pop();
|
|
2367
2367
|
else {
|
|
2368
|
-
var
|
|
2368
|
+
var x;
|
|
2369
2369
|
r = {
|
|
2370
2370
|
inArray: s,
|
|
2371
2371
|
index: u,
|
|
2372
2372
|
keys: o,
|
|
2373
2373
|
edits: h,
|
|
2374
2374
|
prev: r
|
|
2375
|
-
}, s = Array.isArray(p), o = s ? p : (
|
|
2375
|
+
}, s = Array.isArray(p), o = s ? p : (x = n[p.kind]) !== null && x !== void 0 ? x : [], u = -1, h = [], m && y.push(m), m = p;
|
|
2376
2376
|
}
|
|
2377
2377
|
} while (r !== void 0);
|
|
2378
2378
|
return h.length !== 0 ? h[h.length - 1][1] : e;
|
|
@@ -2425,7 +2425,7 @@ const Mt = 80, qt = {
|
|
|
2425
2425
|
`) + e + ": " + t + f(" = ", n) + f(" ", d(i, " "))
|
|
2426
2426
|
},
|
|
2427
2427
|
SelectionSet: {
|
|
2428
|
-
leave: ({ selections: e }) =>
|
|
2428
|
+
leave: ({ selections: e }) => S(e)
|
|
2429
2429
|
},
|
|
2430
2430
|
Field: {
|
|
2431
2431
|
leave({ alias: e, name: t, arguments: n, directives: i, selectionSet: r }) {
|
|
@@ -2513,7 +2513,7 @@ const Mt = 80, qt = {
|
|
|
2513
2513
|
// Type System Definitions
|
|
2514
2514
|
SchemaDefinition: {
|
|
2515
2515
|
leave: ({ description: e, directives: t, operationTypes: n }) => f("", e, `
|
|
2516
|
-
`) + d(["schema", d(t, " "),
|
|
2516
|
+
`) + d(["schema", d(t, " "), S(n)], " ")
|
|
2517
2517
|
},
|
|
2518
2518
|
OperationTypeDefinition: {
|
|
2519
2519
|
leave: ({ operation: e, type: t }) => e + ": " + t
|
|
@@ -2530,7 +2530,7 @@ const Mt = 80, qt = {
|
|
|
2530
2530
|
t,
|
|
2531
2531
|
f("implements ", d(n, " & ")),
|
|
2532
2532
|
d(i, " "),
|
|
2533
|
-
|
|
2533
|
+
S(r)
|
|
2534
2534
|
],
|
|
2535
2535
|
" "
|
|
2536
2536
|
)
|
|
@@ -2557,7 +2557,7 @@ const Mt = 80, qt = {
|
|
|
2557
2557
|
t,
|
|
2558
2558
|
f("implements ", d(n, " & ")),
|
|
2559
2559
|
d(i, " "),
|
|
2560
|
-
|
|
2560
|
+
S(r)
|
|
2561
2561
|
],
|
|
2562
2562
|
" "
|
|
2563
2563
|
)
|
|
@@ -2571,7 +2571,7 @@ const Mt = 80, qt = {
|
|
|
2571
2571
|
},
|
|
2572
2572
|
EnumTypeDefinition: {
|
|
2573
2573
|
leave: ({ description: e, name: t, directives: n, values: i }) => f("", e, `
|
|
2574
|
-
`) + d(["enum", t, d(n, " "),
|
|
2574
|
+
`) + d(["enum", t, d(n, " "), S(i)], " ")
|
|
2575
2575
|
},
|
|
2576
2576
|
EnumValueDefinition: {
|
|
2577
2577
|
leave: ({ description: e, name: t, directives: n }) => f("", e, `
|
|
@@ -2579,7 +2579,7 @@ const Mt = 80, qt = {
|
|
|
2579
2579
|
},
|
|
2580
2580
|
InputObjectTypeDefinition: {
|
|
2581
2581
|
leave: ({ description: e, name: t, directives: n, fields: i }) => f("", e, `
|
|
2582
|
-
`) + d(["input", t, d(n, " "),
|
|
2582
|
+
`) + d(["input", t, d(n, " "), S(i)], " ")
|
|
2583
2583
|
},
|
|
2584
2584
|
DirectiveDefinition: {
|
|
2585
2585
|
leave: ({ description: e, name: t, arguments: n, repeatable: i, locations: r }) => f("", e, `
|
|
@@ -2590,7 +2590,7 @@ const Mt = 80, qt = {
|
|
|
2590
2590
|
},
|
|
2591
2591
|
SchemaExtension: {
|
|
2592
2592
|
leave: ({ directives: e, operationTypes: t }) => d(
|
|
2593
|
-
["extend schema", d(e, " "),
|
|
2593
|
+
["extend schema", d(e, " "), S(t)],
|
|
2594
2594
|
" "
|
|
2595
2595
|
)
|
|
2596
2596
|
},
|
|
@@ -2604,7 +2604,7 @@ const Mt = 80, qt = {
|
|
|
2604
2604
|
e,
|
|
2605
2605
|
f("implements ", d(t, " & ")),
|
|
2606
2606
|
d(n, " "),
|
|
2607
|
-
|
|
2607
|
+
S(i)
|
|
2608
2608
|
],
|
|
2609
2609
|
" "
|
|
2610
2610
|
)
|
|
@@ -2616,7 +2616,7 @@ const Mt = 80, qt = {
|
|
|
2616
2616
|
e,
|
|
2617
2617
|
f("implements ", d(t, " & ")),
|
|
2618
2618
|
d(n, " "),
|
|
2619
|
-
|
|
2619
|
+
S(i)
|
|
2620
2620
|
],
|
|
2621
2621
|
" "
|
|
2622
2622
|
)
|
|
@@ -2633,10 +2633,10 @@ const Mt = 80, qt = {
|
|
|
2633
2633
|
)
|
|
2634
2634
|
},
|
|
2635
2635
|
EnumTypeExtension: {
|
|
2636
|
-
leave: ({ name: e, directives: t, values: n }) => d(["extend enum", e, d(t, " "),
|
|
2636
|
+
leave: ({ name: e, directives: t, values: n }) => d(["extend enum", e, d(t, " "), S(n)], " ")
|
|
2637
2637
|
},
|
|
2638
2638
|
InputObjectTypeExtension: {
|
|
2639
|
-
leave: ({ name: e, directives: t, fields: n }) => d(["extend input", e, d(t, " "),
|
|
2639
|
+
leave: ({ name: e, directives: t, fields: n }) => d(["extend input", e, d(t, " "), S(n)], " ")
|
|
2640
2640
|
},
|
|
2641
2641
|
// Schema Coordinates
|
|
2642
2642
|
TypeCoordinate: {
|
|
@@ -2659,7 +2659,7 @@ function d(e, t = "") {
|
|
|
2659
2659
|
var n;
|
|
2660
2660
|
return (n = e?.filter((i) => i).join(t)) !== null && n !== void 0 ? n : "";
|
|
2661
2661
|
}
|
|
2662
|
-
function
|
|
2662
|
+
function S(e) {
|
|
2663
2663
|
return f(`{
|
|
2664
2664
|
`, Y(d(e, `
|
|
2665
2665
|
`)), `
|
|
@@ -2908,19 +2908,19 @@ class ue extends ae {
|
|
|
2908
2908
|
let i = t, r, s, o;
|
|
2909
2909
|
t && typeof t == "object" && "document" in t ? (i = t.document, r = t.variables, s = t.requestHeaders, o = t.signal) : (r = n[0], s = n[1]);
|
|
2910
2910
|
const u = typeof i == "string" ? i : Vt(i), { type: h, name: p } = nn(u), c = await rn(u), m = r ?? {}, g = this.url ?? this.endpoint ?? "", y = sn(s), I = async (D) => {
|
|
2911
|
-
const
|
|
2912
|
-
let
|
|
2911
|
+
const b = await fetch(g, { method: "POST", headers: y, body: JSON.stringify(D), signal: o });
|
|
2912
|
+
let P = null;
|
|
2913
2913
|
try {
|
|
2914
|
-
|
|
2914
|
+
P = await b.json();
|
|
2915
2915
|
} catch {
|
|
2916
|
-
|
|
2916
|
+
P = null;
|
|
2917
2917
|
}
|
|
2918
|
-
return { status:
|
|
2918
|
+
return { status: b.status, json: P };
|
|
2919
2919
|
}, O = async (D) => {
|
|
2920
|
-
const
|
|
2920
|
+
const b = new URLSearchParams();
|
|
2921
2921
|
for (const [Ke, q] of Object.entries(D))
|
|
2922
|
-
typeof q > "u" ||
|
|
2923
|
-
const
|
|
2922
|
+
typeof q > "u" || b.set(Ke, typeof q == "string" ? q : JSON.stringify(q));
|
|
2923
|
+
const P = g.includes("?") ? "&" : "?", B = `${g}${P}${b.toString()}`, le = await fetch(B, { method: "GET", headers: y, signal: o });
|
|
2924
2924
|
let Z = null;
|
|
2925
2925
|
try {
|
|
2926
2926
|
Z = await le.json();
|
|
@@ -2928,27 +2928,27 @@ class ue extends ae {
|
|
|
2928
2928
|
Z = null;
|
|
2929
2929
|
}
|
|
2930
2930
|
return { status: le.status, json: Z };
|
|
2931
|
-
},
|
|
2931
|
+
}, x = {
|
|
2932
2932
|
operationName: p,
|
|
2933
2933
|
variables: m,
|
|
2934
2934
|
extensions: { persistedQuery: { version: 1, sha256Hash: c } }
|
|
2935
|
-
}, k = async (D,
|
|
2935
|
+
}, k = async (D, b, P) => {
|
|
2936
2936
|
if (ge(D.json?.errors, ["PERSISTED_QUERY_NOT_FOUND", "PersistedQueryNotFound"])) {
|
|
2937
|
-
const B = await
|
|
2937
|
+
const B = await b();
|
|
2938
2938
|
return ne("APQ register", u, m, p, B);
|
|
2939
2939
|
}
|
|
2940
2940
|
if (ge(D.json?.errors, ["PERSISTED_QUERY_NOT_SUPPORTED"])) {
|
|
2941
|
-
const B = await
|
|
2941
|
+
const B = await P();
|
|
2942
2942
|
return ne("no APQ support", u, m, p, B);
|
|
2943
2943
|
}
|
|
2944
2944
|
return ne("", u, m, p, D);
|
|
2945
2945
|
};
|
|
2946
2946
|
if (h === "query") {
|
|
2947
|
-
const D = await O(
|
|
2948
|
-
return k(D, () => I({ ...
|
|
2947
|
+
const D = await O(x);
|
|
2948
|
+
return k(D, () => I({ ...x, query: u }), () => I({ operationName: p, variables: m, query: u }));
|
|
2949
2949
|
}
|
|
2950
|
-
const
|
|
2951
|
-
return k(
|
|
2950
|
+
const L = await I(x);
|
|
2951
|
+
return k(L, () => I({ ...x, query: u }), () => I({ operationName: p, variables: m, query: u }));
|
|
2952
2952
|
}
|
|
2953
2953
|
}
|
|
2954
2954
|
class we {
|
|
@@ -2993,8 +2993,8 @@ class we {
|
|
|
2993
2993
|
banner: r.banner,
|
|
2994
2994
|
description: r.description,
|
|
2995
2995
|
addonDescription: r.addonDescription,
|
|
2996
|
-
startAt:
|
|
2997
|
-
endAt:
|
|
2996
|
+
startAt: R.fromISO(r.startAt, { zone: r.timezone }).toJSDate().toISOString(),
|
|
2997
|
+
endAt: R.fromISO(r.endAt, { zone: r.timezone }).toJSDate().toISOString(),
|
|
2998
2998
|
timezone: r.timezone,
|
|
2999
2999
|
startSalesAt: null,
|
|
3000
3000
|
endSalesAt: null,
|
|
@@ -3028,8 +3028,8 @@ class we {
|
|
|
3028
3028
|
banner: i.banner,
|
|
3029
3029
|
description: i.description,
|
|
3030
3030
|
addonDescription: i.addonDescription,
|
|
3031
|
-
startAt:
|
|
3032
|
-
endAt:
|
|
3031
|
+
startAt: R.fromISO(i.startAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
3032
|
+
endAt: R.fromISO(i.endAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
3033
3033
|
timezone: i.timezone,
|
|
3034
3034
|
startSalesAt: i.startSalesAt,
|
|
3035
3035
|
endSalesAt: i.endSalesAt,
|
|
@@ -3467,10 +3467,10 @@ class Ue {
|
|
|
3467
3467
|
}
|
|
3468
3468
|
}
|
|
3469
3469
|
}
|
|
3470
|
-
var
|
|
3470
|
+
var _ = /* @__PURE__ */ ((e) => (e.PACKAGE = "PACKAGE", e.PRODUCT = "PRODUCT", e.ADD_ONS = "ADD_ONS", e.DELIVERY = "DELIVERY", e.PICKUP = "PICKUP", e))(_ || {}), X = /* @__PURE__ */ ((e) => (e.AdditionalEvent = "ADDITIONAL_EVENT", e.Addon = "ADDON", e.Regular = "REGULAR", e))(X || {}), Ve = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Concept = "CONCEPT", e.Paused = "PAUSED", e.SoldOut = "SOLD_OUT", e))(Ve || {}), Me = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e))(Me || {}), qe = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e.Paused = "PAUSED", e.SoldOut = "SOLD_OUT", e))(qe || {}), ze = /* @__PURE__ */ ((e) => (e.Asc = "ASC", e.Desc = "DESC", e))(ze || {}), je = /* @__PURE__ */ ((e) => (e.AllReserved = "ALL_RESERVED", e.Available = "AVAILABLE", e.SoldOut = "SOLD_OUT", e))(je || {}), Ge = /* @__PURE__ */ ((e) => (e.Addon = "ADDON", e.Delivery = "DELIVERY", e.Door = "DOOR", e.Friend = "FRIEND", e.Guest = "GUEST", e.Pickup = "PICKUP", e.Promoter = "PROMOTER", e.Ticket = "TICKET", e))(Ge || {}), Ye = /* @__PURE__ */ ((e) => (e.FIXED = "FIXED", e.PERCENTAGE = "PERCENTAGE", e))(Ye || {}), He = /* @__PURE__ */ ((e) => (e.AddOn = "ADD_ON", e.DeliveryOption = "DELIVERY_OPTION", e.EntranceTicket = "ENTRANCE_TICKET", e))(He || {}), Qe = /* @__PURE__ */ ((e) => (e.Fixed = "FIXED", e.Percentage = "PERCENTAGE", e))(Qe || {});
|
|
3471
3471
|
const yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3472
3472
|
__proto__: null,
|
|
3473
|
-
BasketOrderType:
|
|
3473
|
+
BasketOrderType: _,
|
|
3474
3474
|
BasketService: Xe,
|
|
3475
3475
|
CategoryService: Ue,
|
|
3476
3476
|
DiscountType: Qe,
|
|
@@ -3763,7 +3763,7 @@ const Ee = {
|
|
|
3763
3763
|
}
|
|
3764
3764
|
], o.amount === 0 && e.order.items.splice(s, 1)) : e.order.items.push({
|
|
3765
3765
|
id: n.packageItemId,
|
|
3766
|
-
type:
|
|
3766
|
+
type: _.ADD_ONS,
|
|
3767
3767
|
name: n.name,
|
|
3768
3768
|
amount: i,
|
|
3769
3769
|
price: n.discountPrice ?? n.price,
|
|
@@ -3808,7 +3808,7 @@ const Ee = {
|
|
|
3808
3808
|
clearBasket: () => Ee
|
|
3809
3809
|
}
|
|
3810
3810
|
}), {
|
|
3811
|
-
setProcessing:
|
|
3811
|
+
setProcessing: C,
|
|
3812
3812
|
initializeOrder: j,
|
|
3813
3813
|
addProduct: ye,
|
|
3814
3814
|
removeProduct: Sn,
|
|
@@ -3851,7 +3851,7 @@ class Xe {
|
|
|
3851
3851
|
}
|
|
3852
3852
|
// Basket update functions
|
|
3853
3853
|
async addProduct(t) {
|
|
3854
|
-
this.store.dispatch(
|
|
3854
|
+
this.store.dispatch(C(!0));
|
|
3855
3855
|
try {
|
|
3856
3856
|
const i = this.getState().order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3857
3857
|
this.debugLog("Adding product", {
|
|
@@ -3880,26 +3880,26 @@ class Xe {
|
|
|
3880
3880
|
j({
|
|
3881
3881
|
id: s,
|
|
3882
3882
|
currency: t.currency,
|
|
3883
|
-
expiredAt: o
|
|
3883
|
+
expiredAt: o
|
|
3884
3884
|
})
|
|
3885
3885
|
), this.store.dispatch(
|
|
3886
3886
|
ye({
|
|
3887
3887
|
input: t,
|
|
3888
3888
|
amountReserved: u,
|
|
3889
|
-
expiredAt: o
|
|
3889
|
+
expiredAt: o
|
|
3890
3890
|
})
|
|
3891
3891
|
);
|
|
3892
3892
|
}
|
|
3893
3893
|
} catch (n) {
|
|
3894
3894
|
throw this.debugLog("Error adding product", n), this.handleError(n), n;
|
|
3895
3895
|
} finally {
|
|
3896
|
-
this.store.dispatch(
|
|
3896
|
+
this.store.dispatch(C(!1));
|
|
3897
3897
|
}
|
|
3898
3898
|
}
|
|
3899
3899
|
async removeProduct(t) {
|
|
3900
3900
|
const i = this.getState().order;
|
|
3901
3901
|
if (i) {
|
|
3902
|
-
this.store.dispatch(
|
|
3902
|
+
this.store.dispatch(C(!0));
|
|
3903
3903
|
try {
|
|
3904
3904
|
this.debugLog("Removing product", {
|
|
3905
3905
|
productId: t.id,
|
|
@@ -3932,12 +3932,12 @@ class Xe {
|
|
|
3932
3932
|
} catch (r) {
|
|
3933
3933
|
throw this.debugLog("Error removing product", r), this.handleError(r), r;
|
|
3934
3934
|
} finally {
|
|
3935
|
-
this.store.dispatch(
|
|
3935
|
+
this.store.dispatch(C(!1));
|
|
3936
3936
|
}
|
|
3937
3937
|
}
|
|
3938
3938
|
}
|
|
3939
3939
|
async configurePackage(t) {
|
|
3940
|
-
this.store.dispatch(
|
|
3940
|
+
this.store.dispatch(C(!0));
|
|
3941
3941
|
try {
|
|
3942
3942
|
const i = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId(), r = t.items.map((o) => ({
|
|
3943
3943
|
packageItemId: o.packageItemId,
|
|
@@ -3964,13 +3964,13 @@ class Xe {
|
|
|
3964
3964
|
j({
|
|
3965
3965
|
id: o,
|
|
3966
3966
|
currency: t.currency,
|
|
3967
|
-
expiredAt: u
|
|
3967
|
+
expiredAt: u
|
|
3968
3968
|
})
|
|
3969
3969
|
), this.store.dispatch(
|
|
3970
3970
|
ve({
|
|
3971
3971
|
input: t,
|
|
3972
3972
|
amountReserved: h,
|
|
3973
|
-
expiredAt: u
|
|
3973
|
+
expiredAt: u
|
|
3974
3974
|
})
|
|
3975
3975
|
), null;
|
|
3976
3976
|
} else
|
|
@@ -3978,17 +3978,17 @@ class Xe {
|
|
|
3978
3978
|
} catch (n) {
|
|
3979
3979
|
return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
|
|
3980
3980
|
} finally {
|
|
3981
|
-
this.store.dispatch(
|
|
3981
|
+
this.store.dispatch(C(!1));
|
|
3982
3982
|
}
|
|
3983
3983
|
}
|
|
3984
3984
|
async configureDelivery(t) {
|
|
3985
|
-
this.store.dispatch(
|
|
3985
|
+
this.store.dispatch(C(!0));
|
|
3986
3986
|
try {
|
|
3987
3987
|
this.store.dispatch(Cn(t));
|
|
3988
3988
|
} catch (n) {
|
|
3989
3989
|
throw this.debugLog("Error setting delivery", n), this.handleError(n), n;
|
|
3990
3990
|
} finally {
|
|
3991
|
-
this.store.dispatch(
|
|
3991
|
+
this.store.dispatch(C(!1));
|
|
3992
3992
|
}
|
|
3993
3993
|
}
|
|
3994
3994
|
async configureCustomer(t) {
|
|
@@ -4007,7 +4007,7 @@ class Xe {
|
|
|
4007
4007
|
}
|
|
4008
4008
|
}
|
|
4009
4009
|
async reserveAdditionalPackageItem(t) {
|
|
4010
|
-
this.store.dispatch(
|
|
4010
|
+
this.store.dispatch(C(!0));
|
|
4011
4011
|
try {
|
|
4012
4012
|
const i = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
4013
4013
|
this.debugLog("reserve additional packageItem", {
|
|
@@ -4030,13 +4030,13 @@ class Xe {
|
|
|
4030
4030
|
j({
|
|
4031
4031
|
id: s,
|
|
4032
4032
|
currency: t.currency,
|
|
4033
|
-
expiredAt: o
|
|
4033
|
+
expiredAt: o
|
|
4034
4034
|
})
|
|
4035
4035
|
), this.store.dispatch(
|
|
4036
4036
|
_n({
|
|
4037
4037
|
input: t,
|
|
4038
4038
|
amountReserved: u,
|
|
4039
|
-
expiredAt: o
|
|
4039
|
+
expiredAt: o
|
|
4040
4040
|
})
|
|
4041
4041
|
), null;
|
|
4042
4042
|
} else
|
|
@@ -4044,7 +4044,7 @@ class Xe {
|
|
|
4044
4044
|
} catch (n) {
|
|
4045
4045
|
return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
|
|
4046
4046
|
} finally {
|
|
4047
|
-
this.store.dispatch(
|
|
4047
|
+
this.store.dispatch(C(!1));
|
|
4048
4048
|
}
|
|
4049
4049
|
}
|
|
4050
4050
|
// Cancel and clear order functions
|
|
@@ -4078,8 +4078,8 @@ class Xe {
|
|
|
4078
4078
|
const i = n.findOrder;
|
|
4079
4079
|
this.debugLog("Order fetched successfully", i);
|
|
4080
4080
|
const r = i.items, s = r.filter((c) => c.product != null && c.amount > 0).map((c) => {
|
|
4081
|
-
let m =
|
|
4082
|
-
return c.product.type === "PROMOTER" ? m =
|
|
4081
|
+
let m = _.PRODUCT;
|
|
4082
|
+
return c.product.type === "PROMOTER" ? m = _.ADD_ONS : c.product.type === "PICKUP" ? m = _.PICKUP : c.product.type === "DELIVERY" && (m = _.DELIVERY), {
|
|
4083
4083
|
id: c.product.id,
|
|
4084
4084
|
type: m,
|
|
4085
4085
|
name: c.product.name,
|
|
@@ -4101,32 +4101,32 @@ class Xe {
|
|
|
4101
4101
|
event: y,
|
|
4102
4102
|
amount: I,
|
|
4103
4103
|
price: O,
|
|
4104
|
-
serviceFee:
|
|
4104
|
+
serviceFee: x,
|
|
4105
4105
|
depositPrice: k,
|
|
4106
|
-
originalPrice:
|
|
4106
|
+
originalPrice: L
|
|
4107
4107
|
} = m, T = g.package.id;
|
|
4108
|
-
c[T] ? (c[T].price += O ?? 0, c[T].serviceFee +=
|
|
4108
|
+
c[T] ? (c[T].price += O ?? 0, c[T].serviceFee += x ?? 0, c[T].originalPrice += L ?? 0, c[T].depositPrice += k ?? O ?? 0) : c[T] = {
|
|
4109
4109
|
id: T,
|
|
4110
|
-
type:
|
|
4110
|
+
type: _.PACKAGE,
|
|
4111
4111
|
name: g.package.name,
|
|
4112
4112
|
amount: I,
|
|
4113
4113
|
price: O ?? 0,
|
|
4114
|
-
serviceFee:
|
|
4114
|
+
serviceFee: x ?? 0,
|
|
4115
4115
|
depositPrice: k ?? O ?? 0,
|
|
4116
|
-
originalPrice:
|
|
4116
|
+
originalPrice: L ?? 0,
|
|
4117
4117
|
packageItems: []
|
|
4118
4118
|
};
|
|
4119
|
-
const
|
|
4119
|
+
const N = R.fromISO(y.startAt, {
|
|
4120
4120
|
zone: y.timezone
|
|
4121
|
-
}), D =
|
|
4121
|
+
}), D = R.fromISO(y.endAt, {
|
|
4122
4122
|
zone: y.timezone
|
|
4123
4123
|
});
|
|
4124
4124
|
return c[T].packageItems.push({
|
|
4125
4125
|
packageItemId: g.id,
|
|
4126
4126
|
eventId: y.id,
|
|
4127
4127
|
name: y.name,
|
|
4128
|
-
startAt:
|
|
4129
|
-
endAt: D
|
|
4128
|
+
startAt: N.toJSDate().toISOString(),
|
|
4129
|
+
endAt: D.toJSDate().toISOString()
|
|
4130
4130
|
}), c;
|
|
4131
4131
|
}, {}), u = [
|
|
4132
4132
|
...s,
|
|
@@ -4141,15 +4141,15 @@ class Xe {
|
|
|
4141
4141
|
this.debugLog("No valid items with expiration times, clearing session"), this.clearOrderFromSession();
|
|
4142
4142
|
return;
|
|
4143
4143
|
}
|
|
4144
|
-
const p =
|
|
4144
|
+
const p = R.fromMillis(Math.min(...h));
|
|
4145
4145
|
this.store.dispatch(Te()), this.store.dispatch(
|
|
4146
4146
|
j({
|
|
4147
4147
|
id: i.id,
|
|
4148
4148
|
currency: i.currency,
|
|
4149
|
-
expiredAt: p
|
|
4149
|
+
expiredAt: p.toJSDate().toISOString()
|
|
4150
4150
|
})
|
|
4151
4151
|
), u.forEach((c) => {
|
|
4152
|
-
c.type ===
|
|
4152
|
+
c.type === _.PACKAGE ? this.store.dispatch(
|
|
4153
4153
|
ve({
|
|
4154
4154
|
input: {
|
|
4155
4155
|
id: c.id,
|
|
@@ -4162,7 +4162,7 @@ class Xe {
|
|
|
4162
4162
|
items: c.packageItems || []
|
|
4163
4163
|
},
|
|
4164
4164
|
amountReserved: c.amount,
|
|
4165
|
-
expiredAt: p
|
|
4165
|
+
expiredAt: p.toJSDate().toISOString()
|
|
4166
4166
|
})
|
|
4167
4167
|
) : this.store.dispatch(
|
|
4168
4168
|
ye({
|
|
@@ -4176,7 +4176,7 @@ class Xe {
|
|
|
4176
4176
|
amount: c.amount
|
|
4177
4177
|
},
|
|
4178
4178
|
amountReserved: c.amount,
|
|
4179
|
-
expiredAt: p
|
|
4179
|
+
expiredAt: p.toJSDate().toISOString()
|
|
4180
4180
|
})
|
|
4181
4181
|
);
|
|
4182
4182
|
}), i.mainBooker && (this.debugLog("Order has customer (mainBooker)", i.mainBooker), this.store.dispatch(
|
|
@@ -4184,7 +4184,10 @@ class Xe {
|
|
|
4184
4184
|
firstName: i.mainBooker.firstName ?? void 0,
|
|
4185
4185
|
lastName: i.mainBooker.lastName ?? void 0,
|
|
4186
4186
|
email: i.mainBooker.email ?? void 0,
|
|
4187
|
-
age: i.mainBooker.age ?? void 0
|
|
4187
|
+
age: i.mainBooker.age ?? void 0,
|
|
4188
|
+
gender: i.mainBooker.gender ?? void 0,
|
|
4189
|
+
residence: i.mainBooker.residence ?? void 0,
|
|
4190
|
+
extraInfo: i.mainBooker.extraInfo ?? void 0
|
|
4188
4191
|
})
|
|
4189
4192
|
)), this.debugLog("Order state fully synced", this.getState());
|
|
4190
4193
|
} catch (n) {
|
|
@@ -4258,7 +4261,7 @@ class $n {
|
|
|
4258
4261
|
}
|
|
4259
4262
|
}
|
|
4260
4263
|
export {
|
|
4261
|
-
|
|
4264
|
+
_ as BasketOrderType,
|
|
4262
4265
|
Xe as BasketService,
|
|
4263
4266
|
Ue as CategoryService,
|
|
4264
4267
|
Qe as DiscountType,
|
|
@@ -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,KAAK,EAAE,iCAAiC,EACzC,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,MAAM,WAAW,YAAa,SAAQ,KAAK;IACzC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC,OA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