@schematichq/schematic-react 0.2.0-rc.0 → 0.2.0-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/schematic-react.cjs.js +1983 -605
- package/dist/schematic-react.d.ts +662 -63
- package/dist/schematic-react.esm.js +1982 -607
- package/package.json +9 -7
@@ -140,7 +140,7 @@ __export(src_exports, {
|
|
140
140
|
IconRound: () => IconRound,
|
141
141
|
IncludedFeatures: () => IncludedFeatures,
|
142
142
|
Invoices: () => Invoices,
|
143
|
-
|
143
|
+
MeteredFeatures: () => MeteredFeatures,
|
144
144
|
PaymentMethod: () => PaymentMethod,
|
145
145
|
PlanManager: () => PlanManager,
|
146
146
|
ProgressBar: () => ProgressBar,
|
@@ -148,6 +148,9 @@ __export(src_exports, {
|
|
148
148
|
SchematicEmbed: () => SchematicEmbed,
|
149
149
|
SchematicProvider: () => SchematicProvider,
|
150
150
|
Text: () => Text,
|
151
|
+
UpcomingBill: () => UpcomingBill,
|
152
|
+
defaultSettings: () => defaultSettings,
|
153
|
+
defaultTheme: () => defaultTheme,
|
151
154
|
useEmbed: () => useEmbed,
|
152
155
|
useSchematic: () => useSchematic,
|
153
156
|
useSchematicContext: () => useSchematicContext,
|
@@ -5906,6 +5909,107 @@ var JSONApiResponse = class {
|
|
5906
5909
|
}
|
5907
5910
|
};
|
5908
5911
|
|
5912
|
+
// src/api/models/BillingPlan.ts
|
5913
|
+
function BillingPlanFromJSON(json) {
|
5914
|
+
return BillingPlanFromJSONTyped(json, false);
|
5915
|
+
}
|
5916
|
+
function BillingPlanFromJSONTyped(json, ignoreDiscriminator) {
|
5917
|
+
if (json == null) {
|
5918
|
+
return json;
|
5919
|
+
}
|
5920
|
+
return {
|
5921
|
+
description: json["description"] == null ? void 0 : json["description"],
|
5922
|
+
id: json["id"],
|
5923
|
+
imageUrl: json["image_url"] == null ? void 0 : json["image_url"],
|
5924
|
+
name: json["name"],
|
5925
|
+
planPeriod: json["plan_period"] == null ? void 0 : json["plan_period"],
|
5926
|
+
planPrice: json["plan_price"] == null ? void 0 : json["plan_price"]
|
5927
|
+
};
|
5928
|
+
}
|
5929
|
+
|
5930
|
+
// src/api/models/BillingPriceResponseData.ts
|
5931
|
+
function BillingPriceResponseDataFromJSON(json) {
|
5932
|
+
return BillingPriceResponseDataFromJSONTyped(json, false);
|
5933
|
+
}
|
5934
|
+
function BillingPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
5935
|
+
if (json == null) {
|
5936
|
+
return json;
|
5937
|
+
}
|
5938
|
+
return {
|
5939
|
+
externalPriceId: json["external_price_id"],
|
5940
|
+
id: json["id"],
|
5941
|
+
interval: json["interval"],
|
5942
|
+
price: json["price"]
|
5943
|
+
};
|
5944
|
+
}
|
5945
|
+
|
5946
|
+
// src/api/models/BillingProductDetailResponseData.ts
|
5947
|
+
function BillingProductDetailResponseDataFromJSON(json) {
|
5948
|
+
return BillingProductDetailResponseDataFromJSONTyped(json, false);
|
5949
|
+
}
|
5950
|
+
function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
5951
|
+
if (json == null) {
|
5952
|
+
return json;
|
5953
|
+
}
|
5954
|
+
return {
|
5955
|
+
prices: json["Prices"].map(
|
5956
|
+
BillingPriceResponseDataFromJSON
|
5957
|
+
),
|
5958
|
+
accountId: json["account_id"],
|
5959
|
+
createdAt: new Date(json["created_at"]),
|
5960
|
+
currency: json["currency"],
|
5961
|
+
environmentId: json["environment_id"],
|
5962
|
+
externalId: json["external_id"],
|
5963
|
+
name: json["name"],
|
5964
|
+
price: json["price"],
|
5965
|
+
productId: json["product_id"],
|
5966
|
+
quantity: json["quantity"],
|
5967
|
+
updatedAt: new Date(json["updated_at"])
|
5968
|
+
};
|
5969
|
+
}
|
5970
|
+
|
5971
|
+
// src/api/models/BillingSubscriptionResponseData.ts
|
5972
|
+
function BillingSubscriptionResponseDataFromJSON(json) {
|
5973
|
+
return BillingSubscriptionResponseDataFromJSONTyped(json, false);
|
5974
|
+
}
|
5975
|
+
function BillingSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
5976
|
+
if (json == null) {
|
5977
|
+
return json;
|
5978
|
+
}
|
5979
|
+
return {
|
5980
|
+
expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
|
5981
|
+
externalId: json["external_id"],
|
5982
|
+
id: json["id"],
|
5983
|
+
updatedAt: new Date(json["updated_at"])
|
5984
|
+
};
|
5985
|
+
}
|
5986
|
+
|
5987
|
+
// src/api/models/ChangeSubscriptionRequestBody.ts
|
5988
|
+
function ChangeSubscriptionRequestBodyToJSON(value) {
|
5989
|
+
if (value == null) {
|
5990
|
+
return value;
|
5991
|
+
}
|
5992
|
+
return {
|
5993
|
+
action: value["action"],
|
5994
|
+
new_plan_id: value["newPlanId"],
|
5995
|
+
new_price_id: value["newPriceId"]
|
5996
|
+
};
|
5997
|
+
}
|
5998
|
+
|
5999
|
+
// src/api/models/CheckoutResponse.ts
|
6000
|
+
function CheckoutResponseFromJSON(json) {
|
6001
|
+
return CheckoutResponseFromJSONTyped(json, false);
|
6002
|
+
}
|
6003
|
+
function CheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
|
6004
|
+
if (json == null) {
|
6005
|
+
return json;
|
6006
|
+
}
|
6007
|
+
return {
|
6008
|
+
data: BillingSubscriptionResponseDataFromJSON(json["data"]),
|
6009
|
+
params: json["params"]
|
6010
|
+
};
|
6011
|
+
}
|
6012
|
+
|
5909
6013
|
// src/api/models/PreviewObject.ts
|
5910
6014
|
function PreviewObjectFromJSON(json) {
|
5911
6015
|
return PreviewObjectFromJSONTyped(json, false);
|
@@ -6008,7 +6112,7 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6008
6112
|
return json;
|
6009
6113
|
}
|
6010
6114
|
return {
|
6011
|
-
addOns: json["add_ons"].map(
|
6115
|
+
addOns: json["add_ons"].map(BillingPlanFromJSON),
|
6012
6116
|
createdAt: new Date(json["created_at"]),
|
6013
6117
|
entityTraits: json["entity_traits"].map(
|
6014
6118
|
EntityTraitDetailResponseDataFromJSON
|
@@ -6019,7 +6123,7 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6019
6123
|
lastSeenAt: json["last_seen_at"] == null ? void 0 : new Date(json["last_seen_at"]),
|
6020
6124
|
logoUrl: json["logo_url"] == null ? void 0 : json["logo_url"],
|
6021
6125
|
name: json["name"],
|
6022
|
-
plan: json["plan"] == null ? void 0 :
|
6126
|
+
plan: json["plan"] == null ? void 0 : BillingPlanFromJSON(json["plan"]),
|
6023
6127
|
plans: json["plans"].map(PreviewObjectFromJSON),
|
6024
6128
|
traits: json["traits"] == null ? void 0 : json["traits"],
|
6025
6129
|
updatedAt: new Date(json["updated_at"]),
|
@@ -6027,25 +6131,6 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6027
6131
|
};
|
6028
6132
|
}
|
6029
6133
|
|
6030
|
-
// src/api/models/ComponentResponseData.ts
|
6031
|
-
function ComponentResponseDataFromJSON(json) {
|
6032
|
-
return ComponentResponseDataFromJSONTyped(json, false);
|
6033
|
-
}
|
6034
|
-
function ComponentResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
6035
|
-
if (json == null) {
|
6036
|
-
return json;
|
6037
|
-
}
|
6038
|
-
return {
|
6039
|
-
ast: json["ast"],
|
6040
|
-
createdAt: new Date(json["created_at"]),
|
6041
|
-
id: json["id"],
|
6042
|
-
name: json["name"],
|
6043
|
-
state: json["state"],
|
6044
|
-
type: json["type"],
|
6045
|
-
updatedAt: new Date(json["updated_at"])
|
6046
|
-
};
|
6047
|
-
}
|
6048
|
-
|
6049
6134
|
// src/api/models/EventSummaryResponseData.ts
|
6050
6135
|
function EventSummaryResponseDataFromJSON(json) {
|
6051
6136
|
return EventSummaryResponseDataFromJSONTyped(json, false);
|
@@ -6247,13 +6332,91 @@ function PlanResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6247
6332
|
return json;
|
6248
6333
|
}
|
6249
6334
|
return {
|
6250
|
-
audienceType: json["audience_type"],
|
6335
|
+
audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
|
6336
|
+
createdAt: new Date(json["created_at"]),
|
6337
|
+
description: json["description"],
|
6338
|
+
icon: json["icon"],
|
6339
|
+
id: json["id"],
|
6340
|
+
name: json["name"],
|
6341
|
+
planType: json["plan_type"],
|
6342
|
+
updatedAt: new Date(json["updated_at"])
|
6343
|
+
};
|
6344
|
+
}
|
6345
|
+
|
6346
|
+
// src/api/models/PlanEntitlementResponseData.ts
|
6347
|
+
function PlanEntitlementResponseDataFromJSON(json) {
|
6348
|
+
return PlanEntitlementResponseDataFromJSONTyped(json, false);
|
6349
|
+
}
|
6350
|
+
function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
6351
|
+
if (json == null) {
|
6352
|
+
return json;
|
6353
|
+
}
|
6354
|
+
return {
|
6355
|
+
createdAt: new Date(json["created_at"]),
|
6356
|
+
environmentId: json["environment_id"],
|
6357
|
+
feature: json["feature"] == null ? void 0 : FeatureResponseDataFromJSON(json["feature"]),
|
6358
|
+
featureId: json["feature_id"],
|
6359
|
+
id: json["id"],
|
6360
|
+
metricPeriod: json["metric_period"] == null ? void 0 : json["metric_period"],
|
6361
|
+
plan: json["plan"] == null ? void 0 : PlanResponseDataFromJSON(json["plan"]),
|
6362
|
+
planId: json["plan_id"],
|
6363
|
+
ruleId: json["rule_id"],
|
6364
|
+
updatedAt: new Date(json["updated_at"]),
|
6365
|
+
valueBool: json["value_bool"] == null ? void 0 : json["value_bool"],
|
6366
|
+
valueNumeric: json["value_numeric"] == null ? void 0 : json["value_numeric"],
|
6367
|
+
valueTrait: json["value_trait"] == null ? void 0 : EntityTraitDefinitionResponseDataFromJSON(json["value_trait"]),
|
6368
|
+
valueTraitId: json["value_trait_id"] == null ? void 0 : json["value_trait_id"],
|
6369
|
+
valueType: json["value_type"]
|
6370
|
+
};
|
6371
|
+
}
|
6372
|
+
|
6373
|
+
// src/api/models/CompanyPlanDetailResponseData.ts
|
6374
|
+
function CompanyPlanDetailResponseDataFromJSON(json) {
|
6375
|
+
return CompanyPlanDetailResponseDataFromJSONTyped(json, false);
|
6376
|
+
}
|
6377
|
+
function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
6378
|
+
if (json == null) {
|
6379
|
+
return json;
|
6380
|
+
}
|
6381
|
+
return {
|
6382
|
+
audienceType: json["audience_type"] == null ? void 0 : json["audience_type"],
|
6383
|
+
billingProduct: json["billing_product"] == null ? void 0 : BillingProductDetailResponseDataFromJSON(json["billing_product"]),
|
6384
|
+
companyCount: json["company_count"],
|
6251
6385
|
createdAt: new Date(json["created_at"]),
|
6386
|
+
current: json["current"],
|
6252
6387
|
description: json["description"],
|
6388
|
+
entitlements: json["entitlements"].map(
|
6389
|
+
PlanEntitlementResponseDataFromJSON
|
6390
|
+
),
|
6391
|
+
features: json["features"].map(
|
6392
|
+
FeatureDetailResponseDataFromJSON
|
6393
|
+
),
|
6253
6394
|
icon: json["icon"],
|
6254
6395
|
id: json["id"],
|
6396
|
+
monthlyPrice: json["monthly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["monthly_price"]),
|
6255
6397
|
name: json["name"],
|
6256
6398
|
planType: json["plan_type"],
|
6399
|
+
updatedAt: new Date(json["updated_at"]),
|
6400
|
+
valid: json["valid"],
|
6401
|
+
yearlyPrice: json["yearly_price"] == null ? void 0 : BillingPriceResponseDataFromJSON(json["yearly_price"])
|
6402
|
+
};
|
6403
|
+
}
|
6404
|
+
|
6405
|
+
// src/api/models/ComponentResponseData.ts
|
6406
|
+
function ComponentResponseDataFromJSON(json) {
|
6407
|
+
return ComponentResponseDataFromJSONTyped(json, false);
|
6408
|
+
}
|
6409
|
+
function ComponentResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
6410
|
+
if (json == null) {
|
6411
|
+
return json;
|
6412
|
+
}
|
6413
|
+
return {
|
6414
|
+
ast: json["ast"] == null ? void 0 : json["ast"],
|
6415
|
+
createdAt: new Date(json["created_at"]),
|
6416
|
+
id: json["id"],
|
6417
|
+
name: json["name"],
|
6418
|
+
state: json["state"],
|
6419
|
+
type: json["type"],
|
6257
6420
|
updatedAt: new Date(json["updated_at"])
|
6258
6421
|
};
|
6259
6422
|
}
|
@@ -6294,6 +6457,20 @@ function FeatureUsageDetailResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
6294
6457
|
};
|
6295
6458
|
}
|
6296
6459
|
|
6460
|
+
// src/api/models/StripeEmbedInfo.ts
|
6461
|
+
function StripeEmbedInfoFromJSON(json) {
|
6462
|
+
return StripeEmbedInfoFromJSONTyped(json, false);
|
6463
|
+
}
|
6464
|
+
function StripeEmbedInfoFromJSONTyped(json, ignoreDiscriminator) {
|
6465
|
+
if (json == null) {
|
6466
|
+
return json;
|
6467
|
+
}
|
6468
|
+
return {
|
6469
|
+
customerEkey: json["customer_ekey"],
|
6470
|
+
publishableKey: json["publishable_key"]
|
6471
|
+
};
|
6472
|
+
}
|
6473
|
+
|
6297
6474
|
// src/api/models/ComponentHydrateResponseData.ts
|
6298
6475
|
function ComponentHydrateResponseDataFromJSON(json) {
|
6299
6476
|
return ComponentHydrateResponseDataFromJSONTyped(json, false);
|
@@ -6303,9 +6480,13 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6303
6480
|
return json;
|
6304
6481
|
}
|
6305
6482
|
return {
|
6483
|
+
activePlans: json["active_plans"].map(
|
6484
|
+
CompanyPlanDetailResponseDataFromJSON
|
6485
|
+
),
|
6306
6486
|
company: json["company"] == null ? void 0 : CompanyDetailResponseDataFromJSON(json["company"]),
|
6307
6487
|
component: json["component"] == null ? void 0 : ComponentResponseDataFromJSON(json["component"]),
|
6308
|
-
featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"])
|
6488
|
+
featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"]),
|
6489
|
+
stripeEmbed: json["stripe_embed"] == null ? void 0 : StripeEmbedInfoFromJSON(json["stripe_embed"])
|
6309
6490
|
};
|
6310
6491
|
}
|
6311
6492
|
|
@@ -6323,8 +6504,50 @@ function HydrateComponentResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
6323
6504
|
};
|
6324
6505
|
}
|
6325
6506
|
|
6326
|
-
// src/api/apis/
|
6327
|
-
var
|
6507
|
+
// src/api/apis/CheckoutApi.ts
|
6508
|
+
var CheckoutApi = class extends BaseAPI {
|
6509
|
+
/**
|
6510
|
+
* Checkout
|
6511
|
+
*/
|
6512
|
+
async checkoutRaw(requestParameters, initOverrides) {
|
6513
|
+
if (requestParameters["changeSubscriptionRequestBody"] == null) {
|
6514
|
+
throw new RequiredError(
|
6515
|
+
"changeSubscriptionRequestBody",
|
6516
|
+
'Required parameter "changeSubscriptionRequestBody" was null or undefined when calling checkout().'
|
6517
|
+
);
|
6518
|
+
}
|
6519
|
+
const queryParameters = {};
|
6520
|
+
const headerParameters = {};
|
6521
|
+
headerParameters["Content-Type"] = "application/json";
|
6522
|
+
if (this.configuration && this.configuration.apiKey) {
|
6523
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
6524
|
+
"X-Schematic-Api-Key"
|
6525
|
+
);
|
6526
|
+
}
|
6527
|
+
const response = await this.request(
|
6528
|
+
{
|
6529
|
+
path: `/checkout`,
|
6530
|
+
method: "POST",
|
6531
|
+
headers: headerParameters,
|
6532
|
+
query: queryParameters,
|
6533
|
+
body: ChangeSubscriptionRequestBodyToJSON(
|
6534
|
+
requestParameters["changeSubscriptionRequestBody"]
|
6535
|
+
)
|
6536
|
+
},
|
6537
|
+
initOverrides
|
6538
|
+
);
|
6539
|
+
return new JSONApiResponse(
|
6540
|
+
response,
|
6541
|
+
(jsonValue) => CheckoutResponseFromJSON(jsonValue)
|
6542
|
+
);
|
6543
|
+
}
|
6544
|
+
/**
|
6545
|
+
* Checkout
|
6546
|
+
*/
|
6547
|
+
async checkout(requestParameters, initOverrides) {
|
6548
|
+
const response = await this.checkoutRaw(requestParameters, initOverrides);
|
6549
|
+
return await response.value();
|
6550
|
+
}
|
6328
6551
|
/**
|
6329
6552
|
* Hydrate component
|
6330
6553
|
*/
|
@@ -6371,30 +6594,73 @@ var ComponentsApi = class extends BaseAPI {
|
|
6371
6594
|
}
|
6372
6595
|
};
|
6373
6596
|
|
6374
|
-
// src/components/theme.ts
|
6375
|
-
var light = {
|
6376
|
-
text: "#000000",
|
6377
|
-
textDetail: "#767676",
|
6378
|
-
background: "#FFFFFF",
|
6379
|
-
button: "#000000"
|
6380
|
-
};
|
6381
|
-
var dark = {
|
6382
|
-
text: "#FFFFFF",
|
6383
|
-
textDetail: "#A5A5A5",
|
6384
|
-
background: "#000000",
|
6385
|
-
button: "#194BFB"
|
6386
|
-
};
|
6387
|
-
|
6388
6597
|
// src/context/embed.tsx
|
6389
6598
|
var import_jsx_runtime = require("react/jsx-runtime");
|
6390
|
-
var
|
6391
|
-
|
6599
|
+
var defaultTheme = {
|
6600
|
+
numberOfColumns: 2,
|
6392
6601
|
sectionLayout: "merged",
|
6393
|
-
|
6394
|
-
|
6395
|
-
|
6396
|
-
|
6397
|
-
|
6602
|
+
colorMode: "light",
|
6603
|
+
primary: "#000000",
|
6604
|
+
secondary: "#000000",
|
6605
|
+
card: {
|
6606
|
+
background: "#FFFFFF",
|
6607
|
+
borderRadius: 10,
|
6608
|
+
hasShadow: true,
|
6609
|
+
padding: 45
|
6610
|
+
},
|
6611
|
+
typography: {
|
6612
|
+
heading1: {
|
6613
|
+
fontFamily: "Manrope",
|
6614
|
+
fontSize: 37,
|
6615
|
+
fontWeight: 800,
|
6616
|
+
color: "#000000"
|
6617
|
+
},
|
6618
|
+
heading2: {
|
6619
|
+
fontFamily: "Manrope",
|
6620
|
+
fontSize: 29,
|
6621
|
+
fontWeight: 800,
|
6622
|
+
color: "#000000"
|
6623
|
+
},
|
6624
|
+
heading3: {
|
6625
|
+
fontFamily: "Manrope",
|
6626
|
+
fontSize: 20,
|
6627
|
+
fontWeight: 600,
|
6628
|
+
color: "#000000"
|
6629
|
+
},
|
6630
|
+
heading4: {
|
6631
|
+
fontFamily: "Manrope",
|
6632
|
+
fontSize: 18,
|
6633
|
+
fontWeight: 800,
|
6634
|
+
color: "#000000"
|
6635
|
+
},
|
6636
|
+
heading5: {
|
6637
|
+
fontFamily: "Public Sans",
|
6638
|
+
fontSize: 17,
|
6639
|
+
fontWeight: 500,
|
6640
|
+
color: "#000000"
|
6641
|
+
},
|
6642
|
+
heading6: {
|
6643
|
+
fontFamily: "Public Sans",
|
6644
|
+
fontSize: 14,
|
6645
|
+
fontWeight: 400,
|
6646
|
+
color: "#8A8A8A"
|
6647
|
+
},
|
6648
|
+
text: {
|
6649
|
+
fontFamily: "Public Sans",
|
6650
|
+
fontSize: 16,
|
6651
|
+
fontWeight: 400,
|
6652
|
+
color: "#000000"
|
6653
|
+
},
|
6654
|
+
link: {
|
6655
|
+
fontFamily: "Inter",
|
6656
|
+
fontSize: 16,
|
6657
|
+
fontWeight: 400,
|
6658
|
+
color: "#194BFB"
|
6659
|
+
}
|
6660
|
+
}
|
6661
|
+
};
|
6662
|
+
var defaultSettings = {
|
6663
|
+
theme: defaultTheme
|
6398
6664
|
};
|
6399
6665
|
function isEditorState(obj) {
|
6400
6666
|
return Object.entries(obj).every(([key, value]) => {
|
@@ -6421,11 +6687,11 @@ function parseEditorState(data) {
|
|
6421
6687
|
});
|
6422
6688
|
return arr;
|
6423
6689
|
}
|
6424
|
-
async function fetchComponent(id, accessToken) {
|
6690
|
+
async function fetchComponent(id, accessToken, options) {
|
6425
6691
|
const settings = { ...defaultSettings };
|
6426
6692
|
const nodes = [];
|
6427
|
-
const config = new Configuration({ apiKey: accessToken });
|
6428
|
-
const api = new
|
6693
|
+
const config = new Configuration({ ...options, apiKey: accessToken });
|
6694
|
+
const api = new CheckoutApi(config);
|
6429
6695
|
const response = await api.hydrateComponent({ componentId: id });
|
6430
6696
|
const { data } = response;
|
6431
6697
|
if (data.component?.ast) {
|
@@ -6433,7 +6699,7 @@ async function fetchComponent(id, accessToken) {
|
|
6433
6699
|
const json = inflate_1(Uint8Array.from(Object.values(compressed)), {
|
6434
6700
|
to: "string"
|
6435
6701
|
});
|
6436
|
-
const ast = getEditorState(json);
|
6702
|
+
const ast = getEditorState(JSON.stringify(json));
|
6437
6703
|
if (ast) {
|
6438
6704
|
Object.assign(settings, ast.ROOT.props);
|
6439
6705
|
nodes.push(...parseEditorState(ast));
|
@@ -6448,61 +6714,92 @@ async function fetchComponent(id, accessToken) {
|
|
6448
6714
|
var EmbedContext = (0, import_react2.createContext)({
|
6449
6715
|
data: {},
|
6450
6716
|
nodes: [],
|
6451
|
-
settings: {},
|
6717
|
+
settings: { ...defaultSettings },
|
6718
|
+
layout: "portal",
|
6719
|
+
error: void 0,
|
6452
6720
|
setData: () => {
|
6453
6721
|
},
|
6454
|
-
setSettings: () => {
|
6455
|
-
},
|
6456
6722
|
updateSettings: () => {
|
6723
|
+
},
|
6724
|
+
setLayout: () => {
|
6457
6725
|
}
|
6458
6726
|
});
|
6459
6727
|
var EmbedProvider = ({
|
6460
6728
|
id,
|
6461
6729
|
accessToken,
|
6730
|
+
apiConfig,
|
6462
6731
|
children
|
6463
6732
|
}) => {
|
6464
|
-
const
|
6465
|
-
|
6466
|
-
|
6467
|
-
|
6468
|
-
|
6469
|
-
|
6470
|
-
|
6471
|
-
|
6472
|
-
|
6473
|
-
|
6733
|
+
const styleRef = (0, import_react2.useRef)(null);
|
6734
|
+
const [state, setState] = (0, import_react2.useState)(() => {
|
6735
|
+
return {
|
6736
|
+
data: {},
|
6737
|
+
nodes: [],
|
6738
|
+
settings: { ...defaultSettings },
|
6739
|
+
layout: "portal",
|
6740
|
+
error: void 0,
|
6741
|
+
setData: () => {
|
6742
|
+
},
|
6743
|
+
updateSettings: () => {
|
6744
|
+
},
|
6745
|
+
setLayout: () => {
|
6746
|
+
}
|
6747
|
+
};
|
6474
6748
|
});
|
6749
|
+
(0, import_react2.useEffect)(() => {
|
6750
|
+
const element = document.getElementById("schematic-fonts");
|
6751
|
+
if (element) {
|
6752
|
+
return void (styleRef.current = element);
|
6753
|
+
}
|
6754
|
+
const style = document.createElement("link");
|
6755
|
+
style.id = "schematic-fonts";
|
6756
|
+
style.rel = "stylesheet";
|
6757
|
+
document.head.appendChild(style);
|
6758
|
+
styleRef.current = style;
|
6759
|
+
}, []);
|
6475
6760
|
(0, import_react2.useEffect)(() => {
|
6476
6761
|
if (!id || !accessToken) {
|
6477
6762
|
return;
|
6478
6763
|
}
|
6479
|
-
fetchComponent(id, accessToken).then((resolvedData) => {
|
6764
|
+
fetchComponent(id, accessToken, apiConfig).then((resolvedData) => {
|
6480
6765
|
setState((prev2) => ({ ...prev2, ...resolvedData }));
|
6481
6766
|
}).catch((error) => setState((prev2) => ({ ...prev2, error })));
|
6482
|
-
}, [id, accessToken]);
|
6767
|
+
}, [id, accessToken, apiConfig]);
|
6768
|
+
(0, import_react2.useEffect)(() => {
|
6769
|
+
const fontSet = /* @__PURE__ */ new Set([]);
|
6770
|
+
Object.values(state.settings.theme.typography).forEach(({ fontFamily }) => {
|
6771
|
+
fontSet.add(fontFamily);
|
6772
|
+
});
|
6773
|
+
if (fontSet.size > 0) {
|
6774
|
+
const src = `https://fonts.googleapis.com/css2?${[...fontSet].map((fontFamily) => `family=${fontFamily}&display=swap`).join("&")}`;
|
6775
|
+
if (styleRef.current) {
|
6776
|
+
styleRef.current.href = src;
|
6777
|
+
}
|
6778
|
+
}
|
6779
|
+
}, [state.settings.theme.typography]);
|
6483
6780
|
const setData = (0, import_react2.useCallback)(
|
6484
6781
|
(data) => {
|
6485
6782
|
setState((prev2) => ({
|
6486
6783
|
...prev2,
|
6487
|
-
data
|
6784
|
+
data: Object.assign({}, data)
|
6488
6785
|
}));
|
6489
6786
|
},
|
6490
6787
|
[setState]
|
6491
6788
|
);
|
6492
|
-
const
|
6789
|
+
const updateSettings = (0, import_react2.useCallback)(
|
6493
6790
|
(settings) => {
|
6494
6791
|
setState((prev2) => ({
|
6495
6792
|
...prev2,
|
6496
|
-
settings
|
6793
|
+
settings: Object.assign({}, prev2.settings, settings)
|
6497
6794
|
}));
|
6498
6795
|
},
|
6499
6796
|
[setState]
|
6500
6797
|
);
|
6501
|
-
const
|
6502
|
-
(
|
6798
|
+
const setLayout = (0, import_react2.useCallback)(
|
6799
|
+
(layout) => {
|
6503
6800
|
setState((prev2) => ({
|
6504
6801
|
...prev2,
|
6505
|
-
|
6802
|
+
layout
|
6506
6803
|
}));
|
6507
6804
|
},
|
6508
6805
|
[setState]
|
@@ -6514,75 +6811,602 @@ var EmbedProvider = ({
|
|
6514
6811
|
data: state.data,
|
6515
6812
|
nodes: state.nodes,
|
6516
6813
|
settings: state.settings,
|
6814
|
+
layout: state.layout,
|
6517
6815
|
error: state.error,
|
6518
6816
|
setData,
|
6519
|
-
|
6520
|
-
|
6817
|
+
updateSettings,
|
6818
|
+
setLayout
|
6521
6819
|
},
|
6522
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ot, { theme: state.settings.theme
|
6820
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ot, { theme: state.settings.theme, children })
|
6523
6821
|
}
|
6524
6822
|
);
|
6525
6823
|
};
|
6526
6824
|
|
6527
6825
|
// node_modules/@schematichq/schematic-js/dist/schematic.esm.js
|
6528
|
-
var
|
6529
|
-
var
|
6530
|
-
|
6531
|
-
|
6532
|
-
|
6533
|
-
|
6534
|
-
|
6535
|
-
|
6826
|
+
var __create2 = Object.create;
|
6827
|
+
var __defProp2 = Object.defineProperty;
|
6828
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
6829
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
6830
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
6831
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
6832
|
+
var __commonJS2 = (cb, mod) => function __require() {
|
6833
|
+
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
6834
|
+
};
|
6835
|
+
var __copyProps2 = (to, from2, except, desc) => {
|
6836
|
+
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
|
6837
|
+
for (let key of __getOwnPropNames2(from2))
|
6838
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
6839
|
+
__defProp2(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc2(from2, key)) || desc.enumerable });
|
6536
6840
|
}
|
6537
|
-
return
|
6538
|
-
}
|
6539
|
-
var byteToHex = [];
|
6540
|
-
for (let i2 = 0; i2 < 256; ++i2) {
|
6541
|
-
byteToHex.push((i2 + 256).toString(16).slice(1));
|
6542
|
-
}
|
6543
|
-
function unsafeStringify(arr, offset = 0) {
|
6544
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
6545
|
-
}
|
6546
|
-
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
6547
|
-
var native_default = {
|
6548
|
-
randomUUID
|
6841
|
+
return to;
|
6549
6842
|
};
|
6550
|
-
|
6551
|
-
|
6552
|
-
|
6553
|
-
|
6554
|
-
|
6555
|
-
|
6556
|
-
|
6557
|
-
|
6558
|
-
|
6559
|
-
|
6560
|
-
|
6561
|
-
|
6562
|
-
|
6563
|
-
|
6564
|
-
|
6565
|
-
|
6566
|
-
|
6567
|
-
|
6568
|
-
|
6569
|
-
|
6570
|
-
|
6571
|
-
|
6572
|
-
|
6573
|
-
|
6574
|
-
|
6575
|
-
|
6576
|
-
|
6577
|
-
|
6578
|
-
|
6579
|
-
|
6580
|
-
|
6581
|
-
|
6582
|
-
|
6583
|
-
|
6584
|
-
|
6585
|
-
|
6843
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
6844
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
6845
|
+
// file that has been converted to a CommonJS file using a Babel-
|
6846
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
6847
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
6848
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
6849
|
+
mod
|
6850
|
+
));
|
6851
|
+
var require_browser_polyfill = __commonJS2({
|
6852
|
+
"node_modules/cross-fetch/dist/browser-polyfill.js"(exports) {
|
6853
|
+
(function(self2) {
|
6854
|
+
var irrelevant = function(exports2) {
|
6855
|
+
var global = typeof globalThis !== "undefined" && globalThis || typeof self2 !== "undefined" && self2 || typeof global !== "undefined" && global;
|
6856
|
+
var support = {
|
6857
|
+
searchParams: "URLSearchParams" in global,
|
6858
|
+
iterable: "Symbol" in global && "iterator" in Symbol,
|
6859
|
+
blob: "FileReader" in global && "Blob" in global && function() {
|
6860
|
+
try {
|
6861
|
+
new Blob();
|
6862
|
+
return true;
|
6863
|
+
} catch (e) {
|
6864
|
+
return false;
|
6865
|
+
}
|
6866
|
+
}(),
|
6867
|
+
formData: "FormData" in global,
|
6868
|
+
arrayBuffer: "ArrayBuffer" in global
|
6869
|
+
};
|
6870
|
+
function isDataView(obj) {
|
6871
|
+
return obj && DataView.prototype.isPrototypeOf(obj);
|
6872
|
+
}
|
6873
|
+
if (support.arrayBuffer) {
|
6874
|
+
var viewClasses = [
|
6875
|
+
"[object Int8Array]",
|
6876
|
+
"[object Uint8Array]",
|
6877
|
+
"[object Uint8ClampedArray]",
|
6878
|
+
"[object Int16Array]",
|
6879
|
+
"[object Uint16Array]",
|
6880
|
+
"[object Int32Array]",
|
6881
|
+
"[object Uint32Array]",
|
6882
|
+
"[object Float32Array]",
|
6883
|
+
"[object Float64Array]"
|
6884
|
+
];
|
6885
|
+
var isArrayBufferView = ArrayBuffer.isView || function(obj) {
|
6886
|
+
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
|
6887
|
+
};
|
6888
|
+
}
|
6889
|
+
function normalizeName(name) {
|
6890
|
+
if (typeof name !== "string") {
|
6891
|
+
name = String(name);
|
6892
|
+
}
|
6893
|
+
if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
|
6894
|
+
throw new TypeError('Invalid character in header field name: "' + name + '"');
|
6895
|
+
}
|
6896
|
+
return name.toLowerCase();
|
6897
|
+
}
|
6898
|
+
function normalizeValue(value) {
|
6899
|
+
if (typeof value !== "string") {
|
6900
|
+
value = String(value);
|
6901
|
+
}
|
6902
|
+
return value;
|
6903
|
+
}
|
6904
|
+
function iteratorFor(items) {
|
6905
|
+
var iterator = {
|
6906
|
+
next: function() {
|
6907
|
+
var value = items.shift();
|
6908
|
+
return { done: value === void 0, value };
|
6909
|
+
}
|
6910
|
+
};
|
6911
|
+
if (support.iterable) {
|
6912
|
+
iterator[Symbol.iterator] = function() {
|
6913
|
+
return iterator;
|
6914
|
+
};
|
6915
|
+
}
|
6916
|
+
return iterator;
|
6917
|
+
}
|
6918
|
+
function Headers(headers) {
|
6919
|
+
this.map = {};
|
6920
|
+
if (headers instanceof Headers) {
|
6921
|
+
headers.forEach(function(value, name) {
|
6922
|
+
this.append(name, value);
|
6923
|
+
}, this);
|
6924
|
+
} else if (Array.isArray(headers)) {
|
6925
|
+
headers.forEach(function(header) {
|
6926
|
+
this.append(header[0], header[1]);
|
6927
|
+
}, this);
|
6928
|
+
} else if (headers) {
|
6929
|
+
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
6930
|
+
this.append(name, headers[name]);
|
6931
|
+
}, this);
|
6932
|
+
}
|
6933
|
+
}
|
6934
|
+
Headers.prototype.append = function(name, value) {
|
6935
|
+
name = normalizeName(name);
|
6936
|
+
value = normalizeValue(value);
|
6937
|
+
var oldValue = this.map[name];
|
6938
|
+
this.map[name] = oldValue ? oldValue + ", " + value : value;
|
6939
|
+
};
|
6940
|
+
Headers.prototype["delete"] = function(name) {
|
6941
|
+
delete this.map[normalizeName(name)];
|
6942
|
+
};
|
6943
|
+
Headers.prototype.get = function(name) {
|
6944
|
+
name = normalizeName(name);
|
6945
|
+
return this.has(name) ? this.map[name] : null;
|
6946
|
+
};
|
6947
|
+
Headers.prototype.has = function(name) {
|
6948
|
+
return this.map.hasOwnProperty(normalizeName(name));
|
6949
|
+
};
|
6950
|
+
Headers.prototype.set = function(name, value) {
|
6951
|
+
this.map[normalizeName(name)] = normalizeValue(value);
|
6952
|
+
};
|
6953
|
+
Headers.prototype.forEach = function(callback, thisArg) {
|
6954
|
+
for (var name in this.map) {
|
6955
|
+
if (this.map.hasOwnProperty(name)) {
|
6956
|
+
callback.call(thisArg, this.map[name], name, this);
|
6957
|
+
}
|
6958
|
+
}
|
6959
|
+
};
|
6960
|
+
Headers.prototype.keys = function() {
|
6961
|
+
var items = [];
|
6962
|
+
this.forEach(function(value, name) {
|
6963
|
+
items.push(name);
|
6964
|
+
});
|
6965
|
+
return iteratorFor(items);
|
6966
|
+
};
|
6967
|
+
Headers.prototype.values = function() {
|
6968
|
+
var items = [];
|
6969
|
+
this.forEach(function(value) {
|
6970
|
+
items.push(value);
|
6971
|
+
});
|
6972
|
+
return iteratorFor(items);
|
6973
|
+
};
|
6974
|
+
Headers.prototype.entries = function() {
|
6975
|
+
var items = [];
|
6976
|
+
this.forEach(function(value, name) {
|
6977
|
+
items.push([name, value]);
|
6978
|
+
});
|
6979
|
+
return iteratorFor(items);
|
6980
|
+
};
|
6981
|
+
if (support.iterable) {
|
6982
|
+
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
6983
|
+
}
|
6984
|
+
function consumed(body) {
|
6985
|
+
if (body.bodyUsed) {
|
6986
|
+
return Promise.reject(new TypeError("Already read"));
|
6987
|
+
}
|
6988
|
+
body.bodyUsed = true;
|
6989
|
+
}
|
6990
|
+
function fileReaderReady(reader) {
|
6991
|
+
return new Promise(function(resolve, reject) {
|
6992
|
+
reader.onload = function() {
|
6993
|
+
resolve(reader.result);
|
6994
|
+
};
|
6995
|
+
reader.onerror = function() {
|
6996
|
+
reject(reader.error);
|
6997
|
+
};
|
6998
|
+
});
|
6999
|
+
}
|
7000
|
+
function readBlobAsArrayBuffer(blob) {
|
7001
|
+
var reader = new FileReader();
|
7002
|
+
var promise = fileReaderReady(reader);
|
7003
|
+
reader.readAsArrayBuffer(blob);
|
7004
|
+
return promise;
|
7005
|
+
}
|
7006
|
+
function readBlobAsText(blob) {
|
7007
|
+
var reader = new FileReader();
|
7008
|
+
var promise = fileReaderReady(reader);
|
7009
|
+
reader.readAsText(blob);
|
7010
|
+
return promise;
|
7011
|
+
}
|
7012
|
+
function readArrayBufferAsText(buf) {
|
7013
|
+
var view = new Uint8Array(buf);
|
7014
|
+
var chars = new Array(view.length);
|
7015
|
+
for (var i2 = 0; i2 < view.length; i2++) {
|
7016
|
+
chars[i2] = String.fromCharCode(view[i2]);
|
7017
|
+
}
|
7018
|
+
return chars.join("");
|
7019
|
+
}
|
7020
|
+
function bufferClone(buf) {
|
7021
|
+
if (buf.slice) {
|
7022
|
+
return buf.slice(0);
|
7023
|
+
} else {
|
7024
|
+
var view = new Uint8Array(buf.byteLength);
|
7025
|
+
view.set(new Uint8Array(buf));
|
7026
|
+
return view.buffer;
|
7027
|
+
}
|
7028
|
+
}
|
7029
|
+
function Body() {
|
7030
|
+
this.bodyUsed = false;
|
7031
|
+
this._initBody = function(body) {
|
7032
|
+
this.bodyUsed = this.bodyUsed;
|
7033
|
+
this._bodyInit = body;
|
7034
|
+
if (!body) {
|
7035
|
+
this._bodyText = "";
|
7036
|
+
} else if (typeof body === "string") {
|
7037
|
+
this._bodyText = body;
|
7038
|
+
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
7039
|
+
this._bodyBlob = body;
|
7040
|
+
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
7041
|
+
this._bodyFormData = body;
|
7042
|
+
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
7043
|
+
this._bodyText = body.toString();
|
7044
|
+
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
7045
|
+
this._bodyArrayBuffer = bufferClone(body.buffer);
|
7046
|
+
this._bodyInit = new Blob([this._bodyArrayBuffer]);
|
7047
|
+
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
7048
|
+
this._bodyArrayBuffer = bufferClone(body);
|
7049
|
+
} else {
|
7050
|
+
this._bodyText = body = Object.prototype.toString.call(body);
|
7051
|
+
}
|
7052
|
+
if (!this.headers.get("content-type")) {
|
7053
|
+
if (typeof body === "string") {
|
7054
|
+
this.headers.set("content-type", "text/plain;charset=UTF-8");
|
7055
|
+
} else if (this._bodyBlob && this._bodyBlob.type) {
|
7056
|
+
this.headers.set("content-type", this._bodyBlob.type);
|
7057
|
+
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
7058
|
+
this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
|
7059
|
+
}
|
7060
|
+
}
|
7061
|
+
};
|
7062
|
+
if (support.blob) {
|
7063
|
+
this.blob = function() {
|
7064
|
+
var rejected = consumed(this);
|
7065
|
+
if (rejected) {
|
7066
|
+
return rejected;
|
7067
|
+
}
|
7068
|
+
if (this._bodyBlob) {
|
7069
|
+
return Promise.resolve(this._bodyBlob);
|
7070
|
+
} else if (this._bodyArrayBuffer) {
|
7071
|
+
return Promise.resolve(new Blob([this._bodyArrayBuffer]));
|
7072
|
+
} else if (this._bodyFormData) {
|
7073
|
+
throw new Error("could not read FormData body as blob");
|
7074
|
+
} else {
|
7075
|
+
return Promise.resolve(new Blob([this._bodyText]));
|
7076
|
+
}
|
7077
|
+
};
|
7078
|
+
this.arrayBuffer = function() {
|
7079
|
+
if (this._bodyArrayBuffer) {
|
7080
|
+
var isConsumed = consumed(this);
|
7081
|
+
if (isConsumed) {
|
7082
|
+
return isConsumed;
|
7083
|
+
}
|
7084
|
+
if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
7085
|
+
return Promise.resolve(
|
7086
|
+
this._bodyArrayBuffer.buffer.slice(
|
7087
|
+
this._bodyArrayBuffer.byteOffset,
|
7088
|
+
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
7089
|
+
)
|
7090
|
+
);
|
7091
|
+
} else {
|
7092
|
+
return Promise.resolve(this._bodyArrayBuffer);
|
7093
|
+
}
|
7094
|
+
} else {
|
7095
|
+
return this.blob().then(readBlobAsArrayBuffer);
|
7096
|
+
}
|
7097
|
+
};
|
7098
|
+
}
|
7099
|
+
this.text = function() {
|
7100
|
+
var rejected = consumed(this);
|
7101
|
+
if (rejected) {
|
7102
|
+
return rejected;
|
7103
|
+
}
|
7104
|
+
if (this._bodyBlob) {
|
7105
|
+
return readBlobAsText(this._bodyBlob);
|
7106
|
+
} else if (this._bodyArrayBuffer) {
|
7107
|
+
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
|
7108
|
+
} else if (this._bodyFormData) {
|
7109
|
+
throw new Error("could not read FormData body as text");
|
7110
|
+
} else {
|
7111
|
+
return Promise.resolve(this._bodyText);
|
7112
|
+
}
|
7113
|
+
};
|
7114
|
+
if (support.formData) {
|
7115
|
+
this.formData = function() {
|
7116
|
+
return this.text().then(decode);
|
7117
|
+
};
|
7118
|
+
}
|
7119
|
+
this.json = function() {
|
7120
|
+
return this.text().then(JSON.parse);
|
7121
|
+
};
|
7122
|
+
return this;
|
7123
|
+
}
|
7124
|
+
var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
7125
|
+
function normalizeMethod(method) {
|
7126
|
+
var upcased = method.toUpperCase();
|
7127
|
+
return methods.indexOf(upcased) > -1 ? upcased : method;
|
7128
|
+
}
|
7129
|
+
function Request(input, options) {
|
7130
|
+
if (!(this instanceof Request)) {
|
7131
|
+
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
|
7132
|
+
}
|
7133
|
+
options = options || {};
|
7134
|
+
var body = options.body;
|
7135
|
+
if (input instanceof Request) {
|
7136
|
+
if (input.bodyUsed) {
|
7137
|
+
throw new TypeError("Already read");
|
7138
|
+
}
|
7139
|
+
this.url = input.url;
|
7140
|
+
this.credentials = input.credentials;
|
7141
|
+
if (!options.headers) {
|
7142
|
+
this.headers = new Headers(input.headers);
|
7143
|
+
}
|
7144
|
+
this.method = input.method;
|
7145
|
+
this.mode = input.mode;
|
7146
|
+
this.signal = input.signal;
|
7147
|
+
if (!body && input._bodyInit != null) {
|
7148
|
+
body = input._bodyInit;
|
7149
|
+
input.bodyUsed = true;
|
7150
|
+
}
|
7151
|
+
} else {
|
7152
|
+
this.url = String(input);
|
7153
|
+
}
|
7154
|
+
this.credentials = options.credentials || this.credentials || "same-origin";
|
7155
|
+
if (options.headers || !this.headers) {
|
7156
|
+
this.headers = new Headers(options.headers);
|
7157
|
+
}
|
7158
|
+
this.method = normalizeMethod(options.method || this.method || "GET");
|
7159
|
+
this.mode = options.mode || this.mode || null;
|
7160
|
+
this.signal = options.signal || this.signal;
|
7161
|
+
this.referrer = null;
|
7162
|
+
if ((this.method === "GET" || this.method === "HEAD") && body) {
|
7163
|
+
throw new TypeError("Body not allowed for GET or HEAD requests");
|
7164
|
+
}
|
7165
|
+
this._initBody(body);
|
7166
|
+
if (this.method === "GET" || this.method === "HEAD") {
|
7167
|
+
if (options.cache === "no-store" || options.cache === "no-cache") {
|
7168
|
+
var reParamSearch = /([?&])_=[^&]*/;
|
7169
|
+
if (reParamSearch.test(this.url)) {
|
7170
|
+
this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
|
7171
|
+
} else {
|
7172
|
+
var reQueryString = /\?/;
|
7173
|
+
this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
|
7174
|
+
}
|
7175
|
+
}
|
7176
|
+
}
|
7177
|
+
}
|
7178
|
+
Request.prototype.clone = function() {
|
7179
|
+
return new Request(this, { body: this._bodyInit });
|
7180
|
+
};
|
7181
|
+
function decode(body) {
|
7182
|
+
var form = new FormData();
|
7183
|
+
body.trim().split("&").forEach(function(bytes) {
|
7184
|
+
if (bytes) {
|
7185
|
+
var split = bytes.split("=");
|
7186
|
+
var name = split.shift().replace(/\+/g, " ");
|
7187
|
+
var value = split.join("=").replace(/\+/g, " ");
|
7188
|
+
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
7189
|
+
}
|
7190
|
+
});
|
7191
|
+
return form;
|
7192
|
+
}
|
7193
|
+
function parseHeaders(rawHeaders) {
|
7194
|
+
var headers = new Headers();
|
7195
|
+
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
|
7196
|
+
preProcessedHeaders.split("\r").map(function(header) {
|
7197
|
+
return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
|
7198
|
+
}).forEach(function(line2) {
|
7199
|
+
var parts = line2.split(":");
|
7200
|
+
var key = parts.shift().trim();
|
7201
|
+
if (key) {
|
7202
|
+
var value = parts.join(":").trim();
|
7203
|
+
headers.append(key, value);
|
7204
|
+
}
|
7205
|
+
});
|
7206
|
+
return headers;
|
7207
|
+
}
|
7208
|
+
Body.call(Request.prototype);
|
7209
|
+
function Response(bodyInit, options) {
|
7210
|
+
if (!(this instanceof Response)) {
|
7211
|
+
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
|
7212
|
+
}
|
7213
|
+
if (!options) {
|
7214
|
+
options = {};
|
7215
|
+
}
|
7216
|
+
this.type = "default";
|
7217
|
+
this.status = options.status === void 0 ? 200 : options.status;
|
7218
|
+
this.ok = this.status >= 200 && this.status < 300;
|
7219
|
+
this.statusText = options.statusText === void 0 ? "" : "" + options.statusText;
|
7220
|
+
this.headers = new Headers(options.headers);
|
7221
|
+
this.url = options.url || "";
|
7222
|
+
this._initBody(bodyInit);
|
7223
|
+
}
|
7224
|
+
Body.call(Response.prototype);
|
7225
|
+
Response.prototype.clone = function() {
|
7226
|
+
return new Response(this._bodyInit, {
|
7227
|
+
status: this.status,
|
7228
|
+
statusText: this.statusText,
|
7229
|
+
headers: new Headers(this.headers),
|
7230
|
+
url: this.url
|
7231
|
+
});
|
7232
|
+
};
|
7233
|
+
Response.error = function() {
|
7234
|
+
var response = new Response(null, { status: 0, statusText: "" });
|
7235
|
+
response.type = "error";
|
7236
|
+
return response;
|
7237
|
+
};
|
7238
|
+
var redirectStatuses = [301, 302, 303, 307, 308];
|
7239
|
+
Response.redirect = function(url, status) {
|
7240
|
+
if (redirectStatuses.indexOf(status) === -1) {
|
7241
|
+
throw new RangeError("Invalid status code");
|
7242
|
+
}
|
7243
|
+
return new Response(null, { status, headers: { location: url } });
|
7244
|
+
};
|
7245
|
+
exports2.DOMException = global.DOMException;
|
7246
|
+
try {
|
7247
|
+
new exports2.DOMException();
|
7248
|
+
} catch (err2) {
|
7249
|
+
exports2.DOMException = function(message, name) {
|
7250
|
+
this.message = message;
|
7251
|
+
this.name = name;
|
7252
|
+
var error = Error(message);
|
7253
|
+
this.stack = error.stack;
|
7254
|
+
};
|
7255
|
+
exports2.DOMException.prototype = Object.create(Error.prototype);
|
7256
|
+
exports2.DOMException.prototype.constructor = exports2.DOMException;
|
7257
|
+
}
|
7258
|
+
function fetch2(input, init) {
|
7259
|
+
return new Promise(function(resolve, reject) {
|
7260
|
+
var request = new Request(input, init);
|
7261
|
+
if (request.signal && request.signal.aborted) {
|
7262
|
+
return reject(new exports2.DOMException("Aborted", "AbortError"));
|
7263
|
+
}
|
7264
|
+
var xhr = new XMLHttpRequest();
|
7265
|
+
function abortXhr() {
|
7266
|
+
xhr.abort();
|
7267
|
+
}
|
7268
|
+
xhr.onload = function() {
|
7269
|
+
var options = {
|
7270
|
+
status: xhr.status,
|
7271
|
+
statusText: xhr.statusText,
|
7272
|
+
headers: parseHeaders(xhr.getAllResponseHeaders() || "")
|
7273
|
+
};
|
7274
|
+
options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL");
|
7275
|
+
var body = "response" in xhr ? xhr.response : xhr.responseText;
|
7276
|
+
setTimeout(function() {
|
7277
|
+
resolve(new Response(body, options));
|
7278
|
+
}, 0);
|
7279
|
+
};
|
7280
|
+
xhr.onerror = function() {
|
7281
|
+
setTimeout(function() {
|
7282
|
+
reject(new TypeError("Network request failed"));
|
7283
|
+
}, 0);
|
7284
|
+
};
|
7285
|
+
xhr.ontimeout = function() {
|
7286
|
+
setTimeout(function() {
|
7287
|
+
reject(new TypeError("Network request failed"));
|
7288
|
+
}, 0);
|
7289
|
+
};
|
7290
|
+
xhr.onabort = function() {
|
7291
|
+
setTimeout(function() {
|
7292
|
+
reject(new exports2.DOMException("Aborted", "AbortError"));
|
7293
|
+
}, 0);
|
7294
|
+
};
|
7295
|
+
function fixUrl(url) {
|
7296
|
+
try {
|
7297
|
+
return url === "" && global.location.href ? global.location.href : url;
|
7298
|
+
} catch (e) {
|
7299
|
+
return url;
|
7300
|
+
}
|
7301
|
+
}
|
7302
|
+
xhr.open(request.method, fixUrl(request.url), true);
|
7303
|
+
if (request.credentials === "include") {
|
7304
|
+
xhr.withCredentials = true;
|
7305
|
+
} else if (request.credentials === "omit") {
|
7306
|
+
xhr.withCredentials = false;
|
7307
|
+
}
|
7308
|
+
if ("responseType" in xhr) {
|
7309
|
+
if (support.blob) {
|
7310
|
+
xhr.responseType = "blob";
|
7311
|
+
} else if (support.arrayBuffer && request.headers.get("Content-Type") && request.headers.get("Content-Type").indexOf("application/octet-stream") !== -1) {
|
7312
|
+
xhr.responseType = "arraybuffer";
|
7313
|
+
}
|
7314
|
+
}
|
7315
|
+
if (init && typeof init.headers === "object" && !(init.headers instanceof Headers)) {
|
7316
|
+
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
|
7317
|
+
xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
|
7318
|
+
});
|
7319
|
+
} else {
|
7320
|
+
request.headers.forEach(function(value, name) {
|
7321
|
+
xhr.setRequestHeader(name, value);
|
7322
|
+
});
|
7323
|
+
}
|
7324
|
+
if (request.signal) {
|
7325
|
+
request.signal.addEventListener("abort", abortXhr);
|
7326
|
+
xhr.onreadystatechange = function() {
|
7327
|
+
if (xhr.readyState === 4) {
|
7328
|
+
request.signal.removeEventListener("abort", abortXhr);
|
7329
|
+
}
|
7330
|
+
};
|
7331
|
+
}
|
7332
|
+
xhr.send(typeof request._bodyInit === "undefined" ? null : request._bodyInit);
|
7333
|
+
});
|
7334
|
+
}
|
7335
|
+
fetch2.polyfill = true;
|
7336
|
+
if (!global.fetch) {
|
7337
|
+
global.fetch = fetch2;
|
7338
|
+
global.Headers = Headers;
|
7339
|
+
global.Request = Request;
|
7340
|
+
global.Response = Response;
|
7341
|
+
}
|
7342
|
+
exports2.Headers = Headers;
|
7343
|
+
exports2.Request = Request;
|
7344
|
+
exports2.Response = Response;
|
7345
|
+
exports2.fetch = fetch2;
|
7346
|
+
return exports2;
|
7347
|
+
}({});
|
7348
|
+
})(typeof self !== "undefined" ? self : exports);
|
7349
|
+
}
|
7350
|
+
});
|
7351
|
+
var getRandomValues;
|
7352
|
+
var rnds8 = new Uint8Array(16);
|
7353
|
+
function rng() {
|
7354
|
+
if (!getRandomValues) {
|
7355
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
7356
|
+
if (!getRandomValues) {
|
7357
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
7358
|
+
}
|
7359
|
+
}
|
7360
|
+
return getRandomValues(rnds8);
|
7361
|
+
}
|
7362
|
+
var byteToHex = [];
|
7363
|
+
for (let i2 = 0; i2 < 256; ++i2) {
|
7364
|
+
byteToHex.push((i2 + 256).toString(16).slice(1));
|
7365
|
+
}
|
7366
|
+
function unsafeStringify(arr, offset = 0) {
|
7367
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
7368
|
+
}
|
7369
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
7370
|
+
var native_default = {
|
7371
|
+
randomUUID
|
7372
|
+
};
|
7373
|
+
function v4(options, buf, offset) {
|
7374
|
+
if (native_default.randomUUID && !buf && !options) {
|
7375
|
+
return native_default.randomUUID();
|
7376
|
+
}
|
7377
|
+
options = options || {};
|
7378
|
+
const rnds = options.random || (options.rng || rng)();
|
7379
|
+
rnds[6] = rnds[6] & 15 | 64;
|
7380
|
+
rnds[8] = rnds[8] & 63 | 128;
|
7381
|
+
if (buf) {
|
7382
|
+
offset = offset || 0;
|
7383
|
+
for (let i2 = 0; i2 < 16; ++i2) {
|
7384
|
+
buf[offset + i2] = rnds[i2];
|
7385
|
+
}
|
7386
|
+
return buf;
|
7387
|
+
}
|
7388
|
+
return unsafeStringify(rnds);
|
7389
|
+
}
|
7390
|
+
var v4_default = v4;
|
7391
|
+
var import_polyfill = __toESM2(require_browser_polyfill());
|
7392
|
+
var anonymousIdKey = "schematicId";
|
7393
|
+
var Schematic = class {
|
7394
|
+
apiKey;
|
7395
|
+
apiUrl = "https://api.schematichq.com";
|
7396
|
+
webSocketUrl = "wss://api.schematichq.com";
|
7397
|
+
eventUrl = "https://c.schematichq.com";
|
7398
|
+
conn = null;
|
7399
|
+
context = {};
|
7400
|
+
eventQueue;
|
7401
|
+
storage;
|
7402
|
+
useWebSocket = false;
|
7403
|
+
values = {};
|
7404
|
+
flagListener;
|
7405
|
+
constructor(apiKey, options) {
|
7406
|
+
this.apiKey = apiKey;
|
7407
|
+
this.eventQueue = [];
|
7408
|
+
this.useWebSocket = options?.useWebSocket ?? false;
|
7409
|
+
this.flagListener = options?.flagListener;
|
6586
7410
|
if (options?.storage) {
|
6587
7411
|
this.storage = options.storage;
|
6588
7412
|
} else if (typeof localStorage !== "undefined") {
|
@@ -6931,14 +7755,11 @@ var useSchematicFlag = (key, opts) => {
|
|
6931
7755
|
return value;
|
6932
7756
|
};
|
6933
7757
|
|
6934
|
-
// src/components/
|
6935
|
-
var
|
6936
|
-
|
6937
|
-
// src/components/embed/renderer.ts
|
6938
|
-
var import_react9 = require("react");
|
7758
|
+
// src/components/elements/card/Card.tsx
|
7759
|
+
var import_react6 = require("react");
|
6939
7760
|
|
6940
|
-
// src/
|
6941
|
-
var
|
7761
|
+
// src/const/index.ts
|
7762
|
+
var TEXT_BASE_SIZE = 16;
|
6942
7763
|
|
6943
7764
|
// src/utils/color.ts
|
6944
7765
|
function hexToHSL(color) {
|
@@ -7025,15 +7846,24 @@ function hslToHex({ h, s: s2, l: l2 }) {
|
|
7025
7846
|
bs = "0" + bs;
|
7026
7847
|
return "#" + rs + gs + bs;
|
7027
7848
|
}
|
7028
|
-
function
|
7849
|
+
function adjustLightness(color, amount) {
|
7029
7850
|
const { h, s: s2, l: l2 } = hexToHSL(color);
|
7030
7851
|
return hslToHex({ h, s: s2, l: Math.max(Math.min(l2 + amount, 100), 0) });
|
7031
7852
|
}
|
7032
7853
|
function lighten(color, amount) {
|
7033
|
-
return
|
7854
|
+
return adjustLightness(color, amount);
|
7034
7855
|
}
|
7035
7856
|
function darken(color, amount) {
|
7036
|
-
return
|
7857
|
+
return adjustLightness(color, -amount);
|
7858
|
+
}
|
7859
|
+
|
7860
|
+
// src/utils/date.ts
|
7861
|
+
function toPrettyDate(date) {
|
7862
|
+
return new Intl.DateTimeFormat("en-US", {
|
7863
|
+
month: "long",
|
7864
|
+
day: "numeric",
|
7865
|
+
year: "numeric"
|
7866
|
+
}).format(new Date(date));
|
7037
7867
|
}
|
7038
7868
|
|
7039
7869
|
// src/utils/string.ts
|
@@ -7041,9 +7871,6 @@ function camelToHyphen(str) {
|
|
7041
7871
|
return str.replace(/([a-z][A-Z])/g, (g2) => `${g2[0]}-${g2[1].toLowerCase()}`);
|
7042
7872
|
}
|
7043
7873
|
|
7044
|
-
// src/const/index.ts
|
7045
|
-
var TEXT_BASE_SIZE = 16;
|
7046
|
-
|
7047
7874
|
// src/utils/style.ts
|
7048
7875
|
function attr(key, value) {
|
7049
7876
|
return typeof value !== "undefined" && lt`
|
@@ -7061,6 +7888,88 @@ attr.rem = function propAsRem(key, value) {
|
|
7061
7888
|
`;
|
7062
7889
|
};
|
7063
7890
|
|
7891
|
+
// src/components/elements/card/styles.ts
|
7892
|
+
var StyledCard = dt.div(
|
7893
|
+
({
|
7894
|
+
theme,
|
7895
|
+
$sectionLayout = "merged",
|
7896
|
+
$borderRadius = 8,
|
7897
|
+
$padding = 48,
|
7898
|
+
$shadow = true
|
7899
|
+
}) => {
|
7900
|
+
return lt`
|
7901
|
+
box-sizing: border-box;
|
7902
|
+
font-size: ${TEXT_BASE_SIZE}px;
|
7903
|
+
|
7904
|
+
*,
|
7905
|
+
*::before,
|
7906
|
+
*::after {
|
7907
|
+
box-sizing: inherit;
|
7908
|
+
}
|
7909
|
+
|
7910
|
+
> * {
|
7911
|
+
padding: ${$padding * 0.75 / TEXT_BASE_SIZE}rem
|
7912
|
+
${$padding / TEXT_BASE_SIZE}rem;
|
7913
|
+
color: ${theme.typography.text.color};
|
7914
|
+
}
|
7915
|
+
|
7916
|
+
${() => {
|
7917
|
+
const { l: l2 } = hexToHSL(theme.card.background);
|
7918
|
+
const borderColor = l2 > 50 ? darken(theme.card.background, 10) : lighten(theme.card.background, 30);
|
7919
|
+
const borderRadius = `${$borderRadius / TEXT_BASE_SIZE}rem`;
|
7920
|
+
const boxShadow = "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A";
|
7921
|
+
if ($sectionLayout === "merged") {
|
7922
|
+
return lt`
|
7923
|
+
background: ${({ theme: theme2 }) => theme2.card.background};
|
7924
|
+
border-radius: ${borderRadius};
|
7925
|
+
|
7926
|
+
${$shadow && `box-shadow: ${boxShadow};`}
|
7927
|
+
|
7928
|
+
> :not(:last-child) {
|
7929
|
+
border-bottom: 1px solid ${borderColor};
|
7930
|
+
}
|
7931
|
+
`;
|
7932
|
+
}
|
7933
|
+
return lt`
|
7934
|
+
> :not(:last-child) {
|
7935
|
+
margin-bottom: 1rem;
|
7936
|
+
}
|
7937
|
+
|
7938
|
+
> * {
|
7939
|
+
background: ${theme.card.background};
|
7940
|
+
border-radius: ${borderRadius};
|
7941
|
+
${$shadow && `box-shadow: ${boxShadow};`}
|
7942
|
+
}
|
7943
|
+
`;
|
7944
|
+
}}
|
7945
|
+
`;
|
7946
|
+
}
|
7947
|
+
);
|
7948
|
+
|
7949
|
+
// src/components/elements/card/Card.tsx
|
7950
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
7951
|
+
var Card = (0, import_react6.forwardRef)(
|
7952
|
+
({ children, className }, ref) => {
|
7953
|
+
const { settings } = useEmbed();
|
7954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
7955
|
+
StyledCard,
|
7956
|
+
{
|
7957
|
+
ref,
|
7958
|
+
className,
|
7959
|
+
$sectionLayout: settings.theme?.sectionLayout,
|
7960
|
+
$borderRadius: settings.theme?.card?.borderRadius,
|
7961
|
+
$padding: settings.theme?.card?.padding,
|
7962
|
+
$shadow: settings.theme?.card?.hasShadow,
|
7963
|
+
children
|
7964
|
+
}
|
7965
|
+
);
|
7966
|
+
}
|
7967
|
+
);
|
7968
|
+
|
7969
|
+
// src/components/elements/plan-manager/PlanManager.tsx
|
7970
|
+
var import_react7 = require("react");
|
7971
|
+
var import_react_dom = require("react-dom");
|
7972
|
+
|
7064
7973
|
// src/components/ui/box/styles.ts
|
7065
7974
|
var Box = dt.div((props) => {
|
7066
7975
|
const initialStyles = [];
|
@@ -7079,10 +7988,13 @@ var Box = dt.div((props) => {
|
|
7079
7988
|
var Text = dt.span`
|
7080
7989
|
font-family: ${({ $font = "Inter" }) => `${$font}, sans-serif`};
|
7081
7990
|
font-size: ${({ $size = 16 }) => typeof $size === "number" ? `${$size / TEXT_BASE_SIZE}rem` : $size};
|
7082
|
-
|
7083
|
-
|
7991
|
+
${({ $weight = 400 }) => lt`
|
7992
|
+
font-weight: ${$weight};
|
7993
|
+
font-variation-settings: "wght" ${$weight};
|
7994
|
+
`};
|
7995
|
+
line-height: ${({ $lineHeight = 1.25 }) => $lineHeight};
|
7084
7996
|
${({ $align }) => attr("text-align", $align)};
|
7085
|
-
color: ${({ $color, theme }) => $color || theme.text};
|
7997
|
+
color: ${({ $color, theme }) => $color || theme.typography.text.color};
|
7086
7998
|
|
7087
7999
|
&:focus-visible {
|
7088
8000
|
outline: 2px solid ${({ theme }) => theme.primary};
|
@@ -7107,46 +8019,46 @@ var Button = dt.button`
|
|
7107
8019
|
switch ($size) {
|
7108
8020
|
case "sm":
|
7109
8021
|
return lt`
|
7110
|
-
font-size: ${12 /
|
8022
|
+
font-size: ${12 / TEXT_BASE_SIZE}rem;
|
7111
8023
|
${$variant !== "link" && lt`
|
7112
|
-
padding: ${7 /
|
8024
|
+
padding: ${7 / TEXT_BASE_SIZE}rem ${20 / TEXT_BASE_SIZE}rem;
|
7113
8025
|
`}
|
7114
|
-
border-radius: ${4 /
|
8026
|
+
border-radius: ${4 / TEXT_BASE_SIZE}rem;
|
7115
8027
|
`;
|
7116
8028
|
case "md":
|
7117
8029
|
default:
|
7118
8030
|
return lt`
|
7119
|
-
font-size: ${14 /
|
8031
|
+
font-size: ${14 / TEXT_BASE_SIZE}rem;
|
7120
8032
|
${$variant !== "link" && lt`
|
7121
|
-
padding: ${8 /
|
8033
|
+
padding: ${8 / TEXT_BASE_SIZE}rem ${24 / TEXT_BASE_SIZE}rem;
|
7122
8034
|
`}
|
7123
|
-
border-radius: ${8 /
|
8035
|
+
border-radius: ${8 / TEXT_BASE_SIZE}rem;
|
7124
8036
|
`;
|
7125
8037
|
case "lg":
|
7126
8038
|
return lt`
|
7127
|
-
font-size: ${16 /
|
8039
|
+
font-size: ${16 / TEXT_BASE_SIZE}rem;
|
7128
8040
|
${$variant !== "link" && lt`
|
7129
|
-
padding: ${9 /
|
8041
|
+
padding: ${9 / TEXT_BASE_SIZE}rem ${28 / TEXT_BASE_SIZE}rem;
|
7130
8042
|
`}
|
7131
|
-
border-radius: ${12 /
|
8043
|
+
border-radius: ${12 / TEXT_BASE_SIZE}rem;
|
7132
8044
|
`;
|
7133
8045
|
}
|
7134
8046
|
}}
|
7135
8047
|
|
7136
8048
|
${({ $color, $variant }) => {
|
7137
|
-
let color = "#
|
8049
|
+
let color = "#FFFFFF";
|
7138
8050
|
let bgColor;
|
7139
8051
|
switch ($color) {
|
7140
8052
|
case "blue":
|
7141
8053
|
default:
|
7142
|
-
bgColor = "#
|
8054
|
+
bgColor = "#194BFB";
|
7143
8055
|
break;
|
7144
8056
|
case "red":
|
7145
|
-
bgColor = "#
|
8057
|
+
bgColor = "#EF4444";
|
7146
8058
|
break;
|
7147
8059
|
case "white":
|
7148
8060
|
color = "#000000";
|
7149
|
-
bgColor = "#
|
8061
|
+
bgColor = "#FFFFFF";
|
7150
8062
|
break;
|
7151
8063
|
case "black":
|
7152
8064
|
bgColor = "#000000";
|
@@ -7175,7 +8087,7 @@ var Button = dt.button`
|
|
7175
8087
|
`;
|
7176
8088
|
|
7177
8089
|
// src/components/ui/button/Button.tsx
|
7178
|
-
var
|
8090
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
7179
8091
|
var Button2 = ({
|
7180
8092
|
color = "white",
|
7181
8093
|
size = "md",
|
@@ -7184,7 +8096,7 @@ var Button2 = ({
|
|
7184
8096
|
children,
|
7185
8097
|
...props
|
7186
8098
|
}) => {
|
7187
|
-
return /* @__PURE__ */ (0,
|
8099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
7188
8100
|
Button,
|
7189
8101
|
{
|
7190
8102
|
$color: color,
|
@@ -7197,72 +8109,6 @@ var Button2 = ({
|
|
7197
8109
|
);
|
7198
8110
|
};
|
7199
8111
|
|
7200
|
-
// src/components/ui/card/Card.tsx
|
7201
|
-
var import_react6 = require("react");
|
7202
|
-
|
7203
|
-
// src/components/ui/card/styles.ts
|
7204
|
-
var StyledCard = dt.div`
|
7205
|
-
box-sizing: border-box;
|
7206
|
-
font-size: ${TEXT_BASE_SIZE}px;
|
7207
|
-
|
7208
|
-
*,
|
7209
|
-
*::before,
|
7210
|
-
*::after {
|
7211
|
-
box-sizing: inherit;
|
7212
|
-
}
|
7213
|
-
|
7214
|
-
> * {
|
7215
|
-
padding: ${40 / 16}rem ${50 / 16}rem;
|
7216
|
-
color: ${({ theme }) => theme.color};
|
7217
|
-
background: ${({ theme }) => theme.background};
|
7218
|
-
box-shadow:
|
7219
|
-
0px 1px 20px 0px #1018280f,
|
7220
|
-
0px 1px 3px 0px #1018281a;
|
7221
|
-
}
|
7222
|
-
|
7223
|
-
${({ $sectionLayout = "merged", $borderRadius = 8 }) => $sectionLayout === "merged" ? lt`
|
7224
|
-
> :first-child {
|
7225
|
-
border-top-left-radius: ${$borderRadius / 16}rem;
|
7226
|
-
border-top-right-radius: ${$borderRadius / 16}rem;
|
7227
|
-
}
|
7228
|
-
|
7229
|
-
> :last-child {
|
7230
|
-
border-bottom-left-radius: ${$borderRadius / 16}rem;
|
7231
|
-
border-bottom-right-radius: ${$borderRadius / 16}rem;
|
7232
|
-
}
|
7233
|
-
|
7234
|
-
> :not(:last-child) {
|
7235
|
-
border-bottom: 1px solid #eaeaea;
|
7236
|
-
}
|
7237
|
-
` : lt`
|
7238
|
-
> :not(:last-child) {
|
7239
|
-
margin-bottom: 2rem;
|
7240
|
-
}
|
7241
|
-
|
7242
|
-
> * {
|
7243
|
-
border-radius: ${$borderRadius / 16}rem;
|
7244
|
-
}
|
7245
|
-
`}
|
7246
|
-
`;
|
7247
|
-
|
7248
|
-
// src/components/ui/card/Card.tsx
|
7249
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
7250
|
-
var Card = (0, import_react6.forwardRef)(
|
7251
|
-
({ children, className }, ref) => {
|
7252
|
-
const { settings } = useEmbed();
|
7253
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
7254
|
-
StyledCard,
|
7255
|
-
{
|
7256
|
-
ref,
|
7257
|
-
className,
|
7258
|
-
$sectionLayout: settings.sectionLayout,
|
7259
|
-
$borderRadius: settings.borderRadius,
|
7260
|
-
children
|
7261
|
-
}
|
7262
|
-
);
|
7263
|
-
}
|
7264
|
-
);
|
7265
|
-
|
7266
8112
|
// src/components/ui/flex/styles.ts
|
7267
8113
|
var Flex = dt(Box)`
|
7268
8114
|
display: flex;
|
@@ -7281,9 +8127,7 @@ var Container = dt.div`
|
|
7281
8127
|
display: flex;
|
7282
8128
|
justify-content: center;
|
7283
8129
|
align-items: center;
|
7284
|
-
border-
|
7285
|
-
border-style: solid;
|
7286
|
-
border-radius: 100%;
|
8130
|
+
border-radius: 9999px;
|
7287
8131
|
${({ $size }) => {
|
7288
8132
|
const base = 24;
|
7289
8133
|
let scale = 1;
|
@@ -7303,18 +8147,18 @@ var Container = dt.div`
|
|
7303
8147
|
break;
|
7304
8148
|
}
|
7305
8149
|
return lt`
|
7306
|
-
font-size: ${base * scale /
|
8150
|
+
font-size: ${base * scale / TEXT_BASE_SIZE}rem;
|
7307
8151
|
line-height: 1;
|
7308
|
-
width: ${(base + 8) * scale /
|
7309
|
-
height: ${(base + 8) * scale /
|
8152
|
+
width: ${(base + 8) * scale / TEXT_BASE_SIZE}rem;
|
8153
|
+
height: ${(base + 8) * scale / TEXT_BASE_SIZE}rem;
|
7310
8154
|
`;
|
7311
8155
|
}}
|
7312
|
-
${({ $
|
8156
|
+
${({ $variant, $colors }) => $variant === "outline" ? lt`
|
8157
|
+
color: ${$colors[0]};
|
7313
8158
|
background-color: transparent;
|
7314
|
-
border-color: #d1d5db;
|
7315
8159
|
` : lt`
|
7316
|
-
|
7317
|
-
|
8160
|
+
color: ${$colors[0]};
|
8161
|
+
background-color: ${$colors[1]};
|
7318
8162
|
`}
|
7319
8163
|
`;
|
7320
8164
|
|
@@ -7328,10 +8172,12 @@ var Icon2 = ({ name, className, ...props }) => {
|
|
7328
8172
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
7329
8173
|
var IconRound = ({
|
7330
8174
|
name,
|
7331
|
-
|
7332
|
-
size = "md"
|
8175
|
+
variant = "filled",
|
8176
|
+
size = "md",
|
8177
|
+
colors = ["white", "#e5e7eb"],
|
8178
|
+
...props
|
7333
8179
|
}) => {
|
7334
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Container, { $size: size, $
|
8180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Container, { $size: size, $variant: variant, $colors: colors, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon2, { name }) });
|
7335
8181
|
};
|
7336
8182
|
|
7337
8183
|
// src/components/ui/progress-bar/styles.ts
|
@@ -7346,7 +8192,7 @@ var ProgressBar = ({
|
|
7346
8192
|
value,
|
7347
8193
|
total = 0,
|
7348
8194
|
color = "gray",
|
7349
|
-
barWidth,
|
8195
|
+
barWidth = "100%",
|
7350
8196
|
...props
|
7351
8197
|
}) => {
|
7352
8198
|
const barColorMap = {
|
@@ -7356,287 +8202,72 @@ var ProgressBar = ({
|
|
7356
8202
|
orange: "#DB6769",
|
7357
8203
|
red: "#EF4444"
|
7358
8204
|
};
|
7359
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
7360
|
-
|
7361
|
-
|
7362
|
-
|
7363
|
-
|
7364
|
-
|
7365
|
-
|
7366
|
-
|
7367
|
-
|
7368
|
-
$borderRadius: "9999px",
|
7369
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
7370
|
-
Box,
|
8205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
8206
|
+
Container2,
|
8207
|
+
{
|
8208
|
+
$alignItems: "center",
|
8209
|
+
$gap: `${16 / TEXT_BASE_SIZE}rem`,
|
8210
|
+
...props,
|
8211
|
+
children: [
|
8212
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
8213
|
+
Flex,
|
7371
8214
|
{
|
7372
|
-
$
|
7373
|
-
$
|
7374
|
-
$
|
7375
|
-
$
|
8215
|
+
$position: "relative",
|
8216
|
+
$alignItems: "center",
|
8217
|
+
$width: `${barWidth}`,
|
8218
|
+
$maxWidth: "100%",
|
8219
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
8220
|
+
Flex,
|
8221
|
+
{
|
8222
|
+
$position: "relative",
|
8223
|
+
$overflow: "hidden",
|
8224
|
+
$width: "100%",
|
8225
|
+
$height: `${8 / TEXT_BASE_SIZE}rem`,
|
8226
|
+
$background: "#F2F4F7",
|
8227
|
+
$borderRadius: "9999px",
|
8228
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
8229
|
+
Box,
|
8230
|
+
{
|
8231
|
+
$width: `${Math.min(progress, 100)}%`,
|
8232
|
+
$height: "100%",
|
8233
|
+
$background: barColorMap[color],
|
8234
|
+
$borderRadius: "9999px"
|
8235
|
+
}
|
8236
|
+
)
|
8237
|
+
}
|
8238
|
+
)
|
7376
8239
|
}
|
7377
|
-
)
|
7378
|
-
|
7379
|
-
|
7380
|
-
|
7381
|
-
|
7382
|
-
|
7383
|
-
|
7384
|
-
|
7385
|
-
] });
|
7386
|
-
};
|
7387
|
-
|
7388
|
-
// src/components/elements/included-features/IncludedFeatures.tsx
|
7389
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
7390
|
-
function resolveDesignProps(props) {
|
7391
|
-
return {
|
7392
|
-
name: {
|
7393
|
-
text: props.name?.text || "Included features",
|
7394
|
-
style: {
|
7395
|
-
fontFamily: props.name?.style?.fontFamily || "Inter",
|
7396
|
-
fontSize: props.name?.style?.fontSize || 16,
|
7397
|
-
fontWeight: props.name?.style?.fontWeight || 500,
|
7398
|
-
color: props.name?.style?.color || "#000000"
|
7399
|
-
}
|
7400
|
-
},
|
7401
|
-
limits: {
|
7402
|
-
isVisible: props.limits?.isVisible || true
|
7403
|
-
},
|
7404
|
-
usage: {
|
7405
|
-
isVisible: props.usage?.isVisible || true
|
7406
|
-
},
|
7407
|
-
count: props.count || 3
|
7408
|
-
};
|
7409
|
-
}
|
7410
|
-
var LimitFeature = ({
|
7411
|
-
feature,
|
7412
|
-
allocation,
|
7413
|
-
usage
|
7414
|
-
}) => {
|
7415
|
-
if (!feature) {
|
7416
|
-
return null;
|
7417
|
-
}
|
7418
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $justifyContent: "space-between", $margin: "0 0 1.5rem", children: [
|
7419
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: `${16 / 16}rem`, children: [
|
7420
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconRound, { name: feature.icon, size: "sm" }),
|
7421
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
7422
|
-
Text,
|
7423
|
-
{
|
7424
|
-
$font: "Public Sans",
|
7425
|
-
$size: `${18 / 16}rem`,
|
7426
|
-
$weight: "500",
|
7427
|
-
$align: "center",
|
7428
|
-
children: feature.name
|
7429
|
-
}
|
7430
|
-
) })
|
7431
|
-
] }),
|
7432
|
-
typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
7433
|
-
ProgressBar,
|
7434
|
-
{
|
7435
|
-
progress: (usage || 0) / allocation * 100,
|
7436
|
-
value: usage || 0,
|
7437
|
-
total: allocation,
|
7438
|
-
color: "blue",
|
7439
|
-
barWidth: "140px"
|
7440
|
-
}
|
7441
|
-
)
|
7442
|
-
] });
|
7443
|
-
};
|
7444
|
-
var UsageFeature = ({
|
7445
|
-
feature,
|
7446
|
-
usage
|
7447
|
-
}) => {
|
7448
|
-
if (!feature) {
|
7449
|
-
return null;
|
7450
|
-
}
|
7451
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $justifyContent: "space-between", $margin: "0 0 1.5rem", children: [
|
7452
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: `${16 / 16}rem`, children: [
|
7453
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconRound, { name: feature.icon, size: "sm" }),
|
7454
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
7455
|
-
Text,
|
7456
|
-
{
|
7457
|
-
$font: "Public Sans",
|
7458
|
-
$size: `${18 / 16}rem`,
|
7459
|
-
$weight: "500",
|
7460
|
-
$align: "center",
|
7461
|
-
children: feature.name
|
7462
|
-
}
|
7463
|
-
) })
|
7464
|
-
] }),
|
7465
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { as: Box, $font: "Public Sans", $weight: "500", $align: "right", children: [
|
7466
|
-
usage,
|
7467
|
-
" ",
|
7468
|
-
feature.featureType,
|
7469
|
-
" used"
|
7470
|
-
] }) })
|
7471
|
-
] });
|
7472
|
-
};
|
7473
|
-
var AddonFeature = ({
|
7474
|
-
feature
|
7475
|
-
}) => {
|
7476
|
-
if (!feature) {
|
7477
|
-
return null;
|
7478
|
-
}
|
7479
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $justifyContent: "space-between", $margin: "0 0 1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: `${16 / 16}rem`, children: [
|
7480
|
-
feature.icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconRound, { name: feature.icon, size: "sm" }),
|
7481
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
7482
|
-
Text,
|
7483
|
-
{
|
7484
|
-
$font: "Public Sans",
|
7485
|
-
$size: `${18 / 16}rem`,
|
7486
|
-
$weight: "500",
|
7487
|
-
$align: "center",
|
7488
|
-
children: feature.name
|
7489
|
-
}
|
7490
|
-
) })
|
7491
|
-
] }) });
|
7492
|
-
};
|
7493
|
-
var IncludedFeatures = ({
|
7494
|
-
className,
|
7495
|
-
...props
|
7496
|
-
}) => {
|
7497
|
-
const designPropsWithDefaults = resolveDesignProps(props);
|
7498
|
-
const { data } = useEmbed();
|
7499
|
-
const [numVisible, setNumVisible] = (0, import_react7.useState)(designPropsWithDefaults.count);
|
7500
|
-
const isExpanded = (0, import_react7.useMemo)(
|
7501
|
-
() => numVisible > designPropsWithDefaults.count,
|
7502
|
-
[numVisible, designPropsWithDefaults.count]
|
8240
|
+
),
|
8241
|
+
total !== 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { $size: 14, $weight: 500, children: [
|
8242
|
+
value,
|
8243
|
+
"/",
|
8244
|
+
total
|
8245
|
+
] })
|
8246
|
+
]
|
8247
|
+
}
|
7503
8248
|
);
|
7504
|
-
const features = (0, import_react7.useMemo)(() => {
|
7505
|
-
return (data.featureUsage?.features || []).map(
|
7506
|
-
({
|
7507
|
-
access,
|
7508
|
-
allocation,
|
7509
|
-
allocationType,
|
7510
|
-
feature,
|
7511
|
-
period,
|
7512
|
-
usage,
|
7513
|
-
...props2
|
7514
|
-
}) => {
|
7515
|
-
return {
|
7516
|
-
access,
|
7517
|
-
allocation,
|
7518
|
-
allocationType,
|
7519
|
-
feature,
|
7520
|
-
period,
|
7521
|
-
/**
|
7522
|
-
* @TODO: resolve feature price
|
7523
|
-
*/
|
7524
|
-
price: void 0,
|
7525
|
-
usage,
|
7526
|
-
...props2
|
7527
|
-
};
|
7528
|
-
}
|
7529
|
-
);
|
7530
|
-
}, [data.featureUsage]);
|
7531
|
-
const resize = () => {
|
7532
|
-
setNumVisible(
|
7533
|
-
(prev2) => prev2 > designPropsWithDefaults.count ? designPropsWithDefaults.count : features.length
|
7534
|
-
);
|
7535
|
-
};
|
7536
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className, children: [
|
7537
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $margin: "0 0 1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
7538
|
-
Text,
|
7539
|
-
{
|
7540
|
-
$font: "Inter",
|
7541
|
-
$size: `${15 / 16}rem`,
|
7542
|
-
$weight: "500",
|
7543
|
-
$color: "#767676",
|
7544
|
-
children: designPropsWithDefaults.name.text
|
7545
|
-
}
|
7546
|
-
) }),
|
7547
|
-
features.slice(0, numVisible).reduce((acc, feature, index) => {
|
7548
|
-
if (feature.allocationType === "boolean") {
|
7549
|
-
return [...acc, /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AddonFeature, { ...feature }, index)];
|
7550
|
-
}
|
7551
|
-
if (feature.allocationType === "numeric" || feature.allocationType === "trait" || feature.allocationType === "unlimited") {
|
7552
|
-
if (typeof feature.allocation === "number") {
|
7553
|
-
return [...acc, /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LimitFeature, { ...feature }, index)];
|
7554
|
-
}
|
7555
|
-
return [...acc, /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UsageFeature, { ...feature }, index)];
|
7556
|
-
}
|
7557
|
-
return acc;
|
7558
|
-
}, []),
|
7559
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $alignItems: "center", $gap: `${4 / 16}rem`, children: [
|
7560
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
7561
|
-
Icon2,
|
7562
|
-
{
|
7563
|
-
name: isExpanded ? "chevron-up" : "chevron-down",
|
7564
|
-
style: { fontSize: "1.25rem", color: "#D0D0D0" }
|
7565
|
-
}
|
7566
|
-
),
|
7567
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button2, { onClick: resize, color: "blue", variant: "link", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $weight: "500", children: "See all" }) })
|
7568
|
-
] })
|
7569
|
-
] });
|
7570
|
-
};
|
7571
|
-
|
7572
|
-
// src/components/elements/invoices/Invoices.tsx
|
7573
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
7574
|
-
var Invoices = () => {
|
7575
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "p-8", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative z-[1] bg-white flex flex-col space-y-4", children: [
|
7576
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "font-bold text-base", children: "Invoices" }) }),
|
7577
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col space-y-2", children: [
|
7578
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-between text-sm", children: [
|
7579
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-blue-400", children: "May 12, 2024" }),
|
7580
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-gray-400", children: "$315.00" })
|
7581
|
-
] }),
|
7582
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-between text-sm", children: [
|
7583
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-blue-400", children: "May 12, 2024" }),
|
7584
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-gray-400", children: "$315.00" })
|
7585
|
-
] })
|
7586
|
-
] }),
|
7587
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-row space-x-2 items-center", children: [
|
7588
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon2, { name: "chevron-down", className: "text-gray-400 leading-none" }),
|
7589
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-blue-400 font-medium font-display text-sm", children: "See all" })
|
7590
|
-
] })
|
7591
|
-
] }) });
|
7592
|
-
};
|
7593
|
-
|
7594
|
-
// src/components/elements/next-bill-due/NextBillDue.tsx
|
7595
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
7596
|
-
var NextBillDue = () => {
|
7597
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "bg-white p-8", children: [
|
7598
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-center justify-between mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "font-bold text-base", children: "Next bill due June 12, 2024" }) }),
|
7599
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center leading-none justify-between", children: [
|
7600
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-row items-end flex-1 font-medium font-display text-gray-700", children: [
|
7601
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-lg mr-0.5 translate-y-[3px]", children: "$" }),
|
7602
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-3xl", children: "315.00" })
|
7603
|
-
] }),
|
7604
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-gray-400 text-xs max-w-[160px]", children: [
|
7605
|
-
"Estimated monthly bill, ",
|
7606
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("br", {}),
|
7607
|
-
"Contract ends 5/12/24."
|
7608
|
-
] })
|
7609
|
-
] })
|
7610
|
-
] });
|
7611
|
-
};
|
7612
|
-
|
7613
|
-
// src/components/elements/payment-method/PaymentMethod.tsx
|
7614
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
7615
|
-
var PaymentMethod = () => {
|
7616
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "relative px-8 py-8 bg-white", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative z-[1] bg-white", children: [
|
7617
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
|
7618
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "font-bold text-base", children: "Payment Method" }),
|
7619
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "text-xs text-red-400", children: "Expires in 4 mo" })
|
7620
|
-
] }),
|
7621
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row justify-between bg-gray-50 text-sm px-4 py-1.5 rounded-full", children: [
|
7622
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "", children: "\u{1F4B3} Card ending 4512" }),
|
7623
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-blue-400", children: "Edit" })
|
7624
|
-
] })
|
7625
|
-
] }) });
|
7626
8249
|
};
|
7627
8250
|
|
7628
|
-
// src/components/elements/plan-manager/PlanManager.tsx
|
7629
|
-
var import_react8 = require("react");
|
7630
|
-
|
7631
8251
|
// src/components/elements/plan-manager/styles.ts
|
7632
|
-
var
|
8252
|
+
var StyledButton = dt(Button2)`
|
7633
8253
|
font-family: "Public Sans", sans-serif;
|
7634
8254
|
font-weight: 500;
|
7635
8255
|
text-align: center;
|
7636
8256
|
width: 100%;
|
7637
|
-
|
7638
|
-
|
7639
|
-
const color =
|
8257
|
+
${({ $color = "primary", theme }) => {
|
8258
|
+
const { l: l2 } = hexToHSL(theme[$color]);
|
8259
|
+
const color = l2 > 50 ? "#000000" : "#FFFFFF";
|
8260
|
+
return lt`
|
8261
|
+
color: ${color};
|
8262
|
+
|
8263
|
+
${Text} {
|
8264
|
+
color: ${color};
|
8265
|
+
}
|
8266
|
+
`;
|
8267
|
+
}};
|
8268
|
+
|
8269
|
+
${({ $color = "primary", theme }) => {
|
8270
|
+
const color = theme[$color];
|
7640
8271
|
return lt`
|
7641
8272
|
background-color: ${color};
|
7642
8273
|
border-color: ${color};
|
@@ -7644,10 +8275,10 @@ var Button3 = dt(Button2)`
|
|
7644
8275
|
}}
|
7645
8276
|
|
7646
8277
|
&:hover {
|
7647
|
-
${({ $
|
7648
|
-
const specified = $
|
7649
|
-
const lightened = lighten(specified,
|
7650
|
-
const color = specified === lightened ? darken(specified,
|
8278
|
+
${({ $color = "primary", theme }) => {
|
8279
|
+
const specified = theme[$color];
|
8280
|
+
const lightened = lighten(specified, 15);
|
8281
|
+
const color = specified === lightened ? darken(specified, 15) : lightened;
|
7651
8282
|
return lt`
|
7652
8283
|
background-color: ${color};
|
7653
8284
|
border-color: ${color};
|
@@ -7680,66 +8311,56 @@ var Button3 = dt(Button2)`
|
|
7680
8311
|
`;
|
7681
8312
|
|
7682
8313
|
// src/components/elements/plan-manager/PlanManager.tsx
|
7683
|
-
var
|
7684
|
-
|
8314
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
8315
|
+
var resolveDesignProps = (props) => {
|
7685
8316
|
return {
|
7686
8317
|
header: {
|
7687
|
-
isVisible: props.header?.isVisible
|
8318
|
+
isVisible: props.header?.isVisible ?? true,
|
7688
8319
|
title: {
|
7689
|
-
|
7690
|
-
fontSize: props.header?.title?.fontSize || 37,
|
7691
|
-
fontWeight: props.header?.title?.fontWeight || 800,
|
7692
|
-
color: props.header?.title?.color || "black"
|
8320
|
+
fontStyle: props.header?.title?.fontStyle ?? "heading1"
|
7693
8321
|
},
|
7694
8322
|
description: {
|
7695
|
-
isVisible: props.header?.description?.isVisible
|
7696
|
-
|
7697
|
-
fontSize: props.header?.description?.fontSize || 16,
|
7698
|
-
fontWeight: props.header?.description?.fontWeight || 400,
|
7699
|
-
color: props.header?.description?.color || "black"
|
8323
|
+
isVisible: props.header?.description?.isVisible ?? true,
|
8324
|
+
fontStyle: props.header?.description?.fontStyle ?? "text"
|
7700
8325
|
},
|
7701
8326
|
price: {
|
7702
|
-
isVisible: props.header?.price?.isVisible
|
7703
|
-
|
7704
|
-
fontSize: props.header?.price?.fontSize || 16,
|
7705
|
-
fontWeight: props.header?.price?.fontWeight || 500,
|
7706
|
-
color: props.header?.price?.color || "black"
|
8327
|
+
isVisible: props.header?.price?.isVisible ?? true,
|
8328
|
+
fontStyle: props.header?.price?.fontStyle ?? "text"
|
7707
8329
|
}
|
7708
8330
|
},
|
7709
8331
|
addOns: {
|
7710
|
-
isVisible: props.addOns?.isVisible
|
7711
|
-
|
7712
|
-
|
7713
|
-
isVisible: props.usageBased?.isVisible || true
|
8332
|
+
isVisible: props.addOns?.isVisible ?? true,
|
8333
|
+
fontStyle: props.addOns?.fontStyle ?? "heading4",
|
8334
|
+
showLabel: props.addOns?.showLabel ?? true
|
7714
8335
|
},
|
7715
8336
|
callToAction: {
|
7716
|
-
isVisible: props.callToAction?.isVisible
|
7717
|
-
|
7718
|
-
|
7719
|
-
backgroundColor: props.callToAction?.backgroundColor || "black"
|
8337
|
+
isVisible: props.callToAction?.isVisible ?? true,
|
8338
|
+
buttonSize: props.callToAction?.buttonSize ?? "md",
|
8339
|
+
buttonStyle: props.callToAction?.buttonStyle ?? "secondary"
|
7720
8340
|
}
|
7721
8341
|
};
|
7722
|
-
}
|
7723
|
-
var PlanManager = ({ className, ...
|
7724
|
-
const
|
7725
|
-
const { data } = useEmbed();
|
7726
|
-
const plans = (0,
|
7727
|
-
return
|
7728
|
-
|
8342
|
+
};
|
8343
|
+
var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal, ...rest }, ref) => {
|
8344
|
+
const props = resolveDesignProps(rest);
|
8345
|
+
const { data, settings, layout, setLayout } = useEmbed();
|
8346
|
+
const { plan, plans, addOns } = (0, import_react7.useMemo)(() => {
|
8347
|
+
return {
|
8348
|
+
plan: data.company?.plan || {},
|
8349
|
+
plans: data.company?.plans?.map(({ name, description }) => ({
|
7729
8350
|
name,
|
7730
8351
|
description,
|
7731
|
-
/**
|
7732
|
-
* @TODO: resolve plan/addon prices
|
7733
|
-
*/
|
7734
8352
|
price: void 0
|
7735
|
-
}
|
7736
|
-
|
7737
|
-
|
7738
|
-
|
7739
|
-
|
7740
|
-
|
7741
|
-
|
7742
|
-
|
8353
|
+
})) || [],
|
8354
|
+
addOns: data.company?.addOns?.map(({ name, description }) => ({
|
8355
|
+
name,
|
8356
|
+
description,
|
8357
|
+
price: void 0
|
8358
|
+
})) || []
|
8359
|
+
};
|
8360
|
+
}, [data.company]);
|
8361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref, className, children: [
|
8362
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", $margin: "0 0 3rem", children: [
|
8363
|
+
props.header.isVisible && plan && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
7743
8364
|
Flex,
|
7744
8365
|
{
|
7745
8366
|
$justifyContent: "space-between",
|
@@ -7747,58 +8368,78 @@ var PlanManager = ({ className, ...props }) => {
|
|
7747
8368
|
$width: "100%",
|
7748
8369
|
$margin: "0 0 1.5rem",
|
7749
8370
|
children: [
|
7750
|
-
/* @__PURE__ */ (0,
|
7751
|
-
/* @__PURE__ */ (0,
|
8371
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
|
8372
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $margin: "0 0 0.75rem", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
7752
8373
|
Text,
|
7753
8374
|
{
|
7754
|
-
$font:
|
7755
|
-
$size:
|
7756
|
-
$weight:
|
7757
|
-
$color:
|
8375
|
+
$font: settings.theme.typography[props.header.title.fontStyle].fontFamily,
|
8376
|
+
$size: settings.theme.typography[props.header.title.fontStyle].fontSize,
|
8377
|
+
$weight: settings.theme.typography[props.header.title.fontStyle].fontWeight,
|
8378
|
+
$color: settings.theme.typography[props.header.title.fontStyle].color,
|
8379
|
+
$lineHeight: 1,
|
7758
8380
|
children: plan.name
|
7759
8381
|
}
|
7760
8382
|
) }),
|
7761
|
-
|
8383
|
+
props.header.description.isVisible && plan.description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
7762
8384
|
Text,
|
7763
8385
|
{
|
7764
|
-
$font:
|
7765
|
-
$size:
|
7766
|
-
$weight:
|
7767
|
-
$color:
|
8386
|
+
$font: settings.theme.typography[props.header.description.fontStyle].fontFamily,
|
8387
|
+
$size: settings.theme.typography[props.header.description.fontStyle].fontSize,
|
8388
|
+
$weight: settings.theme.typography[props.header.description.fontStyle].fontWeight,
|
8389
|
+
$color: settings.theme.typography[props.header.description.fontStyle].color,
|
7768
8390
|
children: plan.description
|
7769
8391
|
}
|
7770
8392
|
)
|
7771
8393
|
] }),
|
7772
|
-
|
8394
|
+
props.header.price.isVisible && plan.planPrice >= 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
7773
8395
|
Text,
|
7774
8396
|
{
|
7775
|
-
$font:
|
7776
|
-
$size:
|
7777
|
-
$weight:
|
7778
|
-
$color:
|
8397
|
+
$font: settings.theme.typography[props.header.price.fontStyle].fontFamily,
|
8398
|
+
$size: settings.theme.typography[props.header.price.fontStyle].fontSize,
|
8399
|
+
$weight: settings.theme.typography[props.header.price.fontStyle].fontWeight,
|
8400
|
+
$color: settings.theme.typography[props.header.price.fontStyle].color,
|
7779
8401
|
children: [
|
7780
8402
|
"$",
|
7781
|
-
plan.
|
7782
|
-
"/
|
8403
|
+
plan.planPrice,
|
8404
|
+
"/",
|
8405
|
+
plan.planPeriod
|
7783
8406
|
]
|
7784
8407
|
}
|
7785
8408
|
)
|
7786
8409
|
]
|
7787
8410
|
}
|
7788
8411
|
),
|
7789
|
-
|
7790
|
-
/* @__PURE__ */ (0,
|
7791
|
-
|
8412
|
+
props.addOns.isVisible && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
8413
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
8414
|
+
Text,
|
8415
|
+
{
|
8416
|
+
$font: settings.theme.typography.text.fontFamily,
|
8417
|
+
$size: settings.theme.typography.text.fontSize,
|
8418
|
+
$weight: 500,
|
8419
|
+
$color: darken(settings.theme.typography.text.color, 20),
|
8420
|
+
children: "Add-Ons"
|
8421
|
+
}
|
8422
|
+
),
|
8423
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $width: "100%", $margin: "0 0 1rem", children: addOns.map((addOn, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
7792
8424
|
Flex,
|
7793
8425
|
{
|
7794
8426
|
$justifyContent: "space-between",
|
7795
8427
|
$alignItems: "center",
|
7796
8428
|
$width: "100%",
|
7797
8429
|
children: [
|
7798
|
-
/* @__PURE__ */ (0,
|
7799
|
-
|
8430
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
8431
|
+
Text,
|
8432
|
+
{
|
8433
|
+
$font: settings.theme.typography[props.addOns.fontStyle].fontFamily,
|
8434
|
+
$size: settings.theme.typography[props.addOns.fontStyle].fontSize,
|
8435
|
+
$weight: settings.theme.typography[props.addOns.fontStyle].fontWeight,
|
8436
|
+
$color: settings.theme.typography[props.addOns.fontStyle].color,
|
8437
|
+
children: addOn.name
|
8438
|
+
}
|
8439
|
+
),
|
8440
|
+
addOn.price >= 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { $weight: 500, children: [
|
7800
8441
|
"$",
|
7801
|
-
|
8442
|
+
addOn.price,
|
7802
8443
|
"/mo"
|
7803
8444
|
] })
|
7804
8445
|
]
|
@@ -7807,23 +8448,759 @@ var PlanManager = ({ className, ...props }) => {
|
|
7807
8448
|
)) })
|
7808
8449
|
] })
|
7809
8450
|
] }),
|
7810
|
-
|
7811
|
-
|
8451
|
+
props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
8452
|
+
StyledButton,
|
7812
8453
|
{
|
7813
|
-
|
7814
|
-
|
7815
|
-
|
7816
|
-
|
8454
|
+
onClick: () => {
|
8455
|
+
if (layout !== "checkout")
|
8456
|
+
return;
|
8457
|
+
setLayout("checkout");
|
8458
|
+
},
|
8459
|
+
$size: props.callToAction.buttonSize,
|
8460
|
+
$color: props.callToAction.buttonStyle,
|
8461
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
8462
|
+
Text,
|
8463
|
+
{
|
8464
|
+
$font: settings.theme.typography.text.fontFamily,
|
8465
|
+
$size: settings.theme.typography.text.fontSize,
|
8466
|
+
$weight: settings.theme.typography.text.fontWeight,
|
8467
|
+
children: "Change Plan"
|
8468
|
+
}
|
8469
|
+
)
|
7817
8470
|
}
|
8471
|
+
),
|
8472
|
+
children,
|
8473
|
+
layout === "checkout" && (0, import_react_dom.createPortal)(
|
8474
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
8475
|
+
Box,
|
8476
|
+
{
|
8477
|
+
$position: "absolute",
|
8478
|
+
$top: "50%",
|
8479
|
+
$left: "50%",
|
8480
|
+
$zIndex: "999999",
|
8481
|
+
$transform: "translate(-50%, -50%)",
|
8482
|
+
$width: "100%",
|
8483
|
+
$height: "100%",
|
8484
|
+
$backgroundColor: "#B5B5B580",
|
8485
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
8486
|
+
Flex,
|
8487
|
+
{
|
8488
|
+
$position: "relative",
|
8489
|
+
$top: "50%",
|
8490
|
+
$left: "50%",
|
8491
|
+
$transform: "translate(-50%, -50%)",
|
8492
|
+
$width: "956px",
|
8493
|
+
$height: "700px",
|
8494
|
+
$backgroundColor: "#FBFBFB",
|
8495
|
+
$borderRadius: "8px",
|
8496
|
+
$boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
|
8497
|
+
id: "select-plan-dialog",
|
8498
|
+
role: "dialog",
|
8499
|
+
"aria-labelledby": "select-plan-dialog-label",
|
8500
|
+
"aria-modal": "true",
|
8501
|
+
children: [
|
8502
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
8503
|
+
Box,
|
8504
|
+
{
|
8505
|
+
$position: "absolute",
|
8506
|
+
$top: "0.25rem",
|
8507
|
+
$right: "0.75rem",
|
8508
|
+
$cursor: "pointer",
|
8509
|
+
onClick: () => {
|
8510
|
+
setLayout("portal");
|
8511
|
+
},
|
8512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } })
|
8513
|
+
}
|
8514
|
+
),
|
8515
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
8516
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
8517
|
+
Text,
|
8518
|
+
{
|
8519
|
+
as: "h1",
|
8520
|
+
id: "select-plan-dialog-label",
|
8521
|
+
$size: 24,
|
8522
|
+
$weight: 800,
|
8523
|
+
children: "Select plan"
|
8524
|
+
}
|
8525
|
+
),
|
8526
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: plans.map((plan2, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
8527
|
+
Flex,
|
8528
|
+
{
|
8529
|
+
$justifyContent: "space-between",
|
8530
|
+
$alignItems: "center",
|
8531
|
+
$width: "100%",
|
8532
|
+
children: [
|
8533
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 20, $weight: 800, children: plan2.name }),
|
8534
|
+
plan2.price >= 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { children: [
|
8535
|
+
"$",
|
8536
|
+
plan2.price,
|
8537
|
+
"/mo"
|
8538
|
+
] })
|
8539
|
+
]
|
8540
|
+
},
|
8541
|
+
index
|
8542
|
+
)) })
|
8543
|
+
] })
|
8544
|
+
]
|
8545
|
+
}
|
8546
|
+
)
|
8547
|
+
}
|
8548
|
+
),
|
8549
|
+
portal || document.body
|
7818
8550
|
)
|
7819
8551
|
] });
|
8552
|
+
});
|
8553
|
+
|
8554
|
+
// src/components/elements/included-features/IncludedFeatures.tsx
|
8555
|
+
var import_react8 = require("react");
|
8556
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
8557
|
+
function resolveDesignProps2(props) {
|
8558
|
+
return {
|
8559
|
+
header: {
|
8560
|
+
isVisible: props.header?.isVisible ?? true,
|
8561
|
+
fontStyle: props.header?.fontStyle ?? "heading4",
|
8562
|
+
text: props.header?.text ?? "Included features"
|
8563
|
+
},
|
8564
|
+
icons: {
|
8565
|
+
isVisible: props.icons?.isVisible ?? true,
|
8566
|
+
fontStyle: props.icons?.fontStyle ?? "heading3",
|
8567
|
+
style: props.icons?.style ?? "light"
|
8568
|
+
},
|
8569
|
+
entitlement: {
|
8570
|
+
isVisible: props.entitlement?.isVisible ?? true,
|
8571
|
+
fontStyle: props.entitlement?.fontStyle ?? "heading5"
|
8572
|
+
},
|
8573
|
+
usage: {
|
8574
|
+
isVisible: props.usage?.isVisible ?? true,
|
8575
|
+
fontStyle: props.usage?.fontStyle ?? "heading6"
|
8576
|
+
}
|
8577
|
+
};
|
8578
|
+
}
|
8579
|
+
var IncludedFeatures = (0, import_react8.forwardRef)(({ className, ...rest }, ref) => {
|
8580
|
+
const props = resolveDesignProps2(rest);
|
8581
|
+
const { data, settings } = useEmbed();
|
8582
|
+
const features = (0, import_react8.useMemo)(() => {
|
8583
|
+
return (data.featureUsage?.features || []).map(
|
8584
|
+
({
|
8585
|
+
access,
|
8586
|
+
allocation,
|
8587
|
+
allocationType,
|
8588
|
+
feature,
|
8589
|
+
period,
|
8590
|
+
usage,
|
8591
|
+
...props2
|
8592
|
+
}) => {
|
8593
|
+
return {
|
8594
|
+
access,
|
8595
|
+
allocation,
|
8596
|
+
allocationType,
|
8597
|
+
feature,
|
8598
|
+
period,
|
8599
|
+
/**
|
8600
|
+
* @TODO: resolve feature price
|
8601
|
+
*/
|
8602
|
+
price: void 0,
|
8603
|
+
usage,
|
8604
|
+
...props2
|
8605
|
+
};
|
8606
|
+
}
|
8607
|
+
);
|
8608
|
+
}, [data.featureUsage]);
|
8609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: [
|
8610
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
8611
|
+
Text,
|
8612
|
+
{
|
8613
|
+
$font: settings.theme.typography[props.header.fontStyle].fontFamily,
|
8614
|
+
$size: settings.theme.typography[props.header.fontStyle].fontSize,
|
8615
|
+
$weight: settings.theme.typography[props.header.fontStyle].fontWeight,
|
8616
|
+
$color: settings.theme.typography[props.header.fontStyle].color,
|
8617
|
+
children: props.header.text
|
8618
|
+
}
|
8619
|
+
) }),
|
8620
|
+
features.reduce(
|
8621
|
+
(acc, { allocation, allocationType, feature, usage }, index) => {
|
8622
|
+
if (!allocationType) {
|
8623
|
+
return acc;
|
8624
|
+
}
|
8625
|
+
return [
|
8626
|
+
...acc,
|
8627
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
8628
|
+
Flex,
|
8629
|
+
{
|
8630
|
+
$flexWrap: "wrap",
|
8631
|
+
$justifyContent: "space-between",
|
8632
|
+
$alignItems: "center",
|
8633
|
+
$gap: "1rem",
|
8634
|
+
children: [
|
8635
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Flex, { $flexShrink: "0", $gap: "1rem", children: [
|
8636
|
+
props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
8637
|
+
IconRound,
|
8638
|
+
{
|
8639
|
+
name: feature.icon,
|
8640
|
+
size: "sm",
|
8641
|
+
colors: [
|
8642
|
+
settings.theme.card.background,
|
8643
|
+
settings.theme.primary
|
8644
|
+
]
|
8645
|
+
}
|
8646
|
+
),
|
8647
|
+
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
8648
|
+
Text,
|
8649
|
+
{
|
8650
|
+
$font: settings.theme.typography[props.icons.fontStyle].fontFamily,
|
8651
|
+
$size: settings.theme.typography[props.icons.fontStyle].fontSize,
|
8652
|
+
$weight: settings.theme.typography[props.icons.fontStyle].fontWeight,
|
8653
|
+
$color: settings.theme.typography[props.icons.fontStyle].color,
|
8654
|
+
$align: "center",
|
8655
|
+
children: feature.name
|
8656
|
+
}
|
8657
|
+
) })
|
8658
|
+
] }),
|
8659
|
+
allocationType === "numeric" && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box, { $textAlign: "right", children: [
|
8660
|
+
props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
8661
|
+
Text,
|
8662
|
+
{
|
8663
|
+
as: Box,
|
8664
|
+
$font: settings.theme.typography[props.entitlement.fontStyle].fontFamily,
|
8665
|
+
$size: settings.theme.typography[props.entitlement.fontStyle].fontSize,
|
8666
|
+
$weight: settings.theme.typography[props.entitlement.fontStyle].fontWeight,
|
8667
|
+
$color: settings.theme.typography[props.entitlement.fontStyle].color,
|
8668
|
+
children: typeof allocation === "number" ? `${allocation} ${feature.name}` : `Unlimited ${feature.name}`
|
8669
|
+
}
|
8670
|
+
),
|
8671
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
8672
|
+
Text,
|
8673
|
+
{
|
8674
|
+
as: Box,
|
8675
|
+
$font: settings.theme.typography[props.usage.fontStyle].fontFamily,
|
8676
|
+
$size: settings.theme.typography[props.usage.fontStyle].fontSize,
|
8677
|
+
$weight: settings.theme.typography[props.usage.fontStyle].fontWeight,
|
8678
|
+
$color: settings.theme.typography[props.usage.fontStyle].color,
|
8679
|
+
children: typeof allocation === "number" ? `${usage} of ${allocation} used` : `${usage} used`
|
8680
|
+
}
|
8681
|
+
)
|
8682
|
+
] })
|
8683
|
+
]
|
8684
|
+
},
|
8685
|
+
index
|
8686
|
+
)
|
8687
|
+
];
|
8688
|
+
},
|
8689
|
+
[]
|
8690
|
+
)
|
8691
|
+
] });
|
8692
|
+
});
|
8693
|
+
|
8694
|
+
// src/components/elements/metered-features/MeteredFeatures.tsx
|
8695
|
+
var import_react9 = require("react");
|
8696
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
8697
|
+
function resolveDesignProps3(props) {
|
8698
|
+
return {
|
8699
|
+
isVisible: props.isVisible ?? true,
|
8700
|
+
header: {
|
8701
|
+
fontStyle: props.header?.fontStyle ?? "heading2"
|
8702
|
+
},
|
8703
|
+
description: {
|
8704
|
+
isVisible: props.description?.isVisible ?? true,
|
8705
|
+
fontStyle: props.description?.fontStyle ?? "text"
|
8706
|
+
},
|
8707
|
+
icon: {
|
8708
|
+
isVisible: props.icon?.isVisible ?? true
|
8709
|
+
},
|
8710
|
+
allocation: {
|
8711
|
+
isVisible: props.allocation?.isVisible ?? true,
|
8712
|
+
fontStyle: props.allocation?.fontStyle ?? "heading4"
|
8713
|
+
},
|
8714
|
+
usage: {
|
8715
|
+
isVisible: props.usage?.isVisible ?? true,
|
8716
|
+
fontStyle: props.usage?.fontStyle ?? "heading5"
|
8717
|
+
},
|
8718
|
+
callToAction: {
|
8719
|
+
isVisible: props.callToAction?.isVisible ?? true,
|
8720
|
+
buttonSize: props.callToAction?.buttonSize ?? "md",
|
8721
|
+
buttonStyle: props.callToAction?.buttonStyle ?? "secondary"
|
8722
|
+
}
|
8723
|
+
};
|
8724
|
+
}
|
8725
|
+
var MeteredFeatures = (0, import_react9.forwardRef)(({ className, ...rest }, ref) => {
|
8726
|
+
const props = resolveDesignProps3(rest);
|
8727
|
+
const { data, settings } = useEmbed();
|
8728
|
+
const features = (0, import_react9.useMemo)(() => {
|
8729
|
+
return (data.featureUsage?.features || []).map(
|
8730
|
+
({
|
8731
|
+
access,
|
8732
|
+
allocation,
|
8733
|
+
allocationType,
|
8734
|
+
feature,
|
8735
|
+
period,
|
8736
|
+
usage,
|
8737
|
+
...props2
|
8738
|
+
}) => {
|
8739
|
+
return {
|
8740
|
+
access,
|
8741
|
+
allocation,
|
8742
|
+
allocationType,
|
8743
|
+
feature,
|
8744
|
+
period,
|
8745
|
+
/**
|
8746
|
+
* @TODO: resolve feature price
|
8747
|
+
*/
|
8748
|
+
price: void 0,
|
8749
|
+
usage,
|
8750
|
+
...props2
|
8751
|
+
};
|
8752
|
+
}
|
8753
|
+
);
|
8754
|
+
}, [data.featureUsage]);
|
8755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: features.reduce(
|
8756
|
+
(acc, { allocation, allocationType, feature, usage }, index) => {
|
8757
|
+
if (!props.isVisible || allocationType !== "numeric" || typeof allocation !== "number") {
|
8758
|
+
return acc;
|
8759
|
+
}
|
8760
|
+
return [
|
8761
|
+
...acc,
|
8762
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { $gap: "1.5rem", children: [
|
8763
|
+
props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { $flexShrink: "0", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconRound, { name: feature.icon, size: "sm" }) }),
|
8764
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box, { $flexGrow: "1", children: [
|
8765
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { children: [
|
8766
|
+
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box, { $flexGrow: "1", children: [
|
8767
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
8768
|
+
Text,
|
8769
|
+
{
|
8770
|
+
as: Box,
|
8771
|
+
$font: settings.theme.typography[props.header.fontStyle].fontFamily,
|
8772
|
+
$size: settings.theme.typography[props.header.fontStyle].fontSize,
|
8773
|
+
$weight: settings.theme.typography[props.header.fontStyle].fontWeight,
|
8774
|
+
$color: settings.theme.typography[props.header.fontStyle].color,
|
8775
|
+
children: feature.name
|
8776
|
+
}
|
8777
|
+
),
|
8778
|
+
props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
8779
|
+
Text,
|
8780
|
+
{
|
8781
|
+
as: Box,
|
8782
|
+
$font: settings.theme.typography[props.description.fontStyle].fontFamily,
|
8783
|
+
$size: settings.theme.typography[props.description.fontStyle].fontSize,
|
8784
|
+
$weight: settings.theme.typography[props.description.fontStyle].fontWeight,
|
8785
|
+
$color: settings.theme.typography[props.description.fontStyle].color,
|
8786
|
+
children: feature.description
|
8787
|
+
}
|
8788
|
+
)
|
8789
|
+
] }),
|
8790
|
+
allocationType === "numeric" && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box, { $textAlign: "right", children: [
|
8791
|
+
props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
8792
|
+
Text,
|
8793
|
+
{
|
8794
|
+
as: Box,
|
8795
|
+
$font: settings.theme.typography[props.allocation.fontStyle].fontFamily,
|
8796
|
+
$size: settings.theme.typography[props.allocation.fontStyle].fontSize,
|
8797
|
+
$weight: settings.theme.typography[props.allocation.fontStyle].fontWeight,
|
8798
|
+
$color: settings.theme.typography[props.allocation.fontStyle].color,
|
8799
|
+
children: typeof allocation === "number" ? `${allocation} ${feature.name}` : `Unlimited ${feature.name}`
|
8800
|
+
}
|
8801
|
+
),
|
8802
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
8803
|
+
Text,
|
8804
|
+
{
|
8805
|
+
as: Box,
|
8806
|
+
$font: settings.theme.typography[props.usage.fontStyle].fontFamily,
|
8807
|
+
$size: settings.theme.typography[props.usage.fontStyle].fontSize,
|
8808
|
+
$weight: settings.theme.typography[props.usage.fontStyle].fontWeight,
|
8809
|
+
$color: settings.theme.typography[props.usage.fontStyle].color,
|
8810
|
+
children: typeof allocation === "number" ? `${usage} of ${allocation} used` : `${usage} used`
|
8811
|
+
}
|
8812
|
+
)
|
8813
|
+
] })
|
8814
|
+
] }),
|
8815
|
+
typeof usage === "number" && typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
8816
|
+
ProgressBar,
|
8817
|
+
{
|
8818
|
+
progress: usage / allocation * 100,
|
8819
|
+
value: usage,
|
8820
|
+
total: allocation,
|
8821
|
+
color: "blue"
|
8822
|
+
}
|
8823
|
+
) })
|
8824
|
+
] })
|
8825
|
+
] }, index)
|
8826
|
+
];
|
8827
|
+
},
|
8828
|
+
[]
|
8829
|
+
) });
|
8830
|
+
});
|
8831
|
+
|
8832
|
+
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
8833
|
+
var import_react10 = require("react");
|
8834
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
8835
|
+
function resolveDesignProps4(props) {
|
8836
|
+
return {
|
8837
|
+
header: {
|
8838
|
+
isVisible: props.header?.isVisible ?? true,
|
8839
|
+
fontStyle: props.header?.fontStyle ?? "heading4",
|
8840
|
+
prefix: props.header?.prefix ?? "Next bill due"
|
8841
|
+
},
|
8842
|
+
price: {
|
8843
|
+
isVisible: props.price?.isVisible ?? true,
|
8844
|
+
fontStyle: props.price?.fontStyle ?? "heading1"
|
8845
|
+
},
|
8846
|
+
contractEndDate: {
|
8847
|
+
isVisible: props.contractEndDate?.isVisible ?? true,
|
8848
|
+
fontStyle: props.contractEndDate?.fontStyle ?? "heading6",
|
8849
|
+
prefix: props.contractEndDate?.prefix ?? "Contract ends"
|
8850
|
+
}
|
8851
|
+
};
|
8852
|
+
}
|
8853
|
+
var UpcomingBill = (0, import_react10.forwardRef)(({ className, ...rest }, ref) => {
|
8854
|
+
const props = resolveDesignProps4(rest);
|
8855
|
+
const { settings } = useEmbed();
|
8856
|
+
const { bill } = (0, import_react10.useMemo)(() => {
|
8857
|
+
return {
|
8858
|
+
bill: {
|
8859
|
+
amount: 200,
|
8860
|
+
period: "monthly",
|
8861
|
+
dueDate: toPrettyDate(/* @__PURE__ */ new Date("2024-06-12")),
|
8862
|
+
endDate: (/* @__PURE__ */ new Date("2025-05-12")).toLocaleDateString()
|
8863
|
+
}
|
8864
|
+
};
|
8865
|
+
}, []);
|
8866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ref, className, children: [
|
8867
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
8868
|
+
Flex,
|
8869
|
+
{
|
8870
|
+
$justifyContent: "space-between",
|
8871
|
+
$alignItems: "center",
|
8872
|
+
$margin: "0 0 0.75rem",
|
8873
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
8874
|
+
Text,
|
8875
|
+
{
|
8876
|
+
$font: settings.theme.typography[props.header.fontStyle].fontFamily,
|
8877
|
+
$size: settings.theme.typography[props.header.fontStyle].fontSize,
|
8878
|
+
$weight: settings.theme.typography[props.header.fontStyle].fontWeight,
|
8879
|
+
$color: settings.theme.typography[props.header.fontStyle].color,
|
8880
|
+
children: [
|
8881
|
+
props.header.prefix,
|
8882
|
+
" ",
|
8883
|
+
bill.dueDate
|
8884
|
+
]
|
8885
|
+
}
|
8886
|
+
)
|
8887
|
+
}
|
8888
|
+
),
|
8889
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
|
8890
|
+
props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
8891
|
+
Text,
|
8892
|
+
{
|
8893
|
+
$font: settings.theme.typography[props.price.fontStyle].fontFamily,
|
8894
|
+
$size: settings.theme.typography[props.price.fontStyle].fontSize,
|
8895
|
+
$weight: settings.theme.typography[props.price.fontStyle].fontWeight,
|
8896
|
+
$color: settings.theme.typography[props.price.fontStyle].color,
|
8897
|
+
$lineHeight: 1,
|
8898
|
+
children: [
|
8899
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
8900
|
+
Text,
|
8901
|
+
{
|
8902
|
+
$size: "0.75em",
|
8903
|
+
$color: settings.theme.typography[props.price.fontStyle].color,
|
8904
|
+
children: "$"
|
8905
|
+
}
|
8906
|
+
),
|
8907
|
+
bill.amount
|
8908
|
+
]
|
8909
|
+
}
|
8910
|
+
) }),
|
8911
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { $maxWidth: "140px", $lineHeight: "1", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
8912
|
+
Text,
|
8913
|
+
{
|
8914
|
+
$font: settings.theme.typography[props.contractEndDate.fontStyle].fontFamily,
|
8915
|
+
$size: settings.theme.typography[props.contractEndDate.fontStyle].fontSize,
|
8916
|
+
$weight: settings.theme.typography[props.contractEndDate.fontStyle].fontWeight,
|
8917
|
+
$color: settings.theme.typography[props.contractEndDate.fontStyle].color,
|
8918
|
+
children: [
|
8919
|
+
"Estimated monthly bill.",
|
8920
|
+
props.contractEndDate.isVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
8921
|
+
"\xA0",
|
8922
|
+
props.contractEndDate.prefix,
|
8923
|
+
" ",
|
8924
|
+
bill.endDate,
|
8925
|
+
"."
|
8926
|
+
] })
|
8927
|
+
]
|
8928
|
+
}
|
8929
|
+
) })
|
8930
|
+
] })
|
8931
|
+
] });
|
8932
|
+
});
|
8933
|
+
|
8934
|
+
// src/components/elements/payment-method/PaymentMethod.tsx
|
8935
|
+
var import_react11 = require("react");
|
8936
|
+
var import_react_dom2 = require("react-dom");
|
8937
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
8938
|
+
var resolveDesignProps5 = (props) => {
|
8939
|
+
return {
|
8940
|
+
header: {
|
8941
|
+
isVisible: props.header?.isVisible ?? true,
|
8942
|
+
fontStyle: props.header?.fontStyle ?? "heading4"
|
8943
|
+
},
|
8944
|
+
functions: {
|
8945
|
+
allowEdit: props.functions?.allowEdit ?? true
|
8946
|
+
}
|
8947
|
+
};
|
7820
8948
|
};
|
8949
|
+
var PaymentMethod = (0, import_react11.forwardRef)(({ children, className, portal, ...rest }, ref) => {
|
8950
|
+
const props = resolveDesignProps5(rest);
|
8951
|
+
const { settings, layout, setLayout } = useEmbed();
|
8952
|
+
const paymentMethod = (0, import_react11.useMemo)(() => {
|
8953
|
+
const cardNumber = "4512";
|
8954
|
+
const expirationDate = "2024-12-22";
|
8955
|
+
const timeToExpiration = Math.round(
|
8956
|
+
+new Date(expirationDate) - +/* @__PURE__ */ new Date()
|
8957
|
+
);
|
8958
|
+
const monthsToExpiration = Math.round(
|
8959
|
+
timeToExpiration / (1e3 * 60 * 60 * 24 * 30)
|
8960
|
+
);
|
8961
|
+
return {
|
8962
|
+
cardNumber,
|
8963
|
+
monthsToExpiration
|
8964
|
+
};
|
8965
|
+
}, []);
|
8966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { ref, className, children: [
|
8967
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
8968
|
+
Flex,
|
8969
|
+
{
|
8970
|
+
$justifyContent: "space-between",
|
8971
|
+
$alignItems: "center",
|
8972
|
+
$margin: "0 0 1rem",
|
8973
|
+
children: [
|
8974
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
8975
|
+
Text,
|
8976
|
+
{
|
8977
|
+
$font: settings.theme.typography[props.header.fontStyle].fontFamily,
|
8978
|
+
$size: settings.theme.typography[props.header.fontStyle].fontSize,
|
8979
|
+
$weight: settings.theme.typography[props.header.fontStyle].fontWeight,
|
8980
|
+
$color: settings.theme.typography[props.header.fontStyle].color,
|
8981
|
+
children: "Payment Method"
|
8982
|
+
}
|
8983
|
+
),
|
8984
|
+
Math.abs(paymentMethod.monthsToExpiration) < 4 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
8985
|
+
Text,
|
8986
|
+
{
|
8987
|
+
$font: settings.theme.typography.text.fontFamily,
|
8988
|
+
$size: 14,
|
8989
|
+
$color: "#DB6769",
|
8990
|
+
children: paymentMethod.monthsToExpiration > 0 ? `Expires in ${paymentMethod.monthsToExpiration} mo` : "Expired"
|
8991
|
+
}
|
8992
|
+
)
|
8993
|
+
]
|
8994
|
+
}
|
8995
|
+
),
|
8996
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
8997
|
+
Flex,
|
8998
|
+
{
|
8999
|
+
$justifyContent: "space-between",
|
9000
|
+
$alignItems: "center",
|
9001
|
+
$margin: "0 0 1rem",
|
9002
|
+
$background: `${hexToHSL(settings.theme.card.background).l > 50 ? darken(settings.theme.card.background, 10) : lighten(settings.theme.card.background, 20)}`,
|
9003
|
+
$padding: "0.375rem 1rem",
|
9004
|
+
$borderRadius: "9999px",
|
9005
|
+
children: [
|
9006
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { $font: settings.theme.typography.text.fontFamily, $size: 14, children: [
|
9007
|
+
"\u{1F4B3} Card ending in ",
|
9008
|
+
paymentMethod.cardNumber
|
9009
|
+
] }),
|
9010
|
+
props.functions.allowEdit && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
9011
|
+
Text,
|
9012
|
+
{
|
9013
|
+
tabIndex: 0,
|
9014
|
+
onClick: () => {
|
9015
|
+
if (layout !== "payment")
|
9016
|
+
return;
|
9017
|
+
setLayout("payment");
|
9018
|
+
},
|
9019
|
+
$font: settings.theme.typography.link.fontFamily,
|
9020
|
+
$size: settings.theme.typography.link.fontSize,
|
9021
|
+
$weight: settings.theme.typography.link.fontWeight,
|
9022
|
+
$color: settings.theme.typography.link.color,
|
9023
|
+
children: "Edit"
|
9024
|
+
}
|
9025
|
+
)
|
9026
|
+
]
|
9027
|
+
}
|
9028
|
+
),
|
9029
|
+
layout === "payment" && (0, import_react_dom2.createPortal)(
|
9030
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
9031
|
+
Box,
|
9032
|
+
{
|
9033
|
+
$position: "absolute",
|
9034
|
+
$top: "50%",
|
9035
|
+
$left: "50%",
|
9036
|
+
$zIndex: "999999",
|
9037
|
+
$transform: "translate(-50%, -50%)",
|
9038
|
+
$width: "100%",
|
9039
|
+
$height: "100%",
|
9040
|
+
$backgroundColor: "#B5B5B580",
|
9041
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
9042
|
+
Flex,
|
9043
|
+
{
|
9044
|
+
$position: "relative",
|
9045
|
+
$top: "50%",
|
9046
|
+
$left: "50%",
|
9047
|
+
$transform: "translate(-50%, -50%)",
|
9048
|
+
$width: "956px",
|
9049
|
+
$height: "700px",
|
9050
|
+
$backgroundColor: "#FBFBFB",
|
9051
|
+
$borderRadius: "8px",
|
9052
|
+
$boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
|
9053
|
+
id: "select-plan-dialog",
|
9054
|
+
role: "dialog",
|
9055
|
+
"aria-labelledby": "select-plan-dialog-label",
|
9056
|
+
"aria-modal": "true",
|
9057
|
+
children: [
|
9058
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
9059
|
+
Box,
|
9060
|
+
{
|
9061
|
+
$position: "absolute",
|
9062
|
+
$top: "0.25rem",
|
9063
|
+
$right: "0.75rem",
|
9064
|
+
$cursor: "pointer",
|
9065
|
+
onClick: () => {
|
9066
|
+
setLayout("portal");
|
9067
|
+
},
|
9068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } })
|
9069
|
+
}
|
9070
|
+
),
|
9071
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
9072
|
+
Text,
|
9073
|
+
{
|
9074
|
+
as: "h1",
|
9075
|
+
id: "select-plan-dialog-label",
|
9076
|
+
$size: 24,
|
9077
|
+
$weight: 800,
|
9078
|
+
children: "Add payment method"
|
9079
|
+
}
|
9080
|
+
) })
|
9081
|
+
]
|
9082
|
+
}
|
9083
|
+
)
|
9084
|
+
}
|
9085
|
+
),
|
9086
|
+
portal || document.body
|
9087
|
+
)
|
9088
|
+
] });
|
9089
|
+
});
|
9090
|
+
|
9091
|
+
// src/components/elements/invoices/Invoices.tsx
|
9092
|
+
var import_react12 = require("react");
|
9093
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
9094
|
+
function resolveDesignProps6(props) {
|
9095
|
+
return {
|
9096
|
+
header: {
|
9097
|
+
isVisible: props.header?.isVisible ?? true,
|
9098
|
+
fontStyle: props.header?.fontStyle ?? "heading4"
|
9099
|
+
},
|
9100
|
+
date: {
|
9101
|
+
isVisible: props.date?.isVisible ?? true,
|
9102
|
+
fontStyle: props.date?.fontStyle ?? "link"
|
9103
|
+
},
|
9104
|
+
amount: {
|
9105
|
+
isVisible: props.amount?.isVisible ?? true,
|
9106
|
+
fontStyle: props.amount?.fontStyle ?? "text"
|
9107
|
+
},
|
9108
|
+
limit: {
|
9109
|
+
isVisible: props.limit?.isVisible ?? true,
|
9110
|
+
number: props.limit?.number ?? 2
|
9111
|
+
},
|
9112
|
+
collapse: {
|
9113
|
+
isVisible: props.collapse?.isVisible ?? true,
|
9114
|
+
fontStyle: props.collapse?.fontStyle ?? "link"
|
9115
|
+
}
|
9116
|
+
};
|
9117
|
+
}
|
9118
|
+
var Invoices = (0, import_react12.forwardRef)(({ className, ...rest }, ref) => {
|
9119
|
+
const props = resolveDesignProps6(rest);
|
9120
|
+
const { settings } = useEmbed();
|
9121
|
+
const { invoices } = (0, import_react12.useMemo)(() => {
|
9122
|
+
return {
|
9123
|
+
invoices: [
|
9124
|
+
{
|
9125
|
+
date: toPrettyDate(/* @__PURE__ */ new Date("2024-05-12")),
|
9126
|
+
amount: 200
|
9127
|
+
},
|
9128
|
+
{
|
9129
|
+
date: toPrettyDate(/* @__PURE__ */ new Date("2024-04-12")),
|
9130
|
+
amount: 200
|
9131
|
+
}
|
9132
|
+
]
|
9133
|
+
};
|
9134
|
+
}, []);
|
9135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
9136
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
9137
|
+
Text,
|
9138
|
+
{
|
9139
|
+
$font: settings.theme.typography[props.header.fontStyle].fontFamily,
|
9140
|
+
$size: settings.theme.typography[props.header.fontStyle].fontSize,
|
9141
|
+
$weight: settings.theme.typography[props.header.fontStyle].fontWeight,
|
9142
|
+
$color: settings.theme.typography[props.header.fontStyle].color,
|
9143
|
+
children: "Invoices"
|
9144
|
+
}
|
9145
|
+
) }),
|
9146
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(
|
9147
|
+
0,
|
9148
|
+
props.limit.isVisible && props.limit.number || invoices.length
|
9149
|
+
).map(({ date, amount }, index) => {
|
9150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $justifyContent: "space-between", children: [
|
9151
|
+
props.date.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
9152
|
+
Text,
|
9153
|
+
{
|
9154
|
+
$font: settings.theme.typography[props.date.fontStyle].fontFamily,
|
9155
|
+
$size: settings.theme.typography[props.date.fontStyle].fontSize,
|
9156
|
+
$weight: settings.theme.typography[props.date.fontStyle].fontWeight,
|
9157
|
+
$color: settings.theme.typography[props.date.fontStyle].color,
|
9158
|
+
children: toPrettyDate(date)
|
9159
|
+
}
|
9160
|
+
),
|
9161
|
+
props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
9162
|
+
Text,
|
9163
|
+
{
|
9164
|
+
$font: settings.theme.typography[props.amount.fontStyle].fontFamily,
|
9165
|
+
$size: settings.theme.typography[props.amount.fontStyle].fontSize,
|
9166
|
+
$weight: settings.theme.typography[props.amount.fontStyle].fontWeight,
|
9167
|
+
$color: settings.theme.typography[props.amount.fontStyle].color,
|
9168
|
+
children: [
|
9169
|
+
"$",
|
9170
|
+
amount
|
9171
|
+
]
|
9172
|
+
}
|
9173
|
+
)
|
9174
|
+
] }, index);
|
9175
|
+
}) }),
|
9176
|
+
props.collapse.isVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
9177
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon2, { name: "chevron-down", style: { color: "#D0D0D0" } }),
|
9178
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
9179
|
+
Text,
|
9180
|
+
{
|
9181
|
+
$font: settings.theme.typography[props.collapse.fontStyle].fontFamily,
|
9182
|
+
$size: settings.theme.typography[props.collapse.fontStyle].fontSize,
|
9183
|
+
$weight: settings.theme.typography[props.collapse.fontStyle].fontWeight,
|
9184
|
+
$color: settings.theme.typography[props.collapse.fontStyle].color,
|
9185
|
+
children: "See all"
|
9186
|
+
}
|
9187
|
+
)
|
9188
|
+
] })
|
9189
|
+
] }) });
|
9190
|
+
});
|
9191
|
+
|
9192
|
+
// src/components/embed/ComponentTree.tsx
|
9193
|
+
var import_react14 = require("react");
|
7821
9194
|
|
7822
9195
|
// src/components/embed/renderer.ts
|
9196
|
+
var import_react13 = require("react");
|
7823
9197
|
var components = {
|
7824
9198
|
Card,
|
9199
|
+
PlanManager,
|
7825
9200
|
IncludedFeatures,
|
7826
|
-
|
9201
|
+
UpcomingBill,
|
9202
|
+
PaymentMethod,
|
9203
|
+
MeteredFeatures
|
7827
9204
|
};
|
7828
9205
|
function createRenderer(options) {
|
7829
9206
|
const { useFallback = true } = options || {};
|
@@ -7840,13 +9217,14 @@ function createRenderer(options) {
|
|
7840
9217
|
if (!component) {
|
7841
9218
|
return null;
|
7842
9219
|
}
|
7843
|
-
const { className,
|
7844
|
-
const resolvedProps =
|
9220
|
+
const { className, ...rest } = props;
|
9221
|
+
const resolvedProps = component === "div" ? rest : props;
|
7845
9222
|
const resolvedChildren = children.map(renderNode);
|
7846
|
-
return (0,
|
9223
|
+
return (0, import_react13.createElement)(
|
7847
9224
|
component,
|
7848
9225
|
{
|
7849
|
-
|
9226
|
+
className,
|
9227
|
+
...component !== "div" && { resolvedProps },
|
7850
9228
|
...Object.keys(custom).length > 0 && { custom },
|
7851
9229
|
key: index
|
7852
9230
|
},
|
@@ -7856,30 +9234,30 @@ function createRenderer(options) {
|
|
7856
9234
|
}
|
7857
9235
|
|
7858
9236
|
// src/components/embed/ComponentTree.tsx
|
7859
|
-
var
|
9237
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
7860
9238
|
var ComponentTree = () => {
|
7861
|
-
const [children, setChildren] = (0,
|
9239
|
+
const [children, setChildren] = (0, import_react14.useState)("Loading");
|
7862
9240
|
const { error, nodes } = useEmbed();
|
7863
|
-
(0,
|
9241
|
+
(0, import_react14.useEffect)(() => {
|
7864
9242
|
const renderer = createRenderer();
|
7865
9243
|
setChildren(nodes.map(renderer));
|
7866
9244
|
}, [nodes]);
|
7867
9245
|
if (error) {
|
7868
|
-
return /* @__PURE__ */ (0,
|
9246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: error.message });
|
7869
9247
|
}
|
7870
|
-
return /* @__PURE__ */ (0,
|
9248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
|
7871
9249
|
};
|
7872
9250
|
|
7873
9251
|
// src/components/embed/Embed.tsx
|
7874
|
-
var
|
7875
|
-
var SchematicEmbed = ({ id, accessToken }) => {
|
9252
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
9253
|
+
var SchematicEmbed = ({ id, accessToken, apiConfig }) => {
|
7876
9254
|
if (accessToken?.length === 0) {
|
7877
|
-
return /* @__PURE__ */ (0,
|
9255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: "Please provide an access token." });
|
7878
9256
|
}
|
7879
9257
|
if (!accessToken?.startsWith("token_")) {
|
7880
|
-
return /* @__PURE__ */ (0,
|
9258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
|
7881
9259
|
}
|
7882
|
-
return /* @__PURE__ */ (0,
|
9260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ComponentTree, {}) });
|
7883
9261
|
};
|
7884
9262
|
/*! Bundled license information:
|
7885
9263
|
|