@gusto/embedded-react-sdk 0.55.0 → 0.55.1

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 (129) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/Common/TaxInputs/TaxInputs.js +65 -64
  3. package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
  4. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  5. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  6. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  7. package/dist/components/Common/UI/Select/Select.module.scss.js +5 -5
  8. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
  9. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  10. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
  11. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  12. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
  13. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  14. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
  15. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  16. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  17. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  18. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
  19. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  20. package/dist/components/Company/Industry/Context.js +6 -7
  21. package/dist/components/Company/Industry/Context.js.map +1 -1
  22. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
  23. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  24. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
  25. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  26. package/dist/components/Company/OnboardingOverview/context.js +3 -4
  27. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  28. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
  29. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  30. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
  31. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  32. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -4
  33. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
  34. package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.d.ts +4 -2
  35. package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js +148 -117
  36. package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js.map +1 -1
  37. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +56 -55
  38. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  39. package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.d.ts +1 -1
  40. package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.js +15 -12
  41. package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.js.map +1 -1
  42. package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.d.ts +69 -0
  43. package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.js +48 -0
  44. package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.js.map +1 -0
  45. package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.d.ts +20 -0
  46. package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.js +25 -0
  47. package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.js.map +1 -0
  48. package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.d.ts +20 -0
  49. package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.js +24 -0
  50. package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.js.map +1 -0
  51. package/dist/components/Contractor/Payments/HistoricalPaymentFlow/index.d.ts +2 -0
  52. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js +16 -15
  53. package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js.map +1 -1
  54. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +2 -0
  55. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +36 -23
  56. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
  57. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +10 -8
  58. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +46 -25
  59. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
  60. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +53 -52
  61. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  62. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +37 -47
  63. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  64. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +47 -44
  65. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
  66. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +2 -1
  67. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +65 -53
  68. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  69. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js +6 -4
  70. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js.map +1 -1
  71. package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.d.ts +1 -1
  72. package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.js +22 -19
  73. package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.js.map +1 -1
  74. package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.d.ts +2 -8
  75. package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.js +43 -42
  76. package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.js.map +1 -1
  77. package/dist/components/Contractor/Payments/shared/paymentAmounts.d.ts +32 -0
  78. package/dist/components/Contractor/Payments/shared/paymentAmounts.js +11 -0
  79. package/dist/components/Contractor/Payments/shared/paymentAmounts.js.map +1 -0
  80. package/dist/components/Contractor/Payments/shared/paymentAmounts.test.d.ts +1 -0
  81. package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.d.ts +13 -4
  82. package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.js +43 -38
  83. package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.js.map +1 -1
  84. package/dist/components/Contractor/exports/contractorManagement.d.ts +1 -0
  85. package/dist/components/Contractor/exports/contractorManagement.js +34 -32
  86. package/dist/components/Contractor/exports/contractorManagement.js.map +1 -1
  87. package/dist/components/Contractor/shared/SelectContractors/SelectContractors.d.ts +6 -1
  88. package/dist/components/Contractor/shared/SelectContractors/SelectContractors.js +13 -12
  89. package/dist/components/Contractor/shared/SelectContractors/SelectContractors.js.map +1 -1
  90. package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.d.ts +5 -1
  91. package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js +34 -32
  92. package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js.map +1 -1
  93. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  94. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  95. package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
  96. package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
  97. package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
  98. package/dist/components/Flow/Flow.js +1 -1
  99. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +2 -3
  100. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  101. package/dist/components/Payroll/usePreparedPayrollData.js +8 -9
  102. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  103. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +6 -0
  104. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +36 -34
  105. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  106. package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.d.ts +22 -0
  107. package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.js +14 -0
  108. package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.js.map +1 -0
  109. package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.d.ts +19 -0
  110. package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.js +8 -0
  111. package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.js.map +1 -0
  112. package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +41 -0
  113. package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js +14 -0
  114. package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -0
  115. package/dist/contexts/index.d.ts +1 -0
  116. package/dist/i18n/en/Contractor.Payments.CreateHistoricalPayment.json.js +34 -32
  117. package/dist/i18n/en/Contractor.Payments.CreateHistoricalPayment.json.js.map +1 -1
  118. package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +20 -18
  119. package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js.map +1 -1
  120. package/dist/i18n/en/common.json.d.ts +0 -21
  121. package/dist/i18n/types.d.ts +10 -2
  122. package/dist/shared/constants.d.ts +2 -0
  123. package/dist/shared/constants.js +1 -0
  124. package/dist/shared/constants.js.map +1 -1
  125. package/dist/style.css +1 -1
  126. package/dist/test-utils/renderWithProviders.d.ts +4 -1
  127. package/dist/test-utils/tableQueries.d.ts +9 -0
  128. package/docs/guides/endpoint-inventory.json +7 -0
  129. package/package.json +18 -18
