@rebuy/rebuy 3.9.0 → 3.10.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 (37) hide show
  1. package/dist/index.cjs +49 -13
  2. package/dist/index.mjs +49 -13
  3. package/dist/schema/checkout-and-beyond/constants.cjs +4 -0
  4. package/dist/schema/checkout-and-beyond/constants.mjs +4 -0
  5. package/dist/schema/checkout-and-beyond/index.cjs +27 -6
  6. package/dist/schema/checkout-and-beyond/index.mjs +27 -6
  7. package/dist/schema/widget-data.cjs +22 -6
  8. package/dist/schema/widget-data.mjs +22 -6
  9. package/dist/schema/widgetData.d.ts +108 -9
  10. package/dist/schema/widgets/checkout-and-beyond/banner.d.ts +36 -3
  11. package/dist/schema/widgets/checkout-and-beyond/button.d.ts +36 -3
  12. package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts +36 -3
  13. package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts +36 -3
  14. package/dist/schema/widgets/checkout-and-beyond/common.d.ts +13 -0
  15. package/dist/schema/widgets/checkout-and-beyond/discount.d.ts +36 -3
  16. package/dist/schema/widgets/checkout-and-beyond/image.d.ts +72 -6
  17. package/dist/schema/widgets/checkout-and-beyond/layout.d.ts +36 -3
  18. package/dist/schema/widgets/checkout-and-beyond/monetize.d.ts +36 -3
  19. package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +36 -3
  20. package/dist/schema/widgets/checkout-and-beyond/product.d.ts +36 -3
  21. package/dist/schema/widgets/checkout-and-beyond/products.d.ts +72 -6
  22. package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +36 -3
  23. package/dist/schema/widgets/checkout-and-beyond/quantity.d.ts +36 -3
  24. package/dist/schema/widgets/checkout-and-beyond/reviews.d.ts +36 -3
  25. package/dist/schema/widgets/checkout-and-beyond/root.d.ts +36 -3
  26. package/dist/schema/widgets/checkout-and-beyond/text.d.ts +36 -3
  27. package/dist/schema/widgets/checkout-and-beyond/variables.d.ts +191 -10
  28. package/dist/schema/widgets/checkout-and-beyond/variants.d.ts +36 -3
  29. package/dist/schema/widgets/contentBlock.d.ts +36 -3
  30. package/dist/schema/widgets/lineItemEditor.d.ts +36 -3
  31. package/dist/schema/widgets/rebuyButton.d.ts +36 -3
  32. package/dist/server/index.cjs +44 -13
  33. package/dist/server/index.mjs +44 -13
  34. package/dist/transforms/contentBlockV1/convertContentBlockTextToV2.d.ts +9 -1
  35. package/dist/transforms/index.cjs +44 -13
  36. package/dist/transforms/index.mjs +44 -13
  37. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -32,6 +32,7 @@ __export(src_exports, {
32
32
  ButtonField: () => ButtonField,
33
33
  ButtonStyle: () => ButtonStyle,
34
34
  CABBannerSection: () => CABBannerSection,
35
+ CABBooleanVariable: () => CABBooleanVariable,
35
36
  CABBorder: () => CABBorder,
36
37
  CABButtonContent: () => CABButtonContent,
37
38
  CABButtonSection: () => CABButtonSection,
@@ -47,6 +48,7 @@ __export(src_exports, {
47
48
  CABIntegrations: () => CABIntegrations,
48
49
  CABLayoutSection: () => CABLayoutSection,
49
50
  CABMonetizeSection: () => CABMonetizeSection,
51
+ CABNumberVariable: () => CABNumberVariable,
50
52
  CABOffersSection: () => CABOffersSection,
51
53
  CABProductSection: () => CABProductSection,
52
54
  CABProductsSection: () => CABProductsSection,
@@ -62,6 +64,7 @@ __export(src_exports, {
62
64
  CABSection: () => CABSection,
63
65
  CABTextSection: () => CABTextSection,
64
66
  CABTextTier: () => CABTextTier,
67
+ CABTextVariable: () => CABTextVariable,
65
68
  CABTracking: () => CABTracking,
66
69
  CABUILabels: () => CABUILabels,
67
70
  CABVariable: () => CABVariable,
@@ -166,6 +169,7 @@ __export(src_exports, {
166
169
  UI_LABELS: () => UI_LABELS,
167
170
  UserConfig: () => UserConfig,
168
171
  VariableEffect: () => VariableEffect,
172
+ VariableType: () => VariableType,
169
173
  VariantMode: () => VariantMode,
170
174
  VariantSelector: () => VariantSelector,
171
175
  VerticalAlignment: () => VerticalAlignment,
@@ -269,6 +273,7 @@ __export(src_exports, {
269
273
  utmObjectFromString: () => utmObjectFromString,
270
274
  uuid: () => uuid,
271
275
  variableEffects: () => variableEffects,
276
+ variableTypes: () => variableTypes,
272
277
  variantAvailable: () => variantAvailable,
273
278
  variantMinMaxPriceObject: () => variantMinMaxPriceObject,
274
279
  variantModes: () => variantModes,
@@ -1749,6 +1754,8 @@ var textSizeNames = [...inlineTextSizeNames, "heading"];
1749
1754
  var TextSizeName = freezeEnum(textSizeNames);
1750
1755
  var variableEffects = ["set_false", "set_true", "toggle"];
1751
1756
  var VariableEffect = freezeEnum(variableEffects);
1757
+ var variableTypes = ["boolean", "number", "text"];
1758
+ var VariableType = freezeEnum(variableTypes);
1752
1759
  var variantModes = ["multiple", "single"];
1753
1760
  var VariantMode = freezeEnum(variantModes);
1754
1761
  var variantSelectors = ["menu", "radio", "button"];
@@ -2113,7 +2120,7 @@ var CABVariableSeed = import_zod12.z.object({
2113
2120
  dataSourceId: import_zod12.z.number().nullable().default(null),
2114
2121
  ruleset: CABRuleset
2115
2122
  });
2116
- var CABVariable = import_zod12.z.object({
2123
+ var CABBooleanVariable = import_zod12.z.object({
2117
2124
  /**
2118
2125
  * Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
2119
2126
  * from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
@@ -2121,11 +2128,25 @@ var CABVariable = import_zod12.z.object({
2121
2128
  */
2122
2129
  defaultValue: import_zod12.z.boolean().optional(),
2123
2130
  name: import_zod12.z.string().min(1),
2124
- seed: CABVariableSeed.optional()
2125
- }).transform(({ defaultValue, ...variable }) => ({
2126
- defaultValue: defaultValue ?? variable.seed === void 0,
2127
- ...variable
2128
- }));
2131
+ seed: CABVariableSeed.optional(),
2132
+ /** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
2133
+ type: import_zod12.z.literal(VariableType.boolean).default(VariableType.boolean)
2134
+ });
2135
+ var CABTextVariable = import_zod12.z.object({
2136
+ defaultValue: import_zod12.z.string(),
2137
+ name: import_zod12.z.string().min(1),
2138
+ seed: import_zod12.z.never().optional(),
2139
+ type: import_zod12.z.literal(VariableType.text)
2140
+ });
2141
+ var CABNumberVariable = import_zod12.z.object({
2142
+ defaultValue: import_zod12.z.number(),
2143
+ name: import_zod12.z.string().min(1),
2144
+ seed: import_zod12.z.never().optional(),
2145
+ type: import_zod12.z.literal(VariableType.number)
2146
+ });
2147
+ var CABVariable = import_zod12.z.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
2148
+ (variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
2149
+ );
2129
2150
  var CABVariableEffect = import_zod12.z.object({
2130
2151
  effect: variableEffect.default(VariableEffect.toggle),
2131
2152
  variable: import_zod12.z.string().min(1)
@@ -3939,7 +3960,8 @@ var normalizeTokens = (text, knownTokens = DEFAULT_KNOWN_TOKENS) => {
3939
3960
  };
3940
3961
 
3941
3962
  // src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
3942
- var convertContentBlockTextToV2 = (language) => {
3963
+ var literalText = (_field, value) => normalizeTokens(value);
3964
+ var convertContentBlockTextToV2 = (language, text = literalText) => {
3943
3965
  const description = language?.description;
3944
3966
  const superTitle = language?.superTitle;
3945
3967
  const title = language?.title;
@@ -3950,20 +3972,20 @@ var convertContentBlockTextToV2 = (language) => {
3950
3972
  color: "base",
3951
3973
  fontSize: "extraLarge",
3952
3974
  marks: [{ type: "bold" }],
3953
- text: normalizeTokens(superTitle),
3975
+ text: text("superTitle", superTitle),
3954
3976
  textAlign: "center"
3955
3977
  }) : null,
3956
3978
  title ? convertTextToTiptapParagraph({
3957
3979
  color: "base",
3958
3980
  fontSize: "medium",
3959
3981
  marks: [{ type: "bold" }],
3960
- text: normalizeTokens(title),
3982
+ text: text("title", title),
3961
3983
  textAlign: "center"
3962
3984
  }) : null,
3963
3985
  description ? convertTextToTiptapParagraph({
3964
3986
  color: "base",
3965
3987
  fontSize: "base",
3966
- text: normalizeTokens(description),
3988
+ text: text("description", description),
3967
3989
  textAlign: "center"
3968
3990
  }) : null
3969
3991
  ].filter((p) => p !== null),
@@ -4667,7 +4689,20 @@ var buildCarouselNav = () => ({
4667
4689
  sections: [navButton("goToPrevPage", "chevron-left"), navButton("goToNextPage", "chevron-right")],
4668
4690
  sectionType: "layout"
4669
4691
  });
4670
- var hasHeaderText = (language) => !!(language?.title || language?.superTitle || language?.description);
4692
+ var HEADER_FIELDS = ["superTitle", "title", "description"];
4693
+ var sanitizedHeader = (language) => Object.fromEntries(
4694
+ HEADER_FIELDS.flatMap((field) => {
4695
+ const value = language?.[field];
4696
+ const sanitized = value ? stripContentBlockHtml(normalizeTokens(value)) : "";
4697
+ return sanitized ? [[field, sanitized]] : [];
4698
+ })
4699
+ );
4700
+ var hasHeaderText = (header) => Object.keys(header).length > 0;
4701
+ var headerText = (field) => `{{${field}}}`;
4702
+ var headerVariables = (header) => HEADER_FIELDS.flatMap((field) => {
4703
+ const defaultValue = header[field];
4704
+ return defaultValue === void 0 ? [] : [{ defaultValue, name: field, type: VariableType.text }];
4705
+ });
4671
4706
  var HAS_PRODUCTS = "hasProducts";
4672
4707
  var hasProductsMutators = () => [
4673
4708
  {
@@ -4754,6 +4789,7 @@ var buildBanner = (language) => language?.successBannerEnabled ? [
4754
4789
  ] : [];
4755
4790
  var convertOfferToV2 = ({ id, name, settings }) => {
4756
4791
  const layout = settings.layout?.large ?? settings.layout?.medium ?? settings.layout?.small;
4792
+ const header = sanitizedHeader(settings.language);
4757
4793
  const columns = layout?.columns ?? 1;
4758
4794
  const direction = directionForStyle(layout?.style);
4759
4795
  const pageSize = Math.max(columns, 1);
@@ -4827,13 +4863,13 @@ var convertOfferToV2 = ({ id, name, settings }) => {
4827
4863
  ...name && { name },
4828
4864
  previewMode: settings.previewMode,
4829
4865
  sections: [
4830
- ...hasHeaderText(settings.language) ? [{ content: { en: convertContentBlockTextToV2(settings.language) }, sectionType: "text" }] : [],
4866
+ ...hasHeaderText(header) ? [{ content: { en: convertContentBlockTextToV2(header, headerText) }, sectionType: "text" }] : [],
4831
4867
  display
4832
4868
  ],
4833
4869
  // CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
4834
4870
  tracking: settings.tracking,
4835
4871
  type: SHOPIFY_CHECKOUT_EXTENSION,
4836
- variables: [{ defaultValue: false, name: HAS_PRODUCTS }],
4872
+ variables: [{ defaultValue: false, name: HAS_PRODUCTS }, ...headerVariables(header)],
4837
4873
  version: 2,
4838
4874
  visibility: { variable: HAS_PRODUCTS, visibleWhen: true },
4839
4875
  widgetId: id
package/dist/index.mjs CHANGED
@@ -1468,6 +1468,8 @@ var textSizeNames = [...inlineTextSizeNames, "heading"];
1468
1468
  var TextSizeName = freezeEnum(textSizeNames);
1469
1469
  var variableEffects = ["set_false", "set_true", "toggle"];
1470
1470
  var VariableEffect = freezeEnum(variableEffects);
1471
+ var variableTypes = ["boolean", "number", "text"];
1472
+ var VariableType = freezeEnum(variableTypes);
1471
1473
  var variantModes = ["multiple", "single"];
1472
1474
  var VariantMode = freezeEnum(variantModes);
1473
1475
  var variantSelectors = ["menu", "radio", "button"];
@@ -1832,7 +1834,7 @@ var CABVariableSeed = z12.object({
1832
1834
  dataSourceId: z12.number().nullable().default(null),
1833
1835
  ruleset: CABRuleset
1834
1836
  });
1835
- var CABVariable = z12.object({
1837
+ var CABBooleanVariable = z12.object({
1836
1838
  /**
1837
1839
  * Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
1838
1840
  * from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
@@ -1840,11 +1842,25 @@ var CABVariable = z12.object({
1840
1842
  */
1841
1843
  defaultValue: z12.boolean().optional(),
1842
1844
  name: z12.string().min(1),
1843
- seed: CABVariableSeed.optional()
1844
- }).transform(({ defaultValue, ...variable }) => ({
1845
- defaultValue: defaultValue ?? variable.seed === void 0,
1846
- ...variable
1847
- }));
1845
+ seed: CABVariableSeed.optional(),
1846
+ /** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
1847
+ type: z12.literal(VariableType.boolean).default(VariableType.boolean)
1848
+ });
1849
+ var CABTextVariable = z12.object({
1850
+ defaultValue: z12.string(),
1851
+ name: z12.string().min(1),
1852
+ seed: z12.never().optional(),
1853
+ type: z12.literal(VariableType.text)
1854
+ });
1855
+ var CABNumberVariable = z12.object({
1856
+ defaultValue: z12.number(),
1857
+ name: z12.string().min(1),
1858
+ seed: z12.never().optional(),
1859
+ type: z12.literal(VariableType.number)
1860
+ });
1861
+ var CABVariable = z12.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
1862
+ (variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
1863
+ );
1848
1864
  var CABVariableEffect = z12.object({
1849
1865
  effect: variableEffect.default(VariableEffect.toggle),
1850
1866
  variable: z12.string().min(1)
@@ -3658,7 +3674,8 @@ var normalizeTokens = (text, knownTokens = DEFAULT_KNOWN_TOKENS) => {
3658
3674
  };
3659
3675
 
3660
3676
  // src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
3661
- var convertContentBlockTextToV2 = (language) => {
3677
+ var literalText = (_field, value) => normalizeTokens(value);
3678
+ var convertContentBlockTextToV2 = (language, text = literalText) => {
3662
3679
  const description = language?.description;
3663
3680
  const superTitle = language?.superTitle;
3664
3681
  const title = language?.title;
@@ -3669,20 +3686,20 @@ var convertContentBlockTextToV2 = (language) => {
3669
3686
  color: "base",
3670
3687
  fontSize: "extraLarge",
3671
3688
  marks: [{ type: "bold" }],
3672
- text: normalizeTokens(superTitle),
3689
+ text: text("superTitle", superTitle),
3673
3690
  textAlign: "center"
3674
3691
  }) : null,
3675
3692
  title ? convertTextToTiptapParagraph({
3676
3693
  color: "base",
3677
3694
  fontSize: "medium",
3678
3695
  marks: [{ type: "bold" }],
3679
- text: normalizeTokens(title),
3696
+ text: text("title", title),
3680
3697
  textAlign: "center"
3681
3698
  }) : null,
3682
3699
  description ? convertTextToTiptapParagraph({
3683
3700
  color: "base",
3684
3701
  fontSize: "base",
3685
- text: normalizeTokens(description),
3702
+ text: text("description", description),
3686
3703
  textAlign: "center"
3687
3704
  }) : null
3688
3705
  ].filter((p) => p !== null),
@@ -4386,7 +4403,20 @@ var buildCarouselNav = () => ({
4386
4403
  sections: [navButton("goToPrevPage", "chevron-left"), navButton("goToNextPage", "chevron-right")],
4387
4404
  sectionType: "layout"
4388
4405
  });
4389
- var hasHeaderText = (language) => !!(language?.title || language?.superTitle || language?.description);
4406
+ var HEADER_FIELDS = ["superTitle", "title", "description"];
4407
+ var sanitizedHeader = (language) => Object.fromEntries(
4408
+ HEADER_FIELDS.flatMap((field) => {
4409
+ const value = language?.[field];
4410
+ const sanitized = value ? stripContentBlockHtml(normalizeTokens(value)) : "";
4411
+ return sanitized ? [[field, sanitized]] : [];
4412
+ })
4413
+ );
4414
+ var hasHeaderText = (header) => Object.keys(header).length > 0;
4415
+ var headerText = (field) => `{{${field}}}`;
4416
+ var headerVariables = (header) => HEADER_FIELDS.flatMap((field) => {
4417
+ const defaultValue = header[field];
4418
+ return defaultValue === void 0 ? [] : [{ defaultValue, name: field, type: VariableType.text }];
4419
+ });
4390
4420
  var HAS_PRODUCTS = "hasProducts";
4391
4421
  var hasProductsMutators = () => [
4392
4422
  {
@@ -4473,6 +4503,7 @@ var buildBanner = (language) => language?.successBannerEnabled ? [
4473
4503
  ] : [];
4474
4504
  var convertOfferToV2 = ({ id, name, settings }) => {
4475
4505
  const layout = settings.layout?.large ?? settings.layout?.medium ?? settings.layout?.small;
4506
+ const header = sanitizedHeader(settings.language);
4476
4507
  const columns = layout?.columns ?? 1;
4477
4508
  const direction = directionForStyle(layout?.style);
4478
4509
  const pageSize = Math.max(columns, 1);
@@ -4546,13 +4577,13 @@ var convertOfferToV2 = ({ id, name, settings }) => {
4546
4577
  ...name && { name },
4547
4578
  previewMode: settings.previewMode,
4548
4579
  sections: [
4549
- ...hasHeaderText(settings.language) ? [{ content: { en: convertContentBlockTextToV2(settings.language) }, sectionType: "text" }] : [],
4580
+ ...hasHeaderText(header) ? [{ content: { en: convertContentBlockTextToV2(header, headerText) }, sectionType: "text" }] : [],
4550
4581
  display
4551
4582
  ],
4552
4583
  // CABTracking's schema fallbacks fill missing or null fields and the missing object; malformed values throw.
4553
4584
  tracking: settings.tracking,
4554
4585
  type: SHOPIFY_CHECKOUT_EXTENSION,
4555
- variables: [{ defaultValue: false, name: HAS_PRODUCTS }],
4586
+ variables: [{ defaultValue: false, name: HAS_PRODUCTS }, ...headerVariables(header)],
4556
4587
  version: 2,
4557
4588
  visibility: { variable: HAS_PRODUCTS, visibleWhen: true },
4558
4589
  widgetId: id
@@ -4571,6 +4602,7 @@ export {
4571
4602
  ButtonField,
4572
4603
  ButtonStyle,
4573
4604
  CABBannerSection,
4605
+ CABBooleanVariable,
4574
4606
  CABBorder,
4575
4607
  CABButtonContent,
4576
4608
  CABButtonSection,
@@ -4586,6 +4618,7 @@ export {
4586
4618
  CABIntegrations,
4587
4619
  CABLayoutSection,
4588
4620
  CABMonetizeSection,
4621
+ CABNumberVariable,
4589
4622
  CABOffersSection,
4590
4623
  CABProductSection,
4591
4624
  CABProductsSection,
@@ -4601,6 +4634,7 @@ export {
4601
4634
  CABSection,
4602
4635
  CABTextSection,
4603
4636
  CABTextTier,
4637
+ CABTextVariable,
4604
4638
  CABTracking,
4605
4639
  CABUILabels,
4606
4640
  CABVariable,
@@ -4705,6 +4739,7 @@ export {
4705
4739
  UI_LABELS,
4706
4740
  UserConfig,
4707
4741
  VariableEffect,
4742
+ VariableType,
4708
4743
  VariantMode,
4709
4744
  VariantSelector,
4710
4745
  VerticalAlignment,
@@ -4808,6 +4843,7 @@ export {
4808
4843
  utmObjectFromString,
4809
4844
  uuid,
4810
4845
  variableEffects,
4846
+ variableTypes,
4811
4847
  variantAvailable,
4812
4848
  variantMinMaxPriceObject,
4813
4849
  variantModes,
@@ -51,6 +51,7 @@ __export(common_exports, {
51
51
  TextColorName: () => TextColorName,
52
52
  TextSizeName: () => TextSizeName,
53
53
  VariableEffect: () => VariableEffect,
54
+ VariableType: () => VariableType,
54
55
  VariantMode: () => VariantMode,
55
56
  VariantSelector: () => VariantSelector,
56
57
  VerticalAlignment: () => VerticalAlignment,
@@ -87,6 +88,7 @@ __export(common_exports, {
87
88
  textColorNames: () => textColorNames,
88
89
  textSizeNames: () => textSizeNames,
89
90
  variableEffects: () => variableEffects,
91
+ variableTypes: () => variableTypes,
90
92
  variantModes: () => variantModes,
91
93
  variantSelectors: () => variantSelectors,
92
94
  verticalAlignments: () => verticalAlignments
@@ -254,6 +256,8 @@ var textSizeNames = [...inlineTextSizeNames, "heading"];
254
256
  var TextSizeName = freezeEnum(textSizeNames);
255
257
  var variableEffects = ["set_false", "set_true", "toggle"];
256
258
  var VariableEffect = freezeEnum(variableEffects);
259
+ var variableTypes = ["boolean", "number", "text"];
260
+ var VariableType = freezeEnum(variableTypes);
257
261
  var variantModes = ["multiple", "single"];
258
262
  var VariantMode = freezeEnum(variantModes);
259
263
  var variantSelectors = ["menu", "radio", "button"];
@@ -161,6 +161,8 @@ var textSizeNames = [...inlineTextSizeNames, "heading"];
161
161
  var TextSizeName = freezeEnum(textSizeNames);
162
162
  var variableEffects = ["set_false", "set_true", "toggle"];
163
163
  var VariableEffect = freezeEnum(variableEffects);
164
+ var variableTypes = ["boolean", "number", "text"];
165
+ var VariableType = freezeEnum(variableTypes);
164
166
  var variantModes = ["multiple", "single"];
165
167
  var VariantMode = freezeEnum(variantModes);
166
168
  var variantSelectors = ["menu", "radio", "button"];
@@ -199,6 +201,7 @@ export {
199
201
  TextColorName,
200
202
  TextSizeName,
201
203
  VariableEffect,
204
+ VariableType,
202
205
  VariantMode,
203
206
  VariantSelector,
204
207
  VerticalAlignment,
@@ -235,6 +238,7 @@ export {
235
238
  textColorNames,
236
239
  textSizeNames,
237
240
  variableEffects,
241
+ variableTypes,
238
242
  variantModes,
239
243
  variantSelectors,
240
244
  verticalAlignments
@@ -29,6 +29,7 @@ __export(checkout_and_beyond_exports, {
29
29
  ButtonField: () => ButtonField,
30
30
  ButtonStyle: () => ButtonStyle,
31
31
  CABBannerSection: () => CABBannerSection,
32
+ CABBooleanVariable: () => CABBooleanVariable,
32
33
  CABBorder: () => CABBorder,
33
34
  CABButtonContent: () => CABButtonContent,
34
35
  CABButtonSection: () => CABButtonSection,
@@ -44,6 +45,7 @@ __export(checkout_and_beyond_exports, {
44
45
  CABIntegrations: () => CABIntegrations,
45
46
  CABLayoutSection: () => CABLayoutSection,
46
47
  CABMonetizeSection: () => CABMonetizeSection,
48
+ CABNumberVariable: () => CABNumberVariable,
47
49
  CABOffersSection: () => CABOffersSection,
48
50
  CABProductSection: () => CABProductSection,
49
51
  CABProductsSection: () => CABProductsSection,
@@ -59,6 +61,7 @@ __export(checkout_and_beyond_exports, {
59
61
  CABSection: () => CABSection,
60
62
  CABTextSection: () => CABTextSection,
61
63
  CABTextTier: () => CABTextTier,
64
+ CABTextVariable: () => CABTextVariable,
62
65
  CABTracking: () => CABTracking,
63
66
  CABUILabels: () => CABUILabels,
64
67
  CABVariable: () => CABVariable,
@@ -118,6 +121,7 @@ __export(checkout_and_beyond_exports, {
118
121
  TiptapText: () => TiptapText,
119
122
  UI_LABELS: () => UI_LABELS,
120
123
  VariableEffect: () => VariableEffect,
124
+ VariableType: () => VariableType,
121
125
  VariantMode: () => VariantMode,
122
126
  VariantSelector: () => VariantSelector,
123
127
  VerticalAlignment: () => VerticalAlignment,
@@ -183,6 +187,7 @@ __export(checkout_and_beyond_exports, {
183
187
  textColorNames: () => textColorNames,
184
188
  textSizeNames: () => textSizeNames,
185
189
  variableEffects: () => variableEffects,
190
+ variableTypes: () => variableTypes,
186
191
  variantModes: () => variantModes,
187
192
  variantSelectors: () => variantSelectors,
188
193
  verticalAlignments: () => verticalAlignments,
@@ -356,6 +361,8 @@ var textSizeNames = [...inlineTextSizeNames, "heading"];
356
361
  var TextSizeName = freezeEnum(textSizeNames);
357
362
  var variableEffects = ["set_false", "set_true", "toggle"];
358
363
  var VariableEffect = freezeEnum(variableEffects);
364
+ var variableTypes = ["boolean", "number", "text"];
365
+ var VariableType = freezeEnum(variableTypes);
359
366
  var variantModes = ["multiple", "single"];
360
367
  var VariantMode = freezeEnum(variantModes);
361
368
  var variantSelectors = ["menu", "radio", "button"];
@@ -604,7 +611,7 @@ var CABVariableSeed = import_zod2.z.object({
604
611
  dataSourceId: import_zod2.z.number().nullable().default(null),
605
612
  ruleset: CABRuleset
606
613
  });
607
- var CABVariable = import_zod2.z.object({
614
+ var CABBooleanVariable = import_zod2.z.object({
608
615
  /**
609
616
  * Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
610
617
  * from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
@@ -612,11 +619,25 @@ var CABVariable = import_zod2.z.object({
612
619
  */
613
620
  defaultValue: import_zod2.z.boolean().optional(),
614
621
  name: import_zod2.z.string().min(1),
615
- seed: CABVariableSeed.optional()
616
- }).transform(({ defaultValue, ...variable }) => ({
617
- defaultValue: defaultValue ?? variable.seed === void 0,
618
- ...variable
619
- }));
622
+ seed: CABVariableSeed.optional(),
623
+ /** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
624
+ type: import_zod2.z.literal(VariableType.boolean).default(VariableType.boolean)
625
+ });
626
+ var CABTextVariable = import_zod2.z.object({
627
+ defaultValue: import_zod2.z.string(),
628
+ name: import_zod2.z.string().min(1),
629
+ seed: import_zod2.z.never().optional(),
630
+ type: import_zod2.z.literal(VariableType.text)
631
+ });
632
+ var CABNumberVariable = import_zod2.z.object({
633
+ defaultValue: import_zod2.z.number(),
634
+ name: import_zod2.z.string().min(1),
635
+ seed: import_zod2.z.never().optional(),
636
+ type: import_zod2.z.literal(VariableType.number)
637
+ });
638
+ var CABVariable = import_zod2.z.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
639
+ (variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
640
+ );
620
641
  var CABVariableEffect = import_zod2.z.object({
621
642
  effect: variableEffect.default(VariableEffect.toggle),
622
643
  variable: import_zod2.z.string().min(1)
@@ -164,6 +164,8 @@ var textSizeNames = [...inlineTextSizeNames, "heading"];
164
164
  var TextSizeName = freezeEnum(textSizeNames);
165
165
  var variableEffects = ["set_false", "set_true", "toggle"];
166
166
  var VariableEffect = freezeEnum(variableEffects);
167
+ var variableTypes = ["boolean", "number", "text"];
168
+ var VariableType = freezeEnum(variableTypes);
167
169
  var variantModes = ["multiple", "single"];
168
170
  var VariantMode = freezeEnum(variantModes);
169
171
  var variantSelectors = ["menu", "radio", "button"];
@@ -412,7 +414,7 @@ var CABVariableSeed = z2.object({
412
414
  dataSourceId: z2.number().nullable().default(null),
413
415
  ruleset: CABRuleset
414
416
  });
415
- var CABVariable = z2.object({
417
+ var CABBooleanVariable = z2.object({
416
418
  /**
417
419
  * Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
418
420
  * from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
@@ -420,11 +422,25 @@ var CABVariable = z2.object({
420
422
  */
421
423
  defaultValue: z2.boolean().optional(),
422
424
  name: z2.string().min(1),
423
- seed: CABVariableSeed.optional()
424
- }).transform(({ defaultValue, ...variable }) => ({
425
- defaultValue: defaultValue ?? variable.seed === void 0,
426
- ...variable
427
- }));
425
+ seed: CABVariableSeed.optional(),
426
+ /** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
427
+ type: z2.literal(VariableType.boolean).default(VariableType.boolean)
428
+ });
429
+ var CABTextVariable = z2.object({
430
+ defaultValue: z2.string(),
431
+ name: z2.string().min(1),
432
+ seed: z2.never().optional(),
433
+ type: z2.literal(VariableType.text)
434
+ });
435
+ var CABNumberVariable = z2.object({
436
+ defaultValue: z2.number(),
437
+ name: z2.string().min(1),
438
+ seed: z2.never().optional(),
439
+ type: z2.literal(VariableType.number)
440
+ });
441
+ var CABVariable = z2.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
442
+ (variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
443
+ );
428
444
  var CABVariableEffect = z2.object({
429
445
  effect: variableEffect.default(VariableEffect.toggle),
430
446
  variable: z2.string().min(1)
@@ -1785,6 +1801,7 @@ export {
1785
1801
  ButtonField,
1786
1802
  ButtonStyle,
1787
1803
  CABBannerSection,
1804
+ CABBooleanVariable,
1788
1805
  CABBorder,
1789
1806
  CABButtonContent,
1790
1807
  CABButtonSection,
@@ -1800,6 +1817,7 @@ export {
1800
1817
  CABIntegrations,
1801
1818
  CABLayoutSection,
1802
1819
  CABMonetizeSection,
1820
+ CABNumberVariable,
1803
1821
  CABOffersSection,
1804
1822
  CABProductSection,
1805
1823
  CABProductsSection,
@@ -1815,6 +1833,7 @@ export {
1815
1833
  CABSection,
1816
1834
  CABTextSection,
1817
1835
  CABTextTier,
1836
+ CABTextVariable,
1818
1837
  CABTracking,
1819
1838
  CABUILabels,
1820
1839
  CABVariable,
@@ -1874,6 +1893,7 @@ export {
1874
1893
  TiptapText,
1875
1894
  UI_LABELS,
1876
1895
  VariableEffect,
1896
+ VariableType,
1877
1897
  VariantMode,
1878
1898
  VariantSelector,
1879
1899
  VerticalAlignment,
@@ -1939,6 +1959,7 @@ export {
1939
1959
  textColorNames,
1940
1960
  textSizeNames,
1941
1961
  variableEffects,
1962
+ variableTypes,
1942
1963
  variantModes,
1943
1964
  variantSelectors,
1944
1965
  verticalAlignments,
@@ -192,6 +192,8 @@ var textSizeNames = [...inlineTextSizeNames, "heading"];
192
192
  var TextSizeName = freezeEnum(textSizeNames);
193
193
  var variableEffects = ["set_false", "set_true", "toggle"];
194
194
  var VariableEffect = freezeEnum(variableEffects);
195
+ var variableTypes = ["boolean", "number", "text"];
196
+ var VariableType = freezeEnum(variableTypes);
195
197
  var variantModes = ["multiple", "single"];
196
198
  var VariantMode = freezeEnum(variantModes);
197
199
  var variantSelectors = ["menu", "radio", "button"];
@@ -528,7 +530,7 @@ var CABVariableSeed = import_zod5.z.object({
528
530
  dataSourceId: import_zod5.z.number().nullable().default(null),
529
531
  ruleset: CABRuleset
530
532
  });
531
- var CABVariable = import_zod5.z.object({
533
+ var CABBooleanVariable = import_zod5.z.object({
532
534
  /**
533
535
  * Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
534
536
  * from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
@@ -536,11 +538,25 @@ var CABVariable = import_zod5.z.object({
536
538
  */
537
539
  defaultValue: import_zod5.z.boolean().optional(),
538
540
  name: import_zod5.z.string().min(1),
539
- seed: CABVariableSeed.optional()
540
- }).transform(({ defaultValue, ...variable }) => ({
541
- defaultValue: defaultValue ?? variable.seed === void 0,
542
- ...variable
543
- }));
541
+ seed: CABVariableSeed.optional(),
542
+ /** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
543
+ type: import_zod5.z.literal(VariableType.boolean).default(VariableType.boolean)
544
+ });
545
+ var CABTextVariable = import_zod5.z.object({
546
+ defaultValue: import_zod5.z.string(),
547
+ name: import_zod5.z.string().min(1),
548
+ seed: import_zod5.z.never().optional(),
549
+ type: import_zod5.z.literal(VariableType.text)
550
+ });
551
+ var CABNumberVariable = import_zod5.z.object({
552
+ defaultValue: import_zod5.z.number(),
553
+ name: import_zod5.z.string().min(1),
554
+ seed: import_zod5.z.never().optional(),
555
+ type: import_zod5.z.literal(VariableType.number)
556
+ });
557
+ var CABVariable = import_zod5.z.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
558
+ (variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
559
+ );
544
560
  var CABVariableEffect = import_zod5.z.object({
545
561
  effect: variableEffect.default(VariableEffect.toggle),
546
562
  variable: import_zod5.z.string().min(1)
@@ -167,6 +167,8 @@ var textSizeNames = [...inlineTextSizeNames, "heading"];
167
167
  var TextSizeName = freezeEnum(textSizeNames);
168
168
  var variableEffects = ["set_false", "set_true", "toggle"];
169
169
  var VariableEffect = freezeEnum(variableEffects);
170
+ var variableTypes = ["boolean", "number", "text"];
171
+ var VariableType = freezeEnum(variableTypes);
170
172
  var variantModes = ["multiple", "single"];
171
173
  var VariantMode = freezeEnum(variantModes);
172
174
  var variantSelectors = ["menu", "radio", "button"];
@@ -503,7 +505,7 @@ var CABVariableSeed = z5.object({
503
505
  dataSourceId: z5.number().nullable().default(null),
504
506
  ruleset: CABRuleset
505
507
  });
506
- var CABVariable = z5.object({
508
+ var CABBooleanVariable = z5.object({
507
509
  /**
508
510
  * Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
509
511
  * from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
@@ -511,11 +513,25 @@ var CABVariable = z5.object({
511
513
  */
512
514
  defaultValue: z5.boolean().optional(),
513
515
  name: z5.string().min(1),
514
- seed: CABVariableSeed.optional()
515
- }).transform(({ defaultValue, ...variable }) => ({
516
- defaultValue: defaultValue ?? variable.seed === void 0,
517
- ...variable
518
- }));
516
+ seed: CABVariableSeed.optional(),
517
+ /** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
518
+ type: z5.literal(VariableType.boolean).default(VariableType.boolean)
519
+ });
520
+ var CABTextVariable = z5.object({
521
+ defaultValue: z5.string(),
522
+ name: z5.string().min(1),
523
+ seed: z5.never().optional(),
524
+ type: z5.literal(VariableType.text)
525
+ });
526
+ var CABNumberVariable = z5.object({
527
+ defaultValue: z5.number(),
528
+ name: z5.string().min(1),
529
+ seed: z5.never().optional(),
530
+ type: z5.literal(VariableType.number)
531
+ });
532
+ var CABVariable = z5.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
533
+ (variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
534
+ );
519
535
  var CABVariableEffect = z5.object({
520
536
  effect: variableEffect.default(VariableEffect.toggle),
521
537
  variable: z5.string().min(1)