@fayz-ai/storefront 0.87.0 → 0.88.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CheckoutPage-NZP33IXA.js +12 -0
- package/dist/{CheckoutPage-4MFKLBEI.js.map → CheckoutPage-NZP33IXA.js.map} +1 -1
- package/dist/MyPurchasesPage-UNY743B3.js +11 -0
- package/dist/{MyPurchasesPage-F25MIFXT.js.map → MyPurchasesPage-UNY743B3.js.map} +1 -1
- package/dist/OrderConfirmationPage-76MLK2XU.js +10 -0
- package/dist/{OrderConfirmationPage-SOQDD767.js.map → OrderConfirmationPage-76MLK2XU.js.map} +1 -1
- package/dist/{chunk-EFHQ5MAJ.js → chunk-27C7DVHW.js} +3 -3
- package/dist/{chunk-EFHQ5MAJ.js.map → chunk-27C7DVHW.js.map} +1 -1
- package/dist/{chunk-NS6UPIJ3.js → chunk-3JAOGX7M.js} +3 -3
- package/dist/{chunk-NS6UPIJ3.js.map → chunk-3JAOGX7M.js.map} +1 -1
- package/dist/{chunk-YCAWAON6.js → chunk-4TSHGV4W.js} +15 -8
- package/dist/chunk-4TSHGV4W.js.map +1 -0
- package/dist/{chunk-RJUEUMR6.js → chunk-6MA7YLPR.js} +4 -4
- package/dist/{chunk-RJUEUMR6.js.map → chunk-6MA7YLPR.js.map} +1 -1
- package/dist/{chunk-IUP5SDTX.js → chunk-EJUFMPSI.js} +5 -5
- package/dist/{chunk-IUP5SDTX.js.map → chunk-EJUFMPSI.js.map} +1 -1
- package/dist/{chunk-YDZU2SZL.js → chunk-EVQYGOB2.js} +4 -4
- package/dist/{chunk-YDZU2SZL.js.map → chunk-EVQYGOB2.js.map} +1 -1
- package/dist/{chunk-Z5JT7T4I.js → chunk-F3JV7A2A.js} +8 -8
- package/dist/{chunk-Z5JT7T4I.js.map → chunk-F3JV7A2A.js.map} +1 -1
- package/dist/{chunk-SLJ4BRXD.js → chunk-GLLGH7FO.js} +3 -3
- package/dist/{chunk-SLJ4BRXD.js.map → chunk-GLLGH7FO.js.map} +1 -1
- package/dist/{chunk-OOQRYH3N.js → chunk-IEIDP37T.js} +6 -6
- package/dist/{chunk-OOQRYH3N.js.map → chunk-IEIDP37T.js.map} +1 -1
- package/dist/{chunk-PSDR5TZD.js → chunk-ILFYNKT2.js} +5 -2
- package/dist/chunk-ILFYNKT2.js.map +1 -0
- package/dist/{chunk-Z2NKBC42.js → chunk-KYFGJZSN.js} +4 -4
- package/dist/{chunk-Z2NKBC42.js.map → chunk-KYFGJZSN.js.map} +1 -1
- package/dist/{chunk-G4WCU526.js → chunk-SY7A4FMH.js} +12 -12
- package/dist/{chunk-G4WCU526.js.map → chunk-SY7A4FMH.js.map} +1 -1
- package/dist/{chunk-C4XATNI2.js → chunk-UHYQNPXO.js} +3 -3
- package/dist/{chunk-C4XATNI2.js.map → chunk-UHYQNPXO.js.map} +1 -1
- package/dist/{chunk-2JMPPAXL.js → chunk-ZHR5TQHW.js} +5 -5
- package/dist/{chunk-2JMPPAXL.js.map → chunk-ZHR5TQHW.js.map} +1 -1
- package/dist/host.js +4 -4
- package/dist/index.js +22 -22
- package/dist/locales/messages.d.ts +1 -0
- package/dist/locales/messages.d.ts.map +1 -1
- package/dist/render.js +9 -9
- package/dist/tanstack.js +8 -8
- package/dist/views/CheckoutPage.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/CheckoutPage-4MFKLBEI.js +0 -12
- package/dist/MyPurchasesPage-F25MIFXT.js +0 -11
- package/dist/OrderConfirmationPage-SOQDD767.js +0 -10
- package/dist/chunk-PSDR5TZD.js.map +0 -1
- package/dist/chunk-YCAWAON6.js.map +0 -1
|
@@ -1 +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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AAY,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-Z5JT7T4I.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"]}
|
|
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,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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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { currentStaticRenderPass, matchPath } from './chunk-
|
|
1
|
+
import { currentStaticRenderPass, matchPath } from './chunk-ILFYNKT2.js';
|
|
2
2
|
import { isLoaderParamRef, isLoaderPropRef, resolveLoader, errorMessage, dataNeedKey, getBlockMeta, defaultPropsFromSettings, getBlockErrorVisibility, isBlockEnabledOn, checkBlockConstraints, checkBlockContext } from '@fayz-ai/core';
|
|
3
3
|
import { createContext, useContext, useMemo, useState, useEffect } from 'react';
|
|
4
4
|
import { getShopProvider } from '@fayz-ai/shop/runtime';
|
|
@@ -325,5 +325,5 @@ function checkPageBlocks(kind, nodes) {
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
export { BLOCK_STRUCTURAL_KEYS, BlockDataError, CATALOG_BODY_BLOCK, PRODUCT_BODY_BLOCK, PageDataScope, blockInstanceId, checkPageBlocks, collectDataNeeds, contentPagePath, defaultPageBlocks, isNestedBlockRef, matchContentPage, mergePageTheme, pageThemeSelector, resolveDataParams, resolvePageData, resolvePageDataNeed, routePathParams, toBlockNodes, useBlockData, useLoader };
|
|
328
|
-
//# sourceMappingURL=chunk-
|
|
329
|
-
//# sourceMappingURL=chunk-
|
|
328
|
+
//# sourceMappingURL=chunk-GLLGH7FO.js.map
|
|
329
|
+
//# sourceMappingURL=chunk-GLLGH7FO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/blocks/page-data.tsx","../src/blocks/page-blocks.ts"],"names":["entry","getBlockMeta"],"mappings":";;;;;;AAwDO,SAAS,iBAAA,CACd,MACA,OAAA,EACyB;AACzB,EAAA,MAAM,MAA+B,EAAC;AACtC,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,KAAK,CAAA,IAAK,MAAA,CAAO,QAAQ,IAAA,CAAK,MAAA,IAAU,EAAE,CAAA,EAAG;AAC7D,IAAA,IAAI,QAAA,GAAoB,KAAA;AACxB,IAAA,IAAI,iBAAiB,KAAK,CAAA,aAAc,OAAA,CAAQ,MAAA,CAAO,MAAM,MAAM,CAAA;AAAA,SAAA,IAC1D,gBAAgB,KAAK,CAAA,aAAc,OAAA,CAAQ,KAAA,CAAM,MAAM,KAAK,CAAA;AACrE,IAAA,IAAI,QAAA,KAAa,MAAA,EAAW,GAAA,CAAI,IAAI,CAAA,GAAI,QAAA;AAAA,EAC1C;AACA,EAAA,OAAO,GAAA;AACT;AAIA,SAAS,aAAa,IAAA,EAAgD;AACpE,EAAA,MAAM,IAAA,GAAO,YAAA,CAAa,IAAA,CAAK,IAAI,CAAA;AACnC,EAAA,OAAO,EAAE,GAAG,IAAA,EAAM,IAAA,EAAM,GAAG,KAAK,IAAA,EAAK;AACvC;AAMO,SAAS,gBAAA,CACd,KAAA,EACA,WAAA,GAAsC,EAAC,EACvB;AAChB,EAAA,MAAM,KAAA,uBAAY,GAAA,EAA0B;AAC5C,EAAA,MAAM,KAAA,GAAQ,CAAC,IAAA,KAA0B;AACvC,IAAA,MAAM,IAAA,GAAO,YAAA,CAAa,IAAA,CAAK,IAAI,CAAA;AACnC,IA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;AAAA,EACF;AAEA,EAAA,IAAI,YAAA,IAAgB,CAAC,OAAA,EAAS;AAK5B,IAAA,KAAA,CAAM,IAAA,CAAK;AAAA,MACT,KAAA,EAAO,SAAA;AAAA,MACP,IAAA,EAAM,mBAAA;AAAA,MACN,MAAA,EAAQ,OAAO,IAAI,CAAA,kBAAA,EAAqB,YAAY,CAAA,0BAAA,EAA6B,IAAA,KAAS,SAAA,GAAY,gBAAA,GAAmB,cAAc,CAAA,wDAAA;AAAA,KACxI,CAAA;AAAA,EACH;AAMA,EAAA,KAAA,MAAW,SAAA,IAAa,qBAAA,CAAsB,KAAK,CAAA,EAAG;AACpD,IAAA,KAAA,CAAM,IAAA,CAAK;AAAA,MACT,KAAA,EAAO,OAAA;AAAA,MACP,MAAM,SAAA,CAAU,IAAA;AAAA,MAChB,MAAA,EAAQ,GAAG,IAAI,CAAA,MAAA,EAAS,UAAU,IAAI,CAAA,EAAA,EAAK,UAAU,MAAM,CAAA;AAAA,KAC5D,CAAA;AAAA,EACH;AAKA,EAAA,KAAA,MAAW,OAAA,IAAW,iBAAA,CAAkB,KAAK,CAAA,EAAG;AAC9C,IAAA,KAAA,CAAM,IAAA,CAAK;AAAA,MACT,KAAA,EAAO,SAAA;AAAA,MACP,IAAA,EAAM,sBAAA;AAAA,MACN,MAAA,EAAQ,CAAA,OAAA,EAAU,OAAA,CAAQ,IAAI,QAAQ,IAAI,CAAA,MAAA,EAAS,OAAA,CAAQ,IAAI,CAAA,eAAA,EAAkB,OAAA,CAAQ,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAC,CAAA,2BAAA;AAAA,KAC5G,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,KAAA;AACT","file":"chunk-SLJ4BRXD.js","sourcesContent":["import { errorMessage } from '@fayz-ai/core'\nimport React, { createContext, useContext, useEffect, useMemo, useState } from 'react'\nimport {\n dataNeedKey,\n defaultPropsFromSettings,\n getBlockErrorVisibility,\n getBlockMeta,\n isLoaderParamRef,\n isLoaderPropRef,\n resolveLoader,\n} from '@fayz-ai/core'\nimport type { BlockDataNeed, BlockNode } from '@fayz-ai/core'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport { currentStaticRenderPass } from '../app/static-render'\n\n// ---------------------------------------------------------------------------\n// Page data — declared needs, resolved once per page (spine M3, I11).\n//\n// A block never fetches for itself. Its meta (or its document instance)\n// declares named needs against registered loaders; the page walks its repaired\n// tree, collects them, DEDUPES identical (loader, params) pairs, resolves them\n// concurrently through the ShopProvider port, and hands the results down by\n// context. Two product rails asking the same question cost one provider call —\n// and, because the needs are known before render, a server can resolve the\n// same set ahead of time, which is the SSR prerequisite L4 calls out.\n//\n// Failure semantics follow the M2 error-boundary contract (I7): one failing\n// loader marks ONE entry as errored and never touches the rest of the page.\n// A block whose data errored renders null for shoppers and an error card in\n// dev/admin (BlockDataError), exactly like a block that crashed.\n// ---------------------------------------------------------------------------\n\nexport type PageDataStatus = 'idle' | 'loading' | 'ready' | 'error'\n\nexport interface PageDataEntry {\n status: 'loading' | 'ready' | 'error'\n data?: unknown\n error?: string\n}\n\n/** One collected, binding-resolved, deduped need. */\nexport interface PageDataNeed {\n key: string\n loader: string\n params: Record<string, unknown>\n}\n\n// --- Binding resolution -------------------------------------------------------\n\n/**\n * Resolve a declared need's param bindings against the page's route params and\n * the declaring block's props (setting defaults filled in, so the declaration\n * and the rendered block agree on unset props). A binding that resolves to\n * `undefined` drops its param — dataNeedKey drops undefined anyway, so the\n * declared need and a hook asking with explicit `undefined`s share a key.\n */\nexport function resolveDataParams(\n need: BlockDataNeed,\n context: { params: Record<string, string>; props: Record<string, unknown> },\n): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const [name, value] of Object.entries(need.params ?? {})) {\n let resolved: unknown = value\n if (isLoaderParamRef(value)) resolved = context.params[value.$param]\n else if (isLoaderPropRef(value)) resolved = context.props[value.$prop]\n if (resolved !== undefined) out[name] = resolved\n }\n return out\n}\n\n/** A block's effective needs: the meta declaration with the document\n * instance's `data` merged over it by need name. */\nfunction needsForNode(node: BlockNode): Record<string, BlockDataNeed> {\n const meta = getBlockMeta(node.type)\n return { ...meta?.data, ...node.data }\n}\n\n/**\n * Walk a block tree (children included) and collect every declared need,\n * bindings resolved, deduped by canonical (loader, params) key.\n */\nexport function collectDataNeeds(\n nodes: readonly BlockNode[],\n routeParams: Record<string, string> = {},\n): PageDataNeed[] {\n const found = new Map<string, PageDataNeed>()\n const visit = (node: BlockNode): void => {\n const meta = getBlockMeta(node.type)\n const needs = needsForNode(node)\n if (Object.keys(needs).length > 0) {\n const props = { ...defaultPropsFromSettings(meta?.settings), ...node.props }\n for (const need of Object.values(needs)) {\n if (!need || typeof need.loader !== 'string' || !need.loader) continue\n const params = resolveDataParams(need, { params: routeParams, props })\n const key = dataNeedKey(need.loader, params)\n if (!found.has(key)) found.set(key, { key, loader: need.loader, params })\n }\n }\n for (const child of node.children ?? []) visit(child)\n }\n for (const node of nodes) visit(node)\n return [...found.values()]\n}\n\n// --- Resolution ---------------------------------------------------------------\n\n/** Resolve ONE need through the provider port. Never throws: an unknown\n * loader or a failing read becomes an 'error' entry for that need alone. */\nexport async function resolvePageDataNeed(need: Pick<PageDataNeed, 'loader' | 'params'>): Promise<PageDataEntry> {\n try {\n const impl = resolveLoader(need.loader)\n const data = await impl(need.params, { shop: getShopProvider() })\n return { status: 'ready', data }\n } catch (err) {\n const message = errorMessage(err)\n // Always log — a store hitting this in production is better off with the\n // reason in the console than without it (same policy as BlockErrorBoundary).\n console.error(`[storefront] loader \"${need.loader}\" failed:`, err)\n return { status: 'error', error: message }\n }\n}\n\n/** Resolve a set of needs concurrently, isolated per need. Test seam and the\n * future server-side entry point — the scope component uses the same calls. */\nexport async function resolvePageData(\n needs: readonly PageDataNeed[],\n): Promise<Record<string, PageDataEntry>> {\n const settled = await Promise.all(\n needs.map(async (need) => [need.key, await resolvePageDataNeed(need)] as const),\n )\n return Object.fromEntries(settled)\n}\n\n// --- The scope ----------------------------------------------------------------\n\ninterface PageDataContextValue {\n entries: Record<string, PageDataEntry>\n /** The route params this scope resolved `$param` bindings against — the same\n * ones a consuming block must use, or its key would diverge. */\n params: Record<string, string>\n}\n\nconst PageDataContext = createContext<PageDataContextValue | null>(null)\n\nexport interface PageDataScopeProps {\n nodes: readonly BlockNode[]\n /** Route params the tree's `$param` bindings resolve against. */\n params?: Record<string, string>\n /**\n * Pre-resolved entries, keyed by dataNeedKey — the server-side/static-render\n * seam (L4): `resolvePageData(collectDataNeeds(nodes))` ahead of render,\n * then hand the results in. Keys already 'ready' here are never re-fetched;\n * anything missing resolves client-side as usual.\n *\n * Live, not mount-only: a host whose shell outlives the page (every real\n * one — the shell must not remount on navigation) hands in a NEW object\n * for each page it loads, and a child scope mounting in that same commit\n * sees it. Pass a stable reference per page (the loader's result), not a\n * literal built in render.\n */\n initial?: Record<string, PageDataEntry>\n children: React.ReactNode\n}\n\n/**\n * Collects and resolves the data needs of one block tree, and provides the\n * results. Scopes nest (a slot inside a page): a child scope reuses every\n * entry an ancestor already resolved and only fetches its own remainder, so\n * dedupe holds across the whole rendered page, not per tree.\n */\nexport function PageDataScope({ nodes, params, initial, children }: PageDataScopeProps) {\n const parent = useContext(PageDataContext)\n const routeParams = useMemo(() => params ?? parent?.params ?? {}, [params, parent])\n const needs = useMemo(() => collectDataNeeds(nodes, routeParams), [nodes, routeParams])\n const own = useMemo(\n () => needs.filter((need) => !parent || !(need.key in parent.entries)),\n [needs, parent],\n )\n // A static render (renderStore) has no effects, so this scope reports what it\n // renders and what it would fetch, and reads back anything an earlier pass\n // already resolved. Null in the browser.\n const staticPass = currentStaticRenderPass()\n if (staticPass) {\n staticPass.tree(nodes)\n staticPass.needs(own)\n }\n\n // Seeded synchronously so the first render already shows 'loading' (or the\n // pre-resolved entry) for every owned key — a consuming block must never see\n // a gap and start its own fetch.\n const [entries, setEntries] = useState<Record<string, PageDataEntry>>(() => ({\n // Everything handed in is published, not only the needs THIS scope\n // collected. That is what lets a host framework resolve a page's data in\n // its own loader and wrap the shell in a seeding scope: the page's own\n // scope then finds those keys already answered on its parent and fetches\n // nothing. Without it, seeding only works when the seeding scope happens to\n // render the same block tree.\n ...initial,\n ...Object.fromEntries(\n own.map((need) => [\n need.key,\n initial?.[need.key] ?? staticPass?.entries[need.key] ?? ({ status: 'loading' } as PageDataEntry),\n ]),\n ),\n }))\n\n const signature = own.map((need) => need.key).join('\\n')\n useEffect(() => {\n // A key handed in ready stays authoritative; everything else resolves here.\n const pending = own.filter((need) => initial?.[need.key]?.status !== 'ready')\n if (pending.length === 0) return\n let cancelled = false\n setEntries((prev) => {\n const next = { ...prev }\n for (const need of pending) {\n if (next[need.key]?.status !== 'ready') next[need.key] = { status: 'loading' }\n }\n return next\n })\n for (const need of pending) {\n void resolvePageDataNeed(need).then((entry) => {\n if (!cancelled) setEntries((prev) => ({ ...prev, [need.key]: entry }))\n })\n }\n return () => {\n cancelled = true\n }\n // `own` is captured by its key signature: same keys = same needs.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [signature])\n\n // `initial` is overlaid at RENDER time, on top of what this scope resolved,\n // rather than folded into state once at mount. The difference is one\n // commit, and it is the whole point: after a client-side navigation the\n // host hands in the next page's entries and the next page's own scope\n // mounts in the same commit — it decides which needs are unanswered by\n // reading this value as it mounts. State would only carry the new entries\n // from the following commit, by which time the child has already started\n // fetching everything the host had just resolved, and the shopper watches\n // content that was ready pop in a second time.\n const value = useMemo<PageDataContextValue>(\n () => ({ entries: { ...parent?.entries, ...entries, ...initial }, params: routeParams }),\n [parent, entries, initial, routeParams],\n )\n return <PageDataContext.Provider value={value}>{children}</PageDataContext.Provider>\n}\n\n// --- Consumption --------------------------------------------------------------\n\nexport interface UseLoaderResult<T> {\n status: PageDataStatus\n data: T | null\n error: string | null\n /** Re-run the read (bypasses the page-resolved entry from then on). */\n reload: () => void\n}\n\n/**\n * A block's (or page's) read: `useLoader('products.list', { filter, limit })`.\n *\n * When a PageDataScope above already resolved the same (loader, params) pair —\n * because this block, or ANY block on the page, declared it — the resolved\n * entry is returned and no request is made. Otherwise the hook resolves the\n * loader itself, through the same provider port, so a component used outside a\n * composed page (a store's hand-written route) keeps working identically.\n * Pass `null` params to disable the read.\n */\nexport function useLoader<T>(\n loader: string,\n params: Record<string, unknown> | null,\n): UseLoaderResult<T> {\n const scope = useContext(PageDataContext)\n const key = params === null ? null : dataNeedKey(loader, params)\n const [nonce, setNonce] = useState(0)\n const scoped = nonce === 0 && key !== null && scope ? scope.entries[key] : undefined\n const [local, setLocal] = useState<{ key: string; entry: PageDataEntry } | null>(null)\n\n // Undeclared reads — a hand-written route calling the hook directly — still\n // resolve under a static render: the pass collects the key on the first pass\n // and serves it on the next. Without this, exactly the reads that no block\n // declared would be the ones missing from a headless render.\n const staticPass = currentStaticRenderPass()\n const staticEntry = staticPass && key !== null && scoped === undefined ? staticPass.entries[key] : undefined\n if (staticPass && key !== null && scoped === undefined && staticEntry === undefined) {\n staticPass.needs([{ key, loader, params: params! }])\n }\n\n const paramsKey = params === null ? null : JSON.stringify(params)\n useEffect(() => {\n if (key === null || scoped !== undefined) return\n let cancelled = false\n setLocal({ key, entry: { status: 'loading' } })\n void resolvePageDataNeed({ loader, params: params! }).then((entry) => {\n if (!cancelled) setLocal({ key, entry })\n })\n return () => {\n cancelled = true\n }\n // params identity travels through paramsKey; scoped presence through a boolean.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loader, paramsKey, nonce, scoped !== undefined])\n\n const entry =\n scoped ??\n staticEntry ??\n (local && local.key === key ? local.entry : key !== null ? { status: 'loading' as const } : null)\n\n return {\n status: entry?.status ?? 'idle',\n data: entry?.status === 'ready' ? (entry.data as T) : null,\n error: entry?.status === 'error' ? entry.error ?? 'unknown error' : null,\n reload: () => setNonce((n) => n + 1),\n }\n}\n\n/**\n * A BLOCK's named data need: `useBlockData(node, 'products', fallback)`.\n *\n * Reads the block's effective declaration — meta `data` with the document\n * instance's `data` merged over it — and resolves its bindings with the SAME\n * inputs the page resolver used (scope route params, node props over setting\n * defaults), so the two always compute the same key. That is what makes a\n * document able to rebind a param (`category: { $param: 'slug' }`) and have\n * the rendered block follow: the block asks for its declared need, not for a\n * hardcoded one.\n *\n * `fallback` covers the component being used directly as JSX (a store's\n * hand-written route), where there is no node and no declaration to read.\n */\nexport function useBlockData<T>(\n node: BlockNode | undefined,\n name: string,\n fallback: { loader: string; params: Record<string, unknown> },\n): UseLoaderResult<T> & { loader: string } {\n const scope = useContext(PageDataContext)\n let loader = fallback.loader\n let params = fallback.params\n if (node) {\n const need = needsForNode(node)[name]\n if (need && typeof need.loader === 'string' && need.loader) {\n const meta = getBlockMeta(node.type)\n loader = need.loader\n params = resolveDataParams(need, {\n params: scope?.params ?? {},\n props: { ...defaultPropsFromSettings(meta?.settings), ...node.props },\n })\n }\n }\n const result = useLoader<T>(loader, params)\n return { ...result, loader }\n}\n\n// --- Error surface ------------------------------------------------------------\n\n/**\n * What a block renders when its declared data failed: nothing for shoppers, a\n * visible card for builders — the same visibility rule as a crashed block\n * (M2's per-block error boundary, WooCommerce's `CURRENT_USER_IS_ADMIN ?\n * onError : () => null`).\n */\nexport function BlockDataError({ loader, message }: { loader: string; message?: string | null }) {\n if (getBlockErrorVisibility() === 'silent') return null\n return (\n <div\n data-block-error={`loader:${loader}`}\n style={{\n border: '1px dashed #dc2626',\n color: '#b91c1c',\n padding: '8px 12px',\n font: '12px ui-monospace, monospace',\n borderRadius: 6,\n }}\n >\n {`Data for this block failed (loader \"${loader}\")`}\n {message ? <div style={{ opacity: 0.8, marginTop: 4 }}>{message}</div> : null}\n </div>\n )\n}\n","import { checkBlockConstraints, checkBlockContext, getBlockMeta, isBlockEnabledOn } from '@fayz-ai/core'\nimport type { BlockDataNeeds, BlockNode } from '@fayz-ai/core'\nimport type { StorefrontSection } from './sections'\nimport type { StorefrontTheme } from '../lib/theme'\nimport { matchPath } from '../app/router'\n\n// ---------------------------------------------------------------------------\n// Pages as block trees.\n//\n// The home page has been a block tree since the registry landed. Every other\n// route was hand-written JSX, which is why a store that wanted a banner above\n// the catalog grid had only one move available: reimplement the catalog page.\n// One store did exactly that for three routes and stopped receiving SDK updates\n// for all three.\n//\n// What the benchmarks do, and what this adopts:\n//\n// Shopify templates/product.json lists sections, one of which is `main` —\n// the product form itself. A theme adds sections around `main`\n// without owning it.\n// VTEX IO store.product is a block array containing `product-details`.\n// Same idea, same reason.\n//\n// So the native page body becomes a block (`catalogBody`, `productBody`), and a\n// store composes around it. The body keeps being maintained by the SDK.\n//\n// One deliberate shape change: the general block form nests its props under\n// `props`, matching Shopify's `settings` and VTEX's `props`. The flat\n// StorefrontSection form stays supported — five of seven live stores write it —\n// but it is the outlier, and it is the reason the two stores with custom blocks\n// both had to write `sections: mySections as never`: a closed union cannot\n// describe a block the SDK has never heard of. Nesting fixes that without a cast.\n// ---------------------------------------------------------------------------\n\n/** Pages that are composed from blocks, and the `enabledOn` vocabulary.\n * `content` is the editorial kind: a titled page that is nothing but blocks —\n * no commerce body, no catalog assumptions. */\nexport type StorefrontPageKind = 'home' | 'catalog' | 'product' | 'collection' | 'content'\n\n/**\n * A block instance in a page tree — the general form.\n *\n * `id` matters more than it looks: two product rails on one page are\n * indistinguishable without it, so an external editor cannot target one of them\n * and an AI-generated diff cannot say which it changed. VTEX solved the same\n * problem with `rich-text#hero`; this is the same idea spelled as a field.\n */\nexport interface StorefrontBlockRef {\n /** Registered block id — an SDK section, a plugin block, or an app's own. */\n type: string\n id?: string\n props?: Record<string, unknown>\n children?: readonly StorefrontBlockRef[]\n /**\n * Instance-level data needs, merged over the block meta's `data` declaration\n * by need name — how a document points a block's loader at a route param\n * (`{ products: { loader: 'products.list', params: { category: { $param:\n * 'slug' } } } }`). Resolved once per page by the page-data scope.\n */\n data?: BlockDataNeeds\n}\n\n/**\n * What a page's block list accepts.\n *\n * The typed union keeps checking SDK sections (a bad `variant` is still a type\n * error); the open ref form is what lets an app place its own registered block\n * without casting.\n */\nexport type StorefrontBlockLike = StorefrontSection | StorefrontBlockRef\n\nexport interface StorefrontPageConfig {\n blocks: readonly StorefrontBlockLike[]\n}\n\n/**\n * An editorial page, expressible entirely in the document: a slug, a title, a\n * route, and blocks. This is the page kind that absorbs the \"brand site half\"\n * of a store — biography, philosophy, press, collections — which today lives\n * as hand-written custom routes (cristinarotondaro carries ~240 lines of them).\n *\n * The store chrome (header, footer, cart) still frames the page; what a\n * content page does NOT get is a commerce body block or any catalog\n * assumption. It is blocks all the way down.\n */\nexport interface StorefrontContentPageConfig extends StorefrontPageConfig {\n /** Document/page title (`<title>` gets \"<title> — <store>\"). Defaults to the slug. */\n title?: string\n /**\n * Route path. Defaults to `/<slug>`. May declare params (`/categoria/:slug`)\n * — one page then serves every match, and its blocks read the params through\n * `$param` loader bindings (M3). validateStore checks that every binding\n * names a param the path declares.\n */\n path?: string\n /**\n * Theme overlay applied ONLY inside this page, merged over the store theme.\n *\n * This is what makes a campaign page — a licensed line, a seasonal drop, a\n * collab — expressible as a content page instead of a microsite. Stores\n * routinely build those elsewhere and lose the funnel with them: the \"buy\"\n * CTA leaves for another domain and the cart, the session and the\n * attribution go with it.\n *\n * The overlay is emitted scoped to `[data-page=\"<slug>\"]`, so a hot-pink\n * summer drop cannot repaint the header, the cart drawer or any other route.\n * It merges key by key, so a page that sets only `colors.primary` keeps the\n * store's typography and every other token.\n */\n theme?: Partial<StorefrontTheme>\n}\n\n/**\n * Merge a page's theme overlay over the store theme.\n *\n * Nested groups merge rather than replace: a page declaring one colour must not\n * silently drop the store's fonts, radii and brand tokens back to SDK defaults.\n */\nexport function mergePageTheme(\n base: StorefrontTheme | undefined,\n overlay: Partial<StorefrontTheme> | undefined,\n): StorefrontTheme | undefined {\n if (!base && !overlay) return undefined\n if (!overlay) return base\n const name = overlay.name ?? (base ? `${base.name}-page` : 'page')\n const font = base?.font ? { ...base.font, ...overlay.font } : (overlay.font as StorefrontTheme['font'])\n return {\n ...base,\n ...overlay,\n name,\n colors: { ...base?.colors, ...overlay.colors },\n font,\n tokens: { ...base?.tokens, ...overlay.tokens },\n header: { ...base?.header, ...overlay.header },\n productCard: { ...base?.productCard, ...overlay.productCard },\n }\n}\n\n/** The wrapper attribute + selector a page's scoped theme is emitted under. */\nexport function pageThemeSelector(slug: string): string {\n return `[data-page=\"${slug}\"]`\n}\n\n/** The params a route path pattern declares ('/categoria/:slug' → ['slug']). */\nexport function routePathParams(path: string): string[] {\n return path\n .split('/')\n .filter((segment) => segment.startsWith(':'))\n .map((segment) => segment.slice(1))\n}\n\nexport interface StorefrontPagesConfig {\n home?: StorefrontPageConfig\n catalog?: StorefrontPageConfig\n product?: StorefrontPageConfig\n collection?: StorefrontPageConfig\n /** Editorial pages, keyed by slug. */\n content?: Record<string, StorefrontContentPageConfig>\n}\n\n/** Route path of one content page (explicit `path`, or `/<slug>`). */\nexport function contentPagePath(slug: string, page: StorefrontContentPageConfig): string {\n return page.path ?? `/${slug}`\n}\n\nexport interface ContentPageMatch {\n slug: string\n page: StorefrontContentPageConfig\n /** Params extracted from the page's path pattern, when it declares any. */\n params: Record<string, string>\n}\n\n/** The content page a path resolves to, if the store declared one. Paths are\n * patterns (`/categoria/:slug`), so one declared page can serve a family of\n * URLs and hand the matched params to its blocks' `$param` bindings. */\nexport function matchContentPage(\n pages: StorefrontPagesConfig | undefined,\n path: string,\n): ContentPageMatch | null {\n for (const [slug, page] of Object.entries(pages?.content ?? {})) {\n const params = matchPath(contentPagePath(slug, page), path)\n if (params) return { slug, page, params }\n }\n return null\n}\n\n/** Block ids for the native page bodies — Shopify's `main` section, by another name. */\nexport const CATALOG_BODY_BLOCK = 'catalogBody'\nexport const PRODUCT_BODY_BLOCK = 'productBody'\n\n/** The block that renders the page's own reason for existing, per page kind. */\nconst BODY_BLOCK_BY_KIND: Partial<Record<StorefrontPageKind, string>> = {\n catalog: CATALOG_BODY_BLOCK,\n product: PRODUCT_BODY_BLOCK,\n}\n\n/**\n * Keys that are block identity rather than props, in the nested form.\n *\n * Exported for the same reason `blockInstanceId` is: it must be ONE rule.\n * Whoever asks \"where do this block's settings live\" — the renderer here, the\n * editor via `blockAtPath`, the overlay's settings/structure guard — has to get\n * the same answer, or an edit an editor accepts is one the renderer ignores.\n */\nexport const BLOCK_STRUCTURAL_KEYS: ReadonlySet<string> = new Set([\n 'type',\n 'id',\n 'props',\n 'children',\n 'data',\n])\n\nconst STRUCTURAL_KEYS = BLOCK_STRUCTURAL_KEYS\n\n/**\n * Does this entry keep its settings under `props` (nested form) or inline on\n * the entry itself (flat form)?\n *\n * Both forms are first-class and they MIX inside one array — artorious's home\n * page is 3 nested and 5 flat — so nothing may assume the shape from the path\n * it took to get here.\n */\nexport function isNestedBlockRef(entry: unknown): boolean {\n return isNestedRef(entry as StorefrontBlockLike)\n}\n\nfunction isNestedRef(entry: StorefrontBlockLike): boolean {\n const record = entry as Record<string, unknown>\n // An explicit `props` settles it. Otherwise: an entry carrying nothing but\n // structural keys is a ref with no props (`{ type: 'seals' }`), which the flat\n // reading would also produce — so either branch is correct for that case.\n if ('props' in record) return true\n return Object.keys(record).every((key) => STRUCTURAL_KEYS.has(key))\n}\n\n/**\n * The id a block instance is known by: the authored `id`, or `<type>-<index>`\n * when it has none.\n *\n * Exported because it must be ONE rule. A block with no authored id still\n * reaches the outside world under its synthesized id — `renderStore` reports\n * it, an editor targets it, a generated diff names it — so `applyChange` has\n * to resolve `blocks[#banner-0]` to the same entry the renderer called\n * `banner-0`. Two implementations of this rule would make the id an agent is\n * handed by one ability unusable by another.\n */\nexport function blockInstanceId(entry: unknown, index: number): string {\n const record = entry as Record<string, unknown> | null\n if (record && typeof record.id === 'string' && record.id) return record.id\n return `${String(record?.type)}-${index}`\n}\n\n/**\n * Normalize one authored entry into a `BlockNode`.\n *\n * Both authoring forms collapse to the same node, so everything downstream —\n * the renderer, the editor, `describeBlocks` — sees one shape.\n */\nfunction toBlockNode(entry: StorefrontBlockLike, index: number): BlockNode {\n const record = entry as Record<string, unknown>\n const type = String(record.type)\n const id = blockInstanceId(entry, index)\n\n const data = record.data as BlockDataNeeds | undefined\n\n if (isNestedRef(entry)) {\n const children = (record.children as readonly StorefrontBlockRef[] | undefined) ?? []\n return {\n type,\n id,\n props: (record.props as Record<string, unknown> | undefined) ?? {},\n ...(children.length ? { children: children.map((child, i) => toBlockNode(child, i)) } : {}),\n ...(data ? { data } : {}),\n }\n }\n\n // Flat form: everything that is not identity is a prop.\n const props: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(record)) {\n if (!STRUCTURAL_KEYS.has(key)) props[key] = value\n }\n return { type, id, props, ...(data ? { data } : {}) }\n}\n\n/** Normalize an authored block list into the block tree the renderer consumes. */\nexport function toBlockNodes(blocks: readonly StorefrontBlockLike[]): BlockNode[] {\n return blocks.map(toBlockNode)\n}\n\n/**\n * The default tree for a page kind — what the SDK renders when a store has not\n * composed the page. For catalog and product that is the native body alone,\n * which is why adopting `pages` is a no-op until a store adds something.\n */\nexport function defaultPageBlocks(kind: StorefrontPageKind): BlockNode[] {\n const body = BODY_BLOCK_BY_KIND[kind]\n return body ? [{ type: body, id: body, props: {} }] : []\n}\n\nexport interface PageBlockDiagnostic {\n level: 'error' | 'warning'\n rule: string\n detail: string\n}\n\n/**\n * Diagnostics for one composed page.\n *\n * These are reported, not enforced. A store in production must not go blank\n * because a block was placed on a page its author did not anticipate — so the\n * hard stop belongs in the editor (which reads the same `enabledOn` through\n * `describeBlocks`), and this is the development-time equivalent.\n */\nexport function checkPageBlocks(kind: StorefrontPageKind, nodes: readonly BlockNode[]): PageBlockDiagnostic[] {\n const found: PageBlockDiagnostic[] = []\n const seenIds = new Set<string>()\n const expectedBody = BODY_BLOCK_BY_KIND[kind]\n let hasBody = false\n\n for (const node of nodes) {\n if (node.type === expectedBody) hasBody = true\n\n if (node.id) {\n if (seenIds.has(node.id)) {\n found.push({\n level: 'warning',\n rule: 'duplicate-block-id',\n detail: `two blocks on the ${kind} page share the id \"${node.id}\" — an editor or a generated diff cannot tell them apart`,\n })\n }\n seenIds.add(node.id)\n }\n\n const meta = getBlockMeta(node.type)\n if (!meta) {\n found.push({\n level: 'error',\n rule: 'unknown-block',\n detail: `the ${kind} page references block \"${node.type}\", which is not registered — register it before the storefront mounts`,\n })\n continue\n }\n if (!isBlockEnabledOn({ enabledOn: meta.enabledOn ?? [] }, kind)) {\n found.push({\n level: 'warning',\n rule: 'block-not-enabled-on-page',\n detail: `block \"${node.type}\" declares enabledOn [${(meta.enabledOn ?? []).join(', ')}] and is placed on the ${kind} page`,\n })\n }\n }\n\n if (expectedBody && !hasBody) {\n // Shopify hard-requires the `main` section in a template for this reason. We\n // warn instead of inserting it, because silently adding a block the config\n // does not mention makes the config a lie — and a fully bespoke catalog is a\n // legitimate thing to build.\n found.push({\n level: 'warning',\n rule: 'missing-page-body',\n detail: `the ${kind} page tree omits \"${expectedBody}\", so the page renders no ${kind === 'product' ? 'product detail' : 'product list'} — add it back unless the replacement is deliberate`,\n })\n }\n\n // Composition constraints, for pages composed in code: a document goes\n // through validateStore, but a TS config never does, so the same structural\n // rules are reported here. Errors, because the renderer will keep these\n // blocks off the shopper's page (I7) — the composition already lies.\n for (const violation of checkBlockConstraints(nodes)) {\n found.push({\n level: 'error',\n rule: violation.rule,\n detail: `${kind} page ${violation.path}: ${violation.detail}`,\n })\n }\n\n // Context is advisory: the key may arrive through a runtime channel a static\n // tree cannot see (a slot area, a future loader), so the honest verdict is\n // \"nothing declares this\", not \"this is broken\".\n for (const finding of checkBlockContext(nodes)) {\n found.push({\n level: 'warning',\n rule: 'context-not-provided',\n detail: `block \"${finding.type}\" at ${kind} page ${finding.path} uses context [${finding.missing.join(', ')}] that no ancestor provides`,\n })\n }\n\n return found\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/blocks/page-data.tsx","../src/blocks/page-blocks.ts"],"names":["entry","getBlockMeta"],"mappings":";;;;;;AAwDO,SAAS,iBAAA,CACd,MACA,OAAA,EACyB;AACzB,EAAA,MAAM,MAA+B,EAAC;AACtC,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,KAAK,CAAA,IAAK,MAAA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AK;AAAA,MACT,KAAA,EAAO,OAAA;AAAA,MACP,MAAM,SAAA,CAAU,IAAA;AAAA,MAChB,MAAA,EAAQ,GAAG,IAAI,CAAA,MAAA,EAAS,UAAU,IAAI,CAAA,EAAA,EAAK,UAAU,MAAM,CAAA;AAAA,KAC5D,CAAA;AAAA,EACH;AAKA,EAAA,KAAA,MAAW,OAAA,IAAW,iBAAA,CAAkB,KAAK,CAAA,EAAG;AAC9C,IAAA,KAAA,CAAM,IAAA,CAAK;AAAA,MACT,KAAA,EAAO,SAAA;AAAA,MACP,IAAA,EAAM,sBAAA;AAAA,MACN,MAAA,EAAQ,CAAA,OAAA,EAAU,OAAA,CAAQ,IAAI,QAAQ,IAAI,CAAA,MAAA,EAAS,OAAA,CAAQ,IAAI,CAAA,eAAA,EAAkB,OAAA,CAAQ,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAC,CAAA,2BAAA;AAAA,KAC5G,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,KAAA;AACT","file":"chunk-GLLGH7FO.js","sourcesContent":["import { errorMessage } from '@fayz-ai/core'\nimport React, { createContext, useContext, useEffect, useMemo, useState } from 'react'\nimport {\n dataNeedKey,\n defaultPropsFromSettings,\n getBlockErrorVisibility,\n getBlockMeta,\n isLoaderParamRef,\n isLoaderPropRef,\n resolveLoader,\n} from '@fayz-ai/core'\nimport type { BlockDataNeed, BlockNode } from '@fayz-ai/core'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport { currentStaticRenderPass } from '../app/static-render'\n\n// ---------------------------------------------------------------------------\n// Page data — declared needs, resolved once per page (spine M3, I11).\n//\n// A block never fetches for itself. Its meta (or its document instance)\n// declares named needs against registered loaders; the page walks its repaired\n// tree, collects them, DEDUPES identical (loader, params) pairs, resolves them\n// concurrently through the ShopProvider port, and hands the results down by\n// context. Two product rails asking the same question cost one provider call —\n// and, because the needs are known before render, a server can resolve the\n// same set ahead of time, which is the SSR prerequisite L4 calls out.\n//\n// Failure semantics follow the M2 error-boundary contract (I7): one failing\n// loader marks ONE entry as errored and never touches the rest of the page.\n// A block whose data errored renders null for shoppers and an error card in\n// dev/admin (BlockDataError), exactly like a block that crashed.\n// ---------------------------------------------------------------------------\n\nexport type PageDataStatus = 'idle' | 'loading' | 'ready' | 'error'\n\nexport interface PageDataEntry {\n status: 'loading' | 'ready' | 'error'\n data?: unknown\n error?: string\n}\n\n/** One collected, binding-resolved, deduped need. */\nexport interface PageDataNeed {\n key: string\n loader: string\n params: Record<string, unknown>\n}\n\n// --- Binding resolution -------------------------------------------------------\n\n/**\n * Resolve a declared need's param bindings against the page's route params and\n * the declaring block's props (setting defaults filled in, so the declaration\n * and the rendered block agree on unset props). A binding that resolves to\n * `undefined` drops its param — dataNeedKey drops undefined anyway, so the\n * declared need and a hook asking with explicit `undefined`s share a key.\n */\nexport function resolveDataParams(\n need: BlockDataNeed,\n context: { params: Record<string, string>; props: Record<string, unknown> },\n): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const [name, value] of Object.entries(need.params ?? {})) {\n let resolved: unknown = value\n if (isLoaderParamRef(value)) resolved = context.params[value.$param]\n else if (isLoaderPropRef(value)) resolved = context.props[value.$prop]\n if (resolved !== undefined) out[name] = resolved\n }\n return out\n}\n\n/** A block's effective needs: the meta declaration with the document\n * instance's `data` merged over it by need name. */\nfunction needsForNode(node: BlockNode): Record<string, BlockDataNeed> {\n const meta = getBlockMeta(node.type)\n return { ...meta?.data, ...node.data }\n}\n\n/**\n * Walk a block tree (children included) and collect every declared need,\n * bindings resolved, deduped by canonical (loader, params) key.\n */\nexport function collectDataNeeds(\n nodes: readonly BlockNode[],\n routeParams: Record<string, string> = {},\n): PageDataNeed[] {\n const found = new Map<string, PageDataNeed>()\n const visit = (node: BlockNode): void => {\n const meta = getBlockMeta(node.type)\n const needs = needsForNode(node)\n if (Object.keys(needs).length > 0) {\n const props = { ...defaultPropsFromSettings(meta?.settings), ...node.props }\n for (const need of Object.values(needs)) {\n if (!need || typeof need.loader !== 'string' || !need.loader) continue\n const params = resolveDataParams(need, { params: routeParams, props })\n const key = dataNeedKey(need.loader, params)\n if (!found.has(key)) found.set(key, { key, loader: need.loader, params })\n }\n }\n for (const child of node.children ?? []) visit(child)\n }\n for (const node of nodes) visit(node)\n return [...found.values()]\n}\n\n// --- Resolution ---------------------------------------------------------------\n\n/** Resolve ONE need through the provider port. Never throws: an unknown\n * loader or a failing read becomes an 'error' entry for that need alone. */\nexport async function resolvePageDataNeed(need: Pick<PageDataNeed, 'loader' | 'params'>): Promise<PageDataEntry> {\n try {\n const impl = resolveLoader(need.loader)\n const data = await impl(need.params, { shop: getShopProvider() })\n return { status: 'ready', data }\n } catch (err) {\n const message = errorMessage(err)\n // Always log — a store hitting this in production is better off with the\n // reason in the console than without it (same policy as BlockErrorBoundary).\n console.error(`[storefront] loader \"${need.loader}\" failed:`, err)\n return { status: 'error', error: message }\n }\n}\n\n/** Resolve a set of needs concurrently, isolated per need. Test seam and the\n * future server-side entry point — the scope component uses the same calls. */\nexport async function resolvePageData(\n needs: readonly PageDataNeed[],\n): Promise<Record<string, PageDataEntry>> {\n const settled = await Promise.all(\n needs.map(async (need) => [need.key, await resolvePageDataNeed(need)] as const),\n )\n return Object.fromEntries(settled)\n}\n\n// --- The scope ----------------------------------------------------------------\n\ninterface PageDataContextValue {\n entries: Record<string, PageDataEntry>\n /** The route params this scope resolved `$param` bindings against — the same\n * ones a consuming block must use, or its key would diverge. */\n params: Record<string, string>\n}\n\nconst PageDataContext = createContext<PageDataContextValue | null>(null)\n\nexport interface PageDataScopeProps {\n nodes: readonly BlockNode[]\n /** Route params the tree's `$param` bindings resolve against. */\n params?: Record<string, string>\n /**\n * Pre-resolved entries, keyed by dataNeedKey — the server-side/static-render\n * seam (L4): `resolvePageData(collectDataNeeds(nodes))` ahead of render,\n * then hand the results in. Keys already 'ready' here are never re-fetched;\n * anything missing resolves client-side as usual.\n *\n * Live, not mount-only: a host whose shell outlives the page (every real\n * one — the shell must not remount on navigation) hands in a NEW object\n * for each page it loads, and a child scope mounting in that same commit\n * sees it. Pass a stable reference per page (the loader's result), not a\n * literal built in render.\n */\n initial?: Record<string, PageDataEntry>\n children: React.ReactNode\n}\n\n/**\n * Collects and resolves the data needs of one block tree, and provides the\n * results. Scopes nest (a slot inside a page): a child scope reuses every\n * entry an ancestor already resolved and only fetches its own remainder, so\n * dedupe holds across the whole rendered page, not per tree.\n */\nexport function PageDataScope({ nodes, params, initial, children }: PageDataScopeProps) {\n const parent = useContext(PageDataContext)\n const routeParams = useMemo(() => params ?? parent?.params ?? {}, [params, parent])\n const needs = useMemo(() => collectDataNeeds(nodes, routeParams), [nodes, routeParams])\n const own = useMemo(\n () => needs.filter((need) => !parent || !(need.key in parent.entries)),\n [needs, parent],\n )\n // A static render (renderStore) has no effects, so this scope reports what it\n // renders and what it would fetch, and reads back anything an earlier pass\n // already resolved. Null in the browser.\n const staticPass = currentStaticRenderPass()\n if (staticPass) {\n staticPass.tree(nodes)\n staticPass.needs(own)\n }\n\n // Seeded synchronously so the first render already shows 'loading' (or the\n // pre-resolved entry) for every owned key — a consuming block must never see\n // a gap and start its own fetch.\n const [entries, setEntries] = useState<Record<string, PageDataEntry>>(() => ({\n // Everything handed in is published, not only the needs THIS scope\n // collected. That is what lets a host framework resolve a page's data in\n // its own loader and wrap the shell in a seeding scope: the page's own\n // scope then finds those keys already answered on its parent and fetches\n // nothing. Without it, seeding only works when the seeding scope happens to\n // render the same block tree.\n ...initial,\n ...Object.fromEntries(\n own.map((need) => [\n need.key,\n initial?.[need.key] ?? staticPass?.entries[need.key] ?? ({ status: 'loading' } as PageDataEntry),\n ]),\n ),\n }))\n\n const signature = own.map((need) => need.key).join('\\n')\n useEffect(() => {\n // A key handed in ready stays authoritative; everything else resolves here.\n const pending = own.filter((need) => initial?.[need.key]?.status !== 'ready')\n if (pending.length === 0) return\n let cancelled = false\n setEntries((prev) => {\n const next = { ...prev }\n for (const need of pending) {\n if (next[need.key]?.status !== 'ready') next[need.key] = { status: 'loading' }\n }\n return next\n })\n for (const need of pending) {\n void resolvePageDataNeed(need).then((entry) => {\n if (!cancelled) setEntries((prev) => ({ ...prev, [need.key]: entry }))\n })\n }\n return () => {\n cancelled = true\n }\n // `own` is captured by its key signature: same keys = same needs.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [signature])\n\n // `initial` is overlaid at RENDER time, on top of what this scope resolved,\n // rather than folded into state once at mount. The difference is one\n // commit, and it is the whole point: after a client-side navigation the\n // host hands in the next page's entries and the next page's own scope\n // mounts in the same commit — it decides which needs are unanswered by\n // reading this value as it mounts. State would only carry the new entries\n // from the following commit, by which time the child has already started\n // fetching everything the host had just resolved, and the shopper watches\n // content that was ready pop in a second time.\n const value = useMemo<PageDataContextValue>(\n () => ({ entries: { ...parent?.entries, ...entries, ...initial }, params: routeParams }),\n [parent, entries, initial, routeParams],\n )\n return <PageDataContext.Provider value={value}>{children}</PageDataContext.Provider>\n}\n\n// --- Consumption --------------------------------------------------------------\n\nexport interface UseLoaderResult<T> {\n status: PageDataStatus\n data: T | null\n error: string | null\n /** Re-run the read (bypasses the page-resolved entry from then on). */\n reload: () => void\n}\n\n/**\n * A block's (or page's) read: `useLoader('products.list', { filter, limit })`.\n *\n * When a PageDataScope above already resolved the same (loader, params) pair —\n * because this block, or ANY block on the page, declared it — the resolved\n * entry is returned and no request is made. Otherwise the hook resolves the\n * loader itself, through the same provider port, so a component used outside a\n * composed page (a store's hand-written route) keeps working identically.\n * Pass `null` params to disable the read.\n */\nexport function useLoader<T>(\n loader: string,\n params: Record<string, unknown> | null,\n): UseLoaderResult<T> {\n const scope = useContext(PageDataContext)\n const key = params === null ? null : dataNeedKey(loader, params)\n const [nonce, setNonce] = useState(0)\n const scoped = nonce === 0 && key !== null && scope ? scope.entries[key] : undefined\n const [local, setLocal] = useState<{ key: string; entry: PageDataEntry } | null>(null)\n\n // Undeclared reads — a hand-written route calling the hook directly — still\n // resolve under a static render: the pass collects the key on the first pass\n // and serves it on the next. Without this, exactly the reads that no block\n // declared would be the ones missing from a headless render.\n const staticPass = currentStaticRenderPass()\n const staticEntry = staticPass && key !== null && scoped === undefined ? staticPass.entries[key] : undefined\n if (staticPass && key !== null && scoped === undefined && staticEntry === undefined) {\n staticPass.needs([{ key, loader, params: params! }])\n }\n\n const paramsKey = params === null ? null : JSON.stringify(params)\n useEffect(() => {\n if (key === null || scoped !== undefined) return\n let cancelled = false\n setLocal({ key, entry: { status: 'loading' } })\n void resolvePageDataNeed({ loader, params: params! }).then((entry) => {\n if (!cancelled) setLocal({ key, entry })\n })\n return () => {\n cancelled = true\n }\n // params identity travels through paramsKey; scoped presence through a boolean.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loader, paramsKey, nonce, scoped !== undefined])\n\n const entry =\n scoped ??\n staticEntry ??\n (local && local.key === key ? local.entry : key !== null ? { status: 'loading' as const } : null)\n\n return {\n status: entry?.status ?? 'idle',\n data: entry?.status === 'ready' ? (entry.data as T) : null,\n error: entry?.status === 'error' ? entry.error ?? 'unknown error' : null,\n reload: () => setNonce((n) => n + 1),\n }\n}\n\n/**\n * A BLOCK's named data need: `useBlockData(node, 'products', fallback)`.\n *\n * Reads the block's effective declaration — meta `data` with the document\n * instance's `data` merged over it — and resolves its bindings with the SAME\n * inputs the page resolver used (scope route params, node props over setting\n * defaults), so the two always compute the same key. That is what makes a\n * document able to rebind a param (`category: { $param: 'slug' }`) and have\n * the rendered block follow: the block asks for its declared need, not for a\n * hardcoded one.\n *\n * `fallback` covers the component being used directly as JSX (a store's\n * hand-written route), where there is no node and no declaration to read.\n */\nexport function useBlockData<T>(\n node: BlockNode | undefined,\n name: string,\n fallback: { loader: string; params: Record<string, unknown> },\n): UseLoaderResult<T> & { loader: string } {\n const scope = useContext(PageDataContext)\n let loader = fallback.loader\n let params = fallback.params\n if (node) {\n const need = needsForNode(node)[name]\n if (need && typeof need.loader === 'string' && need.loader) {\n const meta = getBlockMeta(node.type)\n loader = need.loader\n params = resolveDataParams(need, {\n params: scope?.params ?? {},\n props: { ...defaultPropsFromSettings(meta?.settings), ...node.props },\n })\n }\n }\n const result = useLoader<T>(loader, params)\n return { ...result, loader }\n}\n\n// --- Error surface ------------------------------------------------------------\n\n/**\n * What a block renders when its declared data failed: nothing for shoppers, a\n * visible card for builders — the same visibility rule as a crashed block\n * (M2's per-block error boundary, WooCommerce's `CURRENT_USER_IS_ADMIN ?\n * onError : () => null`).\n */\nexport function BlockDataError({ loader, message }: { loader: string; message?: string | null }) {\n if (getBlockErrorVisibility() === 'silent') return null\n return (\n <div\n data-block-error={`loader:${loader}`}\n style={{\n border: '1px dashed #dc2626',\n color: '#b91c1c',\n padding: '8px 12px',\n font: '12px ui-monospace, monospace',\n borderRadius: 6,\n }}\n >\n {`Data for this block failed (loader \"${loader}\")`}\n {message ? <div style={{ opacity: 0.8, marginTop: 4 }}>{message}</div> : null}\n </div>\n )\n}\n","import { checkBlockConstraints, checkBlockContext, getBlockMeta, isBlockEnabledOn } from '@fayz-ai/core'\nimport type { BlockDataNeeds, BlockNode } from '@fayz-ai/core'\nimport type { StorefrontSection } from './sections'\nimport type { StorefrontTheme } from '../lib/theme'\nimport { matchPath } from '../app/router'\n\n// ---------------------------------------------------------------------------\n// Pages as block trees.\n//\n// The home page has been a block tree since the registry landed. Every other\n// route was hand-written JSX, which is why a store that wanted a banner above\n// the catalog grid had only one move available: reimplement the catalog page.\n// One store did exactly that for three routes and stopped receiving SDK updates\n// for all three.\n//\n// What the benchmarks do, and what this adopts:\n//\n// Shopify templates/product.json lists sections, one of which is `main` —\n// the product form itself. A theme adds sections around `main`\n// without owning it.\n// VTEX IO store.product is a block array containing `product-details`.\n// Same idea, same reason.\n//\n// So the native page body becomes a block (`catalogBody`, `productBody`), and a\n// store composes around it. The body keeps being maintained by the SDK.\n//\n// One deliberate shape change: the general block form nests its props under\n// `props`, matching Shopify's `settings` and VTEX's `props`. The flat\n// StorefrontSection form stays supported — five of seven live stores write it —\n// but it is the outlier, and it is the reason the two stores with custom blocks\n// both had to write `sections: mySections as never`: a closed union cannot\n// describe a block the SDK has never heard of. Nesting fixes that without a cast.\n// ---------------------------------------------------------------------------\n\n/** Pages that are composed from blocks, and the `enabledOn` vocabulary.\n * `content` is the editorial kind: a titled page that is nothing but blocks —\n * no commerce body, no catalog assumptions. */\nexport type StorefrontPageKind = 'home' | 'catalog' | 'product' | 'collection' | 'content'\n\n/**\n * A block instance in a page tree — the general form.\n *\n * `id` matters more than it looks: two product rails on one page are\n * indistinguishable without it, so an external editor cannot target one of them\n * and an AI-generated diff cannot say which it changed. VTEX solved the same\n * problem with `rich-text#hero`; this is the same idea spelled as a field.\n */\nexport interface StorefrontBlockRef {\n /** Registered block id — an SDK section, a plugin block, or an app's own. */\n type: string\n id?: string\n props?: Record<string, unknown>\n children?: readonly StorefrontBlockRef[]\n /**\n * Instance-level data needs, merged over the block meta's `data` declaration\n * by need name — how a document points a block's loader at a route param\n * (`{ products: { loader: 'products.list', params: { category: { $param:\n * 'slug' } } } }`). Resolved once per page by the page-data scope.\n */\n data?: BlockDataNeeds\n}\n\n/**\n * What a page's block list accepts.\n *\n * The typed union keeps checking SDK sections (a bad `variant` is still a type\n * error); the open ref form is what lets an app place its own registered block\n * without casting.\n */\nexport type StorefrontBlockLike = StorefrontSection | StorefrontBlockRef\n\nexport interface StorefrontPageConfig {\n blocks: readonly StorefrontBlockLike[]\n}\n\n/**\n * An editorial page, expressible entirely in the document: a slug, a title, a\n * route, and blocks. This is the page kind that absorbs the \"brand site half\"\n * of a store — biography, philosophy, press, collections — which today lives\n * as hand-written custom routes (cristinarotondaro carries ~240 lines of them).\n *\n * The store chrome (header, footer, cart) still frames the page; what a\n * content page does NOT get is a commerce body block or any catalog\n * assumption. It is blocks all the way down.\n */\nexport interface StorefrontContentPageConfig extends StorefrontPageConfig {\n /** Document/page title (`<title>` gets \"<title> — <store>\"). Defaults to the slug. */\n title?: string\n /**\n * Route path. Defaults to `/<slug>`. May declare params (`/categoria/:slug`)\n * — one page then serves every match, and its blocks read the params through\n * `$param` loader bindings (M3). validateStore checks that every binding\n * names a param the path declares.\n */\n path?: string\n /**\n * Theme overlay applied ONLY inside this page, merged over the store theme.\n *\n * This is what makes a campaign page — a licensed line, a seasonal drop, a\n * collab — expressible as a content page instead of a microsite. Stores\n * routinely build those elsewhere and lose the funnel with them: the \"buy\"\n * CTA leaves for another domain and the cart, the session and the\n * attribution go with it.\n *\n * The overlay is emitted scoped to `[data-page=\"<slug>\"]`, so a hot-pink\n * summer drop cannot repaint the header, the cart drawer or any other route.\n * It merges key by key, so a page that sets only `colors.primary` keeps the\n * store's typography and every other token.\n */\n theme?: Partial<StorefrontTheme>\n}\n\n/**\n * Merge a page's theme overlay over the store theme.\n *\n * Nested groups merge rather than replace: a page declaring one colour must not\n * silently drop the store's fonts, radii and brand tokens back to SDK defaults.\n */\nexport function mergePageTheme(\n base: StorefrontTheme | undefined,\n overlay: Partial<StorefrontTheme> | undefined,\n): StorefrontTheme | undefined {\n if (!base && !overlay) return undefined\n if (!overlay) return base\n const name = overlay.name ?? (base ? `${base.name}-page` : 'page')\n const font = base?.font ? { ...base.font, ...overlay.font } : (overlay.font as StorefrontTheme['font'])\n return {\n ...base,\n ...overlay,\n name,\n colors: { ...base?.colors, ...overlay.colors },\n font,\n tokens: { ...base?.tokens, ...overlay.tokens },\n header: { ...base?.header, ...overlay.header },\n productCard: { ...base?.productCard, ...overlay.productCard },\n }\n}\n\n/** The wrapper attribute + selector a page's scoped theme is emitted under. */\nexport function pageThemeSelector(slug: string): string {\n return `[data-page=\"${slug}\"]`\n}\n\n/** The params a route path pattern declares ('/categoria/:slug' → ['slug']). */\nexport function routePathParams(path: string): string[] {\n return path\n .split('/')\n .filter((segment) => segment.startsWith(':'))\n .map((segment) => segment.slice(1))\n}\n\nexport interface StorefrontPagesConfig {\n home?: StorefrontPageConfig\n catalog?: StorefrontPageConfig\n product?: StorefrontPageConfig\n collection?: StorefrontPageConfig\n /** Editorial pages, keyed by slug. */\n content?: Record<string, StorefrontContentPageConfig>\n}\n\n/** Route path of one content page (explicit `path`, or `/<slug>`). */\nexport function contentPagePath(slug: string, page: StorefrontContentPageConfig): string {\n return page.path ?? `/${slug}`\n}\n\nexport interface ContentPageMatch {\n slug: string\n page: StorefrontContentPageConfig\n /** Params extracted from the page's path pattern, when it declares any. */\n params: Record<string, string>\n}\n\n/** The content page a path resolves to, if the store declared one. Paths are\n * patterns (`/categoria/:slug`), so one declared page can serve a family of\n * URLs and hand the matched params to its blocks' `$param` bindings. */\nexport function matchContentPage(\n pages: StorefrontPagesConfig | undefined,\n path: string,\n): ContentPageMatch | null {\n for (const [slug, page] of Object.entries(pages?.content ?? {})) {\n const params = matchPath(contentPagePath(slug, page), path)\n if (params) return { slug, page, params }\n }\n return null\n}\n\n/** Block ids for the native page bodies — Shopify's `main` section, by another name. */\nexport const CATALOG_BODY_BLOCK = 'catalogBody'\nexport const PRODUCT_BODY_BLOCK = 'productBody'\n\n/** The block that renders the page's own reason for existing, per page kind. */\nconst BODY_BLOCK_BY_KIND: Partial<Record<StorefrontPageKind, string>> = {\n catalog: CATALOG_BODY_BLOCK,\n product: PRODUCT_BODY_BLOCK,\n}\n\n/**\n * Keys that are block identity rather than props, in the nested form.\n *\n * Exported for the same reason `blockInstanceId` is: it must be ONE rule.\n * Whoever asks \"where do this block's settings live\" — the renderer here, the\n * editor via `blockAtPath`, the overlay's settings/structure guard — has to get\n * the same answer, or an edit an editor accepts is one the renderer ignores.\n */\nexport const BLOCK_STRUCTURAL_KEYS: ReadonlySet<string> = new Set([\n 'type',\n 'id',\n 'props',\n 'children',\n 'data',\n])\n\nconst STRUCTURAL_KEYS = BLOCK_STRUCTURAL_KEYS\n\n/**\n * Does this entry keep its settings under `props` (nested form) or inline on\n * the entry itself (flat form)?\n *\n * Both forms are first-class and they MIX inside one array — artorious's home\n * page is 3 nested and 5 flat — so nothing may assume the shape from the path\n * it took to get here.\n */\nexport function isNestedBlockRef(entry: unknown): boolean {\n return isNestedRef(entry as StorefrontBlockLike)\n}\n\nfunction isNestedRef(entry: StorefrontBlockLike): boolean {\n const record = entry as Record<string, unknown>\n // An explicit `props` settles it. Otherwise: an entry carrying nothing but\n // structural keys is a ref with no props (`{ type: 'seals' }`), which the flat\n // reading would also produce — so either branch is correct for that case.\n if ('props' in record) return true\n return Object.keys(record).every((key) => STRUCTURAL_KEYS.has(key))\n}\n\n/**\n * The id a block instance is known by: the authored `id`, or `<type>-<index>`\n * when it has none.\n *\n * Exported because it must be ONE rule. A block with no authored id still\n * reaches the outside world under its synthesized id — `renderStore` reports\n * it, an editor targets it, a generated diff names it — so `applyChange` has\n * to resolve `blocks[#banner-0]` to the same entry the renderer called\n * `banner-0`. Two implementations of this rule would make the id an agent is\n * handed by one ability unusable by another.\n */\nexport function blockInstanceId(entry: unknown, index: number): string {\n const record = entry as Record<string, unknown> | null\n if (record && typeof record.id === 'string' && record.id) return record.id\n return `${String(record?.type)}-${index}`\n}\n\n/**\n * Normalize one authored entry into a `BlockNode`.\n *\n * Both authoring forms collapse to the same node, so everything downstream —\n * the renderer, the editor, `describeBlocks` — sees one shape.\n */\nfunction toBlockNode(entry: StorefrontBlockLike, index: number): BlockNode {\n const record = entry as Record<string, unknown>\n const type = String(record.type)\n const id = blockInstanceId(entry, index)\n\n const data = record.data as BlockDataNeeds | undefined\n\n if (isNestedRef(entry)) {\n const children = (record.children as readonly StorefrontBlockRef[] | undefined) ?? []\n return {\n type,\n id,\n props: (record.props as Record<string, unknown> | undefined) ?? {},\n ...(children.length ? { children: children.map((child, i) => toBlockNode(child, i)) } : {}),\n ...(data ? { data } : {}),\n }\n }\n\n // Flat form: everything that is not identity is a prop.\n const props: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(record)) {\n if (!STRUCTURAL_KEYS.has(key)) props[key] = value\n }\n return { type, id, props, ...(data ? { data } : {}) }\n}\n\n/** Normalize an authored block list into the block tree the renderer consumes. */\nexport function toBlockNodes(blocks: readonly StorefrontBlockLike[]): BlockNode[] {\n return blocks.map(toBlockNode)\n}\n\n/**\n * The default tree for a page kind — what the SDK renders when a store has not\n * composed the page. For catalog and product that is the native body alone,\n * which is why adopting `pages` is a no-op until a store adds something.\n */\nexport function defaultPageBlocks(kind: StorefrontPageKind): BlockNode[] {\n const body = BODY_BLOCK_BY_KIND[kind]\n return body ? [{ type: body, id: body, props: {} }] : []\n}\n\nexport interface PageBlockDiagnostic {\n level: 'error' | 'warning'\n rule: string\n detail: string\n}\n\n/**\n * Diagnostics for one composed page.\n *\n * These are reported, not enforced. A store in production must not go blank\n * because a block was placed on a page its author did not anticipate — so the\n * hard stop belongs in the editor (which reads the same `enabledOn` through\n * `describeBlocks`), and this is the development-time equivalent.\n */\nexport function checkPageBlocks(kind: StorefrontPageKind, nodes: readonly BlockNode[]): PageBlockDiagnostic[] {\n const found: PageBlockDiagnostic[] = []\n const seenIds = new Set<string>()\n const expectedBody = BODY_BLOCK_BY_KIND[kind]\n let hasBody = false\n\n for (const node of nodes) {\n if (node.type === expectedBody) hasBody = true\n\n if (node.id) {\n if (seenIds.has(node.id)) {\n found.push({\n level: 'warning',\n rule: 'duplicate-block-id',\n detail: `two blocks on the ${kind} page share the id \"${node.id}\" — an editor or a generated diff cannot tell them apart`,\n })\n }\n seenIds.add(node.id)\n }\n\n const meta = getBlockMeta(node.type)\n if (!meta) {\n found.push({\n level: 'error',\n rule: 'unknown-block',\n detail: `the ${kind} page references block \"${node.type}\", which is not registered — register it before the storefront mounts`,\n })\n continue\n }\n if (!isBlockEnabledOn({ enabledOn: meta.enabledOn ?? [] }, kind)) {\n found.push({\n level: 'warning',\n rule: 'block-not-enabled-on-page',\n detail: `block \"${node.type}\" declares enabledOn [${(meta.enabledOn ?? []).join(', ')}] and is placed on the ${kind} page`,\n })\n }\n }\n\n if (expectedBody && !hasBody) {\n // Shopify hard-requires the `main` section in a template for this reason. We\n // warn instead of inserting it, because silently adding a block the config\n // does not mention makes the config a lie — and a fully bespoke catalog is a\n // legitimate thing to build.\n found.push({\n level: 'warning',\n rule: 'missing-page-body',\n detail: `the ${kind} page tree omits \"${expectedBody}\", so the page renders no ${kind === 'product' ? 'product detail' : 'product list'} — add it back unless the replacement is deliberate`,\n })\n }\n\n // Composition constraints, for pages composed in code: a document goes\n // through validateStore, but a TS config never does, so the same structural\n // rules are reported here. Errors, because the renderer will keep these\n // blocks off the shopper's page (I7) — the composition already lies.\n for (const violation of checkBlockConstraints(nodes)) {\n found.push({\n level: 'error',\n rule: violation.rule,\n detail: `${kind} page ${violation.path}: ${violation.detail}`,\n })\n }\n\n // Context is advisory: the key may arrive through a runtime channel a static\n // tree cannot see (a slot area, a future loader), so the honest verdict is\n // \"nothing declares this\", not \"this is broken\".\n for (const finding of checkBlockContext(nodes)) {\n found.push({\n level: 'warning',\n rule: 'context-not-provided',\n detail: `block \"${finding.type}\" at ${kind} page ${finding.path} uses context [${finding.missing.join(', ')}] that no ancestor provides`,\n })\n }\n\n return found\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useDeliveryStore, useCartStore, selectSubtotal } from './chunk-
|
|
2
|
-
import { formatMoney, establishCustomerSession, useSessionStore } from './chunk-
|
|
3
|
-
import { toBlockNodes, defaultPageBlocks, PageDataScope, checkPageBlocks } from './chunk-
|
|
4
|
-
import { useRoutePath, useStorefrontConfigOptional, useStorefrontConfig, translate, Link } from './chunk-
|
|
1
|
+
import { useDeliveryStore, useCartStore, selectSubtotal } from './chunk-UHYQNPXO.js';
|
|
2
|
+
import { formatMoney, establishCustomerSession, useSessionStore } from './chunk-27C7DVHW.js';
|
|
3
|
+
import { toBlockNodes, defaultPageBlocks, PageDataScope, checkPageBlocks } from './chunk-GLLGH7FO.js';
|
|
4
|
+
import { useRoutePath, useStorefrontConfigOptional, useStorefrontConfig, translate, Link } from './chunk-ILFYNKT2.js';
|
|
5
5
|
import { createContext, useContext, useMemo, useState, useEffect, useCallback } from 'react';
|
|
6
6
|
import { repairBlockTree, renderBlocks, clearExtensionPoints, defineExtensionPoint, runExtensionPoint, runEscapeValve, getCountrySchema } from '@fayz-ai/core';
|
|
7
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -813,5 +813,5 @@ function returnPath(config) {
|
|
|
813
813
|
}
|
|
814
814
|
|
|
815
815
|
export { BEFORE_PLACE_ORDER_VALVE, BUYER_COUNTRY_COOKIE, CART_LINE_ANNOTATION_POINT, CHECKOUT_FIELD_POINT, ORDER_METADATA_POINT, PAGE_DATA_SCRIPT_ID, PRODUCT_CARD_BADGE_POINT, STOREFRONT_SLOTS, SignInModal, Slot, StorefrontPage, collectOrderMetadata, getCartLineAnnotations, getCheckoutFieldContributions, getProductCardBadges, hydratedEntriesFor, identifyStorefrontBuyer, lastStorefrontEventAt, listSlots, onStorefrontBuyer, onStorefrontEvent, readHydratedPageData, registerStorefrontExtensionPoints, rememberReturnPath, resetPageDiagnostics, resetStorefrontExtensionPoints, returnPath, runBeforePlaceOrderValve, serializePageData, setStorefrontIdentifier, toast, trackStorefront, useBuyerCountry, useBuyerStore, useDiscountValidator, useSlotContext, useSlotFilled, useStorefrontPage, useStorefrontPageOptional, useT, useToastStore, usedSlots };
|
|
816
|
-
//# sourceMappingURL=chunk-
|
|
817
|
-
//# sourceMappingURL=chunk-
|
|
816
|
+
//# sourceMappingURL=chunk-IEIDP37T.js.map
|
|
817
|
+
//# sourceMappingURL=chunk-IEIDP37T.js.map
|