@asteby/storefront-react 0.13.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/checkout/fields.tsx","../src/account/account-auth.tsx"],"names":["useRef","useState","useEffect","jsxs","jsx","ES","EN","Fragment"],"mappings":";;;;;;AA6BA,IAAM,EAAA,GAAoB;AAAA,EACxB,YAAA,EAAc,sBAAA;AAAA,EACd,aAAA,EAAe,sBAAA;AAAA,EACf,KAAA,EAAO,6DAAA;AAAA,EACP,GAAA,EAAK,mCAAA;AAAA,EACL,OAAA,EAAS,oBAAA;AAAA,EACT,QAAA,EAAU,kCAAA;AAAA,EACV,MAAA,EAAQ,oBAAA;AAAA,EACR,UAAA,EAAY,+BAAA;AAAA,EACZ,WAAA,EAAa,kCAAA;AAAA,EACb,QAAA,EAAU;AACZ,CAAA;AAEA,IAAM,EAAA,GAAoB;AAAA,EACxB,YAAA,EAAc,qBAAA;AAAA,EACd,aAAA,EAAe,mBAAA;AAAA,EACf,KAAA,EAAO,6CAAA;AAAA,EACP,GAAA,EAAK,6BAAA;AAAA,EACL,OAAA,EAAS,mBAAA;AAAA,EACT,QAAA,EAAU,gCAAA;AAAA,EACV,MAAA,EAAQ,mBAAA;AAAA,EACR,UAAA,EAAY,2BAAA;AAAA,EACZ,WAAA,EAAa,8BAAA;AAAA,EACb,QAAA,EAAU;AACZ,CAAA;AAGO,SAAS,aAAA,CAAc,QAAwB,SAAA,EAA0D;AAC9G,EAAA,MAAM,IAAA,GAAA,CAAQ,UAAU,OAAA,EAAS,WAAA,GAAc,UAAA,CAAW,IAAI,IAAI,EAAA,GAAK,EAAA;AACvE,EAAA,OAAO,YAAY,EAAE,GAAG,IAAA,EAAM,GAAG,WAAU,GAAI,IAAA;AACjD;AASA,IAAM,SAAA,GAAY,CAAC,EAAA,KACjB,CAAC,CAAC,EAAA,IAAM,OAAQ,GAAe,OAAA,KAAY,Q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EAAK,UAAS,IAAA,EAAK,MAAA,EAAO,KAAA,EAAO,IAAA,EAAM,CAAA,GAAK,IAAA;AAAA,MAC1D,IAAA;AAAA,sBACDA,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,OAAA,EACjB,QAAA,kBAAAA,cAAAA,CAAC,QAAA,EAAA,EAAO,IAAA,EAAK,QAAA,EAAS,IAAA,EAAK,QAAA,EAAS,OAAO,MAAA,EAAQ,QAAA,EAAU,OAAA,EAAS,SAAA,EAAW,EAAA,CAAG,MAAA,EAAQ,wBAAA,EAAsB,IAAA,EAC/G,QAAA,EAAA,CAAA,CAAE,MAAA,CAAO,IAAI,CAAA,EAChB,CAAA,EACF,CAAA;AAAA,sBACAA,eAAC,KAAA,EAAA,EAAI,SAAA,EAAW,GAAG,KAAA,EAAO,uBAAA,EAAqB,MAC5C,QAAA,EAAA,KAAA,EACH;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"account.cjs","sourcesContent":["/**\n * Form fields of a checkout with inline validation: a labelled field that shows its own error under it, a focusable\n * error summary for the submit, and one hook that reads the browser's own constraint validation (`required`, `type`,\n * `pattern`, `minLength`...) so the rules stay in the HTML and the page keeps working without JavaScript (then the\n * browser explains the errors itself).\n *\n * WCAG 2.2: errors are identified in text next to the field (3.3.1), linked with `aria-describedby` and `aria-invalid`,\n * and the summary takes focus and links to every field (3.3.1 / 2.4.3). Validation runs when the buyer leaves a field\n * that has a value, and clears as soon as it is fixed: it never nags while typing.\n */\nimport { useEffect, useRef, useState, type InputHTMLAttributes, type ReactNode, type RefObject, type SelectHTMLAttributes } from 'react'\n\nexport type FieldMessages = {\n valueMissing: string\n /** Required radio group (delivery, payment). */\n choiceMissing: string\n email: string\n tel: string\n pattern: string\n /** `{n}` = minimum length. */\n tooShort: string\n /** A field the server rejected. */\n server: string\n /** Error summary title, `{n}` = number of fields. */\n summaryOne: string\n summaryMany: string\n optional: string\n}\n\nconst ES: FieldMessages = {\n valueMissing: 'Completa este campo.',\n choiceMissing: 'Elige una opción.',\n email: 'Escribe un correo válido, por ejemplo nombre@correo.com.',\n tel: 'Escribe un teléfono válido.',\n pattern: 'Revisa el formato.',\n tooShort: 'Escribe al menos {n} caracteres.',\n server: 'Revisa este campo.',\n summaryOne: 'Revisa 1 campo para continuar',\n summaryMany: 'Revisa {n} campos para continuar',\n optional: '(opcional)',\n}\n\nconst EN: FieldMessages = {\n valueMissing: 'Fill in this field.',\n choiceMissing: 'Choose an option.',\n email: 'Enter a valid email, like name@example.com.',\n tel: 'Enter a valid phone number.',\n pattern: 'Check the format.',\n tooShort: 'Enter at least {n} characters.',\n server: 'Check this field.',\n summaryOne: 'Check 1 field to continue',\n summaryMany: 'Check {n} fields to continue',\n optional: '(optional)',\n}\n\n/** Messages for a locale (`es*` default, `en*`), with optional overrides. */\nexport function fieldMessages(locale?: string | null, overrides?: Partial<FieldMessages> | null): FieldMessages {\n const base = (locale ?? 'es-MX').toLowerCase().startsWith('en') ? EN : ES\n return overrides ? { ...base, ...overrides } : base\n}\n\n/** Field name -> error text. */\nexport type FieldErrors = Record<string, string>\n\nexport type ErrorSummaryItem = { name: string; id: string; label: string; message: string }\n\ntype Control = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement\n\nconst isControl = (el: EventTarget | null): el is Control =>\n !!el && typeof (el as Element).tagName === 'string' && ['INPUT', 'SELECT', 'TEXTAREA'].includes((el as Element).tagName) && !!(el as Control).name\n\n/**\n * The error text for a control, from its validity. A control can bring its own text with `data-sf-error` (any\n * failure) or `title` (pattern mismatch, the HTML convention).\n */\nexport function validationMessage(el: Control, m: FieldMessages = ES): string | null {\n const v = el.validity\n if (!v || v.valid) return null\n const own = el.getAttribute('data-sf-error')\n if (own) return own\n if (v.valueMissing) return el instanceof HTMLInputElement && (el.type === 'radio' || el.type === 'checkbox') ? m.choiceMissing : m.valueMissing\n if (v.typeMismatch && el instanceof HTMLInputElement) return el.type === 'email' ? m.email : el.type === 'tel' ? m.tel : m.pattern\n if (v.patternMismatch) return el.getAttribute('title') || (el instanceof HTMLInputElement && el.type === 'tel' ? m.tel : m.pattern)\n if (v.tooShort && el instanceof HTMLInputElement) return m.tooShort.replace('{n}', String(el.minLength))\n return el.validationMessage || m.pattern\n}\n\n/** Visible name of a control: its `<label>`, `aria-label`, or the legend of its group (radios). */\nfunction labelOf(el: Control): string {\n if (el instanceof HTMLInputElement && el.type === 'radio') {\n const legend = el.closest('fieldset')?.querySelector('legend')\n if (legend?.textContent) return legend.textContent.trim()\n }\n const text = el.labels?.[0]?.getAttribute('data-sf-label') ?? el.labels?.[0]?.textContent ?? el.getAttribute('aria-label') ?? el.name\n return text.trim()\n}\n\nexport type UseFieldErrorsOptions = {\n locale?: string\n messages?: Partial<FieldMessages>\n /** Fields the server rejected (e.g. from the action), shown with `serverMessages[name]` or the generic text. */\n serverFields?: Iterable<string> | null\n serverMessages?: Record<string, string> | null\n}\n\nexport type FieldErrorsState = {\n errors: FieldErrors\n /** Non-null after a submit with problems (or with server errors): render it in `<ErrorSummary>`. */\n summary: ErrorSummaryItem[] | null\n /** Changes every time a new summary appears, so `<ErrorSummary>` focuses it again. */\n summaryKey: number\n clear: () => void\n}\n\n/**\n * Inline validation for the page `<form>`. Listens to the form (no wrapping component): leaving a field with a value\n * checks it; typing in a field with an error clears it when fixed; a submit or `reportValidity()` with problems\n * collects them (the browser's bubbles are replaced by the inline texts) for the summary.\n */\nexport function useFieldErrors(formRef: RefObject<HTMLFormElement | null>, options: UseFieldErrorsOptions = {}): FieldErrorsState {\n const m = fieldMessages(options.locale, options.messages)\n const live = useRef(m)\n live.current = m\n const server = [...(options.serverFields ?? [])]\n const serverKey = server.join('|')\n const [errors, setErrors] = useState<FieldErrors>(() => Object.fromEntries(server.map((n) => [n, options.serverMessages?.[n] ?? m.server])))\n const [summary, setSummary] = useState<ErrorSummaryItem[] | null>(null)\n const [summaryKey, setSummaryKey] = useState(0)\n\n // Server errors (a new action result): inline texts plus a summary.\n useEffect(() => {\n if (!server.length) return\n const form = formRef.current\n const items: ErrorSummaryItem[] = []\n const next: FieldErrors = {}\n for (const name of server) {\n const msg = options.serverMessages?.[name] ?? live.current.server\n next[name] = msg\n const el = form?.elements.namedItem(name)\n const ctl = el && 'length' in el && !(el instanceof HTMLSelectElement) ? ((el as RadioNodeList)[0] as Control | undefined) : (el as Control | null)\n if (ctl) items.push({ name, id: ctl.id || name, label: labelOf(ctl), message: msg })\n }\n setErrors((e) => ({ ...e, ...next }))\n if (items.length) {\n setSummary(items)\n setSummaryKey((k) => k + 1)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [serverKey])\n\n useEffect(() => {\n const form = formRef.current\n if (!form) return\n let batch: Control[] | null = null\n const set = (name: string, msg: string | null) =>\n setErrors((e) => {\n if (msg === null) {\n if (!(name in e)) return e\n const { [name]: _gone, ...rest } = e\n return rest\n }\n return e[name] === msg ? e : { ...e, [name]: msg }\n })\n const onBlur = (ev: FocusEvent) => {\n const el = ev.target\n if (!isControl(el) || (el instanceof HTMLInputElement && (el.type === 'radio' || el.type === 'checkbox' || el.type === 'hidden'))) return\n // Leaving an empty field you only tabbed through is not an error yet; it is at submit.\n if (!el.value) return\n set(el.name, validationMessage(el, live.current))\n }\n const onInput = (ev: Event) => {\n const el = ev.target\n if (!isControl(el)) return\n setErrors((e) => {\n if (!(el.name in e)) return e\n const msg = el.validity.valid ? null : validationMessage(el, live.current)\n if (msg !== null) return e // keep the text until the field is fixed (no flicker while typing)\n const { [el.name]: _gone, ...rest } = e\n return rest\n })\n }\n const onInvalid = (ev: Event) => {\n const el = ev.target\n if (!isControl(el)) return\n ev.preventDefault() // the inline text replaces the browser bubble\n if (!batch) {\n batch = []\n queueMicrotask(() => {\n const list = batch ?? []\n batch = null\n const seen = new Set<string>()\n const items: ErrorSummaryItem[] = []\n const next: FieldErrors = {}\n for (const c of list) {\n if (seen.has(c.name)) continue\n seen.add(c.name)\n const msg = validationMessage(c, live.current) ?? live.current.valueMissing\n next[c.name] = msg\n items.push({ name: c.name, id: c.id || c.name, label: labelOf(c), message: msg })\n }\n setErrors((e) => ({ ...e, ...next }))\n setSummary(items)\n setSummaryKey((k) => k + 1)\n })\n }\n batch.push(el)\n }\n form.addEventListener('focusout', onBlur)\n form.addEventListener('input', onInput)\n form.addEventListener('change', onInput)\n form.addEventListener('invalid', onInvalid, true)\n return () => {\n form.removeEventListener('focusout', onBlur)\n form.removeEventListener('input', onInput)\n form.removeEventListener('change', onInput)\n form.removeEventListener('invalid', onInvalid, true)\n }\n }, [formRef])\n\n // The summary follows the fixes: a field fixed after the submit leaves the list.\n const shown = summary ? summary.filter((s) => s.name in errors).map((s) => ({ ...s, message: errors[s.name]! })) : null\n return {\n errors,\n summary: shown && shown.length ? shown : null,\n summaryKey,\n clear: () => {\n setErrors({})\n setSummary(null)\n },\n }\n}\n\nexport type ErrorSummaryProps = {\n items: readonly ErrorSummaryItem[] | null\n /** Changes when a new summary must take focus (`useFieldErrors().summaryKey`). */\n focusKey?: number\n locale?: string\n messages?: Partial<FieldMessages>\n title?: ReactNode\n className?: string\n classNames?: Partial<Record<'title' | 'list' | 'link', string>>\n}\n\n/**\n * The list of problems after a submit, above the form: `role=\"alert\"`, takes focus, one link per field (moves the\n * focus to it). Renders nothing without items.\n */\nexport function ErrorSummary({ items, focusKey, locale, messages, title, className, classNames: cx = {} }: ErrorSummaryProps) {\n const ref = useRef<HTMLDivElement>(null)\n const m = fieldMessages(locale, messages)\n const has = !!items && items.length > 0\n useEffect(() => {\n if (has) ref.current?.focus()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [focusKey])\n if (!has) return null\n const n = items!.length\n return (\n <div ref={ref} role=\"alert\" tabIndex={-1} className={className} data-sf-error-summary aria-labelledby=\"sf-error-summary-title\">\n <p id=\"sf-error-summary-title\" className={cx.title} data-sf-error-summary-title>\n {title ?? (n === 1 ? m.summaryOne : m.summaryMany.replace('{n}', String(n)))}\n </p>\n <ul className={cx.list}>\n {items!.map((it) => (\n <li key={it.name}>\n <a\n href={`#${it.id}`}\n className={cx.link}\n onClick={(e) => {\n const el = document.getElementById(it.id)\n if (!el) return\n e.preventDefault()\n el.focus()\n el.scrollIntoView?.({ block: 'center' })\n }}\n >\n {it.label}: {it.message}\n </a>\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\nexport type CheckoutFieldClassNames = Partial<Record<'root' | 'label' | 'optional' | 'input' | 'hint' | 'error', string>>\n\ntype BaseFieldProps = {\n name: string\n label: string\n /** Field id. Default: the name. */\n id?: string\n /** Error text (from `useFieldErrors().errors[name]` or the server). */\n error?: string | null\n /** Help under the label (\"we only use it for the delivery\"). */\n hint?: ReactNode\n /** Marks the label \"(optional)\" and drops `required`. */\n optional?: boolean\n classNames?: CheckoutFieldClassNames\n locale?: string\n messages?: Partial<FieldMessages>\n}\n\nexport type CheckoutFieldProps = BaseFieldProps & Omit<InputHTMLAttributes<HTMLInputElement>, 'name' | 'id'> & { as?: 'input' }\nexport type CheckoutSelectProps = BaseFieldProps & Omit<SelectHTMLAttributes<HTMLSelectElement>, 'name' | 'id'> & { as: 'select'; children: ReactNode }\n\n/**\n * One labelled field: label (with \"(optional)\"), hint, the control and its error text, wired with `aria-describedby`\n * and `aria-invalid`. Required unless `optional`. `as=\"select\"` renders a `<select>` with the given options.\n */\nexport function CheckoutField(props: CheckoutFieldProps | CheckoutSelectProps) {\n const { name, label, id = name, error, hint, optional = false, classNames: cx = {}, locale, messages, ...rest } = props\n const m = fieldMessages(locale, messages)\n const hintId = hint ? `${id}-hint` : undefined\n const errorId = `${id}-error`\n const describedBy = [hintId, error ? errorId : undefined].filter(Boolean).join(' ') || undefined\n const common = {\n id,\n name,\n required: !optional,\n 'aria-invalid': error ? true : undefined,\n 'aria-describedby': describedBy,\n className: cx.input,\n 'data-sf-field-control': '',\n } as const\n return (\n <div className={cx.root} data-sf-field data-invalid={error ? '' : undefined}>\n <label htmlFor={id} className={cx.label} data-sf-label={label}>\n {label}\n {optional ? (\n <span className={cx.optional} data-sf-field-optional>\n {' '}\n {m.optional}\n </span>\n ) : null}\n </label>\n {hint ? (\n <p id={hintId} className={cx.hint} data-sf-field-hint>\n {hint}\n </p>\n ) : null}\n {rest.as === 'select' ? (\n (() => {\n const { as: _as, children, ...select } = rest\n return (\n <select {...select} {...common}>\n {children}\n </select>\n )\n })()\n ) : (\n (() => {\n const { as: _as, ...input } = rest as CheckoutFieldProps\n return <input {...input} {...common} />\n })()\n )}\n {/* Reserved only when there is an error: the text sits right under its field. */}\n {error ? (\n <p id={errorId} className={cx.error} data-sf-field-error>\n {error}\n </p>\n ) : null}\n </div>\n )\n}\n","/**\n * The account screen: sign in with password, create an account, verify the emailed code, sign in with a code and\n * recover a forgotten password, in one `<form method=\"post\">` driven by `createAuthAction` (`./server`). What the store\n * offers comes from `loadAuthCapabilities`; the form shows only that. Plain HTML: it works without JavaScript for the\n * password sign-in and the steps the action sends back; the view switches (links) need JavaScript.\n *\n * Styling: `data-sf-account-*` attributes and `classNames` slots, fields reuse `CheckoutField` (and `checkout.css`);\n * `account.css` is an optional neutral sheet. Texts are Spanish by default, English with `locale=\"en\"`, any with `messages`.\n */\nimport { useEffect, useRef, useState, type ComponentType, type ReactNode } from 'react'\nimport type { CustomerCapabilities } from '@asteby/storefront'\nimport { CheckoutField, ErrorSummary, useFieldErrors, type CheckoutFieldClassNames } from '../checkout/fields.js'\nimport type { AuthActionData, AuthErrorCode, AuthStep } from './types.js'\n\nexport type AccountAuthView = 'login' | 'register' | 'otp-email' | 'forgot' | AuthStep\n\nexport type AccountAuthMessages = {\n titles: Record<AccountAuthView, string>\n email: string\n password: string\n newPassword: string\n passwordHint: string\n firstName: string\n lastName: string\n code: string\n codeSentTo: string\n submit: Record<AccountAuthView, string>\n resend: string\n forgotLink: string\n registerLink: string\n loginLink: string\n otpLink: string\n backToLogin: string\n nothingAvailable: string\n errors: Record<AuthErrorCode, string>\n}\n\nconst ES: AccountAuthMessages = {\n titles: {\n login: 'Entrar a tu cuenta',\n register: 'Crear una cuenta',\n verify: 'Confirma tu correo',\n 'otp-email': 'Entrar con un código',\n otp: 'Escribe tu código',\n forgot: 'Recuperar contraseña',\n reset: 'Elige una contraseña nueva',\n },\n email: 'Correo electrónico',\n password: 'Contraseña',\n newPassword: 'Contraseña nueva',\n passwordHint: 'Entre 10 y 128 caracteres.',\n firstName: 'Nombre',\n lastName: 'Apellido',\n code: 'Código',\n codeSentTo: 'Enviamos un código a {email}. Puede tardar un minuto.',\n submit: {\n login: 'Entrar',\n register: 'Crear cuenta',\n verify: 'Confirmar',\n 'otp-email': 'Enviarme el código',\n otp: 'Entrar',\n forgot: 'Enviarme el código',\n reset: 'Guardar y entrar',\n },\n resend: 'Reenviar código',\n forgotLink: '¿Olvidaste tu contraseña?',\n registerLink: 'Crear una cuenta',\n loginLink: 'Ya tengo cuenta',\n otpLink: 'Entrar con un código por correo',\n backToLogin: 'Volver a entrar con contraseña',\n nothingAvailable: 'Esta tienda no admite iniciar sesión por ahora.',\n errors: {\n invalid_credentials: 'El correo o la contraseña no coinciden.',\n invalid_code: 'El código no es válido o ya venció.',\n email_taken: 'Ya existe una cuenta con este correo. Entra o recupera tu contraseña.',\n rate_limited: 'Demasiados intentos. Espera unos minutos e inténtalo de nuevo.',\n validation: 'Revisa los datos e inténtalo de nuevo.',\n unsupported: 'Esta forma de entrar no está disponible en esta tienda.',\n unavailable: 'No pudimos completar la acción. Inténtalo de nuevo en un momento.',\n },\n}\n\nconst EN: AccountAuthMessages = {\n titles: {\n login: 'Sign in',\n register: 'Create an account',\n verify: 'Confirm your email',\n 'otp-email': 'Sign in with a code',\n otp: 'Enter your code',\n forgot: 'Reset your password',\n reset: 'Choose a new password',\n },\n email: 'Email',\n password: 'Password',\n newPassword: 'New password',\n passwordHint: 'Between 10 and 128 characters.',\n firstName: 'First name',\n lastName: 'Last name',\n code: 'Code',\n codeSentTo: 'We sent a code to {email}. It can take a minute.',\n submit: {\n login: 'Sign in',\n register: 'Create account',\n verify: 'Confirm',\n 'otp-email': 'Email me the code',\n otp: 'Sign in',\n forgot: 'Email me the code',\n reset: 'Save and sign in',\n },\n resend: 'Resend code',\n forgotLink: 'Forgot your password?',\n registerLink: 'Create an account',\n loginLink: 'I already have an account',\n otpLink: 'Sign in with an emailed code',\n backToLogin: 'Back to password sign-in',\n nothingAvailable: 'This store does not support signing in right now.',\n errors: {\n invalid_credentials: 'The email and password do not match.',\n invalid_code: 'The code is not valid or has expired.',\n email_taken: 'An account with this email already exists. Sign in or reset your password.',\n rate_limited: 'Too many attempts. Wait a few minutes and try again.',\n validation: 'Check the details and try again.',\n unsupported: 'This way of signing in is not available in this store.',\n unavailable: 'We could not complete that. Try again in a moment.',\n },\n}\n\n/** Messages for a locale (`es*` default, `en*`), with optional overrides (nested `titles`/`submit`/`errors` merge). */\nexport function accountAuthMessages(locale?: string | null, overrides?: DeepPartial<AccountAuthMessages> | null): AccountAuthMessages {\n const base = (locale ?? 'es-MX').toLowerCase().startsWith('en') ? EN : ES\n if (!overrides) return base\n return {\n ...base,\n ...(overrides as Partial<AccountAuthMessages>),\n titles: { ...base.titles, ...overrides.titles },\n submit: { ...base.submit, ...overrides.submit },\n errors: { ...base.errors, ...overrides.errors },\n }\n}\n\ntype DeepPartial<T> = { [K in keyof T]?: T[K] extends Record<string, string> ? Partial<T[K]> : T[K] }\n\nexport type AccountAuthClassNames = Partial<Record<'root' | 'title' | 'form' | 'notice' | 'error' | 'actions' | 'submit' | 'links' | 'link', string>> & {\n field?: CheckoutFieldClassNames\n}\n\n/** What `<AccountAuth>` passes to its `form` component: the few props a router `Form` and the HTML `<form>` both accept. */\nexport type AccountFormProps = {\n method?: 'post'\n action?: string\n className?: string\n children?: ReactNode\n /** Loose on purpose: a router `Form` types its ref with its own copy of `@types/react`. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref?: any\n 'data-sf-account-form'?: boolean | string\n}\n\nexport type AccountAuthProps = {\n /** From `loadAuthCapabilities` (the loader). */\n capabilities: CustomerCapabilities\n /** What the action returned (`useActionData()`); drives the next screen and the errors. */\n data?: AuthActionData | null\n /** Where to go after signing in (sent as `next`; the server validates it). */\n next?: string | null\n /** A submit is in flight (`navigation.state !== 'idle'`): disables the buttons. */\n pending?: boolean\n /** First screen. Default `login`, or `otp-email` when the store has no password sign-in. */\n initialView?: AccountAuthView\n /** Form component, e.g. React Router's `Form`, to submit without a reload. It must forward `ref` to the `<form>` (React 19: a prop). Default: the HTML `<form>`. */\n form?: 'form' | ComponentType<AccountFormProps>\n /** `action` of the form (default: the current URL). */\n action?: string\n locale?: string\n messages?: DeepPartial<AccountAuthMessages>\n classNames?: AccountAuthClassNames\n /** Shown above the form (a logo, a welcome text). */\n header?: ReactNode\n}\n\nconst initialOf = (caps: CustomerCapabilities, initialView?: AccountAuthView): AccountAuthView =>\n initialView ?? (caps.password ? 'login' : caps.otp_channels.includes('email') ? 'otp-email' : 'login')\n\n/**\n * The whole account screen. Headless enough to restyle, complete enough to drop in:\n * `export default function Account() { return <AccountAuth capabilities={useLoaderData()} data={useActionData()} form={Form} /> }`.\n */\nexport function AccountAuth({ capabilities, data, next, pending = false, initialView, form: FormTag = 'form', action, locale, messages, classNames: cx = {}, header }: AccountAuthProps) {\n const m = accountAuthMessages(locale, messages)\n const passwordOn = capabilities.password\n const otpOn = capabilities.otp_channels.includes('email')\n const [view, setView] = useState<AccountAuthView>(() => data?.step ?? initialOf(capabilities, initialView))\n const [email, setEmail] = useState(data?.email ?? '')\n const ref = useRef<HTMLFormElement>(null)\n const serverFields = data?.error?.field ? [data.error.field] : null\n const errorText = data?.error ? m.errors[data.error.code] : null\n const v = useFieldErrors(ref, { ...(locale ? { locale } : {}), serverFields, serverMessages: data?.error?.field && errorText ? { [data.error.field]: errorText } : null })\n\n // The action decides the next screen; the email it carries survives it.\n useEffect(() => {\n if (data?.step) setView(data.step)\n if (data?.email) setEmail(data.email)\n }, [data])\n\n const go = (to: AccountAuthView) => {\n v.clear()\n setView(to)\n }\n const fieldProps = { classNames: cx.field, ...(locale ? { locale } : {}) }\n const emailField = (\n <CheckoutField {...fieldProps} name=\"email\" type=\"email\" label={m.email} autoComplete=\"email\" inputMode=\"email\" value={email} onChange={(e) => setEmail(e.currentTarget.value)} error={v.errors.email ?? null} />\n )\n const codeField = (\n <CheckoutField {...fieldProps} name=\"code\" label={m.code} autoComplete=\"one-time-code\" inputMode=\"numeric\" pattern=\"[0-9]*\" error={v.errors.code ?? null} />\n )\n const passwordField = (label: string, autoComplete: string, newPassword: boolean) => (\n <CheckoutField\n {...fieldProps}\n name=\"password\"\n type=\"password\"\n label={label}\n autoComplete={autoComplete}\n error={v.errors.password ?? null}\n {...(newPassword ? { minLength: 10, maxLength: 128, hint: m.passwordHint } : {})}\n />\n )\n const link = (to: AccountAuthView, text: string) => (\n <button type=\"button\" className={cx.link} data-sf-account-link={to} onClick={() => go(to)}>\n {text}\n </button>\n )\n\n let body: ReactNode\n let links: ReactNode = null\n switch (view) {\n case 'register':\n body = (\n <>\n <CheckoutField {...fieldProps} name=\"first_name\" label={m.firstName} autoComplete=\"given-name\" optional />\n <CheckoutField {...fieldProps} name=\"last_name\" label={m.lastName} autoComplete=\"family-name\" optional />\n {emailField}\n {passwordField(m.password, 'new-password', true)}\n </>\n )\n links = link('login', m.loginLink)\n break\n case 'verify':\n case 'otp':\n body = (\n <>\n <p className={cx.notice} data-sf-account-notice>\n {m.codeSentTo.replace('{email}', email)}\n </p>\n <input type=\"hidden\" name=\"email\" value={email} />\n {codeField}\n </>\n )\n links = (\n <>\n {view === 'otp' ? (\n <button type=\"submit\" name=\"intent\" value=\"otp-request\" formNoValidate className={cx.link} data-sf-account-link=\"resend\">\n {m.resend}\n </button>\n ) : null}\n {link('login', m.backToLogin)}\n </>\n )\n break\n case 'otp-email':\n case 'forgot':\n body = emailField\n links = link('login', m.backToLogin)\n break\n case 'reset':\n body = (\n <>\n <p className={cx.notice} data-sf-account-notice>\n {m.codeSentTo.replace('{email}', email)}\n </p>\n <input type=\"hidden\" name=\"email\" value={email} />\n {codeField}\n {passwordField(m.newPassword, 'new-password', true)}\n </>\n )\n links = link('login', m.backToLogin)\n break\n default:\n body = (\n <>\n {emailField}\n {passwordField(m.password, 'current-password', false)}\n </>\n )\n links = (\n <>\n {otpOn ? link('forgot', m.forgotLink) : null}\n {link('register', m.registerLink)}\n {otpOn ? link('otp-email', m.otpLink) : null}\n </>\n )\n }\n\n const intent = { login: 'login', register: 'register', verify: 'verify', 'otp-email': 'otp-request', otp: 'otp-login', forgot: 'forgot', reset: 'reset' }[view]\n // Without password accounts the password views do not exist; only the code sign-in does.\n const available = view === 'login' || view === 'register' || view === 'forgot' || view === 'reset' || view === 'verify' ? passwordOn : otpOn\n const showSummary = !data?.error?.field\n const title = m.titles[view]\n if (!available && !passwordOn && !otpOn) {\n return (\n <section className={cx.root} data-sf-account-auth data-sf-account-view=\"unavailable\">\n <p className={cx.notice} role=\"status\">\n {m.nothingAvailable}\n </p>\n </section>\n )\n }\n return (\n <section className={cx.root} data-sf-account-auth data-sf-account-view={view} aria-labelledby=\"sf-account-title\">\n {header}\n <h1 id=\"sf-account-title\" className={cx.title}>\n {title}\n </h1>\n <FormTag ref={ref as never} method=\"post\" {...(action ? { action } : {})} className={cx.form} data-sf-account-form>\n <ErrorSummary items={v.summary} focusKey={v.summaryKey} {...(locale ? { locale } : {})} />\n {errorText && showSummary ? (\n <p role=\"alert\" className={cx.error} data-sf-account-error={data!.error!.code}>\n {errorText}\n </p>\n ) : null}\n {next ? <input type=\"hidden\" name=\"next\" value={next} /> : null}\n {body}\n <div className={cx.actions}>\n <button type=\"submit\" name=\"intent\" value={intent} disabled={pending} className={cx.submit} data-sf-account-submit>\n {m.submit[view]}\n </button>\n </div>\n <div className={cx.links} data-sf-account-links>\n {links}\n </div>\n </FormTag>\n </section>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/checkout/fields.tsx","../src/account/account-auth.tsx"],"names":["useRef","useState","useEffect","jsxs","jsx","ES","EN","Fragment"],"mappings":";;;;;;AA6BA,I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CAAA,GAAK,IAAA;AAAA,MAC1D,IAAA;AAAA,sBACDA,cAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,OAAA,EACjB,QAAA,kBAAAA,cAAAA,CAAC,QAAA,EAAA,EAAO,IAAA,EAAK,QAAA,EAAS,IAAA,EAAK,QAAA,EAAS,OAAO,MAAA,EAAQ,QAAA,EAAU,OAAA,EAAS,SAAA,EAAW,EAAA,CAAG,MAAA,EAAQ,wBAAA,EAAsB,IAAA,EAC/G,QAAA,EAAA,CAAA,CAAE,MAAA,CAAO,IAAI,CAAA,EAChB,CAAA,EACF,CAAA;AAAA,sBACAA,eAAC,KAAA,EAAA,EAAI,SAAA,EAAW,GAAG,KAAA,EAAO,uBAAA,EAAqB,MAC5C,QAAA,EAAA,KAAA,EACH;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"account.cjs","sourcesContent":["/**\n * Form fields of a checkout with inline validation: a labelled field that shows its own error under it, a focusable\n * error summary for the submit, and one hook that reads the browser's own constraint validation (`required`, `type`,\n * `pattern`, `minLength`...) so the rules stay in the HTML and the page keeps working without JavaScript (then the\n * browser explains the errors itself).\n *\n * WCAG 2.2: errors are identified in text next to the field (3.3.1), linked with `aria-describedby` and `aria-invalid`,\n * and the summary takes focus and links to every field (3.3.1 / 2.4.3). Validation runs when the buyer leaves a field\n * that has a value, and clears as soon as it is fixed: it never nags while typing.\n */\nimport { useEffect, useRef, useState, type InputHTMLAttributes, type ReactNode, type RefObject, type SelectHTMLAttributes } from 'react'\n\nexport type FieldMessages = {\n valueMissing: string\n /** Required radio group (delivery, payment). */\n choiceMissing: string\n email: string\n tel: string\n pattern: string\n /** `{n}` = minimum length. */\n tooShort: string\n /** A field the server rejected. */\n server: string\n /** Error summary title, `{n}` = number of fields. */\n summaryOne: string\n summaryMany: string\n optional: string\n}\n\nconst ES: FieldMessages = {\n valueMissing: 'Completa este campo.',\n choiceMissing: 'Elige una opción.',\n email: 'Escribe un correo válido, por ejemplo nombre@correo.com.',\n tel: 'Escribe un teléfono válido.',\n pattern: 'Revisa el formato.',\n tooShort: 'Escribe al menos {n} caracteres.',\n server: 'Revisa este campo.',\n summaryOne: 'Revisa 1 campo para continuar',\n summaryMany: 'Revisa {n} campos para continuar',\n optional: '(opcional)',\n}\n\nconst EN: FieldMessages = {\n valueMissing: 'Fill in this field.',\n choiceMissing: 'Choose an option.',\n email: 'Enter a valid email, like name@example.com.',\n tel: 'Enter a valid phone number.',\n pattern: 'Check the format.',\n tooShort: 'Enter at least {n} characters.',\n server: 'Check this field.',\n summaryOne: 'Check 1 field to continue',\n summaryMany: 'Check {n} fields to continue',\n optional: '(optional)',\n}\n\n/** Messages for a locale (`es*` default, `en*`), with optional overrides. */\nexport function fieldMessages(locale?: string | null, overrides?: Partial<FieldMessages> | null): FieldMessages {\n const base = (locale ?? 'es-MX').toLowerCase().startsWith('en') ? EN : ES\n return overrides ? { ...base, ...overrides } : base\n}\n\n/** Field name -> error text. */\nexport type FieldErrors = Record<string, string>\n\nexport type ErrorSummaryItem = { name: string; id: string; label: string; message: string }\n\ntype Control = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement\n\nconst isControl = (el: EventTarget | null): el is Control =>\n !!el && typeof (el as Element).tagName === 'string' && ['INPUT', 'SELECT', 'TEXTAREA'].includes((el as Element).tagName) && !!(el as Control).name\n\n/**\n * The error text for a control, from its validity. A control can bring its own text with `data-sf-error` (any\n * failure) or `title` (pattern mismatch, the HTML convention).\n */\nexport function validationMessage(el: Control, m: FieldMessages = ES): string | null {\n const v = el.validity\n if (!v || v.valid) return null\n const own = el.getAttribute('data-sf-error')\n if (own) return own\n if (v.valueMissing) return el instanceof HTMLInputElement && (el.type === 'radio' || el.type === 'checkbox') ? m.choiceMissing : m.valueMissing\n if (v.typeMismatch && el instanceof HTMLInputElement) return el.type === 'email' ? m.email : el.type === 'tel' ? m.tel : m.pattern\n if (v.patternMismatch) return el.getAttribute('title') || (el instanceof HTMLInputElement && el.type === 'tel' ? m.tel : m.pattern)\n if (v.tooShort && el instanceof HTMLInputElement) return m.tooShort.replace('{n}', String(el.minLength))\n return el.validationMessage || m.pattern\n}\n\n/** Visible name of a control: its `<label>`, `aria-label`, or the legend of its group (radios). */\nfunction labelOf(el: Control): string {\n if (el instanceof HTMLInputElement && el.type === 'radio') {\n const legend = el.closest('fieldset')?.querySelector('legend')\n if (legend?.textContent) return legend.textContent.trim()\n }\n const text = el.labels?.[0]?.getAttribute('data-sf-label') ?? el.labels?.[0]?.textContent ?? el.getAttribute('aria-label') ?? el.name\n return text.trim()\n}\n\nexport type UseFieldErrorsOptions = {\n locale?: string\n messages?: Partial<FieldMessages>\n /** Fields the server rejected (e.g. from the action), shown with `serverMessages[name]` or the generic text. */\n serverFields?: Iterable<string> | null\n serverMessages?: Record<string, string> | null\n}\n\nexport type FieldErrorsState = {\n errors: FieldErrors\n /** Non-null after a submit with problems (or with server errors): render it in `<ErrorSummary>`. */\n summary: ErrorSummaryItem[] | null\n /** Changes every time a new summary appears, so `<ErrorSummary>` focuses it again. */\n summaryKey: number\n clear: () => void\n}\n\n/**\n * Inline validation for the page `<form>`. Listens to the form (no wrapping component): leaving a field with a value\n * checks it; typing in a field with an error clears it when fixed; a submit or `reportValidity()` with problems\n * collects them (the browser's bubbles are replaced by the inline texts) for the summary.\n */\nexport function useFieldErrors(formRef: RefObject<HTMLFormElement | null>, options: UseFieldErrorsOptions = {}): FieldErrorsState {\n const m = fieldMessages(options.locale, options.messages)\n const live = useRef(m)\n live.current = m\n const server = [...(options.serverFields ?? [])]\n const serverKey = server.join('|')\n const [errors, setErrors] = useState<FieldErrors>(() => Object.fromEntries(server.map((n) => [n, options.serverMessages?.[n] ?? m.server])))\n const [summary, setSummary] = useState<ErrorSummaryItem[] | null>(null)\n const [summaryKey, setSummaryKey] = useState(0)\n\n // Server errors (a new action result): inline texts plus a summary.\n useEffect(() => {\n if (!server.length) return\n const form = formRef.current\n const items: ErrorSummaryItem[] = []\n const next: FieldErrors = {}\n for (const name of server) {\n const msg = options.serverMessages?.[name] ?? live.current.server\n next[name] = msg\n const el = form?.elements.namedItem(name)\n const ctl = el && 'length' in el && !(el instanceof HTMLSelectElement) ? ((el as RadioNodeList)[0] as Control | undefined) : (el as Control | null)\n if (ctl) items.push({ name, id: ctl.id || name, label: labelOf(ctl), message: msg })\n }\n setErrors((e) => ({ ...e, ...next }))\n if (items.length) {\n setSummary(items)\n setSummaryKey((k) => k + 1)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [serverKey])\n\n useEffect(() => {\n const form = formRef.current\n if (!form) return\n let batch: Control[] | null = null\n const set = (name: string, msg: string | null) =>\n setErrors((e) => {\n if (msg === null) {\n if (!(name in e)) return e\n const { [name]: _gone, ...rest } = e\n return rest\n }\n return e[name] === msg ? e : { ...e, [name]: msg }\n })\n const onBlur = (ev: FocusEvent) => {\n const el = ev.target\n if (!isControl(el) || (el instanceof HTMLInputElement && (el.type === 'radio' || el.type === 'checkbox' || el.type === 'hidden'))) return\n // Leaving an empty field you only tabbed through is not an error yet; it is at submit.\n if (!el.value) return\n set(el.name, validationMessage(el, live.current))\n }\n const onInput = (ev: Event) => {\n const el = ev.target\n if (!isControl(el)) return\n setErrors((e) => {\n if (!(el.name in e)) return e\n const msg = el.validity.valid ? null : validationMessage(el, live.current)\n if (msg !== null) return e // keep the text until the field is fixed (no flicker while typing)\n const { [el.name]: _gone, ...rest } = e\n return rest\n })\n }\n const onInvalid = (ev: Event) => {\n const el = ev.target\n if (!isControl(el)) return\n ev.preventDefault() // the inline text replaces the browser bubble\n if (!batch) {\n batch = []\n queueMicrotask(() => {\n const list = batch ?? []\n batch = null\n const seen = new Set<string>()\n const items: ErrorSummaryItem[] = []\n const next: FieldErrors = {}\n for (const c of list) {\n if (seen.has(c.name)) continue\n seen.add(c.name)\n const msg = validationMessage(c, live.current) ?? live.current.valueMissing\n next[c.name] = msg\n items.push({ name: c.name, id: c.id || c.name, label: labelOf(c), message: msg })\n }\n setErrors((e) => ({ ...e, ...next }))\n setSummary(items)\n setSummaryKey((k) => k + 1)\n })\n }\n batch.push(el)\n }\n form.addEventListener('focusout', onBlur)\n form.addEventListener('input', onInput)\n form.addEventListener('change', onInput)\n form.addEventListener('invalid', onInvalid, true)\n return () => {\n form.removeEventListener('focusout', onBlur)\n form.removeEventListener('input', onInput)\n form.removeEventListener('change', onInput)\n form.removeEventListener('invalid', onInvalid, true)\n }\n }, [formRef])\n\n // The summary follows the fixes: a field fixed after the submit leaves the list.\n const shown = summary ? summary.filter((s) => s.name in errors).map((s) => ({ ...s, message: errors[s.name]! })) : null\n return {\n errors,\n summary: shown && shown.length ? shown : null,\n summaryKey,\n clear: () => {\n setErrors({})\n setSummary(null)\n },\n }\n}\n\nexport type ErrorSummaryProps = {\n items: readonly ErrorSummaryItem[] | null\n /** Changes when a new summary must take focus (`useFieldErrors().summaryKey`). */\n focusKey?: number\n locale?: string\n messages?: Partial<FieldMessages>\n title?: ReactNode\n className?: string\n classNames?: Partial<Record<'title' | 'list' | 'link', string>>\n}\n\n/**\n * The list of problems after a submit, above the form: `role=\"alert\"`, takes focus, one link per field (moves the\n * focus to it). Renders nothing without items.\n */\nexport function ErrorSummary({ items, focusKey, locale, messages, title, className, classNames: cx = {} }: ErrorSummaryProps) {\n const ref = useRef<HTMLDivElement>(null)\n const m = fieldMessages(locale, messages)\n const has = !!items && items.length > 0\n useEffect(() => {\n if (has) ref.current?.focus()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [focusKey])\n if (!has) return null\n const n = items!.length\n return (\n <div ref={ref} role=\"alert\" tabIndex={-1} className={className} data-sf-error-summary aria-labelledby=\"sf-error-summary-title\">\n <p id=\"sf-error-summary-title\" className={cx.title} data-sf-error-summary-title>\n {title ?? (n === 1 ? m.summaryOne : m.summaryMany.replace('{n}', String(n)))}\n </p>\n <ul className={cx.list}>\n {items!.map((it) => (\n <li key={it.name}>\n <a\n href={`#${it.id}`}\n className={cx.link}\n onClick={(e) => {\n const el = document.getElementById(it.id)\n if (!el) return\n e.preventDefault()\n el.focus()\n el.scrollIntoView?.({ block: 'center' })\n }}\n >\n {it.label}: {it.message}\n </a>\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\nexport type CheckoutFieldClassNames = Partial<Record<'root' | 'label' | 'optional' | 'input' | 'hint' | 'error', string>>\n\ntype BaseFieldProps = {\n name: string\n label: string\n /** Field id. Default: the name. */\n id?: string\n /** Error text (from `useFieldErrors().errors[name]` or the server). */\n error?: string | null\n /** Help under the label (\"we only use it for the delivery\"). */\n hint?: ReactNode\n /** Marks the label \"(optional)\" and drops `required`. */\n optional?: boolean\n classNames?: CheckoutFieldClassNames\n locale?: string\n messages?: Partial<FieldMessages>\n}\n\nexport type CheckoutFieldProps = BaseFieldProps & Omit<InputHTMLAttributes<HTMLInputElement>, 'name' | 'id'> & { as?: 'input' }\nexport type CheckoutSelectProps = BaseFieldProps & Omit<SelectHTMLAttributes<HTMLSelectElement>, 'name' | 'id'> & { as: 'select'; children: ReactNode }\n\n/**\n * One labelled field: label (with \"(optional)\"), hint, the control and its error text, wired with `aria-describedby`\n * and `aria-invalid`. Required unless `optional`. `as=\"select\"` renders a `<select>` with the given options.\n */\nexport function CheckoutField(props: CheckoutFieldProps | CheckoutSelectProps) {\n const { name, label, id = name, error, hint, optional = false, classNames: cx = {}, locale, messages, ...rest } = props\n const m = fieldMessages(locale, messages)\n const hintId = hint ? `${id}-hint` : undefined\n const errorId = `${id}-error`\n const describedBy = [hintId, error ? errorId : undefined].filter(Boolean).join(' ') || undefined\n const common = {\n id,\n name,\n required: !optional,\n 'aria-invalid': error ? true : undefined,\n 'aria-describedby': describedBy,\n className: cx.input,\n 'data-sf-field-control': '',\n } as const\n return (\n <div className={cx.root} data-sf-field data-invalid={error ? '' : undefined}>\n <label htmlFor={id} className={cx.label} data-sf-label={label}>\n {label}\n {optional ? (\n <span className={cx.optional} data-sf-field-optional>\n {' '}\n {m.optional}\n </span>\n ) : null}\n </label>\n {hint ? (\n <p id={hintId} className={cx.hint} data-sf-field-hint>\n {hint}\n </p>\n ) : null}\n {rest.as === 'select' ? (\n (() => {\n const { as: _as, children, ...select } = rest\n return (\n <select {...select} {...common}>\n {children}\n </select>\n )\n })()\n ) : (\n (() => {\n const { as: _as, ...input } = rest as CheckoutFieldProps\n return <input {...input} {...common} />\n })()\n )}\n {/* Reserved only when there is an error: the text sits right under its field. */}\n {error ? (\n <p id={errorId} className={cx.error} data-sf-field-error>\n {error}\n </p>\n ) : null}\n </div>\n )\n}\n","/**\n * The account screen: sign in with password, create an account, verify the emailed code, sign in with a code and\n * recover a forgotten password, in one `<form method=\"post\">` driven by `createAuthAction` (`./server`). What the store\n * offers comes from `loadAuthCapabilities`; the form shows only that. Plain HTML: it works without JavaScript for the\n * password sign-in and the steps the action sends back; the view switches (links) need JavaScript.\n *\n * Styling: `data-sf-account-*` attributes and `classNames` slots, fields reuse `CheckoutField` (and `checkout.css`);\n * `account.css` is an optional neutral sheet. Texts are Spanish by default, English with `locale=\"en\"`, any with `messages`.\n */\nimport { useEffect, useRef, useState, type ComponentType, type ReactNode } from 'react'\nimport type { CustomerCapabilities } from '@asteby/storefront'\nimport { CheckoutField, ErrorSummary, useFieldErrors, type CheckoutFieldClassNames } from '../checkout/fields.js'\nimport type { AuthActionData, AuthErrorCode, AuthStep } from './types.js'\n\nexport type AccountAuthView = 'login' | 'register' | 'otp-email' | 'forgot' | AuthStep\n\nexport type AccountAuthMessages = {\n titles: Record<AccountAuthView, string>\n email: string\n password: string\n newPassword: string\n passwordHint: string\n firstName: string\n lastName: string\n code: string\n codeSentTo: string\n submit: Record<AccountAuthView, string>\n resend: string\n forgotLink: string\n registerLink: string\n loginLink: string\n otpLink: string\n backToLogin: string\n nothingAvailable: string\n errors: Record<AuthErrorCode, string>\n}\n\nconst ES: AccountAuthMessages = {\n titles: {\n login: 'Entrar a tu cuenta',\n register: 'Crear una cuenta',\n verify: 'Confirma tu correo',\n 'otp-email': 'Entrar con un código',\n otp: 'Escribe tu código',\n forgot: 'Recuperar contraseña',\n reset: 'Elige una contraseña nueva',\n },\n email: 'Correo electrónico',\n password: 'Contraseña',\n newPassword: 'Contraseña nueva',\n passwordHint: 'Entre 10 y 128 caracteres.',\n firstName: 'Nombre',\n lastName: 'Apellido',\n code: 'Código',\n codeSentTo: 'Enviamos un código a {email}. Puede tardar un minuto.',\n submit: {\n login: 'Entrar',\n register: 'Crear cuenta',\n verify: 'Confirmar',\n 'otp-email': 'Enviarme el código',\n otp: 'Entrar',\n forgot: 'Enviarme el código',\n reset: 'Guardar y entrar',\n },\n resend: 'Reenviar código',\n forgotLink: '¿Olvidaste tu contraseña?',\n registerLink: 'Crear una cuenta',\n loginLink: 'Ya tengo cuenta',\n otpLink: 'Entrar con un código por correo',\n backToLogin: 'Volver a entrar con contraseña',\n nothingAvailable: 'Esta tienda no admite iniciar sesión por ahora.',\n errors: {\n invalid_credentials: 'El correo o la contraseña no coinciden.',\n invalid_code: 'El código no es válido o ya venció.',\n email_taken: 'Ya existe una cuenta con este correo. Entra o recupera tu contraseña.',\n rate_limited: 'Demasiados intentos. Espera unos minutos e inténtalo de nuevo.',\n validation: 'Revisa los datos e inténtalo de nuevo.',\n unsupported: 'Esta forma de entrar no está disponible en esta tienda.',\n store_misconfigured: 'No pudimos crear tu cuenta por un problema de configuración de la tienda. Puedes comprar como invitado; ya avisamos a la tienda.',\n unavailable: 'No pudimos completar la acción. Inténtalo de nuevo en un momento.',\n },\n}\n\nconst EN: AccountAuthMessages = {\n titles: {\n login: 'Sign in',\n register: 'Create an account',\n verify: 'Confirm your email',\n 'otp-email': 'Sign in with a code',\n otp: 'Enter your code',\n forgot: 'Reset your password',\n reset: 'Choose a new password',\n },\n email: 'Email',\n password: 'Password',\n newPassword: 'New password',\n passwordHint: 'Between 10 and 128 characters.',\n firstName: 'First name',\n lastName: 'Last name',\n code: 'Code',\n codeSentTo: 'We sent a code to {email}. It can take a minute.',\n submit: {\n login: 'Sign in',\n register: 'Create account',\n verify: 'Confirm',\n 'otp-email': 'Email me the code',\n otp: 'Sign in',\n forgot: 'Email me the code',\n reset: 'Save and sign in',\n },\n resend: 'Resend code',\n forgotLink: 'Forgot your password?',\n registerLink: 'Create an account',\n loginLink: 'I already have an account',\n otpLink: 'Sign in with an emailed code',\n backToLogin: 'Back to password sign-in',\n nothingAvailable: 'This store does not support signing in right now.',\n errors: {\n invalid_credentials: 'The email and password do not match.',\n invalid_code: 'The code is not valid or has expired.',\n email_taken: 'An account with this email already exists. Sign in or reset your password.',\n rate_limited: 'Too many attempts. Wait a few minutes and try again.',\n validation: 'Check the details and try again.',\n unsupported: 'This way of signing in is not available in this store.',\n store_misconfigured: 'We could not create your account because of a store configuration problem. You can check out as a guest; we have already told the store.',\n unavailable: 'We could not complete that. Try again in a moment.',\n },\n}\n\n/** Messages for a locale (`es*` default, `en*`), with optional overrides (nested `titles`/`submit`/`errors` merge). */\nexport function accountAuthMessages(locale?: string | null, overrides?: DeepPartial<AccountAuthMessages> | null): AccountAuthMessages {\n const base = (locale ?? 'es-MX').toLowerCase().startsWith('en') ? EN : ES\n if (!overrides) return base\n return {\n ...base,\n ...(overrides as Partial<AccountAuthMessages>),\n titles: { ...base.titles, ...overrides.titles },\n submit: { ...base.submit, ...overrides.submit },\n errors: { ...base.errors, ...overrides.errors },\n }\n}\n\ntype DeepPartial<T> = { [K in keyof T]?: T[K] extends Record<string, string> ? Partial<T[K]> : T[K] }\n\nexport type AccountAuthClassNames = Partial<Record<'root' | 'title' | 'form' | 'notice' | 'error' | 'actions' | 'submit' | 'links' | 'link', string>> & {\n field?: CheckoutFieldClassNames\n}\n\n/** What `<AccountAuth>` passes to its `form` component: the few props a router `Form` and the HTML `<form>` both accept. */\nexport type AccountFormProps = {\n method?: 'post'\n action?: string\n className?: string\n children?: ReactNode\n /** Loose on purpose: a router `Form` types its ref with its own copy of `@types/react`. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref?: any\n 'data-sf-account-form'?: boolean | string\n}\n\nexport type AccountAuthProps = {\n /** From `loadAuthCapabilities` (the loader). */\n capabilities: CustomerCapabilities\n /** What the action returned (`useActionData()`); drives the next screen and the errors. */\n data?: AuthActionData | null\n /** Where to go after signing in (sent as `next`; the server validates it). */\n next?: string | null\n /** A submit is in flight (`navigation.state !== 'idle'`): disables the buttons. */\n pending?: boolean\n /** First screen. Default `login`, or `otp-email` when the store has no password sign-in. */\n initialView?: AccountAuthView\n /** Form component, e.g. React Router's `Form`, to submit without a reload. It must forward `ref` to the `<form>` (React 19: a prop). Default: the HTML `<form>`. */\n form?: 'form' | ComponentType<AccountFormProps>\n /** `action` of the form (default: the current URL). */\n action?: string\n locale?: string\n messages?: DeepPartial<AccountAuthMessages>\n classNames?: AccountAuthClassNames\n /** Shown above the form (a logo, a welcome text). */\n header?: ReactNode\n}\n\nconst initialOf = (caps: CustomerCapabilities, initialView?: AccountAuthView): AccountAuthView =>\n initialView ?? (caps.password ? 'login' : caps.otp_channels.includes('email') ? 'otp-email' : 'login')\n\n/**\n * The whole account screen. Headless enough to restyle, complete enough to drop in:\n * `export default function Account() { return <AccountAuth capabilities={useLoaderData()} data={useActionData()} form={Form} /> }`.\n */\nexport function AccountAuth({ capabilities, data, next, pending = false, initialView, form: FormTag = 'form', action, locale, messages, classNames: cx = {}, header }: AccountAuthProps) {\n const m = accountAuthMessages(locale, messages)\n const passwordOn = capabilities.password\n const otpOn = capabilities.otp_channels.includes('email')\n const [view, setView] = useState<AccountAuthView>(() => data?.step ?? initialOf(capabilities, initialView))\n const [email, setEmail] = useState(data?.email ?? '')\n const ref = useRef<HTMLFormElement>(null)\n const serverFields = data?.error?.field ? [data.error.field] : null\n const errorText = data?.error ? m.errors[data.error.code] : null\n const v = useFieldErrors(ref, { ...(locale ? { locale } : {}), serverFields, serverMessages: data?.error?.field && errorText ? { [data.error.field]: errorText } : null })\n\n // The action decides the next screen; the email it carries survives it.\n useEffect(() => {\n if (data?.step) setView(data.step)\n if (data?.email) setEmail(data.email)\n }, [data])\n\n const go = (to: AccountAuthView) => {\n v.clear()\n setView(to)\n }\n const fieldProps = { classNames: cx.field, ...(locale ? { locale } : {}) }\n const emailField = (\n <CheckoutField {...fieldProps} name=\"email\" type=\"email\" label={m.email} autoComplete=\"email\" inputMode=\"email\" value={email} onChange={(e) => setEmail(e.currentTarget.value)} error={v.errors.email ?? null} />\n )\n const codeField = (\n <CheckoutField {...fieldProps} name=\"code\" label={m.code} autoComplete=\"one-time-code\" inputMode=\"numeric\" pattern=\"[0-9]*\" error={v.errors.code ?? null} />\n )\n const passwordField = (label: string, autoComplete: string, newPassword: boolean) => (\n <CheckoutField\n {...fieldProps}\n name=\"password\"\n type=\"password\"\n label={label}\n autoComplete={autoComplete}\n error={v.errors.password ?? null}\n {...(newPassword ? { minLength: 10, maxLength: 128, hint: m.passwordHint } : {})}\n />\n )\n const link = (to: AccountAuthView, text: string) => (\n <button type=\"button\" className={cx.link} data-sf-account-link={to} onClick={() => go(to)}>\n {text}\n </button>\n )\n\n let body: ReactNode\n let links: ReactNode = null\n switch (view) {\n case 'register':\n body = (\n <>\n <CheckoutField {...fieldProps} name=\"first_name\" label={m.firstName} autoComplete=\"given-name\" optional />\n <CheckoutField {...fieldProps} name=\"last_name\" label={m.lastName} autoComplete=\"family-name\" optional />\n {emailField}\n {passwordField(m.password, 'new-password', true)}\n </>\n )\n links = link('login', m.loginLink)\n break\n case 'verify':\n case 'otp':\n body = (\n <>\n <p className={cx.notice} data-sf-account-notice>\n {m.codeSentTo.replace('{email}', email)}\n </p>\n <input type=\"hidden\" name=\"email\" value={email} />\n {codeField}\n </>\n )\n links = (\n <>\n {view === 'otp' ? (\n <button type=\"submit\" name=\"intent\" value=\"otp-request\" formNoValidate className={cx.link} data-sf-account-link=\"resend\">\n {m.resend}\n </button>\n ) : null}\n {link('login', m.backToLogin)}\n </>\n )\n break\n case 'otp-email':\n case 'forgot':\n body = emailField\n links = link('login', m.backToLogin)\n break\n case 'reset':\n body = (\n <>\n <p className={cx.notice} data-sf-account-notice>\n {m.codeSentTo.replace('{email}', email)}\n </p>\n <input type=\"hidden\" name=\"email\" value={email} />\n {codeField}\n {passwordField(m.newPassword, 'new-password', true)}\n </>\n )\n links = link('login', m.backToLogin)\n break\n default:\n body = (\n <>\n {emailField}\n {passwordField(m.password, 'current-password', false)}\n </>\n )\n links = (\n <>\n {otpOn ? link('forgot', m.forgotLink) : null}\n {link('register', m.registerLink)}\n {otpOn ? link('otp-email', m.otpLink) : null}\n </>\n )\n }\n\n const intent = { login: 'login', register: 'register', verify: 'verify', 'otp-email': 'otp-request', otp: 'otp-login', forgot: 'forgot', reset: 'reset' }[view]\n // Without password accounts the password views do not exist; only the code sign-in does.\n const available = view === 'login' || view === 'register' || view === 'forgot' || view === 'reset' || view === 'verify' ? passwordOn : otpOn\n const showSummary = !data?.error?.field\n const title = m.titles[view]\n if (!available && !passwordOn && !otpOn) {\n return (\n <section className={cx.root} data-sf-account-auth data-sf-account-view=\"unavailable\">\n <p className={cx.notice} role=\"status\">\n {capabilities.unavailable_reason === 'missing_scope' ? m.errors.store_misconfigured : m.nothingAvailable}\n </p>\n </section>\n )\n }\n return (\n <section className={cx.root} data-sf-account-auth data-sf-account-view={view} aria-labelledby=\"sf-account-title\">\n {header}\n <h1 id=\"sf-account-title\" className={cx.title}>\n {title}\n </h1>\n <FormTag ref={ref as never} method=\"post\" {...(action ? { action } : {})} className={cx.form} data-sf-account-form>\n <ErrorSummary items={v.summary} focusKey={v.summaryKey} {...(locale ? { locale } : {})} />\n {errorText && showSummary ? (\n <p role=\"alert\" className={cx.error} data-sf-account-error={data!.error!.code}>\n {errorText}\n </p>\n ) : null}\n {next ? <input type=\"hidden\" name=\"next\" value={next} /> : null}\n {body}\n <div className={cx.actions}>\n <button type=\"submit\" name=\"intent\" value={intent} disabled={pending} className={cx.submit} data-sf-account-submit>\n {m.submit[view]}\n </button>\n </div>\n <div className={cx.links} data-sf-account-links>\n {links}\n </div>\n </FormTag>\n </section>\n )\n}\n"]}
@@ -2,8 +2,8 @@ import * as react from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
3
  import { CustomerCapabilities } from '@asteby/storefront';
4
4
  import { a as CheckoutFieldClassNames } from './fields-vnMUi2HB.cjs';
5
- import { A as AuthActionData, c as AuthStep, a as AuthErrorCode } from './types-HcEUd9hW.cjs';
6
- export { b as AuthIntent } from './types-HcEUd9hW.cjs';
5
+ import { A as AuthActionData, c as AuthStep, a as AuthErrorCode } from './types-D7pVK0GK.cjs';
6
+ export { b as AuthIntent } from './types-D7pVK0GK.cjs';
7
7
 
8
8
  type AccountAuthView = 'login' | 'register' | 'otp-email' | 'forgot' | AuthStep;
9
9
  type AccountAuthMessages = {
package/dist/account.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as react from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
3
  import { CustomerCapabilities } from '@asteby/storefront';
4
4
  import { a as CheckoutFieldClassNames } from './fields-vnMUi2HB.js';
5
- import { A as AuthActionData, c as AuthStep, a as AuthErrorCode } from './types-HcEUd9hW.js';
6
- export { b as AuthIntent } from './types-HcEUd9hW.js';
5
+ import { A as AuthActionData, c as AuthStep, a as AuthErrorCode } from './types-D7pVK0GK.js';
6
+ export { b as AuthIntent } from './types-D7pVK0GK.js';
7
7
 
8
8
  type AccountAuthView = 'login' | 'register' | 'otp-email' | 'forgot' | AuthStep;
9
9
  type AccountAuthMessages = {
package/dist/account.js CHANGED
@@ -43,6 +43,7 @@ var ES = {
43
43
  rate_limited: "Demasiados intentos. Espera unos minutos e int\xE9ntalo de nuevo.",
44
44
  validation: "Revisa los datos e int\xE9ntalo de nuevo.",
45
45
  unsupported: "Esta forma de entrar no est\xE1 disponible en esta tienda.",
46
+ store_misconfigured: "No pudimos crear tu cuenta por un problema de configuraci\xF3n de la tienda. Puedes comprar como invitado; ya avisamos a la tienda.",
46
47
  unavailable: "No pudimos completar la acci\xF3n. Int\xE9ntalo de nuevo en un momento."
47
48
  }
48
49
  };
@@ -87,6 +88,7 @@ var EN = {
87
88
  rate_limited: "Too many attempts. Wait a few minutes and try again.",
88
89
  validation: "Check the details and try again.",
89
90
  unsupported: "This way of signing in is not available in this store.",
91
+ store_misconfigured: "We could not create your account because of a store configuration problem. You can check out as a guest; we have already told the store.",
90
92
  unavailable: "We could not complete that. Try again in a moment."
91
93
  }
92
94
  };
@@ -190,7 +192,7 @@ function AccountAuth({ capabilities, data, next, pending = false, initialView, f
190
192
  const showSummary = !data?.error?.field;
191
193
  const title = m.titles[view];
192
194
  if (!available && !passwordOn && !otpOn) {
193
- return /* @__PURE__ */ jsx("section", { className: cx.root, "data-sf-account-auth": true, "data-sf-account-view": "unavailable", children: /* @__PURE__ */ jsx("p", { className: cx.notice, role: "status", children: m.nothingAvailable }) });
195
+ return /* @__PURE__ */ jsx("section", { className: cx.root, "data-sf-account-auth": true, "data-sf-account-view": "unavailable", children: /* @__PURE__ */ jsx("p", { className: cx.notice, role: "status", children: capabilities.unavailable_reason === "missing_scope" ? m.errors.store_misconfigured : m.nothingAvailable }) });
194
196
  }
195
197
  return /* @__PURE__ */ jsxs("section", { className: cx.root, "data-sf-account-auth": true, "data-sf-account-view": view, "aria-labelledby": "sf-account-title", children: [
196
198
  header,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/account/account-auth.tsx"],"names":[],"mappings":";;;;AAqCA,IAAM,EAAA,GAA0B;AAAA,EAC9B,MAAA,EAAQ;AAAA,IACN,KAAA,EAAO,oBAAA;AAAA,IACP,QAAA,EAAU,kBAAA;AAAA,IACV,MAAA,EAAQ,oBAAA;AAAA,IACR,WAAA,EAAa,yBAAA;AAAA,IACb,GAAA,EAAK,sBAAA;AAAA,IACL,MAAA,EAAQ,yBAAA;AAAA,IACR,KAAA,EAAO;AAAA,GACT;AAAA,EACA,KAAA,EAAO,uBAAA;AAAA,EACP,QAAA,EAAU,eAAA;AAAA,EACV,WAAA,EAAa,qBAAA;AAAA,EACb,YAAA,EAAc,4BAAA;AAAA,EACd,SAAA,EAAW,QAAA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AA,EAAa,GAAI,MAAA,GAAS,EAAE,MAAA,EAAO,GAAI,EAAC,EAAI,CAAA;AAAA,MACvF,SAAA,IAAa,WAAA,mBACZ,GAAA,CAAC,GAAA,EAAA,EAAE,MAAK,OAAA,EAAQ,SAAA,EAAW,EAAA,CAAG,KAAA,EAAO,uBAAA,EAAuB,IAAA,CAAM,KAAA,CAAO,IAAA,EACtE,qBACH,CAAA,GACE,IAAA;AAAA,MACH,IAAA,uBAAQ,OAAA,EAAA,EAAM,IAAA,EAAK,UAAS,IAAA,EAAK,MAAA,EAAO,KAAA,EAAO,IAAA,EAAM,CAAA,GAAK,IAAA;AAAA,MAC1D,IAAA;AAAA,sBACD,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,OAAA,EACjB,8BAAC,QAAA,EAAA,EAAO,IAAA,EAAK,QAAA,EAAS,IAAA,EAAK,QAAA,EAAS,KAAA,EAAO,QAAQ,QAAA,EAAU,OAAA,EAAS,SAAA,EAAW,EAAA,CAAG,MAAA,EAAQ,wBAAA,EAAsB,MAC/G,QAAA,EAAA,CAAA,CAAE,MAAA,CAAO,IAAI,CAAA,EAChB,CAAA,EACF,CAAA;AAAA,0BACC,KAAA,EAAA,EAAI,SAAA,EAAW,GAAG,KAAA,EAAO,uBAAA,EAAqB,MAC5C,QAAA,EAAA,KAAA,EACH;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"account.js","sourcesContent":["/**\n * The account screen: sign in with password, create an account, verify the emailed code, sign in with a code and\n * recover a forgotten password, in one `<form method=\"post\">` driven by `createAuthAction` (`./server`). What the store\n * offers comes from `loadAuthCapabilities`; the form shows only that. Plain HTML: it works without JavaScript for the\n * password sign-in and the steps the action sends back; the view switches (links) need JavaScript.\n *\n * Styling: `data-sf-account-*` attributes and `classNames` slots, fields reuse `CheckoutField` (and `checkout.css`);\n * `account.css` is an optional neutral sheet. Texts are Spanish by default, English with `locale=\"en\"`, any with `messages`.\n */\nimport { useEffect, useRef, useState, type ComponentType, type ReactNode } from 'react'\nimport type { CustomerCapabilities } from '@asteby/storefront'\nimport { CheckoutField, ErrorSummary, useFieldErrors, type CheckoutFieldClassNames } from '../checkout/fields.js'\nimport type { AuthActionData, AuthErrorCode, AuthStep } from './types.js'\n\nexport type AccountAuthView = 'login' | 'register' | 'otp-email' | 'forgot' | AuthStep\n\nexport type AccountAuthMessages = {\n titles: Record<AccountAuthView, string>\n email: string\n password: string\n newPassword: string\n passwordHint: string\n firstName: string\n lastName: string\n code: string\n codeSentTo: string\n submit: Record<AccountAuthView, string>\n resend: string\n forgotLink: string\n registerLink: string\n loginLink: string\n otpLink: string\n backToLogin: string\n nothingAvailable: string\n errors: Record<AuthErrorCode, string>\n}\n\nconst ES: AccountAuthMessages = {\n titles: {\n login: 'Entrar a tu cuenta',\n register: 'Crear una cuenta',\n verify: 'Confirma tu correo',\n 'otp-email': 'Entrar con un código',\n otp: 'Escribe tu código',\n forgot: 'Recuperar contraseña',\n reset: 'Elige una contraseña nueva',\n },\n email: 'Correo electrónico',\n password: 'Contraseña',\n newPassword: 'Contraseña nueva',\n passwordHint: 'Entre 10 y 128 caracteres.',\n firstName: 'Nombre',\n lastName: 'Apellido',\n code: 'Código',\n codeSentTo: 'Enviamos un código a {email}. Puede tardar un minuto.',\n submit: {\n login: 'Entrar',\n register: 'Crear cuenta',\n verify: 'Confirmar',\n 'otp-email': 'Enviarme el código',\n otp: 'Entrar',\n forgot: 'Enviarme el código',\n reset: 'Guardar y entrar',\n },\n resend: 'Reenviar código',\n forgotLink: '¿Olvidaste tu contraseña?',\n registerLink: 'Crear una cuenta',\n loginLink: 'Ya tengo cuenta',\n otpLink: 'Entrar con un código por correo',\n backToLogin: 'Volver a entrar con contraseña',\n nothingAvailable: 'Esta tienda no admite iniciar sesión por ahora.',\n errors: {\n invalid_credentials: 'El correo o la contraseña no coinciden.',\n invalid_code: 'El código no es válido o ya venció.',\n email_taken: 'Ya existe una cuenta con este correo. Entra o recupera tu contraseña.',\n rate_limited: 'Demasiados intentos. Espera unos minutos e inténtalo de nuevo.',\n validation: 'Revisa los datos e inténtalo de nuevo.',\n unsupported: 'Esta forma de entrar no está disponible en esta tienda.',\n unavailable: 'No pudimos completar la acción. Inténtalo de nuevo en un momento.',\n },\n}\n\nconst EN: AccountAuthMessages = {\n titles: {\n login: 'Sign in',\n register: 'Create an account',\n verify: 'Confirm your email',\n 'otp-email': 'Sign in with a code',\n otp: 'Enter your code',\n forgot: 'Reset your password',\n reset: 'Choose a new password',\n },\n email: 'Email',\n password: 'Password',\n newPassword: 'New password',\n passwordHint: 'Between 10 and 128 characters.',\n firstName: 'First name',\n lastName: 'Last name',\n code: 'Code',\n codeSentTo: 'We sent a code to {email}. It can take a minute.',\n submit: {\n login: 'Sign in',\n register: 'Create account',\n verify: 'Confirm',\n 'otp-email': 'Email me the code',\n otp: 'Sign in',\n forgot: 'Email me the code',\n reset: 'Save and sign in',\n },\n resend: 'Resend code',\n forgotLink: 'Forgot your password?',\n registerLink: 'Create an account',\n loginLink: 'I already have an account',\n otpLink: 'Sign in with an emailed code',\n backToLogin: 'Back to password sign-in',\n nothingAvailable: 'This store does not support signing in right now.',\n errors: {\n invalid_credentials: 'The email and password do not match.',\n invalid_code: 'The code is not valid or has expired.',\n email_taken: 'An account with this email already exists. Sign in or reset your password.',\n rate_limited: 'Too many attempts. Wait a few minutes and try again.',\n validation: 'Check the details and try again.',\n unsupported: 'This way of signing in is not available in this store.',\n unavailable: 'We could not complete that. Try again in a moment.',\n },\n}\n\n/** Messages for a locale (`es*` default, `en*`), with optional overrides (nested `titles`/`submit`/`errors` merge). */\nexport function accountAuthMessages(locale?: string | null, overrides?: DeepPartial<AccountAuthMessages> | null): AccountAuthMessages {\n const base = (locale ?? 'es-MX').toLowerCase().startsWith('en') ? EN : ES\n if (!overrides) return base\n return {\n ...base,\n ...(overrides as Partial<AccountAuthMessages>),\n titles: { ...base.titles, ...overrides.titles },\n submit: { ...base.submit, ...overrides.submit },\n errors: { ...base.errors, ...overrides.errors },\n }\n}\n\ntype DeepPartial<T> = { [K in keyof T]?: T[K] extends Record<string, string> ? Partial<T[K]> : T[K] }\n\nexport type AccountAuthClassNames = Partial<Record<'root' | 'title' | 'form' | 'notice' | 'error' | 'actions' | 'submit' | 'links' | 'link', string>> & {\n field?: CheckoutFieldClassNames\n}\n\n/** What `<AccountAuth>` passes to its `form` component: the few props a router `Form` and the HTML `<form>` both accept. */\nexport type AccountFormProps = {\n method?: 'post'\n action?: string\n className?: string\n children?: ReactNode\n /** Loose on purpose: a router `Form` types its ref with its own copy of `@types/react`. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref?: any\n 'data-sf-account-form'?: boolean | string\n}\n\nexport type AccountAuthProps = {\n /** From `loadAuthCapabilities` (the loader). */\n capabilities: CustomerCapabilities\n /** What the action returned (`useActionData()`); drives the next screen and the errors. */\n data?: AuthActionData | null\n /** Where to go after signing in (sent as `next`; the server validates it). */\n next?: string | null\n /** A submit is in flight (`navigation.state !== 'idle'`): disables the buttons. */\n pending?: boolean\n /** First screen. Default `login`, or `otp-email` when the store has no password sign-in. */\n initialView?: AccountAuthView\n /** Form component, e.g. React Router's `Form`, to submit without a reload. It must forward `ref` to the `<form>` (React 19: a prop). Default: the HTML `<form>`. */\n form?: 'form' | ComponentType<AccountFormProps>\n /** `action` of the form (default: the current URL). */\n action?: string\n locale?: string\n messages?: DeepPartial<AccountAuthMessages>\n classNames?: AccountAuthClassNames\n /** Shown above the form (a logo, a welcome text). */\n header?: ReactNode\n}\n\nconst initialOf = (caps: CustomerCapabilities, initialView?: AccountAuthView): AccountAuthView =>\n initialView ?? (caps.password ? 'login' : caps.otp_channels.includes('email') ? 'otp-email' : 'login')\n\n/**\n * The whole account screen. Headless enough to restyle, complete enough to drop in:\n * `export default function Account() { return <AccountAuth capabilities={useLoaderData()} data={useActionData()} form={Form} /> }`.\n */\nexport function AccountAuth({ capabilities, data, next, pending = false, initialView, form: FormTag = 'form', action, locale, messages, classNames: cx = {}, header }: AccountAuthProps) {\n const m = accountAuthMessages(locale, messages)\n const passwordOn = capabilities.password\n const otpOn = capabilities.otp_channels.includes('email')\n const [view, setView] = useState<AccountAuthView>(() => data?.step ?? initialOf(capabilities, initialView))\n const [email, setEmail] = useState(data?.email ?? '')\n const ref = useRef<HTMLFormElement>(null)\n const serverFields = data?.error?.field ? [data.error.field] : null\n const errorText = data?.error ? m.errors[data.error.code] : null\n const v = useFieldErrors(ref, { ...(locale ? { locale } : {}), serverFields, serverMessages: data?.error?.field && errorText ? { [data.error.field]: errorText } : null })\n\n // The action decides the next screen; the email it carries survives it.\n useEffect(() => {\n if (data?.step) setView(data.step)\n if (data?.email) setEmail(data.email)\n }, [data])\n\n const go = (to: AccountAuthView) => {\n v.clear()\n setView(to)\n }\n const fieldProps = { classNames: cx.field, ...(locale ? { locale } : {}) }\n const emailField = (\n <CheckoutField {...fieldProps} name=\"email\" type=\"email\" label={m.email} autoComplete=\"email\" inputMode=\"email\" value={email} onChange={(e) => setEmail(e.currentTarget.value)} error={v.errors.email ?? null} />\n )\n const codeField = (\n <CheckoutField {...fieldProps} name=\"code\" label={m.code} autoComplete=\"one-time-code\" inputMode=\"numeric\" pattern=\"[0-9]*\" error={v.errors.code ?? null} />\n )\n const passwordField = (label: string, autoComplete: string, newPassword: boolean) => (\n <CheckoutField\n {...fieldProps}\n name=\"password\"\n type=\"password\"\n label={label}\n autoComplete={autoComplete}\n error={v.errors.password ?? null}\n {...(newPassword ? { minLength: 10, maxLength: 128, hint: m.passwordHint } : {})}\n />\n )\n const link = (to: AccountAuthView, text: string) => (\n <button type=\"button\" className={cx.link} data-sf-account-link={to} onClick={() => go(to)}>\n {text}\n </button>\n )\n\n let body: ReactNode\n let links: ReactNode = null\n switch (view) {\n case 'register':\n body = (\n <>\n <CheckoutField {...fieldProps} name=\"first_name\" label={m.firstName} autoComplete=\"given-name\" optional />\n <CheckoutField {...fieldProps} name=\"last_name\" label={m.lastName} autoComplete=\"family-name\" optional />\n {emailField}\n {passwordField(m.password, 'new-password', true)}\n </>\n )\n links = link('login', m.loginLink)\n break\n case 'verify':\n case 'otp':\n body = (\n <>\n <p className={cx.notice} data-sf-account-notice>\n {m.codeSentTo.replace('{email}', email)}\n </p>\n <input type=\"hidden\" name=\"email\" value={email} />\n {codeField}\n </>\n )\n links = (\n <>\n {view === 'otp' ? (\n <button type=\"submit\" name=\"intent\" value=\"otp-request\" formNoValidate className={cx.link} data-sf-account-link=\"resend\">\n {m.resend}\n </button>\n ) : null}\n {link('login', m.backToLogin)}\n </>\n )\n break\n case 'otp-email':\n case 'forgot':\n body = emailField\n links = link('login', m.backToLogin)\n break\n case 'reset':\n body = (\n <>\n <p className={cx.notice} data-sf-account-notice>\n {m.codeSentTo.replace('{email}', email)}\n </p>\n <input type=\"hidden\" name=\"email\" value={email} />\n {codeField}\n {passwordField(m.newPassword, 'new-password', true)}\n </>\n )\n links = link('login', m.backToLogin)\n break\n default:\n body = (\n <>\n {emailField}\n {passwordField(m.password, 'current-password', false)}\n </>\n )\n links = (\n <>\n {otpOn ? link('forgot', m.forgotLink) : null}\n {link('register', m.registerLink)}\n {otpOn ? link('otp-email', m.otpLink) : null}\n </>\n )\n }\n\n const intent = { login: 'login', register: 'register', verify: 'verify', 'otp-email': 'otp-request', otp: 'otp-login', forgot: 'forgot', reset: 'reset' }[view]\n // Without password accounts the password views do not exist; only the code sign-in does.\n const available = view === 'login' || view === 'register' || view === 'forgot' || view === 'reset' || view === 'verify' ? passwordOn : otpOn\n const showSummary = !data?.error?.field\n const title = m.titles[view]\n if (!available && !passwordOn && !otpOn) {\n return (\n <section className={cx.root} data-sf-account-auth data-sf-account-view=\"unavailable\">\n <p className={cx.notice} role=\"status\">\n {m.nothingAvailable}\n </p>\n </section>\n )\n }\n return (\n <section className={cx.root} data-sf-account-auth data-sf-account-view={view} aria-labelledby=\"sf-account-title\">\n {header}\n <h1 id=\"sf-account-title\" className={cx.title}>\n {title}\n </h1>\n <FormTag ref={ref as never} method=\"post\" {...(action ? { action } : {})} className={cx.form} data-sf-account-form>\n <ErrorSummary items={v.summary} focusKey={v.summaryKey} {...(locale ? { locale } : {})} />\n {errorText && showSummary ? (\n <p role=\"alert\" className={cx.error} data-sf-account-error={data!.error!.code}>\n {errorText}\n </p>\n ) : null}\n {next ? <input type=\"hidden\" name=\"next\" value={next} /> : null}\n {body}\n <div className={cx.actions}>\n <button type=\"submit\" name=\"intent\" value={intent} disabled={pending} className={cx.submit} data-sf-account-submit>\n {m.submit[view]}\n </button>\n </div>\n <div className={cx.links} data-sf-account-links>\n {links}\n </div>\n </FormTag>\n </section>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/account/account-auth.tsx"],"names":[],"mappings":";;;;AAqCA,IAAM,EAAA,GAA0B;AAAA,EAC9B,MAAA,EAAQ;AAAA,IACN,KAAA,EAAO,oBAAA;AAAA,IACP,QAAA,EAAU,kBAAA;AAAA,IACV,MAAA,EAAQ,oBAAA;AAAA,IACR,WAAA,EAAa,yBAAA;AAAA,IACb,GAAA,EAAK,sBAAA;AAAA,IACL,MAAA,EAAQ,yBAAA;AAAA,IACR,KAAA,EAAO;AAAA,GACT;AAAA,EACA,KAAA,EAAO,uBAAA;AAAA,EACP,QAAA,EAAU,eAAA;AAAA,EACV,WAAA,EAAa,qBAAA;AAAA,EACb,YAAA,EAAc,4BAAA;AAAA,EACd,SAAA,EAAW,QAAA;AAAA,EACX,QAAA,EAAU,UAAA;AAAA,EACV,IAAA,EAAM,WAAA;AAAA,EACN,UAAA,EAAY,0DAAA;AAAA,EACZ,MAAA,EAAQ;AAAA,IACN,KAAA,EAAO,QAAA;AAAA,IACP,QAAA,EAAU,cAAA;AAAA,IACV,MAAA,EAAQ,WAAA;AAAA,IACR,WAAA,EAAa,uBAAA;AAAA,IACb,GAAA,EAAK,QAAA;AAAA,IACL,MAAA,EAAQ,uBAAA;AAAA,IACR,KAAA,EAAO;AAAA,GACT;AAAA,EACA,MAAA,EAAQ,oBAAA;AAAA,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,uBAAA,EAAuB,IAAA,CAAM,KAAA,CAAO,IAAA,EACtE,qBACH,CAAA,GACE,IAAA;AAAA,MACH,IAAA,uBAAQ,OAAA,EAAA,EAAM,IAAA,EAAK,UAAS,IAAA,EAAK,MAAA,EAAO,KAAA,EAAO,IAAA,EAAM,CAAA,GAAK,IAAA;AAAA,MAC1D,IAAA;AAAA,sBACD,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,OAAA,EACjB,8BAAC,QAAA,EAAA,EAAO,IAAA,EAAK,QAAA,EAAS,IAAA,EAAK,QAAA,EAAS,KAAA,EAAO,QAAQ,QAAA,EAAU,OAAA,EAAS,SAAA,EAAW,EAAA,CAAG,MAAA,EAAQ,wBAAA,EAAsB,MAC/G,QAAA,EAAA,CAAA,CAAE,MAAA,CAAO,IAAI,CAAA,EAChB,CAAA,EACF,CAAA;AAAA,0BACC,KAAA,EAAA,EAAI,SAAA,EAAW,GAAG,KAAA,EAAO,uBAAA,EAAqB,MAC5C,QAAA,EAAA,KAAA,EACH;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"account.js","sourcesContent":["/**\n * The account screen: sign in with password, create an account, verify the emailed code, sign in with a code and\n * recover a forgotten password, in one `<form method=\"post\">` driven by `createAuthAction` (`./server`). What the store\n * offers comes from `loadAuthCapabilities`; the form shows only that. Plain HTML: it works without JavaScript for the\n * password sign-in and the steps the action sends back; the view switches (links) need JavaScript.\n *\n * Styling: `data-sf-account-*` attributes and `classNames` slots, fields reuse `CheckoutField` (and `checkout.css`);\n * `account.css` is an optional neutral sheet. Texts are Spanish by default, English with `locale=\"en\"`, any with `messages`.\n */\nimport { useEffect, useRef, useState, type ComponentType, type ReactNode } from 'react'\nimport type { CustomerCapabilities } from '@asteby/storefront'\nimport { CheckoutField, ErrorSummary, useFieldErrors, type CheckoutFieldClassNames } from '../checkout/fields.js'\nimport type { AuthActionData, AuthErrorCode, AuthStep } from './types.js'\n\nexport type AccountAuthView = 'login' | 'register' | 'otp-email' | 'forgot' | AuthStep\n\nexport type AccountAuthMessages = {\n titles: Record<AccountAuthView, string>\n email: string\n password: string\n newPassword: string\n passwordHint: string\n firstName: string\n lastName: string\n code: string\n codeSentTo: string\n submit: Record<AccountAuthView, string>\n resend: string\n forgotLink: string\n registerLink: string\n loginLink: string\n otpLink: string\n backToLogin: string\n nothingAvailable: string\n errors: Record<AuthErrorCode, string>\n}\n\nconst ES: AccountAuthMessages = {\n titles: {\n login: 'Entrar a tu cuenta',\n register: 'Crear una cuenta',\n verify: 'Confirma tu correo',\n 'otp-email': 'Entrar con un código',\n otp: 'Escribe tu código',\n forgot: 'Recuperar contraseña',\n reset: 'Elige una contraseña nueva',\n },\n email: 'Correo electrónico',\n password: 'Contraseña',\n newPassword: 'Contraseña nueva',\n passwordHint: 'Entre 10 y 128 caracteres.',\n firstName: 'Nombre',\n lastName: 'Apellido',\n code: 'Código',\n codeSentTo: 'Enviamos un código a {email}. Puede tardar un minuto.',\n submit: {\n login: 'Entrar',\n register: 'Crear cuenta',\n verify: 'Confirmar',\n 'otp-email': 'Enviarme el código',\n otp: 'Entrar',\n forgot: 'Enviarme el código',\n reset: 'Guardar y entrar',\n },\n resend: 'Reenviar código',\n forgotLink: '¿Olvidaste tu contraseña?',\n registerLink: 'Crear una cuenta',\n loginLink: 'Ya tengo cuenta',\n otpLink: 'Entrar con un código por correo',\n backToLogin: 'Volver a entrar con contraseña',\n nothingAvailable: 'Esta tienda no admite iniciar sesión por ahora.',\n errors: {\n invalid_credentials: 'El correo o la contraseña no coinciden.',\n invalid_code: 'El código no es válido o ya venció.',\n email_taken: 'Ya existe una cuenta con este correo. Entra o recupera tu contraseña.',\n rate_limited: 'Demasiados intentos. Espera unos minutos e inténtalo de nuevo.',\n validation: 'Revisa los datos e inténtalo de nuevo.',\n unsupported: 'Esta forma de entrar no está disponible en esta tienda.',\n store_misconfigured: 'No pudimos crear tu cuenta por un problema de configuración de la tienda. Puedes comprar como invitado; ya avisamos a la tienda.',\n unavailable: 'No pudimos completar la acción. Inténtalo de nuevo en un momento.',\n },\n}\n\nconst EN: AccountAuthMessages = {\n titles: {\n login: 'Sign in',\n register: 'Create an account',\n verify: 'Confirm your email',\n 'otp-email': 'Sign in with a code',\n otp: 'Enter your code',\n forgot: 'Reset your password',\n reset: 'Choose a new password',\n },\n email: 'Email',\n password: 'Password',\n newPassword: 'New password',\n passwordHint: 'Between 10 and 128 characters.',\n firstName: 'First name',\n lastName: 'Last name',\n code: 'Code',\n codeSentTo: 'We sent a code to {email}. It can take a minute.',\n submit: {\n login: 'Sign in',\n register: 'Create account',\n verify: 'Confirm',\n 'otp-email': 'Email me the code',\n otp: 'Sign in',\n forgot: 'Email me the code',\n reset: 'Save and sign in',\n },\n resend: 'Resend code',\n forgotLink: 'Forgot your password?',\n registerLink: 'Create an account',\n loginLink: 'I already have an account',\n otpLink: 'Sign in with an emailed code',\n backToLogin: 'Back to password sign-in',\n nothingAvailable: 'This store does not support signing in right now.',\n errors: {\n invalid_credentials: 'The email and password do not match.',\n invalid_code: 'The code is not valid or has expired.',\n email_taken: 'An account with this email already exists. Sign in or reset your password.',\n rate_limited: 'Too many attempts. Wait a few minutes and try again.',\n validation: 'Check the details and try again.',\n unsupported: 'This way of signing in is not available in this store.',\n store_misconfigured: 'We could not create your account because of a store configuration problem. You can check out as a guest; we have already told the store.',\n unavailable: 'We could not complete that. Try again in a moment.',\n },\n}\n\n/** Messages for a locale (`es*` default, `en*`), with optional overrides (nested `titles`/`submit`/`errors` merge). */\nexport function accountAuthMessages(locale?: string | null, overrides?: DeepPartial<AccountAuthMessages> | null): AccountAuthMessages {\n const base = (locale ?? 'es-MX').toLowerCase().startsWith('en') ? EN : ES\n if (!overrides) return base\n return {\n ...base,\n ...(overrides as Partial<AccountAuthMessages>),\n titles: { ...base.titles, ...overrides.titles },\n submit: { ...base.submit, ...overrides.submit },\n errors: { ...base.errors, ...overrides.errors },\n }\n}\n\ntype DeepPartial<T> = { [K in keyof T]?: T[K] extends Record<string, string> ? Partial<T[K]> : T[K] }\n\nexport type AccountAuthClassNames = Partial<Record<'root' | 'title' | 'form' | 'notice' | 'error' | 'actions' | 'submit' | 'links' | 'link', string>> & {\n field?: CheckoutFieldClassNames\n}\n\n/** What `<AccountAuth>` passes to its `form` component: the few props a router `Form` and the HTML `<form>` both accept. */\nexport type AccountFormProps = {\n method?: 'post'\n action?: string\n className?: string\n children?: ReactNode\n /** Loose on purpose: a router `Form` types its ref with its own copy of `@types/react`. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref?: any\n 'data-sf-account-form'?: boolean | string\n}\n\nexport type AccountAuthProps = {\n /** From `loadAuthCapabilities` (the loader). */\n capabilities: CustomerCapabilities\n /** What the action returned (`useActionData()`); drives the next screen and the errors. */\n data?: AuthActionData | null\n /** Where to go after signing in (sent as `next`; the server validates it). */\n next?: string | null\n /** A submit is in flight (`navigation.state !== 'idle'`): disables the buttons. */\n pending?: boolean\n /** First screen. Default `login`, or `otp-email` when the store has no password sign-in. */\n initialView?: AccountAuthView\n /** Form component, e.g. React Router's `Form`, to submit without a reload. It must forward `ref` to the `<form>` (React 19: a prop). Default: the HTML `<form>`. */\n form?: 'form' | ComponentType<AccountFormProps>\n /** `action` of the form (default: the current URL). */\n action?: string\n locale?: string\n messages?: DeepPartial<AccountAuthMessages>\n classNames?: AccountAuthClassNames\n /** Shown above the form (a logo, a welcome text). */\n header?: ReactNode\n}\n\nconst initialOf = (caps: CustomerCapabilities, initialView?: AccountAuthView): AccountAuthView =>\n initialView ?? (caps.password ? 'login' : caps.otp_channels.includes('email') ? 'otp-email' : 'login')\n\n/**\n * The whole account screen. Headless enough to restyle, complete enough to drop in:\n * `export default function Account() { return <AccountAuth capabilities={useLoaderData()} data={useActionData()} form={Form} /> }`.\n */\nexport function AccountAuth({ capabilities, data, next, pending = false, initialView, form: FormTag = 'form', action, locale, messages, classNames: cx = {}, header }: AccountAuthProps) {\n const m = accountAuthMessages(locale, messages)\n const passwordOn = capabilities.password\n const otpOn = capabilities.otp_channels.includes('email')\n const [view, setView] = useState<AccountAuthView>(() => data?.step ?? initialOf(capabilities, initialView))\n const [email, setEmail] = useState(data?.email ?? '')\n const ref = useRef<HTMLFormElement>(null)\n const serverFields = data?.error?.field ? [data.error.field] : null\n const errorText = data?.error ? m.errors[data.error.code] : null\n const v = useFieldErrors(ref, { ...(locale ? { locale } : {}), serverFields, serverMessages: data?.error?.field && errorText ? { [data.error.field]: errorText } : null })\n\n // The action decides the next screen; the email it carries survives it.\n useEffect(() => {\n if (data?.step) setView(data.step)\n if (data?.email) setEmail(data.email)\n }, [data])\n\n const go = (to: AccountAuthView) => {\n v.clear()\n setView(to)\n }\n const fieldProps = { classNames: cx.field, ...(locale ? { locale } : {}) }\n const emailField = (\n <CheckoutField {...fieldProps} name=\"email\" type=\"email\" label={m.email} autoComplete=\"email\" inputMode=\"email\" value={email} onChange={(e) => setEmail(e.currentTarget.value)} error={v.errors.email ?? null} />\n )\n const codeField = (\n <CheckoutField {...fieldProps} name=\"code\" label={m.code} autoComplete=\"one-time-code\" inputMode=\"numeric\" pattern=\"[0-9]*\" error={v.errors.code ?? null} />\n )\n const passwordField = (label: string, autoComplete: string, newPassword: boolean) => (\n <CheckoutField\n {...fieldProps}\n name=\"password\"\n type=\"password\"\n label={label}\n autoComplete={autoComplete}\n error={v.errors.password ?? null}\n {...(newPassword ? { minLength: 10, maxLength: 128, hint: m.passwordHint } : {})}\n />\n )\n const link = (to: AccountAuthView, text: string) => (\n <button type=\"button\" className={cx.link} data-sf-account-link={to} onClick={() => go(to)}>\n {text}\n </button>\n )\n\n let body: ReactNode\n let links: ReactNode = null\n switch (view) {\n case 'register':\n body = (\n <>\n <CheckoutField {...fieldProps} name=\"first_name\" label={m.firstName} autoComplete=\"given-name\" optional />\n <CheckoutField {...fieldProps} name=\"last_name\" label={m.lastName} autoComplete=\"family-name\" optional />\n {emailField}\n {passwordField(m.password, 'new-password', true)}\n </>\n )\n links = link('login', m.loginLink)\n break\n case 'verify':\n case 'otp':\n body = (\n <>\n <p className={cx.notice} data-sf-account-notice>\n {m.codeSentTo.replace('{email}', email)}\n </p>\n <input type=\"hidden\" name=\"email\" value={email} />\n {codeField}\n </>\n )\n links = (\n <>\n {view === 'otp' ? (\n <button type=\"submit\" name=\"intent\" value=\"otp-request\" formNoValidate className={cx.link} data-sf-account-link=\"resend\">\n {m.resend}\n </button>\n ) : null}\n {link('login', m.backToLogin)}\n </>\n )\n break\n case 'otp-email':\n case 'forgot':\n body = emailField\n links = link('login', m.backToLogin)\n break\n case 'reset':\n body = (\n <>\n <p className={cx.notice} data-sf-account-notice>\n {m.codeSentTo.replace('{email}', email)}\n </p>\n <input type=\"hidden\" name=\"email\" value={email} />\n {codeField}\n {passwordField(m.newPassword, 'new-password', true)}\n </>\n )\n links = link('login', m.backToLogin)\n break\n default:\n body = (\n <>\n {emailField}\n {passwordField(m.password, 'current-password', false)}\n </>\n )\n links = (\n <>\n {otpOn ? link('forgot', m.forgotLink) : null}\n {link('register', m.registerLink)}\n {otpOn ? link('otp-email', m.otpLink) : null}\n </>\n )\n }\n\n const intent = { login: 'login', register: 'register', verify: 'verify', 'otp-email': 'otp-request', otp: 'otp-login', forgot: 'forgot', reset: 'reset' }[view]\n // Without password accounts the password views do not exist; only the code sign-in does.\n const available = view === 'login' || view === 'register' || view === 'forgot' || view === 'reset' || view === 'verify' ? passwordOn : otpOn\n const showSummary = !data?.error?.field\n const title = m.titles[view]\n if (!available && !passwordOn && !otpOn) {\n return (\n <section className={cx.root} data-sf-account-auth data-sf-account-view=\"unavailable\">\n <p className={cx.notice} role=\"status\">\n {capabilities.unavailable_reason === 'missing_scope' ? m.errors.store_misconfigured : m.nothingAvailable}\n </p>\n </section>\n )\n }\n return (\n <section className={cx.root} data-sf-account-auth data-sf-account-view={view} aria-labelledby=\"sf-account-title\">\n {header}\n <h1 id=\"sf-account-title\" className={cx.title}>\n {title}\n </h1>\n <FormTag ref={ref as never} method=\"post\" {...(action ? { action } : {})} className={cx.form} data-sf-account-form>\n <ErrorSummary items={v.summary} focusKey={v.summaryKey} {...(locale ? { locale } : {})} />\n {errorText && showSummary ? (\n <p role=\"alert\" className={cx.error} data-sf-account-error={data!.error!.code}>\n {errorText}\n </p>\n ) : null}\n {next ? <input type=\"hidden\" name=\"next\" value={next} /> : null}\n {body}\n <div className={cx.actions}>\n <button type=\"submit\" name=\"intent\" value={intent} disabled={pending} className={cx.submit} data-sf-account-submit>\n {m.submit[view]}\n </button>\n </div>\n <div className={cx.links} data-sf-account-links>\n {links}\n </div>\n </FormTag>\n </section>\n )\n}\n"]}
package/dist/checkout.cjs CHANGED
@@ -843,6 +843,17 @@ function recommendRates(input, options = {}) {
843
843
  const more = [...groups.values()];
844
844
  return { recommended, more, moreCount: more.reduce((n, g) => n + g.rates.length, 0) };
845
845
  }
846
+ function flatRates(input, options = {}) {
847
+ const count = options.count ?? 3;
848
+ const rates = options.dedupe === false ? [...input] : dedupeRates(input);
849
+ const tags = /* @__PURE__ */ new Map();
850
+ for (const { rate, tags: t } of recommendRates(rates, { count, dedupe: false }).recommended) tags.set(rate, t);
851
+ const list = [...rates];
852
+ const kept = options.keepId ? input.find((r) => r.id === options.keepId) : void 0;
853
+ if (kept && !list.includes(kept)) list.push(kept);
854
+ const byCost = (a, b) => (costOf(a) ?? Infinity) - (costOf(b) ?? Infinity);
855
+ return list.sort(byCost).map((rate) => ({ rate, tags: tags.get(rate) ?? [] }));
856
+ }
846
857
 
847
858
  // src/checkout/delivery.ts
848
859
  var ES4 = {
@@ -1031,7 +1042,13 @@ function DeliveryOptions(props) {
1031
1042
  const m = react.useMemo(() => deliveryMessages(locale, props.messages), [locale, props.messages]);
1032
1043
  const hydrated = useHydrated();
1033
1044
  const badges = react.useMemo(() => showBadges ? rateBadges(rates) : /* @__PURE__ */ new Map(), [rates, showBadges]);
1034
- const firstValue = rates[0] ? rateValue(rates[0]) : null;
1045
+ const flat = react.useMemo(
1046
+ () => layout === "flat" ? flatRates(rates, { count: props.recommendedCount ?? 3, keepId: value ? rates.find((r) => rateValue(r) === value)?.id ?? null : null }) : null,
1047
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1048
+ [layout, rates, props.recommendedCount, value]
1049
+ );
1050
+ const firstRate = flat ? flat[0]?.rate : rates[0];
1051
+ const firstValue = firstRate ? rateValue(firstRate) : null;
1035
1052
  const defaultValue = props.defaultValue === void 0 ? firstValue : props.defaultValue;
1036
1053
  const amount = (money) => Number(money.amount) === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx.free, "data-sf-delivery-free": true, children: m.free }) : renderAmount ? renderAmount(money) : storefront.formatMoney(money, locale);
1037
1054
  const mode = props.quoteNote ?? "always";
@@ -1097,7 +1114,7 @@ function DeliveryOptions(props) {
1097
1114
  ] }) : null,
1098
1115
  children,
1099
1116
  loading && rates.length === 0 ? [0, 1, 2].map((i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx.skeleton, "data-sf-delivery-skeleton": true, "aria-hidden": "true" }, i)) : null,
1100
- plan ? plan.recommended.map(({ rate, tags }) => rateRow(rate, { tags: showBadges ? tags : [] })) : rates.map((rate) => rateRow(rate, { tags: badges.get(rate.id) ?? [] })),
1117
+ flat ? flat.map(({ rate, tags }) => rateRow(rate, { tags: showBadges ? tags : [] })) : plan ? plan.recommended.map(({ rate, tags }) => rateRow(rate, { tags: showBadges ? tags : [] })) : rates.map((rate) => rateRow(rate, { tags: badges.get(rate.id) ?? [] })),
1101
1118
  plan && plan.moreCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("details", { className: cx.more, "data-sf-delivery-more": true, ...inMore ? { open: true } : {}, children: [
1102
1119
  /* @__PURE__ */ jsxRuntime.jsx("summary", { className: cx.moreSummary, "data-sf-delivery-more-summary": true, children: m.moreOptions.replace("{n}", String(plan.moreCount)) }),
1103
1120
  /* @__PURE__ */ jsxRuntime.jsx("div", { "data-sf-delivery-groups": true, children: plan.more.map((g) => {
@@ -1141,6 +1158,7 @@ exports.dedupeRates = dedupeRates;
1141
1158
  exports.deliveryMessages = deliveryMessages;
1142
1159
  exports.fieldMessages = fieldMessages;
1143
1160
  exports.findBrand = findBrand;
1161
+ exports.flatRates = flatRates;
1144
1162
  exports.isQuoteChange = isQuoteChange;
1145
1163
  exports.listBrands = listBrands;
1146
1164
  exports.matchRate = matchRate;