@gusto/embedded-react-sdk 0.56.2 → 0.56.4

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 (154) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/components/Common/FieldCaption/FieldCaption.js +19 -22
  3. package/dist/components/Common/FieldCaption/FieldCaption.js.map +1 -1
  4. package/dist/components/Common/FieldCaption/FieldCaption.module.scss.js +6 -6
  5. package/dist/components/Common/PaginationControl/PaginationControl.js +66 -62
  6. package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
  7. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  8. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  9. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  10. package/dist/components/Company/PaySchedule/management/PaySchedule.js +60 -0
  11. package/dist/components/Company/PaySchedule/management/PaySchedule.js.map +1 -0
  12. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentReviewStepPresentation.js +67 -0
  13. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentReviewStepPresentation.js.map +1 -0
  14. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js +59 -0
  15. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js.map +1 -0
  16. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js +57 -0
  17. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js.map +1 -0
  18. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js +46 -0
  19. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js.map +1 -0
  20. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js +101 -0
  21. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js.map +1 -0
  22. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js +81 -0
  23. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js.map +1 -0
  24. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/stripNullAssignmentPreviewFields.js +18 -0
  25. package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/stripNullAssignmentPreviewFields.js.map +1 -0
  26. package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js +56 -0
  27. package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -0
  28. package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js +34 -0
  29. package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js.map +1 -0
  30. package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.js +77 -0
  31. package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.js.map +1 -0
  32. package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.module.scss.js +10 -0
  33. package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.module.scss.js.map +1 -0
  34. package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js +66 -0
  35. package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js.map +1 -0
  36. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +75 -57
  37. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  38. package/dist/components/Company/StateTaxes/shared/requirementSetError.js +15 -0
  39. package/dist/components/Company/StateTaxes/shared/requirementSetError.js.map +1 -0
  40. package/dist/components/Company/exports/companyManagement.js +7 -0
  41. package/dist/components/Company/exports/companyManagement.js.map +1 -0
  42. package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
  43. package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
  44. package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
  45. package/dist/components/Flow/Flow.js +1 -1
  46. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +28 -28
  47. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  48. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +51 -58
  49. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  50. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +12 -7
  51. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
  52. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +87 -85
  53. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  54. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +1 -1
  55. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  56. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +55 -54
  57. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  58. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +66 -62
  59. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  60. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +129 -125
  61. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  62. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +30 -27
  63. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  64. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js +41 -30
  65. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map +1 -1
  66. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js.map +1 -1
  67. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +159 -152
  68. package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
  69. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +61 -59
  70. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  71. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +32 -31
  72. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  73. package/dist/components/Payroll/PayrollList/PayrollList.js +16 -16
  74. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  75. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  76. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +61 -61
  77. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  78. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +192 -193
  79. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  80. package/dist/components/Payroll/Transition/TransitionFlow.js +27 -22
  81. package/dist/components/Payroll/Transition/TransitionFlow.js.map +1 -1
  82. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +55 -53
  83. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
  84. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js +44 -41
  85. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
  86. package/dist/components/Payroll/helpers.js +72 -67
  87. package/dist/components/Payroll/helpers.js.map +1 -1
  88. package/dist/components/Payroll/usePreparedPayrollData.js +34 -25
  89. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  90. package/dist/contexts/ApiProvider/ApiProvider.js +23 -22
  91. package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
  92. package/dist/contexts/ApiProvider/informationRequestEnumHook.js +30 -0
  93. package/dist/contexts/ApiProvider/informationRequestEnumHook.js.map +1 -0
  94. package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -1
  95. package/dist/helpers/dateFormatting.js.map +1 -1
  96. package/dist/helpers/formattedStrings.js +9 -8
  97. package/dist/helpers/formattedStrings.js.map +1 -1
  98. package/dist/i18n/I18n.js +2 -0
  99. package/dist/i18n/I18n.js.map +1 -1
  100. package/dist/i18n/en/Company.Management.PaySchedule.json.js +24 -0
  101. package/dist/i18n/en/Company.Management.PaySchedule.json.js.map +1 -0
  102. package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js +18 -0
  103. package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js.map +1 -0
  104. package/dist/i18n/en/Company.StateTaxes.json.js +1 -1
  105. package/dist/i18n/en/Payroll.GrossUpModal.json.js +12 -14
  106. package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -1
  107. package/dist/i18n/en/Payroll.PayrollOverview.json.js +1 -1
  108. package/dist/i18n/en/common.json.js +36 -38
  109. package/dist/i18n/en/common.json.js.map +1 -1
  110. package/dist/index.js +137 -135
  111. package/dist/index.js.map +1 -1
  112. package/dist/package.json.js +1 -1
  113. package/dist/shared/constants.js +39 -31
  114. package/dist/shared/constants.js.map +1 -1
  115. package/dist/src/components/Company/PaySchedule/management/PaySchedule.d.ts +24 -0
  116. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentReviewStepPresentation.d.ts +10 -0
  117. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.d.ts +11 -0
  118. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.d.ts +9 -0
  119. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.d.ts +35 -0
  120. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.d.ts +29 -0
  121. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/index.d.ts +1 -0
  122. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.d.ts +7 -0
  123. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/stripNullAssignmentPreviewFields.d.ts +12 -0
  124. package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/usePayScheduleAssignment.d.ts +9 -0
  125. package/dist/src/components/Company/PaySchedule/management/PayScheduleManagementComponents.d.ts +20 -0
  126. package/dist/src/components/Company/PaySchedule/management/PayScheduleOverview.d.ts +11 -0
  127. package/dist/src/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.d.ts +18 -0
  128. package/dist/src/components/Company/PaySchedule/management/index.d.ts +1 -0
  129. package/dist/src/components/Company/PaySchedule/management/payScheduleManagementStateMachine.d.ts +12 -0
  130. package/dist/src/components/Company/StateTaxes/shared/requirementSetError.d.ts +18 -0
  131. package/dist/src/components/Company/StateTaxes/shared/requirementSetError.test.d.ts +1 -0
  132. package/dist/src/components/Company/exports/companyManagement.d.ts +2 -0
  133. package/dist/src/components/Payroll/PayrollBlocker/payrollHelpers.d.ts +12 -0
  134. package/dist/src/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +6 -1
  135. package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.d.ts +2 -2
  136. package/dist/src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +6 -1
  137. package/dist/src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +7 -1
  138. package/dist/src/components/Payroll/helpers.d.ts +34 -0
  139. package/dist/src/components/Payroll/usePreparedPayrollData.d.ts +6 -1
  140. package/dist/src/components/index.d.ts +12 -0
  141. package/dist/src/contexts/ApiProvider/informationRequestEnumHook.d.ts +14 -0
  142. package/dist/src/contexts/ApiProvider/informationRequestEnumHook.test.d.ts +1 -0
  143. package/dist/src/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +2 -0
  144. package/dist/src/helpers/dateFormatting.d.ts +2 -2
  145. package/dist/src/helpers/formattedStrings.d.ts +15 -0
  146. package/dist/src/i18n/en/common.json.d.ts +0 -1
  147. package/dist/src/i18n/types.d.ts +96 -6
  148. package/dist/src/models/external.d.ts +12 -0
  149. package/dist/src/shared/constants.d.ts +16 -0
  150. package/dist/style.css +1 -1
  151. package/dist/types/sdkError.js +32 -21
  152. package/dist/types/sdkError.js.map +1 -1
  153. package/docs/guides/endpoint-inventory.json +59 -10
  154. package/package.json +7 -7
