@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.
@@ -10794,6 +10794,7 @@ function ChangeSubscriptionRequestBodyToJSON(value) {
10794
10794
  add_on_ids: value["addOnIds"].map(
10795
10795
  UpdateAddOnRequestBodyToJSON
10796
10796
  ),
10797
+ coupon_external_id: value["couponExternalId"],
10797
10798
  new_plan_id: value["newPlanId"],
10798
10799
  new_price_id: value["newPriceId"],
10799
10800
  pay_in_advance: value["payInAdvance"].map(
@@ -11253,6 +11254,21 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11253
11254
  };
11254
11255
  }
11255
11256
 
11257
+ // src/api/models/CustomPlanConfig.ts
11258
+ function CustomPlanConfigFromJSON(json) {
11259
+ return CustomPlanConfigFromJSONTyped(json, false);
11260
+ }
11261
+ function CustomPlanConfigFromJSONTyped(json, ignoreDiscriminator) {
11262
+ if (json == null) {
11263
+ return json;
11264
+ }
11265
+ return {
11266
+ ctaText: json["cta_text"],
11267
+ ctaWebSite: json["cta_web_site"],
11268
+ priceText: json["price_text"]
11269
+ };
11270
+ }
11271
+
11256
11272
  // src/api/models/CompanyPlanDetailResponseData.ts
11257
11273
  function CompanyPlanDetailResponseDataFromJSON(json) {
11258
11274
  return CompanyPlanDetailResponseDataFromJSONTyped(json, false);
@@ -11268,6 +11284,8 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11268
11284
  companyCount: json["company_count"],
11269
11285
  createdAt: new Date(json["created_at"]),
11270
11286
  current: json["current"],
11287
+ custom: json["custom"],
11288
+ customPlanConfig: json["custom_plan_config"] == null ? void 0 : CustomPlanConfigFromJSON(json["custom_plan_config"]),
11271
11289
  description: json["description"],
11272
11290
  entitlements: json["entitlements"].map(
11273
11291
  PlanEntitlementResponseDataFromJSON
@@ -11277,6 +11295,7 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11277
11295
  ),
11278
11296
  icon: json["icon"],
11279
11297
  id: json["id"],
11298
+ isCustom: json["is_custom"],
11280
11299
  isDefault: json["is_default"],
11281
11300
  isFree: json["is_free"],
11282
11301
  isTrialable: json["is_trialable"],
@@ -12525,8 +12544,12 @@ function isEditorState(obj) {
12525
12544
  });
12526
12545
  }
12527
12546
  function getEditorState(json) {
12528
- const obj = JSON.parse(json);
12529
- return isEditorState(obj) ? obj : void 0;
12547
+ if (json) {
12548
+ const obj = JSON.parse(json);
12549
+ if (isEditorState(obj)) {
12550
+ return obj;
12551
+ }
12552
+ }
12530
12553
  }
