@schematichq/schematic-components 0.4.0-rc.2 → 0.4.0-rc.4

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.
@@ -2097,7 +2097,7 @@ __export(src_exports, {
2097
2097
  module.exports = __toCommonJS(src_exports);
2098
2098
 
2099
2099
  // src/components/elements/included-features/IncludedFeatures.tsx
2100
- var import_react14 = require("react");
2100
+ var import_react16 = require("react");
2101
2101
 
2102
2102
  // node_modules/styled-components/node_modules/tslib/tslib.es6.mjs
2103
2103
  var __assign = function() {
@@ -8012,6 +8012,31 @@ function BillingPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8012
8012
  };
8013
8013
  }
8014
8014
 
8015
+ // src/api/models/BillingPriceView.ts
8016
+ function BillingPriceViewFromJSON(json) {
8017
+ return BillingPriceViewFromJSONTyped(json, false);
8018
+ }
8019
+ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
8020
+ if (json == null) {
8021
+ return json;
8022
+ }
8023
+ return {
8024
+ createdAt: new Date(json["created_at"]),
8025
+ currency: json["currency"],
8026
+ id: json["id"],
8027
+ interval: json["interval"],
8028
+ meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
8029
+ price: json["price"],
8030
+ priceExternalId: json["price_external_id"],
8031
+ priceId: json["price_id"],
8032
+ productExternalId: json["product_external_id"],
8033
+ productId: json["product_id"],
8034
+ productName: json["product_name"],
8035
+ updatedAt: new Date(json["updated_at"]),
8036
+ usageType: json["usage_type"]
8037
+ };
8038
+ }
8039
+
8015
8040
  // src/api/models/BillingProductDetailResponseData.ts
8016
8041
  function BillingProductDetailResponseDataFromJSON(json) {
8017
8042
  return BillingProductDetailResponseDataFromJSONTyped(json, false);
@@ -8084,7 +8109,8 @@ function BillingSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
8084
8109
  periodStart: json["period_start"],
8085
8110
  status: json["status"],
8086
8111
  subscriptionExternalId: json["subscription_external_id"],
8087
- totalPrice: json["total_price"]
8112
+ totalPrice: json["total_price"],
8113
+ trialEnd: json["trial_end"] == null ? void 0 : json["trial_end"]
8088
8114
  };
8089
8115
  }
8090
8116
 
@@ -8173,7 +8199,8 @@ function BillingSubscriptionViewFromJSONTyped(json, ignoreDiscriminator) {
8173
8199
  ),
8174
8200
  status: json["status"],
8175
8201
  subscriptionExternalId: json["subscription_external_id"],
8176
- totalPrice: json["total_price"]
8202
+ totalPrice: json["total_price"],
8203
+ trialEnd: json["trial_end"] == null ? void 0 : json["trial_end"]
8177
8204
  };
8178
8205
  }
8179
8206
 
@@ -8341,6 +8368,7 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8341
8368
  addOns: json["add_ons"].map(
8342
8369
  CompanyPlanWithBillingSubViewFromJSON
8343
8370
  ),
8371
+ billingSubscription: json["billing_subscription"] == null ? void 0 : BillingSubscriptionViewFromJSON(json["billing_subscription"]),
8344
8372
  billingSubscriptions: json["billing_subscriptions"].map(
8345
8373
  BillingSubscriptionViewFromJSON
8346
8374
  ),
@@ -8607,10 +8635,12 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8607
8635
  feature: json["feature"] == null ? void 0 : FeatureResponseDataFromJSON(json["feature"]),
8608
8636
  featureId: json["feature_id"],
8609
8637
  id: json["id"],
8638
+ meteredPrice: json["metered_price"] == null ? void 0 : BillingPriceViewFromJSON(json["metered_price"]),
8610
8639
  metricPeriod: json["metric_period"] == null ? void 0 : json["metric_period"],
8611
8640
  metricPeriodMonthReset: json["metric_period_month_reset"] == null ? void 0 : json["metric_period_month_reset"],
8612
8641
  plan: json["plan"] == null ? void 0 : PlanResponseDataFromJSON(json["plan"]),
8613
8642
  planId: json["plan_id"],
8643
+ priceBehavior: json["price_behavior"] == null ? void 0 : json["price_behavior"],
8614
8644
  ruleId: json["rule_id"],
8615
8645
  updatedAt: new Date(json["updated_at"]),
8616
8646
  valueBool: json["value_bool"] == null ? void 0 : json["value_bool"],
@@ -8645,6 +8675,7 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8645
8675
  icon: json["icon"],
8646
8676
  id: json["id"],
8647
8677
  isDefault: json["is_default"],
8678
+ isFree: json["is_free"],
8648
8679
  isTrialable: json["is_trialable"],
8649
8680
  monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["monthly_price"]),
8650
8681
  name: json["name"],
@@ -9675,13 +9706,10 @@ var EmbedProvider = ({
9675
9706
  }, [id, state.api]);
9676
9707
  const setData = (0, import_react3.useCallback)(
9677
9708
  (data) => {
9678
- setState((prev2) => {
9679
- const updatedData = (0, import_merge.default)({}, prev2.data, { ...data });
9680
- return {
9681
- ...prev2,
9682
- data: updatedData
9683
- };
9684
- });
9709
+ setState((prev2) => ({
9710
+ ...prev2,
9711
+ data
9712
+ }));
9685
9713
  },
9686
9714
  [setState]
9687
9715
  );
