@hievilmath/browser-formidavim 1.4.33 → 1.4.34

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.
Files changed (3) hide show
  1. package/index.js +89 -89
  2. package/index.mjs +95 -102
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2,7 +2,7 @@ var I6 = Object.defineProperty;
2
2
  var _6 = (e, r, i) => r in e ? I6(e, r, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[r] = i;
3
3
  var y0 = (e, r, i) => _6(e, typeof r != "symbol" ? r + "" : r, i);
4
4
  import * as Re from "react";
5
- import Qs, { useState as Jt, useEffect as Tn, useRef as Hu, useCallback as br, forwardRef as F6, useContext as V6, useMemo as j6 } from "react";
5
+ import Qs, { useState as Zt, useEffect as Tn, useRef as Hu, useCallback as br, forwardRef as F6, useContext as V6, useMemo as j6 } from "react";
6
6
  import { Link as XC } from "react-router-dom";
7
7
  import _e, { css as Bt, ThemeProvider as U6 } from "styled-components";
8
8
  import { useDispatch as B6, useSelector as pp, Provider as z6 } from "react-redux";
@@ -4672,7 +4672,7 @@ const w5 = {
4672
4672
  margin-bottom: 4px;
4673
4673
  `, RO = ({ formComponent: e }) => {
4674
4674
  var j;
4675
- const { getFlowValue: r, setFlowAndPatientValue: i, getFlowError: s } = Lr(), [c, p] = Jt({}), d = e.props, v = (d == null ? void 0 : d.options) || [], b = [], S = r(d.propertyId), T = s(d.propertyId), w = !!T && T !== "Required";
4675
+ const { getFlowValue: r, setFlowAndPatientValue: i, getFlowError: s } = Lr(), [c, p] = Zt({}), d = e.props, v = (d == null ? void 0 : d.options) || [], b = [], S = r(d.propertyId), T = s(d.propertyId), w = !!T && T !== "Required";
4676
4676
  d.propertyId || b.push("Error");
4677
4677
  const R = (d == null ? void 0 : d.required) === "true";
4678
4678
  Tn(() => {
@@ -5060,7 +5060,7 @@ const Z5 = _e.div`
5060
5060
  }
5061
5061
  ) });
