@gusto/embedded-react-sdk 0.56.5 → 0.56.7-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -6
  3. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  4. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -6
  5. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  6. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -8
  7. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  8. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -6
  9. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  10. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -6
  11. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  12. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +8 -11
  13. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  14. package/dist/components/Company/Industry/Context.js +6 -9
  15. package/dist/components/Company/Industry/Context.js.map +1 -1
  16. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -6
  17. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  18. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -6
  19. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  20. package/dist/components/Company/OnboardingOverview/context.js +3 -6
  21. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  22. package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.js +39 -0
  23. package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.js.map +1 -0
  24. package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialogPresentation.js +54 -0
  25. package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialogPresentation.js.map +1 -0
  26. package/dist/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.js +56 -0
  27. package/dist/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.js.map +1 -0
  28. package/dist/components/Company/PaySchedule/management/PaySchedule.js +54 -39
  29. package/dist/components/Company/PaySchedule/management/PaySchedule.js.map +1 -1
  30. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.js +70 -0
  31. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.js.map +1 -0
  32. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js +30 -32
  33. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js.map +1 -1
  34. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js +35 -27
  35. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js.map +1 -1
  36. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js +52 -31
  37. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js.map +1 -1
  38. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js +106 -66
  39. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js.map +1 -1
  40. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js +36 -30
  41. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js.map +1 -1
  42. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/scheduleLabel.js +7 -0
  43. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/scheduleLabel.js.map +1 -0
  44. package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js +81 -0
  45. package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js.map +1 -0
  46. package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js +48 -32
  47. package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -1
  48. package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js +47 -19
  49. package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js.map +1 -1
  50. package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js +74 -32
  51. package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js.map +1 -1
  52. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -6
  53. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  54. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -6
  55. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  56. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -6
  57. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
  58. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +17 -14
  59. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
  60. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -6
  61. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  62. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js +27 -16
  63. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js.map +1 -1
  64. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js +25 -17
  65. package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js.map +1 -1
  66. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/employeeDetailsSchema.js +13 -13
  67. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/employeeDetailsSchema.js.map +1 -1
  68. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js +6 -5
  69. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js.map +1 -1
  70. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +2 -3
  71. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  72. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +49 -48
  73. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  74. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +55 -57
  75. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
  76. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +25 -18
  77. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
  78. package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js +49 -47
  79. package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js.map +1 -1
  80. package/dist/components/Payroll/usePreparedPayrollData.js +7 -10
  81. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  82. package/dist/contexts/ApiProvider/ApiProvider.js +13 -12
  83. package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
  84. package/dist/contexts/ApiProvider/createSdkQueryClient.js +4 -3
  85. package/dist/contexts/ApiProvider/createSdkQueryClient.js.map +1 -1
  86. package/dist/contexts/ApiProvider/payrollDeductionAmountHook.js +36 -0
  87. package/dist/contexts/ApiProvider/payrollDeductionAmountHook.js.map +1 -0
  88. package/dist/helpers/validations.js +1 -1
  89. package/dist/helpers/validations.js.map +1 -1
  90. package/dist/i18n/I18n.js +1 -0
  91. package/dist/i18n/I18n.js.map +1 -1
  92. package/dist/i18n/en/Company.AssignSignatory.json.js +1 -1
  93. package/dist/i18n/en/Company.Management.AutoPilotDialog.json.js +22 -0
  94. package/dist/i18n/en/Company.Management.AutoPilotDialog.json.js.map +1 -0
  95. package/dist/i18n/en/Company.Management.PaySchedule.json.js +24 -14
  96. package/dist/i18n/en/Company.Management.PaySchedule.json.js.map +1 -1
  97. package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js +12 -10
  98. package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js.map +1 -1
  99. package/dist/package.json.js +1 -1
  100. package/dist/shared/constants.js +18 -15
  101. package/dist/shared/constants.js.map +1 -1
  102. package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.d.ts +11 -0
  103. package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialogPresentation.d.ts +17 -0
  104. package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/index.d.ts +1 -0
  105. package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.d.ts +22 -0
  106. package/dist/src/components/Company/PaySchedule/management/PaySchedule.d.ts +17 -1
  107. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.d.ts +15 -0
  108. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.d.ts +3 -3
  109. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.d.ts +7 -3
  110. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.d.ts +20 -4
  111. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/scheduleLabel.d.ts +3 -0
  112. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/usePayScheduleAssignment.d.ts +10 -1
  113. package/dist/src/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.d.ts +25 -0
  114. package/dist/src/components/Company/PaySchedule/management/PayScheduleManagementComponents.d.ts +2 -0
  115. package/dist/src/components/Company/PaySchedule/management/index.d.ts +1 -1
  116. package/dist/src/components/Company/exports/companyManagement.d.ts +1 -1
  117. package/dist/src/components/Employee/EmployeeListFlow/EmployeeListFlow.d.ts +1 -1
  118. package/dist/src/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.d.ts +6 -0
  119. package/dist/src/components/Employee/Profile/shared/useEmployeeDetailsForm/employeeDetailsSchema.test.d.ts +1 -0
  120. package/dist/src/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.test.d.ts +1 -0
  121. package/dist/src/components/Payroll/PayrollList/__fixtures__/payrollListMocks.d.ts +67 -0
  122. package/dist/src/contexts/ApiProvider/createSdkQueryClient.d.ts +2 -0
  123. package/dist/src/contexts/ApiProvider/createSdkQueryClient.test.d.ts +1 -0
  124. package/dist/src/contexts/ApiProvider/payrollDeductionAmountHook.d.ts +12 -0
  125. package/dist/src/contexts/ApiProvider/payrollDeductionAmountHook.test.d.ts +1 -0
  126. package/dist/src/helpers/validations.test.d.ts +1 -0
  127. package/dist/src/i18n/types.d.ts +119 -2
  128. package/dist/src/models/external.d.ts +7 -6
  129. package/dist/src/shared/constants.d.ts +6 -0
  130. package/docs/guides/endpoint-inventory.json +27 -1
  131. package/package.json +14 -14
@@ -1,60 +1,75 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { createMachine as p } from "robot3";
3
- import { useState as h, useMemo as S } from "react";
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 f } from "./payScheduleManagementStateMachine.js";
6
- import { PayScheduleOverviewContextual as y, PayScheduleEditFormContextual as C } from "./PayScheduleManagementComponents.js";
7
- import { BaseComponent as P } from "../../../Base/Base.js";
8
- import { useBase as g } from "../../../Base/useBase.js";
9
- import { useI18n as u, useComponentDictionary as v } from "../../../../i18n/I18n.js";
10
- import { Flow as w } from "../../../Flow/Flow.js";
11
- import { useUnstableFeature as M } from "../../../../contexts/UnstableFeaturesProvider/useUnstableFeature.js";
12
- const k = ({
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: t,
15
- enableMultipleSchedules: o,
16
- dictionary: a,
17
- ...r
18
- }) => (M("managePaySchedules", { throwIfDisabled: !0 }), /* @__PURE__ */ m(P, { ...r, children: /* @__PURE__ */ m(
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: t,
23
- enableMultipleSchedules: o,
24
- dictionary: a
31
+ enableAutoPilot: o,
32
+ enableMultipleSchedules: t,
33
+ dictionary: n
25
34
  }
26
35
  ) }));
