@rebuy/rebuy 3.6.0 → 3.7.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
@@ -1409,7 +1409,29 @@ var Metadata = import_zod4.z.object({
1409
1409
  unmatchedRules: import_zod4.z.array(MatchedRule).optional(),
1410
1410
  widget: import_zod4.z.object({
1411
1411
  discount: import_zod4.z.object({ amount: import_zod4.z.string(), type: import_zod4.z.string() }).optional(),
1412
- language: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.string()).optional()
1412
+ /**
1413
+ * Data-source-authored text content, dual-purpose in the CAB renderer (rebuy-shopify-extensions'
1414
+ * `checkout-and-beyond`): every key becomes a `{{token}}` for the interpolation pass
1415
+ * (`extractDataVariables`), e.g. `{ superTitle: 'Limited drop' }` resolves `{{superTitle}}`
1416
+ * anywhere in the widget's copy, and the legacy add-to-order state keys (`extractLabelOverrides`)
1417
+ * plus `variantOption`/`variantOptions` (`extractVariantLabels`) additionally keep their
1418
+ * whole-label override behavior. The serve path passes metadata through verbatim
1419
+ * (`fetchDataSourceResults` only camelCases keys, which lands snake_case names in the canonical
1420
+ * token grammar); this schema is the contract of record. Parsing mirrors the renderer's
1421
+ * fail-safe: an entry whose value is not a string or finite number — a data-source author's
1422
+ * `null`, boolean, object, or a computed `NaN`/`Infinity` — is dropped at parse time rather
1423
+ * than failing the whole `Metadata` block or rendering `[object Object]` (or a literal `NaN`)
1424
+ * into buyer copy. Booleans stay excluded on purpose (unlike
1425
+ * `Output.value` above, this is buyer-facing copy); an empty string is kept — it deliberately
1426
+ * blanks a token.
1427
+ */
1428
+ language: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).transform(
1429
+ (raw) => Object.fromEntries(
1430
+ Object.entries(raw).filter(
1431
+ (entry) => typeof entry[1] === "string" || Number.isFinite(entry[1])
1432
+ )
1433
+ )
1434
+ ).optional()
1413
1435
  }).optional()
1414
1436
  });
1415
1437
 
package/dist/index.mjs CHANGED
@@ -1128,7 +1128,29 @@ var Metadata = z4.object({
1128
1128
  unmatchedRules: z4.array(MatchedRule).optional(),
1129
1129
  widget: z4.object({
1130
1130
  discount: z4.object({ amount: z4.string(), type: z4.string() }).optional(),
1131
- language: z4.record(z4.string(), z4.string()).optional()
1131
+ /**
1132
+ * Data-source-authored text content, dual-purpose in the CAB renderer (rebuy-shopify-extensions'
1133
+ * `checkout-and-beyond`): every key becomes a `{{token}}` for the interpolation pass
1134
+ * (`extractDataVariables`), e.g. `{ superTitle: 'Limited drop' }` resolves `{{superTitle}}`
1135
+ * anywhere in the widget's copy, and the legacy add-to-order state keys (`extractLabelOverrides`)
1136
+ * plus `variantOption`/`variantOptions` (`extractVariantLabels`) additionally keep their
1137
+ * whole-label override behavior. The serve path passes metadata through verbatim
1138
+ * (`fetchDataSourceResults` only camelCases keys, which lands snake_case names in the canonical
1139
+ * token grammar); this schema is the contract of record. Parsing mirrors the renderer's
1140
+ * fail-safe: an entry whose value is not a string or finite number — a data-source author's
1141
+ * `null`, boolean, object, or a computed `NaN`/`Infinity` — is dropped at parse time rather
1142
+ * than failing the whole `Metadata` block or rendering `[object Object]` (or a literal `NaN`)
1143
+ * into buyer copy. Booleans stay excluded on purpose (unlike
1144
+ * `Output.value` above, this is buyer-facing copy); an empty string is kept — it deliberately
1145
+ * blanks a token.
1146
+ */
1147
+ language: z4.record(z4.string(), z4.unknown()).transform(
1148
+ (raw) => Object.fromEntries(
1149
+ Object.entries(raw).filter(
1150
+ (entry) => typeof entry[1] === "string" || Number.isFinite(entry[1])
1151
+ )
1152
+ )
1153
+ ).optional()
1132
1154
  }).optional()
1133
1155
  });
1134
1156
 
@@ -665,7 +665,9 @@ export declare const Metadata: z.ZodObject<{
665
665
  amount: z.ZodString;
666
666
  type: z.ZodString;
667
667
  }, z.core.$strip>>;
