@nok-integration/storefront-react 0.25.0 → 0.26.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
  *
@@ -2710,6 +2855,10 @@ declare function createClient(options: ClientOptions): {
2710
2855
  amount: number;
2711
2856
  currency: string;
2712
2857
  } | undefined;
2858
+ subtotal_before_discount?: {
2859
+ amount: number;
2860
+ currency: string;
2861
+ } | undefined;
2713
2862
  };
2714
2863
  locked?: {
2715
2864
  reason: "checkout_handoff";
@@ -2769,6 +2918,10 @@ declare function createClient(options: ClientOptions): {
2769
2918
  amount: number;
2770
2919
  currency: string;
2771
2920
  } | undefined;
2921
+ subtotal_before_discount?: {
2922
+ amount: number;
2923
+ currency: string;
2924
+ } | undefined;
2772
2925
  };
2773
2926
  locked?: {
2774
2927
  reason: "checkout_handoff";
@@ -2828,6 +2981,10 @@ declare function createClient(options: ClientOptions): {
2828
2981
  amount: number;
2829
2982
  currency: string;
2830
2983
  } | undefined;
2984
+ subtotal_before_discount?: {
2985
+ amount: number;
2986
+ currency: string;
2987
+ } | undefined;
2831
2988
  };
2832
2989
  locked?: {
2833
2990
  reason: "checkout_handoff";
@@ -2887,6 +3044,10 @@ declare function createClient(options: ClientOptions): {
2887
3044
  amount: number;
2888
3045
  currency: string;
2889
3046
  } | undefined;
3047
+ subtotal_before_discount?: {
3048
+ amount: number;
3049
+ currency: string;
3050
+ } | undefined;
2890
3051
  };
2891
3052
  locked?: {
2892
3053
  reason: "checkout_handoff";
@@ -2946,6 +3107,10 @@ declare function createClient(options: ClientOptions): {
2946
3107
  amount: number;
2947
3108
  currency: string;
2948
3109
  } | undefined;
3110
+ subtotal_before_discount?: {
3111
+ amount: number;
3112
+ currency: string;
3113
+ } | undefined;
2949
3114
  };
2950
3115
  locked?: {
2951
3116
  reason: "checkout_handoff";
@@ -3368,6 +3533,10 @@ declare function createClient(options: ClientOptions): {
3368
3533
  amount: number;
3369
3534
  currency: string;
3370
3535
  } | undefined;
3536
+ subtotal_before_discount?: {
3537
+ amount: number;
3538
+ currency: string;
3539
+ } | undefined;
3371
3540
  };
3372
3541
  locked?: {
3373
3542
  reason: "checkout_handoff";
@@ -4551,7 +4720,12 @@ export declare interface OrderStatusBadgeProps {
4551
4720
  export declare function OrderSummary({ pricing, deferred, hidden, rows, discount, collapsible, }: OrderSummaryProps): JSX.Element;
4552
4721
 
4553
4722
  export declare interface OrderSummaryProps {
4554
- pricing: Pricing;
4723
+ /**
4724
+ * The figures to draw. A cart's `totals` also carries `subtotal_before_discount`, which
4725
+ * the Subtotal row shows whenever the Discount row is drawn, so the rows read
4726
+ * Subtotal − Discount = Total exactly as the engine sent them.
4727
+ */
4728
+ pricing: Pricing & Partial<Pick<CartTotals, 'subtotal_before_discount'>>;
4555
4729
  /**
4556
4730
  * Row order and wording, where a surface's design differs from the cart's.
4557
4731
  *
@@ -5211,7 +5385,7 @@ declare type ProductPromo = z.infer<typeof ProductPromo>;
5211
5385
  * 165:220 image (radius-6) with a TOP PICK flag top-left and a green sale badge
5212
5386
  * bottom-left; below sit the title (2-line clamp) and price with a struck was-price.
5213
5387
  */
5214
- export declare function ProductTile({ product, priority, size }: ProductTileProps): JSX.Element;
5388
+ export declare function ProductTile({ product, priority, size, flag }: ProductTileProps): JSX.Element;
5215
5389
 
5216
5390
  export declare interface ProductTileProps {
5217
5391
  product: Product;
@@ -5222,6 +5396,8 @@ export declare interface ProductTileProps {
5222
5396
  * a taller 343:457 image and an 18px title (Figma `size=large`).
5223
5397
  */
5224
5398
  size?: 'default' | 'large';
5399
+ /** The flag over the image, in place of the product's first badge. */
5400
+ flag?: string;
5225
5401
  }
5226
5402
 
5227
5403
  /** `GET /v1/catalog/products` — a single purchasable variant of a product. */