@schematichq/schematic-components 0.4.1 → 0.4.3

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.
@@ -10747,6 +10747,7 @@ function ChangeSubscriptionRequestBodyToJSON(value) {
10747
10747
  add_on_ids: value["addOnIds"].map(
10748
10748
  UpdateAddOnRequestBodyToJSON
10749
10749
  ),
10750
+ coupon_external_id: value["couponExternalId"],
10750
10751
  new_plan_id: value["newPlanId"],
10751
10752
  new_price_id: value["newPriceId"],
10752
10753
  pay_in_advance: value["payInAdvance"].map(
@@ -11206,6 +11207,21 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11206
11207
  };
11207
11208
  }
11208
11209
 
11210
+ // src/api/models/CustomPlanConfig.ts
11211
+ function CustomPlanConfigFromJSON(json) {
11212
+ return CustomPlanConfigFromJSONTyped(json, false);
11213
+ }
11214
+ function CustomPlanConfigFromJSONTyped(json, ignoreDiscriminator) {
11215
+ if (json == null) {
11216
+ return json;
11217
+ }
11218
+ return {
11219
+ ctaText: json["cta_text"],
11220
+ ctaWebSite: json["cta_web_site"],
11221
+ priceText: json["price_text"]
11222
+ };
11223
+ }
11224
+
11209
11225
  // src/api/models/CompanyPlanDetailResponseData.ts
11210
11226
  function CompanyPlanDetailResponseDataFromJSON(json) {
11211
11227
  return CompanyPlanDetailResponseDataFromJSONTyped(json, false);
@@ -11221,6 +11237,8 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11221
11237
  companyCount: json["company_count"],
11222
11238
  createdAt: new Date(json["created_at"]),
11223
11239
  current: json["current"],
11240
+ custom: json["custom"],
11241
+ customPlanConfig: json["custom_plan_config"] == null ? void 0 : CustomPlanConfigFromJSON(json["custom_plan_config"]),
11224
11242
  description: json["description"],
11225
11243
  entitlements: json["entitlements"].map(
11226
11244
  PlanEntitlementResponseDataFromJSON
@@ -11230,6 +11248,7 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11230
11248
  ),
11231
11249
  icon: json["icon"],
11232
11250
  id: json["id"],
11251
+ isCustom: json["is_custom"],
11233
11252
  isDefault: json["is_default"],
11234
11253
  isFree: json["is_free"],
11235
11254
  isTrialable: json["is_trialable"],
@@ -12478,8 +12497,12 @@ function isEditorState(obj) {
12478
12497
  });
12479
12498
  }
12480
12499
  function getEditorState(json) {
12481
- const obj = JSON.parse(json);
12482
- return isEditorState(obj) ? obj : void 0;
12500
+ if (json) {
12501
+ const obj = JSON.parse(json);
12502
+ if (isEditorState(obj)) {
12503
+ return obj;
12504
+ }
12505
+ }
12483
12506
  }