27
36
  function x({
28
37
  companyId: e,
29
- enableAutoPilot: t,
30
- enableMultipleSchedules: o,
31
- dictionary: a
38
+ enableAutoPilot: o,
39
+ enableMultipleSchedules: t,
40
+ dictionary: n
32
41
  }) {
33
- u("Company.Management.PaySchedule"), v("Company.Management.PaySchedule", a), u("Company.PaySchedule");
34
- const { onEvent: r } = g(), { data: c } = d({ companyId: e }), [{ initialState: i, initialComponent: s }] = h(() => {
35
- const n = (c.payScheduleShowResponse?.length ?? 0) > 0;
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: n ? "overview" : "createSchedule",
38
- initialComponent: n ? y : C
52
+ initialState: r ? "overview" : "createSchedule",
53
+ initialComponent: r ? C : P
39
54
  };
40
- }), l = S(
41
- () => p(
42
- i,
43
- f,
44
- (n) => ({
45
- ...n,
46
- component: s,
55
+ }), h = f(
56
+ () => S(
57
+ u,
58
+ g,
59
+ (r) => ({
60
+ ...r,
61
+ component: c,
47
62
  companyId: e,
48
- enableAutoPilot: t,
49
- enableMultipleSchedules: o,
63
+ enableAutoPilot: o,
64
+ enableMultipleSchedules: t,
50
65
  successAlert: null
51
66
  })
52
67
  ),
53
- [e, t, o, i, s]
68
+ [e, o, t, u, c]
54
69
  );
55
- return /* @__PURE__ */ m(w, { machine: l, onEvent: r });
70
+ return /* @__PURE__ */ s(D, { machine: h, onEvent: a });
56
71
  }
57
72
  export {
58
- k as PaySchedule
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","dictionary","props","useUnstableFeature","jsx","BaseComponent","Root","useI18n","useComponentDictionary","onEvent","useBase","paySchedules","usePaySchedulesGetAllSuspense","initialState","initialComponent","useState","hasSchedules","PayScheduleOverviewContextual","PayScheduleEditFormContextual","machine","useMemo","createMachine","payScheduleManagementStateMachine","initialContext","Flow"],"mappings":";;;;;;;;;;;AAwCO,MAAMA,IAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,OACEC,EAAmB,sBAAsB,EAAE,iBAAiB,GAAA,CAAM,GAGhE,gBAAAC,EAACC,GAAA,EAAe,GAAGH,GACjB,UAAA,gBAAAE;AAAA,EAACE;AAAA,EAAA;AAAA,IACC,WAAAR;AAAA,IACA,iBAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,YAAAC;AAAA,EAAA;AAAA,GAEJ;AAIJ,SAASK,EAAK;AAAA,EACZ,WAAAR;AAAA,EACA,iBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,YAAAC;AACF,GAA8C;AAC5C,EAAAM,EAAQ,gCAAgC,GACxCC,EAAuB,kCAAkCP,CAAU,GAGnEM,EAAQ,qBAAqB;AAC7B,QAAM,EAAE,SAAAE,EAAA,IAAYC,EAAA,GACd,EAAE,MAAMC,EAAA,IAAiBC,EAA8B,EAAE,WAAAd,GAAW,GAMpE,CAAC,EAAE,cAAAe,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,WAAAhB;AAAA,QACA,iBAAAC;AAAA,QACA,yBAAAC;AAAA,QACA,cAAc;AAAA,MAAA;AAAA,IAChB;AAAA,IAEJ,CAACF,GAAWC,GAAiBC,GAAyBa,GAAcC,CAAgB;AAAA,EAAA;AAGtF,SAAO,gBAAAV,EAACoB,GAAA,EAAK,SAAAL,GAAkB,SAAAV,EAAA,CAAkB;AACnD;"}
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;"}
@@ -0,0 +1,70 @@
1
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
+ import { z as a } from "zod";
3
+ import { useForm as f, FormProvider as P } from "react-hook-form";
4
+ import { zodResolver as b } from "@hookform/resolvers/zod";
5
+ import { useTranslation as C } from "react-i18next";
6
+ import { scheduleLabel as g } from "./scheduleLabel.js";
7
+ import { Flex as m } from "../../../../Common/Flex/Flex.js";
8
+ import { ActionsLayout as v } from "../../../../Common/ActionsLayout/ActionsLayout.js";
9
+ import { Form as x } from "../../../../Common/Form/Form.js";
10
+ import { useComponentContext as U } from "../../../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ import { SelectField as c } from "../../../../Common/Fields/SelectField/SelectField.js";
12
+ const D = a.object({
13
+ hourlyPayScheduleUuid: a.string().min(1),
14
+ salariedPayScheduleUuid: a.string().min(1)
15
+ });
16
+ function V({
17
+ schedules: i,
18
+ hourlyPayScheduleUuid: u,
19
+ salariedPayScheduleUuid: s,
20
+ onBack: p,
21
+ onAddPaySchedule: h,
22
+ onContinue: S
23
+ }) {
24
+ const { t: o } = C("Company.Management.PayScheduleAssignment"), n = U(), r = f({
25
+ resolver: b(D),
26
+ defaultValues: {
27
+ hourlyPayScheduleUuid: u ?? i[0]?.uuid ?? "",
28
+ salariedPayScheduleUuid: s ?? i[0]?.uuid ?? ""
29
+ }
30
+ }), y = r.handleSubmit(S), l = i.map((d) => ({
31
+ value: d.uuid,
32
+ label: g(d)
33
+ }));
34
+ return /* @__PURE__ */ e(P, { ...r, children: /* @__PURE__ */ e(x, { onSubmit: () => {
35
+ y();
36
+ }, children: /* @__PURE__ */ t(m, { flexDirection: "column", gap: 32, children: [
37
+ /* @__PURE__ */ e(n.Heading, { as: "h2", children: o("compensationStep.heading") }),
38
+ /* @__PURE__ */ t(m, { flexDirection: "column", gap: 12, children: [
39
+ /* @__PURE__ */ e(
40
+ c,
41
+ {
42
+ name: "hourlyPayScheduleUuid",
43
+ label: o("compensationStep.hourlyPayScheduleLabel"),
44
+ description: o("compensationStep.hourlyPayScheduleDescription"),
45
+ placeholder: "",
46
+ options: l
47
+ }
48
+ ),
49
+ /* @__PURE__ */ e(
50
+ c,
51
+ {
52
+ name: "salariedPayScheduleUuid",
53
+ label: o("compensationStep.salariedPayScheduleLabel"),
54
+ description: o("compensationStep.salariedPayScheduleDescription"),
55
+ placeholder: "",
56
+ options: l
57
+ }
58
+ ),
59
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(n.Button, { variant: "secondary", onClick: h, children: o("compensationStep.addPayScheduleCta") }) })
60
+ ] }),
61
+ /* @__PURE__ */ t(v, { children: [
62
+ /* @__PURE__ */ e(n.Button, { variant: "secondary", onClick: p, children: o("backCta") }),
63
+ /* @__PURE__ */ e(n.Button, { variant: "primary", type: "submit", isDisabled: i.length === 0, children: o("continueCta") })
64
+ ] })
65
+ ] }) }) });
66
+ }
67
+ export {
68
+ V as AssignmentCompensationStepPresentation
69
+ };
70
+ //# sourceMappingURL=AssignmentCompensationStepPresentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssignmentCompensationStepPresentation.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useForm, FormProvider } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTranslation } from 'react-i18next'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport { scheduleLabel } from './scheduleLabel'\nimport { Flex, SelectField, ActionsLayout } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport interface AssignmentCompensationStepPresentationProps {\n schedules: PayScheduleShow[]\n hourlyPayScheduleUuid?: string\n salariedPayScheduleUuid?: string\n onBack: () => void\n onAddPaySchedule: () => void\n onContinue: (selection: {\n hourlyPayScheduleUuid: string\n salariedPayScheduleUuid: string\n }) => void\n}\n\nconst CompensationStepSchema = z.object({\n hourlyPayScheduleUuid: z.string().min(1),\n salariedPayScheduleUuid: z.string().min(1),\n})\n\ntype CompensationStepInputs = z.infer<typeof CompensationStepSchema>\n\n/** @internal */\nexport function AssignmentCompensationStepPresentation({\n schedules,\n hourlyPayScheduleUuid,\n salariedPayScheduleUuid,\n onBack,\n onAddPaySchedule,\n onContinue,\n}: AssignmentCompensationStepPresentationProps) {\n const { t } = useTranslation('Company.Management.PayScheduleAssignment')\n const Components = useComponentContext()\n\n const formMethods = useForm<CompensationStepInputs>({\n resolver: zodResolver(CompensationStepSchema),\n defaultValues: {\n hourlyPayScheduleUuid: hourlyPayScheduleUuid ?? schedules[0]?.uuid ?? '',\n salariedPayScheduleUuid: salariedPayScheduleUuid ?? schedules[0]?.uuid ?? '',\n },\n })\n\n const handleSubmit = formMethods.handleSubmit(onContinue)\n\n const options = schedules.map(schedule => ({\n value: schedule.uuid,\n label: scheduleLabel(schedule),\n }))\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h2\">{t('compensationStep.heading')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={12}>\n <SelectField\n name=\"hourlyPayScheduleUuid\"\n label={t('compensationStep.hourlyPayScheduleLabel')}\n description={t('compensationStep.hourlyPayScheduleDescription')}\n placeholder=\"\"\n options={options}\n />\n <SelectField\n name=\"salariedPayScheduleUuid\"\n label={t('compensationStep.salariedPayScheduleLabel')}\n description={t('compensationStep.salariedPayScheduleDescription')}\n placeholder=\"\"\n options={options}\n />\n <div>\n <Components.Button variant=\"secondary\" onClick={onAddPaySchedule}>\n {t('compensationStep.addPayScheduleCta')}\n </Components.Button>\n </div>\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={onBack}>\n {t('backCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\" isDisabled={schedules.length === 0}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["CompensationStepSchema","z","AssignmentCompensationStepPresentation","schedules","hourlyPayScheduleUuid","salariedPayScheduleUuid","onBack","onAddPaySchedule","onContinue","t","useTranslation","Components","useComponentContext","formMethods","useForm","zodResolver","handleSubmit","options","schedule","scheduleLabel","FormProvider","jsx","Form","jsxs","Flex","SelectField","ActionsLayout"],"mappings":";;;;;;;;;;;AAuBA,MAAMA,IAAyBC,EAAE,OAAO;AAAA,EACtC,uBAAuBA,EAAE,SAAS,IAAI,CAAC;AAAA,EACvC,yBAAyBA,EAAE,OAAA,EAAS,IAAI,CAAC;AAC3C,CAAC;AAKM,SAASC,EAAuC;AAAA,EACrD,WAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AACF,GAAgD;AAC9C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,0CAA0C,GACjEC,IAAaC,EAAA,GAEbC,IAAcC,EAAgC;AAAA,IAClD,UAAUC,EAAYf,CAAsB;AAAA,IAC5C,eAAe;AAAA,MACb,uBAAuBI,KAAyBD,EAAU,CAAC,GAAG,QAAQ;AAAA,MACtE,yBAAyBE,KAA2BF,EAAU,CAAC,GAAG,QAAQ;AAAA,IAAA;AAAA,EAC5E,CACD,GAEKa,IAAeH,EAAY,aAAaL,CAAU,GAElDS,IAAUd,EAAU,IAAI,CAAAe,OAAa;AAAA,IACzC,OAAOA,EAAS;AAAA,IAChB,OAAOC,EAAcD,CAAQ;AAAA,EAAA,EAC7B;AAEF,2BACGE,GAAA,EAAc,GAAGP,GAChB,UAAA,gBAAAQ,EAACC,KAAK,UAAU,MAAA;AAAM,IAAKN;KACzB,UAAA,gBAAAO,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAH,EAACV,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,0BAA0B,GAAE;AAAA,IAC3D,gBAAAc,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,MAAA,gBAAAH;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOhB,EAAE,yCAAyC;AAAA,UAClD,aAAaA,EAAE,+CAA+C;AAAA,UAC9D,aAAY;AAAA,UACZ,SAAAQ;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,gBAAAI;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOhB,EAAE,2CAA2C;AAAA,UACpD,aAAaA,EAAE,iDAAiD;AAAA,UAChE,aAAY;AAAA,UACZ,SAAAQ;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,gBAAAI,EAAC,OAAA,EACC,UAAA,gBAAAA,EAACV,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASJ,GAC7C,UAAAE,EAAE,oCAAoC,GACzC,EAAA,CACF;AAAA,IAAA,GACF;AAAA,sBACCiB,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAL,EAACV,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASL,GAC7C,UAAAG,EAAE,SAAS,EAAA,CACd;AAAA,MACA,gBAAAY,EAACV,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UAAS,YAAYR,EAAU,WAAW,GACjF,UAAAM,EAAE,aAAa,EAAA,CAClB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -1,59 +1,57 @@
1
1
  import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
