@loczer/storefront-sdk 0.221.0 → 0.223.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 (43) 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 +3 -3
  16. package/dist/i18n/fr.d.ts +2 -2
  17. package/dist/i18n/fr.js +3 -3
  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/lib/checkoutPaymentDecision.d.ts +1 -0
  27. package/dist/lib/checkoutPaymentDecision.d.ts.map +1 -1
  28. package/dist/lib/checkoutPaymentDecision.js +1 -0
  29. package/dist/pages/BookingPage.d.ts.map +1 -1
  30. package/dist/pages/BookingPage.js +150 -148
  31. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  32. package/dist/pages/CheckoutPage.js +156 -155
  33. package/dist/pages/ContractSaleDocumentPage.d.ts +2 -3
  34. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  35. package/dist/pages/ContractSaleDocumentPage.js +18 -17
  36. package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts +2 -2
  37. package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
  38. package/dist/pages/checkout/components/CheckoutSummaryColumn.js +14 -15
  39. package/dist/storefront.css +1 -1
  40. package/dist/storefrontSchemas.d.ts +2 -2
  41. package/dist/storefrontSchemas.d.ts.map +1 -1
  42. package/dist/storefrontSchemas.js +95 -94
  43. package/package.json +1 -1
@@ -45,102 +45,102 @@ var Fe = .2, f = (e, t, n) => {
45
45
  }
46
46
  };
