@gusto/embedded-react-sdk 0.57.1 → 0.57.2
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 +13 -0
- package/dist/components/Base/Base.js +2 -3
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -8
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -10
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -6
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -8
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +10 -11
- package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -8
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -6
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -12
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +11 -13
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -7
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -6
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -9
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +8 -11
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +5 -7
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -9
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +10 -12
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +8 -10
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -6
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +6 -8
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +11 -13
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -6
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -6
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleForm.js +66 -62
- package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleForm.module.scss.js +2 -2
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js +80 -68
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js +11 -13
- package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js +49 -44
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -7
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -6
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -8
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -6
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Contractor/Compensation/management/CompensationCard/CompensationCard.js +16 -17
- package/dist/components/Contractor/Compensation/management/CompensationCard/CompensationCard.js.map +1 -1
- package/dist/components/Contractor/Documents/management/DocumentsCard/DocumentsCard.js +8 -9
- package/dist/components/Contractor/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/ContractorBankAccountFormBody/ContractorBankAccountFormBody.js +6 -8
- package/dist/components/Contractor/PaymentMethod/shared/ContractorBankAccountFormBody/ContractorBankAccountFormBody.js.map +1 -1
- package/dist/components/Contractor/Profile/management/ProfileCard/ProfileCard.js +26 -27
- package/dist/components/Contractor/Profile/management/ProfileCard/ProfileCard.js.map +1 -1
- package/dist/components/Contractor/Profile/management/ProfileEditForm.js +11 -11
- package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js +12 -13
- package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js +12 -13
- package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js +6 -8
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -6
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js +3 -4
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js +3 -4
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js +22 -24
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js.map +1 -1
- package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js +8 -9
- package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js.map +1 -1
- package/dist/components/Employee/Profile/management/ProfileCard/ProfileCard.js +14 -15
- package/dist/components/Employee/Profile/management/ProfileCard/ProfileCard.js.map +1 -1
- package/dist/components/Employee/Profile/management/ProfileEditForm.js +1 -1
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +1 -1
- package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js +7 -8
- package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js.map +1 -1
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js +7 -8
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +56 -54
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +14 -16
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +6 -8
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +9 -11
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +74 -88
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +44 -46
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +63 -61
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js +14 -13
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js.map +1 -1
- package/dist/components/Payroll/helpers.js +52 -48
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +13 -16
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js +2 -2
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +2 -4
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +6 -8
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +28 -30
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -4
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/dateFormatting.js +47 -40
- package/dist/helpers/dateFormatting.js.map +1 -1
- package/dist/i18n/en/Company.Management.PaySchedule.json.js +20 -18
- package/dist/i18n/en/Company.Management.PaySchedule.json.js.map +1 -1
- package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js +6 -4
- package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollHistory.json.js +5 -5
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js +8 -10
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js +12 -14
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js +13 -15
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SelectHookField.js +10 -12
- package/dist/partner-hook-utils/form/fields/SelectHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js +14 -16
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js +8 -10
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js.map +1 -1
- package/dist/src/components/Company/PaySchedule/PayScheduleForm.d.ts +6 -0
- package/dist/src/components/Payroll/helpers.d.ts +20 -0
- package/dist/src/helpers/dateFormatting.d.ts +13 -0
- package/dist/src/i18n/types.d.ts +14 -2
- package/dist/style.css +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentsCard.js","sources":["../../../../../../src/components/Employee/Documents/management/DocumentsCard/DocumentsCard.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Form } from '@gusto/embedded-api/models/components/form'\nimport { useDocumentsList } from '../../shared/useDocumentsList'\nimport { DataView, useDataView, EmptyData, Loading } from '@/components/Common'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { LoaderComponentType } from '@/components/Base'\n\n/**\n * Props for {@link DocumentsCard}.\n *\n * @public\n */\nexport interface DocumentsCardProps {\n /** The associated employee identifier. */\n employeeId: string\n /** Event handler fired when a row's View CTA is clicked. */\n onEvent: OnEventType<EventType, unknown>\n /** Custom loading indicator rendered while this component's async data is fetching. Overrides the indicator configured on `GustoProvider` for this instance only. */\n LoaderComponent?: LoaderComponentType\n}\n\n/**\n * Standalone \"Documents\" (forms) card. Owns its own data fetch via\n * {@link useDocumentsList} and renders the employee's forms in a table with a\n * per-row \"View\" action. Emits\n * `employee/management/documents/card/viewRequested` with\n * `{ employeeId, formId }` when a row's View CTA is clicked. The card is\n * read-only — viewing or signing a form happens in the screen the parent\n * routes to — and renders no alerts: alert rendering is the parent's\n * responsibility.\n *\n * @param props - See {@link DocumentsCardProps}.\n * @returns The documents card.\n * @public\n */\nexport function DocumentsCard(props: DocumentsCardProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.Management.Documents\"\n LoaderComponent={props.LoaderComponent}\n >\n <DocumentsCardContent {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction DocumentsCardContent({ employeeId, onEvent, LoaderComponent }: DocumentsCardProps) {\n useI18n('Employee.Management.Documents')\n const { t } = useTranslation('Employee.Management.Documents')\n const Components = useComponentContext()\n\n const documentsList = useDocumentsList({ employeeId })\n\n const forms = documentsList.isLoading ? [] : documentsList.data.forms\n\n const formsColumns = [\n {\n key: 'title',\n title: t('columns.title'),\n render: (form: Form) => form.title || '-',\n },\n {\n key: 'year',\n title: t('columns.year'),\n render: (form: Form) => (form.year ? String(form.year) : '-'),\n },\n {\n key: 'status',\n title: t('columns.status'),\n render: (form: Form) => (form.draft ? t('status.draft') : t('status.final')),\n },\n {\n key: 'requiresSigning',\n title: t('columns.requiresSigning'),\n render: (form: Form) =>\n form.requiresSigning ? (\n <Components.Badge status=\"warning\">{t('signingStatus.notSigned')}</Components.Badge>\n ) : (\n <Components.Badge status=\"success\">{t('signingStatus.signed')}</Components.Badge>\n ),\n },\n ]\n\n const formsDataView = useDataView({\n data: forms,\n columns: formsColumns,\n itemMenu: (form: Form) => (\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_DOCUMENTS_CARD_VIEW_REQUESTED, {\n employeeId,\n formId: form.uuid,\n })\n }}\n >\n {t('viewCta')}\n </Components.Button>\n ),\n emptyState: () => (\n <EmptyData title={t('emptyState.title')} description={t('emptyState.description')} />\n ),\n })\n\n return (\n <BaseLayout error={documentsList.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box withPadding={false} header={<Components.BoxHeader title={t('title')} />}>\n {documentsList.isLoading ? (\n <Loading />\n ) : (\n <DataView label={t('listLabel')} isWithinBox {...formsDataView} />\n )}\n </Components.Box>\n </BaseLayout>\n )\n}\n"],"names":["DocumentsCard","props","jsx","BaseBoundaries","DocumentsCardContent","employeeId","onEvent","LoaderComponent","useI18n","useTranslation","Components","useComponentContext","documentsList","useDocumentsList","forms","formsColumns","form","formsDataView","useDataView","componentEvents","EmptyData","BaseLayout","Loading","DataView"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DocumentsCard.js","sources":["../../../../../../src/components/Employee/Documents/management/DocumentsCard/DocumentsCard.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Form } from '@gusto/embedded-api/models/components/form'\nimport { useDocumentsList } from '../../shared/useDocumentsList'\nimport { DataView, useDataView, EmptyData, Loading } from '@/components/Common'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { LoaderComponentType } from '@/components/Base'\n\n/**\n * Props for {@link DocumentsCard}.\n *\n * @public\n */\nexport interface DocumentsCardProps {\n /** The associated employee identifier. */\n employeeId: string\n /** Event handler fired when a row's View CTA is clicked. */\n onEvent: OnEventType<EventType, unknown>\n /** Custom loading indicator rendered while this component's async data is fetching. Overrides the indicator configured on `GustoProvider` for this instance only. */\n LoaderComponent?: LoaderComponentType\n}\n\n/**\n * Standalone \"Documents\" (forms) card. Owns its own data fetch via\n * {@link useDocumentsList} and renders the employee's forms in a table with a\n * per-row \"View\" action. Emits\n * `employee/management/documents/card/viewRequested` with\n * `{ employeeId, formId }` when a row's View CTA is clicked. The card is\n * read-only — viewing or signing a form happens in the screen the parent\n * routes to — and renders no alerts: alert rendering is the parent's\n * responsibility.\n *\n * @param props - See {@link DocumentsCardProps}.\n * @returns The documents card.\n * @public\n */\nexport function DocumentsCard(props: DocumentsCardProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.Management.Documents\"\n LoaderComponent={props.LoaderComponent}\n >\n <DocumentsCardContent {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction DocumentsCardContent({ employeeId, onEvent, LoaderComponent }: DocumentsCardProps) {\n useI18n('Employee.Management.Documents')\n const { t } = useTranslation('Employee.Management.Documents')\n const Components = useComponentContext()\n\n const documentsList = useDocumentsList({ employeeId })\n\n const forms = documentsList.isLoading ? [] : documentsList.data.forms\n\n const formsColumns = [\n {\n key: 'title',\n title: t('columns.title'),\n render: (form: Form) => form.title || '-',\n },\n {\n key: 'year',\n title: t('columns.year'),\n render: (form: Form) => (form.year ? String(form.year) : '-'),\n },\n {\n key: 'status',\n title: t('columns.status'),\n render: (form: Form) => (form.draft ? t('status.draft') : t('status.final')),\n },\n {\n key: 'requiresSigning',\n title: t('columns.requiresSigning'),\n render: (form: Form) =>\n form.requiresSigning ? (\n <Components.Badge status=\"warning\">{t('signingStatus.notSigned')}</Components.Badge>\n ) : (\n <Components.Badge status=\"success\">{t('signingStatus.signed')}</Components.Badge>\n ),\n },\n ]\n\n const formsDataView = useDataView({\n data: forms,\n columns: formsColumns,\n itemMenu: (form: Form) => (\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_DOCUMENTS_CARD_VIEW_REQUESTED, {\n employeeId,\n formId: form.uuid,\n })\n }}\n >\n {t('viewCta')}\n </Components.Button>\n ),\n emptyState: () => (\n <EmptyData title={t('emptyState.title')} description={t('emptyState.description')} />\n ),\n })\n\n return (\n <BaseLayout error={documentsList.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box withPadding={false} header={<Components.BoxHeader title={t('title')} />}>\n {documentsList.isLoading ? (\n <Loading />\n ) : (\n <DataView label={t('listLabel')} isWithinBox {...formsDataView} />\n )}\n </Components.Box>\n </BaseLayout>\n )\n}\n"],"names":["DocumentsCard","props","jsx","BaseBoundaries","DocumentsCardContent","employeeId","onEvent","LoaderComponent","useI18n","useTranslation","Components","useComponentContext","documentsList","useDocumentsList","forms","formsColumns","form","formsDataView","useDataView","componentEvents","EmptyData","BaseLayout","Loading","DataView"],"mappings":";;;;;;;;;;;AAuCO,SAASA,EAAcC,GAA2B;AACvD,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAc;AAAA,MACd,iBAAiBF,EAAM;AAAA,MAEvB,UAAA,gBAAAC,EAACE,GAAA,EAAsB,GAAGH,EAAA,CAAO;AAAA,IAAA;A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,UAAA,CACd;AAAA,QACH;AAAA,QAEC,YAAE,SAAS;AAAA,MAAA;AAAA,IAAA;AAAA,IAGhB,YAAY,MACV,gBAAAd,EAACkB,GAAA,EAAU,OAAO,EAAE,kBAAkB,GAAG,aAAa,EAAE,wBAAwB,EAAA,CAAG;AAAA,EAAA,CAEtF;AAED,2BACGC,GAAA,EAAW,OAAOT,EAAc,cAAc,QAAQ,iBAAAL,GACrD,UAAA,gBAAAL,EAACQ,EAAW,KAAX,EAAe,aAAa,IAAO,QAAQ,gBAAAR,EAACQ,EAAW,WAAX,EAAqB,OAAO,EAAE,OAAO,GAAG,GAClF,UAAAE,EAAc,YACb,gBAAAV,EAACoB,GAAA,EAAQ,IAET,gBAAApB,EAACqB,GAAA,EAAS,OAAO,EAAE,WAAW,GAAG,aAAW,IAAE,GAAGN,EAAA,CAAe,GAEpE,GACF;AAEJ;"}
|
package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as r } from "react-i18next";
|
|
3
|
-
import { useDocumentList as
|
|
4
|
-
import "
|
|
5
|
-
import "../../../../../../shared/constants.js";
|
|
6
|
-
import { ActionsLayout as s } from "../../../../../Common/ActionsLayout/ActionsLayout.js";
|
|
3
|
+
import { useDocumentList as s } from "./useDocumentList.js";
|
|
4
|
+
import { ActionsLayout as m } from "../../../../../Common/ActionsLayout/ActionsLayout.js";
|
|
7
5
|
import { useComponentContext as c } from "../../../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
8
|
-
function
|
|
9
|
-
const { t } = r("Employee.DocumentSigner"), { handleContinue:
|
|
10
|
-
return /* @__PURE__ */ o(
|
|
6
|
+
function d() {
|
|
7
|
+
const { t: n } = r("Employee.DocumentSigner"), { handleContinue: t, hasSignedAllForms: e } = s(), i = c();
|
|
8
|
+
return /* @__PURE__ */ o(m, { children: /* @__PURE__ */ o(i.Button, { onClick: t, isLoading: !1, isDisabled: !e, children: n("continueCta") }) });
|
|
11
9
|
}
|
|
12
10
|
export {
|
|
13
|
-
|
|
11
|
+
d as Actions
|
|
14
12
|
};
|
|
15
13
|
//# sourceMappingURL=Actions.js.map
|
package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport function Actions() {\n const { t } = useTranslation('Employee.DocumentSigner')\n const { handleContinue, hasSignedAllForms } = useDocumentList()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button onClick={handleContinue} isLoading={false} isDisabled={!hasSignedAllForms}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","handleContinue","hasSignedAllForms","useDocumentList","Components","useComponentContext","ActionsLayout","jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Actions.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport function Actions() {\n const { t } = useTranslation('Employee.DocumentSigner')\n const { handleContinue, hasSignedAllForms } = useDocumentList()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button onClick={handleContinue} isLoading={false} isDisabled={!hasSignedAllForms}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","t","useTranslation","handleContinue","hasSignedAllForms","useDocumentList","Components","useComponentContext","ActionsLayout","jsx"],"mappings":";;;;;AAMO,SAASA,IAAU;AACxB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB,GAChD,EAAE,gBAAAC,GAAgB,mBAAAC,EAAA,IAAsBC,EAAA,GACxCC,IAAaC,EAAA;AAEnB,2BACGC,GAAA,EACC,UAAA,gBAAAC,EAACH,EAAW,QAAX,EAAkB,SAASH,GAAgB,WAAW,IAAO,YAAY,CAACC,GACxE,UAAAH,EAAE,aAAa,GAClB,GACF;AAEJ;"}
|
package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js
CHANGED
|
@@ -9,16 +9,13 @@ import "@gusto/embedded-api/models/errors/gustoembeddederror";
|
|
|
9
9
|
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
10
10
|
import "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
|
-
import "dompurify";
|
|
13
|
-
import "../../../../../../contexts/LocaleProvider/useLocale.js";
|
|
14
12
|
import "../../../../../../shared/constants.js";
|
|
15
|
-
import "classnames";
|
|
16
13
|
import "../../../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
17
14
|
import "../../../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
18
15
|
import { createCompoundContext as t } from "../../../../../Base/createCompoundContext.js";
|
|
19
|
-
const [
|
|
16
|
+
const [a, f] = t("DocumentListContext");
|
|
20
17
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
f as DocumentListProvider,
|
|
19
|
+
a as useDocumentList
|
|
23
20
|
};
|
|
24
21
|
//# sourceMappingURL=useDocumentList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentList.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDocumentList.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
|
|
@@ -5,12 +5,11 @@ import { useFederalTaxesForm as M } from "../shared/useFederalTaxesForm/useFeder
|
|
|
5
5
|
import { useManagementFederalTaxesViewDictionary as y } from "./useViewDictionary.js";
|
|
6
6
|
import { BaseBoundaries as _, BaseLayout as g } from "../../../Base/Base.js";
|
|
7
7
|
import "../../../Base/useBase.js";
|
|
8
|
-
import "classnames";
|
|
9
|
-
import { componentEvents as c } from "../../../../shared/constants.js";
|
|
10
8
|
import { ActionsLayout as A } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
11
9
|
import { useI18n as h, useComponentDictionary as D } from "../../../../i18n/I18n.js";
|
|
10
|
+
import { componentEvents as c } from "../../../../shared/constants.js";
|
|
12
11
|
import { useComponentContext as L } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
|
-
function
|
|
12
|
+
function G({
|
|
14
13
|
FallbackComponent: n,
|
|
15
14
|
LoaderComponent: t,
|
|
16
15
|
...r
|
|
@@ -74,6 +73,6 @@ function C({
|
|
|
74
73
|
);
|
|
75
74
|
}
|
|
76
75
|
export {
|
|
77
|
-
|
|
76
|
+
G as FederalTaxesEditForm
|
|
78
77
|
};
|
|
79
78
|
//# sourceMappingURL=FederalTaxesEditForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederalTaxesEditForm.js","sources":["../../../../../src/components/Employee/FederalTaxes/management/FederalTaxesEditForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FederalTaxesView } from '../shared/FederalTaxesView'\nimport {\n useFederalTaxesForm,\n type UseFederalTaxesFormProps,\n type FederalTaxesFormData,\n} from '../shared/useFederalTaxesForm'\nimport { useManagementFederalTaxesViewDictionary } from './useViewDictionary'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/**\n * Props for {@link FederalTaxesEditForm}.\n *\n * @public\n */\nexport interface FederalTaxesEditFormProps extends BaseComponentInterface<'Employee.Management.FederalTaxes'> {\n /** The associated employee identifier. */\n employeeId: string\n /** Pre-fill form values. Server data takes precedence when the employee already has values on file. */\n defaultValues?: Partial<FederalTaxesFormData>\n}\n\n/**\n * Standalone form for editing an employee's federal tax (W-4) withholdings — filing status, multiple-jobs flag, dependents, other income, deductions, and extra withholding.\n *\n * @remarks\n * Pair with {@link FederalTaxesCard} to route its `employee/management/federalTaxes/card/editRequested` event to this form. {@link FederalTaxes} bundles the card, this form, and the swap wiring as a single drop-in; reach for this form directly only when that orchestration is the wrong fit (for example, when the form needs to render in a modal or drawer, or when the swap is driven by a router).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/management/federalTaxes/editForm/submitted` | Fired after the form is saved; use it to return to the card | The updated `EmployeeFederalTax` entity |\n * | `employee/management/federalTaxes/editForm/cancelled` | Fired when the user clicks Cancel; use it to return to the card | — |\n *\n * @param props - See {@link FederalTaxesEditFormProps}.\n * @returns The rendered federal taxes edit form.\n * @public\n * @group Block components\n */\nexport function FederalTaxesEditForm({\n FallbackComponent,\n LoaderComponent,\n ...props\n}: FederalTaxesEditFormProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.Management.FederalTaxes\"\n FallbackComponent={FallbackComponent}\n LoaderComponent={LoaderComponent}\n >\n <FederalTaxesEditFormRoot LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction FederalTaxesEditFormRoot({\n employeeId,\n className,\n children,\n dictionary,\n defaultValues,\n onEvent,\n LoaderComponent,\n}: FederalTaxesEditFormProps) {\n useI18n('Employee.Management.FederalTaxes')\n useComponentDictionary('Employee.Management.FederalTaxes', dictionary)\n const { t } = useTranslation('Employee.Management.FederalTaxes')\n const Components = useComponentContext()\n const viewDictionary = useManagementFederalTaxesViewDictionary()\n\n const federalTaxes = useFederalTaxesForm({\n employeeId,\n defaultValues,\n optionalFieldsToRequire: {\n update: ['twoJobs', 'dependentsAmount', 'otherIncome', 'deductions', 'extraWithholding'],\n },\n } satisfies UseFederalTaxesFormProps)\n\n if (federalTaxes.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={federalTaxes.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const handleSubmit = async () => {\n const result = await federalTaxes.actions.onSubmit()\n if (!result) return\n\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_FEDERAL_TAXES_EDIT_FORM_SUBMITTED, result.data)\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_FEDERAL_TAXES_EDIT_FORM_CANCELLED)\n }\n\n return (\n <FederalTaxesView\n federalTaxes={federalTaxes}\n onSubmit={handleSubmit}\n LoaderComponent={LoaderComponent}\n actions={\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={federalTaxes.status.isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n }\n className={className}\n dictionary={viewDictionary}\n >\n {children}\n </FederalTaxesView>\n )\n}\n"],"names":["FederalTaxesEditForm","FallbackComponent","LoaderComponent","props","jsx","BaseBoundaries","FederalTaxesEditFormRoot","employeeId","className","children","dictionary","defaultValues","onEvent","useI18n","useComponentDictionary","t","useTranslation","Components","useComponentContext","viewDictionary","useManagementFederalTaxesViewDictionary","federalTaxes","useFederalTaxesForm","BaseLayout","handleSubmit","result","componentEvents","handleCancel","FederalTaxesView","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FederalTaxesEditForm.js","sources":["../../../../../src/components/Employee/FederalTaxes/management/FederalTaxesEditForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FederalTaxesView } from '../shared/FederalTaxesView'\nimport {\n useFederalTaxesForm,\n type UseFederalTaxesFormProps,\n type FederalTaxesFormData,\n} from '../shared/useFederalTaxesForm'\nimport { useManagementFederalTaxesViewDictionary } from './useViewDictionary'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/**\n * Props for {@link FederalTaxesEditForm}.\n *\n * @public\n */\nexport interface FederalTaxesEditFormProps extends BaseComponentInterface<'Employee.Management.FederalTaxes'> {\n /** The associated employee identifier. */\n employeeId: string\n /** Pre-fill form values. Server data takes precedence when the employee already has values on file. */\n defaultValues?: Partial<FederalTaxesFormData>\n}\n\n/**\n * Standalone form for editing an employee's federal tax (W-4) withholdings — filing status, multiple-jobs flag, dependents, other income, deductions, and extra withholding.\n *\n * @remarks\n * Pair with {@link FederalTaxesCard} to route its `employee/management/federalTaxes/card/editRequested` event to this form. {@link FederalTaxes} bundles the card, this form, and the swap wiring as a single drop-in; reach for this form directly only when that orchestration is the wrong fit (for example, when the form needs to render in a modal or drawer, or when the swap is driven by a router).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/management/federalTaxes/editForm/submitted` | Fired after the form is saved; use it to return to the card | The updated `EmployeeFederalTax` entity |\n * | `employee/management/federalTaxes/editForm/cancelled` | Fired when the user clicks Cancel; use it to return to the card | — |\n *\n * @param props - See {@link FederalTaxesEditFormProps}.\n * @returns The rendered federal taxes edit form.\n * @public\n * @group Block components\n */\nexport function FederalTaxesEditForm({\n FallbackComponent,\n LoaderComponent,\n ...props\n}: FederalTaxesEditFormProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.Management.FederalTaxes\"\n FallbackComponent={FallbackComponent}\n LoaderComponent={LoaderComponent}\n >\n <FederalTaxesEditFormRoot LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction FederalTaxesEditFormRoot({\n employeeId,\n className,\n children,\n dictionary,\n defaultValues,\n onEvent,\n LoaderComponent,\n}: FederalTaxesEditFormProps) {\n useI18n('Employee.Management.FederalTaxes')\n useComponentDictionary('Employee.Management.FederalTaxes', dictionary)\n const { t } = useTranslation('Employee.Management.FederalTaxes')\n const Components = useComponentContext()\n const viewDictionary = useManagementFederalTaxesViewDictionary()\n\n const federalTaxes = useFederalTaxesForm({\n employeeId,\n defaultValues,\n optionalFieldsToRequire: {\n update: ['twoJobs', 'dependentsAmount', 'otherIncome', 'deductions', 'extraWithholding'],\n },\n } satisfies UseFederalTaxesFormProps)\n\n if (federalTaxes.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={federalTaxes.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const handleSubmit = async () => {\n const result = await federalTaxes.actions.onSubmit()\n if (!result) return\n\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_FEDERAL_TAXES_EDIT_FORM_SUBMITTED, result.data)\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_FEDERAL_TAXES_EDIT_FORM_CANCELLED)\n }\n\n return (\n <FederalTaxesView\n federalTaxes={federalTaxes}\n onSubmit={handleSubmit}\n LoaderComponent={LoaderComponent}\n actions={\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={federalTaxes.status.isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n }\n className={className}\n dictionary={viewDictionary}\n >\n {children}\n </FederalTaxesView>\n )\n}\n"],"names":["FederalTaxesEditForm","FallbackComponent","LoaderComponent","props","jsx","BaseBoundaries","FederalTaxesEditFormRoot","employeeId","className","children","dictionary","defaultValues","onEvent","useI18n","useComponentDictionary","t","useTranslation","Components","useComponentContext","viewDictionary","useManagementFederalTaxesViewDictionary","federalTaxes","useFederalTaxesForm","BaseLayout","handleSubmit","result","componentEvents","handleCancel","FederalTaxesView","ActionsLayout"],"mappings":";;;;;;;;;;;AA2CO,SAASA,EAAqB;AAAA,EACnC,mBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,GAAGC;AACL,GAA8B;AAC5B,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAc;AAAA,MACd,mBAAAJ;AAAA,MACA,iBAAAC;AAAA,MAEA,UAAA,gBAAAE,EAACE,GAAA,EAAyB,iBAAAJ,GAAmC,GAAGC,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAG7E;AAEA,SAASG,EAAyB;AAAA,EAChC,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA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AGP;"}
|
|
@@ -5,12 +5,11 @@ import { useFederalTaxesForm as E } from "../shared/useFederalTaxesForm/useFeder
|
|
|
5
5
|
import { useOnboardingFederalTaxesViewDictionary as f } from "./useViewDictionary.js";
|
|
6
6
|
import { BaseBoundaries as T, BaseLayout as x } from "../../../Base/Base.js";
|
|
7
7
|
import "../../../Base/useBase.js";
|
|
8
|
-
import "classnames";
|
|
9
|
-
import { componentEvents as m } from "../../../../shared/constants.js";
|
|
10
8
|
import { ActionsLayout as F } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
11
9
|
import { useI18n as y, useComponentDictionary as b } from "../../../../i18n/I18n.js";
|
|
10
|
+
import { componentEvents as m } from "../../../../shared/constants.js";
|
|
12
11
|
import { useComponentContext as g } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
|
-
function
|
|
12
|
+
function N({ FallbackComponent: t, LoaderComponent: o, ...r }) {
|
|
14
13
|
return /* @__PURE__ */ e(
|
|
15
14
|
T,
|
|
16
15
|
{
|
|
@@ -66,6 +65,6 @@ function A({ isPending: t }) {
|
|
|
66
65
|
return /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(r.Button, { type: "submit", isLoading: t, children: o("submitCta") }) });
|
|
67
66
|
}
|
|
68
67
|
export {
|
|
69
|
-
|
|
68
|
+
N as FederalTaxes
|
|
70
69
|
};
|
|
71
70
|
//# sourceMappingURL=FederalTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederalTaxes.js","sources":["../../../../../src/components/Employee/FederalTaxes/onboarding/FederalTaxes.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FederalTaxesView } from '../shared/FederalTaxesView'\nimport {\n useFederalTaxesForm,\n type UseFederalTaxesFormProps,\n type FederalTaxesFormData,\n} from '../shared/useFederalTaxesForm'\nimport { useOnboardingFederalTaxesViewDictionary } from './useViewDictionary'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/**\n * Props for {@link FederalTaxes}.\n *\n * @public\n */\nexport interface FederalTaxesProps extends BaseComponentInterface<'Employee.FederalTaxes'> {\n /** The associated employee identifier. */\n employeeId: string\n /** Pre-fill form values. Server data takes precedence when the employee already has values on file. */\n defaultValues?: Partial<FederalTaxesFormData>\n /** Callback invoked when the block emits an event. See the events table on {@link FederalTaxes} for the available event types and payloads. */\n onEvent: BaseComponentInterface['onEvent']\n}\n\n/**\n * Onboarding step for collecting an employee's federal tax (W-4) withholdings — filing status, multiple-jobs flag, dependents, other income, deductions, and extra withholding.\n *\n * @remarks\n * The federal tax record is created automatically with the employee, so this step is always in update mode. Only the revised 2020 W-4 format is supported. All fields are required by the bundled form, mirroring the IRS-form UX.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/federalTaxes/updated` | Fired after the form is saved | The updated `EmployeeFederalTax` entity |\n * | `employee/federalTaxes/done` | Fired after a successful save so the parent flow can advance | — |\n *\n * @param props - See {@link FederalTaxesProps}.\n * @returns The federal taxes onboarding step.\n * @public\n * @group Block components\n */\nexport function FederalTaxes({ FallbackComponent, LoaderComponent, ...props }: FederalTaxesProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.FederalTaxes\"\n FallbackComponent={FallbackComponent}\n LoaderComponent={LoaderComponent}\n >\n <FederalTaxesRoot LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction FederalTaxesRoot({\n employeeId,\n className,\n children,\n dictionary,\n defaultValues,\n onEvent,\n LoaderComponent,\n}: FederalTaxesProps) {\n useI18n('Employee.FederalTaxes')\n useComponentDictionary('Employee.FederalTaxes', dictionary)\n const viewDictionary = useOnboardingFederalTaxesViewDictionary()\n\n const federalTaxes = useFederalTaxesForm({\n employeeId,\n defaultValues,\n optionalFieldsToRequire: {\n update: ['twoJobs', 'dependentsAmount', 'otherIncome', 'deductions', 'extraWithholding'],\n },\n } satisfies UseFederalTaxesFormProps)\n\n if (federalTaxes.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={federalTaxes.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const handleSubmit = async () => {\n const result = await federalTaxes.actions.onSubmit()\n if (!result) return\n\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_UPDATED, result.data)\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_DONE)\n }\n\n return (\n <FederalTaxesView\n federalTaxes={federalTaxes}\n onSubmit={handleSubmit}\n LoaderComponent={LoaderComponent}\n actions={<ContinueAction isPending={federalTaxes.status.isPending} />}\n className={className}\n dictionary={viewDictionary}\n >\n {children}\n </FederalTaxesView>\n )\n}\n\nfunction ContinueAction({ isPending }: { isPending: boolean }) {\n const { t } = useTranslation('Employee.FederalTaxes')\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["FederalTaxes","FallbackComponent","LoaderComponent","props","jsx","BaseBoundaries","FederalTaxesRoot","employeeId","className","children","dictionary","defaultValues","onEvent","useI18n","useComponentDictionary","viewDictionary","useOnboardingFederalTaxesViewDictionary","federalTaxes","useFederalTaxesForm","BaseLayout","FederalTaxesView","result","componentEvents","ContinueAction","isPending","t","useTranslation","Components","useComponentContext","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FederalTaxes.js","sources":["../../../../../src/components/Employee/FederalTaxes/onboarding/FederalTaxes.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FederalTaxesView } from '../shared/FederalTaxesView'\nimport {\n useFederalTaxesForm,\n type UseFederalTaxesFormProps,\n type FederalTaxesFormData,\n} from '../shared/useFederalTaxesForm'\nimport { useOnboardingFederalTaxesViewDictionary } from './useViewDictionary'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/**\n * Props for {@link FederalTaxes}.\n *\n * @public\n */\nexport interface FederalTaxesProps extends BaseComponentInterface<'Employee.FederalTaxes'> {\n /** The associated employee identifier. */\n employeeId: string\n /** Pre-fill form values. Server data takes precedence when the employee already has values on file. */\n defaultValues?: Partial<FederalTaxesFormData>\n /** Callback invoked when the block emits an event. See the events table on {@link FederalTaxes} for the available event types and payloads. */\n onEvent: BaseComponentInterface['onEvent']\n}\n\n/**\n * Onboarding step for collecting an employee's federal tax (W-4) withholdings — filing status, multiple-jobs flag, dependents, other income, deductions, and extra withholding.\n *\n * @remarks\n * The federal tax record is created automatically with the employee, so this step is always in update mode. Only the revised 2020 W-4 format is supported. All fields are required by the bundled form, mirroring the IRS-form UX.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/federalTaxes/updated` | Fired after the form is saved | The updated `EmployeeFederalTax` entity |\n * | `employee/federalTaxes/done` | Fired after a successful save so the parent flow can advance | — |\n *\n * @param props - See {@link FederalTaxesProps}.\n * @returns The federal taxes onboarding step.\n * @public\n * @group Block components\n */\nexport function FederalTaxes({ FallbackComponent, LoaderComponent, ...props }: FederalTaxesProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.FederalTaxes\"\n FallbackComponent={FallbackComponent}\n LoaderComponent={LoaderComponent}\n >\n <FederalTaxesRoot LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction FederalTaxesRoot({\n employeeId,\n className,\n children,\n dictionary,\n defaultValues,\n onEvent,\n LoaderComponent,\n}: FederalTaxesProps) {\n useI18n('Employee.FederalTaxes')\n useComponentDictionary('Employee.FederalTaxes', dictionary)\n const viewDictionary = useOnboardingFederalTaxesViewDictionary()\n\n const federalTaxes = useFederalTaxesForm({\n employeeId,\n defaultValues,\n optionalFieldsToRequire: {\n update: ['twoJobs', 'dependentsAmount', 'otherIncome', 'deductions', 'extraWithholding'],\n },\n } satisfies UseFederalTaxesFormProps)\n\n if (federalTaxes.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={federalTaxes.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const handleSubmit = async () => {\n const result = await federalTaxes.actions.onSubmit()\n if (!result) return\n\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_UPDATED, result.data)\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_DONE)\n }\n\n return (\n <FederalTaxesView\n federalTaxes={federalTaxes}\n onSubmit={handleSubmit}\n LoaderComponent={LoaderComponent}\n actions={<ContinueAction isPending={federalTaxes.status.isPending} />}\n className={className}\n dictionary={viewDictionary}\n >\n {children}\n </FederalTaxesView>\n )\n}\n\nfunction ContinueAction({ isPending }: { isPending: boolean }) {\n const { t } = useTranslation('Employee.FederalTaxes')\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["FederalTaxes","FallbackComponent","LoaderComponent","props","jsx","BaseBoundaries","FederalTaxesRoot","employeeId","className","children","dictionary","defaultValues","onEvent","useI18n","useComponentDictionary","viewDictionary","useOnboardingFederalTaxesViewDictionary","federalTaxes","useFederalTaxesForm","BaseLayout","FederalTaxesView","result","componentEvents","ContinueAction","isPending","t","useTranslation","Components","useComponentContext","ActionsLayout"],"mappings":";;;;;;;;;;;AA6CO,SAASA,EAAa,EAAE,mBAAAC,GAAmB,iBAAAC,GAAiB,GAAGC,KAA4B;AAChG,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAc;AAAA,MACd,mBAAAJ;AAAA,MACA,iBAAAC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,GAAA,EACC,UAAA,gBAAAzB,EAACuB,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWH,GACzC,UAAAC,EAAE,WAAW,GAChB,GACF;AAEJ;"}
|
|
@@ -1,47 +1,45 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as g } from "react-i18next";
|
|
3
3
|
import { useBankForm as y } from "../useBankForm/useBankForm.js";
|
|
4
|
-
import "classnames";
|
|
5
|
-
import "../../../../../shared/constants.js";
|
|
6
4
|
import { ActionsLayout as N } from "../../../../Common/ActionsLayout/ActionsLayout.js";
|
|
7
5
|
import { Form as f } from "../../../../Common/Form/Form.js";
|
|
8
6
|
import { BaseLayout as u } from "../../../../Base/Base.js";
|
|
9
7
|
import { SDKFormProvider as B } from "../../../../../partner-hook-utils/form/SDKFormProvider.js";
|
|
10
8
|
import { useComponentContext as v } from "../../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
9
|
import { useI18n as E, useComponentDictionary as L } from "../../../../../i18n/I18n.js";
|
|
12
|
-
function
|
|
10
|
+
function A({
|
|
13
11
|
employeeId: c,
|
|
14
12
|
dictionary: l,
|
|
15
13
|
onSaved: d,
|
|
16
14
|
onCancel: i,
|
|
17
15
|
LoaderComponent: a,
|
|
18
|
-
...
|
|
16
|
+
...b
|
|
19
17
|
}) {
|
|
20
18
|
E("Employee.BankFormBody"), L("Employee.BankFormBody", l);
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
return /* @__PURE__ */
|
|
19
|
+
const r = y({ employeeId: c, ...b }), { t: o } = g("Employee.BankFormBody"), s = v();
|
|
20
|
+
if (r.isLoading)
|
|
21
|
+
return /* @__PURE__ */ n(
|
|
24
22
|
u,
|
|
25
23
|
{
|
|
26
24
|
isLoading: !0,
|
|
27
|
-
error:
|
|
25
|
+
error: r.errorHandling.errors,
|
|
28
26
|
LoaderComponent: a
|
|
29
27
|
}
|
|
30
28
|
);
|
|
31
|
-
const { Fields:
|
|
32
|
-
const e = await
|
|
29
|
+
const { Fields: t } = r.form, p = async () => {
|
|
30
|
+
const e = await r.actions.onSubmit();
|
|
33
31
|
e && d(e.data);
|
|
34
32
|
};
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
|
|
33
|
+
return /* @__PURE__ */ n(u, { error: r.errorHandling.errors, LoaderComponent: a, children: /* @__PURE__ */ n(B, { formHookResult: r, children: /* @__PURE__ */ m(f, { onSubmit: p, children: [
|
|
34
|
+
/* @__PURE__ */ n(
|
|
35
|
+
t.Name,
|
|
38
36
|
{
|
|
39
37
|
label: o("nameLabel"),
|
|
40
38
|
validationMessages: { REQUIRED: o("validations.accountName") }
|
|
41
39
|
}
|
|
42
40
|
),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
|
|
41
|
+
/* @__PURE__ */ n(
|
|
42
|
+
t.RoutingNumber,
|
|
45
43
|
{
|
|
46
44
|
label: o("routingNumberLabel"),
|
|
47
45
|
description: o("routingNumberDescription"),
|
|
@@ -51,8 +49,8 @@ function S({
|
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
),
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
|
|
52
|
+
/* @__PURE__ */ n(
|
|
53
|
+
t.AccountNumber,
|
|
56
54
|
{
|
|
57
55
|
label: o("accountNumberLabel"),
|
|
58
56
|
validationMessages: {
|
|
@@ -61,20 +59,20 @@ function S({
|
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
61
|
),
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
|
|
62
|
+
/* @__PURE__ */ n(
|
|
63
|
+
t.AccountType,
|
|
66
64
|
{
|
|
67
65
|
label: o("accountTypeLabel"),
|
|
68
66
|
getOptionLabel: (e) => o(e === "Checking" ? "accountTypeChecking" : "accountTypeSavings")
|
|
69
67
|
}
|
|
70
68
|
),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
i && /* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ m(N, { children: [
|
|
70
|
+
i && /* @__PURE__ */ n(s.Button, { variant: "secondary", type: "button", onClick: i, children: o("cancelCta") }),
|
|
71
|
+
/* @__PURE__ */ n(s.Button, { type: "submit", isLoading: r.status.isPending, children: o("saveCta") })
|
|
74
72
|
] })
|
|
75
73
|
] }) }) });
|
|
76
74
|
}
|
|
77
75
|
export {
|
|
78
|
-
|
|
76
|
+
A as BankFormBody
|
|
79
77
|
};
|
|
80
78
|
//# sourceMappingURL=BankFormBody.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BankFormBody.js","sources":["../../../../../../src/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { EmployeeBankAccount } from '@gusto/embedded-api/models/components/employeebankaccount'\nimport { useBankForm, type AccountType, type UseBankFormProps } from '../useBankForm'\nimport { ActionsLayout } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { BaseLayout } from '@/components/Base/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport type { ResourceDictionary } from '@/types/Helpers'\nimport type { LoaderComponentType } from '@/components/Base'\n\n/** @internal */\nexport type BankFormBodyDictionary = ResourceDictionary<'Employee.BankFormBody'>\n\n/** @internal */\nexport interface BankFormBodyProps extends Omit<UseBankFormProps, 'employeeId'> {\n employeeId: string\n /**\n * Translation overrides for the form's strings. Each consuming surface passes\n * the dictionary it resolved from its own namespace so partner overrides on\n * that namespace flow into the shared form text.\n */\n dictionary?: BankFormBodyDictionary\n /** Called with the created bank account after a successful submit. */\n onSaved: (bankAccount: EmployeeBankAccount) => void\n onCancel?: () => void\n LoaderComponent?: LoaderComponentType\n}\n\n/**\n * Shared bank-account form body. Owns the `useBankForm` composition, the field\n * JSX, and the submit/cancel actions. Reads its copy from the internal\n * `Employee.BankFormBody` namespace; consuming surfaces inject their own copy\n * via the `dictionary` prop and map the `onSaved`/`onCancel` callbacks onto\n * their surface-specific events.\n *\n * @internal\n */\nexport function BankFormBody({\n employeeId,\n dictionary,\n onSaved,\n onCancel,\n LoaderComponent,\n ...hookProps\n}: BankFormBodyProps) {\n useI18n('Employee.BankFormBody')\n useComponentDictionary('Employee.BankFormBody', dictionary)\n const bankForm = useBankForm({ employeeId, ...hookProps })\n const { t } = useTranslation('Employee.BankFormBody')\n const Components = useComponentContext()\n\n if (bankForm.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={bankForm.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const { Fields } = bankForm.form\n\n const handleSubmit = async () => {\n const result = await bankForm.actions.onSubmit()\n if (result) {\n onSaved(result.data)\n }\n }\n\n return (\n <BaseLayout error={bankForm.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <SDKFormProvider formHookResult={bankForm}>\n <Form onSubmit={handleSubmit}>\n <Fields.Name\n label={t('nameLabel')}\n validationMessages={{ REQUIRED: t('validations.accountName') }}\n />\n <Fields.RoutingNumber\n label={t('routingNumberLabel')}\n description={t('routingNumberDescription')}\n validationMessages={{\n REQUIRED: t('validations.routingNumber'),\n INVALID_ROUTING_NUMBER: t('validations.routingNumber'),\n }}\n />\n <Fields.AccountNumber\n label={t('accountNumberLabel')}\n validationMessages={{\n REQUIRED: t('validations.accountNumber'),\n INVALID_ACCOUNT_NUMBER: t('validations.accountNumberFormat'),\n }}\n />\n <Fields.AccountType\n label={t('accountTypeLabel')}\n getOptionLabel={(type: AccountType) =>\n type === 'Checking' ? t('accountTypeChecking') : t('accountTypeSavings')\n }\n />\n <ActionsLayout>\n {onCancel && (\n <Components.Button variant=\"secondary\" type=\"button\" onClick={onCancel}>\n {t('cancelCta')}\n </Components.Button>\n )}\n <Components.Button type=\"submit\" isLoading={bankForm.status.isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n )\n}\n"],"names":["BankFormBody","employeeId","dictionary","onSaved","onCancel","LoaderComponent","hookProps","useI18n","useComponentDictionary","bankForm","useBankForm","t","useTranslation","Components","useComponentContext","jsx","BaseLayout","Fields","handleSubmit","result","SDKFormProvider","jsxs","Form","type","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BankFormBody.js","sources":["../../../../../../src/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { EmployeeBankAccount } from '@gusto/embedded-api/models/components/employeebankaccount'\nimport { useBankForm, type AccountType, type UseBankFormProps } from '../useBankForm'\nimport { ActionsLayout } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { BaseLayout } from '@/components/Base/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport type { ResourceDictionary } from '@/types/Helpers'\nimport type { LoaderComponentType } from '@/components/Base'\n\n/** @internal */\nexport type BankFormBodyDictionary = ResourceDictionary<'Employee.BankFormBody'>\n\n/** @internal */\nexport interface BankFormBodyProps extends Omit<UseBankFormProps, 'employeeId'> {\n employeeId: string\n /**\n * Translation overrides for the form's strings. Each consuming surface passes\n * the dictionary it resolved from its own namespace so partner overrides on\n * that namespace flow into the shared form text.\n */\n dictionary?: BankFormBodyDictionary\n /** Called with the created bank account after a successful submit. */\n onSaved: (bankAccount: EmployeeBankAccount) => void\n onCancel?: () => void\n LoaderComponent?: LoaderComponentType\n}\n\n/**\n * Shared bank-account form body. Owns the `useBankForm` composition, the field\n * JSX, and the submit/cancel actions. Reads its copy from the internal\n * `Employee.BankFormBody` namespace; consuming surfaces inject their own copy\n * via the `dictionary` prop and map the `onSaved`/`onCancel` callbacks onto\n * their surface-specific events.\n *\n * @internal\n */\nexport function BankFormBody({\n employeeId,\n dictionary,\n onSaved,\n onCancel,\n LoaderComponent,\n ...hookProps\n}: BankFormBodyProps) {\n useI18n('Employee.BankFormBody')\n useComponentDictionary('Employee.BankFormBody', dictionary)\n const bankForm = useBankForm({ employeeId, ...hookProps })\n const { t } = useTranslation('Employee.BankFormBody')\n const Components = useComponentContext()\n\n if (bankForm.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={bankForm.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const { Fields } = bankForm.form\n\n const handleSubmit = async () => {\n const result = await bankForm.actions.onSubmit()\n if (result) {\n onSaved(result.data)\n }\n }\n\n return (\n <BaseLayout error={bankForm.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <SDKFormProvider formHookResult={bankForm}>\n <Form onSubmit={handleSubmit}>\n <Fields.Name\n label={t('nameLabel')}\n validationMessages={{ REQUIRED: t('validations.accountName') }}\n />\n <Fields.RoutingNumber\n label={t('routingNumberLabel')}\n description={t('routingNumberDescription')}\n validationMessages={{\n REQUIRED: t('validations.routingNumber'),\n INVALID_ROUTING_NUMBER: t('validations.routingNumber'),\n }}\n />\n <Fields.AccountNumber\n label={t('accountNumberLabel')}\n validationMessages={{\n REQUIRED: t('validations.accountNumber'),\n INVALID_ACCOUNT_NUMBER: t('validations.accountNumberFormat'),\n }}\n />\n <Fields.AccountType\n label={t('accountTypeLabel')}\n getOptionLabel={(type: AccountType) =>\n type === 'Checking' ? t('accountTypeChecking') : t('accountTypeSavings')\n }\n />\n <ActionsLayout>\n {onCancel && (\n <Components.Button variant=\"secondary\" type=\"button\" onClick={onCancel}>\n {t('cancelCta')}\n </Components.Button>\n )}\n <Components.Button type=\"submit\" isLoading={bankForm.status.isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n )\n}\n"],"names":["BankFormBody","employeeId","dictionary","onSaved","onCancel","LoaderComponent","hookProps","useI18n","useComponentDictionary","bankForm","useBankForm","t","useTranslation","Components","useComponentContext","jsx","BaseLayout","Fields","handleSubmit","result","SDKFormProvider","jsxs","Form","type","ActionsLayout"],"mappings":";;;;;;;;;AAuCO,SAASA,EAAa;AAAA,EAC3B,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,GAAGC;AACL,GAAsB;AACpB,EAAAC,EAAQ,uBAAuB,GAC/BC,EAAuB,yBAAyBN,CAAU;AAC1D,QAAMO,IAAWC,EAAY,EAAE,YAAAT,GAAY,GAAGK,GAAW,GACnD,EAAE,GAAAK,EAAA,IAAMC,EAAe,uBAAuB,GAC9CC,IAAaC,EAAA;AAEnB,MAAIL,EAAS;AACX,WACE,gBAAAM;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,WAAS;AAAA,QACT,OAAOP,EAAS,cAAc;AAAA,QAC9B,iBAAAJ;AAAA,MAAA;AAAA,IAAA;AAKN,QAAM,EAAE,QAAAY,MAAWR,EAAS,MAEtBS,IAAe,YAAY;AAC/B,UAAMC,IAAS,MAAMV,EAAS,QAAQ,SAAA;AACtC,IAAIU,KACFhB,EAAQgB,EAAO,IAAI;AAAA,EAEvB;AAEA,SACE,gBAAAJ,EAACC,GAAA,EAAW,OAAOP,EAAS,cAAc,QAAQ,iBAAAJ,GAChD,UAAA,gBAAAU,EAACK,GAAA,EAAgB,gBAAgBX,GAC/B,UAAA,gBAAAY,EAACC,GAAA,EAAK,UAAUJ,GACd,UAAA;AAAA,IAAA,gBAAAH;AAAA,MAACE,EAAO;AAAA,MAAP;AAAA,QACC,OAAON,EAAE,WAAW;AAAA,QACpB,oBAAoB,EAAE,UAAUA,EAAE,yBAAyB,EAAA;AAAA,MAAE;AAAA,IAAA;AAAA,IAE/D,gBAAAI;AAAA,MAACE,EAAO;AAAA,MAAP;AAAA,QACC,OAAON,EAAE,oBAAoB;AAAA,QAC7B,aAAaA,EAAE,0BAA0B;AAAA,QACzC,oBAAoB;AAAA,UAClB,UAAUA,EAAE,2BAA2B;AAAA,UACvC,wBAAwBA,EAAE,2BAA2B;AAAA,QAAA;AAAA,MACvD;AAAA,IAAA;AAAA,IAEF,gBAAAI;AAAA,MAACE,EAAO;AAAA,MAAP;AAAA,QACC,OAAON,EAAE,oBAAoB;AAAA,QAC7B,oBAAoB;AAAA,UAClB,UAAUA,EAAE,2BAA2B;AAAA,UACvC,wBAAwBA,EAAE,iCAAiC;AAAA,QAAA;AAAA,MAC7D;AAAA,IAAA;AAAA,IAEF,gBAAAI;AAAA,MAACE,EAAO;AAAA,MAAP;AAAA,QACC,OAAON,EAAE,kBAAkB;AAAA,QAC3B,gBAAgB,CAACY,MACOZ,EAAtBY,MAAS,aAAe,wBAA2B,oBAAN;AAAA,MAA0B;AAAA,IAAA;AAAA,sBAG1EC,GAAA,EACE,UAAA;AAAA,MAAApB,KACC,gBAAAW,EAACF,EAAW,QAAX,EAAkB,SAAQ,aAAY,MAAK,UAAS,SAAST,GAC3D,UAAAO,EAAE,WAAW,EAAA,CAChB;AAAA,MAEF,gBAAAI,EAACF,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWJ,EAAS,OAAO,WACzD,UAAAE,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -2,10 +2,8 @@ import { jsx as o } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState as L, useCallback as k } from "react";
|
|
3
3
|
import { useTranslation as D } from "react-i18next";
|
|
4
4
|
import { useErrorBoundary as _ } from "react-error-boundary";
|
|
5
|
-
import "classnames";
|
|
6
|
-
import { componentEvents as E } from "../../../../../shared/constants.js";
|
|
7
5
|
import { Loading as T } from "../../../../Common/Loading/Loading.js";
|
|
8
|
-
import { EmptyData as
|
|
6
|
+
import { EmptyData as E } from "../../../../Common/EmptyData/EmptyData.js";
|
|
9
7
|
import { BaseBoundaries as O, BaseLayout as M } from "../../../../Base/Base.js";
|
|
10
8
|
import { useComponentContext as S } from "../../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
9
|
import { openPdfInNewTab as U } from "../../../../../helpers/openPdfInNewTab.js";
|
|
@@ -14,12 +12,13 @@ import { usePaymentMethodList as H } from "../../../PaymentMethod/shared/usePaym
|
|
|
14
12
|
import { formatDateLongWithYear as R } from "../../../../../helpers/dateFormatting.js";
|
|
15
13
|
import W from "../../../../../hooks/useNumberFormatter.js";
|
|
16
14
|
import { useI18n as j } from "../../../../../i18n/I18n.js";
|
|
15
|
+
import { componentEvents as w } from "../../../../../shared/constants.js";
|
|
17
16
|
import F from "../../../../../assets/icons/download-cloud.svg.js";
|
|
18
17
|
import { usePaystubsList as V } from "../../shared/usePaystubsList/usePaystubsList.js";
|
|
19
18
|
import { useNonce as v } from "../../../../../contexts/NonceProvider/useNonce.js";
|
|
20
19
|
import { useDataView as G } from "../../../../Common/DataView/useDataView.js";
|
|
21
20
|
import { DataView as Q } from "../../../../Common/DataView/DataView.js";
|
|
22
|
-
function
|
|
21
|
+
function pt({ LoaderComponent: a, ...i }) {
|
|
23
22
|
return /* @__PURE__ */ o(O, { componentName: "Employee.Management.Paystubs", LoaderComponent: a, children: /* @__PURE__ */ o(q, { LoaderComponent: a, ...i }) });
|
|
24
23
|
}
|
|
25
24
|
function q({ employeeId: a, onEvent: i, LoaderComponent: s }) {
|
|
@@ -49,7 +48,7 @@ function z({
|
|
|
49
48
|
() => /* @__PURE__ */ new Set()
|
|
50
49
|
), { payStubs: h } = s.data, C = s.pagination.payStubs, N = l.isLoading ? void 0 : l.data.paymentMethod, B = k(
|
|
51
50
|
async (t) => {
|
|
52
|
-
i(
|
|
51
|
+
i(w.EMPLOYEE_MANAGEMENT_PAYSTUBS_CARD_DOWNLOAD_REQUESTED, {
|
|
53
52
|
employeeId: a,
|
|
54
53
|
payrollUuid: t
|
|
55
54
|
});
|
|
@@ -64,7 +63,7 @@ function z({
|
|
|
64
63
|
r.close();
|
|
65
64
|
return;
|
|
66
65
|
}
|
|
67
|
-
r.navigate(n.data), i(
|
|
66
|
+
r.navigate(n.data), i(w.EMPLOYEE_MANAGEMENT_PAYSTUBS_CARD_DOWNLOADED, {
|
|
68
67
|
employeeId: a,
|
|
69
68
|
payrollUuid: t
|
|
70
69
|
});
|
|
@@ -130,18 +129,18 @@ function z({
|
|
|
130
129
|
}
|
|
131
130
|
);
|
|
132
131
|
},
|
|
133
|
-
emptyState: () => /* @__PURE__ */ o(
|
|
132
|
+
emptyState: () => /* @__PURE__ */ o(E, { title: e("emptyState.title"), description: e("emptyState.description") })
|
|
134
133
|
}), P = h.length > 0;
|
|
135
134
|
return /* @__PURE__ */ o(M, { error: u.errors, LoaderComponent: d, children: /* @__PURE__ */ o(
|
|
136
135
|
m.Box,
|
|
137
136
|
{
|
|
138
137
|
withPadding: !P,
|
|
139
138
|
header: /* @__PURE__ */ o(m.BoxHeader, { title: e("title") }),
|
|
140
|
-
children: P ? /* @__PURE__ */ o(Q, { label: e("listLabel"), isWithinBox: !0, ...x }) : /* @__PURE__ */ o(
|
|
139
|
+
children: P ? /* @__PURE__ */ o(Q, { label: e("listLabel"), isWithinBox: !0, ...x }) : /* @__PURE__ */ o(E, { title: e("emptyState.title"), description: e("emptyState.description") })
|
|
141
140
|
}
|
|
142
141
|
) });
|
|
143
142
|
}
|
|
144
143
|
export {
|
|
145
|
-
|
|
144
|
+
pt as PaystubsCard
|
|
146
145
|
};
|
|
147
146
|
//# sourceMappingURL=PaystubsCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaystubsCard.js","sources":["../../../../../../src/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.tsx"],"sourcesContent":["import { useCallback, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useErrorBoundary } from 'react-error-boundary'\nimport {\n usePaystubsList,\n type EmployeePayStub,\n type UsePaystubsListReady,\n} from '../../shared/usePaystubsList'\nimport { DataView, EmptyData, useDataView, Loading } from '@/components/Common'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useNonce } from '@/contexts/NonceProvider'\nimport { openPdfInNewTab } from '@/helpers/openPdfInNewTab'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport {\n usePaymentMethodList,\n type UsePaymentMethodListResult,\n} from '@/components/Employee/PaymentMethod/shared'\nimport { formatDateLongWithYear } from '@/helpers/dateFormatting'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { LoaderComponentType } from '@/components/Base'\nimport DownloadCloudIcon from '@/assets/icons/download-cloud.svg?react'\n\n/**\n * Props for {@link PaystubsCard}.\n *\n * @public\n */\nexport interface PaystubsCardProps {\n /** The associated employee identifier. */\n employeeId: string\n /** Event handler fired when paystub interactions occur. */\n onEvent: OnEventType<EventType, unknown>\n /** Custom loading indicator rendered while this component's async data is fetching. Overrides the indicator configured on `GustoProvider` for this instance only. */\n LoaderComponent?: LoaderComponentType\n}\n\n/**\n * Standalone \"Paystubs\" card. Owns its own data fetch via\n * {@link usePaystubsList} and renders the paginated paystubs table with a\n * per-row PDF download action. Emits the management block's scoped events\n * (`EMPLOYEE_MANAGEMENT_PAYSTUBS_CARD_*`) on download request and on\n * download success. The card has no edit transitions and no alert API —\n * paystubs is a read-only surface whose only action is a download side\n * effect that opens the PDF in a new tab.\n *\n * @public\n */\nexport function PaystubsCard({ LoaderComponent, ...props }: PaystubsCardProps) {\n return (\n <BaseBoundaries componentName=\"Employee.Management.Paystubs\" LoaderComponent={LoaderComponent}>\n <PaystubsCardContent LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction PaystubsCardContent({ employeeId, onEvent, LoaderComponent }: PaystubsCardProps) {\n useI18n('Employee.Management.Paystubs')\n const { t } = useTranslation('Employee.Management.Paystubs')\n const Components = useComponentContext()\n const paystubsList = usePaystubsList({ employeeId })\n const paymentMethodList = usePaymentMethodList({ employeeId })\n\n const errorHandling = composeErrorHandler([paystubsList, paymentMethodList])\n\n if (paystubsList.isLoading) {\n return (\n <BaseLayout error={errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box header={<Components.BoxHeader title={t('title')} />}>\n <Loading />\n </Components.Box>\n </BaseLayout>\n )\n }\n\n return (\n <PaystubsCardReady\n employeeId={employeeId}\n onEvent={onEvent}\n paystubsList={paystubsList}\n paymentMethodList={paymentMethodList}\n errorHandling={errorHandling}\n LoaderComponent={LoaderComponent}\n />\n )\n}\n\ninterface PaystubsCardReadyProps extends PaystubsCardProps {\n paystubsList: UsePaystubsListReady\n paymentMethodList: UsePaymentMethodListResult\n errorHandling: ReturnType<typeof composeErrorHandler>\n}\n\nfunction PaystubsCardReady({\n employeeId,\n onEvent,\n paystubsList,\n paymentMethodList,\n errorHandling,\n LoaderComponent,\n}: PaystubsCardReadyProps) {\n const { t } = useTranslation('Employee.Management.Paystubs')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const { showBoundary } = useErrorBoundary()\n const nonce = useNonce()\n\n const [downloadingPayrollUuids, setDownloadingPayrollUuids] = useState<ReadonlySet<string>>(\n () => new Set(),\n )\n\n const { payStubs } = paystubsList.data\n const payStubsPagination = paystubsList.pagination.payStubs\n const paymentMethod = paymentMethodList.isLoading\n ? undefined\n : paymentMethodList.data.paymentMethod\n\n const handleDownload = useCallback(\n async (payrollUuid: string) => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_PAYSTUBS_CARD_DOWNLOAD_REQUESTED, {\n employeeId,\n payrollUuid,\n })\n\n const tab = openPdfInNewTab({ loadingMessage: t('downloadLoadingMessage'), nonce })\n setDownloadingPayrollUuids(prev => {\n const next = new Set(prev)\n next.add(payrollUuid)\n return next\n })\n try {\n const result = await paystubsList.actions.downloadPayStub(payrollUuid)\n if (!result) {\n tab.close()\n return\n }\n tab.navigate(result.data)\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_PAYSTUBS_CARD_DOWNLOADED, {\n employeeId,\n payrollUuid,\n })\n } catch (err) {\n tab.close()\n showBoundary(err instanceof Error ? err : new Error(String(err)))\n } finally {\n setDownloadingPayrollUuids(prev => {\n if (!prev.has(payrollUuid)) return prev\n const next = new Set(prev)\n next.delete(payrollUuid)\n return next\n })\n }\n },\n [paystubsList.actions, onEvent, employeeId, t, showBoundary, nonce],\n )\n\n const payStubsColumns = [\n {\n key: 'payday',\n title: t('payday'),\n render: (payStub: EmployeePayStub) => formatDateLongWithYear(payStub.checkDate) || '-',\n },\n {\n key: 'checkAmount',\n title: t('checkAmount'),\n justify: 'end' as const,\n render: (payStub: EmployeePayStub) => {\n if (!payStub.netPay) return '-'\n const amount = parseFloat(payStub.netPay)\n return isNaN(amount) ? '-' : formatCurrency(amount)\n },\n },\n {\n key: 'grossPay',\n title: t('grossPay'),\n justify: 'end' as const,\n render: (payStub: EmployeePayStub) => {\n if (!payStub.grossPay) return '-'\n const amount = parseFloat(payStub.grossPay)\n return isNaN(amount) ? '-' : formatCurrency(amount)\n },\n },\n {\n key: 'paymentMethod',\n title: t('paymentMethod'),\n render: () => paymentMethod?.type || t('noPaymentMethod'),\n },\n ]\n\n const payStubsDataView = useDataView({\n data: payStubs,\n columns: payStubsColumns,\n pagination: payStubsPagination,\n itemMenu: payStub => {\n const isDownloading =\n !!payStub.payrollUuid && downloadingPayrollUuids.has(payStub.payrollUuid)\n return (\n <Components.ButtonIcon\n variant=\"tertiary\"\n aria-label={t('downloadCta')}\n isDisabled={!payStub.payrollUuid}\n isLoading={isDownloading}\n onClick={() => {\n if (payStub.payrollUuid) {\n void handleDownload(payStub.payrollUuid)\n }\n }}\n >\n <DownloadCloudIcon aria-hidden />\n </Components.ButtonIcon>\n )\n },\n emptyState: () => (\n <EmptyData title={t('emptyState.title')} description={t('emptyState.description')} />\n ),\n })\n\n const isShowingTable = payStubs.length > 0\n\n return (\n <BaseLayout error={errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box\n withPadding={!isShowingTable}\n header={<Components.BoxHeader title={t('title')} />}\n >\n {isShowingTable ? (\n <DataView label={t('listLabel')} isWithinBox {...payStubsDataView} />\n ) : (\n <EmptyData title={t('emptyState.title')} description={t('emptyState.description')} />\n )}\n </Components.Box>\n </BaseLayout>\n )\n}\n"],"names":["PaystubsCard","LoaderComponent","props","jsx","BaseBoundaries","PaystubsCardContent","employeeId","onEvent","useI18n","t","useTranslation","Components","useComponentContext","paystubsList","usePaystubsList","paymentMethodList","usePaymentMethodList","errorHandling","composeErrorHandler","BaseLayout","Loading","PaystubsCardReady","formatCurrency","useNumberFormatter","showBoundary","useErrorBoundary","nonce","useNonce","downloadingPayrollUuids","setDownloadingPayrollUuids","useState","payStubs","payStubsPagination","paymentMethod","handleDownload","useCallback","payrollUuid","componentEvents","tab","openPdfInNewTab","prev","next","result","err","payStubsColumns","payStub","formatDateLongWithYear","amount","payStubsDataView","useDataView","isDownloading","DownloadCloudIcon","EmptyData","isShowingTable","DataView"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmDO,SAASA,GAAa,EAAE,iBAAAC,GAAiB,GAAGC,KAA4B;AAC7E,SACE,gBAAAC,EAACC,GAAA,EAAe,eAAc,gCAA+B,iBAAAH,GAC3D,4BAACI,GAAA,EAAoB,iBAAAJ,GAAmC,GAAGC,EAAA,CAAO,EAAA,CACpE;AAEJ;AAEA,SAASG,EAAoB,EAAE,YAAAC,GAAY,SAAAC,GAAS,iBAAAN,KAAsC;AACxF,EAAAO,EAAQ,8BAA8B;AACtC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,8BAA8B,GACrDC,IAAaC,EAAA,GACbC,IAAeC,EAAgB,EAAE,YAAAR,GAAY,GAC7CS,IAAoBC,EAAqB,EAAE,YAAAV,GAAY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,OAAOF,EAAE,OAAO,GAAG;AAAA,MAEhD,UAAA4C,sBACEC,GAAA,EAAS,OAAO7C,EAAE,WAAW,GAAG,aAAW,IAAE,GAAGuC,GAAkB,IAEnE,gBAAA7C,EAACiD,KAAU,OAAO3C,EAAE,kBAAkB,GAAG,aAAaA,EAAE,wBAAwB,EAAA,CAAG;AAAA,IAAA;AAAA,EAAA,GAGzF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PaystubsCard.js","sources":["../../../../../../src/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.tsx"],"sourcesContent":["import { useCallback, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useErrorBoundary } from 'react-error-boundary'\nimport {\n usePaystubsList,\n type EmployeePayStub,\n type UsePaystubsListReady,\n} from '../../shared/usePaystubsList'\nimport { DataView, EmptyData, useDataView, Loading } from '@/components/Common'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useNonce } from '@/contexts/NonceProvider'\nimport { openPdfInNewTab } from '@/helpers/openPdfInNewTab'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport {\n usePaymentMethodList,\n type UsePaymentMethodListResult,\n} from '@/components/Employee/PaymentMethod/shared'\nimport { formatDateLongWithYear } from '@/helpers/dateFormatting'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { LoaderComponentType } from '@/components/Base'\nimport DownloadCloudIcon from '@/assets/icons/download-cloud.svg?react'\n\n/**\n * Props for {@link PaystubsCard}.\n *\n * @public\n */\nexport interface PaystubsCardProps {\n /** The associated employee identifier. */\n employeeId: string\n /** Event handler fired when paystub interactions occur. */\n onEvent: OnEventType<EventType, unknown>\n /** Custom loading indicator rendered while this component's async data is fetching. Overrides the indicator configured on `GustoProvider` for this instance only. */\n LoaderComponent?: LoaderComponentType\n}\n\n/**\n * Standalone \"Paystubs\" card. Owns its own data fetch via\n * {@link usePaystubsList} and renders the paginated paystubs table with a\n * per-row PDF download action. Emits the management block's scoped events\n * (`EMPLOYEE_MANAGEMENT_PAYSTUBS_CARD_*`) on download request and on\n * download success. The card has no edit transitions and no alert API —\n * paystubs is a read-only surface whose only action is a download side\n * effect that opens the PDF in a new tab.\n *\n * @public\n */\nexport function PaystubsCard({ LoaderComponent, ...props }: PaystubsCardProps) {\n return (\n <BaseBoundaries componentName=\"Employee.Management.Paystubs\" LoaderComponent={LoaderComponent}>\n <PaystubsCardContent LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction PaystubsCardContent({ employeeId, onEvent, LoaderComponent }: PaystubsCardProps) {\n useI18n('Employee.Management.Paystubs')\n const { t } = useTranslation('Employee.Management.Paystubs')\n const Components = useComponentContext()\n const paystubsList = usePaystubsList({ employeeId })\n const paymentMethodList = usePaymentMethodList({ employeeId })\n\n const errorHandling = composeErrorHandler([paystubsList, paymentMethodList])\n\n if (paystubsList.isLoading) {\n return (\n <BaseLayout error={errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box header={<Components.BoxHeader title={t('title')} />}>\n <Loading />\n </Components.Box>\n </BaseLayout>\n )\n }\n\n return (\n <PaystubsCardReady\n employeeId={employeeId}\n onEvent={onEvent}\n paystubsList={paystubsList}\n paymentMethodList={paymentMethodList}\n errorHandling={errorHandling}\n LoaderComponent={LoaderComponent}\n />\n )\n}\n\ninterface PaystubsCardReadyProps extends PaystubsCardProps {\n paystubsList: UsePaystubsListReady\n paymentMethodList: UsePaymentMethodListResult\n errorHandling: ReturnType<typeof composeErrorHandler>\n}\n\nfunction PaystubsCardReady({\n employeeId,\n onEvent,\n paystubsList,\n paymentMethodList,\n errorHandling,\n LoaderComponent,\n}: PaystubsCardReadyProps) {\n const { t } = useTranslation('Employee.Management.Paystubs')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const { showBoundary } = useErrorBoundary()\n const nonce = useNonce()\n\n const [downloadingPayrollUuids, setDownloadingPayrollUuids] = useState<ReadonlySet<string>>(\n () => new Set(),\n )\n\n const { payStubs } = paystubsList.data\n const payStubsPagination = paystubsList.pagination.payStubs\n const paymentMethod = paymentMethodList.isLoading\n ? undefined\n : paymentMethodList.data.paymentMethod\n\n const handleDownload = useCallback(\n async (payrollUuid: string) => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_PAYSTUBS_CARD_DOWNLOAD_REQUESTED, {\n employeeId,\n payrollUuid,\n })\n\n const tab = openPdfInNewTab({ loadingMessage: t('downloadLoadingMessage'), nonce })\n setDownloadingPayrollUuids(prev => {\n const next = new Set(prev)\n next.add(payrollUuid)\n return next\n })\n try {\n const result = await paystubsList.actions.downloadPayStub(payrollUuid)\n if (!result) {\n tab.close()\n return\n }\n tab.navigate(result.data)\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_PAYSTUBS_CARD_DOWNLOADED, {\n employeeId,\n payrollUuid,\n })\n } catch (err) {\n tab.close()\n showBoundary(err instanceof Error ? err : new Error(String(err)))\n } finally {\n setDownloadingPayrollUuids(prev => {\n if (!prev.has(payrollUuid)) return prev\n const next = new Set(prev)\n next.delete(payrollUuid)\n return next\n })\n }\n },\n [paystubsList.actions, onEvent, employeeId, t, showBoundary, nonce],\n )\n\n const payStubsColumns = [\n {\n key: 'payday',\n title: t('payday'),\n render: (payStub: EmployeePayStub) => formatDateLongWithYear(payStub.checkDate) || '-',\n },\n {\n key: 'checkAmount',\n title: t('checkAmount'),\n justify: 'end' as const,\n render: (payStub: EmployeePayStub) => {\n if (!payStub.netPay) return '-'\n const amount = parseFloat(payStub.netPay)\n return isNaN(amount) ? '-' : formatCurrency(amount)\n },\n },\n {\n key: 'grossPay',\n title: t('grossPay'),\n justify: 'end' as const,\n render: (payStub: EmployeePayStub) => {\n if (!payStub.grossPay) return '-'\n const amount = parseFloat(payStub.grossPay)\n return isNaN(amount) ? '-' : formatCurrency(amount)\n },\n },\n {\n key: 'paymentMethod',\n title: t('paymentMethod'),\n render: () => paymentMethod?.type || t('noPaymentMethod'),\n },\n ]\n\n const payStubsDataView = useDataView({\n data: payStubs,\n columns: payStubsColumns,\n pagination: payStubsPagination,\n itemMenu: payStub => {\n const isDownloading =\n !!payStub.payrollUuid && downloadingPayrollUuids.has(payStub.payrollUuid)\n return (\n <Components.ButtonIcon\n variant=\"tertiary\"\n aria-label={t('downloadCta')}\n isDisabled={!payStub.payrollUuid}\n isLoading={isDownloading}\n onClick={() => {\n if (payStub.payrollUuid) {\n void handleDownload(payStub.payrollUuid)\n }\n }}\n >\n <DownloadCloudIcon aria-hidden />\n </Components.ButtonIcon>\n )\n },\n emptyState: () => (\n <EmptyData title={t('emptyState.title')} description={t('emptyState.description')} />\n ),\n })\n\n const isShowingTable = payStubs.length > 0\n\n return (\n <BaseLayout error={errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box\n withPadding={!isShowingTable}\n header={<Components.BoxHeader title={t('title')} />}\n >\n {isShowingTable ? (\n <DataView label={t('listLabel')} isWithinBox {...payStubsDataView} />\n ) : (\n <EmptyData title={t('emptyState.title')} description={t('emptyState.description')} />\n )}\n </Components.Box>\n </BaseLayout>\n )\n}\n"],"names":["PaystubsCard","LoaderComponent","props","jsx","BaseBoundaries","PaystubsCardContent","employeeId","onEvent","useI18n","t","useTranslation","Components","useComponentContext","paystubsList","usePaystubsList","paymentMethodList","usePaymentMethodList","errorHandling","composeErrorHandler","BaseLayout","Loading","PaystubsCardReady","formatCurrency","useNumberFormatter","showBoundary","useErrorBoundary","nonce","useNonce","downloadingPayrollUuids","setDownloadingPayrollUuids","useState","payStubs","payStubsPagination","paymentMethod","handleDownload","useCallback","payrollUuid","componentEvents","tab","openPdfInNewTab","prev","next","result","err","payStubsColumns","payStub","formatDateLongWithYear","amount","payStubsDataView","useDataView","isDownloading","DownloadCloudIcon","EmptyData","isShowingTable","DataView"],"m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EAAQ,WAAW;AAAA,UAE3C;AAAA,UAEA,UAAA,gBAAA1C,EAACgD,GAAA,EAAkB,eAAW,GAAA,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAGrC;AAAA,IACA,YAAY,MACV,gBAAAhD,EAACiD,GAAA,EAAU,OAAO3C,EAAE,kBAAkB,GAAG,aAAaA,EAAE,wBAAwB,EAAA,CAAG;AAAA,EAAA,CAEtF,GAEK4C,IAAiBtB,EAAS,SAAS;AAEzC,SACE,gBAAA5B,EAACgB,GAAA,EAAW,OAAOF,EAAc,QAAQ,iBAAAhB,GACvC,UAAA,gBAAAE;AAAA,IAACQ,EAAW;AAAA,IAAX;AAAA,MACC,aAAa,CAAC0C;AAAA,MACd,0BAAS1C,EAAW,WAAX,EAAqB,OAAOF,EAAE,OAAO,GAAG;AAAA,MAEhD,UAAA4C,sBACEC,GAAA,EAAS,OAAO7C,EAAE,WAAW,GAAG,aAAW,IAAE,GAAGuC,GAAkB,IAEnE,gBAAA7C,EAACiD,KAAU,OAAO3C,EAAE,kBAAkB,GAAG,aAAaA,EAAE,wBAAwB,EAAA,CAAG;AAAA,IAAA;AAAA,EAAA,GAGzF;AAEJ;"}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as y } from "react-i18next";
|
|
3
|
-
import "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { BaseBoundaries as B, BaseLayout as L } from "../../../../Base/Base.js";
|
|
7
|
-
import { useComponentContext as N } from "../../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
3
|
+
import { Loading as g } from "../../../../Common/Loading/Loading.js";
|
|
4
|
+
import { BaseBoundaries as P, BaseLayout as B } from "../../../../Base/Base.js";
|
|
5
|
+
import { useComponentContext as L } from "../../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
8
6
|
import { formatDateLongWithYear as l } from "../../../../../helpers/dateFormatting.js";
|
|
9
|
-
import { firstLastName as
|
|
10
|
-
import { useI18n as
|
|
7
|
+
import { firstLastName as N } from "../../../../../helpers/formattedStrings.js";
|
|
8
|
+
import { useI18n as X } from "../../../../../i18n/I18n.js";
|
|
9
|
+
import { componentEvents as D } from "../../../../../shared/constants.js";
|
|
11
10
|
import { useEmployeeProfileSummary as v } from "../../shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js";
|
|
12
|
-
function
|
|
13
|
-
return /* @__PURE__ */ t(
|
|
11
|
+
function A({ LoaderComponent: r, ...m }) {
|
|
12
|
+
return /* @__PURE__ */ t(P, { componentName: "Employee.Management.Profile", LoaderComponent: r, children: /* @__PURE__ */ t(C, { LoaderComponent: r, ...m }) });
|
|
14
13
|
}
|
|
15
14
|
function C({ employeeId: r, onEvent: m, LoaderComponent: d }) {
|
|
16
|
-
|
|
17
|
-
const { t: o } = y("Employee.Management.Profile"), n =
|
|
15
|
+
X("Employee.Management.Profile");
|
|
16
|
+
const { t: o } = y("Employee.Management.Profile"), n = L(), a = v({ employeeId: r }), s = a.isLoading, e = a.isLoading ? void 0 : a.data.employee, c = e ? N({ first_name: e.firstName, last_name: e.lastName }) : void 0, p = e ? l(e.jobs?.[0]?.hireDate) : void 0, f = e ? l(e.dateOfBirth) : void 0, E = e?.hasSsn ? "XXX-XX-XXXX" : void 0, i = /* @__PURE__ */ t("span", { "aria-label": o("listEmptyPlaceholder"), children: "–" }), h = e ? [
|
|
18
17
|
{ term: o("legalName"), description: c || i },
|
|
19
18
|
{ term: o("startDate"), description: p || i },
|
|
20
19
|
{ term: o("socialSecurityNumber"), description: E || i },
|
|
21
20
|
{ term: o("dateOfBirth"), description: f || i },
|
|
22
21
|
{ term: o("personalEmail"), description: e.email || i }
|
|
23
22
|
] : [], u = () => {
|
|
24
|
-
m(
|
|
23
|
+
m(D.EMPLOYEE_MANAGEMENT_PROFILE_EDIT_REQUESTED, { employeeId: r });
|
|
25
24
|
};
|
|
26
|
-
return /* @__PURE__ */ t(
|
|
25
|
+
return /* @__PURE__ */ t(B, { error: a.errorHandling.errors, LoaderComponent: d, children: /* @__PURE__ */ t(
|
|
27
26
|
n.Box,
|
|
28
27
|
{
|
|
29
28
|
header: /* @__PURE__ */ t(
|
|
@@ -41,11 +40,11 @@ function C({ employeeId: r, onEvent: m, LoaderComponent: d }) {
|
|
|
41
40
|
)
|
|
42
41
|
}
|
|
43
42
|
),
|
|
44
|
-
children: s ? /* @__PURE__ */ t(
|
|
43
|
+
children: s ? /* @__PURE__ */ t(g, {}) : e ? /* @__PURE__ */ t(n.DescriptionList, { items: h }) : null
|
|
45
44
|
}
|
|
46
45
|
) });
|
|
47
46
|
}
|
|
48
47
|
export {
|
|
49
|
-
|
|
48
|
+
A as ProfileCard
|
|
50
49
|
};
|
|
51
50
|
//# sourceMappingURL=ProfileCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileCard.js","sources":["../../../../../../src/components/Employee/Profile/management/ProfileCard/ProfileCard.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEmployeeProfileSummary } from '../../shared/useEmployeeProfileSummary'\nimport { Loading } from '@/components/Common'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { formatDateLongWithYear } from '@/helpers/dateFormatting'\nimport { firstLastName } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { LoaderComponentType } from '@/components/Base'\n\n/**\n * Props for {@link ProfileCard}.\n *\n * @public\n */\nexport interface ProfileCardProps {\n /** The associated employee identifier. */\n employeeId: string\n /** Event handler fired when the user requests to edit the profile. */\n onEvent: OnEventType<EventType, unknown>\n /** Custom loading indicator rendered while this component's async data is fetching. Overrides the indicator configured on `GustoProvider` for this instance only. */\n LoaderComponent?: LoaderComponentType\n}\n\n/**\n * Read-only card showing an employee's basic profile details with an Edit action.\n *\n * @remarks\n * Standalone card that fetches its own data. Emits an event when the user\n * clicks Edit so the parent can switch to the edit form. The card does not\n * render success or error alerts itself — alert presentation is the\n * surrounding surface's responsibility.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/management/profile/editRequested` | Fired when the user clicks the Edit button | `{ employeeId: string }` |\n *\n * @param props - See {@link ProfileCardProps}.\n * @returns The basic-details profile card.\n * @public\n */\nexport function ProfileCard({ LoaderComponent, ...props }: ProfileCardProps) {\n return (\n <BaseBoundaries componentName=\"Employee.Management.Profile\" LoaderComponent={LoaderComponent}>\n <ProfileCardContent LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction ProfileCardContent({ employeeId, onEvent, LoaderComponent }: ProfileCardProps) {\n useI18n('Employee.Management.Profile')\n const { t } = useTranslation('Employee.Management.Profile')\n const Components = useComponentContext()\n\n const profile = useEmployeeProfileSummary({ employeeId })\n\n const isEmployeeLoading = profile.isLoading\n\n const employee = profile.isLoading ? undefined : profile.data.employee\n\n const legalName = employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : undefined\n const startDate = employee ? formatDateLongWithYear(employee.jobs?.[0]?.hireDate) : undefined\n const dateOfBirth = employee ? formatDateLongWithYear(employee.dateOfBirth) : undefined\n const maskedSsn = employee?.hasSsn ? 'XXX-XX-XXXX' : undefined\n\n const emptyPlaceholder = <span aria-label={t('listEmptyPlaceholder')}>–</span>\n const profileItems = employee\n ? [\n { term: t('legalName'), description: legalName || emptyPlaceholder },\n { term: t('startDate'), description: startDate || emptyPlaceholder },\n { term: t('socialSecurityNumber'), description: maskedSsn || emptyPlaceholder },\n { term: t('dateOfBirth'), description: dateOfBirth || emptyPlaceholder },\n { term: t('personalEmail'), description: employee.email || emptyPlaceholder },\n ]\n : []\n\n const handleEdit = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_PROFILE_EDIT_REQUESTED, { employeeId })\n }\n\n return (\n <BaseLayout error={profile.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('title')}\n action={\n <Components.Button\n variant=\"secondary\"\n onClick={handleEdit}\n isDisabled={isEmployeeLoading}\n >\n {t('editCta')}\n </Components.Button>\n }\n />\n }\n >\n {isEmployeeLoading ? (\n <Loading />\n ) : employee ? (\n <Components.DescriptionList items={profileItems} />\n ) : null}\n </Components.Box>\n </BaseLayout>\n )\n}\n"],"names":["ProfileCard","LoaderComponent","props","jsx","BaseBoundaries","ProfileCardContent","employeeId","onEvent","useI18n","t","useTranslation","Components","useComponentContext","profile","useEmployeeProfileSummary","isEmployeeLoading","employee","legalName","firstLastName","startDate","formatDateLongWithYear","dateOfBirth","maskedSsn","emptyPlaceholder","profileItems","handleEdit","componentEvents","BaseLayout","Loading"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProfileCard.js","sources":["../../../../../../src/components/Employee/Profile/management/ProfileCard/ProfileCard.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEmployeeProfileSummary } from '../../shared/useEmployeeProfileSummary'\nimport { Loading } from '@/components/Common'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { formatDateLongWithYear } from '@/helpers/dateFormatting'\nimport { firstLastName } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { LoaderComponentType } from '@/components/Base'\n\n/**\n * Props for {@link ProfileCard}.\n *\n * @public\n */\nexport interface ProfileCardProps {\n /** The associated employee identifier. */\n employeeId: string\n /** Event handler fired when the user requests to edit the profile. */\n onEvent: OnEventType<EventType, unknown>\n /** Custom loading indicator rendered while this component's async data is fetching. Overrides the indicator configured on `GustoProvider` for this instance only. */\n LoaderComponent?: LoaderComponentType\n}\n\n/**\n * Read-only card showing an employee's basic profile details with an Edit action.\n *\n * @remarks\n * Standalone card that fetches its own data. Emits an event when the user\n * clicks Edit so the parent can switch to the edit form. The card does not\n * render success or error alerts itself — alert presentation is the\n * surrounding surface's responsibility.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/management/profile/editRequested` | Fired when the user clicks the Edit button | `{ employeeId: string }` |\n *\n * @param props - See {@link ProfileCardProps}.\n * @returns The basic-details profile card.\n * @public\n */\nexport function ProfileCard({ LoaderComponent, ...props }: ProfileCardProps) {\n return (\n <BaseBoundaries componentName=\"Employee.Management.Profile\" LoaderComponent={LoaderComponent}>\n <ProfileCardContent LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction ProfileCardContent({ employeeId, onEvent, LoaderComponent }: ProfileCardProps) {\n useI18n('Employee.Management.Profile')\n const { t } = useTranslation('Employee.Management.Profile')\n const Components = useComponentContext()\n\n const profile = useEmployeeProfileSummary({ employeeId })\n\n const isEmployeeLoading = profile.isLoading\n\n const employee = profile.isLoading ? undefined : profile.data.employee\n\n const legalName = employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : undefined\n const startDate = employee ? formatDateLongWithYear(employee.jobs?.[0]?.hireDate) : undefined\n const dateOfBirth = employee ? formatDateLongWithYear(employee.dateOfBirth) : undefined\n const maskedSsn = employee?.hasSsn ? 'XXX-XX-XXXX' : undefined\n\n const emptyPlaceholder = <span aria-label={t('listEmptyPlaceholder')}>–</span>\n const profileItems = employee\n ? [\n { term: t('legalName'), description: legalName || emptyPlaceholder },\n { term: t('startDate'), description: startDate || emptyPlaceholder },\n { term: t('socialSecurityNumber'), description: maskedSsn || emptyPlaceholder },\n { term: t('dateOfBirth'), description: dateOfBirth || emptyPlaceholder },\n { term: t('personalEmail'), description: employee.email || emptyPlaceholder },\n ]\n : []\n\n const handleEdit = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_PROFILE_EDIT_REQUESTED, { employeeId })\n }\n\n return (\n <BaseLayout error={profile.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('title')}\n action={\n <Components.Button\n variant=\"secondary\"\n onClick={handleEdit}\n isDisabled={isEmployeeLoading}\n >\n {t('editCta')}\n </Components.Button>\n }\n />\n }\n >\n {isEmployeeLoading ? (\n <Loading />\n ) : employee ? (\n <Components.DescriptionList items={profileItems} />\n ) : null}\n </Components.Box>\n </BaseLayout>\n )\n}\n"],"names":["ProfileCard","LoaderComponent","props","jsx","BaseBoundaries","ProfileCardContent","employeeId","onEvent","useI18n","t","useTranslation","Components","useComponentContext","profile","useEmployeeProfileSummary","isEmployeeLoading","employee","legalName","firstLastName","startDate","formatDateLongWithYear","dateOfBirth","maskedSsn","emptyPlaceholder","profileItems","handleEdit","componentEvents","BaseLayout","Loading"],"mappings":";;;;;;;;;;AA4CO,SAASA,EAAY,EAAE,iBAAAC,GAAiB,GAAGC,KAA2B;AAC3E,SACE,gBAAAC,EAACC,GAAA,EAAe,eAAc,+BAA8B,iBAAAH,GAC1D,4BAACI,GAAA,EAAmB,iBAAAJ,GAAmC,GAAGC,EAAA,CAAO,EAAA,CACnE;AAEJ;AAEA,SAASG,EAAmB,EAAE,YAAAC,GAAY,SAAAC,GAAS,iBAAAN,KAAqC;AACtF,EAAAO,EAAQ,6BAA6B;AACrC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,6BAA6B,GACpDC,IAAaC,EAAA,GAEbC,IAAUC,EAA0B,EAAE,YAAAR,GAAY,GAElDS,IAAoBF,EAAQ,WAE5BG,IAAWH,EAAQ,YAAY,SAAYA,EAAQ,KAAK,UAExDI,IAAYD,IACdE,EAAc,EAAE,YAAYF,EAAS,WAAW,WAAWA,EAAS,SAAA,CAAU,IAC9E,QACEG,IAAYH,IAAWI,EAAuBJ,EAAS,OAAO,CAAC,GAAG,QAAQ,IAAI,QAC9EK,IAAcL,IAAWI,EAAuBJ,EAAS,WAAW,IAAI,QACxEM,IA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