@schematichq/schematic-components 2.11.0 → 2.12.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.
@@ -5006,6 +5006,7 @@ var en_default = {
5006
5006
  Loading: "Loading",
5007
5007
  "Manage plan": "Manage plan",
5008
5008
  "Monthly total": "Monthly total",
5009
+ "Quarterly total": "Quarterly total",
5009
5010
  Next: "Next",
5010
5011
  "No invoices created yet": "No invoices created yet",
5011
5012
  "No limit": "No limit",
@@ -5038,6 +5039,8 @@ var en_default = {
5038
5039
  "Save payment method": "Save payment method",
5039
5040
  "Save with yearly billing": "Save up to {{percent}}% with yearly billing",
5040
5041
  "Saving with yearly billing": "You are saving {{percent}}% with yearly billing",
5042
+ "Save with quarterly billing": "Save up to {{percent}}% with quarterly billing",
5043
+ "Saving with quarterly billing": "You are saving {{percent}}% with quarterly billing",
5041
5044
  "See all": "See all",
5042
5045
  "See balance details": "See balance details",
5043
5046
  "See less": "See less",
@@ -5111,6 +5114,7 @@ var en_default = {
5111
5114
  "$X/Y units/period": "{{cost}}/{{size}} {{units}}/{{period}}",
5112
5115
  day: "day",
5113
5116
  month: "month",
5117
+ quarter: "quarter",
5114
5118
  year: "year",
5115
5119
  "one time": "one time",
5116
5120
  "billing period": "billing period",
@@ -5119,6 +5123,7 @@ var en_default = {
5119
5123
  use: "use",
5120
5124
  used: "used",
5121
5125
  "month, billed yearly": "month, billed yearly",
5126
+ "month, billed quarterly": "month, billed quarterly",
5122
5127
  purchased: "purchased {{date}}",
5123
5128
  usage: {
5124
5129
  limited: "{{amount}} of {{allocation}} used",
@@ -7849,6 +7854,7 @@ function BillingProductPriceResponseDataFromJSONTyped(json, ignoreDiscriminator)
7849
7854
  currency: json["currency"],
7850
7855
  id: json["id"],
7851
7856
  interval: BillingProductPriceIntervalFromJSON(json["interval"]),
7857
+ intervalCount: json["interval_count"],
7852
7858
  isActive: json["is_active"],
7853
7859
  meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
7854
7860
  nickname: json["nickname"] == null ? void 0 : json["nickname"],
@@ -7894,6 +7900,7 @@ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
7894
7900
  currency: json["currency"],
7895
7901
  id: json["id"],
7896
7902
  interval: BillingProductPriceIntervalFromJSON(json["interval"]),
7903
+ intervalCount: json["interval_count"],
7897
7904
  isActive: json["is_active"],
7898
7905
  meterEventName: json["meter_event_name"] == null ? void 0 : json["meter_event_name"],
7899
7906
  meterEventPayloadKey: json["meter_event_payload_key"] == null ? void 0 : json["meter_event_payload_key"],
@@ -8017,6 +8024,7 @@ function BillingPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8017
8024
  externalPriceId: json["external_price_id"],
8018
8025
  id: json["id"],
8019
8026
  interval: BillingProductPriceIntervalFromJSON(json["interval"]),
8027
+ intervalCount: json["interval_count"],
8020
8028
  nickname: json["nickname"] == null ? void 0 : json["nickname"],
8021
8029
  price: json["price"],
8022
8030
  priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
@@ -8305,6 +8313,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
8305
8313
  externalId: json["external_id"],
8306
8314
  id: json["id"],
8307
8315
  interval: json["interval"],
8316
+ intervalCount: json["interval_count"] == null ? void 0 : json["interval_count"],
8308
8317
  meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
8309
8318
  name: json["name"],
8310
8319
  packageSize: json["package_size"],
@@ -9295,6 +9304,7 @@ function EntitlementCurrencyPricesResponseDataFromJSONTyped(json, ignoreDiscrimi
9295
9304
  return {
9296
9305
  currency: json["currency"],
9297
9306
  monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceViewFromJSON(json["monthly_price"]),
9307
+ quarterlyPrice: json["quarterly_price"] == null ? void 0 : BillingPriceViewFromJSON(json["quarterly_price"]),
9298
9308
  yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceViewFromJSON(json["yearly_price"])
9299
9309
  };
9300
9310
  }
@@ -9375,6 +9385,7 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
9375
9385
  featureId: json["feature_id"],
9376
9386
  id: json["id"],
9377
9387
  meteredMonthlyPrice: json["metered_monthly_price"] == null ? void 0 : BillingPriceViewFromJSON(json["metered_monthly_price"]),
9388
+ meteredQuarterlyPrice: json["metered_quarterly_price"] == null ? void 0 : BillingPriceViewFromJSON(json["metered_quarterly_price"]),
9378
9389
  meteredYearlyPrice: json["metered_yearly_price"] == null ? void 0 : BillingPriceViewFromJSON(json["metered_yearly_price"]),
9379
9390
  metricPeriod: json["metric_period"] == null ? void 0 : MetricPeriodFromJSON(json["metric_period"]),
9380
9391
  metricPeriodMonthReset: json["metric_period_month_reset"] == null ? void 0 : MetricPeriodMonthResetFromJSON(json["metric_period_month_reset"]),
@@ -9649,6 +9660,7 @@ function PlanCurrencyPricesResponseDataFromJSONTyped(json, ignoreDiscriminator)
9649
9660
  currency: json["currency"],
9650
9661
  monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["monthly_price"]),
9651
9662
  oneTimePrice: json["one_time_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["one_time_price"]),
9663
+ quarterlyPrice: json["quarterly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["quarterly_price"]),
9652
9664
  yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["yearly_price"])
9653
9665
  };
9654
9666
  }
@@ -9766,6 +9778,7 @@ function FeatureUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
9766
9778
  plan: json["plan"] == null ? void 0 : PlanResponseDataFromJSON(json["plan"]),
9767
9779
  planEntitlement: json["plan_entitlement"] == null ? void 0 : PlanEntitlementResponseDataFromJSON(json["plan_entitlement"]),
9768
9780
  priceBehavior: json["price_behavior"] == null ? void 0 : EntitlementPriceBehaviorFromJSON(json["price_behavior"]),
9781
+ quarterlyUsageBasedPrice: json["quarterly_usage_based_price"] == null ? void 0 : BillingPriceViewFromJSON(json["quarterly_usage_based_price"]),
9769
9782
  softLimit: json["soft_limit"] == null ? void 0 : json["soft_limit"],
9770
9783
  usage: json["usage"] == null ? void 0 : json["usage"],
9771
9784
  yearlyUsageBasedPrice: json["yearly_usage_based_price"] == null ? void 0 : BillingPriceViewFromJSON(json["yearly_usage_based_price"])
@@ -9824,6 +9837,7 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
9824
9837
  name: json["name"],
9825
9838
  oneTimePrice: json["one_time_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["one_time_price"]),
9826
9839
  planType: PlanTypeFromJSON(json["plan_type"]),
9840
+ quarterlyPrice: json["quarterly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["quarterly_price"]),
9827
9841
  trialDays: json["trial_days"] == null ? void 0 : json["trial_days"],
9828
9842
  updatedAt: new Date(json["updated_at"]),
9829
9843
  usageViolations: json["usage_violations"].map(
@@ -9980,6 +9994,7 @@ function PlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
9980
9994
  name: json["name"],
9981
9995
  oneTimePrice: json["one_time_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["one_time_price"]),
9982
9996
  planType: PlanTypeFromJSON(json["plan_type"]),
9997
+ quarterlyPrice: json["quarterly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["quarterly_price"]),
9983
9998
  trialDays: json["trial_days"] == null ? void 0 : json["trial_days"],
9984
9999
  updatedAt: new Date(json["updated_at"]),
9985
10000
  versions: json["versions"].map(
@@ -10084,6 +10099,7 @@ function UsageBasedEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminato
10084
10099
  metricPeriodMonthReset: json["metric_period_month_reset"] == null ? void 0 : MetricPeriodMonthResetFromJSON(json["metric_period_month_reset"]),
10085
10100
  monthlyUsageBasedPrice: json["monthly_usage_based_price"] == null ? void 0 : BillingPriceViewFromJSON(json["monthly_usage_based_price"]),
10086
10101
  priceBehavior: json["price_behavior"] == null ? void 0 : EntitlementPriceBehaviorFromJSON(json["price_behavior"]),
10102
+ quarterlyUsageBasedPrice: json["quarterly_usage_based_price"] == null ? void 0 : BillingPriceViewFromJSON(json["quarterly_usage_based_price"]),
10087
10103
  valueBool: json["value_bool"] == null ? void 0 : json["value_bool"],
10088
10104
  valueNumeric: json["value_numeric"] == null ? void 0 : json["value_numeric"],
10089
10105
  valueType: EntitlementValueTypeFromJSON(json["value_type"]),
@@ -11233,6 +11249,7 @@ function BillingPriceResponseDataFromJSONTyped9(json, ignoreDiscriminator) {
11233
11249
  externalPriceId: json["external_price_id"],
11234
11250
  id: json["id"],
11235
11251
  interval: BillingProductPriceIntervalFromJSON2(json["interval"]),
11252
+ intervalCount: json["interval_count"],
11236
11253
  nickname: json["nickname"] == null ? void 0 : json["nickname"],
11237
11254
  price: json["price"],
11238
11255
  priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
@@ -11368,6 +11385,7 @@ function BillingPriceViewFromJSONTyped9(json, ignoreDiscriminator) {
11368
11385
  currency: json["currency"],
11369
11386
  id: json["id"],
11370
11387
  interval: BillingProductPriceIntervalFromJSON2(json["interval"]),
11388
+ intervalCount: json["interval_count"],
11371
11389
  isActive: json["is_active"],
11372
11390
  meterEventName: json["meter_event_name"] == null ? void 0 : json["meter_event_name"],
11373
11391
  meterEventPayloadKey: json["meter_event_payload_key"] == null ? void 0 : json["meter_event_payload_key"],
@@ -11655,6 +11673,7 @@ function EntitlementCurrencyPricesResponseDataFromJSONTyped3(json, ignoreDiscrim
11655
11673
  return {
11656
11674
  currency: json["currency"],
11657
11675
  monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceViewFromJSON2(json["monthly_price"]),
11676
+ quarterlyPrice: json["quarterly_price"] == null ? void 0 : BillingPriceViewFromJSON2(json["quarterly_price"]),
11658
11677
  yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceViewFromJSON2(json["yearly_price"])
11659
11678
  };
11660
11679
  }
@@ -12002,6 +12021,7 @@ function PlanEntitlementResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
12002
12021
  featureId: json["feature_id"],
12003
12022
  id: json["id"],
12004
12023
  meteredMonthlyPrice: json["metered_monthly_price"] == null ? void 0 : BillingPriceViewFromJSON2(json["metered_monthly_price"]),
12024
+ meteredQuarterlyPrice: json["metered_quarterly_price"] == null ? void 0 : BillingPriceViewFromJSON2(json["metered_quarterly_price"]),
12005
12025
  meteredYearlyPrice: json["metered_yearly_price"] == null ? void 0 : BillingPriceViewFromJSON2(json["metered_yearly_price"]),
12006
12026
  metricPeriod: json["metric_period"] == null ? void 0 : MetricPeriodFromJSON2(json["metric_period"]),
12007
12027
  metricPeriodMonthReset: json["metric_period_month_reset"] == null ? void 0 : MetricPeriodMonthResetFromJSON2(json["metric_period_month_reset"]),
@@ -12079,6 +12099,7 @@ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator)
12079
12099
  currency: json["currency"],
12080
12100
  monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["monthly_price"]),
12081
12101
  oneTimePrice: json["one_time_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["one_time_price"]),
12102
+ quarterlyPrice: json["quarterly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["quarterly_price"]),
12082
12103
  yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["yearly_price"])
12083
12104
  };
12084
12105
  }
@@ -12163,6 +12184,7 @@ function PlanViewPublicResponseDataFromJSONTyped(json, ignoreDiscriminator) {
12163
12184
  name: json["name"],
12164
12185
  oneTimePrice: json["one_time_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["one_time_price"]),
12165
12186
  planType: PlanTypeFromJSON2(json["plan_type"]),
12187
+ quarterlyPrice: json["quarterly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON2(json["quarterly_price"]),
12166
12188
  trialDays: json["trial_days"] == null ? void 0 : json["trial_days"],
12167
12189
  updatedAt: new Date(json["updated_at"]),
12168
12190
  versions: json["versions"].map(
@@ -12250,6 +12272,24 @@ var ComponentspublicApi = class extends BaseAPI2 {
12250
12272
  };
12251
12273
 
12252
12274
  // src/utils/api/billing.ts
12275
+ function derivePeriod(interval, intervalCount) {
12276
+ if (!interval) {
12277
+ return void 0;
12278
+ }
12279
+ if (interval === "month" && intervalCount === 3) {
12280
+ return "quarter";
12281
+ }
12282
+ return interval;
12283
+ }
12284
+ function getSubscriptionPeriod(billingSubscription) {
12285
+ if (!billingSubscription) {
12286
+ return void 0;
12287
+ }
12288
+ const product = billingSubscription.products?.find(
12289
+ (p3) => p3.interval && p3.interval !== "one-time"
12290
+ );
12291
+ return derivePeriod(product?.interval, product?.intervalCount) ?? derivePeriod(billingSubscription.interval);
12292
+ }
12253
12293
  var ChargeType = {
12254
12294
  oneTime: "one_time",
12255
12295
  recurring: "recurring",
@@ -12259,19 +12299,32 @@ function getPriceValue(billingPrice) {
12259
12299
  const price = typeof billingPrice.priceDecimal === "string" ? Number(billingPrice.priceDecimal) : billingPrice.price;
12260
12300
  return price;
12261
12301
  }
12302
+ function selectPriceForPeriod(source, period) {
12303
+ switch (period) {
12304
+ case "year":
12305
+ return source.yearlyPrice;
12306
+ case "quarter":
12307
+ return source.quarterlyPrice;
12308
+ default:
12309
+ return source.monthlyPrice;
12310
+ }
12311
+ }
12312
+ function selectAvailablePrice(source) {
12313
+ return source.monthlyPrice ?? source.quarterlyPrice ?? source.yearlyPrice;
12314
+ }
12262
12315
  function getPlanPrice(plan, period = "month", options = { useSelectedPeriod: true }, currency) {
12263
12316
  if (currency && plan.currencyPrices?.length) {
12264
12317
  const currencyPrice = plan.currencyPrices.find(
12265
12318
  (cp) => cp.currency.toLowerCase() === currency.toLowerCase()
12266
12319
  );
12267
12320
  if (currencyPrice) {
12268
- const billingPrice2 = options.useSelectedPeriod ? period === "year" ? currencyPrice.yearlyPrice : currencyPrice.monthlyPrice : currencyPrice.yearlyPrice && !currencyPrice.monthlyPrice ? currencyPrice.yearlyPrice : currencyPrice.monthlyPrice;
12321
+ const billingPrice2 = options.useSelectedPeriod ? selectPriceForPeriod(currencyPrice, period) : selectAvailablePrice(currencyPrice);
12269
12322
  if (billingPrice2) {
12270
12323
  return { ...billingPrice2, price: getPriceValue(billingPrice2) };
12271
12324
  }
12272
12325
  }
12273
12326
  }
12274
- const billingPrice = options.useSelectedPeriod ? period === "year" ? plan.yearlyPrice : plan.monthlyPrice : plan.yearlyPrice && !plan.monthlyPrice ? plan.yearlyPrice : plan.monthlyPrice;
12327
+ const billingPrice = options.useSelectedPeriod ? selectPriceForPeriod(plan, period) : selectAvailablePrice(plan);
12275
12328
  if (billingPrice) {
12276
12329
  return { ...billingPrice, price: getPriceValue(billingPrice) };
12277
12330
  }
@@ -12282,13 +12335,13 @@ function getAddOnPrice(addOn, period = "month", currency) {
12282
12335
  (cp) => cp.currency.toLowerCase() === currency.toLowerCase()
12283
12336
  );
12284
12337
  if (currencyPrice) {
12285
- const billingPrice2 = addOn.chargeType === ChargeType.oneTime ? currencyPrice.oneTimePrice : period === "year" ? currencyPrice.yearlyPrice : currencyPrice.monthlyPrice;
12338
+ const billingPrice2 = addOn.chargeType === ChargeType.oneTime ? currencyPrice.oneTimePrice : selectPriceForPeriod(currencyPrice, period);
12286
12339
  if (billingPrice2) {
12287
12340
  return { ...billingPrice2, price: getPriceValue(billingPrice2) };
12288
12341
  }
12289
12342
  }
12290
12343
  }
12291
- const billingPrice = addOn.chargeType === ChargeType.oneTime ? addOn.oneTimePrice : period === "year" ? addOn.yearlyPrice : addOn.monthlyPrice;
12344
+ const billingPrice = addOn.chargeType === ChargeType.oneTime ? addOn.oneTimePrice : selectPriceForPeriod(addOn, period);
12292
12345
  if (billingPrice) {
12293
12346
  return { ...billingPrice, price: getPriceValue(billingPrice) };
12294
12347
  }
@@ -12312,14 +12365,28 @@ function getEntitlementPrice(entitlement, period = "month", currency) {
12312
12365
  (cp) => cp.currency.toLowerCase() === currency.toLowerCase()
12313
12366
  );
12314
12367
  if (currencyPrice) {
12315
- source = period === "year" ? currencyPrice.yearlyPrice : currencyPrice.monthlyPrice;
12368
+ source = selectPriceForPeriod(currencyPrice, period);
12316
12369
  }
12317
12370
  }
12318
12371
  if (!source) {
12319
12372
  if ("valueType" in entitlement) {
12320
- source = period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice;
12373
+ source = selectPriceForPeriod(
12374
+ {
12375
+ monthlyPrice: entitlement.meteredMonthlyPrice,
12376
+ quarterlyPrice: entitlement.meteredQuarterlyPrice,
12377
+ yearlyPrice: entitlement.meteredYearlyPrice
12378
+ },
12379
+ period
12380
+ );
12321
12381
  } else if ("entitlementType" in entitlement) {
12322
- source = period === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice;
12382
+ source = selectPriceForPeriod(
12383
+ {
12384
+ monthlyPrice: entitlement.monthlyUsageBasedPrice,
12385
+ quarterlyPrice: entitlement.quarterlyUsageBasedPrice,
12386
+ yearlyPrice: entitlement.yearlyUsageBasedPrice
12387
+ },
12388
+ period
12389
+ );
12323
12390
  }
12324
12391
  }
12325
12392
  if (source) {
@@ -12371,7 +12438,15 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
12371
12438
  return cost;
12372
12439
  }
12373
12440
  function getEntitlementCost(entitlement, period = "month", currency) {
12374
- const source = currency ? getEntitlementPrice(entitlement, period ?? "month", currency) : period === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice;
12441
+ const resolvedPeriod = period ?? "month";
12442
+ const source = currency ? getEntitlementPrice(entitlement, resolvedPeriod, currency) : selectPriceForPeriod(
12443
+ {
12444
+ monthlyPrice: entitlement.monthlyUsageBasedPrice,
12445
+ quarterlyPrice: entitlement.quarterlyUsageBasedPrice,
12446
+ yearlyPrice: entitlement.yearlyUsageBasedPrice
12447
+ },
12448
+ resolvedPeriod
12449
+ );
12375
12450
  if (source) {
12376
12451
  const billingPrice = { ...source };
12377
12452
  if (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && typeof entitlement.allocation === "number" && entitlement.allocation > 0) {
@@ -12632,7 +12707,7 @@ function getMetricPeriodName(entitlement) {
12632
12707
  return name;
12633
12708
  }
12634
12709
  function getUsageDetails(entitlement, period, currency) {
12635
- const billingPrice = currency ? getEntitlementPrice(entitlement, period ?? "month", currency) : period === "year" ? entitlement.yearlyUsageBasedPrice : period === "month" ? entitlement.monthlyUsageBasedPrice : void 0;
12710
+ const billingPrice = currency ? getEntitlementPrice(entitlement, period ?? "month", currency) : period === "year" ? entitlement.yearlyUsageBasedPrice : period === "quarter" ? entitlement.quarterlyUsageBasedPrice : period === "month" ? entitlement.monthlyUsageBasedPrice : void 0;
12636
12711
  let limit;
12637
12712
  if ((!entitlement.priceBehavior || entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance) && typeof entitlement.allocation === "number") {
12638
12713
  limit = entitlement.allocation;
@@ -12694,7 +12769,7 @@ function getCreditBasedEntitlementLimit(entitlement, credits) {
12694
12769
  }
12695
12770
  function extractCurrentUsageBasedEntitlements(features = [], planPeriod) {
12696
12771
  return features.reduce((acc, entitlement) => {
12697
- if (entitlement.priceBehavior && (planPeriod === "month" && entitlement.monthlyUsageBasedPrice || planPeriod === "year" && entitlement.yearlyUsageBasedPrice)) {
12772
+ if (entitlement.priceBehavior && (planPeriod === "month" && entitlement.monthlyUsageBasedPrice || planPeriod === "quarter" && entitlement.quarterlyUsageBasedPrice || planPeriod === "year" && entitlement.yearlyUsageBasedPrice)) {
12698
12773
  const allocation = entitlement.allocation || 0;
12699
12774
  const usage = entitlement.usage || 0;
12700
12775
  const quantity = allocation ?? usage;
@@ -13216,6 +13291,8 @@ function shortenPeriod(period) {
13216
13291
  switch (period) {
13217
13292
  case "month":
13218
13293
  return "mo";
13294
+ case "quarter":
13295
+ return "qtr";
13219
13296
  case "year":
13220
13297
  return "yr";
13221
13298
  }
@@ -13603,7 +13680,7 @@ var reducer = (state, action) => {
13603
13680
  // src/context/EmbedProvider.tsx
13604
13681
  import { jsx, jsxs } from "react/jsx-runtime";
13605
13682
  var getCustomHeaders = (sessionId) => ({
13606
- "X-Schematic-Components-Version": "2.11.0",
13683
+ "X-Schematic-Components-Version": "2.12.0",
13607
13684
  "X-Schematic-Session-ID": sessionId
13608
13685
  });
13609
13686
  var normalizeCurrencyFilter = (filter2) => {
@@ -14139,6 +14216,9 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
14139
14216
  if ((data?.activePlans || []).some((plan) => plan.monthlyPrice) || (data?.activeAddOns || []).some((addOn) => addOn.monthlyPrice)) {
14140
14217
  periods.push("month");
14141
14218
  }
14219
+ if ((data?.activePlans || []).some((plan) => plan.quarterlyPrice) || (data?.activeAddOns || []).some((addOn) => addOn.quarterlyPrice)) {
14220
+ periods.push("quarter");
14221
+ }
14142
14222
  if ((data?.activePlans || []).some((plan) => plan.yearlyPrice) || (data?.activeAddOns || []).some((addOn) => addOn.yearlyPrice)) {
14143
14223
  periods.push("year");
14144
14224
  }
@@ -14148,9 +14228,9 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
14148
14228
  (plans) => {
14149
14229
  const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
14150
14230
  if (options.useSelectedPeriod) {
14151
- return activePeriod === "month" && plan.monthlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
14231
+ return activePeriod === "month" && plan.monthlyPrice || activePeriod === "quarter" && plan.quarterlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
14152
14232
  }
14153
- return plan.monthlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
14233
+ return plan.monthlyPrice || plan.quarterlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
14154
14234
  });
14155
14235
  return activePlans.map((plan) => ({ ...plan, isSelected: false }));
14156
14236
  },
@@ -16139,7 +16219,7 @@ var Plan = ({
16139
16219
  $gap: "1rem",
16140
16220
  $flexGrow: 1,
16141
16221
  children: plans.map((plan, planIndex) => {
16142
- const planPeriod = showPeriodToggle ? period : plan.yearlyPrice && !plan.monthlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
16222
+ const planPeriod = showPeriodToggle ? period : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
16143
16223
  const { price: planPrice, currency: planCurrency } = getPlanPrice(
16144
16224
  plan,
16145
16225
  planPeriod,
@@ -16198,6 +16278,9 @@ var Plan = ({
16198
16278
  children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t3("Custom price") : isUsageBasedPlan ? t3("Usage-based") : isFreePlan && showZeroPriceAsFree ? t3("Free") : showAsMonthlyPrices && planPeriod === BillingProductPriceInterval.Year ? formatCurrency((planPrice ?? 0) / 12, {
16199
16279
  currency: planCurrency,
16200
16280
  testSignificantDigits: false
16281
+ }) : showAsMonthlyPrices && planPeriod === "quarter" ? formatCurrency((planPrice ?? 0) / 3, {
16282
+ currency: planCurrency,
16283
+ testSignificantDigits: false
16201
16284
  }) : formatCurrency(planPrice ?? 0, planCurrency)
16202
16285
  }
16203
16286
  ),
@@ -16208,7 +16291,7 @@ var Plan = ({
16208
16291
  $size: 16 / 30 * settings.theme.typography.heading2.fontSize,
16209
16292
  children: [
16210
16293
  "/",
16211
- showAsMonthlyPrices && planPeriod === BillingProductPriceInterval.Year ? t3("month, billed yearly") : t3(planPeriod)
16294
+ showAsMonthlyPrices && planPeriod === BillingProductPriceInterval.Year ? t3("month, billed yearly") : showAsMonthlyPrices && planPeriod === "quarter" ? t3("month, billed quarterly") : t3(planPeriod)
16212
16295
  ]
16213
16296
  }
16214
16297
  )
@@ -16744,7 +16827,7 @@ var AddOns = ({
16744
16827
  const { t: t3 } = useTranslation();
16745
16828
  const { settings } = useEmbed();
16746
16829
  const isLightBackground = useIsLightBackground();
16747
- const periodKey = period === "year" ? "yearlyPrice" : "monthlyPrice";
16830
+ const periodKey = period === "year" ? "yearlyPrice" : period === "quarter" ? "quarterlyPrice" : "monthlyPrice";
16748
16831
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
16749
16832
  return /* @__PURE__ */ jsx20(
16750
16833
  Box,
@@ -17224,9 +17307,9 @@ var Navigation = ({
17224
17307
  import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
17225
17308
  var createActiveUsageBasedEntitlementsReducer = (entitlements, period) => (acc, entitlement) => {
17226
17309
  const hasCurrencyPrice = entitlement.currencyPrices?.some(
17227
- (cp) => period === "month" && cp.monthlyPrice || period === "year" && cp.yearlyPrice
17310
+ (cp) => period === "month" && cp.monthlyPrice || period === "quarter" && cp.quarterlyPrice || period === "year" && cp.yearlyPrice
17228
17311
  );
17229
- if (entitlement.priceBehavior && (period === "month" && entitlement.meteredMonthlyPrice || period === "year" && entitlement.meteredYearlyPrice || hasCurrencyPrice)) {
17312
+ if (entitlement.priceBehavior && (period === "month" && entitlement.meteredMonthlyPrice || period === "quarter" && entitlement.meteredQuarterlyPrice || period === "year" && entitlement.meteredYearlyPrice || hasCurrencyPrice)) {
17230
17313
  const featureUsage = entitlements.find(
17231
17314
  (usage2) => usage2.feature?.id === entitlement.feature?.id
17232
17315
  );
@@ -17286,15 +17369,16 @@ var CheckoutDialog = ({ top }) => {
17286
17369
  [data?.featureUsage?.features]
17287
17370
  );
17288
17371
  const getValidatedPeriod = () => {
17289
- const requestedPeriod = checkoutState?.period || data?.company?.plan?.planPeriod || "month";
17372
+ const requestedPeriod = checkoutState?.period || getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month";
17290
17373
  if (checkoutState?.planId) {
17291
17374
  const requestedPlan = data?.activePlans?.find(
17292
17375
  (plan) => plan.id === checkoutState.planId
17293
17376
  );
17294
17377
  if (requestedPlan) {
17295
- const planSupportsRequestedPeriod = requestedPeriod === "month" && requestedPlan.monthlyPrice || requestedPeriod === "year" && requestedPlan.yearlyPrice;
17378
+ const planSupportsRequestedPeriod = requestedPeriod === "month" && requestedPlan.monthlyPrice || requestedPeriod === "quarter" && requestedPlan.quarterlyPrice || requestedPeriod === "year" && requestedPlan.yearlyPrice;
17296
17379
  if (!planSupportsRequestedPeriod) {
17297
17380
  if (requestedPlan.yearlyPrice) return "year";
17381
+ if (requestedPlan.quarterlyPrice) return "quarter";
17298
17382
  if (requestedPlan.monthlyPrice) return "month";
17299
17383
  }
17300
17384
  }
@@ -17611,7 +17695,7 @@ var CheckoutDialog = ({ top }) => {
17611
17695
  { useSelectedPeriod: true },
17612
17696
  resolvedCurrency
17613
17697
  ) : void 0;
17614
- const planPriceId = currencyPrice?.id ?? (period === "year" ? plan?.yearlyPrice?.id : plan?.monthlyPrice?.id);
17698
+ const planPriceId = currencyPrice?.id ?? (period === "year" ? plan?.yearlyPrice?.id : period === "quarter" ? plan?.quarterlyPrice?.id : plan?.monthlyPrice?.id);
17615
17699
  const code = typeof updates.promoCode !== "undefined" ? updates.promoCode : promoCode;
17616
17700
  const skipTrial = !(updates.shouldTrial ?? shouldTrial);
17617
17701
  if (!plan || !planPriceId) {
@@ -17737,7 +17821,7 @@ var CheckoutDialog = ({ top }) => {
17737
17821
  const selectPlan = useCallback7(
17738
17822
  (updates) => {
17739
17823
  const plan = updates.plan;
17740
- const period = showPeriodToggle ? updates.period || planPeriod : plan.yearlyPrice && !plan.monthlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
17824
+ const period = showPeriodToggle ? updates.period || planPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
17741
17825
  const updatedUsageBasedEntitlements = plan.entitlements.reduce(
17742
17826
  createActiveUsageBasedEntitlementsReducer(featureUsage, period),
17743
17827
  []
@@ -17795,12 +17879,60 @@ var CheckoutDialog = ({ top }) => {
17795
17879
  );
17796
17880
  const changePlanPeriod = useCallback7(
17797
17881
  (period) => {
17798
- if (period !== planPeriod) {
17799
- setPlanPeriod(period);
17800
- handlePreviewCheckout({ period });
17882
+ if (period === planPeriod) {
17883
+ return;
17801
17884
  }
17885
+ setPlanPeriod(period);
17886
+ const updatedUsageBasedEntitlements = (selectedPlan?.entitlements || []).reduce(
17887
+ createActiveUsageBasedEntitlementsReducer(featureUsage, period),
17888
+ [...[]]
17889
+ );
17890
+ setUsageBasedEntitlements(
17891
+ (prev2) => updatedUsageBasedEntitlements.map((updated) => {
17892
+ const current = prev2.find(
17893
+ ({ featureId }) => featureId === updated.featureId
17894
+ );
17895
+ if (typeof current?.quantity === "number") {
17896
+ return { ...updated, quantity: current.quantity };
17897
+ }
17898
+ return updated;
17899
+ })
17900
+ );
17901
+ const updatedAddOnUsageBasedEntitlements = addOns.filter((addOn) => addOn.isSelected).flatMap(
17902
+ (addOn) => addOn.entitlements.reduce(
17903
+ createActiveUsageBasedEntitlementsReducer(featureUsage, period),
17904
+ []
17905
+ )
17906
+ );
17907
+ setAddOnUsageBasedEntitlements(
17908
+ (prev2) => updatedAddOnUsageBasedEntitlements.map((updated) => {
17909
+ const current = prev2.find(
17910
+ ({ featureId }) => featureId === updated.featureId
17911
+ );
17912
+ if (typeof current?.quantity === "number") {
17913
+ return { ...updated, quantity: current.quantity };
17914
+ }
17915
+ return updated;
17916
+ })
17917
+ );
17918
+ handlePreviewCheckout({
17919
+ period,
17920
+ payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
17921
+ ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
17922
+ ),
17923
+ addOnPayInAdvanceEntitlements: updatedAddOnUsageBasedEntitlements.filter(
17924
+ ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
17925
+ )
17926
+ });
17802
17927
  },
17803
- [planPeriod, setPlanPeriod, handlePreviewCheckout]
17928
+ [
17929
+ planPeriod,
17930
+ selectedPlan?.entitlements,
17931
+ featureUsage,
17932
+ addOns,
17933
+ setPlanPeriod,
17934
+ handlePreviewCheckout
17935
+ ]
17804
17936
  );
17805
17937
  const toggleAddOn = useCallback7(
17806
17938
  (id) => {
@@ -18705,6 +18837,10 @@ var PaymentForm = ({ onConfirm, financeData }) => {
18705
18837
  // src/components/shared/period-toggle/PeriodToggle.tsx
18706
18838
  import { useMemo as useMemo13 } from "react";
18707
18839
  import { jsx as jsx30 } from "react/jsx-runtime";
18840
+ var PERIOD_MONTH_COUNT = {
18841
+ year: 12,
18842
+ quarter: 3
18843
+ };
18708
18844
  var PeriodToggle = ({
18709
18845
  portal,
18710
18846
  options,
@@ -18715,14 +18851,23 @@ var PeriodToggle = ({
18715
18851
  const { t: t3 } = useTranslation();
18716
18852
  const { settings } = useEmbed();
18717
18853
  const isLightBackground = useIsLightBackground();
18718
- const savingsPercentage = useMemo13(() => {
18719
- if (selectedPlan) {
18720
- const monthlyBillingPrice = getPlanPrice(selectedPlan, "month");
18721
- const yearlyBillingPrice = getPlanPrice(selectedPlan, "year");
18722
- const monthly = (monthlyBillingPrice?.price ?? 0) * 12;
18723
- const yearly = yearlyBillingPrice?.price ?? 0;
18724
- return Math.round((monthly - yearly) / monthly * 1e4) / 100;
18854
+ const savingsByPeriod = useMemo13(() => {
18855
+ const result = {};
18856
+ if (!selectedPlan) {
18857
+ return result;
18858
+ }
18859
+ const monthlyPrice = getPlanPrice(selectedPlan, "month")?.price ?? 0;
18860
+ if (monthlyPrice <= 0) {
18861
+ return result;
18725
18862
  }
18863
+ for (const [period, months] of Object.entries(PERIOD_MONTH_COUNT)) {
18864
+ const periodPrice = getPlanPrice(selectedPlan, period)?.price ?? 0;
18865
+ if (periodPrice > 0) {
18866
+ const baseline = monthlyPrice * months;
18867
+ result[period] = Math.round((baseline - periodPrice) / baseline * 1e4) / 100;
18868
+ }
18869
+ }
18870
+ return result;
18726
18871
  }, [selectedPlan]);
18727
18872
  return /* @__PURE__ */ jsx30(
18728
18873
  Flex,
@@ -18776,17 +18921,21 @@ var PeriodToggle = ({
18776
18921
  },
18777
18922
  option
18778
18923
  );
18779
- if (option === "year" && typeof savingsPercentage === "number") {
18924
+ const savingsPercentage = savingsByPeriod[option];
18925
+ if (typeof savingsPercentage === "number") {
18926
+ const isOptionYear = option === "year";
18780
18927
  return /* @__PURE__ */ jsx30(
18781
18928
  Tooltip,
18782
18929
  {
18783
18930
  portal,
18784
18931
  trigger: element,
18785
- content: /* @__PURE__ */ jsx30(Text, { $size: 11, $leading: "none", children: selectedOption === "month" ? t3("Save with yearly billing", {
18786
- percent: savingsPercentage
18787
- }) : t3("Saving with yearly billing", {
18788
- percent: savingsPercentage
18789
- }) }),
18932
+ content: /* @__PURE__ */ jsx30(Text, { $size: 11, $leading: "none", children: selectedOption === option ? t3(
18933
+ isOptionYear ? "Saving with yearly billing" : "Saving with quarterly billing",
18934
+ { percent: savingsPercentage }
18935
+ ) : t3(
18936
+ isOptionYear ? "Save with yearly billing" : "Save with quarterly billing",
18937
+ { percent: savingsPercentage }
18938
+ ) }),
18790
18939
  $flexGrow: 1,
18791
18940
  $flexBasis: "50%"
18792
18941
  },
@@ -19739,7 +19888,7 @@ var SubscriptionSidebar = forwardRef7(
19739
19888
  { useSelectedPeriod: true },
19740
19889
  currency
19741
19890
  ) : void 0;
19742
- const planPriceId = currencyPrice?.id ?? (planPeriod === "year" ? selectedPlan?.yearlyPrice : selectedPlan?.monthlyPrice)?.id;
19891
+ const planPriceId = currencyPrice?.id ?? (planPeriod === "year" ? selectedPlan?.yearlyPrice : planPeriod === "quarter" ? selectedPlan?.quarterlyPrice : selectedPlan?.monthlyPrice)?.id;
19743
19892
  try {
19744
19893
  if (!planId || !planPriceId) {
19745
19894
  throw new Error(t3("Selected plan or associated price is missing."));
@@ -20033,7 +20182,9 @@ var SubscriptionSidebar = forwardRef7(
20033
20182
  ),
20034
20183
  /* @__PURE__ */ jsxs26("sub", { children: [
20035
20184
  "/",
20036
- shortenPeriod(currentPlan.planPeriod || planPeriod)
20185
+ shortenPeriod(
20186
+ getSubscriptionPeriod(billingSubscription) || currentPlan.planPeriod || planPeriod
20187
+ )
20037
20188
  ] })
20038
20189
  ] }) })
20039
20190
  ]
@@ -20416,7 +20567,7 @@ var SubscriptionSidebar = forwardRef7(
20416
20567
  $gap: "1rem",
20417
20568
  children: [
20418
20569
  /* @__PURE__ */ jsx36(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsxs26(Text, { children: [
20419
- planPeriod === "year" ? t3("Yearly total") : t3("Monthly total"),
20570
+ planPeriod === "year" ? t3("Yearly total") : planPeriod === "quarter" ? t3("Quarterly total") : t3("Monthly total"),
20420
20571
  ":"
20421
20572
  ] }) }),
20422
20573
  /* @__PURE__ */ jsx36(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs26(Text, { children: [
@@ -20600,7 +20751,7 @@ var UnsubscribeDialog = ({ top }) => {
20600
20751
  const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = useMemo18(() => {
20601
20752
  const cancelDate2 = data?.subscription?.cancelAt || data?.upcomingInvoice?.dueDate;
20602
20753
  return {
20603
- planPeriod: data?.company?.plan?.planPeriod || "month",
20754
+ planPeriod: getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month",
20604
20755
  currentPlan: data?.company?.plan,
20605
20756
  currentAddOns: data?.company?.addOns || [],
20606
20757
  featureUsage: data?.featureUsage,
@@ -20608,6 +20759,7 @@ var UnsubscribeDialog = ({ top }) => {
20608
20759
  };
20609
20760
  }, [
20610
20761
  data?.company?.addOns,
20762
+ data?.company?.billingSubscription,
20611
20763
  data?.company?.plan,
20612
20764
  data?.featureUsage,
20613
20765
  data?.subscription?.cancelAt,
@@ -21033,7 +21185,7 @@ var UsageDetails = ({ entitlement, layout }) => {
21033
21185
  } = entitlement;
21034
21186
  const { t: t3 } = useTranslation();
21035
21187
  const { data } = useEmbed();
21036
- const period = data?.company?.plan?.planPeriod || void 0;
21188
+ const period = getSubscriptionPeriod(data?.company?.billingSubscription) ?? data?.company?.plan?.planPeriod ?? void 0;
21037
21189
  const showCredits = data?.displaySettings?.showCredits ?? true;
21038
21190
  const {
21039
21191
  price,
@@ -21910,7 +22062,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
21910
22062
  if (!shouldShowFeatures) {
21911
22063
  return null;
21912
22064
  }
21913
- const period = typeof data?.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0;
22065
+ const period = getSubscriptionPeriod(data?.company?.billingSubscription) ?? (typeof data?.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0);
21914
22066
  const canCheckout = data?.capabilities?.checkout ?? false;
21915
22067
  const showCredits = data?.displaySettings?.showCredits ?? true;
21916
22068
  return /* @__PURE__ */ jsxs35(Container2, { ref, className, children: [
@@ -22502,7 +22654,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
22502
22654
  }
22503
22655
  stripe._registerWrapper({
22504
22656
  name: "stripe-js",
22505
- version: "9.4.0",
22657
+ version: "9.6.0",
22506
22658
  startTime
22507
22659
  });
22508
22660
  };
@@ -22580,7 +22732,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
22580
22732
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
22581
22733
  var expectedVersion = RELEASE_TRAIN;
22582
22734
  if (isTestKey && version !== expectedVersion) {
22583
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.4.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
22735
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.6.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
22584
22736
  }
22585
22737
  var stripe = maybeStripe.apply(void 0, args);
22586
22738
  registerWrapper(stripe, startTime);
@@ -22963,7 +23115,8 @@ import { forwardRef as forwardRef14, useMemo as useMemo26 } from "react";
22963
23115
 
22964
23116
  // src/components/elements/plan-manager/AddOn.tsx
22965
23117
  import { jsx as jsx52, jsxs as jsxs38 } from "react/jsx-runtime";
22966
- var AddOn = ({ addOn, currency, layout }) => {
23118
+ var AddOn = ({ addOn, currency, period, layout }) => {
23119
+ const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
22967
23120
  return /* @__PURE__ */ jsxs38(
22968
23121
  Flex,
22969
23122
  {
@@ -22973,9 +23126,9 @@ var AddOn = ({ addOn, currency, layout }) => {
22973
23126
  $gap: "1rem",
22974
23127
  children: [
22975
23128
  /* @__PURE__ */ jsx52(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
22976
- typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ jsxs38(Text, { children: [
23129
+ typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ jsxs38(Text, { children: [
22977
23130
  formatCurrency(addOn.planPrice, currency),
22978
- /* @__PURE__ */ jsx52("sub", { children: addOn.planPeriod == "one-time" ? shortenPeriod(addOn.planPeriod) : `/${shortenPeriod(addOn.planPeriod)}` })
23131
+ /* @__PURE__ */ jsx52("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
22979
23132
  ] })
22980
23133
  ]
22981
23134
  }
@@ -23227,7 +23380,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
23227
23380
  willSubscriptionCancel,
23228
23381
  isTrialSubscription
23229
23382
  } = useMemo26(() => {
23230
- const subscriptionInterval2 = billingSubscription?.interval;
23383
+ const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
23231
23384
  const subscriptionCurrency2 = billingSubscription?.currency;
23232
23385
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
23233
23386
  const willSubscriptionCancel2 = typeof billingSubscription?.cancelAt === "number" && billingSubscription?.cancelAtPeriodEnd === true;
@@ -23238,6 +23391,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
23238
23391
  willSubscriptionCancel: willSubscriptionCancel2
23239
23392
  };
23240
23393
  }, [billingSubscription]);
23394
+ const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
23241
23395
  const { isFreePlan, isUsageBasedPlan } = useMemo26(() => {
23242
23396
  const isFreePlan2 = currentPlan?.planPrice === 0;
23243
23397
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
@@ -23406,9 +23560,9 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
23406
23560
  )
23407
23561
  }
23408
23562
  ),
23409
- !isFreePlan && currentPlan?.planPeriod && /* @__PURE__ */ jsx54(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs40("sub", { children: [
23563
+ !isFreePlan && currentPlanPeriod && /* @__PURE__ */ jsx54(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs40("sub", { children: [
23410
23564
  "/",
23411
- shortenPeriod(currentPlan.planPeriod)
23565
+ shortenPeriod(currentPlanPeriod)
23412
23566
  ] }) })
23413
23567
  ] })
23414
23568
  ]
@@ -23428,6 +23582,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
23428
23582
  {
23429
23583
  addOn,
23430
23584
  currency: subscriptionCurrency,
23585
+ period: currentPlanPeriod,
23431
23586
  layout: props
23432
23587
  },
23433
23588
  addOnIndex
@@ -23447,7 +23602,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
23447
23602
  UsageDetails2,
23448
23603
  {
23449
23604
  entitlement,
23450
- period: currentPlan?.planPeriod || "month",
23605
+ period: currentPlanPeriod || "month",
23451
23606
  currency: subscriptionCurrency,
23452
23607
  showCredits,
23453
23608
  layout: props
@@ -23778,7 +23933,8 @@ var AddOn2 = ({
23778
23933
  };
23779
23934
  }, [data?.capabilities?.checkout, data?.company?.addOns, data?.component]);
23780
23935
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
23781
- const isActiveAddOn = addOn.current && selectedPeriod === currentAddOns.find((currentAddOn) => currentAddOn.id === addOn.id)?.planPeriod;
23936
+ const currentAddOnPeriod = getSubscriptionPeriod(data?.company?.billingSubscription) ?? currentAddOns.find((currentAddOn) => currentAddOn.id === addOn.id)?.planPeriod;
23937
+ const isActiveAddOn = addOn.current && selectedPeriod === currentAddOnPeriod;
23782
23938
  const { price: addOnPrice, currency: addOnCurrency } = getAddOnPrice(addOn, selectedPeriod, currency) || {};
23783
23939
  const displayableEntitlements = addOn.entitlements?.filter(
23784
23940
  (entitlement) => entitlement.valueType === "unlimited" || entitlement.priceBehavior && entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown
@@ -24238,7 +24394,7 @@ var Plan2 = ({
24238
24394
  };
24239
24395
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
24240
24396
  const isStandalone = typeof data?.component === "undefined";
24241
- const currentPeriod = data?.company?.plan?.planPeriod || "month";
24397
+ const currentPeriod = getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month";
24242
24398
  const canCheckout = isStandalone || (data?.capabilities?.checkout ?? true);
24243
24399
  const isTrialSubscription = data?.company?.billingSubscription?.status === "trialing";
24244
24400
  const showCredits = data?.displaySettings?.showCredits ?? true;
@@ -24308,10 +24464,13 @@ var Plan2 = ({
24308
24464
  plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t3("Custom price") : isUsageBasedPlan ? t3("Usage-based") : isFreePlan && showZeroPriceAsFree ? t3("Free") : showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? formatCurrency((planPrice ?? 0) / 12, {
24309
24465
  currency: planCurrency,
24310
24466
  testSignificantDigits: false
24467
+ }) : showAsMonthlyPrices && selectedPeriod === "quarter" ? formatCurrency((planPrice ?? 0) / 3, {
24468
+ currency: planCurrency,
24469
+ testSignificantDigits: false
24311
24470
  }) : formatCurrency(planPrice ?? 0, planCurrency),
24312
24471
  !plan.custom && !isFreePlan && /* @__PURE__ */ jsxs43("sub", { children: [
24313
24472
  "/",
24314
- showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? t3("month, billed yearly") : t3(selectedPeriod)
24473
+ showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? t3("month, billed yearly") : showAsMonthlyPrices && selectedPeriod === "quarter" ? t3("month, billed quarterly") : t3(selectedPeriod)
24315
24474
  ] })
24316
24475
  ]
24317
24476
  }
@@ -24614,7 +24773,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
24614
24773
  []
24615
24774
  );
24616
24775
  const [selectedPeriod, setSelectedPeriod] = useState20(
24617
- () => data?.company?.plan?.planPeriod || "month"
24776
+ () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
24618
24777
  );
24619
24778
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
24620
24779
  const [selectedCurrency, setSelectedCurrency] = useState20(
@@ -24750,7 +24909,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
24750
24909
  $margin: 0,
24751
24910
  $listStyle: "none",
24752
24911
  children: plans.map((plan, index, self2) => {
24753
- const planPeriod = showPeriodToggle ? selectedPeriod : plan.yearlyPrice && !plan.monthlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
24912
+ const planPeriod = showPeriodToggle ? selectedPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
24754
24913
  return /* @__PURE__ */ jsx58(
24755
24914
  Plan2,
24756
24915
  {
@@ -24802,7 +24961,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
24802
24961
  $margin: 0,
24803
24962
  $listStyle: "none",
24804
24963
  children: addOns.map((addOn, index) => {
24805
- const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.yearlyPrice && !addOn.monthlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
24964
+ const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.monthlyPrice ? BillingProductPriceInterval.Month : addOn.quarterlyPrice ? "quarter" : addOn.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
24806
24965
  return /* @__PURE__ */ jsx58(
24807
24966
  AddOn2,
24808
24967
  {