@gusto/embedded-react-sdk 0.55.1 → 0.55.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  3. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  4. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  5. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
  6. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  7. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
  8. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  9. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
  10. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  11. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
  12. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  13. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  14. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  15. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
  16. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  17. package/dist/components/Company/Industry/Context.js +7 -6
  18. package/dist/components/Company/Industry/Context.js.map +1 -1
  19. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
  20. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  21. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
  22. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  23. package/dist/components/Company/OnboardingOverview/context.js +4 -3
  24. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  25. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
  26. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  27. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
  28. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  29. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +4 -3
  30. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
  31. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  32. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  33. package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
  34. package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
  35. package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
  36. package/dist/components/Flow/Flow.js +1 -1
  37. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +3 -2
  38. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  39. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +7 -0
  40. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +191 -153
  41. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  42. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +1 -0
  43. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +87 -81
  44. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  45. package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +1 -0
  46. package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
  47. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +73 -48
  48. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
  49. package/dist/components/Payroll/PayrollFlow/PayrollFlow.d.ts +1 -1
  50. package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +22 -20
  51. package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
  52. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +3 -0
  53. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +22 -20
  54. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  55. package/dist/components/Payroll/PayrollLanding/PayrollLanding.d.ts +2 -0
  56. package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +34 -26
  57. package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
  58. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +4 -0
  59. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +51 -43
  60. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  61. package/dist/components/Payroll/PayrollList/PayrollList.d.ts +2 -0
  62. package/dist/components/Payroll/PayrollList/PayrollList.js +48 -47
  63. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  64. package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -1
  65. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +44 -43
  66. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  67. package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +7 -0
  68. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +115 -112
  69. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  70. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
  71. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +94 -103
  72. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  73. package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +22 -16
  74. package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
  75. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +58 -49
  76. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  77. package/dist/components/Payroll/PrintChecks/PrintChecks.d.ts +21 -0
  78. package/dist/components/Payroll/PrintChecks/PrintChecks.js +68 -0
  79. package/dist/components/Payroll/PrintChecks/PrintChecks.js.map +1 -0
  80. package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.d.ts +9 -0
  81. package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js +34 -0
  82. package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js.map +1 -0
  83. package/dist/components/Payroll/PrintChecks/PrintChecksBanner/index.d.ts +1 -0
  84. package/dist/components/Payroll/PrintChecks/PrintChecksComponents.d.ts +48 -0
  85. package/dist/components/Payroll/PrintChecks/PrintChecksComponents.js +26 -0
  86. package/dist/components/Payroll/PrintChecks/PrintChecksComponents.js.map +1 -0
  87. package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.d.ts +14 -0
  88. package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js +47 -0
  89. package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js.map +1 -0
  90. package/dist/components/Payroll/PrintChecks/PrintChecksFailure/index.d.ts +1 -0
  91. package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.d.ts +16 -0
  92. package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js +144 -0
  93. package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js.map +1 -0
  94. package/dist/components/Payroll/PrintChecks/PrintChecksForm/index.d.ts +1 -0
  95. package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.d.ts +14 -0
  96. package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js +39 -0
  97. package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js.map +1 -0
  98. package/dist/components/Payroll/PrintChecks/PrintChecksSummary/index.d.ts +1 -0
  99. package/dist/components/Payroll/PrintChecks/index.d.ts +2 -0
  100. package/dist/components/Payroll/PrintChecks/printChecksStateMachine.d.ts +33 -0
  101. package/dist/components/Payroll/PrintChecks/printChecksStateMachine.js +93 -0
  102. package/dist/components/Payroll/PrintChecks/printChecksStateMachine.js.map +1 -0
  103. package/dist/components/Payroll/PrintChecks/types.d.ts +14 -0
  104. package/dist/components/Payroll/index.d.ts +2 -0
  105. package/dist/components/Payroll/index.js +26 -24
  106. package/dist/components/Payroll/index.js.map +1 -1
  107. package/dist/components/Payroll/usePreparedPayrollData.js +9 -8
  108. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  109. package/dist/i18n/I18n.js +4 -0
  110. package/dist/i18n/I18n.js.map +1 -1
  111. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +9 -9
  112. package/dist/i18n/en/Payroll.PayrollOverview.json.js +38 -38
  113. package/dist/i18n/en/Payroll.PayrollReceipts.json.js +2 -2
  114. package/dist/i18n/en/Payroll.PrintChecksBanner.json.js +14 -0
  115. package/dist/i18n/en/Payroll.PrintChecksBanner.json.js.map +1 -0
  116. package/dist/i18n/en/Payroll.PrintChecksFailure.json.js +12 -0
  117. package/dist/i18n/en/Payroll.PrintChecksFailure.json.js.map +1 -0
  118. package/dist/i18n/en/Payroll.PrintChecksForm.json.js +28 -0
  119. package/dist/i18n/en/Payroll.PrintChecksForm.json.js.map +1 -0
  120. package/dist/i18n/en/Payroll.PrintChecksSummary.json.js +14 -0
  121. package/dist/i18n/en/Payroll.PrintChecksSummary.json.js.map +1 -0
  122. package/dist/i18n/types.d.ts +65 -7
  123. package/dist/models/external.d.ts +3 -0
  124. package/dist/partner-hook-utils/form/buildFormSchema.js +60 -54
  125. package/dist/partner-hook-utils/form/buildFormSchema.js.map +1 -1
  126. package/dist/shared/constants.d.ts +28 -0
  127. package/dist/shared/constants.js +61 -50
  128. package/dist/shared/constants.js.map +1 -1
  129. package/dist/style.css +1 -1
  130. package/docs/guides/endpoint-inventory.json +26 -0
  131. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"GrossUpModal.js","sources":["../../../../src/components/Payroll/GrossUpModal/GrossUpModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { GrossUpModalProps } from './GrossUpModalTypes'\nimport styles from './GrossUpModal.module.scss'\nimport { ActionsLayout, Flex, NumberInputField } from '@/components/Common'\nimport { useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\n\nconst GrossUpFormSchema = z.object({\n netPay: z.number().positive(),\n})\n\ntype GrossUpFormValues = z.infer<typeof GrossUpFormSchema>\n\n/** @internal */\nexport function GrossUpModal({ isOpen, onCalculateGrossUp, onApply, onCancel }: GrossUpModalProps) {\n useI18n('Payroll.GrossUpModal')\n const { t } = useTranslation('Payroll.GrossUpModal')\n const { Modal, Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const [calculatedGrossUp, setCalculatedGrossUp] = useState<string | null>(null)\n const [errorMessage, setErrorMessage] = useState<string | null>(null)\n const [isCalculating, setIsCalculating] = useState(false)\n const [isApplying, setIsApplying] = useState(false)\n\n const formHandlers = useForm<GrossUpFormValues>({\n resolver: zodResolver(GrossUpFormSchema),\n defaultValues: { netPay: 0 },\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset({ netPay: 0 })\n setCalculatedGrossUp(null)\n setErrorMessage(null)\n }\n }, [isOpen, formHandlers.reset])\n\n const handleCalculate = async (data: GrossUpFormValues) => {\n setErrorMessage(null)\n setCalculatedGrossUp(null)\n setIsCalculating(true)\n\n await baseSubmitHandler(null, async () => {\n try {\n const result = await onCalculateGrossUp(data.netPay)\n\n if (result) {\n setCalculatedGrossUp(result)\n } else {\n setErrorMessage(t('errorMessage'))\n }\n } finally {\n setIsCalculating(false)\n }\n })\n }\n\n const handleApply = async () => {\n if (calculatedGrossUp) {\n setIsApplying(true)\n await baseSubmitHandler(null, async () => {\n try {\n await onApply(calculatedGrossUp)\n } finally {\n setIsApplying(false)\n }\n })\n }\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button\n variant=\"primary\"\n isDisabled={!calculatedGrossUp}\n onClick={handleApply}\n isLoading={isApplying}\n >\n {t('applyCta')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.header}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {t('title')}\n </Heading>\n <Text variant=\"supporting\" as=\"p\">\n {t('description')}\n </Text>\n </div>\n\n <div className={styles.content}>\n {errorMessage && (\n <div className={styles.alert}>\n <Alert label={errorMessage} status=\"error\" disableScrollIntoView />\n </div>\n )}\n\n <div className={styles.alert}>\n <Alert label={t('warning')} status=\"warning\" disableScrollIntoView />\n </div>\n\n <Flex flexDirection=\"row\" gap={8}>\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n errorMessage={t('validations.netPay')}\n min={0}\n isRequired\n />\n <Button\n variant=\"secondary\"\n className={styles.calculateButton}\n isDisabled={isCalculating}\n onClick={formHandlers.handleSubmit(handleCalculate)}\n >\n {isCalculating ? t('calculatingCta') : t('calculateCta')}\n </Button>\n </Flex>\n\n {calculatedGrossUp && (\n <>\n <div className={styles.result}>\n <Text size=\"sm\" variant=\"supporting\" weight=\"semibold\">\n {t('grossPayResult')}\n </Text>\n <Heading as=\"h3\">{formatNumberAsCurrency(parseFloat(calculatedGrossUp))}</Heading>\n </div>\n </>\n )}\n </div>\n </FormProvider>\n </Modal>\n )\n}\n"],"names":["GrossUpFormSchema","z","GrossUpModal","isOpen","onCalculateGrossUp","onApply","onCancel","useI18n","t","useTranslation","Modal","Heading","Text","Button","Alert","useComponentContext","baseSubmitHandler","useBase","modalContainerRef","useRef","calculatedGrossUp","setCalculatedGrossUp","useState","errorMessage","setErrorMessage","isCalculating","setIsCalculating","isApplying","setIsApplying","formHandlers","useForm","zodResolver","useEffect","handleCalculate","data","result","jsx","ActionsLayout","jsxs","FormProvider","styles","Flex","NumberInputField","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAaA,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACjC,QAAQA,EAAE,OAAA,EAAS,SAAA;AACrB,CAAC;AAKM,SAASC,GAAa,EAAE,QAAAC,GAAQ,oBAAAC,GAAoB,SAAAC,GAAS,UAAAC,KAA+B;AACjG,EAAAC,EAAQ,sBAAsB;AAC9B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,sBAAsB,GAC7C,EAAE,OAAAC,GAAO,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,OAAAC,EAAA,IAAUC,EAAA,GAC1C,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GACxBC,IAAoBC,EAAuB,IAAI,GAE/C,CAACC,GAAmBC,CAAoB,IAAIC,EAAwB,IAAI,GACxE,CAACC,GAAcC,CAAe,IAAIF,EAAwB,IAAI,GAC9D,CAACG,GAAeC,CAAgB,IAAIJ,EAAS,EAAK,GAClD,CAACK,GAAYC,CAAa,IAAIN,EAAS,EAAK,GAE5CO,IAAeC,EAA2B;AAAA,IAC9C,UAAUC,EAAY/B,CAAiB;AAAA,IACvC,eAAe,EAAE,QAAQ,EAAA;AAAA,EAAE,CAC5B;AAED,EAAAgC,EAAU,MAAM;AACd,I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A,EAAK,MAAK,MAAK,SAAQ,cAAa,QAAO,YACzC,UAAAJ,EAAE,gBAAgB,EAAA,CACrB;AAAA,YACA,gBAAA4B,EAACzB,KAAQ,IAAG,MAAM,YAAuB,WAAWS,CAAiB,CAAC,EAAA,CAAE;AAAA,UAAA,EAAA,CAC1E,EAAA,CACF;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"GrossUpModal.js","sources":["../../../../src/components/Payroll/GrossUpModal/GrossUpModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { GrossUpModalProps } from './GrossUpModalTypes'\nimport styles from './GrossUpModal.module.scss'\nimport { ActionsLayout, Flex, NumberInputField } from '@/components/Common'\nimport { useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\n\nconst GrossUpFormSchema = z.object({\n netPay: z.number().positive(),\n})\n\ntype GrossUpFormValues = z.infer<typeof GrossUpFormSchema>\n\n/** @internal */\nexport function GrossUpModal({ isOpen, onCalculateGrossUp, onApply, onCancel }: GrossUpModalProps) {\n useI18n('Payroll.GrossUpModal')\n const { t } = useTranslation('Payroll.GrossUpModal')\n const { Modal, Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const [calculatedGrossUp, setCalculatedGrossUp] = useState<string | null>(null)\n const [errorMessage, setErrorMessage] = useState<string | null>(null)\n const [isCalculating, setIsCalculating] = useState(false)\n const [isApplying, setIsApplying] = useState(false)\n\n const formHandlers = useForm<GrossUpFormValues>({\n resolver: zodResolver(GrossUpFormSchema),\n defaultValues: { netPay: 0 },\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset({ netPay: 0 })\n setCalculatedGrossUp(null)\n setErrorMessage(null)\n }\n }, [isOpen, formHandlers.reset])\n\n const handleCalculate = async (data: GrossUpFormValues) => {\n setErrorMessage(null)\n setCalculatedGrossUp(null)\n setIsCalculating(true)\n\n await baseSubmitHandler(null, async () => {\n try {\n const result = await onCalculateGrossUp(data.netPay)\n\n if (result) {\n setCalculatedGrossUp(result)\n } else {\n setErrorMessage(t('errorMessage'))\n }\n } finally {\n setIsCalculating(false)\n }\n })\n }\n\n const handleApply = async () => {\n if (calculatedGrossUp) {\n setIsApplying(true)\n await baseSubmitHandler(null, async () => {\n try {\n await onApply(calculatedGrossUp)\n } finally {\n setIsApplying(false)\n }\n })\n }\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button\n variant=\"primary\"\n isDisabled={!calculatedGrossUp}\n onClick={handleApply}\n isLoading={isApplying}\n >\n {t('applyCta')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.header}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {t('title')}\n </Heading>\n <Text variant=\"supporting\" as=\"p\">\n {t('description')}\n </Text>\n </div>\n\n <div className={styles.content}>\n {errorMessage && (\n <div className={styles.alert}>\n <Alert label={errorMessage} status=\"error\" disableScrollIntoView />\n </div>\n )}\n\n <div className={styles.alert}>\n <Alert label={t('warning')} status=\"warning\" disableScrollIntoView />\n </div>\n\n <Flex flexDirection=\"row\" gap={8}>\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n errorMessage={t('validations.netPay')}\n min={0}\n isRequired\n />\n <Button\n variant=\"secondary\"\n className={styles.calculateButton}\n isDisabled={isCalculating}\n onClick={formHandlers.handleSubmit(handleCalculate)}\n >\n {isCalculating ? t('calculatingCta') : t('calculateCta')}\n </Button>\n </Flex>\n\n {calculatedGrossUp && (\n <>\n <div className={styles.result}>\n <Text size=\"sm\" variant=\"supporting\" weight=\"semibold\">\n {t('grossPayResult')}\n </Text>\n <Heading as=\"h3\">{formatNumberAsCurrency(parseFloat(calculatedGrossUp))}</Heading>\n </div>\n </>\n )}\n </div>\n </FormProvider>\n </Modal>\n )\n}\n"],"names":["GrossUpFormSchema","z","GrossUpModal","isOpen","onCalculateGrossUp","onApply","onCancel","useI18n","t","useTranslation","Modal","Heading","Text","Button","Alert","useComponentContext","baseSubmitHandler","useBase","modalContainerRef","useRef","calculatedGrossUp","setCalculatedGrossUp","useState","errorMessage","setErrorMessage","isCalculating","setIsCalculating","isApplying","setIsApplying","formHandlers","useForm","zodResolver","useEffect","handleCalculate","data","result","jsx","ActionsLayout","jsxs","FormProvider","styles","Flex","NumberInputField","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACjC,QAAQA,EAAE,OAAA,EAAS,SAAA;AACrB,CAAC;AAKM,SAASC,GAAa,EAAE,QAAAC,GAAQ,oBAAAC,GAAoB,SAAAC,GAAS,UAAAC,KAA+B;AACjG,EAAAC,EAAQ,sBAAsB;AAC9B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,sBAAsB,GAC7C,EAAE,OAAAC,GAAO,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,OAAAC,EAAA,IAAUC,EAAA,GAC1C,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GACxBC,IAAoBC,EAAuB,IAAI,GAE/C,CAACC,GAAmBC,CAAoB,IAAIC,EAAwB,IAAI,GACxE,CAACC,GAAcC,CAAe,IAAIF,EAAwB,IAAI,GAC9D,CAACG,GAAeC,CAAgB,IAAIJ,EAAS,EAAK,GAClD,CAACK,GAAYC,CAAa,IAAIN,EAAS,EAAK,GAE5CO,IAAeC,E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,UAECL,KACC,gBAAAgB,EAAAO,GAAA,EACE,UAAA,gBAAAL,EAAC,OAAA,EAAI,WAAWE,EAAO,QACrB,UAAA;AAAA,YAAA,gBAAAJ,EAACxB,GAAA,EAAK,MAAK,MAAK,SAAQ,cAAa,QAAO,YACzC,UAAAJ,EAAE,gBAAgB,EAAA,CACrB;AAAA,YACA,gBAAA4B,EAACzB,KAAQ,IAAG,MAAM,YAAuB,WAAWS,CAAiB,CAAC,EAAA,CAAE;AAAA,UAAA,EAAA,CAC1E,EAAA,CACF;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -19,6 +19,12 @@ export interface PayrollConfigurationProps extends BaseComponentInterface<'Payro
19
19
  * Handles the configuration phase of payroll processing, allowing users to review and modify employee compensation before calculating the payroll.
20
20
  *
21
21
  * @remarks
22
+ * If the payroll turns out to already be processed (e.g. another actor submitted it while this
23
+ * screen was open), this component emits `runPayroll/alreadyProcessed` and then renders
24
+ * {@link PayrollOverview} in its place — the read-only breakdown with the gated "Cancel payroll"
25
+ * action — instead of the configuration table. Events from that delegated view (e.g.
26
+ * `runPayroll/cancelled`) are emitted through this component's own `onEvent`.
27
+ *
22
28
  * Emits the following events:
23
29
  *
24
30
  * @events
@@ -28,6 +34,7 @@ export interface PayrollConfigurationProps extends BaseComponentInterface<'Payro
28
34
  * | `runPayroll/employee/skip` | An employee is skipped or unskipped for this payroll | `{ employeeId }` |
29
35
  * | `runPayroll/employee/saved` | Employee compensation changes are persisted | `{ payrollPrepared }` |
30
36
  * | `runPayroll/calculated` | Payroll calculation completes successfully | `{ payrollId, alert, payPeriod }` |
37
+ * | `runPayroll/alreadyProcessed` | The payroll turns out to already be processed while configuring it | `{ payrollId, alert, payPeriod }` |
31
38
  * | `runPayroll/processingFailed` | Payroll calculation fails or times out | — |
32
39
  * | `runPayroll/blockers/viewAll` | The "view all blockers" affordance is selected | — |
33
40
  * | `runPayroll/grossUp/selected` | The set-net-earnings menu item is selected for an employee | `{ employeeUuid }` |
@@ -1,169 +1,196 @@
1
- import { jsx as P, jsxs as pe, Fragment as ce } from "react/jsx-runtime";
2
- import { useState as f, useRef as me, useMemo as de, useEffect as G } from "react";
3
- import { useQueryClient as ye } from "@tanstack/react-query";
4
- import { usePayrollsGetSuspense as fe } from "@gusto/embedded-api/react-query/payrollsGet";
5
- import { payrollsCalculate as Ce } from "@gusto/embedded-api/funcs/payrollsCalculate";
6
- import { useGustoEmbeddedContext as Ue } from "@gusto/embedded-api/react-query/_context";
7
- import { PayrollProcessingRequestStatus as _ } from "@gusto/embedded-api/models/components/payrollprocessingrequest";
8
- import { useTranslation as Pe } from "react-i18next";
9
- import { usePayrollsUpdateMutation as ge } from "@gusto/embedded-api/react-query/payrollsUpdate";
10
- import { usePayrollsCalculateGrossUpMutation as he } from "@gusto/embedded-api/react-query/payrollsCalculateGrossUp";
11
- import { usePayrollsGetBlockersSuspense as Le } from "@gusto/embedded-api/react-query/payrollsGetBlockers";
12
- import { payrollSubmitHandler as Se } from "../PayrollBlocker/payrollHelpers.js";
13
- import { hasDirectDepositEmployees as we } from "../helpers.js";
14
- import { PayrollConfigurationPresentation as _e } from "./PayrollConfigurationPresentation.js";
15
- import { usePayrollConfigurationData as Re } from "./usePayrollConfigurationData.js";
16
- import { isGrossUpEligible as Ae, getGrossUpTargetCompensationName as De } from "./grossUpHelpers.js";
17
- import { BaseComponent as Ee } from "../../Base/Base.js";
18
- import { componentEvents as i } from "../../../shared/constants.js";
19
- import { useComponentDictionary as Oe, useI18n as Te } from "../../../i18n/I18n.js";
20
- import { useBase as xe } from "../../Base/useBase.js";
21
- import { useDateFormatter as be } from "../../../hooks/useDateFormatter.js";
22
- import { SDKInternalError as N } from "../../../types/sdkError.js";
23
- import { API_QUERY_NAMESPACE as ke } from "../../../contexts/ApiProvider/apiVersion.js";
24
- import { GrossUpModal as Ge } from "../GrossUpModal/GrossUpModal.js";
25
- const Ne = (t) => t?.status === _.Calculating, Me = (t, n) => n != null && (t?.status === _.CalculateSuccess || t == null);
26
- function uo(t) {
27
- return /* @__PURE__ */ P(Ee, { ...t, children: /* @__PURE__ */ P(Ye, { ...t, children: t.children }) });
1
+ import { jsx as C, jsxs as fe, Fragment as Ce } from "react/jsx-runtime";
2
+ import { useState as f, useRef as q, useMemo as F, useEffect as D } from "react";
3
+ import { useQueryClient as Pe } from "@tanstack/react-query";
4
+ import { usePayrollsGetSuspense as Ue } from "@gusto/embedded-api/react-query/payrollsGet";
5
+ import { payrollsCalculate as ge } from "@gusto/embedded-api/funcs/payrollsCalculate";
6
+ import { useGustoEmbeddedContext as he } from "@gusto/embedded-api/react-query/_context";
7
+ import { PayrollProcessingRequestStatus as O } from "@gusto/embedded-api/models/components/payrollprocessingrequest";
8
+ import { useTranslation as Le } from "react-i18next";
9
+ import { usePayrollsUpdateMutation as Se } from "@gusto/embedded-api/react-query/payrollsUpdate";
10
+ import { usePayrollsCalculateGrossUpMutation as Ae } from "@gusto/embedded-api/react-query/payrollsCalculateGrossUp";
11
+ import { usePayrollsGetBlockersSuspense as _e } from "@gusto/embedded-api/react-query/payrollsGetBlockers";
12
+ import { payrollSubmitHandler as we } from "../PayrollBlocker/payrollHelpers.js";
13
+ import { hasDirectDepositEmployees as Re } from "../helpers.js";
14
+ import { PayrollOverview as Ee } from "../PayrollOverview/PayrollOverview.js";
15
+ import { PayrollConfigurationPresentation as De } from "./PayrollConfigurationPresentation.js";
16
+ import { usePayrollConfigurationData as Oe } from "./usePayrollConfigurationData.js";
17
+ import { isGrossUpEligible as Te, getGrossUpTargetCompensationName as xe } from "./grossUpHelpers.js";
18
+ import { BaseComponent as be } from "../../Base/Base.js";
19
+ import { componentEvents as l } from "../../../shared/constants.js";
20
+ import { useComponentDictionary as ke, useI18n as Ne } from "../../../i18n/I18n.js";
21
+ import { useBase as Ge } from "../../Base/useBase.js";
22
+ import { useDateFormatter as Ye } from "../../../hooks/useDateFormatter.js";
23
+ import { SDKInternalError as j } from "../../../types/sdkError.js";
24
+ import { API_QUERY_NAMESPACE as Me } from "../../../contexts/ApiProvider/apiVersion.js";
25
+ import { GrossUpModal as Be } from "../GrossUpModal/GrossUpModal.js";
26
+ const qe = (t) => t?.status === O.Calculating, Fe = (t, u) => u != null && (t?.status === O.CalculateSuccess || t == null);
27
+ function fo(t) {
28
+ return /* @__PURE__ */ C(be, { ...t, children: /* @__PURE__ */ C(je, { ...t, children: t.children }) });
28
29
  }
29
- const Ye = ({
30
+ const je = ({
30
31
  onEvent: t,
31
- companyId: n,
32
- payrollId: u,
33
- dictionary: M,
34
- alerts: Y,
35
- withReimbursements: B = !0
32
+ companyId: u,
33
+ payrollId: i,
34
+ dictionary: v,
35
+ alerts: W,
36
+ withReimbursements: T = !0
36
37
  }) => {
37
- Oe("Payroll.PayrollConfiguration", M), Te("Payroll.PayrollConfiguration");
38
- const { t: p } = Pe("Payroll.PayrollConfiguration"), { baseSubmitHandler: C } = xe(), c = be(), [r, m] = f(!1), [g, R] = f(!1), h = me(null), q = Ue(), j = ye(), { data: s } = fe(
38
+ ke("Payroll.PayrollConfiguration", v), Ne("Payroll.PayrollConfiguration");
39
+ const { t: p } = Le("Payroll.PayrollConfiguration"), { baseSubmitHandler: P } = Ge(), c = Ye(), [n, m] = f(!1), [g, x] = f(!1), h = q(null), K = he(), H = Pe(), { data: s } = Ue(
39
40
  {
40
- companyId: n,
41
- payrollId: u,
41
+ companyId: u,
42
+ payrollId: i,
42
43
  include: ["taxes", "benefits", "deductions", "payroll_status_meta"]
43
44
  },
44
- { refetchInterval: r ? 5e3 : !1 }
45
- ), F = de(
45
+ { refetchInterval: n ? 5e3 : !1 }
46
+ ), V = F(
46
47
  () => s.payrollShow?.employeeCompensations?.filter((e) => e.excluded).map((e) => e.employeeUuid).filter(Boolean) ?? [],
47
48
  [s.payrollShow?.employeeCompensations]
48
49
  ), {
49
- employeeDetails: W,
50
- employeeCompensations: A,
51
- paySchedule: I,
52
- payPeriod: K,
50
+ employeeDetails: I,
51
+ employeeCompensations: b,
52
+ paySchedule: Q,
53
+ payPeriod: J,
53
54
  payrollCategory: L,
54
- pagination: H,
55
- isLoading: V,
56
- refetch: D
57
- } = Re({
58
- companyId: n,
59
- payrollId: u,
60
- isCalculating: r || g,
61
- excludedEmployeeUuids: F
62
- }), { mutateAsync: E, isPending: Q } = ge(), { mutateAsync: v } = he(), [d, O] = f(null), [J, S] = f(!1), T = Ae(L), U = De(L), z = (e) => {
63
- O(e), S(!0), t(i.RUN_PAYROLL_GROSS_UP_SELECTED, { employeeUuid: e });
64
- }, X = async (e) => {
55
+ pagination: z,
56
+ isLoading: X,
57
+ isAlreadyProcessed: S,
58
+ refetch: A
59
+ } = Oe({
60
+ companyId: u,
61
+ payrollId: i,
62
+ isCalculating: n || g,
63
+ excludedEmployeeUuids: V
64
+ }), _ = F(
65
+ () => ({
66
+ type: "error",
67
+ title: p("alerts.alreadyProcessed"),
68
+ alertKey: "alreadyProcessed"
69
+ }),
70
+ [p]
71
+ ), w = q(!1);
72
+ D(() => {
73
+ if (!S) {
74
+ w.current = !1;
75
+ return;
76
+ }
77
+ w.current || (w.current = !0, t(l.RUN_PAYROLL_ALREADY_PROCESSED, {
78
+ payrollId: i,
79
+ alert: _,
80
+ payPeriod: s.payrollShow?.payPeriod
81
+ }));
82
+ }, [
83
+ S,
84
+ t,
85
+ i,
86
+ _,
87
+ s.payrollShow?.payPeriod
88
+ ]);
89
+ const { mutateAsync: k, isPending: Z } = Se(), { mutateAsync: $ } = Ae(), [d, N] = f(null), [ee, R] = f(!1), G = Te(L), U = xe(L), oe = (e) => {
90
+ N(e), R(!0), t(l.RUN_PAYROLL_GROSS_UP_SELECTED, { employeeUuid: e });
91
+ }, te = async (e) => {
65
92
  if (!d) return null;
66
93
  let o = null;
67
- return await C(null, async () => {
68
- o = (await v({
94
+ return await P(null, async () => {
95
+ o = (await $({
69
96
  request: {
70
- payrollUuid: u,
97
+ payrollUuid: i,
71
98
  payrollGrossUpRequest: {
72
99
  employeeUuid: d,
73
100
  netPay: e.toString()
74
101
  }
75
102
  }
76
- })).payrollGrossUpResponse?.grossUp ?? null, o && t(i.RUN_PAYROLL_GROSS_UP_CALCULATED, {
103
+ })).payrollGrossUpResponse?.grossUp ?? null, o && t(l.RUN_PAYROLL_GROSS_UP_CALCULATED, {
77
104
  grossUp: o,
78
105
  netPay: e,
79
106
  employeeUuid: d
80
107
  });
81
108
  }), o;
82
- }, Z = async (e) => {
109
+ }, ae = async (e) => {
83
110
  if (!d || !U)
84
- throw new N(
111
+ throw new j(
85
112
  "Unable to apply gross-up: missing employee or target compensation."
86
113
  );
87
- const o = A.find((a) => a.employeeUuid === d);
114
+ const o = b.find((a) => a.employeeUuid === d);
88
115
  if (!o)
89
- throw new N("Unable to apply gross-up: employee compensation not found.");
90
- const l = o.fixedCompensations ?? [], y = l.some(
116
+ throw new j("Unable to apply gross-up: employee compensation not found.");
117
+ const r = o.fixedCompensations ?? [], y = r.some(
91
118
  (a) => a.name?.toLowerCase() === U.toLowerCase()
92
- ), k = l.map((a) => ({
119
+ ), B = r.map((a) => ({
93
120
  name: a.name,
94
121
  jobUuid: a.jobUuid,
95
122
  amount: a.name?.toLowerCase() === U.toLowerCase() ? e : "0"
96
123
  }));
97
124
  if (!y) {
98
- const a = o.hourlyCompensations?.[0]?.jobUuid ?? l[0]?.jobUuid ?? "";
99
- k.push({
125
+ const a = o.hourlyCompensations?.[0]?.jobUuid ?? r[0]?.jobUuid ?? "";
126
+ B.push({
100
127
  name: U,
101
128
  jobUuid: a,
102
129
  amount: e
103
130
  });
104
131
  }
105
- const ie = (o.hourlyCompensations ?? []).map((a) => ({
132
+ const me = (o.hourlyCompensations ?? []).map((a) => ({
106
133
  name: a.name,
107
134
  jobUuid: a.jobUuid,
108
135
  hours: "0"
109
- })), ne = (o.paidTimeOff ?? []).map((a) => ({
136
+ })), de = (o.paidTimeOff ?? []).map((a) => ({
110
137
  name: a.name,
111
138
  hours: "0"
112
- })), ue = b({
139
+ })), ye = M({
113
140
  ...o,
114
- fixedCompensations: k,
115
- hourlyCompensations: ie,
116
- paidTimeOff: ne
141
+ fixedCompensations: B,
142
+ hourlyCompensations: me,
143
+ paidTimeOff: de
117
144
  });
118
- await C({}, async () => {
119
- const a = await E({
145
+ await P({}, async () => {
146
+ const a = await k({
120
147
  request: {
121
- companyId: n,
122
- payrollId: u,
148
+ companyId: u,
149
+ payrollId: i,
123
150
  payrollUpdate: {
124
- employeeCompensations: [{ ...ue, excluded: !1 }]
151
+ employeeCompensations: [{ ...ye, excluded: !1 }]
125
152
  }
126
153
  }
127
154
  });
128
- t(i.RUN_PAYROLL_EMPLOYEE_SAVED, {
155
+ t(l.RUN_PAYROLL_EMPLOYEE_SAVED, {
129
156
  payrollPrepared: a.payrollPrepared
130
- }), await D();
131
- }), O(null), S(!1);
132
- }, $ = async (e) => {
157
+ }), await A();
158
+ }), N(null), R(!1);
159
+ }, se = async (e) => {
133
160
  try {
134
- await Z(e);
161
+ await ae(e);
135
162
  } catch {
136
163
  }
137
- }, { data: ee } = Le({
138
- companyUuid: n
139
- }), x = (ee.payrollBlockers ?? []).map((e) => ({
164
+ }, { data: re } = _e({
165
+ companyUuid: u
166
+ }), Y = (re.payrollBlockers ?? []).map((e) => ({
140
167
  key: e.key,
141
168
  message: e.message
142
- })), [oe, w] = f(x), te = async () => {
143
- w([]), h.current = s.payrollShow?.calculatedAt?.getTime() ?? null, await C({}, async () => {
144
- const e = await Se(async () => {
145
- R(!0);
169
+ })), [le, E] = f(Y), ie = async () => {
170
+ E([]), h.current = s.payrollShow?.calculatedAt?.getTime() ?? null, await P({}, async () => {
171
+ const e = await we(async () => {
172
+ x(!0);
146
173
  try {
147
- const o = await Ce(q, {
148
- companyId: n,
149
- payrollId: u
174
+ const o = await ge(K, {
175
+ companyId: u,
176
+ payrollId: i
150
177
  });
151
178
  if (!o.ok)
152
179
  throw o.error;
153
- j.invalidateQueries({ queryKey: [ke] }), m(!0);
180
+ H.invalidateQueries({ queryKey: [Me] }), m(!0);
154
181
  } finally {
155
- R(!1);
182
+ x(!1);
156
183
  }
157
184
  });
158
- !e.success && e.blockers.length > 0 && w(e.blockers);
185
+ !e.success && e.blockers.length > 0 && E(e.blockers);
159
186
  });
160
- }, ae = (e) => {
161
- t(i.RUN_PAYROLL_EMPLOYEE_EDIT, {
187
+ }, ne = (e) => {
188
+ t(l.RUN_PAYROLL_EMPLOYEE_EDIT, {
162
189
  employeeId: e.uuid,
163
190
  firstName: e.firstName,
164
191
  lastName: e.lastName
165
192
  });
166
- }, b = (e) => {
193
+ }, M = (e) => {
167
194
  const { paymentMethod: o } = e;
168
195
  return {
169
196
  employeeUuid: e.employeeUuid,
@@ -176,14 +203,14 @@ const Ye = ({
176
203
  ...o && o !== "Historical" ? { paymentMethod: o } : {},
177
204
  memo: e.memo || void 0
178
205
  };
179
- }, se = async (e) => {
180
- t(i.RUN_PAYROLL_EMPLOYEE_SKIP, {
206
+ }, ue = async (e) => {
207
+ t(l.RUN_PAYROLL_EMPLOYEE_SKIP, {
181
208
  employeeId: e.employeeUuid
182
- }), await C({}, async () => {
183
- const o = b(e), l = await E({
209
+ }), await P({}, async () => {
210
+ const o = M(e), r = await k({
184
211
  request: {
185
- companyId: n,
186
- payrollId: u,
212
+ companyId: u,
213
+ payrollId: i,
187
214
  payrollUpdate: {
188
215
  employeeCompensations: [
189
216
  { ...o, excluded: !o.excluded }
@@ -191,42 +218,42 @@ const Ye = ({
191
218
  }
192
219
  }
193
220
  });
194
- t(i.RUN_PAYROLL_EMPLOYEE_SAVED, {
195
- payrollPrepared: l.payrollPrepared
196
- }), await D();
221
+ t(l.RUN_PAYROLL_EMPLOYEE_SAVED, {
222
+ payrollPrepared: r.payrollPrepared
223
+ }), await A();
197
224
  });
198
- }, le = () => {
199
- t(i.RUN_PAYROLL_BLOCKERS_VIEW_ALL);
225
+ }, pe = () => {
226
+ t(l.RUN_PAYROLL_BLOCKERS_VIEW_ALL);
200
227
  };
201
- G(() => {
202
- Ne(s.payrollShow?.processingRequest) && !r && (h.current = s.payrollShow?.calculatedAt?.getTime() ?? null, m(!0));
228
+ D(() => {
229
+ qe(s.payrollShow?.processingRequest) && !n && (h.current = s.payrollShow?.calculatedAt?.getTime() ?? null, m(!0));
203
230
  const e = s.payrollShow?.calculatedAt, o = e?.getTime() !== h.current;
204
- r && o && Me(s.payrollShow?.processingRequest, e) && (t(i.RUN_PAYROLL_CALCULATED, {
205
- payrollId: u,
231
+ n && o && Fe(s.payrollShow?.processingRequest, e) && (t(l.RUN_PAYROLL_CALCULATED, {
232
+ payrollId: i,
206
233
  alert: {
207
234
  type: "success",
208
235
  title: p("alerts.progressSaved"),
209
236
  alertKey: "progressSaved"
210
237
  },
211
238
  payPeriod: s.payrollShow?.payPeriod
212
- }), w([]), m(!1)), r && s.payrollShow?.processingRequest?.status === _.ProcessingFailed && (t(i.RUN_PAYROLL_PROCESSING_FAILED), m(!1));
239
+ }), E([]), m(!1)), n && s.payrollShow?.processingRequest?.status === O.ProcessingFailed && (t(l.RUN_PAYROLL_PROCESSING_FAILED), m(!1));
213
240
  }, [
214
241
  s.payrollShow?.processingRequest?.status,
215
242
  s.payrollShow?.calculatedAt,
216
- r,
243
+ n,
217
244
  t,
218
245
  p,
219
- u
220
- ]), G(() => {
221
- if (!r) return;
246
+ i
247
+ ]), D(() => {
248
+ if (!n) return;
222
249
  const e = 180 * 1e3, o = setTimeout(() => {
223
- t(i.RUN_PAYROLL_PROCESSING_FAILED), m(!1);
250
+ t(l.RUN_PAYROLL_PROCESSING_FAILED), m(!1);
224
251
  }, e);
225
252
  return () => {
226
253
  clearTimeout(o);
227
254
  };
228
- }, [r, t]);
229
- const re = (() => {
255
+ }, [n, t]);
256
+ const ce = (() => {
230
257
  const e = s.payrollShow?.payrollStatusMeta;
231
258
  if (e?.payrollLate && e.initialCheckDate && e.expectedDebitTime && e.expectedCheckDate)
232
259
  return {
@@ -239,56 +266,67 @@ const Ye = ({
239
266
  }),
240
267
  variant: "warning"
241
268
  };
242
- const { payrollShow: l } = s, y = l?.employeeCompensations;
243
- if (l && y && y.length > 0 && we(y))
269
+ const { payrollShow: r } = s, y = r?.employeeCompensations;
270
+ if (r && y && y.length > 0 && Re(y))
244
271
  return {
245
272
  label: p("alerts.directDepositDeadline", {
246
- payDate: c.formatShortWithWeekday(l.checkDate),
247
- ...c.formatWithTime(l.payrollDeadline)
273
+ payDate: c.formatShortWithWeekday(r.checkDate),
274
+ ...c.formatWithTime(r.payrollDeadline)
248
275
  }),
249
276
  content: p("alerts.directDepositDeadlineText"),
250
277
  variant: "info"
251
278
  };
252
279
  })();
253
- return /* @__PURE__ */ pe(ce, { children: [
254
- /* @__PURE__ */ P(
255
- _e,
280
+ return S ? /* @__PURE__ */ C(
281
+ Ee,
282
+ {
283
+ companyId: u,
284
+ payrollId: i,
285
+ onEvent: (o, r) => {
286
+ o === l.RUN_PAYROLL_CANCELLED && A(), t(o, r);
287
+ },
288
+ withReimbursements: T,
289
+ alerts: [_]
290
+ }
291
+ ) : /* @__PURE__ */ fe(Ce, { children: [
292
+ /* @__PURE__ */ C(
293
+ De,
256
294
  {
257
- onCalculatePayroll: te,
258
- isCalculateDisabled: x.length > 0,
259
- onEdit: ae,
260
- onToggleExclude: se,
261
- onViewBlockers: le,
262
- employeeCompensations: A,
263
- employeeDetails: W,
264
- payPeriod: K,
265
- paySchedule: I,
295
+ onCalculatePayroll: ie,
296
+ isCalculateDisabled: Y.length > 0,
297
+ onEdit: ne,
298
+ onToggleExclude: ue,
299
+ onViewBlockers: pe,
300
+ employeeCompensations: b,
301
+ employeeDetails: I,
302
+ payPeriod: J,
303
+ paySchedule: Q,
266
304
  payrollCategory: L,
267
- alerts: Y,
268
- payrollAlert: re,
269
- isPending: r || V || Q || g,
270
- isCalculating: g || r,
271
- payrollBlockers: oe,
272
- pagination: H,
273
- withReimbursements: B,
274
- grossUpEnabled: T,
275
- onGrossUpSelect: z
305
+ alerts: W,
306
+ payrollAlert: ce,
307
+ isPending: n || X || Z || g,
308
+ isCalculating: g || n,
309
+ payrollBlockers: le,
310
+ pagination: z,
311
+ withReimbursements: T,
312
+ grossUpEnabled: G,
313
+ onGrossUpSelect: oe
276
314
  }
277
315
  ),
278
- T && /* @__PURE__ */ P(
279
- Ge,
316
+ G && /* @__PURE__ */ C(
317
+ Be,
280
318
  {
281
- isOpen: J,
282
- onCalculateGrossUp: X,
283
- onApply: $,
319
+ isOpen: ee,
320
+ onCalculateGrossUp: te,
321
+ onApply: se,
284
322
  onCancel: () => {
285
- S(!1);
323
+ R(!1);
286
324
  }
287
325
  }
288
326
  )
289
327
  ] });
290
328
  };
291
329
  export {
292
- uo as PayrollConfiguration
330
+ fo as PayrollConfiguration
293
331
  };
294
332
  //# sourceMappingURL=PayrollConfiguration.js.map