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