5062
5062
  }, aL = ({ formComponent: e }) => {
5063
- const r = e.props, { propertyId: i, label: s = "Text Area Input" } = r || {}, { getFlowValue: c, setFlowAndPatientValue: p, getFlowError: d } = Lr(), v = c(r.propertyId), b = d(i), S = !!b && b !== "Required", T = (r == null ? void 0 : r.options) || [], [w, R] = Jt(!1), A = () => {
5063
+ const r = e.props, { propertyId: i, label: s = "Text Area Input" } = r || {}, { getFlowValue: c, setFlowAndPatientValue: p, getFlowError: d } = Lr(), v = c(r.propertyId), b = d(i), S = !!b && b !== "Required", T = (r == null ? void 0 : r.options) || [], [w, R] = Zt(!1), A = () => {
5064
5064
  w || R(!0);
5065
5065
  }, L = (P) => {
5066
5066
  const { value: j } = P.target;
@@ -5118,7 +5118,7 @@ const Z5 = _e.div`
5118
5118
  ] }) : null
5119
5119
  ] });
5120
5120
  }, lL = ({ formComponent: e }) => {
5121
- const r = e.props, { propertyId: i, label: s = "Input Label" } = r || {}, { getFlowValue: c, setFlowAndPatientValue: p, getPatientValue: d, getFlowError: v } = Lr(), b = c(i), S = v(i), T = !!S && S !== "Required", w = d("dosing"), [R, A] = Jt(!1);
5121
+ const r = e.props, { propertyId: i, label: s = "Input Label" } = r || {}, { getFlowValue: c, setFlowAndPatientValue: p, getPatientValue: d, getFlowError: v } = Lr(), b = c(i), S = v(i), T = !!S && S !== "Required", w = d("dosing"), [R, A] = Zt(!1);
5122
5122
  if (!w)
5123
5123
  return /* @__PURE__ */ I.jsx("p", { children: "Titration options not available for preview" });
5124
5124
  const L = Object.values(w)[0], P = typeof L == "object" && L !== null && "titrations" in L ? L.titrations : [], j = () => {
@@ -10216,7 +10216,7 @@ const hv = (e) => {
10216
10216
  apiUrl: r.api
10217
10217
  });
10218
10218
  }, vL = ({ formComponent: e, formidavimHost: r }) => {
10219
- const i = e.props, { required: s, maxLength: c, propertyId: p, label: d = "Email", inlineCopy: v } = i || {}, { getFlowValue: b, setFlowAndPatientValue: S, getFlowError: T, setFlowError: w, setDisableSubmitValue: R, setFlowValue: A } = Lr(), L = Rp(b(p)), [P, j] = Jt(""), [G, Y] = Jt(!1), [k, V] = Jt(null), N = Hu(!1), z = hv(r), Z = br(async (he) => {
10219
+ const i = e.props, { required: s, maxLength: c, propertyId: p, label: d = "Email", inlineCopy: v } = i || {}, { getFlowValue: b, setFlowAndPatientValue: S, getFlowError: T, setFlowError: w, setDisableSubmitValue: R, setFlowValue: A } = Lr(), L = Rp(b(p)), [P, j] = Zt(""), [G, Y] = Zt(!1), [k, V] = Zt(null), N = Hu(!1), z = hv(r), Z = br(async (he) => {
10220
10220
  if (!he || !hp(he).valid || N.current) {
10221
10221
  V(null);
10222
10222
  return;
@@ -10289,7 +10289,7 @@ const hv = (e) => {
10289
10289
  setFlowError: R,
10290
10290
  setDisableSubmitValue: A,
10291
10291
  setFlowValue: L
10292
- } = Lr(), P = Rp(S(c)), j = b ? Rp(S(b)) : "", G = w(c), Y = b ? w(b) : null, k = !!G && G !== "Required", V = !!Y && Y !== "Required", [N, z] = Jt(!1), [Z, ie] = Jt(!1), [ge, M] = Jt(""), [se, Ee] = Jt(""), he = (Te) => {
10292
+ } = Lr(), P = Rp(S(c)), j = b ? Rp(S(b)) : "", G = w(c), Y = b ? w(b) : null, k = !!G && G !== "Required", V = !!Y && Y !== "Required", [N, z] = Zt(!1), [Z, ie] = Zt(!1), [ge, M] = Zt(""), [se, Ee] = Zt(""), he = (Te) => {
10293
10293
  if (Te.length < v) return !1;
10294
10294
  const B = /[a-z]/.test(Te), W = /[A-Z]/.test(Te), Oe = /\d/.test(Te), Ue = /[^A-Za-z0-9]/.test(Te);
10295
10295
  return B && W && Oe && Ue;
@@ -10460,7 +10460,7 @@ const hv = (e) => {
10460
10460
  ] })
10461
10461
  ] });
10462
10462
  }, gL = ({ formComponent: e, formidavimHost: r }) => {
10463
- const i = e.props, { required: s, maxLength: c, propertyId: p, label: d = "Phone Number" } = i || {}, { getFlowValue: v, setFlowAndPatientValue: b, getFlowError: S, setFlowError: T, setDisableSubmitValue: w, setFlowValue: R } = Lr(), A = Rp(v(p)), [L, P] = Jt(A), [j, G] = Jt(!1), [Y, k] = Jt(null), V = Hu(!1), N = hv(r), z = br(async (Ce) => {
10463
+ const i = e.props, { required: s, maxLength: c, propertyId: p, label: d = "Phone Number" } = i || {}, { getFlowValue: v, setFlowAndPatientValue: b, getFlowError: S, setFlowError: T, setDisableSubmitValue: w, setFlowValue: R } = Lr(), A = Rp(v(p)), [L, P] = Zt(A), [j, G] = Zt(!1), [Y, k] = Zt(null), V = Hu(!1), N = hv(r), z = br(async (Ce) => {
10464
10464
  if (!Ce || !ie(Ce) || V.current) {
10465
10465
  k(null);
10466
10466
  return;
@@ -29453,7 +29453,7 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29453
29453
  {
29454
29454
  var Px = function() {
29455
29455
  d("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
29456
- }, Zt = function() {
29456
+ }, Jt = function() {
29457
29457
  d("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks");
29458
29458
  };
29459
29459
  tT = {
@@ -29757,25 +29757,25 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29757
29757
  return Px(), io(t);
29758
29758
  },
29759
29759
  useCallback: function(t, n) {
29760
- return He = "useCallback", Zt(), Vn(), Rx(t, n);
29760
+ return He = "useCallback", Jt(), Vn(), Rx(t, n);
29761
29761
  },
29762
29762
  useContext: function(t) {
29763
- return He = "useContext", Zt(), Vn(), io(t);
29763
+ return He = "useContext", Jt(), Vn(), io(t);
29764
29764
  },
29765
29765
  useEffect: function(t, n) {
29766
- return He = "useEffect", Zt(), Vn(), Lg(t, n);
29766
+ return He = "useEffect", Jt(), Vn(), Lg(t, n);
29767
29767
  },
29768
29768
  useImperativeHandle: function(t, n, l) {
29769
- return He = "useImperativeHandle", Zt(), Vn(), Tx(t, n, l);
29769
+ return He = "useImperativeHandle", Jt(), Vn(), Tx(t, n, l);
29770
29770
  },
29771
29771
  useInsertionEffect: function(t, n) {
29772
- return He = "useInsertionEffect", Zt(), Vn(), wx(t, n);
29772
+ return He = "useInsertionEffect", Jt(), Vn(), wx(t, n);
29773
29773
  },
29774
29774
  useLayoutEffect: function(t, n) {
29775
- return He = "useLayoutEffect", Zt(), Vn(), Ex(t, n);
29775
+ return He = "useLayoutEffect", Jt(), Vn(), Ex(t, n);
29776
29776
  },
29777
29777
  useMemo: function(t, n) {
29778
- He = "useMemo", Zt(), Vn();
29778
+ He = "useMemo", Jt(), Vn();
29779
29779
  var l = wt.current;
29780
29780
  wt.current = Gl;
29781
29781
  try {
@@ -29785,7 +29785,7 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29785
29785
  }
29786
29786
  },
29787
29787
  useReducer: function(t, n, l) {
29788
- He = "useReducer", Zt(), Vn();
29788
+ He = "useReducer", Jt(), Vn();
29789
29789
  var u = wt.current;
29790
29790
  wt.current = Gl;
29791
29791
  try {
@@ -29795,10 +29795,10 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29795
29795
  }
29796
29796
  },
29797
29797
  useRef: function(t) {
29798
- return He = "useRef", Zt(), Vn(), Cx(t);
29798
+ return He = "useRef", Jt(), Vn(), Cx(t);
29799
29799
  },
29800
29800
  useState: function(t) {
29801
- He = "useState", Zt(), Vn();
29801
+ He = "useState", Jt(), Vn();
29802
29802
  var n = wt.current;
29803
29803
  wt.current = Gl;
29804
29804
  try {
@@ -29808,22 +29808,22 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29808
29808
  }
29809
29809
  },
29810
29810
  useDebugValue: function(t, n) {
29811
- return He = "useDebugValue", Zt(), Vn(), void 0;
29811
+ return He = "useDebugValue", Jt(), Vn(), void 0;
29812
29812
  },
29813
29813
  useDeferredValue: function(t) {
29814
- return He = "useDeferredValue", Zt(), Vn(), $x(t);
29814
+ return He = "useDeferredValue", Jt(), Vn(), $x(t);
29815
29815
  },
29816
29816
  useTransition: function() {
29817
- return He = "useTransition", Zt(), Vn(), Ax();
29817
+ return He = "useTransition", Jt(), Vn(), Ax();
29818
29818
  },
29819
29819
  useMutableSource: function(t, n, l) {
29820
- return He = "useMutableSource", Zt(), Vn(), void 0;
29820
+ return He = "useMutableSource", Jt(), Vn(), void 0;
29821
29821
  },
29822
29822
  useSyncExternalStore: function(t, n, l) {
29823
- return He = "useSyncExternalStore", Zt(), Vn(), bx(t, n, l);
29823
+ return He = "useSyncExternalStore", Jt(), Vn(), bx(t, n, l);
29824
29824
  },
29825
29825
  useId: function() {
29826
- return He = "useId", Zt(), Vn(), kx();
29826
+ return He = "useId", Jt(), Vn(), kx();
29827
29827
  },
29828
29828
  unstable_isNewReconciler: pe
29829
29829
  }, ll = {
@@ -29831,25 +29831,25 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29831
29831
  return Px(), io(t);
29832
29832
  },
29833
29833
  useCallback: function(t, n) {
29834
- return He = "useCallback", Zt(), yt(), jg(t, n);
29834
+ return He = "useCallback", Jt(), yt(), jg(t, n);
29835
29835
  },
29836
29836
  useContext: function(t) {
29837
- return He = "useContext", Zt(), yt(), io(t);
29837
+ return He = "useContext", Jt(), yt(), io(t);
29838
29838
  },
29839
29839
  useEffect: function(t, n) {
29840
- return He = "useEffect", Zt(), yt(), xm(t, n);
29840
+ return He = "useEffect", Jt(), yt(), xm(t, n);
29841
29841
  },
29842
29842
  useImperativeHandle: function(t, n, l) {
29843
- return He = "useImperativeHandle", Zt(), yt(), Fg(t, n, l);
29843
+ return He = "useImperativeHandle", Jt(), yt(), Fg(t, n, l);
29844
29844
  },
29845
29845
  useInsertionEffect: function(t, n) {
29846
- return He = "useInsertionEffect", Zt(), yt(), Ig(t, n);
29846
+ return He = "useInsertionEffect", Jt(), yt(), Ig(t, n);
29847
29847
  },
29848
29848
  useLayoutEffect: function(t, n) {
29849
- return He = "useLayoutEffect", Zt(), yt(), _g(t, n);
29849
+ return He = "useLayoutEffect", Jt(), yt(), _g(t, n);
29850
29850
  },
29851
29851
  useMemo: function(t, n) {
29852
- He = "useMemo", Zt(), yt();
29852
+ He = "useMemo", Jt(), yt();
29853
29853
  var l = wt.current;
29854
29854
  wt.current = ll;
29855
29855
  try {
@@ -29859,7 +29859,7 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29859
29859
  }
29860
29860
  },
29861
29861
  useReducer: function(t, n, l) {
29862
- He = "useReducer", Zt(), yt();
29862
+ He = "useReducer", Jt(), yt();
29863
29863
  var u = wt.current;
29864
29864
  wt.current = ll;
29865
29865
  try {
@@ -29869,10 +29869,10 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29869
29869
  }
29870
29870
  },
29871
29871
  useRef: function(t) {
29872
- return He = "useRef", Zt(), yt(), Dg();
29872
+ return He = "useRef", Jt(), yt(), Dg();
29873
29873
  },
29874
29874
  useState: function(t) {
29875
- He = "useState", Zt(), yt();
29875
+ He = "useState", Jt(), yt();
29876
29876
  var n = wt.current;
29877
29877
  wt.current = ll;
29878
29878
  try {
@@ -29882,22 +29882,22 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29882
29882
  }
29883
29883
  },
29884
29884
  useDebugValue: function(t, n) {
29885
- return He = "useDebugValue", Zt(), yt(), Vg();
29885
+ return He = "useDebugValue", Jt(), yt(), Vg();
29886
29886
  },
29887
29887
  useDeferredValue: function(t) {
29888
- return He = "useDeferredValue", Zt(), yt(), GE(t);
29888
+ return He = "useDeferredValue", Jt(), yt(), GE(t);
29889
29889
  },
29890
29890
  useTransition: function() {
29891
- return He = "useTransition", Zt(), yt(), qE();
29891
+ return He = "useTransition", Jt(), yt(), qE();
29892
29892
  },
29893
29893
  useMutableSource: function(t, n, l) {
29894
- return He = "useMutableSource", Zt(), yt(), void 0;
29894
+ return He = "useMutableSource", Jt(), yt(), void 0;
29895
29895
  },
29896
29896
  useSyncExternalStore: function(t, n, l) {
29897
- return He = "useSyncExternalStore", Zt(), yt(), Pg(t, n);
29897
+ return He = "useSyncExternalStore", Jt(), yt(), Pg(t, n);
29898
29898
  },
29899
29899
  useId: function() {
29900
- return He = "useId", Zt(), yt(), Bg();
29900
+ return He = "useId", Jt(), yt(), Bg();
29901
29901
  },
29902
29902
  unstable_isNewReconciler: pe
29903
29903
  }, Hg = {
@@ -29905,25 +29905,25 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29905
29905
  return Px(), io(t);
29906
29906
  },
29907
29907
  useCallback: function(t, n) {
29908
- return He = "useCallback", Zt(), yt(), jg(t, n);
29908
+ return He = "useCallback", Jt(), yt(), jg(t, n);
29909
29909
  },
29910
29910
  useContext: function(t) {
29911
- return He = "useContext", Zt(), yt(), io(t);
29911
+ return He = "useContext", Jt(), yt(), io(t);
29912
29912
  },
29913
29913
  useEffect: function(t, n) {
29914
- return He = "useEffect", Zt(), yt(), xm(t, n);
29914
+ return He = "useEffect", Jt(), yt(), xm(t, n);
29915
29915
  },
29916
29916
  useImperativeHandle: function(t, n, l) {
29917
- return He = "useImperativeHandle", Zt(), yt(), Fg(t, n, l);
29917
+ return He = "useImperativeHandle", Jt(), yt(), Fg(t, n, l);
29918
29918
  },
29919
29919
  useInsertionEffect: function(t, n) {
29920
- return He = "useInsertionEffect", Zt(), yt(), Ig(t, n);
29920
+ return He = "useInsertionEffect", Jt(), yt(), Ig(t, n);
29921
29921
  },
29922
29922
  useLayoutEffect: function(t, n) {
29923
- return He = "useLayoutEffect", Zt(), yt(), _g(t, n);
29923
+ return He = "useLayoutEffect", Jt(), yt(), _g(t, n);
29924
29924
  },
29925
29925
  useMemo: function(t, n) {
29926
- He = "useMemo", Zt(), yt();
29926
+ He = "useMemo", Jt(), yt();
29927
29927
  var l = wt.current;
29928
29928
  wt.current = ll;
29929
29929
  try {
@@ -29933,7 +29933,7 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29933
29933
  }
29934
29934
  },
29935
29935
  useReducer: function(t, n, l) {
29936
- He = "useReducer", Zt(), yt();
29936
+ He = "useReducer", Jt(), yt();
29937
29937
  var u = wt.current;
29938
29938
  wt.current = ll;
29939
29939
  try {
@@ -29943,10 +29943,10 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29943
29943
  }
29944
29944
  },
29945
29945
  useRef: function(t) {
29946
- return He = "useRef", Zt(), yt(), Dg();
29946
+ return He = "useRef", Jt(), yt(), Dg();
29947
29947
  },
29948
29948
  useState: function(t) {
29949
- He = "useState", Zt(), yt();
29949
+ He = "useState", Jt(), yt();
29950
29950
  var n = wt.current;
29951
29951
  wt.current = ll;
29952
29952
  try {
@@ -29956,22 +29956,22 @@ Incoming: %s`, He, "[" + n.join(", ") + "]", "[" + t.join(", ") + "]");
29956
29956
  }
29957
29957
  },