12531
12554
  function parseEditorState(data) {
12532
12555
  const initialMap = {};
@@ -12706,7 +12729,7 @@ var EmbedProvider = ({
12706
12729
  (0, import_react11.useEffect)(() => {
12707
12730
  if (accessToken) {
12708
12731
  const { headers = {} } = apiConfig ?? {};
12709
- headers["X-Schematic-Components-Version"] = "0.4.1";
12732
+ headers["X-Schematic-Components-Version"] = "0.4.3";
12710
12733
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
12711
12734
  const config = new Configuration({
12712
12735
  ...apiConfig,
@@ -12887,7 +12910,7 @@ function camelToHyphen(str) {
12887
12910
  function formatNumber(num) {
12888
12911
  return new Intl.NumberFormat("en-US").format(num);
12889
12912
  }
12890
- function formatCurrency(amount) {
12913
+ function formatCurrency(amount, currency = "USD") {
12891
12914
  try {
12892
12915
  const dollars = amount / 100;
12893
12916
  const formatValue = (value, symbol) => {
@@ -12895,6 +12918,9 @@ function formatCurrency(amount) {
12895
12918
  if (formatted.endsWith(".0")) {
12896
12919
  formatted = formatted.slice(0, -2);
12897
12920
  }
12921
+ if (currency.toUpperCase() !== "USD") {
12922
+ return `${currency.toUpperCase()}${formatted}${symbol}`;
12923
+ }
12898
12924
  return `$${formatted}${symbol}`;
12899
12925
  };
12900
12926
  if (dollars >= 1e6) {
@@ -12904,14 +12930,14 @@ function formatCurrency(amount) {
12904
12930
  } else {
12905
12931
  return new Intl.NumberFormat("en-US", {
12906
12932
  style: "currency",
12907
- currency: "USD"
12933
+ currency: currency.toUpperCase()
12908
12934
  }).format(dollars);
12909
12935
  }
12910
12936
  } catch (error) {
12911
12937
  console.error("Error formatting currency", error);
12912
12938
  return new Intl.NumberFormat("en-US", {
12913
12939
  style: "currency",
12914
- currency: "USD"
12940
+ currency: currency.toUpperCase()
12915
12941
  }).format(amount / 100);
12916
12942
  }
12917
12943
  }
@@ -13754,6 +13780,7 @@ var ModalHeader = ({
13754
13780
  $padding: "0 1rem",
13755
13781
  $backgroundColor: theme.card.background,
13756
13782
  ...bordered && {
13783
+ $borderWidth: "0",
13757
13784
  $borderBottomWidth: "1px",
13758
13785
  $borderBottomStyle: "solid",
13759
13786
  $borderBottomColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)"
@@ -14437,6 +14464,7 @@ var Sidebar = ({
14437
14464
  }
14438
14465
  let total = 0;
14439
14466
  const planPrice = (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price;
14467
+ const currency = (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency;
14440
14468
  if (planPrice) {
14441
14469
  total += planPrice;
14442
14470
  }
@@ -14450,7 +14478,7 @@ var Sidebar = ({
14450
14478
  0
14451
14479
  );
14452
14480
  total += payInAdvanceCost;
14453
- return formatCurrency(total);
14481
+ return formatCurrency(total, currency);
14454
14482
  }, [selectedPlan, addOns, payInAdvanceEntitlements, planPeriod]);
14455
14483
  const { amountOff, dueNow, newCharges, percentOff, periodStart, proration } = (0, import_react21.useMemo)(() => {
14456
14484
  return {
@@ -14613,6 +14641,7 @@ var Sidebar = ({
14613
14641
  $gap: "1rem",
14614
14642
  $width: "100%",
14615
14643
  $padding: "1.5rem",
14644
+ $borderWidth: "0",
14616
14645
  $borderBottomWidth: "1px",
14617
14646
  $borderStyle: "solid",
14618
14647
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)",
@@ -14638,6 +14667,7 @@ var Sidebar = ({
14638
14667
  $flexGrow: "1",
14639
14668
  $width: "100%",
14640
14669
  $padding: "1.5rem",
14670
+ $borderWidth: "0",
14641
14671
  $borderBottomWidth: "1px",
14642
14672
  $borderStyle: "solid",
14643
14673
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)",
@@ -14683,7 +14713,10 @@ var Sidebar = ({
14683
14713
  $weight: theme.typography.text.fontWeight,
14684
14714
  $color: theme.typography.text.color,
14685
14715
  children: [
14686
- formatCurrency(data.company.plan.planPrice),
14716
+ formatCurrency(
14717
+ data.company.plan.planPrice,
14718
+ data.company.billingSubscription?.currency
14719
+ ),
14687
14720
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
14688
14721
  "/",
14689
14722
  shortenPeriod(
@@ -14743,7 +14776,8 @@ var Sidebar = ({
14743
14776
  $color: theme.typography.text.color,
14744
14777
  children: [
14745
14778
  formatCurrency(
14746
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
14779
+ (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
14780
+ (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
14747
14781
  ),
14748
14782
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
14749
14783
  "/",
@@ -14806,14 +14840,20 @@ var Sidebar = ({
14806
14840
  $color: theme.typography.text.color,
14807
14841
  children: [
14808
14842
  entitlement.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
14809
- formatCurrency(price * quantity),
14843
+ formatCurrency(
14844
+ price * quantity,
14845
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
14846
+ ),
14810
14847
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
14811
14848
  "/",
14812
14849
  shortenPeriod(planPeriod)
14813
14850
  ] })
14814
14851
  ] }),
14815
14852
  entitlement.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
14816
- formatCurrency(price),
14853
+ formatCurrency(
14854
+ price,
14855
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
14856
+ ),
14817
14857
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
14818
14858
  "/",
14819
14859
  (0, import_pluralize.default)(
@@ -14873,7 +14913,8 @@ var Sidebar = ({
14873
14913
  $color: theme.typography.text.color,
14874
14914
  children: [
14875
14915
  formatCurrency(
14876
- ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * previous.quantity
14916
+ ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * previous.quantity,
14917
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
14877
14918
  ),
14878
14919
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
14879
14920
  "/",
@@ -14915,7 +14956,8 @@ var Sidebar = ({
14915
14956
  $color: theme.typography.text.color,
14916
14957
  children: [
14917
14958
  formatCurrency(
14918
- ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * next2.quantity
14959
+ ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * next2.quantity,
14960
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
14919
14961
  ),
14920
14962
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
14921
14963
  "/",
@@ -14969,14 +15011,20 @@ var Sidebar = ({
14969
15011
  $color: theme.typography.text.color,
14970
15012
  children: [
14971
15013
  entitlement.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
14972
- formatCurrency(price * quantity),
15014
+ formatCurrency(
15015
+ price * quantity,
15016
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15017
+ ),
14973
15018
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
14974
15019
  "/",
14975
15020
  shortenPeriod(planPeriod)
14976
15021
  ] })
14977
15022
  ] }),
14978
15023
  entitlement.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
14979
- formatCurrency(price),
15024
+ formatCurrency(
15025
+ price,
15026
+ (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15027
+ ),
14980
15028
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
14981
15029
  "/",
14982
15030
  (0, import_pluralize.default)(
@@ -15037,7 +15085,8 @@ var Sidebar = ({
15037
15085
  children: [
15038
15086
  "-",
15039
15087
  formatCurrency(
15040
- (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
15088
+ (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
15089
+ (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
15041
15090
  ),
15042
15091
  "/",
15043
15092
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("sub", { children: shortenPeriod(planPeriod) })
@@ -15087,7 +15136,10 @@ var Sidebar = ({
15087
15136
  $weight: theme.typography.text.fontWeight,
15088
15137
  $color: theme.typography.text.color,
15089
15138
  children: [
15090
- formatCurrency(addOn.planPrice),
15139
+ formatCurrency(
15140
+ addOn.planPrice,
15141
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15142
+ ),
15091
15143
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
15092
15144
  "/",
15093
15145
  shortenPeriod(addOn.planPeriod)
@@ -15174,7 +15226,10 @@ var Sidebar = ({
15174
15226
  $size: theme.typography.text.fontSize,
15175
15227
  $weight: theme.typography.text.fontWeight,
15176
15228
  $color: theme.typography.text.color,
15177
- children: formatCurrency(proration)
15229
+ children: formatCurrency(
15230
+ proration,
15231
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15232
+ )
15178
15233
  }
15179
15234
  ) })
15180
15235
  ]
@@ -15278,7 +15333,10 @@ var Sidebar = ({
15278
15333
  $size: theme.typography.text.fontSize,
15279
15334
  $weight: theme.typography.text.fontWeight,
15280
15335
  $color: theme.typography.text.color,
15281
- children: formatCurrency(newCharges / 100 * percentOff)
15336
+ children: formatCurrency(
15337
+ newCharges / 100 * percentOff,
15338
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15339
+ )
15282
15340
  }
15283
15341
  ) })
15284
15342
  ]
@@ -15299,7 +15357,10 @@ var Sidebar = ({
15299
15357
  $weight: theme.typography.text.fontWeight,
15300
15358
  $color: theme.typography.text.color,
15301
15359
  children: t2("X off", {
15302
- amount: formatCurrency(Math.abs(amountOff))
15360
+ amount: formatCurrency(
15361
+ Math.abs(amountOff),
15362
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15363
+ )
15303
15364
  })
15304
15365
  }
15305
15366
  ) }),
@@ -15312,7 +15373,10 @@ var Sidebar = ({
15312
15373
  $color: theme.typography.text.color,
15313
15374
  children: [
15314
15375
  "-",
15315
- formatCurrency(Math.abs(amountOff))
15376
+ formatCurrency(
15377
+ Math.abs(amountOff),
15378
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15379
+ )
15316
15380
  ]
15317
15381
  }
15318
15382
  ) })
@@ -15385,7 +15449,10 @@ var Sidebar = ({
15385
15449
  $size: theme.typography.text.fontSize,
15386
15450
  $weight: theme.typography.text.fontWeight,
15387
15451
  $color: theme.typography.text.color,
15388
- children: formatCurrency(Math.max(0, dueNow))
15452
+ children: formatCurrency(
15453
+ Math.max(0, dueNow),
15454
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15455
+ )
15389
15456
  }
15390
15457
  ) })
15391
15458
  ]
@@ -15412,7 +15479,10 @@ var Sidebar = ({
15412
15479
  $size: theme.typography.text.fontSize,
15413
15480
  $weight: theme.typography.text.fontWeight,
15414
15481
  $color: theme.typography.text.color,
15415
- children: formatCurrency(Math.abs(dueNow))
15482
+ children: formatCurrency(
15483
+ Math.abs(dueNow),
15484
+ (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15485
+ )
15416
15486
  }
15417
15487
  ) })
15418
15488
  ] }),
@@ -15534,6 +15604,7 @@ var Plan = ({
15534
15604
  $flexDirection: "column",
15535
15605
  $gap: "0.5rem",
15536
15606
  $padding: `0 ${cardPadding}rem ${0.75 * cardPadding}rem`,
15607
+ $borderWidth: "0",
15537
15608
  $borderBottomWidth: "1px",
15538
15609
  $borderStyle: "solid",
15539
15610
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
@@ -15572,7 +15643,8 @@ var Plan = ({
15572
15643
  $weight: theme.typography.heading2.fontWeight,
15573
15644
  $color: theme.typography.heading2.color,
15574
15645
  children: formatCurrency(
15575
- (period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0
15646
+ (period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0,
15647
+ (period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.currency
15576
15648
  )
15577
15649
  }
15578
15650
  ),
@@ -15637,6 +15709,7 @@ var Plan = ({
15637
15709
  }[entitlement.metricPeriod];
15638
15710
  }
15639
15711
  const price = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price;
15712
+ const currency = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency;
15640
15713
  if (entitlement.priceBehavior && typeof price !== "number") {
15641
15714
  return acc;
15642
15715
  }
@@ -15668,7 +15741,7 @@ var Plan = ({
15668
15741
  $weight: theme.typography.text.fontWeight,
15669
15742
  $color: theme.typography.text.color,
15670
15743
  children: typeof price !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
15671
- formatCurrency(price),
15744
+ formatCurrency(price, currency),
15672
15745
  " ",
15673
15746
  t2("per"),
15674
15747
  " ",
@@ -15772,7 +15845,7 @@ var Plan = ({
15772
15845
  {
15773
15846
  disabled: isLoading || !plan.valid,
15774
15847
  onClick: () => {
15775
- selectPlan(plan);
15848
+ selectPlan({ plan });
15776
15849
  },
15777
15850
  $size: "sm",
15778
15851
  $color: "primary",
@@ -15858,7 +15931,8 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
15858
15931
  $weight: theme.typography.heading2.fontWeight,
15859
15932
  $color: theme.typography.heading2.color,
15860
15933
  children: formatCurrency(
15861
- (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0
15934
+ (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0,
15935
+ (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.currency
15862
15936
  )
15863
15937
  }
15864
15938
  ),
@@ -16059,7 +16133,8 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
16059
16133
  $color: theme.typography.text.color,
16060
16134
  children: [
16061
16135
  formatCurrency(
16062
- ((period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * quantity
16136
+ ((period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * quantity,
16137
+ (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
16063
16138
  ),
16064
16139
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("sub", { children: [
16065
16140
  "/",
@@ -16077,7 +16152,8 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
16077
16152
  $color: unitPriceColor,
16078
16153
  children: [
16079
16154
  formatCurrency(
16080
- (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0
16155
+ (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0,
16156
+ (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
16081
16157
  ),
16082
16158
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("sub", { children: [
16083
16159
  "/",
@@ -16110,14 +16186,19 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
16110
16186
  var import_react23 = require("react");
16111
16187
 
16112
16188
  // node_modules/@stripe/stripe-js/dist/index.mjs
16113
- var V3_URL = "https://js.stripe.com/v3";
16189
+ var ORIGIN = "https://js.stripe.com";
16190
+ var STRIPE_JS_URL = "".concat(ORIGIN, "/v3");
16114
16191
  var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
16192
+ var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
16115
16193
  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";
16194
+ var isStripeJSURL = function isStripeJSURL2(url) {
16195
+ return V3_URL_REGEX.test(url) || STRIPE_JS_URL_REGEX.test(url);
16196
+ };
16116
16197
  var findScript = function findScript2() {
16117
- var scripts = document.querySelectorAll('script[src^="'.concat(V3_URL, '"]'));
16198
+ var scripts = document.querySelectorAll('script[src^="'.concat(ORIGIN, '"]'));
16118
16199
  for (var i2 = 0; i2 < scripts.length; i2++) {
16119
16200
  var script = scripts[i2];
16120
- if (!V3_URL_REGEX.test(script.src)) {
16201
+ if (!isStripeJSURL(script.src)) {
16121
16202
  continue;
16122
16203
  }
16123
16204
  return script;
@@ -16127,7 +16208,7 @@ var findScript = function findScript2() {
16127
16208
  var injectScript = function injectScript2(params) {
16128
16209
  var queryString = params && !params.advancedFraudSignals ? "?advancedFraudSignals=false" : "";
16129
16210
  var script = document.createElement("script");
16130
- script.src = "".concat(V3_URL).concat(queryString);
16211
+ script.src = "".concat(STRIPE_JS_URL).concat(queryString);
16131
16212
  var headOrBody = document.head || document.body;
16132
16213
  if (!headOrBody) {
16133
16214
  throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
@@ -16141,7 +16222,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
16141
16222
  }
16142
16223
  stripe._registerWrapper({
16143
16224
  name: "stripe-js",
16144
- version: "5.6.0",
16225
+ version: "5.7.0",
16145
16226
  startTime
16146
16227
  });
16147
16228
  };
@@ -16423,12 +16504,6 @@ var CheckoutDialog = ({ top = 0 }) => {
16423
16504
  const modalRef = (0, import_react24.useRef)(null);
16424
16505
  const contentRef = (0, import_react24.useRef)(null);
16425
16506
  const checkoutRef = (0, import_react24.useRef)(null);
16426
- const [checkoutStage, setCheckoutStage] = (0, import_react24.useState)(
16427
- () => selected.addOnId ? "addons" : selected.usage ? "usage" : "plan"
16428
- );
16429
- const [planPeriod, setPlanPeriod] = (0, import_react24.useState)(
16430
- selected.period || data.company?.plan?.planPeriod || "month"
16431
- );
16432
16507
  const [charges, setCharges] = (0, import_react24.useState)();
16433
16508
  const [paymentMethodId, setPaymentMethodId] = (0, import_react24.useState)();
16434
16509
  const [isLoading, setIsLoading] = (0, import_react24.useState)(false);
@@ -16437,13 +16512,18 @@ var CheckoutDialog = ({ top = 0 }) => {
16437
16512
  !data.subscription?.paymentMethod
16438
16513
  );
16439
16514
  const [promoCode, setPromoCode] = (0, import_react24.useState)();
16515
+ const [planPeriod, setPlanPeriod] = (0, import_react24.useState)(
16516
+ selected.period || data.company?.plan?.planPeriod || "month"
16517
+ );
16440
16518
  const {
16441
16519
  plans: availablePlans,
16442
16520
  addOns: availableAddOns,
16443
16521
  periods: availablePeriods
16444
16522
  } = useAvailablePlans(planPeriod);
16445
16523
  const [selectedPlan, setSelectedPlan] = (0, import_react24.useState)(
16446
- () => availablePlans.find((plan) => plan.current)
16524
+ () => availablePlans.find(
16525
+ (plan) => selected.planId ? plan.id === selected.planId : plan.current
16526
+ )
16447
16527
  );
16448
16528
  const currentAddOns = data.company?.addOns || [];
16449
16529
  const [addOns, setAddOns] = (0, import_react24.useState)(
@@ -16506,6 +16586,18 @@ var CheckoutDialog = ({ top = 0 }) => {
16506
16586
  ),
16507
16587
  [usageBasedEntitlements]
16508
16588
  );
16589
+ const [checkoutStage, setCheckoutStage] = (0, import_react24.useState)(() => {
16590
+ if (selected.planId !== currentPlan?.id) {
16591
+ return payInAdvanceEntitlements.length > 0 ? "usage" : "addons";
16592
+ }
16593
+ if (selected.addOnId) {
16594
+ return "addons";
16595
+ }
16596
+ if (selected.usage) {
16597
+ return "usage";
16598
+ }
16599
+ return "plan";
16600
+ });
16509
16601
  const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected === true);
16510
16602
  const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
16511
16603
  ({ quantity }) => quantity > 0
@@ -16550,50 +16642,12 @@ var CheckoutDialog = ({ top = 0 }) => {
16550
16642
  requiresPayment
16551
16643
  ]);
16552
16644
  const isLightBackground = useIsLightBackground();
16553
- const selectPlan = (0, import_react24.useCallback)(
16554
- (updatedPlan, updatedPeriod) => {
16555
- const entitlements = updatedPlan.entitlements.reduce(
16556
- createActiveUsageBasedEntitlementsReducer(updatedPeriod),
16557
- []
16558
- );
16559
- setSelectedPlan(updatedPlan);
16560
- setUsageBasedEntitlements(entitlements);
16561
- },
16562
- [createActiveUsageBasedEntitlementsReducer]
16563
- );
16564
- const toggleAddOn = (id) => {
16565
- setAddOns(
16566
- (prev2) => prev2.map((addOn) => ({
16567
- ...addOn,
16568
- ...addOn.id === id && { isSelected: !addOn.isSelected }
16569
- }))
16570
- );
16571
- };
16572
- const changePlanPeriod = (0, import_react24.useCallback)(
16573
- (period) => {
16574
- if (selectedPlan) {
16575
- selectPlan(selectedPlan, period);
16576
- }
16577
- setPlanPeriod(period);
16578
- },
16579
- [selectedPlan, selectPlan, setPlanPeriod]
16580
- );
16581
- const updateUsageBasedEntitlementQuantity = (id, updatedQuantity) => {
16582
- setUsageBasedEntitlements(
16583
- (prev2) => prev2.map(
16584
- ({ entitlement, allocation, quantity, usage }) => entitlement.id === id ? {
16585
- entitlement,
16586
- allocation,
16587
- quantity: updatedQuantity,
16588
- usage
16589
- } : { entitlement, allocation, quantity, usage }
16590
- )
16591
- );
16592
- };
16593
- (0, import_react24.useEffect)(() => {
16594
- async function previewCheckout() {
16595
- const planPriceId = planPeriod === "month" ? selectedPlan?.monthlyPrice?.id : selectedPlan?.yearlyPrice?.id;
16596
- if (!api || !selectedPlan || !planPriceId) {
16645
+ const previewCheckout = (0, import_react24.useCallback)(
16646
+ async (updates) => {
16647
+ const period = updates.period || planPeriod;
16648
+ const plan = updates.plan || selectedPlan;
16649
+ const planPriceId = period === "month" ? plan?.monthlyPrice?.id : plan?.yearlyPrice?.id;
16650
+ if (!api || !plan || !planPriceId) {
16597
16651
  return;
16598
16652
  }
16599
16653
  setError(void 0);
@@ -16602,23 +16656,26 @@ var CheckoutDialog = ({ top = 0 }) => {
16602
16656
  try {
16603
16657
  const { data: data2 } = await api.previewCheckout({
16604
16658
  changeSubscriptionRequestBody: {
16605
- newPlanId: selectedPlan.id,
16659
+ newPlanId: plan.id,
16606
16660
  newPriceId: planPriceId,
16607
- addOnIds: addOns.reduce((acc, addOn) => {
16608
- if (addOn.isSelected) {
16609
- const addOnPriceId = (planPeriod === "month" ? addOn?.monthlyPrice : addOn?.yearlyPrice)?.id;
16610
- if (addOnPriceId) {
16611
- acc.push({
16612
- addOnId: addOn.id,
16613
- priceId: addOnPriceId
16614
- });
16661
+ addOnIds: (updates.addOns || addOns).reduce(
16662
+ (acc, addOn) => {
16663
+ if (addOn.isSelected) {
16664
+ const addOnPriceId = (period === "month" ? addOn?.monthlyPrice : addOn?.yearlyPrice)?.id;
16665
+ if (addOnPriceId) {
16666
+ acc.push({
16667
+ addOnId: addOn.id,
16668
+ priceId: addOnPriceId
16669
+ });
16670
+ }
16615
16671
  }
16616
- }
16617
- return acc;
16618
- }, []),
16619
- payInAdvance: payInAdvanceEntitlements.reduce(
16672
+ return acc;
16673
+ },
16674
+ []
16675
+ ),
16676
+ payInAdvance: (updates.payInAdvanceEntitlements || payInAdvanceEntitlements).reduce(
16620
16677
  (acc, { entitlement, quantity }) => {
16621
- const priceId = (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.priceId;
16678
+ const priceId = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.priceId;
16622
16679
  if (priceId) {
16623
16680
  acc.push({
16624
16681
  priceId,
@@ -16629,7 +16686,7 @@ var CheckoutDialog = ({ top = 0 }) => {
16629
16686
  },
16630
16687
  []
16631
16688
  ),
16632
- promoCode
16689
+ promoCode: updates.promoCode || promoCode
16633
16690
  }
16634
16691
  });
16635
16692
  setCharges(data2);
@@ -16648,19 +16705,88 @@ var CheckoutDialog = ({ top = 0 }) => {
16648
16705
  } finally {
16649
16706
  setIsLoading(false);
16650
16707
  }
16651
- }
16652
- previewCheckout();
16653
- }, [
16654
- t2,
16655
- api,
16656
- planPeriod,
16657
- selectedPlan,
16658
- addOns,
16659
- payInAdvanceEntitlements,
16660
- promoCode
16661
- ]);
16708
+ },
16709
+ [
16710
+ t2,
16711
+ api,
16712
+ planPeriod,
16713
+ selectedPlan,
16714
+ addOns,
16715
+ payInAdvanceEntitlements,
16716
+ promoCode
16717
+ ]
16718
+ );
16719
+ const selectPlan = (0, import_react24.useCallback)(
16720
+ (updates) => {
16721
+ const plan = updates.plan || selectedPlan;
16722
+ if (!plan) {
16723
+ return;
16724
+ }
16725
+ const period = updates.period || planPeriod;
16726
+ const entitlements = plan.entitlements.reduce(
16727
+ createActiveUsageBasedEntitlementsReducer(period),
16728
+ []
16729
+ );
16730
+ if (updates.plan) {
16731
+ setSelectedPlan(plan);
16732
+ setUsageBasedEntitlements(entitlements);
16733
+ }
16734
+ previewCheckout({
16735
+ period,
16736
+ plan: updates.plan,
16737
+ payInAdvanceEntitlements: entitlements.filter(
16738
+ ({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
16739
+ )
16740
+ });
16741
+ },
16742
+ [
16743
+ planPeriod,
16744
+ selectedPlan,
16745
+ createActiveUsageBasedEntitlementsReducer,
16746
+ previewCheckout
16747
+ ]
16748
+ );
16749
+ const changePlanPeriod = (0, import_react24.useCallback)(
16750
+ (period) => {
16751
+ setPlanPeriod(period);
16752
+ previewCheckout({ period });
16753
+ },
16754
+ [setPlanPeriod, previewCheckout]
16755
+ );
16756
+ const toggleAddOn = (id) => {
16757
+ setAddOns((prev2) => {
16758
+ const updated = prev2.map((addOn) => ({
16759
+ ...addOn,
16760
+ ...addOn.id === id && { isSelected: !addOn.isSelected }
16761
+ }));
16762
+ previewCheckout({ addOns: updated });
16763
+ return updated;
16764
+ });
16765
+ };
16766
+ const updateUsageBasedEntitlementQuantity = (0, import_react24.useCallback)(
16767
+ (id, updatedQuantity) => {
16768
+ setUsageBasedEntitlements((prev2) => {
16769
+ const updated = prev2.map(
16770
+ ({ entitlement, allocation, quantity, usage }) => entitlement.id === id ? {
16771
+ entitlement,
16772
+ allocation,
16773
+ quantity: updatedQuantity,
16774
+ usage
16775
+ } : { entitlement, allocation, quantity, usage }
16776
+ );
16777
+ previewCheckout({
16778
+ payInAdvanceEntitlements: updated.filter(
16779
+ ({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
16780
+ )
16781
+ });
16782
+ return updated;
16783
+ });
16784
+ },
16785
+ [previewCheckout]
16786
+ );
16662
16787
  const updatePromoCode = (code) => {
16663
16788
  setPromoCode(code);
16789
+ previewCheckout({ promoCode: code });
16664
16790
  };
16665
16791
  (0, import_react24.useEffect)(() => {
16666
16792
  if (charges) {
@@ -17426,6 +17552,18 @@ var Details = ({
17426
17552
  const { t: t2 } = useTranslation();
17427
17553
  const theme = nt();
17428
17554
  const { data } = useEmbed();
17555
+ const currency = (0, import_react31.useMemo)(() => {
17556
+ if (data.company?.plan?.planPeriod === "month") {
17557
+ return monthlyUsageBasedPrice?.currency;
17558
+ }
17559
+ if (data.company?.plan?.planPeriod === "year") {
17560
+ return yearlyUsageBasedPrice?.currency;
17561
+ }
17562
+ }, [
17563
+ data.company?.plan?.planPeriod,
17564
+ monthlyUsageBasedPrice,
17565
+ yearlyUsageBasedPrice
17566
+ ]);
17429
17567
  const price = (0, import_react31.useMemo)(() => {
17430
17568
  if (data.company?.plan?.planPeriod === "month") {
17431
17569
  return monthlyUsageBasedPrice?.price;
@@ -17446,7 +17584,7 @@ var Details = ({
17446
17584
  return `${formatNumber(allocation)} ${(0, import_pluralize4.default)(feature.name, allocation)}`;
17447
17585
  }
17448
17586
  if (priceBehavior === "pay_as_you_go" && typeof price === "number") {
17449
- return `${formatCurrency(price)} ${t2("per")} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}`;
17587
+ return `${formatCurrency(price, currency)} ${t2("per")} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}`;
17450
17588
  }
17451
17589
  if (!priceBehavior && typeof allocation === "number") {
17452
17590
  return `${formatNumber(allocation)} ${(0, import_pluralize4.default)(feature.name, allocation)}`;
@@ -17462,15 +17600,15 @@ var Details = ({
17462
17600
  if (usageData) {
17463
17601
  let acc;
17464
17602
  if (priceBehavior === "pay_in_advance" && typeof data.company?.plan?.planPeriod === "string" && typeof price === "number") {
17465
- acc = `${formatCurrency(price)}/${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}/${shortenPeriod(data.company.plan.planPeriod)}`;
17603
+ acc = `${formatCurrency(price, currency)}/${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}/${shortenPeriod(data.company.plan.planPeriod)}`;
17466
17604
  } else if (priceBehavior === "pay_as_you_go" && typeof usage === "number") {
17467
17605
  acc = `${usage} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), usage)} ${t2("used")}`;
17468
17606
  }
17469
17607
  if (acc) {
17470
17608
  if (usageData?.priceBehavior === "pay_in_advance" && typeof price === "number" && typeof allocation === "number") {
17471
- acc += ` \u2022 ${formatCurrency(price * allocation)}`;
17609
+ acc += ` \u2022 ${formatCurrency(price * allocation, currency)}`;
17472
17610
  } else if (usageData?.priceBehavior === "pay_as_you_go" && typeof price === "number" && typeof usage === "number") {
17473
- acc += ` \u2022 ${formatCurrency(price * usage)}`;
17611
+ acc += ` \u2022 ${formatCurrency(price * usage, currency)}`;
17474
17612
  }
17475
17613
  return acc;
17476
17614
  }
@@ -17772,9 +17910,9 @@ function resolveDesignProps2(props) {
17772
17910
  function formatInvoices(invoices) {
17773
17911
  return (invoices || []).filter(
17774
17912
  ({ url, amountDue, amountPaid }) => url && (amountDue === 0 || amountPaid > 0)
17775
- ).sort((a2, b2) => a2.dueDate && b2.dueDate ? +b2.dueDate - +a2.dueDate : 1).map(({ amountDue, dueDate, url }) => ({
17913
+ ).sort((a2, b2) => a2.dueDate && b2.dueDate ? +b2.dueDate - +a2.dueDate : 1).map(({ amountDue, dueDate, url, currency }) => ({
17776
17914
  ...dueDate && { date: toPrettyDate(dueDate) },
17777
- amount: formatCurrency(amountDue),
17915
+ amount: formatCurrency(amountDue, currency),
17778
17916
  url
17779
17917
  }));
17780
17918
  }
@@ -17957,10 +18095,13 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
17957
18095
  yearlyUsageBasedPrice
17958
18096
  }, index) => {
17959
18097
  let price;
18098
+ let currency;
17960
18099
  if (planPeriod === "month") {
17961
18100
  price = monthlyUsageBasedPrice?.price;
18101
+ currency = monthlyUsageBasedPrice?.currency;
17962
18102
  } else if (planPeriod === "year") {
17963
18103
  price = yearlyUsageBasedPrice?.price;
18104
+ currency = yearlyUsageBasedPrice?.currency;
17964
18105
  }
17965
18106
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Element, { as: Flex, $gap: "1.5rem", children: [
17966
18107
  props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
@@ -18034,7 +18175,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
18034
18175
  formatNumber(allocation),
18035
18176
  " ",
18036
18177
  (0, import_pluralize5.default)(feature.name, allocation)
18037
- ] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
18178
+ ] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
18038
18179
  formatNumber(usage),
18039
18180
  " ",
18040
18181
  (0, import_pluralize5.default)(feature.name, usage)
@@ -18519,19 +18660,23 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
18519
18660
  (acc, usage) => {
18520
18661
  const quantity = usage?.allocation ?? 0;
18521
18662
  let price;
18663
+ let currencyCode = "USD";
18522
18664
  if (currentPlan?.planPeriod === "month") {
18523
18665
  price = usage.monthlyUsageBasedPrice?.price;
18666
+ currencyCode = usage.monthlyUsageBasedPrice?.currency ?? "USD";
18524
18667
  } else if (currentPlan?.planPeriod === "year") {
18525
18668
  price = usage.yearlyUsageBasedPrice?.price;
18669
+ currencyCode = usage.yearlyUsageBasedPrice?.currency ?? "USD";
18526
18670
  }
18527
18671
  if (usage.priceBehavior && typeof price === "number" && quantity > 0) {
18528
- acc.push({ ...usage, price, quantity });
18672
+ acc.push({ ...usage, price, quantity, currencyCode });
18529
18673
  }
18530
18674
  return acc;
18531
18675
  },
18532
18676
  []
18533
18677
  );
18534
18678
  const billingSubscription = data.company?.billingSubscription;
18679
+ const subscriptionCurrency = billingSubscription?.currency ?? "USD";
18535
18680
  const showTrialBox = billingSubscription && billingSubscription.status == "trialing";
18536
18681
  const trialEndDate = billingSubscription?.trialEnd ? new Date(billingSubscription.trialEnd * 1e3) : /* @__PURE__ */ new Date();
18537
18682
  const todayDate = /* @__PURE__ */ new Date();
@@ -18625,7 +18770,10 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
18625
18770
  $size: theme.typography[props.header.price.fontStyle].fontSize,
18626
18771
  $weight: theme.typography[props.header.price.fontStyle].fontWeight,
18627
18772
  $color: theme.typography[props.header.price.fontStyle].color,
18628
- children: formatCurrency(currentPlan.planPrice)
18773
+ children: formatCurrency(
18774
+ currentPlan.planPrice,
18775
+ subscriptionCurrency
18776
+ )
18629
18777
  }
18630
18778
  ),
18631
18779
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
@@ -18683,7 +18831,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
18683
18831
  $weight: theme.typography.text.fontWeight,
18684
18832
  $color: theme.typography.text.color,
18685
18833
  children: [
18686
- formatCurrency(addOn.planPrice),
18834
+ formatCurrency(addOn.planPrice, subscriptionCurrency),
18687
18835
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("sub", { children: [
18688
18836
  "/",
18689
18837
  shortenPeriod(addOn.planPeriod)
@@ -18746,7 +18894,10 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
18746
18894
  $weight: theme.typography.text.fontWeight,
18747
18895
  $color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
18748
18896
  children: [
18749
- formatCurrency(entitlement.price),
18897
+ formatCurrency(
18898
+ entitlement.price,
18899
+ entitlement.currencyCode
18900
+ ),
18750
18901
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("sub", { children: [
18751
18902
  "/",
18752
18903
  (0, import_pluralize6.default)(
@@ -18768,7 +18919,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
18768
18919
  $color: theme.typography.text.color,
18769
18920
  children: [
18770
18921
  formatCurrency(
18771
- entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1)
18922
+ entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1),
18923
+ entitlement.currencyCode
18772
18924
  ),
18773
18925
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("sub", { children: [
18774
18926
  "/",
@@ -18948,7 +19100,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
18948
19100
  $display: "grid",
18949
19101
  $gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
18950
19102
  $gap: "1rem",
18951
- children: plans.map((plan, index, self2) => {
19103
+ children: plans.map((plan, index) => {
18952
19104
  const isActivePlan = plan.current && data.company?.plan?.planPeriod === selectedPeriod;
18953
19105
  const count = entitlementCounts[plan.id];
18954
19106
  let isExpanded = false;
@@ -18974,6 +19126,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
18974
19126
  $flexDirection: "column",
18975
19127
  $gap: "0.75rem",
18976
19128
  $padding: `0 ${cardPadding}rem ${0.75 * cardPadding}rem`,
19129
+ $borderWidth: "0",
18977
19130
  $borderBottomWidth: "1px",
18978
19131
  $borderStyle: "solid",
18979
19132
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
@@ -19007,7 +19160,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
19007
19160
  $weight: theme.typography[props.plans.name.fontStyle].fontWeight,
19008
19161
  $color: theme.typography[props.plans.name.fontStyle].color,
19009
19162
  children: formatCurrency(
19010
- (selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0
19163
+ (selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0,
19164
+ (selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.currency
19011
19165
  )
19012
19166
  }
19013
19167
  ),
@@ -19052,18 +19206,6 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
19052
19206
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
19053
19207
  children: [
19054
19208
  props.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: [
19055
- props.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
19056
- Text,
19057
- {
19058
- $font: theme.typography.text.fontFamily,
19059
- $size: theme.typography.text.fontSize,
19060
- $weight: theme.typography.text.fontWeight,
19061
- $color: theme.typography.text.color,
19062
- children: t2("Everything in", {
19063
- plan: self2[index - 1].name
19064
- })
19065
- }
19066
- ) }),
19067
19209
  plan.entitlements.slice().sort((a2, b2) => {
19068
19210
  if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
19069
19211
  return 1;
@@ -19074,10 +19216,13 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
19074
19216
  return 0;
19075
19217
  }).reduce((acc, entitlement) => {
19076
19218
  let price;
19219
+ let currency;
19077
19220
  if (selectedPeriod === "month") {
19078
19221
  price = entitlement.meteredMonthlyPrice?.price;
19222
+ currency = entitlement.meteredMonthlyPrice?.currency;
19079
19223
  } else if (selectedPeriod === "year") {
19080
19224
  price = entitlement.meteredYearlyPrice?.price;
19225
+ currency = entitlement.meteredYearlyPrice?.currency;
19081
19226
  }
19082
19227
  if (entitlement.priceBehavior && typeof price !== "number") {
19083
19228
  return acc;
@@ -19104,7 +19249,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
19104
19249
  $color: theme.typography.text.color,
19105
19250
  $leading: 1.35,
19106
19251
  children: typeof price !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
19107
- formatCurrency(price),
19252
+ formatCurrency(price, currency),
19108
19253
  " ",
19109
19254
  t2("per"),
19110
19255
  " ",
@@ -19322,7 +19467,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
19322
19467
  $weight: theme.typography[props.plans.name.fontStyle].fontWeight,
19323
19468
  $color: theme.typography[props.plans.name.fontStyle].color,
19324
19469
  children: formatCurrency(
19325
- (selectedPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0
19470
+ (selectedPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0,
19471
+ (selectedPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.currency
19326
19472
  )
19327
19473
  }
19328
19474
  ),
@@ -19505,7 +19651,8 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
19505
19651
  },
19506
19652
  ...data.upcomingInvoice?.dueDate && {
19507
19653
  dueDate: toPrettyDate(new Date(data.upcomingInvoice.dueDate))
19508
- }
19654
+ },
19655
+ currency: data.upcomingInvoice?.currency
19509
19656
  }
19510
19657
  };
19511
19658
  }, [data.subscription, data.upcomingInvoice]);
@@ -19544,7 +19691,10 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
19544
19691
  $weight: theme.typography[props.price.fontStyle].fontWeight,
19545
19692
  $color: theme.typography[props.price.fontStyle].color,
19546
19693
  $leading: 1,
19547
- children: formatCurrency(upcomingInvoice.amountDue)
19694
+ children: formatCurrency(
19695
+ upcomingInvoice.amountDue,
19696
+ upcomingInvoice.currency
19697
+ )
19548
19698
  }
19549
19699
  ) }),
19550
19700
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -19559,7 +19709,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
19559
19709
  }
19560
19710
  ) })
19561
19711
  ] }),
19562
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
19712
+ discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
19563
19713
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
19564
19714
  Text,
19565
19715
  {
@@ -19714,7 +19864,7 @@ var Error2 = ({ message }) => {
19714
19864
  );
19715
19865
  };
19716
19866
  var ComponentTree = () => {
19717
- const { error, nodes } = useEmbed();
19867
+ const { error, nodes, isPending } = useEmbed();
19718
19868
  const [children, setChildren] = (0, import_react40.useState)(/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Loading, {}));
19719
19869
  (0, import_react40.useEffect)(() => {
19720
19870
  const renderer = createRenderer();
@@ -19724,7 +19874,7 @@ var ComponentTree = () => {
19724
19874
  console.error(error);
19725
19875
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Error2, { message: error.message });
19726
19876
  }
19727
- if (import_react40.Children.count(children) === 0) {
19877
+ if (isPending) {
19728
19878
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Loading, {});
19729
19879
  }
19730
19880
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });