@schematichq/schematic-components 0.6.3 → 0.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.
@@ -3896,6 +3896,7 @@ var VISIBLE_ENTITLEMENT_COUNT = 4;
3896
3896
  var MAX_VISIBLE_INVOICE_COUNT = 12;
3897
3897
  var DEBOUNCE_TIMEOUT = 250;
3898
3898
  var DEFAULT_CURRENCY = "USD";
3899
+ var MAXIMUM_SIGNIFICANT_DIGITS = 6;
3899
3900
 
3900
3901
  // src/hooks/useAvailablePlans.ts
3901
3902
  import { useCallback as useCallback2, useMemo as useMemo2 } from "react";
@@ -10670,7 +10671,8 @@ function BillingPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
10670
10671
  externalPriceId: json["external_price_id"],
10671
10672
  id: json["id"],
10672
10673
  interval: json["interval"],
10673
- price: json["price"]
10674
+ price: json["price"],
10675
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"]
10674
10676
  };
10675
10677
  }
10676
10678
 
@@ -10690,6 +10692,7 @@ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
10690
10692
  isActive: json["is_active"],
10691
10693
  meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
10692
10694
  price: json["price"],
10695
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
10693
10696
  priceExternalId: json["price_external_id"],
10694
10697
  priceId: json["price_id"],
10695
10698
  productExternalId: json["product_external_id"],
@@ -10716,6 +10719,7 @@ function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator
10716
10719
  externalId: json["external_id"],
10717
10720
  name: json["name"],
10718
10721
  price: json["price"],
10722
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
10719
10723
  prices: json["prices"].map(
10720
10724
  BillingPriceResponseDataFromJSON
10721
10725
  ),
@@ -10744,6 +10748,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
10744
10748
  meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
10745
10749
  name: json["name"],
10746
10750
  price: json["price"],
10751
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
10747
10752
  priceExternalId: json["price_external_id"],
10748
10753
  priceId: json["price_id"],
10749
10754
  quantity: json["quantity"],
