@schematichq/schematic-components 0.4.11 → 0.5.0
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 +500 -221
- package/dist/schematic-components.d.ts +100 -7
- package/dist/schematic-components.esm.js +500 -221
- package/package.json +7 -7
|
@@ -10590,6 +10590,7 @@ function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator
|
|
|
10590
10590
|
),
|
|
10591
10591
|
productId: json["product_id"],
|
|
10592
10592
|
quantity: json["quantity"],
|
|
10593
|
+
subscriptionCount: json["subscription_count"],
|
|
10593
10594
|
updatedAt: new Date(json["updated_at"])
|
|
10594
10595
|
};
|
|
10595
10596
|
}
|
|
@@ -10662,6 +10663,7 @@ function BillingSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
10662
10663
|
createdAt: new Date(json["created_at"]),
|
|
10663
10664
|
currency: json["currency"],
|
|
10664
10665
|
customerExternalId: json["customer_external_id"],
|
|
10666
|
+
defaultPaymentMethodId: json["default_payment_method_id"] == null ? void 0 : json["default_payment_method_id"],
|
|
10665
10667
|
expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
|
|
10666
10668
|
id: json["id"],
|
|
10667
10669
|
interval: json["interval"],
|
|
@@ -10730,7 +10732,6 @@ function PaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10730
10732
|
externalId: json["external_id"],
|
|
10731
10733
|
id: json["id"],
|
|
10732
10734
|
paymentMethodType: json["payment_method_type"],
|
|
10733
|
-
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
|
10734
10735
|
updatedAt: new Date(json["updated_at"])
|
|
10735
10736
|
};
|
|
10736
10737
|
}
|
|
@@ -10750,6 +10751,7 @@ function BillingSubscriptionViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10750
10751
|
createdAt: new Date(json["created_at"]),
|
|
10751
10752
|
currency: json["currency"],
|
|
10752
10753
|
customerExternalId: json["customer_external_id"],
|
|
10754
|
+
defaultPaymentMethodId: json["default_payment_method_id"] == null ? void 0 : json["default_payment_method_id"],
|
|
10753
10755
|
discounts: json["discounts"].map(
|
|
10754
10756
|
BillingSubscriptionDiscountViewFromJSON
|
|
10755
10757
|
),
|
|
@@ -11019,6 +11021,9 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11019
11021
|
CompanyEventPeriodMetricsResponseDataFromJSON
|
|
11020
11022
|
),
|
|
11021
11023
|
name: json["name"],
|
|
11024
|
+
paymentMethods: json["payment_methods"].map(
|
|
11025
|
+
PaymentMethodResponseDataFromJSON
|
|
11026
|
+
),
|
|
11022
11027
|
plan: json["plan"] == null ? void 0 : CompanyPlanWithBillingSubViewFromJSON(json["plan"]),
|
|
11023
11028
|
plans: json["plans"].map(GenericPreviewObjectFromJSON),
|
|
11024
11029
|
traits: json["traits"] == null ? void 0 : json["traits"],
|
|
@@ -11181,6 +11186,8 @@ function FeatureResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11181
11186
|
lifecyclePhase: json["lifecycle_phase"] == null ? void 0 : json["lifecycle_phase"],
|
|
11182
11187
|
maintainerId: json["maintainer_id"] == null ? void 0 : json["maintainer_id"],
|
|
11183
11188
|
name: json["name"],
|
|
11189
|
+
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
11190
|
+
singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
|
|
11184
11191
|
traitId: json["trait_id"] == null ? void 0 : json["trait_id"],
|
|
11185
11192
|
updatedAt: new Date(json["updated_at"])
|
|
11186
11193
|
};
|
|
@@ -11232,6 +11239,8 @@ function FeatureDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11232
11239
|
maintainerId: json["maintainer_id"] == null ? void 0 : json["maintainer_id"],
|
|
11233
11240
|
name: json["name"],
|
|
11234
11241
|
plans: json["plans"].map(PreviewObjectFromJSON),
|
|
11242
|
+
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
11243
|
+
singularName: json["singular_name"] == null ? void 0 : json["singular_name"],
|
|
11235
11244
|
trait: json["trait"] == null ? void 0 : EntityTraitDefinitionResponseDataFromJSON(json["trait"]),
|
|
11236
11245
|
traitId: json["trait_id"] == null ? void 0 : json["trait_id"],
|
|
11237
11246
|
updatedAt: new Date(json["updated_at"])
|
|
@@ -11281,6 +11290,7 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11281
11290
|
priceBehavior: json["price_behavior"] == null ? void 0 : json["price_behavior"],
|
|
11282
11291
|
ruleId: json["rule_id"],
|
|
11283
11292
|
ruleIdUsageExceeded: json["rule_id_usage_exceeded"] == null ? void 0 : json["rule_id_usage_exceeded"],
|
|
11293
|
+
softLimit: json["soft_limit"] == null ? void 0 : json["soft_limit"],
|
|
11284
11294
|
updatedAt: new Date(json["updated_at"]),
|
|
11285
11295
|
valueBool: json["value_bool"] == null ? void 0 : json["value_bool"],
|
|
11286
11296
|
valueNumeric: json["value_numeric"] == null ? void 0 : json["value_numeric"],
|
|
@@ -11384,6 +11394,7 @@ function ComponentCapabilitiesFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11384
11394
|
return json;
|
|
11385
11395
|
}
|
|
11386
11396
|
return {
|
|
11397
|
+
badgeVisibility: json["badge_visibility"],
|
|
11387
11398
|
checkout: json["checkout"]
|
|
11388
11399
|
};
|
|
11389
11400
|
}
|
|
@@ -11482,6 +11493,7 @@ function FeatureUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11482
11493
|
period: json["period"] == null ? void 0 : json["period"],
|
|
11483
11494
|
plan: json["plan"] == null ? void 0 : PlanResponseDataFromJSON(json["plan"]),
|
|
11484
11495
|
priceBehavior: json["price_behavior"] == null ? void 0 : json["price_behavior"],
|
|
11496
|
+
softLimit: json["soft_limit"] == null ? void 0 : json["soft_limit"],
|
|
11485
11497
|
usage: json["usage"] == null ? void 0 : json["usage"],
|
|
11486
11498
|
yearlyUsageBasedPrice: json["yearly_usage_based_price"] == null ? void 0 : BillingPriceViewFromJSON(json["yearly_usage_based_price"])
|
|
11487
11499
|
};
|
|
@@ -11544,6 +11556,20 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11544
11556
|
};
|
|
11545
11557
|
}
|
|
11546
11558
|
|
|
11559
|
+
// src/api/models/DeletePaymentMethodResponse.ts
|
|
11560
|
+
function DeletePaymentMethodResponseFromJSON(json) {
|
|
11561
|
+
return DeletePaymentMethodResponseFromJSONTyped(json, false);
|
|
11562
|
+
}
|
|
11563
|
+
function DeletePaymentMethodResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
11564
|
+
if (json == null) {
|
|
11565
|
+
return json;
|
|
11566
|
+
}
|
|
11567
|
+
return {
|
|
11568
|
+
data: DeleteResponseFromJSON(json["data"]),
|
|
11569
|
+
params: json["params"]
|
|
11570
|
+
};
|
|
11571
|
+
}
|
|
11572
|
+
|
|
11547
11573
|
// src/api/models/SetupIntentResponseData.ts
|
|
11548
11574
|
function SetupIntentResponseDataFromJSON(json) {
|
|
11549
11575
|
return SetupIntentResponseDataFromJSONTyped(json, false);
|
|
@@ -11748,6 +11774,50 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
11748
11774
|
const response = await this.checkoutUnsubscribeRaw(initOverrides);
|
|
11749
11775
|
return await response.value();
|
|
11750
11776
|
}
|
|
11777
|
+
/**
|
|
11778
|
+
* Delete payment method
|
|
11779
|
+
*/
|
|
11780
|
+
async deletePaymentMethodRaw(requestParameters, initOverrides) {
|
|
11781
|
+
if (requestParameters["checkoutId"] == null) {
|
|
11782
|
+
throw new RequiredError(
|
|
11783
|
+
"checkoutId",
|
|
11784
|
+
'Required parameter "checkoutId" was null or undefined when calling deletePaymentMethod().'
|
|
11785
|
+
);
|
|
11786
|
+
}
|
|
11787
|
+
const queryParameters = {};
|
|
11788
|
+
const headerParameters = {};
|
|
11789
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
11790
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
11791
|
+
"X-Schematic-Api-Key"
|
|
11792
|
+
);
|
|
11793
|
+
}
|
|
11794
|
+
const response = await this.request(
|
|
11795
|
+
{
|
|
11796
|
+
path: `/checkout/paymentmethod/{checkout_id}`.replace(
|
|
11797
|
+
`{${"checkout_id"}}`,
|
|
11798
|
+
encodeURIComponent(String(requestParameters["checkoutId"]))
|
|
11799
|
+
),
|
|
11800
|
+
method: "DELETE",
|
|
11801
|
+
headers: headerParameters,
|
|
11802
|
+
query: queryParameters
|
|
11803
|
+
},
|
|
11804
|
+
initOverrides
|
|
11805
|
+
);
|
|
11806
|
+
return new JSONApiResponse(
|
|
11807
|
+
response,
|
|
11808
|
+
(jsonValue) => DeletePaymentMethodResponseFromJSON(jsonValue)
|
|
11809
|
+
);
|
|
11810
|
+
}
|
|
11811
|
+
/**
|
|
11812
|
+
* Delete payment method
|
|
11813
|
+
*/
|
|
11814
|
+
async deletePaymentMethod(requestParameters, initOverrides) {
|
|
11815
|
+
const response = await this.deletePaymentMethodRaw(
|
|
11816
|
+
requestParameters,
|
|
11817
|
+
initOverrides
|
|
11818
|
+
);
|
|
11819
|
+
return await response.value();
|
|
11820
|
+
}
|
|
11751
11821
|
/**
|
|
11752
11822
|
* Get setup intent
|
|
11753
11823
|
*/
|
|
@@ -12025,6 +12095,8 @@ var en_default = {
|
|
|
12025
12095
|
"Not ready to cancel?": "Not ready to cancel?",
|
|
12026
12096
|
"Optionally add features to your subscription": "Optionally add features to your subscription",
|
|
12027
12097
|
"Other existing payment method": "Other existing payment method",
|
|
12098
|
+
Overage: "Overage",
|
|
12099
|
+
"Overage fee": "Overage fee",
|
|
12028
12100
|
"Over usage limit": "Over usage limit",
|
|
12029
12101
|
"Pay now": "Pay now",
|
|
12030
12102
|
"Payment Method": "Payment Method",
|
|
@@ -12062,12 +12134,14 @@ var en_default = {
|
|
|
12062
12134
|
"Use existing payment method": "Use existing payment method",
|
|
12063
12135
|
"X% off": "{{percent}}% off",
|
|
12064
12136
|
"X off": "{{amount}} off",
|
|
12137
|
+
"X over the limit": "{{amount}} over the limit",
|
|
12065
12138
|
Yearly: "Yearly",
|
|
12066
12139
|
"You will retain access to your plan until the end of the billing period, on": "You will retain access to your plan until the end of the billing period, on",
|
|
12067
12140
|
day: "day",
|
|
12068
12141
|
month: "month",
|
|
12069
12142
|
per: "per",
|
|
12070
12143
|
year: "year",
|
|
12144
|
+
"overage fee": "overage fee",
|
|
12071
12145
|
used: "used",
|
|
12072
12146
|
usage: {
|
|
12073
12147
|
limited: "{{amount}} of {{allocation}} used",
|
|
@@ -12824,7 +12898,7 @@ var EmbedProvider = ({
|
|
|
12824
12898
|
(0, import_react11.useEffect)(() => {
|
|
12825
12899
|
if (accessToken) {
|
|
12826
12900
|
const { headers = {} } = apiConfig ?? {};
|
|
12827
|
-
headers["X-Schematic-Components-Version"] = "0.
|
|
12901
|
+
headers["X-Schematic-Components-Version"] = "0.5.0";
|
|
12828
12902
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
12829
12903
|
const config = new Configuration({
|
|
12830
12904
|
...apiConfig,
|
|
@@ -13983,6 +14057,7 @@ var ProgressBar = ({
|
|
|
13983
14057
|
value,
|
|
13984
14058
|
total = 0,
|
|
13985
14059
|
color = "gray",
|
|
14060
|
+
bgColor = "#F2F4F7",
|
|
13986
14061
|
barWidth = "100%",
|
|
13987
14062
|
...props
|
|
13988
14063
|
}) => {
|
|
@@ -14014,7 +14089,7 @@ var ProgressBar = ({
|
|
|
14014
14089
|
$overflow: "hidden",
|
|
14015
14090
|
$width: "100%",
|
|
14016
14091
|
$height: `${8 / TEXT_BASE_SIZE}rem`,
|
|
14017
|
-
$backgroundColor:
|
|
14092
|
+
$backgroundColor: bgColor,
|
|
14018
14093
|
$borderRadius: "9999px",
|
|
14019
14094
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
14020
14095
|
Box,
|
|
@@ -15906,7 +15981,7 @@ var Plan = ({
|
|
|
15906
15981
|
plan.entitlements.reduce((acc, entitlement) => {
|
|
15907
15982
|
const hasNumericValue = entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait";
|
|
15908
15983
|
let metricPeriodText;
|
|
15909
|
-
if (hasNumericValue && entitlement.metricPeriod) {
|
|
15984
|
+
if (hasNumericValue && entitlement.metricPeriod && entitlement.priceBehavior !== "overage") {
|
|
15910
15985
|
metricPeriodText = {
|
|
15911
15986
|
billing: t2("billing period"),
|
|
15912
15987
|
current_day: t2("day"),
|
|
@@ -15914,6 +15989,7 @@ var Plan = ({
|
|
|
15914
15989
|
current_year: t2("year")
|
|
15915
15990
|
}[entitlement.metricPeriod];
|
|
15916
15991
|
}
|
|
15992
|
+
const limit = entitlement.softLimit || entitlement.valueNumeric;
|
|
15917
15993
|
const price = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price;
|
|
15918
15994
|
const currency = (period === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.currency;
|
|
15919
15995
|
if (entitlement.priceBehavior && typeof price !== "number") {
|
|
@@ -15939,40 +16015,91 @@ var Plan = ({
|
|
|
15939
16015
|
]
|
|
15940
16016
|
}
|
|
15941
16017
|
),
|
|
15942
|
-
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime13.
|
|
15943
|
-
|
|
16018
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
16019
|
+
Flex,
|
|
15944
16020
|
{
|
|
15945
|
-
$
|
|
15946
|
-
$
|
|
15947
|
-
$
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
16021
|
+
$flexDirection: "column",
|
|
16022
|
+
$justifyContent: "center",
|
|
16023
|
+
$gap: "0.5rem",
|
|
16024
|
+
children: [
|
|
16025
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
16026
|
+
Text,
|
|
16027
|
+
{
|
|
16028
|
+
$font: theme.typography.text.fontFamily,
|
|
16029
|
+
$size: theme.typography.text.fontSize,
|
|
16030
|
+
$weight: theme.typography.text.fontWeight,
|
|
16031
|
+
$color: theme.typography.text.color,
|
|
16032
|
+
$leading: 1.35,
|
|
16033
|
+
children: typeof price === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
16034
|
+
formatCurrency(price, currency),
|
|
16035
|
+
" ",
|
|
16036
|
+
t2("per"),
|
|
16037
|
+
" ",
|
|
16038
|
+
(0, import_pluralize2.default)(entitlement.feature.name, 1),
|
|
16039
|
+
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
16040
|
+
" ",
|
|
16041
|
+
t2("per"),
|
|
16042
|
+
" ",
|
|
16043
|
+
period
|
|
16044
|
+
] })
|
|
16045
|
+
] }) : hasNumericValue ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
16046
|
+
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
16047
|
+
item: (0, import_pluralize2.default)(
|
|
16048
|
+
entitlement.feature.name
|
|
16049
|
+
)
|
|
16050
|
+
}) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
16051
|
+
formatNumber(limit),
|
|
16052
|
+
" ",
|
|
16053
|
+
(0, import_pluralize2.default)(
|
|
16054
|
+
entitlement.feature.name,
|
|
16055
|
+
limit
|
|
16056
|
+
)
|
|
16057
|
+
] }),
|
|
16058
|
+
metricPeriodText ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
16059
|
+
" ",
|
|
16060
|
+
t2("per"),
|
|
16061
|
+
" ",
|
|
16062
|
+
metricPeriodText
|
|
16063
|
+
] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
16064
|
+
"/",
|
|
16065
|
+
shortenPeriod(period)
|
|
16066
|
+
] })
|
|
16067
|
+
] }) : entitlement.feature.name
|
|
16068
|
+
}
|
|
16069
|
+
),
|
|
16070
|
+
entitlement.priceBehavior === "overage" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
16071
|
+
Text,
|
|
16072
|
+
{
|
|
16073
|
+
$font: theme.typography.text.fontFamily,
|
|
16074
|
+
$size: 0.875 * theme.typography.text.fontSize,
|
|
16075
|
+
$weight: theme.typography.text.fontWeight,
|
|
16076
|
+
$color: hexToHSL(theme.typography.text.color).l > 50 ? darken(
|
|
16077
|
+
theme.typography.text.color,
|
|
16078
|
+
0.46
|
|
16079
|
+
) : lighten(
|
|
16080
|
+
theme.typography.text.color,
|
|
16081
|
+
0.46
|
|
16082
|
+
),
|
|
16083
|
+
$leading: 1.35,
|
|
16084
|
+
children: [
|
|
16085
|
+
formatCurrency(price),
|
|
16086
|
+
"/",
|
|
16087
|
+
(0, import_pluralize2.default)(
|
|
16088
|
+
entitlement.feature.name.toLowerCase(),
|
|
16089
|
+
1
|
|
16090
|
+
),
|
|
16091
|
+
entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
16092
|
+
"/",
|
|
16093
|
+
shortenPeriod(period)
|
|
16094
|
+
] }),
|
|
16095
|
+
" ",
|
|
16096
|
+
t2("overage fee")
|
|
16097
|
+
]
|
|
16098
|
+
}
|
|
16099
|
+
)
|
|
16100
|
+
]
|
|
15974
16101
|
}
|
|
15975
|
-
)
|
|
16102
|
+
)
|
|
15976
16103
|
] })
|
|
15977
16104
|
},
|
|
15978
16105
|
entitlement.id
|
|
@@ -16396,12 +16523,12 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
16396
16523
|
var import_react23 = require("react");
|
|
16397
16524
|
|
|
16398
16525
|
// node_modules/@stripe/stripe-js/dist/index.mjs
|
|
16399
|
-
var RELEASE_TRAIN = "
|
|
16526
|
+
var RELEASE_TRAIN = "acacia";
|
|
16400
16527
|
var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
|
|
16401
16528
|
return version === 3 ? "v3" : version;
|
|
16402
16529
|
};
|
|
16403
16530
|
var ORIGIN = "https://js.stripe.com";
|
|
16404
|
-
var STRIPE_JS_URL = "".concat(ORIGIN, "/
|
|
16531
|
+
var STRIPE_JS_URL = "".concat(ORIGIN, "/").concat(RELEASE_TRAIN, "/stripe.js");
|
|
16405
16532
|
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
16406
16533
|
var STRIPE_JS_URL_REGEX = /^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;
|
|
16407
16534
|
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";
|
|
@@ -16436,7 +16563,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
16436
16563
|
}
|
|
16437
16564
|
stripe._registerWrapper({
|
|
16438
16565
|
name: "stripe-js",
|
|
16439
|
-
version: "
|
|
16566
|
+
version: "6.0.0",
|
|
16440
16567
|
startTime
|
|
16441
16568
|
});
|
|
16442
16569
|
};
|
|
@@ -16511,7 +16638,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
16511
16638
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
16512
16639
|
var expectedVersion = RELEASE_TRAIN;
|
|
16513
16640
|
if (isTestKey && version !== expectedVersion) {
|
|
16514
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("
|
|
16641
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("6.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
16515
16642
|
}
|
|
16516
16643
|
var stripe = maybeStripe.apply(void 0, args);
|
|
16517
16644
|
registerWrapper(stripe, startTime);
|
|
@@ -17746,9 +17873,9 @@ var RenderLayout = ({ children }) => {
|
|
|
17746
17873
|
|
|
17747
17874
|
// src/components/layout/viewport/styles.ts
|
|
17748
17875
|
var StyledViewport = dt(Box).attrs(({ theme }) => ({
|
|
17749
|
-
$gridTemplateColumns:
|
|
17876
|
+
$gridTemplateColumns: "repeat(1, minmax(300px, 1fr))",
|
|
17750
17877
|
$viewport: {
|
|
17751
|
-
|
|
17878
|
+
md: {
|
|
17752
17879
|
$gridTemplateColumns: `repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`
|
|
17753
17880
|
}
|
|
17754
17881
|
}
|
|
@@ -17900,11 +18027,12 @@ var Details = ({
|
|
|
17900
18027
|
const {
|
|
17901
18028
|
allocation,
|
|
17902
18029
|
feature,
|
|
18030
|
+
priceBehavior,
|
|
17903
18031
|
usage,
|
|
18032
|
+
softLimit,
|
|
17904
18033
|
monthlyUsageBasedPrice,
|
|
17905
18034
|
yearlyUsageBasedPrice
|
|
17906
18035
|
} = featureUsage || {};
|
|
17907
|
-
const { priceBehavior } = usageData || {};
|
|
17908
18036
|
const { t: t2 } = useTranslation();
|
|
17909
18037
|
const theme = nt();
|
|
17910
18038
|
const { data } = useEmbed();
|
|
@@ -17942,13 +18070,16 @@ var Details = ({
|
|
|
17942
18070
|
if (priceBehavior === "pay_as_you_go" && typeof price === "number") {
|
|
17943
18071
|
return `${formatCurrency(price, currency)} ${t2("per")} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}`;
|
|
17944
18072
|
}
|
|
18073
|
+
if (priceBehavior === "overage" && typeof softLimit === "number") {
|
|
18074
|
+
return `${formatNumber(softLimit)} ${(0, import_pluralize4.default)(feature.name, softLimit)}`;
|
|
18075
|
+
}
|
|
17945
18076
|
if (!priceBehavior && typeof allocation === "number") {
|
|
17946
18077
|
return `${formatNumber(allocation)} ${(0, import_pluralize4.default)(feature.name, allocation)}`;
|
|
17947
18078
|
}
|
|
17948
18079
|
if (!priceBehavior) {
|
|
17949
18080
|
return t2("Unlimited", { item: (0, import_pluralize4.default)(feature.name) });
|
|
17950
18081
|
}
|
|
17951
|
-
}, [t2, allocation, feature?.name, price, priceBehavior, currency]);
|
|
18082
|
+
}, [t2, allocation, feature?.name, price, priceBehavior, currency, softLimit]);
|
|
17952
18083
|
const usageText = (0, import_react31.useMemo)(() => {
|
|
17953
18084
|
if (!feature?.name) {
|
|
17954
18085
|
return;
|
|
@@ -17957,14 +18088,18 @@ var Details = ({
|
|
|
17957
18088
|
let acc;
|
|
17958
18089
|
if (priceBehavior === "pay_in_advance" && typeof data.company?.plan?.planPeriod === "string" && typeof price === "number") {
|
|
17959
18090
|
acc = `${formatCurrency(price, currency)}/${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}/${shortenPeriod(data.company.plan.planPeriod)}`;
|
|
17960
|
-
} else if (priceBehavior === "pay_as_you_go" && typeof usage === "number") {
|
|
18091
|
+
} else if ((priceBehavior === "pay_as_you_go" || priceBehavior === "overage") && typeof usage === "number") {
|
|
17961
18092
|
acc = `${usage} ${(0, import_pluralize4.default)(feature.name.toLowerCase(), usage)} ${t2("used")}`;
|
|
17962
18093
|
}
|
|
17963
18094
|
if (acc) {
|
|
17964
|
-
if (
|
|
18095
|
+
if (priceBehavior === "pay_in_advance" && typeof price === "number" && typeof allocation === "number") {
|
|
17965
18096
|
acc += ` \u2022 ${formatCurrency(price * allocation, currency)}`;
|
|
17966
|
-
} else if (
|
|
18097
|
+
} else if (priceBehavior === "pay_as_you_go" && typeof price === "number" && typeof usage === "number") {
|
|
17967
18098
|
acc += ` \u2022 ${formatCurrency(price * usage, currency)}`;
|
|
18099
|
+
} else if (priceBehavior === "overage" && typeof price === "number" && typeof usage === "number" && typeof softLimit === "number") {
|
|
18100
|
+
const cost = price * (usage - softLimit);
|
|
18101
|
+
const period = feature.featureType === "event" && typeof data.company?.plan?.planPeriod === "string" ? `/${shortenPeriod(data.company.plan.planPeriod)}` : "";
|
|
18102
|
+
acc += cost > 0 ? ` \u2022 ${t2("Overage")}: ${formatCurrency(cost)}${period}` : ` \u2022 ${`${formatCurrency(price)}/${(0, import_pluralize4.default)(feature.name.toLowerCase(), 1)}`} ${t2("overage fee")}`;
|
|
17968
18103
|
}
|
|
17969
18104
|
return acc;
|
|
17970
18105
|
}
|
|
@@ -17979,14 +18114,16 @@ var Details = ({
|
|
|
17979
18114
|
}
|
|
17980
18115
|
}, [
|
|
17981
18116
|
t2,
|
|
17982
|
-
allocation,
|
|
17983
18117
|
data.company?.plan?.planPeriod,
|
|
17984
18118
|
feature?.name,
|
|
17985
|
-
|
|
18119
|
+
feature?.featureType,
|
|
17986
18120
|
priceBehavior,
|
|
18121
|
+
allocation,
|
|
18122
|
+
price,
|
|
18123
|
+
currency,
|
|
18124
|
+
softLimit,
|
|
17987
18125
|
usage,
|
|
17988
|
-
usageData
|
|
17989
|
-
currency
|
|
18126
|
+
usageData
|
|
17990
18127
|
]);
|
|
17991
18128
|
if (!text) {
|
|
17992
18129
|
return null;
|
|
@@ -18426,11 +18563,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18426
18563
|
allocation,
|
|
18427
18564
|
feature,
|
|
18428
18565
|
usage,
|
|
18566
|
+
softLimit,
|
|
18429
18567
|
priceBehavior,
|
|
18430
18568
|
metricResetAt,
|
|
18431
18569
|
monthlyUsageBasedPrice,
|
|
18432
18570
|
yearlyUsageBasedPrice
|
|
18433
18571
|
}, index) => {
|
|
18572
|
+
const limit = allocation || softLimit || 0;
|
|
18573
|
+
const isOverage = priceBehavior === "overage" && typeof softLimit === "number" && typeof usage === "number" && usage > softLimit;
|
|
18434
18574
|
let price;
|
|
18435
18575
|
let currency;
|
|
18436
18576
|
if (planPeriod === "month") {
|
|
@@ -18440,137 +18580,193 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18440
18580
|
price = yearlyUsageBasedPrice?.price;
|
|
18441
18581
|
currency = yearlyUsageBasedPrice?.currency;
|
|
18442
18582
|
}
|
|
18443
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18444
|
-
|
|
18445
|
-
|
|
18583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column-reverse", children: [
|
|
18584
|
+
priceBehavior === "overage" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18585
|
+
Flex,
|
|
18446
18586
|
{
|
|
18447
|
-
|
|
18448
|
-
|
|
18449
|
-
|
|
18450
|
-
|
|
18451
|
-
|
|
18587
|
+
$justifyContent: "space-between",
|
|
18588
|
+
$alignItems: "center",
|
|
18589
|
+
$padding: `${0.4375 * theme.card.padding / TEXT_BASE_SIZE}rem ${theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
18590
|
+
$backgroundColor: isLightBackground ? darken(theme.card.background, 0.05) : lighten(theme.card.background, 0.1),
|
|
18591
|
+
children: [
|
|
18592
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18593
|
+
Text,
|
|
18594
|
+
{
|
|
18595
|
+
$font: theme.typography.text.fontFamily,
|
|
18596
|
+
$size: theme.typography.text.fontSize,
|
|
18597
|
+
$weight: theme.typography.text.fontWeight,
|
|
18598
|
+
$color: theme.typography.text.color,
|
|
18599
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18600
|
+
t2("Overage fee"),
|
|
18601
|
+
": ",
|
|
18602
|
+
formatCurrency(price, currency),
|
|
18603
|
+
feature && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("sub", { children: [
|
|
18604
|
+
"/",
|
|
18605
|
+
(0, import_pluralize5.default)(feature.name.toLowerCase(), 1),
|
|
18606
|
+
feature.featureType === "event" && data.company?.plan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18607
|
+
"/",
|
|
18608
|
+
shortenPeriod(data.company.plan.planPeriod)
|
|
18609
|
+
] })
|
|
18610
|
+
] })
|
|
18611
|
+
] })
|
|
18612
|
+
}
|
|
18613
|
+
),
|
|
18614
|
+
isOverage && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18615
|
+
Text,
|
|
18616
|
+
{
|
|
18617
|
+
$font: theme.typography.text.fontFamily,
|
|
18618
|
+
$size: theme.typography.text.fontSize,
|
|
18619
|
+
$weight: theme.typography.text.fontWeight,
|
|
18620
|
+
$color: theme.typography.text.color,
|
|
18621
|
+
children: [
|
|
18622
|
+
t2("X over the limit", {
|
|
18623
|
+
amount: usage - softLimit
|
|
18624
|
+
}),
|
|
18625
|
+
" \xB7 ",
|
|
18626
|
+
formatCurrency(price * (usage - softLimit), currency),
|
|
18627
|
+
feature?.featureType === "event" && typeof data.company?.plan?.planPeriod === "string" && `/${shortenPeriod(data.company.plan.planPeriod)}`
|
|
18628
|
+
]
|
|
18629
|
+
}
|
|
18630
|
+
)
|
|
18452
18631
|
]
|
|
18453
18632
|
}
|
|
18454
18633
|
),
|
|
18455
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18456
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.
|
|
18457
|
-
|
|
18634
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Element, { as: Flex, $gap: "1.5rem", children: [
|
|
18635
|
+
props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18636
|
+
IconRound,
|
|
18458
18637
|
{
|
|
18459
|
-
|
|
18460
|
-
|
|
18461
|
-
|
|
18462
|
-
|
|
18463
|
-
|
|
18464
|
-
$flexWrap: "wrap",
|
|
18465
|
-
$gap: "1rem",
|
|
18466
|
-
children: [
|
|
18467
|
-
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
|
|
18468
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18469
|
-
Text,
|
|
18470
|
-
{
|
|
18471
|
-
as: Box,
|
|
18472
|
-
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
18473
|
-
$size: theme.typography[props.header.fontStyle].fontSize,
|
|
18474
|
-
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
|
18475
|
-
$color: theme.typography[props.header.fontStyle].color,
|
|
18476
|
-
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18477
|
-
formatNumber(usage),
|
|
18478
|
-
" ",
|
|
18479
|
-
(0, import_pluralize5.default)(feature.name, usage)
|
|
18480
|
-
] }) : feature.name
|
|
18481
|
-
}
|
|
18482
|
-
),
|
|
18483
|
-
props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18484
|
-
Text,
|
|
18485
|
-
{
|
|
18486
|
-
as: Box,
|
|
18487
|
-
$font: theme.typography[props.description.fontStyle].fontFamily,
|
|
18488
|
-
$size: theme.typography[props.description.fontStyle].fontSize,
|
|
18489
|
-
$weight: theme.typography[props.description.fontStyle].fontWeight,
|
|
18490
|
-
$color: theme.typography[props.description.fontStyle].color,
|
|
18491
|
-
children: feature.description
|
|
18492
|
-
}
|
|
18493
|
-
)
|
|
18494
|
-
] }),
|
|
18495
|
-
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18496
|
-
Box,
|
|
18497
|
-
{
|
|
18498
|
-
$flexBasis: "min-content",
|
|
18499
|
-
$flexGrow: "1",
|
|
18500
|
-
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
18501
|
-
children: [
|
|
18502
|
-
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18503
|
-
Text,
|
|
18504
|
-
{
|
|
18505
|
-
as: Box,
|
|
18506
|
-
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
|
18507
|
-
$size: theme.typography[props.usage.fontStyle].fontSize,
|
|
18508
|
-
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
|
18509
|
-
$leading: 1.25,
|
|
18510
|
-
$color: theme.typography[props.usage.fontStyle].color,
|
|
18511
|
-
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18512
|
-
formatNumber(allocation),
|
|
18513
|
-
" ",
|
|
18514
|
-
(0, import_pluralize5.default)(feature.name, allocation)
|
|
18515
|
-
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18516
|
-
formatNumber(usage),
|
|
18517
|
-
" ",
|
|
18518
|
-
(0, import_pluralize5.default)(feature.name, usage)
|
|
18519
|
-
] })
|
|
18520
|
-
}
|
|
18521
|
-
),
|
|
18522
|
-
props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18523
|
-
Text,
|
|
18524
|
-
{
|
|
18525
|
-
$font: theme.typography[props.allocation.fontStyle].fontFamily,
|
|
18526
|
-
$size: theme.typography[props.allocation.fontStyle].fontSize,
|
|
18527
|
-
$weight: theme.typography[props.allocation.fontStyle].fontWeight,
|
|
18528
|
-
$color: theme.typography[props.allocation.fontStyle].color,
|
|
18529
|
-
children: priceBehavior && metricResetAt ? t2("Resets", {
|
|
18530
|
-
date: toPrettyDate(metricResetAt, {
|
|
18531
|
-
month: "short",
|
|
18532
|
-
day: "numeric",
|
|
18533
|
-
year: void 0
|
|
18534
|
-
})
|
|
18535
|
-
}) : typeof allocation === "number" ? t2("Limit of", {
|
|
18536
|
-
amount: formatNumber(allocation)
|
|
18537
|
-
}) : t2("No limit")
|
|
18538
|
-
}
|
|
18539
|
-
) })
|
|
18540
|
-
]
|
|
18541
|
-
}
|
|
18542
|
-
)
|
|
18638
|
+
name: feature.icon,
|
|
18639
|
+
size: "sm",
|
|
18640
|
+
colors: [
|
|
18641
|
+
theme.primary,
|
|
18642
|
+
isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)"
|
|
18543
18643
|
]
|
|
18544
18644
|
}
|
|
18545
18645
|
),
|
|
18546
|
-
|
|
18547
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.
|
|
18548
|
-
|
|
18549
|
-
{
|
|
18550
|
-
progress: usage / allocation * 100,
|
|
18551
|
-
value: usage,
|
|
18552
|
-
total: allocation,
|
|
18553
|
-
color: progressColorMap[Math.floor(
|
|
18554
|
-
Math.min(usage, allocation) / allocation * (progressColorMap.length - 1)
|
|
18555
|
-
)],
|
|
18556
|
-
$flexGrow: "1"
|
|
18557
|
-
}
|
|
18558
|
-
),
|
|
18559
|
-
priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18560
|
-
EmbedButton,
|
|
18646
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
|
|
18647
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18648
|
+
Flex,
|
|
18561
18649
|
{
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
|
|
18565
|
-
|
|
18566
|
-
},
|
|
18567
|
-
style: {
|
|
18568
|
-
width: "fit-content",
|
|
18569
|
-
padding: "0 1rem 0 0.5rem"
|
|
18650
|
+
ref: (el) => {
|
|
18651
|
+
if (el) {
|
|
18652
|
+
elements.current.push(el);
|
|
18653
|
+
}
|
|
18570
18654
|
},
|
|
18571
|
-
|
|
18655
|
+
$flexWrap: "wrap",
|
|
18656
|
+
$gap: "1rem",
|
|
18657
|
+
children: [
|
|
18658
|
+
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
|
|
18659
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18660
|
+
Text,
|
|
18661
|
+
{
|
|
18662
|
+
as: Box,
|
|
18663
|
+
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
18664
|
+
$size: theme.typography[props.header.fontStyle].fontSize,
|
|
18665
|
+
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
|
18666
|
+
$color: theme.typography[props.header.fontStyle].color,
|
|
18667
|
+
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18668
|
+
formatNumber(usage),
|
|
18669
|
+
" ",
|
|
18670
|
+
(0, import_pluralize5.default)(feature.name, usage)
|
|
18671
|
+
] }) : feature.name
|
|
18672
|
+
}
|
|
18673
|
+
),
|
|
18674
|
+
props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18675
|
+
Text,
|
|
18676
|
+
{
|
|
18677
|
+
as: Box,
|
|
18678
|
+
$font: theme.typography[props.description.fontStyle].fontFamily,
|
|
18679
|
+
$size: theme.typography[props.description.fontStyle].fontSize,
|
|
18680
|
+
$weight: theme.typography[props.description.fontStyle].fontWeight,
|
|
18681
|
+
$color: theme.typography[props.description.fontStyle].color,
|
|
18682
|
+
children: feature.description
|
|
18683
|
+
}
|
|
18684
|
+
)
|
|
18685
|
+
] }),
|
|
18686
|
+
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18687
|
+
Box,
|
|
18688
|
+
{
|
|
18689
|
+
$flexBasis: "min-content",
|
|
18690
|
+
$flexGrow: "1",
|
|
18691
|
+
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
18692
|
+
children: [
|
|
18693
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18694
|
+
Text,
|
|
18695
|
+
{
|
|
18696
|
+
as: Box,
|
|
18697
|
+
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
|
18698
|
+
$size: theme.typography[props.usage.fontStyle].fontSize,
|
|
18699
|
+
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
|
18700
|
+
$leading: 1.35,
|
|
18701
|
+
$color: theme.typography[props.usage.fontStyle].color,
|
|
18702
|
+
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18703
|
+
formatNumber(allocation),
|
|
18704
|
+
" ",
|
|
18705
|
+
(0, import_pluralize5.default)(feature.name, allocation)
|
|
18706
|
+
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18707
|
+
formatNumber(usage),
|
|
18708
|
+
" ",
|
|
18709
|
+
(0, import_pluralize5.default)(feature.name, usage),
|
|
18710
|
+
priceBehavior === "overage" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18711
|
+
" ",
|
|
18712
|
+
t2("used")
|
|
18713
|
+
] })
|
|
18714
|
+
] })
|
|
18715
|
+
}
|
|
18716
|
+
),
|
|
18717
|
+
props.allocation.isVisible && priceBehavior !== "overage" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18718
|
+
Text,
|
|
18719
|
+
{
|
|
18720
|
+
$font: theme.typography[props.allocation.fontStyle].fontFamily,
|
|
18721
|
+
$size: theme.typography[props.allocation.fontStyle].fontSize,
|
|
18722
|
+
$weight: theme.typography[props.allocation.fontStyle].fontWeight,
|
|
18723
|
+
$color: theme.typography[props.allocation.fontStyle].color,
|
|
18724
|
+
children: priceBehavior && priceBehavior !== "overage" && metricResetAt ? t2("Resets", {
|
|
18725
|
+
date: toPrettyDate(metricResetAt, {
|
|
18726
|
+
month: "short",
|
|
18727
|
+
day: "numeric",
|
|
18728
|
+
year: void 0
|
|
18729
|
+
})
|
|
18730
|
+
}) : typeof allocation === "number" || typeof softLimit === "number" ? t2("Limit of", {
|
|
18731
|
+
amount: formatNumber(limit)
|
|
18732
|
+
}) : t2("No limit")
|
|
18733
|
+
}
|
|
18734
|
+
) })
|
|
18735
|
+
]
|
|
18736
|
+
}
|
|
18737
|
+
)
|
|
18738
|
+
]
|
|
18572
18739
|
}
|
|
18573
|
-
)
|
|
18740
|
+
),
|
|
18741
|
+
props.isVisible && typeof usage === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $gap: "2rem", children: [
|
|
18742
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18743
|
+
ProgressBar,
|
|
18744
|
+
{
|
|
18745
|
+
progress: (isOverage ? softLimit / usage : usage / limit) * 100,
|
|
18746
|
+
value: usage,
|
|
18747
|
+
total: isOverage ? softLimit : limit,
|
|
18748
|
+
color: isOverage ? "blue" : progressColorMap[Math.floor(
|
|
18749
|
+
Math.min(usage, limit) / limit * (progressColorMap.length - 1)
|
|
18750
|
+
)],
|
|
18751
|
+
...isOverage && { bgColor: "#EF4444" },
|
|
18752
|
+
$flexGrow: "1"
|
|
18753
|
+
}
|
|
18754
|
+
),
|
|
18755
|
+
priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18756
|
+
EmbedButton,
|
|
18757
|
+
{
|
|
18758
|
+
onClick: () => {
|
|
18759
|
+
setSelected({ usage: true });
|
|
18760
|
+
setLayout("checkout");
|
|
18761
|
+
},
|
|
18762
|
+
style: {
|
|
18763
|
+
width: "fit-content",
|
|
18764
|
+
padding: "0 1rem 0 0.5rem"
|
|
18765
|
+
},
|
|
18766
|
+
children: t2("Add More")
|
|
18767
|
+
}
|
|
18768
|
+
)
|
|
18769
|
+
] })
|
|
18574
18770
|
] })
|
|
18575
18771
|
] })
|
|
18576
18772
|
] }, index);
|
|
@@ -18998,7 +19194,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18998
19194
|
};
|
|
18999
19195
|
const usageBasedEntitlements = (featureUsage?.features || []).reduce(
|
|
19000
19196
|
(acc, usage) => {
|
|
19001
|
-
const quantity = usage
|
|
19197
|
+
const quantity = usage.allocation || usage.softLimit || 0;
|
|
19002
19198
|
let price;
|
|
19003
19199
|
let currencyCode;
|
|
19004
19200
|
if (currentPlan?.planPeriod === "month") {
|
|
@@ -19008,7 +19204,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
19008
19204
|
price = usage.yearlyUsageBasedPrice?.price;
|
|
19009
19205
|
currencyCode = usage.yearlyUsageBasedPrice?.currency;
|
|
19010
19206
|
}
|
|
19011
|
-
if (usage.priceBehavior && typeof price === "number"
|
|
19207
|
+
if (usage.priceBehavior && typeof price === "number") {
|
|
19012
19208
|
acc.push({ ...usage, price, quantity, currencyCode });
|
|
19013
19209
|
}
|
|
19014
19210
|
return acc;
|
|
@@ -19238,6 +19434,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
19238
19434
|
),
|
|
19239
19435
|
usageBasedEntitlements.reduce(
|
|
19240
19436
|
(acc, entitlement) => {
|
|
19437
|
+
const overageAmount = entitlement.priceBehavior === "overage" && (entitlement?.usage ?? 0) - (entitlement?.softLimit ?? 0);
|
|
19438
|
+
const amount = entitlement.quantity || Math.max(entitlement?.softLimit || 0, 0);
|
|
19241
19439
|
if (entitlement.feature?.name) {
|
|
19242
19440
|
acc.push(
|
|
19243
19441
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
@@ -19255,17 +19453,45 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
19255
19453
|
$size: theme.typography[props.addOns.fontStyle].fontSize,
|
|
19256
19454
|
$weight: theme.typography[props.addOns.fontStyle].fontWeight,
|
|
19257
19455
|
$color: theme.typography[props.addOns.fontStyle].color,
|
|
19258
|
-
children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19259
|
-
|
|
19456
|
+
children: entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && amount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19457
|
+
amount,
|
|
19260
19458
|
" ",
|
|
19261
|
-
(0, import_pluralize6.default)(
|
|
19262
|
-
entitlement.feature.name,
|
|
19263
|
-
entitlement.quantity
|
|
19264
|
-
)
|
|
19459
|
+
(0, import_pluralize6.default)(entitlement.feature.name, amount)
|
|
19265
19460
|
] }) : entitlement.feature.name
|
|
19266
19461
|
}
|
|
19267
19462
|
),
|
|
19268
19463
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $alignItems: "center", $gap: "1rem", children: [
|
|
19464
|
+
entitlement.priceBehavior === "overage" && currentPlan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19465
|
+
Text,
|
|
19466
|
+
{
|
|
19467
|
+
$font: theme.typography.text.fontFamily,
|
|
19468
|
+
$size: 0.875 * theme.typography.text.fontSize,
|
|
19469
|
+
$weight: theme.typography.text.fontWeight,
|
|
19470
|
+
$color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
|
|
19471
|
+
children: typeof overageAmount === "number" && overageAmount > 0 ? t2("X over the limit", {
|
|
19472
|
+
amount: overageAmount
|
|
19473
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19474
|
+
t2("Overage fee"),
|
|
19475
|
+
":",
|
|
19476
|
+
" ",
|
|
19477
|
+
formatCurrency(
|
|
19478
|
+
entitlement.price,
|
|
19479
|
+
entitlement.currencyCode
|
|
19480
|
+
),
|
|
19481
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
19482
|
+
"/",
|
|
19483
|
+
(0, import_pluralize6.default)(
|
|
19484
|
+
entitlement.feature.name.toLowerCase(),
|
|
19485
|
+
1
|
|
19486
|
+
),
|
|
19487
|
+
entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19488
|
+
"/",
|
|
19489
|
+
shortenPeriod(currentPlan.planPeriod)
|
|
19490
|
+
] })
|
|
19491
|
+
] })
|
|
19492
|
+
] })
|
|
19493
|
+
}
|
|
19494
|
+
),
|
|
19269
19495
|
entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
19270
19496
|
Text,
|
|
19271
19497
|
{
|
|
@@ -19290,7 +19516,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
19290
19516
|
]
|
|
19291
19517
|
}
|
|
19292
19518
|
),
|
|
19293
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
19519
|
+
amount > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
19294
19520
|
Text,
|
|
19295
19521
|
{
|
|
19296
19522
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19299,10 +19525,10 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
19299
19525
|
$color: theme.typography.text.color,
|
|
19300
19526
|
children: [
|
|
19301
19527
|
formatCurrency(
|
|
19302
|
-
entitlement.price *
|
|
19528
|
+
entitlement.price * amount,
|
|
19303
19529
|
entitlement.currencyCode
|
|
19304
19530
|
),
|
|
19305
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
19531
|
+
(entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
19306
19532
|
"/",
|
|
19307
19533
|
currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : (0, import_pluralize6.default)(
|
|
19308
19534
|
entitlement.feature.name.toLowerCase(),
|
|
@@ -19600,6 +19826,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19600
19826
|
}
|
|
19601
19827
|
) }),
|
|
19602
19828
|
plan.entitlements.reduce((acc, entitlement) => {
|
|
19829
|
+
const limit = entitlement.softLimit || entitlement.valueNumeric;
|
|
19603
19830
|
let price;
|
|
19604
19831
|
let currency;
|
|
19605
19832
|
if (selectedPeriod === "month") {
|
|
@@ -19625,49 +19852,101 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19625
19852
|
]
|
|
19626
19853
|
}
|
|
19627
19854
|
),
|
|
19628
|
-
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime32.
|
|
19629
|
-
|
|
19855
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19856
|
+
Flex,
|
|
19630
19857
|
{
|
|
19631
|
-
$
|
|
19632
|
-
$
|
|
19633
|
-
$
|
|
19634
|
-
|
|
19635
|
-
|
|
19636
|
-
|
|
19637
|
-
|
|
19638
|
-
|
|
19639
|
-
|
|
19640
|
-
|
|
19641
|
-
|
|
19642
|
-
|
|
19643
|
-
|
|
19858
|
+
$flexDirection: "column",
|
|
19859
|
+
$justifyContent: "center",
|
|
19860
|
+
$gap: "0.5rem",
|
|
19861
|
+
children: [
|
|
19862
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19863
|
+
Text,
|
|
19864
|
+
{
|
|
19865
|
+
$font: theme.typography.text.fontFamily,
|
|
19866
|
+
$size: theme.typography.text.fontSize,
|
|
19867
|
+
$weight: theme.typography.text.fontWeight,
|
|
19868
|
+
$color: theme.typography.text.color,
|
|
19869
|
+
$leading: 1.35,
|
|
19870
|
+
children: typeof price === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19871
|
+
formatCurrency(price, currency),
|
|
19872
|
+
" ",
|
|
19873
|
+
t2("per"),
|
|
19874
|
+
" ",
|
|
19875
|
+
(0, import_pluralize7.default)(
|
|
19876
|
+
entitlement.feature.name,
|
|
19877
|
+
1
|
|
19878
|
+
),
|
|
19879
|
+
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19880
|
+
" ",
|
|
19881
|
+
t2("per"),
|
|
19882
|
+
" ",
|
|
19883
|
+
selectedPeriod
|
|
19884
|
+
] })
|
|
19885
|
+
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19886
|
+
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
19887
|
+
item: (0, import_pluralize7.default)(
|
|
19888
|
+
entitlement.feature.name
|
|
19889
|
+
)
|
|
19890
|
+
}) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19891
|
+
formatNumber(limit),
|
|
19892
|
+
" ",
|
|
19893
|
+
(0, import_pluralize7.default)(
|
|
19894
|
+
entitlement.feature.name,
|
|
19895
|
+
limit
|
|
19896
|
+
)
|
|
19897
|
+
] }),
|
|
19898
|
+
entitlement.metricPeriod ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19899
|
+
" ",
|
|
19900
|
+
t2("per"),
|
|
19901
|
+
" ",
|
|
19902
|
+
{
|
|
19903
|
+
billing: "billing period",
|
|
19904
|
+
current_day: "day",
|
|
19905
|
+
current_month: "month",
|
|
19906
|
+
current_year: "year"
|
|
19907
|
+
}[entitlement.metricPeriod]
|
|
19908
|
+
] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19909
|
+
"/",
|
|
19910
|
+
shortenPeriod(selectedPeriod)
|
|
19911
|
+
] })
|
|
19912
|
+
] }) : entitlement.feature.name
|
|
19913
|
+
}
|
|
19644
19914
|
),
|
|
19645
|
-
entitlement.priceBehavior === "
|
|
19646
|
-
|
|
19647
|
-
t2("per"),
|
|
19648
|
-
" ",
|
|
19649
|
-
selectedPeriod
|
|
19650
|
-
] })
|
|
19651
|
-
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19652
|
-
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
19653
|
-
item: (0, import_pluralize7.default)(
|
|
19654
|
-
entitlement.feature.name
|
|
19655
|
-
)
|
|
19656
|
-
}) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize7.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
|
|
19657
|
-
entitlement.metricPeriod && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19658
|
-
" ",
|
|
19659
|
-
t2("per"),
|
|
19660
|
-
" ",
|
|
19915
|
+
entitlement.priceBehavior === "overage" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19916
|
+
Text,
|
|
19661
19917
|
{
|
|
19662
|
-
|
|
19663
|
-
|
|
19664
|
-
|
|
19665
|
-
|
|
19666
|
-
|
|
19667
|
-
|
|
19668
|
-
|
|
19918
|
+
$font: theme.typography.text.fontFamily,
|
|
19919
|
+
$size: 0.875 * theme.typography.text.fontSize,
|
|
19920
|
+
$weight: theme.typography.text.fontWeight,
|
|
19921
|
+
$color: hexToHSL(
|
|
19922
|
+
theme.typography.text.color
|
|
19923
|
+
).l > 50 ? darken(
|
|
19924
|
+
theme.typography.text.color,
|
|
19925
|
+
0.46
|
|
19926
|
+
) : lighten(
|
|
19927
|
+
theme.typography.text.color,
|
|
19928
|
+
0.46
|
|
19929
|
+
),
|
|
19930
|
+
$leading: 1.35,
|
|
19931
|
+
children: [
|
|
19932
|
+
formatCurrency(price),
|
|
19933
|
+
"/",
|
|
19934
|
+
(0, import_pluralize7.default)(
|
|
19935
|
+
entitlement.feature.name.toLowerCase(),
|
|
19936
|
+
1
|
|
19937
|
+
),
|
|
19938
|
+
entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19939
|
+
"/",
|
|
19940
|
+
shortenPeriod(selectedPeriod)
|
|
19941
|
+
] }),
|
|
19942
|
+
" ",
|
|
19943
|
+
t2("overage fee")
|
|
19944
|
+
]
|
|
19945
|
+
}
|
|
19946
|
+
)
|
|
19947
|
+
]
|
|
19669
19948
|
}
|
|
19670
|
-
)
|
|
19949
|
+
)
|
|
19671
19950
|
] }, entitlement.id)
|
|
19672
19951
|
);
|
|
19673
19952
|
return acc;
|