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

Sign up to get free protection for your applications and to get access to all the features.
@@ -133,6 +133,7 @@ __export(src_exports, {
133
133
  Box: () => Box,
134
134
  Button: () => Button2,
135
135
  Card: () => Card,
136
+ Column: () => Column,
136
137
  EmbedContext: () => EmbedContext,
137
138
  EmbedProvider: () => EmbedProvider,
138
139
  Flex: () => Flex,
@@ -140,14 +141,22 @@ __export(src_exports, {
140
141
  IconRound: () => IconRound,
141
142
  IncludedFeatures: () => IncludedFeatures,
142
143
  Invoices: () => Invoices,
143
- NextBillDue: () => NextBillDue,
144
+ MeteredFeatures: () => MeteredFeatures,
145
+ OverlayHeader: () => OverlayHeader,
146
+ OverlaySideBar: () => OverlaySideBar,
147
+ OverlayWrapper: () => OverlayWrapper,
144
148
  PaymentMethod: () => PaymentMethod,
145
149
  PlanManager: () => PlanManager,
146
150
  ProgressBar: () => ProgressBar,
151
+ Root: () => Root,
147
152
  Schematic: () => Schematic,
148
153
  SchematicEmbed: () => SchematicEmbed,
149
154
  SchematicProvider: () => SchematicProvider,
150
155
  Text: () => Text,
156
+ UpcomingBill: () => UpcomingBill,
157
+ Viewport: () => Viewport,
158
+ defaultSettings: () => defaultSettings,
159
+ defaultTheme: () => defaultTheme,
151
160
  useEmbed: () => useEmbed,
152
161
  useSchematic: () => useSchematic,
153
162
  useSchematicContext: () => useSchematicContext,
@@ -4969,7 +4978,7 @@ var unitlessKeys = {
4969
4978
  var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
4970
4979
  var m = "active";
4971
4980
  var y = "data-styled-version";
4972
- var v = "6.1.12";
4981
+ var v = "6.1.13";
4973
4982
  var g = "/*!sc*/\n";
4974
4983
  var S = "undefined" != typeof window && "HTMLElement" in window;
4975
4984
  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);
@@ -5649,6 +5658,143 @@ var vt = function() {
5649
5658
  var St = "__sc-".concat(f, "__");
5650
5659
  "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);
5651
5660
 
5661
+ // node_modules/@stripe/stripe-js/dist/index.mjs
5662
+ var V3_URL = "https://js.stripe.com/v3";
5663
+ var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
5664
+ 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";
5665
+ var findScript = function findScript2() {
5666
+ var scripts = document.querySelectorAll('script[src^="'.concat(V3_URL, '"]'));
5667
+ for (var i2 = 0; i2 < scripts.length; i2++) {
5668
+ var script = scripts[i2];
5669
+ if (!V3_URL_REGEX.test(script.src)) {
5670
+ continue;
5671
+ }
5672
+ return script;
5673
+ }
5674
+ return null;
5675
+ };
5676
+ var injectScript = function injectScript2(params) {
5677
+ var queryString = params && !params.advancedFraudSignals ? "?advancedFraudSignals=false" : "";
5678
+ var script = document.createElement("script");
5679
+ script.src = "".concat(V3_URL).concat(queryString);
5680
+ var headOrBody = document.head || document.body;
5681
+ if (!headOrBody) {
5682
+ throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
5683
+ }
5684
+ headOrBody.appendChild(script);
5685
+ return script;
5686
+ };
5687
+ var registerWrapper = function registerWrapper2(stripe, startTime) {
5688
+ if (!stripe || !stripe._registerWrapper) {
5689
+ return;
5690
+ }
5691
+ stripe._registerWrapper({
5692
+ name: "stripe-js",
5693
+ version: "4.3.0",
5694
+ startTime
5695
+ });
5696
+ };
5697
+ var stripePromise = null;
5698
+ var onErrorListener = null;
5699
+ var onLoadListener = null;
5700
+ var onError = function onError2(reject) {
5701
+ return function() {
5702
+ reject(new Error("Failed to load Stripe.js"));
5703
+ };
5704
+ };
5705
+ var onLoad = function onLoad2(resolve, reject) {
5706
+ return function() {
5707
+ if (window.Stripe) {
5708
+ resolve(window.Stripe);
5709
+ } else {
5710
+ reject(new Error("Stripe.js not available"));
5711
+ }
5712
+ };
5713
+ };
5714
+ var loadScript = function loadScript2(params) {
5715
+ if (stripePromise !== null) {
5716
+ return stripePromise;
5717
+ }
5718
+ stripePromise = new Promise(function(resolve, reject) {
5719
+ if (typeof window === "undefined" || typeof document === "undefined") {
5720
+ resolve(null);
5721
+ return;
5722
+ }
5723
+ if (window.Stripe && params) {
5724
+ console.warn(EXISTING_SCRIPT_MESSAGE);
5725
+ }
5726
+ if (window.Stripe) {
5727
+ resolve(window.Stripe);
5728
+ return;
5729
+ }
5730
+ try {
5731
+ var script = findScript();
5732
+ if (script && params) {
5733
+ console.warn(EXISTING_SCRIPT_MESSAGE);
5734
+ } else if (!script) {
5735
+ script = injectScript(params);
5736
+ } else if (script && onLoadListener !== null && onErrorListener !== null) {
5737
+ var _script$parentNode;
5738
+ script.removeEventListener("load", onLoadListener);
5739
+ script.removeEventListener("error", onErrorListener);
5740
+ (_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);
5741
+ script = injectScript(params);
5742
+ }
5743
+ onLoadListener = onLoad(resolve, reject);
5744
+ onErrorListener = onError(reject);
5745
+ script.addEventListener("load", onLoadListener);
5746
+ script.addEventListener("error", onErrorListener);
5747
+ } catch (error) {
5748
+ reject(error);
5749
+ return;
5750
+ }
5751
+ });
5752
+ return stripePromise["catch"](function(error) {
5753
+ stripePromise = null;
5754
+ return Promise.reject(error);
5755
+ });
5756
+ };
5757
+ var initStripe = function initStripe2(maybeStripe, args, startTime) {
5758
+ if (maybeStripe === null) {
5759
+ return null;
5760
+ }
5761
+ var stripe = maybeStripe.apply(void 0, args);
5762
+ registerWrapper(stripe, startTime);
5763
+ return stripe;
5764
+ };
5765
+ var stripePromise$1;
5766
+ var loadCalled = false;
5767
+ var getStripePromise = function getStripePromise2() {
5768
+ if (stripePromise$1) {
5769
+ return stripePromise$1;
5770
+ }
5771
+ stripePromise$1 = loadScript(null)["catch"](function(error) {
5772
+ stripePromise$1 = null;
5773
+ return Promise.reject(error);
5774
+ });
5775
+ return stripePromise$1;
5776
+ };
5777
+ Promise.resolve().then(function() {
5778
+ return getStripePromise();
5779
+ })["catch"](function(error) {
5780
+ if (!loadCalled) {
5781
+ console.warn(error);
5782
+ }
5783
+ });
5784
+ var loadStripe = function loadStripe2() {
5785
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5786
+ args[_key] = arguments[_key];
5787
+ }
5788
+ loadCalled = true;
5789
+ var startTime = Date.now();
5790
+ return getStripePromise().then(function(maybeStripe) {
5791
+ return initStripe(maybeStripe, args, startTime);
5792
+ });
5793
+ };
5794
+
5795
+ // src/context/embed.tsx
5796
+ var import_react_stripe_js = require("@stripe/react-stripe-js");
5797
+
5652
5798
  // src/api/runtime.ts
5653
5799
  var BASE_PATH = "https://api.schematichq.com".replace(/\/+$/, "");
5654
5800
  var Configuration = class {
@@ -5906,6 +6052,130 @@ var JSONApiResponse = class {
5906
6052
  }
5907
6053
  };
5908
6054
 
6055
+ // src/api/models/BillingPlan.ts
6056
+ function BillingPlanFromJSON(json) {
6057
+ return BillingPlanFromJSONTyped(json, false);
6058
+ }
6059
+ function BillingPlanFromJSONTyped(json, ignoreDiscriminator) {
6060
+ if (json == null) {
6061
+ return json;
6062
+ }
6063
+ return {
6064
+ description: json["description"] == null ? void 0 : json["description"],
6065
+ id: json["id"],
6066
+ imageUrl: json["image_url"] == null ? void 0 : json["image_url"],
6067
+ name: json["name"],
6068
+ planPeriod: json["plan_period"] == null ? void 0 : json["plan_period"],
6069
+ planPrice: json["plan_price"] == null ? void 0 : json["plan_price"]
6070
+ };
6071
+ }
6072
+
6073
+ // src/api/models/BillingPriceResponseData.ts
6074
+ function BillingPriceResponseDataFromJSON(json) {
6075
+ return BillingPriceResponseDataFromJSONTyped(json, false);
6076
+ }
6077
+ function BillingPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6078
+ if (json == null) {
6079
+ return json;
6080
+ }
6081
+ return {
6082
+ externalPriceId: json["external_price_id"],
6083
+ id: json["id"],
6084
+ interval: json["interval"],
6085
+ price: json["price"]
6086
+ };
6087
+ }
6088
+
6089
+ // src/api/models/BillingProductDetailResponseData.ts
6090
+ function BillingProductDetailResponseDataFromJSON(json) {
6091
+ return BillingProductDetailResponseDataFromJSONTyped(json, false);
6092
+ }
6093
+ function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6094
+ if (json == null) {
6095
+ return json;
6096
+ }
6097
+ return {
6098
+ prices: json["Prices"].map(
6099
+ BillingPriceResponseDataFromJSON
6100
+ ),
6101
+ accountId: json["account_id"],
6102
+ createdAt: new Date(json["created_at"]),
6103
+ currency: json["currency"],
6104
+ environmentId: json["environment_id"],
6105
+ externalId: json["external_id"],
6106
+ name: json["name"],
6107
+ price: json["price"],
6108
+ productId: json["product_id"],
6109
+ quantity: json["quantity"],
6110
+ updatedAt: new Date(json["updated_at"])
6111
+ };
6112
+ }
6113
+
6114
+ // src/api/models/BillingProductForSubscriptionResponseData.ts
6115
+ function BillingProductForSubscriptionResponseDataFromJSON(json) {
6116
+ return BillingProductForSubscriptionResponseDataFromJSONTyped(json, false);
6117
+ }
6118
+ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6119
+ if (json == null) {
6120
+ return json;
6121
+ }
6122
+ return {
6123
+ accountId: json["account_id"],
6124
+ createdAt: new Date(json["created_at"]),
6125
+ currency: json["currency"],
6126
+ environmentId: json["environment_id"],
6127
+ externalId: json["external_id"],
6128
+ id: json["id"],
6129
+ interval: json["interval"] == null ? void 0 : json["interval"],
6130
+ name: json["name"],
6131
+ price: json["price"],
6132
+ quantity: json["quantity"],
6133
+ subscriptionId: json["subscription_id"],
6134
+ updatedAt: new Date(json["updated_at"])
6135
+ };
6136
+ }
6137
+
6138
+ // src/api/models/BillingSubscriptionResponseData.ts
6139
+ function BillingSubscriptionResponseDataFromJSON(json) {
6140
+ return BillingSubscriptionResponseDataFromJSONTyped(json, false);
6141
+ }
6142
+ function BillingSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6143
+ if (json == null) {
6144
+ return json;
6145
+ }
6146
+ return {
6147
+ expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
6148
+ externalId: json["external_id"],
6149
+ id: json["id"],
6150
+ updatedAt: new Date(json["updated_at"])
6151
+ };
6152
+ }
6153
+
6154
+ // src/api/models/ChangeSubscriptionRequestBody.ts
6155
+ function ChangeSubscriptionRequestBodyToJSON(value) {
6156
+ if (value == null) {
6157
+ return value;
6158
+ }
6159
+ return {
6160
+ new_plan_id: value["newPlanId"],
6161
+ new_price_id: value["newPriceId"]
6162
+ };
6163
+ }
6164
+
6165
+ // src/api/models/CheckoutResponse.ts
6166
+ function CheckoutResponseFromJSON(json) {
6167
+ return CheckoutResponseFromJSONTyped(json, false);
6168
+ }
6169
+ function CheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
6170
+ if (json == null) {
6171
+ return json;
6172
+ }
6173
+ return {
6174
+ data: BillingSubscriptionResponseDataFromJSON(json["data"]),
6175
+ params: json["params"]
6176
+ };
6177
+ }
6178
+
5909
6179
  // src/api/models/PreviewObject.ts
5910
6180
  function PreviewObjectFromJSON(json) {
5911
6181
  return PreviewObjectFromJSONTyped(json, false);
@@ -6008,7 +6278,7 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6008
6278
  return json;
6009
6279
  }
6010
6280
  return {
6011
- addOns: json["add_ons"].map(PreviewObjectFromJSON),
6281
+ addOns: json["add_ons"].map(BillingPlanFromJSON),
6012
6282
  createdAt: new Date(json["created_at"]),
6013
6283
  entityTraits: json["entity_traits"].map(
6014
6284
  EntityTraitDetailResponseDataFromJSON
@@ -6019,7 +6289,7 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6019
6289
  lastSeenAt: json["last_seen_at"] == null ? void 0 : new Date(json["last_seen_at"]),
6020
6290
  logoUrl: json["logo_url"] == null ? void 0 : json["logo_url"],
6021
6291
  name: json["name"],
6022
- plan: json["plan"] == null ? void 0 : PreviewObjectFromJSON(json["plan"]),
6292
+ plan: json["plan"] == null ? void 0 : BillingPlanFromJSON(json["plan"]),
6023
6293
  plans: json["plans"].map(PreviewObjectFromJSON),
6024
6294
  traits: json["traits"] == null ? void 0 : json["traits"],
6025
6295
  updatedAt: new Date(json["updated_at"]),
@@ -6027,25 +6297,6 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6027
6297
  };
6028
6298
  }
6029
6299
 
6030
- // src/api/models/ComponentResponseData.ts
6031
- function ComponentResponseDataFromJSON(json) {
6032
- return ComponentResponseDataFromJSONTyped(json, false);
6033
- }
6034
- function ComponentResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6035
- if (json == null) {
6036
- return json;
6037
- }
6038
- return {
6039
- ast: json["ast"],
6040
- createdAt: new Date(json["created_at"]),
6041
- id: json["id"],
6042
- name: json["name"],
6043
- state: json["state"],
6044
- type: json["type"],
6045
- updatedAt: new Date(json["updated_at"])
6046
- };
6047
- }
6048
-
6049
6300
  // src/api/models/EventSummaryResponseData.ts
6050
6301
  function EventSummaryResponseDataFromJSON(json) {
6051
6302
  return EventSummaryResponseDataFromJSONTyped(json, false);
@@ -6247,13 +6498,166 @@ function PlanResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6247
6498
  return json;
6248
6499
  }
6249
6500
  return {
6250
- audienceType: json["audience_type"],
6501
+ audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
6502
+ createdAt: new Date(json["created_at"]),
6503
+ description: json["description"],
6504
+ icon: json["icon"],
6505
+ id: json["id"],
6506
+ name: json["name"],
6507
+ planType: json["plan_type"],
6508
+ updatedAt: new Date(json["updated_at"])
6509
+ };
6510
+ }
6511
+
6512
+ // src/api/models/PlanEntitlementResponseData.ts
6513
+ function PlanEntitlementResponseDataFromJSON(json) {
6514
+ return PlanEntitlementResponseDataFromJSONTyped(json, false);
6515
+ }
6516
+ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6517
+ if (json == null) {
6518
+ return json;
6519
+ }
6520
+ return {
6521
+ createdAt: new Date(json["created_at"]),
6522
+ environmentId: json["environment_id"],
6523
+ feature: json["feature"] == null ? void 0 : FeatureResponseDataFromJSON(json["feature"]),
6524
+ featureId: json["feature_id"],
6525
+ id: json["id"],
6526
+ metricPeriod: json["metric_period"] == null ? void 0 : json["metric_period"],
6527
+ plan: json["plan"] == null ? void 0 : PlanResponseDataFromJSON(json["plan"]),
6528
+ planId: json["plan_id"],
6529
+ ruleId: json["rule_id"],
6530
+ updatedAt: new Date(json["updated_at"]),
6531
+ valueBool: json["value_bool"] == null ? void 0 : json["value_bool"],
6532
+ valueNumeric: json["value_numeric"] == null ? void 0 : json["value_numeric"],
6533
+ valueTrait: json["value_trait"] == null ? void 0 : EntityTraitDefinitionResponseDataFromJSON(json["value_trait"]),
6534
+ valueTraitId: json["value_trait_id"] == null ? void 0 : json["value_trait_id"],
6535
+ valueType: json["value_type"]
6536
+ };
6537
+ }
6538
+
6539
+ // src/api/models/CompanyPlanDetailResponseData.ts
6540
+ function CompanyPlanDetailResponseDataFromJSON(json) {
6541
+ return CompanyPlanDetailResponseDataFromJSONTyped(json, false);
6542
+ }
6543
+ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6544
+ if (json == null) {
6545
+ return json;
6546
+ }
6547
+ return {
6548
+ audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
6549
+ billingProduct: json["billing_product"] == null ? void 0 : BillingProductDetailResponseDataFromJSON(json["billing_product"]),
6550
+ companyCount: json["company_count"],
6251
6551
  createdAt: new Date(json["created_at"]),
6552
+ current: json["current"],
6252
6553
  description: json["description"],
6554
+ entitlements: json["entitlements"].map(
6555
+ PlanEntitlementResponseDataFromJSON
6556
+ ),
6557
+ features: json["features"].map(
6558
+ FeatureDetailResponseDataFromJSON
6559
+ ),
6253
6560
  icon: json["icon"],
6254
6561
  id: json["id"],
6562
+ monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["monthly_price"]),
6255
6563
  name: json["name"],
6256
6564
  planType: json["plan_type"],
