@rebuy/rebuy 3.66.0 → 3.66.1

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.
@@ -5335,7 +5335,14 @@ var MAX_ICON_SIZE_PX = 64;
5335
5335
  var IN_SCOPE_TIER_TYPES = new Set(progressTierTypes);
5336
5336
  var inScope = (tier) => IN_SCOPE_TIER_TYPES.has(tier.type ?? "");
5337
5337
  var thresholdOf = (tier) => tier.unlockConditionType === "item_quantity" ? Math.ceil(Number(tier.minimum)) : Math.round(Number(tier.minimum) * 100);
5338
- var tierThresholds = (tier) => presentmentThresholds(tier.presentmentCurrencies);
5338
+ var tierThresholds = (tier, shopCurrency) => {
5339
+ const shopCode = shopCurrency?.toLowerCase();
5340
+ return Object.fromEntries(
5341
+ Object.entries(presentmentThresholds(tier.presentmentCurrencies)).filter(
5342
+ ([code, cents]) => cents > 0 && code !== shopCode
5343
+ )
5344
+ );
5345
+ };
5339
5346
  var tierLabel = (tier) => {
5340
5347
  const type = tier.type;
5341
5348
  if ((tier.customTierLabel || type === "decorative") && tier.customTierLabelText) return tier.customTierLabelText;
@@ -5389,7 +5396,7 @@ var exclusionsOf = (tier) => {
5389
5396
  });
5390
5397
  return rules.length > 0 ? rules : void 0;
5391
5398
  };
5392
- var toTierMeta = (tier) => {
5399
+ var toTierMeta = (tier, shopCurrency) => {
5393
5400
  const discount = discountOf(tier);
5394
5401
  const exclusions = exclusionsOf(tier);
5395
5402
  const gift = giftOf(tier);
@@ -5410,16 +5417,16 @@ var toTierMeta = (tier) => {
5410
5417
  /** Carry the image-swap flag only on gift tiers that set it — the client shows the gift's product image in the step slot instead of the bag icon. */
5411
5418
  ...gift && tier.productTierImage && { productTierImage: true },
5412
5419
  threshold: thresholdOf(tier),
5413
- thresholds: !isItemCount && type === "shipping" ? tierThresholds(tier) : {},
5420
+ thresholds: isItemCount ? {} : tierThresholds(tier, shopCurrency),
5414
5421
  ...tier.id && { tierId: tier.id },
5415
5422
  tierType: type,
5416
5423
  ...isItemCount && { unit: "item" }
5417
5424
  };
5418
5425
  };
5419
- var renderableTiers = (bar) => (bar.tiers ?? []).filter(
5426
+ var renderableTiers = (bar, shopCurrency) => (bar.tiers ?? []).filter(
5420
5427
  (tier) => (
5421
5428
  /** onsite `isTierDataValid`: a non-numeric (null/absent) minimum is dropped — else `thresholdOf` reads it as 0, an always-reached tier that auto-adds its gift to every cart. A literal 0 is finite and kept. Divergence: onsite's strict `typeof === 'number'` also drops a string `'50'`; here `minimum` was already `z.coerce`d (`'50' → 50`), so `Number.isFinite` keeps it — see smartCart.ts. */
5422
- inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier)).success
5429
+ inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier, shopCurrency)).success
5423
5430
  )
5424
5431
  );
5425
5432
  var PRODUCT_TOKENS = ["productTitle", "remainingAmount"];
@@ -5474,7 +5481,7 @@ var toTierFeedback = (tier) => {
5474
5481
  });
5475
5482
  return sections;
5476
5483
  };
