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