@gusto/embedded-react-sdk 0.52.0 → 0.52.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/components/Base/Base.d.ts +2 -0
  3. package/dist/components/Base/Base.js.map +1 -1
  4. package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +4 -1
  5. package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -1
  6. package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js.map +1 -1
  7. package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.d.ts +1 -1
  8. package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.js.map +1 -1
  9. package/dist/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +2 -2
  10. package/dist/components/Common/UI/DateRangePicker/DateRangePickerTypes.d.ts +3 -2
  11. package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.d.ts +1 -1
  12. package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js.map +1 -1
  13. package/dist/components/Common/UI/Menu/MenuTypes.d.ts +3 -3
  14. package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
  15. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +2 -2
  16. package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.d.ts +2 -2
  17. package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.js.map +1 -1
  18. package/dist/components/Common/UI/Select/SelectTypes.d.ts +2 -2
  19. package/dist/components/Common/UI/Table/TableTypes.d.ts +4 -4
  20. package/dist/components/Common/UI/Table/TableTypes.js.map +1 -1
  21. package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +2 -2
  22. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/fields.js +4 -4
  23. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +5 -5
  24. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +0 -1
  25. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +12 -14
  26. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +1 -1
  27. package/dist/components/Contractor/Address/Address.js +83 -75
  28. package/dist/components/Contractor/Address/Address.js.map +1 -1
  29. package/dist/components/Contractor/ContractorList/index.d.ts +2 -1
  30. package/dist/components/Contractor/ContractorList/index.js +112 -99
  31. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  32. package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js +170 -123
  33. package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js.map +1 -1
  34. package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.module.scss.js +12 -0
  35. package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.module.scss.js.map +1 -0
  36. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/fields.js +44 -43
  37. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/fields.js.map +1 -1
  38. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.js +91 -88
  39. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.js.map +1 -1
  40. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.d.ts +0 -33
  41. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.js +77 -86
  42. package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.js.map +1 -1
  43. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.d.ts +1 -1
  44. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js.map +1 -1
  45. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.d.ts +2 -0
  46. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
  47. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +150 -80
  48. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
  49. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.test.d.ts +1 -0
  50. package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/fields.js +1 -1
  51. package/dist/components/Contractor/Profile/BusinessSelfOnboardingProfile.js +19 -18
  52. package/dist/components/Contractor/Profile/BusinessSelfOnboardingProfile.js.map +1 -1
  53. package/dist/components/Contractor/Profile/ContractorProfile.d.ts +1 -1
  54. package/dist/components/Contractor/Profile/ContractorProfile.js +121 -111
  55. package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -1
  56. package/dist/components/Contractor/Profile/IndividualSelfOnboardingProfile.js +27 -26
  57. package/dist/components/Contractor/Profile/IndividualSelfOnboardingProfile.js.map +1 -1
  58. package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/fields.js +16 -16
  59. package/dist/components/Contractor/Submit/Submit.js +127 -67
  60. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  61. package/dist/components/Contractor/shared/useContractorHasSignedW9.d.ts +8 -0
  62. package/dist/components/Contractor/shared/useContractorHasSignedW9.js +10 -0
  63. package/dist/components/Contractor/shared/useContractorHasSignedW9.js.map +1 -0
  64. package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js +4 -4
  65. package/dist/components/Employee/Compensation/shared/useJobForm/fields.js +6 -6
  66. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js +8 -8
  67. package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js +4 -4
  68. package/dist/components/Employee/Documents/shared/useSignEmployeeForm/fields.js +1 -1
  69. package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/fields.js +4 -4
  70. package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js +1 -1
  71. package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js +4 -4
  72. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/fields.js +8 -8
  73. package/dist/components/Employee/Profile/shared/useHomeAddressForm/fields.js +5 -5
  74. package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.d.ts +1 -0
  75. package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.js.map +1 -1
  76. package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js +4 -4
  77. package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.d.ts +1 -0
  78. package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.js.map +1 -1
  79. package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js +8 -8
  80. package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.d.ts +2 -2
  81. package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.js.map +1 -1
  82. package/dist/components/index.d.ts +40 -0
  83. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +1 -1
  84. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  85. package/dist/contexts/GustoProvider/GustoProvider.d.ts +1 -0
  86. package/dist/contexts/GustoProvider/GustoProvider.js.map +1 -1
  87. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +1 -0
  88. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  89. package/dist/contexts/ThemeProvider/types.d.ts +2 -2
  90. package/dist/i18n/en/Contractor.Address.json.js +22 -20
  91. package/dist/i18n/en/Contractor.Address.json.js.map +1 -1
  92. package/dist/i18n/en/Contractor.ContractorList.json.js +22 -20
  93. package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -1
  94. package/dist/i18n/en/Contractor.Profile.json.js +13 -11
  95. package/dist/i18n/en/Contractor.Profile.json.js.map +1 -1
  96. package/dist/i18n/en/Contractor.SignatureForm.json.js +5 -5
  97. package/dist/i18n/en/Contractor.Submit.json.js +11 -11
  98. package/dist/i18n/types.d.ts +29 -9
  99. package/dist/index.d.ts +6 -3
  100. package/dist/models/WA_RISK_CODES.d.ts +1 -0
  101. package/dist/models/WA_RISK_CODES.js.map +1 -1
  102. package/dist/partner-hook-utils/composeErrorHandler.d.ts +4 -0
  103. package/dist/partner-hook-utils/composeErrorHandler.js.map +1 -1
  104. package/dist/partner-hook-utils/form/SDKFormProvider.d.ts +1 -0
  105. package/dist/partner-hook-utils/form/SDKFormProvider.js.map +1 -1
  106. package/dist/partner-hook-utils/form/composeSubmitHandler.d.ts +4 -0
  107. package/dist/partner-hook-utils/form/composeSubmitHandler.js.map +1 -1
  108. package/dist/partner-hook-utils/form/fields/CheckboxHookField.d.ts +1 -0
  109. package/dist/partner-hook-utils/form/fields/CheckboxHookField.js.map +1 -1
  110. package/dist/partner-hook-utils/form/fields/DatePickerHookField.d.ts +1 -0
  111. package/dist/partner-hook-utils/form/fields/DatePickerHookField.js.map +1 -1
  112. package/dist/partner-hook-utils/form/fields/NumberInputHookField.d.ts +1 -0
  113. package/dist/partner-hook-utils/form/fields/NumberInputHookField.js.map +1 -1
  114. package/dist/partner-hook-utils/form/fields/RadioGroupHookField.d.ts +1 -0
  115. package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
  116. package/dist/partner-hook-utils/form/fields/SelectHookField.d.ts +1 -0
  117. package/dist/partner-hook-utils/form/fields/SelectHookField.js.map +1 -1
  118. package/dist/partner-hook-utils/form/fields/SwitchHookField.d.ts +1 -0
  119. package/dist/partner-hook-utils/form/fields/SwitchHookField.js.map +1 -1
  120. package/dist/partner-hook-utils/form/fields/TextInputHookField.d.ts +1 -0
  121. package/dist/partner-hook-utils/form/fields/TextInputHookField.js.map +1 -1
  122. package/dist/partner-hook-utils/types.d.ts +9 -0
  123. package/dist/shared/constants.d.ts +10 -0
  124. package/dist/shared/constants.js +7 -6
  125. package/dist/shared/constants.js.map +1 -1
  126. package/dist/style.css +1 -1
  127. package/dist/types/Helpers.d.ts +2 -0
  128. package/dist/types/hooks.d.ts +1 -0
  129. package/dist/types/observability.d.ts +1 -0
  130. package/docs/guides/endpoint-inventory.json +17 -28
  131. package/package.json +16 -16
@@ -1,91 +1,99 @@
1
- import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
- import { useTranslation as c } from "react-i18next";
3
- import g from "classnames";
4
- import C from "./Address.module.scss.js";
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
+ import { useTranslation as m } from "react-i18next";
3
+ import R from "classnames";
4
+ import b from "./Address.module.scss.js";
5
5
  import { useContractorAddressForm as E } from "./shared/useContractorAddressForm/useContractorAddressForm.js";
6
6
  import { BaseBoundaries as S, BaseLayout as p } from "../../Base/Base.js";
7
7
  import "../../Base/useBase.js";
