@gusto/embedded-react-sdk 0.55.2 → 0.55.3

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 (75) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/Common/FieldLayout/FieldLayout.js +6 -6
  3. package/dist/components/Common/Fieldset/Fieldset.js +6 -6
  4. package/dist/components/Common/HorizontalFieldLayout/HorizontalFieldLayout.js +6 -6
  5. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +58 -49
  6. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -1
  7. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js +14 -10
  8. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js.map +1 -1
  9. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +4 -0
  10. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
  11. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  12. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
  13. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  14. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
  15. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  16. package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
  17. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  18. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.d.ts +4 -0
  19. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  20. package/dist/components/Company/DocumentSigner/DocumentList/List.js +11 -8
  21. package/dist/components/Company/DocumentSigner/DocumentList/List.js.map +1 -1
  22. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
  23. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  24. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -8
  25. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  26. package/dist/components/Company/Industry/Context.js +8 -6
  27. package/dist/components/Company/Industry/Context.js.map +1 -1
  28. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
  29. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  30. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
  31. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  32. package/dist/components/Company/OnboardingOverview/context.js +5 -3
  33. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  34. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
  35. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  36. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
  37. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  38. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +5 -3
  39. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
  40. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +116 -116
  41. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
  42. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.d.ts +4 -0
  43. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js +19 -19
  44. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  45. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.js +16 -13
  46. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.js.map +1 -1
  47. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +5 -3
  48. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  49. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.d.ts +4 -0
  50. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js.map +1 -1
  51. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +75 -71
  52. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
  53. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +137 -138
  54. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  55. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +1 -1
  56. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  57. package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +8 -1
  58. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +174 -161
  59. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  60. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
  61. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +42 -41
  62. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  63. package/dist/components/Payroll/helpers.d.ts +0 -15
  64. package/dist/components/Payroll/helpers.js +13 -18
  65. package/dist/components/Payroll/helpers.js.map +1 -1
  66. package/dist/components/Payroll/usePreparedPayrollData.js +10 -8
  67. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  68. package/dist/i18n/en/Company.DocumentList.json.js +34 -32
  69. package/dist/i18n/en/Company.DocumentList.json.js.map +1 -1
  70. package/dist/i18n/en/Employee.DocumentSigner.json.js +24 -22
  71. package/dist/i18n/en/Employee.DocumentSigner.json.js.map +1 -1
  72. package/dist/i18n/en/Payroll.PayrollOverview.json.js +5 -5
  73. package/dist/i18n/types.d.ts +311 -1
  74. package/dist/style.css +1 -1
  75. package/package.json +5 -5
@@ -1,21 +1,24 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useTranslation as m } from "react-i18next";
3
- import { useDocumentList as s } from "./useDocumentList.js";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useTranslation as s } from "react-i18next";
3
+ import { useDocumentList as m } from "./useDocumentList.js";
4
4
  import l from "./List.module.scss.js";
5
5
  import { Flex as u } from "../../../../../Common/Flex/Flex.js";
6
6
  import { DocumentList as c } from "../../../../../Common/DocumentList/DocumentList.js";
