@burdenoff/microfe-billing 2026.901.1 → 2026.903.1
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/billing/modules/checkout/components/StoreShippingSection.js +125 -99
- package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/useCheckout.js +173 -151
- package/dist/billing/modules/checkout/hooks/useCheckout.js.map +1 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +643 -637
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useCreateShippingAddress as e, useEstimateOrderShipping as t, useMyShippingAddresses as n, useShippingMethods as r } from "../hooks/useStoreShipping.js";
|
|
2
2
|
import { useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
3
3
|
import { Check as c, Loader2 as l, MapPin as u, Plus as d, Truck as f, X as p } from "lucide-react";
|
|
4
|
-
import { Fragment as
|
|
4
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
5
5
|
//#region src/billing/modules/checkout/components/StoreShippingSection.tsx
|
|
6
|
-
var
|
|
6
|
+
var _ = [
|
|
7
7
|
{
|
|
8
8
|
value: "IN",
|
|
9
9
|
label: "India"
|
|
@@ -40,7 +40,7 @@ var g = [
|
|
|
40
40
|
value: "AE",
|
|
41
41
|
label: "UAE"
|
|
42
42
|
}
|
|
43
|
-
],
|
|
43
|
+
], v = {
|
|
44
44
|
fullName: "",
|
|
45
45
|
phone: "",
|
|
46
46
|
addressLine1: "",
|
|
@@ -50,7 +50,7 @@ var g = [
|
|
|
50
50
|
postalCode: "",
|
|
51
51
|
country: "IN"
|
|
52
52
|
};
|
|
53
|
-
function
|
|
53
|
+
function y(e, t) {
|
|
54
54
|
try {
|
|
55
55
|
return e.toLocaleString("en", {
|
|
56
56
|
style: "currency",
|
|
@@ -60,29 +60,31 @@ function v(e, t) {
|
|
|
60
60
|
return `${t || "USD"} ${e.toFixed(2)}`;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function b(e, t) {
|
|
64
64
|
if (e == null && t == null) return null;
|
|
65
65
|
if (e != null && t != null) return e === t ? `${e} days` : `${e}–${t} days`;
|
|
66
66
|
let n = e ?? t;
|
|
67
67
|
return n == null ? null : `${n} days`;
|
|
68
68
|
}
|
|
69
|
-
var
|
|
70
|
-
let { addresses:
|
|
69
|
+
var x = ({ storeOrderId: x, currency: S, onChange: C }) => {
|
|
70
|
+
let { addresses: w, loading: T, refetch: E } = n(), { createShippingAddress: D, loading: O } = e(), { methods: k, loading: ee } = r(), [A, { data: j, loading: M }] = t(), [N, P] = s(null), [F, I] = s(null), [L, R] = s(!1), [z, B] = s(v), [V, H] = s({}), [U, W] = s(null), G = o(C);
|
|
71
71
|
i(() => {
|
|
72
|
-
G.current =
|
|
72
|
+
G.current = C;
|
|
73
73
|
});
|
|
74
|
-
let K = a(() =>
|
|
74
|
+
let K = a(() => w.find((e) => e.id === N), [w, N]), q = a(() => {
|
|
75
75
|
if (!K) return [];
|
|
76
76
|
let e = K.country;
|
|
77
|
-
return
|
|
78
|
-
}, [
|
|
77
|
+
return k.filter((t) => t.isActive && (t.availableCountries.length === 0 || t.availableCountries.includes(e)) && !t.excludedCountries.includes(e)).sort((e, t) => e.displayOrder - t.displayOrder);
|
|
78
|
+
}, [k, K]);
|
|
79
79
|
i(() => {
|
|
80
|
-
!N &&
|
|
81
|
-
}, [
|
|
80
|
+
!N && w.length > 0 && P((w.find((e) => e.isDefault) ?? w[0]).id);
|
|
81
|
+
}, [w, N]), i(() => {
|
|
82
82
|
F && !q.some((e) => e.id === F) && I(null);
|
|
83
|
+
}, [q, F]), i(() => {
|
|
84
|
+
!F && q.length === 1 && I(q[0].id);
|
|
83
85
|
}, [q, F]), i(() => {
|
|
84
86
|
K && F && A({ variables: { input: {
|
|
85
|
-
orderId:
|
|
87
|
+
orderId: x,
|
|
86
88
|
shippingMethodId: F,
|
|
87
89
|
destinationCountry: K.country,
|
|
88
90
|
destinationPostalCode: K.postalCode
|
|
@@ -92,7 +94,7 @@ var b = ({ storeOrderId: b, currency: x, onChange: S }) => {
|
|
|
92
94
|
K?.country,
|
|
93
95
|
K?.postalCode,
|
|
94
96
|
F,
|
|
95
|
-
|
|
97
|
+
x,
|
|
96
98
|
A,
|
|
97
99
|
K
|
|
98
100
|
]);
|
|
@@ -121,7 +123,7 @@ var b = ({ storeOrderId: b, currency: x, onChange: S }) => {
|
|
|
121
123
|
if (Z()) {
|
|
122
124
|
W(null);
|
|
123
125
|
try {
|
|
124
|
-
let e = await
|
|
126
|
+
let e = await D({
|
|
125
127
|
fullName: z.fullName.trim(),
|
|
126
128
|
...z.phone.trim() ? { phone: z.phone.trim() } : {},
|
|
127
129
|
addressLine1: z.addressLine1.trim(),
|
|
@@ -130,66 +132,66 @@ var b = ({ storeOrderId: b, currency: x, onChange: S }) => {
|
|
|
130
132
|
...z.state.trim() ? { state: z.state.trim() } : {},
|
|
131
133
|
postalCode: z.postalCode.trim(),
|
|
132
134
|
country: z.country,
|
|
133
|
-
isDefault:
|
|
135
|
+
isDefault: w.length === 0
|
|
134
136
|
});
|
|
135
137
|
if (!e) {
|
|
136
138
|
W("Failed to save address. Please try again.");
|
|
137
139
|
return;
|
|
138
140
|
}
|
|
139
|
-
await
|
|
141
|
+
await E(), P(e.id), I(null), B(v), H({}), R(!1);
|
|
140
142
|
} catch {
|
|
141
143
|
W("Failed to save address. Please try again.");
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
}, $ = (e) => `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${e ? "border-status-error-border" : "border-border-subtle"}`;
|
|
145
|
-
return /* @__PURE__ */
|
|
147
|
+
return /* @__PURE__ */ g("div", {
|
|
146
148
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6 space-y-5",
|
|
147
149
|
children: [
|
|
148
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ g("div", {
|
|
149
151
|
className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
|
|
150
|
-
children: [/* @__PURE__ */
|
|
152
|
+
children: [/* @__PURE__ */ h(f, { className: "size-4 text-text-secondary" }), "Shipping"]
|
|
151
153
|
}),
|
|
152
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ g("section", {
|
|
153
155
|
className: "space-y-3",
|
|
154
156
|
children: [
|
|
155
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ g("div", {
|
|
156
158
|
className: "flex items-center justify-between",
|
|
157
|
-
children: [/* @__PURE__ */
|
|
159
|
+
children: [/* @__PURE__ */ g("div", {
|
|
158
160
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
159
|
-
children: [/* @__PURE__ */
|
|
160
|
-
}), !L && /* @__PURE__ */
|
|
161
|
+
children: [/* @__PURE__ */ h(u, { className: "size-4 text-text-secondary" }), "Delivery address"]
|
|
162
|
+
}), !L && /* @__PURE__ */ g("button", {
|
|
161
163
|
type: "button",
|
|
162
164
|
onClick: () => {
|
|
163
165
|
R(!0), W(null);
|
|
164
166
|
},
|
|
165
167
|
className: "inline-flex items-center gap-1 text-xs font-medium text-text-link hover:underline",
|
|
166
|
-
children: [/* @__PURE__ */
|
|
168
|
+
children: [/* @__PURE__ */ h(d, { className: "size-3.5" }), "Add address"]
|
|
167
169
|
})]
|
|
168
170
|
}),
|
|
169
|
-
|
|
171
|
+
T && w.length === 0 ? /* @__PURE__ */ g("div", {
|
|
170
172
|
className: "flex items-center gap-2 text-sm text-text-secondary",
|
|
171
|
-
children: [/* @__PURE__ */
|
|
172
|
-
}) : /* @__PURE__ */
|
|
173
|
+
children: [/* @__PURE__ */ h(l, { className: "size-4 animate-spin" }), "Loading addresses…"]
|
|
174
|
+
}) : /* @__PURE__ */ g(m, { children: [w.length === 0 && !L && /* @__PURE__ */ h("p", {
|
|
173
175
|
className: "text-sm text-text-secondary",
|
|
174
176
|
children: "No saved delivery addresses yet. Add one to continue."
|
|
175
|
-
}),
|
|
177
|
+
}), w.length > 0 && /* @__PURE__ */ h("div", {
|
|
176
178
|
className: "space-y-2",
|
|
177
|
-
children:
|
|
179
|
+
children: w.map((e) => {
|
|
178
180
|
let t = e.id === N;
|
|
179
|
-
return /* @__PURE__ */
|
|
181
|
+
return /* @__PURE__ */ h("button", {
|
|
180
182
|
type: "button",
|
|
181
183
|
onClick: () => {
|
|
182
184
|
P(e.id), I(null);
|
|
183
185
|
},
|
|
184
186
|
className: `w-full text-left p-3 rounded-input border transition-colors ${t ? "border-action-primary-bg bg-bg-sunken" : "border-border-subtle hover:bg-bg-sunken"}`,
|
|
185
|
-
children: /* @__PURE__ */
|
|
187
|
+
children: /* @__PURE__ */ g("div", {
|
|
186
188
|
className: "flex items-start justify-between gap-2",
|
|
187
|
-
children: [/* @__PURE__ */
|
|
189
|
+
children: [/* @__PURE__ */ g("div", {
|
|
188
190
|
className: "text-sm",
|
|
189
191
|
children: [
|
|
190
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ g("p", {
|
|
191
193
|
className: "font-medium text-text-primary",
|
|
192
|
-
children: [e.fullName, e.label ? /* @__PURE__ */
|
|
194
|
+
children: [e.fullName, e.label ? /* @__PURE__ */ g("span", {
|
|
193
195
|
className: "ml-2 text-xs text-text-muted",
|
|
194
196
|
children: [
|
|
195
197
|
"(",
|
|
@@ -198,7 +200,7 @@ var b = ({ storeOrderId: b, currency: x, onChange: S }) => {
|
|
|
198
200
|
]
|
|
199
201
|
}) : null]
|
|
200
202
|
}),
|
|
201
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ h("p", {
|
|
202
204
|
className: "text-text-secondary text-xs mt-0.5",
|
|
203
205
|
children: [
|
|
204
206
|
e.addressLine1,
|
|
@@ -209,134 +211,134 @@ var b = ({ storeOrderId: b, currency: x, onChange: S }) => {
|
|
|
209
211
|
e.country
|
|
210
212
|
].filter(Boolean).join(", ")
|
|
211
213
|
}),
|
|
212
|
-
e.phone && /* @__PURE__ */
|
|
214
|
+
e.phone && /* @__PURE__ */ h("p", {
|
|
213
215
|
className: "text-text-muted text-xs mt-0.5",
|
|
214
216
|
children: e.phone
|
|
215
217
|
})
|
|
216
218
|
]
|
|
217
|
-
}), t && /* @__PURE__ */
|
|
219
|
+
}), t && /* @__PURE__ */ h(c, { className: "size-4 text-action-primary-bg shrink-0 mt-0.5" })]
|
|
218
220
|
})
|
|
219
221
|
}, e.id);
|
|
220
222
|
})
|
|
221
223
|
})] }),
|
|
222
|
-
L && /* @__PURE__ */
|
|
224
|
+
L && /* @__PURE__ */ g("div", {
|
|
223
225
|
className: "rounded-input border border-border-subtle p-3 space-y-3 bg-bg-sunken",
|
|
224
226
|
children: [
|
|
225
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ g("div", {
|
|
226
228
|
className: "flex items-center justify-between",
|
|
227
|
-
children: [/* @__PURE__ */
|
|
229
|
+
children: [/* @__PURE__ */ h("span", {
|
|
228
230
|
className: "text-sm font-medium text-text-primary",
|
|
229
231
|
children: "New delivery address"
|
|
230
|
-
}), /* @__PURE__ */
|
|
232
|
+
}), /* @__PURE__ */ h("button", {
|
|
231
233
|
type: "button",
|
|
232
234
|
onClick: () => {
|
|
233
235
|
R(!1), H({}), W(null);
|
|
234
236
|
},
|
|
235
237
|
className: "p-1 text-text-secondary hover:text-text-primary rounded-button",
|
|
236
|
-
children: /* @__PURE__ */
|
|
238
|
+
children: /* @__PURE__ */ h(p, { className: "size-4" })
|
|
237
239
|
})]
|
|
238
240
|
}),
|
|
239
|
-
U && /* @__PURE__ */
|
|
241
|
+
U && /* @__PURE__ */ h("div", {
|
|
240
242
|
className: "p-2 rounded-lg bg-status-error-bg-subtle border border-status-error-border text-xs text-status-error-text",
|
|
241
243
|
children: U
|
|
242
244
|
}),
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ g("div", { children: [
|
|
246
|
+
/* @__PURE__ */ h("label", {
|
|
245
247
|
className: "block text-xs text-text-secondary mb-1",
|
|
246
248
|
children: "Recipient name"
|
|
247
249
|
}),
|
|
248
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ h("input", {
|
|
249
251
|
type: "text",
|
|
250
252
|
value: z.fullName,
|
|
251
253
|
onChange: (e) => X("fullName", e.target.value),
|
|
252
254
|
placeholder: "Jane Doe",
|
|
253
255
|
className: $(!!V.fullName)
|
|
254
256
|
}),
|
|
255
|
-
V.fullName && /* @__PURE__ */
|
|
257
|
+
V.fullName && /* @__PURE__ */ h("p", {
|
|
256
258
|
className: "mt-1 text-xs text-status-error-text",
|
|
257
259
|
children: V.fullName
|
|
258
260
|
})
|
|
259
261
|
] }),
|
|
260
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("label", {
|
|
261
263
|
className: "block text-xs text-text-secondary mb-1",
|
|
262
|
-
children: ["Phone ", /* @__PURE__ */
|
|
264
|
+
children: ["Phone ", /* @__PURE__ */ h("span", {
|
|
263
265
|
className: "text-text-muted",
|
|
264
266
|
children: "(optional)"
|
|
265
267
|
})]
|
|
266
|
-
}), /* @__PURE__ */
|
|
268
|
+
}), /* @__PURE__ */ h("input", {
|
|
267
269
|
type: "tel",
|
|
268
270
|
value: z.phone,
|
|
269
271
|
onChange: (e) => X("phone", e.target.value),
|
|
270
272
|
placeholder: "+91 98765 43210",
|
|
271
273
|
className: $(!1)
|
|
272
274
|
})] }),
|
|
273
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
274
276
|
className: "block text-xs text-text-secondary mb-1",
|
|
275
277
|
children: "Country"
|
|
276
|
-
}), /* @__PURE__ */
|
|
278
|
+
}), /* @__PURE__ */ h("select", {
|
|
277
279
|
value: z.country,
|
|
278
280
|
onChange: (e) => X("country", e.target.value),
|
|
279
281
|
className: $(!!V.country),
|
|
280
|
-
children:
|
|
282
|
+
children: _.map((e) => /* @__PURE__ */ h("option", {
|
|
281
283
|
value: e.value,
|
|
282
284
|
children: e.label
|
|
283
285
|
}, e.value))
|
|
284
286
|
})] }),
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ g("div", { children: [
|
|
288
|
+
/* @__PURE__ */ h("label", {
|
|
287
289
|
className: "block text-xs text-text-secondary mb-1",
|
|
288
290
|
children: "Street address"
|
|
289
291
|
}),
|
|
290
|
-
/* @__PURE__ */
|
|
292
|
+
/* @__PURE__ */ h("input", {
|
|
291
293
|
type: "text",
|
|
292
294
|
value: z.addressLine1,
|
|
293
295
|
onChange: (e) => X("addressLine1", e.target.value),
|
|
294
296
|
placeholder: "123 Main St",
|
|
295
297
|
className: $(!!V.addressLine1)
|
|
296
298
|
}),
|
|
297
|
-
V.addressLine1 && /* @__PURE__ */
|
|
299
|
+
V.addressLine1 && /* @__PURE__ */ h("p", {
|
|
298
300
|
className: "mt-1 text-xs text-status-error-text",
|
|
299
301
|
children: V.addressLine1
|
|
300
302
|
})
|
|
301
303
|
] }),
|
|
302
|
-
/* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("label", {
|
|
303
305
|
className: "block text-xs text-text-secondary mb-1",
|
|
304
|
-
children: ["Apartment, suite, etc. ", /* @__PURE__ */
|
|
306
|
+
children: ["Apartment, suite, etc. ", /* @__PURE__ */ h("span", {
|
|
305
307
|
className: "text-text-muted",
|
|
306
308
|
children: "(optional)"
|
|
307
309
|
})]
|
|
308
|
-
}), /* @__PURE__ */
|
|
310
|
+
}), /* @__PURE__ */ h("input", {
|
|
309
311
|
type: "text",
|
|
310
312
|
value: z.addressLine2,
|
|
311
313
|
onChange: (e) => X("addressLine2", e.target.value),
|
|
312
314
|
placeholder: "Apt 4B",
|
|
313
315
|
className: $(!1)
|
|
314
316
|
})] }),
|
|
315
|
-
/* @__PURE__ */
|
|
317
|
+
/* @__PURE__ */ g("div", {
|
|
316
318
|
className: "grid grid-cols-2 gap-3",
|
|
317
|
-
children: [/* @__PURE__ */
|
|
318
|
-
/* @__PURE__ */
|
|
319
|
+
children: [/* @__PURE__ */ g("div", { children: [
|
|
320
|
+
/* @__PURE__ */ h("label", {
|
|
319
321
|
className: "block text-xs text-text-secondary mb-1",
|
|
320
322
|
children: "City"
|
|
321
323
|
}),
|
|
322
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ h("input", {
|
|
323
325
|
type: "text",
|
|
324
326
|
value: z.city,
|
|
325
327
|
onChange: (e) => X("city", e.target.value),
|
|
326
328
|
placeholder: "Mumbai",
|
|
327
329
|
className: $(!!V.city)
|
|
328
330
|
}),
|
|
329
|
-
V.city && /* @__PURE__ */
|
|
331
|
+
V.city && /* @__PURE__ */ h("p", {
|
|
330
332
|
className: "mt-1 text-xs text-status-error-text",
|
|
331
333
|
children: V.city
|
|
332
334
|
})
|
|
333
|
-
] }), /* @__PURE__ */
|
|
335
|
+
] }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("label", {
|
|
334
336
|
className: "block text-xs text-text-secondary mb-1",
|
|
335
|
-
children: ["State ", /* @__PURE__ */
|
|
337
|
+
children: ["State ", /* @__PURE__ */ h("span", {
|
|
336
338
|
className: "text-text-muted",
|
|
337
339
|
children: "(optional)"
|
|
338
340
|
})]
|
|
339
|
-
}), /* @__PURE__ */
|
|
341
|
+
}), /* @__PURE__ */ h("input", {
|
|
340
342
|
type: "text",
|
|
341
343
|
value: z.state,
|
|
342
344
|
onChange: (e) => X("state", e.target.value),
|
|
@@ -344,92 +346,116 @@ var b = ({ storeOrderId: b, currency: x, onChange: S }) => {
|
|
|
344
346
|
className: $(!1)
|
|
345
347
|
})] })]
|
|
346
348
|
}),
|
|
347
|
-
/* @__PURE__ */
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ g("div", { children: [
|
|
350
|
+
/* @__PURE__ */ h("label", {
|
|
349
351
|
className: "block text-xs text-text-secondary mb-1",
|
|
350
352
|
children: "Postal code"
|
|
351
353
|
}),
|
|
352
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ h("input", {
|
|
353
355
|
type: "text",
|
|
354
356
|
value: z.postalCode,
|
|
355
357
|
onChange: (e) => X("postalCode", e.target.value),
|
|
356
358
|
placeholder: "400001",
|
|
357
359
|
className: $(!!V.postalCode)
|
|
358
360
|
}),
|
|
359
|
-
V.postalCode && /* @__PURE__ */
|
|
361
|
+
V.postalCode && /* @__PURE__ */ h("p", {
|
|
360
362
|
className: "mt-1 text-xs text-status-error-text",
|
|
361
363
|
children: V.postalCode
|
|
362
364
|
})
|
|
363
365
|
] }),
|
|
364
|
-
/* @__PURE__ */
|
|
366
|
+
/* @__PURE__ */ h("div", {
|
|
365
367
|
className: "flex justify-end",
|
|
366
|
-
children: /* @__PURE__ */
|
|
368
|
+
children: /* @__PURE__ */ g("button", {
|
|
367
369
|
type: "button",
|
|
368
370
|
onClick: Q,
|
|
369
|
-
disabled:
|
|
371
|
+
disabled: O,
|
|
370
372
|
className: "inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg hover:bg-action-primary-bgHover rounded-lg transition-colors disabled:opacity-50",
|
|
371
|
-
children: [
|
|
373
|
+
children: [O && /* @__PURE__ */ h(l, { className: "size-4 animate-spin" }), "Save address"]
|
|
372
374
|
})
|
|
373
375
|
})
|
|
374
376
|
]
|
|
375
377
|
})
|
|
376
378
|
]
|
|
377
379
|
}),
|
|
378
|
-
/* @__PURE__ */
|
|
380
|
+
/* @__PURE__ */ g("section", {
|
|
379
381
|
className: "space-y-3",
|
|
380
382
|
children: [
|
|
381
|
-
/* @__PURE__ */
|
|
383
|
+
/* @__PURE__ */ g("div", {
|
|
382
384
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
383
|
-
children: [/* @__PURE__ */
|
|
385
|
+
children: [/* @__PURE__ */ h(f, { className: "size-4 text-text-secondary" }), "Shipping method"]
|
|
384
386
|
}),
|
|
385
|
-
K ?
|
|
387
|
+
K ? ee && k.length === 0 ? /* @__PURE__ */ g("div", {
|
|
386
388
|
className: "flex items-center gap-2 text-sm text-text-secondary",
|
|
387
|
-
children: [/* @__PURE__ */
|
|
388
|
-
}) : q.length === 0 ? /* @__PURE__ */
|
|
389
|
+
children: [/* @__PURE__ */ h(l, { className: "size-4 animate-spin" }), "Loading options…"]
|
|
390
|
+
}) : q.length === 0 ? /* @__PURE__ */ g("p", {
|
|
389
391
|
className: "text-sm text-text-secondary",
|
|
390
392
|
children: [
|
|
391
393
|
"No shipping methods available for ",
|
|
392
394
|
K.country,
|
|
393
395
|
". Try a different address."
|
|
394
396
|
]
|
|
395
|
-
}) :
|
|
397
|
+
}) : q.length === 1 ? (() => {
|
|
398
|
+
let e = q[0], t = b(e.estimatedMinDays, e.estimatedMaxDays), n = Y && J;
|
|
399
|
+
return /* @__PURE__ */ h("div", {
|
|
400
|
+
className: "w-full p-3 rounded-input border border-action-primary-bg bg-bg-sunken",
|
|
401
|
+
children: /* @__PURE__ */ g("div", {
|
|
402
|
+
className: "flex items-start justify-between gap-3",
|
|
403
|
+
children: [/* @__PURE__ */ g("div", {
|
|
404
|
+
className: "text-sm",
|
|
405
|
+
children: [/* @__PURE__ */ h("p", {
|
|
406
|
+
className: "font-medium text-text-primary",
|
|
407
|
+
children: e.name
|
|
408
|
+
}), /* @__PURE__ */ g("p", {
|
|
409
|
+
className: "text-text-secondary text-xs mt-0.5",
|
|
410
|
+
children: [e.carrier ? `${e.carrier} · ` : "", t ?? "Delivery time varies"]
|
|
411
|
+
})]
|
|
412
|
+
}), /* @__PURE__ */ g("div", {
|
|
413
|
+
className: "flex items-center gap-2 shrink-0",
|
|
414
|
+
children: [M ? /* @__PURE__ */ h(l, { className: "size-4 animate-spin text-text-secondary" }) : /* @__PURE__ */ h("span", {
|
|
415
|
+
className: "text-sm font-semibold text-text-primary",
|
|
416
|
+
children: n ? y(J.cost, J.currency || S) : y(e.baseCost, e.currency || S)
|
|
417
|
+
}), /* @__PURE__ */ h(c, { className: "size-4 text-action-primary-bg" })]
|
|
418
|
+
})]
|
|
419
|
+
})
|
|
420
|
+
});
|
|
421
|
+
})() : /* @__PURE__ */ h("div", {
|
|
396
422
|
className: "space-y-2",
|
|
397
423
|
children: q.map((e) => {
|
|
398
|
-
let t = e.id === F, n =
|
|
399
|
-
return /* @__PURE__ */
|
|
424
|
+
let t = e.id === F, n = b(e.estimatedMinDays, e.estimatedMaxDays), r = t && Y && J;
|
|
425
|
+
return /* @__PURE__ */ h("button", {
|
|
400
426
|
type: "button",
|
|
401
427
|
onClick: () => I(e.id),
|
|
402
428
|
className: `w-full text-left p-3 rounded-input border transition-colors ${t ? "border-action-primary-bg bg-bg-sunken" : "border-border-subtle hover:bg-bg-sunken"}`,
|
|
403
|
-
children: /* @__PURE__ */
|
|
429
|
+
children: /* @__PURE__ */ g("div", {
|
|
404
430
|
className: "flex items-start justify-between gap-3",
|
|
405
|
-
children: [/* @__PURE__ */
|
|
431
|
+
children: [/* @__PURE__ */ g("div", {
|
|
406
432
|
className: "text-sm",
|
|
407
|
-
children: [/* @__PURE__ */
|
|
433
|
+
children: [/* @__PURE__ */ h("p", {
|
|
408
434
|
className: "font-medium text-text-primary",
|
|
409
435
|
children: e.name
|
|
410
|
-
}), /* @__PURE__ */
|
|
436
|
+
}), /* @__PURE__ */ g("p", {
|
|
411
437
|
className: "text-text-secondary text-xs mt-0.5",
|
|
412
438
|
children: [e.carrier ? `${e.carrier} · ` : "", n ?? "Delivery time varies"]
|
|
413
439
|
})]
|
|
414
|
-
}), /* @__PURE__ */
|
|
440
|
+
}), /* @__PURE__ */ h("div", {
|
|
415
441
|
className: "text-right shrink-0",
|
|
416
|
-
children: t && M ? /* @__PURE__ */
|
|
442
|
+
children: t && M ? /* @__PURE__ */ h(l, { className: "size-4 animate-spin text-text-secondary" }) : /* @__PURE__ */ h("span", {
|
|
417
443
|
className: "text-sm font-semibold text-text-primary",
|
|
418
|
-
children: r ?
|
|
444
|
+
children: r ? y(J.cost, J.currency || S) : y(e.baseCost, e.currency || S)
|
|
419
445
|
})
|
|
420
446
|
})]
|
|
421
447
|
})
|
|
422
448
|
}, e.id);
|
|
423
449
|
})
|
|
424
|
-
}) : /* @__PURE__ */
|
|
450
|
+
}) : /* @__PURE__ */ h("p", {
|
|
425
451
|
className: "text-sm text-text-secondary",
|
|
426
452
|
children: "Select a delivery address to see options."
|
|
427
453
|
}),
|
|
428
|
-
Y && J && /* @__PURE__ */
|
|
454
|
+
Y && J && /* @__PURE__ */ g("p", {
|
|
429
455
|
className: "text-xs text-text-secondary",
|
|
430
456
|
children: [
|
|
431
457
|
"Estimated shipping: ",
|
|
432
|
-
|
|
458
|
+
y(J.cost, J.currency || S),
|
|
433
459
|
J.estimatedDeliveryDate ? ` · arrives around ${new Date(J.estimatedDeliveryDate).toLocaleDateString()}` : ""
|
|
434
460
|
]
|
|
435
461
|
})
|
|
@@ -439,6 +465,6 @@ var b = ({ storeOrderId: b, currency: x, onChange: S }) => {
|
|
|
439
465
|
});
|
|
440
466
|
};
|
|
441
467
|
//#endregion
|
|
442
|
-
export {
|
|
468
|
+
export { x as StoreShippingSection };
|
|
443
469
|
|
|
444
470
|
//# sourceMappingURL=StoreShippingSection.js.map
|