@rebuy/rebuy 3.34.0 → 3.36.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 (51) hide show
  1. package/dist/index.cjs +1003 -801
  2. package/dist/index.mjs +1005 -803
  3. package/dist/schema/index.d.ts +8 -0
  4. package/dist/schema/postPurchaseGroup.d.ts +15 -0
  5. package/dist/schema/postPurchaseGroupCatalog.d.ts +56 -0
  6. package/dist/schema/postPurchaseOfferEligibility.d.ts +32 -0
  7. package/dist/schema/postPurchaseOfferPresentation.d.ts +386 -0
  8. package/dist/schema/postPurchaseProduct.d.ts +74 -24
  9. package/dist/schema/postPurchaseProductCalculation.d.ts +87 -0
  10. package/dist/schema/postPurchaseProductCollectionView.d.ts +724 -3
  11. package/dist/schema/postPurchaseProductDisplay.d.ts +41 -12
  12. package/dist/schema/postPurchaseProductSource.d.ts +10 -5
  13. package/dist/schema/postPurchaseProductView.d.ts +708 -0
  14. package/dist/schema/postPurchaseQuantity.d.ts +26 -0
  15. package/dist/schema/postPurchaseSubscriptionProduct.d.ts +74 -17
  16. package/dist/schema/postPurchaseVariantDefault.d.ts +17 -0
  17. package/dist/schema/postPurchaseVariantDefaultContext.d.ts +10 -0
  18. package/dist/server/__fixtures__/postPurchaseGroup.d.ts +78 -0
  19. package/dist/server/classifyPostPurchaseOffer.d.ts +3 -0
  20. package/dist/server/createPostPurchaseOrderAttributes.d.ts +9 -0
  21. package/dist/server/index.cjs +1131 -210
  22. package/dist/server/index.d.ts +20 -2
  23. package/dist/server/index.mjs +1131 -210
  24. package/dist/server/postPurchaseMemberEligibility.d.ts +7 -0
  25. package/dist/server/postPurchaseOfferCopy.d.ts +3 -0
  26. package/dist/server/postPurchaseProductDisplay.d.ts +38 -6
  27. package/dist/server/postPurchaseProductEligibility.d.ts +3 -7
  28. package/dist/server/postPurchaseSubscriptionEligibility.d.ts +2 -3
  29. package/dist/server/prepareNormalizedSubscription.d.ts +2 -3
  30. package/dist/server/preparePostPurchaseAdmissionView.d.ts +418 -0
  31. package/dist/server/preparePostPurchaseCollectionGroup.d.ts +458 -0
  32. package/dist/server/preparePostPurchaseCollectionView.d.ts +442 -0
  33. package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +459 -0
  34. package/dist/server/preparePostPurchaseGroupDeclineDisplay.d.ts +12 -0
  35. package/dist/server/preparePostPurchaseGroupDefault.d.ts +459 -0
  36. package/dist/server/preparePostPurchaseGroupView.d.ts +458 -0
  37. package/dist/server/preparePostPurchaseMemberView.d.ts +1466 -0
  38. package/dist/server/preparePostPurchaseOfferPresentation.d.ts +137 -0
  39. package/dist/server/preparePostPurchaseProduct.d.ts +11 -0
  40. package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +440 -0
  41. package/dist/server/preparePostPurchaseQuantityView.d.ts +427 -0
  42. package/dist/server/preparePostPurchaseSubscription.d.ts +37 -5
  43. package/dist/server/preparePostPurchaseView.d.ts +8 -0
  44. package/dist/server/projectPostPurchaseProduct.d.ts +42 -12
  45. package/dist/server/readPostPurchaseGroup.d.ts +101 -0
  46. package/dist/server/readPostPurchaseGroupSelection.d.ts +110 -0
  47. package/dist/server/readPostPurchaseQuantity.d.ts +27 -0
  48. package/dist/server/resolvePostPurchaseMemberDefault.d.ts +8 -0
  49. package/dist/server/selectPostPurchaseChoice.d.ts +2 -3
  50. package/dist/transforms/postPurchase/convertDescriptionRte.d.ts +11 -0
  51. package/package.json +1 -1
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ /** One member's buyer choice plus an optional explicit quantity. */
3
+ export declare const PostPurchaseQuantityChoice: z.ZodObject<{
4
+ choice: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
5
+ mode: z.ZodLiteral<"one-time">;
6
+ }, z.core.$strict>, z.ZodObject<{
7
+ mode: z.ZodLiteral<"subscription">;
8
+ sellingPlanId: z.ZodNumber;
9
+ }, z.core.$strict>], "mode">>;
10
+ productId: z.ZodNumber;
11
+ variantId: z.ZodOptional<z.ZodNumber>;
12
+ quantity: z.ZodOptional<z.ZodNumber>;
13
+ }, z.core.$strict>;
14
+ export type PostPurchaseQuantityChoice = z.infer<typeof PostPurchaseQuantityChoice>;
15
+ /**
16
+ * Today's picker bounds plus the trusted initial quantity. A minimum of 0, which the settings schema accepts and
17
+ * maps unreadable values to, floors at 1: nothing can be bought at 0, and legacy still rendered that picker, so
18
+ * it must not refuse the Offer.
19
+ */
20
+ export declare const PostPurchaseQuantityPolicy: z.ZodObject<{
21
+ enabled: z.ZodDefault<z.ZodBoolean>;
22
+ initialQuantity: z.ZodNumber;
23
+ maxValue: z.ZodNumber;
24
+ minValue: z.ZodUnion<[z.ZodPipe<z.ZodLiteral<0>, z.ZodTransform<number, 0>>, z.ZodNumber]>;
25
+ }, z.core.$strip>;
26
+ export type PostPurchaseQuantityPolicy = z.infer<typeof PostPurchaseQuantityPolicy>;
@@ -2,6 +2,43 @@ import { z } from 'zod';
2
2
  import { PreparedPostPurchaseProduct } from './postPurchaseProduct';