29958
29958
  useDebugValue: function(t, n) {
29959
- return He = "useDebugValue", Zt(), yt(), Vg();
29959
+ return He = "useDebugValue", Jt(), yt(), Vg();
29960
29960
  },
29961
29961
  useDeferredValue: function(t) {
29962
- return He = "useDeferredValue", Zt(), yt(), WE(t);
29962
+ return He = "useDeferredValue", Jt(), yt(), WE(t);
29963
29963
  },
29964
29964
  useTransition: function() {
29965
- return He = "useTransition", Zt(), yt(), QE();
29965
+ return He = "useTransition", Jt(), yt(), QE();
29966
29966
  },
29967
29967
  useMutableSource: function(t, n, l) {
29968
- return He = "useMutableSource", Zt(), yt(), void 0;
29968
+ return He = "useMutableSource", Jt(), yt(), void 0;
29969
29969
  },
29970
29970
  useSyncExternalStore: function(t, n, l) {
29971
- return He = "useSyncExternalStore", Zt(), yt(), Pg(t, n);
29971
+ return He = "useSyncExternalStore", Jt(), yt(), Pg(t, n);
29972
29972
  },
29973
29973
  useId: function() {
29974
- return He = "useId", Zt(), yt(), Bg();
29974
+ return He = "useId", Jt(), yt(), Bg();
29975
29975
  },
