@schematichq/schematic-react 0.2.0-rc.4 → 0.2.0-rc.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -864,9 +864,8 @@ __export(src_exports, {
864
864
  IncludedFeatures: () => IncludedFeatures,
865
865
  Invoices: () => Invoices,
866
866
  MeteredFeatures: () => MeteredFeatures,
867
- OverlayHeader: () => OverlayHeader,
868
- OverlaySideBar: () => OverlaySideBar,
869
- OverlayWrapper: () => OverlayWrapper,
867
+ Modal: () => Modal,
868
+ ModalHeader: () => ModalHeader,
870
869
  PaymentMethod: () => PaymentMethod,
871
870
  PlanManager: () => PlanManager,
872
871
  ProgressBar: () => ProgressBar,
@@ -6236,6 +6235,11 @@ var Qe = function() {
6236
6235
  }();
6237
6236
  var et = import_react.default.createContext(void 0);
6238
6237
  var tt = et.Consumer;
6238
+ function nt() {
6239
+ var e = (0, import_react.useContext)(et);
6240
+ if (!e) throw he(18);
6241
+ return e;
6242
+ }
6239
6243
  function ot(e) {
6240
6244
  var n = import_react.default.useContext(et), r2 = (0, import_react.useMemo)(function() {
6241
6245
  return function(e2, n2) {
@@ -6383,6 +6387,12 @@ function ft(n) {
6383
6387
  }
6384
6388
  return import_react.default.memo(l2);
6385
6389
  }
6390
+ function mt(t) {
6391
+ for (var n = [], o2 = 1; o2 < arguments.length; o2++) n[o2 - 1] = arguments[o2];
6392
+ "undefined" != typeof navigator && "ReactNative" === navigator.product && console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.");
6393
+ var r2 = ae(lt.apply(void 0, __spreadArray([t], n, false))), s2 = $(r2);
6394
+ return new We(s2, r2);
6395
+ }
6386
6396
  var vt = function() {
6387
6397
  function e() {
6388
6398
  var e2 = this;
@@ -7351,6 +7361,7 @@ function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7351
7361
  environmentId: json["environment_id"],
7352
7362
  externalId: json["external_id"],
7353
7363
  id: json["id"],
7364
+ paymentMethodExternalId: json["payment_method_external_id"] == null ? void 0 : json["payment_method_external_id"],
7354
7365
  subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
7355
7366
  subtotal: json["subtotal"],
7356
7367
  updatedAt: new Date(json["updated_at"])
@@ -8002,8 +8013,8 @@ function parseEditorState(data) {
8002
8013
  return arr;
8003
8014
  }
8004
8015
  async function fetchComponent(id, api) {
8005
- const settings = { ...defaultSettings };
8006
8016
  const nodes = [];
8017
+ const settings = { ...defaultSettings };
8007
8018
  const response = await api.hydrateComponent({ componentId: id });
8008
8019
  const { data } = response;
8009
8020
  if (data.component?.ast) {
@@ -8117,9 +8128,11 @@ var EmbedProvider = ({
8117
8128
  const setData = (0, import_react2.useCallback)(
8118
8129
  (data) => {
8119
8130
  setState((prev2) => {
8120
- const updated = { ...prev2 };
8121
- (0, import_lodash.default)(updated.data, data);
8122
- return updated;
8131
+ const updatedData = (0, import_lodash.default)({}, prev2.data, { ...data });
8132
+ return {
8133
+ ...prev2,
8134
+ data: updatedData
8135
+ };
8123
8136
  });
8124
8137
  },
8125
8138
  [setState]
@@ -8127,9 +8140,11 @@ var EmbedProvider = ({
8127
8140
  const updateSettings = (0, import_react2.useCallback)(
8128
8141
  (settings) => {
8129
8142
  setState((prev2) => {
8130
- const updated = { ...prev2 };
8131
- (0, import_lodash.default)(updated.settings, settings);
8132
- return updated;
8143
+ const updatedSettings = (0, import_lodash.default)({}, prev2.settings, { ...settings });
8144
+ return {
8145
+ ...prev2,
8146
+ settings: updatedSettings
8147
+ };
8133
8148
  });
8134
8149
  },
8135
8150
  [setState]
@@ -9151,7 +9166,7 @@ var useSchematicFlag = (key, opts) => {
9151
9166
  };
9152
9167
 
9153
9168
  // src/components/elements/plan-manager/PlanManager.tsx
9154
- var import_react8 = require("react");
9169
+ var import_react10 = require("react");
9155
9170
  var import_react_dom = require("react-dom");
9156
9171
 
9157
9172
  // src/utils/color.ts
@@ -9515,13 +9530,115 @@ var IconRound = ({
9515
9530
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Container, { $size: size, $variant: variant, $colors: colors, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon2, { name }) });
9516
9531
  };
9517
9532
 
9533
+ // src/components/ui/modal/Modal.tsx
9534
+ var import_react6 = require("react");
9535
+ var import_jsx_runtime6 = require("react/jsx-runtime");
9536
+ var Modal = ({ children, onClose }) => {
9537
+ const theme = nt();
9538
+ const { setLayout } = useEmbed();
9539
+ const ref = (0, import_react6.useRef)(null);
9540
+ const handleClose = (0, import_react6.useCallback)(() => {
9541
+ setLayout("portal");
9542
+ onClose?.();
9543
+ }, [setLayout, onClose]);
9544
+ (0, import_react6.useEffect)(() => {
9545
+ ref.current?.focus();
9546
+ }, []);
9547
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9548
+ Box,
9549
+ {
9550
+ ref,
9551
+ tabIndex: 0,
9552
+ onClick: (event) => {
9553
+ if (event.target === event.currentTarget) {
9554
+ handleClose();
9555
+ }
9556
+ },
9557
+ onKeyDown: (event) => {
9558
+ if (event.key === "Escape") {
9559
+ handleClose();
9560
+ }
9561
+ },
9562
+ $position: "absolute",
9563
+ $top: "50%",
9564
+ $left: "50%",
9565
+ $zIndex: "999999",
9566
+ $transform: "translate(-50%, -50%)",
9567
+ $width: "100%",
9568
+ $height: "100%",
9569
+ $backgroundColor: hexToHSL(theme.card.background).l > 50 ? darken(theme.card.background, 15) : lighten(theme.card.background, 15),
9570
+ $overflow: "hidden",
9571
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9572
+ Flex,
9573
+ {
9574
+ $position: "relative",
9575
+ $top: "50%",
9576
+ $left: "50%",
9577
+ $transform: "translate(-50%, -50%)",
9578
+ $flexDirection: "column",
9579
+ $overflow: "hidden",
9580
+ $width: "calc(100% - 5rem)",
9581
+ $height: "calc(100% - 5rem)",
9582
+ $backgroundColor: hexToHSL(theme.card.background).l > 50 ? darken(theme.card.background, 2.5) : lighten(theme.card.background, 2.5),
9583
+ $borderRadius: "0.5rem",
9584
+ $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
9585
+ id: "select-plan-dialog",
9586
+ role: "dialog",
9587
+ "aria-labelledby": "select-plan-dialog-label",
9588
+ "aria-modal": "true",
9589
+ children
9590
+ }
9591
+ )
9592
+ }
9593
+ );
9594
+ };
9595
+
9596
+ // src/components/ui/modal/ModalHeader.tsx
9597
+ var import_react7 = require("react");
9598
+ var import_jsx_runtime7 = require("react/jsx-runtime");
9599
+ var ModalHeader = ({ children, onClose }) => {
9600
+ const theme = nt();
9601
+ const { setLayout } = useEmbed();
9602
+ const handleClose = (0, import_react7.useCallback)(() => {
9603
+ setLayout("portal");
9604
+ onClose?.();
9605
+ }, [setLayout, onClose]);
9606
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
9607
+ Flex,
9608
+ {
9609
+ $justifyContent: "space-between",
9610
+ $alignItems: "center",
9611
+ $gap: "1rem",
9612
+ $height: "3.75rem",
9613
+ $padding: "0 0.625rem 0 2.5rem",
9614
+ $backgroundColor: theme.card.background,
9615
+ $borderBottomWidth: "1px",
9616
+ $borderBottomStyle: "solid",
9617
+ $borderBottomColor: hexToHSL(theme.card.background).l > 50 ? darken(theme.card.background, 15) : lighten(theme.card.background, 15),
9618
+ children: [
9619
+ children,
9620
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box, { $cursor: "pointer", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
9621
+ Icon2,
9622
+ {
9623
+ name: "close",
9624
+ style: {
9625
+ fontSize: 36,
9626
+ color: hexToHSL(theme.card.background).l > 50 ? darken(theme.card.background, 27.5) : lighten(theme.card.background, 27.5)
9627
+ }
9628
+ }
9629
+ ) })
9630
+ ]
9631
+ }
9632
+ );
9633
+ };
9634
+
9518
9635
  // src/components/ui/progress-bar/styles.ts
9519
9636
  var Container2 = dt(Flex)`
9520
9637
  position: relative;
9521
9638
  `;
9522
9639
 
9523
9640
  // src/components/ui/progress-bar/ProgressBar.tsx
9524
- var import_jsx_runtime6 = require("react/jsx-runtime");
9641
+ var import_jsx_runtime8 = require("react/jsx-runtime");
9525
9642
  var ProgressBar = ({
9526
9643
  progress,
9527
9644
  value,
@@ -9537,21 +9654,21 @@ var ProgressBar = ({
9537
9654
  orange: "#DB6769",
9538
9655
  red: "#EF4444"
9539
9656
  };
9540
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9657
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9541
9658
  Container2,
9542
9659
  {
9543
9660
  $alignItems: "center",
9544
9661
  $gap: `${16 / TEXT_BASE_SIZE}rem`,
9545
9662
  ...props,
9546
9663
  children: [
9547
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9664
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9548
9665
  Flex,
9549
9666
  {
9550
9667
  $position: "relative",
9551
9668
  $alignItems: "center",
9552
9669
  $width: `${barWidth}`,
9553
9670
  $maxWidth: "100%",
9554
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9671
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9555
9672
  Flex,
9556
9673
  {
9557
9674
  $position: "relative",
@@ -9560,7 +9677,7 @@ var ProgressBar = ({
9560
9677
  $height: `${8 / TEXT_BASE_SIZE}rem`,
9561
9678
  $background: "#F2F4F7",
9562
9679
  $borderRadius: "9999px",
9563
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9680
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9564
9681
  Box,
9565
9682
  {
9566
9683
  $width: `${Math.min(progress, 100)}%`,
@@ -9573,7 +9690,7 @@ var ProgressBar = ({
9573
9690
  )
9574
9691
  }
9575
9692
  ),
9576
- total !== 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { $size: 14, $weight: 500, children: [
9693
+ total !== 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { $size: 14, $weight: 500, children: [
9577
9694
  value,
9578
9695
  "/",
9579
9696
  total
@@ -9584,10 +9701,10 @@ var ProgressBar = ({
9584
9701
  };
9585
9702
 
9586
9703
  // src/components/elements/plan-manager/CheckoutDialog.tsx
9587
- var import_react7 = require("react");
9704
+ var import_react9 = require("react");
9588
9705
 
9589
9706
  // src/components/elements/plan-manager/PaymentForm.tsx
9590
- var import_react6 = require("react");
9707
+ var import_react8 = require("react");
9591
9708
  var import_react_stripe_js2 = require("@stripe/react-stripe-js");
9592
9709
  var import_react_stripe_js3 = require("@stripe/react-stripe-js");
9593
9710
 
@@ -9599,7 +9716,18 @@ var StyledButton = dt(Button2)`
9599
9716
  width: 100%;
9600
9717
  ${({ disabled, $color = "primary", theme }) => {
9601
9718
  const { l: l2 } = hexToHSL(theme[$color]);
9602
- const textColor = disabled ? "#989898" : l2 > 50 ? "#000000" : "#FFFFFF";
9719
+ let textColor;
9720
+ let colorFn;
9721
+ if (l2 > 50) {
9722
+ textColor = "#000000";
9723
+ colorFn = lighten;
9724
+ } else {
9725
+ textColor = "#FFFFFF";
9726
+ colorFn = darken;
9727
+ }
9728
+ if (disabled) {
9729
+ textColor = colorFn(textColor, 42.5);
9730
+ }
9603
9731
  return lt`
9604
9732
  color: ${textColor};
9605
9733
 
@@ -9610,35 +9738,47 @@ var StyledButton = dt(Button2)`
9610
9738
  }};
9611
9739
 
9612
9740
  ${({ disabled, $color = "primary", theme, $variant = "filled" }) => {
9613
- const color = disabled ? "#EEEEEE" : theme[$color];
9741
+ let color = theme[$color];
9742
+ if (disabled) {
9743
+ const { l: l2 } = hexToHSL(theme.card.background);
9744
+ color = hslToHex({ h: 0, s: 0, l: l2 });
9745
+ color = l2 > 50 ? darken(color, 7.5) : lighten(color, 7.5);
9746
+ }
9614
9747
  return $variant === "filled" ? lt`
9615
9748
  background-color: ${color};
9616
9749
  border-color: ${color};
9617
9750
  ` : lt`
9618
9751
  background-color: transparent;
9619
- border-color: #d2d2d2;
9620
- color: #194bfb;
9752
+ border-color: ${color};
9753
+ color: ${color};
9754
+
9621
9755
  ${Text} {
9622
- color: #194bfb;
9756
+ color: ${color};
9623
9757
  }
9624
9758
  `;
9625
9759
  }}
9626
9760
 
9627
- &:hover {
9628
- ${({ disabled }) => disabled && "cursor: not-allowed;"}
9629
- ${({ disabled, $color = "primary", theme, $variant = "filled" }) => {
9761
+ &:disabled:hover {
9762
+ cursor: not-allowed;
9763
+ }
9764
+
9765
+ &:not(:disabled):hover {
9766
+ ${({ $color = "primary", theme, $variant = "filled" }) => {
9630
9767
  const specified = theme[$color];
9631
9768
  const lightened = lighten(specified, 15);
9632
- const color = disabled ? "#EEEEEE" : specified === lightened ? darken(specified, 15) : lightened;
9769
+ const color = specified === lightened ? darken(specified, 15) : lightened;
9770
+ const { l: l2 } = hexToHSL(theme[$color]);
9771
+ const textColor = l2 > 50 ? "#000000" : "#FFFFFF";
9633
9772
  return $variant === "filled" ? lt`
9634
9773
  background-color: ${color};
9635
9774
  border-color: ${color};
9636
9775
  ` : lt`
9637
9776
  background-color: ${color};
9638
9777
  border-color: ${color};
9639
- color: #ffffff;
9778
+ color: ${textColor};
9779
+
9640
9780
  ${Text} {
9641
- color: #ffffff;
9781
+ color: ${textColor};
9642
9782
  }
9643
9783
  `;
9644
9784
  }}
@@ -9669,14 +9809,14 @@ var StyledButton = dt(Button2)`
9669
9809
  `;
9670
9810
 
9671
9811
  // src/components/elements/plan-manager/PaymentForm.tsx
9672
- var import_jsx_runtime7 = require("react/jsx-runtime");
9812
+ var import_jsx_runtime9 = require("react/jsx-runtime");
9673
9813
  var PaymentForm = ({ plan, period, onConfirm }) => {
9674
9814
  const stripe = (0, import_react_stripe_js3.useStripe)();
9675
9815
  const elements = (0, import_react_stripe_js3.useElements)();
9676
9816
  const { api, data } = useEmbed();
9677
- const [message, setMessage] = (0, import_react6.useState)(null);
9678
- const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
9679
- const [isConfirmed, setIsConfirmed] = (0, import_react6.useState)(false);
9817
+ const [message, setMessage] = (0, import_react8.useState)(null);
9818
+ const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
9819
+ const [isConfirmed, setIsConfirmed] = (0, import_react8.useState)(false);
9680
9820
  const handleSubmit = async (event) => {
9681
9821
  event.preventDefault();
9682
9822
  const priceId = period === "month" ? plan.monthlyPrice?.id : plan.yearlyPrice?.id;
@@ -9700,8 +9840,6 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
9700
9840
  }
9701
9841
  if (error?.type === "card_error" || error?.type === "validation_error") {
9702
9842
  setMessage(error.message);
9703
- } else {
9704
- setMessage("An unexpected error occured.");
9705
9843
  }
9706
9844
  setIsLoading(false);
9707
9845
  } catch (error) {
@@ -9713,7 +9851,7 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
9713
9851
  setIsLoading(false);
9714
9852
  }
9715
9853
  };
9716
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
9854
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
9717
9855
  "form",
9718
9856
  {
9719
9857
  id: "payment-form",
@@ -9726,27 +9864,15 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
9726
9864
  overflowY: "auto"
9727
9865
  },
9728
9866
  children: [
9729
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
9730
- Box,
9731
- {
9732
- $fontSize: "18px",
9733
- $marginBottom: "1.5rem",
9734
- $display: "inline-block",
9735
- $width: "100%",
9736
- children: [
9737
- "Add payment method",
9738
- " "
9739
- ]
9740
- }
9741
- ),
9742
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
9867
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { $width: "100%", $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { $size: 18, children: "Add payment method" }) }),
9868
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
9743
9869
  Flex,
9744
9870
  {
9745
9871
  $flexDirection: "column",
9746
9872
  $gap: "1.5rem",
9747
9873
  $marginBottom: "1.5rem",
9748
9874
  $width: "100%",
9749
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
9875
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
9750
9876
  import_react_stripe_js2.LinkAuthenticationElement,
9751
9877
  {
9752
9878
  id: "link-authentication-element"
@@ -9754,18 +9880,18 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
9754
9880
  )
9755
9881
  }
9756
9882
  ),
9757
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Flex, { $flexDirection: "column", $width: "100%", $flex: "1", $height: "100%", children: [
9758
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_stripe_js2.PaymentElement, { id: "payment-element" }),
9759
- message && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { id: "payment-message", children: message })
9883
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Flex, { $flexDirection: "column", $width: "100%", $flex: "1", $height: "100%", children: [
9884
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_stripe_js2.PaymentElement, { id: "payment-element" }),
9885
+ message && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { id: "payment-message", children: message })
9760
9886
  ] }),
9761
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
9887
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
9762
9888
  StyledButton,
9763
9889
  {
9764
9890
  id: "submit",
9765
9891
  disabled: isLoading || !stripe || !elements || !data.stripeEmbed?.publishableKey || !data.stripeEmbed?.setupIntentClientSecret || isConfirmed,
9766
9892
  $size: "md",
9767
9893
  $color: "primary",
9768
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: "button-text", children: isLoading ? "Loading" : "Save payment method" })
9894
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { id: "button-text", children: !isLoading ? "Loading" : "Save payment method" })
9769
9895
  }
9770
9896
  ) })
9771
9897
  ]
@@ -9774,396 +9900,60 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
9774
9900
  };
9775
9901
 
9776
9902
  // src/components/elements/plan-manager/CheckoutDialog.tsx
9777
- var import_jsx_runtime8 = require("react/jsx-runtime");
9778
- var OverlayHeader = ({
9779
- children,
9780
- onClose
9781
- }) => {
9782
- const { setLayout } = useEmbed();
9783
- const handleClose = (0, import_react7.useCallback)(() => {
9784
- setLayout("portal");
9785
- onClose?.();
9786
- }, [setLayout, onClose]);
9787
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9788
- Flex,
9789
- {
9790
- $paddingLeft: "2.5rem",
9791
- $paddingRight: "2.5rem",
9792
- $padding: ".75rem 2.5rem",
9793
- $flexDirection: "row",
9794
- $justifyContent: "space-between",
9795
- $alignItems: "center",
9796
- $borderBottom: "1px solid #DEDEDE",
9797
- $gap: "1rem",
9798
- $backgroundColor: "#FFFFFF",
9799
- $borderRadius: ".5rem .5rem 0 0",
9800
- children: [
9801
- children,
9802
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $cursor: "pointer", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } }) }) })
9803
- ]
9804
- }
9805
- );
9806
- };
9807
- var OverlayWrapper = ({
9808
- children,
9809
- size = "lg",
9810
- onClose
9811
- }) => {
9812
- const { setLayout } = useEmbed();
9813
- const ref = (0, import_react7.useRef)(null);
9814
- const sizeWidthMap = {
9815
- md: "700px",
9816
- lg: "75%"
9817
- };
9818
- const sizeHeighthMap = {
9819
- md: "auto",
9820
- lg: "75%"
9821
- };
9822
- const sizeMaxWidthMap = {
9823
- md: "auto",
9824
- lg: "1140px"
9825
- };
9826
- const handleClose = (0, import_react7.useCallback)(() => {
9827
- setLayout("portal");
9828
- onClose?.();
9829
- }, [setLayout, onClose]);
9830
- (0, import_react7.useEffect)(() => {
9831
- ref.current?.focus();
9832
- }, []);
9833
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9834
- Box,
9835
- {
9836
- ref,
9837
- tabIndex: 0,
9838
- onClick: (event) => {
9839
- if (event.target === event.currentTarget) {
9840
- handleClose();
9841
- }
9842
- },
9843
- onKeyDown: (event) => {
9844
- if (event.key === "Escape") {
9845
- handleClose();
9846
- }
9847
- },
9848
- $position: "absolute",
9849
- $top: "50%",
9850
- $left: "50%",
9851
- $zIndex: "999999",
9852
- $transform: "translate(-50%, -50%)",
9853
- $width: "100%",
9854
- $height: "100%",
9855
- $backgroundColor: "#D9D9D9",
9856
- $overflow: "hidden",
9857
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9858
- Flex,
9859
- {
9860
- $position: "relative",
9861
- $top: "50%",
9862
- $left: "50%",
9863
- $transform: "translate(-50%, -50%)",
9864
- $flexDirection: "column",
9865
- $maxWidth: sizeMaxWidthMap[size],
9866
- $width: sizeWidthMap[size],
9867
- $height: sizeHeighthMap[size],
9868
- $backgroundColor: "#FBFBFB",
9869
- $borderBottom: "1px solid #DEDEDE",
9870
- $borderRadius: "8px",
9871
- $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
9872
- id: "select-plan-dialog",
9873
- role: "dialog",
9874
- "aria-labelledby": "select-plan-dialog-label",
9875
- "aria-modal": "true",
9876
- children
9877
- }
9878
- )
9879
- }
9903
+ var import_jsx_runtime10 = require("react/jsx-runtime");
9904
+ var CheckoutDialog = () => {
9905
+ const [checkoutStage, setCheckoutStage] = (0, import_react9.useState)(
9906
+ "plan"
9880
9907
  );
9881
- };
9882
- var OverlaySideBar = ({
9883
- pricePeriod,
9884
- setPricePeriod,
9885
- checkoutStage,
9886
- setCheckoutStage,
9887
- currentPlan,
9888
- selectedPlan,
9889
- paymentMethodId
9890
- }) => {
9891
- const { api } = useEmbed();
9892
- const savingsPercentage = (0, import_react7.useMemo)(() => {
9893
- if (selectedPlan && pricePeriod === "month") {
9908
+ const [planPeriod, setPlanPeriod] = (0, import_react9.useState)("month");
9909
+ const [selectedPlan, setSelectedPlan] = (0, import_react9.useState)();
9910
+ const [paymentMethodId, setPaymentMethodId] = (0, import_react9.useState)();
9911
+ const [isLoading, setIsLoading] = (0, import_react9.useState)(false);
9912
+ const [isCheckoutComplete, setIsCheckoutComplete] = (0, import_react9.useState)(false);
9913
+ const theme = nt();
9914
+ const { api, data, settings } = useEmbed();
9915
+ const { currentPlan, availablePlans } = (0, import_react9.useMemo)(() => {
9916
+ return {
9917
+ currentPlan: data.company?.plan,
9918
+ availablePlans: data.activePlans
9919
+ };
9920
+ }, [data.company, data.activePlans]);
9921
+ const savingsPercentage = (0, import_react9.useMemo)(() => {
9922
+ if (selectedPlan) {
9894
9923
  const monthly = (selectedPlan?.monthlyPrice?.price || 0) * 12;
9895
9924
  const yearly = selectedPlan?.yearlyPrice?.price || 0;
9896
9925
  return Math.round((monthly - yearly) / monthly * 1e4) / 100;
9897
9926
  }
9898
9927
  return 0;
9899
- }, [selectedPlan, pricePeriod]);
9900
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9901
- Flex,
9902
- {
9903
- $flexDirection: "column",
9904
- $background: "white",
9905
- $borderRadius: "0 0 0.5rem",
9906
- $maxWidth: "275px",
9907
- $height: "100%",
9908
- $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
9909
- children: [
9910
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9911
- Flex,
9928
+ }, [selectedPlan]);
9929
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Modal, { children: [
9930
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ModalHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Flex, { $gap: "1rem", children: !isCheckoutComplete && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
9931
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { $gap: "0.5rem", $alignItems: "center", children: [
9932
+ checkoutStage === "plan" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9933
+ Box,
9912
9934
  {
9913
- $flexDirection: "column",
9914
- $position: "relative",
9915
- $gap: "1rem",
9916
- $width: "100%",
9917
- $height: "auto",
9918
- $padding: "1.5rem",
9919
- $borderBottom: "1px solid #DEDEDE",
9920
- children: [
9921
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $flexDirection: "row", $justifyContent: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 20, $weight: 600, children: "Subscription" }) }),
9922
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9923
- Flex,
9924
- {
9925
- $flexDirection: "row",
9926
- $border: "1px solid #D9D9D9",
9927
- $borderRadius: "40px",
9928
- $fontSize: "12px",
9929
- $textAlign: "center",
9930
- $cursor: "pointer",
9931
- children: [
9932
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9933
- Box,
9934
- {
9935
- onClick: () => setPricePeriod("month"),
9936
- $padding: ".25rem .5rem",
9937
- $flex: "1",
9938
- $fontWeight: pricePeriod === "month" ? "600" : "400",
9939
- $backgroundColor: pricePeriod === "month" ? "#DDDDDD" : "white",
9940
- $borderRadius: "40px",
9941
- children: "Billed monthly"
9942
- }
9943
- ),
9944
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9945
- Box,
9946
- {
9947
- onClick: () => setPricePeriod("year"),
9948
- $padding: ".25rem .5rem",
9949
- $flex: "1",
9950
- $fontWeight: pricePeriod === "year" ? "600" : "400",
9951
- $backgroundColor: pricePeriod === "year" ? "#DDDDDD" : "white",
9952
- $borderRadius: "40px",
9953
- children: "Billed yearly"
9954
- }
9955
- )
9956
- ]
9957
- }
9958
- ),
9959
- savingsPercentage > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { $fontSize: "11px", $color: "#194BFB", children: [
9960
- "Save up to ",
9961
- savingsPercentage,
9962
- "% with yearly billing"
9963
- ] })
9964
- ]
9935
+ $width: "0.9375rem",
9936
+ $height: "0.9375rem",
9937
+ $borderWidth: "2px",
9938
+ $borderStyle: "solid",
9939
+ $borderColor: hexToHSL(theme.card.background).l > 50 ? darken(theme.card.background, 12.5) : lighten(theme.card.background, 12.5),
9940
+ $borderRadius: "9999px"
9941
+ }
9942
+ ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9943
+ IconRound,
9944
+ {
9945
+ name: "check",
9946
+ style: {
9947
+ color: theme.card.background,
9948
+ backgroundColor: hexToHSL(theme.card.background).l > 50 ? darken(theme.card.background, 12.5) : lighten(theme.card.background, 12.5),
9949
+ fontSize: 16,
9950
+ width: "1rem",
9951
+ height: "1rem"
9952
+ }
9965
9953
  }
9966
9954
  ),
9967
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9968
- Flex,
9969
- {
9970
- $flexDirection: "column",
9971
- $position: "relative",
9972
- $gap: "1rem",
9973
- $width: "100%",
9974
- $height: "auto",
9975
- $padding: "1.5rem",
9976
- $flex: "1",
9977
- $borderBottom: "1px solid #DEDEDE",
9978
- children: [
9979
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $fontSize: "14px", $color: "#5D5D5D", children: "Plan" }),
9980
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9981
- Flex,
9982
- {
9983
- $flexDirection: "column",
9984
- $fontSize: "14px",
9985
- $color: "#5D5D5D",
9986
- $gap: ".5rem",
9987
- children: [
9988
- currentPlan && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9989
- Flex,
9990
- {
9991
- $flexDirection: "row",
9992
- $alignItems: "center",
9993
- $justifyContent: "space-between",
9994
- $fontSize: "14px",
9995
- $color: "#5D5D5D",
9996
- children: [
9997
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $fontSize: "14px", $color: "#5D5D5D", children: currentPlan.name }),
9998
- typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $fontSize: "12px", $color: "#000000", children: [
9999
- formatCurrency(currentPlan.planPrice),
10000
- "/",
10001
- currentPlan.planPeriod
10002
- ] })
10003
- ]
10004
- }
10005
- ),
10006
- selectedPlan && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
10007
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10008
- Box,
10009
- {
10010
- $width: "100%",
10011
- $textAlign: "left",
10012
- $opacity: "50%",
10013
- $marginBottom: "-.25rem",
10014
- $marginTop: "-.25rem",
10015
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10016
- Icon2,
10017
- {
10018
- name: "arrow-down",
10019
- style: {
10020
- display: "inline-block"
10021
- }
10022
- }
10023
- )
10024
- }
10025
- ),
10026
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
10027
- Flex,
10028
- {
10029
- $flexDirection: "row",
10030
- $alignItems: "center",
10031
- $justifyContent: "space-between",
10032
- $fontSize: "14px",
10033
- $color: "#5D5D5D",
10034
- children: [
10035
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $fontSize: "14px", $color: "#000000", $fontWeight: "600", children: selectedPlan.name }),
10036
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $fontSize: "12px", $color: "#000000", children: [
10037
- formatCurrency(
10038
- (pricePeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
10039
- ),
10040
- "/",
10041
- pricePeriod
10042
- ] })
10043
- ]
10044
- }
10045
- )
10046
- ] })
10047
- ]
10048
- }
10049
- )
10050
- ]
10051
- }
10052
- ),
10053
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
10054
- Flex,
10055
- {
10056
- $flexDirection: "column",
10057
- $position: "relative",
10058
- $gap: ".75rem",
10059
- $width: "100%",
10060
- $height: "auto",
10061
- $padding: "1.5rem",
10062
- children: [
10063
- selectedPlan && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
10064
- Flex,
10065
- {
10066
- $fontSize: "12px",
10067
- $color: "#5D5D5D",
10068
- $justifyContent: "space-between",
10069
- children: [
10070
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: [
10071
- "Monthly total:",
10072
- " "
10073
- ] }),
10074
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { $fontSize: "12px", $color: "#000000", children: [
10075
- formatCurrency(
10076
- (pricePeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
10077
- ),
10078
- "/",
10079
- pricePeriod
10080
- ] })
10081
- ]
10082
- }
10083
- ),
10084
- checkoutStage === "plan" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10085
- StyledButton,
10086
- {
10087
- $size: "sm",
10088
- onClick: () => {
10089
- setCheckoutStage("checkout");
10090
- },
10091
- ...!selectedPlan && { disabled: true },
10092
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: "0.5rem", $alignItems: "center", $justifyContent: "center", children: [
10093
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Next: Checkout" }),
10094
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon2, { name: "arrow-right" })
10095
- ] })
10096
- }
10097
- ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10098
- StyledButton,
10099
- {
10100
- disabled: !api || !selectedPlan || selectedPlan?.id === currentPlan?.id || !paymentMethodId,
10101
- onClick: async () => {
10102
- const priceId = (pricePeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.id;
10103
- if (!api || !selectedPlan || !priceId || !paymentMethodId) {
10104
- return;
10105
- }
10106
- await api.checkout({
10107
- changeSubscriptionRequestBody: {
10108
- newPlanId: selectedPlan.id,
10109
- newPriceId: priceId,
10110
- paymentMethodId
10111
- }
10112
- });
10113
- },
10114
- $size: "md",
10115
- children: "Pay now"
10116
- }
10117
- ),
10118
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Discounts & credits applied at checkout" })
10119
- ]
10120
- }
10121
- )
10122
- ]
10123
- }
10124
- );
10125
- };
10126
- var CheckoutDialog = () => {
10127
- const [checkoutStage, setCheckoutStage] = (0, import_react7.useState)(
10128
- "plan"
10129
- );
10130
- const [planPeriod, setPlanPeriod] = (0, import_react7.useState)("month");
10131
- const [selectedPlan, setSelectedPlan] = (0, import_react7.useState)();
10132
- const [paymentMethodId, setPaymentMethodId] = (0, import_react7.useState)();
10133
- const { data } = useEmbed();
10134
- const { currentPlan, availablePlans } = (0, import_react7.useMemo)(() => {
10135
- return {
10136
- currentPlan: data.company?.plan,
10137
- availablePlans: data.activePlans
10138
- };
10139
- }, [data.company, data.activePlans]);
10140
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(OverlayWrapper, { children: [
10141
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(OverlayHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: "1rem", children: [
10142
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "row", $gap: "0.5rem", $alignItems: "center", children: [
10143
- checkoutStage === "plan" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10144
- Box,
10145
- {
10146
- $width: "15px",
10147
- $height: "15px",
10148
- $backgroundColor: "white",
10149
- $border: "2px solid #DDDDDD",
10150
- $borderRadius: "999px"
10151
- }
10152
- ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10153
- IconRound,
10154
- {
10155
- name: "check",
10156
- style: {
10157
- color: "#FFFFFF",
10158
- backgroundColor: "#DDDDDD",
10159
- fontSize: 16,
10160
- width: "1rem",
10161
- height: "1rem"
10162
- }
10163
- }
10164
- ),
10165
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10166
- "div",
9955
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9956
+ Box,
10167
9957
  {
10168
9958
  tabIndex: 0,
10169
9959
  ...checkoutStage === "plan" ? {
@@ -10176,30 +9966,34 @@ var CheckoutDialog = () => {
10176
9966
  },
10177
9967
  onClick: () => setCheckoutStage("plan")
10178
9968
  },
10179
- children: "1. Select plan"
9969
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: "1. Select plan" })
10180
9970
  }
10181
9971
  ),
10182
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9972
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10183
9973
  Icon2,
10184
9974
  {
10185
9975
  name: "chevron-right",
10186
- style: { fontSize: 16, color: "#D0D0D0" }
9976
+ style: {
9977
+ fontSize: 16,
9978
+ color: hexToHSL(theme.card.background).l > 50 ? darken(theme.card.background, 17.5) : lighten(theme.card.background, 17.5)
9979
+ }
10187
9980
  }
10188
9981
  )
10189
9982
  ] }),
10190
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "row", $gap: "0.5rem", $alignItems: "center", children: [
10191
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9983
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { $gap: "0.5rem", $alignItems: "center", children: [
9984
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10192
9985
  Box,
10193
9986
  {
10194
- $width: "15px",
10195
- $height: "15px",
10196
- $border: "2px solid #DDDDDD",
10197
- $borderRadius: "999px",
10198
- $backgroundColor: "white"
9987
+ $width: "0.9375rem",
9988
+ $height: "0.9375rem",
9989
+ $borderWidth: "2px",
9990
+ $borderStyle: "solid",
9991
+ $borderColor: hexToHSL(theme.card.background).l > 50 ? darken(theme.card.background, 12.5) : lighten(theme.card.background, 12.5),
9992
+ $borderRadius: "9999px"
10199
9993
  }
10200
9994
  ),
10201
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10202
- "div",
9995
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9996
+ Box,
10203
9997
  {
10204
9998
  tabIndex: 0,
10205
9999
  ...checkoutStage === "checkout" && {
@@ -10207,36 +10001,51 @@ var CheckoutDialog = () => {
10207
10001
  fontWeight: "700"
10208
10002
  }
10209
10003
  },
10210
- children: "2. Checkout"
10004
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: "2. Checkout" })
10211
10005
  }
10212
10006
  )
10213
10007
  ] })
10214
- ] }) }),
10215
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "row", $height: "100%", children: [
10216
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
10008
+ ] }) }) }),
10009
+ isCheckoutComplete && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Flex, { $justifyContent: "center", $alignItems: "center", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10010
+ Text,
10011
+ {
10012
+ as: "h1",
10013
+ $font: theme.typography.heading1.fontFamily,
10014
+ $size: theme.typography.heading1.fontSize,
10015
+ $weight: theme.typography.heading1.fontWeight,
10016
+ $color: theme.typography.heading1.color,
10017
+ children: "Subscription updated!"
10018
+ }
10019
+ ) }),
10020
+ !isCheckoutComplete && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { $position: "relative", $flexGrow: "1", children: [
10021
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10217
10022
  Flex,
10218
10023
  {
10024
+ $position: "absolute",
10025
+ $top: "0",
10026
+ $left: "0",
10219
10027
  $flexDirection: "column",
10220
10028
  $gap: "1rem",
10221
10029
  $padding: "2rem 2.5rem 2rem 2.5rem",
10222
- $backgroundColor: "#FBFBFB",
10223
- $borderRadius: "0 0.5rem 0",
10030
+ $backgroundColor: darken(settings.theme.card.background, 2.5),
10224
10031
  $flex: "1",
10032
+ $width: "72.5%",
10225
10033
  $height: "100%",
10034
+ $overflow: "auto",
10226
10035
  children: [
10227
- checkoutStage === "plan" && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
10228
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $marginBottom: "1rem", children: [
10229
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10036
+ checkoutStage === "plan" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
10037
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $marginBottom: "1rem", children: [
10038
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10230
10039
  Text,
10231
10040
  {
10232
10041
  as: "h1",
10233
10042
  id: "select-plan-dialog-label",
10234
10043
  $size: 18,
10235
- $marginBottom: ".5rem",
10044
+ $marginBottom: "0.5rem",
10236
10045
  children: "Select plan"
10237
10046
  }
10238
10047
  ),
10239
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10048
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10240
10049
  Text,
10241
10050
  {
10242
10051
  as: "p",
@@ -10247,19 +10056,23 @@ var CheckoutDialog = () => {
10247
10056
  }
10248
10057
  )
10249
10058
  ] }),
10250
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $flexDirection: "row", $gap: "1rem", $flex: "1", $height: "100%", children: availablePlans?.map((plan) => {
10251
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
10059
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Flex, { $gap: "1rem", $flexGrow: "1", children: availablePlans?.map((plan) => {
10060
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10252
10061
  Flex,
10253
10062
  {
10254
10063
  $height: "100%",
10255
10064
  $flexDirection: "column",
10256
- $backgroundColor: "white",
10065
+ $backgroundColor: settings.theme.card.background,
10257
10066
  $flex: "1",
10258
- $border: `2px solid ${plan.id === selectedPlan?.id ? "#194BFB" : "transparent"}`,
10259
- $borderRadius: ".5rem",
10260
- $boxShadow: "0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 20px rgba(16, 24, 40, 0.06)",
10067
+ $outlineWidth: "2px",
10068
+ $outlineStyle: "solid",
10069
+ $outlineColor: plan.id === selectedPlan?.id ? theme.primary : "transparent",
10070
+ $borderRadius: `${settings.theme.card.borderRadius / 16}rem`,
10071
+ ...settings.theme.card.hasShadow && {
10072
+ $boxShadow: "0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 20px rgba(16, 24, 40, 0.06)"
10073
+ },
10261
10074
  children: [
10262
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
10075
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10263
10076
  Flex,
10264
10077
  {
10265
10078
  $flexDirection: "column",
@@ -10267,38 +10080,40 @@ var CheckoutDialog = () => {
10267
10080
  $gap: "1rem",
10268
10081
  $width: "100%",
10269
10082
  $height: "auto",
10270
- $padding: "2rem 1.5rem 1.5rem",
10271
- $borderBottom: "1px solid #DEDEDE",
10083
+ $padding: `${settings.theme.card.padding / 16}rem`,
10084
+ $borderBottomWidth: "1px",
10085
+ $borderStyle: "solid",
10086
+ $borderColor: hexToHSL(theme.card.background).l > 50 ? darken(theme.card.background, 17.5) : lighten(theme.card.background, 17.5),
10272
10087
  children: [
10273
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 20, $weight: 600, children: plan.name }),
10274
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 14, children: plan.description }),
10275
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { children: [
10276
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $display: "inline-block", $fontSize: "1.5rem", children: formatCurrency(
10088
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { $size: 20, $weight: 600, children: plan.name }),
10089
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { $size: 14, children: plan.description }),
10090
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { children: [
10091
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { $display: "inline-block", $fontSize: "1.5rem", children: formatCurrency(
10277
10092
  (planPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0
10278
10093
  ) }),
10279
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { $display: "inline-block", $fontSize: ".75rem", children: [
10094
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box, { $display: "inline-block", $fontSize: "0.75rem", children: [
10280
10095
  "/",
10281
10096
  planPeriod
10282
10097
  ] })
10283
10098
  ] }),
10284
- (plan.current || plan.id === currentPlan?.id) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10099
+ (plan.current || plan.id === currentPlan?.id) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10285
10100
  Flex,
10286
10101
  {
10287
10102
  $position: "absolute",
10288
10103
  $right: "1rem",
10289
10104
  $top: "1rem",
10290
- $fontSize: ".625rem",
10291
- $color: "white",
10292
- $backgroundColor: "#194BFB",
10293
- $borderRadius: "999px",
10294
- $padding: ".125rem .85rem",
10105
+ $fontSize: "0.625rem",
10106
+ $color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
10107
+ $backgroundColor: theme.primary,
10108
+ $borderRadius: "9999px",
10109
+ $padding: "0.125rem 0.85rem",
10295
10110
  children: "Current plan"
10296
10111
  }
10297
10112
  )
10298
10113
  ]
10299
10114
  }
10300
10115
  ),
10301
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10116
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10302
10117
  Flex,
10303
10118
  {
10304
10119
  $flexDirection: "column",
@@ -10309,21 +10124,32 @@ var CheckoutDialog = () => {
10309
10124
  $height: "auto",
10310
10125
  $padding: "1.5rem",
10311
10126
  children: plan.features.map((feature) => {
10312
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexShrink: "0", $gap: "1rem", children: [
10313
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10314
- IconRound,
10315
- {
10316
- name: feature.icon,
10317
- size: "tn",
10318
- colors: ["#000000", "#F5F5F5"]
10319
- }
10320
- ),
10321
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: ".75rem", $color: "#00000", children: feature.name }) })
10322
- ] }, feature.id);
10127
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10128
+ Flex,
10129
+ {
10130
+ $flexShrink: "0",
10131
+ $gap: "1rem",
10132
+ children: [
10133
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10134
+ IconRound,
10135
+ {
10136
+ name: feature.icon,
10137
+ size: "tn",
10138
+ colors: [
10139
+ settings.theme.primary,
10140
+ `${hexToHSL(settings.theme.card.background).l > 50 ? darken(settings.theme.card.background, 10) : lighten(settings.theme.card.background, 20)}`
10141
+ ]
10142
+ }
10143
+ ),
10144
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { $size: 12, children: feature.name }) })
10145
+ ]
10146
+ },
10147
+ feature.id
10148
+ );
10323
10149
  })
10324
10150
  }
10325
10151
  ),
10326
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
10152
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10327
10153
  Flex,
10328
10154
  {
10329
10155
  $flexDirection: "column",
@@ -10333,7 +10159,7 @@ var CheckoutDialog = () => {
10333
10159
  $height: "auto",
10334
10160
  $padding: "1.5rem",
10335
10161
  children: [
10336
- plan.id === selectedPlan?.id && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
10162
+ plan.id === selectedPlan?.id && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10337
10163
  Flex,
10338
10164
  {
10339
10165
  $justifyContent: "center",
@@ -10342,22 +10168,22 @@ var CheckoutDialog = () => {
10342
10168
  $fontSize: "0.9375rem",
10343
10169
  $padding: "0.625rem 0",
10344
10170
  children: [
10345
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10171
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10346
10172
  Icon2,
10347
10173
  {
10348
10174
  name: "check-rounded",
10349
10175
  style: {
10350
10176
  fontSize: 20,
10351
10177
  lineHeight: "1",
10352
- color: "#194BFB"
10178
+ color: theme.primary
10353
10179
  }
10354
10180
  }
10355
10181
  ),
10356
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10357
- "span",
10182
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10183
+ Text,
10358
10184
  {
10359
10185
  style: {
10360
- color: "#7B7B7B",
10186
+ color: hexToHSL(theme.card.background).l > 50 ? "#000000" : "#FFFFFF",
10361
10187
  lineHeight: "1.4"
10362
10188
  },
10363
10189
  children: "Selected"
@@ -10366,9 +10192,10 @@ var CheckoutDialog = () => {
10366
10192
  ]
10367
10193
  }
10368
10194
  ),
10369
- !(plan.current || plan.id === currentPlan?.id) && plan.id !== selectedPlan?.id && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10195
+ !(plan.current || plan.id === currentPlan?.id) && plan.id !== selectedPlan?.id && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10370
10196
  StyledButton,
10371
10197
  {
10198
+ disabled: plan.valid === false,
10372
10199
  $size: "sm",
10373
10200
  $color: "primary",
10374
10201
  $variant: "outline",
@@ -10387,7 +10214,7 @@ var CheckoutDialog = () => {
10387
10214
  );
10388
10215
  }) })
10389
10216
  ] }),
10390
- selectedPlan && checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10217
+ selectedPlan && checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10391
10218
  PaymentForm,
10392
10219
  {
10393
10220
  plan: selectedPlan,
@@ -10400,16 +10227,253 @@ var CheckoutDialog = () => {
10400
10227
  ]
10401
10228
  }
10402
10229
  ),
10403
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10404
- OverlaySideBar,
10230
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10231
+ Flex,
10405
10232
  {
10406
- pricePeriod: planPeriod,
10407
- setPricePeriod: setPlanPeriod,
10408
- checkoutStage,
10409
- setCheckoutStage,
10410
- currentPlan,
10411
- selectedPlan,
10412
- paymentMethodId
10233
+ $position: "absolute",
10234
+ $top: "0",
10235
+ $right: "0",
10236
+ $flexDirection: "column",
10237
+ $background: settings.theme.card.background,
10238
+ $borderRadius: "0 0 0.5rem",
10239
+ $width: "27.5%",
10240
+ $height: "100%",
10241
+ $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
10242
+ children: [
10243
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10244
+ Flex,
10245
+ {
10246
+ $flexDirection: "column",
10247
+ $position: "relative",
10248
+ $gap: "1rem",
10249
+ $width: "100%",
10250
+ $height: "auto",
10251
+ $padding: "1.5rem",
10252
+ $borderBottom: "1px solid #DEDEDE",
10253
+ children: [
10254
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Flex, { $justifyContent: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { $size: 20, $weight: 600, children: "Subscription" }) }),
10255
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10256
+ Flex,
10257
+ {
10258
+ $border: "1px solid #D9D9D9",
10259
+ $borderRadius: "2.5rem",
10260
+ $cursor: "pointer",
10261
+ children: [
10262
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10263
+ Flex,
10264
+ {
10265
+ onClick: () => setPlanPeriod("month"),
10266
+ $justifyContent: "center",
10267
+ $alignItems: "center",
10268
+ $padding: "0.25rem 0.5rem",
10269
+ $flex: "1",
10270
+ $backgroundColor: planPeriod === "month" ? darken(settings.theme.card.background, 8) : lighten(settings.theme.card.background, 2),
10271
+ $borderRadius: "2.5rem",
10272
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { $size: 12, $weight: planPeriod === "month" ? 600 : 400, children: "Billed monthly" })
10273
+ }
10274
+ ),
10275
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10276
+ Flex,
10277
+ {
10278
+ onClick: () => setPlanPeriod("year"),
10279
+ $justifyContent: "center",
10280
+ $alignItems: "center",
10281
+ $padding: "0.25rem 0.5rem",
10282
+ $flex: "1",
10283
+ $backgroundColor: planPeriod === "year" ? darken(settings.theme.card.background, 8) : lighten(settings.theme.card.background, 2),
10284
+ $borderRadius: "2.5rem",
10285
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { $size: 12, $weight: planPeriod === "year" ? 600 : 400, children: "Billed yearly" })
10286
+ }
10287
+ )
10288
+ ]
10289
+ }
10290
+ ),
10291
+ savingsPercentage > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { $size: 11, $color: "#194BFB", children: planPeriod === "month" ? `Save up to ${savingsPercentage}% with yearly billing` : `You are saving ${savingsPercentage}% with yearly billing` }) })
10292
+ ]
10293
+ }
10294
+ ),
10295
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10296
+ Flex,
10297
+ {
10298
+ $flexDirection: "column",
10299
+ $position: "relative",
10300
+ $gap: "1rem",
10301
+ $width: "100%",
10302
+ $height: "auto",
10303
+ $padding: "1.5rem",
10304
+ $flex: "1",
10305
+ $borderBottom: "1px solid #DEDEDE",
10306
+ children: [
10307
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { $size: 14, $color: "#5D5D5D", children: "Plan" }) }),
10308
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10309
+ Flex,
10310
+ {
10311
+ $flexDirection: "column",
10312
+ $fontSize: "0.875rem",
10313
+ $color: "#5D5D5D",
10314
+ $gap: "0.5rem",
10315
+ children: [
10316
+ currentPlan && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10317
+ Flex,
10318
+ {
10319
+ $alignItems: "center",
10320
+ $justifyContent: "space-between",
10321
+ $fontSize: "0.875rem",
10322
+ $color: "#5D5D5D",
10323
+ children: [
10324
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Flex, { $fontSize: "0.875rem", $color: "#5D5D5D", children: currentPlan.name }),
10325
+ typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { $fontSize: "0.75rem", $color: "#000000", children: [
10326
+ formatCurrency(currentPlan.planPrice),
10327
+ "/",
10328
+ currentPlan.planPeriod
10329
+ ] })
10330
+ ]
10331
+ }
10332
+ ),
10333
+ selectedPlan && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
10334
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10335
+ Box,
10336
+ {
10337
+ $width: "100%",
10338
+ $textAlign: "left",
10339
+ $opacity: "50%",
10340
+ $marginBottom: "-0.25rem",
10341
+ $marginTop: "-0.25rem",
10342
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10343
+ Icon2,
10344
+ {
10345
+ name: "arrow-down",
10346
+ style: {
10347
+ display: "inline-block"
10348
+ }
10349
+ }
10350
+ )
10351
+ }
10352
+ ),
10353
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10354
+ Flex,
10355
+ {
10356
+ $alignItems: "center",
10357
+ $justifyContent: "space-between",
10358
+ $fontSize: "0.875rem",
10359
+ $color: "#5D5D5D",
10360
+ children: [
10361
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10362
+ Flex,
10363
+ {
10364
+ $fontSize: "0.875rem",
10365
+ $color: "#000000",
10366
+ $fontWeight: "600",
10367
+ children: selectedPlan.name
10368
+ }
10369
+ ),
10370
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { $fontSize: "0.75rem", $color: "#000000", children: [
10371
+ formatCurrency(
10372
+ (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
10373
+ ),
10374
+ "/",
10375
+ planPeriod
10376
+ ] })
10377
+ ]
10378
+ }
10379
+ )
10380
+ ] })
10381
+ ]
10382
+ }
10383
+ )
10384
+ ]
10385
+ }
10386
+ ),
10387
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10388
+ Flex,
10389
+ {
10390
+ $flexDirection: "column",
10391
+ $position: "relative",
10392
+ $gap: "0.75rem",
10393
+ $width: "100%",
10394
+ $height: "auto",
10395
+ $padding: "1.5rem",
10396
+ children: [
10397
+ selectedPlan && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10398
+ Flex,
10399
+ {
10400
+ $fontSize: "0.75rem",
10401
+ $color: "#5D5D5D",
10402
+ $justifyContent: "space-between",
10403
+ children: [
10404
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box, { $fontSize: "0.75rem", $color: "#5D5D5D", children: [
10405
+ planPeriod === "month" ? "Monthly" : "Yearly",
10406
+ " total:",
10407
+ " "
10408
+ ] }),
10409
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box, { $fontSize: "0.75rem", $color: "#000000", children: [
10410
+ formatCurrency(
10411
+ (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
10412
+ ),
10413
+ "/",
10414
+ planPeriod
10415
+ ] })
10416
+ ]
10417
+ }
10418
+ ),
10419
+ checkoutStage === "plan" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10420
+ StyledButton,
10421
+ {
10422
+ disabled: !selectedPlan,
10423
+ onClick: () => {
10424
+ setCheckoutStage("checkout");
10425
+ },
10426
+ $size: "sm",
10427
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10428
+ Flex,
10429
+ {
10430
+ $gap: "0.5rem",
10431
+ $alignItems: "center",
10432
+ $justifyContent: "center",
10433
+ $padding: "0 1rem",
10434
+ children: [
10435
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { $align: "left", children: "Next: Checkout" }),
10436
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { name: "arrow-right" })
10437
+ ]
10438
+ }
10439
+ )
10440
+ }
10441
+ ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10442
+ StyledButton,
10443
+ {
10444
+ disabled: !api || !selectedPlan || selectedPlan?.id === currentPlan?.id || !paymentMethodId || isLoading,
10445
+ onClick: async () => {
10446
+ const priceId = (planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.id;
10447
+ if (!api || !selectedPlan || !priceId || !paymentMethodId) {
10448
+ return;
10449
+ }
10450
+ try {
10451
+ setIsLoading(true);
10452
+ setIsCheckoutComplete(false);
10453
+ await api.checkout({
10454
+ changeSubscriptionRequestBody: {
10455
+ newPlanId: selectedPlan.id,
10456
+ newPriceId: priceId,
10457
+ paymentMethodId
10458
+ }
10459
+ });
10460
+ setIsCheckoutComplete(true);
10461
+ } catch (error) {
10462
+ console.error(error);
10463
+ } finally {
10464
+ setIsCheckoutComplete(true);
10465
+ setIsLoading(false);
10466
+ }
10467
+ },
10468
+ $size: "md",
10469
+ children: "Pay now"
10470
+ }
10471
+ ),
10472
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { $fontSize: "0.75rem", $color: "#5D5D5D", children: "Discounts & credits applied at checkout" })
10473
+ ]
10474
+ }
10475
+ )
10476
+ ]
10413
10477
  }
10414
10478
  )
10415
10479
  ] })
@@ -10417,7 +10481,7 @@ var CheckoutDialog = () => {
10417
10481
  };
10418
10482
 
10419
10483
  // src/components/elements/plan-manager/PlanManager.tsx
10420
- var import_jsx_runtime9 = require("react/jsx-runtime");
10484
+ var import_jsx_runtime11 = require("react/jsx-runtime");
10421
10485
  var resolveDesignProps = (props) => {
10422
10486
  return {
10423
10487
  header: {
@@ -10446,23 +10510,23 @@ var resolveDesignProps = (props) => {
10446
10510
  }
10447
10511
  };
10448
10512
  };
10449
- var PlanManager = (0, import_react8.forwardRef)(({ children, className, portal, ...rest }, ref) => {
10513
+ var PlanManager = (0, import_react10.forwardRef)(({ children, className, portal, ...rest }, ref) => {
10450
10514
  const props = resolveDesignProps(rest);
10451
10515
  const { data, settings, layout, stripe, setLayout } = useEmbed();
10452
- const { currentPlan, canChangePlan } = (0, import_react8.useMemo)(() => {
10516
+ const { currentPlan, canChangePlan } = (0, import_react10.useMemo)(() => {
10453
10517
  return {
10454
10518
  currentPlan: data.company?.plan,
10455
10519
  canChangePlan: stripe !== null
10456
10520
  };
10457
10521
  }, [data.company, stripe]);
10458
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { ref, className, children: [
10459
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
10522
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ref, className, children: [
10523
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10460
10524
  Flex,
10461
10525
  {
10462
10526
  $flexDirection: "column",
10463
10527
  $gap: "0.75rem",
10464
10528
  ...canChangePlan && { $margin: "0 0 0.5rem" },
10465
- children: props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
10529
+ children: props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
10466
10530
  Flex,
10467
10531
  {
10468
10532
  $justifyContent: "space-between",
@@ -10470,8 +10534,8 @@ var PlanManager = (0, import_react8.forwardRef)(({ children, className, portal,
10470
10534
  $width: "100%",
10471
10535
  ...canChangePlan && { $margin: "0 0 1.5rem" },
10472
10536
  children: [
10473
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
10474
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { $margin: "0 0 0.75rem", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
10537
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
10538
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $margin: "0 0 0.75rem", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10475
10539
  Text,
10476
10540
  {
10477
10541
  $font: settings.theme.typography[props.header.title.fontStyle].fontFamily,
@@ -10482,7 +10546,7 @@ var PlanManager = (0, import_react8.forwardRef)(({ children, className, portal,
10482
10546
  children: currentPlan.name
10483
10547
  }
10484
10548
  ) }),
10485
- props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
10549
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10486
10550
  Text,
10487
10551
  {
10488
10552
  $font: settings.theme.typography[props.header.description.fontStyle].fontFamily,
@@ -10493,7 +10557,7 @@ var PlanManager = (0, import_react8.forwardRef)(({ children, className, portal,
10493
10557
  }
10494
10558
  )
10495
10559
  ] }),
10496
- props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
10560
+ props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
10497
10561
  Text,
10498
10562
  {
10499
10563
  $font: settings.theme.typography[props.header.price.fontStyle].fontFamily,
@@ -10512,7 +10576,7 @@ var PlanManager = (0, import_react8.forwardRef)(({ children, className, portal,
10512
10576
  )
10513
10577
  }
10514
10578
  ),
10515
- canChangePlan && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
10579
+ canChangePlan && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10516
10580
  StyledButton,
10517
10581
  {
10518
10582
  onClick: () => {
@@ -10520,7 +10584,7 @@ var PlanManager = (0, import_react8.forwardRef)(({ children, className, portal,
10520
10584
  },
10521
10585
  $size: props.callToAction.buttonSize,
10522
10586
  $color: props.callToAction.buttonStyle,
10523
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
10587
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10524
10588
  Text,
10525
10589
  {
10526
10590
  $font: settings.theme.typography.text.fontFamily,
@@ -10531,13 +10595,13 @@ var PlanManager = (0, import_react8.forwardRef)(({ children, className, portal,
10531
10595
  )
10532
10596
  }
10533
10597
  ),
10534
- canChangePlan && layout === "checkout" && (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckoutDialog, {}), portal || document.body)
10598
+ canChangePlan && layout === "checkout" && (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CheckoutDialog, {}), portal || document.body)
10535
10599
  ] });
10536
10600
  });
10537
10601
 
10538
10602
  // src/components/elements/included-features/IncludedFeatures.tsx
10539
- var import_react9 = require("react");
10540
- var import_jsx_runtime10 = require("react/jsx-runtime");
10603
+ var import_react11 = require("react");
10604
+ var import_jsx_runtime12 = require("react/jsx-runtime");
10541
10605
  function resolveDesignProps2(props) {
10542
10606
  return {
10543
10607
  header: {
@@ -10560,10 +10624,10 @@ function resolveDesignProps2(props) {
10560
10624
  }
10561
10625
  };
10562
10626
  }
10563
- var IncludedFeatures = (0, import_react9.forwardRef)(({ className, ...rest }, ref) => {
10627
+ var IncludedFeatures = (0, import_react11.forwardRef)(({ className, ...rest }, ref) => {
10564
10628
  const props = resolveDesignProps2(rest);
10565
10629
  const { data, settings } = useEmbed();
10566
- const features = (0, import_react9.useMemo)(() => {
10630
+ const features = (0, import_react11.useMemo)(() => {
10567
10631
  return (data.featureUsage?.features || []).map(
10568
10632
  ({
10569
10633
  access,
@@ -10590,8 +10654,8 @@ var IncludedFeatures = (0, import_react9.forwardRef)(({ className, ...rest }, re
10590
10654
  }
10591
10655
  );
10592
10656
  }, [data.featureUsage]);
10593
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: [
10594
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10657
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: [
10658
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10595
10659
  Text,
10596
10660
  {
10597
10661
  $font: settings.theme.typography[props.header.fontStyle].fontFamily,
@@ -10608,7 +10672,7 @@ var IncludedFeatures = (0, import_react9.forwardRef)(({ className, ...rest }, re
10608
10672
  }
10609
10673
  return [
10610
10674
  ...acc,
10611
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
10675
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
10612
10676
  Flex,
10613
10677
  {
10614
10678
  $flexWrap: "wrap",
@@ -10616,8 +10680,8 @@ var IncludedFeatures = (0, import_react9.forwardRef)(({ className, ...rest }, re
10616
10680
  $alignItems: "center",
10617
10681
  $gap: "1rem",
10618
10682
  children: [
10619
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { $gap: "1rem", children: [
10620
- props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10683
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $gap: "1rem", children: [
10684
+ props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10621
10685
  IconRound,
10622
10686
  {
10623
10687
  name: feature.icon,
@@ -10628,7 +10692,7 @@ var IncludedFeatures = (0, import_react9.forwardRef)(({ className, ...rest }, re
10628
10692
  ]
10629
10693
  }
10630
10694
  ),
10631
- feature?.name && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10695
+ feature?.name && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10632
10696
  Text,
10633
10697
  {
10634
10698
  $font: settings.theme.typography[props.icons.fontStyle].fontFamily,
@@ -10639,8 +10703,8 @@ var IncludedFeatures = (0, import_react9.forwardRef)(({ className, ...rest }, re
10639
10703
  }
10640
10704
  ) })
10641
10705
  ] }),
10642
- allocationType === "numeric" && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box, { $textAlign: "right", children: [
10643
- props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10706
+ allocationType === "numeric" && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box, { $textAlign: "right", children: [
10707
+ props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10644
10708
  Text,
10645
10709
  {
10646
10710
  as: Box,
@@ -10651,7 +10715,7 @@ var IncludedFeatures = (0, import_react9.forwardRef)(({ className, ...rest }, re
10651
10715
  children: typeof allocation === "number" ? `${allocation} ${feature.name}` : `Unlimited ${feature.name}`
10652
10716
  }
10653
10717
  ),
10654
- props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
10718
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10655
10719
  Text,
10656
10720
  {
10657
10721
  as: Box,
@@ -10675,8 +10739,8 @@ var IncludedFeatures = (0, import_react9.forwardRef)(({ className, ...rest }, re
10675
10739
  });
10676
10740
 
10677
10741
  // src/components/elements/metered-features/MeteredFeatures.tsx
10678
- var import_react10 = require("react");
10679
- var import_jsx_runtime11 = require("react/jsx-runtime");
10742
+ var import_react12 = require("react");
10743
+ var import_jsx_runtime13 = require("react/jsx-runtime");
10680
10744
  function resolveDesignProps3(props) {
10681
10745
  return {
10682
10746
  isVisible: props.isVisible ?? true,
@@ -10705,10 +10769,10 @@ function resolveDesignProps3(props) {
10705
10769
  }
10706
10770
  };
10707
10771
  }
10708
- var MeteredFeatures = (0, import_react10.forwardRef)(({ className, ...rest }, ref) => {
10772
+ var MeteredFeatures = (0, import_react12.forwardRef)(({ className, ...rest }, ref) => {
10709
10773
  const props = resolveDesignProps3(rest);
10710
10774
  const { data, settings } = useEmbed();
10711
- const features = (0, import_react10.useMemo)(() => {
10775
+ const features = (0, import_react12.useMemo)(() => {
10712
10776
  return (data.featureUsage?.features || []).map(
10713
10777
  ({
10714
10778
  access,
@@ -10735,19 +10799,19 @@ var MeteredFeatures = (0, import_react10.forwardRef)(({ className, ...rest }, re
10735
10799
  }
10736
10800
  );
10737
10801
  }, [data.featureUsage]);
10738
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: features.reduce(
10802
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: features.reduce(
10739
10803
  (acc, { allocation, allocationType, feature, usage }, index) => {
10740
10804
  if (!props.isVisible || allocationType !== "numeric" || typeof allocation !== "number") {
10741
10805
  return acc;
10742
10806
  }
10743
10807
  return [
10744
10808
  ...acc,
10745
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Flex, { $gap: "1.5rem", children: [
10746
- props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $flexShrink: "0", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconRound, { name: feature.icon, size: "sm" }) }),
10747
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box, { $flexGrow: "1", children: [
10748
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Flex, { children: [
10749
- feature?.name && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box, { $flexGrow: "1", children: [
10750
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10809
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $gap: "1.5rem", children: [
10810
+ props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { $flexShrink: "0", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconRound, { name: feature.icon, size: "sm" }) }),
10811
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box, { $flexGrow: "1", children: [
10812
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { children: [
10813
+ feature?.name && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box, { $flexGrow: "1", children: [
10814
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10751
10815
  Text,
10752
10816
  {
10753
10817
  as: Box,
@@ -10758,7 +10822,7 @@ var MeteredFeatures = (0, import_react10.forwardRef)(({ className, ...rest }, re
10758
10822
  children: feature.name
10759
10823
  }
10760
10824
  ),
10761
- props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10825
+ props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10762
10826
  Text,
10763
10827
  {
10764
10828
  as: Box,
@@ -10770,8 +10834,8 @@ var MeteredFeatures = (0, import_react10.forwardRef)(({ className, ...rest }, re
10770
10834
  }
10771
10835
  )
10772
10836
  ] }),
10773
- allocationType === "numeric" && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box, { $textAlign: "right", children: [
10774
- props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10837
+ allocationType === "numeric" && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box, { $textAlign: "right", children: [
10838
+ props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10775
10839
  Text,
10776
10840
  {
10777
10841
  as: Box,
@@ -10782,7 +10846,7 @@ var MeteredFeatures = (0, import_react10.forwardRef)(({ className, ...rest }, re
10782
10846
  children: typeof allocation === "number" ? `${allocation} ${feature.name}` : `Unlimited ${feature.name}`
10783
10847
  }
10784
10848
  ),
10785
- props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10849
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10786
10850
  Text,
10787
10851
  {
10788
10852
  as: Box,
@@ -10795,7 +10859,7 @@ var MeteredFeatures = (0, import_react10.forwardRef)(({ className, ...rest }, re
10795
10859
  )
10796
10860
  ] })
10797
10861
  ] }),
10798
- typeof usage === "number" && typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10862
+ typeof usage === "number" && typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10799
10863
  ProgressBar,
10800
10864
  {
10801
10865
  progress: usage / allocation * 100,
@@ -10813,8 +10877,8 @@ var MeteredFeatures = (0, import_react10.forwardRef)(({ className, ...rest }, re
10813
10877
  });
10814
10878
 
10815
10879
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
10816
- var import_react11 = require("react");
10817
- var import_jsx_runtime12 = require("react/jsx-runtime");
10880
+ var import_react13 = require("react");
10881
+ var import_jsx_runtime14 = require("react/jsx-runtime");
10818
10882
  function resolveDesignProps4(props) {
10819
10883
  return {
10820
10884
  header: {
@@ -10833,10 +10897,10 @@ function resolveDesignProps4(props) {
10833
10897
  }
10834
10898
  };
10835
10899
  }
10836
- var UpcomingBill = (0, import_react11.forwardRef)(({ className, ...rest }, ref) => {
10900
+ var UpcomingBill = (0, import_react13.forwardRef)(({ className, ...rest }, ref) => {
10837
10901
  const props = resolveDesignProps4(rest);
10838
10902
  const { data, settings, stripe } = useEmbed();
10839
- const { upcomingInvoice } = (0, import_react11.useMemo)(() => {
10903
+ const { upcomingInvoice } = (0, import_react13.useMemo)(() => {
10840
10904
  return {
10841
10905
  upcomingInvoice: {
10842
10906
  ...data.upcomingInvoice?.amountDue && {
@@ -10854,14 +10918,14 @@ var UpcomingBill = (0, import_react11.forwardRef)(({ className, ...rest }, ref)
10854
10918
  if (!stripe || !data.upcomingInvoice) {
10855
10919
  return null;
10856
10920
  }
10857
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { ref, className, children: [
10858
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10921
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ref, className, children: [
10922
+ props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10859
10923
  Flex,
10860
10924
  {
10861
10925
  $justifyContent: "space-between",
10862
10926
  $alignItems: "center",
10863
10927
  $margin: "0 0 0.75rem",
10864
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
10928
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
10865
10929
  Text,
10866
10930
  {
10867
10931
  $font: settings.theme.typography[props.header.fontStyle].fontFamily,
@@ -10877,8 +10941,8 @@ var UpcomingBill = (0, import_react11.forwardRef)(({ className, ...rest }, ref)
10877
10941
  )
10878
10942
  }
10879
10943
  ),
10880
- upcomingInvoice.amountDue && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
10881
- props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10944
+ upcomingInvoice.amountDue && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
10945
+ props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10882
10946
  Text,
10883
10947
  {
10884
10948
  $font: settings.theme.typography[props.price.fontStyle].fontFamily,
@@ -10889,7 +10953,7 @@ var UpcomingBill = (0, import_react11.forwardRef)(({ className, ...rest }, ref)
10889
10953
  children: formatCurrency(upcomingInvoice.amountDue)
10890
10954
  }
10891
10955
  ) }),
10892
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $maxWidth: "10rem", $lineHeight: "1", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10956
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box, { $maxWidth: "10rem", $lineHeight: "1", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10893
10957
  Text,
10894
10958
  {
10895
10959
  $font: settings.theme.typography[props.contractEndDate.fontStyle].fontFamily,
@@ -10904,9 +10968,9 @@ var UpcomingBill = (0, import_react11.forwardRef)(({ className, ...rest }, ref)
10904
10968
  });
10905
10969
 
10906
10970
  // src/components/elements/payment-method/PaymentMethod.tsx
10907
- var import_react12 = require("react");
10971
+ var import_react14 = require("react");
10908
10972
  var import_react_dom2 = require("react-dom");
10909
- var import_jsx_runtime13 = require("react/jsx-runtime");
10973
+ var import_jsx_runtime15 = require("react/jsx-runtime");
10910
10974
  var resolveDesignProps5 = (props) => {
10911
10975
  return {
10912
10976
  header: {
@@ -10918,10 +10982,10 @@ var resolveDesignProps5 = (props) => {
10918
10982
  }
10919
10983
  };
10920
10984
  };
10921
- var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, portal, ...rest }, ref) => {
10985
+ var PaymentMethod = (0, import_react14.forwardRef)(({ children, className, portal, ...rest }, ref) => {
10922
10986
  const props = resolveDesignProps5(rest);
10923
10987
  const { data, settings, stripe, layout } = useEmbed();
10924
- const paymentMethod = (0, import_react12.useMemo)(() => {
10988
+ const paymentMethod = (0, import_react14.useMemo)(() => {
10925
10989
  const { cardLast4, cardExpMonth, cardExpYear } = data.subscription?.paymentMethod || {};
10926
10990
  let monthsToExpiration;
10927
10991
  if (typeof cardExpYear === "number" && typeof cardExpMonth === "number") {
@@ -10940,15 +11004,15 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
10940
11004
  if (!stripe || !data.subscription?.paymentMethod) {
10941
11005
  return null;
10942
11006
  }
10943
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { ref, className, children: [
10944
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
11007
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref, className, children: [
11008
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
10945
11009
  Flex,
10946
11010
  {
10947
11011
  $justifyContent: "space-between",
10948
11012
  $alignItems: "center",
10949
11013
  $margin: "0 0 1rem",
10950
11014
  children: [
10951
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11015
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10952
11016
  Text,
10953
11017
  {
10954
11018
  $font: settings.theme.typography[props.header.fontStyle].fontFamily,
@@ -10958,7 +11022,7 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
10958
11022
  children: "Payment Method"
10959
11023
  }
10960
11024
  ),
10961
- typeof paymentMethod.monthsToExpiration === "number" && Math.abs(paymentMethod.monthsToExpiration) < 4 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11025
+ typeof paymentMethod.monthsToExpiration === "number" && Math.abs(paymentMethod.monthsToExpiration) < 4 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10962
11026
  Text,
10963
11027
  {
10964
11028
  $font: settings.theme.typography.text.fontFamily,
@@ -10970,7 +11034,7 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
10970
11034
  ]
10971
11035
  }
10972
11036
  ),
10973
- paymentMethod.cardLast4 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11037
+ paymentMethod.cardLast4 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10974
11038
  Flex,
10975
11039
  {
10976
11040
  $justifyContent: "space-between",
@@ -10979,16 +11043,16 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
10979
11043
  $background: `${hexToHSL(settings.theme.card.background).l > 50 ? darken(settings.theme.card.background, 10) : lighten(settings.theme.card.background, 20)}`,
10980
11044
  $padding: "0.375rem 1rem",
10981
11045
  $borderRadius: "9999px",
10982
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Text, { $font: settings.theme.typography.text.fontFamily, $size: 14, children: [
11046
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text, { $font: settings.theme.typography.text.fontFamily, $size: 14, children: [
10983
11047
  "\u{1F4B3} Card ending in ",
10984
11048
  paymentMethod.cardLast4
10985
11049
  ] })
10986
11050
  }
10987
11051
  ),
10988
11052
  layout === "payment" && (0, import_react_dom2.createPortal)(
10989
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(OverlayWrapper, { size: "md", children: [
10990
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OverlayHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { $fontWeight: "600", children: "Edit payment method" }) }),
10991
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
11053
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Modal, { size: "md", children: [
11054
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ModalHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $fontWeight: "600", children: "Edit payment method" }) }),
11055
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
10992
11056
  Flex,
10993
11057
  {
10994
11058
  $flexDirection: "column",
@@ -10996,7 +11060,7 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
10996
11060
  $height: "100%",
10997
11061
  $gap: "1.5rem",
10998
11062
  children: [
10999
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11063
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11000
11064
  Flex,
11001
11065
  {
11002
11066
  $flexDirection: "column",
@@ -11005,8 +11069,8 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
11005
11069
  $borderRadius: "0 0 0.5rem 0.5rem",
11006
11070
  $flex: "1",
11007
11071
  $height: "100%",
11008
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $flexDirection: "column", $height: "100%", children: [
11009
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11072
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $flexDirection: "column", $height: "100%", children: [
11073
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11010
11074
  Box,
11011
11075
  {
11012
11076
  $fontSize: "18px",
@@ -11016,8 +11080,8 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
11016
11080
  children: "Default"
11017
11081
  }
11018
11082
  ),
11019
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $gap: "1rem", children: [
11020
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11083
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $gap: "1rem", children: [
11084
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11021
11085
  Flex,
11022
11086
  {
11023
11087
  $alignItems: "center",
@@ -11025,65 +11089,48 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
11025
11089
  $border: "1px solid #E2E5E9",
11026
11090
  $borderRadius: ".5rem",
11027
11091
  $backgroundColor: "#ffffff",
11028
- $flexDirection: "row",
11029
11092
  $gap: "1rem",
11030
11093
  $width: "100%",
11031
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
11032
- Flex,
11033
- {
11034
- $flexDirection: "row",
11035
- $justifyContent: "space-between",
11036
- $flex: "1",
11037
- children: [
11038
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
11039
- Flex,
11040
- {
11041
- $flexDirection: "row",
11042
- $alignItems: "center",
11043
- $gap: "1rem",
11044
- children: [
11045
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { $display: "inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11046
- "svg",
11047
- {
11048
- viewBox: "0 0 24 16",
11049
- fill: "none",
11050
- xmlns: "http://www.w3.org/2000/svg",
11051
- width: "26px",
11052
- height: "auto",
11053
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { children: [
11054
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11055
- "rect",
11056
- {
11057
- stroke: "#DDD",
11058
- fill: "#FFF",
11059
- x: ".25",
11060
- y: ".25",
11061
- width: "23",
11062
- height: "15.5",
11063
- rx: "2"
11064
- }
11065
- ),
11066
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11067
- "path",
11068
- {
11069
- d: "M2.788 5.914A7.201 7.201 0 0 0 1 5.237l.028-.125h2.737c.371.013.672.125.77.519l.595 2.836.182.854 1.666-4.21h1.799l-2.674 6.167H4.304L2.788 5.914Zm7.312 5.37H8.399l1.064-6.172h1.7L10.1 11.284Zm6.167-6.021-.232 1.333-.153-.066a3.054 3.054 0 0 0-1.268-.236c-.671 0-.972.269-.98.531 0 .29.365.48.96.762.98.44 1.435.979 1.428 1.681-.014 1.28-1.176 2.108-2.96 2.108-.764-.007-1.5-.158-1.898-.328l.238-1.386.224.099c.553.23.917.328 1.596.328.49 0 1.015-.19 1.022-.604 0-.27-.224-.466-.882-.769-.644-.295-1.505-.788-1.491-1.674C11.878 5.84 13.06 5 14.74 5c.658 0 1.19.138 1.526.263Zm2.26 3.834h1.415c-.07-.308-.392-1.786-.392-1.786l-.12-.531c-.083.23-.23.604-.223.59l-.68 1.727Zm2.1-3.985L22 11.284h-1.575s-.154-.71-.203-.926h-2.184l-.357.926h-1.785l2.527-5.66c.175-.4.483-.512.889-.512h1.316Z",
11070
- fill: "#1434CB"
11071
- }
11072
- )
11073
- ] })
11074
- }
11075
- ) }),
11076
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { $whiteSpace: "nowrap", children: "Visa **** 4242" })
11077
- ]
11078
- }
11079
- ),
11080
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Expires: 3/30" }) })
11081
- ]
11082
- }
11083
- )
11094
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $justifyContent: "space-between", $flex: "1", children: [
11095
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $alignItems: "center", $gap: "1rem", children: [
11096
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $display: "inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11097
+ "svg",
11098
+ {
11099
+ viewBox: "0 0 24 16",
11100
+ fill: "none",
11101
+ xmlns: "http://www.w3.org/2000/svg",
11102
+ width: "26px",
11103
+ height: "auto",
11104
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
11105
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11106
+ "rect",
11107
+ {
11108
+ stroke: "#DDD",
11109
+ fill: "#FFF",
11110
+ x: ".25",
11111
+ y: ".25",
11112
+ width: "23",
11113
+ height: "15.5",
11114
+ rx: "2"
11115
+ }
11116
+ ),
11117
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11118
+ "path",
11119
+ {
11120
+ d: "M2.788 5.914A7.201 7.201 0 0 0 1 5.237l.028-.125h2.737c.371.013.672.125.77.519l.595 2.836.182.854 1.666-4.21h1.799l-2.674 6.167H4.304L2.788 5.914Zm7.312 5.37H8.399l1.064-6.172h1.7L10.1 11.284Zm6.167-6.021-.232 1.333-.153-.066a3.054 3.054 0 0 0-1.268-.236c-.671 0-.972.269-.98.531 0 .29.365.48.96.762.98.44 1.435.979 1.428 1.681-.014 1.28-1.176 2.108-2.96 2.108-.764-.007-1.5-.158-1.898-.328l.238-1.386.224.099c.553.23.917.328 1.596.328.49 0 1.015-.19 1.022-.604 0-.27-.224-.466-.882-.769-.644-.295-1.505-.788-1.491-1.674C11.878 5.84 13.06 5 14.74 5c.658 0 1.19.138 1.526.263Zm2.26 3.834h1.415c-.07-.308-.392-1.786-.392-1.786l-.12-.531c-.083.23-.23.604-.223.59l-.68 1.727Zm2.1-3.985L22 11.284h-1.575s-.154-.71-.203-.926h-2.184l-.357.926h-1.785l2.527-5.66c.175-.4.483-.512.889-.512h1.316Z",
11121
+ fill: "#1434CB"
11122
+ }
11123
+ )
11124
+ ] })
11125
+ }
11126
+ ) }),
11127
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $whiteSpace: "nowrap", children: "Visa **** 4242" })
11128
+ ] }),
11129
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Expires: 3/30" }) })
11130
+ ] })
11084
11131
  }
11085
11132
  ),
11086
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11133
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11087
11134
  StyledButton,
11088
11135
  {
11089
11136
  $size: "sm",
@@ -11101,7 +11148,7 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
11101
11148
  ] })
11102
11149
  }
11103
11150
  ),
11104
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11151
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11105
11152
  Flex,
11106
11153
  {
11107
11154
  $flexDirection: "column",
@@ -11110,8 +11157,8 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
11110
11157
  $borderRadius: "0 0 0.5rem 0.5rem",
11111
11158
  $flex: "1",
11112
11159
  $height: "100%",
11113
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $flexDirection: "column", $height: "100%", children: [
11114
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11160
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $flexDirection: "column", $height: "100%", children: [
11161
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11115
11162
  Box,
11116
11163
  {
11117
11164
  $fontSize: "18px",
@@ -11121,8 +11168,8 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
11121
11168
  children: "Others"
11122
11169
  }
11123
11170
  ),
11124
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $gap: "1rem", children: [
11125
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11171
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $gap: "1rem", children: [
11172
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11126
11173
  Flex,
11127
11174
  {
11128
11175
  $alignItems: "center",
@@ -11130,66 +11177,49 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
11130
11177
  $border: "1px solid #E2E5E9",
11131
11178
  $borderRadius: ".5rem",
11132
11179
  $backgroundColor: "#ffffff",
11133
- $flexDirection: "row",
11134
11180
  $gap: "1rem",
11135
11181
  $width: "100%",
11136
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
11137
- Flex,
11138
- {
11139
- $flexDirection: "row",
11140
- $justifyContent: "space-between",
11141
- $flex: "1",
11142
- children: [
11143
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
11144
- Flex,
11145
- {
11146
- $flexDirection: "row",
11147
- $alignItems: "center",
11148
- $gap: "1rem",
11149
- children: [
11150
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { $display: "inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11151
- "svg",
11152
- {
11153
- viewBox: "0 0 24 16",
11154
- fill: "none",
11155
- xmlns: "http://www.w3.org/2000/svg",
11156
- width: "26px",
11157
- height: "auto",
11158
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { children: [
11159
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11160
- "rect",
11161
- {
11162
- stroke: "#DDD",
11163
- fill: "#FFF",
11164
- x: ".25",
11165
- y: ".25",
11166
- width: "23",
11167
- height: "15.5",
11168
- rx: "2"
11169
- }
11170
- ),
11171
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11172
- "path",
11173
- {
11174
- d: "M2.788 5.914A7.201 7.201 0 0 0 1 5.237l.028-.125h2.737c.371.013.672.125.77.519l.595 2.836.182.854 1.666-4.21h1.799l-2.674 6.167H4.304L2.788 5.914Zm7.312 5.37H8.399l1.064-6.172h1.7L10.1 11.284Zm6.167-6.021-.232 1.333-.153-.066a3.054 3.054 0 0 0-1.268-.236c-.671 0-.972.269-.98.531 0 .29.365.48.96.762.98.44 1.435.979 1.428 1.681-.014 1.28-1.176 2.108-2.96 2.108-.764-.007-1.5-.158-1.898-.328l.238-1.386.224.099c.553.23.917.328 1.596.328.49 0 1.015-.19 1.022-.604 0-.27-.224-.466-.882-.769-.644-.295-1.505-.788-1.491-1.674C11.878 5.84 13.06 5 14.74 5c.658 0 1.19.138 1.526.263Zm2.26 3.834h1.415c-.07-.308-.392-1.786-.392-1.786l-.12-.531c-.083.23-.23.604-.223.59l-.68 1.727Zm2.1-3.985L22 11.284h-1.575s-.154-.71-.203-.926h-2.184l-.357.926h-1.785l2.527-5.66c.175-.4.483-.512.889-.512h1.316Z",
11175
- fill: "#1434CB"
11176
- }
11177
- )
11178
- ] })
11179
- }
11180
- ) }),
11181
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { $whiteSpace: "nowrap", children: "Visa **** 2929" })
11182
- ]
11183
- }
11184
- ),
11185
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Expires: 3/30" }) })
11186
- ]
11187
- }
11188
- )
11182
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $justifyContent: "space-between", $flex: "1", children: [
11183
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $alignItems: "center", $gap: "1rem", children: [
11184
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $display: "inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11185
+ "svg",
11186
+ {
11187
+ viewBox: "0 0 24 16",
11188
+ fill: "none",
11189
+ xmlns: "http://www.w3.org/2000/svg",
11190
+ width: "26px",
11191
+ height: "auto",
11192
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
11193
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11194
+ "rect",
11195
+ {
11196
+ stroke: "#DDD",
11197
+ fill: "#FFF",
11198
+ x: ".25",
11199
+ y: ".25",
11200
+ width: "23",
11201
+ height: "15.5",
11202
+ rx: "2"
11203
+ }
11204
+ ),
11205
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11206
+ "path",
11207
+ {
11208
+ d: "M2.788 5.914A7.201 7.201 0 0 0 1 5.237l.028-.125h2.737c.371.013.672.125.77.519l.595 2.836.182.854 1.666-4.21h1.799l-2.674 6.167H4.304L2.788 5.914Zm7.312 5.37H8.399l1.064-6.172h1.7L10.1 11.284Zm6.167-6.021-.232 1.333-.153-.066a3.054 3.054 0 0 0-1.268-.236c-.671 0-.972.269-.98.531 0 .29.365.48.96.762.98.44 1.435.979 1.428 1.681-.014 1.28-1.176 2.108-2.96 2.108-.764-.007-1.5-.158-1.898-.328l.238-1.386.224.099c.553.23.917.328 1.596.328.49 0 1.015-.19 1.022-.604 0-.27-.224-.466-.882-.769-.644-.295-1.505-.788-1.491-1.674C11.878 5.84 13.06 5 14.74 5c.658 0 1.19.138 1.526.263Zm2.26 3.834h1.415c-.07-.308-.392-1.786-.392-1.786l-.12-.531c-.083.23-.23.604-.223.59l-.68 1.727Zm2.1-3.985L22 11.284h-1.575s-.154-.71-.203-.926h-2.184l-.357.926h-1.785l2.527-5.66c.175-.4.483-.512.889-.512h1.316Z",
11209
+ fill: "#1434CB"
11210
+ }
11211
+ )
11212
+ ] })
11213
+ }
11214
+ ) }),
11215
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $whiteSpace: "nowrap", children: "Visa **** 2929" })
11216
+ ] }),
11217
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Expires: 3/30" }) })
11218
+ ] })
11189
11219
  }
11190
11220
  ),
11191
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $gap: "1rem", children: [
11192
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11221
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { $gap: "1rem", children: [
11222
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11193
11223
  StyledButton,
11194
11224
  {
11195
11225
  $size: "sm",
@@ -11203,7 +11233,7 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
11203
11233
  children: "Make Default"
11204
11234
  }
11205
11235
  ),
11206
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11236
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11207
11237
  StyledButton,
11208
11238
  {
11209
11239
  $size: "sm",
@@ -11232,8 +11262,8 @@ var PaymentMethod = (0, import_react12.forwardRef)(({ children, className, porta
11232
11262
  });
11233
11263
 
11234
11264
  // src/components/elements/invoices/Invoices.tsx
11235
- var import_react13 = require("react");
11236
- var import_jsx_runtime14 = require("react/jsx-runtime");
11265
+ var import_react15 = require("react");
11266
+ var import_jsx_runtime16 = require("react/jsx-runtime");
11237
11267
  function resolveDesignProps6(props) {
11238
11268
  return {
11239
11269
  header: {
@@ -11258,10 +11288,10 @@ function resolveDesignProps6(props) {
11258
11288
  }
11259
11289
  };
11260
11290
  }
11261
- var Invoices = (0, import_react13.forwardRef)(({ className, ...rest }, ref) => {
11291
+ var Invoices = (0, import_react15.forwardRef)(({ className, ...rest }, ref) => {
11262
11292
  const props = resolveDesignProps6(rest);
11263
11293
  const { settings } = useEmbed();
11264
- const { invoices } = (0, import_react13.useMemo)(() => {
11294
+ const { invoices } = (0, import_react15.useMemo)(() => {
11265
11295
  return {
11266
11296
  invoices: [
11267
11297
  {
@@ -11275,8 +11305,8 @@ var Invoices = (0, import_react13.forwardRef)(({ className, ...rest }, ref) => {
11275
11305
  ]
11276
11306
  };
11277
11307
  }, []);
11278
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
11279
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
11308
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
11309
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11280
11310
  Text,
11281
11311
  {
11282
11312
  $font: settings.theme.typography[props.header.fontStyle].fontFamily,
@@ -11286,12 +11316,12 @@ var Invoices = (0, import_react13.forwardRef)(({ className, ...rest }, ref) => {
11286
11316
  children: "Invoices"
11287
11317
  }
11288
11318
  ) }),
11289
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(
11319
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(
11290
11320
  0,
11291
11321
  props.limit.isVisible && props.limit.number || invoices.length
11292
11322
  ).map(({ date, amount }, index) => {
11293
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Flex, { $justifyContent: "space-between", children: [
11294
- props.date.isVisible && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
11323
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $justifyContent: "space-between", children: [
11324
+ props.date.isVisible && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11295
11325
  Text,
11296
11326
  {
11297
11327
  $font: settings.theme.typography[props.date.fontStyle].fontFamily,
@@ -11301,7 +11331,7 @@ var Invoices = (0, import_react13.forwardRef)(({ className, ...rest }, ref) => {
11301
11331
  children: toPrettyDate(date)
11302
11332
  }
11303
11333
  ),
11304
- props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
11334
+ props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
11305
11335
  Text,
11306
11336
  {
11307
11337
  $font: settings.theme.typography[props.amount.fontStyle].fontFamily,
@@ -11316,9 +11346,9 @@ var Invoices = (0, import_react13.forwardRef)(({ className, ...rest }, ref) => {
11316
11346
  )
11317
11347
  ] }, index);
11318
11348
  }) }),
11319
- props.collapse.isVisible && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
11320
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon2, { name: "chevron-down", style: { color: "#D0D0D0" } }),
11321
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
11349
+ props.collapse.isVisible && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
11350
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon2, { name: "chevron-down", style: { color: "#D0D0D0" } }),
11351
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11322
11352
  Text,
11323
11353
  {
11324
11354
  $font: settings.theme.typography[props.collapse.fontStyle].fontFamily,
@@ -11333,22 +11363,22 @@ var Invoices = (0, import_react13.forwardRef)(({ className, ...rest }, ref) => {
11333
11363
  });
11334
11364
 
11335
11365
  // src/components/embed/ComponentTree.tsx
11336
- var import_react19 = require("react");
11366
+ var import_react21 = require("react");
11337
11367
 
11338
11368
  // src/components/embed/renderer.ts
11339
- var import_react18 = require("react");
11369
+ var import_react20 = require("react");
11340
11370
 
11341
11371
  // src/components/layout/root/Root.tsx
11342
- var import_react14 = require("react");
11343
- var import_jsx_runtime15 = require("react/jsx-runtime");
11344
- var Root = (0, import_react14.forwardRef)(
11372
+ var import_react16 = require("react");
11373
+ var import_jsx_runtime17 = require("react/jsx-runtime");
11374
+ var Root = (0, import_react16.forwardRef)(
11345
11375
  (props, ref) => {
11346
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref, ...props });
11376
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref, ...props });
11347
11377
  }
11348
11378
  );
11349
11379
 
11350
11380
  // src/components/layout/viewport/Viewport.tsx
11351
- var import_react15 = require("react");
11381
+ var import_react17 = require("react");
11352
11382
 
11353
11383
  // src/components/layout/viewport/styles.ts
11354
11384
  var StyledViewport = dt.div`
@@ -11359,27 +11389,63 @@ var StyledViewport = dt.div`
11359
11389
  `;
11360
11390
 
11361
11391
  // src/components/layout/viewport/Viewport.tsx
11362
- var import_jsx_runtime16 = require("react/jsx-runtime");
11363
- var Viewport = (0, import_react15.forwardRef)(
11392
+ var import_jsx_runtime18 = require("react/jsx-runtime");
11393
+ var Viewport = (0, import_react17.forwardRef)(
11364
11394
  ({ children, ...props }, ref) => {
11365
11395
  const { settings, layout } = useEmbed();
11366
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11396
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11367
11397
  StyledViewport,
11368
11398
  {
11369
11399
  ref,
11370
11400
  $numberOfColumns: settings.theme.numberOfColumns,
11371
11401
  ...props,
11372
- children: layout === "disabled" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "", children: "DISABLED" }) : children
11402
+ children: layout === "disabled" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Box, { $width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11403
+ Flex,
11404
+ {
11405
+ $flexDirection: "column",
11406
+ $padding: `${settings.theme.card.padding / 16}rem`,
11407
+ $width: "100%",
11408
+ $height: "auto",
11409
+ $borderRadius: `${settings.theme.card.borderRadius / 16}rem`,
11410
+ $backgroundColor: settings.theme.card.background,
11411
+ $alignItems: "center",
11412
+ $justifyContent: "center",
11413
+ children: [
11414
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11415
+ Box,
11416
+ {
11417
+ $marginBottom: "8px",
11418
+ $fontSize: `${settings.theme.typography.heading1.fontSize / 16}rem`,
11419
+ $fontFamily: settings.theme.typography.heading1.fontFamily,
11420
+ $fontWeight: settings.theme.typography.heading1.fontWeight,
11421
+ $color: settings.theme.typography.heading1.color,
11422
+ children: "Coming soon"
11423
+ }
11424
+ ),
11425
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11426
+ Box,
11427
+ {
11428
+ $marginBottom: "8px",
11429
+ $fontSize: `${settings.theme.typography.text.fontSize / 16}rem`,
11430
+ $fontFamily: settings.theme.typography.text.fontFamily,
11431
+ $fontWeight: settings.theme.typography.text.fontWeight,
11432
+ $color: settings.theme.typography.text.color,
11433
+ children: "The plan manager will be back very soon."
11434
+ }
11435
+ )
11436
+ ]
11437
+ }
11438
+ ) }) : children
11373
11439
  }
11374
11440
  );
11375
11441
  }
11376
11442
  );
11377
11443
 
11378
11444
  // src/components/layout/column/Column.tsx
11379
- var import_react17 = require("react");
11445
+ var import_react19 = require("react");
11380
11446
 
11381
11447
  // src/components/layout/card/Card.tsx
11382
- var import_react16 = require("react");
11448
+ var import_react18 = require("react");
11383
11449
 
11384
11450
  // src/components/layout/card/styles.ts
11385
11451
  var StyledCard = dt.div(
@@ -11408,7 +11474,7 @@ var StyledCard = dt.div(
11408
11474
 
11409
11475
  ${() => {
11410
11476
  const { l: l2 } = hexToHSL(theme.card.background);
11411
- const borderColor = l2 > 50 ? darken(theme.card.background, 10) : lighten(theme.card.background, 30);
11477
+ const borderColor = l2 > 50 ? darken(theme.card.background, 10) : lighten(theme.card.background, 20);
11412
11478
  const borderRadius = `${$borderRadius / TEXT_BASE_SIZE}rem`;
11413
11479
  const boxShadow = "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A";
11414
11480
  if ($sectionLayout === "merged") {
@@ -11440,11 +11506,11 @@ var StyledCard = dt.div(
11440
11506
  );
11441
11507
 
11442
11508
  // src/components/layout/card/Card.tsx
11443
- var import_jsx_runtime17 = require("react/jsx-runtime");
11444
- var Card = (0, import_react16.forwardRef)(
11509
+ var import_jsx_runtime19 = require("react/jsx-runtime");
11510
+ var Card = (0, import_react18.forwardRef)(
11445
11511
  ({ children, className }, ref) => {
11446
11512
  const { settings } = useEmbed();
11447
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11513
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11448
11514
  StyledCard,
11449
11515
  {
11450
11516
  ref,
@@ -11466,10 +11532,10 @@ var StyledColumn = dt.div`
11466
11532
  `;
11467
11533
 
11468
11534
  // src/components/layout/column/Column.tsx
11469
- var import_jsx_runtime18 = require("react/jsx-runtime");
11470
- var Column = (0, import_react17.forwardRef)(
11535
+ var import_jsx_runtime20 = require("react/jsx-runtime");
11536
+ var Column = (0, import_react19.forwardRef)(
11471
11537
  ({ children, ...props }, ref) => {
11472
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StyledColumn, { ref, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Card, { children }) });
11538
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StyledColumn, { ref, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Card, { children }) });
11473
11539
  }
11474
11540
  );
11475
11541
 
@@ -11502,7 +11568,7 @@ function createRenderer(options) {
11502
11568
  const { className, ...rest } = props;
11503
11569
  const resolvedProps = component === "div" ? rest : props;
11504
11570
  const resolvedChildren = children.map(renderNode);
11505
- return (0, import_react18.createElement)(
11571
+ return (0, import_react20.createElement)(
11506
11572
  component,
11507
11573
  {
11508
11574
  className,
@@ -11515,31 +11581,101 @@ function createRenderer(options) {
11515
11581
  };
11516
11582
  }
11517
11583
 
11584
+ // src/components/ui/loader/styles.ts
11585
+ var spin = mt`
11586
+ 0% {
11587
+ transform: rotate(0deg);
11588
+ }
11589
+ 100% {
11590
+ transform: rotate(360deg);
11591
+ }
11592
+ `;
11593
+ var Loader = dt.div(() => {
11594
+ const { settings } = useEmbed();
11595
+ return lt`
11596
+ border: 4px solid rgba(0, 0, 0, 0.1);
11597
+ border-top: 4px solid ${settings.theme.primary};
11598
+ border-radius: 50%;
11599
+ width: 40px;
11600
+ height: 40px;
11601
+ animation: ${spin} 1.5s linear infinite;
11602
+ display: inline-block;
11603
+ `;
11604
+ });
11605
+
11518
11606
  // src/components/embed/ComponentTree.tsx
11519
- var import_jsx_runtime19 = require("react/jsx-runtime");
11607
+ var import_jsx_runtime21 = require("react/jsx-runtime");
11520
11608
  var ComponentTree = () => {
11521
- const [children, setChildren] = (0, import_react19.useState)("Loading");
11522
- const { error, nodes } = useEmbed();
11523
- (0, import_react19.useEffect)(() => {
11609
+ const { error, nodes, settings } = useEmbed();
11610
+ const [children, setChildren] = (0, import_react21.useState)(
11611
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11612
+ Flex,
11613
+ {
11614
+ $width: "100%",
11615
+ $height: "100%",
11616
+ $alignItems: "center",
11617
+ $justifyContent: "center",
11618
+ $padding: `${settings.theme.card.padding / 16}rem`,
11619
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader, {})
11620
+ }
11621
+ )
11622
+ );
11623
+ (0, import_react21.useEffect)(() => {
11524
11624
  const renderer = createRenderer();
11525
11625
  setChildren(nodes.map(renderer));
11526
11626
  }, [nodes]);
11527
11627
  if (error) {
11528
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: error.message });
11628
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
11629
+ Flex,
11630
+ {
11631
+ $flexDirection: "column",
11632
+ $padding: `${settings.theme.card.padding / 16}rem`,
11633
+ $width: "100%",
11634
+ $height: "auto",
11635
+ $borderRadius: `${settings.theme.card.borderRadius / 16}rem`,
11636
+ $backgroundColor: settings.theme.card.background,
11637
+ $alignItems: "center",
11638
+ $justifyContent: "center",
11639
+ children: [
11640
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11641
+ Box,
11642
+ {
11643
+ $marginBottom: "8px",
11644
+ $fontSize: `${settings.theme.typography.heading1.fontSize / 16}rem`,
11645
+ $fontFamily: settings.theme.typography.heading1.fontFamily,
11646
+ $fontWeight: settings.theme.typography.heading1.fontWeight,
11647
+ $color: settings.theme.typography.heading1.color,
11648
+ children: "404 Error"
11649
+ }
11650
+ ),
11651
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11652
+ Box,
11653
+ {
11654
+ $marginBottom: "8px",
11655
+ $fontSize: `${settings.theme.typography.text.fontSize / 16}rem`,
11656
+ $fontFamily: settings.theme.typography.text.fontFamily,
11657
+ $fontWeight: settings.theme.typography.text.fontWeight,
11658
+ $color: settings.theme.typography.text.color,
11659
+ children: error.message
11660
+ }
11661
+ )
11662
+ ]
11663
+ }
11664
+ );
11529
11665
  }
11530
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
11666
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
11531
11667
  };
11532
11668
 
11533
11669
  // src/components/embed/Embed.tsx
11534
- var import_jsx_runtime20 = require("react/jsx-runtime");
11670
+ var import_jsx_runtime22 = require("react/jsx-runtime");
11535
11671
  var SchematicEmbed = ({ id, accessToken, apiConfig }) => {
11536
11672
  if (accessToken?.length === 0) {
11537
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: "Please provide an access token." });
11673
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: "Please provide an access token." });
11538
11674
  }
11539
11675
  if (!accessToken?.startsWith("token_")) {
11540
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
11676
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
11541
11677
  }
11542
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ComponentTree, {}) });
11678
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentTree, {}) });
11543
11679
  };
11544
11680
  /*! Bundled license information:
11545
11681