5477
- var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor) => ({
5484
+ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor, shopCurrency) => ({
5478
5485
  /**
5479
5486
  * React's `SmartCartProgressBarContent` centers the bar/message stack (`inlineAlignment="center"`); the
5480
5487
  * section inherits `layout`'s `alignment.horizontal: 'start'`, so an emitted-bare bar would left-align.
@@ -5530,7 +5537,7 @@ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progr
5530
5537
  sectionType: "progressBar",
5531
5538
  /** React's bar/message stack uses `spacing="tight"` (→ `small-100`); `layout` defaults `spacing` to `base`, a wider gap. Emit `tight` for parity (mirrors the v1 shipping converter). */
5532
5539
  spacing: "tight",
5533
- tiers: tiers.map(toTierMeta)
5540
+ tiers: tiers.map((tier) => toTierMeta(tier, shopCurrency))
5534
5541
  });
5535
5542
  var barCountries = (bar) => [
5536
5543
  ...new Set((bar.countryCodes ?? []).map((code) => code.trim().toUpperCase()).filter(Boolean))
@@ -5556,9 +5563,16 @@ var dedupeBars = (entries) => {
5556
5563
  return rendered;
5557
5564
  };
5558
5565
  var convertSmartCartProgressBarToV2 = (input) => {
5559
- const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar) }));
5566
+ const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar, input.shopCurrency) }));
5560
5567
  const sections = dedupeBars(entries).map(
5561
- ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(entry.bar, entry.tiers, countryCodes, excludeCountryCodes, input.progressColor)
5568
+ ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(
5569
+ entry.bar,
5570
+ entry.tiers,
5571
+ countryCodes,
5572
+ excludeCountryCodes,
5573
+ input.progressColor,
5574
+ input.shopCurrency
5575
+ )
5562
5576
  );