29976
29976
  unstable_isNewReconciler: pe
29977
29977
  };
@@ -42624,9 +42624,9 @@ const tj = sn(Rb)(({ theme: e }) => ({
42624
42624
  justifyContent: "center",
42625
42625
  flexWrap: "wrap"
42626
42626
  })), ij = ({ formComponent: e, formidavimHost: r }) => {
42627
- const i = (e == null ? void 0 : e.props) || {}, s = i.propertyId, c = i.label ?? "Enter verification code", p = typeof i.length == "number" ? i.length : 6, d = typeof i.required == "string" ? i.required.toLowerCase() === "true" : !!i.required, v = i.currentValue, { getFlowValue: b, setFlowAndPatientValue: S, setFlowError: T, setDisableSubmitValue: w } = Lr(), R = s ? b(s) : void 0, A = v && v.length === p ? v : typeof R == "string" && R.length === p ? R : "", [L, P] = Jt(
42627
+ const i = (e == null ? void 0 : e.props) || {}, s = i.propertyId, c = i.label ?? "Enter verification code", p = typeof i.length == "number" ? i.length : 6, d = typeof i.required == "string" ? i.required.toLowerCase() === "true" : !!i.required, v = i.currentValue, { getFlowValue: b, setFlowAndPatientValue: S, setFlowError: T, setDisableSubmitValue: w } = Lr(), R = s ? b(s) : void 0, A = v && v.length === p ? v : typeof R == "string" && R.length === p ? R : "", [L, P] = Zt(
42628
42628
  A ? A.split("") : new Array(p).fill("")
42629
- ), [j, G] = Jt(!!(A && A.length === p)), [Y, k] = Jt(!1), [V, N] = Jt(null), [z, Z] = Jt(null), [ie, ge] = Jt(!1), [M, se] = Jt(0), [Ee, he] = Jt(0), [Ce, ce] = Jt(0), [fe, ve] = Jt(!1), pe = Hu([]), ne = b("_phone"), ee = b("email"), Te = hv(r), B = (X) => {
42629
+ ), [j, G] = Zt(!!(A && A.length === p)), [Y, k] = Zt(!1), [V, N] = Zt(null), [z, Z] = Zt(null), [ie, ge] = Zt(!1), [M, se] = Zt(0), [Ee, he] = Zt(0), [Ce, ce] = Zt(0), [fe, ve] = Zt(!1), pe = Hu([]), ne = b("_phone"), ee = b("email"), Te = hv(r), B = (X) => {
42630
42630
  const oe = X.replace(/\D/g, "");
42631
42631
  return oe.length === 10 ? `+1${oe}` : X;
42632
42632
  }, W = br(async (X, oe) => {
@@ -43018,14 +43018,14 @@ const sj = _e.div`
43018
43018
  }
43019
43019
  }
43020
43020
  `, hj = ({ formComponent: e }) => {
43021
- const r = e.props, { required: i, propertyId: s, label: c = "Address", inlineCopy: p } = r || {}, { getFlowValue: d, setFlowAndPatientValue: v, getFlowValue: b, getFlowError: S, setFlowError: T } = Lr(), w = b(s) || {}, [R, A] = Jt({
43021
+ const r = e.props, { required: i, propertyId: s, label: c = "Address", inlineCopy: p } = r || {}, { getFlowValue: d, setFlowAndPatientValue: v, getFlowValue: b, getFlowError: S, setFlowError: T } = Lr(), w = b(s) || {}, [R, A] = Zt({
43022
43022
  address1: w.address1 || "",
43023
43023
  address2: w.address2 || "",
43024
43024
  city: w.city || "",
43025
43025
  state: w.state || "",
43026
43026
  postcode: w.postcode || "",
43027
43027
  coordinates: w.coordinates
43028
- }), [L, P] = Jt([]), [j, G] = Jt(!1), [Y, k] = Jt(!1), [V, N] = Jt(!1), [z, Z] = Jt("prompt"), ie = Hu(), ge = "pk.eyJ1IjoiYW50aG9ueS1pdmltIiwiYSI6ImNsdXY4M245OTAwcmoya3BiY3RwOHU2aGoifQ.WKeVR5UV446JNt1PxJgccg", M = (ve, pe) => {
43028
+ }), [L, P] = Zt([]), [j, G] = Zt(!1), [Y, k] = Zt(!1), [V, N] = Zt(!1), [z, Z] = Zt("prompt"), ie = Hu(), ge = "pk.eyJ1IjoiYW50aG9ueS1pdmltIiwiYSI6ImNsdXY4M245OTAwcmoya3BiY3RwOHU2aGoifQ.WKeVR5UV446JNt1PxJgccg", M = (ve, pe) => {
43029
43029
  const ne = { ...R, [ve]: pe };
43030
43030
  A(ne), v(s, ne), ve === "address1" && pe.length > 1 && se(pe);
43031
43031
  }, se = async (ve) => {
@@ -43230,42 +43230,35 @@ const sj = _e.div`
43230
43230
  ] }) : null
43231
43231
  ] });
43232
43232
  }, mj = ({ formComponent: e, formidavimHost: r }) => {
43233
- const i = e.props, { propertyId: s, label: c = "Hidden Field", jsonataExpression: p } = i || {}, { getFlowValue: d, setFlowAndPatientValue: v, getFlowError: b, setFlowError: S, setDisableSubmitValue: T, setFlowValue: w } = Lr(), R = Rp(d(s)), [A, L] = Jt("");
43234
- Tn(() => {
43235
- R ? L(R) : (v(s, ""), L("")), T(!1);
43236
- }, [s, v, T]), Tn(() => {
43237
- if (p != null) {
43238
- const G = String(p);
43239
- v(s, G), L(G), S(s, null), T(!1), console.log("Hidden component - stored evaluated value:", p);
43240
- } else
43241
- console.log("Hidden component - no value, setting default"), v(s, ""), L(""), S(s, null), T(!1);
43242
- }, [p, s, v, S, T]);
43243
- const j = !!b(s);
43244
- return /* @__PURE__ */ I.jsxs(si, { $visible: !1, $hasError: j, children: [
43245
- /* @__PURE__ */ I.jsx(
43246
- "input",
43247
- {
43248
- id: s,
43249
- name: s,
43250
- type: "text",
43251
- value: A,
43252
- readOnly: !0,
43253
- className: j ? "error" : "",
43254
- style: {
43255
- position: "absolute",
43256
- left: "-9999px",
43257
- opacity: 0,
43258
- pointerEvents: "none",
43259
- width: "1px",
43260
- height: "1px",
43261
- overflow: "hidden"
43262
- },
43263
- "aria-hidden": "true",
43264
- tabIndex: -1
43265
- }
43266
- ),
43267
- /* @__PURE__ */ I.jsx("label", { htmlFor: s, style: { display: "none" }, children: c })
43268
- ] });
43233
+ const i = e.props, { propertyId: s, jsonataExpression: c } = i || {}, { getFlowValue: p, setFlowAndPatientValue: d } = Lr(), v = Rp(p(s)), [b, S] = Zt(""), [T, w] = Zt(!1);
43234
+ return Tn(() => {
43235
+ if (!T) {
43236
+ const R = c != null ? String(c) : v || "";
43237
+ d(s, R), S(R), w(!0), c != null && console.log("Hidden component - stored evaluated value:", c);
43238
+ }
43239
+ }, [T, s, c, v, d]), Tn(() => {
43240
+ T && S(v);
43241
+ }, [v, T]), /* @__PURE__ */ I.jsx(si, { $visible: !1, children: /* @__PURE__ */ I.jsx(
43242
+ "input",
43243
+ {
43244
+ id: s,
43245
+ name: s,
43246
+ type: "text",
43247
+ value: b,
43248
+ readOnly: !0,
43249
+ style: {
43250
+ position: "absolute",
43251
+ left: "-9999px",
43252
+ opacity: 0,
43253
+ pointerEvents: "none",
43254
+ width: "1px",
43255
+ height: "1px",
43256
+ overflow: "hidden"
43257
+ },
43258
+ "aria-hidden": "true",
43259
+ tabIndex: -1
43260
+ }
43261
+ ) });
43269
43262
  }, vj = ({ formComponent: e }) => {
43270
43263
  const r = e.props, { propertyId: i, label: s = "Input Label", required: c, lastPrescribedDose: p, concentration: d } = r || {}, { getFlowValue: v, setFlowAndPatientValue: b, getFlowError: S, setFlowError: T } = Lr(), w = Hu(null), R = Hu(!1), L = ((N) => N ? typeof N == "number" ? N : parseFloat(String(N).replace(" mg", "")) || 0 : 0)(v(i)), P = parseFloat((d == null ? void 0 : d.split(" ")[0]) || "0"), j = 100;
43271
43264
  Tn(() => {
@@ -43316,7 +43309,7 @@ const sj = _e.div`
43316
43309
  inlineCopy: S
43317
43310
  } = r || {}, T = typeof v == "string" ? parseInt(v, 10) : v;
43318
43311
  console.log("maxWidthRaw:", v, "maxWidth:", T);
43319
- const w = typeof p == "string" ? p.split(",").map((ie) => ie.trim()) : Array.isArray(p) ? p : ["pdf", "jpg", "jpeg", "png"], { getFlowValue: R, setFlowAndPatientValue: A, getFlowError: L, setFlowError: P, setDisableSubmitValue: j } = Lr(), G = R(s), Y = L(s), k = !!Y && Y !== "Required", [V, N] = Jt(""), z = i === "true";
43312
+ const w = typeof p == "string" ? p.split(",").map((ie) => ie.trim()) : Array.isArray(p) ? p : ["pdf", "jpg", "jpeg", "png"], { getFlowValue: R, setFlowAndPatientValue: A, getFlowError: L, setFlowError: P, setDisableSubmitValue: j } = Lr(), G = R(s), Y = L(s), k = !!Y && Y !== "Required", [V, N] = Zt(""), z = i === "true";
43320
43313
  Tn(() => {
43321
43314
  G ? b && Array.isArray(G) ? N(`${G.length} file(s) selected`) : !b && G && N("File selected") : N("");
43322
43315
  }, [G, b]);
@@ -43695,7 +43688,7 @@ const Hj = _e.div`
43695
43688
  }
43696
43689
  );
43697
43690
  }, qj = ({ formComponent: e }) => {
43698
- const r = e.props, { getFlowValue: i, setFlowAndPatientValue: s, getFlowError: c } = Lr(), [p, d] = Jt(!1), [v, b] = Jt(!1), [S, T] = Jt(!1), [w, R] = Jt(!1), A = Hu(null), L = i(r.propertyId), P = c(r.propertyId), j = !!P && P !== "Required";
43691
+ const r = e.props, { getFlowValue: i, setFlowAndPatientValue: s, getFlowError: c } = Lr(), [p, d] = Zt(!1), [v, b] = Zt(!1), [S, T] = Zt(!1), [w, R] = Zt(!1), A = Hu(null), L = i(r.propertyId), P = c(r.propertyId), j = !!P && P !== "Required";
43699
43692
  Tn(() => {
43700
43693
  T(!!L);
43701
43694
  }, [L]), Tn(() => {
@@ -47876,7 +47869,7 @@ const WA = /* @__PURE__ */ KC(oU), aU = async (e, r, i) => {
47876
47869
  const s = r(i);
47877
47870
  return !(s == null || typeof s == "string" && s.trim() === "" || Array.isArray(s) && s.length === 0);
47878
47871
  }, uU = ({ flow: e, isPreview: r, $bgColor: i, onSubmit: s, onNextStep: c, onPrevStep: p, shouldRedirect: d = !0, formidavimHost: v }) => {
47879
- const [b, S] = Jt(0), [T, w] = Jt([]), [R, A] = Jt(!0), { evaluateCondition: L } = iU(), { getFlowValue: P, getAllFlowData: j, setDisableSubmitValue: G, getDisableSubmitValue: Y, getFlowError: k, setCurrentFormValue: V } = Lr(), N = Lr().getAllFlowData(), z = async (ce) => {
47872
+ const [b, S] = Zt(0), [T, w] = Zt([]), [R, A] = Zt(!0), { evaluateCondition: L } = iU(), { getFlowValue: P, getAllFlowData: j, setDisableSubmitValue: G, getDisableSubmitValue: Y, getFlowError: k, setCurrentFormValue: V } = Lr(), N = Lr().getAllFlowData(), z = async (ce) => {
47880
47873
  if (!ce) return [];
47881
47874
  const fe = [];
47882
47875
  for (const ve of ce) {
@@ -48038,7 +48031,7 @@ const WA = /* @__PURE__ */ KC(oU), aU = async (e, r, i) => {
48038
48031
  return console.error("Error processing flow config templates:", s), e;
48039
48032
  }
48040
48033
  }, qA = ({ data: e, config: r, isPreview: i, onSubmit: s, onNextStep: c, onPrevStep: p, onFlowInit: d, shouldRedirect: v, formidavimHost: b }) => {
48041
- const { setFlowValues: S, resetAndSetFlowValues: T, generateFormDataFromFlow: w, setPatientValues: R, getFullPatient: A, setCurrentFlowValue: L } = Lr(), [P, j] = Jt(null), [G, Y] = Jt(!0), [k, V] = Jt(!1), N = async (Z, ie = !1, ge = !1) => {
48034
+ const { setFlowValues: S, resetAndSetFlowValues: T, generateFormDataFromFlow: w, setPatientValues: R, getFullPatient: A, setCurrentFlowValue: L } = Lr(), [P, j] = Zt(null), [G, Y] = Zt(!0), [k, V] = Zt(!1), N = async (Z, ie = !1, ge = !1) => {
48042
48035
  try {
48043
48036
  const M = await dU(r, Z);
48044
48037
  if (j(M), L(M), ge && d && (r != null && r.id) && (r != null && r.slug) && d(r), ie) {
@@ -48233,7 +48226,7 @@ const xU = ({ formComponent: e, isPreview: r, boundary: i, isVisible: s = !0, fo
48233
48226
  padding: 20px 0px 20px;
48234
48227
  `, wU = ({ children: e, $bgColor: r }) => /* @__PURE__ */ I.jsx(Ep, { $overflow: "visible", $position: "static", $xSmall: !0, id: "MainFlowContainer", $bgColor: r || "white", $bRad: "0px", $marginBottom: "80px", $marginBottomMd: "0px", children: /* @__PURE__ */ I.jsx(CU, { onSubmit: (i) => i.preventDefault(), children: e }) }), EU = ({ dataFetcher: e = () => {
48235
48228
  }, children: r, configFetcher: i, isPreview: s = !1, onSubmit: c = () => Promise.resolve(), formidavimHost: p, version: d, flowName: v = "", onNextStep: b, onPrevStep: S, onFlowInit: T, onConfigFetchError: w, shouldRedirect: R, onFormidavimFallback: A }) => {
48236
- const L = hv(p), [P, j] = Jt({ config: null, data: null }), [G, Y] = Jt(!0);
48229
+ const L = hv(p), [P, j] = Zt({ config: null, data: null }), [G, Y] = Zt(!0);
48237
48230
  if (Tn(() => {
48238
48231
  Y(!0), (i ? i() : L.flowControllerGetBySlug(v, d).then(({ data: N }) => N)).then(async (N) => {
48239
48232
  const z = e ? await e("flow") : null;
@@ -48267,7 +48260,7 @@ const xU = ({ formComponent: e, isPreview: r, boundary: i, isVisible: s = !0, fo
48267
48260
  }
48268
48261
  ) });
48269
48262
  }, MU = ({ dataFetcher: e = () => Promise.resolve(null), children: r, configFetcher: i, pipelineFetcher: s, isPreview: c = !1, onSubmit: p = () => Promise.resolve(), formidavimHost: d, version: v, flowName: b = "", onNextStep: S, onPrevStep: T, onFlowInit: w, onPipelineInit: R, onNoFlowsAvailable: A, onConfigFetchError: L, onFormidavimFallback: P }) => {
48270
- const j = hv(d), [G, Y] = Jt({ config: null, data: null }), [k, V] = Jt([]), [N, z] = Jt({}), [Z, ie] = Jt(!0), [ge, M] = Jt(!1), se = Hu(/* @__PURE__ */ new Set());
48263
+ const j = hv(d), [G, Y] = Zt({ config: null, data: null }), [k, V] = Zt([]), [N, z] = Zt({}), [Z, ie] = Zt(!0), [ge, M] = Zt(!1), se = Hu(/* @__PURE__ */ new Set());
48271
48264
  Tn(() => {
48272
48265
  ie(!0), (s ? s() : j.pipelineControllerGetBySlug(b, v).then(({ data: fe }) => fe)).then(async (fe) => {
48273
48266
  const ve = e ? await e("pipeline") : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hievilmath/browser-formidavim",
3
- "version": "1.4.33",
3
+ "version": "1.4.34",
4
4
  "main": "./index.js",
5
5
  "module": "./index.mjs",
6
6
  "typings": "./index.d.ts",