@@ -9720,7 +9748,7 @@ var EmbedProvider = ({
9720
9748
  (0, import_react3.useEffect)(() => {
9721
9749
  if (accessToken) {
9722
9750
  const { headers = {} } = apiConfig ?? {};
9723
- headers["X-Schematic-Components-Version"] = "0.4.0-rc.2";
9751
+ headers["X-Schematic-Components-Version"] = "0.4.0-rc.4";
9724
9752
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
9725
9753
  const config = new Configuration({
9726
9754
  ...apiConfig,
@@ -10001,22 +10029,39 @@ var Root = (0, import_react7.forwardRef)(
10001
10029
  Root.displayName = "Root";
10002
10030
 
10003
10031
  // src/components/layout/viewport/Viewport.tsx
10004
- var import_react11 = require("react");
10032
+ var import_react13 = require("react");
10005
10033
 
10006
10034
  // src/components/ui/box/styles.ts
10007
10035
  var Box = dt.div((props) => {
10008
- const initialStyles = [];
10009
- return Object.entries(props).reduce((acc, [key, value]) => {
10010
- if (key.startsWith("$")) {
10036
+ function reducer(acc, [key, value]) {
10037
+ if (key.startsWith("$") && key !== "$viewport") {
10011
10038
  acc.push(
10012
10039
  // keys will always be CSS properties
10013
10040
  attr(camelToHyphen(key.slice(1)), value)
10014
10041
  );
10015
10042
  }
10016
10043
  return acc;
10017
- }, initialStyles);
10044
+ }
10045
+ const styles = Object.entries(props).reduce(reducer, []);
10046
+ for (const [key, value] of Object.entries(props.$viewport || {})) {
10047
+ styles.push(lt`
10048
+ ${{
10049
+ sm: "@media (min-width: 640px)",
10050
+ md: "@media (min-width: 768px)",
10051
+ lg: "@media (min-width: 1024px)",
10052
+ xl: "@media (min-width: 1280px)",
10053
+ "2xl": "@media (min-width: 1536px)"
10054
+ }[key] || key} {
10055
+ ${Object.entries(value || {}).reduce(reducer, [])}
10056
+ }
10057
+ `);
10058
+ }
10059
+ return styles;
10018
10060
  });
10019
10061
 
10062
+ // src/components/ui/button/Button.tsx
10063
+ var import_react8 = require("react");
10064
+
10020
10065
  // src/components/ui/button/styles.ts
10021
10066
  var Button = dt.button`
10022
10067
  appearance: none;
@@ -10102,30 +10147,33 @@ var Button = dt.button`
10102
10147
 
10103
10148
  // src/components/ui/button/Button.tsx
10104
10149
  var import_jsx_runtime3 = require("react/jsx-runtime");
10105
- var Button2 = ({
10106
- color = "white",
10107
- size = "md",
10108
- variant = "solid",
10109
- disabled = false,
10110
- isLoading = false,
10111
- children,
10112
- ...props
10113
- }) => {
10114
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
10115
- Button,
10116
- {
10117
- $color: color,
10118
- $size: size,
10119
- $variant: variant,
10120
- disabled,
10121
- ...props,
10122
- children: [
10123
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { $size: "sm", $isLoading: isLoading }),
10124
- children
10125
- ]
10126
- }
10127
- );
10128
- };
10150
+ var Button2 = (0, import_react8.forwardRef)(
10151
+ ({
10152
+ color = "white",
10153
+ size = "md",
10154
+ variant = "solid",
10155
+ disabled = false,
10156
+ isLoading = false,
10157
+ children,
10158
+ ...props
10159
+ }, ref) => {
10160
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
10161
+ Button,
10162
+ {
10163
+ ref,
10164
+ $color: color,
10165
+ $size: size,
10166
+ $variant: variant,
10167
+ disabled,
10168
+ ...props,
10169
+ children: [
10170
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { $size: "sm", $isLoading: isLoading }),
10171
+ children
10172
+ ]
10173
+ }
10174
+ );
10175
+ }
10176
+ );
10129
10177
 
10130
10178
  // src/components/ui/icon/styles.ts
10131
10179
  var Icon = dt.i`
@@ -10369,7 +10417,7 @@ var Loader = dt.div`
10369
10417
  border-top-color: ${({ theme, $color }) => $color || theme.primary};
10370
10418
  border-radius: 50%;
10371
10419
  transition: all 0.1s;
10372
- animation: ${spin} 1.5s linear infinite;
10420
+ animation: 1.5s linear infinite ${spin};
10373
10421
 
10374
10422
  ${({ $size = "md", $isLoading = true }) => {
10375
10423
  let px;
@@ -10406,7 +10454,7 @@ var Loader = dt.div`
10406
10454
  `;
10407
10455
 
10408
10456
  // src/components/ui/modal/Modal.tsx
10409
- var import_react8 = require("react");
10457
+ var import_react9 = require("react");
10410
10458
 
10411
10459
  // src/components/ui/modal/styles.ts
10412
10460
  var Container2 = dt(Box)`
@@ -10427,108 +10475,120 @@ var Container2 = dt(Box)`
10427
10475
 
10428
10476
  // src/components/ui/modal/Modal.tsx
10429
10477
  var import_jsx_runtime6 = require("react/jsx-runtime");
10430
- var Modal = ({
10431
- children,
10432
- size = "auto",
10433
- top = 0,
10434
- onClose
10435
- }) => {
10436
- const theme = nt();
10437
- const { setLayout } = useEmbed();
10438
- const ref = (0, import_react8.useRef)(null);
10439
- const isLightBackground = useIsLightBackground();
10440
- const handleClose = (0, import_react8.useCallback)(() => {
10441
- setLayout("portal");
10442
- onClose?.();
10443
- }, [setLayout, onClose]);
10444
- (0, import_react8.useEffect)(() => {
10445
- ref.current?.focus();
10446
- }, []);
10447
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
10448
- Container2,
10449
- {
10450
- ref,
10451
- tabIndex: 0,
10452
- onClick: (event) => {
10453
- if (event.target === event.currentTarget) {
10454
- handleClose();
10455
- }
10456
- },
10457
- onKeyDown: (event) => {
10458
- if (event.key === "Escape") {
10459
- handleClose();
10460
- }
10461
- },
10462
- $position: "absolute",
10463
- $top: "50%",
10464
- $left: "50%",
10465
- $zIndex: "999999",
10466
- $transform: "translate(-50%, -50%)",
10467
- $width: "100%",
10468
- $height: "100%",
10469
- $marginTop: `${top}px`,
10470
- $backgroundColor: isLightBackground ? "hsla(0, 0%, 85%, 0.8)" : "hsla(0, 0%, 0%, 0.8)",
10471
- $overflow: "hidden",
10472
- $scrollbarColor: `${isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)"} transparent`,
10473
- $scrollbarWidth: "thin",
10474
- $scrollbarGutter: "stable both-edges",
10475
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
10476
- Flex,
10477
- {
10478
- $position: "relative",
10479
- $top: "50%",
10480
- $left: "50%",
10481
- $transform: "translate(-50%, -50%)",
10482
- $flexDirection: "column",
10483
- $overflow: "hidden",
10484
- ...size === "auto" ? { $width: "fit-content", $height: "fit-content" } : {
10478
+ var Modal = (0, import_react9.forwardRef)(
10479
+ ({ children, contentRef, size = "auto", top = 0, onClose, ...rest }, ref) => {
10480
+ const theme = nt();
10481
+ const { setLayout } = useEmbed();
10482
+ const isLightBackground = useIsLightBackground();
10483
+ const handleClose = (0, import_react9.useCallback)(() => {
10484
+ setLayout("portal");
10485
+ onClose?.();
10486
+ }, [setLayout, onClose]);
10487
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
10488
+ Container2,
10489
+ {
10490
+ ref,
10491
+ tabIndex: 0,
10492
+ onClick: (event) => {
10493
+ if (event.target === event.currentTarget) {
10494
+ handleClose();
10495
+ }
10496
+ },
10497
+ onKeyDown: (event) => {
10498
+ if (event.key === "Escape") {
10499
+ handleClose();
10500
+ }
10501
+ },
10502
+ ...rest,
10503
+ $position: "absolute",
10504
+ $top: "50%",
10505
+ $left: "50%",
10506
+ $zIndex: "999999",
10507
+ $transform: "translate(-50%, -50%)",
10508
+ $width: "100%",
10509
+ $height: "100%",
10510
+ $marginTop: `${top}px`,
10511
+ $backgroundColor: isLightBackground ? "hsla(0, 0%, 85%, 0.8)" : "hsla(0, 0%, 0%, 0.8)",
10512
+ $overflow: "hidden",
10513
+ $scrollbarColor: `${isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)"} transparent`,
10514
+ $scrollbarWidth: "thin",
10515
+ $scrollbarGutter: "stable both-edges",
10516
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
10517
+ Flex,
10518
+ {
10519
+ ref: contentRef,
10520
+ $position: "relative",
10521
+ $top: "50%",
10522
+ $left: "50%",
10523
+ $transform: "translate(-50%, -50%)",
10524
+ $flexDirection: "column",
10525
+ $overflow: "auto",
10485
10526
  $width: "100%",
10486
- ...size === "lg" ? { $height: "100%" } : { $height: "fit-content" },
10487
- $maxWidth: size === "sm" ? "480px" : size === "md" ? "688px" : "1356px",
10488
- $maxHeight: "860px"
10489
- },
10490
- $backgroundColor: theme.card.background,
10491
- $borderRadius: "0.5rem",
10492
- $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
10493
- id: "select-plan-dialog",
10494
- role: "dialog",
10495
- "aria-labelledby": "select-plan-dialog-label",
10496
- "aria-modal": "true",
10497
- children
10498
- }
10499
- )
10500
- }
10501
- );
10502
- };
10527
+ $height: "100vh",
10528
+ $backgroundColor: theme.card.background,
10529
+ $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
10530
+ role: "dialog",
10531
+ "aria-modal": "true",
10532
+ $viewport: {
10533
+ md: {
10534
+ ...size === "auto" ? { $width: "fit-content", $height: "fit-content" } : {
10535
+ $width: "100%",
10536
+ ...size === "lg" ? { $height: "100%" } : { $height: "fit-content" },
10537
+ $maxWidth: size === "sm" ? "480px" : size === "md" ? "688px" : "1356px",
10538
+ $maxHeight: "860px"
10539
+ },
10540
+ $borderRadius: "0.5rem"
10541
+ }
10542
+ },
10543
+ children
10544
+ }
10545
+ )
10546
+ }
10547
+ );
10548
+ }
10549
+ );
10550
+ Modal.displayName = "Modal";
10503
10551
 
10504
10552
  // src/components/ui/modal/ModalHeader.tsx
10505
- var import_react9 = require("react");
10553
+ var import_react10 = require("react");
10506
10554
  var import_jsx_runtime7 = require("react/jsx-runtime");
10507
10555
  var ModalHeader = ({
10508
10556
  children,
10509
10557
  bordered = false,
10510
10558
  onClose
10511
10559
  }) => {
10560
+ const theme = nt();
10512
10561
  const { setLayout } = useEmbed();
10513
10562
  const isLightBackground = useIsLightBackground();
10514
- const handleClose = (0, import_react9.useCallback)(() => {
10563
+ const handleClose = (0, import_react10.useCallback)(() => {
10515
10564
  setLayout("portal");
10516
10565
  onClose?.();
10517
10566
  }, [setLayout, onClose]);
10518
10567
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
10519
10568
  Flex,
10520
10569
  {
10570
+ $position: "sticky",
10571
+ $top: 0,
10572
+ $left: 0,
10573
+ $zIndex: 1,
10521
10574
  $justifyContent: children ? "space-between" : "end",
10522
10575
  $alignItems: "center",
10523
- $flexShrink: "0",
10576
+ $flexShrink: 0,
10524
10577
  $gap: "1rem",
10525
- $height: "5rem",
10526
- $padding: "0 1.5rem 0 3rem",
10578
+ $height: "3.5rem",
10579
+ $padding: "0 1rem",
10580
+ $backgroundColor: theme.card.background,
10527
10581
  ...bordered && {
10528
10582
  $borderBottomWidth: "1px",
10529
10583
  $borderBottomStyle: "solid",
10530
10584
  $borderBottomColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)"
10531
10585
  },
10586
+ $viewport: {
10587
+ md: {
10588
+ $height: "5rem",
10589
+ $padding: "0 1.5rem 0 3rem"
10590
+ }
10591
+ },
10532
10592
  children: [
10533
10593
  children,
10534
10594
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box, { $cursor: "pointer", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
@@ -10653,34 +10713,126 @@ var Text = dt.span.attrs(({ onClick }) => ({
10653
10713
  `}
10654
10714
  `;
10655
10715
 
10716
+ // src/components/ui/tooltip/Tooltip.tsx
10717
+ var import_react11 = require("react");
10718
+ var import_react_dom = require("react-dom");
10719
+
10656
10720
  // src/components/ui/tooltip/styles.ts
10657
- var TooltipWrapper = dt(Box)`
10658
- position: relative;
10721
+ var Trigger = dt(Box)``;
10722
+ var coords = (position2) => {
10723
+ let x2 = 0;
10724
+ let y2 = 0;
10725
+ switch (position2) {
10726
+ case "top":
10727
+ x2 = -50;
10728
+ y2 = -100;
10729
+ break;
10730
+ case "right":
10731
+ x2 = 0;
10732
+ y2 = -50;
10733
+ break;
10734
+ case "bottom":
10735
+ x2 = -50;
10736
+ y2 = 0;
10737
+ break;
10738
+ case "left":
10739
+ x2 = -100;
10740
+ y2 = -50;
10741
+ break;
10742
+ }
10743
+ return { x: x2, y: y2 };
10744
+ };
10745
+ var arrowCoords = (position2) => {
10746
+ let x2 = 0;
10747
+ let y2 = 0;
10748
+ switch (position2) {
10749
+ case "top":
10750
+ x2 = -50;
10751
+ y2 = -50;
10752
+ break;
10753
+ case "right":
10754
+ x2 = 50;
10755
+ y2 = -50;
10756
+ break;
10757
+ case "bottom":
10758
+ x2 = -50;
10759
+ y2 = 50;
10760
+ break;
10761
+ case "left":
10762
+ x2 = -50;
10763
+ y2 = -50;
10764
+ break;
10765
+ }
10766
+ return { x: x2, y: y2 };
10767
+ };
10768
+ var origin = (position2) => {
10769
+ const o2 = {
10770
+ x: position2 === "top" ? "bottom" : position2 === "bottom" ? "top" : "center",
10771
+ y: position2 === "left" ? "right" : position2 === "right" ? "left" : "center"
10772
+ };
10773
+ return o2;
10774
+ };
10775
+ var grow = (translate) => {
10776
+ return mt`
10777
+ 0% {
10778
+ opacity: 0;
10779
+ transform: translate(${translate.x}%, ${translate.y}%) scale(0);
10780
+ }
10659
10781
 
10660
- .tooltip {
10782
+ 100% {
10783
+ opacity: 1;
10784
+ transform: translate(${translate.x}%, ${translate.y}%) scale(1);
10785
+ }
10786
+ `;
10787
+ };
10788
+ var Content = dt(Box).withConfig({
10789
+ shouldForwardProp: (prop) => !["x", "y", "position", "zIndex"].includes(prop)
10790
+ })(({ x: x2, y: y2, position: position2, zIndex }) => {
10791
+ const translate = coords(position2);
10792
+ const arrowTranslate = arrowCoords(position2);
10793
+ const transformOrigin = origin(position2);
10794
+ return lt`
10661
10795
  position: absolute;
10662
- left: 50%;
10663
- transform: translateX(-50%);
10664
- bottom: 100%;
10796
+ top: calc(
10797
+ ${y2}px -
10798
+ ${position2 === "top" ? 0.75 : position2 === "bottom" ? -0.75 : 0}rem
10799
+ );
10800
+ left: calc(
10801
+ ${x2}px -
10802
+ ${position2 === "left" ? 0.75 : position2 === "right" ? -0.75 : 0}rem
10803
+ );
10804
+ transform: translate(${translate.x}%, ${translate.y}%);
10805
+ z-index: ${zIndex};
10806
+ line-height: 1;
10665
10807
  width: max-content;
10666
10808
  max-width: 100%;
10667
- margin-bottom: 0.75rem;
10668
10809
  padding: ${1 / 1.15}rem 1rem;
10669
10810
  text-align: left;
10811
+ opacity: 0;
10670
10812
  background-color: ${({ theme }) => theme.card.background};
10671
10813
  border-radius: ${({ theme }) => `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`};
10672
10814
  filter: drop-shadow(0px 1px 20px #1018280f)
10673
10815
  drop-shadow(0px 1px 3px #1018281a);
10674
- transition: opacity 0.1s 0.2s ease-in-out;
10675
- opacity: 0;
10676
- visibility: hidden;
10816
+ transform-origin: ${transformOrigin.x} ${transformOrigin.y};
10817
+ animation: 0.2s ease-in-out 0.1s both ${grow(translate)};
10677
10818
 
10678
10819
  &::after {
10679
10820
  position: absolute;
10680
10821
  z-index: 0;
10681
- top: 100%;
10682
- left: 50%;
10683
- transform: translate(-50%, -50%);
10822
+ ${position2 === "top" ? lt`
10823
+ top: 100%;
10824
+ left: 50%;
10825
+ ` : position2 === "right" ? lt`
10826
+ top: 50%;
10827
+ right: 100%;
10828
+ ` : position2 === "bottom" ? lt`
10829
+ bottom: 100%;
10830
+ left: 50%;
10831
+ ` : lt`
10832
+ top: 50%;
10833
+ left: 100%;
10834
+ `};
10835
+ transform: translate(${arrowTranslate.x}%, ${arrowTranslate.y}%);
10684
10836
  content: "";
10685
10837
  display: block;
10686
10838
  width: 1rem;
@@ -10688,42 +10840,54 @@ var TooltipWrapper = dt(Box)`
10688
10840
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
10689
10841
  background-color: ${({ theme }) => theme.card.background};
10690
10842
  }
10691
- }
10692
-
10693
- &:hover {
10694
- .tooltip {
10695
- opacity: 1;
10696
- visibility: visible;
10697
- }
10698
- }
10699
- `;
10843
+ `;
10844
+ });
10700
10845
 
10701
10846
  // src/components/ui/tooltip/Tooltip.tsx
10702
10847
  var import_jsx_runtime9 = require("react/jsx-runtime");
10703
- var Tooltip = ({ label, description }) => {
10704
- const theme = nt();
10705
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(TooltipWrapper, { children: [
10706
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
10707
- Text,
10708
- {
10709
- $font: theme.typography.text.fontFamily,
10710
- $size: theme.typography.text.fontSize,
10711
- $weight: theme.typography.text.fontWeight,
10712
- $color: theme.typography.text.color,
10713
- children: label
10714
- }
10715
- ) }),
10716
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { className: "tooltip", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
10717
- Text,
10848
+ var Tooltip = ({
10849
+ trigger,
10850
+ content,
10851
+ position: position2 = "top",
10852
+ zIndex = 1,
10853
+ ...rest
10854
+ }) => {
10855
+ const ref = (0, import_react11.useRef)(null);
10856
+ const [show, setShow] = (0, import_react11.useState)(false);
10857
+ const [coords2, setCoords] = (0, import_react11.useState)({ x: 0, y: 0 });
10858
+ (0, import_react11.useLayoutEffect)(() => {
10859
+ if (ref.current) {
10860
+ const { top: offsetTop, left: offsetLeft } = document.body.getBoundingClientRect();
10861
+ const rect = ref.current.getBoundingClientRect();
10862
+ let x2 = position2 === "left" ? rect.left : rect.right;
10863
+ if (position2 === "top" || position2 === "bottom") {
10864
+ x2 -= rect.width / 2;
10865
+ }
10866
+ let y2 = position2 === "top" ? rect.top : rect.bottom;
10867
+ if (position2 === "left" || position2 === "right") {
10868
+ y2 -= rect.height / 2;
10869
+ }
10870
+ setCoords({
10871
+ x: Math.round(x2 - offsetLeft),
10872
+ y: Math.round(y2 - offsetTop)
10873
+ });
10874
+ }
10875
+ }, [position2, trigger]);
10876
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
10877
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
10878
+ Trigger,
10718
10879
  {
10719
- $font: theme.typography.text.fontFamily,
10720
- $size: theme.typography.text.fontSize,
10721
- $weight: theme.typography.text.fontWeight,
10722
- $color: theme.typography.text.color,
10723
- $leading: 1.15,
10724
- children: description
10880
+ ref,
10881
+ onPointerEnter: () => setShow(true),
10882
+ onPointerLeave: () => setShow(false),
10883
+ ...rest,
10884
+ children: trigger
10725
10885
  }
10726
- ) })
10886
+ ),
10887
+ show && (0, import_react_dom.createPortal)(
10888
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Content, { ...coords2, position: position2, zIndex, children: content }),
10889
+ document.body
10890
+ )
10727
10891
  ] });
10728
10892
  };
10729
10893
 
@@ -10734,97 +10898,94 @@ var Badge = () => {
10734
10898
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10735
10899
  Flex,
10736
10900
  {
10737
- $padding: "0 0.5rem",
10738
- $width: "100%",
10739
- $flexDirection: "row",
10740
- $alignItems: "center",
10741
10901
  $justifyContent: settings.badge.alignment,
10902
+ $alignItems: "center",
10903
+ $gridColumn: "1 / -1",
10742
10904
  children: [
10743
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { $marginRight: "0.5rem", $fontSize: "0.75rem", children: "Powered by" }),
10905
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { $fontSize: "0.75rem", $marginRight: "0.5rem", children: "Powered by" }),
10744
10906
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10745
10907
  "svg",
10746
10908
  {
10747
- width: "86",
10748
- height: "16",
10909
+ width: 86,
10910
+ height: 16,
10749
10911
  viewBox: "0 0 86 16",
10750
- fill: "none",
10751
- xmlns: "http://www.w3.org/2000/svg",
10912
+ style: { marginTop: "0.125rem" },
10752
10913
  children: [
10753
10914
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10754
10915
  "path",
10755
10916
  {
10756
10917
  d: "M21.2354 6.16227C21.1796 5.95015 21.0494 5.76779 20.8261 5.61893C20.6028 5.46635 20.3423 5.39564 20.0408 5.39564C19.3151 5.39564 18.7941 5.69708 18.7941 6.2367C18.7941 6.49721 18.9095 6.69073 19.1402 6.81726C19.3635 6.94379 19.732 7.07033 20.2344 7.18569C21.0084 7.37177 21.4922 7.51691 21.9686 7.7402C22.203 7.85557 22.3928 7.97465 22.5305 8.10863C22.7948 8.3803 22.9548 8.74501 22.9362 9.20276C22.9176 9.86147 22.6571 10.375 22.1547 10.7397C21.6523 11.1082 20.9563 11.2905 20.0818 11.2905C19.2072 11.2905 18.5597 11.1268 18.0312 10.8067C17.5065 10.4867 17.2013 10.0215 17.1194 9.41116L18.6192 9.27719C18.6974 9.57491 18.8723 9.7982 19.1514 9.94706C19.4305 10.0959 19.7394 10.1778 20.0818 10.1778C20.4614 10.1778 20.7777 10.0996 21.0308 9.9359C21.2838 9.77959 21.4104 9.56002 21.4104 9.28835C21.4104 8.90876 21.0531 8.61104 20.5991 8.43613C20.3683 8.35053 20.0855 8.27238 19.7468 8.19423C19.2705 8.07886 18.8946 7.97094 18.6155 7.87418C18.3364 7.78486 18.0908 7.66205 17.8712 7.51319C17.4358 7.21547 17.2832 6.8247 17.2832 6.2367C17.2832 5.61521 17.5325 5.13141 18.0312 4.79648C18.5262 4.46526 19.2035 4.29407 20.0669 4.29407C21.5853 4.29407 22.5752 4.9044 22.7389 6.05807L21.228 6.16227H21.2354Z",
10757
- fill: "black"
10918
+ fill: "currentColor"
10758
10919
  }
10759
10920
  ),
10760
10921
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10761
10922
  "path",
10762
10923
  {
10763
10924
  d: "M29.4145 8.9796L30.7803 9.55271C30.49 10.0923 30.0621 10.5129 29.5001 10.8217C28.9382 11.1344 28.3167 11.2944 27.6319 11.2944C26.9472 11.2944 26.3629 11.1567 25.8121 10.8701C25.2613 10.5873 24.8147 10.1742 24.4835 9.6383C24.1523 9.09868 23.9811 8.48835 23.9811 7.79987C23.9811 7.11138 24.1486 6.49361 24.4835 5.95771C24.8147 5.41809 25.2613 5.00873 25.8121 4.72589C26.3629 4.44305 26.9732 4.30164 27.6319 4.30164C28.2906 4.30164 28.9382 4.45794 29.5038 4.77427C30.0658 5.08688 30.4938 5.51113 30.7803 6.05075L29.4145 6.62015C29.0535 5.93539 28.3985 5.56323 27.6319 5.56323C27.0327 5.56323 26.5303 5.77536 26.1135 6.19961C25.6967 6.62387 25.492 7.15977 25.492 7.80731C25.492 8.45486 25.6967 8.99076 26.1135 9.40757C26.5303 9.83182 27.0327 10.0439 27.6319 10.0439C28.3985 10.0439 29.0535 9.66807 29.4145 8.98703V8.9796Z",
10764
- fill: "black"
10925
+ fill: "currentColor"
10765
10926
  }
10766
10927
  ),
10767
10928
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10768
10929
  "path",
10769
10930
  {
10770
10931
  d: "M37.4386 11.2049V7.80341C37.4386 6.35945 36.9139 5.59282 35.697 5.59282C35.0978 5.59282 34.614 5.7975 34.2419 6.21059C33.8623 6.61996 33.6725 7.15214 33.6725 7.80713V11.2086H32.1615V1.9234H33.6725V5.47745C34.1004 4.73315 35.001 4.29773 36.1919 4.29773C37.167 4.29773 37.8666 4.59917 38.302 5.19834C38.7375 5.7975 38.9533 6.66834 38.9533 7.80341V11.2049H37.4349H37.4386Z",
10771
- fill: "black"
10932
+ fill: "currentColor"
10772
10933
  }
10773
10934
  ),
10774
10935
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10775
10936
  "path",
10776
10937
  {
10777
10938
  d: "M46.5692 5.38819C47.2167 6.07295 47.5777 7.1187 47.5107 8.30587H41.8242C41.9284 8.83805 42.1741 9.26602 42.5611 9.59352C42.9481 9.92473 43.4022 10.0885 43.9157 10.0885C44.8052 10.0885 45.5234 9.59724 45.8844 8.78222L47.1795 9.40372C46.8818 9.99172 46.4352 10.4495 45.8509 10.7881C45.2629 11.1268 44.6191 11.2943 43.9157 11.2943C42.9295 11.2943 42.0178 10.9444 41.3516 10.3453C40.6855 9.7461 40.2649 8.83432 40.2649 7.79602C40.2649 6.75771 40.6892 5.84222 41.3516 5.23933C42.0178 4.64017 42.9295 4.29034 43.9157 4.29034C44.9801 4.29034 45.9216 4.69971 46.5692 5.38447V5.38819ZM42.5388 6.00224C42.1592 6.32974 41.921 6.75772 41.8205 7.29734H46.0221C45.9179 6.75772 45.6835 6.3223 45.3039 5.99852C44.9243 5.67847 44.4628 5.51473 43.9195 5.51473C43.3761 5.51473 42.9221 5.67847 42.5425 6.00597L42.5388 6.00224Z",
10778
- fill: "black"
10939
+ fill: "currentColor"
10779
10940
  }
10780
10941
  ),
10781
10942
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10782
10943
  "path",
10783
10944
  {
10784
10945
  d: "M59.7699 5.23933C60.1495 5.86827 60.3132 6.68329 60.3132 7.80347V11.2049H58.8023V7.80347C58.8023 6.35952 58.3371 5.59288 57.2318 5.59288C56.6438 5.59288 56.1861 5.79384 55.8586 6.19577C55.5311 6.60141 55.3673 7.13731 55.3673 7.80347V11.2049H53.8489V7.80347C53.8489 6.35952 53.3838 5.59288 52.2785 5.59288C51.6905 5.59288 51.2327 5.79384 50.9052 6.19577C50.574 6.60141 50.4102 7.13731 50.4102 7.80347V11.2049H48.8993V4.39827H50.3433L50.4102 5.47379C50.8196 4.65878 51.5825 4.29407 52.8106 4.29407C53.9606 4.29407 54.7161 4.78531 55.077 5.76407C55.5199 4.81508 56.4428 4.29407 57.7677 4.29407C58.7093 4.29407 59.3829 4.61412 59.7699 5.23562V5.23933Z",
10785
- fill: "black"
10946
+ fill: "currentColor"
10786
10947
  }
10787
10948
  ),
10788
10949
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10789
10950
  "path",
10790
10951
  {
10791
10952
  d: "M67.4264 5.47382L67.4934 4.3983H68.9373V11.205H67.4934L67.4264 10.1294C67.0282 10.9147 66.1797 11.3092 64.8809 11.3017C63.102 11.3427 61.591 9.79823 61.6283 7.8035C61.591 5.8162 63.102 4.2606 64.8809 4.29782C66.0643 4.29782 67.0096 4.7444 67.4264 5.47754V5.47382ZM66.8049 9.37398C67.2217 8.95717 67.4264 8.43243 67.4264 7.79605C67.4264 7.15967 67.2217 6.64238 66.8049 6.21813C66.3881 5.80132 65.8782 5.58919 65.2828 5.58919C64.6874 5.58919 64.1887 5.80132 63.7719 6.21813C63.355 6.64238 63.1504 7.16711 63.1504 7.79605C63.1504 8.42499 63.355 8.95717 63.7719 9.37398C64.1887 9.79823 64.6911 10.0104 65.2828 10.0104C65.8745 10.0104 66.3881 9.79823 66.8049 9.37398Z",
10792
- fill: "black"
10953
+ fill: "currentColor"
10793
10954
  }
10794
10955
  ),
10795
10956
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10796
10957
  "path",
10797
10958
  {
10798
10959
  d: "M71.3891 2.85757H72.8926V4.39828H74.6455V5.58172H72.8926V8.9683C72.8926 9.5898 73.1048 9.90985 73.5923 9.96568C73.89 10.0252 74.2398 10.0141 74.6455 9.9359V11.1863C74.1989 11.257 73.7858 11.2943 73.4062 11.2943C72.6731 11.2943 72.1595 11.1082 71.8543 10.7323C71.5454 10.3639 71.3891 9.79076 71.3891 9.02041V5.58172H70.4215V4.39828H71.3891V2.85757Z",
10799
- fill: "black"
10960
+ fill: "currentColor"
10800
10961
  }
10801
10962
  ),
10802
10963
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10803
10964
  "path",
10804
10965
  {
10805
10966
  d: "M76.1747 3.15526C75.9923 2.98035 75.903 2.76078 75.903 2.50772C75.903 2.25466 75.9923 2.04997 76.1747 1.86762C76.3496 1.69271 76.5691 1.60339 76.8222 1.60339C77.0753 1.60339 77.2874 1.69271 77.4623 1.86762C77.6372 2.04997 77.7265 2.2621 77.7265 2.50772C77.7265 2.75334 77.6372 2.97291 77.4623 3.15526C77.2874 3.33762 77.0678 3.42694 76.8222 3.42694C76.5766 3.42694 76.3496 3.33762 76.1747 3.15526ZM76.0593 4.39826H77.5777V11.2049H76.0593V4.39826Z",
10806
- fill: "black"
10967
+ fill: "currentColor"
10807
10968
  }
10808
10969
  ),
10809
10970
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10810
10971
  "path",
10811
10972
  {
10812
10973
  d: "M84.3023 8.9796L85.6681 9.55271C85.3778 10.0923 84.9498 10.5129 84.3879 10.8217C83.8259 11.1344 83.2044 11.2944 82.5197 11.2944C81.8349 11.2944 81.2506 11.1567 80.6998 10.8701C80.1491 10.5873 79.7025 10.1742 79.3713 9.6383C79.04 9.09868 78.8689 8.48835 78.8689 7.79987C78.8689 7.11138 79.0363 6.49361 79.3713 5.95771C79.7025 5.41809 80.1528 5.00873 80.6998 4.72589C81.2469 4.44305 81.8609 4.30164 82.5197 4.30164C83.1784 4.30164 83.8259 4.45794 84.3916 4.77427C84.9535 5.08688 85.3815 5.51113 85.6681 6.05075L84.3023 6.62015C83.9413 5.93539 83.2863 5.56323 82.5197 5.56323C81.9205 5.56323 81.4181 5.77536 81.0013 6.19961C80.5845 6.62387 80.3798 7.15977 80.3798 7.80731C80.3798 8.45486 80.5845 8.99076 81.0013 9.40757C81.4181 9.83182 81.9205 10.0439 82.5197 10.0439C83.2863 10.0439 83.9413 9.66807 84.3023 8.98703V8.9796Z",
10813
- fill: "black"
10974
+ fill: "currentColor"
10814
10975
  }
10815
10976
  ),
10816
10977
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10817
10978
  "path",
10818
10979
  {
10819
10980
  d: "M5.93091 10.8141L7.2758 9.41753L3.83719 5.84667C2.98568 4.9624 2.98568 3.52157 3.83719 2.63731C4.68871 1.75305 6.07617 1.75305 6.92769 2.63731L10.3663 6.20817L11.7112 4.81156L8.27258 1.24069C6.67975 -0.413401 4.08513 -0.413401 2.4923 1.24069C0.899472 2.89479 0.899472 5.58919 2.4923 7.24328L5.93091 10.8141Z",
10820
- fill: "black"
10981
+ fill: "currentColor"
10821
10982
  }
10822
10983
  ),
10823
10984
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10824
10985
  "path",
10825
10986
  {
10826
10987
  d: "M6.05827 3.54751C5.68761 3.1626 5.08404 3.1626 4.71338 3.54751C4.34272 3.93243 4.34272 4.55921 4.71338 4.94413L9.02103 9.41746L5.93054 12.6268L1.62288 8.15349C1.25223 7.76857 0.648653 7.76857 0.277994 8.15349C-0.0926647 8.5384 -0.0926647 9.16519 0.277994 9.5501L5.93054 15.4201L11.7108 9.41746L6.05827 3.54751Z",
10827
- fill: "black"
10988
+ fill: "currentColor"
10828
10989
  }
10829
10990
  )
10830
10991
  ]
@@ -10836,7 +10997,7 @@ var Badge = () => {
10836
10997
  };
10837
10998
 
10838
10999
  // src/components/layout/RenderLayout.tsx
10839
- var import_react10 = require("react");
11000
+ var import_react12 = require("react");
10840
11001
  var import_jsx_runtime11 = require("react/jsx-runtime");
10841
11002
  var Disabled = () => {
10842
11003
  const theme = nt();
@@ -10878,14 +11039,14 @@ var Disabled = () => {
10878
11039
  var Success = () => {
10879
11040
  const theme = nt();
10880
11041
  const { hydrate, data, api, setLayout, isPending } = useEmbed();
10881
- const [isOpen, setIsOpen] = (0, import_react10.useState)(true);
10882
- (0, import_react10.useEffect)(() => {
11042
+ const [isOpen, setIsOpen] = (0, import_react12.useState)(true);
11043
+ (0, import_react12.useEffect)(() => {
10883
11044
  if (api && data.component?.id) {
10884
11045
  hydrate();
10885
11046
  setTimeout(() => setIsOpen(false), 2e3);
10886
11047
  }
10887
11048
  }, [api, data.component?.id, hydrate]);
10888
- (0, import_react10.useEffect)(() => {
11049
+ (0, import_react12.useEffect)(() => {
10889
11050
  if (!isPending && !isOpen) {
10890
11051
  setLayout("portal");
10891
11052
  }
@@ -10946,10 +11107,18 @@ var RenderLayout = ({ children }) => {
10946
11107
  };
10947
11108
 
10948
11109
  // src/components/layout/viewport/styles.ts
10949
- var StyledViewport = dt.div`
10950
- display: flex;
10951
- flex-wrap: wrap;
10952
- place-content: start;
11110
+ var StyledViewport = dt(Box).attrs(({ theme }) => ({
11111
+ $gridTemplateColumns: `repeat(auto-fill, minmax(300px, 1fr))`,
11112
+ $viewport: {
11113
+ xl: {
11114
+ $gridTemplateColumns: `repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`
11115
+ }
11116
+ }
11117
+ })).withConfig({
11118
+ shouldForwardProp: (prop) => !["$numberOfColumns", "numberOfColumns"].includes(prop)
11119
+ })`
11120
+ display: grid;
11121
+
10953
11122
  margin-left: auto;
10954
11123
  margin-right: auto;
10955
11124
  gap: 1rem;
@@ -10957,30 +11126,21 @@ var StyledViewport = dt.div`
10957
11126
 
10958
11127
  // src/components/layout/viewport/Viewport.tsx
10959
11128
  var import_jsx_runtime12 = require("react/jsx-runtime");
10960
- var Viewport = (0, import_react11.forwardRef)(
11129
+ var Viewport = (0, import_react13.forwardRef)(
10961
11130
  ({ children, ...props }, ref) => {
10962
- const theme = nt();
10963
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
10964
- StyledViewport,
10965
- {
10966
- ref,
10967
- $numberOfColumns: theme.numberOfColumns,
10968
- ...props,
10969
- children: [
10970
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RenderLayout, { children }),
10971
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, {})
10972
- ]
10973
- }
10974
- );
11131
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(StyledViewport, { ref, ...props, children: [
11132
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RenderLayout, { children }),
11133
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, {})
11134
+ ] }) });
10975
11135
  }
10976
11136
  );
10977
11137
  Viewport.displayName = "Viewport";
10978
11138
 
10979
11139
  // src/components/layout/column/Column.tsx
10980
- var import_react13 = require("react");
11140
+ var import_react15 = require("react");
10981
11141
 
10982
11142
  // src/components/layout/card/Card.tsx
10983
- var import_react12 = require("react");
11143
+ var import_react14 = require("react");
10984
11144
 
10985
11145
  // src/components/layout/card/styles.ts
10986
11146
  var Element = dt(Box)``;
@@ -11024,7 +11184,7 @@ var StyledCard = dt.div(({ theme }) => {
11024
11184
 
11025
11185
  // src/components/layout/card/Card.tsx
11026
11186
  var import_jsx_runtime13 = require("react/jsx-runtime");
11027
- var Card = (0, import_react12.forwardRef)(
11187
+ var Card = (0, import_react14.forwardRef)(
11028
11188
  ({ children, className }, ref) => {
11029
11189
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StyledCard, { ref, className, children });
11030
11190
  }
@@ -11033,14 +11193,12 @@ Card.displayName = "Card";
11033
11193
 
11034
11194
  // src/components/layout/column/styles.ts
11035
11195
  var StyledColumn = dt.div`
11036
- flex-grow: 1;
11037
- flex-basis: ${({ theme }) => `calc(${100 / theme.numberOfColumns}% - ${(theme.numberOfColumns - 1) / theme.numberOfColumns}rem)`};
11038
11196
  height: min-content;
11039
11197
  `;
11040
11198
 
11041
11199
  // src/components/layout/column/Column.tsx
11042
11200
  var import_jsx_runtime14 = require("react/jsx-runtime");
11043
- var Column = (0, import_react13.forwardRef)(
11201
+ var Column = (0, import_react15.forwardRef)(
11044
11202
  ({ children, basis, ...props }, ref) => {
11045
11203
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StyledColumn, { ref, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Card, { children }) });
11046
11204
  }
@@ -11073,11 +11231,11 @@ function resolveDesignProps(props) {
11073
11231
  visibleFeatures: props.visibleFeatures
11074
11232
  };
11075
11233
  }
11076
- var IncludedFeatures = (0, import_react14.forwardRef)(({ className, ...rest }, ref) => {
11234
+ var IncludedFeatures = (0, import_react16.forwardRef)(({ className, ...rest }, ref) => {
11077
11235
  const props = resolveDesignProps(rest);
11078
11236
  const theme = nt();
11079
11237
  const { data } = useEmbed();
11080
- const elements = (0, import_react14.useRef)([]);
11238
+ const elements = (0, import_react16.useRef)([]);
11081
11239
  const shouldWrapChildren = useWrapChildren(elements.current);
11082
11240
  const isLightBackground = useIsLightBackground();
11083
11241
  const featureUsage = props.visibleFeatures ? props.visibleFeatures.reduce((acc, id) => {
@@ -11100,9 +11258,9 @@ var IncludedFeatures = (0, import_react14.forwardRef)(({ className, ...rest }, r
11100
11258
  ref,
11101
11259
  className,
11102
11260
  $flexDirection: "column",
11103
- $gap: "1.5rem",
11261
+ $gap: "1rem",
11104
11262
  children: [
11105
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11263
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11106
11264
  Text,
11107
11265
  {
11108
11266
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -11152,7 +11310,7 @@ var IncludedFeatures = (0, import_react14.forwardRef)(({ className, ...rest }, r
11152
11310
  $flexGrow: "1",
11153
11311
  $textAlign: shouldWrapChildren ? "left" : "right",
11154
11312
  children: [
11155
- props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11313
+ props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11156
11314
  Text,
11157
11315
  {
11158
11316
  $font: theme.typography[props.entitlement.fontStyle].fontFamily,
@@ -11189,7 +11347,7 @@ var IncludedFeatures = (0, import_react14.forwardRef)(({ className, ...rest }, r
11189
11347
  IncludedFeatures.displayName = "IncludedFeatures";
11190
11348
 
11191
11349
  // src/components/elements/invoices/Invoices.tsx
11192
- var import_react15 = require("react");
11350
+ var import_react17 = require("react");
11193
11351
  var import_jsx_runtime16 = require("react/jsx-runtime");
11194
11352
  function resolveDesignProps2(props) {
11195
11353
  return {
@@ -11243,18 +11401,18 @@ var InvoiceDate = ({ date, fontStyle, url }) => {
11243
11401
  }
11244
11402
  return dateText;
11245
11403
  };
11246
- var Invoices = (0, import_react15.forwardRef)(({ className, data, ...rest }, ref) => {
11404
+ var Invoices = (0, import_react17.forwardRef)(({ className, data, ...rest }, ref) => {
11247
11405
  const props = resolveDesignProps2(rest);
11248
11406
  const theme = nt();
11249
11407
  const { api } = useEmbed();
11250
- const [invoices, setInvoices] = (0, import_react15.useState)(() => formatInvoices(data));
11251
- const [listSize, setListSize] = (0, import_react15.useState)(props.limit.number);
11408
+ const [invoices, setInvoices] = (0, import_react17.useState)(() => formatInvoices(data));
11409
+ const [listSize, setListSize] = (0, import_react17.useState)(props.limit.number);
11252
11410
  const toggleListSize = () => {
11253
11411
  setListSize(
11254
11412
  (prev2) => prev2 !== props.limit.number ? props.limit.number : 12
11255
11413
  );
11256
11414
  };
11257
- (0, import_react15.useEffect)(() => {
11415
+ (0, import_react17.useEffect)(() => {
11258
11416
  api?.listInvoices().then(({ data: data2 }) => {
11259
11417
  setInvoices(formatInvoices(data2));
11260
11418
  });
@@ -11320,7 +11478,7 @@ var Invoices = (0, import_react15.forwardRef)(({ className, data, ...rest }, ref
11320
11478
  Invoices.displayName = "Invoices";
11321
11479
 
11322
11480
  // src/components/elements/metered-features/MeteredFeatures.tsx
11323
- var import_react16 = require("react");
11481
+ var import_react18 = require("react");
11324
11482
  var import_pluralize2 = __toESM(require_pluralize());
11325
11483
 
11326
11484
  // src/components/elements/metered-features/styles.ts
@@ -11367,9 +11525,9 @@ function resolveDesignProps3(props) {
11367
11525
  visibleFeatures: props.visibleFeatures
11368
11526
  };
11369
11527
  }
11370
- var MeteredFeatures = (0, import_react16.forwardRef)(({ className, ...rest }, ref) => {
11528
+ var MeteredFeatures = (0, import_react18.forwardRef)(({ className, ...rest }, ref) => {
11371
11529
  const props = resolveDesignProps3(rest);
11372
- const elements = (0, import_react16.useRef)([]);
11530
+ const elements = (0, import_react18.useRef)([]);
11373
11531
  const shouldWrapChildren = useWrapChildren(elements.current);
11374
11532
  const theme = nt();
11375
11533
  const { data } = useEmbed();
@@ -11491,8 +11649,8 @@ var MeteredFeatures = (0, import_react16.forwardRef)(({ className, ...rest }, re
11491
11649
  MeteredFeatures.displayName = "MeteredFeatures";
11492
11650
 
11493
11651
  // src/components/elements/payment-method/PaymentMethod.tsx
11494
- var import_react21 = require("react");
11495
- var import_react_dom = require("react-dom");
11652
+ var import_react23 = require("react");
11653
+ var import_react_dom2 = require("react-dom");
11496
11654
 
11497
11655
  // node_modules/@stripe/stripe-js/dist/index.mjs
11498
11656
  var V3_URL = "https://js.stripe.com/v3";
@@ -11526,7 +11684,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
11526
11684
  }
11527
11685
  stripe._registerWrapper({
11528
11686
  name: "stripe-js",
11529
- version: "4.6.0",
11687
+ version: "5.1.0",
11530
11688
  startTime
11531
11689
  });
11532
11690
  };
@@ -11632,7 +11790,7 @@ var loadStripe = function loadStripe2() {
11632
11790
  var import_react_stripe_js3 = require("@stripe/react-stripe-js");
11633
11791
 
11634
11792
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
11635
- var import_react18 = require("react");
11793
+ var import_react20 = require("react");
11636
11794
 
11637
11795
  // src/components/shared/checkout-dialog/Navigation.tsx
11638
11796
  var import_jsx_runtime18 = require("react/jsx-runtime");
@@ -11645,49 +11803,74 @@ var Navigation = ({
11645
11803
  }) => {
11646
11804
  const theme = nt();
11647
11805
  const isLightBackground = useIsLightBackground();
11806
+ const showFullContent = index === activeIndex || index === activeIndex + 1;
11648
11807
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
11649
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Flex, { $gap: "0.5rem", $alignItems: "center", children: [
11650
- index >= activeIndex ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11651
- Box,
11652
- {
11653
- $width: `${20 / TEXT_BASE_SIZE}rem`,
11654
- $height: `${20 / TEXT_BASE_SIZE}rem`,
11655
- $borderWidth: "2px",
11656
- $borderStyle: "solid",
11657
- $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)",
11658
- $borderRadius: "9999px"
11659
- }
11660
- ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11661
- IconRound,
11662
- {
11663
- name: "check",
11664
- colors: [
11665
- theme.card.background,
11666
- isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)"
11667
- ],
11668
- style: {
11669
- fontSize: `${16 / TEXT_BASE_SIZE}rem`,
11670
- width: `${20 / TEXT_BASE_SIZE}rem`,
11671
- height: `${20 / TEXT_BASE_SIZE}rem`
11672
- }
11673
- }
11674
- ),
11675
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11676
- Box,
11677
- {
11678
- tabIndex: 0,
11679
- ...index !== activeIndex && { $opacity: "0.6375" },
11680
- ...index < activeIndex && {
11681
- onClick,
11682
- $cursor: "pointer"
11683
- },
11684
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11685
- Text,
11808
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11809
+ Flex,
11810
+ {
11811
+ $gap: "0.5rem",
11812
+ $alignItems: "center",
11813
+ ...!showFullContent && { $flex: 1, $minWidth: 0 },
11814
+ children: [
11815
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11816
+ Box,
11686
11817
  {
11687
- $font: theme.typography.text.fontFamily,
11688
- $size: 19,
11689
- $weight: index === activeIndex ? 600 : 400,
11818
+ $display: "none",
11819
+ $viewport: {
11820
+ md: {
11821
+ $display: "block"
11822
+ }
11823
+ },
11824
+ children: index >= activeIndex ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11825
+ Box,
11826
+ {
11827
+ $width: `${20 / TEXT_BASE_SIZE}rem`,
11828
+ $height: `${20 / TEXT_BASE_SIZE}rem`,
11829
+ $borderWidth: "2px",
11830
+ $borderStyle: "solid",
11831
+ $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)",
11832
+ $borderRadius: "9999px"
11833
+ }
11834
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11835
+ IconRound,
11836
+ {
11837
+ name: "check",
11838
+ colors: [
11839
+ theme.card.background,
11840
+ isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)"
11841
+ ],
11842
+ style: {
11843
+ fontSize: `${16 / TEXT_BASE_SIZE}rem`,
11844
+ width: `${20 / TEXT_BASE_SIZE}rem`,
11845
+ height: `${20 / TEXT_BASE_SIZE}rem`
11846
+ }
11847
+ }
11848
+ )
11849
+ }
11850
+ ),
11851
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11852
+ Box,
11853
+ {
11854
+ tabIndex: 0,
11855
+ $fontSize: `${16 / TEXT_BASE_SIZE}rem`,
11856
+ $fontFamily: theme.typography.text.fontFamily,
11857
+ $fontWeight: index === activeIndex ? 600 : 400,
11690
11858
  $color: theme.typography.text.color,
11859
+ ...!showFullContent && {
11860
+ $overflow: "hidden",
11861
+ $whiteSpace: "nowrap",
11862
+ $textOverflow: "ellipsis"
11863
+ },
11864
+ ...index !== activeIndex && { $opacity: "0.6375" },
11865
+ ...index < activeIndex && {
11866
+ onClick,
11867
+ $cursor: "pointer"
11868
+ },
11869
+ $viewport: {
11870
+ md: {
11871
+ $fontSize: `${19 / TEXT_BASE_SIZE}rem`
11872
+ }
11873
+ },
11691
11874
  children: [
11692
11875
  index + 1,
11693
11876
  ". ",
@@ -11695,9 +11878,9 @@ var Navigation = ({
11695
11878
  ]
11696
11879
  }
11697
11880
  )
11698
- }
11699
- )
11700
- ] }),
11881
+ ]
11882
+ }
11883
+ ),
11701
11884
  !isLast && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11702
11885
  Icon2,
11703
11886
  {
@@ -11712,11 +11895,12 @@ var Navigation = ({
11712
11895
  };
11713
11896
 
11714
11897
  // src/components/shared/checkout-dialog/Sidebar.tsx
11715
- var import_react17 = require("react");
11898
+ var import_react19 = require("react");
11716
11899
  var import_jsx_runtime19 = require("react/jsx-runtime");
11717
11900
  var Sidebar = ({
11718
11901
  addOns,
11719
11902
  charges,
11903
+ checkoutRef,
11720
11904
  checkoutStage,
11721
11905
  currentAddOns,
11722
11906
  currentPlan,
@@ -11725,10 +11909,8 @@ var Sidebar = ({
11725
11909
  paymentMethodId,
11726
11910
  planPeriod,
11727
11911
  selectedPlan,
11728
- selectPlan,
11729
11912
  setCheckoutStage,
11730
11913
  setError,
11731
- setPlanPeriod,
11732
11914
  setSetupIntent,
11733
11915
  showPaymentForm,
11734
11916
  toggleLoading
@@ -11736,20 +11918,7 @@ var Sidebar = ({
11736
11918
  const theme = nt();
11737
11919
  const { api, data, mode, setLayout } = useEmbed();
11738
11920
  const isLightBackground = useIsLightBackground();
11739
- const { planPeriodOptions, paymentMethod } = (0, import_react17.useMemo)(() => {
11740
- const planPeriodOptions2 = [];
11741
- if (data.activePlans.some((plan) => plan.monthlyPrice) || data.activeAddOns.some((addOn) => addOn.monthlyPrice)) {
11742
- planPeriodOptions2.push("month");
11743
- }
11744
- if (data.activePlans.some((plan) => plan.yearlyPrice) || data.activeAddOns.some((addOn) => addOn.yearlyPrice)) {
11745
- planPeriodOptions2.push("year");
11746
- }
11747
- return {
11748
- planPeriodOptions: planPeriodOptions2,
11749
- paymentMethod: data.subscription?.paymentMethod
11750
- };
11751
- }, [data.activePlans, data.activeAddOns, data.subscription?.paymentMethod]);
11752
- const subscriptionPrice = (0, import_react17.useMemo)(() => {
11921
+ const subscriptionPrice = (0, import_react19.useMemo)(() => {
11753
11922
  if (!selectedPlan || !selectedPlan.monthlyPrice || !selectedPlan.yearlyPrice) {
11754
11923
  return;
11755
11924
  }
@@ -11757,7 +11926,7 @@ var Sidebar = ({
11757
11926
  (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price
11758
11927
  );
11759
11928
  }, [selectedPlan, planPeriod]);
11760
- const checkout = (0, import_react17.useCallback)(async () => {
11929
+ const checkout = (0, import_react19.useCallback)(async () => {
11761
11930
  const priceId = (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.id;
11762
11931
  if (!api || !selectedPlan || !priceId) {
11763
11932
  return;
@@ -11802,15 +11971,6 @@ var Sidebar = ({
11802
11971
  setLayout,
11803
11972
  toggleLoading
11804
11973
  ]);
11805
- const changePlanPeriod = (0, import_react17.useCallback)(
11806
- (period) => {
11807
- if (selectedPlan) {
11808
- selectPlan(selectedPlan, period);
11809
- }
11810
- setPlanPeriod(period);
11811
- },
11812
- [selectedPlan, selectPlan, setPlanPeriod]
11813
- );
11814
11974
  const shortPeriod = (p2) => p2 === "month" ? "mo" : "yr";
11815
11975
  const selectedAddOns = addOns.filter((addOn) => addOn.isSelected);
11816
11976
  const willPlanChange = selectedPlan && (selectedPlan.id !== currentPlan?.id || planPeriod !== currentPlan.planPeriod);
@@ -11818,7 +11978,7 @@ var Sidebar = ({
11818
11978
  selectedAddOns.length !== currentAddOns.length || !selectedAddOns.every(
11819
11979
  (addOn) => currentAddOns.some((currentAddOn) => addOn.id === currentAddOn.id)
11820
11980
  )) && !isLoading;
11821
- const canCheckout = canUpdateSubscription && (paymentMethod && !showPaymentForm || paymentMethodId);
11981
+ const canCheckout = canUpdateSubscription && (data.subscription?.paymentMethod && !showPaymentForm || paymentMethodId);
11822
11982
  const removedAddOns = currentAddOns.filter(
11823
11983
  (current) => !selectedAddOns.some((selected) => current.id === selected.id)
11824
11984
  );
@@ -11829,14 +11989,21 @@ var Sidebar = ({
11829
11989
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11830
11990
  Flex,
11831
11991
  {
11992
+ ref: checkoutRef,
11993
+ tabIndex: 0,
11832
11994
  $flexDirection: "column",
11833
- $width: "21.5rem",
11995
+ $flexShrink: 0,
11834
11996
  $overflow: "auto",
11835
11997
  $backgroundColor: theme.card.background,
11836
11998
  $borderRadius: "0 0 0.5rem",
11837
11999
  $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
12000
+ $viewport: {
12001
+ md: {
12002
+ $width: "21.5rem"
12003
+ }
12004
+ },
11838
12005
  children: [
11839
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
12006
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11840
12007
  Flex,
11841
12008
  {
11842
12009
  $position: "relative",
@@ -11847,28 +12014,17 @@ var Sidebar = ({
11847
12014
  $borderBottomWidth: "1px",
11848
12015
  $borderStyle: "solid",
11849
12016
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)",
11850
- children: [
11851
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Flex, { $justifyContent: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11852
- Text,
11853
- {
11854
- as: "h3",
11855
- $font: theme.typography.heading3.fontFamily,
11856
- $size: theme.typography.heading3.fontSize,
11857
- $weight: theme.typography.heading3.fontWeight,
11858
- $color: theme.typography.heading3.color,
11859
- children: "Subscription"
11860
- }
11861
- ) }),
11862
- planPeriodOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11863
- PeriodToggle,
11864
- {
11865
- options: planPeriodOptions,
11866
- selectedOption: planPeriod,
11867
- onChange: changePlanPeriod
11868
- }
11869
- ),
11870
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Savings, { plan: selectedPlan, period: planPeriod })
11871
- ]
12017
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Flex, { $justifyContent: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
12018
+ Text,
12019
+ {
12020
+ as: "h3",
12021
+ $font: theme.typography.heading3.fontFamily,
12022
+ $size: theme.typography.heading3.fontSize,
12023
+ $weight: theme.typography.heading3.fontWeight,
12024
+ $color: theme.typography.heading3.color,
12025
+ children: "Subscription"
12026
+ }
12027
+ ) })
11872
12028
  }
11873
12029
  ),
11874
12030
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
@@ -11876,7 +12032,7 @@ var Sidebar = ({
11876
12032
  {
11877
12033
  $flexDirection: "column",
11878
12034
  $position: "relative",
11879
- $gap: "0.5rem",
12035
+ $gap: "0.125rem",
11880
12036
  $width: "100%",
11881
12037
  $padding: "1.5rem",
11882
12038
  $flex: "1",
@@ -11948,7 +12104,8 @@ var Sidebar = ({
11948
12104
  {
11949
12105
  name: "arrow-down",
11950
12106
  style: {
11951
- display: "inline-block"
12107
+ display: "inline-block",
12108
+ color: theme.typography.text.color
11952
12109
  }
11953
12110
  }
11954
12111
  )
@@ -12210,7 +12367,13 @@ var Sidebar = ({
12210
12367
  EmbedButton,
12211
12368
  {
12212
12369
  disabled: !addOns.length && !canUpdateSubscription,
12213
- onClick: () => {
12370
+ onClick: async () => {
12371
+ if (!addOns.length && api && data.component?.id) {
12372
+ const { data: setupIntent } = await api.getSetupIntent({
12373
+ componentId: data.component.id
12374
+ });
12375
+ setSetupIntent(setupIntent);
12376
+ }
12214
12377
  setCheckoutStage(addOns.length ? "addons" : "checkout");
12215
12378
  },
12216
12379
  isLoading,
@@ -12370,217 +12533,193 @@ var Plan = ({
12370
12533
  const isLightBackground = useIsLightBackground();
12371
12534
  const cardPadding = theme.card.padding / TEXT_BASE_SIZE;
12372
12535
  const currentPlanIndex = plans.findIndex((plan) => plan.current);
12373
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
12374
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $marginBottom: "1rem", children: [
12375
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12376
- Text,
12377
- {
12378
- as: "h3",
12379
- id: "select-plan-dialog-label",
12380
- $font: theme.typography.heading3.fontFamily,
12381
- $size: theme.typography.heading3.fontSize,
12382
- $weight: theme.typography.heading3.fontWeight,
12383
- $color: theme.typography.heading3.color,
12384
- $marginBottom: "0.5rem",
12385
- children: "Select plan"
12386
- }
12387
- ),
12388
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12389
- Text,
12390
- {
12391
- as: "p",
12392
- id: "select-plan-dialog-description",
12393
- $font: theme.typography.text.fontFamily,
12394
- $size: theme.typography.text.fontSize,
12395
- $weight: theme.typography.text.fontWeight,
12396
- $color: theme.typography.text.color,
12397
- children: "Choose your base plan"
12398
- }
12399
- )
12400
- ] }),
12401
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12402
- Box,
12403
- {
12404
- $display: "grid",
12405
- $gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
12406
- $gap: "1rem",
12407
- $flexGrow: "1",
12408
- children: plans.map((plan, index) => {
12409
- const isActivePlan = plan.current && currentPlan?.planPeriod === period;
12410
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12411
- Flex,
12412
- {
12413
- $position: "relative",
12414
- $flexDirection: "column",
12415
- $padding: `${cardPadding}rem 0`,
12416
- $backgroundColor: theme.card.background,
12417
- $borderRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
12418
- $outlineWidth: "2px",
12419
- $outlineStyle: "solid",
12420
- $outlineColor: plan.id === selectedPlan?.id ? theme.primary : "transparent",
12421
- ...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
12422
- children: [
12423
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12424
- Flex,
12425
- {
12426
- $flexDirection: "column",
12427
- $gap: "1rem",
12428
- $padding: `0 ${cardPadding}rem ${0.75 * cardPadding}rem`,
12429
- $borderBottomWidth: "1px",
12430
- $borderStyle: "solid",
12431
- $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
12432
- children: [
12433
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12536
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12537
+ Box,
12538
+ {
12539
+ $display: "grid",
12540
+ $gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
12541
+ $gap: "1rem",
12542
+ $flexGrow: "1",
12543
+ children: plans.map((plan, index) => {
12544
+ const isActivePlan = plan.current && currentPlan?.planPeriod === period;
12545
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12546
+ Flex,
12547
+ {
12548
+ $position: "relative",
12549
+ $flexDirection: "column",
12550
+ $padding: `${0.75 * cardPadding}rem 0`,
12551
+ $backgroundColor: theme.card.background,
12552
+ $borderRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
12553
+ $outlineWidth: "2px",
12554
+ $outlineStyle: "solid",
12555
+ $outlineColor: plan.id === selectedPlan?.id ? theme.primary : "transparent",
12556
+ ...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
12557
+ children: [
12558
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12559
+ Flex,
12560
+ {
12561
+ $flexDirection: "column",
12562
+ $gap: "0.5rem",
12563
+ $padding: `0 ${cardPadding}rem ${0.75 * cardPadding}rem`,
12564
+ $borderBottomWidth: "1px",
12565
+ $borderStyle: "solid",
12566
+ $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
12567
+ $viewport: {
12568
+ md: {
12569
+ $gap: "1rem"
12570
+ }
12571
+ },
12572
+ children: [
12573
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12574
+ Text,
12575
+ {
12576
+ $font: theme.typography.heading2.fontFamily,
12577
+ $size: theme.typography.heading2.fontSize,
12578
+ $weight: theme.typography.heading2.fontWeight,
12579
+ $color: theme.typography.heading2.color,
12580
+ children: plan.name
12581
+ }
12582
+ ) }),
12583
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { $marginBottom: "0.5rem", $lineHeight: 1.35, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12584
+ Text,
12585
+ {
12586
+ $font: theme.typography.text.fontFamily,
12587
+ $size: theme.typography.text.fontSize,
12588
+ $weight: theme.typography.text.fontWeight,
12589
+ $color: theme.typography.text.color,
12590
+ children: plan.description
12591
+ }
12592
+ ) }),
12593
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box, { children: [
12594
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12434
12595
  Text,
12435
12596
  {
12436
12597
  $font: theme.typography.heading2.fontFamily,
12437
12598
  $size: theme.typography.heading2.fontSize,
12438
12599
  $weight: theme.typography.heading2.fontWeight,
12439
12600
  $color: theme.typography.heading2.color,
12440
- children: plan.name
12601
+ children: formatCurrency(
12602
+ (period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0
12603
+ )
12441
12604
  }
12442
- ) }),
12443
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12605
+ ),
12606
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12444
12607
  Text,
12445
12608
  {
12446
- $font: theme.typography.text.fontFamily,
12447
- $size: theme.typography.text.fontSize,
12448
- $weight: theme.typography.text.fontWeight,
12449
- $color: theme.typography.text.color,
12450
- children: plan.description
12451
- }
12452
- ) }),
12453
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box, { children: [
12454
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12455
- Text,
12456
- {
12457
- $font: theme.typography.heading2.fontFamily,
12458
- $size: theme.typography.heading2.fontSize,
12459
- $weight: theme.typography.heading2.fontWeight,
12460
- $color: theme.typography.heading2.color,
12461
- children: formatCurrency(
12462
- (period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0
12463
- )
12464
- }
12465
- ),
12466
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12467
- Text,
12468
- {
12469
- $font: theme.typography.heading2.fontFamily,
12470
- $size: 16 / 30 * theme.typography.heading2.fontSize,
12471
- $weight: theme.typography.heading2.fontWeight,
12472
- $color: theme.typography.heading2.color,
12473
- children: [
12474
- "/",
12475
- period
12476
- ]
12477
- }
12478
- )
12479
- ] }),
12480
- isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12481
- Flex,
12482
- {
12483
- $position: "absolute",
12484
- $right: "1rem",
12485
- $top: "1rem",
12486
- $fontSize: "0.625rem",
12487
- $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
12488
- $backgroundColor: theme.primary,
12489
- $borderRadius: "9999px",
12490
- $padding: "0.125rem 0.85rem",
12491
- children: "Active"
12609
+ $font: theme.typography.heading2.fontFamily,
12610
+ $size: 16 / 30 * theme.typography.heading2.fontSize,
12611
+ $weight: theme.typography.heading2.fontWeight,
12612
+ $color: theme.typography.heading2.color,
12613
+ children: [
12614
+ "/",
12615
+ period
12616
+ ]
12492
12617
  }
12493
12618
  )
12494
- ]
12495
- }
12496
- ),
12497
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12498
- Flex,
12499
- {
12500
- $flexDirection: "column",
12501
- $justifyContent: "end",
12502
- $flexGrow: "1",
12503
- $gap: `${cardPadding}rem`,
12504
- $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
12505
- children: [
12506
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: plan.entitlements.map(
12507
- ({
12508
- id,
12619
+ ] }),
12620
+ isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12621
+ Flex,
12622
+ {
12623
+ $position: "absolute",
12624
+ $right: "1rem",
12625
+ $top: "1rem",
12626
+ $fontSize: "0.75rem",
12627
+ $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
12628
+ $backgroundColor: theme.primary,
12629
+ $borderRadius: "9999px",
12630
+ $padding: "0.125rem 0.85rem",
12631
+ children: "Active"
12632
+ }
12633
+ )
12634
+ ]
12635
+ }
12636
+ ),
12637
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12638
+ Flex,
12639
+ {
12640
+ $flexDirection: "column",
12641
+ $justifyContent: "end",
12642
+ $flexGrow: "1",
12643
+ $gap: `${cardPadding}rem`,
12644
+ $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
12645
+ children: [
12646
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: plan.entitlements.map(
12647
+ ({
12648
+ id,
12649
+ feature,
12650
+ metricPeriod,
12651
+ valueNumeric,
12652
+ valueType
12653
+ }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12654
+ PlanEntitlementRow,
12655
+ {
12509
12656
  feature,
12510
12657
  metricPeriod,
12511
12658
  valueNumeric,
12512
12659
  valueType
12513
- }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12514
- PlanEntitlementRow,
12515
- {
12516
- feature,
12517
- metricPeriod,
12518
- valueNumeric,
12519
- valueType
12520
- },
12521
- id
12522
- )
12523
- ) }),
12524
- plan.id === selectedPlan?.id ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12525
- Flex,
12526
- {
12527
- $justifyContent: "center",
12528
- $alignItems: "center",
12529
- $gap: "0.25rem",
12530
- $padding: "0.625rem 0",
12531
- children: [
12532
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12533
- Icon2,
12534
- {
12535
- name: "check-rounded",
12536
- style: {
12537
- fontSize: 20,
12538
- lineHeight: 1,
12539
- color: theme.primary
12540
- }
12541
- }
12542
- ),
12543
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12544
- Text,
12545
- {
12546
- $size: 15,
12547
- $leading: 1,
12548
- $color: theme.typography.text.color,
12549
- children: isActivePlan ? "Current plan" : "Selected"
12660
+ },
12661
+ id
12662
+ )
12663
+ ) }),
12664
+ plan.id === selectedPlan?.id ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12665
+ Flex,
12666
+ {
12667
+ $justifyContent: "center",
12668
+ $alignItems: "center",
12669
+ $gap: "0.25rem",
12670
+ $padding: "0.625rem 0",
12671
+ children: [
12672
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12673
+ Icon2,
12674
+ {
12675
+ name: "check-rounded",
12676
+ style: {
12677
+ fontSize: 20,
12678
+ lineHeight: 1,
12679
+ color: theme.primary
12550
12680
  }
12551
- )
12552
- ]
12553
- }
12554
- ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12555
- EmbedButton,
12556
- {
12557
- disabled: isLoading || !plan.valid,
12558
- onClick: () => {
12559
- selectPlan(plan);
12560
- },
12561
- $size: "sm",
12562
- $color: "primary",
12563
- $variant: index < currentPlanIndex ? "outline" : "filled",
12564
- children: !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12565
- Tooltip,
12681
+ }
12682
+ ),
12683
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12684
+ Text,
12566
12685
  {
12567
- label: "Over usage limit",
12568
- description: "Current usage exceeds the limit of this plan."
12686
+ $size: 15,
12687
+ $leading: 1,
12688
+ $color: theme.typography.text.color,
12689
+ children: isActivePlan ? "Current plan" : "Selected"
12569
12690
  }
12570
- ) : "Choose plan"
12571
- }
12572
- )
12573
- ]
12574
- }
12575
- )
12576
- ]
12577
- },
12578
- plan.id
12579
- );
12580
- })
12581
- }
12582
- )
12583
- ] });
12691
+ )
12692
+ ]
12693
+ }
12694
+ ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12695
+ EmbedButton,
12696
+ {
12697
+ disabled: isLoading || !plan.valid,
12698
+ onClick: () => {
12699
+ selectPlan(plan);
12700
+ },
12701
+ $size: "sm",
12702
+ $color: "primary",
12703
+ $variant: index < currentPlanIndex ? "outline" : "filled",
12704
+ children: !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12705
+ Tooltip,
12706
+ {
12707
+ trigger: "Over usage limit",
12708
+ content: "Current usage exceeds the limit of this plan."
12709
+ }
12710
+ ) : "Choose plan"
12711
+ }
12712
+ )
12713
+ ]
12714
+ }
12715
+ )
12716
+ ]
12717
+ },
12718
+ plan.id
12719
+ );
12720
+ })
12721
+ }
12722
+ ) });
12584
12723
  };
12585
12724
 
12586
12725
  // src/components/shared/checkout-dialog/AddOns.tsx
@@ -12589,159 +12728,130 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
12589
12728
  const theme = nt();
12590
12729
  const periodKey = period === "year" ? "yearlyPrice" : "monthlyPrice";
12591
12730
  const cardPadding = theme.card.padding / TEXT_BASE_SIZE;
12592
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
12593
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $marginBottom: "1rem", children: [
12594
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12595
- Text,
12596
- {
12597
- as: "h3",
12598
- id: "select-addons-dialog-label",
12599
- $font: theme.typography.heading3.fontFamily,
12600
- $size: theme.typography.heading3.fontSize,
12601
- $weight: theme.typography.heading3.fontWeight,
12602
- $color: theme.typography.heading3.color,
12603
- $marginBottom: "0.5rem",
12604
- children: "Customize with add-ons"
12605
- }
12606
- ),
12607
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12608
- Text,
12609
- {
12610
- as: "p",
12611
- id: "select-addons-dialog-description",
12612
- $font: theme.typography.text.fontFamily,
12613
- $size: theme.typography.text.fontSize,
12614
- $weight: theme.typography.text.fontWeight,
12615
- $color: theme.typography.text.color,
12616
- children: "Optionally add features to your subscription"
12617
- }
12618
- )
12619
- ] }),
12620
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12621
- Box,
12622
- {
12623
- $display: "grid",
12624
- $gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
12625
- $gap: "1rem",
12626
- children: addOns.map((addOn) => {
12627
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12628
- Flex,
12629
- {
12630
- $position: "relative",
12631
- $flexDirection: "column",
12632
- $gap: "2rem",
12633
- $padding: `${cardPadding}rem`,
12634
- $backgroundColor: theme.card.background,
12635
- $borderRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
12636
- $outlineWidth: "2px",
12637
- $outlineStyle: "solid",
12638
- $outlineColor: addOn.isSelected ? theme.primary : "transparent",
12639
- ...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
12640
- children: [
12641
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
12642
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12731
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12732
+ Box,
12733
+ {
12734
+ $display: "grid",
12735
+ $gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
12736
+ $gap: "1rem",
12737
+ children: addOns.map((addOn) => {
12738
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12739
+ Flex,
12740
+ {
12741
+ $position: "relative",
12742
+ $flexDirection: "column",
12743
+ $gap: "2rem",
12744
+ $padding: `${cardPadding}rem`,
12745
+ $backgroundColor: theme.card.background,
12746
+ $borderRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
12747
+ $outlineWidth: "2px",
12748
+ $outlineStyle: "solid",
12749
+ $outlineColor: addOn.isSelected ? theme.primary : "transparent",
12750
+ ...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
12751
+ children: [
12752
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
12753
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12754
+ Text,
12755
+ {
12756
+ $font: theme.typography.heading3.fontFamily,
12757
+ $size: theme.typography.heading3.fontSize,
12758
+ $weight: theme.typography.heading3.fontWeight,
12759
+ $color: theme.typography.heading3.color,
12760
+ children: addOn.name
12761
+ }
12762
+ ) }),
12763
+ addOn.description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12764
+ Text,
12765
+ {
12766
+ $font: theme.typography.text.fontFamily,
12767
+ $size: theme.typography.text.fontSize,
12768
+ $weight: theme.typography.text.fontWeight,
12769
+ $color: theme.typography.text.color,
12770
+ children: addOn.description
12771
+ }
12772
+ ) }),
12773
+ addOn[periodKey] && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Box, { children: [
12774
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12643
12775
  Text,
12644
12776
  {
12645
- $font: theme.typography.heading3.fontFamily,
12646
- $size: theme.typography.heading3.fontSize,
12647
- $weight: theme.typography.heading3.fontWeight,
12648
- $color: theme.typography.heading3.color,
12649
- children: addOn.name
12777
+ $font: theme.typography.heading2.fontFamily,
12778
+ $size: theme.typography.heading2.fontSize,
12779
+ $weight: theme.typography.heading2.fontWeight,
12780
+ $color: theme.typography.heading2.color,
12781
+ children: formatCurrency(
12782
+ (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0
12783
+ )
12650
12784
  }
12651
- ) }),
12652
- addOn.description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12785
+ ),
12786
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12653
12787
  Text,
12654
12788
  {
12655
- $font: theme.typography.text.fontFamily,
12656
- $size: theme.typography.text.fontSize,
12657
- $weight: theme.typography.text.fontWeight,
12658
- $color: theme.typography.text.color,
12659
- children: addOn.description
12660
- }
12661
- ) }),
12662
- addOn[periodKey] && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Box, { children: [
12663
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12664
- Text,
12665
- {
12666
- $font: theme.typography.heading2.fontFamily,
12667
- $size: theme.typography.heading2.fontSize,
12668
- $weight: theme.typography.heading2.fontWeight,
12669
- $color: theme.typography.heading2.color,
12670
- children: formatCurrency(
12671
- (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0
12672
- )
12673
- }
12674
- ),
12675
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12676
- Text,
12677
- {
12678
- $font: theme.typography.heading2.fontFamily,
12679
- $size: 16 / 30 * theme.typography.heading2.fontSize,
12680
- $weight: theme.typography.heading2.fontWeight,
12681
- $color: theme.typography.heading2.color,
12682
- children: [
12683
- "/",
12684
- period
12685
- ]
12686
- }
12687
- )
12688
- ] }),
12689
- addOn.current && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12690
- Flex,
12691
- {
12692
- $position: "absolute",
12693
- $right: "1rem",
12694
- $top: "1rem",
12695
- $fontSize: "0.625rem",
12696
- $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
12697
- $backgroundColor: theme.primary,
12698
- $borderRadius: "9999px",
12699
- $padding: "0.125rem 0.85rem",
12700
- children: "Active"
12789
+ $font: theme.typography.heading2.fontFamily,
12790
+ $size: 16 / 30 * theme.typography.heading2.fontSize,
12791
+ $weight: theme.typography.heading2.fontWeight,
12792
+ $color: theme.typography.heading2.color,
12793
+ children: [
12794
+ "/",
12795
+ period
12796
+ ]
12701
12797
  }
12702
12798
  )
12703
12799
  ] }),
12704
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Flex, { $flexDirection: "column", $justifyContent: "end", $flexGrow: "1", children: !addOn.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12705
- EmbedButton,
12800
+ addOn.current && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12801
+ Flex,
12706
12802
  {
12707
- disabled: isLoading || !addOn.valid,
12708
- onClick: () => toggle(addOn.id),
12709
- $size: "sm",
12710
- $color: "primary",
12711
- $variant: "outline",
12712
- children: "Choose add-on"
12803
+ $position: "absolute",
12804
+ $right: "1rem",
12805
+ $top: "1rem",
12806
+ $fontSize: "0.75rem",
12807
+ $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
12808
+ $backgroundColor: theme.primary,
12809
+ $borderRadius: "9999px",
12810
+ $padding: "0.125rem 0.85rem",
12811
+ children: "Active"
12713
12812
  }
12714
- ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12715
- EmbedButton,
12716
- {
12717
- disabled: isLoading || !addOn.valid,
12718
- onClick: () => toggle(addOn.id),
12719
- $size: "sm",
12720
- $color: addOn.current ? "danger" : "primary",
12721
- $variant: addOn.current ? "ghost" : "text",
12722
- children: addOn.current ? "Remove add-on" : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
12723
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12724
- Icon2,
12725
- {
12726
- name: "check-rounded",
12727
- style: {
12728
- fontSize: 20,
12729
- lineHeight: 1
12730
- }
12813
+ )
12814
+ ] }),
12815
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Flex, { $flexDirection: "column", $justifyContent: "end", $flexGrow: "1", children: !addOn.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12816
+ EmbedButton,
12817
+ {
12818
+ disabled: isLoading || !addOn.valid,
12819
+ onClick: () => toggle(addOn.id),
12820
+ $size: "sm",
12821
+ $color: "primary",
12822
+ $variant: "outline",
12823
+ children: "Choose add-on"
12824
+ }
12825
+ ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12826
+ EmbedButton,
12827
+ {
12828
+ disabled: isLoading || !addOn.valid,
12829
+ onClick: () => toggle(addOn.id),
12830
+ $size: "sm",
12831
+ $color: addOn.current ? "danger" : "primary",
12832
+ $variant: addOn.current ? "ghost" : "text",
12833
+ children: addOn.current ? "Remove add-on" : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
12834
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12835
+ Icon2,
12836
+ {
12837
+ name: "check-rounded",
12838
+ style: {
12839
+ fontSize: 20,
12840
+ lineHeight: 1
12731
12841
  }
12732
- ),
12733
- "Selected"
12734
- ] })
12735
- }
12736
- ) })
12737
- ]
12738
- },
12739
- addOn.id
12740
- );
12741
- })
12742
- }
12743
- )
12744
- ] });
12842
+ }
12843
+ ),
12844
+ "Selected"
12845
+ ] })
12846
+ }
12847
+ ) })
12848
+ ]
12849
+ },
12850
+ addOn.id
12851
+ );
12852
+ })
12853
+ }
12854
+ ) });
12745
12855
  };
