@schematichq/schematic-components 2.6.2 → 2.7.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 +83 -14
- package/dist/schematic-components.esm.js +83 -14
- package/package.json +10 -10
|
@@ -6112,13 +6112,21 @@ var bindMemberFunctions = (inst) => {
|
|
|
6112
6112
|
}
|
|
6113
6113
|
});
|
|
6114
6114
|
};
|
|
6115
|
-
var
|
|
6115
|
+
var SUPPORT_NOTICE_KEY = "__i18next_supportNoticeShown";
|
|
6116
|
+
var getSupportNoticeShown = () => typeof globalThis !== "undefined" && !!globalThis[SUPPORT_NOTICE_KEY];
|
|
6117
|
+
var setSupportNoticeShown = () => {
|
|
6118
|
+
if (typeof globalThis !== "undefined") globalThis[SUPPORT_NOTICE_KEY] = true;
|
|
6119
|
+
};
|
|
6116
6120
|
var usesLocize = (inst) => {
|
|
6117
6121
|
if (inst?.modules?.backend?.name?.indexOf("Locize") > 0) return true;
|
|
6118
6122
|
if (inst?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0) return true;
|
|
6119
6123
|
if (inst?.options?.backend?.backends) {
|
|
6120
6124
|
if (inst.options.backend.backends.some((b3) => b3?.name?.indexOf("Locize") > 0 || b3?.constructor?.name?.indexOf("Locize") > 0)) return true;
|
|
6121
6125
|
}
|
|
6126
|
+
if (inst?.options?.backend?.projectId) return true;
|
|
6127
|
+
if (inst?.options?.backend?.backendOptions) {
|
|
6128
|
+
if (inst.options.backend.backendOptions.some((b3) => b3?.projectId)) return true;
|
|
6129
|
+
}
|
|
6122
6130
|
return false;
|
|
6123
6131
|
};
|
|
6124
6132
|
var I18n = class _I18n extends EventEmitter {
|
|
@@ -6173,9 +6181,9 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6173
6181
|
if (typeof this.options.overloadTranslationOptionHandler !== "function") {
|
|
6174
6182
|
this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
|
|
6175
6183
|
}
|
|
6176
|
-
if (this.options.showSupportNotice !== false && !usesLocize(this) && !
|
|
6184
|
+
if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
|
|
6177
6185
|
if (typeof console !== "undefined" && typeof console.info !== "undefined") console.info("\u{1F310} i18next is maintained with support from Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}");
|
|
6178
|
-
|
|
6186
|
+
setSupportNoticeShown();
|
|
6179
6187
|
}
|
|
6180
6188
|
const createClassOnDemand = (ClassOrObject) => {
|
|
6181
6189
|
if (!ClassOrObject) return null;
|
|
@@ -7384,7 +7392,7 @@ var import_react13 = require("react");
|
|
|
7384
7392
|
var en_default = {
|
|
7385
7393
|
translation: {
|
|
7386
7394
|
"A problem occurred while saving your payment method.": "A problem occurred while saving your payment method.",
|
|
7387
|
-
"Access to plan will end
|
|
7395
|
+
"Access to plan will end.": "Access to {{plan}} will end on {{date}}.",
|
|
7388
7396
|
Active: "Active",
|
|
7389
7397
|
Add: "Add",
|
|
7390
7398
|
"Add new payment method": "Add new payment method",
|
|
@@ -7421,6 +7429,7 @@ var en_default = {
|
|
|
7421
7429
|
"Currently using": "Currently using {{quantity}} {{unit}}",
|
|
7422
7430
|
"Custom price": "Custom price",
|
|
7423
7431
|
Discount: "Discount",
|
|
7432
|
+
"Downgrade to plan scheduled": "Downgrade to {{plan}} scheduled",
|
|
7424
7433
|
"Due today": "Due today",
|
|
7425
7434
|
"Edit payment method": "Edit payment method",
|
|
7426
7435
|
Edit: "Edit",
|
|
@@ -7491,6 +7500,7 @@ var en_default = {
|
|
|
7491
7500
|
Selected: "Selected",
|
|
7492
7501
|
"Selected plan or associated price is missing.": "Selected plan or associated price is missing.",
|
|
7493
7502
|
"Downgrade not permitted.": "Downgrade not permitted.",
|
|
7503
|
+
"Downgrade pending.": "Downgrade pending.",
|
|
7494
7504
|
"Session expired. Please refresh and try again.": "Session expired. Please refresh and try again.",
|
|
7495
7505
|
"Show details": "Show details",
|
|
7496
7506
|
"Start trial": "Start trial",
|
|
@@ -7538,6 +7548,7 @@ var en_default = {
|
|
|
7538
7548
|
"X units per use": "{{amount}} {{units}} per use",
|
|
7539
7549
|
"X time left in trial": "{{amount}} {{units}} left in trial",
|
|
7540
7550
|
"Yearly total": "Yearly total",
|
|
7551
|
+
"You will be downgraded at the end of your billing period.": "You will be downgraded to the {{plan}} plan at the end of your billing period on {{date}}.",
|
|
7541
7552
|
"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",
|
|
7542
7553
|
"$X per unit": "{{cost}} per {{unit}}",
|
|
7543
7554
|
"$X per Y units": "{{cost}} per {{size}} {{units}}",
|
|
@@ -12911,7 +12922,7 @@ var reducer = (state, action) => {
|
|
|
12911
12922
|
// src/context/EmbedProvider.tsx
|
|
12912
12923
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
12913
12924
|
var getCustomHeaders = (sessionId) => ({
|
|
12914
|
-
"X-Schematic-Components-Version": "2.
|
|
12925
|
+
"X-Schematic-Components-Version": "2.7.0",
|
|
12915
12926
|
"X-Schematic-Session-ID": sessionId
|
|
12916
12927
|
});
|
|
12917
12928
|
var EmbedProvider = ({
|
|
@@ -16267,6 +16278,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
16267
16278
|
);
|
|
16268
16279
|
const [promoCode, setPromoCode] = (0, import_react33.useState)(null);
|
|
16269
16280
|
const [isPaymentMethodRequired, setIsPaymentMethodRequired] = (0, import_react33.useState)(false);
|
|
16281
|
+
const [willScheduleDowngrade, setWillScheduleDowngrade] = (0, import_react33.useState)(false);
|
|
16270
16282
|
const willTrialWithoutPaymentMethod = (0, import_react33.useMemo)(
|
|
16271
16283
|
() => shouldTrial && !trialPaymentMethodRequired,
|
|
16272
16284
|
[shouldTrial, trialPaymentMethodRequired]
|
|
@@ -16478,6 +16490,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
16478
16490
|
if (response) {
|
|
16479
16491
|
setCharges(response.data.finance);
|
|
16480
16492
|
setIsPaymentMethodRequired(response.data.paymentMethodRequired);
|
|
16493
|
+
setWillScheduleDowngrade(response.data.isScheduledDowngrade);
|
|
16481
16494
|
}
|
|
16482
16495
|
if (typeof updates.promoCode !== "undefined") {
|
|
16483
16496
|
setPromoCode(code);
|
|
@@ -16505,6 +16518,13 @@ var CheckoutDialog = ({ top }) => {
|
|
|
16505
16518
|
return;
|
|
16506
16519
|
}
|
|
16507
16520
|
}
|
|
16521
|
+
if (err2.response.status === 409) {
|
|
16522
|
+
switch (data2.error) {
|
|
16523
|
+
case "cannot purchase pay-in-advance entitlements while a scheduled downgrade is pending; cancel the scheduled downgrade first":
|
|
16524
|
+
setError(t2("Downgrade pending."));
|
|
16525
|
+
return;
|
|
16526
|
+
}
|
|
16527
|
+
}
|
|
16508
16528
|
setError(
|
|
16509
16529
|
t2("Error retrieving plan details. Please try again in a moment.")
|
|
16510
16530
|
);
|
|
@@ -17012,7 +17032,8 @@ var CheckoutDialog = ({ top }) => {
|
|
|
17012
17032
|
updatePromoCode,
|
|
17013
17033
|
shouldTrial,
|
|
17014
17034
|
setConfirmPaymentIntent: setConfirmPaymentIntentProps,
|
|
17015
|
-
willTrialWithoutPaymentMethod
|
|
17035
|
+
willTrialWithoutPaymentMethod,
|
|
17036
|
+
willScheduleDowngrade
|
|
17016
17037
|
}
|
|
17017
17038
|
)
|
|
17018
17039
|
] })
|
|
@@ -17516,6 +17537,7 @@ var NoPaymentRequired = ({
|
|
|
17516
17537
|
isDisabled,
|
|
17517
17538
|
isLoading,
|
|
17518
17539
|
isSticky = false,
|
|
17540
|
+
willScheduleDowngrade = false,
|
|
17519
17541
|
onClick
|
|
17520
17542
|
}) => {
|
|
17521
17543
|
const { t: t2 } = useTranslation();
|
|
@@ -17528,7 +17550,7 @@ var NoPaymentRequired = ({
|
|
|
17528
17550
|
$size: isSticky ? "sm" : "md",
|
|
17529
17551
|
$fullWidth: true,
|
|
17530
17552
|
$isLoading: isLoading,
|
|
17531
|
-
children: t2("Subscribe and close")
|
|
17553
|
+
children: willScheduleDowngrade ? t2("Schedule downgrade") : t2("Subscribe and close")
|
|
17532
17554
|
}
|
|
17533
17555
|
);
|
|
17534
17556
|
};
|
|
@@ -17547,7 +17569,8 @@ var CheckoutStageButton = ({
|
|
|
17547
17569
|
setCheckoutStage,
|
|
17548
17570
|
trialPaymentMethodRequired,
|
|
17549
17571
|
shouldTrial,
|
|
17550
|
-
willTrialWithoutPaymentMethod
|
|
17572
|
+
willTrialWithoutPaymentMethod,
|
|
17573
|
+
willScheduleDowngrade
|
|
17551
17574
|
}) => {
|
|
17552
17575
|
const { t: t2 } = useTranslation();
|
|
17553
17576
|
const isDisabled = isLoading || !hasPlan || inEditMode || !canCheckout;
|
|
@@ -17821,7 +17844,7 @@ var CheckoutStageButton = ({
|
|
|
17821
17844
|
onClick: checkout,
|
|
17822
17845
|
$fullWidth: true,
|
|
17823
17846
|
$isLoading: isLoading,
|
|
17824
|
-
children: willTrialWithoutPaymentMethod ? t2("Start trial") : t2("Pay now")
|
|
17847
|
+
children: willScheduleDowngrade ? t2("Schedule downgrade") : willTrialWithoutPaymentMethod ? t2("Start trial") : t2("Pay now")
|
|
17825
17848
|
}
|
|
17826
17849
|
);
|
|
17827
17850
|
}
|
|
@@ -17983,6 +18006,7 @@ var SubscriptionSidebar = (0, import_react40.forwardRef)(
|
|
|
17983
18006
|
showHeader = true,
|
|
17984
18007
|
shouldTrial = false,
|
|
17985
18008
|
willTrialWithoutPaymentMethod = false,
|
|
18009
|
+
willScheduleDowngrade = false,
|
|
17986
18010
|
setConfirmPaymentIntent
|
|
17987
18011
|
}, ref) => {
|
|
17988
18012
|
const portal = portalRef?.current || document.body;
|
|
@@ -18346,6 +18370,7 @@ var SubscriptionSidebar = (0, import_react40.forwardRef)(
|
|
|
18346
18370
|
isSelectedPlanTrialable,
|
|
18347
18371
|
trialPaymentMethodRequired,
|
|
18348
18372
|
willTrialWithoutPaymentMethod,
|
|
18373
|
+
willScheduleDowngrade,
|
|
18349
18374
|
shouldTrial,
|
|
18350
18375
|
checkout: handleCheckout
|
|
18351
18376
|
}
|
|
@@ -18381,6 +18406,7 @@ var SubscriptionSidebar = (0, import_react40.forwardRef)(
|
|
|
18381
18406
|
willTrialWithoutPaymentMethod,
|
|
18382
18407
|
shouldTrial,
|
|
18383
18408
|
isPaymentMethodRequired,
|
|
18409
|
+
willScheduleDowngrade,
|
|
18384
18410
|
paymentMethod,
|
|
18385
18411
|
paymentMethodId,
|
|
18386
18412
|
handleCheckout,
|
|
@@ -18938,7 +18964,18 @@ var SubscriptionSidebar = (0, import_react40.forwardRef)(
|
|
|
18938
18964
|
}
|
|
18939
18965
|
)
|
|
18940
18966
|
] }),
|
|
18941
|
-
layout !== "unsubscribe" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { children:
|
|
18967
|
+
layout !== "unsubscribe" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { children: willScheduleDowngrade && selectedPlan?.name && billingSubscription ? t2(
|
|
18968
|
+
"You will be downgraded at the end of your billing period.",
|
|
18969
|
+
{
|
|
18970
|
+
plan: selectedPlan.name,
|
|
18971
|
+
date: toPrettyDate(
|
|
18972
|
+
new Date(billingSubscription.periodEnd * 1e3),
|
|
18973
|
+
{
|
|
18974
|
+
month: "numeric"
|
|
18975
|
+
}
|
|
18976
|
+
)
|
|
18977
|
+
}
|
|
18978
|
+
) : subscriptionPrice && // TODO: localize
|
|
18942
18979
|
`You will be billed ${subscriptionPrice} ${usageBasedEntitlements.length > 0 ? "plus usage based costs" : ""} for this subscription
|
|
18943
18980
|
every ${planPeriod} ${periodStart ? `on the ${formatOrdinal(periodStart.getDate())}` : ""} ${planPeriod === "year" && periodStart ? `of ${getMonthName(periodStart)}` : ""} unless you unsubscribe.` }) })
|
|
18944
18981
|
]
|
|
@@ -20865,7 +20902,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
20865
20902
|
}
|
|
20866
20903
|
stripe._registerWrapper({
|
|
20867
20904
|
name: "stripe-js",
|
|
20868
|
-
version: "8.
|
|
20905
|
+
version: "8.8.0",
|
|
20869
20906
|
startTime
|
|
20870
20907
|
});
|
|
20871
20908
|
};
|
|
@@ -20943,7 +20980,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
20943
20980
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
20944
20981
|
var expectedVersion = RELEASE_TRAIN;
|
|
20945
20982
|
if (isTestKey && version !== expectedVersion) {
|
|
20946
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.
|
|
20983
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.8.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
20947
20984
|
}
|
|
20948
20985
|
var stripe = maybeStripe.apply(void 0, args);
|
|
20949
20986
|
registerWrapper(stripe, startTime);
|
|
@@ -21600,7 +21637,7 @@ var PlanManager = (0, import_react53.forwardRef)(({ children, className, portal,
|
|
|
21600
21637
|
)
|
|
21601
21638
|
]
|
|
21602
21639
|
}
|
|
21603
|
-
) : willSubscriptionCancel
|
|
21640
|
+
) : willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
21604
21641
|
Notice,
|
|
21605
21642
|
{
|
|
21606
21643
|
as: Flex,
|
|
@@ -21616,7 +21653,8 @@ var PlanManager = (0, import_react53.forwardRef)(({ children, className, portal,
|
|
|
21616
21653
|
{
|
|
21617
21654
|
as: "p",
|
|
21618
21655
|
$size: 0.8125 * settings.theme.typography.text.fontSize,
|
|
21619
|
-
children: t2("Access to plan will end
|
|
21656
|
+
children: t2("Access to plan will end.", {
|
|
21657
|
+
plan: currentPlan?.name || "plan",
|
|
21620
21658
|
date: toPrettyDate(
|
|
21621
21659
|
new Date(billingSubscription.cancelAt * 1e3),
|
|
21622
21660
|
{
|
|
@@ -21628,6 +21666,37 @@ var PlanManager = (0, import_react53.forwardRef)(({ children, className, portal,
|
|
|
21628
21666
|
)
|
|
21629
21667
|
]
|
|
21630
21668
|
}
|
|
21669
|
+
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
21670
|
+
Notice,
|
|
21671
|
+
{
|
|
21672
|
+
as: Flex,
|
|
21673
|
+
$flexDirection: "column",
|
|
21674
|
+
$gap: "0.5rem",
|
|
21675
|
+
$padding: "1.5rem",
|
|
21676
|
+
$textAlign: "center",
|
|
21677
|
+
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
21678
|
+
children: [
|
|
21679
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { as: "h3", display: "heading3", children: t2("Downgrade to plan scheduled", {
|
|
21680
|
+
plan: data.company.scheduledDowngrade.toPlanName
|
|
21681
|
+
}) }),
|
|
21682
|
+
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
21683
|
+
Text,
|
|
21684
|
+
{
|
|
21685
|
+
as: "p",
|
|
21686
|
+
$size: 0.8125 * settings.theme.typography.text.fontSize,
|
|
21687
|
+
children: t2("Access to plan will end.", {
|
|
21688
|
+
plan: data.company.scheduledDowngrade.fromPlanName,
|
|
21689
|
+
date: toPrettyDate(
|
|
21690
|
+
new Date(billingSubscription.periodEnd * 1e3),
|
|
21691
|
+
{
|
|
21692
|
+
month: "numeric"
|
|
21693
|
+
}
|
|
21694
|
+
)
|
|
21695
|
+
})
|
|
21696
|
+
}
|
|
21697
|
+
)
|
|
21698
|
+
]
|
|
21699
|
+
}
|
|
21631
21700
|
),
|
|
21632
21701
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
21633
21702
|
Element,
|
|
@@ -6032,13 +6032,21 @@ var bindMemberFunctions = (inst) => {
|
|
|
6032
6032
|
}
|
|
6033
6033
|
});
|
|
6034
6034
|
};
|
|
6035
|
-
var
|
|
6035
|
+
var SUPPORT_NOTICE_KEY = "__i18next_supportNoticeShown";
|
|
6036
|
+
var getSupportNoticeShown = () => typeof globalThis !== "undefined" && !!globalThis[SUPPORT_NOTICE_KEY];
|
|
6037
|
+
var setSupportNoticeShown = () => {
|
|
6038
|
+
if (typeof globalThis !== "undefined") globalThis[SUPPORT_NOTICE_KEY] = true;
|
|
6039
|
+
};
|
|
6036
6040
|
var usesLocize = (inst) => {
|
|
6037
6041
|
if (inst?.modules?.backend?.name?.indexOf("Locize") > 0) return true;
|
|
6038
6042
|
if (inst?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0) return true;
|
|
6039
6043
|
if (inst?.options?.backend?.backends) {
|
|
6040
6044
|
if (inst.options.backend.backends.some((b3) => b3?.name?.indexOf("Locize") > 0 || b3?.constructor?.name?.indexOf("Locize") > 0)) return true;
|
|
6041
6045
|
}
|
|
6046
|
+
if (inst?.options?.backend?.projectId) return true;
|
|
6047
|
+
if (inst?.options?.backend?.backendOptions) {
|
|
6048
|
+
if (inst.options.backend.backendOptions.some((b3) => b3?.projectId)) return true;
|
|
6049
|
+
}
|
|
6042
6050
|
return false;
|
|
6043
6051
|
};
|
|
6044
6052
|
var I18n = class _I18n extends EventEmitter {
|
|
@@ -6093,9 +6101,9 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6093
6101
|
if (typeof this.options.overloadTranslationOptionHandler !== "function") {
|
|
6094
6102
|
this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
|
|
6095
6103
|
}
|
|
6096
|
-
if (this.options.showSupportNotice !== false && !usesLocize(this) && !
|
|
6104
|
+
if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
|
|
6097
6105
|
if (typeof console !== "undefined" && typeof console.info !== "undefined") console.info("\u{1F310} i18next is maintained with support from Locize \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}");
|
|
6098
|
-
|
|
6106
|
+
setSupportNoticeShown();
|
|
6099
6107
|
}
|
|
6100
6108
|
const createClassOnDemand = (ClassOrObject) => {
|
|
6101
6109
|
if (!ClassOrObject) return null;
|
|
@@ -7304,7 +7312,7 @@ import { useContext as useContext4 } from "react";
|
|
|
7304
7312
|
var en_default = {
|
|
7305
7313
|
translation: {
|
|
7306
7314
|
"A problem occurred while saving your payment method.": "A problem occurred while saving your payment method.",
|
|
7307
|
-
"Access to plan will end
|
|
7315
|
+
"Access to plan will end.": "Access to {{plan}} will end on {{date}}.",
|
|
7308
7316
|
Active: "Active",
|
|
7309
7317
|
Add: "Add",
|
|
7310
7318
|
"Add new payment method": "Add new payment method",
|
|
@@ -7341,6 +7349,7 @@ var en_default = {
|
|
|
7341
7349
|
"Currently using": "Currently using {{quantity}} {{unit}}",
|
|
7342
7350
|
"Custom price": "Custom price",
|
|
7343
7351
|
Discount: "Discount",
|
|
7352
|
+
"Downgrade to plan scheduled": "Downgrade to {{plan}} scheduled",
|
|
7344
7353
|
"Due today": "Due today",
|
|
7345
7354
|
"Edit payment method": "Edit payment method",
|
|
7346
7355
|
Edit: "Edit",
|
|
@@ -7411,6 +7420,7 @@ var en_default = {
|
|
|
7411
7420
|
Selected: "Selected",
|
|
7412
7421
|
"Selected plan or associated price is missing.": "Selected plan or associated price is missing.",
|
|
7413
7422
|
"Downgrade not permitted.": "Downgrade not permitted.",
|
|
7423
|
+
"Downgrade pending.": "Downgrade pending.",
|
|
7414
7424
|
"Session expired. Please refresh and try again.": "Session expired. Please refresh and try again.",
|
|
7415
7425
|
"Show details": "Show details",
|
|
7416
7426
|
"Start trial": "Start trial",
|
|
@@ -7458,6 +7468,7 @@ var en_default = {
|
|
|
7458
7468
|
"X units per use": "{{amount}} {{units}} per use",
|
|
7459
7469
|
"X time left in trial": "{{amount}} {{units}} left in trial",
|
|
7460
7470
|
"Yearly total": "Yearly total",
|
|
7471
|
+
"You will be downgraded at the end of your billing period.": "You will be downgraded to the {{plan}} plan at the end of your billing period on {{date}}.",
|
|
7461
7472
|
"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",
|
|
7462
7473
|
"$X per unit": "{{cost}} per {{unit}}",
|
|
7463
7474
|
"$X per Y units": "{{cost}} per {{size}} {{units}}",
|
|
@@ -12831,7 +12842,7 @@ var reducer = (state, action) => {
|
|
|
12831
12842
|
// src/context/EmbedProvider.tsx
|
|
12832
12843
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12833
12844
|
var getCustomHeaders = (sessionId) => ({
|
|
12834
|
-
"X-Schematic-Components-Version": "2.
|
|
12845
|
+
"X-Schematic-Components-Version": "2.7.0",
|
|
12835
12846
|
"X-Schematic-Session-ID": sessionId
|
|
12836
12847
|
});
|
|
12837
12848
|
var EmbedProvider = ({
|
|
@@ -16200,6 +16211,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
16200
16211
|
);
|
|
16201
16212
|
const [promoCode, setPromoCode] = useState8(null);
|
|
16202
16213
|
const [isPaymentMethodRequired, setIsPaymentMethodRequired] = useState8(false);
|
|
16214
|
+
const [willScheduleDowngrade, setWillScheduleDowngrade] = useState8(false);
|
|
16203
16215
|
const willTrialWithoutPaymentMethod = useMemo9(
|
|
16204
16216
|
() => shouldTrial && !trialPaymentMethodRequired,
|
|
16205
16217
|
[shouldTrial, trialPaymentMethodRequired]
|
|
@@ -16411,6 +16423,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
16411
16423
|
if (response) {
|
|
16412
16424
|
setCharges(response.data.finance);
|
|
16413
16425
|
setIsPaymentMethodRequired(response.data.paymentMethodRequired);
|
|
16426
|
+
setWillScheduleDowngrade(response.data.isScheduledDowngrade);
|
|
16414
16427
|
}
|
|
16415
16428
|
if (typeof updates.promoCode !== "undefined") {
|
|
16416
16429
|
setPromoCode(code);
|
|
@@ -16438,6 +16451,13 @@ var CheckoutDialog = ({ top }) => {
|
|
|
16438
16451
|
return;
|
|
16439
16452
|
}
|
|
16440
16453
|
}
|
|
16454
|
+
if (err2.response.status === 409) {
|
|
16455
|
+
switch (data2.error) {
|
|
16456
|
+
case "cannot purchase pay-in-advance entitlements while a scheduled downgrade is pending; cancel the scheduled downgrade first":
|
|
16457
|
+
setError(t2("Downgrade pending."));
|
|
16458
|
+
return;
|
|
16459
|
+
}
|
|
16460
|
+
}
|
|
16441
16461
|
setError(
|
|
16442
16462
|
t2("Error retrieving plan details. Please try again in a moment.")
|
|
16443
16463
|
);
|
|
@@ -16945,7 +16965,8 @@ var CheckoutDialog = ({ top }) => {
|
|
|
16945
16965
|
updatePromoCode,
|
|
16946
16966
|
shouldTrial,
|
|
16947
16967
|
setConfirmPaymentIntent: setConfirmPaymentIntentProps,
|
|
16948
|
-
willTrialWithoutPaymentMethod
|
|
16968
|
+
willTrialWithoutPaymentMethod,
|
|
16969
|
+
willScheduleDowngrade
|
|
16949
16970
|
}
|
|
16950
16971
|
)
|
|
16951
16972
|
] })
|
|
@@ -17461,6 +17482,7 @@ var NoPaymentRequired = ({
|
|
|
17461
17482
|
isDisabled,
|
|
17462
17483
|
isLoading,
|
|
17463
17484
|
isSticky = false,
|
|
17485
|
+
willScheduleDowngrade = false,
|
|
17464
17486
|
onClick
|
|
17465
17487
|
}) => {
|
|
17466
17488
|
const { t: t2 } = useTranslation();
|
|
@@ -17473,7 +17495,7 @@ var NoPaymentRequired = ({
|
|
|
17473
17495
|
$size: isSticky ? "sm" : "md",
|
|
17474
17496
|
$fullWidth: true,
|
|
17475
17497
|
$isLoading: isLoading,
|
|
17476
|
-
children: t2("Subscribe and close")
|
|
17498
|
+
children: willScheduleDowngrade ? t2("Schedule downgrade") : t2("Subscribe and close")
|
|
17477
17499
|
}
|
|
17478
17500
|
);
|
|
17479
17501
|
};
|
|
@@ -17492,7 +17514,8 @@ var CheckoutStageButton = ({
|
|
|
17492
17514
|
setCheckoutStage,
|
|
17493
17515
|
trialPaymentMethodRequired,
|
|
17494
17516
|
shouldTrial,
|
|
17495
|
-
willTrialWithoutPaymentMethod
|
|
17517
|
+
willTrialWithoutPaymentMethod,
|
|
17518
|
+
willScheduleDowngrade
|
|
17496
17519
|
}) => {
|
|
17497
17520
|
const { t: t2 } = useTranslation();
|
|
17498
17521
|
const isDisabled = isLoading || !hasPlan || inEditMode || !canCheckout;
|
|
@@ -17766,7 +17789,7 @@ var CheckoutStageButton = ({
|
|
|
17766
17789
|
onClick: checkout,
|
|
17767
17790
|
$fullWidth: true,
|
|
17768
17791
|
$isLoading: isLoading,
|
|
17769
|
-
children: willTrialWithoutPaymentMethod ? t2("Start trial") : t2("Pay now")
|
|
17792
|
+
children: willScheduleDowngrade ? t2("Schedule downgrade") : willTrialWithoutPaymentMethod ? t2("Start trial") : t2("Pay now")
|
|
17770
17793
|
}
|
|
17771
17794
|
);
|
|
17772
17795
|
}
|
|
@@ -17928,6 +17951,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
17928
17951
|
showHeader = true,
|
|
17929
17952
|
shouldTrial = false,
|
|
17930
17953
|
willTrialWithoutPaymentMethod = false,
|
|
17954
|
+
willScheduleDowngrade = false,
|
|
17931
17955
|
setConfirmPaymentIntent
|
|
17932
17956
|
}, ref) => {
|
|
17933
17957
|
const portal = portalRef?.current || document.body;
|
|
@@ -18291,6 +18315,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
18291
18315
|
isSelectedPlanTrialable,
|
|
18292
18316
|
trialPaymentMethodRequired,
|
|
18293
18317
|
willTrialWithoutPaymentMethod,
|
|
18318
|
+
willScheduleDowngrade,
|
|
18294
18319
|
shouldTrial,
|
|
18295
18320
|
checkout: handleCheckout
|
|
18296
18321
|
}
|
|
@@ -18326,6 +18351,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
18326
18351
|
willTrialWithoutPaymentMethod,
|
|
18327
18352
|
shouldTrial,
|
|
18328
18353
|
isPaymentMethodRequired,
|
|
18354
|
+
willScheduleDowngrade,
|
|
18329
18355
|
paymentMethod,
|
|
18330
18356
|
paymentMethodId,
|
|
18331
18357
|
handleCheckout,
|
|
@@ -18883,7 +18909,18 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
18883
18909
|
}
|
|
18884
18910
|
)
|
|
18885
18911
|
] }),
|
|
18886
|
-
layout !== "unsubscribe" && /* @__PURE__ */ jsx30(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx30(Text, { children:
|
|
18912
|
+
layout !== "unsubscribe" && /* @__PURE__ */ jsx30(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx30(Text, { children: willScheduleDowngrade && selectedPlan?.name && billingSubscription ? t2(
|
|
18913
|
+
"You will be downgraded at the end of your billing period.",
|
|
18914
|
+
{
|
|
18915
|
+
plan: selectedPlan.name,
|
|
18916
|
+
date: toPrettyDate(
|
|
18917
|
+
new Date(billingSubscription.periodEnd * 1e3),
|
|
18918
|
+
{
|
|
18919
|
+
month: "numeric"
|
|
18920
|
+
}
|
|
18921
|
+
)
|
|
18922
|
+
}
|
|
18923
|
+
) : subscriptionPrice && // TODO: localize
|
|
18887
18924
|
`You will be billed ${subscriptionPrice} ${usageBasedEntitlements.length > 0 ? "plus usage based costs" : ""} for this subscription
|
|
18888
18925
|
every ${planPeriod} ${periodStart ? `on the ${formatOrdinal(periodStart.getDate())}` : ""} ${planPeriod === "year" && periodStart ? `of ${getMonthName(periodStart)}` : ""} unless you unsubscribe.` }) })
|
|
18889
18926
|
]
|
|
@@ -20810,7 +20847,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
20810
20847
|
}
|
|
20811
20848
|
stripe._registerWrapper({
|
|
20812
20849
|
name: "stripe-js",
|
|
20813
|
-
version: "8.
|
|
20850
|
+
version: "8.8.0",
|
|
20814
20851
|
startTime
|
|
20815
20852
|
});
|
|
20816
20853
|
};
|
|
@@ -20888,7 +20925,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
20888
20925
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
20889
20926
|
var expectedVersion = RELEASE_TRAIN;
|
|
20890
20927
|
if (isTestKey && version !== expectedVersion) {
|
|
20891
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.
|
|
20928
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.8.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
20892
20929
|
}
|
|
20893
20930
|
var stripe = maybeStripe.apply(void 0, args);
|
|
20894
20931
|
registerWrapper(stripe, startTime);
|
|
@@ -21545,7 +21582,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
21545
21582
|
)
|
|
21546
21583
|
]
|
|
21547
21584
|
}
|
|
21548
|
-
) : willSubscriptionCancel
|
|
21585
|
+
) : willSubscriptionCancel ? /* @__PURE__ */ jsxs37(
|
|
21549
21586
|
Notice,
|
|
21550
21587
|
{
|
|
21551
21588
|
as: Flex,
|
|
@@ -21561,7 +21598,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
21561
21598
|
{
|
|
21562
21599
|
as: "p",
|
|
21563
21600
|
$size: 0.8125 * settings.theme.typography.text.fontSize,
|
|
21564
|
-
children: t2("Access to plan will end
|
|
21601
|
+
children: t2("Access to plan will end.", {
|
|
21602
|
+
plan: currentPlan?.name || "plan",
|
|
21565
21603
|
date: toPrettyDate(
|
|
21566
21604
|
new Date(billingSubscription.cancelAt * 1e3),
|
|
21567
21605
|
{
|
|
@@ -21573,6 +21611,37 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
21573
21611
|
)
|
|
21574
21612
|
]
|
|
21575
21613
|
}
|
|
21614
|
+
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ jsxs37(
|
|
21615
|
+
Notice,
|
|
21616
|
+
{
|
|
21617
|
+
as: Flex,
|
|
21618
|
+
$flexDirection: "column",
|
|
21619
|
+
$gap: "0.5rem",
|
|
21620
|
+
$padding: "1.5rem",
|
|
21621
|
+
$textAlign: "center",
|
|
21622
|
+
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
21623
|
+
children: [
|
|
21624
|
+
/* @__PURE__ */ jsx48(Text, { as: "h3", display: "heading3", children: t2("Downgrade to plan scheduled", {
|
|
21625
|
+
plan: data.company.scheduledDowngrade.toPlanName
|
|
21626
|
+
}) }),
|
|
21627
|
+
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ jsx48(
|
|
21628
|
+
Text,
|
|
21629
|
+
{
|
|
21630
|
+
as: "p",
|
|
21631
|
+
$size: 0.8125 * settings.theme.typography.text.fontSize,
|
|
21632
|
+
children: t2("Access to plan will end.", {
|
|
21633
|
+
plan: data.company.scheduledDowngrade.fromPlanName,
|
|
21634
|
+
date: toPrettyDate(
|
|
21635
|
+
new Date(billingSubscription.periodEnd * 1e3),
|
|
21636
|
+
{
|
|
21637
|
+
month: "numeric"
|
|
21638
|
+
}
|
|
21639
|
+
)
|
|
21640
|
+
})
|
|
21641
|
+
}
|
|
21642
|
+
)
|
|
21643
|
+
]
|
|
21644
|
+
}
|
|
21576
21645
|
),
|
|
21577
21646
|
/* @__PURE__ */ jsxs37(
|
|
21578
21647
|
Element,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematichq/schematic-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"main": "dist/schematic-components.cjs.js",
|
|
5
5
|
"module": "dist/schematic-components.esm.js",
|
|
6
6
|
"types": "dist/schematic-components.d.ts",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@schematichq/schematic-icons": "^0.5.2",
|
|
37
|
-
"@stripe/stripe-js": "^8.
|
|
38
|
-
"i18next": "^25.8.
|
|
37
|
+
"@stripe/stripe-js": "^8.8.0",
|
|
38
|
+
"i18next": "^25.8.13",
|
|
39
39
|
"lodash": "^4.17.23",
|
|
40
40
|
"pako": "^2.1.0",
|
|
41
41
|
"react-i18next": "16.1.6",
|
|
@@ -43,36 +43,36 @@
|
|
|
43
43
|
"uuid": "^13.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@eslint/js": "^9.39.
|
|
46
|
+
"@eslint/js": "^9.39.3",
|
|
47
47
|
"@eslint/json": "^1.0.1",
|
|
48
48
|
"@eslint/markdown": "^7.5.1",
|
|
49
|
-
"@microsoft/api-extractor": "^7.57.
|
|
49
|
+
"@microsoft/api-extractor": "^7.57.3",
|
|
50
50
|
"@openapitools/openapi-generator-cli": "^2.29.0",
|
|
51
51
|
"@stripe/react-stripe-js": "^5.6.0",
|
|
52
|
-
"@swc/core": "^1.15.
|
|
52
|
+
"@swc/core": "^1.15.13",
|
|
53
53
|
"@testing-library/dom": "^10.4.1",
|
|
54
54
|
"@testing-library/jest-dom": "^6.9.1",
|
|
55
55
|
"@testing-library/react": "^16.3.2",
|
|
56
|
-
"@types/lodash": "^4.17.
|
|
56
|
+
"@types/lodash": "^4.17.24",
|
|
57
57
|
"@types/pako": "^2.0.4",
|
|
58
58
|
"@types/react": "^19.2.14",
|
|
59
59
|
"@types/react-dom": "^19.2.3",
|
|
60
60
|
"@vitest/browser": "^4.0.18",
|
|
61
61
|
"esbuild": "^0.27.3",
|
|
62
|
-
"eslint": "^9.39.
|
|
62
|
+
"eslint": "^9.39.3",
|
|
63
63
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
64
64
|
"eslint-plugin-import": "^2.32.0",
|
|
65
65
|
"eslint-plugin-react": "^7.37.5",
|
|
66
66
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
67
67
|
"globals": "^17.3.0",
|
|
68
|
-
"happy-dom": "^20.
|
|
68
|
+
"happy-dom": "^20.7.0",
|
|
69
69
|
"jsdom": "^28.1.0",
|
|
70
70
|
"msw": "^2.12.10",
|
|
71
71
|
"prettier": "^3.8.1",
|
|
72
72
|
"react": "^19.2.4",
|
|
73
73
|
"react-dom": "^19.2.4",
|
|
74
74
|
"typescript": "^5.9.3",
|
|
75
|
-
"typescript-eslint": "^8.56.
|
|
75
|
+
"typescript-eslint": "^8.56.1",
|
|
76
76
|
"vitest": "^4.0.18"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|