@@ -12199,8 +12204,7 @@ var en_default = {
12199
12204
  "Current plan": "Current plan",
12200
12205
  "Current usage exceeds the limit of this plan.": "Current usage exceeds the limit of this plan.",
12201
12206
  "Currently using": "Currently using {{quantity}} {{unit}}",
12202
- "Custom Plan Price": "Custom price",
12203
- "Custom Plan CTA": "Talk to support",
12207
+ "Custom price": "Custom price",
12204
12208
  Discount: "Discount",
12205
12209
  "Due today": "Due today",
12206
12210
  "Edit payment method": "Edit payment method",
@@ -12256,6 +12260,7 @@ var en_default = {
12256
12260
  "Subscribe and close": "Subscribe and close",
12257
12261
  Subscription: "Subscription",
12258
12262
  "Subscription canceled": "Subscription canceled",
12263
+ "Talk to support": "Talk to support",
12259
12264
  Trial: "Trial",
12260
12265
  "Trial ends in": "Trial ends in {{days}} days",
12261
12266
  "Trial plan": "Try free for {{days}} days",
@@ -13056,7 +13061,7 @@ var EmbedProvider = ({
13056
13061
  useEffect2(() => {
13057
13062
  if (accessToken) {
13058
13063
  const { headers = {} } = apiConfig ?? {};
13059
- headers["X-Schematic-Components-Version"] = "0.6.3";
13064
+ headers["X-Schematic-Components-Version"] = "0.7.0";
13060
13065
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
13061
13066
  const config = new Configuration({
13062
13067
  ...apiConfig,
@@ -13132,6 +13137,13 @@ var getFeatureName = (feature, count = 0) => {
13132
13137
  }
13133
13138
  return (0, import_pluralize.default)(name, count);
13134
13139
  };
13140
+ function getBillingPrice(billingPrice) {
13141
+ if (!billingPrice) {
13142
+ return;
13143
+ }
13144
+ const price = typeof billingPrice.priceDecimal === "string" ? parseFloat(billingPrice.priceDecimal) : billingPrice.price;
13145
+ return { ...billingPrice, price };
13146
+ }
13135
13147
 
13136
13148
  // src/utils/color.ts
13137
13149
  function hexToHSL(color) {
@@ -13272,16 +13284,20 @@ function formatCurrency(amount, currency) {
13272
13284
  };
13273
13285
  if (dollars >= 1e6) {
13274
13286
  return formatValue(dollars / 1e6, "M");
13275
- } else if (dollars >= 1e3) {
13287
+ }
13288
+ if (dollars >= 1e3) {
13276
13289
  return formatValue(dollars / 1e3, "k");
13277
- } else {
13278
- return new Intl.NumberFormat("en-US", {
13279
- style: "currency",
13280
- currency: resolvedCurrency,
13281
- minimumSignificantDigits: 1,
13282
- maximumSignificantDigits: 4
13283
- }).format(dollars);
13284
13290
  }
13291
+ const hasManySignificantDigits = /[1-9]/.test(
13292
+ (amount % 1).toFixed(MAXIMUM_SIGNIFICANT_DIGITS)
13293
+ );
13294
+ return new Intl.NumberFormat("en-US", {
13295
+ style: "currency",
13296
+ currency: resolvedCurrency,
13297
+ ...hasManySignificantDigits && {
13298
+ minimumSignificantDigits: 1
13299
+ }
13300
+ }).format(dollars);
13285
13301
  } catch (error) {
13286
13302
  console.error("Error formatting currency", error);
13287
13303
  return new Intl.NumberFormat("en-US", {
@@ -14921,25 +14937,32 @@ var Sidebar = ({
14921
14937
  ({ entitlement }) => entitlement.priceBehavior === "pay_as_you_go"
14922
14938
  );
14923
14939
  const subscriptionPrice = useMemo4(() => {
14924
- let total = 0;
14925
14940
  let planPrice;
14926
14941
  let currency;
14927
14942
  if (selectedPlan) {
14928
- planPrice = planPeriod === "month" ? selectedPlan.monthlyPrice?.price : selectedPlan.yearlyPrice?.price;
14929
- currency = planPeriod === "month" ? selectedPlan.monthlyPrice?.currency : selectedPlan.yearlyPrice?.currency;
14930
- if (planPrice) {
14931
- total += planPrice;
14932
- }
14943
+ const planBillingPrice = getBillingPrice(
14944
+ planPeriod === "year" ? selectedPlan.yearlyPrice : selectedPlan.monthlyPrice
14945
+ );
14946
+ planPrice = planBillingPrice?.price;
14947
+ currency = planBillingPrice?.currency;
14933
14948
  } else if (typeof currentPlan?.planPrice === "number") {
14934
14949
  planPrice = currentPlan.planPrice;
14935
14950
  }
14951
+ let total = 0;
14952
+ if (planPrice) {
14953
+ total += planPrice;
14954
+ }
14936
14955
  const addOnCost = addOns.reduce(
14937
- (sum, addOn) => sum + (addOn.isSelected ? (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0 : 0),
14956
+ (sum, addOn) => sum + (getBillingPrice(
14957
+ planPeriod === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
14958
+ )?.price ?? 0),
14938
14959
  0
14939
14960
  );
14940
14961
  total += addOnCost;
14941
14962
  const payInAdvanceCost = payInAdvanceEntitlements.reduce(
14942
- (sum, { entitlement, quantity }) => sum + quantity * ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price ?? 0),
14963
+ (sum, { entitlement, quantity }) => sum + quantity * (getBillingPrice(
14964
+ planPeriod === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
14965
+ )?.price ?? 0),
14943
14966
  0
14944
14967
  );
14945
14968
  total += payInAdvanceCost;
@@ -14963,7 +14986,7 @@ var Sidebar = ({
14963
14986
  window.dispatchEvent(event);
14964
14987
  };
14965
14988
  const checkout = useCallback7(async () => {
14966
- const priceId = (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.id;
14989
+ const priceId = (planPeriod === "year" ? selectedPlan?.yearlyPrice : selectedPlan?.monthlyPrice)?.id;
14967
14990
  if (!api || !selectedPlan || !priceId) {
14968
14991
  return;
14969
14992
  }
@@ -14976,7 +14999,7 @@ var Sidebar = ({
14976
14999
  newPriceId: priceId,
14977
15000
  addOnIds: addOns.reduce((acc, addOn) => {
14978
15001
  if (addOn.isSelected && !selectedPlan.companyCanTrial) {
14979
- const addOnPriceId = (planPeriod === "month" ? addOn?.monthlyPrice : addOn?.yearlyPrice)?.id;
15002
+ const addOnPriceId = (planPeriod === "year" ? addOn?.yearlyPrice : addOn?.monthlyPrice)?.id;
14980
15003
  if (addOnPriceId) {
14981
15004
  acc.push({
14982
15005
  addOnId: addOn.id,
@@ -14988,7 +15011,7 @@ var Sidebar = ({
14988
15011
  }, []),
14989
15012
  payInAdvance: payInAdvanceEntitlements.reduce(
14990
15013
  (acc, { entitlement, quantity }) => {
14991
- const priceId2 = (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.priceId;
15014
+ const priceId2 = (planPeriod === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice)?.priceId;
14992
15015
  if (priceId2) {
14993
15016
  acc.push({
14994
15017
  priceId: priceId2,
@@ -15111,6 +15134,9 @@ var Sidebar = ({
15111
15134
  if (isTrialable && selectedPlan.trialDays) {
15112
15135
  trialEndsOn.setDate(trialEndsOn.getDate() + selectedPlan.trialDays);
15113
15136
  }
15137
+ const selectedPlanBillingPrice = getBillingPrice(
15138
+ planPeriod === "year" ? selectedPlan?.yearlyPrice : selectedPlan?.monthlyPrice
15139
+ );
15114
15140
  return /* @__PURE__ */ jsxs8(
15115
15141
  Flex,
15116
15142
  {
@@ -15271,8 +15297,8 @@ var Sidebar = ({
15271
15297
  $color: theme.typography.text.color,
15272
15298
  children: [
15273
15299
  formatCurrency(
15274
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
15275
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
15300
+ selectedPlanBillingPrice?.price ?? 0,
15301
+ selectedPlanBillingPrice?.currency
15276
15302
  ),
15277
15303
  /* @__PURE__ */ jsxs8("sub", { children: [
15278
15304
  "/",
@@ -15300,7 +15326,12 @@ var Sidebar = ({
15300
15326
  removedUsageBasedEntitlements.reduce(
15301
15327
  (acc, { allocation, quantity, usage }, index) => {
15302
15328
  if (typeof allocation === "number" && usage.feature?.name) {
15303
- const price = (planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice)?.price;
15329
+ const {
15330
+ price: entitlementPrice,
15331
+ currency: entitlementCurrency
15332
+ } = getBillingPrice(
15333
+ planPeriod === "year" ? usage.yearlyUsageBasedPrice : usage.monthlyUsageBasedPrice
15334
+ ) || {};
15304
15335
  acc.push(
15305
15336
  /* @__PURE__ */ jsxs8(
15306
15337
  Flex,
@@ -15334,20 +15365,20 @@ var Sidebar = ({
15334
15365
  $weight: theme.typography.text.fontWeight,
15335
15366
  $color: theme.typography.text.color,
15336
15367
  children: [
15337
- usage.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15368
+ usage.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15338
15369
  formatCurrency(
15339
- price * quantity,
15340
- (planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice)?.currency
15370
+ (entitlementPrice ?? 0) * quantity,
15371
+ entitlementCurrency
15341
15372
  ),
15342
15373
  /* @__PURE__ */ jsxs8("sub", { children: [
15343
15374
  "/",
15344
15375
  shortenPeriod(planPeriod)
15345
15376
  ] })
15346
15377
  ] }),
15347
- usage.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15378
+ usage.priceBehavior === "pay_as_you_go" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15348
15379
  formatCurrency(
15349
- price,
15350
- (planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice)?.currency
15380
+ entitlementPrice ?? 0,
15381
+ entitlementCurrency
15351
15382
  ),
15352
15383
  /* @__PURE__ */ jsxs8("sub", { children: [
15353
15384
  "/",
@@ -15370,6 +15401,12 @@ var Sidebar = ({
15370
15401
  changedUsageBasedEntitlements.reduce(
15371
15402
  (acc, { entitlement, previous, next: next2 }, index) => {
15372
15403
  if (entitlement?.feature?.name) {
15404
+ const {
15405
+ price: entitlementPrice,
15406
+ currency: entitlementCurrency
15407
+ } = getBillingPrice(
15408
+ planPeriod === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
15409
+ ) || {};
15373
15410
  acc.push(
15374
15411
  /* @__PURE__ */ jsxs8(Box, { children: [
15375
15412
  /* @__PURE__ */ jsxs8(
@@ -15405,8 +15442,8 @@ var Sidebar = ({
15405
15442
  $color: theme.typography.text.color,
15406
15443
  children: [
15407
15444
  formatCurrency(
15408
- ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * previous.quantity,
15409
- (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15445
+ (entitlementPrice ?? 0) * previous.quantity,
15446
+ entitlementCurrency
15410
15447
  ),
15411
15448
  /* @__PURE__ */ jsxs8("sub", { children: [
15412
15449
  "/",
@@ -15448,8 +15485,8 @@ var Sidebar = ({
15448
15485
  $color: theme.typography.text.color,
15449
15486
  children: [
15450
15487
  formatCurrency(
15451
- ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * next2.quantity,
15452
- (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15488
+ (entitlementPrice ?? 0) * next2.quantity,
15489
+ entitlementCurrency
15453
15490
  ),
15454
15491
  /* @__PURE__ */ jsxs8("sub", { children: [
15455
15492
  "/",
@@ -15471,7 +15508,12 @@ var Sidebar = ({
15471
15508
  addedUsageBasedEntitlements.reduce(
15472
15509
  (acc, { entitlement, quantity }, index) => {
15473
15510
  if (entitlement.feature?.name) {
15474
- const price = (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price;
15511
+ const {
15512
+ price: entitlementPrice,
15513
+ currency: entitlementCurrency
15514
+ } = getBillingPrice(
15515
+ planPeriod === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
15516
+ ) || {};
15475
15517
  acc.push(
15476
15518
  /* @__PURE__ */ jsxs8(
15477
15519
  Flex,
@@ -15502,20 +15544,20 @@ var Sidebar = ({
15502
15544
  $weight: theme.typography.text.fontWeight,
15503
15545
  $color: theme.typography.text.color,
15504
15546
  children: [
15505
- entitlement.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15547
+ entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15506
15548
  formatCurrency(
15507
- price * quantity,
15508
- (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15549
+ (entitlementPrice ?? 0) * quantity,
15550
+ entitlementCurrency
15509
15551
  ),
15510
15552
  /* @__PURE__ */ jsxs8("sub", { children: [
15511
15553
  "/",
15512
15554
  shortenPeriod(planPeriod)
15513
15555
  ] })
15514
15556
  ] }),
15515
- entitlement.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15557
+ entitlement.priceBehavior === "pay_as_you_go" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15516
15558
  formatCurrency(
15517
- price,
15518
- (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15559
+ entitlementPrice ?? 0,
15560
+ entitlementCurrency
15519
15561
  ),
15520
15562
  /* @__PURE__ */ jsxs8("sub", { children: [
15521
15563
  "/",
@@ -15574,8 +15616,8 @@ var Sidebar = ({
15574
15616
  children: [
15575
15617
  "-",
15576
15618
  formatCurrency(
15577
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
15578
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
15619
+ selectedPlanBillingPrice?.price ?? 0,
15620
+ selectedPlanBillingPrice?.currency
15579
15621
  ),
15580
15622
  "/",
15581
15623
  /* @__PURE__ */ jsx13("sub", { children: shortenPeriod(planPeriod) })
@@ -15597,89 +15639,93 @@ var Sidebar = ({
15597
15639
  children: t2("Add-ons")
15598
15640
  }
15599
15641
  ) }),
15600
- removedAddOns.map((addOn, index) => /* @__PURE__ */ jsxs8(
15601
- Flex,
15602
- {
15603
- $justifyContent: "space-between",
15604
- $alignItems: "center",
15605
- $gap: "1rem",
15606
- $opacity: "0.625",
15607
- $textDecoration: "line-through",
15608
- $color: theme.typography.heading4.color,
15609
- children: [
15610
- /* @__PURE__ */ jsx13(Box, { children: /* @__PURE__ */ jsx13(
15611
- Text,
15612
- {
15613
- $font: theme.typography.heading4.fontFamily,
15614
- $size: theme.typography.heading4.fontSize,
15615
- $weight: theme.typography.heading4.fontWeight,
15616
- $color: theme.typography.heading4.color,
15617
- children: addOn.name
15618
- }
15619
- ) }),
15620
- typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
15621
- Text,
15622
- {
15623
- $font: theme.typography.text.fontFamily,
15624
- $size: theme.typography.text.fontSize,
15625
- $weight: theme.typography.text.fontWeight,
15626
- $color: theme.typography.text.color,
15627
- children: [
15628
- formatCurrency(
15629
- addOn.planPrice,
15630
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15631
- ),
15632
- /* @__PURE__ */ jsxs8("sub", { children: [
15633
- "/",
15634
- shortenPeriod(addOn.planPeriod)
15635
- ] })
15636
- ]
15637
- }
15638
- ) })
15639
- ]
15640
- },
15641
- index
15642
- )),
15643
- selectedAddOns.map((addOn, index) => /* @__PURE__ */ jsxs8(
15644
- Flex,
15645
- {
15646
- $justifyContent: "space-between",
15647
- $alignItems: "center",
15648
- $gap: "1rem",
15649
- children: [
15650
- /* @__PURE__ */ jsx13(Box, { children: /* @__PURE__ */ jsx13(
15651
- Text,
15652
- {
15653
- $font: theme.typography.heading4.fontFamily,
15654
- $size: theme.typography.heading4.fontSize,
15655
- $weight: theme.typography.heading4.fontWeight,
15656
- $color: theme.typography.heading4.color,
15657
- children: addOn.name
15658
- }
15659
- ) }),
15660
- /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
15661
- Text,
15662
- {
15663
- $font: theme.typography.text.fontFamily,
15664
- $size: theme.typography.text.fontSize,
15665
- $weight: theme.typography.text.fontWeight,
15666
- $color: theme.typography.text.color,
15667
- children: [
15668
- formatCurrency(
15669
- (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0,
15670
- (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.currency
15671
- ),
15672
- /* @__PURE__ */ jsxs8("sub", { children: [
15673
- "/",
15674
- shortenPeriod(planPeriod)
15675
- ] })
15676
- ]
15677
- }
15678
- ) })
15679
- ]
15680
- },
15681
- index
15682
- ))
15642
+ removedAddOns.map((addOn, index) => {
15643
+ return /* @__PURE__ */ jsxs8(
15644
+ Flex,
15645
+ {
15646
+ $justifyContent: "space-between",
15647
+ $alignItems: "center",
15648
+ $gap: "1rem",
15649
+ $opacity: "0.625",
15650
+ $textDecoration: "line-through",
15651
+ $color: theme.typography.heading4.color,
15652
+ children: [
15653
+ /* @__PURE__ */ jsx13(Box, { children: /* @__PURE__ */ jsx13(
15654
+ Text,
15655
+ {
15656
+ $font: theme.typography.heading4.fontFamily,
15657
+ $size: theme.typography.heading4.fontSize,
15658
+ $weight: theme.typography.heading4.fontWeight,
15659
+ $color: theme.typography.heading4.color,
15660
+ children: addOn.name
15661
+ }
15662
+ ) }),
15663
+ typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
15664
+ Text,
15665
+ {
15666
+ $font: theme.typography.text.fontFamily,
15667
+ $size: theme.typography.text.fontSize,
15668
+ $weight: theme.typography.text.fontWeight,
15669
+ $color: theme.typography.text.color,
15670
+ children: [
15671
+ formatCurrency(
15672
+ addOn.planPrice,
15673
+ selectedPlanBillingPrice?.currency
15674
+ ),
15675
+ /* @__PURE__ */ jsxs8("sub", { children: [
15676
+ "/",
15677
+ shortenPeriod(addOn.planPeriod)
15678
+ ] })
15679
+ ]
15680
+ }
15681
+ ) })
15682
+ ]
15683
+ },
15684
+ index
15685
+ );
15686
+ }),
15687
+ selectedAddOns.map((addOn, index) => {
15688
+ const { price: addOnPrice, currency: addOnCurrency } = getBillingPrice(
15689
+ planPeriod === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
15690
+ ) || {};
15691
+ return /* @__PURE__ */ jsxs8(
15692
+ Flex,
15693
+ {
15694
+ $justifyContent: "space-between",
15695
+ $alignItems: "center",
15696
+ $gap: "1rem",
15697
+ children: [
15698
+ /* @__PURE__ */ jsx13(Box, { children: /* @__PURE__ */ jsx13(
15699
+ Text,
15700
+ {
15701
+ $font: theme.typography.heading4.fontFamily,
15702
+ $size: theme.typography.heading4.fontSize,
15703
+ $weight: theme.typography.heading4.fontWeight,
15704
+ $color: theme.typography.heading4.color,
15705
+ children: addOn.name
15706
+ }
15707
+ ) }),
15708
+ /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
15709
+ Text,
15710
+ {
15711
+ $font: theme.typography.text.fontFamily,
15712
+ $size: theme.typography.text.fontSize,
15713
+ $weight: theme.typography.text.fontWeight,
15714
+ $color: theme.typography.text.color,
15715
+ children: [
15716
+ formatCurrency(addOnPrice ?? 0, addOnCurrency),
15717
+ /* @__PURE__ */ jsxs8("sub", { children: [
15718
+ "/",
15719
+ shortenPeriod(planPeriod)
15720
+ ] })
15721
+ ]
15722
+ }
15723
+ ) })
15724
+ ]
15725
+ },
15726
+ index
15727
+ );
15728
+ })
15683
15729
  ] }),
15684
15730
  proration !== 0 && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15685
15731
  /* @__PURE__ */ jsx13(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx13(
@@ -15718,7 +15764,7 @@ var Sidebar = ({
15718
15764
  $color: theme.typography.text.color,
15719
15765
  children: formatCurrency(
15720
15766
  proration,
15721
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15767
+ selectedPlanBillingPrice?.currency
15722
15768
  )
15723
15769
  }
15724
15770
  ) })
@@ -15825,7 +15871,7 @@ var Sidebar = ({
15825
15871
  $color: theme.typography.text.color,
15826
15872
  children: formatCurrency(
15827
15873
  newCharges / 100 * percentOff,
15828
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15874
+ selectedPlanBillingPrice?.currency
15829
15875
  )
15830
15876
  }
15831
15877
  ) })
@@ -15849,7 +15895,7 @@ var Sidebar = ({
15849
15895
  children: t2("X off", {
15850
15896
  amount: formatCurrency(
15851
15897
  Math.abs(amountOff),
15852
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15898
+ selectedPlanBillingPrice?.currency
15853
15899
  )
15854
15900
  })
15855
15901
  }
@@ -15865,7 +15911,7 @@ var Sidebar = ({
15865
15911
  "-",
15866
15912
  formatCurrency(
15867
15913
  Math.abs(amountOff),
15868
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15914
+ selectedPlanBillingPrice?.currency
15869
15915
  )
15870
15916
  ]
15871
15917
  }
@@ -15888,7 +15934,7 @@ var Sidebar = ({
15888
15934
  $weight: theme.typography.text.fontWeight,
15889
15935
  $color: theme.typography.text.color,
15890
15936
  children: [
15891
- planPeriod === "month" ? "Monthly" : "Yearly",
15937
+ planPeriod === "year" ? "Yearly" : "Monthly",
15892
15938
  " total:"
15893
15939
  ]
15894
15940
  }
@@ -15941,7 +15987,7 @@ var Sidebar = ({
15941
15987
  $color: theme.typography.text.color,
15942
15988
  children: formatCurrency(
15943
15989
  Math.max(0, dueNow),
15944
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15990
+ selectedPlanBillingPrice?.currency
15945
15991
  )
15946
15992
  }
15947
15993
  ) })
@@ -15971,7 +16017,7 @@ var Sidebar = ({
15971
16017
  $color: theme.typography.text.color,
15972
16018
  children: formatCurrency(
15973
16019
  Math.abs(dueNow),
15974
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
16020
+ selectedPlanBillingPrice?.currency
15975
16021
  )
15976
16022
  }
15977
16023
  ) })
@@ -16038,6 +16084,9 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
16038
16084
  $gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
16039
16085
  $gap: "1rem",
16040
16086
  children: addOns.map((addOn, index) => {
16087
+ const { price, currency } = getBillingPrice(
16088
+ period === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
16089
+ ) || {};
16041
16090
  return /* @__PURE__ */ jsxs9(
16042
16091
  Flex,
16043
16092
  {
@@ -16081,10 +16130,7 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
16081
16130
  $size: theme.typography.heading2.fontSize,
16082
16131
  $weight: theme.typography.heading2.fontWeight,
16083
16132
  $color: theme.typography.heading2.color,
16084
- children: formatCurrency(
16085
- (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0,
16086
- (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.currency
16087
- )
16133
+ children: formatCurrency(price ?? 0, currency)
16088
16134
  }
16089
16135
  ),
16090
16136
  /* @__PURE__ */ jsxs9(
@@ -16107,12 +16153,19 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
16107
16153
  $position: "absolute",
16108
16154
  $right: "1rem",
16109
16155
  $top: "1rem",
16110
- $fontSize: "0.75rem",
16111
- $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
16112
16156
  $backgroundColor: theme.primary,
16113
16157
  $borderRadius: "9999px",
16114
16158
  $padding: "0.125rem 0.85rem",
16115
- children: t2("Active")
16159
+ children: /* @__PURE__ */ jsx14(
16160
+ Text,
16161
+ {
16162
+ $font: theme.typography.text.fontFamily,
16163
+ $size: 0.75 * theme.typography.text.fontSize,
16164
+ $weight: theme.typography.text.fontWeight,
16165
+ $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
16166
+ children: t2("Active")
16167
+ }
16168
+ )
16116
16169
  }
16117
16170
  )
16118
16171
  ] }),
@@ -16576,11 +16629,14 @@ var Plan = ({
16576
16629
  children: plans.map((plan, planIndex) => {
16577
16630
  const count = entitlementCounts[plan.id];
16578
16631
  const isExpanded = count.limit > VISIBLE_ENTITLEMENT_COUNT;
16579
- const { price: planPrice, currency: planCurrency } = (period === "month" ? plan.monthlyPrice : period === "year" && plan.yearlyPrice) || {};
16632
+ const { price: planPrice, currency: planCurrency } = getBillingPrice(
16633
+ period === "year" ? plan.yearlyPrice : plan.monthlyPrice
16634
+ ) || {};
16580
16635
  const hasUsageBasedEntitlements = plan.entitlements.some(
16581
16636
  (entitlement) => !!entitlement.priceBehavior
16582
16637
  );
16583
16638
  const isUsageBasedPlan = planPrice === 0 && hasUsageBasedEntitlements;
16639
+ const headerPriceFontStyle = plan.custom || isUsageBasedPlan ? theme.typography.heading3 : theme.typography.heading2;
16584
16640
  return /* @__PURE__ */ jsxs12(
16585
16641
  Flex,
16586
16642
  {
@@ -16634,11 +16690,11 @@ var Plan = ({
16634
16690
  /* @__PURE__ */ jsx17(
16635
16691
  Text,
16636
16692
  {
16637
- $font: theme.typography.heading2.fontFamily,
16638
- $size: theme.typography.heading2.fontSize,
16639
- $weight: theme.typography.heading2.fontWeight,
16640
- $color: theme.typography.heading2.color,
16641
- children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom Plan Price") : isUsageBasedPlan ? t2("Usage-based") : formatCurrency(planPrice ?? 0, planCurrency)
16693
+ $font: headerPriceFontStyle.fontFamily,
16694
+ $size: headerPriceFontStyle.fontSize,
16695
+ $weight: headerPriceFontStyle.fontWeight,
16696
+ $color: headerPriceFontStyle.color,
16697
+ children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom price") : isUsageBasedPlan ? t2("Usage-based") : formatCurrency(planPrice ?? 0, planCurrency)
16642
16698
  }
16643
16699
  ),
16644
16700
  !plan.custom && !isUsageBasedPlan && /* @__PURE__ */ jsxs12(
@@ -16661,12 +16717,19 @@ var Plan = ({
16661
16717
  $position: "absolute",
16662
16718
  $right: "1rem",
16663
16719
  $top: "1rem",
16664
- $fontSize: "0.75rem",
16665
- $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
16666
16720
  $backgroundColor: theme.primary,
16667
16721
  $borderRadius: "9999px",
16668
16722
  $padding: "0.125rem 0.85rem",
16669
- children: t2("Active")
16723
+ children: /* @__PURE__ */ jsx17(
16724
+ Text,
16725
+ {
16726
+ $font: theme.typography.text.fontFamily,
16727
+ $size: 0.75 * theme.typography.text.fontSize,
16728
+ $weight: theme.typography.text.fontWeight,
16729
+ $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
16730
+ children: t2("Active")
16731
+ }
16732
+ )
16670
16733
  }
16671
16734
  )
16672
16735
  ]
@@ -16698,7 +16761,9 @@ var Plan = ({
16698
16761
  const {
16699
16762
  price: entitlementPrice,
16700
16763
  currency: entitlementCurrency
16701
- } = (period === "month" ? entitlement.meteredMonthlyPrice : period === "year" && entitlement.meteredYearlyPrice) || {};
16764
+ } = getBillingPrice(
16765
+ period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
16766
+ ) || {};
16702
16767
  if (entitlement.priceBehavior && typeof entitlementPrice !== "number") {
16703
16768
  return acc;
16704
16769
  }
@@ -16908,7 +16973,7 @@ var Plan = ({
16908
16973
  {
16909
16974
  href: plan.customPlanConfig?.ctaWebSite ?? "#",
16910
16975
  target: "_blank",
16911
- children: plan.customPlanConfig?.ctaText ?? t2("Custom Plan CTA")
16976
+ children: plan.customPlanConfig?.ctaText ?? t2("Talk to support")
16912
16977
  }
16913
16978
  ) : !plan.valid ? /* @__PURE__ */ jsx17(
16914
16979
  Tooltip,
@@ -16944,6 +17009,9 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
16944
17009
  return /* @__PURE__ */ jsx18(Fragment8, { children: /* @__PURE__ */ jsx18(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce(
16945
17010
  (acc, { entitlement, quantity, usage }, index) => {
16946
17011
  if (entitlement.priceBehavior === "pay_in_advance" && entitlement.feature) {
17012
+ const { price, currency } = getBillingPrice(
17013
+ period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
17014
+ ) || {};
16947
17015
  acc.push(
16948
17016
  /* @__PURE__ */ jsxs13(
16949
17017
  Flex,
@@ -17047,10 +17115,7 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
17047
17115
  $weight: theme.typography.text.fontWeight,
17048
17116
  $color: theme.typography.text.color,
17049
17117
  children: [
17050
- formatCurrency(
17051
- ((period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * quantity,
17052
- (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
17053
- ),
17118
+ formatCurrency((price ?? 0) * quantity, currency),
17054
17119
  /* @__PURE__ */ jsxs13("sub", { children: [
17055
17120
  "/",
17056
17121
  shortenPeriod(period)
@@ -17066,10 +17131,7 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
17066
17131
  $weight: theme.typography.text.fontWeight,
17067
17132
  $color: unitPriceColor,
17068
17133
  children: [
17069
- formatCurrency(
17070
- (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0,
17071
- (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
17072
- ),
17134
+ formatCurrency(price ?? 0, currency),
17073
17135
  /* @__PURE__ */ jsxs13("sub", { children: [
17074
17136
  "/",
17075
17137
  getFeatureName(entitlement.feature, 1),
@@ -17220,7 +17282,7 @@ var CheckoutDialog = ({ top = 0 }) => {
17220
17282
  async (updates) => {
17221
17283
  const period = updates.period || planPeriod;
17222
17284
  const plan = updates.plan || selectedPlan;
17223
- const planPriceId = period === "month" ? plan?.monthlyPrice?.id : plan?.yearlyPrice?.id;
17285
+ const planPriceId = period === "year" ? plan?.yearlyPrice?.id : plan?.monthlyPrice?.id;
17224
17286
  if (!api || !plan || !planPriceId) {
17225
17287
  return;
17226
17288
  }
@@ -17235,7 +17297,7 @@ var CheckoutDialog = ({ top = 0 }) => {
17235
17297
  addOnIds: (updates.addOns || addOns).reduce(
17236
17298
  (acc, addOn) => {
17237
17299
  if (addOn.isSelected) {
17238
- const addOnPriceId = (period === "month" ? addOn?.monthlyPrice : addOn?.yearlyPrice)?.id;
17300
+ const addOnPriceId = (period === "year" ? addOn?.yearlyPrice : addOn?.monthlyPrice)?.id;
17239
17301
  if (addOnPriceId) {
17240
17302
  acc.push({
17241
17303
  addOnId: addOn.id,
@@ -17249,7 +17311,7 @@ var CheckoutDialog = ({ top = 0 }) => {
17249
17311
  ),
17250
17312
  payInAdvance: (updates.payInAdvanceEntitlements || payInAdvanceEntitlements).reduce(
17251
17313
  (acc, { entitlement, quantity }) => {
17252
- const priceId = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.priceId;
17314
+ const priceId = (period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice)?.priceId;
17253
17315
  if (priceId) {
17254
17316
  acc.push({
17255
17317
  priceId,
@@ -17704,8 +17766,10 @@ var PeriodToggle = ({
17704
17766
  const [tooltipZIndex, setTooltipZIndex] = useState9(1);
17705
17767
  const savingsPercentage = useMemo6(() => {
17706
17768
  if (selectedPlan) {
17707
- const monthly = (selectedPlan?.monthlyPrice?.price || 0) * 12;
17708
- const yearly = selectedPlan?.yearlyPrice?.price || 0;
17769
+ const monthlyBillingPrice = getBillingPrice(selectedPlan?.monthlyPrice);
17770
+ const yearlyBillingPrice = getBillingPrice(selectedPlan?.yearlyPrice);
17771
+ const monthly = (monthlyBillingPrice?.price ?? 0) * 12;
17772
+ const yearly = yearlyBillingPrice?.price ?? 0;
17709
17773
  return Math.round((monthly - yearly) / monthly * 1e4) / 100;
17710
17774
  }
17711
17775
  return 0;
@@ -18234,25 +18298,11 @@ var Details = ({
18234
18298
  const { t: t2 } = useTranslation();
18235
18299
  const theme = nt();
18236
18300
  const { data } = useEmbed();
18237
- const currency = useMemo8(() => {
18238
- if (data.company?.plan?.planPeriod === "month") {
18239
- return monthlyUsageBasedPrice?.currency;
18240
- }
18241
- if (data.company?.plan?.planPeriod === "year") {
18242
- return yearlyUsageBasedPrice?.currency;
18243
- }
18244
- }, [
18245
- data.company?.plan?.planPeriod,
18246
- monthlyUsageBasedPrice,
18247
- yearlyUsageBasedPrice
18248
- ]);
18249
- const price = useMemo8(() => {
18250
- if (data.company?.plan?.planPeriod === "month") {
18251
- return monthlyUsageBasedPrice?.price;
18252
- }
18253
- if (data.company?.plan?.planPeriod === "year") {
18254
- return yearlyUsageBasedPrice?.price;
18255
- }
18301
+ const { price, currency } = useMemo8(() => {
18302
+ const { price: entitlementPrice, currency: entitlementCurrency } = getBillingPrice(
18303
+ data.company?.plan?.planPeriod === "year" ? yearlyUsageBasedPrice : monthlyUsageBasedPrice
18304
+ ) || {};
18305
+ return { price: entitlementPrice, currency: entitlementCurrency };
18256
18306
  }, [
18257
18307
  data.company?.plan?.planPeriod,
18258
18308
  monthlyUsageBasedPrice,
@@ -18688,6 +18738,7 @@ import { forwardRef as forwardRef9, useMemo as useMemo10, useRef as useRef8 } fr
18688
18738
  // src/components/elements/metered-features/styles.ts
18689
18739
  var Container4 = dt(Flex)`
18690
18740
  flex-direction: column;
18741
+ gap: 1rem;
18691
18742
 
18692
18743
  &:last-child {
18693
18744
  overflow: hidden;
@@ -18712,6 +18763,15 @@ var Container4 = dt(Flex)`
18712
18763
  `;
18713
18764
  }}
18714
18765
  }
18766
+
18767
+ ${({ theme }) => {
18768
+ return theme.sectionLayout === "separate" && lt`
18769
+ ${Element}:not(:is(${FussyChild})) {
18770
+ border-bottom-left-radius: 0;
18771
+ border-bottom-right-radius: 0;
18772
+ }
18773
+ `;
18774
+ }}
18715
18775
  `;
18716
18776
 
18717
18777
  // src/components/elements/metered-features/MeteredFeatures.tsx
@@ -18784,7 +18844,9 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18784
18844
  }, index) => {
18785
18845
  const limit = softLimit ?? allocation ?? 0;
18786
18846
  const isOverage = priceBehavior === "overage" && typeof softLimit === "number" && typeof usage === "number" && usage > softLimit;
18787
- const { price, currency } = (planPeriod === "month" ? monthlyUsageBasedPrice : planPeriod === "year" && yearlyUsageBasedPrice) || {};
18847
+ const { price, currency } = getBillingPrice(
18848
+ planPeriod === "year" ? yearlyUsageBasedPrice : monthlyUsageBasedPrice
18849
+ ) || {};
18788
18850
  const progressBar = props.isVisible && typeof usage === "number" && limit > 0 && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ jsx30(
18789
18851
  ProgressBar,
18790
18852
  {
@@ -18806,6 +18868,10 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18806
18868
  $alignItems: "center",
18807
18869
  $padding: `${0.4375 * theme.card.padding / TEXT_BASE_SIZE}rem ${theme.card.padding / TEXT_BASE_SIZE}rem`,
18808
18870
  $backgroundColor: isLightBackground ? darken(theme.card.background, 0.05) : lighten(theme.card.background, 0.1),
18871
+ ...theme.sectionLayout === "separate" && {
18872
+ $borderBottomLeftRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
18873
+ $borderBottomRightRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`
18874
+ },
18809
18875
  children: [
18810
18876
  /* @__PURE__ */ jsx30(
18811
18877
  Text,
@@ -19643,8 +19709,10 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19643
19709
  };
19644
19710
  const usageBasedEntitlements = (featureUsage?.features || []).reduce(
19645
19711
  (acc, usage) => {
19646
- const { price, currency } = (currentPlan?.planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice) || {};
19647
- if (usage.priceBehavior && typeof price === "number") {
19712
+ const { price, currency } = getBillingPrice(
19713
+ currentPlan?.planPeriod === "year" ? usage.yearlyUsageBasedPrice : usage.monthlyUsageBasedPrice
19714
+ ) || {};
19715
+ if (usage.priceBehavior) {
19648
19716
  acc.push({ ...usage, price, currency });
19649
19717
  }
19650
19718
  return acc;
@@ -19664,6 +19732,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19664
19732
  const isTrialSubscription = billingSubscription?.status === "trialing";
19665
19733
  const willSubscriptionCancel = billingSubscription?.cancelAtPeriodEnd;
19666
19734
  const isUsageBasedPlan = currentPlan?.planPrice === 0 && usageBasedEntitlements.length > 0;
19735
+ const headerPriceFontStyle = isUsageBasedPlan ? theme.typography.heading3 : theme.typography[props.header.price.fontStyle];
19667
19736
  return /* @__PURE__ */ jsxs27(Fragment11, { children: [
19668
19737
  isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs27(
19669
19738
  Box,
@@ -19785,10 +19854,10 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19785
19854
  /* @__PURE__ */ jsx34(
19786
19855
  Text,
19787
19856
  {
19788
- $font: theme.typography[props.header.price.fontStyle].fontFamily,
19789
- $size: theme.typography[props.header.price.fontStyle].fontSize,
19790
- $weight: theme.typography[props.header.price.fontStyle].fontWeight,
19791
- $color: theme.typography[props.header.price.fontStyle].color,
19857
+ $font: headerPriceFontStyle.fontFamily,
19858
+ $size: headerPriceFontStyle.fontSize,
19859
+ $weight: headerPriceFontStyle.fontWeight,
19860
+ $color: headerPriceFontStyle.color,
19792
19861
  children: isUsageBasedPlan ? t2("Usage-based") : formatCurrency(
19793
19862
  currentPlan.planPrice,
19794
19863
  subscriptionCurrency
@@ -19925,7 +19994,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19925
19994
  ":",
19926
19995
  " ",
19927
19996
  formatCurrency(
19928
- entitlement.price,
19997
+ entitlement.price ?? 0,
19929
19998
  entitlement.currency
19930
19999
  ),
19931
20000
  /* @__PURE__ */ jsxs27("sub", { children: [
@@ -19947,7 +20016,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19947
20016
  $color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
19948
20017
  children: [
19949
20018
  formatCurrency(
19950
- entitlement.price,
20019
+ entitlement.price ?? 0,
19951
20020
  entitlement.currency
19952
20021
  ),
19953
20022
  /* @__PURE__ */ jsxs27("sub", { children: [
@@ -19968,7 +20037,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19968
20037
  $color: theme.typography.text.color,
19969
20038
  children: [
19970
20039
  formatCurrency(
19971
- entitlement.price * amount,
20040
+ (entitlement.price ?? 0) * amount,
19972
20041
  entitlement.currency
19973
20042
  ),
19974
20043
  (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ jsxs27("sub", { children: [
@@ -20148,13 +20217,16 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
20148
20217
  $gap: "1rem",
20149
20218
  children: plans.map((plan, planIndex, self2) => {
20150
20219
  const isActivePlan = plan.current && data.company?.plan?.planPeriod === selectedPeriod;
20151
- const { price: planPrice, currency: planCurrency } = (selectedPeriod === "month" ? plan.monthlyPrice : selectedPeriod === "year" && plan.yearlyPrice) || {};
20220
+ const { price: planPrice, currency: planCurrency } = getBillingPrice(
20221
+ selectedPeriod === "year" ? plan.yearlyPrice : plan.monthlyPrice
20222
+ ) || {};
20152
20223
  const count = entitlementCounts[plan.id];
20153
20224
  const isExpanded = count.limit > VISIBLE_ENTITLEMENT_COUNT;
20154
20225
  const hasUsageBasedEntitlements = plan.entitlements.some(
20155
20226
  (entitlement) => !!entitlement.priceBehavior
20156
20227
  );
20157
20228
  const isUsageBasedPlan = planPrice === 0 && hasUsageBasedEntitlements;
20229
+ const headerPriceFontStyle = plan.custom || isUsageBasedPlan ? theme.typography.heading3 : theme.typography[props.plans.name.fontStyle];
20158
20230
  return /* @__PURE__ */ jsxs28(
20159
20231
  Flex,
20160
20232
  {
@@ -20203,11 +20275,11 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
20203
20275
  /* @__PURE__ */ jsx35(
20204
20276
  Text,
20205
20277
  {
20206
- $font: theme.typography[props.plans.name.fontStyle].fontFamily,
20207
- $size: theme.typography[props.plans.name.fontStyle].fontSize,
20208
- $weight: theme.typography[props.plans.name.fontStyle].fontWeight,
20209
- $color: theme.typography[props.plans.name.fontStyle].color,
20210
- children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom Plan Price") : isUsageBasedPlan ? t2("Usage-based") : formatCurrency(planPrice ?? 0, planCurrency)
20278
+ $font: headerPriceFontStyle.fontFamily,
20279
+ $size: headerPriceFontStyle.fontSize,
20280
+ $weight: headerPriceFontStyle.fontWeight,
20281
+ $color: headerPriceFontStyle.color,
20282
+ children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom price") : isUsageBasedPlan ? t2("Usage-based") : formatCurrency(planPrice ?? 0, planCurrency)
20211
20283
  }
20212
20284
  ),
20213
20285
  !plan.custom && !isUsageBasedPlan && /* @__PURE__ */ jsxs28(
@@ -20230,12 +20302,19 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
20230
20302
  $position: "absolute",
20231
20303
  $right: "1rem",
20232
20304
  $top: "1rem",
20233
- $fontSize: "0.75rem",
20234
- $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
20235
20305
  $backgroundColor: theme.primary,
20236
20306
  $borderRadius: "9999px",
20237
20307
  $padding: "0.125rem 0.85rem",
20238
- children: trialEndDays ? t2("Trial ends in", { days: trialEndDays }) : t2("Active")
20308
+ children: /* @__PURE__ */ jsx35(
20309
+ Text,
20310
+ {
20311
+ $font: theme.typography.text.fontFamily,
20312
+ $size: 0.75 * theme.typography.text.fontSize,
20313
+ $weight: theme.typography.text.fontWeight,
20314
+ $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
20315
+ children: trialEndDays ? t2("Trial ends in", { days: trialEndDays }) : t2("Active")
20316
+ }
20317
+ )
20239
20318
  }
20240
20319
  )
20241
20320
  ]
@@ -20269,7 +20348,9 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
20269
20348
  const {
20270
20349
  price: entitlementPrice,
20271
20350
  currency: entitlementCurrency
20272
- } = (selectedPeriod === "month" ? entitlement.meteredMonthlyPrice : selectedPeriod === "year" && entitlement.meteredYearlyPrice) || {};
20351
+ } = getBillingPrice(
20352
+ selectedPeriod === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
20353
+ ) || {};
20273
20354
  if (entitlement.priceBehavior && typeof entitlementPrice !== "number") {
20274
20355
  return acc;
20275
20356
  }
@@ -20492,7 +20573,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
20492
20573
  {
20493
20574
  href: plan.customPlanConfig?.ctaWebSite ?? "#",
20494
20575
  target: "_blank",
20495
- children: plan.customPlanConfig?.ctaText ?? t2("Custom Plan CTA")
20576
+ children: plan.customPlanConfig?.ctaText ?? t2("Talk to support")
20496
20577
  }
20497
20578
  ) : !plan.valid ? /* @__PURE__ */ jsx35(
20498
20579
  Tooltip,
@@ -20543,7 +20624,9 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
20543
20624
  $gap: "1rem",
20544
20625
  children: addOns.map((addOn, addOnIndex) => {
20545
20626
  const isActiveAddOn = addOn.current && selectedPeriod === data.company?.addOns.find((a2) => a2.id === addOn.id)?.planPeriod;
20546
- const { price: addOnPrice, currency: addOnCurrency } = (selectedPeriod === "month" ? addOn.monthlyPrice : selectedPeriod === "year" && addOn.yearlyPrice) || {};
20627
+ const { price: addOnPrice, currency: addOnCurrency } = getBillingPrice(
20628
+ selectedPeriod === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
20629
+ ) || {};
20547
20630
  return /* @__PURE__ */ jsxs28(
20548
20631
  Flex,
20549
20632
  {
@@ -20610,12 +20693,19 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
20610
20693
  $position: "absolute",
20611
20694
  $right: "1rem",
20612
20695
  $top: "1rem",
20613
- $fontSize: "0.75rem",
20614
- $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
20615
20696
  $backgroundColor: theme.primary,
20616
20697
  $borderRadius: "9999px",
20617
20698
  $padding: "0.125rem 0.85rem",
20618
- children: t2("Active")
20699
+ children: /* @__PURE__ */ jsx35(
20700
+ Text,
20701
+ {
20702
+ $font: theme.typography.text.fontFamily,
20703
+ $size: 0.75 * theme.typography.text.fontSize,
20704
+ $weight: theme.typography.text.fontWeight,
20705
+ $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
20706
+ children: t2("Active")
20707
+ }
20708
+ )
20619
20709
  }
20620
20710
  )
20621
20711
  ] }),