@verifiedinc-public/shared-ui-elements 12.8.2 → 12.8.4

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.
@@ -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 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:`{
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},o=e?.path??"",i=e?.index??0,r=o.split(".").slice(0,-1).join("."),m=s.getValues(r),f=new Set(m?.map((l,d)=>d!==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,d)=>t[l.id]-t[d.id])},[e,s]),u=c(()=>{var t,o;const i=(o=(t=p.field)==null?void 0:t.value)==null?void 0:o.type;return a?.find(r=>r.id===i)},[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: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};
3
+ }`}),children:n(v,{value:u,onChange:(t,o)=>{if(!o)return;const i=x(o.id),r={type:i.type,mandatory:i.mandatory,description:i.description,allowUserInput:i.allowUserInput,multi:i.multi,children:i.children};e?.fieldArray.update(e?.index,r)},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};
@@ -12,7 +12,7 @@ export declare const employer: {
12
12
  employer: import('zod').ZodObject<{
13
13
  name: import('zod').ZodString;
14
14
  legalName: import('zod').ZodOptional<import('zod').ZodString>;
15
- address: import('zod').ZodEffects<import('zod').ZodEffects<import('zod').ZodObject<{
15
+ address: import('zod').ZodOptional<import('zod').ZodEffects<import('zod').ZodEffects<import('zod').ZodObject<{
16
16
  line1: import('zod').ZodOptional<import('zod').ZodString>;
17
17
  line2: import('zod').ZodOptional<import('zod').ZodString>;
18
18
  city: import('zod').ZodOptional<import('zod').ZodString>;
@@ -61,54 +61,54 @@ export declare const employer: {
61
61
  state?: string | undefined;
62
62
  country?: string | undefined;
63
63
  zipCode?: string | undefined;
64
- }>;
64
+ }>>;
65
65
  }, "strip", import('zod').ZodTypeAny, {
66
- address: {
66
+ name: string;
67
+ address?: {
67
68
  line1?: string | undefined;
68
69
  line2?: string | undefined;
69
70
  city?: string | undefined;
70
71
  state?: string | undefined;
71
72
  country?: "US" | undefined;
72
73
  zipCode?: string | undefined;
73
- };
74
- name: string;
74
+ } | undefined;
75
75
  legalName?: string | undefined;
76
76
  }, {
77
- address: {
77
+ name: string;
78
+ address?: {
78
79
  line1?: string | undefined;
79
80
  line2?: string | undefined;
80
81
  city?: string | undefined;
81
82
  state?: string | undefined;
82
83
  country?: string | undefined;
83
84
  zipCode?: string | undefined;
84
- };
85
- name: string;
85
+ } | undefined;
86
86
  legalName?: string | undefined;
87
87
  }>;
88
88
  }, "strip", import('zod').ZodTypeAny, {
89
89
  employer: {
90
- address: {
90
+ name: string;
91
+ address?: {
91
92
  line1?: string | undefined;
92
93
  line2?: string | undefined;
93
94
  city?: string | undefined;
94
95
  state?: string | undefined;
95
96
  country?: "US" | undefined;
96
97
  zipCode?: string | undefined;
97
- };
98
- name: string;
98
+ } | undefined;
99
99
  legalName?: string | undefined;
100
100
  };
101
101
  }, {
102
102
  employer: {
103
- address: {
103
+ name: string;
104
+ address?: {
104
105
  line1?: string | undefined;
105
106
  line2?: string | undefined;
106
107
  city?: string | undefined;
107
108
  state?: string | undefined;
108
109
  country?: string | undefined;
109
110
  zipCode?: string | undefined;
110
- };
111
- name: string;
111
+ } | undefined;
112
112
  legalName?: string | undefined;
113
113
  };
114
114
  }>;
@@ -609,7 +609,7 @@ export declare const fields: {
609
609
  employer: import('zod').ZodObject<{
610
610
  name: import('zod').ZodString;
611
611
  legalName: import('zod').ZodOptional<import('zod').ZodString>;
612
- address: import('zod').ZodEffects<import('zod').ZodEffects<import('zod').ZodObject<{
612
+ address: import('zod').ZodOptional<import('zod').ZodEffects<import('zod').ZodEffects<import('zod').ZodObject<{
613
613
  line1: import('zod').ZodOptional<import('zod').ZodString>;
614
614
  line2: import('zod').ZodOptional<import('zod').ZodString>;
615
615
  city: import('zod').ZodOptional<import('zod').ZodString>;
@@ -658,54 +658,54 @@ export declare const fields: {
658
658
  state?: string | undefined;
659
659
  country?: string | undefined;
660
660
  zipCode?: string | undefined;
661
- }>;
661
+ }>>;
662
662
  }, "strip", import('zod').ZodTypeAny, {
663
- address: {
663
+ name: string;
664
+ address?: {
664
665
  line1?: string | undefined;
665
666
  line2?: string | undefined;
666
667
  city?: string | undefined;
667
668
  state?: string | undefined;
668
669
  country?: "US" | undefined;
669
670
  zipCode?: string | undefined;
670
- };
671
- name: string;
671
+ } | undefined;
672
672
  legalName?: string | undefined;
673
673
  }, {
674
- address: {
674
+ name: string;
675
+ address?: {
675
676
  line1?: string | undefined;
676
677
  line2?: string | undefined;
677
678
  city?: string | undefined;
678
679
  state?: string | undefined;
679
680
  country?: string | undefined;
680
681
  zipCode?: string | undefined;
681
- };
682
- name: string;
682
+ } | undefined;
683
683
  legalName?: string | undefined;
684
684
  }>;
685
685
  }, "strip", import('zod').ZodTypeAny, {
686
686
  employer: {
687
- address: {
687
+ name: string;
688
+ address?: {
688
689
  line1?: string | undefined;
689
690
  line2?: string | undefined;
690
691
  city?: string | undefined;
691
692
  state?: string | undefined;
692
693
  country?: "US" | undefined;
693
694
  zipCode?: string | undefined;
694
- };
695
- name: string;
695
+ } | undefined;
696
696
  legalName?: string | undefined;
697
697
  };
698
698
  }, {
699
699
  employer: {
700
- address: {
700
+ name: string;
701
+ address?: {
701
702
  line1?: string | undefined;
702
703
  line2?: string | undefined;
703
704
  city?: string | undefined;
704
705
  state?: string | undefined;
705
706
  country?: string | undefined;
706
707
  zipCode?: string | undefined;
707
- };
708
- name: string;
708
+ } | undefined;
709
709
  legalName?: string | undefined;
710
710
  };
711
711
  }>;
@@ -1 +1 @@
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
+ "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 o}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).filter(([,e])=>e!==void 0).map(([e,i])=>[e,r(i)])):s;class c{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===o.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{c as Form};
@@ -1 +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
+ "use strict";const n=l=>{var o;const e=l?.employer;return e!=null&&e.name?[e.name,(o=e.address)==null?void 0:o.state].filter(Boolean).join(" \u2014 "):null};export{n as employerFormat};
@@ -3,7 +3,7 @@ export declare const employerSchema: z.ZodObject<{
3
3
  employer: z.ZodObject<{
4
4
  name: z.ZodString;
5
5
  legalName: z.ZodOptional<z.ZodString>;
6
- address: z.ZodEffects<z.ZodEffects<z.ZodObject<{
6
+ address: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodObject<{
7
7
  line1: z.ZodOptional<z.ZodString>;
8
8
  line2: z.ZodOptional<z.ZodString>;
9
9
  city: z.ZodOptional<z.ZodString>;
@@ -52,54 +52,54 @@ export declare const employerSchema: z.ZodObject<{
52
52
  state?: string | undefined;
53
53
  country?: string | undefined;
54
54
  zipCode?: string | undefined;
55
- }>;
55
+ }>>;
56
56
  }, "strip", z.ZodTypeAny, {
57
- address: {
57
+ name: string;
58
+ address?: {
58
59
  line1?: string | undefined;
59
60
  line2?: string | undefined;
60
61
  city?: string | undefined;
61
62
  state?: string | undefined;
62
63
  country?: "US" | undefined;
63
64
  zipCode?: string | undefined;
64
- };
65
- name: string;
65
+ } | undefined;
66
66
  legalName?: string | undefined;
67
67
  }, {
68
- address: {
68
+ name: string;
69
+ address?: {
69
70
  line1?: string | undefined;
70
71
  line2?: string | undefined;
71
72
  city?: string | undefined;
72
73
  state?: string | undefined;
73
74
  country?: string | undefined;
74
75
  zipCode?: string | undefined;
75
- };
76
- name: string;
76
+ } | undefined;
77
77
  legalName?: string | undefined;
78
78
  }>;
79
79
  }, "strip", z.ZodTypeAny, {
80
80
  employer: {
81
- address: {
81
+ name: string;
82
+ address?: {
82
83
  line1?: string | undefined;
83
84
  line2?: string | undefined;
84
85
  city?: string | undefined;
85
86
  state?: string | undefined;
86
87
  country?: "US" | undefined;
87
88
  zipCode?: string | undefined;
88
- };
89
- name: string;
89
+ } | undefined;
90
90
  legalName?: string | undefined;
91
91
  };
92
92
  }, {
93
93
  employer: {
94
- address: {
94
+ name: string;
95
+ address?: {
95
96
  line1?: string | undefined;
96
97
  line2?: string | undefined;
97
98
  city?: string | undefined;
98
99
  state?: string | undefined;
99
100
  country?: string | undefined;
100
101
  zipCode?: string | undefined;
101
- };
102
- name: string;
102
+ } | undefined;
103
103
  legalName?: string | undefined;
104
104
  };
105
105
  }>;
@@ -1 +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};
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.optional()})});export{r as employerSchema};
@@ -1 +1 @@
1
- "use strict";import{useState as z}from"react";import{Stack as F,TextField as m,Box as I}from"@mui/material";import{AddressInput as q}from"../../../../../AddressInput/index.mjs";import{useFormField as A}from"../../../core/field.hook.mjs";import{RequiredLabel as y,toFieldValueAttribute as o}from"../shared.mjs";import{useOneClickForm as S}from"../../form.context.mjs";import{jsxs as D,jsx as d}from"react/jsx-runtime";import{addressFormat as T}from"../../../../core/formats/address.format.mjs";function B({fieldKey:P}){var p,c;const{options:n}=S(),{field:l,setValue:b}=A({key:P}),[C,k]=z({});if(!l)return null;const f=l.value;if(!f)return null;const a=f.employer,r=e=>{k(s=>s[e]?s:{...s,[e]:!0})},i=e=>{b({employer:{...a,...e}})},t=n.features.enableUserPrivacy,N=((c=(p=l.errors)==null?void 0:p.error)==null?void 0:c.issues)??[],u=e=>{var s;if(!(!l.touched&&!C[e]))return(s=N.find(x=>x.path[1]===e))==null?void 0:s.message},v=u("name"),g=u("legalName"),h=u("address");return D(F,{spacing:2,children:[d(m,{"data-testid":"data-field-atomic-employer.name","data-verified-sdk-field-value":o(a.name,t),fullWidth:!0,size:"small",label:d(y,{required:l.isRequired,children:"Name"}),value:a.name??"",onChange:e=>{i({name:e.target.value}),r("name")},onBlur:()=>r("name"),error:!!v,helperText:v,disabled:l.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}}),d(m,{"data-testid":"data-field-atomic-employer.legalName","data-verified-sdk-field-value":o(a.legalName,t),fullWidth:!0,size:"small",label:"Legal Name",value:a.legalName??"",onChange:e=>{i({legalName:e.target.value||void 0}),r("legalName")},onBlur:()=>r("legalName"),error:!!g,helperText:g,disabled:l.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}}),d(I,{"data-testid":"data-field-composite-employer.address","data-verified-sdk-field-value":o(T(a.address),t),width:"100%",children:d(q,{size:"small",label:d(y,{required:l.isRequired,children:"Address"}),defaultValue:{line1:a.address.line1,city:a.address.city,state:a.address.state,zipCode:a.address.zipCode,country:a.address.country??"US"},onChange:e=>{if(typeof e=="string")return;const s={line1:e?.line1,line2:a.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:!!h,helperText:h,disabled:l.isDisabled,InputProps:{"data-mask-me":!0},service:{googlePlacesAutocompletePlaces:n.servicePaths.googlePlacesAutocompletePlaces,googlePlacesGetPlace:n.servicePaths.googlePlacesGetPlace}})}),d(m,{"data-testid":"data-field-atomic-employer.address.line2","data-verified-sdk-field-value":o(a.address.line2,t),fullWidth:!0,size:"small",label:"Line 2",value:a.address.line2??"",onChange:e=>i({address:{...a.address,line2:e.target.value}}),disabled:l.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}})]})}export{B as EmployerInputField};
1
+ "use strict";import{useState as x}from"react";import{Stack as A,TextField as P,Box as I}from"@mui/material";import{AddressInput as S}from"../../../../../AddressInput/index.mjs";import{useFormField as B}from"../../../core/field.hook.mjs";import{RequiredLabel as U,toFieldValueAttribute as n}from"../shared.mjs";import{useOneClickForm as j}from"../../form.context.mjs";import{jsxs as D,jsx as s}from"react/jsx-runtime";import{addressFormat as T}from"../../../../core/formats/address.format.mjs";function q({fieldKey:h}){var u,m;const{options:r}=j(),{field:l,setValue:b}=B({key:h}),[C,k]=x({});if(!l)return null;const c=l.value;if(!c)return null;const t=c.employer,a=t.address??{},d=r.features.enableUserPrivacy,o=e=>{k(i=>i[e]?i:{...i,[e]:!0})},p=e=>{b({employer:{...t,...e}})},f=e=>{const i=Object.values(e).some(Boolean);p({address:i?e:void 0}),o("address")},z=((m=(u=l.errors)==null?void 0:u.error)==null?void 0:m.issues)??[],v=e=>{var i;if(!(!l.touched&&!C[e]))return(i=z.find(F=>F.path[1]===e))==null?void 0:i.message},y=v("name"),g=v("address");return D(A,{spacing:2,children:[s(P,{"data-testid":"data-field-atomic-employer.name","data-verified-sdk-field-value":n(t.name,d),fullWidth:!0,size:"small",label:s(U,{required:l.isRequired,children:"Name"}),value:t.name??"",onChange:e=>{p({name:e.target.value}),o("name")},onBlur:()=>o("name"),error:!!y,helperText:y,disabled:l.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}}),s(I,{"data-testid":"data-field-composite-employer.address","data-verified-sdk-field-value":n(a.line1?T(a):void 0,d),width:"100%",children:s(S,{size:"small",label:"Address",defaultValue:{line1:a.line1,city:a.city,state:a.state,zipCode:a.zipCode,country:a.country??"US"},onChange:e=>{typeof e!="string"&&f({line1:e?.line1,line2:a.line2??"",city:e?.city,state:e?.state,zipCode:e?.zipCode,country:e?.country==="US"?"US":void 0})},onBlur:()=>o("address"),error:!!g,helperText:g,disabled:l.isDisabled,InputProps:{"data-mask-me":!0},service:{googlePlacesAutocompletePlaces:r.servicePaths.googlePlacesAutocompletePlaces,googlePlacesGetPlace:r.servicePaths.googlePlacesGetPlace}})}),s(P,{"data-testid":"data-field-atomic-employer.address.line2","data-verified-sdk-field-value":n(a.line2,d),fullWidth:!0,size:"small",label:"Line 2",value:a.line2??"",onChange:e=>f({...a,line2:e.target.value}),disabled:l.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}})]})}export{q as EmployerInputField};
@@ -1 +1 @@
1
- "use strict";import{Stack as o,MenuItem as f,Typography as u}from"@mui/material";import{useFormField as p}from"../../../core/field.hook.mjs";import{useOneClickForm as v}from"../../form.context.mjs";import{toFieldValueAttribute as n}from"../shared.mjs";import{FieldSectionTitle as y,FieldSectionContent as h,FieldLabelBase as g}from"../style.mjs";import{VariantSelectField as b}from"./variantSelect.field.mjs";import{jsxs as s,jsx as a}from"react/jsx-runtime";import{addressFormat as F}from"../../../../core/formats/address.format.mjs";function m({label:e,value:i,testId:l,fieldValue:r}){return s(o,{direction:"row","data-testid":l,"data-verified-sdk-field-value":r,children:[a(g,{label:e}),a(u,{"data-mask-me":!0,variant:"body1",sx:{fontSize:20,fontWeight:300,wordBreak:"break-word",textAlign:"left"},children:i})]})}function c({item:e}){const{options:i}=v(),l=i.features.enableUserPrivacy,r=F(e.address);return s(o,{spacing:1.25,children:[a(m,{label:"Name",value:e.name,testId:"data-field-atomic-employer.name",fieldValue:n(e.name,l)}),e.legalName&&a(m,{label:"Legal Name",value:e.legalName,testId:"data-field-atomic-employer.legalName",fieldValue:n(e.legalName,l)}),a(m,{label:"Address",value:r??"-",testId:"data-field-composite-employer.address",fieldValue:n(r,l)})]})}function V({fieldKey:e}){var i;const{field:l}=p({key:e});if(!l)return null;if(!l.hasVariants){const t=(i=l.value)==null?void 0:i.employer;return t?s(o,{spacing:1.25,children:[a(y,{fieldKey:e}),a(h,{spacing:1.25,children:a(c,{item:t})})]}):null}const r=l.variants??[];return a(b,{fieldKey:e,testId:`data-employer-select-${e}`,renderValue:()=>{var t;const d=(t=l.value)==null?void 0:t.employer;return d?a(c,{item:d}):null},children:r.map(t=>a(f,{value:t.id,onClick:d=>d.stopPropagation(),sx:{maxWidth:"100%",whiteSpace:"pre-wrap"},children:a(u,{variant:"body1",fontWeight:500,children:t.displayValue??"-"})},t.id))})}export{V as EmployerField};
1
+ "use strict";import{Stack as n,MenuItem as f,Typography as s}from"@mui/material";import{useFormField as p}from"../../../core/field.hook.mjs";import{useOneClickForm as v}from"../../form.context.mjs";import{toFieldValueAttribute as m}from"../shared.mjs";import{FieldSectionTitle as y,FieldSectionContent as h,FieldLabelBase as b}from"../style.mjs";import{VariantSelectField as F}from"./variantSelect.field.mjs";import{jsxs as o,jsx as i}from"react/jsx-runtime";import{addressFormat as g}from"../../../../core/formats/address.format.mjs";function u({label:a,value:l,testId:t,fieldValue:r}){return o(n,{direction:"row","data-testid":t,"data-verified-sdk-field-value":r,children:[i(b,{label:a}),i(s,{"data-mask-me":!0,variant:"body1",sx:{fontSize:20,fontWeight:300,wordBreak:"break-word",textAlign:"left"},children:l})]})}function c({item:a}){var l;const{options:t}=v(),r=t.features.enableUserPrivacy,e=(l=a.address)!=null&&l.line1?g(a.address):null;return o(n,{spacing:1.25,children:[i(u,{label:"Name",value:a.name,testId:"data-field-atomic-employer.name",fieldValue:m(a.name,r)}),e&&i(u,{label:"Address",value:e,testId:"data-field-composite-employer.address",fieldValue:m(e,r)})]})}function k({fieldKey:a}){var l;const{field:t}=p({key:a});if(!t)return null;if(!t.hasVariants){const e=(l=t.value)==null?void 0:l.employer;return e?o(n,{spacing:1.25,children:[i(y,{fieldKey:a}),i(h,{spacing:1.25,children:i(c,{item:e})})]}):null}const r=t.variants??[];return i(F,{fieldKey:a,testId:`data-employer-select-${a}`,renderValue:()=>{var e;const d=(e=t.value)==null?void 0:e.employer;return d?i(c,{item:d}):null},children:r.map(e=>i(f,{value:e.id,onClick:d=>d.stopPropagation(),sx:{maxWidth:"100%",whiteSpace:"pre-wrap"},children:i(s,{variant:"body1",fontWeight:500,children:e.displayValue??"-"})},e.id))})}export{k as EmployerField};
@@ -31,15 +31,15 @@ export declare const makeAttributes: ({ userPrivacyEnabled, field, fieldKey, opt
31
31
  id?: number | undefined;
32
32
  } | {
33
33
  employer: {
34
- address: {
34
+ name: string;
35
+ address?: {
35
36
  line1?: string | undefined;
36
37
  line2?: string | undefined;
37
38
  city?: string | undefined;
38
39
  state?: string | undefined;
39
40
  country?: "US" | undefined;
40
41
  zipCode?: string | undefined;
41
- };
42
- name: string;
42
+ } | undefined;
43
43
  legalName?: string | undefined;
44
44
  };
45
45
  } | {
@@ -82,15 +82,15 @@ export declare const getFieldValue: (field: FormField, options: OneClickFormOpti
82
82
  id?: number | undefined;
83
83
  } | {
84
84
  employer: {
85
- address: {
85
+ name: string;
86
+ address?: {
86
87
  line1?: string | undefined;
87
88
  line2?: string | undefined;
88
89
  city?: string | undefined;
89
90
  state?: string | undefined;
90
91
  country?: "US" | undefined;
91
92
  zipCode?: string | undefined;
92
- };
93
- name: string;
93
+ } | undefined;
94
94
  legalName?: string | undefined;
95
95
  };
96
96
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "12.8.2",
3
+ "version": "12.8.4",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "sideEffects": false,