@hievilmath/browser-formidavim 1.4.13 → 1.4.14
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 +5 -0
- package/index.js +1 -1
- package/index.mjs +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,11 @@ Quick notes about changes made to this package for each version.
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## Version 1.4.14
|
|
8
|
+
- Fix pipeline condition evaluator evalutating data at the correct level in patient profile AGAIN
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
7
12
|
## Version 1.4.13
|
|
8
13
|
- Fix pipeline condition evaluator evalutating data at the correct level in patient profile
|
|
9
14
|
|
package/index.js
CHANGED
|
@@ -3358,4 +3358,4 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
3358
3358
|
position: relative;
|
|
3359
3359
|
`,Cw=({$isPreview:e,children:r})=>L.jsx(Fu.Provider,{store:cU,children:L.jsx(xe.ThemeProvider,{theme:uU,children:L.jsx(fU,{$isPreview:e,children:L.jsx(dU,{children:r})})})}),QA=({flowForm:e,isPreview:r,evaluatedFormComponents:i,formidavimHost:s})=>!e||!e.form?null:L.jsx(KA,{form:e.form,isPreview:r,evaluatedFormComponents:i,formidavimHost:s}),ww=class ww{static register(r,i){this.registry[r]=i}static getComponent(r){return this.registry[r]||null}static hasComponent(r){return r in this.registry}static getRegisteredComponents(){return Object.keys(this.registry)}};ww.registry={...Kj};let q0=ww;const XA=({formComponent:e,isPreview:r,boundary:i,isVisible:s=!0,formidavimHost:c})=>{var f;const p=v=>{const b=v.componentId;if(!b)return L.jsx(Cp,{errors:["Missing componentId"]});const S=q0.getComponent(b);return S?L.jsx(S,{formComponent:v,formidavimHost:c}):L.jsx(Cp,{errors:[`Unknown component type: ${b}`]})};return L.jsx(Q0,{children:L.jsx(lv,{$span:"12",children:L.jsx(nM,{$margin:(f=e.props)==null?void 0:f.margin,$boundary:i,children:p(e)})})})},KA=({form:e,isPreview:r,evaluatedFormComponents:i,formidavimHost:s})=>{const c=r?i:i.filter(f=>f.shouldRender),p=c.length;return L.jsx(L.Fragment,{children:c.map((f,v)=>{const b=v===0?"first":p===v+1?"last":null,S=f.isVisible;return L.jsx(XA,{formComponent:f,isPreview:r,boundary:b,isVisible:S,formidavimHost:s},f.id)})})},pU=xe.form`
|
|
3360
3360
|
padding: 20px 0px 20px;
|
|
3361
|
-
`,ZA=({children:e,$bgColor:r})=>L.jsx(bp,{$overflow:"visible",$position:"static",$xSmall:!0,id:"MainFlowContainer",$bgColor:r||"white",$bRad:"0px",$marginBottom:"80px",$marginBottomMd:"0px",children:L.jsx(pU,{onSubmit:i=>i.preventDefault(),children:e})}),JA=({dataFetcher:e=()=>{},children:r,configFetcher:i,isPreview:s=!1,onSubmit:c=()=>Promise.resolve(),formidavimHost:p,version:f,flowName:v="",onNextStep:b,onPrevStep:S,onFlowInit:T,onConfigFetchError:w,shouldRedirect:R,onFormidavimFallback:A})=>{const M=uv(p),[k,j]=Ve.useState({config:null,data:null}),[G,W]=Ve.useState(!0);return Ve.useEffect(()=>{(i?i():M.flowControllerGetBySlug(v,f).then(({data:V})=>V)).then(async V=>{const D=e?await e("flow"):null;j({config:V,data:D}),W(!1)}).catch(V=>{console.warn("configFetcher failed",V),w&&w(V),W(!1)})},[v,f]),G?null:k.config?L.jsx(Cw,{children:L.jsx(Sw,{data:k.data,isPreview:s,config:k.config,onSubmit:c,onNextStep:b,onPrevStep:S,onFlowInit:T,shouldRedirect:R,formidavimHost:p})}):(A&&A(),L.jsx(L.Fragment,{children:r}))},hU=({dataFetcher:e=()=>Promise.resolve(null),children:r,configFetcher:i,pipelineFetcher:s,isPreview:c=!1,onSubmit:p=()=>Promise.resolve(),formidavimHost:f,version:v,flowName:b="",onNextStep:S,onPrevStep:T,onFlowInit:w,onPipelineInit:R,onNoFlowsAvailable:A,onConfigFetchError:M,onFormidavimFallback:k})=>{const j=uv(f),[G,W]=Ve.useState({config:null,data:null}),[P,V]=Ve.useState([]),[D,H]=Ve.useState({}),[Z,ie]=Ve.useState(!0),[ae,I]=Ve.useState(!1);Ve.useEffect(()=>{(s?s():j.pipelineControllerGetBySlug(b,v).then(({data:pe})=>pe)).then(async pe=>{const le=e?await e("pipeline"):null;if(W({config:pe,data:le}),pe!=null&&pe.pipelineFlows&&(await ve(pe.pipelineFlows,le.data)).length===0){A&&A();return}R&&R(pe),ie(!1)}).catch(pe=>{console.warn("configFetcher failed",pe),M&&M(pe),ie(!1)})},[b,v]),Ve.useEffect(()=>{var pe;const de=((pe=P==null?void 0:P[0])==null?void 0:pe.flow)||{};H(de)},[P]);const ve=async(de,pe)=>{var se;const le=[],he=ee=>pe==null?void 0:pe[ee],Te=()=>pe,we=(ee,Re)=>{const B=pe==null?void 0:pe.flow_submissions;return!(!B||!B[ee])};for(const ee of de)we(ee.flowSlug,(se=ee.flow)==null?void 0:se.version)||ee.condition&&!await YA(ee.condition,he,Te)||le.push(ee);return V(le),le};if(Z)return null;if(!G.config)return L.jsx(JA,{dataFetcher:e,configFetcher:i,flowName:b,formidavimHost:f,onSubmit:p,isPreview:!1,onNextStep:S,onPrevStep:T,onFlowInit:w,onFormidavimFallback:k,children:r});const Ee=async de=>{var pe;if(!ae){I(!0);try{const le=await p(de,D),he=e?await e("pipeline"):null;if(W(Te=>({...Te,data:he})),(pe=G.config)!=null&&pe.pipelineFlows){const Te=await ve(G.config.pipelineFlows,he);if(Object.keys(Te).length===0&&le&&typeof le=="function"){le();return}}else if(le&&typeof le=="function"){le();return}}finally{I(!1)}}};return L.jsx(Cw,{children:L.jsx(Sw,{data:G.data,isPreview:c,config:D,onSubmit:Ee,onNextStep:S,onPrevStep:T,onFlowInit:w,shouldRedirect:!1,formidavimHost:f})})};exports.ComponentFactory=q0;exports.DataRenderer=JA;exports.FlowFormRenderer=QA;exports.FlowProgressTracker=e3;exports.FlowRenderer=qA;exports.FormComponentRenderer=XA;exports.FormRenderer=KA;exports.FormWrapper=ZA;exports.PipelineProcessor=hU;exports.Renderer=Sw;exports.RendererWrapper=Cw;
|
|
3361
|
+
`,ZA=({children:e,$bgColor:r})=>L.jsx(bp,{$overflow:"visible",$position:"static",$xSmall:!0,id:"MainFlowContainer",$bgColor:r||"white",$bRad:"0px",$marginBottom:"80px",$marginBottomMd:"0px",children:L.jsx(pU,{onSubmit:i=>i.preventDefault(),children:e})}),JA=({dataFetcher:e=()=>{},children:r,configFetcher:i,isPreview:s=!1,onSubmit:c=()=>Promise.resolve(),formidavimHost:p,version:f,flowName:v="",onNextStep:b,onPrevStep:S,onFlowInit:T,onConfigFetchError:w,shouldRedirect:R,onFormidavimFallback:A})=>{const M=uv(p),[k,j]=Ve.useState({config:null,data:null}),[G,W]=Ve.useState(!0);return Ve.useEffect(()=>{(i?i():M.flowControllerGetBySlug(v,f).then(({data:V})=>V)).then(async V=>{const D=e?await e("flow"):null;j({config:V,data:D}),W(!1)}).catch(V=>{console.warn("configFetcher failed",V),w&&w(V),W(!1)})},[v,f]),G?null:k.config?L.jsx(Cw,{children:L.jsx(Sw,{data:k.data,isPreview:s,config:k.config,onSubmit:c,onNextStep:b,onPrevStep:S,onFlowInit:T,shouldRedirect:R,formidavimHost:p})}):(A&&A(),L.jsx(L.Fragment,{children:r}))},hU=({dataFetcher:e=()=>Promise.resolve(null),children:r,configFetcher:i,pipelineFetcher:s,isPreview:c=!1,onSubmit:p=()=>Promise.resolve(),formidavimHost:f,version:v,flowName:b="",onNextStep:S,onPrevStep:T,onFlowInit:w,onPipelineInit:R,onNoFlowsAvailable:A,onConfigFetchError:M,onFormidavimFallback:k})=>{const j=uv(f),[G,W]=Ve.useState({config:null,data:null}),[P,V]=Ve.useState([]),[D,H]=Ve.useState({}),[Z,ie]=Ve.useState(!0),[ae,I]=Ve.useState(!1);Ve.useEffect(()=>{(s?s():j.pipelineControllerGetBySlug(b,v).then(({data:pe})=>pe)).then(async pe=>{const le=e?await e("pipeline"):null;if(W({config:pe,data:le}),pe!=null&&pe.pipelineFlows&&(await ve(pe.pipelineFlows,le.data)).length===0){A&&A();return}R&&R(pe),ie(!1)}).catch(pe=>{console.warn("configFetcher failed",pe),M&&M(pe),ie(!1)})},[b,v]),Ve.useEffect(()=>{var pe;console.log("visiblePipelineFlows",P);const de=((pe=P==null?void 0:P[0])==null?void 0:pe.flow)||{};H(de)},[P]);const ve=async(de,pe)=>{var se;const le=[],he=ee=>pe==null?void 0:pe[ee],Te=()=>pe,we=(ee,Re)=>{const B=pe==null?void 0:pe.flow_submissions;return!(!B||!B[ee])};for(const ee of de)we(ee.flowSlug,(se=ee.flow)==null?void 0:se.version)||ee.condition&&!await YA(ee.condition,he,Te)||le.push(ee);return V(le),le};if(Z)return null;if(!G.config)return L.jsx(JA,{dataFetcher:e,configFetcher:i,flowName:b,formidavimHost:f,onSubmit:p,isPreview:!1,onNextStep:S,onPrevStep:T,onFlowInit:w,onFormidavimFallback:k,children:r});const Ee=async de=>{var pe;if(!ae){I(!0);try{const le=await p(de,D),he=e?await e("pipeline"):null;if(W(Te=>({...Te,data:he})),(pe=G.config)!=null&&pe.pipelineFlows){const Te=await ve(G.config.pipelineFlows,he.data);if(Object.keys(Te).length===0&&le&&typeof le=="function"){le();return}}else if(le&&typeof le=="function"){le();return}}finally{I(!1)}}};return L.jsx(Cw,{children:L.jsx(Sw,{data:G.data,isPreview:c,config:D,onSubmit:Ee,onNextStep:S,onPrevStep:T,onFlowInit:w,shouldRedirect:!1,formidavimHost:f})})};exports.ComponentFactory=q0;exports.DataRenderer=JA;exports.FlowFormRenderer=QA;exports.FlowProgressTracker=e3;exports.FlowRenderer=qA;exports.FormComponentRenderer=XA;exports.FormRenderer=KA;exports.FormWrapper=ZA;exports.PipelineProcessor=hU;exports.Renderer=Sw;exports.RendererWrapper=Cw;
|
package/index.mjs
CHANGED
|
@@ -48220,6 +48220,7 @@ const gU = ({ formComponent: e, isPreview: o, boundary: i, isVisible: s = !0, fo
|
|
|
48220
48220
|
});
|
|
48221
48221
|
}, [b, v]), Tn(() => {
|
|
48222
48222
|
var pe;
|
|
48223
|
+
console.log("visiblePipelineFlows", P);
|
|
48223
48224
|
const fe = ((pe = P == null ? void 0 : P[0]) == null ? void 0 : pe.flow) || {};
|
|
48224
48225
|
H(fe);
|
|
48225
48226
|
}, [P]);
|
|
@@ -48263,7 +48264,7 @@ const gU = ({ formComponent: e, isPreview: o, boundary: i, isVisible: s = !0, fo
|
|
|
48263
48264
|
try {
|
|
48264
48265
|
const le = await p(fe, D), he = e ? await e("pipeline") : null;
|
|
48265
48266
|
if (W((Ee) => ({ ...Ee, data: he })), (pe = G.config) != null && pe.pipelineFlows) {
|
|
48266
|
-
const Ee = await ve(G.config.pipelineFlows, he);
|
|
48267
|
+
const Ee = await ve(G.config.pipelineFlows, he.data);
|
|
48267
48268
|
if (Object.keys(Ee).length === 0 && le && typeof le == "function") {
|
|
48268
48269
|
le();
|
|
48269
48270
|
return;
|