@schematichq/schematic-components 0.4.10 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10590,6 +10590,7 @@ function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator
10590
10590
  ),
10591
10591
  productId: json["product_id"],
10592
10592
  quantity: json["quantity"],
10593
+ subscriptionCount: json["subscription_count"],
10593
10594
  updatedAt: new Date(json["updated_at"])
10594
10595
  };
10595
10596
  }
@@ -10662,6 +10663,7 @@ function BillingSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
10662
10663
  createdAt: new Date(json["created_at"]),
10663
10664
  currency: json["currency"],
10664
10665
  customerExternalId: json["customer_external_id"],
10666
+ defaultPaymentMethodId: json["default_payment_method_id"] == null ? void 0 : json["default_payment_method_id"],
10665
10667
  expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
10666
10668
  id: json["id"],
10667
10669
  interval: json["interval"],
@@ -10730,7 +10732,6 @@ function PaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
10730
10732
  externalId: json["external_id"],
10731
10733
  id: json["id"],
10732
10734
  paymentMethodType: json["payment_method_type"],
10733
- subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
10734
10735
  updatedAt: new Date(json["updated_at"])
10735
10736
  };
10736
10737
  }
@@ -10750,6 +10751,7 @@ function BillingSubscriptionViewFromJSONTyped(json, ignoreDiscriminator) {
10750
10751
  createdAt: new Date(json["created_at"]),
10751
10752
  currency: json["currency"],
10752
10753
  customerExternalId: json["customer_external_id"],
10754
+ defaultPaymentMethodId: json["default_payment_method_id"] == null ? void 0 : json["default_payment_method_id"],
10753
10755
  discounts: json["discounts"].map(
10754
10756
  BillingSubscriptionDiscountViewFromJSON
10755
10757
  ),
@@ -11019,6 +11021,9 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11019
11021
  CompanyEventPeriodMetricsResponseDataFromJSON
11020
11022
  ),
11021
11023
  name: json["name"],
11024
+ paymentMethods: json["payment_methods"].map(
11025
+ PaymentMethodResponseDataFromJSON
11026
+ ),
11022
11027
  plan: json["plan"] == null ? void 0 : CompanyPlanWithBillingSubViewFromJSON(json["plan"]),
11023
11028
  plans: json["plans"].map(GenericPreviewObjectFromJSON),
11024
11029
  traits: json["traits"] == null ? void 0 : json["traits"],
@@ -11181,6 +11186,8 @@ function FeatureResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11181
11186
  lifecyclePhase: json["lifecycle_phase"] == null ? void 0 : json["lifecycle_phase"],
11182
11187
  maintainerId: json["maintainer_id"] == null ? void 0 : json["maintainer_id"],
11183
11188
  name: json["name"],
11189
+ pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
11190
+ singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
11184
11191
  traitId: json["trait_id"] == null ? void 0 : json["trait_id"],
11185
11192
  updatedAt: new Date(json["updated_at"])
11186
11193
  };
@@ -11232,6 +11239,8 @@ function FeatureDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11232
11239
  maintainerId: json["maintainer_id"] == null ? void 0 : json["maintainer_id"],
11233
11240
  name: json["name"],
11234
11241
  plans: json["plans"].map(PreviewObjectFromJSON),
11242
+ pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
11243
+ singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
11235
11244
  trait: json["trait"] == null ? void 0 : EntityTraitDefinitionResponseDataFromJSON(json["trait"]),
11236
11245
  traitId: json["trait_id"] == null ? void 0 : json["trait_id"],
11237
11246
  updatedAt: new Date(json["updated_at"])
@@ -11281,6 +11290,7 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11281
11290
  priceBehavior: json["price_behavior"] == null ? void 0 : json["price_behavior"],
11282
11291
  ruleId: json["rule_id"],
11283
11292
  ruleIdUsageExceeded: json["rule_id_usage_exceeded"] == null ? void 0 : json["rule_id_usage_exceeded"],
11293
+ softLimit: json["soft_limit"] == null ? void 0 : json["soft_limit"],
11284
11294
  updatedAt: new Date(json["updated_at"]),
11285
11295
  valueBool: json["value_bool"] == null ? void 0 : json["value_bool"],
11286
11296
  valueNumeric: json["value_numeric"] == null ? void 0 : json["value_numeric"],
@@ -11384,6 +11394,7 @@ function ComponentCapabilitiesFromJSONTyped(json, ignoreDiscriminator) {
11384
11394
  return json;
11385
11395
  }
11386
11396
  return {
11397
+ badgeVisibility: json["badge_visibility"],
11387
11398
  checkout: json["checkout"]
11388
11399
  };
11389
11400
  }
@@ -11482,6 +11493,7 @@ function FeatureUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11482
11493
  period: json["period"] == null ? void 0 : json["period"],
11483
11494
  plan: json["plan"] == null ? void 0 : PlanResponseDataFromJSON(json["plan"]),
11484
11495
  priceBehavior: json["price_behavior"] == null ? void 0 : json["price_behavior"],
11496
+ softLimit: json["soft_limit"] == null ? void 0 : json["soft_limit"],
11485
11497
  usage: json["usage"] == null ? void 0 : json["usage"],
11486
11498
  yearlyUsageBasedPrice: json["yearly_usage_based_price"] == null ? void 0 : BillingPriceViewFromJSON(json["yearly_usage_based_price"])
11487
11499
  };
@@ -11544,6 +11556,20 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
11544
11556
  };
11545
11557
  }
11546
11558
 
11559
+ // src/api/models/DeletePaymentMethodResponse.ts
11560
+ function DeletePaymentMethodResponseFromJSON(json) {
11561
+ return DeletePaymentMethodResponseFromJSONTyped(json, false);
11562
+ }
11563
+ function DeletePaymentMethodResponseFromJSONTyped(json, ignoreDiscriminator) {
11564
+ if (json == null) {
11565
+ return json;
11566
+ }
11567
+ return {
11568
+ data: DeleteResponseFromJSON(json["data"]),
11569
+ params: json["params"]
11570
+ };
11571
+ }
11572
+
11547
11573
  // src/api/models/SetupIntentResponseData.ts
11548
11574
  function SetupIntentResponseDataFromJSON(json) {
11549
11575
  return SetupIntentResponseDataFromJSONTyped(json, false);
@@ -11748,6 +11774,50 @@ var CheckoutexternalApi = class extends BaseAPI {
11748
11774
  const response = await this.checkoutUnsubscribeRaw(initOverrides);
11749
11775
  return await response.value();
11750
11776
  }
11777
+ /**
11778
+ * Delete payment method
11779
+ */
11780
+ async deletePaymentMethodRaw(requestParameters, initOverrides) {
11781
+ if (requestParameters["checkoutId"] == null) {
11782
+ throw new RequiredError(
11783
+ "checkoutId",
11784
+ 'Required parameter "checkoutId" was null or undefined when calling deletePaymentMethod().'
11785
+ );
11786
+ }
11787
+ const queryParameters = {};
11788
+ const headerParameters = {};
11789
+ if (this.configuration && this.configuration.apiKey) {
11790
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
11791
+ "X-Schematic-Api-Key"
11792
+ );
11793
+ }
11794
+ const response = await this.request(
11795
+ {
11796
+ path: `/checkout/paymentmethod/{checkout_id}`.replace(
11797
+ `{${"checkout_id"}}`,
11798
+ encodeURIComponent(String(requestParameters["checkoutId"]))
11799
+ ),
11800
+ method: "DELETE",
11801
+ headers: headerParameters,
11802
+ query: queryParameters
11803
+ },
11804
+ initOverrides
11805
+ );
11806
+ return new JSONApiResponse(
11807
+ response,
11808
+ (jsonValue) => DeletePaymentMethodResponseFromJSON(jsonValue)
11809
+ );
11810
+ }
11811
+ /**
11812
+ * Delete payment method
11813
+ */
11814
+ async deletePaymentMethod(requestParameters, initOverrides) {
11815
+ const response = await this.deletePaymentMethodRaw(
11816
+ requestParameters,
11817
+ initOverrides
11818
+ );
11819
+ return await response.value();
11820
+ }
11751
11821
  /**
11752
11822
  * Get setup intent
11753
11823
  */