6565
+ updatedAt: new Date(json["updated_at"]),
6566
+ valid: json["valid"],
6567
+ yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["yearly_price"])
6568
+ };
6569
+ }
6570
+
6571
+ // src/api/models/InvoiceResponseData.ts
6572
+ function InvoiceResponseDataFromJSON(json) {
6573
+ return InvoiceResponseDataFromJSONTyped(json, false);
6574
+ }
6575
+ function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6576
+ if (json == null) {
6577
+ return json;
6578
+ }
6579
+ return {
6580
+ amountDue: json["amount_due"],
6581
+ amountPaid: json["amount_paid"],
6582
+ amountRemaining: json["amount_remaining"],
6583
+ collectionMethod: json["collection_method"],
6584
+ companyId: json["company_id"] == null ? void 0 : json["company_id"],
6585
+ createdAt: new Date(json["created_at"]),
6586
+ currency: json["currency"],
6587
+ customerExternalId: json["customer_external_id"],
6588
+ dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
6589
+ environmentId: json["environment_id"],
6590
+ externalId: json["external_id"],
6591
+ id: json["id"],
6592
+ subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
6593
+ subtotal: json["subtotal"],
6594
+ updatedAt: new Date(json["updated_at"])
6595
+ };
6596
+ }
6597
+
6598
+ // src/api/models/PaymentMethodResponseData.ts
6599
+ function PaymentMethodResponseDataFromJSON(json) {
6600
+ return PaymentMethodResponseDataFromJSONTyped(json, false);
6601
+ }
6602
+ function PaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6603
+ if (json == null) {
6604
+ return json;
6605
+ }
6606
+ return {
6607
+ cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
6608
+ cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
6609
+ cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
6610
+ cardLast4: json["card_last4"] == null ? void 0 : json["card_last4"],
6611
+ companyId: json["company_id"] == null ? void 0 : json["company_id"],
6612
+ createdAt: new Date(json["created_at"]),
6613
+ customerExternalId: json["customer_external_id"],
6614
+ environmentId: json["environment_id"],
6615
+ externalId: json["external_id"],
6616
+ id: json["id"],
6617
+ invoiceExternalId: json["invoice_external_id"] == null ? void 0 : json["invoice_external_id"],
6618
+ paymentMethodType: json["payment_method_type"],
6619
+ subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
6620
+ updatedAt: new Date(json["updated_at"])
6621
+ };
6622
+ }
6623
+
6624
+ // src/api/models/CompanySubscriptionResponseData.ts
6625
+ function CompanySubscriptionResponseDataFromJSON(json) {
6626
+ return CompanySubscriptionResponseDataFromJSONTyped(json, false);
6627
+ }
6628
+ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6629
+ if (json == null) {
6630
+ return json;
6631
+ }
6632
+ return {
6633
+ customerExternalId: json["customer_external_id"],
6634
+ expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
6635
+ interval: json["interval"],
6636
+ latestInvoice: json["latest_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["latest_invoice"]),
6637
+ paymentMethod: json["payment_method"] == null ? void 0 : PaymentMethodResponseDataFromJSON(json["payment_method"]),
6638
+ products: json["products"].map(
6639
+ BillingProductForSubscriptionResponseDataFromJSON
6640
+ ),
6641
+ subscriptionExternalId: json["subscription_external_id"],
6642
+ totalPrice: json["total_price"]
6643
+ };
6644
+ }
6645
+
6646
+ // src/api/models/ComponentResponseData.ts
6647
+ function ComponentResponseDataFromJSON(json) {
6648
+ return ComponentResponseDataFromJSONTyped(json, false);
6649
+ }
6650
+ function ComponentResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6651
+ if (json == null) {
6652
+ return json;
6653
+ }
6654
+ return {
6655
+ ast: json["ast"] == null ? void 0 : json["ast"],
6656
+ createdAt: new Date(json["created_at"]),
6657
+ id: json["id"],
6658
+ name: json["name"],
6659
+ state: json["state"],
6660
+ type: json["type"],
6257
6661
  updatedAt: new Date(json["updated_at"])
6258
6662
  };
6259
6663
  }
@@ -6294,6 +6698,20 @@ function FeatureUsageDetailResponseDataFromJSONTyped(json, ignoreDiscriminator)
6294
6698
  };
6295
6699
  }
6296
6700
 
6701
+ // src/api/models/StripeEmbedInfo.ts
6702
+ function StripeEmbedInfoFromJSON(json) {
6703
+ return StripeEmbedInfoFromJSONTyped(json, false);
6704
+ }
6705
+ function StripeEmbedInfoFromJSONTyped(json, ignoreDiscriminator) {
6706
+ if (json == null) {
6707
+ return json;
6708
+ }
6709
+ return {
6710
+ customerEkey: json["customer_ekey"] == null ? void 0 : json["customer_ekey"],
6711
+ publishableKey: json["publishable_key"]
6712
+ };
6713
+ }
6714
+
6297
6715
  // src/api/models/ComponentHydrateResponseData.ts
6298
6716
  function ComponentHydrateResponseDataFromJSON(json) {
6299
6717
  return ComponentHydrateResponseDataFromJSONTyped(json, false);
@@ -6303,9 +6721,14 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6303
6721
  return json;
6304
6722
  }
6305
6723
  return {
6724
+ activePlans: json["active_plans"].map(
6725
+ CompanyPlanDetailResponseDataFromJSON
6726
+ ),
6306
6727
  company: json["company"] == null ? void 0 : CompanyDetailResponseDataFromJSON(json["company"]),
6307
6728
  component: json["component"] == null ? void 0 : ComponentResponseDataFromJSON(json["component"]),
6308
- featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"])
6729
+ featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"]),
6730
+ stripeEmbed: json["stripe_embed"] == null ? void 0 : StripeEmbedInfoFromJSON(json["stripe_embed"]),
6731
+ subscription: json["subscription"] == null ? void 0 : CompanySubscriptionResponseDataFromJSON(json["subscription"])
6309
6732
  };
6310
6733
  }
6311
6734
 
@@ -6323,8 +6746,50 @@ function HydrateComponentResponseFromJSONTyped(json, ignoreDiscriminator) {
6323
6746
  };
6324
6747
  }
6325
6748
 
6326
- // src/api/apis/ComponentsApi.ts
6327
- var ComponentsApi = class extends BaseAPI {
6749
+ // src/api/apis/CheckoutApi.ts
6750
+ var CheckoutApi = class extends BaseAPI {
6751
+ /**
6752
+ * Checkout
6753
+ */
6754
+ async checkoutRaw(requestParameters, initOverrides) {
6755
+ if (requestParameters["changeSubscriptionRequestBody"] == null) {
6756
+ throw new RequiredError(
6757
+ "changeSubscriptionRequestBody",
6758
+ 'Required parameter "changeSubscriptionRequestBody" was null or undefined when calling checkout().'
6759
+ );
6760
+ }
6761
+ const queryParameters = {};
6762
+ const headerParameters = {};
6763
+ headerParameters["Content-Type"] = "application/json";
6764
+ if (this.configuration && this.configuration.apiKey) {
6765
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
6766
+ "X-Schematic-Api-Key"
6767
+ );
6768
+ }
6769
+ const response = await this.request(
6770
+ {
6771
+ path: `/checkout`,
6772
+ method: "POST",
6773
+ headers: headerParameters,
6774
+ query: queryParameters,
6775
+ body: ChangeSubscriptionRequestBodyToJSON(
6776
+ requestParameters["changeSubscriptionRequestBody"]
6777
+ )
6778
+ },
6779
+ initOverrides
6780
+ );
6781
+ return new JSONApiResponse(
6782
+ response,
6783
+ (jsonValue) => CheckoutResponseFromJSON(jsonValue)
6784
+ );
6785
+ }
6786
+ /**
6787
+ * Checkout
6788
+ */
6789
+ async checkout(requestParameters, initOverrides) {
6790
+ const response = await this.checkoutRaw(requestParameters, initOverrides);
6791
+ return await response.value();
6792
+ }
6328
6793
  /**
6329
6794
  * Hydrate component
6330
6795
  */
@@ -6371,30 +6836,73 @@ var ComponentsApi = class extends BaseAPI {
6371
6836
  }
6372
6837
  };
6373
6838
 
6374
- // src/components/theme.ts
6375
- var light = {
6376
- text: "#000000",
6377
- textDetail: "#767676",
6378
- background: "#FFFFFF",
6379
- button: "#000000"
6380
- };
6381
- var dark = {
6382
- text: "#FFFFFF",
6383
- textDetail: "#A5A5A5",
6384
- background: "#000000",
6385
- button: "#194BFB"
6386
- };
6387
-
6388
6839
  // src/context/embed.tsx
6389
6840
  var import_jsx_runtime = require("react/jsx-runtime");
