@loczer/storefront-sdk 0.220.0 → 0.221.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.
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutDetailsCard.d.ts","sourceRoot":"","sources":["../../../../src/pages/checkout/components/CheckoutDetailsCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAOlD,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAElE,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,YAAY,CAAA;CACnB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE,wBAAwB,2CA2FrE"}
1
+ {"version":3,"file":"CheckoutDetailsCard.d.ts","sourceRoot":"","sources":["../../../../src/pages/checkout/components/CheckoutDetailsCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAA;AAK5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAOlD,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAElE,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,YAAY,CAAA;CACnB,CAAA;AAOD,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE,wBAAwB,2CAsHrE"}
@@ -4,88 +4,101 @@ import { Textarea as s } from "../../../ui/textarea.js";
4
4
  import { Card as c } from "../../../ui/card.js";
5
5
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
6
6
  import { useTranslation as d } from "react-i18next";
7
+ import { PhoneNumberInput as f, cn as p } from "@rpcbase/ui";
7
8
  //#region src/pages/checkout/components/CheckoutDetailsCard.tsx
8
- function f({ form: f }) {
9
- let { t: p } = d();
9
+ var m = (e) => e.startsWith("fr") ? "FR" : "US";
10
+ function h({ form: h }) {
11
+ let { t: g, i18n: _ } = d();
10
12
  return /* @__PURE__ */ u(c, {
11
13
  className: "border-slate-200 bg-white shadow-sm",
12
14
  children: [/* @__PURE__ */ u("div", {
13
15
  className: "border-b border-slate-200 px-4 py-4",
14
16
  children: [/* @__PURE__ */ l("p", {
15
17
  className: "text-sm font-semibold text-slate-950",
16
- children: /* @__PURE__ */ l("span", { children: p("checkout_form_title") })
18
+ children: /* @__PURE__ */ l("span", { children: g("checkout_form_title") })
17
19
  }), /* @__PURE__ */ l("p", {
18
20
  className: "mt-1 text-xs text-slate-600",
19
- children: /* @__PURE__ */ l("span", { children: p("checkout_form_description") })
21
+ children: /* @__PURE__ */ l("span", { children: g("checkout_form_description") })
20
22
  })]
21
23
  }), /* @__PURE__ */ l("div", {
22
24
  className: "px-4 py-4",
23
25
  children: /* @__PURE__ */ l(t, {
24
- ...f,
26
+ ...h,
25
27
  children: /* @__PURE__ */ u("form", {
26
28
  onSubmit: (e) => e.preventDefault(),
27
29
  className: "grid gap-3",
28
30
  children: [
29
31
  /* @__PURE__ */ l(r, {
30
- control: f.control,
32
+ control: h.control,
31
33
  name: "first_name",
32
34
  render: ({ field: t }) => /* @__PURE__ */ u(i, { children: [
33
- /* @__PURE__ */ l(a, { children: p("checkout_first_name_label") }),
35
+ /* @__PURE__ */ l(a, { children: g("checkout_first_name_label") }),
34
36
  /* @__PURE__ */ l(n, { children: /* @__PURE__ */ l(e, {
35
37
  ...t,
36
38
  autoComplete: "given-name",
37
- placeholder: p("checkout_first_name_placeholder")
39
+ placeholder: g("checkout_first_name_placeholder")
38
40
  }) }),
39
41
  /* @__PURE__ */ l(o, {})
40
42
  ] })
41
43
  }),
42
44
  /* @__PURE__ */ l(r, {
43
- control: f.control,
45
+ control: h.control,
44
46
  name: "last_name",
45
47
  render: ({ field: t }) => /* @__PURE__ */ u(i, { children: [
46
- /* @__PURE__ */ l(a, { children: p("checkout_last_name_label") }),
48
+ /* @__PURE__ */ l(a, { children: g("checkout_last_name_label") }),
47
49
  /* @__PURE__ */ l(n, { children: /* @__PURE__ */ l(e, {
48
50
  ...t,
49
51
  autoComplete: "family-name",
50
- placeholder: p("checkout_last_name_placeholder")
52
+ placeholder: g("checkout_last_name_placeholder")
51
53
  }) }),
52
54
  /* @__PURE__ */ l(o, {})
53
55
  ] })
54
56
  }),
55
57
  /* @__PURE__ */ l(r, {
56
- control: f.control,
58
+ control: h.control,
57
59
  name: "email",
58
60
  render: ({ field: t }) => /* @__PURE__ */ u(i, { children: [
59
- /* @__PURE__ */ l(a, { children: p("checkout_email_label") }),
61
+ /* @__PURE__ */ l(a, { children: g("checkout_email_label") }),
60
62
  /* @__PURE__ */ l(n, { children: /* @__PURE__ */ l(e, {
61
63
  ...t,
62
64
  type: "email",
63
- placeholder: p("checkout_email_placeholder")
65
+ placeholder: g("checkout_email_placeholder")
64
66
  }) }),
65
67
  /* @__PURE__ */ l(o, {})
66
68
  ] })
67
69
  }),
68
70
  /* @__PURE__ */ l(r, {
69
- control: f.control,
71
+ control: h.control,
70
72
  name: "phone",
71
- render: ({ field: t }) => /* @__PURE__ */ u(i, { children: [
72
- /* @__PURE__ */ l(a, { children: p("checkout_phone_label") }),
73
- /* @__PURE__ */ l(n, { children: /* @__PURE__ */ l(e, {
74
- ...t,
75
- placeholder: p("checkout_phone_placeholder")
73
+ render: ({ field: e, fieldState: t }) => /* @__PURE__ */ u(i, { children: [
74
+ /* @__PURE__ */ l(a, { children: g("checkout_phone_label") }),
75
+ /* @__PURE__ */ l(n, { children: /* @__PURE__ */ l(f, {
76
+ name: e.name,
77
+ value: e.value ?? "",
78
+ onBlur: e.onBlur,
79
+ onChange: (t) => {
80
+ let n = t.e164 || t.formattedInternational || t.rawInput || "";
81
+ e.onChange(n);
82
+ },
83
+ defaultCountry: m(_.language),
84
+ locale: _.language,
85
+ placeholder: g("checkout_phone_placeholder"),
86
+ className: "relative",
87
+ inputClassName: p(t.error && "border-destructive focus-visible:ring-destructive"),
88
+ renderValidationMessage: ({ message: e }) => t.error?.message ? null : /* @__PURE__ */ l(o, { children: /* @__PURE__ */ l("span", { children: e }) })
76
89
  }) }),
77
- /* @__PURE__ */ l(o, {})
90
+ t.error?.message ? /* @__PURE__ */ l(o, {}) : null
78
91
  ] })
79
92
  }),
80
93
  /* @__PURE__ */ l(r, {
81
- control: f.control,
94
+ control: h.control,
82
95
  name: "notes",
83
96
  render: ({ field: e }) => /* @__PURE__ */ u(i, { children: [
84
- /* @__PURE__ */ l(a, { children: p("checkout_notes_label") }),
97
+ /* @__PURE__ */ l(a, { children: g("checkout_notes_label") }),
85
98
  /* @__PURE__ */ l(n, { children: /* @__PURE__ */ l(s, {
86
99
  ...e,
87
100
  rows: 4,
88
- placeholder: p("checkout_notes_placeholder")
101
+ placeholder: g("checkout_notes_placeholder")
89
102
  }) }),
90
103
  /* @__PURE__ */ l(o, {})
91
104
  ] })
@@ -97,4 +110,4 @@ function f({ form: f }) {
97
110
  });
98
111
  }
99
112
  //#endregion
100
- export { f as CheckoutDetailsCard };
113
+ export { h as CheckoutDetailsCard };
@@ -3,9 +3,13 @@ import { StorefrontCartPanel } from '../../../components/StorefrontCartPanel';
3
3
  import { CheckoutCouponCard } from './CheckoutCouponCard';
4
4
  type StorefrontCartPanelProps = ComponentProps<typeof StorefrontCartPanel>;
5
5
  type CheckoutCouponCardProps = ComponentProps<typeof CheckoutCouponCard>;
6
- type CheckoutSummaryColumnProps = Pick<StorefrontCartPanelProps, "lines" | "itemCount" | "totalPerBaseUnitMinor" | "baseUnitLabel" | "estimatedTotalMinor" | "discountedEstimatedTotalMinor" | "discountAmountMinor" | "lateReturnSurchargeMinor" | "couponCode" | "durationInBaseUnitLabel" | "onQuantityChange" | "onRemove"> & {
6
+ type CheckoutSummaryColumnProps = Pick<StorefrontCartPanelProps, "lines" | "itemCount" | "totalPerBaseUnitMinor" | "baseUnitLabel" | "onQuantityChange" | "onRemove"> & {
7
7
  coupon?: CheckoutCouponCardProps;
8
+ bookingSubtotalLabel: string;
9
+ vatAmountLabel: string;
10
+ vatRateLabel: string;
11
+ bookingTotalLabel: string;
8
12
  };
9
- export declare function CheckoutSummaryColumn({ lines, itemCount, totalPerBaseUnitMinor, baseUnitLabel, estimatedTotalMinor, discountedEstimatedTotalMinor, discountAmountMinor, lateReturnSurchargeMinor, couponCode, durationInBaseUnitLabel, coupon, onQuantityChange, onRemove, }: CheckoutSummaryColumnProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function CheckoutSummaryColumn({ lines, itemCount, totalPerBaseUnitMinor, baseUnitLabel, coupon, bookingSubtotalLabel, vatAmountLabel, vatRateLabel, bookingTotalLabel, onQuantityChange, onRemove, }: CheckoutSummaryColumnProps): import("react/jsx-runtime").JSX.Element;
10
14
  export {};
11
15
  //# sourceMappingURL=CheckoutSummaryColumn.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutSummaryColumn.d.ts","sourceRoot":"","sources":["../../../../src/pages/checkout/components/CheckoutSummaryColumn.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAGzD,KAAK,wBAAwB,GAAG,cAAc,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC1E,KAAK,uBAAuB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAExE,KAAK,0BAA0B,GAAG,IAAI,CACpC,wBAAwB,EACtB,OAAO,GACP,WAAW,GACX,uBAAuB,GACvB,eAAe,GACf,qBAAqB,GACrB,+BAA+B,GAC/B,qBAAqB,GACrB,0BAA0B,GAC1B,YAAY,GACZ,yBAAyB,GACzB,kBAAkB,GAClB,UAAU,CACb,GAAG;IACF,MAAM,CAAC,EAAE,uBAAuB,CAAA;CACjC,CAAA;AAED,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,SAAS,EACT,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,6BAA6B,EAC7B,mBAAmB,EACnB,wBAAwB,EACxB,UAAU,EACV,uBAAuB,EACvB,MAAM,EACN,gBAAgB,EAChB,QAAQ,GACT,EAAE,0BAA0B,2CA0B5B"}
1
+ {"version":3,"file":"CheckoutSummaryColumn.d.ts","sourceRoot":"","sources":["../../../../src/pages/checkout/components/CheckoutSummaryColumn.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAGzD,KAAK,wBAAwB,GAAG,cAAc,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC1E,KAAK,uBAAuB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAExE,KAAK,0BAA0B,GAAG,IAAI,CACpC,wBAAwB,EACtB,OAAO,GACP,WAAW,GACX,uBAAuB,GACvB,eAAe,GACf,kBAAkB,GAClB,UAAU,CACb,GAAG;IACF,MAAM,CAAC,EAAE,uBAAuB,CAAA;IAChC,oBAAoB,EAAE,MAAM,CAAA;IAC5B,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,SAAS,EACT,qBAAqB,EACrB,aAAa,EACb,MAAM,EACN,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,GACT,EAAE,0BAA0B,2CAgD5B"}
@@ -1,32 +1,62 @@
1
1
  import { StorefrontCartPanel as e } from "../../../components/StorefrontCartPanel/index.js";
2
2
  import { CheckoutCouponCard as t } from "./CheckoutCouponCard.js";
3
- import { jsx as n } from "react/jsx-runtime";
4
- import { useTranslation as r } from "react-i18next";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { useTranslation as i } from "react-i18next";
5
5
  //#region src/pages/checkout/components/CheckoutSummaryColumn.tsx
6
- function i({ lines: i, itemCount: a, totalPerBaseUnitMinor: o, baseUnitLabel: s, estimatedTotalMinor: c, discountedEstimatedTotalMinor: l, discountAmountMinor: u, lateReturnSurchargeMinor: d, couponCode: f, durationInBaseUnitLabel: p, coupon: m, onQuantityChange: h, onRemove: g }) {
7
- let { t: _ } = r();
6
+ function a({ lines: a, itemCount: o, totalPerBaseUnitMinor: s, baseUnitLabel: c, coupon: l, bookingSubtotalLabel: u, vatAmountLabel: d, vatRateLabel: f, bookingTotalLabel: p, onQuantityChange: m, onRemove: h }) {
7
+ let { t: g } = i();
8
8
  return /* @__PURE__ */ n("div", {
9
9
  className: "lg:col-span-5",
10
10
  children: /* @__PURE__ */ n(e, {
11
- lines: i,
12
- itemCount: a,
13
- totalPerBaseUnitMinor: o,
14
- baseUnitLabel: s,
15
- estimatedTotalMinor: c,
16
- discountedEstimatedTotalMinor: l,
17
- discountAmountMinor: u,
18
- lateReturnSurchargeMinor: d,
19
- couponCode: f,
20
- durationInBaseUnitLabel: p,
21
- title: _("checkout_summary_title"),
22
- description: _("checkout_summary_description"),
11
+ lines: a,
12
+ itemCount: o,
13
+ totalPerBaseUnitMinor: s,
14
+ baseUnitLabel: c,
15
+ title: g("checkout_summary_title"),
16
+ description: g("checkout_summary_description"),
23
17
  editable: !0,
24
- summaryAddon: m ? /* @__PURE__ */ n(t, { ...m }) : void 0,
18
+ summaryAddon: l ? /* @__PURE__ */ n(t, { ...l }) : void 0,
19
+ pricingSummary: /* @__PURE__ */ r("dl", {
20
+ className: "grid border-t border-slate-200 pt-3 text-sm",
21
+ "data-testid": "checkout-booking-totals",
22
+ children: [
23
+ /* @__PURE__ */ r("div", {
24
+ className: "flex items-center justify-between gap-3 py-1.5",
25
+ children: [/* @__PURE__ */ n("dt", {
26
+ className: "text-slate-700",
27
+ children: /* @__PURE__ */ n("span", { children: g("checkout_booking_subtotal") })
28
+ }), /* @__PURE__ */ n("dd", {
29
+ className: "font-medium tabular-nums text-slate-900",
30
+ children: /* @__PURE__ */ n("span", { children: u })
31
+ })]
32
+ }),
33
+ /* @__PURE__ */ r("div", {
34
+ className: "flex items-center justify-between gap-3 py-1.5",
35
+ children: [/* @__PURE__ */ n("dt", {
36
+ className: "text-slate-700",
37
+ children: /* @__PURE__ */ n("span", { children: g("checkout_payment_vat", { rate: f }) })
38
+ }), /* @__PURE__ */ n("dd", {
39
+ className: "font-medium tabular-nums text-slate-900",
40
+ children: /* @__PURE__ */ n("span", { children: d })
41
+ })]
42
+ }),
43
+ /* @__PURE__ */ r("div", {
44
+ className: "mt-1 flex items-center justify-between gap-3 border-t border-slate-200 pt-3",
45
+ children: [/* @__PURE__ */ n("dt", {
46
+ className: "font-semibold text-slate-950",
47
+ children: /* @__PURE__ */ n("span", { children: g("checkout_estimated_total") })
48
+ }), /* @__PURE__ */ n("dd", {
49
+ className: "text-base font-bold tabular-nums tracking-tight text-slate-950",
50
+ children: /* @__PURE__ */ n("span", { children: p })
51
+ })]
52
+ })
53
+ ]
54
+ }),
25
55
  stickyTopClassName: "top-32",
26
- onQuantityChange: h,
27
- onRemove: g
56
+ onQuantityChange: m,
57
+ onRemove: h
28
58
  })
29
59
  });
30
60
  }
31
61
  //#endregion
32
- export { i as CheckoutSummaryColumn };
62
+ export { a as CheckoutSummaryColumn };