@@ -12025,6 +12095,8 @@ var en_default = {
12025
12095
  "Not ready to cancel?": "Not ready to cancel?",
12026
12096
  "Optionally add features to your subscription": "Optionally add features to your subscription",
12027
12097
  "Other existing payment method": "Other existing payment method",
12098
+ Overage: "Overage",
12099
+ "Overage fee": "Overage fee",
12028
12100
  "Over usage limit": "Over usage limit",
12029
12101
  "Pay now": "Pay now",
12030
12102
  "Payment Method": "Payment Method",
@@ -12062,12 +12134,14 @@ var en_default = {
12062
12134
  "Use existing payment method": "Use existing payment method",
12063
12135
  "X% off": "{{percent}}% off",
12064
12136
  "X off": "{{amount}} off",
12137
+ "X over the limit": "{{amount}} over the limit",
12065
12138
  Yearly: "Yearly",
12066
12139
  "You will retain access to your plan until the end of the billing period, on": "You will retain access to your plan until the end of the billing period, on",
12067
12140
  day: "day",
12068
12141
  month: "month",
12069
12142
  per: "per",
12070
12143
  year: "year",
12144
+ "overage fee": "overage fee",
12071
12145
  used: "used",
12072
12146
  usage: {
12073
12147
  limited: "{{amount}} of {{allocation}} used",
@@ -12824,7 +12898,7 @@ var EmbedProvider = ({
12824
12898
  (0, import_react11.useEffect)(() => {
12825
12899
  if (accessToken) {
12826
12900
  const { headers = {} } = apiConfig ?? {};
12827
- headers["X-Schematic-Components-Version"] = "0.4.10";
12901
+ headers["X-Schematic-Components-Version"] = "0.5.0";
12828
12902
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
12829
12903
  const config = new Configuration({
12830
12904
  ...apiConfig,
@@ -13834,6 +13908,9 @@ var Modal = (0, import_react17.forwardRef)(
13834
13908
  setLayout("portal");
13835
13909
  onClose?.();
13836
13910
  }, [setLayout, onClose]);
13911
+ (0, import_react17.useLayoutEffect)(() => {
13912
+ contentRef?.current?.focus({ preventScroll: true });
13913
+ }, [contentRef]);
13837
13914
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
13838
13915
  Container2,
13839
13916
  {
@@ -13867,6 +13944,9 @@ var Modal = (0, import_react17.forwardRef)(
13867
13944
  Flex,
13868
13945
  {
13869
13946
  ref: contentRef,
13947
+ tabIndex: 0,
13948
+ role: "dialog",
13949
+ "aria-modal": "true",
13870
13950
  $position: "relative",
13871
13951
  $top: "50%",
13872
13952
  $left: "50%",
@@ -13877,8 +13957,6 @@ var Modal = (0, import_react17.forwardRef)(
13877
13957
  $height: "100vh",
13878
13958
  $backgroundColor: theme.card.background,
13879
13959
  $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
13880
- role: "dialog",
13881
- "aria-modal": "true",
13882
13960
  $viewport: {
13883
13961
  md: {
13884
13962
  ...size === "auto" ? { $width: "fit-content", $height: "fit-content" } : {
@@ -13979,6 +14057,7 @@ var ProgressBar = ({
13979
14057
  value,
13980
14058
  total = 0,
13981
14059
  color = "gray",
14060
+ bgColor = "#F2F4F7",
13982
14061
  barWidth = "100%",
13983
14062
  ...props
13984
14063
  }) => {
@@ -14010,7 +14089,7 @@ var ProgressBar = ({
14010
14089
  $overflow: "hidden",
14011
14090
  $width: "100%",
14012
14091
  $height: `${8 / TEXT_BASE_SIZE}rem`,
14013
- $backgroundColor: "#F2F4F7",
14092
+ $backgroundColor: bgColor,
14014
14093
  $borderRadius: "9999px",
14015
14094
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
14016
14095
  Box,
@@ -14277,114 +14356,12 @@ var import_react_dom2 = require("react-dom");
14277
14356
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
14278
14357
  var import_react24 = require("react");
14279
14358
 
14280
- // src/components/shared/checkout-dialog/Navigation.tsx
14281
- var import_jsx_runtime10 = require("react/jsx-runtime");
14282
- var Navigation = ({
14283
- name,
14284
- index,
14285
- activeIndex,
14286
- isLast,
14287
- onClick
14288
- }) => {
14289
- const theme = nt();
14290
- const isLightBackground = useIsLightBackground();
14291
- const showFullContent = index === activeIndex || index === activeIndex + 1;
14292
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
14293
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
14294
- Flex,
14295
- {
14296
- $gap: "0.5rem",
14297
- $alignItems: "center",
14298
- ...!showFullContent && { $flexGrow: 1, $minWidth: 0 },
14299
- children: [
14300
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14301
- Box,
14302
- {
14303
- $display: "none",
14304
- $viewport: {
14305
- md: {
14306
- $display: "block"
14307
- }
14308
- },
14309
- children: index >= activeIndex ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14310
- Box,
14311
- {
14312
- $width: `${20 / TEXT_BASE_SIZE}rem`,
14313
- $height: `${20 / TEXT_BASE_SIZE}rem`,
14314
- $borderWidth: "2px",
14315
- $borderStyle: "solid",
14316
- $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)",
14317
- $borderRadius: "9999px"
14318
- }
14319
- ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14320
- IconRound,
14321
- {
14322
- name: "check",
14323
- colors: [
14324
- theme.card.background,
14325
- isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)"
14326
- ],
14327
- style: {
14328
- fontSize: `${16 / TEXT_BASE_SIZE}rem`,
14329
- width: `${20 / TEXT_BASE_SIZE}rem`,
14330
- height: `${20 / TEXT_BASE_SIZE}rem`
14331
- }
14332
- }
14333
- )
14334
- }
14335
- ),
14336
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
14337
- Box,
14338
- {
14339
- tabIndex: 0,
14340
- $fontSize: `${16 / TEXT_BASE_SIZE}rem`,
14341
- $fontFamily: theme.typography.text.fontFamily,
14342
- $fontWeight: index === activeIndex ? 600 : 400,
14343
- $color: theme.typography.text.color,
14344
- ...!showFullContent && {
14345
- $overflow: "hidden",
14346
- $whiteSpace: "nowrap",
14347
- $textOverflow: "ellipsis"
14348
- },
14349
- ...index !== activeIndex && { $opacity: "0.6375" },
14350
- ...index < activeIndex && {
14351
- onClick,
14352
- $cursor: "pointer"
14353
- },
14354
- $viewport: {
14355
- md: {
14356
- $fontSize: `${19 / TEXT_BASE_SIZE}rem`
14357
- }
14358
- },
14359
- children: [
14360
- index + 1,
14361
- ". ",
14362
- name
14363
- ]
14364
- }
14365
- )
14366
- ]
14367
- }
14368
- ),
14369
- !isLast && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14370
- Icon2,
14371
- {
14372
- name: "chevron-right",
14373
- style: {
14374
- fontSize: 16,
14375
- color: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.35)"
14376
- }
14377
- }
14378
- )
14379
- ] });
14380
- };
14381
-
14382
14359
  // src/components/shared/sidebar/Sidebar.tsx
14383
14360
  var import_react21 = require("react");
14384
14361
  var import_pluralize = __toESM(require_pluralize());
14385
14362
 
14386
14363
  // src/components/shared/sidebar/StageButton.tsx
14387
- var import_jsx_runtime11 = require("react/jsx-runtime");
14364
+ var import_jsx_runtime10 = require("react/jsx-runtime");
14388
14365
  var StageButton = ({
14389
14366
  canTrial,
14390
14367
  canCheckout,
@@ -14401,7 +14378,7 @@ var StageButton = ({
14401
14378
  }) => {
14402
14379
  const { t: t2 } = useTranslation();
14403
14380
  const NoPaymentRequired = () => {
14404
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14381
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14405
14382
  EmbedButton,
14406
14383
  {
14407
14384
  type: "button",
@@ -14415,7 +14392,7 @@ var StageButton = ({
14415
14392
  if (checkoutStage === "plan") {
14416
14393
  if (canTrial) {
14417
14394
  if (trialPaymentMethodRequired) {
14418
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14395
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14419
14396
  EmbedButton,
14420
14397
  {
14421
14398
  type: "button",
@@ -14424,7 +14401,7 @@ var StageButton = ({
14424
14401
  setCheckoutStage?.("checkout");
14425
14402
  },
14426
14403
  isLoading,
14427
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14404
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
14428
14405
  Flex,
14429
14406
  {
14430
14407
  $gap: "0.5rem",
@@ -14435,14 +14412,14 @@ var StageButton = ({
14435
14412
  t2("Next"),
14436
14413
  ": ",
14437
14414
  t2("Checkout"),
14438
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon2, { name: "arrow-right" })
14415
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { name: "arrow-right" })
14439
14416
  ]
14440
14417
  }
14441
14418
  )
14442
14419
  }
14443
14420
  );
14444
14421
  }
14445
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14422
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14446
14423
  EmbedButton,
14447
14424
  {
14448
14425
  type: "button",
@@ -14451,7 +14428,7 @@ var StageButton = ({
14451
14428
  checkout();
14452
14429
  },
14453
14430
  isLoading,
14454
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14431
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
14455
14432
  Flex,
14456
14433
  {
14457
14434
  $gap: "0.5rem",
@@ -14460,7 +14437,7 @@ var StageButton = ({
14460
14437
  $padding: "0 1rem",
14461
14438
  children: [
14462
14439
  t2("Subscribe and close"),
14463
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon2, { name: "arrow-right" })
14440
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { name: "arrow-right" })
14464
14441
  ]
14465
14442
  }
14466
14443
  )
@@ -14470,9 +14447,9 @@ var StageButton = ({
14470
14447
  if (!requiresPayment && !checkoutStages?.some(
14471
14448
  (stage) => stage.id === "addons" || stage.id === "usage"
14472
14449
  )) {
14473
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NoPaymentRequired, {});
14450
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NoPaymentRequired, {});
14474
14451
  }
14475
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14452
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14476
14453
  EmbedButton,
14477
14454
  {
14478
14455
  type: "button",
@@ -14483,7 +14460,7 @@ var StageButton = ({
14483
14460
  );
14484
14461
  },
14485
14462
  isLoading,
14486
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14463
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
14487
14464
  Flex,
14488
14465
  {
14489
14466
  $gap: "0.5rem",
@@ -14495,7 +14472,7 @@ var StageButton = ({
14495
14472
  ":",
14496
14473
  " ",
14497
14474
  hasPayInAdvanceEntitlements ? t2("Usage") : hasAddOns ? t2("Addons") : t2("Checkout"),
14498
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon2, { name: "arrow-right" })
14475
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { name: "arrow-right" })
14499
14476
  ]
14500
14477
  }
14501
14478
  )
@@ -14504,9 +14481,9 @@ var StageButton = ({
14504
14481
  }
14505
14482
  if (checkoutStage === "usage") {
14506
14483
  if (!requiresPayment) {
14507
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NoPaymentRequired, {});
14484
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NoPaymentRequired, {});
14508
14485
  }
14509
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14486
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14510
14487
  EmbedButton,
14511
14488
  {
14512
14489
  type: "button",
@@ -14515,7 +14492,7 @@ var StageButton = ({
14515
14492
  setCheckoutStage?.(hasAddOns ? "addons" : "checkout");
14516
14493
  },
14517
14494
  isLoading,
14518
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14495
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
14519
14496
  Flex,
14520
14497
  {
14521
14498
  $gap: "0.5rem",
@@ -14526,7 +14503,7 @@ var StageButton = ({
14526
14503
  t2("Next"),
14527
14504
  ": ",
14528
14505
  hasAddOns ? t2("Addons") : t2("Checkout"),
14529
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon2, { name: "arrow-right" })
14506
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { name: "arrow-right" })
14530
14507
  ]
14531
14508
  }
14532
14509
  )
@@ -14535,9 +14512,9 @@ var StageButton = ({
14535
14512
  }
14536
14513
  if (checkoutStage === "addons") {
14537
14514
  if (!requiresPayment) {
14538
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NoPaymentRequired, {});
14515
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NoPaymentRequired, {});
14539
14516
  }
14540
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14517
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14541
14518
  EmbedButton,
14542
14519
  {
14543
14520
  type: "button",
@@ -14546,7 +14523,7 @@ var StageButton = ({
14546
14523
  setCheckoutStage?.("checkout");
14547
14524
  },
14548
14525
  isLoading,
14549
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14526
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
14550
14527
  Flex,
14551
14528
  {
14552
14529
  $gap: "0.5rem",
@@ -14557,7 +14534,7 @@ var StageButton = ({
14557
14534
  t2("Next"),
14558
14535
  ": ",
14559
14536
  t2("Checkout"),
14560
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon2, { name: "arrow-right" })
14537
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { name: "arrow-right" })
14561
14538
  ]
14562
14539
  }
14563
14540
  )
@@ -14566,9 +14543,9 @@ var StageButton = ({
14566
14543
  }
14567
14544
  if (checkoutStage === "checkout") {
14568
14545
  if (!requiresPayment) {
14569
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NoPaymentRequired, {});
14546
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NoPaymentRequired, {});
14570
14547
  }
14571
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14548
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
14572
14549
  EmbedButton,
14573
14550
  {
14574
14551
  type: "button",
@@ -14582,7 +14559,7 @@ var StageButton = ({
14582
14559
  };
14583
14560
 
14584
14561
  // src/components/shared/sidebar/Sidebar.tsx
14585
- var import_jsx_runtime12 = require("react/jsx-runtime");
14562
+ var import_jsx_runtime11 = require("react/jsx-runtime");
14586
14563
  var Sidebar = ({
14587
14564
  planPeriod,
14588
14565
  selectedPlan,
@@ -14815,7 +14792,7 @@ var Sidebar = ({
14815
14792
  if (isTrialable && selectedPlan.trialDays) {
14816
14793
  trialEndsOn.setDate(trialEndsOn.getDate() + selectedPlan.trialDays);
14817
14794
  }
14818
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
14795
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14819
14796
  Flex,
14820
14797
  {
14821
14798
  ref: checkoutRef,
@@ -14832,7 +14809,7 @@ var Sidebar = ({
14832
14809
  }
14833
14810
  },
14834
14811
  children: [
14835
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
14812
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14836
14813
  Flex,
14837
14814
  {
14838
14815
  $position: "relative",
@@ -14844,7 +14821,7 @@ var Sidebar = ({
14844
14821
  $borderBottomWidth: "1px",
14845
14822
  $borderStyle: "solid",
14846
14823
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)",
14847
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { $justifyContent: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
14824
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { $justifyContent: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14848
14825
  Text,
14849
14826
  {
14850
14827
  as: "h3",
@@ -14857,7 +14834,7 @@ var Sidebar = ({
14857
14834
  ) })
14858
14835
  }
14859
14836
  ),
14860
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
14837
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14861
14838
  Flex,
14862
14839
  {
14863
14840
  $position: "relative",
@@ -14871,7 +14848,7 @@ var Sidebar = ({
14871
14848
  $borderStyle: "solid",
14872
14849
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)",
14873
14850
  children: [
14874
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
14851
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14875
14852
  Text,
14876
14853
  {
14877
14854
  $font: theme.typography.text.fontFamily,
@@ -14881,8 +14858,8 @@ var Sidebar = ({
14881
14858
  children: t2("Plan")
14882
14859
  }
14883
14860
  ) }),
14884
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
14885
- data.company?.plan && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
14861
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
14862
+ data.company?.plan && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14886
14863
  Flex,
14887
14864
  {
14888
14865
  $justifyContent: "space-between",
@@ -14894,7 +14871,7 @@ var Sidebar = ({
14894
14871
  $color: theme.typography.heading4.color
14895
14872
  },
14896
14873
  children: [
14897
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
14874
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14898
14875
  Text,
14899
14876
  {
14900
14877
  $font: theme.typography.heading4.fontFamily,
@@ -14904,7 +14881,7 @@ var Sidebar = ({
14904
14881
  children: data.company.plan.name
14905
14882
  }
14906
14883
  ) }),
14907
- typeof data.company.plan.planPrice === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
14884
+ typeof data.company.plan.planPrice === "number" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14908
14885
  Text,
14909
14886
  {
14910
14887
  $font: theme.typography.text.fontFamily,
@@ -14916,7 +14893,7 @@ var Sidebar = ({
14916
14893
  data.company.plan.planPrice,
14917
14894
  data.company.billingSubscription?.currency
14918
14895
  ),
14919
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
14896
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
14920
14897
  "/",
14921
14898
  shortenPeriod(
14922
14899
  data.company.plan.planPeriod || planPeriod
@@ -14928,8 +14905,8 @@ var Sidebar = ({
14928
14905
  ]
14929
14906
  }
14930
14907
  ),
14931
- willPlanChange && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box, { children: [
14932
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
14908
+ willPlanChange && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box, { children: [
14909
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14933
14910
  Box,
14934
14911
  {
14935
14912
  $width: "100%",
@@ -14937,7 +14914,7 @@ var Sidebar = ({
14937
14914
  $opacity: "50%",
14938
14915
  $marginBottom: "0.25rem",
14939
14916
  $marginTop: "-0.25rem",
14940
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
14917
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14941
14918
  Icon2,
14942
14919
  {
14943
14920
  name: "arrow-down",
@@ -14949,14 +14926,14 @@ var Sidebar = ({
14949
14926
  )
14950
14927
  }
14951
14928
  ),
14952
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
14929
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14953
14930
  Flex,
14954
14931
  {
14955
14932
  $justifyContent: "space-between",
14956
14933
  $alignItems: "center",
14957
14934
  $gap: "1rem",
14958
14935
  children: [
14959
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
14936
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14960
14937
  Text,
14961
14938
  {
14962
14939
  $font: theme.typography.heading4.fontFamily,
@@ -14966,7 +14943,7 @@ var Sidebar = ({
14966
14943
  children: selectedPlan.name
14967
14944
  }
14968
14945
  ) }),
14969
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
14946
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
14970
14947
  Text,
14971
14948
  {
14972
14949
  $font: theme.typography.text.fontFamily,
@@ -14978,7 +14955,7 @@ var Sidebar = ({
14978
14955
  (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
14979
14956
  (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
14980
14957
  ),
14981
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
14958
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
14982
14959
  "/",
14983
14960
  shortenPeriod(planPeriod)
14984
14961
  ] })
@@ -14990,8 +14967,8 @@ var Sidebar = ({
14990
14967
  )
14991
14968
  ] })
14992
14969
  ] }),
14993
- willUsageBasedEntitlementsChange && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
14994
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
14970
+ willUsageBasedEntitlementsChange && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
14971
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
14995
14972
  Text,
14996
14973
  {
14997
14974
  $font: theme.typography.text.fontFamily,
@@ -15006,7 +14983,7 @@ var Sidebar = ({
15006
14983
  if (typeof allocation === "number" && usage.feature?.name) {
15007
14984
  const price = (planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice)?.price;
15008
14985
  acc.push(
15009
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
14986
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15010
14987
  Flex,
15011
14988
  {
15012
14989
  $justifyContent: "space-between",
@@ -15016,21 +14993,21 @@ var Sidebar = ({
15016
14993
  $textDecoration: "line-through",
15017
14994
  $color: theme.typography.heading4.color,
15018
14995
  children: [
15019
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
14996
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15020
14997
  Text,
15021
14998
  {
15022
14999
  $font: theme.typography.heading4.fontFamily,
15023
15000
  $size: theme.typography.heading4.fontSize,
15024
15001
  $weight: theme.typography.heading4.fontWeight,
15025
15002
  $color: theme.typography.heading4.color,
15026
- children: usage.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
15003
+ children: usage.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
15027
15004
  quantity,
15028
15005
  " ",
15029
15006
  (0, import_pluralize.default)(usage.feature.name, quantity)
15030
15007
  ] }) : usage.feature.name
15031
15008
  }
15032
15009
  ) }),
15033
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15010
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15034
15011
  Text,
15035
15012
  {
15036
15013
  $font: theme.typography.text.fontFamily,
@@ -15038,22 +15015,22 @@ var Sidebar = ({
15038
15015
  $weight: theme.typography.text.fontWeight,
15039
15016
  $color: theme.typography.text.color,
15040
15017
  children: [
15041
- usage.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
15018
+ usage.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
15042
15019
  formatCurrency(
15043
15020
  price * quantity,
15044
15021
  (planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice)?.currency
15045
15022
  ),
15046
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
15023
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
15047
15024
  "/",
15048
15025
  shortenPeriod(planPeriod)
15049
15026
  ] })
15050
15027
  ] }),
15051
- usage.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
15028
+ usage.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
15052
15029
  formatCurrency(
15053
15030
  price,
15054
15031
  (planPeriod === "month" ? usage.monthlyUsageBasedPrice : usage.yearlyUsageBasedPrice)?.currency
15055
15032
  ),
15056
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
15033
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
15057
15034
  "/",
15058
15035
  (0, import_pluralize.default)(
15059
15036
  usage.feature.name.toLowerCase(),
@@ -15078,8 +15055,8 @@ var Sidebar = ({
15078
15055
  (acc, { entitlement, previous, next: next2 }) => {
15079
15056
  if (entitlement?.feature?.name) {
15080
15057
  acc.push(
15081
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box, { children: [
15082
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15058
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box, { children: [
15059
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15083
15060
  Flex,
15084
15061
  {
15085
15062
  $justifyContent: "space-between",
@@ -15089,7 +15066,7 @@ var Sidebar = ({
15089
15066
  $textDecoration: "line-through",
15090
15067
  $color: theme.typography.heading4.color,
15091
15068
  children: [
15092
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15069
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15093
15070
  Text,
15094
15071
  {
15095
15072
  $font: theme.typography.heading4.fontFamily,
@@ -15103,7 +15080,7 @@ var Sidebar = ({
15103
15080
  ]
15104
15081
  }
15105
15082
  ) }),
15106
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15083
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15107
15084
  Text,
15108
15085
  {
15109
15086
  $font: theme.typography.text.fontFamily,
@@ -15115,7 +15092,7 @@ var Sidebar = ({
15115
15092
  ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * previous.quantity,
15116
15093
  (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15117
15094
  ),
15118
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
15095
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
15119
15096
  "/",
15120
15097
  shortenPeriod(planPeriod)
15121
15098
  ] })
@@ -15125,14 +15102,14 @@ var Sidebar = ({
15125
15102
  ]
15126
15103
  }
15127
15104
  ),
15128
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15105
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15129
15106
  Flex,
15130
15107
  {
15131
15108
  $justifyContent: "space-between",
15132
15109
  $alignItems: "center",
15133
15110
  $gap: "1rem",
15134
15111
  children: [
15135
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15112
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15136
15113
  Text,
15137
15114
  {
15138
15115
  $font: theme.typography.heading4.fontFamily,
@@ -15146,7 +15123,7 @@ var Sidebar = ({
15146
15123
  ]
15147
15124
  }
15148
15125
  ) }),
15149
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15126
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15150
15127
  Text,
15151
15128
  {
15152
15129
  $font: theme.typography.text.fontFamily,
@@ -15158,7 +15135,7 @@ var Sidebar = ({
15158
15135
  ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * next2.quantity,
15159
15136
  (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15160
15137
  ),
15161
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
15138
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
15162
15139
  "/",
15163
15140
  shortenPeriod(planPeriod)
15164
15141
  ] })
@@ -15180,28 +15157,28 @@ var Sidebar = ({
15180
15157
  if (entitlement.feature?.name) {
15181
15158
  const price = (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price;
15182
15159
  acc.push(
15183
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15160
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15184
15161
  Flex,
15185
15162
  {
15186
15163
  $justifyContent: "space-between",
15187
15164
  $alignItems: "center",
15188
15165
  $gap: "1rem",
15189
15166
  children: [
15190
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15167
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15191
15168
  Text,
15192
15169
  {
15193
15170
  $font: theme.typography.heading4.fontFamily,
15194
15171
  $size: theme.typography.heading4.fontSize,
15195
15172
  $weight: theme.typography.heading4.fontWeight,
15196
15173
  $color: theme.typography.heading4.color,
15197
- children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
15174
+ children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
15198
15175
  quantity,
15199
15176
  " ",
15200
15177
  (0, import_pluralize.default)(entitlement.feature.name, quantity)
15201
15178
  ] }) : entitlement.feature.name
15202
15179
  }
15203
15180
  ) }),
15204
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15181
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15205
15182
  Text,
15206
15183
  {
15207
15184
  $font: theme.typography.text.fontFamily,
@@ -15209,22 +15186,22 @@ var Sidebar = ({
15209
15186
  $weight: theme.typography.text.fontWeight,
15210
15187
  $color: theme.typography.text.color,
15211
15188
  children: [
15212
- entitlement.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
15189
+ entitlement.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
15213
15190
  formatCurrency(
15214
15191
  price * quantity,
15215
15192
  (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15216
15193
  ),
15217
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
15194
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
15218
15195
  "/",
15219
15196
  shortenPeriod(planPeriod)
15220
15197
  ] })
15221
15198
  ] }),
15222
- entitlement.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
15199
+ entitlement.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
15223
15200
  formatCurrency(
15224
15201
  price,
15225
15202
  (planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
15226
15203
  ),
15227
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
15204
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
15228
15205
  "/",
15229
15206
  (0, import_pluralize.default)(
15230
15207
  entitlement.feature.name.toLowerCase(),
@@ -15246,8 +15223,8 @@ var Sidebar = ({
15246
15223
  []
15247
15224
  )
15248
15225
  ] }),
15249
- selectedPlan && isTrialable && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box, { children: [
15250
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15226
+ selectedPlan && isTrialable && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box, { children: [
15227
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15251
15228
  Text,
15252
15229
  {
15253
15230
  $font: theme.typography.text.fontFamily,
@@ -15257,14 +15234,14 @@ var Sidebar = ({
15257
15234
  children: t2("Trial")
15258
15235
  }
15259
15236
  ) }),
15260
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15237
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15261
15238
  Flex,
15262
15239
  {
15263
15240
  $justifyContent: "space-between",
15264
15241
  $alignItems: "center",
15265
15242
  $gap: "1rem",
15266
15243
  children: [
15267
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15244
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15268
15245
  Text,
15269
15246
  {
15270
15247
  $font: theme.typography.heading4.fontFamily,
@@ -15274,7 +15251,7 @@ var Sidebar = ({
15274
15251
  children: t2("Ends on", { date: trialEndsOn.toLocaleDateString() })
15275
15252
  }
15276
15253
  ) }),
15277
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15254
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15278
15255
  Text,
15279
15256
  {
15280
15257
  $font: theme.typography.text.fontFamily,
@@ -15288,7 +15265,7 @@ var Sidebar = ({
15288
15265
  (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
15289
15266
  ),
15290
15267
  "/",
15291
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("sub", { children: shortenPeriod(planPeriod) })
15268
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("sub", { children: shortenPeriod(planPeriod) })
15292
15269
  ]
15293
15270
  }
15294
15271
  ) })
@@ -15296,8 +15273,8 @@ var Sidebar = ({
15296
15273
  }
15297
15274
  )
15298
15275
  ] }),
15299
- (willAddOnsChange || selectedAddOns.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
15300
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15276
+ (willAddOnsChange || selectedAddOns.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
15277
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15301
15278
  Text,
15302
15279
  {
15303
15280
  $font: theme.typography.text.fontFamily,
@@ -15307,7 +15284,7 @@ var Sidebar = ({
15307
15284
  children: t2("Add-ons")
15308
15285
  }
15309
15286
  ) }),
15310
- removedAddOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15287
+ removedAddOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15311
15288
  Flex,
15312
15289
  {
15313
15290
  $justifyContent: "space-between",
@@ -15317,7 +15294,7 @@ var Sidebar = ({
15317
15294
  $textDecoration: "line-through",
15318
15295
  $color: theme.typography.heading4.color,
15319
15296
  children: [
15320
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15297
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15321
15298
  Text,
15322
15299
  {
15323
15300
  $font: theme.typography.heading4.fontFamily,
@@ -15327,7 +15304,7 @@ var Sidebar = ({
15327
15304
  children: addOn.name
15328
15305
  }
15329
15306
  ) }),
15330
- typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15307
+ typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15331
15308
  Text,
15332
15309
  {
15333
15310
  $font: theme.typography.text.fontFamily,
@@ -15339,7 +15316,7 @@ var Sidebar = ({
15339
15316
  addOn.planPrice,
15340
15317
  (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
15341
15318
  ),
15342
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
15319
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
15343
15320
  "/",
15344
15321
  shortenPeriod(addOn.planPeriod)
15345
15322
  ] })
@@ -15350,14 +15327,14 @@ var Sidebar = ({
15350
15327
  },
15351
15328
  addOn.id
15352
15329
  )),
15353
- selectedAddOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15330
+ selectedAddOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15354
15331
  Flex,
15355
15332
  {
15356
15333
  $justifyContent: "space-between",
15357
15334
  $alignItems: "center",
15358
15335
  $gap: "1rem",
15359
15336
  children: [
15360
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15337
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15361
15338
  Text,
15362
15339
  {
15363
15340
  $font: theme.typography.heading4.fontFamily,
@@ -15367,7 +15344,7 @@ var Sidebar = ({
15367
15344
  children: addOn.name
15368
15345
  }
15369
15346
  ) }),
15370
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15347
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15371
15348
  Text,
15372
15349
  {
15373
15350
  $font: theme.typography.text.fontFamily,
@@ -15378,7 +15355,7 @@ var Sidebar = ({
15378
15355
  formatCurrency(
15379
15356
  (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0
15380
15357
  ),
15381
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
15358
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
15382
15359
  "/",
15383
15360
  shortenPeriod(planPeriod)
15384
15361
  ] })
@@ -15390,8 +15367,8 @@ var Sidebar = ({
15390
15367
  addOn.id
15391
15368
  ))
15392
15369
  ] }),
15393
- proration !== 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
15394
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15370
+ proration !== 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
15371
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15395
15372
  Text,
15396
15373
  {
15397
15374
  $font: theme.typography.text.fontFamily,
@@ -15401,14 +15378,14 @@ var Sidebar = ({
15401
15378
  children: proration > 0 ? t2("Proration") : !selectedPlan?.companyCanTrial && t2("Credits")
15402
15379
  }
15403
15380
  ) }),
15404
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: currentPlan && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15381
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: currentPlan && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15405
15382
  Flex,
15406
15383
  {
15407
15384
  $justifyContent: "space-between",
15408
15385
  $alignItems: "center",
15409
15386
  $gap: "1rem",
15410
15387
  children: [
15411
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15388
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15412
15389
  Text,
15413
15390
  {
15414
15391
  $font: theme.typography.heading4.fontFamily,
@@ -15418,7 +15395,7 @@ var Sidebar = ({
15418
15395
  children: t2("Unused time")
15419
15396
  }
15420
15397
  ) }),
15421
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15398
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15422
15399
  Text,
15423
15400
  {
15424
15401
  $font: theme.typography.text.fontFamily,
@@ -15438,7 +15415,7 @@ var Sidebar = ({
15438
15415
  ]
15439
15416
  }
15440
15417
  ),
15441
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15418
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15442
15419
  Flex,
15443
15420
  {
15444
15421
  $flexDirection: "column",
@@ -15447,14 +15424,14 @@ var Sidebar = ({
15447
15424
  $width: "100%",
15448
15425
  $padding: "1.5rem",
15449
15426
  children: [
15450
- promoCode && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15427
+ promoCode && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15451
15428
  Flex,
15452
15429
  {
15453
15430
  $justifyContent: "space-between",
15454
15431
  $alignItems: "center",
15455
15432
  $gap: "1rem",
15456
15433
  children: [
15457
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15434
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15458
15435
  Text,
15459
15436
  {
15460
15437
  $font: theme.typography.text.fontFamily,
@@ -15464,7 +15441,7 @@ var Sidebar = ({
15464
15441
  children: t2("Discount")
15465
15442
  }
15466
15443
  ) }),
15467
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15444
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15468
15445
  Flex,
15469
15446
  {
15470
15447
  $alignItems: "center",
@@ -15474,7 +15451,7 @@ var Sidebar = ({
15474
15451
  $outlineColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
15475
15452
  $borderRadius: "0.3125rem",
15476
15453
  children: [
15477
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15454
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15478
15455
  Text,
15479
15456
  {
15480
15457
  $font: theme.typography.text.fontFamily,
@@ -15484,14 +15461,14 @@ var Sidebar = ({
15484
15461
  children: promoCode
15485
15462
  }
15486
15463
  ),
15487
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15464
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15488
15465
  Box,
15489
15466
  {
15490
15467
  $cursor: "pointer",
15491
15468
  onClick: () => {
15492
15469
  updatePromoCode?.(void 0);
15493
15470
  },
15494
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15471
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15495
15472
  Icon2,
15496
15473
  {
15497
15474
  name: "close",
@@ -15508,14 +15485,14 @@ var Sidebar = ({
15508
15485
  ]
15509
15486
  }
15510
15487
  ),
15511
- percentOff > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15488
+ percentOff > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15512
15489
  Flex,
15513
15490
  {
15514
15491
  $justifyContent: "space-between",
15515
15492
  $alignItems: "center",
15516
15493
  $gap: "1rem",
15517
15494
  children: [
15518
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", $lineHeight: 1.15, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15495
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", $lineHeight: 1.15, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15519
15496
  Text,
15520
15497
  {
15521
15498
  $font: theme.typography.text.fontFamily,
@@ -15525,7 +15502,7 @@ var Sidebar = ({
15525
15502
  children: t2("X% off", { percent: percentOff })
15526
15503
  }
15527
15504
  ) }),
15528
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15505
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15529
15506
  Text,
15530
15507
  {
15531
15508
  $font: theme.typography.text.fontFamily,
@@ -15541,14 +15518,14 @@ var Sidebar = ({
15541
15518
  ]
15542
15519
  }
15543
15520
  ),
15544
- amountOff > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15521
+ amountOff > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15545
15522
  Flex,
15546
15523
  {
15547
15524
  $justifyContent: "space-between",
15548
15525
  $alignItems: "center",
15549
15526
  $gap: "1rem",
15550
15527
  children: [
15551
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", $lineHeight: 1.15, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15528
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", $lineHeight: 1.15, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15552
15529
  Text,
15553
15530
  {
15554
15531
  $font: theme.typography.text.fontFamily,
@@ -15563,7 +15540,7 @@ var Sidebar = ({
15563
15540
  })
15564
15541
  }
15565
15542
  ) }),
15566
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15543
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15567
15544
  Text,
15568
15545
  {
15569
15546
  $font: theme.typography.text.fontFamily,
@@ -15582,14 +15559,14 @@ var Sidebar = ({
15582
15559
  ]
15583
15560
  }
15584
15561
  ),
15585
- subscriptionPrice && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15562
+ subscriptionPrice && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15586
15563
  Flex,
15587
15564
  {
15588
15565
  $justifyContent: "space-between",
15589
15566
  $alignItems: "center",
15590
15567
  $gap: "1rem",
15591
15568
  children: [
15592
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15569
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15593
15570
  Text,
15594
15571
  {
15595
15572
  $font: theme.typography.text.fontFamily,
@@ -15602,7 +15579,7 @@ var Sidebar = ({
15602
15579
  ]
15603
15580
  }
15604
15581
  ) }),
15605
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15582
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15606
15583
  Text,
15607
15584
  {
15608
15585
  $font: theme.typography.text.fontFamily,
@@ -15611,7 +15588,7 @@ var Sidebar = ({
15611
15588
  $color: theme.typography.text.color,
15612
15589
  children: [
15613
15590
  subscriptionPrice,
15614
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
15591
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
15615
15592
  "/",
15616
15593
  shortenPeriod(planPeriod)
15617
15594
  ] })
@@ -15621,14 +15598,14 @@ var Sidebar = ({
15621
15598
  ]
15622
15599
  }
15623
15600
  ),
15624
- charges && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15601
+ charges && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15625
15602
  Flex,
15626
15603
  {
15627
15604
  $justifyContent: "space-between",
15628
15605
  $alignItems: "center",
15629
15606
  $gap: "1rem",
15630
15607
  children: [
15631
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15608
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15632
15609
  Text,
15633
15610
  {
15634
15611
  $font: theme.typography.text.fontFamily,
@@ -15641,7 +15618,7 @@ var Sidebar = ({
15641
15618
  ]
15642
15619
  }
15643
15620
  ) }),
15644
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15621
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15645
15622
  Text,
15646
15623
  {
15647
15624
  $font: theme.typography.text.fontFamily,
@@ -15657,8 +15634,8 @@ var Sidebar = ({
15657
15634
  ]
15658
15635
  }
15659
15636
  ),
15660
- dueNow < 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $justifyContent: "space-between", $gap: "1rem", children: [
15661
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", $lineHeight: 1.15, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15637
+ dueNow < 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Flex, { $justifyContent: "space-between", $gap: "1rem", children: [
15638
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", $lineHeight: 1.15, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
15662
15639
  Text,
15663
15640
  {
15664
15641
  $font: theme.typography.text.fontFamily,
@@ -15671,7 +15648,7 @@ var Sidebar = ({
15671
15648
  ]
15672
15649
  }
15673
15650
  ) }),
15674
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15651
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15675
15652
  Text,
15676
15653
  {
15677
15654
  $font: theme.typography.text.fontFamily,
@@ -15685,7 +15662,7 @@ var Sidebar = ({
15685
15662
  }
15686
15663
  ) })
15687
15664
  ] }),
15688
- layout === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15665
+ layout === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15689
15666
  StageButton,
15690
15667
  {
15691
15668
  canTrial: selectedPlan?.companyCanTrial === true,
@@ -15702,8 +15679,8 @@ var Sidebar = ({
15702
15679
  trialPaymentMethodRequired: data.trialPaymentMethodRequired === true
15703
15680
  }
15704
15681
  ),
15705
- layout === "unsubscribe" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EmbedButton, { onClick: unsubscribe, isLoading, children: t2("Cancel subscription") }),
15706
- !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15682
+ layout === "unsubscribe" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EmbedButton, { onClick: unsubscribe, isLoading, children: t2("Cancel subscription") }),
15683
+ !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15707
15684
  Text,
15708
15685
  {
15709
15686
  $font: theme.typography.text.fontFamily,
@@ -15713,7 +15690,7 @@ var Sidebar = ({
15713
15690
  children: error
15714
15691
  }
15715
15692
  ) }),
15716
- layout !== "unsubscribe" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15693
+ layout !== "unsubscribe" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
15717
15694
  Text,
15718
15695
  {
15719
15696
  $font: theme.typography.text.fontFamily,
@@ -15733,6 +15710,108 @@ var Sidebar = ({
15733
15710
  );
15734
15711
  };
15735
15712
 
15713
+ // src/components/shared/checkout-dialog/Navigation.tsx
15714
+ var import_jsx_runtime12 = require("react/jsx-runtime");
15715
+ var Navigation = ({
15716
+ name,
15717
+ index,
15718
+ activeIndex,
15719
+ isLast,
15720
+ onClick
15721
+ }) => {
15722
+ const theme = nt();
15723
+ const isLightBackground = useIsLightBackground();
15724
+ const showFullContent = index === activeIndex || index === activeIndex + 1;
15725
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
15726
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15727
+ Flex,
15728
+ {
15729
+ $gap: "0.5rem",
15730
+ $alignItems: "center",
15731
+ ...!showFullContent && { $flexGrow: 1, $minWidth: 0 },
15732
+ children: [
15733
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15734
+ Box,
15735
+ {
15736
+ $display: "none",
15737
+ $viewport: {
15738
+ md: {
15739
+ $display: "block"
15740
+ }
15741
+ },
15742
+ children: index >= activeIndex ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15743
+ Box,
15744
+ {
15745
+ $width: `${20 / TEXT_BASE_SIZE}rem`,
15746
+ $height: `${20 / TEXT_BASE_SIZE}rem`,
15747
+ $borderWidth: "2px",
15748
+ $borderStyle: "solid",
15749
+ $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)",
15750
+ $borderRadius: "9999px"
15751
+ }
15752
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15753
+ IconRound,
15754
+ {
15755
+ name: "check",
15756
+ colors: [
15757
+ theme.card.background,
15758
+ isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)"
15759
+ ],
15760
+ style: {
15761
+ fontSize: `${16 / TEXT_BASE_SIZE}rem`,
15762
+ width: `${20 / TEXT_BASE_SIZE}rem`,
15763
+ height: `${20 / TEXT_BASE_SIZE}rem`
15764
+ }
15765
+ }
15766
+ )
15767
+ }
15768
+ ),
15769
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
15770
+ Box,
15771
+ {
15772
+ tabIndex: 0,
15773
+ $fontSize: `${16 / TEXT_BASE_SIZE}rem`,
15774
+ $fontFamily: theme.typography.text.fontFamily,
15775
+ $fontWeight: index === activeIndex ? 600 : 400,
15776
+ $color: theme.typography.text.color,
15777
+ ...!showFullContent && {
15778
+ $overflow: "hidden",
15779
+ $whiteSpace: "nowrap",
15780
+ $textOverflow: "ellipsis"
15781
+ },
15782
+ ...index !== activeIndex && { $opacity: "0.6375" },
15783
+ ...index < activeIndex && {
15784
+ onClick,
15785
+ $cursor: "pointer"
15786
+ },
15787
+ $viewport: {
15788
+ md: {
15789
+ $fontSize: `${19 / TEXT_BASE_SIZE}rem`
15790
+ }
15791
+ },
15792
+ children: [
15793
+ index + 1,
15794
+ ". ",
15795
+ name
15796
+ ]
15797
+ }
15798
+ )
15799
+ ]
15800
+ }
15801
+ ),
15802
+ !isLast && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
15803
+ Icon2,
15804
+ {
15805
+ name: "chevron-right",
15806
+ style: {
15807
+ fontSize: 16,
15808
+ color: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.35)"
15809
+ }
15810
+ }
15811
+ )
15812
+ ] });
15813
+ };
15814
+
15736
15815
  // src/components/shared/checkout-dialog/Plan.tsx
15737
15816
  var import_react22 = require("react");
15738
15817
  var import_pluralize2 = __toESM(require_pluralize());
@@ -15902,7 +15981,7 @@ var Plan = ({
15902
15981
  plan.entitlements.reduce((acc, entitlement) => {
15903
15982
  const hasNumericValue = entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait";
15904
15983
  let metricPeriodText;
15905
- if (hasNumericValue && entitlement.metricPeriod) {
15984
+ if (hasNumericValue && entitlement.metricPeriod && entitlement.priceBehavior !== "overage") {
15906
15985
  metricPeriodText = {
15907
15986
  billing: t2("billing period"),
15908
15987
  current_day: t2("day"),
@@ -15910,6 +15989,7 @@ var Plan = ({
15910
15989
  current_year: t2("year")
15911
15990
  }[entitlement.metricPeriod];
15912
15991
  }
15992
+ const limit = entitlement.softLimit || entitlement.valueNumeric;
15913
15993
  const price = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price;
15914
15994
  const currency = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency;
15915
15995
  if (entitlement.priceBehavior && typeof price !== "number") {
@@ -15935,41 +16015,92 @@ var Plan = ({
15935
16015
  ]
15936
16016
  }
15937
16017
  ),
15938
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
15939
- Text,
16018
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
16019
+ Flex,
15940
16020
  {
15941
- $font: theme.typography.text.fontFamily,
15942
- $size: theme.typography.text.fontSize,
15943
- $weight: theme.typography.text.fontWeight,
15944
- $color: theme.typography.text.color,
15945
- children: typeof price !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
15946
- formatCurrency(price, currency),
15947
- " ",
15948
- t2("per"),
15949
- " ",
15950
- (0, import_pluralize2.default)(entitlement.feature.name, 1),
15951
- entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
15952
- " ",
15953
- t2("per"),
15954
- " ",
15955
- period
15956
- ] })
15957
- ] }) : hasNumericValue ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
15958
- entitlement.valueType === "unlimited" ? t2("Unlimited", {
15959
- item: (0, import_pluralize2.default)(
15960
- entitlement.feature.name
15961
- )
15962
- }) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize2.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
15963
- metricPeriodText && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
15964
- " ",
15965
- t2("per"),
15966
- " ",
15967
- metricPeriodText
15968
- ] })
15969
- ] }) : entitlement.feature.name
15970
- }
15971
- ) })
15972
- ] })
16021
+ $flexDirection: "column",
16022
+ $justifyContent: "center",
16023
+ $gap: "0.5rem",
16024
+ children: [
16025
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
16026
+ Text,
16027
+ {
16028
+ $font: theme.typography.text.fontFamily,
16029
+ $size: theme.typography.text.fontSize,
16030
+ $weight: theme.typography.text.fontWeight,
16031
+ $color: theme.typography.text.color,
16032
+ $leading: 1.35,
16033
+ children: typeof price === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
16034
+ formatCurrency(price, currency),
16035
+ " ",
16036
+ t2("per"),
16037
+ " ",
16038
+ (0, import_pluralize2.default)(entitlement.feature.name, 1),
16039
+ entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
16040
+ " ",
16041
+ t2("per"),
16042
+ " ",
16043
+ period
16044
+ ] })
16045
+ ] }) : hasNumericValue ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
16046
+ entitlement.valueType === "unlimited" ? t2("Unlimited", {
16047
+ item: (0, import_pluralize2.default)(
16048
+ entitlement.feature.name
16049
+ )
16050
+ }) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
16051
+ formatNumber(limit),
16052
+ " ",
16053
+ (0, import_pluralize2.default)(
16054
+ entitlement.feature.name,
16055
+ limit
16056
+ )
16057
+ ] }),
16058
+ metricPeriodText ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
16059
+ " ",
16060
+ t2("per"),
16061
+ " ",
16062
+ metricPeriodText
16063
+ ] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
16064
+ "/",
16065
+ shortenPeriod(period)
16066
+ ] })
16067
+ ] }) : entitlement.feature.name
16068
+ }
16069
+ ),
16070
+ entitlement.priceBehavior === "overage" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
16071
+ Text,
16072
+ {
16073
+ $font: theme.typography.text.fontFamily,
16074
+ $size: 0.875 * theme.typography.text.fontSize,
16075
+ $weight: theme.typography.text.fontWeight,
16076
+ $color: hexToHSL(theme.typography.text.color).l > 50 ? darken(
16077
+ theme.typography.text.color,
16078
+ 0.46
16079
+ ) : lighten(
16080
+ theme.typography.text.color,
16081
+ 0.46
16082
+ ),
16083
+ $leading: 1.35,
16084
+ children: [
16085
+ formatCurrency(price),
16086
+ "/",
16087
+ (0, import_pluralize2.default)(
16088
+ entitlement.feature.name.toLowerCase(),
16089
+ 1
16090
+ ),
16091
+ entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
16092
+ "/",
16093
+ shortenPeriod(period)
16094
+ ] }),
16095
+ " ",
16096
+ t2("overage fee")
16097
+ ]
16098
+ }
16099
+ )
16100
+ ]
16101
+ }
16102
+ )
16103
+ ] })
15973
16104
  },
15974
16105
  entitlement.id
15975
16106
  )
@@ -16392,12 +16523,12 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
16392
16523
  var import_react23 = require("react");
16393
16524
 
16394
16525
  // node_modules/@stripe/stripe-js/dist/index.mjs
16395
- var RELEASE_TRAIN = "v3";
16526
+ var RELEASE_TRAIN = "acacia";
16396
16527
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
16397
16528
  return version === 3 ? "v3" : version;
16398
16529
  };
16399
16530
  var ORIGIN = "https://js.stripe.com";
16400
- var STRIPE_JS_URL = "".concat(ORIGIN, "/v3");
16531
+ var STRIPE_JS_URL = "".concat(ORIGIN, "/").concat(RELEASE_TRAIN, "/stripe.js");
16401
16532
  var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
16402
16533
  var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
16403
16534
  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";
@@ -16432,7 +16563,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
16432
16563
  }
16433
16564
  stripe._registerWrapper({
16434
16565
  name: "stripe-js",
16435
- version: "5.10.0",
16566
+ version: "6.0.0",
16436
16567
  startTime
16437
16568
  });
16438
16569
  };
@@ -16507,7 +16638,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
16507
16638
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
16508
16639
  var expectedVersion = RELEASE_TRAIN;
16509
16640
  if (isTestKey && version !== expectedVersion) {
16510
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("5.10.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
16641
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
16511
16642
  }
16512
16643
  var stripe = maybeStripe.apply(void 0, args);
16513
16644
  registerWrapper(stripe, startTime);
@@ -17393,10 +17524,11 @@ var PeriodToggle = ({
17393
17524
  // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
17394
17525
  var import_react27 = require("react");
17395
17526
  var import_jsx_runtime20 = require("react/jsx-runtime");
17396
- var UnsubscribeDialog = () => {
17527
+ var UnsubscribeDialog = ({ top = 0 }) => {
17397
17528
  const { t: t2 } = useTranslation();
17398
17529
  const theme = nt();
17399
17530
  const { data, setLayout, setSelected } = useEmbed();
17531
+ const contentRef = (0, import_react27.useRef)(null);
17400
17532
  const [error, setError] = (0, import_react27.useState)();
17401
17533
  const [isLoading, setIsLoading] = (0, import_react27.useState)(false);
17402
17534
  const planPeriod = (0, import_react27.useMemo)(
@@ -17443,136 +17575,145 @@ var UnsubscribeDialog = () => {
17443
17575
  const handleClose = (0, import_react27.useCallback)(() => {
17444
17576
  setLayout("portal");
17445
17577
  }, [setLayout]);
17446
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Modal, { id: "unsubscribe-dialog", size: "auto", children: [
17447
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17448
- Box,
17449
- {
17450
- $display: "inline-flex",
17451
- $position: "absolute",
17452
- $top: 0,
17453
- $right: 0,
17454
- $zIndex: 1,
17455
- $cursor: "pointer",
17456
- onClick: handleClose,
17457
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17458
- Icon2,
17578
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
17579
+ Modal,
17580
+ {
17581
+ id: "unsubscribe-dialog",
17582
+ size: "auto",
17583
+ top,
17584
+ contentRef,
17585
+ children: [
17586
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17587
+ Box,
17459
17588
  {
17460
- name: "close",
17461
- style: {
17462
- fontSize: 36,
17463
- color: isLightBackground ? "hsla(0, 0%, 0%, 0.275)" : "hsla(0, 0%, 100%, 0.275)"
17464
- }
17589
+ $display: "inline-flex",
17590
+ $position: "absolute",
17591
+ $top: 0,
17592
+ $right: 0,
17593
+ $zIndex: 1,
17594
+ $cursor: "pointer",
17595
+ onClick: handleClose,
17596
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17597
+ Icon2,
17598
+ {
17599
+ name: "close",
17600
+ style: {
17601
+ fontSize: 36,
17602
+ color: isLightBackground ? "hsla(0, 0%, 0%, 0.275)" : "hsla(0, 0%, 100%, 0.275)"
17603
+ }
17604
+ }
17605
+ )
17465
17606
  }
17466
- )
17467
- }
17468
- ),
17469
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
17470
- Flex,
17471
- {
17472
- $position: "relative",
17473
- $flexDirection: "column",
17474
- $height: "auto",
17475
- $viewport: {
17476
- md: {
17477
- $flexDirection: "row",
17478
- $height: "calc(100% - 5rem)"
17607
+ ),
17608
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
17609
+ Flex,
17610
+ {
17611
+ $position: "relative",
17612
+ $flexDirection: "column",
17613
+ $height: "auto",
17614
+ $viewport: {
17615
+ md: {
17616
+ $flexDirection: "row",
17617
+ $height: "calc(100% - 5rem)"
17618
+ }
17619
+ },
17620
+ children: [
17621
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
17622
+ Flex,
17623
+ {
17624
+ $flexDirection: "column",
17625
+ $flexWrap: "wrap",
17626
+ $justifyContent: "space-around",
17627
+ $gap: "5rem",
17628
+ $padding: "2.5rem",
17629
+ children: [
17630
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
17631
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17632
+ Text,
17633
+ {
17634
+ as: "h2",
17635
+ $font: theme.typography.heading2.fontFamily,
17636
+ $size: theme.typography.heading2.fontSize,
17637
+ $weight: theme.typography.heading2.fontWeight,
17638
+ $color: theme.typography.heading2.color,
17639
+ children: t2("Cancel subscription")
17640
+ }
17641
+ ),
17642
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
17643
+ Text,
17644
+ {
17645
+ as: "p",
17646
+ $font: theme.typography.text.fontFamily,
17647
+ $size: theme.typography.text.fontSize,
17648
+ $weight: theme.typography.text.fontWeight,
17649
+ $color: theme.typography.text.color,
17650
+ children: [
17651
+ t2(
17652
+ "You will retain access to your plan until the end of the billing period, on"
17653
+ ),
17654
+ " ",
17655
+ cancelDate ? toPrettyDate(cancelDate, {
17656
+ month: "numeric"
17657
+ }) : ""
17658
+ ]
17659
+ }
17660
+ )
17661
+ ] }),
17662
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
17663
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17664
+ Text,
17665
+ {
17666
+ as: "p",
17667
+ $font: theme.typography.text.fontFamily,
17668
+ $size: theme.typography.text.fontSize,
17669
+ $weight: theme.typography.text.fontWeight,
17670
+ $color: theme.typography.text.color,
17671
+ children: t2("Not ready to cancel?")
17672
+ }
17673
+ ),
17674
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17675
+ EmbedButton,
17676
+ {
17677
+ onClick: () => {
17678
+ setSelected({
17679
+ planId: data.company?.plan?.id,
17680
+ addOnId: void 0,
17681
+ usage: false
17682
+ });
17683
+ setLayout("checkout");
17684
+ },
17685
+ $size: "sm",
17686
+ $color: "secondary",
17687
+ $variant: "ghost",
17688
+ $fullWidth: false,
17689
+ children: t2("Manage plan")
17690
+ }
17691
+ )
17692
+ ] })
17693
+ ]
17694
+ }
17695
+ ),
17696
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17697
+ Sidebar,
17698
+ {
17699
+ planPeriod,
17700
+ addOns,
17701
+ usageBasedEntitlements,
17702
+ error,
17703
+ isLoading,
17704
+ showHeader: false,
17705
+ showPaymentForm: false,
17706
+ requiresPayment: false,
17707
+ setError: (msg) => setError(msg),
17708
+ setIsLoading
17709
+ }
17710
+ )
17711
+ ]
17479
17712
  }
