@schematichq/schematic-components 2.16.2 → 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.2",
13376
+ "X-Schematic-Components-Version": "2.16.3",
13375
13377
  "X-Schematic-Session-ID": sessionId
13376
13378
  });
13377
13379
  var normalizeCurrencyFilter = (filter2) => {
@@ -18935,6 +18937,8 @@ var PaymentForm = ({ onConfirm, financeData }) => {
18935
18937
  const [isPaymentComplete, setIsPaymentComplete] = (0, import_react39.useState)(false);
18936
18938
  const [isPaymentReady, setIsPaymentReady] = (0, import_react39.useState)(false);
18937
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);
18938
18942
  const [isAddressComplete, setIsAddressComplete] = (0, import_react39.useState)(
18939
18943
  () => !shouldCollectAddress
18940
18944
  );
@@ -18947,6 +18951,11 @@ var PaymentForm = ({ onConfirm, financeData }) => {
18947
18951
  setEmail(billing.email);
18948
18952
  }
18949
18953
  }, [billing?.email]);
18954
+ (0, import_react39.useEffect)(() => {
18955
+ setIsEmailValid(
18956
+ !collectEmail || (emailInputRef.current?.checkValidity() ?? false)
18957
+ );
18958
+ }, [email, collectEmail, stripe]);
18950
18959
  const handleSubmit = async (event) => {
18951
18960
  event.preventDefault();
18952
18961
  if (!stripe || !elements) {
@@ -19046,11 +19055,13 @@ var PaymentForm = ({ onConfirm, financeData }) => {
19046
19055
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
19047
19056
  Input2,
19048
19057
  {
19058
+ ref: emailInputRef,
19049
19059
  id: "email",
19050
- type: "text",
19060
+ type: "email",
19051
19061
  value: email,
19052
19062
  autoComplete: "email",
19053
19063
  placeholder: "Enter email address",
19064
+ required: true,
19054
19065
  onChange: (e2) => {
19055
19066
  userEditedEmailRef.current = true;
19056
19067
  setEmail(e2.target.value);
@@ -19081,7 +19092,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
19081
19092
  Button,
19082
19093
  {
19083
19094
  id: "submit",
19084
- disabled: isLoading || !stripe || !elements || isConfirmed || !isPaymentComplete || !isAddressComplete,
19095
+ disabled: isLoading || !stripe || !elements || isConfirmed || !isPaymentComplete || !isAddressComplete || !isEmailValid,
19085
19096
  style: { flexShrink: 0 },
19086
19097
  $color: "primary",
19087
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}
@@ -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.2",
13287
+ "X-Schematic-Components-Version": "2.16.3",
13286
13288
  "X-Schematic-Session-ID": sessionId
13287
13289
  });
13288
13290
  var normalizeCurrencyFilter = (filter2) => {
@@ -18870,6 +18872,8 @@ var PaymentForm = ({ onConfirm, financeData }) => {
18870
18872
  const [isPaymentComplete, setIsPaymentComplete] = useState11(false);
18871
18873
  const [isPaymentReady, setIsPaymentReady] = useState11(false);
18872
18874
  const [loadError, setLoadError] = useState11();
18875
+ const [isEmailValid, setIsEmailValid] = useState11(() => !collectEmail);
18876
+ const emailInputRef = useRef8(null);
18873
18877
  const [isAddressComplete, setIsAddressComplete] = useState11(
18874
18878
  () => !shouldCollectAddress
18875
18879
  );
@@ -18882,6 +18886,11 @@ var PaymentForm = ({ onConfirm, financeData }) => {
18882
18886
  setEmail(billing.email);
18883
18887
  }
18884
18888
  }, [billing?.email]);
18889
+ useEffect5(() => {
18890
+ setIsEmailValid(
18891
+ !collectEmail || (emailInputRef.current?.checkValidity() ?? false)
18892
+ );
18893
+ }, [email, collectEmail, stripe]);
18885
18894
  const handleSubmit = async (event) => {
18886
18895
  event.preventDefault();
18887
18896
  if (!stripe || !elements) {
@@ -18981,11 +18990,13 @@ var PaymentForm = ({ onConfirm, financeData }) => {
18981
18990
  /* @__PURE__ */ jsx33(
18982
18991
  Input2,
18983
18992
  {
18993
+ ref: emailInputRef,
18984
18994
  id: "email",
18985
- type: "text",
18995
+ type: "email",
18986
18996
  value: email,
18987
18997
  autoComplete: "email",
18988
18998
  placeholder: "Enter email address",
18999
+ required: true,
18989
19000
  onChange: (e2) => {
18990
19001
  userEditedEmailRef.current = true;
18991
19002
  setEmail(e2.target.value);
@@ -19016,7 +19027,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
19016
19027
  Button,
19017
19028
  {
19018
19029
  id: "submit",
19019
- disabled: isLoading || !stripe || !elements || isConfirmed || !isPaymentComplete || !isAddressComplete,
19030
+ disabled: isLoading || !stripe || !elements || isConfirmed || !isPaymentComplete || !isAddressComplete || !isEmailValid,
19020
19031
  style: { flexShrink: 0 },
19021
19032
  $color: "primary",
19022
19033
  $isLoading: isLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematichq/schematic-components",
3
- "version": "2.16.2",
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.5",
68
+ "happy-dom": "^20.10.6",
69
69
  "jsdom": "^29.1.1",
70
70
  "msw": "^2.14.6",
71
71
  "prettier": "^3.8.4",