@schematichq/schematic-components 0.7.13 → 0.7.14
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 +253 -165
- package/dist/schematic-components.d.ts +16 -60
- package/dist/schematic-components.esm.js +283 -195
- package/package.json +12 -12
|
@@ -6692,9 +6692,9 @@ var unitlessKeys = {
|
|
|
6692
6692
|
var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
|
|
6693
6693
|
var m = "active";
|
|
6694
6694
|
var y = "data-styled-version";
|
|
6695
|
-
var v = "6.1.
|
|
6695
|
+
var v = "6.1.18";
|
|
6696
6696
|
var g = "/*!sc*/\n";
|
|
6697
|
-
var S = "undefined" != typeof window && "
|
|
6697
|
+
var S = "undefined" != typeof window && "undefined" != typeof document;
|
|
6698
6698
|
var w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY ? "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY : true);
|
|
6699
6699
|
var b = {};
|
|
6700
6700
|
var E = /invalid hook call/i;
|
|
@@ -8113,13 +8113,14 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
8113
8113
|
if (lng) this.language = lng;
|
|
8114
8114
|
}
|
|
8115
8115
|
exists(key) {
|
|
8116
|
-
let
|
|
8116
|
+
let o2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
8117
8117
|
interpolation: {}
|
|
8118
8118
|
};
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
}
|
|
8122
|
-
|
|
8119
|
+
const opt = {
|
|
8120
|
+
...o2
|
|
8121
|
+
};
|
|
8122
|
+
if (key == null) return false;
|
|
8123
|
+
const resolved = this.resolve(key, opt);
|
|
8123
8124
|
return resolved?.res !== void 0;
|
|
8124
8125
|
}
|
|
8125
8126
|
extractFromKey(key, opt) {
|
|
@@ -8146,7 +8147,10 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
8146
8147
|
namespaces: isString(namespaces) ? [namespaces] : namespaces
|
|
8147
8148
|
};
|
|
8148
8149
|
}
|
|
8149
|
-
translate(keys,
|
|
8150
|
+
translate(keys, o2, lastKey) {
|
|
8151
|
+
let opt = typeof o2 === "object" ? {
|
|
8152
|
+
...o2
|
|
8153
|
+
} : o2;
|
|
8150
8154
|
if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) {
|
|
8151
8155
|
opt = this.options.overloadTranslationOptionHandler(arguments);
|
|
8152
8156
|
}
|
|
@@ -8324,7 +8328,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
8324
8328
|
res = this.extendTranslation(res, keys, opt, resolved, lastKey);
|
|
8325
8329
|
if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = `${namespace}:${key}`;
|
|
8326
8330
|
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
|
|
8327
|
-
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}:${key}` : key, usedDefault ? res : void 0);
|
|
8331
|
+
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}:${key}` : key, usedDefault ? res : void 0, opt);
|
|
8328
8332
|
}
|
|
8329
8333
|
}
|
|
8330
8334
|
if (returnDetails) {
|
|
@@ -9605,7 +9609,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9605
9609
|
}
|
|
9606
9610
|
if (!this.resolvedLanguage && this.languages.indexOf(l2) < 0 && this.store.hasLanguageSomeTranslations(l2)) {
|
|
9607
9611
|
this.resolvedLanguage = l2;
|
|
9608
|
-
|
|
9612
|
+
this.languages.unshift(l2);
|
|
9609
9613
|
}
|
|
9610
9614
|
}
|
|
9611
9615
|
changeLanguage(lng, callback) {
|
|
@@ -9819,12 +9823,13 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
9819
9823
|
prev2[l2] = {
|
|
9820
9824
|
...this.store.data[l2]
|
|
9821
9825
|
};
|
|
9822
|
-
|
|
9826
|
+
prev2[l2] = Object.keys(prev2[l2]).reduce((acc, n) => {
|
|
9823
9827
|
acc[n] = {
|
|
9824
9828
|
...prev2[l2][n]
|
|
9825
9829
|
};
|
|
9826
9830
|
return acc;
|
|
9827
|
-
},
|
|
9831
|
+
}, prev2[l2]);
|
|
9832
|
+
return prev2;
|
|
9828
9833
|
}, {});
|
|
9829
9834
|
clone.store = new ResourceStore(clonedData, mergedOptions);
|
|
9830
9835
|
clone.services.resourceStore = clone.store;
|
|
@@ -14681,6 +14686,8 @@ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
14681
14686
|
id: json["id"],
|
|
14682
14687
|
interval: json["interval"],
|
|
14683
14688
|
isActive: json["is_active"],
|
|
14689
|
+
meterEventName: json["meter_event_name"] == null ? void 0 : json["meter_event_name"],
|
|
14690
|
+
meterEventPayloadKey: json["meter_event_payload_key"] == null ? void 0 : json["meter_event_payload_key"],
|
|
14684
14691
|
meterId: json["meter_id"] == null ? void 0 : json["meter_id"],
|
|
14685
14692
|
packageSize: json["package_size"],
|
|
14686
14693
|
price: json["price"],
|
|
@@ -15221,12 +15228,12 @@ function EventSummaryResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
15221
15228
|
return json;
|
|
15222
15229
|
}
|
|
15223
15230
|
return {
|
|
15224
|
-
companyCount: json["company_count"],
|
|
15231
|
+
companyCount: json["company_count"] == null ? void 0 : json["company_count"],
|
|
15225
15232
|
environmentId: json["environment_id"],
|
|
15226
15233
|
eventCount: json["event_count"],
|
|
15227
15234
|
eventSubtype: json["event_subtype"],
|
|
15228
15235
|
lastSeenAt: json["last_seen_at"] == null ? void 0 : new Date(json["last_seen_at"]),
|
|
15229
|
-
userCount: json["user_count"]
|
|
15236
|
+
userCount: json["user_count"] == null ? void 0 : json["user_count"]
|
|
15230
15237
|
};
|
|
15231
15238
|
}
|
|
15232
15239
|
|
|
@@ -16373,6 +16380,7 @@ var en_default = {
|
|
|
16373
16380
|
"Pay now": "Pay now",
|
|
16374
16381
|
"Payment Method": "Payment Method",
|
|
16375
16382
|
"Percent off": "{{percent}}% off",
|
|
16383
|
+
"Plan selected": "Plan selected",
|
|
16376
16384
|
Plan: "Plan",
|
|
16377
16385
|
Plans: "Plans",
|
|
16378
16386
|
"Please provide an access token.": "Please provide an access token.",
|
|
@@ -16394,13 +16402,15 @@ var en_default = {
|
|
|
16394
16402
|
"Session expired. Please refresh and try again.": "Session expired. Please refresh and try again.",
|
|
16395
16403
|
"Show details": "Show details",
|
|
16396
16404
|
"Start trial": "Start trial",
|
|
16405
|
+
"Start X day trial": "Start {{days}} day trial",
|
|
16397
16406
|
"Subscribe and close": "Subscribe and close",
|
|
16398
16407
|
"Subscription canceled": "Subscription canceled",
|
|
16399
16408
|
Subscription: "Subscription",
|
|
16400
16409
|
"Talk to support": "Talk to support",
|
|
16401
16410
|
Total: "Total",
|
|
16402
16411
|
"Trial ends in": "Trial ends in {{days}} days",
|
|
16403
|
-
"Trial
|
|
16412
|
+
"Trial in progress": "Trial in progress",
|
|
16413
|
+
"Trial selected": "Trial selected",
|
|
16404
16414
|
Trial: "Trial",
|
|
16405
16415
|
Unlimited: "Unlimited {{item}}",
|
|
16406
16416
|
"Unsubscribe failed": "Unsubscribe failed",
|
|
@@ -17095,7 +17105,7 @@ var EmbedProvider = ({
|
|
|
17095
17105
|
useEffect2(() => {
|
|
17096
17106
|
if (accessToken) {
|
|
17097
17107
|
const { headers = {} } = apiConfig ?? {};
|
|
17098
|
-
headers["X-Schematic-Components-Version"] = "0.7.
|
|
17108
|
+
headers["X-Schematic-Components-Version"] = "0.7.14";
|
|
17099
17109
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
17100
17110
|
const config = new Configuration({
|
|
17101
17111
|
...apiConfig,
|
|
@@ -17539,29 +17549,23 @@ var Button = dt.button(
|
|
|
17539
17549
|
case "sm":
|
|
17540
17550
|
return lt`
|
|
17541
17551
|
font-size: ${15 / TEXT_BASE_SIZE}rem;
|
|
17542
|
-
${
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
border-radius: ${6 / TEXT_BASE_SIZE}rem;
|
|
17546
|
-
`}
|
|
17552
|
+
height: ${40 / TEXT_BASE_SIZE}rem;
|
|
17553
|
+
padding: ${7 / TEXT_BASE_SIZE}rem ${20 / TEXT_BASE_SIZE}rem;
|
|
17554
|
+
border-radius: ${6 / TEXT_BASE_SIZE}rem;
|
|
17547
17555
|
`;
|
|
17548
17556
|
case "md":
|
|
17549
17557
|
return lt`
|
|
17550
17558
|
font-size: ${17 / TEXT_BASE_SIZE}rem;
|
|
17551
|
-
${
|
|
17552
|
-
|
|
17553
|
-
|
|
17554
|
-
border-radius: ${8 / TEXT_BASE_SIZE}rem;
|
|
17555
|
-
`}
|
|
17559
|
+
height: ${52 / TEXT_BASE_SIZE}rem;
|
|
17560
|
+
padding: ${8 / TEXT_BASE_SIZE}rem ${24 / TEXT_BASE_SIZE}rem;
|
|
17561
|
+
border-radius: ${8 / TEXT_BASE_SIZE}rem;
|
|
17556
17562
|
`;
|
|
17557
17563
|
case "lg":
|
|
17558
17564
|
return lt`
|
|
17559
17565
|
font-size: ${19 / TEXT_BASE_SIZE}rem;
|
|
17560
|
-
${
|
|
17561
|
-
|
|
17562
|
-
|
|
17563
|
-
border-radius: ${10 / TEXT_BASE_SIZE}rem;
|
|
17564
|
-
`}
|
|
17566
|
+
height: ${64 / TEXT_BASE_SIZE}rem;
|
|
17567
|
+
padding: ${9 / TEXT_BASE_SIZE}rem ${28 / TEXT_BASE_SIZE}rem;
|
|
17568
|
+
border-radius: ${10 / TEXT_BASE_SIZE}rem;
|
|
17565
17569
|
`;
|
|
17566
17570
|
}
|
|
17567
17571
|
}}
|
|
@@ -18466,7 +18470,7 @@ import {
|
|
|
18466
18470
|
useCallback as useCallback8,
|
|
18467
18471
|
useEffect as useEffect4,
|
|
18468
18472
|
useLayoutEffect as useLayoutEffect4,
|
|
18469
|
-
useMemo as
|
|
18473
|
+
useMemo as useMemo6,
|
|
18470
18474
|
useRef as useRef5,
|
|
18471
18475
|
useState as useState8
|
|
18472
18476
|
} from "react";
|
|
@@ -18589,7 +18593,8 @@ var StageButton = ({
|
|
|
18589
18593
|
isLoading,
|
|
18590
18594
|
requiresPayment,
|
|
18591
18595
|
setCheckoutStage,
|
|
18592
|
-
trialPaymentMethodRequired
|
|
18596
|
+
trialPaymentMethodRequired,
|
|
18597
|
+
willTrial
|
|
18593
18598
|
}) => {
|
|
18594
18599
|
const { t: t2 } = useTranslation();
|
|
18595
18600
|
const NoPaymentRequired = () => {
|
|
@@ -18605,42 +18610,14 @@ var StageButton = ({
|
|
|
18605
18610
|
);
|
|
18606
18611
|
};
|
|
18607
18612
|
if (checkoutStage === "plan") {
|
|
18608
|
-
if (canTrial) {
|
|
18609
|
-
if (trialPaymentMethodRequired) {
|
|
18610
|
-
return /* @__PURE__ */ jsx12(
|
|
18611
|
-
Button,
|
|
18612
|
-
{
|
|
18613
|
-
type: "button",
|
|
18614
|
-
disabled: !hasAddOns && !canUpdateSubscription,
|
|
18615
|
-
onClick: async () => {
|
|
18616
|
-
setCheckoutStage?.("checkout");
|
|
18617
|
-
},
|
|
18618
|
-
$isLoading: isLoading,
|
|
18619
|
-
children: /* @__PURE__ */ jsxs7(
|
|
18620
|
-
Flex,
|
|
18621
|
-
{
|
|
18622
|
-
$gap: "0.5rem",
|
|
18623
|
-
$justifyContent: "center",
|
|
18624
|
-
$alignItems: "center",
|
|
18625
|
-
$padding: "0 1rem",
|
|
18626
|
-
children: [
|
|
18627
|
-
t2("Next"),
|
|
18628
|
-
": ",
|
|
18629
|
-
t2("Checkout"),
|
|
18630
|
-
/* @__PURE__ */ jsx12(Icon2, { name: "arrow-right" })
|
|
18631
|
-
]
|
|
18632
|
-
}
|
|
18633
|
-
)
|
|
18634
|
-
}
|
|
18635
|
-
);
|
|
18636
|
-
}
|
|
18613
|
+
if (canTrial && trialPaymentMethodRequired) {
|
|
18637
18614
|
return /* @__PURE__ */ jsx12(
|
|
18638
18615
|
Button,
|
|
18639
18616
|
{
|
|
18640
18617
|
type: "button",
|
|
18641
|
-
disabled: !
|
|
18618
|
+
disabled: !hasAddOns && !canUpdateSubscription,
|
|
18642
18619
|
onClick: async () => {
|
|
18643
|
-
checkout
|
|
18620
|
+
setCheckoutStage?.("checkout");
|
|
18644
18621
|
},
|
|
18645
18622
|
$isLoading: isLoading,
|
|
18646
18623
|
children: /* @__PURE__ */ jsxs7(
|
|
@@ -18651,7 +18628,9 @@ var StageButton = ({
|
|
|
18651
18628
|
$alignItems: "center",
|
|
18652
18629
|
$padding: "0 1rem",
|
|
18653
18630
|
children: [
|
|
18654
|
-
t2("
|
|
18631
|
+
t2("Next"),
|
|
18632
|
+
": ",
|
|
18633
|
+
t2("Checkout"),
|
|
18655
18634
|
/* @__PURE__ */ jsx12(Icon2, { name: "arrow-right" })
|
|
18656
18635
|
]
|
|
18657
18636
|
}
|
|
@@ -18660,7 +18639,7 @@ var StageButton = ({
|
|
|
18660
18639
|
);
|
|
18661
18640
|
}
|
|
18662
18641
|
if (!requiresPayment && !checkoutStages?.some(
|
|
18663
|
-
(stage) => stage.id === "
|
|
18642
|
+
(stage) => stage.id === "usage" || stage.id === "addons"
|
|
18664
18643
|
)) {
|
|
18665
18644
|
return /* @__PURE__ */ jsx12(NoPaymentRequired, {});
|
|
18666
18645
|
}
|
|
@@ -18686,7 +18665,7 @@ var StageButton = ({
|
|
|
18686
18665
|
);
|
|
18687
18666
|
}
|
|
18688
18667
|
if (checkoutStage === "usage") {
|
|
18689
|
-
if (!requiresPayment) {
|
|
18668
|
+
if (!requiresPayment && !checkoutStages?.some((stage) => stage.id === "addons")) {
|
|
18690
18669
|
return /* @__PURE__ */ jsx12(NoPaymentRequired, {});
|
|
18691
18670
|
}
|
|
18692
18671
|
return /* @__PURE__ */ jsx12(
|
|
@@ -18758,7 +18737,7 @@ var StageButton = ({
|
|
|
18758
18737
|
disabled: isLoading || !hasUnstagedChanges || !canCheckout,
|
|
18759
18738
|
onClick: checkout,
|
|
18760
18739
|
$isLoading: isLoading,
|
|
18761
|
-
children:
|
|
18740
|
+
children: willTrial ? t2("Start trial") : t2("Pay now")
|
|
18762
18741
|
}
|
|
18763
18742
|
);
|
|
18764
18743
|
}
|
|
@@ -18784,7 +18763,8 @@ var Sidebar = ({
|
|
|
18784
18763
|
setError,
|
|
18785
18764
|
setIsLoading,
|
|
18786
18765
|
updatePromoCode,
|
|
18787
|
-
showHeader = true
|
|
18766
|
+
showHeader = true,
|
|
18767
|
+
willTrial = false
|
|
18788
18768
|
}) => {
|
|
18789
18769
|
const { t: t2 } = useTranslation();
|
|
18790
18770
|
const theme = nt();
|
|
@@ -18914,10 +18894,10 @@ var Sidebar = ({
|
|
|
18914
18894
|
...promoCode && { promoCode }
|
|
18915
18895
|
}
|
|
18916
18896
|
});
|
|
18917
|
-
dispatchPlanChangedEvent(response.data);
|
|
18918
18897
|
setIsLoading(false);
|
|
18919
18898
|
setLayout("portal");
|
|
18920
|
-
hydrate();
|
|
18899
|
+
await hydrate();
|
|
18900
|
+
dispatchPlanChangedEvent(response.data);
|
|
18921
18901
|
} catch {
|
|
18922
18902
|
setLayout("checkout");
|
|
18923
18903
|
setError(
|
|
@@ -19015,6 +18995,7 @@ var Sidebar = ({
|
|
|
19015
18995
|
currentUsageBasedEntitlements,
|
|
19016
18996
|
usageBasedEntitlements
|
|
19017
18997
|
]);
|
|
18998
|
+
const willPeriodChange = planPeriod !== data.company?.plan?.planPeriod;
|
|
19018
18999
|
const willPlanChange = typeof selectedPlan !== "undefined" && !selectedPlan.current;
|
|
19019
19000
|
const removedAddOns = currentAddOns.filter(
|
|
19020
19001
|
(current) => !selectedAddOns.some((selected) => current.id === selected.id) && current.planPeriod !== "one-time"
|
|
@@ -19024,10 +19005,10 @@ var Sidebar = ({
|
|
|
19024
19005
|
);
|
|
19025
19006
|
const willAddOnsChange = removedAddOns.length > 0 || addedAddOns.length > 0;
|
|
19026
19007
|
const willPayInAdvanceEntitlementsChange = payInAdvanceEntitlements.length > 0 && payInAdvanceEntitlements.some(({ quantity, usage }) => quantity !== usage);
|
|
19027
|
-
const hasUnstagedChanges = willPlanChange || willAddOnsChange || willPayInAdvanceEntitlementsChange;
|
|
19008
|
+
const hasUnstagedChanges = willPeriodChange || willPlanChange || willAddOnsChange || willPayInAdvanceEntitlementsChange;
|
|
19028
19009
|
const canUpdateSubscription = mode === "edit" || api !== null && !isLoading;
|
|
19029
19010
|
const canCheckout = canUpdateSubscription && (!!data.subscription?.paymentMethod || typeof paymentMethodId === "string");
|
|
19030
|
-
const isTrialable = selectedPlan?.companyCanTrial;
|
|
19011
|
+
const isTrialable = selectedPlan?.companyCanTrial === true;
|
|
19031
19012
|
const today = /* @__PURE__ */ new Date();
|
|
19032
19013
|
const trialEndsOn = new Date(today);
|
|
19033
19014
|
if (isTrialable && selectedPlan.trialDays) {
|
|
@@ -19103,7 +19084,7 @@ var Sidebar = ({
|
|
|
19103
19084
|
}
|
|
19104
19085
|
) }),
|
|
19105
19086
|
/* @__PURE__ */ jsxs8(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
|
|
19106
|
-
|
|
19087
|
+
currentPlan && /* @__PURE__ */ jsxs8(
|
|
19107
19088
|
Flex,
|
|
19108
19089
|
{
|
|
19109
19090
|
$justifyContent: "space-between",
|
|
@@ -19122,10 +19103,10 @@ var Sidebar = ({
|
|
|
19122
19103
|
$size: theme.typography.heading4.fontSize,
|
|
19123
19104
|
$weight: theme.typography.heading4.fontWeight,
|
|
19124
19105
|
$color: theme.typography.heading4.color,
|
|
19125
|
-
children:
|
|
19106
|
+
children: currentPlan.name
|
|
19126
19107
|
}
|
|
19127
19108
|
) }),
|
|
19128
|
-
typeof
|
|
19109
|
+
typeof currentPlan.planPrice === "number" && /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs8(
|
|
19129
19110
|
Text,
|
|
19130
19111
|
{
|
|
19131
19112
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19134,14 +19115,12 @@ var Sidebar = ({
|
|
|
19134
19115
|
$color: theme.typography.text.color,
|
|
19135
19116
|
children: [
|
|
19136
19117
|
formatCurrency(
|
|
19137
|
-
|
|
19138
|
-
data.company
|
|
19118
|
+
currentPlan.planPrice,
|
|
19119
|
+
data.company?.billingSubscription?.currency
|
|
19139
19120
|
),
|
|
19140
19121
|
/* @__PURE__ */ jsxs8("sub", { children: [
|
|
19141
19122
|
"/",
|
|
19142
|
-
shortenPeriod(
|
|
19143
|
-
data.company.plan.planPeriod || planPeriod
|
|
19144
|
-
)
|
|
19123
|
+
shortenPeriod(currentPlan.planPeriod || planPeriod)
|
|
19145
19124
|
] })
|
|
19146
19125
|
]
|
|
19147
19126
|
}
|
|
@@ -19907,7 +19886,7 @@ var Sidebar = ({
|
|
|
19907
19886
|
layout === "checkout" && /* @__PURE__ */ jsx13(
|
|
19908
19887
|
StageButton,
|
|
19909
19888
|
{
|
|
19910
|
-
canTrial:
|
|
19889
|
+
canTrial: isTrialable,
|
|
19911
19890
|
canCheckout,
|
|
19912
19891
|
canUpdateSubscription,
|
|
19913
19892
|
checkout,
|
|
@@ -19919,7 +19898,8 @@ var Sidebar = ({
|
|
|
19919
19898
|
isLoading,
|
|
19920
19899
|
requiresPayment,
|
|
19921
19900
|
setCheckoutStage,
|
|
19922
|
-
trialPaymentMethodRequired: data.trialPaymentMethodRequired === true
|
|
19901
|
+
trialPaymentMethodRequired: data.trialPaymentMethodRequired === true,
|
|
19902
|
+
willTrial
|
|
19923
19903
|
}
|
|
19924
19904
|
),
|
|
19925
19905
|
layout === "unsubscribe" && /* @__PURE__ */ jsx13(Button, { onClick: unsubscribe, $isLoading: isLoading, children: t2("Cancel subscription") }),
|
|
@@ -20229,13 +20209,11 @@ var Navigation = ({
|
|
|
20229
20209
|
}
|
|
20230
20210
|
),
|
|
20231
20211
|
/* @__PURE__ */ jsxs11(
|
|
20232
|
-
|
|
20212
|
+
Text,
|
|
20233
20213
|
{
|
|
20214
|
+
as: Box,
|
|
20234
20215
|
tabIndex: 0,
|
|
20235
|
-
$
|
|
20236
|
-
$fontFamily: theme.typography.text.fontFamily,
|
|
20237
|
-
$fontWeight: index === activeIndex ? 600 : 400,
|
|
20238
|
-
$color: theme.typography.text.color,
|
|
20216
|
+
$weight: index === activeIndex ? 600 : 400,
|
|
20239
20217
|
...!showFullContent && {
|
|
20240
20218
|
$overflow: "hidden",
|
|
20241
20219
|
$whiteSpace: "nowrap",
|
|
@@ -20275,7 +20253,7 @@ var Navigation = ({
|
|
|
20275
20253
|
};
|
|
20276
20254
|
|
|
20277
20255
|
// src/components/shared/checkout-dialog/Plan.tsx
|
|
20278
|
-
import { useState as useState7 } from "react";
|
|
20256
|
+
import { useMemo as useMemo5, useState as useState7 } from "react";
|
|
20279
20257
|
|
|
20280
20258
|
// src/components/elements/pricing-table/styles.ts
|
|
20281
20259
|
var ButtonLink = dt.a`
|
|
@@ -20288,15 +20266,162 @@ var ButtonLink = dt.a`
|
|
|
20288
20266
|
|
|
20289
20267
|
// src/components/shared/checkout-dialog/Plan.tsx
|
|
20290
20268
|
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
20269
|
+
var Selected = ({ isCurrent = false, isTrial = false }) => {
|
|
20270
|
+
const { t: t2 } = useTranslation();
|
|
20271
|
+
const theme = nt();
|
|
20272
|
+
const text = useMemo5(() => {
|
|
20273
|
+
if (isCurrent) {
|
|
20274
|
+
return isTrial ? t2("Trial in progress") : t2("Current plan");
|
|
20275
|
+
}
|
|
20276
|
+
return isTrial ? t2("Trial selected") : t2("Plan selected");
|
|
20277
|
+
}, [t2, isCurrent, isTrial]);
|
|
20278
|
+
return /* @__PURE__ */ jsxs12(
|
|
20279
|
+
Flex,
|
|
20280
|
+
{
|
|
20281
|
+
$justifyContent: "center",
|
|
20282
|
+
$alignItems: "center",
|
|
20283
|
+
$gap: "0.25rem",
|
|
20284
|
+
$padding: "0.625rem 0",
|
|
20285
|
+
children: [
|
|
20286
|
+
/* @__PURE__ */ jsx17(
|
|
20287
|
+
Icon2,
|
|
20288
|
+
{
|
|
20289
|
+
name: "check-rounded",
|
|
20290
|
+
style: {
|
|
20291
|
+
fontSize: 20,
|
|
20292
|
+
lineHeight: 1,
|
|
20293
|
+
color: theme.primary
|
|
20294
|
+
}
|
|
20295
|
+
}
|
|
20296
|
+
),
|
|
20297
|
+
/* @__PURE__ */ jsx17(
|
|
20298
|
+
Text,
|
|
20299
|
+
{
|
|
20300
|
+
$font: theme.typography.text.fontFamily,
|
|
20301
|
+
$size: 15 / 16 * theme.typography.text.fontSize,
|
|
20302
|
+
$weight: theme.typography.text.fontWeight,
|
|
20303
|
+
$color: theme.typography.text.color,
|
|
20304
|
+
$leading: 1,
|
|
20305
|
+
children: text
|
|
20306
|
+
}
|
|
20307
|
+
)
|
|
20308
|
+
]
|
|
20309
|
+
}
|
|
20310
|
+
);
|
|
20311
|
+
};
|
|
20312
|
+
var PlanButtonGroup = ({
|
|
20313
|
+
plan,
|
|
20314
|
+
isLoading,
|
|
20315
|
+
isSelected,
|
|
20316
|
+
onSelect,
|
|
20317
|
+
willTrial
|
|
20318
|
+
}) => {
|
|
20319
|
+
const { t: t2 } = useTranslation();
|
|
20320
|
+
const { data } = useEmbed();
|
|
20321
|
+
const isCurrent = plan.id === data.company?.plan?.id;
|
|
20322
|
+
if (plan.companyCanTrial) {
|
|
20323
|
+
return /* @__PURE__ */ jsxs12(Flex, { $flexDirection: "column", $gap: "1.5rem", children: [
|
|
20324
|
+
data.subscription?.status !== "trialing" && /* @__PURE__ */ jsx17(Fragment8, { children: isSelected && willTrial ? /* @__PURE__ */ jsx17(
|
|
20325
|
+
Selected,
|
|
20326
|
+
{
|
|
20327
|
+
isCurrent,
|
|
20328
|
+
isTrial: plan.companyCanTrial && willTrial
|
|
20329
|
+
}
|
|
20330
|
+
) : /* @__PURE__ */ jsx17(
|
|
20331
|
+
Button,
|
|
20332
|
+
{
|
|
20333
|
+
type: "button",
|
|
20334
|
+
disabled: (isLoading || !plan.valid) && !plan.custom,
|
|
20335
|
+
...!plan.custom && {
|
|
20336
|
+
onClick: () => {
|
|
20337
|
+
onSelect({
|
|
20338
|
+
plan,
|
|
20339
|
+
shouldTrial: true
|
|
20340
|
+
});
|
|
20341
|
+
}
|
|
20342
|
+
},
|
|
20343
|
+
$size: "sm",
|
|
20344
|
+
$color: "primary",
|
|
20345
|
+
$variant: "filled",
|
|
20346
|
+
children: plan.custom ? /* @__PURE__ */ jsx17(
|
|
20347
|
+
ButtonLink,
|
|
20348
|
+
{
|
|
20349
|
+
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
20350
|
+
target: "_blank",
|
|
20351
|
+
children: plan.customPlanConfig?.ctaText ?? t2("Talk to support")
|
|
20352
|
+
}
|
|
20353
|
+
) : !plan.valid ? /* @__PURE__ */ jsx17(
|
|
20354
|
+
Tooltip,
|
|
20355
|
+
{
|
|
20356
|
+
trigger: t2("Over usage limit"),
|
|
20357
|
+
content: t2("Current usage exceeds the limit of this plan.")
|
|
20358
|
+
}
|
|
20359
|
+
) : t2("Start X day trial", { days: plan.trialDays })
|
|
20360
|
+
}
|
|
20361
|
+
) }),
|
|
20362
|
+
!plan.custom && /* @__PURE__ */ jsx17(Fragment8, { children: isSelected && (!willTrial || data.subscription?.status === "trialing") ? /* @__PURE__ */ jsx17(Selected, { isCurrent }) : /* @__PURE__ */ jsx17(
|
|
20363
|
+
Button,
|
|
20364
|
+
{
|
|
20365
|
+
type: "button",
|
|
20366
|
+
disabled: isLoading || !plan.valid,
|
|
20367
|
+
onClick: () => {
|
|
20368
|
+
onSelect({ plan, shouldTrial: false });
|
|
20369
|
+
},
|
|
20370
|
+
$size: "sm",
|
|
20371
|
+
$color: "primary",
|
|
20372
|
+
$variant: data.subscription?.status === "trialing" ? "filled" : "text",
|
|
20373
|
+
children: !plan.valid ? /* @__PURE__ */ jsx17(
|
|
20374
|
+
Tooltip,
|
|
20375
|
+
{
|
|
20376
|
+
trigger: t2("Over usage limit"),
|
|
20377
|
+
content: t2("Current usage exceeds the limit of this plan.")
|
|
20378
|
+
}
|
|
20379
|
+
) : t2("Choose plan")
|
|
20380
|
+
}
|
|
20381
|
+
) })
|
|
20382
|
+
] });
|
|
20383
|
+
}
|
|
20384
|
+
return isSelected ? /* @__PURE__ */ jsx17(Selected, { isCurrent }) : /* @__PURE__ */ jsx17(
|
|
20385
|
+
Button,
|
|
20386
|
+
{
|
|
20387
|
+
type: "button",
|
|
20388
|
+
disabled: (isLoading || !plan.valid) && !plan.custom,
|
|
20389
|
+
...!plan.custom && {
|
|
20390
|
+
onClick: () => {
|
|
20391
|
+
onSelect({ plan });
|
|
20392
|
+
}
|
|
20393
|
+
},
|
|
20394
|
+
$size: "sm",
|
|
20395
|
+
$color: "primary",
|
|
20396
|
+
$variant: "filled",
|
|
20397
|
+
children: plan.custom ? /* @__PURE__ */ jsx17(
|
|
20398
|
+
ButtonLink,
|
|
20399
|
+
{
|
|
20400
|
+
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
20401
|
+
target: "_blank",
|
|
20402
|
+
children: plan.customPlanConfig?.ctaText ?? t2("Talk to support")
|
|
20403
|
+
}
|
|
20404
|
+
) : !plan.valid ? /* @__PURE__ */ jsx17(
|
|
20405
|
+
Tooltip,
|
|
20406
|
+
{
|
|
20407
|
+
trigger: t2("Over usage limit"),
|
|
20408
|
+
content: t2("Current usage exceeds the limit of this plan.")
|
|
20409
|
+
}
|
|
20410
|
+
) : t2("Choose plan")
|
|
20411
|
+
}
|
|
20412
|
+
);
|
|
20413
|
+
};
|
|
20291
20414
|
var Plan = ({
|
|
20292
20415
|
isLoading,
|
|
20293
20416
|
plans,
|
|
20294
20417
|
selectedPlan,
|
|
20295
20418
|
period,
|
|
20296
|
-
selectPlan
|
|
20419
|
+
selectPlan,
|
|
20420
|
+
willTrial
|
|
20297
20421
|
}) => {
|
|
20298
20422
|
const { t: t2 } = useTranslation();
|
|
20299
20423
|
const theme = nt();
|
|
20424
|
+
const { data } = useEmbed();
|
|
20300
20425
|
const isLightBackground = useIsLightBackground();
|
|
20301
20426
|
const [entitlementCounts, setEntitlementCounts] = useState7(
|
|
20302
20427
|
() => plans.reduce(
|
|
@@ -20310,7 +20435,6 @@ var Plan = ({
|
|
|
20310
20435
|
{}
|
|
20311
20436
|
)
|
|
20312
20437
|
);
|
|
20313
|
-
const cardPadding = theme.card.padding / TEXT_BASE_SIZE;
|
|
20314
20438
|
const handleToggleShowAll = (id) => {
|
|
20315
20439
|
setEntitlementCounts((prev2) => {
|
|
20316
20440
|
const count = { ...prev2[id] };
|
|
@@ -20323,6 +20447,7 @@ var Plan = ({
|
|
|
20323
20447
|
};
|
|
20324
20448
|
});
|
|
20325
20449
|
};
|
|
20450
|
+
const cardPadding = theme.card.padding / TEXT_BASE_SIZE;
|
|
20326
20451
|
return /* @__PURE__ */ jsx17(Fragment8, { children: /* @__PURE__ */ jsx17(
|
|
20327
20452
|
Box,
|
|
20328
20453
|
{
|
|
@@ -20431,7 +20556,7 @@ var Plan = ({
|
|
|
20431
20556
|
$size: 0.75 * theme.typography.text.fontSize,
|
|
20432
20557
|
$weight: theme.typography.text.fontWeight,
|
|
20433
20558
|
$color: hexToHSL(theme.primary).l > 50 ? "#000000" : "#FFFFFF",
|
|
20434
|
-
children: t2("Active")
|
|
20559
|
+
children: data.subscription?.status === "trialing" ? t2("Trialing") : t2("Active")
|
|
20435
20560
|
}
|
|
20436
20561
|
)
|
|
20437
20562
|
}
|
|
@@ -20646,70 +20771,14 @@ var Plan = ({
|
|
|
20646
20771
|
}
|
|
20647
20772
|
)
|
|
20648
20773
|
] }),
|
|
20649
|
-
|
|
20650
|
-
|
|
20774
|
+
/* @__PURE__ */ jsx17(
|
|
20775
|
+
PlanButtonGroup,
|
|
20651
20776
|
{
|
|
20652
|
-
|
|
20653
|
-
|
|
20654
|
-
|
|
20655
|
-
|
|
20656
|
-
|
|
20657
|
-
/* @__PURE__ */ jsx17(
|
|
20658
|
-
Icon2,
|
|
20659
|
-
{
|
|
20660
|
-
name: "check-rounded",
|
|
20661
|
-
style: {
|
|
20662
|
-
fontSize: 20,
|
|
20663
|
-
lineHeight: 1,
|
|
20664
|
-
color: theme.primary
|
|
20665
|
-
}
|
|
20666
|
-
}
|
|
20667
|
-
),
|
|
20668
|
-
/* @__PURE__ */ jsx17(
|
|
20669
|
-
Text,
|
|
20670
|
-
{
|
|
20671
|
-
$font: theme.typography.text.fontFamily,
|
|
20672
|
-
$size: 15 / 16 * theme.typography.text.fontSize,
|
|
20673
|
-
$weight: theme.typography.text.fontWeight,
|
|
20674
|
-
$color: theme.typography.text.color,
|
|
20675
|
-
$leading: 1,
|
|
20676
|
-
children: plan.current ? t2("Current plan") : t2("Selected")
|
|
20677
|
-
}
|
|
20678
|
-
)
|
|
20679
|
-
]
|
|
20680
|
-
}
|
|
20681
|
-
) : /* @__PURE__ */ jsx17(
|
|
20682
|
-
Button,
|
|
20683
|
-
{
|
|
20684
|
-
type: "button",
|
|
20685
|
-
disabled: (isLoading || !plan.valid) && !plan.custom,
|
|
20686
|
-
...{
|
|
20687
|
-
onClick: () => {
|
|
20688
|
-
if (plan.custom) {
|
|
20689
|
-
return;
|
|
20690
|
-
}
|
|
20691
|
-
selectPlan({ plan });
|
|
20692
|
-
}
|
|
20693
|
-
},
|
|
20694
|
-
$size: "sm",
|
|
20695
|
-
$color: "primary",
|
|
20696
|
-
$variant: plan.current ? "outline" : "filled",
|
|
20697
|
-
children: plan.custom ? /* @__PURE__ */ jsx17(
|
|
20698
|
-
ButtonLink,
|
|
20699
|
-
{
|
|
20700
|
-
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
20701
|
-
target: "_blank",
|
|
20702
|
-
children: plan.customPlanConfig?.ctaText ?? t2("Talk to support")
|
|
20703
|
-
}
|
|
20704
|
-
) : !plan.valid ? /* @__PURE__ */ jsx17(
|
|
20705
|
-
Tooltip,
|
|
20706
|
-
{
|
|
20707
|
-
trigger: t2("Over usage limit"),
|
|
20708
|
-
content: t2(
|
|
20709
|
-
"Current usage exceeds the limit of this plan."
|
|
20710
|
-
)
|
|
20711
|
-
}
|
|
20712
|
-
) : plan.companyCanTrial ? t2("Trial plan", { days: plan.trialDays }) : t2("Choose plan")
|
|
20777
|
+
plan,
|
|
20778
|
+
isLoading,
|
|
20779
|
+
isSelected: plan.id === selectedPlan?.id,
|
|
20780
|
+
onSelect: selectPlan,
|
|
20781
|
+
willTrial
|
|
20713
20782
|
}
|
|
20714
20783
|
)
|
|
20715
20784
|
]
|
|
@@ -20924,7 +20993,6 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
20924
20993
|
);
|
|
20925
20994
|
const [isLoading, setIsLoading] = useState8(false);
|
|
20926
20995
|
const [error, setError] = useState8();
|
|
20927
|
-
const [promoCode, setPromoCode] = useState8();
|
|
20928
20996
|
const [planPeriod, setPlanPeriod] = useState8(
|
|
20929
20997
|
selected.period || data.company?.plan?.planPeriod || "month"
|
|
20930
20998
|
);
|
|
@@ -20938,6 +21006,9 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
20938
21006
|
(plan) => selected.planId ? plan.id === selected.planId : plan.current
|
|
20939
21007
|
)
|
|
20940
21008
|
);
|
|
21009
|
+
const [willTrial, setWillTrial] = useState8(
|
|
21010
|
+
data.subscription?.status !== "trialing" && !data.trialPaymentMethodRequired
|
|
21011
|
+
);
|
|
20941
21012
|
const [addOns, setAddOns] = useState8(
|
|
20942
21013
|
() => availableAddOns.map((addOn) => ({
|
|
20943
21014
|
...addOn,
|
|
@@ -20946,7 +21017,8 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
20946
21017
|
)
|
|
20947
21018
|
}))
|
|
20948
21019
|
);
|
|
20949
|
-
const
|
|
21020
|
+
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected);
|
|
21021
|
+
const currentEntitlements = useMemo6(() => {
|
|
20950
21022
|
return data.featureUsage?.features || [];
|
|
20951
21023
|
}, [data.featureUsage?.features]);
|
|
20952
21024
|
const [usageBasedEntitlements, setUsageBasedEntitlements] = useState8(
|
|
@@ -20958,18 +21030,21 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
20958
21030
|
[]
|
|
20959
21031
|
)
|
|
20960
21032
|
);
|
|
20961
|
-
const payInAdvanceEntitlements =
|
|
21033
|
+
const payInAdvanceEntitlements = useMemo6(
|
|
20962
21034
|
() => usageBasedEntitlements.filter(
|
|
20963
21035
|
(entitlement) => entitlement.priceBehavior === "pay_in_advance"
|
|
20964
21036
|
),
|
|
20965
21037
|
[usageBasedEntitlements]
|
|
20966
21038
|
);
|
|
20967
|
-
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected);
|
|
20968
21039
|
const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
|
|
20969
21040
|
({ quantity }) => quantity > 0
|
|
20970
21041
|
);
|
|
20971
|
-
const
|
|
20972
|
-
const
|
|
21042
|
+
const [promoCode, setPromoCode] = useState8();
|
|
21043
|
+
const isTrialable = selectedPlan?.isTrialable === true && selectedPlan?.companyCanTrial === true;
|
|
21044
|
+
const isTrialableAndFree = isTrialable && data.trialPaymentMethodRequired !== true;
|
|
21045
|
+
const planRequiresPayment = !isTrialableAndFree || !isTrialable && selectedPlan?.isFree !== true;
|
|
21046
|
+
const requiresPayment = planRequiresPayment || hasActiveAddOns || hasActivePayInAdvanceEntitlements;
|
|
21047
|
+
const checkoutStages = useMemo6(() => {
|
|
20973
21048
|
const stages = [
|
|
20974
21049
|
{
|
|
20975
21050
|
id: "plan",
|
|
@@ -20978,13 +21053,16 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
20978
21053
|
description: t2("Choose your base plan")
|
|
20979
21054
|
}
|
|
20980
21055
|
];
|
|
20981
|
-
if (
|
|
21056
|
+
if (willTrial) {
|
|
21057
|
+
return stages;
|
|
21058
|
+
}
|
|
21059
|
+
if (payInAdvanceEntitlements.length > 0) {
|
|
20982
21060
|
stages.push({
|
|
20983
21061
|
id: "usage",
|
|
20984
21062
|
name: t2("Quantity")
|
|
20985
21063
|
});
|
|
20986
21064
|
}
|
|
20987
|
-
if (availableAddOns.length
|
|
21065
|
+
if (availableAddOns.length > 0) {
|
|
20988
21066
|
stages.push({
|
|
20989
21067
|
id: "addons",
|
|
20990
21068
|
name: t2("Add-ons"),
|
|
@@ -21002,9 +21080,9 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
21002
21080
|
return stages;
|
|
21003
21081
|
}, [
|
|
21004
21082
|
t2,
|
|
21083
|
+
willTrial,
|
|
21005
21084
|
payInAdvanceEntitlements,
|
|
21006
21085
|
availableAddOns,
|
|
21007
|
-
selectedPlan?.companyCanTrial,
|
|
21008
21086
|
requiresPayment
|
|
21009
21087
|
]);
|
|
21010
21088
|
const [checkoutStage, setCheckoutStage] = useState8(() => {
|
|
@@ -21109,6 +21187,8 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
21109
21187
|
setSelectedPlan(plan);
|
|
21110
21188
|
setUsageBasedEntitlements(entitlements);
|
|
21111
21189
|
}
|
|
21190
|
+
const shouldTrial = updates.shouldTrial ?? false;
|
|
21191
|
+
setWillTrial(shouldTrial && !data.trialPaymentMethodRequired);
|
|
21112
21192
|
previewCheckout({
|
|
21113
21193
|
period,
|
|
21114
21194
|
plan: updates.plan,
|
|
@@ -21117,7 +21197,13 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
21117
21197
|
)
|
|
21118
21198
|
});
|
|
21119
21199
|
},
|
|
21120
|
-
[
|
|
21200
|
+
[
|
|
21201
|
+
data.trialPaymentMethodRequired,
|
|
21202
|
+
planPeriod,
|
|
21203
|
+
selectedPlan,
|
|
21204
|
+
currentEntitlements,
|
|
21205
|
+
previewCheckout
|
|
21206
|
+
]
|
|
21121
21207
|
);
|
|
21122
21208
|
const changePlanPeriod = useCallback8(
|
|
21123
21209
|
(period) => {
|
|
@@ -21314,7 +21400,8 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
21314
21400
|
period: planPeriod,
|
|
21315
21401
|
plans: availablePlans,
|
|
21316
21402
|
selectedPlan,
|
|
21317
|
-
selectPlan
|
|
21403
|
+
selectPlan,
|
|
21404
|
+
willTrial
|
|
21318
21405
|
}
|
|
21319
21406
|
),
|
|
21320
21407
|
checkoutStage === "usage" && /* @__PURE__ */ jsx19(
|
|
@@ -21366,7 +21453,8 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
21366
21453
|
setCheckoutStage: (stage) => setCheckoutStage(stage),
|
|
21367
21454
|
setError: (msg) => setError(msg),
|
|
21368
21455
|
setIsLoading,
|
|
21369
|
-
updatePromoCode: (code) => updatePromoCode(code)
|
|
21456
|
+
updatePromoCode: (code) => updatePromoCode(code),
|
|
21457
|
+
willTrial
|
|
21370
21458
|
}
|
|
21371
21459
|
)
|
|
21372
21460
|
]
|
|
@@ -21495,7 +21583,7 @@ var PaymentForm = ({ onConfirm }) => {
|
|
|
21495
21583
|
};
|
|
21496
21584
|
|
|
21497
21585
|
// src/components/shared/period-toggle/PeriodToggle.tsx
|
|
21498
|
-
import { useLayoutEffect as useLayoutEffect5, useMemo as
|
|
21586
|
+
import { useLayoutEffect as useLayoutEffect5, useMemo as useMemo7, useState as useState10 } from "react";
|
|
21499
21587
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
21500
21588
|
var PeriodToggle = ({
|
|
21501
21589
|
options: options2,
|
|
@@ -21508,7 +21596,7 @@ var PeriodToggle = ({
|
|
|
21508
21596
|
const theme = nt();
|
|
21509
21597
|
const isLightBackground = useIsLightBackground();
|
|
21510
21598
|
const [tooltipZIndex, setTooltipZIndex] = useState10(1);
|
|
21511
|
-
const savingsPercentage =
|
|
21599
|
+
const savingsPercentage = useMemo7(() => {
|
|
21512
21600
|
if (selectedPlan) {
|
|
21513
21601
|
const monthlyBillingPrice = getBillingPrice(selectedPlan?.monthlyPrice);
|
|
21514
21602
|
const yearlyBillingPrice = getBillingPrice(selectedPlan?.yearlyPrice);
|
|
@@ -21608,7 +21696,7 @@ var PeriodToggle = ({
|
|
|
21608
21696
|
};
|
|
21609
21697
|
|
|
21610
21698
|
// src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
|
|
21611
|
-
import { useCallback as useCallback9, useMemo as
|
|
21699
|
+
import { useCallback as useCallback9, useMemo as useMemo8, useRef as useRef6, useState as useState11 } from "react";
|
|
21612
21700
|
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
21613
21701
|
var UnsubscribeDialog = ({ top = 0 }) => {
|
|
21614
21702
|
const { t: t2 } = useTranslation();
|
|
@@ -21617,12 +21705,12 @@ var UnsubscribeDialog = ({ top = 0 }) => {
|
|
|
21617
21705
|
const contentRef = useRef6(null);
|
|
21618
21706
|
const [error, setError] = useState11();
|
|
21619
21707
|
const [isLoading, setIsLoading] = useState11(false);
|
|
21620
|
-
const planPeriod =
|
|
21708
|
+
const planPeriod = useMemo8(
|
|
21621
21709
|
() => data.company?.plan?.planPeriod ?? "month",
|
|
21622
21710
|
[data.company?.plan?.planPeriod]
|
|
21623
21711
|
);
|
|
21624
21712
|
const { plans: availablePlans, addOns: availableAddOns } = useAvailablePlans(planPeriod);
|
|
21625
|
-
const selectedPlan =
|
|
21713
|
+
const selectedPlan = useMemo8(
|
|
21626
21714
|
() => availablePlans.find(
|
|
21627
21715
|
(plan) => plan.id === data.company?.plan?.id && data.company?.plan.planPeriod === planPeriod
|
|
21628
21716
|
),
|
|
@@ -21633,7 +21721,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
|
|
|
21633
21721
|
createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
|
|
21634
21722
|
[]
|
|
21635
21723
|
);
|
|
21636
|
-
const addOns =
|
|
21724
|
+
const addOns = useMemo8(
|
|
21637
21725
|
() => availableAddOns.map((available) => ({
|
|
21638
21726
|
...available,
|
|
21639
21727
|
isSelected: data.company?.addOns.some((current) => available.id === current.id) ?? false
|
|
@@ -22070,10 +22158,10 @@ var ButtonElement = forwardRef6(({ children, className, ...rest }, ref) => {
|
|
|
22070
22158
|
ButtonElement.displayName = "Button";
|
|
22071
22159
|
|
|
22072
22160
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
22073
|
-
import { forwardRef as forwardRef7, useMemo as
|
|
22161
|
+
import { forwardRef as forwardRef7, useMemo as useMemo10, useRef as useRef7, useState as useState13 } from "react";
|
|
22074
22162
|
|
|
22075
22163
|
// src/components/elements/included-features/Details.tsx
|
|
22076
|
-
import { Fragment as Fragment11, useMemo as
|
|
22164
|
+
import { Fragment as Fragment11, useMemo as useMemo9 } from "react";
|
|
22077
22165
|
import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
22078
22166
|
var Details = ({
|
|
22079
22167
|
shouldWrapChildren,
|
|
@@ -22098,7 +22186,7 @@ var Details = ({
|
|
|
22098
22186
|
priceTier,
|
|
22099
22187
|
currency,
|
|
22100
22188
|
packageSize = 1
|
|
22101
|
-
} =
|
|
22189
|
+
} = useMemo9(() => {
|
|
22102
22190
|
const {
|
|
22103
22191
|
price: entitlementPrice,
|
|
22104
22192
|
priceDecimal: entitlementPriceDecimal,
|
|
@@ -22120,7 +22208,7 @@ var Details = ({
|
|
|
22120
22208
|
monthlyUsageBasedPrice,
|
|
22121
22209
|
yearlyUsageBasedPrice
|
|
22122
22210
|
]);
|
|
22123
|
-
const text =
|
|
22211
|
+
const text = useMemo9(() => {
|
|
22124
22212
|
if (!feature) {
|
|
22125
22213
|
return;
|
|
22126
22214
|
}
|
|
@@ -22171,7 +22259,7 @@ var Details = ({
|
|
|
22171
22259
|
packageSize,
|
|
22172
22260
|
softLimit
|
|
22173
22261
|
]);
|
|
22174
|
-
const usageText =
|
|
22262
|
+
const usageText = useMemo9(() => {
|
|
22175
22263
|
if (!feature) {
|
|
22176
22264
|
return;
|
|
22177
22265
|
}
|
|
@@ -22348,7 +22436,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
22348
22436
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
22349
22437
|
const isLightBackground = useIsLightBackground();
|
|
22350
22438
|
const [showCount, setShowCount] = useState13(VISIBLE_ENTITLEMENT_COUNT);
|
|
22351
|
-
const featureUsage =
|
|
22439
|
+
const featureUsage = useMemo10(() => {
|
|
22352
22440
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
22353
22441
|
(acc, id) => {
|
|
22354
22442
|
const mappedFeatureUsage = data.featureUsage?.features.find(
|
|
@@ -22639,7 +22727,7 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
22639
22727
|
Invoices.displayName = "Invoices";
|
|
22640
22728
|
|
|
22641
22729
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
22642
|
-
import { forwardRef as forwardRef9, useMemo as
|
|
22730
|
+
import { forwardRef as forwardRef9, useMemo as useMemo11, useRef as useRef8 } from "react";
|
|
22643
22731
|
|
|
22644
22732
|
// src/components/elements/metered-features/styles.ts
|
|
22645
22733
|
var Container3 = dt.div`
|
|
@@ -22694,7 +22782,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
22694
22782
|
const theme = nt();
|
|
22695
22783
|
const { data, setLayout, setSelected } = useEmbed();
|
|
22696
22784
|
const isLightBackground = useIsLightBackground();
|
|
22697
|
-
const featureUsage =
|
|
22785
|
+
const featureUsage = useMemo11(() => {
|
|
22698
22786
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
22699
22787
|
(acc, id) => {
|
|
22700
22788
|
const mappedFeatureUsage = data.featureUsage?.features.find(
|
|
@@ -22991,10 +23079,10 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
22991
23079
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
22992
23080
|
|
|
22993
23081
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
22994
|
-
import { forwardRef as forwardRef10, useMemo as
|
|
23082
|
+
import { forwardRef as forwardRef10, useMemo as useMemo13 } from "react";
|
|
22995
23083
|
|
|
22996
23084
|
// src/components/elements/payment-method/PaymentMethodElement.tsx
|
|
22997
|
-
import { useMemo as
|
|
23085
|
+
import { useMemo as useMemo12 } from "react";
|
|
22998
23086
|
import { jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
22999
23087
|
var PaymentElement2 = ({
|
|
23000
23088
|
iconName,
|
|
@@ -23169,7 +23257,7 @@ var PaymentListElement = ({
|
|
|
23169
23257
|
const isLightBackground = useIsLightBackground();
|
|
23170
23258
|
const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
|
|
23171
23259
|
const iconStyles = getIconStyles({ size: "lg", theme });
|
|
23172
|
-
const expirationDate =
|
|
23260
|
+
const expirationDate = useMemo12(() => {
|
|
23173
23261
|
const { cardExpMonth, cardExpYear } = paymentMethod;
|
|
23174
23262
|
if (!cardExpMonth && !cardExpYear) {
|
|
23175
23263
|
return "";
|
|
@@ -23284,10 +23372,10 @@ var resolveDesignProps5 = (props) => {
|
|
|
23284
23372
|
var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
23285
23373
|
const props = resolveDesignProps5(rest);
|
|
23286
23374
|
const { data, setLayout } = useEmbed();
|
|
23287
|
-
const paymentMethod =
|
|
23375
|
+
const paymentMethod = useMemo13(() => {
|
|
23288
23376
|
return data.subscription?.paymentMethod || data.company?.defaultPaymentMethod;
|
|
23289
23377
|
}, [data.company?.defaultPaymentMethod, data.subscription?.paymentMethod]);
|
|
23290
|
-
const monthsToExpiration =
|
|
23378
|
+
const monthsToExpiration = useMemo13(() => {
|
|
23291
23379
|
let expiration;
|
|
23292
23380
|
if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
|
|
23293
23381
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -23356,7 +23444,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
23356
23444
|
}
|
|
23357
23445
|
stripe._registerWrapper({
|
|
23358
23446
|
name: "stripe-js",
|
|
23359
|
-
version: "7.
|
|
23447
|
+
version: "7.3.0",
|
|
23360
23448
|
startTime
|
|
23361
23449
|
});
|
|
23362
23450
|
};
|
|
@@ -23431,7 +23519,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
23431
23519
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
23432
23520
|
var expectedVersion = RELEASE_TRAIN;
|
|
23433
23521
|
if (isTestKey && version !== expectedVersion) {
|
|
23434
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.
|
|
23522
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.3.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
23435
23523
|
}
|
|
23436
23524
|
var stripe = maybeStripe.apply(void 0, args);
|
|
23437
23525
|
registerWrapper(stripe, startTime);
|
|
@@ -23468,7 +23556,7 @@ var loadStripe = function loadStripe2() {
|
|
|
23468
23556
|
};
|
|
23469
23557
|
|
|
23470
23558
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
23471
|
-
import { useCallback as useCallback10, useEffect as useEffect6, useMemo as
|
|
23559
|
+
import { useCallback as useCallback10, useEffect as useEffect6, useMemo as useMemo14, useState as useState15 } from "react";
|
|
23472
23560
|
import { jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
23473
23561
|
var resolveDesignProps6 = () => {
|
|
23474
23562
|
return {
|
|
@@ -23497,7 +23585,7 @@ var PaymentMethodDetails = ({
|
|
|
23497
23585
|
const [setupIntent, setSetupIntent] = useState15();
|
|
23498
23586
|
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState15(false);
|
|
23499
23587
|
const [paymentMethod, setPaymentMethod] = useState15(data.subscription?.paymentMethod || data.company?.defaultPaymentMethod);
|
|
23500
|
-
const monthsToExpiration =
|
|
23588
|
+
const monthsToExpiration = useMemo14(() => {
|
|
23501
23589
|
let expiration;
|
|
23502
23590
|
if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
|
|
23503
23591
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -23767,7 +23855,7 @@ var PaymentMethodDetails = ({
|
|
|
23767
23855
|
};
|
|
23768
23856
|
|
|
23769
23857
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
23770
|
-
import { forwardRef as forwardRef11, useMemo as
|
|
23858
|
+
import { forwardRef as forwardRef11, useMemo as useMemo15 } from "react";
|
|
23771
23859
|
import { Fragment as Fragment14, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
23772
23860
|
var resolveDesignProps7 = (props) => {
|
|
23773
23861
|
return {
|
|
@@ -23823,7 +23911,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
23823
23911
|
[]
|
|
23824
23912
|
);
|
|
23825
23913
|
const billingSubscription = data.company?.billingSubscription;
|
|
23826
|
-
const trialEndDays =
|
|
23914
|
+
const trialEndDays = useMemo15(() => {
|
|
23827
23915
|
const trialEnd = billingSubscription?.trialEnd;
|
|
23828
23916
|
const trialEndDate = trialEnd ? new Date(trialEnd * 1e3) : /* @__PURE__ */ new Date();
|
|
23829
23917
|
const todayDate = /* @__PURE__ */ new Date();
|
|
@@ -24627,7 +24715,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
24627
24715
|
"Current usage exceeds the limit of this plan."
|
|
24628
24716
|
)
|
|
24629
24717
|
}
|
|
24630
|
-
) : plan.companyCanTrial ? t2("
|
|
24718
|
+
) : plan.companyCanTrial ? t2("Start X day trial", { days: plan.trialDays }) : t2("Choose plan")
|
|
24631
24719
|
}
|
|
24632
24720
|
)
|
|
24633
24721
|
]
|
|
@@ -24961,7 +25049,7 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
|
|
|
24961
25049
|
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
24962
25050
|
|
|
24963
25051
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
24964
|
-
import { forwardRef as forwardRef15, useMemo as
|
|
25052
|
+
import { forwardRef as forwardRef15, useMemo as useMemo16 } from "react";
|
|
24965
25053
|
import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
24966
25054
|
function resolveDesignProps11(props) {
|
|
24967
25055
|
return {
|
|
@@ -24987,7 +25075,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
24987
25075
|
const theme = nt();
|
|
24988
25076
|
const { data } = useEmbed();
|
|
24989
25077
|
const isLightBackground = useIsLightBackground();
|
|
24990
|
-
const { upcomingInvoice, discounts } =
|
|
25078
|
+
const { upcomingInvoice, discounts } = useMemo16(() => {
|
|
24991
25079
|
const discounts2 = (data.subscription?.discounts || []).map((discount) => ({
|
|
24992
25080
|
amountOff: discount.amountOff,
|
|
24993
25081
|
couponId: discount.couponId,
|