17480
- },
17481
- children: [
17482
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
17483
- Flex,
17484
- {
17485
- $flexDirection: "column",
17486
- $flexWrap: "wrap",
17487
- $justifyContent: "space-around",
17488
- $gap: "5rem",
17489
- $padding: "2.5rem",
17490
- children: [
17491
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
17492
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17493
- Text,
17494
- {
17495
- as: "h2",
17496
- $font: theme.typography.heading2.fontFamily,
17497
- $size: theme.typography.heading2.fontSize,
17498
- $weight: theme.typography.heading2.fontWeight,
17499
- $color: theme.typography.heading2.color,
17500
- children: t2("Cancel subscription")
17501
- }
17502
- ),
17503
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
17504
- Text,
17505
- {
17506
- as: "p",
17507
- $font: theme.typography.text.fontFamily,
17508
- $size: theme.typography.text.fontSize,
17509
- $weight: theme.typography.text.fontWeight,
17510
- $color: theme.typography.text.color,
17511
- children: [
17512
- t2(
17513
- "You will retain access to your plan until the end of the billing period, on"
17514
- ),
17515
- " ",
17516
- cancelDate ? toPrettyDate(cancelDate, {
17517
- month: "numeric"
17518
- }) : ""
17519
- ]
17520
- }
17521
- )
17522
- ] }),
17523
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
17524
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17525
- Text,
17526
- {
17527
- as: "p",
17528
- $font: theme.typography.text.fontFamily,
17529
- $size: theme.typography.text.fontSize,
17530
- $weight: theme.typography.text.fontWeight,
17531
- $color: theme.typography.text.color,
17532
- children: t2("Not ready to cancel?")
17533
- }
17534
- ),
17535
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17536
- EmbedButton,
17537
- {
17538
- onClick: () => {
17539
- setSelected({
17540
- planId: data.company?.plan?.id,
17541
- addOnId: void 0,
17542
- usage: false
17543
- });
17544
- setLayout("checkout");
17545
- },
17546
- $size: "sm",
17547
- $color: "secondary",
17548
- $variant: "ghost",
17549
- $fullWidth: false,
17550
- children: t2("Manage plan")
17551
- }
17552
- )
17553
- ] })
17554
- ]
17555
- }
17556
- ),
17557
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
17558
- Sidebar,
17559
- {
17560
- planPeriod,
17561
- addOns,
17562
- usageBasedEntitlements,
17563
- error,
17564
- isLoading,
17565
- showHeader: false,
17566
- showPaymentForm: false,
17567
- requiresPayment: false,
17568
- setError: (msg) => setError(msg),
17569
- setIsLoading
17570
- }
17571
- )
17572
- ]
17573
- }
17574
- )
17575
- ] });
17713
+ )
17714
+ ]
17715
+ }
17716
+ );
17576
17717
  };
