@schematichq/schematic-components 0.3.9 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schematic-components.cjs.js +228 -156
- package/dist/schematic-components.d.ts +192 -19
- package/dist/schematic-components.esm.js +228 -156
- package/package.json +1 -1
|
@@ -2601,7 +2601,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
2601
2601
|
}
|
|
2602
2602
|
stripe._registerWrapper({
|
|
2603
2603
|
name: "stripe-js",
|
|
2604
|
-
version: "4.
|
|
2604
|
+
version: "4.8.0",
|
|
2605
2605
|
startTime
|
|
2606
2606
|
});
|
|
2607
2607
|
};
|
|
@@ -7224,9 +7224,6 @@ function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator
|
|
|
7224
7224
|
return json;
|
|
7225
7225
|
}
|
|
7226
7226
|
return {
|
|
7227
|
-
prices: json["Prices"].map(
|
|
7228
|
-
BillingPriceResponseDataFromJSON
|
|
7229
|
-
),
|
|
7230
7227
|
accountId: json["account_id"],
|
|
7231
7228
|
createdAt: new Date(json["created_at"]),
|
|
7232
7229
|
currency: json["currency"],
|
|
@@ -7234,6 +7231,9 @@ function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator
|
|
|
7234
7231
|
externalId: json["external_id"],
|
|
7235
7232
|
name: json["name"],
|
|
7236
7233
|
price: json["price"],
|
|
7234
|
+
prices: json["prices"].map(
|
|
7235
|
+
BillingPriceResponseDataFromJSON
|
|
7236
|
+
),
|
|
7237
7237
|
productId: json["product_id"],
|
|
7238
7238
|
quantity: json["quantity"],
|
|
7239
7239
|
updatedAt: new Date(json["updated_at"])
|
|
@@ -7249,7 +7249,6 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
|
|
|
7249
7249
|
return json;
|
|
7250
7250
|
}
|
|
7251
7251
|
return {
|
|
7252
|
-
accountId: json["account_id"],
|
|
7253
7252
|
createdAt: new Date(json["created_at"]),
|
|
7254
7253
|
currency: json["currency"],
|
|
7255
7254
|
environmentId: json["environment_id"],
|
|
@@ -7274,16 +7273,111 @@ function BillingSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
7274
7273
|
return json;
|
|
7275
7274
|
}
|
|
7276
7275
|
return {
|
|
7276
|
+
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
7277
|
+
createdAt: new Date(json["created_at"]),
|
|
7277
7278
|
currency: json["currency"],
|
|
7279
|
+
customerExternalId: json["customer_external_id"],
|
|
7278
7280
|
expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
|
|
7279
|
-
externalId: json["external_id"],
|
|
7280
7281
|
id: json["id"],
|
|
7281
7282
|
interval: json["interval"],
|
|
7282
|
-
|
|
7283
|
+
metadata: json["metadata"] == null ? void 0 : json["metadata"],
|
|
7284
|
+
periodEnd: json["period_end"],
|
|
7285
|
+
periodStart: json["period_start"],
|
|
7286
|
+
status: json["status"],
|
|
7287
|
+
subscriptionExternalId: json["subscription_external_id"],
|
|
7288
|
+
totalPrice: json["total_price"]
|
|
7289
|
+
};
|
|
7290
|
+
}
|
|
7291
|
+
|
|
7292
|
+
// src/api/models/InvoiceResponseData.ts
|
|
7293
|
+
function InvoiceResponseDataFromJSON(json) {
|
|
7294
|
+
return InvoiceResponseDataFromJSONTyped(json, false);
|
|
7295
|
+
}
|
|
7296
|
+
function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
7297
|
+
if (json == null) {
|
|
7298
|
+
return json;
|
|
7299
|
+
}
|
|
7300
|
+
return {
|
|
7301
|
+
amountDue: json["amount_due"],
|
|
7302
|
+
amountPaid: json["amount_paid"],
|
|
7303
|
+
amountRemaining: json["amount_remaining"],
|
|
7304
|
+
collectionMethod: json["collection_method"],
|
|
7305
|
+
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
7306
|
+
createdAt: new Date(json["created_at"]),
|
|
7307
|
+
currency: json["currency"],
|
|
7308
|
+
customerExternalId: json["customer_external_id"],
|
|
7309
|
+
dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
|
|
7310
|
+
environmentId: json["environment_id"],
|
|
7311
|
+
externalId: json["external_id"] == null ? void 0 : json["external_id"],
|
|
7312
|
+
id: json["id"],
|
|
7313
|
+
paymentMethodExternalId: json["payment_method_external_id"] == null ? void 0 : json["payment_method_external_id"],
|
|
7314
|
+
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
|
7315
|
+
subtotal: json["subtotal"],
|
|
7316
|
+
updatedAt: new Date(json["updated_at"]),
|
|
7317
|
+
url: json["url"] == null ? void 0 : json["url"]
|
|
7318
|
+
};
|
|
7319
|
+
}
|
|
7320
|
+
|
|
7321
|
+
// src/api/models/PaymentMethodResponseData.ts
|
|
7322
|
+
function PaymentMethodResponseDataFromJSON(json) {
|
|
7323
|
+
return PaymentMethodResponseDataFromJSONTyped(json, false);
|
|
7324
|
+
}
|
|
7325
|
+
function PaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
7326
|
+
if (json == null) {
|
|
7327
|
+
return json;
|
|
7328
|
+
}
|
|
7329
|
+
return {
|
|
7330
|
+
accountLast4: json["account_last4"] == null ? void 0 : json["account_last4"],
|
|
7331
|
+
accountName: json["account_name"] == null ? void 0 : json["account_name"],
|
|
7332
|
+
bankName: json["bank_name"] == null ? void 0 : json["bank_name"],
|
|
7333
|
+
billingEmail: json["billing_email"] == null ? void 0 : json["billing_email"],
|
|
7334
|
+
billingName: json["billing_name"] == null ? void 0 : json["billing_name"],
|
|
7335
|
+
cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
|
|
7336
|
+
cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
|
|
7337
|
+
cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
|
|
7338
|
+
cardLast4: json["card_last4"] == null ? void 0 : json["card_last4"],
|
|
7339
|
+
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
7340
|
+
createdAt: new Date(json["created_at"]),
|
|
7341
|
+
customerExternalId: json["customer_external_id"],
|
|
7342
|
+
environmentId: json["environment_id"],
|
|
7343
|
+
externalId: json["external_id"],
|
|
7344
|
+
id: json["id"],
|
|
7345
|
+
paymentMethodType: json["payment_method_type"],
|
|
7346
|
+
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
|
7283
7347
|
updatedAt: new Date(json["updated_at"])
|
|
7284
7348
|
};
|
|
7285
7349
|
}
|
|
7286
7350
|
|
|
7351
|
+
// src/api/models/BillingSubscriptionView.ts
|
|
7352
|
+
function BillingSubscriptionViewFromJSON(json) {
|
|
7353
|
+
return BillingSubscriptionViewFromJSONTyped(json, false);
|
|
7354
|
+
}
|
|
7355
|
+
function BillingSubscriptionViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
7356
|
+
if (json == null) {
|
|
7357
|
+
return json;
|
|
7358
|
+
}
|
|
7359
|
+
return {
|
|
7360
|
+
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
7361
|
+
createdAt: new Date(json["created_at"]),
|
|
7362
|
+
currency: json["currency"],
|
|
7363
|
+
customerExternalId: json["customer_external_id"],
|
|
7364
|
+
expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
|
|
7365
|
+
id: json["id"],
|
|
7366
|
+
interval: json["interval"],
|
|
7367
|
+
latestInvoice: json["latest_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["latest_invoice"]),
|
|
7368
|
+
metadata: json["metadata"] == null ? void 0 : json["metadata"],
|
|
7369
|
+
paymentMethod: json["payment_method"] == null ? void 0 : PaymentMethodResponseDataFromJSON(json["payment_method"]),
|
|
7370
|
+
periodEnd: json["period_end"],
|
|
7371
|
+
periodStart: json["period_start"],
|
|
7372
|
+
products: json["products"].map(
|
|
7373
|
+
BillingProductForSubscriptionResponseDataFromJSON
|
|
7374
|
+
),
|
|
7375
|
+
status: json["status"],
|
|
7376
|
+
subscriptionExternalId: json["subscription_external_id"],
|
|
7377
|
+
totalPrice: json["total_price"]
|
|
7378
|
+
};
|
|
7379
|
+
}
|
|
7380
|
+
|
|
7287
7381
|
// src/api/models/ChangeSubscriptionRequestBody.ts
|
|
7288
7382
|
function ChangeSubscriptionRequestBodyToJSON(value) {
|
|
7289
7383
|
if (value == null) {
|
|
@@ -7435,7 +7529,7 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7435
7529
|
CompanyPlanWithBillingSubViewFromJSON
|
|
7436
7530
|
),
|
|
7437
7531
|
billingSubscriptions: json["billing_subscriptions"].map(
|
|
7438
|
-
|
|
7532
|
+
BillingSubscriptionViewFromJSON
|
|
7439
7533
|
),
|
|
7440
7534
|
createdAt: new Date(json["created_at"]),
|
|
7441
7535
|
entityTraits: json["entity_traits"].map(
|
|
@@ -7743,65 +7837,6 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7743
7837
|
};
|
|
7744
7838
|
}
|
|
7745
7839
|
|
|
7746
|
-
// src/api/models/InvoiceResponseData.ts
|
|
7747
|
-
function InvoiceResponseDataFromJSON(json) {
|
|
7748
|
-
return InvoiceResponseDataFromJSONTyped(json, false);
|
|
7749
|
-
}
|
|
7750
|
-
function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
7751
|
-
if (json == null) {
|
|
7752
|
-
return json;
|
|
7753
|
-
}
|
|
7754
|
-
return {
|
|
7755
|
-
amountDue: json["amount_due"],
|
|
7756
|
-
amountPaid: json["amount_paid"],
|
|
7757
|
-
amountRemaining: json["amount_remaining"],
|
|
7758
|
-
collectionMethod: json["collection_method"],
|
|
7759
|
-
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
7760
|
-
createdAt: new Date(json["created_at"]),
|
|
7761
|
-
currency: json["currency"],
|
|
7762
|
-
customerExternalId: json["customer_external_id"],
|
|
7763
|
-
dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
|
|
7764
|
-
environmentId: json["environment_id"],
|
|
7765
|
-
externalId: json["external_id"] == null ? void 0 : json["external_id"],
|
|
7766
|
-
id: json["id"],
|
|
7767
|
-
paymentMethodExternalId: json["payment_method_external_id"] == null ? void 0 : json["payment_method_external_id"],
|
|
7768
|
-
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
|
7769
|
-
subtotal: json["subtotal"],
|
|
7770
|
-
updatedAt: new Date(json["updated_at"]),
|
|
7771
|
-
url: json["url"] == null ? void 0 : json["url"]
|
|
7772
|
-
};
|
|
7773
|
-
}
|
|
7774
|
-
|
|
7775
|
-
// src/api/models/PaymentMethodResponseData.ts
|
|
7776
|
-
function PaymentMethodResponseDataFromJSON(json) {
|
|
7777
|
-
return PaymentMethodResponseDataFromJSONTyped(json, false);
|
|
7778
|
-
}
|
|
7779
|
-
function PaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
7780
|
-
if (json == null) {
|
|
7781
|
-
return json;
|
|
7782
|
-
}
|
|
7783
|
-
return {
|
|
7784
|
-
accountLast4: json["account_last4"] == null ? void 0 : json["account_last4"],
|
|
7785
|
-
accountName: json["account_name"] == null ? void 0 : json["account_name"],
|
|
7786
|
-
bankName: json["bank_name"] == null ? void 0 : json["bank_name"],
|
|
7787
|
-
billingEmail: json["billing_email"] == null ? void 0 : json["billing_email"],
|
|
7788
|
-
billingName: json["billing_name"] == null ? void 0 : json["billing_name"],
|
|
7789
|
-
cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
|
|
7790
|
-
cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
|
|
7791
|
-
cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
|
|
7792
|
-
cardLast4: json["card_last4"] == null ? void 0 : json["card_last4"],
|
|
7793
|
-
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
7794
|
-
createdAt: new Date(json["created_at"]),
|
|
7795
|
-
customerExternalId: json["customer_external_id"],
|
|
7796
|
-
environmentId: json["environment_id"],
|
|
7797
|
-
externalId: json["external_id"],
|
|
7798
|
-
id: json["id"],
|
|
7799
|
-
paymentMethodType: json["payment_method_type"],
|
|
7800
|
-
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
|
7801
|
-
updatedAt: new Date(json["updated_at"])
|
|
7802
|
-
};
|
|
7803
|
-
}
|
|
7804
|
-
|
|
7805
7840
|
// src/api/models/CompanySubscriptionResponseData.ts
|
|
7806
7841
|
function CompanySubscriptionResponseDataFromJSON(json) {
|
|
7807
7842
|
return CompanySubscriptionResponseDataFromJSONTyped(json, false);
|
|
@@ -7826,6 +7861,19 @@ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
7826
7861
|
};
|
|
7827
7862
|
}
|
|
7828
7863
|
|
|
7864
|
+
// src/api/models/ComponentCapabilities.ts
|
|
7865
|
+
function ComponentCapabilitiesFromJSON(json) {
|
|
7866
|
+
return ComponentCapabilitiesFromJSONTyped(json, false);
|
|
7867
|
+
}
|
|
7868
|
+
function ComponentCapabilitiesFromJSONTyped(json, ignoreDiscriminator) {
|
|
7869
|
+
if (json == null) {
|
|
7870
|
+
return json;
|
|
7871
|
+
}
|
|
7872
|
+
return {
|
|
7873
|
+
checkout: json["checkout"]
|
|
7874
|
+
};
|
|
7875
|
+
}
|
|
7876
|
+
|
|
7829
7877
|
// src/api/models/ComponentResponseData.ts
|
|
7830
7878
|
function ComponentResponseDataFromJSON(json) {
|
|
7831
7879
|
return ComponentResponseDataFromJSONTyped(json, false);
|
|
@@ -7904,9 +7952,13 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7904
7952
|
return json;
|
|
7905
7953
|
}
|
|
7906
7954
|
return {
|
|
7955
|
+
activeAddOns: json["active_add_ons"].map(
|
|
7956
|
+
CompanyPlanDetailResponseDataFromJSON
|
|
7957
|
+
),
|
|
7907
7958
|
activePlans: json["active_plans"].map(
|
|
7908
7959
|
CompanyPlanDetailResponseDataFromJSON
|
|
7909
7960
|
),
|
|
7961
|
+
capabilities: json["capabilities"] == null ? void 0 : ComponentCapabilitiesFromJSON(json["capabilities"]),
|
|
7910
7962
|
company: json["company"] == null ? void 0 : CompanyDetailResponseDataFromJSON(json["company"]),
|
|
7911
7963
|
component: json["component"] == null ? void 0 : ComponentResponseDataFromJSON(json["component"]),
|
|
7912
7964
|
featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"]),
|
|
@@ -8711,6 +8763,7 @@ function parseEditorState(data) {
|
|
|
8711
8763
|
var EmbedContext = createContext({
|
|
8712
8764
|
api: null,
|
|
8713
8765
|
data: {
|
|
8766
|
+
activeAddOns: [],
|
|
8714
8767
|
activePlans: []
|
|
8715
8768
|
},
|
|
8716
8769
|
nodes: [],
|
|
@@ -8741,6 +8794,7 @@ var EmbedProvider = ({
|
|
|
8741
8794
|
return {
|
|
8742
8795
|
api: null,
|
|
8743
8796
|
data: {
|
|
8797
|
+
activeAddOns: [],
|
|
8744
8798
|
activePlans: []
|
|
8745
8799
|
},
|
|
8746
8800
|
nodes: [],
|
|
@@ -8842,7 +8896,7 @@ var EmbedProvider = ({
|
|
|
8842
8896
|
useEffect(() => {
|
|
8843
8897
|
if (accessToken) {
|
|
8844
8898
|
const { headers = {} } = apiConfig ?? {};
|
|
8845
|
-
headers["X-Schematic-Components-Version"] = "0.3.
|
|
8899
|
+
headers["X-Schematic-Components-Version"] = "0.3.11";
|
|
8846
8900
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
8847
8901
|
const config = new Configuration({
|
|
8848
8902
|
...apiConfig,
|
|
@@ -9906,7 +9960,8 @@ var CheckoutDialog = () => {
|
|
|
9906
9960
|
document.body.style.overflow = "";
|
|
9907
9961
|
};
|
|
9908
9962
|
}, []);
|
|
9909
|
-
const
|
|
9963
|
+
const canUpdateSubscription = api && selectedPlan && (selectedPlan.id !== currentPlan?.id || planPeriod !== currentPlan.planPeriod) && !isLoading;
|
|
9964
|
+
const canCheckout = canUpdateSubscription && (paymentMethod && !showPaymentForm || paymentMethodId);
|
|
9910
9965
|
return /* @__PURE__ */ jsxs6(Modal, { size: "lg", children: [
|
|
9911
9966
|
/* @__PURE__ */ jsx9(ModalHeader, { bordered: true, children: /* @__PURE__ */ jsxs6(Flex, { $gap: "1rem", children: [
|
|
9912
9967
|
/* @__PURE__ */ jsxs6(Flex, { $gap: "0.5rem", $alignItems: "center", children: [
|
|
@@ -10427,7 +10482,7 @@ var CheckoutDialog = () => {
|
|
|
10427
10482
|
/* @__PURE__ */ jsx9(
|
|
10428
10483
|
Flex,
|
|
10429
10484
|
{
|
|
10430
|
-
...
|
|
10485
|
+
...canCheckout && {
|
|
10431
10486
|
$opacity: "0.625",
|
|
10432
10487
|
$textDecoration: "line-through"
|
|
10433
10488
|
},
|
|
@@ -10460,7 +10515,7 @@ var CheckoutDialog = () => {
|
|
|
10460
10515
|
]
|
|
10461
10516
|
}
|
|
10462
10517
|
),
|
|
10463
|
-
|
|
10518
|
+
canCheckout && /* @__PURE__ */ jsxs6(Box, { $marginBottom: "1rem", children: [
|
|
10464
10519
|
/* @__PURE__ */ jsx9(
|
|
10465
10520
|
Box,
|
|
10466
10521
|
{
|
|
@@ -10653,7 +10708,7 @@ var CheckoutDialog = () => {
|
|
|
10653
10708
|
EmbedButton,
|
|
10654
10709
|
{
|
|
10655
10710
|
isLoading,
|
|
10656
|
-
...
|
|
10711
|
+
...canUpdateSubscription ? {
|
|
10657
10712
|
onClick: async () => {
|
|
10658
10713
|
if (!data.component?.id) {
|
|
10659
10714
|
return;
|
|
@@ -10682,9 +10737,9 @@ var CheckoutDialog = () => {
|
|
|
10682
10737
|
) : /* @__PURE__ */ jsx9(
|
|
10683
10738
|
EmbedButton,
|
|
10684
10739
|
{
|
|
10685
|
-
disabled: isLoading || !
|
|
10740
|
+
disabled: isLoading || !canCheckout,
|
|
10686
10741
|
isLoading,
|
|
10687
|
-
...
|
|
10742
|
+
...canCheckout && { onClick: checkout },
|
|
10688
10743
|
children: "Pay now"
|
|
10689
10744
|
}
|
|
10690
10745
|
),
|
|
@@ -10964,7 +11019,9 @@ function resolveDesignProps(props) {
|
|
|
10964
11019
|
usage: {
|
|
10965
11020
|
isVisible: props.usage?.isVisible ?? true,
|
|
10966
11021
|
fontStyle: props.usage?.fontStyle ?? "heading6"
|
|
10967
|
-
}
|
|
11022
|
+
},
|
|
11023
|
+
// there is a typescript bug with `RecursivePartial` so we must cast to `string[] | undefined`
|
|
11024
|
+
visibleFeatures: props.visibleFeatures
|
|
10968
11025
|
};
|
|
10969
11026
|
}
|
|
10970
11027
|
var IncludedFeatures = forwardRef5(({ className, ...rest }, ref) => {
|
|
@@ -10974,7 +11031,16 @@ var IncludedFeatures = forwardRef5(({ className, ...rest }, ref) => {
|
|
|
10974
11031
|
const elements = useRef3([]);
|
|
10975
11032
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
10976
11033
|
const isLightBackground = useIsLightBackground();
|
|
10977
|
-
const
|
|
11034
|
+
const featureUsage = props.visibleFeatures ? props.visibleFeatures.reduce((acc, id) => {
|
|
11035
|
+
const mappedFeatureUsage = data.featureUsage?.features.find(
|
|
11036
|
+
(usage) => usage.feature?.id === id
|
|
11037
|
+
);
|
|
11038
|
+
if (mappedFeatureUsage) {
|
|
11039
|
+
acc.push(mappedFeatureUsage);
|
|
11040
|
+
}
|
|
11041
|
+
return acc;
|
|
11042
|
+
}, []) : data.featureUsage?.features || [];
|
|
11043
|
+
const shouldShowFeatures = featureUsage.length > 0 || data.company?.plan || (data.company?.addOns ?? []).length > 0 || false;
|
|
10978
11044
|
if (!shouldShowFeatures) {
|
|
10979
11045
|
return null;
|
|
10980
11046
|
}
|
|
@@ -10997,82 +11063,76 @@ var IncludedFeatures = forwardRef5(({ className, ...rest }, ref) => {
|
|
|
10997
11063
|
children: props.header.text
|
|
10998
11064
|
}
|
|
10999
11065
|
) }),
|
|
11000
|
-
(
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11066
|
+
featureUsage.map(({ allocation, feature, usage }, index) => {
|
|
11067
|
+
return /* @__PURE__ */ jsxs8(
|
|
11068
|
+
Flex,
|
|
11069
|
+
{
|
|
11070
|
+
ref: (el) => el && elements.current.push(el),
|
|
11071
|
+
$flexWrap: "wrap",
|
|
11072
|
+
$justifyContent: "space-between",
|
|
11073
|
+
$alignItems: "center",
|
|
11074
|
+
$gap: "1rem",
|
|
11075
|
+
children: [
|
|
11076
|
+
/* @__PURE__ */ jsxs8(Flex, { $flexGrow: "1", $flexBasis: "min-content", $gap: "1rem", children: [
|
|
11077
|
+
props.icons.isVisible && feature?.icon && /* @__PURE__ */ jsx15(
|
|
11078
|
+
IconRound,
|
|
11079
|
+
{
|
|
11080
|
+
name: feature.icon,
|
|
11081
|
+
size: "sm",
|
|
11082
|
+
colors: [
|
|
11083
|
+
theme.primary,
|
|
11084
|
+
isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)"
|
|
11085
|
+
]
|
|
11086
|
+
}
|
|
11087
|
+
),
|
|
11088
|
+
feature?.name && /* @__PURE__ */ jsx15(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx15(
|
|
11089
|
+
Text,
|
|
11090
|
+
{
|
|
11091
|
+
$font: theme.typography[props.icons.fontStyle].fontFamily,
|
|
11092
|
+
$size: theme.typography[props.icons.fontStyle].fontSize,
|
|
11093
|
+
$weight: theme.typography[props.icons.fontStyle].fontWeight,
|
|
11094
|
+
$color: theme.typography[props.icons.fontStyle].color,
|
|
11095
|
+
children: feature.name
|
|
11096
|
+
}
|
|
11097
|
+
) })
|
|
11098
|
+
] }),
|
|
11099
|
+
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ jsxs8(
|
|
11100
|
+
Box,
|
|
11101
|
+
{
|
|
11102
|
+
$flexBasis: "min-content",
|
|
11103
|
+
$flexGrow: "1",
|
|
11104
|
+
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
11105
|
+
children: [
|
|
11106
|
+
props.entitlement.isVisible && /* @__PURE__ */ jsx15(Box, { children: /* @__PURE__ */ jsx15(
|
|
11107
|
+
Text,
|
|
11016
11108
|
{
|
|
11017
|
-
|
|
11018
|
-
size:
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11109
|
+
$font: theme.typography[props.entitlement.fontStyle].fontFamily,
|
|
11110
|
+
$size: theme.typography[props.entitlement.fontStyle].fontSize,
|
|
11111
|
+
$weight: theme.typography[props.entitlement.fontStyle].fontWeight,
|
|
11112
|
+
$lineHeight: 1.25,
|
|
11113
|
+
$color: theme.typography[props.entitlement.fontStyle].color,
|
|
11114
|
+
children: typeof allocation === "number" ? `${formatNumber(allocation)} ${(0, import_pluralize2.default)(feature.name, allocation)}` : `Unlimited ${(0, import_pluralize2.default)(feature.name)}`
|
|
11023
11115
|
}
|
|
11024
|
-
),
|
|
11025
|
-
|
|
11116
|
+
) }),
|
|
11117
|
+
props.usage.isVisible && /* @__PURE__ */ jsx15(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx15(
|
|
11026
11118
|
Text,
|
|
11027
11119
|
{
|
|
11028
|
-
$font: theme.typography[props.
|
|
11029
|
-
$size: theme.typography[props.
|
|
11030
|
-
$weight: theme.typography[props.
|
|
11031
|
-
$
|
|
11032
|
-
|
|
11120
|
+
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
|
11121
|
+
$size: theme.typography[props.usage.fontStyle].fontSize,
|
|
11122
|
+
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
|
11123
|
+
$lineHeight: 1.5,
|
|
11124
|
+
$color: theme.typography[props.usage.fontStyle].color,
|
|
11125
|
+
children: typeof usage === "number" && /* @__PURE__ */ jsx15(Fragment2, { children: typeof allocation === "number" ? `${formatNumber(usage)} of ${formatNumber(allocation)} used` : `${formatNumber(usage)} used` })
|
|
11033
11126
|
}
|
|
11034
11127
|
) })
|
|
11035
|
-
]
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
|
|
11042
|
-
|
|
11043
|
-
props.entitlement.isVisible && /* @__PURE__ */ jsx15(Box, { children: /* @__PURE__ */ jsx15(
|
|
11044
|
-
Text,
|
|
11045
|
-
{
|
|
11046
|
-
$font: theme.typography[props.entitlement.fontStyle].fontFamily,
|
|
11047
|
-
$size: theme.typography[props.entitlement.fontStyle].fontSize,
|
|
11048
|
-
$weight: theme.typography[props.entitlement.fontStyle].fontWeight,
|
|
11049
|
-
$lineHeight: 1.25,
|
|
11050
|
-
$color: theme.typography[props.entitlement.fontStyle].color,
|
|
11051
|
-
children: typeof allocation === "number" ? `${formatNumber(allocation)} ${(0, import_pluralize2.default)(feature.name, allocation)}` : `Unlimited ${(0, import_pluralize2.default)(feature.name)}`
|
|
11052
|
-
}
|
|
11053
|
-
) }),
|
|
11054
|
-
props.usage.isVisible && /* @__PURE__ */ jsx15(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx15(
|
|
11055
|
-
Text,
|
|
11056
|
-
{
|
|
11057
|
-
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
|
11058
|
-
$size: theme.typography[props.usage.fontStyle].fontSize,
|
|
11059
|
-
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
|
11060
|
-
$lineHeight: 1.5,
|
|
11061
|
-
$color: theme.typography[props.usage.fontStyle].color,
|
|
11062
|
-
children: typeof usage === "number" && /* @__PURE__ */ jsx15(Fragment2, { children: typeof allocation === "number" ? `${formatNumber(usage)} of ${formatNumber(allocation)} used` : `${formatNumber(usage)} used` })
|
|
11063
|
-
}
|
|
11064
|
-
) })
|
|
11065
|
-
]
|
|
11066
|
-
}
|
|
11067
|
-
)
|
|
11068
|
-
]
|
|
11069
|
-
},
|
|
11070
|
-
index
|
|
11071
|
-
)
|
|
11072
|
-
];
|
|
11073
|
-
},
|
|
11074
|
-
[]
|
|
11075
|
-
)
|
|
11128
|
+
]
|
|
11129
|
+
}
|
|
11130
|
+
)
|
|
11131
|
+
]
|
|
11132
|
+
},
|
|
11133
|
+
index
|
|
11134
|
+
);
|
|
11135
|
+
})
|
|
11076
11136
|
]
|
|
11077
11137
|
}
|
|
11078
11138
|
);
|
|
@@ -11217,7 +11277,9 @@ function resolveDesignProps3(props) {
|
|
|
11217
11277
|
usage: {
|
|
11218
11278
|
isVisible: props.usage?.isVisible ?? true,
|
|
11219
11279
|
fontStyle: props.usage?.fontStyle ?? "heading5"
|
|
11220
|
-
}
|
|
11280
|
+
},
|
|
11281
|
+
// there is a typescript bug with `RecursivePartial` so we must cast to `string[] | undefined`
|
|
11282
|
+
visibleFeatures: props.visibleFeatures
|
|
11221
11283
|
};
|
|
11222
11284
|
}
|
|
11223
11285
|
var MeteredFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
@@ -11227,13 +11289,22 @@ var MeteredFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
11227
11289
|
const theme = nt();
|
|
11228
11290
|
const { data } = useEmbed();
|
|
11229
11291
|
const isLightBackground = useIsLightBackground();
|
|
11230
|
-
const
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11292
|
+
const featureUsage = props.visibleFeatures ? props.visibleFeatures.reduce((acc, id) => {
|
|
11293
|
+
const mappedFeatureUsage = data.featureUsage?.features.find(
|
|
11294
|
+
(usage) => usage.feature?.id === id
|
|
11295
|
+
);
|
|
11296
|
+
if (mappedFeatureUsage?.feature?.featureType === "event" || mappedFeatureUsage?.feature?.featureType === "trait") {
|
|
11297
|
+
acc.push(mappedFeatureUsage);
|
|
11298
|
+
}
|
|
11299
|
+
return acc;
|
|
11300
|
+
}, []) : (data.featureUsage?.features || []).filter(
|
|
11301
|
+
(usage) => usage.feature?.featureType === "event" || usage.feature?.featureType === "trait"
|
|
11302
|
+
);
|
|
11303
|
+
const shouldShowFeatures = featureUsage.length > 0 || data.company?.plan || (data.company?.addOns ?? []).length > 0 || false;
|
|
11304
|
+
if (!shouldShowFeatures) {
|
|
11234
11305
|
return null;
|
|
11235
11306
|
}
|
|
11236
|
-
return /* @__PURE__ */ jsx17(Flex, { ref, className, $flexDirection: "column", children:
|
|
11307
|
+
return /* @__PURE__ */ jsx17(Flex, { ref, className, $flexDirection: "column", children: featureUsage.map(({ allocation, feature, usage }, index) => {
|
|
11237
11308
|
return /* @__PURE__ */ jsxs10(Element, { as: Flex, $gap: "1.5rem", children: [
|
|
11238
11309
|
props.icon.isVisible && feature?.icon && /* @__PURE__ */ jsx17(
|
|
11239
11310
|
IconRound,
|
|
@@ -11716,12 +11787,12 @@ var resolveDesignProps5 = (props) => {
|
|
|
11716
11787
|
var PlanManager = forwardRef9(({ children, className, portal, ...rest }, ref) => {
|
|
11717
11788
|
const props = resolveDesignProps5(rest);
|
|
11718
11789
|
const theme = nt();
|
|
11719
|
-
const { data, layout,
|
|
11790
|
+
const { data, layout, setLayout } = useEmbed();
|
|
11720
11791
|
const isLightBackground = useIsLightBackground();
|
|
11721
11792
|
const { currentPlan, canChangePlan, addOns } = {
|
|
11722
|
-
|
|
11723
|
-
canChangePlan:
|
|
11724
|
-
|
|
11793
|
+
addOns: data.company?.addOns || [],
|
|
11794
|
+
canChangePlan: data.capabilities?.checkout ?? true,
|
|
11795
|
+
currentPlan: data.company?.plan
|
|
11725
11796
|
};
|
|
11726
11797
|
return /* @__PURE__ */ jsxs13(
|
|
11727
11798
|
Element,
|
|
@@ -12052,6 +12123,7 @@ var ComponentTree = () => {
|
|
|
12052
12123
|
setChildren(nodes.map(renderer));
|
|
12053
12124
|
}, [nodes]);
|
|
12054
12125
|
if (error) {
|
|
12126
|
+
console.error(error);
|
|
12055
12127
|
return /* @__PURE__ */ jsx22(Error2, { message: error.message });
|
|
12056
12128
|
}
|
|
12057
12129
|
if (Children.count(children) === 0) {
|