@schematichq/schematic-components 2.19.0 → 2.20.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/README.md +7 -0
- package/dist/schematic-components.browser.cjs.js +17 -8
- package/dist/schematic-components.browser.esm.js +17 -8
- package/dist/schematic-components.cjs.js +17 -8
- package/dist/schematic-components.d.ts +18 -0
- package/dist/schematic-components.esm.js +17 -8
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -59,6 +59,7 @@ const config = {
|
|
|
59
59
|
payInAdvanceQuantities: { // pre-fill pay-in-advance quantities, keyed by feature id (optional)
|
|
60
60
|
feat_cns2asuKAG2: 3, // "feat_cns2asuKAG2" is a feature id, 3 is the quantity
|
|
61
61
|
},
|
|
62
|
+
promoCode: 'SUMMER20', // pre-apply a Stripe promotion code (optional)
|
|
62
63
|
skipped: {
|
|
63
64
|
planStage: true, // if true, skip Plan selection
|
|
64
65
|
addOnStage: true, // if true, skip Add-on selection
|
|
@@ -76,6 +77,12 @@ pricing; entries for other (or unknown) features are ignored. Combine it with
|
|
|
76
77
|
`skipped.usageStage` / `skipped.addOnUsageStage` to send the customer straight to
|
|
77
78
|
the final checkout step with the quantities already set.
|
|
78
79
|
|
|
80
|
+
`promoCode` pre-applies a discount to the checkout. It expects a Stripe
|
|
81
|
+
[promotion code](https://docs.stripe.com/billing/subscriptions/coupons) — the
|
|
82
|
+
customer-facing code such as `SUMMER20`, not the underlying coupon id. The
|
|
83
|
+
discount is applied on load, so the previewed charges reflect it and it ships
|
|
84
|
+
with the final checkout request.
|
|
85
|
+
|
|
79
86
|
The Plans and Add-ons available to the checkout flows must be live in your
|
|
80
87
|
Schematic account [Catalog configuration](https://docs.schematichq.com/catalog/overview).
|
|
81
88
|
|
|
@@ -2927,7 +2927,10 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
2927
2927
|
const useOptionsReplaceForData = options.replace && !isString(options.replace);
|
|
2928
2928
|
let data = useOptionsReplaceForData ? options.replace : options;
|
|
2929
2929
|
if (useOptionsReplaceForData && typeof options.count !== "undefined") {
|
|
2930
|
-
data
|
|
2930
|
+
data = {
|
|
2931
|
+
...data,
|
|
2932
|
+
count: options.count
|
|
2933
|
+
};
|
|
2931
2934
|
}
|
|
2932
2935
|
if (this.options.interpolation.defaultVariables) {
|
|
2933
2936
|
data = {
|
|
@@ -3238,10 +3241,10 @@ var Interpolator = class {
|
|
|
3238
3241
|
const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
3239
3242
|
const todos = [{
|
|
3240
3243
|
regex: this.regexpUnescape,
|
|
3241
|
-
safeValue: (val) =>
|
|
3244
|
+
safeValue: (val) => val
|
|
3242
3245
|
}, {
|
|
3243
3246
|
regex: this.regexp,
|
|
3244
|
-
safeValue: (val) => this.escapeValue ?
|
|
3247
|
+
safeValue: (val) => this.escapeValue ? this.escape(val) : val
|
|
3245
3248
|
}];
|
|
3246
3249
|
todos.forEach((todo) => {
|
|
3247
3250
|
replaces = 0;
|
|
@@ -3265,9 +3268,9 @@ var Interpolator = class {
|
|
|
3265
3268
|
value = makeString(value);
|
|
3266
3269
|
}
|
|
3267
3270
|
const safeValue = todo.safeValue(value);
|
|
3268
|
-
str = str.replace(match2[0], safeValue);
|
|
3271
|
+
str = str.replace(match2[0], regexSafe(safeValue));
|
|
3269
3272
|
if (skipOnVariables) {
|
|
3270
|
-
todo.regex.lastIndex +=
|
|
3273
|
+
todo.regex.lastIndex += safeValue.length;
|
|
3271
3274
|
todo.regex.lastIndex -= match2[0].length;
|
|
3272
3275
|
} else {
|
|
3273
3276
|
todo.regex.lastIndex = 0;
|
|
@@ -3317,7 +3320,7 @@ var Interpolator = class {
|
|
|
3317
3320
|
clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
|
|
3318
3321
|
clonedOptions.applyPostProcessor = false;
|
|
3319
3322
|
delete clonedOptions.defaultValue;
|
|
3320
|
-
const keyEndIndex = /{.*}
|
|
3323
|
+
const keyEndIndex = /{.*}/s.test(match2[1]) ? match2[1].lastIndexOf("}") + 1 : match2[1].indexOf(this.formatSeparator);
|
|
3321
3324
|
if (keyEndIndex !== -1) {
|
|
3322
3325
|
formatters = match2[1].slice(keyEndIndex).split(this.formatSeparator).map((elem) => elem.trim()).filter(Boolean);
|
|
3323
3326
|
match2[1] = match2[1].slice(0, keyEndIndex);
|
|
@@ -7832,11 +7835,13 @@ function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7832
7835
|
currency: json["currency"],
|
|
7833
7836
|
customerExternalId: json["customer_external_id"],
|
|
7834
7837
|
dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
|
|
7838
|
+
endingBalance: json["ending_balance"],
|
|
7835
7839
|
environmentId: json["environment_id"],
|
|
7836
7840
|
externalId: json["external_id"] == null ? void 0 : json["external_id"],
|
|
7837
7841
|
id: json["id"],
|
|
7838
7842
|
paymentMethodExternalId: json["payment_method_external_id"] == null ? void 0 : json["payment_method_external_id"],
|
|
7839
7843
|
providerType: BillingProviderTypeFromJSON(json["provider_type"]),
|
|
7844
|
+
startingBalance: json["starting_balance"],
|
|
7840
7845
|
status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
|
|
7841
7846
|
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
|
7842
7847
|
subtotal: json["subtotal"],
|
|
@@ -9907,6 +9912,7 @@ function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscrim
|
|
|
9907
9912
|
dueNow: json["due_now"],
|
|
9908
9913
|
newCharges: json["new_charges"],
|
|
9909
9914
|
percentOff: json["percent_off"],
|
|
9915
|
+
periodEnd: new Date(json["period_end"]),
|
|
9910
9916
|
periodStart: new Date(json["period_start"]),
|
|
9911
9917
|
promoCodeApplied: json["promo_code_applied"],
|
|
9912
9918
|
proration: json["proration"],
|
|
@@ -13533,7 +13539,7 @@ var reducer = (state, action) => {
|
|
|
13533
13539
|
// src/context/EmbedProvider.tsx
|
|
13534
13540
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
13535
13541
|
var getCustomHeaders = (sessionId) => ({
|
|
13536
|
-
"X-Schematic-Components-Version": "2.
|
|
13542
|
+
"X-Schematic-Components-Version": "2.20.0",
|
|
13537
13543
|
"X-Schematic-Session-ID": sessionId
|
|
13538
13544
|
});
|
|
13539
13545
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -20304,6 +20310,7 @@ var SubscriptionSidebar = (0, import_react44.forwardRef)(
|
|
|
20304
20310
|
dueNow,
|
|
20305
20311
|
newCharges,
|
|
20306
20312
|
percentOff,
|
|
20313
|
+
periodEnd,
|
|
20307
20314
|
periodStart,
|
|
20308
20315
|
proration,
|
|
20309
20316
|
taxAmount,
|
|
@@ -20314,12 +20321,14 @@ var SubscriptionSidebar = (0, import_react44.forwardRef)(
|
|
|
20314
20321
|
dueNow: charges?.dueNow ?? 0,
|
|
20315
20322
|
newCharges: charges?.newCharges ?? 0,
|
|
20316
20323
|
percentOff: charges?.percentOff ?? 0,
|
|
20324
|
+
periodEnd: charges?.periodEnd,
|
|
20317
20325
|
periodStart: charges?.periodStart,
|
|
20318
20326
|
proration: charges?.proration ?? 0,
|
|
20319
20327
|
taxAmount: charges?.taxAmount ?? 0,
|
|
20320
20328
|
taxDescription: charges?.taxDisplayName
|
|
20321
20329
|
};
|
|
20322
20330
|
}, [charges]);
|
|
20331
|
+
const renewDate = periodEnd && !Number.isNaN(periodEnd.getTime()) ? periodEnd : periodStart;
|
|
20323
20332
|
const updatedUsageBasedEntitlements = (0, import_react44.useMemo)(() => {
|
|
20324
20333
|
const changedUsageBasedEntitlements = [];
|
|
20325
20334
|
const allSelectedUsageBasedEntitlements = [
|
|
@@ -21209,7 +21218,7 @@ var SubscriptionSidebar = (0, import_react44.forwardRef)(
|
|
|
21209
21218
|
}
|
|
21210
21219
|
) : subscriptionPrice && // TODO: localize
|
|
21211
21220
|
`You will be billed ${subscriptionPrice} ${usageBasedEntitlements.length > 0 ? "plus usage based costs" : ""} for this subscription
|
|
21212
|
-
every ${planPeriod} ${
|
|
21221
|
+
every ${planPeriod} ${renewDate ? `on the ${formatOrdinal(renewDate.getDate())}` : ""} ${planPeriod === "year" && renewDate ? `of ${getMonthName(renewDate)}` : ""} unless you unsubscribe.` }) })
|
|
21213
21222
|
]
|
|
21214
21223
|
}
|
|
21215
21224
|
)
|
|
@@ -2837,7 +2837,10 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
2837
2837
|
const useOptionsReplaceForData = options.replace && !isString(options.replace);
|
|
2838
2838
|
let data = useOptionsReplaceForData ? options.replace : options;
|
|
2839
2839
|
if (useOptionsReplaceForData && typeof options.count !== "undefined") {
|
|
2840
|
-
data
|
|
2840
|
+
data = {
|
|
2841
|
+
...data,
|
|
2842
|
+
count: options.count
|
|
2843
|
+
};
|
|
2841
2844
|
}
|
|
2842
2845
|
if (this.options.interpolation.defaultVariables) {
|
|
2843
2846
|
data = {
|
|
@@ -3148,10 +3151,10 @@ var Interpolator = class {
|
|
|
3148
3151
|
const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
3149
3152
|
const todos = [{
|
|
3150
3153
|
regex: this.regexpUnescape,
|
|
3151
|
-
safeValue: (val) =>
|
|
3154
|
+
safeValue: (val) => val
|
|
3152
3155
|
}, {
|
|
3153
3156
|
regex: this.regexp,
|
|
3154
|
-
safeValue: (val) => this.escapeValue ?
|
|
3157
|
+
safeValue: (val) => this.escapeValue ? this.escape(val) : val
|
|
3155
3158
|
}];
|
|
3156
3159
|
todos.forEach((todo) => {
|
|
3157
3160
|
replaces = 0;
|
|
@@ -3175,9 +3178,9 @@ var Interpolator = class {
|
|
|
3175
3178
|
value = makeString(value);
|
|
3176
3179
|
}
|
|
3177
3180
|
const safeValue = todo.safeValue(value);
|
|
3178
|
-
str = str.replace(match2[0], safeValue);
|
|
3181
|
+
str = str.replace(match2[0], regexSafe(safeValue));
|
|
3179
3182
|
if (skipOnVariables) {
|
|
3180
|
-
todo.regex.lastIndex +=
|
|
3183
|
+
todo.regex.lastIndex += safeValue.length;
|
|
3181
3184
|
todo.regex.lastIndex -= match2[0].length;
|
|
3182
3185
|
} else {
|
|
3183
3186
|
todo.regex.lastIndex = 0;
|
|
@@ -3227,7 +3230,7 @@ var Interpolator = class {
|
|
|
3227
3230
|
clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
|
|
3228
3231
|
clonedOptions.applyPostProcessor = false;
|
|
3229
3232
|
delete clonedOptions.defaultValue;
|
|
3230
|
-
const keyEndIndex = /{.*}
|
|
3233
|
+
const keyEndIndex = /{.*}/s.test(match2[1]) ? match2[1].lastIndexOf("}") + 1 : match2[1].indexOf(this.formatSeparator);
|
|
3231
3234
|
if (keyEndIndex !== -1) {
|
|
3232
3235
|
formatters = match2[1].slice(keyEndIndex).split(this.formatSeparator).map((elem) => elem.trim()).filter(Boolean);
|
|
3233
3236
|
match2[1] = match2[1].slice(0, keyEndIndex);
|
|
@@ -7742,11 +7745,13 @@ function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7742
7745
|
currency: json["currency"],
|
|
7743
7746
|
customerExternalId: json["customer_external_id"],
|
|
7744
7747
|
dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
|
|
7748
|
+
endingBalance: json["ending_balance"],
|
|
7745
7749
|
environmentId: json["environment_id"],
|
|
7746
7750
|
externalId: json["external_id"] == null ? void 0 : json["external_id"],
|
|
7747
7751
|
id: json["id"],
|
|
7748
7752
|
paymentMethodExternalId: json["payment_method_external_id"] == null ? void 0 : json["payment_method_external_id"],
|
|
7749
7753
|
providerType: BillingProviderTypeFromJSON(json["provider_type"]),
|
|
7754
|
+
startingBalance: json["starting_balance"],
|
|
7750
7755
|
status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
|
|
7751
7756
|
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
|
7752
7757
|
subtotal: json["subtotal"],
|
|
@@ -9817,6 +9822,7 @@ function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscrim
|
|
|
9817
9822
|
dueNow: json["due_now"],
|
|
9818
9823
|
newCharges: json["new_charges"],
|
|
9819
9824
|
percentOff: json["percent_off"],
|
|
9825
|
+
periodEnd: new Date(json["period_end"]),
|
|
9820
9826
|
periodStart: new Date(json["period_start"]),
|
|
9821
9827
|
promoCodeApplied: json["promo_code_applied"],
|
|
9822
9828
|
proration: json["proration"],
|
|
@@ -13443,7 +13449,7 @@ var reducer = (state, action) => {
|
|
|
13443
13449
|
// src/context/EmbedProvider.tsx
|
|
13444
13450
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
13445
13451
|
var getCustomHeaders = (sessionId) => ({
|
|
13446
|
-
"X-Schematic-Components-Version": "2.
|
|
13452
|
+
"X-Schematic-Components-Version": "2.20.0",
|
|
13447
13453
|
"X-Schematic-Session-ID": sessionId
|
|
13448
13454
|
});
|
|
13449
13455
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -20245,6 +20251,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
20245
20251
|
dueNow,
|
|
20246
20252
|
newCharges,
|
|
20247
20253
|
percentOff,
|
|
20254
|
+
periodEnd,
|
|
20248
20255
|
periodStart,
|
|
20249
20256
|
proration,
|
|
20250
20257
|
taxAmount,
|
|
@@ -20255,12 +20262,14 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
20255
20262
|
dueNow: charges?.dueNow ?? 0,
|
|
20256
20263
|
newCharges: charges?.newCharges ?? 0,
|
|
20257
20264
|
percentOff: charges?.percentOff ?? 0,
|
|
20265
|
+
periodEnd: charges?.periodEnd,
|
|
20258
20266
|
periodStart: charges?.periodStart,
|
|
20259
20267
|
proration: charges?.proration ?? 0,
|
|
20260
20268
|
taxAmount: charges?.taxAmount ?? 0,
|
|
20261
20269
|
taxDescription: charges?.taxDisplayName
|
|
20262
20270
|
};
|
|
20263
20271
|
}, [charges]);
|
|
20272
|
+
const renewDate = periodEnd && !Number.isNaN(periodEnd.getTime()) ? periodEnd : periodStart;
|
|
20264
20273
|
const updatedUsageBasedEntitlements = useMemo18(() => {
|
|
20265
20274
|
const changedUsageBasedEntitlements = [];
|
|
20266
20275
|
const allSelectedUsageBasedEntitlements = [
|
|
@@ -21150,7 +21159,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
21150
21159
|
}
|
|
21151
21160
|
) : subscriptionPrice && // TODO: localize
|
|
21152
21161
|
`You will be billed ${subscriptionPrice} ${usageBasedEntitlements.length > 0 ? "plus usage based costs" : ""} for this subscription
|
|
21153
|
-
every ${planPeriod} ${
|
|
21162
|
+
every ${planPeriod} ${renewDate ? `on the ${formatOrdinal(renewDate.getDate())}` : ""} ${planPeriod === "year" && renewDate ? `of ${getMonthName(renewDate)}` : ""} unless you unsubscribe.` }) })
|
|
21154
21163
|
]
|
|
21155
21164
|
}
|
|
21156
21165
|
)
|
|
@@ -4698,7 +4698,10 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4698
4698
|
const useOptionsReplaceForData = options.replace && !isString(options.replace);
|
|
4699
4699
|
let data = useOptionsReplaceForData ? options.replace : options;
|
|
4700
4700
|
if (useOptionsReplaceForData && typeof options.count !== "undefined") {
|
|
4701
|
-
data
|
|
4701
|
+
data = {
|
|
4702
|
+
...data,
|
|
4703
|
+
count: options.count
|
|
4704
|
+
};
|
|
4702
4705
|
}
|
|
4703
4706
|
if (this.options.interpolation.defaultVariables) {
|
|
4704
4707
|
data = {
|
|
@@ -5009,10 +5012,10 @@ var Interpolator = class {
|
|
|
5009
5012
|
const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
5010
5013
|
const todos = [{
|
|
5011
5014
|
regex: this.regexpUnescape,
|
|
5012
|
-
safeValue: (val) =>
|
|
5015
|
+
safeValue: (val) => val
|
|
5013
5016
|
}, {
|
|
5014
5017
|
regex: this.regexp,
|
|
5015
|
-
safeValue: (val) => this.escapeValue ?
|
|
5018
|
+
safeValue: (val) => this.escapeValue ? this.escape(val) : val
|
|
5016
5019
|
}];
|
|
5017
5020
|
todos.forEach((todo) => {
|
|
5018
5021
|
replaces = 0;
|
|
@@ -5036,9 +5039,9 @@ var Interpolator = class {
|
|
|
5036
5039
|
value = makeString(value);
|
|
5037
5040
|
}
|
|
5038
5041
|
const safeValue = todo.safeValue(value);
|
|
5039
|
-
str = str.replace(match[0], safeValue);
|
|
5042
|
+
str = str.replace(match[0], regexSafe(safeValue));
|
|
5040
5043
|
if (skipOnVariables) {
|
|
5041
|
-
todo.regex.lastIndex +=
|
|
5044
|
+
todo.regex.lastIndex += safeValue.length;
|
|
5042
5045
|
todo.regex.lastIndex -= match[0].length;
|
|
5043
5046
|
} else {
|
|
5044
5047
|
todo.regex.lastIndex = 0;
|
|
@@ -5088,7 +5091,7 @@ var Interpolator = class {
|
|
|
5088
5091
|
clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
|
|
5089
5092
|
clonedOptions.applyPostProcessor = false;
|
|
5090
5093
|
delete clonedOptions.defaultValue;
|
|
5091
|
-
const keyEndIndex = /{.*}
|
|
5094
|
+
const keyEndIndex = /{.*}/s.test(match[1]) ? match[1].lastIndexOf("}") + 1 : match[1].indexOf(this.formatSeparator);
|
|
5092
5095
|
if (keyEndIndex !== -1) {
|
|
5093
5096
|
formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map((elem) => elem.trim()).filter(Boolean);
|
|
5094
5097
|
match[1] = match[1].slice(0, keyEndIndex);
|
|
@@ -8188,11 +8191,13 @@ function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8188
8191
|
currency: json["currency"],
|
|
8189
8192
|
customerExternalId: json["customer_external_id"],
|
|
8190
8193
|
dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
|
|
8194
|
+
endingBalance: json["ending_balance"],
|
|
8191
8195
|
environmentId: json["environment_id"],
|
|
8192
8196
|
externalId: json["external_id"] == null ? void 0 : json["external_id"],
|
|
8193
8197
|
id: json["id"],
|
|
8194
8198
|
paymentMethodExternalId: json["payment_method_external_id"] == null ? void 0 : json["payment_method_external_id"],
|
|
8195
8199
|
providerType: BillingProviderTypeFromJSON(json["provider_type"]),
|
|
8200
|
+
startingBalance: json["starting_balance"],
|
|
8196
8201
|
status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
|
|
8197
8202
|
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
|
8198
8203
|
subtotal: json["subtotal"],
|
|
@@ -10263,6 +10268,7 @@ function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscrim
|
|
|
10263
10268
|
dueNow: json["due_now"],
|
|
10264
10269
|
newCharges: json["new_charges"],
|
|
10265
10270
|
percentOff: json["percent_off"],
|
|
10271
|
+
periodEnd: new Date(json["period_end"]),
|
|
10266
10272
|
periodStart: new Date(json["period_start"]),
|
|
10267
10273
|
promoCodeApplied: json["promo_code_applied"],
|
|
10268
10274
|
proration: json["proration"],
|
|
@@ -13890,7 +13896,7 @@ var reducer = (state, action) => {
|
|
|
13890
13896
|
// src/context/EmbedProvider.tsx
|
|
13891
13897
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
13892
13898
|
var getCustomHeaders = (sessionId) => ({
|
|
13893
|
-
"X-Schematic-Components-Version": "2.
|
|
13899
|
+
"X-Schematic-Components-Version": "2.20.0",
|
|
13894
13900
|
"X-Schematic-Session-ID": sessionId
|
|
13895
13901
|
});
|
|
13896
13902
|
var normalizeCurrencyFilter = (filter) => {
|
|
@@ -20679,6 +20685,7 @@ var SubscriptionSidebar = (0, import_react43.forwardRef)(
|
|
|
20679
20685
|
dueNow,
|
|
20680
20686
|
newCharges,
|
|
20681
20687
|
percentOff,
|
|
20688
|
+
periodEnd,
|
|
20682
20689
|
periodStart,
|
|
20683
20690
|
proration,
|
|
20684
20691
|
taxAmount,
|
|
@@ -20689,12 +20696,14 @@ var SubscriptionSidebar = (0, import_react43.forwardRef)(
|
|
|
20689
20696
|
dueNow: charges?.dueNow ?? 0,
|
|
20690
20697
|
newCharges: charges?.newCharges ?? 0,
|
|
20691
20698
|
percentOff: charges?.percentOff ?? 0,
|
|
20699
|
+
periodEnd: charges?.periodEnd,
|
|
20692
20700
|
periodStart: charges?.periodStart,
|
|
20693
20701
|
proration: charges?.proration ?? 0,
|
|
20694
20702
|
taxAmount: charges?.taxAmount ?? 0,
|
|
20695
20703
|
taxDescription: charges?.taxDisplayName
|
|
20696
20704
|
};
|
|
20697
20705
|
}, [charges]);
|
|
20706
|
+
const renewDate = periodEnd && !Number.isNaN(periodEnd.getTime()) ? periodEnd : periodStart;
|
|
20698
20707
|
const updatedUsageBasedEntitlements = (0, import_react43.useMemo)(() => {
|
|
20699
20708
|
const changedUsageBasedEntitlements = [];
|
|
20700
20709
|
const allSelectedUsageBasedEntitlements = [
|
|
@@ -21584,7 +21593,7 @@ var SubscriptionSidebar = (0, import_react43.forwardRef)(
|
|
|
21584
21593
|
}
|
|
21585
21594
|
) : subscriptionPrice && // TODO: localize
|
|
21586
21595
|
`You will be billed ${subscriptionPrice} ${usageBasedEntitlements.length > 0 ? "plus usage based costs" : ""} for this subscription
|
|
21587
|
-
every ${planPeriod} ${
|
|
21596
|
+
every ${planPeriod} ${renewDate ? `on the ${formatOrdinal(renewDate.getDate())}` : ""} ${planPeriod === "year" && renewDate ? `of ${getMonthName(renewDate)}` : ""} unless you unsubscribe.` }) })
|
|
21588
21597
|
]
|
|
21589
21598
|
}
|
|
21590
21599
|
)
|
|
@@ -8507,6 +8507,12 @@ declare interface InvoiceResponseData {
|
|
|
8507
8507
|
* @memberof InvoiceResponseData
|
|
8508
8508
|
*/
|
|
8509
8509
|
dueDate?: Date | null;
|
|
8510
|
+
/**
|
|
8511
|
+
*
|
|
8512
|
+
* @type {number}
|
|
8513
|
+
* @memberof InvoiceResponseData
|
|
8514
|
+
*/
|
|
8515
|
+
endingBalance: number;
|
|
8510
8516
|
/**
|
|
8511
8517
|
*
|
|
8512
8518
|
* @type {string}
|
|
@@ -8537,6 +8543,12 @@ declare interface InvoiceResponseData {
|
|
|
8537
8543
|
* @memberof InvoiceResponseData
|
|
8538
8544
|
*/
|
|
8539
8545
|
providerType: BillingProviderType;
|
|
8546
|
+
/**
|
|
8547
|
+
*
|
|
8548
|
+
* @type {number}
|
|
8549
|
+
* @memberof InvoiceResponseData
|
|
8550
|
+
*/
|
|
8551
|
+
startingBalance: number;
|
|
8540
8552
|
/**
|
|
8541
8553
|
*
|
|
8542
8554
|
* @type {InvoiceStatus}
|
|
@@ -11107,6 +11119,12 @@ declare interface PreviewSubscriptionFinanceResponseData {
|
|
|
11107
11119
|
* @memberof PreviewSubscriptionFinanceResponseData
|
|
11108
11120
|
*/
|
|
11109
11121
|
percentOff: number;
|
|
11122
|
+
/**
|
|
11123
|
+
*
|
|
11124
|
+
* @type {Date}
|
|
11125
|
+
* @memberof PreviewSubscriptionFinanceResponseData
|
|
11126
|
+
*/
|
|
11127
|
+
periodEnd: Date;
|
|
11110
11128
|
/**
|
|
11111
11129
|
*
|
|
11112
11130
|
* @type {Date}
|
|
@@ -2837,7 +2837,10 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
2837
2837
|
const useOptionsReplaceForData = options.replace && !isString(options.replace);
|
|
2838
2838
|
let data = useOptionsReplaceForData ? options.replace : options;
|
|
2839
2839
|
if (useOptionsReplaceForData && typeof options.count !== "undefined") {
|
|
2840
|
-
data
|
|
2840
|
+
data = {
|
|
2841
|
+
...data,
|
|
2842
|
+
count: options.count
|
|
2843
|
+
};
|
|
2841
2844
|
}
|
|
2842
2845
|
if (this.options.interpolation.defaultVariables) {
|
|
2843
2846
|
data = {
|
|
@@ -3148,10 +3151,10 @@ var Interpolator = class {
|
|
|
3148
3151
|
const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
3149
3152
|
const todos = [{
|
|
3150
3153
|
regex: this.regexpUnescape,
|
|
3151
|
-
safeValue: (val) =>
|
|
3154
|
+
safeValue: (val) => val
|
|
3152
3155
|
}, {
|
|
3153
3156
|
regex: this.regexp,
|
|
3154
|
-
safeValue: (val) => this.escapeValue ?
|
|
3157
|
+
safeValue: (val) => this.escapeValue ? this.escape(val) : val
|
|
3155
3158
|
}];
|
|
3156
3159
|
todos.forEach((todo) => {
|
|
3157
3160
|
replaces = 0;
|
|
@@ -3175,9 +3178,9 @@ var Interpolator = class {
|
|
|
3175
3178
|
value = makeString(value);
|
|
3176
3179
|
}
|
|
3177
3180
|
const safeValue = todo.safeValue(value);
|
|
3178
|
-
str = str.replace(match2[0], safeValue);
|
|
3181
|
+
str = str.replace(match2[0], regexSafe(safeValue));
|
|
3179
3182
|
if (skipOnVariables) {
|
|
3180
|
-
todo.regex.lastIndex +=
|
|
3183
|
+
todo.regex.lastIndex += safeValue.length;
|
|
3181
3184
|
todo.regex.lastIndex -= match2[0].length;
|
|
3182
3185
|
} else {
|
|
3183
3186
|
todo.regex.lastIndex = 0;
|
|
@@ -3227,7 +3230,7 @@ var Interpolator = class {
|
|
|
3227
3230
|
clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
|
|
3228
3231
|
clonedOptions.applyPostProcessor = false;
|
|
3229
3232
|
delete clonedOptions.defaultValue;
|
|
3230
|
-
const keyEndIndex = /{.*}
|
|
3233
|
+
const keyEndIndex = /{.*}/s.test(match2[1]) ? match2[1].lastIndexOf("}") + 1 : match2[1].indexOf(this.formatSeparator);
|
|
3231
3234
|
if (keyEndIndex !== -1) {
|
|
3232
3235
|
formatters = match2[1].slice(keyEndIndex).split(this.formatSeparator).map((elem) => elem.trim()).filter(Boolean);
|
|
3233
3236
|
match2[1] = match2[1].slice(0, keyEndIndex);
|
|
@@ -7867,11 +7870,13 @@ function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7867
7870
|
currency: json["currency"],
|
|
7868
7871
|
customerExternalId: json["customer_external_id"],
|
|
7869
7872
|
dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
|
|
7873
|
+
endingBalance: json["ending_balance"],
|
|
7870
7874
|
environmentId: json["environment_id"],
|
|
7871
7875
|
externalId: json["external_id"] == null ? void 0 : json["external_id"],
|
|
7872
7876
|
id: json["id"],
|
|
7873
7877
|
paymentMethodExternalId: json["payment_method_external_id"] == null ? void 0 : json["payment_method_external_id"],
|
|
7874
7878
|
providerType: BillingProviderTypeFromJSON(json["provider_type"]),
|
|
7879
|
+
startingBalance: json["starting_balance"],
|
|
7875
7880
|
status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
|
|
7876
7881
|
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
|
7877
7882
|
subtotal: json["subtotal"],
|
|
@@ -9942,6 +9947,7 @@ function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscrim
|
|
|
9942
9947
|
dueNow: json["due_now"],
|
|
9943
9948
|
newCharges: json["new_charges"],
|
|
9944
9949
|
percentOff: json["percent_off"],
|
|
9950
|
+
periodEnd: new Date(json["period_end"]),
|
|
9945
9951
|
periodStart: new Date(json["period_start"]),
|
|
9946
9952
|
promoCodeApplied: json["promo_code_applied"],
|
|
9947
9953
|
proration: json["proration"],
|
|
@@ -13568,7 +13574,7 @@ var reducer = (state, action) => {
|
|
|
13568
13574
|
// src/context/EmbedProvider.tsx
|
|
13569
13575
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
13570
13576
|
var getCustomHeaders = (sessionId) => ({
|
|
13571
|
-
"X-Schematic-Components-Version": "2.
|
|
13577
|
+
"X-Schematic-Components-Version": "2.20.0",
|
|
13572
13578
|
"X-Schematic-Session-ID": sessionId
|
|
13573
13579
|
});
|
|
13574
13580
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -20370,6 +20376,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
20370
20376
|
dueNow,
|
|
20371
20377
|
newCharges,
|
|
20372
20378
|
percentOff,
|
|
20379
|
+
periodEnd,
|
|
20373
20380
|
periodStart,
|
|
20374
20381
|
proration,
|
|
20375
20382
|
taxAmount,
|
|
@@ -20380,12 +20387,14 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
20380
20387
|
dueNow: charges?.dueNow ?? 0,
|
|
20381
20388
|
newCharges: charges?.newCharges ?? 0,
|
|
20382
20389
|
percentOff: charges?.percentOff ?? 0,
|
|
20390
|
+
periodEnd: charges?.periodEnd,
|
|
20383
20391
|
periodStart: charges?.periodStart,
|
|
20384
20392
|
proration: charges?.proration ?? 0,
|
|
20385
20393
|
taxAmount: charges?.taxAmount ?? 0,
|
|
20386
20394
|
taxDescription: charges?.taxDisplayName
|
|
20387
20395
|
};
|
|
20388
20396
|
}, [charges]);
|
|
20397
|
+
const renewDate = periodEnd && !Number.isNaN(periodEnd.getTime()) ? periodEnd : periodStart;
|
|
20389
20398
|
const updatedUsageBasedEntitlements = useMemo18(() => {
|
|
20390
20399
|
const changedUsageBasedEntitlements = [];
|
|
20391
20400
|
const allSelectedUsageBasedEntitlements = [
|
|
@@ -21275,7 +21284,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
21275
21284
|
}
|
|
21276
21285
|
) : subscriptionPrice && // TODO: localize
|
|
21277
21286
|
`You will be billed ${subscriptionPrice} ${usageBasedEntitlements.length > 0 ? "plus usage based costs" : ""} for this subscription
|
|
21278
|
-
every ${planPeriod} ${
|
|
21287
|
+
every ${planPeriod} ${renewDate ? `on the ${formatOrdinal(renewDate.getDate())}` : ""} ${planPeriod === "year" && renewDate ? `of ${getMonthName(renewDate)}` : ""} unless you unsubscribe.` }) })
|
|
21279
21288
|
]
|
|
21280
21289
|
}
|
|
21281
21290
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematichq/schematic-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.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",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@schematichq/schematic-icons": "^0.8.0",
|
|
58
58
|
"@stripe/stripe-js": "^9.9.0",
|
|
59
|
-
"i18next": "^26.3.
|
|
59
|
+
"i18next": "^26.3.6",
|
|
60
60
|
"lodash": "^4.18.1",
|
|
61
61
|
"pako": "^3.0.1",
|
|
62
62
|
"react-i18next": "16.1.6",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"globals": "^17.7.0",
|
|
89
89
|
"happy-dom": "^20.10.6",
|
|
90
90
|
"jsdom": "^29.1.1",
|
|
91
|
-
"msw": "^2.
|
|
92
|
-
"prettier": "^3.9.
|
|
91
|
+
"msw": "^2.15.0",
|
|
92
|
+
"prettier": "^3.9.5",
|
|
93
93
|
"react": "^19.2.7",
|
|
94
94
|
"react-dom": "^19.2.7",
|
|
95
95
|
"typescript": "^6.0.3",
|