7
- function f() {
8
- const { employeeForms: i, handleRequestFormToSign: n, documentListError: r } = s(), { t: e } = m("Employee.DocumentSigner");
9
- return /* @__PURE__ */ o("section", { className: l.root, children: /* @__PURE__ */ o(u, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(
7
+ function a(t, i) {
8
+ return t.name && i(`forms.${t.name}.description`, { defaultValue: "" }) || t.description;
9
+ }
10
+ function D() {
11
+ const { employeeForms: t, handleRequestFormToSign: i, documentListError: r } = m(), { t: e } = s("Employee.DocumentSigner");
12
+ return /* @__PURE__ */ n("section", { className: l.root, children: /* @__PURE__ */ n(u, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ n(
10
13
  c,
11
14
  {
12
- forms: i.map((t) => ({
13
- uuid: t.uuid,
14
- title: t.title,
15
- description: t.description,
16
- requires_signing: t.requiresSigning
15
+ forms: t.map((o) => ({
16
+ uuid: o.uuid,
17
+ title: o.title,
18
+ description: a(o, e),
19
+ requires_signing: o.requiresSigning
17
20
  })),
18
- onRequestSign: n,
21
+ onRequestSign: i,
19
22
  withError: !!r,
20
23
  label: e("documentListLabel"),
21
24
  columnLabels: {
@@ -33,6 +36,6 @@ function f() {
33
36
  ) }) });
34
37
  }
35
38
  export {
36
- f as List
39
+ D as List
37
40
  };
38
41
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport styles from './List.module.scss'\nimport { Flex, DocumentList as SharedDocumentList } from '@/components/Common'\n\n/** @internal */\nexport function List() {\n const { employeeForms, handleRequestFormToSign, documentListError } = useDocumentList()\n const { t } = useTranslation('Employee.DocumentSigner')\n\n return (\n <section className={styles.root}>\n <Flex flexDirection=\"column\" gap={32}>\n <SharedDocumentList\n forms={employeeForms.map(form => ({\n uuid: form.uuid,\n title: form.title,\n description: form.description,\n requires_signing: form.requiresSigning,\n }))}\n onRequestSign={handleRequestFormToSign}\n withError={!!documentListError}\n label={t('documentListLabel')}\n columnLabels={{\n form: t('formColumnLabel'),\n action: t('actionColumnLabel'),\n }}\n statusLabels={{\n signCta: t('signDocumentCta'),\n notSigned: t('notSigned'),\n complete: t('signDocumentComplete'),\n }}\n emptyStateLabel={t('emptyTableTitle')}\n errorLabel={t('documentListError')}\n />\n </Flex>\n </section>\n )\n}\n"],"names":["List","employeeForms","handleRequestFormToSign","documentListError","useDocumentList","t","useTranslation","jsx","styles","Flex","SharedDocumentList","form"],"mappings":";;;;;;AAMO,SAASA,IAAO;AACrB,QAAM,EAAE,eAAAC,GAAe,yBAAAC,GAAyB,mBAAAC,EAAA,IAAsBC,EAAA,GAChE,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB;AAEtD,SACE,gBAAAC,EAAC,WAAA,EAAQ,WAAWC,EAAO,MACzB,4BAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAF;AAAA,IAACG;AAAAA,IAAA;AAAA,MACC,OAAOT,EAAc,IAAI,CAAAU,OAAS;AAAA,QAChC,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,aAAaA,EAAK;AAAA,QAClB,kBAAkBA,EAAK;AAAA,MAAA,EACvB;AAAA,MACF,eAAeT;AAAA,MACf,WAAW,CAAC,CAACC;AAAA,MACb,OAAOE,EAAE,mBAAmB;AAAA,MAC5B,cAAc;AAAA,QACZ,MAAMA,EAAE,iBAAiB;AAAA,QACzB,QAAQA,EAAE,mBAAmB;AAAA,MAAA;AAAA,MAE/B,cAAc;AAAA,QACZ,SAASA,EAAE,iBAAiB;AAAA,QAC5B,WAAWA,EAAE,WAAW;AAAA,QACxB,UAAUA,EAAE,sBAAsB;AAAA,MAAA;AAAA,MAEpC,iBAAiBA,EAAE,iBAAiB;AAAA,MACpC,YAAYA,EAAE,mBAAmB;AAAA,IAAA;AAAA,EAAA,GAErC,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { TFunction } from 'i18next'\nimport type { Form as FormSchema } from '@gusto/embedded-api/models/components/form'\nimport { useDocumentList } from './useDocumentList'\nimport styles from './List.module.scss'\nimport { Flex, DocumentList as SharedDocumentList } from '@/components/Common'\n\n/**\n * Resolves a form's rendered description, preferring a partner-provided\n * `forms.<name>.description` dictionary override over the API-provided text.\n * Falls back to the API text when no override exists (including for form\n * names outside the SDK's known catalog).\n */\nfunction resolveFormDescription(form: FormSchema, t: TFunction<'Employee.DocumentSigner'>) {\n if (!form.name) return form.description\n const override = t(`forms.${form.name}.description` as never, { defaultValue: '' }) as string\n return override || form.description\n}\n\n/** @internal */\nexport function List() {\n const { employeeForms, handleRequestFormToSign, documentListError } = useDocumentList()\n const { t } = useTranslation('Employee.DocumentSigner')\n\n return (\n <section className={styles.root}>\n <Flex flexDirection=\"column\" gap={32}>\n <SharedDocumentList\n forms={employeeForms.map(form => ({\n uuid: form.uuid,\n title: form.title,\n description: resolveFormDescription(form, t),\n requires_signing: form.requiresSigning,\n }))}\n onRequestSign={handleRequestFormToSign}\n withError={!!documentListError}\n label={t('documentListLabel')}\n columnLabels={{\n form: t('formColumnLabel'),\n action: t('actionColumnLabel'),\n }}\n statusLabels={{\n signCta: t('signDocumentCta'),\n notSigned: t('notSigned'),\n complete: t('signDocumentComplete'),\n }}\n emptyStateLabel={t('emptyTableTitle')}\n errorLabel={t('documentListError')}\n />\n </Flex>\n </section>\n )\n}\n"],"names":["resolveFormDescription","form","t","List","employeeForms","handleRequestFormToSign","documentListError","useDocumentList","useTranslation","jsx","styles","Flex","SharedDocumentList"],"mappings":";;;;;;AAaA,SAASA,EAAuBC,GAAkBC,GAAyC;AACzF,SAAKD,EAAK,QACOC,EAAE,SAASD,EAAK,IAAI,gBAAyB,EAAE,cAAc,IAAI,KAC/DA,EAAK;AAC1B;AAGO,SAASE,IAAO;AACrB,QAAM,EAAE,eAAAC,GAAe,yBAAAC,GAAyB,mBAAAC,EAAA,IAAsBC,EAAA,GAChE,EAAE,GAAAL,EAAA,IAAMM,EAAe,yBAAyB;AAEtD,SACE,gBAAAC,EAAC,WAAA,EAAQ,WAAWC,EAAO,MACzB,4BAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAF;AAAA,IAACG;AAAAA,IAAA;AAAA,MACC,OAAOR,EAAc,IAAI,CAAAH,OAAS;AAAA,QAChC,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,aAAaD,EAAuBC,GAAMC,CAAC;AAAA,QAC3C,kBAAkBD,EAAK;AAAA,MAAA,EACvB;AAAA,MACF,eAAeI;AAAA,MACf,WAAW,CAAC,CAACC;AAAA,MACb,OAAOJ,EAAE,mBAAmB;AAAA,MAC5B,cAAc;AAAA,QACZ,MAAMA,EAAE,iBAAiB;AAAA,QACzB,QAAQA,EAAE,mBAAmB;AAAA,MAAA;AAAA,MAE/B,cAAc;AAAA,QACZ,SAASA,EAAE,iBAAiB;AAAA,QAC5B,WAAWA,EAAE,WAAW;AAAA,QACxB,UAAUA,EAAE,sBAAsB;AAAA,MAAA;AAAA,MAEpC,iBAAiBA,EAAE,iBAAiB;AAAA,MACpC,YAAYA,EAAE,mBAAmB;AAAA,IAAA;AAAA,EAAA,GAErC,EAAA,CACF;AAEJ;"}
@@ -9,13 +9,15 @@ import "@gusto/embedded-api/models/errors/gustoembeddederror";
9
9
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
10
10
  import "@gusto/embedded-api/models/errors/unprocessableentityerror";
11
11
  import "@gusto/embedded-api/models/errors/httpclienterrors";
12
+ import "dompurify";
13
+ import "../../../../../../contexts/LocaleProvider/useLocale.js";
12
14
  import "../../../../../../shared/constants.js";
13
15
  import "../../../../../../contexts/ComponentAdapter/useComponentContext.js";
14
16
  import "../../../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
15
17
  import { createCompoundContext as t } from "../../../../../Base/createCompoundContext.js";
16
- const [a, f] = t("DocumentListContext");
18
+ const [v, P] = t("DocumentListContext");
17
19
  export {
18
- f as DocumentListProvider,
19
- a as useDocumentList
20
+ P as DocumentListProvider,
21
+ v as useDocumentList
20
22
  };
21
23
  //# sourceMappingURL=useDocumentList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDocumentList.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
1
+ {"version":3,"file":"useDocumentList.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
@@ -19,6 +19,10 @@ export interface DocumentSignerProps extends BaseComponentInterface<'Employee.Do
19
19
  * signed, the flow starts on the I-9 employment eligibility step before
20
20
  * presenting the document list.
21
21
  *
22
+ * Each form's description is rendered as returned by the API, unless the `dictionary` prop
23
+ * supplies a `forms.<name>.description` override for that form's `name` (e.g.
24
+ * `forms.employee_direct_deposit.description`).
25
+ *
22
26
  * @events
23
27
  * | Event | Description | Data |
24
28
  * | ----- | ----------- | ---- |
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentSigner.js","sources":["../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport {\n DocumentListContextual,\n EmploymentEligibilityContextual,\n type DocumentSignerContextInterface,\n} from './documentSignerStateMachine'\nimport { documentSignerMachine } from './stateMachine'\nimport { Flow } from '@/components/Flow/Flow'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { I9_FORM_NAME } from '@/shared/constants'\n\n/**\n * Props for {@link DocumentSigner}.\n *\n * @public\n */\nexport interface DocumentSignerProps extends BaseComponentInterface<'Employee.DocumentSigner'> {\n /** The associated employee identifier. */\n employeeId: string\n /** When `true`, the flow routes through I-9 employment eligibility before listing documents for signing. Defaults to `false`. */\n withEmployeeI9?: boolean\n}\n\n/**\n * Onboarding step for signing employee documents.\n *\n * @remarks\n * Lists the employee's pending forms and routes through the signing UI for each\n * one. When `withEmployeeI9` is `true` and the employee's I-9 has not been\n * signed, the flow starts on the I-9 employment eligibility step before\n * presenting the document list.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/employmentEligibility/done` | Fired after I-9 employment eligibility is captured | The updated I-9 authorization |\n * | `employee/forms/view` | Fired when a form's \"Sign\" action is selected from the document list | `{ uuid: string; name?: string }` |\n * | `employee/forms/sign` | Fired after a form is successfully signed | {@link APIModels.Form} |\n * | `employee/employmentEligibility/change` | Fired when the user requests to change their I-9 eligibility status | — |\n * | `employee/forms/done` | Fired when all required forms have been signed and the parent flow can advance | — |\n * | `cancel` | Fired when the user cancels signing a form and returns to the document list | — |\n *\n * @components\n * - {@link EmploymentEligibility}\n * - {@link I9SignatureForm}\n * - {@link DocumentList}\n * - {@link SignatureForm}\n *\n * @param props - See {@link DocumentSignerProps}.\n * @returns The document signer flow.\n * @public\n */\nexport function DocumentSigner(props: DocumentSignerProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, onEvent, dictionary, withEmployeeI9 = false }: DocumentSignerProps) {\n useComponentDictionary('Employee.DocumentSigner', dictionary)\n\n const { data: employeeData } = useEmployeesGetSuspense({ employeeId })\n const { data: formsData } = useEmployeeFormsListSuspense({ employeeId })\n\n const employeeHasI9Enabled = employeeData.employee?.onboardingDocumentsConfig?.i9Document === true\n\n const i9Form = formsData.forms?.find(form => form.name === I9_FORM_NAME)\n const needsI9Form =\n withEmployeeI9 && employeeHasI9Enabled && (!i9Form || i9Form.requiresSigning === true)\n\n const machine = useMemo(\n () =>\n createMachine(\n needsI9Form ? 'employmentEligibility' : 'index',\n documentSignerMachine,\n (initialContext: DocumentSignerContextInterface) => ({\n ...initialContext,\n component: needsI9Form ? EmploymentEligibilityContextual : DocumentListContextual,\n employeeId,\n withEmployeeI9,\n }),\n ),\n [employeeId, withEmployeeI9],\n )\n\n return <Flow machine={machine} onEvent={onEvent} />\n}\n"],"names":["DocumentSigner","props","jsx","BaseComponent","Root","employeeId","onEvent","dictionary","withEmployeeI9","useComponentDictionary","employeeData","useEmployeesGetSuspense","formsData","useEmployeeFormsListSuspense","employeeHasI9Enabled","i9Form","form","I9_FORM_NAME","needsI9Form","machine","useMemo","createMachine","documentSignerMachine","initialContext","EmploymentEligibilityContextual","DocumentListContextual","Flow"],"mappings":";;;;;;;;;;;;AAwDO,SAASA,EAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,SAAAC,GAAS,YAAAC,GAAY,gBAAAC,IAAiB,MAA8B;AAC9F,EAAAC,EAAuB,2BAA2BF,CAAU;AAE5D,QAAM,EAAE,MAAMG,EAAA,IAAiBC,EAAwB,EAAE,YAAAN,GAAY,GAC/D,EAAE,MAAMO,EAAA,IAAcC,EAA6B,EAAE,YAAAR,GAAY,GAEjES,IAAuBJ,EAAa,UAAU,2BAA2B,eAAe,IAExFK,IAASH,EAAU,OAAO,KAAK,CAAAI,MAAQA,EAAK,SAASC,CAAY,GACjEC,IACJV,KAAkBM,MAAyB,CAACC,KAAUA,EAAO,oBAAoB,KAE7EI,IAAUC;AAAA,IACd,MACEC;AAAA,MACEH,IAAc,0BAA0B;AAAA,MACxCI;AAAA,MACA,CAACC,OAAoD;AAAA,QACnD,GAAGA;AAAA,QACH,WAAWL,IAAcM,IAAkCC;AAAA,QAC3D,YAAApB;AAAA,QACA,gBAAAG;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACH,GAAYG,CAAc;AAAA,EAAA;AAG7B,SAAO,gBAAAN,EAACwB,GAAA,EAAK,SAAAP,GAAkB,SAAAb,EAAA,CAAkB;AACnD;"}
1
+ {"version":3,"file":"DocumentSigner.js","sources":["../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport {\n DocumentListContextual,\n EmploymentEligibilityContextual,\n type DocumentSignerContextInterface,\n} from './documentSignerStateMachine'\nimport { documentSignerMachine } from './stateMachine'\nimport { Flow } from '@/components/Flow/Flow'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { I9_FORM_NAME } from '@/shared/constants'\n\n/**\n * Props for {@link DocumentSigner}.\n *\n * @public\n */\nexport interface DocumentSignerProps extends BaseComponentInterface<'Employee.DocumentSigner'> {\n /** The associated employee identifier. */\n employeeId: string\n /** When `true`, the flow routes through I-9 employment eligibility before listing documents for signing. Defaults to `false`. */\n withEmployeeI9?: boolean\n}\n\n/**\n * Onboarding step for signing employee documents.\n *\n * @remarks\n * Lists the employee's pending forms and routes through the signing UI for each\n * one. When `withEmployeeI9` is `true` and the employee's I-9 has not been\n * signed, the flow starts on the I-9 employment eligibility step before\n * presenting the document list.\n *\n * Each form's description is rendered as returned by the API, unless the `dictionary` prop\n * supplies a `forms.<name>.description` override for that form's `name` (e.g.\n * `forms.employee_direct_deposit.description`).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/employmentEligibility/done` | Fired after I-9 employment eligibility is captured | The updated I-9 authorization |\n * | `employee/forms/view` | Fired when a form's \"Sign\" action is selected from the document list | `{ uuid: string; name?: string }` |\n * | `employee/forms/sign` | Fired after a form is successfully signed | {@link APIModels.Form} |\n * | `employee/employmentEligibility/change` | Fired when the user requests to change their I-9 eligibility status | — |\n * | `employee/forms/done` | Fired when all required forms have been signed and the parent flow can advance | — |\n * | `cancel` | Fired when the user cancels signing a form and returns to the document list | — |\n *\n * @components\n * - {@link EmploymentEligibility}\n * - {@link I9SignatureForm}\n * - {@link DocumentList}\n * - {@link SignatureForm}\n *\n * @param props - See {@link DocumentSignerProps}.\n * @returns The document signer flow.\n * @public\n */\nexport function DocumentSigner(props: DocumentSignerProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, onEvent, dictionary, withEmployeeI9 = false }: DocumentSignerProps) {\n useComponentDictionary('Employee.DocumentSigner', dictionary)\n\n const { data: employeeData } = useEmployeesGetSuspense({ employeeId })\n const { data: formsData } = useEmployeeFormsListSuspense({ employeeId })\n\n const employeeHasI9Enabled = employeeData.employee?.onboardingDocumentsConfig?.i9Document === true\n\n const i9Form = formsData.forms?.find(form => form.name === I9_FORM_NAME)\n const needsI9Form =\n withEmployeeI9 && employeeHasI9Enabled && (!i9Form || i9Form.requiresSigning === true)\n\n const machine = useMemo(\n () =>\n createMachine(\n needsI9Form ? 'employmentEligibility' : 'index',\n documentSignerMachine,\n (initialContext: DocumentSignerContextInterface) => ({\n ...initialContext,\n component: needsI9Form ? EmploymentEligibilityContextual : DocumentListContextual,\n employeeId,\n withEmployeeI9,\n }),\n ),\n [employeeId, withEmployeeI9],\n )\n\n return <Flow machine={machine} onEvent={onEvent} />\n}\n"],"names":["DocumentSigner","props","jsx","BaseComponent","Root","employeeId","onEvent","dictionary","withEmployeeI9","useComponentDictionary","employeeData","useEmployeesGetSuspense","formsData","useEmployeeFormsListSuspense","employeeHasI9Enabled","i9Form","form","I9_FORM_NAME","needsI9Form","machine","useMemo","createMachine","documentSignerMachine","initialContext","EmploymentEligibilityContextual","DocumentListContextual","Flow"],"mappings":";;;;;;;;;;;;AA4DO,SAASA,EAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,SAAAC,GAAS,YAAAC,GAAY,gBAAAC,IAAiB,MAA8B;AAC9F,EAAAC,EAAuB,2BAA2BF,CAAU;AAE5D,QAAM,EAAE,MAAMG,EAAA,IAAiBC,EAAwB,EAAE,YAAAN,GAAY,GAC/D,EAAE,MAAMO,EAAA,IAAcC,EAA6B,EAAE,YAAAR,GAAY,GAEjES,IAAuBJ,EAAa,UAAU,2BAA2B,eAAe,IAExFK,IAASH,EAAU,OAAO,KAAK,CAAAI,MAAQA,EAAK,SAASC,CAAY,GACjEC,IACJV,KAAkBM,MAAyB,CAACC,KAAUA,EAAO,oBAAoB,KAE7EI,IAAUC;AAAA,IACd,MACEC;AAAA,MACEH,IAAc,0BAA0B;AAAA,MACxCI;AAAA,MACA,CAACC,OAAoD;AAAA,QACnD,GAAGA;AAAA,QACH,WAAWL,IAAcM,IAAkCC;AAAA,QAC3D,YAAApB;AAAA,QACA,gBAAAG;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACH,GAAYG,CAAc;AAAA,EAAA;AAG7B,SAAO,gBAAAN,EAACwB,GAAA,EAAK,SAAAP,GAAkB,SAAAb,EAAA,CAAkB;AACnD;"}
@@ -1,11 +1,11 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { useState as T, useCallback as P, useMemo as z, useEffect as Y } from "react";
3
- import { useForm as H, FormProvider as K } from "react-hook-form";
4
- import { zodResolver as Z } from "@hookform/resolvers/zod";
5
- import { z as n } from "zod";
6
- import { useTranslation as b } from "react-i18next";
7
- import { usePayrollsCreateOffCycleMutation as G } from "@gusto/embedded-api/react-query/payrollsCreateOffCycle";
8
- import { WithholdingPayPeriod as J, OffCycleReason as x } from "@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls";
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { useState as b, useCallback as P, useMemo as z, useEffect as Y } from "react";
3
+ import { useForm as H, FormProvider as J } from "react-hook-form";
4
+ import { zodResolver as K } from "@hookform/resolvers/zod";
5
+ import { z as s } from "zod";
6
+ import { useTranslation as T } from "react-i18next";
7
+ import { usePayrollsCreateOffCycleMutation as Z } from "@gusto/embedded-api/react-query/payrollsCreateOffCycle";
8
+ import { WithholdingPayPeriod as G, OffCycleReason as v } from "@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls";
9
9
  import { RFCDate as g } from "@gusto/embedded-api/types/rfcdate";
10
10
  import { useEmployeesListSuspense as Q } from "@gusto/embedded-api/react-query/employeesList";
11
11
  import { createOffCyclePayPeriodDateFormSchema as X } from "../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js";
@@ -14,61 +14,65 @@ import { OffCycleCreationPresentation as ee } from "./OffCycleCreationPresentati
14
14
  import { useCompanyPaymentSpeed as oe } from "../../../hooks/useCompanyPaymentSpeed.js";
15
15
  import { BaseComponent as te } from "../../Base/Base.js";
16
16
  import { useBase as ne } from "../../Base/useBase.js";
17
- import { useComponentDictionary as le, useI18n as i } from "../../../i18n/I18n.js";
18
- import { componentEvents as se } from "../../../shared/constants.js";
19
- import { SDKInternalError as re } from "../../../types/sdkError.js";
20
- import { Form as ie } from "../../Common/Form/Form.js";
21
- import { OFF_CYCLE_REASON_DEFAULTS as u } from "../OffCycleReasonSelection/types.js";
17
+ import { useComponentDictionary as se, useI18n as a } from "../../../i18n/I18n.js";
18
+ import { componentEvents as le } from "../../../shared/constants.js";
19
+ import { SDKInternalError as ie } from "../../../types/sdkError.js";
20
+ import { Form as re } from "../../Common/Form/Form.js";
21
+ import { OFF_CYCLE_REASON_DEFAULTS as f } from "../OffCycleReasonSelection/types.js";
22
22
  const ae = {
23
- bonus: x.Bonus,
24
- correction: x.Correction
23
+ bonus: v.Bonus,
24
+ correction: v.Correction
25
25
  };
26
- function Ae(c) {
27
- return /* @__PURE__ */ a(te, { ...c, children: /* @__PURE__ */ a(ce, { ...c }) });
26
+ function Ae(d) {
27
+ return /* @__PURE__ */ c(te, { ...d, children: /* @__PURE__ */ c(ce, { ...d }) });
28
28
  }
29
- function ce({ dictionary: c, companyId: f, payrollType: m = "bonus" }) {
30
- le("Payroll.OffCycleCreation", c), i("Payroll.OffCycleCreation"), i("Payroll.OffCycleReasonSelection"), i("Payroll.OffCyclePayPeriodDateForm"), i("Payroll.OffCycleDeductionsSetting"), i("Payroll.EmployeeSelection");
31
- const { t: W } = b("Payroll.OffCyclePayPeriodDateForm"), { t: D } = b("Payroll.OffCycleCreation"), { onEvent: v, baseSubmitHandler: A } = ne(), { paymentSpeedDays: E } = oe(f), { minCheckDate: F, today: U } = $(E), { mutateAsync: N, isPending: L } = G(), [y, O] = T({
32
- withholdingPayPeriod: J.EveryOtherWeek,
33
- withholdingRate: u[m].withholdingType
34
- }), [M, h] = T(!1), _ = P(() => {
35
- h(!0);
36
- }, []), B = P((e) => {
37
- O(e), h(!1);
38
- }, []), I = P(() => {
39
- h(!1);
29
+ function ce({ dictionary: d, companyId: y, payrollType: m = "bonus" }) {
30
+ se("Payroll.OffCycleCreation", d), a("Payroll.OffCycleCreation"), a("Payroll.OffCycleReasonSelection"), a("Payroll.OffCyclePayPeriodDateForm"), a("Payroll.OffCycleDeductionsSetting"), a("Payroll.EmployeeSelection");
31
+ const { t: x } = T("Payroll.OffCyclePayPeriodDateForm"), { t: D } = T("Payroll.OffCycleCreation"), { onEvent: W, baseSubmitHandler: A } = ne(), { paymentSpeedDays: E } = oe(y), { minCheckDate: F, today: U } = $(E), { mutateAsync: N, isPending: L } = Z(), [h, O] = b({
32
+ withholdingPayPeriod: G.EveryOtherWeek,
33
+ withholdingRate: f[m].withholdingType
34
+ }), [M, p] = b(!1), _ = P(() => {
35
+ p(!0);
36
+ }, []), j = P((e) => {
37
+ O(e), p(!1);
38
+ }, []), B = P(() => {
39
+ p(!1);
40
40
  }, []), { data: R } = Q({
41
- companyId: f,
41
+ companyId: y,
42
42
  onboardedActive: !0
43
43
  }), k = z(() => [...R.showEmployees ?? []].sort((o, t) => {
44
- const l = o.lastName.localeCompare(t.lastName);
45
- return l !== 0 ? l : o.firstName.localeCompare(t.firstName);
46
- }).map((o) => ({
47
- label: [o.firstName, o.lastName].filter(Boolean).join(" "),
48
- value: o.uuid
49
- })), [R]), V = (e, o) => (
44
+ const n = o.lastName.localeCompare(t.lastName);
45
+ return n !== 0 ? n : o.firstName.localeCompare(t.firstName);
46
+ }).map((o) => {
47
+ const t = [o.firstName, o.lastName].filter(Boolean).join(" "), n = o.jobs?.find((r) => r.primary) ?? o.jobs?.[0];
48
+ return {
49
+ label: t,
50
+ value: o.uuid,
51
+ description: n?.title || void 0
52
+ };
53
+ }), [R]), I = (e, o) => (
50
54
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
- W(e, o)
52
- ), r = H({
55
+ x(e, o)
56
+ ), i = H({
53
57
  resolver: (e, o, t) => {
54
- const l = e.reason, C = e.isCheckOnly, s = X(
55
- V,
56
- l === "correction" ? "correction" : m,
57
- C ? U : F,
58
+ const n = e.reason, r = e.isCheckOnly, l = X(
59
+ I,
60
+ n === "correction" ? "correction" : m,
61
+ r ? U : F,
58
62
  E
59
- ), d = n.object({
60
- reason: n.enum(["bonus", "correction"]),
61
- skipRegularDeductions: n.boolean(),
62
- includeAllEmployees: n.boolean(),
63
- selectedEmployeeUuids: n.array(n.string())
64
- }).and(s).superRefine((S, q) => {
63
+ ), u = s.object({
64
+ reason: s.enum(["bonus", "correction"]),
65
+ skipRegularDeductions: s.boolean(),
66
+ includeAllEmployees: s.boolean(),
67
+ selectedEmployeeUuids: s.array(s.string())
68
+ }).and(l).superRefine((S, q) => {
65
69
  !S.includeAllEmployees && S.selectedEmployeeUuids.length === 0 && q.addIssue({
66
- code: n.ZodIssueCode.custom,
70
+ code: s.ZodIssueCode.custom,
67
71
  path: ["selectedEmployeeUuids"],
68
72
  message: D("errors.noEmployeesSelected")
69
73
  });
70
74
  });
71
- return Z(d)(e, o, t);
75
+ return K(u)(e, o, t);
72
76
  },
73
77
  defaultValues: {
74
78
  reason: m,
@@ -76,55 +80,55 @@ function ce({ dictionary: c, companyId: f, payrollType: m = "bonus" }) {
76
80
  startDate: null,
77
81
  endDate: null,
78
82
  checkDate: null,
79
- skipRegularDeductions: u[m].skipDeductions,
83
+ skipRegularDeductions: f[m].skipDeductions,
80
84
  includeAllEmployees: !1,
81
85
  selectedEmployeeUuids: []
82
86
  }
83
- }), p = r.watch("reason");
87
+ }), C = i.watch("reason");
84
88
  Y(() => {
85
- r.setValue(
89
+ i.setValue(
86
90
  "skipRegularDeductions",
87
- u[p].skipDeductions
91
+ f[C].skipDeductions
88
92
  ), O((e) => ({
89
93
  ...e,
90
- withholdingRate: u[p].withholdingType
94
+ withholdingRate: f[C].withholdingType
91
95
  }));
92
- }, [p, r]);
93
- const j = async (e) => {
94
- const o = e.reason, t = e.checkDate, l = e.startDate, C = e.endDate, w = e.includeAllEmployees ? k.map((s) => s.value) : e.selectedEmployeeUuids.length > 0 ? e.selectedEmployeeUuids : void 0;
96
+ }, [C, i]);
97
+ const V = async (e) => {
98
+ const o = e.reason, t = e.checkDate, n = e.startDate, r = e.endDate, w = e.includeAllEmployees ? k.map((l) => l.value) : e.selectedEmployeeUuids.length > 0 ? e.selectedEmployeeUuids : void 0;
95
99
  await A(e, async () => {
96
- const s = await N({
100
+ const l = await N({
97
101
  request: {
98
- companyId: f,
102
+ companyId: y,
99
103
  requestBody: {
100
104
  offCycle: !0,
101
105
  offCycleReason: ae[o],
102
- startDate: new g(l),
103
- endDate: new g(C),
106
+ startDate: new g(n),
107
+ endDate: new g(r),
104
108
  checkDate: new g(t),
105
109
  skipRegularDeductions: e.skipRegularDeductions,
106
110
  isCheckOnlyPayroll: e.isCheckOnly,
107
111
  employeeUuids: w,
108
- withholdingPayPeriod: y.withholdingPayPeriod,
109
- fixedWithholdingRate: y.withholdingRate === "supplemental"
112
+ withholdingPayPeriod: h.withholdingPayPeriod,
113
+ fixedWithholdingRate: h.withholdingRate === "supplemental"
110
114
  }
111
115
  }
112
- }), d = s.payrollUnprocessed?.payrollUuid ?? s.payrollUnprocessed?.uuid;
113
- if (!d)
114
- throw new re(D("errors.missingPayrollId"));
115
- v(se.OFF_CYCLE_CREATED, { payrollUuid: d });
116
+ }), u = l.payrollUnprocessed?.payrollUuid ?? l.payrollUnprocessed?.uuid;
117
+ if (!u)
118
+ throw new ie(D("errors.missingPayrollId"));
119
+ W(le.OFF_CYCLE_CREATED, { payrollUuid: u });
116
120
  });
117
121
  };
118
- return /* @__PURE__ */ a(K, { ...r, children: /* @__PURE__ */ a(ie, { onSubmit: r.handleSubmit(j), children: /* @__PURE__ */ a(
122
+ return /* @__PURE__ */ c(J, { ...i, children: /* @__PURE__ */ c(re, { onSubmit: i.handleSubmit(V), children: /* @__PURE__ */ c(
119
123
  ee,
120
124
  {
121
125
  employees: k,
122
126
  isPending: L,
123
- taxWithholdingConfig: y,
127
+ taxWithholdingConfig: h,
124
128
  isTaxWithholdingModalOpen: M,
125
129
  onTaxWithholdingEditClick: _,
126
- onTaxWithholdingModalDone: B,
127
- onTaxWithholdingModalCancel: I
130
+ onTaxWithholdingModalDone: j,
131
+ onTaxWithholdingModalCancel: B
128
132
  }
129
133
  ) }) });
130
134
  }
@@ -1 +1 @@
1
- {"version":3,"file":"OffCycleCreation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreation.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react'\nimport { FormProvider, useForm, type Resolver } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport {\n OffCycleReason as ApiOffCycleReason,\n WithholdingPayPeriod,\n} from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\nimport { OFF_CYCLE_REASON_DEFAULTS, type OffCycleReason } from '../OffCycleReasonSelection'\nimport {\n createOffCyclePayPeriodDateFormSchema,\n type OffCyclePayrollDateType,\n} from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes'\nimport { useOffCyclePayPeriodDateValidation } from '../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation'\nimport type { OffCycleTaxWithholdingConfig } from '../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes'\nimport type { OffCycleCreationFormData, OffCycleCreationProps } from './OffCycleCreationTypes'\nimport { OffCycleCreationPresentation } from './OffCycleCreationPresentation'\nimport { useCompanyPaymentSpeed } from '@/hooks/useCompanyPaymentSpeed'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { Form } from '@/components/Common/Form'\nimport type { MultiSelectComboBoxOption } from '@/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes'\n\nconst LOCAL_TO_API_REASON: Record<OffCycleReason, ApiOffCycleReason> = {\n bonus: ApiOffCycleReason.Bonus,\n correction: ApiOffCycleReason.Correction,\n}\n\n/**\n * Creation form for off-cycle (bonus or correction) payrolls.\n *\n * Walks the user through configuring pay period dates, selecting a reason, choosing\n * employees, and setting deduction and tax withholding preferences, then submits the\n * resulting payroll for execution.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `offCycle/created` | The off-cycle payroll has been created | `{ payrollUuid: string }` |\n *\n * Changing the reason updates the deduction and withholding defaults — `'bonus'` skips\n * regular deductions and uses the supplemental withholding rate; `'correction'` includes\n * regular deductions and uses the regular rate.\n *\n * @param props - {@link OffCycleCreationProps} plus base component props.\n * @returns The off-cycle payroll creation form.\n * @public\n */\nexport function OffCycleCreation(props: OffCycleCreationProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ dictionary, companyId, payrollType = 'bonus' }: OffCycleCreationProps) {\n useComponentDictionary('Payroll.OffCycleCreation', dictionary)\n useI18n('Payroll.OffCycleCreation')\n useI18n('Payroll.OffCycleReasonSelection')\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n useI18n('Payroll.OffCycleDeductionsSetting')\n useI18n('Payroll.EmployeeSelection')\n\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n const { t: tCreation } = useTranslation('Payroll.OffCycleCreation')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { paymentSpeedDays } = useCompanyPaymentSpeed(companyId)\n\n const { minCheckDate, today } = useOffCyclePayPeriodDateValidation(paymentSpeedDays)\n const { mutateAsync: createOffCyclePayroll, isPending } = usePayrollsCreateOffCycleMutation()\n\n const [taxWithholdingConfig, setTaxWithholdingConfig] = useState<OffCycleTaxWithholdingConfig>({\n withholdingPayPeriod: WithholdingPayPeriod.EveryOtherWeek,\n withholdingRate: OFF_CYCLE_REASON_DEFAULTS[payrollType].withholdingType,\n })\n const [isTaxWithholdingModalOpen, setIsTaxWithholdingModalOpen] = useState(false)\n\n const handleTaxWithholdingEditClick = useCallback(() => {\n setIsTaxWithholdingModalOpen(true)\n }, [])\n\n const handleTaxWithholdingModalDone = useCallback((config: OffCycleTaxWithholdingConfig) => {\n setTaxWithholdingConfig(config)\n setIsTaxWithholdingModalOpen(false)\n }, [])\n\n const handleTaxWithholdingModalCancel = useCallback(() => {\n setIsTaxWithholdingModalOpen(false)\n }, [])\n\n const { data: employeesData } = useEmployeesListSuspense({\n companyId,\n onboardedActive: true,\n })\n\n const employees: MultiSelectComboBoxOption[] = useMemo(() => {\n const employeeList = employeesData.showEmployees ?? []\n return [...employeeList]\n .sort((a, b) => {\n const lastNameComparison = a.lastName.localeCompare(b.lastName)\n if (lastNameComparison !== 0) return lastNameComparison\n return a.firstName.localeCompare(b.firstName)\n })\n .map(employee => {\n const fullName = [employee.firstName, employee.lastName].filter(Boolean).join(' ')\n return {\n label: fullName,\n value: employee.uuid,\n }\n })\n }, [employeesData])\n\n const translateValidation = (key: string, options?: Record<string, unknown>): string =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n t(key as any, options as any) as string\n\n const dynamicResolver: Resolver<OffCycleCreationFormData> = (values, context, options) => {\n const reason = values.reason\n const isCheckOnly = values.isCheckOnly\n const resolvedPayrollType: OffCyclePayrollDateType =\n reason === 'correction' ? 'correction' : payrollType\n\n const dateSchema = createOffCyclePayPeriodDateFormSchema(\n translateValidation,\n resolvedPayrollType,\n isCheckOnly ? today : minCheckDate,\n paymentSpeedDays,\n )\n const schema = z\n .object({\n reason: z.enum(['bonus', 'correction']),\n skipRegularDeductions: z.boolean(),\n includeAllEmployees: z.boolean(),\n selectedEmployeeUuids: z.array(z.string()),\n })\n .and(dateSchema)\n .superRefine((data, ctx) => {\n if (!data.includeAllEmployees && data.selectedEmployeeUuids.length === 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['selectedEmployeeUuids'],\n message: tCreation('errors.noEmployeesSelected'),\n })\n }\n })\n\n return zodResolver(schema)(values, context, options)\n }\n\n const methods = useForm<OffCycleCreationFormData>({\n resolver: dynamicResolver,\n defaultValues: {\n reason: payrollType,\n isCheckOnly: false,\n startDate: null,\n endDate: null,\n checkDate: null,\n skipRegularDeductions: OFF_CYCLE_REASON_DEFAULTS[payrollType].skipDeductions,\n includeAllEmployees: false,\n selectedEmployeeUuids: [],\n },\n })\n\n const watchedReason = methods.watch('reason')\n\n useEffect(() => {\n methods.setValue(\n 'skipRegularDeductions',\n OFF_CYCLE_REASON_DEFAULTS[watchedReason].skipDeductions,\n )\n setTaxWithholdingConfig(prev => ({\n ...prev,\n withholdingRate: OFF_CYCLE_REASON_DEFAULTS[watchedReason].withholdingType,\n }))\n }, [watchedReason, methods])\n\n const onSubmit = async (data: OffCycleCreationFormData) => {\n const reason = data.reason\n const checkDate = data.checkDate!\n const startDate = data.startDate!\n const endDate = data.endDate!\n const employeeUuids = data.includeAllEmployees\n ? employees.map(e => e.value)\n : data.selectedEmployeeUuids.length > 0\n ? data.selectedEmployeeUuids\n : undefined\n\n await baseSubmitHandler(data, async () => {\n const response = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: LOCAL_TO_API_REASON[reason],\n startDate: new RFCDate(startDate),\n endDate: new RFCDate(endDate),\n checkDate: new RFCDate(checkDate),\n skipRegularDeductions: data.skipRegularDeductions,\n isCheckOnlyPayroll: data.isCheckOnly,\n employeeUuids,\n withholdingPayPeriod: taxWithholdingConfig.withholdingPayPeriod,\n fixedWithholdingRate: taxWithholdingConfig.withholdingRate === 'supplemental',\n },\n },\n })\n\n const payrollUuid =\n response.payrollUnprocessed?.payrollUuid ?? response.payrollUnprocessed?.uuid\n\n if (!payrollUuid) {\n throw new SDKInternalError(tCreation('errors.missingPayrollId'))\n }\n\n onEvent(componentEvents.OFF_CYCLE_CREATED, { payrollUuid })\n })\n }\n\n return (\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(onSubmit)}>\n <OffCycleCreationPresentation\n employees={employees}\n isPending={isPending}\n taxWithholdingConfig={taxWithholdingConfig}\n isTaxWithholdingModalOpen={isTaxWithholdingModalOpen}\n onTaxWithholdingEditClick={handleTaxWithholdingEditClick}\n onTaxWithholdingModalDone={handleTaxWithholdingModalDone}\n onTaxWithholdingModalCancel={handleTaxWithholdingModalCancel}\n />\n </Form>\n </FormProvider>\n )\n}\n"],"names":["LOCAL_TO_API_REASON","ApiOffCycleReason","OffCycleCreation","props","jsx","BaseComponent","Root","dictionary","companyId","payrollType","useComponentDictionary","useI18n","t","useTranslation","tCreation","onEvent","baseSubmitHandler","useBase","paymentSpeedDays","useCompanyPaymentSpeed","minCheckDate","today","useOffCyclePayPeriodDateValidation","createOffCyclePayroll","isPending","usePayrollsCreateOffCycleMutation","taxWithholdingConfig","setTaxWithholdingConfig","useState","WithholdingPayPeriod","OFF_CYCLE_REASON_DEFAULTS","isTaxWithholdingModalOpen","setIsTaxWithholdingModalOpen","handleTaxWithholdingEditClick","useCallback","handleTaxWithholdingModalDone","config","handleTaxWithholdingModalCancel","employeesData","useEmployeesListSuspense","employees","useMemo","a","b","lastNameComparison","employee","translateValidation","key","options","methods","useForm","values","context","reason","isCheckOnly","dateSchema","createOffCyclePayPeriodDateFormSchema","schema","z","data","ctx","zodResolver","watchedReason","useEffect","prev","onSubmit","checkDate","startDate","endDate","employeeUuids","e","response","RFCDate","payrollUuid","SDKInternalError","componentEvents","FormProvider","Form","OffCycleCreationPresentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,KAAiE;AAAA,EACrE,OAAOC,EAAkB;AAAA,EACzB,YAAYA,EAAkB;AAChC;AAsBO,SAASC,GAAiBC,GAA8B;AAC7D,SACE,gBAAAC,EAACC,MAAe,GAAGF,GACjB,4BAACG,IAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,GAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,aAAAC,IAAc,WAAkC;AACrF,EAAAC,GAAuB,4BAA4BH,CAAU,GAC7DI,EAAQ,0BAA0B,GAClCA,EAAQ,iCAAiC,GACzCA,EAAQ,mCAAmC,GAC3CA,EAAQ,mCAAmC,GAC3CA,EAAQ,2BAA2B;AAEnC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,mCAAmC,GAC1D,EAAE,GAAGC,MAAcD,EAAe,0BAA0B,GAC5D,EAAE,SAAAE,GAAS,mBAAAC,EAAA,IAAsBC,GAAA,GAEjC,EAAE,kBAAAC,EAAA,IAAqBC,GAAuBX,CAAS,GAEvD,EAAE,cAAAY,GAAc,OAAAC,MAAUC,EAAmCJ,CAAgB,GAC7E,EAAE,aAAaK,GAAuB,WAAAC,EAAA,IAAcC,EAAA,GAEpD,CAACC,GAAsBC,CAAuB,IAAIC,EAAuC;AAAA,IAC7F,sBAAsBC,EAAq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A8B,MAAKA,EAAE,KAAK,IAC1BX,EAAK,sBAAsB,SAAS,IAClCA,EAAK,wBACL;AAEN,UAAM3C,EAAkB2C,GAAM,YAAY;AACxC,YAAMY,IAAW,MAAMhD,EAAsB;AAAA,QAC3C,SAAS;AAAA,UACP,WAAAf;AAAA,UACA,aAAa;AAAA,YACX,UAAU;AAAA,YACV,gBAAgBR,GAAoBqD,CAAM;AAAA,YAC1C,WAAW,IAAImB,EAAQL,CAAS;AAAA,YAChC,SAAS,IAAIK,EAAQJ,CAAO;AAAA,YAC5B,WAAW,IAAII,EAAQN,CAAS;AAAA,YAChC,uBAAuBP,EAAK;AAAA,YAC5B,oBAAoBA,EAAK;AAAA,YACzB,eAAAU;AAAA,YACA,sBAAsB3C,EAAqB;AAAA,YAC3C,sBAAsBA,EAAqB,oBAAoB;AAAA,UAAA;AAAA,QACjE;AAAA,MACF,CACD,GAEK+C,IACJF,EAAS,oBAAoB,eAAeA,EAAS,oBAAoB;AAE3E,UAAI,CAACE;AACH,cAAM,IAAIC,GAAiB5D,EAAU,yBAAyB,CAAC;AAGjE,MAAAC,EAAQ4D,GAAgB,mBAAmB,EAAE,aAAAF,EAAA,CAAa;AAAA,IAC5D,CAAC;AAAA,EACH;AAEA,SACE,gBAAArE,EAACwE,GAAA,EAAc,GAAG3B,GAChB,UAAA,gBAAA7C,EAACyE,MAAK,UAAU5B,EAAQ,aAAagB,CAAQ,GAC3C,UAAA,gBAAA7D;AAAA,IAAC0E;AAAA,IAAA;AAAA,MACC,WAAAtC;AAAA,MACA,WAAAhB;AAAA,MACA,sBAAAE;AAAA,MACA,2BAAAK;AAAA,MACA,2BAA2BE;AAAA,MAC3B,2BAA2BE;AAAA,MAC3B,6BAA6BE;AAAA,IAAA;AAAA,EAAA,GAEjC,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"OffCycleCreation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreation.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react'\nimport { FormProvider, useForm, type Resolver } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport {\n OffCycleReason as ApiOffCycleReason,\n WithholdingPayPeriod,\n} from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\nimport { OFF_CYCLE_REASON_DEFAULTS, type OffCycleReason } from '../OffCycleReasonSelection'\nimport {\n createOffCyclePayPeriodDateFormSchema,\n type OffCyclePayrollDateType,\n} from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes'\nimport { useOffCyclePayPeriodDateValidation } from '../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation'\nimport type { OffCycleTaxWithholdingConfig } from '../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes'\nimport type { OffCycleCreationFormData, OffCycleCreationProps } from './OffCycleCreationTypes'\nimport { OffCycleCreationPresentation } from './OffCycleCreationPresentation'\nimport { useCompanyPaymentSpeed } from '@/hooks/useCompanyPaymentSpeed'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { Form } from '@/components/Common/Form'\nimport type { MultiSelectComboBoxOption } from '@/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes'\n\nconst LOCAL_TO_API_REASON: Record<OffCycleReason, ApiOffCycleReason> = {\n bonus: ApiOffCycleReason.Bonus,\n correction: ApiOffCycleReason.Correction,\n}\n\n/**\n * Creation form for off-cycle (bonus or correction) payrolls.\n *\n * Walks the user through configuring pay period dates, selecting a reason, choosing\n * employees, and setting deduction and tax withholding preferences, then submits the\n * resulting payroll for execution.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `offCycle/created` | The off-cycle payroll has been created | `{ payrollUuid: string }` |\n *\n * Changing the reason updates the deduction and withholding defaults — `'bonus'` skips\n * regular deductions and uses the supplemental withholding rate; `'correction'` includes\n * regular deductions and uses the regular rate.\n *\n * @param props - {@link OffCycleCreationProps} plus base component props.\n * @returns The off-cycle payroll creation form.\n * @public\n */\nexport function OffCycleCreation(props: OffCycleCreationProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ dictionary, companyId, payrollType = 'bonus' }: OffCycleCreationProps) {\n useComponentDictionary('Payroll.OffCycleCreation', dictionary)\n useI18n('Payroll.OffCycleCreation')\n useI18n('Payroll.OffCycleReasonSelection')\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n useI18n('Payroll.OffCycleDeductionsSetting')\n useI18n('Payroll.EmployeeSelection')\n\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n const { t: tCreation } = useTranslation('Payroll.OffCycleCreation')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { paymentSpeedDays } = useCompanyPaymentSpeed(companyId)\n\n const { minCheckDate, today } = useOffCyclePayPeriodDateValidation(paymentSpeedDays)\n const { mutateAsync: createOffCyclePayroll, isPending } = usePayrollsCreateOffCycleMutation()\n\n const [taxWithholdingConfig, setTaxWithholdingConfig] = useState<OffCycleTaxWithholdingConfig>({\n withholdingPayPeriod: WithholdingPayPeriod.EveryOtherWeek,\n withholdingRate: OFF_CYCLE_REASON_DEFAULTS[payrollType].withholdingType,\n })\n const [isTaxWithholdingModalOpen, setIsTaxWithholdingModalOpen] = useState(false)\n\n const handleTaxWithholdingEditClick = useCallback(() => {\n setIsTaxWithholdingModalOpen(true)\n }, [])\n\n const handleTaxWithholdingModalDone = useCallback((config: OffCycleTaxWithholdingConfig) => {\n setTaxWithholdingConfig(config)\n setIsTaxWithholdingModalOpen(false)\n }, [])\n\n const handleTaxWithholdingModalCancel = useCallback(() => {\n setIsTaxWithholdingModalOpen(false)\n }, [])\n\n const { data: employeesData } = useEmployeesListSuspense({\n companyId,\n onboardedActive: true,\n })\n\n const employees: MultiSelectComboBoxOption[] = useMemo(() => {\n const employeeList = employeesData.showEmployees ?? []\n return [...employeeList]\n .sort((a, b) => {\n const lastNameComparison = a.lastName.localeCompare(b.lastName)\n if (lastNameComparison !== 0) return lastNameComparison\n return a.firstName.localeCompare(b.firstName)\n })\n .map(employee => {\n const fullName = [employee.firstName, employee.lastName].filter(Boolean).join(' ')\n const primaryJob = employee.jobs?.find(job => job.primary) ?? employee.jobs?.[0]\n return {\n label: fullName,\n value: employee.uuid,\n description: primaryJob?.title || undefined,\n }\n })\n }, [employeesData])\n\n const translateValidation = (key: string, options?: Record<string, unknown>): string =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n t(key as any, options as any) as string\n\n const dynamicResolver: Resolver<OffCycleCreationFormData> = (values, context, options) => {\n const reason = values.reason\n const isCheckOnly = values.isCheckOnly\n const resolvedPayrollType: OffCyclePayrollDateType =\n reason === 'correction' ? 'correction' : payrollType\n\n const dateSchema = createOffCyclePayPeriodDateFormSchema(\n translateValidation,\n resolvedPayrollType,\n isCheckOnly ? today : minCheckDate,\n paymentSpeedDays,\n )\n const schema = z\n .object({\n reason: z.enum(['bonus', 'correction']),\n skipRegularDeductions: z.boolean(),\n includeAllEmployees: z.boolean(),\n selectedEmployeeUuids: z.array(z.string()),\n })\n .and(dateSchema)\n .superRefine((data, ctx) => {\n if (!data.includeAllEmployees && data.selectedEmployeeUuids.length === 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['selectedEmployeeUuids'],\n message: tCreation('errors.noEmployeesSelected'),\n })\n }\n })\n\n return zodResolver(schema)(values, context, options)\n }\n\n const methods = useForm<OffCycleCreationFormData>({\n resolver: dynamicResolver,\n defaultValues: {\n reason: payrollType,\n isCheckOnly: false,\n startDate: null,\n endDate: null,\n checkDate: null,\n skipRegularDeductions: OFF_CYCLE_REASON_DEFAULTS[payrollType].skipDeductions,\n includeAllEmployees: false,\n selectedEmployeeUuids: [],\n },\n })\n\n const watchedReason = methods.watch('reason')\n\n useEffect(() => {\n methods.setValue(\n 'skipRegularDeductions',\n OFF_CYCLE_REASON_DEFAULTS[watchedReason].skipDeductions,\n )\n setTaxWithholdingConfig(prev => ({\n ...prev,\n withholdingRate: OFF_CYCLE_REASON_DEFAULTS[watchedReason].withholdingType,\n }))\n }, [watchedReason, methods])\n\n const onSubmit = async (data: OffCycleCreationFormData) => {\n const reason = data.reason\n const checkDate = data.checkDate!\n const startDate = data.startDate!\n const endDate = data.endDate!\n const employeeUuids = data.includeAllEmployees\n ? employees.map(e => e.value)\n : data.selectedEmployeeUuids.length > 0\n ? data.selectedEmployeeUuids\n : undefined\n\n await baseSubmitHandler(data, async () => {\n const response = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: LOCAL_TO_API_REASON[reason],\n startDate: new RFCDate(startDate),\n endDate: new RFCDate(endDate),\n checkDate: new RFCDate(checkDate),\n skipRegularDeductions: data.skipRegularDeductions,\n isCheckOnlyPayroll: data.isCheckOnly,\n employeeUuids,\n withholdingPayPeriod: taxWithholdingConfig.withholdingPayPeriod,\n fixedWithholdingRate: taxWithholdingConfig.withholdingRate === 'supplemental',\n },\n },\n })\n\n const payrollUuid =\n response.payrollUnprocessed?.payrollUuid ?? response.payrollUnprocessed?.uuid\n\n if (!payrollUuid) {\n throw new SDKInternalError(tCreation('errors.missingPayrollId'))\n }\n\n onEvent(componentEvents.OFF_CYCLE_CREATED, { payrollUuid })\n })\n }\n\n return (\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(onSubmit)}>\n <OffCycleCreationPresentation\n employees={employees}\n isPending={isPending}\n taxWithholdingConfig={taxWithholdingConfig}\n isTaxWithholdingModalOpen={isTaxWithholdingModalOpen}\n onTaxWithholdingEditClick={handleTaxWithholdingEditClick}\n onTaxWithholdingModalDone={handleTaxWithholdingModalDone}\n onTaxWithholdingModalCancel={handleTaxWithholdingModalCancel}\n />\n </Form>\n </FormProvider>\n )\n}\n"],"names":["LOCAL_TO_API_REASON","ApiOffCycleReason","OffCycleCreation","props","jsx","BaseComponent","Root","dictionary","companyId","payrollType","useComponentDictionary","useI18n","t","useTranslation","tCreation","onEvent","baseSubmitHandler","useBase","paymentSpeedDays","useCompanyPaymentSpeed","minCheckDate","today","useOffCyclePayPeriodDateValidation","createOffCyclePayroll","isPending","usePayrollsCreateOffCycleMutation","taxWithholdingConfig","setTaxWithholdingConfig","useState","WithholdingPayPeriod","OFF_CYCLE_REASON_DEFAULTS","isTaxWithholdingModalOpen","setIsTaxWithholdingModalOpen","handleTaxWithholdingEditClick","useCallback","handleTaxWithholdingModalDone","config","handleTaxWithholdingModalCancel","employeesData","useEmployeesListSuspense","employees","useMemo","a","b","lastNameComparison","employee","fullName","primaryJob","job","translateValidation","key","options","methods","useForm","values","context","reason","isCheckOnly","dateSchema","createOffCyclePayPeriodDateFormSchema","schema","z","data","ctx","zodResolver","watchedReason","useEffect","prev","onSubmit","checkDate","startDate","endDate","employeeUuids","e","response","RFCDate","payrollUuid","SDKInternalError","componentEvents","FormProvider","Form","OffCycleCreationPresentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,KAAiE;AAAA,EACrE,OAAOC,EAAkB;AAAA,EACzB,YAAYA,EAAkB;AAChC;AAsBO,SAASC,GAAiBC,GAA8B;AAC7D,SACE,gBAAAC,EAACC,MAAe,GAAGF,GACjB,4BAACG,IAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,GAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,aAAAC,IAAc,WAAkC;AACrF,EAAAC,GAAuB,4BAA4BH,CAAU,GAC7DI,EAAQ,0BAA0B,GAClCA,EAAQ,iCAAiC,GACzC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