6390
- var defaultSettings = {
6391
- theme: "light",
6841
+ var defaultTheme = {
6842
+ numberOfColumns: 2,
6392
6843
  sectionLayout: "merged",
6393
- borderWidth: 0,
6394
- borderColor: "#E9E9E9",
6395
- borderRadius: 10,
6396
- boxShadow: "none",
6397
- boxPadding: 50
6844
+ colorMode: "light",
6845
+ primary: "#000000",
6846
+ secondary: "#000000",
6847
+ card: {
6848
+ background: "#FFFFFF",
6849
+ borderRadius: 10,
6850
+ hasShadow: true,
6851
+ padding: 45
6852
+ },
6853
+ typography: {
6854
+ heading1: {
6855
+ fontFamily: "Manrope",
6856
+ fontSize: 37,
6857
+ fontWeight: 800,
6858
+ color: "#000000"
6859
+ },
6860
+ heading2: {
6861
+ fontFamily: "Manrope",
6862
+ fontSize: 29,
6863
+ fontWeight: 800,
6864
+ color: "#000000"
6865
+ },
6866
+ heading3: {
6867
+ fontFamily: "Manrope",
6868
+ fontSize: 20,
6869
+ fontWeight: 600,
6870
+ color: "#000000"
6871
+ },
6872
+ heading4: {
6873
+ fontFamily: "Manrope",
6874
+ fontSize: 18,
6875
+ fontWeight: 800,
6876
+ color: "#000000"
6877
+ },
6878
+ heading5: {
6879
+ fontFamily: "Public Sans",
6880
+ fontSize: 17,
6881
+ fontWeight: 500,
6882
+ color: "#000000"
6883
+ },
6884
+ heading6: {
6885
+ fontFamily: "Public Sans",
6886
+ fontSize: 14,
6887
+ fontWeight: 400,
6888
+ color: "#8A8A8A"
6889
+ },
6890
+ text: {
6891
+ fontFamily: "Public Sans",
6892
+ fontSize: 16,
6893
+ fontWeight: 400,
6894
+ color: "#000000"
6895
+ },
6896
+ link: {
6897
+ fontFamily: "Inter",
6898
+ fontSize: 16,
6899
+ fontWeight: 400,
6900
+ color: "#194BFB"
6901
+ }
6902
+ }
6903
+ };
6904
+ var defaultSettings = {
6905
+ theme: defaultTheme
6398
6906
  };
6399
6907
  function isEditorState(obj) {
6400
6908
  return Object.entries(obj).every(([key, value]) => {
@@ -6421,11 +6929,11 @@ function parseEditorState(data) {
6421
6929
  });
6422
6930
  return arr;
6423
6931
  }
6424
- async function fetchComponent(id, accessToken) {
6932
+ async function fetchComponent(id, accessToken, options) {
6425
6933
  const settings = { ...defaultSettings };
6426
6934
  const nodes = [];
6427
- const config = new Configuration({ apiKey: accessToken });
6428
- const api = new ComponentsApi(config);
6935
+ const config = new Configuration({ ...options, apiKey: accessToken });
6936
+ const api = new CheckoutApi(config);
6429
6937
  const response = await api.hydrateComponent({ componentId: id });
6430
6938
  const { data } = response;
6431
6939
  if (data.component?.ast) {
@@ -6439,74 +6947,166 @@ async function fetchComponent(id, accessToken) {
6439
6947
  nodes.push(...parseEditorState(ast));
6440
6948
  }
6441
6949
  }
6950
+ let stripe = null;
6951
+ if (data.stripeEmbed?.publishableKey) {
6952
+ stripe = loadStripe(data.stripeEmbed.publishableKey);
6953
+ }
6442
6954
  return {
6443
6955
  data,
6444
6956
  nodes,
6445
- settings
6957
+ settings,
6958
+ stripe
6446
6959
  };
6447
6960
  }
6448
6961
  var EmbedContext = (0, import_react2.createContext)({
6449
6962
  data: {},
6450
6963
  nodes: [],
6451
- settings: {},
6964
+ settings: { ...defaultSettings },
6965
+ stripe: null,
6966
+ layout: "portal",
6967
+ error: void 0,
6452
6968
  setData: () => {
6453
6969
  },
6454
- setSettings: () => {
6455
- },
6456
6970
  updateSettings: () => {
6971
+ },
6972
+ setStripe: () => {
6973
+ },
6974
+ setLayout: () => {
6457
6975
  }
6458
6976
  });
6459
6977
  var EmbedProvider = ({
6460
6978
  id,
6461
6979
  accessToken,
6980
+ apiConfig,
6462
6981
  children
6463
6982
  }) => {
6464
- const [state, setState] = (0, import_react2.useState)({
6465
- data: {},
6466
- nodes: [],
6467
- settings: { ...defaultSettings },
6468
- setData: () => {
6469
- },
6470
- setSettings: () => {
6471
- },
6472
- updateSettings: () => {
6473
- }
6983
+ const styleRef = (0, import_react2.useRef)(null);
6984
+ const [state, setState] = (0, import_react2.useState)(() => {
6985
+ return {
6986
+ data: {},
6987
+ nodes: [],
6988
+ settings: { ...defaultSettings },
6989
+ stripe: null,
6990
+ layout: "portal",
6991
+ error: void 0,
6992
+ setData: () => {
6993
+ },
6994
+ updateSettings: () => {
6995
+ },
6996
+ setStripe: () => {
6997
+ },
6998
+ setLayout: () => {
6999
+ }
7000
+ };
6474
7001
  });
7002
+ (0, import_react2.useEffect)(() => {
7003
+ const element = document.getElementById("schematic-fonts");
7004
+ if (element) {
7005
+ return void (styleRef.current = element);
7006
+ }
7007
+ const style = document.createElement("link");
7008
+ style.id = "schematic-fonts";
7009
+ style.rel = "stylesheet";
7010
+ document.head.appendChild(style);
7011
+ styleRef.current = style;
7012
+ }, []);
6475
7013
  (0, import_react2.useEffect)(() => {
6476
7014
  if (!id || !accessToken) {
6477
7015
  return;
6478
7016
  }
6479
- fetchComponent(id, accessToken).then((resolvedData) => {
7017
+ fetchComponent(id, accessToken, apiConfig).then(async (resolvedData) => {
6480
7018
  setState((prev2) => ({ ...prev2, ...resolvedData }));
6481
7019
  }).catch((error) => setState((prev2) => ({ ...prev2, error })));
6482
- }, [id, accessToken]);
7020
+ }, [id, accessToken, apiConfig]);
7021
+ (0, import_react2.useEffect)(() => {
7022
+ const fontSet = /* @__PURE__ */ new Set([]);
7023
+ Object.values(state.settings.theme.typography).forEach(({ fontFamily }) => {
7024
+ fontSet.add(fontFamily);
7025
+ });
7026
+ if (fontSet.size > 0) {
7027
+ const src = `https://fonts.googleapis.com/css2?${[...fontSet].map((fontFamily) => `family=${fontFamily}&display=swap`).join("&")}`;
7028
+ if (styleRef.current) {
7029
+ styleRef.current.href = src;
7030
+ }
7031
+ }
7032
+ }, [state.settings.theme.typography]);
6483
7033
  const setData = (0, import_react2.useCallback)(
6484
7034
  (data) => {
6485
7035
  setState((prev2) => ({
6486
7036
  ...prev2,
6487
- data
7037
+ data: Object.assign({}, data)
6488
7038
  }));
6489
7039
  },
6490
7040
  [setState]
6491
7041
  );
6492
- const setSettings = (0, import_react2.useCallback)(
7042
+ const updateSettings = (0, import_react2.useCallback)(
6493
7043
  (settings) => {
6494
7044
  setState((prev2) => ({
6495
7045
  ...prev2,
6496
- settings
7046
+ settings: Object.assign({}, prev2.settings, settings)
6497
7047
  }));
6498
7048
  },
6499
7049
  [setState]
6500
7050
  );
6501
- const updateSettings = (0, import_react2.useCallback)(
6502
- (settings) => {
7051
+ const setStripe = (0, import_react2.useCallback)(
7052
+ (stripe) => {
7053
+ setState((prev2) => ({
7054
+ ...prev2,
7055
+ stripe
7056
+ }));
7057
+ },
7058
+ [setState]
7059
+ );
7060
+ const setLayout = (0, import_react2.useCallback)(
7061
+ (layout) => {
6503
7062
  setState((prev2) => ({
6504
7063
  ...prev2,
6505
- settings: { ...prev2.settings, ...settings }
7064
+ layout
6506
7065
  }));
6507
7066
  },
6508
7067
  [setState]
6509
7068
  );
7069
+ const renderChildren = () => {
7070
+ if (state.stripe) {
7071
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
7072
+ import_react_stripe_js.Elements,
7073
+ {
7074
+ stripe: state.stripe,
7075
+ options: {
7076
+ appearance: {
7077
+ theme: "stripe",
7078
+ variables: {
7079
+ // Base
7080
+ spacingUnit: ".25rem",
7081
+ colorPrimary: "#0570de",
7082
+ colorBackground: "#FFFFFF",
7083
+ colorText: "#30313d",
7084
+ colorDanger: "#df1b41",
7085
+ fontFamily: "Public Sans, system-ui, sans-serif",
7086
+ borderRadius: ".5rem",
7087
+ // Layout
7088
+ gridRowSpacing: "1.5rem",
7089
+ gridColumnSpacing: "1.5rem"
7090
+ },
7091
+ rules: {
7092
+ ".Label": {
7093
+ color: "#020202",
7094
+ fontWeight: "400",
7095
+ fontSize: "16px",
7096
+ marginBottom: "12px"
7097
+ }
7098
+ }
7099
+ },
7100
+ ...state.data.stripeEmbed?.customerEkey && {
7101
+ clientSecret: state.data.stripeEmbed.customerEkey
7102
+ }
7103
+ },
7104
+ children
7105
+ }
7106
+ );
7107
+ }
7108
+ return children;
7109
+ };
6510
7110
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
6511
7111
  EmbedContext.Provider,
6512
7112
  {
@@ -6514,17 +7114,545 @@ var EmbedProvider = ({
6514
7114
  data: state.data,
6515
7115
  nodes: state.nodes,
6516
7116
  settings: state.settings,
7117
+ stripe: state.stripe,
7118
+ layout: state.layout,
6517
7119
  error: state.error,
6518
7120
  setData,
6519
- setSettings,
6520
- updateSettings
7121
+ updateSettings,
7122
+ setStripe,
7123
+ setLayout
6521
7124
  },
6522
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ot, { theme: state.settings.theme === "dark" ? dark : light, children })
7125
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ot, { theme: state.settings.theme, children: renderChildren() })
6523
7126
  }
6524
7127
  );
6525
7128
  };
6526
7129
 
6527
7130
  // node_modules/@schematichq/schematic-js/dist/schematic.esm.js
7131
+ var __create2 = Object.create;
7132
+ var __defProp2 = Object.defineProperty;
7133
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
7134
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
7135
+ var __getProtoOf2 = Object.getPrototypeOf;
7136
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
7137
+ var __commonJS2 = (cb, mod) => function __require() {
7138
+ return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7139
+ };
7140
+ var __copyProps2 = (to, from2, except, desc) => {
7141
+ if (from2 && typeof from2 === "object" || typeof from2 === "function") {
7142
+ for (let key of __getOwnPropNames2(from2))
7143
+ if (!__hasOwnProp2.call(to, key) && key !== except)
7144
+ __defProp2(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc2(from2, key)) || desc.enumerable });
7145
+ }
7146
+ return to;
7147
+ };
7148
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
7149
+ // If the importer is in node compatibility mode or this is not an ESM
7150
+ // file that has been converted to a CommonJS file using a Babel-
7151
+ // compatible transform (i.e. "__esModule" has not been set), then set
7152
+ // "default" to the CommonJS "module.exports" for node compatibility.
7153
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
7154
+ mod
7155
+ ));
7156
+ var require_browser_polyfill = __commonJS2({
7157
+ "node_modules/cross-fetch/dist/browser-polyfill.js"(exports) {
7158
+ (function(self2) {
7159
+ var irrelevant = function(exports2) {
7160
+ var global = typeof globalThis !== "undefined" && globalThis || typeof self2 !== "undefined" && self2 || typeof global !== "undefined" && global;
7161
+ var support = {
7162
+ searchParams: "URLSearchParams" in global,
7163
+ iterable: "Symbol" in global && "iterator" in Symbol,
7164
+ blob: "FileReader" in global && "Blob" in global && function() {
7165
+ try {
7166
+ new Blob();
7167
+ return true;
7168
+ } catch (e) {
7169
+ return false;
7170
+ }
7171
+ }(),
7172
+ formData: "FormData" in global,
7173
+ arrayBuffer: "ArrayBuffer" in global
7174
+ };
7175
+ function isDataView(obj) {
7176
+ return obj && DataView.prototype.isPrototypeOf(obj);
7177
+ }
7178
+ if (support.arrayBuffer) {
7179
+ var viewClasses = [
7180
+ "[object Int8Array]",
7181
+ "[object Uint8Array]",
7182
+ "[object Uint8ClampedArray]",
7183
+ "[object Int16Array]",
7184
+ "[object Uint16Array]",
7185
+ "[object Int32Array]",
7186
+ "[object Uint32Array]",
7187
+ "[object Float32Array]",
7188
+ "[object Float64Array]"
7189
+ ];
7190
+ var isArrayBufferView = ArrayBuffer.isView || function(obj) {
7191
+ return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
7192
+ };
7193
+ }
7194
+ function normalizeName(name) {
7195
+ if (typeof name !== "string") {
7196
+ name = String(name);
7197
+ }
7198
+ if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
7199
+ throw new TypeError('Invalid character in header field name: "' + name + '"');
7200
+ }
7201
+ return name.toLowerCase();
7202
+ }
7203
+ function normalizeValue(value) {
7204
+ if (typeof value !== "string") {
7205
+ value = String(value);
7206
+ }
7207
+ return value;
7208
+ }
7209
+ function iteratorFor(items) {
7210
+ var iterator = {
7211
+ next: function() {
7212
+ var value = items.shift();
7213
+ return { done: value === void 0, value };
7214
+ }
7215
+ };
7216
+ if (support.iterable) {
7217
+ iterator[Symbol.iterator] = function() {
7218
+ return iterator;
7219
+ };
7220
+ }
7221
+ return iterator;
7222
+ }
7223
+ function Headers(headers) {
7224
+ this.map = {};
7225
+ if (headers instanceof Headers) {
7226
+ headers.forEach(function(value, name) {
7227
+ this.append(name, value);
7228
+ }, this);
7229
+ } else if (Array.isArray(headers)) {
7230
+ headers.forEach(function(header) {
7231
+ this.append(header[0], header[1]);
7232
+ }, this);
7233
+ } else if (headers) {
7234
+ Object.getOwnPropertyNames(headers).forEach(function(name) {
7235
+ this.append(name, headers[name]);
7236
+ }, this);
7237
+ }
7238
+ }
7239
+ Headers.prototype.append = function(name, value) {
7240
+ name = normalizeName(name);
7241
+ value = normalizeValue(value);
7242
+ var oldValue = this.map[name];
7243
+ this.map[name] = oldValue ? oldValue + ", " + value : value;
7244
+ };
7245
+ Headers.prototype["delete"] = function(name) {
7246
+ delete this.map[normalizeName(name)];
7247
+ };
7248
+ Headers.prototype.get = function(name) {
7249
+ name = normalizeName(name);
7250
+ return this.has(name) ? this.map[name] : null;
7251
+ };
7252
+ Headers.prototype.has = function(name) {
7253
+ return this.map.hasOwnProperty(normalizeName(name));
7254
+ };
7255
+ Headers.prototype.set = function(name, value) {
7256
+ this.map[normalizeName(name)] = normalizeValue(value);
7257
+ };
7258
+ Headers.prototype.forEach = function(callback, thisArg) {
7259
+ for (var name in this.map) {
7260
+ if (this.map.hasOwnProperty(name)) {
7261
+ callback.call(thisArg, this.map[name], name, this);
7262
+ }
7263
+ }
7264
+ };
7265
+ Headers.prototype.keys = function() {
7266
+ var items = [];
7267
+ this.forEach(function(value, name) {
7268
+ items.push(name);
7269
+ });
7270
+ return iteratorFor(items);
7271
+ };
7272
+ Headers.prototype.values = function() {
7273
+ var items = [];
7274
+ this.forEach(function(value) {
7275
+ items.push(value);
7276
+ });
7277
+ return iteratorFor(items);
7278
+ };
7279
+ Headers.prototype.entries = function() {
7280
+ var items = [];
7281
+ this.forEach(function(value, name) {
7282
+ items.push([name, value]);
7283
+ });
7284
+ return iteratorFor(items);
7285
+ };
7286
+ if (support.iterable) {
7287
+ Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
7288
+ }
7289
+ function consumed(body) {
7290
+ if (body.bodyUsed) {
7291
+ return Promise.reject(new TypeError("Already read"));
7292
+ }
7293
+ body.bodyUsed = true;
7294
+ }
7295
+ function fileReaderReady(reader) {
7296
+ return new Promise(function(resolve, reject) {
7297
+ reader.onload = function() {
7298
+ resolve(reader.result);
7299
+ };
7300
+ reader.onerror = function() {
7301
+ reject(reader.error);
7302
+ };
7303
+ });
7304
+ }
7305
+ function readBlobAsArrayBuffer(blob) {
7306
+ var reader = new FileReader();
7307
+ var promise = fileReaderReady(reader);
7308
+ reader.readAsArrayBuffer(blob);
7309
+ return promise;
7310
+ }
7311
+ function readBlobAsText(blob) {
7312
+ var reader = new FileReader();
7313
+ var promise = fileReaderReady(reader);
7314
+ reader.readAsText(blob);
7315
+ return promise;
7316
+ }
7317
+ function readArrayBufferAsText(buf) {
7318
+ var view = new Uint8Array(buf);
7319
+ var chars = new Array(view.length);
7320
+ for (var i2 = 0; i2 < view.length; i2++) {
7321
+ chars[i2] = String.fromCharCode(view[i2]);
7322
+ }
7323
+ return chars.join("");
7324
+ }
7325
+ function bufferClone(buf) {
7326
+ if (buf.slice) {
7327
+ return buf.slice(0);
7328
+ } else {
7329
+ var view = new Uint8Array(buf.byteLength);
7330
+ view.set(new Uint8Array(buf));
7331
+ return view.buffer;
7332
+ }
7333
+ }
7334
+ function Body() {
7335
+ this.bodyUsed = false;
7336
+ this._initBody = function(body) {
7337
+ this.bodyUsed = this.bodyUsed;
7338
+ this._bodyInit = body;
7339
+ if (!body) {
7340
+ this._bodyText = "";
7341
+ } else if (typeof body === "string") {
7342
+ this._bodyText = body;
7343
+ } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
7344
+ this._bodyBlob = body;
7345
+ } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
7346
+ this._bodyFormData = body;
7347
+ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
7348
+ this._bodyText = body.toString();
7349
+ } else if (support.arrayBuffer && support.blob && isDataView(body)) {
7350
+ this._bodyArrayBuffer = bufferClone(body.buffer);
7351
+ this._bodyInit = new Blob([this._bodyArrayBuffer]);
7352
+ } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
7353
+ this._bodyArrayBuffer = bufferClone(body);
7354
+ } else {
7355
+ this._bodyText = body = Object.prototype.toString.call(body);
7356
+ }
7357
+ if (!this.headers.get("content-type")) {
7358
+ if (typeof body === "string") {
7359
+ this.headers.set("content-type", "text/plain;charset=UTF-8");
7360
+ } else if (this._bodyBlob && this._bodyBlob.type) {
7361
+ this.headers.set("content-type", this._bodyBlob.type);
7362
+ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
7363
+ this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
7364
+ }
7365
+ }
7366
+ };
7367
+ if (support.blob) {
7368
+ this.blob = function() {
7369
+ var rejected = consumed(this);
7370
+ if (rejected) {
7371
+ return rejected;
7372
+ }
7373
+ if (this._bodyBlob) {
7374
+ return Promise.resolve(this._bodyBlob);
7375
+ } else if (this._bodyArrayBuffer) {
7376
+ return Promise.resolve(new Blob([this._bodyArrayBuffer]));
7377
+ } else if (this._bodyFormData) {
7378
+ throw new Error("could not read FormData body as blob");
7379
+ } else {
7380
+ return Promise.resolve(new Blob([this._bodyText]));
7381
+ }
7382
+ };
7383
+ this.arrayBuffer = function() {
7384
+ if (this._bodyArrayBuffer) {
7385
+ var isConsumed = consumed(this);
7386
+ if (isConsumed) {
7387
+ return isConsumed;
7388
+ }
7389
+ if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
7390
+ return Promise.resolve(
7391
+ this._bodyArrayBuffer.buffer.slice(
7392
+ this._bodyArrayBuffer.byteOffset,
7393
+ this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
7394
+ )
7395
+ );
7396
+ } else {
7397
+ return Promise.resolve(this._bodyArrayBuffer);
7398
+ }
7399
+ } else {
7400
+ return this.blob().then(readBlobAsArrayBuffer);
7401
+ }
7402
+ };
7403
+ }
7404
+ this.text = function() {
7405
+ var rejected = consumed(this);
7406
+ if (rejected) {
7407
+ return rejected;
7408
+ }
7409
+ if (this._bodyBlob) {
7410
+ return readBlobAsText(this._bodyBlob);
7411
+ } else if (this._bodyArrayBuffer) {
7412
+ return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
7413
+ } else if (this._bodyFormData) {
7414
+ throw new Error("could not read FormData body as text");
7415
+ } else {
7416
+ return Promise.resolve(this._bodyText);
7417
+ }
7418
+ };
7419
+ if (support.formData) {
7420
+ this.formData = function() {
7421
+ return this.text().then(decode);
7422
+ };
7423
+ }
7424
+ this.json = function() {
7425
+ return this.text().then(JSON.parse);
7426
+ };
7427
+ return this;
7428
+ }
7429
+ var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
7430
+ function normalizeMethod(method) {
7431
+ var upcased = method.toUpperCase();
7432
+ return methods.indexOf(upcased) > -1 ? upcased : method;
7433
+ }
7434
+ function Request(input, options) {
7435
+ if (!(this instanceof Request)) {
7436
+ throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
7437
+ }
7438
+ options = options || {};
7439
+ var body = options.body;
7440
+ if (input instanceof Request) {
7441
+ if (input.bodyUsed) {
7442
+ throw new TypeError("Already read");
7443
+ }
7444
+ this.url = input.url;
7445
+ this.credentials = input.credentials;
7446
+ if (!options.headers) {
7447
+ this.headers = new Headers(input.headers);
7448
+ }
7449
+ this.method = input.method;
7450
+ this.mode = input.mode;
7451
+ this.signal = input.signal;
7452
+ if (!body && input._bodyInit != null) {
7453
+ body = input._bodyInit;
7454
+ input.bodyUsed = true;
7455
+ }
7456
+ } else {
7457
+ this.url = String(input);
7458
+ }
7459
+ this.credentials = options.credentials || this.credentials || "same-origin";
7460
+ if (options.headers || !this.headers) {
7461
+ this.headers = new Headers(options.headers);
7462
+ }
7463
+ this.method = normalizeMethod(options.method || this.method || "GET");
7464
+ this.mode = options.mode || this.mode || null;
7465
+ this.signal = options.signal || this.signal;
7466
+ this.referrer = null;
7467
+ if ((this.method === "GET" || this.method === "HEAD") && body) {
7468
+ throw new TypeError("Body not allowed for GET or HEAD requests");
7469
+ }
7470
+ this._initBody(body);
7471
+ if (this.method === "GET" || this.method === "HEAD") {
7472
+ if (options.cache === "no-store" || options.cache === "no-cache") {
7473
+ var reParamSearch = /([?&])_=[^&]*/;
7474
+ if (reParamSearch.test(this.url)) {
7475
+ this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
7476
+ } else {
7477
+ var reQueryString = /\?/;
7478
+ this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
7479
+ }
7480
+ }
7481
+ }
7482
+ }
7483
+ Request.prototype.clone = function() {
7484
+ return new Request(this, { body: this._bodyInit });
7485
+ };
7486
+ function decode(body) {
7487
+ var form = new FormData();
7488
+ body.trim().split("&").forEach(function(bytes) {
7489
+ if (bytes) {
7490
+ var split = bytes.split("=");
7491
+ var name = split.shift().replace(/\+/g, " ");
7492
+ var value = split.join("=").replace(/\+/g, " ");
7493
+ form.append(decodeURIComponent(name), decodeURIComponent(value));
7494
+ }
7495
+ });
7496
+ return form;
7497
+ }
7498
+ function parseHeaders(rawHeaders) {
7499
+ var headers = new Headers();
7500
+ var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
7501
+ preProcessedHeaders.split("\r").map(function(header) {
7502
+ return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
7503
+ }).forEach(function(line2) {
7504
+ var parts = line2.split(":");
7505
+ var key = parts.shift().trim();
7506
+ if (key) {
7507
+ var value = parts.join(":").trim();
7508
+ headers.append(key, value);
7509
+ }
7510
+ });
7511
+ return headers;
7512
+ }
7513
+ Body.call(Request.prototype);
7514
+ function Response(bodyInit, options) {
7515
+ if (!(this instanceof Response)) {
7516
+ throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
7517
+ }
7518
+ if (!options) {
7519
+ options = {};
7520
+ }
7521
+ this.type = "default";
7522
+ this.status = options.status === void 0 ? 200 : options.status;
7523
+ this.ok = this.status >= 200 && this.status < 300;
7524
+ this.statusText = options.statusText === void 0 ? "" : "" + options.statusText;
7525
+ this.headers = new Headers(options.headers);
7526
+ this.url = options.url || "";
7527
+ this._initBody(bodyInit);
7528
+ }
7529
+ Body.call(Response.prototype);
7530
+ Response.prototype.clone = function() {
7531
+ return new Response(this._bodyInit, {
7532
+ status: this.status,
7533
+ statusText: this.statusText,
7534
+ headers: new Headers(this.headers),
7535
+ url: this.url
7536
+ });
7537
+ };
7538
+ Response.error = function() {
7539
+ var response = new Response(null, { status: 0, statusText: "" });
7540
+ response.type = "error";
7541
+ return response;
7542
+ };
7543
+ var redirectStatuses = [301, 302, 303, 307, 308];
7544
+ Response.redirect = function(url, status) {
7545
+ if (redirectStatuses.indexOf(status) === -1) {
7546
+ throw new RangeError("Invalid status code");
7547
+ }
7548
+ return new Response(null, { status, headers: { location: url } });
7549
+ };
7550
+ exports2.DOMException = global.DOMException;
7551
+ try {
7552
+ new exports2.DOMException();
7553
+ } catch (err2) {
7554
+ exports2.DOMException = function(message, name) {
7555
+ this.message = message;
7556
+ this.name = name;
7557
+ var error = Error(message);
7558
+ this.stack = error.stack;
7559
+ };
7560
+ exports2.DOMException.prototype = Object.create(Error.prototype);
7561
+ exports2.DOMException.prototype.constructor = exports2.DOMException;
7562
+ }
7563
+ function fetch2(input, init) {
7564
+ return new Promise(function(resolve, reject) {
7565
+ var request = new Request(input, init);
7566
+ if (request.signal && request.signal.aborted) {
7567
+ return reject(new exports2.DOMException("Aborted", "AbortError"));
7568
+ }
7569
+ var xhr = new XMLHttpRequest();
7570
+ function abortXhr() {
7571
+ xhr.abort();
7572
+ }
7573
+ xhr.onload = function() {
7574
+ var options = {
7575
+ status: xhr.status,
7576
+ statusText: xhr.statusText,
7577
+ headers: parseHeaders(xhr.getAllResponseHeaders() || "")
7578
+ };
7579
+ options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL");
7580
+ var body = "response" in xhr ? xhr.response : xhr.responseText;
7581
+ setTimeout(function() {
7582
+ resolve(new Response(body, options));
7583
+ }, 0);
7584
+ };
7585
+ xhr.onerror = function() {
7586
+ setTimeout(function() {
7587
+ reject(new TypeError("Network request failed"));
7588
+ }, 0);
7589
+ };
7590
+ xhr.ontimeout = function() {
7591
+ setTimeout(function() {
7592
+ reject(new TypeError("Network request failed"));
7593
+ }, 0);
7594
+ };
7595
+ xhr.onabort = function() {
7596
+ setTimeout(function() {
7597
+ reject(new exports2.DOMException("Aborted", "AbortError"));
7598
+ }, 0);
7599
+ };
7600
+ function fixUrl(url) {
7601
+ try {
7602
+ return url === "" && global.location.href ? global.location.href : url;
7603
+ } catch (e) {
7604
+ return url;
7605
+ }
7606
+ }
7607
+ xhr.open(request.method, fixUrl(request.url), true);
7608
+ if (request.credentials === "include") {
7609
+ xhr.withCredentials = true;
7610
+ } else if (request.credentials === "omit") {
7611
+ xhr.withCredentials = false;
7612
+ }
7613
+ if ("responseType" in xhr) {
7614
+ if (support.blob) {
7615
+ xhr.responseType = "blob";
7616
+ } else if (support.arrayBuffer && request.headers.get("Content-Type") && request.headers.get("Content-Type").indexOf("application/octet-stream") !== -1) {
7617
+ xhr.responseType = "arraybuffer";
7618
+ }
7619
+ }
7620
+ if (init && typeof init.headers === "object" && !(init.headers instanceof Headers)) {
7621
+ Object.getOwnPropertyNames(init.headers).forEach(function(name) {
7622
+ xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
7623
+ });
7624
+ } else {
7625
+ request.headers.forEach(function(value, name) {
7626
+ xhr.setRequestHeader(name, value);
7627
+ });
7628
+ }
7629
+ if (request.signal) {
7630
+ request.signal.addEventListener("abort", abortXhr);
7631
+ xhr.onreadystatechange = function() {
7632
+ if (xhr.readyState === 4) {
7633
+ request.signal.removeEventListener("abort", abortXhr);
7634
+ }
7635
+ };
7636
+ }
7637
+ xhr.send(typeof request._bodyInit === "undefined" ? null : request._bodyInit);
7638
+ });
7639
+ }
7640
+ fetch2.polyfill = true;
7641
+ if (!global.fetch) {
7642
+ global.fetch = fetch2;
7643
+ global.Headers = Headers;
7644
+ global.Request = Request;
7645
+ global.Response = Response;
7646
+ }
7647
+ exports2.Headers = Headers;
7648
+ exports2.Request = Request;
7649
+ exports2.Response = Response;
7650
+ exports2.fetch = fetch2;
7651
+ return exports2;
7652
+ }({});
7653
+ })(typeof self !== "undefined" ? self : exports);
7654
+ }
7655
+ });
6528
7656
  var getRandomValues;
6529
7657
  var rnds8 = new Uint8Array(16);
