@gusto/embedded-react-sdk 0.34.0 → 0.35.0-rc.1
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/CHANGELOG.md +38 -0
- package/dist/components/Base/Base.d.ts +6 -2
- package/dist/components/Base/Base.js +105 -59
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Base/useBase.d.ts +1 -0
- package/dist/components/Base/useBase.js.map +1 -1
- package/dist/components/Base/useBaseSubmit.d.ts +1 -1
- package/dist/components/Base/useBaseSubmit.js +60 -33
- package/dist/components/Base/useBaseSubmit.js.map +1 -1
- package/dist/components/Common/HamburgerMenu/HamburgerMenu.d.ts +1 -1
- package/dist/components/Common/HamburgerMenu/HamburgerMenu.js +15 -13
- package/dist/components/Common/HamburgerMenu/HamburgerMenu.js.map +1 -1
- package/dist/components/Common/HamburgerMenu/HamburgerMenuTypes.d.ts +1 -0
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +1 -1
- package/dist/components/Common/UI/Menu/Menu.js +26 -25
- package/dist/components/Common/UI/Menu/Menu.js.map +1 -1
- package/dist/components/Common/UI/Menu/Menu.module.scss.js +7 -7
- package/dist/components/Common/UI/Menu/MenuTypes.d.ts +5 -0
- package/dist/components/Common/UI/Menu/MenuTypes.js +4 -3
- package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
- package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +12 -12
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
- package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +1 -1
- package/dist/components/Contractor/Address/useAddress.js +5 -6
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -2
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +119 -113
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +10 -10
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
- package/dist/components/Employee/Compensation/Edit.js +70 -70
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +9 -10
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +10 -11
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +10 -11
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +18 -18
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +7 -7
- package/dist/components/Employee/DocumentSigner/SignatureForm/Form.js +5 -5
- package/dist/components/Employee/DocumentSigner/SignatureForm/Form.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/Preview.js +8 -8
- package/dist/components/Employee/DocumentSigner/SignatureForm/Preview.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +7 -7
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -2
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +8 -8
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +2 -2
- package/dist/components/Employee/Profile/useProfile.js +3 -4
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/StateTaxes.js +69 -61
- package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +7 -7
- package/dist/components/Employee/Taxes/useTaxes.js +3 -4
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +10 -10
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -9
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.d.ts +2 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +101 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.module.scss.js +16 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.module.scss.js.map +1 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModalTypes.d.ts +7 -0
- package/dist/components/Payroll/GrossUpModal/index.d.ts +3 -0
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +86 -67
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +83 -49
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +6 -0
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +102 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.module.scss.js +14 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.module.scss.js.map +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js +52 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js.map +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js +16 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.module.scss.js.map +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +12 -2
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js +15 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js.map +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/index.d.ts +2 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +212 -120
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +3 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +76 -64
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.d.ts +2 -0
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js +11 -0
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js.map +1 -0
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +67 -57
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +36 -36
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +6 -6
- package/dist/components/Payroll/usePreparedPayrollData.js +44 -44
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +2 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +58 -39
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ObservabilityProvider/ObservabilityContext.d.ts +5 -0
- package/dist/contexts/ObservabilityProvider/ObservabilityContext.js +6 -0
- package/dist/contexts/ObservabilityProvider/ObservabilityContext.js.map +1 -0
- package/dist/contexts/ObservabilityProvider/ObservabilityProvider.d.ts +7 -0
- package/dist/contexts/ObservabilityProvider/ObservabilityProvider.js +11 -0
- package/dist/contexts/ObservabilityProvider/ObservabilityProvider.js.map +1 -0
- package/dist/contexts/ObservabilityProvider/index.d.ts +5 -0
- package/dist/contexts/ObservabilityProvider/observabilityUtils.d.ts +5 -0
- package/dist/contexts/ObservabilityProvider/observabilityUtils.js +45 -0
- package/dist/contexts/ObservabilityProvider/observabilityUtils.js.map +1 -0
- package/dist/contexts/ObservabilityProvider/sanitization.d.ts +19 -0
- package/dist/contexts/ObservabilityProvider/sanitization.js +95 -0
- package/dist/contexts/ObservabilityProvider/sanitization.js.map +1 -0
- package/dist/contexts/ObservabilityProvider/sanitization.test.d.ts +1 -0
- package/dist/contexts/ObservabilityProvider/useObservability.d.ts +2 -0
- package/dist/contexts/ObservabilityProvider/useObservability.js +11 -0
- package/dist/contexts/ObservabilityProvider/useObservability.js.map +1 -0
- package/dist/contexts/ObservabilityProvider/useSanitizedObservability.d.ts +8 -0
- package/dist/contexts/ObservabilityProvider/useSanitizedObservability.js +28 -0
- package/dist/contexts/ObservabilityProvider/useSanitizedObservability.js.map +1 -0
- package/dist/contexts/index.d.ts +2 -0
- package/dist/helpers/formattedStrings.js +12 -13
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/helpers/rem.d.ts +7 -3
- package/dist/helpers/rem.js +14 -10
- package/dist/helpers/rem.js.map +1 -1
- package/dist/helpers/rem.test.d.ts +1 -0
- package/dist/helpers/retryAsync.d.ts +7 -0
- package/dist/helpers/retryAsync.js +18 -0
- package/dist/helpers/retryAsync.js.map +1 -0
- package/dist/i18n/I18n.js +15 -15
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.PaySchedule.json.js +1 -1
- package/dist/i18n/en/Payroll.GrossUpModal.json.js +24 -0
- package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -0
- package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js +13 -11
- package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/dist/shared/constants.d.ts +5 -0
- package/dist/shared/constants.js +11 -8
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +26 -1
- package/dist/types/observability.d.ts +145 -0
- package/docs/reference/endpoint-inventory.json +10 -1
- package/package.json +21 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaymentMethod.js","sources":["../../../../src/components/Employee/PaymentMethod/usePaymentMethod.ts"],"sourcesContent":["import type { EmployeeBankAccount } from '@gusto/embedded-api/models/components/employeebankaccount'\nimport type { EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { z } from 'zod'\nimport { BankAccountSchema } from './BankAccount'\nimport { createCompoundContext } from '@/components/Base'\n\nexport const CombinedSchema = z.union([\n BankAccountSchema.extend({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n hasBankPayload: z.literal(false),\n }),\n z.object({\n type: z.literal('Check'),\n }),\n z.discriminatedUnion('splitBy', [\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Percentage'),\n splitAmount: z.record(z.string(), z.number().max(100).min(0)).superRefine((input, ctx) => {\n const total = Object.values(input).reduce<number>((acc, curr) => acc + curr, 0)\n if (total !== 100) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `percentage_split_total_error:${total}`,\n })\n }\n }),\n priority: z.record(z.string(), z.number()),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Amount'),\n priority: z.record(z.string(), z.number()).refine(input => {\n const arr = Object.values(input)\n return arr.filter((item, index) => arr.indexOf(item) !== index).length === 0\n }),\n splitAmount: z.record(z.string(), z.number().min(0).nullable()),\n remainder: z.string(),\n }),\n ]),\n])\n\nexport type CombinedSchemaInputs = z.input<typeof CombinedSchema>\nexport type CombinedSchemaOutputs = z.output<typeof CombinedSchema>\n\ntype PaymentMethodContextType = {\n bankAccounts: EmployeeBankAccount[]\n isPending: boolean\n watchedType?: string\n mode: MODE\n paymentMethod: EmployeePaymentMethod\n handleAdd: () => void\n handleSplit: () => void\n handleCancel: () => void\n handleDelete: (uuid: string) => void\n isAdmin: boolean\n}\n\nexport type MODE = 'ADD' | 'LIST' | 'SPLIT' | 'INITIAL'\n\nconst [usePaymentMethod, PaymentMethodProvider] =\n createCompoundContext<PaymentMethodContextType>('PaymentMethodContext')\nexport { usePaymentMethod, PaymentMethodProvider }\n"],"names":["CombinedSchema","z","BankAccountSchema","input","ctx","total","acc","curr","arr","item","index","usePaymentMethod","PaymentMethodProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePaymentMethod.js","sources":["../../../../src/components/Employee/PaymentMethod/usePaymentMethod.ts"],"sourcesContent":["import type { EmployeeBankAccount } from '@gusto/embedded-api/models/components/employeebankaccount'\nimport type { EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { z } from 'zod'\nimport { BankAccountSchema } from './BankAccount'\nimport { createCompoundContext } from '@/components/Base'\n\nexport const CombinedSchema = z.union([\n BankAccountSchema.extend({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n hasBankPayload: z.literal(false),\n }),\n z.object({\n type: z.literal('Check'),\n }),\n z.discriminatedUnion('splitBy', [\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Percentage'),\n splitAmount: z.record(z.string(), z.number().max(100).min(0)).superRefine((input, ctx) => {\n const total = Object.values(input).reduce<number>((acc, curr) => acc + curr, 0)\n if (total !== 100) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `percentage_split_total_error:${total}`,\n })\n }\n }),\n priority: z.record(z.string(), z.number()),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Amount'),\n priority: z.record(z.string(), z.number()).refine(input => {\n const arr = Object.values(input)\n return arr.filter((item, index) => arr.indexOf(item) !== index).length === 0\n }),\n splitAmount: z.record(z.string(), z.number().min(0).nullable()),\n remainder: z.string(),\n }),\n ]),\n])\n\nexport type CombinedSchemaInputs = z.input<typeof CombinedSchema>\nexport type CombinedSchemaOutputs = z.output<typeof CombinedSchema>\n\ntype PaymentMethodContextType = {\n bankAccounts: EmployeeBankAccount[]\n isPending: boolean\n watchedType?: string\n mode: MODE\n paymentMethod: EmployeePaymentMethod\n handleAdd: () => void\n handleSplit: () => void\n handleCancel: () => void\n handleDelete: (uuid: string) => void\n isAdmin: boolean\n}\n\nexport type MODE = 'ADD' | 'LIST' | 'SPLIT' | 'INITIAL'\n\nconst [usePaymentMethod, PaymentMethodProvider] =\n createCompoundContext<PaymentMethodContextType>('PaymentMethodContext')\nexport { usePaymentMethod, PaymentMethodProvider }\n"],"names":["CombinedSchema","z","BankAccountSchema","input","ctx","total","acc","curr","arr","item","index","usePaymentMethod","PaymentMethodProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAMO,MAAMA,IAAiBC,EAAE,MAAM;AAAA,EACpCC,EAAkB,OAAO;AAAA,IACvB,MAAMD,EAAE,QAAQ,gBAAgB;AAAA,IAChC,SAASA,EAAE,QAAQ,EAAK;AAAA,EAAA,CACzB;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,IAChC,SAASA,EAAE,QAAQ,EAAK;AAAA,IACxB,gBAAgBA,EAAE,QAAQ,EAAK;AAAA,EAAA,CAChC;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAM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C9D,WAAWA,EAAE,OAAA;AAAA,IAAO,CACrB;AAAA,EAAA,CACF;AACH,CAAC,GAoBK,CAACU,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
|
|
@@ -8,8 +8,8 @@ import P from "./AdminPersonalDetails.module.scss.js";
|
|
|
8
8
|
import { useProfile as x } from "./useProfile.js";
|
|
9
9
|
import "../../../shared/constants.js";
|
|
10
10
|
import "classnames";
|
|
11
|
-
import { SwitchField as C } from "../../Common/Fields/SwitchField/SwitchField.js";
|
|
12
11
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
|
+
import { SwitchField as C } from "../../Common/Fields/SwitchField/SwitchField.js";
|
|
13
13
|
const p = e.object({
|
|
14
14
|
...A.shape,
|
|
15
15
|
...D.shape,
|
|
@@ -5,9 +5,9 @@ import { z as t } from "zod";
|
|
|
5
5
|
import { useProfile as b } from "./useProfile.js";
|
|
6
6
|
import { STATES_ABBR as y } from "../../../shared/constants.js";
|
|
7
7
|
import { Grid as x } from "../../Common/Grid/Grid.js";
|
|
8
|
-
import { TextInputField as o } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
9
8
|
import { useComponentContext as C } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
9
|
import "react";
|
|
10
|
+
import { TextInputField as o } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
11
11
|
import { SelectField as T } from "../../Common/Fields/SelectField/SelectField.js";
|
|
12
12
|
import { CheckboxField as A } from "../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
13
13
|
const s = t.object({
|
|
@@ -4,14 +4,14 @@ import { useFormContext as c } from "react-hook-form";
|
|
|
4
4
|
import { useTranslation as o } from "react-i18next";
|
|
5
5
|
import "../../../shared/constants.js";
|
|
6
6
|
import { Grid as b } from "../../Common/Grid/Grid.js";
|
|
7
|
-
import { TextInputField as i } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
8
|
-
import { DatePickerField as p } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
9
7
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
8
|
import "react";
|
|
11
9
|
import { removeNonDigits as S, addressInline as h } from "../../../helpers/formattedStrings.js";
|
|
12
10
|
import { usePlaceholderSSN as g, normalizeSSN as N } from "../../../helpers/ssn.js";
|
|
13
11
|
import { SSN_REGEX as D, nameValidation as m } from "../../../helpers/validations.js";
|
|
12
|
+
import { TextInputField as i } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
14
13
|
import { SelectField as I } from "../../Common/Fields/SelectField/SelectField.js";
|
|
14
|
+
import { DatePickerField as p } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
15
15
|
const v = t.object({
|
|
16
16
|
firstName: m,
|
|
17
17
|
middleInitial: t.string().optional(),
|
|
@@ -11,11 +11,10 @@ import "classnames";
|
|
|
11
11
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
12
|
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
13
13
|
import "dompurify";
|
|
14
|
-
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
15
14
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [s, u] = o("ProfileContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
u as ProfileProvider,
|
|
18
|
+
s as useProfile
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=useProfile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProfile.js","sources":["../../../../src/components/Employee/Profile/useProfile.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\n\n//Interface for context passed down to component slots\ntype ProfileContextType = {\n companyLocations: Location[]\n workAddresses?: EmployeeWorkAddress[]\n employee?: Employee\n isSelfOnboardingIntended?: boolean\n isPending: boolean\n isAdmin: boolean\n handleCancel: () => void\n isSelfOnboardingEnabled: boolean\n hasCompletedSelfOnboarding: boolean\n}\n\nconst [useProfile, ProfileProvider] = createCompoundContext<ProfileContextType>('ProfileContext')\nexport { useProfile, ProfileProvider }\n"],"names":["useProfile","ProfileProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useProfile.js","sources":["../../../../src/components/Employee/Profile/useProfile.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\n\n//Interface for context passed down to component slots\ntype ProfileContextType = {\n companyLocations: Location[]\n workAddresses?: EmployeeWorkAddress[]\n employee?: Employee\n isSelfOnboardingIntended?: boolean\n isPending: boolean\n isAdmin: boolean\n handleCancel: () => void\n isSelfOnboardingEnabled: boolean\n hasCompletedSelfOnboarding: boolean\n}\n\nconst [useProfile, ProfileProvider] = createCompoundContext<ProfileContextType>('ProfileContext')\nexport { useProfile, ProfileProvider }\n"],"names":["useProfile","ProfileProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,CAACA,GAAYC,CAAe,IAAIC,EAA0C,gBAAgB;"}
|
|
@@ -1,90 +1,98 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { zodResolver as
|
|
3
|
-
import { useForm as
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { useEmployeeTaxSetupGetStateTaxesSuspense as
|
|
6
|
-
import { useEmployeeTaxSetupUpdateStateTaxesMutation as
|
|
7
|
-
import { StateFormSchema as
|
|
8
|
-
import { Actions as
|
|
1
|
+
import { jsx as r, jsxs as U, Fragment as P } from "react/jsx-runtime";
|
|
2
|
+
import { zodResolver as b } from "@hookform/resolvers/zod";
|
|
3
|
+
import { useForm as C, FormProvider as L } from "react-hook-form";
|
|
4
|
+
import { useEffect as R } from "react";
|
|
5
|
+
import { useEmployeeTaxSetupGetStateTaxesSuspense as M } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
|
|
6
|
+
import { useEmployeeTaxSetupUpdateStateTaxesMutation as O } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
|
|
7
|
+
import { StateFormSchema as V, StateForm as I } from "./StateForm.js";
|
|
8
|
+
import { Actions as z } from "./Actions.js";
|
|
9
9
|
import { StateTaxesProvider as X } from "./useStateTaxes.js";
|
|
10
|
-
import { BaseComponent as
|
|
11
|
-
import { useBase as
|
|
12
|
-
import { useI18n as
|
|
10
|
+
import { BaseComponent as B } from "../../Base/Base.js";
|
|
11
|
+
import { useBase as H } from "../../Base/useBase.js";
|
|
12
|
+
import { useI18n as K, useComponentDictionary as Q } from "../../../i18n/I18n.js";
|
|
13
13
|
import { componentEvents as x } from "../../../shared/constants.js";
|
|
14
14
|
import { Form as Y } from "../../Common/Form/Form.js";
|
|
15
|
-
import { snakeCaseToCamelCase as
|
|
16
|
-
const
|
|
17
|
-
function
|
|
18
|
-
return /* @__PURE__ */
|
|
15
|
+
import { snakeCaseToCamelCase as F, normalizeErrorKeyForForm as j } from "../../../helpers/formattedStrings.js";
|
|
16
|
+
const G = "2010-01-01";
|
|
17
|
+
function fe(u) {
|
|
18
|
+
return /* @__PURE__ */ r(B, { ...u, children: /* @__PURE__ */ r(q, { ...u }) });
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
const { employeeId: c, className: h, children:
|
|
22
|
-
|
|
23
|
-
const { data:
|
|
20
|
+
const q = (u) => {
|
|
21
|
+
const { employeeId: c, className: h, children: y, isAdmin: S = !1, dictionary: A } = u, { onEvent: T, fieldErrors: p, baseSubmitHandler: w } = H();
|
|
22
|
+
K("Employee.StateTaxes"), Q("Employee.StateTaxes", A);
|
|
23
|
+
const { data: D } = M({
|
|
24
24
|
employeeUuid: c
|
|
25
|
-
}),
|
|
26
|
-
states:
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
}), d = D.employeeStateTaxesList, { mutateAsync: _, isPending: g } = O(), k = {
|
|
26
|
+
states: d.reduce((o, a) => (a.state && (o[a.state] = a.questions?.reduce((e, m) => {
|
|
27
|
+
const n = m.answers[0]?.value, s = F(m.key), l = m.inputQuestionFormat.type.toLowerCase() === "date";
|
|
28
|
+
if (s === "fileNewHireReport")
|
|
29
|
+
e[s] = typeof n > "u" ? !0 : n;
|
|
30
|
+
else if (l && typeof n == "string") {
|
|
31
|
+
const t = n.trim();
|
|
32
|
+
e[s] = t === "" ? void 0 : new Date(t);
|
|
33
|
+
} else
|
|
34
|
+
e[s] = n;
|
|
35
|
+
return e;
|
|
36
|
+
}, {})), o), {})
|
|
37
|
+
}, E = C({
|
|
38
|
+
resolver: b(V),
|
|
39
|
+
defaultValues: k
|
|
40
|
+
}), { handleSubmit: N, setError: v } = E;
|
|
41
|
+
return R(() => {
|
|
42
|
+
p && p.length > 0 && p.forEach((o) => {
|
|
43
|
+
const a = j(o.errorKey), e = typeof o.message == "string" ? o.message : "Unknown error";
|
|
44
|
+
v(a, { type: "custom", message: e });
|
|
38
45
|
});
|
|
39
|
-
}, [
|
|
46
|
+
}, [p, v]), /* @__PURE__ */ r("section", { className: h, children: /* @__PURE__ */ r(
|
|
40
47
|
X,
|
|
41
48
|
{
|
|
42
49
|
value: {
|
|
43
|
-
employeeStateTaxes:
|
|
44
|
-
isAdmin:
|
|
45
|
-
isPending:
|
|
50
|
+
employeeStateTaxes: d,
|
|
51
|
+
isAdmin: S,
|
|
52
|
+
isPending: g
|
|
46
53
|
},
|
|
47
|
-
children: /* @__PURE__ */
|
|
48
|
-
await
|
|
49
|
-
const { states: e } =
|
|
54
|
+
children: /* @__PURE__ */ r(L, { ...E, children: /* @__PURE__ */ r(Y, { onSubmit: N(async (o) => {
|
|
55
|
+
await w(o, async (a) => {
|
|
56
|
+
const { states: e } = a;
|
|
50
57
|
if (e && Object.keys(e).length > 0) {
|
|
51
|
-
const
|
|
52
|
-
for (const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
state:
|
|
56
|
-
questions:
|
|
57
|
-
if (
|
|
58
|
+
const m = [];
|
|
59
|
+
for (const s of d) {
|
|
60
|
+
const l = s.state;
|
|
61
|
+
l && s.questions !== void 0 && m.push({
|
|
62
|
+
state: l,
|
|
63
|
+
questions: s.questions.map((t) => {
|
|
64
|
+
if (t.isQuestionForAdminOnly && !S)
|
|
58
65
|
return null;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
const i = e[l]?.[F(t.key)];
|
|
67
|
+
let f;
|
|
68
|
+
return i == null || typeof i == "number" && isNaN(i) ? f = "" : i instanceof Date ? f = isNaN(i.getTime()) ? "" : i.toISOString().split("T")[0] ?? "" : f = i, {
|
|
69
|
+
key: t.key,
|
|
62
70
|
answers: [
|
|
63
71
|
{
|
|
64
|
-
validFrom:
|
|
65
|
-
validUpTo:
|
|
66
|
-
value:
|
|
72
|
+
validFrom: t.answers[0]?.validFrom ?? G,
|
|
73
|
+
validUpTo: t.answers[0]?.validUpTo ?? null,
|
|
74
|
+
value: f
|
|
67
75
|
}
|
|
68
76
|
]
|
|
69
77
|
};
|
|
70
|
-
}).filter((
|
|
78
|
+
}).filter((t) => t !== null)
|
|
71
79
|
});
|
|
72
80
|
}
|
|
73
|
-
const
|
|
74
|
-
request: { employeeUuid: c, employeeStateTaxesRequest: { states:
|
|
81
|
+
const n = await _({
|
|
82
|
+
request: { employeeUuid: c, employeeStateTaxesRequest: { states: m } }
|
|
75
83
|
});
|
|
76
|
-
|
|
84
|
+
T(x.EMPLOYEE_STATE_TAXES_UPDATED, n);
|
|
77
85
|
}
|
|
78
|
-
|
|
86
|
+
T(x.EMPLOYEE_STATE_TAXES_DONE);
|
|
79
87
|
});
|
|
80
|
-
}), children:
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
88
|
+
}), children: y || /* @__PURE__ */ U(P, { children: [
|
|
89
|
+
/* @__PURE__ */ r(I, {}),
|
|
90
|
+
/* @__PURE__ */ r(z, {})
|
|
83
91
|
] }) }) })
|
|
84
92
|
}
|
|
85
93
|
) });
|
|
86
94
|
};
|
|
87
95
|
export {
|
|
88
|
-
|
|
96
|
+
fe as StateTaxes
|
|
89
97
|
};
|
|
90
98
|
//# sourceMappingURL=StateTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateTaxes.js","sources":["../../../../src/components/Employee/StateTaxes/StateTaxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useEffect } from 'react'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport { StateForm } from './StateForm'\nimport { StateFormSchema, type StateFormPayload } from './StateForm'\nimport { Actions } from './Actions'\nimport { StateTaxesProvider } from './useStateTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { snakeCaseToCamelCase, normalizeErrorKeyForForm } from '@/helpers/formattedStrings'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface StateTaxesProps extends CommonComponentInterface<'Employee.StateTaxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function StateTaxes(props: StateTaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent<'Employee.StateTaxes'> {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nconst Root = (props: StateTaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.StateTaxes')\n useComponentDictionary('Employee.StateTaxes', dictionary)\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending } = useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const defaultValues = {\n states: employeeStateTaxes.reduce((acc: Record<string, unknown>, state) => {\n if (state.state) {\n acc[state.state] = state.questions?.reduce((acc: Record<string, unknown>, question) => {\n const value = question.answers[0]?.value\n const key = snakeCaseToCamelCase(question.key)\n // Default new hire report to true if not specified\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else {\n acc[key] = value\n }\n return acc\n }, {})\n }\n return acc\n }, {}),\n }\n\n const formMethods = useForm<Record<string, unknown>, unknown, StateFormPayload>({\n resolver: zodResolver(StateFormSchema),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = normalizeErrorKeyForForm(msgObject.errorKey)\n const message = typeof msgObject.message === 'string' ? msgObject.message : 'Unknown error'\n _setError(key, { type: 'custom', message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload } = payload\n\n if (statesPayload && Object.keys(statesPayload).length > 0) {\n const states = []\n\n for (const state of employeeStateTaxes) {\n const stateName = state.state\n\n if (stateName && state.questions !== undefined) {\n states.push({\n state: stateName,\n questions: state.questions\n .map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) {\n return null\n }\n const formValue = statesPayload[stateName]?.[snakeCaseToCamelCase(question.key)]\n return {\n key: question.key,\n answers: [\n {\n validFrom: question.answers[0]?.validFrom ?? DEFAULT_TAX_VALID_FROM,\n validUpTo: question.answers[0]?.validUpTo ?? null,\n value:\n formValue == null || (typeof formValue === 'number' && isNaN(formValue))\n ? ''\n : (formValue as string | number | boolean),\n },\n ],\n }\n })\n .filter(q => q !== null),\n })\n }\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, employeeStateTaxesRequest: { states } },\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, stateTaxesResponse)\n }\n\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <StateTaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </StateTaxesProvider>\n </section>\n )\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","StateTaxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPending","useEmployeeTaxSetupUpdateStateTaxesMutation","defaultValues","acc","state","question","value","key","snakeCaseToCamelCase","formMethods","useForm","zodResolver","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","normalizeErrorKeyForForm","message","StateTaxesProvider","FormProvider","Form","data","payload","statesPayload","states","stateName","formValue","q","stateTaxesResponse","componentEvents","jsxs","Fragment","StateForm","Actions"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAMA,IAAyB;AAOxB,SAASC,GAAWC,GAAiD;AAC1E,SACE,gBAAAC,EAACC,KAAsC,GAAGF,GACx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;AAEA,kBAAMC,IAAqB,MAAM9B,EAAiB;AAAA,cAChD,SAAS,EAAE,cAAcd,GAAY,2BAA2B,EAAE,QAAAwC,IAAO;AAAA,YAAE,CAC5E;AACD,YAAAnC,EAAQwC,EAAgB,8BAA8BD,CAAkB;AAAA,UAC1E;AAEA,UAAAvC,EAAQwC,EAAgB,yBAAyB;AAAA,QACnD,CAAC;AAAA,MACH,CAY6C,GAClC,UAAA3C,KAGC,gBAAA4C,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAAlD,EAACmD,GAAA,EAAU;AAAA,0BACVC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,GAEJ,EAAA,CACF;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"StateTaxes.js","sources":["../../../../src/components/Employee/StateTaxes/StateTaxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useEffect } from 'react'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport { StateForm } from './StateForm'\nimport { StateFormSchema, type StateFormPayload } from './StateForm'\nimport { Actions } from './Actions'\nimport { StateTaxesProvider } from './useStateTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { snakeCaseToCamelCase, normalizeErrorKeyForForm } from '@/helpers/formattedStrings'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface StateTaxesProps extends CommonComponentInterface<'Employee.StateTaxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function StateTaxes(props: StateTaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent<'Employee.StateTaxes'> {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nconst Root = (props: StateTaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.StateTaxes')\n useComponentDictionary('Employee.StateTaxes', dictionary)\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending } = useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const defaultValues = {\n states: employeeStateTaxes.reduce((acc: Record<string, unknown>, state) => {\n if (state.state) {\n acc[state.state] = state.questions?.reduce((acc: Record<string, unknown>, question) => {\n const value = question.answers[0]?.value\n const key = snakeCaseToCamelCase(question.key)\n const isDateField = question.inputQuestionFormat.type.toLowerCase() === 'date'\n\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else if (isDateField && typeof value === 'string') {\n const trimmedValue = value.trim()\n acc[key] = trimmedValue === '' ? undefined : new Date(trimmedValue)\n } else {\n acc[key] = value\n }\n return acc\n }, {})\n }\n return acc\n }, {}),\n }\n\n const formMethods = useForm<Record<string, unknown>, unknown, StateFormPayload>({\n resolver: zodResolver(StateFormSchema),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = normalizeErrorKeyForForm(msgObject.errorKey)\n const message = typeof msgObject.message === 'string' ? msgObject.message : 'Unknown error'\n _setError(key, { type: 'custom', message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload } = payload\n\n if (statesPayload && Object.keys(statesPayload).length > 0) {\n const states = []\n\n for (const state of employeeStateTaxes) {\n const stateName = state.state\n\n if (stateName && state.questions !== undefined) {\n states.push({\n state: stateName,\n questions: state.questions\n .map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) {\n return null\n }\n const formValue = statesPayload[stateName]?.[snakeCaseToCamelCase(question.key)]\n\n let serializedValue: string | number | boolean\n if (formValue == null || (typeof formValue === 'number' && isNaN(formValue))) {\n serializedValue = ''\n } else if (formValue instanceof Date) {\n serializedValue = isNaN(formValue.getTime())\n ? ''\n : (formValue.toISOString().split('T')[0] ?? '')\n } else {\n serializedValue = formValue as string | number | boolean\n }\n\n return {\n key: question.key,\n answers: [\n {\n validFrom: question.answers[0]?.validFrom ?? DEFAULT_TAX_VALID_FROM,\n validUpTo: question.answers[0]?.validUpTo ?? null,\n value: serializedValue,\n },\n ],\n }\n })\n .filter(q => q !== null),\n })\n }\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, employeeStateTaxesRequest: { states } },\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, stateTaxesResponse)\n }\n\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <StateTaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </StateTaxesProvider>\n </section>\n )\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","StateTaxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPending","useEmployeeTaxSetupUpdateStateTaxesMutation","defaultValues","acc","state","question","value","key","snakeCaseToCamelCase","isDateField","trimmedValue","formMethods","useForm","zodResolver","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","normalizeErrorKeyForForm","message","StateTaxesProvider","FormProvider","Form","data","payload","statesPayload","states","stateName","formValue","serializedValue","q","stateTaxesResponse","componentEvents","jsxs","Fragment","StateForm","Actions"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAMA,IAAyB;AAOxB,SAASC,GAAWC,GAAiD;AAC1E,SACE,gBAAAC,EAACC,KAAsC,GAAGF,GACxC,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,MAAMG,IAAO,CAACH,MAA2B;AACvC,QAAM,EAAE,YAAAI,GAAY,WAAAC,GAAW,UAAAC,GAAU,SAAAC,IAAU,IAAO,YAAAC,MAAeR,GACnE,EAAE,SAAAS,GAAS,aAAAC,GAAa,mBAAAC,EAAA,IAAsBC,EAAA;AACpD,EAAAC,EAAQ,qBAAqB,GAC7BC,EAAuB,uBAAuBN,CAAU;AAExD,QAAM,EAAE,MAAMO,EAAA,IAAcC,EAAyC;AAAA,IACnE,cAAcZ;AAAA,EAAA,CACf,GACKa,IAAqBF,EAAU,wBAC/B,EAAE,aAAaG,GAAkB,WAAAC,EAAA,IAAcC,EAAA,GAE/CC,IAAgB;AAAA,IACpB,QAAQJ,EAAmB,OAAO,CAACK,GAA8BC,OAC3DA,EAAM,UACRD,EAAIC,EAAM,KAAK,IAAIA,EAAM,WAAW,OAAO,CAACD,GAA8BE,MAAa;AACrF,YAAMC,IAAQD,EAAS,QAAQ,CAAC,GAAG,OAC7BE,IAAMC,EAAqBH,EAAS,GAAG,GACvCI,IAAcJ,EAAS,oBAAoB,KAAK,kBAAkB;AAExE,UAAIE,MAAQ;AACVJ,QAAAA,EAAII,CAAG,IAAI,OAAOD,IAAU,MAAc,KAAOA;AAAA,eACxCG,KAAe,OAAOH,KAAU,UAAU;AACnD,cAAMI,IAAeJ,EAAM,KAAA;AAC3BH,QAAA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ts/ComponentAdapter/useComponentContext.js";
|
|
12
12
|
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
13
13
|
import "dompurify";
|
|
14
|
-
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [d, u] = t("StateTaxesContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
u as StateTaxesProvider,
|
|
18
|
+
d as useStateTaxes
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=useStateTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStateTaxes.js","sources":["../../../../src/components/Employee/StateTaxes/useStateTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useStateTaxes, StateTaxesProvider] =\n createCompoundContext<StateTaxesContextType>('StateTaxesContext')\nexport { useStateTaxes, StateTaxesProvider }\n"],"names":["useStateTaxes","StateTaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useStateTaxes.js","sources":["../../../../src/components/Employee/StateTaxes/useStateTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useStateTaxes, StateTaxesProvider] =\n createCompoundContext<StateTaxesContextType>('StateTaxesContext')\nexport { useStateTaxes, StateTaxesProvider }\n"],"names":["useStateTaxes","StateTaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AASA,MAAM,CAACA,GAAeC,CAAkB,IACtCC,EAA6C,mBAAmB;"}
|
|
@@ -4,12 +4,12 @@ import { useFormContext as m } from "react-hook-form";
|
|
|
4
4
|
import { z as t } from "zod";
|
|
5
5
|
import "../../../shared/constants.js";
|
|
6
6
|
import "classnames";
|
|
7
|
-
import {
|
|
8
|
-
import { TextInputField as g } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
9
|
-
import { NumberInputField as l } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
10
|
-
import { useComponentContext as c } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
|
+
import { useComponentContext as f } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
8
|
import "react";
|
|
12
9
|
import { SelectField as s } from "../../Common/Fields/SelectField/SelectField.js";
|
|
10
|
+
import { RadioGroupField as g } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
11
|
+
import { NumberInputField as l } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
12
|
+
import { TextInputField as c } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
13
13
|
const p = t.object({
|
|
14
14
|
w4DataType: t.literal("rev_2020_w4"),
|
|
15
15
|
filingStatus: t.string().min(1),
|
|
@@ -29,7 +29,7 @@ function A() {
|
|
|
29
29
|
return e("w4DataType") === "rev_2020_w4" ? /* @__PURE__ */ i(b, {}) : /* @__PURE__ */ i(S, {});
|
|
30
30
|
}
|
|
31
31
|
function b() {
|
|
32
|
-
const { t: e } = o("Employee.Taxes"), r =
|
|
32
|
+
const { t: e } = o("Employee.Taxes"), r = f(), d = [
|
|
33
33
|
{ value: "Single", label: e("filingStatusSingle") },
|
|
34
34
|
{ value: "Married", label: e("filingStatusMarried") },
|
|
35
35
|
{ value: "Head of Household", label: e("filingStatusHeadOfHousehold") },
|
|
@@ -48,7 +48,7 @@ function b() {
|
|
|
48
48
|
}
|
|
49
49
|
),
|
|
50
50
|
/* @__PURE__ */ i(
|
|
51
|
-
|
|
51
|
+
g,
|
|
52
52
|
{
|
|
53
53
|
name: "twoJobs",
|
|
54
54
|
isRequired: !0,
|
|
@@ -149,7 +149,7 @@ function S() {
|
|
|
149
149
|
}
|
|
150
150
|
),
|
|
151
151
|
/* @__PURE__ */ i(
|
|
152
|
-
|
|
152
|
+
c,
|
|
153
153
|
{
|
|
154
154
|
name: "additionalWithholding",
|
|
155
155
|
label: e("additionalWithholding"),
|
|
@@ -11,11 +11,10 @@ import "classnames";
|
|
|
11
11
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
12
|
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
13
13
|
import "dompurify";
|
|
14
|
-
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
15
14
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [u, f] = o("TaxesContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
f as TaxesProvider,
|
|
18
|
+
u as useTaxes
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=useTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AASA,MAAM,CAACA,GAAUC,CAAa,IAAIC,EAAwC,cAAc;"}
|
package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js
CHANGED
|
@@ -15,13 +15,13 @@ import { useBase as J } from "../../Base/useBase.js";
|
|
|
15
15
|
import { Flex as y } from "../../Common/Flex/Flex.js";
|
|
16
16
|
import "classnames";
|
|
17
17
|
import { informationRequestEvents as _ } from "../../../shared/constants.js";
|
|
18
|
-
import { TextInputField as X } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
19
18
|
import { useComponentContext as A } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
20
19
|
import "react";
|
|
21
|
-
import { FileInputField as
|
|
22
|
-
import { Form as
|
|
23
|
-
import { useComponentDictionary as
|
|
24
|
-
import { useFlow as
|
|
20
|
+
import { FileInputField as X } from "../../Common/Fields/FileInputField/FileInputField.js";
|
|
21
|
+
import { Form as Z } from "../../Common/Form/Form.js";
|
|
22
|
+
import { useComponentDictionary as ee, useI18n as C } from "../../../i18n/I18n.js";
|
|
23
|
+
import { useFlow as ne } from "../../Flow/useFlow.js";
|
|
24
|
+
import { TextInputField as te } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
25
25
|
const M = "gusto-sdk-information-request-form", oe = ["image/jpeg", "image/png", "application/pdf"], se = {
|
|
26
26
|
ALLOWED_TAGS: ["a", "b", "strong"],
|
|
27
27
|
ALLOWED_ATTR: ["target", "href", "rel"]
|
|
@@ -47,7 +47,7 @@ function ce(o) {
|
|
|
47
47
|
return o.some((s) => s.responseType === u.Persona);
|
|
48
48
|
}
|
|
49
49
|
function me({ companyId: o, requestId: s, dictionary: i }) {
|
|
50
|
-
|
|
50
|
+
ee("InformationRequests.InformationRequestForm", i), C("InformationRequests.InformationRequestForm");
|
|
51
51
|
const { t: n } = D("InformationRequests.InformationRequestForm"), { Alert: T, Heading: q, Text: c } = A(), { onEvent: I, baseSubmitHandler: g } = J(), { data: x } = P({
|
|
52
52
|
companyUuid: o
|
|
53
53
|
}), l = x.informationRequestList?.find((t) => t.uuid === s), a = l?.requiredQuestions ?? [], F = l?.blockingPayroll ?? !1, w = O(a), E = ce(a), { mutateAsync: L } = V(), v = {}, U = [];
|
|
@@ -106,7 +106,7 @@ function me({ companyId: o, requestId: s, dictionary: i }) {
|
|
|
106
106
|
] }),
|
|
107
107
|
/* @__PURE__ */ e("hr", { className: r.divider }),
|
|
108
108
|
b && /* @__PURE__ */ e("div", { className: r.textInputWrapper, children: /* @__PURE__ */ e(
|
|
109
|
-
|
|
109
|
+
te,
|
|
110
110
|
{
|
|
111
111
|
name: R,
|
|
112
112
|
label: n("fields.textAnswer.label"),
|
|
@@ -116,7 +116,7 @@ function me({ companyId: o, requestId: s, dictionary: i }) {
|
|
|
116
116
|
}
|
|
117
117
|
) }),
|
|
118
118
|
h && /* @__PURE__ */ e("div", { className: r.fileInputWrapper, children: /* @__PURE__ */ e(
|
|
119
|
-
|
|
119
|
+
X,
|
|
120
120
|
{
|
|
121
121
|
name: R,
|
|
122
122
|
label: n("fields.fileUpload.label"),
|
|
@@ -139,12 +139,12 @@ function me({ companyId: o, requestId: s, dictionary: i }) {
|
|
|
139
139
|
return /* @__PURE__ */ e("div", { className: r.root, children: /* @__PURE__ */ m(y, { flexDirection: "column", gap: 16, children: [
|
|
140
140
|
/* @__PURE__ */ e(q, { as: "h2", children: n("title") }),
|
|
141
141
|
F && /* @__PURE__ */ e(T, { status: "error", label: n("blockingAlert.title"), disableScrollIntoView: !0, children: n("blockingAlert.description") }),
|
|
142
|
-
w ? j : /* @__PURE__ */ e(H, { ...N, children: /* @__PURE__ */ e(
|
|
142
|
+
w ? j : /* @__PURE__ */ e(H, { ...N, children: /* @__PURE__ */ e(Z, { id: M, onSubmit: N.handleSubmit(Q), children: /* @__PURE__ */ e(y, { flexDirection: "column", gap: 16, children: a.map(k) }) }) })
|
|
143
143
|
] }) });
|
|
144
144
|
}
|
|
145
145
|
const le = ({ onEvent: o }) => {
|
|
146
146
|
C("InformationRequests.InformationRequestForm");
|
|
147
|
-
const { t: s } = D("InformationRequests.InformationRequestForm"), { Button: i } = A(), { companyId: n, selectedRequestId: T } =
|
|
147
|
+
const { t: s } = D("InformationRequests.InformationRequestForm"), { Button: i } = A(), { companyId: n, selectedRequestId: T } = ne(), { data: q } = P({
|
|
148
148
|
companyUuid: n
|
|
149
149
|
}), I = q.informationRequestList?.find(
|
|
150
150
|
(F) => F.uuid === T
|
package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InformationRequestForm.js","sources":["../../../../src/components/InformationRequests/InformationRequestForm/InformationRequestForm.tsx"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useIsMutating } from '@tanstack/react-query'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport {\n useInformationRequestsSubmitMutation,\n mutationKeyInformationRequestsSubmit,\n} from '@gusto/embedded-api/react-query/informationRequestsSubmit'\nimport type { RequiredQuestions } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType as SubmitResponseType } from '@gusto/embedded-api/models/operations/submitinformationrequest'\nimport type { InformationRequestsContextInterface } from '../InformationRequestsComponents'\nimport styles from './InformationRequestForm.module.scss'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { Flex, TextInputField } from '@/components/Common'\nimport { FileInputField } from '@/components/Common/Fields/FileInputField'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { informationRequestEvents, type EventType } from '@/shared/constants'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nconst INFORMATION_REQUEST_FORM_ID = 'gusto-sdk-information-request-form'\nconst ACCEPTED_FILE_TYPES = ['image/jpeg', 'image/png', 'application/pdf']\nconst dompurifyConfig = {\n ALLOWED_TAGS: ['a', 'b', 'strong'],\n ALLOWED_ATTR: ['target', 'href', 'rel'],\n}\n\nconst InformationRequestFormSchema = z.record(\n z.string(),\n z.union([z.string().min(1), z.instanceof(File)]),\n)\n\ntype InformationRequestFormValues = z.infer<typeof InformationRequestFormSchema>\n\ninterface InformationRequestFormProps extends BaseComponentInterface<'InformationRequests.InformationRequestForm'> {\n companyId: string\n requestId: string\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function InformationRequestForm(props: InformationRequestFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst convertFileToDataUrl = (file: File) => {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => {\n resolve(reader.result as string)\n }\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n}\n\nconst SUPPORTED_RESPONSE_TYPES: ResponseType[] = [ResponseType.Text, ResponseType.Document]\n\nfunction hasUnsupportedQuestionTypes(questions: RequiredQuestions[]) {\n return questions.some(\n question => question.responseType && !SUPPORTED_RESPONSE_TYPES.includes(question.responseType),\n )\n}\n\nfunction hasPersonaQuestionType(questions: RequiredQuestions[]) {\n return questions.some(question => question.responseType === ResponseType.Persona)\n}\n\nfunction Root({ companyId, requestId, dictionary }: InformationRequestFormProps) {\n useComponentDictionary('InformationRequests.InformationRequestForm', dictionary)\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Alert, Heading, Text } = useComponentContext()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequestList?.find(req => req.uuid === requestId)\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const isBlockingPayroll = informationRequest?.blockingPayroll ?? false\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n const hasPersonaType = hasPersonaQuestionType(requiredQuestions)\n\n const { mutateAsync: submitInformationRequest } = useInformationRequestsSubmitMutation()\n\n const defaultValues: Record<string, string | File | undefined> = {}\n const questionUuids: string[] = []\n\n requiredQuestions.forEach(question => {\n if (!question.questionUuid || !question.responseType) return\n\n if (question.responseType === ResponseType.Text) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = ''\n } else if (question.responseType === ResponseType.Document) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = undefined\n }\n })\n\n const formMethods = useForm<InformationRequestFormValues>({\n resolver: zodResolver(InformationRequestFormSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InformationRequestFormValues) => {\n await baseSubmitHandler(formData, async () => {\n const questionResponses = await Promise.all(\n questionUuids.map(async uuid => {\n const value = formData[uuid]\n\n if (typeof value === 'string') {\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Text,\n textResponse: value,\n }\n }\n\n if (value instanceof File) {\n const fileResponse = await convertFileToDataUrl(value)\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Document,\n fileResponse,\n fileName: value.name,\n }\n }\n\n return null\n }),\n )\n\n const validResponses = questionResponses.filter(response => response !== null)\n\n const response = await submitInformationRequest({\n request: {\n informationRequestUuid: requestId,\n requestBody: {\n requiredQuestions: validResponses,\n },\n },\n })\n\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_DONE, response.informationRequest)\n })\n }\n\n const renderQuestion = (question: RequiredQuestions) => {\n if (!question.questionUuid || !question.responseType) return null\n\n const fieldName = question.questionUuid\n const isDocumentType = question.responseType === ResponseType.Document\n const isTextType = question.responseType === ResponseType.Text\n\n return (\n <div key={fieldName} className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text weight=\"medium\">\n {isDocumentType ? t('questionTypes.document') : t('questionTypes.answer')}\n </Text>\n <Text>\n {/* SECURITY: XSS mitigated via DOMPurify with strict allowlist. Pattern matches TaxInputs.tsx */}\n <span\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(question.questionText ?? '', dompurifyConfig),\n }}\n />\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n {isTextType && (\n <div className={styles.textInputWrapper}>\n <TextInputField\n name={fieldName}\n label={t('fields.textAnswer.label')}\n placeholder={t('fields.textAnswer.placeholder')}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n\n {isDocumentType && (\n <div className={styles.fileInputWrapper}>\n <FileInputField\n name={fieldName}\n label={t('fields.fileUpload.label')}\n accept={ACCEPTED_FILE_TYPES}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n </div>\n )\n }\n\n const unsupportedPlaceholder = (\n <div className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text weight=\"medium\">\n {t(hasPersonaType ? 'unsupported.persona.title' : 'unsupported.generic.title')}\n </Text>\n <Text>\n {t(\n hasPersonaType ? 'unsupported.persona.description' : 'unsupported.generic.description',\n )}\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n <div className={styles.contactSupport}>\n <Text variant=\"supporting\">{t('unsupported.contactSupport')}</Text>\n </div>\n </div>\n )\n\n return (\n <div className={styles.root}>\n <Flex flexDirection=\"column\" gap={16}>\n <Heading as=\"h2\">{t('title')}</Heading>\n\n {isBlockingPayroll && (\n <Alert status=\"error\" label={t('blockingAlert.title')} disableScrollIntoView>\n {t('blockingAlert.description')}\n </Alert>\n )}\n\n {hasUnsupportedTypes ? (\n unsupportedPlaceholder\n ) : (\n <FormProvider {...formMethods}>\n <Form id={INFORMATION_REQUEST_FORM_ID} onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={16}>\n {requiredQuestions.map(renderQuestion)}\n </Flex>\n </Form>\n </FormProvider>\n )}\n </Flex>\n </div>\n )\n}\n\nconst Footer = ({ onEvent }: { onEvent: OnEventType<EventType, unknown> }) => {\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Button } = useComponentContext()\n const { companyId, selectedRequestId } = useFlow<InformationRequestsContextInterface>()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequestList?.find(\n req => req.uuid === selectedRequestId,\n )\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n\n const isMutating = useIsMutating({\n mutationKey: mutationKeyInformationRequestsSubmit(),\n })\n const isPending = isMutating > 0\n\n const handleCancel = () => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_CANCEL)\n }\n\n if (hasUnsupportedTypes) {\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel}>\n {t('cta.close')}\n </Button>\n </Flex>\n )\n }\n\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel} isDisabled={isPending}>\n {t('cta.cancel')}\n </Button>\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={INFORMATION_REQUEST_FORM_ID}\n isLoading={isPending}\n >\n {t('cta.submit')}\n </Button>\n </Flex>\n )\n}\n\nInformationRequestForm.Footer = Footer\n"],"names":["INFORMATION_REQUEST_FORM_ID","ACCEPTED_FILE_TYPES","dompurifyConfig","InformationRequestFormSchema","z","InformationRequestForm","props","jsx","BaseComponent","Root","convertFileToDataUrl","file","resolve","reject","reader","SUPPORTED_RESPONSE_TYPES","ResponseType","hasUnsupportedQuestionTypes","questions","question","hasPersonaQuestionType","companyId","requestId","dictionary","useComponentDictionary","useI18n","t","useTranslation","Alert","Heading","Text","useComponentContext","onEvent","baseSubmitHandler","useBase","data","useInformationRequestsGetInformationRequestsSuspense","informationRequest","req","requiredQuestions","isBlockingPayroll","hasUnsupportedTypes","hasPersonaType","submitInformationRequest","useInformationRequestsSubmitMutation","defaultValues","questionUuids","formMethods","useForm","zodResolver","onSubmit","formData","validResponses","uuid","value","SubmitResponseType","fileResponse","response","informationRequestEvents","renderQuestion","fieldName","isDocumentType","isTextType","jsxs","styles","DOMPurify","TextInputField","FileInputField","unsupportedPlaceholder","Flex","FormProvider","Form","Footer","Button","selectedRequestId","useFlow","isPending","useIsMutating","mutationKeyInformationRequestsSubmit","handleCancel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,IAA8B,sCAC9BC,KAAsB,CAAC,cAAc,aAAa,iBAAiB,GACnEC,KAAkB;AAAA,EACtB,cAAc,CAAC,KAAK,KAAK,QAAQ;AAAA,EACjC,cAAc,CAAC,UAAU,QAAQ,KAAK;AACxC,GAEMC,KAA+BC,EAAE;AAAA,EACrCA,EAAE,OAAA;AAAA,EACFA,EAAE,MAAM,CAACA,EAAE,OAAA,EAAS,IAAI,CAAC,GAAGA,EAAE,WAAW,IAAI,CAAC,CAAC;AACjD;AAUO,SAASC,GAAuBC,GAAoC;AACzE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMI,KAAuB,CAACC,MACrB,IAAI,QAAgB,CAACC,GAASC,MAAW;AAC9C,QAAMC,IAAS,IAAI,WAAA;AACnB,EAAAA,EAAO,SAAS,MAAM;AACpB,IAAAF,EAAQE,EAAO,MAAgB;AAAA,EACjC,GACAA,EAAO,UAAUD,GACjBC,EAAO,c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E,MAAAxC,EAAA,IAASC,EAAqD;AAAA,IACpE,aAAaf;AAAA,EAAA,CACd,GAKKkB,IAHqBJ,EAAK,wBAAwB;AAAA,IACtD,CAAAG,MAAOA,EAAI,SAASoC;AAAA,EAAA,GAEwB,qBAAqB,CAAA,GAC7DjC,IAAsBxB,EAA4BsB,CAAiB,GAKnEqC,IAHaC,EAAc;AAAA,IAC/B,aAAaC,EAAA;AAAA,EAAqC,CACnD,IAC8B,GAEzBC,IAAe,MAAM;AACzB,IAAA/C,EAAQ0B,EAAyB,+BAA+B;AAAA,EAClE;AAEA,SAAIjB,IAEA,gBAAAlC,EAAC8D,GAAA,EAAK,gBAAe,YAAW,KAAK,IACnC,UAAA,gBAAA9D,EAACkE,GAAA,EAAO,SAAQ,aAAY,SAASM,GAClC,UAAArD,EAAE,WAAW,GAChB,GACF,IAKF,gBAAAqC,EAACM,GAAA,EAAK,gBAAe,YAAW,KAAK,IACnC,UAAA;AAAA,IAAA,gBAAA9D,EAACkE,GAAA,EAAO,SAAQ,aAAY,SAASM,GAAc,YAAYH,GAC5D,UAAAlD,EAAE,YAAY,EAAA,CACjB;AAAA,IACA,gBAAAnB;AAAA,MAACkE;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,MAAMzE;AAAA,QACN,WAAW4E;AAAA,QAEV,YAAE,YAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EACjB,GACF;AAEJ;AAEAvE,GAAuB,SAASmE;"}
|
|
1
|
+
{"version":3,"file":"InformationRequestForm.js","sources":["../../../../src/components/InformationRequests/InformationRequestForm/InformationRequestForm.tsx"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useIsMutating } from '@tanstack/react-query'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport {\n useInformationRequestsSubmitMutation,\n mutationKeyInformationRequestsSubmit,\n} from '@gusto/embedded-api/react-query/informationRequestsSubmit'\nimport type { RequiredQuestions } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType as SubmitResponseType } from '@gusto/embedded-api/models/operations/submitinformationrequest'\nimport type { InformationRequestsContextInterface } from '../InformationRequestsComponents'\nimport styles from './InformationRequestForm.module.scss'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { Flex, TextInputField } from '@/components/Common'\nimport { FileInputField } from '@/components/Common/Fields/FileInputField'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { informationRequestEvents, type EventType } from '@/shared/constants'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nconst INFORMATION_REQUEST_FORM_ID = 'gusto-sdk-information-request-form'\nconst ACCEPTED_FILE_TYPES = ['image/jpeg', 'image/png', 'application/pdf']\nconst dompurifyConfig = {\n ALLOWED_TAGS: ['a', 'b', 'strong'],\n ALLOWED_ATTR: ['target', 'href', 'rel'],\n}\n\nconst InformationRequestFormSchema = z.record(\n z.string(),\n z.union([z.string().min(1), z.instanceof(File)]),\n)\n\ntype InformationRequestFormValues = z.infer<typeof InformationRequestFormSchema>\n\ninterface InformationRequestFormProps extends BaseComponentInterface<'InformationRequests.InformationRequestForm'> {\n companyId: string\n requestId: string\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function InformationRequestForm(props: InformationRequestFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst convertFileToDataUrl = (file: File) => {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => {\n resolve(reader.result as string)\n }\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n}\n\nconst SUPPORTED_RESPONSE_TYPES: ResponseType[] = [ResponseType.Text, ResponseType.Document]\n\nfunction hasUnsupportedQuestionTypes(questions: RequiredQuestions[]) {\n return questions.some(\n question => question.responseType && !SUPPORTED_RESPONSE_TYPES.includes(question.responseType),\n )\n}\n\nfunction hasPersonaQuestionType(questions: RequiredQuestions[]) {\n return questions.some(question => question.responseType === ResponseType.Persona)\n}\n\nfunction Root({ companyId, requestId, dictionary }: InformationRequestFormProps) {\n useComponentDictionary('InformationRequests.InformationRequestForm', dictionary)\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Alert, Heading, Text } = useComponentContext()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequestList?.find(req => req.uuid === requestId)\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const isBlockingPayroll = informationRequest?.blockingPayroll ?? false\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n const hasPersonaType = hasPersonaQuestionType(requiredQuestions)\n\n const { mutateAsync: submitInformationRequest } = useInformationRequestsSubmitMutation()\n\n const defaultValues: Record<string, string | File | undefined> = {}\n const questionUuids: string[] = []\n\n requiredQuestions.forEach(question => {\n if (!question.questionUuid || !question.responseType) return\n\n if (question.responseType === ResponseType.Text) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = ''\n } else if (question.responseType === ResponseType.Document) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = undefined\n }\n })\n\n const formMethods = useForm<InformationRequestFormValues>({\n resolver: zodResolver(InformationRequestFormSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InformationRequestFormValues) => {\n await baseSubmitHandler(formData, async () => {\n const questionResponses = await Promise.all(\n questionUuids.map(async uuid => {\n const value = formData[uuid]\n\n if (typeof value === 'string') {\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Text,\n textResponse: value,\n }\n }\n\n if (value instanceof File) {\n const fileResponse = await convertFileToDataUrl(value)\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Document,\n fileResponse,\n fileName: value.name,\n }\n }\n\n return null\n }),\n )\n\n const validResponses = questionResponses.filter(response => response !== null)\n\n const response = await submitInformationRequest({\n request: {\n informationRequestUuid: requestId,\n requestBody: {\n requiredQuestions: validResponses,\n },\n },\n })\n\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_DONE, response.informationRequest)\n })\n }\n\n const renderQuestion = (question: RequiredQuestions) => {\n if (!question.questionUuid || !question.responseType) return null\n\n const fieldName = question.questionUuid\n const isDocumentType = question.responseType === ResponseType.Document\n const isTextType = question.responseType === ResponseType.Text\n\n return (\n <div key={fieldName} className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text weight=\"medium\">\n {isDocumentType ? t('questionTypes.document') : t('questionTypes.answer')}\n </Text>\n <Text>\n {/* SECURITY: XSS mitigated via DOMPurify with strict allowlist. Pattern matches TaxInputs.tsx */}\n <span\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(question.questionText ?? '', dompurifyConfig),\n }}\n />\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n {isTextType && (\n <div className={styles.textInputWrapper}>\n <TextInputField\n name={fieldName}\n label={t('fields.textAnswer.label')}\n placeholder={t('fields.textAnswer.placeholder')}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n\n {isDocumentType && (\n <div className={styles.fileInputWrapper}>\n <FileInputField\n name={fieldName}\n label={t('fields.fileUpload.label')}\n accept={ACCEPTED_FILE_TYPES}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n </div>\n )\n }\n\n const unsupportedPlaceholder = (\n <div className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text weight=\"medium\">\n {t(hasPersonaType ? 'unsupported.persona.title' : 'unsupported.generic.title')}\n </Text>\n <Text>\n {t(\n hasPersonaType ? 'unsupported.persona.description' : 'unsupported.generic.description',\n )}\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n <div className={styles.contactSupport}>\n <Text variant=\"supporting\">{t('unsupported.contactSupport')}</Text>\n </div>\n </div>\n )\n\n return (\n <div className={styles.root}>\n <Flex flexDirection=\"column\" gap={16}>\n <Heading as=\"h2\">{t('title')}</Heading>\n\n {isBlockingPayroll && (\n <Alert status=\"error\" label={t('blockingAlert.title')} disableScrollIntoView>\n {t('blockingAlert.description')}\n </Alert>\n )}\n\n {hasUnsupportedTypes ? (\n unsupportedPlaceholder\n ) : (\n <FormProvider {...formMethods}>\n <Form id={INFORMATION_REQUEST_FORM_ID} onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={16}>\n {requiredQuestions.map(renderQuestion)}\n </Flex>\n </Form>\n </FormProvider>\n )}\n </Flex>\n </div>\n )\n}\n\nconst Footer = ({ onEvent }: { onEvent: OnEventType<EventType, unknown> }) => {\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Button } = useComponentContext()\n const { companyId, selectedRequestId } = useFlow<InformationRequestsContextInterface>()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequestList?.find(\n req => req.uuid === selectedRequestId,\n )\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n\n const isMutating = useIsMutating({\n mutationKey: mutationKeyInformationRequestsSubmit(),\n })\n const isPending = isMutating > 0\n\n const handleCancel = () => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_CANCEL)\n }\n\n if (hasUnsupportedTypes) {\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel}>\n {t('cta.close')}\n </Button>\n </Flex>\n )\n }\n\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel} isDisabled={isPending}>\n {t('cta.cancel')}\n </Button>\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={INFORMATION_REQUEST_FORM_ID}\n isLoading={isPending}\n >\n {t('cta.submit')}\n </Button>\n </Flex>\n )\n}\n\nInformationRequestForm.Footer = Footer\n"],"names":["INFORMATION_REQUEST_FORM_ID","ACCEPTED_FILE_TYPES","dompurifyConfig","InformationRequestFormSchema","z","InformationRequestForm","props","jsx","BaseComponent","Root","convertFileToDataUrl","file","resolve","reject","reader","SUPPORTED_RESPONSE_TYPES","ResponseType","hasUnsupportedQuestionTypes","questions","question","hasPersonaQuestionType","companyId","requestId","dictionary","useComponentDictionary","useI18n","t","useTranslation","Alert","Heading","Text","useComponentContext","onEvent","baseSubmitHandler","useBase","data","useInformationRequestsGetInformationRequestsSuspense","informationRequest","req","requiredQuestions","isBlockingPayroll","hasUnsupportedTypes","hasPersonaType","submitInformationRequest","useInformationRequestsSubmitMutation","defaultValues","questionUuids","formMethods","useForm","zodResolver","onSubmit","formData","validResponses","uuid","value","SubmitResponseType","fileResponse","response","informationRequestEvents","renderQuestion","fieldName","isDocumentType","isTextType","jsxs","styles","DOMPurify","TextInputField","FileInputField","unsupportedPlaceholder","Flex","FormProvider","Form","Footer","Button","selectedRequestId","useFlow","isPending","useIsMutating","mutationKeyInformationRequestsSubmit","handleCancel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,IAA8B,sCAC9BC,KAAsB,CAAC,cAAc,aAAa,iBAAiB,GACnEC,KAAkB;AAAA,EACtB,cAAc,CAAC,KAAK,KAAK,QAAQ;AAAA,EACjC,cAAc,CAAC,UAAU,QAAQ,KAAK;AACxC,GAEMC,KAA+BC,EAAE;AAAA,EACrCA,EAAE,OAAA;AAAA,EACFA,EAAE,MAAM,CAACA,EAAE,OAAA,EAAS,IAAI,CAAC,GAAGA,EAAE,WAAW,IAAI,CAAC,CAAC;A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