8
- import { SDKFormProvider as b } from "../../../partner-hook-utils/form/SDKFormProvider.js";
9
- import { Form as v } from "../../Common/Form/Form.js";
10
- import { Flex as u } from "../../Common/Flex/Flex.js";
11
- import { Grid as I } from "../../Common/Grid/Grid.js";
12
- import { ActionsLayout as T } from "../../Common/ActionsLayout/ActionsLayout.js";
13
- import { useComponentContext as y } from "../../../contexts/ComponentAdapter/useComponentContext.js";
8
+ import { SDKFormProvider as v } from "../../../partner-hook-utils/form/SDKFormProvider.js";
9
+ import { Form as T } from "../../Common/Form/Form.js";
10
+ import { Flex as f } from "../../Common/Flex/Flex.js";
11
+ import { Grid as y } from "../../Common/Grid/Grid.js";
12
+ import { ActionsLayout as I } from "../../Common/ActionsLayout/ActionsLayout.js";
13
+ import { useComponentContext as h } from "../../../contexts/ComponentAdapter/useComponentContext.js";
14
14
  import "react";
15
15
  import { useComponentDictionary as x, useI18n as _ } from "../../../i18n/I18n.js";
16
- import { contractorEvents as f } from "../../../shared/constants.js";
17
- const F = {
16
+ import { contractorEvents as g } from "../../../shared/constants.js";
17
+ import { useContractorHasSignedW9 as F } from "../shared/useContractorHasSignedW9.js";
18
+ const L = {
18
19
  update: ["street1", "city", "state", "zip"]
19
20
  };
20
- function G({ onEvent: n, FallbackComponent: a, ...i }) {
21
- return /* @__PURE__ */ e(S, { componentName: "Contractor.Address", FallbackComponent: a, children: /* @__PURE__ */ e(L, { onEvent: n, ...i }) });
21
+ function J({ onEvent: s, FallbackComponent: i, ...o }) {
22
+ return /* @__PURE__ */ t(S, { componentName: "Contractor.Address", FallbackComponent: i, children: /* @__PURE__ */ t(B, { onEvent: s, ...o }) });
22
23
  }
23
- function L({
24
- contractorId: n,
25
- defaultValues: a,
26
- onEvent: i,
27
- dictionary: D,
28
- className: h
24
+ function N({ contractorId: s }) {
25
+ const i = F(s), { t: o } = m("Contractor.Address"), d = h();
26
+ return i ? /* @__PURE__ */ t(d.Alert, { status: "warning", disableScrollIntoView: !0, label: o("w9EditWarning.label"), children: /* @__PURE__ */ t(d.Text, { children: o("w9EditWarning.body") }) }) : null;
27
+ }
28
+ function B({
29
+ contractorId: s,
30
+ defaultValues: i,
31
+ onEvent: o,
32
+ dictionary: d,
33
+ className: D
29
34
  }) {
30
- x("Contractor.Address", D), _("Contractor.Address");
31
- const { t } = c("Contractor.Address"), { t: A } = c("common"), d = y(), r = E({
32
- contractorId: n,
33
- optionalFieldsToRequire: F,
34
- defaultValues: a
35
+ x("Contractor.Address", d), _("Contractor.Address");
36
+ const { t: r } = m("Contractor.Address"), { t: A } = m("common"), c = h(), e = E({
37
+ contractorId: s,
38
+ optionalFieldsToRequire: L,
39
+ defaultValues: i
35
40
  });
36
- if (r.isLoading)
37
- return /* @__PURE__ */ e(p, { isLoading: !0, error: r.errorHandling.errors });
38
- const { Fields: s } = r.form, m = r.data.contractorType === "Business", R = async () => {
39
- const o = await r.actions.onSubmit();
40
- o && (i(f.CONTRACTOR_ADDRESS_UPDATED, o.data), i(f.CONTRACTOR_ADDRESS_DONE));
41
+ if (e.isLoading)
42
+ return /* @__PURE__ */ t(p, { isLoading: !0, error: e.errorHandling.errors });
43
+ const { Fields: n } = e.form, u = e.data.contractorType === "Business", C = async () => {
44
+ const a = await e.actions.onSubmit();
45
+ a && (o(g.CONTRACTOR_ADDRESS_UPDATED, a.data), o(g.CONTRACTOR_ADDRESS_DONE));
41
46
  };
42
- return /* @__PURE__ */ e("section", { className: g(C.container, h), children: /* @__PURE__ */ e(p, { error: r.errorHandling.errors, children: /* @__PURE__ */ e(b, { formHookResult: r, children: /* @__PURE__ */ e(v, { onSubmit: () => {
43
- R();
44
- }, children: /* @__PURE__ */ l(u, { flexDirection: "column", gap: 32, alignItems: "stretch", children: [
45
- /* @__PURE__ */ e("header", { children: /* @__PURE__ */ l(u, { flexDirection: "column", gap: 4, children: [
46
- /* @__PURE__ */ e(d.Heading, { as: "h2", children: t(m ? "businessAddressTitle" : "homeAddressTitle") }),
47
- /* @__PURE__ */ e(d.Text, { variant: "supporting", children: t(m ? "businessAddressDescription" : "homeAddressDescription") })
48
- ] }) }),
49
- /* @__PURE__ */ l(I, { gridTemplateColumns: { base: "1fr", small: ["1fr", "1fr"] }, gap: 20, children: [
50
- /* @__PURE__ */ e(
51
- s.Street1,
52
- {
53
- label: t("street1"),
54
- validationMessages: { REQUIRED: t("validations.street1") }
55
- }
56
- ),
57
- /* @__PURE__ */ e(s.Street2, { label: t("street2") }),
58
- /* @__PURE__ */ e(
59
- s.City,
60
- {
61
- label: t("city"),
62
- validationMessages: { REQUIRED: t("validations.city") }
63
- }
64
- ),
65
- /* @__PURE__ */ e(
66
- s.State,
67
- {
68
- label: t("state"),
69
- placeholder: t("statePlaceholder"),
70
- validationMessages: { REQUIRED: t("validations.state") },
71
- getOptionLabel: (o) => A(`statesHash.${o}`, { defaultValue: o })
72
- }
73
- ),
74
- /* @__PURE__ */ e(
75
- s.Zip,
76
- {
77
- label: t("zip"),
78
- validationMessages: {
79
- REQUIRED: t("validations.zip"),
80
- INVALID_ZIP: t("validations.zipInvalid")
47
+ return /* @__PURE__ */ t("section", { className: R(b.container, D), children: /* @__PURE__ */ t(p, { error: e.errorHandling.errors, children: /* @__PURE__ */ t(v, { formHookResult: e, children: /* @__PURE__ */ l(T, { onSubmit: () => {
48
+ C();
49
+ }, children: [
50
+ /* @__PURE__ */ t(N, { contractorId: s }),
51
+ /* @__PURE__ */ l(f, { flexDirection: "column", gap: 32, alignItems: "stretch", children: [
52
+ /* @__PURE__ */ t("header", { children: /* @__PURE__ */ l(f, { flexDirection: "column", gap: 4, children: [
53
+ /* @__PURE__ */ t(c.Heading, { as: "h2", children: r(u ? "businessAddressTitle" : "homeAddressTitle") }),
54
+ /* @__PURE__ */ t(c.Text, { variant: "supporting", children: r(u ? "businessAddressDescription" : "homeAddressDescription") })
55
+ ] }) }),
56
+ /* @__PURE__ */ l(y, { gridTemplateColumns: { base: "1fr", small: ["1fr", "1fr"] }, gap: 20, children: [
57
+ /* @__PURE__ */ t(
58
+ n.Street1,
59
+ {
60
+ label: r("street1"),
61
+ validationMessages: { REQUIRED: r("validations.street1") }
62
+ }
63
+ ),
64
+ /* @__PURE__ */ t(n.Street2, { label: r("street2") }),
65
+ /* @__PURE__ */ t(
66
+ n.City,
67
+ {
68
+ label: r("city"),
69
+ validationMessages: { REQUIRED: r("validations.city") }
70
+ }
71
+ ),
72
+ /* @__PURE__ */ t(
73
+ n.State,
74
+ {
75
+ label: r("state"),
76
+ placeholder: r("statePlaceholder"),
77
+ validationMessages: { REQUIRED: r("validations.state") },
78
+ getOptionLabel: (a) => A(`statesHash.${a}`, { defaultValue: a })
79
+ }
80
+ ),
81
+ /* @__PURE__ */ t(
82
+ n.Zip,
83
+ {
84
+ label: r("zip"),
85
+ validationMessages: {
86
+ REQUIRED: r("validations.zip"),
87
+ INVALID_ZIP: r("validations.zipInvalid")
88
+ }
81
89
  }
82
- }
83
- )
84
- ] }),
85
- /* @__PURE__ */ e(T, { children: /* @__PURE__ */ e(d.Button, { type: "submit", isDisabled: r.status.isPending, children: r.status.isPending ? t("submitting") : t("submit") }) })
86
- ] }) }) }) }) });
90
+ )
91
+ ] }),
92
+ /* @__PURE__ */ t(I, { children: /* @__PURE__ */ t(c.Button, { type: "submit", isDisabled: e.status.isPending, children: e.status.isPending ? r("submitting") : r("submit") }) })
93
+ ] })
94
+ ] }) }) }) });
87
95
  }
88
96
  export {
89
- G as Address
97
+ J as Address
90
98
  };
91
99
  //# sourceMappingURL=Address.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Address.js","sources":["../../../../src/components/Contractor/Address/Address.tsx"],"sourcesContent":["import type { JSX } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport type { FallbackProps } from 'react-error-boundary'\nimport styles from './Address.module.scss'\nimport { useContractorAddressForm } from './shared/useContractorAddressForm'\nimport type { ContractorAddressOptionalFieldsToRequire } from './shared/useContractorAddressForm'\nimport type { AddressDefaultValues } from './types'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { Form } from '@/components/Common/Form'\nimport { Flex, Grid, ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport type { ResourceDictionary } from '@/types/Helpers'\nimport { contractorEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\n\n// The hook defaults to the API contract, which treats every address field as\n// optional. The SDK's address form has always required a complete mailing\n// address, so it opts those fields back into being required here.\nconst SDK_REQUIRED_ADDRESS_FIELDS: ContractorAddressOptionalFieldsToRequire = {\n update: ['street1', 'city', 'state', 'zip'],\n}\n\n/**\n * Props for {@link Address}.\n *\n * @public\n */\nexport interface AddressProps {\n /** The associated contractor identifier. */\n contractorId: string\n /** Pre-fill values for address fields. Server data takes precedence when the contractor already has an address on file. */\n defaultValues?: AddressDefaultValues\n /** Callback invoked each time the component emits an event. */\n onEvent: OnEventType<EventType, unknown>\n /** Overrides for the component's i18n strings. */\n dictionary?: ResourceDictionary<'Contractor.Address'>\n /** Optional class applied to the wrapping `<section>`. */\n className?: string\n /** Custom React component rendered when an unhandled error is caught by the component-level error boundary. */\n FallbackComponent?: (props: FallbackProps) => JSX.Element\n}\n\n/**\n * Form for collecting and updating a contractor's mailing address. Renders a business or home address title based on the contractor type.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/address/updated` | Fired after the address is saved | The updated `ContractorAddress` entity |\n * | `contractor/address/done` | Fired after a successful save so the parent flow can advance | — |\n *\n * @param props - See {@link AddressProps}.\n * @returns The contractor address form.\n * @public\n *\n * @example\n * ```tsx\n * import { ContractorOnboarding } from '@gusto/embedded-react-sdk'\n *\n * function MyComponent() {\n * return (\n * <ContractorOnboarding.Address\n * contractorId=\"contractor-uuid\"\n * onEvent={() => {}}\n * />\n * )\n * }\n * ```\n */\nexport function Address({ onEvent, FallbackComponent, ...rootProps }: AddressProps) {\n return (\n <BaseBoundaries componentName=\"Contractor.Address\" FallbackComponent={FallbackComponent}>\n <AddressRoot onEvent={onEvent} {...rootProps} />\n </BaseBoundaries>\n )\n}\n\nfunction AddressRoot({\n contractorId,\n defaultValues,\n onEvent,\n dictionary,\n className,\n}: Omit<AddressProps, 'FallbackComponent'>) {\n useComponentDictionary('Contractor.Address', dictionary)\n useI18n('Contractor.Address')\n const { t } = useTranslation('Contractor.Address')\n const { t: tCommon } = useTranslation('common')\n const Components = useComponentContext()\n\n const contractorAddress = useContractorAddressForm({\n contractorId,\n optionalFieldsToRequire: SDK_REQUIRED_ADDRESS_FIELDS,\n defaultValues,\n })\n\n if (contractorAddress.isLoading) {\n return <BaseLayout isLoading error={contractorAddress.errorHandling.errors} />\n }\n\n const { Fields } = contractorAddress.form\n const isBusiness = contractorAddress.data.contractorType === 'Business'\n\n const handleSubmit = async () => {\n const result = await contractorAddress.actions.onSubmit()\n if (result) {\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_UPDATED, result.data)\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_DONE)\n }\n }\n\n return (\n <section className={classNames(styles.container, className)}>\n <BaseLayout error={contractorAddress.errorHandling.errors}>\n <SDKFormProvider formHookResult={contractorAddress}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\" gap={32} alignItems=\"stretch\">\n <header>\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Heading as=\"h2\">\n {isBusiness ? t('businessAddressTitle') : t('homeAddressTitle')}\n </Components.Heading>\n <Components.Text variant=\"supporting\">\n {isBusiness ? t('businessAddressDescription') : t('homeAddressDescription')}\n </Components.Text>\n </Flex>\n </header>\n\n <Grid gridTemplateColumns={{ base: '1fr', small: ['1fr', '1fr'] }} gap={20}>\n <Fields.Street1\n label={t('street1')}\n validationMessages={{ REQUIRED: t('validations.street1') }}\n />\n <Fields.Street2 label={t('street2')} />\n <Fields.City\n label={t('city')}\n validationMessages={{ REQUIRED: t('validations.city') }}\n />\n <Fields.State\n label={t('state')}\n placeholder={t('statePlaceholder')}\n validationMessages={{ REQUIRED: t('validations.state') }}\n getOptionLabel={(abbr: string) =>\n tCommon(`statesHash.${abbr}`, { defaultValue: abbr })\n }\n />\n <Fields.Zip\n label={t('zip')}\n validationMessages={{\n REQUIRED: t('validations.zip'),\n INVALID_ZIP: t('validations.zipInvalid'),\n }}\n />\n </Grid>\n\n <ActionsLayout>\n <Components.Button type=\"submit\" isDisabled={contractorAddress.status.isPending}>\n {contractorAddress.status.isPending ? t('submitting') : t('submit')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["SDK_REQUIRED_ADDRESS_FIELDS","Address","onEvent","FallbackComponent","rootProps","jsx","BaseBoundaries","AddressRoot","contractorId","defaultValues","dictionary","className","useComponentDictionary","useI18n","useTranslation","tCommon","Components","useComponentContext","contractorAddress","useContractorAddressForm","BaseLayout","Fields","isBusiness","handleSubmit","result","contractorEvents","classNames","styles","SDKFormProvider","Form","jsxs","Flex","Grid","abbr","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;AAqBA,MAAMA,IAAwE;AAAA,EAC5E,QAAQ,CAAC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,QAAP;AAAA,UACC,OAAO,EAAE,KAAK;AAAA,UACd,oBAAoB;AAAA,YAClB,UAAU,EAAE,iBAAiB;AAAA,YAC7B,aAAa,EAAE,wBAAwB;AAAA,UAAA;AAAA,QACzC;AAAA,MAAA;AAAA,IACF,GACF;AAAA,IAEA,gBAAAhB,EAAC6B,KACC,UAAA,gBAAA7B,EAACW,EAAW,QAAX,EAAkB,MAAK,UAAS,YAAYE,EAAkB,OAAO,WACnE,UAAAA,EAAkB,OAAO,YAAY,EAAE,YAAY,IAAI,EAAE,QAAQ,EAAA,CACpE,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF,GACF,EAAA,CACF,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"Address.js","sources":["../../../../src/components/Contractor/Address/Address.tsx"],"sourcesContent":["import type { JSX } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport type { FallbackProps } from 'react-error-boundary'\nimport styles from './Address.module.scss'\nimport { useContractorAddressForm } from './shared/useContractorAddressForm'\nimport type { ContractorAddressOptionalFieldsToRequire } from './shared/useContractorAddressForm'\nimport type { AddressDefaultValues } from './types'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { Form } from '@/components/Common/Form'\nimport { Flex, Grid, ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport type { ResourceDictionary } from '@/types/Helpers'\nimport { contractorEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { useContractorHasSignedW9 } from '@/components/Contractor/shared/useContractorHasSignedW9'\n\n// The hook defaults to the API contract, which treats every address field as\n// optional. The SDK's address form has always required a complete mailing\n// address, so it opts those fields back into being required here.\nconst SDK_REQUIRED_ADDRESS_FIELDS: ContractorAddressOptionalFieldsToRequire = {\n update: ['street1', 'city', 'state', 'zip'],\n}\n\n/**\n * Props for {@link Address}.\n *\n * @public\n */\nexport interface AddressProps {\n /** The associated contractor identifier. */\n contractorId: string\n /** Pre-fill values for address fields. Server data takes precedence when the contractor already has an address on file. */\n defaultValues?: AddressDefaultValues\n /** Callback invoked each time the component emits an event. */\n onEvent: OnEventType<EventType, unknown>\n /** Overrides for the component's i18n strings. */\n dictionary?: ResourceDictionary<'Contractor.Address'>\n /** Optional class applied to the wrapping `<section>`. */\n className?: string\n /** Custom React component rendered when an unhandled error is caught by the component-level error boundary. */\n FallbackComponent?: (props: FallbackProps) => JSX.Element\n}\n\n/**\n * Form for collecting and updating a contractor's mailing address. Renders a business or home address title based on the contractor type.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/address/updated` | Fired after the address is saved | The updated `ContractorAddress` entity |\n * | `contractor/address/done` | Fired after a successful save so the parent flow can advance | — |\n *\n * @param props - See {@link AddressProps}.\n * @returns The contractor address form.\n * @public\n *\n * @example\n * ```tsx\n * import { ContractorOnboarding } from '@gusto/embedded-react-sdk'\n *\n * function MyComponent() {\n * return (\n * <ContractorOnboarding.Address\n * contractorId=\"contractor-uuid\"\n * onEvent={() => {}}\n * />\n * )\n * }\n * ```\n */\nexport function Address({ onEvent, FallbackComponent, ...rootProps }: AddressProps) {\n return (\n <BaseBoundaries componentName=\"Contractor.Address\" FallbackComponent={FallbackComponent}>\n <AddressRoot onEvent={onEvent} {...rootProps} />\n </BaseBoundaries>\n )\n}\n\nfunction ContractorAddressW9Warning({ contractorId }: { contractorId: string }) {\n const hasSignedW9 = useContractorHasSignedW9(contractorId)\n const { t } = useTranslation('Contractor.Address')\n const Components = useComponentContext()\n if (!hasSignedW9) return null\n return (\n <Components.Alert status=\"warning\" disableScrollIntoView label={t('w9EditWarning.label')}>\n <Components.Text>{t('w9EditWarning.body')}</Components.Text>\n </Components.Alert>\n )\n}\n\nfunction AddressRoot({\n contractorId,\n defaultValues,\n onEvent,\n dictionary,\n className,\n}: Omit<AddressProps, 'FallbackComponent'>) {\n useComponentDictionary('Contractor.Address', dictionary)\n useI18n('Contractor.Address')\n const { t } = useTranslation('Contractor.Address')\n const { t: tCommon } = useTranslation('common')\n const Components = useComponentContext()\n\n const contractorAddress = useContractorAddressForm({\n contractorId,\n optionalFieldsToRequire: SDK_REQUIRED_ADDRESS_FIELDS,\n defaultValues,\n })\n\n if (contractorAddress.isLoading) {\n return <BaseLayout isLoading error={contractorAddress.errorHandling.errors} />\n }\n\n const { Fields } = contractorAddress.form\n const isBusiness = contractorAddress.data.contractorType === 'Business'\n\n const handleSubmit = async () => {\n const result = await contractorAddress.actions.onSubmit()\n if (result) {\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_UPDATED, result.data)\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_DONE)\n }\n }\n\n return (\n <section className={classNames(styles.container, className)}>\n <BaseLayout error={contractorAddress.errorHandling.errors}>\n <SDKFormProvider formHookResult={contractorAddress}>\n <Form onSubmit={() => void handleSubmit()}>\n <ContractorAddressW9Warning contractorId={contractorId} />\n\n <Flex flexDirection=\"column\" gap={32} alignItems=\"stretch\">\n <header>\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Heading as=\"h2\">\n {isBusiness ? t('businessAddressTitle') : t('homeAddressTitle')}\n </Components.Heading>\n <Components.Text variant=\"supporting\">\n {isBusiness ? t('businessAddressDescription') : t('homeAddressDescription')}\n </Components.Text>\n </Flex>\n </header>\n\n <Grid gridTemplateColumns={{ base: '1fr', small: ['1fr', '1fr'] }} gap={20}>\n <Fields.Street1\n label={t('street1')}\n validationMessages={{ REQUIRED: t('validations.street1') }}\n />\n <Fields.Street2 label={t('street2')} />\n <Fields.City\n label={t('city')}\n validationMessages={{ REQUIRED: t('validations.city') }}\n />\n <Fields.State\n label={t('state')}\n placeholder={t('statePlaceholder')}\n validationMessages={{ REQUIRED: t('validations.state') }}\n getOptionLabel={(abbr: string) =>\n tCommon(`statesHash.${abbr}`, { defaultValue: abbr })\n }\n />\n <Fields.Zip\n label={t('zip')}\n validationMessages={{\n REQUIRED: t('validations.zip'),\n INVALID_ZIP: t('validations.zipInvalid'),\n }}\n />\n </Grid>\n\n <ActionsLayout>\n <Components.Button type=\"submit\" isDisabled={contractorAddress.status.isPending}>\n {contractorAddress.status.isPending ? t('submitting') : t('submit')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["SDK_REQUIRED_ADDRESS_FIELDS","Address","onEvent","FallbackComponent","rootProps","jsx","BaseBoundaries","AddressRoot","ContractorAddressW9Warning","contractorId","hasSignedW9","useContractorHasSignedW9","t","useTranslation","Components","useComponentContext","defaultValues","dictionary","className","useComponentDictionary","useI18n","tCommon","contractorAddress","useContractorAddressForm","BaseLayout","Fields","isBusiness","handleSubmit","result","contractorEvents","classNames","styles","SDKFormProvider","jsxs","Form","Flex","Grid","abbr","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,MAAMA,IAAwE;AAAA,EAC5E,QAAQ,CAAC,WAAW,QAAQ,SAAS,KAAK;AAC5C;AAiDO,SAASC,EAAQ,EAAE,SAAAC,GAAS,mBAAAC,GAAmB,GAAGC,KAA2B;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,eAAc,sBAAqB,mBAAAH,GACjD,4BAACI,GAAA,EAAY,SAAAL,GAAmB,GAAGE,EAAA,CAAW,EAAA,CAChD;AAEJ;AAEA,SAASI,EAA2B,EAAE,cAAAC,KAA0C;AAC9E,QAAMC,IAAcC,EAAyBF,CAAY,GACnD,EAAE,GAAAG,EAAA,IAAMC,EAAe,oBAAoB,GAC3CC,IAAaC,EAAA;AACnB,SAAKL,sBAEFI,EAAW,OAAX,EAAiB,QAAO,WAAU,uBAAqB,IAAC,OAAOF,EAAE,qBAAqB,GACrF,4BAACE,EAAW,MAAX,EAAiB,UAAAF,EAAE,oBAAoB,GAAE,GAC5C,IAJuB;AAM3B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A;AAAA,MACF,GACF;AAAA,MAEA,gBAAAP,EAACiC,KACC,UAAA,gBAAAjC,EAACS,EAAW,QAAX,EAAkB,MAAK,UAAS,YAAYQ,EAAkB,OAAO,WACnE,UAAAA,EAAkB,OAAO,YAAYV,EAAE,YAAY,IAAIA,EAAE,QAAQ,EAAA,CACpE,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -11,7 +11,7 @@ export interface ContractorListProps extends BaseComponentInterface<'Contractor.
11
11
  successMessage?: string;
12
12
  }
13
13
  /**
14
- * Lists a company's contractors with controls to add, edit, delete, and continue onboarding.
14
+ * Lists a company's contractors with controls to add, edit, delete, cancel self-onboarding, and continue onboarding.
15
15
  *
16
16
  * @events
17
17
  * | Event | Description | Data |
@@ -19,6 +19,7 @@ export interface ContractorListProps extends BaseComponentInterface<'Contractor.
19
19
  * | `contractor/create` | The add-contractor action was triggered. | — |
20
20
  * | `contractor/update` | A contractor row's edit action was triggered. | `{ contractorId: string }` |
21
21
  * | `contractor/deleted` | A contractor was successfully deleted. | `{ contractorId: string }` |
22
+ * | `contractor/selfOnboarding/cancelled` | A contractor's self-onboarding was cancelled, reverting them to admin onboarding. | The updated `contractorOnboardingStatus` returned by the API. |
22
23
  * | `contractor/onboarding/continue` | The continue action was triggered to advance onboarding. | — |
23
24
  *
24
25
  * @param props - See {@link ContractorListProps}.
@@ -1,128 +1,141 @@
1
- import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
- import { useTranslation as d } from "react-i18next";
3
- import { useContractorsDeleteMutation as H } from "@gusto/embedded-api/react-query/contractorsDelete";
4
- import { useContractors as k } from "./useContractorList.js";
5
- import { Flex as h } from "../../Common/Flex/Flex.js";
6
- import { EmptyData as U } from "../../Common/EmptyData/EmptyData.js";
7
- import { ActionsLayout as g } from "../../Common/ActionsLayout/ActionsLayout.js";
8
- import { HamburgerMenu as j } from "../../Common/HamburgerMenu/HamburgerMenu.js";
9
- import { firstLastName as V } from "../../../helpers/formattedStrings.js";
10
- import F from "../../../assets/icons/pencil.svg.js";
11
- import { useComponentContext as u } from "../../../contexts/ComponentAdapter/useComponentContext.js";
12
- import { ContractorOnboardingStatusBadge as M } from "../../Common/OnboardingStatusBadge/index.js";
13
- import { useI18n as G, useComponentDictionary as q } from "../../../i18n/I18n.js";
14
- import { BaseComponent as W } from "../../Base/Base.js";
15
- import { useBase as Y } from "../../Base/useBase.js";
16
- import { CONTRACTOR_TYPE as z, componentEvents as l, ContractorOnboardingStatus as J } from "../../../shared/constants.js";
17
- import K from "../../../assets/icons/trashcan.svg.js";
18
- import { useDataView as Q } from "../../Common/DataView/useDataView.js";
19
- import { DataView as X } from "../../Common/DataView/DataView.js";
20
- function Z({ count: o, handleAdd: i }) {
21
- const { Button: r, Heading: s } = u(), { t: n } = d("Contractor.ContractorList");
22
- return /* @__PURE__ */ m(h, { alignItems: "center", justifyContent: "space-between", children: [
23
- /* @__PURE__ */ t(s, { as: "h2", children: n("title") }),
24
- o !== 0 && /* @__PURE__ */ t(r, { variant: "secondary", onClick: i, children: n("addAnotherCta") })
1
+ import { jsx as n, jsxs as C } from "react/jsx-runtime";
2
+ import { useTranslation as p } from "react-i18next";
3
+ import { useContractorsDeleteMutation as V } from "@gusto/embedded-api/react-query/contractorsDelete";
4
+ import { useContractorsUpdateOnboardingStatusMutation as j } from "@gusto/embedded-api/react-query/contractorsUpdateOnboardingStatus";
5
+ import { useContractors as q } from "./useContractorList.js";
6
+ import { Flex as b } from "../../Common/Flex/Flex.js";
7
+ import { EmptyData as W } from "../../Common/EmptyData/EmptyData.js";
8
+ import { ActionsLayout as S } from "../../Common/ActionsLayout/ActionsLayout.js";
9
+ import { HamburgerMenu as X } from "../../Common/HamburgerMenu/HamburgerMenu.js";
10
+ import { firstLastName as Y } from "../../../helpers/formattedStrings.js";
11
+ import z from "../../../assets/icons/pencil.svg.js";
12
+ import { useComponentContext as f } from "../../../contexts/ComponentAdapter/useComponentContext.js";
13
+ import { ContractorOnboardingStatusBadge as J } from "../../Common/OnboardingStatusBadge/index.js";
14
+ import { useI18n as K, useComponentDictionary as Q } from "../../../i18n/I18n.js";
15
+ import { BaseComponent as Z } from "../../Base/Base.js";
16
+ import { useBase as $ } from "../../Base/useBase.js";
17
+ import { CONTRACTOR_TYPE as tt, componentEvents as c, ContractorOnboardingStatus as u } from "../../../shared/constants.js";
18
+ import nt from "../../../assets/icons/trashcan.svg.js";
19
+ import et from "../../../assets/icons/x-circle.svg.js";
20
+ import { useDataView as ot } from "../../Common/DataView/useDataView.js";
21
+ import { DataView as at } from "../../Common/DataView/DataView.js";
22
+ function rt({ count: o, handleAdd: i }) {
23
+ const { Button: r, Heading: d } = f(), { t: e } = p("Contractor.ContractorList");
24
+ return /* @__PURE__ */ C(b, { alignItems: "center", justifyContent: "space-between", children: [
25
+ /* @__PURE__ */ n(d, { as: "h2", children: e("title") }),
26
+ o !== 0 && /* @__PURE__ */ n(r, { variant: "secondary", onClick: i, children: e("addAnotherCta") })
25
27
  ] });
26
28
  }
27
- function $({ handleAdd: o }) {
28
- const { Button: i } = u(), { t: r } = d("Contractor.ContractorList");
29
- return /* @__PURE__ */ t(U, { title: r("emptyTableTitle"), description: r("emptyTableDescription"), children: /* @__PURE__ */ t(g, { justifyContent: "center", children: /* @__PURE__ */ t(i, { onClick: o, children: r("addContractorCta") }) }) });
29
+ function it({ handleAdd: o }) {
30
+ const { Button: i } = f(), { t: r } = p("Contractor.ContractorList");
31
+ return /* @__PURE__ */ n(W, { title: r("emptyTableTitle"), description: r("emptyTableDescription"), children: /* @__PURE__ */ n(S, { justifyContent: "center", children: /* @__PURE__ */ n(i, { onClick: o, children: r("addContractorCta") }) }) });
30
32
  }
31
- function Lt(o) {
32
- return /* @__PURE__ */ t(W, { ...o, children: /* @__PURE__ */ t(tt, { ...o, children: o.children }) });
33
+ function It(o) {
34
+ return /* @__PURE__ */ n(Z, { ...o, children: /* @__PURE__ */ n(st, { ...o, children: o.children }) });
33
35
  }
34
- function tt({ companyId: o, className: i, dictionary: r, successMessage: s }) {
35
- G("Contractor.ContractorList"), q("Contractor.ContractorList", r);
36
- const { t: n } = d("Contractor.ContractorList"), { onEvent: c, baseSubmitHandler: T } = Y(), { Alert: b, Button: L } = u(), {
37
- contractors: O,
38
- totalCount: C,
39
- handleNextPage: E,
40
- handleFirstPage: N,
41
- handleLastPage: P,
42
- handlePreviousPage: R,
43
- handleItemsPerPageChange: A,
44
- currentPage: D,
36
+ function st({ companyId: o, className: i, dictionary: r, successMessage: d }) {
37
+ K("Contractor.ContractorList"), Q("Contractor.ContractorList", r);
38
+ const { t: e } = p("Contractor.ContractorList"), { onEvent: s, baseSubmitHandler: g } = $(), { Alert: E, Button: T } = f(), {
39
+ contractors: A,
40
+ totalCount: O,
41
+ handleNextPage: R,
42
+ handleFirstPage: D,
43
+ handleLastPage: L,
44
+ handlePreviousPage: P,
45
+ handleItemsPerPageChange: I,
46
+ currentPage: _,
45
47
  totalPages: y,
46
- itemsPerPage: S
47
- } = k({ companyUuid: o }), { mutateAsync: I, isPending: _ } = H(), v = Q({
48
+ itemsPerPage: B
49
+ } = q({ companyUuid: o }), { mutateAsync: v, isPending: w } = V(), { mutateAsync: U, isPending: x } = j(), M = ot({
48
50
  columns: [
49
51
  {
50
- title: n("listHeaders.name"),
51
- render: (e) => e.type === z.BUSINESS ? e.businessName : V({ first_name: e.firstName, last_name: e.lastName })
52
+ title: e("listHeaders.name"),
53
+ render: (t) => t.type === tt.BUSINESS ? t.businessName : Y({ first_name: t.firstName, last_name: t.lastName })
52
54
  },
53
55
  {
54
- title: n("listHeaders.status"),
55
- render: ({ onboarded: e, onboardingStatus: a }) => /* @__PURE__ */ t(
56
- M,
56
+ title: e("listHeaders.status"),
57
+ render: ({ onboarded: t, onboardingStatus: a }) => /* @__PURE__ */ n(
58
+ J,
57
59
  {
58
- onboarded: e,
60
+ onboarded: t,
59
61
  onboardingStatus: a
60
62
  }
61
63
  )
62
64
  }
63
65
  ],
64
- data: O,
65
- itemMenu: (e) => {
66
- const a = e.onboardingStatus === J.SELF_ONBOARDING_REVIEW, p = n(a ? "reviewCta" : "editCta");
67
- return /* @__PURE__ */ t(
68
- j,
69
- {
70
- items: [
71
- {
72
- label: p,
73
- icon: /* @__PURE__ */ t(F, { "aria-hidden": !0 }),
74
- onClick: () => {
75
- w(e.uuid);
76
- }
77
- },
78
- {
79
- label: n("deleteCta"),
80
- icon: /* @__PURE__ */ t(K, { "aria-hidden": !0 }),
81
- onClick: () => {
82
- x(e.uuid);
83
- }
84
- }
85
- ],
86
- triggerLabel: p,
87
- isLoading: _
66
+ data: A,
67
+ itemMenu: (t) => {
68
+ const a = t.onboardingStatus === u.SELF_ONBOARDING_REVIEW, m = e(a ? "reviewCta" : "editCta"), N = t.onboardingStatus === u.SELF_ONBOARDING_INVITED || t.onboardingStatus === u.SELF_ONBOARDING_STARTED, l = [];
69
+ return N || l.push({
70
+ label: m,
71
+ icon: /* @__PURE__ */ n(z, { "aria-hidden": !0 }),
72
+ onClick: () => {
73
+ k(t.uuid);
88
74
  }
89
- );
75
+ }), N && l.push({
76
+ label: e("cancelSelfOnboardingCta"),
77
+ icon: /* @__PURE__ */ n(et, { "aria-hidden": !0 }),
78
+ onClick: () => {
79
+ H(t.uuid);
80
+ }
81
+ }), l.push({
82
+ label: e("deleteCta"),
83
+ icon: /* @__PURE__ */ n(nt, { "aria-hidden": !0 }),
84
+ onClick: () => {
85
+ G(t.uuid);
86
+ }
87
+ }), /* @__PURE__ */ n(X, { items: l, isLoading: w || x });
90
88
  },
91
- emptyState: () => /* @__PURE__ */ t($, { handleAdd: f }),
89
+ emptyState: () => /* @__PURE__ */ n(it, { handleAdd: h }),
92
90
  pagination: {
93
- handleNextPage: E,
94
- handleFirstPage: N,
95
- handleLastPage: P,
96
- handlePreviousPage: R,
97
- handleItemsPerPageChange: A,
98
- currentPage: D,
91
+ handleNextPage: R,
92
+ handleFirstPage: D,
93
+ handleLastPage: L,
94
+ handlePreviousPage: P,
95
+ handleItemsPerPageChange: I,
96
+ currentPage: _,
99
97
  totalPages: y,
100
- totalCount: C,
101
- itemsPerPage: S
98
+ totalCount: O,
99
+ itemsPerPage: B
102
100
  }
103
- }), f = () => {
104
- c(l.CONTRACTOR_CREATE);
105
- }, w = (e) => {
106
- c(l.CONTRACTOR_UPDATE, { contractorId: e });
107
- }, B = () => {
108
- c(l.CONTRACTOR_ONBOARDING_CONTINUE);
109
- }, x = async (e) => {
110
- await T(e, async (a) => {
111
- await I({
101
+ }), h = () => {
102
+ s(c.CONTRACTOR_CREATE);
103
+ }, k = (t) => {
104
+ s(c.CONTRACTOR_UPDATE, { contractorId: t });
105
+ }, F = () => {
106
+ s(c.CONTRACTOR_ONBOARDING_CONTINUE);
107
+ }, G = async (t) => {
108
+ await g(t, async (a) => {
109
+ await v({
112
110
  request: { contractorUuid: a }
113
- }), c(l.CONTRACTOR_DELETED, { contractorId: a });
111
+ }), s(c.CONTRACTOR_DELETED, { contractorId: a });
112
+ });
113
+ }, H = async (t) => {
114
+ await g(t, async (a) => {
115
+ const m = await U({
116
+ request: {
117
+ contractorUuid: a,
118
+ contractorOnboardingStatusUpdateRequestBody: {
119
+ onboardingStatus: u.ADMIN_ONBOARDING_INCOMPLETE
120
+ }
121
+ }
122
+ });
123
+ s(
124
+ c.CONTRACTOR_SELF_ONBOARDING_CANCELLED,
125
+ m.contractorOnboardingStatus
126
+ );
114
127
  });
115
128
  };
116
- return /* @__PURE__ */ m("section", { className: i, children: [
117
- s && /* @__PURE__ */ t(b, { label: s, status: "success" }),
118
- /* @__PURE__ */ m(h, { flexDirection: "column", children: [
119
- /* @__PURE__ */ t(Z, { count: C, handleAdd: f }),
120
- /* @__PURE__ */ t(X, { label: n("contractorListLabel"), ...v }),
121
- /* @__PURE__ */ t(g, { children: /* @__PURE__ */ t(L, { onClick: B, isLoading: !1, children: n("continueCta") }) })
129
+ return /* @__PURE__ */ C("section", { className: i, children: [
130
+ d && /* @__PURE__ */ n(E, { label: d, status: "success" }),
131
+ /* @__PURE__ */ C(b, { flexDirection: "column", children: [
132
+ /* @__PURE__ */ n(rt, { count: O, handleAdd: h }),
133
+ /* @__PURE__ */ n(at, { label: e("contractorListLabel"), ...M }),
134
+ /* @__PURE__ */ n(S, { children: /* @__PURE__ */ n(T, { onClick: F, isLoading: !1, children: e("continueCta") }) })
122
135
  ] })
123
136
  ] });
124
137
  }
125
138
  export {
126
- Lt as ContractorList
139
+ It as ContractorList
127
140
  };
128
141
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Contractor/ContractorList/index.tsx"],"sourcesContent":["import { type Contractor } from '@gusto/embedded-api/models/components/contractor'\nimport { useTranslation } from 'react-i18next'\nimport { useContractorsDeleteMutation } from '@gusto/embedded-api/react-query/contractorsDelete'\nimport { useContractors } from './useContractorList'\nimport { ActionsLayout, DataView, EmptyData, Flex, useDataView } from '@/components/Common'\nimport { firstLastName } from '@/helpers/formattedStrings'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { ContractorOnboardingStatusBadge } from '@/components/Common/OnboardingStatusBadge'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { componentEvents, CONTRACTOR_TYPE, ContractorOnboardingStatus } from '@/shared/constants'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\n\ninterface HeadProps {\n count: number\n handleAdd: () => void\n}\nfunction Head({ count, handleAdd }: HeadProps) {\n const { Button, Heading } = useComponentContext()\n const { t } = useTranslation('Contractor.ContractorList')\n\n return (\n <Flex alignItems=\"center\" justifyContent=\"space-between\">\n <Heading as=\"h2\">{t('title')}</Heading>\n\n {count !== 0 && (\n <Button variant=\"secondary\" onClick={handleAdd}>\n {t('addAnotherCta')}\n </Button>\n )}\n </Flex>\n )\n}\n\ninterface EmptyDataContractorsListProps {\n handleAdd: () => void\n}\nfunction EmptyDataContractorsList({ handleAdd }: EmptyDataContractorsListProps) {\n const { Button } = useComponentContext()\n const { t } = useTranslation('Contractor.ContractorList')\n\n return (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Button onClick={handleAdd}>{t('addContractorCta')}</Button>\n </ActionsLayout>\n </EmptyData>\n )\n}\n\n/**\n * Props for {@link ContractorList}.\n *\n * @public\n */\nexport interface ContractorListProps extends BaseComponentInterface<'Contractor.ContractorList'> {\n /** UUID of the company whose contractors should be listed. */\n companyId: string\n /** Success message to display in an alert above the list, typically after a create, update, or delete action. */\n successMessage?: string\n}\n\n/**\n * Lists a company's contractors with controls to add, edit, delete, and continue onboarding.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/create` | The add-contractor action was triggered. | — |\n * | `contractor/update` | A contractor row's edit action was triggered. | `{ contractorId: string }` |\n * | `contractor/deleted` | A contractor was successfully deleted. | `{ contractorId: string }` |\n * | `contractor/onboarding/continue` | The continue action was triggered to advance onboarding. | — |\n *\n * @param props - See {@link ContractorListProps}.\n * @returns The rendered contractor list.\n * @public\n */\nexport function ContractorList(props: ContractorListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, className, dictionary, successMessage }: ContractorListProps) {\n useI18n('Contractor.ContractorList')\n useComponentDictionary('Contractor.ContractorList', dictionary)\n const { t } = useTranslation('Contractor.ContractorList')\n const { onEvent, baseSubmitHandler } = useBase()\n const { Alert, Button } = useComponentContext()\n const {\n contractors,\n totalCount,\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n itemsPerPage,\n } = useContractors({ companyUuid: companyId })\n const { mutateAsync: deleteContractorMutation, isPending: isPendingDelete } =\n useContractorsDeleteMutation()\n\n const dataViewProps = useDataView<Contractor>({\n columns: [\n {\n title: t('listHeaders.name'),\n render: contractor =>\n contractor.type === CONTRACTOR_TYPE.BUSINESS\n ? contractor.businessName\n : firstLastName({ first_name: contractor.firstName, last_name: contractor.lastName }),\n },\n {\n title: t('listHeaders.status'),\n render: ({ onboarded, onboardingStatus }) => (\n <ContractorOnboardingStatusBadge\n onboarded={onboarded}\n onboardingStatus={onboardingStatus}\n />\n ),\n },\n ],\n data: contractors,\n itemMenu: contractor => {\n const isAwaitingSelfOnboardingReview =\n contractor.onboardingStatus === ContractorOnboardingStatus.SELF_ONBOARDING_REVIEW\n const editLabel = isAwaitingSelfOnboardingReview ? t('reviewCta') : t('editCta')\n\n return (\n <HamburgerMenu\n items={[\n {\n label: editLabel,\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n handleEdit(contractor.uuid)\n },\n },\n {\n label: t('deleteCta'),\n icon: <TrashCanSvg aria-hidden />,\n onClick: () => {\n void handleDelete(contractor.uuid)\n },\n },\n ]}\n triggerLabel={editLabel}\n isLoading={isPendingDelete}\n />\n )\n },\n emptyState: () => <EmptyDataContractorsList handleAdd={handleAdd} />,\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n totalCount,\n itemsPerPage,\n },\n })\n\n const handleAdd = () => {\n onEvent(componentEvents.CONTRACTOR_CREATE)\n }\n\n const handleEdit = (uuid: string) => {\n onEvent(componentEvents.CONTRACTOR_UPDATE, { contractorId: uuid })\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.CONTRACTOR_ONBOARDING_CONTINUE)\n }\n\n const handleDelete = async (uuid: string) => {\n await baseSubmitHandler(uuid, async payload => {\n await deleteContractorMutation({\n request: { contractorUuid: payload },\n })\n\n onEvent(componentEvents.CONTRACTOR_DELETED, { contractorId: payload })\n })\n }\n\n return (\n <section className={className}>\n {successMessage && <Alert label={successMessage} status=\"success\" />}\n <Flex flexDirection=\"column\">\n <Head count={totalCount} handleAdd={handleAdd} />\n <DataView label={t('contractorListLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Button onClick={handleContinue} isLoading={false}>\n {t('continueCta')}\n </Button>\n </ActionsLayout>\n </Flex>\n </section>\n )\n}\n"],"names":["Head","count","handleAdd","Button","Heading","useComponentContext","t","useTranslation","jsxs","Flex","jsx","EmptyDataContractorsList","EmptyData","ActionsLayout","ContractorList","props","BaseComponent","Root","companyId","className","dictionary","successMessage","useI18n","useComponentDictionary","onEvent","baseSubmitHandler","useBase","Alert","contractors","totalCount","handleNextPage","handleFirstPage","handleLastPage","handlePreviousPage","handleItemsPerPageChange","currentPage","totalPages","itemsPerPage","useContractors","deleteContractorMutation","isPendingDelete","useContractorsDeleteMutation","dataViewProps","useDataView","contractor","CONTRACTOR_TYPE","firstLastName","onboarded","onboardingStatus","ContractorOnboardingStatusBadge","isAwaitingSelfOnboardingReview","ContractorOnboardingStatus","editLabel","HamburgerMenu","PencilSvg","handleEdit","TrashCanSvg","handleDelete","componentEvents","uuid","handleContinue","payload","DataView"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAASA,EAAK,EAAE,OAAAC,GAAO,WAAAC,KAAwB;AAC7C,QAAM,EAAE,QAAAC,GAAQ,SAAAC,EAAA,IAAYC,EAAA,GACtB,EAAE,GAAAC,EAAA,IAAMC,EAAe,2BAA2B;AAExD,SACE,gBAAAC,EAACC,GAAA,EAAK,YAAW,UAAS,gBAAe,iBACvC,UAAA;AAAA,IAAA,gBAAAC,EAACN,GAAA,EAAQ,IAAG,MAAM,UAAAE,EAAE,OAAO,GAAE;AAAA,IAE5BL,MAAU,KACT,gBAAAS,EAACP,GAAA,EAAO,SAAQ,aAAY,SAASD,GAClC,UAAAI,EAAE,eAAe,EAAA,CACpB;AAAA,EAAA,GAEJ;AAEJ;AAKA,SAASK,EAAyB,EAAE,WAAAT,KAA4C;AAC9E,QAAM,EAAE,QAA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MAAM;AACtB,IAAAsB,EAAQkC,EAAgB,iBAAiB;AAAA,EAC3C,GAEMH,IAAa,CAACI,MAAiB;AACnC,IAAAnC,EAAQkC,EAAgB,mBAAmB,EAAE,cAAcC,GAAM;AAAA,EACnE,GAEMC,IAAiB,MAAM;AAC3B,IAAApC,EAAQkC,EAAgB,8BAA8B;AAAA,EACxD,GAEMD,IAAe,OAAOE,MAAiB;AAC3C,UAAMlC,EAAkBkC,GAAM,OAAME,MAAW;AAC7C,YAAMtB,EAAyB;AAAA,QAC7B,SAAS,EAAE,gBAAgBsB,EAAA;AAAA,MAAQ,CACpC,GAEDrC,EAAQkC,EAAgB,oBAAoB,EAAE,cAAcG,GAAS;AAAA,IACvE,CAAC;AAAA,EACH;AAEA,SACE,gBAAArD,EAAC,aAAQ,WAAAW,GACN,UAAA;AAAA,IAAAE,KAAkB,gBAAAX,EAACiB,GAAA,EAAM,OAAON,GAAgB,QAAO,WAAU;AAAA,IAClE,gBAAAb,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,MAAA,gBAAAC,EAACV,GAAA,EAAK,OAAO6B,GAAY,WAAA3B,EAAA,CAAsB;AAAA,wBAC9C4D,GAAA,EAAS,OAAOxD,EAAE,qBAAqB,GAAI,GAAGoC,GAAe;AAAA,MAC9D,gBAAAhC,EAACG,GAAA,EACC,UAAA,gBAAAH,EAACP,GAAA,EAAO,SAASyD,GAAgB,WAAW,IACzC,UAAAtD,EAAE,aAAa,EAAA,CAClB,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Contractor/ContractorList/index.tsx"],"sourcesContent":["import { type Contractor } from '@gusto/embedded-api/models/components/contractor'\nimport { useTranslation } from 'react-i18next'\nimport { useContractorsDeleteMutation } from '@gusto/embedded-api/react-query/contractorsDelete'\nimport { useContractorsUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/contractorsUpdateOnboardingStatus'\nimport { useContractors } from './useContractorList'\nimport { ActionsLayout, DataView, EmptyData, Flex, useDataView } from '@/components/Common'\nimport { firstLastName } from '@/helpers/formattedStrings'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu/HamburgerMenu'\nimport type { MenuItem } from '@/components/Common/UI/Menu/MenuTypes'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { ContractorOnboardingStatusBadge } from '@/components/Common/OnboardingStatusBadge'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { componentEvents, CONTRACTOR_TYPE, ContractorOnboardingStatus } from '@/shared/constants'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport XCircleSvg from '@/assets/icons/x-circle.svg?react'\n\ninterface HeadProps {\n count: number\n handleAdd: () => void\n}\nfunction Head({ count, handleAdd }: HeadProps) {\n const { Button, Heading } = useComponentContext()\n const { t } = useTranslation('Contractor.ContractorList')\n\n return (\n <Flex alignItems=\"center\" justifyContent=\"space-between\">\n <Heading as=\"h2\">{t('title')}</Heading>\n\n {count !== 0 && (\n <Button variant=\"secondary\" onClick={handleAdd}>\n {t('addAnotherCta')}\n </Button>\n )}\n </Flex>\n )\n}\n\ninterface EmptyDataContractorsListProps {\n handleAdd: () => void\n}\nfunction EmptyDataContractorsList({ handleAdd }: EmptyDataContractorsListProps) {\n const { Button } = useComponentContext()\n const { t } = useTranslation('Contractor.ContractorList')\n\n return (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Button onClick={handleAdd}>{t('addContractorCta')}</Button>\n </ActionsLayout>\n </EmptyData>\n )\n}\n\n/**\n * Props for {@link ContractorList}.\n *\n * @public\n */\nexport interface ContractorListProps extends BaseComponentInterface<'Contractor.ContractorList'> {\n /** UUID of the company whose contractors should be listed. */\n companyId: string\n /** Success message to display in an alert above the list, typically after a create, update, or delete action. */\n successMessage?: string\n}\n\n/**\n * Lists a company's contractors with controls to add, edit, delete, cancel self-onboarding, and continue onboarding.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/create` | The add-contractor action was triggered. | — |\n * | `contractor/update` | A contractor row's edit action was triggered. | `{ contractorId: string }` |\n * | `contractor/deleted` | A contractor was successfully deleted. | `{ contractorId: string }` |\n * | `contractor/selfOnboarding/cancelled` | A contractor's self-onboarding was cancelled, reverting them to admin onboarding. | The updated `contractorOnboardingStatus` returned by the API. |\n * | `contractor/onboarding/continue` | The continue action was triggered to advance onboarding. | — |\n *\n * @param props - See {@link ContractorListProps}.\n * @returns The rendered contractor list.\n * @public\n */\nexport function ContractorList(props: ContractorListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, className, dictionary, successMessage }: ContractorListProps) {\n useI18n('Contractor.ContractorList')\n useComponentDictionary('Contractor.ContractorList', dictionary)\n const { t } = useTranslation('Contractor.ContractorList')\n const { onEvent, baseSubmitHandler } = useBase()\n const { Alert, Button } = useComponentContext()\n const {\n contractors,\n totalCount,\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n itemsPerPage,\n } = useContractors({ companyUuid: companyId })\n const { mutateAsync: deleteContractorMutation, isPending: isPendingDelete } =\n useContractorsDeleteMutation()\n const { mutateAsync: updateOnboardingStatusMutation, isPending: isPendingCancel } =\n useContractorsUpdateOnboardingStatusMutation()\n\n const dataViewProps = useDataView<Contractor>({\n columns: [\n {\n title: t('listHeaders.name'),\n render: contractor =>\n contractor.type === CONTRACTOR_TYPE.BUSINESS\n ? contractor.businessName\n : firstLastName({ first_name: contractor.firstName, last_name: contractor.lastName }),\n },\n {\n title: t('listHeaders.status'),\n render: ({ onboarded, onboardingStatus }) => (\n <ContractorOnboardingStatusBadge\n onboarded={onboarded}\n onboardingStatus={onboardingStatus}\n />\n ),\n },\n ],\n data: contractors,\n itemMenu: contractor => {\n const isAwaitingSelfOnboardingReview =\n contractor.onboardingStatus === ContractorOnboardingStatus.SELF_ONBOARDING_REVIEW\n const editLabel = isAwaitingSelfOnboardingReview ? t('reviewCta') : t('editCta')\n const canCancelSelfOnboarding =\n contractor.onboardingStatus === ContractorOnboardingStatus.SELF_ONBOARDING_INVITED ||\n contractor.onboardingStatus === ContractorOnboardingStatus.SELF_ONBOARDING_STARTED\n\n // While the contractor is mid self-onboarding, editing is blocked: the\n // admin must first cancel self-onboarding. So the Edit item is omitted\n // whenever cancelling is available.\n const menuItems: MenuItem[] = []\n\n if (!canCancelSelfOnboarding) {\n menuItems.push({\n label: editLabel,\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n handleEdit(contractor.uuid)\n },\n })\n }\n\n if (canCancelSelfOnboarding) {\n menuItems.push({\n label: t('cancelSelfOnboardingCta'),\n icon: <XCircleSvg aria-hidden />,\n onClick: () => {\n void handleCancelSelfOnboarding(contractor.uuid)\n },\n })\n }\n\n menuItems.push({\n label: t('deleteCta'),\n icon: <TrashCanSvg aria-hidden />,\n onClick: () => {\n void handleDelete(contractor.uuid)\n },\n })\n\n return <HamburgerMenu items={menuItems} isLoading={isPendingDelete || isPendingCancel} />\n },\n emptyState: () => <EmptyDataContractorsList handleAdd={handleAdd} />,\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n totalCount,\n itemsPerPage,\n },\n })\n\n const handleAdd = () => {\n onEvent(componentEvents.CONTRACTOR_CREATE)\n }\n\n const handleEdit = (uuid: string) => {\n onEvent(componentEvents.CONTRACTOR_UPDATE, { contractorId: uuid })\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.CONTRACTOR_ONBOARDING_CONTINUE)\n }\n\n const handleDelete = async (uuid: string) => {\n await baseSubmitHandler(uuid, async payload => {\n await deleteContractorMutation({\n request: { contractorUuid: payload },\n })\n\n onEvent(componentEvents.CONTRACTOR_DELETED, { contractorId: payload })\n })\n }\n\n const handleCancelSelfOnboarding = async (uuid: string) => {\n await baseSubmitHandler(uuid, async payload => {\n const response = await updateOnboardingStatusMutation({\n request: {\n contractorUuid: payload,\n contractorOnboardingStatusUpdateRequestBody: {\n onboardingStatus: ContractorOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n },\n },\n })\n\n onEvent(\n componentEvents.CONTRACTOR_SELF_ONBOARDING_CANCELLED,\n response.contractorOnboardingStatus,\n )\n })\n }\n\n return (\n <section className={className}>\n {successMessage && <Alert label={successMessage} status=\"success\" />}\n <Flex flexDirection=\"column\">\n <Head count={totalCount} handleAdd={handleAdd} />\n <DataView label={t('contractorListLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Button onClick={handleContinue} isLoading={false}>\n {t('continueCta')}\n </Button>\n </ActionsLayout>\n </Flex>\n </section>\n )\n}\n"],"names":["Head","count","handleAdd","Button","Heading","useComponentContext","t","useTranslation","jsxs","Flex","jsx","EmptyDataContractorsList","EmptyData","ActionsLayout","ContractorList","props","BaseComponent","Root","companyId","className","dictionary","successMessage","useI18n","useComponentDictionary","onEvent","baseSubmitHandler","useBase","Alert","contractors","totalCount","handleNextPage","handleFirstPage","handleLastPage","handlePreviousPage","handleItemsPerPageChange","currentPage","totalPages","itemsPerPage","useContractors","deleteContractorMutation","isPendingDelete","useContractorsDeleteMutation","updateOnboardingStatusMutation","isPendingCancel","useContractorsUpdateOnboardingStatusMutation","dataViewProps","useDataView","contractor","CONTRACTOR_TYPE","firstLastName","onboarded","onboardingStatus","ContractorOnboardingStatusBadge","isAwaitingSelfOnboardingReview","ContractorOnboardingStatus","editLabel","canCancelSelfOnboarding","menuItems","PencilSvg","handleEdit","XCircleSvg","handleCancelSelfOnboarding","TrashCanSvg","handleDelete","HamburgerMenu","componentEvents","uuid","handleContinue","payload","response","DataView"],"mappings":";;;;;;;;;;;;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