@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,442 @@
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
+ shouldShowSavingText: boolean;
110
+ description: string | null;
111
+ descriptionDocument?: {
112
+ attrs: {
113
+ blockSpacing?: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose" | undefined;
114
+ };
115
+ content: never[] | {
116
+ attrs: {
117
+ textAlign?: "start" | "center" | "end" | undefined;
118
+ };
119
+ content: never[] | {
120
+ text: string;
121
+ type: "text";
122
+ marks?: never[] | ({
123
+ type: "bold";
124
+ } | {
125
+ type: "italic";
126
+ } | {
127
+ attrs: {
128
+ class: string | null;
129
+ href: string;
130
+ rel: string;
131
+ target: string;
132
+ };
133
+ type: "link";
134
+ } | {
135
+ type: "strike";
136
+ } | {
137
+ attrs: {
138
+ color: "success" | "warning" | "critical" | "base" | "decorative" | "subdued" | "accent";
139
+ fontSize: "small" | "base" | "large" | "medium" | "extraSmall" | "extraLarge" | "heading";
140
+ };
141
+ type: "textStyle";
142
+ })[] | undefined;
143
+ }[];
144
+ type: "paragraph";
145
+ }[];
146
+ type: "doc";
147
+ } | undefined;
148
+ gallery?: {
149
+ images: {
150
+ description: string;
151
+ id: number;
152
+ source: string;
153
+ thumbnail: string;
154
+ }[];
155
+ selectedImageId?: number | undefined;
156
+ } | undefined;
157
+ };
158
+ };
159
+ sections: {
160
+ alignment: {
161
+ horizontal: "start" | "center" | "end";
162
+ vertical: "top" | "middle" | "bottom";
163
+ };
164
+ border: {
165
+ radius: "small" | "none" | "base" | "large" | "fullyRounded";
166
+ style: "none" | "base" | "dotted" | "dashed";
167
+ width: "base" | "medium" | "thick";
168
+ };
169
+ direction: "columns" | "rows" | "grid";
170
+ padding: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
171
+ sectionId: string;
172
+ sections: never[] | import("..").CABSection[];
173
+ sectionType: "layout";
174
+ spacing: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
175
+ width: number;
176
+ editorMode: "checkoutExtension" | "postPurchaseOffer" | "thankYouPage" | "orderStatusPage" | "ordersIndexPage" | "customerProfilePage";
177
+ previewMode: boolean;
178
+ storeId: number | null;
179
+ targetArea: {
180
+ icon: string;
181
+ label: string;
182
+ width: string;
183
+ fill?: boolean | undefined;
184
+ flip?: "vertical" | "horizontal" | "both" | undefined;
185
+ } | null;
186
+ tracking: {
187
+ enableAttribution: boolean;
188
+ enableSource: boolean;
189
+ enableWidget: boolean;
190
+ };
191
+ 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";
192
+ uiLabels: {
193
+ currentPage: Record<string, string>;
194
+ guest: Record<string, string>;
195
+ loadingOptions: Record<string, string>;
196
+ nextPage: Record<string, string>;
197
+ offerCarousel: Record<string, string>;
198
+ offerDialog: Record<string, string>;
199
+ page: Record<string, string>;
200
+ previousPage: Record<string, string>;
201
+ selected: Record<string, string>;
202
+ subscriptionOptions: Record<string, string>;
203
+ updating: Record<string, string>;
204
+ };
205
+ version: 2;
206
+ widgetId: number | null;
207
+ 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;
208
+ frame?: "callout" | "offer-content" | undefined;
209
+ grid?: {
210
+ columns: (string | number)[];
211
+ rows: (string | number)[];
212
+ } | undefined;
213
+ name?: string | undefined;
214
+ viewUrl?: string | undefined;
215
+ wrapping?: {
216
+ breakAt: number;
217
+ maxPerLine: number;
218
+ } | undefined;
219
+ mutators?: {
220
+ effect: "set_false" | "set_true" | "toggle";
221
+ variable: string;
222
+ when: {
223
+ operator: "is_empty" | "is_not_empty";
224
+ type: "content";
225
+ } | {
226
+ operator: "equals" | "greater_than" | "less_than";
227
+ type: "result_count";
228
+ value: number;
229
+ } | {
230
+ operator: "contains" | "does_not_contain";
231
+ type: "result_tag";
232
+ value: string;
233
+ } | {
234
+ event: "item_added" | "quantity_changed" | "variant_selected";
235
+ type: "event";
236
+ };
237
+ }[] | undefined;
238
+ variables?: ({
239
+ defaultValue: string;
240
+ name: string;
241
+ type: "text";
242
+ seed?: undefined;
243
+ } | {
244
+ defaultValue: number;
245
+ name: string;
246
+ type: "number";
247
+ seed?: undefined;
248
+ } | {
249
+ defaultValue: boolean;
250
+ name: string;
251
+ type: "boolean";
252
+ seed?: {
253
+ dataSourceId: number | null;
254
+ ruleset: {
255
+ exitIfMatched: boolean;
256
+ logic: {
257
+ rules: {
258
+ operator: "equals" | "greater_than" | "less_than" | "contains" | "does_not_contain" | "after" | "anything" | "before" | "contains_any" | "does_not_contain_any" | "does_not_equal";
259
+ products: never[] | unknown[];
260
+ 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";
261
+ value: string;
262
+ }[];
263
+ }[];
264
+ output: {
265
+ key: string;
266
+ type: "data_json";
267
+ value: string;
268
+ }[];
269
+ }[];
270
+ } | undefined;
271
+ })[] | undefined;
272
+ visibility?: {
273
+ variable: string;
274
+ visibleWhen: boolean;
275
+ } | undefined;
276
+ experiment?: {
277
+ elementId: number;
278
+ experimentId: number;
279
+ experimentType: string;
280
+ selectedId: number;
281
+ } | undefined;
282
+ };
283
+ groupCatalog?: {
284
+ memberProductId: number;
285
+ options: {
286
+ productId: number;
287
+ title: string;
288
+ variantCatalog: {
289
+ displayMode: "single" | "separate";
290
+ options: {
291
+ name: string;
292
+ values: string[];
293
+ id: number;
294
+ position: number;
295
+ }[];
296
+ productId: number;
297
+ showSelectors: boolean;
298
+ variants: {
299
+ available: boolean;
300
+ id: number;
301
+ title: string;
302
+ option1?: string | undefined;
303
+ option2?: string | null | undefined;
304
+ option3?: string | null | undefined;
305
+ imageId?: number | null | undefined;
306
+ }[];
307
+ };
308
+ }[];
309
+ } | undefined;
310
+ initialVariant?: {
311
+ variantId: number;
312
+ } | undefined;
313
+ planCatalog?: {
314
+ plans: {
315
+ id: number;
316
+ intervalLabel: string;
317
+ name: string;
318
+ adjustment?: {
319
+ amount: number;
320
+ type: "price" | "fixed_amount" | "percentage";
321
+ } | undefined;
322
+ intervalFrequency?: string | undefined;
323
+ }[];
324
+ productId: number;
325
+ requiresSellingPlan: boolean;
326
+ variantId: number;
327
+ } | null | undefined;
328
+ purchaseOptions?: {
329
+ defaultChoice: {
330
+ mode: "one-time";
331
+ } | {
332
+ mode: "subscription";
333
+ sellingPlanId: number;
334
+ };
335
+ modes: ("one-time" | "subscription")[];
336
+ selector: "radio" | "dropdown";
337
+ } | undefined;
338
+ variantCatalog?: {
339
+ displayMode: "single" | "separate";
340
+ options: {
341
+ name: string;
342
+ values: string[];
343
+ id: number;
344
+ position: number;
345
+ }[];
346
+ productId: number;
347
+ showSelectors: boolean;
348
+ variants: {
349
+ available: boolean;
350
+ id: number;
351
+ title: string;
352
+ option1?: string | undefined;
353
+ option2?: string | null | undefined;
354
+ option3?: string | null | undefined;
355
+ imageId?: number | null | undefined;
356
+ }[];
357
+ } | undefined;
358
+ } | {
359
+ preparation: {
360
+ reason: string;
361
+ status: "unsupported";
362
+ };
363
+ sections: null;
364
+ groupCatalog?: {
365
+ memberProductId: number;
366
+ options: {
367
+ productId: number;
368
+ title: string;
369
+ variantCatalog: {
370
+ displayMode: "single" | "separate";
371
+ options: {
372
+ name: string;
373
+ values: string[];
374
+ id: number;
375
+ position: number;
376
+ }[];
377
+ productId: number;
378
+ showSelectors: boolean;
379
+ variants: {
380
+ available: boolean;
381
+ id: number;
382
+ title: string;
383
+ option1?: string | undefined;
384
+ option2?: string | null | undefined;
385
+ option3?: string | null | undefined;
386
+ imageId?: number | null | undefined;
387
+ }[];
388
+ };
389
+ }[];
390
+ } | undefined;
391
+ initialVariant?: {
392
+ variantId: number;
393
+ } | undefined;
394
+ planCatalog?: {
395
+ plans: {
396
+ id: number;
397
+ intervalLabel: string;
398
+ name: string;
399
+ adjustment?: {
400
+ amount: number;
401
+ type: "price" | "fixed_amount" | "percentage";
402
+ } | undefined;
403
+ intervalFrequency?: string | undefined;
404
+ }[];
405
+ productId: number;
406
+ requiresSellingPlan: boolean;
407
+ variantId: number;
408
+ } | null | undefined;
409
+ purchaseOptions?: {
410
+ defaultChoice: {
411
+ mode: "one-time";
412
+ } | {
413
+ mode: "subscription";
414
+ sellingPlanId: number;
415
+ };
416
+ modes: ("one-time" | "subscription")[];
417
+ selector: "radio" | "dropdown";
418
+ } | undefined;
419
+ variantCatalog?: {
420
+ displayMode: "single" | "separate";
421
+ options: {
422
+ name: string;
423
+ values: string[];
424
+ id: number;
425
+ position: number;
426
+ }[];
427
+ productId: number;
428
+ showSelectors: boolean;
429
+ variants: {
430
+ available: boolean;
431
+ id: number;
432
+ title: string;
433
+ option1?: string | undefined;
434
+ option2?: string | null | undefined;
435
+ option3?: string | null | undefined;
436
+ imageId?: number | null | undefined;
437
+ }[];
438
+ } | undefined;
439
+ };
440
+ }[];
441
+ };
442
+ export {};