@schematichq/schematic-components 0.4.2 → 0.4.3
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 +288 -144
- package/dist/schematic-components.d.ts +55 -0
- package/dist/schematic-components.esm.js +289 -145
- package/package.json +10 -11
|
@@ -11254,6 +11254,21 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11254
11254
|
};
|
|
11255
11255
|
}
|
|
11256
11256
|
|
|
11257
|
+
// src/api/models/CustomPlanConfig.ts
|
|
11258
|
+
function CustomPlanConfigFromJSON(json) {
|
|
11259
|
+
return CustomPlanConfigFromJSONTyped(json, false);
|
|
11260
|
+
}
|
|
11261
|
+
function CustomPlanConfigFromJSONTyped(json, ignoreDiscriminator) {
|
|
11262
|
+
if (json == null) {
|
|
11263
|
+
return json;
|
|
11264
|
+
}
|
|
11265
|
+
return {
|
|
11266
|
+
ctaText: json["cta_text"],
|
|
11267
|
+
ctaWebSite: json["cta_web_site"],
|
|
11268
|
+
priceText: json["price_text"]
|
|
11269
|
+
};
|
|
11270
|
+
}
|
|
11271
|
+
|
|
11257
11272
|
// src/api/models/CompanyPlanDetailResponseData.ts
|
|
11258
11273
|
function CompanyPlanDetailResponseDataFromJSON(json) {
|
|
11259
11274
|
return CompanyPlanDetailResponseDataFromJSONTyped(json, false);
|
|
@@ -11269,6 +11284,8 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11269
11284
|
companyCount: json["company_count"],
|
|
11270
11285
|
createdAt: new Date(json["created_at"]),
|
|
11271
11286
|
current: json["current"],
|
|
11287
|
+
custom: json["custom"],
|
|
11288
|
+
customPlanConfig: json["custom_plan_config"] == null ? void 0 : CustomPlanConfigFromJSON(json["custom_plan_config"]),
|
|
11272
11289
|
description: json["description"],
|
|
11273
11290
|
entitlements: json["entitlements"].map(
|
|
11274
11291
|
PlanEntitlementResponseDataFromJSON
|
|
@@ -11278,6 +11295,7 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11278
11295
|
),
|
|
11279
11296
|
icon: json["icon"],
|
|
11280
11297
|
id: json["id"],
|
|
11298
|
+
isCustom: json["is_custom"],
|
|
11281
11299
|
isDefault: json["is_default"],
|
|
11282
11300
|
isFree: json["is_free"],
|
|
11283
11301
|
isTrialable: json["is_trialable"],
|
|
@@ -12526,8 +12544,12 @@ function isEditorState(obj) {
|
|
|
12526
12544
|
});
|
|
12527
12545
|
}
|
|
12528
12546
|
function getEditorState(json) {
|
|
12529
|
-
|
|
12530
|
-
|
|
12547
|
+
if (json) {
|
|
12548
|
+
const obj = JSON.parse(json);
|
|
12549
|
+
if (isEditorState(obj)) {
|
|
12550
|
+
return obj;
|
|
12551
|
+
}
|
|
12552
|
+
}
|
|
12531
12553
|
}
|
|
12532
12554
|
function parseEditorState(data) {
|
|
12533
12555
|
const initialMap = {};
|
|
@@ -12707,7 +12729,7 @@ var EmbedProvider = ({
|
|
|
12707
12729
|
(0, import_react11.useEffect)(() => {
|
|
12708
12730
|
if (accessToken) {
|
|
12709
12731
|
const { headers = {} } = apiConfig ?? {};
|
|
12710
|
-
headers["X-Schematic-Components-Version"] = "0.4.
|
|
12732
|
+
headers["X-Schematic-Components-Version"] = "0.4.3";
|
|
12711
12733
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
12712
12734
|
const config = new Configuration({
|
|
12713
12735
|
...apiConfig,
|
|
@@ -12888,7 +12910,7 @@ function camelToHyphen(str) {
|
|
|
12888
12910
|
function formatNumber(num) {
|
|
12889
12911
|
return new Intl.NumberFormat("en-US").format(num);
|
|
12890
12912
|
}
|
|
12891
|
-
function formatCurrency(amount) {
|
|
12913
|
+
function formatCurrency(amount, currency = "USD") {
|
|
12892
12914
|
try {
|
|
12893
12915
|
const dollars = amount / 100;
|
|
12894
12916
|
const formatValue = (value, symbol) => {
|
|
@@ -12896,6 +12918,9 @@ function formatCurrency(amount) {
|
|
|
12896
12918
|
if (formatted.endsWith(".0")) {
|
|
12897
12919
|
formatted = formatted.slice(0, -2);
|
|
12898
12920
|
}
|
|
12921
|
+
if (currency.toUpperCase() !== "USD") {
|
|
12922
|
+
return `${currency.toUpperCase()}${formatted}${symbol}`;
|
|
12923
|
+
}
|
|
12899
12924
|
return `$${formatted}${symbol}`;
|
|
12900
12925
|
};
|
|
12901
12926
|
if (dollars >= 1e6) {
|
|
@@ -12905,14 +12930,14 @@ function formatCurrency(amount) {
|
|
|
12905
12930
|
} else {
|
|
12906
12931
|
return new Intl.NumberFormat("en-US", {
|
|
12907
12932
|
style: "currency",
|
|
12908
|
-
currency:
|
|
12933
|
+
currency: currency.toUpperCase()
|
|
12909
12934
|
}).format(dollars);
|
|
12910
12935
|
}
|
|
12911
12936
|
} catch (error) {
|
|
12912
12937
|
console.error("Error formatting currency", error);
|
|
12913
12938
|
return new Intl.NumberFormat("en-US", {
|
|
12914
12939
|
style: "currency",
|
|
12915
|
-
currency:
|
|
12940
|
+
currency: currency.toUpperCase()
|
|
12916
12941
|
}).format(amount / 100);
|
|
12917
12942
|
}
|
|
12918
12943
|
}
|
|
@@ -14439,6 +14464,7 @@ var Sidebar = ({
|
|
|
14439
14464
|
}
|
|
14440
14465
|
let total = 0;
|
|
14441
14466
|
const planPrice = (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price;
|
|
14467
|
+
const currency = (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency;
|
|
14442
14468
|
if (planPrice) {
|
|
14443
14469
|
total += planPrice;
|
|
14444
14470
|
}
|
|
@@ -14452,7 +14478,7 @@ var Sidebar = ({
|
|
|
14452
14478
|
0
|
|
14453
14479
|
);
|
|
14454
14480
|
total += payInAdvanceCost;
|
|
14455
|
-
return formatCurrency(total);
|
|
14481
|
+
return formatCurrency(total, currency);
|
|
14456
14482
|
}, [selectedPlan, addOns, payInAdvanceEntitlements, planPeriod]);
|
|
14457
14483
|
const { amountOff, dueNow, newCharges, percentOff, periodStart, proration } = (0, import_react21.useMemo)(() => {
|
|
14458
14484
|
return {
|
|
@@ -14687,7 +14713,10 @@ var Sidebar = ({
|
|
|
14687
14713
|
$weight: theme.typography.text.fontWeight,
|
|
14688
14714
|
$color: theme.typography.text.color,
|
|
14689
14715
|
children: [
|
|
14690
|
-
formatCurrency(
|
|
14716
|
+
formatCurrency(
|
|
14717
|
+
data.company.plan.planPrice,
|
|
14718
|
+
data.company.billingSubscription?.currency
|
|
14719
|
+
),
|
|
14691
14720
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
|
|
14692
14721
|
"/",
|
|
14693
14722
|
shortenPeriod(
|
|
@@ -14747,7 +14776,8 @@ var Sidebar = ({
|
|
|
14747
14776
|
$color: theme.typography.text.color,
|
|
14748
14777
|
children: [
|
|
14749
14778
|
formatCurrency(
|
|
14750
|
-
(planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
|
|
14779
|
+
(planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
|
|
14780
|
+
(planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
|
|
14751
14781
|
),
|
|
14752
14782
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
|
|
14753
14783
|
"/",
|
|
@@ -14810,14 +14840,20 @@ var Sidebar = ({
|
|
|
14810
14840
|
$color: theme.typography.text.color,
|
|
14811
14841
|
children: [
|
|
14812
14842
|
entitlement.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
14813
|
-
formatCurrency(
|
|
14843
|
+
formatCurrency(
|
|
14844
|
+
price * quantity,
|
|
14845
|
+
(planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
|
|
14846
|
+
),
|
|
14814
14847
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
|
|
14815
14848
|
"/",
|
|
14816
14849
|
shortenPeriod(planPeriod)
|
|
14817
14850
|
] })
|
|
14818
14851
|
] }),
|
|
14819
14852
|
entitlement.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
14820
|
-
formatCurrency(
|
|
14853
|
+
formatCurrency(
|
|
14854
|
+
price,
|
|
14855
|
+
(planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
|
|
14856
|
+
),
|
|
14821
14857
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
|
|
14822
14858
|
"/",
|
|
14823
14859
|
(0, import_pluralize.default)(
|
|
@@ -14877,7 +14913,8 @@ var Sidebar = ({
|
|
|
14877
14913
|
$color: theme.typography.text.color,
|
|
14878
14914
|
children: [
|
|
14879
14915
|
formatCurrency(
|
|
14880
|
-
((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * previous.quantity
|
|
14916
|
+
((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * previous.quantity,
|
|
14917
|
+
(planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
|
|
14881
14918
|
),
|
|
14882
14919
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
|
|
14883
14920
|
"/",
|
|
@@ -14919,7 +14956,8 @@ var Sidebar = ({
|
|
|
14919
14956
|
$color: theme.typography.text.color,
|
|
14920
14957
|
children: [
|
|
14921
14958
|
formatCurrency(
|
|
14922
|
-
((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * next2.quantity
|
|
14959
|
+
((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * next2.quantity,
|
|
14960
|
+
(planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
|
|
14923
14961
|
),
|
|
14924
14962
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
|
|
14925
14963
|
"/",
|
|
@@ -14973,14 +15011,20 @@ var Sidebar = ({
|
|
|
14973
15011
|
$color: theme.typography.text.color,
|
|
14974
15012
|
children: [
|
|
14975
15013
|
entitlement.priceBehavior === "pay_in_advance" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
14976
|
-
formatCurrency(
|
|
15014
|
+
formatCurrency(
|
|
15015
|
+
price * quantity,
|
|
15016
|
+
(planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
|
|
15017
|
+
),
|
|
14977
15018
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
|
|
14978
15019
|
"/",
|
|
14979
15020
|
shortenPeriod(planPeriod)
|
|
14980
15021
|
] })
|
|
14981
15022
|
] }),
|
|
14982
15023
|
entitlement.priceBehavior === "pay_as_you_go" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
14983
|
-
formatCurrency(
|
|
15024
|
+
formatCurrency(
|
|
15025
|
+
price,
|
|
15026
|
+
(planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
|
|
15027
|
+
),
|
|
14984
15028
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
|
|
14985
15029
|
"/",
|
|
14986
15030
|
(0, import_pluralize.default)(
|
|
@@ -15041,7 +15085,8 @@ var Sidebar = ({
|
|
|
15041
15085
|
children: [
|
|
15042
15086
|
"-",
|
|
15043
15087
|
formatCurrency(
|
|
15044
|
-
(planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
|
|
15088
|
+
(planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0,
|
|
15089
|
+
(planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency
|
|
15045
15090
|
),
|
|
15046
15091
|
"/",
|
|
15047
15092
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("sub", { children: shortenPeriod(planPeriod) })
|
|
@@ -15091,7 +15136,10 @@ var Sidebar = ({
|
|
|
15091
15136
|
$weight: theme.typography.text.fontWeight,
|
|
15092
15137
|
$color: theme.typography.text.color,
|
|
15093
15138
|
children: [
|
|
15094
|
-
formatCurrency(
|
|
15139
|
+
formatCurrency(
|
|
15140
|
+
addOn.planPrice,
|
|
15141
|
+
(planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
|
|
15142
|
+
),
|
|
15095
15143
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
|
|
15096
15144
|
"/",
|
|
15097
15145
|
shortenPeriod(addOn.planPeriod)
|
|
@@ -15178,7 +15226,10 @@ var Sidebar = ({
|
|
|
15178
15226
|
$size: theme.typography.text.fontSize,
|
|
15179
15227
|
$weight: theme.typography.text.fontWeight,
|
|
15180
15228
|
$color: theme.typography.text.color,
|
|
15181
|
-
children: formatCurrency(
|
|
15229
|
+
children: formatCurrency(
|
|
15230
|
+
proration,
|
|
15231
|
+
(planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
|
|
15232
|
+
)
|
|
15182
15233
|
}
|
|
15183
15234
|
) })
|
|
15184
15235
|
]
|
|
@@ -15282,7 +15333,10 @@ var Sidebar = ({
|
|
|
15282
15333
|
$size: theme.typography.text.fontSize,
|
|
15283
15334
|
$weight: theme.typography.text.fontWeight,
|
|
15284
15335
|
$color: theme.typography.text.color,
|
|
15285
|
-
children: formatCurrency(
|
|
15336
|
+
children: formatCurrency(
|
|
15337
|
+
newCharges / 100 * percentOff,
|
|
15338
|
+
(planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
|
|
15339
|
+
)
|
|
15286
15340
|
}
|
|
15287
15341
|
) })
|
|
15288
15342
|
]
|
|
@@ -15303,7 +15357,10 @@ var Sidebar = ({
|
|
|
15303
15357
|
$weight: theme.typography.text.fontWeight,
|
|
15304
15358
|
$color: theme.typography.text.color,
|
|
15305
15359
|
children: t2("X off", {
|
|
15306
|
-
amount: formatCurrency(
|
|
15360
|
+
amount: formatCurrency(
|
|
15361
|
+
Math.abs(amountOff),
|
|
15362
|
+
(planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
|
|
15363
|
+
)
|
|
15307
15364
|
})
|
|
15308
15365
|
}
|
|
15309
15366
|
) }),
|
|
@@ -15316,7 +15373,10 @@ var Sidebar = ({
|
|
|
15316
15373
|
$color: theme.typography.text.color,
|
|
15317
15374
|
children: [
|
|
15318
15375
|
"-",
|
|
15319
|
-
formatCurrency(
|
|
15376
|
+
formatCurrency(
|
|
15377
|
+
Math.abs(amountOff),
|
|
15378
|
+
(planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
|
|
15379
|
+
)
|
|
15320
15380
|
]
|
|
15321
15381
|
}
|
|
15322
15382
|
) })
|
|
@@ -15389,7 +15449,10 @@ var Sidebar = ({
|
|
|
15389
15449
|
$size: theme.typography.text.fontSize,
|
|
15390
15450
|
$weight: theme.typography.text.fontWeight,
|
|
15391
15451
|
$color: theme.typography.text.color,
|
|
15392
|
-
children: formatCurrency(
|
|
15452
|
+
children: formatCurrency(
|
|
15453
|
+
Math.max(0, dueNow),
|
|
15454
|
+
(planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
|
|
15455
|
+
)
|
|
15393
15456
|
}
|
|
15394
15457
|
) })
|
|
15395
15458
|
]
|
|
@@ -15416,7 +15479,10 @@ var Sidebar = ({
|
|
|
15416
15479
|
$size: theme.typography.text.fontSize,
|
|
15417
15480
|
$weight: theme.typography.text.fontWeight,
|
|
15418
15481
|
$color: theme.typography.text.color,
|
|
15419
|
-
children: formatCurrency(
|
|
15482
|
+
children: formatCurrency(
|
|
15483
|
+
Math.abs(dueNow),
|
|
15484
|
+
(planPeriod === "month" ? selectedPlan?.monthlyPrice : selectedPlan?.yearlyPrice)?.currency
|
|
15485
|
+
)
|
|
15420
15486
|
}
|
|
15421
15487
|
) })
|
|
15422
15488
|
] }),
|
|
@@ -15577,7 +15643,8 @@ var Plan = ({
|
|
|
15577
15643
|
$weight: theme.typography.heading2.fontWeight,
|
|
15578
15644
|
$color: theme.typography.heading2.color,
|
|
15579
15645
|
children: formatCurrency(
|
|
15580
|
-
(period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0
|
|
15646
|
+
(period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0,
|
|
15647
|
+
(period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.currency
|
|
15581
15648
|
)
|
|
15582
15649
|
}
|
|
15583
15650
|
),
|
|
@@ -15642,6 +15709,7 @@ var Plan = ({
|
|
|
15642
15709
|
}[entitlement.metricPeriod];
|
|
15643
15710
|
}
|
|
15644
15711
|
const price = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price;
|
|
15712
|
+
const currency = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency;
|
|
15645
15713
|
if (entitlement.priceBehavior && typeof price !== "number") {
|
|
15646
15714
|
return acc;
|
|
15647
15715
|
}
|
|
@@ -15673,7 +15741,7 @@ var Plan = ({
|
|
|
15673
15741
|
$weight: theme.typography.text.fontWeight,
|
|
15674
15742
|
$color: theme.typography.text.color,
|
|
15675
15743
|
children: typeof price !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
15676
|
-
formatCurrency(price),
|
|
15744
|
+
formatCurrency(price, currency),
|
|
15677
15745
|
" ",
|
|
15678
15746
|
t2("per"),
|
|
15679
15747
|
" ",
|
|
@@ -15777,7 +15845,7 @@ var Plan = ({
|
|
|
15777
15845
|
{
|
|
15778
15846
|
disabled: isLoading || !plan.valid,
|
|
15779
15847
|
onClick: () => {
|
|
15780
|
-
selectPlan(plan);
|
|
15848
|
+
selectPlan({ plan });
|
|
15781
15849
|
},
|
|
15782
15850
|
$size: "sm",
|
|
15783
15851
|
$color: "primary",
|
|
@@ -15863,7 +15931,8 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
|
|
|
15863
15931
|
$weight: theme.typography.heading2.fontWeight,
|
|
15864
15932
|
$color: theme.typography.heading2.color,
|
|
15865
15933
|
children: formatCurrency(
|
|
15866
|
-
(period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0
|
|
15934
|
+
(period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0,
|
|
15935
|
+
(period === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.currency
|
|
15867
15936
|
)
|
|
15868
15937
|
}
|
|
15869
15938
|
),
|
|
@@ -16064,7 +16133,8 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
16064
16133
|
$color: theme.typography.text.color,
|
|
16065
16134
|
children: [
|
|
16066
16135
|
formatCurrency(
|
|
16067
|
-
((period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * quantity
|
|
16136
|
+
((period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0) * quantity,
|
|
16137
|
+
(period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
|
|
16068
16138
|
),
|
|
16069
16139
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("sub", { children: [
|
|
16070
16140
|
"/",
|
|
@@ -16082,7 +16152,8 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
16082
16152
|
$color: unitPriceColor,
|
|
16083
16153
|
children: [
|
|
16084
16154
|
formatCurrency(
|
|
16085
|
-
(period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0
|
|
16155
|
+
(period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0,
|
|
16156
|
+
(period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency
|
|
16086
16157
|
),
|
|
16087
16158
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("sub", { children: [
|
|
16088
16159
|
"/",
|
|
@@ -16115,14 +16186,19 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
16115
16186
|
var import_react23 = require("react");
|
|
16116
16187
|
|
|
16117
16188
|
// node_modules/@stripe/stripe-js/dist/index.mjs
|
|
16118
|
-
var
|
|
16189
|
+
var ORIGIN = "https://js.stripe.com";
|
|
16190
|
+
var STRIPE_JS_URL = "".concat(ORIGIN, "/v3");
|
|
16119
16191
|
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
16192
|
+
var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
|
|
16120
16193
|
var EXISTING_SCRIPT_MESSAGE = "loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";
|
|
16194
|
+
var isStripeJSURL = function isStripeJSURL2(url) {
|
|
16195
|
+
return V3_URL_REGEX.test(url) || STRIPE_JS_URL_REGEX.test(url);
|
|
16196
|
+
};
|
|
16121
16197
|
var findScript = function findScript2() {
|
|
16122
|
-
var scripts = document.querySelectorAll('script[src^="'.concat(
|
|
16198
|
+
var scripts = document.querySelectorAll('script[src^="'.concat(ORIGIN, '"]'));
|
|
16123
16199
|
for (var i2 = 0; i2 < scripts.length; i2++) {
|
|
16124
16200
|
var script = scripts[i2];
|
|
16125
|
-
if (!
|
|
16201
|
+
if (!isStripeJSURL(script.src)) {
|
|
16126
16202
|
continue;
|
|
16127
16203
|
}
|
|
16128
16204
|
return script;
|
|
@@ -16132,7 +16208,7 @@ var findScript = function findScript2() {
|
|
|
16132
16208
|
var injectScript = function injectScript2(params) {
|
|
16133
16209
|
var queryString = params && !params.advancedFraudSignals ? "?advancedFraudSignals=false" : "";
|
|
16134
16210
|
var script = document.createElement("script");
|
|
16135
|
-
script.src = "".concat(
|
|
16211
|
+
script.src = "".concat(STRIPE_JS_URL).concat(queryString);
|
|
16136
16212
|
var headOrBody = document.head || document.body;
|
|
16137
16213
|
if (!headOrBody) {
|
|
16138
16214
|
throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
|
|
@@ -16146,7 +16222,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
16146
16222
|
}
|
|
16147
16223
|
stripe._registerWrapper({
|
|
16148
16224
|
name: "stripe-js",
|
|
16149
|
-
version: "5.
|
|
16225
|
+
version: "5.7.0",
|
|
16150
16226
|
startTime
|
|
16151
16227
|
});
|
|
16152
16228
|
};
|
|
@@ -16428,12 +16504,6 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16428
16504
|
const modalRef = (0, import_react24.useRef)(null);
|
|
16429
16505
|
const contentRef = (0, import_react24.useRef)(null);
|
|
16430
16506
|
const checkoutRef = (0, import_react24.useRef)(null);
|
|
16431
|
-
const [checkoutStage, setCheckoutStage] = (0, import_react24.useState)(
|
|
16432
|
-
() => selected.addOnId ? "addons" : selected.usage ? "usage" : "plan"
|
|
16433
|
-
);
|
|
16434
|
-
const [planPeriod, setPlanPeriod] = (0, import_react24.useState)(
|
|
16435
|
-
selected.period || data.company?.plan?.planPeriod || "month"
|
|
16436
|
-
);
|
|
16437
16507
|
const [charges, setCharges] = (0, import_react24.useState)();
|
|
16438
16508
|
const [paymentMethodId, setPaymentMethodId] = (0, import_react24.useState)();
|
|
16439
16509
|
const [isLoading, setIsLoading] = (0, import_react24.useState)(false);
|
|
@@ -16442,13 +16512,18 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16442
16512
|
!data.subscription?.paymentMethod
|
|
16443
16513
|
);
|
|
16444
16514
|
const [promoCode, setPromoCode] = (0, import_react24.useState)();
|
|
16515
|
+
const [planPeriod, setPlanPeriod] = (0, import_react24.useState)(
|
|
16516
|
+
selected.period || data.company?.plan?.planPeriod || "month"
|
|
16517
|
+
);
|
|
16445
16518
|
const {
|
|
16446
16519
|
plans: availablePlans,
|
|
16447
16520
|
addOns: availableAddOns,
|
|
16448
16521
|
periods: availablePeriods
|
|
16449
16522
|
} = useAvailablePlans(planPeriod);
|
|
16450
16523
|
const [selectedPlan, setSelectedPlan] = (0, import_react24.useState)(
|
|
16451
|
-
() => availablePlans.find(
|
|
16524
|
+
() => availablePlans.find(
|
|
16525
|
+
(plan) => selected.planId ? plan.id === selected.planId : plan.current
|
|
16526
|
+
)
|
|
16452
16527
|
);
|
|
16453
16528
|
const currentAddOns = data.company?.addOns || [];
|
|
16454
16529
|
const [addOns, setAddOns] = (0, import_react24.useState)(
|
|
@@ -16511,6 +16586,18 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16511
16586
|
),
|
|
16512
16587
|
[usageBasedEntitlements]
|
|
16513
16588
|
);
|
|
16589
|
+
const [checkoutStage, setCheckoutStage] = (0, import_react24.useState)(() => {
|
|
16590
|
+
if (selected.planId !== currentPlan?.id) {
|
|
16591
|
+
return payInAdvanceEntitlements.length > 0 ? "usage" : "addons";
|
|
16592
|
+
}
|
|
16593
|
+
if (selected.addOnId) {
|
|
16594
|
+
return "addons";
|
|
16595
|
+
}
|
|
16596
|
+
if (selected.usage) {
|
|
16597
|
+
return "usage";
|
|
16598
|
+
}
|
|
16599
|
+
return "plan";
|
|
16600
|
+
});
|
|
16514
16601
|
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected === true);
|
|
16515
16602
|
const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
|
|
16516
16603
|
({ quantity }) => quantity > 0
|
|
@@ -16555,50 +16642,12 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16555
16642
|
requiresPayment
|
|
16556
16643
|
]);
|
|
16557
16644
|
const isLightBackground = useIsLightBackground();
|
|
16558
|
-
const
|
|
16559
|
-
(
|
|
16560
|
-
const
|
|
16561
|
-
|
|
16562
|
-
|
|
16563
|
-
)
|
|
16564
|
-
setSelectedPlan(updatedPlan);
|
|
16565
|
-
setUsageBasedEntitlements(entitlements);
|
|
16566
|
-
},
|
|
16567
|
-
[createActiveUsageBasedEntitlementsReducer]
|
|
16568
|
-
);
|
|
16569
|
-
const toggleAddOn = (id) => {
|
|
16570
|
-
setAddOns(
|
|
16571
|
-
(prev2) => prev2.map((addOn) => ({
|
|
16572
|
-
...addOn,
|
|
16573
|
-
...addOn.id === id && { isSelected: !addOn.isSelected }
|
|
16574
|
-
}))
|
|
16575
|
-
);
|
|
16576
|
-
};
|
|
16577
|
-
const changePlanPeriod = (0, import_react24.useCallback)(
|
|
16578
|
-
(period) => {
|
|
16579
|
-
if (selectedPlan) {
|
|
16580
|
-
selectPlan(selectedPlan, period);
|
|
16581
|
-
}
|
|
16582
|
-
setPlanPeriod(period);
|
|
16583
|
-
},
|
|
16584
|
-
[selectedPlan, selectPlan, setPlanPeriod]
|
|
16585
|
-
);
|
|
16586
|
-
const updateUsageBasedEntitlementQuantity = (id, updatedQuantity) => {
|
|
16587
|
-
setUsageBasedEntitlements(
|
|
16588
|
-
(prev2) => prev2.map(
|
|
16589
|
-
({ entitlement, allocation, quantity, usage }) => entitlement.id === id ? {
|
|
16590
|
-
entitlement,
|
|
16591
|
-
allocation,
|
|
16592
|
-
quantity: updatedQuantity,
|
|
16593
|
-
usage
|
|
16594
|
-
} : { entitlement, allocation, quantity, usage }
|
|
16595
|
-
)
|
|
16596
|
-
);
|
|
16597
|
-
};
|
|
16598
|
-
(0, import_react24.useEffect)(() => {
|
|
16599
|
-
async function previewCheckout() {
|
|
16600
|
-
const planPriceId = planPeriod === "month" ? selectedPlan?.monthlyPrice?.id : selectedPlan?.yearlyPrice?.id;
|
|
16601
|
-
if (!api || !selectedPlan || !planPriceId) {
|
|
16645
|
+
const previewCheckout = (0, import_react24.useCallback)(
|
|
16646
|
+
async (updates) => {
|
|
16647
|
+
const period = updates.period || planPeriod;
|
|
16648
|
+
const plan = updates.plan || selectedPlan;
|
|
16649
|
+
const planPriceId = period === "month" ? plan?.monthlyPrice?.id : plan?.yearlyPrice?.id;
|
|
16650
|
+
if (!api || !plan || !planPriceId) {
|
|
16602
16651
|
return;
|
|
16603
16652
|
}
|
|
16604
16653
|
setError(void 0);
|
|
@@ -16607,23 +16656,26 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16607
16656
|
try {
|
|
16608
16657
|
const { data: data2 } = await api.previewCheckout({
|
|
16609
16658
|
changeSubscriptionRequestBody: {
|
|
16610
|
-
newPlanId:
|
|
16659
|
+
newPlanId: plan.id,
|
|
16611
16660
|
newPriceId: planPriceId,
|
|
16612
|
-
addOnIds: addOns.reduce(
|
|
16613
|
-
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
|
|
16661
|
+
addOnIds: (updates.addOns || addOns).reduce(
|
|
16662
|
+
(acc, addOn) => {
|
|
16663
|
+
if (addOn.isSelected) {
|
|
16664
|
+
const addOnPriceId = (period === "month" ? addOn?.monthlyPrice : addOn?.yearlyPrice)?.id;
|
|
16665
|
+
if (addOnPriceId) {
|
|
16666
|
+
acc.push({
|
|
16667
|
+
addOnId: addOn.id,
|
|
16668
|
+
priceId: addOnPriceId
|
|
16669
|
+
});
|
|
16670
|
+
}
|
|
16620
16671
|
}
|
|
16621
|
-
|
|
16622
|
-
|
|
16623
|
-
|
|
16624
|
-
|
|
16672
|
+
return acc;
|
|
16673
|
+
},
|
|
16674
|
+
[]
|
|
16675
|
+
),
|
|
16676
|
+
payInAdvance: (updates.payInAdvanceEntitlements || payInAdvanceEntitlements).reduce(
|
|
16625
16677
|
(acc, { entitlement, quantity }) => {
|
|
16626
|
-
const priceId = (
|
|
16678
|
+
const priceId = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.priceId;
|
|
16627
16679
|
if (priceId) {
|
|
16628
16680
|
acc.push({
|
|
16629
16681
|
priceId,
|
|
@@ -16634,7 +16686,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16634
16686
|
},
|
|
16635
16687
|
[]
|
|
16636
16688
|
),
|
|
16637
|
-
promoCode
|
|
16689
|
+
promoCode: updates.promoCode || promoCode
|
|
16638
16690
|
}
|
|
16639
16691
|
});
|
|
16640
16692
|
setCharges(data2);
|
|
@@ -16653,19 +16705,88 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16653
16705
|
} finally {
|
|
16654
16706
|
setIsLoading(false);
|
|
16655
16707
|
}
|
|
16656
|
-
}
|
|
16657
|
-
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16663
|
-
|
|
16664
|
-
|
|
16665
|
-
|
|
16666
|
-
|
|
16708
|
+
},
|
|
16709
|
+
[
|
|
16710
|
+
t2,
|
|
16711
|
+
api,
|
|
16712
|
+
planPeriod,
|
|
16713
|
+
selectedPlan,
|
|
16714
|
+
addOns,
|
|
16715
|
+
payInAdvanceEntitlements,
|
|
16716
|
+
promoCode
|
|
16717
|
+
]
|
|
16718
|
+
);
|
|
16719
|
+
const selectPlan = (0, import_react24.useCallback)(
|
|
16720
|
+
(updates) => {
|
|
16721
|
+
const plan = updates.plan || selectedPlan;
|
|
16722
|
+
if (!plan) {
|
|
16723
|
+
return;
|
|
16724
|
+
}
|
|
16725
|
+
const period = updates.period || planPeriod;
|
|
16726
|
+
const entitlements = plan.entitlements.reduce(
|
|
16727
|
+
createActiveUsageBasedEntitlementsReducer(period),
|
|
16728
|
+
[]
|
|
16729
|
+
);
|
|
16730
|
+
if (updates.plan) {
|
|
16731
|
+
setSelectedPlan(plan);
|
|
16732
|
+
setUsageBasedEntitlements(entitlements);
|
|
16733
|
+
}
|
|
16734
|
+
previewCheckout({
|
|
16735
|
+
period,
|
|
16736
|
+
plan: updates.plan,
|
|
16737
|
+
payInAdvanceEntitlements: entitlements.filter(
|
|
16738
|
+
({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
|
|
16739
|
+
)
|
|
16740
|
+
});
|
|
16741
|
+
},
|
|
16742
|
+
[
|
|
16743
|
+
planPeriod,
|
|
16744
|
+
selectedPlan,
|
|
16745
|
+
createActiveUsageBasedEntitlementsReducer,
|
|
16746
|
+
previewCheckout
|
|
16747
|
+
]
|
|
16748
|
+
);
|
|
16749
|
+
const changePlanPeriod = (0, import_react24.useCallback)(
|
|
16750
|
+
(period) => {
|
|
16751
|
+
setPlanPeriod(period);
|
|
16752
|
+
previewCheckout({ period });
|
|
16753
|
+
},
|
|
16754
|
+
[setPlanPeriod, previewCheckout]
|
|
16755
|
+
);
|
|
16756
|
+
const toggleAddOn = (id) => {
|
|
16757
|
+
setAddOns((prev2) => {
|
|
16758
|
+
const updated = prev2.map((addOn) => ({
|
|
16759
|
+
...addOn,
|
|
16760
|
+
...addOn.id === id && { isSelected: !addOn.isSelected }
|
|
16761
|
+
}));
|
|
16762
|
+
previewCheckout({ addOns: updated });
|
|
16763
|
+
return updated;
|
|
16764
|
+
});
|
|
16765
|
+
};
|
|
16766
|
+
const updateUsageBasedEntitlementQuantity = (0, import_react24.useCallback)(
|
|
16767
|
+
(id, updatedQuantity) => {
|
|
16768
|
+
setUsageBasedEntitlements((prev2) => {
|
|
16769
|
+
const updated = prev2.map(
|
|
16770
|
+
({ entitlement, allocation, quantity, usage }) => entitlement.id === id ? {
|
|
16771
|
+
entitlement,
|
|
16772
|
+
allocation,
|
|
16773
|
+
quantity: updatedQuantity,
|
|
16774
|
+
usage
|
|
16775
|
+
} : { entitlement, allocation, quantity, usage }
|
|
16776
|
+
);
|
|
16777
|
+
previewCheckout({
|
|
16778
|
+
payInAdvanceEntitlements: updated.filter(
|
|
16779
|
+
({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
|
|
16780
|
+
)
|
|
16781
|
+
});
|
|
16782
|
+
return updated;
|
|
16783
|
+
});
|
|
16784
|
+
},
|
|
16785
|
+
[previewCheckout]
|
|
16786
|
+
);
|
|
16667
16787
|
const updatePromoCode = (code) => {
|
|
16668
16788
|
setPromoCode(code);
|
|
16789
|
+
previewCheckout({ promoCode: code });
|
|
16669
16790
|
};
|
|
16670
16791
|
(0, import_react24.useEffect)(() => {
|
|
16671
16792
|
if (charges) {
|
|
@@ -17431,6 +17552,18 @@ var Details = ({
|
|
|
17431
17552
|
const { t: t2 } = useTranslation();
|
|
17432
17553
|
const theme = nt();
|
|
17433
17554
|
const { data } = useEmbed();
|
|
17555
|
+
const currency = (0, import_react31.useMemo)(() => {
|
|
17556
|
+
if (data.company?.plan?.planPeriod === "month") {
|
|
17557
|
+
return monthlyUsageBasedPrice?.currency;
|
|
17558
|
+
}
|
|
17559
|
+
if (data.company?.plan?.planPeriod === "year") {
|
|
17560
|
+
return yearlyUsageBasedPrice?.currency;
|
|
17561
|
+
}
|
|
17562
|
+
}, [
|
|
17563
|
+
data.company?.plan?.planPeriod,
|
|
17564
|
+
monthlyUsageBasedPrice,
|
|
17565
|
+
yearlyUsageBasedPrice
|
|
17566
|
+
]);
|
|
17434
17567
|
const price = (0, import_react31.useMemo)(() => {
|
|
17435
17568
|
if (data.company?.plan?.planPeriod === "month") {
|
|
17436
17569
|
return monthlyUsageBasedPrice?.price;
|
|
@@ -17451,7 +17584,7 @@ var Details = ({
|
|
|
17451
17584
|
return `${formatNumber(allocation)} ${(0, import_pluralize4.default)(feature.name, allocation)}`;
|
|
17452
17585
|
}
|
|
17453
17586
|
if (priceBehavior === "pay_as_you_go" && typeof price === "number") {
|
|
17454
|
-
return `${formatCurrency(price)} ${t2("per")} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}`;
|
|
17587
|
+
return `${formatCurrency(price, currency)} ${t2("per")} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}`;
|
|
17455
17588
|
}
|
|
17456
17589
|
if (!priceBehavior && typeof allocation === "number") {
|
|
17457
17590
|
return `${formatNumber(allocation)} ${(0, import_pluralize4.default)(feature.name, allocation)}`;
|
|
@@ -17467,15 +17600,15 @@ var Details = ({
|
|
|
17467
17600
|
if (usageData) {
|
|
17468
17601
|
let acc;
|
|
17469
17602
|
if (priceBehavior === "pay_in_advance" && typeof data.company?.plan?.planPeriod === "string" && typeof price === "number") {
|
|
17470
|
-
acc = `${formatCurrency(price)}/${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}/${shortenPeriod(data.company.plan.planPeriod)}`;
|
|
17603
|
+
acc = `${formatCurrency(price, currency)}/${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}/${shortenPeriod(data.company.plan.planPeriod)}`;
|
|
17471
17604
|
} else if (priceBehavior === "pay_as_you_go" && typeof usage === "number") {
|
|
17472
17605
|
acc = `${usage} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), usage)} ${t2("used")}`;
|
|
17473
17606
|
}
|
|
17474
17607
|
if (acc) {
|
|
17475
17608
|
if (usageData?.priceBehavior === "pay_in_advance" && typeof price === "number" && typeof allocation === "number") {
|
|
17476
|
-
acc += ` \u2022 ${formatCurrency(price * allocation)}`;
|
|
17609
|
+
acc += ` \u2022 ${formatCurrency(price * allocation, currency)}`;
|
|
17477
17610
|
} else if (usageData?.priceBehavior === "pay_as_you_go" && typeof price === "number" && typeof usage === "number") {
|
|
17478
|
-
acc += ` \u2022 ${formatCurrency(price * usage)}`;
|
|
17611
|
+
acc += ` \u2022 ${formatCurrency(price * usage, currency)}`;
|
|
17479
17612
|
}
|
|
17480
17613
|
return acc;
|
|
17481
17614
|
}
|
|
@@ -17777,9 +17910,9 @@ function resolveDesignProps2(props) {
|
|
|
17777
17910
|
function formatInvoices(invoices) {
|
|
17778
17911
|
return (invoices || []).filter(
|
|
17779
17912
|
({ url, amountDue, amountPaid }) => url && (amountDue === 0 || amountPaid > 0)
|
|
17780
|
-
).sort((a2, b2) => a2.dueDate && b2.dueDate ? +b2.dueDate - +a2.dueDate : 1).map(({ amountDue, dueDate, url }) => ({
|
|
17913
|
+
).sort((a2, b2) => a2.dueDate && b2.dueDate ? +b2.dueDate - +a2.dueDate : 1).map(({ amountDue, dueDate, url, currency }) => ({
|
|
17781
17914
|
...dueDate && { date: toPrettyDate(dueDate) },
|
|
17782
|
-
amount: formatCurrency(amountDue),
|
|
17915
|
+
amount: formatCurrency(amountDue, currency),
|
|
17783
17916
|
url
|
|
17784
17917
|
}));
|
|
17785
17918
|
}
|
|
@@ -17962,10 +18095,13 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
17962
18095
|
yearlyUsageBasedPrice
|
|
17963
18096
|
}, index) => {
|
|
17964
18097
|
let price;
|
|
18098
|
+
let currency;
|
|
17965
18099
|
if (planPeriod === "month") {
|
|
17966
18100
|
price = monthlyUsageBasedPrice?.price;
|
|
18101
|
+
currency = monthlyUsageBasedPrice?.currency;
|
|
17967
18102
|
} else if (planPeriod === "year") {
|
|
17968
18103
|
price = yearlyUsageBasedPrice?.price;
|
|
18104
|
+
currency = yearlyUsageBasedPrice?.currency;
|
|
17969
18105
|
}
|
|
17970
18106
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Element, { as: Flex, $gap: "1.5rem", children: [
|
|
17971
18107
|
props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -18039,7 +18175,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18039
18175
|
formatNumber(allocation),
|
|
18040
18176
|
" ",
|
|
18041
18177
|
(0, import_pluralize5.default)(feature.name, allocation)
|
|
18042
|
-
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
18178
|
+
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
18043
18179
|
formatNumber(usage),
|
|
18044
18180
|
" ",
|
|
18045
18181
|
(0, import_pluralize5.default)(feature.name, usage)
|
|
@@ -18524,19 +18660,23 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18524
18660
|
(acc, usage) => {
|
|
18525
18661
|
const quantity = usage?.allocation ?? 0;
|
|
18526
18662
|
let price;
|
|
18663
|
+
let currencyCode = "USD";
|
|
18527
18664
|
if (currentPlan?.planPeriod === "month") {
|
|
18528
18665
|
price = usage.monthlyUsageBasedPrice?.price;
|
|
18666
|
+
currencyCode = usage.monthlyUsageBasedPrice?.currency ?? "USD";
|
|
18529
18667
|
} else if (currentPlan?.planPeriod === "year") {
|
|
18530
18668
|
price = usage.yearlyUsageBasedPrice?.price;
|
|
18669
|
+
currencyCode = usage.yearlyUsageBasedPrice?.currency ?? "USD";
|
|
18531
18670
|
}
|
|
18532
18671
|
if (usage.priceBehavior && typeof price === "number" && quantity > 0) {
|
|
18533
|
-
acc.push({ ...usage, price, quantity });
|
|
18672
|
+
acc.push({ ...usage, price, quantity, currencyCode });
|
|
18534
18673
|
}
|
|
18535
18674
|
return acc;
|
|
18536
18675
|
},
|
|
18537
18676
|
[]
|
|
18538
18677
|
);
|
|
18539
18678
|
const billingSubscription = data.company?.billingSubscription;
|
|
18679
|
+
const subscriptionCurrency = billingSubscription?.currency ?? "USD";
|
|
18540
18680
|
const showTrialBox = billingSubscription && billingSubscription.status == "trialing";
|
|
18541
18681
|
const trialEndDate = billingSubscription?.trialEnd ? new Date(billingSubscription.trialEnd * 1e3) : /* @__PURE__ */ new Date();
|
|
18542
18682
|
const todayDate = /* @__PURE__ */ new Date();
|
|
@@ -18630,7 +18770,10 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18630
18770
|
$size: theme.typography[props.header.price.fontStyle].fontSize,
|
|
18631
18771
|
$weight: theme.typography[props.header.price.fontStyle].fontWeight,
|
|
18632
18772
|
$color: theme.typography[props.header.price.fontStyle].color,
|
|
18633
|
-
children: formatCurrency(
|
|
18773
|
+
children: formatCurrency(
|
|
18774
|
+
currentPlan.planPrice,
|
|
18775
|
+
subscriptionCurrency
|
|
18776
|
+
)
|
|
18634
18777
|
}
|
|
18635
18778
|
),
|
|
18636
18779
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
@@ -18688,7 +18831,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18688
18831
|
$weight: theme.typography.text.fontWeight,
|
|
18689
18832
|
$color: theme.typography.text.color,
|
|
18690
18833
|
children: [
|
|
18691
|
-
formatCurrency(addOn.planPrice),
|
|
18834
|
+
formatCurrency(addOn.planPrice, subscriptionCurrency),
|
|
18692
18835
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("sub", { children: [
|
|
18693
18836
|
"/",
|
|
18694
18837
|
shortenPeriod(addOn.planPeriod)
|
|
@@ -18751,7 +18894,10 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18751
18894
|
$weight: theme.typography.text.fontWeight,
|
|
18752
18895
|
$color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
|
|
18753
18896
|
children: [
|
|
18754
|
-
formatCurrency(
|
|
18897
|
+
formatCurrency(
|
|
18898
|
+
entitlement.price,
|
|
18899
|
+
entitlement.currencyCode
|
|
18900
|
+
),
|
|
18755
18901
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("sub", { children: [
|
|
18756
18902
|
"/",
|
|
18757
18903
|
(0, import_pluralize6.default)(
|
|
@@ -18773,7 +18919,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18773
18919
|
$color: theme.typography.text.color,
|
|
18774
18920
|
children: [
|
|
18775
18921
|
formatCurrency(
|
|
18776
|
-
entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1)
|
|
18922
|
+
entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1),
|
|
18923
|
+
entitlement.currencyCode
|
|
18777
18924
|
),
|
|
18778
18925
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("sub", { children: [
|
|
18779
18926
|
"/",
|
|
@@ -18953,7 +19100,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
18953
19100
|
$display: "grid",
|
|
18954
19101
|
$gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
|
|
18955
19102
|
$gap: "1rem",
|
|
18956
|
-
children: plans.map((plan, index
|
|
19103
|
+
children: plans.map((plan, index) => {
|
|
18957
19104
|
const isActivePlan = plan.current && data.company?.plan?.planPeriod === selectedPeriod;
|
|
18958
19105
|
const count = entitlementCounts[plan.id];
|
|
18959
19106
|
let isExpanded = false;
|
|
@@ -19013,7 +19160,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19013
19160
|
$weight: theme.typography[props.plans.name.fontStyle].fontWeight,
|
|
19014
19161
|
$color: theme.typography[props.plans.name.fontStyle].color,
|
|
19015
19162
|
children: formatCurrency(
|
|
19016
|
-
(selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0
|
|
19163
|
+
(selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0,
|
|
19164
|
+
(selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.currency
|
|
19017
19165
|
)
|
|
19018
19166
|
}
|
|
19019
19167
|
),
|
|
@@ -19058,18 +19206,6 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19058
19206
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
19059
19207
|
children: [
|
|
19060
19208
|
props.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: [
|
|
19061
|
-
props.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19062
|
-
Text,
|
|
19063
|
-
{
|
|
19064
|
-
$font: theme.typography.text.fontFamily,
|
|
19065
|
-
$size: theme.typography.text.fontSize,
|
|
19066
|
-
$weight: theme.typography.text.fontWeight,
|
|
19067
|
-
$color: theme.typography.text.color,
|
|
19068
|
-
children: t2("Everything in", {
|
|
19069
|
-
plan: self2[index - 1].name
|
|
19070
|
-
})
|
|
19071
|
-
}
|
|
19072
|
-
) }),
|
|
19073
19209
|
plan.entitlements.slice().sort((a2, b2) => {
|
|
19074
19210
|
if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
|
|
19075
19211
|
return 1;
|
|
@@ -19080,10 +19216,13 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19080
19216
|
return 0;
|
|
19081
19217
|
}).reduce((acc, entitlement) => {
|
|
19082
19218
|
let price;
|
|
19219
|
+
let currency;
|
|
19083
19220
|
if (selectedPeriod === "month") {
|
|
19084
19221
|
price = entitlement.meteredMonthlyPrice?.price;
|
|
19222
|
+
currency = entitlement.meteredMonthlyPrice?.currency;
|
|
19085
19223
|
} else if (selectedPeriod === "year") {
|
|
19086
19224
|
price = entitlement.meteredYearlyPrice?.price;
|
|
19225
|
+
currency = entitlement.meteredYearlyPrice?.currency;
|
|
19087
19226
|
}
|
|
19088
19227
|
if (entitlement.priceBehavior && typeof price !== "number") {
|
|
19089
19228
|
return acc;
|
|
@@ -19110,7 +19249,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19110
19249
|
$color: theme.typography.text.color,
|
|
19111
19250
|
$leading: 1.35,
|
|
19112
19251
|
children: typeof price !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19113
|
-
formatCurrency(price),
|
|
19252
|
+
formatCurrency(price, currency),
|
|
19114
19253
|
" ",
|
|
19115
19254
|
t2("per"),
|
|
19116
19255
|
" ",
|
|
@@ -19328,7 +19467,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19328
19467
|
$weight: theme.typography[props.plans.name.fontStyle].fontWeight,
|
|
19329
19468
|
$color: theme.typography[props.plans.name.fontStyle].color,
|
|
19330
19469
|
children: formatCurrency(
|
|
19331
|
-
(selectedPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0
|
|
19470
|
+
(selectedPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0,
|
|
19471
|
+
(selectedPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.currency
|
|
19332
19472
|
)
|
|
19333
19473
|
}
|
|
19334
19474
|
),
|
|
@@ -19511,7 +19651,8 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19511
19651
|
},
|
|
19512
19652
|
...data.upcomingInvoice?.dueDate && {
|
|
19513
19653
|
dueDate: toPrettyDate(new Date(data.upcomingInvoice.dueDate))
|
|
19514
|
-
}
|
|
19654
|
+
},
|
|
19655
|
+
currency: data.upcomingInvoice?.currency
|
|
19515
19656
|
}
|
|
19516
19657
|
};
|
|
19517
19658
|
}, [data.subscription, data.upcomingInvoice]);
|
|
@@ -19550,7 +19691,10 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19550
19691
|
$weight: theme.typography[props.price.fontStyle].fontWeight,
|
|
19551
19692
|
$color: theme.typography[props.price.fontStyle].color,
|
|
19552
19693
|
$leading: 1,
|
|
19553
|
-
children: formatCurrency(
|
|
19694
|
+
children: formatCurrency(
|
|
19695
|
+
upcomingInvoice.amountDue,
|
|
19696
|
+
upcomingInvoice.currency
|
|
19697
|
+
)
|
|
19554
19698
|
}
|
|
19555
19699
|
) }),
|
|
19556
19700
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -19565,7 +19709,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19565
19709
|
}
|
|
19566
19710
|
) })
|
|
19567
19711
|
] }),
|
|
19568
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
19712
|
+
discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
19569
19713
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19570
19714
|
Text,
|
|
19571
19715
|
{
|
|
@@ -19720,7 +19864,7 @@ var Error2 = ({ message }) => {
|
|
|
19720
19864
|
);
|
|
19721
19865
|
};
|
|
19722
19866
|
var ComponentTree = () => {
|
|
19723
|
-
const { error, nodes } = useEmbed();
|
|
19867
|
+
const { error, nodes, isPending } = useEmbed();
|
|
19724
19868
|
const [children, setChildren] = (0, import_react40.useState)(/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Loading, {}));
|
|
19725
19869
|
(0, import_react40.useEffect)(() => {
|
|
19726
19870
|
const renderer = createRenderer();
|
|
@@ -19730,7 +19874,7 @@ var ComponentTree = () => {
|
|
|
19730
19874
|
console.error(error);
|
|
19731
19875
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Error2, { message: error.message });
|
|
19732
19876
|
}
|
|
19733
|
-
if (
|
|
19877
|
+
if (isPending) {
|
|
19734
19878
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Loading, {});
|
|
19735
19879
|
}
|
|
19736
19880
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
|