@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.
@@ -1,14 +1,14 @@
1
- import { useKadaikodi as e } from "../../context/KadaikodiContext.js";
2
- import { cn as t } from "../../utils/cn.js";
3
- import { PageLayout as n } from "../../components/PageLayout.js";
4
- import { EmptyState as r } from "../../components/EmptyState.js";
5
- import { useState as i } from "react";
6
- import { Briefcase as a, CheckCircle2 as o, Home as s, MapPin as c, Pencil as l, Plus as u, Star as d, Trash2 as f, X as p } from "lucide-react";
7
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
- import { EmphasisPanel as g, PagePurpose as _ } from "@burdenoff/fe-libs/ui";
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 v = {
11
- type: "home",
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
- }, y = {
20
- home: s,
21
- office: a,
22
- other: c
23
- }, b = {
24
- home: "bg-status-success-bg-subtle text-status-success-text",
25
- office: "bg-[var(--color-accent-soft)] text-text-primary",
26
- other: "bg-accent-purple-subtle text-text-primary"
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 x({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
29
- return /* @__PURE__ */ h("div", {
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__ */ h("div", {
46
+ /* @__PURE__ */ b("div", {
33
47
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
34
- children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ h("label", {
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__ */ m("span", {
50
+ children: ["Address Type ", /* @__PURE__ */ y("span", {
37
51
  className: "text-status-error-text",
38
52
  children: "*"
39
53
  })]
40
- }), /* @__PURE__ */ h("select", {
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__ */ m("option", {
46
- value: "home",
59
+ /* @__PURE__ */ y("option", {
60
+ value: "HOME",
47
61
  children: "Home"
48
62
  }),
49
- /* @__PURE__ */ m("option", {
50
- value: "office",
63
+ /* @__PURE__ */ y("option", {
64
+ value: "OFFICE",
51
65
  children: "Office"
52
66
  }),
53
- /* @__PURE__ */ m("option", {
54
- value: "other",
67
+ /* @__PURE__ */ y("option", {
68
+ value: "OTHER",
55
69
  children: "Other"
56
70
  })
57
71
  ]
58
- })] }), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
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__ */ m("input", {
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__ */ h("div", { children: [/* @__PURE__ */ h("label", {
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__ */ m("span", {
85
+ children: ["Address Line 1 ", /* @__PURE__ */ y("span", {
72
86
  className: "text-status-error-text",
73
87
  children: "*"
74
88
  })]
75
- }), /* @__PURE__ */ m("input", {
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__ */ h("div", { children: [/* @__PURE__ */ m("label", {
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__ */ m("input", {
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__ */ h("div", {
106
+ /* @__PURE__ */ b("div", {
93
107
  className: "grid grid-cols-1 sm:grid-cols-3 gap-4",
94
108
  children: [
95
- /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ h("label", {
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__ */ m("span", {
111
+ children: ["City ", /* @__PURE__ */ y("span", {
98
112
  className: "text-status-error-text",
99
113
  children: "*"
100
114
  })]
101
- }), /* @__PURE__ */ m("input", {
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__ */ h("div", { children: [/* @__PURE__ */ h("label", {
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__ */ m("span", {
124
+ children: ["State ", /* @__PURE__ */ y("span", {
111
125
  className: "text-status-error-text",
112
126
  children: "*"
113
127
  })]
114
- }), /* @__PURE__ */ m("input", {
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__ */ h("div", { children: [/* @__PURE__ */ h("label", {
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__ */ m("span", {
137
+ children: ["ZIP Code ", /* @__PURE__ */ y("span", {
124
138
  className: "text-status-error-text",
125
139
  children: "*"
126
140
  })]
127
- }), /* @__PURE__ */ m("input", {
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__ */ h("label", {
150
+ /* @__PURE__ */ b("label", {
137
151
  className: "flex items-center gap-2 cursor-pointer",
138
- children: [/* @__PURE__ */ m("input", {
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__ */ m("span", {
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__ */ h("div", {
162
+ /* @__PURE__ */ b("div", {
149
163
  className: "flex items-center gap-3 pt-2",
150
- children: [/* @__PURE__ */ m("button", {
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__ */ m("button", {
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 S() {
166
- let { navigateTo: a } = e(), [s, S] = i([]), [C, w] = i(!1), [T, E] = i(null), [D, O] = i({ ...v }), [k, A] = i(null), j = (e) => {
167
- A(e), setTimeout(() => A(null), 3e3);
168
- }, M = (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, N = () => {
169
- if (!M(D)) return;
170
- let e = {
171
- id: `addr-${Date.now()}`,
172
- type: D.type,
173
- nickname: D.nickname,
174
- addressLine1: D.addressLine1,
175
- addressLine2: D.addressLine2,
176
- city: D.city,
177
- state: D.state,
178
- zipCode: D.zipCode,
179
- isDefault: D.isDefault,
180
- usageCount: 0
181
- };
182
- S((t) => {
183
- let n = [...t];
184
- return e.isDefault && (n = n.map((e) => ({
185
- ...e,
186
- isDefault: !1
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
- S((t) => t.filter((t) => t.id !== e)), j("Address deleted successfully");
200
- }, I = (e) => {
201
- S((t) => t.map((t) => ({
202
- ...t,
203
- isDefault: t.id === e
204
- }))), j("Default address updated");
205
- }, L = (e, t, n) => {
206
- e((e) => ({
207
- ...e,
208
- [t]: n
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__ */ h(n, {
216
+ return d ? /* @__PURE__ */ y(t, {
212
217
  title: "Saved Addresses",
213
218
  description: "Manage your delivery addresses for faster checkout",
214
- actions: C ? void 0 : /* @__PURE__ */ h("button", {
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: () => w(!0),
217
- className: t("flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-opacity", "bg-foreground text-background hover:opacity-90"),
218
- children: [/* @__PURE__ */ m(u, { className: "h-4 w-4" }), "Add New Address"]
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__ */ m(_, {
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
- s.length > 0 && /* @__PURE__ */ m(g, {
237
+ l.length > 0 && /* @__PURE__ */ y(x, {
226
238
  className: "mb-6",
227
- children: /* @__PURE__ */ h("div", {
239
+ children: /* @__PURE__ */ b("div", {
228
240
  className: "flex items-center gap-2 text-sm text-text-secondary",
229
- children: [/* @__PURE__ */ m(c, { className: "h-4 w-4" }), /* @__PURE__ */ h("span", { children: [
230
- s.length,
241
+ children: [/* @__PURE__ */ y(p, { className: "h-4 w-4" }), /* @__PURE__ */ b("span", { children: [
242
+ l.length,
231
243
  " saved ",
232
- s.length === 1 ? "address" : "addresses",
233
- s.some((e) => e.isDefault) ? ` · default set to ${s.find((e) => e.isDefault)?.nickname ?? "one address"}` : " · no default set yet"
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
- k && /* @__PURE__ */ h("div", {
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__ */ m(o, { className: "h-4 w-4 text-status-success-text shrink-0" }), /* @__PURE__ */ m("p", {
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: k
253
+ children: z
242
254
  })]
243
255
  }),
244
- C && /* @__PURE__ */ h("div", {
256
+ N && /* @__PURE__ */ b("div", {
245
257
  className: "rounded-lg border border-border-subtle bg-bg-surface p-5 mb-6",
246
- children: [/* @__PURE__ */ m("h3", {
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__ */ m(x, {
250
- data: D,
251
- onChange: (e, t) => L(O, e, t),
252
- onSubmit: N,
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
- w(!1), O({ ...v });
271
+ P(!1), R({ ...C });
255
272
  },
256
273
  submitLabel: "Save Address"
257
274
  })]
258
275
  }),
259
- s.length > 0 ? /* @__PURE__ */ m("div", {
276
+ l.length > 0 ? /* @__PURE__ */ y("div", {
260
277
  className: "space-y-3",
261
- children: s.map((e) => {
262
- let n = y[e.type];
263
- return /* @__PURE__ */ m("div", {
264
- className: t("rounded-lg border bg-bg-surface p-4", e.isDefault ? "border-foreground/30" : "border-border-subtle"),
265
- children: /* @__PURE__ */ h("div", {
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__ */ h("div", {
284
+ children: [/* @__PURE__ */ b("div", {
268
285
  className: "flex items-start gap-3 flex-1 min-w-0",
269
- children: [/* @__PURE__ */ m("div", {
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__ */ m(n, { className: "h-5 w-5 text-text-secondary" })
272
- }), /* @__PURE__ */ h("div", {
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__ */ h("div", {
292
+ /* @__PURE__ */ b("div", {
276
293
  className: "flex flex-wrap items-center gap-2",
277
- children: [/* @__PURE__ */ m("span", {
278
- className: t("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium capitalize", b[e.type]),
279
- children: e.type
280
- }), e.isDefault && /* @__PURE__ */ h("span", {
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__ */ m(o, { className: "h-3 w-3" }), "Default"]
299
+ children: [/* @__PURE__ */ y(u, { className: "h-3 w-3" }), "Default"]
283
300
  })]
284
301
  }),
285
- e.nickname && /* @__PURE__ */ m("p", {
302
+ t.nickname && /* @__PURE__ */ y("p", {
286
303
  className: "mt-1 text-sm font-semibold text-text-primary",
287
- children: e.nickname
304
+ children: t.nickname
288
305
  }),
289
- /* @__PURE__ */ m("p", {
306
+ /* @__PURE__ */ y("p", {
290
307
  className: "mt-0.5 text-sm text-text-primary",
291
- children: e.addressLine1
308
+ children: t.addressLine1
292
309
  }),
293
- e.addressLine2 && /* @__PURE__ */ m("p", {
310
+ t.addressLine2 && /* @__PURE__ */ y("p", {
294
311
  className: "text-sm text-text-secondary",
295
- children: e.addressLine2
312
+ children: t.addressLine2
296
313
  }),
297
- /* @__PURE__ */ h("p", {
314
+ /* @__PURE__ */ b("p", {
298
315
  className: "text-sm text-text-secondary",
299
316
  children: [
300
- e.city,
317
+ t.city,
301
318
  ", ",
302
- e.state,
319
+ t.state,
303
320
  " - ",
304
- e.zipCode
321
+ t.zipCode
305
322
  ]
306
323
  })
307
324
  ]
308
325
  })]
309
- }), /* @__PURE__ */ h("div", {
326
+ }), /* @__PURE__ */ b("div", {
310
327
  className: "flex items-center gap-1 shrink-0",
311
328
  children: [
312
- !e.isDefault && /* @__PURE__ */ m("button", {
329
+ !t.isDefault && /* @__PURE__ */ y("button", {
313
330
  type: "button",
314
- onClick: () => I(e.id),
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__ */ m(d, { className: "h-4 w-4" })
334
+ children: /* @__PURE__ */ y(g, { className: "h-4 w-4" })
318
335
  }),
319
- /* @__PURE__ */ m("button", {
336
+ /* @__PURE__ */ y("button", {
320
337
  type: "button",
321
- onClick: () => E({ ...e }),
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(l, { className: "h-4 w-4" })
341
+ children: /* @__PURE__ */ y(m, { className: "h-4 w-4" })
325
342
  }),
326
- /* @__PURE__ */ m("button", {
343
+ /* @__PURE__ */ y("button", {
327
344
  type: "button",
328
- onClick: () => F(e.id),
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__ */ m(f, { className: "h-4 w-4" })
348
+ children: /* @__PURE__ */ y(_, { className: "h-4 w-4" })
332
349
  })
333
350
  ]
334
351
  })]
335
352
  })
336
- }, e.id);
353
+ }, t.id);
337
354
  })
338
- }) : /* @__PURE__ */ m(r, {
355
+ }) : /* @__PURE__ */ y(n, {
339
356
  illustration: "empty-files",
340
- icon: /* @__PURE__ */ m(c, { className: "h-12 w-12" }),
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. Address book sync is coming soon — for now, entries are kept for this session.",
343
- action: /* @__PURE__ */ m("button", {
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: () => w(!0),
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
- T && /* @__PURE__ */ m("div", {
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__ */ m("div", {
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__ */ h("div", {
371
+ children: /* @__PURE__ */ b("div", {
355
372
  className: "p-5",
356
- children: [/* @__PURE__ */ h("div", {
373
+ children: [/* @__PURE__ */ b("div", {
357
374
  className: "flex items-center justify-between mb-4",
358
- children: [/* @__PURE__ */ m("h3", {
375
+ children: [/* @__PURE__ */ y("h3", {
359
376
  className: "text-lg font-semibold text-text-primary",
360
377
  children: "Edit Address"
361
- }), /* @__PURE__ */ m("button", {
378
+ }), /* @__PURE__ */ y("button", {
362
379
  type: "button",
363
- onClick: () => E(null),
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__ */ m(p, { className: "h-4 w-4" })
382
+ children: /* @__PURE__ */ y(v, { className: "h-4 w-4" })
366
383
  })]
367
- }), /* @__PURE__ */ m(x, {
368
- data: T,
369
- onChange: (e, t) => L(E, e, t),
370
- onSubmit: P,
371
- onCancel: () => E(null),
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 { S as SavedAddressesPage };
403
+ export { k as SavedAddressesPage };
382
404
 
383
405
  //# sourceMappingURL=SavedAddressesPage.js.map