@schematichq/schematic-react 0.2.0-rc.1 → 0.2.0-rc.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4934,7 +4934,7 @@ var unitlessKeys = {
4934
4934
  var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
4935
4935
  var m = "active";
4936
4936
  var y = "data-styled-version";
4937
- var v = "6.1.12";
4937
+ var v = "6.1.13";
4938
4938
  var g = "/*!sc*/\n";
4939
4939
  var S = "undefined" != typeof window && "HTMLElement" in window;
4940
4940
  var w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY ? "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY : true);
@@ -5614,6 +5614,143 @@ var vt = function() {
5614
5614
  var St = "__sc-".concat(f, "__");
5615
5615
  "undefined" != typeof window && (window[St] || (window[St] = 0), 1 === window[St] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window[St] += 1);
5616
5616
 
5617
+ // node_modules/@stripe/stripe-js/dist/index.mjs
5618
+ var V3_URL = "https://js.stripe.com/v3";
5619
+ var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
5620
+ var EXISTING_SCRIPT_MESSAGE = "loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";
5621
+ var findScript = function findScript2() {
5622
+ var scripts = document.querySelectorAll('script[src^="'.concat(V3_URL, '"]'));
5623
+ for (var i2 = 0; i2 < scripts.length; i2++) {
5624
+ var script = scripts[i2];
5625
+ if (!V3_URL_REGEX.test(script.src)) {
5626
+ continue;
5627
+ }
5628
+ return script;
5629
+ }
5630
+ return null;
5631
+ };
5632
+ var injectScript = function injectScript2(params) {
5633
+ var queryString = params && !params.advancedFraudSignals ? "?advancedFraudSignals=false" : "";
5634
+ var script = document.createElement("script");
5635
+ script.src = "".concat(V3_URL).concat(queryString);
5636
+ var headOrBody = document.head || document.body;
5637
+ if (!headOrBody) {
5638
+ throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
5639
+ }
5640
+ headOrBody.appendChild(script);
5641
+ return script;
5642
+ };
5643
+ var registerWrapper = function registerWrapper2(stripe, startTime) {
5644
+ if (!stripe || !stripe._registerWrapper) {
5645
+ return;
5646
+ }
5647
+ stripe._registerWrapper({
5648
+ name: "stripe-js",
5649
+ version: "4.3.0",
5650
+ startTime
5651
+ });
5652
+ };
5653
+ var stripePromise = null;
5654
+ var onErrorListener = null;
5655
+ var onLoadListener = null;
5656
+ var onError = function onError2(reject) {
5657
+ return function() {
5658
+ reject(new Error("Failed to load Stripe.js"));
5659
+ };
5660
+ };
5661
+ var onLoad = function onLoad2(resolve, reject) {
5662
+ return function() {
5663
+ if (window.Stripe) {
5664
+ resolve(window.Stripe);
5665
+ } else {
5666
+ reject(new Error("Stripe.js not available"));
5667
+ }
5668
+ };
5669
+ };
5670
+ var loadScript = function loadScript2(params) {
5671
+ if (stripePromise !== null) {
5672
+ return stripePromise;
5673
+ }
5674
+ stripePromise = new Promise(function(resolve, reject) {
5675
+ if (typeof window === "undefined" || typeof document === "undefined") {
5676
+ resolve(null);
5677
+ return;
5678
+ }
5679
+ if (window.Stripe && params) {
5680
+ console.warn(EXISTING_SCRIPT_MESSAGE);
5681
+ }
5682
+ if (window.Stripe) {
5683
+ resolve(window.Stripe);
5684
+ return;
5685
+ }
5686
+ try {
5687
+ var script = findScript();
5688
+ if (script && params) {
5689
+ console.warn(EXISTING_SCRIPT_MESSAGE);
5690
+ } else if (!script) {
5691
+ script = injectScript(params);
5692
+ } else if (script && onLoadListener !== null && onErrorListener !== null) {
5693
+ var _script$parentNode;
5694
+ script.removeEventListener("load", onLoadListener);
5695
+ script.removeEventListener("error", onErrorListener);
5696
+ (_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);
5697
+ script = injectScript(params);
5698
+ }
5699
+ onLoadListener = onLoad(resolve, reject);
5700
+ onErrorListener = onError(reject);
5701
+ script.addEventListener("load", onLoadListener);
5702
+ script.addEventListener("error", onErrorListener);
5703
+ } catch (error) {
5704
+ reject(error);
5705
+ return;
5706
+ }
5707
+ });
5708
+ return stripePromise["catch"](function(error) {
5709
+ stripePromise = null;
5710
+ return Promise.reject(error);
5711
+ });
5712
+ };
5713
+ var initStripe = function initStripe2(maybeStripe, args, startTime) {
5714
+ if (maybeStripe === null) {
5715
+ return null;
5716
+ }
5717
+ var stripe = maybeStripe.apply(void 0, args);
5718
+ registerWrapper(stripe, startTime);
5719
+ return stripe;
5720
+ };
5721
+ var stripePromise$1;
5722
+ var loadCalled = false;
5723
+ var getStripePromise = function getStripePromise2() {
5724
+ if (stripePromise$1) {
5725
+ return stripePromise$1;
5726
+ }
5727
+ stripePromise$1 = loadScript(null)["catch"](function(error) {
5728
+ stripePromise$1 = null;
5729
+ return Promise.reject(error);
5730
+ });
5731
+ return stripePromise$1;
5732
+ };
5733
+ Promise.resolve().then(function() {
5734
+ return getStripePromise();
5735
+ })["catch"](function(error) {
5736
+ if (!loadCalled) {
5737
+ console.warn(error);
5738
+ }
5739
+ });
5740
+ var loadStripe = function loadStripe2() {
5741
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5742
+ args[_key] = arguments[_key];
5743
+ }
5744
+ loadCalled = true;
5745
+ var startTime = Date.now();
5746
+ return getStripePromise().then(function(maybeStripe) {
5747
+ return initStripe(maybeStripe, args, startTime);
5748
+ });
5749
+ };
5750
+
5751
+ // src/context/embed.tsx
5752
+ import { Elements } from "@stripe/react-stripe-js";
5753
+
5617
5754
  // src/api/runtime.ts
5618
5755
  var BASE_PATH = "https://api.schematichq.com".replace(/\/+$/, "");
5619
5756
  var Configuration = class {
@@ -5930,6 +6067,30 @@ function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator
5930
6067
  };
5931
6068
  }
5932
6069
 
6070
+ // src/api/models/BillingProductForSubscriptionResponseData.ts
6071
+ function BillingProductForSubscriptionResponseDataFromJSON(json) {
6072
+ return BillingProductForSubscriptionResponseDataFromJSONTyped(json, false);
6073
+ }
6074
+ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6075
+ if (json == null) {
6076
+ return json;
6077
+ }
6078
+ return {
6079
+ accountId: json["account_id"],
6080
+ createdAt: new Date(json["created_at"]),
6081
+ currency: json["currency"],
6082
+ environmentId: json["environment_id"],
6083
+ externalId: json["external_id"],
6084
+ id: json["id"],
6085
+ interval: json["interval"] == null ? void 0 : json["interval"],
6086
+ name: json["name"],
6087
+ price: json["price"],
6088
+ quantity: json["quantity"],
6089
+ subscriptionId: json["subscription_id"],
6090
+ updatedAt: new Date(json["updated_at"])
6091
+ };
6092
+ }
6093
+
5933
6094
  // src/api/models/BillingSubscriptionResponseData.ts
5934
6095
  function BillingSubscriptionResponseDataFromJSON(json) {
5935
6096
  return BillingSubscriptionResponseDataFromJSONTyped(json, false);
@@ -5952,7 +6113,6 @@ function ChangeSubscriptionRequestBodyToJSON(value) {
5952
6113
  return value;
5953
6114
  }
5954
6115
  return {
5955
- action: value["action"],
5956
6116
  new_plan_id: value["newPlanId"],
5957
6117
  new_price_id: value["newPriceId"]
5958
6118
  };
@@ -6364,6 +6524,81 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6364
6524
  };
6365
6525
  }
6366
6526
 
6527
+ // src/api/models/InvoiceResponseData.ts
6528
+ function InvoiceResponseDataFromJSON(json) {
6529
+ return InvoiceResponseDataFromJSONTyped(json, false);
6530
+ }
6531
+ function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6532
+ if (json == null) {
6533
+ return json;
6534
+ }
6535
+ return {
6536
+ amountDue: json["amount_due"],
6537
+ amountPaid: json["amount_paid"],
6538
+ amountRemaining: json["amount_remaining"],
6539
+ collectionMethod: json["collection_method"],
6540
+ companyId: json["company_id"] == null ? void 0 : json["company_id"],
6541
+ createdAt: new Date(json["created_at"]),
6542
+ currency: json["currency"],
6543
+ customerExternalId: json["customer_external_id"],
6544
+ dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
6545
+ environmentId: json["environment_id"],
6546
+ externalId: json["external_id"],
6547
+ id: json["id"],
6548
+ subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
6549
+ subtotal: json["subtotal"],
6550
+ updatedAt: new Date(json["updated_at"])
6551
+ };
6552
+ }
6553
+
6554
+ // src/api/models/PaymentMethodResponseData.ts
6555
+ function PaymentMethodResponseDataFromJSON(json) {
6556
+ return PaymentMethodResponseDataFromJSONTyped(json, false);
6557
+ }
6558
+ function PaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6559
+ if (json == null) {
6560
+ return json;
6561
+ }
6562
+ return {
6563
+ cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
6564
+ cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
6565
+ cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
6566
+ cardLast4: json["card_last4"] == null ? void 0 : json["card_last4"],
6567
+ companyId: json["company_id"] == null ? void 0 : json["company_id"],
6568
+ createdAt: new Date(json["created_at"]),
6569
+ customerExternalId: json["customer_external_id"],
6570
+ environmentId: json["environment_id"],
6571
+ externalId: json["external_id"],
6572
+ id: json["id"],
6573
+ invoiceExternalId: json["invoice_external_id"] == null ? void 0 : json["invoice_external_id"],
6574
+ paymentMethodType: json["payment_method_type"],
6575
+ subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
6576
+ updatedAt: new Date(json["updated_at"])
6577
+ };
6578
+ }
6579
+
6580
+ // src/api/models/CompanySubscriptionResponseData.ts
6581
+ function CompanySubscriptionResponseDataFromJSON(json) {
6582
+ return CompanySubscriptionResponseDataFromJSONTyped(json, false);
6583
+ }
6584
+ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6585
+ if (json == null) {
6586
+ return json;
6587
+ }
6588
+ return {
6589
+ customerExternalId: json["customer_external_id"],
6590
+ expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
6591
+ interval: json["interval"],
6592
+ latestInvoice: json["latest_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["latest_invoice"]),
6593
+ paymentMethod: json["payment_method"] == null ? void 0 : PaymentMethodResponseDataFromJSON(json["payment_method"]),
6594
+ products: json["products"].map(
6595
+ BillingProductForSubscriptionResponseDataFromJSON
6596
+ ),
6597
+ subscriptionExternalId: json["subscription_external_id"],
6598
+ totalPrice: json["total_price"]
6599
+ };
6600
+ }
6601
+
6367
6602
  // src/api/models/ComponentResponseData.ts
6368
6603
  function ComponentResponseDataFromJSON(json) {
6369
6604
  return ComponentResponseDataFromJSONTyped(json, false);
@@ -6428,7 +6663,7 @@ function StripeEmbedInfoFromJSONTyped(json, ignoreDiscriminator) {
6428
6663
  return json;
6429
6664
  }
6430
6665
  return {
6431
- customerEkey: json["customer_ekey"],
6666
+ customerEkey: json["customer_ekey"] == null ? void 0 : json["customer_ekey"],
6432
6667
  publishableKey: json["publishable_key"]
6433
6668
  };
6434
6669
  }
@@ -6448,7 +6683,8 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6448
6683
  company: json["company"] == null ? void 0 : CompanyDetailResponseDataFromJSON(json["company"]),
6449
6684
  component: json["component"] == null ? void 0 : ComponentResponseDataFromJSON(json["component"]),
6450
6685
  featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"]),
6451
- stripeEmbed: json["stripe_embed"] == null ? void 0 : StripeEmbedInfoFromJSON(json["stripe_embed"])
6686
+ stripeEmbed: json["stripe_embed"] == null ? void 0 : StripeEmbedInfoFromJSON(json["stripe_embed"]),
6687
+ subscription: json["subscription"] == null ? void 0 : CompanySubscriptionResponseDataFromJSON(json["subscription"])
6452
6688
  };
6453
6689
  }
6454
6690
 
@@ -6661,28 +6897,36 @@ async function fetchComponent(id, accessToken, options) {
6661
6897
  const json = inflate_1(Uint8Array.from(Object.values(compressed)), {
6662
6898
  to: "string"
6663
6899
  });
6664
- const ast = getEditorState(JSON.stringify(json));
6900
+ const ast = getEditorState(json);
6665
6901
  if (ast) {
6666
6902
  Object.assign(settings, ast.ROOT.props);
6667
6903
  nodes.push(...parseEditorState(ast));
6668
6904
  }
6669
6905
  }
6906
+ let stripe = null;
6907
+ if (data.stripeEmbed?.publishableKey) {
6908
+ stripe = loadStripe(data.stripeEmbed.publishableKey);
6909
+ }
6670
6910
  return {
6671
6911
  data,
6672
6912
  nodes,
6673
- settings
6913
+ settings,
6914
+ stripe
6674
6915
  };
6675
6916
  }
