@schematichq/schematic-components 0.6.4 → 0.7.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.
@@ -10671,7 +10671,8 @@ function BillingPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
10671
10671
  externalPriceId: json["external_price_id"],
10672
10672
  id: json["id"],
10673
10673
  interval: json["interval"],
10674
- price: json["price"]
10674
+ price: json["price"],
10675
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"]
10675
10676
  };
10676
10677
  }
10677
10678
 
@@ -10691,6 +10692,7 @@ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
10691
10692
  isActive: json["is_active"],
10692
10693
  meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
10693
10694
  price: json["price"],
10695
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
10694
10696
  priceExternalId: json["price_external_id"],
10695
10697
  priceId: json["price_id"],
10696
10698
  productExternalId: json["product_external_id"],
@@ -10717,6 +10719,7 @@ function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator
10717
10719
  externalId: json["external_id"],
10718
10720
  name: json["name"],
10719
10721
  price: json["price"],
10722
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
10720
10723
  prices: json["prices"].map(
10721
10724
  BillingPriceResponseDataFromJSON
10722
10725
  ),
@@ -10745,6 +10748,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
10745
10748
  meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
10746
10749
  name: json["name"],
10747
10750
  price: json["price"],
10751
+ priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
10748
10752
  priceExternalId: json["price_external_id"],
10749
10753
  priceId: json["price_id"],
10750
10754
  quantity: json["quantity"],