17577
17718
 
17578
17719
  // src/components/ui/badge/Badge.tsx
@@ -17732,9 +17873,9 @@ var RenderLayout = ({ children }) => {
17732
17873
 
17733
17874
  // src/components/layout/viewport/styles.ts
17734
17875
  var StyledViewport = dt(Box).attrs(({ theme }) => ({
17735
- $gridTemplateColumns: `repeat(auto-fit, minmax(300px, 1fr))`,
17876
+ $gridTemplateColumns: "repeat(1, minmax(300px, 1fr))",
17736
17877
  $viewport: {
17737
- xl: {
17878
+ md: {
17738
17879
  $gridTemplateColumns: `repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`
17739
17880
  }
17740
17881
  }
@@ -17756,15 +17897,13 @@ var Viewport = (0, import_react28.forwardRef)(
17756
17897
  const [top, setTop] = (0, import_react28.useState)(0);
17757
17898
  const canCheckout = data.capabilities?.checkout ?? true;
17758
17899
  (0, import_react28.useLayoutEffect)(() => {
17759
- if (layout !== "checkout" && layout !== "unsubscribe") {
17760
- return;
17761
- }
17762
17900
  const parent = portal || document.body;
17763
- const value = Math.abs(
17764
- (parent === document.body ? window.scrollY : parent.scrollTop) ?? 0
17901
+ setTop(
17902
+ Math.abs(
17903
+ (parent === document.body ? window.scrollY : parent.scrollTop) ?? 0
17904
+ )
17765
17905
  );
17766
- setTop(value);
17767
- parent.style.overflow = "hidden";
17906
+ parent.style.overflow = layout === "checkout" || layout === "unsubscribe" ? "hidden" : "";
17768
17907
  return () => {
17769
17908
  parent.style.overflow = "";
17770
17909
  };
@@ -17775,7 +17914,10 @@ var Viewport = (0, import_react28.forwardRef)(
17775
17914
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Badge, {})
17776
17915
  ] }),
17777
17916
  canCheckout && layout === "checkout" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CheckoutDialog, { top }), portal || document.body),
17778
- layout === "unsubscribe" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UnsubscribeDialog, {}), portal || document.body)
17917
+ layout === "unsubscribe" && (0, import_react_dom2.createPortal)(
17918
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UnsubscribeDialog, { top }),
17919
+ portal || document.body
17920
+ )
17779
17921
  ] });
