@rebuy/rebuy 3.49.0 → 3.51.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.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/schema/postPurchaseGroupCatalog.d.ts +2 -2
- package/dist/schema/postPurchaseProductCollectionView.d.ts +4 -4
- package/dist/schema/postPurchaseProductView.d.ts +4 -4
- package/dist/schema/postPurchaseVariantCatalog.d.ts +6 -2
- package/dist/server/__fixtures__/postPurchaseRankingWorker.d.ts +91 -0
- package/dist/server/index.cjs +70 -38
- package/dist/server/index.mjs +70 -38
- package/dist/server/postPurchaseJudgeMeReviews.d.ts +1 -1
- package/dist/server/postPurchaseOkendoReviews.d.ts +1 -1
- package/dist/server/postPurchaseReviewData.d.ts +1 -1
- package/dist/server/postPurchaseReviewFields.d.ts +7 -0
- package/dist/server/postPurchaseReviews.d.ts +9 -2
- package/dist/server/postPurchaseScalarReviews.d.ts +1 -1
- package/dist/server/preparePostPurchaseAdmissionView.d.ts +4 -4
- package/dist/server/preparePostPurchaseCollectionGroup.d.ts +5 -5
- package/dist/server/preparePostPurchaseCollectionView.d.ts +4 -4
- package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +5 -5
- package/dist/server/preparePostPurchaseGroupDefault.d.ts +5 -5
- package/dist/server/preparePostPurchaseGroupView.d.ts +5 -5
- package/dist/server/preparePostPurchaseMemberView.d.ts +12 -12
- package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +4 -4
- package/dist/server/preparePostPurchaseQuantityView.d.ts +4 -4
- package/dist/server/readPostPurchaseGroup.d.ts +3 -3
- package/dist/server/readPostPurchaseGroupSelection.d.ts +3 -3
- package/dist/server/shared.d.ts +9 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3089,7 +3089,7 @@ var PostPurchaseProgressSchema = import_zod32.z.object({
|
|
|
3089
3089
|
var import_zod33 = require("zod");
|
|
3090
3090
|
var PostPurchaseVariantSelector = import_zod33.z.object({ variantId: PostPurchaseVariantId }).strict();
|
|
3091
3091
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
3092
|
-
id: import_zod33.z.number().int().positive(),
|
|
3092
|
+
id: import_zod33.z.number().int().positive().optional(),
|
|
3093
3093
|
position: import_zod33.z.number().int().min(1).max(3)
|
|
3094
3094
|
});
|
|
3095
3095
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
package/dist/index.mjs
CHANGED
|
@@ -2617,7 +2617,7 @@ var PostPurchaseProgressSchema = z32.object({
|
|
|
2617
2617
|
import { z as z33 } from "zod";
|
|
2618
2618
|
var PostPurchaseVariantSelector = z33.object({ variantId: PostPurchaseVariantId }).strict();
|
|
2619
2619
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
2620
|
-
id: z33.number().int().positive(),
|
|
2620
|
+
id: z33.number().int().positive().optional(),
|
|
2621
2621
|
position: z33.number().int().min(1).max(3)
|
|
2622
2622
|
});
|
|
2623
2623
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
@@ -14,7 +14,7 @@ export declare const PostPurchaseGroupDescription: z.ZodObject<{
|
|
|
14
14
|
options: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
15
15
|
name: z.ZodString;
|
|
16
16
|
values: z.ZodArray<z.ZodString>;
|
|
17
|
-
id: z.ZodNumber
|
|
17
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
18
18
|
position: z.ZodNumber;
|
|
19
19
|
}, z.core.$strip>>>;
|
|
20
20
|
}, z.core.$strip>;
|
|
@@ -31,7 +31,7 @@ export declare const PostPurchaseGroupCatalog: z.ZodObject<{
|
|
|
31
31
|
options: z.ZodArray<z.ZodObject<{
|
|
32
32
|
name: z.ZodString;
|
|
33
33
|
values: z.ZodArray<z.ZodString>;
|
|
34
|
-
id: z.ZodNumber
|
|
34
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
35
35
|
position: z.ZodNumber;
|
|
36
36
|
}, z.core.$strip>>;
|
|
37
37
|
productId: z.ZodNumber;
|
|
@@ -74,7 +74,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
|
|
|
74
74
|
options: z.ZodArray<z.ZodObject<{
|
|
75
75
|
name: z.ZodString;
|
|
76
76
|
values: z.ZodArray<z.ZodString>;
|
|
77
|
-
id: z.ZodNumber
|
|
77
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
78
78
|
position: z.ZodNumber;
|
|
79
79
|
}, z.core.$strip>>;
|
|
80
80
|
productId: z.ZodNumber;
|
|
@@ -665,7 +665,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
|
|
|
665
665
|
options: z.ZodArray<z.ZodObject<{
|
|
666
666
|
name: z.ZodString;
|
|
667
667
|
values: z.ZodArray<z.ZodString>;
|
|
668
|
-
id: z.ZodNumber
|
|
668
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
669
669
|
position: z.ZodNumber;
|
|
670
670
|
}, z.core.$strip>>;
|
|
671
671
|
productId: z.ZodNumber;
|
|
@@ -694,7 +694,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
|
|
|
694
694
|
options: z.ZodArray<z.ZodObject<{
|
|
695
695
|
name: z.ZodString;
|
|
696
696
|
values: z.ZodArray<z.ZodString>;
|
|
697
|
-
id: z.ZodNumber
|
|
697
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
698
698
|
position: z.ZodNumber;
|
|
699
699
|
}, z.core.$strip>>;
|
|
700
700
|
productId: z.ZodNumber;
|
|
@@ -1128,7 +1128,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
|
|
|
1128
1128
|
options: z.ZodArray<z.ZodObject<{
|
|
1129
1129
|
name: z.ZodString;
|
|
1130
1130
|
values: z.ZodArray<z.ZodString>;
|
|
1131
|
-
id: z.ZodNumber
|
|
1131
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
1132
1132
|
position: z.ZodNumber;
|
|
1133
1133
|
}, z.core.$strip>>;
|
|
1134
1134
|
productId: z.ZodNumber;
|
|
@@ -77,7 +77,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
77
77
|
options: z.ZodArray<z.ZodObject<{
|
|
78
78
|
name: z.ZodString;
|
|
79
79
|
values: z.ZodArray<z.ZodString>;
|
|
80
|
-
id: z.ZodNumber
|
|
80
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
81
81
|
position: z.ZodNumber;
|
|
82
82
|
}, z.core.$strip>>;
|
|
83
83
|
productId: z.ZodNumber;
|
|
@@ -668,7 +668,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
668
668
|
options: z.ZodArray<z.ZodObject<{
|
|
669
669
|
name: z.ZodString;
|
|
670
670
|
values: z.ZodArray<z.ZodString>;
|
|
671
|
-
id: z.ZodNumber
|
|
671
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
672
672
|
position: z.ZodNumber;
|
|
673
673
|
}, z.core.$strip>>;
|
|
674
674
|
productId: z.ZodNumber;
|
|
@@ -697,7 +697,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
697
697
|
options: z.ZodArray<z.ZodObject<{
|
|
698
698
|
name: z.ZodString;
|
|
699
699
|
values: z.ZodArray<z.ZodString>;
|
|
700
|
-
id: z.ZodNumber
|
|
700
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
701
701
|
position: z.ZodNumber;
|
|
702
702
|
}, z.core.$strip>>;
|
|
703
703
|
productId: z.ZodNumber;
|
|
@@ -1131,7 +1131,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
1131
1131
|
options: z.ZodArray<z.ZodObject<{
|
|
1132
1132
|
name: z.ZodString;
|
|
1133
1133
|
values: z.ZodArray<z.ZodString>;
|
|
1134
|
-
id: z.ZodNumber
|
|
1134
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
1135
1135
|
position: z.ZodNumber;
|
|
1136
1136
|
}, z.core.$strip>>;
|
|
1137
1137
|
productId: z.ZodNumber;
|
|
@@ -3,10 +3,14 @@ export declare const PostPurchaseVariantSelector: z.ZodObject<{
|
|
|
3
3
|
variantId: z.ZodNumber;
|
|
4
4
|
}, z.core.$strict>;
|
|
5
5
|
export type PostPurchaseVariantSelector = z.infer<typeof PostPurchaseVariantSelector>;
|
|
6
|
+
/**
|
|
7
|
+
* `position` (1–3, unique, contiguous) is the option's key. `id` is optional because the v2 ranking-worker
|
|
8
|
+
* `/data-source/id/*` product shape omits it (REB-24953); nothing reads it, and a v1 id still passes through.
|
|
9
|
+
*/
|
|
6
10
|
export declare const PostPurchaseVariantOption: z.ZodObject<{
|
|
7
11
|
name: z.ZodString;
|
|
8
12
|
values: z.ZodArray<z.ZodString>;
|
|
9
|
-
id: z.ZodNumber
|
|
13
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
10
14
|
position: z.ZodNumber;
|
|
11
15
|
}, z.core.$strip>;
|
|
12
16
|
export declare const PostPurchaseVariantValues: z.ZodObject<{
|
|
@@ -23,7 +27,7 @@ export declare const PostPurchaseVariantCatalog: z.ZodObject<{
|
|
|
23
27
|
options: z.ZodArray<z.ZodObject<{
|
|
24
28
|
name: z.ZodString;
|
|
25
29
|
values: z.ZodArray<z.ZodString>;
|
|
26
|
-
id: z.ZodNumber
|
|
30
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
27
31
|
position: z.ZodNumber;
|
|
28
32
|
}, z.core.$strip>>;
|
|
29
33
|
productId: z.ZodNumber;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export declare const rankingWorkerResponse: {
|
|
2
|
+
data: {
|
|
3
|
+
admin_graphql_api_id: string;
|
|
4
|
+
body_html: string;
|
|
5
|
+
created_at: string;
|
|
6
|
+
description: string;
|
|
7
|
+
handle: string;
|
|
8
|
+
id: number;
|
|
9
|
+
image: {
|
|
10
|
+
admin_graphql_api_id: string;
|
|
11
|
+
alt: string;
|
|
12
|
+
height: number;
|
|
13
|
+
id: number;
|
|
14
|
+
position: number;
|
|
15
|
+
product_id: number;
|
|
16
|
+
src: string;
|
|
17
|
+
variant_ids: number[];
|
|
18
|
+
width: number;
|
|
19
|
+
};
|
|
20
|
+
images: {
|
|
21
|
+
admin_graphql_api_id: string;
|
|
22
|
+
alt: string;
|
|
23
|
+
height: number;
|
|
24
|
+
id: number;
|
|
25
|
+
position: number;
|
|
26
|
+
product_id: number;
|
|
27
|
+
src: string;
|
|
28
|
+
variant_ids: number[];
|
|
29
|
+
width: number;
|
|
30
|
+
}[];
|
|
31
|
+
options: {
|
|
32
|
+
name: string;
|
|
33
|
+
position: number;
|
|
34
|
+
product_id: number;
|
|
35
|
+
values: string[];
|
|
36
|
+
}[];
|
|
37
|
+
product_type: string;
|
|
38
|
+
published_at: string;
|
|
39
|
+
recommended_variant_ids: never[];
|
|
40
|
+
requires_selling_plan: boolean;
|
|
41
|
+
status: string;
|
|
42
|
+
tags: string;
|
|
43
|
+
template_suffix: string;
|
|
44
|
+
title: string;
|
|
45
|
+
updated_at: string;
|
|
46
|
+
variant_ids: {
|
|
47
|
+
id: number;
|
|
48
|
+
}[];
|
|
49
|
+
variants: {
|
|
50
|
+
admin_graphql_api_id: string;
|
|
51
|
+
barcode: string;
|
|
52
|
+
compare_at_price: null;
|
|
53
|
+
created_at: string;
|
|
54
|
+
fulfillment_service: string;
|
|
55
|
+
grams: number;
|
|
56
|
+
id: number;
|
|
57
|
+
image_id: number;
|
|
58
|
+
inventory_management: string;
|
|
59
|
+
inventory_policy: string;
|
|
60
|
+
inventory_quantity: number;
|
|
61
|
+
metafields: null;
|
|
62
|
+
option1: string;
|
|
63
|
+
option2: string;
|
|
64
|
+
option3: null;
|
|
65
|
+
position: number;
|
|
66
|
+
price: string;
|
|
67
|
+
product_id: number;
|
|
68
|
+
requires_shipping: boolean;
|
|
69
|
+
sku: string;
|
|
70
|
+
tax_code: string;
|
|
71
|
+
taxable: boolean;
|
|
72
|
+
title: string;
|
|
73
|
+
updated_at: string;
|
|
74
|
+
weight: number;
|
|
75
|
+
weight_unit: string;
|
|
76
|
+
}[];
|
|
77
|
+
vendor: string;
|
|
78
|
+
}[];
|
|
79
|
+
metadata: {
|
|
80
|
+
cache_info: {};
|
|
81
|
+
cart_items: never[];
|
|
82
|
+
errors: never[];
|
|
83
|
+
filtered_input_products: never[];
|
|
84
|
+
filtered_oos_products: never[];
|
|
85
|
+
global_excluded_products: never[];
|
|
86
|
+
input_products: never[];
|
|
87
|
+
matched_rules: never[];
|
|
88
|
+
unevaluated_rules: never[];
|
|
89
|
+
unmatched_rules: never[];
|
|
90
|
+
};
|
|
91
|
+
};
|
package/dist/server/index.cjs
CHANGED
|
@@ -6635,45 +6635,76 @@ var projectPostPurchaseProductDisplay = (effective, metadata, product) => PostPu
|
|
|
6635
6635
|
});
|
|
6636
6636
|
|
|
6637
6637
|
// src/server/postPurchaseReviewData.ts
|
|
6638
|
-
var
|
|
6638
|
+
var import_zod64 = require("zod");
|
|
6639
6639
|
|
|
6640
6640
|
// src/server/postPurchaseJudgeMeReviews.ts
|
|
6641
|
+
var import_zod61 = require("zod");
|
|
6642
|
+
|
|
6643
|
+
// src/server/postPurchaseReviewFields.ts
|
|
6641
6644
|
var import_zod60 = require("zod");
|
|
6645
|
+
var Field = import_zod60.z.object({ key: import_zod60.z.string(), namespace: import_zod60.z.string(), value: import_zod60.z.unknown().optional() });
|
|
6646
|
+
var reviewFields = (raw) => {
|
|
6647
|
+
const fields4 = import_zod60.z.array(import_zod60.z.unknown()).parse(raw).flatMap((field) => {
|
|
6648
|
+
const parsed = Field.safeParse(field);
|
|
6649
|
+
return parsed.success ? [parsed.data] : [];
|
|
6650
|
+
});
|
|
6651
|
+
return (namespace, key) => fields4.find((field) => field.namespace === namespace && field.key === key);
|
|
6652
|
+
};
|
|
6653
|
+
var ReviewFieldError = class extends Error {
|
|
6654
|
+
constructor(field) {
|
|
6655
|
+
super(`Unreadable review field ${field}`);
|
|
6656
|
+
this.field = field;
|
|
6657
|
+
}
|
|
6658
|
+
};
|
|
6659
|
+
var readReviewField = (field, read) => {
|
|
6660
|
+
try {
|
|
6661
|
+
return read(field.value);
|
|
6662
|
+
} catch {
|
|
6663
|
+
throw new ReviewFieldError(`${field.namespace}.${field.key}`);
|
|
6664
|
+
}
|
|
6665
|
+
};
|
|
6666
|
+
|
|
6667
|
+
// src/server/postPurchaseJudgeMeReviews.ts
|
|
6642
6668
|
var readJudgeMeReviews = (find) => {
|
|
6643
6669
|
const field = find("judgeme", "badge");
|
|
6644
6670
|
if (!field) return null;
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6671
|
+
return readReviewField(field, (value) => {
|
|
6672
|
+
const html = import_zod61.z.string().parse(value);
|
|
6673
|
+
const rating = html.match(/data-average-rating=['"](\d+(?:\.\d+)?)['"]/);
|
|
6674
|
+
const count = html.match(/data-number-of-reviews=['"](\d+)['"]/);
|
|
6675
|
+
if (!rating || !count) throw new Error("Unreadable Judge.me attributes");
|
|
6676
|
+
return {
|
|
6677
|
+
rating: PostPurchaseCommonReviewRating.parse({ value: rating[1] }).value,
|
|
6678
|
+
reviewCount: PostPurchaseReviewCount.parse(count[1])
|
|
6679
|
+
};
|
|
6680
|
+
});
|
|
6653
6681
|
};
|
|
6654
6682
|
|
|
6655
6683
|
// src/server/postPurchaseOkendoReviews.ts
|
|
6656
|
-
var
|
|
6657
|
-
var Summary =
|
|
6684
|
+
var import_zod62 = require("zod");
|
|
6685
|
+
var Summary = import_zod62.z.object({
|
|
6658
6686
|
reviewAverageValue: PostPurchaseCommonReviewRating.shape.value,
|
|
6659
|
-
reviewCount:
|
|
6687
|
+
reviewCount: import_zod62.z.union([PostPurchaseProductReviews.shape.reviewCount, PostPurchaseReviewCount])
|
|
6660
6688
|
});
|
|
6661
6689
|
var readOkendoReviews = (find) => {
|
|
6662
6690
|
const field = find("okendo", "summaryData");
|
|
6663
6691
|
if (!field) return null;
|
|
6664
|
-
const summary = Summary.parse(JSON.parse(
|
|
6692
|
+
const summary = readReviewField(field, (value) => Summary.parse(JSON.parse(import_zod62.z.string().parse(value))));
|
|
6665
6693
|
return { rating: summary.reviewAverageValue, reviewCount: summary.reviewCount };
|
|
6666
6694
|
};
|
|
6667
6695
|
|
|
6668
6696
|
// src/server/postPurchaseScalarReviews.ts
|
|
6669
|
-
var
|
|
6697
|
+
var import_zod63 = require("zod");
|
|
6670
6698
|
var readScalarReviews = (find, namespace, ratingKey, countKey) => {
|
|
6671
6699
|
const rating = find(namespace, ratingKey);
|
|
6672
6700
|
const count = find(namespace, countKey);
|
|
6673
6701
|
if (!rating || !count) return null;
|
|
6674
6702
|
return {
|
|
6675
|
-
rating:
|
|
6676
|
-
|
|
6703
|
+
rating: readReviewField(
|
|
6704
|
+
rating,
|
|
6705
|
+
(value) => PostPurchaseCommonReviewRating.parse({ value: import_zod63.z.string().parse(value) }).value
|
|
6706
|
+
),
|
|
6707
|
+
reviewCount: readReviewField(count, (value) => PostPurchaseReviewCount.parse(value))
|
|
6677
6708
|
};
|
|
6678
6709
|
};
|
|
6679
6710
|
|
|
@@ -6682,10 +6713,12 @@ var readStandardReviews = (find) => {
|
|
|
6682
6713
|
const rating = find("reviews", "rating");
|
|
6683
6714
|
const count = find("reviews", "rating_count");
|
|
6684
6715
|
if (!rating || !count) return null;
|
|
6685
|
-
const value = import_zod63.z.string().parse(rating.value);
|
|
6686
6716
|
return {
|
|
6687
|
-
rating:
|
|
6688
|
-
|
|
6717
|
+
rating: readReviewField(rating, (raw) => {
|
|
6718
|
+
const value = import_zod64.z.string().parse(raw);
|
|
6719
|
+
return PostPurchaseCommonReviewRating.parse(/^\d+(?:\.\d+)?$/.test(value) ? { value } : JSON.parse(value)).value;
|
|
6720
|
+
}),
|
|
6721
|
+
reviewCount: readReviewField(count, (value) => PostPurchaseReviewCount.parse(value))
|
|
6689
6722
|
};
|
|
6690
6723
|
};
|
|
6691
6724
|
var readPostPurchaseReviewData = (provider, find) => {
|
|
@@ -6702,22 +6735,14 @@ var readPostPurchaseReviewData = (provider, find) => {
|
|
|
6702
6735
|
const count = find("reviews", "rating_count");
|
|
6703
6736
|
if (!rating || !count) return null;
|
|
6704
6737
|
return {
|
|
6705
|
-
rating:
|
|
6706
|
-
|
|
6738
|
+
rating: readReviewField(
|
|
6739
|
+
rating,
|
|
6740
|
+
(value) => PostPurchaseKlaviyoReviewRating.parse(JSON.parse(import_zod64.z.string().parse(value))).value
|
|
6741
|
+
),
|
|
6742
|
+
reviewCount: readReviewField(count, (value) => PostPurchaseReviewCount.parse(value))
|
|
6707
6743
|
};
|
|
6708
6744
|
};
|
|
6709
6745
|
|
|
6710
|
-
// src/server/postPurchaseReviewFields.ts
|
|
6711
|
-
var import_zod64 = require("zod");
|
|
6712
|
-
var Field = import_zod64.z.object({ key: import_zod64.z.string(), namespace: import_zod64.z.string(), value: import_zod64.z.unknown().optional() });
|
|
6713
|
-
var reviewFields = (raw) => {
|
|
6714
|
-
const fields4 = import_zod64.z.array(import_zod64.z.unknown()).parse(raw).flatMap((field) => {
|
|
6715
|
-
const parsed = Field.safeParse(field);
|
|
6716
|
-
return parsed.success ? [parsed.data] : [];
|
|
6717
|
-
});
|
|
6718
|
-
return (namespace, key) => fields4.find((field) => field.namespace === namespace && field.key === key);
|
|
6719
|
-
};
|
|
6720
|
-
|
|
6721
6746
|
// src/server/postPurchaseReviewProvider.ts
|
|
6722
6747
|
var import_zod65 = require("zod");
|
|
6723
6748
|
var IntegrationInput = import_zod65.z.record(import_zod65.z.string(), import_zod65.z.unknown()).prefault({});
|
|
@@ -6750,7 +6775,7 @@ var selectPostPurchaseReviewProvider = (raw) => {
|
|
|
6750
6775
|
};
|
|
6751
6776
|
|
|
6752
6777
|
// src/server/postPurchaseReviews.ts
|
|
6753
|
-
var projectPostPurchaseReviews = (settings, metafields, report) => {
|
|
6778
|
+
var projectPostPurchaseReviews = (settings, { id: productId2, metafields }, report) => {
|
|
6754
6779
|
try {
|
|
6755
6780
|
const provider = selectPostPurchaseReviewProvider(settings.integrations);
|
|
6756
6781
|
if (!provider || metafields == null) return null;
|
|
@@ -6766,8 +6791,15 @@ var projectPostPurchaseReviews = (settings, metafields, report) => {
|
|
|
6766
6791
|
strokeColor: styles2.starStrokeColor,
|
|
6767
6792
|
strokeWidth: styles2.strokeWidth
|
|
6768
6793
|
});
|
|
6769
|
-
} catch {
|
|
6770
|
-
report?.(
|
|
6794
|
+
} catch (error) {
|
|
6795
|
+
report?.(
|
|
6796
|
+
error instanceof ReviewFieldError ? {
|
|
6797
|
+
detail: "Unreadable post-purchase reviews metafield",
|
|
6798
|
+
field: error.field,
|
|
6799
|
+
kind: "reviews",
|
|
6800
|
+
productId: productId2
|
|
6801
|
+
} : { detail: "Unreadable post-purchase reviews", kind: "product" }
|
|
6802
|
+
);
|
|
6771
6803
|
return null;
|
|
6772
6804
|
}
|
|
6773
6805
|
};
|
|
@@ -6779,7 +6811,7 @@ var projectPostPurchaseProduct = ({ data, effective, metadata, original }, repor
|
|
|
6779
6811
|
return {
|
|
6780
6812
|
display: {
|
|
6781
6813
|
...projectPostPurchaseProductDisplay(effective, metadata, product),
|
|
6782
|
-
reviews: projectPostPurchaseReviews(effective, product
|
|
6814
|
+
reviews: projectPostPurchaseReviews(effective, product, report)
|
|
6783
6815
|
},
|
|
6784
6816
|
labels: effective.language.global,
|
|
6785
6817
|
product: { ...product, variant: variant2 },
|
|
@@ -6923,7 +6955,7 @@ var import_zod70 = require("zod");
|
|
|
6923
6955
|
var import_zod69 = require("zod");
|
|
6924
6956
|
var PostPurchaseVariantSelector = import_zod69.z.object({ variantId: PostPurchaseVariantId }).strict();
|
|
6925
6957
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
6926
|
-
id: import_zod69.z.number().int().positive(),
|
|
6958
|
+
id: import_zod69.z.number().int().positive().optional(),
|
|
6927
6959
|
position: import_zod69.z.number().int().min(1).max(3)
|
|
6928
6960
|
});
|
|
6929
6961
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
@@ -7370,7 +7402,7 @@ var projectPostPurchaseVariantCatalog = (product, settings) => {
|
|
|
7370
7402
|
...PostPurchaseVariantValues.partial().parse(variant2)
|
|
7371
7403
|
}));
|
|
7372
7404
|
const tuples = variants.map(({ option1, option2, option3 }) => [option1, option2, option3]);
|
|
7373
|
-
if (new Set(product.variants.map(({ id }) => id)).size !== product.variants.length || product.variants.some(({ productId: productId2 }) => productId2 !== product.id) ||
|
|
7405
|
+
if (new Set(product.variants.map(({ id }) => id)).size !== product.variants.length || product.variants.some(({ productId: productId2 }) => productId2 !== product.id) || options2.some(
|
|
7374
7406
|
({ position, values: values2 }, index) => position !== index + 1 || new Set(values2).size !== values2.length
|
|
7375
7407
|
) || product.variants.length > 1 && new Set(tuples.map((tuple) => JSON.stringify(tuple))).size !== tuples.length)
|
|
7376
7408
|
throw new Error("Ambiguous post-purchase variant catalog");
|
package/dist/server/index.mjs
CHANGED
|
@@ -6563,45 +6563,76 @@ var projectPostPurchaseProductDisplay = (effective, metadata, product) => PostPu
|
|
|
6563
6563
|
});
|
|
6564
6564
|
|
|
6565
6565
|
// src/server/postPurchaseReviewData.ts
|
|
6566
|
-
import { z as
|
|
6566
|
+
import { z as z64 } from "zod";
|
|
6567
6567
|
|
|
6568
6568
|
// src/server/postPurchaseJudgeMeReviews.ts
|
|
6569
|
+
import { z as z61 } from "zod";
|
|
6570
|
+
|
|
6571
|
+
// src/server/postPurchaseReviewFields.ts
|
|
6569
6572
|
import { z as z60 } from "zod";
|
|
6573
|
+
var Field = z60.object({ key: z60.string(), namespace: z60.string(), value: z60.unknown().optional() });
|
|
6574
|
+
var reviewFields = (raw) => {
|
|
6575
|
+
const fields4 = z60.array(z60.unknown()).parse(raw).flatMap((field) => {
|
|
6576
|
+
const parsed = Field.safeParse(field);
|
|
6577
|
+
return parsed.success ? [parsed.data] : [];
|
|
6578
|
+
});
|
|
6579
|
+
return (namespace, key) => fields4.find((field) => field.namespace === namespace && field.key === key);
|
|
6580
|
+
};
|
|
6581
|
+
var ReviewFieldError = class extends Error {
|
|
6582
|
+
constructor(field) {
|
|
6583
|
+
super(`Unreadable review field ${field}`);
|
|
6584
|
+
this.field = field;
|
|
6585
|
+
}
|
|
6586
|
+
};
|
|
6587
|
+
var readReviewField = (field, read) => {
|
|
6588
|
+
try {
|
|
6589
|
+
return read(field.value);
|
|
6590
|
+
} catch {
|
|
6591
|
+
throw new ReviewFieldError(`${field.namespace}.${field.key}`);
|
|
6592
|
+
}
|
|
6593
|
+
};
|
|
6594
|
+
|
|
6595
|
+
// src/server/postPurchaseJudgeMeReviews.ts
|
|
6570
6596
|
var readJudgeMeReviews = (find) => {
|
|
6571
6597
|
const field = find("judgeme", "badge");
|
|
6572
6598
|
if (!field) return null;
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6599
|
+
return readReviewField(field, (value) => {
|
|
6600
|
+
const html = z61.string().parse(value);
|
|
6601
|
+
const rating = html.match(/data-average-rating=['"](\d+(?:\.\d+)?)['"]/);
|
|
6602
|
+
const count = html.match(/data-number-of-reviews=['"](\d+)['"]/);
|
|
6603
|
+
if (!rating || !count) throw new Error("Unreadable Judge.me attributes");
|
|
6604
|
+
return {
|
|
6605
|
+
rating: PostPurchaseCommonReviewRating.parse({ value: rating[1] }).value,
|
|
6606
|
+
reviewCount: PostPurchaseReviewCount.parse(count[1])
|
|
6607
|
+
};
|
|
6608
|
+
});
|
|
6581
6609
|
};
|
|
6582
6610
|
|
|
6583
6611
|
// src/server/postPurchaseOkendoReviews.ts
|
|
6584
|
-
import { z as
|
|
6585
|
-
var Summary =
|
|
6612
|
+
import { z as z62 } from "zod";
|
|
6613
|
+
var Summary = z62.object({
|
|
6586
6614
|
reviewAverageValue: PostPurchaseCommonReviewRating.shape.value,
|
|
6587
|
-
reviewCount:
|
|
6615
|
+
reviewCount: z62.union([PostPurchaseProductReviews.shape.reviewCount, PostPurchaseReviewCount])
|
|
6588
6616
|
});
|
|
6589
6617
|
var readOkendoReviews = (find) => {
|
|
6590
6618
|
const field = find("okendo", "summaryData");
|
|
6591
6619
|
if (!field) return null;
|
|
6592
|
-
const summary = Summary.parse(JSON.parse(
|
|
6620
|
+
const summary = readReviewField(field, (value) => Summary.parse(JSON.parse(z62.string().parse(value))));
|
|
6593
6621
|
return { rating: summary.reviewAverageValue, reviewCount: summary.reviewCount };
|
|
6594
6622
|
};
|
|
6595
6623
|
|
|
6596
6624
|
// src/server/postPurchaseScalarReviews.ts
|
|
6597
|
-
import { z as
|
|
6625
|
+
import { z as z63 } from "zod";
|
|
6598
6626
|
var readScalarReviews = (find, namespace, ratingKey, countKey) => {
|
|
6599
6627
|
const rating = find(namespace, ratingKey);
|
|
6600
6628
|
const count = find(namespace, countKey);
|
|
6601
6629
|
if (!rating || !count) return null;
|
|
6602
6630
|
return {
|
|
6603
|
-
rating:
|
|
6604
|
-
|
|
6631
|
+
rating: readReviewField(
|
|
6632
|
+
rating,
|
|
6633
|
+
(value) => PostPurchaseCommonReviewRating.parse({ value: z63.string().parse(value) }).value
|
|
6634
|
+
),
|
|
6635
|
+
reviewCount: readReviewField(count, (value) => PostPurchaseReviewCount.parse(value))
|
|
6605
6636
|
};
|
|
6606
6637
|
};
|
|
6607
6638
|
|
|
@@ -6610,10 +6641,12 @@ var readStandardReviews = (find) => {
|
|
|
6610
6641
|
const rating = find("reviews", "rating");
|
|
6611
6642
|
const count = find("reviews", "rating_count");
|
|
6612
6643
|
if (!rating || !count) return null;
|
|
6613
|
-
const value = z63.string().parse(rating.value);
|
|
6614
6644
|
return {
|
|
6615
|
-
rating:
|
|
6616
|
-
|
|
6645
|
+
rating: readReviewField(rating, (raw) => {
|
|
6646
|
+
const value = z64.string().parse(raw);
|
|
6647
|
+
return PostPurchaseCommonReviewRating.parse(/^\d+(?:\.\d+)?$/.test(value) ? { value } : JSON.parse(value)).value;
|
|
6648
|
+
}),
|
|
6649
|
+
reviewCount: readReviewField(count, (value) => PostPurchaseReviewCount.parse(value))
|
|
6617
6650
|
};
|
|
6618
6651
|
};
|
|
6619
6652
|
var readPostPurchaseReviewData = (provider, find) => {
|
|
@@ -6630,22 +6663,14 @@ var readPostPurchaseReviewData = (provider, find) => {
|
|
|
6630
6663
|
const count = find("reviews", "rating_count");
|
|
6631
6664
|
if (!rating || !count) return null;
|
|
6632
6665
|
return {
|
|
6633
|
-
rating:
|
|
6634
|
-
|
|
6666
|
+
rating: readReviewField(
|
|
6667
|
+
rating,
|
|
6668
|
+
(value) => PostPurchaseKlaviyoReviewRating.parse(JSON.parse(z64.string().parse(value))).value
|
|
6669
|
+
),
|
|
6670
|
+
reviewCount: readReviewField(count, (value) => PostPurchaseReviewCount.parse(value))
|
|
6635
6671
|
};
|
|
6636
6672
|
};
|
|
6637
6673
|
|
|
6638
|
-
// src/server/postPurchaseReviewFields.ts
|
|
6639
|
-
import { z as z64 } from "zod";
|
|
6640
|
-
var Field = z64.object({ key: z64.string(), namespace: z64.string(), value: z64.unknown().optional() });
|
|
6641
|
-
var reviewFields = (raw) => {
|
|
6642
|
-
const fields4 = z64.array(z64.unknown()).parse(raw).flatMap((field) => {
|
|
6643
|
-
const parsed = Field.safeParse(field);
|
|
6644
|
-
return parsed.success ? [parsed.data] : [];
|
|
6645
|
-
});
|
|
6646
|
-
return (namespace, key) => fields4.find((field) => field.namespace === namespace && field.key === key);
|
|
6647
|
-
};
|
|
6648
|
-
|
|
6649
6674
|
// src/server/postPurchaseReviewProvider.ts
|
|
6650
6675
|
import { z as z65 } from "zod";
|
|
6651
6676
|
var IntegrationInput = z65.record(z65.string(), z65.unknown()).prefault({});
|
|
@@ -6678,7 +6703,7 @@ var selectPostPurchaseReviewProvider = (raw) => {
|
|
|
6678
6703
|
};
|
|
6679
6704
|
|
|
6680
6705
|
// src/server/postPurchaseReviews.ts
|
|
6681
|
-
var projectPostPurchaseReviews = (settings, metafields, report) => {
|
|
6706
|
+
var projectPostPurchaseReviews = (settings, { id: productId2, metafields }, report) => {
|
|
6682
6707
|
try {
|
|
6683
6708
|
const provider = selectPostPurchaseReviewProvider(settings.integrations);
|
|
6684
6709
|
if (!provider || metafields == null) return null;
|
|
@@ -6694,8 +6719,15 @@ var projectPostPurchaseReviews = (settings, metafields, report) => {
|
|
|
6694
6719
|
strokeColor: styles2.starStrokeColor,
|
|
6695
6720
|
strokeWidth: styles2.strokeWidth
|
|
6696
6721
|
});
|
|
6697
|
-
} catch {
|
|
6698
|
-
report?.(
|
|
6722
|
+
} catch (error) {
|
|
6723
|
+
report?.(
|
|
6724
|
+
error instanceof ReviewFieldError ? {
|
|
6725
|
+
detail: "Unreadable post-purchase reviews metafield",
|
|
6726
|
+
field: error.field,
|
|
6727
|
+
kind: "reviews",
|
|
6728
|
+
productId: productId2
|
|
6729
|
+
} : { detail: "Unreadable post-purchase reviews", kind: "product" }
|
|
6730
|
+
);
|
|
6699
6731
|
return null;
|
|
6700
6732
|
}
|
|
6701
6733
|
};
|
|
@@ -6707,7 +6739,7 @@ var projectPostPurchaseProduct = ({ data, effective, metadata, original }, repor
|
|
|
6707
6739
|
return {
|
|
6708
6740
|
display: {
|
|
6709
6741
|
...projectPostPurchaseProductDisplay(effective, metadata, product),
|
|
6710
|
-
reviews: projectPostPurchaseReviews(effective, product
|
|
6742
|
+
reviews: projectPostPurchaseReviews(effective, product, report)
|
|
6711
6743
|
},
|
|
6712
6744
|
labels: effective.language.global,
|
|
6713
6745
|
product: { ...product, variant: variant2 },
|
|
@@ -6851,7 +6883,7 @@ import { z as z70 } from "zod";
|
|
|
6851
6883
|
import { z as z69 } from "zod";
|
|
6852
6884
|
var PostPurchaseVariantSelector = z69.object({ variantId: PostPurchaseVariantId }).strict();
|
|
6853
6885
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
6854
|
-
id: z69.number().int().positive(),
|
|
6886
|
+
id: z69.number().int().positive().optional(),
|
|
6855
6887
|
position: z69.number().int().min(1).max(3)
|
|
6856
6888
|
});
|
|
6857
6889
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
@@ -7298,7 +7330,7 @@ var projectPostPurchaseVariantCatalog = (product, settings) => {
|
|
|
7298
7330
|
...PostPurchaseVariantValues.partial().parse(variant2)
|
|
7299
7331
|
}));
|
|
7300
7332
|
const tuples = variants.map(({ option1, option2, option3 }) => [option1, option2, option3]);
|
|
7301
|
-
if (new Set(product.variants.map(({ id }) => id)).size !== product.variants.length || product.variants.some(({ productId: productId2 }) => productId2 !== product.id) ||
|
|
7333
|
+
if (new Set(product.variants.map(({ id }) => id)).size !== product.variants.length || product.variants.some(({ productId: productId2 }) => productId2 !== product.id) || options2.some(
|
|
7302
7334
|
({ position, values: values2 }, index) => position !== index + 1 || new Set(values2).size !== values2.length
|
|
7303
7335
|
) || product.variants.length > 1 && new Set(tuples.map((tuple) => JSON.stringify(tuple))).size !== tuples.length)
|
|
7304
7336
|
throw new Error("Ambiguous post-purchase variant catalog");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReviewFields } from '../server/postPurchaseReviewFields';
|
|
2
2
|
/** Read attributes only; merchant badge HTML never enters the prepared display or section tree. */
|
|
3
3
|
export declare const readJudgeMeReviews: (find: ReviewFields) => {
|
|
4
4
|
rating: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReviewFields } from '../server/postPurchaseReviewFields';
|
|
2
2
|
/** Only the selected aggregate's two numeric members enter the prepared review display. */
|
|
3
3
|
export declare const readOkendoReviews: (find: ReviewFields) => {
|
|
4
4
|
rating: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReviewFields } from '../server/postPurchaseReviewFields';
|
|
2
2
|
import type { selectPostPurchaseReviewProvider } from '../server/postPurchaseReviewProvider';
|
|
3
3
|
/**
|
|
4
4
|
* Selection is complete before reading data; a missing selected aggregate cannot fall through. Reviews.io reading
|
|
@@ -5,3 +5,10 @@ export declare const reviewFields: (raw: unknown) => (namespace: string, key: st
|
|
|
5
5
|
value?: unknown;
|
|
6
6
|
} | undefined;
|
|
7
7
|
export type ReviewFields = ReturnType<typeof reviewFields>;
|
|
8
|
+
/** A selected review field whose value failed its read. It names the field (`namespace.key`), never the value. */
|
|
9
|
+
export declare class ReviewFieldError extends Error {
|
|
10
|
+
readonly field: string;
|
|
11
|
+
constructor(field: string);
|
|
12
|
+
}
|
|
13
|
+
/** Reads one matched field's value; any failure is rethrown naming only that field. */
|
|
14
|
+
export declare const readReviewField: <T>(field: NonNullable<ReturnType<ReviewFields>>, read: (value: unknown) => T) => T;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { PostPurchaseProductReviews } from '../schema/postPurchaseProductReviews';
|
|
2
2
|
import type { PostPurchaseProductSettings } from '../schema/postPurchaseProductSettings';
|
|
3
3
|
import type { Reporter } from '../server/shared';
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Reviews are optional display data; neither missing nor malformed aggregates invalidate the offer. A malformed
|
|
6
|
+
* selected review field reports `reviews` drift naming the product and the field (`namespace.key`, never the
|
|
7
|
+
* value); unreadable flags, metafield containers, styles or output stay sanitized `product` drift.
|
|
8
|
+
*/
|
|
9
|
+
export declare const projectPostPurchaseReviews: (settings: PostPurchaseProductSettings, { id: productId, metafields }: {
|
|
10
|
+
id: number;
|
|
11
|
+
metafields?: unknown;
|
|
12
|
+
}, report?: Reporter) => PostPurchaseProductReviews | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReviewFields } from '../server/postPurchaseReviewFields';
|
|
2
2
|
/** Pair absence is ordinary; invalid selected values throw to the single local recovery boundary. */
|
|
3
3
|
export declare const readScalarReviews: (find: ReviewFields, namespace: string, ratingKey: string, countKey: string) => {
|
|
4
4
|
rating: number;
|
|
@@ -326,8 +326,8 @@ export declare const preparePostPurchaseAdmissionView: (widgetId: number, settin
|
|
|
326
326
|
options: {
|
|
327
327
|
name: string;
|
|
328
328
|
values: string[];
|
|
329
|
-
id: number;
|
|
330
329
|
position: number;
|
|
330
|
+
id?: number | undefined;
|
|
331
331
|
}[];
|
|
332
332
|
productId: number;
|
|
333
333
|
showSelectors: boolean;
|
|
@@ -377,8 +377,8 @@ export declare const preparePostPurchaseAdmissionView: (widgetId: number, settin
|
|
|
377
377
|
options: {
|
|
378
378
|
name: string;
|
|
379
379
|
values: string[];
|
|
380
|
-
id: number;
|
|
381
380
|
position: number;
|
|
381
|
+
id?: number | undefined;
|
|
382
382
|
}[];
|
|
383
383
|
productId: number;
|
|
384
384
|
showSelectors: boolean;
|
|
@@ -531,8 +531,8 @@ export declare const preparePostPurchaseAdmissionView: (widgetId: number, settin
|
|
|
531
531
|
options: {
|
|
532
532
|
name: string;
|
|
533
533
|
values: string[];
|
|
534
|
-
id: number;
|
|
535
534
|
position: number;
|
|
535
|
+
id?: number | undefined;
|
|
536
536
|
}[];
|
|
537
537
|
productId: number;
|
|
538
538
|
showSelectors: boolean;
|
|
@@ -585,8 +585,8 @@ export declare const preparePostPurchaseAdmissionView: (widgetId: number, settin
|
|
|
585
585
|
options: {
|
|
586
586
|
name: string;
|
|
587
587
|
values: string[];
|
|
588
|
-
id: number;
|
|
589
588
|
position: number;
|
|
589
|
+
id?: number | undefined;
|
|
590
590
|
}[];
|
|
591
591
|
productId: number;
|
|
592
592
|
showSelectors: boolean;
|
|
@@ -24,8 +24,8 @@ export declare const preparePostPurchaseCollectionGroup: (widgetId: number, sett
|
|
|
24
24
|
options: {
|
|
25
25
|
name: string;
|
|
26
26
|
values: string[];
|
|
27
|
-
id: number;
|
|
28
27
|
position: number;
|
|
28
|
+
id?: number | undefined;
|
|
29
29
|
}[];
|
|
30
30
|
productId: number;
|
|
31
31
|
showSelectors: boolean;
|
|
@@ -387,8 +387,8 @@ export declare const preparePostPurchaseCollectionGroup: (widgetId: number, sett
|
|
|
387
387
|
options: {
|
|
388
388
|
name: string;
|
|
389
389
|
values: string[];
|
|
390
|
-
id: number;
|
|
391
390
|
position: number;
|
|
391
|
+
id?: number | undefined;
|
|
392
392
|
}[];
|
|
393
393
|
productId: number;
|
|
394
394
|
showSelectors: boolean;
|
|
@@ -414,8 +414,8 @@ export declare const preparePostPurchaseCollectionGroup: (widgetId: number, sett
|
|
|
414
414
|
options: {
|
|
415
415
|
name: string;
|
|
416
416
|
values: string[];
|
|
417
|
-
id: number;
|
|
418
417
|
position: number;
|
|
418
|
+
id?: number | undefined;
|
|
419
419
|
}[];
|
|
420
420
|
productId: number;
|
|
421
421
|
showSelectors: boolean;
|
|
@@ -596,8 +596,8 @@ export declare const preparePostPurchaseCollectionGroup: (widgetId: number, sett
|
|
|
596
596
|
options: {
|
|
597
597
|
name: string;
|
|
598
598
|
values: string[];
|
|
599
|
-
id: number;
|
|
600
599
|
position: number;
|
|
600
|
+
id?: number | undefined;
|
|
601
601
|
}[];
|
|
602
602
|
productId: number;
|
|
603
603
|
showSelectors: boolean;
|
|
@@ -622,8 +622,8 @@ export declare const preparePostPurchaseCollectionGroup: (widgetId: number, sett
|
|
|
622
622
|
options: {
|
|
623
623
|
name: string;
|
|
624
624
|
values: string[];
|
|
625
|
-
id: number;
|
|
626
625
|
position: number;
|
|
626
|
+
id?: number | undefined;
|
|
627
627
|
}[];
|
|
628
628
|
productId: number;
|
|
629
629
|
showSelectors: boolean;
|
|
@@ -348,8 +348,8 @@ export declare const preparePostPurchaseCollectionView: (widgetId: number, setti
|
|
|
348
348
|
options: {
|
|
349
349
|
name: string;
|
|
350
350
|
values: string[];
|
|
351
|
-
id: number;
|
|
352
351
|
position: number;
|
|
352
|
+
id?: number | undefined;
|
|
353
353
|
}[];
|
|
354
354
|
productId: number;
|
|
355
355
|
showSelectors: boolean;
|
|
@@ -399,8 +399,8 @@ export declare const preparePostPurchaseCollectionView: (widgetId: number, setti
|
|
|
399
399
|
options: {
|
|
400
400
|
name: string;
|
|
401
401
|
values: string[];
|
|
402
|
-
id: number;
|
|
403
402
|
position: number;
|
|
403
|
+
id?: number | undefined;
|
|
404
404
|
}[];
|
|
405
405
|
productId: number;
|
|
406
406
|
showSelectors: boolean;
|
|
@@ -553,8 +553,8 @@ export declare const preparePostPurchaseCollectionView: (widgetId: number, setti
|
|
|
553
553
|
options: {
|
|
554
554
|
name: string;
|
|
555
555
|
values: string[];
|
|
556
|
-
id: number;
|
|
557
556
|
position: number;
|
|
557
|
+
id?: number | undefined;
|
|
558
558
|
}[];
|
|
559
559
|
productId: number;
|
|
560
560
|
showSelectors: boolean;
|
|
@@ -607,8 +607,8 @@ export declare const preparePostPurchaseCollectionView: (widgetId: number, setti
|
|
|
607
607
|
options: {
|
|
608
608
|
name: string;
|
|
609
609
|
values: string[];
|
|
610
|
-
id: number;
|
|
611
610
|
position: number;
|
|
611
|
+
id?: number | undefined;
|
|
612
612
|
}[];
|
|
613
613
|
productId: number;
|
|
614
614
|
showSelectors: boolean;
|
|
@@ -13,8 +13,8 @@ export declare const preparePostPurchaseGroupAdmissionView: (widgetId: number, s
|
|
|
13
13
|
options: {
|
|
14
14
|
name: string;
|
|
15
15
|
values: string[];
|
|
16
|
-
id: number;
|
|
17
16
|
position: number;
|
|
17
|
+
id?: number | undefined;
|
|
18
18
|
}[];
|
|
19
19
|
productId: number;
|
|
20
20
|
showSelectors: boolean;
|
|
@@ -367,8 +367,8 @@ export declare const preparePostPurchaseGroupAdmissionView: (widgetId: number, s
|
|
|
367
367
|
options: {
|
|
368
368
|
name: string;
|
|
369
369
|
values: string[];
|
|
370
|
-
id: number;
|
|
371
370
|
position: number;
|
|
371
|
+
id?: number | undefined;
|
|
372
372
|
}[];
|
|
373
373
|
productId: number;
|
|
374
374
|
showSelectors: boolean;
|
|
@@ -418,8 +418,8 @@ export declare const preparePostPurchaseGroupAdmissionView: (widgetId: number, s
|
|
|
418
418
|
options: {
|
|
419
419
|
name: string;
|
|
420
420
|
values: string[];
|
|
421
|
-
id: number;
|
|
422
421
|
position: number;
|
|
422
|
+
id?: number | undefined;
|
|
423
423
|
}[];
|
|
424
424
|
productId: number;
|
|
425
425
|
showSelectors: boolean;
|
|
@@ -572,8 +572,8 @@ export declare const preparePostPurchaseGroupAdmissionView: (widgetId: number, s
|
|
|
572
572
|
options: {
|
|
573
573
|
name: string;
|
|
574
574
|
values: string[];
|
|
575
|
-
id: number;
|
|
576
575
|
position: number;
|
|
576
|
+
id?: number | undefined;
|
|
577
577
|
}[];
|
|
578
578
|
productId: number;
|
|
579
579
|
showSelectors: boolean;
|
|
@@ -626,8 +626,8 @@ export declare const preparePostPurchaseGroupAdmissionView: (widgetId: number, s
|
|
|
626
626
|
options: {
|
|
627
627
|
name: string;
|
|
628
628
|
values: string[];
|
|
629
|
-
id: number;
|
|
630
629
|
position: number;
|
|
630
|
+
id?: number | undefined;
|
|
631
631
|
}[];
|
|
632
632
|
productId: number;
|
|
633
633
|
showSelectors: boolean;
|
|
@@ -330,8 +330,8 @@ export declare const preparePostPurchaseGroupDefault: (widgetId: number, setting
|
|
|
330
330
|
options: {
|
|
331
331
|
name: string;
|
|
332
332
|
values: string[];
|
|
333
|
-
id: number;
|
|
334
333
|
position: number;
|
|
334
|
+
id?: number | undefined;
|
|
335
335
|
}[];
|
|
336
336
|
productId: number;
|
|
337
337
|
showSelectors: boolean;
|
|
@@ -378,8 +378,8 @@ export declare const preparePostPurchaseGroupDefault: (widgetId: number, setting
|
|
|
378
378
|
options: {
|
|
379
379
|
name: string;
|
|
380
380
|
values: string[];
|
|
381
|
-
id: number;
|
|
382
381
|
position: number;
|
|
382
|
+
id?: number | undefined;
|
|
383
383
|
}[];
|
|
384
384
|
productId: number;
|
|
385
385
|
showSelectors: boolean;
|
|
@@ -535,8 +535,8 @@ export declare const preparePostPurchaseGroupDefault: (widgetId: number, setting
|
|
|
535
535
|
options: {
|
|
536
536
|
name: string;
|
|
537
537
|
values: string[];
|
|
538
|
-
id: number;
|
|
539
538
|
position: number;
|
|
539
|
+
id?: number | undefined;
|
|
540
540
|
}[];
|
|
541
541
|
productId: number;
|
|
542
542
|
showSelectors: boolean;
|
|
@@ -586,8 +586,8 @@ export declare const preparePostPurchaseGroupDefault: (widgetId: number, setting
|
|
|
586
586
|
options: {
|
|
587
587
|
name: string;
|
|
588
588
|
values: string[];
|
|
589
|
-
id: number;
|
|
590
589
|
position: number;
|
|
590
|
+
id?: number | undefined;
|
|
591
591
|
}[];
|
|
592
592
|
productId: number;
|
|
593
593
|
showSelectors: boolean;
|
|
@@ -612,8 +612,8 @@ export declare const preparePostPurchaseGroupDefault: (widgetId: number, setting
|
|
|
612
612
|
options: {
|
|
613
613
|
name: string;
|
|
614
614
|
values: string[];
|
|
615
|
-
id: number;
|
|
616
615
|
position: number;
|
|
616
|
+
id?: number | undefined;
|
|
617
617
|
}[];
|
|
618
618
|
productId: number;
|
|
619
619
|
showSelectors: boolean;
|
|
@@ -13,8 +13,8 @@ export declare const preparePostPurchaseGroupView: (widgetId: number, settings:
|
|
|
13
13
|
options: {
|
|
14
14
|
name: string;
|
|
15
15
|
values: string[];
|
|
16
|
-
id: number;
|
|
17
16
|
position: number;
|
|
17
|
+
id?: number | undefined;
|
|
18
18
|
}[];
|
|
19
19
|
productId: number;
|
|
20
20
|
showSelectors: boolean;
|
|
@@ -366,8 +366,8 @@ export declare const preparePostPurchaseGroupView: (widgetId: number, settings:
|
|
|
366
366
|
options: {
|
|
367
367
|
name: string;
|
|
368
368
|
values: string[];
|
|
369
|
-
id: number;
|
|
370
369
|
position: number;
|
|
370
|
+
id?: number | undefined;
|
|
371
371
|
}[];
|
|
372
372
|
productId: number;
|
|
373
373
|
showSelectors: boolean;
|
|
@@ -417,8 +417,8 @@ export declare const preparePostPurchaseGroupView: (widgetId: number, settings:
|
|
|
417
417
|
options: {
|
|
418
418
|
name: string;
|
|
419
419
|
values: string[];
|
|
420
|
-
id: number;
|
|
421
420
|
position: number;
|
|
421
|
+
id?: number | undefined;
|
|
422
422
|
}[];
|
|
423
423
|
productId: number;
|
|
424
424
|
showSelectors: boolean;
|
|
@@ -571,8 +571,8 @@ export declare const preparePostPurchaseGroupView: (widgetId: number, settings:
|
|
|
571
571
|
options: {
|
|
572
572
|
name: string;
|
|
573
573
|
values: string[];
|
|
574
|
-
id: number;
|
|
575
574
|
position: number;
|
|
575
|
+
id?: number | undefined;
|
|
576
576
|
}[];
|
|
577
577
|
productId: number;
|
|
578
578
|
showSelectors: boolean;
|
|
@@ -625,8 +625,8 @@ export declare const preparePostPurchaseGroupView: (widgetId: number, settings:
|
|
|
625
625
|
options: {
|
|
626
626
|
name: string;
|
|
627
627
|
values: string[];
|
|
628
|
-
id: number;
|
|
629
628
|
position: number;
|
|
629
|
+
id?: number | undefined;
|
|
630
630
|
}[];
|
|
631
631
|
productId: number;
|
|
632
632
|
showSelectors: boolean;
|
|
@@ -329,8 +329,8 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
|
|
|
329
329
|
options: {
|
|
330
330
|
name: string;
|
|
331
331
|
values: string[];
|
|
332
|
-
id: number;
|
|
333
332
|
position: number;
|
|
333
|
+
id?: number | undefined;
|
|
334
334
|
}[];
|
|
335
335
|
productId: number;
|
|
336
336
|
showSelectors: boolean;
|
|
@@ -380,8 +380,8 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
|
|
|
380
380
|
options: {
|
|
381
381
|
name: string;
|
|
382
382
|
values: string[];
|
|
383
|
-
id: number;
|
|
384
383
|
position: number;
|
|
384
|
+
id?: number | undefined;
|
|
385
385
|
}[];
|
|
386
386
|
productId: number;
|
|
387
387
|
showSelectors: boolean;
|
|
@@ -534,8 +534,8 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
|
|
|
534
534
|
options: {
|
|
535
535
|
name: string;
|
|
536
536
|
values: string[];
|
|
537
|
-
id: number;
|
|
538
537
|
position: number;
|
|
538
|
+
id?: number | undefined;
|
|
539
539
|
}[];
|
|
540
540
|
productId: number;
|
|
541
541
|
showSelectors: boolean;
|
|
@@ -588,8 +588,8 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
|
|
|
588
588
|
options: {
|
|
589
589
|
name: string;
|
|
590
590
|
values: string[];
|
|
591
|
-
id: number;
|
|
592
591
|
position: number;
|
|
592
|
+
id?: number | undefined;
|
|
593
593
|
}[];
|
|
594
594
|
productId: number;
|
|
595
595
|
showSelectors: boolean;
|
|
@@ -1142,8 +1142,8 @@ export declare const preparePostPurchaseMemberView: (widgetId: number, settings:
|
|
|
1142
1142
|
options: {
|
|
1143
1143
|
name: string;
|
|
1144
1144
|
values: string[];
|
|
1145
|
-
id: number;
|
|
1146
1145
|
position: number;
|
|
1146
|
+
id?: number | undefined;
|
|
1147
1147
|
}[];
|
|
1148
1148
|
productId: number;
|
|
1149
1149
|
showSelectors: boolean;
|
|
@@ -1193,8 +1193,8 @@ export declare const preparePostPurchaseMemberView: (widgetId: number, settings:
|
|
|
1193
1193
|
options: {
|
|
1194
1194
|
name: string;
|
|
1195
1195
|
values: string[];
|
|
1196
|
-
id: number;
|
|
1197
1196
|
position: number;
|
|
1197
|
+
id?: number | undefined;
|
|
1198
1198
|
}[];
|
|
1199
1199
|
productId: number;
|
|
1200
1200
|
showSelectors: boolean;
|
|
@@ -1347,8 +1347,8 @@ export declare const preparePostPurchaseMemberView: (widgetId: number, settings:
|
|
|
1347
1347
|
options: {
|
|
1348
1348
|
name: string;
|
|
1349
1349
|
values: string[];
|
|
1350
|
-
id: number;
|
|
1351
1350
|
position: number;
|
|
1351
|
+
id?: number | undefined;
|
|
1352
1352
|
}[];
|
|
1353
1353
|
productId: number;
|
|
1354
1354
|
showSelectors: boolean;
|
|
@@ -1401,8 +1401,8 @@ export declare const preparePostPurchaseMemberView: (widgetId: number, settings:
|
|
|
1401
1401
|
options: {
|
|
1402
1402
|
name: string;
|
|
1403
1403
|
values: string[];
|
|
1404
|
-
id: number;
|
|
1405
1404
|
position: number;
|
|
1405
|
+
id?: number | undefined;
|
|
1406
1406
|
}[];
|
|
1407
1407
|
productId: number;
|
|
1408
1408
|
showSelectors: boolean;
|
|
@@ -1746,8 +1746,8 @@ export declare const preparePostPurchaseMemberAdmissionView: (widgetId: number,
|
|
|
1746
1746
|
options: {
|
|
1747
1747
|
name: string;
|
|
1748
1748
|
values: string[];
|
|
1749
|
-
id: number;
|
|
1750
1749
|
position: number;
|
|
1750
|
+
id?: number | undefined;
|
|
1751
1751
|
}[];
|
|
1752
1752
|
productId: number;
|
|
1753
1753
|
showSelectors: boolean;
|
|
@@ -1797,8 +1797,8 @@ export declare const preparePostPurchaseMemberAdmissionView: (widgetId: number,
|
|
|
1797
1797
|
options: {
|
|
1798
1798
|
name: string;
|
|
1799
1799
|
values: string[];
|
|
1800
|
-
id: number;
|
|
1801
1800
|
position: number;
|
|
1801
|
+
id?: number | undefined;
|
|
1802
1802
|
}[];
|
|
1803
1803
|
productId: number;
|
|
1804
1804
|
showSelectors: boolean;
|
|
@@ -1951,8 +1951,8 @@ export declare const preparePostPurchaseMemberAdmissionView: (widgetId: number,
|
|
|
1951
1951
|
options: {
|
|
1952
1952
|
name: string;
|
|
1953
1953
|
values: string[];
|
|
1954
|
-
id: number;
|
|
1955
1954
|
position: number;
|
|
1955
|
+
id?: number | undefined;
|
|
1956
1956
|
}[];
|
|
1957
1957
|
productId: number;
|
|
1958
1958
|
showSelectors: boolean;
|
|
@@ -2005,8 +2005,8 @@ export declare const preparePostPurchaseMemberAdmissionView: (widgetId: number,
|
|
|
2005
2005
|
options: {
|
|
2006
2006
|
name: string;
|
|
2007
2007
|
values: string[];
|
|
2008
|
-
id: number;
|
|
2009
2008
|
position: number;
|
|
2009
|
+
id?: number | undefined;
|
|
2010
2010
|
}[];
|
|
2011
2011
|
productId: number;
|
|
2012
2012
|
showSelectors: boolean;
|
|
@@ -347,8 +347,8 @@ export declare const preparePostPurchaseQuantityAdmissionView: (widgetId: number
|
|
|
347
347
|
options: {
|
|
348
348
|
name: string;
|
|
349
349
|
values: string[];
|
|
350
|
-
id: number;
|
|
351
350
|
position: number;
|
|
351
|
+
id?: number | undefined;
|
|
352
352
|
}[];
|
|
353
353
|
productId: number;
|
|
354
354
|
showSelectors: boolean;
|
|
@@ -398,8 +398,8 @@ export declare const preparePostPurchaseQuantityAdmissionView: (widgetId: number
|
|
|
398
398
|
options: {
|
|
399
399
|
name: string;
|
|
400
400
|
values: string[];
|
|
401
|
-
id: number;
|
|
402
401
|
position: number;
|
|
402
|
+
id?: number | undefined;
|
|
403
403
|
}[];
|
|
404
404
|
productId: number;
|
|
405
405
|
showSelectors: boolean;
|
|
@@ -552,8 +552,8 @@ export declare const preparePostPurchaseQuantityAdmissionView: (widgetId: number
|
|
|
552
552
|
options: {
|
|
553
553
|
name: string;
|
|
554
554
|
values: string[];
|
|
555
|
-
id: number;
|
|
556
555
|
position: number;
|
|
556
|
+
id?: number | undefined;
|
|
557
557
|
}[];
|
|
558
558
|
productId: number;
|
|
559
559
|
showSelectors: boolean;
|
|
@@ -606,8 +606,8 @@ export declare const preparePostPurchaseQuantityAdmissionView: (widgetId: number
|
|
|
606
606
|
options: {
|
|
607
607
|
name: string;
|
|
608
608
|
values: string[];
|
|
609
|
-
id: number;
|
|
610
609
|
position: number;
|
|
610
|
+
id?: number | undefined;
|
|
611
611
|
}[];
|
|
612
612
|
productId: number;
|
|
613
613
|
showSelectors: boolean;
|
|
@@ -335,8 +335,8 @@ export declare const preparePostPurchaseQuantityView: (widgetId: number, setting
|
|
|
335
335
|
options: {
|
|
336
336
|
name: string;
|
|
337
337
|
values: string[];
|
|
338
|
-
id: number;
|
|
339
338
|
position: number;
|
|
339
|
+
id?: number | undefined;
|
|
340
340
|
}[];
|
|
341
341
|
productId: number;
|
|
342
342
|
showSelectors: boolean;
|
|
@@ -386,8 +386,8 @@ export declare const preparePostPurchaseQuantityView: (widgetId: number, setting
|
|
|
386
386
|
options: {
|
|
387
387
|
name: string;
|
|
388
388
|
values: string[];
|
|
389
|
-
id: number;
|
|
390
389
|
position: number;
|
|
390
|
+
id?: number | undefined;
|
|
391
391
|
}[];
|
|
392
392
|
productId: number;
|
|
393
393
|
showSelectors: boolean;
|
|
@@ -540,8 +540,8 @@ export declare const preparePostPurchaseQuantityView: (widgetId: number, setting
|
|
|
540
540
|
options: {
|
|
541
541
|
name: string;
|
|
542
542
|
values: string[];
|
|
543
|
-
id: number;
|
|
544
543
|
position: number;
|
|
544
|
+
id?: number | undefined;
|
|
545
545
|
}[];
|
|
546
546
|
productId: number;
|
|
547
547
|
showSelectors: boolean;
|
|
@@ -594,8 +594,8 @@ export declare const preparePostPurchaseQuantityView: (widgetId: number, setting
|
|
|
594
594
|
options: {
|
|
595
595
|
name: string;
|
|
596
596
|
values: string[];
|
|
597
|
-
id: number;
|
|
598
597
|
position: number;
|
|
598
|
+
id?: number | undefined;
|
|
599
599
|
}[];
|
|
600
600
|
productId: number;
|
|
601
601
|
showSelectors: boolean;
|
|
@@ -12,8 +12,8 @@ export declare const readPostPurchaseGroup: (product: ReturnType<typeof normaliz
|
|
|
12
12
|
options: {
|
|
13
13
|
name: string;
|
|
14
14
|
values: string[];
|
|
15
|
-
id: number;
|
|
16
15
|
position: number;
|
|
16
|
+
id?: number | undefined;
|
|
17
17
|
}[];
|
|
18
18
|
productId: number;
|
|
19
19
|
showSelectors: boolean;
|
|
@@ -61,8 +61,8 @@ export declare const readPostPurchaseGroup: (product: ReturnType<typeof normaliz
|
|
|
61
61
|
options: {
|
|
62
62
|
name: string;
|
|
63
63
|
values: string[];
|
|
64
|
-
id: number;
|
|
65
64
|
position: number;
|
|
65
|
+
id?: number | undefined;
|
|
66
66
|
}[];
|
|
67
67
|
sellingPlanGroups: {
|
|
68
68
|
requiresSellingPlan: boolean;
|
|
@@ -82,8 +82,8 @@ export declare const readPostPurchaseGroup: (product: ReturnType<typeof normaliz
|
|
|
82
82
|
options: {
|
|
83
83
|
name: string;
|
|
84
84
|
values: string[];
|
|
85
|
-
id: number;
|
|
86
85
|
position: number;
|
|
86
|
+
id?: number | undefined;
|
|
87
87
|
}[];
|
|
88
88
|
productId: number;
|
|
89
89
|
showSelectors: boolean;
|
|
@@ -12,8 +12,8 @@ export declare const readPostPurchaseGroupSelection: (settings: unknown, respons
|
|
|
12
12
|
options: {
|
|
13
13
|
name: string;
|
|
14
14
|
values: string[];
|
|
15
|
-
id: number;
|
|
16
15
|
position: number;
|
|
16
|
+
id?: number | undefined;
|
|
17
17
|
}[];
|
|
18
18
|
productId: number;
|
|
19
19
|
showSelectors: boolean;
|
|
@@ -67,8 +67,8 @@ export declare const readPostPurchaseGroupSelection: (settings: unknown, respons
|
|
|
67
67
|
options: {
|
|
68
68
|
name: string;
|
|
69
69
|
values: string[];
|
|
70
|
-
id: number;
|
|
71
70
|
position: number;
|
|
71
|
+
id?: number | undefined;
|
|
72
72
|
}[];
|
|
73
73
|
sellingPlanGroups: {
|
|
74
74
|
requiresSellingPlan: boolean;
|
|
@@ -92,8 +92,8 @@ export declare const readPostPurchaseGroupSelection: (settings: unknown, respons
|
|
|
92
92
|
options: {
|
|
93
93
|
name: string;
|
|
94
94
|
values: string[];
|
|
95
|
-
id: number;
|
|
96
95
|
position: number;
|
|
96
|
+
id?: number | undefined;
|
|
97
97
|
}[];
|
|
98
98
|
productId: number;
|
|
99
99
|
showSelectors: boolean;
|
package/dist/server/shared.d.ts
CHANGED
|
@@ -28,14 +28,21 @@ export type UpstreamFetch = (path: string, params: Record<string, string>, optio
|
|
|
28
28
|
/**
|
|
29
29
|
* A drift signal the orchestrators emit when a per-item payload salvage drops something: a malformed
|
|
30
30
|
* offer product, an invalid/unknown section stubbed out, an unreadable rule verdict, a shop-config
|
|
31
|
-
* entry the shared schema inerted (`shopConfig`),
|
|
32
|
-
* (`giftMilestones` — the widget's gifts are then kept)
|
|
31
|
+
* entry the shared schema inerted (`shopConfig`), unreadable selectable-gift milestones
|
|
32
|
+
* (`giftMilestones` — the widget's gifts are then kept), or a post-purchase product's malformed selected review
|
|
33
|
+
* metafield (`reviews` — the reviews are then omitted; it names the product and the field, never the value). Distinct from a hard {@link UpstreamError} — the
|
|
33
34
|
* request still succeeds (degraded), so this is the only trace that an upstream contract moved. Optional
|
|
34
35
|
* on {@link ServerContext}; the host (rebuy-api) wires it to its logger.
|
|
35
36
|
*/
|
|
36
37
|
export type ServerDrift = {
|
|
37
38
|
detail: string;
|
|
38
39
|
kind: 'b2bAvailability' | 'dataSource' | 'giftMilestones' | 'monetizeOffer' | 'product' | 'ruleVerdict' | 'section' | 'shopConfig';
|
|
40
|
+
} | {
|
|
41
|
+
detail: string;
|
|
42
|
+
/** The malformed selected review metafield as `namespace.key`; never its value. */
|
|
43
|
+
field: string;
|
|
44
|
+
kind: 'reviews';
|
|
45
|
+
productId: number;
|
|
39
46
|
};
|
|
40
47
|
/** A {@link ServerDrift} sink, as the orchestrators pass it around internally. */
|
|
41
48
|
export type Reporter = (event: ServerDrift) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuy/rebuy",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.51.0",
|
|
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.",
|