@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,459 @@
1
+ import type { PostPurchaseGroupSelection } from '../schema/postPurchaseGroupCatalog';
2
+ import type { PostPurchaseExcludedProductIds } from '../schema/postPurchaseProductCollectionView';
3
+ import type { PostPurchaseVariantDefaultContext } from '../schema/postPurchaseVariantDefaultContext';
4
+ import type { Reporter } from '../server/shared';
5
+ /** Reuse initial default policy after validating association and removing handled merchandise. */
6
+ export declare const preparePostPurchaseGroupDefault: (widgetId: number, settings: unknown, response: unknown, memberProductId: PostPurchaseGroupSelection["memberProductId"], context: PostPurchaseVariantDefaultContext, report?: Reporter, excludedProductIds?: PostPurchaseExcludedProductIds) => {
7
+ view: {
8
+ initialVariant: {
9
+ variantId: number;
10
+ };
11
+ preparation: {
12
+ labels: {
13
+ declineAll: string;
14
+ free: string;
15
+ payNow: string;
16
+ quantity: string;
17
+ recurringShipping: string;
18
+ recurringSubtotal: string;
19
+ save: string;
20
+ shipping: string;
21
+ subtotal: string;
22
+ taxes: string;
23
+ total: string;
24
+ };
25
+ product: {
26
+ title: string;
27
+ id: number;
28
+ variant: {
29
+ title: string;
30
+ compareAtPrice: string | null;
31
+ id: number;
32
+ price: string;
33
+ };
34
+ image?: {
35
+ src: string;
36
+ } | null | undefined;
37
+ description?: string | null | undefined;
38
+ };
39
+ selection: {
40
+ productId: number;
41
+ quantity: number;
42
+ variantId: number;
43
+ sellingPlanId?: number | undefined;
44
+ };
45
+ status: "prepared";
46
+ terms: {
47
+ discount: {
48
+ amount: number;
49
+ title: string;
50
+ type: "none" | "fixed_amount" | "percentage";
51
+ };
52
+ shipping: {
53
+ amount: number;
54
+ title: string;
55
+ type: "fixed_amount" | "free";
56
+ };
57
+ subscription?: {
58
+ initialShippingPrice: number;
59
+ intervalLabel: string;
60
+ name: string;
61
+ recurringShippingPrice: number;
62
+ shippingOption: {
63
+ presentmentTitle: string;
64
+ title: string;
65
+ };
66
+ adjustment?: {
67
+ amount: number;
68
+ type: "price" | "fixed_amount" | "percentage";
69
+ } | undefined;
70
+ } | undefined;
71
+ };
72
+ display: {
73
+ discountedFrom: "price" | "compare_at_price";
74
+ language: {
75
+ description: string;
76
+ descriptionEnabled: boolean;
77
+ };
78
+ primaryImage: {
79
+ description: string;
80
+ source: string;
81
+ };
82
+ productOptions: {
83
+ showShipping: boolean;
84
+ showSubtotal: boolean;
85
+ showTaxes: boolean;
86
+ showTotal: boolean;
87
+ showVariantSelectors: boolean;
88
+ showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
89
+ };
90
+ responseDescription: string;
91
+ shouldShowSavingText: boolean;
92
+ description: string | null;
93
+ descriptionDocument?: {
94
+ attrs: {
95
+ blockSpacing?: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose" | undefined;
96
+ };
97
+ content: never[] | {
98
+ attrs: {
99
+ textAlign?: "start" | "center" | "end" | undefined;
100
+ };
101
+ content: never[] | {
102
+ text: string;
103
+ type: "text";
104
+ marks?: never[] | ({
105
+ type: "bold";
106
+ } | {
107
+ type: "italic";
108
+ } | {
109
+ attrs: {
110
+ class: string | null;
111
+ href: string;
112
+ rel: string;
113
+ target: string;
114
+ };
115
+ type: "link";
116
+ } | {
117
+ type: "strike";
118
+ } | {
119
+ attrs: {
120
+ color: "success" | "warning" | "critical" | "base" | "decorative" | "subdued" | "accent";
121
+ fontSize: "small" | "base" | "large" | "medium" | "extraSmall" | "extraLarge" | "heading";
122
+ };
123
+ type: "textStyle";
124
+ })[] | undefined;
125
+ }[];
126
+ type: "paragraph";
127
+ }[];
128
+ type: "doc";
129
+ } | undefined;
130
+ gallery?: {
131
+ images: {
132
+ description: string;
133
+ id: number;
134
+ source: string;
135
+ thumbnail: string;
136
+ }[];
137
+ selectedImageId?: number | undefined;
138
+ } | undefined;
139
+ };
140
+ };
141
+ sections: {
142
+ alignment: {
143
+ horizontal: "start" | "center" | "end";
144
+ vertical: "top" | "middle" | "bottom";
145
+ };
146
+ border: {
147
+ radius: "small" | "none" | "base" | "large" | "fullyRounded";
148
+ style: "none" | "base" | "dotted" | "dashed";
149
+ width: "base" | "medium" | "thick";
150
+ };
151
+ direction: "columns" | "rows" | "grid";
152
+ padding: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
153
+ sectionId: string;
154
+ sections: never[] | import("..").CABSection[];
155
+ sectionType: "layout";
156
+ spacing: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
157
+ width: number;
158
+ editorMode: "checkoutExtension" | "postPurchaseOffer" | "thankYouPage" | "orderStatusPage" | "ordersIndexPage" | "customerProfilePage";
159
+ previewMode: boolean;
160
+ storeId: number | null;
161
+ targetArea: {
162
+ icon: string;
163
+ label: string;
164
+ width: string;
165
+ fill?: boolean | undefined;
166
+ flip?: "vertical" | "horizontal" | "both" | undefined;
167
+ } | null;
168
+ tracking: {
169
+ enableAttribution: boolean;
170
+ enableSource: boolean;
171
+ enableWidget: boolean;
172
+ };
173
+ type: "product" | "bundle_builder" | "cart" | "cart_subscription" | "dynamic_bundle" | "gift_with_purchase" | "placeholder" | "pre_purchase" | "product_addon" | "product_upsell" | "recharge_checkout" | "recharge_customer_portal" | "recharge_post_purchase" | "shopify_checkout" | "shopify_checkout_extension" | "shopify_post_purchase" | "shopify_post_purchase_extension" | "switch_to_subscription" | "ui_extension_ad" | "ui_extension_button" | "ui_extension_content_block" | "ui_extension_line_item_editor" | "ui_extension_progress_bar";
174
+ uiLabels: {
175
+ currentPage: Record<string, string>;
176
+ guest: Record<string, string>;
177
+ loadingOptions: Record<string, string>;
178
+ nextPage: Record<string, string>;
179
+ offerCarousel: Record<string, string>;
180
+ offerDialog: Record<string, string>;
181
+ page: Record<string, string>;
182
+ previousPage: Record<string, string>;
183
+ selected: Record<string, string>;
184
+ subscriptionOptions: Record<string, string>;
185
+ updating: Record<string, string>;
186
+ };
187
+ version: 2;
188
+ widgetId: number | null;
189
+ buttonField?: "declineAllOffers" | "declineOffer" | "removeFromOrder" | "undoAddToOrder" | "activePage" | "addedToCart" | "addingToCart" | "addToCart" | "buttonLabel" | "destinationUrl" | "inactivePage" | "overlayContent" | "payNow" | "progressReached" | "progressRemaining" | "redirectToCheckout" | "showVariant" | "showVariants" | "soldOut" | "subscriptionOption" | "switchToOneTimePurchase" | "switchToSubscriptionNoDiscount" | "switchToSubscriptionWithDiscount" | undefined;
190
+ frame?: "callout" | "offer-content" | undefined;
191
+ grid?: {
192
+ columns: (string | number)[];
193
+ rows: (string | number)[];
194
+ } | undefined;
195
+ name?: string | undefined;
196
+ viewUrl?: string | undefined;
197
+ wrapping?: {
198
+ breakAt: number;
199
+ maxPerLine: number;
200
+ } | undefined;
201
+ mutators?: {
202
+ effect: "set_false" | "set_true" | "toggle";
203
+ variable: string;
204
+ when: {
205
+ operator: "is_empty" | "is_not_empty";
206
+ type: "content";
207
+ } | {
208
+ operator: "equals" | "greater_than" | "less_than";
209
+ type: "result_count";
210
+ value: number;
211
+ } | {
212
+ operator: "contains" | "does_not_contain";
213
+ type: "result_tag";
214
+ value: string;
215
+ } | {
216
+ event: "item_added" | "quantity_changed" | "variant_selected";
217
+ type: "event";
218
+ };
219
+ }[] | undefined;
220
+ variables?: ({
221
+ defaultValue: string;
222
+ name: string;
223
+ type: "text";
224
+ seed?: undefined;
225
+ } | {
226
+ defaultValue: number;
227
+ name: string;
228
+ type: "number";
229
+ seed?: undefined;
230
+ } | {
231
+ defaultValue: boolean;
232
+ name: string;
233
+ type: "boolean";
234
+ seed?: {
235
+ dataSourceId: number | null;
236
+ ruleset: {
237
+ exitIfMatched: boolean;
238
+ logic: {
239
+ rules: {
240
+ operator: "equals" | "greater_than" | "less_than" | "contains" | "does_not_contain" | "after" | "anything" | "before" | "contains_any" | "does_not_contain_any" | "does_not_equal";
241
+ products: never[] | unknown[];
242
+ type: "product" | "date" | "cart" | "cart_count" | "cart_item_count" | "cart_line_count" | "cart_subtotal" | "collection" | "customer" | "customer_order_count" | "customer_tag" | "customer_total_spent" | "product_tag" | "product_title" | "product_type" | "product_vendor";
243
+ value: string;
244
+ }[];
245
+ }[];
246
+ output: {
247
+ key: string;
248
+ type: "data_json";
249
+ value: string;
250
+ }[];
251
+ }[];
252
+ } | undefined;
253
+ })[] | undefined;
254
+ visibility?: {
255
+ variable: string;
256
+ visibleWhen: boolean;
257
+ } | undefined;
258
+ experiment?: {
259
+ elementId: number;
260
+ experimentId: number;
261
+ experimentType: string;
262
+ selectedId: number;
263
+ } | undefined;
264
+ };
265
+ groupCatalog?: {
266
+ memberProductId: number;
267
+ options: {
268
+ productId: number;
269
+ title: string;
270
+ variantCatalog: {
271
+ displayMode: "single" | "separate";
272
+ options: {
273
+ name: string;
274
+ values: string[];
275
+ id: number;
276
+ position: number;
277
+ }[];
278
+ productId: number;
279
+ showSelectors: boolean;
280
+ variants: {
281
+ available: boolean;
282
+ id: number;
283
+ title: string;
284
+ option1?: string | undefined;
285
+ option2?: string | null | undefined;
286
+ option3?: string | null | undefined;
287
+ imageId?: number | null | undefined;
288
+ }[];
289
+ };
290
+ }[];
291
+ } | undefined;
292
+ planCatalog?: {
293
+ plans: {
294
+ id: number;
295
+ intervalLabel: string;
296
+ name: string;
297
+ adjustment?: {
298
+ amount: number;
299
+ type: "price" | "fixed_amount" | "percentage";
300
+ } | undefined;
301
+ intervalFrequency?: string | undefined;
302
+ }[];
303
+ productId: number;
304
+ requiresSellingPlan: boolean;
305
+ variantId: number;
306
+ } | null | undefined;
307
+ purchaseOptions?: {
308
+ defaultChoice: {
309
+ mode: "one-time";
310
+ } | {
311
+ mode: "subscription";
312
+ sellingPlanId: number;
313
+ };
314
+ modes: ("one-time" | "subscription")[];
315
+ selector: "radio" | "dropdown";
316
+ } | undefined;
317
+ variantCatalog?: {
318
+ displayMode: "single" | "separate";
319
+ options: {
320
+ name: string;
321
+ values: string[];
322
+ id: number;
323
+ position: number;
324
+ }[];
325
+ productId: number;
326
+ showSelectors: boolean;
327
+ variants: {
328
+ available: boolean;
329
+ id: number;
330
+ title: string;
331
+ option1?: string | undefined;
332
+ option2?: string | null | undefined;
333
+ option3?: string | null | undefined;
334
+ imageId?: number | null | undefined;
335
+ }[];
336
+ } | undefined;
337
+ } | {
338
+ initialVariant: {
339
+ variantId: number;
340
+ };
341
+ preparation: {
342
+ reason: string;
343
+ status: "unsupported";
344
+ };
345
+ sections: null;
346
+ groupCatalog?: {
347
+ memberProductId: number;
348
+ options: {
349
+ productId: number;
350
+ title: string;
351
+ variantCatalog: {
352
+ displayMode: "single" | "separate";
353
+ options: {
354
+ name: string;
355
+ values: string[];
356
+ id: number;
357
+ position: number;
358
+ }[];
359
+ productId: number;
360
+ showSelectors: boolean;
361
+ variants: {
362
+ available: boolean;
363
+ id: number;
364
+ title: string;
365
+ option1?: string | undefined;
366
+ option2?: string | null | undefined;
367
+ option3?: string | null | undefined;
368
+ imageId?: number | null | undefined;
369
+ }[];
370
+ };
371
+ }[];
372
+ } | undefined;
373
+ planCatalog?: {
374
+ plans: {
375
+ id: number;
376
+ intervalLabel: string;
377
+ name: string;
378
+ adjustment?: {
379
+ amount: number;
380
+ type: "price" | "fixed_amount" | "percentage";
381
+ } | undefined;
382
+ intervalFrequency?: string | undefined;
383
+ }[];
384
+ productId: number;
385
+ requiresSellingPlan: boolean;
386
+ variantId: number;
387
+ } | null | undefined;
388
+ purchaseOptions?: {
389
+ defaultChoice: {
390
+ mode: "one-time";
391
+ } | {
392
+ mode: "subscription";
393
+ sellingPlanId: number;
394
+ };
395
+ modes: ("one-time" | "subscription")[];
396
+ selector: "radio" | "dropdown";
397
+ } | undefined;
398
+ variantCatalog?: {
399
+ displayMode: "single" | "separate";
400
+ options: {
401
+ name: string;
402
+ values: string[];
403
+ id: number;
404
+ position: number;
405
+ }[];
406
+ productId: number;
407
+ showSelectors: boolean;
408
+ variants: {
409
+ available: boolean;
410
+ id: number;
411
+ title: string;
412
+ option1?: string | undefined;
413
+ option2?: string | null | undefined;
414
+ option3?: string | null | undefined;
415
+ imageId?: number | null | undefined;
416
+ }[];
417
+ } | undefined;
418
+ };
419
+ groupCatalog: {
420
+ memberProductId: number;
421
+ options: {
422
+ productId: number;
423
+ title: string;
424
+ variantCatalog: {
425
+ displayMode: "single" | "separate";
426
+ options: {
427
+ name: string;
428
+ values: string[];
429
+ id: number;
430
+ position: number;
431
+ }[];
432
+ productId: number;
433
+ showSelectors: boolean;
434
+ variants: {
435
+ available: boolean;
436
+ id: number;
437
+ title: string;
438
+ option1?: string | undefined;
439
+ option2?: string | null | undefined;
440
+ option3?: string | null | undefined;
441
+ imageId?: number | null | undefined;
442
+ }[];
443
+ };
444
+ }[];
445
+ };
446
+ memberProductId: number;
447
+ productIndex: number;
448
+ reportingProduct: {
449
+ id: number;
450
+ title: string;
451
+ };
452
+ quantityPolicy: {
453
+ enabled: boolean;
454
+ initialQuantity: number;
455
+ maxValue: number;
456
+ minValue: number;
457
+ };
458
+ productId: number;
459
+ } | null;