@fayz-ai/storefront 0.84.0 → 0.84.2
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/CheckoutPage-DDY4WLFJ.js +12 -0
- package/dist/CheckoutPage-DDY4WLFJ.js.map +1 -0
- package/dist/MyPurchasesPage-IHCB5QRR.js +11 -0
- package/dist/MyPurchasesPage-IHCB5QRR.js.map +1 -0
- package/dist/OrderConfirmationPage-SAKAGOCC.js +10 -0
- package/dist/OrderConfirmationPage-SAKAGOCC.js.map +1 -0
- package/dist/analytics/meta-pixel.d.ts +13 -0
- package/dist/analytics/meta-pixel.d.ts.map +1 -1
- package/dist/app/createStorefrontApp.d.ts.map +1 -1
- package/dist/chunk-45R7CIEA.js +234 -0
- package/dist/chunk-45R7CIEA.js.map +1 -0
- package/dist/{chunk-QU5O4CKY.js → chunk-6NUBVJJY.js} +5 -4
- package/dist/chunk-6NUBVJJY.js.map +1 -0
- package/dist/chunk-BKO2AQ3Q.js +329 -0
- package/dist/chunk-BKO2AQ3Q.js.map +1 -0
- package/dist/chunk-CV6RYJIC.js +454 -0
- package/dist/chunk-CV6RYJIC.js.map +1 -0
- package/dist/chunk-D5C5U2SG.js +267 -0
- package/dist/chunk-D5C5U2SG.js.map +1 -0
- package/dist/chunk-DRMDBXMT.js +2123 -0
- package/dist/chunk-DRMDBXMT.js.map +1 -0
- package/dist/chunk-DVQHKNNX.js +29 -0
- package/dist/chunk-DVQHKNNX.js.map +1 -0
- package/dist/chunk-FCPOPWG3.js +31 -0
- package/dist/chunk-FCPOPWG3.js.map +1 -0
- package/dist/chunk-GQ3TCJVX.js +216 -0
- package/dist/chunk-GQ3TCJVX.js.map +1 -0
- package/dist/{chunk-7N5HKQBM.js → chunk-GVZ2SAOI.js} +5 -552
- package/dist/chunk-GVZ2SAOI.js.map +1 -0
- package/dist/{chunk-7FR6KOW2.js → chunk-JLCF7CPP.js} +1256 -6590
- package/dist/chunk-JLCF7CPP.js.map +1 -0
- package/dist/chunk-K27LYMSF.js +435 -0
- package/dist/chunk-K27LYMSF.js.map +1 -0
- package/dist/chunk-MFAU3AWK.js +817 -0
- package/dist/chunk-MFAU3AWK.js.map +1 -0
- package/dist/chunk-OHWX6BEY.js +436 -0
- package/dist/chunk-OHWX6BEY.js.map +1 -0
- package/dist/chunk-PATS4DIF.js +484 -0
- package/dist/chunk-PATS4DIF.js.map +1 -0
- package/dist/chunk-WDQFNHYO.js +41 -0
- package/dist/chunk-WDQFNHYO.js.map +1 -0
- package/dist/chunk-WPWNYBNG.js +68 -0
- package/dist/chunk-WPWNYBNG.js.map +1 -0
- package/dist/chunk-WXXYJZE6.js +99 -0
- package/dist/chunk-WXXYJZE6.js.map +1 -0
- package/dist/host.js +4 -2
- package/dist/host.js.map +1 -1
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/dist/render.js +11 -3
- package/dist/render.js.map +1 -1
- package/dist/tanstack.js +10 -2
- package/dist/tanstack.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-7FR6KOW2.js.map +0 -1
- package/dist/chunk-7N5HKQBM.js.map +0 -1
- package/dist/chunk-QU5O4CKY.js.map +0 -1
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { useMyOrders } from './chunk-WPWNYBNG.js';
|
|
2
|
+
import { CustomerAccountShell, financialStatusBadge, OrderTrackingTimeline } from './chunk-D5C5U2SG.js';
|
|
3
|
+
import { SkeletonGroup, Skeleton } from './chunk-FCPOPWG3.js';
|
|
4
|
+
import { useAccountAddresses } from './chunk-OHWX6BEY.js';
|
|
5
|
+
import { useDeliveryStore } from './chunk-K27LYMSF.js';
|
|
6
|
+
import { parseAccountSection } from './chunk-DVQHKNNX.js';
|
|
7
|
+
import { useSessionStore, useStorefrontHead, TID, SmoothImage, signUpCustomer, establishCustomerSession, EmailConfirmationRequiredError, formatMoney } from './chunk-PATS4DIF.js';
|
|
8
|
+
import { useStorefrontConfig, useRoutePath, Link } from './chunk-GVZ2SAOI.js';
|
|
9
|
+
import React, { useState } from 'react';
|
|
10
|
+
import { Package, MapPin, CreditCard, QrCode } from 'lucide-react';
|
|
11
|
+
import { getShopProvider } from '@fayz-ai/shop/runtime';
|
|
12
|
+
import { isValidCpf } from '@fayz-ai/shop';
|
|
13
|
+
import { describeError } from '@fayz-ai/core';
|
|
14
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
|
+
|
|
16
|
+
function AuthForm() {
|
|
17
|
+
const [mode, setMode] = useState("signin");
|
|
18
|
+
const [email, setEmail] = useState("");
|
|
19
|
+
const [password, setPassword] = useState("");
|
|
20
|
+
const [confirmPassword, setConfirmPassword] = useState("");
|
|
21
|
+
const [name, setName] = useState("");
|
|
22
|
+
const [busy, setBusy] = useState(false);
|
|
23
|
+
const [error, setError] = useState(null);
|
|
24
|
+
const [notice, setNotice] = useState(null);
|
|
25
|
+
async function submit(e) {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
setError(null);
|
|
28
|
+
setNotice(null);
|
|
29
|
+
if (!email.trim() || !password) return;
|
|
30
|
+
if (mode === "signup" && !name.trim()) {
|
|
31
|
+
setError("Informe seu nome.");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (mode === "signup" && password !== confirmPassword) {
|
|
35
|
+
setError("As senhas n\xE3o s\xE3o iguais.");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
setBusy(true);
|
|
39
|
+
try {
|
|
40
|
+
if (mode === "signup") await signUpCustomer(email, password, name.trim());
|
|
41
|
+
else await establishCustomerSession(email, { password });
|
|
42
|
+
} catch (err) {
|
|
43
|
+
if (err instanceof EmailConfirmationRequiredError) {
|
|
44
|
+
setNotice("Cadastro realizado! Confirme seu e-mail para continuar.");
|
|
45
|
+
} else {
|
|
46
|
+
setError(describeError(err, "N\xE3o foi poss\xEDvel entrar. Verifique seus dados."));
|
|
47
|
+
}
|
|
48
|
+
} finally {
|
|
49
|
+
setBusy(false);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const tab = (id, label, testId) => /* @__PURE__ */ jsx(
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
"data-testid": testId,
|
|
57
|
+
onClick: () => {
|
|
58
|
+
setMode(id);
|
|
59
|
+
setError(null);
|
|
60
|
+
setNotice(null);
|
|
61
|
+
},
|
|
62
|
+
className: `flex-1 border-b-2 pb-2.5 text-sm font-semibold transition-colors ${mode === id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground"}`,
|
|
63
|
+
children: label
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-sm animate-fade-up border bg-card p-7", style: { borderRadius: "var(--sf-radius-card)" }, children: [
|
|
67
|
+
/* @__PURE__ */ jsx("h2", { className: "sf-heading text-xl font-semibold", children: "Minha conta" }),
|
|
68
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Acompanhe pedidos e acelere seus pr\xF3ximos checkouts." }),
|
|
69
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-5 flex gap-2", children: [
|
|
70
|
+
tab("signin", "Entrar", TID.authTabSignin),
|
|
71
|
+
tab("signup", "Criar conta", TID.authTabSignup)
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ jsxs("form", { className: "mt-5 space-y-3", onSubmit: submit, children: [
|
|
74
|
+
mode === "signup" && /* @__PURE__ */ jsx(
|
|
75
|
+
"input",
|
|
76
|
+
{
|
|
77
|
+
"data-testid": TID.signinName,
|
|
78
|
+
type: "text",
|
|
79
|
+
required: true,
|
|
80
|
+
placeholder: "Nome completo",
|
|
81
|
+
value: name,
|
|
82
|
+
onChange: (e) => setName(e.target.value),
|
|
83
|
+
className: "w-full border bg-background px-3 py-2.5 text-sm",
|
|
84
|
+
style: { borderRadius: "var(--sf-radius-input)" }
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
"input",
|
|
89
|
+
{
|
|
90
|
+
"data-testid": TID.signinEmail,
|
|
91
|
+
type: "email",
|
|
92
|
+
required: true,
|
|
93
|
+
placeholder: "voce@exemplo.com",
|
|
94
|
+
value: email,
|
|
95
|
+
onChange: (e) => setEmail(e.target.value),
|
|
96
|
+
className: "w-full border bg-background px-3 py-2.5 text-sm",
|
|
97
|
+
style: { borderRadius: "var(--sf-radius-input)" }
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ jsx(
|
|
101
|
+
"input",
|
|
102
|
+
{
|
|
103
|
+
"data-testid": TID.signinPassword,
|
|
104
|
+
type: "password",
|
|
105
|
+
required: true,
|
|
106
|
+
placeholder: "Senha",
|
|
107
|
+
value: password,
|
|
108
|
+
onChange: (e) => setPassword(e.target.value),
|
|
109
|
+
className: "w-full border bg-background px-3 py-2.5 text-sm",
|
|
110
|
+
style: { borderRadius: "var(--sf-radius-input)" }
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
mode === "signup" && /* @__PURE__ */ jsx(
|
|
114
|
+
"input",
|
|
115
|
+
{
|
|
116
|
+
"data-testid": TID.signinPasswordConfirm,
|
|
117
|
+
type: "password",
|
|
118
|
+
required: true,
|
|
119
|
+
placeholder: "Confirmar senha",
|
|
120
|
+
value: confirmPassword,
|
|
121
|
+
onChange: (e) => setConfirmPassword(e.target.value),
|
|
122
|
+
"aria-invalid": confirmPassword.length > 0 && password !== confirmPassword,
|
|
123
|
+
className: "w-full border bg-background px-3 py-2.5 text-sm",
|
|
124
|
+
style: { borderRadius: "var(--sf-radius-input)" }
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
notice && /* @__PURE__ */ jsx("p", { "data-testid": TID.authNotice, className: "text-sm font-medium text-emerald-600", children: notice }),
|
|
128
|
+
error && /* @__PURE__ */ jsx("p", { "data-testid": TID.authError, className: "text-sm text-destructive", children: error }),
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
"button",
|
|
131
|
+
{
|
|
132
|
+
type: "submit",
|
|
133
|
+
"data-testid": TID.signinSubmit,
|
|
134
|
+
disabled: busy,
|
|
135
|
+
className: "sf-cta w-full bg-primary py-3 font-semibold text-primary-foreground shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg disabled:opacity-60",
|
|
136
|
+
style: { borderRadius: "var(--sf-radius-button)" },
|
|
137
|
+
children: busy ? "Entrando\u2026" : mode === "signup" ? "Criar conta" : "Entrar"
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] })
|
|
141
|
+
] });
|
|
142
|
+
}
|
|
143
|
+
function OrdersPanel() {
|
|
144
|
+
const config = useStorefrontConfig();
|
|
145
|
+
const { orders, loading } = useMyOrders();
|
|
146
|
+
const money = (v) => formatMoney(v, config.currency, config.locale);
|
|
147
|
+
if (loading) {
|
|
148
|
+
return /* @__PURE__ */ jsx(SkeletonGroup, { label: "Carregando seus pedidos", className: "space-y-4", children: [0, 1].map((row) => /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border bg-card p-5", children: [
|
|
149
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
150
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32" }),
|
|
151
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24 rounded-full" })
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "mt-2 h-3 w-20" }),
|
|
154
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4 flex items-center gap-2", children: [0, 1, 2, 3].map((node) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
155
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-6 shrink-0 rounded-full" }),
|
|
156
|
+
node < 3 && /* @__PURE__ */ jsx(Skeleton, { className: "h-px flex-1" })
|
|
157
|
+
] }, node)) }),
|
|
158
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-4 flex flex-wrap gap-2", children: [
|
|
159
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-32 rounded-lg" }),
|
|
160
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-24 rounded-lg" })
|
|
161
|
+
] }),
|
|
162
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center justify-between border-t pt-3", children: [
|
|
163
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" }),
|
|
164
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-20" })
|
|
165
|
+
] })
|
|
166
|
+
] }, row)) });
|
|
167
|
+
}
|
|
168
|
+
if (orders.length === 0) {
|
|
169
|
+
return /* @__PURE__ */ jsxs("div", { "data-testid": TID.purchasesEmpty, className: "rounded-2xl border bg-card py-16 text-center", children: [
|
|
170
|
+
/* @__PURE__ */ jsx(Package, { className: "mx-auto h-10 w-10 text-muted-foreground" }),
|
|
171
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-muted-foreground", children: "Voc\xEA ainda n\xE3o tem pedidos." }),
|
|
172
|
+
/* @__PURE__ */ jsx(Link, { to: "/", className: "mt-4 inline-block text-primary underline", children: "Explorar a loja" })
|
|
173
|
+
] });
|
|
174
|
+
}
|
|
175
|
+
return /* @__PURE__ */ jsx("ul", { "data-testid": TID.purchasesList, className: "space-y-4", children: orders.map((order) => /* @__PURE__ */ jsxs(
|
|
176
|
+
"li",
|
|
177
|
+
{
|
|
178
|
+
"data-testid": TID.purchaseItem,
|
|
179
|
+
"data-order-number": order.orderNumber,
|
|
180
|
+
className: "rounded-2xl border bg-card p-5",
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
183
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
|
|
184
|
+
"Pedido #",
|
|
185
|
+
order.orderNumber
|
|
186
|
+
] }),
|
|
187
|
+
/* @__PURE__ */ jsx("span", { className: `inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium ${financialStatusBadge(order.financialStatus).className}`, children: financialStatusBadge(order.financialStatus).label })
|
|
188
|
+
] }),
|
|
189
|
+
/* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-muted-foreground", children: new Date(order.createdAt).toLocaleDateString(config.locale) }),
|
|
190
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(OrderTrackingTimeline, { order, compact: true }) }),
|
|
191
|
+
/* @__PURE__ */ jsx("ul", { className: "mt-3 flex flex-wrap gap-2", children: order.items.map((item) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2 rounded-lg border px-2 py-1 text-xs", children: [
|
|
192
|
+
item.imageUrl && /* @__PURE__ */ jsx(SmoothImage, { src: item.imageUrl, alt: item.name, className: "h-6 w-6 rounded object-cover", variant: { width: 24 } }),
|
|
193
|
+
item.name,
|
|
194
|
+
" \xD7 ",
|
|
195
|
+
item.quantity
|
|
196
|
+
] }, item.id)) }),
|
|
197
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center justify-between border-t pt-3 text-sm", children: [
|
|
198
|
+
/* @__PURE__ */ jsx(Link, { to: `/order/${order.id}`, className: "font-medium text-primary hover:underline", children: "Ver detalhes" }),
|
|
199
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
200
|
+
/* @__PURE__ */ jsx("span", { className: "mr-2 text-muted-foreground", children: "Total" }),
|
|
201
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", "data-price": order.total.toFixed(2), children: money(order.total) })
|
|
202
|
+
] })
|
|
203
|
+
] })
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
order.id
|
|
207
|
+
)) });
|
|
208
|
+
}
|
|
209
|
+
function maskPhone(raw) {
|
|
210
|
+
const d = raw.replace(/\D/g, "").replace(/^55(?=\d{10,11}$)/, "").slice(0, 11);
|
|
211
|
+
if (d.length <= 2) return d ? `(${d}` : "";
|
|
212
|
+
if (d.length <= 6) return `(${d.slice(0, 2)}) ${d.slice(2)}`;
|
|
213
|
+
const head = d.length === 11 ? 7 : 6;
|
|
214
|
+
return `(${d.slice(0, 2)}) ${d.slice(2, head)}-${d.slice(head)}`;
|
|
215
|
+
}
|
|
216
|
+
function maskCpf(raw) {
|
|
217
|
+
const d = raw.replace(/\D/g, "").slice(0, 11);
|
|
218
|
+
return [d.slice(0, 3), d.slice(3, 6), d.slice(6, 9)].filter(Boolean).join(".") + (d.length > 9 ? `-${d.slice(9)}` : "");
|
|
219
|
+
}
|
|
220
|
+
var field = "mt-1 w-full rounded-lg border bg-background px-3 py-2.5 text-sm";
|
|
221
|
+
function ProfilePanel() {
|
|
222
|
+
const session = useSessionStore();
|
|
223
|
+
const provider = getShopProvider();
|
|
224
|
+
const supported = typeof provider.getMyProfile === "function" && typeof provider.saveMyProfile === "function";
|
|
225
|
+
const [name, setName] = useState(session.name ?? "");
|
|
226
|
+
const [phone, setPhone] = useState("");
|
|
227
|
+
const [cpf, setCpf] = useState("");
|
|
228
|
+
const [birthDate, setBirthDate] = useState("");
|
|
229
|
+
const [loading, setLoading] = useState(supported);
|
|
230
|
+
const [saving, setSaving] = useState(false);
|
|
231
|
+
const [saved, setSaved] = useState(false);
|
|
232
|
+
const [error, setError] = useState(null);
|
|
233
|
+
React.useEffect(() => {
|
|
234
|
+
if (!supported) return;
|
|
235
|
+
let cancelled = false;
|
|
236
|
+
provider.getMyProfile().then((p) => {
|
|
237
|
+
if (cancelled || !p) return;
|
|
238
|
+
const full = [p.firstName, p.lastName].filter(Boolean).join(" ").trim();
|
|
239
|
+
if (full) setName(full);
|
|
240
|
+
setPhone(maskPhone(p.phone ?? ""));
|
|
241
|
+
setCpf(maskCpf(p.document ?? ""));
|
|
242
|
+
setBirthDate(p.birthDate ?? "");
|
|
243
|
+
}).catch(() => {
|
|
244
|
+
}).finally(() => {
|
|
245
|
+
if (!cancelled) setLoading(false);
|
|
246
|
+
});
|
|
247
|
+
return () => {
|
|
248
|
+
cancelled = true;
|
|
249
|
+
};
|
|
250
|
+
}, [supported]);
|
|
251
|
+
const edit = (set) => (v) => {
|
|
252
|
+
set(v);
|
|
253
|
+
setSaved(false);
|
|
254
|
+
setError(null);
|
|
255
|
+
};
|
|
256
|
+
async function save(e) {
|
|
257
|
+
e.preventDefault();
|
|
258
|
+
const trimmed = name.trim();
|
|
259
|
+
if (!trimmed) {
|
|
260
|
+
setError("Informe seu nome.");
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const phoneDigits = phone.replace(/\D/g, "");
|
|
264
|
+
if (phoneDigits && phoneDigits.length !== 10 && phoneDigits.length !== 11) {
|
|
265
|
+
setError("Celular inv\xE1lido: use o DDD e o n\xFAmero.");
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const cpfDigits = cpf.replace(/\D/g, "");
|
|
269
|
+
if (cpfDigits && !isValidCpf(cpfDigits)) {
|
|
270
|
+
setError("CPF inv\xE1lido. Confira os n\xFAmeros.");
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
setSaving(true);
|
|
274
|
+
setSaved(false);
|
|
275
|
+
setError(null);
|
|
276
|
+
try {
|
|
277
|
+
if (supported) {
|
|
278
|
+
await provider.saveMyProfile({
|
|
279
|
+
name: trimmed,
|
|
280
|
+
phone: phoneDigits || null,
|
|
281
|
+
document: cpfDigits || null,
|
|
282
|
+
birthDate: birthDate || null
|
|
283
|
+
});
|
|
284
|
+
} else if (session.customerId) {
|
|
285
|
+
const parts = trimmed.split(/\s+/).filter(Boolean);
|
|
286
|
+
await provider.updateCustomer(session.customerId, { firstName: parts[0] ?? trimmed, lastName: parts.slice(1).join(" ") });
|
|
287
|
+
}
|
|
288
|
+
useSessionStore.setState({ name: trimmed });
|
|
289
|
+
setSaved(true);
|
|
290
|
+
} catch (err) {
|
|
291
|
+
setError(err instanceof Error && err.message ? err.message : "N\xE3o foi poss\xEDvel salvar agora. Tente novamente em instantes.");
|
|
292
|
+
} finally {
|
|
293
|
+
setSaving(false);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
297
|
+
return /* @__PURE__ */ jsxs("form", { onSubmit: save, className: "max-w-md rounded-2xl border bg-card p-6", "data-testid": "account-profile", children: [
|
|
298
|
+
/* @__PURE__ */ jsx("h2", { className: "sf-heading text-lg font-semibold", children: "Perfil" }),
|
|
299
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Seus dados para os pr\xF3ximos pedidos." }),
|
|
300
|
+
/* @__PURE__ */ jsxs("fieldset", { disabled: loading || saving, className: "contents", children: [
|
|
301
|
+
/* @__PURE__ */ jsxs("label", { className: "mt-5 block text-sm font-medium", children: [
|
|
302
|
+
"Nome completo",
|
|
303
|
+
/* @__PURE__ */ jsx("input", { value: name, onChange: (e) => edit(setName)(e.target.value), className: field, placeholder: "Seu nome", autoComplete: "name" })
|
|
304
|
+
] }),
|
|
305
|
+
/* @__PURE__ */ jsxs("label", { className: "mt-4 block text-sm font-medium", children: [
|
|
306
|
+
"E-mail",
|
|
307
|
+
/* @__PURE__ */ jsx(
|
|
308
|
+
"input",
|
|
309
|
+
{
|
|
310
|
+
value: session.email ?? "",
|
|
311
|
+
readOnly: true,
|
|
312
|
+
className: "mt-1 w-full cursor-not-allowed rounded-lg border bg-muted/40 px-3 py-2.5 text-sm text-muted-foreground"
|
|
313
|
+
}
|
|
314
|
+
)
|
|
315
|
+
] }),
|
|
316
|
+
/* @__PURE__ */ jsxs("label", { className: "mt-4 block text-sm font-medium", children: [
|
|
317
|
+
"Celular",
|
|
318
|
+
/* @__PURE__ */ jsx(
|
|
319
|
+
"input",
|
|
320
|
+
{
|
|
321
|
+
value: phone,
|
|
322
|
+
onChange: (e) => edit(setPhone)(maskPhone(e.target.value)),
|
|
323
|
+
className: field,
|
|
324
|
+
placeholder: "(21) 99999-9999",
|
|
325
|
+
inputMode: "tel",
|
|
326
|
+
autoComplete: "tel-national",
|
|
327
|
+
"data-testid": "profile-phone"
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
] }),
|
|
331
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2", children: [
|
|
332
|
+
/* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium", children: [
|
|
333
|
+
"CPF",
|
|
334
|
+
/* @__PURE__ */ jsx(
|
|
335
|
+
"input",
|
|
336
|
+
{
|
|
337
|
+
value: cpf,
|
|
338
|
+
onChange: (e) => edit(setCpf)(maskCpf(e.target.value)),
|
|
339
|
+
className: field,
|
|
340
|
+
placeholder: "000.000.000-00",
|
|
341
|
+
inputMode: "numeric",
|
|
342
|
+
"data-testid": "profile-cpf"
|
|
343
|
+
}
|
|
344
|
+
)
|
|
345
|
+
] }),
|
|
346
|
+
/* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium", children: [
|
|
347
|
+
"Data de nascimento",
|
|
348
|
+
/* @__PURE__ */ jsx(
|
|
349
|
+
"input",
|
|
350
|
+
{
|
|
351
|
+
type: "date",
|
|
352
|
+
value: birthDate,
|
|
353
|
+
max: today,
|
|
354
|
+
min: "1900-01-01",
|
|
355
|
+
onChange: (e) => edit(setBirthDate)(e.target.value),
|
|
356
|
+
className: `${field} [color-scheme:light] dark:[color-scheme:dark]`,
|
|
357
|
+
autoComplete: "bday",
|
|
358
|
+
"data-testid": "profile-birth-date"
|
|
359
|
+
}
|
|
360
|
+
)
|
|
361
|
+
] })
|
|
362
|
+
] })
|
|
363
|
+
] }),
|
|
364
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-5 flex items-center gap-3", children: [
|
|
365
|
+
/* @__PURE__ */ jsx(
|
|
366
|
+
"button",
|
|
367
|
+
{
|
|
368
|
+
type: "submit",
|
|
369
|
+
disabled: saving || loading,
|
|
370
|
+
className: "sf-cta rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-primary-foreground disabled:opacity-60",
|
|
371
|
+
"data-testid": "profile-save",
|
|
372
|
+
children: saving ? "Salvando\u2026" : "Salvar"
|
|
373
|
+
}
|
|
374
|
+
),
|
|
375
|
+
saved && /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-emerald-600", children: "Salvo" })
|
|
376
|
+
] }),
|
|
377
|
+
error && /* @__PURE__ */ jsx("p", { role: "alert", className: "mt-3 text-sm text-destructive", children: error })
|
|
378
|
+
] });
|
|
379
|
+
}
|
|
380
|
+
function AddressesPanel() {
|
|
381
|
+
const config = useStorefrontConfig();
|
|
382
|
+
const customerId = useSessionStore((s) => s.customerId);
|
|
383
|
+
const account = useAccountAddresses(customerId);
|
|
384
|
+
const browser = useDeliveryStore((s) => s.savedAddresses);
|
|
385
|
+
const removeAddress = useDeliveryStore((s) => s.removeAddress);
|
|
386
|
+
const empty = account.length === 0 && browser.length === 0;
|
|
387
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border bg-card p-6", "data-testid": "account-addresses", children: [
|
|
388
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
389
|
+
/* @__PURE__ */ jsx(MapPin, { className: "h-5 w-5 text-primary" }),
|
|
390
|
+
/* @__PURE__ */ jsx("h2", { className: "sf-heading text-lg font-semibold", children: "Endere\xE7os" })
|
|
391
|
+
] }),
|
|
392
|
+
empty ? /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: "Nenhum endere\xE7o salvo ainda. Ele fica salvo quando voc\xEA informa onde receber no card\xE1pio ou no checkout." }) : /* @__PURE__ */ jsxs("ul", { className: "mt-4 space-y-2", children: [
|
|
393
|
+
account.map((a) => /* @__PURE__ */ jsxs("li", { className: "rounded-lg border p-3 text-sm", children: [
|
|
394
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: a.label ?? `${a.street}${a.number ? `, ${a.number}` : ""}` }),
|
|
395
|
+
/* @__PURE__ */ jsx("span", { className: "block text-xs text-muted-foreground", children: [a.label ? `${a.street}${a.number ? `, ${a.number}` : ""}` : null, a.complement, a.district, a.city].filter(Boolean).join(" \xB7 ") })
|
|
396
|
+
] }, `account-${a.id}`)),
|
|
397
|
+
browser.map((a) => /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2 rounded-lg border p-3 text-sm", children: [
|
|
398
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
399
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: a.label ?? `${a.street}, ${a.number}` }),
|
|
400
|
+
/* @__PURE__ */ jsx("span", { className: "block text-xs text-muted-foreground", children: [a.label ? `${a.street}, ${a.number}` : null, a.complement, a.district, a.city].filter(Boolean).join(" \xB7 ") }),
|
|
401
|
+
/* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-[11px] text-muted-foreground", children: "Salvo neste aparelho" })
|
|
402
|
+
] }),
|
|
403
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => removeAddress(a.id), className: "text-xs font-semibold text-destructive", children: "Remover" })
|
|
404
|
+
] }, a.id))
|
|
405
|
+
] }),
|
|
406
|
+
/* @__PURE__ */ jsx(Link, { to: config.catalogPath, className: "mt-4 inline-block text-sm font-semibold text-primary underline", children: "Continuar comprando" })
|
|
407
|
+
] });
|
|
408
|
+
}
|
|
409
|
+
function PaymentsPanel() {
|
|
410
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border bg-card p-6", children: [
|
|
411
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
412
|
+
/* @__PURE__ */ jsx(CreditCard, { className: "h-5 w-5 text-primary" }),
|
|
413
|
+
/* @__PURE__ */ jsx("h2", { className: "sf-heading text-lg font-semibold", children: "Pagamentos" })
|
|
414
|
+
] }),
|
|
415
|
+
/* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: "Os pagamentos s\xE3o processados com seguran\xE7a no checkout \u2014 nenhum dado de pagamento fica salvo nesta conta." }),
|
|
416
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center gap-2 rounded-lg bg-muted/40 px-3 py-2.5 text-sm", children: [
|
|
417
|
+
/* @__PURE__ */ jsx(QrCode, { className: "h-4 w-4 text-primary" }),
|
|
418
|
+
/* @__PURE__ */ jsx("span", { children: "Pix e cart\xE3o via Mercado Pago no momento da compra." })
|
|
419
|
+
] })
|
|
420
|
+
] });
|
|
421
|
+
}
|
|
422
|
+
var SECTION_SUBTITLE = {
|
|
423
|
+
profile: "Seus dados de contato.",
|
|
424
|
+
orders: "Acompanhe seus pedidos e entregas.",
|
|
425
|
+
addresses: "Endere\xE7os de entrega.",
|
|
426
|
+
payments: "Como voc\xEA paga na loja."
|
|
427
|
+
};
|
|
428
|
+
function MyPurchasesPage() {
|
|
429
|
+
const config = useStorefrontConfig();
|
|
430
|
+
const session = useSessionStore();
|
|
431
|
+
const section = parseAccountSection(useRoutePath());
|
|
432
|
+
useStorefrontHead({ title: `Minha conta \u2014 ${config.name}` });
|
|
433
|
+
if (!session.email) {
|
|
434
|
+
return /* @__PURE__ */ jsx("main", { className: "mx-auto max-w-3xl px-4 py-12 sm:px-6", children: /* @__PURE__ */ jsx(AuthForm, {}) });
|
|
435
|
+
}
|
|
436
|
+
return /* @__PURE__ */ jsxs(
|
|
437
|
+
CustomerAccountShell,
|
|
438
|
+
{
|
|
439
|
+
title: "Minha conta",
|
|
440
|
+
subtitle: SECTION_SUBTITLE[section],
|
|
441
|
+
active: section,
|
|
442
|
+
children: [
|
|
443
|
+
section === "profile" && /* @__PURE__ */ jsx(ProfilePanel, {}),
|
|
444
|
+
section === "orders" && /* @__PURE__ */ jsx(OrdersPanel, {}),
|
|
445
|
+
section === "addresses" && /* @__PURE__ */ jsx(AddressesPanel, {}),
|
|
446
|
+
section === "payments" && /* @__PURE__ */ jsx(PaymentsPanel, {})
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export { MyPurchasesPage };
|
|
453
|
+
//# sourceMappingURL=chunk-CV6RYJIC.js.map
|
|
454
|
+
//# sourceMappingURL=chunk-CV6RYJIC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/views/MyPurchasesPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAsBA,SAAS,QAAA,GAAW;AAClB,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAA8B,QAAQ,CAAA;AAC9D,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,EAAE,CAAA;AACrC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,EAAE,CAAA;AAC3C,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,SAAS,EAAE,CAAA;AACzD,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,EAAE,CAAA;AACnC,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CAAA;AACtC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAwB,IAAI,CAAA;AACtD,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAwB,IAAI,CAAA;AAExD,EAAA,eAAe,OAAO,CAAA,EAAoB;AACxC,IAAA,CAAA,CAAE,cAAA,EAAe;AACjB,IAAA,QAAA,CAAS,IAAI,CAAA;AACb,IAAA,SAAA,CAAU,IAAI,CAAA;AACd,IAAA,IAAI,CAAC,KAAA,CAAM,IAAA,EAAK,IAAK,CAAC,QAAA,EAAU;AAChC,IAAA,IAAI,IAAA,KAAS,QAAA,IAAY,CAAC,IAAA,CAAK,MAAK,EAAG;AACrC,MAAA,QAAA,CAAS,mBAAmB,CAAA;AAC5B,MAAA;AAAA,IACF;AAIA,IAAA,IAAI,IAAA,KAAS,QAAA,IAAY,QAAA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AAA,uBACE,IAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAM,aAAA;AAAA,MACN,QAAA,EAAU,iBAAiB,OAAO,CAAA;AAAA,MAClC,MAAA,EAAQ,OAAA;AAAA,MAEP,QAAA,EAAA;AAAA,QAAA,OAAA,KAAY,SAAA,wBAAc,YAAA,EAAA,EAAa,CAAA;AAAA,QACvC,OAAA,KAAY,QAAA,oBAAY,GAAA,CAAC,WAAA,EAAA,EAAY,CAAA;AAAA,QACrC,OAAA,KAAY,WAAA,oBAAe,GAAA,CAAC,cAAA,EAAA,EAAe,CAAA;AAAA,QAC3C,OAAA,KAAY,UAAA,oBAAc,GAAA,CAAC,aAAA,EAAA,EAAc;AAAA;AAAA;AAAA,GAC5C;AAEJ","file":"chunk-CV6RYJIC.js","sourcesContent":["import React, { useState } from 'react'\nimport { CreditCard, MapPin, Package, QrCode } from 'lucide-react'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport { isValidCpf } from '@fayz-ai/shop'\nimport { useSessionStore } from '../stores/session.store'\nimport { establishCustomerSession, signUpCustomer, EmailConfirmationRequiredError } from '../data/auth'\nimport { useMyOrders } from '../hooks/use-my-orders'\nimport { useStorefrontConfig } from '../document/config'\nimport { Link, useRoutePath } from '../app/router'\nimport { formatMoney } from '../lib/format'\nimport { TID } from '../lib/testids'\nimport { useAccountAddresses } from '../components/delivery/AddressSheet'\nimport { useDeliveryStore } from '../stores/delivery.store'\nimport { CustomerAccountShell } from '../components/account/CustomerAccountShell'\nimport { parseAccountSection, type AccountSection } from '../components/account/section'\nimport { OrderTrackingTimeline } from '../components/order/OrderTrackingTimeline'\nimport { financialStatusBadge } from '../data/order-status'\nimport { useStorefrontHead } from '../hooks/use-storefront-head'\nimport { SmoothImage } from '../components/SmoothImage'\nimport { Skeleton, SkeletonGroup } from '../components/Skeleton'\nimport { describeError } from '@fayz-ai/core'\n\nfunction AuthForm() {\n const [mode, setMode] = useState<'signin' | 'signup'>('signin')\n const [email, setEmail] = useState('')\n const [password, setPassword] = useState('')\n const [confirmPassword, setConfirmPassword] = useState('')\n const [name, setName] = useState('')\n const [busy, setBusy] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [notice, setNotice] = useState<string | null>(null)\n\n async function submit(e: React.FormEvent) {\n e.preventDefault()\n setError(null)\n setNotice(null)\n if (!email.trim() || !password) return\n if (mode === 'signup' && !name.trim()) {\n setError('Informe seu nome.')\n return\n }\n // Checked here rather than left to the provider: a typo in a password\n // nobody can read back is only discovered at the next sign-in, and by\n // then the account exists with a password its owner never meant to set.\n if (mode === 'signup' && password !== confirmPassword) {\n setError('As senhas não são iguais.')\n return\n }\n setBusy(true)\n try {\n if (mode === 'signup') await signUpCustomer(email, password, name.trim())\n else await establishCustomerSession(email, { password })\n } catch (err) {\n if (err instanceof EmailConfirmationRequiredError) {\n setNotice('Cadastro realizado! Confirme seu e-mail para continuar.')\n } else {\n setError(describeError(err, 'Não foi possível entrar. Verifique seus dados.'))\n }\n } finally {\n setBusy(false)\n }\n }\n\n const tab = (id: 'signin' | 'signup', label: string, testId: string) => (\n <button\n type=\"button\"\n data-testid={testId}\n onClick={() => {\n setMode(id)\n setError(null)\n setNotice(null)\n }}\n className={`flex-1 border-b-2 pb-2.5 text-sm font-semibold transition-colors ${\n mode === id ? 'border-primary text-primary' : 'border-transparent text-muted-foreground hover:text-foreground'\n }`}\n >\n {label}\n </button>\n )\n\n return (\n <div className=\"mx-auto max-w-sm animate-fade-up border bg-card p-7\" style={{ borderRadius: 'var(--sf-radius-card)' }}>\n <h2 className=\"sf-heading text-xl font-semibold\">Minha conta</h2>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n Acompanhe pedidos e acelere seus próximos checkouts.\n </p>\n <div className=\"mt-5 flex gap-2\">\n {tab('signin', 'Entrar', TID.authTabSignin)}\n {tab('signup', 'Criar conta', TID.authTabSignup)}\n </div>\n <form className=\"mt-5 space-y-3\" onSubmit={submit}>\n {mode === 'signup' && (\n <input\n data-testid={TID.signinName}\n type=\"text\"\n required\n placeholder=\"Nome completo\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className=\"w-full border bg-background px-3 py-2.5 text-sm\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n )}\n <input\n data-testid={TID.signinEmail}\n type=\"email\"\n required\n placeholder=\"voce@exemplo.com\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n className=\"w-full border bg-background px-3 py-2.5 text-sm\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n <input\n data-testid={TID.signinPassword}\n type=\"password\"\n required\n placeholder=\"Senha\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n className=\"w-full border bg-background px-3 py-2.5 text-sm\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n {mode === 'signup' && (\n <input\n data-testid={TID.signinPasswordConfirm}\n type=\"password\"\n required\n placeholder=\"Confirmar senha\"\n value={confirmPassword}\n onChange={(e) => setConfirmPassword(e.target.value)}\n aria-invalid={confirmPassword.length > 0 && password !== confirmPassword}\n className=\"w-full border bg-background px-3 py-2.5 text-sm\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n )}\n {notice && (\n <p data-testid={TID.authNotice} className=\"text-sm font-medium text-emerald-600\">{notice}</p>\n )}\n {error && (\n <p data-testid={TID.authError} className=\"text-sm text-destructive\">{error}</p>\n )}\n <button\n type=\"submit\"\n data-testid={TID.signinSubmit}\n disabled={busy}\n className=\"sf-cta w-full bg-primary py-3 font-semibold text-primary-foreground shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg disabled:opacity-60\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n {busy ? 'Entrando…' : mode === 'signup' ? 'Criar conta' : 'Entrar'}\n </button>\n </form>\n </div>\n )\n}\n\nfunction OrdersPanel() {\n const config = useStorefrontConfig()\n const { orders, loading } = useMyOrders()\n const money = (v: number) => formatMoney(v, config.currency, config.locale)\n\n if (loading) {\n return (\n <SkeletonGroup label=\"Carregando seus pedidos\" className=\"space-y-4\">\n {[0, 1].map((row) => (\n <div key={row} className=\"rounded-2xl border bg-card p-5\">\n <div className=\"flex items-center justify-between\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"h-5 w-24 rounded-full\" />\n </div>\n <Skeleton className=\"mt-2 h-3 w-20\" />\n <div className=\"mt-4 flex items-center gap-2\">\n {[0, 1, 2, 3].map((node) => (\n <React.Fragment key={node}>\n <Skeleton className=\"h-6 w-6 shrink-0 rounded-full\" />\n {node < 3 && <Skeleton className=\"h-px flex-1\" />}\n </React.Fragment>\n ))}\n </div>\n <div className=\"mt-4 flex flex-wrap gap-2\">\n <Skeleton className=\"h-7 w-32 rounded-lg\" />\n <Skeleton className=\"h-7 w-24 rounded-lg\" />\n </div>\n <div className=\"mt-3 flex items-center justify-between border-t pt-3\">\n <Skeleton className=\"h-4 w-24\" />\n <Skeleton className=\"h-4 w-20\" />\n </div>\n </div>\n ))}\n </SkeletonGroup>\n )\n }\n if (orders.length === 0) {\n return (\n <div data-testid={TID.purchasesEmpty} className=\"rounded-2xl border bg-card py-16 text-center\">\n <Package className=\"mx-auto h-10 w-10 text-muted-foreground\" />\n <p className=\"mt-3 text-muted-foreground\">Você ainda não tem pedidos.</p>\n <Link to=\"/\" className=\"mt-4 inline-block text-primary underline\">Explorar a loja</Link>\n </div>\n )\n }\n return (\n <ul data-testid={TID.purchasesList} className=\"space-y-4\">\n {orders.map((order) => (\n <li\n key={order.id}\n data-testid={TID.purchaseItem}\n data-order-number={order.orderNumber}\n className=\"rounded-2xl border bg-card p-5\"\n >\n <div className=\"flex items-center justify-between\">\n <span className=\"font-semibold\">Pedido #{order.orderNumber}</span>\n <span className={`inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium ${financialStatusBadge(order.financialStatus).className}`}>\n {financialStatusBadge(order.financialStatus).label}\n </span>\n </div>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {new Date(order.createdAt).toLocaleDateString(config.locale)}\n </p>\n <div className=\"mt-4\">\n <OrderTrackingTimeline order={order} compact />\n </div>\n <ul className=\"mt-3 flex flex-wrap gap-2\">\n {order.items.map((item) => (\n <li key={item.id} className=\"flex items-center gap-2 rounded-lg border px-2 py-1 text-xs\">\n {item.imageUrl && <SmoothImage src={item.imageUrl} alt={item.name} className=\"h-6 w-6 rounded object-cover\" variant={{ width: 24 }} />}\n {item.name} × {item.quantity}\n </li>\n ))}\n </ul>\n <div className=\"mt-3 flex items-center justify-between border-t pt-3 text-sm\">\n <Link to={`/order/${order.id}`} className=\"font-medium text-primary hover:underline\">\n Ver detalhes\n </Link>\n <span>\n <span className=\"mr-2 text-muted-foreground\">Total</span>\n <span className=\"font-semibold\" data-price={order.total.toFixed(2)}>{money(order.total)}</span>\n </span>\n </div>\n </li>\n ))}\n </ul>\n )\n}\n\n/** «(21) 97122-1016» from digits; partial input stays partial. */\nfunction maskPhone(raw: string): string {\n const d = raw.replace(/\\D/g, '').replace(/^55(?=\\d{10,11}$)/, '').slice(0, 11)\n if (d.length <= 2) return d ? `(${d}` : ''\n if (d.length <= 6) return `(${d.slice(0, 2)}) ${d.slice(2)}`\n const head = d.length === 11 ? 7 : 6\n return `(${d.slice(0, 2)}) ${d.slice(2, head)}-${d.slice(head)}`\n}\n\nfunction maskCpf(raw: string): string {\n const d = raw.replace(/\\D/g, '').slice(0, 11)\n return [d.slice(0, 3), d.slice(3, 6), d.slice(6, 9)].filter(Boolean).join('.') + (d.length > 9 ? `-${d.slice(9)}` : '')\n}\n\nconst field = 'mt-1 w-full rounded-lg border bg-background px-3 py-2.5 text-sm'\n\n/**\n * The buyer's own data (shop 0133): name, phone, CPF and date of birth, read\n * and saved through shop_my_profile / shop_save_my_profile — a shopper is not a\n * member of the store, so a plain customer UPDATE is refused by RLS. Phone and\n * CPF open prefilled from the last order when the profile never had them.\n */\nfunction ProfilePanel() {\n const session = useSessionStore()\n const provider = getShopProvider()\n const supported = typeof provider.getMyProfile === 'function' && typeof provider.saveMyProfile === 'function'\n const [name, setName] = useState(session.name ?? '')\n const [phone, setPhone] = useState('')\n const [cpf, setCpf] = useState('')\n const [birthDate, setBirthDate] = useState('')\n const [loading, setLoading] = useState(supported)\n const [saving, setSaving] = useState(false)\n const [saved, setSaved] = useState(false)\n const [error, setError] = useState<string | null>(null)\n\n React.useEffect(() => {\n if (!supported) return\n let cancelled = false\n provider.getMyProfile!()\n .then((p) => {\n if (cancelled || !p) return\n const full = [p.firstName, p.lastName].filter(Boolean).join(' ').trim()\n if (full) setName(full)\n setPhone(maskPhone(p.phone ?? ''))\n setCpf(maskCpf(p.document ?? ''))\n setBirthDate(p.birthDate ?? '')\n })\n .catch(() => { /* the form still saves; it just opens empty */ })\n .finally(() => { if (!cancelled) setLoading(false) })\n return () => { cancelled = true }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [supported])\n\n const edit = <T,>(set: (v: T) => void) => (v: T) => { set(v); setSaved(false); setError(null) }\n\n async function save(e: React.FormEvent) {\n e.preventDefault()\n const trimmed = name.trim()\n if (!trimmed) { setError('Informe seu nome.'); return }\n const phoneDigits = phone.replace(/\\D/g, '')\n if (phoneDigits && phoneDigits.length !== 10 && phoneDigits.length !== 11) {\n setError('Celular inválido: use o DDD e o número.'); return\n }\n const cpfDigits = cpf.replace(/\\D/g, '')\n if (cpfDigits && !isValidCpf(cpfDigits)) { setError('CPF inválido. Confira os números.'); return }\n setSaving(true)\n setSaved(false)\n setError(null)\n try {\n if (supported) {\n await provider.saveMyProfile!({\n name: trimmed,\n phone: phoneDigits || null,\n document: cpfDigits || null,\n birthDate: birthDate || null,\n })\n } else if (session.customerId) {\n const parts = trimmed.split(/\\s+/).filter(Boolean)\n await provider.updateCustomer(session.customerId, { firstName: parts[0] ?? trimmed, lastName: parts.slice(1).join(' ') })\n }\n // Only after the write landed: mirroring the new name locally on a failed\n // save is how this looked like it worked while the record never changed.\n useSessionStore.setState({ name: trimmed })\n setSaved(true)\n } catch (err) {\n setError(err instanceof Error && err.message ? err.message : 'Não foi possível salvar agora. Tente novamente em instantes.')\n } finally {\n setSaving(false)\n }\n }\n\n const today = new Date().toISOString().slice(0, 10)\n\n return (\n <form onSubmit={save} className=\"max-w-md rounded-2xl border bg-card p-6\" data-testid=\"account-profile\">\n <h2 className=\"sf-heading text-lg font-semibold\">Perfil</h2>\n <p className=\"mt-1 text-sm text-muted-foreground\">Seus dados para os próximos pedidos.</p>\n <fieldset disabled={loading || saving} className=\"contents\">\n <label className=\"mt-5 block text-sm font-medium\">\n Nome completo\n <input value={name} onChange={(e) => edit(setName)(e.target.value)} className={field} placeholder=\"Seu nome\" autoComplete=\"name\" />\n </label>\n <label className=\"mt-4 block text-sm font-medium\">\n E-mail\n <input\n value={session.email ?? ''}\n readOnly\n className=\"mt-1 w-full cursor-not-allowed rounded-lg border bg-muted/40 px-3 py-2.5 text-sm text-muted-foreground\"\n />\n </label>\n <label className=\"mt-4 block text-sm font-medium\">\n Celular\n <input\n value={phone}\n onChange={(e) => edit(setPhone)(maskPhone(e.target.value))}\n className={field}\n placeholder=\"(21) 99999-9999\"\n inputMode=\"tel\"\n autoComplete=\"tel-national\"\n data-testid=\"profile-phone\"\n />\n </label>\n <div className=\"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <label className=\"block text-sm font-medium\">\n CPF\n <input\n value={cpf}\n onChange={(e) => edit(setCpf)(maskCpf(e.target.value))}\n className={field}\n placeholder=\"000.000.000-00\"\n inputMode=\"numeric\"\n data-testid=\"profile-cpf\"\n />\n </label>\n <label className=\"block text-sm font-medium\">\n Data de nascimento\n <input\n type=\"date\"\n value={birthDate}\n max={today}\n min=\"1900-01-01\"\n onChange={(e) => edit(setBirthDate)(e.target.value)}\n className={`${field} [color-scheme:light] dark:[color-scheme:dark]`}\n autoComplete=\"bday\"\n data-testid=\"profile-birth-date\"\n />\n </label>\n </div>\n </fieldset>\n <div className=\"mt-5 flex items-center gap-3\">\n <button\n type=\"submit\"\n disabled={saving || loading}\n className=\"sf-cta rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-primary-foreground disabled:opacity-60\"\n data-testid=\"profile-save\"\n >\n {saving ? 'Salvando…' : 'Salvar'}\n </button>\n {saved && <span className=\"text-sm font-medium text-emerald-600\">Salvo</span>}\n </div>\n {error && <p role=\"alert\" className=\"mt-3 text-sm text-destructive\">{error}</p>}\n </form>\n )\n}\n\nfunction AddressesPanel() {\n const config = useStorefrontConfig()\n const customerId = useSessionStore((s) => s.customerId)\n const account = useAccountAddresses(customerId)\n const browser = useDeliveryStore((s) => s.savedAddresses)\n const removeAddress = useDeliveryStore((s) => s.removeAddress)\n const empty = account.length === 0 && browser.length === 0\n return (\n <div className=\"rounded-2xl border bg-card p-6\" data-testid=\"account-addresses\">\n <div className=\"flex items-center gap-2\">\n <MapPin className=\"h-5 w-5 text-primary\" />\n <h2 className=\"sf-heading text-lg font-semibold\">Endereços</h2>\n </div>\n {empty ? (\n <p className=\"mt-2 text-sm text-muted-foreground\">\n Nenhum endereço salvo ainda. Ele fica salvo quando você informa onde receber no cardápio ou no checkout.\n </p>\n ) : (\n <ul className=\"mt-4 space-y-2\">\n {account.map((a) => (\n <li key={`account-${a.id}`} className=\"rounded-lg border p-3 text-sm\">\n <span className=\"block font-medium\">{a.label ?? `${a.street}${a.number ? `, ${a.number}` : ''}`}</span>\n <span className=\"block text-xs text-muted-foreground\">\n {[a.label ? `${a.street}${a.number ? `, ${a.number}` : ''}` : null, a.complement, a.district, a.city].filter(Boolean).join(' · ')}\n </span>\n </li>\n ))}\n {browser.map((a) => (\n <li key={a.id} className=\"flex items-start gap-2 rounded-lg border p-3 text-sm\">\n <span className=\"min-w-0 flex-1\">\n <span className=\"block font-medium\">{a.label ?? `${a.street}, ${a.number}`}</span>\n <span className=\"block text-xs text-muted-foreground\">\n {[a.label ? `${a.street}, ${a.number}` : null, a.complement, a.district, a.city].filter(Boolean).join(' · ')}\n </span>\n <span className=\"mt-0.5 block text-[11px] text-muted-foreground\">Salvo neste aparelho</span>\n </span>\n <button type=\"button\" onClick={() => removeAddress(a.id)} className=\"text-xs font-semibold text-destructive\">\n Remover\n </button>\n </li>\n ))}\n </ul>\n )}\n <Link to={config.catalogPath} className=\"mt-4 inline-block text-sm font-semibold text-primary underline\">\n Continuar comprando\n </Link>\n </div>\n )\n}\n\nfunction PaymentsPanel() {\n return (\n <div className=\"rounded-2xl border bg-card p-6\">\n <div className=\"flex items-center gap-2\">\n <CreditCard className=\"h-5 w-5 text-primary\" />\n <h2 className=\"sf-heading text-lg font-semibold\">Pagamentos</h2>\n </div>\n <p className=\"mt-2 text-sm text-muted-foreground\">\n Os pagamentos são processados com segurança no checkout — nenhum dado de pagamento fica salvo nesta conta.\n </p>\n <div className=\"mt-4 flex items-center gap-2 rounded-lg bg-muted/40 px-3 py-2.5 text-sm\">\n <QrCode className=\"h-4 w-4 text-primary\" />\n <span>Pix e cartão via Mercado Pago no momento da compra.</span>\n </div>\n </div>\n )\n}\n\nconst SECTION_SUBTITLE: Record<AccountSection, string> = {\n profile: 'Seus dados de contato.',\n orders: 'Acompanhe seus pedidos e entregas.',\n addresses: 'Endereços de entrega.',\n payments: 'Como você paga na loja.',\n}\n\nexport function MyPurchasesPage() {\n const config = useStorefrontConfig()\n const session = useSessionStore()\n const section = parseAccountSection(useRoutePath())\n useStorefrontHead({ title: `Minha conta — ${config.name}` })\n\n if (!session.email) {\n return (\n <main className=\"mx-auto max-w-3xl px-4 py-12 sm:px-6\">\n <AuthForm />\n </main>\n )\n }\n\n return (\n <CustomerAccountShell\n title=\"Minha conta\"\n subtitle={SECTION_SUBTITLE[section]}\n active={section}\n >\n {section === 'profile' && <ProfilePanel />}\n {section === 'orders' && <OrdersPanel />}\n {section === 'addresses' && <AddressesPanel />}\n {section === 'payments' && <PaymentsPanel />}\n </CustomerAccountShell>\n )\n}\n"]}
|