@rebuy/rebuy 3.36.0 → 3.37.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.
Files changed (35) hide show
  1. package/dist/index.cjs +689 -656
  2. package/dist/index.mjs +689 -656
  3. package/dist/schema/index.d.ts +1 -0
  4. package/dist/schema/postPurchaseProduct.d.ts +28 -0
  5. package/dist/schema/postPurchaseProductCollectionView.d.ts +14 -0
  6. package/dist/schema/postPurchaseProductDisplay.d.ts +16 -4
  7. package/dist/schema/postPurchaseProductReviews.d.ts +36 -0
  8. package/dist/schema/postPurchaseProductView.d.ts +14 -0
  9. package/dist/schema/postPurchaseSubscriptionProduct.d.ts +24 -0
  10. package/dist/server/__fixtures__/postPurchaseReviewProviders.d.ts +30 -0
  11. package/dist/server/__fixtures__/postPurchaseReviews.d.ts +67 -0
  12. package/dist/server/index.cjs +382 -224
  13. package/dist/server/index.mjs +382 -224
  14. package/dist/server/postPurchaseJudgeMeReviews.d.ts +6 -0
  15. package/dist/server/postPurchaseOkendoReviews.d.ts +6 -0
  16. package/dist/server/postPurchaseProductDisplay.d.ts +12 -2
  17. package/dist/server/postPurchaseReviewData.d.ts +7 -0
  18. package/dist/server/postPurchaseReviewFields.d.ts +7 -0
  19. package/dist/server/postPurchaseReviewProvider.d.ts +2 -0
  20. package/dist/server/postPurchaseReviews.d.ts +5 -0
  21. package/dist/server/postPurchaseScalarReviews.d.ts +6 -0
  22. package/dist/server/prepareNormalizedSubscription.d.ts +2 -2
  23. package/dist/server/preparePostPurchaseAdmissionView.d.ts +10 -0
  24. package/dist/server/preparePostPurchaseCollectionGroup.d.ts +10 -0
  25. package/dist/server/preparePostPurchaseCollectionView.d.ts +10 -0
  26. package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +10 -0
  27. package/dist/server/preparePostPurchaseGroupDefault.d.ts +10 -0
  28. package/dist/server/preparePostPurchaseGroupView.d.ts +10 -0
  29. package/dist/server/preparePostPurchaseMemberView.d.ts +30 -0
  30. package/dist/server/preparePostPurchaseProduct.d.ts +1 -4
  31. package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +10 -0
  32. package/dist/server/preparePostPurchaseQuantityView.d.ts +10 -0
  33. package/dist/server/preparePostPurchaseSubscription.d.ts +10 -0
  34. package/dist/server/projectPostPurchaseProduct.d.ts +12 -1
  35. package/package.json +1 -1
@@ -19,6 +19,7 @@ export * from './postPurchaseProductCalculation';
19
19
  export * from './postPurchaseProductCollectionView';
20
20
  export * from './postPurchaseProductDisplay';
21
21
  export * from './postPurchaseProductGallery';
22
+ export * from './postPurchaseProductReviews';
22
23
  export * from './postPurchaseProductSettings';
23
24
  export * from './postPurchaseProductSource';
24
25
  export * from './postPurchaseProductView';
@@ -81,6 +81,20 @@ export declare const PreparedPostPurchaseProduct: z.ZodObject<{
81
81
  showVariantSelectors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
82
82
  }, z.core.$strip>;
83
83
  responseDescription: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>;
84
+ reviews: z.ZodDefault<z.ZodNullable<z.ZodObject<{
85
+ color: z.ZodString;
86
+ rating: z.ZodNumber;
87
+ reviewCount: z.ZodNumber;
88
+ reviewsPlural: z.ZodString;
89
+ reviewsSingular: z.ZodString;
90
+ size: z.ZodEnum<{
91
+ small: "small";
92
+ large: "large";
93
+ medium: "medium";
94
+ }>;
95
+ strokeColor: z.ZodString;
96
+ strokeWidth: z.ZodNumber;
97
+ }, z.core.$strip>>>;
84
98
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
85
99
  }, z.core.$strip>;
86
100
  labels: z.ZodObject<{
@@ -230,6 +244,20 @@ export declare const PostPurchasePreparation: z.ZodDiscriminatedUnion<[z.ZodObje
230
244
  showVariantSelectors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
231
245
  }, z.core.$strip>;
232
246
  responseDescription: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>;
247
+ reviews: z.ZodDefault<z.ZodNullable<z.ZodObject<{
248
+ color: z.ZodString;
249
+ rating: z.ZodNumber;
250
+ reviewCount: z.ZodNumber;
251
+ reviewsPlural: z.ZodString;
252
+ reviewsSingular: z.ZodString;
253
+ size: z.ZodEnum<{
254
+ small: "small";
255
+ large: "large";
256
+ medium: "medium";
257
+ }>;
258
+ strokeColor: z.ZodString;
259
+ strokeWidth: z.ZodNumber;
260
+ }, z.core.$strip>>>;
233
261
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
234
262
  }, z.core.$strip>;
