@burdenoff/microfe-kadaikodi 2026.719.2 → 2026.719.4
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/kadaikodi/hooks/useKadaikodiApi.d.ts +36 -0
- package/dist/kadaikodi/hooks/useKadaikodiApi.d.ts.map +1 -1
- package/dist/kadaikodi/hooks/useKadaikodiApi.js +148 -27
- package/dist/kadaikodi/hooks/useKadaikodiApi.js.map +1 -1
- package/dist/kadaikodi/pages/customer/CheckoutPage.d.ts.map +1 -1
- package/dist/kadaikodi/pages/customer/CheckoutPage.js +235 -219
- package/dist/kadaikodi/pages/customer/CheckoutPage.js.map +1 -1
- package/dist/kadaikodi/pages/customer/PaymentMethodsPage.d.ts +4 -0
- package/dist/kadaikodi/pages/customer/PaymentMethodsPage.d.ts.map +1 -1
- package/dist/kadaikodi/pages/customer/PaymentMethodsPage.js +209 -192
- package/dist/kadaikodi/pages/customer/PaymentMethodsPage.js.map +1 -1
- package/dist/kadaikodi/pages/customer/SavedAddressesPage.d.ts +3 -1
- package/dist/kadaikodi/pages/customer/SavedAddressesPage.d.ts.map +1 -1
- package/dist/kadaikodi/pages/customer/SavedAddressesPage.js +195 -173
- package/dist/kadaikodi/pages/customer/SavedAddressesPage.js.map +1 -1
- package/dist/kadaikodi/pages/customer/shared.d.ts +1 -2
- package/dist/kadaikodi/pages/customer/shared.d.ts.map +1 -1
- package/dist/kadaikodi/pages/customer/shared.js +15 -37
- package/dist/kadaikodi/pages/customer/shared.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useState as
|
|
6
|
-
import { Briefcase as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { EmphasisPanel as
|
|
1
|
+
import { cn as e } from "../../utils/cn.js";
|
|
2
|
+
import { PageLayout as t } from "../../components/PageLayout.js";
|
|
3
|
+
import { EmptyState as n } from "../../components/EmptyState.js";
|
|
4
|
+
import { useAddAddress as r, useDeleteAddress as i, useMyAddresses as a, useSetDefaultAddress as o, useUpdateAddress as s } from "../../hooks/useKadaikodiApi.js";
|
|
5
|
+
import { useState as c } from "react";
|
|
6
|
+
import { Briefcase as l, CheckCircle2 as u, Home as d, Loader2 as f, MapPin as p, Pencil as m, Plus as h, Star as g, Trash2 as _, X as v } from "lucide-react";
|
|
7
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
8
|
+
import { EmphasisPanel as x, PagePurpose as S } from "@burdenoff/fe-libs/ui";
|
|
9
9
|
//#region src/kadaikodi/pages/customer/SavedAddressesPage.tsx
|
|
10
|
-
var
|
|
11
|
-
type: "
|
|
10
|
+
var C = {
|
|
11
|
+
type: "HOME",
|
|
12
12
|
nickname: "",
|
|
13
13
|
addressLine1: "",
|
|
14
14
|
addressLine2: "",
|
|
@@ -16,49 +16,63 @@ var v = {
|
|
|
16
16
|
state: "",
|
|
17
17
|
zipCode: "",
|
|
18
18
|
isDefault: !1
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
}, w = (e) => ({
|
|
20
|
+
id: e.id,
|
|
21
|
+
type: e.type,
|
|
22
|
+
nickname: e.nickname ?? "",
|
|
23
|
+
addressLine1: e.addressLine1,
|
|
24
|
+
addressLine2: e.addressLine2 ?? "",
|
|
25
|
+
city: e.city,
|
|
26
|
+
state: e.state,
|
|
27
|
+
zipCode: e.zipCode,
|
|
28
|
+
isDefault: e.isDefault
|
|
29
|
+
}), T = {
|
|
30
|
+
HOME: d,
|
|
31
|
+
OFFICE: l,
|
|
32
|
+
OTHER: p
|
|
33
|
+
}, E = {
|
|
34
|
+
HOME: "bg-status-success-bg-subtle text-status-success-text",
|
|
35
|
+
OFFICE: "bg-[var(--color-accent-soft)] text-text-primary",
|
|
36
|
+
OTHER: "bg-accent-purple-subtle text-text-primary"
|
|
37
|
+
}, D = {
|
|
38
|
+
HOME: "Home",
|
|
39
|
+
OFFICE: "Office",
|
|
40
|
+
OTHER: "Other"
|
|
27
41
|
};
|
|
28
|
-
function
|
|
29
|
-
return /* @__PURE__ */
|
|
42
|
+
function O({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
43
|
+
return /* @__PURE__ */ b("div", {
|
|
30
44
|
className: "space-y-4",
|
|
31
45
|
children: [
|
|
32
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ b("div", {
|
|
33
47
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
|
|
34
|
-
children: [/* @__PURE__ */
|
|
48
|
+
children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
|
|
35
49
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
36
|
-
children: ["Address Type ", /* @__PURE__ */
|
|
50
|
+
children: ["Address Type ", /* @__PURE__ */ y("span", {
|
|
37
51
|
className: "text-status-error-text",
|
|
38
52
|
children: "*"
|
|
39
53
|
})]
|
|
40
|
-
}), /* @__PURE__ */
|
|
54
|
+
}), /* @__PURE__ */ b("select", {
|
|
41
55
|
value: e.type,
|
|
42
56
|
onChange: (e) => t("type", e.target.value),
|
|
43
57
|
className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
|
|
44
58
|
children: [
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
value: "
|
|
59
|
+
/* @__PURE__ */ y("option", {
|
|
60
|
+
value: "HOME",
|
|
47
61
|
children: "Home"
|
|
48
62
|
}),
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
value: "
|
|
63
|
+
/* @__PURE__ */ y("option", {
|
|
64
|
+
value: "OFFICE",
|
|
51
65
|
children: "Office"
|
|
52
66
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
value: "
|
|
67
|
+
/* @__PURE__ */ y("option", {
|
|
68
|
+
value: "OTHER",
|
|
55
69
|
children: "Other"
|
|
56
70
|
})
|
|
57
71
|
]
|
|
58
|
-
})] }), /* @__PURE__ */
|
|
72
|
+
})] }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
|
|
59
73
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
60
74
|
children: "Nickname"
|
|
61
|
-
}), /* @__PURE__ */
|
|
75
|
+
}), /* @__PURE__ */ y("input", {
|
|
62
76
|
type: "text",
|
|
63
77
|
placeholder: "e.g., Home Sweet Home",
|
|
64
78
|
value: e.nickname,
|
|
@@ -66,65 +80,65 @@ function x({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
|
66
80
|
className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
67
81
|
})] })]
|
|
68
82
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
|
|
70
84
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
71
|
-
children: ["Address Line 1 ", /* @__PURE__ */
|
|
85
|
+
children: ["Address Line 1 ", /* @__PURE__ */ y("span", {
|
|
72
86
|
className: "text-status-error-text",
|
|
73
87
|
children: "*"
|
|
74
88
|
})]
|
|
75
|
-
}), /* @__PURE__ */
|
|
89
|
+
}), /* @__PURE__ */ y("input", {
|
|
76
90
|
type: "text",
|
|
77
91
|
placeholder: "House/Flat number, Street name",
|
|
78
92
|
value: e.addressLine1,
|
|
79
93
|
onChange: (e) => t("addressLine1", e.target.value),
|
|
80
94
|
className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
81
95
|
})] }),
|
|
82
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
|
|
83
97
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
84
98
|
children: "Address Line 2"
|
|
85
|
-
}), /* @__PURE__ */
|
|
99
|
+
}), /* @__PURE__ */ y("input", {
|
|
86
100
|
type: "text",
|
|
87
101
|
placeholder: "Area, Landmark",
|
|
88
102
|
value: e.addressLine2,
|
|
89
103
|
onChange: (e) => t("addressLine2", e.target.value),
|
|
90
104
|
className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
91
105
|
})] }),
|
|
92
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ b("div", {
|
|
93
107
|
className: "grid grid-cols-1 sm:grid-cols-3 gap-4",
|
|
94
108
|
children: [
|
|
95
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
|
|
96
110
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
97
|
-
children: ["City ", /* @__PURE__ */
|
|
111
|
+
children: ["City ", /* @__PURE__ */ y("span", {
|
|
98
112
|
className: "text-status-error-text",
|
|
99
113
|
children: "*"
|
|
100
114
|
})]
|
|
101
|
-
}), /* @__PURE__ */
|
|
115
|
+
}), /* @__PURE__ */ y("input", {
|
|
102
116
|
type: "text",
|
|
103
117
|
placeholder: "City",
|
|
104
118
|
value: e.city,
|
|
105
119
|
onChange: (e) => t("city", e.target.value),
|
|
106
120
|
className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
107
121
|
})] }),
|
|
108
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
|
|
109
123
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
110
|
-
children: ["State ", /* @__PURE__ */
|
|
124
|
+
children: ["State ", /* @__PURE__ */ y("span", {
|
|
111
125
|
className: "text-status-error-text",
|
|
112
126
|
children: "*"
|
|
113
127
|
})]
|
|
114
|
-
}), /* @__PURE__ */
|
|
128
|
+
}), /* @__PURE__ */ y("input", {
|
|
115
129
|
type: "text",
|
|
116
130
|
placeholder: "State",
|
|
117
131
|
value: e.state,
|
|
118
132
|
onChange: (e) => t("state", e.target.value),
|
|
119
133
|
className: "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
120
134
|
})] }),
|
|
121
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
|
|
122
136
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
123
|
-
children: ["ZIP Code ", /* @__PURE__ */
|
|
137
|
+
children: ["ZIP Code ", /* @__PURE__ */ y("span", {
|
|
124
138
|
className: "text-status-error-text",
|
|
125
139
|
children: "*"
|
|
126
140
|
})]
|
|
127
|
-
}), /* @__PURE__ */
|
|
141
|
+
}), /* @__PURE__ */ y("input", {
|
|
128
142
|
type: "text",
|
|
129
143
|
placeholder: "560001",
|
|
130
144
|
value: e.zipCode,
|
|
@@ -133,26 +147,26 @@ function x({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
|
133
147
|
})] })
|
|
134
148
|
]
|
|
135
149
|
}),
|
|
136
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ b("label", {
|
|
137
151
|
className: "flex items-center gap-2 cursor-pointer",
|
|
138
|
-
children: [/* @__PURE__ */
|
|
152
|
+
children: [/* @__PURE__ */ y("input", {
|
|
139
153
|
type: "checkbox",
|
|
140
154
|
checked: e.isDefault,
|
|
141
155
|
onChange: (e) => t("isDefault", e.target.checked),
|
|
142
156
|
className: "h-4 w-4 rounded border-border-subtle text-text-primary"
|
|
143
|
-
}), /* @__PURE__ */
|
|
157
|
+
}), /* @__PURE__ */ y("span", {
|
|
144
158
|
className: "text-sm text-text-secondary",
|
|
145
159
|
children: "Set as default address"
|
|
146
160
|
})]
|
|
147
161
|
}),
|
|
148
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ b("div", {
|
|
149
163
|
className: "flex items-center gap-3 pt-2",
|
|
150
|
-
children: [/* @__PURE__ */
|
|
164
|
+
children: [/* @__PURE__ */ y("button", {
|
|
151
165
|
type: "button",
|
|
152
166
|
onClick: n,
|
|
153
167
|
className: "rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity",
|
|
154
168
|
children: i
|
|
155
|
-
}), /* @__PURE__ */
|
|
169
|
+
}), /* @__PURE__ */ y("button", {
|
|
156
170
|
type: "button",
|
|
157
171
|
onClick: r,
|
|
158
172
|
className: "rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-accent transition-colors",
|
|
@@ -162,213 +176,221 @@ function x({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
|
162
176
|
]
|
|
163
177
|
});
|
|
164
178
|
}
|
|
165
|
-
function
|
|
166
|
-
let {
|
|
167
|
-
|
|
168
|
-
},
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}))), [...n, e];
|
|
188
|
-
}), O({ ...v }), w(!1), j("Address added successfully");
|
|
189
|
-
}, P = () => {
|
|
190
|
-
T && M(T) && (S((e) => e.map((e) => e.id === T.id ? T : T.isDefault ? {
|
|
191
|
-
...e,
|
|
192
|
-
isDefault: !1
|
|
193
|
-
} : e)), E(null), j("Address updated successfully"));
|
|
194
|
-
}, F = (e) => {
|
|
195
|
-
if (s.find((t) => t.id === e)?.isDefault) {
|
|
179
|
+
function k() {
|
|
180
|
+
let { data: l = [], isLoading: d } = a(), k = r(), A = s(), j = i(), M = o(), [N, P] = c(!1), [F, I] = c(null), [L, R] = c({ ...C }), [z, B] = c(null), V = (e) => {
|
|
181
|
+
B(e), setTimeout(() => B(null), 3e3);
|
|
182
|
+
}, H = (e) => !e.addressLine1.trim() || !e.city.trim() || !e.state.trim() || !e.zipCode.trim() ? (alert("Please fill in all required fields (Address Line 1, City, State, ZIP Code)."), !1) : !0, U = async () => {
|
|
183
|
+
if (H(L)) try {
|
|
184
|
+
await k.mutateAsync({ ...L }), R({ ...C }), P(!1), V("Address added successfully");
|
|
185
|
+
} catch {
|
|
186
|
+
alert("Failed to save address. Please try again.");
|
|
187
|
+
}
|
|
188
|
+
}, W = async () => {
|
|
189
|
+
if (!F || !H(F)) return;
|
|
190
|
+
let { id: e, ...t } = F;
|
|
191
|
+
try {
|
|
192
|
+
await A.mutateAsync({
|
|
193
|
+
id: e,
|
|
194
|
+
input: t
|
|
195
|
+
}), I(null), V("Address updated successfully");
|
|
196
|
+
} catch {
|
|
197
|
+
alert("Failed to update address. Please try again.");
|
|
198
|
+
}
|
|
199
|
+
}, G = async (e) => {
|
|
200
|
+
if (l.find((t) => t.id === e)?.isDefault) {
|
|
196
201
|
alert("Cannot delete default address. Set another address as default first.");
|
|
197
202
|
return;
|
|
198
203
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
204
|
+
try {
|
|
205
|
+
await j.mutateAsync(e), V("Address deleted successfully");
|
|
206
|
+
} catch {
|
|
207
|
+
alert("Failed to delete address. Please try again.");
|
|
208
|
+
}
|
|
209
|
+
}, K = async (e) => {
|
|
210
|
+
try {
|
|
211
|
+
await M.mutateAsync(e), V("Default address updated");
|
|
212
|
+
} catch {
|
|
213
|
+
alert("Failed to set default address. Please try again.");
|
|
214
|
+
}
|
|
210
215
|
};
|
|
211
|
-
return /* @__PURE__ */
|
|
216
|
+
return d ? /* @__PURE__ */ y(t, {
|
|
212
217
|
title: "Saved Addresses",
|
|
213
218
|
description: "Manage your delivery addresses for faster checkout",
|
|
214
|
-
|
|
219
|
+
children: /* @__PURE__ */ y("div", {
|
|
220
|
+
className: "flex h-40 items-center justify-center",
|
|
221
|
+
children: /* @__PURE__ */ y(f, { className: "h-6 w-6 animate-spin text-text-secondary" })
|
|
222
|
+
})
|
|
223
|
+
}) : /* @__PURE__ */ b(t, {
|
|
224
|
+
title: "Saved Addresses",
|
|
225
|
+
description: "Manage your delivery addresses for faster checkout",
|
|
226
|
+
actions: N ? void 0 : /* @__PURE__ */ b("button", {
|
|
215
227
|
type: "button",
|
|
216
|
-
onClick: () =>
|
|
217
|
-
className:
|
|
218
|
-
children: [/* @__PURE__ */
|
|
228
|
+
onClick: () => P(!0),
|
|
229
|
+
className: e("flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-opacity", "bg-foreground text-background hover:opacity-90"),
|
|
230
|
+
children: [/* @__PURE__ */ y(h, { className: "h-4 w-4" }), "Add New Address"]
|
|
219
231
|
}),
|
|
220
232
|
children: [
|
|
221
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ y(S, {
|
|
222
234
|
className: "mb-6",
|
|
223
235
|
children: "Save the places you order to most — home, work, a friend's flat — so checkout is one tap and your courier always knows exactly where to go. Set a default to make it the automatic pick at checkout."
|
|
224
236
|
}),
|
|
225
|
-
|
|
237
|
+
l.length > 0 && /* @__PURE__ */ y(x, {
|
|
226
238
|
className: "mb-6",
|
|
227
|
-
children: /* @__PURE__ */
|
|
239
|
+
children: /* @__PURE__ */ b("div", {
|
|
228
240
|
className: "flex items-center gap-2 text-sm text-text-secondary",
|
|
229
|
-
children: [/* @__PURE__ */
|
|
230
|
-
|
|
241
|
+
children: [/* @__PURE__ */ y(p, { className: "h-4 w-4" }), /* @__PURE__ */ b("span", { children: [
|
|
242
|
+
l.length,
|
|
231
243
|
" saved ",
|
|
232
|
-
|
|
233
|
-
|
|
244
|
+
l.length === 1 ? "address" : "addresses",
|
|
245
|
+
l.some((e) => e.isDefault) ? ` · default set to ${l.find((e) => e.isDefault)?.nickname || "one address"}` : " · no default set yet"
|
|
234
246
|
] })]
|
|
235
247
|
})
|
|
236
248
|
}),
|
|
237
|
-
|
|
249
|
+
z && /* @__PURE__ */ b("div", {
|
|
238
250
|
className: "mb-4 rounded-lg border border-status-success-text/30 bg-status-success-bg-subtle p-3 flex items-center gap-2",
|
|
239
|
-
children: [/* @__PURE__ */
|
|
251
|
+
children: [/* @__PURE__ */ y(u, { className: "h-4 w-4 text-status-success-text shrink-0" }), /* @__PURE__ */ y("p", {
|
|
240
252
|
className: "text-sm text-status-success-text",
|
|
241
|
-
children:
|
|
253
|
+
children: z
|
|
242
254
|
})]
|
|
243
255
|
}),
|
|
244
|
-
|
|
256
|
+
N && /* @__PURE__ */ b("div", {
|
|
245
257
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-5 mb-6",
|
|
246
|
-
children: [/* @__PURE__ */
|
|
258
|
+
children: [/* @__PURE__ */ y("h3", {
|
|
247
259
|
className: "text-base font-semibold text-text-primary mb-4",
|
|
248
260
|
children: "Add New Address"
|
|
249
|
-
}), /* @__PURE__ */
|
|
250
|
-
data:
|
|
251
|
-
onChange: (e, t) =>
|
|
252
|
-
|
|
261
|
+
}), /* @__PURE__ */ y(O, {
|
|
262
|
+
data: L,
|
|
263
|
+
onChange: (e, t) => {
|
|
264
|
+
R((n) => ({
|
|
265
|
+
...n,
|
|
266
|
+
[e]: t
|
|
267
|
+
}));
|
|
268
|
+
},
|
|
269
|
+
onSubmit: U,
|
|
253
270
|
onCancel: () => {
|
|
254
|
-
|
|
271
|
+
P(!1), R({ ...C });
|
|
255
272
|
},
|
|
256
273
|
submitLabel: "Save Address"
|
|
257
274
|
})]
|
|
258
275
|
}),
|
|
259
|
-
|
|
276
|
+
l.length > 0 ? /* @__PURE__ */ y("div", {
|
|
260
277
|
className: "space-y-3",
|
|
261
|
-
children:
|
|
262
|
-
let n =
|
|
263
|
-
return /* @__PURE__ */
|
|
264
|
-
className:
|
|
265
|
-
children: /* @__PURE__ */
|
|
278
|
+
children: l.map((t) => {
|
|
279
|
+
let n = T[t.type];
|
|
280
|
+
return /* @__PURE__ */ y("div", {
|
|
281
|
+
className: e("rounded-lg border bg-bg-surface p-4", t.isDefault ? "border-foreground/30" : "border-border-subtle"),
|
|
282
|
+
children: /* @__PURE__ */ b("div", {
|
|
266
283
|
className: "flex items-start justify-between gap-3",
|
|
267
|
-
children: [/* @__PURE__ */
|
|
284
|
+
children: [/* @__PURE__ */ b("div", {
|
|
268
285
|
className: "flex items-start gap-3 flex-1 min-w-0",
|
|
269
|
-
children: [/* @__PURE__ */
|
|
286
|
+
children: [/* @__PURE__ */ y("div", {
|
|
270
287
|
className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-bg-sunken",
|
|
271
|
-
children: /* @__PURE__ */
|
|
272
|
-
}), /* @__PURE__ */
|
|
288
|
+
children: /* @__PURE__ */ y(n, { className: "h-5 w-5 text-text-secondary" })
|
|
289
|
+
}), /* @__PURE__ */ b("div", {
|
|
273
290
|
className: "min-w-0 flex-1",
|
|
274
291
|
children: [
|
|
275
|
-
/* @__PURE__ */
|
|
292
|
+
/* @__PURE__ */ b("div", {
|
|
276
293
|
className: "flex flex-wrap items-center gap-2",
|
|
277
|
-
children: [/* @__PURE__ */
|
|
278
|
-
className:
|
|
279
|
-
children:
|
|
280
|
-
}),
|
|
294
|
+
children: [/* @__PURE__ */ y("span", {
|
|
295
|
+
className: e("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium", E[t.type]),
|
|
296
|
+
children: D[t.type]
|
|
297
|
+
}), t.isDefault && /* @__PURE__ */ b("span", {
|
|
281
298
|
className: "inline-flex items-center gap-1 rounded-full bg-status-success-bg-subtle px-2 py-0.5 text-[10px] font-medium text-status-success-text",
|
|
282
|
-
children: [/* @__PURE__ */
|
|
299
|
+
children: [/* @__PURE__ */ y(u, { className: "h-3 w-3" }), "Default"]
|
|
283
300
|
})]
|
|
284
301
|
}),
|
|
285
|
-
|
|
302
|
+
t.nickname && /* @__PURE__ */ y("p", {
|
|
286
303
|
className: "mt-1 text-sm font-semibold text-text-primary",
|
|
287
|
-
children:
|
|
304
|
+
children: t.nickname
|
|
288
305
|
}),
|
|
289
|
-
/* @__PURE__ */
|
|
306
|
+
/* @__PURE__ */ y("p", {
|
|
290
307
|
className: "mt-0.5 text-sm text-text-primary",
|
|
291
|
-
children:
|
|
308
|
+
children: t.addressLine1
|
|
292
309
|
}),
|
|
293
|
-
|
|
310
|
+
t.addressLine2 && /* @__PURE__ */ y("p", {
|
|
294
311
|
className: "text-sm text-text-secondary",
|
|
295
|
-
children:
|
|
312
|
+
children: t.addressLine2
|
|
296
313
|
}),
|
|
297
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ b("p", {
|
|
298
315
|
className: "text-sm text-text-secondary",
|
|
299
316
|
children: [
|
|
300
|
-
|
|
317
|
+
t.city,
|
|
301
318
|
", ",
|
|
302
|
-
|
|
319
|
+
t.state,
|
|
303
320
|
" - ",
|
|
304
|
-
|
|
321
|
+
t.zipCode
|
|
305
322
|
]
|
|
306
323
|
})
|
|
307
324
|
]
|
|
308
325
|
})]
|
|
309
|
-
}), /* @__PURE__ */
|
|
326
|
+
}), /* @__PURE__ */ b("div", {
|
|
310
327
|
className: "flex items-center gap-1 shrink-0",
|
|
311
328
|
children: [
|
|
312
|
-
!
|
|
329
|
+
!t.isDefault && /* @__PURE__ */ y("button", {
|
|
313
330
|
type: "button",
|
|
314
|
-
onClick: () =>
|
|
331
|
+
onClick: () => K(t.id),
|
|
315
332
|
title: "Set as default",
|
|
316
333
|
className: "rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors",
|
|
317
|
-
children: /* @__PURE__ */
|
|
334
|
+
children: /* @__PURE__ */ y(g, { className: "h-4 w-4" })
|
|
318
335
|
}),
|
|
319
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ y("button", {
|
|
320
337
|
type: "button",
|
|
321
|
-
onClick: () =>
|
|
338
|
+
onClick: () => I(w(t)),
|
|
322
339
|
title: "Edit address",
|
|
323
340
|
className: "rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors",
|
|
324
|
-
children: /* @__PURE__ */ m
|
|
341
|
+
children: /* @__PURE__ */ y(m, { className: "h-4 w-4" })
|
|
325
342
|
}),
|
|
326
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ y("button", {
|
|
327
344
|
type: "button",
|
|
328
|
-
onClick: () =>
|
|
345
|
+
onClick: () => G(t.id),
|
|
329
346
|
title: "Delete address",
|
|
330
347
|
className: "rounded-md p-2 text-text-secondary hover:bg-status-error-bg/10 hover:text-status-error-text transition-colors",
|
|
331
|
-
children: /* @__PURE__ */
|
|
348
|
+
children: /* @__PURE__ */ y(_, { className: "h-4 w-4" })
|
|
332
349
|
})
|
|
333
350
|
]
|
|
334
351
|
})]
|
|
335
352
|
})
|
|
336
|
-
},
|
|
353
|
+
}, t.id);
|
|
337
354
|
})
|
|
338
|
-
}) : /* @__PURE__ */
|
|
355
|
+
}) : /* @__PURE__ */ y(n, {
|
|
339
356
|
illustration: "empty-files",
|
|
340
|
-
icon: /* @__PURE__ */
|
|
357
|
+
icon: /* @__PURE__ */ y(p, { className: "h-12 w-12" }),
|
|
341
358
|
title: "No saved addresses",
|
|
342
|
-
description: "Add a delivery address to get started
|
|
343
|
-
action: /* @__PURE__ */
|
|
359
|
+
description: "Add a delivery address to get started — it's saved to your account for faster checkout next time.",
|
|
360
|
+
action: /* @__PURE__ */ y("button", {
|
|
344
361
|
type: "button",
|
|
345
|
-
onClick: () =>
|
|
362
|
+
onClick: () => P(!0),
|
|
346
363
|
className: "rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity",
|
|
347
364
|
children: "Add Address"
|
|
348
365
|
})
|
|
349
366
|
}),
|
|
350
|
-
|
|
367
|
+
F && /* @__PURE__ */ y("div", {
|
|
351
368
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
|
|
352
|
-
children: /* @__PURE__ */
|
|
369
|
+
children: /* @__PURE__ */ y("div", {
|
|
353
370
|
className: "w-full max-w-2xl max-h-[90vh] overflow-y-auto rounded-lg border border-border-subtle bg-bg-surface shadow-lg",
|
|
354
|
-
children: /* @__PURE__ */
|
|
371
|
+
children: /* @__PURE__ */ b("div", {
|
|
355
372
|
className: "p-5",
|
|
356
|
-
children: [/* @__PURE__ */
|
|
373
|
+
children: [/* @__PURE__ */ b("div", {
|
|
357
374
|
className: "flex items-center justify-between mb-4",
|
|
358
|
-
children: [/* @__PURE__ */
|
|
375
|
+
children: [/* @__PURE__ */ y("h3", {
|
|
359
376
|
className: "text-lg font-semibold text-text-primary",
|
|
360
377
|
children: "Edit Address"
|
|
361
|
-
}), /* @__PURE__ */
|
|
378
|
+
}), /* @__PURE__ */ y("button", {
|
|
362
379
|
type: "button",
|
|
363
|
-
onClick: () =>
|
|
380
|
+
onClick: () => I(null),
|
|
364
381
|
className: "rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors",
|
|
365
|
-
children: /* @__PURE__ */
|
|
382
|
+
children: /* @__PURE__ */ y(v, { className: "h-4 w-4" })
|
|
366
383
|
})]
|
|
367
|
-
}), /* @__PURE__ */
|
|
368
|
-
data:
|
|
369
|
-
onChange: (e, t) =>
|
|
370
|
-
|
|
371
|
-
|
|
384
|
+
}), /* @__PURE__ */ y(O, {
|
|
385
|
+
data: F,
|
|
386
|
+
onChange: (e, t) => {
|
|
387
|
+
I((n) => n && {
|
|
388
|
+
...n,
|
|
389
|
+
[e]: t
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
onSubmit: W,
|
|
393
|
+
onCancel: () => I(null),
|
|
372
394
|
submitLabel: "Save Changes"
|
|
373
395
|
})]
|
|
374
396
|
})
|
|
@@ -378,6 +400,6 @@ function S() {
|
|
|
378
400
|
});
|
|
379
401
|
}
|
|
380
402
|
//#endregion
|
|
381
|
-
export {
|
|
403
|
+
export { k as SavedAddressesPage };
|
|
382
404
|
|
|
383
405
|
//# sourceMappingURL=SavedAddressesPage.js.map
|