@gusto/embedded-react-sdk 0.52.0 → 0.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/components/Base/Base.d.ts +2 -0
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +4 -1
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.d.ts +1 -1
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js.map +1 -1
- package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.d.ts +1 -1
- package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +2 -2
- package/dist/components/Common/UI/DateRangePicker/DateRangePickerTypes.d.ts +3 -2
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.d.ts +1 -1
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js.map +1 -1
- package/dist/components/Common/UI/Menu/MenuTypes.d.ts +3 -3
- package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +2 -2
- package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.d.ts +2 -2
- package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.js.map +1 -1
- package/dist/components/Common/UI/Select/SelectTypes.d.ts +2 -2
- package/dist/components/Common/UI/Table/TableTypes.d.ts +4 -4
- package/dist/components/Common/UI/Table/TableTypes.js.map +1 -1
- package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +2 -2
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +8 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.d.ts +2 -1
- package/dist/components/Contractor/ContractorList/index.js +121 -99
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.d.ts +1 -1
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.d.ts +2 -0
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +150 -80
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.test.d.ts +1 -0
- package/dist/components/Contractor/Profile/BusinessSelfOnboardingProfile.js +19 -18
- package/dist/components/Contractor/Profile/BusinessSelfOnboardingProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfile.d.ts +1 -1
- package/dist/components/Contractor/Profile/ContractorProfile.js +114 -110
- package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/IndividualSelfOnboardingProfile.js +27 -26
- package/dist/components/Contractor/Profile/IndividualSelfOnboardingProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +106 -63
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.d.ts +2 -2
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +10 -8
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProvider.d.ts +1 -0
- package/dist/contexts/GustoProvider/GustoProvider.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +1 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ThemeProvider/types.d.ts +2 -2
- package/dist/i18n/en/Contractor.ContractorList.json.js +22 -20
- package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -1
- package/dist/i18n/en/Contractor.Submit.json.js +11 -11
- package/dist/i18n/types.d.ts +7 -3
- package/dist/models/WA_RISK_CODES.d.ts +1 -0
- package/dist/models/WA_RISK_CODES.js.map +1 -1
- package/dist/partner-hook-utils/composeErrorHandler.d.ts +4 -0
- package/dist/partner-hook-utils/composeErrorHandler.js.map +1 -1
- package/dist/partner-hook-utils/form/SDKFormProvider.d.ts +1 -0
- package/dist/partner-hook-utils/form/SDKFormProvider.js.map +1 -1
- package/dist/partner-hook-utils/form/composeSubmitHandler.d.ts +4 -0
- package/dist/partner-hook-utils/form/composeSubmitHandler.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SelectHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/SelectHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SwitchHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/TextInputHookField.d.ts +1 -0
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js.map +1 -1
- package/dist/partner-hook-utils/types.d.ts +9 -0
- package/dist/shared/constants.d.ts +10 -0
- package/dist/shared/constants.js +7 -6
- package/dist/shared/constants.js.map +1 -1
- package/dist/types/Helpers.d.ts +2 -0
- package/dist/types/hooks.d.ts +1 -0
- package/dist/types/observability.d.ts +1 -0
- package/docs/guides/endpoint-inventory.json +17 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFederalTaxes.js","sources":["../../../../src/components/Company/FederalTaxes/useFederalTaxes.ts"],"sourcesContent":["import { z } from 'zod'\nimport type { FederalTaxDetails } from '@gusto/embedded-api/models/components/federaltaxdetails'\nimport { FilingForm, TaxPayerType } from '@gusto/embedded-api/models/components/federaltaxdetails'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\n/** @internal */\nexport const FederalTaxFormSchema = z.object({\n federalEin: z.string().optional(),\n taxPayerType: z.enum(Object.values(TaxPayerType) as [string, ...string[]]).optional(),\n filingForm: z.enum(Object.values(FilingForm) as [string, ...string[]]).optional(),\n legalName: z.string().min(1),\n})\n\n/** @internal */\nexport type FederalTaxFormInputs = z.input<typeof FederalTaxFormSchema>\n\n/**\n * Pre-populated values for the company federal tax form, supplied via {@link FederalTaxesProps}.\n * At least one of `taxPayerType`, `filingForm`, or `legalName` must be provided.\n *\n * @public\n */\nexport type FederalTaxesDefaultValues = RequireAtLeastOne<{\n taxPayerType?: FederalTaxFormInputs['taxPayerType']\n filingForm?: FederalTaxFormInputs['filingForm']\n legalName?: FederalTaxFormInputs['legalName']\n}>\n\ntype FederalTaxesContextType = {\n isPending: boolean\n federalTaxDetails?: FederalTaxDetails\n}\n\nconst [useFederalTaxes, FederalTaxesProvider] = createCompoundContext<FederalTaxesContextType>(\n 'CompanyFederalTaxesContext',\n)\n\nexport { useFederalTaxes, FederalTaxesProvider }\n"],"names":["FederalTaxFormSchema","z","TaxPayerType","FilingForm","useFederalTaxes","FederalTaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFederalTaxes.js","sources":["../../../../src/components/Company/FederalTaxes/useFederalTaxes.ts"],"sourcesContent":["import { z } from 'zod'\nimport type { FederalTaxDetails } from '@gusto/embedded-api/models/components/federaltaxdetails'\nimport { FilingForm, TaxPayerType } from '@gusto/embedded-api/models/components/federaltaxdetails'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\n/** @internal */\nexport const FederalTaxFormSchema = z.object({\n federalEin: z.string().optional(),\n taxPayerType: z.enum(Object.values(TaxPayerType) as [string, ...string[]]).optional(),\n filingForm: z.enum(Object.values(FilingForm) as [string, ...string[]]).optional(),\n legalName: z.string().min(1),\n})\n\n/** @internal */\nexport type FederalTaxFormInputs = z.input<typeof FederalTaxFormSchema>\n\n/**\n * Pre-populated values for the company federal tax form, supplied via {@link FederalTaxesProps}.\n * At least one of `taxPayerType`, `filingForm`, or `legalName` must be provided.\n *\n * @public\n */\nexport type FederalTaxesDefaultValues = RequireAtLeastOne<{\n taxPayerType?: FederalTaxFormInputs['taxPayerType']\n filingForm?: FederalTaxFormInputs['filingForm']\n legalName?: FederalTaxFormInputs['legalName']\n}>\n\ntype FederalTaxesContextType = {\n isPending: boolean\n federalTaxDetails?: FederalTaxDetails\n}\n\nconst [useFederalTaxes, FederalTaxesProvider] = createCompoundContext<FederalTaxesContextType>(\n 'CompanyFederalTaxesContext',\n)\n\nexport { useFederalTaxes, FederalTaxesProvider }\n"],"names":["FederalTaxFormSchema","z","TaxPayerType","FilingForm","useFederalTaxes","FederalTaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;;;AAOO,MAAMA,IAAuBC,EAAE,OAAO;AAAA,EAC3C,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,cAAcA,EAAE,KAAK,OAAO,OAAOC,CAAY,CAA0B,EAAE,SAAA;AAAA,EAC3E,YAAYD,EAAE,KAAK,OAAO,OAAOE,CAAU,CAA0B,EAAE,SAAA;AAAA,EACvE,WAAWF,EAAE,OAAA,EAAS,IAAI,CAAC;AAC7B,CAAC,GAsBK,CAACG,GAAiBC,CAAoB,IAAIC;AAAA,EAC9C;AACF;"}
|
|
@@ -9,19 +9,21 @@ 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 [
|
|
18
|
+
const [v, x] = t("IndustryItems", {
|
|
17
19
|
items: []
|
|
18
|
-
}), [
|
|
20
|
+
}), [C, S] = t("IndustryApi", {
|
|
19
21
|
isPending: !1
|
|
20
22
|
});
|
|
21
23
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
S as IndustryApiStateProvider,
|
|
25
|
+
x as IndustryItemsProvider,
|
|
26
|
+
C as useIndustryApiState,
|
|
27
|
+
v as useIndustryItems
|
|
26
28
|
};
|
|
27
29
|
//# sourceMappingURL=Context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sources":["../../../../src/components/Company/Industry/Context.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\nimport type { ComboBoxOption } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\n\nconst [useIndustryItems, IndustryItemsProvider] = createCompoundContext('IndustryItems', {\n items: [] as ComboBoxOption[],\n})\n\nconst [useIndustryApiState, IndustryApiStateProvider] = createCompoundContext('IndustryApi', {\n isPending: false,\n})\n\nexport { IndustryApiStateProvider, IndustryItemsProvider, useIndustryItems, useIndustryApiState }\n"],"names":["useIndustryItems","IndustryItemsProvider","createCompoundContext","useIndustryApiState","IndustryApiStateProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Context.js","sources":["../../../../src/components/Company/Industry/Context.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\nimport type { ComboBoxOption } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\n\nconst [useIndustryItems, IndustryItemsProvider] = createCompoundContext('IndustryItems', {\n items: [] as ComboBoxOption[],\n})\n\nconst [useIndustryApiState, IndustryApiStateProvider] = createCompoundContext('IndustryApi', {\n isPending: false,\n})\n\nexport { IndustryApiStateProvider, IndustryItemsProvider, useIndustryItems, useIndustryApiState }\n"],"names":["useIndustryItems","IndustryItemsProvider","createCompoundContext","useIndustryApiState","IndustryApiStateProvider"],"mappings":";;;;;;;;;;;;;;;;;AAGA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC,EAAsB,iBAAiB;AAAA,EACvF,OAAO,CAAA;AACT,CAAC,GAEK,CAACC,GAAqBC,CAAwB,IAAIF,EAAsB,eAAe;AAAA,EAC3F,WAAW;AACb,CAAC;"}
|
|
@@ -9,15 +9,17 @@ 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 o } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
18
|
+
const [v, y] = o(
|
|
17
19
|
"CompanyDocumentFormContext"
|
|
18
20
|
);
|
|
19
21
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
y as LocationsFormProvider,
|
|
23
|
+
v as useLocationsForm
|
|
22
24
|
};
|
|
23
25
|
//# sourceMappingURL=useLocationForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocationForm.js","sources":["../../../../../src/components/Company/Locations/LocationForm/useLocationForm.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\n\ntype LocationsFormContextType = {\n isPending: boolean\n handleCancel: () => void\n}\n\nconst [useLocationsForm, LocationsFormProvider] = createCompoundContext<LocationsFormContextType>(\n 'CompanyDocumentFormContext',\n)\n\nexport { useLocationsForm, LocationsFormProvider }\n"],"names":["useLocationsForm","LocationsFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocationForm.js","sources":["../../../../../src/components/Company/Locations/LocationForm/useLocationForm.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\n\ntype LocationsFormContextType = {\n isPending: boolean\n handleCancel: () => void\n}\n\nconst [useLocationsForm, LocationsFormProvider] = createCompoundContext<LocationsFormContextType>(\n 'CompanyDocumentFormContext',\n)\n\nexport { useLocationsForm, LocationsFormProvider }\n"],"names":["useLocationsForm","LocationsFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;AAOA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC;AAAA,EAChD;AACF;"}
|
|
@@ -9,15 +9,17 @@ 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 o } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
18
|
+
const [y, D] = o(
|
|
17
19
|
"CompanyDocumentListContext"
|
|
18
20
|
);
|
|
19
21
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
D as LocationsListProvider,
|
|
23
|
+
y as useLocationsList
|
|
22
24
|
};
|
|
23
25
|
//# sourceMappingURL=useLocationsList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/useLocationsList.ts"],"sourcesContent":["import { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype LocationsListContextType = {\n locationList: Location[]\n totalPages: number\n totalCount: number\n currentPage: number\n itemsPerPage: PaginationItemsPerPage\n handleItemsPerPageChange: (n: PaginationItemsPerPage) => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleEditLocation: (uuid: string) => void\n handleAddLocation: () => void\n handleContinue: () => void\n}\n\nconst [useLocationsList, LocationsListProvider] = createCompoundContext<LocationsListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useLocationsList, LocationsListProvider }\n"],"names":["useLocationsList","LocationsListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/useLocationsList.ts"],"sourcesContent":["import { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype LocationsListContextType = {\n locationList: Location[]\n totalPages: number\n totalCount: number\n currentPage: number\n itemsPerPage: PaginationItemsPerPage\n handleItemsPerPageChange: (n: PaginationItemsPerPage) => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleEditLocation: (uuid: string) => void\n handleAddLocation: () => void\n handleContinue: () => void\n}\n\nconst [useLocationsList, LocationsListProvider] = createCompoundContext<LocationsListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useLocationsList, LocationsListProvider }\n"],"names":["useLocationsList","LocationsListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC;AAAA,EAChD;AACF;"}
|
|
@@ -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 o } from "../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
18
|
+
const [s, u] = o("OnboardingOverviewContext");
|
|
17
19
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
u as OnboardingOverviewProvider,
|
|
21
|
+
s as useOnboardingOverview
|
|
20
22
|
};
|
|
21
23
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../src/components/Company/OnboardingOverview/context.ts"],"sourcesContent":["import type { OnboardingStep } from '@gusto/embedded-api/models/components/companyonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\n\ntype OnboardingOverviewContextType = {\n onboardingCompleted?: boolean\n onboardingSteps?: OnboardingStep[]\n handleDone: () => void\n handleContinue: () => void\n}\n\nconst [useOnboardingOverview, OnboardingOverviewProvider] =\n createCompoundContext<OnboardingOverviewContextType>('OnboardingOverviewContext')\n\nexport { useOnboardingOverview, OnboardingOverviewProvider }\n"],"names":["useOnboardingOverview","OnboardingOverviewProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../src/components/Company/OnboardingOverview/context.ts"],"sourcesContent":["import type { OnboardingStep } from '@gusto/embedded-api/models/components/companyonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\n\ntype OnboardingOverviewContextType = {\n onboardingCompleted?: boolean\n onboardingSteps?: OnboardingStep[]\n handleDone: () => void\n handleContinue: () => void\n}\n\nconst [useOnboardingOverview, OnboardingOverviewProvider] =\n createCompoundContext<OnboardingOverviewContextType>('OnboardingOverviewContext')\n\nexport { useOnboardingOverview, OnboardingOverviewProvider }\n"],"names":["useOnboardingOverview","OnboardingOverviewProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAuBC,CAA0B,IACtDC,EAAqD,2BAA2B;"}
|
|
@@ -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 [
|
|
18
|
+
const [f, v] = t("StateTaxesFormContext");
|
|
17
19
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
v as StateTaxesFormProvider,
|
|
21
|
+
f as useStateTaxesForm
|
|
20
22
|
};
|
|
21
23
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/context.ts"],"sourcesContent":["import type { TaxRequirementsState } from '@gusto/embedded-api/models/components/taxrequirementsstate'\nimport { createCompoundContext } from '@/components/Base'\n\ninterface StateTaxFormContext {\n isPending: boolean\n state: string\n stateTaxRequirements: TaxRequirementsState\n handleCancel: () => void\n}\n\nconst [useStateTaxesForm, StateTaxesFormProvider] =\n createCompoundContext<StateTaxFormContext>('StateTaxesFormContext')\n\nexport { useStateTaxesForm, StateTaxesFormProvider }\n"],"names":["useStateTaxesForm","StateTaxesFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/context.ts"],"sourcesContent":["import type { TaxRequirementsState } from '@gusto/embedded-api/models/components/taxrequirementsstate'\nimport { createCompoundContext } from '@/components/Base'\n\ninterface StateTaxFormContext {\n isPending: boolean\n state: string\n stateTaxRequirements: TaxRequirementsState\n handleCancel: () => void\n}\n\nconst [useStateTaxesForm, StateTaxesFormProvider] =\n createCompoundContext<StateTaxFormContext>('StateTaxesFormContext')\n\nexport { useStateTaxesForm, StateTaxesFormProvider }\n"],"names":["useStateTaxesForm","StateTaxesFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAA2C,uBAAuB;"}
|
|
@@ -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 [
|
|
18
|
+
const [f, v] = t("StateTaxesListContext");
|
|
17
19
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
v as StateTaxesListProvider,
|
|
21
|
+
f as useStateTaxesList
|
|
20
22
|
};
|
|
21
23
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/context.ts"],"sourcesContent":["import type { TaxRequirementStatesList } from '@gusto/embedded-api/models/components/taxrequirementstateslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesListContextType = {\n isPending: boolean\n stateTaxRequirements: TaxRequirementStatesList[]\n handleContinue: () => void\n handleChange: (state: string) => void\n}\n\nconst [useStateTaxesList, StateTaxesListProvider] =\n createCompoundContext<StateTaxesListContextType>('StateTaxesListContext')\n\nexport { useStateTaxesList, StateTaxesListProvider }\n"],"names":["useStateTaxesList","StateTaxesListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/context.ts"],"sourcesContent":["import type { TaxRequirementStatesList } from '@gusto/embedded-api/models/components/taxrequirementstateslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesListContextType = {\n isPending: boolean\n stateTaxRequirements: TaxRequirementStatesList[]\n handleContinue: () => void\n handleChange: (state: string) => void\n}\n\nconst [useStateTaxesList, StateTaxesListProvider] =\n createCompoundContext<StateTaxesListContextType>('StateTaxesListContext')\n\nexport { useStateTaxesList, StateTaxesListProvider }\n"],"names":["useStateTaxesList","StateTaxesListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAAiD,uBAAuB;"}
|
|
@@ -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,150 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
import { useContractorsDeleteMutation as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { jsx as n, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as g } 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 N } from "../../Common/Flex/Flex.js";
|
|
7
|
+
import { EmptyData as W } from "../../Common/EmptyData/EmptyData.js";
|
|
8
|
+
import { ActionsLayout as b } 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 p } 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 } = p(), { t: e } = g("Contractor.ContractorList");
|
|
24
|
+
return /* @__PURE__ */ C(N, { 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
|
|
28
|
-
const { Button: i } =
|
|
29
|
-
return /* @__PURE__ */
|
|
29
|
+
function it({ handleAdd: o }) {
|
|
30
|
+
const { Button: i } = p(), { t: r } = g("Contractor.ContractorList");
|
|
31
|
+
return /* @__PURE__ */ n(W, { title: r("emptyTableTitle"), description: r("emptyTableDescription"), children: /* @__PURE__ */ n(b, { justifyContent: "center", children: /* @__PURE__ */ n(i, { onClick: o, children: r("addContractorCta") }) }) });
|
|
30
32
|
}
|
|
31
|
-
function
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
+
function It(o) {
|
|
34
|
+
return /* @__PURE__ */ n(Z, { ...o, children: /* @__PURE__ */ n(st, { ...o, children: o.children }) });
|
|
33
35
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
const { t:
|
|
37
|
-
contractors:
|
|
38
|
-
totalCount:
|
|
39
|
-
handleNextPage:
|
|
40
|
-
handleFirstPage:
|
|
41
|
-
handleLastPage:
|
|
42
|
-
handlePreviousPage:
|
|
43
|
-
handleItemsPerPageChange:
|
|
44
|
-
currentPage:
|
|
45
|
-
totalPages:
|
|
46
|
-
itemsPerPage:
|
|
47
|
-
} =
|
|
36
|
+
function st({ companyId: o, className: i, dictionary: r, successMessage: d }) {
|
|
37
|
+
K("Contractor.ContractorList"), Q("Contractor.ContractorList", r);
|
|
38
|
+
const { t: e } = g("Contractor.ContractorList"), { onEvent: s, baseSubmitHandler: f } = $(), { Alert: S, Button: E } = p(), {
|
|
39
|
+
contractors: T,
|
|
40
|
+
totalCount: O,
|
|
41
|
+
handleNextPage: A,
|
|
42
|
+
handleFirstPage: L,
|
|
43
|
+
handleLastPage: R,
|
|
44
|
+
handlePreviousPage: D,
|
|
45
|
+
handleItemsPerPageChange: P,
|
|
46
|
+
currentPage: I,
|
|
47
|
+
totalPages: _,
|
|
48
|
+
itemsPerPage: y
|
|
49
|
+
} = q({ companyUuid: o }), { mutateAsync: B, isPending: v } = V(), { mutateAsync: w, isPending: U } = j(), x = ot({
|
|
48
50
|
columns: [
|
|
49
51
|
{
|
|
50
|
-
title:
|
|
51
|
-
render: (
|
|
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:
|
|
55
|
-
render: ({ onboarded:
|
|
56
|
-
|
|
56
|
+
title: e("listHeaders.status"),
|
|
57
|
+
render: ({ onboarded: t, onboardingStatus: a }) => /* @__PURE__ */ n(
|
|
58
|
+
J,
|
|
57
59
|
{
|
|
58
|
-
onboarded:
|
|
60
|
+
onboarded: t,
|
|
59
61
|
onboardingStatus: a
|
|
60
62
|
}
|
|
61
63
|
)
|
|
62
64
|
}
|
|
63
65
|
],
|
|
64
|
-
data:
|
|
65
|
-
itemMenu: (
|
|
66
|
-
const a =
|
|
67
|
-
return /* @__PURE__ */ t(
|
|
68
|
-
j,
|
|
66
|
+
data: T,
|
|
67
|
+
itemMenu: (t) => {
|
|
68
|
+
const a = t.onboardingStatus === u.SELF_ONBOARDING_REVIEW, l = e(a ? "reviewCta" : "editCta"), H = t.onboardingStatus === u.SELF_ONBOARDING_INVITED || t.onboardingStatus === u.SELF_ONBOARDING_STARTED, m = [
|
|
69
69
|
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
label: l,
|
|
71
|
+
icon: /* @__PURE__ */ n(z, { "aria-hidden": !0 }),
|
|
72
|
+
onClick: () => {
|
|
73
|
+
M(t.uuid);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
return H && m.push({
|
|
78
|
+
label: e("cancelSelfOnboardingCta"),
|
|
79
|
+
icon: /* @__PURE__ */ n(et, { "aria-hidden": !0 }),
|
|
80
|
+
onClick: () => {
|
|
81
|
+
G(t.uuid);
|
|
82
|
+
}
|
|
83
|
+
}), m.push({
|
|
84
|
+
label: e("deleteCta"),
|
|
85
|
+
icon: /* @__PURE__ */ n(nt, { "aria-hidden": !0 }),
|
|
86
|
+
onClick: () => {
|
|
87
|
+
F(t.uuid);
|
|
88
|
+
}
|
|
89
|
+
}), /* @__PURE__ */ n(
|
|
90
|
+
X,
|
|
91
|
+
{
|
|
92
|
+
items: m,
|
|
93
|
+
triggerLabel: l,
|
|
94
|
+
isLoading: v || U
|
|
88
95
|
}
|
|
89
96
|
);
|
|
90
97
|
},
|
|
91
|
-
emptyState: () => /* @__PURE__ */
|
|
98
|
+
emptyState: () => /* @__PURE__ */ n(it, { handleAdd: h }),
|
|
92
99
|
pagination: {
|
|
93
|
-
handleNextPage:
|
|
94
|
-
handleFirstPage:
|
|
95
|
-
handleLastPage:
|
|
96
|
-
handlePreviousPage:
|
|
97
|
-
handleItemsPerPageChange:
|
|
98
|
-
currentPage:
|
|
99
|
-
totalPages:
|
|
100
|
-
totalCount:
|
|
101
|
-
itemsPerPage:
|
|
100
|
+
handleNextPage: A,
|
|
101
|
+
handleFirstPage: L,
|
|
102
|
+
handleLastPage: R,
|
|
103
|
+
handlePreviousPage: D,
|
|
104
|
+
handleItemsPerPageChange: P,
|
|
105
|
+
currentPage: I,
|
|
106
|
+
totalPages: _,
|
|
107
|
+
totalCount: O,
|
|
108
|
+
itemsPerPage: y
|
|
102
109
|
}
|
|
103
|
-
}),
|
|
104
|
-
c
|
|
105
|
-
},
|
|
106
|
-
c
|
|
107
|
-
},
|
|
108
|
-
c
|
|
109
|
-
},
|
|
110
|
-
await
|
|
111
|
-
await
|
|
110
|
+
}), h = () => {
|
|
111
|
+
s(c.CONTRACTOR_CREATE);
|
|
112
|
+
}, M = (t) => {
|
|
113
|
+
s(c.CONTRACTOR_UPDATE, { contractorId: t });
|
|
114
|
+
}, k = () => {
|
|
115
|
+
s(c.CONTRACTOR_ONBOARDING_CONTINUE);
|
|
116
|
+
}, F = async (t) => {
|
|
117
|
+
await f(t, async (a) => {
|
|
118
|
+
await B({
|
|
112
119
|
request: { contractorUuid: a }
|
|
113
|
-
}), c
|
|
120
|
+
}), s(c.CONTRACTOR_DELETED, { contractorId: a });
|
|
121
|
+
});
|
|
122
|
+
}, G = async (t) => {
|
|
123
|
+
await f(t, async (a) => {
|
|
124
|
+
const l = await w({
|
|
125
|
+
request: {
|
|
126
|
+
contractorUuid: a,
|
|
127
|
+
contractorOnboardingStatusUpdateRequestBody: {
|
|
128
|
+
onboardingStatus: u.ADMIN_ONBOARDING_INCOMPLETE
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
s(
|
|
133
|
+
c.CONTRACTOR_SELF_ONBOARDING_CANCELLED,
|
|
134
|
+
l.contractorOnboardingStatus
|
|
135
|
+
);
|
|
114
136
|
});
|
|
115
137
|
};
|
|
116
|
-
return /* @__PURE__ */
|
|
117
|
-
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
/* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ C("section", { className: i, children: [
|
|
139
|
+
d && /* @__PURE__ */ n(S, { label: d, status: "success" }),
|
|
140
|
+
/* @__PURE__ */ C(N, { flexDirection: "column", children: [
|
|
141
|
+
/* @__PURE__ */ n(rt, { count: O, handleAdd: h }),
|
|
142
|
+
/* @__PURE__ */ n(at, { label: e("contractorListLabel"), ...x }),
|
|
143
|
+
/* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(E, { onClick: k, isLoading: !1, children: e("continueCta") }) })
|
|
122
144
|
] })
|
|
123
145
|
] });
|
|
124
146
|
}
|
|
125
147
|
export {
|
|
126
|
-
|
|
148
|
+
It as ContractorList
|
|
127
149
|
};
|
|
128
150
|
//# 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,QAAAC,EAAA,IAAWE,EAAA,GACb,EAAE,GAAAC,EAAA,IAAMC,EAAe,2BAA2B;AAExD,SACE,gBAAAG,EAACE,KAAU,OAAON,EAAE,iBAAiB,GAAG,aAAaA,EAAE,uBAAuB,GAC5E,UAAA,gBAAAI,EAACG,KAAc,gBAAe,UAC5B,4BAACV,GAAA,EAAO,SAASD,GAAY,UAAAI,EAAE,kBAAkB,EAAA,CAAE,EAAA,CACrD,EAAA,CACF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,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 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 const menuItems = [\n {\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 (\n <HamburgerMenu\n items={menuItems}\n triggerLabel={editLabel}\n isLoading={isPendingDelete || isPendingCancel}\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 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":";;;;;;;;;;;;;;;;;;;;;AAqBA,SAASA,GAAK,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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A;AAAA,IAEb,CAAC;AAAA,EACH;AAEA,SACE,gBAAA7D,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,IAAA,EAAK,OAAO6B,GAAY,WAAA3B,EAAA,CAAsB;AAAA,wBAC9CoE,IAAA,EAAS,OAAOhE,EAAE,qBAAqB,GAAI,GAAGuC,GAAe;AAAA,MAC9D,gBAAAnC,EAACG,GAAA,EACC,UAAA,gBAAAH,EAACP,GAAA,EAAO,SAASgE,GAAgB,WAAW,IACzC,UAAA7D,EAAE,aAAa,EAAA,CAClB,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -27,7 +27,7 @@ import { OnboardingFlowProps } from './OnboardingFlowComponents';
|
|
|
27
27
|
* | `contractor/onboarding/continue` | Fired when the user chooses to continue onboarding a contractor | — |
|
|
28
28
|
* | `contractor/created` | Fired when a new contractor is created successfully | Create contractor API response |
|
|
29
29
|
* | `contractor/updated` | Fired when an existing contractor is updated | Update contractor API response |
|
|
30
|
-
* | `contractor/profile/done` | Fired when the contractor profile step is complete | `{ contractorId: string, selfOnboarding: boolean }` |
|
|
30
|
+
* | `contractor/profile/done` | Fired when the contractor profile step is complete | `{ contractorId: string, onboardingStatus?: string, selfOnboarding: boolean }` |
|
|
31
31
|
* | `contractor/address/updated` | Fired when the contractor address is updated | Create or update contractor address API response |
|
|
32
32
|
* | `contractor/address/done` | Fired when the address step is complete | — |
|
|
33
33
|
* | `contractor/bankAccount/created` | Fired when a bank account is created for the contractor | Create contractor bank account API response |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingFlow.js","sources":["../../../../src/components/Contractor/OnboardingFlow/OnboardingFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { onboardingMachine } from './onboardingStateMachine'\nimport type { OnboardingFlowProps } from './OnboardingFlowComponents'\nimport {\n ContractorListContextual,\n type OnboardingFlowContextInterface,\n} from './OnboardingFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\n\n/**\n * Guided flow for admins to onboard a contractor to the company.\n *\n * @remarks\n * Renders a multi-step experience that collects every piece of information\n * required to add a contractor to a company. Begins on the contractor list\n * and transitions into the per-step screens when \"Add contractor\" or a row's\n * \"Edit\"/\"Continue\" action is invoked; the submit step returns to the list.\n * The flow is driven by an internal state machine and wraps each step in\n * error and suspense boundaries.\n *\n * Each step of the flow is also exported as a standalone block (see the\n * Blocks table) for composing a custom workflow when this orchestration\n * is the wrong fit.\n *\n * The flow forwards every event emitted by its blocks to `onEvent`;\n * see the events table on each block for the full set of events and\n * payloads observable from this flow.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/create` | Fired when the user chooses to add a new contractor | — |\n * | `contractor/update` | Fired when the user selects a contractor to edit | `{ contractorId: string }` |\n * | `contractor/deleted` | Fired when a contractor is deleted | `{ contractorId: string }` |\n * | `contractor/onboarding/continue` | Fired when the user chooses to continue onboarding a contractor | — |\n * | `contractor/created` | Fired when a new contractor is created successfully | Create contractor API response |\n * | `contractor/updated` | Fired when an existing contractor is updated | Update contractor API response |\n * | `contractor/profile/done` | Fired when the contractor profile step is complete | `{ contractorId: string, selfOnboarding: boolean }` |\n * | `contractor/address/updated` | Fired when the contractor address is updated | Create or update contractor address API response |\n * | `contractor/address/done` | Fired when the address step is complete | — |\n * | `contractor/bankAccount/created` | Fired when a bank account is created for the contractor | Create contractor bank account API response |\n * | `contractor/paymentMethod/updated` | Fired when the payment method is updated | Update contractor payment method API response |\n * | `contractor/paymentMethod/done` | Fired when the payment method step is complete | — |\n * | `contractor/newHireReport/updated` | Fired when the new hire report is updated | Update contractor API response |\n * | `contractor/newHireReport/done` | Fired when the new hire report step is complete | — |\n * | `contractor/onboardingStatus/updated` | Fired when the contractor's onboarding status is updated | Change contractor onboarding status API response |\n * | `contractor/submit/done` | Fired when the contractor submission is complete | `{ message: string }` or `{ onboardingStatus, message: string }` |\n * | `contractor/invite/selfOnboarding` | Fired when the contractor is invited for self-onboarding | `{ contractorId: string }` |\n *\n * @components\n * - {@link ContractorList}\n * - {@link ContractorProfile}\n * - {@link Address}\n * - {@link PaymentMethod}\n * - {@link NewHireReport}\n * - {@link ContractorSubmit}\n *\n * @param props - See {@link OnboardingFlowProps}.\n * @returns The multi-step onboarding flow with internal navigation between the contractor list and the per-step screens.\n * @public\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { ContractorOnboarding, type EventType } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <ContractorOnboarding.OnboardingFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * onEvent={(eventType: EventType) => {\n * if (eventType === 'contractor/submit/done') {\n * // Contractor onboarding complete — navigate to your next screen\n * }\n * }}\n * />\n * )\n * }\n * ```\n */\nexport const OnboardingFlow = ({ companyId, onEvent, defaultValues }: OnboardingFlowProps) => {\n const onboardingFlow = useMemo(\n () =>\n createMachine(\n 'list',\n onboardingMachine,\n (initialContext: OnboardingFlowContextInterface) => ({\n ...initialContext,\n component: ContractorListContextual,\n companyId,\n defaultValues,\n selfOnboarding: false,\n }),\n ),\n [companyId, defaultValues],\n )\n return <Flow machine={onboardingFlow} onEvent={onEvent} />\n}\n"],"names":["OnboardingFlow","companyId","onEvent","defaultValues","onboardingFlow","useMemo","createMachine","onboardingMachine","initialContext","ContractorListContextual","jsx","Flow"],"mappings":";;;;;;AAgFO,MAAMA,IAAiB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,eAAAC,QAAyC;AAC5F,QAAMC,IAAiBC;AAAA,IACrB,MACEC;AAAA,MACE;AAAA,MACAC;AAAA,MACA,CAACC,OAAoD;AAAA,QACnD,GAAGA;AAAA,QACH,WAAWC;AAAA,QACX,WAAAR;AAAA,QACA,eAAAE;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAClB;AAAA,IAEJ,CAACF,GAAWE,CAAa;AAAA,EAAA;AAE3B,SAAO,gBAAAO,EAACC,GAAA,EAAK,SAASP,GAAgB,SAAAF,EAAA,CAAkB;AAC1D;"}
|
|
1
|
+
{"version":3,"file":"OnboardingFlow.js","sources":["../../../../src/components/Contractor/OnboardingFlow/OnboardingFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { onboardingMachine } from './onboardingStateMachine'\nimport type { OnboardingFlowProps } from './OnboardingFlowComponents'\nimport {\n ContractorListContextual,\n type OnboardingFlowContextInterface,\n} from './OnboardingFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\n\n/**\n * Guided flow for admins to onboard a contractor to the company.\n *\n * @remarks\n * Renders a multi-step experience that collects every piece of information\n * required to add a contractor to a company. Begins on the contractor list\n * and transitions into the per-step screens when \"Add contractor\" or a row's\n * \"Edit\"/\"Continue\" action is invoked; the submit step returns to the list.\n * The flow is driven by an internal state machine and wraps each step in\n * error and suspense boundaries.\n *\n * Each step of the flow is also exported as a standalone block (see the\n * Blocks table) for composing a custom workflow when this orchestration\n * is the wrong fit.\n *\n * The flow forwards every event emitted by its blocks to `onEvent`;\n * see the events table on each block for the full set of events and\n * payloads observable from this flow.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/create` | Fired when the user chooses to add a new contractor | — |\n * | `contractor/update` | Fired when the user selects a contractor to edit | `{ contractorId: string }` |\n * | `contractor/deleted` | Fired when a contractor is deleted | `{ contractorId: string }` |\n * | `contractor/onboarding/continue` | Fired when the user chooses to continue onboarding a contractor | — |\n * | `contractor/created` | Fired when a new contractor is created successfully | Create contractor API response |\n * | `contractor/updated` | Fired when an existing contractor is updated | Update contractor API response |\n * | `contractor/profile/done` | Fired when the contractor profile step is complete | `{ contractorId: string, onboardingStatus?: string, selfOnboarding: boolean }` |\n * | `contractor/address/updated` | Fired when the contractor address is updated | Create or update contractor address API response |\n * | `contractor/address/done` | Fired when the address step is complete | — |\n * | `contractor/bankAccount/created` | Fired when a bank account is created for the contractor | Create contractor bank account API response |\n * | `contractor/paymentMethod/updated` | Fired when the payment method is updated | Update contractor payment method API response |\n * | `contractor/paymentMethod/done` | Fired when the payment method step is complete | — |\n * | `contractor/newHireReport/updated` | Fired when the new hire report is updated | Update contractor API response |\n * | `contractor/newHireReport/done` | Fired when the new hire report step is complete | — |\n * | `contractor/onboardingStatus/updated` | Fired when the contractor's onboarding status is updated | Change contractor onboarding status API response |\n * | `contractor/submit/done` | Fired when the contractor submission is complete | `{ message: string }` or `{ onboardingStatus, message: string }` |\n * | `contractor/invite/selfOnboarding` | Fired when the contractor is invited for self-onboarding | `{ contractorId: string }` |\n *\n * @components\n * - {@link ContractorList}\n * - {@link ContractorProfile}\n * - {@link Address}\n * - {@link PaymentMethod}\n * - {@link NewHireReport}\n * - {@link ContractorSubmit}\n *\n * @param props - See {@link OnboardingFlowProps}.\n * @returns The multi-step onboarding flow with internal navigation between the contractor list and the per-step screens.\n * @public\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { ContractorOnboarding, type EventType } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <ContractorOnboarding.OnboardingFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * onEvent={(eventType: EventType) => {\n * if (eventType === 'contractor/submit/done') {\n * // Contractor onboarding complete — navigate to your next screen\n * }\n * }}\n * />\n * )\n * }\n * ```\n */\nexport const OnboardingFlow = ({ companyId, onEvent, defaultValues }: OnboardingFlowProps) => {\n const onboardingFlow = useMemo(\n () =>\n createMachine(\n 'list',\n onboardingMachine,\n (initialContext: OnboardingFlowContextInterface) => ({\n ...initialContext,\n component: ContractorListContextual,\n companyId,\n defaultValues,\n selfOnboarding: false,\n }),\n ),\n [companyId, defaultValues],\n )\n return <Flow machine={onboardingFlow} onEvent={onEvent} />\n}\n"],"names":["OnboardingFlow","companyId","onEvent","defaultValues","onboardingFlow","useMemo","createMachine","onboardingMachine","initialContext","ContractorListContextual","jsx","Flow"],"mappings":";;;;;;AAgFO,MAAMA,IAAiB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,eAAAC,QAAyC;AAC5F,QAAMC,IAAiBC;AAAA,IACrB,MACEC;AAAA,MACE;AAAA,MACAC;AAAA,MACA,CAACC,OAAoD;AAAA,QACnD,GAAGA;AAAA,QACH,WAAWC;AAAA,QACX,WAAAR;AAAA,QACA,eAAAE;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAClB;AAAA,IAEJ,CAACF,GAAWE,CAAa;AAAA,EAAA;AAE3B,SAAO,gBAAAO,EAACC,GAAA,EAAK,SAASP,GAAgB,SAAAF,EAAA,CAAkB;AAC1D;"}
|
|
@@ -34,6 +34,8 @@ export interface OnboardingFlowContextInterface extends FlowContextInterface {
|
|
|
34
34
|
defaultValues?: OnboardingFlowDefaultValues;
|
|
35
35
|
/** True when the contractor will be self-onboarding; switches the flow to the shorter self-onboarding path. */
|
|
36
36
|
selfOnboarding?: boolean;
|
|
37
|
+
/** True while the new hire report step should be shown; false once the contractor has advanced past the admin's initial onboarding pass. */
|
|
38
|
+
showNewHireReport?: boolean;
|
|
37
39
|
/** Success message to display on the contractor list when returning from a completed sub-flow. */
|
|
38
40
|
successMessage?: string;
|
|
39
41
|
}
|