6676
6917
  var EmbedContext = createContext({
6677
6918
  data: {},
6678
6919
  nodes: [],
6679
6920
  settings: { ...defaultSettings },
6921
+ stripe: null,
6680
6922
  layout: "portal",
6681
6923
  error: void 0,
6682
6924
  setData: () => {
6683
6925
  },
6684
6926
  updateSettings: () => {
6685
6927
  },
6928
+ setStripe: () => {
6929
+ },
6686
6930
  setLayout: () => {
6687
6931
  }
6688
6932
  });
@@ -6698,12 +6942,15 @@ var EmbedProvider = ({
6698
6942
  data: {},
6699
6943
  nodes: [],
6700
6944
  settings: { ...defaultSettings },
6945
+ stripe: null,
6701
6946
  layout: "portal",
6702
6947
  error: void 0,
6703
6948
  setData: () => {
6704
6949
  },
6705
6950
  updateSettings: () => {
6706
6951
  },
6952
+ setStripe: () => {
6953
+ },
6707
6954
  setLayout: () => {
6708
6955
  }
6709
6956
  };
@@ -6723,7 +6970,7 @@ var EmbedProvider = ({
6723
6970
  if (!id || !accessToken) {
6724
6971
  return;
6725
6972
  }
6726
- fetchComponent(id, accessToken, apiConfig).then((resolvedData) => {
6973
+ fetchComponent(id, accessToken, apiConfig).then(async (resolvedData) => {
6727
6974
  setState((prev2) => ({ ...prev2, ...resolvedData }));
6728
6975
  }).catch((error) => setState((prev2) => ({ ...prev2, error })));
6729
6976
  }, [id, accessToken, apiConfig]);
@@ -6757,6 +7004,15 @@ var EmbedProvider = ({
6757
7004
  },
6758
7005
  [setState]
6759
7006
  );
7007
+ const setStripe = useCallback(
7008
+ (stripe) => {
7009
+ setState((prev2) => ({
7010
+ ...prev2,
7011
+ stripe
7012
+ }));
7013
+ },
7014
+ [setState]
7015
+ );
6760
7016
  const setLayout = useCallback(
6761
7017
  (layout) => {
6762
7018
  setState((prev2) => ({
@@ -6766,6 +7022,47 @@ var EmbedProvider = ({
6766
7022
  },
6767
7023
  [setState]
6768
7024
  );
7025
+ const renderChildren = () => {
7026
+ if (state.stripe) {
7027
+ return /* @__PURE__ */ jsx(
7028
+ Elements,
7029
+ {
7030
+ stripe: state.stripe,
7031
+ options: {
7032
+ appearance: {
7033
+ theme: "stripe",
7034
+ variables: {
7035
+ // Base
7036
+ spacingUnit: ".25rem",
7037
+ colorPrimary: "#0570de",
7038
+ colorBackground: "#FFFFFF",
7039
+ colorText: "#30313d",
7040
+ colorDanger: "#df1b41",
7041
+ fontFamily: "Public Sans, system-ui, sans-serif",
7042
+ borderRadius: ".5rem",
7043
+ // Layout
7044
+ gridRowSpacing: "1.5rem",
7045
+ gridColumnSpacing: "1.5rem"
7046
+ },
7047
+ rules: {
7048
+ ".Label": {
7049
+ color: "#020202",
7050
+ fontWeight: "400",
7051
+ fontSize: "16px",
7052
+ marginBottom: "12px"
7053
+ }
7054
+ }
7055
+ },
7056
+ ...state.data.stripeEmbed?.customerEkey && {
7057
+ clientSecret: state.data.stripeEmbed.customerEkey
7058
+ }
7059
+ },
7060
+ children
7061
+ }
7062
+ );
7063
+ }
7064
+ return children;
7065
+ };
6769
7066
  return /* @__PURE__ */ jsx(
6770
7067
  EmbedContext.Provider,
6771
7068
  {
@@ -6773,13 +7070,15 @@ var EmbedProvider = ({
6773
7070
  data: state.data,
6774
7071
  nodes: state.nodes,
6775
7072
  settings: state.settings,
7073
+ stripe: state.stripe,
6776
7074
  layout: state.layout,
6777
7075
  error: state.error,
6778
7076
  setData,
6779
7077
  updateSettings,
7078
+ setStripe,
6780
7079
  setLayout
6781
7080
  },
6782
- children: /* @__PURE__ */ jsx(ot, { theme: state.settings.theme, children })
7081
+ children: /* @__PURE__ */ jsx(ot, { theme: state.settings.theme, children: renderChildren() })
6783
7082
  }
6784
7083
  );
6785
7084
  };
@@ -7624,12 +7923,7 @@ function contextString(context) {
7624
7923
  }
7625
7924
 
7626
7925
  // src/context/schematic.tsx
7627
- import {
7628
- createContext as createContext2,
7629
- useEffect as useEffect2,
7630
- useMemo,
7631
- useState as useState2
7632
- } from "react";
7926
+ import { createContext as createContext2, useEffect as useEffect2, useMemo, useState as useState2 } from "react";
7633
7927
  import { jsx as jsx2 } from "react/jsx-runtime";
7634
7928
  var SchematicContext = createContext2({
7635
7929
  flagValues: {}
@@ -7722,11 +8016,13 @@ var useSchematicFlag = (key, opts) => {
7722
8016
  return value;
7723
8017
  };
7724
8018
 
7725
- // src/components/elements/card/Card.tsx
7726
- import { forwardRef } from "react";
7727
-
7728
- // src/const/index.ts
7729
- var TEXT_BASE_SIZE = 16;
8019
+ // src/components/elements/plan-manager/PlanManager.tsx
8020
+ import {
8021
+ forwardRef,
8022
+ useMemo as useMemo2,
8023
+ useState as useState5
8024
+ } from "react";
8025
+ import { createPortal } from "react-dom";
7730
8026
 
7731
8027
  // src/utils/color.ts
7732
8028
  function hexToHSL(color) {
@@ -7838,6 +8134,9 @@ function camelToHyphen(str) {
7838
8134
  return str.replace(/([a-z][A-Z])/g, (g2) => `${g2[0]}-${g2[1].toLowerCase()}`);
7839
8135
  }
7840
8136
 
8137
+ // src/const/index.ts
8138
+ var TEXT_BASE_SIZE = 16;
8139
+
7841
8140
  // src/utils/style.ts
7842
8141
  function attr(key, value) {
7843
8142
  return typeof value !== "undefined" && lt`
@@ -7855,88 +8154,6 @@ attr.rem = function propAsRem(key, value) {
7855
8154
  `;
7856
8155
  };
7857
8156
 
7858
- // src/components/elements/card/styles.ts
7859
- var StyledCard = dt.div(
7860
- ({
7861
- theme,
7862
- $sectionLayout = "merged",
7863
- $borderRadius = 8,
7864
- $padding = 48,
7865
- $shadow = true
7866
- }) => {
7867
- return lt`
7868
- box-sizing: border-box;
7869
- font-size: ${TEXT_BASE_SIZE}px;
7870
-
7871
- *,
7872
- *::before,
7873
- *::after {
7874
- box-sizing: inherit;
7875
- }
7876
-
7877
- > * {
7878
- padding: ${$padding * 0.75 / TEXT_BASE_SIZE}rem
7879
- ${$padding / TEXT_BASE_SIZE}rem;
7880
- color: ${theme.typography.text.color};
7881
- }
7882
-
7883
- ${() => {
7884
- const { l: l2 } = hexToHSL(theme.card.background);
7885
- const borderColor = l2 > 50 ? darken(theme.card.background, 10) : lighten(theme.card.background, 30);
7886
- const borderRadius = `${$borderRadius / TEXT_BASE_SIZE}rem`;
7887
- const boxShadow = "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A";
7888
- if ($sectionLayout === "merged") {
7889
- return lt`
7890
- background: ${({ theme: theme2 }) => theme2.card.background};
7891
- border-radius: ${borderRadius};
7892
-
7893
- ${$shadow && `box-shadow: ${boxShadow};`}
7894
-
7895
- > :not(:last-child) {
7896
- border-bottom: 1px solid ${borderColor};
7897
- }
7898
- `;
7899
- }
7900
- return lt`
7901
- > :not(:last-child) {
7902
- margin-bottom: 1rem;
7903
- }
7904
-
7905
- > * {
7906
- background: ${theme.card.background};
7907
- border-radius: ${borderRadius};
7908
- ${$shadow && `box-shadow: ${boxShadow};`}
7909
- }
7910
- `;
7911
- }}
7912
- `;
7913
- }
7914
- );
7915
-
7916
- // src/components/elements/card/Card.tsx
7917
- import { jsx as jsx3 } from "react/jsx-runtime";
7918
- var Card = forwardRef(
7919
- ({ children, className }, ref) => {
7920
- const { settings } = useEmbed();
7921
- return /* @__PURE__ */ jsx3(
7922
- StyledCard,
7923
- {
7924
- ref,
7925
- className,
7926
- $sectionLayout: settings.theme?.sectionLayout,
7927
- $borderRadius: settings.theme?.card?.borderRadius,
7928
- $padding: settings.theme?.card?.padding,
7929
- $shadow: settings.theme?.card?.hasShadow,
7930
- children
7931
- }
7932
- );
7933
- }
7934
- );
7935
-
7936
- // src/components/elements/plan-manager/PlanManager.tsx
7937
- import { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
7938
- import { createPortal } from "react-dom";
7939
-
7940
8157
  // src/components/ui/box/styles.ts
7941
8158
  var Box = dt.div((props) => {
7942
8159
  const initialStyles = [];
@@ -8054,7 +8271,7 @@ var Button = dt.button`
8054
8271
  `;
8055
8272
 
8056
8273
  // src/components/ui/button/Button.tsx
8057
- import { jsx as jsx4 } from "react/jsx-runtime";
8274
+ import { jsx as jsx3 } from "react/jsx-runtime";
8058
8275
  var Button2 = ({
8059
8276
  color = "white",
8060
8277
  size = "md",
@@ -8063,7 +8280,7 @@ var Button2 = ({
8063
8280
  children,
8064
8281
  ...props
8065
8282
  }) => {
8066
- return /* @__PURE__ */ jsx4(
8283
+ return /* @__PURE__ */ jsx3(
8067
8284
  Button,
8068
8285
  {
8069
8286
  $color: color,
@@ -8094,6 +8311,7 @@ var Container = dt.div`
8094
8311
  display: flex;
8095
8312
  justify-content: center;
8096
8313
  align-items: center;
8314
+ flex-shrink: 0;
8097
8315
  border-radius: 9999px;
8098
8316
  ${({ $size }) => {
8099
8317
  const base = 24;
@@ -8130,13 +8348,13 @@ var Container = dt.div`
8130
8348
  `;
8131
8349
 
8132
8350
  // src/components/ui/icon/Icon.tsx
8133
- import { jsx as jsx5 } from "react/jsx-runtime";
8351
+ import { jsx as jsx4 } from "react/jsx-runtime";
8134
8352
  var Icon2 = ({ name, className, ...props }) => {
8135
- return /* @__PURE__ */ jsx5(Icon, { className: (0, import_classnames.default)("i", `i-${name}`, className), ...props });
8353
+ return /* @__PURE__ */ jsx4(Icon, { className: (0, import_classnames.default)("i", `i-${name}`, className), ...props });
8136
8354
  };
8137
8355
 
8138
8356
  // src/components/ui/icon/IconRound.tsx
8139
- import { jsx as jsx6 } from "react/jsx-runtime";
8357
+ import { jsx as jsx5 } from "react/jsx-runtime";
8140
8358
  var IconRound = ({
8141
8359
  name,
8142
8360
  variant = "filled",
@@ -8144,7 +8362,7 @@ var IconRound = ({
8144
8362
  colors = ["white", "#e5e7eb"],
8145
8363
  ...props
8146
8364
  }) => {
8147
- return /* @__PURE__ */ jsx6(Container, { $size: size, $variant: variant, $colors: colors, ...props, children: /* @__PURE__ */ jsx6(Icon2, { name }) });
8365
+ return /* @__PURE__ */ jsx5(Container, { $size: size, $variant: variant, $colors: colors, ...props, children: /* @__PURE__ */ jsx5(Icon2, { name }) });
8148
8366
  };
8149
8367
 
8150
8368
  // src/components/ui/progress-bar/styles.ts
@@ -8153,7 +8371,7 @@ var Container2 = dt(Flex)`
8153
8371
  `;
8154
8372
 
8155
8373
  // src/components/ui/progress-bar/ProgressBar.tsx
8156
- import { jsx as jsx7, jsxs } from "react/jsx-runtime";
8374
+ import { jsx as jsx6, jsxs } from "react/jsx-runtime";
8157
8375
  var ProgressBar = ({
8158
8376
  progress,
8159
8377
  value,
@@ -8176,14 +8394,14 @@ var ProgressBar = ({
8176
8394
  $gap: `${16 / TEXT_BASE_SIZE}rem`,
8177
8395
  ...props,
8178
8396
  children: [
8179
- /* @__PURE__ */ jsx7(
8397
+ /* @__PURE__ */ jsx6(
8180
8398
  Flex,
8181
8399
  {
8182
8400
  $position: "relative",
8183
8401
  $alignItems: "center",
8184
8402
  $width: `${barWidth}`,
8185
8403
  $maxWidth: "100%",
8186
- children: /* @__PURE__ */ jsx7(
8404
+ children: /* @__PURE__ */ jsx6(
8187
8405
  Flex,
8188
8406
  {
8189
8407
  $position: "relative",
@@ -8192,7 +8410,7 @@ var ProgressBar = ({
8192
8410
  $height: `${8 / TEXT_BASE_SIZE}rem`,
8193
8411
  $background: "#F2F4F7",
8194
8412
  $borderRadius: "9999px",
8195
- children: /* @__PURE__ */ jsx7(
8413
+ children: /* @__PURE__ */ jsx6(
8196
8414
  Box,
8197
8415
  {
8198
8416
  $width: `${Math.min(progress, 100)}%`,
@@ -8215,41 +8433,155 @@ var ProgressBar = ({
8215
8433
  );
8216
8434
  };
8217
8435
 
8436
+ // src/components/elements/plan-manager/CheckoutForm.tsx
8437
+ import { useState as useState4 } from "react";
8438
+ import {
8439
+ LinkAuthenticationElement,
8440
+ PaymentElement
8441
+ } from "@stripe/react-stripe-js";
8442
+ import { useStripe, useElements } from "@stripe/react-stripe-js";
8443
+ import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
8444
+ var CheckoutForm = () => {
8445
+ const stripe = useStripe();
8446
+ const elements = useElements();
8447
+ const [message, setMessage] = useState4(null);
8448
+ const [isLoading, setIsLoading] = useState4(false);
8449
+ const handleSubmit = async (event) => {
8450
+ event.preventDefault();
8451
+ if (!stripe || !elements) {
8452
+ return;
8453
+ }
8454
+ setIsLoading(true);
8455
+ const { error } = await stripe.confirmPayment({
8456
+ elements,
8457
+ confirmParams: {
8458
+ return_url: window.location.href
8459
+ }
8460
+ });
8461
+ if (error.type === "card_error" || error.type === "validation_error") {
8462
+ setMessage(error.message);
8463
+ } else {
8464
+ setMessage("An unexpected error occured.");
8465
+ }
8466
+ setIsLoading(false);
8467
+ };
8468
+ return /* @__PURE__ */ jsxs2(
8469
+ "form",
8470
+ {
8471
+ id: "payment-form",
8472
+ onSubmit: handleSubmit,
8473
+ style: {
8474
+ display: "flex",
8475
+ flexDirection: "column",
8476
+ height: "100%"
8477
+ },
8478
+ children: [
8479
+ /* @__PURE__ */ jsxs2(
8480
+ Box,
8481
+ {
8482
+ $fontSize: "18px",
8483
+ $marginBottom: "1.5rem",
8484
+ $display: "inline-block",
8485
+ $width: "100%",
8486
+ children: [
8487
+ "Add payment method",
8488
+ " "
8489
+ ]
8490
+ }
8491
+ ),
8492
+ /* @__PURE__ */ jsx7(
8493
+ Flex,
8494
+ {
8495
+ $flexDirection: "column",
8496
+ $gap: "1.5rem",
8497
+ $marginBottom: "1.5rem",
8498
+ $width: "100%",
8499
+ children: /* @__PURE__ */ jsx7(
8500
+ LinkAuthenticationElement,
8501
+ {
8502
+ id: "link-authentication-element"
8503
+ }
8504
+ )
8505
+ }
8506
+ ),
8507
+ /* @__PURE__ */ jsxs2(Flex, { $flexDirection: "column", $width: "100%", $flex: "1", $height: "100%", children: [
8508
+ /* @__PURE__ */ jsx7(PaymentElement, { id: "payment-element" }),
8509
+ message && /* @__PURE__ */ jsx7("div", { id: "payment-message", children: message })
8510
+ ] }),
8511
+ /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(
8512
+ "button",
8513
+ {
8514
+ disabled: isLoading || !stripe || !elements,
8515
+ id: "submit",
8516
+ style: {
8517
+ backgroundColor: "#000000",
8518
+ color: "#ffffff",
8519
+ paddingTop: ".75rem",
8520
+ paddingBottom: ".75rem",
8521
+ fontSize: "15px",
8522
+ width: "100%",
8523
+ borderRadius: ".5rem",
8524
+ textAlign: "center",
8525
+ cursor: "pointer"
8526
+ },
8527
+ children: /* @__PURE__ */ jsx7("span", { id: "button-text", style: { marginTop: "2.5rem" }, children: isLoading ? /* @__PURE__ */ jsx7("div", { className: "spinner", id: "spinner" }) : "Save payment method" })
8528
+ }
8529
+ ) })
8530
+ ]
8531
+ }
8532
+ );
8533
+ };
8534
+
8218
8535
  // src/components/elements/plan-manager/styles.ts
8219
8536
  var StyledButton = dt(Button2)`
8220
8537
  font-family: "Public Sans", sans-serif;
8221
8538
  font-weight: 500;
8222
8539
  text-align: center;
8223
8540
  width: 100%;
8541
+
8224
8542
  ${({ $color = "primary", theme }) => {
8225
8543
  const { l: l2 } = hexToHSL(theme[$color]);
8226
- const color = l2 > 50 ? "#000000" : "#FFFFFF";
8544
+ const textColor = l2 > 50 ? "#000000" : "#FFFFFF";
8227
8545
  return lt`
8228
- color: ${color};
8546
+ color: ${textColor};
8229
8547
 
8230
8548
  ${Text} {
8231
- color: ${color};
8549
+ color: ${textColor};
8232
8550
  }
8233
8551
  `;
8234
8552
  }};
8235
8553
 
8236
- ${({ $color = "primary", theme }) => {
8554
+ ${({ $color = "primary", theme, $variant = "filled" }) => {
8237
8555
  const color = theme[$color];
8238
- return lt`
8239
- background-color: ${color};
8240
- border-color: ${color};
8241
- `;
8242
- }}
8556
+ return $variant === "filled" ? lt`
8557
+ background-color: ${color};
8558
+ border-color: ${color};
8559
+ ` : lt`
8560
+ background-color: transparent;
8561
+ border-color: #d2d2d2;
8562
+ color: #194bfb;
8563
+ ${Text} {
8564
+ color: #194bfb;
8565
+ }
8566
+ `;
8567
+ }}
8243
8568
 
8244
8569
  &:hover {
8245
- ${({ $color = "primary", theme }) => {
8570
+ ${({ $color = "primary", theme, $variant = "filled" }) => {
8246
8571
  const specified = theme[$color];
8247
8572
  const lightened = lighten(specified, 15);
8248
8573
  const color = specified === lightened ? darken(specified, 15) : lightened;
8249
- return lt`
8250
- background-color: ${color};
8251
- border-color: ${color};
8252
- `;
8574
+ return $variant === "filled" ? lt`
8575
+ background-color: ${color};
8576
+ border-color: ${color};
8577
+ ` : lt`
8578
+ background-color: ${color};
8579
+ border-color: ${color};
8580
+ color: #ffffff;
8581
+ ${Text} {
8582
+ color: #ffffff;
8583
+ }
8584
+ `;
8253
8585
  }}
8254
8586
  }
8255
8587
 
@@ -8259,26 +8591,321 @@ var StyledButton = dt(Button2)`
8259
8591
  return lt`
8260
8592
  font-size: ${15 / 16}rem;
8261
8593
  padding: ${12 / 16}rem 0;
8262
- border-radius: ${8 / 16}rem;
8594
+ border-radius: ${6 / 16}rem;
8263
8595
  `;
8264
8596
  case "md":
8265
8597
  return lt`
8266
8598
  font-size: ${17 / 16}rem;
8267
8599
  padding: ${16 / 16}rem 0;
8268
- border-radius: ${10 / 16}rem;
8600
+ border-radius: ${8 / 16}rem;
8269
8601
  `;
8270
8602
  case "lg":
8271
8603
  return lt`
8272
8604
  font-size: ${19 / 16}rem;
8273
8605
  padding: ${20 / 16}rem 0;
8274
- border-radius: ${12 / 16}rem;
8606
+ border-radius: ${10 / 16}rem;
8275
8607
  `;
8276
8608
  }
8277
8609
  }}
8278
8610
  `;
8279
8611
 
8280
8612
  // src/components/elements/plan-manager/PlanManager.tsx
8281
- import { Fragment, jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
8613
+ import { Fragment, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
8614
+ var OverlayHeader = ({ children }) => {
8615
+ const { setLayout } = useEmbed();
8616
+ return /* @__PURE__ */ jsxs3(
8617
+ Flex,
8618
+ {
8619
+ $paddingLeft: "2.5rem",
8620
+ $paddingRight: "2.5rem",
8621
+ $padding: ".75rem 2.5rem",
8622
+ $flexDirection: "row",
8623
+ $justifyContent: "space-between",
8624
+ $alignItems: "center",
8625
+ $borderBottom: "1px solid #DEDEDE",
8626
+ $gap: "1rem",
8627
+ $backgroundColor: "#FFFFFF",
8628
+ $borderRadius: ".5rem .5rem 0 0",
8629
+ children: [
8630
+ children,
8631
+ /* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(
8632
+ Box,
8633
+ {
8634
+ $cursor: "pointer",
8635
+ onClick: () => {
8636
+ setLayout("portal");
8637
+ },
8638
+ children: /* @__PURE__ */ jsx8(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } })
8639
+ }
8640
+ ) })
8641
+ ]
8642
+ }
8643
+ );
8644
+ };
8645
+ var OverlayWrapper = ({
8646
+ children,
8647
+ size = "lg"
8648
+ }) => {
8649
+ const sizeWidthMap = {
8650
+ md: "700px",
8651
+ lg: "75%"
8652
+ };
8653
+ const sizeHeighthMap = {
8654
+ md: "auto",
8655
+ lg: "75%"
8656
+ };
8657
+ const sizeMaxWidthMap = {
8658
+ md: "auto",
8659
+ lg: "1140px"
8660
+ };
8661
+ return /* @__PURE__ */ jsx8(
8662
+ Box,
8663
+ {
8664
+ $position: "absolute",
8665
+ $top: "50%",
8666
+ $left: "50%",
8667
+ $zIndex: "999999",
8668
+ $transform: "translate(-50%, -50%)",
8669
+ $width: "100%",
8670
+ $height: "100%",
8671
+ $backgroundColor: "#D9D9D9",
8672
+ $overflow: "hidden",
8673
+ children: /* @__PURE__ */ jsx8(
8674
+ Flex,
8675
+ {
8676
+ $position: "relative",
8677
+ $top: "50%",
8678
+ $left: "50%",
8679
+ $transform: "translate(-50%, -50%)",
8680
+ $flexDirection: "column",
8681
+ $maxWidth: sizeMaxWidthMap[size],
8682
+ $width: sizeWidthMap[size],
8683
+ $height: sizeHeighthMap[size],
8684
+ $backgroundColor: "#FBFBFB",
8685
+ $borderBottom: "1px solid #DEDEDE",
8686
+ $borderRadius: "8px",
8687
+ $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
8688
+ id: "select-plan-dialog",
8689
+ role: "dialog",
8690
+ "aria-labelledby": "select-plan-dialog-label",
8691
+ "aria-modal": "true",
8692
+ children
8693
+ }
8694
+ )
8695
+ }
8696
+ );
8697
+ };
8698
+ var OverlaySideBar = ({
8699
+ pricePeriod,
8700
+ setPricePeriod,
8701
+ setCheckoutStage
8702
+ }) => {
8703
+ return /* @__PURE__ */ jsxs3(
8704
+ Flex,
8705
+ {
8706
+ $flexDirection: "column",
8707
+ $background: "white",
8708
+ $borderRadius: "0 0 0.5rem",
8709
+ $maxWidth: "275px",
8710
+ $height: "100%",
8711
+ $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
8712
+ children: [
8713
+ /* @__PURE__ */ jsxs3(
8714
+ Flex,
8715
+ {
8716
+ $flexDirection: "column",
8717
+ $position: "relative",
8718
+ $gap: "1rem",
8719
+ $width: "100%",
8720
+ $height: "auto",
8721
+ $padding: "1.5rem",
8722
+ $borderBottom: "1px solid #DEDEDE",
8723
+ children: [
8724
+ /* @__PURE__ */ jsxs3(Flex, { $flexDirection: "row", $justifyContent: "space-between", children: [
8725
+ /* @__PURE__ */ jsx8(Text, { $size: 20, $weight: 600, children: "Subscription" }),
8726
+ /* @__PURE__ */ jsxs3(
8727
+ Flex,
8728
+ {
8729
+ $border: "1px solid #D9D9D9",
8730
+ $padding: ".15rem .45rem .15rem .55rem",
8731
+ $alignItems: "center",
8732
+ $borderRadius: "5px",
8733
+ $fontSize: "12px",
8734
+ children: [
8735
+ /* @__PURE__ */ jsx8(Box, { $display: "inline-block", $marginRight: ".5rem", children: "$ USD" }),
8736
+ /* @__PURE__ */ jsx8(
8737
+ Icon2,
8738
+ {
8739
+ name: "chevron-down",
8740
+ style: {
8741
+ fontSize: "20px",
8742
+ lineHeight: "1em"
8743
+ }
8744
+ }
8745
+ )
8746
+ ]
8747
+ }
8748
+ )
8749
+ ] }),
8750
+ /* @__PURE__ */ jsxs3(
8751
+ Flex,
8752
+ {
8753
+ $flexDirection: "row",
8754
+ $border: "1px solid #D9D9D9",
8755
+ $borderRadius: "40px",
8756
+ $fontSize: "12px",
8757
+ $textAlign: "center",
8758
+ $cursor: "pointer",
8759
+ children: [
8760
+ /* @__PURE__ */ jsx8(
8761
+ Box,
8762
+ {
8763
+ onClick: () => setPricePeriod("month"),
8764
+ $padding: ".25rem .5rem",
8765
+ $flex: "1",
8766
+ $fontWeight: pricePeriod === "month" ? "600" : "400",
8767
+ $backgroundColor: pricePeriod === "month" ? "#DDDDDD" : "white",
8768
+ $borderRadius: "40px",
8769
+ children: "Billed monthly"
8770
+ }
8771
+ ),
8772
+ /* @__PURE__ */ jsx8(
8773
+ Box,
8774
+ {
8775
+ onClick: () => setPricePeriod("year"),
8776
+ $padding: ".25rem .5rem",
8777
+ $flex: "1",
8778
+ $fontWeight: pricePeriod === "year" ? "600" : "400",
8779
+ $backgroundColor: pricePeriod === "year" ? "#DDDDDD" : "white",
8780
+ $borderRadius: "40px",
8781
+ children: "Billed yearly"
8782
+ }
8783
+ )
8784
+ ]
8785
+ }
8786
+ ),
8787
+ /* @__PURE__ */ jsx8(Box, { $fontSize: "11px", $color: "#194BFB", children: "Save up to 33% with yearly billing" })
8788
+ ]
8789
+ }
8790
+ ),
8791
+ /* @__PURE__ */ jsxs3(
8792
+ Flex,
8793
+ {
8794
+ $flexDirection: "column",
8795
+ $position: "relative",
8796
+ $gap: "1rem",
8797
+ $width: "100%",
8798
+ $height: "auto",
8799
+ $padding: "1.5rem",
8800
+ $flex: "1",
8801
+ $borderBottom: "1px solid #DEDEDE",
8802
+ children: [
8803
+ /* @__PURE__ */ jsx8(Box, { $fontSize: "14px", $color: "#5D5D5D", children: "Plan" }),
8804
+ /* @__PURE__ */ jsxs3(
8805
+ Flex,
8806
+ {
8807
+ $flexDirection: "column",
8808
+ $fontSize: "14px",
8809
+ $color: "#5D5D5D",
8810
+ $gap: ".5rem",
8811
+ children: [
8812
+ /* @__PURE__ */ jsxs3(
8813
+ Flex,
8814
+ {
8815
+ $flexDirection: "row",
8816
+ $alignItems: "center",
8817
+ $justifyContent: "space-between",
8818
+ $fontSize: "14px",
8819
+ $color: "#5D5D5D",
8820
+ children: [
8821
+ /* @__PURE__ */ jsx8(Flex, { $fontSize: "14px", $color: "#5D5D5D", children: "Free" }),
8822
+ /* @__PURE__ */ jsxs3(Flex, { $fontSize: "12px", $color: "#000000", children: [
8823
+ "$0/",
8824
+ pricePeriod
8825
+ ] })
8826
+ ]
8827
+ }
8828
+ ),
8829
+ /* @__PURE__ */ jsx8(
8830
+ Box,
8831
+ {
8832
+ $width: "100%",
8833
+ $textAlign: "left",
8834
+ $opacity: "50%",
8835
+ $marginBottom: "-.25rem",
8836
+ $marginTop: "-.25rem",
8837
+ children: /* @__PURE__ */ jsx8(
8838
+ Icon2,
8839
+ {
8840
+ name: "arrow-down",
8841
+ style: {
8842
+ display: "inline-block"
8843
+ }
8844
+ }
8845
+ )
8846
+ }
8847
+ ),
8848
+ /* @__PURE__ */ jsxs3(
8849
+ Flex,
8850
+ {
8851
+ $flexDirection: "row",
8852
+ $alignItems: "center",
8853
+ $justifyContent: "space-between",
8854
+ $fontSize: "14px",
8855
+ $color: "#5D5D5D",
8856
+ children: [
8857
+ /* @__PURE__ */ jsx8(Flex, { $fontSize: "14px", $color: "#000000", $fontWeight: "600", children: "Professional" }),
8858
+ /* @__PURE__ */ jsxs3(Flex, { $fontSize: "12px", $color: "#000000", children: [
8859
+ "$285/",
8860
+ pricePeriod
8861
+ ] })
8862
+ ]
8863
+ }
8864
+ )
8865
+ ]
8866
+ }
8867
+ )
8868
+ ]
8869
+ }
8870
+ ),
8871
+ /* @__PURE__ */ jsxs3(
8872
+ Flex,
8873
+ {
8874
+ $flexDirection: "column",
8875
+ $position: "relative",
8876
+ $gap: ".75rem",
8877
+ $width: "100%",
8878
+ $height: "auto",
8879
+ $padding: "1.5rem",
8880
+ children: [
8881
+ /* @__PURE__ */ jsxs3(Flex, { $fontSize: "12px", $color: "#5D5D5D", $justifyContent: "space-between", children: [
8882
+ /* @__PURE__ */ jsxs3(Box, { $fontSize: "12px", $color: "#5D5D5D", children: [
8883
+ "Monthly total:",
8884
+ " "
8885
+ ] }),
8886
+ /* @__PURE__ */ jsx8(Box, { $fontSize: "12px", $color: "#000000", children: "$285/mo" })
8887
+ ] }),
8888
+ /* @__PURE__ */ jsx8(
8889
+ StyledButton,
8890
+ {
8891
+ $size: "sm",
8892
+ onClick: () => {
8893
+ setCheckoutStage("checkout");
8894
+ },
8895
+ children: /* @__PURE__ */ jsxs3(Flex, { $gap: ".5rem", $alignItems: "center", $justifyContent: "center", children: [
8896
+ /* @__PURE__ */ jsx8("span", { children: "Next: Checkout" }),
8897
+ /* @__PURE__ */ jsx8(Icon2, { name: "arrow-right" })
8898
+ ] })
8899
+ }
8900
+ ),
8901
+ /* @__PURE__ */ jsx8(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Discounts & credits applied at checkout" })
8902
+ ]
8903
+ }
8904
+ )
8905
+ ]
8906
+ }
8907
+ );
8908
+ };
8282
8909
  var resolveDesignProps = (props) => {
8283
8910
  return {
8284
8911
  header: {
@@ -8307,120 +8934,91 @@ var resolveDesignProps = (props) => {
8307
8934
  }
8308
8935
  };
8309
8936
  };
8310
- var PlanManager = forwardRef2(({ children, className, portal, ...rest }, ref) => {
8937
+ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) => {
8311
8938
  const props = resolveDesignProps(rest);
8312
- const { data, settings, layout, setLayout } = useEmbed();
8313
- const { plan, plans, addOns } = useMemo2(() => {
8314
- return {
8315
- plan: data.company?.plan || {},
8316
- plans: data.company?.plans?.map(({ name, description }) => ({
8317
- name,
8318
- description,
8319
- price: void 0
8320
- })) || [],
8321
- addOns: data.company?.addOns?.map(({ name, description }) => ({
8939
+ const [checkoutStage, setCheckoutStage] = useState5(
8940
+ "plan"
8941
+ );
8942
+ const [planPeriod, setPlanPeriod] = useState5("month");
8943
+ const { data, settings, layout, stripe, setLayout } = useEmbed();
8944
+ const { currentPlan, canChangePlan, availablePlans } = useMemo2(() => {
8945
+ const canChangePlan2 = stripe !== null;
8946
+ const availablePlans2 = data.activePlans?.map(
8947
+ ({ name, description, current, monthlyPrice, yearlyPrice }) => ({
8322
8948
  name,
8323
8949
  description,
8324
- price: void 0
8325
- })) || []
8950
+ price: planPeriod === "month" ? monthlyPrice?.price : yearlyPrice?.price,
8951
+ current
8952
+ })
8953
+ );
8954
+ return {
8955
+ currentPlan: data.company?.plan,
8956
+ canChangePlan: canChangePlan2,
8957
+ availablePlans: availablePlans2
8326
8958
  };
8327
- }, [data.company]);
8328
- return /* @__PURE__ */ jsxs2("div", { ref, className, children: [
8329
- /* @__PURE__ */ jsxs2(Flex, { $flexDirection: "column", $gap: "0.75rem", $margin: "0 0 3rem", children: [
8330
- props.header.isVisible && plan && /* @__PURE__ */ jsxs2(
8331
- Flex,
8332
- {
8333
- $justifyContent: "space-between",
8334
- $alignItems: "center",
8335
- $width: "100%",
8336
- $margin: "0 0 1.5rem",
8337
- children: [
8338
- /* @__PURE__ */ jsxs2("div", { children: [
8339
- /* @__PURE__ */ jsx8(Box, { $margin: "0 0 0.75rem", children: /* @__PURE__ */ jsx8(
8340
- Text,
8341
- {
8342
- $font: settings.theme.typography[props.header.title.fontStyle].fontFamily,
8343
- $size: settings.theme.typography[props.header.title.fontStyle].fontSize,
8344
- $weight: settings.theme.typography[props.header.title.fontStyle].fontWeight,
8345
- $color: settings.theme.typography[props.header.title.fontStyle].color,
8346
- $lineHeight: 1,
8347
- children: plan.name
8348
- }
8349
- ) }),
8350
- props.header.description.isVisible && plan.description && /* @__PURE__ */ jsx8(
8351
- Text,
8352
- {
8353
- $font: settings.theme.typography[props.header.description.fontStyle].fontFamily,
8354
- $size: settings.theme.typography[props.header.description.fontStyle].fontSize,
8355
- $weight: settings.theme.typography[props.header.description.fontStyle].fontWeight,
8356
- $color: settings.theme.typography[props.header.description.fontStyle].color,
8357
- children: plan.description
8358
- }
8359
- )
8360
- ] }),
8361
- props.header.price.isVisible && plan.planPrice >= 0 && /* @__PURE__ */ jsxs2(
8362
- Text,
8363
- {
8364
- $font: settings.theme.typography[props.header.price.fontStyle].fontFamily,
8365
- $size: settings.theme.typography[props.header.price.fontStyle].fontSize,
8366
- $weight: settings.theme.typography[props.header.price.fontStyle].fontWeight,
8367
- $color: settings.theme.typography[props.header.price.fontStyle].color,
8368
- children: [
8369
- "$",
8370
- plan.planPrice,
8371
- "/",
8372
- plan.planPeriod
8373
- ]
8374
- }
8375
- )
8376
- ]
8377
- }
8378
- ),
8379
- props.addOns.isVisible && /* @__PURE__ */ jsxs2(Fragment, { children: [
8380
- props.addOns.showLabel && /* @__PURE__ */ jsx8(
8381
- Text,
8382
- {
8383
- $font: settings.theme.typography.text.fontFamily,
8384
- $size: settings.theme.typography.text.fontSize,
8385
- $weight: 500,
8386
- $color: darken(settings.theme.typography.text.color, 20),
8387
- children: "Add-Ons"
8388
- }
8389
- ),
8390
- /* @__PURE__ */ jsx8(Box, { $width: "100%", $margin: "0 0 1rem", children: addOns.map((addOn, index) => /* @__PURE__ */ jsxs2(
8959
+ }, [data.company, data.activePlans, stripe, planPeriod]);
8960
+ return /* @__PURE__ */ jsxs3("div", { ref, className, children: [
8961
+ /* @__PURE__ */ jsx8(
8962
+ Flex,
8963
+ {
8964
+ $flexDirection: "column",
8965
+ $gap: "0.75rem",
8966
+ ...canChangePlan && { $margin: "0 0 0.5rem" },
8967
+ children: props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs3(
8391
8968
  Flex,
8392
8969
  {
8393
8970
  $justifyContent: "space-between",
8394
8971
  $alignItems: "center",
8395
8972
  $width: "100%",
8973
+ ...canChangePlan && { $margin: "0 0 1.5rem" },
8396
8974
  children: [
8397
- /* @__PURE__ */ jsx8(
8975
+ /* @__PURE__ */ jsxs3("div", { children: [
8976
+ /* @__PURE__ */ jsx8(Box, { $margin: "0 0 0.75rem", children: /* @__PURE__ */ jsx8(
8977
+ Text,
8978
+ {
8979
+ $font: settings.theme.typography[props.header.title.fontStyle].fontFamily,
8980
+ $size: settings.theme.typography[props.header.title.fontStyle].fontSize,
8981
+ $weight: settings.theme.typography[props.header.title.fontStyle].fontWeight,
8982
+ $color: settings.theme.typography[props.header.title.fontStyle].color,
8983
+ $lineHeight: 1,
8984
+ children: currentPlan.name
8985
+ }
8986
+ ) }),
8987
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx8(
8988
+ Text,
8989
+ {
8990
+ $font: settings.theme.typography[props.header.description.fontStyle].fontFamily,
8991
+ $size: settings.theme.typography[props.header.description.fontStyle].fontSize,
8992
+ $weight: settings.theme.typography[props.header.description.fontStyle].fontWeight,
8993
+ $color: settings.theme.typography[props.header.description.fontStyle].color,
8994
+ children: currentPlan.description
8995
+ }
8996
+ )
8997
+ ] }),
8998
+ props.header.price.isVisible && currentPlan.planPrice >= 0 && currentPlan.planPeriod && /* @__PURE__ */ jsxs3(
8398
8999
  Text,
8399
9000
  {
8400
- $font: settings.theme.typography[props.addOns.fontStyle].fontFamily,
8401
- $size: settings.theme.typography[props.addOns.fontStyle].fontSize,
8402
- $weight: settings.theme.typography[props.addOns.fontStyle].fontWeight,
8403
- $color: settings.theme.typography[props.addOns.fontStyle].color,
8404
- children: addOn.name
9001
+ $font: settings.theme.typography[props.header.price.fontStyle].fontFamily,
9002
+ $size: settings.theme.typography[props.header.price.fontStyle].fontSize,
9003
+ $weight: settings.theme.typography[props.header.price.fontStyle].fontWeight,
9004
+ $color: settings.theme.typography[props.header.price.fontStyle].color,
9005
+ children: [
9006
+ "$",
9007
+ currentPlan.planPrice,
9008
+ "/",
9009
+ currentPlan.planPeriod
9010
+ ]
8405
9011
  }
8406
- ),
8407
- addOn.price >= 0 && /* @__PURE__ */ jsxs2(Text, { $weight: 500, children: [
8408
- "$",
8409
- addOn.price,
8410
- "/mo"
8411
- ] })
9012
+ )
8412
9013
  ]
8413
- },
8414
- index
8415
- )) })
8416
- ] })
8417
- ] }),
8418
- props.callToAction.isVisible && /* @__PURE__ */ jsx8(
9014
+ }
9015
+ )
9016
+ }
9017
+ ),
9018
+ canChangePlan && props.callToAction.isVisible && /* @__PURE__ */ jsx8(
8419
9019
  StyledButton,
8420
9020
  {
8421
9021
  onClick: () => {
8422
- if (layout !== "checkout")
8423
- return;
8424
9022
  setLayout("checkout");
8425
9023
  },
8426
9024
  $size: props.callToAction.buttonSize,
@@ -8436,91 +9034,277 @@ var PlanManager = forwardRef2(({ children, className, portal, ...rest }, ref) =>
8436
9034
  )
8437
9035
  }
8438
9036
  ),
8439
- children,
8440
- layout === "checkout" && createPortal(
8441
- /* @__PURE__ */ jsx8(
8442
- Box,
8443
- {
8444
- $position: "absolute",
8445
- $top: "50%",
8446
- $left: "50%",
8447
- $zIndex: "999999",
8448
- $transform: "translate(-50%, -50%)",
8449
- $width: "100%",
8450
- $height: "100%",
8451
- $backgroundColor: "#B5B5B580",
8452
- children: /* @__PURE__ */ jsxs2(
9037
+ canChangePlan && layout === "checkout" && createPortal(
9038
+ /* @__PURE__ */ jsxs3(OverlayWrapper, { children: [
9039
+ /* @__PURE__ */ jsx8(OverlayHeader, { children: /* @__PURE__ */ jsxs3(Flex, { $gap: "1rem", children: [
9040
+ /* @__PURE__ */ jsxs3(Flex, { $flexDirection: "row", $gap: "0.5rem", $alignItems: "center", children: [
9041
+ /* @__PURE__ */ jsx8(
9042
+ Box,
9043
+ {
9044
+ $width: "15px",
9045
+ $height: "15px",
9046
+ $border: "2px solid #DDDDDD",
9047
+ $borderRadius: "999px",
9048
+ $backgroundColor: "white"
9049
+ }
9050
+ ),
9051
+ /* @__PURE__ */ jsx8(
9052
+ "div",
9053
+ {
9054
+ ...checkoutStage === "plan" && {
9055
+ style: {
9056
+ fontWeight: "700"
9057
+ }
9058
+ },
9059
+ children: "1. Select plan"
9060
+ }
9061
+ ),
9062
+ /* @__PURE__ */ jsx8(
9063
+ Icon2,
9064
+ {
9065
+ name: "chevron-right",
9066
+ style: { fontSize: 16, color: "#D0D0D0" }
9067
+ }
9068
+ )
9069
+ ] }),
9070
+ /* @__PURE__ */ jsxs3(Flex, { $flexDirection: "row", $gap: "0.5rem", $alignItems: "center", children: [
9071
+ /* @__PURE__ */ jsx8(
9072
+ Box,
9073
+ {
9074
+ $width: "15px",
9075
+ $height: "15px",
9076
+ $border: "2px solid #DDDDDD",
9077
+ $borderRadius: "999px",
9078
+ $backgroundColor: "white"
9079
+ }
9080
+ ),
9081
+ /* @__PURE__ */ jsx8(
9082
+ "div",
9083
+ {
9084
+ ...checkoutStage === "checkout" && {
9085
+ style: {
9086
+ fontWeight: "700"
9087
+ }
9088
+ },
9089
+ children: "2. Checkout"
9090
+ }
9091
+ ),
9092
+ /* @__PURE__ */ jsx8(
9093
+ Icon2,
9094
+ {
9095
+ name: "chevron-right",
9096
+ style: { fontSize: 16, color: "#D0D0D0" }
9097
+ }
9098
+ )
9099
+ ] })
9100
+ ] }) }),
9101
+ /* @__PURE__ */ jsxs3(Flex, { $flexDirection: "row", $height: "100%", children: [
9102
+ /* @__PURE__ */ jsxs3(
8453
9103
  Flex,
8454
9104
  {
8455
- $position: "relative",
8456
- $top: "50%",
8457
- $left: "50%",
8458
- $transform: "translate(-50%, -50%)",
8459
- $width: "956px",
8460
- $height: "700px",
9105
+ $flexDirection: "column",
9106
+ $gap: "1rem",
9107
+ $padding: "2rem 2.5rem 2rem 2.5rem",
8461
9108
  $backgroundColor: "#FBFBFB",
8462
- $borderRadius: "8px",
8463
- $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
8464
- id: "select-plan-dialog",
8465
- role: "dialog",
8466
- "aria-labelledby": "select-plan-dialog-label",
8467
- "aria-modal": "true",
9109
+ $borderRadius: "0 0.5rem 0",
9110
+ $flex: "1",
9111
+ $height: "100%",
8468
9112
  children: [
8469
- /* @__PURE__ */ jsx8(
8470
- Box,
8471
- {
8472
- $position: "absolute",
8473
- $top: "0.25rem",
8474
- $right: "0.75rem",
8475
- $cursor: "pointer",
8476
- onClick: () => {
8477
- setLayout("portal");
8478
- },
8479
- children: /* @__PURE__ */ jsx8(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } })
8480
- }
8481
- ),
8482
- /* @__PURE__ */ jsxs2(Flex, { $flexDirection: "column", $gap: "1rem", children: [
8483
- /* @__PURE__ */ jsx8(
8484
- Text,
9113
+ checkoutStage === "plan" && /* @__PURE__ */ jsxs3(Fragment, { children: [
9114
+ /* @__PURE__ */ jsxs3(
9115
+ Flex,
8485
9116
  {
8486
- as: "h1",
8487
- id: "select-plan-dialog-label",
8488
- $size: 24,
8489
- $weight: 800,
8490
- children: "Select plan"
9117
+ $flexDirection: "column",
9118
+ $gap: "1rem",
9119
+ $marginBottom: "1rem",
9120
+ children: [
9121
+ /* @__PURE__ */ jsx8(
9122
+ Text,
9123
+ {
9124
+ as: "h1",
9125
+ id: "select-plan-dialog-label",
9126
+ $size: 18,
9127
+ $marginBottom: ".5rem",
9128
+ children: "Select plan"
9129
+ }
9130
+ ),
9131
+ /* @__PURE__ */ jsx8(
9132
+ Text,
9133
+ {
9134
+ as: "p",
9135
+ id: "select-plan-dialog-description",
9136
+ $size: 14,
9137
+ $weight: 400,
9138
+ children: "Choose your base plan"
9139
+ }
9140
+ )
9141
+ ]
8491
9142
  }
8492
9143
  ),
8493
- /* @__PURE__ */ jsx8(Flex, { $flexDirection: "column", $gap: "1rem", children: plans.map((plan2, index) => /* @__PURE__ */ jsxs2(
9144
+ /* @__PURE__ */ jsx8(
8494
9145
  Flex,
8495
9146
  {
8496
- $justifyContent: "space-between",
8497
- $alignItems: "center",
8498
- $width: "100%",
8499
- children: [
8500
- /* @__PURE__ */ jsx8(Text, { $size: 20, $weight: 800, children: plan2.name }),
8501
- plan2.price >= 0 && /* @__PURE__ */ jsxs2(Text, { children: [
8502
- "$",
8503
- plan2.price,
8504
- "/mo"
8505
- ] })
8506
- ]
8507
- },
8508
- index
8509
- )) })
8510
- ] })
9147
+ $flexDirection: "row",
9148
+ $gap: "1rem",
9149
+ $flex: "1",
9150
+ $height: "100%",
9151
+ children: availablePlans?.map((plan) => {
9152
+ return /* @__PURE__ */ jsxs3(
9153
+ Flex,
9154
+ {
9155
+ $height: "100%",
9156
+ $flexDirection: "column",
9157
+ $backgroundColor: "white",
9158
+ $border: plan?.current ? `2px solid #194BFB` : "",
9159
+ $flex: "1",
9160
+ $borderRadius: ".5rem",
9161
+ $boxShadow: "0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 20px rgba(16, 24, 40, 0.06)",
9162
+ children: [
9163
+ /* @__PURE__ */ jsxs3(
9164
+ Flex,
9165
+ {
9166
+ $flexDirection: "column",
9167
+ $position: "relative",
9168
+ $gap: "1rem",
9169
+ $width: "100%",
9170
+ $height: "auto",
9171
+ $padding: "1.5rem",
9172
+ $borderBottom: "1px solid #DEDEDE",
9173
+ children: [
9174
+ /* @__PURE__ */ jsx8(Text, { $size: 20, $weight: 600, children: plan?.name }),
9175
+ /* @__PURE__ */ jsx8(Text, { $size: 14, children: plan?.description }),
9176
+ /* @__PURE__ */ jsxs3(Text, { children: [
9177
+ /* @__PURE__ */ jsx8(Box, { $display: "inline-block", $fontSize: ".90rem", children: "$" }),
9178
+ /* @__PURE__ */ jsx8(Box, { $display: "inline-block", $fontSize: "1.5rem", children: plan?.price ? plan.price : "350" }),
9179
+ /* @__PURE__ */ jsxs3(Box, { $display: "inline-block", $fontSize: ".75rem", children: [
9180
+ "/",
9181
+ planPeriod
9182
+ ] })
9183
+ ] }),
9184
+ plan?.current && /* @__PURE__ */ jsx8(
9185
+ Flex,
9186
+ {
9187
+ $position: "absolute",
9188
+ $right: "1rem",
9189
+ $top: "1rem",
9190
+ $fontSize: ".75rem",
9191
+ $color: "white",
9192
+ $backgroundColor: "#194BFB",
9193
+ $borderRadius: "999px",
9194
+ $padding: ".125rem .85rem",
9195
+ children: "Current plan"
9196
+ }
9197
+ )
9198
+ ]
9199
+ }
9200
+ ),
9201
+ /* @__PURE__ */ jsx8(
9202
+ Flex,
9203
+ {
9204
+ $flexDirection: "column",
9205
+ $position: "relative",
9206
+ $gap: "0.5rem",
9207
+ $flex: "1",
9208
+ $width: "100%",
9209
+ $height: "auto",
9210
+ $padding: "1.5rem",
9211
+ children: [{}, {}, {}].map(() => {
9212
+ return /* @__PURE__ */ jsxs3(Flex, { $flexShrink: "0", $gap: "1rem", children: [
9213
+ /* @__PURE__ */ jsx8(
9214
+ IconRound,
9215
+ {
9216
+ name: "server-search",
9217
+ size: "tn",
9218
+ colors: ["#00000", "#F5F5F5"]
9219
+ }
9220
+ ),
9221
+ /* @__PURE__ */ jsx8(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx8(Text, { $size: ".75rem", $color: "#00000", children: "5 Queries/mo" }) })
9222
+ ] });
9223
+ })
9224
+ }
9225
+ ),
9226
+ /* @__PURE__ */ jsx8(
9227
+ Flex,
9228
+ {
9229
+ $flexDirection: "column",
9230
+ $position: "relative",
9231
+ $gap: "1rem",
9232
+ $width: "100%",
9233
+ $height: "auto",
9234
+ $padding: "1.5rem",
9235
+ children: plan.current ? /* @__PURE__ */ jsxs3(
9236
+ Flex,
9237
+ {
9238
+ $flexDirection: "row",
9239
+ $gap: ".5rem",
9240
+ $justifyContent: "center",
9241
+ $alignItems: "center",
9242
+ children: [
9243
+ /* @__PURE__ */ jsx8(
9244
+ Icon2,
9245
+ {
9246
+ name: "check-rounded",
9247
+ style: {
9248
+ fontSize: 24,
9249
+ lineHeight: "1em",
9250
+ color: "#194BFB"
9251
+ }
9252
+ }
9253
+ ),
9254
+ /* @__PURE__ */ jsx8(
9255
+ "span",
9256
+ {
9257
+ style: {
9258
+ fontSize: "1rem",
9259
+ color: "#7B7B7B"
9260
+ },
9261
+ children: "Selected"
9262
+ }
9263
+ )
9264
+ ]
9265
+ }
9266
+ ) : /* @__PURE__ */ jsx8(
9267
+ StyledButton,
9268
+ {
9269
+ $size: "sm",
9270
+ $color: "secondary",
9271
+ $variant: "outline",
9272
+ onClick: () => {
9273
+ },
9274
+ children: "Select"
9275
+ }
9276
+ )
9277
+ }
9278
+ )
9279
+ ]
9280
+ }
9281
+ );
9282
+ })
9283
+ }
9284
+ )
9285
+ ] }),
9286
+ checkoutStage === "checkout" && /* @__PURE__ */ jsx8(CheckoutForm, {})
8511
9287
  ]
8512
9288
  }
9289
+ ),
9290
+ /* @__PURE__ */ jsx8(
9291
+ OverlaySideBar,
9292
+ {
9293
+ pricePeriod: planPeriod,
9294
+ setPricePeriod: setPlanPeriod,
9295
+ setCheckoutStage
9296
+ }
8513
9297
  )
8514
- }
8515
- ),
9298
+ ] })
9299
+ ] }),
8516
9300
  portal || document.body
8517
9301
  )
8518
9302
  ] });
8519
9303
  });
8520
9304
 
8521
9305
  // src/components/elements/included-features/IncludedFeatures.tsx
8522
- import { forwardRef as forwardRef3, useMemo as useMemo3 } from "react";
8523
- import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
9306
+ import { forwardRef as forwardRef2, useMemo as useMemo3 } from "react";
9307
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
8524
9308
  function resolveDesignProps2(props) {
8525
9309
  return {
8526
9310
  header: {
@@ -8543,7 +9327,7 @@ function resolveDesignProps2(props) {
8543
9327
  }
8544
9328
  };
8545
9329
  }
8546
- var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
9330
+ var IncludedFeatures = forwardRef2(({ className, ...rest }, ref) => {
8547
9331
  const props = resolveDesignProps2(rest);
8548
9332
  const { data, settings } = useEmbed();
8549
9333
  const features = useMemo3(() => {
@@ -8554,7 +9338,7 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
8554
9338
  allocationType,
8555
9339
  feature,
8556
9340
  period,
8557
- usage,
9341
+ usage = 0,
8558
9342
  ...props2
8559
9343
  }) => {
8560
9344
  return {
@@ -8573,7 +9357,7 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
8573
9357
  }
8574
9358
  );
8575
9359
  }, [data.featureUsage]);
8576
- return /* @__PURE__ */ jsxs3(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: [
9360
+ return /* @__PURE__ */ jsxs4(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: [
8577
9361
  props.header.isVisible && /* @__PURE__ */ jsx9(Box, { children: /* @__PURE__ */ jsx9(
8578
9362
  Text,
8579
9363
  {
@@ -8591,7 +9375,7 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
8591
9375
  }
8592
9376
  return [
8593
9377
  ...acc,
8594
- /* @__PURE__ */ jsxs3(
9378
+ /* @__PURE__ */ jsxs4(
8595
9379
  Flex,
8596
9380
  {
8597
9381
  $flexWrap: "wrap",
@@ -8599,7 +9383,7 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
8599
9383
  $alignItems: "center",
8600
9384
  $gap: "1rem",
8601
9385
  children: [
8602
- /* @__PURE__ */ jsxs3(Flex, { $flexShrink: "0", $gap: "1rem", children: [
9386
+ /* @__PURE__ */ jsxs4(Flex, { $gap: "1rem", children: [
8603
9387
  props.icons.isVisible && feature?.icon && /* @__PURE__ */ jsx9(
8604
9388
  IconRound,
8605
9389
  {
@@ -8618,12 +9402,11 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
8618
9402
  $size: settings.theme.typography[props.icons.fontStyle].fontSize,
8619
9403
  $weight: settings.theme.typography[props.icons.fontStyle].fontWeight,
8620
9404
  $color: settings.theme.typography[props.icons.fontStyle].color,
8621
- $align: "center",
8622
9405
  children: feature.name
8623
9406
  }
8624
9407
  ) })
8625
9408
  ] }),
8626
- allocationType === "numeric" && feature?.name && /* @__PURE__ */ jsxs3(Box, { $textAlign: "right", children: [
9409
+ allocationType === "numeric" && feature?.name && /* @__PURE__ */ jsxs4(Box, { $textAlign: "right", children: [
8627
9410
  props.entitlement.isVisible && /* @__PURE__ */ jsx9(
8628
9411
  Text,
8629
9412
  {
@@ -8659,8 +9442,8 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
8659
9442
  });
8660
9443
 
8661
9444
  // src/components/elements/metered-features/MeteredFeatures.tsx
8662
- import { forwardRef as forwardRef4, useMemo as useMemo4 } from "react";
8663
- import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
9445
+ import { forwardRef as forwardRef3, useMemo as useMemo4 } from "react";
9446
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
8664
9447
  function resolveDesignProps3(props) {
8665
9448
  return {
8666
9449
  isVisible: props.isVisible ?? true,
@@ -8689,7 +9472,7 @@ function resolveDesignProps3(props) {
8689
9472
  }
8690
9473
  };
8691
9474
  }
8692
- var MeteredFeatures = forwardRef4(({ className, ...rest }, ref) => {
9475
+ var MeteredFeatures = forwardRef3(({ className, ...rest }, ref) => {
8693
9476
  const props = resolveDesignProps3(rest);
8694
9477
  const { data, settings } = useEmbed();
8695
9478
  const features = useMemo4(() => {
@@ -8726,11 +9509,11 @@ var MeteredFeatures = forwardRef4(({ className, ...rest }, ref) => {
8726
9509
  }
8727
9510
  return [
8728
9511
  ...acc,
8729
- /* @__PURE__ */ jsxs4(Flex, { $gap: "1.5rem", children: [
9512
+ /* @__PURE__ */ jsxs5(Flex, { $gap: "1.5rem", children: [
8730
9513
  props.icon.isVisible && feature?.icon && /* @__PURE__ */ jsx10(Box, { $flexShrink: "0", children: /* @__PURE__ */ jsx10(IconRound, { name: feature.icon, size: "sm" }) }),
8731
- /* @__PURE__ */ jsxs4(Box, { $flexGrow: "1", children: [
8732
- /* @__PURE__ */ jsxs4(Flex, { children: [
8733
- feature?.name && /* @__PURE__ */ jsxs4(Box, { $flexGrow: "1", children: [
9514
+ /* @__PURE__ */ jsxs5(Box, { $flexGrow: "1", children: [
9515
+ /* @__PURE__ */ jsxs5(Flex, { children: [
9516
+ feature?.name && /* @__PURE__ */ jsxs5(Box, { $flexGrow: "1", children: [
8734
9517
  /* @__PURE__ */ jsx10(
8735
9518
  Text,
8736
9519
  {
@@ -8754,7 +9537,7 @@ var MeteredFeatures = forwardRef4(({ className, ...rest }, ref) => {
8754
9537
  }
8755
9538
  )
8756
9539
  ] }),
8757
- allocationType === "numeric" && feature?.name && /* @__PURE__ */ jsxs4(Box, { $textAlign: "right", children: [
9540
+ allocationType === "numeric" && feature?.name && /* @__PURE__ */ jsxs5(Box, { $textAlign: "right", children: [
8758
9541
  props.allocation.isVisible && /* @__PURE__ */ jsx10(
8759
9542
  Text,
8760
9543
  {
@@ -8797,8 +9580,8 @@ var MeteredFeatures = forwardRef4(({ className, ...rest }, ref) => {
8797
9580
  });
8798
9581
 
8799
9582
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
8800
- import { forwardRef as forwardRef5, useMemo as useMemo5 } from "react";
8801
- import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
9583
+ import { forwardRef as forwardRef4, useMemo as useMemo5 } from "react";
9584
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
8802
9585
  function resolveDesignProps4(props) {
8803
9586
  return {
8804
9587
  header: {
@@ -8817,27 +9600,37 @@ function resolveDesignProps4(props) {
8817
9600
  }
8818
9601
  };
8819
9602
  }
8820
- var UpcomingBill = forwardRef5(({ className, ...rest }, ref) => {
9603
+ var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
8821
9604
  const props = resolveDesignProps4(rest);
8822
- const { settings } = useEmbed();
8823
- const { bill } = useMemo5(() => {
9605
+ const { data, settings, stripe } = useEmbed();
9606
+ const { latestInvoice } = useMemo5(() => {
8824
9607
  return {
8825
- bill: {
8826
- amount: 200,
8827
- period: "monthly",
8828
- dueDate: toPrettyDate(/* @__PURE__ */ new Date("2024-06-12")),
8829
- endDate: (/* @__PURE__ */ new Date("2025-05-12")).toLocaleDateString()
9608
+ latestInvoice: {
9609
+ ...data.subscription?.latestInvoice?.amountDue && {
9610
+ amountDue: data.subscription.latestInvoice.amountDue
9611
+ },
9612
+ ...data.subscription?.interval && {
9613
+ interval: data.subscription.interval
9614
+ },
9615
+ ...data.subscription?.latestInvoice?.dueDate && {
9616
+ dueDate: toPrettyDate(
9617
+ new Date(data.subscription.latestInvoice.dueDate)
9618
+ )
9619
+ }
8830
9620
  }
8831
9621
  };
8832
- }, []);
8833
- return /* @__PURE__ */ jsxs5("div", { ref, className, children: [
8834
- props.header.isVisible && /* @__PURE__ */ jsx11(
9622
+ }, [data.subscription]);
9623
+ if (!stripe || !data.subscription?.latestInvoice) {
9624
+ return null;
9625
+ }
9626
+ return /* @__PURE__ */ jsxs6("div", { ref, className, children: [
9627
+ props.header.isVisible && latestInvoice.dueDate && /* @__PURE__ */ jsx11(
8835
9628
  Flex,
8836
9629
  {
8837
9630
  $justifyContent: "space-between",
8838
9631
  $alignItems: "center",
8839
9632
  $margin: "0 0 0.75rem",
8840
- children: /* @__PURE__ */ jsxs5(
9633
+ children: /* @__PURE__ */ jsxs6(
8841
9634
  Text,
8842
9635
  {
8843
9636
  $font: settings.theme.typography[props.header.fontStyle].fontFamily,
@@ -8847,14 +9640,14 @@ var UpcomingBill = forwardRef5(({ className, ...rest }, ref) => {
8847
9640
  children: [
8848
9641
  props.header.prefix,
8849
9642
  " ",
8850
- bill.dueDate
9643
+ latestInvoice.dueDate
8851
9644
  ]
8852
9645
  }
8853
9646
  )
8854
9647
  }
8855
9648
  ),
8856
- /* @__PURE__ */ jsxs5(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
8857
- props.price.isVisible && /* @__PURE__ */ jsx11(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ jsxs5(
9649
+ latestInvoice.amountDue && /* @__PURE__ */ jsxs6(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
9650
+ props.price.isVisible && /* @__PURE__ */ jsx11(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ jsxs6(
8858
9651
  Text,
8859
9652
  {
8860
9653
  $font: settings.theme.typography[props.price.fontStyle].fontFamily,
@@ -8871,27 +9664,18 @@ var UpcomingBill = forwardRef5(({ className, ...rest }, ref) => {
8871
9664
  children: "$"
8872
9665
  }
8873
9666
  ),
8874
- bill.amount
9667
+ latestInvoice.amountDue
8875
9668
  ]
8876
9669
  }
8877
9670
  ) }),
8878
- /* @__PURE__ */ jsx11(Box, { $maxWidth: "140px", $lineHeight: "1", children: /* @__PURE__ */ jsxs5(
9671
+ /* @__PURE__ */ jsx11(Box, { $maxWidth: "10rem", $lineHeight: "1", $textAlign: "right", children: /* @__PURE__ */ jsx11(
8879
9672
  Text,
8880
9673
  {
8881
9674
  $font: settings.theme.typography[props.contractEndDate.fontStyle].fontFamily,
8882
9675
  $size: settings.theme.typography[props.contractEndDate.fontStyle].fontSize,
8883
9676
  $weight: settings.theme.typography[props.contractEndDate.fontStyle].fontWeight,
8884
9677
  $color: settings.theme.typography[props.contractEndDate.fontStyle].color,
8885
- children: [
8886
- "Estimated monthly bill.",
8887
- props.contractEndDate.isVisible && /* @__PURE__ */ jsxs5(Fragment2, { children: [
8888
- "\xA0",
8889
- props.contractEndDate.prefix,
8890
- " ",
8891
- bill.endDate,
8892
- "."
8893
- ] })
8894
- ]
9678
+ children: "Estimated monthly bill."
8895
9679
  }
8896
9680
  ) })
8897
9681
  ] })
@@ -8899,9 +9683,9 @@ var UpcomingBill = forwardRef5(({ className, ...rest }, ref) => {
8899
9683
  });
8900
9684
 
8901
9685
  // src/components/elements/payment-method/PaymentMethod.tsx
8902
- import { forwardRef as forwardRef6, useMemo as useMemo6 } from "react";
9686
+ import { forwardRef as forwardRef5, useMemo as useMemo6 } from "react";
8903
9687
  import { createPortal as createPortal2 } from "react-dom";
8904
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
9688
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
8905
9689
  var resolveDesignProps5 = (props) => {
8906
9690
  return {
8907
9691
  header: {
@@ -8913,25 +9697,30 @@ var resolveDesignProps5 = (props) => {
8913
9697
  }
8914
9698
  };
8915
9699
  };
8916
- var PaymentMethod = forwardRef6(({ children, className, portal, ...rest }, ref) => {
9700
+ var PaymentMethod = forwardRef5(({ children, className, portal, ...rest }, ref) => {
8917
9701
  const props = resolveDesignProps5(rest);
8918
- const { settings, layout, setLayout } = useEmbed();
9702
+ const { data, settings, stripe, layout, setLayout } = useEmbed();
8919
9703
  const paymentMethod = useMemo6(() => {
8920
- const cardNumber = "4512";
8921
- const expirationDate = "2024-12-22";
8922
- const timeToExpiration = Math.round(
8923
- +new Date(expirationDate) - +/* @__PURE__ */ new Date()
8924
- );
8925
- const monthsToExpiration = Math.round(
8926
- timeToExpiration / (1e3 * 60 * 60 * 24 * 30)
8927
- );
9704
+ const { cardLast4, cardExpMonth, cardExpYear } = data.subscription?.paymentMethod || {};
9705
+ let monthsToExpiration;
9706
+ if (typeof cardExpYear === "number" && typeof cardExpMonth === "number") {
9707
+ const timeToExpiration = Math.round(
9708
+ +new Date(cardExpYear, cardExpMonth - 1) - +/* @__PURE__ */ new Date()
9709
+ );
9710
+ monthsToExpiration = Math.round(
9711
+ timeToExpiration / (1e3 * 60 * 60 * 24 * 30)
9712
+ );
9713
+ }
8928
9714
  return {
8929
- cardNumber,
9715
+ cardLast4,
8930
9716
  monthsToExpiration
8931
9717
  };
8932
- }, []);
8933
- return /* @__PURE__ */ jsxs6("div", { ref, className, children: [
8934
- props.header.isVisible && /* @__PURE__ */ jsxs6(
9718
+ }, [data.subscription?.paymentMethod]);
9719
+ if (!stripe || !data.subscription?.paymentMethod) {
9720
+ return null;
9721
+ }
9722
+ return /* @__PURE__ */ jsxs7("div", { ref, className, children: [
9723
+ props.header.isVisible && /* @__PURE__ */ jsxs7(
8935
9724
  Flex,
8936
9725
  {
8937
9726
  $justifyContent: "space-between",
@@ -8948,7 +9737,7 @@ var PaymentMethod = forwardRef6(({ children, className, portal, ...rest }, ref)
8948
9737
  children: "Payment Method"
8949
9738
  }
8950
9739
  ),
8951
- Math.abs(paymentMethod.monthsToExpiration) < 4 && /* @__PURE__ */ jsx12(
9740
+ typeof paymentMethod.monthsToExpiration === "number" && Math.abs(paymentMethod.monthsToExpiration) < 4 && /* @__PURE__ */ jsx12(
8952
9741
  Text,
8953
9742
  {
8954
9743
  $font: settings.theme.typography.text.fontFamily,
@@ -8960,7 +9749,7 @@ var PaymentMethod = forwardRef6(({ children, className, portal, ...rest }, ref)
8960
9749
  ]
8961
9750
  }
8962
9751
  ),
8963
- /* @__PURE__ */ jsxs6(
9752
+ paymentMethod.cardLast4 && /* @__PURE__ */ jsxs7(
8964
9753
  Flex,
8965
9754
  {
8966
9755
  $justifyContent: "space-between",
@@ -8970,9 +9759,9 @@ var PaymentMethod = forwardRef6(({ children, className, portal, ...rest }, ref)
8970
9759
  $padding: "0.375rem 1rem",
8971
9760
  $borderRadius: "9999px",
8972
9761
  children: [
8973
- /* @__PURE__ */ jsxs6(Text, { $font: settings.theme.typography.text.fontFamily, $size: 14, children: [
9762
+ /* @__PURE__ */ jsxs7(Text, { $font: settings.theme.typography.text.fontFamily, $size: 14, children: [
8974
9763
  "\u{1F4B3} Card ending in ",
8975
- paymentMethod.cardNumber
9764
+ paymentMethod.cardLast4
8976
9765
  ] }),
8977
9766
  props.functions.allowEdit && /* @__PURE__ */ jsx12(
8978
9767
  Text,
@@ -8994,70 +9783,254 @@ var PaymentMethod = forwardRef6(({ children, className, portal, ...rest }, ref)
8994
9783
  }
8995
9784
  ),
8996
9785
  layout === "payment" && createPortal2(
8997
- /* @__PURE__ */ jsx12(
8998
- Box,
8999
- {
9000
- $position: "absolute",
9001
- $top: "50%",
9002
- $left: "50%",
9003
- $zIndex: "999999",
9004
- $transform: "translate(-50%, -50%)",
9005
- $width: "100%",
9006
- $height: "100%",
9007
- $backgroundColor: "#B5B5B580",
9008
- children: /* @__PURE__ */ jsxs6(
9009
- Flex,
9010
- {
9011
- $position: "relative",
9012
- $top: "50%",
9013
- $left: "50%",
9014
- $transform: "translate(-50%, -50%)",
9015
- $width: "956px",
9016
- $height: "700px",
9017
- $backgroundColor: "#FBFBFB",
9018
- $borderRadius: "8px",
9019
- $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
9020
- id: "select-plan-dialog",
9021
- role: "dialog",
9022
- "aria-labelledby": "select-plan-dialog-label",
9023
- "aria-modal": "true",
9024
- children: [
9025
- /* @__PURE__ */ jsx12(
9026
- Box,
9027
- {
9028
- $position: "absolute",
9029
- $top: "0.25rem",
9030
- $right: "0.75rem",
9031
- $cursor: "pointer",
9032
- onClick: () => {
9033
- setLayout("portal");
9034
- },
9035
- children: /* @__PURE__ */ jsx12(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } })
9036
- }
9037
- ),
9038
- /* @__PURE__ */ jsx12(Flex, { $flexDirection: "column", $gap: "1rem", children: /* @__PURE__ */ jsx12(
9039
- Text,
9040
- {
9041
- as: "h1",
9042
- id: "select-plan-dialog-label",
9043
- $size: 24,
9044
- $weight: 800,
9045
- children: "Add payment method"
9046
- }
9047
- ) })
9048
- ]
9049
- }
9050
- )
9051
- }
9052
- ),
9786
+ /* @__PURE__ */ jsxs7(OverlayWrapper, { size: "md", children: [
9787
+ /* @__PURE__ */ jsx12(OverlayHeader, { children: /* @__PURE__ */ jsx12(Box, { $fontWeight: "600", children: "Edit payment method" }) }),
9788
+ /* @__PURE__ */ jsxs7(
9789
+ Flex,
9790
+ {
9791
+ $flexDirection: "column",
9792
+ $padding: "2.5rem",
9793
+ $height: "100%",
9794
+ $gap: "1.5rem",
9795
+ children: [
9796
+ /* @__PURE__ */ jsx12(
9797
+ Flex,
9798
+ {
9799
+ $flexDirection: "column",
9800
+ $gap: "1rem",
9801
+ $backgroundColor: "#FBFBFB",
9802
+ $borderRadius: "0 0 0.5rem 0.5rem",
9803
+ $flex: "1",
9804
+ $height: "100%",
9805
+ children: /* @__PURE__ */ jsxs7(Flex, { $flexDirection: "column", $height: "100%", children: [
9806
+ /* @__PURE__ */ jsx12(
9807
+ Box,
9808
+ {
9809
+ $fontSize: "18px",
9810
+ $marginBottom: "1.5rem",
9811
+ $display: "inline-block",
9812
+ $width: "100%",
9813
+ children: "Default"
9814
+ }
9815
+ ),
9816
+ /* @__PURE__ */ jsxs7(Flex, { $gap: "1rem", children: [
9817
+ /* @__PURE__ */ jsx12(
9818
+ Flex,
9819
+ {
9820
+ $alignItems: "center",
9821
+ $padding: ".5rem 1rem",
9822
+ $border: "1px solid #E2E5E9",
9823
+ $borderRadius: ".5rem",
9824
+ $backgroundColor: "#ffffff",
9825
+ $flexDirection: "row",
9826
+ $gap: "1rem",
9827
+ $width: "100%",
9828
+ children: /* @__PURE__ */ jsxs7(
9829
+ Flex,
9830
+ {
9831
+ $flexDirection: "row",
9832
+ $justifyContent: "space-between",
9833
+ $flex: "1",
9834
+ children: [
9835
+ /* @__PURE__ */ jsxs7(
9836
+ Flex,
9837
+ {
9838
+ $flexDirection: "row",
9839
+ $alignItems: "center",
9840
+ $gap: "1rem",
9841
+ children: [
9842
+ /* @__PURE__ */ jsx12(Box, { $display: "inline-block", children: /* @__PURE__ */ jsx12(
9843
+ "svg",
9844
+ {
9845
+ viewBox: "0 0 24 16",
9846
+ fill: "none",
9847
+ xmlns: "http://www.w3.org/2000/svg",
9848
+ width: "26px",
9849
+ height: "auto",
9850
+ children: /* @__PURE__ */ jsxs7("g", { children: [
9851
+ /* @__PURE__ */ jsx12(
9852
+ "rect",
9853
+ {
9854
+ stroke: "#DDD",
9855
+ fill: "#FFF",
9856
+ x: ".25",
9857
+ y: ".25",
9858
+ width: "23",
9859
+ height: "15.5",
9860
+ rx: "2"
9861
+ }
9862
+ ),
9863
+ /* @__PURE__ */ jsx12(
9864
+ "path",
9865
+ {
9866
+ 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",
9867
+ fill: "#1434CB"
9868
+ }
9869
+ )
9870
+ ] })
9871
+ }
9872
+ ) }),
9873
+ /* @__PURE__ */ jsx12(Box, { $whiteSpace: "nowrap", children: "Visa **** 4242" })
9874
+ ]
9875
+ }
9876
+ ),
9877
+ /* @__PURE__ */ jsx12(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx12(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Expires: 3/30" }) })
9878
+ ]
9879
+ }
9880
+ )
9881
+ }
9882
+ ),
9883
+ /* @__PURE__ */ jsx12(Flex, { children: /* @__PURE__ */ jsx12(
9884
+ StyledButton,
9885
+ {
9886
+ $size: "sm",
9887
+ $color: "secondary",
9888
+ $variant: "outline",
9889
+ style: {
9890
+ whiteSpace: "nowrap",
9891
+ paddingLeft: "1rem",
9892
+ paddingRight: "1rem"
9893
+ },
9894
+ children: "Edit"
9895
+ }
9896
+ ) })
9897
+ ] })
9898
+ ] })
9899
+ }
9900
+ ),
9901
+ /* @__PURE__ */ jsx12(
9902
+ Flex,
9903
+ {
9904
+ $flexDirection: "column",
9905
+ $gap: "1rem",
9906
+ $backgroundColor: "#FBFBFB",
9907
+ $borderRadius: "0 0 0.5rem 0.5rem",
9908
+ $flex: "1",
9909
+ $height: "100%",
9910
+ children: /* @__PURE__ */ jsxs7(Flex, { $flexDirection: "column", $height: "100%", children: [
9911
+ /* @__PURE__ */ jsx12(
9912
+ Box,
9913
+ {
9914
+ $fontSize: "18px",
9915
+ $marginBottom: "1.5rem",
9916
+ $display: "inline-block",
9917
+ $width: "100%",
9918
+ children: "Others"
9919
+ }
9920
+ ),
9921
+ /* @__PURE__ */ jsxs7(Flex, { $gap: "1rem", children: [
9922
+ /* @__PURE__ */ jsx12(
9923
+ Flex,
9924
+ {
9925
+ $alignItems: "center",
9926
+ $padding: ".5rem 1rem",
9927
+ $border: "1px solid #E2E5E9",
9928
+ $borderRadius: ".5rem",
9929
+ $backgroundColor: "#ffffff",
9930
+ $flexDirection: "row",
9931
+ $gap: "1rem",
9932
+ $width: "100%",
9933
+ children: /* @__PURE__ */ jsxs7(
9934
+ Flex,
9935
+ {
9936
+ $flexDirection: "row",
9937
+ $justifyContent: "space-between",
9938
+ $flex: "1",
9939
+ children: [
9940
+ /* @__PURE__ */ jsxs7(
9941
+ Flex,
9942
+ {
9943
+ $flexDirection: "row",
9944
+ $alignItems: "center",
9945
+ $gap: "1rem",
9946
+ children: [
9947
+ /* @__PURE__ */ jsx12(Box, { $display: "inline-block", children: /* @__PURE__ */ jsx12(
9948
+ "svg",
9949
+ {
9950
+ viewBox: "0 0 24 16",
9951
+ fill: "none",
9952
+ xmlns: "http://www.w3.org/2000/svg",
9953
+ width: "26px",
9954
+ height: "auto",
9955
+ children: /* @__PURE__ */ jsxs7("g", { children: [
9956
+ /* @__PURE__ */ jsx12(
9957
+ "rect",
9958
+ {
9959
+ stroke: "#DDD",
9960
+ fill: "#FFF",
9961
+ x: ".25",
9962
+ y: ".25",
9963
+ width: "23",
9964
+ height: "15.5",
9965
+ rx: "2"
9966
+ }
9967
+ ),
9968
+ /* @__PURE__ */ jsx12(
9969
+ "path",
9970
+ {
9971
+ 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",
9972
+ fill: "#1434CB"
9973
+ }
9974
+ )
9975
+ ] })
9976
+ }
9977
+ ) }),
9978
+ /* @__PURE__ */ jsx12(Box, { $whiteSpace: "nowrap", children: "Visa **** 2929" })
9979
+ ]
9980
+ }
9981
+ ),
9982
+ /* @__PURE__ */ jsx12(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx12(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Expires: 3/30" }) })
9983
+ ]
9984
+ }
9985
+ )
9986
+ }
9987
+ ),
9988
+ /* @__PURE__ */ jsxs7(Flex, { $gap: "1rem", children: [
9989
+ /* @__PURE__ */ jsx12(
9990
+ StyledButton,
9991
+ {
9992
+ $size: "sm",
9993
+ $color: "secondary",
9994
+ $variant: "outline",
9995
+ style: {
9996
+ whiteSpace: "nowrap",
9997
+ paddingLeft: "1rem",
9998
+ paddingRight: "1rem"
9999
+ },
10000
+ children: "Make Default"
10001
+ }
10002
+ ),
10003
+ /* @__PURE__ */ jsx12(
10004
+ StyledButton,
10005
+ {
10006
+ $size: "sm",
10007
+ $color: "secondary",
10008
+ $variant: "outline",
10009
+ style: {
10010
+ whiteSpace: "nowrap",
10011
+ paddingLeft: "1rem",
10012
+ paddingRight: "1rem"
10013
+ },
10014
+ children: "Edit"
10015
+ }
10016
+ )
10017
+ ] })
10018
+ ] })
10019
+ ] })
10020
+ }
10021
+ )
10022
+ ]
10023
+ }
10024
+ )
10025
+ ] }),
9053
10026
  portal || document.body
9054
10027
  )
9055
10028
  ] });
9056
10029
  });
9057
10030
 
9058
10031
  // src/components/elements/invoices/Invoices.tsx
9059
- import { forwardRef as forwardRef7, useMemo as useMemo7 } from "react";
9060
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
10032
+ import { forwardRef as forwardRef6, useMemo as useMemo7 } from "react";
10033
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
9061
10034
  function resolveDesignProps6(props) {
9062
10035
  return {
9063
10036
  header: {
@@ -9082,7 +10055,7 @@ function resolveDesignProps6(props) {
9082
10055
  }
9083
10056
  };
9084
10057
  }
9085
- var Invoices = forwardRef7(({ className, ...rest }, ref) => {
10058
+ var Invoices = forwardRef6(({ className, ...rest }, ref) => {
9086
10059
  const props = resolveDesignProps6(rest);
9087
10060
  const { settings } = useEmbed();
9088
10061
  const { invoices } = useMemo7(() => {
@@ -9099,7 +10072,7 @@ var Invoices = forwardRef7(({ className, ...rest }, ref) => {
9099
10072
  ]
9100
10073
  };
9101
10074
  }, []);
9102
- return /* @__PURE__ */ jsx13("div", { ref, className, children: /* @__PURE__ */ jsxs7(Flex, { $flexDirection: "column", $gap: "1rem", children: [
10075
+ return /* @__PURE__ */ jsx13("div", { ref, className, children: /* @__PURE__ */ jsxs8(Flex, { $flexDirection: "column", $gap: "1rem", children: [
9103
10076
  props.header.isVisible && /* @__PURE__ */ jsx13(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx13(
9104
10077
  Text,
9105
10078
  {
@@ -9114,7 +10087,7 @@ var Invoices = forwardRef7(({ className, ...rest }, ref) => {
9114
10087
  0,
9115
10088
  props.limit.isVisible && props.limit.number || invoices.length
9116
10089
  ).map(({ date, amount }, index) => {
9117
- return /* @__PURE__ */ jsxs7(Flex, { $justifyContent: "space-between", children: [
10090
+ return /* @__PURE__ */ jsxs8(Flex, { $justifyContent: "space-between", children: [
9118
10091
  props.date.isVisible && /* @__PURE__ */ jsx13(
9119
10092
  Text,
9120
10093
  {
@@ -9125,7 +10098,7 @@ var Invoices = forwardRef7(({ className, ...rest }, ref) => {
9125
10098
  children: toPrettyDate(date)
9126
10099
  }
9127
10100
  ),
9128
- props.amount.isVisible && /* @__PURE__ */ jsxs7(
10101
+ props.amount.isVisible && /* @__PURE__ */ jsxs8(
9129
10102
  Text,
9130
10103
  {
9131
10104
  $font: settings.theme.typography[props.amount.fontStyle].fontFamily,
@@ -9140,7 +10113,7 @@ var Invoices = forwardRef7(({ className, ...rest }, ref) => {
9140
10113
  )
9141
10114
  ] }, index);
9142
10115
  }) }),
9143
- props.collapse.isVisible && /* @__PURE__ */ jsxs7(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
10116
+ props.collapse.isVisible && /* @__PURE__ */ jsxs8(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
9144
10117
  /* @__PURE__ */ jsx13(Icon2, { name: "chevron-down", style: { color: "#D0D0D0" } }),
9145
10118
  /* @__PURE__ */ jsx13(
9146
10119
  Text,
@@ -9157,20 +10130,159 @@ var Invoices = forwardRef7(({ className, ...rest }, ref) => {
9157
10130
  });
9158
10131
 
9159
10132
  // src/components/embed/ComponentTree.tsx
9160
- import { useEffect as useEffect4, useState as useState4 } from "react";
10133
+ import { useEffect as useEffect4, useState as useState6 } from "react";
9161
10134
 
9162
10135
  // src/components/embed/renderer.ts
9163
10136
  import { createElement } from "react";
10137
+
10138
+ // src/components/layout/root/Root.tsx
10139
+ import { forwardRef as forwardRef7 } from "react";
10140
+ import { jsx as jsx14 } from "react/jsx-runtime";
10141
+ var Root = forwardRef7(
10142
+ (props, ref) => {
10143
+ return /* @__PURE__ */ jsx14("div", { ref, ...props });
10144
+ }
10145
+ );
10146
+
10147
+ // src/components/layout/viewport/Viewport.tsx
10148
+ import { forwardRef as forwardRef8 } from "react";
10149
+
10150
+ // src/components/layout/viewport/styles.ts
10151
+ var StyledViewport = dt.div`
10152
+ display: flex;
10153
+ flex-wrap: wrap;
10154
+ margin-left: auto;
10155
+ margin-right: auto;
10156
+ `;
10157
+
10158
+ // src/components/layout/viewport/Viewport.tsx
10159
+ import { jsx as jsx15 } from "react/jsx-runtime";
10160
+ var Viewport = forwardRef8(
10161
+ ({ children, ...props }, ref) => {
10162
+ const { settings, layout } = useEmbed();
10163
+ return /* @__PURE__ */ jsx15(
10164
+ StyledViewport,
10165
+ {
10166
+ ref,
10167
+ $numberOfColumns: settings.theme.numberOfColumns,
10168
+ ...props,
10169
+ children: layout === "disabled" ? /* @__PURE__ */ jsx15("div", { className: "", children: "DISABLED" }) : children
10170
+ }
10171
+ );
10172
+ }
10173
+ );
10174
+
10175
+ // src/components/layout/column/Column.tsx
10176
+ import { forwardRef as forwardRef10 } from "react";
10177
+
10178
+ // src/components/layout/card/Card.tsx
10179
+ import { forwardRef as forwardRef9 } from "react";
10180
+
10181
+ // src/components/layout/card/styles.ts
10182
+ var StyledCard = dt.div(
10183
+ ({
10184
+ theme,
10185
+ $sectionLayout = "merged",
10186
+ $borderRadius = 8,
10187
+ $padding = 48,
10188
+ $shadow = true
10189
+ }) => {
10190
+ return lt`
10191
+ box-sizing: border-box;
10192
+ font-size: ${TEXT_BASE_SIZE}px;
10193
+
10194
+ *,
10195
+ *::before,
10196
+ *::after {
10197
+ box-sizing: inherit;
10198
+ }
10199
+
10200
+ > * {
10201
+ padding: ${$padding * 0.75 / TEXT_BASE_SIZE}rem
10202
+ ${$padding / TEXT_BASE_SIZE}rem;
10203
+ color: ${theme.typography.text.color};
10204
+ }
10205
+
10206
+ ${() => {
10207
+ const { l: l2 } = hexToHSL(theme.card.background);
10208
+ const borderColor = l2 > 50 ? darken(theme.card.background, 10) : lighten(theme.card.background, 30);
10209
+ const borderRadius = `${$borderRadius / TEXT_BASE_SIZE}rem`;
10210
+ const boxShadow = "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A";
10211
+ if ($sectionLayout === "merged") {
10212
+ return lt`
10213
+ background: ${({ theme: theme2 }) => theme2.card.background};
10214
+ border-radius: ${borderRadius};
10215
+
10216
+ ${$shadow && `box-shadow: ${boxShadow};`}
10217
+
10218
+ > :not(:last-child) {
10219
+ border-bottom: 1px solid ${borderColor};
10220
+ }
10221
+ `;
10222
+ }
10223
+ return lt`
10224
+ > :not(:last-child) {
10225
+ margin-bottom: 1rem;
10226
+ }
10227
+
10228
+ > * {
10229
+ background: ${theme.card.background};
10230
+ border-radius: ${borderRadius};
10231
+ ${$shadow && `box-shadow: ${boxShadow};`}
10232
+ }
10233
+ `;
10234
+ }}
10235
+ `;
10236
+ }
10237
+ );
10238
+
10239
+ // src/components/layout/card/Card.tsx
10240
+ import { jsx as jsx16 } from "react/jsx-runtime";
10241
+ var Card = forwardRef9(
10242
+ ({ children, className }, ref) => {
10243
+ const { settings } = useEmbed();
10244
+ return /* @__PURE__ */ jsx16(
10245
+ StyledCard,
10246
+ {
10247
+ ref,
10248
+ className,
10249
+ $sectionLayout: settings.theme?.sectionLayout,
10250
+ $borderRadius: settings.theme?.card?.borderRadius,
10251
+ $padding: settings.theme?.card?.padding,
10252
+ $shadow: settings.theme?.card?.hasShadow,
10253
+ children
10254
+ }
10255
+ );
10256
+ }
10257
+ );
10258
+
10259
+ // src/components/layout/column/styles.ts
10260
+ var StyledColumn = dt.div`
10261
+ flex-grow: 1;
10262
+ padding: 0.75rem;
10263
+ `;
10264
+
10265
+ // src/components/layout/column/Column.tsx
10266
+ import { jsx as jsx17 } from "react/jsx-runtime";
10267
+ var Column = forwardRef10(
10268
+ ({ children, ...props }, ref) => {
10269
+ return /* @__PURE__ */ jsx17(StyledColumn, { ref, ...props, children: /* @__PURE__ */ jsx17(Card, { children }) });
10270
+ }
10271
+ );
10272
+
10273
+ // src/components/embed/renderer.ts
9164
10274
  var components = {
10275
+ Root,
10276
+ Viewport,
10277
+ Column,
9165
10278
  Card,
9166
10279
  PlanManager,
9167
10280
  IncludedFeatures,
9168
10281
  UpcomingBill,
9169
- PaymentMethod,
9170
- MeteredFeatures
10282
+ PaymentMethod
9171
10283
  };
9172
10284
  function createRenderer(options) {
9173
- const { useFallback = true } = options || {};
10285
+ const { useFallback = false } = options || {};
9174
10286
  return function renderNode(node2, index) {
9175
10287
  const { type, props = {}, custom = {}, children } = node2;
9176
10288
  const name = typeof type !== "string" ? type.resolvedName : type;
@@ -9192,7 +10304,7 @@ function createRenderer(options) {
9192
10304
  {
9193
10305
  className,
9194
10306
  ...component !== "div" && { resolvedProps },
9195
- ...Object.keys(custom).length > 0 && { custom },
10307
+ ...component !== "div" && Object.keys(custom).length > 0 && { custom },
9196
10308
  key: index
9197
10309
  },
9198
10310
  resolvedChildren
@@ -9201,35 +10313,36 @@ function createRenderer(options) {
9201
10313
  }
9202
10314
 
9203
10315
  // src/components/embed/ComponentTree.tsx
9204
- import { Fragment as Fragment3, jsx as jsx14 } from "react/jsx-runtime";
10316
+ import { Fragment as Fragment2, jsx as jsx18 } from "react/jsx-runtime";
9205
10317
  var ComponentTree = () => {
9206
- const [children, setChildren] = useState4("Loading");
10318
+ const [children, setChildren] = useState6("Loading");
9207
10319
  const { error, nodes } = useEmbed();
9208
10320
  useEffect4(() => {
9209
10321
  const renderer = createRenderer();
9210
10322
  setChildren(nodes.map(renderer));
9211
10323
  }, [nodes]);
9212
10324
  if (error) {
9213
- return /* @__PURE__ */ jsx14("div", { children: error.message });
10325
+ return /* @__PURE__ */ jsx18("div", { children: error.message });
9214
10326
  }
9215
- return /* @__PURE__ */ jsx14(Fragment3, { children });
10327
+ return /* @__PURE__ */ jsx18(Fragment2, { children });
9216
10328
  };
9217
10329
 
9218
10330
  // src/components/embed/Embed.tsx
9219
- import { jsx as jsx15 } from "react/jsx-runtime";
10331
+ import { jsx as jsx19 } from "react/jsx-runtime";
9220
10332
  var SchematicEmbed = ({ id, accessToken, apiConfig }) => {
9221
10333
  if (accessToken?.length === 0) {
9222
- return /* @__PURE__ */ jsx15("div", { children: "Please provide an access token." });
10334
+ return /* @__PURE__ */ jsx19("div", { children: "Please provide an access token." });
9223
10335
  }
9224
10336
  if (!accessToken?.startsWith("token_")) {
9225
- return /* @__PURE__ */ jsx15("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
10337
+ return /* @__PURE__ */ jsx19("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
9226
10338
  }
9227
- return /* @__PURE__ */ jsx15(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ jsx15(ComponentTree, {}) });
10339
+ return /* @__PURE__ */ jsx19(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ jsx19(ComponentTree, {}) });
9228
10340
  };
9229
10341
  export {
9230
10342
  Box,
9231
10343
  Button2 as Button,
9232
10344
  Card,
10345
+ Column,
9233
10346
  EmbedContext,
9234
10347
  EmbedProvider,
9235
10348
  Flex,
@@ -9238,14 +10351,19 @@ export {
9238
10351
  IncludedFeatures,
9239
10352
  Invoices,
9240
10353
  MeteredFeatures,
10354
+ OverlayHeader,
10355
+ OverlaySideBar,
10356
+ OverlayWrapper,
9241
10357
  PaymentMethod,
9242
10358
  PlanManager,
9243
10359
  ProgressBar,
10360
+ Root,
9244
10361
  Schematic,
9245
10362
  SchematicEmbed,
9246
10363
  SchematicProvider,
9247
10364
  Text,
9248
10365
  UpcomingBill,
10366
+ Viewport,
9249
10367
  defaultSettings,
9250
10368
  defaultTheme,
9251
10369
  useEmbed,