@verifiedinc-public/shared-ui-elements 12.7.0 → 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.
- package/dist/components/CredentialRequestsEditor/components/CredentialRequestsField.mjs +1 -1
- package/dist/components/CredentialRequestsEditor/components/DataFieldOptionType.mjs +2 -2
- package/dist/components/CredentialRequestsEditor/types/form.d.ts +0 -4
- package/dist/components/chart/BillableEventsTable/BillableEventsTable.types.mjs +1 -1
- package/dist/components/form/AddressInput/hook.mjs +1 -1
- package/dist/components/form/NewOneClickForm/core/fields/employer.d.ts +125 -0
- package/dist/components/form/NewOneClickForm/core/fields/employer.mjs +1 -0
- package/dist/components/form/NewOneClickForm/core/fields/index.d.ts +113 -0
- package/dist/components/form/NewOneClickForm/core/fields/index.mjs +1 -1
- package/dist/components/form/NewOneClickForm/core/form/form.d.ts +1 -26
- package/dist/components/form/NewOneClickForm/core/form/form.mjs +1 -1
- package/dist/components/form/NewOneClickForm/core/form/formBuilder.mjs +1 -1
- package/dist/components/form/NewOneClickForm/core/form/formFieldBuilder.d.ts +1 -1
- package/dist/components/form/NewOneClickForm/core/form/formFieldBuilder.mjs +1 -1
- package/dist/components/form/NewOneClickForm/core/formats/employer.format.d.ts +2 -0
- package/dist/components/form/NewOneClickForm/core/formats/employer.format.mjs +1 -0
- package/dist/components/form/NewOneClickForm/core/formats/index.d.ts +1 -0
- package/dist/components/form/NewOneClickForm/core/mappers/create-patch.map.mjs +1 -1
- package/dist/components/form/NewOneClickForm/core/validations/address/address.schema.d.ts +50 -0
- package/dist/components/form/NewOneClickForm/core/validations/address/address.schema.mjs +1 -1
- package/dist/components/form/NewOneClickForm/core/validations/employer/employer.schema.d.ts +106 -0
- package/dist/components/form/NewOneClickForm/core/validations/employer/employer.schema.mjs +1 -0
- package/dist/components/form/NewOneClickForm/core/validations/employer/employerName.schema.d.ts +3 -0
- package/dist/components/form/NewOneClickForm/core/validations/employer/employerName.schema.mjs +1 -0
- package/dist/components/form/NewOneClickForm/core/validations/employer/index.d.ts +1 -0
- package/dist/components/form/NewOneClickForm/core/validations/employer/legalName.schema.d.ts +3 -0
- package/dist/components/form/NewOneClickForm/core/validations/employer/legalName.schema.mjs +1 -0
- package/dist/components/form/NewOneClickForm/core/validations/index.d.ts +1 -0
- package/dist/components/form/NewOneClickForm/react/core/form.context.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/address.field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/employer.field.d.ts +3 -0
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/employer.field.mjs +1 -0
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/healthInsurance.field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/readonly/employer.field.d.ts +3 -0
- package/dist/components/form/NewOneClickForm/react/ui/fields/readonly/employer.field.mjs +1 -0
- package/dist/components/form/NewOneClickForm/react/ui/fields/readonly/field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/readonly/healthInsurance.field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/shared.d.ts +17 -0
- package/dist/components/form/NewOneClickForm/react/ui/fields/shared.mjs +1 -1
- 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
|
|
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
|
|
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:
|
|
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";var i=(e=>(e.TEXT_TO_SIGNUP="TEXT_TO_SIGNUP",e.ONE_CLICK_VERIFY="ONE_CLICK_VERIFY",e.ONE_CLICK_SIGNUP="ONE_CLICK_SIGNUP",e.ONE_CLICK_HEALTH="ONE_CLICK_HEALTH",e))(i||{});const l=[{product:"TEXT_TO_SIGNUP",label:"Text to Signup",columns:[{key:"tts_smsKeywordsReceived",label:"SMS Keywords Received",metricKey:"ttsSent"},{key:"tts_verificationsSucceeded",label:"Verifications Succeeded",metricKey:"ttsVerified"}]},{product:"ONE_CLICK_VERIFY",label:"1-Click Verify",columns:[{key:"verify_smsSent",label:"SMS Sent",metricKey:"oneClickVerificationSending"},{key:"
|
|
1
|
+
"use strict";var i=(e=>(e.TEXT_TO_SIGNUP="TEXT_TO_SIGNUP",e.ONE_CLICK_VERIFY="ONE_CLICK_VERIFY",e.ONE_CLICK_SIGNUP="ONE_CLICK_SIGNUP",e.ONE_CLICK_HEALTH="ONE_CLICK_HEALTH",e))(i||{});const l=[{product:"TEXT_TO_SIGNUP",label:"Text to Signup",columns:[{key:"tts_smsKeywordsReceived",label:"SMS Keywords Received",metricKey:"ttsSent"},{key:"tts_verificationsSucceeded",label:"Verifications Succeeded",metricKey:"ttsVerified"}]},{product:"ONE_CLICK_VERIFY",label:"1-Click Verify",columns:[{key:"verify_smsSent",label:"SMS Sent",metricKey:"oneClickVerificationSending"},{key:"verify_autofillsSucceeded",label:"Autofills Succeeded",metricKey:"oneClickVerificationAutofillVerified"},{key:"verify_silentSucceeded",label:"Silent Succeeded",metricKey:"oneClickVerificationSilentVerified"},{key:"verify_verificationsSucceeded",label:"Verifications Succeeded",metricKey:"oneClickVerificationVerified"}]},{product:"ONE_CLICK_SIGNUP",label:"1-Click Signup",columns:[{key:"signup_autofillsSucceeded",label:"Autofills Succeeded",metricKey:"oneClickSuccess"},{key:"signup_riskSignalsReturned",label:"Risk Signals Returned",metricKey:"riskSignal"}]},{product:"ONE_CLICK_HEALTH",label:"1-Click Health",columns:[{key:"health_autofillsStarted",label:"Autofills Started",metricKey:"oneClickHealthCreated"},{key:"health_checksStarted",label:"Checks Started",metricKey:"oneClickHealthCheckStarted"}]}];export{l as BILLABLE_PRODUCTS,i as BillableProduct};
|
|
@@ -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
|
|
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
|
|
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]:
|
|
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,
|
|
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
|
|
13
|
+
createFromSchema(requestObj: CredentialRequestObject, fieldSchema: BaseFieldDefinition<string>, parentRequestObj?: CredentialRequestObject): FormField;
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
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 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";import{fieldInputTypes as
|
|
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
|
|
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};
|
package/dist/components/form/NewOneClickForm/core/validations/employer/employerName.schema.mjs
ADDED
|
@@ -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 @@
|
|
|
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};
|
|
@@ -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,
|
|
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
|
|
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 @@
|
|
|
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
|
|
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};
|
package/dist/components/form/NewOneClickForm/react/ui/fields/input/healthInsurance.field.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState as I,useRef as
|
|
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 @@
|
|
|
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
|
|
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};
|
package/dist/components/form/NewOneClickForm/react/ui/fields/readonly/healthInsurance.field.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{
|
|
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
|
|
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};
|