@@ -13057,7 +13061,7 @@ var EmbedProvider = ({
13057
13061
  useEffect2(() => {
13058
13062
  if (accessToken) {
13059
13063
  const { headers = {} } = apiConfig ?? {};
13060
- headers["X-Schematic-Components-Version"] = "0.6.4";
13064
+ headers["X-Schematic-Components-Version"] = "0.7.1";
13061
13065
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
13062
13066
  const config = new Configuration({
13063
13067
  ...apiConfig,
@@ -13133,6 +13137,13 @@ var getFeatureName = (feature, count = 0) => {
13133
13137
  }
13134
13138
  return (0, import_pluralize.default)(name, count);
13135
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
+ }
13136
13147
 
13137
13148
  // src/utils/color.ts
13138
13149
  function hexToHSL(color) {
@@ -13272,7 +13283,7 @@ function formatCurrency(amount, currency) {
13272
13283
  return `$${formatted}${symbol}`;
13273
13284
  };
13274
13285
  if (dollars >= 1e6) {
13275
- formatValue(dollars / 1e6, "M");
13286
+ return formatValue(dollars / 1e6, "M");
13276
13287
  }
13277
13288
  if (dollars >= 1e3) {
13278
13289
  return formatValue(dollars / 1e3, "k");
@@ -13395,10 +13406,7 @@ import { forwardRef as forwardRef3 } from "react";
13395
13406
  // src/components/ui/box/styles.ts
13396
13407
  var Box = dt.div((props) => {
13397
13408
  function reducer(acc, [key, value]) {
13398
- if (key.startsWith("$") && ![
13399
- "$viewport",
13400
- ...Object.values(TextPropNames).filter((prop) => prop !== "$color")
13401
- ].includes(key)) {
13409
+ if (key.startsWith("$") && !["$viewport"].includes(key)) {
13402
13410
  acc.push(
13403
13411
  // keys will always be CSS properties
13404
13412
  attr(camelToHyphen(key.slice(1)), value)
@@ -13521,6 +13529,7 @@ var Button2 = forwardRef(
13521
13529
  children,
13522
13530
  ...props
13523
13531
  }, ref) => {
13532
+ const theme = nt();
13524
13533
  return /* @__PURE__ */ jsxs2(
13525
13534
  Button,
13526
13535
  {
@@ -13531,7 +13540,7 @@ var Button2 = forwardRef(
13531
13540
  disabled,
13532
13541
  ...props,
13533
13542
  children: [
13534
- /* @__PURE__ */ jsx2(Loader, { $size: "sm", $isLoading: isLoading }),
13543
+ /* @__PURE__ */ jsx2(Loader, { $color: theme.primary, $size: "sm", $isLoading: isLoading }),
13535
13544
  children
13536
13545
  ]
13537
13546
  }
@@ -14039,7 +14048,7 @@ var Loader = dt.div`
14039
14048
  }
14040
14049
  return lt`
14041
14050
  border-color: ${color};
14042
- border-top-color: ${colorFn(color, 42.5)};
14051
+ border-top-color: ${colorFn(color, 0.425)};
14043
14052
  `;
14044
14053
  }}
14045
14054
 
@@ -14219,8 +14228,11 @@ var ModalHeader = ({
14219
14228
  };
14220
14229
 
14221
14230
  // src/components/ui/progress-bar/styles.ts
14222
- var Container3 = dt(Flex)`
14231
+ var Container3 = dt.div`
14223
14232
  position: relative;
14233
+ display: flex;
14234
+ align-items: center;
14235
+ gap: 1rem;
14224
14236
  `;
14225
14237
 
14226
14238
  // src/components/ui/progress-bar/ProgressBar.tsx
@@ -14250,59 +14262,51 @@ var ProgressBar = ({
14250
14262
  orange: "#DB6769",
14251
14263
  red: "#EF4444"
14252
14264
  };
14253
- return /* @__PURE__ */ jsxs4(
14254
- Container3,
14255
- {
14256
- $alignItems: "center",
14257
- $gap: `${16 / TEXT_BASE_SIZE}rem`,
14258
- ...props,
14259
- children: [
14260
- /* @__PURE__ */ jsx7(
14265
+ return /* @__PURE__ */ jsxs4(Container3, { ...props, children: [
14266
+ /* @__PURE__ */ jsx7(
14267
+ Flex,
14268
+ {
14269
+ $position: "relative",
14270
+ $alignItems: "center",
14271
+ $width: `${barWidth}`,
14272
+ $maxWidth: "100%",
14273
+ children: /* @__PURE__ */ jsx7(
14261
14274
  Flex,
14262
14275
  {
14263
14276
  $position: "relative",
14264
- $alignItems: "center",
14265
- $width: `${barWidth}`,
14266
- $maxWidth: "100%",
14277
+ $overflow: "hidden",
14278
+ $width: "100%",
14279
+ $height: `${8 / TEXT_BASE_SIZE}rem`,
14280
+ $backgroundColor: bgColor,
14281
+ $borderRadius: "9999px",
14267
14282
  children: /* @__PURE__ */ jsx7(
14268
- Flex,
14283
+ Box,
14269
14284
  {
14270
- $position: "relative",
14271
- $overflow: "hidden",
14272
- $width: "100%",
14273
- $height: `${8 / TEXT_BASE_SIZE}rem`,
14274
- $backgroundColor: bgColor,
14275
- $borderRadius: "9999px",
14276
- children: /* @__PURE__ */ jsx7(
14277
- Box,
14278
- {
14279
- $width: `${Math.min(progress, 100)}%`,
14280
- $height: "100%",
14281
- $backgroundColor: barColorMap[color],
14282
- $borderRadius: "9999px"
14283
- }
14284
- )
14285
+ $width: `${Math.min(progress, 100)}%`,
14286
+ $height: "100%",
14287
+ $backgroundColor: barColorMap[color],
14288
+ $borderRadius: "9999px"
14285
14289
  }
14286
14290
  )
14287
14291
  }
14288
- ),
14289
- total !== 0 && /* @__PURE__ */ jsxs4(
14290
- Text,
14291
- {
14292
- $font: theme.typography.text.fontFamily,
14293
- $size: 14,
14294
- $weight: 500,
14295
- $color: theme.typography.text.color,
14296
- children: [
14297
- value,
14298
- "/",
14299
- total
14300
- ]
14301
- }
14302
14292
  )
14303
- ]
14304
- }
14305
- );
14293
+ }
14294
+ ),
14295
+ total !== 0 && /* @__PURE__ */ jsxs4(
14296
+ Text,
14297
+ {
14298
+ $font: theme.typography.text.fontFamily,
14299
+ $size: 14,
14300
+ $weight: 500,
14301
+ $color: theme.typography.text.color,
14302
+ children: [
14303
+ value,
14304
+ "/",
14305
+ total
14306
+ ]
14307
+ }
14308
+ )
14309
+ ] });
14306
14310
  };
14307
14311
 
14308
14312
  // src/components/ui/text/styles.ts
@@ -14315,8 +14319,7 @@ var TextPropNames = /* @__PURE__ */ ((TextPropNames2) => {
14315
14319
  TextPropNames2["Leading"] = "$leading";
14316
14320
  return TextPropNames2;
14317
14321
  })(TextPropNames || {});
14318
- var Text = dt(Box).attrs(({ as = "span", onClick }) => ({
14319
- as,
14322
+ var Text = dt.span.attrs(({ onClick }) => ({
14320
14323
  ...onClick && { tabIndex: 0 }
14321
14324
  }))`
14322
14325
  ${({ $font }) => $font && lt`
@@ -14352,7 +14355,7 @@ import { useCallback as useCallback6, useLayoutEffect as useLayoutEffect3, useRe
14352
14355
  import { createPortal } from "react-dom";
14353
14356
 
14354
14357
  // src/components/ui/tooltip/styles.ts
14355
- var Trigger = dt(Box)``;
14358
+ var Trigger = dt.div``;
14356
14359
  var coords = (position2) => {
14357
14360
  let x2 = 0;
14358
14361
  let y2 = 0;
@@ -14419,7 +14422,7 @@ var grow = (translate) => {
14419
14422
  }
14420
14423
  `;
14421
14424
  };
14422
- var Content = dt(Box).withConfig({
14425
+ var Content = dt.div.withConfig({
14423
14426
  shouldForwardProp: (prop) => !["x", "y", "position", "zIndex"].includes(prop)
14424
14427
  })(({ x: x2, y: y2, position: position2, zIndex }) => {
14425
14428
  const translate = coords(position2);
@@ -14536,6 +14539,7 @@ var Tooltip = ({
14536
14539
  // src/components/layout/card/styles.ts
14537
14540
  var Element = dt(Box)``;
14538
14541
  var FussyChild = dt(Element)``;
14542
+ var Notice = dt(Box)``;
14539
14543
  var cardBoxShadow = "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A";
14540
14544
  var StyledCard = dt.div(({ theme }) => {
14541
14545
  const { l: l2 } = hexToHSL(theme.card.background);
@@ -14563,6 +14567,11 @@ var StyledCard = dt.div(({ theme }) => {
14563
14567
  `}
14564
14568
  }
14565
14569
  }
14570
+
14571
+ ${Notice}:first-child {
14572
+ border-top-left-radius: ${borderRadius};
14573
+ border-top-right-radius: ${borderRadius};
14574
+ }
14566
14575
  `;
14567
14576
  });
14568
14577
 
@@ -14617,11 +14626,12 @@ Column.displayName = "Column";
14617
14626
  import { forwardRef as forwardRef5 } from "react";
14618
14627
 
14619
14628
  // src/components/layout/root/styles.ts
14620
- var Container2 = dt(Box)`
14629
+ var Container2 = dt.div`
14621
14630
  all: initial;
14622
14631
  box-sizing: border-box;
14623
14632
  display: block;
14624
14633
  font-size: ${TEXT_BASE_SIZE}px;
14634
+ line-height: 1.35;
14625
14635
  width: 100%;
14626
14636
  height: 100%;
14627
14637
 
@@ -14902,49 +14912,65 @@ var Sidebar = ({
14902
14912
  const isLightBackground = useIsLightBackground();
14903
14913
  const currentPlan = data.company?.plan;
14904
14914
  const currentAddOns = data.company?.addOns || [];
14905
- const currentUsageBasedEntitlements = data.activeUsageBasedEntitlements.reduce(
14906
- (acc, usageData) => {
14907
- const featureUsage = data.featureUsage?.features.find(
14908
- (usage2) => usage2.feature?.id === usageData.featureId
14909
- );
14910
- const allocation = featureUsage?.allocation || 0;
14911
- const usage = featureUsage?.usage || 0;
14912
- acc.push({
14913
- usageData,
14914
- allocation,
14915
- quantity: allocation ?? usage,
14916
- usage
14917
- });
14918
- return acc;
14919
- },
14920
- []
14921
- );
14922
- const payInAdvanceEntitlements = usageBasedEntitlements.filter(
14923
- ({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
14924
- );
14925
- const payAsYouGoEntitlements = usageBasedEntitlements.filter(
14926
- ({ entitlement }) => entitlement.priceBehavior === "pay_as_you_go"
14927
- );
14915
+ const currentUsageBasedEntitlements = useMemo4(() => {
14916
+ return (data.featureUsage?.features || []).reduce(
14917
+ (acc, entitlement) => {
14918
+ if (entitlement.priceBehavior && (planPeriod === "month" && entitlement.monthlyUsageBasedPrice || planPeriod === "year" && entitlement.yearlyUsageBasedPrice)) {
14919
+ const allocation = entitlement.allocation || 0;
14920
+ const usage = entitlement.usage || 0;
14921
+ acc.push({
14922
+ ...entitlement,
14923
+ allocation,
14924
+ usage,
14925
+ quantity: allocation ?? usage
14926
+ });
14927
+ }
14928
+ return acc;
14929
+ },
14930
+ []
14931
+ );
14932
+ }, [data.featureUsage?.features, planPeriod]);
14933
+ const { payAsYouGoEntitlements, payInAdvanceEntitlements } = useMemo4(() => {
14934
+ const payAsYouGoEntitlements2 = [];
14935
+ const payInAdvanceEntitlements2 = usageBasedEntitlements.filter(
14936
+ (entitlement) => {
14937
+ if (entitlement.priceBehavior === "pay_as_you_go") {
14938
+ payAsYouGoEntitlements2.push(entitlement);
14939
+ }
14940
+ return entitlement.priceBehavior === "pay_in_advance";
14941
+ }
14942
+ );
14943
+ return { payAsYouGoEntitlements: payAsYouGoEntitlements2, payInAdvanceEntitlements: payInAdvanceEntitlements2 };
14944
+ }, [usageBasedEntitlements]);
14928
14945
  const subscriptionPrice = useMemo4(() => {
14929
- let total = 0;
14930
14946
  let planPrice;
14931
14947
  let currency;
14932
14948
  if (selectedPlan) {
14933
- planPrice = planPeriod === "month" ? selectedPlan.monthlyPrice?.price : selectedPlan.yearlyPrice?.price;
14934
- currency = planPeriod === "month" ? selectedPlan.monthlyPrice?.currency : selectedPlan.yearlyPrice?.currency;
14935
- if (planPrice) {
14936
- total += planPrice;
14937
- }
14949
+ const planBillingPrice = getBillingPrice(
14950
+ planPeriod === "year" ? selectedPlan.yearlyPrice : selectedPlan.monthlyPrice
14951
+ );
14952
+ planPrice = planBillingPrice?.price;
14953
+ currency = planBillingPrice?.currency;
14938
14954
  } else if (typeof currentPlan?.planPrice === "number") {
14939
14955
  planPrice = currentPlan.planPrice;
14940
14956
  }
14941
- const addOnCost = addOns.reduce(
14942
- (sum, addOn) => sum + (addOn.isSelected ? (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0 : 0),
14943
- 0
14944
- );
14957
+ let total = 0;
14958
+ if (planPrice) {
14959
+ total += planPrice;
14960
+ }
14961
+ const addOnCost = addOns.reduce((sum, addOn) => {
14962
+ if (addOn.isSelected) {
14963
+ sum += getBillingPrice(
14964
+ planPeriod === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
14965
+ )?.price ?? 0;
14966
+ }
14967
+ return sum;
14968
+ }, 0);
14945
14969
  total += addOnCost;
14946
14970
  const payInAdvanceCost = payInAdvanceEntitlements.reduce(
14947
- (sum, { entitlement, quantity }) => sum + quantity * ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price ?? 0),
14971
+ (sum, entitlement) => sum + entitlement.quantity * (getBillingPrice(
14972
+ planPeriod === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
14973
+ )?.price ?? 0),
14948
14974
  0
14949
14975
  );
14950
14976
  total += payInAdvanceCost;
@@ -14968,7 +14994,7 @@ var Sidebar = ({
14968
14994
  window.dispatchEvent(event);
14969
14995
  };
14970
14996
  const checkout = useCallback7(async () => {
14971
- const priceId = (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.id;
14997
+ const priceId = (planPeriod === "year" ? selectedPlan?.yearlyPrice : selectedPlan?.monthlyPrice)?.id;
14972
14998
  if (!api || !selectedPlan || !priceId) {
14973
14999
  return;
14974
15000
  }
@@ -14981,7 +15007,7 @@ var Sidebar = ({
14981
15007
  newPriceId: priceId,
14982
15008
  addOnIds: addOns.reduce((acc, addOn) => {
14983
15009
  if (addOn.isSelected && !selectedPlan.companyCanTrial) {
14984
- const addOnPriceId = (planPeriod === "month" ? addOn?.monthlyPrice : addOn?.yearlyPrice)?.id;
15010
+ const addOnPriceId = (planPeriod === "year" ? addOn?.yearlyPrice : addOn?.monthlyPrice)?.id;
14985
15011
  if (addOnPriceId) {
14986
15012
  acc.push({
14987
15013
  addOnId: addOn.id,
@@ -14992,8 +15018,8 @@ var Sidebar = ({
14992
15018
  return acc;
14993
15019
  }, []),
14994
15020
  payInAdvance: payInAdvanceEntitlements.reduce(
14995
- (acc, { entitlement, quantity }) => {
14996
- const priceId2 = (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.priceId;
15021
+ (acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
15022
+ const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
14997
15023
  if (priceId2) {
14998
15024
  acc.push({
14999
15025
  priceId: priceId2,
@@ -15061,48 +15087,62 @@ var Sidebar = ({
15061
15087
  ({ quantity, usage }) => quantity >= usage
15062
15088
  )) && !isLoading;
15063
15089
  const canCheckout = canUpdateSubscription && (!!data.subscription?.paymentMethod || typeof paymentMethodId === "string");
15064
- const changedUsageBasedEntitlements = [];
15065
- const addedUsageBasedEntitlements = usageBasedEntitlements.reduce(
15066
- (acc, selected) => {
15067
- const changed = currentUsageBasedEntitlements.find(
15068
- (current) => current.usageData.featureId === selected.entitlement.featureId && current.quantity !== selected.quantity
15069
- );
15070
- if (changed) {
15071
- changedUsageBasedEntitlements.push({
15072
- entitlement: selected.entitlement,
15073
- previous: changed,
15074
- next: {
15075
- allocation: selected.allocation,
15076
- quantity: selected.quantity,
15077
- usage: selected.usage
15078
- }
15079
- });
15080
- } else {
15081
- acc.push(selected);
15082
- }
15083
- return acc;
15084
- },
15085
- []
15086
- );
15087
- const removedUsageBasedEntitlements = currentUsageBasedEntitlements.reduce(
15088
- (acc, current) => {
15089
- const match2 = usageBasedEntitlements.every(
15090
- ({ entitlement }) => entitlement.featureId !== current.usageData.featureId
15091
- ) && data.featureUsage?.features.find(
15092
- (usage) => usage.feature?.id === current.usageData.featureId
15093
- );
15094
- if (match2) {
15095
- acc.push({
15096
- usage: match2,
15097
- allocation: current.allocation,
15098
- quantity: current.quantity
15099
- });
15100
- }
15101
- return acc;
15102
- },
15103
- []
15104
- );
15105
- const willUsageBasedEntitlementsChange = changedUsageBasedEntitlements.length > 0 || addedUsageBasedEntitlements.length > 0 || removedUsageBasedEntitlements.length > 0;
15090
+ const {
15091
+ changedUsageBasedEntitlements,
15092
+ addedUsageBasedEntitlements,
15093
+ removedUsageBasedEntitlements,
15094
+ willUsageBasedEntitlementsChange
15095
+ } = useMemo4(() => {
15096
+ const changedUsageBasedEntitlements2 = [];
15097
+ const addedUsageBasedEntitlements2 = selectedPlan ? usageBasedEntitlements.reduce(
15098
+ (acc, selected) => {
15099
+ const changed = currentUsageBasedEntitlements.find(
15100
+ (current) => current.entitlementId === selected.id && current.quantity !== selected.quantity
15101
+ );
15102
+ if (changed) {
15103
+ changedUsageBasedEntitlements2.push({
15104
+ previous: changed,
15105
+ next: selected
15106
+ });
15107
+ } else {
15108
+ acc.push(selected);
15109
+ }
15110
+ return acc;
15111
+ },
15112
+ []
15113
+ ) : [];
15114
+ const removedUsageBasedEntitlements2 = selectedPlan ? currentUsageBasedEntitlements.reduce(
15115
+ (acc, current) => {
15116
+ const match2 = usageBasedEntitlements.every(
15117
+ (entitlement) => entitlement.id !== current.entitlementId
15118
+ ) && data.featureUsage?.features.find(
15119
+ (usage) => usage.entitlementId === current.entitlementId
15120
+ );
15121
+ if (match2) {
15122
+ acc.push({
15123
+ ...match2,
15124
+ allocation: current.allocation,
15125
+ usage: current.usage,
15126
+ quantity: current.quantity
15127
+ });
15128
+ }
15129
+ return acc;
15130
+ },
15131
+ []
15132
+ ) : [];
15133
+ const willUsageBasedEntitlementsChange2 = changedUsageBasedEntitlements2.length > 0 || addedUsageBasedEntitlements2.length > 0 || removedUsageBasedEntitlements2.length > 0;
15134
+ return {
15135
+ changedUsageBasedEntitlements: changedUsageBasedEntitlements2,
15136
+ addedUsageBasedEntitlements: addedUsageBasedEntitlements2,
15137
+ removedUsageBasedEntitlements: removedUsageBasedEntitlements2,
15138
+ willUsageBasedEntitlementsChange: willUsageBasedEntitlementsChange2
15139
+ };
15140
+ }, [
15141
+ selectedPlan,
15142
+ data.featureUsage?.features,
15143
+ currentUsageBasedEntitlements,
15144
+ usageBasedEntitlements
15145
+ ]);
15106
15146
  const removedAddOns = currentAddOns.filter(
15107
15147
  (current) => !selectedAddOns.some((selected) => current.id === selected.id)
15108
15148
  );
@@ -15116,6 +15156,9 @@ var Sidebar = ({
15116
15156
  if (isTrialable && selectedPlan.trialDays) {
15117
15157
  trialEndsOn.setDate(trialEndsOn.getDate() + selectedPlan.trialDays);
15118
15158
  }
15159
+ const selectedPlanBillingPrice = getBillingPrice(
15160
+ planPeriod === "year" ? selectedPlan?.yearlyPrice : selectedPlan?.monthlyPrice
15161
+ );
15119
15162
  return /* @__PURE__ */ jsxs8(
15120
15163
  Flex,
15121
15164
  {
@@ -15276,8 +15319,8 @@ var Sidebar = ({
15276
15319
  $color: theme.typography.text.color,
15277
15320
  children: [
15278
15321
  formatCurrency(
15279
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
15280
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
15322
+ selectedPlanBillingPrice?.price ?? 0,
15323
+ selectedPlanBillingPrice?.currency
15281
15324
  ),
15282
15325
  /* @__PURE__ */ jsxs8("sub", { children: [
15283
15326
  "/",
@@ -15303,9 +15346,14 @@ var Sidebar = ({
15303
15346
  }
15304
15347
  ) }),
15305
15348
  removedUsageBasedEntitlements.reduce(
15306
- (acc, { allocation, quantity, usage }, index) => {
15307
- if (typeof allocation === "number" && usage.feature?.name) {
15308
- const price = (planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice)?.price;
15349
+ (acc, entitlement, index) => {
15350
+ if (typeof entitlement.allocation === "number" && entitlement.feature?.name) {
15351
+ const {
15352
+ price: entitlementPrice,
15353
+ currency: entitlementCurrency
15354
+ } = getBillingPrice(
15355
+ planPeriod === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice
15356
+ ) || {};
15309
15357
  acc.push(
15310
15358
  /* @__PURE__ */ jsxs8(
15311
15359
  Flex,
@@ -15324,11 +15372,14 @@ var Sidebar = ({
15324
15372
  $size: theme.typography.heading4.fontSize,
15325
15373
  $weight: theme.typography.heading4.fontWeight,
15326
15374
  $color: theme.typography.heading4.color,
15327
- children: usage.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
15328
- quantity,
15375
+ children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
15376
+ entitlement.quantity,
15329
15377
  " ",
15330
- getFeatureName(usage.feature, quantity)
15331
- ] }) : usage.feature.name
15378
+ getFeatureName(
15379
+ entitlement.feature,
15380
+ entitlement.quantity
15381
+ )
15382
+ ] }) : entitlement.feature.name
15332
15383
  }
15333
15384
  ) }),
15334
15385
  /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
@@ -15339,24 +15390,24 @@ var Sidebar = ({
15339
15390
  $weight: theme.typography.text.fontWeight,
15340
15391
  $color: theme.typography.text.color,
15341
15392
  children: [
15342
- usage.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15393
+ entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15343
15394
  formatCurrency(
15344
- price * quantity,
15345
- (planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice)?.currency
15395
+ (entitlementPrice ?? 0) * entitlement.quantity,
15396
+ entitlementCurrency
15346
15397
  ),
15347
15398
  /* @__PURE__ */ jsxs8("sub", { children: [
15348
15399
  "/",
15349
15400
  shortenPeriod(planPeriod)
15350
15401
  ] })
15351
15402
  ] }),
15352
- usage.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15403
+ entitlement.priceBehavior === "pay_as_you_go" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15353
15404
  formatCurrency(
15354
- price,
15355
- (planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice)?.currency
15405
+ entitlementPrice ?? 0,
15406
+ entitlementCurrency
15356
15407
  ),
15357
15408
  /* @__PURE__ */ jsxs8("sub", { children: [
15358
15409
  "/",
15359
- getFeatureName(usage.feature, 1)
15410
+ getFeatureName(entitlement.feature, 1)
15360
15411
  ] })
15361
15412
  ] })
15362
15413
  ]
@@ -15373,8 +15424,14 @@ var Sidebar = ({
15373
15424
  []
15374
15425
  ),
15375
15426
  changedUsageBasedEntitlements.reduce(
15376
- (acc, { entitlement, previous, next: next2 }, index) => {
15377
- if (entitlement?.feature?.name) {
15427
+ (acc, { previous, next: next2 }, index) => {
15428
+ if (next2.feature?.name) {
15429
+ const {
15430
+ price: entitlementPrice,
15431
+ currency: entitlementCurrency
15432
+ } = getBillingPrice(
15433
+ planPeriod === "year" ? next2.meteredYearlyPrice : next2.meteredMonthlyPrice
15434
+ ) || {};
15378
15435
  acc.push(
15379
15436
  /* @__PURE__ */ jsxs8(Box, { children: [
15380
15437
  /* @__PURE__ */ jsxs8(
@@ -15397,7 +15454,7 @@ var Sidebar = ({
15397
15454
  children: [
15398
15455
  previous.quantity,
15399
15456
  " ",
15400
- getFeatureName(entitlement.feature)
15457
+ getFeatureName(next2.feature)
15401
15458
  ]
15402
15459
  }
15403
15460
  ) }),
@@ -15410,8 +15467,8 @@ var Sidebar = ({
15410
15467
  $color: theme.typography.text.color,
15411
15468
  children: [
15412
15469
  formatCurrency(
15413
- ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * previous.quantity,
15414
- (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15470
+ (entitlementPrice ?? 0) * previous.quantity,
15471
+ entitlementCurrency
15415
15472
  ),
15416
15473
  /* @__PURE__ */ jsxs8("sub", { children: [
15417
15474
  "/",
@@ -15440,7 +15497,7 @@ var Sidebar = ({
15440
15497
  children: [
15441
15498
  next2.quantity,
15442
15499
  " ",
15443
- getFeatureName(entitlement.feature)
15500
+ getFeatureName(next2.feature)
15444
15501
  ]
15445
15502
  }
15446
15503
  ) }),
@@ -15453,8 +15510,8 @@ var Sidebar = ({
15453
15510
  $color: theme.typography.text.color,
15454
15511
  children: [
15455
15512
  formatCurrency(
15456
- ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * next2.quantity,
15457
- (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15513
+ (entitlementPrice ?? 0) * next2.quantity,
15514
+ entitlementCurrency
15458
15515
  ),
15459
15516
  /* @__PURE__ */ jsxs8("sub", { children: [
15460
15517
  "/",
@@ -15474,9 +15531,14 @@ var Sidebar = ({
15474
15531
  []
15475
15532
  ),
15476
15533
  addedUsageBasedEntitlements.reduce(
15477
- (acc, { entitlement, quantity }, index) => {
15534
+ (acc, entitlement, index) => {
15478
15535
  if (entitlement.feature?.name) {
15479
- const price = (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price;
15536
+ const {
15537
+ price: entitlementPrice,
15538
+ currency: entitlementCurrency
15539
+ } = getBillingPrice(
15540
+ planPeriod === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
15541
+ ) || {};
15480
15542
  acc.push(
15481
15543
  /* @__PURE__ */ jsxs8(
15482
15544
  Flex,
@@ -15493,9 +15555,12 @@ var Sidebar = ({
15493
15555
  $weight: theme.typography.heading4.fontWeight,
15494
15556
  $color: theme.typography.heading4.color,
15495
15557
  children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
15496
- quantity,
15558
+ entitlement.quantity,
15497
15559
  " ",
15498
- getFeatureName(entitlement.feature, quantity)
15560
+ getFeatureName(
15561
+ entitlement.feature,
15562
+ entitlement.quantity
15563
+ )
15499
15564
  ] }) : entitlement.feature.name
15500
15565
  }
15501
15566
  ) }),
@@ -15507,20 +15572,20 @@ var Sidebar = ({
15507
15572
  $weight: theme.typography.text.fontWeight,
15508
15573
  $color: theme.typography.text.color,
15509
15574
  children: [
15510
- entitlement.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15575
+ entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15511
15576
  formatCurrency(
15512
- price * quantity,
15513
- (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15577
+ (entitlementPrice ?? 0) * entitlement.quantity,
15578
+ entitlementCurrency
15514
15579
  ),
15515
15580
  /* @__PURE__ */ jsxs8("sub", { children: [
15516
15581
  "/",
15517
15582
  shortenPeriod(planPeriod)
15518
15583
  ] })
15519
15584
  ] }),
15520
- entitlement.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15585
+ entitlement.priceBehavior === "pay_as_you_go" && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15521
15586
  formatCurrency(
15522
- price,
15523
- (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15587
+ entitlementPrice ?? 0,
15588
+ entitlementCurrency
15524
15589
  ),
15525
15590
  /* @__PURE__ */ jsxs8("sub", { children: [
15526
15591
  "/",
@@ -15579,8 +15644,8 @@ var Sidebar = ({
15579
15644
  children: [
15580
15645
  "-",
15581
15646
  formatCurrency(
15582
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
15583
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
15647
+ selectedPlanBillingPrice?.price ?? 0,
15648
+ selectedPlanBillingPrice?.currency
15584
15649
  ),
15585
15650
  "/",
15586
15651
  /* @__PURE__ */ jsx13("sub", { children: shortenPeriod(planPeriod) })
@@ -15602,89 +15667,93 @@ var Sidebar = ({
15602
15667
  children: t2("Add-ons")
15603
15668
  }
15604
15669
  ) }),
15605
- removedAddOns.map((addOn, index) => /* @__PURE__ */ jsxs8(
15606
- Flex,
15607
- {
15608
- $justifyContent: "space-between",
15609
- $alignItems: "center",
15610
- $gap: "1rem",
15611
- $opacity: "0.625",
15612
- $textDecoration: "line-through",
15613
- $color: theme.typography.heading4.color,
15614
- children: [
15615
- /* @__PURE__ */ jsx13(Box, { children: /* @__PURE__ */ jsx13(
15616
- Text,
15617
- {
15618
- $font: theme.typography.heading4.fontFamily,
15619
- $size: theme.typography.heading4.fontSize,
15620
- $weight: theme.typography.heading4.fontWeight,
15621
- $color: theme.typography.heading4.color,
15622
- children: addOn.name
15623
- }
15624
- ) }),
15625
- typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
15626
- Text,
15627
- {
15628
- $font: theme.typography.text.fontFamily,
15629
- $size: theme.typography.text.fontSize,
15630
- $weight: theme.typography.text.fontWeight,
15631
- $color: theme.typography.text.color,
15632
- children: [
15633
- formatCurrency(
15634
- addOn.planPrice,
15635
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15636
- ),
15637
- /* @__PURE__ */ jsxs8("sub", { children: [
15638
- "/",
15639
- shortenPeriod(addOn.planPeriod)
15640
- ] })
15641
- ]
15642
- }
15643
- ) })
15644
- ]
15645
- },
15646
- index
15647
- )),
15648
- selectedAddOns.map((addOn, index) => /* @__PURE__ */ jsxs8(
15649
- Flex,
15650
- {
15651
- $justifyContent: "space-between",
15652
- $alignItems: "center",
15653
- $gap: "1rem",
15654
- children: [
15655
- /* @__PURE__ */ jsx13(Box, { children: /* @__PURE__ */ jsx13(
15656
- Text,
15657
- {
15658
- $font: theme.typography.heading4.fontFamily,
15659
- $size: theme.typography.heading4.fontSize,
15660
- $weight: theme.typography.heading4.fontWeight,
15661
- $color: theme.typography.heading4.color,
15662
- children: addOn.name
15663
- }
15664
- ) }),
15665
- /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
15666
- Text,
15667
- {
15668
- $font: theme.typography.text.fontFamily,
15669
- $size: theme.typography.text.fontSize,
15670
- $weight: theme.typography.text.fontWeight,
15671
- $color: theme.typography.text.color,
15672
- children: [
15673
- formatCurrency(
15674
- (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0,
15675
- (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.currency
15676
- ),
15677
- /* @__PURE__ */ jsxs8("sub", { children: [
15678
- "/",
15679
- shortenPeriod(planPeriod)
15680
- ] })
15681
- ]
15682
- }
15683
- ) })
15684
- ]
15685
- },
15686
- index
15687
- ))
15670
+ removedAddOns.map((addOn, index) => {
15671
+ return /* @__PURE__ */ jsxs8(
15672
+ Flex,
15673
+ {
15674
+ $justifyContent: "space-between",
15675
+ $alignItems: "center",
15676
+ $gap: "1rem",
15677
+ $opacity: "0.625",
15678
+ $textDecoration: "line-through",
15679
+ $color: theme.typography.heading4.color,
15680
+ children: [
15681
+ /* @__PURE__ */ jsx13(Box, { children: /* @__PURE__ */ jsx13(
15682
+ Text,
15683
+ {
15684
+ $font: theme.typography.heading4.fontFamily,
15685
+ $size: theme.typography.heading4.fontSize,
15686
+ $weight: theme.typography.heading4.fontWeight,
15687
+ $color: theme.typography.heading4.color,
15688
+ children: addOn.name
15689
+ }
15690
+ ) }),
15691
+ typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
15692
+ Text,
15693
+ {
15694
+ $font: theme.typography.text.fontFamily,
15695
+ $size: theme.typography.text.fontSize,
15696
+ $weight: theme.typography.text.fontWeight,
15697
+ $color: theme.typography.text.color,
15698
+ children: [
15699
+ formatCurrency(
15700
+ addOn.planPrice,
15701
+ selectedPlanBillingPrice?.currency
15702
+ ),
15703
+ /* @__PURE__ */ jsxs8("sub", { children: [
15704
+ "/",
15705
+ shortenPeriod(addOn.planPeriod)
15706
+ ] })
15707
+ ]
15708
+ }
15709
+ ) })
15710
+ ]
15711
+ },
15712
+ index
15713
+ );
15714
+ }),
15715
+ selectedAddOns.map((addOn, index) => {
15716
+ const { price: addOnPrice, currency: addOnCurrency } = getBillingPrice(
15717
+ planPeriod === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
15718
+ ) || {};
15719
+ return /* @__PURE__ */ jsxs8(
15720
+ Flex,
15721
+ {
15722
+ $justifyContent: "space-between",
15723
+ $alignItems: "center",
15724
+ $gap: "1rem",
15725
+ children: [
15726
+ /* @__PURE__ */ jsx13(Box, { children: /* @__PURE__ */ jsx13(
15727
+ Text,
15728
+ {
15729
+ $font: theme.typography.heading4.fontFamily,
15730
+ $size: theme.typography.heading4.fontSize,
15731
+ $weight: theme.typography.heading4.fontWeight,
15732
+ $color: theme.typography.heading4.color,
15733
+ children: addOn.name
15734
+ }
15735
+ ) }),
15736
+ /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
15737
+ Text,
15738
+ {
15739
+ $font: theme.typography.text.fontFamily,
15740
+ $size: theme.typography.text.fontSize,
15741
+ $weight: theme.typography.text.fontWeight,
15742
+ $color: theme.typography.text.color,
15743
+ children: [
15744
+ formatCurrency(addOnPrice ?? 0, addOnCurrency),
15745
+ /* @__PURE__ */ jsxs8("sub", { children: [
15746
+ "/",
15747
+ shortenPeriod(planPeriod)
15748
+ ] })
15749
+ ]
15750
+ }
15751
+ ) })
15752
+ ]
15753
+ },
15754
+ index
15755
+ );
15756
+ })
15688
15757
  ] }),
15689
15758
  proration !== 0 && /* @__PURE__ */ jsxs8(Fragment3, { children: [
15690
15759
  /* @__PURE__ */ jsx13(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx13(
@@ -15723,7 +15792,7 @@ var Sidebar = ({
15723
15792
  $color: theme.typography.text.color,
15724
15793
  children: formatCurrency(
15725
15794
  proration,
15726
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15795
+ selectedPlanBillingPrice?.currency
15727
15796
  )
15728
15797
  }
15729
15798
  ) })
@@ -15830,7 +15899,7 @@ var Sidebar = ({
15830
15899
  $color: theme.typography.text.color,
15831
15900
  children: formatCurrency(
15832
15901
  newCharges / 100 * percentOff,
15833
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15902
+ selectedPlanBillingPrice?.currency
15834
15903
  )
15835
15904
  }
15836
15905
  ) })
@@ -15854,7 +15923,7 @@ var Sidebar = ({
15854
15923
  children: t2("X off", {
15855
15924
  amount: formatCurrency(
15856
15925
  Math.abs(amountOff),
15857
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15926
+ selectedPlanBillingPrice?.currency
15858
15927
  )
15859
15928
  })
15860
15929
  }
@@ -15870,7 +15939,7 @@ var Sidebar = ({
15870
15939
  "-",
15871
15940
  formatCurrency(
15872
15941
  Math.abs(amountOff),
15873
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15942
+ selectedPlanBillingPrice?.currency
15874
15943
  )
15875
15944
  ]
15876
15945
  }
@@ -15893,7 +15962,7 @@ var Sidebar = ({
15893
15962
  $weight: theme.typography.text.fontWeight,
15894
15963
  $color: theme.typography.text.color,
15895
15964
  children: [
15896
- planPeriod === "month" ? "Monthly" : "Yearly",
15965
+ planPeriod === "year" ? "Yearly" : "Monthly",
15897
15966
  " total:"
15898
15967
  ]
15899
15968
  }
@@ -15946,7 +16015,7 @@ var Sidebar = ({
15946
16015
  $color: theme.typography.text.color,
15947
16016
  children: formatCurrency(
15948
16017
  Math.max(0, dueNow),
15949
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
16018
+ selectedPlanBillingPrice?.currency
15950
16019
  )
15951
16020
  }
15952
16021
  ) })
@@ -15976,7 +16045,7 @@ var Sidebar = ({
15976
16045
  $color: theme.typography.text.color,
15977
16046
  children: formatCurrency(
15978
16047
  Math.abs(dueNow),
15979
- (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
16048
+ selectedPlanBillingPrice?.currency
15980
16049
  )
15981
16050
  }
15982
16051
  ) })
@@ -16043,6 +16112,9 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
16043
16112
  $gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
16044
16113
  $gap: "1rem",
16045
16114
  children: addOns.map((addOn, index) => {
16115
+ const { price, currency } = getBillingPrice(
16116
+ period === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
16117
+ ) || {};
16046
16118
  return /* @__PURE__ */ jsxs9(
16047
16119
  Flex,
16048
16120
  {
@@ -16086,10 +16158,7 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
16086
16158
  $size: theme.typography.heading2.fontSize,
16087
16159
  $weight: theme.typography.heading2.fontWeight,
16088
16160
  $color: theme.typography.heading2.color,
16089
- children: formatCurrency(
16090
- (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0,
16091
- (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.currency
16092
- )
16161
+ children: formatCurrency(price ?? 0, currency)
16093
16162
  }
16094
16163
  ),
16095
16164
  /* @__PURE__ */ jsxs9(
@@ -16360,7 +16429,7 @@ var Checkout = ({
16360
16429
  $alignItems: "center",
16361
16430
  $flexGrow: 1,
16362
16431
  $marginTop: "-3.5rem",
16363
- children: /* @__PURE__ */ jsx15(Loader, { $size: "3xl" })
16432
+ children: /* @__PURE__ */ jsx15(Loader, { $color: theme.primary, $size: "3xl" })
16364
16433
  }
16365
16434
  );
16366
16435
  }
@@ -16588,7 +16657,9 @@ var Plan = ({
16588
16657
  children: plans.map((plan, planIndex) => {
16589
16658
  const count = entitlementCounts[plan.id];
16590
16659
  const isExpanded = count.limit > VISIBLE_ENTITLEMENT_COUNT;
16591
- const { price: planPrice, currency: planCurrency } = (period === "month" ? plan.monthlyPrice : period === "year" && plan.yearlyPrice) || {};
16660
+ const { price: planPrice, currency: planCurrency } = getBillingPrice(
16661
+ period === "year" ? plan.yearlyPrice : plan.monthlyPrice
16662
+ ) || {};
16592
16663
  const hasUsageBasedEntitlements = plan.entitlements.some(
16593
16664
  (entitlement) => !!entitlement.priceBehavior
16594
16665
  );
@@ -16718,7 +16789,9 @@ var Plan = ({
16718
16789
  const {
16719
16790
  price: entitlementPrice,
16720
16791
  currency: entitlementCurrency
16721
- } = (period === "month" ? entitlement.meteredMonthlyPrice : period === "year" && entitlement.meteredYearlyPrice) || {};
16792
+ } = getBillingPrice(
16793
+ period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
16794
+ ) || {};
16722
16795
  if (entitlement.priceBehavior && typeof entitlementPrice !== "number") {
16723
16796
  return acc;
16724
16797
  }
@@ -16962,8 +17035,11 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
16962
17035
  const unitPriceFontSize = 0.875 * theme.typography.text.fontSize;
16963
17036
  const unitPriceColor = hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46);
16964
17037
  return /* @__PURE__ */ jsx18(Fragment8, { children: /* @__PURE__ */ jsx18(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce(
16965
- (acc, { entitlement, quantity, usage }, index) => {
17038
+ (acc, entitlement, index) => {
16966
17039
  if (entitlement.priceBehavior === "pay_in_advance" && entitlement.feature) {
17040
+ const { price, currency } = getBillingPrice(
17041
+ period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
17042
+ ) || {};
16967
17043
  acc.push(
16968
17044
  /* @__PURE__ */ jsxs13(
16969
17045
  Flex,
@@ -17018,8 +17094,8 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
17018
17094
  {
17019
17095
  $size: "lg",
17020
17096
  type: "number",
17021
- value: quantity,
17022
- min: usage,
17097
+ value: entitlement.quantity,
17098
+ min: entitlement.usage,
17023
17099
  autoFocus: true,
17024
17100
  onFocus: (event) => event.target.select(),
17025
17101
  onChange: (event) => {
@@ -17039,12 +17115,12 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
17039
17115
  $weight: theme.typography.text.fontWeight,
17040
17116
  $color: unitPriceColor,
17041
17117
  children: [
17042
- quantity < usage && /* @__PURE__ */ jsxs13("span", { style: { color: "#DB6669" }, children: [
17118
+ entitlement.quantity < entitlement.usage && /* @__PURE__ */ jsxs13("span", { style: { color: "#DB6669" }, children: [
17043
17119
  t2("Cannot downgrade entitlement"),
17044
17120
  " "
17045
17121
  ] }),
17046
17122
  t2("Currently using", {
17047
- quantity: usage,
17123
+ quantity: entitlement.usage,
17048
17124
  unit: getFeatureName(entitlement.feature)
17049
17125
  })
17050
17126
  ]
@@ -17068,8 +17144,8 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
17068
17144
  $color: theme.typography.text.color,
17069
17145
  children: [
17070
17146
  formatCurrency(
17071
- ((period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * quantity,
17072
- (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
17147
+ (price ?? 0) * entitlement.quantity,
17148
+ currency
17073
17149
  ),
17074
17150
  /* @__PURE__ */ jsxs13("sub", { children: [
17075
17151
  "/",
@@ -17086,10 +17162,7 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
17086
17162
  $weight: theme.typography.text.fontWeight,
17087
17163
  $color: unitPriceColor,
17088
17164
  children: [
17089
- formatCurrency(
17090
- (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0,
17091
- (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
17092
- ),
17165
+ formatCurrency(price ?? 0, currency),
17093
17166
  /* @__PURE__ */ jsxs13("sub", { children: [
17094
17167
  "/",
17095
17168
  getFeatureName(entitlement.feature, 1),
@@ -17116,6 +17189,22 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
17116
17189
 
17117
17190
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
17118
17191
  import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
17192
+ var createActiveUsageBasedEntitlementsReducer = (entitlements, period) => (acc, entitlement) => {
17193
+ if (entitlement.priceBehavior && (period === "month" && entitlement.meteredMonthlyPrice || period === "year" && entitlement.meteredYearlyPrice)) {
17194
+ const featureUsage = entitlements.find(
17195
+ (usage2) => usage2.feature?.id === entitlement.feature?.id
17196
+ );
17197
+ const allocation = featureUsage?.allocation || 0;
17198
+ const usage = featureUsage?.usage || 0;
17199
+ acc.push({
17200
+ ...entitlement,
17201
+ allocation,
17202
+ usage,
17203
+ quantity: allocation
17204
+ });
17205
+ }
17206
+ return acc;
17207
+ };
17119
17208
  var CheckoutDialog = ({ top = 0 }) => {
17120
17209
  const { t: t2 } = useTranslation();
17121
17210
  const theme = nt();
@@ -17149,34 +17238,21 @@ var CheckoutDialog = ({ top = 0 }) => {
17149
17238
  )
17150
17239
  }))
17151
17240
  );
17152
- const createActiveUsageBasedEntitlementsReducer = useCallback8(
17153
- (period = planPeriod) => (acc, entitlement) => {
17154
- if (entitlement.priceBehavior && (period === "month" && entitlement.meteredMonthlyPrice || period === "year" && entitlement.meteredYearlyPrice)) {
17155
- const featureUsage = data.featureUsage?.features.find(
17156
- (usage2) => usage2.feature?.id === entitlement.feature?.id
17157
- );
17158
- const allocation = featureUsage?.allocation ?? 0;
17159
- const usage = featureUsage?.usage ?? 0;
17160
- acc.push({
17161
- entitlement,
17162
- allocation,
17163
- quantity: allocation,
17164
- usage
17165
- });
17166
- }
17167
- return acc;
17168
- },
17169
- [planPeriod, data.featureUsage?.features]
17170
- );
17241
+ const currentEntitlements = useMemo5(() => {
17242
+ return data.featureUsage?.features || [];
17243
+ }, [data.featureUsage?.features]);
17171
17244
  const [usageBasedEntitlements, setUsageBasedEntitlements] = useState7(
17172
17245
  () => (selectedPlan?.entitlements || []).reduce(
17173
- createActiveUsageBasedEntitlementsReducer(),
17246
+ createActiveUsageBasedEntitlementsReducer(
17247
+ currentEntitlements,
17248
+ planPeriod
17249
+ ),
17174
17250
  []
17175
17251
  )
17176
17252
  );
17177
17253
  const payInAdvanceEntitlements = useMemo5(
17178
17254
  () => usageBasedEntitlements.filter(
17179
- ({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
17255
+ (entitlement) => entitlement.priceBehavior === "pay_in_advance"
17180
17256
  ),
17181
17257
  [usageBasedEntitlements]
17182
17258
  );
@@ -17240,7 +17316,7 @@ var CheckoutDialog = ({ top = 0 }) => {
17240
17316
  async (updates) => {
17241
17317
  const period = updates.period || planPeriod;
17242
17318
  const plan = updates.plan || selectedPlan;
17243
- const planPriceId = period === "month" ? plan?.monthlyPrice?.id : plan?.yearlyPrice?.id;
17319
+ const planPriceId = period === "year" ? plan?.yearlyPrice?.id : plan?.monthlyPrice?.id;
17244
17320
  if (!api || !plan || !planPriceId) {
17245
17321
  return;
17246
17322
  }
@@ -17255,7 +17331,7 @@ var CheckoutDialog = ({ top = 0 }) => {
17255
17331
  addOnIds: (updates.addOns || addOns).reduce(
17256
17332
  (acc, addOn) => {
17257
17333
  if (addOn.isSelected) {
17258
- const addOnPriceId = (period === "month" ? addOn?.monthlyPrice : addOn?.yearlyPrice)?.id;
17334
+ const addOnPriceId = (period === "year" ? addOn?.yearlyPrice : addOn?.monthlyPrice)?.id;
17259
17335
  if (addOnPriceId) {
17260
17336
  acc.push({
17261
17337
  addOnId: addOn.id,
@@ -17268,8 +17344,8 @@ var CheckoutDialog = ({ top = 0 }) => {
17268
17344
  []
17269
17345
  ),
17270
17346
  payInAdvance: (updates.payInAdvanceEntitlements || payInAdvanceEntitlements).reduce(
17271
- (acc, { entitlement, quantity }) => {
17272
- const priceId = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.priceId;
17347
+ (acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
17348
+ const priceId = (period === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
17273
17349
  if (priceId) {
17274
17350
  acc.push({
17275
17351
  priceId,
@@ -17318,7 +17394,7 @@ var CheckoutDialog = ({ top = 0 }) => {
17318
17394
  }
17319
17395
  const period = updates.period || planPeriod;
17320
17396
  const entitlements = plan.entitlements.reduce(
17321
- createActiveUsageBasedEntitlementsReducer(period),
17397
+ createActiveUsageBasedEntitlementsReducer(currentEntitlements, period),
17322
17398
  []
17323
17399
  );
17324
17400
  if (updates.plan) {
@@ -17329,16 +17405,11 @@ var CheckoutDialog = ({ top = 0 }) => {
17329
17405
  period,
17330
17406
  plan: updates.plan,
17331
17407
  payInAdvanceEntitlements: entitlements.filter(
17332
- ({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
17408
+ ({ priceBehavior }) => priceBehavior === "pay_in_advance"
17333
17409
  )
17334
17410
  });
17335
17411
  },
17336
- [
17337
- planPeriod,
17338
- selectedPlan,
17339
- createActiveUsageBasedEntitlementsReducer,
17340
- previewCheckout
17341
- ]
17412
+ [planPeriod, selectedPlan, currentEntitlements, previewCheckout]
17342
17413
  );
17343
17414
  const changePlanPeriod = useCallback8(
17344
17415
  (period) => {
@@ -17361,16 +17432,14 @@ var CheckoutDialog = ({ top = 0 }) => {
17361
17432
  (id, updatedQuantity) => {
17362
17433
  setUsageBasedEntitlements((prev2) => {
17363
17434
  const updated = prev2.map(
17364
- ({ entitlement, allocation, quantity, usage }) => entitlement.id === id ? {
17365
- entitlement,
17366
- allocation,
17367
- quantity: updatedQuantity,
17368
- usage
17369
- } : { entitlement, allocation, quantity, usage }
17435
+ (entitlement) => entitlement.id === id ? {
17436
+ ...entitlement,
17437
+ quantity: updatedQuantity
17438
+ } : entitlement
17370
17439
  );
17371
17440
  previewCheckout({
17372
17441
  payInAdvanceEntitlements: updated.filter(
17373
- ({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
17442
+ ({ priceBehavior }) => priceBehavior === "pay_in_advance"
17374
17443
  )
17375
17444
  });
17376
17445
  return updated;
@@ -17499,7 +17568,7 @@ var CheckoutDialog = ({ top = 0 }) => {
17499
17568
  $size: theme.typography.heading3.fontSize,
17500
17569
  $weight: theme.typography.heading3.fontWeight,
17501
17570
  $color: theme.typography.heading3.color,
17502
- $marginBottom: "0.5rem",
17571
+ style: { marginBottom: "0.5rem" },
17503
17572
  children: activeCheckoutStage.label
17504
17573
  }
17505
17574
  ),
@@ -17724,8 +17793,10 @@ var PeriodToggle = ({
17724
17793
  const [tooltipZIndex, setTooltipZIndex] = useState9(1);
17725
17794
  const savingsPercentage = useMemo6(() => {
17726
17795
  if (selectedPlan) {
17727
- const monthly = (selectedPlan?.monthlyPrice?.price || 0) * 12;
17728
- const yearly = selectedPlan?.yearlyPrice?.price || 0;
17796
+ const monthlyBillingPrice = getBillingPrice(selectedPlan?.monthlyPrice);
17797
+ const yearlyBillingPrice = getBillingPrice(selectedPlan?.yearlyPrice);
17798
+ const monthly = (monthlyBillingPrice?.price ?? 0) * 12;
17799
+ const yearly = yearlyBillingPrice?.price ?? 0;
17729
17800
  return Math.round((monthly - yearly) / monthly * 1e4) / 100;
17730
17801
  }
17731
17802
  return 0;
@@ -17776,11 +17847,11 @@ var PeriodToggle = ({
17776
17847
  children: /* @__PURE__ */ jsx22(
17777
17848
  Text,
17778
17849
  {
17779
- $flexShrink: 0,
17780
17850
  $font: theme.typography.text.fontFamily,
17781
17851
  $size: 15,
17782
17852
  $weight: option === selectedOption ? 600 : 400,
17783
17853
  $color: theme.typography.text.color,
17854
+ style: { flexShrink: 0 },
17784
17855
  children: t2("Billed", { period: adjectify(option) })
17785
17856
  }
17786
17857
  )
@@ -17840,23 +17911,9 @@ var UnsubscribeDialog = ({ top = 0 }) => {
17840
17911
  ),
17841
17912
  [data.company?.plan, planPeriod, availablePlans]
17842
17913
  );
17914
+ const currentEntitlements = data.featureUsage?.features || [];
17843
17915
  const usageBasedEntitlements = (selectedPlan?.entitlements || []).reduce(
17844
- (acc, entitlement) => {
17845
- if (entitlement.priceBehavior && (planPeriod === "month" && entitlement.meteredMonthlyPrice || planPeriod === "year" && entitlement.meteredYearlyPrice)) {
17846
- const featureUsage = data.featureUsage?.features.find(
17847
- (usage2) => usage2.feature?.id === entitlement.feature?.id
17848
- );
17849
- const allocation = featureUsage?.allocation ?? 0;
17850
- const usage = featureUsage?.usage ?? 0;
17851
- acc.push({
17852
- entitlement,
17853
- allocation,
17854
- quantity: allocation,
17855
- usage
17856
- });
17857
- }
17858
- return acc;
17859
- },
17916
+ createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
17860
17917
  []
17861
17918
  );
17862
17919
  const addOns = useMemo7(
@@ -18179,21 +18236,18 @@ var RenderLayout = ({ children }) => {
18179
18236
  };
18180
18237
 
18181
18238
  // src/components/layout/viewport/styles.ts
18182
- var StyledViewport = dt(Box).attrs(({ theme }) => ({
18183
- $gridTemplateColumns: "repeat(1, minmax(300px, 1fr))",
18184
- $viewport: {
18185
- md: {
18186
- $gridTemplateColumns: `repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`
18187
- }
18188
- }
18189
- })).withConfig({
18239
+ var StyledViewport = dt.div.withConfig({
18190
18240
  shouldForwardProp: (prop) => !["$numberOfColumns", "numberOfColumns"].includes(prop)
18191
18241
  })`
18192
18242
  display: grid;
18193
-
18243
+ grid-template-columns: repeat(1, minmax(300px, 1fr));
18194
18244
  margin-left: auto;
18195
18245
  margin-right: auto;
18196
18246
  gap: 1rem;
18247
+
18248
+ @media (min-width: 768px) {
18249
+ grid-template-columns: ${({ theme }) => lt`repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`};
18250
+ }
18197
18251
  `;
18198
18252
 
18199
18253
  // src/components/layout/viewport/Viewport.tsx
@@ -18254,25 +18308,11 @@ var Details = ({
18254
18308
  const { t: t2 } = useTranslation();
18255
18309
  const theme = nt();
18256
18310
  const { data } = useEmbed();
18257
- const currency = useMemo8(() => {
18258
- if (data.company?.plan?.planPeriod === "month") {
18259
- return monthlyUsageBasedPrice?.currency;
18260
- }
18261
- if (data.company?.plan?.planPeriod === "year") {
18262
- return yearlyUsageBasedPrice?.currency;
18263
- }
18264
- }, [
18265
- data.company?.plan?.planPeriod,
18266
- monthlyUsageBasedPrice,
18267
- yearlyUsageBasedPrice
18268
- ]);
18269
- const price = useMemo8(() => {
18270
- if (data.company?.plan?.planPeriod === "month") {
18271
- return monthlyUsageBasedPrice?.price;
18272
- }
18273
- if (data.company?.plan?.planPeriod === "year") {
18274
- return yearlyUsageBasedPrice?.price;
18275
- }
18311
+ const { price, currency } = useMemo8(() => {
18312
+ const { price: entitlementPrice, currency: entitlementCurrency } = getBillingPrice(
18313
+ data.company?.plan?.planPeriod === "year" ? yearlyUsageBasedPrice : monthlyUsageBasedPrice
18314
+ ) || {};
18315
+ return { price: entitlementPrice, currency: entitlementCurrency };
18276
18316
  }, [
18277
18317
  data.company?.plan?.planPeriod,
18278
18318
  monthlyUsageBasedPrice,
@@ -18706,7 +18746,8 @@ Invoices.displayName = "Invoices";
18706
18746
  import { forwardRef as forwardRef9, useMemo as useMemo10, useRef as useRef8 } from "react";
18707
18747
 
18708
18748
  // src/components/elements/metered-features/styles.ts
18709
- var Container4 = dt(Flex)`
18749
+ var Container4 = dt.div`
18750
+ display: flex;
18710
18751
  flex-direction: column;
18711
18752
  gap: 1rem;
18712
18753
 
@@ -18814,7 +18855,9 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18814
18855
  }, index) => {
18815
18856
  const limit = softLimit ?? allocation ?? 0;
18816
18857
  const isOverage = priceBehavior === "overage" && typeof softLimit === "number" && typeof usage === "number" && usage > softLimit;
18817
- const { price, currency } = (planPeriod === "month" ? monthlyUsageBasedPrice : planPeriod === "year" && yearlyUsageBasedPrice) || {};
18858
+ const { price, currency } = getBillingPrice(
18859
+ planPeriod === "year" ? yearlyUsageBasedPrice : monthlyUsageBasedPrice
18860
+ ) || {};
18818
18861
  const progressBar = props.isVisible && typeof usage === "number" && limit > 0 && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ jsx30(
18819
18862
  ProgressBar,
18820
18863
  {
@@ -19513,7 +19556,7 @@ var PaymentMethodDetails = ({
19513
19556
  $zIndex: 1,
19514
19557
  $backgroundColor: "black",
19515
19558
  $opacity: 0.5,
19516
- children: /* @__PURE__ */ jsx33(Loader, { $size: "2xl" })
19559
+ children: /* @__PURE__ */ jsx33(Loader, { $color: theme.primary, $size: "2xl" })
19517
19560
  }
19518
19561
  ),
19519
19562
  /* @__PURE__ */ jsxs26(
@@ -19677,8 +19720,10 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19677
19720
  };
19678
19721
  const usageBasedEntitlements = (featureUsage?.features || []).reduce(
19679
19722
  (acc, usage) => {
19680
- const { price, currency } = (currentPlan?.planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice) || {};
19681
- if (usage.priceBehavior && typeof price === "number") {
19723
+ const { price, currency } = getBillingPrice(
19724
+ currentPlan?.planPeriod === "year" ? usage.yearlyUsageBasedPrice : usage.monthlyUsageBasedPrice
19725
+ ) || {};
19726
+ if (usage.priceBehavior) {
19682
19727
  acc.push({ ...usage, price, currency });
19683
19728
  }
19684
19729
  return acc;
@@ -19701,11 +19746,14 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19701
19746
  const headerPriceFontStyle = isUsageBasedPlan ? theme.typography.heading3 : theme.typography[props.header.price.fontStyle];
19702
19747
  return /* @__PURE__ */ jsxs27(Fragment11, { children: [
19703
19748
  isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs27(
19704
- Box,
19749
+ Notice,
19705
19750
  {
19706
- $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.04)" : "hsla(0, 0%, 100%, 0.04)",
19751
+ as: Flex,
19752
+ $flexDirection: "column",
19753
+ $gap: "0.5rem",
19754
+ $padding: "1.5rem",
19707
19755
  $textAlign: "center",
19708
- $padding: "1rem",
19756
+ $backgroundColor: isLightBackground ? darken(theme.card.background, 0.04) : lighten(theme.card.background, 0.04),
19709
19757
  children: [
19710
19758
  /* @__PURE__ */ jsx34(
19711
19759
  Text,
@@ -19736,11 +19784,14 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19736
19784
  ]
19737
19785
  }
19738
19786
  ) : willSubscriptionCancel && /* @__PURE__ */ jsxs27(
19739
- Box,
19787
+ Notice,
19740
19788
  {
19741
- $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.04)" : "hsla(0, 0%, 100%, 0.04)",
19789
+ as: Flex,
19790
+ $flexDirection: "column",
19791
+ $gap: "0.5rem",
19792
+ $padding: "1.5rem",
19742
19793
  $textAlign: "center",
19743
- $padding: "1rem",
19794
+ $backgroundColor: isLightBackground ? darken(theme.card.background, 0.04) : lighten(theme.card.background, 0.04),
19744
19795
  children: [
19745
19796
  /* @__PURE__ */ jsx34(
19746
19797
  Text,
@@ -19753,7 +19804,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19753
19804
  children: t2("Subscription canceled")
19754
19805
  }
19755
19806
  ),
19756
- /* @__PURE__ */ jsx34(
19807
+ billingSubscription?.cancelAt && /* @__PURE__ */ jsx34(
19757
19808
  Text,
19758
19809
  {
19759
19810
  as: "p",
@@ -19761,14 +19812,14 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19761
19812
  $size: 0.8125 * theme.typography.text.fontSize,
19762
19813
  $weight: theme.typography.text.fontWeight,
19763
19814
  $color: theme.typography.text.color,
19764
- children: billingSubscription?.cancelAt ? t2("Access to plan will end on", {
19815
+ children: t2("Access to plan will end on", {
19765
19816
  date: toPrettyDate(
19766
19817
  new Date(billingSubscription.cancelAt * 1e3),
19767
19818
  {
19768
19819
  month: "numeric"
19769
19820
  }
19770
19821
  )
19771
- }) : ""
19822
+ })
19772
19823
  }
19773
19824
  )
19774
19825
  ]
@@ -19960,7 +20011,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19960
20011
  ":",
19961
20012
  " ",
19962
20013
  formatCurrency(
19963
- entitlement.price,
20014
+ entitlement.price ?? 0,
19964
20015
  entitlement.currency
19965
20016
  ),
19966
20017
  /* @__PURE__ */ jsxs27("sub", { children: [
@@ -19982,7 +20033,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
19982
20033
  $color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
19983
20034
  children: [
19984
20035
  formatCurrency(
19985
- entitlement.price,
20036
+ entitlement.price ?? 0,
19986
20037
  entitlement.currency
19987
20038
  ),
19988
20039
  /* @__PURE__ */ jsxs27("sub", { children: [
@@ -20003,7 +20054,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
20003
20054
  $color: theme.typography.text.color,
20004
20055
  children: [
20005
20056
  formatCurrency(
20006
- entitlement.price * amount,
20057
+ (entitlement.price ?? 0) * amount,
20007
20058
  entitlement.currency
20008
20059
  ),
20009
20060
  (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ jsxs27("sub", { children: [
@@ -20183,7 +20234,9 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
20183
20234
  $gap: "1rem",
20184
20235
  children: plans.map((plan, planIndex, self2) => {
20185
20236
  const isActivePlan = plan.current && data.company?.plan?.planPeriod === selectedPeriod;
20186
- const { price: planPrice, currency: planCurrency } = (selectedPeriod === "month" ? plan.monthlyPrice : selectedPeriod === "year" && plan.yearlyPrice) || {};
20237
+ const { price: planPrice, currency: planCurrency } = getBillingPrice(
20238
+ selectedPeriod === "year" ? plan.yearlyPrice : plan.monthlyPrice
20239
+ ) || {};
20187
20240
  const count = entitlementCounts[plan.id];
20188
20241
  const isExpanded = count.limit > VISIBLE_ENTITLEMENT_COUNT;
20189
20242
  const hasUsageBasedEntitlements = plan.entitlements.some(
@@ -20312,7 +20365,9 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
20312
20365
  const {
20313
20366
  price: entitlementPrice,
20314
20367
  currency: entitlementCurrency
20315
- } = (selectedPeriod === "month" ? entitlement.meteredMonthlyPrice : selectedPeriod === "year" && entitlement.meteredYearlyPrice) || {};
20368
+ } = getBillingPrice(
20369
+ selectedPeriod === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
20370
+ ) || {};
20316
20371
  if (entitlement.priceBehavior && typeof entitlementPrice !== "number") {
20317
20372
  return acc;
20318
20373
  }
@@ -20586,7 +20641,9 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
20586
20641
  $gap: "1rem",
20587
20642
  children: addOns.map((addOn, addOnIndex) => {
20588
20643
  const isActiveAddOn = addOn.current && selectedPeriod === data.company?.addOns.find((a2) => a2.id === addOn.id)?.planPeriod;
20589
- const { price: addOnPrice, currency: addOnCurrency } = (selectedPeriod === "month" ? addOn.monthlyPrice : selectedPeriod === "year" && addOn.yearlyPrice) || {};
20644
+ const { price: addOnPrice, currency: addOnCurrency } = getBillingPrice(
20645
+ selectedPeriod === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
20646
+ ) || {};
20590
20647
  return /* @__PURE__ */ jsxs28(
20591
20648
  Flex,
20592
20649
  {
@@ -21062,7 +21119,7 @@ var Loading = () => {
21062
21119
  $alignItems: "center",
21063
21120
  $justifyContent: "center",
21064
21121
  $padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
21065
- children: /* @__PURE__ */ jsx38(Loader, { $size: "2xl", $color: "#194BFB" })
21122
+ children: /* @__PURE__ */ jsx38(Loader, { $color: "#194BFB", $size: "2xl" })
21066
21123
  }
21067
21124
  );
21068
21125
  };
@@ -21168,6 +21225,7 @@ export {
21168
21225
  MeteredFeatures,
21169
21226
  Modal,
21170
21227
  ModalHeader,
21228
+ Notice,
21171
21229
  PaymentMethod,
21172
21230
  PaymentMethodDetails,
21173
21231
  PlanManager,