3
3
  export declare const PreparedPostPurchaseSubscription: z.ZodObject<{
4
4
  display: z.ZodObject<{
5
+ descriptionDocument: z.ZodOptional<z.ZodObject<{
6
+ attrs: z.ZodDefault<z.ZodObject<{
7
+ blockSpacing: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<"none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose" | undefined, string>>>;
8
+ }, z.core.$strip>>;
9
+ content: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
10
+ attrs: z.ZodDefault<z.ZodObject<{
11
+ textAlign: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<"start" | "center" | "end" | undefined, string>>>;
12
+ }, z.core.$strip>>;
13
+ content: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
14
+ marks: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
15
+ type: z.ZodLiteral<"bold">;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ type: z.ZodLiteral<"italic">;
18
+ }, z.core.$strip>, z.ZodObject<{
19
+ attrs: z.ZodObject<{
20
+ class: z.ZodNullable<z.ZodString>;
21
+ href: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"#">, z.ZodString, z.ZodString]>;
22
+ rel: z.ZodDefault<z.ZodString>;
23
+ target: z.ZodDefault<z.ZodString>;
24
+ }, z.core.$strip>;
25
+ type: z.ZodLiteral<"link">;
26
+ }, z.core.$strip>, z.ZodObject<{
27
+ type: z.ZodLiteral<"strike">;
28
+ }, z.core.$strip>, z.ZodObject<{
29
+ attrs: z.ZodObject<{
30
+ color: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<"success" | "warning" | "critical" | "base" | "decorative" | "subdued" | "accent" | undefined, string>>>>;
31
+ fontSize: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<"small" | "base" | "large" | "medium" | "extraSmall" | "extraLarge" | "heading" | undefined, string>>>>;
32
+ }, z.core.$strip>;
33
+ type: z.ZodLiteral<"textStyle">;
34
+ }, z.core.$strip>], "type">>, z.ZodPipe<z.ZodObject<{}, z.core.$strict>, z.ZodTransform<never[], Record<string, never>>>]>>;
35
+ text: z.ZodDefault<z.ZodString>;
36
+ type: z.ZodDefault<z.ZodLiteral<"text">>;
37
+ }, z.core.$strip>>, z.ZodPipe<z.ZodObject<{}, z.core.$strict>, z.ZodTransform<never[], Record<string, never>>>]>>;
38
+ type: z.ZodDefault<z.ZodLiteral<"paragraph">>;
39
+ }, z.core.$strip>>, z.ZodPipe<z.ZodObject<{}, z.core.$strict>, z.ZodTransform<never[], Record<string, never>>>]>>;
40
+ type: z.ZodDefault<z.ZodLiteral<"doc">>;
41
+ }, z.core.$strip>>;
5
42
  discountedFrom: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
