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