6530
7658
  function rng() {
@@ -6565,6 +7693,7 @@ function v4(options, buf, offset) {
6565
7693
  return unsafeStringify(rnds);
6566
7694
  }
6567
7695
  var v4_default = v4;
7696
+ var import_polyfill = __toESM2(require_browser_polyfill());
6568
7697
  var anonymousIdKey = "schematicId";
6569
7698
  var Schematic = class {
6570
7699
  apiKey;
@@ -6931,14 +8060,9 @@ var useSchematicFlag = (key, opts) => {
6931
8060
  return value;
6932
8061
  };
6933
8062
 
6934
- // src/components/embed/ComponentTree.tsx
6935
- var import_react10 = require("react");
6936
-
6937
- // src/components/embed/renderer.ts
6938
- var import_react9 = require("react");
6939
-
6940
- // src/components/elements/included-features/IncludedFeatures.tsx
8063
+ // src/components/elements/plan-manager/PlanManager.tsx
6941
8064
  var import_react7 = require("react");
8065
+ var import_react_dom = require("react-dom");
6942
8066
 
6943
8067
  // src/utils/color.ts
6944
8068
  function hexToHSL(color) {
@@ -7025,15 +8149,24 @@ function hslToHex({ h, s: s2, l: l2 }) {
7025
8149
  bs = "0" + bs;
7026
8150
  return "#" + rs + gs + bs;
7027
8151
  }
7028
- function adjustHexLightness(color, amount) {
8152
+ function adjustLightness(color, amount) {
7029
8153
  const { h, s: s2, l: l2 } = hexToHSL(color);
7030
8154
  return hslToHex({ h, s: s2, l: Math.max(Math.min(l2 + amount, 100), 0) });
7031
8155
  }
7032
8156
  function lighten(color, amount) {
7033
- return adjustHexLightness(color, amount);
8157
+ return adjustLightness(color, amount);
7034
8158
  }
7035
8159
  function darken(color, amount) {
7036
- return adjustHexLightness(color, -amount);
8160
+ return adjustLightness(color, -amount);
8161
+ }
8162
+
8163
+ // src/utils/date.ts
8164
+ function toPrettyDate(date) {
8165
+ return new Intl.DateTimeFormat("en-US", {
8166
+ month: "long",
8167
+ day: "numeric",
8168
+ year: "numeric"
8169
+ }).format(new Date(date));
7037
8170
  }
7038
8171
 
7039
8172
  // src/utils/string.ts
@@ -7079,10 +8212,13 @@ var Box = dt.div((props) => {
7079
8212
  var Text = dt.span`
7080
8213
  font-family: ${({ $font = "Inter" }) => `${$font}, sans-serif`};
7081
8214
  font-size: ${({ $size = 16 }) => typeof $size === "number" ? `${$size / TEXT_BASE_SIZE}rem` : $size};
7082
- font-weight: ${({ $weight = 400 }) => $weight};
7083
- line-height: 1.25;
8215
+ ${({ $weight = 400 }) => lt`
8216
+ font-weight: ${$weight};
8217
+ font-variation-settings: "wght" ${$weight};
8218
+ `};
8219
+ line-height: ${({ $lineHeight = 1.25 }) => $lineHeight};
7084
8220
  ${({ $align }) => attr("text-align", $align)};
7085
- color: ${({ $color, theme }) => $color || theme.text};
8221
+ color: ${({ $color, theme }) => $color || theme.typography.text.color};
7086
8222
 
7087
8223
  &:focus-visible {
7088
8224
  outline: 2px solid ${({ theme }) => theme.primary};
@@ -7107,46 +8243,46 @@ var Button = dt.button`
7107
8243
  switch ($size) {
7108
8244
  case "sm":
7109
8245
  return lt`
7110
- font-size: ${12 / 16}rem;
8246
+ font-size: ${12 / TEXT_BASE_SIZE}rem;
7111
8247
  ${$variant !== "link" && lt`
7112
- padding: ${7 / 16}rem ${20 / 16}rem;
8248
+ padding: ${7 / TEXT_BASE_SIZE}rem ${20 / TEXT_BASE_SIZE}rem;
7113
8249
  `}
7114
- border-radius: ${4 / 16}rem;
8250
+ border-radius: ${4 / TEXT_BASE_SIZE}rem;
7115
8251
  `;
7116
8252
  case "md":
7117
8253
  default:
7118
8254
  return lt`
7119
- font-size: ${14 / 16}rem;
8255
+ font-size: ${14 / TEXT_BASE_SIZE}rem;
7120
8256
  ${$variant !== "link" && lt`
7121
- padding: ${8 / 16}rem ${24 / 16}rem;
8257
+ padding: ${8 / TEXT_BASE_SIZE}rem ${24 / TEXT_BASE_SIZE}rem;
7122
8258
  `}
7123
- border-radius: ${8 / 16}rem;
8259
+ border-radius: ${8 / TEXT_BASE_SIZE}rem;
7124
8260
  `;
7125
8261
  case "lg":
7126
8262
  return lt`
7127
- font-size: ${16 / 16}rem;
8263
+ font-size: ${16 / TEXT_BASE_SIZE}rem;
7128
8264
  ${$variant !== "link" && lt`
7129
- padding: ${9 / 16}rem ${28 / 16}rem;
8265
+ padding: ${9 / TEXT_BASE_SIZE}rem ${28 / TEXT_BASE_SIZE}rem;
7130
8266
  `}
7131
- border-radius: ${12 / 16}rem;
8267
+ border-radius: ${12 / TEXT_BASE_SIZE}rem;
7132
8268
  `;
7133
8269
  }
7134
8270
  }}
7135
8271
 
7136
8272
  ${({ $color, $variant }) => {
7137
- let color = "#ffffff";
8273
+ let color = "#FFFFFF";
7138
8274
  let bgColor;
7139
8275
  switch ($color) {
7140
8276
  case "blue":
7141
8277
  default:
7142
- bgColor = "#194bfb";
8278
+ bgColor = "#194BFB";
7143
8279
  break;
7144
8280
  case "red":
7145
- bgColor = "#ef4444";
8281
+ bgColor = "#EF4444";
7146
8282
  break;
7147
8283
  case "white":
7148
8284
  color = "#000000";
7149
- bgColor = "#ffffff";
8285
+ bgColor = "#FFFFFF";
7150
8286
  break;
7151
8287
  case "black":
7152
8288
  bgColor = "#000000";
@@ -7197,72 +8333,6 @@ var Button2 = ({
7197
8333
  );
7198
8334
  };
7199
8335
 
7200
- // src/components/ui/card/Card.tsx
7201
- var import_react6 = require("react");
7202
-
7203
- // src/components/ui/card/styles.ts
7204
- var StyledCard = dt.div`
7205
- box-sizing: border-box;
7206
- font-size: ${TEXT_BASE_SIZE}px;
7207
-
7208
- *,
7209
- *::before,
7210
- *::after {
7211
- box-sizing: inherit;
7212
- }
7213
-
7214
- > * {
7215
- padding: ${40 / 16}rem ${50 / 16}rem;
7216
- color: ${({ theme }) => theme.color};
7217
- background: ${({ theme }) => theme.background};
7218
- box-shadow:
7219
- 0px 1px 20px 0px #1018280f,
7220
- 0px 1px 3px 0px #1018281a;
7221
- }
7222
-
7223
- ${({ $sectionLayout = "merged", $borderRadius = 8 }) => $sectionLayout === "merged" ? lt`
7224
- > :first-child {
7225
- border-top-left-radius: ${$borderRadius / 16}rem;
7226
- border-top-right-radius: ${$borderRadius / 16}rem;
7227
- }
7228
-
7229
- > :last-child {
7230
- border-bottom-left-radius: ${$borderRadius / 16}rem;
7231
- border-bottom-right-radius: ${$borderRadius / 16}rem;
7232
- }
7233
-
7234
- > :not(:last-child) {
7235
- border-bottom: 1px solid #eaeaea;
7236
- }
7237
- ` : lt`
7238
- > :not(:last-child) {
7239
- margin-bottom: 2rem;
7240
- }
7241
-
7242
- > * {
7243
- border-radius: ${$borderRadius / 16}rem;
7244
- }
7245
- `}
7246
- `;
7247
-
7248
- // src/components/ui/card/Card.tsx
7249
- var import_jsx_runtime4 = require("react/jsx-runtime");
7250
- var Card = (0, import_react6.forwardRef)(
7251
- ({ children, className }, ref) => {
7252
- const { settings } = useEmbed();
7253
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
7254
- StyledCard,
7255
- {
7256
- ref,
7257
- className,
7258
- $sectionLayout: settings.sectionLayout,
7259
- $borderRadius: settings.borderRadius,
7260
- children
7261
- }
7262
- );
7263
- }
7264
- );
7265
-
7266
8336
  // src/components/ui/flex/styles.ts
7267
8337
  var Flex = dt(Box)`
7268
8338
  display: flex;
@@ -7281,9 +8351,8 @@ var Container = dt.div`
7281
8351
  display: flex;
7282
8352
  justify-content: center;
7283
8353
  align-items: center;
7284
- border-width: 1px;
7285
- border-style: solid;
7286
- border-radius: 100%;
8354
+ flex-shrink: 0;
8355
+ border-radius: 9999px;
7287
8356
  ${({ $size }) => {
7288
8357
  const base = 24;
7289
8358
  let scale = 1;
@@ -7303,35 +8372,37 @@ var Container = dt.div`
7303
8372
  break;
7304
8373
  }
7305
8374
  return lt`
7306
- font-size: ${base * scale / 16}rem;
8375
+ font-size: ${base * scale / TEXT_BASE_SIZE}rem;
7307
8376
  line-height: 1;
7308
- width: ${(base + 8) * scale / 16}rem;
7309
- height: ${(base + 8) * scale / 16}rem;
8377
+ width: ${(base + 8) * scale / TEXT_BASE_SIZE}rem;
8378
+ height: ${(base + 8) * scale / TEXT_BASE_SIZE}rem;
7310
8379
  `;
7311
8380
  }}
7312
- ${({ $style }) => $style === "outline" ? lt`
8381
+ ${({ $variant, $colors }) => $variant === "outline" ? lt`
8382
+ color: ${$colors[0]};
7313
8383
  background-color: transparent;
7314
- border-color: #d1d5db;
7315
8384
  ` : lt`
7316
- background-color: #e5e7eb;
7317
- border-color: #e5e7eb;
8385
+ color: ${$colors[0]};
8386
+ background-color: ${$colors[1]};
7318
8387
  `}
7319
8388
  `;
7320
8389
 
7321
8390
  // src/components/ui/icon/Icon.tsx
7322
- var import_jsx_runtime5 = require("react/jsx-runtime");
8391
+ var import_jsx_runtime4 = require("react/jsx-runtime");
7323
8392
  var Icon2 = ({ name, className, ...props }) => {
7324
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { className: (0, import_classnames.default)("i", `i-${name}`, className), ...props });
8393
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { className: (0, import_classnames.default)("i", `i-${name}`, className), ...props });
7325
8394
  };
7326
8395
 
7327
8396
  // src/components/ui/icon/IconRound.tsx
7328
- var import_jsx_runtime6 = require("react/jsx-runtime");
8397
+ var import_jsx_runtime5 = require("react/jsx-runtime");
7329
8398
  var IconRound = ({
7330
8399
  name,
7331
- style = "filled",
7332
- size = "md"
8400
+ variant = "filled",
8401
+ size = "md",
8402
+ colors = ["white", "#e5e7eb"],
8403
+ ...props
7333
8404
  }) => {
7334
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Container, { $size: size, $style: style, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon2, { name }) });
8405
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Container, { $size: size, $variant: variant, $colors: colors, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon2, { name }) });
7335
8406
  };
7336
8407
 
7337
8408
  // src/components/ui/progress-bar/styles.ts
@@ -7340,13 +8411,13 @@ var Container2 = dt(Flex)`
7340
8411
  `;
7341
8412
 
7342
8413
  // src/components/ui/progress-bar/ProgressBar.tsx
7343
- var import_jsx_runtime7 = require("react/jsx-runtime");
8414
+ var import_jsx_runtime6 = require("react/jsx-runtime");
7344
8415
  var ProgressBar = ({
7345
8416
  progress,
7346
8417
  value,
7347
8418
  total = 0,
7348
8419
  color = "gray",
7349
- barWidth,
8420
+ barWidth = "100%",
7350
8421
  ...props
7351
8422
  }) => {
7352
8423
  const barColorMap = {
@@ -7356,477 +8427,1899 @@ var ProgressBar = ({
7356
8427
  orange: "#DB6769",
7357
8428
  red: "#EF4444"
7358
8429
  };
7359
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Container2, { $alignItems: "center", $gap: `${16 / 16}rem`, ...props, children: [
7360
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Flex, { $alignItems: "center", $width: `${barWidth}`, $position: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
7361
- Flex,
7362
- {
7363
- $position: "relative",
7364
- $overflow: "hidden",
7365
- $width: "100%",
7366
- $height: `${8 / TEXT_BASE_SIZE}rem`,
7367
- $background: "#F2F4F7",
7368
- $borderRadius: "9999px",
7369
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
7370
- Box,
8430
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
8431
+ Container2,
8432
+ {
8433
+ $alignItems: "center",
8434
+ $gap: `${16 / TEXT_BASE_SIZE}rem`,
8435
+ ...props,
8436
+ children: [
8437
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
8438
+ Flex,
7371
8439
  {
7372
- $width: `${Math.min(progress, 100)}%`,
7373
- $height: "100%",
7374
- $background: barColorMap[color],
7375
- $borderRadius: "9999px"
8440
+ $position: "relative",
8441
+ $alignItems: "center",
8442
+ $width: `${barWidth}`,
8443
+ $maxWidth: "100%",
8444
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
8445
+ Flex,
8446
+ {
8447
+ $position: "relative",
8448
+ $overflow: "hidden",
8449
+ $width: "100%",
8450
+ $height: `${8 / TEXT_BASE_SIZE}rem`,
8451
+ $background: "#F2F4F7",
8452
+ $borderRadius: "9999px",
8453
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
8454
+ Box,
8455
+ {
8456
+ $width: `${Math.min(progress, 100)}%`,
8457
+ $height: "100%",
8458
+ $background: barColorMap[color],
8459
+ $borderRadius: "9999px"
8460
+ }
8461
+ )
8462
+ }
8463
+ )
7376
8464
  }
7377
- )
7378
- }
7379
- ) }),
7380
- total !== 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { $size: `${14 / 16}rem`, $weight: "500", children: [
7381
- value,
7382
- "/",
7383
- total
7384
- ] })
7385
- ] });
8465
+ ),
8466
+ total !== 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { $size: 14, $weight: 500, children: [
8467
+ value,
8468
+ "/",
8469
+ total
8470
+ ] })
8471
+ ]
8472
+ }
8473
+ );
7386
8474
  };
7387
8475
 
7388
- // src/components/elements/included-features/IncludedFeatures.tsx
7389
- var import_jsx_runtime8 = require("react/jsx-runtime");
7390
- function resolveDesignProps(props) {
7391
- return {
7392
- name: {
7393
- text: props.name?.text || "Included features",
7394
- style: {
7395
- fontFamily: props.name?.style?.fontFamily || "Inter",
7396
- fontSize: props.name?.style?.fontSize || 16,
7397
- fontWeight: props.name?.style?.fontWeight || 500,
7398
- color: props.name?.style?.color || "#000000"
8476
+ // src/components/elements/plan-manager/CheckoutForm.tsx
8477
+ var import_react6 = require("react");
8478
+ var import_react_stripe_js2 = require("@stripe/react-stripe-js");
8479
+ var import_react_stripe_js3 = require("@stripe/react-stripe-js");
8480
+ var import_jsx_runtime7 = require("react/jsx-runtime");
8481
+ var CheckoutForm = () => {
8482
+ const stripe = (0, import_react_stripe_js3.useStripe)();
8483
+ const elements = (0, import_react_stripe_js3.useElements)();
8484
+ const [message, setMessage] = (0, import_react6.useState)(null);
8485
+ const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
8486
+ const handleSubmit = async (event) => {
8487
+ event.preventDefault();
8488
+ if (!stripe || !elements) {
8489
+ return;
8490
+ }
8491
+ setIsLoading(true);
8492
+ const { error } = await stripe.confirmPayment({
8493
+ elements,
8494
+ confirmParams: {
8495
+ return_url: window.location.href
7399
8496
  }
7400
- },
7401
- limits: {
7402
- isVisible: props.limits?.isVisible || true
7403
- },
7404
- usage: {
7405
- isVisible: props.usage?.isVisible || true
7406
- },
7407
- count: props.count || 3
8497
+ });
8498
+ if (error.type === "card_error" || error.type === "validation_error") {
8499
+ setMessage(error.message);
8500
+ } else {
8501
+ setMessage("An unexpected error occured.");
8502
+ }
8503
+ setIsLoading(false);
7408
8504
  };
7409
- }
7410
- var LimitFeature = ({
7411
- feature,
7412
- allocation,
7413
- usage
7414
- }) => {
7415
- if (!feature) {
7416
- return null;
7417
- }
7418
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $justifyContent: "space-between", $margin: "0 0 1.5rem", children: [
7419
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: `${16 / 16}rem`, children: [
7420
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconRound, { name: feature.icon, size: "sm" }),
7421
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
7422
- Text,
7423
- {
7424
- $font: "Public Sans",
7425
- $size: `${18 / 16}rem`,
7426
- $weight: "500",
7427
- $align: "center",
7428
- children: feature.name
7429
- }
7430
- ) })
7431
- ] }),
7432
- typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
7433
- ProgressBar,
7434
- {
7435
- progress: (usage || 0) / allocation * 100,
7436
- value: usage || 0,
7437
- total: allocation,
7438
- color: "blue",
7439
- barWidth: "140px"
8505
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
8506
+ "form",
8507
+ {
8508
+ id: "payment-form",
8509
+ onSubmit: handleSubmit,
8510
+ style: {
8511
+ display: "flex",
8512
+ flexDirection: "column",
8513
+ height: "100%"
8514
+ },
8515
+ children: [
8516
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
8517
+ Box,
8518
+ {
8519
+ $fontSize: "18px",
8520
+ $marginBottom: "1.5rem",
8521
+ $display: "inline-block",
8522
+ $width: "100%",
8523
+ children: [
8524
+ "Add payment method",
8525
+ " "
8526
+ ]
8527
+ }
8528
+ ),
8529
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
8530
+ Flex,
8531
+ {
8532
+ $flexDirection: "column",
8533
+ $gap: "1.5rem",
8534
+ $marginBottom: "1.5rem",
8535
+ $width: "100%",
8536
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
8537
+ import_react_stripe_js2.LinkAuthenticationElement,
8538
+ {
8539
+ id: "link-authentication-element"
8540
+ }
8541
+ )
8542
+ }
8543
+ ),
8544
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Flex, { $flexDirection: "column", $width: "100%", $flex: "1", $height: "100%", children: [
8545
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_stripe_js2.PaymentElement, { id: "payment-element" }),
8546
+ message && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { id: "payment-message", children: message })
8547
+ ] }),
8548
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
8549
+ "button",
8550
+ {
8551
+ disabled: isLoading || !stripe || !elements,
8552
+ id: "submit",
8553
+ style: {
8554
+ backgroundColor: "#000000",
8555
+ color: "#ffffff",
8556
+ paddingTop: ".75rem",
8557
+ paddingBottom: ".75rem",
8558
+ fontSize: "15px",
8559
+ width: "100%",
8560
+ borderRadius: ".5rem",
8561
+ textAlign: "center",
8562
+ cursor: "pointer"
8563
+ },
8564
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: "button-text", style: { marginTop: "2.5rem" }, children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "spinner", id: "spinner" }) : "Save payment method" })
8565
+ }
8566
+ ) })
8567
+ ]
8568
+ }
8569
+ );
8570
+ };
8571
+
8572
+ // src/components/elements/plan-manager/styles.ts
8573
+ var StyledButton = dt(Button2)`
8574
+ font-family: "Public Sans", sans-serif;
8575
+ font-weight: 500;
8576
+ text-align: center;
8577
+ width: 100%;
8578
+
8579
+ ${({ $color = "primary", theme }) => {
8580
+ const { l: l2 } = hexToHSL(theme[$color]);
8581
+ const textColor = l2 > 50 ? "#000000" : "#FFFFFF";
8582
+ return lt`
8583
+ color: ${textColor};
8584
+
8585
+ ${Text} {
8586
+ color: ${textColor};
7440
8587
  }
7441
- )
7442
- ] });
8588
+ `;
8589
+ }};
8590
+
8591
+ ${({ $color = "primary", theme, $variant = "filled" }) => {
8592
+ const color = theme[$color];
8593
+ return $variant === "filled" ? lt`
8594
+ background-color: ${color};
8595
+ border-color: ${color};
8596
+ ` : lt`
8597
+ background-color: transparent;
8598
+ border-color: #d2d2d2;
8599
+ color: #194bfb;
8600
+ ${Text} {
8601
+ color: #194bfb;
8602
+ }
8603
+ `;
8604
+ }}
8605
+
8606
+ &:hover {
8607
+ ${({ $color = "primary", theme, $variant = "filled" }) => {
8608
+ const specified = theme[$color];
8609
+ const lightened = lighten(specified, 15);
8610
+ const color = specified === lightened ? darken(specified, 15) : lightened;
8611
+ return $variant === "filled" ? lt`
8612
+ background-color: ${color};
8613
+ border-color: ${color};
8614
+ ` : lt`
8615
+ background-color: ${color};
8616
+ border-color: ${color};
8617
+ color: #ffffff;
8618
+ ${Text} {
8619
+ color: #ffffff;
8620
+ }
8621
+ `;
8622
+ }}
8623
+ }
8624
+
8625
+ ${({ $size = "md" }) => {
8626
+ switch ($size) {
8627
+ case "sm":
8628
+ return lt`
8629
+ font-size: ${15 / 16}rem;
8630
+ padding: ${12 / 16}rem 0;
8631
+ border-radius: ${6 / 16}rem;
8632
+ `;
8633
+ case "md":
8634
+ return lt`
8635
+ font-size: ${17 / 16}rem;
8636
+ padding: ${16 / 16}rem 0;
8637
+ border-radius: ${8 / 16}rem;
8638
+ `;
8639
+ case "lg":
8640
+ return lt`
8641
+ font-size: ${19 / 16}rem;
8642
+ padding: ${20 / 16}rem 0;
8643
+ border-radius: ${10 / 16}rem;
8644
+ `;
8645
+ }
8646
+ }}
8647
+ `;
8648
+
8649
+ // src/components/elements/plan-manager/PlanManager.tsx
8650
+ var import_jsx_runtime8 = require("react/jsx-runtime");
8651
+ var OverlayHeader = ({ children }) => {
8652
+ const { setLayout } = useEmbed();
8653
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
8654
+ Flex,
8655
+ {
8656
+ $paddingLeft: "2.5rem",
8657
+ $paddingRight: "2.5rem",
8658
+ $padding: ".75rem 2.5rem",
8659
+ $flexDirection: "row",
8660
+ $justifyContent: "space-between",
8661
+ $alignItems: "center",
8662
+ $borderBottom: "1px solid #DEDEDE",
8663
+ $gap: "1rem",
8664
+ $backgroundColor: "#FFFFFF",
8665
+ $borderRadius: ".5rem .5rem 0 0",
8666
+ children: [
8667
+ children,
8668
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
8669
+ Box,
8670
+ {
8671
+ $cursor: "pointer",
8672
+ onClick: () => {
8673
+ setLayout("portal");
8674
+ },
8675
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } })
8676
+ }
8677
+ ) })
8678
+ ]
8679
+ }
8680
+ );
8681
+ };
8682
+ var OverlayWrapper = ({
8683
+ children,
8684
+ size = "lg"
8685
+ }) => {
8686
+ const sizeWidthMap = {
8687
+ md: "700px",
8688
+ lg: "75%"
8689
+ };
8690
+ const sizeHeighthMap = {
8691
+ md: "auto",
8692
+ lg: "75%"
8693
+ };
8694
+ const sizeMaxWidthMap = {
8695
+ md: "auto",
8696
+ lg: "1140px"
8697
+ };
8698
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
8699
+ Box,
8700
+ {
8701
+ $position: "absolute",
8702
+ $top: "50%",
8703
+ $left: "50%",
8704
+ $zIndex: "999999",
8705
+ $transform: "translate(-50%, -50%)",
8706
+ $width: "100%",
8707
+ $height: "100%",
8708
+ $backgroundColor: "#D9D9D9",
8709
+ $overflow: "hidden",
8710
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
8711
+ Flex,
8712
+ {
8713
+ $position: "relative",
8714
+ $top: "50%",
8715
+ $left: "50%",
8716
+ $transform: "translate(-50%, -50%)",
8717
+ $flexDirection: "column",
8718
+ $maxWidth: sizeMaxWidthMap[size],
8719
+ $width: sizeWidthMap[size],
8720
+ $height: sizeHeighthMap[size],
8721
+ $backgroundColor: "#FBFBFB",
8722
+ $borderBottom: "1px solid #DEDEDE",
8723
+ $borderRadius: "8px",
8724
+ $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
8725
+ id: "select-plan-dialog",
8726
+ role: "dialog",
8727
+ "aria-labelledby": "select-plan-dialog-label",
8728
+ "aria-modal": "true",
8729
+ children
8730
+ }
8731
+ )
8732
+ }
8733
+ );
7443
8734
  };
7444
- var UsageFeature = ({
7445
- feature,
7446
- usage
8735
+ var OverlaySideBar = ({
8736
+ pricePeriod,
8737
+ setPricePeriod,
8738
+ setCheckoutStage
7447
8739
  }) => {
7448
- if (!feature) {
8740
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
8741
+ Flex,
8742
+ {
8743
+ $flexDirection: "column",
8744
+ $background: "white",
8745
+ $borderRadius: "0 0 0.5rem",
8746
+ $maxWidth: "275px",
8747
+ $height: "100%",
8748
+ $boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
8749
+ children: [
8750
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
8751
+ Flex,
8752
+ {
8753
+ $flexDirection: "column",
8754
+ $position: "relative",
8755
+ $gap: "1rem",
8756
+ $width: "100%",
8757
+ $height: "auto",
8758
+ $padding: "1.5rem",
8759
+ $borderBottom: "1px solid #DEDEDE",
8760
+ children: [
8761
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "row", $justifyContent: "space-between", children: [
8762
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 20, $weight: 600, children: "Subscription" }),
8763
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
8764
+ Flex,
8765
+ {
8766
+ $border: "1px solid #D9D9D9",
8767
+ $padding: ".15rem .45rem .15rem .55rem",
8768
+ $alignItems: "center",
8769
+ $borderRadius: "5px",
8770
+ $fontSize: "12px",
8771
+ children: [
8772
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $display: "inline-block", $marginRight: ".5rem", children: "$ USD" }),
8773
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
8774
+ Icon2,
8775
+ {
8776
+ name: "chevron-down",
8777
+ style: {
8778
+ fontSize: "20px",
8779
+ lineHeight: "1em"
8780
+ }
8781
+ }
8782
+ )
8783
+ ]
8784
+ }
8785
+ )
8786
+ ] }),
8787
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
8788
+ Flex,
8789
+ {
8790
+ $flexDirection: "row",
8791
+ $border: "1px solid #D9D9D9",
8792
+ $borderRadius: "40px",
8793
+ $fontSize: "12px",
8794
+ $textAlign: "center",
8795
+ $cursor: "pointer",
8796
+ children: [
8797
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
8798
+ Box,
8799
+ {
8800
+ onClick: () => setPricePeriod("month"),
8801
+ $padding: ".25rem .5rem",
8802
+ $flex: "1",
8803
+ $fontWeight: pricePeriod === "month" ? "600" : "400",
8804
+ $backgroundColor: pricePeriod === "month" ? "#DDDDDD" : "white",
8805
+ $borderRadius: "40px",
8806
+ children: "Billed monthly"
8807
+ }
8808
+ ),
8809
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
8810
+ Box,
8811
+ {
8812
+ onClick: () => setPricePeriod("year"),
8813
+ $padding: ".25rem .5rem",
8814
+ $flex: "1",
8815
+ $fontWeight: pricePeriod === "year" ? "600" : "400",
8816
+ $backgroundColor: pricePeriod === "year" ? "#DDDDDD" : "white",
8817
+ $borderRadius: "40px",
8818
+ children: "Billed yearly"
8819
+ }
8820
+ )
8821
+ ]
8822
+ }
8823
+ ),
8824
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $fontSize: "11px", $color: "#194BFB", children: "Save up to 33% with yearly billing" })
8825
+ ]
8826
+ }
8827
+ ),
8828
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
8829
+ Flex,
8830
+ {
8831
+ $flexDirection: "column",
8832
+ $position: "relative",
8833
+ $gap: "1rem",
8834
+ $width: "100%",
8835
+ $height: "auto",
8836
+ $padding: "1.5rem",
8837
+ $flex: "1",
8838
+ $borderBottom: "1px solid #DEDEDE",
8839
+ children: [
8840
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $fontSize: "14px", $color: "#5D5D5D", children: "Plan" }),
8841
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
8842
+ Flex,
8843
+ {
8844
+ $flexDirection: "column",
8845
+ $fontSize: "14px",
8846
+ $color: "#5D5D5D",
8847
+ $gap: ".5rem",
8848
+ children: [
8849
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
8850
+ Flex,
8851
+ {
8852
+ $flexDirection: "row",
8853
+ $alignItems: "center",
8854
+ $justifyContent: "space-between",
8855
+ $fontSize: "14px",
8856
+ $color: "#5D5D5D",
8857
+ children: [
8858
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $fontSize: "14px", $color: "#5D5D5D", children: "Free" }),
8859
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $fontSize: "12px", $color: "#000000", children: [
8860
+ "$0/",
8861
+ pricePeriod
8862
+ ] })
8863
+ ]
8864
+ }
8865
+ ),
8866
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
8867
+ Box,
8868
+ {
8869
+ $width: "100%",
8870
+ $textAlign: "left",
8871
+ $opacity: "50%",
8872
+ $marginBottom: "-.25rem",
8873
+ $marginTop: "-.25rem",
8874
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
8875
+ Icon2,
8876
+ {
8877
+ name: "arrow-down",
8878
+ style: {
8879
+ display: "inline-block"
8880
+ }
8881
+ }
8882
+ )
8883
+ }
8884
+ ),
8885
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
8886
+ Flex,
8887
+ {
8888
+ $flexDirection: "row",
8889
+ $alignItems: "center",
8890
+ $justifyContent: "space-between",
8891
+ $fontSize: "14px",
8892
+ $color: "#5D5D5D",
8893
+ children: [
8894
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $fontSize: "14px", $color: "#000000", $fontWeight: "600", children: "Professional" }),
8895
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $fontSize: "12px", $color: "#000000", children: [
8896
+ "$285/",
8897
+ pricePeriod
8898
+ ] })
8899
+ ]
8900
+ }
8901
+ )
8902
+ ]
8903
+ }
8904
+ )
8905
+ ]
8906
+ }
8907
+ ),
8908
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
8909
+ Flex,
8910
+ {
8911
+ $flexDirection: "column",
8912
+ $position: "relative",
8913
+ $gap: ".75rem",
8914
+ $width: "100%",
8915
+ $height: "auto",
8916
+ $padding: "1.5rem",
8917
+ children: [
8918
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $fontSize: "12px", $color: "#5D5D5D", $justifyContent: "space-between", children: [
8919
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: [
8920
+ "Monthly total:",
8921
+ " "
8922
+ ] }),
8923
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $fontSize: "12px", $color: "#000000", children: "$285/mo" })
8924
+ ] }),
8925
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
8926
+ StyledButton,
8927
+ {
8928
+ $size: "sm",
8929
+ onClick: () => {
8930
+ setCheckoutStage("checkout");
8931
+ },
8932
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: ".5rem", $alignItems: "center", $justifyContent: "center", children: [
8933
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Next: Checkout" }),
8934
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon2, { name: "arrow-right" })
8935
+ ] })
8936
+ }
8937
+ ),
8938
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Discounts & credits applied at checkout" })
8939
+ ]
8940
+ }
8941
+ )
8942
+ ]
8943
+ }
8944
+ );
8945
+ };
8946
+ var resolveDesignProps = (props) => {
8947
+ return {
8948
+ header: {
8949
+ isVisible: props.header?.isVisible ?? true,
8950
+ title: {
8951
+ fontStyle: props.header?.title?.fontStyle ?? "heading1"
8952
+ },
8953
+ description: {
8954
+ isVisible: props.header?.description?.isVisible ?? true,
8955
+ fontStyle: props.header?.description?.fontStyle ?? "text"
8956
+ },
8957
+ price: {
8958
+ isVisible: props.header?.price?.isVisible ?? true,
8959
+ fontStyle: props.header?.price?.fontStyle ?? "text"
8960
+ }
8961
+ },
8962
+ addOns: {
8963
+ isVisible: props.addOns?.isVisible ?? true,
8964
+ fontStyle: props.addOns?.fontStyle ?? "heading4",
8965
+ showLabel: props.addOns?.showLabel ?? true
8966
+ },
8967
+ callToAction: {
8968
+ isVisible: props.callToAction?.isVisible ?? true,
8969
+ buttonSize: props.callToAction?.buttonSize ?? "md",
8970
+ buttonStyle: props.callToAction?.buttonStyle ?? "secondary"
8971
+ }
8972
+ };
8973
+ };
8974
+ var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal, ...rest }, ref) => {
8975
+ const props = resolveDesignProps(rest);
8976
+ const [checkoutStage, setCheckoutStage] = (0, import_react7.useState)(
8977
+ "plan"
8978
+ );
8979
+ const [planPeriod, setPlanPeriod] = (0, import_react7.useState)("month");
8980
+ const { data, settings, layout, stripe, setLayout } = useEmbed();
8981
+ const { currentPlan, canChangePlan, availablePlans } = (0, import_react7.useMemo)(() => {
8982
+ const canChangePlan2 = stripe !== null;
8983
+ const availablePlans2 = data.activePlans?.map(
8984
+ ({ name, description, current, monthlyPrice, yearlyPrice }) => ({
8985
+ name,
8986
+ description,
8987
+ price: planPeriod === "month" ? monthlyPrice?.price : yearlyPrice?.price,
8988
+ current
8989
+ })
8990
+ );
8991
+ return {
8992
+ currentPlan: data.company?.plan,
8993
+ canChangePlan: canChangePlan2,
8994
+ availablePlans: availablePlans2
8995
+ };
8996
+ }, [data.company, data.activePlans, stripe, planPeriod]);
8997
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref, className, children: [
8998
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
8999
+ Flex,
9000
+ {
9001
+ $flexDirection: "column",
9002
+ $gap: "0.75rem",
9003
+ ...canChangePlan && { $margin: "0 0 0.5rem" },
9004
+ children: props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9005
+ Flex,
9006
+ {
9007
+ $justifyContent: "space-between",
9008
+ $alignItems: "center",
9009
+ $width: "100%",
9010
+ ...canChangePlan && { $margin: "0 0 1.5rem" },
9011
+ children: [
9012
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
9013
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $margin: "0 0 0.75rem", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9014
+ Text,
9015
+ {
9016
+ $font: settings.theme.typography[props.header.title.fontStyle].fontFamily,
9017
+ $size: settings.theme.typography[props.header.title.fontStyle].fontSize,
9018
+ $weight: settings.theme.typography[props.header.title.fontStyle].fontWeight,
9019
+ $color: settings.theme.typography[props.header.title.fontStyle].color,
9020
+ $lineHeight: 1,
9021
+ children: currentPlan.name
9022
+ }
9023
+ ) }),
9024
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9025
+ Text,
9026
+ {
9027
+ $font: settings.theme.typography[props.header.description.fontStyle].fontFamily,
9028
+ $size: settings.theme.typography[props.header.description.fontStyle].fontSize,
9029
+ $weight: settings.theme.typography[props.header.description.fontStyle].fontWeight,
9030
+ $color: settings.theme.typography[props.header.description.fontStyle].color,
9031
+ children: currentPlan.description
9032
+ }
9033
+ )
9034
+ ] }),
9035
+ props.header.price.isVisible && currentPlan.planPrice >= 0 && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9036
+ Text,
9037
+ {
9038
+ $font: settings.theme.typography[props.header.price.fontStyle].fontFamily,
9039
+ $size: settings.theme.typography[props.header.price.fontStyle].fontSize,
9040
+ $weight: settings.theme.typography[props.header.price.fontStyle].fontWeight,
9041
+ $color: settings.theme.typography[props.header.price.fontStyle].color,
9042
+ children: [
9043
+ "$",
9044
+ currentPlan.planPrice,
9045
+ "/",
9046
+ currentPlan.planPeriod
9047
+ ]
9048
+ }
9049
+ )
9050
+ ]
9051
+ }
9052
+ )
9053
+ }
9054
+ ),
9055
+ canChangePlan && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9056
+ StyledButton,
9057
+ {
9058
+ onClick: () => {
9059
+ setLayout("checkout");
9060
+ },
9061
+ $size: props.callToAction.buttonSize,
9062
+ $color: props.callToAction.buttonStyle,
9063
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9064
+ Text,
9065
+ {
9066
+ $font: settings.theme.typography.text.fontFamily,
9067
+ $size: settings.theme.typography.text.fontSize,
9068
+ $weight: settings.theme.typography.text.fontWeight,
9069
+ children: "Change Plan"
9070
+ }
9071
+ )
9072
+ }
9073
+ ),
9074
+ canChangePlan && layout === "checkout" && (0, import_react_dom.createPortal)(
9075
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(OverlayWrapper, { children: [
9076
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(OverlayHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: "1rem", children: [
9077
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "row", $gap: "0.5rem", $alignItems: "center", children: [
9078
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9079
+ Box,
9080
+ {
9081
+ $width: "15px",
9082
+ $height: "15px",
9083
+ $border: "2px solid #DDDDDD",
9084
+ $borderRadius: "999px",
9085
+ $backgroundColor: "white"
9086
+ }
9087
+ ),
9088
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9089
+ "div",
9090
+ {
9091
+ ...checkoutStage === "plan" && {
9092
+ style: {
9093
+ fontWeight: "700"
9094
+ }
9095
+ },
9096
+ children: "1. Select plan"
9097
+ }
9098
+ ),
9099
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9100
+ Icon2,
9101
+ {
9102
+ name: "chevron-right",
9103
+ style: { fontSize: 16, color: "#D0D0D0" }
9104
+ }
9105
+ )
9106
+ ] }),
9107
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "row", $gap: "0.5rem", $alignItems: "center", children: [
9108
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9109
+ Box,
9110
+ {
9111
+ $width: "15px",
9112
+ $height: "15px",
9113
+ $border: "2px solid #DDDDDD",
9114
+ $borderRadius: "999px",
9115
+ $backgroundColor: "white"
9116
+ }
9117
+ ),
9118
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9119
+ "div",
9120
+ {
9121
+ ...checkoutStage === "checkout" && {
9122
+ style: {
9123
+ fontWeight: "700"
9124
+ }
9125
+ },
9126
+ children: "2. Checkout"
9127
+ }
9128
+ ),
9129
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9130
+ Icon2,
9131
+ {
9132
+ name: "chevron-right",
9133
+ style: { fontSize: 16, color: "#D0D0D0" }
9134
+ }
9135
+ )
9136
+ ] })
9137
+ ] }) }),
9138
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "row", $height: "100%", children: [
9139
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9140
+ Flex,
9141
+ {
9142
+ $flexDirection: "column",
9143
+ $gap: "1rem",
9144
+ $padding: "2rem 2.5rem 2rem 2.5rem",
9145
+ $backgroundColor: "#FBFBFB",
9146
+ $borderRadius: "0 0.5rem 0",
9147
+ $flex: "1",
9148
+ $height: "100%",
9149
+ children: [
9150
+ checkoutStage === "plan" && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
9151
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9152
+ Flex,
9153
+ {
9154
+ $flexDirection: "column",
9155
+ $gap: "1rem",
9156
+ $marginBottom: "1rem",
9157
+ children: [
9158
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9159
+ Text,
9160
+ {
9161
+ as: "h1",
9162
+ id: "select-plan-dialog-label",
9163
+ $size: 18,
9164
+ $marginBottom: ".5rem",
9165
+ children: "Select plan"
9166
+ }
9167
+ ),
9168
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9169
+ Text,
9170
+ {
9171
+ as: "p",
9172
+ id: "select-plan-dialog-description",
9173
+ $size: 14,
9174
+ $weight: 400,
9175
+ children: "Choose your base plan"
9176
+ }
9177
+ )
9178
+ ]
9179
+ }
9180
+ ),
9181
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9182
+ Flex,
9183
+ {
9184
+ $flexDirection: "row",
9185
+ $gap: "1rem",
9186
+ $flex: "1",
9187
+ $height: "100%",
9188
+ children: availablePlans?.map((plan) => {
9189
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9190
+ Flex,
9191
+ {
9192
+ $height: "100%",
9193
+ $flexDirection: "column",
9194
+ $backgroundColor: "white",
9195
+ $border: plan?.current ? `2px solid #194BFB` : "",
9196
+ $flex: "1",
9197
+ $borderRadius: ".5rem",
9198
+ $boxShadow: "0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 20px rgba(16, 24, 40, 0.06)",
9199
+ children: [
9200
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9201
+ Flex,
9202
+ {
9203
+ $flexDirection: "column",
9204
+ $position: "relative",
9205
+ $gap: "1rem",
9206
+ $width: "100%",
9207
+ $height: "auto",
9208
+ $padding: "1.5rem",
9209
+ $borderBottom: "1px solid #DEDEDE",
9210
+ children: [
9211
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 20, $weight: 600, children: plan?.name }),
9212
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 14, children: plan?.description }),
9213
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { children: [
9214
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $display: "inline-block", $fontSize: ".90rem", children: "$" }),
9215
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $display: "inline-block", $fontSize: "1.5rem", children: plan?.price ? plan.price : "350" }),
9216
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { $display: "inline-block", $fontSize: ".75rem", children: [
9217
+ "/",
9218
+ planPeriod
9219
+ ] })
9220
+ ] }),
9221
+ plan?.current && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9222
+ Flex,
9223
+ {
9224
+ $position: "absolute",
9225
+ $right: "1rem",
9226
+ $top: "1rem",
9227
+ $fontSize: ".75rem",
9228
+ $color: "white",
9229
+ $backgroundColor: "#194BFB",
9230
+ $borderRadius: "999px",
9231
+ $padding: ".125rem .85rem",
9232
+ children: "Current plan"
9233
+ }
9234
+ )
9235
+ ]
9236
+ }
9237
+ ),
9238
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9239
+ Flex,
9240
+ {
9241
+ $flexDirection: "column",
9242
+ $position: "relative",
9243
+ $gap: "0.5rem",
9244
+ $flex: "1",
9245
+ $width: "100%",
9246
+ $height: "auto",
9247
+ $padding: "1.5rem",
9248
+ children: [{}, {}, {}].map(() => {
9249
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexShrink: "0", $gap: "1rem", children: [
9250
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9251
+ IconRound,
9252
+ {
9253
+ name: "server-search",
9254
+ size: "tn",
9255
+ colors: ["#00000", "#F5F5F5"]
9256
+ }
9257
+ ),
9258
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: ".75rem", $color: "#00000", children: "5 Queries/mo" }) })
9259
+ ] });
9260
+ })
9261
+ }
9262
+ ),
9263
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9264
+ Flex,
9265
+ {
9266
+ $flexDirection: "column",
9267
+ $position: "relative",
9268
+ $gap: "1rem",
9269
+ $width: "100%",
9270
+ $height: "auto",
9271
+ $padding: "1.5rem",
9272
+ children: plan.current ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
9273
+ Flex,
9274
+ {
9275
+ $flexDirection: "row",
9276
+ $gap: ".5rem",
9277
+ $justifyContent: "center",
9278
+ $alignItems: "center",
9279
+ children: [
9280
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9281
+ Icon2,
9282
+ {
9283
+ name: "check-rounded",
9284
+ style: {
9285
+ fontSize: 24,
9286
+ lineHeight: "1em",
9287
+ color: "#194BFB"
9288
+ }
9289
+ }
9290
+ ),
9291
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9292
+ "span",
9293
+ {
9294
+ style: {
9295
+ fontSize: "1rem",
9296
+ color: "#7B7B7B"
9297
+ },
9298
+ children: "Selected"
9299
+ }
9300
+ )
9301
+ ]
9302
+ }
9303
+ ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9304
+ StyledButton,
9305
+ {
9306
+ $size: "sm",
9307
+ $color: "secondary",
9308
+ $variant: "outline",
9309
+ onClick: () => {
9310
+ },
9311
+ children: "Select"
9312
+ }
9313
+ )
9314
+ }
9315
+ )
9316
+ ]
9317
+ }
9318
+ );
9319
+ })
9320
+ }
9321
+ )
9322
+ ] }),
9323
+ checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckoutForm, {})
9324
+ ]
9325
+ }
9326
+ ),
9327
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9328
+ OverlaySideBar,
9329
+ {
9330
+ pricePeriod: planPeriod,
9331
+ setPricePeriod: setPlanPeriod,
9332
+ setCheckoutStage
9333
+ }
9334
+ )
9335
+ ] })
9336
+ ] }),
9337
+ portal || document.body
9338
+ )
9339
+ ] });
9340
+ });
9341
+
9342
+ // src/components/elements/included-features/IncludedFeatures.tsx
9343
+ var import_react8 = require("react");
9344
+ var import_jsx_runtime9 = require("react/jsx-runtime");
9345
+ function resolveDesignProps2(props) {
9346
+ return {
9347
+ header: {
9348
+ isVisible: props.header?.isVisible ?? true,
9349
+ fontStyle: props.header?.fontStyle ?? "heading4",
9350
+ text: props.header?.text ?? "Included features"
9351
+ },
9352
+ icons: {
9353
+ isVisible: props.icons?.isVisible ?? true,
9354
+ fontStyle: props.icons?.fontStyle ?? "heading3",
9355
+ style: props.icons?.style ?? "light"
9356
+ },
9357
+ entitlement: {
9358
+ isVisible: props.entitlement?.isVisible ?? true,
9359
+ fontStyle: props.entitlement?.fontStyle ?? "heading5"
9360
+ },
9361
+ usage: {
9362
+ isVisible: props.usage?.isVisible ?? true,
9363
+ fontStyle: props.usage?.fontStyle ?? "heading6"
9364
+ }
9365
+ };
9366
+ }
9367
+ var IncludedFeatures = (0, import_react8.forwardRef)(({ className, ...rest }, ref) => {
9368
+ const props = resolveDesignProps2(rest);
9369
+ const { data, settings } = useEmbed();
9370
+ const features = (0, import_react8.useMemo)(() => {
9371
+ return (data.featureUsage?.features || []).map(
9372
+ ({
9373
+ access,
9374
+ allocation,
9375
+ allocationType,
9376
+ feature,
9377
+ period,
9378
+ usage = 0,
9379
+ ...props2
9380
+ }) => {
9381
+ return {
9382
+ access,
9383
+ allocation,
9384
+ allocationType,
9385
+ feature,
9386
+ period,
9387
+ /**
9388
+ * @TODO: resolve feature price
9389
+ */
9390
+ price: void 0,
9391
+ usage,
9392
+ ...props2
9393
+ };
9394
+ }
9395
+ );
9396
+ }, [data.featureUsage]);
9397
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: [
9398
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
9399
+ Text,
9400
+ {
9401
+ $font: settings.theme.typography[props.header.fontStyle].fontFamily,
9402
+ $size: settings.theme.typography[props.header.fontStyle].fontSize,
9403
+ $weight: settings.theme.typography[props.header.fontStyle].fontWeight,
9404
+ $color: settings.theme.typography[props.header.fontStyle].color,
9405
+ children: props.header.text
9406
+ }
9407
+ ) }),
9408
+ features.reduce(
9409
+ (acc, { allocation, allocationType, feature, usage }, index) => {
9410
+ if (!allocationType) {
9411
+ return acc;
9412
+ }
9413
+ return [
9414
+ ...acc,
9415
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
9416
+ Flex,
9417
+ {
9418
+ $flexWrap: "wrap",
9419
+ $justifyContent: "space-between",
9420
+ $alignItems: "center",
9421
+ $gap: "1rem",
9422
+ children: [
9423
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Flex, { $gap: "1rem", children: [
9424
+ props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
9425
+ IconRound,
9426
+ {
9427
+ name: feature.icon,
9428
+ size: "sm",
9429
+ colors: [
9430
+ settings.theme.card.background,
9431
+ settings.theme.primary
9432
+ ]
9433
+ }
9434
+ ),
9435
+ feature?.name && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
9436
+ Text,
9437
+ {
9438
+ $font: settings.theme.typography[props.icons.fontStyle].fontFamily,
9439
+ $size: settings.theme.typography[props.icons.fontStyle].fontSize,
9440
+ $weight: settings.theme.typography[props.icons.fontStyle].fontWeight,
9441
+ $color: settings.theme.typography[props.icons.fontStyle].color,
9442
+ children: feature.name
9443
+ }
9444
+ ) })
9445
+ ] }),
9446
+ allocationType === "numeric" && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box, { $textAlign: "right", children: [
9447
+ props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
9448
+ Text,
9449
+ {
9450
+ as: Box,
9451
+ $font: settings.theme.typography[props.entitlement.fontStyle].fontFamily,
9452
+ $size: settings.theme.typography[props.entitlement.fontStyle].fontSize,
9453
+ $weight: settings.theme.typography[props.entitlement.fontStyle].fontWeight,
9454
+ $color: settings.theme.typography[props.entitlement.fontStyle].color,
9455
+ children: typeof allocation === "number" ? `${allocation} ${feature.name}` : `Unlimited ${feature.name}`
9456
+ }
9457
+ ),
9458
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
9459
+ Text,
9460
+ {
9461
+ as: Box,
9462
+ $font: settings.theme.typography[props.usage.fontStyle].fontFamily,
9463
+ $size: settings.theme.typography[props.usage.fontStyle].fontSize,
9464
+ $weight: settings.theme.typography[props.usage.fontStyle].fontWeight,
9465
+ $color: settings.theme.typography[props.usage.fontStyle].color,
9466
+ children: typeof allocation === "number" ? `${usage} of ${allocation} used` : `${usage} used`
9467
+ }
9468
+ )
9469
+ ] })
9470
+ ]
9471
+ },
9472
+ index
9473
+ )
9474
+ ];
9475
+ },
9476
+ []
9477
+ )
9478
+ ] });
9479
+ });
9480
+
9481
+ // src/components/elements/metered-features/MeteredFeatures.tsx
9482
+ var import_react9 = require("react");
9483
+ var import_jsx_runtime10 = require("react/jsx-runtime");
9484
+ function resolveDesignProps3(props) {
9485
+ return {
9486
+ isVisible: props.isVisible ?? true,
9487
+ header: {
9488
+ fontStyle: props.header?.fontStyle ?? "heading2"
9489
+ },
9490
+ description: {
9491
+ isVisible: props.description?.isVisible ?? true,
9492
+ fontStyle: props.description?.fontStyle ?? "text"
9493
+ },
9494
+ icon: {
9495
+ isVisible: props.icon?.isVisible ?? true
9496
+ },
9497
+ allocation: {
9498
+ isVisible: props.allocation?.isVisible ?? true,
9499
+ fontStyle: props.allocation?.fontStyle ?? "heading4"
9500
+ },
9501
+ usage: {
9502
+ isVisible: props.usage?.isVisible ?? true,
9503
+ fontStyle: props.usage?.fontStyle ?? "heading5"
9504
+ },
9505
+ callToAction: {
9506
+ isVisible: props.callToAction?.isVisible ?? true,
9507
+ buttonSize: props.callToAction?.buttonSize ?? "md",
9508
+ buttonStyle: props.callToAction?.buttonStyle ?? "secondary"
9509
+ }
9510
+ };
9511
+ }
9512
+ var MeteredFeatures = (0, import_react9.forwardRef)(({ className, ...rest }, ref) => {
9513
+ const props = resolveDesignProps3(rest);
9514
+ const { data, settings } = useEmbed();
9515
+ const features = (0, import_react9.useMemo)(() => {
9516
+ return (data.featureUsage?.features || []).map(
9517
+ ({
9518
+ access,
9519
+ allocation,
9520
+ allocationType,
9521
+ feature,
9522
+ period,
9523
+ usage,
9524
+ ...props2
9525
+ }) => {
9526
+ return {
9527
+ access,
9528
+ allocation,
9529
+ allocationType,
9530
+ feature,
9531
+ period,
9532
+ /**
9533
+ * @TODO: resolve feature price
9534
+ */
9535
+ price: void 0,
9536
+ usage,
9537
+ ...props2
9538
+ };
9539
+ }
9540
+ );
9541
+ }, [data.featureUsage]);
9542
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: features.reduce(
9543
+ (acc, { allocation, allocationType, feature, usage }, index) => {
9544
+ if (!props.isVisible || allocationType !== "numeric" || typeof allocation !== "number") {
9545
+ return acc;
9546
+ }
9547
+ return [
9548
+ ...acc,
9549
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { $gap: "1.5rem", children: [
9550
+ props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { $flexShrink: "0", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconRound, { name: feature.icon, size: "sm" }) }),
9551
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box, { $flexGrow: "1", children: [
9552
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { children: [
9553
+ feature?.name && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box, { $flexGrow: "1", children: [
9554
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9555
+ Text,
9556
+ {
9557
+ as: Box,
9558
+ $font: settings.theme.typography[props.header.fontStyle].fontFamily,
9559
+ $size: settings.theme.typography[props.header.fontStyle].fontSize,
9560
+ $weight: settings.theme.typography[props.header.fontStyle].fontWeight,
9561
+ $color: settings.theme.typography[props.header.fontStyle].color,
9562
+ children: feature.name
9563
+ }
9564
+ ),
9565
+ props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9566
+ Text,
9567
+ {
9568
+ as: Box,
9569
+ $font: settings.theme.typography[props.description.fontStyle].fontFamily,
9570
+ $size: settings.theme.typography[props.description.fontStyle].fontSize,
9571
+ $weight: settings.theme.typography[props.description.fontStyle].fontWeight,
9572
+ $color: settings.theme.typography[props.description.fontStyle].color,
9573
+ children: feature.description
9574
+ }
9575
+ )
9576
+ ] }),
9577
+ allocationType === "numeric" && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box, { $textAlign: "right", children: [
9578
+ props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9579
+ Text,
9580
+ {
9581
+ as: Box,
9582
+ $font: settings.theme.typography[props.allocation.fontStyle].fontFamily,
9583
+ $size: settings.theme.typography[props.allocation.fontStyle].fontSize,
9584
+ $weight: settings.theme.typography[props.allocation.fontStyle].fontWeight,
9585
+ $color: settings.theme.typography[props.allocation.fontStyle].color,
9586
+ children: typeof allocation === "number" ? `${allocation} ${feature.name}` : `Unlimited ${feature.name}`
9587
+ }
9588
+ ),
9589
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9590
+ Text,
9591
+ {
9592
+ as: Box,
9593
+ $font: settings.theme.typography[props.usage.fontStyle].fontFamily,
9594
+ $size: settings.theme.typography[props.usage.fontStyle].fontSize,
9595
+ $weight: settings.theme.typography[props.usage.fontStyle].fontWeight,
9596
+ $color: settings.theme.typography[props.usage.fontStyle].color,
9597
+ children: typeof allocation === "number" ? `${usage} of ${allocation} used` : `${usage} used`
9598
+ }
9599
+ )
9600
+ ] })
9601
+ ] }),
9602
+ typeof usage === "number" && typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
9603
+ ProgressBar,
9604
+ {
9605
+ progress: usage / allocation * 100,
9606
+ value: usage,
9607
+ total: allocation,
9608
+ color: "blue"
9609
+ }
9610
+ ) })
9611
+ ] })
9612
+ ] }, index)
9613
+ ];
9614
+ },
9615
+ []
9616
+ ) });
9617
+ });
9618
+
9619
+ // src/components/elements/upcoming-bill/UpcomingBill.tsx
9620
+ var import_react10 = require("react");
9621
+ var import_jsx_runtime11 = require("react/jsx-runtime");
9622
+ function resolveDesignProps4(props) {
9623
+ return {
9624
+ header: {
9625
+ isVisible: props.header?.isVisible ?? true,
9626
+ fontStyle: props.header?.fontStyle ?? "heading4",
9627
+ prefix: props.header?.prefix ?? "Next bill due"
9628
+ },
9629
+ price: {
9630
+ isVisible: props.price?.isVisible ?? true,
9631
+ fontStyle: props.price?.fontStyle ?? "heading1"
9632
+ },
9633
+ contractEndDate: {
9634
+ isVisible: props.contractEndDate?.isVisible ?? true,
9635
+ fontStyle: props.contractEndDate?.fontStyle ?? "heading6",
9636
+ prefix: props.contractEndDate?.prefix ?? "Contract ends"
9637
+ }
9638
+ };
9639
+ }
9640
+ var UpcomingBill = (0, import_react10.forwardRef)(({ className, ...rest }, ref) => {
9641
+ const props = resolveDesignProps4(rest);
9642
+ const { data, settings, stripe } = useEmbed();
9643
+ const { latestInvoice } = (0, import_react10.useMemo)(() => {
9644
+ return {
9645
+ latestInvoice: {
9646
+ ...data.subscription?.latestInvoice?.amountDue && {
9647
+ amountDue: data.subscription.latestInvoice.amountDue
9648
+ },
9649
+ ...data.subscription?.interval && {
9650
+ interval: data.subscription.interval
9651
+ },
9652
+ ...data.subscription?.latestInvoice?.dueDate && {
9653
+ dueDate: toPrettyDate(
9654
+ new Date(data.subscription.latestInvoice.dueDate)
9655
+ )
9656
+ }
9657
+ }
9658
+ };
9659
+ }, [data.subscription]);
9660
+ if (!stripe || !data.subscription?.latestInvoice) {
7449
9661
  return null;
7450
9662
  }
7451
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $justifyContent: "space-between", $margin: "0 0 1.5rem", children: [
7452
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: `${16 / 16}rem`, children: [
7453
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconRound, { name: feature.icon, size: "sm" }),
7454
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
9663
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ref, className, children: [
9664
+ props.header.isVisible && latestInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9665
+ Flex,
9666
+ {
9667
+ $justifyContent: "space-between",
9668
+ $alignItems: "center",
9669
+ $margin: "0 0 0.75rem",
9670
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
9671
+ Text,
9672
+ {
9673
+ $font: settings.theme.typography[props.header.fontStyle].fontFamily,
9674
+ $size: settings.theme.typography[props.header.fontStyle].fontSize,
9675
+ $weight: settings.theme.typography[props.header.fontStyle].fontWeight,
9676
+ $color: settings.theme.typography[props.header.fontStyle].color,
9677
+ children: [
9678
+ props.header.prefix,
9679
+ " ",
9680
+ latestInvoice.dueDate
9681
+ ]
9682
+ }
9683
+ )
9684
+ }
9685
+ ),
9686
+ latestInvoice.amountDue && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
9687
+ props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
9688
+ Text,
9689
+ {
9690
+ $font: settings.theme.typography[props.price.fontStyle].fontFamily,
9691
+ $size: settings.theme.typography[props.price.fontStyle].fontSize,
9692
+ $weight: settings.theme.typography[props.price.fontStyle].fontWeight,
9693
+ $color: settings.theme.typography[props.price.fontStyle].color,
9694
+ $lineHeight: 1,
9695
+ children: [
9696
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9697
+ Text,
9698
+ {
9699
+ $size: "0.75em",
9700
+ $color: settings.theme.typography[props.price.fontStyle].color,
9701
+ children: "$"
9702
+ }
9703
+ ),
9704
+ latestInvoice.amountDue
9705
+ ]
9706
+ }
9707
+ ) }),
9708
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $maxWidth: "10rem", $lineHeight: "1", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
7455
9709
  Text,
