@gusto/embedded-react-sdk 0.56.4 → 0.56.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/components/Common/DocumentEmbed/DocumentEmbed.js +18 -0
- package/dist/components/Common/DocumentEmbed/DocumentEmbed.js.map +1 -0
- package/dist/components/Common/DocumentViewer/DocumentViewer.js +35 -29
- package/dist/components/Common/DocumentViewer/DocumentViewer.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/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.js +39 -0
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialogPresentation.js +54 -0
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialogPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.js +56 -0
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PaySchedule.js +54 -39
- package/dist/components/Company/PaySchedule/management/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js +48 -32
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js +8 -8
- package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js +74 -32
- package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.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/Contractor/ContractorList/management/ManagementContractorList.js +64 -61
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js +133 -134
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js.map +1 -1
- package/dist/components/Contractor/ContractorListFlow/ContractorListFlow.js.map +1 -1
- package/dist/components/Contractor/ContractorListFlow/ContractorListFlowComponents.js +22 -9
- package/dist/components/Contractor/ContractorListFlow/ContractorListFlowComponents.js.map +1 -1
- package/dist/components/Contractor/ContractorListFlow/contractorListStateMachine.js +51 -20
- package/dist/components/Contractor/ContractorListFlow/contractorListStateMachine.js.map +1 -1
- package/dist/components/Contractor/Dismissal/Dismissal.js +77 -0
- package/dist/components/Contractor/Dismissal/Dismissal.js.map +1 -0
- package/dist/components/Contractor/Dismissal/DismissalPresentation.js +57 -0
- package/dist/components/Contractor/Dismissal/DismissalPresentation.js.map +1 -0
- package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js +44 -0
- package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +17 -14
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +45 -41
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/exports/contractorManagement.js +56 -54
- package/dist/components/Contractor/exports/contractorManagement.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/EmployeeListFlow/EmployeeListFlow.js +27 -16
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js.map +1 -1
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js +25 -17
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js +6 -5
- package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +3 -2
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +201 -196
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js +55 -52
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js +38 -29
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +63 -62
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +25 -18
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js +72 -68
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +3 -2
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/i18n/I18n.js +2 -0
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.Management.AutoPilotDialog.json.js +22 -0
- package/dist/i18n/en/Company.Management.AutoPilotDialog.json.js.map +1 -0
- package/dist/i18n/en/Contractor.Dismissal.json.js +20 -0
- package/dist/i18n/en/Contractor.Dismissal.json.js.map +1 -0
- package/dist/i18n/en/Contractor.Payments.PaymentStatement.json.js +2 -2
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +38 -38
- package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js +31 -31
- package/dist/i18n/en/common.json.js +37 -35
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/shared/constants.js +19 -15
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Common/DocumentEmbed/DocumentEmbed.d.ts +3 -0
- package/dist/src/components/Common/DocumentEmbed/DocumentEmbedTypes.d.ts +25 -0
- package/dist/src/components/Common/DocumentEmbed/index.d.ts +2 -0
- package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.d.ts +11 -0
- package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialogPresentation.d.ts +17 -0
- package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/index.d.ts +1 -0
- package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.d.ts +22 -0
- package/dist/src/components/Company/PaySchedule/management/PaySchedule.d.ts +17 -1
- package/dist/src/components/Company/PaySchedule/management/PayScheduleManagementComponents.d.ts +2 -0
- package/dist/src/components/Company/PaySchedule/management/index.d.ts +1 -1
- package/dist/src/components/Company/exports/companyManagement.d.ts +1 -1
- package/dist/src/components/Contractor/ContractorList/management/ManagementContractorList.d.ts +2 -0
- package/dist/src/components/Contractor/ContractorList/management/ManagementContractorListView.d.ts +3 -1
- package/dist/src/components/Contractor/ContractorListFlow/ContractorListFlow.d.ts +6 -4
- package/dist/src/components/Contractor/ContractorListFlow/ContractorListFlowComponents.d.ts +2 -0
- package/dist/src/components/Contractor/ContractorListFlow/contractorListStateMachine.d.ts +1 -0
- package/dist/src/components/Contractor/ContractorListFlow/contractorListStateMachine.test.d.ts +1 -0
- package/dist/src/components/Contractor/Dismissal/Dismissal.d.ts +45 -0
- package/dist/src/components/Contractor/Dismissal/DismissalPresentation.d.ts +17 -0
- package/dist/src/components/Contractor/Dismissal/useDismissal/useDismissal.d.ts +41 -0
- package/dist/src/components/Contractor/Dismissal/useDismissal/useDismissal.test.d.ts +1 -0
- package/dist/src/components/Contractor/exports/contractorManagement.d.ts +1 -0
- package/dist/src/components/Employee/EmployeeListFlow/EmployeeListFlow.d.ts +1 -1
- package/dist/src/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.d.ts +6 -0
- package/dist/src/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.test.d.ts +1 -0
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.d.ts +19 -0
- package/dist/src/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
- package/dist/src/contexts/ComponentAdapter/useComponentContext.d.ts +5 -2
- package/dist/src/i18n/en/common.json.d.ts +3 -0
- package/dist/src/i18n/types.d.ts +128 -0
- package/dist/src/shared/constants.d.ts +8 -0
- package/docs/guides/endpoint-inventory.json +30 -1
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useState as t } from "react";
|
|
2
|
+
import { usePaySchedulesGet as h } from "@gusto/embedded-api/react-query/paySchedulesGet";
|
|
3
|
+
import { usePaySchedulesUpdateMutation as A } from "@gusto/embedded-api/react-query/paySchedulesUpdate";
|
|
4
|
+
import { componentEvents as r } from "../../../../../shared/constants.js";
|
|
5
|
+
import { normalizeToSDKError as g } from "../../../../../types/sdkError.js";
|
|
6
|
+
function O({ companyId: n, schedule: e, onEvent: a }) {
|
|
7
|
+
const [o, S] = t(!!e.autoPayroll), [E, l] = t(!1), [d, i] = t(), { mutateAsync: P, isPending: _ } = A(), s = !e.autoPayroll, {
|
|
8
|
+
data: m,
|
|
9
|
+
isLoading: u,
|
|
10
|
+
isError: y
|
|
11
|
+
} = h(
|
|
12
|
+
{ companyId: n, payScheduleId: e.uuid },
|
|
13
|
+
{ enabled: s }
|
|
14
|
+
), c = m?.payScheduleShow?.autoPayrollEnablementBlockers ?? [], D = s && (u || y || c.length > 0), p = o !== !!e.autoPayroll;
|
|
15
|
+
return {
|
|
16
|
+
nextEnabled: o,
|
|
17
|
+
setNextEnabled: S,
|
|
18
|
+
blockers: c,
|
|
19
|
+
isEnableBlocked: D,
|
|
20
|
+
isLoadingBlockers: s && u,
|
|
21
|
+
isSaving: _,
|
|
22
|
+
hasGenericError: E,
|
|
23
|
+
errorMessage: d,
|
|
24
|
+
onSave: async () => {
|
|
25
|
+
if (!p) {
|
|
26
|
+
a(r.PAY_SCHEDULE_AUTO_PILOT_DISMISSED, null);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
l(!1), i(void 0);
|
|
30
|
+
try {
|
|
31
|
+
await P({
|
|
32
|
+
request: {
|
|
33
|
+
companyId: n,
|
|
34
|
+
payScheduleId: e.uuid,
|
|
35
|
+
payScheduleUpdateRequest: {
|
|
36
|
+
version: e.version,
|
|
37
|
+
autoPayroll: o
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}), a(
|
|
41
|
+
o ? r.PAY_SCHEDULE_AUTO_PILOT_ENABLED : r.PAY_SCHEDULE_AUTO_PILOT_DISABLED,
|
|
42
|
+
null
|
|
43
|
+
);
|
|
44
|
+
} catch (L) {
|
|
45
|
+
i(g(L).fieldErrors[0]?.message), l(!0);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
onClose: () => {
|
|
49
|
+
a(r.PAY_SCHEDULE_AUTO_PILOT_DISMISSED, null);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
O as useAutoPilotDialog
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=useAutoPilotDialog.js.map
|
package/dist/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoPilotDialog.js","sources":["../../../../../../src/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.ts"],"sourcesContent":["import { useState } from 'react'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport { usePaySchedulesUpdateMutation } from '@gusto/embedded-api/react-query/paySchedulesUpdate'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { normalizeToSDKError } from '@/types/sdkError'\n\ninterface UseAutoPilotDialogProps {\n companyId: string\n schedule: PayScheduleShow\n onEvent: OnEventType<EventType, unknown>\n}\n\n/** @internal */\nexport function useAutoPilotDialog({ companyId, schedule, onEvent }: UseAutoPilotDialogProps) {\n const [nextEnabled, setNextEnabled] = useState(Boolean(schedule.autoPayroll))\n const [hasGenericError, setHasGenericError] = useState(false)\n const [errorMessage, setErrorMessage] = useState<string | undefined>()\n const { mutateAsync: updatePaySchedule, isPending: isSaving } = usePaySchedulesUpdateMutation()\n\n // The list call never returns `autoPayrollEnablementBlockers` -- only the show call does.\n // Blockers only gate enabling, so skip the fetch entirely when the schedule is already on.\n const shouldCheckBlockers = !schedule.autoPayroll\n const {\n data: scheduleDetails,\n isLoading: isLoadingBlockers,\n isError: hasBlockersError,\n } = usePaySchedulesGet(\n { companyId, payScheduleId: schedule.uuid },\n { enabled: shouldCheckBlockers },\n )\n\n const blockers = scheduleDetails?.payScheduleShow?.autoPayrollEnablementBlockers ?? []\n // Named blockers only gate enabling; a schedule already enabled can always be disabled.\n // A failed eligibility check also blocks enabling -- we can't confirm blockers are clear,\n // so default to the safe outcome instead of letting the user bypass an unchecked blocker.\n const isEnableBlocked =\n shouldCheckBlockers && (isLoadingBlockers || hasBlockersError || blockers.length > 0)\n\n const hasChanges = nextEnabled !== Boolean(schedule.autoPayroll)\n\n const onSave = async () => {\n if (!hasChanges) {\n onEvent(componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISMISSED, null)\n return\n }\n\n setHasGenericError(false)\n setErrorMessage(undefined)\n\n try {\n await updatePaySchedule({\n request: {\n companyId,\n payScheduleId: schedule.uuid,\n payScheduleUpdateRequest: {\n version: schedule.version,\n autoPayroll: nextEnabled,\n },\n },\n })\n onEvent(\n nextEnabled\n ? componentEvents.PAY_SCHEDULE_AUTO_PILOT_ENABLED\n : componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISABLED,\n null,\n )\n } catch (err) {\n // The API returns this as a single error keyed `auto_payroll` with a human-readable\n // message (e.g. which blocker tripped). Fall back to the canned copy only when the\n // error can't be parsed into that shape at all.\n setErrorMessage(normalizeToSDKError(err).fieldErrors[0]?.message)\n setHasGenericError(true)\n }\n }\n\n const onClose = () => {\n onEvent(componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISMISSED, null)\n }\n\n return {\n nextEnabled,\n setNextEnabled,\n blockers,\n isEnableBlocked,\n isLoadingBlockers: shouldCheckBlockers && isLoadingBlockers,\n isSaving,\n hasGenericError,\n errorMessage,\n onSave,\n onClose,\n }\n}\n"],"names":["useAutoPilotDialog","companyId","schedule","onEvent","nextEnabled","setNextEnabled","useState","hasGenericError","setHasGenericError","errorMessage","setErrorMessage","updatePaySchedule","isSaving","usePaySchedulesUpdateMutation","shouldCheckBlockers","scheduleDetails","isLoadingBlockers","hasBlockersError","usePaySchedulesGet","blockers","isEnableBlocked","hasChanges","componentEvents","err","normalizeToSDKError"],"mappings":";;;;;AAeO,SAASA,EAAmB,EAAE,WAAAC,GAAW,UAAAC,GAAU,SAAAC,KAAoC;AAC5F,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAAS,EAAQJ,EAAS,WAAY,GACtE,CAACK,GAAiBC,CAAkB,IAAIF,EAAS,EAAK,GACtD,CAACG,GAAcC,CAAe,IAAIJ,EAAA,GAClC,EAAE,aAAaK,GAAmB,WAAWC,EAAA,IAAaC,EAAA,GAI1DC,IAAsB,CAACZ,EAAS,aAChC;AAAA,IACJ,MAAMa;AAAA,IACN,WAAWC;AAAA,IACX,SAASC;AAAA,EAAA,IACPC;AAAA,IACF,EAAE,WAAAjB,GAAW,eAAeC,EAAS,KAAA;AAAA,IACrC,EAAE,SAASY,EAAA;AAAA,EAAoB,GAG3BK,IAAWJ,GAAiB,iBAAiB,iCAAiC,CAAA,GAI9EK,IACJN,MAAwBE,KAAqBC,KAAoBE,EAAS,SAAS,IAE/EE,IAAajB,MAAgB,EAAQF,EAAS;AAyCpD,SAAO;AAAA,IACL,aAAAE;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAc;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAmBN,KAAuBE;AAAA,IAC1C,UAAAJ;AAAA,IACA,iBAAAL;AAAA,IACA,cAAAE;AAAA,IACA,QAhDa,YAAY;AACzB,UAAI,CAACY,GAAY;AACf,QAAAlB,EAAQmB,EAAgB,mCAAmC,IAAI;AAC/D;AAAA,MACF;AAEA,MAAAd,EAAmB,EAAK,GACxBE,EAAgB,MAAS;AAEzB,UAAI;AACF,cAAMC,EAAkB;AAAA,UACtB,SAAS;AAAA,YACP,WAAAV;AAAA,YACA,eAAeC,EAAS;AAAA,YACxB,0BAA0B;AAAA,cACxB,SAASA,EAAS;AAAA,cAClB,aAAaE;AAAA,YAAA;AAAA,UACf;AAAA,QACF,CACD,GACDD;AAAA,UACEC,IACIkB,EAAgB,kCAChBA,EAAgB;AAAA,UACpB;AAAA,QAAA;AAAA,MAEJ,SAASC,GAAK;AAIZ,QAAAb,EAAgBc,EAAoBD,CAAG,EAAE,YAAY,CAAC,GAAG,OAAO,GAChEf,EAAmB,EAAI;AAAA,MACzB;AAAA,IACF;AAAA,IAgBE,SAdc,MAAM;AACpB,MAAAL,EAAQmB,EAAgB,mCAAmC,IAAI;AAAA,IACjE;AAAA,EAYE;AAEJ;"}
|
|
@@ -1,60 +1,75 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createMachine as
|
|
3
|
-
import { useState as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { createMachine as S } from "robot3";
|
|
3
|
+
import { useState as y, useMemo as f } from "react";
|
|
4
4
|
import { usePaySchedulesGetAllSuspense as d } from "@gusto/embedded-api/react-query/paySchedulesGetAll";
|
|
5
|
-
import { payScheduleManagementStateMachine as
|
|
6
|
-
import { PayScheduleOverviewContextual as
|
|
7
|
-
import { BaseComponent as
|
|
8
|
-
import { useBase as
|
|
9
|
-
import { useI18n as
|
|
10
|
-
import { Flow as
|
|
11
|
-
import { useUnstableFeature as
|
|
12
|
-
|
|
5
|
+
import { payScheduleManagementStateMachine as g } from "./payScheduleManagementStateMachine.js";
|
|
6
|
+
import { PayScheduleOverviewContextual as C, PayScheduleEditFormContextual as P } from "./PayScheduleManagementComponents.js";
|
|
7
|
+
import { BaseComponent as M } from "../../../Base/Base.js";
|
|
8
|
+
import { useBase as v } from "../../../Base/useBase.js";
|
|
9
|
+
import { useI18n as i, useComponentDictionary as l } from "../../../../i18n/I18n.js";
|
|
10
|
+
import { Flow as D } from "../../../Flow/Flow.js";
|
|
11
|
+
import { useUnstableFeature as w } from "../../../../contexts/UnstableFeaturesProvider/useUnstableFeature.js";
|
|
12
|
+
function p(e, o) {
|
|
13
|
+
if (!e) return;
|
|
14
|
+
const t = {};
|
|
15
|
+
for (const n in e) {
|
|
16
|
+
const a = n, m = e[a]?.[o];
|
|
17
|
+
m && (t[a] = m);
|
|
18
|
+
}
|
|
19
|
+
return Object.keys(t).length > 0 ? t : void 0;
|
|
20
|
+
}
|
|
21
|
+
const N = ({
|
|
13
22
|
companyId: e,
|
|
14
|
-
enableAutoPilot:
|
|
15
|
-
enableMultipleSchedules:
|
|
16
|
-
dictionary:
|
|
17
|
-
...
|
|
18
|
-
}) => (
|
|
23
|
+
enableAutoPilot: o,
|
|
24
|
+
enableMultipleSchedules: t,
|
|
25
|
+
dictionary: n,
|
|
26
|
+
...a
|
|
27
|
+
}) => (w("managePaySchedules", { throwIfDisabled: !0 }), /* @__PURE__ */ s(M, { ...a, children: /* @__PURE__ */ s(
|
|
19
28
|
x,
|
|
20
29
|
{
|
|
21
30
|
companyId: e,
|
|
22
|
-
enableAutoPilot:
|
|
23
|
-
enableMultipleSchedules:
|
|
24
|
-
dictionary:
|
|
31
|
+
enableAutoPilot: o,
|
|
32
|
+
enableMultipleSchedules: t,
|
|
33
|
+
dictionary: n
|
|
25
34
|
}
|
|
26
35
|
) }));
|
|
27
36
|
function x({
|
|
28
37
|
companyId: e,
|
|
29
|
-
enableAutoPilot:
|
|
30
|
-
enableMultipleSchedules:
|
|
31
|
-
dictionary:
|
|
38
|
+
enableAutoPilot: o,
|
|
39
|
+
enableMultipleSchedules: t,
|
|
40
|
+
dictionary: n
|
|
32
41
|
}) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
i("Company.Management.PaySchedule"), l(
|
|
43
|
+
"Company.Management.PaySchedule",
|
|
44
|
+
p(n, "Company.Management.PaySchedule")
|
|
45
|
+
), i("Company.Management.AutoPilotDialog"), l(
|
|
46
|
+
"Company.Management.AutoPilotDialog",
|
|
47
|
+
p(n, "Company.Management.AutoPilotDialog")
|
|
48
|
+
), i("Company.PaySchedule");
|
|
49
|
+
const { onEvent: a } = v(), { data: m } = d({ companyId: e }), [{ initialState: u, initialComponent: c }] = y(() => {
|
|
50
|
+
const r = (m.payScheduleShowResponse?.length ?? 0) > 0;
|
|
36
51
|
return {
|
|
37
|
-
initialState:
|
|
38
|
-
initialComponent:
|
|
52
|
+
initialState: r ? "overview" : "createSchedule",
|
|
53
|
+
initialComponent: r ? C : P
|
|
39
54
|
};
|
|
40
|
-
}),
|
|
41
|
-
() =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
(
|
|
45
|
-
...
|
|
46
|
-
component:
|
|
55
|
+
}), h = f(
|
|
56
|
+
() => S(
|
|
57
|
+
u,
|
|
58
|
+
g,
|
|
59
|
+
(r) => ({
|
|
60
|
+
...r,
|
|
61
|
+
component: c,
|
|
47
62
|
companyId: e,
|
|
48
|
-
enableAutoPilot:
|
|
49
|
-
enableMultipleSchedules:
|
|
63
|
+
enableAutoPilot: o,
|
|
64
|
+
enableMultipleSchedules: t,
|
|
50
65
|
successAlert: null
|
|
51
66
|
})
|
|
52
67
|
),
|
|
53
|
-
[e,
|
|
68
|
+
[e, o, t, u, c]
|
|
54
69
|
);
|
|
55
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ s(D, { machine: h, onEvent: a });
|
|
56
71
|
}
|
|
57
72
|
export {
|
|
58
|
-
|
|
73
|
+
N as PaySchedule
|
|
59
74
|
};
|
|
60
75
|
//# sourceMappingURL=PaySchedule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaySchedule.js","sources":["../../../../../src/components/Company/PaySchedule/management/PaySchedule.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo, useState } from 'react'\nimport { usePaySchedulesGetAllSuspense } from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { payScheduleManagementStateMachine } from './payScheduleManagementStateMachine'\nimport type { PayScheduleManagementContextInterface } from './PayScheduleManagementComponents'\nimport {\n PayScheduleOverviewContextual,\n PayScheduleEditFormContextual,\n} from './PayScheduleManagementComponents'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport type { BaseComponentKeys } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { Flow } from '@/components/Flow/Flow'\nimport { useUnstableFeature } from '@/contexts/UnstableFeaturesProvider/useUnstableFeature'\n\n/**\n * Props for {@link PaySchedule}.\n *\n * @alpha\n */\nexport interface PayScheduleProps extends BaseComponentInterface<'Company.Management.PaySchedule'> {\n /** Company whose pay schedule is managed. */\n companyId: string\n /** Shows the AutoPilot row and its Edit action. */\n enableAutoPilot?: boolean\n /** Shows the Manage action. */\n enableMultipleSchedules?: boolean\n}\n\n/**\n * Manages a company's pay schedule after onboarding.\n *\n * @remarks\n * Renders the overview when the company already has a pay schedule, or the create form\n * directly when it doesn't.\n *\n * @alpha\n */\nexport const PaySchedule = ({\n companyId,\n enableAutoPilot,\n enableMultipleSchedules,\n dictionary,\n ...props\n}: PayScheduleProps) => {\n useUnstableFeature('managePaySchedules', { throwIfDisabled: true })\n\n return (\n <BaseComponent {...props}>\n <Root\n companyId={companyId}\n enableAutoPilot={enableAutoPilot}\n enableMultipleSchedules={enableMultipleSchedules}\n dictionary={dictionary}\n />\n </BaseComponent>\n )\n}\n\nfunction Root({\n companyId,\n enableAutoPilot,\n enableMultipleSchedules,\n dictionary,\n}: Omit<PayScheduleProps, BaseComponentKeys>) {\n useI18n('Company.Management.PaySchedule')\n useComponentDictionary('Company.Management.PaySchedule', dictionary)\n // PayScheduleEditFormContextual reuses the onboarding PayScheduleForm, whose translations\n // live under its own namespace and are otherwise never loaded from this flow.\n useI18n('Company.PaySchedule')\n const { onEvent } = useBase()\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({ companyId })\n\n /**\n * Freeze the initial routing decision. Recomputing it after a later refetch (e.g. once the\n * first schedule is created) would re-seat the machine and orphan its interpreter.\n */\n const [{ initialState, initialComponent }] = useState<{\n initialState: keyof typeof payScheduleManagementStateMachine\n initialComponent: typeof PayScheduleOverviewContextual | typeof PayScheduleEditFormContextual\n }>(() => {\n const hasSchedules = (paySchedules.payScheduleShowResponse?.length ?? 0) > 0\n return {\n initialState: hasSchedules ? 'overview' : 'createSchedule',\n initialComponent: hasSchedules\n ? PayScheduleOverviewContextual\n : PayScheduleEditFormContextual,\n }\n })\n\n const machine = useMemo(\n () =>\n createMachine(\n initialState,\n payScheduleManagementStateMachine,\n (initialContext: PayScheduleManagementContextInterface) => ({\n ...initialContext,\n component: initialComponent,\n companyId,\n enableAutoPilot,\n enableMultipleSchedules,\n successAlert: null,\n }),\n ),\n [companyId, enableAutoPilot, enableMultipleSchedules, initialState, initialComponent],\n )\n\n return <Flow machine={machine} onEvent={onEvent} />\n}\n"],"names":["PaySchedule","companyId","enableAutoPilot","enableMultipleSchedules","
|
|
1
|
+
{"version":3,"file":"PaySchedule.js","sources":["../../../../../src/components/Company/PaySchedule/management/PaySchedule.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo, useState } from 'react'\nimport { usePaySchedulesGetAllSuspense } from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { payScheduleManagementStateMachine } from './payScheduleManagementStateMachine'\nimport type { PayScheduleManagementContextInterface } from './PayScheduleManagementComponents'\nimport {\n PayScheduleOverviewContextual,\n PayScheduleEditFormContextual,\n} from './PayScheduleManagementComponents'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport type { BaseComponentKeys } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { Flow } from '@/components/Flow/Flow'\nimport { useUnstableFeature } from '@/contexts/UnstableFeaturesProvider/useUnstableFeature'\nimport type {\n DeepPartial,\n ResourceDictionary,\n Resources,\n SupportedLanguages,\n} from '@/types/Helpers'\n\n/**\n * Translation overrides for {@link PaySchedule}, covering both its own namespace and\n * `Company.Management.AutoPilotDialog` — the AutoPilot dialog is an internal spoke of this\n * flow with no standalone `dictionary` prop of its own.\n *\n * @alpha\n */\nexport type PayScheduleDictionary = {\n [Lang in SupportedLanguages]?: {\n 'Company.Management.PaySchedule'?: DeepPartial<Resources['Company.Management.PaySchedule']>\n 'Company.Management.AutoPilotDialog'?: DeepPartial<\n Resources['Company.Management.AutoPilotDialog']\n >\n }\n}\n\nfunction pickNamespaceDictionary<K extends keyof Resources>(\n dictionary: PayScheduleDictionary | undefined,\n ns: K,\n): ResourceDictionary<K> | undefined {\n if (!dictionary) return undefined\n\n const picked = {} as Record<SupportedLanguages, DeepPartial<Resources[K]>>\n for (const lang in dictionary) {\n const langKey = lang as SupportedLanguages\n const nsValue = (\n dictionary[langKey] as Partial<Record<K, DeepPartial<Resources[K]>>> | undefined\n )?.[ns]\n if (nsValue) {\n picked[langKey] = nsValue\n }\n }\n return Object.keys(picked).length > 0 ? (picked as ResourceDictionary<K>) : undefined\n}\n\n/**\n * Props for {@link PaySchedule}.\n *\n * @alpha\n */\nexport interface PayScheduleProps extends Omit<\n BaseComponentInterface<'Company.Management.PaySchedule'>,\n 'dictionary'\n> {\n /** Company whose pay schedule is managed. */\n companyId: string\n /** Shows the AutoPilot row and its Edit action. */\n enableAutoPilot?: boolean\n /** Shows the Manage action. */\n enableMultipleSchedules?: boolean\n /** Overrides for this flow's i18n strings, including the AutoPilot dialog's. */\n dictionary?: PayScheduleDictionary\n}\n\n/**\n * Manages a company's pay schedule after onboarding.\n *\n * @remarks\n * Renders the overview when the company already has a pay schedule, or the create form\n * directly when it doesn't.\n *\n * @alpha\n */\nexport const PaySchedule = ({\n companyId,\n enableAutoPilot,\n enableMultipleSchedules,\n dictionary,\n ...props\n}: PayScheduleProps) => {\n useUnstableFeature('managePaySchedules', { throwIfDisabled: true })\n\n return (\n <BaseComponent {...props}>\n <Root\n companyId={companyId}\n enableAutoPilot={enableAutoPilot}\n enableMultipleSchedules={enableMultipleSchedules}\n dictionary={dictionary}\n />\n </BaseComponent>\n )\n}\n\nfunction Root({\n companyId,\n enableAutoPilot,\n enableMultipleSchedules,\n dictionary,\n}: Omit<PayScheduleProps, BaseComponentKeys>) {\n useI18n('Company.Management.PaySchedule')\n useComponentDictionary(\n 'Company.Management.PaySchedule',\n pickNamespaceDictionary(dictionary, 'Company.Management.PaySchedule'),\n )\n // AutoPilotDialog is an internal spoke off PayScheduleOverviewContextual, not standalone-\n // mountable, so PaySchedule's own dictionary covers this namespace too.\n useI18n('Company.Management.AutoPilotDialog')\n useComponentDictionary(\n 'Company.Management.AutoPilotDialog',\n pickNamespaceDictionary(dictionary, 'Company.Management.AutoPilotDialog'),\n )\n // PayScheduleEditFormContextual reuses the onboarding PayScheduleForm, whose translations\n // live under its own namespace and are otherwise never loaded from this flow.\n useI18n('Company.PaySchedule')\n const { onEvent } = useBase()\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({ companyId })\n\n /**\n * Freeze the initial routing decision. Recomputing it after a later refetch (e.g. once the\n * first schedule is created) would re-seat the machine and orphan its interpreter.\n */\n const [{ initialState, initialComponent }] = useState<{\n initialState: keyof typeof payScheduleManagementStateMachine\n initialComponent: typeof PayScheduleOverviewContextual | typeof PayScheduleEditFormContextual\n }>(() => {\n const hasSchedules = (paySchedules.payScheduleShowResponse?.length ?? 0) > 0\n return {\n initialState: hasSchedules ? 'overview' : 'createSchedule',\n initialComponent: hasSchedules\n ? PayScheduleOverviewContextual\n : PayScheduleEditFormContextual,\n }\n })\n\n const machine = useMemo(\n () =>\n createMachine(\n initialState,\n payScheduleManagementStateMachine,\n (initialContext: PayScheduleManagementContextInterface) => ({\n ...initialContext,\n component: initialComponent,\n companyId,\n enableAutoPilot,\n enableMultipleSchedules,\n successAlert: null,\n }),\n ),\n [companyId, enableAutoPilot, enableMultipleSchedules, initialState, initialComponent],\n )\n\n return <Flow machine={machine} onEvent={onEvent} />\n}\n"],"names":["pickNamespaceDictionary","dictionary","ns","picked","lang","langKey","nsValue","PaySchedule","companyId","enableAutoPilot","enableMultipleSchedules","props","useUnstableFeature","jsx","BaseComponent","Root","useI18n","useComponentDictionary","onEvent","useBase","paySchedules","usePaySchedulesGetAllSuspense","initialState","initialComponent","useState","hasSchedules","PayScheduleOverviewContextual","PayScheduleEditFormContextual","machine","useMemo","createMachine","payScheduleManagementStateMachine","initialContext","Flow"],"mappings":";;;;;;;;;;;AAuCA,SAASA,EACPC,GACAC,GACmC;AACnC,MAAI,CAACD,EAAY;AAEjB,QAAME,IAAS,CAAA;AACf,aAAWC,KAAQH,GAAY;AAC7B,UAAMI,IAAUD,GACVE,IACJL,EAAWI,CAAO,IAChBH,CAAE;AACN,IAAII,MACFH,EAAOE,CAAO,IAAIC;AAAA,EAEtB;AACA,SAAO,OAAO,KAAKH,CAAM,EAAE,SAAS,IAAKA,IAAmC;AAC9E;AA8BO,MAAMI,IAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,YAAAT;AAAA,EACA,GAAGU;AACL,OACEC,EAAmB,sBAAsB,EAAE,iBAAiB,GAAA,CAAM,GAGhE,gBAAAC,EAACC,GAAA,EAAe,GAAGH,GACjB,UAAA,gBAAAE;AAAA,EAACE;AAAA,EAAA;AAAA,IACC,WAAAP;AAAA,IACA,iBAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,YAAAT;AAAA,EAAA;AAAA,GAEJ;AAIJ,SAASc,EAAK;AAAA,EACZ,WAAAP;AAAA,EACA,iBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,YAAAT;AACF,GAA8C;AAC5C,EAAAe,EAAQ,gCAAgC,GACxCC;AAAA,IACE;AAAA,IACAjB,EAAwBC,GAAY,gCAAgC;AAAA,EAAA,GAItEe,EAAQ,oCAAoC,GAC5CC;AAAA,IACE;AAAA,IACAjB,EAAwBC,GAAY,oCAAoC;AAAA,EAAA,GAI1Ee,EAAQ,qBAAqB;AAC7B,QAAM,EAAE,SAAAE,EAAA,IAAYC,EAAA,GACd,EAAE,MAAMC,EAAA,IAAiBC,EAA8B,EAAE,WAAAb,GAAW,GAMpE,CAAC,EAAE,cAAAc,GAAc,kBAAAC,GAAkB,IAAIC,EAG1C,MAAM;AACP,UAAMC,KAAgBL,EAAa,yBAAyB,UAAU,KAAK;AAC3E,WAAO;AAAA,MACL,cAAcK,IAAe,aAAa;AAAA,MAC1C,kBAAkBA,IACdC,IACAC;AAAA,IAAA;AAAA,EAER,CAAC,GAEKC,IAAUC;AAAA,IACd,MACEC;AAAA,MACER;AAAA,MACAS;AAAA,MACA,CAACC,OAA2D;AAAA,QAC1D,GAAGA;AAAA,QACH,WAAWT;AAAA,QACX,WAAAf;AAAA,QACA,iBAAAC;AAAA,QACA,yBAAAC;AAAA,QACA,cAAc;AAAA,MAAA;AAAA,IAChB;AAAA,IAEJ,CAACF,GAAWC,GAAiBC,GAAyBY,GAAcC,CAAgB;AAAA,EAAA;AAGtF,SAAO,gBAAAV,EAACoB,GAAA,EAAK,SAAAL,GAAkB,SAAAV,EAAA,CAAkB;AACnD;"}
|
|
@@ -1,56 +1,72 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
import { PayScheduleForm as
|
|
4
|
-
import { PayScheduleOverview as
|
|
5
|
-
import { useComponentContext as
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as p } from "react-i18next";
|
|
3
|
+
import { PayScheduleForm as d } from "../PayScheduleForm.js";
|
|
4
|
+
import { PayScheduleOverview as f } from "./PayScheduleOverview.js";
|
|
5
|
+
import { useComponentContext as y } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
6
|
import { useFlow as m } from "../../../Flow/useFlow.js";
|
|
7
|
-
import { ensureRequired as
|
|
8
|
-
import { componentEvents as
|
|
9
|
-
import { Flex as
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
import { ensureRequired as n } from "../../../../helpers/ensureRequired.js";
|
|
8
|
+
import { componentEvents as S } from "../../../../shared/constants.js";
|
|
9
|
+
import { Flex as h } from "../../../Common/Flex/Flex.js";
|
|
10
|
+
import { AutoPilotDialog as E } from "./AutoPilotDialog/AutoPilotDialog.js";
|
|
11
|
+
import { PayScheduleAssignment as P } from "./PayScheduleAssignment/PayScheduleAssignment.js";
|
|
12
|
+
function w() {
|
|
13
|
+
const {
|
|
14
|
+
companyId: o,
|
|
15
|
+
onEvent: e,
|
|
16
|
+
enableAutoPilot: l,
|
|
17
|
+
enableMultipleSchedules: r,
|
|
18
|
+
successAlert: u,
|
|
19
|
+
autoPilotSchedule: c
|
|
20
|
+
} = m(), { t: s } = p("Company.Management.PaySchedule"), a = y();
|
|
21
|
+
return /* @__PURE__ */ i(h, { flexDirection: "column", gap: 16, children: [
|
|
22
|
+
u ? /* @__PURE__ */ t(
|
|
23
|
+
a.Alert,
|
|
16
24
|
{
|
|
17
25
|
status: "success",
|
|
18
|
-
label:
|
|
26
|
+
label: s(`alerts.${u}`),
|
|
19
27
|
onDismiss: () => {
|
|
20
|
-
e(
|
|
28
|
+
e(S.PAY_SCHEDULE_MANAGEMENT_ALERT_DISMISSED, null);
|
|
21
29
|
}
|
|
22
30
|
}
|
|
23
31
|
) : null,
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
32
|
+
/* @__PURE__ */ t(
|
|
33
|
+
f,
|
|
26
34
|
{
|
|
27
|
-
companyId:
|
|
35
|
+
companyId: n(o),
|
|
28
36
|
onEvent: e,
|
|
29
|
-
enableAutoPilot:
|
|
37
|
+
enableAutoPilot: l,
|
|
30
38
|
enableMultipleSchedules: r
|
|
31
39
|
}
|
|
32
|
-
)
|
|
40
|
+
),
|
|
41
|
+
c ? /* @__PURE__ */ t(
|
|
42
|
+
E,
|
|
43
|
+
{
|
|
44
|
+
companyId: n(o),
|
|
45
|
+
schedule: c,
|
|
46
|
+
onEvent: e
|
|
47
|
+
}
|
|
48
|
+
) : null
|
|
33
49
|
] });
|
|
34
50
|
}
|
|
35
|
-
function
|
|
51
|
+
function T() {
|
|
36
52
|
const { companyId: o, onEvent: e } = m();
|
|
37
|
-
return /* @__PURE__ */
|
|
53
|
+
return /* @__PURE__ */ t(P, { companyId: n(o), onEvent: e });
|
|
38
54
|
}
|
|
39
|
-
function
|
|
40
|
-
const { companyId: o, payScheduleId: e, defaultValues:
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
|
|
55
|
+
function j() {
|
|
56
|
+
const { companyId: o, payScheduleId: e, defaultValues: l, onEvent: r } = m();
|
|
57
|
+
return /* @__PURE__ */ t(
|
|
58
|
+
d,
|
|
43
59
|
{
|
|
44
|
-
companyId:
|
|
60
|
+
companyId: n(o),
|
|
45
61
|
payScheduleId: e,
|
|
46
|
-
defaultValues:
|
|
62
|
+
defaultValues: l,
|
|
47
63
|
onEvent: r
|
|
48
64
|
}
|
|
49
65
|
);
|
|
50
66
|
}
|
|
51
67
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
T as PayScheduleAssignmentContextual,
|
|
69
|
+
j as PayScheduleEditFormContextual,
|
|
70
|
+
w as PayScheduleOverviewContextual
|
|
55
71
|
};
|
|
56
72
|
//# sourceMappingURL=PayScheduleManagementComponents.js.map
|
package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayScheduleManagementComponents.js","sources":["../../../../../src/components/Company/PaySchedule/management/PayScheduleManagementComponents.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { PayScheduleForm } from '../PayScheduleForm'\nimport type { PayScheduleDefaultValues } from '../PaySchedule'\nimport { PayScheduleOverview } from './PayScheduleOverview'\nimport { PayScheduleAssignment } from './PayScheduleAssignment'\nimport { Flex } from '@/components/Common/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { componentEvents } from '@/shared/constants'\n\n/** @internal */\nexport type PayScheduleManagementSuccessAlertCode = 'assignmentUpdated'\n\n/** @internal */\nexport interface PayScheduleManagementContextInterface extends FlowContextInterface {\n companyId: string\n payScheduleId?: string\n defaultValues?: PayScheduleDefaultValues\n enableAutoPilot?: boolean\n enableMultipleSchedules?: boolean\n successAlert?: PayScheduleManagementSuccessAlertCode | null\n component: React.ComponentType | null\n}\n\n/** @internal */\nexport function PayScheduleOverviewContextual() {\n const {
|
|
1
|
+
{"version":3,"file":"PayScheduleManagementComponents.js","sources":["../../../../../src/components/Company/PaySchedule/management/PayScheduleManagementComponents.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport { PayScheduleForm } from '../PayScheduleForm'\nimport type { PayScheduleDefaultValues } from '../PaySchedule'\nimport { PayScheduleOverview } from './PayScheduleOverview'\nimport { PayScheduleAssignment } from './PayScheduleAssignment'\nimport { AutoPilotDialog } from './AutoPilotDialog'\nimport { Flex } from '@/components/Common/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { componentEvents } from '@/shared/constants'\n\n/** @internal */\nexport type PayScheduleManagementSuccessAlertCode = 'assignmentUpdated'\n\n/** @internal */\nexport interface PayScheduleManagementContextInterface extends FlowContextInterface {\n companyId: string\n payScheduleId?: string\n defaultValues?: PayScheduleDefaultValues\n enableAutoPilot?: boolean\n enableMultipleSchedules?: boolean\n successAlert?: PayScheduleManagementSuccessAlertCode | null\n autoPilotSchedule?: PayScheduleShow\n component: React.ComponentType | null\n}\n\n/** @internal */\nexport function PayScheduleOverviewContextual() {\n const {\n companyId,\n onEvent,\n enableAutoPilot,\n enableMultipleSchedules,\n successAlert,\n autoPilotSchedule,\n } = useFlow<PayScheduleManagementContextInterface>()\n const { t } = useTranslation('Company.Management.PaySchedule')\n const Components = useComponentContext()\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n {successAlert ? (\n <Components.Alert\n status=\"success\"\n label={t(`alerts.${successAlert}`)}\n onDismiss={() => {\n onEvent(componentEvents.PAY_SCHEDULE_MANAGEMENT_ALERT_DISMISSED, null)\n }}\n />\n ) : null}\n <PayScheduleOverview\n companyId={ensureRequired(companyId)}\n onEvent={onEvent}\n enableAutoPilot={enableAutoPilot}\n enableMultipleSchedules={enableMultipleSchedules}\n />\n {autoPilotSchedule ? (\n <AutoPilotDialog\n companyId={ensureRequired(companyId)}\n schedule={autoPilotSchedule}\n onEvent={onEvent}\n />\n ) : null}\n </Flex>\n )\n}\n\n/** @internal */\nexport function PayScheduleAssignmentContextual() {\n const { companyId, onEvent } = useFlow<PayScheduleManagementContextInterface>()\n\n return <PayScheduleAssignment companyId={ensureRequired(companyId)} onEvent={onEvent} />\n}\n\n/** @internal */\nexport function PayScheduleEditFormContextual() {\n const { companyId, payScheduleId, defaultValues, onEvent } =\n useFlow<PayScheduleManagementContextInterface>()\n\n return (\n <PayScheduleForm\n companyId={ensureRequired(companyId)}\n payScheduleId={payScheduleId}\n defaultValues={defaultValues}\n onEvent={onEvent}\n />\n )\n}\n"],"names":["PayScheduleOverviewContextual","companyId","onEvent","enableAutoPilot","enableMultipleSchedules","successAlert","autoPilotSchedule","useFlow","t","useTranslation","Components","useComponentContext","jsxs","Flex","jsx","componentEvents","PayScheduleOverview","ensureRequired","AutoPilotDialog","PayScheduleAssignmentContextual","PayScheduleAssignment","PayScheduleEditFormContextual","payScheduleId","defaultValues","PayScheduleForm"],"mappings":";;;;;;;;;;;AA6BO,SAASA,IAAgC;AAC9C,QAAM;AAAA,IACJ,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,mBAAAC;AAAA,EAAA,IACEC,EAAA,GACE,EAAE,GAAAC,EAAA,IAAMC,EAAe,gCAAgC,GACvDC,IAAaC,EAAA;AAEnB,SACE,gBAAAC,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAA;AAAA,IAAAR,IACC,gBAAAS;AAAA,MAACJ,EAAW;AAAA,MAAX;AAAA,QACC,QAAO;AAAA,QACP,OAAOF,EAAE,UAAUH,CAAY,EAAE;AAAA,QACjC,WAAW,MAAM;AACf,UAAAH,EAAQa,EAAgB,yCAAyC,IAAI;AAAA,QACvE;AAAA,MAAA;AAAA,IAAA,IAEA;AAAA,IACJ,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,WAAWC,EAAehB,CAAS;AAAA,QACnC,SAAAC;AAAA,QACA,iBAAAC;AAAA,QACA,yBAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEDE,IACC,gBAAAQ;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,WAAWD,EAAehB,CAAS;AAAA,QACnC,UAAUK;AAAA,QACV,SAAAJ;AAAA,MAAA;AAAA,IAAA,IAEA;AAAA,EAAA,GACN;AAEJ;AAGO,SAASiB,IAAkC;AAChD,QAAM,EAAE,WAAAlB,GAAW,SAAAC,EAAA,IAAYK,EAAA;AAE/B,2BAAQa,GAAA,EAAsB,WAAWH,EAAehB,CAAS,GAAG,SAAAC,GAAkB;AACxF;AAGO,SAASmB,IAAgC;AAC9C,QAAM,EAAE,WAAApB,GAAW,eAAAqB,GAAe,eAAAC,GAAe,SAAArB,EAAA,IAC/CK,EAAA;AAEF,SACE,gBAAAO;AAAA,IAACU;AAAA,IAAA;AAAA,MACC,WAAWP,EAAehB,CAAS;AAAA,MACnC,eAAAqB;AAAA,MACA,eAAAC;AAAA,MACA,SAAArB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { usePaySchedulesGetAllSuspense as S } from "@gusto/embedded-api/react-query/paySchedulesGetAll";
|
|
3
3
|
import { PayScheduleOverviewPresentation as m } from "./PayScheduleOverviewPresentation.js";
|
|
4
|
-
import { componentEvents as
|
|
4
|
+
import { componentEvents as t } from "../../../../shared/constants.js";
|
|
5
5
|
import { ensureRequired as a } from "../../../../helpers/ensureRequired.js";
|
|
6
6
|
function h({
|
|
7
|
-
companyId:
|
|
7
|
+
companyId: u,
|
|
8
8
|
onEvent: e,
|
|
9
|
-
enableAutoPilot:
|
|
9
|
+
enableAutoPilot: i,
|
|
10
10
|
enableMultipleSchedules: r
|
|
11
11
|
}) {
|
|
12
|
-
const { data:
|
|
12
|
+
const { data: n } = S({ companyId: u }), s = n.payScheduleShowResponse ?? [], o = a(s.find((d) => d.active) ?? s[0]);
|
|
13
13
|
return /* @__PURE__ */ c(
|
|
14
14
|
m,
|
|
15
15
|
{
|
|
16
16
|
schedule: o,
|
|
17
|
-
enableAutoPilot:
|
|
17
|
+
enableAutoPilot: i,
|
|
18
18
|
enableMultipleSchedules: r,
|
|
19
19
|
onEditSchedule: () => {
|
|
20
|
-
e(
|
|
20
|
+
e(t.PAY_SCHEDULE_UPDATE, { uuid: o.uuid });
|
|
21
21
|
},
|
|
22
22
|
onManageAssignment: () => {
|
|
23
|
-
e(
|
|
23
|
+
e(t.PAY_SCHEDULE_MANAGE_ASSIGNMENT);
|
|
24
24
|
},
|
|
25
25
|
onEditAutoPilot: () => {
|
|
26
|
-
e(
|
|
26
|
+
e(t.PAY_SCHEDULE_AUTO_PILOT_EDIT, { schedule: o });
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayScheduleOverview.js","sources":["../../../../../src/components/Company/PaySchedule/management/PayScheduleOverview.tsx"],"sourcesContent":["import { usePaySchedulesGetAllSuspense } from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { PayScheduleOverviewPresentation } from './PayScheduleOverviewPresentation'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\n/** @internal */\nexport interface PayScheduleOverviewProps {\n companyId: string\n onEvent: OnEventType<EventType, unknown>\n enableAutoPilot?: boolean\n enableMultipleSchedules?: boolean\n}\n\n/** @internal */\nexport function PayScheduleOverview({\n companyId,\n onEvent,\n enableAutoPilot,\n enableMultipleSchedules,\n}: PayScheduleOverviewProps) {\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({ companyId })\n const schedules = paySchedules.payScheduleShowResponse ?? []\n /**\n * Prefer the schedule with employees assigned to it over an unassigned leftover — relevant\n * if enableMultipleSchedules was previously on and is now off, leaving more than one schedule\n * behind. PaySchedule.tsx only routes here once it's confirmed at least one schedule exists.\n */\n const schedule = ensureRequired(schedules.find(s => s.active) ?? schedules[0])\n\n return (\n <PayScheduleOverviewPresentation\n schedule={schedule}\n enableAutoPilot={enableAutoPilot}\n enableMultipleSchedules={enableMultipleSchedules}\n onEditSchedule={() => {\n onEvent(componentEvents.PAY_SCHEDULE_UPDATE, { uuid: schedule.uuid })\n }}\n onManageAssignment={() => {\n onEvent(componentEvents.PAY_SCHEDULE_MANAGE_ASSIGNMENT)\n }}\n onEditAutoPilot={() => {\n onEvent(componentEvents.PAY_SCHEDULE_AUTO_PILOT_EDIT, {
|
|
1
|
+
{"version":3,"file":"PayScheduleOverview.js","sources":["../../../../../src/components/Company/PaySchedule/management/PayScheduleOverview.tsx"],"sourcesContent":["import { usePaySchedulesGetAllSuspense } from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { PayScheduleOverviewPresentation } from './PayScheduleOverviewPresentation'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\n/** @internal */\nexport interface PayScheduleOverviewProps {\n companyId: string\n onEvent: OnEventType<EventType, unknown>\n enableAutoPilot?: boolean\n enableMultipleSchedules?: boolean\n}\n\n/** @internal */\nexport function PayScheduleOverview({\n companyId,\n onEvent,\n enableAutoPilot,\n enableMultipleSchedules,\n}: PayScheduleOverviewProps) {\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({ companyId })\n const schedules = paySchedules.payScheduleShowResponse ?? []\n /**\n * Prefer the schedule with employees assigned to it over an unassigned leftover — relevant\n * if enableMultipleSchedules was previously on and is now off, leaving more than one schedule\n * behind. PaySchedule.tsx only routes here once it's confirmed at least one schedule exists.\n */\n const schedule = ensureRequired(schedules.find(s => s.active) ?? schedules[0])\n\n return (\n <PayScheduleOverviewPresentation\n schedule={schedule}\n enableAutoPilot={enableAutoPilot}\n enableMultipleSchedules={enableMultipleSchedules}\n onEditSchedule={() => {\n onEvent(componentEvents.PAY_SCHEDULE_UPDATE, { uuid: schedule.uuid })\n }}\n onManageAssignment={() => {\n onEvent(componentEvents.PAY_SCHEDULE_MANAGE_ASSIGNMENT)\n }}\n onEditAutoPilot={() => {\n onEvent(componentEvents.PAY_SCHEDULE_AUTO_PILOT_EDIT, { schedule })\n }}\n />\n )\n}\n"],"names":["PayScheduleOverview","companyId","onEvent","enableAutoPilot","enableMultipleSchedules","paySchedules","usePaySchedulesGetAllSuspense","schedules","schedule","ensureRequired","s","jsx","PayScheduleOverviewPresentation","componentEvents"],"mappings":";;;;;AAeO,SAASA,EAAoB;AAAA,EAClC,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,yBAAAC;AACF,GAA6B;AAC3B,QAAM,EAAE,MAAMC,EAAA,IAAiBC,EAA8B,EAAE,WAAAL,GAAW,GACpEM,IAAYF,EAAa,2BAA2B,CAAA,GAMpDG,IAAWC,EAAeF,EAAU,KAAK,CAAAG,MAAKA,EAAE,MAAM,KAAKH,EAAU,CAAC,CAAC;AAE7E,SACE,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,UAAAJ;AAAA,MACA,iBAAAL;AAAA,MACA,yBAAAC;AAAA,MACA,gBAAgB,MAAM;AACpB,QAAAF,EAAQW,EAAgB,qBAAqB,EAAE,MAAML,EAAS,MAAM;AAAA,MACtE;AAAA,MACA,oBAAoB,MAAM;AACxB,QAAAN,EAAQW,EAAgB,8BAA8B;AAAA,MACxD;AAAA,MACA,iBAAiB,MAAM;AACrB,QAAAX,EAAQW,EAAgB,8BAA8B,EAAE,UAAAL,EAAA,CAAU;AAAA,MACpE;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,66 +1,108 @@
|
|
|
1
|
-
import { state as
|
|
2
|
-
import { PayScheduleEditFormContextual as
|
|
1
|
+
import { state as A, transition as o, reduce as E } from "robot3";
|
|
2
|
+
import { PayScheduleEditFormContextual as l, PayScheduleAssignmentContextual as v, PayScheduleOverviewContextual as d } from "./PayScheduleManagementComponents.js";
|
|
3
3
|
import { componentEvents as t } from "../../../../shared/constants.js";
|
|
4
|
-
const
|
|
5
|
-
(
|
|
6
|
-
...
|
|
7
|
-
component:
|
|
4
|
+
const S = E(
|
|
5
|
+
(e) => ({
|
|
6
|
+
...e,
|
|
7
|
+
component: d,
|
|
8
8
|
payScheduleId: void 0,
|
|
9
|
+
autoPilotSchedule: void 0,
|
|
9
10
|
successAlert: null
|
|
10
11
|
})
|
|
11
|
-
),
|
|
12
|
+
), c = (e) => E((i) => ({
|
|
12
13
|
...i,
|
|
13
|
-
component:
|
|
14
|
+
component: d,
|
|
14
15
|
payScheduleId: void 0,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
autoPilotSchedule: void 0,
|
|
17
|
+
successAlert: e
|
|
18
|
+
})), a = {
|
|
19
|
+
overview: A(
|
|
20
|
+
o(
|
|
19
21
|
t.PAY_SCHEDULE_UPDATE,
|
|
20
22
|
"editSchedule",
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
...
|
|
24
|
-
component:
|
|
23
|
+
E(
|
|
24
|
+
(e, i) => ({
|
|
25
|
+
...e,
|
|
26
|
+
component: l,
|
|
25
27
|
payScheduleId: i.payload.uuid
|
|
26
28
|
})
|
|
27
29
|
)
|
|
28
30
|
),
|
|
29
|
-
|
|
31
|
+
o(
|
|
30
32
|
t.PAY_SCHEDULE_MANAGE_ASSIGNMENT,
|
|
31
33
|
"manageAssignment",
|
|
32
|
-
|
|
33
|
-
(
|
|
34
|
-
...
|
|
35
|
-
component:
|
|
34
|
+
E(
|
|
35
|
+
(e) => ({
|
|
36
|
+
...e,
|
|
37
|
+
component: v,
|
|
36
38
|
successAlert: null
|
|
37
39
|
})
|
|
38
40
|
)
|
|
39
41
|
),
|
|
40
|
-
|
|
42
|
+
o(t.PAY_SCHEDULE_MANAGEMENT_ALERT_DISMISSED, "overview", S),
|
|
43
|
+
o(
|
|
44
|
+
t.PAY_SCHEDULE_AUTO_PILOT_EDIT,
|
|
45
|
+
"overview",
|
|
46
|
+
E(
|
|
47
|
+
(e, i) => ({
|
|
48
|
+
...e,
|
|
49
|
+
autoPilotSchedule: i.payload.schedule
|
|
50
|
+
})
|
|
51
|
+
)
|
|
52
|
+
),
|
|
53
|
+
o(
|
|
54
|
+
t.PAY_SCHEDULE_AUTO_PILOT_ENABLED,
|
|
55
|
+
"overview",
|
|
56
|
+
E(
|
|
57
|
+
(e) => ({
|
|
58
|
+
...e,
|
|
59
|
+
autoPilotSchedule: void 0
|
|
60
|
+
})
|
|
61
|
+
)
|
|
62
|
+
),
|
|
63
|
+
o(
|
|
64
|
+
t.PAY_SCHEDULE_AUTO_PILOT_DISABLED,
|
|
65
|
+
"overview",
|
|
66
|
+
E(
|
|
67
|
+
(e) => ({
|
|
68
|
+
...e,
|
|
69
|
+
autoPilotSchedule: void 0
|
|
70
|
+
})
|
|
71
|
+
)
|
|
72
|
+
),
|
|
73
|
+
o(
|
|
74
|
+
t.PAY_SCHEDULE_AUTO_PILOT_DISMISSED,
|
|
75
|
+
"overview",
|
|
76
|
+
E(
|
|
77
|
+
(e) => ({
|
|
78
|
+
...e,
|
|
79
|
+
autoPilotSchedule: void 0
|
|
80
|
+
})
|
|
81
|
+
)
|
|
82
|
+
)
|
|
41
83
|
),
|
|
42
|
-
editSchedule:
|
|
43
|
-
|
|
44
|
-
|
|
84
|
+
editSchedule: A(
|
|
85
|
+
o(t.PAY_SCHEDULE_UPDATED, "overview", S),
|
|
86
|
+
o(t.CANCEL, "overview", S)
|
|
45
87
|
),
|
|
46
88
|
/**
|
|
47
89
|
* Entered directly from PaySchedule.tsx's initial routing when the company has no pay
|
|
48
90
|
* schedules yet — there's no overview to fall back to, so CANCEL isn't handled here; it
|
|
49
91
|
* still bubbles to the host via Flow's onEvent re-emit.
|
|
50
92
|
*/
|
|
51
|
-
createSchedule:
|
|
52
|
-
|
|
93
|
+
createSchedule: A(
|
|
94
|
+
o(t.PAY_SCHEDULE_CREATED, "overview", S)
|
|
53
95
|
),
|
|
54
|
-
manageAssignment:
|
|
55
|
-
|
|
56
|
-
|
|
96
|
+
manageAssignment: A(
|
|
97
|
+
o(t.PAY_SCHEDULE_ASSIGNMENT_CANCEL, "overview", S),
|
|
98
|
+
o(
|
|
57
99
|
t.PAY_SCHEDULE_ASSIGNED,
|
|
58
100
|
"overview",
|
|
59
|
-
|
|
101
|
+
c("assignmentUpdated")
|
|
60
102
|
)
|
|
61
103
|
)
|
|
62
104
|
};
|
|
63
105
|
export {
|
|
64
|
-
|
|
106
|
+
a as payScheduleManagementStateMachine
|
|
65
107
|
};
|
|
66
108
|
//# sourceMappingURL=payScheduleManagementStateMachine.js.map
|
package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payScheduleManagementStateMachine.js","sources":["../../../../../src/components/Company/PaySchedule/management/payScheduleManagementStateMachine.ts"],"sourcesContent":["import { reduce, state, transition } from 'robot3'\nimport type { ComponentType } from 'react'\nimport type { PayScheduleManagementContextInterface } from './PayScheduleManagementComponents'\nimport {\n PayScheduleOverviewContextual,\n PayScheduleEditFormContextual,\n PayScheduleAssignmentContextual,\n} from './PayScheduleManagementComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\n\ntype EventPayloads = {\n [componentEvents.PAY_SCHEDULE_UPDATE]: { uuid: string }\n [componentEvents.PAY_SCHEDULE_CREATED]: undefined\n}\n\nconst toOverview = reduce(\n (ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleOverviewContextual as ComponentType,\n payScheduleId: undefined,\n successAlert: null,\n }),\n)\n\nconst toOverviewWithAlert = (alert: PayScheduleManagementContextInterface['successAlert']) =>\n reduce((ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleOverviewContextual as ComponentType,\n payScheduleId: undefined,\n successAlert: alert,\n }))\n\n/** @internal */\nexport const payScheduleManagementStateMachine = {\n overview: state<MachineTransition>(\n transition(\n componentEvents.PAY_SCHEDULE_UPDATE,\n 'editSchedule',\n reduce(\n (\n ctx: PayScheduleManagementContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.PAY_SCHEDULE_UPDATE>,\n ): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleEditFormContextual as ComponentType,\n payScheduleId: ev.payload.uuid,\n }),\n ),\n ),\n transition(\n componentEvents.PAY_SCHEDULE_MANAGE_ASSIGNMENT,\n 'manageAssignment',\n reduce(\n (ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleAssignmentContextual as ComponentType,\n successAlert: null,\n }),\n ),\n ),\n transition(componentEvents.PAY_SCHEDULE_MANAGEMENT_ALERT_DISMISSED, 'overview', toOverview),\n ),\n editSchedule: state<MachineTransition>(\n transition(componentEvents.PAY_SCHEDULE_UPDATED, 'overview', toOverview),\n transition(componentEvents.CANCEL, 'overview', toOverview),\n ),\n /**\n * Entered directly from PaySchedule.tsx's initial routing when the company has no pay\n * schedules yet — there's no overview to fall back to, so CANCEL isn't handled here; it\n * still bubbles to the host via Flow's onEvent re-emit.\n */\n createSchedule: state<MachineTransition>(\n transition(componentEvents.PAY_SCHEDULE_CREATED, 'overview', toOverview),\n ),\n manageAssignment: state<MachineTransition>(\n transition(componentEvents.PAY_SCHEDULE_ASSIGNMENT_CANCEL, 'overview', toOverview),\n transition(\n componentEvents.PAY_SCHEDULE_ASSIGNED,\n 'overview',\n toOverviewWithAlert('assignmentUpdated'),\n ),\n ),\n}\n"],"names":["toOverview","reduce","ctx","PayScheduleOverviewContextual","toOverviewWithAlert","alert","payScheduleManagementStateMachine","state","transition","componentEvents","ev","PayScheduleEditFormContextual","PayScheduleAssignmentContextual"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"payScheduleManagementStateMachine.js","sources":["../../../../../src/components/Company/PaySchedule/management/payScheduleManagementStateMachine.ts"],"sourcesContent":["import { reduce, state, transition } from 'robot3'\nimport type { ComponentType } from 'react'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport type { PayScheduleManagementContextInterface } from './PayScheduleManagementComponents'\nimport {\n PayScheduleOverviewContextual,\n PayScheduleEditFormContextual,\n PayScheduleAssignmentContextual,\n} from './PayScheduleManagementComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\n\ntype EventPayloads = {\n [componentEvents.PAY_SCHEDULE_UPDATE]: { uuid: string }\n [componentEvents.PAY_SCHEDULE_CREATED]: undefined\n [componentEvents.PAY_SCHEDULE_AUTO_PILOT_EDIT]: { schedule: PayScheduleShow }\n}\n\nconst toOverview = reduce(\n (ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleOverviewContextual as ComponentType,\n payScheduleId: undefined,\n autoPilotSchedule: undefined,\n successAlert: null,\n }),\n)\n\nconst toOverviewWithAlert = (alert: PayScheduleManagementContextInterface['successAlert']) =>\n reduce((ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleOverviewContextual as ComponentType,\n payScheduleId: undefined,\n autoPilotSchedule: undefined,\n successAlert: alert,\n }))\n\n/** @internal */\nexport const payScheduleManagementStateMachine = {\n overview: state<MachineTransition>(\n transition(\n componentEvents.PAY_SCHEDULE_UPDATE,\n 'editSchedule',\n reduce(\n (\n ctx: PayScheduleManagementContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.PAY_SCHEDULE_UPDATE>,\n ): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleEditFormContextual as ComponentType,\n payScheduleId: ev.payload.uuid,\n }),\n ),\n ),\n transition(\n componentEvents.PAY_SCHEDULE_MANAGE_ASSIGNMENT,\n 'manageAssignment',\n reduce(\n (ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n component: PayScheduleAssignmentContextual as ComponentType,\n successAlert: null,\n }),\n ),\n ),\n transition(componentEvents.PAY_SCHEDULE_MANAGEMENT_ALERT_DISMISSED, 'overview', toOverview),\n transition(\n componentEvents.PAY_SCHEDULE_AUTO_PILOT_EDIT,\n 'overview',\n reduce(\n (\n ctx: PayScheduleManagementContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.PAY_SCHEDULE_AUTO_PILOT_EDIT>,\n ): PayScheduleManagementContextInterface => ({\n ...ctx,\n autoPilotSchedule: ev.payload.schedule,\n }),\n ),\n ),\n transition(\n componentEvents.PAY_SCHEDULE_AUTO_PILOT_ENABLED,\n 'overview',\n reduce(\n (ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n autoPilotSchedule: undefined,\n }),\n ),\n ),\n transition(\n componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISABLED,\n 'overview',\n reduce(\n (ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n autoPilotSchedule: undefined,\n }),\n ),\n ),\n transition(\n componentEvents.PAY_SCHEDULE_AUTO_PILOT_DISMISSED,\n 'overview',\n reduce(\n (ctx: PayScheduleManagementContextInterface): PayScheduleManagementContextInterface => ({\n ...ctx,\n autoPilotSchedule: undefined,\n }),\n ),\n ),\n ),\n editSchedule: state<MachineTransition>(\n transition(componentEvents.PAY_SCHEDULE_UPDATED, 'overview', toOverview),\n transition(componentEvents.CANCEL, 'overview', toOverview),\n ),\n /**\n * Entered directly from PaySchedule.tsx's initial routing when the company has no pay\n * schedules yet — there's no overview to fall back to, so CANCEL isn't handled here; it\n * still bubbles to the host via Flow's onEvent re-emit.\n */\n createSchedule: state<MachineTransition>(\n transition(componentEvents.PAY_SCHEDULE_CREATED, 'overview', toOverview),\n ),\n manageAssignment: state<MachineTransition>(\n transition(componentEvents.PAY_SCHEDULE_ASSIGNMENT_CANCEL, 'overview', toOverview),\n transition(\n componentEvents.PAY_SCHEDULE_ASSIGNED,\n 'overview',\n toOverviewWithAlert('assignmentUpdated'),\n ),\n ),\n}\n"],"names":["toOverview","reduce","ctx","PayScheduleOverviewContextual","toOverviewWithAlert","alert","payScheduleManagementStateMachine","state","transition","componentEvents","ev","PayScheduleEditFormContextual","PayScheduleAssignmentContextual"],"mappings":";;;AAkBA,MAAMA,IAAaC;AAAA,EACjB,CAACC,OAAuF;AAAA,IACtF,GAAGA;AAAA,IACH,WAAWC;AAAA,IACX,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,cAAc;AAAA,EAAA;AAElB,GAEMC,IAAsB,CAACC,MAC3BJ,EAAO,CAACC,OAAuF;AAAA,EAC7F,GAAGA;AAAA,EACH,WAAWC;AAAA,EACX,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,cAAcE;AAChB,EAAE,GAGSC,IAAoC;AAAA,EAC/C,UAAUC;AAAA,IACRC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAR;AAAA,QACE,CACEC,GACAQ,OAC2C;AAAA,UAC3C,GAAGR;AAAA,UACH,WAAWS;AAAA,UACX,eAAeD,EAAG,QAAQ;AAAA,QAAA;AAAA,MAC5B;AAAA,IACF;AAAA,IAEFF;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAR;AAAA,QACE,CAACC,OAAuF;AAAA,UACtF,GAAGA;AAAA,UACH,WAAWU;AAAA,UACX,cAAc;AAAA,QAAA;AAAA,MAChB;AAAA,IACF;AAAA,IAEFJ,EAAWC,EAAgB,yCAAyC,YAAYT,CAAU;AAAA,IAC1FQ;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAR;AAAA,QACE,CACEC,GACAQ,OAC2C;AAAA,UAC3C,GAAGR;AAAA,UACH,mBAAmBQ,EAAG,QAAQ;AAAA,QAAA;AAAA,MAChC;AAAA,IACF;AAAA,IAEFF;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAR;AAAA,QACE,CAACC,OAAuF;AAAA,UACtF,GAAGA;AAAA,UACH,mBAAmB;AAAA,QAAA;AAAA,MACrB;AAAA,IACF;AAAA,IAEFM;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAR;AAAA,QACE,CAACC,OAAuF;AAAA,UACtF,GAAGA;AAAA,UACH,mBAAmB;AAAA,QAAA;AAAA,MACrB;AAAA,IACF;AAAA,IAEFM;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAR;AAAA,QACE,CAACC,OAAuF;AAAA,UACtF,GAAGA;AAAA,UACH,mBAAmB;AAAA,QAAA;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AAAA,EAEF,cAAcK;AAAA,IACZC,EAAWC,EAAgB,sBAAsB,YAAYT,CAAU;AAAA,IACvEQ,EAAWC,EAAgB,QAAQ,YAAYT,CAAU;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO3D,gBAAgBO;AAAA,IACdC,EAAWC,EAAgB,sBAAsB,YAAYT,CAAU;AAAA,EAAA;AAAA,EAEzE,kBAAkBO;AAAA,IAChBC,EAAWC,EAAgB,gCAAgC,YAAYT,CAAU;AAAA,IACjFQ;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAL,EAAoB,mBAAmB;AAAA,IAAA;AAAA,EACzC;AAEJ;"}
|
|
@@ -11,10 +11,11 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
+
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
14
15
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
16
|
+
const [d, u] = t("StateTaxesFormContext");
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
u as StateTaxesFormProvider,
|
|
19
|
+
d as useStateTaxesForm
|
|
19
20
|
};
|
|
20
21
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/context.ts"],"sourcesContent":["import type { TaxRequirementsState } from '@gusto/embedded-api/models/components/taxrequirementsstate'\nimport { createCompoundContext } from '@/components/Base'\n\ninterface StateTaxFormContext {\n isPending: boolean\n state: string\n stateTaxRequirements: TaxRequirementsState\n handleCancel: () => void\n}\n\nconst [useStateTaxesForm, StateTaxesFormProvider] =\n createCompoundContext<StateTaxFormContext>('StateTaxesFormContext')\n\nexport { useStateTaxesForm, StateTaxesFormProvider }\n"],"names":["useStateTaxesForm","StateTaxesFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/context.ts"],"sourcesContent":["import type { TaxRequirementsState } from '@gusto/embedded-api/models/components/taxrequirementsstate'\nimport { createCompoundContext } from '@/components/Base'\n\ninterface StateTaxFormContext {\n isPending: boolean\n state: string\n stateTaxRequirements: TaxRequirementsState\n handleCancel: () => void\n}\n\nconst [useStateTaxesForm, StateTaxesFormProvider] =\n createCompoundContext<StateTaxFormContext>('StateTaxesFormContext')\n\nexport { useStateTaxesForm, StateTaxesFormProvider }\n"],"names":["useStateTaxesForm","StateTaxesFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAA2C,uBAAuB;"}
|
|
@@ -11,10 +11,11 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../shared/constants.js";
|
|
13
13
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
+
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
14
15
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
16
|
+
const [d, u] = t("StateTaxesListContext");
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
u as StateTaxesListProvider,
|
|
19
|
+
d as useStateTaxesList
|
|
19
20
|
};
|
|
20
21
|
//# sourceMappingURL=context.js.map
|