5563
5577
  return CABRootSection.parse(
5564
5578
  normalizeTextContent({
@@ -6198,7 +6212,9 @@ var fetchProgressBarContext = async (shop, ctx, prefetched) => {
6198
6212
  const entitled = config.shop.billingVersion !== "v6" || config.shop.activePackages.some((pkg) => pkg.shortName === "cart-merchandising" && pkg.isActive);
6199
6213
  return {
6200
6214
  bars: entitled ? extractSmartCartBars(config.smartCart) : [],
6201
- progressColor: await fetchThemeColor(config.shop.shopId, ctx)
6215
+ progressColor: await fetchThemeColor(config.shop.shopId, ctx),
6216
+ /** The tiers' per-currency thresholds skip the shop's own code (onsite `getStoredPresentmentMinimum`). */
6217
+ shopCurrency: config.shop.currency
6202
6218
  };
6203
6219
  };
6204
6220
  var fetchThemeColor = async (shopId, ctx) => {
@@ -6280,8 +6296,14 @@ var fetchAndConvert = async (id, input, ctx, config) => {
6280
6296
  if (isMissingUpstreamPayload(data)) throw new NotFoundError(`Widget not found: ${id}`);
6281
6297
  const normalized = convertNumericObjects(deepCamelCase(data));
6282
6298
  if (isProgressBarV1(normalized) && normalized.barSettings.barType === "smart-cart") {
6283
- const { bars, progressColor } = await fetchProgressBarContext(input.shop, ctx, config);
6284
- return convertSmartCartProgressBarToV2({ bars: bars ?? [], id, progressColor, settings: normalized });
6299
+ const { bars, progressColor, shopCurrency } = await fetchProgressBarContext(input.shop, ctx, config);
6300
+ return convertSmartCartProgressBarToV2({
6301
+ bars: bars ?? [],
6302
+ id,
6303
+ progressColor,
6304
+ settings: normalized,
6305
+ shopCurrency
6306
+ });
6285
6307
  }
6286
6308
  if (isConvertibleProgressBarV1(normalized)) {
6287
6309
  const { progressColor } = await fetchProgressBarContext(input.shop, ctx, config);
@@ -5262,7 +5262,14 @@ var MAX_ICON_SIZE_PX = 64;
5262
5262
  var IN_SCOPE_TIER_TYPES = new Set(progressTierTypes);
5263
5263
  var inScope = (tier) => IN_SCOPE_TIER_TYPES.has(tier.type ?? "");
5264
5264
  var thresholdOf = (tier) => tier.unlockConditionType === "item_quantity" ? Math.ceil(Number(tier.minimum)) : Math.round(Number(tier.minimum) * 100);
5265
- var tierThresholds = (tier) => presentmentThresholds(tier.presentmentCurrencies);
5265
+ var tierThresholds = (tier, shopCurrency) => {
5266
+ const shopCode = shopCurrency?.toLowerCase();
5267
+ return Object.fromEntries(
5268
+ Object.entries(presentmentThresholds(tier.presentmentCurrencies)).filter(
5269
+ ([code, cents]) => cents > 0 && code !== shopCode
5270
+ )
5271
+ );
5272
+ };
5266
5273
  var tierLabel = (tier) => {
5267
5274
  const type = tier.type;
5268
5275
  if ((tier.customTierLabel || type === "decorative") && tier.customTierLabelText) return tier.customTierLabelText;
@@ -5316,7 +5323,7 @@ var exclusionsOf = (tier) => {
5316
5323
  });
5317
5324
  return rules.length > 0 ? rules : void 0;
5318
5325
  };
5319
- var toTierMeta = (tier) => {
5326
+ var toTierMeta = (tier, shopCurrency) => {
5320
5327
  const discount = discountOf(tier);
5321
5328
  const exclusions = exclusionsOf(tier);
5322
5329
  const gift = giftOf(tier);
@@ -5337,16 +5344,16 @@ var toTierMeta = (tier) => {
5337
5344
  /** Carry the image-swap flag only on gift tiers that set it — the client shows the gift's product image in the step slot instead of the bag icon. */
5338
5345
  ...gift && tier.productTierImage && { productTierImage: true },
5339
5346
  threshold: thresholdOf(tier),
5340
- thresholds: !isItemCount && type === "shipping" ? tierThresholds(tier) : {},
5347
+ thresholds: isItemCount ? {} : tierThresholds(tier, shopCurrency),
5341
5348
  ...tier.id && { tierId: tier.id },
5342
5349
  tierType: type,
5343
5350
  ...isItemCount && { unit: "item" }
5344
5351
  };
5345
5352
  };
5346
- var renderableTiers = (bar) => (bar.tiers ?? []).filter(
5353
+ var renderableTiers = (bar, shopCurrency) => (bar.tiers ?? []).filter(
5347
5354
  (tier) => (
5348
5355
  /** onsite `isTierDataValid`: a non-numeric (null/absent) minimum is dropped — else `thresholdOf` reads it as 0, an always-reached tier that auto-adds its gift to every cart. A literal 0 is finite and kept. Divergence: onsite's strict `typeof === 'number'` also drops a string `'50'`; here `minimum` was already `z.coerce`d (`'50' → 50`), so `Number.isFinite` keeps it — see smartCart.ts. */
5349
- inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier)).success
5356
+ inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier, shopCurrency)).success
5350
5357
  )
5351
5358
  );
5352
5359
  var PRODUCT_TOKENS = ["productTitle", "remainingAmount"];
@@ -5401,7 +5408,7 @@ var toTierFeedback = (tier) => {
5401
5408
  });
5402
5409
  return sections;
5403
5410
  };
5404
- var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor) => ({
5411
+ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor, shopCurrency) => ({
5405
5412
  /**
5406
5413
  * React's `SmartCartProgressBarContent` centers the bar/message stack (`inlineAlignment="center"`); the
5407
5414
  * section inherits `layout`'s `alignment.horizontal: 'start'`, so an emitted-bare bar would left-align.
@@ -5457,7 +5464,7 @@ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progr
5457
5464
  sectionType: "progressBar",
5458
5465
  /** React's bar/message stack uses `spacing="tight"` (→ `small-100`); `layout` defaults `spacing` to `base`, a wider gap. Emit `tight` for parity (mirrors the v1 shipping converter). */
5459
5466
  spacing: "tight",
5460
- tiers: tiers.map(toTierMeta)
5467
+ tiers: tiers.map((tier) => toTierMeta(tier, shopCurrency))
5461
5468
  });
5462
5469
  var barCountries = (bar) => [
5463
5470
  ...new Set((bar.countryCodes ?? []).map((code) => code.trim().toUpperCase()).filter(Boolean))
@@ -5483,9 +5490,16 @@ var dedupeBars = (entries) => {
5483
5490
  return rendered;
5484
5491
  };
5485
5492
  var convertSmartCartProgressBarToV2 = (input) => {
5486
- const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar) }));
5493
+ const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar, input.shopCurrency) }));
5487
5494
  const sections = dedupeBars(entries).map(
5488
- ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(entry.bar, entry.tiers, countryCodes, excludeCountryCodes, input.progressColor)
5495
+ ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(
5496
+ entry.bar,
5497
+ entry.tiers,
5498
+ countryCodes,
5499
+ excludeCountryCodes,
5500
+ input.progressColor,
5501
+ input.shopCurrency
5502
+ )
5489
5503
  );