7456
9710
  {
7457
- $font: "Public Sans",
7458
- $size: `${18 / 16}rem`,
7459
- $weight: "500",
7460
- $align: "center",
7461
- children: feature.name
9711
+ $font: settings.theme.typography[props.contractEndDate.fontStyle].fontFamily,
9712
+ $size: settings.theme.typography[props.contractEndDate.fontStyle].fontSize,
9713
+ $weight: settings.theme.typography[props.contractEndDate.fontStyle].fontWeight,
9714
+ $color: settings.theme.typography[props.contractEndDate.fontStyle].color,
9715
+ children: "Estimated monthly bill."
7462
9716
  }
7463
9717
  ) })
7464
- ] }),
7465
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { as: Box, $font: "Public Sans", $weight: "500", $align: "right", children: [
7466
- usage,
7467
- " ",
7468
- feature.featureType,
7469
- " used"
7470
- ] }) })
9718
+ ] })
7471
9719
  ] });
9720
+ });
9721
+
9722
+ // src/components/elements/payment-method/PaymentMethod.tsx
9723
+ var import_react11 = require("react");
9724
+ var import_react_dom2 = require("react-dom");
9725
+ var import_jsx_runtime12 = require("react/jsx-runtime");
9726
+ var resolveDesignProps5 = (props) => {
9727
+ return {
9728
+ header: {
9729
+ isVisible: props.header?.isVisible ?? true,
9730
+ fontStyle: props.header?.fontStyle ?? "heading4"
9731
+ },
9732
+ functions: {
9733
+ allowEdit: props.functions?.allowEdit ?? true
9734
+ }
9735
+ };
7472
9736
  };
