@asteby/storefront-react 0.19.0 → 0.21.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.
Files changed (51) hide show
  1. package/README.md +41 -0
  2. package/dist/account-server.cjs +405 -7
  3. package/dist/account-server.cjs.map +1 -1
  4. package/dist/account-server.d.cts +41 -1
  5. package/dist/account-server.d.ts +41 -1
  6. package/dist/account-server.js +73 -3
  7. package/dist/account-server.js.map +1 -1
  8. package/dist/account.cjs +1663 -4
  9. package/dist/account.cjs.map +1 -1
  10. package/dist/account.css +362 -0
  11. package/dist/account.d.cts +499 -3
  12. package/dist/account.d.ts +499 -3
  13. package/dist/account.js +1102 -2
  14. package/dist/account.js.map +1 -1
  15. package/dist/cart.cjs +125 -2
  16. package/dist/cart.cjs.map +1 -1
  17. package/dist/cart.css +145 -2
  18. package/dist/cart.js +4 -2
  19. package/dist/cart.js.map +1 -1
  20. package/dist/checkout.cjs +129 -1
  21. package/dist/checkout.cjs.map +1 -1
  22. package/dist/checkout.css +142 -0
  23. package/dist/checkout.d.cts +3 -1
  24. package/dist/checkout.d.ts +3 -1
  25. package/dist/checkout.js +10 -3
  26. package/dist/checkout.js.map +1 -1
  27. package/dist/chunk-PPQEUTXJ.js +260 -0
  28. package/dist/chunk-PPQEUTXJ.js.map +1 -0
  29. package/dist/chunk-TXEYBDFG.js +182 -0
  30. package/dist/chunk-TXEYBDFG.js.map +1 -0
  31. package/dist/chunk-VHEY5AU3.js +152 -0
  32. package/dist/chunk-VHEY5AU3.js.map +1 -0
  33. package/dist/fiscal.d.cts +34 -34
  34. package/dist/fiscal.d.ts +34 -34
  35. package/dist/fiscal.js +4 -258
  36. package/dist/fiscal.js.map +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/payments.css +15 -14
  39. package/dist/payments.js +2 -2
  40. package/dist/product-preview-DRtLWGLS.d.cts +85 -0
  41. package/dist/product-preview-DaICr4f2.d.ts +85 -0
  42. package/dist/ui.cjs +202 -0
  43. package/dist/ui.cjs.map +1 -1
  44. package/dist/ui.css +142 -0
  45. package/dist/ui.d.cts +3 -0
  46. package/dist/ui.d.ts +3 -0
  47. package/dist/ui.js +3 -1
  48. package/dist/ui.js.map +1 -1
  49. package/dist/voucher-document-SFWJCLTN.js +124 -0
  50. package/dist/voucher-document-SFWJCLTN.js.map +1 -0
  51. package/package.json +2 -2
@@ -1,9 +1,12 @@
1
1
  import * as react from 'react';
2
- import { ComponentType, ReactNode } from 'react';
3
- import { CustomerCapabilities } from '@asteby/storefront';
2
+ import { ComponentType, ReactNode, MouseEvent } from 'react';
3
+ import { CustomerCapabilities, Order, NextAction, OrderProgress as OrderProgress$1, OrderLine, Shipment, ShipmentMap, InvoiceDoc, InvoiceSummary, InvoiceFileKind, PendingPayment, PaymentInfo, Refund, StorefrontClient, Connection, Money } from '@asteby/storefront';
4
4
  import { a as CheckoutFieldClassNames } from './fields-vnMUi2HB.cjs';
5
5
  import { A as AuthActionData, c as AuthStep, a as AuthErrorCode } from './types-D7pVK0GK.cjs';
6
6
  export { b as AuthIntent } from './types-D7pVK0GK.cjs';
7
+ import { a as ProductPreviewClassNames, e as ProductThumbImage } from './product-preview-DRtLWGLS.cjs';
8
+ export { P as ProductPreview, b as ProductPreviewProps, c as ProductThumb, f as ProductThumbProps, g as ProductThumbStack, h as ProductThumbStackProps, p as productInitials } from './product-preview-DRtLWGLS.cjs';
9
+ import './components-B5XhSH-m.cjs';
7
10
 
8
11
  type AccountAuthView = 'login' | 'register' | 'otp-email' | 'forgot' | AuthStep;