5490
5504
  return CABRootSection.parse(
5491
5505
  normalizeTextContent({
@@ -6125,7 +6139,9 @@ var fetchProgressBarContext = async (shop, ctx, prefetched) => {
6125
6139
  const entitled = config.shop.billingVersion !== "v6" || config.shop.activePackages.some((pkg) => pkg.shortName === "cart-merchandising" && pkg.isActive);
6126
6140
  return {
6127
6141
  bars: entitled ? extractSmartCartBars(config.smartCart) : [],
6128
- progressColor: await fetchThemeColor(config.shop.shopId, ctx)
6142
+ progressColor: await fetchThemeColor(config.shop.shopId, ctx),
6143
+ /** The tiers' per-currency thresholds skip the shop's own code (onsite `getStoredPresentmentMinimum`). */
6144
+ shopCurrency: config.shop.currency
6129
6145
  };
6130
6146
  };
6131
6147
  var fetchThemeColor = async (shopId, ctx) => {
@@ -6207,8 +6223,14 @@ var fetchAndConvert = async (id, input, ctx, config) => {
6207
6223
  if (isMissingUpstreamPayload(data)) throw new NotFoundError(`Widget not found: ${id}`);
6208
6224
  const normalized = convertNumericObjects(deepCamelCase(data));
6209
6225
  if (isProgressBarV1(normalized) && normalized.barSettings.barType === "smart-cart") {
6210
- const { bars, progressColor } = await fetchProgressBarContext(input.shop, ctx, config);
6211
- return convertSmartCartProgressBarToV2({ bars: bars ?? [], id, progressColor, settings: normalized });
6226
+ const { bars, progressColor, shopCurrency } = await fetchProgressBarContext(input.shop, ctx, config);
6227
+ return convertSmartCartProgressBarToV2({
6228
+ bars: bars ?? [],
6229
+ id,
6230
+ progressColor,
6231
+ settings: normalized,
6232
+ shopCurrency
6233
+ });
6212
6234
  }
6213
6235
  if (isConvertibleProgressBarV1(normalized)) {
6214
6236
  const { progressColor } = await fetchProgressBarContext(input.shop, ctx, config);
@@ -4866,7 +4866,14 @@ var MAX_ICON_SIZE_PX = 64;
4866
4866
  var IN_SCOPE_TIER_TYPES = new Set(progressTierTypes);
4867
4867
  var inScope = (tier) => IN_SCOPE_TIER_TYPES.has(tier.type ?? "");
4868
4868
  var thresholdOf = (tier) => tier.unlockConditionType === "item_quantity" ? Math.ceil(Number(tier.minimum)) : Math.round(Number(tier.minimum) * 100);
4869
- var tierThresholds = (tier) => presentmentThresholds(tier.presentmentCurrencies);
4869
+ var tierThresholds = (tier, shopCurrency) => {
4870
+ const shopCode = shopCurrency?.toLowerCase();
4871
+ return Object.fromEntries(
4872
+ Object.entries(presentmentThresholds(tier.presentmentCurrencies)).filter(
4873
+ ([code, cents]) => cents > 0 && code !== shopCode
4874
+ )
4875
+ );
4876
+ };
4870
4877
  var tierLabel = (tier) => {
4871
4878
  const type = tier.type;
4872
4879
  if ((tier.customTierLabel || type === "decorative") && tier.customTierLabelText) return tier.customTierLabelText;
@@ -4920,7 +4927,7 @@ var exclusionsOf = (tier) => {
4920
4927
  });
4921
4928
  return rules.length > 0 ? rules : void 0;
4922
4929
  };
4923
- var toTierMeta = (tier) => {
4930
+ var toTierMeta = (tier, shopCurrency) => {
4924
4931
  const discount = discountOf(tier);
4925
4932
  const exclusions = exclusionsOf(tier);
4926
4933
  const gift = giftOf(tier);
@@ -4941,16 +4948,16 @@ var toTierMeta = (tier) => {
4941
4948
  /** Carry the image-swap flag only on gift tiers that set it — the client shows the gift's product image in the step slot instead of the bag icon. */
4942
4949
  ...gift && tier.productTierImage && { productTierImage: true },
4943
4950
  threshold: thresholdOf(tier),
4944
- thresholds: !isItemCount && type === "shipping" ? tierThresholds(tier) : {},
4951
+ thresholds: isItemCount ? {} : tierThresholds(tier, shopCurrency),
4945
4952
  ...tier.id && { tierId: tier.id },
4946
4953
  tierType: type,
4947
4954
  ...isItemCount && { unit: "item" }
4948
4955
  };
4949
4956
  };
4950
- var renderableTiers = (bar) => (bar.tiers ?? []).filter(
4957
+ var renderableTiers = (bar, shopCurrency) => (bar.tiers ?? []).filter(
4951
4958
  (tier) => (
4952
4959
  /** onsite `isTierDataValid`: a non-numeric (null/absent) minimum is dropped — else `thresholdOf` reads it as 0, an always-reached tier that auto-adds its gift to every cart. A literal 0 is finite and kept. Divergence: onsite's strict `typeof === 'number'` also drops a string `'50'`; here `minimum` was already `z.coerce`d (`'50' → 50`), so `Number.isFinite` keeps it — see smartCart.ts. */
4953
- inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier)).success
4960
+ inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier, shopCurrency)).success
4954
4961
  )
4955
4962
  );
4956
4963
  var PRODUCT_TOKENS = ["productTitle", "remainingAmount"];
@@ -5005,7 +5012,7 @@ var toTierFeedback = (tier) => {
5005
5012
  });
5006
5013
  return sections;
5007
5014
  };
5008
- var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor) => ({
5015
+ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor, shopCurrency) => ({
5009
5016
  /**
5010
5017
  * React's `SmartCartProgressBarContent` centers the bar/message stack (`inlineAlignment="center"`); the
5011
5018
  * section inherits `layout`'s `alignment.horizontal: 'start'`, so an emitted-bare bar would left-align.
@@ -5061,7 +5068,7 @@ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progr
5061
5068
  sectionType: "progressBar",
5062
5069
  /** React's bar/message stack uses `spacing="tight"` (→ `small-100`); `layout` defaults `spacing` to `base`, a wider gap. Emit `tight` for parity (mirrors the v1 shipping converter). */
5063
5070
  spacing: "tight",
5064
- tiers: tiers.map(toTierMeta)
5071
+ tiers: tiers.map((tier) => toTierMeta(tier, shopCurrency))
5065
5072
  });
5066
5073
  var barCountries = (bar) => [
5067
5074
  ...new Set((bar.countryCodes ?? []).map((code) => code.trim().toUpperCase()).filter(Boolean))
@@ -5087,9 +5094,16 @@ var dedupeBars = (entries) => {
5087
5094
  return rendered;
5088
5095
  };
5089
5096
  var convertSmartCartProgressBarToV2 = (input) => {
5090
- const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar) }));
5097
+ const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar, input.shopCurrency) }));
5091
5098
  const sections = dedupeBars(entries).map(
5092
- ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(entry.bar, entry.tiers, countryCodes, excludeCountryCodes, input.progressColor)
5099
+ ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(
5100
+ entry.bar,
5101
+ entry.tiers,
5102
+ countryCodes,
5103
+ excludeCountryCodes,
5104
+ input.progressColor,
5105
+ input.shopCurrency
5106
+ )
5093
5107
  );