7473
- var AddonFeature = ({
7474
- feature
7475
- }) => {
7476
- if (!feature) {
9737
+ var PaymentMethod = (0, import_react11.forwardRef)(({ children, className, portal, ...rest }, ref) => {
9738
+ const props = resolveDesignProps5(rest);
9739
+ const { data, settings, stripe, layout, setLayout } = useEmbed();
9740
+ const paymentMethod = (0, import_react11.useMemo)(() => {
9741
+ const { cardLast4, cardExpMonth, cardExpYear } = data.subscription?.paymentMethod || {};
9742
+ let monthsToExpiration;
9743
+ if (typeof cardExpYear === "number" && typeof cardExpMonth === "number") {
9744
+ const timeToExpiration = Math.round(
9745
+ +new Date(cardExpYear, cardExpMonth - 1) - +/* @__PURE__ */ new Date()
9746
+ );
9747
+ monthsToExpiration = Math.round(
9748
+ timeToExpiration / (1e3 * 60 * 60 * 24 * 30)
9749
+ );
9750
+ }
9751
+ return {
9752
+ cardLast4,
9753
+ monthsToExpiration
9754
+ };
9755
+ }, [data.subscription?.paymentMethod]);
9756
+ if (!stripe || !data.subscription?.paymentMethod) {
7477
9757
  return null;
7478
9758
  }
7479
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $justifyContent: "space-between", $margin: "0 0 1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: `${16 / 16}rem`, children: [
7480
- feature.icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconRound, { name: feature.icon, size: "sm" }),
7481
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
7482
- Text,
9759
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { ref, className, children: [
9760
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
9761
+ Flex,
7483
9762
  {
7484
- $font: "Public Sans",
7485
- $size: `${18 / 16}rem`,
7486
- $weight: "500",
7487
- $align: "center",
7488
- children: feature.name
9763
+ $justifyContent: "space-between",
9764
+ $alignItems: "center",
9765
+ $margin: "0 0 1rem",
9766
+ children: [
9767
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9768
+ Text,
9769
+ {
9770
+ $font: settings.theme.typography[props.header.fontStyle].fontFamily,
9771
+ $size: settings.theme.typography[props.header.fontStyle].fontSize,
9772
+ $weight: settings.theme.typography[props.header.fontStyle].fontWeight,
9773
+ $color: settings.theme.typography[props.header.fontStyle].color,
9774
+ children: "Payment Method"
9775
+ }
9776
+ ),
9777
+ typeof paymentMethod.monthsToExpiration === "number" && Math.abs(paymentMethod.monthsToExpiration) < 4 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9778
+ Text,
9779
+ {
9780
+ $font: settings.theme.typography.text.fontFamily,
9781
+ $size: 14,
9782
+ $color: "#DB6769",
9783
+ children: paymentMethod.monthsToExpiration > 0 ? `Expires in ${paymentMethod.monthsToExpiration} mo` : "Expired"
9784
+ }
9785
+ )
9786
+ ]
7489
9787
  }
7490
- ) })
7491
- ] }) });
7492
- };
7493
- var IncludedFeatures = ({
7494
- className,
7495
- ...props
7496
- }) => {
7497
- const designPropsWithDefaults = resolveDesignProps(props);
7498
- const { data } = useEmbed();
7499
- const [numVisible, setNumVisible] = (0, import_react7.useState)(designPropsWithDefaults.count);
7500
- const isExpanded = (0, import_react7.useMemo)(
7501
- () => numVisible > designPropsWithDefaults.count,
7502
- [numVisible, designPropsWithDefaults.count]
7503
- );
7504
- const features = (0, import_react7.useMemo)(() => {
7505
- return (data.featureUsage?.features || []).map(
7506
- ({
7507
- access,
7508
- allocation,
7509
- allocationType,
7510
- feature,
7511
- period,
7512
- usage,
7513
- ...props2
7514
- }) => {
7515
- return {
7516
- access,
7517
- allocation,
7518
- allocationType,
7519
- feature,
7520
- period,
7521
- /**
7522
- * @TODO: resolve feature price
7523
- */
7524
- price: void 0,
7525
- usage,
7526
- ...props2
7527
- };
9788
+ ),
9789
+ paymentMethod.cardLast4 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
9790
+ Flex,
9791
+ {
9792
+ $justifyContent: "space-between",
9793
+ $alignItems: "center",
9794
+ $margin: "0 0 1rem",
9795
+ $background: `${hexToHSL(settings.theme.card.background).l > 50 ? darken(settings.theme.card.background, 10) : lighten(settings.theme.card.background, 20)}`,
9796
+ $padding: "0.375rem 1rem",
9797
+ $borderRadius: "9999px",
9798
+ children: [
9799
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { $font: settings.theme.typography.text.fontFamily, $size: 14, children: [
9800
+ "\u{1F4B3} Card ending in ",
9801
+ paymentMethod.cardLast4
9802
+ ] }),
9803
+ props.functions.allowEdit && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9804
+ Text,
9805
+ {
9806
+ tabIndex: 0,
9807
+ onClick: () => {
9808
+ if (layout !== "payment")
9809
+ return;
9810
+ setLayout("payment");
9811
+ },
9812
+ $font: settings.theme.typography.link.fontFamily,
9813
+ $size: settings.theme.typography.link.fontSize,
9814
+ $weight: settings.theme.typography.link.fontWeight,
9815
+ $color: settings.theme.typography.link.color,
9816
+ children: "Edit"
9817
+ }
9818
+ )
9819
+ ]
7528
9820
  }
7529
- );
7530
- }, [data.featureUsage]);
7531
- const resize = () => {
7532
- setNumVisible(
7533
- (prev2) => prev2 > designPropsWithDefaults.count ? designPropsWithDefaults.count : features.length
7534
- );
9821
+ ),
9822
+ layout === "payment" && (0, import_react_dom2.createPortal)(
9823
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(OverlayWrapper, { size: "md", children: [
9824
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(OverlayHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $fontWeight: "600", children: "Edit payment method" }) }),
9825
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
9826
+ Flex,
9827
+ {
9828
+ $flexDirection: "column",
9829
+ $padding: "2.5rem",
9830
+ $height: "100%",
9831
+ $gap: "1.5rem",
9832
+ children: [
9833
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9834
+ Flex,
9835
+ {
9836
+ $flexDirection: "column",
9837
+ $gap: "1rem",
9838
+ $backgroundColor: "#FBFBFB",
9839
+ $borderRadius: "0 0 0.5rem 0.5rem",
9840
+ $flex: "1",
9841
+ $height: "100%",
9842
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $flexDirection: "column", $height: "100%", children: [
9843
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9844
+ Box,
9845
+ {
9846
+ $fontSize: "18px",
9847
+ $marginBottom: "1.5rem",
9848
+ $display: "inline-block",
9849
+ $width: "100%",
9850
+ children: "Default"
9851
+ }
9852
+ ),
9853
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $gap: "1rem", children: [
9854
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9855
+ Flex,
9856
+ {
9857
+ $alignItems: "center",
9858
+ $padding: ".5rem 1rem",
9859
+ $border: "1px solid #E2E5E9",
9860
+ $borderRadius: ".5rem",
9861
+ $backgroundColor: "#ffffff",
9862
+ $flexDirection: "row",
9863
+ $gap: "1rem",
9864
+ $width: "100%",
9865
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
9866
+ Flex,
9867
+ {
9868
+ $flexDirection: "row",
9869
+ $justifyContent: "space-between",
9870
+ $flex: "1",
9871
+ children: [
9872
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
9873
+ Flex,
9874
+ {
9875
+ $flexDirection: "row",
9876
+ $alignItems: "center",
9877
+ $gap: "1rem",
9878
+ children: [
9879
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $display: "inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9880
+ "svg",
9881
+ {
9882
+ viewBox: "0 0 24 16",
9883
+ fill: "none",
9884
+ xmlns: "http://www.w3.org/2000/svg",
9885
+ width: "26px",
9886
+ height: "auto",
9887
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { children: [
9888
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9889
+ "rect",
9890
+ {
9891
+ stroke: "#DDD",
9892
+ fill: "#FFF",
9893
+ x: ".25",
9894
+ y: ".25",
9895
+ width: "23",
9896
+ height: "15.5",
9897
+ rx: "2"
9898
+ }
9899
+ ),
9900
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9901
+ "path",
9902
+ {
9903
+ 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",
9904
+ fill: "#1434CB"
9905
+ }
9906
+ )
9907
+ ] })
9908
+ }
9909
+ ) }),
9910
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $whiteSpace: "nowrap", children: "Visa **** 4242" })
9911
+ ]
9912
+ }
9913
+ ),
9914
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Expires: 3/30" }) })
9915
+ ]
9916
+ }
9917
+ )
9918
+ }
9919
+ ),
9920
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9921
+ StyledButton,
9922
+ {
9923
+ $size: "sm",
9924
+ $color: "secondary",
9925
+ $variant: "outline",
9926
+ style: {
9927
+ whiteSpace: "nowrap",
9928
+ paddingLeft: "1rem",
9929
+ paddingRight: "1rem"
9930
+ },
9931
+ children: "Edit"
9932
+ }
9933
+ ) })
9934
+ ] })
9935
+ ] })
9936
+ }
9937
+ ),
9938
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9939
+ Flex,
9940
+ {
9941
+ $flexDirection: "column",
9942
+ $gap: "1rem",
9943
+ $backgroundColor: "#FBFBFB",
9944
+ $borderRadius: "0 0 0.5rem 0.5rem",
9945
+ $flex: "1",
9946
+ $height: "100%",
9947
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $flexDirection: "column", $height: "100%", children: [
9948
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9949
+ Box,
9950
+ {
9951
+ $fontSize: "18px",
9952
+ $marginBottom: "1.5rem",
9953
+ $display: "inline-block",
9954
+ $width: "100%",
9955
+ children: "Others"
9956
+ }
9957
+ ),
9958
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $gap: "1rem", children: [
9959
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9960
+ Flex,
9961
+ {
9962
+ $alignItems: "center",
9963
+ $padding: ".5rem 1rem",
9964
+ $border: "1px solid #E2E5E9",
9965
+ $borderRadius: ".5rem",
9966
+ $backgroundColor: "#ffffff",
9967
+ $flexDirection: "row",
9968
+ $gap: "1rem",
9969
+ $width: "100%",
9970
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
9971
+ Flex,
9972
+ {
9973
+ $flexDirection: "row",
9974
+ $justifyContent: "space-between",
9975
+ $flex: "1",
9976
+ children: [
9977
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
9978
+ Flex,
9979
+ {
9980
+ $flexDirection: "row",
9981
+ $alignItems: "center",
9982
+ $gap: "1rem",
9983
+ children: [
9984
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $display: "inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9985
+ "svg",
9986
+ {
9987
+ viewBox: "0 0 24 16",
9988
+ fill: "none",
9989
+ xmlns: "http://www.w3.org/2000/svg",
9990
+ width: "26px",
9991
+ height: "auto",
9992
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { children: [
9993
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9994
+ "rect",
9995
+ {
9996
+ stroke: "#DDD",
9997
+ fill: "#FFF",
9998
+ x: ".25",
9999
+ y: ".25",
10000
+ width: "23",
10001
+ height: "15.5",
10002
+ rx: "2"
10003
+ }
10004
+ ),
10005
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10006
+ "path",
10007
+ {
10008
+ 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",
10009
+ fill: "#1434CB"
10010
+ }
10011
+ )
10012
+ ] })
10013
+ }
10014
+ ) }),
10015
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $whiteSpace: "nowrap", children: "Visa **** 2929" })
10016
+ ]
10017
+ }
10018
+ ),
10019
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Expires: 3/30" }) })
10020
+ ]
10021
+ }
10022
+ )
10023
+ }
10024
+ ),
10025
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $gap: "1rem", children: [
10026
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10027
+ StyledButton,
10028
+ {
10029
+ $size: "sm",
10030
+ $color: "secondary",
10031
+ $variant: "outline",
10032
+ style: {
10033
+ whiteSpace: "nowrap",
10034
+ paddingLeft: "1rem",
10035
+ paddingRight: "1rem"
10036
+ },
10037
+ children: "Make Default"
10038
+ }
10039
+ ),
10040
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10041
+ StyledButton,
10042
+ {
10043
+ $size: "sm",
10044
+ $color: "secondary",
10045
+ $variant: "outline",
10046
+ style: {
10047
+ whiteSpace: "nowrap",
10048
+ paddingLeft: "1rem",
10049
+ paddingRight: "1rem"
10050
+ },
10051
+ children: "Edit"
10052
+ }
10053
+ )
10054
+ ] })
10055
+ ] })
10056
+ ] })
10057
+ }
10058
+ )
10059
+ ]
10060
+ }
10061
+ )
10062
+ ] }),
10063
+ portal || document.body
10064
+ )
10065
+ ] });
10066
+ });
10067
+
10068
+ // src/components/elements/invoices/Invoices.tsx
10069
+ var import_react12 = require("react");
10070
+ var import_jsx_runtime13 = require("react/jsx-runtime");
10071
+ function resolveDesignProps6(props) {
10072
+ return {
10073
+ header: {
10074
+ isVisible: props.header?.isVisible ?? true,
10075
+ fontStyle: props.header?.fontStyle ?? "heading4"
10076
+ },
10077
+ date: {
10078
+ isVisible: props.date?.isVisible ?? true,
10079
+ fontStyle: props.date?.fontStyle ?? "link"
10080
+ },
10081
+ amount: {
10082
+ isVisible: props.amount?.isVisible ?? true,
10083
+ fontStyle: props.amount?.fontStyle ?? "text"
10084
+ },
10085
+ limit: {
10086
+ isVisible: props.limit?.isVisible ?? true,
10087
+ number: props.limit?.number ?? 2
10088
+ },
10089
+ collapse: {
10090
+ isVisible: props.collapse?.isVisible ?? true,
10091
+ fontStyle: props.collapse?.fontStyle ?? "link"
10092
+ }
7535
10093
  };
7536
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className, children: [
7537
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $margin: "0 0 1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
10094
+ }
10095
+ var Invoices = (0, import_react12.forwardRef)(({ className, ...rest }, ref) => {
10096
+ const props = resolveDesignProps6(rest);
10097
+ const { settings } = useEmbed();
10098
+ const { invoices } = (0, import_react12.useMemo)(() => {
10099
+ return {
10100
+ invoices: [
10101
+ {
10102
+ date: toPrettyDate(/* @__PURE__ */ new Date("2024-05-12")),
10103
+ amount: 200
10104
+ },
10105
+ {
10106
+ date: toPrettyDate(/* @__PURE__ */ new Date("2024-04-12")),
10107
+ amount: 200
10108
+ }
10109
+ ]
10110
+ };
10111
+ }, []);
10112
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
10113
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
7538
10114
  Text,
7539
10115
  {
7540
- $font: "Inter",
7541
- $size: `${15 / 16}rem`,
7542
- $weight: "500",
7543
- $color: "#767676",
7544
- children: designPropsWithDefaults.name.text
10116
+ $font: settings.theme.typography[props.header.fontStyle].fontFamily,
10117
+ $size: settings.theme.typography[props.header.fontStyle].fontSize,
10118
+ $weight: settings.theme.typography[props.header.fontStyle].fontWeight,
10119
+ $color: settings.theme.typography[props.header.fontStyle].color,
10120
+ children: "Invoices"
7545
10121
  }
7546
10122
  ) }),