12484
12507
  function parseEditorState(data) {
12485
12508
  const initialMap = {};
@@ -12659,7 +12682,7 @@ var EmbedProvider = ({
12659
12682
  useEffect2(() => {
12660
12683
  if (accessToken) {
12661
12684
  const { headers = {} } = apiConfig ?? {};
12662
- headers["X-Schematic-Components-Version"] = "0.4.1";
12685
+ headers["X-Schematic-Components-Version"] = "0.4.3";
12663
12686
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
12664
12687
  const config = new Configuration({
12665
12688
  ...apiConfig,
@@ -12840,7 +12863,7 @@ function camelToHyphen(str) {
12840
12863
  function formatNumber(num) {
12841
12864
  return new Intl.NumberFormat("en-US").format(num);
12842
12865
  }
12843
- function formatCurrency(amount) {
12866
+ function formatCurrency(amount, currency = "USD") {
12844
12867
  try {
12845
12868
  const dollars = amount / 100;
12846
12869
  const formatValue = (value, symbol) => {
@@ -12848,6 +12871,9 @@ function formatCurrency(amount) {
12848
12871
  if (formatted.endsWith(".0")) {
12849
12872
  formatted = formatted.slice(0, -2);
12850
12873
  }
12874
+ if (currency.toUpperCase() !== "USD") {
12875
+ return `${currency.toUpperCase()}${formatted}${symbol}`;
12876
+ }
12851
12877
  return `$${formatted}${symbol}`;
12852
12878
  };
12853
12879
  if (dollars >= 1e6) {
@@ -12857,14 +12883,14 @@ function formatCurrency(amount) {
12857
12883
  } else {
12858
12884
  return new Intl.NumberFormat("en-US", {
12859
12885
  style: "currency",
12860
- currency: "USD"
12886
+ currency: currency.toUpperCase()
12861
12887
  }).format(dollars);
12862
12888
  }
12863
12889
  } catch (error) {
12864
12890
  console.error("Error formatting currency", error);
12865
12891
  return new Intl.NumberFormat("en-US", {
12866
12892
  style: "currency",
12867
- currency: "USD"
12893
+ currency: currency.toUpperCase()
12868
12894
  }).format(amount / 100);
12869
12895
  }
12870
12896
  }
@@ -13707,6 +13733,7 @@ var ModalHeader = ({
13707
13733
  $padding: "0 1rem",
13708
13734
  $backgroundColor: theme.card.background,
13709
13735
  ...bordered && {
13736
+ $borderWidth: "0",
13710
13737
  $borderBottomWidth: "1px",
13711
13738
  $borderBottomStyle: "solid",
13712
13739
  $borderBottomColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)"
@@ -14397,6 +14424,7 @@ var Sidebar = ({
14397
14424
  }
14398
14425
  let total = 0;
14399
14426
  const planPrice = (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price;
14427
+ const currency = (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency;
14400
14428
  if (planPrice) {
14401
14429
  total += planPrice;
14402
14430
  }
@@ -14410,7 +14438,7 @@ var Sidebar = ({
14410
14438
  0
14411
14439
  );
14412
14440
  total += payInAdvanceCost;
14413
- return formatCurrency(total);
14441
+ return formatCurrency(total, currency);
14414
14442
  }, [selectedPlan, addOns, payInAdvanceEntitlements, planPeriod]);
14415
14443
  const { amountOff, dueNow, newCharges, percentOff, periodStart, proration } = useMemo4(() => {
14416
14444
  return {
@@ -14573,6 +14601,7 @@ var Sidebar = ({
14573
14601
  $gap: "1rem",
14574
14602
  $width: "100%",
14575
14603
  $padding: "1.5rem",
14604
+ $borderWidth: "0",
14576
14605
  $borderBottomWidth: "1px",
14577
14606
  $borderStyle: "solid",
14578
14607
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)",
@@ -14598,6 +14627,7 @@ var Sidebar = ({
14598
14627
  $flexGrow: "1",
14599
14628
  $width: "100%",
14600
14629
  $padding: "1.5rem",
14630
+ $borderWidth: "0",
14601
14631
  $borderBottomWidth: "1px",
14602
14632
  $borderStyle: "solid",
14603
14633
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)",
@@ -14643,7 +14673,10 @@ var Sidebar = ({
14643
14673
  $weight: theme.typography.text.fontWeight,
14644
14674
  $color: theme.typography.text.color,
14645
14675
  children: [
14646
- formatCurrency(data.company.plan.planPrice),
14676
+ formatCurrency(
14677
+ data.company.plan.planPrice,
14678
+ data.company.billingSubscription?.currency
14679
+ ),
14647
14680
  /* @__PURE__ */ jsxs8("sub", { children: [
14648
14681
  "/",
14649
14682
  shortenPeriod(
@@ -14703,7 +14736,8 @@ var Sidebar = ({
14703
14736
  $color: theme.typography.text.color,
14704
14737
  children: [
14705
14738
  formatCurrency(
14706
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
14739
+ (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
14740
+ (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
14707
14741
  ),
14708
14742
  /* @__PURE__ */ jsxs8("sub", { children: [
14709
14743
  "/",
@@ -14766,14 +14800,20 @@ var Sidebar = ({
14766
14800
  $color: theme.typography.text.color,
14767
14801
  children: [
14768
14802
  entitlement.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment4, { children: [
14769
- formatCurrency(price * quantity),
14803
+ formatCurrency(
14804
+ price * quantity,
14805
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
14806
+ ),
14770
14807
  /* @__PURE__ */ jsxs8("sub", { children: [
14771
14808
  "/",
14772
14809
  shortenPeriod(planPeriod)
14773
14810
  ] })
14774
14811
  ] }),
14775
14812
  entitlement.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment4, { children: [
14776
- formatCurrency(price),
14813
+ formatCurrency(
14814
+ price,
14815
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
14816
+ ),
14777
14817
  /* @__PURE__ */ jsxs8("sub", { children: [
14778
14818
  "/",
14779
14819
  (0, import_pluralize.default)(
@@ -14833,7 +14873,8 @@ var Sidebar = ({
14833
14873
  $color: theme.typography.text.color,
14834
14874
  children: [
14835
14875
  formatCurrency(
14836
- ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * previous.quantity
14876
+ ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * previous.quantity,
14877
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
14837
14878
  ),
14838
14879
  /* @__PURE__ */ jsxs8("sub", { children: [
14839
14880
  "/",
@@ -14875,7 +14916,8 @@ var Sidebar = ({
14875
14916
  $color: theme.typography.text.color,
14876
14917
  children: [
14877
14918
  formatCurrency(
14878
- ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * next2.quantity
14919
+ ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * next2.quantity,
14920
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
14879
14921
  ),
14880
14922
  /* @__PURE__ */ jsxs8("sub", { children: [
14881
14923
  "/",
@@ -14929,14 +14971,20 @@ var Sidebar = ({
14929
14971
  $color: theme.typography.text.color,
14930
14972
  children: [
14931
14973
  entitlement.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment4, { children: [
14932
- formatCurrency(price * quantity),
14974
+ formatCurrency(
14975
+ price * quantity,
14976
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
14977
+ ),
14933
14978
  /* @__PURE__ */ jsxs8("sub", { children: [
14934
14979
  "/",
14935
14980
  shortenPeriod(planPeriod)
14936
14981
  ] })
14937
14982
  ] }),
14938
14983
  entitlement.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ jsxs8(Fragment4, { children: [
14939
- formatCurrency(price),
14984
+ formatCurrency(
14985
+ price,
14986
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
14987
+ ),
14940
14988
  /* @__PURE__ */ jsxs8("sub", { children: [
14941
14989
  "/",
14942
14990
  (0, import_pluralize.default)(
@@ -14997,7 +15045,8 @@ var Sidebar = ({
14997
15045
  children: [
14998
15046
  "-",
14999
15047
  formatCurrency(
15000
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
15048
+ (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
15049
+ (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
15001
15050
  ),
15002
15051
  "/",
15003
15052
  /* @__PURE__ */ jsx12("sub", { children: shortenPeriod(planPeriod) })
@@ -15047,7 +15096,10 @@ var Sidebar = ({
15047
15096
  $weight: theme.typography.text.fontWeight,
15048
15097
  $color: theme.typography.text.color,
15049
15098
  children: [
15050
- formatCurrency(addOn.planPrice),
15099
+ formatCurrency(
15100
+ addOn.planPrice,
15101
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15102
+ ),
15051
15103
  /* @__PURE__ */ jsxs8("sub", { children: [
15052
15104
  "/",
15053
15105
  shortenPeriod(addOn.planPeriod)
@@ -15134,7 +15186,10 @@ var Sidebar = ({
15134
15186
  $size: theme.typography.text.fontSize,
15135
15187
  $weight: theme.typography.text.fontWeight,
15136
15188
  $color: theme.typography.text.color,
15137
- children: formatCurrency(proration)
15189
+ children: formatCurrency(
15190
+ proration,
15191
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15192
+ )
15138
15193
  }
15139
15194
  ) })
15140
15195
  ]
@@ -15238,7 +15293,10 @@ var Sidebar = ({
15238
15293
  $size: theme.typography.text.fontSize,
15239
15294
  $weight: theme.typography.text.fontWeight,
15240
15295
  $color: theme.typography.text.color,
15241
- children: formatCurrency(newCharges / 100 * percentOff)
15296
+ children: formatCurrency(
15297
+ newCharges / 100 * percentOff,
15298
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15299
+ )
15242
15300
  }
15243
15301
  ) })
15244
15302
  ]
@@ -15259,7 +15317,10 @@ var Sidebar = ({
15259
15317
  $weight: theme.typography.text.fontWeight,
15260
15318
  $color: theme.typography.text.color,
15261
15319
  children: t2("X off", {
15262
- amount: formatCurrency(Math.abs(amountOff))
15320
+ amount: formatCurrency(
15321
+ Math.abs(amountOff),
15322
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15323
+ )
15263
15324
  })
15264
15325
  }
15265
15326
  ) }),
@@ -15272,7 +15333,10 @@ var Sidebar = ({
15272
15333
  $color: theme.typography.text.color,
15273
15334
  children: [
15274
15335
  "-",
15275
- formatCurrency(Math.abs(amountOff))
15336
+ formatCurrency(
15337
+ Math.abs(amountOff),
15338
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15339
+ )
15276
15340
  ]
15277
15341
  }
15278
15342
  ) })
@@ -15345,7 +15409,10 @@ var Sidebar = ({
15345
15409
  $size: theme.typography.text.fontSize,
15346
15410
  $weight: theme.typography.text.fontWeight,
15347
15411
  $color: theme.typography.text.color,
15348
- children: formatCurrency(Math.max(0, dueNow))
15412
+ children: formatCurrency(
15413
+ Math.max(0, dueNow),
15414
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15415
+ )
15349
15416
  }
15350
15417
  ) })
15351
15418
  ]
@@ -15372,7 +15439,10 @@ var Sidebar = ({
15372
15439
  $size: theme.typography.text.fontSize,
15373
15440
  $weight: theme.typography.text.fontWeight,
15374
15441
  $color: theme.typography.text.color,
15375
- children: formatCurrency(Math.abs(dueNow))
15442
+ children: formatCurrency(
15443
+ Math.abs(dueNow),
15444
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15445
+ )
15376
15446
  }
15377
15447
  ) })
15378
15448
  ] }),
@@ -15494,6 +15564,7 @@ var Plan = ({
15494
15564
  $flexDirection: "column",
15495
15565
  $gap: "0.5rem",
15496
15566
  $padding: `0 ${cardPadding}rem ${0.75 * cardPadding}rem`,
15567
+ $borderWidth: "0",
15497
15568
  $borderBottomWidth: "1px",
15498
15569
  $borderStyle: "solid",
15499
15570
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
@@ -15532,7 +15603,8 @@ var Plan = ({
15532
15603
  $weight: theme.typography.heading2.fontWeight,
15533
15604
  $color: theme.typography.heading2.color,
15534
15605
  children: formatCurrency(
15535
- (period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0
15606
+ (period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0,
15607
+ (period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.currency
15536
15608
  )
15537
15609
  }
15538
15610
  ),
@@ -15597,6 +15669,7 @@ var Plan = ({
15597
15669
  }[entitlement.metricPeriod];
15598
15670
  }
15599
15671
  const price = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price;
15672
+ const currency = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency;
15600
15673
  if (entitlement.priceBehavior && typeof price !== "number") {
15601
15674
  return acc;
15602
15675
  }
@@ -15628,7 +15701,7 @@ var Plan = ({
15628
15701
  $weight: theme.typography.text.fontWeight,
15629
15702
  $color: theme.typography.text.color,
15630
15703
  children: typeof price !== "undefined" ? /* @__PURE__ */ jsxs9(Fragment5, { children: [
15631
- formatCurrency(price),
15704
+ formatCurrency(price, currency),
15632
15705
  " ",
15633
15706
  t2("per"),
15634
15707
  " ",
@@ -15732,7 +15805,7 @@ var Plan = ({
15732
15805
  {
15733
15806
  disabled: isLoading || !plan.valid,
15734
15807
  onClick: () => {
15735
- selectPlan(plan);
15808
+ selectPlan({ plan });
15736
15809
  },
15737
15810
  $size: "sm",
15738
15811
  $color: "primary",
@@ -15818,7 +15891,8 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
15818
15891
  $weight: theme.typography.heading2.fontWeight,
15819
15892
  $color: theme.typography.heading2.color,
15820
15893
  children: formatCurrency(
15821
- (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0
15894
+ (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0,
15895
+ (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.currency
15822
15896
  )
15823
15897
  }
15824
15898
  ),
@@ -16019,7 +16093,8 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
16019
16093
  $color: theme.typography.text.color,
16020
16094
  children: [
16021
16095
  formatCurrency(
16022
- ((period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * quantity
16096
+ ((period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * quantity,
16097
+ (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
16023
16098
  ),
16024
16099
  /* @__PURE__ */ jsxs11("sub", { children: [
16025
16100
  "/",
@@ -16037,7 +16112,8 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
16037
16112
  $color: unitPriceColor,
16038
16113
  children: [
16039
16114
  formatCurrency(
16040
- (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0
16115
+ (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0,
16116
+ (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
16041
16117
  ),
16042
16118
  /* @__PURE__ */ jsxs11("sub", { children: [
16043
16119
  "/",
@@ -16070,14 +16146,19 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
16070
16146
  import { useEffect as useEffect4, useState as useState6 } from "react";
16071
16147
 
16072
16148
  // node_modules/@stripe/stripe-js/dist/index.mjs
16073
- var V3_URL = "https://js.stripe.com/v3";
16149
+ var ORIGIN = "https://js.stripe.com";
16150
+ var STRIPE_JS_URL = "".concat(ORIGIN, "/v3");
16074
16151
  var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
16152
+ var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
16075
16153
  var EXISTING_SCRIPT_MESSAGE = "loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";
16154
+ var isStripeJSURL = function isStripeJSURL2(url) {
16155
+ return V3_URL_REGEX.test(url) || STRIPE_JS_URL_REGEX.test(url);
16156
+ };
16076
16157
  var findScript = function findScript2() {
16077
- var scripts = document.querySelectorAll('script[src^="'.concat(V3_URL, '"]'));
16158
+ var scripts = document.querySelectorAll('script[src^="'.concat(ORIGIN, '"]'));
16078
16159
  for (var i2 = 0; i2 < scripts.length; i2++) {
16079
16160
  var script = scripts[i2];
16080
- if (!V3_URL_REGEX.test(script.src)) {
16161
+ if (!isStripeJSURL(script.src)) {
16081
16162
  continue;
16082
16163
  }
16083
16164
  return script;
@@ -16087,7 +16168,7 @@ var findScript = function findScript2() {
16087
16168
  var injectScript = function injectScript2(params) {
16088
16169
  var queryString = params && !params.advancedFraudSignals ? "?advancedFraudSignals=false" : "";
16089
16170
  var script = document.createElement("script");
16090
- script.src = "".concat(V3_URL).concat(queryString);
16171
+ script.src = "".concat(STRIPE_JS_URL).concat(queryString);
16091
16172
  var headOrBody = document.head || document.body;
16092
16173
  if (!headOrBody) {
16093
16174
  throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
@@ -16101,7 +16182,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
16101
16182
  }
16102
16183
  stripe._registerWrapper({
16103
16184
  name: "stripe-js",
16104
- version: "5.6.0",
16185
+ version: "5.7.0",
16105
16186
  startTime
16106
16187
  });
16107
16188
  };
@@ -16383,12 +16464,6 @@ var CheckoutDialog = ({ top = 0 }) => {
16383
16464
  const modalRef = useRef5(null);
16384
16465
  const contentRef = useRef5(null);
16385
16466
  const checkoutRef = useRef5(null);
16386
- const [checkoutStage, setCheckoutStage] = useState7(
16387
- () => selected.addOnId ? "addons" : selected.usage ? "usage" : "plan"
16388
- );
16389
- const [planPeriod, setPlanPeriod] = useState7(
16390
- selected.period || data.company?.plan?.planPeriod || "month"
16391
- );
16392
16467
  const [charges, setCharges] = useState7();
16393
16468
  const [paymentMethodId, setPaymentMethodId] = useState7();
16394
16469
  const [isLoading, setIsLoading] = useState7(false);
@@ -16397,13 +16472,18 @@ var CheckoutDialog = ({ top = 0 }) => {
16397
16472
  !data.subscription?.paymentMethod
16398
16473
  );
16399
16474
  const [promoCode, setPromoCode] = useState7();
16475
+ const [planPeriod, setPlanPeriod] = useState7(
16476
+ selected.period || data.company?.plan?.planPeriod || "month"
16477
+ );
16400
16478
  const {
16401
16479
  plans: availablePlans,
16402
16480
  addOns: availableAddOns,
16403
16481
  periods: availablePeriods
16404
16482
  } = useAvailablePlans(planPeriod);
16405
16483
  const [selectedPlan, setSelectedPlan] = useState7(
16406
- () => availablePlans.find((plan) => plan.current)
16484
+ () => availablePlans.find(
16485
+ (plan) => selected.planId ? plan.id === selected.planId : plan.current
16486
+ )
16407
16487
  );
16408
16488
  const currentAddOns = data.company?.addOns || [];
16409
16489
  const [addOns, setAddOns] = useState7(
@@ -16466,6 +16546,18 @@ var CheckoutDialog = ({ top = 0 }) => {
16466
16546
  ),
16467
16547
  [usageBasedEntitlements]
16468
16548
  );
16549
+ const [checkoutStage, setCheckoutStage] = useState7(() => {
16550
+ if (selected.planId !== currentPlan?.id) {
16551
+ return payInAdvanceEntitlements.length > 0 ? "usage" : "addons";
16552
+ }
16553
+ if (selected.addOnId) {
16554
+ return "addons";
16555
+ }
16556
+ if (selected.usage) {
16557
+ return "usage";
16558
+ }
16559
+ return "plan";
16560
+ });
16469
16561
  const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected === true);
16470
16562
  const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
16471
16563
  ({ quantity }) => quantity > 0
@@ -16510,50 +16602,12 @@ var CheckoutDialog = ({ top = 0 }) => {
16510
16602
  requiresPayment
16511
16603
  ]);
16512
16604
  const isLightBackground = useIsLightBackground();
16513
- const selectPlan = useCallback7(
16514
- (updatedPlan, updatedPeriod) => {
16515
- const entitlements = updatedPlan.entitlements.reduce(
16516
- createActiveUsageBasedEntitlementsReducer(updatedPeriod),
16517
- []
16518
- );
16519
- setSelectedPlan(updatedPlan);
16520
- setUsageBasedEntitlements(entitlements);
16521
- },
16522
- [createActiveUsageBasedEntitlementsReducer]
16523
- );
16524
- const toggleAddOn = (id) => {
16525
- setAddOns(
16526
- (prev2) => prev2.map((addOn) => ({
16527
- ...addOn,
16528
- ...addOn.id === id && { isSelected: !addOn.isSelected }
16529
- }))
16530
- );
16531
- };
16532
- const changePlanPeriod = useCallback7(
16533
- (period) => {
16534
- if (selectedPlan) {
16535
- selectPlan(selectedPlan, period);
16536
- }
16537
- setPlanPeriod(period);
16538
- },
16539
- [selectedPlan, selectPlan, setPlanPeriod]
16540
- );
16541
- const updateUsageBasedEntitlementQuantity = (id, updatedQuantity) => {
16542
- setUsageBasedEntitlements(
16543
- (prev2) => prev2.map(
16544
- ({ entitlement, allocation, quantity, usage }) => entitlement.id === id ? {
16545
- entitlement,
16546
- allocation,
16547
- quantity: updatedQuantity,
16548
- usage
16549
- } : { entitlement, allocation, quantity, usage }
16550
- )
16551
- );
16552
- };
16553
- useEffect5(() => {
16554
- async function previewCheckout() {
16555
- const planPriceId = planPeriod === "month" ? selectedPlan?.monthlyPrice?.id : selectedPlan?.yearlyPrice?.id;
16556
- if (!api || !selectedPlan || !planPriceId) {
16605
+ const previewCheckout = useCallback7(
16606
+ async (updates) => {
16607
+ const period = updates.period || planPeriod;
16608
+ const plan = updates.plan || selectedPlan;
16609
+ const planPriceId = period === "month" ? plan?.monthlyPrice?.id : plan?.yearlyPrice?.id;
16610
+ if (!api || !plan || !planPriceId) {
16557
16611
  return;
16558
16612
  }
16559
16613
  setError(void 0);
@@ -16562,23 +16616,26 @@ var CheckoutDialog = ({ top = 0 }) => {
16562
16616
  try {
16563
16617
  const { data: data2 } = await api.previewCheckout({
16564
16618
  changeSubscriptionRequestBody: {
16565
- newPlanId: selectedPlan.id,
16619
+ newPlanId: plan.id,
16566
16620
  newPriceId: planPriceId,
16567
- addOnIds: addOns.reduce((acc, addOn) => {
16568
- if (addOn.isSelected) {
16569
- const addOnPriceId = (planPeriod === "month" ? addOn?.monthlyPrice : addOn?.yearlyPrice)?.id;
16570
- if (addOnPriceId) {
16571
- acc.push({
16572
- addOnId: addOn.id,
16573
- priceId: addOnPriceId
16574
- });
16621
+ addOnIds: (updates.addOns || addOns).reduce(
16622
+ (acc, addOn) => {
16623
+ if (addOn.isSelected) {
16624
+ const addOnPriceId = (period === "month" ? addOn?.monthlyPrice : addOn?.yearlyPrice)?.id;
16625
+ if (addOnPriceId) {
16626
+ acc.push({
16627
+ addOnId: addOn.id,
16628
+ priceId: addOnPriceId
16629
+ });
16630
+ }
16575
16631
  }
16576
- }
16577
- return acc;
16578
- }, []),
16579
- payInAdvance: payInAdvanceEntitlements.reduce(
16632
+ return acc;
16633
+ },
16634
+ []
16635
+ ),
16636
+ payInAdvance: (updates.payInAdvanceEntitlements || payInAdvanceEntitlements).reduce(
16580
16637
  (acc, { entitlement, quantity }) => {
16581
- const priceId = (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.priceId;
16638
+ const priceId = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.priceId;
16582
16639
  if (priceId) {
16583
16640
  acc.push({
16584
16641
  priceId,
@@ -16589,7 +16646,7 @@ var CheckoutDialog = ({ top = 0 }) => {
16589
16646
  },
16590
16647
  []
16591
16648
  ),
16592
- promoCode
16649
+ promoCode: updates.promoCode || promoCode
16593
16650
  }
16594
16651
  });
16595
16652
  setCharges(data2);
@@ -16608,19 +16665,88 @@ var CheckoutDialog = ({ top = 0 }) => {
16608
16665
  } finally {
16609
16666
  setIsLoading(false);
16610
16667
  }
16611
- }
16612
- previewCheckout();
16613
- }, [
16614
- t2,
16615
- api,
16616
- planPeriod,
16617
- selectedPlan,
16618
- addOns,
16619
- payInAdvanceEntitlements,
16620
- promoCode
16621
- ]);
16668
+ },
16669
+ [
16670
+ t2,
16671
+ api,
16672
+ planPeriod,
16673
+ selectedPlan,
16674
+ addOns,
16675
+ payInAdvanceEntitlements,
16676
+ promoCode
16677
+ ]
16678
+ );
16679
+ const selectPlan = useCallback7(
16680
+ (updates) => {
16681
+ const plan = updates.plan || selectedPlan;
16682
+ if (!plan) {
16683
+ return;
16684
+ }
16685
+ const period = updates.period || planPeriod;
16686
+ const entitlements = plan.entitlements.reduce(
16687
+ createActiveUsageBasedEntitlementsReducer(period),
16688
+ []
16689
+ );
16690
+ if (updates.plan) {
16691
+ setSelectedPlan(plan);
16692
+ setUsageBasedEntitlements(entitlements);
16693
+ }
16694
+ previewCheckout({
16695
+ period,
16696
+ plan: updates.plan,
16697
+ payInAdvanceEntitlements: entitlements.filter(
16698
+ ({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
16699
+ )
16700
+ });
16701
+ },
16702
+ [
16703
+ planPeriod,
16704
+ selectedPlan,
16705
+ createActiveUsageBasedEntitlementsReducer,
16706
+ previewCheckout
16707
+ ]
16708
+ );
16709
+ const changePlanPeriod = useCallback7(
16710
+ (period) => {
16711
+ setPlanPeriod(period);
16712
+ previewCheckout({ period });
16713
+ },
16714
+ [setPlanPeriod, previewCheckout]
16715
+ );
16716
+ const toggleAddOn = (id) => {
16717
+ setAddOns((prev2) => {
16718
+ const updated = prev2.map((addOn) => ({
16719
+ ...addOn,
16720
+ ...addOn.id === id && { isSelected: !addOn.isSelected }
16721
+ }));
16722
+ previewCheckout({ addOns: updated });
16723
+ return updated;
16724
+ });
16725
+ };
16726
+ const updateUsageBasedEntitlementQuantity = useCallback7(
16727
+ (id, updatedQuantity) => {
16728
+ setUsageBasedEntitlements((prev2) => {
16729
+ const updated = prev2.map(
16730
+ ({ entitlement, allocation, quantity, usage }) => entitlement.id === id ? {
16731
+ entitlement,
16732
+ allocation,
16733
+ quantity: updatedQuantity,
16734
+ usage
16735
+ } : { entitlement, allocation, quantity, usage }
16736
+ );
16737
+ previewCheckout({
16738
+ payInAdvanceEntitlements: updated.filter(
16739
+ ({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
16740
+ )
16741
+ });
16742
+ return updated;
16743
+ });
16744
+ },
16745
+ [previewCheckout]
16746
+ );
16622
16747
  const updatePromoCode = (code) => {
16623
16748
  setPromoCode(code);
16749
+ previewCheckout({ promoCode: code });
16624
16750
  };
16625
16751
  useEffect5(() => {
16626
16752
  if (charges) {
@@ -17390,6 +17516,18 @@ var Details = ({
17390
17516
  const { t: t2 } = useTranslation();
17391
17517
  const theme = nt();
17392
17518
  const { data } = useEmbed();
17519
+ const currency = useMemo7(() => {
17520
+ if (data.company?.plan?.planPeriod === "month") {
17521
+ return monthlyUsageBasedPrice?.currency;
17522
+ }
17523
+ if (data.company?.plan?.planPeriod === "year") {
17524
+ return yearlyUsageBasedPrice?.currency;
17525
+ }
17526
+ }, [
17527
+ data.company?.plan?.planPeriod,
17528
+ monthlyUsageBasedPrice,
17529
+ yearlyUsageBasedPrice
17530
+ ]);
17393
17531
  const price = useMemo7(() => {
17394
17532
  if (data.company?.plan?.planPeriod === "month") {
17395
17533
  return monthlyUsageBasedPrice?.price;
@@ -17410,7 +17548,7 @@ var Details = ({
17410
17548
  return `${formatNumber(allocation)} ${(0, import_pluralize4.default)(feature.name, allocation)}`;
17411
17549
  }
17412
17550
  if (priceBehavior === "pay_as_you_go" && typeof price === "number") {
17413
- return `${formatCurrency(price)} ${t2("per")} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}`;
17551
+ return `${formatCurrency(price, currency)} ${t2("per")} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}`;
17414
17552
  }
17415
17553
  if (!priceBehavior && typeof allocation === "number") {
17416
17554
  return `${formatNumber(allocation)} ${(0, import_pluralize4.default)(feature.name, allocation)}`;
@@ -17426,15 +17564,15 @@ var Details = ({
17426
17564
  if (usageData) {
17427
17565
  let acc;
17428
17566
  if (priceBehavior === "pay_in_advance" && typeof data.company?.plan?.planPeriod === "string" && typeof price === "number") {
17429
- acc = `${formatCurrency(price)}/${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}/${shortenPeriod(data.company.plan.planPeriod)}`;
17567
+ acc = `${formatCurrency(price, currency)}/${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}/${shortenPeriod(data.company.plan.planPeriod)}`;
17430
17568
  } else if (priceBehavior === "pay_as_you_go" && typeof usage === "number") {
17431
17569
  acc = `${usage} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), usage)} ${t2("used")}`;
17432
17570
  }
17433
17571
  if (acc) {
17434
17572
  if (usageData?.priceBehavior === "pay_in_advance" && typeof price === "number" && typeof allocation === "number") {
17435
- acc += ` \u2022 ${formatCurrency(price * allocation)}`;
17573
+ acc += ` \u2022 ${formatCurrency(price * allocation, currency)}`;
17436
17574
  } else if (usageData?.priceBehavior === "pay_as_you_go" && typeof price === "number" && typeof usage === "number") {
17437
- acc += ` \u2022 ${formatCurrency(price * usage)}`;
17575
+ acc += ` \u2022 ${formatCurrency(price * usage, currency)}`;
17438
17576
  }
17439
17577
  return acc;
17440
17578
  }
@@ -17736,9 +17874,9 @@ function resolveDesignProps2(props) {
17736
17874
  function formatInvoices(invoices) {
17737
17875
  return (invoices || []).filter(
17738
17876
  ({ url, amountDue, amountPaid }) => url && (amountDue === 0 || amountPaid > 0)
17739
- ).sort((a2, b2) => a2.dueDate && b2.dueDate ? +b2.dueDate - +a2.dueDate : 1).map(({ amountDue, dueDate, url }) => ({
17877
+ ).sort((a2, b2) => a2.dueDate && b2.dueDate ? +b2.dueDate - +a2.dueDate : 1).map(({ amountDue, dueDate, url, currency }) => ({
17740
17878
  ...dueDate && { date: toPrettyDate(dueDate) },
17741
- amount: formatCurrency(amountDue),
17879
+ amount: formatCurrency(amountDue, currency),
17742
17880
  url
17743
17881
  }));
17744
17882
  }
@@ -17921,10 +18059,13 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
17921
18059
  yearlyUsageBasedPrice
17922
18060
  }, index) => {
17923
18061
  let price;
18062
+ let currency;
17924
18063
  if (planPeriod === "month") {
17925
18064
  price = monthlyUsageBasedPrice?.price;
18065
+ currency = monthlyUsageBasedPrice?.currency;
17926
18066
  } else if (planPeriod === "year") {
17927
18067
  price = yearlyUsageBasedPrice?.price;
18068
+ currency = yearlyUsageBasedPrice?.currency;
17928
18069
  }
17929
18070
  return /* @__PURE__ */ jsxs21(Element, { as: Flex, $gap: "1.5rem", children: [
17930
18071
  props.icon.isVisible && feature?.icon && /* @__PURE__ */ jsx28(
@@ -17998,7 +18139,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
17998
18139
  formatNumber(allocation),
17999
18140
  " ",
18000
18141
  (0, import_pluralize5.default)(feature.name, allocation)
18001
- ] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price) : typeof usage === "number" && /* @__PURE__ */ jsxs21(Fragment10, { children: [
18142
+ ] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ jsxs21(Fragment10, { children: [
18002
18143
  formatNumber(usage),
18003
18144
  " ",
18004
18145
  (0, import_pluralize5.default)(feature.name, usage)
@@ -18490,19 +18631,23 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18490
18631
  (acc, usage) => {
18491
18632
  const quantity = usage?.allocation ?? 0;
18492
18633
  let price;
18634
+ let currencyCode = "USD";
18493
18635
  if (currentPlan?.planPeriod === "month") {
18494
18636
  price = usage.monthlyUsageBasedPrice?.price;
18637
+ currencyCode = usage.monthlyUsageBasedPrice?.currency ?? "USD";
18495
18638
  } else if (currentPlan?.planPeriod === "year") {
18496
18639
  price = usage.yearlyUsageBasedPrice?.price;
18640
+ currencyCode = usage.yearlyUsageBasedPrice?.currency ?? "USD";
18497
18641
  }
18498
18642
  if (usage.priceBehavior && typeof price === "number" && quantity > 0) {
18499
- acc.push({ ...usage, price, quantity });
18643
+ acc.push({ ...usage, price, quantity, currencyCode });
18500
18644
  }
18501
18645
  return acc;
18502
18646
  },
18503
18647
  []
18504
18648
  );
18505
18649
  const billingSubscription = data.company?.billingSubscription;
18650
+ const subscriptionCurrency = billingSubscription?.currency ?? "USD";
18506
18651
  const showTrialBox = billingSubscription && billingSubscription.status == "trialing";
18507
18652
  const trialEndDate = billingSubscription?.trialEnd ? new Date(billingSubscription.trialEnd * 1e3) : /* @__PURE__ */ new Date();
18508
18653
  const todayDate = /* @__PURE__ */ new Date();
@@ -18596,7 +18741,10 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18596
18741
  $size: theme.typography[props.header.price.fontStyle].fontSize,
18597
18742
  $weight: theme.typography[props.header.price.fontStyle].fontWeight,
18598
18743
  $color: theme.typography[props.header.price.fontStyle].color,
18599
- children: formatCurrency(currentPlan.planPrice)
18744
+ children: formatCurrency(
18745
+ currentPlan.planPrice,
18746
+ subscriptionCurrency
18747
+ )
18600
18748
  }
18601
18749
  ),
18602
18750
  /* @__PURE__ */ jsx30(
@@ -18654,7 +18802,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18654
18802
  $weight: theme.typography.text.fontWeight,
18655
18803
  $color: theme.typography.text.color,
18656
18804
  children: [
18657
- formatCurrency(addOn.planPrice),
18805
+ formatCurrency(addOn.planPrice, subscriptionCurrency),
18658
18806
  /* @__PURE__ */ jsxs23("sub", { children: [
18659
18807
  "/",
18660
18808
  shortenPeriod(addOn.planPeriod)
@@ -18717,7 +18865,10 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18717
18865
  $weight: theme.typography.text.fontWeight,
18718
18866
  $color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
18719
18867
  children: [
18720
- formatCurrency(entitlement.price),
18868
+ formatCurrency(
18869
+ entitlement.price,
18870
+ entitlement.currencyCode
18871
+ ),
18721
18872
  /* @__PURE__ */ jsxs23("sub", { children: [
18722
18873
  "/",
18723
18874
  (0, import_pluralize6.default)(
@@ -18739,7 +18890,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18739
18890
  $color: theme.typography.text.color,
18740
18891
  children: [
18741
18892
  formatCurrency(
18742
- entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1)
18893
+ entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1),
18894
+ entitlement.currencyCode
18743
18895
  ),
18744
18896
  /* @__PURE__ */ jsxs23("sub", { children: [
18745
18897
  "/",
@@ -18919,7 +19071,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
18919
19071
  $display: "grid",
18920
19072
  $gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
18921
19073
  $gap: "1rem",
18922
- children: plans.map((plan, index, self2) => {
19074
+ children: plans.map((plan, index) => {
18923
19075
  const isActivePlan = plan.current && data.company?.plan?.planPeriod === selectedPeriod;
18924
19076
  const count = entitlementCounts[plan.id];
18925
19077
  let isExpanded = false;
@@ -18945,6 +19097,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
18945
19097
  $flexDirection: "column",
18946
19098
  $gap: "0.75rem",
18947
19099
  $padding: `0 ${cardPadding}rem ${0.75 * cardPadding}rem`,
19100
+ $borderWidth: "0",
18948
19101
  $borderBottomWidth: "1px",
18949
19102
  $borderStyle: "solid",
18950
19103
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
@@ -18978,7 +19131,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
18978
19131
  $weight: theme.typography[props.plans.name.fontStyle].fontWeight,
18979
19132
  $color: theme.typography[props.plans.name.fontStyle].color,
18980
19133
  children: formatCurrency(
18981
- (selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0
19134
+ (selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0,
19135
+ (selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.currency
18982
19136
  )
18983
19137
  }
18984
19138
  ),
@@ -19023,18 +19177,6 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19023
19177
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
19024
19178
  children: [
19025
19179
  props.plans.showEntitlements && /* @__PURE__ */ jsxs24(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: [
19026
- props.plans.showInclusionText && index > 0 && /* @__PURE__ */ jsx31(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx31(
19027
- Text,
19028
- {
19029
- $font: theme.typography.text.fontFamily,
19030
- $size: theme.typography.text.fontSize,
19031
- $weight: theme.typography.text.fontWeight,
19032
- $color: theme.typography.text.color,
19033
- children: t2("Everything in", {
19034
- plan: self2[index - 1].name
19035
- })
19036
- }
19037
- ) }),
19038
19180
  plan.entitlements.slice().sort((a2, b2) => {
19039
19181
  if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
19040
19182
  return 1;
@@ -19045,10 +19187,13 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19045
19187
  return 0;
19046
19188
  }).reduce((acc, entitlement) => {
19047
19189
  let price;
19190
+ let currency;
19048
19191
  if (selectedPeriod === "month") {
19049
19192
  price = entitlement.meteredMonthlyPrice?.price;
19193
+ currency = entitlement.meteredMonthlyPrice?.currency;
19050
19194
  } else if (selectedPeriod === "year") {
19051
19195
  price = entitlement.meteredYearlyPrice?.price;
19196
+ currency = entitlement.meteredYearlyPrice?.currency;
19052
19197
  }
19053
19198
  if (entitlement.priceBehavior && typeof price !== "number") {
19054
19199
  return acc;
@@ -19075,7 +19220,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19075
19220
  $color: theme.typography.text.color,
19076
19221
  $leading: 1.35,
19077
19222
  children: typeof price !== "undefined" ? /* @__PURE__ */ jsxs24(Fragment13, { children: [
19078
- formatCurrency(price),
19223
+ formatCurrency(price, currency),
19079
19224
  " ",
19080
19225
  t2("per"),
19081
19226
  " ",
@@ -19293,7 +19438,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19293
19438
  $weight: theme.typography[props.plans.name.fontStyle].fontWeight,
19294
19439
  $color: theme.typography[props.plans.name.fontStyle].color,
19295
19440
  children: formatCurrency(
19296
- (selectedPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0
19441
+ (selectedPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0,
19442
+ (selectedPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.currency
19297
19443
  )
19298
19444
  }
19299
19445
  ),
@@ -19476,7 +19622,8 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19476
19622
  },
19477
19623
  ...data.upcomingInvoice?.dueDate && {
19478
19624
  dueDate: toPrettyDate(new Date(data.upcomingInvoice.dueDate))
19479
- }
19625
+ },
19626
+ currency: data.upcomingInvoice?.currency
19480
19627
  }
19481
19628
  };
19482
19629
  }, [data.subscription, data.upcomingInvoice]);
@@ -19515,7 +19662,10 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19515
19662
  $weight: theme.typography[props.price.fontStyle].fontWeight,
19516
19663
  $color: theme.typography[props.price.fontStyle].color,
19517
19664
  $leading: 1,
19518
- children: formatCurrency(upcomingInvoice.amountDue)
19665
+ children: formatCurrency(
19666
+ upcomingInvoice.amountDue,
19667
+ upcomingInvoice.currency
19668
+ )
19519
19669
  }
19520
19670
  ) }),
19521
19671
  /* @__PURE__ */ jsx32(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx32(
@@ -19530,7 +19680,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19530
19680
  }
19531
19681
  ) })
19532
19682
  ] }),
19533
- /* @__PURE__ */ jsxs25(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
19683
+ discounts.length > 0 && /* @__PURE__ */ jsxs25(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
19534
19684
  /* @__PURE__ */ jsx32(Box, { children: /* @__PURE__ */ jsx32(
19535
19685
  Text,
19536
19686
  {
@@ -19582,7 +19732,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19582
19732
  UpcomingBill.displayName = "UpcomingBill";
19583
19733
 
19584
19734
  // src/components/embed/ComponentTree.tsx
19585
- import { useEffect as useEffect9, useState as useState16, Children as Children2 } from "react";
19735
+ import { useEffect as useEffect9, useState as useState16 } from "react";
19586
19736
 
19587
19737
  // src/components/embed/renderer.ts
19588
19738
  import { createElement as createElement5 } from "react";
@@ -19685,7 +19835,7 @@ var Error2 = ({ message }) => {
19685
19835
  );
19686
19836
  };
19687
19837
  var ComponentTree = () => {
19688
- const { error, nodes } = useEmbed();
19838
+ const { error, nodes, isPending } = useEmbed();
19689
19839
  const [children, setChildren] = useState16(/* @__PURE__ */ jsx33(Loading, {}));
19690
19840
  useEffect9(() => {
19691
19841
  const renderer = createRenderer();
@@ -19695,7 +19845,7 @@ var ComponentTree = () => {
19695
19845
  console.error(error);
19696
19846
  return /* @__PURE__ */ jsx33(Error2, { message: error.message });
19697
19847
  }
19698
- if (Children2.count(children) === 0) {
19848
+ if (isPending) {
19699
19849
  return /* @__PURE__ */ jsx33(Loading, {});
19700
19850
  }
19701
19851
  return /* @__PURE__ */ jsx33(Fragment14, { children });