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