7547
- features.slice(0, numVisible).reduce((acc, feature, index) => {
7548
- if (feature.allocationType === "boolean") {
7549
- return [...acc, /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AddonFeature, { ...feature }, index)];
7550
- }
7551
- if (feature.allocationType === "numeric" || feature.allocationType === "trait" || feature.allocationType === "unlimited") {
7552
- if (typeof feature.allocation === "number") {
7553
- return [...acc, /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LimitFeature, { ...feature }, index)];
7554
- }
7555
- return [...acc, /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UsageFeature, { ...feature }, index)];
7556
- }
7557
- return acc;
7558
- }, []),
7559
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $alignItems: "center", $gap: `${4 / 16}rem`, children: [
7560
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
7561
- Icon2,
10123
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(
10124
+ 0,
10125
+ props.limit.isVisible && props.limit.number || invoices.length
10126
+ ).map(({ date, amount }, index) => {
10127
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $justifyContent: "space-between", children: [
10128
+ props.date.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10129
+ Text,
10130
+ {
10131
+ $font: settings.theme.typography[props.date.fontStyle].fontFamily,
10132
+ $size: settings.theme.typography[props.date.fontStyle].fontSize,
10133
+ $weight: settings.theme.typography[props.date.fontStyle].fontWeight,
10134
+ $color: settings.theme.typography[props.date.fontStyle].color,
10135
+ children: toPrettyDate(date)
10136
+ }
10137
+ ),
10138
+ props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
10139
+ Text,
10140
+ {
10141
+ $font: settings.theme.typography[props.amount.fontStyle].fontFamily,
10142
+ $size: settings.theme.typography[props.amount.fontStyle].fontSize,
10143
+ $weight: settings.theme.typography[props.amount.fontStyle].fontWeight,
10144
+ $color: settings.theme.typography[props.amount.fontStyle].color,
10145
+ children: [
10146
+ "$",
10147
+ amount
10148
+ ]
10149
+ }
10150
+ )
10151
+ ] }, index);
10152
+ }) }),
10153
+ props.collapse.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
10154
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon2, { name: "chevron-down", style: { color: "#D0D0D0" } }),
10155
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10156
+ Text,
7562
10157
  {
7563
- name: isExpanded ? "chevron-up" : "chevron-down",
7564
- style: { fontSize: "1.25rem", color: "#D0D0D0" }
10158
+ $font: settings.theme.typography[props.collapse.fontStyle].fontFamily,
10159
+ $size: settings.theme.typography[props.collapse.fontStyle].fontSize,
10160
+ $weight: settings.theme.typography[props.collapse.fontStyle].fontWeight,
10161
+ $color: settings.theme.typography[props.collapse.fontStyle].color,
10162
+ children: "See all"
7565
10163
  }
