@verifiedinc-public/shared-ui-elements 12.7.1 → 12.8.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.
Files changed (40) hide show
  1. package/dist/components/CredentialRequestsEditor/components/CredentialRequestsField.mjs +1 -1
  2. package/dist/components/CredentialRequestsEditor/components/DataFieldOptionType.mjs +2 -2
  3. package/dist/components/CredentialRequestsEditor/types/form.d.ts +0 -4
  4. package/dist/components/form/AddressInput/hook.mjs +1 -1
  5. package/dist/components/form/NewOneClickForm/core/fields/employer.d.ts +125 -0
  6. package/dist/components/form/NewOneClickForm/core/fields/employer.mjs +1 -0
  7. package/dist/components/form/NewOneClickForm/core/fields/index.d.ts +113 -0
  8. package/dist/components/form/NewOneClickForm/core/fields/index.mjs +1 -1
  9. package/dist/components/form/NewOneClickForm/core/form/form.d.ts +1 -26
  10. package/dist/components/form/NewOneClickForm/core/form/form.mjs +1 -1
  11. package/dist/components/form/NewOneClickForm/core/form/formBuilder.mjs +1 -1
  12. package/dist/components/form/NewOneClickForm/core/form/formFieldBuilder.d.ts +1 -1
  13. package/dist/components/form/NewOneClickForm/core/form/formFieldBuilder.mjs +1 -1
  14. package/dist/components/form/NewOneClickForm/core/formats/employer.format.d.ts +2 -0
  15. package/dist/components/form/NewOneClickForm/core/formats/employer.format.mjs +1 -0
  16. package/dist/components/form/NewOneClickForm/core/formats/index.d.ts +1 -0
  17. package/dist/components/form/NewOneClickForm/core/mappers/create-patch.map.mjs +1 -1
  18. package/dist/components/form/NewOneClickForm/core/validations/address/address.schema.d.ts +50 -0
  19. package/dist/components/form/NewOneClickForm/core/validations/address/address.schema.mjs +1 -1
  20. package/dist/components/form/NewOneClickForm/core/validations/employer/employer.schema.d.ts +106 -0
  21. package/dist/components/form/NewOneClickForm/core/validations/employer/employer.schema.mjs +1 -0
  22. package/dist/components/form/NewOneClickForm/core/validations/employer/employerName.schema.d.ts +3 -0
  23. package/dist/components/form/NewOneClickForm/core/validations/employer/employerName.schema.mjs +1 -0
  24. package/dist/components/form/NewOneClickForm/core/validations/employer/index.d.ts +1 -0
  25. package/dist/components/form/NewOneClickForm/core/validations/employer/legalName.schema.d.ts +3 -0
  26. package/dist/components/form/NewOneClickForm/core/validations/employer/legalName.schema.mjs +1 -0
  27. package/dist/components/form/NewOneClickForm/core/validations/index.d.ts +1 -0
  28. package/dist/components/form/NewOneClickForm/react/core/form.context.mjs +1 -1
  29. package/dist/components/form/NewOneClickForm/react/ui/fields/input/address.field.mjs +1 -1
  30. package/dist/components/form/NewOneClickForm/react/ui/fields/input/employer.field.d.ts +3 -0
  31. package/dist/components/form/NewOneClickForm/react/ui/fields/input/employer.field.mjs +1 -0
  32. package/dist/components/form/NewOneClickForm/react/ui/fields/input/field.mjs +1 -1
  33. package/dist/components/form/NewOneClickForm/react/ui/fields/input/healthInsurance.field.mjs +1 -1
  34. package/dist/components/form/NewOneClickForm/react/ui/fields/readonly/employer.field.d.ts +3 -0
  35. package/dist/components/form/NewOneClickForm/react/ui/fields/readonly/employer.field.mjs +1 -0
  36. package/dist/components/form/NewOneClickForm/react/ui/fields/readonly/field.mjs +1 -1
  37. package/dist/components/form/NewOneClickForm/react/ui/fields/readonly/healthInsurance.field.mjs +1 -1
  38. package/dist/components/form/NewOneClickForm/react/ui/fields/shared.d.ts +17 -0
  39. package/dist/components/form/NewOneClickForm/react/ui/fields/shared.mjs +1 -1
  40. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";import{Stack as f}from"@mui/material";import{Add as h}from"@mui/icons-material";import{useFormContext as y,useFieldArray as A}from"react-hook-form";import{DndProvider as F}from"react-dnd";import{HTML5Backend as x}from"react-dnd-html5-backend";import{Button as q}from"../../Button/index.mjs";import{buildDataFieldValue as v}from"../utils/buildDataFieldValue.mjs";import{CredentialRequestFieldProvider as k}from"../contexts/CredentialRequestFieldContext.mjs";import{DataFieldAccordion as C}from"./DataFieldAccordion.mjs";import{useCredentialRequestsEditor as R}from"../CredentialRequestsEditor.context.mjs";import{jsx as r,jsxs as o,Fragment as g}from"react/jsx-runtime";function p({path:a="credentialRequests",parentFieldArray:u,parentIndex:m=0,level:d=0}){const s=R(),c=y(),t=A({control:c.control,name:a});return o(g,{children:[t.fields.map((e,i)=>{const n=`${a}.${i}`;return o(k,{path:n,field:e,fieldArray:t,index:i,level:d,onAllFieldsDelete:()=>{var l;(l=u??t)==null||l.remove(m)},children:[r(C,{riskSignals:s.riskSignals}),Array.isArray(e.children)&&r(p,{path:`${n}.children`,parentFieldArray:t,parentIndex:i,level:d+1},`${n}.children`)]},n+e.type)}),a==="credentialRequests"&&r(q,{type:"button",onClick:()=>{if(!s)return;const e=v(""),i={type:e.type,issuers:e.issuers,required:e.required,mandatory:e.mandatory,description:e.description,allowUserInput:e.allowUserInput,multi:e.multi,children:e.children,isNew:!0};t.append(i)},size:"large",variant:"outlined",startIcon:r(h,{}),fullWidth:!0,sx:{width:"100%"},children:s.addButtonText??"Add Credential Request"})]})}function w(){return r(F,{backend:x,children:r(f,{spacing:2,children:r(p,{})})})}export{w as CredentialRequestsField};
1
+ "use strict";import{Stack as f}from"@mui/material";import{Add as h}from"@mui/icons-material";import{useFormContext as y,useFieldArray as A}from"react-hook-form";import{DndProvider as F}from"react-dnd";import{HTML5Backend as x}from"react-dnd-html5-backend";import{Button as v}from"../../Button/index.mjs";import{buildDataFieldValue as k}from"../utils/buildDataFieldValue.mjs";import{CredentialRequestFieldProvider as q}from"../contexts/CredentialRequestFieldContext.mjs";import{DataFieldAccordion as C}from"./DataFieldAccordion.mjs";import{useCredentialRequestsEditor as R}from"../CredentialRequestsEditor.context.mjs";import{jsx as r,jsxs as s,Fragment as g}from"react/jsx-runtime";function p({path:a="credentialRequests",parentFieldArray:m,parentIndex:c=0,level:d=0}){const l=R(),u=y(),t=A({control:u.control,name:a});return s(g,{children:[t.fields.map((e,i)=>{const n=`${a}.${i}`;return s(q,{path:n,field:e,fieldArray:t,index:i,level:d,onAllFieldsDelete:()=>{var o;(o=m??t)==null||o.remove(c)},children:[r(C,{riskSignals:l.riskSignals}),Array.isArray(e.children)&&r(p,{path:`${n}.children`,parentFieldArray:t,parentIndex:i,level:d+1},`${n}.children`)]},n+e.type)}),a==="credentialRequests"&&r(v,{type:"button",onClick:()=>{if(!l)return;const e=k(""),i={type:e.type,mandatory:e.mandatory,description:e.description,allowUserInput:e.allowUserInput,multi:e.multi,children:e.children,isNew:!0};t.append(i)},size:"large",variant:"outlined",startIcon:r(h,{}),fullWidth:!0,sx:{width:"100%"},children:l.addButtonText??"Add Credential Request"})]})}function w(){return r(F,{backend:x,children:r(f,{spacing:2,children:r(p,{})})})}export{w as CredentialRequestsField};
@@ -1,3 +1,3 @@
1
- "use strict";import{useMemo as c}from"react";import{useFormContext as y,useController as h}from"react-hook-form";import{Autocomplete as v,TextField as C}from"@mui/material";import{prettyField as F}from"../utils/prettyField.mjs";import{buildDataFieldValue as x}from"../utils/buildDataFieldValue.mjs";import{useCredentialRequestField as b}from"../contexts/CredentialRequestFieldContext.mjs";import{DataFieldSection as g}from"./DataFieldSection.mjs";import{jsx as d}from"react/jsx-runtime";function S(){const e=b(),s=y(),u=h({name:`${e?.path}`}),a=c(()=>{const t={PhoneCredential:0,FullNameCredential:1,AddressCredential:2,BirthDateCredential:3,SsnCredential:4,SexCredential:5},r=e?.path??"",i=e?.index??0,o=r.split(".").slice(0,-1).join("."),m=s.getValues(o),f=new Set(m?.map((l,n)=>n!==i?l.type:null).filter(l=>l!==null)??[]);return Object.keys(t).map(l=>({label:F(l),id:l})).filter(l=>!f.has(l.id)).sort((l,n)=>t[l.id]-t[n.id])},[e,s]),p=c(()=>{var t,r;const i=(r=(t=u.field)==null?void 0:t.value)==null?void 0:r.type;return a?.find(o=>o.id===i)},[u,a]);return d(g,{title:"Field Type",description:"What type of user data this field is for",tip:d("pre",{children:`{
1
+ "use strict";import{useMemo as c}from"react";import{useFormContext as y,useController as h}from"react-hook-form";import{Autocomplete as v,TextField as C}from"@mui/material";import{prettyField as F}from"../utils/prettyField.mjs";import{buildDataFieldValue as x}from"../utils/buildDataFieldValue.mjs";import{useCredentialRequestField as b}from"../contexts/CredentialRequestFieldContext.mjs";import{DataFieldSection as g}from"./DataFieldSection.mjs";import{jsx as n}from"react/jsx-runtime";function S(){const e=b(),s=y(),p=h({name:`${e?.path}`}),a=c(()=>{const t={PhoneCredential:0,FullNameCredential:1,AddressCredential:2,BirthDateCredential:3,SsnCredential:4,SexCredential:5,EmployerCredential:6},r=e?.path??"",l=e?.index??0,o=r.split(".").slice(0,-1).join("."),m=s.getValues(o),f=new Set(m?.map((i,d)=>d!==l?i.type:null).filter(i=>i!==null)??[]);return Object.keys(t).map(i=>({label:F(i),id:i})).filter(i=>!f.has(i.id)).sort((i,d)=>t[i.id]-t[d.id])},[e,s]),u=c(()=>{var t,r;const l=(r=(t=p.field)==null?void 0:t.value)==null?void 0:r.type;return a?.find(o=>o.id===l)},[p,a]);return n(g,{title:"Field Type",description:"What type of user data this field is for",tip:n("pre",{children:`{
2
2
  type: string
3
- }`}),children:d(v,{value:p,onChange:(t,r)=>{if(!r)return;const i=x(r.id),o={type:i.type,issuers:i.issuers,required:i.required,mandatory:i.mandatory,description:i.description,allowUserInput:i.allowUserInput,multi:i.multi,children:i.children};e?.fieldArray.update(e?.index,o)},options:a,disablePortal:!0,renderInput:t=>d(C,{...t,label:"Type",color:"success",size:"small",className:"original",fullWidth:!0,inputProps:{...t.inputProps,"data-testid":"custom-demo-dialog-data-field-type-input"},placeholder:"Choose a type..."}),disabled:(e?.level??0)>0})},JSON.stringify(p))}export{S as DataFieldOptionType};
3
+ }`}),children:n(v,{value:u,onChange:(t,r)=>{if(!r)return;const l=x(r.id),o={type:l.type,mandatory:l.mandatory,description:l.description,allowUserInput:l.allowUserInput,multi:l.multi,children:l.children};e?.fieldArray.update(e?.index,o)},options:a,disablePortal:!0,renderInput:t=>n(C,{...t,label:"Type",color:"success",size:"small",className:"original",fullWidth:!0,inputProps:{...t.inputProps,"data-testid":"custom-demo-dialog-data-field-type-input"},placeholder:"Choose a type..."}),disabled:(e?.level??0)>0})},JSON.stringify(u))}export{S as DataFieldOptionType};
@@ -1,8 +1,6 @@
1
1
  import { MandatoryEnum } from './mandatoryEnum';
