@schematichq/schematic-components 0.7.11 → 0.7.13
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 +347 -90
- package/dist/schematic-components.d.ts +33 -1
- package/dist/schematic-components.esm.js +376 -119
- package/package.json +11 -11
|
@@ -9603,6 +9603,10 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9603
9603
|
break;
|
|
9604
9604
|
}
|
|
9605
9605
|
}
|
|
9606
|
+
if (!this.resolvedLanguage && this.languages.indexOf(l2) < 0 && this.store.hasLanguageSomeTranslations(l2)) {
|
|
9607
|
+
this.resolvedLanguage = l2;
|
|
9608
|
+
if (this.languages.indexOf(l2) < 0) this.languages.unshift(l2);
|
|
9609
|
+
}
|
|
9606
9610
|
}
|
|
9607
9611
|
changeLanguage(lng, callback) {
|
|
9608
9612
|
var _this2 = this;
|
|
@@ -9636,7 +9640,8 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9636
9640
|
};
|
|
9637
9641
|
const setLng = (lngs) => {
|
|
9638
9642
|
if (!lng && !lngs && this.services.languageDetector) lngs = [];
|
|
9639
|
-
const
|
|
9643
|
+
const fl = isString(lngs) ? lngs : lngs && lngs[0];
|
|
9644
|
+
const l2 = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
|
|
9640
9645
|
if (l2) {
|
|
9641
9646
|
if (!this.language) {
|
|
9642
9647
|
setLngProps(l2);
|
|
@@ -15776,6 +15781,20 @@ function HydrateComponentResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
15776
15781
|
};
|
|
15777
15782
|
}
|
|
15778
15783
|
|
|
15784
|
+
// src/api/checkoutexternal/models/HydrateUpcomingInvoiceResponse.ts
|
|
15785
|
+
function HydrateUpcomingInvoiceResponseFromJSON(json) {
|
|
15786
|
+
return HydrateUpcomingInvoiceResponseFromJSONTyped(json, false);
|
|
15787
|
+
}
|
|
15788
|
+
function HydrateUpcomingInvoiceResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
15789
|
+
if (json == null) {
|
|
15790
|
+
return json;
|
|
15791
|
+
}
|
|
15792
|
+
return {
|
|
15793
|
+
data: InvoiceResponseDataFromJSON(json["data"]),
|
|
15794
|
+
params: json["params"]
|
|
15795
|
+
};
|
|
15796
|
+
}
|
|
15797
|
+
|
|
15779
15798
|
// src/api/checkoutexternal/models/ListInvoicesParams.ts
|
|
15780
15799
|
function ListInvoicesParamsFromJSON(json) {
|
|
15781
15800
|
return ListInvoicesParamsFromJSONTyped(json, false);
|
|
@@ -16112,6 +16131,50 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
16112
16131
|
);
|
|
16113
16132
|
return await response.value();
|
|
16114
16133
|
}
|
|
16134
|
+
/**
|
|
16135
|
+
* Hydrate upcoming invoice
|
|
16136
|
+
*/
|
|
16137
|
+
async hydrateUpcomingInvoiceRaw(requestParameters, initOverrides) {
|
|
16138
|
+
if (requestParameters["componentId"] == null) {
|
|
16139
|
+
throw new RequiredError(
|
|
16140
|
+
"componentId",
|
|
16141
|
+
'Required parameter "componentId" was null or undefined when calling hydrateUpcomingInvoice().'
|
|
16142
|
+
);
|
|
16143
|
+
}
|
|
16144
|
+
const queryParameters = {};
|
|
16145
|
+
const headerParameters = {};
|
|
16146
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
16147
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
16148
|
+
"X-Schematic-Api-Key"
|
|
16149
|
+
);
|
|
16150
|
+
}
|
|
16151
|
+
const response = await this.request(
|
|
16152
|
+
{
|
|
16153
|
+
path: `/components/{component_id}/hydrate/upcoming-invoice`.replace(
|
|
16154
|
+
`{${"component_id"}}`,
|
|
16155
|
+
encodeURIComponent(String(requestParameters["componentId"]))
|
|
16156
|
+
),
|
|
16157
|
+
method: "GET",
|
|
16158
|
+
headers: headerParameters,
|
|
16159
|
+
query: queryParameters
|
|
16160
|
+
},
|
|
16161
|
+
initOverrides
|
|
16162
|
+
);
|
|
16163
|
+
return new JSONApiResponse(
|
|
16164
|
+
response,
|
|
16165
|
+
(jsonValue) => HydrateUpcomingInvoiceResponseFromJSON(jsonValue)
|
|
16166
|
+
);
|
|
16167
|
+
}
|
|
16168
|
+
/**
|
|
16169
|
+
* Hydrate upcoming invoice
|
|
16170
|
+
*/
|
|
16171
|
+
async hydrateUpcomingInvoice(requestParameters, initOverrides) {
|
|
16172
|
+
const response = await this.hydrateUpcomingInvoiceRaw(
|
|
16173
|
+
requestParameters,
|
|
16174
|
+
initOverrides
|
|
16175
|
+
);
|
|
16176
|
+
return await response.value();
|
|
16177
|
+
}
|
|
16115
16178
|
/**
|
|
16116
16179
|
* List invoices
|
|
16117
16180
|
*/
|
|
@@ -16300,7 +16363,7 @@ var en_default = {
|
|
|
16300
16363
|
Monthly: "Monthly",
|
|
16301
16364
|
Next: "Next",
|
|
16302
16365
|
"No limit": "No limit",
|
|
16303
|
-
"No payment method
|
|
16366
|
+
"No payment method added yet": "No payment method added yet",
|
|
16304
16367
|
"Not ready to cancel?": "Not ready to cancel?",
|
|
16305
16368
|
"On demand": "On demand",
|
|
16306
16369
|
"One time ": "One time",
|
|
@@ -16323,6 +16386,7 @@ var en_default = {
|
|
|
16323
16386
|
"See less": "See less",
|
|
16324
16387
|
"See more": "See more",
|
|
16325
16388
|
"Select add-ons": "Select add-ons",
|
|
16389
|
+
"Select existing payment method": "Select existing payment method",
|
|
16326
16390
|
"Select payment method": "Select payment method",
|
|
16327
16391
|
"Select plan": "Select plan",
|
|
16328
16392
|
"Select quantity": "Select quantity",
|
|
@@ -17031,7 +17095,7 @@ var EmbedProvider = ({
|
|
|
17031
17095
|
useEffect2(() => {
|
|
17032
17096
|
if (accessToken) {
|
|
17033
17097
|
const { headers = {} } = apiConfig ?? {};
|
|
17034
|
-
headers["X-Schematic-Components-Version"] = "0.7.
|
|
17098
|
+
headers["X-Schematic-Components-Version"] = "0.7.13";
|
|
17035
17099
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
17036
17100
|
const config = new Configuration({
|
|
17037
17101
|
...apiConfig,
|
|
@@ -19163,7 +19227,8 @@ var Sidebar = ({
|
|
|
19163
19227
|
if (typeof entitlement.allocation === "number" && entitlement.feature?.name) {
|
|
19164
19228
|
const {
|
|
19165
19229
|
price: entitlementPrice,
|
|
19166
|
-
currency: entitlementCurrency
|
|
19230
|
+
currency: entitlementCurrency,
|
|
19231
|
+
packageSize: entitlementPackageSize = 1
|
|
19167
19232
|
} = getBillingPrice(
|
|
19168
19233
|
planPeriod === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice
|
|
19169
19234
|
) || {};
|
|
@@ -19220,7 +19285,14 @@ var Sidebar = ({
|
|
|
19220
19285
|
),
|
|
19221
19286
|
/* @__PURE__ */ jsxs8("sub", { children: [
|
|
19222
19287
|
"/",
|
|
19223
|
-
|
|
19288
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
19289
|
+
entitlementPackageSize,
|
|
19290
|
+
" "
|
|
19291
|
+
] }),
|
|
19292
|
+
getFeatureName(
|
|
19293
|
+
entitlement.feature,
|
|
19294
|
+
entitlementPackageSize
|
|
19295
|
+
)
|
|
19224
19296
|
] })
|
|
19225
19297
|
] })
|
|
19226
19298
|
]
|
|
@@ -19348,7 +19420,8 @@ var Sidebar = ({
|
|
|
19348
19420
|
if (entitlement.feature?.name) {
|
|
19349
19421
|
const {
|
|
19350
19422
|
price: entitlementPrice,
|
|
19351
|
-
currency: entitlementCurrency
|
|
19423
|
+
currency: entitlementCurrency,
|
|
19424
|
+
packageSize: entitlementPackageSize = 1
|
|
19352
19425
|
} = getBillingPrice(
|
|
19353
19426
|
planPeriod === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
|
|
19354
19427
|
) || {};
|
|
@@ -19402,7 +19475,14 @@ var Sidebar = ({
|
|
|
19402
19475
|
),
|
|
19403
19476
|
/* @__PURE__ */ jsxs8("sub", { children: [
|
|
19404
19477
|
"/",
|
|
19405
|
-
|
|
19478
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
19479
|
+
entitlementPackageSize,
|
|
19480
|
+
" "
|
|
19481
|
+
] }),
|
|
19482
|
+
getFeatureName(
|
|
19483
|
+
entitlement.feature,
|
|
19484
|
+
entitlementPackageSize
|
|
19485
|
+
)
|
|
19406
19486
|
] })
|
|
19407
19487
|
] })
|
|
19408
19488
|
]
|
|
@@ -20384,9 +20464,10 @@ var Plan = ({
|
|
|
20384
20464
|
const limit = entitlement.softLimit ?? entitlement.valueNumeric;
|
|
20385
20465
|
const entitlementPriceObject = getBillingPrice(
|
|
20386
20466
|
period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
|
|
20387
|
-
)
|
|
20467
|
+
);
|
|
20388
20468
|
let entitlementPrice = entitlementPriceObject?.price;
|
|
20389
20469
|
const entitlementCurrency = entitlementPriceObject?.currency;
|
|
20470
|
+
const entitlementPackageSize = entitlementPriceObject?.packageSize ?? 1;
|
|
20390
20471
|
if (entitlement.priceBehavior === "overage" && entitlementPriceObject) {
|
|
20391
20472
|
const { priceTier } = entitlementPriceObject;
|
|
20392
20473
|
if (priceTier.length > 1) {
|
|
@@ -20441,7 +20522,14 @@ var Plan = ({
|
|
|
20441
20522
|
" ",
|
|
20442
20523
|
t2("per"),
|
|
20443
20524
|
" ",
|
|
20444
|
-
|
|
20525
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
20526
|
+
entitlementPackageSize,
|
|
20527
|
+
" "
|
|
20528
|
+
] }),
|
|
20529
|
+
getFeatureName(
|
|
20530
|
+
entitlement.feature,
|
|
20531
|
+
entitlementPackageSize
|
|
20532
|
+
),
|
|
20445
20533
|
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
20446
20534
|
" ",
|
|
20447
20535
|
t2("per"),
|
|
@@ -20495,7 +20583,14 @@ var Plan = ({
|
|
|
20495
20583
|
entitlementCurrency
|
|
20496
20584
|
),
|
|
20497
20585
|
"/",
|
|
20498
|
-
|
|
20586
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
20587
|
+
entitlementPackageSize,
|
|
20588
|
+
" "
|
|
20589
|
+
] }),
|
|
20590
|
+
getFeatureName(
|
|
20591
|
+
entitlement.feature,
|
|
20592
|
+
entitlementPackageSize
|
|
20593
|
+
),
|
|
20499
20594
|
entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
20500
20595
|
"/",
|
|
20501
20596
|
shortenPeriod(period)
|
|
@@ -20640,7 +20735,11 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
20640
20735
|
return /* @__PURE__ */ jsx18(Fragment9, { children: /* @__PURE__ */ jsx18(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce(
|
|
20641
20736
|
(acc, entitlement, index) => {
|
|
20642
20737
|
if (entitlement.priceBehavior === "pay_in_advance" && entitlement.feature) {
|
|
20643
|
-
const {
|
|
20738
|
+
const {
|
|
20739
|
+
price,
|
|
20740
|
+
currency,
|
|
20741
|
+
packageSize = 1
|
|
20742
|
+
} = getBillingPrice(
|
|
20644
20743
|
period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
|
|
20645
20744
|
) || {};
|
|
20646
20745
|
acc.push(
|
|
@@ -20768,7 +20867,11 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
20768
20867
|
formatCurrency(price ?? 0, currency),
|
|
20769
20868
|
/* @__PURE__ */ jsxs13("sub", { children: [
|
|
20770
20869
|
"/",
|
|
20771
|
-
|
|
20870
|
+
packageSize > 1 && /* @__PURE__ */ jsxs13(Fragment9, { children: [
|
|
20871
|
+
packageSize,
|
|
20872
|
+
" "
|
|
20873
|
+
] }),
|
|
20874
|
+
getFeatureName(entitlement.feature, packageSize),
|
|
20772
20875
|
"/",
|
|
20773
20876
|
shortenPeriod(period)
|
|
20774
20877
|
] })
|
|
@@ -20816,7 +20919,9 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
20816
20919
|
const contentRef = useRef5(null);
|
|
20817
20920
|
const checkoutRef = useRef5(null);
|
|
20818
20921
|
const [charges, setCharges] = useState8();
|
|
20819
|
-
const [paymentMethodId, setPaymentMethodId] = useState8(
|
|
20922
|
+
const [paymentMethodId, setPaymentMethodId] = useState8(
|
|
20923
|
+
(data.subscription?.paymentMethod || data.company?.defaultPaymentMethod)?.externalId
|
|
20924
|
+
);
|
|
20820
20925
|
const [isLoading, setIsLoading] = useState8(false);
|
|
20821
20926
|
const [error, setError] = useState8();
|
|
20822
20927
|
const [promoCode, setPromoCode] = useState8();
|
|
@@ -21310,6 +21415,7 @@ var PaymentForm = ({ onConfirm }) => {
|
|
|
21310
21415
|
const [message, setMessage] = useState9(null);
|
|
21311
21416
|
const [isLoading, setIsLoading] = useState9(false);
|
|
21312
21417
|
const [isConfirmed, setIsConfirmed] = useState9(false);
|
|
21418
|
+
const [isComplete, setIsComplete] = useState9(false);
|
|
21313
21419
|
const handleSubmit = async (event) => {
|
|
21314
21420
|
event.preventDefault();
|
|
21315
21421
|
if (!api || !stripe || !elements) {
|
|
@@ -21352,12 +21458,20 @@ var PaymentForm = ({ onConfirm }) => {
|
|
|
21352
21458
|
overflowY: "auto"
|
|
21353
21459
|
},
|
|
21354
21460
|
children: [
|
|
21355
|
-
/* @__PURE__ */ jsx21(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx21(
|
|
21461
|
+
/* @__PURE__ */ jsx21(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx21(
|
|
21462
|
+
PaymentElement,
|
|
21463
|
+
{
|
|
21464
|
+
id: "payment-element",
|
|
21465
|
+
onChange: (event) => {
|
|
21466
|
+
setIsComplete(event.complete);
|
|
21467
|
+
}
|
|
21468
|
+
}
|
|
21469
|
+
) }),
|
|
21356
21470
|
/* @__PURE__ */ jsx21(
|
|
21357
21471
|
Button,
|
|
21358
21472
|
{
|
|
21359
21473
|
id: "submit",
|
|
21360
|
-
disabled: isLoading || !stripe || !elements || isConfirmed,
|
|
21474
|
+
disabled: isLoading || !stripe || !elements || isConfirmed || !isComplete,
|
|
21361
21475
|
style: { flexShrink: 0 },
|
|
21362
21476
|
$color: "primary",
|
|
21363
21477
|
$isLoading: isLoading,
|
|
@@ -21959,8 +22073,8 @@ ButtonElement.displayName = "Button";
|
|
|
21959
22073
|
import { forwardRef as forwardRef7, useMemo as useMemo9, useRef as useRef7, useState as useState13 } from "react";
|
|
21960
22074
|
|
|
21961
22075
|
// src/components/elements/included-features/Details.tsx
|
|
21962
|
-
import { useMemo as useMemo8 } from "react";
|
|
21963
|
-
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
22076
|
+
import { Fragment as Fragment11, useMemo as useMemo8 } from "react";
|
|
22077
|
+
import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
21964
22078
|
var Details = ({
|
|
21965
22079
|
shouldWrapChildren,
|
|
21966
22080
|
featureUsage,
|
|
@@ -21978,12 +22092,19 @@ var Details = ({
|
|
|
21978
22092
|
const { t: t2 } = useTranslation();
|
|
21979
22093
|
const theme = nt();
|
|
21980
22094
|
const { data } = useEmbed();
|
|
21981
|
-
const {
|
|
22095
|
+
const {
|
|
22096
|
+
price,
|
|
22097
|
+
priceDecimal,
|
|
22098
|
+
priceTier,
|
|
22099
|
+
currency,
|
|
22100
|
+
packageSize = 1
|
|
22101
|
+
} = useMemo8(() => {
|
|
21982
22102
|
const {
|
|
21983
22103
|
price: entitlementPrice,
|
|
21984
22104
|
priceDecimal: entitlementPriceDecimal,
|
|
21985
22105
|
priceTier: entitlementPriceTier,
|
|
21986
|
-
currency: entitlementCurrency
|
|
22106
|
+
currency: entitlementCurrency,
|
|
22107
|
+
packageSize: entitlementPackageSize
|
|
21987
22108
|
} = getBillingPrice(
|
|
21988
22109
|
data.company?.plan?.planPeriod === "year" ? yearlyUsageBasedPrice : monthlyUsageBasedPrice
|
|
21989
22110
|
) || {};
|
|
@@ -21991,7 +22112,8 @@ var Details = ({
|
|
|
21991
22112
|
price: entitlementPrice,
|
|
21992
22113
|
priceDecimal: entitlementPriceDecimal,
|
|
21993
22114
|
priceTier: entitlementPriceTier,
|
|
21994
|
-
currency: entitlementCurrency
|
|
22115
|
+
currency: entitlementCurrency,
|
|
22116
|
+
packageSize: entitlementPackageSize
|
|
21995
22117
|
};
|
|
21996
22118
|
}, [
|
|
21997
22119
|
data.company?.plan?.planPeriod,
|
|
@@ -22003,36 +22125,104 @@ var Details = ({
|
|
|
22003
22125
|
return;
|
|
22004
22126
|
}
|
|
22005
22127
|
if (priceBehavior === "pay_in_advance" && typeof allocation === "number") {
|
|
22006
|
-
return
|
|
22128
|
+
return /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
22129
|
+
formatNumber(allocation),
|
|
22130
|
+
" ",
|
|
22131
|
+
getFeatureName(feature, allocation)
|
|
22132
|
+
] });
|
|
22007
22133
|
}
|
|
22008
22134
|
if (priceBehavior === "pay_as_you_go" && typeof price === "number") {
|
|
22009
|
-
return
|
|
22135
|
+
return /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
22136
|
+
formatCurrency(price, currency),
|
|
22137
|
+
" ",
|
|
22138
|
+
t2("per"),
|
|
22139
|
+
" ",
|
|
22140
|
+
packageSize > 1 && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
22141
|
+
packageSize,
|
|
22142
|
+
" "
|
|
22143
|
+
] }),
|
|
22144
|
+
getFeatureName(feature, packageSize)
|
|
22145
|
+
] });
|
|
22010
22146
|
}
|
|
22011
22147
|
if (priceBehavior === "overage" && typeof softLimit === "number") {
|
|
22012
|
-
return
|
|
22148
|
+
return /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
22149
|
+
formatNumber(softLimit),
|
|
22150
|
+
" ",
|
|
22151
|
+
getFeatureName(feature, softLimit)
|
|
22152
|
+
] });
|
|
22013
22153
|
}
|
|
22014
22154
|
if (!priceBehavior && typeof allocation === "number") {
|
|
22015
|
-
return
|
|
22155
|
+
return /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
22156
|
+
formatNumber(allocation),
|
|
22157
|
+
" ",
|
|
22158
|
+
getFeatureName(feature, allocation)
|
|
22159
|
+
] });
|
|
22016
22160
|
}
|
|
22017
22161
|
if (!priceBehavior) {
|
|
22018
22162
|
return t2("Unlimited", { item: getFeatureName(feature) });
|
|
22019
22163
|
}
|
|
22020
|
-
}, [
|
|
22164
|
+
}, [
|
|
22165
|
+
t2,
|
|
22166
|
+
allocation,
|
|
22167
|
+
feature,
|
|
22168
|
+
price,
|
|
22169
|
+
priceBehavior,
|
|
22170
|
+
currency,
|
|
22171
|
+
packageSize,
|
|
22172
|
+
softLimit
|
|
22173
|
+
]);
|
|
22021
22174
|
const usageText = useMemo8(() => {
|
|
22022
22175
|
if (!feature) {
|
|
22023
22176
|
return;
|
|
22024
22177
|
}
|
|
22025
|
-
|
|
22178
|
+
const acc = [];
|
|
22179
|
+
let index = 0;
|
|
22026
22180
|
if (priceBehavior === "pay_in_advance" && typeof data.company?.plan?.planPeriod === "string" && typeof price === "number") {
|
|
22027
|
-
acc
|
|
22181
|
+
acc.push(
|
|
22182
|
+
/* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
22183
|
+
formatCurrency(price, currency),
|
|
22184
|
+
"/",
|
|
22185
|
+
packageSize > 1 && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
22186
|
+
packageSize,
|
|
22187
|
+
" "
|
|
22188
|
+
] }),
|
|
22189
|
+
getFeatureName(feature, packageSize),
|
|
22190
|
+
"/",
|
|
22191
|
+
shortenPeriod(data.company.plan.planPeriod)
|
|
22192
|
+
] }, index)
|
|
22193
|
+
);
|
|
22194
|
+
index += 1;
|
|
22028
22195
|
} else if ((priceBehavior === "pay_as_you_go" || priceBehavior === "overage") && typeof usage === "number") {
|
|
22029
|
-
acc
|
|
22196
|
+
acc.push(
|
|
22197
|
+
/* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
22198
|
+
usage,
|
|
22199
|
+
" ",
|
|
22200
|
+
getFeatureName(feature, usage),
|
|
22201
|
+
" ",
|
|
22202
|
+
t2("used")
|
|
22203
|
+
] }, index)
|
|
22204
|
+
);
|
|
22205
|
+
index += 1;
|
|
22030
22206
|
}
|
|
22031
22207
|
if (acc) {
|
|
22032
22208
|
if (priceBehavior === "pay_in_advance" && typeof price === "number" && typeof allocation === "number") {
|
|
22033
|
-
acc
|
|
22209
|
+
acc.push(
|
|
22210
|
+
/* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
22211
|
+
" ",
|
|
22212
|
+
"\u2022 ",
|
|
22213
|
+
formatCurrency(price * allocation, currency)
|
|
22214
|
+
] }, index)
|
|
22215
|
+
);
|
|
22216
|
+
index += 1;
|
|
22034
22217
|
} else if (priceBehavior === "pay_as_you_go" && typeof price === "number" && typeof usage === "number") {
|
|
22035
|
-
acc
|
|
22218
|
+
acc.push(
|
|
22219
|
+
/* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
22220
|
+
" ",
|
|
22221
|
+
"\u2022 ",
|
|
22222
|
+
formatCurrency(price * usage, currency)
|
|
22223
|
+
] }, index)
|
|
22224
|
+
);
|
|
22225
|
+
index += 1;
|
|
22036
22226
|
} else if (priceBehavior === "overage" && typeof price === "number" && typeof usage === "number" && typeof softLimit === "number") {
|
|
22037
22227
|
let overagePrice = price ?? priceDecimal;
|
|
22038
22228
|
if (priceTier?.length === 2) {
|
|
@@ -22046,7 +22236,16 @@ var Details = ({
|
|
|
22046
22236
|
const cost = usage - softLimit < 0 ? 0 : overagePrice * (usage - softLimit);
|
|
22047
22237
|
const period = feature.featureType === "trait" && typeof data.company?.plan?.planPeriod === "string" ? `/${shortenPeriod(data.company.plan.planPeriod)}` : "";
|
|
22048
22238
|
if (cost > 0) {
|
|
22049
|
-
acc
|
|
22239
|
+
acc.push(
|
|
22240
|
+
/* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
22241
|
+
" ",
|
|
22242
|
+
"\u2022 ",
|
|
22243
|
+
formatCurrency(cost),
|
|
22244
|
+
"$",
|
|
22245
|
+
period
|
|
22246
|
+
] }, index)
|
|
22247
|
+
);
|
|
22248
|
+
index += 1;
|
|
22050
22249
|
}
|
|
22051
22250
|
}
|
|
22052
22251
|
return acc;
|
|
@@ -22069,6 +22268,7 @@ var Details = ({
|
|
|
22069
22268
|
priceDecimal,
|
|
22070
22269
|
priceTier,
|
|
22071
22270
|
currency,
|
|
22271
|
+
packageSize,
|
|
22072
22272
|
softLimit,
|
|
22073
22273
|
usage
|
|
22074
22274
|
]);
|
|
@@ -22460,7 +22660,7 @@ var Container3 = dt.div`
|
|
|
22460
22660
|
`;
|
|
22461
22661
|
|
|
22462
22662
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
22463
|
-
import { Fragment as
|
|
22663
|
+
import { Fragment as Fragment13, jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
22464
22664
|
function resolveDesignProps4(props) {
|
|
22465
22665
|
return {
|
|
22466
22666
|
isVisible: props.isVisible ?? true,
|
|
@@ -22529,9 +22729,11 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
22529
22729
|
}, index) => {
|
|
22530
22730
|
const limit = softLimit ?? allocation ?? 0;
|
|
22531
22731
|
const isOverage = priceBehavior === "overage" && typeof softLimit === "number" && typeof usage === "number" && usage > softLimit;
|
|
22532
|
-
|
|
22732
|
+
const billingPrice = getBillingPrice(
|
|
22533
22733
|
planPeriod === "year" ? yearlyUsageBasedPrice : monthlyUsageBasedPrice
|
|
22534
|
-
)
|
|
22734
|
+
);
|
|
22735
|
+
let { price, currency } = billingPrice || {};
|
|
22736
|
+
const packageSize = billingPrice?.packageSize ?? 1;
|
|
22535
22737
|
if (priceBehavior === "overage") {
|
|
22536
22738
|
const productId = (yearlyUsageBasedPrice ?? monthlyUsageBasedPrice)?.productId;
|
|
22537
22739
|
if (productId) {
|
|
@@ -22597,7 +22799,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
22597
22799
|
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
|
22598
22800
|
$color: theme.typography[props.header.fontStyle].color,
|
|
22599
22801
|
$leading: 1.35,
|
|
22600
|
-
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ jsxs24(
|
|
22802
|
+
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ jsxs24(Fragment13, { children: [
|
|
22601
22803
|
formatNumber(usage),
|
|
22602
22804
|
" ",
|
|
22603
22805
|
getFeatureName(feature, usage)
|
|
@@ -22635,15 +22837,15 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
22635
22837
|
style: {
|
|
22636
22838
|
whiteSpace: "nowrap"
|
|
22637
22839
|
},
|
|
22638
|
-
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ jsxs24(
|
|
22840
|
+
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ jsxs24(Fragment13, { children: [
|
|
22639
22841
|
formatNumber(allocation),
|
|
22640
22842
|
" ",
|
|
22641
22843
|
getFeatureName(feature, allocation)
|
|
22642
|
-
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ jsxs24(
|
|
22844
|
+
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ jsxs24(Fragment13, { children: [
|
|
22643
22845
|
formatNumber(usage),
|
|
22644
22846
|
" ",
|
|
22645
22847
|
getFeatureName(feature, usage),
|
|
22646
|
-
priceBehavior === "overage" && /* @__PURE__ */ jsxs24(
|
|
22848
|
+
priceBehavior === "overage" && /* @__PURE__ */ jsxs24(Fragment13, { children: [
|
|
22647
22849
|
" ",
|
|
22648
22850
|
t2("used")
|
|
22649
22851
|
] })
|
|
@@ -22736,14 +22938,18 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
22736
22938
|
$weight: theme.typography.text.fontWeight,
|
|
22737
22939
|
$color: theme.typography.text.color,
|
|
22738
22940
|
$leading: 1.35,
|
|
22739
|
-
children: /* @__PURE__ */ jsxs24(
|
|
22941
|
+
children: /* @__PURE__ */ jsxs24(Fragment13, { children: [
|
|
22740
22942
|
t2("Additional"),
|
|
22741
22943
|
": ",
|
|
22742
22944
|
formatCurrency(price, currency),
|
|
22743
22945
|
feature && /* @__PURE__ */ jsxs24(Box, { as: "sub", $whiteSpace: "nowrap", children: [
|
|
22744
22946
|
"/",
|
|
22745
|
-
|
|
22746
|
-
|
|
22947
|
+
packageSize > 1 && /* @__PURE__ */ jsxs24(Fragment13, { children: [
|
|
22948
|
+
packageSize,
|
|
22949
|
+
" "
|
|
22950
|
+
] }),
|
|
22951
|
+
getFeatureName(feature, packageSize),
|
|
22952
|
+
feature.featureType === "trait" && planPeriod && /* @__PURE__ */ jsxs24(Fragment13, { children: [
|
|
22747
22953
|
"/",
|
|
22748
22954
|
shortenPeriod(planPeriod)
|
|
22749
22955
|
] })
|
|
@@ -22808,7 +23014,7 @@ var PaymentElement2 = ({
|
|
|
22808
23014
|
};
|
|
22809
23015
|
var EmptyPaymentElement = () => {
|
|
22810
23016
|
const theme = nt();
|
|
22811
|
-
return /* @__PURE__ */ jsx32(Text, { $font: theme.typography.text.fontFamily, $size: 16, children: /* @__PURE__ */ jsx32(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ jsx32(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx32(Box, { $lineHeight: "1", $marginRight: "4px", children: t("No payment method
|
|
23017
|
+
return /* @__PURE__ */ jsx32(Text, { $font: theme.typography.text.fontFamily, $size: 16, children: /* @__PURE__ */ jsx32(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ jsx32(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx32(Box, { $lineHeight: "1", $marginRight: "4px", children: t("No payment method added yet") }) }) }) });
|
|
22812
23018
|
};
|
|
22813
23019
|
var getPaymentMethodData = ({
|
|
22814
23020
|
accountLast4,
|
|
@@ -23150,7 +23356,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
23150
23356
|
}
|
|
23151
23357
|
stripe._registerWrapper({
|
|
23152
23358
|
name: "stripe-js",
|
|
23153
|
-
version: "7.
|
|
23359
|
+
version: "7.2.0",
|
|
23154
23360
|
startTime
|
|
23155
23361
|
});
|
|
23156
23362
|
};
|
|
@@ -23225,7 +23431,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
23225
23431
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
23226
23432
|
var expectedVersion = RELEASE_TRAIN;
|
|
23227
23433
|
if (isTestKey && version !== expectedVersion) {
|
|
23228
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.
|
|
23434
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.2.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
23229
23435
|
}
|
|
23230
23436
|
var stripe = maybeStripe.apply(void 0, args);
|
|
23231
23437
|
registerWrapper(stripe, startTime);
|
|
@@ -23290,12 +23496,7 @@ var PaymentMethodDetails = ({
|
|
|
23290
23496
|
const [stripe, setStripe] = useState15(null);
|
|
23291
23497
|
const [setupIntent, setSetupIntent] = useState15();
|
|
23292
23498
|
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState15(false);
|
|
23293
|
-
const [paymentMethod, setPaymentMethod] = useState15(
|
|
23294
|
-
useEffect6(() => {
|
|
23295
|
-
setPaymentMethod(
|
|
23296
|
-
data.subscription?.paymentMethod || data.company?.defaultPaymentMethod
|
|
23297
|
-
);
|
|
23298
|
-
}, [data.company?.defaultPaymentMethod, data.subscription?.paymentMethod]);
|
|
23499
|
+
const [paymentMethod, setPaymentMethod] = useState15(data.subscription?.paymentMethod || data.company?.defaultPaymentMethod);
|
|
23299
23500
|
const monthsToExpiration = useMemo13(() => {
|
|
23300
23501
|
let expiration;
|
|
23301
23502
|
if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
|
|
@@ -23309,33 +23510,25 @@ var PaymentMethodDetails = ({
|
|
|
23309
23510
|
}
|
|
23310
23511
|
return expiration;
|
|
23311
23512
|
}, [paymentMethod?.cardExpYear, paymentMethod?.cardExpMonth]);
|
|
23312
|
-
useEffect6(() => {
|
|
23313
|
-
if (!stripe && setupIntent?.publishableKey) {
|
|
23314
|
-
setStripe(loadStripe(setupIntent.publishableKey));
|
|
23315
|
-
}
|
|
23316
|
-
}, [stripe, setupIntent?.publishableKey]);
|
|
23317
23513
|
const createSetupIntent = useCallback10(async () => {
|
|
23318
23514
|
if (!api || !data.component?.id) {
|
|
23319
23515
|
return;
|
|
23320
23516
|
}
|
|
23321
23517
|
try {
|
|
23322
23518
|
setIsLoading(true);
|
|
23323
|
-
const
|
|
23519
|
+
const response = await api.getSetupIntent({
|
|
23324
23520
|
componentId: data.component.id
|
|
23325
23521
|
});
|
|
23326
|
-
setSetupIntent(
|
|
23327
|
-
setShowPaymentForm(true);
|
|
23522
|
+
setSetupIntent(response.data);
|
|
23328
23523
|
} catch {
|
|
23329
23524
|
setError(
|
|
23330
23525
|
t2("Error initializing payment method change. Please try again.")
|
|
23331
23526
|
);
|
|
23332
23527
|
} finally {
|
|
23528
|
+
setShowPaymentForm(true);
|
|
23333
23529
|
setIsLoading(false);
|
|
23334
23530
|
}
|
|
23335
23531
|
}, [t2, api, data.component?.id]);
|
|
23336
|
-
const dropDownDifferentPaymentMethods = useCallback10(() => {
|
|
23337
|
-
setShowDifferentPaymentMethods((state) => !state);
|
|
23338
|
-
}, []);
|
|
23339
23532
|
const updatePaymentMethod = useCallback10(
|
|
23340
23533
|
async (externalId) => {
|
|
23341
23534
|
if (!api || !externalId) {
|
|
@@ -23412,33 +23605,43 @@ var PaymentMethodDetails = ({
|
|
|
23412
23605
|
},
|
|
23413
23606
|
[api, data, setData, t2]
|
|
23414
23607
|
);
|
|
23608
|
+
useEffect6(() => {
|
|
23609
|
+
if (!stripe && setupIntent?.publishableKey) {
|
|
23610
|
+
setStripe(loadStripe(setupIntent.publishableKey));
|
|
23611
|
+
}
|
|
23612
|
+
}, [stripe, setupIntent?.publishableKey]);
|
|
23613
|
+
useEffect6(() => {
|
|
23614
|
+
if (!setupIntent && (!paymentMethod || showPaymentForm)) {
|
|
23615
|
+
createSetupIntent();
|
|
23616
|
+
}
|
|
23617
|
+
}, [setupIntent, paymentMethod, showPaymentForm, createSetupIntent]);
|
|
23415
23618
|
return /* @__PURE__ */ jsxs26(Flex, { $position: "relative", children: [
|
|
23416
|
-
|
|
23619
|
+
/* @__PURE__ */ jsx34(
|
|
23417
23620
|
Flex,
|
|
23418
23621
|
{
|
|
23419
23622
|
$position: "absolute",
|
|
23420
|
-
$
|
|
23421
|
-
$height: "100%",
|
|
23623
|
+
$zIndex: isLoading ? 1 : 0,
|
|
23422
23624
|
$justifyContent: "center",
|
|
23423
23625
|
$alignItems: "center",
|
|
23424
|
-
$
|
|
23425
|
-
$
|
|
23426
|
-
$
|
|
23427
|
-
$opacity: 0.5,
|
|
23428
|
-
children: /* @__PURE__ */ jsx34(Loader, { $color: theme.primary, $size: "2xl" })
|
|
23626
|
+
$width: "100%",
|
|
23627
|
+
$height: "100%",
|
|
23628
|
+
children: /* @__PURE__ */ jsx34(Loader, { $color: theme.primary, $size: "2xl", $isLoading: isLoading })
|
|
23429
23629
|
}
|
|
23430
23630
|
),
|
|
23431
23631
|
/* @__PURE__ */ jsxs26(
|
|
23432
23632
|
Flex,
|
|
23433
23633
|
{
|
|
23634
|
+
$position: "relative",
|
|
23635
|
+
$zIndex: isLoading ? 0 : 1,
|
|
23434
23636
|
$flexDirection: "column",
|
|
23435
|
-
$flexGrow:
|
|
23637
|
+
$flexGrow: 1,
|
|
23436
23638
|
$gap: "1rem",
|
|
23639
|
+
$overflow: "auto",
|
|
23437
23640
|
$padding: "2rem 2.5rem 2rem 2.5rem",
|
|
23641
|
+
$visibility: isLoading ? "hidden" : "visible",
|
|
23438
23642
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
|
|
23439
|
-
$overflow: "auto",
|
|
23440
23643
|
children: [
|
|
23441
|
-
showPaymentForm ? /* @__PURE__ */
|
|
23644
|
+
setupIntent && showPaymentForm ? /* @__PURE__ */ jsxs26(
|
|
23442
23645
|
Elements,
|
|
23443
23646
|
{
|
|
23444
23647
|
stripe,
|
|
@@ -23467,16 +23670,32 @@ var PaymentMethodDetails = ({
|
|
|
23467
23670
|
},
|
|
23468
23671
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
23469
23672
|
},
|
|
23470
|
-
children:
|
|
23471
|
-
|
|
23472
|
-
|
|
23473
|
-
|
|
23474
|
-
|
|
23475
|
-
|
|
23476
|
-
|
|
23673
|
+
children: [
|
|
23674
|
+
/* @__PURE__ */ jsx34(
|
|
23675
|
+
PaymentForm,
|
|
23676
|
+
{
|
|
23677
|
+
onConfirm: async (paymentMethodId) => {
|
|
23678
|
+
await updatePaymentMethod(paymentMethodId);
|
|
23679
|
+
setShowPaymentForm(false);
|
|
23680
|
+
setShowDifferentPaymentMethods(false);
|
|
23681
|
+
}
|
|
23477
23682
|
}
|
|
23478
|
-
|
|
23479
|
-
|
|
23683
|
+
),
|
|
23684
|
+
paymentMethod && /* @__PURE__ */ jsx34(Box, { children: /* @__PURE__ */ jsx34(
|
|
23685
|
+
Text,
|
|
23686
|
+
{
|
|
23687
|
+
onClick: () => {
|
|
23688
|
+
setShowPaymentForm(false);
|
|
23689
|
+
setShowDifferentPaymentMethods(false);
|
|
23690
|
+
},
|
|
23691
|
+
$font: theme.typography.link.fontFamily,
|
|
23692
|
+
$size: theme.typography.link.fontSize,
|
|
23693
|
+
$weight: theme.typography.link.fontWeight,
|
|
23694
|
+
$color: theme.typography.link.color,
|
|
23695
|
+
children: t2("Select existing payment method")
|
|
23696
|
+
}
|
|
23697
|
+
) })
|
|
23698
|
+
]
|
|
23480
23699
|
}
|
|
23481
23700
|
) : /* @__PURE__ */ jsxs26(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
23482
23701
|
/* @__PURE__ */ jsx34(
|
|
@@ -23491,7 +23710,9 @@ var PaymentMethodDetails = ({
|
|
|
23491
23710
|
(data.company?.paymentMethods || []).length > 0 && /* @__PURE__ */ jsx34(Box, { children: /* @__PURE__ */ jsxs26(
|
|
23492
23711
|
Text,
|
|
23493
23712
|
{
|
|
23494
|
-
onClick:
|
|
23713
|
+
onClick: () => {
|
|
23714
|
+
setShowDifferentPaymentMethods((prev2) => !prev2);
|
|
23715
|
+
},
|
|
23495
23716
|
$font: theme.typography.link.fontFamily,
|
|
23496
23717
|
$size: theme.typography.link.fontSize,
|
|
23497
23718
|
$weight: theme.typography.link.fontWeight,
|
|
@@ -23514,18 +23735,20 @@ var PaymentMethodDetails = ({
|
|
|
23514
23735
|
]
|
|
23515
23736
|
}
|
|
23516
23737
|
) }),
|
|
23517
|
-
showDifferentPaymentMethods && /* @__PURE__ */
|
|
23518
|
-
(
|
|
23519
|
-
|
|
23520
|
-
|
|
23521
|
-
|
|
23522
|
-
|
|
23523
|
-
|
|
23524
|
-
|
|
23525
|
-
|
|
23526
|
-
|
|
23527
|
-
|
|
23528
|
-
|
|
23738
|
+
showDifferentPaymentMethods && /* @__PURE__ */ jsxs26(Flex, { $flexDirection: "column", $overflowY: "hidden", children: [
|
|
23739
|
+
/* @__PURE__ */ jsx34(Flex, { $flexDirection: "column", $overflowY: "scroll", children: (data.company?.paymentMethods.filter(
|
|
23740
|
+
(pm) => pm.id !== paymentMethod?.id
|
|
23741
|
+
) || []).map((paymentMethod2) => /* @__PURE__ */ jsx34(
|
|
23742
|
+
PaymentListElement,
|
|
23743
|
+
{
|
|
23744
|
+
paymentMethod: paymentMethod2,
|
|
23745
|
+
setDefault: updatePaymentMethod,
|
|
23746
|
+
handleDelete: deletePaymentMethod
|
|
23747
|
+
},
|
|
23748
|
+
paymentMethod2.id
|
|
23749
|
+
)) }),
|
|
23750
|
+
(!setupIntent || !paymentMethod || showDifferentPaymentMethods) && /* @__PURE__ */ jsx34(Button, { onClick: createSetupIntent, $size: "lg", children: t2("Add new payment method") })
|
|
23751
|
+
] })
|
|
23529
23752
|
] }),
|
|
23530
23753
|
!isLoading && error && /* @__PURE__ */ jsx34(Box, { children: /* @__PURE__ */ jsx34(
|
|
23531
23754
|
Text,
|
|
@@ -23545,7 +23768,7 @@ var PaymentMethodDetails = ({
|
|
|
23545
23768
|
|
|
23546
23769
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
23547
23770
|
import { forwardRef as forwardRef11, useMemo as useMemo14 } from "react";
|
|
23548
|
-
import { Fragment as
|
|
23771
|
+
import { Fragment as Fragment14, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
23549
23772
|
var resolveDesignProps7 = (props) => {
|
|
23550
23773
|
return {
|
|
23551
23774
|
header: {
|
|
@@ -23613,7 +23836,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
23613
23836
|
const willSubscriptionCancel = billingSubscription?.cancelAtPeriodEnd;
|
|
23614
23837
|
const isUsageBasedPlan = currentPlan?.planPrice === 0 && usageBasedEntitlements.length > 0;
|
|
23615
23838
|
const headerPriceFontStyle = isUsageBasedPlan ? "heading3" : props.header.price.fontStyle;
|
|
23616
|
-
return /* @__PURE__ */ jsxs27(
|
|
23839
|
+
return /* @__PURE__ */ jsxs27(Fragment14, { children: [
|
|
23617
23840
|
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs27(
|
|
23618
23841
|
Notice,
|
|
23619
23842
|
{
|
|
@@ -23729,10 +23952,12 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
23729
23952
|
const limit = entitlement.softLimit ?? entitlement.allocation ?? 0;
|
|
23730
23953
|
let overageAmount = entitlement.priceBehavior === "overage" && (entitlement?.usage ?? 0) - (entitlement?.softLimit ?? 0);
|
|
23731
23954
|
const amount = overageAmount || entitlement.allocation || 0;
|
|
23955
|
+
let packageSize = 1;
|
|
23732
23956
|
if (entitlement.priceBehavior === "overage" && data.subscription) {
|
|
23733
23957
|
const subscription = data.subscription;
|
|
23734
23958
|
const entitlementPrice = entitlement.monthlyUsageBasedPrice ?? entitlement.yearlyUsageBasedPrice;
|
|
23735
23959
|
if (entitlementPrice) {
|
|
23960
|
+
packageSize = entitlementPrice.packageSize;
|
|
23736
23961
|
const entitlementProduct = subscription.products.find(
|
|
23737
23962
|
(product) => product.id === entitlementPrice.productId
|
|
23738
23963
|
);
|
|
@@ -23756,12 +23981,12 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
23756
23981
|
$gap: "1rem",
|
|
23757
23982
|
children: [
|
|
23758
23983
|
/* @__PURE__ */ jsxs27(Text, { display: props.addOns.fontStyle, children: [
|
|
23759
|
-
entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && limit > 0 ? /* @__PURE__ */ jsxs27(
|
|
23984
|
+
entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && limit > 0 ? /* @__PURE__ */ jsxs27(Fragment14, { children: [
|
|
23760
23985
|
limit,
|
|
23761
23986
|
" ",
|
|
23762
23987
|
getFeatureName(entitlement.feature, limit)
|
|
23763
23988
|
] }) : entitlement.feature.name,
|
|
23764
|
-
entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && currentPlan?.planPeriod && /* @__PURE__ */ jsxs27(
|
|
23989
|
+
entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && currentPlan?.planPeriod && /* @__PURE__ */ jsxs27(Fragment14, { children: [
|
|
23765
23990
|
"/",
|
|
23766
23991
|
shortenPeriod(currentPlan.planPeriod)
|
|
23767
23992
|
] })
|
|
@@ -23774,7 +23999,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
23774
23999
|
$color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
|
|
23775
24000
|
children: typeof overageAmount === "number" && overageAmount > 0 ? t2("X additional", {
|
|
23776
24001
|
amount: overageAmount
|
|
23777
|
-
}) : /* @__PURE__ */ jsxs27(
|
|
24002
|
+
}) : /* @__PURE__ */ jsxs27(Fragment14, { children: [
|
|
23778
24003
|
t2("Additional"),
|
|
23779
24004
|
":",
|
|
23780
24005
|
" ",
|
|
@@ -23784,8 +24009,15 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
23784
24009
|
),
|
|
23785
24010
|
/* @__PURE__ */ jsxs27("sub", { children: [
|
|
23786
24011
|
"/",
|
|
23787
|
-
|
|
23788
|
-
|
|
24012
|
+
packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment14, { children: [
|
|
24013
|
+
packageSize,
|
|
24014
|
+
" "
|
|
24015
|
+
] }),
|
|
24016
|
+
getFeatureName(
|
|
24017
|
+
entitlement.feature,
|
|
24018
|
+
packageSize
|
|
24019
|
+
),
|
|
24020
|
+
entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs27(Fragment14, { children: [
|
|
23789
24021
|
"/",
|
|
23790
24022
|
shortenPeriod(currentPlan.planPeriod)
|
|
23791
24023
|
] })
|
|
@@ -23804,7 +24036,14 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
23804
24036
|
),
|
|
23805
24037
|
/* @__PURE__ */ jsxs27("sub", { children: [
|
|
23806
24038
|
"/",
|
|
23807
|
-
|
|
24039
|
+
packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment14, { children: [
|
|
24040
|
+
packageSize,
|
|
24041
|
+
" "
|
|
24042
|
+
] }),
|
|
24043
|
+
getFeatureName(
|
|
24044
|
+
entitlement.feature,
|
|
24045
|
+
packageSize
|
|
24046
|
+
),
|
|
23808
24047
|
"/",
|
|
23809
24048
|
shortenPeriod(currentPlan.planPeriod)
|
|
23810
24049
|
] })
|
|
@@ -23818,7 +24057,16 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
23818
24057
|
),
|
|
23819
24058
|
(entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ jsxs27("sub", { children: [
|
|
23820
24059
|
"/",
|
|
23821
|
-
currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) :
|
|
24060
|
+
currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : /* @__PURE__ */ jsxs27(Fragment14, { children: [
|
|
24061
|
+
packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment14, { children: [
|
|
24062
|
+
packageSize,
|
|
24063
|
+
" "
|
|
24064
|
+
] }),
|
|
24065
|
+
getFeatureName(
|
|
24066
|
+
entitlement.feature,
|
|
24067
|
+
packageSize
|
|
24068
|
+
)
|
|
24069
|
+
] })
|
|
23822
24070
|
] })
|
|
23823
24071
|
] })
|
|
23824
24072
|
] })
|
|
@@ -23859,7 +24107,7 @@ PlanManager.displayName = "PlanManager";
|
|
|
23859
24107
|
|
|
23860
24108
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
23861
24109
|
import { forwardRef as forwardRef12, useState as useState16 } from "react";
|
|
23862
|
-
import { Fragment as
|
|
24110
|
+
import { Fragment as Fragment15, jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
23863
24111
|
var resolveDesignProps8 = (props) => {
|
|
23864
24112
|
return {
|
|
23865
24113
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -24141,6 +24389,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24141
24389
|
if (entitlement.priceBehavior && typeof entitlementPrice !== "number") {
|
|
24142
24390
|
return acc;
|
|
24143
24391
|
}
|
|
24392
|
+
const entitlementPackageSize = entitlementPriceObject?.packageSize ?? 1;
|
|
24144
24393
|
acc.push(
|
|
24145
24394
|
/* @__PURE__ */ jsxs28(Flex, { $gap: "1rem", children: [
|
|
24146
24395
|
props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx36(
|
|
@@ -24169,7 +24418,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24169
24418
|
$weight: theme.typography.text.fontWeight,
|
|
24170
24419
|
$color: theme.typography.text.color,
|
|
24171
24420
|
$leading: 1.35,
|
|
24172
|
-
children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ jsxs28(
|
|
24421
|
+
children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24173
24422
|
formatCurrency(
|
|
24174
24423
|
entitlementPrice,
|
|
24175
24424
|
entitlementCurrency
|
|
@@ -24177,22 +24426,26 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24177
24426
|
" ",
|
|
24178
24427
|
t2("per"),
|
|
24179
24428
|
" ",
|
|
24429
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24430
|
+
entitlementPackageSize,
|
|
24431
|
+
" "
|
|
24432
|
+
] }),
|
|
24180
24433
|
getFeatureName(
|
|
24181
24434
|
entitlement.feature,
|
|
24182
|
-
|
|
24435
|
+
entitlementPackageSize
|
|
24183
24436
|
),
|
|
24184
|
-
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs28(
|
|
24437
|
+
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24185
24438
|
" ",
|
|
24186
24439
|
t2("per"),
|
|
24187
24440
|
" ",
|
|
24188
24441
|
selectedPeriod
|
|
24189
24442
|
] })
|
|
24190
|
-
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(
|
|
24443
|
+
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24191
24444
|
entitlement.valueType === "unlimited" && !entitlement.priceBehavior ? t2("Unlimited", {
|
|
24192
24445
|
item: getFeatureName(
|
|
24193
24446
|
entitlement.feature
|
|
24194
24447
|
)
|
|
24195
|
-
}) : typeof limit === "number" && /* @__PURE__ */ jsxs28(
|
|
24448
|
+
}) : typeof limit === "number" && /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24196
24449
|
formatNumber(limit),
|
|
24197
24450
|
" ",
|
|
24198
24451
|
getFeatureName(
|
|
@@ -24200,7 +24453,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24200
24453
|
limit
|
|
24201
24454
|
)
|
|
24202
24455
|
] }),
|
|
24203
|
-
entitlement.metricPeriod && entitlement.priceBehavior !== "overage" ? /* @__PURE__ */ jsxs28(
|
|
24456
|
+
entitlement.metricPeriod && entitlement.priceBehavior !== "overage" ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24204
24457
|
" ",
|
|
24205
24458
|
t2("per"),
|
|
24206
24459
|
" ",
|
|
@@ -24210,7 +24463,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24210
24463
|
current_month: "month",
|
|
24211
24464
|
current_year: "year"
|
|
24212
24465
|
}[entitlement.metricPeriod]
|
|
24213
|
-
] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ jsxs28(
|
|
24466
|
+
] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24214
24467
|
"/",
|
|
24215
24468
|
shortenPeriod(
|
|
24216
24469
|
selectedPeriod
|
|
@@ -24241,11 +24494,15 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24241
24494
|
entitlementCurrency
|
|
24242
24495
|
),
|
|
24243
24496
|
"/",
|
|
24497
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24498
|
+
entitlementPackageSize,
|
|
24499
|
+
" "
|
|
24500
|
+
] }),
|
|
24244
24501
|
getFeatureName(
|
|
24245
24502
|
entitlement.feature,
|
|
24246
|
-
|
|
24503
|
+
entitlementPackageSize
|
|
24247
24504
|
),
|
|
24248
|
-
entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs28(
|
|
24505
|
+
entitlement.feature.featureType === "trait" && /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24249
24506
|
"/",
|
|
24250
24507
|
shortenPeriod(selectedPeriod)
|
|
24251
24508
|
] }),
|
|
@@ -24384,7 +24641,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24384
24641
|
}
|
|
24385
24642
|
)
|
|
24386
24643
|
] }),
|
|
24387
|
-
/* @__PURE__ */ jsx36(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs28(
|
|
24644
|
+
/* @__PURE__ */ jsx36(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24388
24645
|
props.header.isVisible && /* @__PURE__ */ jsx36(
|
|
24389
24646
|
Flex,
|
|
24390
24647
|
{
|
|
@@ -24539,12 +24796,12 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24539
24796
|
$size: theme.typography.text.fontSize,
|
|
24540
24797
|
$weight: theme.typography.text.fontWeight,
|
|
24541
24798
|
$color: theme.typography.text.color,
|
|
24542
|
-
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(
|
|
24799
|
+
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24543
24800
|
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
24544
24801
|
item: getFeatureName(
|
|
24545
24802
|
entitlement.feature
|
|
24546
24803
|
)
|
|
24547
|
-
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ jsxs28(
|
|
24804
|
+
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24548
24805
|
formatNumber(
|
|
24549
24806
|
entitlement.valueNumeric
|
|
24550
24807
|
),
|
|
@@ -24554,7 +24811,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24554
24811
|
entitlement.valueNumeric
|
|
24555
24812
|
)
|
|
24556
24813
|
] }),
|
|
24557
|
-
entitlement.metricPeriod && /* @__PURE__ */ jsxs28(
|
|
24814
|
+
entitlement.metricPeriod && /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
24558
24815
|
" ",
|
|
24559
24816
|
t2("per"),
|
|
24560
24817
|
" ",
|
|
@@ -24910,7 +25167,7 @@ function createRenderer(options2) {
|
|
|
24910
25167
|
}
|
|
24911
25168
|
|
|
24912
25169
|
// src/components/embed/ComponentTree.tsx
|
|
24913
|
-
import { Fragment as
|
|
25170
|
+
import { Fragment as Fragment16, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
24914
25171
|
var Loading = () => {
|
|
24915
25172
|
const theme = nt();
|
|
24916
25173
|
return /* @__PURE__ */ jsx40(
|
|
@@ -24978,7 +25235,7 @@ var ComponentTree = () => {
|
|
|
24978
25235
|
if (isPending) {
|
|
24979
25236
|
return /* @__PURE__ */ jsx40(Loading, {});
|
|
24980
25237
|
}
|
|
24981
|
-
return /* @__PURE__ */ jsx40(
|
|
25238
|
+
return /* @__PURE__ */ jsx40(Fragment16, { children });
|
|
24982
25239
|
};
|
|
24983
25240
|
|
|
24984
25241
|
// src/components/embed/Embed.tsx
|