@gusto/embedded-react-sdk 0.55.8 → 0.56.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.
- package/CHANGELOG.md +56 -0
- package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +43 -42
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +4 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +4 -3
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js +70 -69
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js +2 -2
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js +51 -42
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js +29 -26
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +2 -2
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +11 -11
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js +3 -3
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +76 -79
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +2 -2
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +2 -2
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js +10 -10
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +49 -45
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlow.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +24 -18
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js +39 -21
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +98 -88
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +64 -60
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +12 -12
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +40 -40
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +205 -185
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js +48 -34
- package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +13 -16
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +0 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js +138 -110
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +149 -146
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +4 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js +22 -35
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +185 -171
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js +45 -34
- package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +44 -44
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.module.scss.js +14 -14
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js +16 -16
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js +52 -37
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlow.js +49 -36
- package/dist/components/Payroll/Transition/TransitionFlow.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js +24 -47
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +1 -1
- package/dist/components/Payroll/Transition/transitionStateMachine.js +35 -40
- package/dist/components/Payroll/Transition/transitionStateMachine.js.map +1 -1
- package/dist/components/Payroll/TransitionPayroll/TransitionPayroll.js +48 -0
- package/dist/components/Payroll/TransitionPayroll/TransitionPayroll.js.map +1 -0
- package/dist/components/Payroll/TransitionPayroll/TransitionPayrollComponents.js +35 -0
- package/dist/components/Payroll/TransitionPayroll/TransitionPayrollComponents.js.map +1 -0
- package/dist/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.js +23 -0
- package/dist/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.js.map +1 -0
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js +32 -0
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js.map +1 -0
- package/dist/components/Payroll/index.js +7 -5
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +9 -8
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +29 -28
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/apiVersionMismatchHook.js +15 -0
- package/dist/contexts/ApiProvider/apiVersionMismatchHook.js.map +1 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ThemeProvider/ThemeProvider.js +32 -26
- package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/hooks/usePollingTask/usePollingTask.js +53 -41
- package/dist/hooks/usePollingTask/usePollingTask.js.map +1 -1
- package/dist/i18n/I18n.js +9 -4
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js +28 -24
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js.map +1 -1
- package/dist/i18n/en/Payroll.GrossUpModal.json.js +12 -10
- package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollBlocker.json.js +10 -8
- package/dist/i18n/en/Payroll.PayrollBlocker.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +8 -8
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +15 -15
- package/dist/i18n/es_US/Company.StateTaxes.json.js +1 -1
- package/dist/i18n/es_US/Contractor.ContractorList.json.js +14 -12
- package/dist/i18n/es_US/Contractor.ContractorList.json.js.map +1 -1
- package/dist/i18n/es_US/Contractor.Management.Compensation.json.js +4 -4
- package/dist/i18n/es_US/Contractor.Management.Profile.json.js +4 -4
- package/dist/i18n/es_US/Contractor.ManagementContractorList.json.js +40 -38
- package/dist/i18n/es_US/Contractor.ManagementContractorList.json.js.map +1 -1
- package/dist/i18n/es_US/Contractor.Payments.PaymentsList.json.js +18 -16
- package/dist/i18n/es_US/Contractor.Payments.PaymentsList.json.js.map +1 -1
- package/dist/i18n/es_US/Contractor.Profile.json.js +5 -5
- package/dist/i18n/es_US/Payroll.OffCycleCreation.json.js +11 -9
- package/dist/i18n/es_US/Payroll.OffCycleCreation.json.js.map +1 -1
- package/dist/i18n/es_US/Payroll.OffCyclePayPeriodDateForm.json.js +2 -2
- package/dist/i18n/es_US/Payroll.OffCycleTaxWithholding.json.js +6 -6
- package/dist/i18n/es_US/Payroll.PayrollConfiguration.json.js +15 -15
- package/dist/i18n/es_US/Payroll.PayrollEditEmployee.json.js +28 -26
- package/dist/i18n/es_US/Payroll.PayrollEditEmployee.json.js.map +1 -1
- package/dist/i18n/es_US/Payroll.PayrollOverview.json.js +40 -38
- package/dist/i18n/es_US/Payroll.PayrollOverview.json.js.map +1 -1
- package/dist/i18n/es_US/Payroll.PrintChecksBanner.json.js +14 -0
- package/dist/i18n/es_US/Payroll.PrintChecksBanner.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.PrintChecksFailure.json.js +12 -0
- package/dist/i18n/es_US/Payroll.PrintChecksFailure.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.PrintChecksForm.json.js +26 -0
- package/dist/i18n/es_US/Payroll.PrintChecksForm.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.PrintChecksSummary.json.js +14 -0
- package/dist/i18n/es_US/Payroll.PrintChecksSummary.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.UNSTABLE_PayrollEditEmployee.json.js +78 -0
- package/dist/i18n/es_US/Payroll.UNSTABLE_PayrollEditEmployee.json.js.map +1 -0
- package/dist/i18n/es_US/common.json.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/shared/constants.js +21 -20
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +1 -1
- package/dist/src/components/Common/UI/DatePicker/DatePickerTypes.d.ts +2 -1
- package/dist/src/components/Common/UI/Menu/MenuTypes.d.ts +1 -1
- package/dist/src/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.d.ts +1 -1
- package/dist/src/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +5 -0
- package/dist/src/components/Common/UI/Select/SelectTypes.d.ts +2 -1
- package/dist/src/components/Employee/EmployeeList/shared/useEmployeeList.d.ts +7 -2
- package/dist/src/components/Employee/EmployeeListFlow/employeeListStateMachine.test.d.ts +1 -0
- package/dist/src/components/Payroll/OffCycle/OffCycleFlow.d.ts +2 -0
- package/dist/src/components/Payroll/OffCycle/OffCycleFlowComponents.d.ts +2 -0
- package/dist/src/components/Payroll/OffCycle/offCycleStateMachine.d.ts +1 -0
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreation.d.ts +1 -0
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +11 -0
- package/dist/src/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollConfiguration/useCalculationPoll.d.ts +6 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.d.ts +18 -0
- package/dist/src/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +8 -0
- package/dist/src/components/Payroll/PayrollFlow/PayrollFlow.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollFlow/TransitionFlowContextual.d.ts +6 -1
- package/dist/src/components/Payroll/PayrollOverview/useSubmissionPoll.d.ts +10 -1
- package/dist/src/components/Payroll/Transition/TransitionFlow.d.ts +17 -15
- package/dist/src/components/Payroll/Transition/TransitionFlowComponents.d.ts +21 -12
- package/dist/src/components/Payroll/Transition/transitionStateMachine.d.ts +25 -4
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayroll.d.ts +55 -0
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayrollComponents.d.ts +24 -0
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayrollTypes.d.ts +23 -0
- package/dist/src/components/Payroll/TransitionPayroll/index.d.ts +2 -0
- package/dist/src/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.d.ts +15 -0
- package/dist/src/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.d.ts +28 -0
- package/dist/src/components/Payroll/index.d.ts +2 -0
- package/dist/src/contexts/ApiProvider/ApiProvider.d.ts +5 -3
- package/dist/src/contexts/ApiProvider/apiVersionMismatchHook.d.ts +3 -0
- package/dist/src/contexts/ApiProvider/apiVersionMismatchHook.test.d.ts +1 -0
- package/dist/src/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +9 -1
- package/dist/src/contexts/ThemeProvider/ThemeProvider.d.ts +8 -3
- package/dist/src/hooks/usePollingTask/usePollingTask.d.ts +55 -14
- package/dist/src/i18n/types.d.ts +20 -0
- package/dist/src/shared/constants.d.ts +2 -0
- package/dist/style.css +1 -1
- package/docs/guides/endpoint-inventory.json +19 -19
- package/package.json +8 -8
|
@@ -1,55 +1,70 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { buildGeneratedDocumentsGetQuery as
|
|
3
|
-
import { useGustoEmbeddedContext as
|
|
4
|
-
import { useQueryClient as
|
|
5
|
-
import { DocumentType as
|
|
6
|
-
import { GeneratedDocumentStatus as
|
|
7
|
-
import { usePollingTask as D } from "../../../../hooks/usePollingTask/usePollingTask.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { useRef as m, useCallback as f } from "react";
|
|
2
|
+
import { buildGeneratedDocumentsGetQuery as p } from "@gusto/embedded-api/react-query/generatedDocumentsGet";
|
|
3
|
+
import { useGustoEmbeddedContext as y } from "@gusto/embedded-api/react-query/_context";
|
|
4
|
+
import { useQueryClient as h } from "@tanstack/react-query";
|
|
5
|
+
import { DocumentType as P } from "@gusto/embedded-api/models/operations/getv1generateddocumentsdocumenttyperequestuuid";
|
|
6
|
+
import { GeneratedDocumentStatus as o } from "@gusto/embedded-api/models/components/generateddocument";
|
|
7
|
+
import { usePollingTask as D, isNonRetryablePollError as g } from "../../../../hooks/usePollingTask/usePollingTask.js";
|
|
8
|
+
import { useObservability as C } from "../../../../contexts/ObservabilityProvider/useObservability.js";
|
|
9
|
+
import { normalizeToSDKError as b } from "../../../../types/sdkError.js";
|
|
10
|
+
const k = "Payroll.PrintChecksForm", E = (e) => e?.generatedDocument?.status === o.Succeeded ? { type: "succeeded", url: e?.generatedDocument?.documentUrls?.[0] ?? null } : { type: "failed" }, v = (e) => {
|
|
11
|
+
if (!e.success)
|
|
12
|
+
return g(e.error) ? { status: "error", error: e.error } : { status: "polling" };
|
|
13
|
+
const r = e.data.generatedDocument?.status;
|
|
14
|
+
return r === o.Succeeded ? {
|
|
15
|
+
status: "done",
|
|
16
|
+
value: { type: "succeeded", url: e.data.generatedDocument?.documentUrls?.[0] ?? null }
|
|
17
|
+
} : r === o.Failed ? { status: "done", value: { type: "failed" } } : { status: "polling" };
|
|
18
|
+
};
|
|
19
|
+
function x({
|
|
20
|
+
onSucceeded: e,
|
|
17
21
|
onFailed: r
|
|
18
22
|
}) {
|
|
19
|
-
const l =
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
23
|
+
const l = y(), i = h(), s = m(null), { observability: c } = C(), d = (t) => {
|
|
24
|
+
const n = s.current;
|
|
25
|
+
if (!n)
|
|
22
26
|
throw new Error("usePollingTask started without a print-checks request in flight");
|
|
23
|
-
return
|
|
24
|
-
...
|
|
27
|
+
return i.fetchQuery({
|
|
28
|
+
...p(
|
|
25
29
|
l,
|
|
26
|
-
{ documentType:
|
|
27
|
-
{ signal:
|
|
30
|
+
{ documentType: P.PrintablePayrollChecks, requestUuid: n },
|
|
31
|
+
{ signal: t }
|
|
28
32
|
),
|
|
29
33
|
staleTime: 0
|
|
30
34
|
});
|
|
31
|
-
},
|
|
32
|
-
if (
|
|
35
|
+
}, u = (t) => {
|
|
36
|
+
if (t.type === "failed") {
|
|
33
37
|
r();
|
|
34
38
|
return;
|
|
35
39
|
}
|
|
36
|
-
t
|
|
37
|
-
}, { start:
|
|
38
|
-
fetch:
|
|
39
|
-
evaluate:
|
|
40
|
-
onDone:
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
e(t.url);
|
|
41
|
+
}, { start: a } = D({
|
|
42
|
+
fetch: d,
|
|
43
|
+
evaluate: v,
|
|
44
|
+
onDone: u,
|
|
45
|
+
// Unlike the payroll polls, print-checks generation has no equivalent to prepare/resubmit to
|
|
46
|
+
// guard against, so a non-retryable read error can safely reuse the same failure path as a
|
|
47
|
+
// real generation failure — same screen, same retry CTA.
|
|
48
|
+
onError: (t) => {
|
|
49
|
+
const n = b(t);
|
|
50
|
+
c?.onError?.({
|
|
51
|
+
...n,
|
|
52
|
+
timestamp: Date.now(),
|
|
53
|
+
componentName: k
|
|
54
|
+
}), r();
|
|
55
|
+
},
|
|
56
|
+
onDeadline: (t) => {
|
|
57
|
+
u(E(t));
|
|
43
58
|
}
|
|
44
59
|
});
|
|
45
|
-
return { start:
|
|
46
|
-
(
|
|
47
|
-
|
|
60
|
+
return { start: f(
|
|
61
|
+
(t) => {
|
|
62
|
+
s.current = t, a();
|
|
48
63
|
},
|
|
49
|
-
[
|
|
64
|
+
[a]
|
|
50
65
|
) };
|
|
51
66
|
}
|
|
52
67
|
export {
|
|
53
|
-
|
|
68
|
+
x as useGenerationPoll
|
|
54
69
|
};
|
|
55
70
|
//# sourceMappingURL=useGenerationPoll.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGenerationPoll.js","sources":["../../../../../src/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.ts"],"sourcesContent":["import { useCallback, useRef } from 'react'\nimport {\n buildGeneratedDocumentsGetQuery,\n type GeneratedDocumentsGetQueryData,\n} from '@gusto/embedded-api/react-query/generatedDocumentsGet'\nimport { useGustoEmbeddedContext } from '@gusto/embedded-api/react-query/_context'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { DocumentType } from '@gusto/embedded-api/models/operations/getv1generateddocumentsdocumenttyperequestuuid'\nimport { GeneratedDocumentStatus } from '@gusto/embedded-api/models/components/generateddocument'\nimport {
|
|
1
|
+
{"version":3,"file":"useGenerationPoll.js","sources":["../../../../../src/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.ts"],"sourcesContent":["import { useCallback, useRef } from 'react'\nimport {\n buildGeneratedDocumentsGetQuery,\n type GeneratedDocumentsGetQueryData,\n} from '@gusto/embedded-api/react-query/generatedDocumentsGet'\nimport { useGustoEmbeddedContext } from '@gusto/embedded-api/react-query/_context'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { DocumentType } from '@gusto/embedded-api/models/operations/getv1generateddocumentsdocumenttyperequestuuid'\nimport { GeneratedDocumentStatus } from '@gusto/embedded-api/models/components/generateddocument'\nimport {\n usePollingTask,\n isNonRetryablePollError,\n type PollReadOutcome,\n type PollTickResult,\n} from '@/hooks/usePollingTask/usePollingTask'\nimport { useObservability } from '@/contexts/ObservabilityProvider/useObservability'\nimport { normalizeToSDKError } from '@/types/sdkError'\n\nconst COMPONENT_NAME = 'Payroll.PrintChecksForm'\n\ntype PrintChecksOutcome = { type: 'succeeded'; url: string | null } | { type: 'failed' }\n\n// Verify against the last-known data before reporting failure: a document that already\n// finished generating must never be reported as a failure just because the deadline hit first.\nconst verifiedPrintChecksOutcome = (\n lastData: GeneratedDocumentsGetQueryData | null,\n): PrintChecksOutcome => {\n const status = lastData?.generatedDocument?.status\n if (status === GeneratedDocumentStatus.Succeeded) {\n return { type: 'succeeded', url: lastData?.generatedDocument?.documentUrls?.[0] ?? null }\n }\n return { type: 'failed' }\n}\n\nconst evaluatePrintChecksOutcome = (\n outcome: PollReadOutcome<GeneratedDocumentsGetQueryData>,\n): PollTickResult<PrintChecksOutcome> => {\n if (!outcome.success) {\n return isNonRetryablePollError(outcome.error)\n ? { status: 'error', error: outcome.error }\n : { status: 'polling' }\n }\n\n const status = outcome.data.generatedDocument?.status\n if (status === GeneratedDocumentStatus.Succeeded) {\n return {\n status: 'done',\n value: { type: 'succeeded', url: outcome.data.generatedDocument?.documentUrls?.[0] ?? null },\n }\n }\n if (status === GeneratedDocumentStatus.Failed) {\n return { status: 'done', value: { type: 'failed' } }\n }\n return { status: 'polling' }\n}\n\n/** @internal */\nexport interface UseGenerationPollOptions {\n onSucceeded: (url: string | null) => void\n onFailed: () => void\n}\n\n/** @internal */\nexport interface GenerationPoll {\n /** Starts polling the generated-document status for `requestUuid`. */\n start: (requestUuid: string) => void\n}\n\n/**\n * Polls a generated print-checks document until it reaches a terminal state, via\n * {@link usePollingTask}.\n *\n * @internal\n */\nexport function useGenerationPoll({\n onSucceeded,\n onFailed,\n}: UseGenerationPollOptions): GenerationPoll {\n const gustoClient = useGustoEmbeddedContext()\n const queryClient = useQueryClient()\n const requestUuidRef = useRef<string | null>(null)\n const { observability } = useObservability()\n\n // Unlike the payroll polls, there's no sibling `useGeneratedDocumentsGet` rendering this data —\n // the result is only ever downloaded, never displayed — so there's no other observer of this\n // queryKey for this fetchQuery call to race against, and no `refetch` to reuse instead.\n const fetchGeneratedDocument = (signal: AbortSignal) => {\n const requestUuid = requestUuidRef.current\n if (!requestUuid) {\n throw new Error('usePollingTask started without a print-checks request in flight')\n }\n return queryClient.fetchQuery({\n ...buildGeneratedDocumentsGetQuery(\n gustoClient,\n { documentType: DocumentType.PrintablePayrollChecks, requestUuid },\n { signal },\n ),\n staleTime: 0,\n })\n }\n\n const handleOutcome = (outcome: PrintChecksOutcome) => {\n if (outcome.type === 'failed') {\n onFailed()\n return\n }\n onSucceeded(outcome.url)\n }\n\n const { start: startPoll } = usePollingTask<GeneratedDocumentsGetQueryData, PrintChecksOutcome>({\n fetch: fetchGeneratedDocument,\n evaluate: evaluatePrintChecksOutcome,\n onDone: handleOutcome,\n // Unlike the payroll polls, print-checks generation has no equivalent to prepare/resubmit to\n // guard against, so a non-retryable read error can safely reuse the same failure path as a\n // real generation failure — same screen, same retry CTA.\n onError: error => {\n const sdkError = normalizeToSDKError(error)\n observability?.onError?.({\n ...sdkError,\n timestamp: Date.now(),\n componentName: COMPONENT_NAME,\n })\n onFailed()\n },\n onDeadline: lastData => {\n handleOutcome(verifiedPrintChecksOutcome(lastData))\n },\n })\n\n const start = useCallback(\n (requestUuid: string) => {\n requestUuidRef.current = requestUuid\n startPoll()\n },\n [startPoll],\n )\n\n return { start }\n}\n"],"names":["COMPONENT_NAME","verifiedPrintChecksOutcome","lastData","GeneratedDocumentStatus","evaluatePrintChecksOutcome","outcome","isNonRetryablePollError","status","useGenerationPoll","onSucceeded","onFailed","gustoClient","useGustoEmbeddedContext","queryClient","useQueryClient","requestUuidRef","useRef","observability","useObservability","fetchGeneratedDocument","signal","requestUuid","buildGeneratedDocumentsGetQuery","DocumentType","handleOutcome","startPoll","usePollingTask","error","sdkError","normalizeToSDKError","useCallback"],"mappings":";;;;;;;;;AAkBA,MAAMA,IAAiB,2BAMjBC,IAA6B,CACjCC,MAEeA,GAAU,mBAAmB,WAC7BC,EAAwB,YAC9B,EAAE,MAAM,aAAa,KAAKD,GAAU,mBAAmB,eAAe,CAAC,KAAK,KAAA,IAE9E,EAAE,MAAM,SAAA,GAGXE,IAA6B,CACjCC,MACuC;AACvC,MAAI,CAACA,EAAQ;AACX,WAAOC,EAAwBD,EAAQ,KAAK,IACxC,EAAE,QAAQ,SAAS,OAAOA,EAAQ,MAAA,IAClC,EAAE,QAAQ,UAAA;AAGhB,QAAME,IAASF,EAAQ,KAAK,mBAAmB;AAC/C,SAAIE,MAAWJ,EAAwB,YAC9B;AAAA,IACL,QAAQ;AAAA,IACR,OAAO,EAAE,MAAM,aAAa,KAAKE,EAAQ,KAAK,mBAAmB,eAAe,CAAC,KAAK,KAAA;AAAA,EAAK,IAG3FE,MAAWJ,EAAwB,SAC9B,EAAE,QAAQ,QAAQ,OAAO,EAAE,MAAM,WAAS,IAE5C,EAAE,QAAQ,UAAA;AACnB;AAoBO,SAASK,EAAkB;AAAA,EAChC,aAAAC;AAAA,EACA,UAAAC;AACF,GAA6C;AAC3C,QAAMC,IAAcC,EAAA,GACdC,IAAcC,EAAA,GACdC,IAAiBC,EAAsB,IAAI,GAC3C,EAAE,eAAAC,EAAA,IAAkBC,EAAA,GAKpBC,IAAyB,CAACC,MAAwB;AACtD,UAAMC,IAAcN,EAAe;AACnC,QAAI,CAACM;AACH,YAAM,IAAI,MAAM,iEAAiE;AAEnF,WAAOR,EAAY,WAAW;AAAA,MAC5B,GAAGS;AAAA,QACDX;AAAA,QACA,EAAE,cAAcY,EAAa,wBAAwB,aAAAF,EAAA;AAAA,QACrD,EAAE,QAAAD,EAAA;AAAA,MAAO;AAAA,MAEX,WAAW;AAAA,IAAA,CACZ;AAAA,EACH,GAEMI,IAAgB,CAACnB,MAAgC;AACrD,QAAIA,EAAQ,SAAS,UAAU;AAC7B,MAAAK,EAAA;AACA;AAAA,IACF;AACA,IAAAD,EAAYJ,EAAQ,GAAG;AAAA,EACzB,GAEM,EAAE,OAAOoB,EAAA,IAAcC,EAAmE;AAAA,IAC9F,OAAOP;AAAA,IACP,UAAUf;AAAA,IACV,QAAQoB;AAAA;AAAA;AAAA;AAAA,IAIR,SAAS,CAAAG,MAAS;AAChB,YAAMC,IAAWC,EAAoBF,CAAK;AAC1C,MAAAV,GAAe,UAAU;AAAA,QACvB,GAAGW;AAAA,QACH,WAAW,KAAK,IAAA;AAAA,QAChB,eAAe5B;AAAA,MAAA,CAChB,GACDU,EAAA;AAAA,IACF;AAAA,IACA,YAAY,CAAAR,MAAY;AACtB,MAAAsB,EAAcvB,EAA2BC,CAAQ,CAAC;AAAA,IACpD;AAAA,EAAA,CACD;AAUD,SAAO,EAAE,OARK4B;AAAA,IACZ,CAACT,MAAwB;AACvB,MAAAN,EAAe,UAAUM,GACzBI,EAAA;AAAA,IACF;AAAA,IACA,CAACA,CAAS;AAAA,EAAA,EAGH;AACX;"}
|
|
@@ -1,42 +1,55 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import { createMachine as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b } from "react";
|
|
3
|
+
import { createMachine as y } from "robot3";
|
|
4
|
+
import { useResolveTransitionPayroll as B } from "../TransitionPayroll/useResolveTransitionPayroll.js";
|
|
5
|
+
import { transitionBreadcrumbsNodes as P, transitionMachine as h } from "./transitionStateMachine.js";
|
|
6
|
+
import { TransitionPayrollContextual as x } from "./TransitionFlowComponents.js";
|
|
7
|
+
import { Flow as T } from "../../Flow/Flow.js";
|
|
8
|
+
import { BaseComponent as v } from "../../Base/Base.js";
|
|
9
|
+
import { useBase as w } from "../../Base/useBase.js";
|
|
10
|
+
import { buildBreadcrumbs as C, updateBreadcrumbs as F } from "../../../helpers/breadcrumbHelpers.js";
|
|
11
|
+
function A(r) {
|
|
12
|
+
return /* @__PURE__ */ i(v, { ...r, children: /* @__PURE__ */ i(M, { ...r }) });
|
|
13
|
+
}
|
|
14
|
+
function M({
|
|
15
|
+
companyId: r,
|
|
16
|
+
startDate: o,
|
|
17
|
+
endDate: t,
|
|
18
|
+
payScheduleUuid: n,
|
|
19
|
+
payrollUuid: a,
|
|
20
|
+
withReimbursements: m = !0
|
|
15
21
|
}) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
const { onEvent: l } = w(), s = B({
|
|
23
|
+
companyId: r,
|
|
24
|
+
startDate: o,
|
|
25
|
+
endDate: t,
|
|
26
|
+
payScheduleUuid: n
|
|
27
|
+
}), e = a ?? s, [c] = b(() => {
|
|
28
|
+
const u = e ? "configuration" : "createTransitionPayroll", f = C(P), d = F(
|
|
29
|
+
u,
|
|
30
|
+
{ header: { type: "breadcrumbs", breadcrumbs: f } },
|
|
31
|
+
{ startDate: o, endDate: t }
|
|
32
|
+
);
|
|
33
|
+
return y(
|
|
34
|
+
"transitionPayroll",
|
|
35
|
+
h,
|
|
36
|
+
(p) => ({
|
|
37
|
+
...p,
|
|
38
|
+
...d,
|
|
39
|
+
component: x,
|
|
40
|
+
companyId: r,
|
|
41
|
+
startDate: o,
|
|
42
|
+
endDate: t,
|
|
43
|
+
payScheduleUuid: n,
|
|
44
|
+
payrollUuid: e,
|
|
45
|
+
withReimbursements: m,
|
|
46
|
+
withOffcyclePayroll: !0
|
|
33
47
|
})
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
);
|
|
37
|
-
return /* @__PURE__ */ u(d, { machine: c, onEvent: a });
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
return /* @__PURE__ */ i(T, { machine: c, onEvent: l });
|
|
38
51
|
}
|
|
39
52
|
export {
|
|
40
|
-
|
|
53
|
+
A as TransitionFlow
|
|
41
54
|
};
|
|
42
55
|
//# sourceMappingURL=TransitionFlow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransitionFlow.js","sources":["../../../../src/components/Payroll/Transition/TransitionFlow.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"TransitionFlow.js","sources":["../../../../src/components/Payroll/Transition/TransitionFlow.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { createMachine } from 'robot3'\nimport { useResolveTransitionPayroll } from '../TransitionPayroll/useResolveTransitionPayroll'\nimport { transitionMachine, transitionBreadcrumbsNodes } from './transitionStateMachine'\nimport {\n TransitionPayrollContextual,\n type TransitionFlowContextInterface,\n type TransitionFlowProps,\n} from './TransitionFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { buildBreadcrumbs, updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\n\n/**\n * Macro flow that runs a transition payroll end to end: resolve or create the payroll, then\n * configure, review, submit, and view receipts.\n *\n * @remarks\n * Renders {@link TransitionPayroll} as its entry step, then routes the events its configuration\n * screen emits into the shared payroll-execution states (overview, edit-employee, receipts,\n * blockers). It owns the breadcrumb chrome and back-navigation, and re-runs the same cached resolve\n * lookup to seed its initial breadcrumb and payroll context.\n *\n * There is no terminal state (SDK-1169). Completion events bubble via `onEvent` for the parent to\n * handle (in `Payroll.PayrollFlow` the parent machine does).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `transition/created` | Fired when the transition payroll is created and the flow advances to configuration | `{ payrollUuid: string }` |\n * | `breadcrumb/navigate` | Fired when the user navigates via the breadcrumb header | `{ key: string }` |\n *\n * All standard run-payroll events are emitted once configuration begins.\n *\n * @components\n * - {@link TransitionPayroll}\n * - {@link PayrollOverview}\n * - {@link PayrollEditEmployee}\n * - {@link PayrollReceipts}\n * - {@link PayrollBlockerList}\n *\n * @param props - See {@link TransitionFlowProps}.\n * @returns The transition payroll flow.\n * @public\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { Payroll, type EventType } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <Payroll.TransitionFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * startDate=\"2025-01-16\"\n * endDate=\"2025-01-31\"\n * payScheduleUuid=\"c75c1ef6-2ec0-4cca-94a5-8b4cf7e5ea21\"\n * onEvent={(eventType: EventType) => {\n * if (eventType === 'runPayroll/submitted') {\n * // Payroll submitted — navigate to your next screen\n * }\n * }}\n * />\n * )\n * }\n * ```\n */\nexport function TransitionFlow(props: TransitionFlowProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({\n companyId,\n startDate,\n endDate,\n payScheduleUuid,\n payrollUuid,\n withReimbursements = true,\n}: TransitionFlowProps) {\n const { onEvent } = useBase()\n\n const resolvedPayrollUuid = useResolveTransitionPayroll({\n companyId,\n startDate,\n endDate,\n payScheduleUuid,\n })\n\n // A caller-supplied payrollUuid wins over the lookup, so a parent that already knows the payroll\n // can skip creation.\n const initialPayrollUuid = payrollUuid ?? resolvedPayrollUuid\n\n // Freeze the machine once. Creating a payroll refetches the resolve query, so recomputing this\n // would re-seat the machine mid-flow. TransitionPayroll freezes the same decision independently.\n const [machine] = useState(() => {\n const initialBreadcrumbId = initialPayrollUuid ? 'configuration' : 'createTransitionPayroll'\n const breadcrumbs = buildBreadcrumbs(transitionBreadcrumbsNodes)\n const initialBreadcrumbContext = updateBreadcrumbs(\n initialBreadcrumbId,\n { header: { type: 'breadcrumbs' as const, breadcrumbs } },\n { startDate, endDate },\n )\n\n return createMachine(\n 'transitionPayroll',\n transitionMachine,\n (initialContext: TransitionFlowContextInterface) => ({\n ...initialContext,\n ...initialBreadcrumbContext,\n component: TransitionPayrollContextual,\n companyId,\n startDate,\n endDate,\n payScheduleUuid,\n payrollUuid: initialPayrollUuid,\n withReimbursements,\n withOffcyclePayroll: true,\n }),\n )\n })\n\n return <Flow machine={machine} onEvent={onEvent} />\n}\n"],"names":["TransitionFlow","props","jsx","BaseComponent","Root","companyId","startDate","endDate","payScheduleUuid","payrollUuid","withReimbursements","onEvent","useBase","resolvedPayrollUuid","useResolveTransitionPayroll","initialPayrollUuid","machine","useState","initialBreadcrumbId","breadcrumbs","buildBreadcrumbs","transitionBreadcrumbsNodes","initialBreadcrumbContext","updateBreadcrumbs","createMachine","transitionMachine","initialContext","TransitionPayrollContextual","Flow"],"mappings":";;;;;;;;;;AAmEO,SAASA,EAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK;AAAA,EACZ,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC,IAAqB;AACvB,GAAwB;AACtB,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAEdC,IAAsBC,EAA4B;AAAA,IACtD,WAAAT;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,iBAAAC;AAAA,EAAA,CACD,GAIKO,IAAqBN,KAAeI,GAIpC,CAACG,CAAO,IAAIC,EAAS,MAAM;AAC/B,UAAMC,IAAsBH,IAAqB,kBAAkB,2BAC7DI,IAAcC,EAAiBC,CAA0B,GACzDC,IAA2BC;AAAA,MAC/BL;AAAA,MACA,EAAE,QAAQ,EAAE,MAAM,eAAwB,aAAAC,IAAY;AAAA,MACtD,EAAE,WAAAb,GAAW,SAAAC,EAAA;AAAA,IAAQ;AAGvB,WAAOiB;AAAA,MACL;AAAA,MACAC;AAAA,MACA,CAACC,OAAoD;AAAA,QACnD,GAAGA;AAAA,QACH,GAAGJ;AAAA,QACH,WAAWK;AAAA,QACX,WAAAtB;AAAA,QACA,WAAAC;AAAA,QACA,SAAAC;AAAA,QACA,iBAAAC;AAAA,QACA,aAAaO;AAAA,QACb,oBAAAL;AAAA,QACA,qBAAqB;AAAA,MAAA;AAAA,IACvB;AAAA,EAEJ,CAAC;AAED,SAAO,gBAAAR,EAAC0B,GAAA,EAAK,SAAAZ,GAAkB,SAAAL,EAAA,CAAkB;AACnD;"}
|
|
@@ -1,54 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { useFlow as d } from "../../Flow/useFlow.js";
|
|
3
|
+
import { ensureRequired as t } from "../../../helpers/ensureRequired.js";
|
|
4
|
+
import { TransitionPayroll as l } from "../TransitionPayroll/TransitionPayroll.js";
|
|
5
|
+
function f() {
|
|
6
|
+
const {
|
|
7
|
+
companyId: e,
|
|
8
|
+
startDate: o,
|
|
9
|
+
endDate: r,
|
|
10
|
+
payScheduleUuid: n,
|
|
11
|
+
payrollUuid: a,
|
|
12
|
+
withReimbursements: i,
|
|
13
|
+
onEvent: m
|
|
14
|
+
} = d();
|
|
15
|
+
return /* @__PURE__ */ u(
|
|
16
|
+
l,
|
|
13
17
|
{
|
|
14
|
-
companyId:
|
|
15
|
-
startDate:
|
|
16
|
-
endDate:
|
|
17
|
-
payScheduleUuid:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
function S() {
|
|
23
|
-
const { companyId: r, payrollUuid: t, onEvent: e, header: n } = s(), o = n?.type === "breadcrumbs" ? n.breadcrumbs?.createTransitionPayroll?.[0] : void 0, u = c(() => o ? [o] : void 0, [o]), d = a(r), m = a(t);
|
|
24
|
-
return /* @__PURE__ */ i(y, { onEvent: e, children: /* @__PURE__ */ i(
|
|
25
|
-
x,
|
|
26
|
-
{
|
|
27
|
-
companyId: d,
|
|
28
|
-
payrollId: m,
|
|
29
|
-
onEvent: e,
|
|
30
|
-
prefixBreadcrumbs: u
|
|
31
|
-
}
|
|
32
|
-
) });
|
|
33
|
-
}
|
|
34
|
-
function x({
|
|
35
|
-
companyId: r,
|
|
36
|
-
payrollId: t,
|
|
37
|
-
...e
|
|
38
|
-
}) {
|
|
39
|
-
const { data: n } = l({ companyId: r, payrollId: t }), o = n.payrollShow?.payPeriod;
|
|
40
|
-
return /* @__PURE__ */ i(
|
|
41
|
-
p,
|
|
42
|
-
{
|
|
43
|
-
companyId: r,
|
|
44
|
-
payrollId: t,
|
|
45
|
-
initialPayPeriod: o,
|
|
46
|
-
...e
|
|
18
|
+
companyId: t(e),
|
|
19
|
+
startDate: t(o),
|
|
20
|
+
endDate: t(r),
|
|
21
|
+
payScheduleUuid: t(n),
|
|
22
|
+
payrollUuid: a,
|
|
23
|
+
withReimbursements: i,
|
|
24
|
+
onEvent: m
|
|
47
25
|
}
|
|
48
26
|
);
|
|
49
27
|
}
|
|
50
28
|
export {
|
|
51
|
-
|
|
52
|
-
S as TransitionExecutionContextual
|
|
29
|
+
f as TransitionPayrollContextual
|
|
53
30
|
};
|
|
54
31
|
//# sourceMappingURL=TransitionFlowComponents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransitionFlowComponents.js","sources":["../../../../src/components/Payroll/Transition/TransitionFlowComponents.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"TransitionFlowComponents.js","sources":["../../../../src/components/Payroll/Transition/TransitionFlowComponents.tsx"],"sourcesContent":["import { TransitionPayroll } from '../TransitionPayroll'\nimport type { PayrollFlowContextInterface } from '../PayrollFlow/PayrollFlowComponents'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\n/**\n * Flow context shape carried through the transition payroll macro state machine.\n *\n * @remarks\n * Extends {@link PayrollFlowContextInterface} so the payroll-execution reducers reused by the\n * transition machine (overview, edit-employee, receipts, blockers) typecheck against a single\n * shared context shape.\n *\n * @internal\n */\nexport interface TransitionFlowContextInterface extends PayrollFlowContextInterface {\n /** Start date of the transition pay period (YYYY-MM-DD). */\n startDate: string\n /** End date of the transition pay period (YYYY-MM-DD). */\n endDate: string\n /** UUID of the pay schedule the transition is associated with. */\n payScheduleUuid: string\n}\n\n/**\n * Props for {@link TransitionFlow}.\n *\n * @public\n */\nexport interface TransitionFlowProps {\n /** Company running the transition payroll. */\n companyId: string\n /** Start date of the transition pay period (YYYY-MM-DD). */\n startDate: string\n /** End date of the transition pay period (YYYY-MM-DD). */\n endDate: string\n /** UUID of the pay schedule the transition is associated with. */\n payScheduleUuid: string\n /**\n * UUID of an existing transition payroll. When provided, the flow skips the lookup and starts on\n * configuration for this payroll. When omitted, it resolves the payroll for the pay period.\n */\n payrollUuid?: string\n /** Whether reimbursement fields are shown throughout the flow. Defaults to `true`. */\n withReimbursements?: boolean\n /** Callback invoked for each event emitted by the flow and its child steps. */\n onEvent: OnEventType<EventType, unknown>\n}\n\n/**\n * Renders {@link TransitionPayroll} as the entry step of {@link TransitionFlow}, wiring its events\n * up to the flow's state machine.\n *\n * @internal\n */\nexport function TransitionPayrollContextual() {\n const {\n companyId,\n startDate,\n endDate,\n payScheduleUuid,\n payrollUuid,\n withReimbursements,\n onEvent,\n } = useFlow<TransitionFlowContextInterface>()\n return (\n <TransitionPayroll\n companyId={ensureRequired(companyId)}\n startDate={ensureRequired(startDate)}\n endDate={ensureRequired(endDate)}\n payScheduleUuid={ensureRequired(payScheduleUuid)}\n payrollUuid={payrollUuid}\n withReimbursements={withReimbursements}\n onEvent={onEvent}\n />\n )\n}\n"],"names":["TransitionPayrollContextual","companyId","startDate","endDate","payScheduleUuid","payrollUuid","withReimbursements","onEvent","useFlow","jsx","TransitionPayroll","ensureRequired"],"mappings":";;;;AAyDO,SAASA,IAA8B;AAC5C,QAAM;AAAA,IACJ,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,IACEC,EAAA;AACJ,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAeV,CAAS;AAAA,MACnC,WAAWU,EAAeT,CAAS;AAAA,MACnC,SAASS,EAAeR,CAAO;AAAA,MAC/B,iBAAiBQ,EAAeP,CAAe;AAAA,MAC/C,aAAAC;AAAA,MACA,oBAAAC;AAAA,MACA,SAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,54 +1,49 @@
|
|
|
1
|
-
import { state as t, transition as n, reduce as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { state as t, transition as n, reduce as i } from "robot3";
|
|
2
|
+
import { payrollExecutionMachine as e, getPayrollExecutionBreadcrumbsNodes as l, calculatedTransition as s, alreadyProcessedTransition as c, employeeEditTransition as d, blockersViewAllTransition as m } from "../PayrollExecutionFlow/payrollExecutionMachine.js";
|
|
3
|
+
import { TransitionPayrollContextual as u } from "./TransitionFlowComponents.js";
|
|
4
|
+
import { componentEvents as p } from "../../../shared/constants.js";
|
|
5
|
+
import { updateBreadcrumbs as y } from "../../../helpers/breadcrumbHelpers.js";
|
|
6
|
+
const r = l(), T = r.configuration, D = {
|
|
7
|
+
// Display-only creation crumb (no `onNavigate`, matching the non-navigable prefix the flow
|
|
8
|
+
// rendered before this refactor).
|
|
6
9
|
createTransitionPayroll: {
|
|
7
10
|
parent: null,
|
|
8
11
|
item: {
|
|
9
12
|
id: "createTransitionPayroll",
|
|
10
13
|
label: "breadcrumbLabel",
|
|
11
|
-
namespace: "Payroll.Transition"
|
|
12
|
-
onNavigate: ((r) => ({
|
|
13
|
-
...a(r, { currentBreadcrumbId: "createTransitionPayroll" }),
|
|
14
|
-
component: i,
|
|
15
|
-
payrollUuid: void 0
|
|
16
|
-
}))
|
|
14
|
+
namespace: "Payroll.Transition"
|
|
17
15
|
}
|
|
16
|
+
},
|
|
17
|
+
...r,
|
|
18
|
+
configuration: {
|
|
19
|
+
...T,
|
|
20
|
+
parent: "createTransitionPayroll"
|
|
18
21
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
),
|
|
33
|
-
e(u)
|
|
22
|
+
}, b = n(
|
|
23
|
+
p.TRANSITION_CREATED,
|
|
24
|
+
"transitionPayroll",
|
|
25
|
+
i(
|
|
26
|
+
(o, a) => ({
|
|
27
|
+
...y("configuration", o, {
|
|
28
|
+
startDate: o.startDate,
|
|
29
|
+
endDate: o.endDate
|
|
30
|
+
}),
|
|
31
|
+
component: u,
|
|
32
|
+
payrollUuid: a.payload?.payrollUuid ?? o.payrollUuid
|
|
33
|
+
})
|
|
34
|
+
)
|
|
34
35
|
), B = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
...a(r, { currentBreadcrumbId: void 0 }),
|
|
42
|
-
payrollUuid: o.payload?.payrollUuid,
|
|
43
|
-
component: d
|
|
44
|
-
})
|
|
45
|
-
)
|
|
46
|
-
)
|
|
36
|
+
transitionPayroll: t(
|
|
37
|
+
b,
|
|
38
|
+
s,
|
|
39
|
+
c,
|
|
40
|
+
d,
|
|
41
|
+
m
|
|
47
42
|
),
|
|
48
|
-
|
|
43
|
+
...e
|
|
49
44
|
};
|
|
50
45
|
export {
|
|
51
|
-
|
|
46
|
+
D as transitionBreadcrumbsNodes,
|
|
52
47
|
B as transitionMachine
|
|
53
48
|
};
|
|
54
49
|
//# sourceMappingURL=transitionStateMachine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitionStateMachine.js","sources":["../../../../src/components/Payroll/Transition/transitionStateMachine.ts"],"sourcesContent":["import { state, transition, reduce
|
|
1
|
+
{"version":3,"file":"transitionStateMachine.js","sources":["../../../../src/components/Payroll/Transition/transitionStateMachine.ts"],"sourcesContent":["import { state, transition, reduce } from 'robot3'\nimport {\n payrollExecutionMachine,\n getPayrollExecutionBreadcrumbsNodes,\n calculatedTransition,\n alreadyProcessedTransition,\n employeeEditTransition,\n blockersViewAllTransition,\n} from '../PayrollExecutionFlow/payrollExecutionMachine'\nimport {\n TransitionPayrollContextual,\n type TransitionFlowContextInterface,\n} from './TransitionFlowComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineTransition } from '@/types/Helpers'\nimport type {\n BreadcrumbNode,\n BreadcrumbNodes,\n} from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\n\nconst executionBreadcrumbsNodes = getPayrollExecutionBreadcrumbsNodes()\nconst sharedConfigurationNode = executionBreadcrumbsNodes.configuration!\n\n/**\n * Breadcrumb nodes for the transition payroll macro flow: the creation crumb merged with the\n * shared payroll-execution crumbs. `configuration` is nested under the creation crumb so the\n * \"Transition Payroll\" crumb persists in the trail once the flow advances past creation, matching\n * the display-only prefix the flow rendered before this refactor.\n *\n * @internal\n */\nexport const transitionBreadcrumbsNodes: BreadcrumbNodes = {\n // Display-only creation crumb (no `onNavigate`, matching the non-navigable prefix the flow\n // rendered before this refactor).\n createTransitionPayroll: {\n parent: null,\n item: {\n id: 'createTransitionPayroll',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.Transition',\n },\n },\n ...executionBreadcrumbsNodes,\n configuration: {\n ...sharedConfigurationNode,\n parent: 'createTransitionPayroll',\n },\n} satisfies Record<string, BreadcrumbNode>\n\n// Records the created payroll's UUID and moves the breadcrumb to configuration, keeping\n// TransitionPayroll mounted so it advances its own screen from creation to configuration.\nconst transitionCreatedTransition = transition(\n componentEvents.TRANSITION_CREATED,\n 'transitionPayroll',\n reduce(\n (\n ctx: TransitionFlowContextInterface,\n ev: { payload?: { payrollUuid?: string } },\n ): TransitionFlowContextInterface => ({\n ...updateBreadcrumbs('configuration', ctx, {\n startDate: ctx.startDate,\n endDate: ctx.endDate,\n }),\n component: TransitionPayrollContextual,\n payrollUuid: ev.payload?.payrollUuid ?? ctx.payrollUuid,\n }),\n ),\n)\n\n/**\n * Macro state machine for {@link TransitionFlow}.\n *\n * @remarks\n * The entry state renders {@link TransitionPayroll}; the rest of the states are the shared\n * {@link payrollExecutionMachine} states, reused via object spread. The entry state reuses that\n * machine's onward transitions so configuration events route into overview / edit-employee /\n * blockers.\n *\n * @internal\n */\nexport const transitionMachine = {\n transitionPayroll: state<MachineTransition>(\n transitionCreatedTransition,\n calculatedTransition,\n alreadyProcessedTransition,\n employeeEditTransition,\n blockersViewAllTransition,\n ),\n ...payrollExecutionMachine,\n}\n"],"names":["executionBreadcrumbsNodes","getPayrollExecutionBreadcrumbsNodes","sharedConfigurationNode","transitionBreadcrumbsNodes","transitionCreatedTransition","transition","componentEvents","reduce","ctx","ev","updateBreadcrumbs","TransitionPayrollContextual","transitionMachine","state","calculatedTransition","alreadyProcessedTransition","employeeEditTransition","blockersViewAllTransition","payrollExecutionMachine"],"mappings":";;;;;AAqBA,MAAMA,IAA4BC,EAAA,GAC5BC,IAA0BF,EAA0B,eAU7CG,IAA8C;AAAA;AAAA;AAAA,EAGzD,yBAAyB;AAAA,IACvB,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,WAAW;AAAA,IAAA;AAAA,EACb;AAAA,EAEF,GAAGH;AAAA,EACH,eAAe;AAAA,IACb,GAAGE;AAAA,IACH,QAAQ;AAAA,EAAA;AAEZ,GAIME,IAA8BC;AAAA,EAClCC,EAAgB;AAAA,EAChB;AAAA,EACAC;AAAA,IACE,CACEC,GACAC,OACoC;AAAA,MACpC,GAAGC,EAAkB,iBAAiBF,GAAK;AAAA,QACzC,WAAWA,EAAI;AAAA,QACf,SAASA,EAAI;AAAA,MAAA,CACd;AAAA,MACD,WAAWG;AAAA,MACX,aAAaF,EAAG,SAAS,eAAeD,EAAI;AAAA,IAAA;AAAA,EAC9C;AAEJ,GAaaI,IAAoB;AAAA,EAC/B,mBAAmBC;AAAA,IACjBT;AAAA,IACAU;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,EAAA;AAAA,EAEF,GAAGC;AACL;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p } from "react";
|
|
3
|
+
import { createMachine as P } from "robot3";
|
|
4
|
+
import { transitionPayrollMachine as x } from "./transitionPayrollStateMachine.js";
|
|
5
|
+
import { PayrollConfigurationContextual as y, TransitionCreationContextual as C } from "./TransitionPayrollComponents.js";
|
|
6
|
+
import { useResolveTransitionPayroll as h } from "./useResolveTransitionPayroll.js";
|
|
7
|
+
import { BaseComponent as g } from "../../Base/Base.js";
|
|
8
|
+
import { useBase as v } from "../../Base/useBase.js";
|
|
9
|
+
import { Flow as B } from "../../Flow/Flow.js";
|
|
10
|
+
function k(o) {
|
|
11
|
+
return /* @__PURE__ */ r(g, { ...o, children: /* @__PURE__ */ r(T, { ...o }) });
|
|
12
|
+
}
|
|
13
|
+
function T({
|
|
14
|
+
companyId: o,
|
|
15
|
+
startDate: n,
|
|
16
|
+
endDate: t,
|
|
17
|
+
payScheduleUuid: i,
|
|
18
|
+
payrollUuid: l,
|
|
19
|
+
withReimbursements: m = !0
|
|
20
|
+
}) {
|
|
21
|
+
const { onEvent: s } = v(), u = h({
|
|
22
|
+
companyId: o,
|
|
23
|
+
startDate: n,
|
|
24
|
+
endDate: t,
|
|
25
|
+
payScheduleUuid: i
|
|
26
|
+
}), e = l ?? u, [c] = p(() => {
|
|
27
|
+
const a = !!e;
|
|
28
|
+
return P(
|
|
29
|
+
a ? "configuration" : "creation",
|
|
30
|
+
x,
|
|
31
|
+
(f) => ({
|
|
32
|
+
...f,
|
|
33
|
+
component: a ? y : C,
|
|
34
|
+
companyId: o,
|
|
35
|
+
startDate: n,
|
|
36
|
+
endDate: t,
|
|
37
|
+
payScheduleUuid: i,
|
|
38
|
+
payrollUuid: e,
|
|
39
|
+
withReimbursements: m
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
return /* @__PURE__ */ r(B, { machine: c, onEvent: s });
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
k as TransitionPayroll
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=TransitionPayroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransitionPayroll.js","sources":["../../../../src/components/Payroll/TransitionPayroll/TransitionPayroll.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { createMachine } from 'robot3'\nimport { transitionPayrollMachine } from './transitionPayrollStateMachine'\nimport {\n TransitionCreationContextual,\n PayrollConfigurationContextual,\n type TransitionPayrollContextInterface,\n} from './TransitionPayrollComponents'\nimport { useResolveTransitionPayroll } from './useResolveTransitionPayroll'\nimport type { TransitionPayrollProps } from './TransitionPayrollTypes'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { Flow } from '@/components/Flow/Flow'\n\n/**\n * Resolves and runs a transition payroll for a pay-schedule change, picking up an existing\n * unprocessed transition payroll when one exists and creating one otherwise.\n *\n * @remarks\n * A transition payroll covers the gap that opens when a company changes its pay schedule. This\n * component looks up whether one already exists for the pay period and picks the starting screen:\n *\n * - If it exists, it starts on {@link PayrollConfiguration} for that payroll.\n * - Otherwise it starts on {@link TransitionCreation}, then advances to {@link PayrollConfiguration}\n * once the payroll is created.\n *\n * Configuration events (calculate, employee edit, blockers, etc.) are emitted through `onEvent` for\n * the host to route. Compose it inside {@link TransitionFlow} for the full run-payroll experience,\n * or handle the events yourself.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `transition/created` | The transition payroll has been created and the flow advances to configuration | `{ payrollUuid: string }` |\n *\n * Once configuration begins, all standard run-payroll events are emitted as well (e.g.\n * `runPayroll/calculated`, `runPayroll/employee/edit`, `runPayroll/blockers/viewAll`).\n *\n * @components\n * - {@link TransitionCreation}\n * - {@link PayrollConfiguration}\n *\n * @param props - See {@link TransitionPayrollProps}.\n * @returns The transition payroll component.\n * @public\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { Payroll, type EventType } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <Payroll.TransitionPayroll\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * startDate=\"2025-01-16\"\n * endDate=\"2025-01-31\"\n * payScheduleUuid=\"c75c1ef6-2ec0-4cca-94a5-8b4cf7e5ea21\"\n * onEvent={(eventType: EventType) => {\n * if (eventType === 'runPayroll/calculated') {\n * // Payroll calculated — navigate to your review screen\n * }\n * }}\n * />\n * )\n * }\n * ```\n */\nexport function TransitionPayroll(props: TransitionPayrollProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({\n companyId,\n startDate,\n endDate,\n payScheduleUuid,\n payrollUuid,\n withReimbursements = true,\n}: TransitionPayrollProps) {\n const { onEvent } = useBase()\n\n const resolvedPayrollUuid = useResolveTransitionPayroll({\n companyId,\n startDate,\n endDate,\n payScheduleUuid,\n })\n\n // A caller-supplied payrollUuid wins over the lookup, so a parent that already knows the payroll\n // can skip creation.\n const initialPayrollUuid = payrollUuid ?? resolvedPayrollUuid\n\n // Freeze the machine once. Creating a payroll refetches the resolve query, so recomputing this\n // would re-seat the machine mid-flow.\n const [machine] = useState(() => {\n const hasExisting = Boolean(initialPayrollUuid)\n return createMachine(\n hasExisting ? 'configuration' : 'creation',\n transitionPayrollMachine,\n (initialContext: TransitionPayrollContextInterface) => ({\n ...initialContext,\n component: hasExisting ? PayrollConfigurationContextual : TransitionCreationContextual,\n companyId,\n startDate,\n endDate,\n payScheduleUuid,\n payrollUuid: initialPayrollUuid,\n withReimbursements,\n }),\n )\n })\n\n return <Flow machine={machine} onEvent={onEvent} />\n}\n"],"names":["TransitionPayroll","props","jsx","BaseComponent","Root","companyId","startDate","endDate","payScheduleUuid","payrollUuid","withReimbursements","onEvent","useBase","resolvedPayrollUuid","useResolveTransitionPayroll","initialPayrollUuid","machine","useState","hasExisting","createMachine","transitionPayrollMachine","initialContext","PayrollConfigurationContextual","TransitionCreationContextual","Flow"],"mappings":";;;;;;;;;AAmEO,SAASA,EAAkBC,GAA+B;AAC/D,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK;AAAA,EACZ,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC,IAAqB;AACvB,GAA2B;AACzB,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAEdC,IAAsBC,EAA4B;AAAA,IACtD,WAAAT;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,iBAAAC;AAAA,EAAA,CACD,GAIKO,IAAqBN,KAAeI,GAIpC,CAACG,CAAO,IAAIC,EAAS,MAAM;AAC/B,UAAMC,IAAc,EAAQH;AAC5B,WAAOI;AAAA,MACLD,IAAc,kBAAkB;AAAA,MAChCE;AAAA,MACA,CAACC,OAAuD;AAAA,QACtD,GAAGA;AAAA,QACH,WAAWH,IAAcI,IAAiCC;AAAA,QAC1D,WAAAlB;AAAA,QACA,WAAAC;AAAA,QACA,SAAAC;AAAA,QACA,iBAAAC;AAAA,QACA,aAAaO;AAAA,QACb,oBAAAL;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,CAAC;AAED,SAAO,gBAAAR,EAACsB,GAAA,EAAK,SAAAR,GAAkB,SAAAL,EAAA,CAAkB;AACnD;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { PayrollConfiguration as m } from "../PayrollConfiguration/PayrollConfiguration.js";
|
|
3
|
+
import { useFlow as i } from "../../Flow/useFlow.js";
|
|
4
|
+
import { ensureRequired as o } from "../../../helpers/ensureRequired.js";
|
|
5
|
+
import { TransitionCreation as p } from "../TransitionCreation/TransitionCreation.js";
|
|
6
|
+
function f() {
|
|
7
|
+
const { companyId: t, startDate: n, endDate: r, payScheduleUuid: e, onEvent: u } = i();
|
|
8
|
+
return /* @__PURE__ */ a(
|
|
9
|
+
p,
|
|
10
|
+
{
|
|
11
|
+
companyId: o(t),
|
|
12
|
+
startDate: o(n),
|
|
13
|
+
endDate: o(r),
|
|
14
|
+
payScheduleUuid: o(e),
|
|
15
|
+
onEvent: u
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
function C() {
|
|
20
|
+
const { companyId: t, payrollUuid: n, onEvent: r, withReimbursements: e } = i();
|
|
21
|
+
return /* @__PURE__ */ a(
|
|
22
|
+
m,
|
|
23
|
+
{
|
|
24
|
+
companyId: o(t),
|
|
25
|
+
payrollId: o(n),
|
|
26
|
+
onEvent: r,
|
|
27
|
+
withReimbursements: e
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
C as PayrollConfigurationContextual,
|
|
33
|
+
f as TransitionCreationContextual
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=TransitionPayrollComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransitionPayrollComponents.js","sources":["../../../../src/components/Payroll/TransitionPayroll/TransitionPayrollComponents.tsx"],"sourcesContent":["import { TransitionCreation } from '../TransitionCreation'\nimport { PayrollConfiguration } from '../PayrollConfiguration/PayrollConfiguration'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\n/**\n * Flow context shape carried through the {@link TransitionPayroll} state machine.\n *\n * @internal\n */\nexport interface TransitionPayrollContextInterface extends FlowContextInterface {\n /** Company the transition payroll belongs to. */\n companyId: string\n /** Start date of the transition pay period (YYYY-MM-DD). */\n startDate: string\n /** End date of the transition pay period (YYYY-MM-DD). */\n endDate: string\n /** UUID of the pay schedule the transition is associated with. */\n payScheduleUuid: string\n /** UUID of the transition payroll once it has been resolved or created. */\n payrollUuid?: string\n /** Whether reimbursement fields are shown on the configuration screen. Defaults to `true`. */\n withReimbursements?: boolean\n}\n\n/** @internal */\nexport function TransitionCreationContextual() {\n const { companyId, startDate, endDate, payScheduleUuid, onEvent } =\n useFlow<TransitionPayrollContextInterface>()\n return (\n <TransitionCreation\n companyId={ensureRequired(companyId)}\n startDate={ensureRequired(startDate)}\n endDate={ensureRequired(endDate)}\n payScheduleUuid={ensureRequired(payScheduleUuid)}\n onEvent={onEvent}\n />\n )\n}\n\n/** @internal */\nexport function PayrollConfigurationContextual() {\n const { companyId, payrollUuid, onEvent, withReimbursements } =\n useFlow<TransitionPayrollContextInterface>()\n return (\n <PayrollConfiguration\n companyId={ensureRequired(companyId)}\n payrollId={ensureRequired(payrollUuid)}\n onEvent={onEvent}\n withReimbursements={withReimbursements}\n />\n )\n}\n"],"names":["TransitionCreationContextual","companyId","startDate","endDate","payScheduleUuid","onEvent","useFlow","jsx","TransitionCreation","ensureRequired","PayrollConfigurationContextual","payrollUuid","withReimbursements","PayrollConfiguration"],"mappings":";;;;;AA0BO,SAASA,IAA+B;AAC7C,QAAM,EAAE,WAAAC,GAAW,WAAAC,GAAW,SAAAC,GAAS,iBAAAC,GAAiB,SAAAC,EAAA,IACtDC,EAAA;AACF,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAeR,CAAS;AAAA,MACnC,WAAWQ,EAAeP,CAAS;AAAA,MACnC,SAASO,EAAeN,CAAO;AAAA,MAC/B,iBAAiBM,EAAeL,CAAe;AAAA,MAC/C,SAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;AAGO,SAASK,IAAiC;AAC/C,QAAM,EAAE,WAAAT,GAAW,aAAAU,GAAa,SAAAN,GAAS,oBAAAO,EAAA,IACvCN,EAAA;AACF,SACE,gBAAAC;AAAA,IAACM;AAAA,IAAA;AAAA,MACC,WAAWJ,EAAeR,CAAS;AAAA,MACnC,WAAWQ,EAAeE,CAAW;AAAA,MACrC,SAAAN;AAAA,MACA,oBAAAO;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|