@asteby/storefront-react 0.20.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.
- package/dist/account.cjs +272 -2
- package/dist/account.cjs.map +1 -1
- package/dist/account.css +159 -0
- package/dist/account.d.cts +35 -3
- package/dist/account.d.ts +35 -3
- package/dist/account.js +70 -1
- package/dist/account.js.map +1 -1
- package/dist/cart.cjs +125 -2
- package/dist/cart.cjs.map +1 -1
- package/dist/cart.css +145 -2
- package/dist/cart.js +4 -2
- package/dist/cart.js.map +1 -1
- package/dist/checkout.cjs +129 -1
- package/dist/checkout.cjs.map +1 -1
- package/dist/checkout.css +142 -0
- package/dist/checkout.d.cts +3 -1
- package/dist/checkout.d.ts +3 -1
- package/dist/checkout.js +8 -1
- package/dist/checkout.js.map +1 -1
- package/dist/chunk-VHEY5AU3.js +152 -0
- package/dist/chunk-VHEY5AU3.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/product-preview-DRtLWGLS.d.cts +85 -0
- package/dist/product-preview-DaICr4f2.d.ts +85 -0
- package/dist/ui.cjs +202 -0
- package/dist/ui.cjs.map +1 -1
- package/dist/ui.css +142 -0
- package/dist/ui.d.cts +3 -0
- package/dist/ui.d.ts +3 -0
- package/dist/ui.js +3 -1
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
package/dist/account.css
CHANGED
|
@@ -241,3 +241,162 @@
|
|
|
241
241
|
animation: none;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
+
|
|
245
|
+
/* products of an order card (`OrderProductsStack`); the line list is `OrderLines` (`ProductPreview` rows) */
|
|
246
|
+
[data-sf-order-products] {
|
|
247
|
+
margin-block: 0.5rem 0.25rem;
|
|
248
|
+
}
|
|
249
|
+
[data-sf-order-lines-list] {
|
|
250
|
+
display: grid;
|
|
251
|
+
margin: 0;
|
|
252
|
+
padding: 0;
|
|
253
|
+
list-style: none;
|
|
254
|
+
}
|
|
255
|
+
[data-sf-order-line] {
|
|
256
|
+
padding-block: 0.75rem;
|
|
257
|
+
}
|
|
258
|
+
[data-sf-order-line] + [data-sf-order-line] {
|
|
259
|
+
border-top: 1px solid var(--sf-account-line, color-mix(in srgb, currentColor 14%, transparent));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/*
|
|
263
|
+
* <ProductThumb>, <ProductPreview>, <ProductThumbStack>: la foto del producto y la línea de producto de la tienda.
|
|
264
|
+
* CSS plano sobre los tokens de la tienda (--foreground, --background, --border, --muted-foreground, --radius); en tema
|
|
265
|
+
* oscuro la superficie y el brillo salen de color-mix, sin colores escritos aquí. Va incluido en cart.css, checkout.css,
|
|
266
|
+
* account.css y ui.css (misma regla, un solo origen: src/ui/product-preview.css).
|
|
267
|
+
*/
|
|
268
|
+
[data-sf-thumb] {
|
|
269
|
+
--_surface: color-mix(in srgb, var(--foreground, #111) 5%, var(--background, #fff));
|
|
270
|
+
position: relative;
|
|
271
|
+
display: inline-block;
|
|
272
|
+
flex: none;
|
|
273
|
+
box-sizing: border-box;
|
|
274
|
+
width: var(--sf-preview-size, 3.5rem);
|
|
275
|
+
aspect-ratio: var(--sf-preview-ratio, 1 / 1);
|
|
276
|
+
overflow: hidden;
|
|
277
|
+
border-radius: calc(var(--radius, 0.5rem) * 1.25);
|
|
278
|
+
background: var(--_surface);
|
|
279
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground, #111) 9%, transparent);
|
|
280
|
+
vertical-align: middle;
|
|
281
|
+
}
|
|
282
|
+
:root[data-theme="dark"] [data-sf-thumb] { --_surface: color-mix(in srgb, var(--foreground, #fff) 9%, var(--background, #111)); }
|
|
283
|
+
[data-sf-thumb] > img {
|
|
284
|
+
display: block;
|
|
285
|
+
width: 100%;
|
|
286
|
+
height: 100%;
|
|
287
|
+
box-sizing: border-box;
|
|
288
|
+
object-fit: contain;
|
|
289
|
+
padding: 6%;
|
|
290
|
+
transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1), opacity 180ms;
|
|
291
|
+
}
|
|
292
|
+
[data-sf-thumb][data-fit="cover"] > img { object-fit: cover; padding: 0; }
|
|
293
|
+
/* Fotos sobre fondo blanco: se funden con la superficie en tema claro (no hay caja blanca dentro del marco). */
|
|
294
|
+
[data-sf-thumb][data-fit="contain"] > img { mix-blend-mode: multiply; }
|
|
295
|
+
:root[data-theme="dark"] [data-sf-thumb] > img { mix-blend-mode: normal; }
|
|
296
|
+
[data-sf-thumb][data-state="loading"]::before {
|
|
297
|
+
content: "";
|
|
298
|
+
position: absolute;
|
|
299
|
+
inset: 0;
|
|
300
|
+
background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--foreground, #111) 8%, transparent) 50%, transparent 80%);
|
|
301
|
+
background-size: 200% 100%;
|
|
302
|
+
animation: sf-thumb-shimmer 1.4s linear infinite;
|
|
303
|
+
pointer-events: none;
|
|
304
|
+
}
|
|
305
|
+
@keyframes sf-thumb-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
|
|
306
|
+
[data-sf-thumb][data-zoom]:hover > img { transform: scale(1.07); }
|
|
307
|
+
@media (prefers-reduced-motion: reduce) {
|
|
308
|
+
[data-sf-thumb][data-state="loading"]::before { animation: none; }
|
|
309
|
+
[data-sf-thumb] > img { transition: none; }
|
|
310
|
+
[data-sf-thumb][data-zoom]:hover > img { transform: none; }
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
[data-sf-thumb-fallback] {
|
|
314
|
+
position: absolute;
|
|
315
|
+
inset: 0;
|
|
316
|
+
display: grid;
|
|
317
|
+
place-items: center;
|
|
318
|
+
color: color-mix(in srgb, var(--foreground, #111) 42%, transparent);
|
|
319
|
+
background: linear-gradient(145deg, color-mix(in srgb, var(--foreground, #111) 3%, transparent), color-mix(in srgb, var(--foreground, #111) 9%, transparent));
|
|
320
|
+
}
|
|
321
|
+
[data-sf-thumb-initial] {
|
|
322
|
+
font-size: calc(var(--sf-preview-size, 3.5rem) * 0.36);
|
|
323
|
+
font-weight: 600;
|
|
324
|
+
letter-spacing: 0.02em;
|
|
325
|
+
line-height: 1;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
[data-sf-thumb-qty] {
|
|
329
|
+
position: absolute;
|
|
330
|
+
top: 0.2rem;
|
|
331
|
+
right: 0.2rem;
|
|
332
|
+
min-width: 1.25rem;
|
|
333
|
+
height: 1.25rem;
|
|
334
|
+
padding: 0 0.3rem;
|
|
335
|
+
box-sizing: border-box;
|
|
336
|
+
display: inline-grid;
|
|
337
|
+
place-items: center;
|
|
338
|
+
border-radius: 999px;
|
|
339
|
+
font-size: 0.7rem;
|
|
340
|
+
font-weight: 700;
|
|
341
|
+
font-variant-numeric: tabular-nums;
|
|
342
|
+
background: var(--sf-summary-qty-bg, color-mix(in srgb, var(--foreground, #111) 78%, transparent));
|
|
343
|
+
color: var(--sf-summary-qty-fg, var(--background, #fff));
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/* Línea de producto: foto | texto | importe. */
|
|
347
|
+
[data-sf-preview] {
|
|
348
|
+
display: flex;
|
|
349
|
+
align-items: center;
|
|
350
|
+
gap: 0.875rem;
|
|
351
|
+
min-width: 0;
|
|
352
|
+
}
|
|
353
|
+
[data-sf-preview][data-missing] [data-sf-preview-name] { font-style: italic; color: var(--muted-foreground, color-mix(in srgb, currentColor 60%, transparent)); }
|
|
354
|
+
[data-sf-preview-media] { flex: none; display: inline-flex; }
|
|
355
|
+
[data-sf-preview-body] { display: grid; flex: 1 1 auto; gap: 0.125rem; min-width: 0; }
|
|
356
|
+
[data-sf-preview-name] {
|
|
357
|
+
display: -webkit-box;
|
|
358
|
+
-webkit-line-clamp: 2;
|
|
359
|
+
-webkit-box-orient: vertical;
|
|
360
|
+
overflow: hidden;
|
|
361
|
+
overflow-wrap: anywhere;
|
|
362
|
+
font-size: 0.9375rem;
|
|
363
|
+
font-weight: 600;
|
|
364
|
+
line-height: 1.3;
|
|
365
|
+
}
|
|
366
|
+
[data-sf-preview-name] a { color: inherit; text-decoration: none; }
|
|
367
|
+
[data-sf-preview-name] a:hover { text-decoration: underline; }
|
|
368
|
+
[data-sf-preview-variant],
|
|
369
|
+
[data-sf-preview-sku],
|
|
370
|
+
[data-sf-preview-meta] {
|
|
371
|
+
font-size: 0.8125rem;
|
|
372
|
+
line-height: 1.35;
|
|
373
|
+
color: var(--muted-foreground, color-mix(in srgb, currentColor 66%, transparent));
|
|
374
|
+
}
|
|
375
|
+
[data-sf-preview-sku] { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
|
|
376
|
+
[data-sf-preview-total] {
|
|
377
|
+
flex: none;
|
|
378
|
+
align-self: flex-start;
|
|
379
|
+
font-size: 0.9375rem;
|
|
380
|
+
font-weight: 700;
|
|
381
|
+
font-variant-numeric: tabular-nums;
|
|
382
|
+
text-align: right;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/* Fotos apiladas (tarjeta de pedido). */
|
|
386
|
+
[data-sf-thumb-stack] { display: inline-flex; align-items: center; }
|
|
387
|
+
[data-sf-thumb-stack] > * { box-shadow: 0 0 0 2px var(--card, var(--background, #fff)), inset 0 0 0 1px color-mix(in srgb, var(--foreground, #111) 9%, transparent); }
|
|
388
|
+
[data-sf-thumb-stack] > * + * { margin-inline-start: -0.625rem; }
|
|
389
|
+
[data-sf-thumb-more] {
|
|
390
|
+
display: inline-grid;
|
|
391
|
+
place-items: center;
|
|
392
|
+
flex: none;
|
|
393
|
+
box-sizing: border-box;
|
|
394
|
+
width: var(--sf-preview-size, 2.75rem);
|
|
395
|
+
aspect-ratio: 1 / 1;
|
|
396
|
+
border-radius: calc(var(--radius, 0.5rem) * 1.25);
|
|
397
|
+
font-size: 0.8125rem;
|
|
398
|
+
font-weight: 600;
|
|
399
|
+
font-variant-numeric: tabular-nums;
|
|
400
|
+
color: var(--muted-foreground, color-mix(in srgb, currentColor 66%, transparent));
|
|
401
|
+
background: color-mix(in srgb, var(--foreground, #111) 7%, var(--background, #fff));
|
|
402
|
+
}
|
package/dist/account.d.cts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode, MouseEvent } from 'react';
|
|
3
|
-
import { CustomerCapabilities, Order, NextAction, OrderProgress as OrderProgress$1, Shipment, ShipmentMap, InvoiceDoc, InvoiceSummary, InvoiceFileKind, PendingPayment, PaymentInfo, Refund, StorefrontClient, Connection, Money } from '@asteby/storefront';
|
|
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 = {
|
|
@@ -141,6 +144,11 @@ declare const ES: {
|
|
|
141
144
|
readonly 'order.view': "Ver pedido";
|
|
142
145
|
readonly 'order.items.one': "{count} artículo";
|
|
143
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";
|
|
144
152
|
readonly 'order.stepOf': "Paso {n} de {total}: {step}";
|
|
145
153
|
readonly 'order.listLabel': "Tus pedidos";
|
|
146
154
|
readonly 'order.loading': "Cargando tus pedidos";
|
|
@@ -357,7 +365,7 @@ type NextActionBarProps = AccountTextProps & {
|
|
|
357
365
|
*/
|
|
358
366
|
declare function NextActionBar({ order, action, hrefFor, onAction, secondary, classNames: cx, ...text }: NextActionBarProps): react.JSX.Element | null;
|
|
359
367
|
|
|
360
|
-
type OrderCardClassNames = Partial<Record<'root' | 'header' | 'number' | 'link' | 'meta' | 'badge' | 'summary' | 'shipment' | 'footer' | 'total' | 'actions', string>> & {
|
|
368
|
+
type OrderCardClassNames = Partial<Record<'root' | 'header' | 'products' | 'number' | 'link' | 'meta' | 'badge' | 'summary' | 'shipment' | 'footer' | 'total' | 'actions', string>> & {
|
|
361
369
|
progress?: OrderProgressClassNames;
|
|
362
370
|
action?: NextActionBarClassNames;
|
|
363
371
|
};
|
|
@@ -393,6 +401,30 @@ type OrderListProps = AccountTextProps & Pick<OrderCardProps, 'orderHref' | 'act
|
|
|
393
401
|
};
|
|
394
402
|
declare function OrderList({ orders, status, skeletons, onRetry, hasMore, loadingMore, onLoadMore, emptyAction, guestHint, orderHref, actionHref, onAction, headingLevel, classNames: cx, ...text }: OrderListProps): react.JSX.Element;
|
|
395
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
|
+
|
|
396
428
|
type ShipmentCardClassNames = Partial<Record<'root' | 'header' | 'carrier' | 'status' | 'meta' | 'number' | 'actions' | 'link' | 'copy' | 'events' | 'event' | 'toggle' | 'empty' | 'test' | 'map', string>>;
|
|
397
429
|
/** What `renderMap` receives. */
|
|
398
430
|
type ShipmentMapSlotProps = {
|
|
@@ -591,4 +623,4 @@ declare function barcodeGeometry(value: string, opts?: {
|
|
|
591
623
|
height?: number;
|
|
592
624
|
}): BarcodeGeometry | null;
|
|
593
625
|
|
|
594
|
-
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, OrderList, type OrderListClassNames, type OrderListProps, 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, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments, voucherOf };
|
|
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 };
|
package/dist/account.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode, MouseEvent } from 'react';
|
|
3
|
-
import { CustomerCapabilities, Order, NextAction, OrderProgress as OrderProgress$1, Shipment, ShipmentMap, InvoiceDoc, InvoiceSummary, InvoiceFileKind, PendingPayment, PaymentInfo, Refund, StorefrontClient, Connection, Money } from '@asteby/storefront';
|
|
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.js';
|
|
5
5
|
import { A as AuthActionData, c as AuthStep, a as AuthErrorCode } from './types-D7pVK0GK.js';
|
|
6
6
|
export { b as AuthIntent } from './types-D7pVK0GK.js';
|
|
7
|
+
import { a as ProductPreviewClassNames, e as ProductThumbImage } from './product-preview-DaICr4f2.js';
|
|
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-DaICr4f2.js';
|
|
9
|
+
import './components-B5XhSH-m.js';
|
|
7
10
|
|
|
8
11
|
type AccountAuthView = 'login' | 'register' | 'otp-email' | 'forgot' | AuthStep;
|
|
9
12
|
type AccountAuthMessages = {
|
|
@@ -141,6 +144,11 @@ declare const ES: {
|
|
|
141
144
|
readonly 'order.view': "Ver pedido";
|
|
142
145
|
readonly 'order.items.one': "{count} artículo";
|
|
143
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";
|
|
144
152
|
readonly 'order.stepOf': "Paso {n} de {total}: {step}";
|
|
145
153
|
readonly 'order.listLabel': "Tus pedidos";
|
|
146
154
|
readonly 'order.loading': "Cargando tus pedidos";
|
|
@@ -357,7 +365,7 @@ type NextActionBarProps = AccountTextProps & {
|
|
|
357
365
|
*/
|
|
358
366
|
declare function NextActionBar({ order, action, hrefFor, onAction, secondary, classNames: cx, ...text }: NextActionBarProps): react.JSX.Element | null;
|
|
359
367
|
|
|
360
|
-
type OrderCardClassNames = Partial<Record<'root' | 'header' | 'number' | 'link' | 'meta' | 'badge' | 'summary' | 'shipment' | 'footer' | 'total' | 'actions', string>> & {
|
|
368
|
+
type OrderCardClassNames = Partial<Record<'root' | 'header' | 'products' | 'number' | 'link' | 'meta' | 'badge' | 'summary' | 'shipment' | 'footer' | 'total' | 'actions', string>> & {
|
|
361
369
|
progress?: OrderProgressClassNames;
|
|
362
370
|
action?: NextActionBarClassNames;
|
|
363
371
|
};
|
|
@@ -393,6 +401,30 @@ type OrderListProps = AccountTextProps & Pick<OrderCardProps, 'orderHref' | 'act
|
|
|
393
401
|
};
|
|
394
402
|
declare function OrderList({ orders, status, skeletons, onRetry, hasMore, loadingMore, onLoadMore, emptyAction, guestHint, orderHref, actionHref, onAction, headingLevel, classNames: cx, ...text }: OrderListProps): react.JSX.Element;
|
|
395
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
|
+
|
|
396
428
|
type ShipmentCardClassNames = Partial<Record<'root' | 'header' | 'carrier' | 'status' | 'meta' | 'number' | 'actions' | 'link' | 'copy' | 'events' | 'event' | 'toggle' | 'empty' | 'test' | 'map', string>>;
|
|
397
429
|
/** What `renderMap` receives. */
|
|
398
430
|
type ShipmentMapSlotProps = {
|
|
@@ -591,4 +623,4 @@ declare function barcodeGeometry(value: string, opts?: {
|
|
|
591
623
|
height?: number;
|
|
592
624
|
}): BarcodeGeometry | null;
|
|
593
625
|
|
|
594
|
-
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, OrderList, type OrderListClassNames, type OrderListProps, 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, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments, voucherOf };
|
|
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 };
|
package/dist/account.js
CHANGED
|
@@ -2,6 +2,9 @@ import { fill } from './chunk-PPQEUTXJ.js';
|
|
|
2
2
|
import { barcodeGeometry, voucherOf, barcodeValue } from './chunk-TXEYBDFG.js';
|
|
3
3
|
export { barcodeGeometry, barcodeValue, code128Modules, voucherOf } from './chunk-TXEYBDFG.js';
|
|
4
4
|
import { useFieldErrors, CheckoutField, ErrorSummary } from './chunk-DFGLCIEG.js';
|
|
5
|
+
import { ProductPreview, ProductThumbStack } from './chunk-VHEY5AU3.js';
|
|
6
|
+
export { ProductPreview, ProductThumb, ProductThumbStack, productInitials } from './chunk-VHEY5AU3.js';
|
|
7
|
+
import './chunk-6CVKW7F3.js';
|
|
5
8
|
import { useResolvedLocale } from './chunk-T52H5HL3.js';
|
|
6
9
|
import { useOptionalStorefront } from './chunk-DQBL2DFJ.js';
|
|
7
10
|
import { useState, useRef, useEffect, useId, useMemo, useCallback } from 'react';
|
|
@@ -335,6 +338,11 @@ var ES3 = {
|
|
|
335
338
|
"order.view": "Ver pedido",
|
|
336
339
|
"order.items.one": "{count} art\xEDculo",
|
|
337
340
|
"order.items.other": "{count} art\xEDculos",
|
|
341
|
+
"order.lines": "Art\xEDculos del pedido",
|
|
342
|
+
"order.line.quantity": "Cantidad {n}",
|
|
343
|
+
"order.line.each": "{price} c/u",
|
|
344
|
+
"order.line.unavailable": "Producto no disponible",
|
|
345
|
+
"order.productsMore": "y {n} m\xE1s",
|
|
338
346
|
"order.stepOf": "Paso {n} de {total}: {step}",
|
|
339
347
|
"order.listLabel": "Tus pedidos",
|
|
340
348
|
"order.loading": "Cargando tus pedidos",
|
|
@@ -497,6 +505,11 @@ var EN3 = {
|
|
|
497
505
|
"order.view": "View order",
|
|
498
506
|
"order.items.one": "{count} item",
|
|
499
507
|
"order.items.other": "{count} items",
|
|
508
|
+
"order.lines": "Items in this order",
|
|
509
|
+
"order.line.quantity": "Quantity {n}",
|
|
510
|
+
"order.line.each": "{price} each",
|
|
511
|
+
"order.line.unavailable": "Product unavailable",
|
|
512
|
+
"order.productsMore": "and {n} more",
|
|
500
513
|
"order.stepOf": "Step {n} of {total}: {step}",
|
|
501
514
|
"order.listLabel": "Your orders",
|
|
502
515
|
"order.loading": "Loading your orders",
|
|
@@ -724,6 +737,61 @@ function CopyButton({ value, label, copiedLabel, failedLabel, className, ariaLab
|
|
|
724
737
|
/* @__PURE__ */ jsx("span", { role: "status", "aria-live": "polite", "data-sf-copy-status": true, style: state === "failed" ? void 0 : SR_ONLY, children: state === "copied" ? copiedLabel : state === "failed" ? failedLabel : "" })
|
|
725
738
|
] });
|
|
726
739
|
}
|
|
740
|
+
function lineImage(line) {
|
|
741
|
+
const img = line?.image;
|
|
742
|
+
if (!img || typeof img !== "object") return null;
|
|
743
|
+
const url = str(img.url);
|
|
744
|
+
if (!url) return null;
|
|
745
|
+
const alt = str(img.alt);
|
|
746
|
+
const w = Number(img.width);
|
|
747
|
+
const h = Number(img.height);
|
|
748
|
+
return { url, alt, ...Number.isFinite(w) && w > 0 ? { width: w } : {}, ...Number.isFinite(h) && h > 0 ? { height: h } : {} };
|
|
749
|
+
}
|
|
750
|
+
function validLines(order) {
|
|
751
|
+
return (Array.isArray(order.lines) ? order.lines : []).filter((l) => !!l && typeof l === "object");
|
|
752
|
+
}
|
|
753
|
+
function OrderLines({ order, lineHref, size = 64, label, classNames: cx = {}, ...text }) {
|
|
754
|
+
const { m, locale } = useAccountText(text);
|
|
755
|
+
const lines = validLines(order);
|
|
756
|
+
if (lines.length === 0) return null;
|
|
757
|
+
return /* @__PURE__ */ jsx("div", { className: cx.root, "data-sf-order-lines": "", children: /* @__PURE__ */ jsx("ul", { className: cx.list, "aria-label": label ?? m["order.lines"], "data-sf-order-lines-list": "", children: lines.map((l, i) => {
|
|
758
|
+
const qty = Number.isFinite(l.quantity) && l.quantity > 0 ? l.quantity : 1;
|
|
759
|
+
const unit = moneyText(l.unit, locale);
|
|
760
|
+
const variant = str(l.variant_title);
|
|
761
|
+
return /* @__PURE__ */ jsx("li", { className: cx.item, "data-sf-order-line": "", children: /* @__PURE__ */ jsx(
|
|
762
|
+
ProductPreview,
|
|
763
|
+
{
|
|
764
|
+
image: lineImage(l),
|
|
765
|
+
name: str(l.title) ?? "",
|
|
766
|
+
variant: variant && !/^default( title)?$/i.test(variant) ? variant : null,
|
|
767
|
+
sku: str(l.sku),
|
|
768
|
+
quantity: qty,
|
|
769
|
+
quantityLabel: m["order.line.quantity"],
|
|
770
|
+
unavailableLabel: m["order.line.unavailable"],
|
|
771
|
+
unitPrice: unit ? fill(m["order.line.each"], { price: unit }) : null,
|
|
772
|
+
total: moneyText(l.total, locale),
|
|
773
|
+
href: lineHref?.(l) ?? null,
|
|
774
|
+
size,
|
|
775
|
+
...cx.preview ? { classNames: cx.preview } : {}
|
|
776
|
+
}
|
|
777
|
+
) }, `${str(l.sku) ?? ""}-${i}`);
|
|
778
|
+
}) }) });
|
|
779
|
+
}
|
|
780
|
+
function OrderProductsStack({ order, size = 44, max = 4, className, ...text }) {
|
|
781
|
+
const { m } = useAccountText(text);
|
|
782
|
+
const lines = validLines(order);
|
|
783
|
+
if (lines.length === 0) return null;
|
|
784
|
+
return /* @__PURE__ */ jsx(
|
|
785
|
+
ProductThumbStack,
|
|
786
|
+
{
|
|
787
|
+
items: lines.map((l) => ({ image: lineImage(l), name: str(l.title) })),
|
|
788
|
+
size,
|
|
789
|
+
max,
|
|
790
|
+
moreLabel: m["order.productsMore"],
|
|
791
|
+
...className ? { className } : {}
|
|
792
|
+
}
|
|
793
|
+
);
|
|
794
|
+
}
|
|
727
795
|
var STEP_STATES = /* @__PURE__ */ new Set(["done", "current", "pending", "problem"]);
|
|
728
796
|
var stepState = (s) => typeof s === "string" && STEP_STATES.has(s) ? s : "pending";
|
|
729
797
|
var GLYPH = { done: "\u2713", current: "\u25CF", pending: "\u25CB", problem: "!" };
|
|
@@ -823,6 +891,7 @@ function OrderCard({ order, orderHref, actionHref, onAction, headingLevel = 3, c
|
|
|
823
891
|
plural(m, "order.items", items)
|
|
824
892
|
] }) : null
|
|
825
893
|
] }),
|
|
894
|
+
Array.isArray(order.lines) && order.lines.length > 0 ? /* @__PURE__ */ jsx("div", { className: cx.products, "data-sf-order-products": true, children: /* @__PURE__ */ jsx(OrderProductsStack, { order, ...text }) }) : null,
|
|
826
895
|
/* @__PURE__ */ jsxs("div", { className: cx.summary, "data-sf-order-summary": true, children: [
|
|
827
896
|
/* @__PURE__ */ jsx(OrderProgress, { progress, variant: "compact", ...text, ...cx.progress ? { classNames: cx.progress } : {} }),
|
|
828
897
|
showShipment ? /* @__PURE__ */ jsxs("p", { className: cx.shipment, "data-sf-order-shipment": true, children: [
|
|
@@ -1351,6 +1420,6 @@ function useCustomerOrder(id, { client, initial, poll } = {}) {
|
|
|
1351
1420
|
return { status: mine ? state.status : "loading", order, error: mine ? state.error : null, refreshing: mine && refreshing, reload };
|
|
1352
1421
|
}
|
|
1353
1422
|
|
|
1354
|
-
export { AccountAuth, Barcode, InvoiceList, NextActionBar, OrderCard, OrderList, OrderProgress, OrderStatusBadge, PaymentSummary, PendingPaymentCard, PendingPaymentList, PostPurchaseAccountPrompt, RefundList, ShipmentCard, accountAuthMessages, accountMessages, enumText, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments };
|
|
1423
|
+
export { AccountAuth, Barcode, InvoiceList, NextActionBar, OrderCard, OrderLines, OrderList, OrderProductsStack, OrderProgress, OrderStatusBadge, PaymentSummary, PendingPaymentCard, PendingPaymentList, PostPurchaseAccountPrompt, RefundList, ShipmentCard, accountAuthMessages, accountMessages, enumText, lineImage, postPurchaseAccountPromptMessages, stageTone, useCustomerOrder, useCustomerOrders, usePendingPayments };
|
|
1355
1424
|
//# sourceMappingURL=account.js.map
|
|
1356
1425
|
//# sourceMappingURL=account.js.map
|