@gusto/embedded-react-sdk 0.9.0 → 0.10.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +86 -2
  2. package/dist/components/Base/Base.d.ts +1 -1
  3. package/dist/components/Base/Base.js +39 -40
  4. package/dist/components/Base/Base.js.map +1 -1
  5. package/dist/components/Common/OnboardingStatusBadge/index.d.ts +21 -0
  6. package/dist/components/Common/OnboardingStatusBadge/index.js +17 -0
  7. package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -0
  8. package/dist/components/Common/TaxInputs/TaxInputs.js +42 -36
  9. package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
  10. package/dist/components/Contractor/Address/Form.js +4 -12
  11. package/dist/components/Contractor/Address/Form.js.map +1 -1
  12. package/dist/components/Contractor/List/index.d.ts +25 -0
  13. package/dist/components/Contractor/List/index.js +84 -0
  14. package/dist/components/Contractor/List/index.js.map +1 -0
  15. package/dist/components/Contractor/List/useContractorList.d.ts +20 -0
  16. package/dist/components/Contractor/List/useContractorList.js +31 -0
  17. package/dist/components/Contractor/List/useContractorList.js.map +1 -0
  18. package/dist/components/Contractor/NewHireReport/NewHireReport.d.ts +21 -0
  19. package/dist/components/Contractor/NewHireReport/NewHireReport.js +111 -0
  20. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -0
  21. package/dist/components/Contractor/NewHireReport/types.d.ts +4 -0
  22. package/dist/components/Contractor/PaymentMethod/BankAccountForm.d.ts +2 -0
  23. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +52 -0
  24. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -0
  25. package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +31 -0
  26. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +116 -0
  27. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -0
  28. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +11 -0
  29. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +35 -0
  30. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -0
  31. package/dist/components/Contractor/PaymentMethod/types.d.ts +8 -0
  32. package/dist/components/Contractor/index.d.ts +3 -0
  33. package/dist/components/Contractor/index.js +8 -2
  34. package/dist/components/Contractor/index.js.map +1 -1
  35. package/dist/components/Employee/Compensation/Edit.js +59 -56
  36. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  37. package/dist/components/Employee/Compensation/useCompensation.d.ts +2 -0
  38. package/dist/components/Employee/Compensation/useCompensation.js +16 -14
  39. package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
  40. package/dist/components/Employee/Deductions/DeductionForm.js +11 -3
  41. package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
  42. package/dist/components/Employee/Deductions/Deductions.js +25 -25
  43. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  44. package/dist/components/Employee/EmployeeList/List.js +56 -51
  45. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  46. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +48 -43
  47. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
  48. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
  49. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  50. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +3 -4
  51. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  52. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  53. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  54. package/dist/components/Employee/PaymentMethod/Split.js +88 -76
  55. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  56. package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +2 -2
  57. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +29 -25
  58. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  59. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +49 -20
  60. package/dist/components/Employee/Profile/AdminPersonalDetails.js +27 -25
  61. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  62. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +1 -1
  63. package/dist/components/Employee/Profile/Profile.js +135 -129
  64. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  65. package/dist/components/Employee/Taxes/StateForm.d.ts +1 -1
  66. package/dist/components/Employee/Taxes/StateForm.js +27 -25
  67. package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
  68. package/dist/components/Employee/Taxes/Taxes.d.ts +1 -1
  69. package/dist/components/Employee/Taxes/Taxes.js +77 -73
  70. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  71. package/dist/components/index.d.ts +1 -1
  72. package/dist/i18n/I18n.js +17 -17
  73. package/dist/i18n/I18n.js.map +1 -1
  74. package/dist/i18n/en/Contractor.ContractorList.json.js +25 -0
  75. package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -0
  76. package/dist/i18n/en/Contractor.NewHireReport.json.js +24 -0
  77. package/dist/i18n/en/Contractor.NewHireReport.json.js.map +1 -0
  78. package/dist/i18n/en/Contractor.PaymentMethod.json.js +35 -0
  79. package/dist/i18n/en/Contractor.PaymentMethod.json.js.map +1 -0
  80. package/dist/i18n/en/Employee.Compensation.json.js +22 -20
  81. package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
  82. package/dist/i18n/en/Employee.PaymentMethod.json.js +18 -17
  83. package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
  84. package/dist/i18n/en/common.json.d.ts +21 -9
  85. package/dist/i18n/en/common.json.js +35 -23
  86. package/dist/i18n/en/common.json.js.map +1 -1
  87. package/dist/index.js +4 -4
  88. package/dist/shared/constants.d.ts +18 -0
  89. package/dist/shared/constants.js +28 -15
  90. package/dist/shared/constants.js.map +1 -1
  91. package/dist/style.css +1 -1
  92. package/dist/types/i18next.d.ts +64 -1
  93. package/package.json +4 -3
  94. package/dist/components/Employee/PaymentMethod/Constants.d.ts +0 -8
  95. package/dist/components/Employee/PaymentMethod/Constants.js +0 -6
  96. package/dist/components/Employee/PaymentMethod/Constants.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Deductions.js","sources":["../../../../src/components/Employee/Deductions/Deductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEffect, useMemo, useState } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n useGarnishmentsListSuspense,\n invalidateGarnishmentsList,\n} from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useQueryClient } from '@tanstack/react-query'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport {\n type DeductionInputs,\n type DeductionPayload,\n DeductionSchema,\n DeductionsProvider,\n type MODE,\n} from './useDeductions'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Actions } from '@/components/Employee/Deductions/Actions'\nimport { IncludeDeductionsForm } from '@/components/Employee/Deductions/IncludeDeductionsForm'\nimport { Head } from '@/components/Employee/Deductions/Head'\nimport { DeductionForm } from '@/components/Employee/Deductions/DeductionForm'\nimport { DeductionsList } from '@/components/Employee/Deductions/DeductionsList'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface DeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nconst IncludeDeductionsSchema = z.object({ includeDeductions: z.enum(['Yes', 'No']) })\nexport type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>\n\nexport function Deductions(props: DeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\nexport const Root = ({ employeeId, className, dictionary }: DeductionsProps) => {\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n useComponentDictionary('Employee.Deductions', dictionary)\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n\n // Used for deletion or edit of deduction\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation({\n onSettled: () => invalidateGarnishmentsList(queryClient, [employeeId]),\n })\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation({\n onSettled: () => invalidateGarnishmentsList(queryClient, [employeeId]),\n })\n\n const activeDeductions = deductions.filter(deduction => deduction.active)\n const [mode, setMode] = useState<MODE>(activeDeductions.length < 1 ? 'INITIAL' : 'LIST')\n const [currentDeduction, setCurrentDeduction] = useState<Garnishment | null>(null)\n useI18n('Employee.Deductions')\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: currentDeduction?.amount ? Number(currentDeduction.amount) : 0,\n description: currentDeduction?.description ?? '',\n times: currentDeduction?.times ?? null,\n recurring: currentDeduction?.recurring?.toString() ?? 'true',\n annualMaximum: currentDeduction?.annualMaximum\n ? Number(currentDeduction.annualMaximum)\n : null,\n payPeriodMaximum: currentDeduction?.payPeriodMaximum\n ? Number(currentDeduction.payPeriodMaximum)\n : null,\n deductAsPercentage: currentDeduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: currentDeduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [currentDeduction])\n\n const includeDeductionsFormMethods = useForm<IncludeDeductionsPayload>({\n // resolver: zodResolver(IncludeDeductionsSchema),\n defaultValues: { includeDeductions: 'No' },\n })\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n\n const { reset: resetForm } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [currentDeduction, defaultValues, resetForm, mode])\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n //Deletion of deduction is simply updating it with active: false\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n })\n }\n const onSubmit: SubmitHandler<DeductionPayload | IncludeDeductionsPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if ('includeDeductions' in payload) {\n if (payload.includeDeductions === 'Yes') {\n setMode('ADD')\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n return\n }\n }\n if (!('includeDeductions' in payload)) {\n if (mode === 'ADD') {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else if (mode === 'EDIT') {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: currentDeduction?.uuid ?? '',\n requestBody: {\n ...payload,\n version: currentDeduction?.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n setCurrentDeduction(null)\n }\n setMode('LIST')\n }\n })\n }\n const handleAdd = () => {\n setMode('ADD')\n }\n const handleCancel = () => {\n setMode('LIST')\n setCurrentDeduction(null)\n }\n const handleEdit = (deduction: Garnishment) => {\n setMode('EDIT')\n setCurrentDeduction(deduction)\n }\n const handlePassthrough = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n return (\n <section className={className}>\n <DeductionsProvider\n value={{\n isPending: isPendingCreate || isPendingUpdate,\n employeeId,\n mode,\n deductions,\n handleAdd,\n handleCancel,\n handleDelete,\n handleEdit,\n handlePassthrough,\n }}\n >\n {mode === 'INITIAL' ? (\n <FormProvider {...includeDeductionsFormMethods}>\n <Form onSubmit={includeDeductionsFormMethods.handleSubmit(onSubmit)}>\n <Head />\n <IncludeDeductionsForm />\n <Actions />\n </Form>\n </FormProvider>\n ) : (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Head />\n <DeductionsList />\n <DeductionForm />\n <Actions />\n </Form>\n </FormProvider>\n )}\n </DeductionsProvider>\n </section>\n )\n}\n\nexport const DeductionsContextual = () => {\n const { employeeId, onEvent } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Deductions',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Deductions employeeId={employeeId} onEvent={onEvent} />\n}\n"],"names":["z","Deductions","props","jsx","BaseComponent","Root","employeeId","className","dictionary","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","useComponentDictionary","data","useGarnishmentsListSuspense","deductions","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","invalidateGarnishmentsList","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","activeDeductions","deduction","mode","setMode","useState","currentDeduction","setCurrentDeduction","useI18n","defaultValues","useMemo","includeDeductionsFormMethods","useForm","formMethods","zodResolver","DeductionSchema","resetForm","useEffect","handleDelete","payload","garnishment","componentEvents","onSubmit","createDeductionResponse","updateDeductionResponse","DeductionsProvider","FormProvider","jsxs","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,CAAS;AAAA,QAC/B;AAAA,QAgBQ,mBAfkB,MAAM;AAC9B,UAAAjB,EAAQoC,EAAgB,uBAAuB;AAAA,QACjD;AAAA,MAcM;AAAA,MAEC,UAASlB,MAAA,YACP,gBAAAxB,EAAA+C,GAAA,EAAc,GAAGf,GAChB,UAAC,gBAAAgB,EAAAC,GAAA,EAAK,UAAUjB,EAA6B,aAAaW,CAAQ,GAChE,UAAA;AAAA,QAAA,gBAAA3C,EAACkD,GAAK,EAAA;AAAA,0BACLC,GAAsB,EAAA;AAAA,0BACtBC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA,EACF,CAAA,IAEC,gBAAApD,EAAA+C,GAAA,EAAc,GAAGb,GAChB,UAAC,gBAAAc,EAAAC,GAAA,EAAK,UAAUf,EAAY,aAAaS,CAAQ,GAC/C,UAAA;AAAA,QAAA,gBAAA3C,EAACkD,GAAK,EAAA;AAAA,0BACLG,GAAe,EAAA;AAAA,0BACfC,GAAc,EAAA;AAAA,0BACdF,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ,GAEaG,KAAuB,MAAM;AACxC,QAAM,EAAE,YAAApD,GAAY,SAAAG,EAAQ,IAAIkD,GAAoC,GAC9D,EAAE,GAAAC,EAAA,IAAMC,EAAe,QAAQ;AAErC,MAAI,CAACvD;AACH,UAAM,IAAI;AAAA,MACRsD,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEK,SAAA,gBAAAzD,EAACF,IAAW,EAAA,YAAAK,GAAwB,SAAAG,EAAkB,CAAA;AAC/D;"}
1
+ {"version":3,"file":"Deductions.js","sources":["../../../../src/components/Employee/Deductions/Deductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEffect, useMemo, useState } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n useGarnishmentsListSuspense,\n invalidateGarnishmentsList,\n} from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useQueryClient } from '@tanstack/react-query'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport {\n type DeductionInputs,\n type DeductionPayload,\n DeductionSchema,\n DeductionsProvider,\n type MODE,\n} from './useDeductions'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Actions } from '@/components/Employee/Deductions/Actions'\nimport { IncludeDeductionsForm } from '@/components/Employee/Deductions/IncludeDeductionsForm'\nimport { Head } from '@/components/Employee/Deductions/Head'\nimport { DeductionForm } from '@/components/Employee/Deductions/DeductionForm'\nimport { DeductionsList } from '@/components/Employee/Deductions/DeductionsList'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface DeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nconst IncludeDeductionsSchema = z.object({ includeDeductions: z.enum(['Yes', 'No']) })\nexport type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>\n\nexport function Deductions(props: DeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\nexport const Root = ({ employeeId, className, dictionary }: DeductionsProps) => {\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n useComponentDictionary('Employee.Deductions', dictionary)\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n\n // Used for deletion or edit of deduction\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation({\n onSettled: () => invalidateGarnishmentsList(queryClient, [employeeId]),\n })\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation({\n onSettled: () => invalidateGarnishmentsList(queryClient, [employeeId]),\n })\n\n const activeDeductions = deductions.filter(deduction => deduction.active)\n const [mode, setMode] = useState<MODE>(activeDeductions.length < 1 ? 'INITIAL' : 'LIST')\n const [currentDeduction, setCurrentDeduction] = useState<Garnishment | null>(null)\n useI18n('Employee.Deductions')\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: currentDeduction?.amount ? Number(currentDeduction.amount) : 0,\n description: currentDeduction?.description ?? '',\n times: currentDeduction?.times ?? null,\n recurring: currentDeduction?.recurring?.toString() ?? 'true',\n annualMaximum: currentDeduction?.annualMaximum\n ? Number(currentDeduction.annualMaximum)\n : null,\n payPeriodMaximum: currentDeduction?.payPeriodMaximum\n ? Number(currentDeduction.payPeriodMaximum)\n : null,\n deductAsPercentage: currentDeduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: currentDeduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [currentDeduction])\n\n const includeDeductionsFormMethods = useForm<IncludeDeductionsPayload>({\n // resolver: zodResolver(IncludeDeductionsSchema),\n defaultValues: { includeDeductions: 'No' },\n })\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n\n const { reset: resetForm } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [currentDeduction, defaultValues, resetForm, mode])\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n //Deletion of deduction is simply updating it with active: false\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n })\n }\n const onSubmit: SubmitHandler<DeductionPayload | IncludeDeductionsPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if ('includeDeductions' in payload) {\n if (payload.includeDeductions === 'Yes') {\n setMode('ADD')\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n return\n }\n }\n if (!('includeDeductions' in payload)) {\n if (mode === 'ADD') {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else if (mode === 'EDIT') {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: currentDeduction?.uuid ?? '',\n requestBody: {\n ...payload,\n version: currentDeduction?.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n setCurrentDeduction(null)\n }\n setMode('LIST')\n }\n })\n }\n const handleAdd = () => {\n setMode('ADD')\n }\n const handleCancel = () => {\n setMode(activeDeductions.length < 1 ? 'INITIAL' : 'LIST')\n setCurrentDeduction(null)\n }\n const handleEdit = (deduction: Garnishment) => {\n setMode('EDIT')\n setCurrentDeduction(deduction)\n }\n const handlePassthrough = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n return (\n <section className={className}>\n <DeductionsProvider\n value={{\n isPending: isPendingCreate || isPendingUpdate,\n employeeId,\n mode,\n deductions,\n handleAdd,\n handleCancel,\n handleDelete,\n handleEdit,\n handlePassthrough,\n }}\n >\n {mode === 'INITIAL' ? (\n <FormProvider {...includeDeductionsFormMethods}>\n <Form onSubmit={includeDeductionsFormMethods.handleSubmit(onSubmit)}>\n <Head />\n <IncludeDeductionsForm />\n <Actions />\n </Form>\n </FormProvider>\n ) : (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Head />\n <DeductionsList />\n <DeductionForm />\n <Actions />\n </Form>\n </FormProvider>\n )}\n </DeductionsProvider>\n </section>\n )\n}\n\nexport const DeductionsContextual = () => {\n const { employeeId, onEvent } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Deductions',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Deductions employeeId={employeeId} onEvent={onEvent} />\n}\n"],"names":["z","Deductions","props","jsx","BaseComponent","Root","employeeId","className","dictionary","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","useComponentDictionary","data","useGarnishmentsListSuspense","deductions","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","invalidateGarnishmentsList","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","activeDeductions","deduction","mode","setMode","useState","currentDeduction","setCurrentDeduction","useI18n","defaultValues","useMemo","includeDeductionsFormMethods","useForm","formMethods","zodResolver","DeductionSchema","resetForm","useEffect","handleDelete","payload","garnishment","componentEvents","onSubmit","createDeductionResponse","updateDeductionResponse","DeductionsProvider","FormProvider","jsxs","Form","Head","IncludeDeductionsForm","Actions","DeductionsList","DeductionForm","DeductionsContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0CgCA,EAAE,OAAO,EAAE,mBAAmBA,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,EAAG,CAAA;AAG9E,SAASC,GAAWC,GAAiD;AAExE,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;A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AA;AAAA,0BACtBC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA,EACF,CAAA,IAEC,gBAAApD,EAAA+C,GAAA,EAAc,GAAGb,GAChB,UAAC,gBAAAc,EAAAC,GAAA,EAAK,UAAUf,EAAY,aAAaS,CAAQ,GAC/C,UAAA;AAAA,QAAA,gBAAA3C,EAACkD,GAAK,EAAA;AAAA,0BACLG,GAAe,EAAA;AAAA,0BACfC,GAAc,EAAA;AAAA,0BACdF,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ,GAEaG,KAAuB,MAAM;AACxC,QAAM,EAAE,YAAApD,GAAY,SAAAG,EAAQ,IAAIkD,GAAoC,GAC9D,EAAE,GAAAC,EAAA,IAAMC,EAAe,QAAQ;AAErC,MAAI,CAACvD;AACH,UAAM,IAAI;AAAA,MACRsD,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEK,SAAA,gBAAAzD,EAACF,IAAW,EAAA,YAAAK,GAAwB,SAAAG,EAAkB,CAAA;AAC/D;"}
@@ -1,113 +1,118 @@
1
- import { jsx as a, jsxs as c, Fragment as v } from "react/jsx-runtime";
2
- import { useTranslation as w } from "react-i18next";
3
- import { useState as A } from "react";
4
- import T from "./List.module.scss.js";
5
- import { useEmployeeList as k } from "./useEmployeeList.js";
1
+ import { jsx as e, jsxs as c, Fragment as v } from "react/jsx-runtime";
2
+ import { useTranslation as A } from "react-i18next";
3
+ import { useState as T } from "react";
4
+ import k from "./List.module.scss.js";
5
+ import { useEmployeeList as w } from "./useEmployeeList.js";
6
6
  import { EmptyData as B } from "../../Common/EmptyData/EmptyData.js";
7
7
  import { ActionsLayout as h } from "../../Common/ActionsLayout/ActionsLayout.js";
8
8
  import { useComponentContext as M } from "../../../contexts/ComponentAdapter/useComponentContext.js";
9
- import { HamburgerMenu as G } from "../../Common/HamburgerMenu/HamburgerMenu.js";
9
+ import { HamburgerMenu as y } from "../../Common/HamburgerMenu/HamburgerMenu.js";
10
+ import { EmployeeOnboardingStatusBadge as G } from "../../Common/OnboardingStatusBadge/index.js";
10
11
  import s from "../../../assets/icons/pencil.svg.js";
11
12
  import R from "../../../assets/icons/trashcan.svg.js";
12
13
  import { EmployeeOnboardingStatus as i, EmployeeSelfOnboardingStatuses as x } from "../../../shared/constants.js";
13
- import { firstLastName as y } from "../../../helpers/formattedStrings.js";
14
- import { useDataView as F } from "../../Common/DataView/useDataView.js";
15
- import { DataView as V } from "../../Common/DataView/DataView.js";
16
- const at = () => {
14
+ import { firstLastName as F } from "../../../helpers/formattedStrings.js";
15
+ import { useDataView as V } from "../../Common/DataView/useDataView.js";
16
+ import { DataView as j } from "../../Common/DataView/DataView.js";
17
+ const it = () => {
17
18
  const {
18
19
  handleDelete: g,
19
20
  employees: d,
20
- handleEdit: b,
21
+ handleEdit: p,
21
22
  handleReview: f,
22
- handleNew: u,
23
- handleCancelSelfOnboarding: p,
24
- handleFirstPage: S,
25
- handlePreviousPage: E,
23
+ handleNew: l,
24
+ handleCancelSelfOnboarding: b,
25
+ handleFirstPage: E,
26
+ handlePreviousPage: S,
26
27
  handleNextPage: C,
27
28
  handleLastPage: N,
28
29
  handleItemsPerPageChange: L,
29
30
  currentPage: O,
30
31
  totalPages: _,
31
32
  handleSkip: D
32
- } = k(), r = M(), { t: n } = w("Employee.EmployeeList"), [I, l] = A(/* @__PURE__ */ new Set()), { ...P } = F({
33
+ } = w(), r = M(), { t: a } = A("Employee.EmployeeList"), [I, u] = T(/* @__PURE__ */ new Set()), { ...P } = V({
33
34
  data: d,
34
35
  columns: [
35
36
  {
36
37
  key: "name",
37
- title: n("nameLabel"),
38
- render: (t) => y({
38
+ title: a("nameLabel"),
39
+ render: (t) => F({
39
40
  first_name: t.firstName,
40
41
  last_name: t.lastName
41
42
  })
42
43
  },
43
44
  {
44
45
  key: "status",
45
- title: n("statusLabel"),
46
- render: (t) => /* @__PURE__ */ a(r.Badge, { status: t.onboarded ? "success" : "warning", children: n(`onboardingStatus.${t.onboardingStatus ?? "undefined"}`, {
47
- ns: "common"
48
- }) })
46
+ title: a("statusLabel"),
47
+ render: ({ onboarded: t, onboardingStatus: n }) => /* @__PURE__ */ e(
48
+ G,
49
+ {
50
+ onboarded: t,
51
+ onboardingStatus: n
52
+ }
53
+ )
49
54
  }
50
55
  ],
51
56
  itemMenu: (t) => {
52
- const e = [];
53
- return (t.onboardingStatus === i.ADMIN_ONBOARDING_INCOMPLETE || t.onboardingStatus === i.SELF_ONBOARDING_PENDING_INVITE || t.onboardingStatus === i.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW || t.onboardingStatus === i.ONBOARDING_COMPLETED) && e.push({
54
- label: n("editCta"),
57
+ const n = [];
58
+ return (t.onboardingStatus === i.ADMIN_ONBOARDING_INCOMPLETE || t.onboardingStatus === i.SELF_ONBOARDING_PENDING_INVITE || t.onboardingStatus === i.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW || t.onboardingStatus === i.ONBOARDING_COMPLETED) && n.push({
59
+ label: a("editCta"),
55
60
  onClick: () => {
56
- b(t.uuid, t.onboardingStatus ?? void 0);
61
+ p(t.uuid, t.onboardingStatus ?? void 0);
57
62
  },
58
- icon: /* @__PURE__ */ a(s, { "aria-hidden": !0 })
59
- }), x.has(t.onboarding_status ?? "") && e.push({
60
- label: n("cancelSelfOnboardingCta"),
63
+ icon: /* @__PURE__ */ e(s, { "aria-hidden": !0 })
64
+ }), x.has(t.onboarding_status ?? "") && n.push({
65
+ label: a("cancelSelfOnboardingCta"),
61
66
  onClick: async () => {
62
- await p(t.uuid);
67
+ await b(t.uuid);
63
68
  },
64
- icon: /* @__PURE__ */ a(s, { "aria-hidden": !0 })
65
- }), t.onboardingStatus === i.SELF_ONBOARDING_COMPLETED_BY_EMPLOYEE && e.push({
66
- label: n("reviewCta"),
69
+ icon: /* @__PURE__ */ e(s, { "aria-hidden": !0 })
70
+ }), t.onboardingStatus === i.SELF_ONBOARDING_COMPLETED_BY_EMPLOYEE && n.push({
71
+ label: a("reviewCta"),
67
72
  onClick: () => {
68
73
  f(t.uuid);
69
74
  },
70
- icon: /* @__PURE__ */ a(s, { "aria-hidden": !0 })
71
- }), t.onboarded || e.push({
72
- label: n("deleteCta"),
75
+ icon: /* @__PURE__ */ e(s, { "aria-hidden": !0 })
76
+ }), t.onboarded || n.push({
77
+ label: a("deleteCta"),
73
78
  onClick: () => {
74
- l((o) => new Set(o).add(t.uuid)), g(t.uuid).then(() => {
75
- l((o) => {
79
+ u((o) => new Set(o).add(t.uuid)), g(t.uuid).then(() => {
80
+ u((o) => {
76
81
  const m = new Set(o);
77
82
  return m.delete(t.uuid), m;
78
83
  });
79
84
  });
80
85
  },
81
- icon: /* @__PURE__ */ a(R, { "aria-hidden": !0 })
82
- }), /* @__PURE__ */ a(
83
- G,
86
+ icon: /* @__PURE__ */ e(R, { "aria-hidden": !0 })
87
+ }), /* @__PURE__ */ e(
88
+ y,
84
89
  {
85
- items: e,
86
- triggerLabel: n("hamburgerTitle"),
90
+ items: n,
91
+ triggerLabel: a("hamburgerTitle"),
87
92
  isLoading: I.has(t.uuid)
88
93
  }
89
94
  );
90
95
  },
91
96
  pagination: {
92
97
  handleNextPage: C,
93
- handleFirstPage: S,
98
+ handleFirstPage: E,
94
99
  handleLastPage: N,
95
- handlePreviousPage: E,
100
+ handlePreviousPage: S,
96
101
  handleItemsPerPageChange: L,
97
102
  currentPage: O,
98
103
  totalPages: _
99
104
  },
100
- emptyState: () => /* @__PURE__ */ a(B, { title: n("emptyTableTitle"), description: n("emptyTableDescription"), children: /* @__PURE__ */ c(h, { justifyContent: "center", children: [
101
- /* @__PURE__ */ a(r.Button, { variant: "secondary", onClick: D, children: n("skipCta") }),
102
- /* @__PURE__ */ a(r.Button, { variant: "primary", onClick: u, children: n("addEmployeeCTA") })
105
+ emptyState: () => /* @__PURE__ */ e(B, { title: a("emptyTableTitle"), description: a("emptyTableDescription"), children: /* @__PURE__ */ c(h, { justifyContent: "center", children: [
106
+ /* @__PURE__ */ e(r.Button, { variant: "secondary", onClick: D, children: a("skipCta") }),
107
+ /* @__PURE__ */ e(r.Button, { variant: "primary", onClick: l, children: a("addEmployeeCTA") })
103
108
  ] }) })
104
109
  });
105
110
  return /* @__PURE__ */ c(v, { children: [
106
- d.length > 0 && /* @__PURE__ */ a(h, { children: /* @__PURE__ */ a(r.Button, { variant: "secondary", onClick: u, children: n("addAnotherCta") }) }),
107
- /* @__PURE__ */ a("div", { className: T.container, children: /* @__PURE__ */ a(V, { label: n("employeeListLabel"), ...P }) })
111
+ d.length > 0 && /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(r.Button, { variant: "secondary", onClick: l, children: a("addAnotherCta") }) }),
112
+ /* @__PURE__ */ e("div", { className: k.container, children: /* @__PURE__ */ e(j, { label: a("employeeListLabel"), ...P }) })
108
113
  ] });
109
114
  };
110
115
  export {
111
- at as List
116
+ it as List
112
117
  };
113
118
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../src/components/Employee/EmployeeList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport style from './List.module.scss'\nimport { useEmployeeList } from './useEmployeeList'\nimport { DataView, EmptyData, ActionsLayout, useDataView } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { EmployeeOnboardingStatus, EmployeeSelfOnboardingStatuses } from '@/shared/constants'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\n/**List of employees slot for EmployeeList component */\nexport const List = () => {\n const {\n handleDelete,\n employees,\n handleEdit,\n handleReview,\n handleNew,\n handleCancelSelfOnboarding,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n handleSkip,\n } = useEmployeeList()\n const Components = useComponentContext()\n\n const { t } = useTranslation('Employee.EmployeeList')\n const [deleting, setDeleting] = useState<Set<string>>(new Set())\n const { ...dataViewProps } = useDataView({\n data: employees,\n columns: [\n {\n key: 'name',\n title: t('nameLabel'),\n render: employee => {\n return firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n },\n },\n {\n key: 'status',\n title: t('statusLabel'),\n render: employee => {\n return (\n <Components.Badge status={employee.onboarded ? 'success' : 'warning'}>\n {t(`onboardingStatus.${employee.onboardingStatus ?? 'undefined'}`, {\n ns: 'common',\n })}\n </Components.Badge>\n )\n },\n },\n ],\n itemMenu: employee => {\n const menuItems = []\n\n // Edit item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE ||\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE ||\n employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW ||\n employee.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED\n ) {\n menuItems.push({\n label: t('editCta'),\n onClick: () => {\n handleEdit(employee.uuid, employee.onboardingStatus ?? undefined)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Cancel self onboarding item\n /* @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses */\n if (EmployeeSelfOnboardingStatuses.has(employee.onboarding_status ?? '')) {\n menuItems.push({\n label: t('cancelSelfOnboardingCta'),\n onClick: async () => {\n await handleCancelSelfOnboarding(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Review item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_COMPLETED_BY_EMPLOYEE\n ) {\n menuItems.push({\n label: t('reviewCta'),\n onClick: () => {\n void handleReview(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Delete item\n if (!employee.onboarded) {\n menuItems.push({\n label: t('deleteCta'),\n onClick: () => {\n setDeleting(prev => new Set(prev).add(employee.uuid))\n void handleDelete(employee.uuid).then(() => {\n setDeleting(prev => {\n const newSet = new Set(prev)\n newSet.delete(employee.uuid)\n return newSet\n })\n })\n },\n icon: <TrashCanSvg aria-hidden />,\n })\n }\n\n return (\n <HamburgerMenu\n items={menuItems}\n triggerLabel={t('hamburgerTitle')}\n isLoading={deleting.has(employee.uuid)}\n />\n )\n },\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n },\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Components.Button variant=\"secondary\" onClick={handleSkip}>\n {t('skipCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" onClick={handleNew}>\n {t('addEmployeeCTA')}\n </Components.Button>\n </ActionsLayout>\n </EmptyData>\n ),\n })\n return (\n <>\n {employees.length > 0 && (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleNew}>\n {t('addAnotherCta')}\n </Components.Button>\n </ActionsLayout>\n )}\n <div className={style.container}>\n <DataView label={t('employeeListLabel')} {...dataViewProps} />\n </div>\n </>\n )\n}\n"],"names":["List","handleDelete","employees","handleEdit","handleReview","handleNew","handleCancelSelfOnboarding","handleFirstPage","handlePreviousPage","handleNextPage","handleLastPage","handleItemsPerPageChange","currentPage","totalPages","handleSkip","useEmployeeList","Components","useComponentContext","t","useTranslation","deleting","setDeleting","useState","dataViewProps","useDataView","employee","firstLastName","jsx","menuItems","EmployeeOnboardingStatus","PencilSvg","EmployeeSelfOnboardingStatuses","prev","newSet","TrashCanSvg","HamburgerMenu","EmptyData","jsxs","ActionsLayout","Fragment","style","DataView"],"mappings":";;;;;;;;;;;;;;;AAaO,MAAM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AA,IAEJ;AAAA,IACA,YAAY;AAAA,MACV,gBAAAhB;AAAA,MACA,iBAAAF;AAAA,MACA,gBAAAG;AAAA,MACA,oBAAAF;AAAA,MACA,0BAAAG;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,IACF;AAAA,IACA,YAAY,MACT,gBAAAc,EAAAS,GAAA,EAAU,OAAOlB,EAAE,iBAAiB,GAAG,aAAaA,EAAE,uBAAuB,GAC5E,UAAC,gBAAAmB,EAAAC,GAAA,EAAc,gBAAe,UAC5B,UAAA;AAAA,MAAC,gBAAAX,EAAAX,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASF,GAC7C,UAAEI,EAAA,SAAS,EACd,CAAA;AAAA,MACA,gBAAAS,EAACX,EAAW,QAAX,EAAkB,SAAQ,WAAU,SAASX,GAC3C,UAAEa,EAAA,gBAAgB,EACrB,CAAA;AAAA,IAAA,EAAA,CACF,EACF,CAAA;AAAA,EAAA,CAEH;AACD,SAEK,gBAAAmB,EAAAE,GAAA,EAAA,UAAA;AAAA,IAAArC,EAAU,SAAS,KACjB,gBAAAyB,EAAAW,GAAA,EACC,4BAACtB,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASX,GAC7C,UAAEa,EAAA,eAAe,EACpB,CAAA,GACF;AAAA,IAED,gBAAAS,EAAA,OAAA,EAAI,WAAWa,EAAM,WACpB,UAAA,gBAAAb,EAACc,GAAS,EAAA,OAAOvB,EAAE,mBAAmB,GAAI,GAAGK,GAAe,EAC9D,CAAA;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../src/components/Employee/EmployeeList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport style from './List.module.scss'\nimport { useEmployeeList } from './useEmployeeList'\nimport { DataView, EmptyData, ActionsLayout, useDataView } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { EmployeeOnboardingStatusBadge } from '@/components/Common/OnboardingStatusBadge'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { EmployeeOnboardingStatus, EmployeeSelfOnboardingStatuses } from '@/shared/constants'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\n/**List of employees slot for EmployeeList component */\nexport const List = () => {\n const {\n handleDelete,\n employees,\n handleEdit,\n handleReview,\n handleNew,\n handleCancelSelfOnboarding,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n handleSkip,\n } = useEmployeeList()\n const Components = useComponentContext()\n\n const { t } = useTranslation('Employee.EmployeeList')\n const [deleting, setDeleting] = useState<Set<string>>(new Set())\n const { ...dataViewProps } = useDataView({\n data: employees,\n columns: [\n {\n key: 'name',\n title: t('nameLabel'),\n render: employee => {\n return firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n },\n },\n {\n key: 'status',\n title: t('statusLabel'),\n render: ({ onboarded, onboardingStatus }) => (\n <EmployeeOnboardingStatusBadge\n onboarded={onboarded}\n onboardingStatus={onboardingStatus}\n />\n ),\n },\n ],\n itemMenu: employee => {\n const menuItems = []\n\n // Edit item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE ||\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE ||\n employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW ||\n employee.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED\n ) {\n menuItems.push({\n label: t('editCta'),\n onClick: () => {\n handleEdit(employee.uuid, employee.onboardingStatus ?? undefined)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Cancel self onboarding item\n /* @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses */\n if (EmployeeSelfOnboardingStatuses.has(employee.onboarding_status ?? '')) {\n menuItems.push({\n label: t('cancelSelfOnboardingCta'),\n onClick: async () => {\n await handleCancelSelfOnboarding(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Review item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_COMPLETED_BY_EMPLOYEE\n ) {\n menuItems.push({\n label: t('reviewCta'),\n onClick: () => {\n void handleReview(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Delete item\n if (!employee.onboarded) {\n menuItems.push({\n label: t('deleteCta'),\n onClick: () => {\n setDeleting(prev => new Set(prev).add(employee.uuid))\n void handleDelete(employee.uuid).then(() => {\n setDeleting(prev => {\n const newSet = new Set(prev)\n newSet.delete(employee.uuid)\n return newSet\n })\n })\n },\n icon: <TrashCanSvg aria-hidden />,\n })\n }\n\n return (\n <HamburgerMenu\n items={menuItems}\n triggerLabel={t('hamburgerTitle')}\n isLoading={deleting.has(employee.uuid)}\n />\n )\n },\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n },\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Components.Button variant=\"secondary\" onClick={handleSkip}>\n {t('skipCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" onClick={handleNew}>\n {t('addEmployeeCTA')}\n </Components.Button>\n </ActionsLayout>\n </EmptyData>\n ),\n })\n return (\n <>\n {employees.length > 0 && (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleNew}>\n {t('addAnotherCta')}\n </Components.Button>\n </ActionsLayout>\n )}\n <div className={style.container}>\n <DataView label={t('employeeListLabel')} {...dataViewProps} />\n </div>\n </>\n )\n}\n"],"names":["List","handleDelete","employees","handleEdit","handleReview","handleNew","handleCancelSelfOnboarding","handleFirstPage","handlePreviousPage","handleNextPage","handleLastPage","handleItemsPerPageChange","currentPage","totalPages","handleSkip","useEmployeeList","Components","useComponentContext","t","useTranslation","deleting","setDeleting","useState","dataViewProps","useDataView","employee","firstLastName","onboarded","onboardingStatus","jsx","EmployeeOnboardingStatusBadge","menuItems","EmployeeOnboardingStatus","PencilSvg","EmployeeSelfOnboardingStatuses","prev","newSet","TrashCanSvg","HamburgerMenu","EmptyData","jsxs","ActionsLayout","Fragment","style","DataView"],"mappings":";;;;;;;;;;;;;;;;AAcO,MAAMA,KAAO,MAAM;AAClB,QAAA;AAAA,IACJ,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,MACEC,EAAgB,GACdC,IAAaC,EAAoB,GAEjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,uBAAuB,GAC9C,CAACC,GAAUC,CAAW,IAAIC,EAAsB,oBAAI,KAAK,GACzD,EAAE,GAAGC,EAAc,IAAIC,EAAY;AAAA,IACvC,MAAMtB;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAOgB,EAAE,WAAW;AAAA,QACpB,QAAQ,CAAYO,MACXC,EAAc;AAAA,UACnB,YAAYD,EAAS;AAAA,UACrB,WAAWA,EAAS;AAAA,QAAA,CACrB;AAAA,MAEL;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,OAAOP,EAAE,aAAa;AAAA,QACtB,QAAQ,CAAC,EAAE,WAAAS,GAAW,kBAAAC,EACpB,MAAA,gBAAAC;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,WAAAH;AAAA,YACA,kBAAAC;AAAA,UAAA;AAAA,QA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A;AAAA,EAAA,GACF;AAEJ;"}
@@ -1,71 +1,76 @@
1
- import { jsx as e, jsxs as m, Fragment as h } from "react/jsx-runtime";
2
- import { useTranslation as y } from "react-i18next";
3
- import C from "classnames";
4
- import { useEmployeesGetSuspense as I } from "@gusto/embedded-api/react-query/employeesGet";
5
- import { useEmployeesGetOnboardingStatusSuspense as D } from "@gusto/embedded-api/react-query/employeesGetOnboardingStatus";
6
- import i from "./OnboardingSummary.module.scss.js";
7
- import { BaseComponent as v } from "../../Base/Base.js";
8
- import { useBase as A } from "../../Base/useBase.js";
1
+ import { jsx as e, jsxs as s, Fragment as g } from "react/jsx-runtime";
2
+ import { useTranslation as b } from "react-i18next";
3
+ import A from "classnames";
4
+ import { useEmployeesGetSuspense as B } from "@gusto/embedded-api/react-query/employeesGet";
5
+ import { useEmployeesGetOnboardingStatusSuspense as L } from "@gusto/embedded-api/react-query/employeesGetOnboardingStatus";
6
+ import y from "dompurify";
7
+ import { useMemo as S } from "react";
8
+ import r from "./OnboardingSummary.module.scss.js";
9
+ import { BaseComponent as P } from "../../Base/Base.js";
10
+ import { useBase as R } from "../../Base/useBase.js";
9
11
  import { Flex as d } from "../../Common/Flex/Flex.js";
10
- import { ActionsLayout as g } from "../../Common/ActionsLayout/ActionsLayout.js";
11
- import { useComponentContext as B } from "../../../contexts/ComponentAdapter/useComponentContext.js";
12
- import { useI18n as R, useComponentDictionary as T } from "../../../i18n/I18n.js";
13
- import { componentEvents as f, EmployeeOnboardingStatus as S } from "../../../shared/constants.js";
14
- import _ from "../../../assets/icons/success_check.svg.js";
15
- import w from "../../../assets/icons/unchecked_circular.svg.js";
16
- import { useFlow as G } from "../../Flow/useFlow.js";
17
- function L(n) {
18
- return R("Employee.OnboardingSummary"), T("Employee.OnboardingSummary", n.dictionary), /* @__PURE__ */ e(v, { ...n, children: /* @__PURE__ */ e(P, { ...n, children: n.children }) });
12
+ import { ActionsLayout as E } from "../../Common/ActionsLayout/ActionsLayout.js";
13
+ import { useComponentContext as T } from "../../../contexts/ComponentAdapter/useComponentContext.js";
14
+ import { useI18n as _, useComponentDictionary as w } from "../../../i18n/I18n.js";
15
+ import { componentEvents as N, EmployeeOnboardingStatus as O } from "../../../shared/constants.js";
16
+ import F from "../../../assets/icons/success_check.svg.js";
17
+ import G from "../../../assets/icons/unchecked_circular.svg.js";
18
+ import { useFlow as M } from "../../Flow/useFlow.js";
19
+ function j(n) {
20
+ return _("Employee.OnboardingSummary"), w("Employee.OnboardingSummary", n.dictionary), /* @__PURE__ */ e(P, { ...n, children: /* @__PURE__ */ e(k, { ...n, children: n.children }) });
19
21
  }
20
- const P = ({ employeeId: n, className: c, isAdmin: s = !1 }) => {
21
- const { onEvent: a } = A(), { t } = y("Employee.OnboardingSummary"), o = B(), {
22
- data: { employee: E }
23
- } = I({ employeeId: n }), { firstName: O, lastName: b } = E, { data: N } = D({ employeeId: n }), { onboardingStatus: u, onboardingSteps: l } = N.employeeOnboardingStatus, x = l?.length && l.findIndex((r) => r.required && !r.completed) > -1, p = u === S.ONBOARDING_COMPLETED || !x && u === S.SELF_ONBOARDING_PENDING_INVITE;
24
- return /* @__PURE__ */ e("section", { className: c, children: /* @__PURE__ */ m(d, { flexDirection: "column", gap: 32, children: [
25
- /* @__PURE__ */ e(d, { alignItems: "center", flexDirection: "column", gap: 8, children: s ? p ? /* @__PURE__ */ m(h, { children: [
26
- /* @__PURE__ */ e(o.Heading, { as: "h2", textAlign: "center", children: t("onboardedAdminSubtitle", { name: `${O} ${b}` }) }),
27
- /* @__PURE__ */ e(o.Text, { className: i.description, children: t("onboardedAdminDescription") })
28
- ] }) : /* @__PURE__ */ m(d, { flexDirection: "column", alignItems: "flex-start", gap: 8, children: [
22
+ const k = ({ employeeId: n, className: c, isAdmin: m = !1 }) => {
23
+ const { onEvent: a } = R(), { t } = b("Employee.OnboardingSummary"), o = T(), {
24
+ data: { employee: x }
25
+ } = B({ employeeId: n }), { firstName: u, lastName: p } = x, { data: C } = L({ employeeId: n }), { onboardingStatus: h, onboardingSteps: l } = C.employeeOnboardingStatus, I = l?.length && l.findIndex((i) => i.required && !i.completed) > -1, f = h === O.ONBOARDING_COMPLETED || !I && h === O.SELF_ONBOARDING_PENDING_INVITE, D = S(() => y.sanitize(u), [u]), v = S(() => y.sanitize(p), [p]);
26
+ return /* @__PURE__ */ e("section", { className: c, children: /* @__PURE__ */ s(d, { flexDirection: "column", gap: 32, children: [
27
+ /* @__PURE__ */ e(d, { alignItems: "center", flexDirection: "column", gap: 8, children: m ? f ? /* @__PURE__ */ s(g, { children: [
28
+ /* @__PURE__ */ e(o.Heading, { as: "h2", textAlign: "center", children: t("onboardedAdminSubtitle", {
29
+ name: `${D} ${v}`,
30
+ interpolation: { escapeValue: !1 }
31
+ }) }),
32
+ /* @__PURE__ */ e(o.Text, { className: r.description, children: t("onboardedAdminDescription") })
33
+ ] }) : /* @__PURE__ */ s(d, { flexDirection: "column", alignItems: "flex-start", gap: 8, children: [
29
34
  /* @__PURE__ */ e(o.Heading, { as: "h2", children: t("missingRequirementsSubtitle") }),
30
35
  /* @__PURE__ */ e(o.Text, { children: t("missingRequirementsDescription") }),
31
- /* @__PURE__ */ e("ul", { className: i.list, children: l?.sort((r, F) => r.completed ? -1 : 1).map((r) => /* @__PURE__ */ m("li", { className: i.listItem, children: [
32
- r.completed ? /* @__PURE__ */ e(_, { width: 24, height: 24, className: i.listItemIcon }) : /* @__PURE__ */ e(
33
- w,
36
+ /* @__PURE__ */ e("ul", { className: r.list, children: l?.sort((i, q) => i.completed ? -1 : 1).map((i) => /* @__PURE__ */ s("li", { className: r.listItem, children: [
37
+ i.completed ? /* @__PURE__ */ e(F, { width: 24, height: 24, className: r.listItemIcon }) : /* @__PURE__ */ e(
38
+ G,
34
39
  {
35
40
  width: 24,
36
41
  height: 24,
37
- className: C(i.listItemIcon, i.incomplete)
42
+ className: A(r.listItemIcon, r.incomplete)
38
43
  }
39
44
  ),
40
- /* @__PURE__ */ e(o.Heading, { as: "h4", children: t(`steps.${r.id}`, r.title) })
41
- ] }, r.id)) })
42
- ] }) : /* @__PURE__ */ m(h, { children: [
45
+ /* @__PURE__ */ e(o.Heading, { as: "h4", children: t(`steps.${i.id}`, i.title) })
46
+ ] }, i.id)) })
47
+ ] }) : /* @__PURE__ */ s(g, { children: [
43
48
  /* @__PURE__ */ e(o.Heading, { as: "h2", textAlign: "center", children: t("onboardedSelfSubtitle") }),
44
- /* @__PURE__ */ e(o.Text, { className: i.description, children: t("onboardedSelfDescription") }),
45
- /* @__PURE__ */ e(g, { justifyContent: p ? "center" : "start", children: /* @__PURE__ */ e(
49
+ /* @__PURE__ */ e(o.Text, { className: r.description, children: t("onboardedSelfDescription") }),
50
+ /* @__PURE__ */ e(E, { justifyContent: f ? "center" : "start", children: /* @__PURE__ */ e(
46
51
  o.Button,
47
52
  {
48
53
  variant: "secondary",
49
54
  onClick: () => {
50
- a(f.EMPLOYEE_ONBOARDING_DONE);
55
+ a(N.EMPLOYEE_ONBOARDING_DONE);
51
56
  },
52
57
  children: t("doneCta")
53
58
  }
54
59
  ) })
55
60
  ] }) }),
56
- s && /* @__PURE__ */ e(g, { justifyContent: "center", children: /* @__PURE__ */ e(
61
+ m && /* @__PURE__ */ e(E, { justifyContent: "center", children: /* @__PURE__ */ e(
57
62
  o.Button,
58
63
  {
59
64
  variant: "secondary",
60
65
  onClick: () => {
61
- a(f.EMPLOYEES_LIST);
66
+ a(N.EMPLOYEES_LIST);
62
67
  },
63
68
  children: t("doneCta")
64
69
  }
65
70
  ) })
66
71
  ] }) });
67
- }, ee = () => {
68
- const { employeeId: n, onEvent: c, isAdmin: s } = G(), { t: a } = y("common");
72
+ }, se = () => {
73
+ const { employeeId: n, onEvent: c, isAdmin: m } = M(), { t: a } = b("common");
69
74
  if (!n)
70
75
  throw new Error(
71
76
  a("errors.missingParamsOrContext", {
@@ -74,10 +79,10 @@ const P = ({ employeeId: n, className: c, isAdmin: s = !1 }) => {
74
79
  provider: "FlowProvider"
75
80
  })
76
81
  );
77
- return /* @__PURE__ */ e(L, { employeeId: n, onEvent: c, isAdmin: s });
82
+ return /* @__PURE__ */ e(j, { employeeId: n, onEvent: c, isAdmin: m });
78
83
  };
79
84
  export {
80
- L as OnboardingSummary,
81
- ee as OnboardingSummaryContextual
85
+ j as OnboardingSummary,
86
+ se as OnboardingSummaryContextual
82
87
  };
83
88
  //# sourceMappingURL=OnboardingSummary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OnboardingSummary.js","sources":["../../../../src/components/Employee/OnboardingSummary/OnboardingSummary.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useEmployeesGetOnboardingStatusSuspense } from '@gusto/embedded-api/react-query/employeesGetOnboardingStatus'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport styles from './OnboardingSummary.module.scss'\nimport {\n BaseComponent,\n useBase,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { Flex, ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, EmployeeOnboardingStatus } from '@/shared/constants'\nimport SuccessCheck from '@/assets/icons/success_check.svg?react'\nimport UncheckedCircular from '@/assets/icons/unchecked_circular.svg?react'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface SummaryProps extends CommonComponentInterface<'Employee.OnboardingSummary'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function OnboardingSummary(props: SummaryProps & BaseComponentInterface) {\n useI18n('Employee.OnboardingSummary')\n useComponentDictionary('Employee.OnboardingSummary', props.dictionary)\n\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, className, isAdmin = false }: SummaryProps) => {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.OnboardingSummary')\n const Components = useComponentContext()\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n const { firstName, lastName } = employee!\n\n const { data } = useEmployeesGetOnboardingStatusSuspense({ employeeId })\n const { onboardingStatus, onboardingSteps } = data.employeeOnboardingStatus!\n\n const hasMissingRequirements =\n onboardingSteps?.length &&\n onboardingSteps.findIndex(step => step.required && !step.completed) > -1\n\n const isOnboardingCompleted =\n onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n (!hasMissingRequirements &&\n onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE)\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n <Flex alignItems=\"center\" flexDirection=\"column\" gap={8}>\n {isAdmin ? (\n isOnboardingCompleted ? (\n <>\n <Components.Heading as=\"h2\" textAlign=\"center\">\n {t('onboardedAdminSubtitle', { name: `${firstName} ${lastName}` })}\n </Components.Heading>\n <Components.Text className={styles.description}>\n {t('onboardedAdminDescription')}\n </Components.Text>\n </>\n ) : (\n <Flex flexDirection=\"column\" alignItems=\"flex-start\" gap={8}>\n <Components.Heading as=\"h2\">{t('missingRequirementsSubtitle')}</Components.Heading>\n <Components.Text>{t('missingRequirementsDescription')}</Components.Text>\n <ul className={styles.list}>\n {onboardingSteps\n ?.sort((a, b) => (a.completed ? -1 : 1))\n .map(step => {\n return (\n <li key={step.id} className={styles.listItem}>\n {step.completed ? (\n <SuccessCheck width={24} height={24} className={styles.listItemIcon} />\n ) : (\n <UncheckedCircular\n width={24}\n height={24}\n className={classNames(styles.listItemIcon, styles.incomplete)}\n />\n )}\n <Components.Heading as=\"h4\">\n {/* @ts-expect-error: id has typeof keyof steps */}\n {t(`steps.${step.id}`, step.title)}\n </Components.Heading>\n </li>\n )\n })}\n </ul>\n </Flex>\n )\n ) : (\n <>\n <Components.Heading as=\"h2\" textAlign=\"center\">\n {t('onboardedSelfSubtitle')}\n </Components.Heading>\n <Components.Text className={styles.description}>\n {t('onboardedSelfDescription')}\n </Components.Text>\n <ActionsLayout justifyContent={isOnboardingCompleted ? 'center' : 'start'}>\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_DONE)\n }}\n >\n {t('doneCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n\n {isAdmin && (\n <ActionsLayout justifyContent={'center'}>\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEES_LIST)\n }}\n >\n {t('doneCta')}\n </Components.Button>\n </ActionsLayout>\n )}\n </Flex>\n </section>\n )\n}\n\nexport const OnboardingSummaryContextual = () => {\n const { employeeId, onEvent, isAdmin } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Summary',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <OnboardingSummary employeeId={employeeId} onEvent={onEvent} isAdmin={isAdmin} />\n}\n"],"names":["OnboardingSummary","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","employeeId","className","isAdmin","onEvent","useBase","useTranslation","Components","useComponentContext","employee","useEmployeesGetSuspense","firstName","lastName","data","useEmployeesGetOnboardingStatusSuspense","onboardingStatus","onboardingSteps","hasMissingRequirements","step","isOnboardingCompleted","EmployeeOnboardingStatus","jsxs","Flex","Fragment","styles","a","b","SuccessCheck","UncheckedCircular","classNames","ActionsLayout","componentEvents","OnboardingSummaryContextual","useFlow","t"],"mappings":";;;;;;;;;;;;;;;;AA0BO,SAASA,EAAkBC,GAA8C;AAC9E,SAAAC,EAAQ,4BAA4B,GACbC,EAAA,8BAA8BF,EAAM,UAAU,GAGnE,gBAAAG,EAACC,GAAe,EAAA,GAAGJ,GACjB,UAAA,gBAAAG,EAACE,KAAM,GAAGL,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ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A,EAAA,CACF,EAEJ,CAAA;AAAA,IAEC5B,KACC,gBAAAL,EAACgC,GAAc,EAAA,gBAAgB,UAC7B,UAAA,gBAAAhC;AAAA,MAACS,EAAW;AAAA,MAAX;AAAA,QACC,SAAQ;AAAA,QACR,SAAS,MAAM;AACb,UAAAH,EAAQ2B,EAAgB,cAAc;AAAA,QACxC;AAAA,QAEC,YAAE,SAAS;AAAA,MAAA;AAAA,IAAA,EAEhB,CAAA;AAAA,EAAA,EAAA,CAEJ,EACF,CAAA;AAEJ,GAEaC,KAA8B,MAAM;AAC/C,QAAM,EAAE,YAAA/B,GAAY,SAAAG,GAAS,SAAAD,EAAA,IAAY8B,EAAoC,GACvE,EAAE,GAAAC,EAAA,IAAM5B,EAAe,QAAQ;AAErC,MAAI,CAACL;AACH,UAAM,IAAI;AAAA,MACRiC,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEF,SAAQ,gBAAApC,EAAAJ,GAAA,EAAkB,YAAAO,GAAwB,SAAAG,GAAkB,SAAAD,EAAkB,CAAA;AACxF;"}
1
+ {"version":3,"file":"OnboardingSummary.js","sources":["../../../../src/components/Employee/OnboardingSummary/OnboardingSummary.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useEmployeesGetOnboardingStatusSuspense } from '@gusto/embedded-api/react-query/employeesGetOnboardingStatus'\nimport DOMPurify from 'dompurify'\nimport { useMemo } from 'react'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport styles from './OnboardingSummary.module.scss'\nimport {\n BaseComponent,\n useBase,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { Flex, ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, EmployeeOnboardingStatus } from '@/shared/constants'\nimport SuccessCheck from '@/assets/icons/success_check.svg?react'\nimport UncheckedCircular from '@/assets/icons/unchecked_circular.svg?react'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface SummaryProps extends CommonComponentInterface<'Employee.OnboardingSummary'> {\n employeeId: string\n isAdmin?: boolean\n}\n\nexport function OnboardingSummary(props: SummaryProps & BaseComponentInterface) {\n useI18n('Employee.OnboardingSummary')\n useComponentDictionary('Employee.OnboardingSummary', props.dictionary)\n\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, className, isAdmin = false }: SummaryProps) => {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.OnboardingSummary')\n const Components = useComponentContext()\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n const { firstName, lastName } = employee!\n\n const { data } = useEmployeesGetOnboardingStatusSuspense({ employeeId })\n const { onboardingStatus, onboardingSteps } = data.employeeOnboardingStatus!\n\n const hasMissingRequirements =\n onboardingSteps?.length &&\n onboardingSteps.findIndex(step => step.required && !step.completed) > -1\n\n const isOnboardingCompleted =\n onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n (!hasMissingRequirements &&\n onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE)\n\n const sanitizedFirstName = useMemo(() => DOMPurify.sanitize(firstName), [firstName])\n const sanitizedLastName = useMemo(() => DOMPurify.sanitize(lastName), [lastName])\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n <Flex alignItems=\"center\" flexDirection=\"column\" gap={8}>\n {isAdmin ? (\n isOnboardingCompleted ? (\n <>\n <Components.Heading as=\"h2\" textAlign=\"center\">\n {t('onboardedAdminSubtitle', {\n name: `${sanitizedFirstName} ${sanitizedLastName}`,\n interpolation: { escapeValue: false },\n })}\n </Components.Heading>\n <Components.Text className={styles.description}>\n {t('onboardedAdminDescription')}\n </Components.Text>\n </>\n ) : (\n <Flex flexDirection=\"column\" alignItems=\"flex-start\" gap={8}>\n <Components.Heading as=\"h2\">{t('missingRequirementsSubtitle')}</Components.Heading>\n <Components.Text>{t('missingRequirementsDescription')}</Components.Text>\n <ul className={styles.list}>\n {onboardingSteps\n ?.sort((a, b) => (a.completed ? -1 : 1))\n .map(step => {\n return (\n <li key={step.id} className={styles.listItem}>\n {step.completed ? (\n <SuccessCheck width={24} height={24} className={styles.listItemIcon} />\n ) : (\n <UncheckedCircular\n width={24}\n height={24}\n className={classNames(styles.listItemIcon, styles.incomplete)}\n />\n )}\n <Components.Heading as=\"h4\">\n {/* @ts-expect-error: id has typeof keyof steps */}\n {t(`steps.${step.id}`, step.title)}\n </Components.Heading>\n </li>\n )\n })}\n </ul>\n </Flex>\n )\n ) : (\n <>\n <Components.Heading as=\"h2\" textAlign=\"center\">\n {t('onboardedSelfSubtitle')}\n </Components.Heading>\n <Components.Text className={styles.description}>\n {t('onboardedSelfDescription')}\n </Components.Text>\n <ActionsLayout justifyContent={isOnboardingCompleted ? 'center' : 'start'}>\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_DONE)\n }}\n >\n {t('doneCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n\n {isAdmin && (\n <ActionsLayout justifyContent={'center'}>\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEES_LIST)\n }}\n >\n {t('doneCta')}\n </Components.Button>\n </ActionsLayout>\n )}\n </Flex>\n </section>\n )\n}\n\nexport const OnboardingSummaryContextual = () => {\n const { employeeId, onEvent, isAdmin } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Summary',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <OnboardingSummary employeeId={employeeId} onEvent={onEvent} isAdmin={isAdmin} />\n}\n"],"names":["OnboardingSummary","props","useI18n","useComponentDictionary","jsx","BaseComponent","Root","employeeId","className","isAdmin","onEvent","useBase","useTranslation","Components","useComponentContext","employee","useEmployeesGetSuspense","firstName","lastName","data","useEmployeesGetOnboardingStatusSuspense","onboardingStatus","onboardingSteps","hasMissingRequirements","step","isOnboardingCompleted","EmployeeOnboardingStatus","sanitizedFirstName","useMemo","DOMPurify","sanitizedLastName","jsxs","Flex","Fragment","styles","a","b","SuccessCheck","UncheckedCircular","classNames","ActionsLayout","componentEvents","OnboardingSummaryContextual","useFlow","t"],"mappings":";;;;;;;;;;;;;;;;;;AA4BO,SAASA,EAAkBC,GAA8C;AAC9E,SAAAC,EAAQ,4BAA4B,GACbC,EAAA,8BAA8BF,EAAM,UAAU,GAGnE,gBAAAG,EAACC,GAAe,EAAA,GAAGJ,GACjB,UAAA,gBAAAG,EAACE,KAAM,GAAGL,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,MAAMK,IAAO,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,SAAAC,IAAU,SAA0B;AACnE,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAQ,GACtB,EAAE,EAAA,IAAMC,EAAe,4BAA4B,GACnDC,IAAaC,EAAoB,GAEjC;AAAA,IACJ,MAAM,EAAE,UAAAC,EAAS;AAAA,EAAA,IACfC,EAAwB,EAAE,YAAAT,GAAY,GACpC,EAAE,WAAAU,GAAW,UAAAC,EAAA,IAAaH,GAE1B,EAAE,MAAAI,EAAK,IAAIC,EAAwC,EAAE,YAAAb,GAAY,GACjE,EAAE,kBAAAc,GAAkB,iBAAAC,EAAgB,IAAIH,EAAK,0BAE7CI,IACJD,GAAiB,UACjBA,EAAgB,UAAU,CAAQE,MAAAA,EAAK,YAAY,CAACA,EAAK,SAAS,IAAI,IAElEC,IACJJ,MAAqBK,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AAE,YAAAnC,GAAY,SAAAG,GAAS,SAAAD,EAAA,IAAYkC,EAAoC,GACvE,EAAE,GAAAC,EAAA,IAAMhC,EAAe,QAAQ;AAErC,MAAI,CAACL;AACH,UAAM,IAAI;AAAA,MACRqC,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MACX,CAAA;AAAA,IACH;AAEF,SAAQ,gBAAAxC,EAAAJ,GAAA,EAAkB,YAAAO,GAAwB,SAAAG,GAAkB,SAAAD,EAAkB,CAAA;AACxF;"}
@@ -2,7 +2,7 @@ import { jsxs as i, Fragment as u, jsx as r } from "react/jsx-runtime";
2
2
  import { useFormContext as m } from "react-hook-form";
3
3
  import { useTranslation as c } from "react-i18next";
4
4
  import { usePaymentMethod as s } from "./usePaymentMethod.js";
5
- import { PAYMENT_METHODS as l } from "./Constants.js";
5
+ import { PAYMENT_METHODS as l } from "../../../shared/constants.js";
6
6
  import { TextInputField as o } from "../../Common/Fields/TextInputField/TextInputField.js";
7
7
  import { RadioGroupField as p } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
8
8
  const h = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"BankAccountEdit.js","sources":["../../../../src/components/Employee/PaymentMethod/BankAccountEdit.tsx"],"sourcesContent":["import { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { BankAccountInputs } from './BankAccount'\nimport { usePaymentMethod } from './usePaymentMethod'\nimport { PAYMENT_METHODS } from './Constants'\nimport { RadioGroupField, TextInputField } from '@/components/Common'\n\nexport const BankAccountForm = () => {\n const { mode, watchedType } = usePaymentMethod()\n const { t } = useTranslation('Employee.PaymentMethod')\n const { setValue } = useFormContext<BankAccountInputs>()\n\n if ((mode !== 'ADD' && mode !== 'INITIAL') || watchedType === PAYMENT_METHODS.check) {\n return\n }\n //Used by form schema to determine variant\n setValue('hasBankPayload', true)\n\n return (\n <>\n <TextInputField\n name=\"name\"\n isRequired\n label={t('nameLabel')}\n errorMessage={t('validations.accountName')}\n />\n\n <TextInputField\n name=\"routingNumber\"\n label={t('routingNumberLabel')}\n isRequired\n description={t('routingNumberDescription')}\n errorMessage={t('validations.routingNumber')}\n />\n\n <TextInputField\n name=\"accountNumber\"\n label={t('accountNumberLabel')}\n errorMessage={t('validations.accountNumber')}\n isRequired\n />\n\n <RadioGroupField\n name=\"accountType\"\n label={t('accountTypeLabel')}\n options={[\n { value: 'Checking', label: t('accountTypeChecking') },\n { value: 'Savings', label: t('accountTypeSavings') },\n ]}\n />\n </>\n )\n}\n"],"names":["BankAccountForm","mode","watchedType","usePaymentMethod","t","useTranslation","setValue","useFormContext","PAYMENT_METHODS","jsxs","Fragment","jsx","TextInputField","RadioGroupField"],"mappings":";;;;;;;AAOO,MAAMA,IAAkB,MAAM;AACnC,QAAM,EAAE,MAAAC,GAAM,aAAAC,EAAY,IAAIC,EAAiB,GACzC,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/C,EAAE,UAAAC,EAAS,IAAIC,EAAkC;AAEvD,MAAK,EAAAN,MAAS,SAASA,MAAS,aAAcC,MAAgBM,EAAgB;AAI9E,WAAAF,EAAS,kBAAkB,EAAI,GAI3B,gBAAAG,EAAAC,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,YAAU;AAAA,UACV,OAAOR,EAAE,WAAW;AAAA,UACpB,cAAcA,EAAE,yBAAyB;AAAA,QAAA;AAAA,MAC3C;AAAA,MAEA,gBAAAO;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOR,EAAE,oBAAoB;AAAA,UAC7B,YAAU;AAAA,UACV,aAAaA,EAAE,0BAA0B;AAAA,UACzC,cAAcA,EAAE,2BAA2B;AAAA,QAAA;AAAA,MAC7C;AAAA,MAEA,gBAAAO;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOR,EAAE,oBAAoB;AAAA,UAC7B,cAAcA,EAAE,2BAA2B;AAAA,UAC3C,YAAU;AAAA,QAAA;AAAA,MACZ;AAAA,MAEA,gBAAAO;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOT,EAAE,kBAAkB;AAAA,UAC3B,SAAS;AAAA,YACP,EAAE,OAAO,YAAY,OAAOA,EAAE,qBAAqB,EAAE;AAAA,YACrD,EAAE,OAAO,WAAW,OAAOA,EAAE,oBAAoB,EAAE;AAAA,UAAA;AAAA,QACrD;AAAA,MAAA;AAAA,IACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"BankAccountEdit.js","sources":["../../../../src/components/Employee/PaymentMethod/BankAccountEdit.tsx"],"sourcesContent":["import { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { BankAccountInputs } from './BankAccount'\nimport { usePaymentMethod } from './usePaymentMethod'\nimport { RadioGroupField, TextInputField } from '@/components/Common'\nimport { PAYMENT_METHODS } from '@/shared/constants'\n\nexport const BankAccountForm = () => {\n const { mode, watchedType } = usePaymentMethod()\n const { t } = useTranslation('Employee.PaymentMethod')\n const { setValue } = useFormContext<BankAccountInputs>()\n\n if ((mode !== 'ADD' && mode !== 'INITIAL') || watchedType === PAYMENT_METHODS.check) {\n return\n }\n //Used by form schema to determine variant\n setValue('hasBankPayload', true)\n\n return (\n <>\n <TextInputField\n name=\"name\"\n isRequired\n label={t('nameLabel')}\n errorMessage={t('validations.accountName')}\n />\n\n <TextInputField\n name=\"routingNumber\"\n label={t('routingNumberLabel')}\n isRequired\n description={t('routingNumberDescription')}\n errorMessage={t('validations.routingNumber')}\n />\n\n <TextInputField\n name=\"accountNumber\"\n label={t('accountNumberLabel')}\n errorMessage={t('validations.accountNumber')}\n isRequired\n />\n\n <RadioGroupField\n name=\"accountType\"\n label={t('accountTypeLabel')}\n options={[\n { value: 'Checking', label: t('accountTypeChecking') },\n { value: 'Savings', label: t('accountTypeSavings') },\n ]}\n />\n </>\n )\n}\n"],"names":["BankAccountForm","mode","watchedType","usePaymentMethod","t","useTranslation","setValue","useFormContext","PAYMENT_METHODS","jsxs","Fragment","jsx","TextInputField","RadioGroupField"],"mappings":";;;;;;;AAOO,MAAMA,IAAkB,MAAM;AACnC,QAAM,EAAE,MAAAC,GAAM,aAAAC,EAAY,IAAIC,EAAiB,GACzC,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/C,EAAE,UAAAC,EAAS,IAAIC,EAAkC;AAEvD,MAAK,EAAAN,MAAS,SAASA,MAAS,aAAcC,MAAgBM,EAAgB;AAI9E,WAAAF,EAAS,kBAAkB,EAAI,GAI3B,gBAAAG,EAAAC,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,YAAU;AAAA,UACV,OAAOR,EAAE,WAAW;AAAA,UACpB,cAAcA,EAAE,yBAAyB;AAAA,QAAA;AAAA,MAC3C;AAAA,MAEA,gBAAAO;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOR,EAAE,oBAAoB;AAAA,UAC7B,YAAU;AAAA,UACV,aAAaA,EAAE,0BAA0B;AAAA,UACzC,cAAcA,EAAE,2BAA2B;AAAA,QAAA;AAAA,MAC7C;AAAA,MAEA,gBAAAO;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOR,EAAE,oBAAoB;AAAA,UAC7B,cAAcA,EAAE,2BAA2B;AAAA,UAC3C,YAAU;AAAA,QAAA;AAAA,MACZ;AAAA,MAEA,gBAAAO;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOT,EAAE,kBAAkB;AAAA,UAC3B,SAAS;AAAA,YACP,EAAE,OAAO,YAAY,OAAOA,EAAE,qBAAqB,EAAE;AAAA,YACrD,EAAE,OAAO,WAAW,OAAOA,EAAE,oBAAoB,EAAE;AAAA,UAAA;AAAA,QACrD;AAAA,MAAA;AAAA,IACF,GACF;AAEJ;"}
@@ -11,7 +11,6 @@ import { useCallback as X, useState as Z, useMemo as k, useEffect as S } from "r
11
11
  import { useForm as $, FormProvider as tt } from "react-hook-form";
12
12
  import { useTranslation as et } from "react-i18next";
13
13
  import { CombinedSchema as ot, PaymentMethodProvider as nt } from "./usePaymentMethod.js";
14
- import { SPLIT_BY as b, PAYMENT_METHODS as N } from "./Constants.js";
15
14
  import { BaseComponent as it } from "../../Base/Base.js";
16
15
  import { useBase as st } from "../../Base/useBase.js";
17
16
  import { Form as rt } from "../../Common/Form/Form.js";
@@ -22,7 +21,7 @@ import { Head as ut } from "./Head.js";
22
21
  import { PaymentTypeForm as pt } from "./PaymentTypeForm.js";
23
22
  import { Split as lt } from "./Split.js";
24
23
  import { useI18n as dt, useComponentDictionary as yt } from "../../../i18n/I18n.js";
25
- import { componentEvents as A } from "../../../shared/constants.js";
24
+ import { SPLIT_BY as b, componentEvents as A, PAYMENT_METHODS as N } from "../../../shared/constants.js";
26
25
  import { useFlow as ht } from "../../Flow/useFlow.js";
27
26
  function At(o) {
28
27
  return /* @__PURE__ */ n(it, { ...o, children: /* @__PURE__ */ n(ft, { ...o, children: o.children }) });
@@ -155,7 +154,7 @@ const ft = ({ employeeId: o, className: f, dictionary: E }) => {
155
154
  ] }) })
156
155
  }
157
156
  ) });
158
- }, Vt = () => {
157
+ }, Gt = () => {
159
158
  const { employeeId: o, onEvent: f } = ht(), { t: E } = et("common");
160
159
  if (!o)
161
160
  throw new Error(
@@ -169,6 +168,6 @@ const ft = ({ employeeId: o, className: f, dictionary: E }) => {
169
168
  };
170
169
  export {
171
170
  At as PaymentMethod,
172
- Vt as PaymentMethodContextual
171
+ Gt as PaymentMethodContextual
173
172
  };
174
173
  //# sourceMappingURL=PaymentMethod.js.map