@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.
- package/dist/StorefrontContext.d.ts +2 -2
- package/dist/StorefrontProvider.d.ts +2 -2
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +118 -126
- package/dist/components/LanguageSelector/index.d.ts +7 -0
- package/dist/components/LanguageSelector/index.d.ts.map +1 -0
- package/dist/components/LanguageSelector/index.js +69 -0
- package/dist/components/StorefrontCartPanel/index.d.ts +2 -8
- package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
- package/dist/components/StorefrontCartPanel/index.js +65 -107
- package/dist/i18n/I18nProvider.d.ts +3 -2
- package/dist/i18n/I18nProvider.d.ts.map +1 -1
- package/dist/i18n/I18nProvider.js +61 -64
- package/dist/i18n/en.d.ts +2 -2
- package/dist/i18n/en.js +3 -3
- package/dist/i18n/fr.d.ts +2 -2
- package/dist/i18n/fr.js +3 -3
- package/dist/i18n/languages.d.ts +15 -0
- package/dist/i18n/languages.d.ts.map +1 -0
- package/dist/i18n/languages.js +26 -0
- package/dist/index.d.ts +33 -24
- package/dist/index.js +50 -49
- package/dist/lib/cartSummary.d.ts +2 -5
- package/dist/lib/cartSummary.d.ts.map +1 -1
- package/dist/lib/cartSummary.js +5 -11
- package/dist/lib/checkoutPaymentDecision.d.ts +1 -0
- package/dist/lib/checkoutPaymentDecision.d.ts.map +1 -1
- package/dist/lib/checkoutPaymentDecision.js +1 -0
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +150 -148
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +156 -155
- package/dist/pages/ContractSaleDocumentPage.d.ts +2 -3
- package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
- package/dist/pages/ContractSaleDocumentPage.js +18 -17
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts +2 -2
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutSummaryColumn.js +14 -15
- package/dist/storefront.css +1 -1
- package/dist/storefrontSchemas.d.ts +2 -2
- package/dist/storefrontSchemas.d.ts.map +1 -1
- package/dist/storefrontSchemas.js +95 -94
- 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:
|
|
49
|
-
let e = t(
|
|
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" && !
|
|
53
|
+
return e.fulfillment === "delivery" && !L ? {
|
|
54
54
|
...e,
|
|
55
55
|
fulfillment: "pickup"
|
|
56
56
|
} : e;
|
|
57
|
-
}, [
|
|
58
|
-
items:
|
|
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:
|
|
63
|
-
accessories:
|
|
62
|
+
bikes: g,
|
|
63
|
+
accessories: Re
|
|
64
64
|
},
|
|
65
|
-
priceUnit:
|
|
66
|
-
billableUnitCount:
|
|
65
|
+
priceUnit: B.baseUnit,
|
|
66
|
+
billableUnitCount: ft
|
|
67
67
|
}), [
|
|
68
|
-
ze,
|
|
69
68
|
Re,
|
|
70
|
-
|
|
69
|
+
g,
|
|
70
|
+
ft,
|
|
71
71
|
m.language,
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
Ve,
|
|
73
|
+
B.baseUnit,
|
|
74
74
|
Le
|
|
75
|
-
]),
|
|
75
|
+
]), H = c(() => V.lines.map((e) => ({
|
|
76
76
|
productId: e.checkoutProductId,
|
|
77
77
|
productVariantId: e.productVariantId,
|
|
78
78
|
quantity: e.quantity
|
|
79
|
-
})), [
|
|
79
|
+
})), [V.lines]), [pt, U] = l([]), [W, G] = l(!1);
|
|
80
80
|
s(() => {
|
|
81
|
-
if (!
|
|
82
|
-
|
|
81
|
+
if (!_ || H.length === 0) {
|
|
82
|
+
U([]), G(!1);
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
if (!
|
|
86
|
-
|
|
85
|
+
if (!z) {
|
|
86
|
+
U([]), G(!1);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
let e = !1;
|
|
90
|
-
return
|
|
90
|
+
return G(!0), U([]), (async () => {
|
|
91
91
|
try {
|
|
92
92
|
let t = await o(oe, {
|
|
93
|
-
storeSlug:
|
|
94
|
-
schedule:
|
|
95
|
-
products:
|
|
93
|
+
storeSlug: _,
|
|
94
|
+
schedule: z,
|
|
95
|
+
products: H
|
|
96
96
|
}), n = ue.parse(t);
|
|
97
97
|
if (e) return;
|
|
98
|
-
|
|
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),
|
|
101
|
+
console.error("Failed to load checkout cart availability", t), U([]);
|
|
102
102
|
} finally {
|
|
103
|
-
e ||
|
|
103
|
+
e || G(!1);
|
|
104
104
|
}
|
|
105
105
|
})(), () => {
|
|
106
106
|
e = !0;
|
|
107
107
|
};
|
|
108
108
|
}, [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
|
118
|
-
...
|
|
119
|
-
lines:
|
|
120
|
-
let t =
|
|
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: !
|
|
124
|
-
availabilityIssue:
|
|
123
|
+
insufficientCapacity: !W && n !== void 0,
|
|
124
|
+
availabilityIssue: W ? void 0 : n
|
|
125
125
|
};
|
|
126
126
|
})
|
|
127
127
|
}), [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
]),
|
|
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
|
-
})), [
|
|
137
|
-
let t =
|
|
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
|
-
}),
|
|
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(
|
|
155
|
-
}, [
|
|
156
|
-
!
|
|
157
|
-
}, [
|
|
158
|
-
let
|
|
154
|
+
i(_, R);
|
|
155
|
+
}, [R, _]), s(() => {
|
|
156
|
+
!J && I && it(!1);
|
|
157
|
+
}, [I, J]);
|
|
158
|
+
let wt = (t) => {
|
|
159
159
|
let n = {
|
|
160
|
-
...
|
|
160
|
+
...R,
|
|
161
161
|
...t
|
|
162
|
-
}, r = e(
|
|
163
|
-
r.toString() !==
|
|
162
|
+
}, r = e(v, n);
|
|
163
|
+
r.toString() !== v.toString() && (ze(r, { replace: !0 }), i(_, r));
|
|
164
164
|
};
|
|
165
165
|
s(() => {
|
|
166
|
-
if (!
|
|
167
|
-
|
|
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 =
|
|
171
|
-
return
|
|
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:
|
|
175
|
-
schedule:
|
|
176
|
-
items:
|
|
174
|
+
storeSlug: _,
|
|
175
|
+
schedule: z,
|
|
176
|
+
items: K,
|
|
177
177
|
couponCode: e || void 0,
|
|
178
178
|
includeAutoApply: t,
|
|
179
|
-
insuranceAccepted:
|
|
179
|
+
insuranceAccepted: Y
|
|
180
180
|
}), i = be.parse(r);
|
|
181
181
|
if (n) return;
|
|
182
|
-
if (
|
|
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
|
-
|
|
189
|
+
O(null), P(i.message || p("checkout_coupon_invalid"));
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
|
|
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),
|
|
195
|
+
console.error("Failed to verify checkout coupon", e), O(null), A(null), P(p("checkout_coupon_error"));
|
|
196
196
|
} finally {
|
|
197
|
-
n ||
|
|
197
|
+
n || M(!1);
|
|
198
198
|
}
|
|
199
199
|
})(), () => {
|
|
200
200
|
n = !0;
|
|
201
201
|
};
|
|
202
202
|
}, [
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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 (!
|
|
216
|
-
|
|
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
|
|
220
|
+
return C(!0), T(null), (async () => {
|
|
221
221
|
try {
|
|
222
222
|
let t = await o(_e, {
|
|
223
|
-
storeSlug:
|
|
224
|
-
schedule:
|
|
225
|
-
estimatedTotalMinor:
|
|
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
|
-
|
|
230
|
+
S(null), T(n.message || p("checkout_payment_error"));
|
|
230
231
|
return;
|
|
231
232
|
}
|
|
232
|
-
|
|
233
|
+
S(n.decision);
|
|
233
234
|
} catch (t) {
|
|
234
235
|
if (e) return;
|
|
235
|
-
console.error("Failed to load checkout payment decision", t),
|
|
236
|
+
console.error("Failed to load checkout payment decision", t), S(null), T(p("checkout_payment_error"));
|
|
236
237
|
} finally {
|
|
237
|
-
e ||
|
|
238
|
+
e || C(!1);
|
|
238
239
|
}
|
|
239
240
|
})(), () => {
|
|
240
241
|
e = !0;
|
|
241
242
|
};
|
|
242
243
|
}, [
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
|
254
|
-
if (!
|
|
255
|
-
|
|
256
|
-
let t =
|
|
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:
|
|
261
|
+
storeSlug: _,
|
|
260
262
|
checkoutSessionId: t.checkoutSessionId,
|
|
261
263
|
replacesCheckoutSessionId: t.replacesCheckoutSessionId,
|
|
262
|
-
schedule:
|
|
263
|
-
fulfillment:
|
|
264
|
-
startAddress:
|
|
265
|
-
endAddress:
|
|
266
|
-
couponCode:
|
|
267
|
-
couponAutoApplied: !
|
|
268
|
-
insuranceAccepted:
|
|
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:
|
|
278
|
+
items: K
|
|
277
279
|
}), r = ae.parse(n);
|
|
278
280
|
if (!r.success || !r.checkout) {
|
|
279
|
-
|
|
281
|
+
qe(), a.error(r.message || p("checkout_payment_error"));
|
|
280
282
|
return;
|
|
281
283
|
}
|
|
282
|
-
r.checkout.requiresPayment ?
|
|
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
|
-
|
|
288
|
+
b.current = !1, Ye(!1);
|
|
287
289
|
}
|
|
288
|
-
}), Lt = p(Ft ? "checkout_continue_to_payment" : "checkout_submit"), Rt =
|
|
289
|
-
return
|
|
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:
|
|
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:
|
|
320
|
-
checkoutPath:
|
|
321
|
-
backPath:
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
344
|
-
onValueChange: (e) =>
|
|
345
|
-
pickupAddress:
|
|
346
|
-
deliveryEnabled:
|
|
347
|
-
deliveryDisabledReason:
|
|
348
|
-
startAddress:
|
|
349
|
-
onStartAddressChange: (e) =>
|
|
350
|
-
endAddress:
|
|
351
|
-
onEndAddressChange: (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:
|
|
357
|
-
|
|
358
|
-
accepted:
|
|
359
|
-
disabled:
|
|
360
|
-
dailyAmountLabel: f(
|
|
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:
|
|
363
|
-
deductibleLabel:
|
|
364
|
-
onAcceptedChange:
|
|
364
|
+
billableDays: k?.insuranceBillableDays,
|
|
365
|
+
deductibleLabel: vt > 0 ? f(vt, $, m.language) : void 0,
|
|
366
|
+
onAcceptedChange: it
|
|
365
367
|
}) : null,
|
|
366
|
-
|
|
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
|
-
|
|
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:
|
|
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:
|
|
401
|
-
itemCount:
|
|
402
|
-
|
|
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:
|
|
409
|
-
onRemove:
|
|
409
|
+
onQuantityChange: Ue,
|
|
410
|
+
onRemove: We,
|
|
410
411
|
coupon: {
|
|
411
|
-
code:
|
|
412
|
-
appliedCode:
|
|
413
|
-
discountLabel:
|
|
414
|
-
message:
|
|
415
|
-
error:
|
|
416
|
-
loading:
|
|
417
|
-
disabled:
|
|
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
|
-
|
|
420
|
+
E(e), P(null), N(null);
|
|
420
421
|
},
|
|
421
422
|
onApply: () => {
|
|
422
|
-
|
|
423
|
+
rt(!1), et(Qe.trim());
|
|
423
424
|
},
|
|
424
425
|
onRemove: () => {
|
|
425
|
-
|
|
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:
|
|
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:
|
|
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;
|
|
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 {
|
|
2
|
-
import {
|
|
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:
|
|
67
|
-
let { t: r } = C(), [i, a] = g(!1), o = L.find((
|
|
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(
|
|
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((
|
|
104
|
-
onClick: (
|
|
105
|
-
|
|
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-${
|
|
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",
|
|
109
|
-
children: [/* @__PURE__ */ _("span", { children: r(
|
|
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:
|
|
112
|
+
children: t.code
|
|
112
113
|
})]
|
|
113
|
-
},
|
|
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) ??
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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" | "
|
|
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,
|
|
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
|