@loczer/storefront-sdk 0.221.0 → 0.222.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.
Files changed (40) hide show
  1. package/dist/StorefrontContext.d.ts +2 -2
  2. package/dist/StorefrontProvider.d.ts +2 -2
  3. package/dist/components/Header/index.d.ts.map +1 -1
  4. package/dist/components/Header/index.js +118 -126
  5. package/dist/components/LanguageSelector/index.d.ts +7 -0
  6. package/dist/components/LanguageSelector/index.d.ts.map +1 -0
  7. package/dist/components/LanguageSelector/index.js +69 -0
  8. package/dist/components/StorefrontCartPanel/index.d.ts +2 -8
  9. package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
  10. package/dist/components/StorefrontCartPanel/index.js +65 -107
  11. package/dist/i18n/I18nProvider.d.ts +3 -2
  12. package/dist/i18n/I18nProvider.d.ts.map +1 -1
  13. package/dist/i18n/I18nProvider.js +61 -64
  14. package/dist/i18n/en.d.ts +2 -2
  15. package/dist/i18n/en.js +2 -2
  16. package/dist/i18n/fr.d.ts +2 -2
  17. package/dist/i18n/fr.js +2 -2
  18. package/dist/i18n/languages.d.ts +15 -0
  19. package/dist/i18n/languages.d.ts.map +1 -0
  20. package/dist/i18n/languages.js +26 -0
  21. package/dist/index.d.ts +33 -24
  22. package/dist/index.js +50 -49
  23. package/dist/lib/cartSummary.d.ts +2 -5
  24. package/dist/lib/cartSummary.d.ts.map +1 -1
  25. package/dist/lib/cartSummary.js +5 -11
  26. package/dist/pages/BookingPage.d.ts.map +1 -1
  27. package/dist/pages/BookingPage.js +150 -148
  28. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  29. package/dist/pages/CheckoutPage.js +1 -2
  30. package/dist/pages/ContractSaleDocumentPage.d.ts +2 -3
  31. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  32. package/dist/pages/ContractSaleDocumentPage.js +18 -17
  33. package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts +2 -2
  34. package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
  35. package/dist/pages/checkout/components/CheckoutSummaryColumn.js +14 -15
  36. package/dist/storefront.css +1 -1
  37. package/dist/storefrontSchemas.d.ts +2 -2
  38. package/dist/storefrontSchemas.d.ts.map +1 -1
  39. package/dist/storefrontSchemas.js +95 -94
  40. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
- import { Button as e } from "../ui/button.js";
2
- import { normalizeStorefrontI18nLanguage as t } from "../i18n/I18nProvider.js";
1
+ import { normalizeStorefrontI18nLanguage as e } from "../i18n/languages.js";
2
+ import { Button as t } from "../ui/button.js";
3
+ import "../i18n/I18nProvider.js";
3
4
  import { toast as n } from "../lib/toast.js";
4
5
  import { Card as r } from "../ui/card.js";
5
6
  import { ContractSaleDocument as i } from "../components/ContractSaleDocument/Invoice.js";
@@ -63,14 +64,14 @@ var k = (e) => new URLSearchParams(e).get("pdf") === "1", A = (e) => c(new URLSe
63
64
  code: "fr",
64
65
  labelKey: "docs_contract_sale_language_option_fr"
65
66
  };