9
12
  type AccountAuthMessages = {
@@ -127,4 +130,497 @@ type PostPurchaseAccountPromptProps = {
127
130
  */
128
131
  declare function PostPurchaseAccountPrompt({ email, capabilities, data, next, pending, form: FormTag, action, headingLevel, loginHref, locale, messages, classNames: cx, children, }: PostPurchaseAccountPromptProps): react.JSX.Element | null;
129
132
 
130
- export { AccountAuth, type AccountAuthClassNames, type AccountAuthMessages, type AccountAuthProps, type AccountAuthView, type AccountFormProps, AuthActionData, AuthErrorCode, AuthStep, PostPurchaseAccountPrompt, type PostPurchaseAccountPromptClassNames, type PostPurchaseAccountPromptMessages, type PostPurchaseAccountPromptProps, accountAuthMessages, postPurchaseAccountPromptMessages };
133
+ /**
134
+ * Texts of the order screens (`OrderList`, `OrderProgress`, `NextActionBar`, `ShipmentCard`, `InvoiceList`,
135
+ * `PendingPaymentCard`, `RefundList`). Spanish (es-MX) by default, English with `en*`, anything with `messages`.
136
+ * Server enums are open: every group has a `*.unknown` text so a value this SDK has never seen reads as plain words,
137
+ * never as a raw code.
138
+ */
139
+
140
+ declare const ES: {
141
+ readonly 'order.number': "Pedido {number}";
142
+ readonly 'order.placed': "Realizado el {date}";
143
+ readonly 'order.total': "Total";
144
+ readonly 'order.view': "Ver pedido";
145
+ readonly 'order.items.one': "{count} artículo";
146
+ readonly 'order.items.other': "{count} artículos";
147
+ readonly 'order.lines': "Artículos del pedido";
148
+ readonly 'order.line.quantity': "Cantidad {n}";
149
+ readonly 'order.line.each': "{price} c/u";
150
+ readonly 'order.line.unavailable': "Producto no disponible";
151
+ readonly 'order.productsMore': "y {n} más";
152
+ readonly 'order.stepOf': "Paso {n} de {total}: {step}";
153
+ readonly 'order.listLabel': "Tus pedidos";
154
+ readonly 'order.loading': "Cargando tus pedidos";
155
+ readonly 'order.loadMore': "Ver más pedidos";
156
+ readonly 'order.loadingMore': "Cargando…";
157
+ readonly 'order.error': "No pudimos cargar tus pedidos. Tus compras están a salvo.";
158
+ readonly 'order.retry': "Reintentar";
159
+ readonly 'order.emptyTitle': "Aún no tienes pedidos";
160
+ readonly 'order.emptyBody': "Cuando compres, aquí verás el estado y el envío de cada pedido.";
161
+ readonly 'order.emptyGuest': "¿Compraste como invitado? Verifica tu correo para ver aquí tus pedidos.";
162
+ readonly 'stage.pending_payment': "Esperando pago";
163
+ readonly 'stage.paid': "Pagado";
164
+ readonly 'stage.preparing': "En preparación";
165
+ readonly 'stage.ready_for_pickup': "Listo para recoger";
166
+ readonly 'stage.shipped': "Enviado";
167
+ readonly 'stage.in_transit': "En camino";
168
+ readonly 'stage.out_for_delivery': "En reparto";
169
+ readonly 'stage.delivered': "Entregado";
170
+ readonly 'stage.cancelled': "Cancelado";
171
+ readonly 'stage.refunded': "Reembolsado";
172
+ readonly 'stage.unknown': "En proceso";
173
+ readonly 'progress.label': "Progreso del pedido";
174
+ readonly 'step.paid': "Pagado";
175
+ readonly 'step.preparing': "En preparación";
176
+ readonly 'step.shipped': "Enviado";
177
+ readonly 'step.in_transit': "En camino";
178
+ readonly 'step.ready_for_pickup': "Listo para recoger";
179
+ readonly 'step.delivered': "Entregado";
180
+ readonly 'step.unknown': "Siguiente paso";
181
+ readonly 'stepState.done': "completado";
182
+ readonly 'stepState.current': "paso actual";
183
+ readonly 'stepState.pending': "pendiente";
184
+ readonly 'stepState.problem': "con incidencia";
185
+ readonly 'problem.delivery_exception': "Hubo un problema con la entrega. Contacta a la tienda si no se resuelve.";
186
+ readonly 'problem.returned': "El paquete regresó a la tienda. Contáctanos para coordinar un nuevo envío.";
187
+ readonly 'problem.lost': "No encontramos tu paquete. Contáctanos y lo resolvemos.";
188
+ readonly 'problem.payment_failed': "El pago no se completó. Puedes intentarlo de nuevo.";
189
+ readonly 'problem.unknown': "Tu pedido tiene una incidencia. Contacta a la tienda.";
190
+ readonly 'progress.cancelled': "Este pedido fue cancelado.";
191
+ readonly 'progress.refunded': "Este pedido fue reembolsado.";
192
+ readonly 'action.pay': "Pagar ahora";
193
+ readonly 'action.track': "Rastrear envío";
194
+ readonly 'action.pickup': "Recoger en sucursal";
195
+ readonly 'action.download_invoice': "Descargar factura";
196
+ readonly 'action.request_invoice': "Solicitar factura";
197
+ readonly 'action.correct_invoice_data': "Corregir datos de facturación";
198
+ readonly 'action.contact_store': "Contactar a la tienda";
199
+ readonly 'action.unknown': "Ver detalle";
200
+ readonly 'action.newTab': "(se abre en una pestaña nueva)";
201
+ readonly 'action.label': "Siguiente paso del pedido";
202
+ readonly 'shipment.title': "Envío";
203
+ readonly 'shipment.return': "Devolución";
204
+ readonly 'shipment.carrier': "Paquetería";
205
+ readonly 'shipment.service': "Servicio";
206
+ readonly 'shipment.number': "Número de guía";
207
+ readonly 'shipment.copy': "Copiar";
208
+ readonly 'shipment.copied': "Copiado";
209
+ readonly 'shipment.copyFailed': "No pudimos copiar; selecciona el texto.";
210
+ readonly 'shipment.track': "Rastrear con {carrier}";
211
+ readonly 'shipment.trackGeneric': "Rastrear envío";
212
+ readonly 'shipment.promised': "Llega a más tardar el {date}";
213
+ readonly 'shipment.delivered': "Entregado el {date}";
214
+ readonly 'shipment.shipped': "Enviado el {date}";
215
+ readonly 'shipment.events': "Movimientos";
216
+ readonly 'shipment.noEvents': "La paquetería aún no registra movimientos; suele tardar 24 horas.";
217
+ readonly 'shipment.showAll': "Ver todo ({count})";
218
+ readonly 'shipment.showLess': "Ver menos";
219
+ readonly 'shipment.returnLabel': "Guía de devolución";
220
+ readonly 'shipment.test': "De prueba";
221
+ readonly 'shipment.testNote': "Envío de prueba: no es un envío real.";
222
+ readonly 'shipment.preparing': "Preparando tu envío";
223
+ readonly 'shipment.status.pending': "Preparando envío";
224
+ readonly 'shipment.status.label_created': "Guía generada";
225
+ readonly 'shipment.status.in_transit': "En camino";
226
+ readonly 'shipment.status.out_for_delivery': "En reparto";
227
+ readonly 'shipment.status.delivered': "Entregado";
228
+ readonly 'shipment.status.exception': "Incidencia en la entrega";
229
+ readonly 'shipment.status.returned': "Devuelto a la tienda";
230
+ readonly 'shipment.status.lost': "Extraviado";
231
+ readonly 'shipment.status.cancelled': "Cancelado";
232
+ readonly 'shipment.status.unknown': "En proceso";
233
+ readonly 'shipment.eventFrom': "{location}";
234
+ readonly 'invoice.title': "Facturas";
235
+ readonly 'invoice.invoice': "Factura";
236
+ readonly 'invoice.creditNote': "Nota de crédito";
237
+ readonly 'invoice.creditNoteOf': "Corrige la factura {folio}";
238
+ readonly 'invoice.folio': "Folio fiscal";
239
+ readonly 'invoice.series': "Serie y folio";
240
+ readonly 'invoice.issued': "Emitida el {date}";
241
+ readonly 'invoice.total': "Total";
242
+ readonly 'invoice.pdf': "Descargar PDF";
243
+ readonly 'invoice.xml': "Descargar XML";
244
+ readonly 'invoice.downloadOf': "{action}, {kind} {name}";
245
+ readonly 'invoice.none': "Aún no hay facturas de este pedido.";
246
+ readonly 'invoice.test': "Factura de prueba, sin validez";
247
+ readonly 'invoice.status.issued': "Emitida";
248
+ readonly 'invoice.status.pending': "En proceso";
249
+ readonly 'invoice.status.cancelled': "Cancelada";
250
+ readonly 'invoice.status.error': "No se pudo emitir";
251
+ readonly 'invoice.status.unknown': "En proceso";
252
+ readonly 'invoice.statusNote.pending': "La estamos generando; te avisaremos cuando esté lista.";
253
+ readonly 'invoice.statusNote.error': "Contacta a la tienda para resolverlo.";
254
+ readonly 'invoice.statusNote.cancelled': "Esta factura fue cancelada y ya no tiene validez.";
255
+ readonly 'pending.title': "Pendientes de pago";
256
+ readonly 'pending.intro': "Tu pedido se genera en cuanto confirmamos el pago. Paga con la ficha antes de que venza.";
257
+ readonly 'pending.waiting': "Esperando pago";
258
+ readonly 'pending.expired': "Vencida";
259
+ readonly 'pending.reference': "Referencia";
260
+ readonly 'pending.clabe': "CLABE";
261
+ readonly 'pending.expires': "Vence el {date}";
262
+ readonly 'pending.expiredOn': "Venció el {date}";
263
+ readonly 'pending.total': "Total";
264
+ readonly 'pending.copyReference': "Copiar referencia";
265
+ readonly 'pending.copyClabe': "Copiar CLABE";
266
+ readonly 'pending.copied': "Copiada";
267
+ readonly 'pending.copyFailed': "No pudimos copiar; selecciona el texto.";
268
+ readonly 'pending.print': "Ver e imprimir ficha";
269
+ readonly 'pending.download': "Descargar ficha";
270
+ readonly 'pending.expiredNote': "Esta ficha ya no es válida. Haz tu pedido de nuevo.";
271
+ readonly 'pending.barcode': "Código de barras {code}";
272
+ readonly 'pending.method.oxxo': "OXXO";
273
+ readonly 'pending.method.spei': "Transferencia SPEI";
274
+ readonly 'pending.method.bank_transfer': "Transferencia bancaria";
275
+ readonly 'pending.method.bank_deposit': "Depósito bancario";
276
+ readonly 'pending.method.cash': "Pago en efectivo";
277
+ readonly 'pending.method.unknown': "Pago en efectivo";
278
+ readonly 'refund.title': "Reembolsos";
279
+ readonly 'refund.status.requested': "Solicitado";
280
+ readonly 'refund.status.processing': "En proceso";
281
+ readonly 'refund.status.completed': "Completado";
282
+ readonly 'refund.status.failed': "No se pudo completar";
283
+ readonly 'refund.status.unknown': "En proceso";
284
+ readonly 'refund.requested': "Solicitado el {date}";
285
+ readonly 'refund.completed': "Completado el {date}";
286
+ readonly 'refund.none': "Este pedido no tiene reembolsos.";
287
+ readonly 'payment.title': "Pagos";
288
+ readonly 'payment.status.paid': "Pagado";
289
+ readonly 'payment.status.pending': "Pendiente";
290
+ readonly 'payment.status.failed': "Fallido";
291
+ readonly 'payment.status.refunded': "Reembolsado";
292
+ readonly 'payment.status.partially_refunded': "Reembolsado parcialmente";
293
+ readonly 'payment.status.unknown': "En proceso";
294
+ readonly 'payment.paidOn': "Pagado el {date}";
295
+ readonly 'section.error': "No pudimos cargar esta sección.";
296
+ readonly 'section.retry': "Reintentar";
297
+ readonly 'section.loading': "Cargando";
298
+ };
299
+ type AccountMessageKey = keyof typeof ES;
300
+ type AccountMessages = Record<AccountMessageKey, string>;
301
+ /** Messages for a locale (`es*` default, `en*`), with optional per-key overrides. */
302
+ declare function accountMessages(locale?: string | null, overrides?: Partial<AccountMessages> | null): AccountMessages;
303
+ /** Text for an open enum: `<group>.<value>` when this SDK knows it, else `<group>.unknown`. Never the raw value. */
304
+ declare function enumText(m: AccountMessages, group: string, value: unknown): string;
305
+
306
+ type AccountTextProps = {
307
+ /** BCP 47; defaults to the provider's, then `es-MX`. */
308
+ locale?: string;
309
+ /** Per-key text overrides (a store's own words). */
310
+ messages?: Partial<AccountMessages>;
311
+ /** IANA time zone for dates (`America/Mexico_City`). Pass the store's own to get the same text on server and browser. */
312
+ timeZone?: string;
313
+ };
314
+
315
+ type OrderTone = 'done' | 'current' | 'problem' | 'muted';
316
+ /** Tone of a stage for the store's own colors (`data-sf-tone`). */
317
+ declare function stageTone(stage: string, problem?: unknown): OrderTone;
318
+ type OrderStatusBadgeProps = AccountTextProps & {
319
+ /** The order (its `progress` or a derived one is used) ... */
320
+ order?: Order;
321
+ /** ... or the progress itself. */
322
+ progress?: OrderProgress$1;
323
+ className?: string;
324
+ };
325
+ /** Status in words with a semantic tone: `<span data-sf-order-badge data-sf-tone="current">En camino</span>`. */
326
+ declare function OrderStatusBadge({ order, progress, className, ...text }: OrderStatusBadgeProps): react.JSX.Element | null;
327
+ type OrderProgressClassNames = Partial<Record<'root' | 'list' | 'step' | 'marker' | 'label' | 'time' | 'problem' | 'terminal', string>>;
328
+ type OrderProgressProps = AccountTextProps & {
329
+ /** Pass the order (progress is read or derived) ... */
330
+ order?: Order;
331
+ /** ... or the progress. */
332
+ progress?: OrderProgress$1;
333
+ /** `compact`: only the current step and "step 3 of 5", for a list card. */
334
+ variant?: 'full' | 'compact';
335
+ classNames?: OrderProgressClassNames;
336
+ };
337
+ /**
338
+ * `<ol>` with the steps paid → preparing → shipped → on its way → delivered (or pickup). The current step carries
339
+ * `aria-current="step"`; every state also has text for screen readers, and a problem is written out below the list.
340
+ */
341
+ declare function OrderProgress({ order, progress, variant, classNames: cx, ...text }: OrderProgressProps): react.JSX.Element | null;
342
+ type NextActionBarClassNames = Partial<Record<'root' | 'primary' | 'secondary', string>>;
343
+ type NextActionBarProps = AccountTextProps & {
344
+ /** The order (its `next_action` is read or derived) ... */
345
+ order?: Order;
346
+ /** ... or the action itself. */
347
+ action?: NextAction | null;
348
+ /**
349
+ * Where each action goes in YOUR store: `pay` → the voucher/checkout, `download_invoice` → your invoice-file route,
350
+ * `request_invoice` / `correct_invoice_data` → your invoice form, `contact_store` → your contact page. `track` and
351
+ * `pickup` default to the action's own `https` link. Return `null` when there is nowhere to go: the bar then renders
352
+ * a button only if `onAction` handles it, and nothing otherwise.
353
+ */
354
+ hrefFor?: (action: NextAction) => string | null | undefined;
355
+ /** Click handler for actions with no link (`pay` opening a dialog...). Called with the action. */
356
+ onAction?: (action: NextAction, event: MouseEvent<HTMLElement>) => void;
357
+ /** Secondary buttons next to the primary one (copy tracking number, request return...). */
358
+ secondary?: ReactNode;
359
+ classNames?: NextActionBarClassNames;
360
+ };
361
+ /**
362
+ * ONE primary call to action: "Rastrear envío", "Descargar factura", "Pagar ahora"... Links that leave the store carry
363
+ * `rel="noopener noreferrer"` and a hidden "(opens in a new tab)". Nothing renders for `none` or an action with no
364
+ * way to act.
365
+ */
366
+ declare function NextActionBar({ order, action, hrefFor, onAction, secondary, classNames: cx, ...text }: NextActionBarProps): react.JSX.Element | null;
367
+
368
+ type OrderCardClassNames = Partial<Record<'root' | 'header' | 'products' | 'number' | 'link' | 'meta' | 'badge' | 'summary' | 'shipment' | 'footer' | 'total' | 'actions', string>> & {
369
+ progress?: OrderProgressClassNames;
370
+ action?: NextActionBarClassNames;
371
+ };
372
+ type OrderCardProps = AccountTextProps & {
373
+ order: Order;
374
+ /** Where the order detail lives in your store. The whole card is reached through the number's link. */
375
+ orderHref: (order: Order) => string;
376
+ /** Where each next action goes (see `NextActionBar.hrefFor`). */
377
+ actionHref?: (action: NextAction, order: Order) => string | null | undefined;
378
+ onAction?: (action: NextAction, order: Order) => void;
379
+ /** Heading level of the order number (default 3). */
380
+ headingLevel?: 2 | 3 | 4;
381
+ classNames?: OrderCardClassNames;
382
+ };
383
+ declare function OrderCard({ order, orderHref, actionHref, onAction, headingLevel, classNames: cx, ...text }: OrderCardProps): react.JSX.Element;
384
+ type OrderListClassNames = Partial<Record<'root' | 'list' | 'item' | 'skeleton' | 'empty' | 'emptyTitle' | 'emptyBody' | 'emptyGuest' | 'error' | 'retry' | 'more', string>> & {
385
+ card?: OrderCardClassNames;
386
+ };
387
+ type OrderListProps = AccountTextProps & Pick<OrderCardProps, 'orderHref' | 'actionHref' | 'onAction' | 'headingLevel'> & {
388
+ orders?: readonly Order[] | null;
389
+ status?: 'loading' | 'ready' | 'error';
390
+ /** Skeleton cards while loading (default 3). */
391
+ skeletons?: number;
392
+ onRetry?: () => void;
393
+ hasMore?: boolean;
394
+ loadingMore?: boolean;
395
+ onLoadMore?: () => void;
396
+ /** Your call to action in the empty state ("Ver catálogo"). */
397
+ emptyAction?: ReactNode;
398
+ /** Show "bought as a guest? verify your email" in the empty state (default true). */
399
+ guestHint?: boolean;
400
+ classNames?: OrderListClassNames;
401
+ };
402
+ declare function OrderList({ orders, status, skeletons, onRetry, hasMore, loadingMore, onLoadMore, emptyAction, guestHint, orderHref, actionHref, onAction, headingLevel, classNames: cx, ...text }: OrderListProps): react.JSX.Element;
403
+
404
+ /** The picture of a line when it carries a usable URL. */
405
+ declare function lineImage(line: Partial<OrderLine> | null | undefined): ProductThumbImage | null;
406
+ type OrderLinesClassNames = Partial<Record<'root' | 'list' | 'item', string>> & {
407
+ preview?: ProductPreviewClassNames;
408
+ };
409
+ type OrderLinesProps = AccountTextProps & {
410
+ order: Pick<Order, 'lines'>;
411
+ /** Product page of a line (return `null` for none). */
412
+ lineHref?: (line: OrderLine) => string | null | undefined;
413
+ /** Thumb side in px. Default 64. */
414
+ size?: number;
415
+ /** Heading of the list for screen readers. */
416
+ label?: string;
417
+ classNames?: OrderLinesClassNames;
418
+ };
419
+ declare function OrderLines({ order, lineHref, size, label, classNames: cx, ...text }: OrderLinesProps): react.JSX.Element | null;
420
+ /** The products of an order as overlapped pictures with "+N": the glance of an order card. */
421
+ declare function OrderProductsStack({ order, size, max, className, ...text }: AccountTextProps & {
422
+ order: Pick<Order, 'lines'>;
423
+ size?: number;
424
+ max?: number;
425
+ className?: string;
426
+ }): react.JSX.Element | null;
427
+
428
+ type ShipmentCardClassNames = Partial<Record<'root' | 'header' | 'carrier' | 'status' | 'meta' | 'number' | 'actions' | 'link' | 'copy' | 'events' | 'event' | 'toggle' | 'empty' | 'test' | 'map', string>>;
429
+ /** What `renderMap` receives. */
430
+ type ShipmentMapSlotProps = {
431
+ shipment: Shipment;
432
+ map: ShipmentMap;
433
+ };
434
+ type ShipmentCardProps = AccountTextProps & {
435
+ shipment: Shipment;
436
+ /** A sandbox shipment: `hide` (default) renders nothing; `mark` shows it labelled "test", without number or link. */
437
+ testMode?: 'hide' | 'mark';
438
+ /** How many events show before "Show all". Default 3. */
439
+ eventsPreview?: number;
440
+ /** The carrier's logo/brand mark (e.g. `<BrandMark brand={shipment.carrier_logo_key} />` from `/checkout`); kept out of this bundle on purpose. */
441
+ renderCarrierMark?: (shipment: Shipment) => ReactNode;
442
+ /** Slot for the map (F7). Called only when the shipment has a `map`. */
443
+ renderMap?: (props: ShipmentMapSlotProps) => ReactNode;
444
+ /** Heading level of the title (default 3). */
445
+ headingLevel?: 2 | 3 | 4 | 5;
446
+ classNames?: ShipmentCardClassNames;
447
+ };
448
+ declare function ShipmentCard({ shipment, testMode, eventsPreview, renderCarrierMark, renderMap, headingLevel, classNames: cx, ...text }: ShipmentCardProps): react.JSX.Element | null;
449
+
450
+ type InvoiceListClassNames = Partial<Record<'root' | 'title' | 'group' | 'doc' | 'status' | 'meta' | 'note' | 'actions' | 'download' | 'creditNotes' | 'test' | 'error' | 'retry' | 'empty', string>>;
451
+ type InvoiceListProps = AccountTextProps & {
452
+ invoices?: readonly InvoiceDoc[] | null;
453
+ /** The order's invoice summary, handed to `renderSummary` when there are no documents. */
454
+ summary?: InvoiceSummary | null;
455
+ /** Draws the summary (request, needs data, being generated...): `(s) => <InvoiceStatusCard invoice={s} requestHref="/factura" />`. */
456
+ renderSummary?: (summary: InvoiceSummary) => ReactNode;
457
+ /** Your authenticated download route for a file of a document, e.g. `/cuenta/pedidos/${order}/facturas/${doc.id}.${kind}`. */
458
+ fileHref?: (doc: InvoiceDoc, kind: InvoiceFileKind) => string | null | undefined;
459
+ /** Alternative to `fileHref`: a handler (opens your own download flow). */
460
+ onDownload?: (doc: InvoiceDoc, kind: InvoiceFileKind) => void;
461
+ /** The server could not read the invoices (`order.degraded` has `invoices`): shows a recoverable error. */
462
+ degraded?: boolean;
463
+ onRetry?: () => void;
464
+ /** A sandbox invoice: `mark` (default) shows it labelled and with no download; `hide` removes it. */
465
+ testMode?: 'hide' | 'mark';
466
+ /** Money formatter is `Intl`; the order's currency comes with each total. */
467
+ headingLevel?: 2 | 3 | 4;
468
+ /** Content under the list (e.g. a "Request invoice" button). */
469
+ children?: ReactNode;
470
+ classNames?: InvoiceListClassNames;
471
+ };
472
+ declare function InvoiceList({ invoices, summary, renderSummary, fileHref, onDownload, degraded, onRetry, testMode, headingLevel, children, classNames: cx, ...text }: InvoiceListProps): react.JSX.Element;
473
+
474
+ type BarcodeProps = {
475
+ value: string;
476
+ label: string;
477
+ height?: number;
478
+ className?: string;
479
+ };
480
+ /** Code 128 as an inline `<svg role="img">` (no HTML injection). `null` when the value cannot be encoded. */
481
+ declare function Barcode({ value, label, height, className }: BarcodeProps): react.JSX.Element | null;
482
+ type PendingPaymentCardClassNames = Partial<Record<'root' | 'header' | 'method' | 'badge' | 'field' | 'label' | 'value' | 'barcode' | 'expiry' | 'total' | 'note' | 'actions' | 'primary' | 'secondary', string>>;
483
+ type PendingPaymentCardProps = AccountTextProps & {
484
+ payment: PendingPayment;
485
+ /** Server route that serves the printable voucher: `(payment, { download })`. Without it the browser builds it. */
486
+ voucherHref?: (payment: PendingPayment, opts: {
487
+ download: boolean;
488
+ }) => string;
489
+ /** Store name printed on the document built in the browser. */
490
+ shopName?: string;
491
+ headingLevel?: 2 | 3 | 4;
492
+ classNames?: PendingPaymentCardClassNames;
493
+ children?: ReactNode;
494
+ };
495
+ declare function PendingPaymentCard({ payment, voucherHref, shopName, headingLevel, classNames: cx, children, ...text }: PendingPaymentCardProps): react.JSX.Element | null;
496
+ type PendingPaymentListProps = AccountTextProps & Pick<PendingPaymentCardProps, 'voucherHref' | 'shopName' | 'classNames'> & {
497
+ payments?: readonly PendingPayment[] | null;
498
+ headingLevel?: 2 | 3;
499
+ /** Classes of the section itself. */
500
+ listClassNames?: Partial<Record<'root' | 'title' | 'intro' | 'list' | 'item', string>>;
501
+ };
502
+ /** "Pendientes de pago": the valid vouchers first, then the expired ones. Renders nothing when there are none. */
503
+ declare function PendingPaymentList({ payments, voucherHref, shopName, classNames, listClassNames: lc, headingLevel, ...text }: PendingPaymentListProps): react.JSX.Element | null;
504
+
505
+ type RefundListClassNames = Partial<Record<'root' | 'title' | 'list' | 'item' | 'amount' | 'status' | 'meta' | 'empty' | 'error' | 'retry', string>>;
506
+ type RefundListProps = AccountTextProps & {
507
+ refunds?: readonly Refund[] | null;
508
+ /** Show the "no refunds" text when empty (default: render nothing, the usual case). */
509
+ showEmpty?: boolean;
510
+ /** The server could not read refunds (`order.degraded`): recoverable error. */
511
+ degraded?: boolean;
512
+ onRetry?: () => void;
513
+ headingLevel?: 2 | 3 | 4;
514
+ classNames?: RefundListClassNames;
515
+ };
516
+ declare function RefundList({ refunds, showEmpty, degraded, onRetry, headingLevel, classNames: cx, ...text }: RefundListProps): react.JSX.Element | null;
517
+ type PaymentSummaryProps = AccountTextProps & {
518
+ payments?: readonly PaymentInfo[] | null;
519
+ headingLevel?: 2 | 3 | 4;
520
+ classNames?: Partial<Record<'root' | 'title' | 'list' | 'item' | 'status' | 'meta', string>>;
521
+ };
522
+ /** What the buyer paid with (card, voucher...) and its status. Renders nothing when the order has no payments. */
523
+ declare function PaymentSummary({ payments, headingLevel, classNames: cx, ...text }: PaymentSummaryProps): react.JSX.Element | null;
524
+
525
+ /**
526
+ * Data hooks of the account screens. They talk to the client of the `StorefrontProvider` (or `client`), which must carry
527
+ * the buyer's session (`withCustomerToken`); on a store that renders on the server, pass what the loader read as
528
+ * `initial` and nothing is fetched until the buyer asks (`reload`, `loadMore`) or a poll tick fires.
529
+ *
530
+ * They never throw: a failure is `status: 'error'` with the `StorefrontError` in `error`, and `reload()` is the retry.
531
+ * A 404 on one order is `status: 'not_found'` (also when it belongs to someone else: the server does not tell).
532
+ */
533
+
534
+ type AccountStatus = 'loading' | 'ready' | 'error' | 'not_found';
535
+ type UseConnectionResult<T> = {
536
+ status: Exclude<AccountStatus, 'not_found'>;
537
+ nodes: T[];
538
+ error: Error | null;
539
+ hasMore: boolean;
540
+ loadingMore: boolean;
541
+ totalCount: number | null;
542
+ /** Fetches the first page again (the retry). Keeps showing the current list meanwhile. */
543
+ reload: () => void;
544
+ /** Appends the next page. */
545
+ loadMore: () => void;
546
+ };
547
+ type UseCustomerOrdersOptions = {
548
+ client?: StorefrontClient | null;
549
+ /** Page size (default 20). */
550
+ first?: number;
551
+ /** First page already read on the server: renders at once, nothing is fetched. */
552
+ initial?: Connection<Order> | null;
553
+ };
554
+ /** The buyer's orders (summaries), newest first, with `loadMore`. */
555
+ declare function useCustomerOrders({ client, first, initial }?: UseCustomerOrdersOptions): UseConnectionResult<Order>;
556
+ type UsePendingPaymentsOptions = UseCustomerOrdersOptions & {
557
+ initial?: Connection<PendingPayment> | null;
558
+ };
559
+ /** Cash vouchers still waiting for payment. A failure of this section never blocks the orders: it is its own `status`. */
560
+ declare function usePendingPayments({ client, first, initial }?: UsePendingPaymentsOptions): UseConnectionResult<PendingPayment>;
561
+ type UseCustomerOrderOptions = {
562
+ client?: StorefrontClient | null;
563
+ /** The order already read on the server (`null` = the server found none: `not_found`). */
564
+ initial?: Order | null;
565
+ /**
566
+ * Re-reads the order every `everyMs` (default 10 s) for at most `forMs` (default 60 s) while `while(order)` is true,
567
+ * e.g. an invoice being generated: `{ while: (o) => ['queued','issuing'].includes(o.invoice?.stage ?? '') }`.
568
+ * Polling is silent: the order stays on screen and `refreshing` flips.
569
+ */
570
+ poll?: {
571
+ while: (order: Order) => boolean;
572
+ everyMs?: number;
573
+ forMs?: number;
574
+ };
575
+ };
576
+ type UseCustomerOrderResult = {
577
+ status: AccountStatus;
578
+ order: Order | null;
579
+ error: Error | null;
580
+ /** A silent re-read is in flight (retry or poll): keep showing `order`. */
581
+ refreshing: boolean;
582
+ reload: () => void;
583
+ };
584
+ /** One order with its detail (shipments, invoices, payments, refunds, `degraded`). */
585
+ declare function useCustomerOrder(id: string | null | undefined, { client, initial, poll }?: UseCustomerOrderOptions): UseCustomerOrderResult;
586
+
587
+ /**
588
+ * Pure pieces of the cash voucher (OXXO, SPEI, deposit): the normalized `VoucherView` of a `PendingPayment` and the
589
+ * Code 128 barcode (the one cashiers' readers scan). No React, no DOM: the same code draws the barcode in the page
590
+ * (`<Barcode>`) and in the printable document (`voucher-document.ts`, loaded only when the buyer prints).
591
+ */
592
+
593
+ type VoucherView = {
594
+ /** `oxxo`, `spei`, ... as the gateway publishes it. */
595
+ method: string | null;
596
+ reference: string | null;
597
+ barcode: string | null;
598
+ clabe: string | null;
599
+ expires_at: string | null;
600
+ amount: Money | null;
601
+ instructions: string | null;
602
+ };
603
+ /** The voucher of a pending payment; `null` when it has neither reference, barcode nor CLABE (nothing to pay with). */
604
+ declare function voucherOf(p: Pick<PendingPayment, 'payment' | 'total' | 'expires_at'> | null | undefined): VoucherView | null;
605
+ /** The value the barcode encodes: the gateway's `barcode`, else the reference of an OXXO voucher. */
606
+ declare function barcodeValue(v: Pick<VoucherView, 'barcode' | 'method' | 'reference'>): string | null;
607
+ /**
608
+ * Modules (`1` bar, `0` space) of the Code 128 of `value`: set C (digit pairs) when it is all digits of even length,
609
+ * set B (printable ASCII) otherwise. `null` when it cannot be encoded.
610
+ */
611
+ declare function code128Modules(value: string): string | null;
612
+ type BarcodeGeometry = {
613
+ width: number;
614
+ height: number;
615
+ rects: {
616
+ x: number;
617
+ w: number;
618
+ }[];
619
+ };
620
+ /** Bars of the barcode as rectangles (quiet zone of 10 modules each side included in `width`). `null` if not encodable. */
621
+ declare function barcodeGeometry(value: string, opts?: {
622
+ module?: number;
623
+ height?: number;
624
+ }): BarcodeGeometry | null;
625
+
626
+ export { AccountAuth, type AccountAuthClassNames, type AccountAuthMessages, type AccountAuthProps, type AccountAuthView, type AccountFormProps, type AccountMessageKey, type AccountMessages, type AccountStatus, type AccountTextProps, AuthActionData, AuthErrorCode, AuthStep, Barcode, type BarcodeGeometry, type BarcodeProps, InvoiceList, type InvoiceListClassNames, type InvoiceListProps, NextActionBar, type NextActionBarClassNames, type NextActionBarProps, OrderCard, type OrderCardClassNames, type OrderCardProps, OrderLines, type OrderLinesClassNames, type OrderLinesProps, OrderList, type OrderListClassNames, type OrderListProps, OrderProductsStack, OrderProgress, type OrderProgressClassNames, type OrderProgressProps, OrderStatusBadge, type OrderStatusBadgeProps, type OrderTone, PaymentSummary, type PaymentSummaryProps, PendingPaymentCard, type PendingPaymentCardClassNames, type PendingPaymentCardProps, PendingPaymentList, type PendingPaymentListProps, PostPurchaseAccountPrompt, type PostPurchaseAccountPromptClassNames, type PostPurchaseAccountPromptMessages, type PostPurchaseAccountPromptProps, RefundList, type RefundListClassNames, type RefundListProps, ShipmentCard, type ShipmentCardClassNames, type ShipmentCardProps, type ShipmentMapSlotProps, type UseConnectionResult, type UseCustomerOrderOptions, type UseCustomerOrderResult, type UseCustomerOrdersOptions, type UsePendingPaymentsOptions, type VoucherView, accountAuthMessages, accountMessages, barcodeGeometry, barcodeValue, code128Modules, enumText, lineImage, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments, voucherOf };