@nok-integration/storefront-react 0.25.0 → 0.27.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/index.d.ts CHANGED
@@ -319,6 +319,151 @@ declare function CartSheetProvider({ children }: {
319
319
  export { CartSheetProvider as CartSheet }
320
320
  export { CartSheetProvider }
321
321
 
322
+ /**
323
+ * Cart totals: the standard pricing breakdown, plus what came off.
324
+ *
325
+ * `discount` is **additive** — `Pricing` itself is untouched, because it is shared with
326
+ * surfaces that have no concept of one and must not grow a field they cannot populate.
327
+ */
328
+ declare const CartTotals: z.ZodObject<{
329
+ subtotal: z.ZodObject<{
330
+ amount: z.ZodNumber;
331
+ currency: z.ZodString;
332
+ }, "strict", z.ZodTypeAny, {
333
+ amount: number;
334
+ currency: string;
335
+ }, {
336
+ amount: number;
337
+ currency: string;
338
+ }>;
339
+ shipping: z.ZodObject<{
340
+ amount: z.ZodNumber;
341
+ currency: z.ZodString;
342
+ }, "strict", z.ZodTypeAny, {
343
+ amount: number;
344
+ currency: string;
345
+ }, {
346
+ amount: number;
347
+ currency: string;
348
+ }>;
349
+ tax: z.ZodObject<{
350
+ amount: z.ZodNumber;
351
+ currency: z.ZodString;
352
+ }, "strict", z.ZodTypeAny, {
353
+ amount: number;
354
+ currency: string;
355
+ }, {
356
+ amount: number;
357
+ currency: string;
358
+ }>;
359
+ total: z.ZodObject<{
360
+ amount: z.ZodNumber;
361
+ currency: z.ZodString;
362
+ }, "strict", z.ZodTypeAny, {
363
+ amount: number;
364
+ currency: string;
365
+ }, {
366
+ amount: number;
367
+ currency: string;
368
+ }>;
369
+ } & {
370
+ /**
371
+ * What came off across the whole basket, as a **positive** amount. Absent means nothing
372
+ * did; a zero is never sent.
373
+ *
374
+ * Positive rather than signed, and the surface that draws it owns the minus sign —
375
+ * exactly as `OrderTotals.discount` does. A signed field invites a reader to add it to a
376
+ * running total, and nothing here is a running total: every figure is server-computed
377
+ * and `total` is never derived by a consumer from the parts.
378
+ *
379
+ * Kept out of `subtotal` deliberately. The design lists a subtotal and a discount as two
380
+ * rows because the fan is owed both figures, and folding the saving into the subtotal
381
+ * loses the one they came for.
382
+ */
383
+ discount: z.ZodOptional<z.ZodObject<{
384
+ amount: z.ZodNumber;
385
+ currency: z.ZodString;
386
+ }, "strict", z.ZodTypeAny, {
387
+ amount: number;
388
+ currency: string;
389
+ }, {
390
+ amount: number;
391
+ currency: string;
392
+ }>>;
393
+ /**
394
+ * The lines at their undiscounted prices: each line's `compare_at_unit_price` where it
395
+ * has one, otherwise its `unit_price`, times its quantity. Present exactly when
396
+ * `discount` is, and absent means it equals `subtotal`.
397
+ *
398
+ * This is the figure the summary's Subtotal row draws above the Discount row, so the
399
+ * rows read top to bottom: `subtotal_before_discount` − `discount` = `subtotal`, and
400
+ * `total` is `subtotal` plus shipping and tax. `subtotal` itself keeps its meaning — what
401
+ * the lines cost now — because the hand-off and analytics read it as the basket's value.
402
+ */
403
+ subtotal_before_discount: z.ZodOptional<z.ZodObject<{
404
+ amount: z.ZodNumber;
405
+ currency: z.ZodString;
406
+ }, "strict", z.ZodTypeAny, {
407
+ amount: number;
408
+ currency: string;
409
+ }, {
410
+ amount: number;
411
+ currency: string;
412
+ }>>;
413
+ }, "strip", z.ZodTypeAny, {
414
+ subtotal: {
415
+ amount: number;
416
+ currency: string;
417
+ };
418
+ shipping: {
419
+ amount: number;
420
+ currency: string;
421
+ };
422
+ tax: {
423
+ amount: number;
424
+ currency: string;
425
+ };
426
+ total: {
427
+ amount: number;
428
+ currency: string;
429
+ };
430
+ discount?: {
431
+ amount: number;
432
+ currency: string;
433
+ } | undefined;
434
+ subtotal_before_discount?: {
435
+ amount: number;
436
+ currency: string;
437
+ } | undefined;
438
+ }, {
439
+ subtotal: {
440
+ amount: number;
441
+ currency: string;
442
+ };
443
+ shipping: {
444
+ amount: number;
445
+ currency: string;
446
+ };
447
+ tax: {
448
+ amount: number;
449
+ currency: string;
450
+ };
451
+ total: {
452
+ amount: number;
453
+ currency: string;
454
+ };
455
+ discount?: {
456
+ amount: number;
457
+ currency: string;
458
+ } | undefined;
459
+ subtotal_before_discount?: {
460
+ amount: number;
461
+ currency: string;
462
+ } | undefined;
463
+ }>;
464
+
465
+ declare type CartTotals = z.infer<typeof CartTotals>;
466
+
322
467
  /**
323
468
  * Opens the cart as a bottom sheet.
324
469
  *
@@ -2623,6 +2768,7 @@ declare function createClient(options: ClientOptions): {
2623
2768
  desktop_image?: string | undefined;
2624
2769
  target?: string | undefined;
2625
2770
  video?: string | undefined;
2771
+ desktop_video?: string | undefined;
2626
2772
  focal_y?: number | undefined;
2627
2773
  }[];
2628
2774
  }>;
@@ -2710,6 +2856,10 @@ declare function createClient(options: ClientOptions): {
2710
2856
  amount: number;
2711
2857
  currency: string;
2712
2858
  } | undefined;
2859
+ subtotal_before_discount?: {
2860
+ amount: number;
2861
+ currency: string;
2862
+ } | undefined;
2713
2863
  };
2714
2864
  locked?: {
2715
2865
  reason: "checkout_handoff";
@@ -2769,6 +2919,10 @@ declare function createClient(options: ClientOptions): {
2769
2919
  amount: number;
2770
2920
  currency: string;
2771
2921
  } | undefined;
2922
+ subtotal_before_discount?: {
2923
+ amount: number;
2924
+ currency: string;
2925
+ } | undefined;
2772
2926
  };
2773
2927
  locked?: {
2774
2928
  reason: "checkout_handoff";
@@ -2828,6 +2982,10 @@ declare function createClient(options: ClientOptions): {
2828
2982
  amount: number;
2829
2983
  currency: string;
2830
2984
  } | undefined;
2985
+ subtotal_before_discount?: {
2986
+ amount: number;
2987
+ currency: string;
2988
+ } | undefined;
2831
2989
  };
2832
2990
  locked?: {
2833
2991
  reason: "checkout_handoff";
@@ -2887,6 +3045,10 @@ declare function createClient(options: ClientOptions): {
2887
3045
  amount: number;
2888
3046
  currency: string;
2889
3047
  } | undefined;
3048
+ subtotal_before_discount?: {
3049
+ amount: number;
3050
+ currency: string;
3051
+ } | undefined;
2890
3052
  };
2891
3053
  locked?: {
2892
3054
  reason: "checkout_handoff";
@@ -2946,6 +3108,10 @@ declare function createClient(options: ClientOptions): {
2946
3108
  amount: number;
2947
3109
  currency: string;
2948
3110
  } | undefined;
3111
+ subtotal_before_discount?: {
3112
+ amount: number;
3113
+ currency: string;
3114
+ } | undefined;
2949
3115
  };
2950
3116
  locked?: {
2951
3117
  reason: "checkout_handoff";
@@ -3368,6 +3534,10 @@ declare function createClient(options: ClientOptions): {
3368
3534
  amount: number;
3369
3535
  currency: string;
3370
3536
  } | undefined;
3537
+ subtotal_before_discount?: {
3538
+ amount: number;
3539
+ currency: string;
3540
+ } | undefined;
3371
3541
  };
3372
3542
  locked?: {
3373
3543
  reason: "checkout_handoff";
@@ -4551,7 +4721,12 @@ export declare interface OrderStatusBadgeProps {
4551
4721
  export declare function OrderSummary({ pricing, deferred, hidden, rows, discount, collapsible, }: OrderSummaryProps): JSX.Element;
4552
4722
 
4553
4723
  export declare interface OrderSummaryProps {
4554
- pricing: Pricing;
4724
+ /**
4725
+ * The figures to draw. A cart's `totals` also carries `subtotal_before_discount`, which
4726
+ * the Subtotal row shows whenever the Discount row is drawn, so the rows read
4727
+ * Subtotal − Discount = Total exactly as the engine sent them.
4728
+ */
4729
+ pricing: Pricing & Partial<Pick<CartTotals, 'subtotal_before_discount'>>;
4555
4730
  /**
4556
4731
  * Row order and wording, where a surface's design differs from the cart's.
4557
4732
  *
@@ -5211,7 +5386,7 @@ declare type ProductPromo = z.infer<typeof ProductPromo>;
5211
5386
  * 165:220 image (radius-6) with a TOP PICK flag top-left and a green sale badge
5212
5387
  * bottom-left; below sit the title (2-line clamp) and price with a struck was-price.
5213
5388
  */
5214
- export declare function ProductTile({ product, priority, size }: ProductTileProps): JSX.Element;
5389
+ export declare function ProductTile({ product, priority, size, flag }: ProductTileProps): JSX.Element;
5215
5390
 
5216
5391
  export declare interface ProductTileProps {
5217
5392
  product: Product;
@@ -5222,6 +5397,8 @@ export declare interface ProductTileProps {
5222
5397
  * a taller 343:457 image and an 18px title (Figma `size=large`).
5223
5398
  */
5224
5399
  size?: 'default' | 'large';
5400
+ /** The flag over the image, in place of the product's first badge. */
5401
+ flag?: string;
5225
5402
  }
5226
5403
 
5227
5404
  /** `GET /v1/catalog/products` — a single purchasable variant of a product. */