17780
17922
  }
17781
17923
  );
@@ -17885,11 +18027,12 @@ var Details = ({
17885
18027
  const {
17886
18028
  allocation,
17887
18029
  feature,
18030
+ priceBehavior,
17888
18031
  usage,
18032
+ softLimit,
17889
18033
  monthlyUsageBasedPrice,
17890
18034
  yearlyUsageBasedPrice
17891
18035
  } = featureUsage || {};
17892
- const { priceBehavior } = usageData || {};
17893
18036
  const { t: t2 } = useTranslation();
17894
18037
  const theme = nt();
17895
18038
  const { data } = useEmbed();
@@ -17927,13 +18070,16 @@ var Details = ({
17927
18070
  if (priceBehavior === "pay_as_you_go" && typeof price === "number") {
17928
18071
  return `${formatCurrency(price, currency)} ${t2("per")} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}`;
17929
18072
  }
18073
+ if (priceBehavior === "overage" && typeof softLimit === "number") {
18074
+ return `${formatNumber(softLimit)} ${(0, import_pluralize4.default)(feature.name, softLimit)}`;
18075
+ }
17930
18076
  if (!priceBehavior && typeof allocation === "number") {
17931
18077
  return `${formatNumber(allocation)} ${(0, import_pluralize4.default)(feature.name, allocation)}`;
17932
18078
  }
17933
18079
  if (!priceBehavior) {
17934
18080
  return t2("Unlimited", { item: (0, import_pluralize4.default)(feature.name) });
17935
18081
  }
17936
- }, [t2, allocation, feature?.name, price, priceBehavior, currency]);
18082
+ }, [t2, allocation, feature?.name, price, priceBehavior, currency, softLimit]);
17937
18083
  const usageText = (0, import_react31.useMemo)(() => {
17938
18084
  if (!feature?.name) {
17939
18085
  return;
@@ -17942,14 +18088,18 @@ var Details = ({
17942
18088
  let acc;
17943
18089
  if (priceBehavior === "pay_in_advance" && typeof data.company?.plan?.planPeriod === "string" && typeof price === "number") {
17944
18090
  acc = `${formatCurrency(price, currency)}/${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}/${shortenPeriod(data.company.plan.planPeriod)}`;
17945
- } else if (priceBehavior === "pay_as_you_go" && typeof usage === "number") {
18091
+ } else if ((priceBehavior === "pay_as_you_go" || priceBehavior === "overage") && typeof usage === "number") {
17946
18092
  acc = `${usage} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), usage)} ${t2("used")}`;
17947
18093
  }
17948
18094
  if (acc) {
17949
- if (usageData?.priceBehavior === "pay_in_advance" && typeof price === "number" && typeof allocation === "number") {
18095
+ if (priceBehavior === "pay_in_advance" && typeof price === "number" && typeof allocation === "number") {
17950
18096
  acc += ` \u2022 ${formatCurrency(price * allocation, currency)}`;
17951
- } else if (usageData?.priceBehavior === "pay_as_you_go" && typeof price === "number" && typeof usage === "number") {
18097
+ } else if (priceBehavior === "pay_as_you_go" && typeof price === "number" && typeof usage === "number") {
17952
18098
  acc += ` \u2022 ${formatCurrency(price * usage, currency)}`;
18099
+ } else if (priceBehavior === "overage" && typeof price === "number" && typeof usage === "number" && typeof softLimit === "number") {
18100
+ const cost = price * (usage - softLimit);
18101
+ const period = feature.featureType === "event" && typeof data.company?.plan?.planPeriod === "string" ? `/${shortenPeriod(data.company.plan.planPeriod)}` : "";
18102
+ acc += cost > 0 ? ` \u2022 ${t2("Overage")}: ${formatCurrency(cost)}${period}` : ` \u2022 ${`${formatCurrency(price)}/${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}`} ${t2("overage fee")}`;
17953
18103
  }
17954
18104
  return acc;
17955
18105
  }
@@ -17964,14 +18114,16 @@ var Details = ({
17964
18114
  }
17965
18115
  }, [
17966
18116
  t2,
17967
- allocation,
17968
18117
  data.company?.plan?.planPeriod,
17969
18118
  feature?.name,
17970
- price,
18119
+ feature?.featureType,
17971
18120
  priceBehavior,
18121
+ allocation,
18122
+ price,
18123
+ currency,
18124
+ softLimit,
17972
18125
  usage,
17973
- usageData,
17974
- currency
18126
+ usageData
17975
18127
  ]);
17976
18128
  if (!text) {
17977
18129
  return null;
@@ -18411,11 +18563,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
18411
18563
  allocation,
18412
18564
  feature,
18413
18565
  usage,
18566
+ softLimit,
18414
18567
  priceBehavior,
18415
18568
  metricResetAt,
18416
18569
  monthlyUsageBasedPrice,
18417
18570
  yearlyUsageBasedPrice
18418
18571
  }, index) => {
18572
+ const limit = allocation || softLimit || 0;
18573
+ const isOverage = priceBehavior === "overage" && typeof softLimit === "number" && typeof usage === "number" && usage > softLimit;
18419
18574
  let price;
18420
18575
  let currency;
18421
18576
  if (planPeriod === "month") {
@@ -18425,137 +18580,193 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
18425
18580
  price = yearlyUsageBasedPrice?.price;
18426
18581
  currency = yearlyUsageBasedPrice?.currency;
18427
18582
  }
18428
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Element, { as: Flex, $gap: "1.5rem", children: [
18429
- props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18430
- IconRound,
18583
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column-reverse", children: [
18584
+ priceBehavior === "overage" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
18585
+ Flex,
18431
18586
  {
18432
- name: feature.icon,
18433
- size: "sm",
18434
- colors: [
18435
- theme.primary,
18436
- isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)"
18587
+ $justifyContent: "space-between",
18588
+ $alignItems: "center",
18589
+ $padding: `${0.4375 * theme.card.padding / TEXT_BASE_SIZE}rem ${theme.card.padding / TEXT_BASE_SIZE}rem`,
18590
+ $backgroundColor: isLightBackground ? darken(theme.card.background, 0.05) : lighten(theme.card.background, 0.1),
18591
+ children: [
18592
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18593
+ Text,
18594
+ {
18595
+ $font: theme.typography.text.fontFamily,
18596
+ $size: theme.typography.text.fontSize,
18597
+ $weight: theme.typography.text.fontWeight,
18598
+ $color: theme.typography.text.color,
18599
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
18600
+ t2("Overage fee"),
18601
+ ": ",
18602
+ formatCurrency(price, currency),
18603
+ feature && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("sub", { children: [
18604
+ "/",
18605
+ (0, import_pluralize5.default)(feature.name.toLowerCase(), 1),
18606
+ feature.featureType === "event" && data.company?.plan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
18607
+ "/",
18608
+ shortenPeriod(data.company.plan.planPeriod)
18609
+ ] })
18610
+ ] })
18611
+ ] })
18612
+ }
18613
+ ),
18614
+ isOverage && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
18615
+ Text,
18616
+ {
18617
+ $font: theme.typography.text.fontFamily,
18618
+ $size: theme.typography.text.fontSize,
18619
+ $weight: theme.typography.text.fontWeight,
18620
+ $color: theme.typography.text.color,
18621
+ children: [
18622
+ t2("X over the limit", {
18623
+ amount: usage - softLimit
18624
+ }),
18625
+ " \xB7 ",
18626
+ formatCurrency(price * (usage - softLimit), currency),
18627
+ feature?.featureType === "event" && typeof data.company?.plan?.planPeriod === "string" && `/${shortenPeriod(data.company.plan.planPeriod)}`
18628
+ ]
18629
+ }
18630
+ )
18437
18631
  ]
