@gusto/embedded-react-sdk 0.55.8 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +43 -42
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +4 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +4 -3
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js +70 -69
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js +2 -2
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js +51 -42
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js +29 -26
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +2 -2
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +11 -11
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js +3 -3
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +76 -79
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +2 -2
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +2 -2
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js +10 -10
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +49 -45
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +83 -76
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +63 -60
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +184 -165
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js +48 -34
- package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +185 -171
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js +45 -34
- package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +44 -44
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.module.scss.js +14 -14
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js +16 -16
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js +52 -37
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +9 -8
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +29 -28
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/apiVersionMismatchHook.js +15 -0
- package/dist/contexts/ApiProvider/apiVersionMismatchHook.js.map +1 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ThemeProvider/ThemeProvider.js +32 -26
- package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/hooks/usePollingTask/usePollingTask.js +53 -41
- package/dist/hooks/usePollingTask/usePollingTask.js.map +1 -1
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js +28 -24
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js.map +1 -1
- package/dist/i18n/en/Payroll.GrossUpModal.json.js +12 -10
- package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +8 -8
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +15 -15
- package/dist/package.json.js +1 -1
- package/dist/src/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +1 -1
- package/dist/src/components/Common/UI/DatePicker/DatePickerTypes.d.ts +2 -1
- package/dist/src/components/Common/UI/Menu/MenuTypes.d.ts +1 -1
- package/dist/src/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.d.ts +1 -1
- package/dist/src/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +5 -0
- package/dist/src/components/Common/UI/Select/SelectTypes.d.ts +2 -1
- package/dist/src/components/Employee/EmployeeList/shared/useEmployeeList.d.ts +7 -2
- package/dist/src/components/Employee/EmployeeListFlow/employeeListStateMachine.test.d.ts +1 -0
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +6 -0
- package/dist/src/components/Payroll/PayrollConfiguration/useCalculationPoll.d.ts +6 -1
- package/dist/src/components/Payroll/PayrollOverview/useSubmissionPoll.d.ts +10 -1
- package/dist/src/contexts/ApiProvider/ApiProvider.d.ts +5 -3
- package/dist/src/contexts/ApiProvider/apiVersionMismatchHook.d.ts +3 -0
- package/dist/src/contexts/ApiProvider/apiVersionMismatchHook.test.d.ts +1 -0
- package/dist/src/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +9 -1
- package/dist/src/contexts/ThemeProvider/ThemeProvider.d.ts +8 -3
- package/dist/src/hooks/usePollingTask/usePollingTask.d.ts +55 -14
- package/dist/src/i18n/types.d.ts +14 -0
- package/dist/style.css +1 -1
- package/docs/guides/endpoint-inventory.json +5 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkAddressView.js","sources":["../../../../../src/components/Employee/WorkAddress/management/WorkAddressView.tsx"],"sourcesContent":["import { useLayoutEffect, useMemo, useRef, useState } from 'react'\nimport { Trans, useTranslation } from 'react-i18next'\nimport type { Location } from '@gusto/embedded-api/models/components/location'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport {\n formatPendingWorkAddressLine,\n getPendingFutureWorkAddress,\n} from './getPendingFutureWorkAddress'\nimport ListIcon from '@/assets/icons/list.svg?react'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport {\n ActionsLayout,\n DataView,\n EmptyData,\n Grid,\n HamburgerMenu,\n useDataView,\n} from '@/components/Common'\nimport { Flex, FlexItem } from '@/components/Common/Flex/Flex'\nimport {\n LocationField,\n EffectiveDateField,\n} from '@/components/Employee/Profile/shared/useWorkAddressForm/fields'\nimport { WorkAddressErrorCodes } from '@/components/Employee/Profile/shared/useWorkAddressForm/workAddressSchema'\nimport type { UseWorkAddressFormReady } from '@/components/Employee/Profile/shared/useWorkAddressForm'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport type { HookSubmitResult } from '@/partner-hook-utils/types'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { addDays, formatDateLongWithYear, normalizeToDate } from '@/helpers/dateFormatting'\nimport { getCityStateZip, getStreet } from '@/helpers/formattedStrings'\n\n/** @internal */\nexport interface WorkAddressViewProps {\n editWorkAddressForm: UseWorkAddressFormReady\n changeWorkAddressForm: UseWorkAddressFormReady\n /** Full list for history table, pending-future alert, and delete-confirmation lookup. */\n workAddresses: EmployeeWorkAddress[] | undefined\n editTargetUuid: string | undefined\n onEditTargetUuidChange: (uuid: string | undefined) => void\n employeeDisplayName: string\n onConfirmDelete: (workAddressUuid: string) => Promise<boolean>\n onWorkAddressSaved: (result: HookSubmitResult<EmployeeWorkAddress>) => void\n onBack: () => void\n isDeletePending?: boolean\n /** CSS class name applied to the root element. */\n className?: string\n}\n\nfunction resolveLocation(\n row: EmployeeWorkAddress,\n companyLocations: Location[] | undefined,\n): Location | undefined {\n if (!row.locationUuid || !companyLocations?.length) {\n return undefined\n }\n return companyLocations.find(loc => loc.uuid === row.locationUuid)\n}\n\nfunction formatWorkAddressLines(\n row: EmployeeWorkAddress,\n companyLocations: Location[] | undefined,\n): { primary: string; secondary: string } {\n const location = resolveLocation(row, companyLocations)\n if (location) {\n const street = getStreet(location).trim()\n const locality = getCityStateZip(location).trim()\n return { primary: street, secondary: locality }\n }\n const street = getStreet(row).trim()\n const locality = getCityStateZip(row).trim()\n return { primary: street, secondary: locality }\n}\n\n/** @internal */\nexport function WorkAddressView({\n editWorkAddressForm,\n changeWorkAddressForm,\n workAddresses,\n editTargetUuid,\n onEditTargetUuidChange,\n employeeDisplayName,\n onConfirmDelete,\n onWorkAddressSaved,\n onBack,\n isDeletePending = false,\n className,\n}: WorkAddressViewProps) {\n const { t } = useTranslation('Employee.Management.WorkAddress')\n const Components = useComponentContext()\n const [addressModal, setAddressModal] = useState<'edit' | 'create' | null>(null)\n const [deleteConfirmUuid, setDeleteConfirmUuid] = useState<string | null>(null)\n const addressModalContainerRef = useRef<HTMLDivElement>(null)\n const [addressModalPortal, setAddressModalPortal] = useState<HTMLElement | undefined>(undefined)\n\n useLayoutEffect(() => {\n if (!addressModal) {\n setAddressModalPortal(undefined)\n return\n }\n const syncPortal = () => {\n setAddressModalPortal(addressModalContainerRef.current ?? undefined)\n }\n syncPortal()\n if (addressModalContainerRef.current == null) {\n const id = requestAnimationFrame(syncPortal)\n return () => {\n cancelAnimationFrame(id)\n }\n }\n }, [addressModal])\n\n const {\n data: { workAddress, companyLocations },\n status: editStatus,\n form: { Fields: editFormFields },\n } = editWorkAddressForm\n\n const editShowsEffectiveDateField = editFormFields.EffectiveDate != null\n\n const { status: createStatus } = changeWorkAddressForm\n\n const locationValidation = {\n [WorkAddressErrorCodes.REQUIRED]: t('form.locationRequired'),\n }\n\n const startDateValidation = {\n [WorkAddressErrorCodes.REQUIRED]: t('form.startDateRequired'),\n }\n\n const pendingFutureAddress = useMemo(\n () => getPendingFutureWorkAddress(workAddresses),\n [workAddresses],\n )\n\n const addressForDeleteModal = useMemo(() => {\n if (!deleteConfirmUuid || !workAddresses) {\n return undefined\n }\n return workAddresses.find(a => a.uuid === deleteConfirmUuid)\n }, [deleteConfirmUuid, workAddresses])\n\n const changePendingPossessiveLabel = useMemo(() => {\n const trimmed = employeeDisplayName.trim()\n return trimmed ? `${trimmed}'s` : t('changePendingPossessiveFallback')\n }, [employeeDisplayName, t])\n\n const chronologicalAsc = useMemo(() => {\n return [...(workAddresses ?? [])].sort((a, b) => {\n const aDate = a.effectiveDate ?? ''\n const bDate = b.effectiveDate ?? ''\n if (!aDate && !bDate) return 0\n if (!aDate) return 1\n if (!bDate) return -1\n return aDate.localeCompare(bDate)\n })\n }, [workAddresses])\n\n const historyAddresses = useMemo(\n () => chronologicalAsc.filter(address => address.active !== true),\n [chronologicalAsc],\n )\n\n const sortedHistory = useMemo(() => [...historyAddresses].reverse(), [historyAddresses])\n\n const historyEndDate = (row: EmployeeWorkAddress) => {\n const idx = chronologicalAsc.findIndex(a => a.uuid === row.uuid)\n if (idx === -1 || idx >= chronologicalAsc.length - 1) return '—'\n const nextStart = chronologicalAsc[idx + 1]?.effectiveDate\n if (!nextStart) return '—'\n const nextDate = normalizeToDate(nextStart)\n if (!nextDate) return '—'\n const endDate = addDays(nextDate, -1)\n const y = endDate.getFullYear()\n const m = String(endDate.getMonth() + 1).padStart(2, '0')\n const d = String(endDate.getDate()).padStart(2, '0')\n return formatDateLongWithYear(`${y}-${m}-${d}`)\n }\n\n const historyDataView = useDataView({\n data: sortedHistory,\n columns: [\n {\n title: t('columns.location'),\n render: (row: EmployeeWorkAddress) => {\n const lines = formatWorkAddressLines(row, companyLocations)\n return (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text weight=\"medium\">{lines.primary}</Components.Text>\n <Components.Text variant=\"supporting\">{lines.secondary}</Components.Text>\n </Flex>\n )\n },\n },\n {\n title: t('columns.startDate'),\n render: (row: EmployeeWorkAddress) =>\n row.effectiveDate ? formatDateLongWithYear(row.effectiveDate) : '—',\n },\n {\n title: t('columns.endDate'),\n render: (row: EmployeeWorkAddress) => historyEndDate(row),\n },\n ],\n itemMenu: (row: EmployeeWorkAddress) => (\n <HamburgerMenu\n triggerLabel={t('rowMenuAriaLabel')}\n items={[\n {\n label: t('rowEdit'),\n onClick: () => {\n onEditTargetUuidChange(row.uuid)\n setAddressModal('edit')\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('rowDelete'),\n onClick: () => {\n if (row.active === true) {\n return\n }\n setDeleteConfirmUuid(row.uuid)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n ),\n emptyState: () => (\n <div data-testid=\"work-address-history-empty\">\n <EmptyData\n icon={<ListIcon aria-hidden />}\n title={t('historyEmptyTitle')}\n description={t('historyEmptyDescription')}\n />\n </div>\n ),\n })\n\n const closeAddressModal = () => {\n setAddressModal(null)\n onEditTargetUuidChange(undefined)\n }\n\n const handleDeleteModalConfirm = async () => {\n if (!deleteConfirmUuid) {\n return\n }\n const deleted = await onConfirmDelete(deleteConfirmUuid)\n if (deleted) {\n setDeleteConfirmUuid(null)\n }\n }\n\n const handleSave = async () => {\n if (!addressModal) {\n return\n }\n\n if (addressModal === 'edit') {\n const result = await editWorkAddressForm.actions.onSubmit(\n undefined,\n editShowsEffectiveDateField ? undefined : { effectiveDate: workAddress?.effectiveDate },\n )\n if (result) {\n onWorkAddressSaved(result)\n closeAddressModal()\n }\n return\n }\n\n const result = await changeWorkAddressForm.actions.onSubmit()\n if (result) {\n onWorkAddressSaved(result)\n closeAddressModal()\n }\n }\n\n const modalPending = addressModal === 'edit' ? editStatus.isPending : createStatus.isPending\n\n const currentLines = workAddress ? formatWorkAddressLines(workAddress, companyLocations) : null\n const currentLocation =\n workAddress && companyLocations ? resolveLocation(workAddress, companyLocations) : undefined\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" gap={4} alignItems=\"flex-start\">\n <Components.Heading as=\"h1\" styledAs=\"h2\">\n {t('title')}\n </Components.Heading>\n <Components.Text variant=\"supporting\">{t('description')}</Components.Text>\n </Flex>\n\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('currentSectionTitle')}\n action={\n workAddress ? (\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEditTargetUuidChange(undefined)\n setAddressModal('edit')\n }}\n isLoading={editStatus.isPending}\n >\n {t('editCta')}\n </Components.Button>\n ) : undefined\n }\n />\n }\n footer={\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEditTargetUuidChange(undefined)\n setAddressModal('create')\n }}\n isLoading={createStatus.isPending}\n >\n {t('changeCta')}\n </Components.Button>\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n {workAddress && currentLines ? (\n <Flex flexDirection=\"column\" gap={4}>\n <FlexItem>\n {currentLocation ? (\n <>\n <Components.Text weight=\"medium\">\n {getStreet(currentLocation).trim()}\n </Components.Text>\n <Components.Text weight=\"medium\">\n {getCityStateZip(currentLocation)}\n </Components.Text>\n </>\n ) : (\n <>\n <Components.Text weight=\"medium\">{currentLines.primary}</Components.Text>\n <Components.Text weight=\"medium\">{currentLines.secondary}</Components.Text>\n </>\n )}\n </FlexItem>\n {workAddress.effectiveDate ? (\n <Components.Text variant=\"supporting\">\n {t('currentSince', {\n date: formatDateLongWithYear(workAddress.effectiveDate),\n })}\n </Components.Text>\n ) : null}\n </Flex>\n ) : (\n <Components.Text>{t('currentEmpty')}</Components.Text>\n )}\n {pendingFutureAddress ? (\n <Components.Alert status=\"warning\" label={t('changePendingTitle')}>\n <Components.Text variant=\"supporting\">\n {t('changePendingDescription', {\n possessiveLabel: changePendingPossessiveLabel,\n newAddress: formatPendingWorkAddressLine(\n pendingFutureAddress,\n companyLocations,\n ),\n effectiveDate: pendingFutureAddress.effectiveDate\n ? formatDateLongWithYear(pendingFutureAddress.effectiveDate)\n : '—',\n // Values are inserted into JSX text, so the browser already\n // escapes them. Telling i18next to escape too produces\n // double-encoded entities like `'` showing as text.\n interpolation: { escapeValue: false },\n })}\n </Components.Text>\n </Components.Alert>\n ) : null}\n </Flex>\n </Components.Box>\n\n <Flex flexDirection=\"column\" gap={12}>\n <Components.Heading as=\"h2\" styledAs=\"h4\">\n {t('historySectionTitle')}\n </Components.Heading>\n <DataView label={t('historySectionTitle')} {...historyDataView} />\n </Flex>\n\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={onBack}>\n {t('backCta')}\n </Components.Button>\n </ActionsLayout>\n\n <Components.Modal\n isOpen={addressModal !== null}\n onClose={closeAddressModal}\n shouldCloseOnBackdropClick={false}\n containerRef={addressModalContainerRef}\n footer={\n <Flex flexDirection=\"row\" gap={12} justifyContent=\"flex-end\">\n <Components.Button variant=\"secondary\" onClick={closeAddressModal}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button\n variant=\"primary\"\n onClick={() => {\n void handleSave()\n }}\n isLoading={modalPending}\n >\n {t('submitCta')}\n </Components.Button>\n </Flex>\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n <Components.Heading as=\"h2\">\n {addressModal === 'edit' ? t('editModalTitle') : t('changeModalTitle')}\n </Components.Heading>\n <Components.Text variant=\"supporting\">\n {addressModal === 'edit' ? t('editModalDescription') : t('changeModalDescription')}\n </Components.Text>\n {addressModal === 'edit' && editShowsEffectiveDateField ? (\n <Components.Alert status=\"warning\" label={t('editPastAddressAlertTitle')} />\n ) : null}\n {addressModal === 'edit' ? (\n <SDKFormProvider formHookResult={editWorkAddressForm}>\n <Grid\n gridTemplateColumns={{\n base: '1fr',\n small: '1fr',\n }}\n gap={20}\n >\n <LocationField\n label={\n editShowsEffectiveDateField\n ? t('form.editInactiveLocationLabel')\n : t('form.editLocationLabel')\n }\n description={t('form.editLocationDescription')}\n placeholder={t('form.selectPlaceholder')}\n validationMessages={locationValidation}\n portalContainer={addressModalPortal}\n />\n {editShowsEffectiveDateField ? (\n <EffectiveDateField\n label={t('form.startDateLabel')}\n description={t('form.editInactiveStartDateDescription')}\n validationMessages={startDateValidation}\n portalContainer={addressModalPortal}\n />\n ) : null}\n </Grid>\n </SDKFormProvider>\n ) : null}\n {addressModal === 'create' ? (\n <SDKFormProvider formHookResult={changeWorkAddressForm}>\n <Grid\n gridTemplateColumns={{\n base: '1fr',\n small: '1fr',\n }}\n gap={20}\n >\n <LocationField\n label={t('form.newWorkAddressLabel')}\n description={t('form.newWorkAddressDescription')}\n placeholder={t('form.selectPlaceholder')}\n validationMessages={locationValidation}\n portalContainer={addressModalPortal}\n />\n <EffectiveDateField\n label={t('form.startDateLabel')}\n description={t('form.startDateDescription')}\n validationMessages={startDateValidation}\n portalContainer={addressModalPortal}\n />\n </Grid>\n </SDKFormProvider>\n ) : null}\n </Flex>\n </Components.Modal>\n\n <Components.Modal\n isOpen={deleteConfirmUuid !== null}\n onClose={() => {\n setDeleteConfirmUuid(null)\n }}\n shouldCloseOnBackdropClick={false}\n footer={\n <Flex flexDirection=\"row\" gap={12} justifyContent=\"flex-end\">\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n setDeleteConfirmUuid(null)\n }}\n >\n {t('cancelCta')}\n </Components.Button>\n <Components.Button\n variant=\"error\"\n onClick={() => {\n void handleDeleteModalConfirm()\n }}\n isLoading={isDeletePending && deleteConfirmUuid !== null}\n >\n {t('deleteModalConfirmCta')}\n </Components.Button>\n </Flex>\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n <Components.Heading as=\"h2\">{t('deleteModalTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {addressForDeleteModal ? (\n <Trans\n t={t}\n i18nKey=\"deleteModalDescription\"\n values={{\n address: formatPendingWorkAddressLine(addressForDeleteModal, companyLocations),\n }}\n components={{\n strong: <Components.Text weight=\"medium\" as=\"span\" />,\n }}\n />\n ) : null}\n </Components.Text>\n </Flex>\n </Components.Modal>\n </Flex>\n </section>\n )\n}\n"],"names":["resolveLocation","row","companyLocations","loc","formatWorkAddressLines","location","street","getStreet","locality","getCityStateZip","WorkAddressView","editWorkAddressForm","changeWorkAddressForm","workAddresses","editTargetUuid","onEditTargetUuidChange","employeeDisplayName","onConfirmDelete","onWorkAddressSaved","onBack","isDeletePending","className","useTranslation","Components","useComponentContext","addressModal","setAddressModal","useState","deleteConfirmUuid","setDeleteConfirmUuid","addressModalContainerRef","useRef","addressModalPortal","setAddressModalPortal","useLayoutEffect","syncPortal","id","workAddress","editStatus","editFormFields","editShowsEffectiveDateField","createStatus","locationValidation","WorkAddressErrorCodes","startDateValidation","pendingFutureAddress","useMemo","getPendingFutureWorkAddress","addressForDeleteModal","a","changePendingPossessiveLabel","trimmed","chronologicalAsc","b","aDate","bDate","historyAddresses","address","sortedHistory","historyEndDate","idx","nextStart","nextDate","normalizeToDate","endDate","addDays","y","m","d","formatDateLongWithYear","historyDataView","useDataView","lines","jsxs","Flex","jsx","HamburgerMenu","PencilSvg","TrashCanSvg","EmptyData","ListIcon","closeAddressModal","handleDeleteModalConfirm","handleSave","result","modalPending","currentLines","currentLocation","FlexItem","Fragment","formatPendingWorkAddressLine","DataView","ActionsLayout","SDKFormProvider","Grid","LocationField","EffectiveDateField","Trans"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiDA,SAASA,EACPC,GACAC,GACsB;AACtB,MAAI,GAACD,EAAI,gBAAgB,CAACC,GAAkB;AAG5C,WAAOA,EAAiB,KAAK,CAAAC,MAAOA,EAAI,SAASF,EAAI,YAAY;AACnE;AAEA,SAASG,EACPH,GACAC,GACwC;AACxC,QAAMG,IAAWL,EAAgBC,GAAKC,CAAgB;AACtD,MAAIG,GAAU;AACZ,UAAMC,IAASC,EAAUF,CAAQ,EAAE,KAAA,GAC7BG,IAAWC,EAAgBJ,CAAQ,EAAE,KAAA;AAC3C,WAAO,EAAE,SAASC,GAAQ,WAAWE,EAAAA;AAAAA,EACvC;AACA,QAAMF,IAASC,EAAUN,CAAG,EAAE,KAAA,GACxBO,IAAWC,EAAgBR,CAAG,EAAE,KAAA;AACtC,SAAO,EAAE,SAASK,GAAQ,WAAWE,EAAA;AACvC;AAGO,SAASE,GAAgB;AAAA,EAC9B,qBAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC,KAAkB;AAAA,EAClB,WAAAC;AACF,GAAyB;AACvB,QAAM,EAAE,EAAA,IAAMC,GAAe,iCAAiC,GACxDC,IAAaC,GAAA,GACb,CAACC,GAAcC,CAAe,IAAIC,EAAmC,IAAI,GACzE,CAACC,GAAmBC,CAAoB,IAAIF,EAAwB,IAAI,GACxEG,IAA2BC,GAAuB,IAAI,GACtD,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ACb,UAAAC,EAAqB,IAAI;AAAA,QAC3B;AAAA,QACA,4BAA4B;AAAA,QAC5B,0BACG6C,GAAA,EAAK,eAAc,OAAM,KAAK,IAAI,gBAAe,YAChD,UAAA;AAAA,UAAA,gBAAAC;AAAA,YAACpD,EAAW;AAAA,YAAX;AAAA,cACC,SAAQ;AAAA,cACR,SAAS,MAAM;AACb,gBAAAM,EAAqB,IAAI;AAAA,cAC3B;AAAA,cAEC,YAAE,WAAW;AAAA,YAAA;AAAA,UAAA;AAAA,UAEhB,gBAAA8C;AAAA,YAACpD,EAAW;AAAA,YAAX;AAAA,cACC,SAAQ;AAAA,cACR,SAAS,MAAM;AACb,gBAAK2D,GAAA;AAAA,cACP;AAAA,cACA,WAAW9D,MAAmBQ,MAAsB;AAAA,cAEnD,YAAE,uBAAuB;AAAA,YAAA;AAAA,UAAA;AAAA,QAC5B,GACF;AAAA,QAGF,UAAA,gBAAA6C,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,UAAA,gBAAAC,EAACpD,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAA,EAAE,kBAAkB,GAAE;AAAA,4BAClDA,EAAW,MAAX,EAAgB,SAAQ,cACtB,UAAAyB,IACC,gBAAA2B;AAAA,YAACsB;AAAA,YAAA;AAAA,cACC;AAAA,cACA,SAAQ;AAAA,cACR,QAAQ;AAAA,gBACN,SAASP,EAA6B1C,GAAuB9C,CAAgB;AAAA,cAAA;AAAA,cAE/E,YAAY;AAAA,gBACV,0BAASqB,EAAW,MAAX,EAAgB,QAAO,UAAS,IAAG,OAAA,CAAO;AAAA,cAAA;AAAA,YACrD;AAAA,UAAA,IAEA,KAAA,CACN;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"WorkAddressView.js","sources":["../../../../../src/components/Employee/WorkAddress/management/WorkAddressView.tsx"],"sourcesContent":["import { useLayoutEffect, useMemo, useRef, useState } from 'react'\nimport { Trans, useTranslation } from 'react-i18next'\nimport type { Location } from '@gusto/embedded-api/models/components/location'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport {\n formatPendingWorkAddressLine,\n getPendingFutureWorkAddress,\n} from './getPendingFutureWorkAddress'\nimport ListIcon from '@/assets/icons/list.svg?react'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport {\n ActionsLayout,\n DataView,\n EmptyData,\n Grid,\n HamburgerMenu,\n useDataView,\n} from '@/components/Common'\nimport { Flex, FlexItem } from '@/components/Common/Flex/Flex'\nimport {\n LocationField,\n EffectiveDateField,\n} from '@/components/Employee/Profile/shared/useWorkAddressForm/fields'\nimport { WorkAddressErrorCodes } from '@/components/Employee/Profile/shared/useWorkAddressForm/workAddressSchema'\nimport type { UseWorkAddressFormReady } from '@/components/Employee/Profile/shared/useWorkAddressForm'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport type { HookSubmitResult } from '@/partner-hook-utils/types'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { addDays, formatDateLongWithYear, normalizeToDate } from '@/helpers/dateFormatting'\nimport { getCityStateZip, getStreet } from '@/helpers/formattedStrings'\n\n/** @internal */\nexport interface WorkAddressViewProps {\n editWorkAddressForm: UseWorkAddressFormReady\n changeWorkAddressForm: UseWorkAddressFormReady\n /** Full list for history table, pending-future alert, and delete-confirmation lookup. */\n workAddresses: EmployeeWorkAddress[] | undefined\n editTargetUuid: string | undefined\n onEditTargetUuidChange: (uuid: string | undefined) => void\n employeeDisplayName: string\n onConfirmDelete: (workAddressUuid: string) => Promise<boolean>\n onWorkAddressSaved: (result: HookSubmitResult<EmployeeWorkAddress>) => void\n onBack: () => void\n isDeletePending?: boolean\n /** CSS class name applied to the root element. */\n className?: string\n}\n\nfunction resolveLocation(\n row: EmployeeWorkAddress,\n companyLocations: Location[] | undefined,\n): Location | undefined {\n if (!row.locationUuid || !companyLocations?.length) {\n return undefined\n }\n return companyLocations.find(loc => loc.uuid === row.locationUuid)\n}\n\nfunction formatWorkAddressLines(\n row: EmployeeWorkAddress,\n companyLocations: Location[] | undefined,\n): { primary: string; secondary: string } {\n const location = resolveLocation(row, companyLocations)\n if (location) {\n const street = getStreet(location).trim()\n const locality = getCityStateZip(location).trim()\n return { primary: street, secondary: locality }\n }\n const street = getStreet(row).trim()\n const locality = getCityStateZip(row).trim()\n return { primary: street, secondary: locality }\n}\n\n/** @internal */\nexport function WorkAddressView({\n editWorkAddressForm,\n changeWorkAddressForm,\n workAddresses,\n editTargetUuid,\n onEditTargetUuidChange,\n employeeDisplayName,\n onConfirmDelete,\n onWorkAddressSaved,\n onBack,\n isDeletePending = false,\n className,\n}: WorkAddressViewProps) {\n const { t } = useTranslation('Employee.Management.WorkAddress')\n const Components = useComponentContext()\n const [addressModal, setAddressModal] = useState<'edit' | 'create' | null>(null)\n const [deleteConfirmUuid, setDeleteConfirmUuid] = useState<string | null>(null)\n const addressModalContainerRef = useRef<HTMLDivElement>(null)\n const [addressModalPortal, setAddressModalPortal] = useState<HTMLElement | undefined>(undefined)\n\n useLayoutEffect(() => {\n if (!addressModal) {\n setAddressModalPortal(undefined)\n return\n }\n const syncPortal = () => {\n setAddressModalPortal(addressModalContainerRef.current ?? undefined)\n }\n syncPortal()\n if (addressModalContainerRef.current == null) {\n const id = requestAnimationFrame(syncPortal)\n return () => {\n cancelAnimationFrame(id)\n }\n }\n }, [addressModal])\n\n const {\n data: { workAddress, companyLocations },\n status: editStatus,\n form: { Fields: editFormFields },\n } = editWorkAddressForm\n\n const editShowsEffectiveDateField = editFormFields.EffectiveDate != null\n\n const { status: createStatus } = changeWorkAddressForm\n\n const locationValidation = {\n [WorkAddressErrorCodes.REQUIRED]: t('form.locationRequired'),\n }\n\n const startDateValidation = {\n [WorkAddressErrorCodes.REQUIRED]: t('form.startDateRequired'),\n }\n\n const pendingFutureAddress = useMemo(\n () => getPendingFutureWorkAddress(workAddresses),\n [workAddresses],\n )\n\n const addressForDeleteModal = useMemo(() => {\n if (!deleteConfirmUuid || !workAddresses) {\n return undefined\n }\n return workAddresses.find(a => a.uuid === deleteConfirmUuid)\n }, [deleteConfirmUuid, workAddresses])\n\n const changePendingPossessiveLabel = useMemo(() => {\n const trimmed = employeeDisplayName.trim()\n return trimmed ? `${trimmed}'s` : t('changePendingPossessiveFallback')\n }, [employeeDisplayName, t])\n\n const chronologicalAsc = useMemo(() => {\n return [...(workAddresses ?? [])].sort((a, b) => {\n const aDate = a.effectiveDate ?? ''\n const bDate = b.effectiveDate ?? ''\n if (!aDate && !bDate) return 0\n if (!aDate) return 1\n if (!bDate) return -1\n return aDate.localeCompare(bDate)\n })\n }, [workAddresses])\n\n const historyAddresses = useMemo(\n () => chronologicalAsc.filter(address => address.active !== true),\n [chronologicalAsc],\n )\n\n const sortedHistory = useMemo(() => [...historyAddresses].reverse(), [historyAddresses])\n\n const historyEndDate = (row: EmployeeWorkAddress) => {\n const idx = chronologicalAsc.findIndex(a => a.uuid === row.uuid)\n if (idx === -1 || idx >= chronologicalAsc.length - 1) return '—'\n const nextStart = chronologicalAsc[idx + 1]?.effectiveDate\n if (!nextStart) return '—'\n const nextDate = normalizeToDate(nextStart)\n if (!nextDate) return '—'\n const endDate = addDays(nextDate, -1)\n const y = endDate.getFullYear()\n const m = String(endDate.getMonth() + 1).padStart(2, '0')\n const d = String(endDate.getDate()).padStart(2, '0')\n return formatDateLongWithYear(`${y}-${m}-${d}`)\n }\n\n const historyDataView = useDataView({\n data: sortedHistory,\n columns: [\n {\n title: t('columns.location'),\n render: (row: EmployeeWorkAddress) => {\n const lines = formatWorkAddressLines(row, companyLocations)\n return (\n <Flex flexDirection=\"column\" gap={0}>\n <Components.Text weight=\"medium\">{lines.primary}</Components.Text>\n <Components.Text variant=\"supporting\">{lines.secondary}</Components.Text>\n </Flex>\n )\n },\n },\n {\n title: t('columns.startDate'),\n render: (row: EmployeeWorkAddress) =>\n row.effectiveDate ? formatDateLongWithYear(row.effectiveDate) : '—',\n },\n {\n title: t('columns.endDate'),\n render: (row: EmployeeWorkAddress) => historyEndDate(row),\n },\n ],\n itemMenu: (row: EmployeeWorkAddress) => (\n <HamburgerMenu\n triggerLabel={t('rowMenuAriaLabel')}\n items={[\n {\n label: t('rowEdit'),\n onClick: () => {\n onEditTargetUuidChange(row.uuid)\n setAddressModal('edit')\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('rowDelete'),\n onClick: () => {\n if (row.active === true) {\n return\n }\n setDeleteConfirmUuid(row.uuid)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n ),\n emptyState: () => (\n <div data-testid=\"work-address-history-empty\">\n <EmptyData\n icon={<ListIcon aria-hidden />}\n title={t('historyEmptyTitle')}\n description={t('historyEmptyDescription')}\n />\n </div>\n ),\n })\n\n const closeAddressModal = () => {\n setAddressModal(null)\n onEditTargetUuidChange(undefined)\n }\n\n const handleDeleteModalConfirm = async () => {\n if (!deleteConfirmUuid) {\n return\n }\n const deleted = await onConfirmDelete(deleteConfirmUuid)\n if (deleted) {\n setDeleteConfirmUuid(null)\n }\n }\n\n const handleSave = async () => {\n if (!addressModal) {\n return\n }\n\n if (addressModal === 'edit') {\n const result = await editWorkAddressForm.actions.onSubmit(\n undefined,\n editShowsEffectiveDateField ? undefined : { effectiveDate: workAddress?.effectiveDate },\n )\n if (result) {\n onWorkAddressSaved(result)\n closeAddressModal()\n }\n return\n }\n\n const result = await changeWorkAddressForm.actions.onSubmit()\n if (result) {\n onWorkAddressSaved(result)\n closeAddressModal()\n }\n }\n\n const modalPending = addressModal === 'edit' ? editStatus.isPending : createStatus.isPending\n\n const currentLines = workAddress ? formatWorkAddressLines(workAddress, companyLocations) : null\n const currentLocation =\n workAddress && companyLocations ? resolveLocation(workAddress, companyLocations) : undefined\n\n return (\n <Flex className={className} flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" gap={4} alignItems=\"flex-start\">\n <Components.Heading as=\"h1\" styledAs=\"h2\">\n {t('title')}\n </Components.Heading>\n <Components.Text variant=\"supporting\">{t('description')}</Components.Text>\n </Flex>\n\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('currentSectionTitle')}\n action={\n workAddress ? (\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEditTargetUuidChange(undefined)\n setAddressModal('edit')\n }}\n isLoading={editStatus.isPending}\n >\n {t('editCta')}\n </Components.Button>\n ) : undefined\n }\n />\n }\n footer={\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEditTargetUuidChange(undefined)\n setAddressModal('create')\n }}\n isLoading={createStatus.isPending}\n >\n {t('changeCta')}\n </Components.Button>\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n {workAddress && currentLines ? (\n <Flex flexDirection=\"column\" gap={4}>\n <FlexItem>\n {currentLocation ? (\n <>\n <Components.Text weight=\"medium\">\n {getStreet(currentLocation).trim()}\n </Components.Text>\n <Components.Text weight=\"medium\">\n {getCityStateZip(currentLocation)}\n </Components.Text>\n </>\n ) : (\n <>\n <Components.Text weight=\"medium\">{currentLines.primary}</Components.Text>\n <Components.Text weight=\"medium\">{currentLines.secondary}</Components.Text>\n </>\n )}\n </FlexItem>\n {workAddress.effectiveDate ? (\n <Components.Text variant=\"supporting\">\n {t('currentSince', {\n date: formatDateLongWithYear(workAddress.effectiveDate),\n })}\n </Components.Text>\n ) : null}\n </Flex>\n ) : (\n <Components.Text>{t('currentEmpty')}</Components.Text>\n )}\n {pendingFutureAddress ? (\n <Components.Alert status=\"warning\" label={t('changePendingTitle')}>\n <Components.Text variant=\"supporting\">\n {t('changePendingDescription', {\n possessiveLabel: changePendingPossessiveLabel,\n newAddress: formatPendingWorkAddressLine(pendingFutureAddress, companyLocations),\n effectiveDate: pendingFutureAddress.effectiveDate\n ? formatDateLongWithYear(pendingFutureAddress.effectiveDate)\n : '—',\n // Values are inserted into JSX text, so the browser already\n // escapes them. Telling i18next to escape too produces\n // double-encoded entities like `'` showing as text.\n interpolation: { escapeValue: false },\n })}\n </Components.Text>\n </Components.Alert>\n ) : null}\n </Flex>\n </Components.Box>\n\n <Flex flexDirection=\"column\" gap={12}>\n <Components.Heading as=\"h2\" styledAs=\"h4\">\n {t('historySectionTitle')}\n </Components.Heading>\n <DataView label={t('historySectionTitle')} {...historyDataView} />\n </Flex>\n\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={onBack}>\n {t('backCta')}\n </Components.Button>\n </ActionsLayout>\n\n <Components.Modal\n isOpen={addressModal !== null}\n onClose={closeAddressModal}\n shouldCloseOnBackdropClick={false}\n containerRef={addressModalContainerRef}\n footer={\n <Flex flexDirection=\"row\" gap={12} justifyContent=\"flex-end\">\n <Components.Button variant=\"secondary\" onClick={closeAddressModal}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button\n variant=\"primary\"\n onClick={() => {\n void handleSave()\n }}\n isLoading={modalPending}\n >\n {t('submitCta')}\n </Components.Button>\n </Flex>\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n <Components.Heading as=\"h2\">\n {addressModal === 'edit' ? t('editModalTitle') : t('changeModalTitle')}\n </Components.Heading>\n <Components.Text variant=\"supporting\">\n {addressModal === 'edit' ? t('editModalDescription') : t('changeModalDescription')}\n </Components.Text>\n {addressModal === 'edit' && editShowsEffectiveDateField ? (\n <Components.Alert status=\"warning\" label={t('editPastAddressAlertTitle')} />\n ) : null}\n {addressModal === 'edit' ? (\n <SDKFormProvider formHookResult={editWorkAddressForm}>\n <Grid\n gridTemplateColumns={{\n base: '1fr',\n small: '1fr',\n }}\n gap={20}\n >\n <LocationField\n label={\n editShowsEffectiveDateField\n ? t('form.editInactiveLocationLabel')\n : t('form.editLocationLabel')\n }\n description={t('form.editLocationDescription')}\n placeholder={t('form.selectPlaceholder')}\n validationMessages={locationValidation}\n portalContainer={addressModalPortal}\n />\n {editShowsEffectiveDateField ? (\n <EffectiveDateField\n label={t('form.startDateLabel')}\n description={t('form.editInactiveStartDateDescription')}\n validationMessages={startDateValidation}\n portalContainer={addressModalPortal}\n />\n ) : null}\n </Grid>\n </SDKFormProvider>\n ) : null}\n {addressModal === 'create' ? (\n <SDKFormProvider formHookResult={changeWorkAddressForm}>\n <Grid\n gridTemplateColumns={{\n base: '1fr',\n small: '1fr',\n }}\n gap={20}\n >\n <LocationField\n label={t('form.newWorkAddressLabel')}\n description={t('form.newWorkAddressDescription')}\n placeholder={t('form.selectPlaceholder')}\n validationMessages={locationValidation}\n portalContainer={addressModalPortal}\n />\n <EffectiveDateField\n label={t('form.startDateLabel')}\n description={t('form.startDateDescription')}\n validationMessages={startDateValidation}\n portalContainer={addressModalPortal}\n />\n </Grid>\n </SDKFormProvider>\n ) : null}\n </Flex>\n </Components.Modal>\n\n <Components.Modal\n isOpen={deleteConfirmUuid !== null}\n onClose={() => {\n setDeleteConfirmUuid(null)\n }}\n shouldCloseOnBackdropClick={false}\n footer={\n <Flex flexDirection=\"row\" gap={12} justifyContent=\"flex-end\">\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n setDeleteConfirmUuid(null)\n }}\n >\n {t('cancelCta')}\n </Components.Button>\n <Components.Button\n variant=\"error\"\n onClick={() => {\n void handleDeleteModalConfirm()\n }}\n isLoading={isDeletePending && deleteConfirmUuid !== null}\n >\n {t('deleteModalConfirmCta')}\n </Components.Button>\n </Flex>\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n <Components.Heading as=\"h2\">{t('deleteModalTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {addressForDeleteModal ? (\n <Trans\n t={t}\n i18nKey=\"deleteModalDescription\"\n values={{\n address: formatPendingWorkAddressLine(addressForDeleteModal, companyLocations),\n }}\n components={{\n strong: <Components.Text weight=\"medium\" as=\"span\" />,\n }}\n />\n ) : null}\n </Components.Text>\n </Flex>\n </Components.Modal>\n </Flex>\n )\n}\n"],"names":["resolveLocation","row","companyLocations","loc","formatWorkAddressLines","location","street","getStreet","locality","getCityStateZip","WorkAddressView","editWorkAddressForm","changeWorkAddressForm","workAddresses","editTargetUuid","onEditTargetUuidChange","employeeDisplayName","onConfirmDelete","onWorkAddressSaved","onBack","isDeletePending","className","t","useTranslation","Components","useComponentContext","addressModal","setAddressModal","useState","deleteConfirmUuid","setDeleteConfirmUuid","addressModalContainerRef","useRef","addressModalPortal","setAddressModalPortal","useLayoutEffect","syncPortal","id","workAddress","editStatus","editFormFields","editShowsEffectiveDateField","createStatus","locationValidation","WorkAddressErrorCodes","startDateValidation","pendingFutureAddress","useMemo","getPendingFutureWorkAddress","addressForDeleteModal","a","changePendingPossessiveLabel","trimmed","chronologicalAsc","b","aDate","bDate","historyAddresses","address","sortedHistory","historyEndDate","idx","nextStart","nextDate","normalizeToDate","endDate","addDays","y","m","d","formatDateLongWithYear","historyDataView","useDataView","lines","jsxs","Flex","jsx","HamburgerMenu","PencilSvg","TrashCanSvg","EmptyData","ListIcon","closeAddressModal","handleDeleteModalConfirm","handleSave","result","modalPending","currentLines","currentLocation","FlexItem","Fragment","formatPendingWorkAddressLine","DataView","ActionsLayout","SDKFormProvider","Grid","LocationField","EffectiveDateField","Trans"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiDA,SAASA,EACPC,GACAC,GACsB;AACtB,MAAI,GAACD,EAAI,gBAAgB,CAACC,GAAkB;AAG5C,WAAOA,EAAiB,KAAK,CAAAC,MAAOA,EAAI,SAASF,EAAI,YAAY;AACnE;AAEA,SAASG,EACPH,GACAC,GACwC;AACxC,QAAMG,IAAWL,EAAgBC,GAAKC,CAAgB;AACtD,MAAIG,GAAU;AACZ,UAAMC,IAASC,EAAUF,CAAQ,EAAE,KAAA,GAC7BG,IAAWC,EAAgBJ,CAAQ,EAAE,KAAA;AAC3C,WAAO,EAAE,SAASC,GAAQ,WAAWE,EAAAA;AAAAA,EACvC;AACA,QAAMF,IAASC,EAAUN,CAAG,EAAE,KAAA,GACxBO,IAAWC,EAA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AF,EAAE,kBAAkB,GAAE;AAAA,4BAClDE,EAAW,MAAX,EAAgB,SAAQ,cACtB,UAAAyB,IACC,gBAAA2B;AAAA,YAACsB;AAAA,YAAA;AAAA,cACC,GAAA5E;AAAA,cACA,SAAQ;AAAA,cACR,QAAQ;AAAA,gBACN,SAASqE,EAA6B1C,GAAuB/C,CAAgB;AAAA,cAAA;AAAA,cAE/E,YAAY;AAAA,gBACV,0BAASsB,EAAW,MAAX,EAAgB,QAAO,UAAS,IAAG,OAAA,CAAO;AAAA,cAAA;AAAA,YACrD;AAAA,UAAA,IAEA,KAAA,CACN;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js
CHANGED
|
@@ -76,13 +76,13 @@ function L({ companyId: o, dictionary: d, onEvent: f, className: y }) {
|
|
|
76
76
|
}
|
|
77
77
|
) : null
|
|
78
78
|
});
|
|
79
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ a(u, { className: y, flexDirection: "column", gap: 20, children: [
|
|
80
80
|
/* @__PURE__ */ a(u, { flexDirection: "column", gap: 2, children: [
|
|
81
81
|
/* @__PURE__ */ n(R, { as: "h2", styledAs: "h4", children: t("title") }),
|
|
82
82
|
c.length > 0 && /* @__PURE__ */ n(l, { children: t("description") })
|
|
83
83
|
] }),
|
|
84
84
|
/* @__PURE__ */ n(k, { ...b, label: t("title") })
|
|
85
|
-
] })
|
|
85
|
+
] });
|
|
86
86
|
}
|
|
87
87
|
export {
|
|
88
88
|
K as InformationRequestList
|
package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InformationRequestList.js","sources":["../../../../src/components/InformationRequests/InformationRequestList/InformationRequestList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport type { InformationRequest } from '@gusto/embedded-api/models/components/informationrequest'\nimport {\n InformationRequestStatus,\n InformationRequestType,\n} from '@gusto/embedded-api/models/components/informationrequest'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { DataView } from '@/components/Common/DataView/DataView'\nimport { useDataView } from '@/components/Common/DataView/useDataView'\nimport { EmptyData, Flex, FlexItem } from '@/components/Common'\nimport { informationRequestEvents } from '@/shared/constants'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\n\n/**\n * Props for {@link InformationRequestList}.\n *\n * @public\n */\nexport interface InformationRequestListProps extends BaseComponentInterface<'InformationRequests.InformationRequestList'> {\n /** The associated company identifier. */\n companyId: string\n /** Event callback. See the events table on {@link InformationRequestList} for emitted events. */\n onEvent: BaseComponentInterface['onEvent']\n}\n\n/**\n * Displays the list of outstanding information requests for a company with a \"Respond\" CTA on each open request.\n *\n * @remarks\n * Renders status badges for each request and an extra \"Payroll blocking\" badge when the request is currently blocking payroll. Approved requests are filtered out of the list. Used as the top-level surface of `InformationRequests.InformationRequestsFlow`, but can be rendered directly when you want to host the response form yourself (e.g. in a custom modal or page).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `informationRequest/respond` | Fired when the user clicks \"Respond\" on an open request | `{ requestId: string }` |\n *\n * @param props - See {@link InformationRequestListProps}.\n * @returns The rendered information request list.\n * @public\n */\nexport function InformationRequestList(props: InformationRequestListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\ntype StatusMapping = {\n label: string\n badgeStatus: BadgeProps['status']\n} | null\n\nfunction Root({ companyId, dictionary, onEvent, className }: InformationRequestListProps) {\n useComponentDictionary('InformationRequests.InformationRequestList', dictionary)\n useI18n('InformationRequests.InformationRequestList')\n const { t } = useTranslation('InformationRequests.InformationRequestList')\n const { Heading, Text, Button, Badge } = useComponentContext()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequests = data.informationRequests ?? []\n\n const visibleRequests = informationRequests.filter(\n request => request.status !== InformationRequestStatus.Approved,\n )\n\n const getTypeLabel = (type: InformationRequest['type']): string => {\n switch (type) {\n case InformationRequestType.CompanyOnboarding:\n return t('types.companyOnboarding')\n case InformationRequestType.AccountProtection:\n return t('types.accountProtection')\n case InformationRequestType.PaymentRequest:\n return t('types.paymentRequest')\n case InformationRequestType.PaymentError:\n return t('types.paymentError')\n default:\n return t('types.unknown')\n }\n }\n\n const getStatusMapping = (status: InformationRequest['status']): StatusMapping => {\n switch (status) {\n case InformationRequestStatus.PendingResponse:\n return { label: t('status.incomplete'), badgeStatus: 'info' }\n case InformationRequestStatus.PendingReview:\n return { label: t('status.underReview'), badgeStatus: 'warning' }\n default:\n return null\n }\n }\n\n const dataViewProps = useDataView({\n data: visibleRequests,\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')} />\n ),\n columns: [\n {\n key: 'type',\n title: t('columns.type'),\n render: request => (\n <FlexItem flexGrow={1}>\n <Text weight=\"medium\">{getTypeLabel(request.type)}</Text>\n </FlexItem>\n ),\n },\n {\n key: 'status',\n title: t('columns.status'),\n render: request => {\n const statusMapping = getStatusMapping(request.status)\n const showPayrollBlockingBadge = request.blockingPayroll\n\n if (!statusMapping && !showPayrollBlockingBadge) {\n return null\n }\n\n return (\n <Flex gap={8} alignItems=\"center\">\n {statusMapping && (\n <Badge status={statusMapping.badgeStatus}>{statusMapping.label}</Badge>\n )}\n {showPayrollBlockingBadge && (\n <Badge status=\"error\">{t('status.payrollBlocking')}</Badge>\n )}\n </Flex>\n )\n },\n },\n ],\n itemMenu: request => {\n const isPendingResponse = request.status === InformationRequestStatus.PendingResponse\n if (!isPendingResponse) {\n return null\n }\n return (\n <Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_RESPOND, {\n requestId: request.uuid,\n })\n }}\n >\n {t('cta.respond')}\n </Button>\n )\n },\n })\n\n return (\n <
|
|
1
|
+
{"version":3,"file":"InformationRequestList.js","sources":["../../../../src/components/InformationRequests/InformationRequestList/InformationRequestList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport type { InformationRequest } from '@gusto/embedded-api/models/components/informationrequest'\nimport {\n InformationRequestStatus,\n InformationRequestType,\n} from '@gusto/embedded-api/models/components/informationrequest'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { DataView } from '@/components/Common/DataView/DataView'\nimport { useDataView } from '@/components/Common/DataView/useDataView'\nimport { EmptyData, Flex, FlexItem } from '@/components/Common'\nimport { informationRequestEvents } from '@/shared/constants'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\n\n/**\n * Props for {@link InformationRequestList}.\n *\n * @public\n */\nexport interface InformationRequestListProps extends BaseComponentInterface<'InformationRequests.InformationRequestList'> {\n /** The associated company identifier. */\n companyId: string\n /** Event callback. See the events table on {@link InformationRequestList} for emitted events. */\n onEvent: BaseComponentInterface['onEvent']\n}\n\n/**\n * Displays the list of outstanding information requests for a company with a \"Respond\" CTA on each open request.\n *\n * @remarks\n * Renders status badges for each request and an extra \"Payroll blocking\" badge when the request is currently blocking payroll. Approved requests are filtered out of the list. Used as the top-level surface of `InformationRequests.InformationRequestsFlow`, but can be rendered directly when you want to host the response form yourself (e.g. in a custom modal or page).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `informationRequest/respond` | Fired when the user clicks \"Respond\" on an open request | `{ requestId: string }` |\n *\n * @param props - See {@link InformationRequestListProps}.\n * @returns The rendered information request list.\n * @public\n */\nexport function InformationRequestList(props: InformationRequestListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\ntype StatusMapping = {\n label: string\n badgeStatus: BadgeProps['status']\n} | null\n\nfunction Root({ companyId, dictionary, onEvent, className }: InformationRequestListProps) {\n useComponentDictionary('InformationRequests.InformationRequestList', dictionary)\n useI18n('InformationRequests.InformationRequestList')\n const { t } = useTranslation('InformationRequests.InformationRequestList')\n const { Heading, Text, Button, Badge } = useComponentContext()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequests = data.informationRequests ?? []\n\n const visibleRequests = informationRequests.filter(\n request => request.status !== InformationRequestStatus.Approved,\n )\n\n const getTypeLabel = (type: InformationRequest['type']): string => {\n switch (type) {\n case InformationRequestType.CompanyOnboarding:\n return t('types.companyOnboarding')\n case InformationRequestType.AccountProtection:\n return t('types.accountProtection')\n case InformationRequestType.PaymentRequest:\n return t('types.paymentRequest')\n case InformationRequestType.PaymentError:\n return t('types.paymentError')\n default:\n return t('types.unknown')\n }\n }\n\n const getStatusMapping = (status: InformationRequest['status']): StatusMapping => {\n switch (status) {\n case InformationRequestStatus.PendingResponse:\n return { label: t('status.incomplete'), badgeStatus: 'info' }\n case InformationRequestStatus.PendingReview:\n return { label: t('status.underReview'), badgeStatus: 'warning' }\n default:\n return null\n }\n }\n\n const dataViewProps = useDataView({\n data: visibleRequests,\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')} />\n ),\n columns: [\n {\n key: 'type',\n title: t('columns.type'),\n render: request => (\n <FlexItem flexGrow={1}>\n <Text weight=\"medium\">{getTypeLabel(request.type)}</Text>\n </FlexItem>\n ),\n },\n {\n key: 'status',\n title: t('columns.status'),\n render: request => {\n const statusMapping = getStatusMapping(request.status)\n const showPayrollBlockingBadge = request.blockingPayroll\n\n if (!statusMapping && !showPayrollBlockingBadge) {\n return null\n }\n\n return (\n <Flex gap={8} alignItems=\"center\">\n {statusMapping && (\n <Badge status={statusMapping.badgeStatus}>{statusMapping.label}</Badge>\n )}\n {showPayrollBlockingBadge && (\n <Badge status=\"error\">{t('status.payrollBlocking')}</Badge>\n )}\n </Flex>\n )\n },\n },\n ],\n itemMenu: request => {\n const isPendingResponse = request.status === InformationRequestStatus.PendingResponse\n if (!isPendingResponse) {\n return null\n }\n return (\n <Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_RESPOND, {\n requestId: request.uuid,\n })\n }}\n >\n {t('cta.respond')}\n </Button>\n )\n },\n })\n\n return (\n <Flex className={className} flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('title')}\n </Heading>\n {visibleRequests.length > 0 && <Text>{t('description')}</Text>}\n </Flex>\n\n <DataView {...dataViewProps} label={t('title')} />\n </Flex>\n )\n}\n"],"names":["InformationRequestList","props","jsx","BaseComponent","Root","companyId","dictionary","onEvent","className","useComponentDictionary","useI18n","useTranslation","Heading","Text","Button","Badge","useComponentContext","data","useInformationRequestsGetInformationRequestsSuspense","visibleRequests","request","InformationRequestStatus","getTypeLabel","type","InformationRequestType","getStatusMapping","status","dataViewProps","useDataView","EmptyData","FlexItem","statusMapping","showPayrollBlockingBadge","jsxs","Flex","informationRequestEvents","DataView"],"mappings":";;;;;;;;;;;;;AA2CO,SAASA,EAAuBC,GAAoC;AACzE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAOA,SAASG,EAAK,EAAE,WAAAC,GAAW,YAAAC,GAAY,SAAAC,GAAS,WAAAC,KAA0C;AACxF,EAAAC,EAAuB,8CAA8CH,CAAU,GAC/EI,EAAQ,4CAA4C;AACpD,QAAM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D;AAEJ;"}
|
|
@@ -82,7 +82,7 @@ const K = ({
|
|
|
82
82
|
}
|
|
83
83
|
);
|
|
84
84
|
};
|
|
85
|
-
return /* @__PURE__ */
|
|
85
|
+
return /* @__PURE__ */ h(g, { className: P, flexDirection: "column", gap: 16, children: [
|
|
86
86
|
y && /* @__PURE__ */ n(
|
|
87
87
|
L,
|
|
88
88
|
{
|
|
@@ -99,7 +99,7 @@ const K = ({
|
|
|
99
99
|
F(),
|
|
100
100
|
/* @__PURE__ */ n(b, { variant: "secondary", onClick: C, children: s("cta.startWireTransfer") })
|
|
101
101
|
] }) })
|
|
102
|
-
] })
|
|
102
|
+
] });
|
|
103
103
|
};
|
|
104
104
|
export {
|
|
105
105
|
se as ConfirmWireDetailsBanner
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmWireDetailsBanner.js","sources":["../../../../../src/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useWireInRequestsListSuspense } from '@gusto/embedded-api/react-query/wireInRequestsList'\nimport { usePayrollsListSuspense } from '@gusto/embedded-api/react-query/payrollsList'\nimport { useState, useEffect } from 'react'\nimport type { ConfirmationAlert } from '../types'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\n\ninterface ConfirmWireDetailsBannerProps extends BaseComponentInterface<'Payroll.ConfirmWireDetailsBanner'> {\n wireInId?: string\n companyId: string\n confirmationAlert?: ConfirmationAlert\n onStartWireTransfer: () => void\n}\n\n/** @internal */\nexport function ConfirmWireDetailsBanner(props: ConfirmWireDetailsBannerProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n wireInId,\n companyId,\n dictionary,\n confirmationAlert,\n onStartWireTransfer,\n className,\n}: ConfirmWireDetailsBannerProps) => {\n useComponentDictionary('Payroll.ConfirmWireDetailsBanner', dictionary)\n useI18n('Payroll.ConfirmWireDetailsBanner')\n const { t } = useTranslation('Payroll.ConfirmWireDetailsBanner')\n const { Alert, Banner, Button, UnorderedList, Text } = useComponentContext()\n const dateFormatter = useDateFormatter()\n const [isConfirmationAlertDismissed, setIsConfirmationAlertDismissed] = useState(false)\n const currencyFormatter = useNumberFormatter('currency')\n\n useEffect(() => {\n if (confirmationAlert) {\n setIsConfirmationAlertDismissed(false)\n }\n }, [confirmationAlert])\n\n const { data: wireInRequestsData } = useWireInRequestsListSuspense({\n companyUuid: companyId,\n })\n\n const { data: payrollsData } = usePayrollsListSuspense({\n companyId,\n processed: true,\n })\n\n const activeWireInRequests = (wireInRequestsData.wireInRequestList || []).filter(\n request => request.status === 'awaiting_funds',\n )\n const wireInRequests = wireInId\n ? activeWireInRequests.filter(request => request.uuid === wireInId)\n : activeWireInRequests\n\n const payrolls = payrollsData.payrollList || []\n\n const wireInRequestsWithPayrolls = wireInRequests.map(wireInRequest => {\n const payroll = payrolls.find(p => p.payrollUuid === wireInRequest.paymentUuid)\n const payrollRange = payroll?.payPeriod\n ? dateFormatter.formatPayPeriodRange(payroll.payPeriod.startDate, payroll.payPeriod.endDate)\n : ''\n return {\n wireInRequest,\n payroll,\n payrollRange,\n paymentType: wireInRequest.paymentType,\n requestedAmount: wireInRequest.requestedAmount ?? '',\n }\n })\n\n const shouldShowBanner =\n wireInRequestsWithPayrolls.length > 0 &&\n (wireInRequestsWithPayrolls.length > 1 || wireInRequestsWithPayrolls[0]?.wireInRequest)\n\n const shouldShowConfirmationAlert = !isConfirmationAlertDismissed && confirmationAlert\n\n if (!shouldShowBanner && !shouldShowConfirmationAlert) {\n return null\n }\n\n const formatDeadline = (deadline: string) => {\n const date = new Date(deadline)\n\n const timeRaw = date.toLocaleTimeString('en-US', {\n hour: 'numeric',\n minute: date.getMinutes() === 0 ? undefined : '2-digit',\n hour12: true,\n timeZone: 'America/Los_Angeles',\n timeZoneName: 'short',\n })\n\n const time = timeRaw.replace(/\\s?(AM|PM)/i, match => match.trim().toLowerCase())\n\n const dateString = date.toLocaleDateString('en-US', {\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n timeZone: 'America/Los_Angeles',\n })\n\n return { time, date: dateString }\n }\n\n const getBannerTitle = () => {\n const isSingleWireInRequest = wireInRequestsWithPayrolls.length === 1\n const { wireInRequest, payrollRange } = wireInRequestsWithPayrolls[0] || {}\n\n if (isSingleWireInRequest) {\n if (wireInId && wireInRequest?.wireInDeadline) {\n const { time, date } = formatDeadline(wireInRequest.wireInDeadline)\n return t('banner.title', { time, date })\n }\n return t('banner.titleWithPayroll', { payrollRange })\n }\n return t('banner.titleMultiple', { count: wireInRequestsWithPayrolls.length })\n }\n\n const getBannerContent = () => {\n if (wireInRequestsWithPayrolls.length > 1) {\n return (\n <UnorderedList\n items={wireInRequestsWithPayrolls.map(\n ({ paymentType, payrollRange, requestedAmount }, index) =>\n paymentType === 'Payroll' ? (\n <Text key={index}>{t('banner.requestLabelPayroll', { payrollRange })}</Text>\n ) : (\n <Text key={index}>\n {t('banner.requestLabelContractorPaymentGroup', {\n requestedAmount: currencyFormatter(Number(requestedAmount)),\n })}\n </Text>\n ),\n )}\n />\n )\n }\n }\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={16}>\n {shouldShowConfirmationAlert && (\n <Alert\n status=\"success\"\n label={confirmationAlert.title}\n onDismiss={() => {\n setIsConfirmationAlertDismissed(true)\n }}\n >\n {confirmationAlert.content}\n </Alert>\n )}\n {shouldShowBanner && (\n <Banner status=\"warning\" title={getBannerTitle()}>\n <Flex flexDirection=\"column\" gap={16} alignItems=\"flex-start\">\n <div>{t('banner.description')}</div>\n {getBannerContent()}\n <Button variant=\"secondary\" onClick={onStartWireTransfer}>\n {t('cta.startWireTransfer')}\n </Button>\n </Flex>\n </Banner>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["ConfirmWireDetailsBanner","props","jsx","BaseComponent","Root","wireInId","companyId","dictionary","confirmationAlert","onStartWireTransfer","className","useComponentDictionary","useI18n","t","useTranslation","Alert","Banner","Button","UnorderedList","Text","useComponentContext","dateFormatter","useDateFormatter","isConfirmationAlertDismissed","setIsConfirmationAlertDismissed","useState","currencyFormatter","useNumberFormatter","useEffect","wireInRequestsData","useWireInRequestsListSuspense","payrollsData","usePayrollsListSuspense","activeWireInRequests","request","wireInRequests","payrolls","wireInRequestsWithPayrolls","wireInRequest","payroll","p","payrollRange","shouldShowBanner","shouldShowConfirmationAlert","formatDeadline","deadline","date","time","match","dateString","getBannerTitle","isSingleWireInRequest","getBannerContent","paymentType","requestedAmount","index","jsxs","Flex"],"mappings":";;;;;;;;;;;;AAoBO,SAASA,GAAyBC,GAAsC;AAC7E,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,IAAO,CAAC;AAAA,EACZ,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,WAAAC;AACF,MAAqC;AACnC,EAAAC,EAAuB,oCAAoCJ,CAAU,GACrEK,EAAQ,kCAAkC;AAC1C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,kCAAkC,GACzD,EAAE,OAAAC,GAAO,QAAAC,GAAQ,QAAAC,GAAQ,eAAAC,GAAe,MAAAC,EAAA,IAASC,EAAA,GACjDC,IAAgBC,EAAA,GAChB,CAACC,GAA8BC,CAA+B,IAAIC,EAAS,EAAK,GAChFC,IAAoBC,EAAmB,UAAU;AAEvD,EAAAC,EAAU,MAAM;AACd,IAAIpB,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S,KAAK,IAC/B,UAAA;AAAA,IAAAd,KACC,gBAAAzC;AAAA,MAACa;AAAA,MAAA;AAAA,QACC,QAAO;AAAA,QACP,OAAOP,EAAkB;AAAA,QACzB,WAAW,MAAM;AACf,UAAAgB,EAAgC,EAAI;AAAA,QACtC;AAAA,QAEC,UAAAhB,EAAkB;AAAA,MAAA;AAAA,IAAA;AAAA,IAGtBkC,KACC,gBAAAxC,EAACc,GAAA,EAAO,QAAO,WAAU,OAAOkC,EAAA,GAC9B,UAAA,gBAAAM,EAACC,KAAK,eAAc,UAAS,KAAK,IAAI,YAAW,cAC/C,UAAA;AAAA,MAAA,gBAAAvD,EAAC,OAAA,EAAK,UAAAW,EAAE,oBAAoB,EAAA,CAAE;AAAA,MAC7BuC,EAAA;AAAA,MACD,gBAAAlD,EAACe,KAAO,SAAQ,aAAY,SAASR,GAClC,UAAAI,EAAE,uBAAuB,EAAA,CAC5B;AAAA,IAAA,EAAA,CACF,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ConfirmWireDetailsBanner.js","sources":["../../../../../src/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useWireInRequestsListSuspense } from '@gusto/embedded-api/react-query/wireInRequestsList'\nimport { usePayrollsListSuspense } from '@gusto/embedded-api/react-query/payrollsList'\nimport { useState, useEffect } from 'react'\nimport type { ConfirmationAlert } from '../types'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\n\ninterface ConfirmWireDetailsBannerProps extends BaseComponentInterface<'Payroll.ConfirmWireDetailsBanner'> {\n wireInId?: string\n companyId: string\n confirmationAlert?: ConfirmationAlert\n onStartWireTransfer: () => void\n}\n\n/** @internal */\nexport function ConfirmWireDetailsBanner(props: ConfirmWireDetailsBannerProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n wireInId,\n companyId,\n dictionary,\n confirmationAlert,\n onStartWireTransfer,\n className,\n}: ConfirmWireDetailsBannerProps) => {\n useComponentDictionary('Payroll.ConfirmWireDetailsBanner', dictionary)\n useI18n('Payroll.ConfirmWireDetailsBanner')\n const { t } = useTranslation('Payroll.ConfirmWireDetailsBanner')\n const { Alert, Banner, Button, UnorderedList, Text } = useComponentContext()\n const dateFormatter = useDateFormatter()\n const [isConfirmationAlertDismissed, setIsConfirmationAlertDismissed] = useState(false)\n const currencyFormatter = useNumberFormatter('currency')\n\n useEffect(() => {\n if (confirmationAlert) {\n setIsConfirmationAlertDismissed(false)\n }\n }, [confirmationAlert])\n\n const { data: wireInRequestsData } = useWireInRequestsListSuspense({\n companyUuid: companyId,\n })\n\n const { data: payrollsData } = usePayrollsListSuspense({\n companyId,\n processed: true,\n })\n\n const activeWireInRequests = (wireInRequestsData.wireInRequestList || []).filter(\n request => request.status === 'awaiting_funds',\n )\n const wireInRequests = wireInId\n ? activeWireInRequests.filter(request => request.uuid === wireInId)\n : activeWireInRequests\n\n const payrolls = payrollsData.payrollList || []\n\n const wireInRequestsWithPayrolls = wireInRequests.map(wireInRequest => {\n const payroll = payrolls.find(p => p.payrollUuid === wireInRequest.paymentUuid)\n const payrollRange = payroll?.payPeriod\n ? dateFormatter.formatPayPeriodRange(payroll.payPeriod.startDate, payroll.payPeriod.endDate)\n : ''\n return {\n wireInRequest,\n payroll,\n payrollRange,\n paymentType: wireInRequest.paymentType,\n requestedAmount: wireInRequest.requestedAmount ?? '',\n }\n })\n\n const shouldShowBanner =\n wireInRequestsWithPayrolls.length > 0 &&\n (wireInRequestsWithPayrolls.length > 1 || wireInRequestsWithPayrolls[0]?.wireInRequest)\n\n const shouldShowConfirmationAlert = !isConfirmationAlertDismissed && confirmationAlert\n\n if (!shouldShowBanner && !shouldShowConfirmationAlert) {\n return null\n }\n\n const formatDeadline = (deadline: string) => {\n const date = new Date(deadline)\n\n const timeRaw = date.toLocaleTimeString('en-US', {\n hour: 'numeric',\n minute: date.getMinutes() === 0 ? undefined : '2-digit',\n hour12: true,\n timeZone: 'America/Los_Angeles',\n timeZoneName: 'short',\n })\n\n const time = timeRaw.replace(/\\s?(AM|PM)/i, match => match.trim().toLowerCase())\n\n const dateString = date.toLocaleDateString('en-US', {\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n timeZone: 'America/Los_Angeles',\n })\n\n return { time, date: dateString }\n }\n\n const getBannerTitle = () => {\n const isSingleWireInRequest = wireInRequestsWithPayrolls.length === 1\n const { wireInRequest, payrollRange } = wireInRequestsWithPayrolls[0] || {}\n\n if (isSingleWireInRequest) {\n if (wireInId && wireInRequest?.wireInDeadline) {\n const { time, date } = formatDeadline(wireInRequest.wireInDeadline)\n return t('banner.title', { time, date })\n }\n return t('banner.titleWithPayroll', { payrollRange })\n }\n return t('banner.titleMultiple', { count: wireInRequestsWithPayrolls.length })\n }\n\n const getBannerContent = () => {\n if (wireInRequestsWithPayrolls.length > 1) {\n return (\n <UnorderedList\n items={wireInRequestsWithPayrolls.map(\n ({ paymentType, payrollRange, requestedAmount }, index) =>\n paymentType === 'Payroll' ? (\n <Text key={index}>{t('banner.requestLabelPayroll', { payrollRange })}</Text>\n ) : (\n <Text key={index}>\n {t('banner.requestLabelContractorPaymentGroup', {\n requestedAmount: currencyFormatter(Number(requestedAmount)),\n })}\n </Text>\n ),\n )}\n />\n )\n }\n }\n\n return (\n <Flex className={className} flexDirection=\"column\" gap={16}>\n {shouldShowConfirmationAlert && (\n <Alert\n status=\"success\"\n label={confirmationAlert.title}\n onDismiss={() => {\n setIsConfirmationAlertDismissed(true)\n }}\n >\n {confirmationAlert.content}\n </Alert>\n )}\n {shouldShowBanner && (\n <Banner status=\"warning\" title={getBannerTitle()}>\n <Flex flexDirection=\"column\" gap={16} alignItems=\"flex-start\">\n <div>{t('banner.description')}</div>\n {getBannerContent()}\n <Button variant=\"secondary\" onClick={onStartWireTransfer}>\n {t('cta.startWireTransfer')}\n </Button>\n </Flex>\n </Banner>\n )}\n </Flex>\n )\n}\n"],"names":["ConfirmWireDetailsBanner","props","jsx","BaseComponent","Root","wireInId","companyId","dictionary","confirmationAlert","onStartWireTransfer","className","useComponentDictionary","useI18n","t","useTranslation","Alert","Banner","Button","UnorderedList","Text","useComponentContext","dateFormatter","useDateFormatter","isConfirmationAlertDismissed","setIsConfirmationAlertDismissed","useState","currencyFormatter","useNumberFormatter","useEffect","wireInRequestsData","useWireInRequestsListSuspense","payrollsData","usePayrollsListSuspense","activeWireInRequests","request","wireInRequests","payrolls","wireInRequestsWithPayrolls","wireInRequest","payroll","p","payrollRange","shouldShowBanner","shouldShowConfirmationAlert","formatDeadline","deadline","date","time","match","dateString","getBannerTitle","isSingleWireInRequest","getBannerContent","paymentType","requestedAmount","index","Flex","jsxs"],"mappings":";;;;;;;;;;;;AAoBO,SAASA,GAAyBC,GAAsC;AAC7E,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,IAAO,CAAC;AAAA,EACZ,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,WAAAC;AACF,MAAqC;AACnC,EAAAC,EAAuB,oCAAoCJ,CAAU,GACrEK,EAAQ,kCAAkC;AAC1C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,kCAAkC,GACzD,EAAE,OAAAC,GAAO,QAAAC,GAAQ,QAAAC,GAAQ,eAAAC,GAAe,MAAAC,EAAA,IA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D,KAHQC,CAIX;AAAA,UAAA;AAAA,QAEN;AAAA,MAAA;AAAA,EAIR;AAEA,2BACGC,GAAA,EAAK,WAAA9C,GAAsB,eAAc,UAAS,KAAK,IACrD,UAAA;AAAA,IAAAiC,KACC,gBAAAzC;AAAA,MAACa;AAAA,MAAA;AAAA,QACC,QAAO;AAAA,QACP,OAAOP,EAAkB;AAAA,QACzB,WAAW,MAAM;AACf,UAAAgB,EAAgC,EAAI;AAAA,QACtC;AAAA,QAEC,UAAAhB,EAAkB;AAAA,MAAA;AAAA,IAAA;AAAA,IAGtBkC,KACC,gBAAAxC,EAACc,GAAA,EAAO,QAAO,WAAU,OAAOkC,EAAA,GAC9B,UAAA,gBAAAO,EAACD,KAAK,eAAc,UAAS,KAAK,IAAI,YAAW,cAC/C,UAAA;AAAA,MAAA,gBAAAtD,EAAC,OAAA,EAAK,UAAAW,EAAE,oBAAoB,EAAA,CAAE;AAAA,MAC7BuC,EAAA;AAAA,MACD,gBAAAlD,EAACe,KAAO,SAAQ,aAAY,SAASR,GAClC,UAAAI,EAAE,uBAAuB,EAAA,CAC5B;AAAA,IAAA,EAAA,CACF,EAAA,CACF;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as f } from "react-i18next";
|
|
3
3
|
import { Flex as o } from "../../../Common/Flex/Flex.js";
|
|
4
4
|
import { ActionsLayout as g } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
5
5
|
import { useComponentContext as x } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
6
|
import { useI18n as D } from "../../../../i18n/I18n.js";
|
|
7
7
|
function S({
|
|
8
|
-
payPeriodOptions:
|
|
8
|
+
payPeriodOptions: n,
|
|
9
9
|
selectedPeriodKey: r,
|
|
10
10
|
onSelectPeriod: c,
|
|
11
11
|
onSubmit: m,
|
|
@@ -13,20 +13,20 @@ function S({
|
|
|
13
13
|
className: a
|
|
14
14
|
}) {
|
|
15
15
|
D("Payroll.Dismissal");
|
|
16
|
-
const { t: i } = f("Payroll.Dismissal"), { Heading: s, Text: p, Select:
|
|
17
|
-
return
|
|
16
|
+
const { t: i } = f("Payroll.Dismissal"), { Heading: s, Text: p, Select: u, Button: h, Alert: d } = x();
|
|
17
|
+
return n.length === 0 ? /* @__PURE__ */ t(o, { className: a, flexDirection: "column", gap: 24, children: [
|
|
18
18
|
/* @__PURE__ */ e(o, { flexDirection: "column", gap: 4, children: /* @__PURE__ */ e(s, { as: "h2", children: i("pageTitle") }) }),
|
|
19
19
|
/* @__PURE__ */ e(d, { status: "info", label: i("emptyState") })
|
|
20
|
-
] })
|
|
21
|
-
/* @__PURE__ */
|
|
20
|
+
] }) : /* @__PURE__ */ t(o, { className: a, flexDirection: "column", gap: 24, children: [
|
|
21
|
+
/* @__PURE__ */ t(o, { flexDirection: "column", gap: 4, children: [
|
|
22
22
|
/* @__PURE__ */ e(s, { as: "h2", children: i("pageTitle") }),
|
|
23
23
|
/* @__PURE__ */ e(p, { variant: "supporting", children: i("pageDescription") })
|
|
24
24
|
] }),
|
|
25
25
|
/* @__PURE__ */ e(
|
|
26
|
-
|
|
26
|
+
u,
|
|
27
27
|
{
|
|
28
28
|
label: i("selectLabel"),
|
|
29
|
-
options:
|
|
29
|
+
options: n,
|
|
30
30
|
value: r,
|
|
31
31
|
onChange: c,
|
|
32
32
|
placeholder: i("selectPlaceholder"),
|
|
@@ -34,7 +34,7 @@ function S({
|
|
|
34
34
|
}
|
|
35
35
|
),
|
|
36
36
|
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(
|
|
37
|
-
|
|
37
|
+
h,
|
|
38
38
|
{
|
|
39
39
|
variant: "primary",
|
|
40
40
|
onClick: m,
|
|
@@ -43,7 +43,7 @@ function S({
|
|
|
43
43
|
children: i("continueCta")
|
|
44
44
|
}
|
|
45
45
|
) })
|
|
46
|
-
] })
|
|
46
|
+
] });
|
|
47
47
|
}
|
|
48
48
|
export {
|
|
49
49
|
S as DismissalPayPeriodSelectionPresentation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DismissalPayPeriodSelectionPresentation.js","sources":["../../../../../src/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { Flex, ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport type { SelectOption } from '@/components/Common/UI/Select/SelectTypes'\n\n/** @internal */\nexport interface DismissalPayPeriodSelectionPresentationProps {\n /** Pay period options to display in the select. */\n payPeriodOptions: SelectOption[]\n /** Key of the currently selected pay period option, or undefined when none is selected. */\n selectedPeriodKey: string | undefined\n /** Called when the user selects a pay period from the options. */\n onSelectPeriod: (value: string) => void\n /** Called when the user clicks the continue button. */\n onSubmit: () => void\n /** Whether the submit action is in flight. */\n isPending: boolean\n /** CSS class name applied to the root element. */\n className?: string\n}\n\n/** @internal */\nexport function DismissalPayPeriodSelectionPresentation({\n payPeriodOptions,\n selectedPeriodKey,\n onSelectPeriod,\n onSubmit,\n isPending,\n className,\n}: DismissalPayPeriodSelectionPresentationProps) {\n useI18n('Payroll.Dismissal')\n const { t } = useTranslation('Payroll.Dismissal')\n const { Heading, Text, Select, Button, Alert } = useComponentContext()\n\n const hasNoPayPeriods = payPeriodOptions.length === 0\n\n if (hasNoPayPeriods) {\n return (\n <
|
|
1
|
+
{"version":3,"file":"DismissalPayPeriodSelectionPresentation.js","sources":["../../../../../src/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { Flex, ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport type { SelectOption } from '@/components/Common/UI/Select/SelectTypes'\n\n/** @internal */\nexport interface DismissalPayPeriodSelectionPresentationProps {\n /** Pay period options to display in the select. */\n payPeriodOptions: SelectOption[]\n /** Key of the currently selected pay period option, or undefined when none is selected. */\n selectedPeriodKey: string | undefined\n /** Called when the user selects a pay period from the options. */\n onSelectPeriod: (value: string) => void\n /** Called when the user clicks the continue button. */\n onSubmit: () => void\n /** Whether the submit action is in flight. */\n isPending: boolean\n /** CSS class name applied to the root element. */\n className?: string\n}\n\n/** @internal */\nexport function DismissalPayPeriodSelectionPresentation({\n payPeriodOptions,\n selectedPeriodKey,\n onSelectPeriod,\n onSubmit,\n isPending,\n className,\n}: DismissalPayPeriodSelectionPresentationProps) {\n useI18n('Payroll.Dismissal')\n const { t } = useTranslation('Payroll.Dismissal')\n const { Heading, Text, Select, Button, Alert } = useComponentContext()\n\n const hasNoPayPeriods = payPeriodOptions.length === 0\n\n if (hasNoPayPeriods) {\n return (\n <Flex className={className} flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('pageTitle')}</Heading>\n </Flex>\n <Alert status=\"info\" label={t('emptyState')} />\n </Flex>\n )\n }\n\n return (\n <Flex className={className} flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('pageTitle')}</Heading>\n <Text variant=\"supporting\">{t('pageDescription')}</Text>\n </Flex>\n\n <Select\n label={t('selectLabel')}\n options={payPeriodOptions}\n value={selectedPeriodKey}\n onChange={onSelectPeriod}\n placeholder={t('selectPlaceholder')}\n isRequired\n />\n\n <ActionsLayout>\n <Button\n variant=\"primary\"\n onClick={onSubmit}\n isLoading={isPending}\n isDisabled={isPending || selectedPeriodKey === undefined}\n >\n {t('continueCta')}\n </Button>\n </ActionsLayout>\n </Flex>\n )\n}\n"],"names":["DismissalPayPeriodSelectionPresentation","payPeriodOptions","selectedPeriodKey","onSelectPeriod","onSubmit","isPending","className","useI18n","t","useTran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;AAAA,sBAGXW,GAAA,EACC,UAAA,gBAAAF;AAAA,MAACJ;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,SAAST;AAAA,QACT,WAAWC;AAAA,QACX,YAAYA,KAAaH,MAAsB;AAAA,QAE9C,YAAE,aAAa;AAAA,MAAA;AAAA,IAAA,EAClB,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,115 +1,119 @@
|
|
|
1
|
-
import { jsx as e, jsxs as t
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useForm as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { z as
|
|
6
|
-
import { zodResolver as
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as F, useState as o, useEffect as G } from "react";
|
|
3
|
+
import { useForm as R, FormProvider as U } from "react-hook-form";
|
|
4
|
+
import { useTranslation as z } from "react-i18next";
|
|
5
|
+
import { z as w } from "zod";
|
|
6
|
+
import { zodResolver as H } from "@hookform/resolvers/zod";
|
|
7
7
|
import a from "./GrossUpModal.module.scss.js";
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { ActionsLayout as
|
|
8
|
+
import { Flex as j } from "../../Common/Flex/Flex.js";
|
|
9
|
+
import { ActionsLayout as k } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
10
10
|
import "react-error-boundary";
|
|
11
11
|
import "@tanstack/react-query";
|
|
12
|
-
import { useBase as
|
|
12
|
+
import { useBase as B } from "../../Base/useBase.js";
|
|
13
13
|
import "@gusto/embedded-api/models/errors/apierror";
|
|
14
14
|
import "@gusto/embedded-api/models/errors/gustoembeddederror";
|
|
15
15
|
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
16
16
|
import "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
17
17
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
18
|
-
import { formatNumberAsCurrency as
|
|
18
|
+
import { formatNumberAsCurrency as D } from "../../../helpers/formattedStrings.js";
|
|
19
19
|
import "../../../shared/constants.js";
|
|
20
|
-
import { useComponentContext as
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
import { useComponentContext as L } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
21
|
+
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
22
|
+
import { useI18n as V } from "../../../i18n/I18n.js";
|
|
23
|
+
import { NumberInputField as E } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
24
|
+
const T = w.object({
|
|
25
|
+
netPay: w.number().positive()
|
|
25
26
|
});
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
const { t: r } =
|
|
29
|
-
resolver:
|
|
30
|
-
|
|
27
|
+
function ue({ isOpen: n, onCalculateGrossUp: P, onApply: x, onCancel: p }) {
|
|
28
|
+
V("Payroll.GrossUpModal");
|
|
29
|
+
const { t: r } = z("Payroll.GrossUpModal"), { Modal: A, Heading: u, Text: i, Button: c, Alert: f } = L(), { baseSubmitHandler: y } = B(), M = F(null), [l, m] = o(null), [h, d] = o(null), [g, b] = o(!1), [N, v] = o(!1), s = R({
|
|
30
|
+
resolver: H(T),
|
|
31
|
+
// Start blank rather than 0: 0 is not a valid net amount, and a leading 0
|
|
32
|
+
// in the field means typing an amount produces values like "0350".
|
|
33
|
+
defaultValues: {}
|
|
31
34
|
});
|
|
32
|
-
|
|
33
|
-
n || (s.reset(
|
|
35
|
+
G(() => {
|
|
36
|
+
n || (s.reset(), m(null), d(null));
|
|
34
37
|
}, [n, s.reset]);
|
|
35
|
-
const
|
|
36
|
-
|
|
38
|
+
const I = async (S) => {
|
|
39
|
+
d(null), m(null), b(!0), await y(null, async () => {
|
|
37
40
|
try {
|
|
38
|
-
const C = await
|
|
39
|
-
C ?
|
|
41
|
+
const C = await P(S.netPay);
|
|
42
|
+
C ? m(C) : d(r("errorMessage"));
|
|
40
43
|
} finally {
|
|
41
44
|
b(!1);
|
|
42
45
|
}
|
|
43
46
|
});
|
|
44
47
|
};
|
|
45
48
|
return /* @__PURE__ */ e(
|
|
46
|
-
|
|
49
|
+
A,
|
|
47
50
|
{
|
|
48
51
|
isOpen: n,
|
|
49
|
-
onClose:
|
|
50
|
-
containerRef:
|
|
51
|
-
footer: /* @__PURE__ */ t(
|
|
52
|
+
onClose: p,
|
|
53
|
+
containerRef: M,
|
|
54
|
+
footer: /* @__PURE__ */ t(k, { children: [
|
|
52
55
|
/* @__PURE__ */ e(
|
|
53
|
-
|
|
56
|
+
c,
|
|
54
57
|
{
|
|
55
58
|
variant: "primary",
|
|
56
59
|
isDisabled: !l,
|
|
57
60
|
onClick: async () => {
|
|
58
61
|
l && (v(!0), await y(null, async () => {
|
|
59
62
|
try {
|
|
60
|
-
await
|
|
63
|
+
await x(l);
|
|
61
64
|
} finally {
|
|
62
65
|
v(!1);
|
|
63
66
|
}
|
|
64
67
|
}));
|
|
65
68
|
},
|
|
66
|
-
isLoading:
|
|
69
|
+
isLoading: N,
|
|
67
70
|
children: r("applyCta")
|
|
68
71
|
}
|
|
69
72
|
),
|
|
70
|
-
/* @__PURE__ */ e(
|
|
73
|
+
/* @__PURE__ */ e(c, { variant: "secondary", onClick: p, children: r("cancelCta") })
|
|
71
74
|
] }),
|
|
72
|
-
children: /* @__PURE__ */ t(
|
|
75
|
+
children: /* @__PURE__ */ t(U, { ...s, children: [
|
|
73
76
|
/* @__PURE__ */ t("div", { className: a.header, children: [
|
|
74
77
|
/* @__PURE__ */ e(u, { as: "h2", styledAs: "h3", children: r("title") }),
|
|
75
|
-
/* @__PURE__ */ e(
|
|
78
|
+
/* @__PURE__ */ e(i, { variant: "supporting", as: "p", children: r("description") })
|
|
76
79
|
] }),
|
|
77
80
|
/* @__PURE__ */ t("div", { className: a.content, children: [
|
|
78
81
|
h && /* @__PURE__ */ e("div", { className: a.alert, children: /* @__PURE__ */ e(f, { label: h, status: "error", disableScrollIntoView: !0 }) }),
|
|
79
82
|
/* @__PURE__ */ e("div", { className: a.alert, children: /* @__PURE__ */ e(f, { label: r("warning"), status: "warning", disableScrollIntoView: !0 }) }),
|
|
80
|
-
/* @__PURE__ */ t(
|
|
83
|
+
/* @__PURE__ */ t(j, { flexDirection: "row", gap: 8, alignItems: "flex-end", children: [
|
|
81
84
|
/* @__PURE__ */ e(
|
|
82
|
-
|
|
85
|
+
E,
|
|
83
86
|
{
|
|
84
87
|
name: "netPay",
|
|
85
88
|
label: r("netPayLabel"),
|
|
86
89
|
format: "currency",
|
|
90
|
+
adornmentStart: "$",
|
|
87
91
|
errorMessage: r("validations.netPay"),
|
|
88
92
|
min: 0,
|
|
89
93
|
isRequired: !0
|
|
90
94
|
}
|
|
91
95
|
),
|
|
92
96
|
/* @__PURE__ */ e(
|
|
93
|
-
|
|
97
|
+
c,
|
|
94
98
|
{
|
|
95
99
|
variant: "secondary",
|
|
96
100
|
className: a.calculateButton,
|
|
97
101
|
isDisabled: g,
|
|
98
|
-
onClick: s.handleSubmit(
|
|
102
|
+
onClick: s.handleSubmit(I),
|
|
99
103
|
children: r(g ? "calculatingCta" : "calculateCta")
|
|
100
104
|
}
|
|
101
105
|
)
|
|
102
106
|
] }),
|
|
103
|
-
l
|
|
104
|
-
/* @__PURE__ */ e(
|
|
105
|
-
/* @__PURE__ */ e(u, { as: "h3", children:
|
|
106
|
-
] }) })
|
|
107
|
+
l ? /* @__PURE__ */ t("div", { className: a.result, children: [
|
|
108
|
+
/* @__PURE__ */ e(i, { size: "sm", variant: "supporting", weight: "semibold", children: r("grossPayResult") }),
|
|
109
|
+
/* @__PURE__ */ e(u, { as: "h3", children: D(parseFloat(l)) })
|
|
110
|
+
] }) : /* @__PURE__ */ e(i, { size: "sm", variant: "supporting", children: r("applyHint") })
|
|
107
111
|
] })
|
|
108
112
|
] })
|
|
109
113
|
}
|
|
110
114
|
);
|
|
111
115
|
}
|
|
112
116
|
export {
|
|
113
|
-
|
|
117
|
+
ue as GrossUpModal
|
|
114
118
|
};
|
|
115
119
|
//# sourceMappingURL=GrossUpModal.js.map
|