@loczer/storefront-sdk 0.160.0 → 0.162.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/chunks/booking-engine/dist/utils/{pricing-DcnUXaeI.js → pricing-CYLeWtmu.js} +6 -6
- package/dist/components/BikeProductCard/index.js +1 -1
- package/dist/components/ContactSection/index.js +2 -2
- package/dist/components/StorefrontCartPanel/index.d.ts +3 -1
- package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
- package/dist/components/StorefrontCartPanel/index.js +25 -23
- package/dist/i18n/en.js +1 -1
- package/dist/i18n/fr.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/lib/checkoutSubmit.d.ts +2 -2
- package/dist/lib/checkoutSubmit.js +1 -1
- package/dist/lib/fetchStorefrontTimeSlots.d.ts +4 -0
- package/dist/lib/fetchStorefrontTimeSlots.d.ts.map +1 -0
- package/dist/lib/fetchStorefrontTimeSlots.js +22 -0
- package/dist/lib/pricing.js +3 -3
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +98 -101
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +71 -75
- package/dist/pages/CheckoutPaymentPage.js +5 -5
- package/dist/pages/CheckoutSuccessPage.js +6 -6
- package/dist/pages/ContractSaleDocumentPage.js +1 -1
- package/dist/pages/HomePage.d.ts.map +1 -1
- package/dist/pages/HomePage.js +134 -137
- package/dist/pages/PaymentLinkPage.js +3 -3
- package/dist/pages/PaymentLinkSuccessPage.js +1 -1
- package/dist/pages/ProductPage.js +3 -3
- package/dist/pages/checkout/components/CheckoutCouponCard.d.ts +2 -1
- package/dist/pages/checkout/components/CheckoutCouponCard.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutCouponCard.js +37 -36
- package/dist/pages/checkout/components/CheckoutDetailsCard.js +2 -2
- package/dist/pages/checkout/components/CheckoutPaymentSummaryCard.js +21 -21
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts +6 -2
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutSummaryColumn.js +26 -23
- package/dist/pages/checkout/types.d.ts +1 -1
- package/dist/pages/checkout/types.js +3 -3
- package/dist/storefront.css +1 -1
- package/dist/ui/card.js +26 -26
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
function d(n, r) {
|
|
2
2
|
return n.quantity - r.quantity;
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
return Number.
|
|
4
|
+
function q(n) {
|
|
5
|
+
return Number.isFinite(n) && n > 0;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
if (!
|
|
9
|
-
throw new Error(`Requested quantity must be a positive
|
|
7
|
+
function v(n, r, a = "day") {
|
|
8
|
+
if (!q(r))
|
|
9
|
+
throw new Error(`Requested quantity must be a positive number (received ${r}).`);
|
|
10
10
|
if (!n || n.length === 0)
|
|
11
11
|
throw new Error("Cannot calculate price without pricing tiers.");
|
|
12
12
|
const c = n.filter((t) => t.unit === a).sort(d);
|
|
@@ -32,5 +32,5 @@ function q(n, r, a = "day") {
|
|
|
32
32
|
return Math.round(e);
|
|
33
33
|
}
|
|
34
34
|
export {
|
|
35
|
-
|
|
35
|
+
v as calculatePriceForQuantity
|
|
36
36
|
};
|
|
@@ -24,7 +24,7 @@ function F({
|
|
|
24
24
|
return /* @__PURE__ */ a(
|
|
25
25
|
"div",
|
|
26
26
|
{
|
|
27
|
-
className: "flex h-full flex-col gap-2 rounded-
|
|
27
|
+
className: "flex h-full flex-col gap-2 rounded-xl border border-slate-200 bg-white p-3 shadow-sm",
|
|
28
28
|
"data-testid": g,
|
|
29
29
|
children: [
|
|
30
30
|
/* @__PURE__ */ a("div", { className: "flex flex-1 items-stretch gap-4", children: [
|
|
@@ -62,8 +62,8 @@ function we({ preset: s, storeSlug: j }) {
|
|
|
62
62
|
/* @__PURE__ */ e("h2", { className: "text-3xl font-semibold tracking-tight text-slate-950", children: t("contact_section_title") }),
|
|
63
63
|
/* @__PURE__ */ e("p", { className: "mt-3 text-sm text-slate-600 sm:text-base", children: t("contact_section_subtitle") })
|
|
64
64
|
] }),
|
|
65
|
-
/* @__PURE__ */ r("div", { className: "mt-
|
|
66
|
-
/* @__PURE__ */ r("div", { className: "flex flex-col gap-
|
|
65
|
+
/* @__PURE__ */ r("div", { className: "mt-8 grid gap-6 rounded-xl border border-slate-200 bg-white p-4 shadow-sm lg:grid-cols-2 lg:p-6", children: [
|
|
66
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-6 lg:border-r lg:border-slate-200 lg:pr-6", children: [
|
|
67
67
|
/* @__PURE__ */ r("div", { children: [
|
|
68
68
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-slate-950", children: t("contact_section_info_title") }),
|
|
69
69
|
/* @__PURE__ */ e("p", { className: "mt-2 text-sm text-slate-600", children: t(T ? "contact_section_info_description" : "contact_section_info_description_without_whatsapp") })
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { StorefrontCartSummaryLine } from '../../lib/cartSummary';
|
|
2
3
|
type StorefrontCartPanelProps = {
|
|
3
4
|
lines: StorefrontCartSummaryLine[];
|
|
@@ -16,11 +17,12 @@ type StorefrontCartPanelProps = {
|
|
|
16
17
|
showCheckoutAction?: boolean;
|
|
17
18
|
showClearAction?: boolean;
|
|
18
19
|
editable?: boolean;
|
|
20
|
+
summaryAddon?: ReactNode;
|
|
19
21
|
stickyTopClassName?: string;
|
|
20
22
|
onQuantityChange?: (key: string, quantity: number) => void;
|
|
21
23
|
onRemove?: (key: string) => void;
|
|
22
24
|
onClear?: () => void;
|
|
23
25
|
};
|
|
24
|
-
export declare function StorefrontCartPanel({ lines, itemCount, totalPerDayMinor, estimatedDays, estimatedTotalMinor, discountedEstimatedTotalMinor, discountAmountMinor, lateReturnSurchargeMinor, couponCode, durationLabel, title, description, checkoutPath, showCheckoutAction, showClearAction, editable, stickyTopClassName, onQuantityChange, onRemove, onClear, }: StorefrontCartPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function StorefrontCartPanel({ lines, itemCount, totalPerDayMinor, estimatedDays, estimatedTotalMinor, discountedEstimatedTotalMinor, discountAmountMinor, lateReturnSurchargeMinor, couponCode, durationLabel, title, description, checkoutPath, showCheckoutAction, showClearAction, editable, summaryAddon, stickyTopClassName, onQuantityChange, onRemove, onClear, }: StorefrontCartPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
25
27
|
export {};
|
|
26
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/StorefrontCartPanel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/StorefrontCartPanel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAQtE,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,yBAAyB,EAAE,CAAA;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,6BAA6B,CAAC,EAAE,MAAM,CAAA;IACtC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1D,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,6BAA6B,EAC7B,mBAAmB,EACnB,wBAAwB,EACxB,UAAU,EACV,aAAa,EACb,KAAK,EACL,WAAW,EACX,YAAY,EACZ,kBAA0B,EAC1B,eAAuB,EACvB,QAAe,EACf,YAAY,EACZ,kBAA6B,EAC7B,gBAAgB,EAChB,QAAQ,EACR,OAAO,GACR,EAAE,wBAAwB,2CA0L1B"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as l, jsx as e, Fragment as
|
|
2
|
-
import { Link as
|
|
1
|
+
import { jsxs as l, jsx as e, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { Link as W } from "@rpcbase/router";
|
|
3
3
|
import { cn as d } from "@rpcbase/ui";
|
|
4
|
-
import { Trash2 as
|
|
5
|
-
import { useTranslation as
|
|
4
|
+
import { Trash2 as D, ArrowRight as T } from "lucide-react";
|
|
5
|
+
import { useTranslation as E } from "react-i18next";
|
|
6
6
|
import { formatPriceMinor as r } from "../../lib/utils.js";
|
|
7
7
|
import { Badge as m } from "../../ui/badge.js";
|
|
8
8
|
import { Button as o } from "../../ui/button.js";
|
|
9
|
-
import { Card as
|
|
10
|
-
import { Input as
|
|
11
|
-
import { ProductWarningNotice as
|
|
12
|
-
function
|
|
9
|
+
import { Card as G } from "../../ui/card.js";
|
|
10
|
+
import { Input as H } from "../../ui/input.js";
|
|
11
|
+
import { ProductWarningNotice as J } from "../ProductWarningNotice/index.js";
|
|
12
|
+
function ee({
|
|
13
13
|
lines: n,
|
|
14
14
|
itemCount: _,
|
|
15
15
|
totalPerDayMinor: v,
|
|
@@ -26,13 +26,14 @@ function M({
|
|
|
26
26
|
showCheckoutAction: q = !1,
|
|
27
27
|
showClearAction: C = !1,
|
|
28
28
|
editable: V = !0,
|
|
29
|
-
|
|
29
|
+
summaryAddon: L,
|
|
30
|
+
stickyTopClassName: P = "top-24",
|
|
30
31
|
onQuantityChange: b,
|
|
31
32
|
onRemove: N,
|
|
32
33
|
onClear: g
|
|
33
34
|
}) {
|
|
34
|
-
const { t, i18n: s } =
|
|
35
|
-
return /* @__PURE__ */ l(
|
|
35
|
+
const { t, i18n: s } = E();
|
|
36
|
+
return /* @__PURE__ */ l(G, { className: d("sticky border-slate-200 bg-white shadow-sm", P), children: [
|
|
36
37
|
/* @__PURE__ */ l("div", { className: "border-b border-slate-200 px-4 py-4", children: [
|
|
37
38
|
/* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-3", children: [
|
|
38
39
|
/* @__PURE__ */ e("p", { className: "text-sm font-semibold text-slate-950", children: /* @__PURE__ */ e("span", { children: j ?? t("cart_title") }) }),
|
|
@@ -42,7 +43,7 @@ function M({
|
|
|
42
43
|
] }),
|
|
43
44
|
/* @__PURE__ */ l("div", { className: "grid gap-3 p-4", children: [
|
|
44
45
|
n.length === 0 ? /* @__PURE__ */ e("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ e("span", { children: t("cart_empty") }) }) : /* @__PURE__ */ e("div", { className: "grid gap-3", children: n.map((a) => {
|
|
45
|
-
const
|
|
46
|
+
const $ = r(a.unitPriceMinor, s.language), z = a.insufficientCapacity === !0, I = a.availabilityIssue === "quantity_unavailable" ? t("availability_quantity_unavailable") : t("availability_out_of_stock");
|
|
46
47
|
return /* @__PURE__ */ l(
|
|
47
48
|
"div",
|
|
48
49
|
{
|
|
@@ -52,20 +53,20 @@ function M({
|
|
|
52
53
|
/* @__PURE__ */ e("p", { className: "truncate text-sm font-medium text-slate-950", children: /* @__PURE__ */ e("span", { children: a.productName }) }),
|
|
53
54
|
a.productVariantLabel ? /* @__PURE__ */ e("p", { className: "text-xs text-slate-600", children: /* @__PURE__ */ e("span", { children: `${t(a.productVariantIsSize ? "product_size_label" : "product_variant_label")}: ${a.productVariantLabel}` }) }) : null,
|
|
54
55
|
a.productVariantDescription ? /* @__PURE__ */ e("p", { className: "text-xs text-slate-500", children: /* @__PURE__ */ e("span", { children: a.productVariantDescription }) }) : null,
|
|
55
|
-
/* @__PURE__ */ e(
|
|
56
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-slate-600", children: /* @__PURE__ */ e("span", { children: t("cart_line_meta", { quantity: a.quantity, price:
|
|
57
|
-
|
|
56
|
+
/* @__PURE__ */ e(J, { warning: a.productWarning }),
|
|
57
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-slate-600", children: /* @__PURE__ */ e("span", { children: t("cart_line_meta", { quantity: a.quantity, price: $ }) }) }),
|
|
58
|
+
z ? /* @__PURE__ */ e("div", { className: "flex flex-col items-start gap-1 pt-1", children: /* @__PURE__ */ e(m, { variant: "destructive", children: /* @__PURE__ */ e("span", { children: I }) }) }) : null
|
|
58
59
|
] }),
|
|
59
60
|
V ? /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
60
61
|
b ? /* @__PURE__ */ e(
|
|
61
|
-
|
|
62
|
+
H,
|
|
62
63
|
{
|
|
63
64
|
type: "number",
|
|
64
65
|
min: 1,
|
|
65
66
|
max: 99,
|
|
66
67
|
value: a.quantity,
|
|
67
|
-
onChange: (
|
|
68
|
-
const y = Number(
|
|
68
|
+
onChange: (B) => {
|
|
69
|
+
const y = Number(B.target.value);
|
|
69
70
|
b(a.key, Number.isFinite(y) ? y : 0);
|
|
70
71
|
},
|
|
71
72
|
className: "h-9 w-16",
|
|
@@ -81,7 +82,7 @@ function M({
|
|
|
81
82
|
className: "h-8 w-8 text-slate-500 hover:bg-slate-50 hover:text-slate-700",
|
|
82
83
|
onClick: () => N(a.key),
|
|
83
84
|
"aria-label": t("remove_from_cart"),
|
|
84
|
-
children: /* @__PURE__ */ e(
|
|
85
|
+
children: /* @__PURE__ */ e(D, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
85
86
|
}
|
|
86
87
|
) : null
|
|
87
88
|
] }) : null
|
|
@@ -90,11 +91,12 @@ function M({
|
|
|
90
91
|
a.key
|
|
91
92
|
);
|
|
92
93
|
}) }),
|
|
94
|
+
L,
|
|
93
95
|
/* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-3 border-t border-slate-200 pt-3 text-sm", children: [
|
|
94
96
|
/* @__PURE__ */ e("p", { className: "text-slate-700", children: /* @__PURE__ */ e("span", { children: t("cart_total_per_day") }) }),
|
|
95
97
|
/* @__PURE__ */ e("p", { className: "font-semibold text-slate-950", children: /* @__PURE__ */ e("span", { children: r(v, s.language) }) })
|
|
96
98
|
] }),
|
|
97
|
-
typeof p == "number" && typeof h == "number" ? /* @__PURE__ */ l(
|
|
99
|
+
typeof p == "number" && typeof h == "number" ? /* @__PURE__ */ l(F, { children: [
|
|
98
100
|
/* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-3 text-sm", children: [
|
|
99
101
|
/* @__PURE__ */ e("p", { className: "text-slate-700", children: /* @__PURE__ */ e("span", { children: t("checkout_estimated_days", { count: p }) }) }),
|
|
100
102
|
u ? /* @__PURE__ */ e(m, { variant: "outline", className: "border-slate-200 bg-white text-slate-700", children: /* @__PURE__ */ e("span", { children: u }) }) : null
|
|
@@ -113,9 +115,9 @@ function M({
|
|
|
113
115
|
] })
|
|
114
116
|
] }) : null,
|
|
115
117
|
/* @__PURE__ */ l("div", { className: "grid gap-2", children: [
|
|
116
|
-
q && f ? /* @__PURE__ */ e(
|
|
118
|
+
q && f ? /* @__PURE__ */ e(W, { to: f, className: d(n.length > 0 ? "block" : "hidden"), children: /* @__PURE__ */ l(o, { className: "w-full gap-2", children: [
|
|
117
119
|
/* @__PURE__ */ e("span", { children: t("checkout_button") }),
|
|
118
|
-
/* @__PURE__ */ e(
|
|
120
|
+
/* @__PURE__ */ e(T, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
119
121
|
] }) }) : null,
|
|
120
122
|
C && g ? /* @__PURE__ */ e(
|
|
121
123
|
o,
|
|
@@ -132,5 +134,5 @@ function M({
|
|
|
132
134
|
] });
|
|
133
135
|
}
|
|
134
136
|
export {
|
|
135
|
-
|
|
137
|
+
ee as StorefrontCartPanel
|
|
136
138
|
};
|
package/dist/i18n/en.js
CHANGED
|
@@ -127,7 +127,7 @@ const e = {
|
|
|
127
127
|
checkout_full_name_placeholder: "Jane Doe",
|
|
128
128
|
checkout_email_label: "Email",
|
|
129
129
|
checkout_email_placeholder: "jane@example.com",
|
|
130
|
-
checkout_phone_label: "Phone
|
|
130
|
+
checkout_phone_label: "Phone",
|
|
131
131
|
checkout_phone_placeholder: "+1 555 555 5555",
|
|
132
132
|
checkout_notes_label: "Notes or message (optional)",
|
|
133
133
|
checkout_notes_placeholder: "Any details about your booking…",
|
package/dist/i18n/fr.js
CHANGED
|
@@ -127,7 +127,7 @@ const e = {
|
|
|
127
127
|
checkout_full_name_placeholder: "Jean Dupont",
|
|
128
128
|
checkout_email_label: "Email",
|
|
129
129
|
checkout_email_placeholder: "jean@example.com",
|
|
130
|
-
checkout_phone_label: "Téléphone
|
|
130
|
+
checkout_phone_label: "Téléphone",
|
|
131
131
|
checkout_phone_placeholder: "+33 6 00 00 00 00",
|
|
132
132
|
checkout_notes_label: "Notes ou message (optionnel)",
|
|
133
133
|
checkout_notes_placeholder: "Précisions pour votre réservation…",
|
package/dist/index.d.ts
CHANGED
|
@@ -2801,7 +2801,7 @@ export declare type StorefrontCartItem = {
|
|
|
2801
2801
|
quantity: number;
|
|
2802
2802
|
};
|
|
2803
2803
|
|
|
2804
|
-
export declare function StorefrontCartPanel({ lines, itemCount, totalPerDayMinor, estimatedDays, estimatedTotalMinor, discountedEstimatedTotalMinor, discountAmountMinor, lateReturnSurchargeMinor, couponCode, durationLabel, title, description, checkoutPath, showCheckoutAction, showClearAction, editable, stickyTopClassName, onQuantityChange, onRemove, onClear, }: StorefrontCartPanelProps): JSX.Element;
|
|
2804
|
+
export declare function StorefrontCartPanel({ lines, itemCount, totalPerDayMinor, estimatedDays, estimatedTotalMinor, discountedEstimatedTotalMinor, discountAmountMinor, lateReturnSurchargeMinor, couponCode, durationLabel, title, description, checkoutPath, showCheckoutAction, showClearAction, editable, summaryAddon, stickyTopClassName, onQuantityChange, onRemove, onClear, }: StorefrontCartPanelProps): JSX.Element;
|
|
2805
2805
|
|
|
2806
2806
|
declare type StorefrontCartPanelProps = {
|
|
2807
2807
|
lines: StorefrontCartSummaryLine[];
|
|
@@ -2820,6 +2820,7 @@ declare type StorefrontCartPanelProps = {
|
|
|
2820
2820
|
showCheckoutAction?: boolean;
|
|
2821
2821
|
showClearAction?: boolean;
|
|
2822
2822
|
editable?: boolean;
|
|
2823
|
+
summaryAddon?: ReactNode;
|
|
2823
2824
|
stickyTopClassName?: string;
|
|
2824
2825
|
onQuantityChange?: (key: string, quantity: number) => void;
|
|
2825
2826
|
onRemove?: (key: string) => void;
|
|
@@ -2893,7 +2894,7 @@ export declare const storefrontCheckoutSubmitRequestBaseSchema: z.ZodObject<{
|
|
|
2893
2894
|
customer: z.ZodObject<{
|
|
2894
2895
|
fullName: z.ZodString;
|
|
2895
2896
|
email: z.ZodString;
|
|
2896
|
-
phone: z.
|
|
2897
|
+
phone: z.ZodString;
|
|
2897
2898
|
notes: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
2898
2899
|
}, z.core.$strip>;
|
|
2899
2900
|
items: z.ZodArray<z.ZodObject<{
|
|
@@ -2926,7 +2927,7 @@ export declare const storefrontCheckoutSubmitRequestSchema: z.ZodObject<{
|
|
|
2926
2927
|
customer: z.ZodObject<{
|
|
2927
2928
|
fullName: z.ZodString;
|
|
2928
2929
|
email: z.ZodString;
|
|
2929
|
-
phone: z.
|
|
2930
|
+
phone: z.ZodString;
|
|
2930
2931
|
notes: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
2931
2932
|
}, z.core.$strip>;
|
|
2932
2933
|
items: z.ZodArray<z.ZodObject<{
|
|
@@ -26,7 +26,7 @@ export declare const requestBaseSchema: z.ZodObject<{
|
|
|
26
26
|
customer: z.ZodObject<{
|
|
27
27
|
fullName: z.ZodString;
|
|
28
28
|
email: z.ZodString;
|
|
29
|
-
phone: z.
|
|
29
|
+
phone: z.ZodString;
|
|
30
30
|
notes: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
31
31
|
}, z.core.$strip>;
|
|
32
32
|
items: z.ZodArray<z.ZodObject<{
|
|
@@ -60,7 +60,7 @@ export declare const requestSchema: z.ZodObject<{
|
|
|
60
60
|
customer: z.ZodObject<{
|
|
61
61
|
fullName: z.ZodString;
|
|
62
62
|
email: z.ZodString;
|
|
63
|
-
phone: z.
|
|
63
|
+
phone: z.ZodString;
|
|
64
64
|
notes: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
65
65
|
}, z.core.$strip>;
|
|
66
66
|
items: z.ZodArray<z.ZodObject<{
|
|
@@ -27,7 +27,7 @@ const x = "/api/public/storefront/checkout/submit", n = t.object({
|
|
|
27
27
|
customer: t.object({
|
|
28
28
|
fullName: t.string().trim().min(2),
|
|
29
29
|
email: t.string().trim().email(),
|
|
30
|
-
phone: t.string().trim().min(6)
|
|
30
|
+
phone: t.string().trim().min(6),
|
|
31
31
|
notes: t.string().trim().max(2e3).optional().or(t.literal(""))
|
|
32
32
|
}),
|
|
33
33
|
items: t.array(n).min(1),
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { JourneyType, TimeSlot } from './booking-period-time-slots';
|
|
2
|
+
export type StorefrontTimeSlotsFetcher = (date: string, journey: JourneyType) => Promise<TimeSlot[] | null>;
|
|
3
|
+
export declare const createStorefrontTimeSlotsFetcher: (storeSlug?: string) => StorefrontTimeSlotsFetcher | undefined;
|
|
4
|
+
//# sourceMappingURL=fetchStorefrontTimeSlots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchStorefrontTimeSlots.d.ts","sourceRoot":"","sources":["../../src/lib/fetchStorefrontTimeSlots.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAO7E,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAA;AAI3G,eAAO,MAAM,gCAAgC,GAAI,YAAY,MAAM,KAAG,0BAA0B,GAAG,SAsBlG,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { apiGet as l } from "./apiCall.js";
|
|
2
|
+
import { ROUTE as u, responseSchema as m } from "./storefrontTimeSlots.js";
|
|
3
|
+
const s = /* @__PURE__ */ new Map(), f = (c) => {
|
|
4
|
+
const e = c?.trim().toLowerCase();
|
|
5
|
+
if (!e)
|
|
6
|
+
return;
|
|
7
|
+
const t = s.get(e);
|
|
8
|
+
if (t)
|
|
9
|
+
return t;
|
|
10
|
+
const r = async (n, a) => {
|
|
11
|
+
const i = await l(u, {
|
|
12
|
+
storeSlug: e,
|
|
13
|
+
date: n,
|
|
14
|
+
journey: a
|
|
15
|
+
}), o = m.parse(i);
|
|
16
|
+
return o.success ? o.timeSlots ?? null : null;
|
|
17
|
+
};
|
|
18
|
+
return s.set(e, r), r;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
f as createStorefrontTimeSlotsFetcher
|
|
22
|
+
};
|
package/dist/lib/pricing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { calculatePriceForQuantity as
|
|
1
|
+
import { calculatePriceForQuantity as D } from "../chunks/booking-engine/dist/utils/pricing-CYLeWtmu.js";
|
|
2
2
|
import { formatPriceMinor as d } from "./utils.js";
|
|
3
3
|
const f = "EUR", b = 8, p = (t) => [...t].sort((r, i) => r.quantity - i.quantity), P = (t) => t.find((r) => r.currency?.trim())?.currency?.trim() || f, F = (t) => Math.abs(t) % 100 !== 0 ? {} : {
|
|
4
4
|
minimumFractionDigits: 0,
|
|
@@ -17,7 +17,7 @@ function Q(t, r) {
|
|
|
17
17
|
const i = m(t);
|
|
18
18
|
if (i.length === 0) return null;
|
|
19
19
|
try {
|
|
20
|
-
return
|
|
20
|
+
return D(i, r, "day");
|
|
21
21
|
} catch {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
@@ -38,7 +38,7 @@ function E(t, r) {
|
|
|
38
38
|
function I(t, r, i) {
|
|
39
39
|
const n = m(t), a = P(n);
|
|
40
40
|
return n.map((c, e) => {
|
|
41
|
-
const o = e > 0 ? n[e - 1] : void 0, s = o?.quantity ?? 0,
|
|
41
|
+
const o = e > 0 ? n[e - 1] : void 0, s = o?.quantity ?? 0, g = o?.value ?? 0, l = c.quantity - s, y = c.value - g;
|
|
42
42
|
return l <= 0 || y < 0 ? u(c.value, r, { currency: a }) : `${u(y, r, { currency: a })} / ${_(l, r, i)}`;
|
|
43
43
|
});
|
|
44
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AAwQA,MAAM,CAAC,OAAO,UAAU,WAAW,
|
|
1
|
+
{"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AAwQA,MAAM,CAAC,OAAO,UAAU,WAAW,4CA2lBlC"}
|