@schematichq/schematic-components 2.16.1 → 2.16.3
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.
|
@@ -8291,6 +8291,7 @@ function FeatureEntitlementFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8291
8291
|
}
|
|
8292
8292
|
return {
|
|
8293
8293
|
allocation: json["allocation"] == null ? void 0 : json["allocation"],
|
|
8294
|
+
consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
|
|
8294
8295
|
creditId: json["credit_id"] == null ? void 0 : json["credit_id"],
|
|
8295
8296
|
creditRemaining: json["credit_remaining"] == null ? void 0 : json["credit_remaining"],
|
|
8296
8297
|
creditReserved: json["credit_reserved"] == null ? void 0 : json["credit_reserved"],
|
|
@@ -8298,6 +8299,7 @@ function FeatureEntitlementFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8298
8299
|
creditTotal: json["credit_total"] == null ? void 0 : json["credit_total"],
|
|
8299
8300
|
creditUsed: json["credit_used"] == null ? void 0 : json["credit_used"],
|
|
8300
8301
|
eventName: json["event_name"] == null ? void 0 : json["event_name"],
|
|
8302
|
+
eventSubtype: json["event_subtype"] == null ? void 0 : json["event_subtype"],
|
|
8301
8303
|
featureId: json["feature_id"],
|
|
8302
8304
|
featureKey: json["feature_key"],
|
|
8303
8305
|
metricPeriod: json["metric_period"] == null ? void 0 : MetricPeriodFromJSON(json["metric_period"]),
|
|
@@ -13371,7 +13373,7 @@ var reducer = (state, action) => {
|
|
|
13371
13373
|
// src/context/EmbedProvider.tsx
|
|
13372
13374
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
13373
13375
|
var getCustomHeaders = (sessionId) => ({
|
|
13374
|
-
"X-Schematic-Components-Version": "2.16.
|
|
13376
|
+
"X-Schematic-Components-Version": "2.16.3",
|
|
13375
13377
|
"X-Schematic-Session-ID": sessionId
|
|
13376
13378
|
});
|
|
13377
13379
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -13938,6 +13940,9 @@ function useAvailableCurrenciesWithInvalid() {
|
|
|
13938
13940
|
}
|
|
13939
13941
|
function useSubscriptionCurrency() {
|
|
13940
13942
|
const { data } = useEmbed();
|
|
13943
|
+
if (data?.subscription?.isInitial) {
|
|
13944
|
+
return void 0;
|
|
13945
|
+
}
|
|
13941
13946
|
return data?.subscription?.currency?.toUpperCase();
|
|
13942
13947
|
}
|
|
13943
13948
|
|
|
@@ -18932,6 +18937,8 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
18932
18937
|
const [isPaymentComplete, setIsPaymentComplete] = (0, import_react39.useState)(false);
|
|
18933
18938
|
const [isPaymentReady, setIsPaymentReady] = (0, import_react39.useState)(false);
|
|
18934
18939
|
const [loadError, setLoadError] = (0, import_react39.useState)();
|
|
18940
|
+
const [isEmailValid, setIsEmailValid] = (0, import_react39.useState)(() => !collectEmail);
|
|
18941
|
+
const emailInputRef = (0, import_react39.useRef)(null);
|
|
18935
18942
|
const [isAddressComplete, setIsAddressComplete] = (0, import_react39.useState)(
|
|
18936
18943
|
() => !shouldCollectAddress
|
|
18937
18944
|
);
|
|
@@ -18944,6 +18951,11 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
18944
18951
|
setEmail(billing.email);
|
|
18945
18952
|
}
|
|
18946
18953
|
}, [billing?.email]);
|
|
18954
|
+
(0, import_react39.useEffect)(() => {
|
|
18955
|
+
setIsEmailValid(
|
|
18956
|
+
!collectEmail || (emailInputRef.current?.checkValidity() ?? false)
|
|
18957
|
+
);
|
|
18958
|
+
}, [email, collectEmail, stripe]);
|
|
18947
18959
|
const handleSubmit = async (event) => {
|
|
18948
18960
|
event.preventDefault();
|
|
18949
18961
|
if (!stripe || !elements) {
|
|
@@ -19043,11 +19055,13 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
19043
19055
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19044
19056
|
Input2,
|
|
19045
19057
|
{
|
|
19058
|
+
ref: emailInputRef,
|
|
19046
19059
|
id: "email",
|
|
19047
|
-
type: "
|
|
19060
|
+
type: "email",
|
|
19048
19061
|
value: email,
|
|
19049
19062
|
autoComplete: "email",
|
|
19050
19063
|
placeholder: "Enter email address",
|
|
19064
|
+
required: true,
|
|
19051
19065
|
onChange: (e2) => {
|
|
19052
19066
|
userEditedEmailRef.current = true;
|
|
19053
19067
|
setEmail(e2.target.value);
|
|
@@ -19078,7 +19092,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
19078
19092
|
Button,
|
|
19079
19093
|
{
|
|
19080
19094
|
id: "submit",
|
|
19081
|
-
disabled: isLoading || !stripe || !elements || isConfirmed || !isPaymentComplete || !isAddressComplete,
|
|
19095
|
+
disabled: isLoading || !stripe || !elements || isConfirmed || !isPaymentComplete || !isAddressComplete || !isEmailValid,
|
|
19082
19096
|
style: { flexShrink: 0 },
|
|
19083
19097
|
$color: "primary",
|
|
19084
19098
|
$isLoading: isLoading,
|
|
@@ -6949,6 +6949,12 @@ declare interface FeatureEntitlement {
|
|
|
6949
6949
|
* @memberof FeatureEntitlement
|
|
6950
6950
|
*/
|
|
6951
6951
|
allocation?: number | null;
|
|
6952
|
+
/**
|
|
6953
|
+
* If the company has a credit-based entitlement for this feature, the credit cost per unit of usage
|
|
6954
|
+
* @type {number}
|
|
6955
|
+
* @memberof FeatureEntitlement
|
|
6956
|
+
*/
|
|
6957
|
+
consumptionRate?: number | null;
|
|
6952
6958
|
/**
|
|
6953
6959
|
* If the company has a credit-based entitlement for this feature, the ID of the credit
|
|
6954
6960
|
* @type {string}
|
|
@@ -6991,6 +6997,12 @@ declare interface FeatureEntitlement {
|
|
|
6991
6997
|
* @memberof FeatureEntitlement
|
|
6992
6998
|
*/
|
|
6993
6999
|
eventName?: string | null;
|
|
7000
|
+
/**
|
|
7001
|
+
* For event-based or credit-metered feature entitlements, the event subtype whose usage is tracked
|
|
7002
|
+
* @type {string}
|
|
7003
|
+
* @memberof FeatureEntitlement
|
|
7004
|
+
*/
|
|
7005
|
+
eventSubtype?: string | null;
|
|
6994
7006
|
/**
|
|
6995
7007
|
* The ID of the feature
|
|
6996
7008
|
* @type {string}
|
|
@@ -12476,7 +12488,9 @@ export declare function useRequest<TData>(fn: () => Promise<{
|
|
|
12476
12488
|
/**
|
|
12477
12489
|
* Returns the currency of the company's active subscription, if any.
|
|
12478
12490
|
* Stripe does not allow mixing currencies on a subscription, so when
|
|
12479
|
-
* this is set the currency selector should be locked.
|
|
12491
|
+
* this is set the currency selector should be locked. The initial (free,
|
|
12492
|
+
* $0) plan is exempt: its subscription can be switched at checkout, so
|
|
12493
|
+
* we treat it as having no locked currency.
|
|
12480
12494
|
*/
|
|
12481
12495
|
export declare function useSubscriptionCurrency(): string | undefined;
|
|
12482
12496
|
|
|
@@ -8202,6 +8202,7 @@ function FeatureEntitlementFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8202
8202
|
}
|
|
8203
8203
|
return {
|
|
8204
8204
|
allocation: json["allocation"] == null ? void 0 : json["allocation"],
|
|
8205
|
+
consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
|
|
8205
8206
|
creditId: json["credit_id"] == null ? void 0 : json["credit_id"],
|
|
8206
8207
|
creditRemaining: json["credit_remaining"] == null ? void 0 : json["credit_remaining"],
|
|
8207
8208
|
creditReserved: json["credit_reserved"] == null ? void 0 : json["credit_reserved"],
|
|
@@ -8209,6 +8210,7 @@ function FeatureEntitlementFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8209
8210
|
creditTotal: json["credit_total"] == null ? void 0 : json["credit_total"],
|
|
8210
8211
|
creditUsed: json["credit_used"] == null ? void 0 : json["credit_used"],
|
|
8211
8212
|
eventName: json["event_name"] == null ? void 0 : json["event_name"],
|
|
8213
|
+
eventSubtype: json["event_subtype"] == null ? void 0 : json["event_subtype"],
|
|
8212
8214
|
featureId: json["feature_id"],
|
|
8213
8215
|
featureKey: json["feature_key"],
|
|
8214
8216
|
metricPeriod: json["metric_period"] == null ? void 0 : MetricPeriodFromJSON(json["metric_period"]),
|
|
@@ -13282,7 +13284,7 @@ var reducer = (state, action) => {
|
|
|
13282
13284
|
// src/context/EmbedProvider.tsx
|
|
13283
13285
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
13284
13286
|
var getCustomHeaders = (sessionId) => ({
|
|
13285
|
-
"X-Schematic-Components-Version": "2.16.
|
|
13287
|
+
"X-Schematic-Components-Version": "2.16.3",
|
|
13286
13288
|
"X-Schematic-Session-ID": sessionId
|
|
13287
13289
|
});
|
|
13288
13290
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -13849,6 +13851,9 @@ function useAvailableCurrenciesWithInvalid() {
|
|
|
13849
13851
|
}
|
|
13850
13852
|
function useSubscriptionCurrency() {
|
|
13851
13853
|
const { data } = useEmbed();
|
|
13854
|
+
if (data?.subscription?.isInitial) {
|
|
13855
|
+
return void 0;
|
|
13856
|
+
}
|
|
13852
13857
|
return data?.subscription?.currency?.toUpperCase();
|
|
13853
13858
|
}
|
|
13854
13859
|
|
|
@@ -18867,6 +18872,8 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
18867
18872
|
const [isPaymentComplete, setIsPaymentComplete] = useState11(false);
|
|
18868
18873
|
const [isPaymentReady, setIsPaymentReady] = useState11(false);
|
|
18869
18874
|
const [loadError, setLoadError] = useState11();
|
|
18875
|
+
const [isEmailValid, setIsEmailValid] = useState11(() => !collectEmail);
|
|
18876
|
+
const emailInputRef = useRef8(null);
|
|
18870
18877
|
const [isAddressComplete, setIsAddressComplete] = useState11(
|
|
18871
18878
|
() => !shouldCollectAddress
|
|
18872
18879
|
);
|
|
@@ -18879,6 +18886,11 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
18879
18886
|
setEmail(billing.email);
|
|
18880
18887
|
}
|
|
18881
18888
|
}, [billing?.email]);
|
|
18889
|
+
useEffect5(() => {
|
|
18890
|
+
setIsEmailValid(
|
|
18891
|
+
!collectEmail || (emailInputRef.current?.checkValidity() ?? false)
|
|
18892
|
+
);
|
|
18893
|
+
}, [email, collectEmail, stripe]);
|
|
18882
18894
|
const handleSubmit = async (event) => {
|
|
18883
18895
|
event.preventDefault();
|
|
18884
18896
|
if (!stripe || !elements) {
|
|
@@ -18978,11 +18990,13 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
18978
18990
|
/* @__PURE__ */ jsx33(
|
|
18979
18991
|
Input2,
|
|
18980
18992
|
{
|
|
18993
|
+
ref: emailInputRef,
|
|
18981
18994
|
id: "email",
|
|
18982
|
-
type: "
|
|
18995
|
+
type: "email",
|
|
18983
18996
|
value: email,
|
|
18984
18997
|
autoComplete: "email",
|
|
18985
18998
|
placeholder: "Enter email address",
|
|
18999
|
+
required: true,
|
|
18986
19000
|
onChange: (e2) => {
|
|
18987
19001
|
userEditedEmailRef.current = true;
|
|
18988
19002
|
setEmail(e2.target.value);
|
|
@@ -19013,7 +19027,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
19013
19027
|
Button,
|
|
19014
19028
|
{
|
|
19015
19029
|
id: "submit",
|
|
19016
|
-
disabled: isLoading || !stripe || !elements || isConfirmed || !isPaymentComplete || !isAddressComplete,
|
|
19030
|
+
disabled: isLoading || !stripe || !elements || isConfirmed || !isPaymentComplete || !isAddressComplete || !isEmailValid,
|
|
19017
19031
|
style: { flexShrink: 0 },
|
|
19018
19032
|
$color: "primary",
|
|
19019
19033
|
$isLoading: isLoading,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematichq/schematic-components",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.3",
|
|
4
4
|
"main": "dist/schematic-components.cjs.js",
|
|
5
5
|
"module": "dist/schematic-components.esm.js",
|
|
6
6
|
"types": "dist/schematic-components.d.ts",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"eslint-plugin-react": "^7.37.5",
|
|
66
66
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
67
67
|
"globals": "^17.6.0",
|
|
68
|
-
"happy-dom": "^20.10.
|
|
68
|
+
"happy-dom": "^20.10.6",
|
|
69
69
|
"jsdom": "^29.1.1",
|
|
70
70
|
"msw": "^2.14.6",
|
|
71
71
|
"prettier": "^3.8.4",
|