@asteby/storefront-react 0.9.0 → 0.10.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/checkout/brands.ts","../src/checkout/brand-mark.tsx","../src/context.tsx","../src/locale.ts","../src/checkout/delivery.ts","../src/checkout/delivery-options.tsx"],"names":["jsx","jsxs","createContext","useContext","useSyncExternalStore","useMemo","formatMoney","Fragment"],"mappings":";;;;;;;AA6BA,IAAM,CAAA,GAAI,CAAC,GAAA,EAAa,IAAA,EAAc,MAAiB,EAAA,EAAY,EAAA,EAAY,MAAe,KAAA,MAAmC;AAAA,EAC/H,GAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA,EAAA;AAAA,EACA,EAAA;AAAA,EACA,GAAI,IAAA,GAAO,EAAE,IAAA,KAAS,EAAC;AAAA,EACvB,GAAI,KAAA,GAAQ,EAAE,KAAA,KAAU;AAC1B,CAAA,CAAA;AAEA,IAAM,IAAA,GAAgB;AAAA;AAAA,EAEpB,CAAA,CAAE,OAAA,EAAS,OAAA,EAAS,SAAA,EAAW,WAAW,SAAS,CAAA;AAAA,EACnD,CAAA,CAAE,KAAA,EAAO,KAAA,EAAO,SAAA,EAAW,WAAW,SAAS,CAAA;AAAA,EAC/C,CAAA,CAAE,UAAA,EAAY,UAAA,EAAY,SAAA,EAAW,WAAW,SAAS,CAAA;AAAA,EACzD,EAAE,eAAA,EAAiB,eAAA,EAAiB,SAAA,EAAW,SAAA,EAAW,WAAW,iBAAiB,CAAA;AAAA,EACtF,CAAA,CAAE,KAAA,EAAO,KAAA,EAAO,SAAA,EAAW,WAAW,SAAS,CAAA;AAAA,EAC/C,CAAA,CAAE,SAAA,EAAW,SAAA,EAAW,SAAA,EAAW,WAAW,SAAS,CAAA;AAAA,EACvD,EAAE,WAAA,EAAa,YAAA,EAAc,SAAA,EAAW,SAAA,EAAW,WAAW,IAAI,CAAA;AA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AU,UAC7F,QAAA,EAAA,SAAA,EAAW,IAAA,IAAQ,IACtB,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ","file":"checkout.cjs","sourcesContent":["/**\n * Shared catalog of the brands a checkout names: parcel carriers, card networks, wallets and cash payment points.\n *\n * Keys are the stable identifiers the providers already send (`ShippingRate.carrier` of Skydropx / Envía, the\n * `PaymentPoint.payment_point` or `id` of the payment addon, a `PaymentMethod.key`). Nothing here decides what a shop\n * offers: the server lists the rates and methods; this only gives each one its commercial name and a mark.\n *\n * Marks are typographic badges drawn by `<BrandMark>` (brand color + short wordmark): no third-party logo files are\n * bundled, so there is no licensing question and no extra request. A provider that holds a licensed logo sends it as\n * `logo_url` and it wins over the badge. Colors are close approximations of each brand's public color.\n */\n\nexport type BrandKind = 'carrier' | 'card' | 'wallet' | 'cash' | 'bank'\n\nexport type Brand = {\n key: string\n /** Commercial name, as the brand writes it. */\n name: string\n kind: BrandKind\n /** Badge background. */\n bg: string\n /** Badge text color (AA on `bg`). */\n fg: string\n /** Short wordmark drawn in the badge (`\\n` = two lines). Default: `name`. */\n mark?: string\n /** Special drawings instead of a wordmark. */\n shape?: 'mastercard'\n}\n\nconst B = (key: string, name: string, kind: BrandKind, bg: string, fg: string, mark?: string, shape?: Brand['shape']): Brand => ({\n key,\n name,\n kind,\n bg,\n fg,\n ...(mark ? { mark } : {}),\n ...(shape ? { shape } : {}),\n})\n\nconst LIST: Brand[] = [\n // Parcel carriers (Mexico and global).\n B('fedex', 'FedEx', 'carrier', '#4D148C', '#FFFFFF'),\n B('dhl', 'DHL', 'carrier', '#FFCC00', '#B00410'),\n B('estafeta', 'Estafeta', 'carrier', '#C8102E', '#FFFFFF'),\n B('paquetexpress', 'Paquetexpress', 'carrier', '#0B4EA2', '#FFFFFF', 'Paquet\\nexpress'),\n B('ups', 'UPS', 'carrier', '#351C15', '#FFB500'),\n B('redpack', 'Redpack', 'carrier', '#C8102E', '#FFFFFF'),\n B('99minutos', '99 Minutos', 'carrier', '#00704A', '#FFFFFF', '99'),\n B('jtexpress', 'J&T Express', 'carrier', '#C8102E', '#FFFFFF', 'J&T'),\n B('sendex', 'Sendex', 'carrier', '#003A70', '#FFFFFF'),\n B('ampm', 'AMPM', 'carrier', '#1D1D1B', '#FFFFFF'),\n B('tresguerras', 'Tresguerras', 'carrier', '#005BAC', '#FFFFFF', '3G'),\n B('quiken', 'Quiken', 'carrier', '#1D1D1B', '#FFFFFF'),\n B('imile', 'iMile', 'carrier', '#0057B8', '#FFFFFF'),\n B('carssa', 'Carssa', 'carrier', '#00529B', '#FFFFFF'),\n B('correosdemexico', 'Correos de México', 'carrier', '#7A1E3A', '#FFFFFF', 'Correos\\nMéxico'),\n B('usps', 'USPS', 'carrier', '#333366', '#FFFFFF'),\n B('canadapost', 'Canada Post', 'carrier', '#DA291C', '#FFFFFF', 'CPC'),\n // Card networks.\n B('visa', 'Visa', 'card', '#1A1F71', '#FFFFFF', 'VISA'),\n B('mastercard', 'Mastercard', 'card', '#FFFFFF', '#1D1D1B', 'MC', 'mastercard'),\n B('amex', 'American Express', 'card', '#1F72CD', '#FFFFFF', 'AMEX'),\n B('carnet', 'Carnet', 'card', '#003B71', '#FFFFFF'),\n // Wallets and payment providers.\n B('mercadopago', 'Mercado Pago', 'wallet', '#00B1EA', '#0B1F4E', 'mercado\\npago'),\n B('paypal', 'PayPal', 'wallet', '#003087', '#FFFFFF'),\n B('clip', 'Clip', 'wallet', '#FC4C02', '#1D1D1B'),\n B('applepay', 'Apple Pay', 'wallet', '#000000', '#FFFFFF', 'Pay'),\n B('googlepay', 'Google Pay', 'wallet', '#FFFFFF', '#3C4043', 'G Pay'),\n // Cash points and transfers (Mexico).\n B('oxxo', 'OXXO', 'cash', '#E21E26', '#FFE600'),\n B('spei', 'SPEI', 'bank', '#14365F', '#FFFFFF'),\n B('stp', 'STP', 'bank', '#14365F', '#FFFFFF', 'SPEI'),\n B('7eleven', '7-Eleven', 'cash', '#00704A', '#FFFFFF', '7-11'),\n B('circlek', 'Circle K', 'cash', '#DA291C', '#FFFFFF', 'K'),\n B('soriana', 'Soriana', 'cash', '#C8102E', '#FFFFFF'),\n B('extra', 'Extra', 'cash', '#E35205', '#FFFFFF'),\n B('kiosko', 'Kiosko', 'cash', '#C8102E', '#FFFFFF'),\n B('calimax', 'Calimax', 'cash', '#D52B1E', '#FFFFFF'),\n B('farmaciasyza', 'Farmacias Yza', 'cash', '#0A5A9C', '#FFFFFF', 'Yza'),\n B('chedraui', 'Chedraui', 'cash', '#0047BB', '#FFFFFF'),\n B('casaley', 'Casa Ley', 'cash', '#C8102E', '#FFFFFF', 'Ley'),\n B('telecomm', 'Telecomm', 'cash', '#6F1D46', '#FFFFFF'),\n B('walmart', 'Walmart', 'cash', '#0071CE', '#FFFFFF'),\n B('santander', 'Santander', 'bank', '#C00000', '#FFFFFF'),\n B('bbva', 'BBVA', 'bank', '#004481', '#FFFFFF'),\n B('citibanamex', 'Citibanamex', 'bank', '#004B8D', '#FFFFFF', 'Citi'),\n B('banorte', 'Banorte', 'bank', '#C8102E', '#FFFFFF'),\n]\n\n/** Alternative spellings that providers send for the same brand (already normalized by `brandKey`). */\nconst ALIASES: Record<string, string> = {\n fedexmx: 'fedex',\n fedexexpress: 'fedex',\n dhlexpress: 'dhl',\n dhlmx: 'dhl',\n paquetexpres: 'paquetexpress',\n paqueteexpress: 'paquetexpress',\n jt: 'jtexpress',\n jandtexpress: 'jtexpress',\n noventaynueveminutos: '99minutos',\n correos: 'correosdemexico',\n sepomex: 'correosdemexico',\n master: 'mastercard',\n americanexpress: 'amex',\n mercadopagomx: 'mercadopago',\n mp: 'mercadopago',\n clabe: 'spei',\n banktransfer: 'spei',\n seveneleven: '7eleven',\n '711': '7eleven',\n circulok: 'circlek',\n yza: 'farmaciasyza',\n bancomer: 'bbva',\n banamex: 'citibanamex',\n ley: 'casaley',\n}\n\nconst BY_KEY = new Map(LIST.map((b) => [b.key, b]))\n\n/** `\"FedEx México\"`, `\"fedex_mx\"` and `\"FEDEX\"` all become `fedex`. Lowercase ASCII letters and digits only. */\nexport function brandKey(raw: string | null | undefined): string {\n const flat = (raw ?? '')\n .normalize('NFD')\n .replace(/[̀-ͯ]/g, '')\n .toLowerCase()\n .replace(/&/g, 'and')\n .replace(/[^a-z0-9]/g, '')\n const noCountry = flat.endsWith('mexico') && flat !== 'correosdemexico' ? flat.slice(0, -6) : flat\n return ALIASES[noCountry] ?? (BY_KEY.has(noCountry) ? noCountry : ALIASES[flat] ?? flat)\n}\n\n/** Catalog entry for a provider identifier, or `null` when the brand is not in the catalog. */\nexport function findBrand(raw: string | null | undefined): Brand | null {\n return BY_KEY.get(brandKey(raw)) ?? null\n}\n\n/**\n * Commercial name for a provider identifier: the catalog's (`fedex` → \"FedEx\") or, for an unknown one, the identifier\n * in title case (`\"envios_rapidos\"` → \"Envios Rapidos\"). `null` for an empty input.\n */\nexport function brandName(raw: string | null | undefined): string | null {\n const brand = findBrand(raw)\n if (brand) return brand.name\n const text = (raw ?? '').trim()\n if (!text) return null\n // Already cased by the provider (\"Envía Plus\"): keep it.\n if (text !== text.toLowerCase() && text !== text.toUpperCase()) return text\n return text\n .toLowerCase()\n .split(/[\\s_-]+/)\n .filter(Boolean)\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(' ')\n}\n\n/** Every brand of the catalog (for docs, previews and tests). */\nexport function listBrands(kind?: BrandKind): Brand[] {\n return kind ? LIST.filter((b) => b.kind === kind) : [...LIST]\n}\n","import type { CSSProperties } from 'react'\nimport { brandName, findBrand } from './brands.js'\n\nexport type BrandMarkProps = {\n /** Provider identifier (`fedex`, `oxxo`, `mercadopago`, `7eleven`…). Unknown keys get a neutral monogram. */\n brand: string | null | undefined\n /** Licensed logo sent by the provider (`PaymentPoint.logo_url`…). Only `https:`; it wins over the badge. */\n logoUrl?: string | null\n /** Height in px. The badge is 3:2 (width = 1.5 × height). Default 24. */\n size?: number\n /**\n * Accessible name. Omit it when the brand name is already written next to the mark (the usual case): the mark is then\n * decorative (`aria-hidden`).\n */\n title?: string\n className?: string\n}\n\nfunction safeLogo(url: string | null | undefined): string | null {\n if (!url) return null\n try {\n return new URL(url).protocol === 'https:' ? url : null\n } catch {\n return null\n }\n}\n\n/** Letters of a monogram for a brand outside the catalog: \"envios rapidos\" → \"ER\". */\nfunction monogram(raw: string): string {\n const words = (brandName(raw) ?? raw).split(/\\s+/).filter(Boolean)\n const letters = words.length > 1 ? words.slice(0, 2).map((w) => w[0]) : [(words[0] ?? '?').slice(0, 2)]\n return letters.join('').toUpperCase()\n}\n\n/**\n * The mark of a carrier, card network, wallet or cash point: an inline SVG badge in the brand color with its short\n * wordmark (no network request, same size on the server and in the browser, so no layout shift). With `logoUrl` it\n * draws the provider's licensed logo instead, lazily, with fixed dimensions.\n *\n * The badge carries its own background, so it keeps its contrast on light and dark themes; a hairline\n * (`--sf-brand-mark-ring`) separates it from the page.\n */\nexport function BrandMark({ brand, logoUrl, size = 24, title, className }: BrandMarkProps) {\n const height = size\n const width = Math.round(size * 1.5)\n const a11y = title ? { role: 'img' as const, 'aria-label': title } : { 'aria-hidden': true as const }\n const logo = safeLogo(logoUrl)\n const found = findBrand(brand)\n const key = found?.key ?? 'generic'\n const style: CSSProperties = { width, height, flex: 'none' }\n if (logo) {\n return (\n <img\n src={logo}\n alt={title ?? ''}\n width={width}\n height={height}\n loading=\"lazy\"\n decoding=\"async\"\n className={className}\n style={{ ...style, objectFit: 'contain' }}\n data-sf-brand-mark={key}\n {...(title ? {} : { 'aria-hidden': true })}\n />\n )\n }\n const ring = 'var(--sf-brand-mark-ring, rgb(127 127 127 / 0.35))'\n if (found?.shape === 'mastercard') {\n return (\n <svg viewBox=\"0 0 48 32\" width={width} height={height} className={className} style={style} data-sf-brand-mark={key} focusable=\"false\" {...a11y}>\n <rect x=\"0.5\" y=\"0.5\" width=\"47\" height=\"31\" rx=\"5\" fill={found.bg} stroke={ring} />\n <circle cx=\"19\" cy=\"16\" r=\"9\" fill=\"#EB001B\" />\n <circle cx=\"29\" cy=\"16\" r=\"9\" fill=\"#F79E1B\" />\n <path d=\"M24 8.52a9 9 0 0 1 0 14.96a9 9 0 0 1 0-14.96z\" fill=\"#FF5F00\" />\n </svg>\n )\n }\n const text = found ? (found.mark ?? found.name) : monogram(brand ?? '')\n const bg = found?.bg ?? 'var(--sf-brand-mark-bg, #E7E9EE)'\n const fg = found?.fg ?? 'var(--sf-brand-mark-fg, #2B2F38)'\n const lines = text.split('\\n')\n const longest = Math.max(...lines.map((l) => l.length))\n // Short marks grow; long ones are squeezed into the badge (textLength) so every badge has the same box.\n const fontSize = lines.length > 1 ? (longest <= 5 ? 11 : 9.5) : longest <= 2 ? 15 : longest <= 4 ? 12 : 10\n const fit = (l: string) => (l.length > 5 ? { textLength: 40, lengthAdjust: 'spacingAndGlyphs' as const } : {})\n const italic = found?.key === 'visa' || found?.key === 'fedex' ? 'italic' : undefined\n const common = {\n textAnchor: 'middle' as const,\n fill: fg,\n fontFamily: \"system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif\",\n fontWeight: 800,\n fontSize,\n fontStyle: italic,\n }\n return (\n <svg viewBox=\"0 0 48 32\" width={width} height={height} className={className} style={style} data-sf-brand-mark={key} focusable=\"false\" {...a11y}>\n <rect x=\"0.5\" y=\"0.5\" width=\"47\" height=\"31\" rx=\"5\" fill={bg} stroke={ring} />\n {lines.length > 1 ? (\n lines.slice(0, 2).map((l, i) => (\n <text key={i} x=\"24\" y={i === 0 ? 15 : 25.5} {...common} {...fit(l)}>\n {l}\n </text>\n ))\n ) : (\n <text x=\"24\" y=\"16\" dominantBaseline=\"central\" letterSpacing={longest <= 4 ? 0.3 : 0} {...common} {...fit(text)}>\n {text}\n </text>\n )}\n </svg>\n )\n}\n","import { createContext, useContext, useMemo, type ReactNode } from 'react'\nimport { createStorefrontClient, type Shop, type StorefrontClient, type StorefrontClientOptions } from '@asteby/storefront'\n\nexport type StorefrontContextValue = {\n /** Client for browser-side calls (use a public `pk_` token). */\n client: StorefrontClient | null\n shop: Shop | null\n /** BCP 47 locale used for formatting (defaults to `shop.locale`, then `es-MX`). */\n locale: string\n /** ISO 4217 currency (defaults to `shop.currency_code`, then `MXN`). */\n currency: string\n}\n\nconst StorefrontContext = createContext<StorefrontContextValue | null>(null)\n\nexport type StorefrontProviderProps = {\n /** A ready client. Takes precedence over `config`. */\n client?: StorefrontClient\n /** Options to create the browser client (use a `pk_` token). */\n config?: StorefrontClientOptions\n /** Shop info loaded on the server (root loader). */\n shop?: Shop | null\n locale?: string\n currency?: string\n children?: ReactNode\n}\n\n/**\n * Makes the storefront client, shop, locale and currency available to the\n * tree. SSR-safe: creating the client does not touch `window`.\n */\nexport function StorefrontProvider({ client, config, shop = null, locale, currency, children }: StorefrontProviderProps) {\n const configKey = config ? `${config.baseUrl}|${config.token}|${config.locale ?? ''}|${config.customerToken ?? ''}` : ''\n const resolvedClient = useMemo(\n () => client ?? (config ? createStorefrontClient(config) : null),\n [client, configKey],\n )\n const value = useMemo<StorefrontContextValue>(\n () => ({\n client: resolvedClient,\n shop,\n locale: locale ?? config?.locale ?? shop?.locale ?? 'es-MX',\n currency: currency ?? shop?.currency_code ?? 'MXN',\n }),\n [resolvedClient, shop, locale, currency, config?.locale],\n )\n return <StorefrontContext.Provider value={value}>{children}</StorefrontContext.Provider>\n}\n\n/** Storefront context. Throws outside `<StorefrontProvider>`. */\nexport function useStorefront(): StorefrontContextValue {\n const ctx = useContext(StorefrontContext)\n if (!ctx) throw new Error('useStorefront must be used inside <StorefrontProvider>')\n return ctx\n}\n\n/** Storefront context or `null` outside a provider (for components that work standalone). */\nexport function useOptionalStorefront(): StorefrontContextValue | null {\n return useContext(StorefrontContext)\n}\n\n/** The client from context; throws when the provider has none. */\nexport function useStorefrontClient(): StorefrontClient {\n const { client } = useStorefront()\n if (!client) throw new Error('<StorefrontProvider> needs a `client` or `config` for browser-side calls')\n return client\n}\n","import { useOptionalStorefront } from './context.js'\n\n/** Locale of a component: its own prop, else the `StorefrontProvider`'s, else `es-MX`. */\nexport function useResolvedLocale(locale?: string | null): string {\n const sf = useOptionalStorefront()\n return locale ?? sf?.locale ?? 'es-MX'\n}\n","/**\n * Pure helpers for the \"Delivery\" step: how to name a carrier rate, its arrival time, which rate is the cheapest or the\n * fastest, and one human note for the quote deadline. No amounts are computed: `cost` is shown as the server sends it;\n * comparing two costs to flag the cheapest is the only arithmetic.\n */\nimport type { ShippingRate } from '@asteby/storefront'\nimport { brandName } from './brands.js'\n\nexport type DeliveryMessages = {\n /** `{n}` = business days. */\n etaOne: string\n etaMany: string\n /** `{min}` / `{max}` = business days. */\n etaRange: string\n etaUpTo: string\n etaFrom: string\n cheapest: string\n fastest: string\n free: string\n pickupTitle: string\n /** Quote deadline, `{time}` = local time. */\n quoteToday: string\n quoteTomorrow: string\n /** `{date}` = short date + time. */\n quoteLater: string\n quoteSoon: string\n partial: string\n loading: string\n /** The quote expired or changed and the rates were reloaded. */\n requoted: string\n}\n\nconst ES: DeliveryMessages = {\n etaOne: 'Llega en 1 día hábil',\n etaMany: 'Llega en {n} días hábiles',\n etaRange: 'Llega en {min} a {max} días hábiles',\n etaUpTo: 'Llega en máximo {max} días hábiles',\n etaFrom: 'Llega en {min} días hábiles o más',\n cheapest: 'Más económico',\n fastest: 'Más rápido',\n free: 'Gratis',\n pickupTitle: 'Recoger en {name}',\n quoteToday: 'Precios de envío vigentes hasta las {time}.',\n quoteTomorrow: 'Precios de envío vigentes hasta mañana a las {time}.',\n quoteLater: 'Precios de envío vigentes hasta el {date}.',\n quoteSoon: 'Los precios de envío vencen pronto ({time}).',\n partial: 'No pudimos consultar todas las paqueterías. Estas son las opciones disponibles ahora.',\n loading: 'Buscando opciones de envío…',\n requoted: 'Las tarifas de envío cambiaron y ya están actualizadas. Revisa tu envío antes de pagar.',\n}\n\nconst EN: DeliveryMessages = {\n etaOne: 'Arrives in 1 business day',\n etaMany: 'Arrives in {n} business days',\n etaRange: 'Arrives in {min} to {max} business days',\n etaUpTo: 'Arrives in up to {max} business days',\n etaFrom: 'Arrives in {min}+ business days',\n cheapest: 'Cheapest',\n fastest: 'Fastest',\n free: 'Free',\n pickupTitle: 'Pick up at {name}',\n quoteToday: 'Shipping prices valid until {time}.',\n quoteTomorrow: 'Shipping prices valid until tomorrow at {time}.',\n quoteLater: 'Shipping prices valid until {date}.',\n quoteSoon: 'Shipping prices expire soon ({time}).',\n partial: \"We couldn't reach every carrier. These are the options available now.\",\n loading: 'Looking for delivery options…',\n requoted: 'Shipping rates changed and are now up to date. Check your delivery before paying.',\n}\n\n/** Messages for a locale (`es*` default, `en*`), with optional overrides. */\nexport function deliveryMessages(locale?: string | null, overrides?: Partial<DeliveryMessages> | null): DeliveryMessages {\n const base = (locale ?? 'es-MX').toLowerCase().startsWith('en') ? EN : ES\n return overrides ? { ...base, ...overrides } : base\n}\n\n// A value that already ends in a period (\"9:39 p.m.\") does not get a second one from the template.\nconst fill = (tpl: string, vars: Record<string, string | number>) => tpl.replace(/\\{(\\w+)\\}/g, (_, k: string) => String(vars[k] ?? '')).replace(/\\.\\.$/, '.')\n\n/** Commercial carrier name of a rate (`fedex` → \"FedEx\"); `null` without carrier. */\nexport function rateCarrier(rate: Pick<ShippingRate, 'carrier'>): string | null {\n return brandName(rate.carrier)\n}\n\n/**\n * Service name without the carrier repeated: \"FedEx Express Saver\" with carrier `fedex` → \"Express Saver\". Falls back\n * to the title when stripping would leave nothing.\n */\nexport function rateService(rate: Pick<ShippingRate, 'title' | 'carrier'>): string {\n const title = rate.title.trim()\n const carrier = rateCarrier(rate)\n if (!carrier) return title\n for (const prefix of [carrier, rate.carrier ?? '']) {\n if (!prefix) continue\n if (title.toLowerCase().startsWith(prefix.toLowerCase())) {\n const rest = title.slice(prefix.length).replace(/^[\\s·:|-]+/, '')\n if (rest) return rest\n }\n }\n return title\n}\n\n/** Arrival time of a rate: business days from the provider, else the server `eta` text as is. */\nexport function rateEta(\n rate: Pick<ShippingRate, 'eta' | 'eta_days_min' | 'eta_days_max'>,\n messages: DeliveryMessages = ES,\n): string | null {\n const { eta_days_min: min, eta_days_max: max } = rate\n if (typeof min === 'number' && typeof max === 'number') {\n if (min === max) return min === 1 ? messages.etaOne : fill(messages.etaMany, { n: min })\n return fill(messages.etaRange, { min, max })\n }\n if (typeof max === 'number') return max === 1 ? messages.etaOne : fill(messages.etaUpTo, { max })\n if (typeof min === 'number') return min === 1 ? messages.etaOne : fill(messages.etaFrom, { min })\n return rate.eta ?? null\n}\n\nexport type RateBadge = 'cheapest' | 'fastest'\n\nconst costOf = (r: ShippingRate) => {\n const n = Number(r.cost.amount)\n return Number.isFinite(n) ? n : null\n}\nconst daysOf = (r: ShippingRate) => r.eta_days_max ?? r.eta_days_min ?? null\n\n/**\n * Badges per rate id. Only with two or more rates, only when one rate is strictly the cheapest (same currency) or\n * strictly the fastest: a tie gets no badge, so the badge always tells the buyer something.\n */\nexport function rateBadges(rates: readonly ShippingRate[]): Map<string, RateBadge[]> {\n const out = new Map<string, RateBadge[]>()\n if (rates.length < 2) return out\n const add = (id: string, b: RateBadge) => out.set(id, [...(out.get(id) ?? []), b])\n const unique = (values: Array<[string, number | null]>) => {\n const known = values.filter((v): v is [string, number] => v[1] !== null)\n if (known.length < 2) return null\n const min = Math.min(...known.map((v) => v[1]))\n const winners = known.filter((v) => v[1] === min)\n return winners.length === 1 ? winners[0]![0] : null\n }\n const currencies = new Set(rates.map((r) => r.cost.currency_code))\n if (currencies.size === 1) {\n const id = unique(rates.map((r) => [r.id, costOf(r)]))\n if (id) add(id, 'cheapest')\n }\n const fast = unique(rates.map((r) => [r.id, daysOf(r)]))\n if (fast) add(fast, 'fastest')\n return out\n}\n\n/** Earliest `expires_at` of the rates (the deadline of the whole list), or `null`. */\nexport function quoteDeadline(rates: readonly Pick<ShippingRate, 'expires_at'>[]): Date | null {\n let best: Date | null = null\n for (const r of rates) {\n if (!r.expires_at) continue\n const d = new Date(r.expires_at)\n if (Number.isNaN(d.getTime())) continue\n if (!best || d < best) best = d\n }\n return best\n}\n\nexport type QuoteNote = { text: string; soon: boolean }\n\n/**\n * One human note for the quote deadline, in the buyer's time zone (or `timeZone`): \"valid until 9:39 p.m.\", \"until\n * tomorrow at…\", \"until Oct 24, …\", or \"expire soon\" within `soonMinutes` (default 15). `null` when already past.\n */\nexport function quoteNote(\n deadline: Date | null,\n opts: { locale?: string; now?: Date; timeZone?: string; soonMinutes?: number; messages?: DeliveryMessages } = {},\n): QuoteNote | null {\n if (!deadline) return null\n const now = opts.now ?? new Date()\n const left = deadline.getTime() - now.getTime()\n if (left <= 0) return null\n const m = opts.messages ?? ES\n const locale = opts.locale ?? 'es-MX'\n const tz = opts.timeZone ? { timeZone: opts.timeZone } : {}\n const time = new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit', ...tz }).format(deadline)\n if (left <= (opts.soonMinutes ?? 15) * 60_000) return { text: fill(m.quoteSoon, { time }), soon: true }\n const day = (d: Date) => new Intl.DateTimeFormat('en-CA', { year: 'numeric', month: '2-digit', day: '2-digit', ...tz }).format(d)\n if (day(deadline) === day(now)) return { text: fill(m.quoteToday, { time }), soon: false }\n if (day(deadline) === day(new Date(now.getTime() + 86_400_000))) return { text: fill(m.quoteTomorrow, { time }), soon: false }\n const date = new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'short', hour: 'numeric', minute: '2-digit', ...tz }).format(deadline)\n return { text: fill(m.quoteLater, { date }), soon: false }\n}\n\n/** Error codes a server uses (or will use) when the chosen rate is no longer quotable. */\nconst QUOTE_CODES = new Set(['quote_expired', 'rate_expired', 'rate_changed', 'rate_unavailable', 'rate_not_found', 'stale_rate', 'invalid_rate'])\n\n/**\n * `true` when saving a shipping rate failed because the quote expired or the rates changed, so the shop should reload\n * the rates (and keep the address) instead of showing a generic failure. Recognizes the explicit codes\n * (`quote_expired`, `rate_expired`…, any status), a `409`, and the generic `422` on the rate field that older servers\n * answer when the provider re-quoted with new ids. 5xx and other 4xx stay real failures.\n */\nexport function isQuoteChange(err: { status?: number; code?: string | null; field?: string | null } | null | undefined): boolean {\n if (!err) return false\n if (err.code && QUOTE_CODES.has(err.code)) return true\n if (err.status === 409) return true\n return err.status === 422 && (err.field === 'rate_id' || err.field === 'delivery' || err.field === 'delivery.rate_id' || !err.field)\n}\n\n/**\n * The rate of a fresh quote that matches the one the buyer had chosen (same carrier and service), so a re-quote keeps\n * the choice even though the provider issued new ids. `null` when that service is no longer offered.\n */\nexport function matchRate<R extends Pick<ShippingRate, 'id' | 'carrier' | 'service_code' | 'title'>>(previous: Pick<ShippingRate, 'carrier' | 'service_code' | 'title'> | null | undefined, rates: readonly R[]): R | null {\n if (!previous) return null\n const norm = (s: string | null | undefined) => (s ?? '').trim().toLowerCase()\n const sameCarrier = (r: R) => norm(r.carrier) === norm(previous.carrier)\n if (previous.service_code) {\n const hit = rates.find((r) => sameCarrier(r) && norm(r.service_code) === norm(previous.service_code))\n if (hit) return hit\n }\n return rates.find((r) => sameCarrier(r) && norm(r.title) === norm(previous.title)) ?? null\n}\n","import { useMemo, useSyncExternalStore, type CSSProperties, type ReactNode } from 'react'\nimport { formatMoney, type Money, type PickupOption, type ShippingRate } from '@asteby/storefront'\nimport { useResolvedLocale } from '../locale.js'\nimport { BrandMark } from './brand-mark.js'\nimport {\n deliveryMessages,\n quoteDeadline,\n quoteNote,\n rateBadges,\n rateCarrier,\n rateEta,\n rateService,\n type DeliveryMessages,\n type RateBadge,\n} from './delivery.js'\n\nexport type DeliveryOptionsClassNames = Partial<\n Record<\n | 'root'\n | 'option'\n | 'radio'\n | 'mark'\n | 'body'\n | 'title'\n | 'carrier'\n | 'service'\n | 'eta'\n | 'badges'\n | 'badge'\n | 'price'\n | 'free'\n | 'note'\n | 'partial'\n | 'skeleton',\n string\n >\n>\n\nexport type DeliveryOptionsProps = {\n rates: readonly ShippingRate[]\n pickup?: readonly PickupOption[]\n /** Radio group name. Default `delivery_choice`. */\n name?: string\n /** Form value of a rate. Default `rate:<id>`. */\n rateValue?: (rate: ShippingRate) => string\n /** Form value of a pickup branch. Default `pickup:<branch_id>`. */\n pickupValue?: (branch: PickupOption) => string\n /** Uncontrolled preselection. Default: the first rate. `null`: nothing preselected. */\n defaultValue?: string | null\n /** Controlled value (use with `onValueChange`). */\n value?: string\n onValueChange?: (value: string) => void\n /** Some provider did not answer (`DeliveryOptions.partial`): one neutral note above the list. */\n partial?: boolean\n /** The previous quote expired or changed and these rates are fresh: one status note above the list. */\n requoted?: boolean\n /** Rates are being quoted again: skeleton rows (no rates yet) or the current rows dimmed, `aria-busy`. */\n loading?: boolean\n /** Quote deadline note: `always` (default), only when it is `soon`, or `never`. */\n quoteNote?: 'always' | 'soon' | 'never'\n /** Time zone of the note. Default: the buyer's browser. */\n timeZone?: string\n /** Show the carrier marks. Default true. */\n marks?: boolean\n /** Cheapest / fastest badges. Default true. */\n badges?: boolean\n required?: boolean\n locale?: string\n messages?: Partial<DeliveryMessages>\n renderAmount?: (amount: Money) => ReactNode\n classNames?: DeliveryOptionsClassNames\n /** `data-testid` of every radio. */\n testId?: string\n /** Rows the shop renders before the rates (e.g. \"home delivery, rates after the address\"). */\n children?: ReactNode\n}\n\nconst SR_ONLY: CSSProperties = { position: 'absolute', width: 1, height: 1, overflow: 'hidden', clip: 'rect(0 0 0 0)', whiteSpace: 'nowrap' }\n\nconst useHydrated = () =>\n useSyncExternalStore(\n () => () => {},\n () => true,\n () => false,\n )\n\nfunction PickupGlyph({ size = 24 }: { size?: number }) {\n return (\n <svg viewBox=\"0 0 48 32\" width={Math.round(size * 1.5)} height={size} aria-hidden=\"true\" focusable=\"false\" style={{ flex: 'none' }} data-sf-brand-mark=\"pickup\">\n <rect x=\"0.5\" y=\"0.5\" width=\"47\" height=\"31\" rx=\"5\" fill=\"var(--sf-brand-mark-bg, #E7E9EE)\" stroke=\"var(--sf-brand-mark-ring, rgb(127 127 127 / 0.35))\" />\n <path d=\"M15 13.5 17 9h14l2 4.5M15 13.5h18M15 13.5V23h18v-9.5M21 23v-5h6v5\" fill=\"none\" stroke=\"var(--sf-brand-mark-fg, #2B2F38)\" strokeWidth=\"1.8\" strokeLinejoin=\"round\" />\n </svg>\n )\n}\n\n/**\n * The rates and pickup branches of \"Delivery\" as native radios: carrier mark and commercial name, readable service,\n * arrival time, cheapest / fastest badges, price as the server sends it, and ONE note for the quote deadline in the\n * buyer's time zone. Works without JavaScript (plain radios in the page form); the note appears after hydration in a\n * reserved line, so it never shifts the layout.\n *\n * Wrap it in the shop's own `<fieldset><legend>`. Style it with `classNames` and/or the default sheet\n * `@asteby/storefront-react/checkout.css`.\n */\nexport function DeliveryOptions(props: DeliveryOptionsProps) {\n const {\n rates,\n pickup = [],\n name = 'delivery_choice',\n rateValue = (r) => `rate:${r.id}`,\n pickupValue = (b) => `pickup:${b.branch_id}`,\n value,\n onValueChange,\n partial = false,\n requoted = false,\n loading = false,\n timeZone,\n marks = true,\n badges: showBadges = true,\n required = true,\n renderAmount,\n classNames: cx = {},\n testId,\n children,\n } = props\n const locale = useResolvedLocale(props.locale)\n const m = useMemo(() => deliveryMessages(locale, props.messages), [locale, props.messages])\n const hydrated = useHydrated()\n const badges = useMemo(() => (showBadges ? rateBadges(rates) : new Map<string, RateBadge[]>()), [rates, showBadges])\n const firstValue = rates[0] ? rateValue(rates[0]) : null\n const defaultValue = props.defaultValue === undefined ? firstValue : props.defaultValue\n const amount = (money: Money) => (Number(money.amount) === 0 ? <span className={cx.free} data-sf-delivery-free>{m.free}</span> : renderAmount ? renderAmount(money) : formatMoney(money, locale))\n const mode = props.quoteNote ?? 'always'\n const deadline = mode === 'never' ? null : quoteDeadline(rates)\n const note = hydrated && deadline ? quoteNote(deadline, { locale, messages: m, ...(timeZone ? { timeZone } : {}) }) : null\n const shownNote = note && (mode === 'always' || note.soon) ? note : null\n\n const radio = (v: string) => (\n <input\n type=\"radio\"\n name={name}\n value={v}\n required={required}\n className={cx.radio}\n {...(value !== undefined ? { checked: value === v, onChange: () => onValueChange?.(v) } : { defaultChecked: v === defaultValue, ...(onValueChange ? { onChange: () => onValueChange(v) } : {}) })}\n {...(testId ? { 'data-testid': testId } : {})}\n />\n )\n\n return (\n <div className={cx.root} data-sf-delivery aria-busy={loading || undefined}>\n {partial ? (\n <p role=\"status\" className={cx.partial} data-sf-delivery-partial>\n {m.partial}\n </p>\n ) : null}\n {requoted ? (\n <p role=\"status\" className={cx.partial} data-sf-delivery-requoted>\n {m.requoted}\n </p>\n ) : null}\n {loading ? (\n <span style={SR_ONLY} role=\"status\" data-sf-delivery-loading>\n {m.loading}\n </span>\n ) : null}\n {children}\n {loading && rates.length === 0\n ? [0, 1, 2].map((i) => <div key={i} className={cx.skeleton} data-sf-delivery-skeleton aria-hidden=\"true\" />)\n : null}\n {rates.map((rate) => {\n const carrier = rateCarrier(rate)\n const service = rateService(rate)\n const eta = rateEta(rate, m)\n const own = badges.get(rate.id) ?? []\n return (\n <label key={rate.id} className={cx.option} data-sf-delivery-option data-loading={loading || undefined}>\n {radio(rateValue(rate))}\n {marks ? <BrandMark brand={rate.carrier ?? rate.provider ?? rate.title} size={28} {...(cx.mark ? { className: cx.mark } : {})} /> : null}\n <span className={cx.body} data-sf-delivery-body>\n <span className={cx.title} data-sf-delivery-title>\n {carrier ? (\n <>\n <span className={cx.carrier} data-sf-delivery-carrier>\n {carrier}\n </span>{' '}\n <span className={cx.service} data-sf-delivery-service>\n {service}\n </span>\n </>\n ) : (\n <span className={cx.carrier} data-sf-delivery-carrier>\n {service}\n </span>\n )}\n </span>\n {eta ? (\n <span className={cx.eta} data-sf-delivery-eta>\n {eta}\n </span>\n ) : null}\n {own.length ? (\n <span className={cx.badges} data-sf-delivery-badges>\n {own.map((b) => (\n <span key={b} className={cx.badge} data-sf-delivery-badge={b}>\n {b === 'cheapest' ? m.cheapest : m.fastest}\n </span>\n ))}\n </span>\n ) : null}\n </span>\n <span className={cx.price} data-sf-delivery-price>\n {amount(rate.cost)}\n </span>\n </label>\n )\n })}\n {pickup.map((b) => (\n <label key={b.branch_id} className={cx.option} data-sf-delivery-option data-sf-delivery-pickup>\n {radio(pickupValue(b))}\n {marks ? <PickupGlyph size={28} /> : null}\n <span className={cx.body} data-sf-delivery-body>\n <span className={cx.title} data-sf-delivery-title>\n <span className={cx.carrier} data-sf-delivery-carrier>\n {m.pickupTitle.replace('{name}', b.name)}\n </span>\n </span>\n {b.address || b.city ? (\n <span className={cx.eta} data-sf-delivery-eta>\n {[b.address, b.city].filter(Boolean).join(', ')}\n </span>\n ) : null}\n </span>\n <span className={cx.price} data-sf-delivery-price>\n <span className={cx.free} data-sf-delivery-free>\n {m.free}\n </span>\n </span>\n </label>\n ))}\n {deadline ? (\n <p className={cx.note} data-sf-delivery-note data-soon={shownNote?.soon || undefined} aria-live=\"polite\">\n {shownNote?.text ?? ''}\n </p>\n ) : null}\n </div>\n )\n}\n"]}
@@ -0,0 +1,100 @@
1
+ /*
2
+ * Default sheet for <DeliveryOptions> and the brand marks (`@asteby/storefront-react/checkout.css`). Optional and
3
+ * neutral: layout, badges, skeleton and the reserved line of the quote note. Colors come from `currentColor` and a few
4
+ * variables the shop can set (light and dark):
5
+ * --sf-brand-mark-ring hairline around a mark (default rgb(127 127 127 / .35))
6
+ * --sf-brand-mark-bg/fg badge of a brand outside the catalog
7
+ * --sf-delivery-badge-bg / --sf-delivery-badge-fg
8
+ * --sf-delivery-muted secondary text (default currentColor at 70%)
9
+ */
10
+ [data-sf-delivery] {
11
+ display: grid;
12
+ gap: 0.75rem;
13
+ }
14
+ [data-sf-delivery-option] {
15
+ display: flex;
16
+ align-items: center;
17
+ gap: 0.75rem;
18
+ min-height: 44px;
19
+ cursor: pointer;
20
+ }
21
+ [data-sf-delivery-option][data-loading] {
22
+ opacity: 0.6;
23
+ transition: opacity 150ms;
24
+ }
25
+ [data-sf-delivery-body] {
26
+ display: flex;
27
+ flex: 1 1 auto;
28
+ min-width: 0;
29
+ flex-direction: column;
30
+ gap: 0.125rem;
31
+ }
32
+ [data-sf-delivery-title] {
33
+ overflow-wrap: anywhere;
34
+ }
35
+ [data-sf-delivery-carrier] {
36
+ font-weight: 600;
37
+ }
38
+ [data-sf-delivery-service],
39
+ [data-sf-delivery-eta] {
40
+ color: var(--sf-delivery-muted, color-mix(in srgb, currentColor 72%, transparent));
41
+ }
42
+ [data-sf-delivery-eta] {
43
+ font-size: 0.875em;
44
+ }
45
+ [data-sf-delivery-badges] {
46
+ display: flex;
47
+ flex-wrap: wrap;
48
+ gap: 0.375rem;
49
+ margin-top: 0.25rem;
50
+ }
51
+ [data-sf-delivery-badge] {
52
+ display: inline-flex;
53
+ align-items: center;
54
+ border-radius: 999px;
55
+ padding: 0.0625rem 0.5rem;
56
+ font-size: 0.75em;
57
+ font-weight: 600;
58
+ line-height: 1.5;
59
+ background: var(--sf-delivery-badge-bg, color-mix(in srgb, currentColor 10%, transparent));
60
+ color: var(--sf-delivery-badge-fg, inherit);
61
+ }
62
+ [data-sf-delivery-price] {
63
+ flex: none;
64
+ font-weight: 600;
65
+ font-variant-numeric: tabular-nums;
66
+ text-align: right;
67
+ }
68
+ [data-sf-delivery-note] {
69
+ min-height: 1.5em; /* reserved before hydration: the text never shifts the layout */
70
+ margin: 0;
71
+ font-size: 0.75rem;
72
+ color: var(--sf-delivery-muted, color-mix(in srgb, currentColor 72%, transparent));
73
+ }
74
+ [data-sf-delivery-skeleton] {
75
+ height: 4.5rem;
76
+ border-radius: 0.375rem;
77
+ background: linear-gradient(90deg, color-mix(in srgb, currentColor 6%, transparent) 0%, color-mix(in srgb, currentColor 12%, transparent) 50%, color-mix(in srgb, currentColor 6%, transparent) 100%);
78
+ background-size: 200% 100%;
79
+ animation: sf-delivery-shimmer 1.2s ease-in-out infinite;
80
+ }
81
+ @keyframes sf-delivery-shimmer {
82
+ from {
83
+ background-position: 100% 0;
84
+ }
85
+ to {
86
+ background-position: -100% 0;
87
+ }
88
+ }
89
+ @media (prefers-reduced-motion: reduce) {
90
+ [data-sf-delivery-skeleton] {
91
+ animation: none;
92
+ }
93
+ [data-sf-delivery-option][data-loading] {
94
+ transition: none;
95
+ }
96
+ }
97
+ [data-sf-brand-mark] {
98
+ display: inline-block;
99
+ vertical-align: middle;
100
+ }
@@ -0,0 +1,197 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { ShippingRate, PickupOption, Money } from '@asteby/storefront';
4
+
5
+ type BrandMarkProps = {
6
+ /** Provider identifier (`fedex`, `oxxo`, `mercadopago`, `7eleven`…). Unknown keys get a neutral monogram. */
7
+ brand: string | null | undefined;
8
+ /** Licensed logo sent by the provider (`PaymentPoint.logo_url`…). Only `https:`; it wins over the badge. */
9
+ logoUrl?: string | null;
10
+ /** Height in px. The badge is 3:2 (width = 1.5 × height). Default 24. */
11
+ size?: number;
12
+ /**
13
+ * Accessible name. Omit it when the brand name is already written next to the mark (the usual case): the mark is then
14
+ * decorative (`aria-hidden`).
15
+ */
16
+ title?: string;
17
+ className?: string;
18
+ };
19
+ /**
20
+ * The mark of a carrier, card network, wallet or cash point: an inline SVG badge in the brand color with its short
21
+ * wordmark (no network request, same size on the server and in the browser, so no layout shift). With `logoUrl` it
22
+ * draws the provider's licensed logo instead, lazily, with fixed dimensions.
23
+ *
24
+ * The badge carries its own background, so it keeps its contrast on light and dark themes; a hairline
25
+ * (`--sf-brand-mark-ring`) separates it from the page.
26
+ */
27
+ declare function BrandMark({ brand, logoUrl, size, title, className }: BrandMarkProps): react.JSX.Element;
28
+
29
+ /**
30
+ * Shared catalog of the brands a checkout names: parcel carriers, card networks, wallets and cash payment points.
31
+ *
32
+ * Keys are the stable identifiers the providers already send (`ShippingRate.carrier` of Skydropx / Envía, the
33
+ * `PaymentPoint.payment_point` or `id` of the payment addon, a `PaymentMethod.key`). Nothing here decides what a shop
34
+ * offers: the server lists the rates and methods; this only gives each one its commercial name and a mark.
35
+ *
36
+ * Marks are typographic badges drawn by `<BrandMark>` (brand color + short wordmark): no third-party logo files are
37
+ * bundled, so there is no licensing question and no extra request. A provider that holds a licensed logo sends it as
38
+ * `logo_url` and it wins over the badge. Colors are close approximations of each brand's public color.
39
+ */
40
+ type BrandKind = 'carrier' | 'card' | 'wallet' | 'cash' | 'bank';
41
+ type Brand = {
42
+ key: string;
43
+ /** Commercial name, as the brand writes it. */
44
+ name: string;
45
+ kind: BrandKind;
46
+ /** Badge background. */
47
+ bg: string;
48
+ /** Badge text color (AA on `bg`). */
49
+ fg: string;
50
+ /** Short wordmark drawn in the badge (`\n` = two lines). Default: `name`. */
51
+ mark?: string;
52
+ /** Special drawings instead of a wordmark. */
53
+ shape?: 'mastercard';
54
+ };
55
+ /** `"FedEx México"`, `"fedex_mx"` and `"FEDEX"` all become `fedex`. Lowercase ASCII letters and digits only. */
56
+ declare function brandKey(raw: string | null | undefined): string;
57
+ /** Catalog entry for a provider identifier, or `null` when the brand is not in the catalog. */
58
+ declare function findBrand(raw: string | null | undefined): Brand | null;
59
+ /**
60
+ * Commercial name for a provider identifier: the catalog's (`fedex` → "FedEx") or, for an unknown one, the identifier
61
+ * in title case (`"envios_rapidos"` → "Envios Rapidos"). `null` for an empty input.
62
+ */
63
+ declare function brandName(raw: string | null | undefined): string | null;
64
+ /** Every brand of the catalog (for docs, previews and tests). */
65
+ declare function listBrands(kind?: BrandKind): Brand[];
66
+
67
+ /**
68
+ * Pure helpers for the "Delivery" step: how to name a carrier rate, its arrival time, which rate is the cheapest or the
69
+ * fastest, and one human note for the quote deadline. No amounts are computed: `cost` is shown as the server sends it;
70
+ * comparing two costs to flag the cheapest is the only arithmetic.
71
+ */
72
+
73
+ type DeliveryMessages = {
74
+ /** `{n}` = business days. */
75
+ etaOne: string;
76
+ etaMany: string;
77
+ /** `{min}` / `{max}` = business days. */
78
+ etaRange: string;
79
+ etaUpTo: string;
80
+ etaFrom: string;
81
+ cheapest: string;
82
+ fastest: string;
83
+ free: string;
84
+ pickupTitle: string;
85
+ /** Quote deadline, `{time}` = local time. */
86
+ quoteToday: string;
87
+ quoteTomorrow: string;
88
+ /** `{date}` = short date + time. */
89
+ quoteLater: string;
90
+ quoteSoon: string;
91
+ partial: string;
92
+ loading: string;
93
+ /** The quote expired or changed and the rates were reloaded. */
94
+ requoted: string;
95
+ };
96
+ /** Messages for a locale (`es*` default, `en*`), with optional overrides. */
97
+ declare function deliveryMessages(locale?: string | null, overrides?: Partial<DeliveryMessages> | null): DeliveryMessages;
98
+ /** Commercial carrier name of a rate (`fedex` → "FedEx"); `null` without carrier. */
99
+ declare function rateCarrier(rate: Pick<ShippingRate, 'carrier'>): string | null;
100
+ /**
101
+ * Service name without the carrier repeated: "FedEx Express Saver" with carrier `fedex` → "Express Saver". Falls back
102
+ * to the title when stripping would leave nothing.
103
+ */
104
+ declare function rateService(rate: Pick<ShippingRate, 'title' | 'carrier'>): string;
105
+ /** Arrival time of a rate: business days from the provider, else the server `eta` text as is. */
106
+ declare function rateEta(rate: Pick<ShippingRate, 'eta' | 'eta_days_min' | 'eta_days_max'>, messages?: DeliveryMessages): string | null;
107
+ type RateBadge = 'cheapest' | 'fastest';
108
+ /**
109
+ * Badges per rate id. Only with two or more rates, only when one rate is strictly the cheapest (same currency) or
110
+ * strictly the fastest: a tie gets no badge, so the badge always tells the buyer something.
111
+ */
112
+ declare function rateBadges(rates: readonly ShippingRate[]): Map<string, RateBadge[]>;
113
+ /** Earliest `expires_at` of the rates (the deadline of the whole list), or `null`. */
114
+ declare function quoteDeadline(rates: readonly Pick<ShippingRate, 'expires_at'>[]): Date | null;
115
+ type QuoteNote = {
116
+ text: string;
117
+ soon: boolean;
118
+ };
119
+ /**
120
+ * One human note for the quote deadline, in the buyer's time zone (or `timeZone`): "valid until 9:39 p.m.", "until
121
+ * tomorrow at…", "until Oct 24, …", or "expire soon" within `soonMinutes` (default 15). `null` when already past.
122
+ */
123
+ declare function quoteNote(deadline: Date | null, opts?: {
124
+ locale?: string;
125
+ now?: Date;
126
+ timeZone?: string;
127
+ soonMinutes?: number;
128
+ messages?: DeliveryMessages;
129
+ }): QuoteNote | null;
130
+ /**
131
+ * `true` when saving a shipping rate failed because the quote expired or the rates changed, so the shop should reload
132
+ * the rates (and keep the address) instead of showing a generic failure. Recognizes the explicit codes
133
+ * (`quote_expired`, `rate_expired`…, any status), a `409`, and the generic `422` on the rate field that older servers
134
+ * answer when the provider re-quoted with new ids. 5xx and other 4xx stay real failures.
135
+ */
136
+ declare function isQuoteChange(err: {
137
+ status?: number;
138
+ code?: string | null;
139
+ field?: string | null;
140
+ } | null | undefined): boolean;
141
+ /**
142
+ * The rate of a fresh quote that matches the one the buyer had chosen (same carrier and service), so a re-quote keeps
143
+ * the choice even though the provider issued new ids. `null` when that service is no longer offered.
144
+ */
145
+ declare function matchRate<R extends Pick<ShippingRate, 'id' | 'carrier' | 'service_code' | 'title'>>(previous: Pick<ShippingRate, 'carrier' | 'service_code' | 'title'> | null | undefined, rates: readonly R[]): R | null;
146
+
147
+ type DeliveryOptionsClassNames = Partial<Record<'root' | 'option' | 'radio' | 'mark' | 'body' | 'title' | 'carrier' | 'service' | 'eta' | 'badges' | 'badge' | 'price' | 'free' | 'note' | 'partial' | 'skeleton', string>>;
148
+ type DeliveryOptionsProps = {
149
+ rates: readonly ShippingRate[];
150
+ pickup?: readonly PickupOption[];
151
+ /** Radio group name. Default `delivery_choice`. */
152
+ name?: string;
153
+ /** Form value of a rate. Default `rate:<id>`. */
154
+ rateValue?: (rate: ShippingRate) => string;
155
+ /** Form value of a pickup branch. Default `pickup:<branch_id>`. */
156
+ pickupValue?: (branch: PickupOption) => string;
157
+ /** Uncontrolled preselection. Default: the first rate. `null`: nothing preselected. */
158
+ defaultValue?: string | null;
159
+ /** Controlled value (use with `onValueChange`). */
160
+ value?: string;
161
+ onValueChange?: (value: string) => void;
162
+ /** Some provider did not answer (`DeliveryOptions.partial`): one neutral note above the list. */
163
+ partial?: boolean;
164
+ /** The previous quote expired or changed and these rates are fresh: one status note above the list. */
165
+ requoted?: boolean;
166
+ /** Rates are being quoted again: skeleton rows (no rates yet) or the current rows dimmed, `aria-busy`. */
167
+ loading?: boolean;
168
+ /** Quote deadline note: `always` (default), only when it is `soon`, or `never`. */
169
+ quoteNote?: 'always' | 'soon' | 'never';
170
+ /** Time zone of the note. Default: the buyer's browser. */
171
+ timeZone?: string;
172
+ /** Show the carrier marks. Default true. */
173
+ marks?: boolean;
174
+ /** Cheapest / fastest badges. Default true. */
175
+ badges?: boolean;
176
+ required?: boolean;
177
+ locale?: string;
178
+ messages?: Partial<DeliveryMessages>;
179
+ renderAmount?: (amount: Money) => ReactNode;
180
+ classNames?: DeliveryOptionsClassNames;
181
+ /** `data-testid` of every radio. */
182
+ testId?: string;
183
+ /** Rows the shop renders before the rates (e.g. "home delivery, rates after the address"). */
184
+ children?: ReactNode;
185
+ };
186
+ /**
187
+ * The rates and pickup branches of "Delivery" as native radios: carrier mark and commercial name, readable service,
188
+ * arrival time, cheapest / fastest badges, price as the server sends it, and ONE note for the quote deadline in the
189
+ * buyer's time zone. Works without JavaScript (plain radios in the page form); the note appears after hydration in a
190
+ * reserved line, so it never shifts the layout.
191
+ *
192
+ * Wrap it in the shop's own `<fieldset><legend>`. Style it with `classNames` and/or the default sheet
193
+ * `@asteby/storefront-react/checkout.css`.
194
+ */
195
+ declare function DeliveryOptions(props: DeliveryOptionsProps): react.JSX.Element;
196
+
197
+ export { type Brand, type BrandKind, BrandMark, type BrandMarkProps, type DeliveryMessages, DeliveryOptions, type DeliveryOptionsClassNames, type DeliveryOptionsProps, type QuoteNote, type RateBadge, brandKey, brandName, deliveryMessages, findBrand, isQuoteChange, listBrands, matchRate, quoteDeadline, quoteNote, rateBadges, rateCarrier, rateEta, rateService };
@@ -0,0 +1,197 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { ShippingRate, PickupOption, Money } from '@asteby/storefront';
4
+
5
+ type BrandMarkProps = {
6
+ /** Provider identifier (`fedex`, `oxxo`, `mercadopago`, `7eleven`…). Unknown keys get a neutral monogram. */
7
+ brand: string | null | undefined;
8
+ /** Licensed logo sent by the provider (`PaymentPoint.logo_url`…). Only `https:`; it wins over the badge. */
9
+ logoUrl?: string | null;
10
+ /** Height in px. The badge is 3:2 (width = 1.5 × height). Default 24. */
11
+ size?: number;
12
+ /**
13
+ * Accessible name. Omit it when the brand name is already written next to the mark (the usual case): the mark is then
14
+ * decorative (`aria-hidden`).
15
+ */
16
+ title?: string;
17
+ className?: string;
18
+ };
19
+ /**
20
+ * The mark of a carrier, card network, wallet or cash point: an inline SVG badge in the brand color with its short
21
+ * wordmark (no network request, same size on the server and in the browser, so no layout shift). With `logoUrl` it
22
+ * draws the provider's licensed logo instead, lazily, with fixed dimensions.
23
+ *
24
+ * The badge carries its own background, so it keeps its contrast on light and dark themes; a hairline
25
+ * (`--sf-brand-mark-ring`) separates it from the page.
26
+ */
27
+ declare function BrandMark({ brand, logoUrl, size, title, className }: BrandMarkProps): react.JSX.Element;
28
+
29
+ /**
30
+ * Shared catalog of the brands a checkout names: parcel carriers, card networks, wallets and cash payment points.
31
+ *
32
+ * Keys are the stable identifiers the providers already send (`ShippingRate.carrier` of Skydropx / Envía, the
33
+ * `PaymentPoint.payment_point` or `id` of the payment addon, a `PaymentMethod.key`). Nothing here decides what a shop
34
+ * offers: the server lists the rates and methods; this only gives each one its commercial name and a mark.
35
+ *
36
+ * Marks are typographic badges drawn by `<BrandMark>` (brand color + short wordmark): no third-party logo files are
37
+ * bundled, so there is no licensing question and no extra request. A provider that holds a licensed logo sends it as
38
+ * `logo_url` and it wins over the badge. Colors are close approximations of each brand's public color.
39
+ */
40
+ type BrandKind = 'carrier' | 'card' | 'wallet' | 'cash' | 'bank';
41
+ type Brand = {
42
+ key: string;
43
+ /** Commercial name, as the brand writes it. */
44
+ name: string;
45
+ kind: BrandKind;
46
+ /** Badge background. */
47
+ bg: string;
48
+ /** Badge text color (AA on `bg`). */
49
+ fg: string;
50
+ /** Short wordmark drawn in the badge (`\n` = two lines). Default: `name`. */
51
+ mark?: string;
52
+ /** Special drawings instead of a wordmark. */
53
+ shape?: 'mastercard';
54
+ };
55
+ /** `"FedEx México"`, `"fedex_mx"` and `"FEDEX"` all become `fedex`. Lowercase ASCII letters and digits only. */
56
+ declare function brandKey(raw: string | null | undefined): string;
57
+ /** Catalog entry for a provider identifier, or `null` when the brand is not in the catalog. */
58
+ declare function findBrand(raw: string | null | undefined): Brand | null;
59
+ /**
60
+ * Commercial name for a provider identifier: the catalog's (`fedex` → "FedEx") or, for an unknown one, the identifier
61
+ * in title case (`"envios_rapidos"` → "Envios Rapidos"). `null` for an empty input.
62
+ */
63
+ declare function brandName(raw: string | null | undefined): string | null;
64
+ /** Every brand of the catalog (for docs, previews and tests). */
65
+ declare function listBrands(kind?: BrandKind): Brand[];
66
+
67
+ /**
68
+ * Pure helpers for the "Delivery" step: how to name a carrier rate, its arrival time, which rate is the cheapest or the
69
+ * fastest, and one human note for the quote deadline. No amounts are computed: `cost` is shown as the server sends it;
70
+ * comparing two costs to flag the cheapest is the only arithmetic.
71
+ */
72
+
73
+ type DeliveryMessages = {
74
+ /** `{n}` = business days. */
75
+ etaOne: string;
76
+ etaMany: string;
77
+ /** `{min}` / `{max}` = business days. */
78
+ etaRange: string;
79
+ etaUpTo: string;
80
+ etaFrom: string;
81
+ cheapest: string;
82
+ fastest: string;
83
+ free: string;
84
+ pickupTitle: string;
85
+ /** Quote deadline, `{time}` = local time. */
86
+ quoteToday: string;
87
+ quoteTomorrow: string;
88
+ /** `{date}` = short date + time. */
89
+ quoteLater: string;
90
+ quoteSoon: string;
91
+ partial: string;
92
+ loading: string;
93
+ /** The quote expired or changed and the rates were reloaded. */
94
+ requoted: string;
95
+ };
96
+ /** Messages for a locale (`es*` default, `en*`), with optional overrides. */
97
+ declare function deliveryMessages(locale?: string | null, overrides?: Partial<DeliveryMessages> | null): DeliveryMessages;
98
+ /** Commercial carrier name of a rate (`fedex` → "FedEx"); `null` without carrier. */
99
+ declare function rateCarrier(rate: Pick<ShippingRate, 'carrier'>): string | null;
100
+ /**
101
+ * Service name without the carrier repeated: "FedEx Express Saver" with carrier `fedex` → "Express Saver". Falls back
102
+ * to the title when stripping would leave nothing.
103
+ */
104
+ declare function rateService(rate: Pick<ShippingRate, 'title' | 'carrier'>): string;
105
+ /** Arrival time of a rate: business days from the provider, else the server `eta` text as is. */
106
+ declare function rateEta(rate: Pick<ShippingRate, 'eta' | 'eta_days_min' | 'eta_days_max'>, messages?: DeliveryMessages): string | null;
107
+ type RateBadge = 'cheapest' | 'fastest';
108
+ /**
109
+ * Badges per rate id. Only with two or more rates, only when one rate is strictly the cheapest (same currency) or
110
+ * strictly the fastest: a tie gets no badge, so the badge always tells the buyer something.
111
+ */
112
+ declare function rateBadges(rates: readonly ShippingRate[]): Map<string, RateBadge[]>;
113
+ /** Earliest `expires_at` of the rates (the deadline of the whole list), or `null`. */
114
+ declare function quoteDeadline(rates: readonly Pick<ShippingRate, 'expires_at'>[]): Date | null;
115
+ type QuoteNote = {
116
+ text: string;
117
+ soon: boolean;
118
+ };
119
+ /**
120
+ * One human note for the quote deadline, in the buyer's time zone (or `timeZone`): "valid until 9:39 p.m.", "until
121
+ * tomorrow at…", "until Oct 24, …", or "expire soon" within `soonMinutes` (default 15). `null` when already past.
122
+ */
123
+ declare function quoteNote(deadline: Date | null, opts?: {
124
+ locale?: string;
125
+ now?: Date;
126
+ timeZone?: string;
127
+ soonMinutes?: number;
128
+ messages?: DeliveryMessages;
129
+ }): QuoteNote | null;
130
+ /**
131
+ * `true` when saving a shipping rate failed because the quote expired or the rates changed, so the shop should reload
132
+ * the rates (and keep the address) instead of showing a generic failure. Recognizes the explicit codes
133
+ * (`quote_expired`, `rate_expired`…, any status), a `409`, and the generic `422` on the rate field that older servers
134
+ * answer when the provider re-quoted with new ids. 5xx and other 4xx stay real failures.
135
+ */
136
+ declare function isQuoteChange(err: {
137
+ status?: number;
138
+ code?: string | null;
139
+ field?: string | null;
140
+ } | null | undefined): boolean;
141
+ /**
142
+ * The rate of a fresh quote that matches the one the buyer had chosen (same carrier and service), so a re-quote keeps
143
+ * the choice even though the provider issued new ids. `null` when that service is no longer offered.
144
+ */
145
+ declare function matchRate<R extends Pick<ShippingRate, 'id' | 'carrier' | 'service_code' | 'title'>>(previous: Pick<ShippingRate, 'carrier' | 'service_code' | 'title'> | null | undefined, rates: readonly R[]): R | null;
146
+
147
+ type DeliveryOptionsClassNames = Partial<Record<'root' | 'option' | 'radio' | 'mark' | 'body' | 'title' | 'carrier' | 'service' | 'eta' | 'badges' | 'badge' | 'price' | 'free' | 'note' | 'partial' | 'skeleton', string>>;
148
+ type DeliveryOptionsProps = {
149
+ rates: readonly ShippingRate[];
150
+ pickup?: readonly PickupOption[];
151
+ /** Radio group name. Default `delivery_choice`. */
152
+ name?: string;
153
+ /** Form value of a rate. Default `rate:<id>`. */
154
+ rateValue?: (rate: ShippingRate) => string;
155
+ /** Form value of a pickup branch. Default `pickup:<branch_id>`. */
156
+ pickupValue?: (branch: PickupOption) => string;
157
+ /** Uncontrolled preselection. Default: the first rate. `null`: nothing preselected. */
158
+ defaultValue?: string | null;
159
+ /** Controlled value (use with `onValueChange`). */
160
+ value?: string;
161
+ onValueChange?: (value: string) => void;
162
+ /** Some provider did not answer (`DeliveryOptions.partial`): one neutral note above the list. */
163
+ partial?: boolean;
164
+ /** The previous quote expired or changed and these rates are fresh: one status note above the list. */
165
+ requoted?: boolean;
166
+ /** Rates are being quoted again: skeleton rows (no rates yet) or the current rows dimmed, `aria-busy`. */
167
+ loading?: boolean;
168
+ /** Quote deadline note: `always` (default), only when it is `soon`, or `never`. */
169
+ quoteNote?: 'always' | 'soon' | 'never';
170
+ /** Time zone of the note. Default: the buyer's browser. */
171
+ timeZone?: string;
172
+ /** Show the carrier marks. Default true. */
173
+ marks?: boolean;
174
+ /** Cheapest / fastest badges. Default true. */
175
+ badges?: boolean;
176
+ required?: boolean;
177
+ locale?: string;
178
+ messages?: Partial<DeliveryMessages>;
179
+ renderAmount?: (amount: Money) => ReactNode;
180
+ classNames?: DeliveryOptionsClassNames;
181
+ /** `data-testid` of every radio. */
182
+ testId?: string;
183
+ /** Rows the shop renders before the rates (e.g. "home delivery, rates after the address"). */
184
+ children?: ReactNode;
185
+ };
186
+ /**
187
+ * The rates and pickup branches of "Delivery" as native radios: carrier mark and commercial name, readable service,
188
+ * arrival time, cheapest / fastest badges, price as the server sends it, and ONE note for the quote deadline in the
189
+ * buyer's time zone. Works without JavaScript (plain radios in the page form); the note appears after hydration in a
190
+ * reserved line, so it never shifts the layout.
191
+ *
192
+ * Wrap it in the shop's own `<fieldset><legend>`. Style it with `classNames` and/or the default sheet
193
+ * `@asteby/storefront-react/checkout.css`.
194
+ */
195
+ declare function DeliveryOptions(props: DeliveryOptionsProps): react.JSX.Element;
196
+
197
+ export { type Brand, type BrandKind, BrandMark, type BrandMarkProps, type DeliveryMessages, DeliveryOptions, type DeliveryOptionsClassNames, type DeliveryOptionsProps, type QuoteNote, type RateBadge, brandKey, brandName, deliveryMessages, findBrand, isQuoteChange, listBrands, matchRate, quoteDeadline, quoteNote, rateBadges, rateCarrier, rateEta, rateService };