@schematichq/schematic-components 2.9.0-rc.1 → 2.9.0-rc.2

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.
@@ -6890,6 +6890,7 @@ var Configuration = class {
6890
6890
  constructor(configuration = {}) {
6891
6891
  this.configuration = configuration;
6892
6892
  }
6893
+ configuration;
6893
6894
  set config(configuration) {
6894
6895
  this.configuration = configuration;
6895
6896
  }
@@ -6938,6 +6939,7 @@ var BaseAPI = class _BaseAPI {
6938
6939
  this.configuration = configuration;
6939
6940
  this.middleware = configuration.middleware;
6940
6941
  }
6942
+ configuration;
6941
6943
  static jsonRegex = new RegExp(
6942
6944
  "^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$",
6943
6945
  "i"
@@ -7094,6 +7096,7 @@ var ResponseError = class extends Error {
7094
7096
  super(msg);
7095
7097
  this.response = response;
7096
7098
  }
7099
+ response;
7097
7100
  name = "ResponseError";
7098
7101
  };
7099
7102
  var FetchError = class extends Error {
@@ -7101,6 +7104,7 @@ var FetchError = class extends Error {
7101
7104
  super(msg);
7102
7105
  this.cause = cause;
7103
7106
  }
7107
+ cause;
7104
7108
  name = "FetchError";
7105
7109
  };
7106
7110
  var RequiredError = class extends Error {
@@ -7108,6 +7112,7 @@ var RequiredError = class extends Error {
7108
7112
  super(msg);
7109
7113
  this.field = field;
7110
7114
  }
7115
+ field;
7111
7116
  name = "RequiredError";
7112
7117
  };
7113
7118
  function querystring(params, prefix2 = "") {
@@ -7136,6 +7141,8 @@ var JSONApiResponse = class {
7136
7141
  this.raw = raw;
7137
7142
  this.transformer = transformer;
7138
7143
  }
7144
+ raw;
7145
+ transformer;
7139
7146
  async value() {
7140
7147
  return this.transformer(await this.raw.json());
7141
7148
  }
@@ -7579,6 +7586,7 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
7579
7586
  autoTopupExpiryType: json["auto_topup_expiry_type"] == null ? void 0 : BillingCreditExpiryTypeFromJSON(json["auto_topup_expiry_type"]),
7580
7587
  autoTopupExpiryUnit: json["auto_topup_expiry_unit"] == null ? void 0 : BillingCreditExpiryUnitFromJSON(json["auto_topup_expiry_unit"]),
7581
7588
  autoTopupExpiryUnitCount: json["auto_topup_expiry_unit_count"] == null ? void 0 : json["auto_topup_expiry_unit_count"],
7589
+ autoTopupThresholdCredits: json["auto_topup_threshold_credits"] == null ? void 0 : json["auto_topup_threshold_credits"],
7582
7590
  autoTopupThresholdPercent: json["auto_topup_threshold_percent"] == null ? void 0 : json["auto_topup_threshold_percent"],
7583
7591
  createdAt: new Date(json["created_at"]),
7584
7592
  credit: json["credit"] == null ? void 0 : BillingCreditResponseDataFromJSON(json["credit"]),
@@ -8066,6 +8074,7 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
8066
8074
  json["billing_credit_auto_topup_expiry_unit"]
8067
8075
  ),
8068
8076
  billingCreditAutoTopupExpiryUnitCount: json["billing_credit_auto_topup_expiry_unit_count"] == null ? void 0 : json["billing_credit_auto_topup_expiry_unit_count"],
8077
+ billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
8069
8078
  billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
8070
8079
  createdAt: new Date(json["created_at"]),
8071
8080
  credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON(json["credit"]),
@@ -8726,6 +8735,14 @@ function EntitlementPriceBehaviorFromJSONTyped(json, ignoreDiscriminator) {
8726
8735
  return json;
8727
8736
  }
8728
8737
 
8738
+ // src/api/checkoutexternal/models/PlanIcon.ts
8739
+ function PlanIconFromJSON(json) {
8740
+ return PlanIconFromJSONTyped(json, false);
8741
+ }
8742
+ function PlanIconFromJSONTyped(json, ignoreDiscriminator) {
8743
+ return json;
8744
+ }
8745
+
8729
8746
  // src/api/checkoutexternal/models/PlanType.ts
8730
8747
  function PlanTypeFromJSON(json) {
8731
8748
  return PlanTypeFromJSONTyped(json, false);
@@ -8746,7 +8763,7 @@ function PlanResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8746
8763
  audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
8747
8764
  createdAt: new Date(json["created_at"]),
8748
8765
  description: json["description"],
8749
- icon: json["icon"],
8766
+ icon: PlanIconFromJSON(json["icon"]),
8750
8767
  id: json["id"],
8751
8768
  name: json["name"],
8752
8769
  planType: PlanTypeFromJSON(json["plan_type"]),
@@ -8845,7 +8862,7 @@ function PlanVersionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8845
8862
  createdAt: new Date(json["created_at"]),
8846
8863
  description: json["description"],
8847
8864
  environmentId: json["environment_id"],
8848
- icon: json["icon"],
8865
+ icon: PlanIconFromJSON(json["icon"]),
8849
8866
  id: json["id"],
8850
8867
  name: json["name"],
8851
8868
  originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
@@ -8976,7 +8993,7 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8976
8993
  features: json["features"].map(
8977
8994
  FeatureDetailResponseDataFromJSON
8978
8995
  ),
8979
- icon: json["icon"],
8996
+ icon: PlanIconFromJSON(json["icon"]),
8980
8997
  id: json["id"],
8981
8998
  includedCreditGrants: json["included_credit_grants"].map(
8982
8999
  PlanCreditGrantViewFromJSON
@@ -9127,7 +9144,7 @@ function PlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
9127
9144
  features: json["features"].map(
9128
9145
  FeatureDetailResponseDataFromJSON
9129
9146
  ),
9130
- icon: json["icon"],
9147
+ icon: PlanIconFromJSON(json["icon"]),
9131
9148
  id: json["id"],
9132
9149
  includedCreditGrants: json["included_credit_grants"] == null ? void 0 : json["included_credit_grants"].map(
9133
9150
  BillingPlanCreditGrantResponseDataFromJSON
@@ -10081,6 +10098,7 @@ var Configuration2 = class {
10081
10098
  constructor(configuration = {}) {
10082
10099
  this.configuration = configuration;
10083
10100
  }
10101
+ configuration;
10084
10102
  set config(configuration) {
10085
10103
  this.configuration = configuration;
10086
10104
  }
@@ -10129,6 +10147,7 @@ var BaseAPI2 = class _BaseAPI {
10129
10147
  this.configuration = configuration;
10130
10148
  this.middleware = configuration.middleware;
10131
10149
  }
10150
+ configuration;
10132
10151
  static jsonRegex = new RegExp(
10133
10152
  "^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$",
10134
10153
  "i"
@@ -10285,6 +10304,7 @@ var ResponseError2 = class extends Error {
10285
10304
  super(msg);
10286
10305
  this.response = response;
10287
10306
  }
10307
+ response;
10288
10308
  name = "ResponseError";
10289
10309
  };
10290
10310
  var FetchError2 = class extends Error {
@@ -10292,6 +10312,7 @@ var FetchError2 = class extends Error {
10292
10312
  super(msg);
10293
10313
  this.cause = cause;
10294
10314
  }
10315
+ cause;
10295
10316
  name = "FetchError";
10296
10317
  };
10297
10318
  function querystring2(params, prefix2 = "") {
@@ -10320,6 +10341,8 @@ var JSONApiResponse2 = class {
10320
10341
  this.raw = raw;
10321
10342
  this.transformer = transformer;
10322
10343
  }
10344
+ raw;
10345
+ transformer;
10323
10346
  async value() {
10324
10347
  return this.transformer(await this.raw.json());
10325
10348
  }
@@ -11044,6 +11067,7 @@ function PlanCreditGrantViewFromJSONTyped4(json, ignoreDiscriminator) {
11044
11067
  json["billing_credit_auto_topup_expiry_unit"]
11045
11068
  ),
11046
11069
  billingCreditAutoTopupExpiryUnitCount: json["billing_credit_auto_topup_expiry_unit_count"] == null ? void 0 : json["billing_credit_auto_topup_expiry_unit_count"],
11070
+ billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
11047
11071
  billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
11048
11072
  createdAt: new Date(json["created_at"]),
11049
11073
  credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON2(json["credit"]),
@@ -11084,6 +11108,14 @@ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator)
11084
11108
  };
11085
11109
  }
11086
11110
 
11111
+ // src/api/componentspublic/models/PlanIcon.ts
11112
+ function PlanIconFromJSON2(json) {
11113
+ return PlanIconFromJSONTyped7(json, false);
11114
+ }
11115
+ function PlanIconFromJSONTyped7(json, ignoreDiscriminator) {
11116
+ return json;
11117
+ }
11118
+
11087
11119
  // src/api/componentspublic/models/PlanType.ts
11088
11120
  function PlanTypeFromJSON2(json) {
11089
11121
  return PlanTypeFromJSONTyped7(json, false);
@@ -11104,7 +11136,7 @@ function PlanResponseDataFromJSONTyped4(json, ignoreDiscriminator) {
11104
11136
  audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
11105
11137
  createdAt: new Date(json["created_at"]),
11106
11138
  description: json["description"],
11107
- icon: json["icon"],
11139
+ icon: PlanIconFromJSON2(json["icon"]),
11108
11140
  id: json["id"],
11109
11141
  name: json["name"],
11110
11142
  planType: PlanTypeFromJSON2(json["plan_type"]),
@@ -11172,7 +11204,7 @@ function PlanVersionResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
11172
11204
  createdAt: new Date(json["created_at"]),
11173
11205
  description: json["description"],
11174
11206
  environmentId: json["environment_id"],
11175
- icon: json["icon"],
11207
+ icon: PlanIconFromJSON2(json["icon"]),
11176
11208
  id: json["id"],
11177
11209
  name: json["name"],
11178
11210
  originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
@@ -11213,7 +11245,7 @@ function PlanViewPublicResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11213
11245
  features: json["features"].map(
11214
11246
  FeatureDetailResponseDataFromJSON2
11215
11247
  ),
11216
- icon: json["icon"],
11248
+ icon: PlanIconFromJSON2(json["icon"]),
11217
11249
  id: json["id"],
11218
11250
  includedCreditGrants: json["included_credit_grants"].map(
11219
11251
  PlanCreditGrantViewFromJSON2
@@ -11357,8 +11389,9 @@ function getAddOnPrice(addOn, period = "month", currency) {
11357
11389
  }
11358
11390
  }
11359
11391
  function getEntitlementPrice(entitlement, period = "month", currency) {
11360
- if (currency && "valueType" in entitlement && entitlement.currencyPrices?.length) {
11361
- const currencyPrice = entitlement.currencyPrices.find(
11392
+ const currencyPrices = "valueType" in entitlement ? entitlement.currencyPrices : "entitlementType" in entitlement ? entitlement.planEntitlement?.currencyPrices : void 0;
11393
+ if (currency && currencyPrices?.length) {
11394
+ const currencyPrice = currencyPrices.find(
11362
11395
  (cp) => cp.currency.toLowerCase() === currency.toLowerCase()
11363
11396
  );
11364
11397
  if (currencyPrice) {
@@ -11427,8 +11460,8 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
11427
11460
  }
11428
11461
  return cost;
11429
11462
  }
11430
- function getEntitlementCost(entitlement, period = "month") {
11431
- const source = period === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice;
11463
+ function getEntitlementCost(entitlement, period = "month", currency) {
11464
+ const source = currency ? getEntitlementPrice(entitlement, period ?? "month", currency) : period === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice;
11432
11465
  if (source) {
11433
11466
  const billingPrice = { ...source };
11434
11467
  if (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && typeof entitlement.allocation === "number" && entitlement.allocation > 0) {
@@ -11631,8 +11664,8 @@ function getMetricPeriodName(entitlement) {
11631
11664
  const name = period ? PeriodName[period] : void 0;
11632
11665
  return name;
11633
11666
  }
11634
- function getUsageDetails(entitlement, period) {
11635
- const billingPrice = period === "year" ? entitlement.yearlyUsageBasedPrice : period === "month" ? entitlement.monthlyUsageBasedPrice : void 0;
11667
+ function getUsageDetails(entitlement, period, currency) {
11668
+ const billingPrice = currency ? getEntitlementPrice(entitlement, period ?? "month", currency) : period === "year" ? entitlement.yearlyUsageBasedPrice : period === "month" ? entitlement.monthlyUsageBasedPrice : void 0;
11636
11669
  let limit;
11637
11670
  if ((!entitlement.priceBehavior || entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance) && typeof entitlement.allocation === "number") {
11638
11671
  limit = entitlement.allocation;
@@ -11651,7 +11684,7 @@ function getUsageDetails(entitlement, period) {
11651
11684
  } else if (entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof entitlement.creditUsed === "number" && typeof entitlement.creditConsumptionRate === "number") {
11652
11685
  amount = entitlement.creditUsed / entitlement.creditConsumptionRate;
11653
11686
  }
11654
- const cost = getEntitlementCost(entitlement, period);
11687
+ const cost = getEntitlementCost(entitlement, period, currency);
11655
11688
  const tiers = billingPrice?.priceTier || [];
11656
11689
  let currentTier;
11657
11690
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlement.softLimit === "number") {
@@ -12127,17 +12160,22 @@ function hexToHSL(color) {
12127
12160
  const cmin = Math.min(r2, g2, b2);
12128
12161
  const cmax = Math.max(r2, g2, b2);
12129
12162
  const delta = cmax - cmin;
12130
- let h2 = 0;
12131
- let s = 0;
12132
- let l2 = 0;
12133
- if (delta == 0) h2 = 0;
12134
- else if (cmax == r2) h2 = (g2 - b2) / delta % 6;
12135
- else if (cmax == g2) h2 = (b2 - r2) / delta + 2;
12136
- else h2 = (r2 - g2) / delta + 4;
12163
+ let h2;
12164
+ if (delta == 0) {
12165
+ h2 = 0;
12166
+ } else if (cmax == r2) {
12167
+ h2 = (g2 - b2) / delta % 6;
12168
+ } else if (cmax == g2) {
12169
+ h2 = (b2 - r2) / delta + 2;
12170
+ } else {
12171
+ h2 = (r2 - g2) / delta + 4;
12172
+ }
12137
12173
  h2 = Math.round(h2 * 60);
12138
- if (h2 < 0) h2 += 360;
12139
- l2 = (cmax + cmin) / 2;
12140
- s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l2 - 1));
12174
+ if (h2 < 0) {
12175
+ h2 += 360;
12176
+ }
12177
+ let l2 = (cmax + cmin) / 2;
12178
+ let s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l2 - 1));
12141
12179
  s = +(s * 100).toFixed(1);
12142
12180
  l2 = +(l2 * 100).toFixed(1);
12143
12181
  return { h: h2, s, l: l2 };
@@ -12602,7 +12640,7 @@ var reducer = (state, action) => {
12602
12640
  // src/context/EmbedProvider.tsx
12603
12641
  var import_jsx_runtime2 = require("react/jsx-runtime");
12604
12642
  var getCustomHeaders = (sessionId) => ({
12605
- "X-Schematic-Components-Version": "2.9.0-rc.1",
12643
+ "X-Schematic-Components-Version": "2.9.0-rc.2",
12606
12644
  "X-Schematic-Session-ID": sessionId
12607
12645
  });
12608
12646
  var EmbedProvider = ({
@@ -13043,7 +13081,11 @@ function useAvailableCurrencies() {
13043
13081
  currencySet.add(cp.currency.toUpperCase());
13044
13082
  }
13045
13083
  }
13046
- return Array.from(currencySet).sort();
13084
+ return Array.from(currencySet).sort((a2, b2) => {
13085
+ if (a2 === DEFAULT_CURRENCY) return -1;
13086
+ if (b2 === DEFAULT_CURRENCY) return 1;
13087
+ return a2.localeCompare(b2);
13088
+ });
13047
13089
  }, [data?.activePlans, data?.activeAddOns]);
13048
13090
  }
13049
13091
  function useSubscriptionCurrency() {
@@ -19585,7 +19627,6 @@ var UsageDetails = ({ entitlement, layout }) => {
19585
19627
  })
19586
19628
  ] }, index)
19587
19629
  );
19588
- index += 1;
19589
19630
  }
19590
19631
  if (acc.length > 0) {
19591
19632
  return acc;
@@ -20848,7 +20889,7 @@ function _typeof(obj) {
20848
20889
  }
20849
20890
  return _typeof(obj);
20850
20891
  }
20851
- var RELEASE_TRAIN = "clover";
20892
+ var RELEASE_TRAIN = "dahlia";
20852
20893
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
20853
20894
  return version === 3 ? "v3" : version;
20854
20895
  };
@@ -20888,7 +20929,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
20888
20929
  }
20889
20930
  stripe._registerWrapper({
20890
20931
  name: "stripe-js",
20891
- version: "8.11.0",
20932
+ version: "9.0.1",
20892
20933
  startTime
20893
20934
  });
20894
20935
  };
@@ -20966,7 +21007,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
20966
21007
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
20967
21008
  var expectedVersion = RELEASE_TRAIN;
20968
21009
  if (isTestKey && version !== expectedVersion) {
20969
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.11.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
21010
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.0.1", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
20970
21011
  }
20971
21012
  var stripe = maybeStripe.apply(void 0, args);
20972
21013
  registerWrapper(stripe, startTime);
@@ -21357,6 +21398,7 @@ var import_jsx_runtime51 = require("react/jsx-runtime");
21357
21398
  var UsageDetails2 = ({
21358
21399
  entitlement,
21359
21400
  period,
21401
+ currency,
21360
21402
  showCredits,
21361
21403
  layout
21362
21404
  }) => {
@@ -21367,8 +21409,8 @@ var UsageDetails2 = ({
21367
21409
  limit,
21368
21410
  cost = 0
21369
21411
  } = (0, import_react52.useMemo)(
21370
- () => getUsageDetails(entitlement, period),
21371
- [entitlement, period]
21412
+ () => getUsageDetails(entitlement, period, currency),
21413
+ [entitlement, period, currency]
21372
21414
  );
21373
21415
  const description = (0, import_react52.useMemo)(() => {
21374
21416
  const acc = [];
@@ -21384,7 +21426,7 @@ var UsageDetails2 = ({
21384
21426
  acc.push(/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react52.Fragment, { children: t2("Tier-based") }, index));
21385
21427
  index += 1;
21386
21428
  }
21387
- const { price } = getEntitlementPrice(entitlement, period) || {};
21429
+ const { price } = getEntitlementPrice(entitlement, period, currency) || {};
21388
21430
  if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
21389
21431
  const packageSize = billingPrice?.packageSize ?? 1;
21390
21432
  acc.push(
@@ -21421,12 +21463,12 @@ var UsageDetails2 = ({
21421
21463
  t2("use")
21422
21464
  ] }, index)
21423
21465
  );
21424
- index += 1;
21425
21466
  }
21426
21467
  return acc;
21427
21468
  }, [
21428
21469
  t2,
21429
21470
  period,
21471
+ currency,
21430
21472
  showCredits,
21431
21473
  entitlement,
21432
21474
  billingPrice?.packageSize,
@@ -21496,6 +21538,7 @@ var UsageDetails2 = ({
21496
21538
  var import_jsx_runtime52 = require("react/jsx-runtime");
21497
21539
  var resolveDesignProps7 = (props) => {
21498
21540
  return {
21541
+ showCurrencySelector: props.showCurrencySelector ?? false,
21499
21542
  header: {
21500
21543
  isVisible: props.header?.isVisible ?? true,
21501
21544
  title: {
@@ -21770,6 +21813,7 @@ var PlanManager = (0, import_react53.forwardRef)(({ children, className, portal,
21770
21813
  {
21771
21814
  entitlement,
21772
21815
  period: currentPlan?.planPeriod || "month",
21816
+ currency: subscriptionCurrency,
21773
21817
  showCredits,
21774
21818
  layout: props
21775
21819
  },
@@ -22277,6 +22321,7 @@ var Entitlement2 = ({
22277
22321
  entitlement,
22278
22322
  sharedProps,
22279
22323
  selectedPeriod = BillingProductPriceInterval.Month,
22324
+ currency,
22280
22325
  credits = [],
22281
22326
  showCredits = true
22282
22327
  }) => {
@@ -22286,7 +22331,8 @@ var Entitlement2 = ({
22286
22331
  const isLightBackground = useIsLightBackground();
22287
22332
  const entitlementBillingPrice = getEntitlementPrice(
22288
22333
  entitlement,
22289
- selectedPeriod
22334
+ selectedPeriod,
22335
+ currency
22290
22336
  );
22291
22337
  const {
22292
22338
  price: entitlementPrice,
@@ -22623,6 +22669,7 @@ var Plan2 = ({
22623
22669
  entitlement,
22624
22670
  credits,
22625
22671
  selectedPeriod,
22672
+ currency,
22626
22673
  showCredits,
22627
22674
  sharedProps: { layout }
22628
22675
  },
@@ -871,6 +871,12 @@ declare interface BillingPlanCreditGrantResponseData {
871
871
  * @memberof BillingPlanCreditGrantResponseData
872
872
  */
873
873
  autoTopupExpiryUnitCount?: number | null;
874
+ /**
875
+ *
876
+ * @type {number}
877
+ * @memberof BillingPlanCreditGrantResponseData
878
+ */
879
+ autoTopupThresholdCredits?: number | null;
874
880
  /**
875
881
  *
876
882
  * @type {number}
@@ -3546,10 +3552,10 @@ declare interface CompanyPlanDetailResponseData {
3546
3552
  features: Array<FeatureDetailResponseData>;
3547
3553
  /**
3548
3554
  *
3549
- * @type {string}
3555
+ * @type {PlanIcon}
3550
3556
  * @memberof CompanyPlanDetailResponseData
3551
3557
  */
3552
- icon: string;
3558
+ icon: PlanIcon;
3553
3559
  /**
3554
3560
  *
3555
3561
  * @type {string}
@@ -5261,6 +5267,7 @@ declare interface DesignProps_5 {
5261
5267
  }
5262
5268
 
5263
5269
  declare interface DesignProps_6 {
5270
+ showCurrencySelector: boolean;
5264
5271
  header: {
5265
5272
  isVisible: boolean;
5266
5273
  title: {
@@ -7696,6 +7703,12 @@ declare interface PlanCreditGrantView {
7696
7703
  * @memberof PlanCreditGrantView
7697
7704
  */
7698
7705
  billingCreditAutoTopupExpiryUnitCount?: number | null;
7706
+ /**
7707
+ *
7708
+ * @type {number}
7709
+ * @memberof PlanCreditGrantView
7710
+ */
7711
+ billingCreditAutoTopupThresholdCredits?: number | null;
7699
7712
  /**
7700
7713
  *
7701
7714
  * @type {number}
@@ -7871,6 +7884,12 @@ declare interface PlanCreditGrantView_2 {
7871
7884
  * @memberof PlanCreditGrantView
7872
7885
  */
7873
7886
  billingCreditAutoTopupExpiryUnitCount?: number | null;
7887
+ /**
7888
+ *
7889
+ * @type {number}
7890
+ * @memberof PlanCreditGrantView
7891
+ */
7892
+ billingCreditAutoTopupThresholdCredits?: number | null;
7874
7893
  /**
7875
7894
  *
7876
7895
  * @type {number}
@@ -8143,10 +8162,10 @@ declare interface PlanDetailResponseData {
8143
8162
  features: Array<FeatureDetailResponseData>;
8144
8163
  /**
8145
8164
  *
8146
- * @type {string}
8165
+ * @type {PlanIcon}
8147
8166
  * @memberof PlanDetailResponseData
8148
8167
  */
8149
- icon: string;
8168
+ icon: PlanIcon;
8150
8169
  /**
8151
8170
  *
8152
8171
  * @type {string}
@@ -8556,6 +8575,74 @@ declare interface PlanEntitlementResponseData_2 {
8556
8575
  valueType: EntitlementValueType_2;
8557
8576
  }
8558
8577
 
8578
+ /**
8579
+ *
8580
+ * @export
8581
+ */
8582
+ declare const PlanIcon: {
8583
+ readonly Amber: "amber";
8584
+ readonly Blue: "blue";
8585
+ readonly BlueGray: "blueGray";
8586
+ readonly BlueGreen: "blueGreen";
8587
+ readonly Cyan: "cyan";
8588
+ readonly Emerald: "emerald";
8589
+ readonly Fuchsia: "fuchsia";
8590
+ readonly Gray: "gray";
8591
+ readonly Green: "green";
8592
+ readonly Indigo: "indigo";
8593
+ readonly LightBlue: "lightBlue";
8594
+ readonly Lime: "lime";
8595
+ readonly Orange: "orange";
8596
+ readonly Pink: "pink";
8597
+ readonly Purple: "purple";
8598
+ readonly Red: "red";
8599
+ readonly RedOrange: "redOrange";
8600
+ readonly Rose: "rose";
8601
+ readonly Sky: "sky";
8602
+ readonly Slate: "slate";
8603
+ readonly Teal: "teal";
8604
+ readonly TrueGray: "trueGray";
8605
+ readonly Violet: "violet";
8606
+ readonly WarmGray: "warmGray";
8607
+ readonly Yellow: "yellow";
8608
+ };
8609
+
8610
+ declare type PlanIcon = (typeof PlanIcon)[keyof typeof PlanIcon];
8611
+
8612
+ /**
8613
+ *
8614
+ * @export
8615
+ */
8616
+ declare const PlanIcon_2: {
8617
+ readonly Amber: "amber";
8618
+ readonly Blue: "blue";
8619
+ readonly BlueGray: "blueGray";
8620
+ readonly BlueGreen: "blueGreen";
8621
+ readonly Cyan: "cyan";
8622
+ readonly Emerald: "emerald";
8623
+ readonly Fuchsia: "fuchsia";
8624
+ readonly Gray: "gray";
8625
+ readonly Green: "green";
8626
+ readonly Indigo: "indigo";
8627
+ readonly LightBlue: "lightBlue";
8628
+ readonly Lime: "lime";
8629
+ readonly Orange: "orange";
8630
+ readonly Pink: "pink";
8631
+ readonly Purple: "purple";
8632
+ readonly Red: "red";
8633
+ readonly RedOrange: "redOrange";
8634
+ readonly Rose: "rose";
8635
+ readonly Sky: "sky";
8636
+ readonly Slate: "slate";
8637
+ readonly Teal: "teal";
8638
+ readonly TrueGray: "trueGray";
8639
+ readonly Violet: "violet";
8640
+ readonly WarmGray: "warmGray";
8641
+ readonly Yellow: "yellow";
8642
+ };
8643
+
8644
+ declare type PlanIcon_2 = (typeof PlanIcon_2)[keyof typeof PlanIcon_2];
8645
+
8559
8646
  export declare const PlanManager: ForwardRefExoticComponent<ElementProps & DeepPartial<DesignProps_6> & HTMLAttributes<HTMLDivElement> & {
8560
8647
  portal?: HTMLElement | null;
8561
8648
  } & RefAttributes<HTMLDivElement | null>>;
@@ -8604,10 +8691,10 @@ declare interface PlanResponseData {
8604
8691
  description: string;
8605
8692
  /**
8606
8693
  *
8607
- * @type {string}
8694
+ * @type {PlanIcon}
8608
8695
  * @memberof PlanResponseData
8609
8696
  */
8610
- icon: string;
8697
+ icon: PlanIcon;
8611
8698
  /**
8612
8699
  *
8613
8700
  * @type {string}
@@ -8661,10 +8748,10 @@ declare interface PlanResponseData_2 {
8661
8748
  description: string;
8662
8749
  /**
8663
8750
  *
8664
- * @type {string}
8751
+ * @type {PlanIcon}
8665
8752
  * @memberof PlanResponseData
8666
8753
  */
8667
- icon: string;
8754
+ icon: PlanIcon_2;
8668
8755
  /**
8669
8756
  *
8670
8757
  * @type {string}
@@ -8739,10 +8826,10 @@ declare interface PlanVersionResponseData {
8739
8826
  environmentId: string;
8740
8827
  /**
8741
8828
  *
8742
- * @type {string}
8829
+ * @type {PlanIcon}
8743
8830
  * @memberof PlanVersionResponseData
8744
8831
  */
8745
- icon: string;
8832
+ icon: PlanIcon;
8746
8833
  /**
8747
8834
  *
8748
8835
  * @type {string}
@@ -8813,10 +8900,10 @@ declare interface PlanVersionResponseData_2 {
8813
8900
  environmentId: string;
8814
8901
  /**
8815
8902
  *
8816
- * @type {string}
8903
+ * @type {PlanIcon}
8817
8904
  * @memberof PlanVersionResponseData
8818
8905
  */
8819
- icon: string;
8906
+ icon: PlanIcon_2;
8820
8907
  /**
8821
8908
  *
8822
8909
  * @type {string}
@@ -8984,10 +9071,10 @@ declare interface PlanViewPublicResponseData {
8984
9071
  features: Array<FeatureDetailResponseData_2>;
8985
9072
  /**
8986
9073
  *
8987
- * @type {string}
9074
+ * @type {PlanIcon}
8988
9075
  * @memberof PlanViewPublicResponseData
8989
9076
  */
8990
- icon: string;
9077
+ icon: PlanIcon_2;
8991
9078
  /**
8992
9079
  *
8993
9080
  * @type {string}
@@ -6806,6 +6806,7 @@ var Configuration = class {
6806
6806
  constructor(configuration = {}) {
6807
6807
  this.configuration = configuration;
6808
6808
  }
6809
+ configuration;
6809
6810
  set config(configuration) {
6810
6811
  this.configuration = configuration;
6811
6812
  }
@@ -6854,6 +6855,7 @@ var BaseAPI = class _BaseAPI {
6854
6855
  this.configuration = configuration;
6855
6856
  this.middleware = configuration.middleware;
6856
6857
  }
6858
+ configuration;
6857
6859
  static jsonRegex = new RegExp(
6858
6860
  "^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$",
6859
6861
  "i"
@@ -7010,6 +7012,7 @@ var ResponseError = class extends Error {
7010
7012
  super(msg);
7011
7013
  this.response = response;
7012
7014
  }
7015
+ response;
7013
7016
  name = "ResponseError";
7014
7017
  };
7015
7018
  var FetchError = class extends Error {
@@ -7017,6 +7020,7 @@ var FetchError = class extends Error {
7017
7020
  super(msg);
7018
7021
  this.cause = cause;
7019
7022
  }
7023
+ cause;
7020
7024
  name = "FetchError";
7021
7025
  };
7022
7026
  var RequiredError = class extends Error {
@@ -7024,6 +7028,7 @@ var RequiredError = class extends Error {
7024
7028
  super(msg);
7025
7029
  this.field = field;
7026
7030
  }
7031
+ field;
7027
7032
  name = "RequiredError";
7028
7033
  };
7029
7034
  function querystring(params, prefix2 = "") {
@@ -7052,6 +7057,8 @@ var JSONApiResponse = class {
7052
7057
  this.raw = raw;
7053
7058
  this.transformer = transformer;
7054
7059
  }
7060
+ raw;
7061
+ transformer;
7055
7062
  async value() {
7056
7063
  return this.transformer(await this.raw.json());
7057
7064
  }
@@ -7495,6 +7502,7 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
7495
7502
  autoTopupExpiryType: json["auto_topup_expiry_type"] == null ? void 0 : BillingCreditExpiryTypeFromJSON(json["auto_topup_expiry_type"]),
7496
7503
  autoTopupExpiryUnit: json["auto_topup_expiry_unit"] == null ? void 0 : BillingCreditExpiryUnitFromJSON(json["auto_topup_expiry_unit"]),
7497
7504
  autoTopupExpiryUnitCount: json["auto_topup_expiry_unit_count"] == null ? void 0 : json["auto_topup_expiry_unit_count"],
7505
+ autoTopupThresholdCredits: json["auto_topup_threshold_credits"] == null ? void 0 : json["auto_topup_threshold_credits"],
7498
7506
  autoTopupThresholdPercent: json["auto_topup_threshold_percent"] == null ? void 0 : json["auto_topup_threshold_percent"],
7499
7507
  createdAt: new Date(json["created_at"]),
7500
7508
  credit: json["credit"] == null ? void 0 : BillingCreditResponseDataFromJSON(json["credit"]),
@@ -7982,6 +7990,7 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
7982
7990
  json["billing_credit_auto_topup_expiry_unit"]
7983
7991
  ),
7984
7992
  billingCreditAutoTopupExpiryUnitCount: json["billing_credit_auto_topup_expiry_unit_count"] == null ? void 0 : json["billing_credit_auto_topup_expiry_unit_count"],
7993
+ billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
7985
7994
  billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
7986
7995
  createdAt: new Date(json["created_at"]),
7987
7996
  credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON(json["credit"]),
@@ -8642,6 +8651,14 @@ function EntitlementPriceBehaviorFromJSONTyped(json, ignoreDiscriminator) {
8642
8651
  return json;
8643
8652
  }
8644
8653
 
8654
+ // src/api/checkoutexternal/models/PlanIcon.ts
8655
+ function PlanIconFromJSON(json) {
8656
+ return PlanIconFromJSONTyped(json, false);
8657
+ }
8658
+ function PlanIconFromJSONTyped(json, ignoreDiscriminator) {
8659
+ return json;
8660
+ }
8661
+
8645
8662
  // src/api/checkoutexternal/models/PlanType.ts
8646
8663
  function PlanTypeFromJSON(json) {
8647
8664
  return PlanTypeFromJSONTyped(json, false);
@@ -8662,7 +8679,7 @@ function PlanResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8662
8679
  audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
8663
8680
  createdAt: new Date(json["created_at"]),
8664
8681
  description: json["description"],
8665
- icon: json["icon"],
8682
+ icon: PlanIconFromJSON(json["icon"]),
8666
8683
  id: json["id"],
8667
8684
  name: json["name"],
8668
8685
  planType: PlanTypeFromJSON(json["plan_type"]),
@@ -8761,7 +8778,7 @@ function PlanVersionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8761
8778
  createdAt: new Date(json["created_at"]),
8762
8779
  description: json["description"],
8763
8780
  environmentId: json["environment_id"],
8764
- icon: json["icon"],
8781
+ icon: PlanIconFromJSON(json["icon"]),
8765
8782
  id: json["id"],
8766
8783
  name: json["name"],
8767
8784
  originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
@@ -8892,7 +8909,7 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8892
8909
  features: json["features"].map(
8893
8910
  FeatureDetailResponseDataFromJSON
8894
8911
  ),
8895
- icon: json["icon"],
8912
+ icon: PlanIconFromJSON(json["icon"]),
8896
8913
  id: json["id"],
8897
8914
  includedCreditGrants: json["included_credit_grants"].map(
8898
8915
  PlanCreditGrantViewFromJSON
@@ -9043,7 +9060,7 @@ function PlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
9043
9060
  features: json["features"].map(
9044
9061
  FeatureDetailResponseDataFromJSON
9045
9062
  ),
9046
- icon: json["icon"],
9063
+ icon: PlanIconFromJSON(json["icon"]),
9047
9064
  id: json["id"],
9048
9065
  includedCreditGrants: json["included_credit_grants"] == null ? void 0 : json["included_credit_grants"].map(
9049
9066
  BillingPlanCreditGrantResponseDataFromJSON
@@ -9997,6 +10014,7 @@ var Configuration2 = class {
9997
10014
  constructor(configuration = {}) {
9998
10015
  this.configuration = configuration;
9999
10016
  }
10017
+ configuration;
10000
10018
  set config(configuration) {
10001
10019
  this.configuration = configuration;
10002
10020
  }
@@ -10045,6 +10063,7 @@ var BaseAPI2 = class _BaseAPI {
10045
10063
  this.configuration = configuration;
10046
10064
  this.middleware = configuration.middleware;
10047
10065
  }
10066
+ configuration;
10048
10067
  static jsonRegex = new RegExp(
10049
10068
  "^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$",
10050
10069
  "i"
@@ -10201,6 +10220,7 @@ var ResponseError2 = class extends Error {
10201
10220
  super(msg);
10202
10221
  this.response = response;
10203
10222
  }
10223
+ response;
10204
10224
  name = "ResponseError";
10205
10225
  };
10206
10226
  var FetchError2 = class extends Error {
@@ -10208,6 +10228,7 @@ var FetchError2 = class extends Error {
10208
10228
  super(msg);
10209
10229
  this.cause = cause;
10210
10230
  }
10231
+ cause;
10211
10232
  name = "FetchError";
10212
10233
  };
10213
10234
  function querystring2(params, prefix2 = "") {
@@ -10236,6 +10257,8 @@ var JSONApiResponse2 = class {
10236
10257
  this.raw = raw;
10237
10258
  this.transformer = transformer;
10238
10259
  }
10260
+ raw;
10261
+ transformer;
10239
10262
  async value() {
10240
10263
  return this.transformer(await this.raw.json());
10241
10264
  }
@@ -10960,6 +10983,7 @@ function PlanCreditGrantViewFromJSONTyped4(json, ignoreDiscriminator) {
10960
10983
  json["billing_credit_auto_topup_expiry_unit"]
10961
10984
  ),
10962
10985
  billingCreditAutoTopupExpiryUnitCount: json["billing_credit_auto_topup_expiry_unit_count"] == null ? void 0 : json["billing_credit_auto_topup_expiry_unit_count"],
10986
+ billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
10963
10987
  billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
10964
10988
  createdAt: new Date(json["created_at"]),
10965
10989
  credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON2(json["credit"]),
@@ -11000,6 +11024,14 @@ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator)
11000
11024
  };
11001
11025
  }
11002
11026
 
11027
+ // src/api/componentspublic/models/PlanIcon.ts
11028
+ function PlanIconFromJSON2(json) {
11029
+ return PlanIconFromJSONTyped7(json, false);
11030
+ }
11031
+ function PlanIconFromJSONTyped7(json, ignoreDiscriminator) {
11032
+ return json;
11033
+ }
11034
+
11003
11035
  // src/api/componentspublic/models/PlanType.ts
11004
11036
  function PlanTypeFromJSON2(json) {
11005
11037
  return PlanTypeFromJSONTyped7(json, false);
@@ -11020,7 +11052,7 @@ function PlanResponseDataFromJSONTyped4(json, ignoreDiscriminator) {
11020
11052
  audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
11021
11053
  createdAt: new Date(json["created_at"]),
11022
11054
  description: json["description"],
11023
- icon: json["icon"],
11055
+ icon: PlanIconFromJSON2(json["icon"]),
11024
11056
  id: json["id"],
11025
11057
  name: json["name"],
11026
11058
  planType: PlanTypeFromJSON2(json["plan_type"]),
@@ -11088,7 +11120,7 @@ function PlanVersionResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
11088
11120
  createdAt: new Date(json["created_at"]),
11089
11121
  description: json["description"],
11090
11122
  environmentId: json["environment_id"],
11091
- icon: json["icon"],
11123
+ icon: PlanIconFromJSON2(json["icon"]),
11092
11124
  id: json["id"],
11093
11125
  name: json["name"],
11094
11126
  originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
@@ -11129,7 +11161,7 @@ function PlanViewPublicResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11129
11161
  features: json["features"].map(
11130
11162
  FeatureDetailResponseDataFromJSON2
11131
11163
  ),
11132
- icon: json["icon"],
11164
+ icon: PlanIconFromJSON2(json["icon"]),
11133
11165
  id: json["id"],
11134
11166
  includedCreditGrants: json["included_credit_grants"].map(
11135
11167
  PlanCreditGrantViewFromJSON2
@@ -11273,8 +11305,9 @@ function getAddOnPrice(addOn, period = "month", currency) {
11273
11305
  }
11274
11306
  }
11275
11307
  function getEntitlementPrice(entitlement, period = "month", currency) {
11276
- if (currency && "valueType" in entitlement && entitlement.currencyPrices?.length) {
11277
- const currencyPrice = entitlement.currencyPrices.find(
11308
+ const currencyPrices = "valueType" in entitlement ? entitlement.currencyPrices : "entitlementType" in entitlement ? entitlement.planEntitlement?.currencyPrices : void 0;
11309
+ if (currency && currencyPrices?.length) {
11310
+ const currencyPrice = currencyPrices.find(
11278
11311
  (cp) => cp.currency.toLowerCase() === currency.toLowerCase()
11279
11312
  );
11280
11313
  if (currencyPrice) {
@@ -11343,8 +11376,8 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
11343
11376
  }
11344
11377
  return cost;
11345
11378
  }
11346
- function getEntitlementCost(entitlement, period = "month") {
11347
- const source = period === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice;
11379
+ function getEntitlementCost(entitlement, period = "month", currency) {
11380
+ const source = currency ? getEntitlementPrice(entitlement, period ?? "month", currency) : period === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice;
11348
11381
  if (source) {
11349
11382
  const billingPrice = { ...source };
11350
11383
  if (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && typeof entitlement.allocation === "number" && entitlement.allocation > 0) {
@@ -11547,8 +11580,8 @@ function getMetricPeriodName(entitlement) {
11547
11580
  const name = period ? PeriodName[period] : void 0;
11548
11581
  return name;
11549
11582
  }
11550
- function getUsageDetails(entitlement, period) {
11551
- const billingPrice = period === "year" ? entitlement.yearlyUsageBasedPrice : period === "month" ? entitlement.monthlyUsageBasedPrice : void 0;
11583
+ function getUsageDetails(entitlement, period, currency) {
11584
+ const billingPrice = currency ? getEntitlementPrice(entitlement, period ?? "month", currency) : period === "year" ? entitlement.yearlyUsageBasedPrice : period === "month" ? entitlement.monthlyUsageBasedPrice : void 0;
11552
11585
  let limit;
11553
11586
  if ((!entitlement.priceBehavior || entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance) && typeof entitlement.allocation === "number") {
11554
11587
  limit = entitlement.allocation;
@@ -11567,7 +11600,7 @@ function getUsageDetails(entitlement, period) {
11567
11600
  } else if (entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof entitlement.creditUsed === "number" && typeof entitlement.creditConsumptionRate === "number") {
11568
11601
  amount = entitlement.creditUsed / entitlement.creditConsumptionRate;
11569
11602
  }
11570
- const cost = getEntitlementCost(entitlement, period);
11603
+ const cost = getEntitlementCost(entitlement, period, currency);
11571
11604
  const tiers = billingPrice?.priceTier || [];
11572
11605
  let currentTier;
11573
11606
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlement.softLimit === "number") {
@@ -12043,17 +12076,22 @@ function hexToHSL(color) {
12043
12076
  const cmin = Math.min(r2, g2, b2);
12044
12077
  const cmax = Math.max(r2, g2, b2);
12045
12078
  const delta = cmax - cmin;
12046
- let h2 = 0;
12047
- let s = 0;
12048
- let l2 = 0;
12049
- if (delta == 0) h2 = 0;
12050
- else if (cmax == r2) h2 = (g2 - b2) / delta % 6;
12051
- else if (cmax == g2) h2 = (b2 - r2) / delta + 2;
12052
- else h2 = (r2 - g2) / delta + 4;
12079
+ let h2;
12080
+ if (delta == 0) {
12081
+ h2 = 0;
12082
+ } else if (cmax == r2) {
12083
+ h2 = (g2 - b2) / delta % 6;
12084
+ } else if (cmax == g2) {
12085
+ h2 = (b2 - r2) / delta + 2;
12086
+ } else {
12087
+ h2 = (r2 - g2) / delta + 4;
12088
+ }
12053
12089
  h2 = Math.round(h2 * 60);
12054
- if (h2 < 0) h2 += 360;
12055
- l2 = (cmax + cmin) / 2;
12056
- s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l2 - 1));
12090
+ if (h2 < 0) {
12091
+ h2 += 360;
12092
+ }
12093
+ let l2 = (cmax + cmin) / 2;
12094
+ let s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l2 - 1));
12057
12095
  s = +(s * 100).toFixed(1);
12058
12096
  l2 = +(l2 * 100).toFixed(1);
12059
12097
  return { h: h2, s, l: l2 };
@@ -12518,7 +12556,7 @@ var reducer = (state, action) => {
12518
12556
  // src/context/EmbedProvider.tsx
12519
12557
  import { jsx, jsxs } from "react/jsx-runtime";
12520
12558
  var getCustomHeaders = (sessionId) => ({
12521
- "X-Schematic-Components-Version": "2.9.0-rc.1",
12559
+ "X-Schematic-Components-Version": "2.9.0-rc.2",
12522
12560
  "X-Schematic-Session-ID": sessionId
12523
12561
  });
12524
12562
  var EmbedProvider = ({
@@ -12959,7 +12997,11 @@ function useAvailableCurrencies() {
12959
12997
  currencySet.add(cp.currency.toUpperCase());
12960
12998
  }
12961
12999
  }
12962
- return Array.from(currencySet).sort();
13000
+ return Array.from(currencySet).sort((a2, b2) => {
13001
+ if (a2 === DEFAULT_CURRENCY) return -1;
13002
+ if (b2 === DEFAULT_CURRENCY) return 1;
13003
+ return a2.localeCompare(b2);
13004
+ });
12963
13005
  }, [data?.activePlans, data?.activeAddOns]);
12964
13006
  }
12965
13007
  function useSubscriptionCurrency() {
@@ -19532,7 +19574,6 @@ var UsageDetails = ({ entitlement, layout }) => {
19532
19574
  })
19533
19575
  ] }, index)
19534
19576
  );
19535
- index += 1;
19536
19577
  }
19537
19578
  if (acc.length > 0) {
19538
19579
  return acc;
@@ -20795,7 +20836,7 @@ function _typeof(obj) {
20795
20836
  }
20796
20837
  return _typeof(obj);
20797
20838
  }
20798
- var RELEASE_TRAIN = "clover";
20839
+ var RELEASE_TRAIN = "dahlia";
20799
20840
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
20800
20841
  return version === 3 ? "v3" : version;
20801
20842
  };
@@ -20835,7 +20876,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
20835
20876
  }
20836
20877
  stripe._registerWrapper({
20837
20878
  name: "stripe-js",
20838
- version: "8.11.0",
20879
+ version: "9.0.1",
20839
20880
  startTime
20840
20881
  });
20841
20882
  };
@@ -20913,7 +20954,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
20913
20954
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
20914
20955
  var expectedVersion = RELEASE_TRAIN;
20915
20956
  if (isTestKey && version !== expectedVersion) {
20916
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.11.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
20957
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.0.1", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
20917
20958
  }
20918
20959
  var stripe = maybeStripe.apply(void 0, args);
20919
20960
  registerWrapper(stripe, startTime);
@@ -21304,6 +21345,7 @@ import { Fragment as Fragment21, jsx as jsx50, jsxs as jsxs37 } from "react/jsx-
21304
21345
  var UsageDetails2 = ({
21305
21346
  entitlement,
21306
21347
  period,
21348
+ currency,
21307
21349
  showCredits,
21308
21350
  layout
21309
21351
  }) => {
@@ -21314,8 +21356,8 @@ var UsageDetails2 = ({
21314
21356
  limit,
21315
21357
  cost = 0
21316
21358
  } = useMemo23(
21317
- () => getUsageDetails(entitlement, period),
21318
- [entitlement, period]
21359
+ () => getUsageDetails(entitlement, period, currency),
21360
+ [entitlement, period, currency]
21319
21361
  );
21320
21362
  const description = useMemo23(() => {
21321
21363
  const acc = [];
@@ -21331,7 +21373,7 @@ var UsageDetails2 = ({
21331
21373
  acc.push(/* @__PURE__ */ jsx50(Fragment20, { children: t2("Tier-based") }, index));
21332
21374
  index += 1;
21333
21375
  }
21334
- const { price } = getEntitlementPrice(entitlement, period) || {};
21376
+ const { price } = getEntitlementPrice(entitlement, period, currency) || {};
21335
21377
  if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
21336
21378
  const packageSize = billingPrice?.packageSize ?? 1;
21337
21379
  acc.push(
@@ -21368,12 +21410,12 @@ var UsageDetails2 = ({
21368
21410
  t2("use")
21369
21411
  ] }, index)
21370
21412
  );
21371
- index += 1;
21372
21413
  }
21373
21414
  return acc;
21374
21415
  }, [
21375
21416
  t2,
21376
21417
  period,
21418
+ currency,
21377
21419
  showCredits,
21378
21420
  entitlement,
21379
21421
  billingPrice?.packageSize,
@@ -21443,6 +21485,7 @@ var UsageDetails2 = ({
21443
21485
  import { Fragment as Fragment22, jsx as jsx51, jsxs as jsxs38 } from "react/jsx-runtime";
21444
21486
  var resolveDesignProps7 = (props) => {
21445
21487
  return {
21488
+ showCurrencySelector: props.showCurrencySelector ?? false,
21446
21489
  header: {
21447
21490
  isVisible: props.header?.isVisible ?? true,
21448
21491
  title: {
@@ -21717,6 +21760,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
21717
21760
  {
21718
21761
  entitlement,
21719
21762
  period: currentPlan?.planPeriod || "month",
21763
+ currency: subscriptionCurrency,
21720
21764
  showCredits,
21721
21765
  layout: props
21722
21766
  },
@@ -22230,6 +22274,7 @@ var Entitlement2 = ({
22230
22274
  entitlement,
22231
22275
  sharedProps,
22232
22276
  selectedPeriod = BillingProductPriceInterval.Month,
22277
+ currency,
22233
22278
  credits = [],
22234
22279
  showCredits = true
22235
22280
  }) => {
@@ -22239,7 +22284,8 @@ var Entitlement2 = ({
22239
22284
  const isLightBackground = useIsLightBackground();
22240
22285
  const entitlementBillingPrice = getEntitlementPrice(
22241
22286
  entitlement,
22242
- selectedPeriod
22287
+ selectedPeriod,
22288
+ currency
22243
22289
  );
22244
22290
  const {
22245
22291
  price: entitlementPrice,
@@ -22576,6 +22622,7 @@ var Plan2 = ({
22576
22622
  entitlement,
22577
22623
  credits,
22578
22624
  selectedPeriod,
22625
+ currency,
22579
22626
  showCredits,
22580
22627
  sharedProps: { layout }
22581
22628
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematichq/schematic-components",
3
- "version": "2.9.0-rc.1",
3
+ "version": "2.9.0-rc.2",
4
4
  "main": "dist/schematic-components.cjs.js",
5
5
  "module": "dist/schematic-components.esm.js",
6
6
  "types": "dist/schematic-components.d.ts",
@@ -34,21 +34,21 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@schematichq/schematic-icons": "^0.5.2",
37
- "@stripe/stripe-js": "^8.11.0",
38
- "i18next": "^26.0.2",
39
- "lodash": "^4.17.23",
37
+ "@stripe/stripe-js": "^9.0.1",
38
+ "i18next": "^26.0.3",
39
+ "lodash": "^4.18.1",
40
40
  "pako": "^2.1.0",
41
41
  "react-i18next": "16.1.6",
42
42
  "styled-components": "^6.3.12",
43
43
  "uuid": "^13.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@eslint/js": "^9.39.3",
46
+ "@eslint/js": "^10.0.1",
47
47
  "@eslint/json": "^1.2.0",
48
48
  "@eslint/markdown": "^8.0.1",
49
- "@microsoft/api-extractor": "^7.57.7",
49
+ "@microsoft/api-extractor": "^7.58.0",
50
50
  "@openapitools/openapi-generator-cli": "^2.31.0",
51
- "@stripe/react-stripe-js": "^5.6.1",
51
+ "@stripe/react-stripe-js": "^6.1.0",
52
52
  "@swc/core": "^1.15.21",
53
53
  "@testing-library/dom": "^10.4.1",
54
54
  "@testing-library/jest-dom": "^6.9.1",
@@ -57,11 +57,11 @@
57
57
  "@types/pako": "^2.0.4",
58
58
  "@types/react": "^19.2.14",
59
59
  "@types/react-dom": "^19.2.3",
60
- "@vitest/browser": "^4.0.18",
61
- "esbuild": "^0.27.4",
62
- "eslint": "^9.39.3",
60
+ "@vitest/browser": "^4.1.2",
61
+ "esbuild": "^0.28.0",
62
+ "eslint": "^10.1.0",
63
63
  "eslint-import-resolver-typescript": "^4.4.4",
64
- "eslint-plugin-import": "^2.32.0",
64
+ "eslint-plugin-import-x": "^4.16.2",
65
65
  "eslint-plugin-react": "^7.37.5",
66
66
  "eslint-plugin-react-hooks": "^7.0.1",
67
67
  "globals": "^17.4.0",
@@ -71,9 +71,9 @@
71
71
  "prettier": "^3.8.1",
72
72
  "react": "^19.2.4",
73
73
  "react-dom": "^19.2.4",
74
- "typescript": "^5.9.3",
75
- "typescript-eslint": "^8.57.2",
76
- "vitest": "^4.0.18"
74
+ "typescript": "^6.0.2",
75
+ "typescript-eslint": "^8.58.0",
76
+ "vitest": "^4.1.2"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "@stripe/react-stripe-js": ">=3",