18438
18632
  }
18439
18633
  ),
18440
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
18441
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
18442
- Flex,
18634
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Element, { as: Flex, $gap: "1.5rem", children: [
18635
+ props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18636
+ IconRound,
18443
18637
  {
18444
- ref: (el) => {
18445
- if (el) {
18446
- elements.current.push(el);
18447
- }
18448
- },
18449
- $flexWrap: "wrap",
18450
- $gap: "1rem",
18451
- children: [
18452
- feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
18453
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18454
- Text,
18455
- {
18456
- as: Box,
18457
- $font: theme.typography[props.header.fontStyle].fontFamily,
18458
- $size: theme.typography[props.header.fontStyle].fontSize,
18459
- $weight: theme.typography[props.header.fontStyle].fontWeight,
18460
- $color: theme.typography[props.header.fontStyle].color,
18461
- children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
18462
- formatNumber(usage),
18463
- " ",
18464
- (0, import_pluralize5.default)(feature.name, usage)
18465
- ] }) : feature.name
18466
- }
18467
- ),
18468
- props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18469
- Text,
18470
- {
18471
- as: Box,
18472
- $font: theme.typography[props.description.fontStyle].fontFamily,
18473
- $size: theme.typography[props.description.fontStyle].fontSize,
18474
- $weight: theme.typography[props.description.fontStyle].fontWeight,
18475
- $color: theme.typography[props.description.fontStyle].color,
18476
- children: feature.description
18477
- }
18478
- )
18479
- ] }),
18480
- (feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
18481
- Box,
18482
- {
18483
- $flexBasis: "min-content",
18484
- $flexGrow: "1",
18485
- $textAlign: shouldWrapChildren ? "left" : "right",
18486
- children: [
18487
- props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18488
- Text,
18489
- {
18490
- as: Box,
18491
- $font: theme.typography[props.usage.fontStyle].fontFamily,
18492
- $size: theme.typography[props.usage.fontStyle].fontSize,
18493
- $weight: theme.typography[props.usage.fontStyle].fontWeight,
18494
- $leading: 1.25,
18495
- $color: theme.typography[props.usage.fontStyle].color,
18496
- children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
18497
- formatNumber(allocation),
18498
- " ",
18499
- (0, import_pluralize5.default)(feature.name, allocation)
18500
- ] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
18501
- formatNumber(usage),
18502
- " ",
18503
- (0, import_pluralize5.default)(feature.name, usage)
18504
- ] })
18505
- }
18506
- ),
18507
- props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18508
- Text,
18509
- {
18510
- $font: theme.typography[props.allocation.fontStyle].fontFamily,
18511
- $size: theme.typography[props.allocation.fontStyle].fontSize,
18512
- $weight: theme.typography[props.allocation.fontStyle].fontWeight,
18513
- $color: theme.typography[props.allocation.fontStyle].color,
18514
- children: priceBehavior && metricResetAt ? t2("Resets", {
18515
- date: toPrettyDate(metricResetAt, {
18516
- month: "short",
18517
- day: "numeric",
18518
- year: void 0
18519
- })
18520
- }) : typeof allocation === "number" ? t2("Limit of", {
18521
- amount: formatNumber(allocation)
18522
- }) : t2("No limit")
18523
- }
18524
- ) })
18525
- ]
18526
- }
18527
- )
18638
+ name: feature.icon,
18639
+ size: "sm",
18640
+ colors: [
18641
+ theme.primary,
18642
+ isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)"
18528
18643
  ]