5094
5108
  return CABRootSection.parse(
5095
5109
  normalizeTextContent({
@@ -4805,7 +4805,14 @@ var MAX_ICON_SIZE_PX = 64;
4805
4805
  var IN_SCOPE_TIER_TYPES = new Set(progressTierTypes);
4806
4806
  var inScope = (tier) => IN_SCOPE_TIER_TYPES.has(tier.type ?? "");
4807
4807
  var thresholdOf = (tier) => tier.unlockConditionType === "item_quantity" ? Math.ceil(Number(tier.minimum)) : Math.round(Number(tier.minimum) * 100);
4808
- var tierThresholds = (tier) => presentmentThresholds(tier.presentmentCurrencies);
4808
+ var tierThresholds = (tier, shopCurrency) => {
4809
+ const shopCode = shopCurrency?.toLowerCase();
4810
+ return Object.fromEntries(
4811
+ Object.entries(presentmentThresholds(tier.presentmentCurrencies)).filter(
4812
+ ([code, cents]) => cents > 0 && code !== shopCode
4813
+ )
4814
+ );
4815
+ };
4809
4816
  var tierLabel = (tier) => {
4810
4817
  const type = tier.type;
4811
4818
  if ((tier.customTierLabel || type === "decorative") && tier.customTierLabelText) return tier.customTierLabelText;
@@ -4859,7 +4866,7 @@ var exclusionsOf = (tier) => {
4859
4866
  });
4860
4867
  return rules.length > 0 ? rules : void 0;
4861
4868
  };
4862
- var toTierMeta = (tier) => {
4869
+ var toTierMeta = (tier, shopCurrency) => {
4863
4870
  const discount = discountOf(tier);
4864
4871
  const exclusions = exclusionsOf(tier);
4865
4872
  const gift = giftOf(tier);
@@ -4880,16 +4887,16 @@ var toTierMeta = (tier) => {
4880
4887
  /** Carry the image-swap flag only on gift tiers that set it — the client shows the gift's product image in the step slot instead of the bag icon. */
4881
4888
  ...gift && tier.productTierImage && { productTierImage: true },
4882
4889
  threshold: thresholdOf(tier),
4883
- thresholds: !isItemCount && type === "shipping" ? tierThresholds(tier) : {},
4890
+ thresholds: isItemCount ? {} : tierThresholds(tier, shopCurrency),
4884
4891
  ...tier.id && { tierId: tier.id },
4885
4892
  tierType: type,
4886
4893
  ...isItemCount && { unit: "item" }
4887
4894
  };
4888
4895
  };
4889
- var renderableTiers = (bar) => (bar.tiers ?? []).filter(
4896
+ var renderableTiers = (bar, shopCurrency) => (bar.tiers ?? []).filter(
4890
4897
  (tier) => (
4891
4898
  /** onsite `isTierDataValid`: a non-numeric (null/absent) minimum is dropped — else `thresholdOf` reads it as 0, an always-reached tier that auto-adds its gift to every cart. A literal 0 is finite and kept. Divergence: onsite's strict `typeof === 'number'` also drops a string `'50'`; here `minimum` was already `z.coerce`d (`'50' → 50`), so `Number.isFinite` keeps it — see smartCart.ts. */
4892
- inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier)).success
4899
+ inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier, shopCurrency)).success
4893
4900
  )
4894
4901
  );
