@gusto/embedded-react-sdk 0.28.0 → 0.29.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 +25 -0
- package/dist/components/Common/Fields/PercentageField/PercentageField.d.ts +8 -0
- package/dist/components/Common/Fields/PercentageField/PercentageField.js +58 -0
- package/dist/components/Common/Fields/PercentageField/PercentageField.js.map +1 -0
- package/dist/components/Common/Fields/PercentageField/index.d.ts +2 -0
- package/dist/components/Common/SignatureForm/SignatureForm.js +11 -12
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +3 -4
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +7 -8
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/TaxInputs/TaxInputs.js +125 -98
- package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
- package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +5 -5
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +3 -4
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +2 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +17 -16
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -5
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +2 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +6 -5
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -5
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -7
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +6 -6
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -6
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -5
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +2 -3
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +6 -7
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -6
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +2 -3
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -5
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -2
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -5
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +6 -7
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +2 -2
- package/dist/components/Company/FederalTaxes/Form.js +3 -4
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +8 -10
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +7 -8
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -8
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +2 -3
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +6 -7
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +6 -5
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +2 -2
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -5
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +2 -3
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +6 -7
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +39 -56
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -5
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +2 -3
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +2 -3
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -2
- package/dist/components/Company/OnboardingOverview/context.js +3 -5
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +2 -2
- package/dist/components/Company/PaySchedule/_parts/Actions.js +2 -3
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +24 -23
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Head.js +8 -9
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +11 -12
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -7
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +2 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +60 -67
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -5
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/index.d.ts +2 -0
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +2 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +2 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -5
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/index.d.ts +2 -0
- package/dist/components/Company/index.d.ts +2 -0
- package/dist/components/Company/index.js +21 -17
- package/dist/components/Company/index.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +2 -2
- package/dist/components/Contractor/Address/Form.js +11 -10
- package/dist/components/Contractor/Address/Form.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +5 -7
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +17 -17
- package/dist/components/Contractor/ContractorList/useContractorList.d.ts +8 -8
- package/dist/components/Contractor/ContractorList/useContractorList.js +9 -25
- package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +11 -12
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +2 -2
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +2 -3
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +23 -22
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +7 -8
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +1 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +38 -24
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +1 -0
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +95 -60
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +2 -3
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +6 -7
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +2 -3
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +67 -42
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +3 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +40 -36
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/types.d.ts +2 -0
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +13 -13
- package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +1 -1
- package/dist/components/Employee/Compensation/Actions.js +1 -1
- package/dist/components/Employee/Compensation/Edit.js +14 -14
- package/dist/components/Employee/Compensation/List.js +22 -23
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +10 -12
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +11 -13
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +11 -13
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +3 -2
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +2 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -5
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -5
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +6 -7
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +77 -95
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +2 -3
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +12 -12
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -5
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/Actions.js +5 -6
- package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +11 -12
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -5
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +8 -8
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
- package/dist/components/Employee/PaymentMethod/Actions.js +5 -6
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +3 -3
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +6 -6
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +2 -2
- package/dist/components/Employee/PaymentMethod/Split.js +9 -9
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -7
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +5 -6
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +5 -6
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +10 -9
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +3 -3
- package/dist/components/Employee/Profile/useProfile.js +3 -5
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/Actions.js +5 -6
- package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -5
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +6 -7
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +13 -14
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +3 -5
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Flow/Flow.js +2 -3
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -16
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +4 -4
- package/dist/components/InformationRequests/InformationRequests.js +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -9
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js +11 -12
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +2 -3
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +12 -12
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +3 -2
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +50 -68
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +39 -38
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +17 -18
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +2 -3
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +2 -3
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +3 -2
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +2 -3
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +2 -3
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +6 -6
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +2 -3
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +5 -7
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -4
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/formattedStrings.js +11 -12
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/helpers/percentageConversion.d.ts +3 -0
- package/dist/helpers/percentageConversion.js +27 -0
- package/dist/helpers/percentageConversion.js.map +1 -0
- package/dist/helpers/percentageConversion.test.d.ts +1 -0
- package/dist/hooks/usePagination/usePagination.d.ts +15 -0
- package/dist/hooks/usePagination/usePagination.js +37 -0
- package/dist/hooks/usePagination/usePagination.js.map +1 -0
- package/dist/hooks/usePagination/usePagination.test.d.ts +1 -0
- package/dist/i18n/en/Company.StateTaxes.json.js +1 -1
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +28 -28
- package/dist/i18n/en/common.json.d.ts +3 -1
- package/dist/i18n/en/common.json.js +1 -1
- package/dist/shared/constants.d.ts +2 -0
- package/dist/shared/constants.js +11 -10
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +7 -0
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FastAchSubmissionBlockerBanner.js","sources":["../../../../../src/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type {\n PayrollSubmissionBlockerType,\n UnblockOptions,\n} from '@gusto/embedded-api/models/components/payrollsubmissionblockertype'\nimport { Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport IconFast from '@/assets/icons/icon-zap-fast.svg?react'\n\ntype FastAchBlockerType = 'fast_ach_threshold_exceeded' | 'needs_earned_access_for_fast_ach'\n\nconst blockerTitleKeys = {\n fast_ach_threshold_exceeded: 'submissionBlockers.fast_ach_threshold_exceeded.title',\n needs_earned_access_for_fast_ach: 'submissionBlockers.needs_earned_access_for_fast_ach.title',\n} as const\n\ninterface FastAchSubmissionBlockerBannerProps {\n blocker: PayrollSubmissionBlockerType\n selectedValue?: string\n onUnblockOptionChange: (blockerType: string, value: string) => void\n}\n\nexport const FastAchSubmissionBlockerBanner = ({\n blocker,\n selectedValue,\n onUnblockOptionChange,\n}: FastAchSubmissionBlockerBannerProps) => {\n const { t } = useTranslation('Payroll.PayrollOverview')\n const { Banner, Text, RadioGroup, Badge } = useComponentContext()\n const dateFormatter = useDateFormatter()\n const blockerType = (blocker.blockerType || 'fast_ach_threshold_exceeded') as FastAchBlockerType\n\n return (\n <Banner status=\"error\" title={t(blockerTitleKeys[blockerType])}>\n <Flex flexDirection=\"column\" gap={16}>\n <Text>{t('submissionBlockers.fastAchOptions.description')}</Text>\n <RadioGroup\n label={t('submissionBlockers.fastAchOptions.fundingOptionsLabel')}\n shouldVisuallyHideLabel\n options={\n blocker.unblockOptions?.map((option: UnblockOptions) => {\n const isWire = option.unblockType === 'wire_in'\n const label = isWire\n ? t('submissionBlockers.fastAchOptions.wireLabel')\n : t('submissionBlockers.fastAchOptions.directDepositLabel')\n const description = isWire\n ? t('submissionBlockers.fastAchOptions.wireDescription')\n : t('submissionBlockers.fastAchOptions.directDepositDescription')\n\n return {\n value: option.unblockType || '',\n label: (\n <Flex alignItems=\"center\" gap={8}>\n <Text weight=\"semibold\">{label}</Text>\n {isWire && (\n <Badge status=\"success\">\n <IconFast aria-hidden />{' '}\n {t('submissionBlockers.fastAchOptions.wireFastestBadge')}\n </Badge>\n )}\n {option.checkDate && (\n <Badge status=\"info\">\n {t('submissionBlockers.fastAchOptions.employeePayDate', {\n date: dateFormatter.formatShortWithYear(option.checkDate),\n })}\n </Badge>\n )}\n </Flex>\n ),\n description,\n }\n }) || []\n }\n value={selectedValue}\n onChange={value => {\n onUnblockOptionChange(blockerType, value)\n }}\n />\n </Flex>\n </Banner>\n )\n}\n"],"names":["blockerTitleKeys","FastAchSubmissionBlockerBanner","blocker","selectedValue","onUnblockOptionChange","t","useTranslation","Banner","Text","RadioGroup","Badge","useComponentContext","dateFormatter","useDateFormatter","blockerType","jsx","jsxs","Flex","option","isWire","label","description","IconFast","value"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FastAchSubmissionBlockerBanner.js","sources":["../../../../../src/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type {\n PayrollSubmissionBlockerType,\n UnblockOptions,\n} from '@gusto/embedded-api/models/components/payrollsubmissionblockertype'\nimport { Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport IconFast from '@/assets/icons/icon-zap-fast.svg?react'\n\ntype FastAchBlockerType = 'fast_ach_threshold_exceeded' | 'needs_earned_access_for_fast_ach'\n\nconst blockerTitleKeys = {\n fast_ach_threshold_exceeded: 'submissionBlockers.fast_ach_threshold_exceeded.title',\n needs_earned_access_for_fast_ach: 'submissionBlockers.needs_earned_access_for_fast_ach.title',\n} as const\n\ninterface FastAchSubmissionBlockerBannerProps {\n blocker: PayrollSubmissionBlockerType\n selectedValue?: string\n onUnblockOptionChange: (blockerType: string, value: string) => void\n}\n\nexport const FastAchSubmissionBlockerBanner = ({\n blocker,\n selectedValue,\n onUnblockOptionChange,\n}: FastAchSubmissionBlockerBannerProps) => {\n const { t } = useTranslation('Payroll.PayrollOverview')\n const { Banner, Text, RadioGroup, Badge } = useComponentContext()\n const dateFormatter = useDateFormatter()\n const blockerType = (blocker.blockerType || 'fast_ach_threshold_exceeded') as FastAchBlockerType\n\n return (\n <Banner status=\"error\" title={t(blockerTitleKeys[blockerType])}>\n <Flex flexDirection=\"column\" gap={16}>\n <Text>{t('submissionBlockers.fastAchOptions.description')}</Text>\n <RadioGroup\n label={t('submissionBlockers.fastAchOptions.fundingOptionsLabel')}\n shouldVisuallyHideLabel\n options={\n blocker.unblockOptions?.map((option: UnblockOptions) => {\n const isWire = option.unblockType === 'wire_in'\n const label = isWire\n ? t('submissionBlockers.fastAchOptions.wireLabel')\n : t('submissionBlockers.fastAchOptions.directDepositLabel')\n const description = isWire\n ? t('submissionBlockers.fastAchOptions.wireDescription')\n : t('submissionBlockers.fastAchOptions.directDepositDescription')\n\n return {\n value: option.unblockType || '',\n label: (\n <Flex alignItems=\"center\" gap={8}>\n <Text weight=\"semibold\">{label}</Text>\n {isWire && (\n <Badge status=\"success\">\n <IconFast aria-hidden />{' '}\n {t('submissionBlockers.fastAchOptions.wireFastestBadge')}\n </Badge>\n )}\n {option.checkDate && (\n <Badge status=\"info\">\n {t('submissionBlockers.fastAchOptions.employeePayDate', {\n date: dateFormatter.formatShortWithYear(option.checkDate),\n })}\n </Badge>\n )}\n </Flex>\n ),\n description,\n }\n }) || []\n }\n value={selectedValue}\n onChange={value => {\n onUnblockOptionChange(blockerType, value)\n }}\n />\n </Flex>\n </Banner>\n )\n}\n"],"names":["blockerTitleKeys","FastAchSubmissionBlockerBanner","blocker","selectedValue","onUnblockOptionChange","t","useTranslation","Banner","Text","RadioGroup","Badge","useComponentContext","dateFormatter","useDateFormatter","blockerType","jsx","jsxs","Flex","option","isWire","label","description","IconFast","value"],"mappings":";;;;;;;;AAYA,MAAMA,IAAmB;AAAA,EACvB,6BAA6B;AAAA,EAC7B,kCAAkC;AACpC,GAQaC,IAAiC,CAAC;AAAA,EAC7C,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,uBAAAC;AACF,MAA2C;AACzC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB,GAChD,EAAE,QAAAC,GAAQ,MAAAC,GAAM,YAAAC,GAAY,OAAAC,EAAA,IAAUC,EAAA,GACtCC,IAAgBC,EAAA,GAChBC,IAAeZ,EAAQ,eAAe;AAE5C,SACE,gBAAAa,EAACR,GAAA,EAAO,QAAO,SAAQ,OAAOF,EAAEL,EAAiBc,CAAW,CAAC,GAC3D,UAAA,gBAAAE,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAF,EAACP,GAAA,EAAM,UAAAH,EAAE,+CAA+C,EAAA,CAAE;AAAA,IAC1D,gBAAAU;AAAA,MAACN;AAAA,MAAA;AAAA,QACC,OAAOJ,EAAE,uDAAuD;AAAA,QAChE,yBAAuB;AAAA,QACvB,SACEH,EAAQ,gBAAgB,IAAI,CAACgB,MAA2B;AACtD,gBAAMC,IAASD,EAAO,gBAAgB,WAChCE,IACFf,EADUc,IACR,gDACA,sDAD6C,GAE7CE,IACFhB,EADgBc,IACd,sDACA,4DADmD;AAGzD,iBAAO;AAAA,YACL,OAAOD,EAAO,eAAe;AAAA,YAC7B,OACE,gBAAAF,EAACC,GAAA,EAAK,YAAW,UAAS,KAAK,GAC7B,UAAA;AAAA,cAAA,gBAAAF,EAACP,GAAA,EAAK,QAAO,YAAY,UAAAY,GAAM;AAAA,cAC9BD,KACC,gBAAAH,EAACN,GAAA,EAAM,QAAO,WACZ,UAAA;AAAA,gBAAA,gBAAAK,EAACO,GAAA,EAAS,eAAW,GAAA,CAAC;AAAA,gBAAG;AAAA,gBACxBjB,EAAE,oDAAoD;AAAA,cAAA,GACzD;AAAA,cAEDa,EAAO,aACN,gBAAAH,EAACL,KAAM,QAAO,QACX,YAAE,qDAAqD;AAAA,gBACtD,MAAME,EAAc,oBAAoBM,EAAO,SAAS;AAAA,cAAA,CACzD,EAAA,CACH;AAAA,YAAA,GAEJ;AAAA,YAEF,aAAAG;AAAA,UAAA;AAAA,QAEJ,CAAC,KAAK,CAAA;AAAA,QAER,OAAOlB;AAAA,QACP,UAAU,CAAAoB,MAAS;AACjB,UAAAnB,EAAsBU,GAAaS,CAAK;AAAA,QAC1C;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
@@ -4,7 +4,6 @@ import { useTranslation as z } from "react-i18next";
|
|
|
4
4
|
import p from "classnames";
|
|
5
5
|
import i from "./PayrollReceiptsPresentation.module.scss.js";
|
|
6
6
|
import { Flex as m } from "../../Common/Flex/Flex.js";
|
|
7
|
-
import "../../../shared/constants.js";
|
|
8
7
|
import { useComponentContext as M } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
9
8
|
import { formatNumberAsCurrency as a } from "../../../helpers/formattedStrings.js";
|
|
10
9
|
import { useI18n as $ } from "../../../i18n/I18n.js";
|
|
@@ -12,7 +11,7 @@ import { useContainerBreakpoints as A } from "../../../hooks/useContainerBreakpo
|
|
|
12
11
|
import B from "../../../assets/icons/receipt-check.svg.js";
|
|
13
12
|
import { DataTable as y } from "../../Common/DataView/DataTable/DataTable.js";
|
|
14
13
|
import { DataView as f } from "../../Common/DataView/DataView.js";
|
|
15
|
-
const
|
|
14
|
+
const Y = ({
|
|
16
15
|
receiptData: o,
|
|
17
16
|
withReimbursements: u = !0
|
|
18
17
|
}) => {
|
|
@@ -230,6 +229,6 @@ const Z = ({
|
|
|
230
229
|
] }) });
|
|
231
230
|
};
|
|
232
231
|
export {
|
|
233
|
-
|
|
232
|
+
Y as PayrollReceiptsPresentation
|
|
234
233
|
};
|
|
235
234
|
//# sourceMappingURL=PayrollReceiptsPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollReceiptsPresentation.js","sources":["../../../../src/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport type {\n PayrollReceipt,\n Taxes as TaxBreakdownItem,\n PayrollReceiptEmployeeCompensations as EmployeeBreakdownItem,\n} from '@gusto/embedded-api/models/components/payrollreceipt'\nimport styles from './PayrollReceiptsPresentation.module.scss'\nimport { DataView, DataTable, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { useContainerBreakpoints } from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\nimport ReceiptCheck from '@/assets/icons/receipt-check.svg?react'\n\ninterface PayrollReceiptsPresentationProps {\n receiptData: PayrollReceipt\n withReimbursements?: boolean\n}\n\nexport const PayrollReceiptsPresentation = ({\n receiptData,\n withReimbursements = true,\n}: PayrollReceiptsPresentationProps) => {\n const { Heading, Text } = useComponentContext()\n useI18n('Payroll.PayrollReceipts')\n const { t } = useTranslation('Payroll.PayrollReceipts')\n\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isMobile = !breakpoints.includes('small')\n\n // Helper to get employee full name\n const getEmployeeFullName = (emp: EmployeeBreakdownItem) =>\n `${emp.employeeFirstName || ''} ${emp.employeeLastName || ''}`.trim()\n\n const getTotalChildSupport = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.childSupportGarnishment || '0'),\n 0,\n )\n\n const getTotalReimbursements = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.totalReimbursement || '0'),\n 0,\n )\n\n const getTotalNetPay = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.netPay || '0'),\n 0,\n )\n\n const getTotalTaxes = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.totalTax || '0'),\n 0,\n )\n\n const breakdownData = [\n {\n label: t('breakdown.directDeposits'),\n amount: parseFloat(receiptData.totals?.netPayDebit || '0'),\n },\n ...(withReimbursements\n ? [\n {\n label: t('breakdown.reimbursements'),\n amount: parseFloat(receiptData.totals?.reimbursementDebit || '0'),\n },\n ]\n : []),\n {\n label: t('breakdown.garnishments'),\n amount: parseFloat(receiptData.totals?.childSupportDebit || '0'),\n },\n { label: t('breakdown.taxes'), amount: parseFloat(receiptData.totals?.taxDebit || '0') },\n ]\n\n const receiptDetailsConfig = [\n {\n label: t('receipt.receiptId'),\n value: receiptData.payrollUuid || '',\n },\n {\n label: t('receipt.from'),\n value: receiptData.nameOfSender || '',\n },\n {\n label: t('receipt.to'),\n value: receiptData.nameOfRecipient || 'Payroll Recipients',\n },\n {\n label: t('receipt.debitDate'),\n value: receiptData.debitDate || '',\n },\n ]\n\n const renderReceiptHeader = () => (\n <div className={classNames(styles.receiptHeader, isMobile && styles.receiptHeaderMobile)}>\n <Flex flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={16}>\n <div className={styles.receiptIcon}>\n <ReceiptCheck className={styles.checkmarkIcon} />\n </div>\n\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={8}>\n <Text size=\"sm\" variant=\"supporting\">\n {t('receipt.totalLabel')}\n </Text>\n <Heading as=\"h1\" styledAs=\"h2\" className={styles.totalAmount}>\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.companyDebit || '0'))}\n </Heading>\n </Flex>\n </Flex>\n\n <div className={styles.receiptDetailsTable}>\n <DataView\n label={t('receipt.detailsLabel')}\n variant=\"minimal\"\n breakAt=\"small\"\n breakpoints={{\n base: '0rem',\n small: '22rem',\n }}\n columns={[\n {\n title: '',\n render: (item: { label: string; value: string }) => (\n <Text size=\"sm\" variant=\"supporting\">\n {item.label}\n </Text>\n ),\n },\n {\n title: '',\n render: (item: { label: string; value: string }) => (\n <Text size=\"sm\">{item.value}</Text>\n ),\n },\n ]}\n data={receiptDetailsConfig}\n />\n </div>\n\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={12}>\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.disclaimer, isMobile && styles.textMobile)}\n >\n {receiptData.recipientNotice}\n </Text>\n\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.companyInfo, isMobile && styles.textMobile)}\n >\n {receiptData.license}\n </Text>\n\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.address, isMobile && styles.textMobile)}\n >\n {receiptData.licensee &&\n `${receiptData.licensee.address || ''}, ${receiptData.licensee.city || ''}, ${receiptData.licensee.state || ''} ${receiptData.licensee.postalCode || ''}`}\n </Text>\n </Flex>\n </Flex>\n </div>\n )\n\n const renderBreakdownSection = () => (\n <Flex flexDirection=\"column\" gap={16}>\n <DataTable\n label={t('sections.debitedLabel')}\n columns={[\n {\n title: t('sections.debitedLabel'),\n render: (item: { label: string; amount: number }) => <Text>{item.label}</Text>,\n },\n {\n title: t('breakdown.amount'),\n render: (item: { label: string; amount: number }) => (\n <Text>{formatNumberAsCurrency(item.amount)}</Text>\n ),\n },\n ]}\n data={breakdownData}\n footer={() => ({\n 'column-0': <Text weight=\"semibold\">{t('breakdown.totals')}</Text>,\n 'column-1': (\n <Text weight=\"semibold\">\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.companyDebit || '0'))}\n </Text>\n ),\n })}\n />\n </Flex>\n )\n\n const renderTaxBreakdown = () => (\n <Flex flexDirection=\"column\" gap={16}>\n <DataTable\n label={t('sections.taxLabel')}\n columns={[\n {\n title: t('sections.taxLabel'),\n render: (tax: TaxBreakdownItem) => <Text>{tax.name}</Text>,\n },\n {\n title: t('tax.amount'),\n render: (tax: TaxBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(tax.amount || '0'))}</Text>\n ),\n },\n ]}\n data={receiptData.taxes || []}\n footer={() => ({\n 'column-0': <Text weight=\"semibold\">{t('breakdown.totals')}</Text>,\n 'column-1': (\n <Text weight=\"semibold\">\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.taxDebit || '0'))}\n </Text>\n ),\n })}\n />\n </Flex>\n )\n\n const renderEmployeeBreakdown = () => {\n const footerValues = [\n <Flex flexDirection=\"column\" gap={4} key=\"totals\">\n <Text weight=\"semibold\">{t('breakdown.totals')}</Text>\n <Text size=\"sm\" variant=\"supporting\">\n {t('employee.totalEmployees', {\n count: receiptData.employeeCompensations?.length || 0,\n })}\n </Text>\n </Flex>,\n <Text key=\"spacer\">{'\\u00A0'}</Text>,\n <Text weight=\"semibold\" key=\"childSupport\">\n {formatNumberAsCurrency(getTotalChildSupport())}\n </Text>,\n ...(withReimbursements\n ? [\n <Text weight=\"semibold\" key=\"reimbursements\">\n {formatNumberAsCurrency(getTotalReimbursements())}\n </Text>,\n ]\n : []),\n <Text weight=\"semibold\" key=\"taxes\">\n {formatNumberAsCurrency(getTotalTaxes())}\n </Text>,\n <Text weight=\"semibold\" key=\"netPay\">\n {formatNumberAsCurrency(getTotalNetPay())}\n </Text>,\n ]\n\n const footerContent = footerValues.reduce<Record<string, React.ReactNode>>(\n (acc, value, index) => {\n acc[`column-${index}`] = value\n return acc\n },\n {},\n )\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n {isMobile && <Heading as=\"h2\">{t('sections.employeesLabel')}</Heading>}\n <DataView\n label={t('sections.employeesLabel')}\n columns={[\n {\n title: t('employee.name'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{getEmployeeFullName(employee)}</Text>\n ),\n },\n {\n title: t('employee.paymentMethod'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{employee.paymentMethod || 'N/A'}</Text>\n ),\n },\n {\n title: t('employee.childSupport'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>\n {formatNumberAsCurrency(parseFloat(employee.childSupportGarnishment || '0'))}\n </Text>\n ),\n },\n ...(withReimbursements\n ? [\n {\n title: t('employee.reimbursement'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>\n {formatNumberAsCurrency(parseFloat(employee.totalReimbursement || '0'))}\n </Text>\n ),\n },\n ]\n : []),\n {\n title: t('employee.totalTaxes'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(employee.totalTax || '0'))}</Text>\n ),\n },\n {\n title: t('employee.netPay'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(employee.netPay || '0'))}</Text>\n ),\n },\n ]}\n data={receiptData.employeeCompensations || []}\n footer={() => footerContent}\n />\n </Flex>\n )\n }\n\n return (\n <div className={styles.container} ref={containerRef}>\n <Flex flexDirection=\"column\" gap={24}>\n {renderReceiptHeader()}\n {renderBreakdownSection()}\n {renderTaxBreakdown()}\n {renderEmployeeBreakdown()}\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollReceiptsPresentation","receiptData","withReimbursements","Heading","Text","useComponentContext","useI18n","t","useTranslation","containerRef","useRef","isMobile","useContainerBreakpoints","getEmployeeFullName","emp","getTotalChildSupport","sum","getTotalReimbursements","getTotalNetPay","getTotalTaxes","breakdownData","receiptDetailsConfig","renderReceiptHeader","jsx","classNames","styles","jsxs","Flex","ReceiptCheck","formatNumberAsCurrency","DataView","item","renderBreakdownSection","DataTable","renderTaxBreakdown","tax","renderEmployeeBreakdown","footerContent","acc","value","index","employee"],"mappings":";;;;;;;;;;;;;;AAqBO,MAAMA,IAA8B,CAAC;AAAA,EAC1C,aAAAC;AAAA,EACA,oBAAAC,IAAqB;AACvB,MAAwC;AACtC,QAAM,EAAE,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA;AAC1B,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EA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AAAA,cAC1B,QAAQ,CAACkC,MACP,gBAAAlB,EAACnB,GAAA,EAAM,UAAAyB,EAAuB,WAAWY,EAAS,UAAU,GAAG,CAAC,EAAA,CAAE;AAAA,YAAA;AAAA,UAEtE;AAAA,UAEF,MAAMxC,EAAY,yBAAyB,CAAA;AAAA,UAC3C,QAAQ,MAAMoC;AAAA,QAAA;AAAA,MAAA;AAAA,IAChB,GACF;AAAA,EAEJ;AAEA,SACE,gBAAAd,EAAC,OAAA,EAAI,WAAWE,EAAO,WAAW,KAAKhB,GACrC,UAAA,gBAAAiB,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAA;AAAA,IAAAL,EAAA;AAAA,IACAU,EAAA;AAAA,IACAE,EAAA;AAAA,IACAE,EAAA;AAAA,EAAwB,EAAA,CAC3B,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PayrollReceiptsPresentation.js","sources":["../../../../src/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport type {\n PayrollReceipt,\n Taxes as TaxBreakdownItem,\n PayrollReceiptEmployeeCompensations as EmployeeBreakdownItem,\n} from '@gusto/embedded-api/models/components/payrollreceipt'\nimport styles from './PayrollReceiptsPresentation.module.scss'\nimport { DataView, DataTable, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { useContainerBreakpoints } from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\nimport ReceiptCheck from '@/assets/icons/receipt-check.svg?react'\n\ninterface PayrollReceiptsPresentationProps {\n receiptData: PayrollReceipt\n withReimbursements?: boolean\n}\n\nexport const PayrollReceiptsPresentation = ({\n receiptData,\n withReimbursements = true,\n}: PayrollReceiptsPresentationProps) => {\n const { Heading, Text } = useComponentContext()\n useI18n('Payroll.PayrollReceipts')\n const { t } = useTranslation('Payroll.PayrollReceipts')\n\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isMobile = !breakpoints.includes('small')\n\n // Helper to get employee full name\n const getEmployeeFullName = (emp: EmployeeBreakdownItem) =>\n `${emp.employeeFirstName || ''} ${emp.employeeLastName || ''}`.trim()\n\n const getTotalChildSupport = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.childSupportGarnishment || '0'),\n 0,\n )\n\n const getTotalReimbursements = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.totalReimbursement || '0'),\n 0,\n )\n\n const getTotalNetPay = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.netPay || '0'),\n 0,\n )\n\n const getTotalTaxes = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.totalTax || '0'),\n 0,\n )\n\n const breakdownData = [\n {\n label: t('breakdown.directDeposits'),\n amount: parseFloat(receiptData.totals?.netPayDebit || '0'),\n },\n ...(withReimbursements\n ? [\n {\n label: t('breakdown.reimbursements'),\n amount: parseFloat(receiptData.totals?.reimbursementDebit || '0'),\n },\n ]\n : []),\n {\n label: t('breakdown.garnishments'),\n amount: parseFloat(receiptData.totals?.childSupportDebit || '0'),\n },\n { label: t('breakdown.taxes'), amount: parseFloat(receiptData.totals?.taxDebit || '0') },\n ]\n\n const receiptDetailsConfig = [\n {\n label: t('receipt.receiptId'),\n value: receiptData.payrollUuid || '',\n },\n {\n label: t('receipt.from'),\n value: receiptData.nameOfSender || '',\n },\n {\n label: t('receipt.to'),\n value: receiptData.nameOfRecipient || 'Payroll Recipients',\n },\n {\n label: t('receipt.debitDate'),\n value: receiptData.debitDate || '',\n },\n ]\n\n const renderReceiptHeader = () => (\n <div className={classNames(styles.receiptHeader, isMobile && styles.receiptHeaderMobile)}>\n <Flex flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={16}>\n <div className={styles.receiptIcon}>\n <ReceiptCheck className={styles.checkmarkIcon} />\n </div>\n\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={8}>\n <Text size=\"sm\" variant=\"supporting\">\n {t('receipt.totalLabel')}\n </Text>\n <Heading as=\"h1\" styledAs=\"h2\" className={styles.totalAmount}>\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.companyDebit || '0'))}\n </Heading>\n </Flex>\n </Flex>\n\n <div className={styles.receiptDetailsTable}>\n <DataView\n label={t('receipt.detailsLabel')}\n variant=\"minimal\"\n breakAt=\"small\"\n breakpoints={{\n base: '0rem',\n small: '22rem',\n }}\n columns={[\n {\n title: '',\n render: (item: { label: string; value: string }) => (\n <Text size=\"sm\" variant=\"supporting\">\n {item.label}\n </Text>\n ),\n },\n {\n title: '',\n render: (item: { label: string; value: string }) => (\n <Text size=\"sm\">{item.value}</Text>\n ),\n },\n ]}\n data={receiptDetailsConfig}\n />\n </div>\n\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={12}>\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.disclaimer, isMobile && styles.textMobile)}\n >\n {receiptData.recipientNotice}\n </Text>\n\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.companyInfo, isMobile && styles.textMobile)}\n >\n {receiptData.license}\n </Text>\n\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.address, isMobile && styles.textMobile)}\n >\n {receiptData.licensee &&\n `${receiptData.licensee.address || ''}, ${receiptData.licensee.city || ''}, ${receiptData.licensee.state || ''} ${receiptData.licensee.postalCode || ''}`}\n </Text>\n </Flex>\n </Flex>\n </div>\n )\n\n const renderBreakdownSection = () => (\n <Flex flexDirection=\"column\" gap={16}>\n <DataTable\n label={t('sections.debitedLabel')}\n columns={[\n {\n title: t('sections.debitedLabel'),\n render: (item: { label: string; amount: number }) => <Text>{item.label}</Text>,\n },\n {\n title: t('breakdown.amount'),\n render: (item: { label: string; amount: number }) => (\n <Text>{formatNumberAsCurrency(item.amount)}</Text>\n ),\n },\n ]}\n data={breakdownData}\n footer={() => ({\n 'column-0': <Text weight=\"semibold\">{t('breakdown.totals')}</Text>,\n 'column-1': (\n <Text weight=\"semibold\">\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.companyDebit || '0'))}\n </Text>\n ),\n })}\n />\n </Flex>\n )\n\n const renderTaxBreakdown = () => (\n <Flex flexDirection=\"column\" gap={16}>\n <DataTable\n label={t('sections.taxLabel')}\n columns={[\n {\n title: t('sections.taxLabel'),\n render: (tax: TaxBreakdownItem) => <Text>{tax.name}</Text>,\n },\n {\n title: t('tax.amount'),\n render: (tax: TaxBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(tax.amount || '0'))}</Text>\n ),\n },\n ]}\n data={receiptData.taxes || []}\n footer={() => ({\n 'column-0': <Text weight=\"semibold\">{t('breakdown.totals')}</Text>,\n 'column-1': (\n <Text weight=\"semibold\">\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.taxDebit || '0'))}\n </Text>\n ),\n })}\n />\n </Flex>\n )\n\n const renderEmployeeBreakdown = () => {\n const footerValues = [\n <Flex flexDirection=\"column\" gap={4} key=\"totals\">\n <Text weight=\"semibold\">{t('breakdown.totals')}</Text>\n <Text size=\"sm\" variant=\"supporting\">\n {t('employee.totalEmployees', {\n count: receiptData.employeeCompensations?.length || 0,\n })}\n </Text>\n </Flex>,\n <Text key=\"spacer\">{'\\u00A0'}</Text>,\n <Text weight=\"semibold\" key=\"childSupport\">\n {formatNumberAsCurrency(getTotalChildSupport())}\n </Text>,\n ...(withReimbursements\n ? [\n <Text weight=\"semibold\" key=\"reimbursements\">\n {formatNumberAsCurrency(getTotalReimbursements())}\n </Text>,\n ]\n : []),\n <Text weight=\"semibold\" key=\"taxes\">\n {formatNumberAsCurrency(getTotalTaxes())}\n </Text>,\n <Text weight=\"semibold\" key=\"netPay\">\n {formatNumberAsCurrency(getTotalNetPay())}\n </Text>,\n ]\n\n const footerContent = footerValues.reduce<Record<string, React.ReactNode>>(\n (acc, value, index) => {\n acc[`column-${index}`] = value\n return acc\n },\n {},\n )\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n {isMobile && <Heading as=\"h2\">{t('sections.employeesLabel')}</Heading>}\n <DataView\n label={t('sections.employeesLabel')}\n columns={[\n {\n title: t('employee.name'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{getEmployeeFullName(employee)}</Text>\n ),\n },\n {\n title: t('employee.paymentMethod'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{employee.paymentMethod || 'N/A'}</Text>\n ),\n },\n {\n title: t('employee.childSupport'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>\n {formatNumberAsCurrency(parseFloat(employee.childSupportGarnishment || '0'))}\n </Text>\n ),\n },\n ...(withReimbursements\n ? [\n {\n title: t('employee.reimbursement'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>\n {formatNumberAsCurrency(parseFloat(employee.totalReimbursement || '0'))}\n </Text>\n ),\n },\n ]\n : []),\n {\n title: t('employee.totalTaxes'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(employee.totalTax || '0'))}</Text>\n ),\n },\n {\n title: t('employee.netPay'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(employee.netPay || '0'))}</Text>\n ),\n },\n ]}\n data={receiptData.employeeCompensations || []}\n footer={() => footerContent}\n />\n </Flex>\n )\n }\n\n return (\n <div className={styles.container} ref={containerRef}>\n <Flex flexDirection=\"column\" gap={24}>\n {renderReceiptHeader()}\n {renderBreakdownSection()}\n {renderTaxBreakdown()}\n {renderEmployeeBreakdown()}\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollReceiptsPresentation","receiptData","withReimbursements","Heading","Text","useComponentContext","useI18n","t","useTranslation","containerRef","useRef","isMobile","useContainerBreakpoints","getEmployeeFullName","emp","getTotalChildSupport","sum","getTotalReimbursements","getTotalNetPay","getTotalTaxes","breakdownData","receiptDetailsConfig","renderReceiptHeader","jsx","classNames","styles","jsxs","Flex","ReceiptCheck","formatNumberAsCurrency","DataView","item","renderBreakdownSection","DataTable","renderTaxBreakdown","tax","renderEmployeeBreakdown","footerContent","acc","value","index","employee"],"mappings":";;;;;;;;;;;;;AAqBO,MAAMA,IAA8B,CAAC;AAAA,EAC1C,aAAAC;AAAA,EACA,oBAAAC,IAAqB;AACvB,MAAwC;AACtC,QAAM,EAAE,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA;AAC1B,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB,GAEhDC,IAAeC,EAAuB,IAAI,GAE1CC,IAAW,CADGC,EAAwB,EAAE,KAAKH,GAAc,EACnC,SAAS,OAAO,GAGxCI,IAAsB,CAACC,MAC3B,GAAGA,EAAI,qBAAqB,EAAE,IAAIA,EAAI,oBAAoB,EAAE,GAAG,KAAA,GAE3DC,IAAuB,OAC1Bd,EAAY,yBAAyB,CAAA,GAAI;AAAA,IACxC,CAACe,GAAKF,MAAQE,IAAM,WAAWF,EAAI,2BAA2B,GAAG;AAAA,IACjE;AAAA,EAAA,GAGEG,IAAyB,OAC5BhB,EAAY,yBAAyB,CAAA,GAAI;AAAA,IACxC,CAACe,GAAKF,MAAQE,IAAM,WAAWF,EAAI,sBAAsB,GAAG;AAAA,IAC5D;AAAA,EAAA,GAGEI,IAAiB,OACpBjB,EAAY,yBAAyB,CAAA,GAAI;AAAA,IACxC,CAACe,GAAKF,MAAQE,IAAM,WAAWF,EAAI,UAAU,GAAG;AAAA,IAChD;AAAA,EAAA,GAGEK,IAAgB,OACnBlB,EAAY,yBAAyB,CAAA,GAAI;AAAA,IACxC,CAACe,GAAKF,MAAQE,IAAM,WAAWF,EAAI,YAAY,GAAG;AAAA,IAClD;AAA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AAA,YAGJ,GAAIvC,IACA;AAAA,cACE;AAAA,gBACE,OAAOK,EAAE,wBAAwB;AAAA,gBACjC,QAAQ,CAACkC,MACP,gBAAAlB,EAACnB,GAAA,EACE,UAAAyB,EAAuB,WAAWY,EAAS,sBAAsB,GAAG,CAAC,EAAA,CACxE;AAAA,cAAA;AAAA,YAEJ,IAEF,CAAA;AAAA,YACJ;AAAA,cACE,OAAOlC,EAAE,qBAAqB;AAAA,cAC9B,QAAQ,CAACkC,MACP,gBAAAlB,EAACnB,GAAA,EAAM,UAAAyB,EAAuB,WAAWY,EAAS,YAAY,GAAG,CAAC,EAAA,CAAE;AAAA,YAAA;AAAA,YAGxE;AAAA,cACE,OAAOlC,EAAE,iBAAiB;AAAA,cAC1B,QAAQ,CAACkC,MACP,gBAAAlB,EAACnB,GAAA,EAAM,UAAAyB,EAAuB,WAAWY,EAAS,UAAU,GAAG,CAAC,EAAA,CAAE;AAAA,YAAA;AAAA,UAEtE;AAAA,UAEF,MAAMxC,EAAY,yBAAyB,CAAA;AAAA,UAC3C,QAAQ,MAAMoC;AAAA,QAAA;AAAA,MAAA;AAAA,IAChB,GACF;AAAA,EAEJ;AAEA,SACE,gBAAAd,EAAC,OAAA,EAAI,WAAWE,EAAO,WAAW,KAAKhB,GACrC,UAAA,gBAAAiB,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAA;AAAA,IAAAL,EAAA;AAAA,IACAU,EAAA;AAAA,IACAE,EAAA;AAAA,IACAE,EAAA;AAAA,EAAwB,EAAA,CAC3B,EAAA,CACF;AAEJ;"}
|
|
@@ -11,8 +11,8 @@ import { DataView as b } from "../../../Common/DataView/DataView.js";
|
|
|
11
11
|
import { useDataView as E } from "../../../Common/DataView/useDataView.js";
|
|
12
12
|
import { FlexItem as x, Flex as d } from "../../../Common/Flex/Flex.js";
|
|
13
13
|
import "classnames";
|
|
14
|
-
import { recoveryCasesEvents as D } from "../../../../shared/constants.js";
|
|
15
14
|
import "react";
|
|
15
|
+
import { recoveryCasesEvents as D } from "../../../../shared/constants.js";
|
|
16
16
|
import { formatNumberAsCurrency as y } from "../../../../helpers/formattedStrings.js";
|
|
17
17
|
function z(t) {
|
|
18
18
|
return /* @__PURE__ */ e(R, { ...t, children: /* @__PURE__ */ e(w, { ...t, children: t.children }) });
|
package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js
CHANGED
|
@@ -8,19 +8,19 @@ import { BaseComponent as D } from "../../../Base/Base.js";
|
|
|
8
8
|
import { useBase as B } from "../../../Base/useBase.js";
|
|
9
9
|
import { Flex as d } from "../../../Common/Flex/Flex.js";
|
|
10
10
|
import "classnames";
|
|
11
|
-
import {
|
|
12
|
-
import { useComponentContext as y } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
|
+
import { useComponentContext as C } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
12
|
import "react";
|
|
14
13
|
import { Form as F } from "../../../Common/Form/Form.js";
|
|
15
14
|
import { useFlow as A } from "../../../Flow/useFlow.js";
|
|
16
15
|
import { useComponentDictionary as I, useI18n as O } from "../../../../i18n/I18n.js";
|
|
16
|
+
import { recoveryCasesEvents as y } from "../../../../shared/constants.js";
|
|
17
17
|
const R = "gusto-sdk-recovery-cases-resubmit-form";
|
|
18
18
|
function T(e) {
|
|
19
19
|
return /* @__PURE__ */ t(D, { ...e, children: /* @__PURE__ */ t(U, { ...e, children: e.children }) });
|
|
20
20
|
}
|
|
21
21
|
function U({ dictionary: e, recoveryCaseId: o }) {
|
|
22
22
|
I("Payroll.RecoveryCasesResubmit", e);
|
|
23
|
-
const { Heading: r, Text: s } =
|
|
23
|
+
const { Heading: r, Text: s } = C(), { onEvent: n, baseSubmitHandler: a } = B(), { companyId: p } = A(), { data: f } = S({
|
|
24
24
|
companyUuid: p
|
|
25
25
|
}), v = f?.recoveryCaseList?.find((i) => i.uuid === o), { title: c, subtitle: m, description: u } = x(
|
|
26
26
|
v?.latestErrorCode ?? void 0
|
|
@@ -30,7 +30,7 @@ function U({ dictionary: e, recoveryCaseId: o }) {
|
|
|
30
30
|
request: {
|
|
31
31
|
recoveryCaseUuid: o
|
|
32
32
|
}
|
|
33
|
-
}), n(
|
|
33
|
+
}), n(y.RECOVERY_CASE_RESUBMIT_DONE, {
|
|
34
34
|
recoveryCaseId: o
|
|
35
35
|
});
|
|
36
36
|
});
|
|
@@ -44,12 +44,12 @@ function U({ dictionary: e, recoveryCaseId: o }) {
|
|
|
44
44
|
}
|
|
45
45
|
const P = ({ onEvent: e }) => {
|
|
46
46
|
O("Payroll.RecoveryCasesResubmit");
|
|
47
|
-
const { t: o } = h("Payroll.RecoveryCasesResubmit"), { Button: r } =
|
|
47
|
+
const { t: o } = h("Payroll.RecoveryCasesResubmit"), { Button: r } = C(), n = g({
|
|
48
48
|
mutationKey: M()
|
|
49
49
|
}) > 0;
|
|
50
50
|
return /* @__PURE__ */ l(d, { justifyContent: "flex-end", gap: 12, children: [
|
|
51
51
|
/* @__PURE__ */ t(r, { variant: "secondary", onClick: () => {
|
|
52
|
-
e(
|
|
52
|
+
e(y.RECOVERY_CASE_RESUBMIT_CANCEL);
|
|
53
53
|
}, isDisabled: n, children: o("cta.cancel") }),
|
|
54
54
|
/* @__PURE__ */ t(
|
|
55
55
|
r,
|
|
@@ -3,7 +3,6 @@ import { useTranslation as a, Trans as c } from "react-i18next";
|
|
|
3
3
|
import p from "./RecoveryCaseErrorCode.module.scss.js";
|
|
4
4
|
import { Flex as C } from "../../Common/Flex/Flex.js";
|
|
5
5
|
import "classnames";
|
|
6
|
-
import "../../../shared/constants.js";
|
|
7
6
|
import { useComponentContext as R } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
8
7
|
import "react";
|
|
9
8
|
import { useI18n as f } from "../../../i18n/I18n.js";
|
|
@@ -21,7 +20,7 @@ function h(s) {
|
|
|
21
20
|
return "bankError";
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
|
-
function
|
|
23
|
+
function E(s) {
|
|
25
24
|
f("Payroll.RecoveryCasesResubmit");
|
|
26
25
|
const { t: r } = a("Payroll.RecoveryCasesResubmit"), { Text: o } = R();
|
|
27
26
|
if (!s)
|
|
@@ -62,6 +61,6 @@ function T(s) {
|
|
|
62
61
|
};
|
|
63
62
|
}
|
|
64
63
|
export {
|
|
65
|
-
|
|
64
|
+
E as useRecoveryCaseErrorCode
|
|
66
65
|
};
|
|
67
66
|
//# sourceMappingURL=useRecoveryCaseErrorCode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRecoveryCaseErrorCode.js","sources":["../../../../src/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { Trans, useTranslation } from 'react-i18next'\nimport styles from './RecoveryCaseErrorCode.module.scss'\nimport { Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\nexport interface RecoveryCaseErrorCodeContent {\n title: string | null\n subtitle: string | null\n description: ReactNode[]\n}\n\ntype ErrorCodeKey = 'R01' | 'R02' | 'R16' | 'R29' | 'bankError'\n\nfunction getErrorCodeKey(errorCode: string | null | undefined): ErrorCodeKey {\n switch (errorCode) {\n case 'R01':\n return 'R01'\n case 'R02':\n return 'R02'\n case 'R16':\n return 'R16'\n case 'R29':\n return 'R29'\n default:\n return 'bankError'\n }\n}\n\nexport function useRecoveryCaseErrorCode(\n errorCode: string | null | undefined,\n): RecoveryCaseErrorCodeContent {\n useI18n('Payroll.RecoveryCasesResubmit')\n const { t } = useTranslation('Payroll.RecoveryCasesResubmit')\n const { Text } = useComponentContext()\n\n if (!errorCode) {\n return {\n title: null,\n subtitle: null,\n description: [],\n }\n }\n\n const errorCodeKey = getErrorCodeKey(errorCode)\n\n const transComponents = {\n medium: <Text as=\"span\" weight=\"medium\" />,\n }\n\n const description: ReactNode[] = [\n <Text key=\"body\">\n <Trans t={t} i18nKey={`errorCodes.${errorCodeKey}.body`} components={transComponents} />\n </Text>,\n ]\n\n if (errorCodeKey === 'R29') {\n const achCodes = Object.values(t('errorCodes.R29.achCodes', { returnObjects: true }))\n description.push(\n <Flex key=\"instruction\" flexDirection=\"column\" gap={16}>\n <Text>{t('errorCodes.R29.listDescription')}</Text>\n <ul className={styles.compactList}>\n {achCodes.map((code, index) => (\n <li key={index}>{code}</li>\n ))}\n </ul>\n <Text>\n <Trans t={t} i18nKey=\"errorCodes.R29.instruction\" components={transComponents} />\n </Text>\n </Flex>,\n )\n } else {\n const instruction = t(`errorCodes.${errorCodeKey}.instruction`)\n if (instruction) {\n description.push(\n <Text key=\"instruction\">\n <Trans\n t={t}\n i18nKey={`errorCodes.${errorCodeKey}.instruction`}\n components={transComponents}\n />\n </Text>,\n )\n }\n }\n\n return {\n title: t(`errorCodes.${errorCodeKey}.title`),\n subtitle: t(`errorCodes.${errorCodeKey}.subtitle`),\n description,\n }\n}\n"],"names":["getErrorCodeKey","errorCode","useRecoveryCaseErrorCode","useI18n","t","useTranslation","Text","useComponentContext","errorCodeKey","transComponents","jsx","description","Trans","achCodes","jsxs","Flex","styles","code","index"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRecoveryCaseErrorCode.js","sources":["../../../../src/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { Trans, useTranslation } from 'react-i18next'\nimport styles from './RecoveryCaseErrorCode.module.scss'\nimport { Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\nexport interface RecoveryCaseErrorCodeContent {\n title: string | null\n subtitle: string | null\n description: ReactNode[]\n}\n\ntype ErrorCodeKey = 'R01' | 'R02' | 'R16' | 'R29' | 'bankError'\n\nfunction getErrorCodeKey(errorCode: string | null | undefined): ErrorCodeKey {\n switch (errorCode) {\n case 'R01':\n return 'R01'\n case 'R02':\n return 'R02'\n case 'R16':\n return 'R16'\n case 'R29':\n return 'R29'\n default:\n return 'bankError'\n }\n}\n\nexport function useRecoveryCaseErrorCode(\n errorCode: string | null | undefined,\n): RecoveryCaseErrorCodeContent {\n useI18n('Payroll.RecoveryCasesResubmit')\n const { t } = useTranslation('Payroll.RecoveryCasesResubmit')\n const { Text } = useComponentContext()\n\n if (!errorCode) {\n return {\n title: null,\n subtitle: null,\n description: [],\n }\n }\n\n const errorCodeKey = getErrorCodeKey(errorCode)\n\n const transComponents = {\n medium: <Text as=\"span\" weight=\"medium\" />,\n }\n\n const description: ReactNode[] = [\n <Text key=\"body\">\n <Trans t={t} i18nKey={`errorCodes.${errorCodeKey}.body`} components={transComponents} />\n </Text>,\n ]\n\n if (errorCodeKey === 'R29') {\n const achCodes = Object.values(t('errorCodes.R29.achCodes', { returnObjects: true }))\n description.push(\n <Flex key=\"instruction\" flexDirection=\"column\" gap={16}>\n <Text>{t('errorCodes.R29.listDescription')}</Text>\n <ul className={styles.compactList}>\n {achCodes.map((code, index) => (\n <li key={index}>{code}</li>\n ))}\n </ul>\n <Text>\n <Trans t={t} i18nKey=\"errorCodes.R29.instruction\" components={transComponents} />\n </Text>\n </Flex>,\n )\n } else {\n const instruction = t(`errorCodes.${errorCodeKey}.instruction`)\n if (instruction) {\n description.push(\n <Text key=\"instruction\">\n <Trans\n t={t}\n i18nKey={`errorCodes.${errorCodeKey}.instruction`}\n components={transComponents}\n />\n </Text>,\n )\n }\n }\n\n return {\n title: t(`errorCodes.${errorCodeKey}.title`),\n subtitle: t(`errorCodes.${errorCodeKey}.subtitle`),\n description,\n }\n}\n"],"names":["getErrorCodeKey","errorCode","useRecoveryCaseErrorCode","useI18n","t","useTranslation","Text","useComponentContext","errorCodeKey","transComponents","jsx","description","Trans","achCodes","jsxs","Flex","styles","code","index"],"mappings":";;;;;;;;AAeA,SAASA,EAAgBC,GAAoD;AAC3E,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAA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UV;AAAA,IAAA;AAAA,EAEJ;AAEE,IADoBL,EAAE,cAAcI,CAAY,cAAc,KAE5DG,EAAY;AAAA,wBACTL,GAAA,EACC,UAAA,gBAAAI;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,GAAAR;AAAA,UACA,SAAS,cAAcI,CAAY;AAAA,UACnC,YAAYC;AAAA,QAAA;AAAA,MAAA,KAJN,aAMV;AAAA,IAAA;AAKN,SAAO;AAAA,IACL,OAAOL,EAAE,cAAcI,CAAY,QAAQ;AAAA,IAC3C,UAAUJ,EAAE,cAAcI,CAAY,WAAW;AAAA,IACjD,aAAAG;AAAA,EAAA;AAEJ;"}
|
|
@@ -11,17 +11,15 @@ import { useBase as M } from "../Base/useBase.js";
|
|
|
11
11
|
import "../../shared/constants.js";
|
|
12
12
|
import "classnames";
|
|
13
13
|
import "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import "dompurify";
|
|
16
|
-
|
|
17
|
-
const J = ({
|
|
15
|
+
const z = ({
|
|
18
16
|
companyId: r,
|
|
19
17
|
payrollId: s,
|
|
20
18
|
employeeUuids: a,
|
|
21
19
|
sortBy: l,
|
|
22
20
|
onDataReady: n
|
|
23
21
|
}) => {
|
|
24
|
-
const { mutateAsync: p, isPending: u } = q(), [t, d] = g(), e = b(!1), { baseSubmitHandler: c } = M(), P = L(() => a?.join(",") ?? "", [a]), { data:
|
|
22
|
+
const { mutateAsync: p, isPending: u } = q(), [t, d] = g(), e = b(!1), { baseSubmitHandler: c } = M(), P = L(() => a?.join(",") ?? "", [a]), { data: y, isLoading: m } = w(
|
|
25
23
|
{
|
|
26
24
|
companyId: r,
|
|
27
25
|
payScheduleId: t?.payPeriod?.payScheduleUuid || ""
|
|
@@ -55,17 +53,17 @@ const J = ({
|
|
|
55
53
|
j(() => {
|
|
56
54
|
o();
|
|
57
55
|
}, [o]);
|
|
58
|
-
const h = u && !e.current, f = u && e.current, S = h ||
|
|
56
|
+
const h = u && !e.current, f = u && e.current, S = h || m;
|
|
59
57
|
return {
|
|
60
58
|
handlePreparePayroll: o,
|
|
61
59
|
preparedPayroll: t,
|
|
62
|
-
paySchedule:
|
|
60
|
+
paySchedule: y?.payScheduleObject,
|
|
63
61
|
isLoading: S,
|
|
64
62
|
isPaginating: f,
|
|
65
63
|
hasInitialData: e.current
|
|
66
64
|
};
|
|
67
65
|
};
|
|
68
66
|
export {
|
|
69
|
-
|
|
67
|
+
z as usePreparedPayrollData
|
|
70
68
|
};
|
|
71
69
|
//# sourceMappingURL=usePreparedPayrollData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayrollPrepareSortBy } from '@gusto/embedded-api/models/components/payrollpreparesortby'\nimport { useBase } from '../Base'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n employeeUuids?: string[]\n sortBy?: PayrollPrepareSortBy\n onDataReady?: (preparedPayroll: PayrollPrepared) => void\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleObject | undefined\n isLoading: boolean\n isPaginating: boolean\n hasInitialData: boolean\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n employeeUuids,\n sortBy,\n onDataReady,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const hasInitialDataRef = useRef(false)\n const { baseSubmitHandler } = useBase()\n\n const employeeUuidsKey = useMemo(() => employeeUuids?.join(',') ?? '', [employeeUuids])\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid,\n },\n )\n\n const handlePreparePayroll = useCallback(async () => {\n await baseSubmitHandler(null, async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n sortBy,\n requestBody: {\n employeeUuids,\n },\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n if (result.payrollPrepared) {\n hasInitialDataRef.current = true\n onDataReady?.(result.payrollPrepared)\n }\n })\n }, [\n companyId,\n payrollId,\n preparePayroll,\n employeeUuidsKey,\n baseSubmitHandler,\n sortBy,\n onDataReady,\n ])\n\n useEffect(() => {\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isInitialLoading = isPreparePayrollPending && !hasInitialDataRef.current\n const isPaginating = isPreparePayrollPending && hasInitialDataRef.current\n const isLoading = isInitialLoading || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleObject,\n isLoading,\n isPaginating,\n hasInitialData: hasInitialDataRef.current,\n }\n}\n"],"names":["usePreparedPayrollData","companyId","payrollId","employeeUuids","sortBy","onDataReady","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","hasInitialDataRef","useRef","baseSubmitHandler","useBase","employeeUuidsKey","useMemo","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","handlePreparePayroll","useCallback","result","useEffect","isInitialLoading","isPaginating","isLoading"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayrollPrepareSortBy } from '@gusto/embedded-api/models/components/payrollpreparesortby'\nimport { useBase } from '../Base'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n employeeUuids?: string[]\n sortBy?: PayrollPrepareSortBy\n onDataReady?: (preparedPayroll: PayrollPrepared) => void\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleObject | undefined\n isLoading: boolean\n isPaginating: boolean\n hasInitialData: boolean\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n employeeUuids,\n sortBy,\n onDataReady,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const hasInitialDataRef = useRef(false)\n const { baseSubmitHandler } = useBase()\n\n const employeeUuidsKey = useMemo(() => employeeUuids?.join(',') ?? '', [employeeUuids])\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid,\n },\n )\n\n const handlePreparePayroll = useCallback(async () => {\n await baseSubmitHandler(null, async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n sortBy,\n requestBody: {\n employeeUuids,\n },\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n if (result.payrollPrepared) {\n hasInitialDataRef.current = true\n onDataReady?.(result.payrollPrepared)\n }\n })\n }, [\n companyId,\n payrollId,\n preparePayroll,\n employeeUuidsKey,\n baseSubmitHandler,\n sortBy,\n onDataReady,\n ])\n\n useEffect(() => {\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isInitialLoading = isPreparePayrollPending && !hasInitialDataRef.current\n const isPaginating = isPreparePayrollPending && hasInitialDataRef.current\n const isLoading = isInitialLoading || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleObject,\n isLoading,\n isPaginating,\n hasInitialData: hasInitialDataRef.current,\n }\n}\n"],"names":["usePreparedPayrollData","companyId","payrollId","employeeUuids","sortBy","onDataReady","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","hasInitialDataRef","useRef","baseSubmitHandler","useBase","employeeUuidsKey","useMemo","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","handlePreparePayroll","useCallback","result","useEffect","isInitialLoading","isPaginating","isLoading"],"mappings":";;;;;;;;;;;;;;AAyBO,MAAMA,IAAyB,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AACF,MAAkE;AAChE,QAAM,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAC9CC,EAAA,GACI,CAACC,GAAiBC,CAAkB,IAAIC,EAAA,GACxCC,IAAoBC,EAAO,EAAK,GAChC,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GAExBC,IAAmBC,EAAQ,MAAMd,GAAe,KAAK,GAAG,KAAK,IAAI,CAACA,CAAa,CAAC,GAEhF,EAAE,MAAMe,GAAiB,WAAWC,MAAyBC;AAAA,IACjE;AAAA,MACE,WAAAnB;AAAA,MACA,eAAeQ,GAAiB,WAAW,mBAAmB;AAAA,IAAA;AAAA,IAEhE;AAAA,MACE,SAAS,CAAC,CAACA,GAAiB,WAAW;AAAA,IAAA;AAAA,EACzC,GAGIY,IAAuBC,EAAY,YAAY;AACnD,UAAMR,EAAkB,MAAM,YAAY;AACxC,YAAMS,IAAS,MAAMjB,EAAe;AAAA,QAClC,SAAS;AAAA,UACP,WAAAL;AAAA,UACA,WAAAC;AAAA,UACA,QAAAE;AAAA,UACA,aAAa;AAAA,YACX,eAAAD;AAAA,UAAA;AAAA,QACF;AAAA,MACF,CACD;AACD,MAAAO,EAAmBa,EAAO,eAAe,GACrCA,EAAO,oBACTX,EAAkB,UAAU,IAC5BP,IAAckB,EAAO,eAAe;AAAA,IAExC,CAAC;AAAA,EACH,GAAG;AAAA,IACDtB;AAAA,IACAC;AAAA,IACAI;AAAA,IACAU;AAAA,IACAF;AAAA,IACAV;AAAA,IACAC;AAAA,EAAA,CACD;AAED,EAAAmB,EAAU,MAAM;AACd,IAAKH,EAAA;AAAA,EACP,GAAG,CAACA,CAAoB,CAAC;AAEzB,QAAMI,IAAmBlB,KAA2B,CAACK,EAAkB,SACjEc,IAAenB,KAA2BK,EAAkB,SAC5De,IAAYF,KAAoBN;AAEtC,SAAO;AAAA,IACL,sBAAAE;AAAA,IACA,iBAAAZ;AAAA,IACA,aAAaS,GAAiB;AAAA,IAC9B,WAAAS;AAAA,IACA,cAAAD;AAAA,IACA,gBAAgBd,EAAkB;AAAA,EAAA;AAEtC;"}
|
|
@@ -6,14 +6,12 @@ import { ComponentsProvider as y } from "../ComponentAdapter/ComponentsProvider.
|
|
|
6
6
|
import { ApiProvider as C } from "../ApiProvider/ApiProvider.js";
|
|
7
7
|
import { LoadingIndicatorProvider as I } from "../LoadingIndicatorProvider/LoadingIndicatorProvider.js";
|
|
8
8
|
import { SDKI18next as t } from "./SDKI18next.js";
|
|
9
|
-
import "../../shared/constants.js";
|
|
10
9
|
import "classnames";
|
|
11
10
|
import { InternalError as x } from "../../components/Common/InternalError/InternalError.js";
|
|
12
11
|
import "../ComponentAdapter/useComponentContext.js";
|
|
13
12
|
import { LocaleProvider as L } from "../LocaleProvider/LocaleProvider.js";
|
|
14
|
-
import "../LocaleProvider/useLocale.js";
|
|
15
13
|
import { ThemeProvider as U } from "../ThemeProvider/ThemeProvider.js";
|
|
16
|
-
const
|
|
14
|
+
const R = (a) => {
|
|
17
15
|
const {
|
|
18
16
|
children: d,
|
|
19
17
|
config: e,
|
|
@@ -52,6 +50,6 @@ const z = (a) => {
|
|
|
52
50
|
) }, n) }) }) }) }) });
|
|
53
51
|
};
|
|
54
52
|
export {
|
|
55
|
-
|
|
53
|
+
R as GustoProviderCustomUIAdapter
|
|
56
54
|
};
|
|
57
55
|
//# sourceMappingURL=GustoProviderCustomUIAdapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport type { LoadingIndicatorContextProps } from '../LoadingIndicatorProvider/useLoadingIndicator'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GustoSDKTheme } from '@/contexts/ThemeProvider/theme'\nimport type { ResourceDictionary, SupportedLanguages } from '@/types/Helpers'\nimport type { SDKHooks } from '@/types/hooks'\n\nexport interface APIConfig {\n baseUrl: string\n headers?: HeadersInit\n hooks?: SDKHooks\n}\n\nexport interface GustoProviderProps {\n config: APIConfig\n dictionary?: ResourceDictionary\n lng?: string\n locale?: string\n currency?: string\n theme?: GustoSDKTheme\n queryClient?: QueryClient\n components: ComponentsContextType\n LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator']\n}\n\nexport interface GustoProviderCustomUIAdapterProps extends GustoProviderProps {\n children?: React.ReactNode\n}\n\n/**\n * A provider that accepts UI component adapters through the components prop\n */\nconst GustoProviderCustomUIAdapter: React.FC<GustoProviderCustomUIAdapterProps> = props => {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n components,\n LoaderComponent,\n queryClient,\n } = props\n\n // Handle dictionary resources\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n // Adding resources overrides to i18next instance - initial load will override common namespace and add component specific dictionaries provided by partners\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n // Handle language change\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n return (\n <ComponentsProvider value={components}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ErrorBoundary FallbackComponent={InternalError}>\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider\n url={config.baseUrl}\n headers={config.headers}\n hooks={config.hooks}\n queryClient={queryClient}\n >\n {children}\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n )\n}\n\nexport { GustoProviderCustomUIAdapter }\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","components","LoaderComponent","queryClient","language","lang","ns","SDKI18next","useEffect","jsx","ComponentsProvider","LoadingIndicatorProvider","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport type { LoadingIndicatorContextProps } from '../LoadingIndicatorProvider/useLoadingIndicator'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GustoSDKTheme } from '@/contexts/ThemeProvider/theme'\nimport type { ResourceDictionary, SupportedLanguages } from '@/types/Helpers'\nimport type { SDKHooks } from '@/types/hooks'\n\nexport interface APIConfig {\n baseUrl: string\n headers?: HeadersInit\n hooks?: SDKHooks\n}\n\nexport interface GustoProviderProps {\n config: APIConfig\n dictionary?: ResourceDictionary\n lng?: string\n locale?: string\n currency?: string\n theme?: GustoSDKTheme\n queryClient?: QueryClient\n components: ComponentsContextType\n LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator']\n}\n\nexport interface GustoProviderCustomUIAdapterProps extends GustoProviderProps {\n children?: React.ReactNode\n}\n\n/**\n * A provider that accepts UI component adapters through the components prop\n */\nconst GustoProviderCustomUIAdapter: React.FC<GustoProviderCustomUIAdapterProps> = props => {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n components,\n LoaderComponent,\n queryClient,\n } = props\n\n // Handle dictionary resources\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n // Adding resources overrides to i18next instance - initial load will override common namespace and add component specific dictionaries provided by partners\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n // Handle language change\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n return (\n <ComponentsProvider value={components}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ErrorBoundary FallbackComponent={InternalError}>\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider\n url={config.baseUrl}\n headers={config.headers}\n hooks={config.hooks}\n queryClient={queryClient}\n >\n {children}\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n )\n}\n\nexport { GustoProviderCustomUIAdapter }\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","components","LoaderComponent","queryClient","language","lang","ns","SDKI18next","useEffect","jsx","ComponentsProvider","LoadingIndicatorProvider","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider"],"mappings":";;;;;;;;;;;;;AA2CA,MAAMA,IAA4E,CAAAC,MAAS;AACzF,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,aAAAC;AAAA,EAAA,IACEV;AAGJ,MAAIG;AACF,eAAWQ,KAAYR,GAAY;AACjC,YAAMS,IAAOD;AACb,iBAAWE,KAAMV,EAAWS,CAAI;AAE9B,QAAAE,EAAW;AAAA,UACTF;AAAA,UACAC;AAAA,UACCV,EAAWS,CAAI,EAA8BC,CAAE;AAAA,UAChD;AAAA,UACA;AAAA,QAAA;AAAA,IAGN;AAIF,SAAAE,EAAU,MAAM;AACd,KAAM,YACJ,MAAMD,EAAW,eAAeV,CAAG;AAAA,EAEvC,GAAG,CAACA,CAAG,CAAC,GAGN,gBAAAY,EAACC,KAAmB,OAAOT,GACzB,4BAACU,GAAA,EAAyB,OAAOT,GAC/B,UAAA,gBAAAO,EAACG,GAAA,EAAc,mBAAmBC,GAChC,UAAA,gBAAAJ,EAACK,GAAA,EAAc,OAAAd,GACb,UAAA,gBAAAS,EAACM,GAAA,EAAe,QAAAjB,GAAgB,UAAAC,GAC9B,UAAA,gBAAAU,EAACO,GAAA,EAAgB,MAAMT,GACrB,UAAA,gBAAAE;AAAA,IAACQ;AAAA,IAAA;AAAA,MACC,KAAKtB,EAAO;AAAA,MACZ,SAASA,EAAO;AAAA,MAChB,OAAOA,EAAO;AAAA,MACd,aAAAQ;AAAA,MAEC,UAAAT;AAAA,IAAA;AAAA,EAAA,KAPmCG,CASxC,EAAA,CACF,EAAA,CACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import i from "dompurify";
|
|
2
2
|
import "react-i18next";
|
|
3
3
|
import "react";
|
|
4
|
-
|
|
5
|
-
const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), S = ({
|
|
4
|
+
const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), h = ({
|
|
6
5
|
first_name: t,
|
|
7
6
|
last_name: e
|
|
8
7
|
}) => `${t ? c(t) : ""}${e ? n(c(e)) : ""}`, n = (t) => t ? ` ${t}` : "", m = (t) => {
|
|
9
8
|
const e = n(t.street1), r = n(t.street2);
|
|
10
9
|
return `${e},${r}`;
|
|
11
|
-
}, u = (t) => `${n(t.city)}, ${n(t.state)} ${n(t.zip)}`,
|
|
10
|
+
}, u = (t) => `${n(t.city)}, ${n(t.state)} ${n(t.zip)}`, S = (t) => `${m(t)} ${u(t)}`, p = (t, e) => e ? `${t}%` : `$${t}`, a = (t, e = "en-US") => {
|
|
12
11
|
const r = t.toLocaleString(e, {
|
|
13
12
|
minimumFractionDigits: 2,
|
|
14
13
|
maximumFractionDigits: 2
|
|
15
14
|
});
|
|
16
15
|
return p(r, !1);
|
|
17
|
-
},
|
|
16
|
+
}, C = ({
|
|
18
17
|
rate: t,
|
|
19
18
|
paymentUnit: e,
|
|
20
19
|
t: r,
|
|
@@ -42,25 +41,25 @@ const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), S = ({
|
|
|
42
41
|
return o;
|
|
43
42
|
}
|
|
44
43
|
}, l = { ALLOWED_TAGS: ["a", "b", "strong"], ALLOWED_ATTR: ["href", "target"] };
|
|
45
|
-
function
|
|
44
|
+
function D(t) {
|
|
46
45
|
return t ? { __html: i.sanitize(t, l) } : { __html: "" };
|
|
47
46
|
}
|
|
48
|
-
const $ = (t) => t.replace(/\D/g, ""),
|
|
47
|
+
const $ = (t) => t.replace(/\D/g, ""), F = (t) => t.replace(/_([a-z])/g, (e, r) => r.toUpperCase()), L = (t) => {
|
|
49
48
|
if (!t) return "";
|
|
50
49
|
const e = $(String(t));
|
|
51
50
|
return e.length === 10 ? `${e.slice(0, 3)}-${e.slice(3, 6)}-${e.slice(6)}` : e.length === 11 && e.startsWith("1") ? `${e.slice(1, 4)}-${e.slice(4, 7)}-${e.slice(7)}` : e || "";
|
|
52
51
|
};
|
|
53
52
|
export {
|
|
54
|
-
|
|
53
|
+
S as addressInline,
|
|
55
54
|
p as amountStr,
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
D as createMarkup,
|
|
56
|
+
h as firstLastName,
|
|
58
57
|
a as formatNumberAsCurrency,
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
C as formatPayRate,
|
|
59
|
+
L as formatPhoneNumber,
|
|
61
60
|
u as getCityStateZip,
|
|
62
61
|
m as getStreet,
|
|
63
62
|
$ as removeNonDigits,
|
|
64
|
-
|
|
63
|
+
F as snakeCaseToCamelCase
|
|
65
64
|
};
|
|
66
65
|
//# sourceMappingURL=formattedStrings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formattedStrings.js","sources":["../../src/helpers/formattedStrings.ts"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { type TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\nimport { useCallback } from 'react'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\nconst capitalize = (word: string) => word.charAt(0).toLocaleUpperCase() + word.slice(1)\n\nexport const firstLastName = ({\n first_name,\n last_name,\n}: {\n first_name?: string | null\n last_name?: string | null\n}) =>\n `${first_name ? capitalize(first_name) : ''}${last_name ? maybeString(capitalize(last_name)) : ''}`\n\nconst maybeString = (str: string | null | undefined) => {\n return str ? ` ${str}` : ''\n}\n\nexport const getStreet = (address: EmployeeAddress | Location) => {\n const street1 = maybeString(address.street1)\n const street2 = maybeString(address.street2)\n\n return `${street1},${street2}`\n}\n\nexport const getCityStateZip = (address: EmployeeAddress | Location) =>\n `${maybeString(address.city)}, ${maybeString(address.state)} ${maybeString(address.zip)}`\n\nexport const addressInline = (address: EmployeeAddress | Location) =>\n `${getStreet(address)} ${getCityStateZip(address)}`\n\nexport const currentDateString = () => {\n const d = new Date()\n const dateString = `${String(d.getFullYear())}-${('0' + String(d.getMonth() + 1)).slice(-2)}-${('0' + String(d.getDate())).slice(-2)}`\n return dateString\n}\n\nexport function isNumberKey({ which, keyCode }: KeyboardEvent) {\n const charCode = which ? which : keyCode\n if (charCode > 31 && charCode != 46 && (charCode < 48 || charCode > 57)) return false\n return true\n}\n\nexport const booleanToString = (value: boolean) => (value ? 'true' : 'false')\n\nexport const amountStr = (amount: string, isPercentage: boolean) =>\n isPercentage ? `${amount}%` : `$${amount}`\n\nexport const formatNumberAsCurrency = (amount: number, locale: string = 'en-US') => {\n const formattedNumber = amount.toLocaleString(locale, {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n })\n return amountStr(formattedNumber, false)\n}\n\nexport const formatPayRate = ({\n rate,\n paymentUnit,\n t,\n locale = 'en-US',\n}: {\n rate: number\n paymentUnit: string\n t: TFunction\n locale?: string\n}) => {\n const amount = formatNumberAsCurrency(rate, locale)\n\n switch (paymentUnit) {\n case 'Hour':\n return t('payRateFormats.hourly', { amount, ns: 'common' })\n case 'Week':\n return t('payRateFormats.weekly', {\n amount: formatNumberAsCurrency(rate * 52, locale),\n ns: 'common',\n })\n case 'Month':\n return t('payRateFormats.monthly', {\n amount: formatNumberAsCurrency(rate * 12, locale),\n ns: 'common',\n })\n case 'Year':\n return t('payRateFormats.yearly', { amount, ns: 'common' })\n case 'Paycheck':\n return t('payRateFormats.paycheck', { amount, ns: 'common' })\n default:\n return amount\n }\n}\n\nexport const useFormatPayRate = () => {\n const { t } = useTranslation('common')\n const { locale } = useLocale()\n\n return useCallback(\n (rate: number, paymentUnit: string) => {\n return formatPayRate({ rate, paymentUnit, t, locale })\n },\n [t, locale],\n )\n}\n\nconst dompurifyConfig = { ALLOWED_TAGS: ['a', 'b', 'strong'], ALLOWED_ATTR: ['href', 'target'] }\nexport function createMarkup(dirty: string) {\n if (!dirty) return { __html: '' }\n return { __html: DOMPurify.sanitize(dirty, dompurifyConfig) }\n}\n\nexport const removeNonDigits = (value: string): string => {\n return value.replace(/\\D/g, '')\n}\n\nexport const snakeCaseToCamelCase = (s: string) => {\n return s.replace(/_([a-z])/g, (_: string, char: string) => char.toUpperCase())\n}\n\nexport const camelCaseToSnakeCase = (s: string) => {\n return s\n .replace(\n /([a-z0-9])([A-Z])/g,\n (_: string, group1: string, group2: string) => `${group1}_${group2.toLowerCase()}`,\n )\n .replace(\n /([A-Z])([A-Z])(?=[a-z])/g,\n (_: string, group1: string, group2: string) =>\n `${group1.toLowerCase()}_${group2.toLowerCase()}`,\n )\n .toLowerCase()\n}\n\nexport const formatPhoneNumber = (phoneNumber: string | number | null | undefined): string => {\n if (!phoneNumber) return ''\n\n const digits = removeNonDigits(String(phoneNumber))\n\n if (digits.length === 10) {\n return `${digits.slice(0, 3)}-${digits.slice(3, 6)}-${digits.slice(6)}`\n }\n\n if (digits.length === 11 && digits.startsWith('1')) {\n return `${digits.slice(1, 4)}-${digits.slice(4, 7)}-${digits.slice(7)}`\n }\n\n return digits || ''\n}\n"],"names":["capitalize","word","firstLastName","first_name","last_name","maybeString","str","getStreet","address","street1","street2","getCityStateZip","addressInline","amountStr","amount","isPercentage","formatNumberAsCurrency","locale","formattedNumber","formatPayRate","rate","paymentUnit","t","dompurifyConfig","createMarkup","dirty","DOMPurify","removeNonDigits","value","snakeCaseToCamelCase","s","_","char","formatPhoneNumber","phoneNumber","digits"],"mappings":"
|
|
1
|
+
{"version":3,"file":"formattedStrings.js","sources":["../../src/helpers/formattedStrings.ts"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { type TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\nimport { useCallback } from 'react'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\nconst capitalize = (word: string) => word.charAt(0).toLocaleUpperCase() + word.slice(1)\n\nexport const firstLastName = ({\n first_name,\n last_name,\n}: {\n first_name?: string | null\n last_name?: string | null\n}) =>\n `${first_name ? capitalize(first_name) : ''}${last_name ? maybeString(capitalize(last_name)) : ''}`\n\nconst maybeString = (str: string | null | undefined) => {\n return str ? ` ${str}` : ''\n}\n\nexport const getStreet = (address: EmployeeAddress | Location) => {\n const street1 = maybeString(address.street1)\n const street2 = maybeString(address.street2)\n\n return `${street1},${street2}`\n}\n\nexport const getCityStateZip = (address: EmployeeAddress | Location) =>\n `${maybeString(address.city)}, ${maybeString(address.state)} ${maybeString(address.zip)}`\n\nexport const addressInline = (address: EmployeeAddress | Location) =>\n `${getStreet(address)} ${getCityStateZip(address)}`\n\nexport const currentDateString = () => {\n const d = new Date()\n const dateString = `${String(d.getFullYear())}-${('0' + String(d.getMonth() + 1)).slice(-2)}-${('0' + String(d.getDate())).slice(-2)}`\n return dateString\n}\n\nexport function isNumberKey({ which, keyCode }: KeyboardEvent) {\n const charCode = which ? which : keyCode\n if (charCode > 31 && charCode != 46 && (charCode < 48 || charCode > 57)) return false\n return true\n}\n\nexport const booleanToString = (value: boolean) => (value ? 'true' : 'false')\n\nexport const amountStr = (amount: string, isPercentage: boolean) =>\n isPercentage ? `${amount}%` : `$${amount}`\n\nexport const formatNumberAsCurrency = (amount: number, locale: string = 'en-US') => {\n const formattedNumber = amount.toLocaleString(locale, {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n })\n return amountStr(formattedNumber, false)\n}\n\nexport const formatPayRate = ({\n rate,\n paymentUnit,\n t,\n locale = 'en-US',\n}: {\n rate: number\n paymentUnit: string\n t: TFunction\n locale?: string\n}) => {\n const amount = formatNumberAsCurrency(rate, locale)\n\n switch (paymentUnit) {\n case 'Hour':\n return t('payRateFormats.hourly', { amount, ns: 'common' })\n case 'Week':\n return t('payRateFormats.weekly', {\n amount: formatNumberAsCurrency(rate * 52, locale),\n ns: 'common',\n })\n case 'Month':\n return t('payRateFormats.monthly', {\n amount: formatNumberAsCurrency(rate * 12, locale),\n ns: 'common',\n })\n case 'Year':\n return t('payRateFormats.yearly', { amount, ns: 'common' })\n case 'Paycheck':\n return t('payRateFormats.paycheck', { amount, ns: 'common' })\n default:\n return amount\n }\n}\n\nexport const useFormatPayRate = () => {\n const { t } = useTranslation('common')\n const { locale } = useLocale()\n\n return useCallback(\n (rate: number, paymentUnit: string) => {\n return formatPayRate({ rate, paymentUnit, t, locale })\n },\n [t, locale],\n )\n}\n\nconst dompurifyConfig = { ALLOWED_TAGS: ['a', 'b', 'strong'], ALLOWED_ATTR: ['href', 'target'] }\nexport function createMarkup(dirty: string) {\n if (!dirty) return { __html: '' }\n return { __html: DOMPurify.sanitize(dirty, dompurifyConfig) }\n}\n\nexport const removeNonDigits = (value: string): string => {\n return value.replace(/\\D/g, '')\n}\n\nexport const snakeCaseToCamelCase = (s: string) => {\n return s.replace(/_([a-z])/g, (_: string, char: string) => char.toUpperCase())\n}\n\nexport const camelCaseToSnakeCase = (s: string) => {\n return s\n .replace(\n /([a-z0-9])([A-Z])/g,\n (_: string, group1: string, group2: string) => `${group1}_${group2.toLowerCase()}`,\n )\n .replace(\n /([A-Z])([A-Z])(?=[a-z])/g,\n (_: string, group1: string, group2: string) =>\n `${group1.toLowerCase()}_${group2.toLowerCase()}`,\n )\n .toLowerCase()\n}\n\nexport const formatPhoneNumber = (phoneNumber: string | number | null | undefined): string => {\n if (!phoneNumber) return ''\n\n const digits = removeNonDigits(String(phoneNumber))\n\n if (digits.length === 10) {\n return `${digits.slice(0, 3)}-${digits.slice(3, 6)}-${digits.slice(6)}`\n }\n\n if (digits.length === 11 && digits.startsWith('1')) {\n return `${digits.slice(1, 4)}-${digits.slice(4, 7)}-${digits.slice(7)}`\n }\n\n return digits || ''\n}\n"],"names":["capitalize","word","firstLastName","first_name","last_name","maybeString","str","getStreet","address","street1","street2","getCityStateZip","addressInline","amountStr","amount","isPercentage","formatNumberAsCurrency","locale","formattedNumber","formatPayRate","rate","paymentUnit","t","dompurifyConfig","createMarkup","dirty","DOMPurify","removeNonDigits","value","snakeCaseToCamelCase","s","_","char","formatPhoneNumber","phoneNumber","digits"],"mappings":";;;AAQA,MAAMA,IAAa,CAACC,MAAiBA,EAAK,OAAO,CAAC,EAAE,sBAAsBA,EAAK,MAAM,CAAC,GAEzEC,IAAgB,CAAC;AAAA,EAC5B,YAAAC;AAAA,EACA,WAAAC;AACF,MAIE,GAAGD,IAAaH,EAAWG,CAAU,IAAI,EAAE,GAAGC,IAAYC,EAAYL,EAAWI,CAAS,CAAC,IAAI,EAAE,IAE7FC,IAAc,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,UAAU;AAAA,IAC5D,KAAK;AACH,aAAOQ,EAAE,2BAA2B,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC9D;AACE,aAAOA;AAAA,EAAA;AAEb,GAcMS,IAAkB,EAAE,cAAc,CAAC,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,QAAQ,QAAQ,EAAA;AACtF,SAASC,EAAaC,GAAe;AAC1C,SAAKA,IACE,EAAE,QAAQC,EAAU,SAASD,GAAOF,CAAe,EAAA,IADvC,EAAE,QAAQ,GAAA;AAE/B;AAEO,MAAMI,IAAkB,CAACC,MACvBA,EAAM,QAAQ,OAAO,EAAE,GAGnBC,IAAuB,CAACC,MAC5BA,EAAE,QAAQ,aAAa,CAACC,GAAWC,MAAiBA,EAAK,aAAa,GAiBlEC,IAAoB,CAACC,MAA4D;AAC5F,MAAI,CAACA,EAAa,QAAO;AAEzB,QAAMC,IAASR,EAAgB,OAAOO,CAAW,CAAC;AAElD,SAAIC,EAAO,WAAW,KACb,GAAGA,EAAO,MAAM,GAAG,CAAC,CAAC,IAAIA,EAAO,MAAM,GAAG,CAAC,CAAC,IAAIA,EAAO,MAAM,CAAC,CAAC,KAGnEA,EAAO,WAAW,MAAMA,EAAO,WAAW,GAAG,IACxC,GAAGA,EAAO,MAAM,GAAG,CAAC,CAAC,IAAIA,EAAO,MAAM,GAAG,CAAC,CAAC,IAAIA,EAAO,MAAM,CAAC,CAAC,KAGhEA,KAAU;AACnB;"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function decimalToPercent(value: string | number | boolean | null | undefined): number | undefined;
|
|
2
|
+
export declare function percentToDecimal(value: number | string): string;
|
|
3
|
+
export declare function formatPercentLabel(decimalValue: string, locale?: string): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function o(t) {
|
|
2
|
+
return parseFloat(t.toPrecision(12));
|
|
3
|
+
}
|
|
4
|
+
function e(t) {
|
|
5
|
+
if (t == null || t === "" || typeof t == "boolean")
|
|
6
|
+
return;
|
|
7
|
+
const n = typeof t == "number" ? t : parseFloat(t);
|
|
8
|
+
if (!isNaN(n))
|
|
9
|
+
return o(n * 100);
|
|
10
|
+
}
|
|
11
|
+
function m(t) {
|
|
12
|
+
const n = typeof t == "number" ? t : parseFloat(t);
|
|
13
|
+
return isNaN(n) ? String(t) : String(o(n / 100));
|
|
14
|
+
}
|
|
15
|
+
function c(t, n = "en-US") {
|
|
16
|
+
const r = e(t);
|
|
17
|
+
return r === void 0 ? t : `${new Intl.NumberFormat(n, {
|
|
18
|
+
minimumFractionDigits: 1,
|
|
19
|
+
maximumFractionDigits: 4
|
|
20
|
+
}).format(r)}%`;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
e as decimalToPercent,
|
|
24
|
+
c as formatPercentLabel,
|
|
25
|
+
m as percentToDecimal
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=percentageConversion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"percentageConversion.js","sources":["../../src/helpers/percentageConversion.ts"],"sourcesContent":["const PRECISION_DIGITS = 12\n\nfunction toCleanNumber(value: number): number {\n return parseFloat(value.toPrecision(PRECISION_DIGITS))\n}\n\nexport function decimalToPercent(\n value: string | number | boolean | null | undefined,\n): number | undefined {\n if (value === null || value === undefined || value === '' || typeof value === 'boolean') {\n return undefined\n }\n\n const numValue = typeof value === 'number' ? value : parseFloat(value)\n\n if (isNaN(numValue)) {\n return undefined\n }\n\n return toCleanNumber(numValue * 100)\n}\n\nexport function percentToDecimal(value: number | string): string {\n const numValue = typeof value === 'number' ? value : parseFloat(value)\n\n if (isNaN(numValue)) {\n return String(value)\n }\n\n return String(toCleanNumber(numValue / 100))\n}\n\nexport function formatPercentLabel(decimalValue: string, locale = 'en-US'): string {\n const percent = decimalToPercent(decimalValue)\n if (percent === undefined) return decimalValue\n\n const formatted = new Intl.NumberFormat(locale, {\n minimumFractionDigits: 1,\n maximumFractionDigits: 4,\n }).format(percent)\n\n return `${formatted}%`\n}\n"],"names":["toCleanNumber","value","decimalToPercent","numValue","percentToDecimal","formatPercentLabel","decimalValue","locale","percent"],"mappings":"AAEA,SAASA,EAAcC,GAAuB;AAC5C,SAAO,WAAWA,EAAM,YAAY,EAAgB,CAAC;AACvD;AAEO,SAASC,EACdD,GACoB;AACpB,MAAIA,KAAU,QAA+BA,MAAU,MAAM,OAAOA,KAAU;AAC5E;AAGF,QAAME,IAAW,OAAOF,KAAU,WAAWA,IAAQ,WAAWA,CAAK;AAErE,MAAI,OAAME,CAAQ;AAIlB,WAAOH,EAAcG,IAAW,GAAG;AACrC;AAEO,SAASC,EAAiBH,GAAgC;AAC/D,QAAME,IAAW,OAAOF,KAAU,WAAWA,IAAQ,WAAWA,CAAK;AAErE,SAAI,MAAME,CAAQ,IACT,OAAOF,CAAK,IAGd,OAAOD,EAAcG,IAAW,GAAG,CAAC;AAC7C;AAEO,SAASE,EAAmBC,GAAsBC,IAAS,SAAiB;AACjF,QAAMC,IAAUN,EAAiBI,CAAY;AAC7C,SAAIE,MAAY,SAAkBF,IAO3B,GALW,IAAI,KAAK,aAAaC,GAAQ;AAAA,IAC9C,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,EAAA,CACxB,EAAE,OAAOC,CAAO,CAEE;AACrB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PaginationControlProps, PaginationItemsPerPage } from '../../components/Common/PaginationControl/PaginationControlTypes';
|
|
2
|
+
interface UsePaginationOptions {
|
|
3
|
+
defaultItemsPerPage?: PaginationItemsPerPage;
|
|
4
|
+
}
|
|
5
|
+
type PaginationProps = Required<Pick<PaginationControlProps, 'totalCount' | 'itemsPerPage'>> & Omit<PaginationControlProps, 'totalCount' | 'itemsPerPage'>;
|
|
6
|
+
interface UsePaginationResult {
|
|
7
|
+
/** Current page number — pass to API query as `page` */
|
|
8
|
+
currentPage: number;
|
|
9
|
+
/** Items per page — pass to API query as `per` */
|
|
10
|
+
itemsPerPage: PaginationItemsPerPage;
|
|
11
|
+
/** Build PaginationControlProps from API response headers */
|
|
12
|
+
getPaginationProps: (headers: Headers, isFetching?: boolean) => PaginationProps;
|
|
13
|
+
}
|
|
14
|
+
export declare function usePagination(options?: UsePaginationOptions): UsePaginationResult;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useState as P, useRef as m } from "react";
|
|
2
|
+
function d(g) {
|
|
3
|
+
const { defaultItemsPerPage: u = 5 } = g ?? {}, [r, e] = P(1), [a, c] = P(u), n = m(1);
|
|
4
|
+
return {
|
|
5
|
+
currentPage: r,
|
|
6
|
+
itemsPerPage: a,
|
|
7
|
+
getPaginationProps: (o, i) => {
|
|
8
|
+
const s = Number(o.get("x-total-pages") ?? 1), l = Number(o.get("x-total-count") ?? 0);
|
|
9
|
+
return n.current = s, {
|
|
10
|
+
currentPage: r,
|
|
11
|
+
totalPages: s,
|
|
12
|
+
totalCount: l,
|
|
13
|
+
itemsPerPage: a,
|
|
14
|
+
isFetching: i,
|
|
15
|
+
handleFirstPage: () => {
|
|
16
|
+
e(1);
|
|
17
|
+
},
|
|
18
|
+
handleLastPage: () => {
|
|
19
|
+
e(n.current);
|
|
20
|
+
},
|
|
21
|
+
handleNextPage: () => {
|
|
22
|
+
e((t) => Math.min(t + 1, n.current));
|
|
23
|
+
},
|
|
24
|
+
handlePreviousPage: () => {
|
|
25
|
+
e((t) => Math.max(t - 1, 1));
|
|
26
|
+
},
|
|
27
|
+
handleItemsPerPageChange: (t) => {
|
|
28
|
+
t !== a && (c(t), e(1));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
d as usePagination
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=usePagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePagination.js","sources":["../../../src/hooks/usePagination/usePagination.ts"],"sourcesContent":["import { useState, useRef } from 'react'\nimport type {\n PaginationControlProps,\n PaginationItemsPerPage,\n} from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ninterface UsePaginationOptions {\n defaultItemsPerPage?: PaginationItemsPerPage\n}\n\ntype PaginationProps = Required<Pick<PaginationControlProps, 'totalCount' | 'itemsPerPage'>> &\n Omit<PaginationControlProps, 'totalCount' | 'itemsPerPage'>\n\ninterface UsePaginationResult {\n /** Current page number — pass to API query as `page` */\n currentPage: number\n /** Items per page — pass to API query as `per` */\n itemsPerPage: PaginationItemsPerPage\n /** Build PaginationControlProps from API response headers */\n getPaginationProps: (headers: Headers, isFetching?: boolean) => PaginationProps\n}\n\nexport function usePagination(options?: UsePaginationOptions): UsePaginationResult {\n const { defaultItemsPerPage = 5 } = options ?? {}\n const [currentPage, setCurrentPage] = useState(1)\n const [itemsPerPage, setItemsPerPage] = useState<PaginationItemsPerPage>(defaultItemsPerPage)\n const totalPagesRef = useRef(1)\n\n const getPaginationProps = (headers: Headers, isFetching?: boolean): PaginationProps => {\n const totalPages = Number(headers.get('x-total-pages') ?? 1)\n const totalCount = Number(headers.get('x-total-count') ?? 0)\n\n totalPagesRef.current = totalPages\n\n return {\n currentPage,\n totalPages,\n totalCount,\n itemsPerPage,\n isFetching,\n handleFirstPage: () => {\n setCurrentPage(1)\n },\n handleLastPage: () => {\n setCurrentPage(totalPagesRef.current)\n },\n handleNextPage: () => {\n setCurrentPage(prev => Math.min(prev + 1, totalPagesRef.current))\n },\n handlePreviousPage: () => {\n setCurrentPage(prev => Math.max(prev - 1, 1))\n },\n handleItemsPerPageChange: (value: PaginationItemsPerPage) => {\n if (value !== itemsPerPage) {\n setItemsPerPage(value)\n setCurrentPage(1)\n }\n },\n }\n }\n\n return {\n currentPage,\n itemsPerPage,\n getPaginationProps,\n }\n}\n"],"names":["usePagination","options","defaultItemsPerPage","currentPage","setCurrentPage","useState","itemsPerPage","setItemsPerPage","totalPagesRef","useRef","headers","isFetching","totalPages","totalCount","prev","value"],"mappings":";AAsBO,SAASA,EAAcC,GAAqD;AACjF,QAAM,EAAE,qBAAAC,IAAsB,EAAA,IAAMD,KAAW,CAAA,GACzC,CAACE,GAAaC,CAAc,IAAIC,EAAS,CAAC,GAC1C,CAACC,GAAcC,CAAe,IAAIF,EAAiCH,CAAmB,GACtFM,IAAgBC,EAAO,CAAC;AAmC9B,SAAO;AAAA,IACL,aAAAN;AAAA,IACA,cAAAG;AAAA,IACA,oBApCyB,CAACI,GAAkBC,MAA0C;AACtF,YAAMC,IAAa,OAAOF,EAAQ,IAAI,eAAe,KAAK,CAAC,GACrDG,IAAa,OAAOH,EAAQ,IAAI,eAAe,KAAK,CAAC;AAE3D,aAAAF,EAAc,UAAUI,GAEjB;AAAA,QACL,aAAAT;AAAA,QACA,YAAAS;AAAA,QACA,YAAAC;AAAA,QACA,cAAAP;AAAA,QACA,YAAAK;AAAA,QACA,iBAAiB,MAAM;AACrB,UAAAP,EAAe,CAAC;AAAA,QAClB;AAAA,QACA,gBAAgB,MAAM;AACpB,UAAAA,EAAeI,EAAc,OAAO;AAAA,QACtC;AAAA,QACA,gBAAgB,MAAM;AACpB,UAAAJ,EAAe,OAAQ,KAAK,IAAIU,IAAO,GAAGN,EAAc,OAAO,CAAC;AAAA,QAClE;AAAA,QACA,oBAAoB,MAAM;AACxB,UAAAJ,EAAe,OAAQ,KAAK,IAAIU,IAAO,GAAG,CAAC,CAAC;AAAA,QAC9C;AAAA,QACA,0BAA0B,CAACC,MAAkC;AAC3D,UAAIA,MAAUT,MACZC,EAAgBQ,CAAK,GACrBX,EAAe,CAAC;AAAA,QAEpB;AAAA,MAAA;AAAA,IAEJ;AAAA,EAKE;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|