12746
12856
 
12747
12857
  // src/components/shared/checkout-dialog/Checkout.tsx
@@ -12827,35 +12937,45 @@ var CheckoutDialog = ({
12827
12937
  initialAddOnId,
12828
12938
  portal
12829
12939
  }) => {
12940
+ const theme = nt();
12830
12941
  const { api, data } = useEmbed();
12831
- const [checkoutStage, setCheckoutStage] = (0, import_react18.useState)("plan");
12832
- const [planPeriod, setPlanPeriod] = (0, import_react18.useState)(
12942
+ const modalRef = (0, import_react20.useRef)(null);
12943
+ const contentRef = (0, import_react20.useRef)(null);
12944
+ const checkoutRef = (0, import_react20.useRef)(null);
12945
+ const [checkoutStage, setCheckoutStage] = (0, import_react20.useState)("plan");
12946
+ const [planPeriod, setPlanPeriod] = (0, import_react20.useState)(
12833
12947
  initialPeriod || data.company?.plan?.planPeriod || "month"
12834
12948
  );
12835
- const [charges, setCharges] = (0, import_react18.useState)();
12836
- const [paymentMethodId, setPaymentMethodId] = (0, import_react18.useState)();
12837
- const [isLoading, setIsLoading] = (0, import_react18.useState)(false);
12838
- const [error, setError] = (0, import_react18.useState)();
12839
- const [showPaymentForm, setShowPaymentForm] = (0, import_react18.useState)(
12949
+ const [charges, setCharges] = (0, import_react20.useState)();
12950
+ const [paymentMethodId, setPaymentMethodId] = (0, import_react20.useState)();
12951
+ const [isLoading, setIsLoading] = (0, import_react20.useState)(false);
12952
+ const [error, setError] = (0, import_react20.useState)();
12953
+ const [showPaymentForm, setShowPaymentForm] = (0, import_react20.useState)(
12840
12954
  !data.subscription?.paymentMethod
12841
12955
  );
12842
- const [stripe, setStripe] = (0, import_react18.useState)(null);
12843
- const [setupIntent, setSetupIntent] = (0, import_react18.useState)();
12844
- const [top, setTop] = (0, import_react18.useState)(0);
12845
- const { plans: availablePlans, addOns: availableAddOns } = useAvailablePlans(planPeriod);
12846
- const checkoutStages = (0, import_react18.useMemo)(() => {
12956
+ const [stripe, setStripe] = (0, import_react20.useState)(null);
12957
+ const [setupIntent, setSetupIntent] = (0, import_react20.useState)();
12958
+ const [top, setTop] = (0, import_react20.useState)(0);
12959
+ const {
12960
+ plans: availablePlans,
12961
+ addOns: availableAddOns,
12962
+ periods: availablePeriods
12963
+ } = useAvailablePlans(planPeriod);
12964
+ const checkoutStages = (0, import_react20.useMemo)(() => {
12847
12965
  const checkoutStages2 = [
12848
12966
  {
12849
12967
  id: "plan",
12850
- name: "Select plan",
12968
+ name: "Plan",
12969
+ label: "Select plan",
12851
12970
  description: "Choose your base plan"
12852
12971
  },
12853
12972
  {
12854
12973
  id: "addons",
12855
- name: "Customize with addons",
12974
+ name: "Add-ons",
12975
+ label: "Select add-ons",
12856
12976
  description: "Optionally add features to your subscription"
12857
12977
  },
12858
- { id: "checkout", name: "Checkout", description: "" }
12978
+ { id: "checkout", name: "Checkout", label: "Checkout" }
12859
12979
  ];
12860
12980
  if (!availableAddOns.length) {
12861
12981
  checkoutStages2.splice(1, 1);
@@ -12863,21 +12983,22 @@ var CheckoutDialog = ({
12863
12983
  return checkoutStages2;
12864
12984
  }, [availableAddOns]);
12865
12985
  const currentPlan = data.company?.plan;
12866
- const [selectedPlan, setSelectedPlan] = (0, import_react18.useState)(
12986
+ const [selectedPlan, setSelectedPlan] = (0, import_react20.useState)(
12867
12987
  () => availablePlans.find(
12868
12988
  (plan) => plan.id === (typeof initialPlanId !== "undefined" ? initialPlanId : currentPlan?.id)
12869
12989
  )
12870
12990
  );
12871
12991
  const currentAddOns = data.company?.addOns || [];
12872
- const [addOns, setAddOns] = (0, import_react18.useState)(
12992
+ const [addOns, setAddOns] = (0, import_react20.useState)(
12873
12993
  () => availableAddOns.map((addOn) => ({
12874
12994
  ...addOn,
12875
12995
  isSelected: typeof initialAddOnId !== "undefined" ? addOn.id === initialAddOnId : currentAddOns.some((currentAddOn) => addOn.id === currentAddOn.id)
12876
12996
  }))
12877
12997
  );
12878
12998
  const isLightBackground = useIsLightBackground();
12879
- const previewCheckout = (0, import_react18.useCallback)(
12880
- async (plan, addOns2, period) => {
12999
+ const previewCheckout = (0, import_react20.useCallback)(
13000
+ async (plan, addOns2, newPeriod) => {
13001
+ const period = newPeriod || planPeriod;
12881
13002
  const planPriceId = period === "month" ? plan?.monthlyPrice?.id : plan?.yearlyPrice?.id;
12882
13003
  if (!api || !planPriceId) {
12883
13004
  return;
@@ -12911,18 +13032,33 @@ var CheckoutDialog = ({
12911
13032
  );
12912
13033
  } finally {
12913
13034
  setIsLoading(false);
13035
+ if (!newPeriod) {
13036
+ checkoutRef.current?.scrollIntoView({
13037
+ behavior: "smooth",
13038
+ block: "nearest"
13039
+ });
13040
+ }
12914
13041
  }
12915
13042
  },
12916
- [api]
13043
+ [api, planPeriod]
12917
13044
  );
12918
- const selectPlan = (0, import_react18.useCallback)(
13045
+ const selectPlan = (0, import_react20.useCallback)(
12919
13046
  (plan, newPeriod) => {
12920
13047
  setSelectedPlan(plan);
12921
- previewCheckout(plan, addOns, newPeriod || planPeriod);
13048
+ previewCheckout(plan, addOns, newPeriod);
13049
+ },
13050
+ [addOns, previewCheckout]
13051
+ );
13052
+ const changePlanPeriod = (0, import_react20.useCallback)(
13053
+ (period) => {
13054
+ if (selectedPlan) {
13055
+ selectPlan(selectedPlan, period);
13056
+ }
13057
+ setPlanPeriod(period);
12922
13058
  },
12923
- [addOns, planPeriod, previewCheckout]
13059
+ [selectedPlan, selectPlan, setPlanPeriod]
12924
13060
  );
12925
- const toggleAddOn = (0, import_react18.useCallback)(
13061
+ const toggleAddOn = (0, import_react20.useCallback)(
12926
13062
  (id, newPeriod) => {
12927
13063
  const updatedAddOns = addOns.map((addOn) => ({
12928
13064
  ...addOn,
@@ -12936,12 +13072,12 @@ var CheckoutDialog = ({
12936
13072
  },
12937
13073
  [selectedPlan, addOns, planPeriod, previewCheckout]
12938
13074
  );
12939
- (0, import_react18.useEffect)(() => {
13075
+ (0, import_react20.useEffect)(() => {
12940
13076
  if (!stripe && setupIntent?.publishableKey) {
12941
13077
  setStripe(loadStripe(setupIntent.publishableKey));
12942
13078
  }
12943
13079
  }, [stripe, setupIntent?.publishableKey]);
12944
- (0, import_react18.useLayoutEffect)(() => {
13080
+ (0, import_react20.useLayoutEffect)(() => {
12945
13081
  const parent = portal || document.body;
12946
13082
  const value = Math.abs(parent.getBoundingClientRect().top ?? 0);
12947
13083
  setTop(value);
@@ -12950,102 +13086,219 @@ var CheckoutDialog = ({
12950
13086
  parent.style.overflow = "";
12951
13087
  };
12952
13088
  }, [portal]);
12953
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Modal, { size: "lg", top, children: [
12954
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ModalHeader, { bordered: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Flex, { $gap: "1rem", children: checkoutStages.map((stage, index, stages) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12955
- Navigation,
12956
- {
12957
- name: stage.name,
12958
- index,
12959
- activeIndex: checkoutStages.findIndex(
12960
- (s2) => s2.id === checkoutStage
12961
- ),
12962
- isLast: index === stages.length - 1,
12963
- onClick: () => setCheckoutStage(stage.id)
12964
- },
12965
- stage.id
12966
- )) }) }),
12967
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Flex, { $position: "relative", $height: "calc(100% - 5rem)", children: [
12968
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
12969
- Flex,
12970
- {
12971
- $flexDirection: "column",
12972
- $flexGrow: "1",
12973
- $gap: "1rem",
12974
- $padding: "2rem 2.5rem 2rem 2.5rem",
12975
- $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
12976
- $flex: "1",
12977
- $overflow: "auto",
12978
- children: [
12979
- checkoutStage === "plan" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12980
- Plan,
12981
- {
12982
- isLoading,
12983
- period: planPeriod,
12984
- plans: availablePlans,
12985
- currentPlan,
12986
- selectedPlan,
12987
- selectPlan
12988
- }
12989
- ),
12990
- checkoutStage === "addons" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12991
- AddOns,
12992
- {
12993
- isLoading,
12994
- period: planPeriod,
12995
- addOns,
12996
- toggle: (id) => toggleAddOn(id)
13089
+ (0, import_react20.useLayoutEffect)(() => {
13090
+ if (contentRef.current) {
13091
+ contentRef.current.scrollTo({
13092
+ top: 0,
13093
+ left: 0,
13094
+ behavior: "smooth"
13095
+ });
13096
+ }
13097
+ }, [checkoutStage]);
13098
+ const activeCheckoutStage = checkoutStages.find(
13099
+ (stage) => stage.id === checkoutStage
13100
+ );
13101
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13102
+ Modal,
13103
+ {
13104
+ ref: modalRef,
13105
+ id: "select-plan-dialog",
13106
+ size: "lg",
13107
+ top,
13108
+ contentRef,
13109
+ children: [
13110
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ModalHeader, { bordered: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13111
+ Flex,
13112
+ {
13113
+ $flexWrap: "wrap",
13114
+ $gap: "0.5rem",
13115
+ $viewport: {
13116
+ md: {
13117
+ $gap: "1rem"
12997
13118
  }
12998
- ),
12999
- checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13000
- Checkout,
13119
+ },
13120
+ children: checkoutStages.map((stage, index, stages) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13121
+ Navigation,
13001
13122
  {
13002
- setPaymentMethodId: (id) => setPaymentMethodId(id),
13003
- togglePaymentForm: () => setShowPaymentForm((prev2) => !prev2),
13004
- setupIntent,
13005
- showPaymentForm,
13006
- stripe
13123
+ name: stage.name,
13124
+ index,
13125
+ activeIndex: checkoutStages.findIndex(
13126
+ (s2) => s2.id === checkoutStage
13127
+ ),
13128
+ isLast: index === stages.length - 1,
13129
+ onClick: () => setCheckoutStage(stage.id)
13130
+ },
13131
+ stage.id
13132
+ ))
13133
+ }
13134
+ ) }),
13135
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13136
+ Flex,
13137
+ {
13138
+ $position: "relative",
13139
+ $flexDirection: "column",
13140
+ $height: "auto",
13141
+ $viewport: {
13142
+ md: {
13143
+ $flexDirection: "row",
13144
+ $height: "calc(100% - 5rem)"
13007
13145
  }
13008
- )
13009
- ]
13010
- }
13011
- ),
13012
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13013
- Sidebar,
13014
- {
13015
- addOns,
13016
- charges,
13017
- checkoutStage,
13018
- currentAddOns,
13019
- currentPlan,
13020
- error,
13021
- isLoading,
13022
- paymentMethodId,
13023
- planPeriod,
13024
- selectedPlan,
13025
- selectPlan,
13026
- setCheckoutStage: (stage) => setCheckoutStage(stage),
13027
- setError: (msg) => setError(msg),
13028
- setPlanPeriod: (period) => setPlanPeriod(period),
13029
- setSetupIntent: (intent) => setSetupIntent(intent),
13030
- showPaymentForm,
13031
- toggleLoading: () => setIsLoading((prev2) => !prev2)
13032
- }
13033
- )
13034
- ] })
13035
- ] });
13146
+ },
13147
+ children: [
13148
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13149
+ Flex,
13150
+ {
13151
+ $flexDirection: "column",
13152
+ $flexGrow: "1",
13153
+ $gap: "1.5rem",
13154
+ $padding: "1.5rem",
13155
+ $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
13156
+ $overflow: "auto",
13157
+ $viewport: {
13158
+ md: {
13159
+ $padding: "2rem 2.5rem 2rem 2.5rem"
13160
+ }
13161
+ },
13162
+ children: [
13163
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13164
+ Flex,
13165
+ {
13166
+ $flexDirection: "column",
13167
+ $flexWrap: "wrap",
13168
+ $gap: "1.5rem",
13169
+ $viewport: {
13170
+ md: {
13171
+ $flexDirection: "row",
13172
+ $justifyContent: "space-between",
13173
+ $alignItems: "start",
13174
+ $gap: "1rem"
13175
+ }
13176
+ },
13177
+ children: [
13178
+ activeCheckoutStage && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13179
+ Flex,
13180
+ {
13181
+ $flexDirection: "column",
13182
+ $alignItems: "center",
13183
+ $gap: "0.25rem",
13184
+ $viewport: {
13185
+ md: {
13186
+ $alignItems: "start"
13187
+ }
13188
+ },
13189
+ children: [
13190
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13191
+ Text,
13192
+ {
13193
+ as: "h3",
13194
+ $font: theme.typography.heading3.fontFamily,
13195
+ $size: theme.typography.heading3.fontSize,
13196
+ $weight: theme.typography.heading3.fontWeight,
13197
+ $color: theme.typography.heading3.color,
13198
+ $marginBottom: "0.5rem",
13199
+ children: activeCheckoutStage.label
13200
+ }
13201
+ ),
13202
+ activeCheckoutStage?.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13203
+ Text,
13204
+ {
13205
+ as: "p",
13206
+ $font: theme.typography.text.fontFamily,
13207
+ $size: theme.typography.text.fontSize,
13208
+ $weight: theme.typography.text.fontWeight,
13209
+ $color: theme.typography.text.color,
13210
+ children: activeCheckoutStage.description
13211
+ }
13212
+ )
13213
+ ]
13214
+ }
13215
+ ),
13216
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13217
+ PeriodToggle,
13218
+ {
13219
+ options: availablePeriods,
13220
+ selectedOption: planPeriod,
13221
+ selectedPlan,
13222
+ onChange: changePlanPeriod,
13223
+ layerRef: modalRef
13224
+ }
13225
+ )
13226
+ ]
13227
+ }
13228
+ ),
13229
+ checkoutStage === "plan" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13230
+ Plan,
13231
+ {
13232
+ isLoading,
13233
+ period: planPeriod,
13234
+ plans: availablePlans,
13235
+ currentPlan,
13236
+ selectedPlan,
13237
+ selectPlan
13238
+ }
13239
+ ),
13240
+ checkoutStage === "addons" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13241
+ AddOns,
13242
+ {
13243
+ isLoading,
13244
+ period: planPeriod,
13245
+ addOns,
13246
+ toggle: (id) => toggleAddOn(id)
13247
+ }
13248
+ ),
13249
+ checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13250
+ Checkout,
13251
+ {
13252
+ setPaymentMethodId: (id) => setPaymentMethodId(id),
13253
+ togglePaymentForm: () => setShowPaymentForm((prev2) => !prev2),
13254
+ setupIntent,
13255
+ showPaymentForm,
13256
+ stripe
13257
+ }
13258
+ )
13259
+ ]
13260
+ }
13261
+ ),
13262
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13263
+ Sidebar,
13264
+ {
13265
+ addOns,
13266
+ charges,
13267
+ checkoutRef,
13268
+ checkoutStage,
13269
+ currentAddOns,
13270
+ currentPlan,
13271
+ error,
13272
+ isLoading,
13273
+ paymentMethodId,
13274
+ planPeriod,
13275
+ selectedPlan,
13276
+ setCheckoutStage: (stage) => setCheckoutStage(stage),
13277
+ setError: (msg) => setError(msg),
13278
+ setSetupIntent: (intent) => setSetupIntent(intent),
13279
+ showPaymentForm,
13280
+ toggleLoading: () => setIsLoading((prev2) => !prev2)
13281
+ }
13282
+ )
13283
+ ]
13284
+ }
13285
+ )
13286
+ ]
13287
+ }
13288
+ );
13036
13289
  };