4895
4902
  var PRODUCT_TOKENS = ["productTitle", "remainingAmount"];
@@ -4944,7 +4951,7 @@ var toTierFeedback = (tier) => {
4944
4951
  });
4945
4952
  return sections;
4946
4953
  };
4947
- var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor) => ({
4954
+ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor, shopCurrency) => ({
4948
4955
  /**
4949
4956
  * React's `SmartCartProgressBarContent` centers the bar/message stack (`inlineAlignment="center"`); the
4950
4957
  * section inherits `layout`'s `alignment.horizontal: 'start'`, so an emitted-bare bar would left-align.
@@ -5000,7 +5007,7 @@ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progr
5000
5007
  sectionType: "progressBar",
5001
5008
  /** React's bar/message stack uses `spacing="tight"` (→ `small-100`); `layout` defaults `spacing` to `base`, a wider gap. Emit `tight` for parity (mirrors the v1 shipping converter). */
5002
5009
  spacing: "tight",
5003
- tiers: tiers.map(toTierMeta)
5010
+ tiers: tiers.map((tier) => toTierMeta(tier, shopCurrency))
5004
5011
  });
5005
5012
  var barCountries = (bar) => [
5006
5013
  ...new Set((bar.countryCodes ?? []).map((code) => code.trim().toUpperCase()).filter(Boolean))
@@ -5026,9 +5033,16 @@ var dedupeBars = (entries) => {
5026
5033
  return rendered;
5027
5034
  };
5028
5035
  var convertSmartCartProgressBarToV2 = (input) => {
5029
- const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar) }));
5036
+ const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar, input.shopCurrency) }));
5030
5037
  const sections = dedupeBars(entries).map(
5031
- ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(entry.bar, entry.tiers, countryCodes, excludeCountryCodes, input.progressColor)
5038
+ ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(
5039
+ entry.bar,
5040
+ entry.tiers,
5041
+ countryCodes,
5042
+ excludeCountryCodes,
5043
+ input.progressColor,
5044
+ input.shopCurrency
5045
+ )
5032
5046
  );
