@loczer/storefront-sdk 0.219.0 → 0.220.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.
- package/dist/index.d.ts +0 -1
- package/dist/lib/checkoutPaymentDecision.d.ts +2 -6
- package/dist/lib/checkoutPaymentDecision.d.ts.map +1 -1
- package/dist/lib/checkoutPaymentDecision.js +3 -4
- package/dist/lib/checkoutSubmit.d.ts +0 -3
- package/dist/lib/checkoutSubmit.d.ts.map +1 -1
- package/dist/lib/checkoutSubmit.js +41 -43
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +26 -26
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3561,7 +3561,6 @@ export declare type StorefrontCheckoutSubmitResponsePayload = z.infer<typeof sto
|
|
|
3561
3561
|
export declare const storefrontCheckoutSubmitResponseSchema: z.ZodObject<{
|
|
3562
3562
|
success: z.ZodBoolean;
|
|
3563
3563
|
message: z.ZodOptional<z.ZodString>;
|
|
3564
|
-
errorCode: z.ZodOptional<z.ZodLiteral<"online_payment_provider_missing">>;
|
|
3565
3564
|
checkout: z.ZodOptional<z.ZodObject<{
|
|
3566
3565
|
bookingExternalId: z.ZodString;
|
|
3567
3566
|
saleId: z.ZodString;
|
|
@@ -2,13 +2,10 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const ROUTE = "/api/public/storefront/checkout/payment-decision";
|
|
3
3
|
export declare const paymentDecisionModeSchema: z.ZodEnum<{
|
|
4
4
|
none: "none";
|
|
5
|
-
deposit: "deposit";
|
|
6
5
|
full: "full";
|
|
6
|
+
deposit: "deposit";
|
|
7
7
|
}>;
|
|
8
8
|
export type PaymentDecisionMode = z.infer<typeof paymentDecisionModeSchema>;
|
|
9
|
-
export declare const MISSING_ONLINE_PAYMENT_PROVIDER_ERROR_CODE = "online_payment_provider_missing";
|
|
10
|
-
export declare const checkoutPaymentErrorCodeSchema: z.ZodLiteral<"online_payment_provider_missing">;
|
|
11
|
-
export type CheckoutPaymentErrorCode = z.infer<typeof checkoutPaymentErrorCodeSchema>;
|
|
12
9
|
export declare const requestSchema: z.ZodObject<{
|
|
13
10
|
storeSlug: z.ZodString;
|
|
14
11
|
schedule: z.ZodObject<{
|
|
@@ -24,13 +21,12 @@ export type RequestPayload = z.infer<typeof requestSchema>;
|
|
|
24
21
|
export declare const responseSchema: z.ZodObject<{
|
|
25
22
|
success: z.ZodBoolean;
|
|
26
23
|
message: z.ZodOptional<z.ZodString>;
|
|
27
|
-
errorCode: z.ZodOptional<z.ZodLiteral<"online_payment_provider_missing">>;
|
|
28
24
|
decision: z.ZodOptional<z.ZodObject<{
|
|
29
25
|
shouldCollectOnlinePayment: z.ZodBoolean;
|
|
30
26
|
paymentMode: z.ZodEnum<{
|
|
31
27
|
none: "none";
|
|
32
|
-
deposit: "deposit";
|
|
33
28
|
full: "full";
|
|
29
|
+
deposit: "deposit";
|
|
34
30
|
}>;
|
|
35
31
|
calculatedAmountMinor: z.ZodNumber;
|
|
36
32
|
amountToCollectMinor: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkoutPaymentDecision.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutPaymentDecision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,KAAK,qDAAqD,CAAA;AAEvE,eAAO,MAAM,yBAAyB;;;;EAAsC,CAAA;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"checkoutPaymentDecision.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutPaymentDecision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,KAAK,qDAAqD,CAAA;AAEvE,eAAO,MAAM,yBAAyB;;;;EAAsC,CAAA;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,eAAO,MAAM,aAAa;;;;;;;;;;iBAYxB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBzB,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
|
@@ -4,7 +4,7 @@ var t = "/api/public/storefront/checkout/payment-decision", n = e.enum([
|
|
|
4
4
|
"none",
|
|
5
5
|
"deposit",
|
|
6
6
|
"full"
|
|
7
|
-
]), r =
|
|
7
|
+
]), r = e.object({
|
|
8
8
|
storeSlug: e.string().trim().min(1).toLowerCase(),
|
|
9
9
|
schedule: e.object({
|
|
10
10
|
startDate: e.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
@@ -14,10 +14,9 @@ var t = "/api/public/storefront/checkout/payment-decision", n = e.enum([
|
|
|
14
14
|
}),
|
|
15
15
|
estimatedTotalMinor: e.number().int().min(0),
|
|
16
16
|
nowIso: e.string().datetime({ offset: !0 }).optional()
|
|
17
|
-
}),
|
|
17
|
+
}), i = e.object({
|
|
18
18
|
success: e.boolean(),
|
|
19
19
|
message: e.string().optional(),
|
|
20
|
-
errorCode: i.optional(),
|
|
21
20
|
decision: e.object({
|
|
22
21
|
shouldCollectOnlinePayment: e.boolean(),
|
|
23
22
|
paymentMode: n,
|
|
@@ -38,4 +37,4 @@ var t = "/api/public/storefront/checkout/payment-decision", n = e.enum([
|
|
|
38
37
|
}).optional()
|
|
39
38
|
});
|
|
40
39
|
//#endregion
|
|
41
|
-
export {
|
|
40
|
+
export { t as ROUTE, n as paymentDecisionModeSchema, r as requestSchema, i as responseSchema };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { MISSING_ONLINE_PAYMENT_PROVIDER_ERROR_CODE } from './checkoutPaymentDecision';
|
|
3
|
-
export { MISSING_ONLINE_PAYMENT_PROVIDER_ERROR_CODE };
|
|
4
2
|
export declare const ROUTE = "/api/public/storefront/checkout/submit";
|
|
5
3
|
export declare const requestCheckoutItemSchema: z.ZodObject<{
|
|
6
4
|
kind: any;
|
|
@@ -87,7 +85,6 @@ export type RequestPayload = z.infer<typeof requestSchema>;
|
|
|
87
85
|
export declare const responseSchema: z.ZodObject<{
|
|
88
86
|
success: z.ZodBoolean;
|
|
89
87
|
message: z.ZodOptional<z.ZodString>;
|
|
90
|
-
errorCode: z.ZodOptional<z.ZodLiteral<"online_payment_provider_missing">>;
|
|
91
88
|
checkout: z.ZodOptional<z.ZodObject<{
|
|
92
89
|
bookingExternalId: z.ZodString;
|
|
93
90
|
saleId: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkoutSubmit.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"checkoutSubmit.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,KAAK,2CAA2C,CAAA;AAE7D,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAI3E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+B5B,CAAA;AAEF,eAAO,MAAM,yBAAyB,GACpC,SAAS;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACxD,KAAK,CAAC,CAAC,aAAa,SAWrB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoBxB,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;;iBAazB,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
|
@@ -2,69 +2,67 @@ import { productKindSchema as e } from "../chunks/pkg/booking-engine/dist/models
|
|
|
2
2
|
import { DEFAULT_BOOKING_DELIVERY_OPTION as t, bookingScheduleInputSchema as n } from "../chunks/pkg/booking-engine/dist/schemas/cart-inputs-epi7FXIk.js";
|
|
3
3
|
import "../chunks/pkg/booking-engine/dist/schemas-DGn2a1my.js";
|
|
4
4
|
import { storefrontFulfillmentModeSchema as r } from "../storefrontSchemas.js";
|
|
5
|
-
import {
|
|
6
|
-
import { z as o } from "zod";
|
|
5
|
+
import { z as i } from "zod";
|
|
7
6
|
//#region src/lib/checkoutSubmit.ts
|
|
8
|
-
var
|
|
7
|
+
var a = "/api/public/storefront/checkout/submit", o = i.object({
|
|
9
8
|
kind: e,
|
|
10
|
-
productId:
|
|
11
|
-
productVariantId:
|
|
12
|
-
quantity:
|
|
13
|
-
}),
|
|
14
|
-
storeSlug:
|
|
15
|
-
checkoutSessionId:
|
|
16
|
-
replacesCheckoutSessionId:
|
|
9
|
+
productId: i.string().trim().min(1),
|
|
10
|
+
productVariantId: i.string().trim().min(1).optional(),
|
|
11
|
+
quantity: i.number().int().positive()
|
|
12
|
+
}), s = i.object({
|
|
13
|
+
storeSlug: i.string().trim().min(1).toLowerCase(),
|
|
14
|
+
checkoutSessionId: i.string().trim().min(1).max(256).optional(),
|
|
15
|
+
replacesCheckoutSessionId: i.string().trim().min(1).max(256).optional(),
|
|
17
16
|
schedule: n,
|
|
18
17
|
fulfillment: r.default(t),
|
|
19
|
-
startAddress:
|
|
20
|
-
endAddress:
|
|
21
|
-
couponCode:
|
|
22
|
-
couponAutoApplied:
|
|
23
|
-
insuranceAccepted:
|
|
24
|
-
customer:
|
|
25
|
-
firstName:
|
|
26
|
-
lastName:
|
|
27
|
-
fullName:
|
|
28
|
-
email:
|
|
29
|
-
phone:
|
|
30
|
-
notes:
|
|
18
|
+
startAddress: i.string().trim().max(500).optional(),
|
|
19
|
+
endAddress: i.string().trim().max(500).optional(),
|
|
20
|
+
couponCode: i.string().trim().max(64).optional().or(i.literal("")),
|
|
21
|
+
couponAutoApplied: i.boolean().optional(),
|
|
22
|
+
insuranceAccepted: i.boolean().optional(),
|
|
23
|
+
customer: i.object({
|
|
24
|
+
firstName: i.string().trim().min(1).optional(),
|
|
25
|
+
lastName: i.string().trim().min(1).optional(),
|
|
26
|
+
fullName: i.string().trim().min(2).optional(),
|
|
27
|
+
email: i.string().trim().email(),
|
|
28
|
+
phone: i.string().trim().min(6),
|
|
29
|
+
notes: i.string().trim().max(2e3).optional().or(i.literal(""))
|
|
31
30
|
}).superRefine((e, t) => {
|
|
32
31
|
e.firstName && e.lastName || e.fullName || t.addIssue({
|
|
33
|
-
code:
|
|
32
|
+
code: i.ZodIssueCode.custom,
|
|
34
33
|
path: ["firstName"],
|
|
35
34
|
message: "Customer first and last names are required."
|
|
36
35
|
});
|
|
37
36
|
}),
|
|
38
|
-
items:
|
|
39
|
-
nowIso:
|
|
40
|
-
}),
|
|
37
|
+
items: i.array(o).min(1),
|
|
38
|
+
nowIso: i.string().datetime({ offset: !0 }).optional()
|
|
39
|
+
}), c = (e, t) => {
|
|
41
40
|
e.fulfillment === "delivery" && (e.startAddress?.trim() || t.addIssue({
|
|
42
|
-
code:
|
|
41
|
+
code: i.ZodIssueCode.custom,
|
|
43
42
|
message: "Delivery start address is required.",
|
|
44
43
|
path: ["startAddress"]
|
|
45
44
|
}));
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
code:
|
|
45
|
+
}, l = s.superRefine((e, t) => {
|
|
46
|
+
c(e, t), e.replacesCheckoutSessionId && !e.checkoutSessionId && t.addIssue({
|
|
47
|
+
code: i.ZodIssueCode.custom,
|
|
49
48
|
message: "A replacement checkout session requires a new checkout session id.",
|
|
50
49
|
path: ["checkoutSessionId"]
|
|
51
50
|
}), e.checkoutSessionId && e.replacesCheckoutSessionId === e.checkoutSessionId && t.addIssue({
|
|
52
|
-
code:
|
|
51
|
+
code: i.ZodIssueCode.custom,
|
|
53
52
|
message: "The new and replaced checkout session ids must differ.",
|
|
54
53
|
path: ["replacesCheckoutSessionId"]
|
|
55
54
|
});
|
|
56
|
-
}),
|
|
57
|
-
success:
|
|
58
|
-
message:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
checkoutSessionId: o.string().trim().min(1).max(256).optional()
|
|
55
|
+
}), u = i.object({
|
|
56
|
+
success: i.boolean(),
|
|
57
|
+
message: i.string().optional(),
|
|
58
|
+
checkout: i.object({
|
|
59
|
+
bookingExternalId: i.string().trim().min(1),
|
|
60
|
+
saleId: i.string().trim().min(1),
|
|
61
|
+
nextPath: i.string().trim().min(1),
|
|
62
|
+
successPath: i.string().trim().min(1),
|
|
63
|
+
requiresPayment: i.boolean(),
|
|
64
|
+
checkoutSessionId: i.string().trim().min(1).max(256).optional()
|
|
67
65
|
}).optional()
|
|
68
66
|
});
|
|
69
67
|
//#endregion
|
|
70
|
-
export {
|
|
68
|
+
export { a as ROUTE, s as requestBaseSchema, o as requestCheckoutItemSchema, c as requestDeliveryRefinement, l as requestSchema, u as responseSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"AAuGA,MAAM,CAAC,OAAO,UAAU,YAAY,4CAysBnC"}
|
|
@@ -2,15 +2,15 @@ import { applyBookingParamsToSearch as e, getBookingParamsFromSearch as t, pickB
|
|
|
2
2
|
import { useStorefrontCart as ee } from "../lib/cart.js";
|
|
3
3
|
import { calculateBookingRentalUnitSummary as te, formatRentalUnitQuantity as ne, getPricingUnitLabel as re } from "../lib/pricing.js";
|
|
4
4
|
import { buildStorefrontCartSummary as ie } from "../lib/cartSummary.js";
|
|
5
|
-
import { ROUTE as ae, responseSchema as oe } from "../lib/
|
|
6
|
-
import { ROUTE as se,
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { toast as _e } from "../lib/toast.js";
|
|
5
|
+
import { ROUTE as ae, responseSchema as oe } from "../lib/checkoutSubmit.js";
|
|
6
|
+
import { ROUTE as se, buildStorefrontAvailabilityKey as ce, getStorefrontAvailabilityIssue as le, getValidStorefrontAvailabilitySchedule as ue, responseSchema as de } from "../lib/storefrontAvailability.js";
|
|
7
|
+
import { Button as fe } from "../ui/button.js";
|
|
8
|
+
import { useStorefront as pe, useStorefrontProducts as me } from "../StorefrontContext.js";
|
|
9
|
+
import { toast as he } from "../lib/toast.js";
|
|
11
10
|
import { apiPost as a } from "../lib/apiCall.js";
|
|
12
|
-
import { FulfillmentSection as
|
|
13
|
-
import { BookingFlowPageLayout as
|
|
11
|
+
import { FulfillmentSection as ge } from "../components/FulfillmentSection/index.js";
|
|
12
|
+
import { BookingFlowPageLayout as _e } from "../components/BookingFlowPageLayout/index.js";
|
|
13
|
+
import { ROUTE as ve, responseSchema as ye } from "../lib/checkoutPaymentDecision.js";
|
|
14
14
|
import { ROUTE as be, responseSchema as xe } from "../lib/checkoutVerifyCoupon.js";
|
|
15
15
|
import { CheckoutDetailsCard as Se } from "./checkout/components/CheckoutDetailsCard.js";
|
|
16
16
|
import { CheckoutPaymentSummaryCard as Ce } from "./checkout/components/CheckoutPaymentSummaryCard.js";
|
|
@@ -57,7 +57,7 @@ var Ie = .2, d = (e, t, n) => {
|
|
|
57
57
|
return new Intl.DateTimeFormat(t, r).format(e);
|
|
58
58
|
};
|
|
59
59
|
function f() {
|
|
60
|
-
let { t: f, i18n: p } = Me(), { storefrontConfiguration: m } =
|
|
60
|
+
let { t: f, i18n: p } = Me(), { storefrontConfiguration: m } = pe(), ze = m.workspace?.workspaceLanguage, { bikes: h, accessories: Be } = me(), { storeSlug: g } = Ae(), [_, Ve] = je(), He = ke(), { items: Ue, itemCount: We, setQuantity: Ge, removeItem: Ke, beginCheckoutSubmission: qe, confirmCheckoutPaymentSession: Je, clearCheckoutSession: Ye, clear: Xe } = ee(), [v, Ze] = c(!1), Qe = De(!1), [y, b] = c(null), [$e, et] = c(!1), [tt, x] = c(null), nt = _.get("coupon") ?? _.get("code") ?? "", [rt, it] = c(nt), [at, ot] = c(nt.trim()), [S, C] = c(null), [w, T] = c(null), [E, D] = c(!1), [st, O] = c(null), [ct, k] = c(null), [A, lt] = c(!1), [j, ut] = c(!1), dt = n(_).toString(), ft = s(() => r(new URLSearchParams(dt), g), [dt, g]), M = m.settings.fulfillmentModes.includes("delivery"), pt = m.settings.deliveryDisabledReason.trim(), mt = M || pt.length > 0, ht = m.shop.address?.trim() ?? "", N = s(() => {
|
|
61
61
|
let e = t(ft, {
|
|
62
62
|
start_time: "",
|
|
63
63
|
end_time: ""
|
|
@@ -66,7 +66,7 @@ function f() {
|
|
|
66
66
|
...e,
|
|
67
67
|
fulfillment: "pickup"
|
|
68
68
|
} : e;
|
|
69
|
-
}, [ft, M]), P = s(() =>
|
|
69
|
+
}, [ft, M]), P = s(() => ue(N), [N]), F = m.bookingEngine.pricing, I = te(N, F, m.bookingEngine.shop.timeZone), gt = re(F.baseUnit, f), _t = I ? ne(I.billableUnitCount, I.priceUnit, p.language, f) : void 0, vt = I?.billableUnitCount, L = s(() => ie({
|
|
70
70
|
items: Ue,
|
|
71
71
|
language: p.language,
|
|
72
72
|
fallbackLanguage: ze,
|
|
@@ -101,11 +101,11 @@ function f() {
|
|
|
101
101
|
let e = !1;
|
|
102
102
|
return B(!0), z([]), (async () => {
|
|
103
103
|
try {
|
|
104
|
-
let t = await a(
|
|
104
|
+
let t = await a(se, {
|
|
105
105
|
storeSlug: g,
|
|
106
106
|
schedule: P,
|
|
107
107
|
products: R
|
|
108
|
-
}), n =
|
|
108
|
+
}), n = de.parse(t);
|
|
109
109
|
if (e) return;
|
|
110
110
|
z(n.success ? n.availability ?? [] : []);
|
|
111
111
|
} catch (t) {
|
|
@@ -126,10 +126,10 @@ function f() {
|
|
|
126
126
|
R,
|
|
127
127
|
g
|
|
128
128
|
]);
|
|
129
|
-
let xt = s(() => new Map(yt.map((e) => [
|
|
129
|
+
let xt = s(() => new Map(yt.map((e) => [ce(e.productId, e.productVariantId), e])), [yt]), St = s(() => ({
|
|
130
130
|
...L,
|
|
131
131
|
lines: L.lines.map((e) => {
|
|
132
|
-
let t = xt.get(
|
|
132
|
+
let t = xt.get(ce(e.checkoutProductId, e.productVariantId)), n = t ? le(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
|
|
133
133
|
return {
|
|
134
134
|
...e,
|
|
135
135
|
insufficientCapacity: !bt && n !== void 0,
|
|
@@ -231,14 +231,14 @@ function f() {
|
|
|
231
231
|
let e = !1;
|
|
232
232
|
return et(!0), x(null), (async () => {
|
|
233
233
|
try {
|
|
234
|
-
let t = await a(
|
|
234
|
+
let t = await a(ve, {
|
|
235
235
|
storeSlug: g,
|
|
236
236
|
schedule: P,
|
|
237
237
|
estimatedTotalMinor: G
|
|
238
|
-
}), n =
|
|
238
|
+
}), n = ye.parse(t);
|
|
239
239
|
if (e) return;
|
|
240
240
|
if (!n.success || !n.decision) {
|
|
241
|
-
b(null), x(n.
|
|
241
|
+
b(null), x(n.message || f("checkout_payment_error"));
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
b(n.decision);
|
|
@@ -284,7 +284,7 @@ function f() {
|
|
|
284
284
|
Ze(!0), Qe.current = !0;
|
|
285
285
|
let t = qe();
|
|
286
286
|
try {
|
|
287
|
-
let n = await a(
|
|
287
|
+
let n = await a(ae, {
|
|
288
288
|
storeSlug: g,
|
|
289
289
|
checkoutSessionId: t.checkoutSessionId,
|
|
290
290
|
replacesCheckoutSessionId: t.replacesCheckoutSessionId,
|
|
@@ -303,14 +303,14 @@ function f() {
|
|
|
303
303
|
notes: e.notes
|
|
304
304
|
},
|
|
305
305
|
items: V
|
|
306
|
-
}), r =
|
|
306
|
+
}), r = oe.parse(n);
|
|
307
307
|
if (!r.success || !r.checkout) {
|
|
308
|
-
Ye(),
|
|
308
|
+
Ye(), he.error(r.message || f("checkout_payment_error"));
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
|
-
r.checkout.requiresPayment ? Je(r.checkout.checkoutSessionId ?? t.checkoutSessionId) :
|
|
311
|
+
r.checkout.requiresPayment ? Je(r.checkout.checkoutSessionId ?? t.checkoutSessionId) : he.success(f("checkout_success_toast")), await He(r.checkout.nextPath), r.checkout.requiresPayment || Xe();
|
|
312
312
|
} catch (e) {
|
|
313
|
-
console.error("Failed to submit storefront checkout", e),
|
|
313
|
+
console.error("Failed to submit storefront checkout", e), he.error(f("checkout_payment_error"));
|
|
314
314
|
} finally {
|
|
315
315
|
Qe.current = !1, Ze(!1);
|
|
316
316
|
}
|
|
@@ -332,7 +332,7 @@ function f() {
|
|
|
332
332
|
className: "mt-6",
|
|
333
333
|
children: /* @__PURE__ */ l(Oe, {
|
|
334
334
|
to: J,
|
|
335
|
-
children: /* @__PURE__ */ u(
|
|
335
|
+
children: /* @__PURE__ */ u(fe, {
|
|
336
336
|
className: "gap-2",
|
|
337
337
|
children: [/* @__PURE__ */ l(Ne, {
|
|
338
338
|
className: "h-4 w-4",
|
|
@@ -343,7 +343,7 @@ function f() {
|
|
|
343
343
|
})
|
|
344
344
|
]
|
|
345
345
|
})
|
|
346
|
-
}) : /* @__PURE__ */ l(
|
|
346
|
+
}) : /* @__PURE__ */ l(_e, {
|
|
347
347
|
currentStep: "checkout",
|
|
348
348
|
bookingPath: J,
|
|
349
349
|
checkoutPath: Dt,
|
|
@@ -368,7 +368,7 @@ function f() {
|
|
|
368
368
|
children: [
|
|
369
369
|
mt ? /* @__PURE__ */ l("div", {
|
|
370
370
|
className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm",
|
|
371
|
-
children: /* @__PURE__ */ l(
|
|
371
|
+
children: /* @__PURE__ */ l(ge, {
|
|
372
372
|
value: N.fulfillment,
|
|
373
373
|
onValueChange: (e) => Y({ fulfillment: e }),
|
|
374
374
|
pickupAddress: ht,
|
|
@@ -412,7 +412,7 @@ function f() {
|
|
|
412
412
|
submitting: v,
|
|
413
413
|
onSelectPaymentMethod: () => {}
|
|
414
414
|
}),
|
|
415
|
-
/* @__PURE__ */ l(
|
|
415
|
+
/* @__PURE__ */ l(fe, {
|
|
416
416
|
type: "button",
|
|
417
417
|
size: "lg",
|
|
418
418
|
onClick: () => {
|