7566
- ),
7567
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button2, { onClick: resize, color: "blue", variant: "link", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $weight: "500", children: "See all" }) })
7568
- ] })
7569
- ] });
7570
- };
7571
-
7572
- // src/components/elements/invoices/Invoices.tsx
7573
- var import_jsx_runtime9 = require("react/jsx-runtime");
7574
- var Invoices = () => {
7575
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "p-8", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative z-[1] bg-white flex flex-col space-y-4", children: [
7576
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "font-bold text-base", children: "Invoices" }) }),
7577
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col space-y-2", children: [
7578
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-between text-sm", children: [
7579
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-blue-400", children: "May 12, 2024" }),
7580
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-gray-400", children: "$315.00" })
7581
- ] }),
7582
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-between text-sm", children: [
7583
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-blue-400", children: "May 12, 2024" }),
7584
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-gray-400", children: "$315.00" })
7585
- ] })
7586
- ] }),
7587
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-row space-x-2 items-center", children: [
7588
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon2, { name: "chevron-down", className: "text-gray-400 leading-none" }),
7589
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-blue-400 font-medium font-display text-sm", children: "See all" })
10164
+ )
7590
10165
  ] })
7591
10166
  ] }) });
7592
- };
10167
+ });
7593
10168
 
7594
- // src/components/elements/next-bill-due/NextBillDue.tsx
7595
- var import_jsx_runtime10 = require("react/jsx-runtime");
7596
- var NextBillDue = () => {
7597
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-white p-8", children: [
7598
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-center justify-between mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "font-bold text-base", children: "Next bill due June 12, 2024" }) }),
7599
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center leading-none justify-between", children: [
7600
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-row items-end flex-1 font-medium font-display text-gray-700", children: [
7601
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-lg mr-0.5 translate-y-[3px]", children: "$" }),
7602
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-3xl", children: "315.00" })
7603
- ] }),
7604
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-gray-400 text-xs max-w-[160px]", children: [
7605
- "Estimated monthly bill, ",
7606
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("br", {}),
7607
- "Contract ends 5/12/24."
7608
- ] })
7609
- ] })
7610
- ] });
7611
- };
10169
+ // src/components/embed/ComponentTree.tsx
10170
+ var import_react18 = require("react");
7612
10171
 
7613
- // src/components/elements/payment-method/PaymentMethod.tsx
7614
- var import_jsx_runtime11 = require("react/jsx-runtime");
7615
- var PaymentMethod = () => {
7616
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative px-8 py-8 bg-white", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative z-[1] bg-white", children: [
7617
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
7618
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "font-bold text-base", children: "Payment Method" }),
7619
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "text-xs text-red-400", children: "Expires in 4 mo" })
7620
- ] }),
7621
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row justify-between bg-gray-50 text-sm px-4 py-1.5 rounded-full", children: [
7622
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "", children: "\u{1F4B3} Card ending 4512" }),
7623
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-blue-400", children: "Edit" })
7624
- ] })
7625
- ] }) });
7626
- };
10172
+ // src/components/embed/renderer.ts
10173
+ var import_react17 = require("react");
7627
10174
 
7628
- // src/components/elements/plan-manager/PlanManager.tsx
7629
- var import_react8 = require("react");
10175
+ // src/components/layout/root/Root.tsx
10176
+ var import_react13 = require("react");
10177
+ var import_jsx_runtime14 = require("react/jsx-runtime");
10178
+ var Root = (0, import_react13.forwardRef)(
10179
+ (props, ref) => {
10180
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ref, ...props });
10181
+ }
10182
+ );
7630
10183
 
7631
- // src/components/elements/plan-manager/styles.ts
7632
- var Button3 = dt(Button2)`
7633
- font-family: "Public Sans", sans-serif;
7634
- font-weight: 500;
7635
- text-align: center;
7636
- width: 100%;
7637
- color: ${({ $color, theme }) => $color || theme.text};
7638
- ${({ $backgroundColor, theme }) => {
7639
- const color = $backgroundColor || theme.button;
7640
- return lt`
7641
- background-color: ${color};
7642
- border-color: ${color};
7643
- `;
7644
- }}
10184
+ // src/components/layout/viewport/Viewport.tsx
10185
+ var import_react14 = require("react");
7645
10186
 
7646
- &:hover {
7647
- ${({ $backgroundColor, theme }) => {
7648
- const specified = $backgroundColor || theme.button;
7649
- const lightened = lighten(specified, 12.5);
7650
- const color = specified === lightened ? darken(specified, 12.5) : lightened;
7651
- return lt`
7652
- background-color: ${color};
7653
- border-color: ${color};
7654
- `;
7655
- }}
10187
+ // src/components/layout/viewport/styles.ts
10188
+ var StyledViewport = dt.div`
10189
+ display: flex;
10190
+ flex-wrap: wrap;
10191
+ margin-left: auto;
10192
+ margin-right: auto;
10193
+ `;
10194
+
10195
+ // src/components/layout/viewport/Viewport.tsx
10196
+ var import_jsx_runtime15 = require("react/jsx-runtime");
10197
+ var Viewport = (0, import_react14.forwardRef)(
10198
+ ({ children, ...props }, ref) => {
10199
+ const { settings, layout } = useEmbed();
10200
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10201
+ StyledViewport,
10202
+ {
10203
+ ref,
10204
+ $numberOfColumns: settings.theme.numberOfColumns,
10205
+ ...props,
10206
+ children: layout === "disabled" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "", children: "DISABLED" }) : children
10207
+ }
10208
+ );
7656
10209
  }
10210
+ );
7657
10211
 
7658
- ${({ $size = "md" }) => {
7659
- switch ($size) {
7660
- case "sm":
7661
- return lt`
7662
- font-size: ${15 / 16}rem;
7663
- padding: ${12 / 16}rem 0;
7664
- border-radius: ${8 / 16}rem;
7665
- `;
7666
- case "md":
7667
- return lt`
7668
- font-size: ${17 / 16}rem;
7669
- padding: ${16 / 16}rem 0;
7670
- border-radius: ${10 / 16}rem;
7671
- `;
7672
- case "lg":
10212
+ // src/components/layout/column/Column.tsx
10213
+ var import_react16 = require("react");
10214
+
10215
+ // src/components/layout/card/Card.tsx
10216
+ var import_react15 = require("react");
10217
+
10218
+ // src/components/layout/card/styles.ts
10219
+ var StyledCard = dt.div(
10220
+ ({
10221
+ theme,
10222
+ $sectionLayout = "merged",
10223
+ $borderRadius = 8,
10224
+ $padding = 48,
10225
+ $shadow = true
10226
+ }) => {
10227
+ return lt`
10228
+ box-sizing: border-box;
10229
+ font-size: ${TEXT_BASE_SIZE}px;
10230
+
10231
+ *,
10232
+ *::before,
10233
+ *::after {
10234
+ box-sizing: inherit;
10235
+ }
10236
+
10237
+ > * {
10238
+ padding: ${$padding * 0.75 / TEXT_BASE_SIZE}rem
10239
+ ${$padding / TEXT_BASE_SIZE}rem;
10240
+ color: ${theme.typography.text.color};
10241
+ }
10242
+
10243
+ ${() => {
10244
+ const { l: l2 } = hexToHSL(theme.card.background);
10245
+ const borderColor = l2 > 50 ? darken(theme.card.background, 10) : lighten(theme.card.background, 30);
10246
+ const borderRadius = `${$borderRadius / TEXT_BASE_SIZE}rem`;
10247
+ const boxShadow = "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A";
10248
+ if ($sectionLayout === "merged") {
10249
+ return lt`
10250
+ background: ${({ theme: theme2 }) => theme2.card.background};
10251
+ border-radius: ${borderRadius};
10252
+
10253
+ ${$shadow && `box-shadow: ${boxShadow};`}
10254
+
10255
+ > :not(:last-child) {
10256
+ border-bottom: 1px solid ${borderColor};
10257
+ }
10258
+ `;
10259
+ }
7673
10260
  return lt`
7674
- font-size: ${19 / 16}rem;
7675
- padding: ${20 / 16}rem 0;
7676
- border-radius: ${12 / 16}rem;
10261
+ > :not(:last-child) {
10262
+ margin-bottom: 1rem;
10263
+ }
10264
+
10265
+ > * {
10266
+ background: ${theme.card.background};
10267
+ border-radius: ${borderRadius};
10268
+ ${$shadow && `box-shadow: ${boxShadow};`}
10269
+ }
7677
10270
  `;
10271
+ }}
10272
+ `;
7678
10273
  }
7679
- }}
7680
- `;
10274
+ );
7681
10275
 
7682
- // src/components/elements/plan-manager/PlanManager.tsx
7683
- var import_jsx_runtime12 = require("react/jsx-runtime");
7684
- function resolveDesignProps2(props) {
7685
- return {
7686
- header: {
7687
- isVisible: props.header?.isVisible || true,
7688
- title: {
7689
- fontFamily: props.header?.title?.fontFamily || "Manrope",
7690
- fontSize: props.header?.title?.fontSize || 37,
7691
- fontWeight: props.header?.title?.fontWeight || 800,
7692
- color: props.header?.title?.color || "black"
7693
- },
7694
- description: {
7695
- isVisible: props.header?.description?.isVisible || true,
7696
- fontFamily: props.header?.description?.fontFamily || "Public Sans",
7697
- fontSize: props.header?.description?.fontSize || 16,
7698
- fontWeight: props.header?.description?.fontWeight || 400,
7699
- color: props.header?.description?.color || "black"
7700
- },
7701
- price: {
7702
- isVisible: props.header?.price?.isVisible || true,
7703
- fontFamily: props.header?.price?.fontFamily || "Inter",
7704
- fontSize: props.header?.price?.fontSize || 16,
7705
- fontWeight: props.header?.price?.fontWeight || 500,
7706
- color: props.header?.price?.color || "black"
7707
- }
7708
- },
7709
- addOns: {
7710
- isVisible: props.addOns?.isVisible || true
7711
- },
7712
- usageBased: {
7713
- isVisible: props.usageBased?.isVisible || true
7714
- },
7715
- callToAction: {
7716
- isVisible: props.callToAction?.isVisible || true,
7717
- size: props.callToAction?.size || "md",
7718
- color: props.callToAction?.color || "white",
7719
- backgroundColor: props.callToAction?.backgroundColor || "black"
7720
- }
7721
- };
7722
- }
7723
- var PlanManager = ({ className, ...props }) => {
7724
- const designPropsWithDefaults = resolveDesignProps2(props);
7725
- const { data } = useEmbed();
7726
- const plans = (0, import_react8.useMemo)(() => {
7727
- return (data.company?.plans || []).map(({ name, description }) => {
7728
- return {
7729
- name,
7730
- description,
7731
- /**
7732
- * @TODO: resolve plan/addon prices
7733
- */
7734
- price: void 0
7735
- };
7736
- });
7737
- }, [data.company?.plans]);
7738
- const plan = plans.at(0);
7739
- const addons = plans.slice(1);
7740
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className, children: [
7741
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $flexDirection: "column", $gap: `${12 / 16}rem`, $margin: "0 0 3rem", children: [
7742
- designPropsWithDefaults.header.isVisible && plan && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
7743
- Flex,
7744
- {
7745
- $justifyContent: "space-between",
7746
- $alignItems: "center",
7747
- $width: "100%",
7748
- $margin: "0 0 1.5rem",
7749
- children: [
7750
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
7751
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $margin: "0 0 0.75rem", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
7752
- Text,
7753
- {
7754
- $font: designPropsWithDefaults.header.title.fontFamily,
7755
- $size: `${designPropsWithDefaults.header.title.fontSize / 16}rem`,
7756
- $weight: `${designPropsWithDefaults.header.title.fontWeight}`,
7757
- $color: designPropsWithDefaults.header.title.color,
7758
- children: plan.name
7759
- }
7760
- ) }),
7761
- designPropsWithDefaults.header.description.isVisible && plan.description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
7762
- Text,
7763
- {
7764
- $font: designPropsWithDefaults.header.description.fontFamily,
7765
- $size: `${designPropsWithDefaults.header.description.fontSize / 16}rem`,
7766
- $weight: `${designPropsWithDefaults.header.description.fontWeight}`,
7767
- $color: designPropsWithDefaults.header.description.color,
7768
- children: plan.description
7769
- }
7770
- )
7771
- ] }),
7772
- designPropsWithDefaults.header.price.isVisible && plan.price >= 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
7773
- Text,
7774
- {
7775
- $font: designPropsWithDefaults.header.price.fontFamily,
7776
- $size: `${designPropsWithDefaults.header.price.fontSize / 16}`,
7777
- $weight: `${designPropsWithDefaults.header.price.fontWeight}`,
7778
- $color: designPropsWithDefaults.header.price.color,
7779
- children: [
7780
- "$",
7781
- plan.price,
7782
- "/mo"
7783
- ]
7784
- }
7785
- )
7786
- ]
7787
- }
7788
- ),
7789
- designPropsWithDefaults.addOns.isVisible && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
7790
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { $size: `${15 / 16}rem`, $weight: "500", children: "Add-Ons" }),
7791
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $width: "100%", $margin: "0 0 1rem", children: addons.map((addon, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
7792
- Flex,
7793
- {
7794
- $justifyContent: "space-between",
7795
- $alignItems: "center",
7796
- $width: "100%",
7797
- children: [
7798
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { $font: "Manrope", $size: `${18 / 16}rem`, $weight: "800", children: addon.name }),
7799
- addon.price >= 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { $weight: "500", children: [
7800
- "$",
7801
- addon.price,
7802
- "/mo"
7803
- ] })
7804
- ]
7805
- },
7806
- index
7807
- )) })
7808
- ] })
7809
- ] }),
7810
- designPropsWithDefaults.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
7811
- Button3,
10276
+ // src/components/layout/card/Card.tsx
10277
+ var import_jsx_runtime16 = require("react/jsx-runtime");
10278
+ var Card = (0, import_react15.forwardRef)(
10279
+ ({ children, className }, ref) => {
10280
+ const { settings } = useEmbed();
10281
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10282
+ StyledCard,
7812
10283
  {
7813
- $size: designPropsWithDefaults.callToAction.size,
7814
- $color: designPropsWithDefaults.callToAction.color,
7815
- $backgroundColor: designPropsWithDefaults.callToAction.backgroundColor,
7816
- children: "Change Plan"
10284
+ ref,
10285
+ className,
10286
+ $sectionLayout: settings.theme?.sectionLayout,
10287
+ $borderRadius: settings.theme?.card?.borderRadius,
10288
+ $padding: settings.theme?.card?.padding,
10289
+ $shadow: settings.theme?.card?.hasShadow,
10290
+ children
7817
10291
  }
7818
- )
7819
- ] });
7820
- };
10292
+ );
10293
+ }
10294
+ );
10295
+
10296
+ // src/components/layout/column/styles.ts
10297
+ var StyledColumn = dt.div`
10298
+ flex-grow: 1;
10299
+ padding: 0.75rem;
10300
+ `;
10301
+
10302
+ // src/components/layout/column/Column.tsx
10303
+ var import_jsx_runtime17 = require("react/jsx-runtime");
10304
+ var Column = (0, import_react16.forwardRef)(
10305
+ ({ children, ...props }, ref) => {
10306
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StyledColumn, { ref, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Card, { children }) });
10307
+ }
10308
+ );
7821
10309
 
7822
10310
  // src/components/embed/renderer.ts
7823
10311
  var components = {
10312
+ Root,
10313
+ Viewport,
10314
+ Column,
7824
10315
  Card,
10316
+ PlanManager,
7825
10317
  IncludedFeatures,
7826
- PlanManager
10318
+ UpcomingBill,
10319
+ PaymentMethod
7827
10320
  };
7828
10321
  function createRenderer(options) {
7829
- const { useFallback = true } = options || {};
10322
+ const { useFallback = false } = options || {};
7830
10323
  return function renderNode(node2, index) {
7831
10324
  const { type, props = {}, custom = {}, children } = node2;
7832
10325
  const name = typeof type !== "string" ? type.resolvedName : type;
@@ -7840,14 +10333,15 @@ function createRenderer(options) {
7840
10333
  if (!component) {
7841
10334
  return null;
7842
10335
  }
7843
- const { className, style, ...rootProps } = props;
7844
- const resolvedProps = node2.id === "ROOT" ? rootProps : props;
10336
+ const { className, ...rest } = props;
10337
+ const resolvedProps = component === "div" ? rest : props;
7845
10338
  const resolvedChildren = children.map(renderNode);
7846
- return (0, import_react9.createElement)(
10339
+ return (0, import_react17.createElement)(
7847
10340
  component,
7848
10341
  {
7849
- ...resolvedProps,
7850
- ...Object.keys(custom).length > 0 && { custom },
10342
+ className,
10343
+ ...component !== "div" && { resolvedProps },
10344
+ ...component !== "div" && Object.keys(custom).length > 0 && { custom },
7851
10345
  key: index
7852
10346
  },
7853
10347
  resolvedChildren
@@ -7856,30 +10350,30 @@ function createRenderer(options) {
7856
10350
  }
7857
10351
 
7858
10352
  // src/components/embed/ComponentTree.tsx
7859
- var import_jsx_runtime13 = require("react/jsx-runtime");
10353
+ var import_jsx_runtime18 = require("react/jsx-runtime");
7860
10354
  var ComponentTree = () => {
7861
- const [children, setChildren] = (0, import_react10.useState)("Loading");
10355
+ const [children, setChildren] = (0, import_react18.useState)("Loading");
7862
10356
  const { error, nodes } = useEmbed();
7863
- (0, import_react10.useEffect)(() => {
10357
+ (0, import_react18.useEffect)(() => {
7864
10358
  const renderer = createRenderer();
7865
10359
  setChildren(nodes.map(renderer));
7866
10360
  }, [nodes]);
7867
10361
  if (error) {
7868
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: error.message });
10362
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: error.message });
7869
10363
  }
7870
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children });
10364
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children });
7871
10365
  };
7872
10366
 
7873
10367
  // src/components/embed/Embed.tsx
7874
- var import_jsx_runtime14 = require("react/jsx-runtime");
7875
- var SchematicEmbed = ({ id, accessToken }) => {
10368
+ var import_jsx_runtime19 = require("react/jsx-runtime");
10369
+ var SchematicEmbed = ({ id, accessToken, apiConfig }) => {
7876
10370
  if (accessToken?.length === 0) {
7877
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: "Please provide an access token." });
10371
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: "Please provide an access token." });
7878
10372
  }
7879
10373
  if (!accessToken?.startsWith("token_")) {
7880
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
10374
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
7881
10375
  }
7882
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EmbedProvider, { id, accessToken, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ComponentTree, {}) });
10376
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ComponentTree, {}) });
7883
10377
  };
7884
10378
  /*! Bundled license information:
7885
10379