18529
18644
  }
18530
18645
  ),
18531
- props.isVisible && typeof usage === "number" && typeof allocation === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $gap: "2rem", children: [
18532
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18533
- ProgressBar,
18534
- {
18535
- progress: usage / allocation * 100,
18536
- value: usage,
18537
- total: allocation,
18538
- color: progressColorMap[Math.floor(
18539
- Math.min(usage, allocation) / allocation * (progressColorMap.length - 1)
18540
- )],
18541
- $flexGrow: "1"
18542
- }
18543
- ),
18544
- priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18545
- EmbedButton,
18646
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
18647
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
18648
+ Flex,
18546
18649
  {
18547
- type: "button",
18548
- onClick: () => {
18549
- setSelected({ usage: true });
18550
- setLayout("checkout");
18551
- },
18552
- style: {
18553
- width: "fit-content",
18554
- padding: "0 1rem 0 0.5rem"
18650
+ ref: (el) => {
18651
+ if (el) {
18652
+ elements.current.push(el);
18653
+ }
18555
18654
  },
18556
- children: t2("Add More")
18655
+ $flexWrap: "wrap",
18656
+ $gap: "1rem",
18657
+ children: [
18658
+ feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
18659
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18660
+ Text,
18661
+ {
18662
+ as: Box,
18663
+ $font: theme.typography[props.header.fontStyle].fontFamily,
18664
+ $size: theme.typography[props.header.fontStyle].fontSize,
18665
+ $weight: theme.typography[props.header.fontStyle].fontWeight,
18666
+ $color: theme.typography[props.header.fontStyle].color,
18667
+ children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
18668
+ formatNumber(usage),
18669
+ " ",
18670
+ (0, import_pluralize5.default)(feature.name, usage)
18671
+ ] }) : feature.name
18672
+ }
18673
+ ),
18674
+ props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18675
+ Text,
18676
+ {
18677
+ as: Box,
18678
+ $font: theme.typography[props.description.fontStyle].fontFamily,
18679
+ $size: theme.typography[props.description.fontStyle].fontSize,
18680
+ $weight: theme.typography[props.description.fontStyle].fontWeight,
18681
+ $color: theme.typography[props.description.fontStyle].color,
18682
+ children: feature.description
18683
+ }
18684
+ )
18685
+ ] }),
18686
+ (feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
18687
+ Box,
18688
+ {
18689
+ $flexBasis: "min-content",
18690
+ $flexGrow: "1",
18691
+ $textAlign: shouldWrapChildren ? "left" : "right",
18692
+ children: [
18693
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18694
+ Text,
18695
+ {
18696
+ as: Box,
18697
+ $font: theme.typography[props.usage.fontStyle].fontFamily,
18698
+ $size: theme.typography[props.usage.fontStyle].fontSize,
18699
+ $weight: theme.typography[props.usage.fontStyle].fontWeight,
18700
+ $leading: 1.35,
18701
+ $color: theme.typography[props.usage.fontStyle].color,
18702
+ children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
18703
+ formatNumber(allocation),
18704
+ " ",
18705
+ (0, import_pluralize5.default)(feature.name, allocation)
18706
+ ] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
18707
+ formatNumber(usage),
18708
+ " ",
18709
+ (0, import_pluralize5.default)(feature.name, usage),
18710
+ priceBehavior === "overage" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
18711
+ " ",
18712
+ t2("used")
18713
+ ] })
18714
+ ] })
18715
+ }
18716
+ ),
18717
+ props.allocation.isVisible && priceBehavior !== "overage" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18718
+ Text,
18719
+ {
18720
+ $font: theme.typography[props.allocation.fontStyle].fontFamily,
18721
+ $size: theme.typography[props.allocation.fontStyle].fontSize,
18722
+ $weight: theme.typography[props.allocation.fontStyle].fontWeight,
18723
+ $color: theme.typography[props.allocation.fontStyle].color,
18724
+ children: priceBehavior && priceBehavior !== "overage" && metricResetAt ? t2("Resets", {
18725
+ date: toPrettyDate(metricResetAt, {
18726
+ month: "short",
18727
+ day: "numeric",
18728
+ year: void 0
18729
+ })
18730
+ }) : typeof allocation === "number" || typeof softLimit === "number" ? t2("Limit of", {
18731
+ amount: formatNumber(limit)
18732
+ }) : t2("No limit")
18733
+ }
18734
+ ) })
18735
+ ]
18736
+ }
18737
+ )
18738
+ ]
18557
18739
  }
