@rebuy/rebuy 3.51.0 → 3.52.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.
package/dist/index.cjs CHANGED
@@ -1714,7 +1714,13 @@ var OfferProduct = import_zod5.z.object({
1714
1714
  discount: OfferProductDiscount.optional(),
1715
1715
  id: import_zod5.z.number(),
1716
1716
  image: import_zod5.z.object({ src: import_zod5.z.string() }).nullish(),
1717
- images: import_zod5.z.array(import_zod5.z.object({ src: import_zod5.z.string(), variantIds: import_zod5.z.array(import_zod5.z.number()) })).nullish(),
1717
+ /**
1718
+ * `variantIds` is optional: the engine omits `variant_ids` (rather than sending `[]`) on an image tied to no
1719
+ * variant — seen live on the `recommended` data source while `top_sellers` sends `[]` for the same image
1720
+ * (REB-24958). A missing list means "not variant-specific", exactly like `[]`, so the image keeps its `src`
1721
+ * and the product is never dropped over it.
1722
+ */
1723
+ images: import_zod5.z.array(import_zod5.z.object({ src: import_zod5.z.string(), variantIds: import_zod5.z.array(import_zod5.z.number()).optional() })).nullish(),
1718
1724
  link: import_zod5.z.string().optional(),
1719
1725
  metafields: import_zod5.z.array(import_zod5.z.object({ key: import_zod5.z.string(), namespace: import_zod5.z.string(), value: import_zod5.z.string() })).optional(),
1720
1726
  options: import_zod5.z.array(OfferProductOption),
@@ -1777,6 +1783,12 @@ var import_zod18 = require("zod");
1777
1783
  // src/schema/postPurchaseProductGallery.ts
1778
1784
  var import_zod9 = require("zod");
1779
1785
  var PostPurchaseProductGallery = import_zod9.z.object({
1786
+ /**
1787
+ * The product had more than one image before `images` was capped at the sub-image limit, so a
1788
+ * renderer shows the thumbnail row even when the cap leaves one image (legacy checks the count
1789
+ * before slicing). Older replies omit it; fall back to `images.length > 1`.
1790
+ */
1791
+ hasMultiple: import_zod9.z.boolean().optional(),
1780
1792
  images: import_zod9.z.array(
1781
1793
  import_zod9.z.object({
1782
1794
  description: import_zod9.z.string(),
package/dist/index.mjs CHANGED
@@ -1242,7 +1242,13 @@ var OfferProduct = z5.object({
1242
1242
  discount: OfferProductDiscount.optional(),
1243
1243
  id: z5.number(),
1244
1244
  image: z5.object({ src: z5.string() }).nullish(),
1245
- images: z5.array(z5.object({ src: z5.string(), variantIds: z5.array(z5.number()) })).nullish(),
1245
+ /**
1246
+ * `variantIds` is optional: the engine omits `variant_ids` (rather than sending `[]`) on an image tied to no
1247
+ * variant — seen live on the `recommended` data source while `top_sellers` sends `[]` for the same image
1248
+ * (REB-24958). A missing list means "not variant-specific", exactly like `[]`, so the image keeps its `src`
1249
+ * and the product is never dropped over it.
1250
+ */
1251
+ images: z5.array(z5.object({ src: z5.string(), variantIds: z5.array(z5.number()).optional() })).nullish(),
1246
1252
  link: z5.string().optional(),
1247
1253
  metafields: z5.array(z5.object({ key: z5.string(), namespace: z5.string(), value: z5.string() })).optional(),
1248
1254
  options: z5.array(OfferProductOption),
@@ -1305,6 +1311,12 @@ import { z as z18 } from "zod";
1305
1311
  // src/schema/postPurchaseProductGallery.ts
1306
1312
  import { z as z9 } from "zod";
1307
1313
  var PostPurchaseProductGallery = z9.object({
1314
+ /**
1315
+ * The product had more than one image before `images` was capped at the sub-image limit, so a
1316
+ * renderer shows the thumbnail row even when the cap leaves one image (legacy checks the count
1317
+ * before slicing). Older replies omit it; fall back to `images.length > 1`.
1318
+ */
1319
+ hasMultiple: z9.boolean().optional(),
1308
1320
  images: z9.array(
1309
1321
  z9.object({
1310
1322
  description: z9.string(),
@@ -21,7 +21,7 @@ export declare const OfferProduct: z.ZodObject<{
21
21
  }, z.core.$strip>>>;
22
22
  images: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
23
23
  src: z.ZodString;
24
- variantIds: z.ZodArray<z.ZodNumber>;
24
+ variantIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
25
25
  }, z.core.$strip>>>>;
26
26
  link: z.ZodOptional<z.ZodString>;
27
27
  metafields: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -51,6 +51,7 @@ export declare const PreparedPostPurchaseProduct: z.ZodObject<{
51
51
  compare_at_price: "compare_at_price";
52
52
  }>>>;
53
53
  gallery: z.ZodOptional<z.ZodObject<{
54
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
54
55
  images: z.ZodArray<z.ZodObject<{
55
56
  description: z.ZodString;
56
57
  id: z.ZodNumber;
@@ -215,6 +216,7 @@ export declare const PostPurchasePreparation: z.ZodDiscriminatedUnion<[z.ZodObje
215
216
  compare_at_price: "compare_at_price";
216
217
  }>>>;
217
218
  gallery: z.ZodOptional<z.ZodObject<{
219
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
218
220
  images: z.ZodArray<z.ZodObject<{
219
221
  description: z.ZodString;
220
222
  id: z.ZodNumber;
@@ -230,6 +230,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
230
230
  compare_at_price: "compare_at_price";
231
231
  }>>>;
232
232
  gallery: z.ZodOptional<z.ZodObject<{
233
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
233
234
  images: z.ZodArray<z.ZodObject<{
234
235
  description: z.ZodString;
235
236
  id: z.ZodNumber;
@@ -51,6 +51,7 @@ export declare const PostPurchaseProductDisplay: z.ZodObject<{
51
51
  compare_at_price: "compare_at_price";
52
52
  }>>>;
53
53
  gallery: z.ZodOptional<z.ZodObject<{
54
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
54
55
  images: z.ZodArray<z.ZodObject<{
55
56
  description: z.ZodString;
56
57
  id: z.ZodNumber;
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const PostPurchaseProductGallery: z.ZodObject<{
3
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
3
4
  images: z.ZodArray<z.ZodObject<{
4
5
  description: z.ZodString;
5
6
  id: z.ZodNumber;
@@ -233,6 +233,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
233
233
  compare_at_price: "compare_at_price";
234
234
  }>>>;
235
235
  gallery: z.ZodOptional<z.ZodObject<{
236
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
236
237
  images: z.ZodArray<z.ZodObject<{
237
238
  description: z.ZodString;
238
239
  id: z.ZodNumber;
@@ -44,6 +44,7 @@ export declare const PreparedPostPurchaseSubscription: z.ZodObject<{
44
44
  compare_at_price: "compare_at_price";
45
45
  }>>>;
46
46
  gallery: z.ZodOptional<z.ZodObject<{
47
+ hasMultiple: z.ZodOptional<z.ZodBoolean>;
47
48
  images: z.ZodArray<z.ZodObject<{
48
49
  description: z.ZodString;
49
50
  id: z.ZodNumber;
@@ -240,6 +241,7 @@ export declare const readPostPurchaseSubscription: (prepared: z.infer<typeof Pre
240
241
  source: string;
241
242
  thumbnail: string;
242
243
  }[];
244
+ hasMultiple?: boolean | undefined;
243
245
  selectedImageId?: number | undefined;
244
246
  } | undefined;
245
247
  };
@@ -387,7 +387,13 @@ var OfferProduct = import_zod3.z.object({
387
387
  discount: OfferProductDiscount.optional(),
388
388
  id: import_zod3.z.number(),
389
389
  image: import_zod3.z.object({ src: import_zod3.z.string() }).nullish(),
390
- images: import_zod3.z.array(import_zod3.z.object({ src: import_zod3.z.string(), variantIds: import_zod3.z.array(import_zod3.z.number()) })).nullish(),
390
+ /**
391
+ * `variantIds` is optional: the engine omits `variant_ids` (rather than sending `[]`) on an image tied to no
392
+ * variant — seen live on the `recommended` data source while `top_sellers` sends `[]` for the same image
393
+ * (REB-24958). A missing list means "not variant-specific", exactly like `[]`, so the image keeps its `src`
394
+ * and the product is never dropped over it.
395
+ */
396
+ images: import_zod3.z.array(import_zod3.z.object({ src: import_zod3.z.string(), variantIds: import_zod3.z.array(import_zod3.z.number()).optional() })).nullish(),
391
397
  link: import_zod3.z.string().optional(),
392
398
  metafields: import_zod3.z.array(import_zod3.z.object({ key: import_zod3.z.string(), namespace: import_zod3.z.string(), value: import_zod3.z.string() })).optional(),
393
399
  options: import_zod3.z.array(OfferProductOption),
@@ -6362,6 +6368,12 @@ var import_zod54 = require("zod");
6362
6368
  // src/schema/postPurchaseProductGallery.ts
6363
6369
  var import_zod52 = require("zod");
6364
6370
  var PostPurchaseProductGallery = import_zod52.z.object({
6371
+ /**
6372
+ * The product had more than one image before `images` was capped at the sub-image limit, so a
6373
+ * renderer shows the thumbnail row even when the cap leaves one image (legacy checks the count
6374
+ * before slicing). Older replies omit it; fall back to `images.length > 1`.
6375
+ */
6376
+ hasMultiple: import_zod52.z.boolean().optional(),
6365
6377
  images: import_zod52.z.array(
6366
6378
  import_zod52.z.object({
6367
6379
  description: import_zod52.z.string(),
@@ -6555,6 +6567,7 @@ var postPurchasePrimaryImage = (product) => {
6555
6567
 
6556
6568
  // src/server/postPurchaseProductGallery.ts
6557
6569
  var postPurchaseProductGallery = (product, limit) => ({
6570
+ hasMultiple: (product.images?.length ?? 0) > 1,
6558
6571
  images: (product.images ?? []).slice(0, limit ?? 0).map((image) => ({
6559
6572
  description: image.alt ?? product.title,
6560
6573
  id: image.id,
@@ -315,7 +315,13 @@ var OfferProduct = z3.object({
315
315
  discount: OfferProductDiscount.optional(),
316
316
  id: z3.number(),
317
317
  image: z3.object({ src: z3.string() }).nullish(),
318
- images: z3.array(z3.object({ src: z3.string(), variantIds: z3.array(z3.number()) })).nullish(),
318
+ /**
319
+ * `variantIds` is optional: the engine omits `variant_ids` (rather than sending `[]`) on an image tied to no
320
+ * variant — seen live on the `recommended` data source while `top_sellers` sends `[]` for the same image
321
+ * (REB-24958). A missing list means "not variant-specific", exactly like `[]`, so the image keeps its `src`
322
+ * and the product is never dropped over it.
323
+ */
324
+ images: z3.array(z3.object({ src: z3.string(), variantIds: z3.array(z3.number()).optional() })).nullish(),
319
325
  link: z3.string().optional(),
320
326
  metafields: z3.array(z3.object({ key: z3.string(), namespace: z3.string(), value: z3.string() })).optional(),
321
327
  options: z3.array(OfferProductOption),
@@ -6290,6 +6296,12 @@ import { z as z54 } from "zod";
6290
6296
  // src/schema/postPurchaseProductGallery.ts
6291
6297
  import { z as z52 } from "zod";
6292
6298
  var PostPurchaseProductGallery = z52.object({
6299
+ /**
6300
+ * The product had more than one image before `images` was capped at the sub-image limit, so a
6301
+ * renderer shows the thumbnail row even when the cap leaves one image (legacy checks the count
6302
+ * before slicing). Older replies omit it; fall back to `images.length > 1`.
6303
+ */
6304
+ hasMultiple: z52.boolean().optional(),
6293
6305
  images: z52.array(
6294
6306
  z52.object({
6295
6307
  description: z52.string(),
@@ -6483,6 +6495,7 @@ var postPurchasePrimaryImage = (product) => {
6483
6495
 
6484
6496
  // src/server/postPurchaseProductGallery.ts
6485
6497
  var postPurchaseProductGallery = (product, limit) => ({
6498
+ hasMultiple: (product.images?.length ?? 0) > 1,
6486
6499
  images: (product.images ?? []).slice(0, limit ?? 0).map((image) => ({
6487
6500
  description: image.alt ?? product.title,
6488
6501
  id: image.id,
@@ -78,6 +78,7 @@ export declare const projectPostPurchaseProductDisplay: (effective: PostPurchase
78
78
  source: string;
79
79
  thumbnail: string;
80
80
  }[];
81
+ hasMultiple?: boolean | undefined;
81
82
  selectedImageId?: number | undefined;
82
83
  } | undefined;
83
84
  };
@@ -1,5 +1,8 @@
1
1
  import type { PostPurchaseProductGallery } from '../schema/postPurchaseProductGallery';
2
2
  import type { PostPurchaseProductSettings } from '../schema/postPurchaseProductSettings';
3
3
  import type { PostPurchaseProductSource } from '../schema/postPurchaseProductSource';
4
- /** Display-only catalog facts (L67); a selected image may lie outside the configured thumbnail limit. */
4
+ /**
5
+ * Display-only catalog facts (L67); a selected image may lie outside the configured thumbnail limit, and
6
+ * `hasMultiple` counts the images before the limit applies (legacy ProductOffer).
7
+ */
5
8
  export declare const postPurchaseProductGallery: (product: PostPurchaseProductSource["data"][number], limit: PostPurchaseProductSettings["subImages"]) => PostPurchaseProductGallery;
@@ -141,6 +141,7 @@ export declare const preparePostPurchaseAdmissionView: (widgetId: number, settin
141
141
  source: string;
142
142
  thumbnail: string;
143
143
  }[];
144
+ hasMultiple?: boolean | undefined;
144
145
  selectedImageId?: number | undefined;
145
146
  } | undefined;
146
147
  };
@@ -181,6 +181,7 @@ export declare const preparePostPurchaseCollectionGroup: (widgetId: number, sett
181
181
  source: string;
182
182
  thumbnail: string;
183
183
  }[];
184
+ hasMultiple?: boolean | undefined;
184
185
  selectedImageId?: number | undefined;
185
186
  } | undefined;
186
187
  };
@@ -163,6 +163,7 @@ export declare const preparePostPurchaseCollectionView: (widgetId: number, setti
163
163
  source: string;
164
164
  thumbnail: string;
165
165
  }[];
166
+ hasMultiple?: boolean | undefined;
166
167
  selectedImageId?: number | undefined;
167
168
  } | undefined;
168
169
  };
@@ -182,6 +182,7 @@ export declare const preparePostPurchaseGroupAdmissionView: (widgetId: number, s
182
182
  source: string;
183
183
  thumbnail: string;
184
184
  }[];
185
+ hasMultiple?: boolean | undefined;
185
186
  selectedImageId?: number | undefined;
186
187
  } | undefined;
187
188
  };
@@ -145,6 +145,7 @@ export declare const preparePostPurchaseGroupDefault: (widgetId: number, setting
145
145
  source: string;
146
146
  thumbnail: string;
147
147
  }[];
148
+ hasMultiple?: boolean | undefined;
148
149
  selectedImageId?: number | undefined;
149
150
  } | undefined;
150
151
  };
@@ -181,6 +181,7 @@ export declare const preparePostPurchaseGroupView: (widgetId: number, settings:
181
181
  source: string;
182
182
  thumbnail: string;
183
183
  }[];
184
+ hasMultiple?: boolean | undefined;
184
185
  selectedImageId?: number | undefined;
185
186
  } | undefined;
186
187
  };
@@ -144,6 +144,7 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
144
144
  source: string;
145
145
  thumbnail: string;
146
146
  }[];
147
+ hasMultiple?: boolean | undefined;
147
148
  selectedImageId?: number | undefined;
148
149
  } | undefined;
149
150
  };
@@ -957,6 +958,7 @@ export declare const preparePostPurchaseMemberView: (widgetId: number, settings:
957
958
  source: string;
958
959
  thumbnail: string;
959
960
  }[];
961
+ hasMultiple?: boolean | undefined;
960
962
  selectedImageId?: number | undefined;
961
963
  } | undefined;
962
964
  };
@@ -1561,6 +1563,7 @@ export declare const preparePostPurchaseMemberAdmissionView: (widgetId: number,
1561
1563
  source: string;
1562
1564
  thumbnail: string;
1563
1565
  }[];
1566
+ hasMultiple?: boolean | undefined;
1564
1567
  selectedImageId?: number | undefined;
1565
1568
  } | undefined;
1566
1569
  };
@@ -162,6 +162,7 @@ export declare const preparePostPurchaseQuantityAdmissionView: (widgetId: number
162
162
  source: string;
163
163
  thumbnail: string;
164
164
  }[];
165
+ hasMultiple?: boolean | undefined;
165
166
  selectedImageId?: number | undefined;
166
167
  } | undefined;
167
168
  };
@@ -150,6 +150,7 @@ export declare const preparePostPurchaseQuantityView: (widgetId: number, setting
150
150
  source: string;
151
151
  thumbnail: string;
152
152
  }[];
153
+ hasMultiple?: boolean | undefined;
153
154
  selectedImageId?: number | undefined;
154
155
  } | undefined;
155
156
  };
@@ -75,6 +75,7 @@ export declare const preparePostPurchaseSubscription: (settings: unknown, respon
75
75
  source: string;
76
76
  thumbnail: string;
77
77
  }[];
78
+ hasMultiple?: boolean | undefined;
78
79
  selectedImageId?: number | undefined;
79
80
  } | undefined;
80
81
  };
@@ -81,6 +81,7 @@ export declare const projectPostPurchaseProduct: ({ data, effective, metadata, o
81
81
  source: string;
82
82
  thumbnail: string;
83
83
  }[];
84
+ hasMultiple?: boolean | undefined;
84
85
  selectedImageId?: number | undefined;
85
86
  } | undefined;
86
87
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebuy/rebuy",
3
- "version": "3.51.0",
3
+ "version": "3.52.0",
4
4
  "description": "Shared zod schemas, legacy-to-CAB widget transforms, and server orchestrators for Rebuy's Shopify consumers (rebuy-api, admin-nextjs, rebuy-shopify-extensions)",
5
5
  "license": "MIT",
6
6
  "author": "Rebuy, Inc.",