47
47
  function p() {
48
- let { t: p, i18n: m } = Ae(), { storefrontConfiguration: h } = fe(), Le = h.workspace?.workspaceLanguage, { bikes: Re, accessories: ze } = pe(), { storeSlug: g } = Oe(), [_, Be] = ke(), Ve = De(), { items: He, itemCount: Ue, setQuantity: We, removeItem: Ge, beginCheckoutSubmission: Ke, confirmCheckoutPaymentSession: qe, clearCheckoutSession: Je, clear: Ye } = ee(), [v, Xe] = l(!1), y = Te(!1), [b, x] = l(null), [Ze, S] = l(!1), [C, w] = l(null), Qe = _.get("coupon") ?? _.get("code") ?? "", [$e, et] = l(Qe), [tt, nt] = l(Qe.trim()), [T, E] = l(null), [D, O] = l(null), [k, A] = l(!1), [rt, j] = l(null), [it, M] = l(null), [N, at] = l(!1), [P, ot] = l(!1), st = n(_).toString(), ct = c(() => r(new URLSearchParams(st), g), [st, g]), F = h.settings.fulfillmentModes.includes("delivery"), lt = h.settings.deliveryDisabledReason.trim(), ut = F || lt.length > 0, dt = h.shop.address?.trim() ?? "", I = c(() => {
49
- let e = t(ct, {
48
+ let { t: p, i18n: m } = Ae(), { storefrontConfiguration: h } = fe(), Le = h.workspace?.workspaceLanguage, { bikes: g, accessories: Re } = pe(), { storeSlug: _ } = Oe(), [v, ze] = ke(), Be = De(), { items: Ve, itemCount: He, setQuantity: Ue, removeItem: We, beginCheckoutSubmission: Ge, confirmCheckoutPaymentSession: Ke, clearCheckoutSession: qe, clear: Je } = ee(), [y, Ye] = l(!1), b = Te(!1), [x, S] = l(null), [Xe, C] = l(!1), [w, T] = l(null), Ze = v.get("coupon") ?? v.get("code") ?? "", [Qe, E] = l(Ze), [$e, et] = l(Ze.trim()), [D, O] = l(null), [k, A] = l(null), [j, M] = l(!1), [tt, N] = l(null), [nt, P] = l(null), [F, rt] = l(!1), [I, it] = l(!1), at = n(v).toString(), ot = c(() => r(new URLSearchParams(at), _), [at, _]), L = h.settings.fulfillmentModes.includes("delivery"), st = h.settings.deliveryDisabledReason.trim(), ct = L || st.length > 0, lt = h.shop.address?.trim() ?? "", R = c(() => {
49
+ let e = t(ot, {
50
50
  start_time: "",
51
51
  end_time: ""
52
52
  });
53
- return e.fulfillment === "delivery" && !F ? {
53
+ return e.fulfillment === "delivery" && !L ? {
54
54
  ...e,
55
55
  fulfillment: "pickup"
56
56
  } : e;
57
- }, [ct, F]), L = c(() => le(I), [I]), R = h.bookingEngine.pricing, ft = te(I, R, h.bookingEngine.shop.timeZone), pt = ne(R.baseUnit, p), mt = ft?.billableUnitCount, z = c(() => re({
58
- items: He,
57
+ }, [ot, L]), z = c(() => le(R), [R]), B = h.bookingEngine.pricing, ut = te(R, B, h.bookingEngine.shop.timeZone), dt = ne(B.baseUnit, p), ft = ut?.billableUnitCount, V = c(() => re({
58
+ items: Ve,
59
59
  language: m.language,
60
60
  fallbackLanguage: Le,
61
61
  products: {
62
- bikes: Re,
63
- accessories: ze
62
+ bikes: g,
63
+ accessories: Re
64
64
  },
65
- priceUnit: R.baseUnit,
66
- billableUnitCount: mt
65
+ priceUnit: B.baseUnit,
66
+ billableUnitCount: ft
67
67
  }), [
68
- ze,
69
68
  Re,
70
- mt,
69
+ g,
70
+ ft,
71
71
  m.language,
72
- He,
73
- R.baseUnit,
72
+ Ve,
73
+ B.baseUnit,
74
74
  Le
75
- ]), B = c(() => z.lines.map((e) => ({
75
+ ]), H = c(() => V.lines.map((e) => ({
76
76
  productId: e.checkoutProductId,
77
77
  productVariantId: e.productVariantId,
78
78
  quantity: e.quantity
79
- })), [z.lines]), [ht, V] = l([]), [H, U] = l(!1);
79
+ })), [V.lines]), [pt, U] = l([]), [W, G] = l(!1);
80
80
  s(() => {
81
- if (!g || B.length === 0) {
82
- V([]), U(!1);
81
+ if (!_ || H.length === 0) {
82
+ U([]), G(!1);
83
83
  return;
84
84
  }
85
- if (!L) {
86
- V([]), U(!1);
85
+ if (!z) {
86
+ U([]), G(!1);
87
87
  return;
88
88
  }
89
89
  let e = !1;
90
- return U(!0), V([]), (async () => {
90
+ return G(!0), U([]), (async () => {
91
91
  try {
92
92
  let t = await o(oe, {
93
- storeSlug: g,
94
- schedule: L,
95
- products: B
93
+ storeSlug: _,
94
+ schedule: z,
95
+ products: H
96
96
  }), n = ue.parse(t);
97
97
  if (e) return;
98
- V(n.success ? n.availability ?? [] : []);
98
+ U(n.success ? n.availability ?? [] : []);
99
99
  } catch (t) {
100
100
  if (e) return;
101
- console.error("Failed to load checkout cart availability", t), V([]);
101
+ console.error("Failed to load checkout cart availability", t), U([]);
102
102
  } finally {
103
- e || U(!1);
103
+ e || G(!1);
104
104
  }
105
105
  })(), () => {
106
106
  e = !0;
107
107
  };
108
108
  }, [
109
- I.end_date,
110
- I.end_time,
111
- I.start_date,
112
- I.start_time,
113
- L,
114
- B,
115
- g
109
+ R.end_date,
110
+ R.end_time,
111
+ R.start_date,
112
+ R.start_time,
113
+ z,
114
+ H,
115
+ _
116
116
  ]);
117
- let gt = c(() => new Map(ht.map((e) => [se(e.productId, e.productVariantId), e])), [ht]), _t = c(() => ({
118
- ...z,
119
- lines: z.lines.map((e) => {
120
- let t = gt.get(se(e.checkoutProductId, e.productVariantId)), n = t ? ce(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
117
+ let mt = c(() => new Map(pt.map((e) => [se(e.productId, e.productVariantId), e])), [pt]), ht = c(() => ({
118
+ ...V,
119
+ lines: V.lines.map((e) => {
120
+ let t = mt.get(se(e.checkoutProductId, e.productVariantId)), n = t ? ce(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
121
121
  return {
122
122
  ...e,
123
- insufficientCapacity: !H && n !== void 0,
124
- availabilityIssue: H ? void 0 : n
123
+ insufficientCapacity: !W && n !== void 0,
124
+ availabilityIssue: W ? void 0 : n
125
125
  };
126
126
  })
127
127
  }), [
128
- gt,
129
- H,
130
- z
131
- ]), W = c(() => z.lines.map((e) => ({
128
+ mt,
129
+ W,
130
+ V
131
+ ]), K = c(() => V.lines.map((e) => ({
132
132
  kind: e.kind,
133
133
  productId: e.checkoutProductId,
134
134
  productVariantId: e.productVariantId,
135
135
  quantity: e.quantity
136
- })), [z.lines]), vt = new Map(Re.map((e) => [e.checkoutProductId?.trim() || e.id, e])), G = z.lines.flatMap((e) => {
137
- let t = vt.get(e.checkoutProductId);
136
+ })), [V.lines]), gt = new Map(g.map((e) => [e.checkoutProductId?.trim() || e.id, e])), q = V.lines.flatMap((e) => {
137
+ let t = gt.get(e.checkoutProductId);
138
138
  return t?.insurance?.enabled ? [{
139
139
  quantity: e.quantity,
140
140
  pricePerDayMinor: t.insurance.pricePerDayMinor,
141
141
  deductibleAmountMinor: t.insurance.deductibleAmountMinor
142
142
  }] : [];
143
- }), K = h.modules?.insurance?.enabled === !0 && G.length > 0, q = K && P, yt = G.reduce((e, t) => e + t.pricePerDayMinor * t.quantity, 0), bt = G.reduce((e, t) => Math.max(e, t.deductibleAmountMinor), 0), xt = z.estimatedTotalMinor ?? z.totalPerBaseUnitMinor, J = D?.totalMinor ?? xt, St = T?.discountAmountMinor ?? 0, Y = e(new URLSearchParams(), I).toString(), X = `/${g ?? ""}/booking${Y ? `?${Y}` : ""}`, Ct = `/${g ?? ""}/checkout${Y ? `?${Y}` : ""}`, wt = Ne({
143
+ }), J = h.modules?.insurance?.enabled === !0 && q.length > 0, Y = J && I, _t = q.reduce((e, t) => e + t.pricePerDayMinor * t.quantity, 0), vt = q.reduce((e, t) => Math.max(e, t.deductibleAmountMinor), 0), yt = V.totalMinor ?? 0, X = k?.totalMinor ?? yt, Z = k?.insuranceSubtotalMinor ?? 0, bt = D?.discountAmountMinor ?? 0, Q = e(new URLSearchParams(), R).toString(), xt = `/${_ ?? ""}/booking${Q ? `?${Q}` : ""}`, St = `/${_ ?? ""}/checkout${Q ? `?${Q}` : ""}`, Ct = Ne({
144
144
  resolver: Pe(we),
145
145
  defaultValues: {
146
146
  first_name: "",
@@ -151,121 +151,123 @@ function p() {
151
151
  }
152
152
  });
153
153
  s(() => {
154
- i(g, I);
155
- }, [I, g]), s(() => {
156
- !K && P && ot(!1);
157
- }, [P, K]);
158
- let Z = (t) => {
154
+ i(_, R);
155
+ }, [R, _]), s(() => {
156
+ !J && I && it(!1);
157
+ }, [I, J]);
158
+ let wt = (t) => {
159
159
  let n = {
160
- ...I,
160
+ ...R,
161
161
  ...t
162
- }, r = e(_, n);
163
- r.toString() !== _.toString() && (Be(r, { replace: !0 }), i(g, r));
162
+ }, r = e(v, n);
163
+ r.toString() !== v.toString() && (ze(r, { replace: !0 }), i(_, r));
164
164
  };
165
165
  s(() => {
166
- if (!g || W.length === 0 || !L) {
167
- E(null), O(null), A(!1), j(null), M(null);
166
+ if (!_ || K.length === 0 || !z) {
167
+ O(null), A(null), M(!1), N(null), P(null);
168
168
  return;
169
169
  }
170
- let e = tt.trim(), t = e.length === 0 && !N, n = !1;
171
- return A(!0), M(null), j(null), (async () => {
170
+ let e = $e.trim(), t = e.length === 0 && !F, n = !1;
171
+ return M(!0), P(null), N(null), (async () => {
172
172
  try {
173
173
  let r = await o(ye, {
174
- storeSlug: g,
175
- schedule: L,
176
- items: W,
174
+ storeSlug: _,
175
+ schedule: z,
176
+ items: K,
177
177
  couponCode: e || void 0,
178
178
  includeAutoApply: t,
179
- insuranceAccepted: q
179
+ insuranceAccepted: Y
180
180
  }), i = be.parse(r);
181
181
  if (n) return;
182
- if (O(typeof i.subtotalMinor == "number" && typeof i.totalMinor == "number" ? {
182
+ if (A(typeof i.subtotalMinor == "number" && typeof i.totalMinor == "number" ? {
183
183
  subtotalMinor: i.subtotalMinor,
184
184
  totalMinor: i.totalMinor,
185
185
  lateReturnSurchargeMinor: i.lateReturnSurchargeMinor,
186
186
  insuranceSubtotalMinor: i.insuranceSubtotalMinor,
187
187
  insuranceBillableDays: i.insuranceBillableDays
188
188
  } : null), !i.success) {
189
- E(null), M(i.message || p("checkout_coupon_invalid"));
189
+ O(null), P(i.message || p("checkout_coupon_invalid"));
190
190
  return;
191
191
  }
192
- E(i.coupon ?? null), i.coupon && (i.coupon.autoApplied && e.length === 0 ? (et(i.coupon.code), j(p("checkout_coupon_auto_applied", { code: i.coupon.code }))) : j(p("checkout_coupon_manual_applied")));
192
+ O(i.coupon ?? null), i.coupon && (i.coupon.autoApplied && e.length === 0 ? (E(i.coupon.code), N(p("checkout_coupon_auto_applied", { code: i.coupon.code }))) : N(p("checkout_coupon_manual_applied")));
193
193
  } catch (e) {
194
194
  if (n) return;
195
- console.error("Failed to verify checkout coupon", e), E(null), O(null), M(p("checkout_coupon_error"));
195
+ console.error("Failed to verify checkout coupon", e), O(null), A(null), P(p("checkout_coupon_error"));
196
196
  } finally {
197
- n || A(!1);
197
+ n || M(!1);
198
198
  }
199
199
  })(), () => {
200
200
  n = !0;
201
201
  };
202
202
  }, [
203
- N,
204
- I.end_date,
205
- I.end_time,
206
- I.start_date,
207
- I.start_time,
208
- L,
209
- W,
210
- q,
211
- g,
212
- tt,
203
+ F,
204
+ R.end_date,
205
+ R.end_time,
206
+ R.start_date,
207
+ R.start_time,
208
+ z,
209
+ K,
210
+ Y,
211
+ _,
212
+ $e,
213
213
  p
214
214
  ]), s(() => {
215
- if (!g || z.lines.length === 0 || !L) {
216
- x(null), w(null), S(!1);
215
+ if (!_ || V.lines.length === 0 || !z) {
216
+ S(null), T(null), C(!1);
217
217
  return;
218
218
  }
219
219
  let e = !1;
220
- return S(!0), w(null), (async () => {
220
+ return C(!0), T(null), (async () => {
221
221
  try {
222
222
  let t = await o(_e, {
223
- storeSlug: g,
224
- schedule: L,
225
- estimatedTotalMinor: J
223
+ storeSlug: _,
224
+ schedule: z,
225
+ estimatedTotalMinor: X,
226
+ insuranceAmountMinor: Z
226
227
  }), n = ve.parse(t);
227
228
  if (e) return;
228
229
  if (!n.success || !n.decision) {
229
- x(null), w(n.message || p("checkout_payment_error"));
230
+ S(null), T(n.message || p("checkout_payment_error"));
230
231
  return;
231
232
  }
232
- x(n.decision);
233
+ S(n.decision);
233
234
  } catch (t) {
234
235
  if (e) return;
235
- console.error("Failed to load checkout payment decision", t), x(null), w(p("checkout_payment_error"));
236
+ console.error("Failed to load checkout payment decision", t), S(null), T(p("checkout_payment_error"));
236
237
  } finally {
237
- e || S(!1);
238
+ e || C(!1);
238
239
  }
239
240
  })(), () => {
240
241
  e = !0;
241
242
  };
242
243
  }, [
243
- I.end_date,
244
- I.end_time,
245
- I.start_date,
246
- I.start_time,
247
- L,
248
- J,
249
- z.lines.length,
250
- g,
244
+ R.end_date,
245
+ R.end_time,
246
+ R.start_date,
247
+ R.start_time,
248
+ z,
249
+ X,
250
+ V.lines.length,
251
+ Z,
252
+ _,
251
253
  p
252
254
  ]);
253
- let Q = b?.currency ?? "EUR", Tt = f(J, Q, m.language), $ = D?.insuranceSubtotalMinor ?? 0, Et = Math.max(0, J - $), Dt = Math.round(Et / 1.2), Ot = Dt + $, kt = Math.max(0, Et - Dt), At = f(Ot, Q, m.language), jt = f(kt, Q, m.language), Mt = Ie(Fe, m.language), Nt = $ > 0 ? f($, Q, m.language) : void 0, Pt = b?.amountToCollectMinor ?? 0, Ft = b?.shouldCollectOnlinePayment === !0 && Pt > 0, It = wt.handleSubmit(async (e) => {
254
- if (!g || W.length === 0 || !L || y.current) return;
255
- Xe(!0), y.current = !0;
256
- let t = Ke();
255
+ let $ = x?.currency ?? "EUR", Tt = f(X, $, m.language), Et = Math.max(0, X - Z), Dt = Math.round(Et / 1.2), Ot = Dt + Z, kt = Math.max(0, Et - Dt), At = f(Ot, $, m.language), jt = f(kt, $, m.language), Mt = Ie(Fe, m.language), Nt = Z > 0 ? f(Z, $, m.language) : void 0, Pt = x?.amountToCollectMinor ?? 0, Ft = x?.shouldCollectOnlinePayment === !0 && Pt > 0, It = Ct.handleSubmit(async (e) => {
256
+ if (!_ || K.length === 0 || !z || b.current) return;
257
+ Ye(!0), b.current = !0;
258
+ let t = Ge();
257
259
  try {
258
260
  let n = await o(ie, {
259
- storeSlug: g,
261
+ storeSlug: _,
260
262
  checkoutSessionId: t.checkoutSessionId,
261
263
  replacesCheckoutSessionId: t.replacesCheckoutSessionId,
262
- schedule: L,
263
- fulfillment: I.fulfillment,
264
- startAddress: I.fulfillment === "delivery" ? I.start_address : void 0,
265
- endAddress: I.fulfillment === "delivery" ? I.end_address : void 0,
266
- couponCode: T?.code,
267
- couponAutoApplied: !N && T?.autoApplied,
268
- insuranceAccepted: q,
264
+ schedule: z,
265
+ fulfillment: R.fulfillment,
266
+ startAddress: R.fulfillment === "delivery" ? R.start_address : void 0,
267
+ endAddress: R.fulfillment === "delivery" ? R.end_address : void 0,
268
+ couponCode: D?.code,
269
+ couponAutoApplied: !F && D?.autoApplied,
270
+ insuranceAccepted: Y,
269
271
  customer: {
270
272
  firstName: e.first_name,
271
273
  lastName: e.last_name,
@@ -273,20 +275,20 @@ function p() {
273
275
  phone: e.phone,
274
276
  notes: e.notes
275
277
  },
276
- items: W
278
+ items: K
277
279
  }), r = ae.parse(n);
278
280
  if (!r.success || !r.checkout) {
279
- Je(), a.error(r.message || p("checkout_payment_error"));
281
+ qe(), a.error(r.message || p("checkout_payment_error"));
280
282
  return;
281
283
  }
282
- r.checkout.requiresPayment ? qe(r.checkout.checkoutSessionId ?? t.checkoutSessionId) : a.success(p("checkout_success_toast")), await Ve(r.checkout.nextPath), r.checkout.requiresPayment || Ye();
284
+ r.checkout.requiresPayment ? Ke(r.checkout.checkoutSessionId ?? t.checkoutSessionId) : a.success(p("checkout_success_toast")), await Be(r.checkout.nextPath), r.checkout.requiresPayment || Je();
283
285
  } catch (e) {
284
286
  console.error("Failed to submit storefront checkout", e), a.error(p("checkout_payment_error"));
285
287
  } finally {
286
- y.current = !1, Xe(!1);
288
+ b.current = !1, Ye(!1);
287
289
  }
288
- }), Lt = p(Ft ? "checkout_continue_to_payment" : "checkout_submit"), Rt = I.fulfillment === "delivery" && I.start_address.trim().length === 0, zt = !v && !Ze && !C && !k && !it && !!b && !!L && !Rt && W.length > 0;
289
- return z.lines.length === 0 ? /* @__PURE__ */ u("div", {
290
+ }), Lt = p(Ft ? "checkout_continue_to_payment" : "checkout_submit"), Rt = R.fulfillment === "delivery" && R.start_address.trim().length === 0, zt = !y && !Xe && !w && !j && !nt && !!x && !!z && !Rt && K.length > 0;
291
+ return V.lines.length === 0 ? /* @__PURE__ */ u("div", {
290
292
  className: "mx-auto max-w-3xl px-4 py-10 sm:px-6",
291
293
  children: /* @__PURE__ */ d("div", {
292
294
  className: "rounded-xl border border-slate-200 bg-white p-4 shadow-sm",
@@ -302,7 +304,7 @@ function p() {
302
304
  /* @__PURE__ */ u("div", {
303
305
  className: "mt-6",
304
306
  children: /* @__PURE__ */ u(Ee, {
305
- to: X,
307
+ to: xt,
306
308
  children: /* @__PURE__ */ d(de, {
307
309
  className: "gap-2",
308
310
  children: [/* @__PURE__ */ u(Me, {
@@ -316,9 +318,9 @@ function p() {
316
318
  })
317
319
  }) : /* @__PURE__ */ u(he, {
318
320
  currentStep: "checkout",
319
- bookingPath: X,
320
- checkoutPath: Ct,
321
- backPath: X,
321
+ bookingPath: xt,
322
+ checkoutPath: St,
323
+ backPath: xt,
322
324
  backLabel: p("back_to_booking"),
323
325
  children: /* @__PURE__ */ d("div", {
324
326
  className: "grid gap-6 lg:grid-cols-12",
@@ -329,7 +331,7 @@ function p() {
329
331
  className: "text-xl font-semibold tracking-tight text-slate-950",
330
332
  children: /* @__PURE__ */ u("span", { children: p("checkout_title") })
331
333
  }),
332
- L ? null : /* @__PURE__ */ u("p", {
334
+ z ? null : /* @__PURE__ */ u("p", {
333
335
  role: "alert",
334
336
  className: "mt-3 text-sm text-destructive",
335
337
  children: /* @__PURE__ */ u("span", { children: p("booking_time_slots_required") })
@@ -337,33 +339,33 @@ function p() {
337
339
  /* @__PURE__ */ d("div", {
338
340
  className: "mt-5 grid gap-4",
339
341
  children: [
340
- ut ? /* @__PURE__ */ u("div", {
342
+ ct ? /* @__PURE__ */ u("div", {
341
343
  className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm",
342
344
  children: /* @__PURE__ */ u(me, {
343
- value: I.fulfillment,
344
- onValueChange: (e) => Z({ fulfillment: e }),
345
- pickupAddress: dt,
346
- deliveryEnabled: F,
347
- deliveryDisabledReason: lt,
348
- startAddress: I.start_address,
349
- onStartAddressChange: (e) => Z({ start_address: e }),
350
- endAddress: I.end_address,
351
- onEndAddressChange: (e) => Z({ end_address: e }),
345
+ value: R.fulfillment,
346
+ onValueChange: (e) => wt({ fulfillment: e }),
347
+ pickupAddress: lt,
348
+ deliveryEnabled: L,
349
+ deliveryDisabledReason: st,
350
+ startAddress: R.start_address,
351
+ onStartAddressChange: (e) => wt({ start_address: e }),
352
+ endAddress: R.end_address,
353
+ onEndAddressChange: (e) => wt({ end_address: e }),
352
354
  showPickupAddressWhenPickupOnly: !1,
353
355
  testIdPrefix: "storefront-checkout-fulfillment"
354
356
  })
355
357
  }) : null,
356
- /* @__PURE__ */ u(xe, { form: wt }),
357
- K ? /* @__PURE__ */ u(Se, {
358
- accepted: q,
359
- disabled: v || k,
360
- dailyAmountLabel: f(yt, Q, m.language),
358
+ /* @__PURE__ */ u(xe, { form: Ct }),
359
+ J ? /* @__PURE__ */ u(Se, {
360
+ accepted: Y,
361
+ disabled: y || j,
362
+ dailyAmountLabel: f(_t, $, m.language),
361
363
  totalAmountLabel: Nt,
362
- billableDays: D?.insuranceBillableDays,
363
- deductibleLabel: bt > 0 ? f(bt, Q, m.language) : void 0,
364
- onAcceptedChange: ot
364
+ billableDays: k?.insuranceBillableDays,
365
+ deductibleLabel: vt > 0 ? f(vt, $, m.language) : void 0,
366
+ onAcceptedChange: it
365
367
  }) : null,
366
- Ze ? /* @__PURE__ */ d("div", {
368
+ Xe ? /* @__PURE__ */ d("div", {
367
369
  className: "flex items-center gap-2 text-sm text-slate-600",
368
370
  role: "status",
369
371
  children: [/* @__PURE__ */ u(ge, {
@@ -371,13 +373,13 @@ function p() {
371
373
  "aria-hidden": "true"
372
374
  }), /* @__PURE__ */ u("span", { children: p("checkout_payment_loading") })]
373
375
  }) : null,
374
- C ? /* @__PURE__ */ d("div", {
376
+ w ? /* @__PURE__ */ d("div", {
375
377
  className: "flex items-start gap-2 rounded-md bg-destructive p-3 text-sm text-destructive-foreground shadow-sm",
376
378
  role: "alert",
377
379
  children: [/* @__PURE__ */ u(je, {
378
380
  className: "mt-0.5 h-4 w-4",
379
381
  "aria-hidden": "true"
380
- }), /* @__PURE__ */ u("span", { children: C })]
382
+ }), /* @__PURE__ */ u("span", { children: w })]
381
383
  }) : null,
382
384
  /* @__PURE__ */ u(de, {
383
385
  type: "button",
@@ -397,32 +399,31 @@ function p() {
397
399
  })
398
400
  ]
399
401
  }), /* @__PURE__ */ u(Ce, {
400
- lines: _t.lines,
401
- itemCount: Ue,
402
- totalPerBaseUnitMinor: _t.totalPerBaseUnitMinor,
403
- baseUnitLabel: pt,
402
+ lines: ht.lines,
403
+ itemCount: He,
404
+ baseUnitLabel: dt,
404
405
  bookingSubtotalLabel: At,
405
406
  vatAmountLabel: jt,
406
407
  vatRateLabel: Mt,
407
408
  bookingTotalLabel: Tt,
408
- onQuantityChange: We,
409
- onRemove: Ge,
409
+ onQuantityChange: Ue,
410
+ onRemove: We,
410
411
  coupon: {
411
- code: $e,
412
- appliedCode: T?.code,
413
- discountLabel: T && St > 0 ? f(St, Q, m.language) : null,
414
- message: rt,
415
- error: it,
416
- loading: k,
417
- disabled: v,
412
+ code: Qe,
413
+ appliedCode: D?.code,
414
+ discountLabel: D && bt > 0 ? f(bt, $, m.language) : null,
415
+ message: tt,
416
+ error: nt,
417
+ loading: j,
418
+ disabled: y,
418
419
  onCodeChange: (e) => {
419
- et(e), M(null), j(null);
420
+ E(e), P(null), N(null);
420
421
  },
421
422
  onApply: () => {
422
- at(!1), nt($e.trim());
423
+ rt(!1), et(Qe.trim());
423
424
  },
424
425
  onRemove: () => {
425
- et(""), nt(""), E(null), O(null), M(null), j(null), at(!0);
426
+ E(""), et(""), O(null), A(null), P(null), N(null), rt(!0);
426
427
  }
427
428
  }
428
429
  })]
@@ -1,5 +1,4 @@
1
1
  import { Loader } from '@rpcbase/client';
2
- import { StorefrontI18nLanguage } from '../i18n/I18nProvider';
3
2
  export declare const resolveContractSaleDocumentBackLink: (search: string) => string | null;
4
3
  type ContractSaleDocumentLoaderArgs = Parameters<Loader>[0] & {
5
4
  request?: {
@@ -11,7 +10,7 @@ export declare const loader: ({ ctx, params, request }: ContractSaleDocumentLoad
11
10
  referenceId: string;
12
11
  saleDocumentId: string;
13
12
  pdfMode: boolean;
14
- documentLanguage: StorefrontI18nLanguage | null;
13
+ documentLanguage: "fr" | "en" | null;
15
14
  document: null;
16
15
  error: string | null;
17
16
  } | {
@@ -19,7 +18,7 @@ export declare const loader: ({ ctx, params, request }: ContractSaleDocumentLoad
19
18
  referenceId: string;
20
19
  saleDocumentId: string;
21
20
  pdfMode: boolean;
22
- documentLanguage: StorefrontI18nLanguage | null;
21
+ documentLanguage: "fr" | "en" | null;
23
22
  document: {
24
23
  id: string;
25
24
  kind: "quote" | "invoice" | "credit_note";
@@ -1 +1 @@
1
- {"version":3,"file":"ContractSaleDocumentPage.d.ts","sourceRoot":"","sources":["../../src/pages/ContractSaleDocumentPage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAsB7C,OAAO,EAAmC,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAanG,eAAO,MAAM,mCAAmC,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAe7E,CAAA;AA0KD,KAAK,8BAA8B,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;IAC5D,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,MAAM,6BAAqC,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEnE,CAAA;AAYnB,MAAM,CAAC,OAAO,UAAU,wBAAwB,4CA8P/C"}
1
+ {"version":3,"file":"ContractSaleDocumentPage.d.ts","sourceRoot":"","sources":["../../src/pages/ContractSaleDocumentPage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAmC7C,eAAO,MAAM,mCAAmC,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAe7E,CAAA;AA0KD,KAAK,8BAA8B,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;IAC5D,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,MAAM,6BAAqC,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEnE,CAAA;AAYnB,MAAM,CAAC,OAAO,UAAU,wBAAwB,4CA8P/C"}
@@ -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