18558
- )
18740
+ ),
18741
+ props.isVisible && typeof usage === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $gap: "2rem", children: [
18742
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18743
+ ProgressBar,
18744
+ {
18745
+ progress: (isOverage ? softLimit / usage : usage / limit) * 100,
18746
+ value: usage,
18747
+ total: isOverage ? softLimit : limit,
18748
+ color: isOverage ? "blue" : progressColorMap[Math.floor(
18749
+ Math.min(usage, limit) / limit * (progressColorMap.length - 1)
18750
+ )],
18751
+ ...isOverage && { bgColor: "#EF4444" },
18752
+ $flexGrow: "1"
18753
+ }
18754
+ ),
18755
+ priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
18756
+ EmbedButton,
18757
+ {
18758
+ onClick: () => {
18759
+ setSelected({ usage: true });
18760
+ setLayout("checkout");
18761
+ },
18762
+ style: {
18763
+ width: "fit-content",
18764
+ padding: "0 1rem 0 0.5rem"
18765
+ },
18766
+ children: t2("Add More")
18767
+ }
18768
+ )
18769
+ ] })
18559
18770
  ] })
18560
18771
  ] })
18561
18772
  ] }, index);
@@ -18983,7 +19194,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
18983
19194
  };
18984
19195
  const usageBasedEntitlements = (featureUsage?.features || []).reduce(
18985
19196
  (acc, usage) => {
18986
- const quantity = usage?.allocation ?? 0;
19197
+ const quantity = usage.allocation || usage.softLimit || 0;
18987
19198
  let price;
18988
19199
  let currencyCode;
18989
19200
  if (currentPlan?.planPeriod === "month") {
@@ -18993,7 +19204,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
18993
19204
  price = usage.yearlyUsageBasedPrice?.price;
18994
19205
  currencyCode = usage.yearlyUsageBasedPrice?.currency;
18995
19206
  }
18996
- if (usage.priceBehavior && typeof price === "number" && quantity > 0) {
19207
+ if (usage.priceBehavior && typeof price === "number") {
18997
19208
  acc.push({ ...usage, price, quantity, currencyCode });
18998
19209
  }
18999
19210
  return acc;
@@ -19223,6 +19434,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
19223
19434
  ),
19224
19435
  usageBasedEntitlements.reduce(
19225
19436
  (acc, entitlement) => {
19437
+ const overageAmount = entitlement.priceBehavior === "overage" && (entitlement?.usage ?? 0) - (entitlement?.softLimit ?? 0);
19438
+ const amount = entitlement.quantity || Math.max(entitlement?.softLimit || 0, 0);
19226
19439
  if (entitlement.feature?.name) {
19227
19440
  acc.push(
19228
19441
  /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
@@ -19240,17 +19453,45 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
19240
19453
  $size: theme.typography[props.addOns.fontStyle].fontSize,
19241
19454
  $weight: theme.typography[props.addOns.fontStyle].fontWeight,
19242
19455
  $color: theme.typography[props.addOns.fontStyle].color,
19243
- children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
19244
- entitlement.quantity,
19456
+ children: entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && amount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
19457
+ amount,
19245
19458
  " ",
19246
- (0, import_pluralize6.default)(
19247
- entitlement.feature.name,
19248
- entitlement.quantity
19249
- )
19459
+ (0, import_pluralize6.default)(entitlement.feature.name, amount)
19250
19460
  ] }) : entitlement.feature.name
19251
19461
  }
19252
19462
  ),
19253
19463
  /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $alignItems: "center", $gap: "1rem", children: [
19464
+ entitlement.priceBehavior === "overage" && currentPlan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
19465
+ Text,
19466
+ {
19467
+ $font: theme.typography.text.fontFamily,
19468
+ $size: 0.875 * theme.typography.text.fontSize,
19469
+ $weight: theme.typography.text.fontWeight,
19470
+ $color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
19471
+ children: typeof overageAmount === "number" && overageAmount > 0 ? t2("X over the limit", {
19472
+ amount: overageAmount
19473
+ }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
19474
+ t2("Overage fee"),
19475
+ ":",
19476
+ " ",
19477
+ formatCurrency(
19478
+ entitlement.price,
19479
+ entitlement.currencyCode
19480
+ ),
19481
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
19482
+ "/",
19483
+ (0, import_pluralize6.default)(
19484
+ entitlement.feature.name.toLowerCase(),
19485
+ 1
19486
+ ),
19487
+ entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
19488
+ "/",
19489
+ shortenPeriod(currentPlan.planPeriod)
19490
+ ] })
19491
+ ] })
19492
+ ] })
19493
+ }
19494
+ ),
19254
19495
  entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
19255
19496
  Text,
19256
19497
  {
@@ -19275,7 +19516,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
19275
19516
  ]
19276
19517
  }
19277
19518
  ),
19278
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
19519
+ amount > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
19279
19520
  Text,
19280
19521
  {
19281
19522
  $font: theme.typography.text.fontFamily,
@@ -19284,10 +19525,10 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
19284
19525
  $color: theme.typography.text.color,
19285
19526
  children: [
19286
19527
  formatCurrency(
19287
- entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1),
19528
+ entitlement.price * amount,
19288
19529
  entitlement.currencyCode
19289
19530
  ),
19290
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
19531
+ (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
19291
19532
  "/",
19292
19533
  currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : (0, import_pluralize6.default)(
19293
19534
  entitlement.feature.name.toLowerCase(),
@@ -19585,6 +19826,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
19585
19826
  }
19586
19827
  ) }),
19587
19828
  plan.entitlements.reduce((acc, entitlement) => {
19829
+ const limit = entitlement.softLimit || entitlement.valueNumeric;
19588
19830
  let price;
19589
19831
  let currency;
19590
19832
  if (selectedPeriod === "month") {
@@ -19610,49 +19852,101 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
19610
19852
  ]
19611
19853
  }
19612
19854
  ),
19613
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
19614
- Text,
19855
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
19856
+ Flex,
19615
19857
  {
19616
- $font: theme.typography.text.fontFamily,
19617
- $size: theme.typography.text.fontSize,
19618
- $weight: theme.typography.text.fontWeight,
19619
- $color: theme.typography.text.color,
19620
- $leading: 1.35,
19621
- children: typeof price !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19622
- formatCurrency(price, currency),
19623
- " ",
19624
- t2("per"),
19625
- " ",
19626
- (0, import_pluralize7.default)(
19627
- entitlement.feature.name,
19628
- 1
19858
+ $flexDirection: "column",
19859
+ $justifyContent: "center",
19860
+ $gap: "0.5rem",
19861
+ children: [
19862
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
19863
+ Text,
19864
+ {
19865
+ $font: theme.typography.text.fontFamily,
19866
+ $size: theme.typography.text.fontSize,
19867
+ $weight: theme.typography.text.fontWeight,
19868
+ $color: theme.typography.text.color,
19869
+ $leading: 1.35,
19870
+ children: typeof price === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19871
+ formatCurrency(price, currency),
19872
+ " ",
19873
+ t2("per"),
19874
+ " ",
19875
+ (0, import_pluralize7.default)(
19876
+ entitlement.feature.name,
19877
+ 1
19878
+ ),
19879
+ entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19880
+ " ",
19881
+ t2("per"),
19882
+ " ",
19883
+ selectedPeriod
19884
+ ] })
19885
+ ] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19886
+ entitlement.valueType === "unlimited" ? t2("Unlimited", {
19887
+ item: (0, import_pluralize7.default)(
19888
+ entitlement.feature.name
19889
+ )
19890
+ }) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19891
+ formatNumber(limit),
19892
+ " ",
19893
+ (0, import_pluralize7.default)(
19894
+ entitlement.feature.name,
19895
+ limit
19896
+ )
19897
+ ] }),
19898
+ entitlement.metricPeriod ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19899
+ " ",
19900
+ t2("per"),
19901
+ " ",
19902
+ {
19903
+ billing: "billing period",
19904
+ current_day: "day",
19905
+ current_month: "month",
19906
+ current_year: "year"
19907
+ }[entitlement.metricPeriod]
19908
+ ] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19909
+ "/",
19910
+ shortenPeriod(selectedPeriod)
19911
+ ] })
19912
+ ] }) : entitlement.feature.name
19913
+ }
19629
19914
  ),
19630
- entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19631
- " ",
19632
- t2("per"),
19633
- " ",
19634
- selectedPeriod
19635
- ] })
19636
- ] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19637
- entitlement.valueType === "unlimited" ? t2("Unlimited", {
19638
- item: (0, import_pluralize7.default)(
19639
- entitlement.feature.name
19640
- )
19641
- }) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize7.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
19642
- entitlement.metricPeriod && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19643
- " ",
19644
- t2("per"),
19645
- " ",
19915
+ entitlement.priceBehavior === "overage" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
19916
+ Text,
19646
19917
  {
19647
- billing: "billing period",
19648
- current_day: "day",
19649
- current_month: "month",
19650
- current_year: "year"
19651
- }[entitlement.metricPeriod]
19652
- ] })
19653
- ] }) : entitlement.feature.name
19918
+ $font: theme.typography.text.fontFamily,
19919
+ $size: 0.875 * theme.typography.text.fontSize,
19920
+ $weight: theme.typography.text.fontWeight,
19921
+ $color: hexToHSL(
19922
+ theme.typography.text.color
19923
+ ).l > 50 ? darken(
19924
+ theme.typography.text.color,
19925
+ 0.46
19926
+ ) : lighten(
19927
+ theme.typography.text.color,
19928
+ 0.46
19929
+ ),
19930
+ $leading: 1.35,
19931
+ children: [
19932
+ formatCurrency(price),
19933
+ "/",
19934
+ (0, import_pluralize7.default)(
19935
+ entitlement.feature.name.toLowerCase(),
19936
+ 1
19937
+ ),
19938
+ entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
19939
+ "/",
19940
+ shortenPeriod(selectedPeriod)
19941
+ ] }),
19942
+ " ",
19943
+ t2("overage fee")
19944
+ ]
19945
+ }
19946
+ )
19947
+ ]
19654
19948
  }
19655
- ) })
19949
+ )
19656
19950
  ] }, entitlement.id)
19657
19951
  );
19658
19952
  return acc;