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