@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
@@ -0,0 +1,6 @@
1
+ import type { ReviewFields } from '../server/postPurchaseReviewFields';
2
+ /** Read attributes only; merchant badge HTML never enters the prepared display or section tree. */
3
+ export declare const readJudgeMeReviews: (find: ReviewFields) => {
4
+ rating: number;
5
+ reviewCount: number;
6
+ } | null;
@@ -0,0 +1,6 @@
1
+ import type { ReviewFields } from '../server/postPurchaseReviewFields';
2
+ /** Only the selected aggregate's two numeric members enter the prepared review display. */
3
+ export declare const readOkendoReviews: (find: ReviewFields) => {
4
+ rating: number;
5
+ reviewCount: number;
6
+ } | null;
@@ -1,8 +1,8 @@
1
1
  import type { PostPurchaseProductSettings } from '../schema/postPurchaseProductSettings';
2
2
  import type { PostPurchaseProductSource } from '../schema/postPurchaseProductSource';
3
3
  /**
4
- * Keep response-description provenance: it precedes the merchant's rich description even after settings are merged. Reviews
5
- * are Slice 26's addition (see `postPurchaseProductDisplay` schema); nothing here computes them yet.
4
+ * Keep response-description provenance: it precedes the merchant's rich description even after settings are merged.
5
+ * `projectPostPurchaseProduct` adds the reviews, which need the product's metafields and the drift reporter.
6
6
  */