@@ -1 +1 @@
1
- {"version":3,"file":"CreateHistoricalPayment.js","sources":["../../../../../src/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.tsx"],"sourcesContent":["import { useContractorsListSuspense } from '@gusto/embedded-api/react-query/contractorsList'\nimport { useContractorPaymentGroupsPreviewMutation } from '@gusto/embedded-api/react-query/contractorPaymentGroupsPreview'\nimport { useContractorPaymentGroupsCreateMutation } from '@gusto/embedded-api/react-query/contractorPaymentGroupsCreate'\nimport type { ContractorPaymentGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentgrouppreview'\nimport type { PostV1CompaniesCompanyIdContractorPaymentGroupsPaymentMethod as ContractorPaymentMethod } from '@gusto/embedded-api/models/operations/postv1companiescompanyidcontractorpaymentgroups'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useMemo, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { usePaymentAmountsEditor } from '../shared/usePaymentAmountsEditor'\nimport { SetPaymentAmounts } from '../shared/SetPaymentAmounts'\nimport { PaymentSummaryBlock } from '../shared/PaymentSummaryBlock'\nimport { getHistoricalPaymentCheckDateBounds } from '../shared/historicalPaymentDateBounds'\nimport {\n useCreateHistoricalPaymentDictionary,\n useCreateHistoricalPaymentReviewDictionary,\n} from './useFormDictionary'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { ActionsLayout, Flex, FlexItem } from '@/components/Common'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { componentEvents } from '@/shared/constants'\nimport { SelectContractors } from '@/components/Contractor/shared/SelectContractors/SelectContractors'\n\nconst ALLOWED_PAYMENT_METHODS: ContractorPaymentMethod[] = ['Historical Payment']\n\n/**\n * Props for {@link CreateHistoricalPayment}.\n *\n * @alpha\n */\nexport interface CreateHistoricalPaymentProps extends BaseComponentInterface<'Contractor.Payments.CreateHistoricalPayment'> {\n /** UUID of the company recording the historical payment. */\n companyId: string\n}\n\n/**\n * Records a historical contractor payment — one that already happened outside Gusto and does not\n * move money — by picking a paid date and the contractors being paid, entering hours, wages,\n * bonuses, and reimbursements for them, then reviewing and submitting.\n *\n * @remarks\n * Every contractor payment is fixed to the `Historical Payment` payment method, so there is no\n * payment method choice or debit information to review.\n * Continue on the contractor-selection step is disabled until the paid date is valid and at least\n * one contractor is selected. Continue on the amounts step is disabled until at least one selected\n * contractor has a payment total greater than zero, and swaps the amounts grid for an in-place\n * review (mirroring `CreatePayment`'s preview step); Edit returns to the grid without losing\n * entered amounts, and Submit creates the contractor payment group. Once creation succeeds, the\n * Edit and Submit buttons are replaced with a success message, since the creation token has been\n * consumed and the host is expected to navigate away (e.g. to `HistoricalPaymentSummary`).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/historicalPayments/edit` | The edit modal was opened for a contractor. | — |\n * | `contractor/historicalPayments/update` | A contractor's payment values were updated locally. | The updated form values (hours, wage, bonus, reimbursement, payment method, etc.). |\n * | `contractor/historicalPayments/preview` | The preview API call succeeded. | The contractor payment group preview response. |\n * | `contractor/historicalPayments/backToEdit` | The user returned from preview to continue editing. | — |\n * | `contractor/historicalPayments/created` | The payment group was successfully created. | The created contractor payment group response. |\n *\n * @param props - See {@link CreateHistoricalPaymentProps}.\n * @returns The rendered contractor-selection screen, the payment-amounts entry screen, or its\n * in-place review.\n * @alpha\n */\nexport function CreateHistoricalPayment(props: CreateHistoricalPaymentProps) {\n return (\n <BaseComponent {...props} componentName=\"Contractor.Payments.CreateHistoricalPayment\">\n <Root {...props} />\n </BaseComponent>\n )\n}\n\ninterface ContractorSelection {\n contractorIds: string[]\n checkDate: string\n}\n\nfunction Root({ companyId, dictionary, onEvent }: CreateHistoricalPaymentProps) {\n useI18n('Contractor.Payments.CreateHistoricalPayment')\n useComponentDictionary('Contractor.Payments.CreateHistoricalPayment', dictionary)\n const { t } = useTranslation('Contractor.Payments.CreateHistoricalPayment')\n const { Heading, Text, Button, DatePicker } = useComponentContext()\n\n const { minDate, maxDate } = useMemo(() => getHistoricalPaymentCheckDateBounds(), [])\n const [checkDate, setCheckDate] = useState<Date | null>(null)\n const [selectedIds, setSelectedIds] = useState<string[]>([])\n const [selection, setSelection] = useState<ContractorSelection | null>(null)\n\n let dateError: string | null = null\n if (checkDate !== null && checkDate > maxDate) {\n dateError = t('select.dateInFutureError')\n } else if (checkDate !== null && checkDate < minDate) {\n dateError = t('select.dateTooEarlyError', {\n year: checkDate.getFullYear(),\n allowedYear: minDate.getFullYear(),\n })\n }\n\n const canContinue = selectedIds.length > 0 && checkDate !== null && dateError === null\n\n const handleContinue = () => {\n if (!canContinue) return\n const checkDateString = formatDateToStringDate(checkDate)\n if (!checkDateString) return\n setSelection({ contractorIds: selectedIds, checkDate: checkDateString })\n }\n\n if (!selection) {\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('select.heading')}</Heading>\n <Text variant=\"supporting\">{t('select.subtitle')}</Text>\n </Flex>\n\n <DatePicker\n label={t('select.dateLabel')}\n isRequired\n value={checkDate}\n onChange={setCheckDate}\n minDate={minDate}\n maxDate={maxDate}\n isInvalid={dateError !== null}\n errorMessage={dateError ?? undefined}\n />\n\n <SelectContractors companyId={companyId} onSelectionChange={setSelectedIds} />\n\n <ActionsLayout>\n <Button onClick={handleContinue} variant=\"primary\" isDisabled={!canContinue}>\n {t('select.continueButton')}\n </Button>\n </ActionsLayout>\n </Flex>\n )\n }\n\n return (\n <AmountsAndReview\n companyId={companyId}\n contractorIds={selection.contractorIds}\n checkDate={selection.checkDate}\n onEvent={onEvent}\n />\n )\n}\n\ninterface AmountsAndReviewProps {\n companyId: string\n contractorIds: string[]\n checkDate: string\n onEvent: CreateHistoricalPaymentProps['onEvent']\n}\n\nfunction AmountsAndReview({ companyId, contractorIds, checkDate, onEvent }: AmountsAndReviewProps) {\n const { t } = useTranslation('Contractor.Payments.CreateHistoricalPayment')\n const { Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const { formatLongWithYear } = useDateFormatter()\n const paymentAmountsDictionary = useCreateHistoricalPaymentDictionary()\n const reviewDictionary = useCreateHistoricalPaymentReviewDictionary()\n\n const { data: contractorList } = useContractorsListSuspense({ companyUuid: companyId })\n const contractors = (contractorList.contractors ?? []).filter(contractor =>\n contractorIds.includes(contractor.uuid),\n )\n\n const { virtualContractorPayments, totals, editModal } = usePaymentAmountsEditor({\n contractors,\n allowedPaymentMethods: ALLOWED_PAYMENT_METHODS,\n onEditOpen: () => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_EDIT)\n },\n onEditSave: data => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_UPDATE, data)\n },\n })\n\n const canContinue = totals.total > 0\n\n const { mutateAsync: previewContractorPaymentGroup, isPending: isPreviewing } =\n useContractorPaymentGroupsPreviewMutation()\n const { mutateAsync: createContractorPaymentGroup, isPending: isCreating } =\n useContractorPaymentGroupsCreateMutation()\n\n const [previewData, setPreviewData] = useState<ContractorPaymentGroupPreview | null>(null)\n const [isCreated, setIsCreated] = useState(false)\n\n const touchedContractorPayments = () =>\n virtualContractorPayments\n .filter(payment => payment.isTouched)\n .map(({ isTouched: _isTouched, ...rest }) => rest)\n\n const handleContinue = async () => {\n if (!canContinue) return\n\n await baseSubmitHandler(null, async () => {\n const response = await previewContractorPaymentGroup({\n request: {\n companyId,\n requestBody: {\n checkDate: new RFCDate(checkDate),\n contractorPayments: touchedContractorPayments(),\n },\n },\n })\n setPreviewData(response.contractorPaymentGroupPreview || null)\n onEvent(\n componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_PREVIEW,\n response.contractorPaymentGroupPreview,\n )\n })\n }\n\n const handleBackToEdit = () => {\n setPreviewData(null)\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_BACK_TO_EDIT)\n }\n\n const handleSubmit = async () => {\n const creationToken = previewData?.creationToken\n if (!creationToken || isCreated) return\n\n await baseSubmitHandler(null, async () => {\n const response = await createContractorPaymentGroup({\n request: {\n companyId,\n requestBody: {\n checkDate: new RFCDate(checkDate),\n creationToken,\n contractorPayments: touchedContractorPayments(),\n },\n },\n })\n\n if (!response.contractorPaymentGroup) return\n\n setIsCreated(true)\n onEvent(\n componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_CREATED,\n response.contractorPaymentGroup,\n )\n })\n }\n\n if (previewData) {\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex justifyContent=\"space-between\" alignItems=\"flex-start\" gap={16}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('review.title')}</Heading>\n <Text variant=\"supporting\">\n {t('review.subtitle', {\n checkDate: formatLongWithYear(previewData.checkDate ?? ''),\n })}\n </Text>\n </Flex>\n {!isCreated && (\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Button onClick={handleBackToEdit} variant=\"secondary\">\n {t('review.editButton')}\n </Button>\n <Button onClick={handleSubmit} variant=\"primary\" isLoading={isCreating}>\n {t('review.submitButton')}\n </Button>\n </Flex>\n )}\n </Flex>\n\n {isCreated && (\n <Alert status=\"success\" label={t('review.successTitle')}>\n <Text>{t('review.successMessage')}</Text>\n </Alert>\n )}\n\n <PaymentSummaryBlock\n contractorPaymentGroup={previewData}\n contractors={contractors}\n showDebitColumns={false}\n dictionary={reviewDictionary}\n />\n </Flex>\n )\n }\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('amounts.heading')}</Heading>\n <Text variant=\"supporting\">{t('amounts.subtitle')}</Text>\n </Flex>\n <FlexItem>\n <Button\n onClick={handleContinue}\n variant=\"primary\"\n isDisabled={!canContinue}\n isLoading={isPreviewing}\n >\n {t('amounts.continueButton')}\n </Button>\n </FlexItem>\n </Flex>\n\n <SetPaymentAmounts\n contractors={contractors}\n contractorPayments={virtualContractorPayments}\n totals={totals}\n allowedPaymentMethods={ALLOWED_PAYMENT_METHODS}\n editModal={editModal}\n dictionary={paymentAmountsDictionary}\n />\n </Flex>\n )\n}\n"],"names":["ALLOWED_PAYMENT_METHODS","CreateHistoricalPayment","props","jsx","BaseComponent","Root","companyId","dictionary","onEvent","useI18n","useComponentDictionary","t","useTranslation","Heading","Text","Button","DatePicker","useComponentContext","minDate","maxDate","useMemo","getHistoricalPaymentCheckDateBounds","checkDate","setCheckDate","useState","selectedIds","setSelectedIds","selection","setSelection","dateError","canContinue","handleContinue","checkDateString","formatDateToStringDate","AmountsAndReview","jsxs","Flex","SelectContractors","ActionsLayout","contractorIds","Alert","baseSubmitHandler","useBase","formatLongWithYear","useDateFormatter","paymentAmountsDictionary","useCreateHistoricalPaymentDictionary","reviewDictionary","useCreateHistoricalPaymentReviewDictionary","contractorList","useContractorsListSuspense","contractors","contractor","virtualContractorPayments","totals","editModal","usePaymentAmountsEditor","componentEvents","data","previewContractorPaymentGroup","isPreviewing","useContractorPaymentGroupsPreviewMutation","createContractorPaymentGroup","isCreating","useContractorPaymentGroupsCreateMutation","previewData","setPreviewData","isCreated","setIsCreated","touchedContractorPayments","payment","_isTouched","rest","response","RFCDate","handleBackToEdit","handleSubmit","creationToken","PaymentSummaryBlock","FlexItem","SetPaymentAmounts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAMA,IAAqD,CAAC,oBAAoB;AA0CzE,SAASC,GAAwBC,GAAqC;AAC3E,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GAAO,eAAc,+CACtC,UAAA,gBAAAC,EAACE,IAAA,EAAM,GAAGH,EAAA,CAAO,EAAA,CACnB;AAEJ;AAOA,SAASG,GAAK,EAAE,WAAAC,GAAW,YAAAC,GAAY,SAAAC,KAAyC;AAC9E,EAAAC,GAAQ,6CAA6C,GACrDC,GAAuB,+CAA+CH,CAAU;AAChF,QAAM,EAAE,GAAAI,EAAA,IAAMC,EAAe,6CAA6C,GACpE,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,YAAAC,EAAA,IAAeC,EAAA,GAExC,EAAE,SAAAC,GAAS,SAAAC,EAAA,IAAYC,EAAQ,MAAMC,EAAA,GAAuC,EAAE,GAC9E,CAACC,GAAWC,CAAY,IAAIC,EAAsB,IAAI,GACtD,CAACC,GAAaC,CAAc,IAAIF,EAAmB,CAAA,CAAE,GACrD,CAACG,GAAWC,CAAY,IAAIJ,EAAqC,IAAI;AAE3E,MAAIK,IAA2B;AAC/B,EAAIP,MAAc,QAAQA,IAAYH,IACpCU,IAAYlB,EAAE,0BAA0B,IAC/BW,MAAc,QAAQA,IAAYJ,MAC3CW,IAAYlB,EAAE,4BAA4B;AAAA,IACxC,MAAMW,EAAU,YAAA;AAAA,IAChB,aAAaJ,EAAQ,YAAA;AAAA,EAAY,CAClC;AAGH,QAAMY,IAAcL,EAAY,SAAS,KAAKH,MAAc,QAAQO,MAAc,MAE5EE,IAAiB,MAAM;AAC3B,QAAI,CAACD,EAAa;AAClB,UAAME,IAAkBC,EAAuBX,CAAS;AACxD,IAAKU,KACLJ,EAAa,EAAE,eAAeH,GAAa,WAAWO,GAAi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A,uBAAuBtD;AAAA,QACvB,WAAAuD;AAAA,QACA,YAAYV;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,GACF;AAEJ;"}
1
+ {"version":3,"file":"CreateHistoricalPayment.js","sources":["../../../../../src/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.tsx"],"sourcesContent":["import { useContractorsListSuspense } from '@gusto/embedded-api/react-query/contractorsList'\nimport { useContractorPaymentGroupsPreviewMutation } from '@gusto/embedded-api/react-query/contractorPaymentGroupsPreview'\nimport { useContractorPaymentGroupsCreateMutation } from '@gusto/embedded-api/react-query/contractorPaymentGroupsCreate'\nimport type { ContractorPaymentGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentgrouppreview'\nimport type { PostV1CompaniesCompanyIdContractorPaymentGroupsPaymentMethod as ContractorPaymentMethod } from '@gusto/embedded-api/models/operations/postv1companiescompanyidcontractorpaymentgroups'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useMemo, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport {\n usePaymentAmountsEditor,\n type VirtualContractorPayment,\n} from '../shared/usePaymentAmountsEditor'\nimport { SetPaymentAmounts } from '../shared/SetPaymentAmounts'\nimport { PaymentSummaryBlock } from '../shared/PaymentSummaryBlock'\nimport { getHistoricalPaymentCheckDateBounds } from '../shared/historicalPaymentDateBounds'\nimport {\n useCreateHistoricalPaymentDictionary,\n useCreateHistoricalPaymentReviewDictionary,\n} from './useFormDictionary'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { ActionsLayout, Flex, FlexItem } from '@/components/Common'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { componentEvents } from '@/shared/constants'\nimport { SelectContractors } from '@/components/Contractor/shared/SelectContractors/SelectContractors'\nimport CaretLeftIcon from '@/assets/icons/caret-left.svg?react'\nimport { useUnstableFeature } from '@/contexts/UnstableFeaturesProvider/useUnstableFeature'\n\nconst ALLOWED_PAYMENT_METHODS: ContractorPaymentMethod[] = ['Historical Payment']\n\n/**\n * Props for {@link CreateHistoricalPayment}.\n *\n * @alpha\n */\nexport interface CreateHistoricalPaymentProps extends BaseComponentInterface<'Contractor.Payments.CreateHistoricalPayment'> {\n /** UUID of the company recording the historical payment. */\n companyId: string\n}\n\n/**\n * Records a historical contractor payment — one that already happened outside Gusto and does not\n * move money — by picking a paid date and the contractors being paid, entering hours, wages,\n * bonuses, and reimbursements for them, then reviewing and submitting.\n *\n * @remarks\n * Every contractor payment is fixed to the `Historical Payment` payment method, so there is no\n * payment method choice or debit information to review.\n * Continue on the contractor-selection step is disabled until the paid date is valid and at least\n * one contractor is selected. Continue on the amounts step is disabled until at least one selected\n * contractor has a payment total greater than zero, and swaps the amounts grid for an in-place\n * review (mirroring `CreatePayment`'s preview step); Back returns to the grid without losing\n * entered amounts, and Submit creates the contractor payment group. Once creation succeeds, the\n * Back and Submit buttons are replaced with a success message, since the creation token has been\n * consumed and the host is expected to navigate away (e.g. to `HistoricalPaymentSummary`).\n * The amounts step also has its own Back button, returning to contractor selection without losing\n * the selected paid date, contractors, or any amounts already entered.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/historicalPayments/edit` | The edit modal was opened for a contractor. | — |\n * | `contractor/historicalPayments/update` | A contractor's payment values were updated locally. | The updated form values (hours, wage, bonus, reimbursement, payment method, etc.). |\n * | `contractor/historicalPayments/preview` | The preview API call succeeded. | The contractor payment group preview response. |\n * | `contractor/historicalPayments/backToEdit` | The user returned from preview to continue editing. | — |\n * | `contractor/historicalPayments/created` | The payment group was successfully created. | The created contractor payment group response. |\n *\n * @param props - See {@link CreateHistoricalPaymentProps}.\n * @returns The rendered contractor-selection screen, the payment-amounts entry screen, or its\n * in-place review.\n * @alpha\n */\nexport function CreateHistoricalPayment(props: CreateHistoricalPaymentProps) {\n return (\n <BaseComponent {...props} componentName=\"Contractor.Payments.CreateHistoricalPayment\">\n <Root {...props} />\n </BaseComponent>\n )\n}\n\ninterface ContractorSelection {\n contractorIds: string[]\n checkDate: string\n}\n\nfunction Root({ companyId, dictionary, onEvent }: CreateHistoricalPaymentProps) {\n useUnstableFeature('historicalPayments', { throwIfDisabled: true })\n useI18n('Contractor.Payments.CreateHistoricalPayment')\n useComponentDictionary('Contractor.Payments.CreateHistoricalPayment', dictionary)\n const { t } = useTranslation('Contractor.Payments.CreateHistoricalPayment')\n const { Heading, Text, Button, DatePicker } = useComponentContext()\n\n const { minDate, maxDate } = useMemo(() => getHistoricalPaymentCheckDateBounds(), [])\n const [checkDate, setCheckDate] = useState<Date | null>(null)\n const [selectedIds, setSelectedIds] = useState<string[]>([])\n const [selection, setSelection] = useState<ContractorSelection | null>(null)\n const [savedContractorPayments, setSavedContractorPayments] = useState<\n VirtualContractorPayment[] | undefined\n >(undefined)\n\n let dateError: string | null = null\n if (checkDate !== null && checkDate > maxDate) {\n dateError = t('select.dateInFutureError')\n } else if (checkDate !== null && checkDate < minDate) {\n dateError = t('select.dateTooEarlyError', {\n year: checkDate.getFullYear(),\n allowedYear: minDate.getFullYear(),\n })\n }\n\n const canContinue = selectedIds.length > 0 && checkDate !== null && dateError === null\n\n const handleContinue = () => {\n if (!canContinue) return\n const checkDateString = formatDateToStringDate(checkDate)\n if (!checkDateString) return\n setSelection({ contractorIds: selectedIds, checkDate: checkDateString })\n }\n\n if (!selection) {\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('select.heading')}</Heading>\n <Text variant=\"supporting\">{t('select.subtitle')}</Text>\n </Flex>\n\n <DatePicker\n label={t('select.dateLabel')}\n isRequired\n value={checkDate}\n onChange={setCheckDate}\n minDate={minDate}\n maxDate={maxDate}\n isInvalid={dateError !== null}\n errorMessage={dateError ?? undefined}\n />\n\n <SelectContractors\n companyId={companyId}\n onSelectionChange={setSelectedIds}\n initialSelectedIds={selectedIds}\n />\n\n <ActionsLayout>\n <Button onClick={handleContinue} variant=\"primary\" isDisabled={!canContinue}>\n {t('select.continueButton')}\n </Button>\n </ActionsLayout>\n </Flex>\n )\n }\n\n return (\n <AmountsAndReview\n companyId={companyId}\n contractorIds={selection.contractorIds}\n checkDate={selection.checkDate}\n onEvent={onEvent}\n preservedContractorPayments={savedContractorPayments}\n onBack={payments => {\n setSavedContractorPayments(payments)\n setSelection(null)\n }}\n />\n )\n}\n\ninterface AmountsAndReviewProps {\n companyId: string\n contractorIds: string[]\n checkDate: string\n onEvent: CreateHistoricalPaymentProps['onEvent']\n preservedContractorPayments?: VirtualContractorPayment[]\n onBack: (payments: VirtualContractorPayment[]) => void\n}\n\nfunction AmountsAndReview({\n companyId,\n contractorIds,\n checkDate,\n onEvent,\n preservedContractorPayments,\n onBack,\n}: AmountsAndReviewProps) {\n const { t } = useTranslation('Contractor.Payments.CreateHistoricalPayment')\n const { Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const { formatLongWithYear } = useDateFormatter()\n const paymentAmountsDictionary = useCreateHistoricalPaymentDictionary()\n const reviewDictionary = useCreateHistoricalPaymentReviewDictionary()\n\n const { data: contractorList } = useContractorsListSuspense({ companyUuid: companyId })\n const contractors = (contractorList.contractors ?? []).filter(contractor =>\n contractorIds.includes(contractor.uuid),\n )\n\n const { virtualContractorPayments, totals, editModal } = usePaymentAmountsEditor({\n contractors,\n allowedPaymentMethods: ALLOWED_PAYMENT_METHODS,\n preservedContractorPayments,\n onEditOpen: () => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_EDIT)\n },\n onEditSave: data => {\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_UPDATE, data)\n },\n })\n\n const canContinue = totals.total > 0\n\n const { mutateAsync: previewContractorPaymentGroup, isPending: isPreviewing } =\n useContractorPaymentGroupsPreviewMutation()\n const { mutateAsync: createContractorPaymentGroup, isPending: isCreating } =\n useContractorPaymentGroupsCreateMutation()\n\n const [previewData, setPreviewData] = useState<ContractorPaymentGroupPreview | null>(null)\n const [isCreated, setIsCreated] = useState(false)\n\n const touchedContractorPayments = () =>\n virtualContractorPayments\n .filter(payment => payment.isTouched)\n .map(({ isTouched: _isTouched, ...rest }) => rest)\n\n const handleContinue = async () => {\n if (!canContinue) return\n\n await baseSubmitHandler(null, async () => {\n const response = await previewContractorPaymentGroup({\n request: {\n companyId,\n requestBody: {\n checkDate: new RFCDate(checkDate),\n contractorPayments: touchedContractorPayments(),\n },\n },\n })\n setPreviewData(response.contractorPaymentGroupPreview || null)\n onEvent(\n componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_PREVIEW,\n response.contractorPaymentGroupPreview,\n )\n })\n }\n\n const handleBackToEdit = () => {\n setPreviewData(null)\n onEvent(componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_BACK_TO_EDIT)\n }\n\n const handleSubmit = async () => {\n const creationToken = previewData?.creationToken\n if (!creationToken || isCreated) return\n\n await baseSubmitHandler(null, async () => {\n const response = await createContractorPaymentGroup({\n request: {\n companyId,\n requestBody: {\n checkDate: new RFCDate(checkDate),\n creationToken,\n contractorPayments: touchedContractorPayments(),\n },\n },\n })\n\n if (!response.contractorPaymentGroup) return\n\n setIsCreated(true)\n onEvent(\n componentEvents.CONTRACTOR_HISTORICAL_PAYMENT_CREATED,\n response.contractorPaymentGroup,\n )\n })\n }\n\n if (previewData) {\n return (\n <Flex flexDirection=\"column\" gap={32}>\n {!isCreated && <BackButton onClick={handleBackToEdit} />}\n\n <Flex justifyContent=\"space-between\" alignItems=\"flex-start\" gap={16}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('review.title')}</Heading>\n <Text variant=\"supporting\">\n {t('review.subtitle', {\n checkDate: formatLongWithYear(previewData.checkDate ?? ''),\n })}\n </Text>\n </Flex>\n {!isCreated && (\n <Button onClick={handleSubmit} variant=\"primary\" isLoading={isCreating}>\n {t('review.submitButton')}\n </Button>\n )}\n </Flex>\n\n {isCreated && (\n <Alert status=\"success\" label={t('review.successTitle')}>\n <Text>{t('review.successMessage')}</Text>\n </Alert>\n )}\n\n <PaymentSummaryBlock\n contractorPaymentGroup={previewData}\n contractors={contractors}\n showDebitColumns={false}\n dictionary={reviewDictionary}\n />\n </Flex>\n )\n }\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <BackButton\n onClick={() => {\n onBack(virtualContractorPayments)\n }}\n />\n\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('amounts.heading')}</Heading>\n <Text variant=\"supporting\">{t('amounts.subtitle')}</Text>\n </Flex>\n <FlexItem>\n <Button\n onClick={handleContinue}\n variant=\"primary\"\n isDisabled={!canContinue}\n isLoading={isPreviewing}\n >\n {t('amounts.continueButton')}\n </Button>\n </FlexItem>\n </Flex>\n\n <SetPaymentAmounts\n contractors={contractors}\n contractorPayments={virtualContractorPayments}\n totals={totals}\n allowedPaymentMethods={ALLOWED_PAYMENT_METHODS}\n editModal={editModal}\n dictionary={paymentAmountsDictionary}\n />\n </Flex>\n )\n}\n\nfunction BackButton({ onClick }: { onClick: () => void }) {\n const { t } = useTranslation('Contractor.Payments.CreateHistoricalPayment')\n const { Button } = useComponentContext()\n\n return (\n <Button variant=\"secondary\" icon={<CaretLeftIcon aria-hidden=\"true\" />} onClick={onClick}>\n {t('backButton')}\n </Button>\n )\n}\n"],"names":["ALLOWED_PAYMENT_METHODS","CreateHistoricalPayment","props","jsx","BaseComponent","Root","companyId","dictionary","onEvent","useUnstableFeature","useI18n","useComponentDictionary","t","useTranslation","Heading","Text","Button","DatePicker","useComponentContext","minDate","maxDate","useMemo","getHistoricalPaymentCheckDateBounds","checkDate","setCheckDate","useState","selectedIds","setSelectedIds","selection","setSelection","savedContractorPayments","setSavedContractorPayments","dateError","canContinue","handleContinue","checkDateString","formatDateToStringDate","AmountsAndReview","payments","jsxs","Flex","SelectContractors","ActionsLayout","contractorIds","preservedContractorPayments","onBack","Alert","baseSubmitHandler","useBase","formatLongWithYear","useDateFormatter","paymentAmountsDictionary","useCreateHistoricalPaymentDictionary","reviewDictionary","useCreateHistoricalPaymentReviewDictionary","contractorList","useContractorsListSuspense","contractors","contractor","virtualContractorPayments","totals","editModal","usePaymentAmountsEditor","componentEvents","data","previewContractorPaymentGroup","isPreviewing","useContractorPaymentGroupsPreviewMutation","createContractorPaymentGroup","isCreating","useContractorPaymentGroupsCreateMutation","previewData","setPreviewData","isCreated","setIsCreated","touchedContractorPayments","payment","_isTouched","rest","response","RFCDate","handleBackToEdit","handleSubmit","creationToken","BackButton","PaymentSummaryBlock","FlexItem","SetPaymentAmounts","onClick","CaretLeftIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,IAAqD,CAAC,oBAAoB;AA4CzE,SAASC,GAAwBC,GAAqC;AAC3E,SACE,gBAAAC,EAACC,IAAA,EAAe,GAAGF,GAAO,eAAc,+CACtC,UAAA,gBAAAC,EAACE,IAAA,EAAM,GAAGH,EAAA,CAAO,EAAA,CACnB;AAEJ;AAOA,SAASG,GAAK,EAAE,WAAAC,GAAW,YAAAC,GAAY,SAAAC,KAAyC;AAC9E,EAAAC,GAAmB,sBAAsB,EAAE,iBAAiB,GAAA,CAAM,GAClEC,GAAQ,6CAA6C,GACrDC,GAAuB,+CAA+CJ,CAAU;AAChF,QAAM,EAAE,GAAAK,EAAA,IAAMC,EAAe,6CAA6C,GACpE,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,YAAAC,EAAA,IAAeC,EAAA,GAExC,EAAE,SAAAC,GAAS,SAAAC,EAAA,IAAYC,EAAQ,MAAMC,EAAA,GAAuC,EAAE,GAC9E,CAACC,GAAWC,CAAY,IAAIC,EAAsB,IAAI,GACtD,CAACC,GAAaC,CAAc,IAAIF,EAAmB,CAAA,CAAE,GACr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";
2
- import { useTranslation as C } from "react-i18next";
3
- import { useMemo as j } from "react";
4
- import { getContractorDisplayName as v } from "../../shared/helpers.js";
5
- import { FastAchSubmissionBlockerBanner as P } from "./FastAchSubmissionBlockerBanner.js";
6
- import { GenericBlocker as R } from "./GenericBlocker.js";
1
+ import { jsxs as m, jsx as a } from "react/jsx-runtime";
2
+ import { useTranslation as j } from "react-i18next";
3
+ import { useMemo as v } from "react";
4
+ import { getContractorDisplayName as P } from "../../shared/helpers.js";
5
+ import { getContractorPaymentTotalAmount as f } from "../shared/paymentAmounts.js";
6
+ import { FastAchSubmissionBlockerBanner as R } from "./FastAchSubmissionBlockerBanner.js";
7
+ import { GenericBlocker as L } from "./GenericBlocker.js";
7
8
  import { Flex as u } from "../../../Common/Flex/Flex.js";
8
- import { useComponentContext as L } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
9
- import { useI18n as _ } from "../../../../i18n/I18n.js";
10
- import { formatHoursDisplay as E } from "../../../Payroll/helpers.js";
11
- import F from "../../../../hooks/useNumberFormatter.js";
12
- import { PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES as f } from "../../../../shared/constants.js";
9
+ import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
10
+ import { useI18n as E } from "../../../../i18n/I18n.js";
11
+ import { formatHoursDisplay as F } from "../../../Payroll/helpers.js";
12
+ import I from "../../../../hooks/useNumberFormatter.js";
13
+ import { PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES as p } from "../../../../shared/constants.js";
13
14
  import { DataView as T } from "../../../Common/DataView/DataView.js";
14
- const I = "0.000", X = ({
15
+ const M = "0.000", ee = ({
15
16
  contractorPaymentGroup: n,
16
- contractors: p,
17
- onBackToEdit: h,
18
- onSubmit: A,
17
+ contractors: h,
18
+ onBackToEdit: A,
19
+ onSubmit: D,
19
20
  isLoading: l,
20
- bankAccount: D,
21
+ bankAccount: g,
21
22
  selectedUnblockOptions: d = {},
22
23
  onUnblockOptionChange: b,
23
- paymentSpeed: g
24
+ paymentSpeed: H
24
25
  }) => {
25
- const { Button: c, Text: w, Heading: y, Alert: H } = L();
26
- _("Contractor.Payments.CreatePayment");
27
- const { t } = C("Contractor.Payments.CreatePayment", {
26
+ const { Button: c, Text: w, Heading: y, Alert: N } = _();
27
+ E("Contractor.Payments.CreatePayment");
28
+ const { t } = j("Contractor.Payments.CreatePayment", {
28
29
  keyPrefix: "previewPresentation"
29
- }), a = F(), N = (e) => e.wageType === "Hourly" && e.hourlyRate ? `${a(Number(e.hourlyRate || "0"))}${t("perHour")}` : e.wageType, i = j(
30
+ }), o = I(), B = (e) => e.wageType === "Hourly" && e.hourlyRate ? `${o(Number(e.hourlyRate || "0"))}${t("perHour")}` : e.wageType, i = v(
30
31
  () => n.contractorPayments?.reduce(
31
- (e, r) => (e.wageAmount += Number(r.wage || "0"), e.bonusAmount += Number(r.bonus || "0"), e.reimbursementAmount += Number(r.reimbursement || "0"), e.totalAmount += Number(r.wageTotal || "0"), e),
32
+ (e, r) => (e.wageAmount += Number(r.wage || "0"), e.bonusAmount += Number(r.bonus || "0"), e.reimbursementAmount += Number(r.reimbursement || "0"), e.totalAmount += f(r), e),
32
33
  { wageAmount: 0, bonusAmount: 0, reimbursementAmount: 0, totalAmount: 0 }
33
34
  ),
34
35
  [n.contractorPayments]
35
- ), B = n.contractorPayments || [], s = (n.submissionBlockers || []).filter(
36
+ ), C = n.contractorPayments || [], s = (n.submissionBlockers || []).filter(
36
37
  (e) => e.status === "unresolved"
37
38
  ), S = s.some(
38
- (e) => !f.includes(e.blockerType || "")
39
+ (e) => !p.includes(e.blockerType || "")
39
40
  ), k = s.some(
40
41
  (e) => !d[e.blockerType || ""]
41
42
  ), x = l || s.length > 0 && (S || k);
42
43
  return /* @__PURE__ */ m(u, { flexDirection: "column", gap: 32, children: [
43
44
  /* @__PURE__ */ m(u, { justifyContent: "flex-end", gap: 16, children: [
44
45
  /* @__PURE__ */ m(u, { flexDirection: "column", gap: 2, children: [
45
- /* @__PURE__ */ o(y, { as: "h2", children: t("reviewAndSubmitTitle") }),
46
- /* @__PURE__ */ o(w, { variant: "supporting", children: t("reviewSubtitle", { debitDate: n.debitDate }) })
46
+ /* @__PURE__ */ a(y, { as: "h2", children: t("reviewAndSubmitTitle") }),
47
+ /* @__PURE__ */ a(w, { variant: "supporting", children: t("reviewSubtitle", { debitDate: n.debitDate }) })
47
48
  ] }),
48
49
  /* @__PURE__ */ m(u, { justifyContent: "flex-end", gap: 16, children: [
49
- /* @__PURE__ */ o(c, { onClick: h, variant: "secondary", children: t("editButton") }),
50
- /* @__PURE__ */ o(
50
+ /* @__PURE__ */ a(c, { onClick: A, variant: "secondary", children: t("editButton") }),
51
+ /* @__PURE__ */ a(
51
52
  c,
52
53
  {
53
- onClick: A,
54
+ onClick: D,
54
55
  variant: "primary",
55
56
  isLoading: l,
56
57
  isDisabled: x,
@@ -59,8 +60,8 @@ const I = "0.000", X = ({
59
60
  )
60
61
  ] })
61
62
  ] }),
62
- /* @__PURE__ */ o(
63
- H,
63
+ /* @__PURE__ */ a(
64
+ N,
64
65
  {
65
66
  status: "info",
66
67
  label: t("alerts.submitPaymentsDeadline", {
@@ -71,33 +72,33 @@ const I = "0.000", X = ({
71
72
  ),
72
73
  s.length > 0 && b && s.map((e) => {
73
74
  const r = e.blockerType || "";
74
- return f.includes(r) ? /* @__PURE__ */ o(
75
- P,
75
+ return p.includes(r) ? /* @__PURE__ */ a(
76
+ R,
76
77
  {
77
78
  blocker: e,
78
79
  selectedValue: d[r],
79
80
  onUnblockOptionChange: b,
80
- paymentSpeed: g
81
+ paymentSpeed: H
81
82
  },
82
83
  r
83
- ) : /* @__PURE__ */ o(R, { blocker: e }, r);
84
+ ) : /* @__PURE__ */ a(L, { blocker: e }, r);
84
85
  }),
85
- /* @__PURE__ */ o(y, { as: "h3", children: t("paymentSummaryTitle") }),
86
- /* @__PURE__ */ o(
86
+ /* @__PURE__ */ a(y, { as: "h3", children: t("paymentSummaryTitle") }),
87
+ /* @__PURE__ */ a(
87
88
  T,
88
89
  {
89
90
  columns: [
90
91
  {
91
92
  title: t("summaryTableHeaders.totalAmount"),
92
- render: () => a(Number(n.totals?.amount || "0"))
93
+ render: () => o(Number(n.totals?.amount || "0"))
93
94
  },
94
95
  {
95
96
  title: t("summaryTableHeaders.debitAmount"),
96
- render: () => a(Number(n.totals?.debitAmount || "0"))
97
+ render: () => o(Number(n.totals?.debitAmount || "0"))
97
98
  },
98
99
  {
99
100
  title: t("summaryTableHeaders.debitAccount"),
100
- render: () => D?.hiddenAccountNumber ?? t("naDebitAccount")
101
+ render: () => g?.hiddenAccountNumber ?? t("naDebitAccount")
101
102
  },
102
103
  {
103
104
  title: t("summaryTableHeaders.debitDate"),
@@ -112,21 +113,21 @@ const I = "0.000", X = ({
112
113
  label: "Payment Summary"
113
114
  }
114
115
  ),
115
- /* @__PURE__ */ o(
116
+ /* @__PURE__ */ a(
116
117
  T,
117
118
  {
118
119
  columns: [
119
120
  {
120
121
  title: t("contractorTableHeaders.contractor"),
121
- render: (e) => v(
122
- p.find(
122
+ render: (e) => P(
123
+ h.find(
123
124
  (r) => r.uuid === e.contractorUuid
124
125
  )
125
126
  )
126
127
  },
127
128
  {
128
129
  title: t("contractorTableHeaders.wageType"),
129
- render: (e) => N(e)
130
+ render: (e) => B(e)
130
131
  },
131
132
  {
132
133
  title: t("contractorTableHeaders.paymentMethod"),
@@ -138,37 +139,37 @@ const I = "0.000", X = ({
138
139
  render: (e) => {
139
140
  if (e.wageType === "Fixed") return t("na");
140
141
  const r = Number(e.hours || "0");
141
- return r ? E(r) : I;
142
+ return r ? F(r) : M;
142
143
  }
143
144
  },
144
145
  {
145
146
  title: t("contractorTableHeaders.wage"),
146
147
  justify: "end",
147
- render: (e) => e.wageType === "Hourly" ? t("na") : a(Number(e.wage || "0"))
148
+ render: (e) => e.wageType === "Hourly" ? t("na") : o(Number(e.wage || "0"))
148
149
  },
149
150
  {
150
151
  title: t("contractorTableHeaders.bonus"),
151
152
  justify: "end",
152
- render: (e) => a(Number(e.bonus || "0"))
153
+ render: (e) => o(Number(e.bonus || "0"))
153
154
  },
154
155
  {
155
156
  title: t("contractorTableHeaders.reimbursement"),
156
157
  justify: "end",
157
- render: (e) => a(Number(e.reimbursement || "0"))
158
+ render: (e) => o(Number(e.reimbursement || "0"))
158
159
  },
159
160
  {
160
161
  title: t("contractorTableHeaders.total"),
161
162
  justify: "end",
162
- render: (e) => a(Number(e.wageTotal || "0"))
163
+ render: (e) => o(f(e))
163
164
  }
164
165
  ],
165
- data: B,
166
+ data: C,
166
167
  footer: () => ({
167
168
  "column-0": t("totalsLabel"),
168
- "column-4": a(i?.wageAmount ?? 0),
169
- "column-5": a(i?.bonusAmount ?? 0),
170
- "column-6": a(i?.reimbursementAmount ?? 0),
171
- "column-7": a(i?.totalAmount ?? 0)
169
+ "column-4": o(i?.wageAmount ?? 0),
170
+ "column-5": o(i?.bonusAmount ?? 0),
171
+ "column-6": o(i?.reimbursementAmount ?? 0),
172
+ "column-7": o(i?.totalAmount ?? 0)
172
173
  }),
173
174
  label: t("whatYourCompanyPays")
174
175
  }
@@ -176,6 +177,6 @@ const I = "0.000", X = ({
176
177
  ] });
177
178
  };
178
179
  export {
179
- X as PreviewPresentation
180
+ ee as PreviewPresentation
180
181
  };
181
182
  //# sourceMappingURL=PreviewPresentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewPresentation.js","sources":["../../../../../src/components/Contractor/Payments/CreatePayment/PreviewPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { ContractorPaymentGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentgrouppreview'\nimport type { ContractorPaymentForGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentforgrouppreview'\nimport { useMemo } from 'react'\nimport type { Contractor } from '@gusto/embedded-api/models/components/contractor'\nimport type { CompanyBankAccount } from '@gusto/embedded-api/models/components/companybankaccount'\nimport type { PaymentSpeed } from '@gusto/embedded-api/models/components/paymentconfigs'\nimport { getContractorDisplayName } from '../../shared/helpers'\nimport { FastAchSubmissionBlockerBanner } from './FastAchSubmissionBlockerBanner'\nimport { GenericBlocker } from './GenericBlocker'\nimport { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatHoursDisplay } from '@/components/Payroll/helpers'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES } from '@/shared/constants'\n\nconst ZERO_HOURS_DISPLAY = '0.000'\n\ninterface PreviewPresentationProps {\n contractorPaymentGroup: ContractorPaymentGroupPreview\n contractors: Contractor[]\n onBackToEdit: () => void\n onSubmit: () => void\n isLoading: boolean\n bankAccount?: CompanyBankAccount\n selectedUnblockOptions?: Record<string, string>\n onUnblockOptionChange?: (blockerType: string, value: string) => void\n paymentSpeed?: PaymentSpeed\n}\n\n/** @internal */\nexport const PreviewPresentation = ({\n contractorPaymentGroup,\n contractors,\n onBackToEdit,\n onSubmit,\n isLoading,\n bankAccount,\n selectedUnblockOptions = {},\n onUnblockOptionChange,\n paymentSpeed,\n}: PreviewPresentationProps) => {\n const { Button, Text, Heading, Alert } = useComponentContext()\n useI18n('Contractor.Payments.CreatePayment')\n const { t } = useTranslation('Contractor.Payments.CreatePayment', {\n keyPrefix: 'previewPresentation',\n })\n const currencyFormatter = useNumberFormatter()\n\n const formatWageType = (contractor: ContractorPaymentForGroupPreview) => {\n if (contractor.wageType === 'Hourly' && contractor.hourlyRate) {\n return `${currencyFormatter(Number(contractor.hourlyRate || '0'))}${t('perHour')}`\n }\n return contractor.wageType\n }\n\n const totals = useMemo(\n () =>\n contractorPaymentGroup.contractorPayments?.reduce(\n (acc, contractor) => {\n acc.wageAmount += Number(contractor.wage || '0')\n acc.bonusAmount += Number(contractor.bonus || '0')\n acc.reimbursementAmount += Number(contractor.reimbursement || '0')\n acc.totalAmount += Number(contractor.wageTotal || '0')\n return acc\n },\n { wageAmount: 0, bonusAmount: 0, reimbursementAmount: 0, totalAmount: 0 },\n ),\n [contractorPaymentGroup.contractorPayments],\n )\n\n const contractorPayments = contractorPaymentGroup.contractorPayments || []\n\n const submissionBlockers = (contractorPaymentGroup.submissionBlockers || []).filter(\n blocker => blocker.status === 'unresolved',\n )\n\n const hasUnresolvableBlockers = submissionBlockers.some(\n blocker => !PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blocker.blockerType || ''),\n )\n\n const hasUnselectedBlockers = submissionBlockers.some(\n blocker => !selectedUnblockOptions[blocker.blockerType || ''],\n )\n\n const isSubmitDisabled =\n isLoading ||\n (submissionBlockers.length > 0 && (hasUnresolvableBlockers || hasUnselectedBlockers))\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\">{t('reviewAndSubmitTitle')}</Heading>\n <Text variant=\"supporting\">\n {t('reviewSubtitle', { debitDate: contractorPaymentGroup.debitDate })}\n </Text>\n </Flex>\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Button onClick={onBackToEdit} variant=\"secondary\">\n {t('editButton')}\n </Button>\n <Button\n onClick={onSubmit}\n variant=\"primary\"\n isLoading={isLoading}\n isDisabled={isSubmitDisabled}\n >\n {t('submitButton')}\n </Button>\n </Flex>\n </Flex>\n\n <Alert\n status=\"info\"\n label={t('alerts.submitPaymentsDeadline', {\n checkDate: contractorPaymentGroup.checkDate,\n debitDate: contractorPaymentGroup.debitDate,\n })}\n />\n\n {submissionBlockers.length > 0 &&\n onUnblockOptionChange &&\n submissionBlockers.map(blocker => {\n const blockerType = blocker.blockerType || ''\n\n if (PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blockerType)) {\n return (\n <FastAchSubmissionBlockerBanner\n key={blockerType}\n blocker={blocker}\n selectedValue={selectedUnblockOptions[blockerType]}\n onUnblockOptionChange={onUnblockOptionChange}\n paymentSpeed={paymentSpeed}\n />\n )\n }\n\n return <GenericBlocker key={blockerType} blocker={blocker} />\n })}\n\n {/* Payment Summary */}\n <Heading as=\"h3\">{t('paymentSummaryTitle')}</Heading>\n <DataView\n columns={[\n {\n title: t('summaryTableHeaders.totalAmount'),\n render: () => currencyFormatter(Number(contractorPaymentGroup.totals?.amount || '0')),\n },\n {\n title: t('summaryTableHeaders.debitAmount'),\n render: () =>\n currencyFormatter(Number(contractorPaymentGroup.totals?.debitAmount || '0')),\n },\n {\n title: t('summaryTableHeaders.debitAccount'),\n render: () => bankAccount?.hiddenAccountNumber ?? t('naDebitAccount'),\n },\n {\n title: t('summaryTableHeaders.debitDate'),\n render: () => contractorPaymentGroup.debitDate || 'debitDate',\n },\n {\n title: t('summaryTableHeaders.contractorPayDate'),\n render: () => contractorPaymentGroup.checkDate || 'contractorPayDate',\n },\n ]}\n data={[contractorPaymentGroup]}\n label=\"Payment Summary\"\n />\n\n {/* Contractor Payments Table */}\n <DataView\n columns={[\n {\n title: t('contractorTableHeaders.contractor'),\n render: contractorPayment =>\n getContractorDisplayName(\n contractors.find(\n contractor => contractor.uuid === contractorPayment.contractorUuid,\n ),\n ),\n },\n {\n title: t('contractorTableHeaders.wageType'),\n render: contractorPayment => formatWageType(contractorPayment),\n },\n {\n title: t('contractorTableHeaders.paymentMethod'),\n render: contractorPayment => contractorPayment.paymentMethod || 'N/A',\n },\n {\n title: t('contractorTableHeaders.hours'),\n justify: 'end',\n render: contractorPayment => {\n if (contractorPayment.wageType === 'Fixed') return t('na')\n const hours = Number(contractorPayment.hours || '0')\n return hours ? formatHoursDisplay(hours) : ZERO_HOURS_DISPLAY\n },\n },\n {\n title: t('contractorTableHeaders.wage'),\n justify: 'end',\n render: contractorPayment => {\n if (contractorPayment.wageType === 'Hourly') return t('na')\n return currencyFormatter(Number(contractorPayment.wage || '0'))\n },\n },\n {\n title: t('contractorTableHeaders.bonus'),\n justify: 'end',\n render: contractorPayment => currencyFormatter(Number(contractorPayment.bonus || '0')),\n },\n {\n title: t('contractorTableHeaders.reimbursement'),\n justify: 'end',\n render: contractorPayment =>\n currencyFormatter(Number(contractorPayment.reimbursement || '0')),\n },\n {\n title: t('contractorTableHeaders.total'),\n justify: 'end',\n render: contractorPayment =>\n currencyFormatter(Number(contractorPayment.wageTotal || '0')),\n },\n ]}\n data={contractorPayments}\n footer={() => ({\n 'column-0': t('totalsLabel'),\n 'column-4': currencyFormatter(totals?.wageAmount ?? 0),\n 'column-5': currencyFormatter(totals?.bonusAmount ?? 0),\n 'column-6': currencyFormatter(totals?.reimbursementAmount ?? 0),\n 'column-7': currencyFormatter(totals?.totalAmount ?? 0),\n })}\n label={t('whatYourCompanyPays')}\n />\n </Flex>\n )\n}\n"],"names":["ZERO_HOURS_DISPLAY","PreviewPresentation","contractorPaymentGroup","contractors","onBackToEdit","onSubmit","isLoading","bankAccount","selectedUnblockOptions","onUnblockOptionChange","paymentSpeed","Button","Text","Heading","Alert","useComponentContext","useI18n","useTranslation","currencyFormatter","useNumberFormatter","formatWageType","contractor","totals","useMemo","acc","contractorPayments","submissionBlockers","blocker","hasUnresolvableBlockers","PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES","hasUnselectedBlockers","isSubmitDisabled","jsxs","Flex","jsx","blockerType","FastAchSubmissionBlockerBanner","GenericBlocker","DataView","contractorPayment","getContractorDisplayName","hours","formatHoursDisplay"],"mappings":";;;;;;;;;;;;;AAiBA,MAAMA,IAAqB,SAedC,IAAsB,CAAC;AAAA,EAClC,wBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC,IAAyB,CAAA;AAAA,EACzB,uBAAAC;AAAA,EACA,cAAAC;AACF,MAAgC;AAC9B,QAAM,EAAE,QAAAC,GAAQ,MAAAC,GAAM,SAAAC,GAAS,OAAAC,EAAA,IAAUC,EAAA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GACF;AAEJ;"}
1
+ {"version":3,"file":"PreviewPresentation.js","sources":["../../../../../src/components/Contractor/Payments/CreatePayment/PreviewPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { ContractorPaymentGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentgrouppreview'\nimport type { ContractorPaymentForGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentforgrouppreview'\nimport { useMemo } from 'react'\nimport type { Contractor } from '@gusto/embedded-api/models/components/contractor'\nimport type { CompanyBankAccount } from '@gusto/embedded-api/models/components/companybankaccount'\nimport type { PaymentSpeed } from '@gusto/embedded-api/models/components/paymentconfigs'\nimport { getContractorDisplayName } from '../../shared/helpers'\nimport { getContractorPaymentTotalAmount } from '../shared/paymentAmounts'\nimport { FastAchSubmissionBlockerBanner } from './FastAchSubmissionBlockerBanner'\nimport { GenericBlocker } from './GenericBlocker'\nimport { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatHoursDisplay } from '@/components/Payroll/helpers'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES } from '@/shared/constants'\n\nconst ZERO_HOURS_DISPLAY = '0.000'\n\ninterface PreviewPresentationProps {\n contractorPaymentGroup: ContractorPaymentGroupPreview\n contractors: Contractor[]\n onBackToEdit: () => void\n onSubmit: () => void\n isLoading: boolean\n bankAccount?: CompanyBankAccount\n selectedUnblockOptions?: Record<string, string>\n onUnblockOptionChange?: (blockerType: string, value: string) => void\n paymentSpeed?: PaymentSpeed\n}\n\n/** @internal */\nexport const PreviewPresentation = ({\n contractorPaymentGroup,\n contractors,\n onBackToEdit,\n onSubmit,\n isLoading,\n bankAccount,\n selectedUnblockOptions = {},\n onUnblockOptionChange,\n paymentSpeed,\n}: PreviewPresentationProps) => {\n const { Button, Text, Heading, Alert } = useComponentContext()\n useI18n('Contractor.Payments.CreatePayment')\n const { t } = useTranslation('Contractor.Payments.CreatePayment', {\n keyPrefix: 'previewPresentation',\n })\n const currencyFormatter = useNumberFormatter()\n\n const formatWageType = (contractor: ContractorPaymentForGroupPreview) => {\n if (contractor.wageType === 'Hourly' && contractor.hourlyRate) {\n return `${currencyFormatter(Number(contractor.hourlyRate || '0'))}${t('perHour')}`\n }\n return contractor.wageType\n }\n\n const totals = useMemo(\n () =>\n contractorPaymentGroup.contractorPayments?.reduce(\n (acc, contractor) => {\n acc.wageAmount += Number(contractor.wage || '0')\n acc.bonusAmount += Number(contractor.bonus || '0')\n acc.reimbursementAmount += Number(contractor.reimbursement || '0')\n acc.totalAmount += getContractorPaymentTotalAmount(contractor)\n return acc\n },\n { wageAmount: 0, bonusAmount: 0, reimbursementAmount: 0, totalAmount: 0 },\n ),\n [contractorPaymentGroup.contractorPayments],\n )\n\n const contractorPayments = contractorPaymentGroup.contractorPayments || []\n\n const submissionBlockers = (contractorPaymentGroup.submissionBlockers || []).filter(\n blocker => blocker.status === 'unresolved',\n )\n\n const hasUnresolvableBlockers = submissionBlockers.some(\n blocker => !PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blocker.blockerType || ''),\n )\n\n const hasUnselectedBlockers = submissionBlockers.some(\n blocker => !selectedUnblockOptions[blocker.blockerType || ''],\n )\n\n const isSubmitDisabled =\n isLoading ||\n (submissionBlockers.length > 0 && (hasUnresolvableBlockers || hasUnselectedBlockers))\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\">{t('reviewAndSubmitTitle')}</Heading>\n <Text variant=\"supporting\">\n {t('reviewSubtitle', { debitDate: contractorPaymentGroup.debitDate })}\n </Text>\n </Flex>\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Button onClick={onBackToEdit} variant=\"secondary\">\n {t('editButton')}\n </Button>\n <Button\n onClick={onSubmit}\n variant=\"primary\"\n isLoading={isLoading}\n isDisabled={isSubmitDisabled}\n >\n {t('submitButton')}\n </Button>\n </Flex>\n </Flex>\n\n <Alert\n status=\"info\"\n label={t('alerts.submitPaymentsDeadline', {\n checkDate: contractorPaymentGroup.checkDate,\n debitDate: contractorPaymentGroup.debitDate,\n })}\n />\n\n {submissionBlockers.length > 0 &&\n onUnblockOptionChange &&\n submissionBlockers.map(blocker => {\n const blockerType = blocker.blockerType || ''\n\n if (PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blockerType)) {\n return (\n <FastAchSubmissionBlockerBanner\n key={blockerType}\n blocker={blocker}\n selectedValue={selectedUnblockOptions[blockerType]}\n onUnblockOptionChange={onUnblockOptionChange}\n paymentSpeed={paymentSpeed}\n />\n )\n }\n\n return <GenericBlocker key={blockerType} blocker={blocker} />\n })}\n\n {/* Payment Summary */}\n <Heading as=\"h3\">{t('paymentSummaryTitle')}</Heading>\n <DataView\n columns={[\n {\n title: t('summaryTableHeaders.totalAmount'),\n render: () => currencyFormatter(Number(contractorPaymentGroup.totals?.amount || '0')),\n },\n {\n title: t('summaryTableHeaders.debitAmount'),\n render: () =>\n currencyFormatter(Number(contractorPaymentGroup.totals?.debitAmount || '0')),\n },\n {\n title: t('summaryTableHeaders.debitAccount'),\n render: () => bankAccount?.hiddenAccountNumber ?? t('naDebitAccount'),\n },\n {\n title: t('summaryTableHeaders.debitDate'),\n render: () => contractorPaymentGroup.debitDate || 'debitDate',\n },\n {\n title: t('summaryTableHeaders.contractorPayDate'),\n render: () => contractorPaymentGroup.checkDate || 'contractorPayDate',\n },\n ]}\n data={[contractorPaymentGroup]}\n label=\"Payment Summary\"\n />\n\n {/* Contractor Payments Table */}\n <DataView\n columns={[\n {\n title: t('contractorTableHeaders.contractor'),\n render: contractorPayment =>\n getContractorDisplayName(\n contractors.find(\n contractor => contractor.uuid === contractorPayment.contractorUuid,\n ),\n ),\n },\n {\n title: t('contractorTableHeaders.wageType'),\n render: contractorPayment => formatWageType(contractorPayment),\n },\n {\n title: t('contractorTableHeaders.paymentMethod'),\n render: contractorPayment => contractorPayment.paymentMethod || 'N/A',\n },\n {\n title: t('contractorTableHeaders.hours'),\n justify: 'end',\n render: contractorPayment => {\n if (contractorPayment.wageType === 'Fixed') return t('na')\n const hours = Number(contractorPayment.hours || '0')\n return hours ? formatHoursDisplay(hours) : ZERO_HOURS_DISPLAY\n },\n },\n {\n title: t('contractorTableHeaders.wage'),\n justify: 'end',\n render: contractorPayment => {\n if (contractorPayment.wageType === 'Hourly') return t('na')\n return currencyFormatter(Number(contractorPayment.wage || '0'))\n },\n },\n {\n title: t('contractorTableHeaders.bonus'),\n justify: 'end',\n render: contractorPayment => currencyFormatter(Number(contractorPayment.bonus || '0')),\n },\n {\n title: t('contractorTableHeaders.reimbursement'),\n justify: 'end',\n render: contractorPayment =>\n currencyFormatter(Number(contractorPayment.reimbursement || '0')),\n },\n {\n title: t('contractorTableHeaders.total'),\n justify: 'end',\n render: contractorPayment =>\n currencyFormatter(getContractorPaymentTotalAmount(contractorPayment)),\n },\n ]}\n data={contractorPayments}\n footer={() => ({\n 'column-0': t('totalsLabel'),\n 'column-4': currencyFormatter(totals?.wageAmount ?? 0),\n 'column-5': currencyFormatter(totals?.bonusAmount ?? 0),\n 'column-6': currencyFormatter(totals?.reimbursementAmount ?? 0),\n 'column-7': currencyFormatter(totals?.totalAmount ?? 0),\n })}\n label={t('whatYourCompanyPays')}\n />\n </Flex>\n )\n}\n"],"names":["ZERO_HOURS_DISPLAY","PreviewPresentation","contractorPaymentGroup","contractors","onBackToEdit","onSubmit","isLoading","bankAccount","selectedUnblockOptions","onUnblockOptionChange","paymentSpeed","Button","Text","Heading","Alert","useComponentContext","useI18n","useTranslation","currencyFormatter","useNumberFormatter","formatWageType","contractor","totals","useMemo","acc","getContractorPaymentTotalAmount","contractorPayments","submissionBlockers","blocker","hasUnresolvableBlockers","PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES","hasUnselectedBlockers","isSubmitDisabled","jsxs","Flex","jsx","blockerType","FastAchSubmissionBlockerBanner","GenericBlocker","DataView","contractorPayment","getContractorDisplayName","hours","formatHoursDisplay"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAMA,IAAqB,SAedC,KAAsB,CAAC;AAAA,EAClC,wBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC,IAAyB,CAAA;AAAA,EACzB,uBAAAC;AAAA,EACA,cAAAC;AACF,MAAgC;AAC9B,QAAM,EAAE,QAAAC,GAAQ,MAAAC,GAAM,SAAAC,GAAS,OAAAC,EAAA,IAAUC,EAAA;AACzC,EAAAC,EAAQ,mCAAmC;AAC3C,QAAM,EAAE,EAAA,IAAMC,EAAe,qCAAqC;AAAA,IAChE,WAAW;AAAA,EAAA,CACZ,GACKC,IAAoBC,EAAA,GAEpBC,IAAiB,CAACC,MAClBA,EAAW,aAAa,YAAYA,EAAW,aAC1C,GAAGH,EAAkB,OAAOG,EAAW,cAAc,GAAG,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,KAE3EA,EAAW,UAGdC,IAASC;AAAA,IACb,MACErB,EAAuB,oBAAoB;AAAA,MACzC,CAACsB,GAAKH,OACJG,EAAI,cAAc,OAAOH,EAAW,QAAQ,GAAG,GAC/CG,EAAI,eAAe,OAAOH,EAAW,SAAS,GAAG,GACjDG,EAAI,uBAAuB,OAAOH,EAAW,iBAAiB,GAAG,GACjEG,EAAI,eAAeC,EAAgCJ,CAAU,GACtDG;AAAA,MAET,EAAE,YAAY,GAAG,aAAa,GAAG,qBAAqB,GAAG,aAAa,EAAA;AAAA,IAAE;AAAA,IAE5E,CAACtB,EAAuB,kBAAkB;AAAA,EAAA,GAGtCwB,IAAqBxB,EAAuB,sBAAsB,CAAA,GAElEyB,KAAsBzB,EAAuB,sBAAsB,CAAA,GAAI;AAAA,IAC3E,CA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vC,SAAS;AAAA,YACT,QAAQ,CAAAA,MACNtB,EAAkBO,EAAgCe,CAAiB,CAAC;AAAA,UAAA;AAAA,QACxE;AAAA,QAEF,MAAMd;AAAA,QACN,QAAQ,OAAO;AAAA,UACb,YAAY,EAAE,aAAa;AAAA,UAC3B,YAAYR,EAAkBI,GAAQ,cAAc,CAAC;AAAA,UACrD,YAAYJ,EAAkBI,GAAQ,eAAe,CAAC;AAAA,UACtD,YAAYJ,EAAkBI,GAAQ,uBAAuB,CAAC;AAAA,UAC9D,YAAYJ,EAAkBI,GAAQ,eAAe,CAAC;AAAA,QAAA;AAAA,QAExD,OAAO,EAAE,qBAAqB;AAAA,MAAA;AAAA,IAAA;AAAA,EAChC,GACF;AAEJ;"}
@@ -60,4 +60,4 @@ export declare function CreatePaymentFlow(props: CreatePaymentFlowProps): import
60
60
  *
61
61
  * @internal
62
62
  */
63
- export declare function CreatePaymentInternalFlow({ companyId, onEvent, prefixBreadcrumbs, }: CreatePaymentInternalFlowProps): import("react").JSX.Element;
63
+ export declare function CreatePaymentInternalFlow(props: CreatePaymentInternalFlowProps): import("react").JSX.Element;
@@ -1,24 +1,27 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { createMachine as u } from "robot3";
2
+ import { createMachine as s } from "robot3";
3
3
  import { useState as b } from "react";
4
- import { createPaymentMachine as p, createPaymentBreadcrumbsNodes as d } from "./createPaymentMachine.js";
5
- import { CreatePaymentContextual as f } from "./CreatePaymentFlowComponents.js";
4
+ import { createPaymentBreadcrumbsNodes as d, createPaymentMachine as f } from "./createPaymentMachine.js";
5
+ import { CreatePaymentContextual as p } from "./CreatePaymentFlowComponents.js";
6
6
  import { Flow as y } from "../../../Flow/Flow.js";
7
7
  import { buildBreadcrumbs as P, updateBreadcrumbs as l } from "../../../../helpers/breadcrumbHelpers.js";
8
8
  const B = [];
9
9
  function O(e) {
10
10
  return /* @__PURE__ */ r(C, { ...e });
11
11
  }
12
- function C({
12
+ function C(e) {
13
+ return /* @__PURE__ */ r(h, { ...e }, e.companyId);
14
+ }
15
+ function h({
13
16
  companyId: e,
14
17
  onEvent: a,
15
- prefixBreadcrumbs: m = B
18
+ prefixBreadcrumbs: n = B
16
19
  }) {
17
- const [n] = b(() => {
20
+ const [m] = b(() => {
18
21
  const o = P(d), c = Object.fromEntries(
19
- Object.entries(o).map(([t, s]) => [
22
+ Object.entries(o).map(([t, u]) => [
20
23
  t,
21
- [...m, ...s]
24
+ [...n, ...u]
22
25
  ])
23
26
  ), i = l("createPayment", {
24
27
  header: {
@@ -26,18 +29,18 @@ function C({
26
29
  breadcrumbs: c
27
30
  }
28
31
  });
29
- return u(
32
+ return s(
30
33
  "createPayment",
31
- p,
34
+ f,
32
35
  (t) => ({
33
36
  ...t,
34
37
  ...i,
35
- component: f,
38
+ component: p,
36
39
  companyId: e
37
40
  })
38
41
  );
39
42
  });
40
- return /* @__PURE__ */ r(y, { machine: n, onEvent: a });
43
+ return /* @__PURE__ */ r(y, { machine: m, onEvent: a });
41
44
  }
42
45
  export {
43
46
  O as CreatePaymentFlow,
@@ -1 +1 @@
1
- {"version":3,"file":"CreatePaymentFlow.js","sources":["../../../../../src/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useState } from 'react'\nimport { createPaymentBreadcrumbsNodes, createPaymentMachine } from './createPaymentMachine'\nimport {\n CreatePaymentContextual,\n type CreatePaymentFlowContextInterface,\n type CreatePaymentFlowProps,\n} from './CreatePaymentFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { FlowBreadcrumb } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { buildBreadcrumbs, updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\n\nconst EMPTY_BREADCRUMBS: FlowBreadcrumb[] = []\n\n/**\n * Props for the flow-internal {@link CreatePaymentInternalFlow}, which layers a parent flow's\n * prefix breadcrumbs on top of the public {@link CreatePaymentFlowProps}.\n *\n * @internal\n */\nexport interface CreatePaymentInternalFlowProps extends CreatePaymentFlowProps {\n /**\n * Breadcrumbs prepended to the flow's own breadcrumb trail. Set by a parent flow (e.g.\n * `PaymentFlow`) so the breadcrumb history remains coherent across the handoff.\n */\n prefixBreadcrumbs?: FlowBreadcrumb[]\n}\n\n/**\n * Guided flow to create a contractor payment and review the resulting summary.\n *\n * @remarks\n * This is the inner flow that powers the create-payment spoke of `ContractorManagement.PaymentFlow`.\n * Render it directly when you have built your own payments landing page and want to hand the user\n * off to the standard create-payment experience without re-implementing it. The flow ships with\n * breadcrumb navigation and handles Fast ACH blockers and wire transfer requirements inline.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/payments/created` | Fired when a payment group is successfully created | The created `ContractorPaymentGroup` |\n * | `contractor/payments/exit` | Fired when the user completes the payment flow | `{ uuid?: string \\| null }` |\n * | `payroll/wire/form/done` | Fired when wire transfer details are submitted | `{ wireInRequest: WireInRequest, confirmationAlert: { title: string, content?: string } }` |\n * | `breadcrumb/navigate` | Fired when the user clicks a breadcrumb to navigate back | `{ key: string, onNavigate: (ctx) => ctx }` |\n *\n * @components\n * - {@link CreatePayment}\n * - {@link PaymentSummary}\n *\n * @param props - See {@link CreatePaymentFlowProps}.\n * @returns The composed create-payment flow.\n * @alpha\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { ContractorManagement } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <ContractorManagement.CreatePaymentFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * onEvent={() => {}}\n * />\n * )\n * }\n * ```\n */\nexport function CreatePaymentFlow(props: CreatePaymentFlowProps) {\n return <CreatePaymentInternalFlow {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link CreatePaymentFlow} that additionally accepts\n * flow-injected `prefixBreadcrumbs`. Partners use {@link CreatePaymentFlow}; `PaymentFlow` renders\n * this directly to prepend its own breadcrumb trail.\n *\n * @internal\n */\nexport function CreatePaymentInternalFlow({\n companyId,\n onEvent,\n prefixBreadcrumbs = EMPTY_BREADCRUMBS,\n}: CreatePaymentInternalFlowProps) {\n // Built once via a lazy useState initializer, not useMemo: the machine's identity must survive\n // re-renders no matter what, and useMemo is only a performance hint React may discard, not an\n // identity guarantee. A useMemo keyed on `prefixBreadcrumbs` previously recreated this machine\n // (and reset in-flight state) whenever the parent app re-rendered in response to a bubbled\n // `onEvent` call, since an inline array literal upstream gets a new reference every render.\n const [createPaymentFlow] = useState(() => {\n const baseBreadcrumbs = buildBreadcrumbs(createPaymentBreadcrumbsNodes)\n const breadcrumbs = Object.fromEntries(\n Object.entries(baseBreadcrumbs).map(([stateKey, trail]) => [\n stateKey,\n [...prefixBreadcrumbs, ...trail],\n ]),\n )\n\n const initialBreadcrumbContext = updateBreadcrumbs('createPayment', {\n header: {\n type: 'breadcrumbs' as const,\n breadcrumbs,\n },\n })\n\n return createMachine(\n 'createPayment',\n createPaymentMachine,\n (initialContext: CreatePaymentFlowContextInterface) => ({\n ...initialContext,\n ...initialBreadcrumbContext,\n component: CreatePaymentContextual,\n companyId,\n }),\n )\n })\n\n return <Flow machine={createPaymentFlow} onEvent={onEvent} />\n}\n"],"names":["EMPTY_BREADCRUMBS","CreatePaymentFlow","props","jsx","CreatePaymentInternalFlow","companyId","onEvent","prefixBreadcrumbs","createPaymentFlow","useState","baseBreadcrumbs","buildBreadcrumbs","createPaymentBreadcrumbsNodes","breadcrumbs","stateKey","trail","initialBreadcrumbContext","updateBreadcrumbs","createMachine","createPaymentMachine","initialContext","CreatePaymentContextual","Flow"],"mappings":";;;;;;;AAYA,MAAMA,IAAsC,CAAA;AAuDrC,SAASC,EAAkBC,GAA+B;AAC/D,SAAO,gBAAAC,EAACC,GAAA,EAA2B,GAAGF,EAAA,CAAO;AAC/C;AASO,SAASE,EAA0B;AAAA,EACxC,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,mBAAAC,IAAoBP;AACtB,GAAmC;AAMjC,QAAM,CAACQ,CAAiB,IAAIC,EAAS,MAAM;AACzC,UAAMC,IAAkBC,EAAiBC,CAA6B,GAChEC,IAAc,OAAO;AAAA,MACzB,OAAO,QAAQH,CAAe,EAAE,IAAI,CAAC,CAACI,GAAUC,CAAK,MAAM;AAAA,QACzDD;AAAA,QACA,CAAC,GAAGP,GAAmB,GAAGQ,CAAK;AAAA,MAAA,CAChC;AAAA,IAAA,GAGGC,IAA2BC,EAAkB,iBAAiB;AAAA,MAClE,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,aAAAJ;AAAA,MAAA;AAAA,IACF,CACD;AAED,WAAOK;AAAA,MACL;AAAA,MACAC;AAAA,MACA,CAACC,OAAuD;AAAA,QACtD,GAAGA;AAAA,QACH,GAAGJ;AAAA,QACH,WAAWK;AAAA,QACX,WAAAhB;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,CAAC;AAED,SAAO,gBAAAF,EAACmB,GAAA,EAAK,SAASd,GAAmB,SAAAF,EAAA,CAAkB;AAC7D;"}
1
+ {"version":3,"file":"CreatePaymentFlow.js","sources":["../../../../../src/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useState } from 'react'\nimport { createPaymentBreadcrumbsNodes, createPaymentMachine } from './createPaymentMachine'\nimport {\n CreatePaymentContextual,\n type CreatePaymentFlowContextInterface,\n type CreatePaymentFlowProps,\n} from './CreatePaymentFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { FlowBreadcrumb } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { buildBreadcrumbs, updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\n\nconst EMPTY_BREADCRUMBS: FlowBreadcrumb[] = []\n\n/**\n * Props for the flow-internal {@link CreatePaymentInternalFlow}, which layers a parent flow's\n * prefix breadcrumbs on top of the public {@link CreatePaymentFlowProps}.\n *\n * @internal\n */\nexport interface CreatePaymentInternalFlowProps extends CreatePaymentFlowProps {\n /**\n * Breadcrumbs prepended to the flow's own breadcrumb trail. Set by a parent flow (e.g.\n * `PaymentFlow`) so the breadcrumb history remains coherent across the handoff.\n */\n prefixBreadcrumbs?: FlowBreadcrumb[]\n}\n\n/**\n * Guided flow to create a contractor payment and review the resulting summary.\n *\n * @remarks\n * This is the inner flow that powers the create-payment spoke of `ContractorManagement.PaymentFlow`.\n * Render it directly when you have built your own payments landing page and want to hand the user\n * off to the standard create-payment experience without re-implementing it. The flow ships with\n * breadcrumb navigation and handles Fast ACH blockers and wire transfer requirements inline.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/payments/created` | Fired when a payment group is successfully created | The created `ContractorPaymentGroup` |\n * | `contractor/payments/exit` | Fired when the user completes the payment flow | `{ uuid?: string \\| null }` |\n * | `payroll/wire/form/done` | Fired when wire transfer details are submitted | `{ wireInRequest: WireInRequest, confirmationAlert: { title: string, content?: string } }` |\n * | `breadcrumb/navigate` | Fired when the user clicks a breadcrumb to navigate back | `{ key: string, onNavigate: (ctx) => ctx }` |\n *\n * @components\n * - {@link CreatePayment}\n * - {@link PaymentSummary}\n *\n * @param props - See {@link CreatePaymentFlowProps}.\n * @returns The composed create-payment flow.\n * @alpha\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { ContractorManagement } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <ContractorManagement.CreatePaymentFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * onEvent={() => {}}\n * />\n * )\n * }\n * ```\n */\nexport function CreatePaymentFlow(props: CreatePaymentFlowProps) {\n return <CreatePaymentInternalFlow {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link CreatePaymentFlow} that additionally accepts\n * flow-injected `prefixBreadcrumbs`. Partners use {@link CreatePaymentFlow}; `PaymentFlow` renders\n * this directly to prepend its own breadcrumb trail.\n *\n * @internal\n */\nexport function CreatePaymentInternalFlow(props: CreatePaymentInternalFlowProps) {\n // Remount and reset all state if companyId ever changes\n return <CreatePaymentFlowMachine key={props.companyId} {...props} />\n}\n\nfunction CreatePaymentFlowMachine({\n companyId,\n onEvent,\n prefixBreadcrumbs = EMPTY_BREADCRUMBS,\n}: CreatePaymentInternalFlowProps) {\n // Built once via a lazy useState initializer. If the companyId ever changes,\n // remount the entire component to reset all state, not just the state machine.\n const [createPaymentFlow] = useState(() => {\n const baseBreadcrumbs = buildBreadcrumbs(createPaymentBreadcrumbsNodes)\n const breadcrumbs = Object.fromEntries(\n Object.entries(baseBreadcrumbs).map(([stateKey, trail]) => [\n stateKey,\n [...prefixBreadcrumbs, ...trail],\n ]),\n )\n\n const initialBreadcrumbContext = updateBreadcrumbs('createPayment', {\n header: {\n type: 'breadcrumbs' as const,\n breadcrumbs,\n },\n })\n\n return createMachine(\n 'createPayment',\n createPaymentMachine,\n (initialContext: CreatePaymentFlowContextInterface) => ({\n ...initialContext,\n ...initialBreadcrumbContext,\n component: CreatePaymentContextual,\n companyId,\n }),\n )\n })\n\n return <Flow machine={createPaymentFlow} onEvent={onEvent} />\n}\n"],"names":["EMPTY_BREADCRUMBS","CreatePaymentFlow","props","jsx","CreatePaymentInternalFlow","CreatePaymentFlowMachine","companyId","onEvent","prefixBreadcrumbs","createPaymentFlow","useState","baseBreadcrumbs","buildBreadcrumbs","createPaymentBreadcrumbsNodes","breadcrumbs","stateKey","trail","initialBreadcrumbContext","updateBreadcrumbs","createMachine","createPaymentMachine","initialContext","CreatePaymentContextual","Flow"],"mappings":";;;;;;;AAYA,MAAMA,IAAsC,CAAA;AAuDrC,SAASC,EAAkBC,GAA+B;AAC/D,SAAO,gBAAAC,EAACC,GAAA,EAA2B,GAAGF,EAAA,CAAO;AAC/C;AASO,SAASE,EAA0BF,GAAuC;AAE/E,SAAO,gBAAAC,EAACE,GAAA,EAAgD,GAAGH,EAAA,GAArBA,EAAM,SAAsB;AACpE;AAEA,SAASG,EAAyB;AAAA,EAChC,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,mBAAAC,IAAoBR;AACtB,GAAmC;AAGjC,QAAM,CAACS,CAAiB,IAAIC,EAAS,MAAM;AACzC,UAAMC,IAAkBC,EAAiBC,CAA6B,GAChEC,IAAc,OAAO;AAAA,MACzB,OAAO,QAAQH,CAAe,EAAE,IAAI,CAAC,CAACI,GAAUC,CAAK,MAAM;AAAA,QACzDD;AAAA,QACA,CAAC,GAAGP,GAAmB,GAAGQ,CAAK;AAAA,MAAA,CAChC;AAAA,IAAA,GAGGC,IAA2BC,EAAkB,iBAAiB;AAAA,MAClE,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,aAAAJ;AAAA,MAAA;AAAA,IACF,CACD;AAED,WAAOK;AAAA,MACL;AAAA,MACAC;AAAA,MACA,CAACC,OAAuD;AAAA,QACtD,GAAGA;AAAA,QACH,GAAGJ;AAAA,QACH,WAAWK;AAAA,QACX,WAAAhB;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,CAAC;AAED,SAAO,gBAAAH,EAACoB,GAAA,EAAK,SAASd,GAAmB,SAAAF,EAAA,CAAkB;AAC7D;"}
@@ -0,0 +1,69 @@
1
+ import { HistoricalPaymentFlowProps } from './HistoricalPaymentFlowComponents';
2
+ import { FlowBreadcrumb } from '../../../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes';
3
+ /**
4
+ * Props for the flow-internal {@link HistoricalPaymentInternalFlow}, which layers a parent flow's
5
+ * prefix breadcrumbs on top of the public {@link HistoricalPaymentFlowProps}.
6
+ *
7
+ * @internal
8
+ */
9
+ export interface HistoricalPaymentInternalFlowProps extends HistoricalPaymentFlowProps {
10
+ /**
11
+ * Breadcrumbs prepended to this flow's trail. Set by a parent flow (e.g. `PaymentFlow`) so a
12
+ * user can navigate out of this flow entirely -- this flow contributes no breadcrumb items of
13
+ * its own (each of its own screens has its own Back button instead), so the trail is just
14
+ * `prefixBreadcrumbs` passed straight through.
15
+ */
16
+ prefixBreadcrumbs?: FlowBreadcrumb[];
17
+ }
18
+ /**
19
+ * Guided flow to record a historical contractor payment and review the resulting summary.
20
+ *
21
+ * @remarks
22
+ * This is the inner flow that powers the historical-payment spoke of `ContractorManagement.PaymentFlow`.
23
+ * Render it directly when you have built your own payments landing page and want to hand the user
24
+ * off to the standard historical-payment experience without re-implementing it. A historical payment
25
+ * already happened outside Gusto and does not move money, so unlike `CreatePaymentFlow` there is no
26
+ * Fast ACH blocker or wire-transfer step.
27
+ *
28
+ * @events
29
+ * | Event | Description | Data |
30
+ * | ----- | ----------- | ---- |
31
+ * | `contractor/historicalPayments/edit` | The edit modal was opened for a contractor | — |
32
+ * | `contractor/historicalPayments/update` | A contractor's payment values were updated locally | The updated form values (hours, wage, bonus, reimbursement, payment method, etc.) |
33
+ * | `contractor/historicalPayments/preview` | The preview API call succeeded | The contractor payment group preview response |
34
+ * | `contractor/historicalPayments/backToEdit` | The user returned from preview to continue editing | — |
35
+ * | `contractor/historicalPayments/created` | The payment group was successfully created | The created `ContractorPaymentGroup` |
36
+ * | `contractor/historicalPayments/exit` | User is done reviewing the summary | — |
37
+ * | `breadcrumb/navigate` | Fired when the user clicks a breadcrumb injected via `prefixBreadcrumbs` | `{ key: string, onNavigate: (ctx) => ctx }` |
38
+ *
39
+ * @components
40
+ * - {@link CreateHistoricalPayment}
41
+ * - {@link HistoricalPaymentSummary}
42
+ *
43
+ * @param props - See {@link HistoricalPaymentFlowProps}.
44
+ * @returns The composed historical-payment flow.
45
+ * @alpha
46
+ *
47
+ * @example
48
+ * ```tsx title="App.tsx"
49
+ * import { ContractorManagement } from '@gusto/embedded-react-sdk'
50
+ *
51
+ * function MyApp() {
52
+ * return (
53
+ * <ContractorManagement.HistoricalPaymentFlow
54
+ * companyId="a007e1ab-3595-43c2-ab4b-af7a5af2e365"
55
+ * onEvent={() => {}}
56
+ * />
57
+ * )
58
+ * }
59
+ * ```
60
+ */
61
+ export declare function HistoricalPaymentFlow(props: HistoricalPaymentFlowProps): import("react").JSX.Element;
62
+ /**
63
+ * Flow-internal entry point for {@link HistoricalPaymentFlow} that additionally accepts
64
+ * flow-injected `prefixBreadcrumbs`. Partners use {@link HistoricalPaymentFlow}; `PaymentFlow`
65
+ * renders this directly to give the user a way back to the payments landing screen.
66
+ *
67
+ * @internal
68
+ */
69
+ export declare function HistoricalPaymentInternalFlow(props: HistoricalPaymentInternalFlowProps): import("react").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { createMachine as m } from "robot3";
3
+ import { useState as c } from "react";
4
+ import { historicalPaymentMachine as l } from "./historicalPaymentMachine.js";
5
+ import { CreateHistoricalPaymentContextual as s } from "./HistoricalPaymentFlowComponents.js";
6
+ import { Flow as u } from "../../../Flow/Flow.js";
7
+ import { updateBreadcrumbs as y } from "../../../../helpers/breadcrumbHelpers.js";
8
+ import { useUnstableFeature as P } from "../../../../contexts/UnstableFeaturesProvider/useUnstableFeature.js";
9
+ const f = [];
10
+ function B(t) {
11
+ return /* @__PURE__ */ r(h, { ...t });
12
+ }
13
+ function h(t) {
14
+ return P("historicalPayments", { throwIfDisabled: !0 }), /* @__PURE__ */ r(p, { ...t }, t.companyId);
15
+ }
16
+ function p({
17
+ companyId: t,
18
+ onEvent: a,
19
+ prefixBreadcrumbs: e = f
20
+ }) {
21
+ const [o] = c(() => {
22
+ const i = y("createHistoricalPayment", {
23
+ header: {
24
+ type: "breadcrumbs",
25
+ breadcrumbs: {
26
+ createHistoricalPayment: e,
27
+ historicalPaymentSummary: e
28
+ }
29
+ }
30
+ });
31
+ return m(
32
+ "createHistoricalPayment",
33
+ l,
34
+ (n) => ({
35
+ ...n,
36
+ ...i,
37
+ component: s,
38
+ companyId: t
39
+ })
40
+ );
41
+ });
42
+ return /* @__PURE__ */ r(u, { machine: o, onEvent: a });
43
+ }
44
+ export {
45
+ B as HistoricalPaymentFlow,
46
+ h as HistoricalPaymentInternalFlow
47
+ };
48
+ //# sourceMappingURL=HistoricalPaymentFlow.js.map