6
43
  price: "price";
7
44
  compare_at_price: "compare_at_price";
@@ -18,18 +55,6 @@ export declare const PreparedPostPurchaseSubscription: z.ZodObject<{
18
55
  language: z.ZodObject<{
19
56
  description: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>]>>;
20
57
  descriptionEnabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
21
- descriptionRte: z.ZodOptional<z.ZodObject<{
22
- content: z.ZodArray<z.ZodUnknown>;
23
- type: z.ZodString;
24
- }, z.core.$strip>>;
25
- descriptionSpacing: z.ZodOptional<z.ZodEnum<{
26
- default: "default";
27
- none: "none";
28
- tight: "tight";
29
- loose: "loose";
30
- xtight: "xtight";
31
- xloose: "xloose";
32
- }>>;
33
58
  }, z.core.$strip>;
34
59
  primaryImage: z.ZodObject<{
35
60
  description: z.ZodString;
@@ -131,11 +156,6 @@ export declare const readPostPurchaseSubscription: (prepared: z.infer<typeof Pre
131
156
  language: {
132
157
  description: string;
133
158
  descriptionEnabled: boolean;
134
- descriptionRte?: {
135
- content: unknown[];
136
- type: string;
137
- } | undefined;
138
- descriptionSpacing?: "default" | "none" | "tight" | "loose" | "xtight" | "xloose" | undefined;
139
159
  };
140
160
  primaryImage: {
141
161
  description: string;
@@ -151,6 +171,43 @@ export declare const readPostPurchaseSubscription: (prepared: z.infer<typeof Pre
151
171
  };
152
172
  responseDescription: string;
153
173
  shouldShowSavingText: boolean;
174
+ descriptionDocument?: {
175
+ attrs: {
176
+ blockSpacing?: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose" | undefined;
177
+ };
178
+ content: never[] | {
179
+ attrs: {
180
+ textAlign?: "start" | "center" | "end" | undefined;
181
+ };
182
+ content: never[] | {
183
+ text: string;
184
+ type: "text";
185
+ marks?: never[] | ({
186
+ type: "bold";
187
+ } | {
188
+ type: "italic";
189
+ } | {
190
+ attrs: {
191
+ class: string | null;
192
+ href: string;
193
+ rel: string;
194
+ target: string;
195
+ };
196
+ type: "link";
197
+ } | {
198
+ type: "strike";
199
+ } | {
200
+ attrs: {
201
+ color: "success" | "warning" | "critical" | "base" | "decorative" | "subdued" | "accent";
202
+ fontSize: "small" | "base" | "large" | "medium" | "extraSmall" | "extraLarge" | "heading";
203
+ };
204
+ type: "textStyle";
205
+ })[] | undefined;
206
+ }[];
207
+ type: "paragraph";
208
+ }[];
209
+ type: "doc";
210
+ } | undefined;
154
211
  gallery?: {
155
212
  images: {
156
213
  description: string;
@@ -34,3 +34,20 @@ export declare const PostPurchaseVariantDefaultSettings: z.ZodObject<{
34
34
  hideOutOfStockVariants: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
35
35
  }, z.core.$strip>;
36
36
  export declare const PostPurchaseOrderAttributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
37
+ export declare const PostPurchaseOriginalVariants: z.ZodArray<z.ZodObject<{
38
+ productId: z.ZodNumber;
39
+ variantId: z.ZodNumber;
40
+ }, z.core.$strip>>;
41
+ export declare const PostPurchaseAttributeProducts: z.ZodArray<z.ZodObject<{
42
+ id: z.ZodNumber;
43
+ options: z.ZodArray<z.ZodObject<{
44
+ values: z.ZodArray<z.ZodString>;
45
+ name: z.ZodString;
46
+ }, z.core.$strip>>;
47
+ variants: z.ZodArray<z.ZodObject<{
48
+ option2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ option3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ option1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ id: z.ZodNumber;
52
+ }, z.core.$strip>>;
53
+ }, z.core.$strip>>;
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ /** Server-owned original-order facts; enrichment is parsed only when matching consumes it. */
3
+ export declare const PostPurchaseVariantDefaultContext: z.ZodObject<{
4
+ enrichedLineItems: z.ZodOptional<z.ZodUnknown>;
5
+ originalVariants: z.ZodArray<z.ZodObject<{
6
+ productId: z.ZodNumber;
7
+ variantId: z.ZodNumber;
8
+ }, z.core.$strip>>;
9
+ }, z.core.$strip>;
10
+ export type PostPurchaseVariantDefaultContext = z.infer<typeof PostPurchaseVariantDefaultContext>;
@@ -0,0 +1,78 @@
1
+ /** Synthetic group wire grounded in legacy schemas/consumers; not a captured upstream response. */
2
+ export declare const groupSettings: {
3
+ quantity_inputs: {
4
+ default_quantity: number;
5
+ enabled: boolean;
6
+ };
7
+ blocks: {
8
+ type: string;
9
+ }[];
10
+ discount: {
11
+ amount: string;
12
+ type: string;
13
+ };
14
+ endpoint: string;
15
+ integrations: {};
16
+ key: string;
17
+ language: {};
18
+ product_limit: number;
19
+ product_options: {};
20
+ product_type: string;
21
+ shipping: {
22
+ amount: string;
23
+ title: string;
24
+ type: string;
25
+ };
26
+ };
27
+ export declare const groupResponse: () => {
28
+ data: {
29
+ metadata: {
30
+ product_quantity: number;
31
+ };
32
+ options: {
33
+ id: number;
34
+ name: string;
35
+ position: number;
36
+ values: string[];
37
+ }[];
38
+ product_group_variants: ({
39
+ description: string;
40
+ id: number;
41
+ image: null;
42
+ options: {
43
+ id: number;
44
+ name: string;
45
+ position: number;
46
+ values: string[];
47
+ }[];
48
+ title: string;
49
+ } | null)[];
50
+ variants: ({
51
+ inventory_quantity: number;
52
+ option1: string;
53
+ compare_at_price: string;
54
+ id: number;
55
+ inventory_management: string;
56
+ inventory_policy: string;
57
+ price: string;
58
+ product_id: number;
59
+ title: string;
60
+ } | {
61
+ id: number;
62
+ product_id: number;
63
+ title: string;
64
+ compare_at_price: string;
65
+ inventory_management: string;
66
+ inventory_policy: string;
67
+ inventory_quantity: number;
68
+ price: string;
69
+ })[];
70
+ description: string;
71
+ id: number;
72
+ image: {
73
+ src: string;
74
+ };
75
+ title: string;
76
+ }[];
77
+ metadata: {};
78
+ };
@@ -0,0 +1,3 @@
1
+ import { type z } from 'zod';
2
+ import { type PostPurchaseOfferEligibility, PostPurchaseOfferEligibilityContext } from '../schema/postPurchaseOfferEligibility';
3
+ export declare const classifyPostPurchaseOffer: (settings: unknown, response: unknown, context: z.input<typeof PostPurchaseOfferEligibilityContext>) => PostPurchaseOfferEligibility;
@@ -0,0 +1,9 @@
1
+ import type { z } from 'zod';
2
+ import { PostPurchaseAttributeProducts, PostPurchaseOriginalVariants } from '../schema/postPurchaseVariantDefault';
3
+ /**
4
+ * `{ optionName: values }` from the original line items joined to the enrichment by product id, in original
5
+ * line order. Two legacy `createAttributeMap` defects are fixed: an append now tests the value at the position
6
+ * being pushed rather than `option1` for every position (L103), and a position the product does not declare is
7
+ * skipped rather than throwing (L104).
8
+ */
9
+ export declare const createPostPurchaseOrderAttributes: (original: z.input<typeof PostPurchaseOriginalVariants>, enriched: z.input<typeof PostPurchaseAttributeProducts>) => Record<string, string[]>;