@rebuy/rebuy 3.56.1 → 3.56.2
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.cjs +2 -0
- package/dist/index.mjs +2 -0
- package/dist/schema/postPurchaseProductSource.d.ts +1 -0
- package/dist/server/index.cjs +14 -4
- package/dist/server/index.mjs +14 -4
- package/dist/server/normalizePostPurchaseCollection.d.ts +2 -0
- package/dist/server/normalizePostPurchaseProduct.d.ts +3 -0
- package/dist/server/postPurchaseSts.d.ts +1 -0
- package/dist/server/preparePostPurchaseMemberView.d.ts +2 -0
- package/dist/server/preparePostPurchaseStsMember.d.ts +1 -0
- package/dist/server/projectPostPurchaseProduct.d.ts +1 -0
- package/dist/server/readPostPurchaseGroup.d.ts +1 -0
- package/dist/server/readPostPurchaseGroupSelection.d.ts +1 -0
- package/dist/server/readPostPurchaseProductSource.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2769,6 +2769,8 @@ var Product2 = ProductBase.extend({
|
|
|
2769
2769
|
metafields: import_zod19.z.unknown().optional(),
|
|
2770
2770
|
options: import_zod19.z.unknown().optional(),
|
|
2771
2771
|
productGroupVariants: import_zod19.z.array(import_zod19.z.unknown()).default([]),
|
|
2772
|
+
// REB-25048: the v2 data source flags a subscription-only product here and sends no selling plan groups
|
|
2773
|
+
requiresSellingPlan: import_zod19.z.boolean().nullish(),
|
|
2772
2774
|
selectedVariant: import_zod19.z.unknown().optional(),
|
|
2773
2775
|
sellingPlanGroups: import_zod19.z.array(
|
|
2774
2776
|
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
package/dist/index.mjs
CHANGED
|
@@ -2290,6 +2290,8 @@ var Product2 = ProductBase.extend({
|
|
|
2290
2290
|
metafields: z19.unknown().optional(),
|
|
2291
2291
|
options: z19.unknown().optional(),
|
|
2292
2292
|
productGroupVariants: z19.array(z19.unknown()).default([]),
|
|
2293
|
+
// REB-25048: the v2 data source flags a subscription-only product here and sends no selling plan groups
|
|
2294
|
+
requiresSellingPlan: z19.boolean().nullish(),
|
|
2293
2295
|
selectedVariant: z19.unknown().optional(),
|
|
2294
2296
|
sellingPlanGroups: z19.array(
|
|
2295
2297
|
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
@@ -42,6 +42,7 @@ export declare const PostPurchaseProductSource: z.ZodObject<{
|
|
|
42
42
|
metafields: z.ZodOptional<z.ZodUnknown>;
|
|
43
43
|
options: z.ZodOptional<z.ZodUnknown>;
|
|
44
44
|
productGroupVariants: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
|
|
45
|
+
requiresSellingPlan: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
45
46
|
selectedVariant: z.ZodOptional<z.ZodUnknown>;
|
|
46
47
|
sellingPlanGroups: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
47
48
|
discountAmount: z.ZodOptional<z.ZodUnknown>;
|
package/dist/server/index.cjs
CHANGED
|
@@ -6128,6 +6128,8 @@ var Product2 = ProductBase.extend({
|
|
|
6128
6128
|
metafields: import_zod43.z.unknown().optional(),
|
|
6129
6129
|
options: import_zod43.z.unknown().optional(),
|
|
6130
6130
|
productGroupVariants: import_zod43.z.array(import_zod43.z.unknown()).default([]),
|
|
6131
|
+
// REB-25048: the v2 data source flags a subscription-only product here and sends no selling plan groups
|
|
6132
|
+
requiresSellingPlan: import_zod43.z.boolean().nullish(),
|
|
6131
6133
|
selectedVariant: import_zod43.z.unknown().optional(),
|
|
6132
6134
|
sellingPlanGroups: import_zod43.z.array(
|
|
6133
6135
|
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
@@ -6187,7 +6189,14 @@ var readPostPurchaseProductSource = (response, report) => {
|
|
|
6187
6189
|
const dropped = [];
|
|
6188
6190
|
const products = data.flatMap((raw, productIndex) => {
|
|
6189
6191
|
const parsed = Product3.safeParse(raw);
|
|
6190
|
-
if (parsed.success)
|
|
6192
|
+
if (parsed.success) {
|
|
6193
|
+
if (parsed.data.requiresSellingPlan && !parsed.data.sellingPlanGroups.length)
|
|
6194
|
+
drift.push({
|
|
6195
|
+
detail: `Dropped post-purchase product ${parsed.data.id}: data.${productIndex}.requiresSellingPlan`,
|
|
6196
|
+
kind: "product"
|
|
6197
|
+
});
|
|
6198
|
+
return [{ product: parsed.data, productIndex }];
|
|
6199
|
+
}
|
|
6191
6200
|
const id = Identified.safeParse(raw);
|
|
6192
6201
|
const issues = parsed.error.issues.map((issue) => ({ ...issue, path: ["data", productIndex, ...issue.path] }));
|
|
6193
6202
|
const path = issues[0].path.join(".");
|
|
@@ -6398,7 +6407,8 @@ var projectPostPurchasePlanCatalog = (normalized, report) => {
|
|
|
6398
6407
|
discountPercentage: postPurchasePlanDiscountPercentage(variant2.price, plan.adjustment)
|
|
6399
6408
|
})),
|
|
6400
6409
|
productId: product.id,
|
|
6401
|
-
|
|
6410
|
+
// REB-25048: a v2 product flags the requirement on itself and carries no selling plan groups
|
|
6411
|
+
requiresSellingPlan: (required[0] ?? false) || product.requiresSellingPlan === true,
|
|
6402
6412
|
variantId: variant2.id
|
|
6403
6413
|
});
|
|
6404
6414
|
} catch {
|
|
@@ -6951,7 +6961,7 @@ var oneTimeUnavailable = (normalized, allowCollection, quantity3) => {
|
|
|
6951
6961
|
return "Only fixed one-time configuration is supported";
|
|
6952
6962
|
const product = data[0];
|
|
6953
6963
|
const variant2 = product.variants[0];
|
|
6954
|
-
if (product.productGroupVariants.length || product.sellingPlanGroups?.some((group) => group.requiresSellingPlan))
|
|
6964
|
+
if (product.productGroupVariants.length || product.requiresSellingPlan === true || product.sellingPlanGroups?.some((group) => group.requiresSellingPlan))
|
|
6955
6965
|
return "A one-time variant without product groups or a required selling plan is required";
|
|
6956
6966
|
if (!postPurchaseVariantAvailable(variant2)) return VARIANT_UNAVAILABLE;
|
|
6957
6967
|
if (variant2.productId !== product.id) throw new Error("Product variant identity mismatch");
|
|
@@ -8062,7 +8072,7 @@ var postPurchaseMemberEligibility = (normalized, product, excluded) => {
|
|
|
8062
8072
|
data: [{ ...product, variants: [variant2] }]
|
|
8063
8073
|
});
|
|
8064
8074
|
if (!catalog) throw new Error("Unreadable subscription catalog");
|
|
8065
|
-
if (normalized.effective.productType === "one-time" &&
|
|
8075
|
+
if (normalized.effective.productType === "one-time" && product.sellingPlanGroups.some((group) => group.requiresSellingPlan))
|
|
8066
8076
|
throw new Error("Unsupported purchase mode");
|
|
8067
8077
|
return catalog;
|
|
8068
8078
|
});
|
package/dist/server/index.mjs
CHANGED
|
@@ -6055,6 +6055,8 @@ var Product2 = ProductBase.extend({
|
|
|
6055
6055
|
metafields: z43.unknown().optional(),
|
|
6056
6056
|
options: z43.unknown().optional(),
|
|
6057
6057
|
productGroupVariants: z43.array(z43.unknown()).default([]),
|
|
6058
|
+
// REB-25048: the v2 data source flags a subscription-only product here and sends no selling plan groups
|
|
6059
|
+
requiresSellingPlan: z43.boolean().nullish(),
|
|
6058
6060
|
selectedVariant: z43.unknown().optional(),
|
|
6059
6061
|
sellingPlanGroups: z43.array(
|
|
6060
6062
|
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
@@ -6114,7 +6116,14 @@ var readPostPurchaseProductSource = (response, report) => {
|
|
|
6114
6116
|
const dropped = [];
|
|
6115
6117
|
const products = data.flatMap((raw, productIndex) => {
|
|
6116
6118
|
const parsed = Product3.safeParse(raw);
|
|
6117
|
-
if (parsed.success)
|
|
6119
|
+
if (parsed.success) {
|
|
6120
|
+
if (parsed.data.requiresSellingPlan && !parsed.data.sellingPlanGroups.length)
|
|
6121
|
+
drift.push({
|
|
6122
|
+
detail: `Dropped post-purchase product ${parsed.data.id}: data.${productIndex}.requiresSellingPlan`,
|
|
6123
|
+
kind: "product"
|
|
6124
|
+
});
|
|
6125
|
+
return [{ product: parsed.data, productIndex }];
|
|
6126
|
+
}
|
|
6118
6127
|
const id = Identified.safeParse(raw);
|
|
6119
6128
|
const issues = parsed.error.issues.map((issue) => ({ ...issue, path: ["data", productIndex, ...issue.path] }));
|
|
6120
6129
|
const path = issues[0].path.join(".");
|
|
@@ -6325,7 +6334,8 @@ var projectPostPurchasePlanCatalog = (normalized, report) => {
|
|
|
6325
6334
|
discountPercentage: postPurchasePlanDiscountPercentage(variant2.price, plan.adjustment)
|
|
6326
6335
|
})),
|
|
6327
6336
|
productId: product.id,
|
|
6328
|
-
|
|
6337
|
+
// REB-25048: a v2 product flags the requirement on itself and carries no selling plan groups
|
|
6338
|
+
requiresSellingPlan: (required[0] ?? false) || product.requiresSellingPlan === true,
|
|
6329
6339
|
variantId: variant2.id
|
|
6330
6340
|
});
|
|
6331
6341
|
} catch {
|
|
@@ -6878,7 +6888,7 @@ var oneTimeUnavailable = (normalized, allowCollection, quantity3) => {
|
|
|
6878
6888
|
return "Only fixed one-time configuration is supported";
|
|
6879
6889
|
const product = data[0];
|
|
6880
6890
|
const variant2 = product.variants[0];
|
|
6881
|
-
if (product.productGroupVariants.length || product.sellingPlanGroups?.some((group) => group.requiresSellingPlan))
|
|
6891
|
+
if (product.productGroupVariants.length || product.requiresSellingPlan === true || product.sellingPlanGroups?.some((group) => group.requiresSellingPlan))
|
|
6882
6892
|
return "A one-time variant without product groups or a required selling plan is required";
|
|
6883
6893
|
if (!postPurchaseVariantAvailable(variant2)) return VARIANT_UNAVAILABLE;
|
|
6884
6894
|
if (variant2.productId !== product.id) throw new Error("Product variant identity mismatch");
|
|
@@ -7989,7 +7999,7 @@ var postPurchaseMemberEligibility = (normalized, product, excluded) => {
|
|
|
7989
7999
|
data: [{ ...product, variants: [variant2] }]
|
|
7990
8000
|
});
|
|
7991
8001
|
if (!catalog) throw new Error("Unreadable subscription catalog");
|
|
7992
|
-
if (normalized.effective.productType === "one-time" &&
|
|
8002
|
+
if (normalized.effective.productType === "one-time" && product.sellingPlanGroups.some((group) => group.requiresSellingPlan))
|
|
7993
8003
|
throw new Error("Unsupported purchase mode");
|
|
7994
8004
|
return catalog;
|
|
7995
8005
|
});
|
|
@@ -51,6 +51,7 @@ export declare const normalizePostPurchaseCollection: (settings: unknown, respon
|
|
|
51
51
|
} | undefined;
|
|
52
52
|
metafields?: unknown;
|
|
53
53
|
options?: unknown;
|
|
54
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
54
55
|
selectedVariant?: unknown;
|
|
55
56
|
};
|
|
56
57
|
productIndex: number;
|
|
@@ -96,6 +97,7 @@ export declare const normalizePostPurchaseCollection: (settings: unknown, respon
|
|
|
96
97
|
} | undefined;
|
|
97
98
|
metafields?: unknown;
|
|
98
99
|
options?: unknown;
|
|
100
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
99
101
|
selectedVariant?: unknown;
|
|
100
102
|
}[];
|
|
101
103
|
effective: {
|
|
@@ -52,6 +52,7 @@ export declare const normalizePostPurchaseSource: (settings: unknown, response:
|
|
|
52
52
|
} | undefined;
|
|
53
53
|
metafields?: unknown;
|
|
54
54
|
options?: unknown;
|
|
55
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
55
56
|
selectedVariant?: unknown;
|
|
56
57
|
}[];
|
|
57
58
|
effective: {
|
|
@@ -254,6 +255,7 @@ export declare const normalizePostPurchaseSource: (settings: unknown, response:
|
|
|
254
255
|
} | undefined;
|
|
255
256
|
metafields?: unknown;
|
|
256
257
|
options?: unknown;
|
|
258
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
257
259
|
selectedVariant?: unknown;
|
|
258
260
|
};
|
|
259
261
|
productIndex: number;
|
|
@@ -317,6 +319,7 @@ export declare const normalizePostPurchaseProduct: (settings: unknown, response:
|
|
|
317
319
|
} | undefined;
|
|
318
320
|
metafields?: unknown;
|
|
319
321
|
options?: unknown;
|
|
322
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
320
323
|
selectedVariant?: unknown;
|
|
321
324
|
}[];
|
|
322
325
|
effective: {
|
|
@@ -651,6 +651,7 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
|
|
|
651
651
|
} | undefined;
|
|
652
652
|
metafields?: unknown;
|
|
653
653
|
options?: unknown;
|
|
654
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
654
655
|
selectedVariant?: unknown;
|
|
655
656
|
}[];
|
|
656
657
|
effective: {
|
|
@@ -1468,6 +1469,7 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
|
|
|
1468
1469
|
} | undefined;
|
|
1469
1470
|
metafields?: unknown;
|
|
1470
1471
|
options?: unknown;
|
|
1472
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
1471
1473
|
selectedVariant?: unknown;
|
|
1472
1474
|
}[];
|
|
1473
1475
|
effective: {
|
|
@@ -656,6 +656,7 @@ export declare const preparePostPurchaseStsMember: (widgetId: number, settings:
|
|
|
656
656
|
} | undefined;
|
|
657
657
|
metafields?: unknown;
|
|
658
658
|
options?: unknown;
|
|
659
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
659
660
|
selectedVariant?: unknown;
|
|
660
661
|
}[];
|
|
661
662
|
effective: {
|
|
@@ -159,6 +159,7 @@ export declare const projectPostPurchaseProduct: ({ data, effective, metadata, o
|
|
|
159
159
|
} | undefined;
|
|
160
160
|
metafields?: unknown;
|
|
161
161
|
options?: unknown;
|
|
162
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
162
163
|
selectedVariant?: unknown;
|
|
163
164
|
};
|
|
164
165
|
selection: {
|
|
@@ -75,6 +75,7 @@ export declare const readPostPurchaseGroup: (product: ReturnType<typeof normaliz
|
|
|
75
75
|
productQuantity?: number | undefined;
|
|
76
76
|
} | undefined;
|
|
77
77
|
metafields?: unknown;
|
|
78
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
78
79
|
selectedVariant?: unknown;
|
|
79
80
|
};
|
|
80
81
|
variantCatalog: {
|
|
@@ -81,6 +81,7 @@ export declare const readPostPurchaseGroupSelection: (settings: unknown, respons
|
|
|
81
81
|
productQuantity?: number | undefined;
|
|
82
82
|
} | undefined;
|
|
83
83
|
metafields?: unknown;
|
|
84
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
84
85
|
selectedVariant?: unknown;
|
|
85
86
|
}[];
|
|
86
87
|
metadata: {
|
|
@@ -9,6 +9,10 @@ import type { Reporter } from '../server/shared';
|
|
|
9
9
|
* one request (a re-parse or clone per projection reports the drops again). The envelope (an object, `data`
|
|
10
10
|
* an array, readable `metadata`) still throws.
|
|
11
11
|
*
|
|
12
|
+
* A product that parses but requires a selling plan on itself with no selling plan groups (a v2 subscription-only
|
|
13
|
+
* product, REB-25048) is kept for eligibility to drop, and reported here as the same once-per-response drift,
|
|
14
|
+
* naming its `requiresSellingPlan` path: it has no plan to sell it with and may never be sold one-time.
|
|
15
|
+
*
|
|
12
16
|
* Every survivor keeps `productIndex`, its position in the raw `data` array: Decision, Render and Offer
|
|
13
17
|
* members identify a product by that index, so a drop never renumbers the products after it. `dropped` keeps
|
|
14
18
|
* each drop's `productIndex` and its zod issues with paths from the source root, so a caller can fail a source
|
|
@@ -63,6 +67,7 @@ export declare const readPostPurchaseProductSource: (response: unknown, report?:
|
|
|
63
67
|
} | undefined;
|
|
64
68
|
metafields?: unknown;
|
|
65
69
|
options?: unknown;
|
|
70
|
+
requiresSellingPlan?: boolean | null | undefined;
|
|
66
71
|
selectedVariant?: unknown;
|
|
67
72
|
};
|
|
68
73
|
productIndex: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuy/rebuy",
|
|
3
|
-
"version": "3.56.
|
|
3
|
+
"version": "3.56.2",
|
|
4
4
|
"description": "Shared zod schemas, legacy-to-CAB widget transforms, and server orchestrators for Rebuy's Shopify consumers (rebuy-api, admin-nextjs, rebuy-shopify-extensions)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Rebuy, Inc.",
|