@gusto/embedded-react-sdk 0.29.0 → 0.30.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 +19 -0
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +3 -2
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +7 -6
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +3 -2
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +3 -2
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +3 -2
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +6 -6
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +3 -2
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +7 -6
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +3 -2
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -6
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +9 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +8 -7
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +3 -2
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +7 -6
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +7 -6
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +4 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +3 -2
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +3 -2
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +3 -2
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +3 -2
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +4 -4
- package/dist/components/Contractor/Address/useAddress.js +6 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +11 -10
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +11 -11
- package/dist/components/Employee/Compensation/Actions.js +1 -1
- package/dist/components/Employee/Compensation/Edit.js +20 -16
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +23 -22
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +3 -2
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +7 -6
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +12 -12
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/Actions.js +6 -5
- package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +5 -4
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -3
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +6 -6
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +6 -5
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +5 -4
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +9 -8
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +4 -3
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/Actions.js +6 -5
- package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -3
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +7 -6
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +7 -6
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +4 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js +11 -10
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +4 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +17 -0
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js +75 -0
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -0
- package/dist/components/Payroll/PayrollExecutionFlow/index.d.ts +3 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +9 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +198 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.test.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js +49 -0
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js.map +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +17 -13
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +3 -6
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +115 -300
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.test.d.ts +1 -0
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +15 -13
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +1 -0
- package/dist/components/Payroll/index.js +14 -12
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +6 -5
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +4 -2
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/formattedStrings.js +12 -11
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/package.json +6 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollOverview.js","sources":["../../../../src/components/Payroll/PayrollOverview/PayrollOverview.tsx"],"sourcesContent":["import { usePayrollsSubmitMutation } from '@gusto/embedded-api/react-query/payrollsSubmit'\nimport { usePayrollsCancelMutation } from '@gusto/embedded-api/react-query/payrollsCancel'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { useTranslation } from 'react-i18next'\nimport { useBankAccountsGetSuspense } from '@gusto/embedded-api/react-query/bankAccountsGet'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\nimport { useWireInRequestsGet } from '@gusto/embedded-api/react-query/wireInRequestsGet'\nimport { useEffect, useState } from 'react'\nimport { useGustoEmbeddedContext } from '@gusto/embedded-api/react-query/_context'\nimport { payrollsGetPayStub } from '@gusto/embedded-api/funcs/payrollsGetPayStub'\nimport { useErrorBoundary } from 'react-error-boundary'\nimport type { PayrollSubmissionBlockerType } from '@gusto/embedded-api/models/components/payrollsubmissionblockertype'\nimport type {\n PayrollCreditBlockerType,\n PayrollCreditBlockerTypeUnblockOptions,\n} from '@gusto/embedded-api/models/components/payrollcreditblockertype'\nimport type { PayrollFlowAlert } from '../PayrollFlow/PayrollFlowComponents'\nimport {\n ConfirmWireDetails,\n type ConfirmWireDetailsComponentType,\n} from '../ConfirmWireDetails/ConfirmWireDetails'\nimport { canCancelPayroll } from '../helpers'\nimport { PayrollOverviewPresentation } from './PayrollOverviewPresentation'\nimport { PayrollOverviewStatus } from './PayrollOverviewTypes'\nimport {\n componentEvents,\n payrollWireEvents,\n PAYROLL_PROCESSING_STATUS,\n PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES,\n type EventType,\n} from '@/shared/constants'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { readableStreamToBlob } from '@/helpers/readableStreamToBlob'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { renderErrorList } from '@/helpers/apiErrorToList'\nimport { Flex } from '@/components/Common'\n\ninterface PayrollOverviewProps extends BaseComponentInterface<'Payroll.PayrollOverview'> {\n companyId: string\n payrollId: string\n alerts?: PayrollFlowAlert[]\n withReimbursements?: boolean\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n}\n\nconst findUnresolvedBlockersWithOptions = (blockers: PayrollSubmissionBlockerType[] = []) => {\n return blockers.filter(\n blocker =>\n blocker.status === 'unresolved' &&\n blocker.unblockOptions &&\n blocker.unblockOptions.length > 0,\n )\n}\n\nconst findWireInRequestUuid = (\n creditBlockers: PayrollCreditBlockerType[] = [],\n): string | undefined => {\n const unresolvedCreditBlocker = creditBlockers.find(blocker => blocker.status === 'unresolved')\n\n if (!unresolvedCreditBlocker?.unblockOptions) {\n return undefined\n }\n\n const wireUnblockOption = unresolvedCreditBlocker.unblockOptions.find(\n (option: PayrollCreditBlockerTypeUnblockOptions) => option.unblockType === 'submit_wire',\n )\n\n return wireUnblockOption?.metadata.wireInRequestUuid\n}\n\nexport function PayrollOverview(props: PayrollOverviewProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nexport const Root = ({\n companyId,\n payrollId,\n dictionary,\n onEvent,\n alerts,\n withReimbursements = true,\n ConfirmWireDetailsComponent = ConfirmWireDetails,\n}: PayrollOverviewProps) => {\n useComponentDictionary('Payroll.PayrollOverview', dictionary)\n useI18n('Payroll.PayrollOverview')\n const { baseSubmitHandler } = useBase()\n const { t } = useTranslation('Payroll.PayrollOverview')\n const [isPolling, setIsPolling] = useState(false)\n const [internalAlerts, setInternalAlerts] = useState<PayrollFlowAlert[]>(alerts || [])\n const [selectedUnblockOptions, setSelectedUnblockOptions] = useState<Record<string, string>>({})\n const [showWireDetailsConfirmation, setShowWireDetailsConfirmation] = useState(false)\n const { showBoundary } = useErrorBoundary()\n const formatCurrency = useNumberFormatter('currency')\n const dateFormatter = useDateFormatter()\n const { Button, UnorderedList, Text } = useComponentContext()\n const [status, setStatus] = useState<PayrollOverviewStatus>(PayrollOverviewStatus.Viewing)\n const { data } = usePayrollsGetSuspense(\n {\n companyId,\n payrollId: payrollId,\n include: ['taxes', 'benefits', 'deductions'],\n },\n { refetchInterval: isPolling ? 5_000 : false },\n )\n const payrollData = data.payrollShow!\n const submissionBlockers = findUnresolvedBlockersWithOptions(payrollData.submissionBlockers)\n const wireInId = findWireInRequestUuid(payrollData.creditBlockers)\n\n const { data: wireInRequestData } = useWireInRequestsGet(\n {\n wireInRequestUuid: wireInId || '',\n },\n { enabled: !!wireInId },\n )\n const wireInRequest = wireInRequestData?.wireInRequest\n\n const onEdit = () => {\n onEvent(componentEvents.RUN_PAYROLL_EDIT)\n }\n\n const handleWireEvent = (type: EventType, data?: unknown) => {\n if (type === payrollWireEvents.PAYROLL_WIRE_FORM_DONE) {\n setShowWireDetailsConfirmation(true)\n }\n onEvent(type, data)\n }\n\n const wireInConfirmationRequest = wireInId && (\n <ConfirmWireDetailsComponent\n companyId={companyId}\n wireInId={wireInId}\n onEvent={handleWireEvent}\n />\n )\n\n useEffect(() => {\n if (wireInRequest?.status === 'pending_review' && !showWireDetailsConfirmation) {\n setShowWireDetailsConfirmation(true)\n }\n }, [wireInRequest?.status, showWireDetailsConfirmation])\n\n useEffect(() => {\n if (showWireDetailsConfirmation) {\n const checkDate = dateFormatter.formatShortWithYear(payrollData.checkDate)\n\n setInternalAlerts([\n {\n type: 'success',\n title: t('alerts.wireDetailsSubmittedTitle'),\n content: <Text>{t('alerts.wireDetailsSubmittedMessage', { checkDate })}</Text>,\n onDismiss: () => {\n setShowWireDetailsConfirmation(false)\n },\n },\n ])\n }\n }, [showWireDetailsConfirmation, payrollData.checkDate, t, dateFormatter, Text])\n\n useEffect(() => {\n // Start polling when payroll is submitting and not already polling\n if (\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submitting &&\n !isPolling\n ) {\n setIsPolling(true)\n }\n // Stop polling and emit event when payroll is processed successfully\n if (\n isPolling &&\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submit_success\n ) {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSED)\n setInternalAlerts([\n {\n type: 'success',\n title: t('alerts.payrollProcessedTitle'),\n content: t('alerts.payrollProcessedMessage', {\n amount: formatCurrency(Number(payrollData.totals?.companyDebit)),\n date: dateFormatter.formatShortWithYear(\n payrollData.payrollStatusMeta?.expectedDebitTime ?? payrollData.payrollDeadline,\n ),\n }),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setIsPolling(false)\n }\n // If we are polling and payroll is in failed state, stop polling, and emit failure event\n if (\n isPolling &&\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.processing_failed\n ) {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSING_FAILED)\n setInternalAlerts([\n {\n type: 'error',\n title: t('alerts.payrollProcessingFailedTitle'),\n content: (\n <Flex flexDirection=\"column\" gap={16}>\n <UnorderedList items={renderErrorList(payrollData.processingRequest.errors ?? [])} />\n <Button variant=\"secondary\" onClick={onEdit}>\n {t('alerts.payrollProcessingFailedCtaLabel')}\n </Button>\n </Flex>\n ),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setIsPolling(false)\n }\n }, [\n payrollData.processingRequest?.status,\n isPolling,\n onEvent,\n t,\n dateFormatter,\n formatCurrency,\n payrollData.totals?.netPayDebit,\n payrollData.payrollStatusMeta?.expectedDebitTime,\n payrollData.payrollDeadline,\n ])\n\n const { data: bankAccountData } = useBankAccountsGetSuspense({\n companyId,\n })\n const bankAccount = bankAccountData.companyBankAccounts?.[0]\n\n const { data: employeeData } = useEmployeesListSuspense({\n companyId,\n })\n\n const { mutateAsync: submitPayroll, isPending } = usePayrollsSubmitMutation()\n\n const { mutateAsync: cancelPayroll } = usePayrollsCancelMutation()\n\n if (status === PayrollOverviewStatus.Viewing && !payrollData.calculatedAt) {\n throw new Error(t('alerts.payrollNotCalculated'))\n }\n const gustoEmbedded = useGustoEmbeddedContext()\n\n const taxes =\n payrollData.employeeCompensations?.reduce(\n (acc, compensation) => {\n compensation.taxes?.forEach(tax => {\n acc[tax.name] = {\n employee: (acc[tax.name]?.employee ?? 0) + (tax.employer ? 0 : tax.amount),\n employer: (acc[tax.name]?.employer ?? 0) + (tax.employer ? tax.amount : 0),\n }\n })\n\n return acc\n },\n {} as Record<string, { employee: number; employer: number }>,\n ) || {}\n\n const onCancel = async () => {\n setStatus(PayrollOverviewStatus.Cancelling)\n await baseSubmitHandler(data, async () => {\n try {\n const result = await cancelPayroll({\n request: {\n companyId,\n payrollId,\n },\n })\n setStatus(PayrollOverviewStatus.Cancelled)\n onEvent(componentEvents.RUN_PAYROLL_CANCELLED, result)\n } catch (error) {\n setStatus(PayrollOverviewStatus.Viewing)\n throw error\n }\n })\n }\n const onPayrollReceipt = () => {\n onEvent(componentEvents.RUN_PAYROLL_RECEIPT_GET, { payrollId })\n }\n\n const onPaystubDownload = async (employeeId: string) => {\n // Open a blank window *synchronously* with the click\n const newWindow = window.open('', '_blank')\n\n try {\n // Fetch the PDF from your API\n const response = await payrollsGetPayStub(gustoEmbedded, { payrollId, employeeId })\n if (!response.value?.responseStream) {\n throw new Error(t('alerts.paystubPdfError'))\n }\n const pdfBlob = await readableStreamToBlob(response.value.responseStream, 'application/pdf')\n\n const url = URL.createObjectURL(pdfBlob)\n\n // Load the PDF into the new window\n if (newWindow) {\n newWindow.location.href = url\n }\n onEvent(componentEvents.RUN_PAYROLL_PDF_PAYSTUB_VIEWED, { employeeId })\n URL.revokeObjectURL(url) // Clean up the URL object after use\n } catch (err) {\n if (newWindow) {\n newWindow.close()\n }\n showBoundary(err instanceof Error ? err : new Error(String(err)))\n }\n }\n const onSubmit = async () => {\n await baseSubmitHandler(data, async () => {\n const result = await submitPayroll({\n request: {\n companyId,\n payrollId,\n requestBody: {\n submissionBlockers: Object.entries(selectedUnblockOptions)\n .filter(([blockerType]) =>\n PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blockerType),\n )\n .map(([blockerType, selectedOption]) => ({\n blockerType,\n selectedOption,\n })),\n },\n },\n })\n onEvent(componentEvents.RUN_PAYROLL_SUBMITTED, result)\n setIsPolling(true)\n })\n }\n\n return (\n <PayrollOverviewPresentation\n onEdit={onEdit}\n onSubmit={onSubmit}\n onCancel={onCancel}\n onPayrollReceipt={onPayrollReceipt}\n onPaystubDownload={onPaystubDownload}\n status={isPending || isPolling ? PayrollOverviewStatus.Submitting : status}\n isProcessed={\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submit_success\n }\n canCancel={canCancelPayroll(payrollData)}\n payrollData={payrollData}\n bankAccount={bankAccount}\n employeeDetails={employeeData.showEmployees || []}\n taxes={taxes}\n alerts={internalAlerts}\n submissionBlockers={submissionBlockers}\n selectedUnblockOptions={selectedUnblockOptions}\n onUnblockOptionChange={(blockerType, value) => {\n setSelectedUnblockOptions(prev => ({ ...prev, [blockerType]: value }))\n }}\n wireInConfirmationRequest={wireInConfirmationRequest}\n withReimbursements={withReimbursements}\n />\n )\n}\n"],"names":["findUnresolvedBlockersWithOptions","blockers","blocker","findWireInRequestUuid","creditBlockers","unresolvedCreditBlocker","option","PayrollOverview","props","jsx","BaseComponent","Root","companyId","payrollId","dictionary","onEvent","alerts","withReimbursements","ConfirmWireDetailsComponent","ConfirmWireDetails","useComponentDictionary","useI18n","baseSubmitHandler","useBase","t","useTranslation","isPolling","setIsPolling","useState","internalAlerts","setInternalAlerts","selectedUnblockOptions","setSelectedUnblockOptions","showWireDetailsConfirmation","setShowWireDetailsConfirmation","showBoundary","useErrorBoundary","formatCurrency","useNumberFormatter","dateFormatter","useDateFormatter","Button","UnorderedList","Text","useComponentContext","status","setStatus","PayrollOverviewStatus","data","usePayrollsGetSuspense","payrollData","submissionBlockers","wireInId","wireInRequestData","useWireInRequestsGet","wireInRequest","onEdit","componentEvents","wireInConfirmationRequest","type","payrollWireEvents","useEffect","checkDate","PAYROLL_PROCESSING_STATUS","jsxs","Flex","renderErrorList","bankAccountData","useBankAccountsGetSuspense","bankAccount","employeeData","useEmployeesListSuspense","submitPayroll","isPending","usePayrollsSubmitMutation","cancelPayroll","usePayrollsCancelMutation","gustoEmbedded","useGustoEmbeddedContext","taxes","acc","compensation","tax","PayrollOverviewPresentation","result","blockerType","PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES","selectedOption","error","employeeId","newWindow","response","payrollsGetPayStub","pdfBlob","readableStreamToBlob","url","err","canCancelPayroll","value","prev"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAMA,KAAoC,CAACC,IAA2C,OAC7EA,EAAS;AAAA,EACd,CAAAC,MACEA,EAAQ,WAAW,gBACnBA,EAAQ,kBACRA,EAAQ,eAAe,SAAS;AAAA,GAIhCC,KAAwB,CAC5BC,IAA6C,OACtB;AACvB,QAAMC,IAA0BD,EAAe,KAAK,CAAAF,MAAWA,EAAQ,WAAW,YAAY;AAE9F,SAAKG,GAAyB,iBAIJA,EAAwB,eAAe;AAAA,IAC/D,CAACC,MAAmDA,EAAO,gBAAgB;AAAA,EAAA,GAGnD,SAAS,oBAPjC;AAQJ;AAEO,SAASC,GAAgBC,GAA6B;AAC3D,SACE,gBAAAC,EAACC,IAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEO,MAAMG,KAAO,CAAC;AAAA,EACnB,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,oBAAAC,IAAqB;AAAA,EACrB,6BAAAC,IAA8BC;AAChC,MAA4B;AAC1B,EAAAC,GAAuB,2BAA2BN,CAAU,GAC5DO,GAAQ,yBAAyB;AACjC,QAAM,EAAE,mBAAAC,EAAA,IAAsBC,GAAA,GACxB,EAAE,GAAAC,EAAA,IAAMC,GAAe,yBAAyB,GAChD,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1C,CAACC,GAAgBC,CAAiB,IAAIF,EAA6BZ,KAAU,CAA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AAMC,IAAW,MAAMC,GAAmBf,GAAe,EAAE,WAAAhE,GAAW,YAAA4E,GAAY;AAClF,cAAI,CAACE,EAAS,OAAO;AACnB,kBAAM,IAAI,MAAMnE,EAAE,wBAAwB,CAAC;AAE7C,gBAAMqE,IAAU,MAAMC,GAAqBH,EAAS,MAAM,gBAAgB,iBAAiB,GAErFI,IAAM,IAAI,gBAAgBF,CAAO;AAGvC,UAAIH,MACFA,EAAU,SAAS,OAAOK,IAE5BhF,EAAQ0C,EAAgB,gCAAgC,EAAE,YAAAgC,EAAA,CAAY,GACtE,IAAI,gBAAgBM,CAAG;AAAA,QACzB,SAASC,GAAK;AACZ,UAAIN,KACFA,EAAU,MAAA,GAEZvD,EAAa6D,aAAe,QAAQA,IAAM,IAAI,MAAM,OAAOA,CAAG,CAAC,CAAC;AAAA,QAClE;AAAA,MACF;AAAA,MA+BI,QAAQvB,KAAa/C,IAAYqB,EAAsB,aAAaF;AAAA,MACpE,aACEK,EAAY,mBAAmB,WAAWa,EAA0B;AAAA,MAEtE,WAAWkC,GAAiB/C,CAAW;AAAA,MACvC,aAAAA;AAAA,MACA,aAAAmB;AAAA,MACA,iBAAiBC,EAAa,iBAAiB,CAAA;AAAA,MAC/C,OAAAS;AAAA,MACA,QAAQlD;AAAA,MACR,oBAAAsB;AAAA,MACA,wBAAApB;AAAA,MACA,uBAAuB,CAACsD,GAAaa,MAAU;AAC7C,QAAAlE,EAA0B,CAAAmE,OAAS,EAAE,GAAGA,GAAM,CAACd,CAAW,GAAGa,IAAQ;AAAA,MACvE;AAAA,MACA,2BAAAxC;AAAA,MACA,oBAAAzC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"PayrollOverview.js","sources":["../../../../src/components/Payroll/PayrollOverview/PayrollOverview.tsx"],"sourcesContent":["import { usePayrollsSubmitMutation } from '@gusto/embedded-api/react-query/payrollsSubmit'\nimport { usePayrollsCancelMutation } from '@gusto/embedded-api/react-query/payrollsCancel'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { useTranslation } from 'react-i18next'\nimport { useBankAccountsGetSuspense } from '@gusto/embedded-api/react-query/bankAccountsGet'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\nimport { useWireInRequestsGet } from '@gusto/embedded-api/react-query/wireInRequestsGet'\nimport { useEffect, useState } from 'react'\nimport { useGustoEmbeddedContext } from '@gusto/embedded-api/react-query/_context'\nimport { payrollsGetPayStub } from '@gusto/embedded-api/funcs/payrollsGetPayStub'\nimport { useErrorBoundary } from 'react-error-boundary'\nimport type { PayrollSubmissionBlockerType } from '@gusto/embedded-api/models/components/payrollsubmissionblockertype'\nimport type {\n PayrollCreditBlockerType,\n PayrollCreditBlockerTypeUnblockOptions,\n} from '@gusto/embedded-api/models/components/payrollcreditblockertype'\nimport type { PayrollFlowAlert } from '../PayrollFlow/PayrollFlowComponents'\nimport {\n ConfirmWireDetails,\n type ConfirmWireDetailsComponentType,\n} from '../ConfirmWireDetails/ConfirmWireDetails'\nimport { canCancelPayroll } from '../helpers'\nimport { PayrollOverviewPresentation } from './PayrollOverviewPresentation'\nimport { PayrollOverviewStatus } from './PayrollOverviewTypes'\nimport {\n componentEvents,\n payrollWireEvents,\n PAYROLL_PROCESSING_STATUS,\n PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES,\n type EventType,\n} from '@/shared/constants'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { readableStreamToBlob } from '@/helpers/readableStreamToBlob'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { renderErrorList } from '@/helpers/apiErrorToList'\nimport { Flex } from '@/components/Common'\n\ninterface PayrollOverviewProps extends BaseComponentInterface<'Payroll.PayrollOverview'> {\n companyId: string\n payrollId: string\n alerts?: PayrollFlowAlert[]\n withReimbursements?: boolean\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n}\n\nconst findUnresolvedBlockersWithOptions = (blockers: PayrollSubmissionBlockerType[] = []) => {\n return blockers.filter(\n blocker =>\n blocker.status === 'unresolved' &&\n blocker.unblockOptions &&\n blocker.unblockOptions.length > 0,\n )\n}\n\nconst findWireInRequestUuid = (\n creditBlockers: PayrollCreditBlockerType[] = [],\n): string | undefined => {\n const unresolvedCreditBlocker = creditBlockers.find(blocker => blocker.status === 'unresolved')\n\n if (!unresolvedCreditBlocker?.unblockOptions) {\n return undefined\n }\n\n const wireUnblockOption = unresolvedCreditBlocker.unblockOptions.find(\n (option: PayrollCreditBlockerTypeUnblockOptions) => option.unblockType === 'submit_wire',\n )\n\n return wireUnblockOption?.metadata.wireInRequestUuid\n}\n\nexport function PayrollOverview(props: PayrollOverviewProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nexport const Root = ({\n companyId,\n payrollId,\n dictionary,\n onEvent,\n alerts,\n withReimbursements = true,\n ConfirmWireDetailsComponent = ConfirmWireDetails,\n}: PayrollOverviewProps) => {\n useComponentDictionary('Payroll.PayrollOverview', dictionary)\n useI18n('Payroll.PayrollOverview')\n const { baseSubmitHandler } = useBase()\n const { t } = useTranslation('Payroll.PayrollOverview')\n const [isPolling, setIsPolling] = useState(false)\n const [internalAlerts, setInternalAlerts] = useState<PayrollFlowAlert[]>(alerts || [])\n const [selectedUnblockOptions, setSelectedUnblockOptions] = useState<Record<string, string>>({})\n const [showWireDetailsConfirmation, setShowWireDetailsConfirmation] = useState(false)\n const { showBoundary } = useErrorBoundary()\n const formatCurrency = useNumberFormatter('currency')\n const dateFormatter = useDateFormatter()\n const { Button, UnorderedList, Text } = useComponentContext()\n const [status, setStatus] = useState<PayrollOverviewStatus>(PayrollOverviewStatus.Viewing)\n const { data } = usePayrollsGetSuspense(\n {\n companyId,\n payrollId: payrollId,\n include: ['taxes', 'benefits', 'deductions'],\n },\n { refetchInterval: isPolling ? 5_000 : false },\n )\n const payrollData = data.payrollShow!\n const submissionBlockers = findUnresolvedBlockersWithOptions(payrollData.submissionBlockers)\n const wireInId = findWireInRequestUuid(payrollData.creditBlockers)\n\n const { data: wireInRequestData } = useWireInRequestsGet(\n {\n wireInRequestUuid: wireInId || '',\n },\n { enabled: !!wireInId },\n )\n const wireInRequest = wireInRequestData?.wireInRequest\n\n const onEdit = () => {\n onEvent(componentEvents.RUN_PAYROLL_EDIT)\n }\n\n const handleWireEvent = (type: EventType, data?: unknown) => {\n if (type === payrollWireEvents.PAYROLL_WIRE_FORM_DONE) {\n setShowWireDetailsConfirmation(true)\n }\n onEvent(type, data)\n }\n\n const wireInConfirmationRequest = wireInId && (\n <ConfirmWireDetailsComponent\n companyId={companyId}\n wireInId={wireInId}\n onEvent={handleWireEvent}\n />\n )\n\n useEffect(() => {\n if (wireInRequest?.status === 'pending_review' && !showWireDetailsConfirmation) {\n setShowWireDetailsConfirmation(true)\n }\n }, [wireInRequest?.status, showWireDetailsConfirmation])\n\n useEffect(() => {\n if (showWireDetailsConfirmation) {\n const checkDate = dateFormatter.formatShortWithYear(payrollData.checkDate)\n\n setInternalAlerts([\n {\n type: 'success',\n title: t('alerts.wireDetailsSubmittedTitle'),\n content: <Text>{t('alerts.wireDetailsSubmittedMessage', { checkDate })}</Text>,\n onDismiss: () => {\n setShowWireDetailsConfirmation(false)\n },\n },\n ])\n }\n }, [showWireDetailsConfirmation, payrollData.checkDate, t, dateFormatter, Text])\n\n useEffect(() => {\n // Start polling when payroll is submitting and not already polling\n if (\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submitting &&\n !isPolling\n ) {\n setIsPolling(true)\n }\n // Stop polling and emit event when payroll is processed successfully\n if (\n isPolling &&\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submit_success\n ) {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSED, {\n payPeriod: payrollData.payPeriod,\n })\n setInternalAlerts([\n {\n type: 'success',\n title: t('alerts.payrollProcessedTitle'),\n content: t('alerts.payrollProcessedMessage', {\n amount: formatCurrency(Number(payrollData.totals?.companyDebit)),\n date: dateFormatter.formatShortWithYear(\n payrollData.payrollStatusMeta?.expectedDebitTime ?? payrollData.payrollDeadline,\n ),\n }),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setIsPolling(false)\n }\n // If we are polling and payroll is in failed state, stop polling, and emit failure event\n if (\n isPolling &&\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.processing_failed\n ) {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSING_FAILED)\n setInternalAlerts([\n {\n type: 'error',\n title: t('alerts.payrollProcessingFailedTitle'),\n content: (\n <Flex flexDirection=\"column\" gap={16}>\n <UnorderedList items={renderErrorList(payrollData.processingRequest.errors ?? [])} />\n <Button variant=\"secondary\" onClick={onEdit}>\n {t('alerts.payrollProcessingFailedCtaLabel')}\n </Button>\n </Flex>\n ),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setIsPolling(false)\n }\n }, [\n payrollData.processingRequest?.status,\n isPolling,\n onEvent,\n t,\n dateFormatter,\n formatCurrency,\n payrollData.totals?.netPayDebit,\n payrollData.payrollStatusMeta?.expectedDebitTime,\n payrollData.payrollDeadline,\n ])\n\n const { data: bankAccountData } = useBankAccountsGetSuspense({\n companyId,\n })\n const bankAccount = bankAccountData.companyBankAccounts?.[0]\n\n const { data: employeeData } = useEmployeesListSuspense({\n companyId,\n })\n\n const { mutateAsync: submitPayroll, isPending } = usePayrollsSubmitMutation()\n\n const { mutateAsync: cancelPayroll } = usePayrollsCancelMutation()\n\n if (status === PayrollOverviewStatus.Viewing && !payrollData.calculatedAt) {\n throw new Error(t('alerts.payrollNotCalculated'))\n }\n const gustoEmbedded = useGustoEmbeddedContext()\n\n const taxes =\n payrollData.employeeCompensations?.reduce(\n (acc, compensation) => {\n compensation.taxes?.forEach(tax => {\n acc[tax.name] = {\n employee: (acc[tax.name]?.employee ?? 0) + (tax.employer ? 0 : tax.amount),\n employer: (acc[tax.name]?.employer ?? 0) + (tax.employer ? tax.amount : 0),\n }\n })\n\n return acc\n },\n {} as Record<string, { employee: number; employer: number }>,\n ) || {}\n\n const onCancel = async () => {\n setStatus(PayrollOverviewStatus.Cancelling)\n await baseSubmitHandler(data, async () => {\n try {\n const result = await cancelPayroll({\n request: {\n companyId,\n payrollId,\n },\n })\n setStatus(PayrollOverviewStatus.Cancelled)\n onEvent(componentEvents.RUN_PAYROLL_CANCELLED, result)\n } catch (error) {\n setStatus(PayrollOverviewStatus.Viewing)\n throw error\n }\n })\n }\n const onPayrollReceipt = () => {\n onEvent(componentEvents.RUN_PAYROLL_RECEIPT_GET, { payrollId })\n }\n\n const onPaystubDownload = async (employeeId: string) => {\n // Open a blank window *synchronously* with the click\n const newWindow = window.open('', '_blank')\n\n try {\n // Fetch the PDF from your API\n const response = await payrollsGetPayStub(gustoEmbedded, { payrollId, employeeId })\n if (!response.value?.responseStream) {\n throw new Error(t('alerts.paystubPdfError'))\n }\n const pdfBlob = await readableStreamToBlob(response.value.responseStream, 'application/pdf')\n\n const url = URL.createObjectURL(pdfBlob)\n\n // Load the PDF into the new window\n if (newWindow) {\n newWindow.location.href = url\n }\n onEvent(componentEvents.RUN_PAYROLL_PDF_PAYSTUB_VIEWED, { employeeId })\n URL.revokeObjectURL(url) // Clean up the URL object after use\n } catch (err) {\n if (newWindow) {\n newWindow.close()\n }\n showBoundary(err instanceof Error ? err : new Error(String(err)))\n }\n }\n const onSubmit = async () => {\n await baseSubmitHandler(data, async () => {\n const result = await submitPayroll({\n request: {\n companyId,\n payrollId,\n requestBody: {\n submissionBlockers: Object.entries(selectedUnblockOptions)\n .filter(([blockerType]) =>\n PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blockerType),\n )\n .map(([blockerType, selectedOption]) => ({\n blockerType,\n selectedOption,\n })),\n },\n },\n })\n onEvent(componentEvents.RUN_PAYROLL_SUBMITTED, result)\n setIsPolling(true)\n })\n }\n\n return (\n <PayrollOverviewPresentation\n onEdit={onEdit}\n onSubmit={onSubmit}\n onCancel={onCancel}\n onPayrollReceipt={onPayrollReceipt}\n onPaystubDownload={onPaystubDownload}\n status={isPending || isPolling ? PayrollOverviewStatus.Submitting : status}\n isProcessed={\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submit_success\n }\n canCancel={canCancelPayroll(payrollData)}\n payrollData={payrollData}\n bankAccount={bankAccount}\n employeeDetails={employeeData.showEmployees || []}\n taxes={taxes}\n alerts={internalAlerts}\n submissionBlockers={submissionBlockers}\n selectedUnblockOptions={selectedUnblockOptions}\n onUnblockOptionChange={(blockerType, value) => {\n setSelectedUnblockOptions(prev => ({ ...prev, [blockerType]: value }))\n }}\n wireInConfirmationRequest={wireInConfirmationRequest}\n withReimbursements={withReimbursements}\n />\n )\n}\n"],"names":["findUnresolvedBlockersWithOptions","blockers","blocker","findWireInRequestUuid","creditBlockers","unresolvedCreditBlocker","option","PayrollOverview","props","jsx","BaseComponent","Root","companyId","payrollId","dictionary","onEvent","alerts","withReimbursements","ConfirmWireDetailsComponent","ConfirmWireDetails","useComponentDictionary","useI18n","baseSubmitHandler","useBase","t","useTranslation","isPolling","setIsPolling","useState","internalAlerts","setInternalAlerts","selectedUnblockOptions","setSelectedUnblockOptions","showWireDetailsConfirmation","setShowWireDetailsConfirmation","showBoundary","useErrorBoundary","formatCurrency","useNumberFormatter","dateFormatter","useDateFormatter","Button","UnorderedList","Text","useComponentContext","status","setStatus","PayrollOverviewStatus","data","usePayrollsGetSuspense","payrollData","submissionBlockers","wireInId","wireInRequestData","useWireInRequestsGet","wireInRequest","onEdit","componentEvents","wireInConfirmationRequest","type","payrollWireEvents","useEffect","checkDate","PAYROLL_PROCESSING_STATUS","jsxs","Flex","renderErrorList","bankAccountData","useBankAccountsGetSuspense","bankAccount","employeeData","useEmployeesListSuspense","submitPayroll","isPending","usePayrollsSubmitMutation","cancelPayroll","usePayrollsCancelMutation","gustoEmbedded","useGustoEmbeddedContext","taxes","acc","compensation","tax","PayrollOverviewPresentation","result","blockerType","PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES","selectedOption","error","employeeId","newWindow","response","payrollsGetPayStub","pdfBlob","readableStreamToBlob","url","err","canCancelPayroll","value","prev"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAMA,KAAoC,CAACC,IAA2C,OAC7EA,EAAS;AAAA,EACd,CAAAC,MACEA,EAAQ,WAAW,gBACnBA,EAAQ,kBACRA,EAAQ,eAAe,SAAS;AAAA,GAIhCC,KAAwB,CAC5BC,IAA6C,OACtB;AACvB,QAAMC,IAA0BD,EAAe,KAAK,CAAAF,MAAWA,EAAQ,WAAW,YAAY;AAE9F,SAAKG,GAAyB,iBAIJA,EAAwB,eAAe;AAAA,IAC/D,CAACC,MAAmDA,EAAO,gBAAgB;AAAA,EAAA,GAGnD,SAAS,oBAPjC;AAQJ;AAEO,SAASC,GAAgBC,GAA6B;AAC3D,SACE,gBAAAC,EAACC,IAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEO,MAAMG,KAAO,CAAC;AAAA,EACnB,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,oBAAAC,IAAqB;AAAA,EACrB,6BAAAC,IAA8BC;AAChC,MAA4B;AAC1B,EAAAC,GAAuB,2BAA2BN,CAAU,GAC5DO,GAAQ,yBAAyB;AACjC,QAAM,EAAE,mBAAAC,EAAA,IAAsBC,GAAA,GACxB,EAAE,GAAAC,EAAA,IAAMC,GAAe,yBAAyB,GAChD,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1C,CAACC,GAAgBC,CAAiB,IAAIF,EAA6BZ,K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AY,OAAO,KAAK,IAAI,QAAQ;AAE1C,YAAI;AAEF,gBAAMC,IAAW,MAAMC,GAAmBf,GAAe,EAAE,WAAAhE,GAAW,YAAA4E,GAAY;AAClF,cAAI,CAACE,EAAS,OAAO;AACnB,kBAAM,IAAI,MAAMnE,EAAE,wBAAwB,CAAC;AAE7C,gBAAMqE,IAAU,MAAMC,GAAqBH,EAAS,MAAM,gBAAgB,iBAAiB,GAErFI,IAAM,IAAI,gBAAgBF,CAAO;AAGvC,UAAIH,MACFA,EAAU,SAAS,OAAOK,IAE5BhF,EAAQ0C,EAAgB,gCAAgC,EAAE,YAAAgC,EAAA,CAAY,GACtE,IAAI,gBAAgBM,CAAG;AAAA,QACzB,SAASC,GAAK;AACZ,UAAIN,KACFA,EAAU,MAAA,GAEZvD,EAAa6D,aAAe,QAAQA,IAAM,IAAI,MAAM,OAAOA,CAAG,CAAC,CAAC;AAAA,QAClE;AAAA,MACF;AAAA,MA+BI,QAAQvB,KAAa/C,IAAYqB,EAAsB,aAAaF;AAAA,MACpE,aACEK,EAAY,mBAAmB,WAAWa,EAA0B;AAAA,MAEtE,WAAWkC,GAAiB/C,CAAW;AAAA,MACvC,aAAAA;AAAA,MACA,aAAAmB;AAAA,MACA,iBAAiBC,EAAa,iBAAiB,CAAA;AAAA,MAC/C,OAAAS;AAAA,MACA,QAAQlD;AAAA,MACR,oBAAAsB;AAAA,MACA,wBAAApB;AAAA,MACA,uBAAuB,CAACsD,GAAaa,MAAU;AAC7C,QAAAlE,EAA0B,CAAAmE,OAAS,EAAE,GAAGA,GAAM,CAACd,CAAW,GAAGa,IAAQ;AAAA,MACvE;AAAA,MACA,2BAAAxC;AAAA,MACA,oBAAAzC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -8,6 +8,7 @@ export { OffCycleReasonSelection } from './OffCycleReasonSelection';
|
|
|
8
8
|
export type { OffCycleReason, OffCycleReasonDefaults, OffCycleReasonSelectionProps, SelectReasonPayload, } from './OffCycleReasonSelection';
|
|
9
9
|
export { PayrollOverview } from './PayrollOverview/PayrollOverview';
|
|
10
10
|
export { PayrollFlow } from './PayrollFlow/PayrollFlow';
|
|
11
|
+
export { PayrollExecutionFlow, type PayrollExecutionFlowProps, type PayrollExecutionInitialState, } from './PayrollExecutionFlow';
|
|
11
12
|
export { PayrollReceipts } from './PayrollReceipts/PayrollReceipts';
|
|
12
13
|
export { ConfirmWireDetails } from './ConfirmWireDetails/ConfirmWireDetails';
|
|
13
14
|
export type { ConfirmWireDetailsProps, ConfirmWireDetailsComponentType } from './ConfirmWireDetails';
|
|
@@ -2,28 +2,30 @@ import { PayrollConfiguration as e } from "./PayrollConfiguration/PayrollConfigu
|
|
|
2
2
|
import { PayrollEditEmployee as t } from "./PayrollEditEmployee/PayrollEditEmployee.js";
|
|
3
3
|
import { PayrollHistory as a } from "./PayrollHistory/PayrollHistory.js";
|
|
4
4
|
import { PayrollLanding as p } from "./PayrollLanding/PayrollLanding.js";
|
|
5
|
-
import { PayrollList as
|
|
5
|
+
import { PayrollList as x } from "./PayrollList/PayrollList.js";
|
|
6
6
|
import { PayrollOverview as P } from "./PayrollOverview/PayrollOverview.js";
|
|
7
|
-
import { PayrollFlow as
|
|
7
|
+
import { PayrollFlow as s } from "./PayrollFlow/PayrollFlow.js";
|
|
8
8
|
import { PayrollReceipts as C } from "./PayrollReceipts/PayrollReceipts.js";
|
|
9
9
|
import { ConfirmWireDetails as v } from "./ConfirmWireDetails/ConfirmWireDetails.js";
|
|
10
|
-
import { RecoveryCases as
|
|
11
|
-
import { OffCycleReasonSelection as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { RecoveryCases as E } from "./RecoveryCases/RecoveryCases.js";
|
|
11
|
+
import { OffCycleReasonSelection as L } from "./OffCycleReasonSelection/OffCycleReasonSelection.js";
|
|
12
|
+
import { PayrollExecutionFlow as g } from "./PayrollExecutionFlow/PayrollExecutionFlow.js";
|
|
13
|
+
import { PayrollBlockerList as D } from "./PayrollBlocker/components/PayrollBlockerList.js";
|
|
14
|
+
import { PayPeriodDateForm as k } from "./PayPeriodDateForm/PayPeriodDateForm.js";
|
|
14
15
|
export {
|
|
15
16
|
v as ConfirmWireDetails,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
L as OffCycleReasonSelection,
|
|
18
|
+
k as PayPeriodDateForm,
|
|
19
|
+
D as PayrollBlockerList,
|
|
19
20
|
e as PayrollConfiguration,
|
|
20
21
|
t as PayrollEditEmployee,
|
|
21
|
-
|
|
22
|
+
g as PayrollExecutionFlow,
|
|
23
|
+
s as PayrollFlow,
|
|
22
24
|
a as PayrollHistory,
|
|
23
25
|
p as PayrollLanding,
|
|
24
|
-
|
|
26
|
+
x as PayrollList,
|
|
25
27
|
P as PayrollOverview,
|
|
26
28
|
C as PayrollReceipts,
|
|
27
|
-
|
|
29
|
+
E as RecoveryCases
|
|
28
30
|
};
|
|
29
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -12,14 +12,15 @@ import "../../shared/constants.js";
|
|
|
12
12
|
import "classnames";
|
|
13
13
|
import "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
14
|
import "dompurify";
|
|
15
|
-
|
|
15
|
+
import "../../contexts/LocaleProvider/useLocale.js";
|
|
16
|
+
const F = ({
|
|
16
17
|
companyId: r,
|
|
17
18
|
payrollId: s,
|
|
18
19
|
employeeUuids: a,
|
|
19
20
|
sortBy: l,
|
|
20
21
|
onDataReady: n
|
|
21
22
|
}) => {
|
|
22
|
-
const { mutateAsync: p, isPending: u } = q(), [t, d] = g(), e = b(!1), { baseSubmitHandler: c } = M(), P = L(() => a?.join(",") ?? "", [a]), { data:
|
|
23
|
+
const { mutateAsync: p, isPending: u } = q(), [t, d] = g(), e = b(!1), { baseSubmitHandler: c } = M(), P = L(() => a?.join(",") ?? "", [a]), { data: m, isLoading: y } = w(
|
|
23
24
|
{
|
|
24
25
|
companyId: r,
|
|
25
26
|
payScheduleId: t?.payPeriod?.payScheduleUuid || ""
|
|
@@ -53,17 +54,17 @@ const z = ({
|
|
|
53
54
|
j(() => {
|
|
54
55
|
o();
|
|
55
56
|
}, [o]);
|
|
56
|
-
const h = u && !e.current, f = u && e.current, S = h ||
|
|
57
|
+
const h = u && !e.current, f = u && e.current, S = h || y;
|
|
57
58
|
return {
|
|
58
59
|
handlePreparePayroll: o,
|
|
59
60
|
preparedPayroll: t,
|
|
60
|
-
paySchedule:
|
|
61
|
+
paySchedule: m?.payScheduleObject,
|
|
61
62
|
isLoading: S,
|
|
62
63
|
isPaginating: f,
|
|
63
64
|
hasInitialData: e.current
|
|
64
65
|
};
|
|
65
66
|
};
|
|
66
67
|
export {
|
|
67
|
-
|
|
68
|
+
F as usePreparedPayrollData
|
|
68
69
|
};
|
|
69
70
|
//# 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,IA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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";
|
|
9
10
|
import "classnames";
|
|
10
11
|
import { InternalError as x } from "../../components/Common/InternalError/InternalError.js";
|
|
11
12
|
import "../ComponentAdapter/useComponentContext.js";
|
|
12
13
|
import { LocaleProvider as L } from "../LocaleProvider/LocaleProvider.js";
|
|
14
|
+
import "../LocaleProvider/useLocale.js";
|
|
13
15
|
import { ThemeProvider as U } from "../ThemeProvider/ThemeProvider.js";
|
|
14
|
-
const
|
|
16
|
+
const z = (a) => {
|
|
15
17
|
const {
|
|
16
18
|
children: d,
|
|
17
19
|
config: e,
|
|
@@ -50,6 +52,6 @@ const R = (a) => {
|
|
|
50
52
|
) }, n) }) }) }) }) });
|
|
51
53
|
};
|
|
52
54
|
export {
|
|
53
|
-
|
|
55
|
+
z as GustoProviderCustomUIAdapter
|
|
54
56
|
};
|
|
55
57
|
//# 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,19 +1,20 @@
|
|
|
1
1
|
import i from "dompurify";
|
|
2
2
|
import "react-i18next";
|
|
3
3
|
import "react";
|
|
4
|
-
|
|
4
|
+
import "../contexts/LocaleProvider/useLocale.js";
|
|
5
|
+
const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), S = ({
|
|
5
6
|
first_name: t,
|
|
6
7
|
last_name: e
|
|
7
8
|
}) => `${t ? c(t) : ""}${e ? n(c(e)) : ""}`, n = (t) => t ? ` ${t}` : "", m = (t) => {
|
|
8
9
|
const e = n(t.street1), r = n(t.street2);
|
|
9
10
|
return `${e},${r}`;
|
|
10
|
-
}, u = (t) => `${n(t.city)}, ${n(t.state)} ${n(t.zip)}`,
|
|
11
|
+
}, u = (t) => `${n(t.city)}, ${n(t.state)} ${n(t.zip)}`, C = (t) => `${m(t)} ${u(t)}`, p = (t, e) => e ? `${t}%` : `$${t}`, a = (t, e = "en-US") => {
|
|
11
12
|
const r = t.toLocaleString(e, {
|
|
12
13
|
minimumFractionDigits: 2,
|
|
13
14
|
maximumFractionDigits: 2
|
|
14
15
|
});
|
|
15
16
|
return p(r, !1);
|
|
16
|
-
},
|
|
17
|
+
}, D = ({
|
|
17
18
|
rate: t,
|
|
18
19
|
paymentUnit: e,
|
|
19
20
|
t: r,
|
|
@@ -41,25 +42,25 @@ const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), h = ({
|
|
|
41
42
|
return o;
|
|
42
43
|
}
|
|
43
44
|
}, l = { ALLOWED_TAGS: ["a", "b", "strong"], ALLOWED_ATTR: ["href", "target"] };
|
|
44
|
-
function
|
|
45
|
+
function F(t) {
|
|
45
46
|
return t ? { __html: i.sanitize(t, l) } : { __html: "" };
|
|
46
47
|
}
|
|
47
|
-
const $ = (t) => t.replace(/\D/g, ""),
|
|
48
|
+
const $ = (t) => t.replace(/\D/g, ""), L = (t) => t.replace(/_([a-z])/g, (e, r) => r.toUpperCase()), R = (t) => {
|
|
48
49
|
if (!t) return "";
|
|
49
50
|
const e = $(String(t));
|
|
50
51
|
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 || "";
|
|
51
52
|
};
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
+
C as addressInline,
|
|
54
55
|
p as amountStr,
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
F as createMarkup,
|
|
57
|
+
S as firstLastName,
|
|
57
58
|
a as formatNumberAsCurrency,
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
D as formatPayRate,
|
|
60
|
+
R as formatPhoneNumber,
|
|
60
61
|
u as getCityStateZip,
|
|
61
62
|
m as getStreet,
|
|
62
63
|
$ as removeNonDigits,
|
|
63
|
-
|
|
64
|
+
L as snakeCaseToCamelCase
|
|
64
65
|
};
|
|
65
66
|
//# 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"],"mapp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
{
|
|
2
2
|
"name": "@gusto/embedded-react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"homepage": "https://github.com/Gusto/embedded-react-sdk",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/Gusto/embedded-react-sdk/issues"
|
|
@@ -50,9 +50,11 @@
|
|
|
50
50
|
"docs:publish": "npx tsx .docs/src/publish/readmePublisher.ts",
|
|
51
51
|
"format": "prettier . --write --log-level warn",
|
|
52
52
|
"format:check": "prettier . --check --log-level warn",
|
|
53
|
+
"format:staged": "prettier --write --log-level warn",
|
|
53
54
|
"i18n:generate": "node ./build/interface.js",
|
|
54
55
|
"lint": "npm run lint:check -- --fix",
|
|
55
56
|
"lint:check": "eslint .",
|
|
57
|
+
"lint:staged": "eslint --fix --cache",
|
|
56
58
|
"pack": "npm run build && npm pack",
|
|
57
59
|
"postversion": "git push",
|
|
58
60
|
"prepare": "husky",
|
|
@@ -72,7 +74,7 @@
|
|
|
72
74
|
"@storybook/addon-a11y": "^10.2.10",
|
|
73
75
|
"@storybook/addon-docs": "^10.2.10",
|
|
74
76
|
"@storybook/addon-onboarding": "^10.2.10",
|
|
75
|
-
"@storybook/react-vite": "^10.2.
|
|
77
|
+
"@storybook/react-vite": "^10.2.10",
|
|
76
78
|
"@storybook/test-runner": "^0.24.2",
|
|
77
79
|
"@testing-library/jest-dom": "^6.9.1",
|
|
78
80
|
"@testing-library/react": "^16.3.2",
|
|
@@ -92,7 +94,7 @@
|
|
|
92
94
|
"eslint-plugin-react": "^7.37.5",
|
|
93
95
|
"eslint-plugin-react-hooks": "^6.1.1",
|
|
94
96
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
95
|
-
"eslint-plugin-storybook": "^10.2.
|
|
97
|
+
"eslint-plugin-storybook": "^10.2.10",
|
|
96
98
|
"globals": "^17.3.0",
|
|
97
99
|
"husky": "^9.1.7",
|
|
98
100
|
"jest-axe": "^9.0.0",
|
|
@@ -136,7 +138,7 @@
|
|
|
136
138
|
"classnames": "^2.5.1",
|
|
137
139
|
"deepmerge": "^4.3.1",
|
|
138
140
|
"dompurify": "^3.3.1",
|
|
139
|
-
"i18next": "^25.8.
|
|
141
|
+
"i18next": "^25.8.11",
|
|
140
142
|
"react-aria": "^3.44.0",
|
|
141
143
|
"react-aria-components": "1.13.0",
|
|
142
144
|
"react-error-boundary": "^6.1.1",
|