@@ -0,0 +1,57 @@
1
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
+ import { z as p } from "zod";
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";
9
+ import { Form as g } from "../../../../Common/Form/Form.js";
10
+ import { useComponentContext as b } from "../../../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ import { RadioGroupField as v } from "../../../../Common/Fields/RadioGroupField/RadioGroupField.js";
12
+ const x = p.object({
13
+ type: p.literal(i.Single)
14
+ });
15
+ function L({
16
+ defaultType: m = i.Single,
17
+ onBack: a,
18
+ onContinue: s
19
+ }) {
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);
25
+ });
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") })
32
+ ] }),
33
+ /* @__PURE__ */ t(
34
+ v,
35
+ {
36
+ name: "type",
37
+ label: e("typeStep.heading"),
38
+ shouldVisuallyHideLabel: !0,
39
+ options: [
40
+ {
41
+ value: i.Single,
42
+ label: e("typeStep.options.single.label"),
43
+ description: e("typeStep.options.single.description")
44
+ }
45
+ ]
46
+ }
47
+ ),
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") })
51
+ ] })
52
+ ] }) }) });
53
+ }
54
+ export {
55
+ L as AssignmentTypeStepPresentation
56
+ };
57
+ //# sourceMappingURL=AssignmentTypeStepPresentation.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,46 @@
1
+ import { jsx as s } from "react/jsx-runtime";
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,
15
+ dictionary: t,
16
+ ...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);
27
+ };
28
+ }, [r]);
29
+ const c = f(
30
+ () => p(
31
+ "assignmentType",
32
+ d,
33
+ (e) => ({
34
+ ...e,
35
+ component: h,
36
+ companyId: o
37
+ })
38
+ ),
39
+ [o]
40
+ );
41
+ return /* @__PURE__ */ s(g, { machine: c, onEvent: n });
42
+ }
43
+ export {
44
+ j as PayScheduleAssignment
45
+ };
46
+ //# sourceMappingURL=PayScheduleAssignment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayScheduleAssignment.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useEffect, useMemo } from 'react'\nimport { useGustoEmbeddedContext } from '@gusto/embedded-api/react-query/_context'\nimport { payScheduleAssignmentStateMachine } from './payScheduleAssignmentStateMachine'\nimport { AssignmentTypeStep } from './PayScheduleAssignmentComponents'\nimport type { PayScheduleAssignmentContextInterface } from './usePayScheduleAssignment'\nimport { stripNullAssignmentPreviewFields } from './stripNullAssignmentPreviewFields'\nimport { Flow } from '@/components/Flow/Flow'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport type { BaseComponentKeys } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { useUnstableFeature } from '@/contexts/UnstableFeaturesProvider/useUnstableFeature'\n\n/**\n * Props for {@link PayScheduleAssignment}.\n *\n * @alpha\n */\nexport interface PayScheduleAssignmentProps extends BaseComponentInterface<'Company.Management.PayScheduleAssignment'> {\n /** Company whose pay schedule assignment is managed. */\n companyId: string\n}\n\n/**\n * Assigns a company's employees to a pay schedule.\n *\n * @remarks\n * Walks through choosing an assignment type, picking (or creating) a pay schedule, and reviewing\n * the employees and transition payrolls affected before submitting. Only the single-schedule\n * assignment type is currently supported. Can be mounted directly or launched from\n * `CompanyManagement.PaySchedule`'s Manage action.\n *\n * The internal step-to-step selection events (assignment type chosen, schedule picked) also\n * bubble through `onEvent` as a side effect of how the underlying `Flow` re-emits every event —\n * they carry no information a host needs mid-flow, since `assigned` reports the final outcome,\n * so they're intentionally left out of the table below.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `paySchedule/create` | The user chose to add a new pay schedule from the picker step | — |\n * | `paySchedule/created` | A new pay schedule was created from the picker step | `{ paySchedule: PayScheduleShow }` |\n * | `paySchedule/management/assignment/cancel` | The user backed out of the flow entirely, from the first step | — |\n * | `paySchedule/management/assignment/assigned` | The assignment was submitted successfully | `{ type: PayScheduleAssignmentBodyType; defaultPayScheduleUuid: string; employeeChanges: PayScheduleAssignmentEmployeeChange[] }` |\n *\n * @alpha\n */\nexport const PayScheduleAssignment = ({\n companyId,\n dictionary,\n ...props\n}: PayScheduleAssignmentProps) => {\n useUnstableFeature('managePaySchedules', { throwIfDisabled: true })\n\n return (\n <BaseComponent {...props}>\n <Root companyId={companyId} dictionary={dictionary} />\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, dictionary }: Omit<PayScheduleAssignmentProps, BaseComponentKeys>) {\n useI18n('Company.Management.PayScheduleAssignment')\n useComponentDictionary('Company.Management.PayScheduleAssignment', dictionary)\n // AssignmentCreateScheduleStep reuses the onboarding PayScheduleForm, whose translations live\n // under its own namespace and are otherwise never loaded from this flow.\n useI18n('Company.PaySchedule')\n const { onEvent } = useBase()\n\n // Temporary: patch the assignment-preview response before the SDK validates it, and log\n // request/error details for debugging. See stripNullAssignmentPreviewFields for why —\n // remove both alongside it once the OAS is fixed upstream.\n const client = useGustoEmbeddedContext()\n useEffect(() => {\n const hooks = client._options.hooks\n if (!hooks) return\n hooks.registerAfterSuccessHook(stripNullAssignmentPreviewFields)\n\n return () => {\n // Remove only the single instance this effect registered — filtering the array would\n // also drop another concurrently-mounted instance's registration of the same hook.\n const index = hooks.afterSuccessHooks.indexOf(stripNullAssignmentPreviewFields)\n if (index !== -1) {\n hooks.afterSuccessHooks.splice(index, 1)\n }\n }\n }, [client])\n\n const machine = useMemo(\n () =>\n createMachine(\n 'assignmentType',\n payScheduleAssignmentStateMachine,\n (initialContext: PayScheduleAssignmentContextInterface) => ({\n ...initialContext,\n component: AssignmentTypeStep,\n companyId,\n }),\n ),\n [companyId],\n )\n\n return <Flow machine={machine} onEvent={onEvent} />\n}\n"],"names":["PayScheduleAssignment","companyId","dictionary","props","useUnstableFeature","jsx","BaseComponent","Root","useI18n","useComponentDictionary","onEvent","useBase","client","useGustoEmbeddedContext","useEffect","hooks","stripNullAssignmentPreviewFields","index","machine","useMemo","createMachine","payScheduleAssignmentStateMachine","initialContext","AssignmentTypeStep","Flow"],"mappings":";;;;;;;;;;;;AAgDO,MAAMA,IAAwB,CAAC;AAAA,EACpC,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,OACEC,EAAmB,sBAAsB,EAAE,iBAAiB,GAAA,CAAM,GAGhE,gBAAAC,EAACC,KAAe,GAAGH,GACjB,4BAACI,GAAA,EAAK,WAAAN,GAAsB,YAAAC,GAAwB,EAAA,CACtD;AAIJ,SAASK,EAAK,EAAE,WAAAN,GAAW,YAAAC,KAAmE;AAC5F,EAAAM,EAAQ,0CAA0C,GAClDC,EAAuB,4CAA4CP,CAAU,GAG7EM,EAAQ,qBAAqB;AAC7B,QAAM,EAAE,SAAAE,EAAA,IAAYC,EAAA,GAKdC,IAASC,EAAA;AACf,EAAAC,EAAU,MAAM;AACd,UAAMC,IAAQH,EAAO,SAAS;AAC9B,QAAKG;AACL,aAAAA,EAAM,yBAAyBC,CAAgC,GAExD,MAAM;AAGX,cAAMC,IAAQF,EAAM,kBAAkB,QAAQC,CAAgC;AAC9E,QAAIC,MAAU,MACZF,EAAM,kBAAkB,OAAOE,GAAO,CAAC;AAAA,MAE3C;AAAA,EACF,GAAG,CAACL,CAAM,CAAC;AAEX,QAAMM,IAAUC;AAAA,IACd,MACEC;AAAA,MACE;AAAA,MACAC;AAAA,MACA,CAACC,OAA2D;AAAA,QAC1D,GAAGA;AAAA,QACH,WAAWC;AAAA,QACX,WAAAtB;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACA,CAAS;AAAA,EAAA;AAGZ,SAAO,gBAAAI,EAACmB,GAAA,EAAK,SAAAN,GAAkB,SAAAR,EAAA,CAAkB;AACnD;"}
@@ -0,0 +1,101 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { useState as g, useMemo as P, useEffect as h } from "react";
3
+ import { usePaySchedulesGetAllSuspense as C } from "@gusto/embedded-api/react-query/paySchedulesGetAll";
4
+ import { usePaySchedulesPreviewAssignmentMutation as _ } from "@gusto/embedded-api/react-query/paySchedulesPreviewAssignment";
5
+ import { usePaySchedulesAssignMutation as v } from "@gusto/embedded-api/react-query/paySchedulesAssign";
6
+ import { PayScheduleAssignmentBodyType as p } from "@gusto/embedded-api/models/components/payscheduleassignmentbody";
7
+ import { AssignmentTypeStepPresentation as T } from "./AssignmentTypeStepPresentation.js";
8
+ import { AssignmentScheduleStepPresentation as L } from "./AssignmentScheduleStepPresentation.js";
9
+ import { AssignmentReviewStepPresentation as I } from "./AssignmentReviewStepPresentation.js";
10
+ import { PayScheduleForm as U } from "../../PayScheduleForm.js";
11
+ import { useFlow as d } from "../../../../Flow/useFlow.js";
12
+ import { BaseLayout as N } from "../../../../Base/Base.js";
13
+ import { useBase as D } from "../../../../Base/useBase.js";
14
+ import { ensureRequired as u } from "../../../../../helpers/ensureRequired.js";
15
+ import { componentEvents as s } from "../../../../../shared/constants.js";
16
+ function J() {
17
+ const { assignmentType: e, onEvent: n } = d();
18
+ return /* @__PURE__ */ a(
19
+ T,
20
+ {
21
+ defaultType: e === p.Single ? e : void 0,
22
+ onBack: () => {
23
+ n(s.PAY_SCHEDULE_ASSIGNMENT_CANCEL);
24
+ },
25
+ onContinue: (t) => {
26
+ n(s.PAY_SCHEDULE_ASSIGNMENT_TYPE_SELECTED, { type: t });
27
+ }
28
+ }
29
+ );
30
+ }
31
+ function O() {
32
+ const { companyId: e, defaultPayScheduleUuid: n, onEvent: t } = d(), { data: m } = C({
33
+ companyId: u(e)
34
+ }), i = m.payScheduleShowResponse ?? [], S = i.find((o) => o.active);
35
+ return /* @__PURE__ */ a(
36
+ L,
37
+ {
38
+ schedules: i,
39
+ defaultPayScheduleUuid: n ?? S?.uuid,
40
+ onBack: () => {
41
+ t(s.PAY_SCHEDULE_ASSIGNMENT_BACK);
42
+ },
43
+ onAddPaySchedule: () => {
44
+ t(s.PAY_SCHEDULE_CREATE);
45
+ },
46
+ onContinue: (o) => {
47
+ t(s.PAY_SCHEDULE_ASSIGNMENT_SCHEDULE_SELECTED, {
48
+ defaultPayScheduleUuid: o
49
+ });
50
+ }
51
+ }
52
+ );
53
+ }
54
+ function Q() {
55
+ const { companyId: e, onEvent: n } = d();
56
+ return /* @__PURE__ */ a(U, { companyId: u(e), onEvent: n });
57
+ }
58
+ function V() {
59
+ const { companyId: e, assignmentType: n, defaultPayScheduleUuid: t, onEvent: m } = d(), { baseSubmitHandler: i, error: S } = D(), [o, y] = g(null), { mutateAsync: c, isPending: l } = _(), { mutateAsync: E, isPending: A } = v(), r = P(
60
+ () => ({
61
+ type: n ?? p.Single,
62
+ defaultPayScheduleUuid: t
63
+ }),
64
+ [n, t]
65
+ );
66
+ return h(() => {
67
+ i(void 0, async () => {
68
+ const f = await c({
69
+ request: { companyId: u(e), payScheduleAssignmentBody: r }
70
+ });
71
+ y(f.payScheduleAssignmentPreview?.employeeChanges ?? []);
72
+ });
73
+ }, [e, r, c, i]), S ? null : l || !o ? /* @__PURE__ */ a(N, { isLoading: !0 }) : /* @__PURE__ */ a(
74
+ I,
75
+ {
76
+ employeeChanges: o,
77
+ isSubmitting: A,
78
+ onBack: () => {
79
+ m(s.PAY_SCHEDULE_ASSIGNMENT_BACK);
80
+ },
81
+ onSubmit: () => {
82
+ i(void 0, async () => {
83
+ await E({
84
+ request: { companyId: u(e), payScheduleAssignmentBody: r }
85
+ }), m(s.PAY_SCHEDULE_ASSIGNED, {
86
+ type: r.type,
87
+ defaultPayScheduleUuid: u(t),
88
+ employeeChanges: o
89
+ });
90
+ });
91
+ }
92
+ }
93
+ );
94
+ }
95
+ export {
96
+ Q as AssignmentCreateScheduleStep,
97
+ V as AssignmentReviewStep,
98
+ O as AssignmentScheduleStep,
99
+ J as AssignmentTypeStep
100
+ };
101
+ //# sourceMappingURL=PayScheduleAssignmentComponents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayScheduleAssignmentComponents.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react'\nimport { usePaySchedulesGetAllSuspense } from '@gusto/embedded-api/react-query/paySchedulesGetAll'\nimport { usePaySchedulesPreviewAssignmentMutation } from '@gusto/embedded-api/react-query/paySchedulesPreviewAssignment'\nimport { usePaySchedulesAssignMutation } from '@gusto/embedded-api/react-query/paySchedulesAssign'\nimport { PayScheduleAssignmentBodyType } from '@gusto/embedded-api/models/components/payscheduleassignmentbody'\nimport type { PayScheduleAssignmentBody } from '@gusto/embedded-api/models/components/payscheduleassignmentbody'\nimport type { PayScheduleAssignmentEmployeeChange } from '@gusto/embedded-api/models/components/payscheduleassignmentemployeechange'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport { AssignmentTypeStepPresentation } from './AssignmentTypeStepPresentation'\nimport { AssignmentScheduleStepPresentation } from './AssignmentScheduleStepPresentation'\nimport { AssignmentReviewStepPresentation } from './AssignmentReviewStepPresentation'\nimport type { PayScheduleAssignmentContextInterface } from './usePayScheduleAssignment'\nimport { PayScheduleForm } from '@/components/Company/PaySchedule/PayScheduleForm'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useBase, BaseLayout } from '@/components/Base'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { componentEvents } from '@/shared/constants'\n\n/** @internal */\nexport type EventPayloads = {\n [componentEvents.PAY_SCHEDULE_ASSIGNMENT_TYPE_SELECTED]: { type: PayScheduleAssignmentBodyType }\n [componentEvents.PAY_SCHEDULE_ASSIGNMENT_SCHEDULE_SELECTED]: { defaultPayScheduleUuid: string }\n [componentEvents.PAY_SCHEDULE_CREATED]: { paySchedule: PayScheduleShow }\n [componentEvents.PAY_SCHEDULE_ASSIGNED]: {\n type: PayScheduleAssignmentBodyType\n defaultPayScheduleUuid: string\n employeeChanges: PayScheduleAssignmentEmployeeChange[]\n }\n}\n\n/** @internal */\nexport function AssignmentTypeStep() {\n const { assignmentType, onEvent } = useFlow<PayScheduleAssignmentContextInterface>()\n\n return (\n <AssignmentTypeStepPresentation\n defaultType={\n assignmentType === PayScheduleAssignmentBodyType.Single ? assignmentType : undefined\n }\n onBack={() => {\n onEvent(componentEvents.PAY_SCHEDULE_ASSIGNMENT_CANCEL)\n }}\n onContinue={type => {\n onEvent(componentEvents.PAY_SCHEDULE_ASSIGNMENT_TYPE_SELECTED, { type })\n }}\n />\n )\n}\n\n/** @internal */\nexport function AssignmentScheduleStep() {\n const { companyId, defaultPayScheduleUuid, onEvent } =\n useFlow<PayScheduleAssignmentContextInterface>()\n const { data: paySchedules } = usePaySchedulesGetAllSuspense({\n companyId: ensureRequired(companyId),\n })\n const schedules = paySchedules.payScheduleShowResponse ?? []\n const activeSchedule = schedules.find(s => s.active)\n\n return (\n <AssignmentScheduleStepPresentation\n schedules={schedules}\n defaultPayScheduleUuid={defaultPayScheduleUuid ?? activeSchedule?.uuid}\n onBack={() => {\n onEvent(componentEvents.PAY_SCHEDULE_ASSIGNMENT_BACK)\n }}\n onAddPaySchedule={() => {\n onEvent(componentEvents.PAY_SCHEDULE_CREATE)\n }}\n onContinue={uuid => {\n onEvent(componentEvents.PAY_SCHEDULE_ASSIGNMENT_SCHEDULE_SELECTED, {\n defaultPayScheduleUuid: uuid,\n })\n }}\n />\n )\n}\n\n/** @internal */\nexport function AssignmentCreateScheduleStep() {\n const { companyId, onEvent } = useFlow<PayScheduleAssignmentContextInterface>()\n\n return <PayScheduleForm companyId={ensureRequired(companyId)} onEvent={onEvent} />\n}\n\n/** @internal */\nexport function AssignmentReviewStep() {\n const { companyId, assignmentType, defaultPayScheduleUuid, onEvent } =\n useFlow<PayScheduleAssignmentContextInterface>()\n const { baseSubmitHandler, error } = useBase()\n const [employeeChanges, setEmployeeChanges] = useState<\n PayScheduleAssignmentEmployeeChange[] | null\n >(null)\n const { mutateAsync: previewAssignment, isPending: isPreviewLoading } =\n usePaySchedulesPreviewAssignmentMutation()\n const { mutateAsync: assignSchedules, isPending: isAssigning } = usePaySchedulesAssignMutation()\n\n const payScheduleAssignmentBody: PayScheduleAssignmentBody = useMemo(\n () => ({\n type: assignmentType ?? PayScheduleAssignmentBodyType.Single,\n defaultPayScheduleUuid,\n }),\n [assignmentType, defaultPayScheduleUuid],\n )\n\n useEffect(() => {\n void baseSubmitHandler(undefined, async () => {\n const response = await previewAssignment({\n request: { companyId: ensureRequired(companyId), payScheduleAssignmentBody },\n })\n setEmployeeChanges(response.payScheduleAssignmentPreview?.employeeChanges ?? [])\n })\n }, [companyId, payScheduleAssignmentBody, previewAssignment, baseSubmitHandler])\n\n // The enclosing BaseComponent's own BaseLayout already renders `error` for this whole\n // component tree, so surface only the loading state here to avoid rendering it twice.\n if (error) {\n return null\n }\n if (isPreviewLoading || !employeeChanges) {\n return <BaseLayout isLoading />\n }\n\n return (\n <AssignmentReviewStepPresentation\n employeeChanges={employeeChanges}\n isSubmitting={isAssigning}\n onBack={() => {\n onEvent(componentEvents.PAY_SCHEDULE_ASSIGNMENT_BACK)\n }}\n onSubmit={() => {\n void baseSubmitHandler(undefined, async () => {\n await assignSchedules({\n request: { companyId: ensureRequired(companyId), payScheduleAssignmentBody },\n })\n onEvent(componentEvents.PAY_SCHEDULE_ASSIGNED, {\n type: payScheduleAssignmentBody.type,\n defaultPayScheduleUuid: ensureRequired(defaultPayScheduleUuid),\n employeeChanges,\n })\n })\n }}\n />\n )\n}\n"],"names":["AssignmentTypeStep","assignmentType","onEvent","useFlow","jsx","AssignmentTypeStepPresentation","PayScheduleAssignmentBodyType","componentEvents","type","AssignmentScheduleStep","companyId","defaultPayScheduleUuid","paySchedules","usePaySchedulesGetAllSuspense","ensureRequired","schedules","activeSchedule","s","AssignmentScheduleStepPresentation","uuid","AssignmentCreateScheduleStep","PayScheduleForm","AssignmentReviewStep","baseSubmitHandler","error","useBase","employeeChanges","setEmployeeChanges","useState","previewAssignment","isPreviewLoading","usePaySchedulesPreviewAssignmentMutation","assignSchedules","isAssigning","usePaySchedulesAssignMutation","payScheduleAssignmentBody","useMemo","useEffect","response","BaseLayout","AssignmentReviewStepPresentation"],"mappings":";;;;;;;;;;;;;;;AA+BO,SAASA,IAAqB;AACnC,QAAM,EAAE,gBAAAC,GAAgB,SAAAC,EAAA,IAAYC,EAAA;AAEpC,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,aACEJ,MAAmBK,EAA8B,SAASL,IAAiB;AAAA,MAE7E,QAAQ,MAAM;AACZ,QAAAC,EAAQK,EAAgB,8BAA8B;AAAA,MACxD;AAAA,MACA,YAAY,CAAAC,MAAQ;AAClB,QAAAN,EAAQK,EAAgB,uCAAuC,EAAE,MAAAC,EAAA,CAAM;AAAA,MACzE;AAAA,IAAA;AAAA,EAAA;AAGN;AAGO,SAASC,IAAyB;AACvC,QAAM,EAAE,WAAAC,GAAW,wBAAAC,GAAwB,SAAAT,EAAA,IACzCC,EAAA,GACI,EAAE,MAAMS,EAAA,IAAiBC,EAA8B;AAAA,IAC3D,WAAWC,EAAeJ,CAAS;AAAA,EAAA,CACpC,GACKK,IAAYH,EAAa,2BAA2B,CAAA,GACpDI,IAAiBD,EAAU,KAAK,CAAAE,MAAKA,EAAE,MAAM;AAEnD,SACE,gBAAAb;AAAA,IAACc;AAAA,IAAA;AAAA,MACC,WAAAH;AAAA,MACA,wBAAwBJ,KAA0BK,GAAgB;AAAA,MAClE,QAAQ,MAAM;AACZ,QAAAd,EAAQK,EAAgB,4BAA4B;AAAA,MACtD;AAAA,MACA,kBAAkB,MAAM;AACtB,QAAAL,EAAQK,EAAgB,mBAAmB;AAAA,MAC7C;AAAA,MACA,YAAY,CAAAY,MAAQ;AAClB,QAAAjB,EAAQK,EAAgB,2CAA2C;AAAA,UACjE,wBAAwBY;AAAA,QAAA,CACzB;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAGO,SAASC,IAA+B;AAC7C,QAAM,EAAE,WAAAV,GAAW,SAAAR,EAAA,IAAYC,EAAA;AAE/B,2BAAQkB,GAAA,EAAgB,WAAWP,EAAeJ,CAAS,GAAG,SAAAR,GAAkB;AAClF;AAGO,SAASoB,IAAuB;AACrC,QAAM,EAAE,WAAAZ,GAAW,gBAAAT,GAAgB,wBAAAU,GAAwB,SAAAT,EAAA,IACzDC,EAAA,GACI,EAAE,mBAAAoB,GAAmB,OAAAC,EAAA,IAAUC,EAAA,GAC/B,CAACC,GAAiBC,CAAkB,IAAIC,EAE5C,IAAI,GACA,EAAE,aAAaC,GAAmB,WAAWC,EAAA,IACjDC,EAAA,GACI,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAAgBC,EAAA,GAE3DC,IAAuDC;AAAA,IAC3D,OAAO;AAAA,MACL,MAAMnC,KAAkBK,EAA8B;AAAA,MACtD,wBAAAK;AAAA,IAAA;AAAA,IAEF,CAACV,GAAgBU,CAAsB;AAAA,EAAA;AAczC,SAXA0B,EAAU,MAAM;AACd,IAAKd,EAAkB,QAAW,YAAY;AAC5C,YAAMe,IAAW,MAAMT,EAAkB;AAAA,QACvC,SAAS,EAAE,WAAWf,EAAeJ,CAAS,GAAG,2BAAAyB,EAAA;AAAA,MAA0B,CAC5E;AACD,MAAAR,EAAmBW,EAAS,8BAA8B,mBAAmB,CAAA,CAAE;AAAA,IACjF,CAAC;AAAA,EACH,GAAG,CAAC5B,GAAWyB,GAA2BN,GAAmBN,CAAiB,CAAC,GAI3EC,IACK,OAELM,KAAoB,CAACJ,IAChB,gBAAAtB,EAACmC,GAAA,EAAW,WAAS,GAAA,CAAC,IAI7B,gBAAAnC;AAAA,IAACoC;AAAA,IAAA;AAAA,MACC,iBAAAd;AAAA,MACA,cAAcO;AAAA,MACd,QAAQ,MAAM;AACZ,QAAA/B,EAAQK,EAAgB,4BAA4B;AAAA,MACtD;AAAA,MACA,UAAU,MAAM;AACd,QAAKgB,EAAkB,QAAW,YAAY;AAC5C,gBAAMS,EAAgB;AAAA,YACpB,SAAS,EAAE,WAAWlB,EAAeJ,CAAS,GAAG,2BAAAyB,EAAA;AAAA,UAA0B,CAC5E,GACDjC,EAAQK,EAAgB,uBAAuB;AAAA,YAC7C,MAAM4B,EAA0B;AAAA,YAChC,wBAAwBrB,EAAeH,CAAsB;AAAA,YAC7D,iBAAAe;AAAA,UAAA,CACD;AAAA,QACH,CAAC;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,81 @@
1
+ import { state as a, transition as n, reduce as s } from "robot3";
2
+ import { AssignmentScheduleStep as i, AssignmentTypeStep as E, AssignmentCreateScheduleStep as o, AssignmentReviewStep as c } from "./PayScheduleAssignmentComponents.js";
3
+ import { componentEvents as t } from "../../../../../shared/constants.js";
4
+ const m = s(
5
+ (e) => ({
6
+ ...e,
7
+ component: i
8
+ })
9
+ ), l = {
10
+ assignmentType: a(
11
+ n(
12
+ t.PAY_SCHEDULE_ASSIGNMENT_TYPE_SELECTED,
13
+ "assignmentSchedule",
14
+ s(
15
+ (e, S) => ({
16
+ ...e,
17
+ component: i,
18
+ assignmentType: S.payload.type
19
+ })
20
+ )
21
+ )
22
+ ),
23
+ assignmentSchedule: a(
24
+ n(
25
+ t.PAY_SCHEDULE_ASSIGNMENT_BACK,
26
+ "assignmentType",
27
+ s(
28
+ (e) => ({
29
+ ...e,
30
+ component: E
31
+ })
32
+ )
33
+ ),
34
+ n(
35
+ t.PAY_SCHEDULE_CREATE,
36
+ "assignmentCreateSchedule",
37
+ s(
38
+ (e) => ({
39
+ ...e,
40
+ component: o
41
+ })
42
+ )
43
+ ),
44
+ n(
45
+ t.PAY_SCHEDULE_ASSIGNMENT_SCHEDULE_SELECTED,
46
+ "assignmentReview",
47
+ s(
48
+ (e, S) => ({
49
+ ...e,
50
+ component: c,
51
+ defaultPayScheduleUuid: S.payload.defaultPayScheduleUuid
52
+ })
53
+ )
54
+ )
55
+ ),
56
+ assignmentCreateSchedule: a(
57
+ n(
58
+ t.PAY_SCHEDULE_CREATED,
59
+ "assignmentSchedule",
60
+ s(
61
+ (e, S) => ({
62
+ ...e,
63
+ component: i,
64
+ defaultPayScheduleUuid: S.payload.paySchedule.uuid
65
+ })
66
+ )
67
+ ),
68
+ n(t.CANCEL, "assignmentSchedule", m)
69
+ ),
70
+ assignmentReview: a(
71
+ n(
72
+ t.PAY_SCHEDULE_ASSIGNMENT_BACK,
73
+ "assignmentSchedule",
74
+ m
75
+ )
76
+ )
77
+ };
78
+ export {
79
+ l as payScheduleAssignmentStateMachine
80
+ };
81
+ //# sourceMappingURL=payScheduleAssignmentStateMachine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payScheduleAssignmentStateMachine.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.ts"],"sourcesContent":["import { state, transition, reduce } from 'robot3'\nimport type { ComponentType } from 'react'\nimport {\n AssignmentTypeStep,\n AssignmentScheduleStep,\n AssignmentCreateScheduleStep,\n AssignmentReviewStep,\n} from './PayScheduleAssignmentComponents'\nimport type { EventPayloads } from './PayScheduleAssignmentComponents'\nimport type { PayScheduleAssignmentContextInterface } from './usePayScheduleAssignment'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\n\nconst toAssignmentSchedule = reduce(\n (ctx: PayScheduleAssignmentContextInterface): PayScheduleAssignmentContextInterface => ({\n ...ctx,\n component: AssignmentScheduleStep as ComponentType,\n }),\n)\n\n/** @internal */\nexport const payScheduleAssignmentStateMachine = {\n assignmentType: state<MachineTransition>(\n transition(\n componentEvents.PAY_SCHEDULE_ASSIGNMENT_TYPE_SELECTED,\n 'assignmentSchedule',\n reduce(\n (\n ctx: PayScheduleAssignmentContextInterface,\n ev: MachineEventType<\n EventPayloads,\n typeof componentEvents.PAY_SCHEDULE_ASSIGNMENT_TYPE_SELECTED\n >,\n ): PayScheduleAssignmentContextInterface => ({\n ...ctx,\n component: AssignmentScheduleStep as ComponentType,\n assignmentType: ev.payload.type,\n }),\n ),\n ),\n ),\n assignmentSchedule: state<MachineTransition>(\n transition(\n componentEvents.PAY_SCHEDULE_ASSIGNMENT_BACK,\n 'assignmentType',\n reduce(\n (ctx: PayScheduleAssignmentContextInterface): PayScheduleAssignmentContextInterface => ({\n ...ctx,\n component: AssignmentTypeStep as ComponentType,\n }),\n ),\n ),\n transition(\n componentEvents.PAY_SCHEDULE_CREATE,\n 'assignmentCreateSchedule',\n reduce(\n (ctx: PayScheduleAssignmentContextInterface): PayScheduleAssignmentContextInterface => ({\n ...ctx,\n component: AssignmentCreateScheduleStep as ComponentType,\n }),\n ),\n ),\n transition(\n componentEvents.PAY_SCHEDULE_ASSIGNMENT_SCHEDULE_SELECTED,\n 'assignmentReview',\n reduce(\n (\n ctx: PayScheduleAssignmentContextInterface,\n ev: MachineEventType<\n EventPayloads,\n typeof componentEvents.PAY_SCHEDULE_ASSIGNMENT_SCHEDULE_SELECTED\n >,\n ): PayScheduleAssignmentContextInterface => ({\n ...ctx,\n component: AssignmentReviewStep as ComponentType,\n defaultPayScheduleUuid: ev.payload.defaultPayScheduleUuid,\n }),\n ),\n ),\n ),\n assignmentCreateSchedule: state<MachineTransition>(\n transition(\n componentEvents.PAY_SCHEDULE_CREATED,\n 'assignmentSchedule',\n reduce(\n (\n ctx: PayScheduleAssignmentContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.PAY_SCHEDULE_CREATED>,\n ): PayScheduleAssignmentContextInterface => ({\n ...ctx,\n component: AssignmentScheduleStep as ComponentType,\n defaultPayScheduleUuid: ev.payload.paySchedule.uuid,\n }),\n ),\n ),\n transition(componentEvents.CANCEL, 'assignmentSchedule', toAssignmentSchedule),\n ),\n assignmentReview: state<MachineTransition>(\n transition(\n componentEvents.PAY_SCHEDULE_ASSIGNMENT_BACK,\n 'assignmentSchedule',\n toAssignmentSchedule,\n ),\n ),\n}\n"],"names":["toAssignmentSchedule","reduce","ctx","AssignmentScheduleStep","payScheduleAssignmentStateMachine","state","transition","componentEvents","ev","AssignmentTypeStep","AssignmentCreateScheduleStep","AssignmentReviewStep"],"mappings":";;;AAaA,MAAMA,IAAuBC;AAAA,EAC3B,CAACC,OAAuF;AAAA,IACtF,GAAGA;AAAA,IACH,WAAWC;AAAA,EAAA;AAEf,GAGaC,IAAoC;AAAA,EAC/C,gBAAgBC;AAAA,IACdC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAN;AAAA,QACE,CACEC,GACAM,OAI2C;AAAA,UAC3C,GAAGN;AAAA,UACH,WAAWC;AAAA,UACX,gBAAgBK,EAAG,QAAQ;AAAA,QAAA;AAAA,MAC7B;AAAA,IACF;AAAA,EACF;AAAA,EAEF,oBAAoBH;AAAA,IAClBC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAN;AAAA,QACE,CAACC,OAAuF;AAAA,UACtF,GAAGA;AAAA,UACH,WAAWO;AAAA,QAAA;AAAA,MACb;AAAA,IACF;AAAA,IAEFH;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAN;AAAA,QACE,CAACC,OAAuF;AAAA,UACtF,GAAGA;AAAA,UACH,WAAWQ;AAAA,QAAA;AAAA,MACb;AAAA,IACF;AAAA,IAEFJ;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAN;AAAA,QACE,CACEC,GACAM,OAI2C;AAAA,UAC3C,GAAGN;AAAA,UACH,WAAWS;AAAA,UACX,wBAAwBH,EAAG,QAAQ;AAAA,QAAA;AAAA,MACrC;AAAA,IACF;AAAA,EACF;AAAA,EAEF,0BAA0BH;AAAA,IACxBC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAN;AAAA,QACE,CACEC,GACAM,OAC2C;AAAA,UAC3C,GAAGN;AAAA,UACH,WAAWC;AAAA,UACX,wBAAwBK,EAAG,QAAQ,YAAY;AAAA,QAAA;AAAA,MACjD;AAAA,IACF;AAAA,IAEFF,EAAWC,EAAgB,QAAQ,sBAAsBP,CAAoB;AAAA,EAAA;AAAA,EAE/E,kBAAkBK;AAAA,IAChBC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAP;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -0,0 +1,18 @@
1
+ const a = "post-v1-companies-company_id-pay_schedules-assignment_preview", o = {
2
+ afterSuccess: async (i, e) => {
3
+ if (i.operationID !== a)
4
+ return e;
5
+ const s = await e.clone().json(), n = s?.employee_changes ?? [];
6
+ for (const t of n)
7
+ t.transition_pay_period === null && delete t.transition_pay_period, t.first_pay_period === null && delete t.first_pay_period;
8
+ return new Response(JSON.stringify(s), {
9
+ status: e.status,
10
+ statusText: e.statusText,
11
+ headers: e.headers
12
+ });
13
+ }
14
+ };
15
+ export {
16
+ o as stripNullAssignmentPreviewFields
17
+ };
18
+ //# sourceMappingURL=stripNullAssignmentPreviewFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripNullAssignmentPreviewFields.js","sources":["../../../../../../src/components/Company/PaySchedule/management/PayScheduleAssignment/stripNullAssignmentPreviewFields.ts"],"sourcesContent":["import type { AfterSuccessHook } from '@/types/hooks'\n\nconst ASSIGNMENT_PREVIEW_OPERATION_ID =\n 'post-v1-companies-company_id-pay_schedules-assignment_preview'\n\n/**\n * Temporary workaround for a Gusto-Partner-API spec gap: `transition_pay_period` and\n * `first_pay_period` on `Pay-Schedule-Assignment-Employee-Change` are bare `$ref`s with no\n * nullable branch, so the generated Zod schema rejects the `null` the backend legitimately\n * returns for an employee with no transition period. Strips those keys when null so the SDK's\n * response validation never sees them. Scoped to the assignment-preview operation only.\n * Remove once the OAS is fixed upstream or we use a client with lax mode.\n *\n * @internal\n */\nexport const stripNullAssignmentPreviewFields: AfterSuccessHook = {\n afterSuccess: async (hookCtx, response) => {\n if (hookCtx.operationID !== ASSIGNMENT_PREVIEW_OPERATION_ID) {\n return response\n }\n\n const body = await response.clone().json()\n const changes = body?.employee_changes ?? []\n\n for (const change of changes) {\n if (change.transition_pay_period === null) {\n delete change.transition_pay_period\n }\n if (change.first_pay_period === null) {\n delete change.first_pay_period\n }\n }\n\n return new Response(JSON.stringify(body), {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n })\n },\n}\n"],"names":["ASSIGNMENT_PREVIEW_OPERATION_ID","stripNullAssignmentPreviewFields","hookCtx","response","body","changes","change"],"mappings":"AAEA,MAAMA,IACJ,iEAYWC,IAAqD;AAAA,EAChE,cAAc,OAAOC,GAASC,MAAa;AACzC,QAAID,EAAQ,gBAAgBF;AAC1B,aAAOG;AAGT,UAAMC,IAAO,MAAMD,EAAS,MAAA,EAAQ,KAAA,GAC9BE,IAAUD,GAAM,oBAAoB,CAAA;AAE1C,eAAWE,KAAUD;AACnB,MAAIC,EAAO,0BAA0B,QACnC,OAAOA,EAAO,uBAEZA,EAAO,qBAAqB,QAC9B,OAAOA,EAAO;AAIlB,WAAO,IAAI,SAAS,KAAK,UAAUF,CAAI,GAAG;AAAA,MACxC,QAAQD,EAAS;AAAA,MACjB,YAAYA,EAAS;AAAA,MACrB,SAASA,EAAS;AAAA,IAAA,CACnB;AAAA,EACH;AACF;"}
@@ -0,0 +1,56 @@
1
+ import { jsxs as a, jsx as n } from "react/jsx-runtime";
2
+ import { useTranslation as i } from "react-i18next";
3
+ import { PayScheduleForm as p } from "../PayScheduleForm.js";
4
+ import { PayScheduleOverview as d } from "./PayScheduleOverview.js";
5
+ import { useComponentContext as f } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
6
+ import { useFlow as m } from "../../../Flow/useFlow.js";
7
+ import { ensureRequired as l } from "../../../../helpers/ensureRequired.js";
8
+ import { componentEvents as y } from "../../../../shared/constants.js";
9
+ import { Flex as S } from "../../../Common/Flex/Flex.js";
10
+ import { PayScheduleAssignment as E } from "./PayScheduleAssignment/PayScheduleAssignment.js";
11
+ function F() {
12
+ const { companyId: o, onEvent: e, enableAutoPilot: t, enableMultipleSchedules: r, successAlert: s } = m(), { t: u } = i("Company.Management.PaySchedule"), c = f();
13
+ return /* @__PURE__ */ a(S, { flexDirection: "column", gap: 16, children: [
14
+ s ? /* @__PURE__ */ n(
15
+ c.Alert,
16
+ {
17
+ status: "success",
18
+ label: u(`alerts.${s}`),
19
+ onDismiss: () => {
20
+ e(y.PAY_SCHEDULE_MANAGEMENT_ALERT_DISMISSED, null);
21
+ }
22
+ }
23
+ ) : null,
24
+ /* @__PURE__ */ n(
25
+ d,
26
+ {
27
+ companyId: l(o),
28
+ onEvent: e,
29
+ enableAutoPilot: t,
30
+ enableMultipleSchedules: r
31
+ }
32
+ )
33
+ ] });
34
+ }
35
+ function _() {
36
+ const { companyId: o, onEvent: e } = m();
37
+ return /* @__PURE__ */ n(E, { companyId: l(o), onEvent: e });
38
+ }
39
+ function b() {
40
+ const { companyId: o, payScheduleId: e, defaultValues: t, onEvent: r } = m();
41
+ return /* @__PURE__ */ n(
42
+ p,
43
+ {
44
+ companyId: l(o),
45
+ payScheduleId: e,
46
+ defaultValues: t,
47
+ onEvent: r
48
+ }
49
+ );
50
+ }
51
+ export {
52
+ _ as PayScheduleAssignmentContextual,
53
+ b as PayScheduleEditFormContextual,
54
+ F as PayScheduleOverviewContextual
55
+ };
56
+ //# sourceMappingURL=PayScheduleManagementComponents.js.map
@@ -0,0 +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 { companyId, onEvent, enableAutoPilot, enableMultipleSchedules, successAlert } =\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 </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","useFlow","t","useTranslation","Components","useComponentContext","jsxs","Flex","jsx","componentEvents","PayScheduleOverview","ensureRequired","PayScheduleAssignmentContextual","PayScheduleAssignment","PayScheduleEditFormContextual","payScheduleId","defaultValues","PayScheduleForm"],"mappings":";;;;;;;;;;AA0BO,SAASA,IAAgC;AAC9C,QAAM,EAAE,WAAAC,GAAW,SAAAC,GAAS,iBAAAC,GAAiB,yBAAAC,GAAyB,cAAAC,EAAA,IACpEC,EAAA,GACI,EAAE,GAAAC,EAAA,IAAMC,EAAe,gCAAgC,GACvDC,IAAaC,EAAA;AAEnB,SACE,gBAAAC,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAA;AAAA,IAAAP,IACC,gBAAAQ;AAAA,MAACJ,EAAW;AAAA,MAAX;AAAA,QACC,QAAO;AAAA,QACP,OAAOF,EAAE,UAAUF,CAAY,EAAE;AAAA,QACjC,WAAW,MAAM;AACf,UAAAH,EAAQY,EAAgB,yCAAyC,IAAI;AAAA,QACvE;AAAA,MAAA;AAAA,IAAA,IAEA;AAAA,IACJ,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,WAAWC,EAAef,CAAS;AAAA,QACnC,SAAAC;AAAA,QACA,iBAAAC;AAAA,QACA,yBAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;AAGO,SAASa,IAAkC;AAChD,QAAM,EAAE,WAAAhB,GAAW,SAAAC,EAAA,IAAYI,EAAA;AAE/B,2BAAQY,GAAA,EAAsB,WAAWF,EAAef,CAAS,GAAG,SAAAC,GAAkB;AACxF;AAGO,SAASiB,IAAgC;AAC9C,QAAM,EAAE,WAAAlB,GAAW,eAAAmB,GAAe,eAAAC,GAAe,SAAAnB,EAAA,IAC/CI,EAAA;AAEF,SACE,gBAAAO;AAAA,IAACS;AAAA,IAAA;AAAA,MACC,WAAWN,EAAef,CAAS;AAAA,MACnC,eAAAmB;AAAA,MACA,eAAAC;AAAA,MACA,SAAAnB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,34 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { usePaySchedulesGetAllSuspense as S } from "@gusto/embedded-api/react-query/paySchedulesGetAll";
3
+ import { PayScheduleOverviewPresentation as m } from "./PayScheduleOverviewPresentation.js";
4
+ import { componentEvents as u } from "../../../../shared/constants.js";
5
+ import { ensureRequired as a } from "../../../../helpers/ensureRequired.js";
6
+ function h({
7
+ companyId: i,
8
+ onEvent: e,
9
+ enableAutoPilot: s,
10
+ enableMultipleSchedules: r
11
+ }) {
12
+ const { data: d } = S({ companyId: i }), t = d.payScheduleShowResponse ?? [], o = a(t.find((n) => n.active) ?? t[0]);
13
+ return /* @__PURE__ */ c(
14
+ m,
15
+ {
16
+ schedule: o,
17
+ enableAutoPilot: s,
18
+ enableMultipleSchedules: r,
19
+ onEditSchedule: () => {
20
+ e(u.PAY_SCHEDULE_UPDATE, { uuid: o.uuid });
21
+ },
22
+ onManageAssignment: () => {
23
+ e(u.PAY_SCHEDULE_MANAGE_ASSIGNMENT);
24
+ },
25
+ onEditAutoPilot: () => {
26
+ e(u.PAY_SCHEDULE_AUTO_PILOT_EDIT, { uuid: o.uuid });
27
+ }
28
+ }
29
+ );
30
+ }
31
+ export {
32
+ h as PayScheduleOverview
33
+ };
34
+ //# sourceMappingURL=PayScheduleOverview.js.map
@@ -0,0 +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, { uuid: schedule.uuid })\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,MAAML,EAAS,MAAM;AAAA,MAC/E;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,77 @@
1
+ import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
+ import { useTranslation as b } from "react-i18next";
3
+ import d from "./PayScheduleOverviewPresentation.module.scss.js";
4
+ import { useComponentContext as u } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
5
+ import { Flex as s } from "../../../Common/Flex/Flex.js";
6
+ function r({ label: n, value: i, action: l }) {
7
+ const o = u();
8
+ return /* @__PURE__ */ t("div", { className: d.row, children: /* @__PURE__ */ c(s, { justifyContent: "space-between", alignItems: "center", children: [
9
+ /* @__PURE__ */ c(s, { flexDirection: "column", gap: 4, children: [
10
+ /* @__PURE__ */ t(o.Text, { weight: "semibold", children: n }),
11
+ /* @__PURE__ */ t(o.Text, { variant: "supporting", children: i })
12
+ ] }),
13
+ l
14
+ ] }) });
15
+ }
16
+ function x({
17
+ schedule: n,
18
+ enableAutoPilot: i,
19
+ enableMultipleSchedules: l,
20
+ onEditSchedule: o,
21
+ onManageAssignment: m,
22
+ onEditAutoPilot: p
23
+ }) {
24
+ const { t: e } = b("Company.Management.PaySchedule"), a = u();
25
+ return /* @__PURE__ */ t(
26
+ a.Box,
27
+ {
28
+ header: /* @__PURE__ */ t(
29
+ a.BoxHeader,
30
+ {
31
+ title: e("title"),
32
+ description: e("description"),
33
+ action: l ? /* @__PURE__ */ t(a.Button, { variant: "secondary", onClick: m, children: e("manageCta") }) : void 0
34
+ }
35
+ ),
36
+ children: /* @__PURE__ */ c("div", { className: d.rows, children: [
37
+ /* @__PURE__ */ t(
38
+ r,
39
+ {
40
+ label: e("labels.name"),
41
+ value: n.customName,
42
+ action: /* @__PURE__ */ t(
43
+ a.Button,
44
+ {
45
+ variant: "secondary",
46
+ onClick: o,
47
+ "aria-label": e("editScheduleAriaLabel"),
48
+ children: e("editCta")
49
+ }
50
+ )
51
+ }
52
+ ),
53
+ /* @__PURE__ */ t(r, { label: e("labels.frequency"), value: n.frequency }),
54
+ i ? /* @__PURE__ */ t(
55
+ r,
56
+ {
57
+ label: e("autoPilot.label"),
58
+ value: n.autoPayroll ? e("autoPilot.enabled") : e("autoPilot.disabled"),
59
+ action: /* @__PURE__ */ t(
60
+ a.Button,
61
+ {
62
+ variant: "secondary",
63
+ onClick: p,
64
+ "aria-label": e("editAutoPilotAriaLabel"),
65
+ children: e("editCta")
66
+ }
67
+ )
68
+ }
69
+ ) : null
70
+ ] })
71
+ }
72
+ );
73
+ }
74
+ export {
75
+ x as PayScheduleOverviewPresentation
76
+ };
77
+ //# sourceMappingURL=PayScheduleOverviewPresentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayScheduleOverviewPresentation.js","sources":["../../../../../src/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport styles from './PayScheduleOverviewPresentation.module.scss'\nimport { Flex } from '@/components/Common/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/** @internal */\nexport interface PayScheduleOverviewPresentationProps {\n /** The company's single pay schedule. */\n schedule: PayScheduleShow\n /** Shows the AutoPilot row and its Edit action when `true`. */\n enableAutoPilot?: boolean\n /** Shows the Manage action when `true`. */\n enableMultipleSchedules?: boolean\n /** Fired when the user clicks Edit on the pay schedule row. */\n onEditSchedule: () => void\n /** Fired when the user clicks Manage. */\n onManageAssignment: () => void\n /** Fired when the user clicks Edit on the AutoPilot row. */\n onEditAutoPilot: () => void\n}\n\nfunction Row({ label, value, action }: { label: ReactNode; value: ReactNode; action?: ReactNode }) {\n const Components = useComponentContext()\n return (\n <div className={styles.row}>\n <Flex justifyContent=\"space-between\" alignItems=\"center\">\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Text weight=\"semibold\">{label}</Components.Text>\n <Components.Text variant=\"supporting\">{value}</Components.Text>\n </Flex>\n {action}\n </Flex>\n </div>\n )\n}\n\n/** @internal */\nexport function PayScheduleOverviewPresentation({\n schedule,\n enableAutoPilot,\n enableMultipleSchedules,\n onEditSchedule,\n onManageAssignment,\n onEditAutoPilot,\n}: PayScheduleOverviewPresentationProps) {\n const { t } = useTranslation('Company.Management.PaySchedule')\n const Components = useComponentContext()\n\n return (\n <Components.Box\n header={\n <Components.BoxHeader\n title={t('title')}\n description={t('description')}\n action={\n enableMultipleSchedules ? (\n <Components.Button variant=\"secondary\" onClick={onManageAssignment}>\n {t('manageCta')}\n </Components.Button>\n ) : undefined\n }\n />\n }\n >\n <div className={styles.rows}>\n <Row\n label={t('labels.name')}\n value={schedule.customName}\n action={\n <Components.Button\n variant=\"secondary\"\n onClick={onEditSchedule}\n aria-label={t('editScheduleAriaLabel')}\n >\n {t('editCta')}\n </Components.Button>\n }\n />\n <Row label={t('labels.frequency')} value={schedule.frequency} />\n {enableAutoPilot ? (\n <Row\n label={t('autoPilot.label')}\n value={schedule.autoPayroll ? t('autoPilot.enabled') : t('autoPilot.disabled')}\n action={\n <Components.Button\n variant=\"secondary\"\n onClick={onEditAutoPilot}\n aria-label={t('editAutoPilotAriaLabel')}\n >\n {t('editCta')}\n </Components.Button>\n }\n />\n ) : null}\n </div>\n </Components.Box>\n )\n}\n"],"names":["Row","label","value","action","Components","useComponentContext","jsx","styles","Flex","jsxs","PayScheduleOverviewPresentation","schedule","enableAutoPilot","enableMultipleSchedules","onEditSchedule","onManageAssignment","onEditAutoPilot","t","useTranslation"],"mappings":";;;;;AAuBA,SAASA,EAAI,EAAE,OAAAC,GAAO,OAAAC,GAAO,QAAAC,KAAsE;AACjG,QAAMC,IAAaC,EAAA;AACnB,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAWC,EAAO,KACrB,4BAACC,GAAA,EAAK,gBAAe,iBAAgB,YAAW,UAC9C,UAAA;AAAA,IAAA,gBAAAC,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAF,EAACF,EAAW,MAAX,EAAgB,QAAO,YAAY,UAAAH,GAAM;AAAA,wBACzCG,EAAW,MAAX,EAAgB,SAAQ,cAAc,UAAAF,EAAA,CAAM;AAAA,IAAA,GAC/C;AAAA,IACCC;AAAA,EAAA,EAAA,CACH,EAAA,CACF;AAEJ;AAGO,SAASO,EAAgC;AAAA,EAC9C,UAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,iBAAAC;AACF,GAAyC;AACvC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,gCAAgC,GACvDd,IAAaC,EAAA;AAEnB,SACE,gBAAAC;AAAA,IAACF,EAAW;AAAA,IAAX;AAAA,MACC,QACE,gBAAAE;AAAA,QAACF,EAAW;AAAA,QAAX;AAAA,UACC,OAAOa,EAAE,OAAO;AAAA,UAChB,aAAaA,EAAE,aAAa;AAAA,UAC5B,QACEJ,IACE,gBAAAP,EAACF,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASW,GAC7C,UAAAE,EAAE,WAAW,GAChB,IACE;AAAA,QAAA;AAAA,MAAA;AAAA,MAKV,UAAA,gBAAAR,EAAC,OAAA,EAAI,WAAWF,EAAO,MACrB,UAAA;AAAA,QAAA,gBAAAD;AAAA,UAACN;AAAA,UAAA;AAAA,YACC,OAAOiB,EAAE,aAAa;AAAA,YACtB,OAAON,EAAS;AAAA,YAChB,QACE,gBAAAL;AAAA,cAACF,EAAW;AAAA,cAAX;AAAA,gBACC,SAAQ;AAAA,gBACR,SAASU;AAAA,gBACT,cAAYG,EAAE,uBAAuB;AAAA,gBAEpC,YAAE,SAAS;AAAA,cAAA;AAAA,YAAA;AAAA,UACd;AAAA,QAAA;AAAA,QAGJ,gBAAAX,EAACN,KAAI,OAAOiB,EAAE,kBAAkB,GAAG,OAAON,EAAS,WAAW;AAAA,QAC7DC,IACC,gBAAAN;AAAA,UAACN;AAAA,UAAA;AAAA,YACC,OAAOiB,EAAE,iBAAiB;AAAA,YAC1B,OAAON,EAAS,cAAcM,EAAE,mBAAmB,IAAIA,EAAE,oBAAoB;AAAA,YAC7E,QACE,gBAAAX;AAAA,cAACF,EAAW;AAAA,cAAX;AAAA,gBACC,SAAQ;AAAA,gBACR,SAASY;AAAA,gBACT,cAAYC,EAAE,wBAAwB;AAAA,gBAErC,YAAE,SAAS;AAAA,cAAA;AAAA,YAAA;AAAA,UACd;AAAA,QAAA,IAGF;AAAA,MAAA,EAAA,CACN;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,10 @@
1
+ const o = "_rows_y2uum_1", s = "_row_y2uum_1", r = {
2
+ rows: o,
3
+ row: s
4
+ };
5
+ export {
6
+ r as default,
7
+ s as row,
8
+ o as rows
9
+ };
10
+ //# sourceMappingURL=PayScheduleOverviewPresentation.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayScheduleOverviewPresentation.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}