7
7
  export declare const projectPostPurchaseProductDisplay: (effective: PostPurchaseProductSettings, metadata: PostPurchaseProductSource["metadata"], product: PostPurchaseProductSource["data"][number]) => {
8
8
  discountedFrom: "price" | "compare_at_price";
@@ -23,6 +23,16 @@ export declare const projectPostPurchaseProductDisplay: (effective: PostPurchase
23
23
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
24
24
  };
25
25
  responseDescription: string;
26
+ reviews: {
27
+ color: string;
28
+ rating: number;
29
+ reviewCount: number;
30
+ reviewsPlural: string;
31
+ reviewsSingular: string;
32
+ size: "small" | "large" | "medium";
33
+ strokeColor: string;
34
+ strokeWidth: number;
35
+ } | null;
26
36
  shouldShowSavingText: boolean;
27
37
  descriptionDocument?: {
28
38
  attrs: {
@@ -0,0 +1,7 @@
1
+ import type { ReviewFields } from '../server/postPurchaseReviewFields';
2
+ import type { selectPostPurchaseReviewProvider } from '../server/postPurchaseReviewProvider';
3
+ /** Selection is complete before reading data; a missing selected aggregate cannot fall through. */
4
+ export declare const readPostPurchaseReviewData: (provider: NonNullable<ReturnType<typeof selectPostPurchaseReviewProvider>>, find: ReviewFields) => {
5
+ rating: number;
6
+ reviewCount: number;
7
+ } | null;
@@ -0,0 +1,7 @@
1
+ /** Missing identity is unrelated data; a matched field retains its unknown or absent value. */
2
+ export declare const reviewFields: (raw: unknown) => (namespace: string, key: string) => {
3
+ key: string;
4
+ namespace: string;
5
+ value?: unknown;
6
+ } | undefined;
7
+ export type ReviewFields = ReturnType<typeof reviewFields>;
@@ -0,0 +1,2 @@
1
+ /** Stop at the first enabled flag; later malformed flags are not consumed. */
2
+ export declare const selectPostPurchaseReviewProvider: (raw: unknown) => "judgeme" | "junip" | "klaviyo" | "loox" | "okendo" | "opinew" | "reviewsio" | "stamped" | "yotpo" | null;
@@ -0,0 +1,5 @@
1
+ import { PostPurchaseProductReviews } from '../schema/postPurchaseProductReviews';
2
+ import type { PostPurchaseProductSettings } from '../schema/postPurchaseProductSettings';
3
+ import type { Reporter } from '../server/shared';
4
+ /** Reviews are optional display data; neither missing nor malformed aggregates invalidate the offer. */
5
+ export declare const projectPostPurchaseReviews: (settings: PostPurchaseProductSettings, metafields: unknown, report?: Reporter) => PostPurchaseProductReviews | null;
@@ -0,0 +1,6 @@
1
+ import type { ReviewFields } from '../server/postPurchaseReviewFields';
2
+ /** Pair absence is ordinary; invalid selected values throw to the single local recovery boundary. */
3
+ export declare const readScalarReviews: (find: ReviewFields, namespace: string, ratingKey: string, countKey: string) => {
4
+ rating: number;
5
+ reviewCount: number;
6
+ } | null;
@@ -4,7 +4,7 @@ import type { normalizePostPurchaseProduct } from '../server/normalizePostPurcha
4
4
  import type { PostPurchaseQuantity } from '../server/readPostPurchaseQuantity';
5
5
  import type { Reporter } from '../server/shared';
6
6
  /**
7
- * Preparation for one allocated plan with validated configured shipping and discount. `report` is kept in the
8
- * frozen position for Slice 26, whose review projection is the only consumer inside `projectPostPurchaseProduct`.
7
+ * Preparation for one allocated plan with validated configured shipping and discount; `report` receives
8
+ * unreadable-review drift.
9
9
  */
10
10
  export declare const prepareNormalizedSubscription: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, report: Reporter | undefined, plan: PostPurchasePlanOption | undefined, quantity?: PostPurchaseQuantity, allowCollection?: boolean) => PostPurchasePreparation;
@@ -84,6 +84,16 @@ export declare const preparePostPurchaseAdmissionView: (widgetId: number, settin
84
84
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
85
85
  };
86
86
  responseDescription: string;
87
+ reviews: {
88
+ color: string;
89
+ rating: number;
90
+ reviewCount: number;
91
+ reviewsPlural: string;
92
+ reviewsSingular: string;
93
+ size: "small" | "large" | "medium";
94
+ strokeColor: string;
95
+ strokeWidth: number;
96
+ } | null;
87
97
  shouldShowSavingText: boolean;
88
98
  description: string | null;
89
99
  descriptionDocument?: {
@@ -121,6 +121,16 @@ export declare const preparePostPurchaseCollectionGroup: (widgetId: number, sett
121
121
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
122
122
  };
123
123
  responseDescription: string;
124
+ reviews: {
125
+ color: string;
126
+ rating: number;
127
+ reviewCount: number;
128
+ reviewsPlural: string;
129
+ reviewsSingular: string;
130
+ size: "small" | "large" | "medium";
131
+ strokeColor: string;
132
+ strokeWidth: number;
133
+ } | null;
124
134
  shouldShowSavingText: boolean;
125
135
  description: string | null;
126
136
  descriptionDocument?: {
@@ -106,6 +106,16 @@ export declare const preparePostPurchaseCollectionView: (widgetId: number, setti
106
106
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
107
107
  };
108
108
  responseDescription: string;
109
+ reviews: {
110
+ color: string;
111
+ rating: number;
112
+ reviewCount: number;
113
+ reviewsPlural: string;
114
+ reviewsSingular: string;
115
+ size: "small" | "large" | "medium";
116
+ strokeColor: string;
117
+ strokeWidth: number;
118
+ } | null;
109
119
  shouldShowSavingText: boolean;
110
120
  description: string | null;
111
121
  descriptionDocument?: {
@@ -125,6 +125,16 @@ export declare const preparePostPurchaseGroupAdmissionView: (widgetId: number, s
125
125
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
126
126
  };
127
127
  responseDescription: string;
128
+ reviews: {
129
+ color: string;
130
+ rating: number;
131
+ reviewCount: number;
132
+ reviewsPlural: string;
133
+ reviewsSingular: string;
134
+ size: "small" | "large" | "medium";
135
+ strokeColor: string;
136
+ strokeWidth: number;
137
+ } | null;
128
138
  shouldShowSavingText: boolean;
129
139
  description: string | null;
130
140
  descriptionDocument?: {
@@ -88,6 +88,16 @@ export declare const preparePostPurchaseGroupDefault: (widgetId: number, setting
88
88
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
89
89
  };
90
90
  responseDescription: string;
91
+ reviews: {
92
+ color: string;
93
+ rating: number;
94
+ reviewCount: number;
95
+ reviewsPlural: string;
96
+ reviewsSingular: string;
97
+ size: "small" | "large" | "medium";
98
+ strokeColor: string;
99
+ strokeWidth: number;
100
+ } | null;
91
101
  shouldShowSavingText: boolean;
92
102
  description: string | null;
93
103
  descriptionDocument?: {
@@ -124,6 +124,16 @@ export declare const preparePostPurchaseGroupView: (widgetId: number, settings:
124
124
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
125
125
  };
126
126
  responseDescription: string;
127
+ reviews: {
128
+ color: string;
129
+ rating: number;
130
+ reviewCount: number;
131
+ reviewsPlural: string;
132
+ reviewsSingular: string;
133
+ size: "small" | "large" | "medium";
134
+ strokeColor: string;
135
+ strokeWidth: number;
136
+ } | null;
127
137
  shouldShowSavingText: boolean;
128
138
  description: string | null;
129
139
  descriptionDocument?: {
@@ -87,6 +87,16 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
87
87
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
88
88
  };
89
89
  responseDescription: string;
90
+ reviews: {
91
+ color: string;
92
+ rating: number;
93
+ reviewCount: number;
94
+ reviewsPlural: string;
95
+ reviewsSingular: string;
96
+ size: "small" | "large" | "medium";
97
+ strokeColor: string;
98
+ strokeWidth: number;
99
+ } | null;
90
100
  shouldShowSavingText: boolean;
91
101
  description: string | null;
92
102
  descriptionDocument?: {
@@ -714,6 +724,16 @@ export declare const preparePostPurchaseMemberView: (widgetId: number, settings:
714
724
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
715
725
  };
716
726
  responseDescription: string;
727
+ reviews: {
728
+ color: string;
729
+ rating: number;
730
+ reviewCount: number;
731
+ reviewsPlural: string;
732
+ reviewsSingular: string;
733
+ size: "small" | "large" | "medium";
734
+ strokeColor: string;
735
+ strokeWidth: number;
736
+ } | null;
717
737
  shouldShowSavingText: boolean;
718
738
  description: string | null;
719
739
  descriptionDocument?: {
@@ -1132,6 +1152,16 @@ export declare const preparePostPurchaseMemberAdmissionView: (widgetId: number,
1132
1152
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
1133
1153
  };
1134
1154
  responseDescription: string;
1155
+ reviews: {
1156
+ color: string;
1157
+ rating: number;
1158
+ reviewCount: number;
1159
+ reviewsPlural: string;
1160
+ reviewsSingular: string;
1161
+ size: "small" | "large" | "medium";
1162
+ strokeColor: string;
1163
+ strokeWidth: number;
1164
+ } | null;
1135
1165
  shouldShowSavingText: boolean;
1136
1166
  description: string | null;
1137
1167
  descriptionDocument?: {
@@ -2,10 +2,7 @@ import { type PostPurchasePreparation } from '../schema/postPurchaseProduct';
2
2
  import { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
3
3
  import type { PostPurchaseQuantity } from '../server/readPostPurchaseQuantity';
4
4
  import type { Reporter } from '../server/shared';
5
- /**
6
- * The one-time sibling of `prepareNormalizedSubscription`. `report` is kept in the frozen position for Slice
7
- * 26, whose review projection is the only consumer inside `projectPostPurchaseProduct`.
8
- */
5
+ /** The one-time sibling of `prepareNormalizedSubscription`; `report` receives unreadable-review drift. */
9
6
  export declare const prepareNormalizedProduct: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, report?: Reporter, quantity?: PostPurchaseQuantity, allowCollection?: boolean) => PostPurchasePreparation;
10
7
  /** Pure preparation only: the authenticated caller owns selected-entry binding and session expiry. */
11
8
  export declare const preparePostPurchaseProduct: (settings: unknown, response: unknown, report?: Reporter) => PostPurchasePreparation;
@@ -105,6 +105,16 @@ export declare const preparePostPurchaseQuantityAdmissionView: (widgetId: number
105
105
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
106
106
  };
107
107
  responseDescription: string;
108
+ reviews: {
109
+ color: string;
110
+ rating: number;
111
+ reviewCount: number;
112
+ reviewsPlural: string;
113
+ reviewsSingular: string;
114
+ size: "small" | "large" | "medium";
115
+ strokeColor: string;
116
+ strokeWidth: number;
117
+ } | null;
108
118
  shouldShowSavingText: boolean;
109
119
  description: string | null;
110
120
  descriptionDocument?: {
@@ -93,6 +93,16 @@ export declare const preparePostPurchaseQuantityView: (widgetId: number, setting
93
93
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
94
94
  };
95
95
  responseDescription: string;
96
+ reviews: {
97
+ color: string;
98
+ rating: number;
99
+ reviewCount: number;
100
+ reviewsPlural: string;
101
+ reviewsSingular: string;
102
+ size: "small" | "large" | "medium";
103
+ strokeColor: string;
104
+ strokeWidth: number;
105
+ } | null;
96
106
  shouldShowSavingText: boolean;
97
107
  description: string | null;
98
108
  descriptionDocument?: {
@@ -20,6 +20,16 @@ export declare const preparePostPurchaseSubscription: (settings: unknown, respon
20
20
  showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
21
21
  };
22
22
  responseDescription: string;
23
+ reviews: {
24
+ color: string;
25
+ rating: number;
26
+ reviewCount: number;
27
+ reviewsPlural: string;
28
+ reviewsSingular: string;
29
+ size: "small" | "large" | "medium";
30
+ strokeColor: string;
31
+ strokeWidth: number;
32
+ } | null;
23
33
  shouldShowSavingText: boolean;
24
34
  descriptionDocument?: {
25
35
  attrs: {
@@ -1,12 +1,23 @@
1
1
  import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
2
2
  import type { PostPurchaseQuantity } from '../server/readPostPurchaseQuantity';
3
+ import type { Reporter } from '../server/shared';
3
4
  /**
4
5
  * Both fixed purchase kinds project the same product and effective display after eligibility. Without a
5
6
  * read quantity the selection falls back to `readPostPurchaseQuantity`'s initial quantity (metadata, then the
6
7
  * picker default, then 1).
7
8
  */
8
- export declare const projectPostPurchaseProduct: ({ data, effective, metadata, original }: ReturnType<typeof normalizePostPurchaseProduct>, selectedQuantity?: PostPurchaseQuantity) => {
9
+ export declare const projectPostPurchaseProduct: ({ data, effective, metadata, original }: ReturnType<typeof normalizePostPurchaseProduct>, report?: Reporter, selectedQuantity?: PostPurchaseQuantity) => {
9
10
  display: {
11
+ reviews: {
12
+ color: string;
13
+ rating: number;
14
+ reviewCount: number;
15
+ reviewsPlural: string;
16
+ reviewsSingular: string;
17
+ size: "small" | "large" | "medium";
18
+ strokeColor: string;
19
+ strokeWidth: number;
20
+ } | null;
10
21
  discountedFrom: "price" | "compare_at_price";
11
22
  language: {
12
23
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebuy/rebuy",
3
- "version": "3.36.0",
3
+ "version": "3.37.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.",