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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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_react15 = require("react");
2101
2101
 
2102
2102
  // node_modules/styled-components/node_modules/tslib/tslib.es6.mjs
2103
2103
  var __assign = function() {
@@ -8341,6 +8341,7 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8341
8341
  addOns: json["add_ons"].map(
8342
8342
  CompanyPlanWithBillingSubViewFromJSON
8343
8343
  ),
8344
+ billingSubscription: json["billing_subscription"] == null ? void 0 : BillingSubscriptionViewFromJSON(json["billing_subscription"]),
8344
8345
  billingSubscriptions: json["billing_subscriptions"].map(
8345
8346
  BillingSubscriptionViewFromJSON
8346
8347
  ),
@@ -9675,13 +9676,10 @@ var EmbedProvider = ({
9675
9676
  }, [id, state.api]);
9676
9677
  const setData = (0, import_react3.useCallback)(
9677
9678
  (data) => {
9678
- setState((prev2) => {
9679
- const updatedData = (0, import_merge.default)({}, prev2.data, { ...data });
9680
- return {
9681
- ...prev2,
9682
- data: updatedData
9683
- };
9684
- });
9679
+ setState((prev2) => ({
9680
+ ...prev2,
9681
+ data
9682
+ }));
9685
9683
  },
9686
9684
  [setState]
9687
9685
  );
@@ -9720,7 +9718,7 @@ var EmbedProvider = ({
9720
9718
  (0, import_react3.useEffect)(() => {
9721
9719
  if (accessToken) {
9722
9720
  const { headers = {} } = apiConfig ?? {};
9723
- headers["X-Schematic-Components-Version"] = "0.4.0-rc.2";
9721
+ headers["X-Schematic-Components-Version"] = "0.4.0-rc.3";
9724
9722
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
9725
9723
  const config = new Configuration({
9726
9724
  ...apiConfig,
@@ -10001,22 +9999,39 @@ var Root = (0, import_react7.forwardRef)(
10001
9999
  Root.displayName = "Root";
10002
10000
 
10003
10001
  // src/components/layout/viewport/Viewport.tsx
10004
- var import_react11 = require("react");
10002
+ var import_react12 = require("react");
10005
10003
 
10006
10004
  // src/components/ui/box/styles.ts
10007
10005
  var Box = dt.div((props) => {
10008
- const initialStyles = [];
10009
- return Object.entries(props).reduce((acc, [key, value]) => {
10010
- if (key.startsWith("$")) {
10006
+ function reducer(acc, [key, value]) {
10007
+ if (key.startsWith("$") && key !== "$viewport") {
10011
10008
  acc.push(
10012
10009
  // keys will always be CSS properties
10013
10010
  attr(camelToHyphen(key.slice(1)), value)
10014
10011
  );
10015
10012
  }
10016
10013
  return acc;
10017
- }, initialStyles);
10014
+ }
10015
+ const styles = Object.entries(props).reduce(reducer, []);
10016
+ for (const [key, value] of Object.entries(props.$viewport || {})) {
10017
+ styles.push(lt`
10018
+ ${{
10019
+ sm: "@media (min-width: 640px)",
10020
+ md: "@media (min-width: 768px)",
10021
+ lg: "@media (min-width: 1024px)",
10022
+ xl: "@media (min-width: 1280px)",
10023
+ "2xl": "@media (min-width: 1536px)"
10024
+ }[key] || key} {
10025
+ ${Object.entries(value || {}).reduce(reducer, [])}
10026
+ }
10027
+ `);
10028
+ }
10029
+ return styles;
10018
10030
  });
10019
10031
 
10032
+ // src/components/ui/button/Button.tsx
10033
+ var import_react8 = require("react");
10034
+
10020
10035
  // src/components/ui/button/styles.ts
10021
10036
  var Button = dt.button`
10022
10037
  appearance: none;
@@ -10102,30 +10117,33 @@ var Button = dt.button`
10102
10117
 
10103
10118
  // src/components/ui/button/Button.tsx
10104
10119
  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
- };
10120
+ var Button2 = (0, import_react8.forwardRef)(
10121
+ ({
10122
+ color = "white",
10123
+ size = "md",
10124
+ variant = "solid",
10125
+ disabled = false,
10126
+ isLoading = false,
10127
+ children,
10128
+ ...props
10129
+ }, ref) => {
10130
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
10131
+ Button,
10132
+ {
10133
+ ref,
10134
+ $color: color,
10135
+ $size: size,
10136
+ $variant: variant,
10137
+ disabled,
10138
+ ...props,
10139
+ children: [
10140
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { $size: "sm", $isLoading: isLoading }),
10141
+ children
10142
+ ]
10143
+ }
10144
+ );
10145
+ }
10146
+ );
10129
10147
 
10130
10148
  // src/components/ui/icon/styles.ts
10131
10149
  var Icon = dt.i`
@@ -10406,7 +10424,7 @@ var Loader = dt.div`
10406
10424
  `;
10407
10425
 
10408
10426
  // src/components/ui/modal/Modal.tsx
10409
- var import_react8 = require("react");
10427
+ var import_react9 = require("react");
10410
10428
 
10411
10429
  // src/components/ui/modal/styles.ts
10412
10430
  var Container2 = dt(Box)`
@@ -10429,25 +10447,22 @@ var Container2 = dt(Box)`
10429
10447
  var import_jsx_runtime6 = require("react/jsx-runtime");
10430
10448
  var Modal = ({
10431
10449
  children,
10450
+ contentRef,
10432
10451
  size = "auto",
10433
10452
  top = 0,
10434
- onClose
10453
+ onClose,
10454
+ ...rest
10435
10455
  }) => {
10436
10456
  const theme = nt();
10437
10457
  const { setLayout } = useEmbed();
10438
- const ref = (0, import_react8.useRef)(null);
10439
10458
  const isLightBackground = useIsLightBackground();
10440
- const handleClose = (0, import_react8.useCallback)(() => {
10459
+ const handleClose = (0, import_react9.useCallback)(() => {
10441
10460
  setLayout("portal");
10442
10461
  onClose?.();
10443
10462
  }, [setLayout, onClose]);
10444
- (0, import_react8.useEffect)(() => {
10445
- ref.current?.focus();
10446
- }, []);
10447
10463
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
10448
10464
  Container2,
10449
10465
  {
10450
- ref,
10451
10466
  tabIndex: 0,
10452
10467
  onClick: (event) => {
10453
10468
  if (event.target === event.currentTarget) {
@@ -10459,6 +10474,7 @@ var Modal = ({
10459
10474
  handleClose();
10460
10475
  }
10461
10476
  },
10477
+ ...rest,
10462
10478
  $position: "absolute",
10463
10479
  $top: "50%",
10464
10480
  $left: "50%",
@@ -10475,25 +10491,30 @@ var Modal = ({
10475
10491
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
10476
10492
  Flex,
10477
10493
  {
10494
+ ref: contentRef,
10478
10495
  $position: "relative",
10479
10496
  $top: "50%",
10480
10497
  $left: "50%",
10481
10498
  $transform: "translate(-50%, -50%)",
10482
10499
  $flexDirection: "column",
10483
- $overflow: "hidden",
10484
- ...size === "auto" ? { $width: "fit-content", $height: "fit-content" } : {
10485
- $width: "100%",
10486
- ...size === "lg" ? { $height: "100%" } : { $height: "fit-content" },
10487
- $maxWidth: size === "sm" ? "480px" : size === "md" ? "688px" : "1356px",
10488
- $maxHeight: "860px"
10489
- },
10500
+ $overflow: "auto",
10501
+ $width: "100%",
10502
+ $height: "100vh",
10490
10503
  $backgroundColor: theme.card.background,
10491
- $borderRadius: "0.5rem",
10492
10504
  $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
10493
- id: "select-plan-dialog",
10494
10505
  role: "dialog",
10495
- "aria-labelledby": "select-plan-dialog-label",
10496
10506
  "aria-modal": "true",
10507
+ $viewport: {
10508
+ sm: {
10509
+ ...size === "auto" ? { $width: "fit-content", $height: "fit-content" } : {
10510
+ $width: "100%",
10511
+ ...size === "lg" ? { $height: "100%" } : { $height: "fit-content" },
10512
+ $maxWidth: size === "sm" ? "480px" : size === "md" ? "688px" : "1356px",
10513
+ $maxHeight: "860px"
10514
+ },
10515
+ $borderRadius: "0.5rem"
10516
+ }
10517
+ },
10497
10518
  children
10498
10519
  }
10499
10520
  )
@@ -10502,33 +10523,45 @@ var Modal = ({
10502
10523
  };
10503
10524
 
10504
10525
  // src/components/ui/modal/ModalHeader.tsx
10505
- var import_react9 = require("react");
10526
+ var import_react10 = require("react");
10506
10527
  var import_jsx_runtime7 = require("react/jsx-runtime");
10507
10528
  var ModalHeader = ({
10508
10529
  children,
10509
10530
  bordered = false,
10510
10531
  onClose
10511
10532
  }) => {
10533
+ const theme = nt();
10512
10534
  const { setLayout } = useEmbed();
10513
10535
  const isLightBackground = useIsLightBackground();
10514
- const handleClose = (0, import_react9.useCallback)(() => {
10536
+ const handleClose = (0, import_react10.useCallback)(() => {
10515
10537
  setLayout("portal");
10516
10538
  onClose?.();
10517
10539
  }, [setLayout, onClose]);
10518
10540
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
10519
10541
  Flex,
10520
10542
  {
10543
+ $position: "sticky",
10544
+ $top: 0,
10545
+ $left: 0,
10546
+ $zIndex: 1,
10521
10547
  $justifyContent: children ? "space-between" : "end",
10522
10548
  $alignItems: "center",
10523
- $flexShrink: "0",
10549
+ $flexShrink: 0,
10524
10550
  $gap: "1rem",
10525
- $height: "5rem",
10526
- $padding: "0 1.5rem 0 3rem",
10551
+ $height: "3.5rem",
10552
+ $padding: "0 1rem",
10553
+ $backgroundColor: theme.card.background,
10527
10554
  ...bordered && {
10528
10555
  $borderBottomWidth: "1px",
10529
10556
  $borderBottomStyle: "solid",
10530
10557
  $borderBottomColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)"
10531
10558
  },
10559
+ $viewport: {
10560
+ sm: {
10561
+ $height: "5rem",
10562
+ $padding: "0 1.5rem 0 3rem"
10563
+ }
10564
+ },
10532
10565
  children: [
10533
10566
  children,
10534
10567
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box, { $cursor: "pointer", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
@@ -10662,6 +10695,7 @@ var TooltipWrapper = dt(Box)`
10662
10695
  left: 50%;
10663
10696
  transform: translateX(-50%);
10664
10697
  bottom: 100%;
10698
+ line-height: 1;
10665
10699
  width: max-content;
10666
10700
  max-width: 100%;
10667
10701
  margin-bottom: 0.75rem;
@@ -10700,30 +10734,10 @@ var TooltipWrapper = dt(Box)`
10700
10734
 
10701
10735
  // src/components/ui/tooltip/Tooltip.tsx
10702
10736
  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,
10718
- {
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
10725
- }
10726
- ) })
10737
+ var Tooltip = ({ label, description, ...rest }) => {
10738
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(TooltipWrapper, { ...rest, children: [
10739
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { children: label }),
10740
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { className: "tooltip", children: description })
10727
10741
  ] });
10728
10742
  };
10729
10743
 
@@ -10731,112 +10745,101 @@ var Tooltip = ({ label, description }) => {
10731
10745
  var import_jsx_runtime10 = require("react/jsx-runtime");
10732
10746
  var Badge = () => {
10733
10747
  const { settings } = useEmbed();
10734
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10735
- Flex,
10736
- {
10737
- $padding: "0 0.5rem",
10738
- $width: "100%",
10739
- $flexDirection: "row",
10740
- $alignItems: "center",
10741
- $justifyContent: settings.badge.alignment,
10742
- children: [
10743
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { $marginRight: "0.5rem", $fontSize: "0.75rem", children: "Powered by" }),
10744
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10745
- "svg",
10746
- {
10747
- width: "86",
10748
- height: "16",
10749
- viewBox: "0 0 86 16",
10750
- fill: "none",
10751
- xmlns: "http://www.w3.org/2000/svg",
10752
- children: [
10753
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10754
- "path",
10755
- {
10756
- 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"
10758
- }
10759
- ),
10760
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10761
- "path",
10762
- {
10763
- 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"
10765
- }
10766
- ),
10767
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10768
- "path",
10769
- {
10770
- 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"
10772
- }
10773
- ),
10774
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10775
- "path",
10776
- {
10777
- 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"
10779
- }
10780
- ),
10781
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10782
- "path",
10783
- {
10784
- 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"
10786
- }
10787
- ),
10788
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10789
- "path",
10790
- {
10791
- 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"
10793
- }
10794
- ),
10795
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10796
- "path",
10797
- {
10798
- 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"
10800
- }
10801
- ),
10802
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10803
- "path",
10804
- {
10805
- 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"
10807
- }
10808
- ),
10809
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10810
- "path",
10811
- {
10812
- 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"
10814
- }
10815
- ),
10816
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10817
- "path",
10818
- {
10819
- 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"
10821
- }
10822
- ),
10823
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10824
- "path",
10825
- {
10826
- 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"
10828
- }
10829
- )
10830
- ]
10831
- }
10832
- )
10833
- ]
10834
- }
10835
- );
10748
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { $justifyContent: settings.badge.alignment, $alignItems: "center", children: [
10749
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { $fontSize: "0.75rem", $marginRight: "0.5rem", children: "Powered by" }),
10750
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10751
+ "svg",
10752
+ {
10753
+ width: 86,
10754
+ height: 16,
10755
+ viewBox: "0 0 86 16",
10756
+ style: { marginTop: "0.125rem" },
10757
+ children: [
10758
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10759
+ "path",
10760
+ {
10761
+ 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",
10762
+ fill: "currentColor"
10763
+ }
10764
+ ),
10765
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10766
+ "path",
10767
+ {
10768
+ 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",
10769
+ fill: "currentColor"
10770
+ }
10771
+ ),
10772
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10773
+ "path",
10774
+ {
10775
+ 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",
10776
+ fill: "currentColor"
10777
+ }
10778
+ ),
10779
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10780
+ "path",
10781
+ {
10782
+ 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",
10783
+ fill: "currentColor"
10784
+ }
10785
+ ),
10786
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10787
+ "path",
10788
+ {
10789
+ 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",
10790
+ fill: "currentColor"
10791
+ }
10792
+ ),
10793
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10794
+ "path",
10795
+ {
10796
+ 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",
10797
+ fill: "currentColor"
10798
+ }
10799
+ ),
10800
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10801
+ "path",
10802
+ {
10803
+ 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",
10804
+ fill: "currentColor"
10805
+ }
10806
+ ),
10807
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10808
+ "path",
10809
+ {
10810
+ 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",
10811
+ fill: "currentColor"
10812
+ }
10813
+ ),
10814
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10815
+ "path",
10816
+ {
10817
+ 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",
10818
+ fill: "currentColor"
10819
+ }
10820
+ ),
10821
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10822
+ "path",
10823
+ {
10824
+ 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",
10825
+ fill: "currentColor"
10826
+ }
10827
+ ),
10828
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10829
+ "path",
10830
+ {
10831
+ 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",
10832
+ fill: "currentColor"
10833
+ }
10834
+ )
10835
+ ]
10836
+ }
10837
+ )
10838
+ ] });
10836
10839
  };
10837
10840
 
10838
10841
  // src/components/layout/RenderLayout.tsx
10839
- var import_react10 = require("react");
10842
+ var import_react11 = require("react");
10840
10843
  var import_jsx_runtime11 = require("react/jsx-runtime");
10841
10844
  var Disabled = () => {
10842
10845
  const theme = nt();
@@ -10878,14 +10881,14 @@ var Disabled = () => {
10878
10881
  var Success = () => {
10879
10882
  const theme = nt();
10880
10883
  const { hydrate, data, api, setLayout, isPending } = useEmbed();
10881
- const [isOpen, setIsOpen] = (0, import_react10.useState)(true);
10882
- (0, import_react10.useEffect)(() => {
10884
+ const [isOpen, setIsOpen] = (0, import_react11.useState)(true);
10885
+ (0, import_react11.useEffect)(() => {
10883
10886
  if (api && data.component?.id) {
10884
10887
  hydrate();
10885
10888
  setTimeout(() => setIsOpen(false), 2e3);
10886
10889
  }
10887
10890
  }, [api, data.component?.id, hydrate]);
10888
- (0, import_react10.useEffect)(() => {
10891
+ (0, import_react11.useEffect)(() => {
10889
10892
  if (!isPending && !isOpen) {
10890
10893
  setLayout("portal");
10891
10894
  }
@@ -10946,18 +10949,17 @@ var RenderLayout = ({ children }) => {
10946
10949
  };
10947
10950
 
10948
10951
  // src/components/layout/viewport/styles.ts
10949
- var StyledViewport = dt.div`
10950
- display: flex;
10952
+ var StyledViewport = dt(Flex)`
10951
10953
  flex-wrap: wrap;
10952
10954
  place-content: start;
10953
10955
  margin-left: auto;
10954
10956
  margin-right: auto;
10955
- gap: 1rem;
10957
+ gap: 2rem;
10956
10958
  `;
10957
10959
 
10958
10960
  // src/components/layout/viewport/Viewport.tsx
10959
10961
  var import_jsx_runtime12 = require("react/jsx-runtime");
10960
- var Viewport = (0, import_react11.forwardRef)(
10962
+ var Viewport = (0, import_react12.forwardRef)(
10961
10963
  ({ children, ...props }, ref) => {
10962
10964
  const theme = nt();
10963
10965
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
@@ -10977,10 +10979,10 @@ var Viewport = (0, import_react11.forwardRef)(
10977
10979
  Viewport.displayName = "Viewport";
10978
10980
 
10979
10981
  // src/components/layout/column/Column.tsx
10980
- var import_react13 = require("react");
10982
+ var import_react14 = require("react");
10981
10983
 
10982
10984
  // src/components/layout/card/Card.tsx
10983
- var import_react12 = require("react");
10985
+ var import_react13 = require("react");
10984
10986
 
10985
10987
  // src/components/layout/card/styles.ts
10986
10988
  var Element = dt(Box)``;
@@ -11024,7 +11026,7 @@ var StyledCard = dt.div(({ theme }) => {
11024
11026
 
11025
11027
  // src/components/layout/card/Card.tsx
11026
11028
  var import_jsx_runtime13 = require("react/jsx-runtime");
11027
- var Card = (0, import_react12.forwardRef)(
11029
+ var Card = (0, import_react13.forwardRef)(
11028
11030
  ({ children, className }, ref) => {
11029
11031
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StyledCard, { ref, className, children });
11030
11032
  }
@@ -11040,7 +11042,7 @@ var StyledColumn = dt.div`
11040
11042
 
11041
11043
  // src/components/layout/column/Column.tsx
11042
11044
  var import_jsx_runtime14 = require("react/jsx-runtime");
11043
- var Column = (0, import_react13.forwardRef)(
11045
+ var Column = (0, import_react14.forwardRef)(
11044
11046
  ({ children, basis, ...props }, ref) => {
11045
11047
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StyledColumn, { ref, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Card, { children }) });
11046
11048
  }
@@ -11073,11 +11075,11 @@ function resolveDesignProps(props) {
11073
11075
  visibleFeatures: props.visibleFeatures
11074
11076
  };
11075
11077
  }
11076
- var IncludedFeatures = (0, import_react14.forwardRef)(({ className, ...rest }, ref) => {
11078
+ var IncludedFeatures = (0, import_react15.forwardRef)(({ className, ...rest }, ref) => {
11077
11079
  const props = resolveDesignProps(rest);
11078
11080
  const theme = nt();
11079
11081
  const { data } = useEmbed();
11080
- const elements = (0, import_react14.useRef)([]);
11082
+ const elements = (0, import_react15.useRef)([]);
11081
11083
  const shouldWrapChildren = useWrapChildren(elements.current);
11082
11084
  const isLightBackground = useIsLightBackground();
11083
11085
  const featureUsage = props.visibleFeatures ? props.visibleFeatures.reduce((acc, id) => {
@@ -11100,9 +11102,9 @@ var IncludedFeatures = (0, import_react14.forwardRef)(({ className, ...rest }, r
11100
11102
  ref,
11101
11103
  className,
11102
11104
  $flexDirection: "column",
11103
- $gap: "1.5rem",
11105
+ $gap: "1rem",
11104
11106
  children: [
11105
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11107
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11106
11108
  Text,
11107
11109
  {
11108
11110
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -11152,7 +11154,7 @@ var IncludedFeatures = (0, import_react14.forwardRef)(({ className, ...rest }, r
11152
11154
  $flexGrow: "1",
11153
11155
  $textAlign: shouldWrapChildren ? "left" : "right",
11154
11156
  children: [
11155
- props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11157
+ props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11156
11158
  Text,
11157
11159
  {
11158
11160
  $font: theme.typography[props.entitlement.fontStyle].fontFamily,
@@ -11189,7 +11191,7 @@ var IncludedFeatures = (0, import_react14.forwardRef)(({ className, ...rest }, r
11189
11191
  IncludedFeatures.displayName = "IncludedFeatures";
11190
11192
 
11191
11193
  // src/components/elements/invoices/Invoices.tsx
11192
- var import_react15 = require("react");
11194
+ var import_react16 = require("react");
11193
11195
  var import_jsx_runtime16 = require("react/jsx-runtime");
11194
11196
  function resolveDesignProps2(props) {
11195
11197
  return {
@@ -11243,18 +11245,18 @@ var InvoiceDate = ({ date, fontStyle, url }) => {
11243
11245
  }
11244
11246
  return dateText;
11245
11247
  };
11246
- var Invoices = (0, import_react15.forwardRef)(({ className, data, ...rest }, ref) => {
11248
+ var Invoices = (0, import_react16.forwardRef)(({ className, data, ...rest }, ref) => {
11247
11249
  const props = resolveDesignProps2(rest);
11248
11250
  const theme = nt();
11249
11251
  const { api } = useEmbed();
11250
- const [invoices, setInvoices] = (0, import_react15.useState)(() => formatInvoices(data));
11251
- const [listSize, setListSize] = (0, import_react15.useState)(props.limit.number);
11252
+ const [invoices, setInvoices] = (0, import_react16.useState)(() => formatInvoices(data));
11253
+ const [listSize, setListSize] = (0, import_react16.useState)(props.limit.number);
11252
11254
  const toggleListSize = () => {
11253
11255
  setListSize(
11254
11256
  (prev2) => prev2 !== props.limit.number ? props.limit.number : 12
11255
11257
  );
11256
11258
  };
11257
- (0, import_react15.useEffect)(() => {
11259
+ (0, import_react16.useEffect)(() => {
11258
11260
  api?.listInvoices().then(({ data: data2 }) => {
11259
11261
  setInvoices(formatInvoices(data2));
11260
11262
  });
@@ -11320,7 +11322,7 @@ var Invoices = (0, import_react15.forwardRef)(({ className, data, ...rest }, ref
11320
11322
  Invoices.displayName = "Invoices";
11321
11323
 
11322
11324
  // src/components/elements/metered-features/MeteredFeatures.tsx
11323
- var import_react16 = require("react");
11325
+ var import_react17 = require("react");
11324
11326
  var import_pluralize2 = __toESM(require_pluralize());
11325
11327
 
11326
11328
  // src/components/elements/metered-features/styles.ts
@@ -11367,9 +11369,9 @@ function resolveDesignProps3(props) {
11367
11369
  visibleFeatures: props.visibleFeatures
11368
11370
  };
11369
11371
  }
11370
- var MeteredFeatures = (0, import_react16.forwardRef)(({ className, ...rest }, ref) => {
11372
+ var MeteredFeatures = (0, import_react17.forwardRef)(({ className, ...rest }, ref) => {
11371
11373
  const props = resolveDesignProps3(rest);
11372
- const elements = (0, import_react16.useRef)([]);
11374
+ const elements = (0, import_react17.useRef)([]);
11373
11375
  const shouldWrapChildren = useWrapChildren(elements.current);
11374
11376
  const theme = nt();
11375
11377
  const { data } = useEmbed();
@@ -11491,7 +11493,7 @@ var MeteredFeatures = (0, import_react16.forwardRef)(({ className, ...rest }, re
11491
11493
  MeteredFeatures.displayName = "MeteredFeatures";
11492
11494
 
11493
11495
  // src/components/elements/payment-method/PaymentMethod.tsx
11494
- var import_react21 = require("react");
11496
+ var import_react22 = require("react");
11495
11497
  var import_react_dom = require("react-dom");
11496
11498
 
11497
11499
  // node_modules/@stripe/stripe-js/dist/index.mjs
@@ -11526,7 +11528,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
11526
11528
  }
11527
11529
  stripe._registerWrapper({
11528
11530
  name: "stripe-js",
11529
- version: "4.6.0",
11531
+ version: "5.1.0",
11530
11532
  startTime
11531
11533
  });
11532
11534
  };
@@ -11632,7 +11634,7 @@ var loadStripe = function loadStripe2() {
11632
11634
  var import_react_stripe_js3 = require("@stripe/react-stripe-js");
11633
11635
 
11634
11636
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
11635
- var import_react18 = require("react");
11637
+ var import_react19 = require("react");
11636
11638
 
11637
11639
  // src/components/shared/checkout-dialog/Navigation.tsx
11638
11640
  var import_jsx_runtime18 = require("react/jsx-runtime");
@@ -11645,49 +11647,74 @@ var Navigation = ({
11645
11647
  }) => {
11646
11648
  const theme = nt();
11647
11649
  const isLightBackground = useIsLightBackground();
11650
+ const showFullContent = index === activeIndex || index === activeIndex + 1;
11648
11651
  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,
11652
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11653
+ Flex,
11654
+ {
11655
+ $gap: "0.5rem",
11656
+ $alignItems: "center",
11657
+ ...!showFullContent && { $flex: 1, $minWidth: 0 },
11658
+ children: [
11659
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11660
+ Box,
11686
11661
  {
11687
- $font: theme.typography.text.fontFamily,
11688
- $size: 19,
11689
- $weight: index === activeIndex ? 600 : 400,
11662
+ $display: "none",
11663
+ $viewport: {
11664
+ sm: {
11665
+ $display: "block"
11666
+ }
11667
+ },
11668
+ children: index >= activeIndex ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11669
+ Box,
11670
+ {
11671
+ $width: `${20 / TEXT_BASE_SIZE}rem`,
11672
+ $height: `${20 / TEXT_BASE_SIZE}rem`,
11673
+ $borderWidth: "2px",
11674
+ $borderStyle: "solid",
11675
+ $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)",
11676
+ $borderRadius: "9999px"
11677
+ }
11678
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11679
+ IconRound,
11680
+ {
11681
+ name: "check",
11682
+ colors: [
11683
+ theme.card.background,
11684
+ isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)"
11685
+ ],
11686
+ style: {
11687
+ fontSize: `${16 / TEXT_BASE_SIZE}rem`,
11688
+ width: `${20 / TEXT_BASE_SIZE}rem`,
11689
+ height: `${20 / TEXT_BASE_SIZE}rem`
11690
+ }
11691
+ }
11692
+ )
11693
+ }
11694
+ ),
11695
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11696
+ Box,
11697
+ {
11698
+ tabIndex: 0,
11699
+ $fontSize: `${16 / TEXT_BASE_SIZE}rem`,
11700
+ $fontFamily: theme.typography.text.fontFamily,
11701
+ $fontWeight: index === activeIndex ? 600 : 400,
11690
11702
  $color: theme.typography.text.color,
11703
+ ...!showFullContent && {
11704
+ $overflow: "hidden",
11705
+ $whiteSpace: "nowrap",
11706
+ $textOverflow: "ellipsis"
11707
+ },
11708
+ ...index !== activeIndex && { $opacity: "0.6375" },
11709
+ ...index < activeIndex && {
11710
+ onClick,
11711
+ $cursor: "pointer"
11712
+ },
11713
+ $viewport: {
11714
+ sm: {
11715
+ $fontSize: `${19 / TEXT_BASE_SIZE}rem`
11716
+ }
11717
+ },
11691
11718
  children: [
11692
11719
  index + 1,
11693
11720
  ". ",
@@ -11695,9 +11722,9 @@ var Navigation = ({
11695
11722
  ]
11696
11723
  }
11697
11724
  )
11698
- }
11699
- )
11700
- ] }),
11725
+ ]
11726
+ }
11727
+ ),
11701
11728
  !isLast && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11702
11729
  Icon2,
11703
11730
  {
@@ -11712,11 +11739,12 @@ var Navigation = ({
11712
11739
  };
11713
11740
 
11714
11741
  // src/components/shared/checkout-dialog/Sidebar.tsx
11715
- var import_react17 = require("react");
11742
+ var import_react18 = require("react");
11716
11743
  var import_jsx_runtime19 = require("react/jsx-runtime");
11717
11744
  var Sidebar = ({
11718
11745
  addOns,
11719
11746
  charges,
11747
+ checkoutRef,
11720
11748
  checkoutStage,
11721
11749
  currentAddOns,
11722
11750
  currentPlan,
@@ -11725,10 +11753,8 @@ var Sidebar = ({
11725
11753
  paymentMethodId,
11726
11754
  planPeriod,
11727
11755
  selectedPlan,
11728
- selectPlan,
11729
11756
  setCheckoutStage,
11730
11757
  setError,
11731
- setPlanPeriod,
11732
11758
  setSetupIntent,
11733
11759
  showPaymentForm,
11734
11760
  toggleLoading
@@ -11736,20 +11762,7 @@ var Sidebar = ({
11736
11762
  const theme = nt();
11737
11763
  const { api, data, mode, setLayout } = useEmbed();
11738
11764
  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)(() => {
11765
+ const subscriptionPrice = (0, import_react18.useMemo)(() => {
11753
11766
  if (!selectedPlan || !selectedPlan.monthlyPrice || !selectedPlan.yearlyPrice) {
11754
11767
  return;
11755
11768
  }
@@ -11757,7 +11770,7 @@ var Sidebar = ({
11757
11770
  (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price
11758
11771
  );
11759
11772
  }, [selectedPlan, planPeriod]);
11760
- const checkout = (0, import_react17.useCallback)(async () => {
11773
+ const checkout = (0, import_react18.useCallback)(async () => {
11761
11774
  const priceId = (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.id;
11762
11775
  if (!api || !selectedPlan || !priceId) {
11763
11776
  return;
@@ -11802,15 +11815,6 @@ var Sidebar = ({
11802
11815
  setLayout,
11803
11816
  toggleLoading
11804
11817
  ]);
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
11818
  const shortPeriod = (p2) => p2 === "month" ? "mo" : "yr";
11815
11819
  const selectedAddOns = addOns.filter((addOn) => addOn.isSelected);
11816
11820
  const willPlanChange = selectedPlan && (selectedPlan.id !== currentPlan?.id || planPeriod !== currentPlan.planPeriod);
@@ -11818,7 +11822,7 @@ var Sidebar = ({
11818
11822
  selectedAddOns.length !== currentAddOns.length || !selectedAddOns.every(
11819
11823
  (addOn) => currentAddOns.some((currentAddOn) => addOn.id === currentAddOn.id)
11820
11824
  )) && !isLoading;
11821
- const canCheckout = canUpdateSubscription && (paymentMethod && !showPaymentForm || paymentMethodId);
11825
+ const canCheckout = canUpdateSubscription && (data.subscription?.paymentMethod && !showPaymentForm || paymentMethodId);
11822
11826
  const removedAddOns = currentAddOns.filter(
11823
11827
  (current) => !selectedAddOns.some((selected) => current.id === selected.id)
11824
11828
  );
@@ -11829,14 +11833,20 @@ var Sidebar = ({
11829
11833
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11830
11834
  Flex,
11831
11835
  {
11836
+ ref: checkoutRef,
11837
+ tabIndex: 0,
11832
11838
  $flexDirection: "column",
11833
- $width: "21.5rem",
11834
11839
  $overflow: "auto",
11835
11840
  $backgroundColor: theme.card.background,
11836
11841
  $borderRadius: "0 0 0.5rem",
11837
11842
  $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
11843
+ $viewport: {
11844
+ sm: {
11845
+ $width: "21.5rem"
11846
+ }
11847
+ },
11838
11848
  children: [
11839
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11849
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11840
11850
  Flex,
11841
11851
  {
11842
11852
  $position: "relative",
@@ -11847,28 +11857,17 @@ var Sidebar = ({
11847
11857
  $borderBottomWidth: "1px",
11848
11858
  $borderStyle: "solid",
11849
11859
  $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
- ]
11860
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Flex, { $justifyContent: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11861
+ Text,
11862
+ {
11863
+ as: "h3",
11864
+ $font: theme.typography.heading3.fontFamily,
11865
+ $size: theme.typography.heading3.fontSize,
11866
+ $weight: theme.typography.heading3.fontWeight,
11867
+ $color: theme.typography.heading3.color,
11868
+ children: "Subscription"
11869
+ }
11870
+ ) })
11872
11871
  }
11873
11872
  ),
11874
11873
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
@@ -11876,7 +11875,7 @@ var Sidebar = ({
11876
11875
  {
11877
11876
  $flexDirection: "column",
11878
11877
  $position: "relative",
11879
- $gap: "0.5rem",
11878
+ $gap: "0.125rem",
11880
11879
  $width: "100%",
11881
11880
  $padding: "1.5rem",
11882
11881
  $flex: "1",
@@ -11948,7 +11947,8 @@ var Sidebar = ({
11948
11947
  {
11949
11948
  name: "arrow-down",
11950
11949
  style: {
11951
- display: "inline-block"
11950
+ display: "inline-block",
11951
+ color: theme.typography.text.color
11952
11952
  }
11953
11953
  }
11954
11954
  )
@@ -12210,7 +12210,13 @@ var Sidebar = ({
12210
12210
  EmbedButton,
12211
12211
  {
12212
12212
  disabled: !addOns.length && !canUpdateSubscription,
12213
- onClick: () => {
12213
+ onClick: async () => {
12214
+ if (!addOns.length && api && data.component?.id) {
12215
+ const { data: setupIntent } = await api.getSetupIntent({
12216
+ componentId: data.component.id
12217
+ });
12218
+ setSetupIntent(setupIntent);
12219
+ }
12214
12220
  setCheckoutStage(addOns.length ? "addons" : "checkout");
12215
12221
  },
12216
12222
  isLoading,
@@ -12370,217 +12376,193 @@ var Plan = ({
12370
12376
  const isLightBackground = useIsLightBackground();
12371
12377
  const cardPadding = theme.card.padding / TEXT_BASE_SIZE;
12372
12378
  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)(
12379
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12380
+ Box,
12381
+ {
12382
+ $display: "grid",
12383
+ $gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
12384
+ $gap: "1rem",
12385
+ $flexGrow: "1",
12386
+ children: plans.map((plan, index) => {
12387
+ const isActivePlan = plan.current && currentPlan?.planPeriod === period;
12388
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12389
+ Flex,
12390
+ {
12391
+ $position: "relative",
12392
+ $flexDirection: "column",
12393
+ $padding: `${0.75 * cardPadding}rem 0`,
12394
+ $backgroundColor: theme.card.background,
12395
+ $borderRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
12396
+ $outlineWidth: "2px",
12397
+ $outlineStyle: "solid",
12398
+ $outlineColor: plan.id === selectedPlan?.id ? theme.primary : "transparent",
12399
+ ...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
12400
+ children: [
12401
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12402
+ Flex,
12403
+ {
12404
+ $flexDirection: "column",
12405
+ $gap: "0.5rem",
12406
+ $padding: `0 ${cardPadding}rem ${0.75 * cardPadding}rem`,
12407
+ $borderBottomWidth: "1px",
12408
+ $borderStyle: "solid",
12409
+ $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
12410
+ $viewport: {
12411
+ sm: {
12412
+ $gap: "1rem"
12413
+ }
12414
+ },
12415
+ children: [
12416
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12417
+ Text,
12418
+ {
12419
+ $font: theme.typography.heading2.fontFamily,
12420
+ $size: theme.typography.heading2.fontSize,
12421
+ $weight: theme.typography.heading2.fontWeight,
12422
+ $color: theme.typography.heading2.color,
12423
+ children: plan.name
12424
+ }
12425
+ ) }),
12426
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { $marginBottom: "0.5rem", $lineHeight: 1.35, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12427
+ Text,
12428
+ {
12429
+ $font: theme.typography.text.fontFamily,
12430
+ $size: theme.typography.text.fontSize,
12431
+ $weight: theme.typography.text.fontWeight,
12432
+ $color: theme.typography.text.color,
12433
+ children: plan.description
12434
+ }
12435
+ ) }),
12436
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box, { children: [
12437
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12434
12438
  Text,
12435
12439
  {
12436
12440
  $font: theme.typography.heading2.fontFamily,
12437
12441
  $size: theme.typography.heading2.fontSize,
12438
12442
  $weight: theme.typography.heading2.fontWeight,
12439
12443
  $color: theme.typography.heading2.color,
12440
- children: plan.name
12444
+ children: formatCurrency(
12445
+ (period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0
12446
+ )
12441
12447
  }
12442
- ) }),
12443
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12448
+ ),
12449
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12444
12450
  Text,
12445
12451
  {
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"
12452
+ $font: theme.typography.heading2.fontFamily,
12453
+ $size: 16 / 30 * theme.typography.heading2.fontSize,
12454
+ $weight: theme.typography.heading2.fontWeight,
12455
+ $color: theme.typography.heading2.color,
12456
+ children: [
12457
+ "/",
12458
+ period
12459
+ ]
12492
12460
  }
12493
12461
  )
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,
12462
+ ] }),
12463
+ isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12464
+ Flex,
12465
+ {
12466
+ $position: "absolute",
12467
+ $right: "1rem",
12468
+ $top: "1rem",
12469
+ $fontSize: "0.75rem",
12470
+ $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
12471
+ $backgroundColor: theme.primary,
12472
+ $borderRadius: "9999px",
12473
+ $padding: "0.125rem 0.85rem",
12474
+ children: "Active"
12475
+ }
12476
+ )
12477
+ ]
12478
+ }
12479
+ ),
12480
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12481
+ Flex,
12482
+ {
12483
+ $flexDirection: "column",
12484
+ $justifyContent: "end",
12485
+ $flexGrow: "1",
12486
+ $gap: `${cardPadding}rem`,
12487
+ $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
12488
+ children: [
12489
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: plan.entitlements.map(
12490
+ ({
12491
+ id,
12492
+ feature,
12493
+ metricPeriod,
12494
+ valueNumeric,
12495
+ valueType
12496
+ }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12497
+ PlanEntitlementRow,
12498
+ {
12509
12499
  feature,
12510
12500
  metricPeriod,
12511
12501
  valueNumeric,
12512
12502
  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"
12503
+ },
12504
+ id
12505
+ )
12506
+ ) }),
12507
+ plan.id === selectedPlan?.id ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12508
+ Flex,
12509
+ {
12510
+ $justifyContent: "center",
12511
+ $alignItems: "center",
12512
+ $gap: "0.25rem",
12513
+ $padding: "0.625rem 0",
12514
+ children: [
12515
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12516
+ Icon2,
12517
+ {
12518
+ name: "check-rounded",
12519
+ style: {
12520
+ fontSize: 20,
12521
+ lineHeight: 1,
12522
+ color: theme.primary
12550
12523
  }
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,
12524
+ }
12525
+ ),
12526
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12527
+ Text,
12566
12528
  {
12567
- label: "Over usage limit",
12568
- description: "Current usage exceeds the limit of this plan."
12529
+ $size: 15,
12530
+ $leading: 1,
12531
+ $color: theme.typography.text.color,
12532
+ children: isActivePlan ? "Current plan" : "Selected"
12569
12533
  }
12570
- ) : "Choose plan"
12571
- }
12572
- )
12573
- ]
12574
- }
12575
- )
12576
- ]
12577
- },
12578
- plan.id
12579
- );
12580
- })
12581
- }
12582
- )
12583
- ] });
12534
+ )
12535
+ ]
12536
+ }
12537
+ ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12538
+ EmbedButton,
12539
+ {
12540
+ disabled: isLoading || !plan.valid,
12541
+ onClick: () => {
12542
+ selectPlan(plan);
12543
+ },
12544
+ $size: "sm",
12545
+ $color: "primary",
12546
+ $variant: index < currentPlanIndex ? "outline" : "filled",
12547
+ children: !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12548
+ Tooltip,
12549
+ {
12550
+ label: "Over usage limit",
12551
+ description: "Current usage exceeds the limit of this plan."
12552
+ }
12553
+ ) : "Choose plan"
12554
+ }
12555
+ )
12556
+ ]
12557
+ }
12558
+ )
12559
+ ]
12560
+ },
12561
+ plan.id
12562
+ );
12563
+ })
12564
+ }
12565
+ ) });
12584
12566
  };
12585
12567
 
12586
12568
  // src/components/shared/checkout-dialog/AddOns.tsx
@@ -12589,159 +12571,130 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
12589
12571
  const theme = nt();
12590
12572
  const periodKey = period === "year" ? "yearlyPrice" : "monthlyPrice";
12591
12573
  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)(
12574
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12575
+ Box,
12576
+ {
12577
+ $display: "grid",
12578
+ $gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
12579
+ $gap: "1rem",
12580
+ children: addOns.map((addOn) => {
12581
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12582
+ Flex,
12583
+ {
12584
+ $position: "relative",
12585
+ $flexDirection: "column",
12586
+ $gap: "2rem",
12587
+ $padding: `${cardPadding}rem`,
12588
+ $backgroundColor: theme.card.background,
12589
+ $borderRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
12590
+ $outlineWidth: "2px",
12591
+ $outlineStyle: "solid",
12592
+ $outlineColor: addOn.isSelected ? theme.primary : "transparent",
12593
+ ...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
12594
+ children: [
12595
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
12596
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12597
+ Text,
12598
+ {
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
+ children: addOn.name
12604
+ }
12605
+ ) }),
12606
+ addOn.description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12607
+ Text,
12608
+ {
12609
+ $font: theme.typography.text.fontFamily,
12610
+ $size: theme.typography.text.fontSize,
12611
+ $weight: theme.typography.text.fontWeight,
12612
+ $color: theme.typography.text.color,
12613
+ children: addOn.description
12614
+ }
12615
+ ) }),
12616
+ addOn[periodKey] && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Box, { children: [
12617
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12643
12618
  Text,
12644
12619
  {
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
12620
+ $font: theme.typography.heading2.fontFamily,
12621
+ $size: theme.typography.heading2.fontSize,
12622
+ $weight: theme.typography.heading2.fontWeight,
12623
+ $color: theme.typography.heading2.color,
12624
+ children: formatCurrency(
12625
+ (period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0
12626
+ )
12650
12627
  }
12651
- ) }),
12652
- addOn.description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12628
+ ),
12629
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
12653
12630
  Text,
12654
12631
  {
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"
12632
+ $font: theme.typography.heading2.fontFamily,
12633
+ $size: 16 / 30 * theme.typography.heading2.fontSize,
12634
+ $weight: theme.typography.heading2.fontWeight,
12635
+ $color: theme.typography.heading2.color,
12636
+ children: [
12637
+ "/",
12638
+ period
12639
+ ]
12701
12640
  }
12702
12641
  )
12703
12642
  ] }),
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,
12643
+ addOn.current && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12644
+ Flex,
12706
12645
  {
12707
- disabled: isLoading || !addOn.valid,
12708
- onClick: () => toggle(addOn.id),
12709
- $size: "sm",
12710
- $color: "primary",
12711
- $variant: "outline",
12712
- children: "Choose add-on"
12646
+ $position: "absolute",
12647
+ $right: "1rem",
12648
+ $top: "1rem",
12649
+ $fontSize: "0.75rem",
12650
+ $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
12651
+ $backgroundColor: theme.primary,
12652
+ $borderRadius: "9999px",
12653
+ $padding: "0.125rem 0.85rem",
12654
+ children: "Active"
12713
12655
  }
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
- }
12656
+ )
12657
+ ] }),
12658
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Flex, { $flexDirection: "column", $justifyContent: "end", $flexGrow: "1", children: !addOn.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12659
+ EmbedButton,
12660
+ {
12661
+ disabled: isLoading || !addOn.valid,
12662
+ onClick: () => toggle(addOn.id),
12663
+ $size: "sm",
12664
+ $color: "primary",
12665
+ $variant: "outline",
12666
+ children: "Choose add-on"
12667
+ }
12668
+ ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12669
+ EmbedButton,
12670
+ {
12671
+ disabled: isLoading || !addOn.valid,
12672
+ onClick: () => toggle(addOn.id),
12673
+ $size: "sm",
12674
+ $color: addOn.current ? "danger" : "primary",
12675
+ $variant: addOn.current ? "ghost" : "text",
12676
+ children: addOn.current ? "Remove add-on" : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
12677
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
12678
+ Icon2,
12679
+ {
12680
+ name: "check-rounded",
12681
+ style: {
12682
+ fontSize: 20,
12683
+ lineHeight: 1
12731
12684
  }
12732
- ),
12733
- "Selected"
12734
- ] })
12735
- }
12736
- ) })
12737
- ]
12738
- },
12739
- addOn.id
12740
- );
12741
- })
12742
- }
12743
- )
12744
- ] });
12685
+ }
12686
+ ),
12687
+ "Selected"
12688
+ ] })
12689
+ }
12690
+ ) })
12691
+ ]
12692
+ },
12693
+ addOn.id
12694
+ );
12695
+ })
12696
+ }
12697
+ ) });
12745
12698
  };
12746
12699
 
12747
12700
  // src/components/shared/checkout-dialog/Checkout.tsx
@@ -12827,35 +12780,44 @@ var CheckoutDialog = ({
12827
12780
  initialAddOnId,
12828
12781
  portal
12829
12782
  }) => {
12783
+ const theme = nt();
12830
12784
  const { api, data } = useEmbed();
12831
- const [checkoutStage, setCheckoutStage] = (0, import_react18.useState)("plan");
12832
- const [planPeriod, setPlanPeriod] = (0, import_react18.useState)(
12785
+ const contentRef = (0, import_react19.useRef)(null);
12786
+ const checkoutRef = (0, import_react19.useRef)(null);
12787
+ const [checkoutStage, setCheckoutStage] = (0, import_react19.useState)("plan");
12788
+ const [planPeriod, setPlanPeriod] = (0, import_react19.useState)(
12833
12789
  initialPeriod || data.company?.plan?.planPeriod || "month"
12834
12790
  );
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)(
12791
+ const [charges, setCharges] = (0, import_react19.useState)();
12792
+ const [paymentMethodId, setPaymentMethodId] = (0, import_react19.useState)();
12793
+ const [isLoading, setIsLoading] = (0, import_react19.useState)(false);
12794
+ const [error, setError] = (0, import_react19.useState)();
12795
+ const [showPaymentForm, setShowPaymentForm] = (0, import_react19.useState)(
12840
12796
  !data.subscription?.paymentMethod
12841
12797
  );
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)(() => {
12798
+ const [stripe, setStripe] = (0, import_react19.useState)(null);
12799
+ const [setupIntent, setSetupIntent] = (0, import_react19.useState)();
12800
+ const [top, setTop] = (0, import_react19.useState)(0);
12801
+ const {
12802
+ plans: availablePlans,
12803
+ addOns: availableAddOns,
12804
+ periods: availablePeriods
12805
+ } = useAvailablePlans(planPeriod);
12806
+ const checkoutStages = (0, import_react19.useMemo)(() => {
12847
12807
  const checkoutStages2 = [
12848
12808
  {
12849
12809
  id: "plan",
12850
- name: "Select plan",
12810
+ name: "Plan",
12811
+ label: "Select plan",
12851
12812
  description: "Choose your base plan"
12852
12813
  },
12853
12814
  {
12854
12815
  id: "addons",
12855
- name: "Customize with addons",
12816
+ name: "Add-ons",
12817
+ label: "Select add-ons",
12856
12818
  description: "Optionally add features to your subscription"
12857
12819
  },
12858
- { id: "checkout", name: "Checkout", description: "" }
12820
+ { id: "checkout", name: "Checkout", label: "Checkout" }
12859
12821
  ];
12860
12822
  if (!availableAddOns.length) {
12861
12823
  checkoutStages2.splice(1, 1);
@@ -12863,21 +12825,22 @@ var CheckoutDialog = ({
12863
12825
  return checkoutStages2;
12864
12826
  }, [availableAddOns]);
12865
12827
  const currentPlan = data.company?.plan;
12866
- const [selectedPlan, setSelectedPlan] = (0, import_react18.useState)(
12828
+ const [selectedPlan, setSelectedPlan] = (0, import_react19.useState)(
12867
12829
  () => availablePlans.find(
12868
12830
  (plan) => plan.id === (typeof initialPlanId !== "undefined" ? initialPlanId : currentPlan?.id)
12869
12831
  )
12870
12832
  );
12871
12833
  const currentAddOns = data.company?.addOns || [];
12872
- const [addOns, setAddOns] = (0, import_react18.useState)(
12834
+ const [addOns, setAddOns] = (0, import_react19.useState)(
12873
12835
  () => availableAddOns.map((addOn) => ({
12874
12836
  ...addOn,
12875
12837
  isSelected: typeof initialAddOnId !== "undefined" ? addOn.id === initialAddOnId : currentAddOns.some((currentAddOn) => addOn.id === currentAddOn.id)
12876
12838
  }))
12877
12839
  );
12878
12840
  const isLightBackground = useIsLightBackground();
12879
- const previewCheckout = (0, import_react18.useCallback)(
12880
- async (plan, addOns2, period) => {
12841
+ const previewCheckout = (0, import_react19.useCallback)(
12842
+ async (plan, addOns2, newPeriod) => {
12843
+ const period = newPeriod || planPeriod;
12881
12844
  const planPriceId = period === "month" ? plan?.monthlyPrice?.id : plan?.yearlyPrice?.id;
12882
12845
  if (!api || !planPriceId) {
12883
12846
  return;
@@ -12911,18 +12874,33 @@ var CheckoutDialog = ({
12911
12874
  );
12912
12875
  } finally {
12913
12876
  setIsLoading(false);
12877
+ if (!newPeriod) {
12878
+ checkoutRef.current?.scrollIntoView({
12879
+ behavior: "smooth",
12880
+ block: "nearest"
12881
+ });
12882
+ }
12914
12883
  }
12915
12884
  },
12916
- [api]
12885
+ [api, planPeriod]
12917
12886
  );
12918
- const selectPlan = (0, import_react18.useCallback)(
12887
+ const selectPlan = (0, import_react19.useCallback)(
12919
12888
  (plan, newPeriod) => {
12920
12889
  setSelectedPlan(plan);
12921
- previewCheckout(plan, addOns, newPeriod || planPeriod);
12890
+ previewCheckout(plan, addOns, newPeriod);
12891
+ },
12892
+ [addOns, previewCheckout]
12893
+ );
12894
+ const changePlanPeriod = (0, import_react19.useCallback)(
12895
+ (period) => {
12896
+ if (selectedPlan) {
12897
+ selectPlan(selectedPlan, period);
12898
+ }
12899
+ setPlanPeriod(period);
12922
12900
  },
12923
- [addOns, planPeriod, previewCheckout]
12901
+ [selectedPlan, selectPlan, setPlanPeriod]
12924
12902
  );
12925
- const toggleAddOn = (0, import_react18.useCallback)(
12903
+ const toggleAddOn = (0, import_react19.useCallback)(
12926
12904
  (id, newPeriod) => {
12927
12905
  const updatedAddOns = addOns.map((addOn) => ({
12928
12906
  ...addOn,
@@ -12936,12 +12914,12 @@ var CheckoutDialog = ({
12936
12914
  },
12937
12915
  [selectedPlan, addOns, planPeriod, previewCheckout]
12938
12916
  );
12939
- (0, import_react18.useEffect)(() => {
12917
+ (0, import_react19.useEffect)(() => {
12940
12918
  if (!stripe && setupIntent?.publishableKey) {
12941
12919
  setStripe(loadStripe(setupIntent.publishableKey));
12942
12920
  }
12943
12921
  }, [stripe, setupIntent?.publishableKey]);
12944
- (0, import_react18.useLayoutEffect)(() => {
12922
+ (0, import_react19.useLayoutEffect)(() => {
12945
12923
  const parent = portal || document.body;
12946
12924
  const value = Math.abs(parent.getBoundingClientRect().top ?? 0);
12947
12925
  setTop(value);
@@ -12950,102 +12928,210 @@ var CheckoutDialog = ({
12950
12928
  parent.style.overflow = "";
12951
12929
  };
12952
12930
  }, [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,
12931
+ (0, import_react19.useLayoutEffect)(() => {
12932
+ if (contentRef.current) {
12933
+ contentRef.current.scrollTo({
12934
+ top: 0,
12935
+ left: 0,
12936
+ behavior: "smooth"
12937
+ });
12938
+ }
12939
+ }, [checkoutStage]);
12940
+ const activeCheckoutStage = checkoutStages.find(
12941
+ (stage) => stage.id === checkoutStage
12942
+ );
12943
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Modal, { id: "select-plan-dialog", size: "lg", top, contentRef, children: [
12944
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ModalHeader, { bordered: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12945
+ Flex,
12956
12946
  {
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)
12997
- }
12947
+ $flexWrap: "wrap",
12948
+ $gap: "0.5rem",
12949
+ $viewport: {
12950
+ sm: {
12951
+ $gap: "1rem"
12952
+ }
12953
+ },
12954
+ 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
12998
12961
  ),
12999
- checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13000
- Checkout,
13001
- {
13002
- setPaymentMethodId: (id) => setPaymentMethodId(id),
13003
- togglePaymentForm: () => setShowPaymentForm((prev2) => !prev2),
13004
- setupIntent,
13005
- showPaymentForm,
13006
- stripe
13007
- }
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
- ] })
12962
+ isLast: index === stages.length - 1,
12963
+ onClick: () => setCheckoutStage(stage.id)
12964
+ },
12965
+ stage.id
12966
+ ))
12967
+ }
12968
+ ) }),
12969
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
12970
+ Flex,
12971
+ {
12972
+ $position: "relative",
12973
+ $flexDirection: "column",
12974
+ $height: "auto",
12975
+ $viewport: {
12976
+ sm: {
12977
+ $flexDirection: "row",
12978
+ $height: "calc(100% - 5rem)"
12979
+ }
12980
+ },
12981
+ children: [
12982
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
12983
+ Flex,
12984
+ {
12985
+ $flexDirection: "column",
12986
+ $flexGrow: "1",
12987
+ $gap: "1.5rem",
12988
+ $padding: "1.5rem",
12989
+ $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
12990
+ $overflow: "auto",
12991
+ $viewport: {
12992
+ sm: {
12993
+ $gap: "1rem",
12994
+ $padding: "2rem 2.5rem 2rem 2.5rem"
12995
+ }
12996
+ },
12997
+ children: [
12998
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
12999
+ Flex,
13000
+ {
13001
+ $flexDirection: "column",
13002
+ $gap: "1.5rem",
13003
+ $viewport: {
13004
+ sm: {
13005
+ $flexDirection: "row",
13006
+ $justifyContent: "space-between",
13007
+ $alignItems: "start",
13008
+ $gap: "1rem"
13009
+ }
13010
+ },
13011
+ children: [
13012
+ activeCheckoutStage && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13013
+ Flex,
13014
+ {
13015
+ $flexDirection: "column",
13016
+ $alignItems: "center",
13017
+ $gap: "0.25rem",
13018
+ $viewport: {
13019
+ sm: {
13020
+ $alignItems: "start",
13021
+ $gap: "1rem",
13022
+ $marginBottom: "1rem"
13023
+ }
13024
+ },
13025
+ children: [
13026
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13027
+ Text,
13028
+ {
13029
+ as: "h3",
13030
+ $font: theme.typography.heading3.fontFamily,
13031
+ $size: theme.typography.heading3.fontSize,
13032
+ $weight: theme.typography.heading3.fontWeight,
13033
+ $color: theme.typography.heading3.color,
13034
+ $marginBottom: "0.5rem",
13035
+ children: activeCheckoutStage.label
13036
+ }
13037
+ ),
13038
+ activeCheckoutStage?.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13039
+ Text,
13040
+ {
13041
+ as: "p",
13042
+ $font: theme.typography.text.fontFamily,
13043
+ $size: theme.typography.text.fontSize,
13044
+ $weight: theme.typography.text.fontWeight,
13045
+ $color: theme.typography.text.color,
13046
+ children: activeCheckoutStage.description
13047
+ }
13048
+ )
13049
+ ]
13050
+ }
13051
+ ),
13052
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13053
+ PeriodToggle,
13054
+ {
13055
+ options: availablePeriods,
13056
+ selectedOption: planPeriod,
13057
+ selectedPlan,
13058
+ onChange: changePlanPeriod
13059
+ }
13060
+ )
13061
+ ]
13062
+ }
13063
+ ),
13064
+ checkoutStage === "plan" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13065
+ Plan,
13066
+ {
13067
+ isLoading,
13068
+ period: planPeriod,
13069
+ plans: availablePlans,
13070
+ currentPlan,
13071
+ selectedPlan,
13072
+ selectPlan
13073
+ }
13074
+ ),
13075
+ checkoutStage === "addons" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13076
+ AddOns,
13077
+ {
13078
+ isLoading,
13079
+ period: planPeriod,
13080
+ addOns,
13081
+ toggle: (id) => toggleAddOn(id)
13082
+ }
13083
+ ),
13084
+ checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13085
+ Checkout,
13086
+ {
13087
+ setPaymentMethodId: (id) => setPaymentMethodId(id),
13088
+ togglePaymentForm: () => setShowPaymentForm((prev2) => !prev2),
13089
+ setupIntent,
13090
+ showPaymentForm,
13091
+ stripe
13092
+ }
13093
+ )
13094
+ ]
13095
+ }
13096
+ ),
13097
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13098
+ Sidebar,
13099
+ {
13100
+ addOns,
13101
+ charges,
13102
+ checkoutRef,
13103
+ checkoutStage,
13104
+ currentAddOns,
13105
+ currentPlan,
13106
+ error,
13107
+ isLoading,
13108
+ paymentMethodId,
13109
+ planPeriod,
13110
+ selectedPlan,
13111
+ setCheckoutStage: (stage) => setCheckoutStage(stage),
13112
+ setError: (msg) => setError(msg),
13113
+ setSetupIntent: (intent) => setSetupIntent(intent),
13114
+ showPaymentForm,
13115
+ toggleLoading: () => setIsLoading((prev2) => !prev2)
13116
+ }
13117
+ )
13118
+ ]
13119
+ }
13120
+ )
13035
13121
  ] });
13036
13122
  };
13037
13123
 
13038
13124
  // src/components/shared/payment-form/PaymentForm.tsx
13039
- var import_react19 = require("react");
13125
+ var import_react20 = require("react");
13040
13126
  var import_react_stripe_js2 = require("@stripe/react-stripe-js");
13041
13127
  var import_jsx_runtime25 = require("react/jsx-runtime");
13042
13128
  var PaymentForm = ({ onConfirm }) => {
13043
13129
  const stripe = (0, import_react_stripe_js2.useStripe)();
13044
13130
  const elements = (0, import_react_stripe_js2.useElements)();
13045
13131
  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);
13132
+ const [message, setMessage] = (0, import_react20.useState)(null);
13133
+ const [isLoading, setIsLoading] = (0, import_react20.useState)(false);
13134
+ const [isConfirmed, setIsConfirmed] = (0, import_react20.useState)(false);
13049
13135
  const handleSubmit = async (event) => {
13050
13136
  event.preventDefault();
13051
13137
  if (!api || !stripe || !elements) {
@@ -13110,6 +13196,7 @@ var import_jsx_runtime26 = require("react/jsx-runtime");
13110
13196
  var PeriodToggle = ({
13111
13197
  options,
13112
13198
  selectedOption,
13199
+ selectedPlan,
13113
13200
  onChange
13114
13201
  }) => {
13115
13202
  const theme = nt();
@@ -13117,32 +13204,43 @@ var PeriodToggle = ({
13117
13204
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13118
13205
  Flex,
13119
13206
  {
13120
- $width: "fit-content",
13207
+ $margin: 0,
13121
13208
  $backgroundColor: theme.card.background,
13122
13209
  $borderWidth: "1px",
13123
13210
  $borderStyle: "solid",
13124
13211
  $borderColor: isLightBackground ? "hsl(0, 0%, 92.5%)" : "hsl(0, 0%, 7.5%)",
13125
13212
  $borderRadius: "2.5rem",
13126
13213
  $cursor: "pointer",
13214
+ $viewport: {
13215
+ sm: {
13216
+ $width: "fit-content"
13217
+ }
13218
+ },
13127
13219
  children: options.map((option) => {
13128
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13220
+ const element = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13129
13221
  Flex,
13130
13222
  {
13131
13223
  tabIndex: 0,
13132
13224
  onClick: () => onChange(option),
13133
13225
  $justifyContent: "center",
13134
13226
  $alignItems: "center",
13135
- $padding: "0.375rem 1rem",
13227
+ $flexGrow: 1,
13228
+ $padding: "0.75rem 1rem",
13136
13229
  ...option === selectedOption && {
13137
13230
  $backgroundColor: isLightBackground ? "hsl(0, 0%, 92.5%)" : "hsl(0, 0%, 7.5%)"
13138
13231
  },
13139
13232
  $borderRadius: "2.5rem",
13233
+ $viewport: {
13234
+ sm: {
13235
+ $padding: "0.375rem 1rem"
13236
+ }
13237
+ },
13140
13238
  children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
13141
13239
  Text,
13142
13240
  {
13143
- $flexShrink: "0",
13241
+ $flexShrink: 0,
13144
13242
  $font: theme.typography.text.fontFamily,
13145
- $size: 14,
13243
+ $size: 15,
13146
13244
  $weight: option === selectedOption ? 600 : 400,
13147
13245
  $color: theme.typography.text.color,
13148
13246
  children: [
@@ -13154,17 +13252,28 @@ var PeriodToggle = ({
13154
13252
  },
13155
13253
  option
13156
13254
  );
13255
+ if (option === "year") {
13256
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
13257
+ Tooltip,
13258
+ {
13259
+ label: element,
13260
+ description: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Savings, { plan: selectedPlan, period: selectedOption }),
13261
+ $flexGrow: 1
13262
+ }
13263
+ );
13264
+ }
13265
+ return element;
13157
13266
  })
13158
13267
  }
13159
13268
  );
13160
13269
  };
13161
13270
 
13162
13271
  // src/components/shared/savings/Savings.tsx
13163
- var import_react20 = require("react");
13272
+ var import_react21 = require("react");
13164
13273
  var import_jsx_runtime27 = require("react/jsx-runtime");
13165
13274
  var Savings = ({ plan, period }) => {
13166
13275
  const theme = nt();
13167
- const savingsPercentage = (0, import_react20.useMemo)(() => {
13276
+ const savingsPercentage = (0, import_react21.useMemo)(() => {
13168
13277
  if (plan) {
13169
13278
  const monthly = (plan?.monthlyPrice?.price || 0) * 12;
13170
13279
  const yearly = plan?.yearlyPrice?.price || 0;
@@ -13179,6 +13288,7 @@ var Savings = ({ plan, period }) => {
13179
13288
  $size: 11,
13180
13289
  $weight: theme.typography.text.fontWeight,
13181
13290
  $color: theme.primary,
13291
+ $leading: 1,
13182
13292
  children: period === "month" ? `Save up to ${savingsPercentage}% with yearly billing` : `You are saving ${savingsPercentage}% with yearly billing`
13183
13293
  }
13184
13294
  );
@@ -13257,20 +13367,20 @@ var PaymentMethodElement = ({
13257
13367
  )
13258
13368
  ] });
13259
13369
  };
13260
- var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
13370
+ var PaymentMethod = (0, import_react22.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
13261
13371
  const props = resolveDesignProps4(rest);
13262
13372
  const theme = nt();
13263
13373
  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)(
13374
+ const [isLoading, setIsLoading] = (0, import_react22.useState)(false);
13375
+ const [error, setError] = (0, import_react22.useState)();
13376
+ const [showPaymentForm, setShowPaymentForm] = (0, import_react22.useState)(
13267
13377
  () => typeof data.subscription?.paymentMethod === "undefined"
13268
13378
  );
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);
13379
+ const [stripe, setStripe] = (0, import_react22.useState)(null);
13380
+ const [setupIntent, setSetupIntent] = (0, import_react22.useState)();
13381
+ const [top, setTop] = (0, import_react22.useState)(0);
13272
13382
  const isLightBackground = useIsLightBackground();
13273
- const paymentMethod = (0, import_react21.useMemo)(() => {
13383
+ const paymentMethod = (0, import_react22.useMemo)(() => {
13274
13384
  const { paymentMethodType, cardLast4, cardExpMonth, cardExpYear } = data.subscription?.paymentMethod || {};
13275
13385
  let monthsToExpiration;
13276
13386
  if (typeof cardExpYear === "number" && typeof cardExpMonth === "number") {
@@ -13290,7 +13400,7 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13290
13400
  monthsToExpiration
13291
13401
  };
13292
13402
  }, [data.subscription?.paymentMethod]);
13293
- const createSetupIntent = (0, import_react21.useCallback)(async () => {
13403
+ const createSetupIntent = (0, import_react22.useCallback)(async () => {
13294
13404
  if (!api || !data.component?.id) {
13295
13405
  return;
13296
13406
  }
@@ -13307,7 +13417,7 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13307
13417
  setIsLoading(false);
13308
13418
  }
13309
13419
  }, [api, data.component?.id]);
13310
- const updatePaymentMethod = (0, import_react21.useCallback)(
13420
+ const updatePaymentMethod = (0, import_react22.useCallback)(
13311
13421
  async (id) => {
13312
13422
  if (!api || !id) {
13313
13423
  return;
@@ -13328,22 +13438,16 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13328
13438
  },
13329
13439
  [api, setLayout]
13330
13440
  );
13331
- (0, import_react21.useEffect)(() => {
13441
+ (0, import_react22.useEffect)(() => {
13332
13442
  if (!stripe && setupIntent?.publishableKey) {
13333
13443
  setStripe(loadStripe(setupIntent.publishableKey));
13334
13444
  }
13335
13445
  }, [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)(() => {
13446
+ (0, import_react22.useLayoutEffect)(() => {
13343
13447
  const parent = portal || document.body;
13344
13448
  const value = Math.abs(parent.getBoundingClientRect().top ?? 0);
13345
13449
  setTop(value);
13346
- parent.style.overflow = "hidden";
13450
+ parent.style.overflow = layout === "payment" ? "hidden" : "";
13347
13451
  return () => {
13348
13452
  parent.style.overflow = "";
13349
13453
  };
@@ -13462,7 +13566,7 @@ var PaymentMethod = (0, import_react21.forwardRef)(({ children, className, porta
13462
13566
  PaymentMethod.displayName = "PaymentMethod";
13463
13567
 
13464
13568
  // src/components/elements/plan-manager/PlanManager.tsx
13465
- var import_react22 = require("react");
13569
+ var import_react23 = require("react");
13466
13570
  var import_react_dom2 = require("react-dom");
13467
13571
  var import_jsx_runtime29 = require("react/jsx-runtime");
13468
13572
  var resolveDesignProps5 = (props) => {
@@ -13493,7 +13597,7 @@ var resolveDesignProps5 = (props) => {
13493
13597
  }
13494
13598
  };
13495
13599
  };
13496
- var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal, ...rest }, ref) => {
13600
+ var PlanManager = (0, import_react23.forwardRef)(({ children, className, portal, ...rest }, ref) => {
13497
13601
  const props = resolveDesignProps5(rest);
13498
13602
  const theme = nt();
13499
13603
  const { data, layout, setLayout } = useEmbed();
@@ -13545,20 +13649,31 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13545
13649
  }
13546
13650
  )
13547
13651
  ] }),
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
- )
13652
+ props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Box, { children: [
13653
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13654
+ Text,
13655
+ {
13656
+ $font: theme.typography[props.header.price.fontStyle].fontFamily,
13657
+ $size: theme.typography[props.header.price.fontStyle].fontSize,
13658
+ $weight: theme.typography[props.header.price.fontStyle].fontWeight,
13659
+ $color: theme.typography[props.header.price.fontStyle].color,
13660
+ children: formatCurrency(currentPlan.planPrice)
13661
+ }
13662
+ ),
13663
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
13664
+ Text,
13665
+ {
13666
+ $font: theme.typography[props.header.price.fontStyle].fontFamily,
13667
+ $size: 16 / 30 * theme.typography[props.header.price.fontStyle].fontSize,
13668
+ $weight: theme.typography[props.header.price.fontStyle].fontWeight,
13669
+ $color: theme.typography[props.header.price.fontStyle].color,
13670
+ children: [
13671
+ "/",
13672
+ currentPlan.planPeriod
13673
+ ]
13674
+ }
13675
+ )
13676
+ ] })
13562
13677
  ]
13563
13678
  }
13564
13679
  ),
@@ -13633,7 +13748,7 @@ var PlanManager = (0, import_react22.forwardRef)(({ children, className, portal,
13633
13748
  PlanManager.displayName = "PlanManager";
13634
13749
 
13635
13750
  // src/components/elements/pricing-table/PricingTable.tsx
13636
- var import_react23 = require("react");
13751
+ var import_react24 = require("react");
13637
13752
  var import_react_dom3 = require("react-dom");
13638
13753
  var import_pluralize4 = __toESM(require_pluralize());
13639
13754
  var import_jsx_runtime30 = require("react/jsx-runtime");
@@ -13666,31 +13781,30 @@ var resolveDesignProps6 = (props) => {
13666
13781
  },
13667
13782
  upgrade: {
13668
13783
  isVisible: props.upgrade?.isVisible ?? true,
13669
- buttonSize: props.upgrade?.buttonSize ?? "sm",
13784
+ buttonSize: props.upgrade?.buttonSize ?? "md",
13670
13785
  buttonStyle: props.upgrade?.buttonStyle ?? "primary"
13671
13786
  },
13672
13787
  downgrade: {
13673
13788
  isVisible: props.downgrade?.isVisible ?? true,
13674
- buttonSize: props.downgrade?.buttonSize ?? "sm",
13789
+ buttonSize: props.downgrade?.buttonSize ?? "md",
13675
13790
  buttonStyle: props.downgrade?.buttonStyle ?? "primary"
13676
13791
  }
13677
13792
  };
13678
13793
  };
13679
- var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal, ...rest }, ref) => {
13794
+ var PricingTable = (0, import_react24.forwardRef)(({ children, className, portal, ...rest }, ref) => {
13680
13795
  const props = resolveDesignProps6(rest);
13681
13796
  const theme = nt();
13682
13797
  const { data, layout, setLayout } = useEmbed();
13683
- const [selectedPeriod, setSelectedPeriod] = (0, import_react23.useState)(
13798
+ const [selectedPeriod, setSelectedPeriod] = (0, import_react24.useState)(
13684
13799
  () => data.company?.plan?.planPeriod || "month"
13685
13800
  );
13686
- const [selectedPlanId, setSelectedPlanId] = (0, import_react23.useState)();
13687
- const [selectedAddOnId, setSelectedAddOnId] = (0, import_react23.useState)();
13801
+ const [selectedPlanId, setSelectedPlanId] = (0, import_react24.useState)();
13802
+ const [selectedAddOnId, setSelectedAddOnId] = (0, import_react24.useState)();
13688
13803
  const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
13689
13804
  const isLightBackground = useIsLightBackground();
13690
13805
  const canChangePlan = data.capabilities?.checkout ?? true;
13691
13806
  const cardPadding = theme.card.padding / TEXT_BASE_SIZE;
13692
13807
  const currentPlanIndex = plans.findIndex((plan) => plan.current);
13693
- const currentPlan = plans[currentPlanIndex];
13694
13808
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
13695
13809
  FussyChild,
13696
13810
  {
@@ -13698,15 +13812,23 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13698
13812
  className,
13699
13813
  as: Flex,
13700
13814
  $flexDirection: "column",
13701
- $gap: "3rem",
13815
+ $gap: "2rem",
13702
13816
  children: [
13703
13817
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Box, { children: [
13704
13818
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
13705
13819
  Flex,
13706
13820
  {
13707
- $justifyContent: "space-between",
13821
+ $flexDirection: "column",
13822
+ $justifyContent: "center",
13708
13823
  $alignItems: "center",
13709
- $marginBottom: "2rem",
13824
+ $gap: "1rem",
13825
+ $marginBottom: "1rem",
13826
+ $viewport: {
13827
+ sm: {
13828
+ $flexDirection: "row",
13829
+ $justifyContent: "space-between"
13830
+ }
13831
+ },
13710
13832
  children: [
13711
13833
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
13712
13834
  Text,
@@ -13714,21 +13836,18 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13714
13836
  $font: theme.typography[props.header.fontStyle].fontFamily,
13715
13837
  $size: theme.typography[props.header.fontStyle].fontSize,
13716
13838
  $weight: theme.typography[props.header.fontStyle].fontWeight,
13717
- $color: theme.typography[props.header.fontStyle].color,
13839
+ $color: theme.card.background,
13718
13840
  children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && "Plans"
13719
13841
  }
13720
13842
  ),
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
- ] })
13843
+ props.showPeriodToggle && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
13844
+ PeriodToggle,
13845
+ {
13846
+ options: periods,
13847
+ selectedOption: selectedPeriod,
13848
+ onChange: (period) => setSelectedPeriod(period)
13849
+ }
13850
+ )
13732
13851
  ]
13733
13852
  }
13734
13853
  ),
@@ -13816,7 +13935,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13816
13935
  $position: "absolute",
13817
13936
  $right: "1rem",
13818
13937
  $top: "1rem",
13819
- $fontSize: "0.625rem",
13938
+ $fontSize: "0.75rem",
13820
13939
  $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
13821
13940
  $backgroundColor: theme.primary,
13822
13941
  $borderRadius: "9999px",
@@ -13836,7 +13955,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13836
13955
  $gap: `${cardPadding}rem`,
13837
13956
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
13838
13957
  children: [
13839
- props.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
13958
+ props.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: [
13840
13959
  props.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
13841
13960
  Text,
13842
13961
  {
@@ -13959,14 +14078,14 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
13959
14078
  {
13960
14079
  $justifyContent: "space-between",
13961
14080
  $alignItems: "center",
13962
- $marginBottom: "2rem",
14081
+ $marginBottom: "1rem",
13963
14082
  children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
13964
14083
  Text,
13965
14084
  {
13966
14085
  $font: theme.typography[props.header.fontStyle].fontFamily,
13967
14086
  $size: theme.typography[props.header.fontStyle].fontSize,
13968
14087
  $weight: theme.typography[props.header.fontStyle].fontWeight,
13969
- $color: theme.typography[props.header.fontStyle].color,
14088
+ $color: theme.card.background,
13970
14089
  children: "Add-ons"
13971
14090
  }
13972
14091
  )
@@ -14048,7 +14167,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14048
14167
  $position: "absolute",
14049
14168
  $right: "1rem",
14050
14169
  $top: "1rem",
14051
- $fontSize: "0.625rem",
14170
+ $fontSize: "0.75rem",
14052
14171
  $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
14053
14172
  $backgroundColor: theme.primary,
14054
14173
  $borderRadius: "9999px",
@@ -14070,7 +14189,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14070
14189
  {
14071
14190
  $flexDirection: "column",
14072
14191
  $position: "relative",
14073
- $gap: "0.5rem",
14192
+ $gap: "1rem",
14074
14193
  $flexGrow: "1",
14075
14194
  children: addOn.entitlements.map((entitlement) => {
14076
14195
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
@@ -14160,7 +14279,7 @@ var PricingTable = (0, import_react23.forwardRef)(({ children, className, portal
14160
14279
  PricingTable.displayName = "PricingTable";
14161
14280
 
14162
14281
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
14163
- var import_react24 = require("react");
14282
+ var import_react25 = require("react");
14164
14283
  var import_jsx_runtime31 = require("react/jsx-runtime");
14165
14284
  function resolveDesignProps7(props) {
14166
14285
  return {
@@ -14180,11 +14299,11 @@ function resolveDesignProps7(props) {
14180
14299
  }
14181
14300
  };
14182
14301
  }
14183
- var UpcomingBill = (0, import_react24.forwardRef)(({ className, ...rest }, ref) => {
14302
+ var UpcomingBill = (0, import_react25.forwardRef)(({ className, ...rest }, ref) => {
14184
14303
  const props = resolveDesignProps7(rest);
14185
14304
  const theme = nt();
14186
14305
  const { data } = useEmbed();
14187
- const { upcomingInvoice } = (0, import_react24.useMemo)(() => {
14306
+ const { upcomingInvoice } = (0, import_react25.useMemo)(() => {
14188
14307
  return {
14189
14308
  upcomingInvoice: {
14190
14309
  ...typeof data.upcomingInvoice?.amountDue === "number" && {
@@ -14237,7 +14356,7 @@ var UpcomingBill = (0, import_react24.forwardRef)(({ className, ...rest }, ref)
14237
14356
  children: formatCurrency(upcomingInvoice.amountDue)
14238
14357
  }
14239
14358
  ) }),
14240
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
14359
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
14241
14360
  Text,
14242
14361
  {
14243
14362
  $font: theme.typography[props.contractEndDate.fontStyle].fontFamily,
@@ -14254,10 +14373,10 @@ var UpcomingBill = (0, import_react24.forwardRef)(({ className, ...rest }, ref)
14254
14373
  UpcomingBill.displayName = "UpcomingBill";
14255
14374
 
14256
14375
  // src/components/embed/ComponentTree.tsx
14257
- var import_react26 = require("react");
14376
+ var import_react27 = require("react");
14258
14377
 
14259
14378
  // src/components/embed/renderer.ts
14260
- var import_react25 = require("react");
14379
+ var import_react26 = require("react");
14261
14380
  var components = {
14262
14381
  Root,
14263
14382
  Viewport,
@@ -14289,7 +14408,7 @@ function createRenderer(options) {
14289
14408
  const { className, ...rest } = props;
14290
14409
  const resolvedProps = component === "div" ? rest : props;
14291
14410
  const resolvedChildren = children.map(renderNode);
14292
- return (0, import_react25.createElement)(
14411
+ return (0, import_react26.createElement)(
14293
14412
  component,
14294
14413
  {
14295
14414
  key: index,
@@ -14358,8 +14477,8 @@ var Error2 = ({ message }) => {
14358
14477
  };
14359
14478
  var ComponentTree = () => {
14360
14479
  const { error, nodes } = useEmbed();
14361
- const [children, setChildren] = (0, import_react26.useState)(/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Loading, {}));
14362
- (0, import_react26.useEffect)(() => {
14480
+ const [children, setChildren] = (0, import_react27.useState)(/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Loading, {}));
14481
+ (0, import_react27.useEffect)(() => {
14363
14482
  const renderer = createRenderer();
14364
14483
  setChildren(nodes.map(renderer));
14365
14484
  }, [nodes]);
@@ -14367,7 +14486,7 @@ var ComponentTree = () => {
14367
14486
  console.error(error);
14368
14487
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Error2, { message: error.message });
14369
14488
  }
14370
- if (import_react26.Children.count(children) === 0) {
14489
+ if (import_react27.Children.count(children) === 0) {
14371
14490
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Loading, {});
14372
14491
  }
14373
14492
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children });