668
- language: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
668
+ language: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodTransform<{
669
+ [k: string]: string | number;
670
+ }, Record<string, unknown>>>>;
669
671
  }, z.core.$strip>>;
670
672
  }, z.core.$strip>;
671
673
  export type Metadata = z.infer<typeof Metadata>;
@@ -301,7 +301,29 @@ var Metadata = import_zod2.z.object({
301
301
  unmatchedRules: import_zod2.z.array(MatchedRule).optional(),
302
302
  widget: import_zod2.z.object({
303
303
  discount: import_zod2.z.object({ amount: import_zod2.z.string(), type: import_zod2.z.string() }).optional(),
304
- language: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional()
304
+ /**
305
+ * Data-source-authored text content, dual-purpose in the CAB renderer (rebuy-shopify-extensions'
306
+ * `checkout-and-beyond`): every key becomes a `{{token}}` for the interpolation pass
307
+ * (`extractDataVariables`), e.g. `{ superTitle: 'Limited drop' }` resolves `{{superTitle}}`
308
+ * anywhere in the widget's copy, and the legacy add-to-order state keys (`extractLabelOverrides`)
309
+ * plus `variantOption`/`variantOptions` (`extractVariantLabels`) additionally keep their
310
+ * whole-label override behavior. The serve path passes metadata through verbatim
311
+ * (`fetchDataSourceResults` only camelCases keys, which lands snake_case names in the canonical
312
+ * token grammar); this schema is the contract of record. Parsing mirrors the renderer's
313
+ * fail-safe: an entry whose value is not a string or finite number — a data-source author's
314
+ * `null`, boolean, object, or a computed `NaN`/`Infinity` — is dropped at parse time rather
315
+ * than failing the whole `Metadata` block or rendering `[object Object]` (or a literal `NaN`)
316
+ * into buyer copy. Booleans stay excluded on purpose (unlike
317
+ * `Output.value` above, this is buyer-facing copy); an empty string is kept — it deliberately
318
+ * blanks a token.
319
+ */
320
+ language: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.unknown()).transform(
321
+ (raw) => Object.fromEntries(
322
+ Object.entries(raw).filter(
323
+ (entry) => typeof entry[1] === "string" || Number.isFinite(entry[1])
324
+ )
325
+ )
326
+ ).optional()
305
327
  }).optional()
306
328
  });
307
329
 
@@ -253,7 +253,29 @@ var Metadata = z2.object({
253
253
  unmatchedRules: z2.array(MatchedRule).optional(),
254
254
  widget: z2.object({
255
255
  discount: z2.object({ amount: z2.string(), type: z2.string() }).optional(),
256
- language: z2.record(z2.string(), z2.string()).optional()
256
+ /**
257
+ * Data-source-authored text content, dual-purpose in the CAB renderer (rebuy-shopify-extensions'
258
+ * `checkout-and-beyond`): every key becomes a `{{token}}` for the interpolation pass
259
+ * (`extractDataVariables`), e.g. `{ superTitle: 'Limited drop' }` resolves `{{superTitle}}`
260
+ * anywhere in the widget's copy, and the legacy add-to-order state keys (`extractLabelOverrides`)
261
+ * plus `variantOption`/`variantOptions` (`extractVariantLabels`) additionally keep their
262
+ * whole-label override behavior. The serve path passes metadata through verbatim
263
+ * (`fetchDataSourceResults` only camelCases keys, which lands snake_case names in the canonical
264
+ * token grammar); this schema is the contract of record. Parsing mirrors the renderer's
265
+ * fail-safe: an entry whose value is not a string or finite number — a data-source author's
266
+ * `null`, boolean, object, or a computed `NaN`/`Infinity` — is dropped at parse time rather
267
+ * than failing the whole `Metadata` block or rendering `[object Object]` (or a literal `NaN`)
268
+ * into buyer copy. Booleans stay excluded on purpose (unlike
269
+ * `Output.value` above, this is buyer-facing copy); an empty string is kept — it deliberately
270
+ * blanks a token.
271
+ */
272
+ language: z2.record(z2.string(), z2.unknown()).transform(
273
+ (raw) => Object.fromEntries(
274
+ Object.entries(raw).filter(
275
+ (entry) => typeof entry[1] === "string" || Number.isFinite(entry[1])
276
+ )
277
+ )
278
+ ).optional()
257
279
  }).optional()
258
280
  });
259
281
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebuy/rebuy",
3
- "version": "3.6.0",
3
+ "version": "3.7.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.",