13037
13290
 
13038
13291
  // src/components/shared/payment-form/PaymentForm.tsx
13039
- var import_react19 = require("react");
13292
+ var import_react21 = require("react");
13040
13293
  var import_react_stripe_js2 = require("@stripe/react-stripe-js");
13041
13294
  var import_jsx_runtime25 = require("react/jsx-runtime");
13042
13295
  var PaymentForm = ({ onConfirm }) => {
13043
13296
  const stripe = (0, import_react_stripe_js2.useStripe)();
13044
13297
  const elements = (0, import_react_stripe_js2.useElements)();
13045
13298
  const { api } = useEmbed();
13046
- const [message, setMessage] = (0, import_react19.useState)(null);
13047
- const [isLoading, setIsLoading] = (0, import_react19.useState)(false);
13048
- const [isConfirmed, setIsConfirmed] = (0, import_react19.useState)(false);
13299
+ const [message, setMessage] = (0, import_react21.useState)(null);
13300
+ const [isLoading, setIsLoading] = (0, import_react21.useState)(false);
13301
+ const [isConfirmed, setIsConfirmed] = (0, import_react21.useState)(false);
13049
13302
  const handleSubmit = async (event) => {
13050
13303
  event.preventDefault();
13051
13304
  if (!api || !stripe || !elements) {
@@ -13106,43 +13359,75 @@ var PaymentForm = ({ onConfirm }) => {
13106
13359
  };
13107
13360
 
13108
13361
  // src/components/shared/period-toggle/PeriodToggle.tsx
13362
+ var import_react22 = require("react");
13109
13363
  var import_jsx_runtime26 = require("react/jsx-runtime");
13110
13364
  var PeriodToggle = ({
13111
13365
  options,
13112
13366
  selectedOption,
13113
- onChange
13367
+ selectedPlan,
13368
+ onChange,
13369
+ layerRef
13114
13370
  }) => {
13115
13371
  const theme = nt();
13116
13372
  const isLightBackground = useIsLightBackground();
13373
+ const [tooltipZIndex, setTooltipZIndex] = (0, import_react22.useState)(1);
13374
+ const savingsPercentage = (0, import_react22.useMemo)(() => {
13375
+ if (selectedPlan) {
13376
+ const monthly = (selectedPlan?.monthlyPrice?.price || 0) * 12;
13377
+ const yearly = selectedPlan?.yearlyPrice?.price || 0;
13378
+ return Math.round((monthly - yearly) / monthly * 1e4) / 100;
13379
+ }
13380
+ return 0;
13381
+ }, [selectedPlan]);
13382
+ (0, import_react22.useLayoutEffect)(() => {
13383
+ const element = layerRef?.current;
13384
+ if (element) {
13385
+ const style = getComputedStyle(element);
13386
+ const value = style.getPropertyValue("z-index");
13387
+ setTooltipZIndex(parseInt(value) + 1);
13388
+ }
13389
+ }, [layerRef]);
13117
13390
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13118
13391
  Flex,
13119
13392
  {
13120
- $width: "fit-content",
13393
+ $margin: 0,
13121
13394
  $backgroundColor: theme.card.background,
13122
13395
  $borderWidth: "1px",
13123
13396
  $borderStyle: "solid",
13124
13397
  $borderColor: isLightBackground ? "hsl(0, 0%, 92.5%)" : "hsl(0, 0%, 7.5%)",
13125
13398
  $borderRadius: "2.5rem",
13126
13399
  $cursor: "pointer",
13400
+ $viewport: {
13401
+ md: {
13402
+ $width: "fit-content"
13403
+ }
13404
+ },
13127
13405
  children: options.map((option) => {
13128
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13406
+ const element = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13129
13407
  Flex,
13130
13408
  {
13131
13409
  tabIndex: 0,
13132
13410
  onClick: () => onChange(option),
13133
13411
  $justifyContent: "center",
13134
13412
  $alignItems: "center",
13135
- $padding: "0.375rem 1rem",
13413
+ $flexGrow: 1,
13414
+ $whiteSpace: "nowrap",
13415
+ $padding: "0.75rem 1rem",
13136
13416
  ...option === selectedOption && {
13137
13417
  $backgroundColor: isLightBackground ? "hsl(0, 0%, 92.5%)" : "hsl(0, 0%, 7.5%)"
13138
13418
  },
13139
13419
  $borderRadius: "2.5rem",
13420
+ $viewport: {
13421
+ md: {
13422
+ $padding: "0.375rem 1rem"
13423
+ }
13424
+ },
13140
13425
  children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
13141
13426
  Text,
13142
13427
  {
13143
- $flexShrink: "0",
13428
+ $flexShrink: 0,
13144
13429
  $font: theme.typography.text.fontFamily,
13145
- $size: 14,
13430
+ $size: 15,
13146
13431
  $weight: option === selectedOption ? 600 : 400,
13147
13432
  $color: theme.typography.text.color,
13148
13433
  children: [
@@ -13154,38 +13439,36 @@ var PeriodToggle = ({
13154
13439
  },
13155
13440
  option
13156
13441
  );
13442
+ if (option === "year" && savingsPercentage > 0) {
13443
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13444
+ Tooltip,
13445
+ {
13446
+ trigger: element,
13447
+ content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13448
+ Text,
13449
+ {
13450
+ $font: theme.typography.text.fontFamily,
13451
+ $size: 11,
13452
+ $weight: theme.typography.text.fontWeight,
13453
+ $color: theme.primary,
13454
+ $leading: 1,
13455
+ children: selectedOption === "month" ? `Save up to ${savingsPercentage}% with yearly billing` : `You are saving ${savingsPercentage}% with yearly billing`
13456
+ }
13457
+ ),
13458
+ zIndex: tooltipZIndex,
13459
+ $flexGrow: 1
13460
+ },
13461
+ option
13462
+ );
13463
+ }
13464
+ return element;
13157
13465
  })
13158
13466
  }
13159
13467
  );
13160
13468
  };
13161
13469
 
13162
- // src/components/shared/savings/Savings.tsx
13163
- var import_react20 = require("react");
13164
- var import_jsx_runtime27 = require("react/jsx-runtime");
13165
- var Savings = ({ plan, period }) => {
13166
- const theme = nt();
13167
- const savingsPercentage = (0, import_react20.useMemo)(() => {
13168
- if (plan) {
13169
- const monthly = (plan?.monthlyPrice?.price || 0) * 12;
13170
- const yearly = plan?.yearlyPrice?.price || 0;
13171
- return Math.round((monthly - yearly) / monthly * 1e4) / 100;
13172
- }
13173
- return 0;
13174
- }, [plan]);
13175
- return savingsPercentage > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13176
- Text,
13177
- {
13178
- $font: theme.typography.text.fontFamily,
13179
- $size: 11,
13180
- $weight: theme.typography.text.fontWeight,
13181
- $color: theme.primary,
13182
- children: period === "month" ? `Save up to ${savingsPercentage}% with yearly billing` : `You are saving ${savingsPercentage}% with yearly billing`
13183
- }
13184
- );
13185
- };
13186
-
13187
13470
  // src/components/elements/payment-method/PaymentMethod.tsx
13188
- var import_jsx_runtime28 = require("react/jsx-runtime");
13471
+ var import_jsx_runtime27 = require("react/jsx-runtime");
13189
13472
  var resolveDesignProps4 = (props) => {
13190
13473
  return {
13191
13474
  header: {
@@ -13208,9 +13491,9 @@ var PaymentMethodElement = ({
13208
13491
  const theme = nt();
13209
13492
  const isLightBackground = useIsLightBackground();
13210
13493
  const sizeFactor = size === "lg" ? 2 : size === "md" ? 1 : 0.5;
13211
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
13212
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
13213
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13494
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
13495
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
13496
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13214
13497
  Text,
13215
13498
  {
13216
13499
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -13220,7 +13503,7 @@ var PaymentMethodElement = ({
13220
13503
  children: "Payment Method"
13221
13504
  }
13222
13505
  ),
13223
- props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13506
+ props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13224
13507
  Text,
13225
13508
  {
13226
13509
  $font: theme.typography.text.fontFamily,
@@ -13230,7 +13513,7 @@ var PaymentMethodElement = ({
13230
13513
  }
13231
13514
  )
13232
13515
  ] }),
13233
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
13516
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
13234
13517
  Flex,
13235
13518
  {
13236
13519
  $justifyContent: "space-between",
@@ -13239,8 +13522,8 @@ var PaymentMethodElement = ({
13239
13522
  $padding: `${sizeFactor / 2}rem ${sizeFactor}rem`,
13240
13523
  $borderRadius: "9999px",
13241
13524
  children: [
13242
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text, { $font: theme.typography.text.fontFamily, $size: 14, children: cardLast4 ? `\u{1F4B3} Card ending in ${cardLast4}` : "Other existing payment method" }),
13243
- props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13525
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { $font: theme.typography.text.fontFamily, $size: 14, children: cardLast4 ? `\u{1F4B3} Card ending in ${cardLast4}` : "Other existing payment method" }),
13526
+ props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13244
13527
  Text,
13245
13528
  {
13246
13529
  onClick: onEdit,
@@ -13257,20 +13540,20 @@ var PaymentMethodElement = ({
13257
13540
  )
13258
13541
  ] });
13259
13542
  };
13260
- var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
13543
+ var PaymentMethod = (0, import_react23.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
13261
13544
  const props = resolveDesignProps4(rest);
13262
13545
  const theme = nt();
13263
13546
  const { api, data, layout, setLayout } = useEmbed();
13264
- const [isLoading, setIsLoading] = (0, import_react21.useState)(false);
13265
- const [error, setError] = (0, import_react21.useState)();
13266
- const [showPaymentForm, setShowPaymentForm] = (0, import_react21.useState)(
13547
+ const [isLoading, setIsLoading] = (0, import_react23.useState)(false);
13548
+ const [error, setError] = (0, import_react23.useState)();
13549
+ const [showPaymentForm, setShowPaymentForm] = (0, import_react23.useState)(
13267
13550
  () => typeof data.subscription?.paymentMethod === "undefined"
13268
13551
  );
13269
- const [stripe, setStripe] = (0, import_react21.useState)(null);
13270
- const [setupIntent, setSetupIntent] = (0, import_react21.useState)();
13271
- const [top, setTop] = (0, import_react21.useState)(0);
13552
+ const [stripe, setStripe] = (0, import_react23.useState)(null);
13553
+ const [setupIntent, setSetupIntent] = (0, import_react23.useState)();
13554
+ const [top, setTop] = (0, import_react23.useState)(0);
13272
13555
  const isLightBackground = useIsLightBackground();
13273
- const paymentMethod = (0, import_react21.useMemo)(() => {
13556
+ const paymentMethod = (0, import_react23.useMemo)(() => {
13274
13557
  const { paymentMethodType, cardLast4, cardExpMonth, cardExpYear } = data.subscription?.paymentMethod || {};
13275
13558
  let monthsToExpiration;
13276
13559
  if (typeof cardExpYear === "number" && typeof cardExpMonth === "number") {
@@ -13290,7 +13573,7 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13290
13573
  monthsToExpiration
13291
13574
  };
13292
13575
  }, [data.subscription?.paymentMethod]);
13293
- const createSetupIntent = (0, import_react21.useCallback)(async () => {
13576
+ const createSetupIntent = (0, import_react23.useCallback)(async () => {
13294
13577
  if (!api || !data.component?.id) {
13295
13578
  return;
13296
13579
  }
@@ -13307,7 +13590,7 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13307
13590
  setIsLoading(false);
13308
13591
  }
13309
13592
  }, [api, data.component?.id]);
13310
- const updatePaymentMethod = (0, import_react21.useCallback)(
13593
+ const updatePaymentMethod = (0, import_react23.useCallback)(
13311
13594
  async (id) => {
13312
13595
  if (!api || !id) {
13313
13596
  return;
@@ -13328,22 +13611,16 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13328
13611
  },
13329
13612
  [api, setLayout]
13330
13613
  );
13331
- (0, import_react21.useEffect)(() => {
13614
+ (0, import_react23.useEffect)(() => {
13332
13615
  if (!stripe && setupIntent?.publishableKey) {
13333
13616
  setStripe(loadStripe(setupIntent.publishableKey));
13334
13617
  }
13335
13618
  }, [stripe, setupIntent?.publishableKey]);
13336
- (0, import_react21.useEffect)(() => {
13337
- document.body.style.overflow = layout === "payment" ? "hidden" : "";
13338
- return () => {
13339
- document.body.style.overflow = "";
13340
- };
13341
- }, [layout]);
13342
- (0, import_react21.useLayoutEffect)(() => {
13619
+ (0, import_react23.useLayoutEffect)(() => {
13343
13620
  const parent = portal || document.body;
13344
13621
  const value = Math.abs(parent.getBoundingClientRect().top ?? 0);
13345
13622
  setTop(value);
13346
- parent.style.overflow = "hidden";
13623
+ parent.style.overflow = layout === "payment" ? "hidden" : "";
13347
13624
  return () => {
13348
13625
  parent.style.overflow = "";
13349
13626
  };
@@ -13351,8 +13628,8 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13351
13628
  if (!paymentMethod.paymentMethodType) {
13352
13629
  return null;
13353
13630
  }
13354
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Element, { ref, className, children: [
13355
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13631
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Element, { ref, className, children: [
13632
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13356
13633
  PaymentMethodElement,
13357
13634
  {
13358
13635
  ...allowEdit && { onEdit: () => setLayout("payment") },
@@ -13360,9 +13637,9 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13360
13637
  ...props
13361
13638
  }
13362
13639
  ),
13363
- layout === "payment" && (0, import_react_dom.createPortal)(
13364
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Modal, { size: "md", top, onClose: () => setShowPaymentForm(false), children: [
13365
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ModalHeader, { bordered: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13640
+ layout === "payment" && (0, import_react_dom2.createPortal)(
13641
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Modal, { size: "md", top, onClose: () => setShowPaymentForm(false), children: [
13642
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ModalHeader, { bordered: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13366
13643
  Text,
13367
13644
  {
13368
13645
  $font: theme.typography.text.fontFamily,
@@ -13372,7 +13649,7 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13372
13649
  children: "Edit payment method"
13373
13650
  }
13374
13651
  ) }),
13375
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Flex, { $position: "relative", $height: "calc(100% - 5rem)", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13652
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Flex, { $position: "relative", $height: "calc(100% - 5rem)", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13376
13653
  Flex,
13377
13654
  {
13378
13655
  $flexDirection: "column",
@@ -13381,8 +13658,8 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13381
13658
  $padding: "2rem 2.5rem 2rem 2.5rem",
13382
13659
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
13383
13660
  $overflow: "auto",
13384
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
13385
- showPaymentForm ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13661
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
13662
+ showPaymentForm ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13386
13663
  import_react_stripe_js3.Elements,
13387
13664
  {
13388
13665
  stripe,
@@ -13413,15 +13690,15 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13413
13690
  },
13414
13691
  clientSecret: setupIntent?.setupIntentClientSecret
13415
13692
  },
13416
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13693
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13417
13694
  PaymentForm,
13418
13695
  {
13419
13696
  onConfirm: (value) => updatePaymentMethod(value)
13420
13697
  }
13421
13698
  )
13422
13699
  }
13423
- ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
13424
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13700
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
13701
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13425
13702
  PaymentMethodElement,
13426
13703
  {
13427
13704
  size: "lg",
@@ -13429,7 +13706,7 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13429
13706
  ...props
13430
13707
  }
13431
13708
  ),
13432
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13709
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13433
13710
  Text,
13434
13711
  {
13435
13712
  onClick: createSetupIntent,
@@ -13441,7 +13718,7 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13441
13718
  }
13442
13719
  ) })
13443
13720
  ] }),
13444
- !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13721
+ !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
13445
13722
  Text,
13446
13723
  {
13447
13724
  $font: theme.typography.text.fontFamily,
@@ -13462,9 +13739,9 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13462
13739
  PaymentMethod.displayName = "PaymentMethod";
13463
13740
 
13464
13741
  // src/components/elements/plan-manager/PlanManager.tsx
13465
- var import_react22 = require("react");
13466
- var import_react_dom2 = require("react-dom");
13467
- var import_jsx_runtime29 = require("react/jsx-runtime");
13742
+ var import_react24 = require("react");
13743
+ var import_react_dom3 = require("react-dom");
13744
+ var import_jsx_runtime28 = require("react/jsx-runtime");
13468
13745
  var resolveDesignProps5 = (props) => {
13469
13746
  return {
13470
13747
  header: {
@@ -13478,7 +13755,7 @@ var resolveDesignProps5 = (props) => {
13478
13755
  },
13479
13756
  price: {
13480
13757
  isVisible: props.header?.price?.isVisible ?? true,
13481
- fontStyle: props.header?.price?.fontStyle ?? "text"
13758
+ fontStyle: props.header?.price?.fontStyle ?? "heading3"
13482
13759
  }
13483
13760
  },
13484
13761
  addOns: {
@@ -13493,7 +13770,7 @@ var resolveDesignProps5 = (props) => {
13493
13770
  }
13494
13771
  };
13495
13772
  };
13496
- var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal, ...rest }, ref) => {
13773
+ var PlanManager = (0, import_react24.forwardRef)(({ children, className, portal, ...rest }, ref) => {
13497
13774
  const props = resolveDesignProps5(rest);
13498
13775
  const theme = nt();
13499
13776
  const { data, layout, setLayout } = useEmbed();
@@ -13503,7 +13780,7 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13503
13780
  canChangePlan: data.capabilities?.checkout ?? true,
13504
13781
  currentPlan: data.company?.plan
13505
13782
  };
13506
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13783
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
13507
13784
  Element,
13508
13785
  {
13509
13786
  as: Flex,
@@ -13512,7 +13789,7 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13512
13789
  $flexDirection: "column",
13513
13790
  $gap: "2rem",
13514
13791
  children: [
13515
- props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13792
+ props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
13516
13793
  Flex,
13517
13794
  {
13518
13795
  $justifyContent: "space-between",
@@ -13520,8 +13797,8 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13520
13797
  $flexWrap: "wrap",
13521
13798
  $gap: "1rem",
13522
13799
  children: [
13523
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
13524
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13800
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
13801
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13525
13802
  Text,
13526
13803
  {
13527
13804
  as: Box,
@@ -13533,7 +13810,7 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13533
13810
  children: currentPlan.name
13534
13811
  }
13535
13812
  ),
13536
- props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13813
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13537
13814
  Text,
13538
13815
  {
13539
13816
  as: Box,
@@ -13545,25 +13822,36 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13545
13822
  }
13546
13823
  )
13547
13824
  ] }),
13548
- props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13549
- Text,
13550
- {
13551
- $font: theme.typography[props.header.price.fontStyle].fontFamily,
13552
- $size: theme.typography[props.header.price.fontStyle].fontSize,
13553
- $weight: theme.typography[props.header.price.fontStyle].fontWeight,
13554
- $color: theme.typography[props.header.price.fontStyle].color,
13555
- children: [
13556
- formatCurrency(currentPlan.planPrice),
13557
- "/",
13558
- currentPlan.planPeriod
13559
- ]
13560
- }
13561
- )
13825
+ props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Box, { children: [
13826
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13827
+ Text,
13828
+ {
13829
+ $font: theme.typography[props.header.price.fontStyle].fontFamily,
13830
+ $size: theme.typography[props.header.price.fontStyle].fontSize,
13831
+ $weight: theme.typography[props.header.price.fontStyle].fontWeight,
13832
+ $color: theme.typography[props.header.price.fontStyle].color,
13833
+ children: formatCurrency(currentPlan.planPrice)
13834
+ }
13835
+ ),
13836
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
13837
+ Text,
13838
+ {
13839
+ $font: theme.typography[props.header.price.fontStyle].fontFamily,
13840
+ $size: 16 / 30 * theme.typography[props.header.price.fontStyle].fontSize,
13841
+ $weight: theme.typography[props.header.price.fontStyle].fontWeight,
13842
+ $color: theme.typography[props.header.price.fontStyle].color,
13843
+ children: [
13844
+ "/",
13845
+ currentPlan.planPeriod
13846
+ ]
13847
+ }
13848
+ )
13849
+ ] })
13562
13850
  ]
13563
13851
  }
13564
13852
  ),
13565
- props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
13566
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13853
+ props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
13854
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13567
13855
  Text,
13568
13856
  {
13569
13857
  $font: theme.typography.text.fontFamily,
@@ -13574,7 +13862,7 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13574
13862
  children: "Addons"
13575
13863
  }
13576
13864
  ),
13577
- addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13865
+ addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
13578
13866
  Flex,
13579
13867
  {
13580
13868
  $justifyContent: "space-between",
@@ -13582,7 +13870,7 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13582
13870
  $flexWrap: "wrap",
13583
13871
  $gap: "1rem",
13584
13872
  children: [
13585
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13873
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13586
13874
  Text,
13587
13875
  {
13588
13876
  $font: theme.typography[props.addOns.fontStyle].fontFamily,
@@ -13592,7 +13880,7 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13592
13880
  children: addOn.name
13593
13881
  }
13594
13882
  ),
13595
- addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13883
+ addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
13596
13884
  Text,
13597
13885
  {
13598
13886
  $font: theme.typography.text.fontFamily,
@@ -13611,7 +13899,7 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13611
13899
  addOn.id
13612
13900
  ))
13613
13901
  ] }),
13614
- canChangePlan && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13902
+ canChangePlan && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
13615
13903
  EmbedButton,
13616
13904
  {
13617
13905
  onClick: () => {
@@ -13622,8 +13910,8 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13622
13910
  children: "Change Plan"
13623
13911
  }
13624
13912
  ),
13625
- canChangePlan && layout === "checkout" && (0, import_react_dom2.createPortal)(
13626
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CheckoutDialog, { ...portal && { portal } }),
13913
+ canChangePlan && layout === "checkout" && (0, import_react_dom3.createPortal)(
13914
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CheckoutDialog, { ...portal && { portal } }),
13627
13915
  portal || document.body
13628
13916
  )
13629
13917
  ]
@@ -13633,10 +13921,10 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13633
13921
  PlanManager.displayName = "PlanManager";
13634
13922
 
13635
13923
  // src/components/elements/pricing-table/PricingTable.tsx
13636
- var import_react23 = require("react");
13637
- var import_react_dom3 = require("react-dom");
13924
+ var import_react25 = require("react");
13925
+ var import_react_dom4 = require("react-dom");
13638
13926
  var import_pluralize4 = __toESM(require_pluralize());
13639
- var import_jsx_runtime30 = require("react/jsx-runtime");
13927
+ var import_jsx_runtime29 = require("react/jsx-runtime");
13640
13928
  var resolveDesignProps6 = (props) => {
13641
13929
  return {
13642
13930
  showPeriodToggle: props.showPeriodToggle ?? true,
@@ -13666,73 +13954,77 @@ var resolveDesignProps6 = (props) => {
13666
13954
  },
13667
13955
  upgrade: {
13668
13956
  isVisible: props.upgrade?.isVisible ?? true,
13669
- buttonSize: props.upgrade?.buttonSize ?? "sm",
13957
+ buttonSize: props.upgrade?.buttonSize ?? "md",
13670
13958
  buttonStyle: props.upgrade?.buttonStyle ?? "primary"
13671
13959
  },
13672
13960
  downgrade: {
13673
13961
  isVisible: props.downgrade?.isVisible ?? true,
13674
- buttonSize: props.downgrade?.buttonSize ?? "sm",
13962
+ buttonSize: props.downgrade?.buttonSize ?? "md",
13675
13963
  buttonStyle: props.downgrade?.buttonStyle ?? "primary"
13676
13964
  }
13677
13965
  };
13678
13966
  };
13679
- var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal, ...rest }, ref) => {
13967
+ var PricingTable = (0, import_react25.forwardRef)(({ children, className, portal, ...rest }, ref) => {
13680
13968
  const props = resolveDesignProps6(rest);
13681
13969
  const theme = nt();
13682
13970
  const { data, layout, setLayout } = useEmbed();
13683
- const [selectedPeriod, setSelectedPeriod] = (0, import_react23.useState)(
13971
+ const [selectedPeriod, setSelectedPeriod] = (0, import_react25.useState)(
13684
13972
  () => data.company?.plan?.planPeriod || "month"
13685
13973
  );
13686
- const [selectedPlanId, setSelectedPlanId] = (0, import_react23.useState)();
13687
- const [selectedAddOnId, setSelectedAddOnId] = (0, import_react23.useState)();
13974
+ const [selectedPlanId, setSelectedPlanId] = (0, import_react25.useState)();
13975
+ const [selectedAddOnId, setSelectedAddOnId] = (0, import_react25.useState)();
13688
13976
  const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
13689
13977
  const isLightBackground = useIsLightBackground();
13690
13978
  const canChangePlan = data.capabilities?.checkout ?? true;
13691
13979
  const cardPadding = theme.card.padding / TEXT_BASE_SIZE;
13692
13980
  const currentPlanIndex = plans.findIndex((plan) => plan.current);
13693
- const currentPlan = plans[currentPlanIndex];
13694
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
13981
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13695
13982
  FussyChild,
13696
13983
  {
13697
13984
  ref,
13698
13985
  className,
13699
13986
  as: Flex,
13700
13987
  $flexDirection: "column",
13701
- $gap: "3rem",
13988
+ $gap: "2rem",
13702
13989
  children: [
13703
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Box, { children: [
13704
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
13990
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Box, { children: [
13991
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13705
13992
  Flex,
13706
13993
  {
13707
- $justifyContent: "space-between",
13994
+ $flexDirection: "column",
13995
+ $justifyContent: "center",
13708
13996
  $alignItems: "center",
13709
- $marginBottom: "2rem",
13997
+ $gap: "1rem",
13998
+ $marginBottom: "1rem",
13999
+ $viewport: {
14000
+ md: {
14001
+ $flexDirection: "row",
14002
+ $justifyContent: "space-between"
14003
+ }
14004
+ },
13710
14005
  children: [
13711
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14006
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13712
14007
  Text,
13713
14008
  {
13714
14009
  $font: theme.typography[props.header.fontStyle].fontFamily,
13715
14010
  $size: theme.typography[props.header.fontStyle].fontSize,
13716
14011
  $weight: theme.typography[props.header.fontStyle].fontWeight,
13717
- $color: theme.typography[props.header.fontStyle].color,
14012
+ $color: theme.card.background,
13718
14013
  children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && "Plans"
13719
14014
  }
13720
14015
  ),
13721
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $alignItems: "center", $gap: "1rem", children: [
13722
- props.showDiscount && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Savings, { plan: currentPlan, period: selectedPeriod }),
13723
- props.showPeriodToggle && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
13724
- PeriodToggle,
13725
- {
13726
- options: periods,
13727
- selectedOption: selectedPeriod,
13728
- onChange: (period) => setSelectedPeriod(period)
13729
- }
13730
- )
13731
- ] })
14016
+ props.showPeriodToggle && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14017
+ PeriodToggle,
14018
+ {
14019
+ options: periods,
14020
+ selectedOption: selectedPeriod,
14021
+ onChange: (period) => setSelectedPeriod(period)
14022
+ }
14023
+ )
13732
14024
  ]
13733
14025
  }
13734
14026
  ),
13735
- props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14027
+ props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13736
14028
  Box,
13737
14029
  {
13738
14030
  $display: "grid",
@@ -13740,7 +14032,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13740
14032
  $gap: "1rem",
13741
14033
  children: plans.map((plan, index, self2) => {
13742
14034
  const isActivePlan = plan.current && data.company?.plan?.planPeriod === selectedPeriod;
13743
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
14035
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13744
14036
  Flex,
13745
14037
  {
13746
14038
  $position: "relative",
@@ -13753,7 +14045,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13753
14045
  $outlineColor: isActivePlan ? theme.primary : "transparent",
13754
14046
  ...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
13755
14047
  children: [
13756
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
14048
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13757
14049
  Flex,
13758
14050
  {
13759
14051
  $flexDirection: "column",
@@ -13763,7 +14055,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13763
14055
  $borderStyle: "solid",
13764
14056
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
13765
14057
  children: [
13766
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14058
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13767
14059
  Text,
13768
14060
  {
13769
14061
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -13773,7 +14065,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13773
14065
  children: plan.name
13774
14066
  }
13775
14067
  ) }),
13776
- props.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14068
+ props.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13777
14069
  Text,
13778
14070
  {
13779
14071
  $font: theme.typography[props.plans.description.fontStyle].fontFamily,
@@ -13783,8 +14075,8 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13783
14075
  children: plan.description
13784
14076
  }
13785
14077
  ) }),
13786
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Box, { children: [
13787
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14078
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Box, { children: [
14079
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13788
14080
  Text,
13789
14081
  {
13790
14082
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -13796,7 +14088,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13796
14088
  )
13797
14089
  }
13798
14090
  ),
13799
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
14091
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13800
14092
  Text,
13801
14093
  {
13802
14094
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -13810,13 +14102,13 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13810
14102
  }
13811
14103
  )
13812
14104
  ] }),
13813
- isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14105
+ isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13814
14106
  Flex,
13815
14107
  {
13816
14108
  $position: "absolute",
13817
14109
  $right: "1rem",
13818
14110
  $top: "1rem",
13819
- $fontSize: "0.625rem",
14111
+ $fontSize: "0.75rem",
13820
14112
  $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
13821
14113
  $backgroundColor: theme.primary,
13822
14114
  $borderRadius: "9999px",
@@ -13827,7 +14119,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13827
14119
  ]
13828
14120
  }
13829
14121
  ),
13830
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
14122
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13831
14123
  Flex,
13832
14124
  {
13833
14125
  $flexDirection: "column",
@@ -13836,8 +14128,8 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13836
14128
  $gap: `${cardPadding}rem`,
13837
14129
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
13838
14130
  children: [
13839
- props.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
13840
- props.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
14131
+ props.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: [
14132
+ props.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13841
14133
  Text,
13842
14134
  {
13843
14135
  $font: theme.typography.text.fontFamily,
@@ -13852,8 +14144,8 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13852
14144
  }
13853
14145
  ) }),
13854
14146
  plan.entitlements.map((entitlement) => {
13855
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $gap: "1rem", children: [
13856
- props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14147
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $gap: "1rem", children: [
14148
+ props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13857
14149
  IconRound,
13858
14150
  {
13859
14151
  name: entitlement.feature.icon,
@@ -13864,14 +14156,14 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13864
14156
  ]
13865
14157
  }
13866
14158
  ),
13867
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14159
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13868
14160
  Text,
13869
14161
  {
13870
14162
  $font: theme.typography.text.fontFamily,
13871
14163
  $size: theme.typography.text.fontSize,
13872
14164
  $weight: theme.typography.text.fontWeight,
13873
14165
  $color: theme.typography.text.color,
13874
- children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
14166
+ children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
13875
14167
  typeof entitlement.valueNumeric === "number" ? `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize4.default)(entitlement.feature.name, entitlement.valueNumeric)}` : `Unlimited ${(0, import_pluralize4.default)(entitlement.feature.name)}`,
13876
14168
  entitlement.metricPeriod && ` per ${{
13877
14169
  billing: "billing period",
@@ -13885,7 +14177,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13885
14177
  ] }, entitlement.id);
13886
14178
  })
13887
14179
  ] }),
13888
- isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
14180
+ isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13889
14181
  Flex,
13890
14182
  {
13891
14183
  $justifyContent: "center",
@@ -13893,7 +14185,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13893
14185
  $gap: "0.25rem",
13894
14186
  $padding: "0.625rem 0",
13895
14187
  children: [
13896
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14188
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13897
14189
  Icon2,
13898
14190
  {
13899
14191
  name: "check-rounded",
@@ -13904,7 +14196,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13904
14196
  }
13905
14197
  }
13906
14198
  ),
13907
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14199
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13908
14200
  Text,
13909
14201
  {
13910
14202
  $size: 15,
@@ -13915,7 +14207,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13915
14207
  )
13916
14208
  ]
13917
14209
  }
13918
- ) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14210
+ ) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13919
14211
  EmbedButton,
13920
14212
  {
13921
14213
  disabled: !plan.valid,
@@ -13933,11 +14225,11 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13933
14225
  $color: props.downgrade.buttonStyle,
13934
14226
  $variant: "outline"
13935
14227
  },
13936
- children: !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14228
+ children: !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13937
14229
  Tooltip,
13938
14230
  {
13939
- label: "Over usage limit",
13940
- description: "Current usage exceeds the limit of this plan."
14231
+ trigger: "Over usage limit",
14232
+ content: "Current usage exceeds the limit of this plan."
13941
14233
  }
13942
14234
  ) : "Choose plan"
13943
14235
  }
@@ -13953,26 +14245,26 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13953
14245
  }
13954
14246
  )
13955
14247
  ] }),
13956
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
13957
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14248
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
14249
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13958
14250
  Flex,
13959
14251
  {
13960
14252
  $justifyContent: "space-between",
13961
14253
  $alignItems: "center",
13962
- $marginBottom: "2rem",
13963
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14254
+ $marginBottom: "1rem",
14255
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13964
14256
  Text,
13965
14257
  {
13966
14258
  $font: theme.typography[props.header.fontStyle].fontFamily,
13967
14259
  $size: theme.typography[props.header.fontStyle].fontSize,
13968
14260
  $weight: theme.typography[props.header.fontStyle].fontWeight,
13969
- $color: theme.typography[props.header.fontStyle].color,
14261
+ $color: theme.card.background,
13970
14262
  children: "Add-ons"
13971
14263
  }
13972
14264
  )
13973
14265
  }
13974
14266
  ),
13975
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14267
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13976
14268
  Box,
13977
14269
  {
13978
14270
  $display: "grid",
@@ -13980,7 +14272,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13980
14272
  $gap: "1rem",
13981
14273
  children: addOns.map((addOn, index) => {
13982
14274
  const isActiveAddOn = addOn.current && selectedPeriod === data.company?.addOns.find((a2) => a2.id === addOn.id)?.planPeriod;
13983
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
14275
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13984
14276
  Flex,
13985
14277
  {
13986
14278
  $position: "relative",
@@ -13994,8 +14286,8 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13994
14286
  $outlineColor: isActiveAddOn ? theme.primary : "transparent",
13995
14287
  ...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
13996
14288
  children: [
13997
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
13998
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14289
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
14290
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13999
14291
  Text,
14000
14292
  {
14001
14293
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -14005,7 +14297,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14005
14297
  children: addOn.name
14006
14298
  }
14007
14299
  ) }),
14008
- props.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14300
+ props.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14009
14301
  Text,
14010
14302
  {
14011
14303
  $font: theme.typography[props.plans.description.fontStyle].fontFamily,
@@ -14015,8 +14307,8 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14015
14307
  children: addOn.description
14016
14308
  }
14017
14309
  ) }),
14018
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Box, { children: [
14019
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14310
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Box, { children: [
14311
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14020
14312
  Text,
14021
14313
  {
14022
14314
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -14028,7 +14320,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14028
14320
  )
14029
14321
  }
14030
14322
  ),
14031
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
14323
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
14032
14324
  Text,
14033
14325
  {
14034
14326
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -14042,13 +14334,13 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14042
14334
  }
14043
14335
  )
14044
14336
  ] }),
14045
- isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14337
+ isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14046
14338
  Flex,
14047
14339
  {
14048
14340
  $position: "absolute",
14049
14341
  $right: "1rem",
14050
14342
  $top: "1rem",
14051
- $fontSize: "0.625rem",
14343
+ $fontSize: "0.75rem",
14052
14344
  $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
14053
14345
  $backgroundColor: theme.primary,
14054
14346
  $borderRadius: "9999px",
@@ -14057,7 +14349,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14057
14349
  }
14058
14350
  )
14059
14351
  ] }),
14060
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
14352
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
14061
14353
  Flex,
14062
14354
  {
14063
14355
  $flexDirection: "column",
@@ -14065,23 +14357,23 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14065
14357
  $gap: `${cardPadding}rem`,
14066
14358
  $flexGrow: "1",
14067
14359
  children: [
14068
- props.addOns.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14360
+ props.addOns.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14069
14361
  Flex,
14070
14362
  {
14071
14363
  $flexDirection: "column",
14072
14364
  $position: "relative",
14073
- $gap: "0.5rem",
14365
+ $gap: "1rem",
14074
14366
  $flexGrow: "1",
14075
14367
  children: addOn.entitlements.map((entitlement) => {
14076
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14368
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14077
14369
  Flex,
14078
14370
  {
14079
14371
  $flexWrap: "wrap",
14080
14372
  $justifyContent: "space-between",
14081
14373
  $alignItems: "center",
14082
14374
  $gap: "1rem",
14083
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $gap: "1rem", children: [
14084
- props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14375
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $gap: "1rem", children: [
14376
+ props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14085
14377
  IconRound,
14086
14378
  {
14087
14379
  name: entitlement.feature.icon,
@@ -14092,14 +14384,14 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14092
14384
  ]
14093
14385
  }
14094
14386
  ),
14095
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14387
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14096
14388
  Text,
14097
14389
  {
14098
14390
  $font: theme.typography.text.fontFamily,
14099
14391
  $size: theme.typography.text.fontSize,
14100
14392
  $weight: theme.typography.text.fontWeight,
14101
14393
  $color: theme.typography.text.color,
14102
- children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
14394
+ children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
14103
14395
  typeof entitlement.valueNumeric === "number" ? `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize4.default)(entitlement.feature.name, entitlement.valueNumeric)}` : `Unlimited ${(0, import_pluralize4.default)(entitlement.feature.name)}`,
14104
14396
  entitlement.metricPeriod && ` per ${{
14105
14397
  billing: "billing period",
@@ -14117,7 +14409,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14117
14409
  })
14118
14410
  }
14119
14411
  ),
14120
- props.upgrade.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14412
+ props.upgrade.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14121
14413
  EmbedButton,
14122
14414
  {
14123
14415
  disabled: !addOn.valid,
@@ -14142,8 +14434,8 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14142
14434
  }
14143
14435
  )
14144
14436
  ] }) }),