- import { z as l } from "zod";
3
- import { useForm as h, FormProvider as f } from "react-hook-form";
4
- import { zodResolver as S } from "@hookform/resolvers/zod";
2
+ import { z as a } from "zod";
3
+ import { useForm as h, FormProvider as S } from "react-hook-form";
4
+ import { zodResolver as f } from "@hookform/resolvers/zod";
5
5
  import { useTranslation as y } from "react-i18next";
6
+ import { scheduleLabel as b } from "./scheduleLabel.js";
6
7
  import { Flex as d } from "../../../../Common/Flex/Flex.js";
7
- import { ActionsLayout as b } from "../../../../Common/ActionsLayout/ActionsLayout.js";
8
- import { Form as g } from "../../../../Common/Form/Form.js";
9
- import { useComponentContext as v } from "../../../../../contexts/ComponentAdapter/useComponentContext.js";
10
- import { SelectField as C } from "../../../../Common/Fields/SelectField/SelectField.js";
11
- const P = l.object({
12
- defaultPayScheduleUuid: l.string().min(1)
8
+ import { ActionsLayout as g } from "../../../../Common/ActionsLayout/ActionsLayout.js";
9
+ import { Form as v } from "../../../../Common/Form/Form.js";
10
+ import { useComponentContext as C } from "../../../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ import { SelectField as P } from "../../../../Common/Fields/SelectField/SelectField.js";
12
+ const x = a.object({
13
+ defaultPayScheduleUuid: a.string().min(1)
13
14
  });
14
- function x(t) {
15
- return [t.customName, t.frequency].filter(Boolean).join(" — ");
16
- }
17
- function q({
18
- schedules: t,
15
+ function R({
16
+ schedules: n,
19
17
  defaultPayScheduleUuid: c,
20
- onBack: u,
21
- onAddPaySchedule: m,
18
+ onBack: m,
19
+ onAddPaySchedule: u,
22
20
  onContinue: s
23
21
  }) {
24
- const { t: o } = y("Company.Management.PayScheduleAssignment"), n = v(), a = h({
25
- resolver: S(P),
26
- defaultValues: { defaultPayScheduleUuid: c ?? t[0]?.uuid ?? "" }
27
- }), p = a.handleSubmit(({ defaultPayScheduleUuid: i }) => {
22
+ const { t } = y("Company.Management.PayScheduleAssignment"), o = C(), l = h({
23
+ resolver: f(x),
24
+ defaultValues: { defaultPayScheduleUuid: c ?? n[0]?.uuid ?? "" }
25
+ }), p = l.handleSubmit(({ defaultPayScheduleUuid: i }) => {
28
26
  s(i);
29
27
  });
30
- return /* @__PURE__ */ e(f, { ...a, children: /* @__PURE__ */ e(g, { onSubmit: () => {
28
+ return /* @__PURE__ */ e(S, { ...l, children: /* @__PURE__ */ e(v, { onSubmit: () => {
31
29
  p();
32
30
  }, children: /* @__PURE__ */ r(d, { flexDirection: "column", gap: 32, children: [
33
- /* @__PURE__ */ e(n.Heading, { as: "h2", children: o("scheduleStep.heading") }),
31
+ /* @__PURE__ */ e(o.Heading, { as: "h2", children: t("scheduleStep.heading") }),
34
32
  /* @__PURE__ */ r(d, { flexDirection: "column", gap: 12, children: [
35
33
  /* @__PURE__ */ e(
36
- C,
34
+ P,
37
35
  {
38
36
  name: "defaultPayScheduleUuid",
39
- label: o("scheduleStep.payScheduleLabel"),
40
- description: o("scheduleStep.payScheduleDescription"),
37
+ label: t("scheduleStep.payScheduleLabel"),
38
+ description: t("scheduleStep.payScheduleDescription"),
41
39
  placeholder: "",
42
- options: t.map((i) => ({
40
+ options: n.map((i) => ({
43
41
  value: i.uuid,
44
- label: x(i)
42
+ label: b(i)
45
43
  }))
46
44
  }
47
45
  ),
48
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(n.Button, { variant: "secondary", onClick: m, children: o("scheduleStep.addPayScheduleCta") }) })
46
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(o.Button, { variant: "secondary", onClick: u, children: t("scheduleStep.addPayScheduleCta") }) })
49
47
  ] }),
50
- /* @__PURE__ */ r(b, { children: [
51
- /* @__PURE__ */ e(n.Button, { variant: "secondary", onClick: u, children: o("backCta") }),
52
- /* @__PURE__ */ e(n.Button, { variant: "primary", type: "submit", isDisabled: t.length === 0, children: o("continueCta") })
48
+ /* @__PURE__ */ r(g, { children: [
49
+ /* @__PURE__ */ e(o.Button, { variant: "secondary", onClick: m, children: t("backCta") }),
50
+ /* @__PURE__ */ e(o.Button, { variant: "primary", type: "submit", isDisabled: n.length === 0, children: t("continueCta") })
53
51
  ] })
54
52
  ] }) }) });
55
53
  }
56
54
  export {
57
- q as AssignmentScheduleStepPresentation
55
+ R as AssignmentScheduleStepPresentation
58
56
  };
59
57
  //# sourceMappingURL=AssignmentScheduleStepPresentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssignmentScheduleStepPresentation.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useForm, FormProvider } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTranslation } from 'react-i18next'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport { Flex, SelectField, ActionsLayout } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport interface AssignmentScheduleStepPresentationProps {\n schedules: PayScheduleShow[]\n defaultPayScheduleUuid?: string\n onBack: () => void\n onAddPaySchedule: () => void\n onContinue: (defaultPayScheduleUuid: string) => void\n}\n\nconst ScheduleStepSchema = z.object({\n defaultPayScheduleUuid: z.string().min(1),\n})\n\ntype ScheduleStepInputs = z.infer<typeof ScheduleStepSchema>\n\nfunction scheduleLabel(schedule: PayScheduleShow): string {\n return [schedule.customName, schedule.frequency].filter(Boolean).join(' — ')\n}\n\n/** @internal */\nexport function AssignmentScheduleStepPresentation({\n schedules,\n defaultPayScheduleUuid,\n onBack,\n onAddPaySchedule,\n onContinue,\n}: AssignmentScheduleStepPresentationProps) {\n const { t } = useTranslation('Company.Management.PayScheduleAssignment')\n const Components = useComponentContext()\n\n const formMethods = useForm<ScheduleStepInputs>({\n resolver: zodResolver(ScheduleStepSchema),\n defaultValues: { defaultPayScheduleUuid: defaultPayScheduleUuid ?? schedules[0]?.uuid ?? '' },\n })\n\n const handleSubmit = formMethods.handleSubmit(({ defaultPayScheduleUuid: uuid }) => {\n onContinue(uuid)\n })\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h2\">{t('scheduleStep.heading')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={12}>\n <SelectField\n name=\"defaultPayScheduleUuid\"\n label={t('scheduleStep.payScheduleLabel')}\n description={t('scheduleStep.payScheduleDescription')}\n placeholder=\"\"\n options={schedules.map(schedule => ({\n value: schedule.uuid,\n label: scheduleLabel(schedule),\n }))}\n />\n <div>\n <Components.Button variant=\"secondary\" onClick={onAddPaySchedule}>\n {t('scheduleStep.addPayScheduleCta')}\n </Components.Button>\n </div>\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={onBack}>\n {t('backCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\" isDisabled={schedules.length === 0}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["ScheduleStepSchema","z","scheduleLabel","schedule","AssignmentScheduleStepPresentation","schedules","defaultPayScheduleUuid","onBack","onAddPaySchedule","onContinue","t","useTranslation","Components","useComponentContext","formMethods","useForm","zodResolver","handleSubmit","uuid","FormProvider","jsx","Form","jsxs","Flex","SelectField","ActionsLayout"],"mappings":";;;;;;;;;;AAkBA,MAAMA,IAAqBC,EAAE,OAAO;AAAA,EAClC,wBAAwBA,EAAE,OAAA,EAAS,IAAI,CAAC;AAC1C,CAAC;AAID,SAASC,EAAcC,GAAmC;AACxD,SAAO,CAACA,EAAS,YAAYA,EAAS,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,KAAK;AAC7E;AAGO,SAASC,EAAmC;AAAA,EACjD,WAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AACF,GAA4C;AAC1C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,0CAA0C,GACjEC,IAAaC,EAAA,GAEbC,IAAcC,EAA4B;AAAA,IAC9C,UAAUC,EAAYhB,CAAkB;AAAA,IACxC,eAAe,EAAE,wBAAwBM,KAA0BD,EAAU,CAAC,GAAG,QAAQ,GAAA;AAAA,EAAG,CAC7F,GAEKY,IAAeH,EAAY,aAAa,CAAC,EAAE,wBAAwBI,QAAW;AAClF,IAAAT,EAAWS,CAAI;AAAA,EACjB,CAAC;AAED,2BACGC,GAAA,EAAc,GAAGL,GAChB,UAAA,gBAAAM,EAACC,KAAK,UAAU,MAAA;AAAM,IAAKJ;KACzB,UAAA,gBAAAK,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAH,EAACR,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,sBAAsB,GAAE;AAAA,IACvD,gBAAAY,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,MAAA,gBAAAH;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOd,EAAE,+BAA+B;AAAA,UACxC,aAAaA,EAAE,qCAAqC;AAAA,UACpD,aAAY;AAAA,UACZ,SAASL,EAAU,IAAI,CAAAF,OAAa;AAAA,YAClC,OAAOA,EAAS;AAAA,YAChB,OAAOD,EAAcC,CAAQ;AAAA,UAAA,EAC7B;AAAA,QAAA;AAAA,MAAA;AAAA,MAEJ,gBAAAiB,EAAC,OAAA,EACC,UAAA,gBAAAA,EAACR,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASJ,GAC7C,UAAAE,EAAE,gCAAgC,GACrC,EAAA,CACF;AAAA,IAAA,GACF;AAAA,sBACCe,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAL,EAACR,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASL,GAC7C,UAAAG,EAAE,SAAS,EAAA,CACd;AAAA,MACA,gBAAAU,EAACR,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UAAS,YAAYP,EAAU,WAAW,GACjF,UAAAK,EAAE,aAAa,EAAA,CAClB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"AssignmentScheduleStepPresentation.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useForm, FormProvider } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTranslation } from 'react-i18next'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport { scheduleLabel } from './scheduleLabel'\nimport { Flex, SelectField, ActionsLayout } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport interface AssignmentScheduleStepPresentationProps {\n schedules: PayScheduleShow[]\n defaultPayScheduleUuid?: string\n onBack: () => void\n onAddPaySchedule: () => void\n onContinue: (defaultPayScheduleUuid: string) => void\n}\n\nconst ScheduleStepSchema = z.object({\n defaultPayScheduleUuid: z.string().min(1),\n})\n\ntype ScheduleStepInputs = z.infer<typeof ScheduleStepSchema>\n\n/** @internal */\nexport function AssignmentScheduleStepPresentation({\n schedules,\n defaultPayScheduleUuid,\n onBack,\n onAddPaySchedule,\n onContinue,\n}: AssignmentScheduleStepPresentationProps) {\n const { t } = useTranslation('Company.Management.PayScheduleAssignment')\n const Components = useComponentContext()\n\n const formMethods = useForm<ScheduleStepInputs>({\n resolver: zodResolver(ScheduleStepSchema),\n defaultValues: { defaultPayScheduleUuid: defaultPayScheduleUuid ?? schedules[0]?.uuid ?? '' },\n })\n\n const handleSubmit = formMethods.handleSubmit(({ defaultPayScheduleUuid: uuid }) => {\n onContinue(uuid)\n })\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h2\">{t('scheduleStep.heading')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={12}>\n <SelectField\n name=\"defaultPayScheduleUuid\"\n label={t('scheduleStep.payScheduleLabel')}\n description={t('scheduleStep.payScheduleDescription')}\n placeholder=\"\"\n options={schedules.map(schedule => ({\n value: schedule.uuid,\n label: scheduleLabel(schedule),\n }))}\n />\n <div>\n <Components.Button variant=\"secondary\" onClick={onAddPaySchedule}>\n {t('scheduleStep.addPayScheduleCta')}\n </Components.Button>\n </div>\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={onBack}>\n {t('backCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\" isDisabled={schedules.length === 0}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["ScheduleStepSchema","z","AssignmentScheduleStepPresentation","schedules","defaultPayScheduleUuid","onBack","onAddPaySchedule","onContinue","useTranslation","Components","useComponentContext","formMethods","useForm","zodResolver","handleSubmit","uuid","FormProvider","jsx","Form","jsxs","Flex","SelectField","schedule","scheduleLabel","ActionsLayout"],"mappings":";;;;;;;;;;;AAmBA,MAAMA,IAAqBC,EAAE,OAAO;AAAA,EAClC,wBAAwBA,EAAE,OAAA,EAAS,IAAI,CAAC;AAC1C,CAAC;AAKM,SAASC,EAAmC;AAAA,EACjD,WAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AACF,GAA4C;AAC1C,QAAM,EAAE,EAAA,IAAMC,EAAe,0CAA0C,GACjEC,IAAaC,EAAA,GAEbC,IAAcC,EAA4B;AAAA,IAC9C,UAAUC,EAAYb,CAAkB;AAAA,IACxC,eAAe,EAAE,wBAAwBI,KAA0BD,EAAU,CAAC,GAAG,QAAQ,GAAA;AAAA,EAAG,CAC7F,GAEKW,IAAeH,EAAY,aAAa,CAAC,EAAE,wBAAwBI,QAAW;AAClF,IAAAR,EAAWQ,CAAI;AAAA,EACjB,CAAC;AAED,2BACGC,GAAA,EAAc,GAAGL,GAChB,UAAA,gBAAAM,EAACC,KAAK,UAAU,MAAA;AAAM,IAAKJ;KACzB,UAAA,gBAAAK,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAH,EAACR,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAA,EAAE,sBAAsB,GAAE;AAAA,IACvD,gBAAAU,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,MAAA,gBAAAH;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAO,EAAE,+BAA+B;AAAA,UACxC,aAAa,EAAE,qCAAqC;AAAA,UACpD,aAAY;AAAA,UACZ,SAASlB,EAAU,IAAI,CAAAmB,OAAa;AAAA,YAClC,OAAOA,EAAS;AAAA,YAChB,OAAOC,EAAcD,CAAQ;AAAA,UAAA,EAC7B;AAAA,QAAA;AAAA,MAAA;AAAA,MAEJ,gBAAAL,EAAC,OAAA,EACC,UAAA,gBAAAA,EAACR,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASH,GAC7C,UAAA,EAAE,gCAAgC,GACrC,EAAA,CACF;AAAA,IAAA,GACF;AAAA,sBACCkB,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAP,EAACR,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASJ,GAC7C,UAAA,EAAE,SAAS,EAAA,CACd;AAAA,MACA,gBAAAY,EAACR,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UAAS,YAAYN,EAAU,WAAW,GACjF,UAAA,EAAE,aAAa,EAAA,CAClB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -1,34 +1,37 @@
1
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
- import { z as p } from "zod";
1
+ import { jsx as t, jsxs as r } from "react/jsx-runtime";
2
+ import { z as n } from "zod";
3
3
  import { useForm as u, FormProvider as y } from "react-hook-form";
4
- import { zodResolver as h } from "@hookform/resolvers/zod";
5
- import { useTranslation as f } from "react-i18next";
6
- import { PayScheduleAssignmentBodyType as i } from "@gusto/embedded-api/models/components/payscheduleassignmentbody";
7
- import { Flex as l } from "../../../../Common/Flex/Flex.js";
8
- import { ActionsLayout as S } from "../../../../Common/ActionsLayout/ActionsLayout.js";
4
+ import { zodResolver as S } from "@hookform/resolvers/zod";
5
+ import { useTranslation as h } from "react-i18next";
6
+ import { PayScheduleAssignmentBodyType as o } from "@gusto/embedded-api/models/components/payscheduleassignmentbody";
7
+ import { Flex as p } from "../../../../Common/Flex/Flex.js";
8
+ import { ActionsLayout as f } from "../../../../Common/ActionsLayout/ActionsLayout.js";
9
9
  import { Form as g } from "../../../../Common/Form/Form.js";
10
10
  import { useComponentContext as b } from "../../../../../contexts/ComponentAdapter/useComponentContext.js";
11
11
  import { RadioGroupField as v } from "../../../../Common/Fields/RadioGroupField/RadioGroupField.js";
12
- const x = p.object({
13
- type: p.literal(i.Single)
12
+ const x = n.object({
13
+ type: n.union([
14
+ n.literal(o.Single),
15
+ n.literal(o.HourlySalaried)
16
+ ])
14
17
  });
15
18
  function L({
16
- defaultType: m = i.Single,
17
- onBack: a,
18
- onContinue: s
19
+ defaultType: a = o.Single,
20
+ onBack: s,
21
+ onContinue: m
19
22
  }) {
20
- const { t: e } = f("Company.Management.PayScheduleAssignment"), o = b(), r = u({
21
- resolver: h(x),
22
- defaultValues: { type: m }
23
- }), c = r.handleSubmit(({ type: d }) => {
24
- s(d);
23
+ const { t: e } = h("Company.Management.PayScheduleAssignment"), i = b(), l = u({
24
+ resolver: S(x),
25
+ defaultValues: { type: a }
26
+ }), d = l.handleSubmit(({ type: c }) => {
27
+ m(c);
25
28
  });
26
- return /* @__PURE__ */ t(y, { ...r, children: /* @__PURE__ */ t(g, { onSubmit: () => {
27
- c();
28
- }, children: /* @__PURE__ */ n(l, { flexDirection: "column", gap: 32, children: [
29
- /* @__PURE__ */ n(l, { flexDirection: "column", gap: 4, children: [
30
- /* @__PURE__ */ t(o.Heading, { as: "h2", children: e("typeStep.heading") }),
31
- /* @__PURE__ */ t(o.Text, { variant: "supporting", children: e("typeStep.description") })
29
+ return /* @__PURE__ */ t(y, { ...l, children: /* @__PURE__ */ t(g, { onSubmit: () => {
30
+ d();
31
+ }, children: /* @__PURE__ */ r(p, { flexDirection: "column", gap: 32, children: [
32
+ /* @__PURE__ */ r(p, { flexDirection: "column", gap: 4, children: [
33
+ /* @__PURE__ */ t(i.Heading, { as: "h2", children: e("typeStep.heading") }),
34
+ /* @__PURE__ */ t(i.Text, { variant: "supporting", children: e("typeStep.description") })
32
35
  ] }),
33
36
  /* @__PURE__ */ t(
34
37
  v,
@@ -38,16 +41,21 @@ function L({
38
41
  shouldVisuallyHideLabel: !0,
39
42
  options: [
40
43
  {
41
- value: i.Single,
44
+ value: o.Single,
42
45
  label: e("typeStep.options.single.label"),
43
46
  description: e("typeStep.options.single.description")
47
+ },
48
+ {
49
+ value: o.HourlySalaried,
50
+ label: e("typeStep.options.hourlySalaried.label"),
51
+ description: e("typeStep.options.hourlySalaried.description")
44
52
  }
45
53
  ]
46
54
  }
47
55
  ),
48
- /* @__PURE__ */ n(S, { children: [
49
- /* @__PURE__ */ t(o.Button, { variant: "secondary", onClick: a, children: e("backCta") }),
50
- /* @__PURE__ */ t(o.Button, { variant: "primary", type: "submit", children: e("continueCta") })
56
+ /* @__PURE__ */ r(f, { children: [
57
+ /* @__PURE__ */ t(i.Button, { variant: "secondary", onClick: s, children: e("backCta") }),
58
+ /* @__PURE__ */ t(i.Button, { variant: "primary", type: "submit", children: e("continueCta") })
51
59
  ] })
52
60
  ] }) }) });
53
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AssignmentTypeStepPresentation.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useForm, FormProvider } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTranslation } from 'react-i18next'\nimport { PayScheduleAssignmentBodyType } from '@gusto/embedded-api/models/components/payscheduleassignmentbody'\nimport { Flex, RadioGroupField, ActionsLayout } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport interface AssignmentTypeStepPresentationProps {\n defaultType?: typeof PayScheduleAssignmentBodyType.Single\n onBack: () => void\n onContinue: (type: PayScheduleAssignmentBodyType) => void\n}\n\nconst TypeStepSchema = z.object({\n type: z.literal(PayScheduleAssignmentBodyType.Single),\n})\n\ntype TypeStepInputs = z.infer<typeof TypeStepSchema>\n\n/** @internal */\nexport function AssignmentTypeStepPresentation({\n defaultType = PayScheduleAssignmentBodyType.Single,\n onBack,\n onContinue,\n}: AssignmentTypeStepPresentationProps) {\n const { t } = useTranslation('Company.Management.PayScheduleAssignment')\n const Components = useComponentContext()\n\n const formMethods = useForm<TypeStepInputs>({\n resolver: zodResolver(TypeStepSchema),\n defaultValues: { type: defaultType },\n })\n\n const handleSubmit = formMethods.handleSubmit(({ type }) => {\n onContinue(type)\n })\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={32}>\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Heading as=\"h2\">{t('typeStep.heading')}</Components.Heading>\n <Components.Text variant=\"supporting\">{t('typeStep.description')}</Components.Text>\n </Flex>\n <RadioGroupField\n name=\"type\"\n label={t('typeStep.heading')}\n shouldVisuallyHideLabel\n options={[\n {\n value: PayScheduleAssignmentBodyType.Single,\n label: t('typeStep.options.single.label'),\n description: t('typeStep.options.single.description'),\n },\n ]}\n />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={onBack}>\n {t('backCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\">\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["TypeStepSchema","z","PayScheduleAssignmentBodyType","AssignmentTypeStepPresentation","defaultType","onBack","onContinue","t","useTranslation","Components","useComponentContext","formMethods","useForm","zodResolver","handleSubmit","type","FormProvider","jsx","Form","jsxs","Flex","RadioGroupField","ActionsLayout"],"mappings":";;;;;;;;;;;AAgBA,MAAMA,IAAiBC,EAAE,OAAO;AAAA,EAC9B,MAAMA,EAAE,QAAQC,EAA8B,MAAM;AACtD,CAAC;AAKM,SAASC,EAA+B;AAAA,EAC7C,aAAAC,IAAcF,EAA8B;AAAA,EAC5C,QAAAG;AAAA,EACA,YAAAC;AACF,GAAwC;AACtC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,0CAA0C,GACjEC,IAAaC,EAAA,GAEbC,IAAcC,EAAwB;AAAA,IAC1C,UAAUC,EAAYb,CAAc;AAAA,IACpC,eAAe,EAAE,MAAMI,EAAA;AAAA,EAAY,CACpC,GAEKU,IAAeH,EAAY,aAAa,CAAC,EAAE,MAAAI,QAAW;AAC1D,IAAAT,EAAWS,CAAI;AAAA,EACjB,CAAC;AAED,2BACGC,GAAA,EAAc,GAAGL,GAChB,UAAA,gBAAAM,EAACC,KAAK,UAAU,MAAA;AAAM,IAAKJ;KACzB,UAAA,gBAAAK,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAD,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAH,EAACR,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,kBAAkB,GAAE;AAAA,MACnD,gBAAAU,EAACR,EAAW,MAAX,EAAgB,SAAQ,cAAc,UAAAF,EAAE,sBAAsB,EAAA,CAAE;AAAA,IAAA,GACnE;AAAA,IACA,gBAAAU;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOd,EAAE,kBAAkB;AAAA,QAC3B,yBAAuB;AAAA,QACvB,SAAS;AAAA,UACP;AAAA,YACE,OAAOL,EAA8B;AAAA,YACrC,OAAOK,EAAE,+BAA+B;AAAA,YACxC,aAAaA,EAAE,qCAAqC;AAAA,UAAA;AAAA,QACtD;AAAA,MACF;AAAA,IAAA;AAAA,sBAEDe,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAL,EAACR,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASJ,GAC7C,UAAAE,EAAE,SAAS,EAAA,CACd;AAAA,MACA,gBAAAU,EAACR,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UACvC,UAAAF,EAAE,aAAa,EAAA,CAClB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"AssignmentTypeStepPresentation.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useForm, FormProvider } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTranslation } from 'react-i18next'\nimport { PayScheduleAssignmentBodyType } from '@gusto/embedded-api/models/components/payscheduleassignmentbody'\nimport type { SupportedAssignmentType } from './usePayScheduleAssignment'\nimport { Flex, RadioGroupField, ActionsLayout } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport interface AssignmentTypeStepPresentationProps {\n defaultType?: SupportedAssignmentType\n onBack: () => void\n onContinue: (type: SupportedAssignmentType) => void\n}\n\nconst TypeStepSchema = z.object({\n type: z.union([\n z.literal(PayScheduleAssignmentBodyType.Single),\n z.literal(PayScheduleAssignmentBodyType.HourlySalaried),\n ]),\n})\n\ntype TypeStepInputs = z.infer<typeof TypeStepSchema>\n\n/** @internal */\nexport function AssignmentTypeStepPresentation({\n defaultType = PayScheduleAssignmentBodyType.Single,\n onBack,\n onContinue,\n}: AssignmentTypeStepPresentationProps) {\n const { t } = useTranslation('Company.Management.PayScheduleAssignment')\n const Components = useComponentContext()\n\n const formMethods = useForm<TypeStepInputs>({\n resolver: zodResolver(TypeStepSchema),\n defaultValues: { type: defaultType },\n })\n\n const handleSubmit = formMethods.handleSubmit(({ type }) => {\n onContinue(type)\n })\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={32}>\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Heading as=\"h2\">{t('typeStep.heading')}</Components.Heading>\n <Components.Text variant=\"supporting\">{t('typeStep.description')}</Components.Text>\n </Flex>\n <RadioGroupField\n name=\"type\"\n label={t('typeStep.heading')}\n shouldVisuallyHideLabel\n options={[\n {\n value: PayScheduleAssignmentBodyType.Single,\n label: t('typeStep.options.single.label'),\n description: t('typeStep.options.single.description'),\n },\n {\n value: PayScheduleAssignmentBodyType.HourlySalaried,\n label: t('typeStep.options.hourlySalaried.label'),\n description: t('typeStep.options.hourlySalaried.description'),\n },\n ]}\n />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={onBack}>\n {t('backCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\">\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["TypeStepSchema","z","PayScheduleAssignmentBodyType","AssignmentTypeStepPresentation","defaultType","onBack","onContinue","t","useTranslation","Components","useComponentContext","formMethods","useForm","zodResolver","handleSubmit","type","FormProvider","jsx","Form","jsxs","Flex","RadioGroupField","ActionsLayout"],"mappings":";;;;;;;;;;;AAiBA,MAAMA,IAAiBC,EAAE,OAAO;AAAA,EAC9B,MAAMA,EAAE,MAAM;AAAA,IACZA,EAAE,QAAQC,EAA8B,MAAM;AAAA,IAC9CD,EAAE,QAAQC,EAA8B,cAAc;AAAA,EAAA,CACvD;AACH,CAAC;AAKM,SAASC,EAA+B;AAAA,EAC7C,aAAAC,IAAcF,EAA8B;AAAA,EAC5C,QAAAG;AAAA,EACA,YAAAC;AACF,GAAwC;AACtC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,0CAA0C,GACjEC,IAAaC,EAAA,GAEbC,IAAcC,EAAwB;AAAA,IAC1C,UAAUC,EAAYb,CAAc;AAAA,IACpC,eAAe,EAAE,MAAMI,EAAA;AAAA,EAAY,CACpC,GAEKU,IAAeH,EAAY,aAAa,CAAC,EAAE,MAAAI,QAAW;AAC1D,IAAAT,EAAWS,CAAI;AAAA,EACjB,CAAC;AAED,2BACGC,GAAA,EAAc,GAAGL,GAChB,UAAA,gBAAAM,EAACC,KAAK,UAAU,MAAA;AAAM,IAAKJ;KACzB,UAAA,gBAAAK,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAD,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAH,EAACR,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,kBAAkB,GAAE;AAAA,MACnD,gBAAAU,EAACR,EAAW,MAAX,EAAgB,SAAQ,cAAc,UAAAF,EAAE,sBAAsB,EAAA,CAAE;AAAA,IAAA,GACnE;AAAA,IACA,gBAAAU;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOd,EAAE,kBAAkB;AAAA,QAC3B,yBAAuB;AAAA,QACvB,SAAS;AAAA,UACP;AAAA,YACE,OAAOL,EAA8B;AAAA,YACrC,OAAOK,EAAE,+BAA+B;AAAA,YACxC,aAAaA,EAAE,qCAAqC;AAAA,UAAA;AAAA,UAEtD;AAAA,YACE,OAAOL,EAA8B;AAAA,YACrC,OAAOK,EAAE,uCAAuC;AAAA,YAChD,aAAaA,EAAE,6CAA6C;AAAA,UAAA;AAAA,QAC9D;AAAA,MACF;AAAA,IAAA;AAAA,sBAEDe,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAL,EAACR,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASJ,GAC7C,UAAAE,EAAE,SAAS,EAAA,CACd;AAAA,MACA,gBAAAU,EAACR,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UACvC,UAAAF,EAAE,aAAa,EAAA,CAClB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -1,46 +1,67 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
2
  import { createMachine as p } from "robot3";
3
- import { useEffect as u, useMemo as f } from "react";
4
- import { useGustoEmbeddedContext as l } from "@gusto/embedded-api/react-query/_context";
5
- import { payScheduleAssignmentStateMachine as d } from "./payScheduleAssignmentStateMachine.js";
6
- import { AssignmentTypeStep as h } from "./PayScheduleAssignmentComponents.js";
7
- import { stripNullAssignmentPreviewFields as i } from "./stripNullAssignmentPreviewFields.js";
8
- import { Flow as g } from "../../../../Flow/Flow.js";
9
- import { BaseComponent as y } from "../../../../Base/Base.js";
10
- import { useBase as S } from "../../../../Base/useBase.js";
11
- import { useI18n as a, useComponentDictionary as A } from "../../../../../i18n/I18n.js";
12
- import { useUnstableFeature as C } from "../../../../../contexts/UnstableFeaturesProvider/useUnstableFeature.js";
13
- const j = ({
14
- companyId: o,
3
+ import { useEffect as f, useState as S, useMemo as h } from "react";
4
+ import { useGustoEmbeddedContext as y } from "@gusto/embedded-api/react-query/_context";
5
+ import { usePaySchedulesGetAssignmentsSuspense as g } from "@gusto/embedded-api/react-query/paySchedulesGetAssignments";
6
+ import { PayScheduleAssignmentType as a } from "@gusto/embedded-api/models/components/payscheduleassignment";
7
+ import { payScheduleAssignmentStateMachine as P } from "./payScheduleAssignmentStateMachine.js";
8
+ import { AssignmentTypeStep as A } from "./PayScheduleAssignmentComponents.js";
9
+ import { stripNullAssignmentPreviewFields as m } from "./stripNullAssignmentPreviewFields.js";
10
+ import { Flow as U } from "../../../../Flow/Flow.js";
11
+ import { BaseComponent as v } from "../../../../Base/Base.js";
12
+ import { useBase as C } from "../../../../Base/useBase.js";
13
+ import { useI18n as c, useComponentDictionary as k } from "../../../../../i18n/I18n.js";
14
+ import { useUnstableFeature as x } from "../../../../../contexts/UnstableFeaturesProvider/useUnstableFeature.js";
15
+ function M(e) {
16
+ switch (e) {
17
+ case a.Single:
18
+ case a.HourlySalaried:
19
+ return e;
20
+ default:
21
+ return;
22
+ }
23
+ }
24
+ function T(e) {
25
+ const t = M(e?.type);
26
+ return t ? {
27
+ assignmentType: t,
28
+ defaultPayScheduleUuid: e?.defaultPayScheduleUuid ?? void 0,
29
+ hourlyPayScheduleUuid: e?.hourlyPayScheduleUuid ?? void 0,
30
+ salariedPayScheduleUuid: e?.salariedPayScheduleUuid ?? void 0
31
+ } : {};
32
+ }
33
+ const I = ({
34
+ companyId: e,
15
35
  dictionary: t,
16
36
  ...n
17
- }) => (C("managePaySchedules", { throwIfDisabled: !0 }), /* @__PURE__ */ s(y, { ...n, children: /* @__PURE__ */ s(P, { companyId: o, dictionary: t }) }));
18
- function P({ companyId: o, dictionary: t }) {
19
- a("Company.Management.PayScheduleAssignment"), A("Company.Management.PayScheduleAssignment", t), a("Company.PaySchedule");
20
- const { onEvent: n } = S(), r = l();
21
- u(() => {
22
- const e = r._options.hooks;
23
- if (e)
24
- return e.registerAfterSuccessHook(i), () => {
25
- const m = e.afterSuccessHooks.indexOf(i);
26
- m !== -1 && e.afterSuccessHooks.splice(m, 1);
37
+ }) => (x("managePaySchedules", { throwIfDisabled: !0 }), /* @__PURE__ */ s(v, { ...n, children: /* @__PURE__ */ s(w, { companyId: e, dictionary: t }) }));
38
+ function w({ companyId: e, dictionary: t }) {
39
+ c("Company.Management.PayScheduleAssignment"), k("Company.Management.PayScheduleAssignment", t), c("Company.PaySchedule");
40
+ const { onEvent: n } = C(), r = y();
41
+ f(() => {
42
+ const o = r._options.hooks;
43
+ if (o)
44
+ return o.registerAfterSuccessHook(m), () => {
45
+ const u = o.afterSuccessHooks.indexOf(m);
46
+ u !== -1 && o.afterSuccessHooks.splice(u, 1);
27
47
  };
28
48
  }, [r]);
29
- const c = f(
49
+ const { data: d } = g({ companyId: e }), [i] = S(() => T(d.payScheduleAssignment)), l = h(
30
50
  () => p(
31
51
  "assignmentType",
32
- d,
33
- (e) => ({
34
- ...e,
35
- component: h,
36
- companyId: o
52
+ P,
53
+ (o) => ({
54
+ ...o,
55
+ component: A,
56
+ companyId: e,
57
+ ...i
37
58
  })
38
59
  ),
39
- [o]
60
+ [e, i]
40
61
  );
41
- return /* @__PURE__ */ s(g, { machine: c, onEvent: n });
62
+ return /* @__PURE__ */ s(U, { machine: l, onEvent: n });
42
63
  }
43
64
  export {
44
- j as PayScheduleAssignment
65
+ I as PayScheduleAssignment
45
66
  };
46
67
  //# sourceMappingURL=PayScheduleAssignment.js.map