235
263
  labels: z.ZodObject<{
@@ -206,6 +206,20 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
206
206
  showVariantSelectors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
207
207
  }, z.core.$strip>;
208
208
  responseDescription: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>;
209
+ reviews: z.ZodDefault<z.ZodNullable<z.ZodObject<{
210
+ color: z.ZodString;
211
+ rating: z.ZodNumber;
212
+ reviewCount: z.ZodNumber;
213
+ reviewsPlural: z.ZodString;
214
+ reviewsSingular: z.ZodString;
215
+ size: z.ZodEnum<{
216
+ small: "small";
217
+ large: "large";
218
+ medium: "medium";
219
+ }>;
220
+ strokeColor: z.ZodString;
221
+ strokeWidth: z.ZodNumber;
222
+ }, z.core.$strip>>>;
209
223
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
210
224
  description: z.ZodNullable<z.ZodString>;
211
225
  }, z.core.$strip>;
@@ -1,10 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  export declare const PostPurchasePrimaryImageSource: z.ZodDefault<z.ZodString>;
3
3
  /**
4
- * `reviews` is deliberately absent here — the frozen branch merges `projectPostPurchaseReviews`'s result
5
- * in, but that reader (and the nine provider formats behind it) is Slice 26's "Review providers" module.
6
- * Slice 26 extends this schema and `projectPostPurchaseProductDisplay`'s return value with the field
7
- * together, rather than this Slice carrying an always-null placeholder for it.
4
+ * `reviews` is the optional aggregate from `projectPostPurchaseReviews` (see `docs/post-purchase-reviews.md`):
5
+ * null when disabled, missing, zero-rated or unreadable, never a reason to refuse the Offer.
8
6
  *
9
7
  * The merchant's rich description is carried only as the standard CAB `descriptionDocument`, converted from
10
8
  * the post-purchase editor's custom `descriptionRte` (whose block spacing it absorbs), so no consumer ever
@@ -83,6 +81,20 @@ export declare const PostPurchaseProductDisplay: z.ZodObject<{
83
81
  showVariantSelectors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
84
82
  }, z.core.$strip>;
85
83
  responseDescription: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>;
84
+ reviews: z.ZodDefault<z.ZodNullable<z.ZodObject<{
85
+ color: z.ZodString;
86
+ rating: z.ZodNumber;
87
+ reviewCount: z.ZodNumber;
88
+ reviewsPlural: z.ZodString;
89
+ reviewsSingular: z.ZodString;
90
+ size: z.ZodEnum<{
91
+ small: "small";
92
+ large: "large";
93
+ medium: "medium";
94
+ }>;
95
+ strokeColor: z.ZodString;
96
+ strokeWidth: z.ZodNumber;
97
+ }, z.core.$strip>>>;
86
98
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
87
99
  }, z.core.$strip>;
88
100
  export type PostPurchaseProductDisplay = z.infer<typeof PostPurchaseProductDisplay>;
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ /** CAB's common Shopify format accepts a value without Klaviyo's scale envelope. */
3
+ export declare const PostPurchaseCommonReviewRating: z.ZodObject<{
4
+ value: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodNumber>;
5
+ }, z.core.$strip>;
6
+ export declare const PostPurchaseKlaviyoReviewRating: z.ZodObject<{
7
+ value: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodNumber>;
8
+ scale_max: z.ZodNonOptional<z.ZodUnknown>;
9
+ scale_min: z.ZodNonOptional<z.ZodUnknown>;
10
+ }, z.core.$strip>;
11
+ export declare const PostPurchaseReviewCount: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>;
12
+ export declare const PostPurchaseReviewStyles: z.ZodPrefault<z.ZodObject<{
13
+ starColor: z.ZodDefault<z.ZodOptional<z.ZodString>>;
14
+ starSize: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
15
+ small: "small";
16
+ large: "large";
17
+ medium: "medium";
18
+ }>, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>>;
19
+ starStrokeColor: z.ZodDefault<z.ZodOptional<z.ZodString>>;
20
+ strokeWidth: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodNumber>>;
21
+ }, z.core.$strip>>;
22
+ export declare const PostPurchaseProductReviews: z.ZodObject<{
23
+ color: z.ZodString;
24
+ rating: z.ZodNumber;
25
+ reviewCount: z.ZodNumber;
26
+ reviewsPlural: z.ZodString;
27
+ reviewsSingular: z.ZodString;
28
+ size: z.ZodEnum<{
29
+ small: "small";
30
+ large: "large";
31
+ medium: "medium";
32
+ }>;
33
+ strokeColor: z.ZodString;
34
+ strokeWidth: z.ZodNumber;
35
+ }, z.core.$strip>;
36
+ export type PostPurchaseProductReviews = z.infer<typeof PostPurchaseProductReviews>;
@@ -201,6 +201,20 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
201
201
  showVariantSelectors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
202
202
  }, z.core.$strip>;
203
203
  responseDescription: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>;