66
- function z({ selectedLanguage: t, onChange: n }) {
67
- let { t: r } = C(), [i, a] = g(!1), o = L.find((e) => e.code === t) ?? R;
67
+ function z({ selectedLanguage: e, onChange: n }) {
68
+ let { t: r } = C(), [i, a] = g(!1), o = L.find((t) => t.code === e) ?? R;
68
69
  return /* @__PURE__ */ v(O.Root, {
69
70
  open: i,
70
71
  onOpenChange: a,
71
72
  children: [/* @__PURE__ */ _(O.Trigger, {
72
73
  nativeButton: !0,
73
- render: /* @__PURE__ */ v(e, {
74
+ render: /* @__PURE__ */ v(t, {
74
75
  variant: "outline",
75
76
  size: "sm",
76
77
  type: "button",
@@ -100,17 +101,17 @@ function z({ selectedLanguage: t, onChange: n }) {
100
101
  "data-state": t.open ? "open" : "closed"
101
102
  }),
102
103
  className: "z-50 min-w-36 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md transition-opacity duration-75 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 data-[instant]:transition-none",
103
- children: L.map((e) => /* @__PURE__ */ v(O.Item, {
104
- onClick: (t) => {
105
- t.defaultPrevented || (n(e.code), a(!1));
104
+ children: L.map((t) => /* @__PURE__ */ v(O.Item, {
105
+ onClick: (e) => {
106
+ e.defaultPrevented || (n(t.code), a(!1));
106
107
  },
107
- "data-testid": `contract-sale-document-language-option-${e.code}`,
108
- className: w("relative flex cursor-pointer select-none items-center justify-between gap-3 whitespace-nowrap rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground", t === e.code && "bg-accent"),
109
- children: [/* @__PURE__ */ _("span", { children: r(e.labelKey) }), /* @__PURE__ */ _("span", {
108
+ "data-testid": `contract-sale-document-language-option-${t.code}`,
109
+ className: w("relative flex cursor-pointer select-none items-center justify-between gap-3 whitespace-nowrap rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground", e === t.code && "bg-accent"),
110
+ children: [/* @__PURE__ */ _("span", { children: r(t.labelKey) }), /* @__PURE__ */ _("span", {
110
111
  className: "text-2xs uppercase text-muted-foreground",
111
- children: e.code
112
+ children: t.code
112
113
  })]
113
- }, e.code))
114
+ }, t.code))
114
115
  })
115
116
  }) })]
116
117
  });
@@ -166,11 +167,11 @@ var B = (async ({ ctx: e, params: t, request: n }) => {
166
167
  return t.success ? t.data : null;
167
168
  };
168
169
  function H() {
169
- let { t: a, i18n: s } = C(), c = b(), u = x(), d = S(), { storeSlug: p, referenceId: m, saleDocumentId: w } = c, E = c.pdfMode || k(u.search), O = j(u.search), M = O ?? `/${p ?? ""}`, L = a(O ? "docs_contract_sale_back" : "docs_contract_sale_back_to_storefront"), [R, B] = g(V(c.document)), [H, U] = g(null), [W, G] = g(!1), [K, q] = g(c.error), J = A(u.search) ?? t(R?.language?.customer) ?? c.documentLanguage ?? t(s.language) ?? "fr", Y = p && m && w ? N(p, m, w, J) : null, X = p && m && w ? P(p, m, w, J) : "";
170
+ let { t: a, i18n: s } = C(), c = b(), u = x(), d = S(), { storeSlug: p, referenceId: m, saleDocumentId: w } = c, E = c.pdfMode || k(u.search), O = j(u.search), M = O ?? `/${p ?? ""}`, L = a(O ? "docs_contract_sale_back" : "docs_contract_sale_back_to_storefront"), [R, B] = g(V(c.document)), [H, U] = g(null), [W, G] = g(!1), [K, q] = g(c.error), J = A(u.search) ?? e(R?.language?.customer) ?? c.documentLanguage ?? e(s.language) ?? "fr", Y = p && m && w ? N(p, m, w, J) : null, X = p && m && w ? P(p, m, w, J) : "";
170
171
  h(() => {
171
172
  B(V(c.document)), q(c.error);
172
173
  }, [c.document, c.error]), h(() => {
173
- t(s.language) !== J && s.changeLanguage(J);
174
+ e(s.language) !== J && s.changeLanguage(J);
174
175
  }, [s, J]);
175
176
  let Z = (e) => {
176
177
  if (e === J) return;
@@ -198,7 +199,7 @@ function H() {
198
199
  /* @__PURE__ */ _(y, {
199
200
  to: M,
200
201
  "data-testid": "contract-sale-document-back-link",
201
- children: /* @__PURE__ */ v(e, {
202
+ children: /* @__PURE__ */ v(t, {
202
203
  className: "gap-2",
203
204
  children: [/* @__PURE__ */ _(T, {
204
205
  className: "h-4 w-4",
@@ -267,7 +268,7 @@ function H() {
267
268
  selectedLanguage: J,
268
269
  onChange: Z
269
270
  }),
270
- Y ? /* @__PURE__ */ v(e, {
271
+ Y ? /* @__PURE__ */ v(t, {
271
272
  variant: "outline",
272
273
  size: "sm",
273
274
  type: "button",
@@ -3,13 +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" | "onQuantityChange" | "onRemove"> & {
6
+ type CheckoutSummaryColumnProps = Pick<StorefrontCartPanelProps, "lines" | "itemCount" | "baseUnitLabel" | "onQuantityChange" | "onRemove"> & {
7
7
  coupon?: CheckoutCouponCardProps;
8
8
  bookingSubtotalLabel: string;
9
9
  vatAmountLabel: string;
10
10
  vatRateLabel: string;
11
11
  bookingTotalLabel: string;
12
12
  };
13
- export declare function CheckoutSummaryColumn({ lines, itemCount, totalPerBaseUnitMinor, baseUnitLabel, coupon, bookingSubtotalLabel, vatAmountLabel, vatRateLabel, bookingTotalLabel, onQuantityChange, onRemove, }: CheckoutSummaryColumnProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function CheckoutSummaryColumn({ lines, itemCount, baseUnitLabel, coupon, bookingSubtotalLabel, vatAmountLabel, vatRateLabel, bookingTotalLabel, onQuantityChange, onRemove, }: CheckoutSummaryColumnProps): import("react/jsx-runtime").JSX.Element;
14
14
  export {};
15
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,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
+ {"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,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,aAAa,EACb,MAAM,EACN,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,GACT,EAAE,0BAA0B,2CA+C5B"}
@@ -3,19 +3,18 @@ import { CheckoutCouponCard as t } from "./CheckoutCouponCard.js";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
4
  import { useTranslation as i } from "react-i18next";
5
5
  //#region src/pages/checkout/components/CheckoutSummaryColumn.tsx
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();
6
+ function a({ lines: a, itemCount: o, baseUnitLabel: s, coupon: c, bookingSubtotalLabel: l, vatAmountLabel: u, vatRateLabel: d, bookingTotalLabel: f, onQuantityChange: p, onRemove: m }) {
7
+ let { t: h } = i();
8
8
  return /* @__PURE__ */ n("div", {
9
9
  className: "lg:col-span-5",
10
10
  children: /* @__PURE__ */ n(e, {
11
11
  lines: a,
12
12
  itemCount: o,
13
- totalPerBaseUnitMinor: s,
14
- baseUnitLabel: c,
15
- title: g("checkout_summary_title"),
16
- description: g("checkout_summary_description"),
13
+ baseUnitLabel: s,
14
+ title: h("checkout_summary_title"),
15
+ description: h("checkout_summary_description"),
17
16
  editable: !0,
18
- summaryAddon: l ? /* @__PURE__ */ n(t, { ...l }) : void 0,
17
+ summaryAddon: c ? /* @__PURE__ */ n(t, { ...c }) : void 0,
19
18
  pricingSummary: /* @__PURE__ */ r("dl", {
20
19
  className: "grid border-t border-slate-200 pt-3 text-sm",
21
20
  "data-testid": "checkout-booking-totals",
@@ -24,37 +23,37 @@ function a({ lines: a, itemCount: o, totalPerBaseUnitMinor: s, baseUnitLabel: c,
24
23
  className: "flex items-center justify-between gap-3 py-1.5",
25
24
  children: [/* @__PURE__ */ n("dt", {
26
25
  className: "text-slate-700",
27
- children: /* @__PURE__ */ n("span", { children: g("checkout_booking_subtotal") })
26
+ children: /* @__PURE__ */ n("span", { children: h("checkout_booking_subtotal") })
28
27
  }), /* @__PURE__ */ n("dd", {
29
28
  className: "font-medium tabular-nums text-slate-900",
30
- children: /* @__PURE__ */ n("span", { children: u })
29
+ children: /* @__PURE__ */ n("span", { children: l })
31
30
  })]
32
31
  }),
33
32
  /* @__PURE__ */ r("div", {
34
33
  className: "flex items-center justify-between gap-3 py-1.5",
35
34
  children: [/* @__PURE__ */ n("dt", {
36
35
  className: "text-slate-700",
37
- children: /* @__PURE__ */ n("span", { children: g("checkout_payment_vat", { rate: f }) })
36
+ children: /* @__PURE__ */ n("span", { children: h("checkout_payment_vat", { rate: d }) })
38
37
  }), /* @__PURE__ */ n("dd", {
39
38
  className: "font-medium tabular-nums text-slate-900",
40
- children: /* @__PURE__ */ n("span", { children: d })
39
+ children: /* @__PURE__ */ n("span", { children: u })
41
40
  })]
42
41
  }),
43
42
  /* @__PURE__ */ r("div", {
44
43
  className: "mt-1 flex items-center justify-between gap-3 border-t border-slate-200 pt-3",
45
44
  children: [/* @__PURE__ */ n("dt", {
46
45
  className: "font-semibold text-slate-950",
47
- children: /* @__PURE__ */ n("span", { children: g("checkout_estimated_total") })
46
+ children: /* @__PURE__ */ n("span", { children: h("checkout_estimated_total") })
48
47
  }), /* @__PURE__ */ n("dd", {
49
48
  className: "text-base font-bold tabular-nums tracking-tight text-slate-950",
50
- children: /* @__PURE__ */ n("span", { children: p })
49
+ children: /* @__PURE__ */ n("span", { children: f })
51
50
  })]
52
51
  })
53
52
  ]
54
53
  }),
55
54
  stickyTopClassName: "top-32",
56
- onQuantityChange: m,
57
- onRemove: h
55
+ onQuantityChange: p,
56
+ onRemove: m
58
57
  })
59
58
  });
60
59
  }