@wocart/storefront 1.12.0 → 1.13.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/CHANGELOG.md +9 -0
- package/USAGE.md +9 -2
- package/dist/schemas.d.ts +8 -0
- package/dist/schemas.js +7 -0
- package/dist/types.d.ts +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ follows [semantic versioning](https://semver.org/): breaking changes ship only
|
|
|
5
5
|
in a new major version, and an export is marked `@deprecated` for at least one
|
|
6
6
|
minor release before a major removes it.
|
|
7
7
|
|
|
8
|
+
## 1.13.0 — 2026-10-17
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- A cart quote names its offers: `CartValidationLine.offerName`, and each
|
|
13
|
+
`CartReward` says what will be given — `variantId`, `variantLabel` and the
|
|
14
|
+
giving offer's `offerName` — in the shopper's language. All absent from an
|
|
15
|
+
older server.
|
|
16
|
+
|
|
8
17
|
## 1.12.0 — 2026-10-17
|
|
9
18
|
|
|
10
19
|
### Added
|
package/USAGE.md
CHANGED
|
@@ -1000,10 +1000,17 @@ The server re-prices catalog lines, merges duplicate lines, checks stock and
|
|
|
1000
1000
|
offers, and calculates free-delivery eligibility. CartValidation contains:
|
|
1001
1001
|
|
|
1002
1002
|
- lines with productId, variantId, variantLabel, productName, quantity,
|
|
1003
|
-
unitPrice, lineTotal
|
|
1004
|
-
|
|
1003
|
+
unitPrice, lineTotal (offers and the coupon applied), offerId and
|
|
1004
|
+
offerName (the offer that priced the line), discount, maxQuantity, and
|
|
1005
|
+
blocker;
|
|
1006
|
+
- subtotal and rewards — each gift as the order will give it: productName,
|
|
1007
|
+
variantLabel, quantity and the offerName that gives it, free;
|
|
1005
1008
|
- freeDelivery with fromOffer, threshold, qualified, and remaining.
|
|
1006
1009
|
|
|
1010
|
+
Show a line at `lineTotal + discount` (the coupon has its own row) and its
|
|
1011
|
+
catalog price struck through when an offer brought it down; list each reward
|
|
1012
|
+
as its own free row, so the basket reads like the order it becomes.
|
|
1013
|
+
|
|
1007
1014
|
Line blockers include missing, unlisted, and out_of_stock. The creative
|
|
1008
1015
|
experience is yours: inline warnings, a highlighted invalid line, a drawer,
|
|
1009
1016
|
or a guided correction step. The server result is not optional.
|
package/dist/schemas.d.ts
CHANGED
|
@@ -713,6 +713,7 @@ export declare const CartValidationLineSchema: z.ZodObject<{
|
|
|
713
713
|
unitPrice: z.ZodNumber;
|
|
714
714
|
lineTotal: z.ZodNumber;
|
|
715
715
|
offerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
716
|
+
offerName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
716
717
|
discount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
717
718
|
maxQuantity: z.ZodNullable<z.ZodNumber>;
|
|
718
719
|
blocker: z.ZodNullable<z.ZodEnum<{
|
|
@@ -723,8 +724,11 @@ export declare const CartValidationLineSchema: z.ZodObject<{
|
|
|
723
724
|
}, z.core.$strip>;
|
|
724
725
|
export declare const CartRewardSchema: z.ZodObject<{
|
|
725
726
|
offerId: z.ZodString;
|
|
727
|
+
offerName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
726
728
|
productId: z.ZodNullable<z.ZodString>;
|
|
727
729
|
productName: z.ZodNullable<z.ZodString>;
|
|
730
|
+
variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
731
|
+
variantLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
728
732
|
quantity: z.ZodNumber;
|
|
729
733
|
}, z.core.$strip>;
|
|
730
734
|
/**
|
|
@@ -755,6 +759,7 @@ export declare const CartValidationSchema: z.ZodObject<{
|
|
|
755
759
|
unitPrice: z.ZodNumber;
|
|
756
760
|
lineTotal: z.ZodNumber;
|
|
757
761
|
offerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
762
|
+
offerName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
758
763
|
discount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
759
764
|
maxQuantity: z.ZodNullable<z.ZodNumber>;
|
|
760
765
|
blocker: z.ZodNullable<z.ZodEnum<{
|
|
@@ -766,8 +771,11 @@ export declare const CartValidationSchema: z.ZodObject<{
|
|
|
766
771
|
subtotal: z.ZodNumber;
|
|
767
772
|
rewards: z.ZodArray<z.ZodObject<{
|
|
768
773
|
offerId: z.ZodString;
|
|
774
|
+
offerName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
769
775
|
productId: z.ZodNullable<z.ZodString>;
|
|
770
776
|
productName: z.ZodNullable<z.ZodString>;
|
|
777
|
+
variantId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
778
|
+
variantLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
771
779
|
quantity: z.ZodNumber;
|
|
772
780
|
}, z.core.$strip>>;
|
|
773
781
|
freeDelivery: z.ZodObject<{
|
package/dist/schemas.js
CHANGED
|
@@ -353,6 +353,8 @@ export const CartValidationLineSchema = z.object({
|
|
|
353
353
|
lineTotal: z.number(),
|
|
354
354
|
/** The offer applied to the line; absent from a server that predates offers on lines. */
|
|
355
355
|
offerId: z.string().nullish(),
|
|
356
|
+
/** That offer's name, in the shopper's language; absent from an older server. */
|
|
357
|
+
offerName: z.string().nullish(),
|
|
356
358
|
/** The line's share of the coupon's discount, already out of `lineTotal`; absent from a server that predates coupons. */
|
|
357
359
|
discount: z.number().nullish(),
|
|
358
360
|
maxQuantity: z.number().nullable(),
|
|
@@ -360,8 +362,13 @@ export const CartValidationLineSchema = z.object({
|
|
|
360
362
|
});
|
|
361
363
|
export const CartRewardSchema = z.object({
|
|
362
364
|
offerId: z.string(),
|
|
365
|
+
/** The offer's name, in the shopper's language; absent from an older server. */
|
|
366
|
+
offerName: z.string().nullish(),
|
|
363
367
|
productId: z.string().nullable(),
|
|
364
368
|
productName: z.string().nullable(),
|
|
369
|
+
/** The variant given and its label; absent from an older server. */
|
|
370
|
+
variantId: z.string().nullish(),
|
|
371
|
+
variantLabel: z.string().nullish(),
|
|
365
372
|
quantity: z.number().int(),
|
|
366
373
|
});
|
|
367
374
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -314,6 +314,8 @@ export interface CartValidationLine {
|
|
|
314
314
|
lineTotal: number;
|
|
315
315
|
/** The offer applied to the line; null or absent when none. */
|
|
316
316
|
offerId?: string | null | undefined;
|
|
317
|
+
/** That offer's name, in the shopper's language; null or absent when none. */
|
|
318
|
+
offerName?: string | null | undefined;
|
|
317
319
|
/** The line's share of the coupon's discount, already out of `lineTotal`; null or absent without one. */
|
|
318
320
|
discount?: number | null | undefined;
|
|
319
321
|
/** Units still available; null when the product is not stock-tracked. */
|
|
@@ -325,10 +327,16 @@ export interface CartValidationLine {
|
|
|
325
327
|
blocker: "missing" | "unlisted" | "out_of_stock" | null;
|
|
326
328
|
}
|
|
327
329
|
/** A satisfied Buy-X-Get-Y reward, appended server-side at order time. */
|
|
330
|
+
/** A gift the basket earns, as the order will give it: free, beside the lines. */
|
|
328
331
|
export interface CartReward {
|
|
329
332
|
offerId: string;
|
|
333
|
+
/** The offer's name, in the shopper's language; absent from an older server. */
|
|
334
|
+
offerName?: string | null | undefined;
|
|
330
335
|
productId: string | null;
|
|
331
336
|
productName: string | null;
|
|
337
|
+
/** The variant given and its label; null for a product without variants, absent from an older server. */
|
|
338
|
+
variantId?: string | null | undefined;
|
|
339
|
+
variantLabel?: string | null | undefined;
|
|
332
340
|
quantity: number;
|
|
333
341
|
}
|
|
334
342
|
/** The catalog's truth about a basket, right now. Read-only — nothing is written. */
|
package/package.json
CHANGED