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