14145
- canChangePlan && layout === "checkout" && (0, import_react_dom3.createPortal)(
14146
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14437
+ canChangePlan && layout === "checkout" && (0, import_react_dom4.createPortal)(
14438
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14147
14439
  CheckoutDialog,
14148
14440
  {
14149
14441
  initialPeriod: selectedPeriod,
@@ -14160,8 +14452,8 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14160
14452
  PricingTable.displayName = "PricingTable";
14161
14453
 
14162
14454
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
14163
- var import_react24 = require("react");
14164
- var import_jsx_runtime31 = require("react/jsx-runtime");
14455
+ var import_react26 = require("react");
14456
+ var import_jsx_runtime30 = require("react/jsx-runtime");
14165
14457
  function resolveDesignProps7(props) {
14166
14458
  return {
14167
14459
  header: {
@@ -14180,11 +14472,11 @@ function resolveDesignProps7(props) {
14180
14472
  }
14181
14473
  };
14182
14474
  }
14183
- var UpcomingBill = (0, import_react24.forwardRef)(({ className, ...rest }, ref) => {
14475
+ var UpcomingBill = (0, import_react26.forwardRef)(({ className, ...rest }, ref) => {
14184
14476
  const props = resolveDesignProps7(rest);
14185
14477
  const theme = nt();
14186
14478
  const { data } = useEmbed();
14187
- const { upcomingInvoice } = (0, import_react24.useMemo)(() => {
14479
+ const { upcomingInvoice } = (0, import_react26.useMemo)(() => {
14188
14480
  return {
14189
14481
  upcomingInvoice: {
14190
14482
  ...typeof data.upcomingInvoice?.amountDue === "number" && {
@@ -14202,14 +14494,14 @@ var UpcomingBill = (0, import_react24.forwardRef)(({ className, ...rest }, ref)
14202
14494
  if (typeof upcomingInvoice.amountDue !== "number" || !upcomingInvoice.dueDate) {
14203
14495
  return null;
14204
14496
  }
14205
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Element, { ref, className, children: [
14206
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
14497
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Element, { ref, className, children: [
14498
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14207
14499
  Flex,
14208
14500
  {
14209
14501
  $justifyContent: "space-between",
14210
14502
  $alignItems: "center",
14211
14503
  $margin: "0 0 1rem",
14212
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
14504
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
14213
14505
  Text,
14214
14506
  {
14215
14507
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -14225,8 +14517,8 @@ var UpcomingBill = (0, import_react24.forwardRef)(({ className, ...rest }, ref)
14225
14517
  )
14226
14518
  }
14227
14519
  ),
14228
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
14229
- props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
14520
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
14521
+ props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14230
14522
  Text,
14231
14523
  {
14232
14524
  $font: theme.typography[props.price.fontStyle].fontFamily,
@@ -14237,7 +14529,7 @@ var UpcomingBill = (0, import_react24.forwardRef)(({ className, ...rest }, ref)
14237
14529
  children: formatCurrency(upcomingInvoice.amountDue)
14238
14530
  }
14239
14531
  ) }),
14240
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
14532
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
14241
14533
  Text,
14242
14534
  {
14243
14535
  $font: theme.typography[props.contractEndDate.fontStyle].fontFamily,
@@ -14254,10 +14546,10 @@ var UpcomingBill = (0, import_react24.forwardRef)(({ className, ...rest }, ref)
14254
14546
  UpcomingBill.displayName = "UpcomingBill";
14255
14547
 
14256
14548
  // src/components/embed/ComponentTree.tsx
14257
- var import_react26 = require("react");
14549
+ var import_react28 = require("react");
14258
14550
 
14259
14551
  // src/components/embed/renderer.ts
14260
- var import_react25 = require("react");
14552
+ var import_react27 = require("react");
14261
14553
  var components = {
14262
14554
  Root,
14263
14555
  Viewport,
@@ -14289,7 +14581,7 @@ function createRenderer(options) {
14289
14581
  const { className, ...rest } = props;
14290
14582
  const resolvedProps = component === "div" ? rest : props;
14291
14583
  const resolvedChildren = children.map(renderNode);
14292
- return (0, import_react25.createElement)(
14584
+ return (0, import_react27.createElement)(
14293
14585
  component,
14294
14586
  {
14295
14587
  key: index,
@@ -14302,10 +14594,10 @@ function createRenderer(options) {
14302
14594
  }
14303
14595
 
14304
14596
  // src/components/embed/ComponentTree.tsx
14305
- var import_jsx_runtime32 = require("react/jsx-runtime");
14597
+ var import_jsx_runtime31 = require("react/jsx-runtime");
14306
14598
  var Loading = () => {
14307
14599
  const theme = nt();
14308
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
14600
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
14309
14601
  Flex,
14310
14602
  {
14311
14603
  $width: "100%",
@@ -14313,13 +14605,13 @@ var Loading = () => {
14313
14605
  $alignItems: "center",
14314
14606
  $justifyContent: "center",
14315
14607
  $padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
14316
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Loader, { $size: "2xl", $color: "#194BFB" })
14608
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Loader, { $size: "2xl", $color: "#194BFB" })
14317
14609
  }
14318
14610
  );
14319
14611
  };
14320
14612
  var Error2 = ({ message }) => {
14321
14613
  const theme = nt();
14322
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
14614
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
14323
14615
  Flex,
14324
14616
  {
14325
14617
  $flexDirection: "column",
@@ -14330,7 +14622,7 @@ var Error2 = ({ message }) => {
14330
14622
  $alignItems: "center",
14331
14623
  $justifyContent: "center",
14332
14624
  children: [
14333
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
14625
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
14334
14626
  Box,
14335
14627
  {
14336
14628
  $marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
@@ -14341,7 +14633,7 @@ var Error2 = ({ message }) => {
14341
14633
  children: "404 Error"
14342
14634
  }
14343
14635
  ),
14344
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
14636
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
14345
14637
  Box,
14346
14638
  {
14347
14639
  $marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
@@ -14358,31 +14650,31 @@ var Error2 = ({ message }) => {
14358
14650
  };
14359
14651
  var ComponentTree = () => {
14360
14652
  const { error, nodes } = useEmbed();
14361
- const [children, setChildren] = (0, import_react26.useState)(/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Loading, {}));
14362
- (0, import_react26.useEffect)(() => {
14653
+ const [children, setChildren] = (0, import_react28.useState)(/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Loading, {}));
14654
+ (0, import_react28.useEffect)(() => {
14363
14655
  const renderer = createRenderer();
14364
14656
  setChildren(nodes.map(renderer));
14365
14657
  }, [nodes]);
14366
14658
  if (error) {
14367
14659
  console.error(error);
14368
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Error2, { message: error.message });
14660
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Error2, { message: error.message });
14369
14661
  }
14370
- if (import_react26.Children.count(children) === 0) {
14371
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Loading, {});
14662
+ if (import_react28.Children.count(children) === 0) {
14663
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Loading, {});
14372
14664
  }
14373
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children });
14665
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
14374
14666
  };
14375
14667
 
14376
14668
  // src/components/embed/Embed.tsx
14377
- var import_jsx_runtime33 = require("react/jsx-runtime");
14669
+ var import_jsx_runtime32 = require("react/jsx-runtime");
14378
14670
  var SchematicEmbed = ({ id, accessToken, apiConfig }) => {
14379
14671
  if (accessToken?.length === 0) {
14380
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: "Please provide an access token." });
14672
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: "Please provide an access token." });
14381
14673
  }
14382
14674
  if (!accessToken?.startsWith("token_")) {
14383
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
14675
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
14384
14676
  }
14385
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ComponentTree, {}) });
14677
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ComponentTree, {}) });
14386
14678
  };
14387
14679
  /*! Bundled license information:
14388
14680