5033
5047
  return CABRootSection.parse(
5034
5048
  normalizeTextContent({
@@ -6,7 +6,7 @@ import { type V1ProgressBarSettings } from '../../transforms/progressBarV1/types
6
6
  * `progressBar` container per configured bar (tiers come from the shop's smart-cart config — see
7
7
  * `extractSmartCartBars`). Each container holds its tier display (composable `columns → rows → text/image`)
8
8
  * + copy as children, with milestones on `tiers` (server-precomputed per tier: cents — base +
9
- * per-presentment-currency for shipping tiers — or a raw item count for `item_quantity` tiers) so the
9
+ * per-presentment-currency on every money tier — or a raw item count for `item_quantity` tiers) so the
10
10
  * client only compares each tier against its own unit's progress, mirroring the shipping bar. DISPLAY
11
11
  * ONLY — gift add/remove is a later stage. Tiers whose meta fails the strict schema are dropped (never
12
12
  * thrown); a bar left with no renderable tier renders nothing — but a geo bar still shadows its countries
@@ -18,4 +18,6 @@ export declare const convertSmartCartProgressBarToV2: (input: {
18
18
  /** The shop theme's `buttonBackground` (bar fill), resolved by the caller; schema-defaulted when absent. */
19
19
  progressColor?: string;
20
20
  settings: V1ProgressBarSettings;
21
+ /** The shop's base-currency ISO code (`CabShopConfig.currency`): its per-currency entry is never a threshold. */
22
+ shopCurrency?: string;
21
23
  }) => CABRootSection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebuy/rebuy",
3
- "version": "3.66.0",
3
+ "version": "3.66.1",
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.",