2
2
  export interface CredentialRequests {
3
3
  type: string;
4
- issuers?: string[];
5
- required?: boolean;
6
4
  mandatory?: MandatoryEnum;
7
5
  description?: string;
8
6
  allowUserInput?: boolean;
@@ -12,8 +10,6 @@ export interface CredentialRequests {
12
10
  }
13
11
  export interface CredentialRequestsWithNew {
14
12
  type: string;
15
- issuers?: string[];
16
- required?: boolean;
17
13
  mandatory?: MandatoryEnum;
18
14
  description?: string;
19
15
  allowUserInput?: boolean;
@@ -1 +1 @@
1
- "use strict";import{useState as l,useMemo as D,useEffect as d}from"react";import{wrapPromise as I}from"../../../utils/wrapPromise/index.mjs";import"libphonenumber-js";import"lodash/find";import"tinycolor2";import{toUSaddress as p,fromUSAddress as U}from"../../../utils/address/index.mjs";import{useDebounceValue as x}from"../../../hooks/useDebounceValue.mjs";import{usePrevious as E}from"../../../hooks/usePrevious.mjs";import{useAutoFill as M}from"./autofill.hook.mjs";function O({defaultValue:o,onChange:m}){const[c,u]=l(!1),{handleAutoComplete:f,fetchPlace:g,buildAddress:h,suggestions:v,isPending:C}=M(),P=D(()=>p({line1:o?.line1??"",city:o?.city??"",state:o?.state??"",zipCode:o?.zipCode??""}),[o]),[y,A]=l({title:P??"",value:""}),[r,s]=l(""),F=E(r),t=x(r),[S,V]=l(!1),a=(e,n)=>{let i;typeof e=="string"?i=U(e.replace(/\n/g,"")):(i=e,s(p({...e,country:void 0})??"")),m(i,n)},b=async e=>{if(A(e),!e.value)return;u(!0);const[n]=await I(g(e.value));if(!n)return;const i=h(n);a(i),u(!1)},w=e=>{s(e)},z=()=>{s(""),a("",{shouldValidate:!1})};return d(()=>{!t.length&&S&&a("",void 0),!(!t||t.length<=3||t===F)&&(a(t,void 0),f(t).catch(console.error))},[t]),d(()=>{V(!0)},[]),{value:y,inputValue:r,suggestions:v,isPending:C,isFetchingPlace:c,handleInputChange:w,handleOptionChange:b,handleClear:z}}export{O as useDataFieldAddressInput};
1
+ "use strict";import{useState as l,useMemo as D,useEffect as d}from"react";import{wrapPromise as I}from"../../../utils/wrapPromise/index.mjs";import"libphonenumber-js";import"lodash/find";import"tinycolor2";import{toUSaddress as p,fromUSAddress as U}from"../../../utils/address/index.mjs";import{useDebounceValue as x}from"../../../hooks/useDebounceValue.mjs";import{usePrevious as E}from"../../../hooks/usePrevious.mjs";import{useAutoFill as M}from"./autofill.hook.mjs";function O({defaultValue:o,onChange:m}){const[c,u]=l(!1),{handleAutoComplete:f,fetchPlace:g,buildAddress:h,suggestions:v,isPending:C}=M(),P=D(()=>p({line1:o?.line1??"",city:o?.city??"",state:o?.state??"",zipCode:o?.zipCode??""}),[o]),[y,A]=l({title:P??"",value:""}),[r,s]=l(""),F=E(r),t=x(r),[S,V]=l(!1),a=(e,n)=>{let i;typeof e=="string"?i=U(e.replace(/\n/g,"")):(i=e,s(p({...e,country:void 0})??"")),m(i,n)},b=async e=>{if(A(e),!e.value)return;u(!0);const[n]=await I(g(e.value));if(!n)return;const i=h(n);a(i),u(!1)},w=e=>{s(e)},z=()=>{s(""),a("",{shouldValidate:!1})};return d(()=>{!t.length&&S&&a("",void 0),!(!t||t===F)&&(a(t,void 0),!(t.length<=3)&&f(t).catch(console.error))},[t]),d(()=>{V(!0)},[]),{value:y,inputValue:r,suggestions:v,isPending:C,isFetchingPlace:c,handleInputChange:w,handleOptionChange:b,handleClear:z}}export{O as useDataFieldAddressInput};
@@ -0,0 +1,125 @@
1
+ import { EmployerValue } from '../validations';
2
+ import { CompositeFieldDefinition } from './types';
3
+ declare const employerKey = "employer";
4
+ export declare const employer: {
5
+ key: string;
6
+ characteristics: {
7
+ inputType: "composite";
8
+ label: string;
9
+ defaultOrder: readonly [];
10
+ };
11
+ zodSchema: import('zod').ZodObject<{
12
+ employer: import('zod').ZodObject<{
13
+ name: import('zod').ZodString;
14
+ legalName: import('zod').ZodOptional<import('zod').ZodString>;
15
+ address: import('zod').ZodEffects<import('zod').ZodEffects<import('zod').ZodObject<{
16
+ line1: import('zod').ZodOptional<import('zod').ZodString>;
17
+ line2: import('zod').ZodOptional<import('zod').ZodString>;
18
+ city: import('zod').ZodOptional<import('zod').ZodString>;
19
+ state: import('zod').ZodOptional<import('zod').ZodEnum<[string, ...string[]]>>;
20
+ country: import('zod').ZodOptional<import('zod').ZodEffects<import('zod').ZodString, "US", string>>;
21
+ zipCode: import('zod').ZodOptional<import('zod').ZodString>;
22
+ }, "strip", import('zod').ZodTypeAny, {
23
+ line1?: string | undefined;
24
+ line2?: string | undefined;
25
+ city?: string | undefined;
26
+ state?: string | undefined;
27
+ country?: "US" | undefined;
28
+ zipCode?: string | undefined;
29
+ }, {
30
+ line1?: string | undefined;
31
+ line2?: string | undefined;
32
+ city?: string | undefined;
33
+ state?: string | undefined;
34
+ country?: string | undefined;
35
+ zipCode?: string | undefined;
36
+ }>, {
37
+ line1?: string | undefined;
38
+ line2?: string | undefined;
39
+ city?: string | undefined;
40
+ state?: string | undefined;
41
+ country?: "US" | undefined;
42
+ zipCode?: string | undefined;
43
+ }, {
44
+ line1?: string | undefined;
45
+ line2?: string | undefined;
46
+ city?: string | undefined;
47
+ state?: string | undefined;
48
+ country?: string | undefined;
49
+ zipCode?: string | undefined;
50
+ }>, {
51
+ line1?: string | undefined;
52
+ line2?: string | undefined;
53
+ city?: string | undefined;
54
+ state?: string | undefined;
55
+ country?: "US" | undefined;
56
+ zipCode?: string | undefined;
57
+ }, {
58
+ line1?: string | undefined;
59
+ line2?: string | undefined;
60
+ city?: string | undefined;
61
+ state?: string | undefined;
62
+ country?: string | undefined;
63
+ zipCode?: string | undefined;
64
+ }>;
65
+ }, "strip", import('zod').ZodTypeAny, {
66
+ address: {
67
+ line1?: string | undefined;
68
+ line2?: string | undefined;
69
+ city?: string | undefined;
70
+ state?: string | undefined;
71
+ country?: "US" | undefined;
72
+ zipCode?: string | undefined;
73
+ };
74
+ name: string;
75
+ legalName?: string | undefined;
76
+ }, {
77
+ address: {
78
+ line1?: string | undefined;
79
+ line2?: string | undefined;
80
+ city?: string | undefined;
81
+ state?: string | undefined;
82
+ country?: string | undefined;
83
+ zipCode?: string | undefined;
84
+ };
85
+ name: string;
86
+ legalName?: string | undefined;
87
+ }>;
88
+ }, "strip", import('zod').ZodTypeAny, {
89
+ employer: {
90
+ address: {
91
+ line1?: string | undefined;
92
+ line2?: string | undefined;
93
+ city?: string | undefined;
94
+ state?: string | undefined;
95
+ country?: "US" | undefined;
96
+ zipCode?: string | undefined;
97
+ };
98
+ name: string;
99
+ legalName?: string | undefined;
100
+ };
101
+ }, {
102
+ employer: {
103
+ address: {
104
+ line1?: string | undefined;
105
+ line2?: string | undefined;
106
+ city?: string | undefined;
107
+ state?: string | undefined;
108
+ country?: string | undefined;
109
+ zipCode?: string | undefined;
110
+ };
111
+ name: string;
112
+ legalName?: string | undefined;
113
+ };
114
+ }>;
115
+ format: (value: EmployerValue) => string | null;
116
+ };
117
+ declare module '../declarations' {
118
+ interface FieldSchemaDefinitions {
119
+ employer: CompositeFieldDefinition<typeof employerKey>;
120
+ }
121
+ interface FieldValueDefinitions {
122
+ employer: EmployerValue;
123
+ }
124
+ }
125
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";import{employerFormat as e}from"../formats/employer.format.mjs";import{employerSchema as o}from"../validations/employer/employer.schema.mjs";const r="employer",m={key:r,characteristics:{inputType:"composite",label:"Employer",defaultOrder:[]},zodSchema:o,format:e};export{m as employer};
@@ -598,6 +598,119 @@ export declare const fields: {
598
598
  };
599
599
  zodSchema: import('zod').ZodString;
600
600
  };
601
+ employer: {
602
+ key: string;
603
+ characteristics: {
604
+ inputType: "composite";
605
+ label: string;
606
+ defaultOrder: readonly [];
607
+ };
608
+ zodSchema: import('zod').ZodObject<{
609
+ employer: import('zod').ZodObject<{
610
+ name: import('zod').ZodString;
611
+ legalName: import('zod').ZodOptional<import('zod').ZodString>;
612
+ address: import('zod').ZodEffects<import('zod').ZodEffects<import('zod').ZodObject<{
613
+ line1: import('zod').ZodOptional<import('zod').ZodString>;
614
+ line2: import('zod').ZodOptional<import('zod').ZodString>;
615
+ city: import('zod').ZodOptional<import('zod').ZodString>;
616
+ state: import('zod').ZodOptional<import('zod').ZodEnum<[string, ...string[]]>>;
617
+ country: import('zod').ZodOptional<import('zod').ZodEffects<import('zod').ZodString, "US", string>>;
618
+ zipCode: import('zod').ZodOptional<import('zod').ZodString>;
619
+ }, "strip", import('zod').ZodTypeAny, {
620
+ line1?: string | undefined;
621
+ line2?: string | undefined;
622
+ city?: string | undefined;
623
+ state?: string | undefined;
624
+ country?: "US" | undefined;
625
+ zipCode?: string | undefined;
626
+ }, {
627
+ line1?: string | undefined;
628
+ line2?: string | undefined;
629
+ city?: string | undefined;
630
+ state?: string | undefined;
631
+ country?: string | undefined;
632
+ zipCode?: string | undefined;
633
+ }>, {
634
+ line1?: string | undefined;
635
+ line2?: string | undefined;
636
+ city?: string | undefined;
637
+ state?: string | undefined;
638
+ country?: "US" | undefined;
639
+ zipCode?: string | undefined;
640
+ }, {
641
+ line1?: string | undefined;
642
+ line2?: string | undefined;
643
+ city?: string | undefined;
644
+ state?: string | undefined;
645
+ country?: string | undefined;
646
+ zipCode?: string | undefined;
647
+ }>, {
648
+ line1?: string | undefined;
649
+ line2?: string | undefined;
650
+ city?: string | undefined;
651
+ state?: string | undefined;
652
+ country?: "US" | undefined;
653
+ zipCode?: string | undefined;
654
+ }, {
655
+ line1?: string | undefined;
656
+ line2?: string | undefined;
657
+ city?: string | undefined;
658
+ state?: string | undefined;
659
+ country?: string | undefined;
660
+ zipCode?: string | undefined;
661
+ }>;
662
+ }, "strip", import('zod').ZodTypeAny, {
663
+ address: {
664
+ line1?: string | undefined;
665
+ line2?: string | undefined;
666
+ city?: string | undefined;
667
+ state?: string | undefined;
668
+ country?: "US" | undefined;
669
+ zipCode?: string | undefined;
670
+ };
671
+ name: string;
672
+ legalName?: string | undefined;
673
+ }, {
674
+ address: {
675
+ line1?: string | undefined;
676
+ line2?: string | undefined;
677
+ city?: string | undefined;
678
+ state?: string | undefined;
679
+ country?: string | undefined;
680
+ zipCode?: string | undefined;
681
+ };
682
+ name: string;
683
+ legalName?: string | undefined;
684
+ }>;
685
+ }, "strip", import('zod').ZodTypeAny, {
686
+ employer: {
687
+ address: {
688
+ line1?: string | undefined;
689
+ line2?: string | undefined;
690
+ city?: string | undefined;
691
+ state?: string | undefined;
692
+ country?: "US" | undefined;
693
+ zipCode?: string | undefined;
694
+ };
695
+ name: string;
696
+ legalName?: string | undefined;
697
+ };
698
+ }, {
699
+ employer: {
700
+ address: {
701
+ line1?: string | undefined;
702
+ line2?: string | undefined;
703
+ city?: string | undefined;
704
+ state?: string | undefined;
705
+ country?: string | undefined;
706
+ zipCode?: string | undefined;
707
+ };
708
+ name: string;
709
+ legalName?: string | undefined;
710
+ };
711
+ }>;
712
+ format: (value: import('../validations').EmployerValue) => string | null;
713
+ };
601
714
  ssn: {
602
715
  key: string;
603
716
  characteristics: {
@@ -1 +1 @@
1
- "use strict";import{middleName as s,lastName as r,firstName as t,fullName as m}from"./fullName.mjs";import{zipCode as i,country as o,state as n,city as p,line2 as c,line1 as d,address as l}from"./address.mjs";import{expirationDate as f,issuanceDate as u,issuanceState as N,documentNumber as y,driversLicense as b}from"./driversLicense.mjs";import{payerName as h,payer as D,memberId as x,healthInsurance as I}from"./healthInsurance.mjs";import{ssn as j}from"./ssn.mjs";import{phone as v}from"./phone.mjs";import{sex as z}from"./sex.mjs";import{birthDate as O}from"./birthDate.mjs";const a={fullName:m,firstName:t,lastName:r,middleName:s,address:l,line1:d,line2:c,city:p,state:n,country:o,zipCode:i,driversLicense:b,documentNumber:y,issuanceState:N,issuanceDate:u,expirationDate:f,healthInsurance:I,memberId:x,payer:D,payerName:h,ssn:j,phone:v,sex:z,birthDate:O},C=Object.fromEntries(Object.keys(a).map(e=>[e,e]));export{C as credentialKeys,a as fields};
1
+ "use strict";import{middleName as s,lastName as r,firstName as t,fullName as m}from"./fullName.mjs";import{zipCode as i,country as o,state as n,city as p,line2 as c,line1 as d,address as l}from"./address.mjs";import{expirationDate as f,issuanceDate as u,issuanceState as y,documentNumber as N,driversLicense as b}from"./driversLicense.mjs";import{payerName as h,payer as D,memberId as x,healthInsurance as I}from"./healthInsurance.mjs";import{employer as j}from"./employer.mjs";import{ssn as v}from"./ssn.mjs";import{phone as z}from"./phone.mjs";import{sex as C}from"./sex.mjs";import{birthDate as O}from"./birthDate.mjs";const a={fullName:m,firstName:t,lastName:r,middleName:s,address:l,line1:d,line2:c,city:p,state:n,country:o,zipCode:i,driversLicense:b,documentNumber:N,issuanceState:y,issuanceDate:u,expirationDate:f,healthInsurance:I,memberId:x,payer:D,payerName:h,employer:j,ssn:v,phone:z,sex:C,birthDate:O},L=Object.fromEntries(Object.keys(a).map(e=>[e,e]));export{L as credentialKeys,a as fields};
@@ -7,31 +7,6 @@ export declare class Form {
7
7
  get isDirty(): boolean;
8
8
  get isDisabled(): boolean;
9
9
  get values(): {
10
- [k: string]: string | {
11
- memberId: string;
12
- payer: {
13
- name: string;
14
- verifiedId: string;
15
- logoUrl?: string | null | undefined;
16
- };
17
- id?: number | undefined;
18
- } | {
19
- firstName?: string | undefined;
20
- lastName?: string | undefined;
21
- middleName?: string | undefined;
22
- } | {
23
- line1?: string | undefined;
24
- line2?: string | undefined;
25
- city?: string | undefined;
26
- state?: string | undefined;
27
- country?: string | undefined;
28
- zipCode?: string | undefined;
29
- } | {
30
- documentNumber?: string | undefined;
31
- issuanceState?: string | undefined;
32
- issuanceDate?: string | undefined;
33
- expirationDate?: string | undefined;
34
- address?: undefined;
35
- };
10
+ [k: string]: unknown;
36
11
  };
37
12
  }
@@ -1 +1 @@
1
- "use strict";var t=Object.defineProperty,r=(s,e,i)=>e in s?t(s,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[e]=i,a=(s,e,i)=>r(s,typeof e!="symbol"?e+"":e,i);import{credentialKeys as l}from"../fields/index.mjs";class u{constructor(e){a(this,"fields"),this.fields=e}get isValid(){return Object.values(this.fields).every(e=>e.isValid)}get isEmpty(){return Object.values(this.fields).every(e=>e.schema.key===l.phone?!0:e.isEmpty)}get isDirty(){return Object.values(this.fields).some(e=>e.isDirty)}get isDisabled(){return Object.values(this.fields).every(e=>e.isDisabled)}get values(){return Object.fromEntries(Object.values(this.fields).map(e=>[e.schema.key,e.value]))}}export{u as Form};
1
+ "use strict";var t=Object.defineProperty,a=(s,e,i)=>e in s?t(s,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[e]=i,l=(s,e,i)=>a(s,typeof e!="symbol"?e+"":e,i);import{credentialKeys as c}from"../fields/index.mjs";const r=s=>typeof s=="string"?s.trim():Array.isArray(s)?s.map(r):s&&typeof s=="object"?Object.fromEntries(Object.entries(s).map(([e,i])=>[e,r(i)])):s;class n{constructor(e){l(this,"fields"),this.fields=e}get isValid(){return Object.values(this.fields).every(e=>e.isValid)}get isEmpty(){return Object.values(this.fields).every(e=>e.schema.key===c.phone?!0:e.isEmpty)}get isDirty(){return Object.values(this.fields).some(e=>e.isDirty)}get isDisabled(){return Object.values(this.fields).every(e=>e.isDisabled)}get values(){return Object.fromEntries(Object.values(this.fields).map(e=>[e.schema.key,r(e.value)]))}}export{n as Form};
@@ -1 +1 @@
1
- "use strict";var C=Object.defineProperty,F=(u,e,t)=>e in u?C(u,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[e]=t,w=(u,e,t)=>F(u,typeof e!="symbol"?e+"":e,t);import{fields as p}from"../fields/index.mjs";import{FormFieldBuilder as O}from"./formFieldBuilder.mjs";import{Form as T}from"./form.mjs";import{normalizeCredentialType as m}from"./utils.mjs";import{fieldInputTypes as f}from"../fields/constants.mjs";class x{constructor(){w(this,"fieldBuilder",new O)}createFromCredentialAndRequests(e,t){const i={};for(const l of t){let r;if(typeof l=="string")r=this.expandCredentialType(l);else if(r=l,!r.children){const c=r.type.replace(/Credential$/,""),h=c.charAt(0).toLowerCase()+c.slice(1),d=p[h],y=["healthInsurance"];if(d&&d.characteristics.inputType===f.composite&&"children"in d&&"defaultOrder"in d.characteristics&&d.characteristics.defaultOrder&&!y.includes(h)){const v=this.expandCredentialType(r.type);r={...r,children:v.children}}}const n=m(r.type),s=e.filter(c=>c.type===n).filter(c=>this.credentialMeetsRequirements(r,c)),a=this.createField(r,s,n),o=p[n];o&&(i[o.key]=a)}return new T(i)}createField(e,t,i){const l=p[i];if(!l)throw new Error(`Unknown credential type: ${i}`);const r=this.extractRequestOptions(e);if(t.length===0)return this.fieldBuilder.createFromSchema(e,l);const n=t[0],s=this.createChildFields(e,n);let a;return t.length>1&&(a=t.map(o=>{const c=this.createChildFields(e,o);return this.fieldBuilder.createFromCredential(o,c,r)})),this.fieldBuilder.createFromCredential(n,s,r,a)}createChildFields(e,t){if(!e.children)return;const i={};for(const l of e.children){const r=m(l.type),n=p[r];if(!n)continue;const s=n.key;if(t.value&&s in t.value){let a;n.characteristics.inputType===f.composite?a=t.value[s]:a=t.value;const o={...t,uuid:void 0,type:r,value:a},c=this.extractRequestOptions(l,e);let h;n.characteristics.inputType===f.composite&&l.children&&(h=this.createChildFields(l,o));const d=this.fieldBuilder.createFromCredential(o,h,c);i[s]=d}else{const a=this.extractRequestOptions(l,e),o={...l,...a},c=this.fieldBuilder.createFromSchema(o,n);i[s]=c}}return Object.keys(i).length>0?i:void 0}expandCredentialType(e){var t;const i=e.replace(/Credential$/,""),l=i.charAt(0).toLowerCase()+i.slice(1),r=p[l];if(!r)throw new Error(`Unknown credential type: ${e}`);const n={type:e,allowUserInput:!0,mandatory:"no",multi:!1};if(r.characteristics.inputType===f.composite&&"children"in r&&"defaultOrder"in r.characteristics&&r.characteristics.defaultOrder){const s=[];for(const a of r.characteristics.defaultOrder){const o=(t=r.children)==null?void 0:t[a];if(o){const c=this.expandCredentialType(o.key);s.push(c)}}return{...n,children:s}}return n}credentialMeetsRequirements(e,t){if(!e.children)return!0;for(const i of e.children){const l=m(typeof i=="string"?i:i.type);if((typeof i=="string"?"no":i.mandatory??"no")==="no")continue;let r=!1;const n=p[l];if(n&&t.value){const s=n.key;r=s in t.value&&t.value[s]!==void 0&&t.value[s]!==null&&t.value[s]!==""}if(!r)return!1}return!0}extractRequestOptions(e,t){return{allowUserInput:e.allowUserInput??t?.allowUserInput??!0,mandatory:e.mandatory??t?.mandatory??"no",multi:e.multi??!1,description:e.description}}}export{x as FormBuilder};
1
+ "use strict";var C=Object.defineProperty,F=(u,e,t)=>e in u?C(u,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[e]=t,w=(u,e,t)=>F(u,typeof e!="symbol"?e+"":e,t);import{fields as p}from"../fields/index.mjs";import{FormFieldBuilder as O}from"./formFieldBuilder.mjs";import{Form as T}from"./form.mjs";import{normalizeCredentialType as m}from"./utils.mjs";import{fieldInputTypes as f}from"../fields/constants.mjs";class x{constructor(){w(this,"fieldBuilder",new O)}createFromCredentialAndRequests(e,t){const i={};for(const l of t){let r;if(typeof l=="string")r=this.expandCredentialType(l);else if(r=l,!r.children){const c=r.type.replace(/Credential$/,""),h=c.charAt(0).toLowerCase()+c.slice(1),d=p[h],y=["healthInsurance","employer"];if(d&&d.characteristics.inputType===f.composite&&"children"in d&&"defaultOrder"in d.characteristics&&d.characteristics.defaultOrder&&!y.includes(h)){const v=this.expandCredentialType(r.type);r={...r,children:v.children}}}const n=m(r.type),s=e.filter(c=>c.type===n).filter(c=>this.credentialMeetsRequirements(r,c)),a=this.createField(r,s,n),o=p[n];o&&(i[o.key]=a)}return new T(i)}createField(e,t,i){const l=p[i];if(!l)throw new Error(`Unknown credential type: ${i}`);const r=this.extractRequestOptions(e);if(t.length===0)return this.fieldBuilder.createFromSchema(e,l);const n=t[0],s=this.createChildFields(e,n);let a;return t.length>1&&(a=t.map(o=>{const c=this.createChildFields(e,o);return this.fieldBuilder.createFromCredential(o,c,r)})),this.fieldBuilder.createFromCredential(n,s,r,a)}createChildFields(e,t){if(!e.children)return;const i={};for(const l of e.children){const r=m(l.type),n=p[r];if(!n)continue;const s=n.key;if(t.value&&s in t.value){let a;n.characteristics.inputType===f.composite?a=t.value[s]:a=t.value;const o={...t,uuid:void 0,type:r,value:a},c=this.extractRequestOptions(l,e);let h;n.characteristics.inputType===f.composite&&l.children&&(h=this.createChildFields(l,o));const d=this.fieldBuilder.createFromCredential(o,h,c);i[s]=d}else{const a=this.extractRequestOptions(l,e),o={...l,...a},c=this.fieldBuilder.createFromSchema(o,n);i[s]=c}}return Object.keys(i).length>0?i:void 0}expandCredentialType(e){var t;const i=e.replace(/Credential$/,""),l=i.charAt(0).toLowerCase()+i.slice(1),r=p[l];if(!r)throw new Error(`Unknown credential type: ${e}`);const n={type:e,allowUserInput:!0,mandatory:"no",multi:!1};if(r.characteristics.inputType===f.composite&&"children"in r&&"defaultOrder"in r.characteristics&&r.characteristics.defaultOrder){const s=[];for(const a of r.characteristics.defaultOrder){const o=(t=r.children)==null?void 0:t[a];if(o){const c=this.expandCredentialType(o.key);s.push(c)}}return{...n,children:s}}return n}credentialMeetsRequirements(e,t){if(!e.children)return!0;for(const i of e.children){const l=m(typeof i=="string"?i:i.type);if((typeof i=="string"?"no":i.mandatory??"no")==="no")continue;let r=!1;const n=p[l];if(n&&t.value){const s=n.key;r=s in t.value&&t.value[s]!==void 0&&t.value[s]!==null&&t.value[s]!==""}if(!r)return!1}return!0}extractRequestOptions(e,t){return{allowUserInput:e.allowUserInput??t?.allowUserInput??!0,mandatory:e.mandatory??t?.mandatory??"no",multi:e.multi??!1,description:e.description}}}export{x as FormBuilder};
@@ -10,5 +10,5 @@ export interface CredentialRequestOptions {
10
10
  }
11
11
  export declare class FormFieldBuilder {
12
12
  createFromCredential<TFieldKey extends keyof FieldValueDefinitions = keyof FieldValueDefinitions>(credential: Credential, children?: Record<string, FormField<TFieldKey>>, options?: CredentialRequestOptions, variants?: Array<FormField<TFieldKey>>): FormField<TFieldKey>;
13
- createFromSchema(requestObj: CredentialRequestObject, fieldSchema: BaseFieldDefinition<string>): FormField;
13
+ createFromSchema(requestObj: CredentialRequestObject, fieldSchema: BaseFieldDefinition<string>, parentRequestObj?: CredentialRequestObject): FormField;
14
14
  }
@@ -1 +1 @@
1
- "use strict";import h from"lodash/cloneDeep";import{z as d}from"zod";import{fields as m}from"../fields/index.mjs";import{FormField as y}from"./formField.mjs";import{normalizeCredentialType as b}from"./utils.mjs";import{fieldInputTypes as f}from"../fields/constants.mjs";function p(n){if(n instanceof d.ZodObject){const t=n.shape;return Object.fromEntries(Object.entries(t).map(([o,e])=>[o,p(e)]))}if(!(n instanceof d.ZodOptional||n instanceof d.ZodNullable)){if(n instanceof d.ZodEffects)return p(n.innerType());if(n instanceof d.ZodDefault)return n._def.defaultValue();if(n instanceof d.ZodLiteral)return n.value;if(n instanceof d.ZodString)return""}}class j{createFromCredential(t,o,e,a){var s;const u=m[t.type];if(!u)throw new Error(`Invalid credential type: ${t.type}`);const r=u.key;let i;if(u.characteristics.inputType===f.composite)if(t.value&&Object.keys(t.value).length>0)if(o&&Object.keys(o).length>0){const c={};Object.keys(o).forEach(l=>{l in t.value&&(c[l]=t.value[l])}),i=Object.keys(c).length>0?c:void 0}else i=t.value;else i=void 0;else i=(s=t.value)==null?void 0:s[r];return new y(t.uuid,i,i,u,{children:o,allowUserInput:e?.allowUserInput??!0,mandatory:e?.mandatory??"no",multi:e?.multi??!1,variants:a,description:e?.description})}createFromSchema(t,o){let e,a;const s={allowUserInput:t.allowUserInput??!0,mandatory:t.mandatory??"no",multi:t.multi??!1,description:t.description};if(o.characteristics.inputType===f.composite&&t.children){const r={};for(const i of t.children){const c=b(i.type),l=m[c];if(l){const v=this.createFromSchema(i,l);r[l.key]=v}}a=Object.keys(r).length>0?r:void 0}if(o.characteristics.inputType===f.composite)if(a&&Object.keys(a).length>0){const r={};Object.entries(a).forEach(([i,c])=>{r[i]=c.defaultValue}),e=r}else e=p(o.zodSchema);else e="";const u=typeof e=="object"&&e!==null?h(e):e;return new y(void 0,e,u,o,{children:a,allowUserInput:s.allowUserInput,mandatory:s.mandatory,multi:s.multi,variants:void 0,description:s.description})}}export{j as FormFieldBuilder};
1
+ "use strict";import b from"lodash/cloneDeep";import{z as d}from"zod";import{fields as y}from"../fields/index.mjs";import{FormField as v}from"./formField.mjs";import{normalizeCredentialType as w}from"./utils.mjs";import{fieldInputTypes as p}from"../fields/constants.mjs";function m(o){if(o instanceof d.ZodObject){const e=o.shape;return Object.fromEntries(Object.entries(e).map(([i,t])=>[i,m(t)]))}if(!(o instanceof d.ZodOptional||o instanceof d.ZodNullable)){if(o instanceof d.ZodEffects)return m(o.innerType());if(o instanceof d.ZodDefault)return o._def.defaultValue();if(o instanceof d.ZodLiteral)return o.value;if(o instanceof d.ZodString)return""}}class j{createFromCredential(e,i,t,r){var l;const a=y[e.type];if(!a)throw new Error(`Invalid credential type: ${e.type}`);const u=a.key;let n;if(a.characteristics.inputType===p.composite)if(e.value&&Object.keys(e.value).length>0)if(i&&Object.keys(i).length>0){const s={};Object.keys(i).forEach(c=>{c in e.value&&(s[c]=e.value[c])}),n=Object.keys(s).length>0?s:void 0}else n=e.value;else n=void 0;else n=(l=e.value)==null?void 0:l[u];return new v(e.uuid,n,n,a,{children:i,allowUserInput:t?.allowUserInput??!0,mandatory:t?.mandatory??"no",multi:t?.multi??!1,variants:r,description:t?.description})}createFromSchema(e,i,t){let r,l;const a={allowUserInput:e.allowUserInput??t?.allowUserInput??!0,mandatory:e.mandatory??t?.mandatory??"no",multi:e.multi??!1,description:e.description};if(i.characteristics.inputType===p.composite&&e.children){const n={};for(const s of e.children){const c=w(s.type),f=y[c];if(f){const h=this.createFromSchema(s,f,e);n[f.key]=h}}l=Object.keys(n).length>0?n:void 0}if(i.characteristics.inputType===p.composite)if(l&&Object.keys(l).length>0){const n={};Object.entries(l).forEach(([s,c])=>{n[s]=c.defaultValue}),r=n}else r=m(i.zodSchema);else r="";const u=typeof r=="object"&&r!==null?b(r):r;return new v(void 0,r,u,i,{children:l,allowUserInput:a.allowUserInput,mandatory:a.mandatory,multi:a.multi,variants:void 0,description:a.description})}}export{j as FormFieldBuilder};
@@ -0,0 +1,2 @@
1
+ import { EmployerValue } from '../validations';
2
+ export declare const employerFormat: (value: EmployerValue) => string | null;
@@ -0,0 +1 @@
1
+ "use strict";const o=l=>{var e;return(e=l?.employer)!=null&&e.name?[l.employer.name,l.employer.legalName].filter(Boolean).join(" \u2014 "):null};export{o as employerFormat};
@@ -1,5 +1,6 @@
1
1
  export * from './address.format';
2
2
  export * from './date.format';
3
+ export * from './employer.format';
3
4
  export * from './healthInsurance.format';
4
5
  export * from './phone.format';
5
6
  export * from './ssn.format';
@@ -1 +1 @@
1
- "use strict";import{fieldInputTypes as h}from"../fields/constants.mjs";function f(p){const c=t=>t.uuid!==void 0,i=t=>t.schema.characteristics.inputType===h.composite&&t.children?Object.values(t.children).some(i):!t.isEmpty,a=t=>{if(t==null)return t;if(typeof t=="object"&&!Array.isArray(t)){const e={};return Object.entries(t).forEach(([s,d])=>{const r=a(d);r!==""&&r!==null&&r!==void 0&&(typeof r=="object"&&!Array.isArray(r)?Object.keys(r).length>0&&(e[s]=r):e[s]=r)}),e}return t},y=t=>{const e=a(t.value);let s;return t.schema.characteristics.inputType===h.composite?s=e:s={[t.schema.key]:e},t.id?{uuid:t.id,type:t.schema.key,value:s}:{type:t.schema.key,value:s}},l=Object.values(p.fields).filter(i),o=[],n=[],u=[];return l.forEach(t=>{const e=y(t);t.isDirty?c(e)?n.push(e):o.push(e):c(e)&&u.push(e)}),{toCreate:o,toPatch:n,unchanged:u}}export{f as toCreatePatchCredentials};
1
+ "use strict";import{fieldInputTypes as p}from"../fields/constants.mjs";function f(h){const i=e=>e.uuid!==void 0,t=e=>e.schema.characteristics.inputType===p.composite&&e.children?Object.values(e.children).some(t):!e.isEmpty,a=e=>{if(e==null)return e;if(typeof e=="object"&&!Array.isArray(e)){const r={};return Object.entries(e).forEach(([c,d])=>{const s=a(d);s!==""&&s!==null&&s!==void 0&&(typeof s=="object"&&!Array.isArray(s)?Object.keys(s).length>0&&(r[c]=s):r[c]=s)}),r}return typeof e=="string"?e.trim():e},l=e=>{const r=a(e.value);let c;return e.schema.characteristics.inputType===p.composite?c=r:c={[e.schema.key]:r},e.id?{uuid:e.id,type:e.schema.key,value:c}:{type:e.schema.key,value:c}},y=Object.values(h.fields).filter(t),o=[],n=[],u=[];return y.forEach(e=>{const r=l(e);e.isDirty?i(r)?n.push(r):o.push(r):i(r)&&u.push(r)}),{toCreate:o,toPatch:n,unchanged:u}}export{f as toCreatePatchCredentials};
@@ -35,3 +35,53 @@ export declare const addressSchema: z.ZodEffects<z.ZodObject<{
35
35
  country?: string | undefined;
36
36
  zipCode?: string | undefined;
37
37
  }>;
38
+ export declare const requiredAddressSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
39
+ line1: z.ZodOptional<z.ZodString>;
40
+ line2: z.ZodOptional<z.ZodString>;
41
+ city: z.ZodOptional<z.ZodString>;
42
+ state: z.ZodOptional<z.ZodEnum<[string, ...string[]]>>;
43
+ country: z.ZodOptional<z.ZodEffects<z.ZodString, "US", string>>;
44
+ zipCode: z.ZodOptional<z.ZodString>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ line1?: string | undefined;
47
+ line2?: string | undefined;
48
+ city?: string | undefined;
49
+ state?: string | undefined;
50
+ country?: "US" | undefined;
51
+ zipCode?: string | undefined;
52
+ }, {
53
+ line1?: string | undefined;
54
+ line2?: string | undefined;
55
+ city?: string | undefined;
56
+ state?: string | undefined;
57
+ country?: string | undefined;
58
+ zipCode?: string | undefined;
59
+ }>, {
60
+ line1?: string | undefined;
61
+ line2?: string | undefined;
62
+ city?: string | undefined;
63
+ state?: string | undefined;
64
+ country?: "US" | undefined;
65
+ zipCode?: string | undefined;
66
+ }, {
67
+ line1?: string | undefined;
68
+ line2?: string | undefined;
69
+ city?: string | undefined;
70
+ state?: string | undefined;
71
+ country?: string | undefined;
72
+ zipCode?: string | undefined;
73
+ }>, {
74
+ line1?: string | undefined;
75
+ line2?: string | undefined;
76
+ city?: string | undefined;
77
+ state?: string | undefined;
78
+ country?: "US" | undefined;
79
+ zipCode?: string | undefined;
80
+ }, {
81
+ line1?: string | undefined;
82
+ line2?: string | undefined;
83
+ city?: string | undefined;
84
+ state?: string | undefined;
85
+ country?: string | undefined;
86
+ zipCode?: string | undefined;
87
+ }>;
@@ -1 +1 @@
1
- "use strict";import{z as t}from"zod";import{line1Schema as a,line1ValidationMessage as l}from"./line1.schema.mjs";import{line2Schema as n}from"./line2.schema.mjs";import{citySchema as o,cityValidationMessage as d}from"./city.schema.mjs";import{stateSchema as c,stateValidationMessage as y}from"./state.schema.mjs";import{countrySchema as r,countryValidationMessage as m}from"./country.schema.mjs";import{zipCodeSchema as p,zipCodeValidationMessage as u}from"./zipcode.schema.mjs";const h=t.object({line1:a.optional(),line2:n.optional(),city:o.optional(),state:c.optional(),country:r.optional(),zipCode:p.optional()}).superRefine((e,s)=>{if(Object.values(e).every(i=>!i))return!0;(Object.prototype.hasOwnProperty.call(e,"line1")||Object.prototype.hasOwnProperty.call(e,"line2")||Object.prototype.hasOwnProperty.call(e,"city")||Object.prototype.hasOwnProperty.call(e,"state")||Object.prototype.hasOwnProperty.call(e,"country")||Object.prototype.hasOwnProperty.call(e,"zipCode"))&&(Object.prototype.hasOwnProperty.call(e,"line1")&&(!e.line1||e.line1.trim()==="")&&(a.safeParse(e.line1).success||s.addIssue({code:t.ZodIssueCode.custom,path:["line1"],message:l})),Object.prototype.hasOwnProperty.call(e,"city")&&(!e.city||e.city.trim()==="")&&(o.safeParse(e.city).success||s.addIssue({code:t.ZodIssueCode.custom,path:["city"],message:d})),Object.prototype.hasOwnProperty.call(e,"state")&&(c.safeParse(e.state).success||s.addIssue({code:t.ZodIssueCode.custom,path:["state"],message:y})),Object.prototype.hasOwnProperty.call(e,"country")&&(r.safeParse(e.country).success||s.addIssue({code:t.ZodIssueCode.custom,path:["country"],message:m})),Object.prototype.hasOwnProperty.call(e,"zipCode")&&(p.safeParse(e.zipCode).success||s.addIssue({code:t.ZodIssueCode.custom,path:["zipCode"],message:u})))});export{h as addressSchema};
1
+ "use strict";import{z as s}from"zod";import{line1Schema as a,line1ValidationMessage as r}from"./line1.schema.mjs";import{line2Schema as O}from"./line2.schema.mjs";import{citySchema as c,cityValidationMessage as p}from"./city.schema.mjs";import{stateSchema as i,stateValidationMessage as d}from"./state.schema.mjs";import{countrySchema as l,countryValidationMessage as n}from"./country.schema.mjs";import{zipCodeSchema as y,zipCodeValidationMessage as m}from"./zipcode.schema.mjs";const u=s.object({line1:a.optional(),line2:O.optional(),city:c.optional(),state:i.optional(),country:l.optional(),zipCode:y.optional()}).superRefine((e,t)=>{if(Object.values(e).every(o=>!o))return!0;(Object.prototype.hasOwnProperty.call(e,"line1")||Object.prototype.hasOwnProperty.call(e,"line2")||Object.prototype.hasOwnProperty.call(e,"city")||Object.prototype.hasOwnProperty.call(e,"state")||Object.prototype.hasOwnProperty.call(e,"country")||Object.prototype.hasOwnProperty.call(e,"zipCode"))&&(Object.prototype.hasOwnProperty.call(e,"line1")&&(!e.line1||e.line1.trim()==="")&&(a.safeParse(e.line1).success||t.addIssue({code:s.ZodIssueCode.custom,path:["line1"],message:r})),Object.prototype.hasOwnProperty.call(e,"city")&&(!e.city||e.city.trim()==="")&&(c.safeParse(e.city).success||t.addIssue({code:s.ZodIssueCode.custom,path:["city"],message:p})),Object.prototype.hasOwnProperty.call(e,"state")&&(i.safeParse(e.state).success||t.addIssue({code:s.ZodIssueCode.custom,path:["state"],message:d})),Object.prototype.hasOwnProperty.call(e,"country")&&(l.safeParse(e.country).success||t.addIssue({code:s.ZodIssueCode.custom,path:["country"],message:n})),Object.prototype.hasOwnProperty.call(e,"zipCode")&&(y.safeParse(e.zipCode).success||t.addIssue({code:s.ZodIssueCode.custom,path:["zipCode"],message:m})))}),f=[["line1",r],["city",p],["state",d],["zipCode",m],["country",n]],P=u.superRefine((e,t)=>{f.forEach(([o,h])=>{e[o]||t.addIssue({code:s.ZodIssueCode.custom,path:[o],message:h})})});export{u as addressSchema,P as requiredAddressSchema};
@@ -0,0 +1,106 @@
1
+ import { z } from 'zod';
2
+ export declare const employerSchema: z.ZodObject<{
3
+ employer: z.ZodObject<{
4
+ name: z.ZodString;
5
+ legalName: z.ZodOptional<z.ZodString>;
6
+ address: z.ZodEffects<z.ZodEffects<z.ZodObject<{
7
+ line1: z.ZodOptional<z.ZodString>;
8
+ line2: z.ZodOptional<z.ZodString>;
9
+ city: z.ZodOptional<z.ZodString>;
10
+ state: z.ZodOptional<z.ZodEnum<[string, ...string[]]>>;
11
+ country: z.ZodOptional<z.ZodEffects<z.ZodString, "US", string>>;
12
+ zipCode: z.ZodOptional<z.ZodString>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ line1?: string | undefined;
15
+ line2?: string | undefined;
16
+ city?: string | undefined;
17
+ state?: string | undefined;
18
+ country?: "US" | undefined;
19
+ zipCode?: string | undefined;
20
+ }, {
21
+ line1?: string | undefined;
22
+ line2?: string | undefined;
23
+ city?: string | undefined;
24
+ state?: string | undefined;
25
+ country?: string | undefined;
26
+ zipCode?: string | undefined;
27
+ }>, {
28
+ line1?: string | undefined;
29
+ line2?: string | undefined;
30
+ city?: string | undefined;
31
+ state?: string | undefined;
32
+ country?: "US" | undefined;
33
+ zipCode?: string | undefined;
34
+ }, {
35
+ line1?: string | undefined;
36
+ line2?: string | undefined;
37
+ city?: string | undefined;
38
+ state?: string | undefined;
39
+ country?: string | undefined;
40
+ zipCode?: string | undefined;
41
+ }>, {
42
+ line1?: string | undefined;
43
+ line2?: string | undefined;
44
+ city?: string | undefined;
45
+ state?: string | undefined;
46
+ country?: "US" | undefined;
47
+ zipCode?: string | undefined;
48
+ }, {
49
+ line1?: string | undefined;
50
+ line2?: string | undefined;
51
+ city?: string | undefined;
52
+ state?: string | undefined;
53
+ country?: string | undefined;
54
+ zipCode?: string | undefined;
55
+ }>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ address: {
58
+ line1?: string | undefined;
59
+ line2?: string | undefined;
60
+ city?: string | undefined;
61
+ state?: string | undefined;
62
+ country?: "US" | undefined;
63
+ zipCode?: string | undefined;
64
+ };
65
+ name: string;
66
+ legalName?: string | undefined;
67
+ }, {
68
+ address: {
69
+ line1?: string | undefined;
70
+ line2?: string | undefined;
71
+ city?: string | undefined;
72
+ state?: string | undefined;
73
+ country?: string | undefined;
74
+ zipCode?: string | undefined;
75
+ };
76
+ name: string;
77
+ legalName?: string | undefined;
78
+ }>;
79
+ }, "strip", z.ZodTypeAny, {
80
+ employer: {
81
+ address: {
82
+ line1?: string | undefined;
83
+ line2?: string | undefined;
84
+ city?: string | undefined;
85
+ state?: string | undefined;
86
+ country?: "US" | undefined;
87
+ zipCode?: string | undefined;
88
+ };
89
+ name: string;
90
+ legalName?: string | undefined;
91
+ };
92
+ }, {
93
+ employer: {
94
+ address: {
95
+ line1?: string | undefined;
96
+ line2?: string | undefined;
97
+ city?: string | undefined;
98
+ state?: string | undefined;
99
+ country?: string | undefined;
100
+ zipCode?: string | undefined;
101
+ };
102
+ name: string;
103
+ legalName?: string | undefined;
104
+ };
105
+ }>;
106
+ export type EmployerValue = z.infer<typeof employerSchema>;
@@ -0,0 +1 @@
1
+ "use strict";import{z as e}from"zod";import{employerNameSchema as m}from"./employerName.schema.mjs";import{legalNameSchema as o}from"./legalName.schema.mjs";import{requiredAddressSchema as a}from"../address/address.schema.mjs";const r=e.object({employer:e.object({name:m,legalName:o.optional(),address:a})});export{r as employerSchema};
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ export declare const employerNameValidationMessage = "Employer name is required";
3
+ export declare const employerNameSchema: z.ZodString;
@@ -0,0 +1 @@
1
+ "use strict";import{z as m}from"zod";const e="Employer name is required",a=m.string().trim().min(1,e).max(255,e);export{a as employerNameSchema,e as employerNameValidationMessage};
@@ -0,0 +1 @@
1
+ export * from './employer.schema';
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ export declare const legalNameValidationMessage = "Legal name is required";
3
+ export declare const legalNameSchema: z.ZodString;
@@ -0,0 +1 @@
1
+ "use strict";import{z as e}from"zod";const a="Legal name is required",i=e.string().trim().min(1,a).max(255,a);export{i as legalNameSchema,a as legalNameValidationMessage};
@@ -3,3 +3,4 @@ export * from './name';
3
3
  export * from './driversLicense';
4
4
  export * from './healthInsurance';
5
5
  export * from './other';
6
+ export * from './employer';
@@ -1 +1 @@
1
- "use strict";import{useState as T,useCallback as i,useContext as W,createContext as K}from"react";import{jsx as N}from"react/jsx-runtime";const O=K(null),q=()=>{const m=W(O);if(!m)throw new Error("useForm must be used within a FormProvider");return m},R=({children:m,form:x,onSubmit:h})=>{const[n,l]=T({form:x,isSubmitting:!1,isSubmitSuccess:!1}),s=i(e=>{var t;if(!n.form)return;const r=e.split(".");if(r.length===1){const a=r[0],w=n.form.fields[a];if(w)return w;for(const g of Object.values(n.form.fields))if(g.children){for(const E of Object.values(g.children))if(E.id===a)return E}return}const[o,...c]=r,f=n.form.fields[o];if(!(f!=null&&f.children))return;let u=f;for(const a of c){if(!((t=u?.children)!=null&&t[a]))return;u=u.children[a]}return u},[n.form]),b=i(()=>n.form?n.form.isValid:!1,[n.form]),y=i(e=>{l(t=>({...t,form:e}))},[]),j=i(e=>{if(!n.form)return null;const t=e.split(".");if(t.length<2)return null;const r=t.slice(0,-1).join("."),o=t[t.length-1],c=s(r);if(!c||c.schema.characteristics.inputType!=="composite")throw new Error(`Parent field not found: ${r}`);return{parentField:c,childKey:o}},[n.form,s]),S=i(e=>{if(!e.children)return{};const t={};return Object.entries(e.children).forEach(([r,o])=>{t[r]=o.value}),t},[]),v=i(e=>{const t=j(e);if(t){const{parentField:r}=t,o=S(r);r.value=Object.keys(o).length>0?o:{};const c=e.split(".");if(c.length>2){const f=c.slice(0,-1).join(".");v(f)}}},[j,S]),V=i((e,t)=>{const r=s(e);if(!r){console.warn(`Attempted to update non-existent field: ${e}`);return}r.value!==t&&(r.value=t,v(e),l(o=>o.form?{...o,form:o.form}:o))},[s,v]),P=i((e,t)=>{const r=s(e);if(!r){console.warn(`Attempted to set touched state for non-existent field: ${e}`);return}r.touched!==t&&(r.touched=t,l(o=>o.form?{...o,form:o.form}:o))},[s]),p=i(()=>{l(e=>{if(!e.form)return e;const t=r=>{r.touched=!0,r.children&&Object.values(r.children).forEach(t)};return Object.values(e.form.fields).forEach(t),{...e,form:e.form}})},[]),$=i(()=>{l(e=>{if(!e.form)return e;const t=r=>{r.value=r.defaultValue,r.touched=!1,r.children&&Object.values(r.children).forEach(t)};return Object.values(e.form.fields).forEach(t),{...e,isSubmitting:!1,isSubmitSuccess:!1}})},[]),F=i(e=>{l(t=>({...t,isSubmitting:e}))},[]),d=i(e=>{l(t=>({...t,isSubmitSuccess:e}))},[]),A=i(async()=>{if(n.form){if(!b()){p();return}F(!0),d(!1);try{h&&(await h(n.form),d(!0))}catch(e){console.error("Form submission failed:",e),d(!1)}finally{F(!1)}}},[n.form,h,b,p,F,d]),C=i((e,t)=>{l(r=>{if(!r.form)return console.warn("No form instance available"),r;const o=s(e);return o?(o.replaceWithVariant(t),{...r,form:r.form}):(console.warn(`Field ${e} not found`),r)})},[s]),k={state:n,setForm:y,updateFieldValue:V,setFieldTouched:P,getField:s,validateForm:b,touchAllFields:p,resetForm:$,submitForm:A,replaceFieldWithVariant:C};return N(O.Provider,{value:k,children:m})};export{R as FormProvider,q as useForm};
1
+ "use strict";import{useState as T,useCallback as i,useContext as W,createContext as K}from"react";import{jsx as N}from"react/jsx-runtime";const O=K(null),q=()=>{const m=W(O);if(!m)throw new Error("useForm must be used within a FormProvider");return m},R=({children:m,form:x,onSubmit:h})=>{const[n,s]=T({form:x,isSubmitting:!1,isSubmitSuccess:!1}),l=i(e=>{var o;if(!n.form)return;const r=e.split(".");if(r.length===1){const a=r[0],g=n.form.fields[a];if(g)return g;for(const S of Object.values(n.form.fields))if(S.children){for(const E of Object.values(S.children))if(E.id===a)return E}return}const[t,...f]=r,c=n.form.fields[t];if(!(c!=null&&c.children))return;let u=c;for(const a of f){if(!((o=u?.children)!=null&&o[a]))return;u=u.children[a]}return u},[n.form]),v=i(()=>n.form?n.form.isValid:!1,[n.form]),y=i(e=>{s(o=>({...o,form:e}))},[]),j=i(e=>{if(!n.form)return null;const o=e.split(".");if(o.length<2)return null;const r=o.slice(0,-1).join("."),t=o[o.length-1],f=l(r);if(!f||f.schema.characteristics.inputType!=="composite")throw new Error(`Parent field not found: ${r}`);return{parentField:f,childKey:t}},[n.form,l]),w=i(e=>{if(!e.children)return{};const o={};return Object.entries(e.children).forEach(([r,t])=>{o[r]=t.value}),o},[]),b=i(e=>{const o=j(e);if(o){const{parentField:r}=o,t=w(r);r.value=Object.keys(t).length>0?t:{};const f=e.split(".");if(f.length>2){const c=f.slice(0,-1).join(".");b(c)}}},[j,w]),V=i((e,o)=>{const r=l(e);if(!r){console.warn(`Attempted to update non-existent field: ${e}`);return}r.value!==o&&(r.value=o,b(e),s(t=>t.form?{...t,form:t.form}:t))},[l,b]),P=i((e,o)=>{const r=l(e);if(!r){console.warn(`Attempted to set touched state for non-existent field: ${e}`);return}r.touched!==o&&(r.touched=o,s(t=>t.form?{...t,form:t.form}:t))},[l]),p=i(()=>{s(e=>{if(!e.form)return e;const o=r=>{r.touched=!0,r.children&&Object.values(r.children).forEach(o)};return Object.values(e.form.fields).forEach(o),{...e,form:e.form}})},[]),$=i(()=>{s(e=>{if(!e.form)return e;const o=r=>{r.value=r.defaultValue,r.touched=!1,r.children&&Object.values(r.children).forEach(o)};return Object.values(e.form.fields).forEach(o),{...e}})},[]),F=i(e=>{s(o=>({...o,isSubmitting:e}))},[]),d=i(e=>{s(o=>({...o,isSubmitSuccess:e}))},[]),A=i(async()=>{if(n.form){if(!v()){p();return}F(!0),d(!1);try{h&&(await h(n.form),d(!0))}catch(e){console.error("Form submission failed:",e),d(!1)}finally{F(!1)}}},[n.form,h,v,p,F,d]),C=i((e,o)=>{s(r=>{if(!r.form)return console.warn("No form instance available"),r;const t=l(e);return t?(t.replaceWithVariant(o),{...r,form:r.form}):(console.warn(`Field ${e} not found`),r)})},[l]),k={state:n,setForm:y,updateFieldValue:V,setFieldTouched:P,getField:l,validateForm:v,touchAllFields:p,resetForm:$,submitForm:A,replaceFieldWithVariant:C};return N(O.Provider,{value:k,children:m})};export{R as FormProvider,q as useForm};
@@ -1 +1 @@
1
- "use strict";import{AddressInput as k}from"../../../../../AddressInput/index.mjs";import{useFormField as A}from"../../../core/field.hook.mjs";import{useOneClickForm as b}from"../../form.context.mjs";import{FieldLabel as z}from"./label.mjs";import{ClearFieldAdornment as F}from"./clear-field-adornment.mjs";import{jsx as t}from"react/jsx-runtime";import{fieldInputTypes as I}from"../../../../core/fields/constants.mjs";function T({fieldKey:i}){var n,u,s,d,a,r;const{options:v}=b(),{field:e,setChildValue:o,setTouched:h}=A({key:i});if(e?.schema.characteristics.inputType!==I.composite)return null;const P=(n=e.errorMessage)==null?void 0:n.toLowerCase().startsWith("line 2"),c=(e.touched||e.isDirty)&&!!e.errors&&!P;return t(k,{label:t(z,{fieldKey:i}),helperText:c?e.errorMessage??e?.description:e?.description,error:c,onBlur:()=>h(!0),disabled:e.isDisabled,defaultValue:{line1:(u=e?.value)==null?void 0:u.line1,city:(s=e?.value)==null?void 0:s.city,state:(d=e?.value)==null?void 0:d.state,zipCode:(a=e?.value)==null?void 0:a.zipCode,country:((r=e?.value)==null?void 0:r.country)??"US"},onChange:l=>{var p,y,m,f,g;typeof l!="string"&&(l===null&&Object.keys(e?.value??{}).forEach(C=>{C!=="line2"&&o(C,"")}),typeof((p=e?.value)==null?void 0:p.line1)=="string"&&o("line1",l?.line1??""),typeof((y=e?.value)==null?void 0:y.city)=="string"&&o("city",l?.city??""),typeof((m=e?.value)==null?void 0:m.state)=="string"&&o("state",l?.state??""),typeof((f=e?.value)==null?void 0:f.zipCode)=="string"&&o("zipCode",l?.zipCode??""),typeof((g=e?.value)==null?void 0:g.country)=="string"&&o("country",l?.country??""))},InputProps:{"data-mask-me":!0},ClearAdornment:function({onClick:l}){return t(F,{fieldKey:i,onClick:l,ignoreKeys:["line2"]})},service:{googlePlacesAutocompletePlaces:v.servicePaths.googlePlacesAutocompletePlaces,googlePlacesGetPlace:v.servicePaths.googlePlacesGetPlace}})}export{T as AddressInputField};
1
+ "use strict";import{AddressInput as k}from"../../../../../AddressInput/index.mjs";import{useFormField as A}from"../../../core/field.hook.mjs";import{useOneClickForm as F}from"../../form.context.mjs";import{FieldLabel as b}from"./label.mjs";import{ClearFieldAdornment as z}from"./clear-field-adornment.mjs";import{jsx as t}from"react/jsx-runtime";import{fieldInputTypes as I}from"../../../../core/fields/constants.mjs";function T({fieldKey:i}){var n,u,s,d,a,r;const{options:v}=F(),{field:l,setChildValue:o,setTouched:h}=A({key:i});if(l?.schema.characteristics.inputType!==I.composite)return null;const P=(n=l.errorMessage)==null?void 0:n.toLowerCase().startsWith("line 2"),c=(l.touched||l.isDirty)&&!!l.errors&&!P;return t(k,{size:"small",label:t(b,{fieldKey:i}),helperText:c?l.errorMessage??l?.description:l?.description,error:c,onBlur:()=>h(!0),disabled:l.isDisabled,defaultValue:{line1:(u=l?.value)==null?void 0:u.line1,city:(s=l?.value)==null?void 0:s.city,state:(d=l?.value)==null?void 0:d.state,zipCode:(a=l?.value)==null?void 0:a.zipCode,country:((r=l?.value)==null?void 0:r.country)??"US"},onChange:e=>{var p,m,y,f,g;typeof e!="string"&&(e===null&&Object.keys(l?.value??{}).forEach(C=>{C!=="line2"&&o(C,"")}),typeof((p=l?.value)==null?void 0:p.line1)=="string"&&o("line1",e?.line1??""),typeof((m=l?.value)==null?void 0:m.city)=="string"&&o("city",e?.city??""),typeof((y=l?.value)==null?void 0:y.state)=="string"&&o("state",e?.state??""),typeof((f=l?.value)==null?void 0:f.zipCode)=="string"&&o("zipCode",e?.zipCode??""),typeof((g=l?.value)==null?void 0:g.country)=="string"&&o("country",e?.country??""))},InputProps:{"data-mask-me":!0},ClearAdornment:function({onClick:e}){return t(z,{fieldKey:i,onClick:e,ignoreKeys:["line2"]})},service:{googlePlacesAutocompletePlaces:v.servicePaths.googlePlacesAutocompletePlaces,googlePlacesGetPlace:v.servicePaths.googlePlacesGetPlace}})}export{T as AddressInputField};
@@ -0,0 +1,3 @@
1
+ export declare function EmployerInputField({ fieldKey }: {
2
+ fieldKey: string;
3
+ }): import("react").JSX.Element | null;
@@ -0,0 +1 @@
1
+ "use strict";import{useState as k}from"react";import{Stack as x,TextField as d}from"@mui/material";import{AddressInput as I}from"../../../../../AddressInput/index.mjs";import{useFormField as N}from"../../../core/field.hook.mjs";import{RequiredLabel as v}from"../shared.mjs";import{useOneClickForm as q}from"../../form.context.mjs";import{jsxs as F,jsx as o}from"react/jsx-runtime";function D({fieldKey:h}){var n,u;const{options:m}=q(),{field:a,setValue:P}=N({key:h}),[y,b]=k({});if(!a)return null;const p=a.value;if(!p)return null;const l=p.employer,r=e=>{b(s=>s[e]?s:{...s,[e]:!0})},i=e=>{P({employer:{...l,...e}})},C=((u=(n=a.errors)==null?void 0:n.error)==null?void 0:u.issues)??[],t=e=>{var s;if(!(!a.touched&&!y[e]))return(s=C.find(z=>z.path[1]===e))==null?void 0:s.message},c=t("name"),f=t("legalName"),g=t("address");return F(x,{spacing:2,children:[o(d,{fullWidth:!0,size:"small",label:o(v,{required:a.isRequired,children:"Name"}),value:l.name??"",onChange:e=>{i({name:e.target.value}),r("name")},onBlur:()=>r("name"),error:!!c,helperText:c,disabled:a.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}}),o(d,{fullWidth:!0,size:"small",label:"Legal Name",value:l.legalName??"",onChange:e=>{i({legalName:e.target.value||void 0}),r("legalName")},onBlur:()=>r("legalName"),error:!!f,helperText:f,disabled:a.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}}),o(I,{size:"small",label:o(v,{required:a.isRequired,children:"Address"}),defaultValue:{line1:l.address.line1,city:l.address.city,state:l.address.state,zipCode:l.address.zipCode,country:l.address.country??"US"},onChange:e=>{if(typeof e=="string")return;const s={line1:e?.line1,line2:l.address.line2??"",city:e?.city,state:e?.state,zipCode:e?.zipCode,country:e?.country==="US"?"US":void 0};i({address:s}),r("address")},onBlur:()=>r("address"),error:!!g,helperText:g,disabled:a.isDisabled,InputProps:{"data-mask-me":!0},service:{googlePlacesAutocompletePlaces:m.servicePaths.googlePlacesAutocompletePlaces,googlePlacesGetPlace:m.servicePaths.googlePlacesGetPlace}}),o(d,{fullWidth:!0,size:"small",label:"Line 2",value:l.address.line2??"",onChange:e=>i({address:{...l.address,line2:e.target.value}}),disabled:a.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}})]})}export{D as EmployerInputField};
@@ -1 +1 @@
1
- "use strict";import{Stack as y}from"@mui/material";import{credentialKeys as o}from"../../../../core/fields/index.mjs";import{useFormField as K}from"../../../core/field.hook.mjs";import{useOneClickForm as F}from"../../form.context.mjs";import{FieldRowContainer as d,FieldSectionTitle as m,FieldSectionContent as f}from"../style.mjs";import{getDisplayFieldKeys as v}from"../field-order.mjs";import{AddressInputField as k}from"./address.field.mjs";import{PhoneInputField as I}from"./phone.field.mjs";import{TextInputField as u}from"./text.field.mjs";import{SelectInputField as x}from"./select.field.mjs";import{SSNInputField as T}from"./ssn.field.mjs";import{DateInputField as $}from"./date.field.mjs";import{HealthInsuranceInputField as g}from"./healthInsurance.field.mjs";import{jsx as i,jsxs as p,Fragment as S}from"react/jsx-runtime";import{fieldInputTypes as t}from"../../../../core/fields/constants.mjs";function h({fieldKey:e}){var r,a;const{field:l}=K({key:e}),c=(n,s)=>s?.schema.characteristics.inputType===t.text&&s?.schema.key===o.ssn?i(T,{fieldKey:n}):s?.schema.characteristics.inputType===t.date?i($,{fieldKey:n}):s?.schema.characteristics.inputType===t.select?i(x,{fieldKey:n}):s?.schema.characteristics.inputType===t.text?i(u,{fieldKey:n}):(console.warn("Field not supported:",s?.schema.key),null);return((r=l?.schema)==null?void 0:r.key)===o.phone?i(d,{fieldKey:e,children:i(I,{fieldKey:e})}):((a=l?.schema)==null?void 0:a.key)===o.healthInsurance?p(d,{fieldKey:e,spacing:1.25,children:[i(m,{fieldKey:e,description:"Enter your insurance info:"}),i(f,{spacing:1.25,children:i(g,{fieldKey:e})})]}):l?.schema.characteristics.inputType===t.composite?l!=null&&l.children?l.schema.key===o.fullName?Object.keys(l.children).map(n=>{var s;return i(d,{fieldKey:`${e}.${n}`,children:c(`${e}.${n}`,(s=l.children)==null?void 0:s[n])},n)}):l.schema.key===o.address?p(S,{children:[i(d,{fieldKey:e,children:i(k,{fieldKey:e})}),i(d,{fieldKey:`${e}.line2`,children:i(u,{fieldKey:`${e}.line2`})})]}):p(d,{fieldKey:e,spacing:1.25,children:[i(m,{fieldKey:e}),i(f,{spacing:2,sx:{pt:1},children:Object.keys(l.children).map(n=>i(h,{fieldKey:`${e}.${n}`},n))})]}):null:i(d,{fieldKey:e,children:c(e,l)})}function w(){var e,r;const a=F(),{fields:l}=a.formContext.state.form,c=v(l,{showPhone:(r=(e=a.options.features.field)==null?void 0:e.phone)==null?void 0:r.show});return i(y,{spacing:2,sx:{width:"100%"},children:c.map(n=>i(h,{fieldKey:n},n))})}export{w as EditFields};
1
+ "use strict";import{Stack as K}from"@mui/material";import{credentialKeys as d}from"../../../../core/fields/index.mjs";import{useFormField as v}from"../../../core/field.hook.mjs";import{useOneClickForm as F}from"../../form.context.mjs";import{FieldRowContainer as t,FieldSectionTitle as f,FieldSectionContent as u}from"../style.mjs";import{getDisplayFieldKeys as k}from"../field-order.mjs";import{AddressInputField as I}from"./address.field.mjs";import{PhoneInputField as g}from"./phone.field.mjs";import{TextInputField as y}from"./text.field.mjs";import{SelectInputField as x}from"./select.field.mjs";import{SSNInputField as T}from"./ssn.field.mjs";import{DateInputField as $}from"./date.field.mjs";import{HealthInsuranceInputField as S}from"./healthInsurance.field.mjs";import{EmployerInputField as w}from"./employer.field.mjs";import{jsx as i,jsxs as m,Fragment as j}from"react/jsx-runtime";import{fieldInputTypes as c}from"../../../../core/fields/constants.mjs";function h({fieldKey:e}){var a,o,p;const{field:l}=v({key:e}),r=(s,n)=>n?.schema.characteristics.inputType===c.text&&n?.schema.key===d.ssn?i(T,{fieldKey:s}):n?.schema.characteristics.inputType===c.date?i($,{fieldKey:s}):n?.schema.characteristics.inputType===c.select?i(x,{fieldKey:s}):n?.schema.characteristics.inputType===c.text?i(y,{fieldKey:s}):(console.warn("Field not supported:",n?.schema.key),null);return((a=l?.schema)==null?void 0:a.key)===d.phone?i(t,{fieldKey:e,children:i(g,{fieldKey:e})}):((o=l?.schema)==null?void 0:o.key)===d.healthInsurance?m(t,{fieldKey:e,spacing:1.25,children:[i(f,{fieldKey:e,description:"Enter your insurance info:"}),i(u,{spacing:1.25,children:i(S,{fieldKey:e})})]}):((p=l?.schema)==null?void 0:p.key)===d.employer?m(t,{fieldKey:e,spacing:1.25,children:[i(f,{fieldKey:e}),i(u,{spacing:1.25,children:i(w,{fieldKey:e})})]}):l?.schema.characteristics.inputType===c.composite?l!=null&&l.children?l.schema.key===d.fullName?Object.keys(l.children).map(s=>{var n;return i(t,{fieldKey:`${e}.${s}`,children:r(`${e}.${s}`,(n=l.children)==null?void 0:n[s])},s)}):l.schema.key===d.address?m(j,{children:[i(t,{fieldKey:e,children:i(I,{fieldKey:e})}),i(t,{fieldKey:`${e}.line2`,children:i(y,{fieldKey:`${e}.line2`})})]}):m(t,{fieldKey:e,spacing:1.25,children:[i(f,{fieldKey:e}),i(u,{spacing:2,sx:{pt:1},children:Object.keys(l.children).map(s=>i(h,{fieldKey:`${e}.${s}`},s))})]}):null:i(t,{fieldKey:e,children:r(e,l)})}function C(){var e,a;const o=F(),{fields:p}=o.formContext.state.form,l=k(p,{showPhone:(a=(e=o.options.features.field)==null?void 0:e.phone)==null?void 0:a.show});return i(K,{spacing:2,sx:{width:"100%"},children:l.map(r=>i(h,{fieldKey:r},r))})}export{C as EditFields};
@@ -1 +1 @@
1
- "use strict";import{useState as I,useRef as H,useCallback as O,createElement as R}from"react";import{Stack as S,Autocomplete as j,TextField as K,Box as W,Typography as z,InputAdornment as Q,IconButton as $,Avatar as G}from"@mui/material";import{Close as J}from"@mui/icons-material";import{useQuery as N}from"@tanstack/react-query";import{useDebounceValue as X}from"../../../../../../../hooks/useDebounceValue.mjs";import{MemberIdInput as Y}from"../../../../../MemberIdInput/index.mjs";import{useFormField as Z}from"../../../core/field.hook.mjs";import{useOneClickForm as _}from"../../form.context.mjs";import{jsxs as C,jsx as n,Fragment as B}from"react/jsx-runtime";const y=20;function ee(o){const{options:a}=_(),l=X(o,300),[m,c]=I([]),[s,i]=I(!0),[f,g]=I(!1),p=H(0),{isLoading:P}=N({queryKey:["insurance-providers",l],queryFn:async({signal:h})=>{var t,d;const u=await((d=(t=a.servicePaths).oneClickHealthProviderPayers)==null?void 0:d.call(t,{search:l||void 0,limit:y,skip:0},h))??[];return p.current=u.length,c(u),i(u.length>=y),u},refetchOnMount:!0,enabled:!!a.servicePaths.oneClickHealthProviderPayers}),b=O(async()=>{var h,t;if(!(f||!s)){g(!0);try{const d=await((t=(h=a.servicePaths).oneClickHealthProviderPayers)==null?void 0:t.call(h,{search:l||void 0,limit:y,skip:p.current}))??[];c(u=>[...u,...d]),p.current+=d.length,i(d.length>=y)}finally{g(!1)}}},[f,s,l,a.servicePaths]);return{providers:m,isLoading:P,isLoadingMore:f,hasMore:s,loadMore:b}}function V({children:o,required:a}){return a?C(B,{children:[o," ",n(z,{"data-asterisk":!0,component:"span",color:"error",variant:"subtitle2",sx:{fontSize:"inherit"},children:"\u273D"})]}):n(B,{children:o})}function re({name:o,logoUrl:a}){var l;const[m,c]=I(!1),s=m?void 0:a||void 0;return n(G,{src:s,alt:`${o} logo`,sx:{width:32,height:32,borderRadius:1,bgcolor:s?"transparent":"primary.main"},slotProps:{img:{onError:()=>c(!0)}},children:(l=o[0])==null?void 0:l.toUpperCase()})}function ie({fieldKey:o}){var a,l,m,c,s;const{field:i,setValue:f,setTouched:g}=Z({key:o}),[p,P]=I(""),{providers:b,isLoading:h,isLoadingMore:t,hasMore:d,loadMore:u}=ee(p),w=H(null),E=O(e=>{const r=e.currentTarget;r.scrollTop+r.clientHeight>=r.scrollHeight-50&&d&&!t&&u()},[d,t,u]);if(!i)return null;const v=i.value;if(!v)return null;const k=e=>{f({...v,...e})},M=(i.touched||i.isDirty)&&!i.isValid,x=((l=(a=i.errors)==null?void 0:a.error)==null?void 0:l.issues)??[],T=((m=x.find(e=>e.path.join(".")==="payer.name"))==null?void 0:m.message)??((c=x.find(e=>e.path[0]==="payer"))==null?void 0:c.message),q=(s=x.find(e=>e.path[0]==="memberId"))==null?void 0:s.message,D=M&&!!T,F=M&&!!q,L=b.find(e=>e.verifiedId===v.payer.verifiedId)??v.payer;return C(S,{spacing:2,children:[n(j,{fullWidth:!0,disabled:i.isDisabled,options:b,loading:h||t,filterOptions:e=>e,value:L.verifiedId?L:null,inputValue:p,onInputChange:(e,r)=>{P(r)},onChange:(e,r)=>{k(r?{payer:{name:r.name,logoUrl:r.logoUrl,verifiedId:r.verifiedId},memberId:""}:{payer:{name:"",logoUrl:void 0,verifiedId:""},memberId:""})},isOptionEqualToValue:(e,r)=>!!e&&!!r&&e.verifiedId===r.verifiedId,getOptionLabel:e=>e.name,ListboxProps:{ref:w,onScroll:E},renderOption:(e,r)=>R(W,{component:"li",...e,key:r.verifiedId},C(S,{direction:"row",spacing:1.5,alignItems:"center",children:[n(re,{name:r.name,logoUrl:r.logoUrl}),n(z,{sx:{textAlign:"left"},children:r.name})]})),renderInput:e=>n(K,{...e,label:n(V,{required:i.isRequired,children:"Insurer"}),error:D,helperText:D?T:"The company that provides your health insurance",placeholder:"Search...",size:"small",InputLabelProps:{shrink:!0},InputProps:{...e.InputProps,"data-mask-me":!0,endAdornment:e.InputProps.endAdornment},inputProps:{...e.inputProps,onBlur:r=>{var A,U;(U=(A=e.inputProps).onBlur)==null||U.call(A,r),g(!0)}}})}),n(Y,{fullWidth:!0,label:n(V,{required:i.isRequired,children:"Member ID"}),placeholder:"Enter member ID",size:"small",disabled:i.isDisabled,value:v.memberId,onChange:e=>k({memberId:e.target.value}),onBlur:()=>g(!0),error:F,helperText:F?q:"From your health insurance ID card",InputProps:{"data-mask-me":!0,endAdornment:v.memberId?n(Q,{position:"end",children:n($,{tabIndex:-1,"aria-label":"clear member id",edge:"end",size:"small",disabled:i.isDisabled,onClick:()=>k({memberId:""}),children:n(J,{fontSize:"small"})})}):null}})]})}export{ie as HealthInsuranceInputField};
1
+ "use strict";import{useState as I,useRef as U,useCallback as H,createElement as w}from"react";import{Stack as O,Autocomplete as z,TextField as E,Box as j,Typography as K,InputAdornment as W,IconButton as Q,Avatar as $}from"@mui/material";import{Close as G}from"@mui/icons-material";import{useQuery as J}from"@tanstack/react-query";import{useDebounceValue as N}from"../../../../../../../hooks/useDebounceValue.mjs";import{MemberIdInput as X}from"../../../../../MemberIdInput/index.mjs";import{useFormField as Y}from"../../../core/field.hook.mjs";import{useOneClickForm as Z}from"../../form.context.mjs";import{RequiredLabel as B}from"../shared.mjs";import{jsxs as R,jsx as n}from"react/jsx-runtime";const y=20;function _(m){const{options:a}=Z(),o=N(m,300),[p,u]=I([]),[l,i]=I(!0),[f,g]=I(!1),c=U(0),{isLoading:P}=J({queryKey:["insurance-providers",o],queryFn:async({signal:h})=>{var s,t;const d=await((t=(s=a.servicePaths).oneClickHealthProviderPayers)==null?void 0:t.call(s,{search:o||void 0,limit:y,skip:0},h))??[];return c.current=d.length,u(d),i(d.length>=y),d},refetchOnMount:!0,enabled:!!a.servicePaths.oneClickHealthProviderPayers}),b=H(async()=>{var h,s;if(!(f||!l)){g(!0);try{const t=await((s=(h=a.servicePaths).oneClickHealthProviderPayers)==null?void 0:s.call(h,{search:o||void 0,limit:y,skip:c.current}))??[];u(d=>[...d,...t]),c.current+=t.length,i(t.length>=y)}finally{g(!1)}}},[f,l,o,a.servicePaths]);return{providers:p,isLoading:P,isLoadingMore:f,hasMore:l,loadMore:b}}function ee({name:m,logoUrl:a}){var o;const[p,u]=I(!1),l=p?void 0:a||void 0;return n($,{src:l,alt:`${m} logo`,sx:{width:32,height:32,borderRadius:1,bgcolor:l?"transparent":"primary.main"},slotProps:{img:{onError:()=>u(!0)}},children:(o=m[0])==null?void 0:o.toUpperCase()})}function re({fieldKey:m}){var a,o,p,u,l;const{field:i,setValue:f,setTouched:g}=Y({key:m}),[c,P]=I(""),{providers:b,isLoading:h,isLoadingMore:s,hasMore:t,loadMore:d}=_(c),S=U(null),V=H(e=>{const r=e.currentTarget;r.scrollTop+r.clientHeight>=r.scrollHeight-50&&t&&!s&&d()},[t,s,d]);if(!i)return null;const v=i.value;if(!v)return null;const k=e=>{f({...v,...e})},C=(i.touched||i.isDirty)&&!i.isValid,x=((o=(a=i.errors)==null?void 0:a.error)==null?void 0:o.issues)??[],L=((p=x.find(e=>e.path.join(".")==="payer.name"))==null?void 0:p.message)??((u=x.find(e=>e.path[0]==="payer"))==null?void 0:u.message),M=(l=x.find(e=>e.path[0]==="memberId"))==null?void 0:l.message,T=C&&!!L,q=C&&!!M,D=b.find(e=>e.verifiedId===v.payer.verifiedId)??v.payer;return R(O,{spacing:2,children:[n(z,{fullWidth:!0,disabled:i.isDisabled,options:b,loading:h||s,filterOptions:e=>e,value:D.verifiedId?D:null,inputValue:c,onInputChange:(e,r)=>{P(r)},onChange:(e,r)=>{k(r?{payer:{name:r.name,logoUrl:r.logoUrl,verifiedId:r.verifiedId},memberId:""}:{payer:{name:"",logoUrl:void 0,verifiedId:""},memberId:""})},isOptionEqualToValue:(e,r)=>!!e&&!!r&&e.verifiedId===r.verifiedId,getOptionLabel:e=>e.name,ListboxProps:{ref:S,onScroll:V},renderOption:(e,r)=>w(j,{component:"li",...e,key:r.verifiedId},R(O,{direction:"row",spacing:1.5,alignItems:"center",children:[n(ee,{name:r.name,logoUrl:r.logoUrl}),n(K,{sx:{textAlign:"left"},children:r.name})]})),renderInput:e=>n(E,{...e,label:n(B,{required:i.isRequired,children:"Insurer"}),error:T,helperText:T?L:"The company that provides your health insurance",placeholder:"Search...",size:"small",InputLabelProps:{shrink:!0},InputProps:{...e.InputProps,"data-mask-me":!0,endAdornment:e.InputProps.endAdornment},inputProps:{...e.inputProps,onBlur:r=>{var A,F;(F=(A=e.inputProps).onBlur)==null||F.call(A,r),g(!0)}}})}),n(X,{fullWidth:!0,label:n(B,{required:i.isRequired,children:"Member ID"}),placeholder:"Enter member ID",size:"small",disabled:i.isDisabled,value:v.memberId,onChange:e=>k({memberId:e.target.value}),onBlur:()=>g(!0),error:q,helperText:q?M:"From your health insurance ID card",InputProps:{"data-mask-me":!0,endAdornment:v.memberId?n(W,{position:"end",children:n(Q,{tabIndex:-1,"aria-label":"clear member id",edge:"end",size:"small",disabled:i.isDisabled,onClick:()=>k({memberId:""}),children:n(G,{fontSize:"small"})})}):null}})]})}export{re as HealthInsuranceInputField};
@@ -0,0 +1,3 @@
1
+ export declare function EmployerField({ fieldKey }: {
2
+ fieldKey: string;
3
+ }): import("react").JSX.Element | null;
@@ -0,0 +1 @@
1
+ "use strict";import{Stack as n,MenuItem as u,Typography as d}from"@mui/material";import{useFormField as p}from"../../../core/field.hook.mjs";import{FieldSectionTitle as f,FieldSectionContent as h,FieldLabelBase as v}from"../style.mjs";import{VariantSelectField as y}from"./variantSelect.field.mjs";import{jsxs as o,jsx as e}from"react/jsx-runtime";import{addressFormat as g}from"../../../../core/formats/address.format.mjs";function s({label:a,value:t}){return o(n,{direction:"row",children:[e(v,{label:a}),e(d,{"data-mask-me":!0,variant:"body1",sx:{fontSize:20,fontWeight:300,wordBreak:"break-word",textAlign:"left"},children:t})]})}function m({item:a}){return o(n,{spacing:1.25,children:[e(s,{label:"Name",value:a.name}),a.legalName&&e(s,{label:"Legal Name",value:a.legalName}),e(s,{label:"Address",value:g(a.address)??"-"})]})}function b({fieldKey:a}){var t;const{field:i}=p({key:a});if(!i)return null;if(!i.hasVariants){const l=(t=i.value)==null?void 0:t.employer;return l?o(n,{spacing:1.25,children:[e(f,{fieldKey:a}),e(h,{spacing:1.25,children:e(m,{item:l})})]}):null}const c=i.variants??[];return e(y,{fieldKey:a,testId:`data-employer-select-${a}`,renderValue:()=>{var l;const r=(l=i.value)==null?void 0:l.employer;return r?e(m,{item:r}):null},children:c.map(l=>e(u,{value:l.id,onClick:r=>r.stopPropagation(),sx:{maxWidth:"100%",whiteSpace:"pre-wrap"},children:e(d,{variant:"body1",fontWeight:500,children:l.displayValue??"-"})},l.id))})}export{b as EmployerField};
@@ -1 +1 @@
1
- "use strict";import{Stack as p}from"@mui/material";import{credentialKeys as a}from"../../../../core/fields/index.mjs";import{useFormField as h}from"../../../core/field.hook.mjs";import{useOneClickForm as y}from"../../form.context.mjs";import{FieldRowContainer as t,FieldRow as f,FieldSectionTitle as u,FieldSectionContent as K}from"../style.mjs";import{getDisplayFieldKeys as v}from"../field-order.mjs";import{MultiField as m}from"./multi.field.mjs";import{SingleField as F}from"./single.field.mjs";import{HealthInsuranceField as k}from"./healthInsurance.field.mjs";import{DriversLicenseField as g}from"./driversLicense.field.mjs";import{jsx as l,jsxs as x}from"react/jsx-runtime";import{fieldInputTypes as C}from"../../../../core/fields/constants.mjs";function r({fieldKey:e}){var d,s;const{field:i}=h({key:e});return((d=i?.schema)==null?void 0:d.key)===a.driversLicense&&i.hasVariants?l(t,{fieldKey:e,spacing:1.25,children:l(g,{fieldKey:e})}):((s=i?.schema)==null?void 0:s.key)===a.healthInsurance?l(t,{fieldKey:e,spacing:1.25,children:l(k,{fieldKey:e})}):i?.schema.characteristics.inputType===C.composite&&i.children?i.schema.key===a.address?l(f,{fieldKey:e,children:l(m,{fieldKey:e})}):i.schema.key===a.fullName?l(t,{fieldKey:e,spacing:1.25,children:Object.keys(i.children).map(o=>l(r,{fieldKey:`${e}.${o}`},o))}):x(t,{fieldKey:e,spacing:1.25,children:[l(u,{fieldKey:e}),l(K,{spacing:1.25,children:Object.keys(i.children).map(o=>l(r,{fieldKey:`${e}.${o}`},o))})]}):l(f,{fieldKey:e,children:i!=null&&i.hasVariants?l(m,{fieldKey:e}):l(F,{fieldKey:e})})}function w(){var e,d;const s=y(),{fields:i}=s.formContext.state.form,o=v(i,{showPhone:(d=(e=s.options.features.field)==null?void 0:e.phone)==null?void 0:d.show});return l(p,{spacing:1.25,sx:{width:"100%"},onClick:()=>{var n,c;(((n=s.options.features.editMode)==null?void 0:n.hide)??((c=s.formContext.state.form)==null?void 0:c.isDisabled))||s.setEditMode(!0)},children:o.map(n=>l(r,{fieldKey:n},n))})}export{w as ReadonlyFields};
1
+ "use strict";import{Stack as p}from"@mui/material";import{credentialKeys as r}from"../../../../core/fields/index.mjs";import{useFormField as y}from"../../../core/field.hook.mjs";import{useOneClickForm as h}from"../../form.context.mjs";import{FieldRowContainer as n,FieldRow as c,FieldSectionTitle as u,FieldSectionContent as K}from"../style.mjs";import{getDisplayFieldKeys as v}from"../field-order.mjs";import{MultiField as f}from"./multi.field.mjs";import{SingleField as F}from"./single.field.mjs";import{HealthInsuranceField as k}from"./healthInsurance.field.mjs";import{DriversLicenseField as g}from"./driversLicense.field.mjs";import{EmployerField as x}from"./employer.field.mjs";import{jsx as l,jsxs as C}from"react/jsx-runtime";import{fieldInputTypes as w}from"../../../../core/fields/constants.mjs";function m({fieldKey:e}){var d,o,a;const{field:i}=y({key:e});return((d=i?.schema)==null?void 0:d.key)===r.driversLicense&&i.hasVariants?l(n,{fieldKey:e,spacing:1.25,children:l(g,{fieldKey:e})}):((o=i?.schema)==null?void 0:o.key)===r.healthInsurance&&!i.isEmpty?l(n,{fieldKey:e,spacing:1.25,children:l(k,{fieldKey:e})}):((a=i?.schema)==null?void 0:a.key)===r.employer&&!i.isEmpty?l(n,{fieldKey:e,spacing:1.25,children:l(x,{fieldKey:e})}):i?.schema.characteristics.inputType===w.composite&&i.children?i.schema.key===r.address?l(c,{fieldKey:e,children:l(f,{fieldKey:e})}):i.schema.key===r.fullName?l(n,{fieldKey:e,spacing:1.25,children:Object.keys(i.children).map(s=>l(m,{fieldKey:`${e}.${s}`},s))}):C(n,{fieldKey:e,spacing:1.25,children:[l(u,{fieldKey:e}),l(K,{spacing:1.25,children:Object.keys(i.children).map(s=>l(m,{fieldKey:`${e}.${s}`},s))})]}):l(c,{fieldKey:e,children:i!=null&&i.hasVariants?l(f,{fieldKey:e}):l(F,{fieldKey:e})})}function E(){var e,d;const o=h(),{fields:a}=o.formContext.state.form,i=v(a,{showPhone:(d=(e=o.options.features.field)==null?void 0:e.phone)==null?void 0:d.show});return l(p,{spacing:1.25,sx:{width:"100%"},onClick:()=>{var s,t;(((s=o.options.features.editMode)==null?void 0:s.hide)??((t=o.formContext.state.form)==null?void 0:t.isDisabled))||(o.setEditMode(!0),o.setUserInitiatedEdit(!0))},children:i.map(s=>l(m,{fieldKey:s},s))})}export{E as ReadonlyFields};
@@ -1 +1 @@
1
- "use strict";import{Typography as s,Stack as i,MenuItem as I,Avatar as f}from"@mui/material";import{useFormField as S}from"../../../core/field.hook.mjs";import{FieldSectionTitle as F,FieldSectionContent as A,FieldLabelBase as v,FieldDescriptionBase as C}from"../style.mjs";import{VariantSelectField as B}from"./variantSelect.field.mjs";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{maskMemberId as y}from"../../../../core/formats/healthInsurance.format.mjs";const x=48,D={pointerEvents:"auto"};function b({item:n}){var d,a,c,r,o;return e(i,{py:1,children:t(i,{direction:"row",sx:{flex:1},spacing:1.5,children:[e(f,{draggable:!1,src:((d=n.payer)==null?void 0:d.logoUrl)??"",sx:{bgcolor:"primary.main",width:x,height:x,borderRadius:2,flexShrink:0},slotProps:{img:{onError:m=>{m.currentTarget.style.display="none"}}},children:(r=(c=(a=n.payer)==null?void 0:a.name)==null?void 0:c[0])==null?void 0:r.toUpperCase()}),t(i,{direction:"column",spacing:1.5,children:[e(i,{direction:"row",spacing:1.5,children:t(i,{direction:"row",sx:{flex:1},children:[e(v,{label:"Insurer"}),e(s,{"data-mask-me":!0,variant:"body1",sx:{fontSize:20,fontWeight:300,wordBreak:"break-word",textAlign:"left"},children:(o=n.payer)==null?void 0:o.name})]})}),t(i,{direction:"row",children:[e(v,{label:"Member ID"}),t(i,{children:[e(s,{"data-mask-me":!0,variant:"body1",sx:{fontSize:20,fontWeight:300,wordBreak:"break-word",textAlign:"left"},children:y(n.memberId)}),e(C,{description:"Hidden for privacy"})]})]})]})]})})}function P({fieldKey:n}){var d;const{field:a}=S({key:n});if(!a)return null;if(!a.hasVariants){const r=a.value;return(d=r?.payer)!=null&&d.name?t(i,{spacing:1.25,sx:D,onClick:o=>{o.preventDefault(),o.stopPropagation()},children:[e(F,{fieldKey:n}),e(A,{spacing:1.25,children:e(b,{item:r})})]}):e(s,{sx:{textAlign:"left"},children:"No health insurance information available."})}const c=a.variants??[];return e(B,{fieldKey:n,testId:`data-health-insurance-select-${n}`,renderValue:()=>{const r=a.value;return r?e(b,{item:r}):null},children:c.map(r=>{var o,m,u,h,g;const l=r.value,k=((o=l?.payer)==null?void 0:o.name)??"-",w=l!=null&&l.memberId?y(l.memberId):"-";return e(I,{value:r.id,onClick:p=>p.stopPropagation(),sx:{maxWidth:"100%",whiteSpace:"pre-wrap"},children:t(i,{direction:"row",spacing:1.5,alignItems:"center",children:[e(f,{draggable:!1,src:((m=l?.payer)==null?void 0:m.logoUrl)??"",sx:{bgcolor:"primary.main",width:32,height:32,borderRadius:1,flexShrink:0},slotProps:{img:{onError:p=>{p.currentTarget.style.display="none"}}},children:(g=(h=(u=l?.payer)==null?void 0:u.name)==null?void 0:h[0])==null?void 0:g.toUpperCase()}),t(i,{sx:{alignItems:"flex-start",textAlign:"left"},children:[e(s,{variant:"body1",fontWeight:500,children:k}),e(s,{variant:"caption",color:"text.secondary",children:w})]})]})},r.id)})})}export{P as HealthInsuranceField};
1
+ "use strict";import{Stack as i,MenuItem as k,Avatar as g,Typography as m}from"@mui/material";import{useFormField as I}from"../../../core/field.hook.mjs";import{FieldSectionTitle as S,FieldSectionContent as F,FieldLabelBase as f,FieldDescriptionBase as A}from"../style.mjs";import{VariantSelectField as B}from"./variantSelect.field.mjs";import{jsxs as a,jsx as e}from"react/jsx-runtime";import{maskMemberId as v}from"../../../../core/formats/healthInsurance.format.mjs";const y=48;function x({item:n}){var t,s,r,o,d;return e(i,{py:1,children:a(i,{direction:"row",sx:{flex:1},spacing:1.5,children:[e(g,{draggable:!1,src:((t=n.payer)==null?void 0:t.logoUrl)??"",sx:{bgcolor:"primary.main",width:y,height:y,borderRadius:2,flexShrink:0},slotProps:{img:{onError:c=>{c.currentTarget.style.display="none"}}},children:(o=(r=(s=n.payer)==null?void 0:s.name)==null?void 0:r[0])==null?void 0:o.toUpperCase()}),a(i,{direction:"column",spacing:1.5,children:[e(i,{direction:"row",spacing:1.5,children:a(i,{direction:"row",sx:{flex:1},children:[e(f,{label:"Insurer"}),e(m,{"data-mask-me":!0,variant:"body1",sx:{fontSize:20,fontWeight:300,wordBreak:"break-word",textAlign:"left"},children:(d=n.payer)==null?void 0:d.name})]})}),a(i,{direction:"row",children:[e(f,{label:"Member ID"}),a(i,{children:[e(m,{"data-mask-me":!0,variant:"body1",sx:{fontSize:20,fontWeight:300,wordBreak:"break-word",textAlign:"left"},children:v(n.memberId)}),e(A,{description:"Hidden for privacy"})]})]})]})]})})}function C({fieldKey:n}){const{field:t}=I({key:n});if(!t)return null;if(!t.hasVariants){const r=t.value;return r?a(i,{spacing:1.25,children:[e(S,{fieldKey:n}),e(F,{spacing:1.25,children:e(x,{item:r})})]}):null}const s=t.variants??[];return e(B,{fieldKey:n,testId:`data-health-insurance-select-${n}`,renderValue:()=>{const r=t.value;return r?e(x,{item:r}):null},children:s.map(r=>{var o,d,c,u,h;const l=r.value,b=((o=l?.payer)==null?void 0:o.name)??"-",w=l!=null&&l.memberId?v(l.memberId):"-";return e(k,{value:r.id,onClick:p=>p.stopPropagation(),sx:{maxWidth:"100%",whiteSpace:"pre-wrap"},children:a(i,{direction:"row",spacing:1.5,alignItems:"center",children:[e(g,{draggable:!1,src:((d=l?.payer)==null?void 0:d.logoUrl)??"",sx:{bgcolor:"primary.main",width:32,height:32,borderRadius:1,flexShrink:0},slotProps:{img:{onError:p=>{p.currentTarget.style.display="none"}}},children:(h=(u=(c=l?.payer)==null?void 0:c.name)==null?void 0:u[0])==null?void 0:h.toUpperCase()}),a(i,{sx:{alignItems:"flex-start",textAlign:"left"},children:[e(m,{variant:"body1",fontWeight:500,children:b}),e(m,{variant:"caption",color:"text.secondary",children:w})]})]})},r.id)})})}export{C as HealthInsuranceField};
@@ -35,6 +35,19 @@ export declare const getFieldValue: (field: FormField, options: OneClickFormOpti
35
35
  logoUrl?: string | null | undefined;
36
36
  };
37
37
  id?: number | undefined;
38
+ } | {
39
+ employer: {
40
+ address: {
41
+ line1?: string | undefined;
42
+ line2?: string | undefined;
43
+ city?: string | undefined;
44
+ state?: string | undefined;
45
+ country?: "US" | undefined;
46
+ zipCode?: string | undefined;
47
+ };
48
+ name: string;
49
+ legalName?: string | undefined;
50
+ };
38
51
  } | {
39
52
  firstName?: string | undefined;
40
53
  lastName?: string | undefined;
@@ -58,3 +71,7 @@ export declare const getFieldValue: (field: FormField, options: OneClickFormOpti
58
71
  * transformations (e.g. year redaction for DOB).
59
72
  */
60
73
  export declare const getFieldDisplayValue: (field: FormField, options: OneClickFormOptions) => string | null;
74
+ export declare function RequiredLabel({ children, required, }: {
75
+ children: React.ReactNode;
76
+ required: boolean;
77
+ }): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use strict";import{credentialKeys as a}from"../../../core/fields/index.mjs";import{fieldInputTypes as o}from"../../../core/fields/constants.mjs";const c=({userPrivacyEnabled:e,field:t,fieldKey:i,options:l})=>{const s={role:"region","aria-label":t?.schema.characteristics.label,"data-testid":t?.schema.characteristics.inputType===o.composite?`data-field-composite-${i}`:`data-field-atomic-${i}`,"data-verified-sdk-field-value":void 0};return e||(s["data-verified-sdk-field-value"]=t?d(t,l):void 0),s};function n(e){return e===a.firstName?"given-name":e===a.lastName?"family-name":e===a.phone?"tel":e===a.address?"street-address address-level2 address-level1 postal-code":e===a.line2?"address-line2":"off"}const d=(e,t)=>{if(!(typeof e.value=="object"&&e.schema.key!==a.address&&e.schema.key!==a.healthInsurance))return e.schema.key===a.state||e.schema.key===a.issuanceState||e.schema.key===a.birthDate||e.schema.key===a.expirationDate||e.schema.key===a.issuanceDate?e.value:r(e,t)},r=(e,t)=>{var i,l;const s=e.displayValue;return(l=(i=t.features.field)==null?void 0:i.dob)!=null&&l.redactYear&&e.schema.key===a.birthDate&&typeof s=="string"?s.replace(/\/\d{4}$/,"/\u2022\u2022\u2022\u2022"):s};export{n as getAutoCompleteAttributeValue,r as getFieldDisplayValue,d as getFieldValue,c as makeAttributes};
1
+ "use strict";import{Typography as c}from"@mui/material";import{credentialKeys as a}from"../../../core/fields/index.mjs";import{jsx as l,Fragment as d,jsxs as m}from"react/jsx-runtime";import{fieldInputTypes as u}from"../../../core/fields/constants.mjs";const p=({userPrivacyEnabled:e,field:s,fieldKey:i,options:r})=>{const t={role:"region","aria-label":s?.schema.characteristics.label,"data-testid":s?.schema.characteristics.inputType===u.composite?`data-field-composite-${i}`:`data-field-atomic-${i}`,"data-verified-sdk-field-value":void 0};return e||(t["data-verified-sdk-field-value"]=s?o(s,r):void 0),t};function f(e){return e===a.firstName?"given-name":e===a.lastName?"family-name":e===a.phone?"tel":e===a.address?"street-address address-level2 address-level1 postal-code":e===a.line2?"address-line2":"off"}const o=(e,s)=>{if(!(typeof e.value=="object"&&e.schema.key!==a.address&&e.schema.key!==a.healthInsurance&&e.schema.key!==a.employer))return e.schema.key===a.state||e.schema.key===a.issuanceState||e.schema.key===a.birthDate||e.schema.key===a.expirationDate||e.schema.key===a.issuanceDate?e.value:n(e,s)},n=(e,s)=>{var i,r;const t=e.displayValue;return(r=(i=s.features.field)==null?void 0:i.dob)!=null&&r.redactYear&&e.schema.key===a.birthDate&&typeof t=="string"?t.replace(/\/\d{4}$/,"/\u2022\u2022\u2022\u2022"):t};function h({children:e,required:s}){return s?m(d,{children:[e," ",l(c,{"data-asterisk":!0,component:"span",color:"error",variant:"subtitle2",sx:{fontSize:"inherit"},children:"\u273D"})]}):l(d,{children:e})}export{h as RequiredLabel,f as getAutoCompleteAttributeValue,n as getFieldDisplayValue,o as getFieldValue,p as makeAttributes};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "12.7.1",
3
+ "version": "12.8.0",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "sideEffects": false,