204
+ reviews: z.ZodDefault<z.ZodNullable<z.ZodObject<{
205
+ color: z.ZodString;
206
+ rating: z.ZodNumber;
207
+ reviewCount: z.ZodNumber;
208
+ reviewsPlural: z.ZodString;
209
+ reviewsSingular: z.ZodString;
210
+ size: z.ZodEnum<{
211
+ small: "small";
212
+ large: "large";
213
+ medium: "medium";
214
+ }>;
215
+ strokeColor: z.ZodString;
216
+ strokeWidth: z.ZodNumber;
217
+ }, z.core.$strip>>>;
204
218
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
205
219
  description: z.ZodNullable<z.ZodString>;
206
220
  }, z.core.$strip>;
@@ -74,6 +74,20 @@ export declare const PreparedPostPurchaseSubscription: z.ZodObject<{
74
74
  showVariantSelectors: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
75
75
  }, z.core.$strip>;
76
76
  responseDescription: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>;
77
+ reviews: z.ZodDefault<z.ZodNullable<z.ZodObject<{
78
+ color: z.ZodString;
79
+ rating: z.ZodNumber;
80
+ reviewCount: z.ZodNumber;
81
+ reviewsPlural: z.ZodString;
82
+ reviewsSingular: z.ZodString;
83
+ size: z.ZodEnum<{
84
+ small: "small";
85
+ large: "large";
86
+ medium: "medium";
87
+ }>;
88
+ strokeColor: z.ZodString;
89
+ strokeWidth: z.ZodNumber;
90
+ }, z.core.$strip>>>;
77
91
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
78
92
  }, z.core.$strip>;
79
93
  labels: z.ZodObject<{
@@ -170,6 +184,16 @@ export declare const readPostPurchaseSubscription: (prepared: z.infer<typeof Pre
170
184
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
171
185
  };
172
186
  responseDescription: string;
187
+ reviews: {
188
+ color: string;
189
+ rating: number;
190
+ reviewCount: number;
191
+ reviewsPlural: string;
192
+ reviewsSingular: string;
193
+ size: "small" | "large" | "medium";
194
+ strokeColor: string;
195
+ strokeWidth: number;
196
+ } | null;
173
197
  shouldShowSavingText: boolean;
174
198
  descriptionDocument?: {
175
199
  attrs: {
@@ -0,0 +1,30 @@
1
+ /** One sanitized legacy metafield payload per provider (doc R7), in the legacy precedence order. */
2
+ export declare const providerCases: ({
3
+ metafields: {
4
+ key: string;
5
+ namespace: string;
6
+ type: string;
7
+ value: string;
8
+ }[];
9
+ provider: string;
10
+ rating: number;
11
+ reviewCount: number;
12
+ } | {
13
+ metafields: {
14
+ key: string;
15
+ namespace: string;
16
+ value: string;
17
+ }[];
18
+ provider: string;
19
+ rating: number;
20
+ reviewCount: number;
21
+ })[];
22
+ export declare const allReviewFields: {
23
+ key: string;
24
+ namespace: string;
25
+ value: string;
26
+ }[];
27
+ /** Providers before `index` off, `index` on, the rest set to `rest` (an unconsumed value when malformed). */
28
+ export declare const integrationsFrom: (index: number, selected?: unknown, rest?: unknown) => {
29
+ [k: string]: unknown;
30
+ };
@@ -0,0 +1,67 @@
1
+ /** Common Shopify aggregate fields, as the Klaviyo integration writes them. */
2
+ export declare const reviewMetafields: {
3
+ key: string;
4
+ namespace: string;
5
+ type: string;
6
+ value: string;
7
+ }[];
8
+ export declare const reviewSettings: {
9
+ integrations: {
10
+ klaviyo: boolean;
11
+ };
12
+ language: {
13
+ global: {
14
+ reviews_plural: string;
15
+ reviews_singular: string;
16
+ };
17
+ };
18
+ styles: {
19
+ star_color: string;
20
+ star_size: string;
21
+ star_stroke_color: string;
22
+ stroke_width: string;
23
+ };
24
+ blocks: {
25
+ type: string;
26
+ }[];
27
+ discount: {
28
+ amount: string;
29
+ type: string;
30
+ };
31
+ endpoint: string;
32
+ key: string;
33
+ product_limit: number;
34
+ product_options: {};
35
+ product_type: string;
36
+ quantity_inputs: {
37
+ default_quantity: number;
38
+ enabled: boolean;
39
+ };
40
+ shipping: {
41
+ amount: string;
42
+ title: string;
43
+ type: string;
44
+ };
45
+ };
46
+ export declare const reviewResponse: (metafields?: unknown) => {
47
+ data: {
48
+ metafields: unknown;
49
+ description: string;
50
+ id: number;
51
+ image: {
52
+ src: string;
53
+ };
54
+ title: string;
55
+ variants: {
56
+ compare_at_price: string;
57
+ id: number;
58
+ inventory_management: string;
59
+ inventory_policy: string;
60
+ inventory_quantity: number;
61
+ price: string;
62
+ product_id: number;
63
+ title: string;
64
+ }[];
65
+ }[];
66
+ metadata: {};
67
+ };