@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.
- package/CHANGELOG.md +32 -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/DocumentSigner/shared/useSignCompanyForm/fields.js +4 -4
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +5 -5
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +0 -1
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +12 -14
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +83 -75
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.d.ts +2 -1
- package/dist/components/Contractor/ContractorList/index.js +112 -99
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js +170 -123
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.module.scss.js +12 -0
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.module.scss.js.map +1 -0
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/fields.js +44 -43
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/fields.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.js +91 -88
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.d.ts +0 -33
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.js +77 -86
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.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/PaymentMethod/shared/useContractorBankAccountForm/fields.js +1 -1
- 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 +121 -111
- 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/Profile/shared/useContractorDetailsForm/fields.js +16 -16
- package/dist/components/Contractor/Submit/Submit.js +127 -67
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Contractor/shared/useContractorHasSignedW9.d.ts +8 -0
- package/dist/components/Contractor/shared/useContractorHasSignedW9.js +10 -0
- package/dist/components/Contractor/shared/useContractorHasSignedW9.js.map +1 -0
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js +4 -4
- package/dist/components/Employee/Compensation/shared/useJobForm/fields.js +6 -6
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js +8 -8
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js +4 -4
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/fields.js +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/fields.js +4 -4
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js +4 -4
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/fields.js +8 -8
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/fields.js +5 -5
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.d.ts +1 -0
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js +4 -4
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.d.ts +1 -0
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js +8 -8
- 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/index.d.ts +40 -0
- 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.Address.json.js +22 -20
- package/dist/i18n/en/Contractor.Address.json.js.map +1 -1
- 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.Profile.json.js +13 -11
- package/dist/i18n/en/Contractor.Profile.json.js.map +1 -1
- package/dist/i18n/en/Contractor.SignatureForm.json.js +5 -5
- package/dist/i18n/en/Contractor.Submit.json.js +11 -11
- package/dist/i18n/types.d.ts +29 -9
- package/dist/index.d.ts +6 -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/style.css +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 -28
- package/package.json +16 -16
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useFormFieldsMetadataContext as r } from "../../../../../partner-hook-utils/form/FormFieldsMetadataContext.js";
|
|
3
|
-
import { usePlaceholderSSN as m, normalizeSSN as l } from "../../../../../helpers/ssn.js";
|
|
4
|
-
import { SwitchHookField as d } from "../../../../../partner-hook-utils/form/fields/SwitchHookField.js";
|
|
5
2
|
import { TextInputHookField as a } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
6
|
-
import { DatePickerHookField as
|
|
3
|
+
import { DatePickerHookField as r } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
4
|
+
import { SwitchHookField as m } from "../../../../../partner-hook-utils/form/fields/SwitchHookField.js";
|
|
5
|
+
import { useFormFieldsMetadataContext as l } from "../../../../../partner-hook-utils/form/FormFieldsMetadataContext.js";
|
|
6
|
+
import { usePlaceholderSSN as d, normalizeSSN as f } from "../../../../../helpers/ssn.js";
|
|
7
7
|
function h(e) {
|
|
8
8
|
return /* @__PURE__ */ t(a, { ...e, name: "firstName" });
|
|
9
9
|
}
|
|
@@ -17,22 +17,22 @@ function x(e) {
|
|
|
17
17
|
return /* @__PURE__ */ t(a, { ...e, name: "email" });
|
|
18
18
|
}
|
|
19
19
|
function H(e) {
|
|
20
|
-
return /* @__PURE__ */ t(
|
|
20
|
+
return /* @__PURE__ */ t(r, { ...e, name: "dateOfBirth" });
|
|
21
21
|
}
|
|
22
22
|
function O(e) {
|
|
23
|
-
const n =
|
|
23
|
+
const n = l(), i = e.formHookResult?.form.fieldsMetadata ?? n?.metadata ?? {}, o = d(i.ssn?.hasRedactedValue);
|
|
24
24
|
return /* @__PURE__ */ t(
|
|
25
25
|
a,
|
|
26
26
|
{
|
|
27
27
|
...e,
|
|
28
28
|
name: "ssn",
|
|
29
|
-
transform:
|
|
29
|
+
transform: f,
|
|
30
30
|
placeholder: o
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
function I(e) {
|
|
35
|
-
return /* @__PURE__ */ t(
|
|
35
|
+
return /* @__PURE__ */ t(m, { ...e, name: "selfOnboarding" });
|
|
36
36
|
}
|
|
37
37
|
export {
|
|
38
38
|
H as DateOfBirthField,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { DatePickerHookField as r } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
3
|
-
import { CheckboxHookField as n } from "../../../../../partner-hook-utils/form/fields/CheckboxHookField.js";
|
|
4
2
|
import { TextInputHookField as i } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
5
|
-
import { SelectHookField as
|
|
3
|
+
import { SelectHookField as r } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
4
|
+
import { CheckboxHookField as n } from "../../../../../partner-hook-utils/form/fields/CheckboxHookField.js";
|
|
5
|
+
import { DatePickerHookField as o } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
6
6
|
function d(e) {
|
|
7
7
|
return /* @__PURE__ */ t(i, { ...e, name: "street1" });
|
|
8
8
|
}
|
|
@@ -13,7 +13,7 @@ function F(e) {
|
|
|
13
13
|
return /* @__PURE__ */ t(i, { ...e, name: "city" });
|
|
14
14
|
}
|
|
15
15
|
function p(e) {
|
|
16
|
-
return /* @__PURE__ */ t(
|
|
16
|
+
return /* @__PURE__ */ t(r, { ...e, name: "state" });
|
|
17
17
|
}
|
|
18
18
|
function k(e) {
|
|
19
19
|
return /* @__PURE__ */ t(i, { ...e, name: "zip" });
|
|
@@ -22,7 +22,7 @@ function s(e) {
|
|
|
22
22
|
return /* @__PURE__ */ t(n, { ...e, name: "courtesyWithholding" });
|
|
23
23
|
}
|
|
24
24
|
function h(e) {
|
|
25
|
-
return /* @__PURE__ */ t(
|
|
25
|
+
return /* @__PURE__ */ t(o, { ...e, name: "effectiveDate" });
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
28
|
F as CityField,
|
package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { UseHomeAddressFormProps, UseHomeAddressFormResult } from './useHomeAddr
|
|
|
7
7
|
* the hook resolves the current home address itself.
|
|
8
8
|
*
|
|
9
9
|
* @public
|
|
10
|
+
* @interface
|
|
10
11
|
*/
|
|
11
12
|
export type UseCurrentHomeAddressFormProps = Omit<UseHomeAddressFormProps, 'homeAddressUuid'>;
|
|
12
13
|
/**
|
package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentHomeAddressForm.js","sources":["../../../../../../src/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.tsx"],"sourcesContent":["import { useEmployeeAddressesGet } from '@gusto/embedded-api/react-query/employeeAddressesGet'\nimport { useHomeAddressForm } from './useHomeAddressForm'\nimport type { UseHomeAddressFormProps, UseHomeAddressFormResult } from './useHomeAddressForm'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\n\n/**\n * Options for {@link useCurrentHomeAddressForm}.\n *\n * @remarks\n * Same shape as {@link UseHomeAddressFormProps} minus `homeAddressUuid` —\n * the hook resolves the current home address itself.\n *\n * @public\n */\nexport type UseCurrentHomeAddressFormProps = Omit<UseHomeAddressFormProps, 'homeAddressUuid'>\n\n/**\n * Convenience wrapper around {@link useHomeAddressForm} that auto-resolves the employee's current home address.\n *\n * @remarks\n * Lists the employee's home addresses and selects the active one (or the\n * first when none are active) as the row to edit. When the employee has no\n * home address on file the hook operates in create mode. The returned\n * shape is identical to {@link useHomeAddressForm}, so the same `Fields`,\n * `actions.onSubmit`, and `errorHandling` apply.\n *\n * @param props - See {@link UseCurrentHomeAddressFormProps}.\n * @returns A {@link HookLoadingResult} while loading, or a {@link UseHomeAddressFormReady} once ready.\n * @public\n *\n * @example\n * ```tsx\n * import { useCurrentHomeAddressForm } from '@gusto/embedded-react-sdk'\n *\n * function HomeAddressEditor({ employeeId }: { employeeId: string }) {\n * const homeAddress = useCurrentHomeAddressForm({ employeeId })\n *\n * if (homeAddress.isLoading) return <div>Loading...</div>\n *\n * const { Fields } = homeAddress.form\n * return (\n * <form onSubmit={e => { e.preventDefault(); void homeAddress.actions.onSubmit() }}>\n * <Fields.Street1 label=\"Street\" />\n * <Fields.City label=\"City\" />\n * <Fields.State label=\"State\" />\n * <Fields.Zip label=\"ZIP\" />\n * <button type=\"submit\">Save</button>\n * </form>\n * )\n * }\n * ```\n */\nexport function useCurrentHomeAddressForm(\n props: UseCurrentHomeAddressFormProps,\n): UseHomeAddressFormResult {\n const { employeeId, ...rest } = props\n\n const listQuery = useEmployeeAddressesGet({ employeeId }, { enabled: !!employeeId })\n\n const homeAddresses = listQuery.data?.employeeAddressList\n const currentHomeAddress = homeAddresses?.find(a => a.active) ?? homeAddresses?.[0]\n\n const base = useHomeAddressForm({\n ...rest,\n employeeId,\n homeAddressUuid: currentHomeAddress?.uuid,\n })\n\n const listInitiallyBlocking = listQuery.isLoading && !listQuery.data\n\n if (listInitiallyBlocking) {\n return {\n isLoading: true as const,\n errorHandling: composeErrorHandler([listQuery]),\n }\n }\n\n if (base.isLoading) {\n return {\n ...base,\n errorHandling: composeErrorHandler([listQuery, { errorHandling: base.errorHandling }]),\n }\n }\n\n return {\n ...base,\n errorHandling: composeErrorHandler([listQuery, { errorHandling: base.errorHandling }]),\n }\n}\n"],"names":["useCurrentHomeAddressForm","props","employeeId","rest","listQuery","useEmployeeAddressesGet","homeAddresses","currentHomeAddress","a","base","useHomeAddressForm","composeErrorHandler"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"useCurrentHomeAddressForm.js","sources":["../../../../../../src/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.tsx"],"sourcesContent":["import { useEmployeeAddressesGet } from '@gusto/embedded-api/react-query/employeeAddressesGet'\nimport { useHomeAddressForm } from './useHomeAddressForm'\nimport type { UseHomeAddressFormProps, UseHomeAddressFormResult } from './useHomeAddressForm'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\n\n/**\n * Options for {@link useCurrentHomeAddressForm}.\n *\n * @remarks\n * Same shape as {@link UseHomeAddressFormProps} minus `homeAddressUuid` —\n * the hook resolves the current home address itself.\n *\n * @public\n * @interface\n */\nexport type UseCurrentHomeAddressFormProps = Omit<UseHomeAddressFormProps, 'homeAddressUuid'>\n\n/**\n * Convenience wrapper around {@link useHomeAddressForm} that auto-resolves the employee's current home address.\n *\n * @remarks\n * Lists the employee's home addresses and selects the active one (or the\n * first when none are active) as the row to edit. When the employee has no\n * home address on file the hook operates in create mode. The returned\n * shape is identical to {@link useHomeAddressForm}, so the same `Fields`,\n * `actions.onSubmit`, and `errorHandling` apply.\n *\n * @param props - See {@link UseCurrentHomeAddressFormProps}.\n * @returns A {@link HookLoadingResult} while loading, or a {@link UseHomeAddressFormReady} once ready.\n * @public\n *\n * @example\n * ```tsx\n * import { useCurrentHomeAddressForm } from '@gusto/embedded-react-sdk'\n *\n * function HomeAddressEditor({ employeeId }: { employeeId: string }) {\n * const homeAddress = useCurrentHomeAddressForm({ employeeId })\n *\n * if (homeAddress.isLoading) return <div>Loading...</div>\n *\n * const { Fields } = homeAddress.form\n * return (\n * <form onSubmit={e => { e.preventDefault(); void homeAddress.actions.onSubmit() }}>\n * <Fields.Street1 label=\"Street\" />\n * <Fields.City label=\"City\" />\n * <Fields.State label=\"State\" />\n * <Fields.Zip label=\"ZIP\" />\n * <button type=\"submit\">Save</button>\n * </form>\n * )\n * }\n * ```\n */\nexport function useCurrentHomeAddressForm(\n props: UseCurrentHomeAddressFormProps,\n): UseHomeAddressFormResult {\n const { employeeId, ...rest } = props\n\n const listQuery = useEmployeeAddressesGet({ employeeId }, { enabled: !!employeeId })\n\n const homeAddresses = listQuery.data?.employeeAddressList\n const currentHomeAddress = homeAddresses?.find(a => a.active) ?? homeAddresses?.[0]\n\n const base = useHomeAddressForm({\n ...rest,\n employeeId,\n homeAddressUuid: currentHomeAddress?.uuid,\n })\n\n const listInitiallyBlocking = listQuery.isLoading && !listQuery.data\n\n if (listInitiallyBlocking) {\n return {\n isLoading: true as const,\n errorHandling: composeErrorHandler([listQuery]),\n }\n }\n\n if (base.isLoading) {\n return {\n ...base,\n errorHandling: composeErrorHandler([listQuery, { errorHandling: base.errorHandling }]),\n }\n }\n\n return {\n ...base,\n errorHandling: composeErrorHandler([listQuery, { errorHandling: base.errorHandling }]),\n }\n}\n"],"names":["useCurrentHomeAddressForm","props","employeeId","rest","listQuery","useEmployeeAddressesGet","homeAddresses","currentHomeAddress","a","base","useHomeAddressForm","composeErrorHandler"],"mappings":";;;AAqDO,SAASA,EACdC,GAC0B;AAC1B,QAAM,EAAE,YAAAC,GAAY,GAAGC,EAAA,IAASF,GAE1BG,IAAYC,EAAwB,EAAE,YAAAH,EAAA,GAAc,EAAE,SAAS,CAAC,CAACA,GAAY,GAE7EI,IAAgBF,EAAU,MAAM,qBAChCG,IAAqBD,GAAe,KAAK,CAAAE,MAAKA,EAAE,MAAM,KAAKF,IAAgB,CAAC,GAE5EG,IAAOC,EAAmB;AAAA,IAC9B,GAAGP;AAAA,IACH,YAAAD;AAAA,IACA,iBAAiBK,GAAoB;AAAA,EAAA,CACtC;AAID,SAF8BH,EAAU,aAAa,CAACA,EAAU,OAGvD;AAAA,IACL,WAAW;AAAA,IACX,eAAeO,EAAoB,CAACP,CAAS,CAAC;AAAA,EAAA,IAI9CK,EAAK,YACA;AAAA,IACL,GAAGA;AAAA,IACH,eAAeE,EAAoB,CAACP,GAAW,EAAE,eAAeK,EAAK,eAAe,CAAC;AAAA,EAAA,IAIlF;AAAA,IACL,GAAGA;AAAA,IACH,eAAeE,EAAoB,CAACP,GAAW,EAAE,eAAeK,EAAK,eAAe,CAAC;AAAA,EAAA;AAEzF;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { SelectHookField as t } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
3
|
+
import { DatePickerHookField as i } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
4
4
|
function c(e) {
|
|
5
|
-
return /* @__PURE__ */ o(
|
|
5
|
+
return /* @__PURE__ */ o(t, { ...e, name: "locationUuid" });
|
|
6
6
|
}
|
|
7
7
|
function m(e) {
|
|
8
|
-
return /* @__PURE__ */ o(
|
|
8
|
+
return /* @__PURE__ */ o(i, { ...e, name: "effectiveDate" });
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
11
|
m as EffectiveDateField,
|
package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { UseWorkAddressFormProps, UseWorkAddressFormResult } from './useWorkAddr
|
|
|
7
7
|
* the hook resolves the current work address itself.
|
|
8
8
|
*
|
|
9
9
|
* @public
|
|
10
|
+
* @interface
|
|
10
11
|
*/
|
|
11
12
|
export type UseCurrentWorkAddressFormProps = Omit<UseWorkAddressFormProps, 'workAddressUuid'>;
|
|
12
13
|
/**
|
package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentWorkAddressForm.js","sources":["../../../../../../src/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.tsx"],"sourcesContent":["import { useEmployeeAddressesGetWorkAddresses } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport { useWorkAddressForm } from './useWorkAddressForm'\nimport type { UseWorkAddressFormProps, UseWorkAddressFormResult } from './useWorkAddressForm'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\n\n/**\n * Options for {@link useCurrentWorkAddressForm}.\n *\n * @remarks\n * Same shape as {@link UseWorkAddressFormProps} minus `workAddressUuid` —\n * the hook resolves the current work address itself.\n *\n * @public\n */\nexport type UseCurrentWorkAddressFormProps = Omit<UseWorkAddressFormProps, 'workAddressUuid'>\n\n/**\n * Convenience wrapper around {@link useWorkAddressForm} that auto-resolves the employee's current work address.\n *\n * @remarks\n * Lists the employee's work addresses and selects the active one (or the\n * first when none are active) as the row to edit. When the employee has no\n * work address on file the hook operates in create mode. The returned shape\n * is identical to {@link useWorkAddressForm}, so the same `Fields`,\n * `actions.onSubmit`, and `errorHandling` apply.\n *\n * @param props - See {@link UseCurrentWorkAddressFormProps}.\n * @returns A {@link HookLoadingResult} while loading, or a {@link UseWorkAddressFormReady} once ready.\n * @public\n *\n * @example\n * ```tsx\n * import { useCurrentWorkAddressForm } from '@gusto/embedded-react-sdk'\n *\n * function WorkAddressEditor({ employeeId, companyId }: { employeeId: string; companyId: string }) {\n * const workAddress = useCurrentWorkAddressForm({ employeeId, companyId })\n *\n * if (workAddress.isLoading) return <div>Loading...</div>\n *\n * const { Fields } = workAddress.form\n * return (\n * <form onSubmit={e => { e.preventDefault(); void workAddress.actions.onSubmit() }}>\n * <Fields.Location label=\"Work location\" />\n * <button type=\"submit\">Save</button>\n * </form>\n * )\n * }\n * ```\n */\nexport function useCurrentWorkAddressForm(\n props: UseCurrentWorkAddressFormProps,\n): UseWorkAddressFormResult {\n const { employeeId, ...rest } = props\n\n const listQuery = useEmployeeAddressesGetWorkAddresses({ employeeId }, { enabled: !!employeeId })\n\n const workAddresses = listQuery.data?.employeeWorkAddressesList\n const currentWorkAddress = workAddresses?.find(w => w.active) ?? workAddresses?.[0]\n\n const base = useWorkAddressForm({\n ...rest,\n employeeId,\n workAddressUuid: currentWorkAddress?.uuid,\n })\n\n const listInitiallyBlocking = listQuery.isLoading && !listQuery.data\n\n if (listInitiallyBlocking) {\n return {\n isLoading: true as const,\n errorHandling: composeErrorHandler([listQuery]),\n }\n }\n\n if (base.isLoading) {\n return {\n ...base,\n errorHandling: composeErrorHandler([listQuery, { errorHandling: base.errorHandling }]),\n }\n }\n\n return {\n ...base,\n errorHandling: composeErrorHandler([listQuery, { errorHandling: base.errorHandling }]),\n }\n}\n"],"names":["useCurrentWorkAddressForm","props","employeeId","rest","listQuery","useEmployeeAddressesGetWorkAddresses","workAddresses","currentWorkAddress","w","base","useWorkAddressForm","composeErrorHandler"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"useCurrentWorkAddressForm.js","sources":["../../../../../../src/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.tsx"],"sourcesContent":["import { useEmployeeAddressesGetWorkAddresses } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport { useWorkAddressForm } from './useWorkAddressForm'\nimport type { UseWorkAddressFormProps, UseWorkAddressFormResult } from './useWorkAddressForm'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\n\n/**\n * Options for {@link useCurrentWorkAddressForm}.\n *\n * @remarks\n * Same shape as {@link UseWorkAddressFormProps} minus `workAddressUuid` —\n * the hook resolves the current work address itself.\n *\n * @public\n * @interface\n */\nexport type UseCurrentWorkAddressFormProps = Omit<UseWorkAddressFormProps, 'workAddressUuid'>\n\n/**\n * Convenience wrapper around {@link useWorkAddressForm} that auto-resolves the employee's current work address.\n *\n * @remarks\n * Lists the employee's work addresses and selects the active one (or the\n * first when none are active) as the row to edit. When the employee has no\n * work address on file the hook operates in create mode. The returned shape\n * is identical to {@link useWorkAddressForm}, so the same `Fields`,\n * `actions.onSubmit`, and `errorHandling` apply.\n *\n * @param props - See {@link UseCurrentWorkAddressFormProps}.\n * @returns A {@link HookLoadingResult} while loading, or a {@link UseWorkAddressFormReady} once ready.\n * @public\n *\n * @example\n * ```tsx\n * import { useCurrentWorkAddressForm } from '@gusto/embedded-react-sdk'\n *\n * function WorkAddressEditor({ employeeId, companyId }: { employeeId: string; companyId: string }) {\n * const workAddress = useCurrentWorkAddressForm({ employeeId, companyId })\n *\n * if (workAddress.isLoading) return <div>Loading...</div>\n *\n * const { Fields } = workAddress.form\n * return (\n * <form onSubmit={e => { e.preventDefault(); void workAddress.actions.onSubmit() }}>\n * <Fields.Location label=\"Work location\" />\n * <button type=\"submit\">Save</button>\n * </form>\n * )\n * }\n * ```\n */\nexport function useCurrentWorkAddressForm(\n props: UseCurrentWorkAddressFormProps,\n): UseWorkAddressFormResult {\n const { employeeId, ...rest } = props\n\n const listQuery = useEmployeeAddressesGetWorkAddresses({ employeeId }, { enabled: !!employeeId })\n\n const workAddresses = listQuery.data?.employeeWorkAddressesList\n const currentWorkAddress = workAddresses?.find(w => w.active) ?? workAddresses?.[0]\n\n const base = useWorkAddressForm({\n ...rest,\n employeeId,\n workAddressUuid: currentWorkAddress?.uuid,\n })\n\n const listInitiallyBlocking = listQuery.isLoading && !listQuery.data\n\n if (listInitiallyBlocking) {\n return {\n isLoading: true as const,\n errorHandling: composeErrorHandler([listQuery]),\n }\n }\n\n if (base.isLoading) {\n return {\n ...base,\n errorHandling: composeErrorHandler([listQuery, { errorHandling: base.errorHandling }]),\n }\n }\n\n return {\n ...base,\n errorHandling: composeErrorHandler([listQuery, { errorHandling: base.errorHandling }]),\n }\n}\n"],"names":["useCurrentWorkAddressForm","props","employeeId","rest","listQuery","useEmployeeAddressesGetWorkAddresses","workAddresses","currentWorkAddress","w","base","useWorkAddressForm","composeErrorHandler"],"mappings":";;;AAkDO,SAASA,EACdC,GAC0B;AAC1B,QAAM,EAAE,YAAAC,GAAY,GAAGC,EAAA,IAASF,GAE1BG,IAAYC,EAAqC,EAAE,YAAAH,EAAA,GAAc,EAAE,SAAS,CAAC,CAACA,GAAY,GAE1FI,IAAgBF,EAAU,MAAM,2BAChCG,IAAqBD,GAAe,KAAK,CAAAE,MAAKA,EAAE,MAAM,KAAKF,IAAgB,CAAC,GAE5EG,IAAOC,EAAmB;AAAA,IAC9B,GAAGP;AAAA,IACH,YAAAD;AAAA,IACA,iBAAiBK,GAAoB;AAAA,EAAA,CACtC;AAID,SAF8BH,EAAU,aAAa,CAACA,EAAU,OAGvD;AAAA,IACL,WAAW;AAAA,IACX,eAAeO,EAAoB,CAACP,CAAS,CAAC;AAAA,EAAA,IAI9CK,EAAK,YACA;AAAA,IACL,GAAGA;AAAA,IACH,eAAeE,EAAoB,CAACP,GAAW,EAAE,eAAeK,EAAK,eAAe,CAAC;AAAA,EAAA,IAIlF;AAAA,IACL,GAAGA;AAAA,IACH,eAAeE,EAAoB,CAACP,GAAW,EAAE,eAAeK,EAAK,eAAe,CAAC;AAAA,EAAA;AAEzF;"}
|
package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as r } from "react-i18next";
|
|
3
3
|
import { EmployeeStateTaxesErrorCodes as c } from "./employeeStateTaxesSchema.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TextInputHookField as d } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
5
|
+
import { SelectHookField as m } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
5
6
|
import { NumberInputHookField as l } from "../../../../../partner-hook-utils/form/fields/NumberInputHookField.js";
|
|
6
|
-
import {
|
|
7
|
-
import { RadioGroupHookField as
|
|
8
|
-
import { SelectHookField as f } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
7
|
+
import { DatePickerHookField as u } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
8
|
+
import { RadioGroupHookField as f } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
|
|
9
9
|
function F() {
|
|
10
10
|
const { t: o } = r("Employee.StateTaxesView");
|
|
11
11
|
return { [c.REQUIRED]: o("validations.required") };
|
|
@@ -26,21 +26,21 @@ function P({ meta: o, ...e }) {
|
|
|
26
26
|
placeholder: e.placeholder ?? n("selectPlaceholder"),
|
|
27
27
|
FieldComponent: e.FieldComponent
|
|
28
28
|
};
|
|
29
|
-
return /* @__PURE__ */ i(
|
|
29
|
+
return /* @__PURE__ */ i(m, { ...s });
|
|
30
30
|
}
|
|
31
31
|
function H({ meta: o, ...e }) {
|
|
32
32
|
const t = {
|
|
33
33
|
...a(o, e),
|
|
34
34
|
FieldComponent: e.FieldComponent
|
|
35
35
|
};
|
|
36
|
-
return /* @__PURE__ */ i(
|
|
36
|
+
return /* @__PURE__ */ i(f, { ...t });
|
|
37
37
|
}
|
|
38
38
|
function R({ meta: o, ...e }) {
|
|
39
39
|
const t = {
|
|
40
40
|
...a(o, e),
|
|
41
41
|
placeholder: e.placeholder
|
|
42
42
|
};
|
|
43
|
-
return /* @__PURE__ */ i(
|
|
43
|
+
return /* @__PURE__ */ i(d, { ...t });
|
|
44
44
|
}
|
|
45
45
|
function v({ meta: o, ...e }) {
|
|
46
46
|
const t = {
|
|
@@ -63,7 +63,7 @@ function E({ meta: o, ...e }) {
|
|
|
63
63
|
...a(o, e),
|
|
64
64
|
FieldComponent: e.FieldComponent
|
|
65
65
|
};
|
|
66
|
-
return /* @__PURE__ */ i(
|
|
66
|
+
return /* @__PURE__ */ i(u, { ...t });
|
|
67
67
|
}
|
|
68
68
|
export {
|
|
69
69
|
D as CurrencyStateTaxField,
|
|
@@ -108,7 +108,7 @@ export interface DateStateTaxQuestion extends SharedQuestionMetadata {
|
|
|
108
108
|
*
|
|
109
109
|
* @public
|
|
110
110
|
* @group Fields
|
|
111
|
-
* @
|
|
111
|
+
* @siblingOf {@link StateTaxFieldsGroup}
|
|
112
112
|
*/
|
|
113
113
|
export type StateTaxQuestionFieldEntry = SelectStateTaxQuestion | RadioStateTaxQuestion | TextStateTaxQuestion | NumberStateTaxQuestion | CurrencyStateTaxQuestion | DateStateTaxQuestion;
|
|
114
114
|
/**
|
|
@@ -117,7 +117,7 @@ export type StateTaxQuestionFieldEntry = SelectStateTaxQuestion | RadioStateTaxQ
|
|
|
117
117
|
*
|
|
118
118
|
* @public
|
|
119
119
|
* @group Fields
|
|
120
|
-
* @
|
|
120
|
+
* @siblingOf {@link StateTaxFields}
|
|
121
121
|
*/
|
|
122
122
|
export interface StateTaxFieldsGroup {
|
|
123
123
|
/** Two-letter state code. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sources":["../../../../../../src/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport { useMemo } from 'react'\nimport type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { getQuestionVariant, type StateTaxQuestionVariant } from './fieldMapping'\nimport {\n CurrencyStateTaxField,\n DateStateTaxField,\n NumberStateTaxField,\n RadioStateTaxField,\n SelectStateTaxField,\n TextStateTaxField,\n} from './fieldComponents'\nimport type { BoundFieldMeta } from './fieldMeta'\nimport type {\n CurrencyStateTaxFieldProps,\n DateStateTaxFieldProps,\n NumberStateTaxFieldProps,\n RadioStateTaxFieldProps,\n SelectStateTaxFieldProps,\n TextStateTaxFieldProps,\n} from './fieldProps'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\n\nexport type {\n BaseStateTaxFieldProps,\n StateTaxValidationMessages,\n CurrencyStateTaxFieldProps,\n DateStateTaxFieldProps,\n NumberStateTaxFieldProps,\n RadioStateTaxFieldProps,\n SelectStateTaxFieldProps,\n TextStateTaxFieldProps,\n} from './fieldProps'\n\n// ── Discriminated union surfaced to partners ───────────────────────────\n\n/**\n * Metadata shared by every {@link StateTaxQuestionFieldEntry} variant,\n * independent of which input the question renders.\n *\n * @public\n */\nexport interface SharedQuestionMetadata {\n /** Stable identifier for this question (camelCase form of the API key). */\n questionId: string\n /** API-supplied label; default text for the rendered Field. */\n label: string\n /** API-supplied description (raw HTML, sanitized internally before render). */\n description: string | null\n}\n\n/**\n * A state-tax question that renders as a select (dropdown). Includes read-only\n * question metadata from the API and a bound select field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface SelectStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the select variant. */\n type: 'select'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<SelectStateTaxFieldProps>\n}\n\n/**\n * A state-tax question that renders as a radio group. Includes read-only\n * question metadata from the API and a bound radio field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface RadioStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the radio variant. */\n type: 'radio'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<RadioStateTaxFieldProps>\n}\n\n/**\n * A state-tax question that renders as a single-line text input. Includes\n * read-only question metadata from the API and a bound text field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface TextStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the text variant. */\n type: 'text'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<TextStateTaxFieldProps>\n}\n\n/**\n * A state-tax question that renders as a decimal number input. Includes\n * read-only question metadata from the API and a bound number field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface NumberStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the number variant. */\n type: 'number'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<NumberStateTaxFieldProps>\n}\n\n/**\n * A state-tax question that renders as a currency-formatted number input. Includes\n * read-only question metadata from the API and a bound currency field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface CurrencyStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the currency variant. */\n type: 'currency'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<CurrencyStateTaxFieldProps>\n}\n\n/**\n * A state-tax question that renders as a date picker. Includes read-only\n * question metadata from the API and a bound date field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface DateStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the date variant. */\n type: 'date'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<DateStateTaxFieldProps>\n}\n\n/**\n * One question entry within a {@link StateTaxFieldsGroup}, discriminated by\n * `type` to identify which input variant the question uses. Each entry carries\n * a `Field` component pre-bound to its API-supplied metadata so callers can\n * render the input directly.\n *\n * @public\n * @group Fields\n * @groupWith {@link StateTaxFieldsGroup}\n */\nexport type StateTaxQuestionFieldEntry =\n | SelectStateTaxQuestion\n | RadioStateTaxQuestion\n | TextStateTaxQuestion\n | NumberStateTaxQuestion\n | CurrencyStateTaxQuestion\n | DateStateTaxQuestion\n\n/**\n * Group of state-tax questions for a single jurisdiction returned by\n * {@link useStateFields}.\n *\n * @public\n * @group Fields\n * @groupWith {@link StateTaxFields}\n */\nexport interface StateTaxFieldsGroup {\n /** Two-letter state code. */\n state: string\n /** Ordered list of question entries for this state, post admin-only filtering. */\n questions: StateTaxQuestionFieldEntry[]\n}\n\n/**\n * Iterable, render-ready group + question entries with bound Field components,\n * grouped by state.\n *\n * @public\n *\n * @example\n * The value exposed on `form.Fields`: one entry per state, each carrying its\n * questions as pre-bound `Field` components you render directly.\n *\n * ```tsx\n * function StateTaxQuestions({ fields }: { fields: StateTaxFields }) {\n * return fields.map(group => (\n * <section key={group.state}>\n * <h3>{group.state}</h3>\n * {group.questions.map(question => (\n * <question.Field key={question.questionId} />\n * ))}\n * </section>\n * ))\n * }\n * ```\n */\nexport type StateTaxFields = StateTaxFieldsGroup[]\n\n// ── Factory ────────────────────────────────────────────────────────────\n\n/** @internal */\nexport interface CreateStateFieldsOptions {\n isAdmin: boolean\n}\n\n/** @internal */\nexport function createStateFields(\n employeeStateTaxes: EmployeeStateTaxesList[],\n options: CreateStateFieldsOptions,\n): StateTaxFieldsGroup[] {\n const { isAdmin } = options\n const groups: StateTaxFieldsGroup[] = []\n\n for (const stateGroup of employeeStateTaxes) {\n if (!stateGroup.state || !stateGroup.questions) continue\n\n const questions: StateTaxQuestionFieldEntry[] = []\n for (const question of stateGroup.questions) {\n if (question.isQuestionForAdminOnly && !isAdmin) continue\n\n const formKey = snakeCaseToCamelCase(question.key)\n const meta: BoundFieldMeta = {\n name: `states.${stateGroup.state}.${formKey}`,\n apiLabel: question.label,\n apiDescription: question.description,\n }\n const variant = getQuestionVariant(question)\n const shared: SharedQuestionMetadata = {\n questionId: formKey,\n label: question.label,\n description: question.description,\n }\n\n questions.push(buildEntry(variant, meta, shared))\n }\n\n if (questions.length === 0) continue\n\n groups.push({\n state: stateGroup.state,\n questions,\n })\n }\n\n return groups\n}\n\nfunction buildEntry(\n variant: StateTaxQuestionVariant,\n meta: BoundFieldMeta,\n shared: SharedQuestionMetadata,\n): StateTaxQuestionFieldEntry {\n switch (variant) {\n case 'select':\n return {\n type: 'select',\n Field: function BoundSelectStateTaxField(props: SelectStateTaxFieldProps) {\n return <SelectStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n case 'radio':\n return {\n type: 'radio',\n Field: function BoundRadioStateTaxField(props: RadioStateTaxFieldProps) {\n return <RadioStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n case 'text':\n return {\n type: 'text',\n Field: function BoundTextStateTaxField(props: TextStateTaxFieldProps) {\n return <TextStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n case 'number':\n return {\n type: 'number',\n Field: function BoundNumberStateTaxField(props: NumberStateTaxFieldProps) {\n return <NumberStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n case 'currency':\n return {\n type: 'currency',\n Field: function BoundCurrencyStateTaxField(props: CurrencyStateTaxFieldProps) {\n return <CurrencyStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n case 'date':\n return {\n type: 'date',\n Field: function BoundDateStateTaxField(props: DateStateTaxFieldProps) {\n return <DateStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n }\n}\n\n/**\n * Memoizes the bound field components for a state-taxes form, avoiding unnecessary rebuilds when the data refetches but the underlying questions haven't changed.\n *\n * @param employeeStateTaxes - Array of state-tax groups returned by the employee state-taxes API.\n * @param isAdmin - When `true`, admin-only questions are included; when `false`, they are filtered out.\n * @returns An array of {@link StateTaxFieldsGroup} — one entry per state, each with a `questions` array of bound field components.\n * @public\n * @group Utility hooks\n */\nexport function useStateFields(\n employeeStateTaxes: EmployeeStateTaxesList[],\n isAdmin: boolean,\n): StateTaxFieldsGroup[] {\n return useMemo(\n () => createStateFields(employeeStateTaxes, { isAdmin }),\n [employeeStateTaxes, isAdmin],\n )\n}\n"],"names":["createStateFields","employeeStateTaxes","options","isAdmin","groups","stateGroup","questions","question","formKey","snakeCaseToCamelCase","meta","variant","getQuestionVariant","shared","buildEntry","props","jsx","SelectStateTaxField","RadioStateTaxField","TextStateTaxField","NumberStateTaxField","CurrencyStateTaxField","DateStateTaxField","useStateFields","useMemo"],"mappings":";;;;;AA+MO,SAASA,EACdC,GACAC,GACuB;AACvB,QAAM,EAAE,SAAAC,MAAYD,GACdE,IAAgC,CAAA;AAEtC,aAAWC,KAAcJ,GAAoB;AAC3C,QAAI,CAACI,EAAW,SAAS,CAACA,EAAW,UAAW;AAEhD,UAAMC,IAA0C,CAAA;AAChD,eAAWC,KAAYF,EAAW,WAAW;AAC3C,UAAIE,EAAS,0BAA0B,CAACJ,EAAS;AAEjD,YAAMK,IAAUC,EAAqBF,EAAS,GAAG,GAC3CG,IAAuB;AAAA,QAC3B,MAAM,UAAUL,EAAW,KAAK,IAAIG,CAAO;AAAA,QAC3C,UAAUD,EAAS;AAAA,QACnB,gBAAgBA,EAAS;AAAA,MAAA,GAErBI,IAAUC,EAAmBL,CAAQ,GACrCM,IAAiC;AAAA,QACrC,YAAYL;AAAA,QACZ,OAAOD,EAAS;AAAA,QAChB,aAAaA,EAAS;AAAA,MAAA;AAGxB,MAAAD,EAAU,KAAKQ,EAAWH,GAASD,GAAMG,CAAM,CAAC;AAAA,IAClD;AAEA,IAAIP,EAAU,WAAW,KAEzBF,EAAO,KAAK;AAAA,MACV,OAAOC,EAAW;AAAA,MAClB,WAAAC;AAAA,IAAA,CACD;AAAA,EACH;AAEA,SAAOF;AACT;AAEA,SAASU,EACPH,GACAD,GACAG,GAC4B;AAC5B,UAAQF,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAkCI,GAAiC;AACxE,iBAAO,gBAAAC,EAACC,GAAA,EAAoB,MAAAP,GAAa,GAAGK,EAAA,CAAO;AAAA,QACrD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,IAEP,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAiCE,GAAgC;AACtE,iBAAO,gBAAAC,EAACE,GAAA,EAAmB,MAAAR,GAAa,GAAGK,EAAA,CAAO;AAAA,QACpD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,IAEP,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAgCE,GAA+B;AACpE,iBAAO,gBAAAC,EAACG,GAAA,EAAkB,MAAAT,GAAa,GAAGK,EAAA,CAAO;AAAA,QACnD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,IAEP,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAkCE,GAAiC;AACxE,iBAAO,gBAAAC,EAACI,GAAA,EAAoB,MAAAV,GAAa,GAAGK,EAAA,CAAO;AAAA,QACrD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,IAEP,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAoCE,GAAmC;AAC5E,iBAAO,gBAAAC,EAACK,GAAA,EAAsB,MAAAX,GAAa,GAAGK,EAAA,CAAO;AAAA,QACvD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,IAEP,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAgCE,GAA+B;AACpE,iBAAO,gBAAAC,EAACM,GAAA,EAAkB,MAAAZ,GAAa,GAAGK,EAAA,CAAO;AAAA,QACnD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,EACL;AAEN;AAWO,SAASU,EACdtB,GACAE,GACuB;AACvB,SAAOqB;AAAA,IACL,MAAMxB,EAAkBC,GAAoB,EAAE,SAAAE,GAAS;AAAA,IACvD,CAACF,GAAoBE,CAAO;AAAA,EAAA;AAEhC;"}
|
|
1
|
+
{"version":3,"file":"fields.js","sources":["../../../../../../src/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport { useMemo } from 'react'\nimport type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { getQuestionVariant, type StateTaxQuestionVariant } from './fieldMapping'\nimport {\n CurrencyStateTaxField,\n DateStateTaxField,\n NumberStateTaxField,\n RadioStateTaxField,\n SelectStateTaxField,\n TextStateTaxField,\n} from './fieldComponents'\nimport type { BoundFieldMeta } from './fieldMeta'\nimport type {\n CurrencyStateTaxFieldProps,\n DateStateTaxFieldProps,\n NumberStateTaxFieldProps,\n RadioStateTaxFieldProps,\n SelectStateTaxFieldProps,\n TextStateTaxFieldProps,\n} from './fieldProps'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\n\nexport type {\n BaseStateTaxFieldProps,\n StateTaxValidationMessages,\n CurrencyStateTaxFieldProps,\n DateStateTaxFieldProps,\n NumberStateTaxFieldProps,\n RadioStateTaxFieldProps,\n SelectStateTaxFieldProps,\n TextStateTaxFieldProps,\n} from './fieldProps'\n\n// ── Discriminated union surfaced to partners ───────────────────────────\n\n/**\n * Metadata shared by every {@link StateTaxQuestionFieldEntry} variant,\n * independent of which input the question renders.\n *\n * @public\n */\nexport interface SharedQuestionMetadata {\n /** Stable identifier for this question (camelCase form of the API key). */\n questionId: string\n /** API-supplied label; default text for the rendered Field. */\n label: string\n /** API-supplied description (raw HTML, sanitized internally before render). */\n description: string | null\n}\n\n/**\n * A state-tax question that renders as a select (dropdown). Includes read-only\n * question metadata from the API and a bound select field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface SelectStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the select variant. */\n type: 'select'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<SelectStateTaxFieldProps>\n}\n\n/**\n * A state-tax question that renders as a radio group. Includes read-only\n * question metadata from the API and a bound radio field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface RadioStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the radio variant. */\n type: 'radio'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<RadioStateTaxFieldProps>\n}\n\n/**\n * A state-tax question that renders as a single-line text input. Includes\n * read-only question metadata from the API and a bound text field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface TextStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the text variant. */\n type: 'text'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<TextStateTaxFieldProps>\n}\n\n/**\n * A state-tax question that renders as a decimal number input. Includes\n * read-only question metadata from the API and a bound number field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface NumberStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the number variant. */\n type: 'number'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<NumberStateTaxFieldProps>\n}\n\n/**\n * A state-tax question that renders as a currency-formatted number input. Includes\n * read-only question metadata from the API and a bound currency field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface CurrencyStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the currency variant. */\n type: 'currency'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<CurrencyStateTaxFieldProps>\n}\n\n/**\n * A state-tax question that renders as a date picker. Includes read-only\n * question metadata from the API and a bound date field, exposed as\n * `<question.Field />`.\n *\n * @public\n * @group Fields\n */\nexport interface DateStateTaxQuestion extends SharedQuestionMetadata {\n /** Discriminant identifying the date variant. */\n type: 'date'\n /** Field component pre-bound to this question's API-supplied metadata. */\n Field: ComponentType<DateStateTaxFieldProps>\n}\n\n/**\n * One question entry within a {@link StateTaxFieldsGroup}, discriminated by\n * `type` to identify which input variant the question uses. Each entry carries\n * a `Field` component pre-bound to its API-supplied metadata so callers can\n * render the input directly.\n *\n * @public\n * @group Fields\n * @siblingOf {@link StateTaxFieldsGroup}\n */\nexport type StateTaxQuestionFieldEntry =\n | SelectStateTaxQuestion\n | RadioStateTaxQuestion\n | TextStateTaxQuestion\n | NumberStateTaxQuestion\n | CurrencyStateTaxQuestion\n | DateStateTaxQuestion\n\n/**\n * Group of state-tax questions for a single jurisdiction returned by\n * {@link useStateFields}.\n *\n * @public\n * @group Fields\n * @siblingOf {@link StateTaxFields}\n */\nexport interface StateTaxFieldsGroup {\n /** Two-letter state code. */\n state: string\n /** Ordered list of question entries for this state, post admin-only filtering. */\n questions: StateTaxQuestionFieldEntry[]\n}\n\n/**\n * Iterable, render-ready group + question entries with bound Field components,\n * grouped by state.\n *\n * @public\n *\n * @example\n * The value exposed on `form.Fields`: one entry per state, each carrying its\n * questions as pre-bound `Field` components you render directly.\n *\n * ```tsx\n * function StateTaxQuestions({ fields }: { fields: StateTaxFields }) {\n * return fields.map(group => (\n * <section key={group.state}>\n * <h3>{group.state}</h3>\n * {group.questions.map(question => (\n * <question.Field key={question.questionId} />\n * ))}\n * </section>\n * ))\n * }\n * ```\n */\nexport type StateTaxFields = StateTaxFieldsGroup[]\n\n// ── Factory ────────────────────────────────────────────────────────────\n\n/** @internal */\nexport interface CreateStateFieldsOptions {\n isAdmin: boolean\n}\n\n/** @internal */\nexport function createStateFields(\n employeeStateTaxes: EmployeeStateTaxesList[],\n options: CreateStateFieldsOptions,\n): StateTaxFieldsGroup[] {\n const { isAdmin } = options\n const groups: StateTaxFieldsGroup[] = []\n\n for (const stateGroup of employeeStateTaxes) {\n if (!stateGroup.state || !stateGroup.questions) continue\n\n const questions: StateTaxQuestionFieldEntry[] = []\n for (const question of stateGroup.questions) {\n if (question.isQuestionForAdminOnly && !isAdmin) continue\n\n const formKey = snakeCaseToCamelCase(question.key)\n const meta: BoundFieldMeta = {\n name: `states.${stateGroup.state}.${formKey}`,\n apiLabel: question.label,\n apiDescription: question.description,\n }\n const variant = getQuestionVariant(question)\n const shared: SharedQuestionMetadata = {\n questionId: formKey,\n label: question.label,\n description: question.description,\n }\n\n questions.push(buildEntry(variant, meta, shared))\n }\n\n if (questions.length === 0) continue\n\n groups.push({\n state: stateGroup.state,\n questions,\n })\n }\n\n return groups\n}\n\nfunction buildEntry(\n variant: StateTaxQuestionVariant,\n meta: BoundFieldMeta,\n shared: SharedQuestionMetadata,\n): StateTaxQuestionFieldEntry {\n switch (variant) {\n case 'select':\n return {\n type: 'select',\n Field: function BoundSelectStateTaxField(props: SelectStateTaxFieldProps) {\n return <SelectStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n case 'radio':\n return {\n type: 'radio',\n Field: function BoundRadioStateTaxField(props: RadioStateTaxFieldProps) {\n return <RadioStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n case 'text':\n return {\n type: 'text',\n Field: function BoundTextStateTaxField(props: TextStateTaxFieldProps) {\n return <TextStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n case 'number':\n return {\n type: 'number',\n Field: function BoundNumberStateTaxField(props: NumberStateTaxFieldProps) {\n return <NumberStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n case 'currency':\n return {\n type: 'currency',\n Field: function BoundCurrencyStateTaxField(props: CurrencyStateTaxFieldProps) {\n return <CurrencyStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n case 'date':\n return {\n type: 'date',\n Field: function BoundDateStateTaxField(props: DateStateTaxFieldProps) {\n return <DateStateTaxField meta={meta} {...props} />\n },\n ...shared,\n }\n }\n}\n\n/**\n * Memoizes the bound field components for a state-taxes form, avoiding unnecessary rebuilds when the data refetches but the underlying questions haven't changed.\n *\n * @param employeeStateTaxes - Array of state-tax groups returned by the employee state-taxes API.\n * @param isAdmin - When `true`, admin-only questions are included; when `false`, they are filtered out.\n * @returns An array of {@link StateTaxFieldsGroup} — one entry per state, each with a `questions` array of bound field components.\n * @public\n * @group Utility hooks\n */\nexport function useStateFields(\n employeeStateTaxes: EmployeeStateTaxesList[],\n isAdmin: boolean,\n): StateTaxFieldsGroup[] {\n return useMemo(\n () => createStateFields(employeeStateTaxes, { isAdmin }),\n [employeeStateTaxes, isAdmin],\n )\n}\n"],"names":["createStateFields","employeeStateTaxes","options","isAdmin","groups","stateGroup","questions","question","formKey","snakeCaseToCamelCase","meta","variant","getQuestionVariant","shared","buildEntry","props","jsx","SelectStateTaxField","RadioStateTaxField","TextStateTaxField","NumberStateTaxField","CurrencyStateTaxField","DateStateTaxField","useStateFields","useMemo"],"mappings":";;;;;AA+MO,SAASA,EACdC,GACAC,GACuB;AACvB,QAAM,EAAE,SAAAC,MAAYD,GACdE,IAAgC,CAAA;AAEtC,aAAWC,KAAcJ,GAAoB;AAC3C,QAAI,CAACI,EAAW,SAAS,CAACA,EAAW,UAAW;AAEhD,UAAMC,IAA0C,CAAA;AAChD,eAAWC,KAAYF,EAAW,WAAW;AAC3C,UAAIE,EAAS,0BAA0B,CAACJ,EAAS;AAEjD,YAAMK,IAAUC,EAAqBF,EAAS,GAAG,GAC3CG,IAAuB;AAAA,QAC3B,MAAM,UAAUL,EAAW,KAAK,IAAIG,CAAO;AAAA,QAC3C,UAAUD,EAAS;AAAA,QACnB,gBAAgBA,EAAS;AAAA,MAAA,GAErBI,IAAUC,EAAmBL,CAAQ,GACrCM,IAAiC;AAAA,QACrC,YAAYL;AAAA,QACZ,OAAOD,EAAS;AAAA,QAChB,aAAaA,EAAS;AAAA,MAAA;AAGxB,MAAAD,EAAU,KAAKQ,EAAWH,GAASD,GAAMG,CAAM,CAAC;AAAA,IAClD;AAEA,IAAIP,EAAU,WAAW,KAEzBF,EAAO,KAAK;AAAA,MACV,OAAOC,EAAW;AAAA,MAClB,WAAAC;AAAA,IAAA,CACD;AAAA,EACH;AAEA,SAAOF;AACT;AAEA,SAASU,EACPH,GACAD,GACAG,GAC4B;AAC5B,UAAQF,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAkCI,GAAiC;AACxE,iBAAO,gBAAAC,EAACC,GAAA,EAAoB,MAAAP,GAAa,GAAGK,EAAA,CAAO;AAAA,QACrD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,IAEP,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAiCE,GAAgC;AACtE,iBAAO,gBAAAC,EAACE,GAAA,EAAmB,MAAAR,GAAa,GAAGK,EAAA,CAAO;AAAA,QACpD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,IAEP,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAgCE,GAA+B;AACpE,iBAAO,gBAAAC,EAACG,GAAA,EAAkB,MAAAT,GAAa,GAAGK,EAAA,CAAO;AAAA,QACnD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,IAEP,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAkCE,GAAiC;AACxE,iBAAO,gBAAAC,EAACI,GAAA,EAAoB,MAAAV,GAAa,GAAGK,EAAA,CAAO;AAAA,QACrD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,IAEP,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAoCE,GAAmC;AAC5E,iBAAO,gBAAAC,EAACK,GAAA,EAAsB,MAAAX,GAAa,GAAGK,EAAA,CAAO;AAAA,QACvD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,IAEP,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,SAAgCE,GAA+B;AACpE,iBAAO,gBAAAC,EAACM,GAAA,EAAkB,MAAAZ,GAAa,GAAGK,EAAA,CAAO;AAAA,QACnD;AAAA,QACA,GAAGF;AAAA,MAAA;AAAA,EACL;AAEN;AAWO,SAASU,EACdtB,GACAE,GACuB;AACvB,SAAOqB;AAAA,IACL,MAAMxB,EAAkBC,GAAoB,EAAE,SAAAE,GAAS;AAAA,IACvD,CAACF,GAAoBE,CAAO;AAAA,EAAA;AAEhC;"}
|
|
@@ -1,48 +1,88 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Flows and blocks for viewing and responding to information requests from Gusto.
|
|
3
3
|
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { InformationRequests } from '@gusto/embedded-react-sdk'
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
4
9
|
* @group Component namespaces
|
|
5
10
|
*/
|
|
6
11
|
export * as InformationRequests from './InformationRequests';
|
|
7
12
|
/**
|
|
8
13
|
* Flows and blocks for running and managing payroll across a company's pay schedules.
|
|
9
14
|
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { Payroll } from '@gusto/embedded-react-sdk'
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
10
20
|
* @group Component namespaces
|
|
11
21
|
*/
|
|
12
22
|
export * as Payroll from './Payroll';
|
|
13
23
|
/**
|
|
14
24
|
* Flows and blocks for creating and managing time-off policies — sick, vacation, and holiday.
|
|
15
25
|
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { TimeOff } from '@gusto/embedded-react-sdk'
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
16
31
|
* @group Component namespaces
|
|
17
32
|
*/
|
|
18
33
|
export * as TimeOff from './TimeOff';
|
|
19
34
|
/**
|
|
20
35
|
* Flows and blocks for onboarding employees.
|
|
21
36
|
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { EmployeeOnboarding } from '@gusto/embedded-react-sdk'
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
22
42
|
* @group Component namespaces
|
|
23
43
|
*/
|
|
24
44
|
export * as EmployeeOnboarding from './Employee/exports/employeeOnboarding';
|
|
25
45
|
/**
|
|
26
46
|
* Flows and blocks for managing an employee after onboarding.
|
|
27
47
|
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { EmployeeManagement } from '@gusto/embedded-react-sdk'
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
28
53
|
* @group Component namespaces
|
|
29
54
|
*/
|
|
30
55
|
export * as EmployeeManagement from './Employee/exports/employeeManagement';
|
|
31
56
|
/**
|
|
32
57
|
* Flows and blocks for onboarding a company.
|
|
33
58
|
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { CompanyOnboarding } from '@gusto/embedded-react-sdk'
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
34
64
|
* @group Component namespaces
|
|
35
65
|
*/
|
|
36
66
|
export * as CompanyOnboarding from './Company/exports/companyOnboarding';
|
|
37
67
|
/**
|
|
38
68
|
* Flows and blocks for onboarding contractors.
|
|
39
69
|
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { ContractorOnboarding } from '@gusto/embedded-react-sdk'
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
40
75
|
* @group Component namespaces
|
|
41
76
|
*/
|
|
42
77
|
export * as ContractorOnboarding from './Contractor/exports/contractorOnboarding';
|
|
43
78
|
/**
|
|
44
79
|
* Flows and blocks for managing contractors after onboarding — payments, payment methods, and profile details.
|
|
45
80
|
*
|
|
81
|
+
* @remarks
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { ContractorManagement } from '@gusto/embedded-react-sdk'
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
46
86
|
* @group Component namespaces
|
|
47
87
|
*/
|
|
48
88
|
export * as ContractorManagement from './Contractor/exports/contractorManagement';
|
|
@@ -51,7 +51,7 @@ import { PayrollLoadingProps } from '../../components/Common/PayrollLoading/Payr
|
|
|
51
51
|
* which fall back to built-in SDK implementations when omitted.
|
|
52
52
|
*
|
|
53
53
|
* @public
|
|
54
|
-
* @group
|
|
54
|
+
* @group Component adapter
|
|
55
55
|
*
|
|
56
56
|
* @example Partial override with GustoProvider
|
|
57
57
|
* ```tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComponentContext.js","sources":["../../../src/contexts/ComponentAdapter/useComponentContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { FunctionComponent } from 'react'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport type { TextAreaProps } from '@/components/Common/UI/TextArea/TextAreaTypes'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport type { CheckboxGroupProps } from '@/components/Common/UI/CheckboxGroup/CheckboxGroupTypes'\nimport type { ComboBoxProps } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\nimport type { RadioProps } from '@/components/Common/UI/Radio/RadioTypes'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\nimport type { SwitchProps } from '@/components/Common/UI/Switch/SwitchTypes'\nimport type { ButtonIconProps, ButtonProps } from '@/components/Common/UI/Button/ButtonTypes'\nimport type { AlertProps } from '@/components/Common/UI/Alert/AlertTypes'\nimport type { CardProps } from '@/components/Common/UI/Card/CardTypes'\nimport type { BoxProps } from '@/components/Common/UI/Box/BoxTypes'\nimport type { FormBoxProps } from '@/components/Common/UI/FormBox/FormBoxTypes'\nimport type { LinkProps } from '@/components/Common/UI/Link/LinkTypes'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\nimport type { BannerProps } from '@/components/Common/UI/Banner/BannerTypes'\nimport type { MenuProps } from '@/components/Common/UI/Menu/MenuTypes'\nimport type { TableProps } from '@/components/Common/UI/Table/TableTypes'\nimport type { OrderedListProps, UnorderedListProps } from '@/components/Common/UI/List/ListTypes'\nimport type { HeadingProps } from '@/components/Common/UI/Heading/HeadingTypes'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport type { TextProps } from '@/components/Common/UI/Text/TextTypes'\nimport type { CalendarPreviewProps } from '@/components/Common/UI/CalendarPreview/CalendarPreviewTypes'\nimport type { DateRangePickerProps } from '@/components/Common/UI/DateRangePicker/DateRangePickerTypes'\nimport type { ProgressBarProps } from '@/components/Common/UI/ProgressBar/ProgressBarTypes'\nimport type { BreadcrumbsProps } from '@/components/Common/UI/Breadcrumbs/BreadcrumbsTypes'\nimport type { TabsProps } from '@/components/Common/UI/Tabs/TabsTypes'\nimport type { DialogProps } from '@/components/Common/UI/Dialog/DialogTypes'\nimport type { ModalProps } from '@/components/Common/UI/Modal/ModalTypes'\nimport type { LoadingSpinnerProps } from '@/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes'\nimport type { DescriptionListProps } from '@/components/Common/UI/DescriptionList/DescriptionListTypes'\nimport type { FileInputProps } from '@/components/Common/UI/FileInput/FileInputTypes'\nimport type { BoxHeaderProps } from '@/components/Common/UI/BoxHeader/BoxHeaderTypes'\nimport type { FormBoxHeaderProps } from '@/components/Common/UI/FormBoxHeader/FormBoxHeaderTypes'\nimport type { MultiSelectComboBoxProps } from '@/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes'\nimport type { PayrollLoadingProps } from '@/components/Common/PayrollLoading/PayrollLoadingTypes'\n\n/**\n * Full map of UI components used by the SDK. Every property is a React component that the\n * SDK renders internally — override any of them to substitute your own design system.\n *\n * Pass a `Partial<ComponentsContextType>` to {@link GustoProvider} via the `components` prop to\n * replace specific components while keeping SDK defaults for the rest.\n *\n * To take full control of every UI component (and eliminate the React Aria dependency),\n * pass a complete {@link ComponentsContextType} to {@link GustoProviderCustomUIAdapter} instead.\n * All properties are then required except `PaginationControl` and `PayrollLoading`,\n * which fall back to built-in SDK implementations when omitted.\n *\n * @public\n * @group Utility types\n *\n * @example Partial override with GustoProvider\n * ```tsx\n * import { GustoProvider } from '@gusto/embedded-react-sdk'\n *\n * function App() {\n * return (\n * <GustoProvider\n * config={{ baseUrl: '/api/gusto/' }}\n * components={{\n * Button: MyButton,\n * TextInput: MyTextInput,\n * }}\n * >\n * <EmployeeOnboardingFlow companyId=\"company_123\" />\n * </GustoProvider>\n * )\n * }\n * ```\n *\n * @example Full replacement with GustoProviderCustomUIAdapter\n * ```tsx\n * import { GustoProviderCustomUIAdapter, type ComponentsContextType } from '@gusto/embedded-react-sdk'\n *\n * const myComponents: ComponentsContextType = {\n * Alert: props => <MyAlert {...props} />,\n * Button: props => <MyButton {...props} />,\n * // ... all required components\n * }\n *\n * function App() {\n * return (\n * <GustoProviderCustomUIAdapter\n * config={{ baseUrl: '/api/gusto/' }}\n * components={myComponents}\n * >\n * <EmployeeOnboardingFlow companyId=\"company_123\" />\n * </GustoProviderCustomUIAdapter>\n * )\n * }\n * ```\n */\nexport interface ComponentsContextType {\n /** Status message with an optional dismiss action; used for errors, warnings, success, and info. */\n Alert: FunctionComponent<AlertProps>\n /** Small inline label for status, counts, or tags; optionally dismissible. */\n Badge: FunctionComponent<BadgeProps>\n /** Full-width notification banner for prominent warnings and errors. */\n Banner: FunctionComponent<BannerProps>\n /** HTML `<button>` with primary, secondary, tertiary, and error variants. */\n Button: FunctionComponent<ButtonProps>\n /** Icon-only `<button>`; requires `aria-label` since there is no visible text for assistive technologies. */\n ButtonIcon: FunctionComponent<ButtonIconProps>\n /** Sectioned layout container with distinct header, body, and footer areas. */\n Box: FunctionComponent<BoxProps>\n /** Header section of a Box with a title, optional description, and optional inline action. */\n BoxHeader: FunctionComponent<BoxHeaderProps>\n /** Bordered container for grouping related form fields, with an optional header slot. */\n FormBox: FunctionComponent<FormBoxProps>\n /** Header section of a FormBox with a title, optional description, and optional inline action. */\n FormBoxHeader: FunctionComponent<FormBoxHeaderProps>\n /** Read-only calendar for visualizing a date range with optional highlighted dates. */\n CalendarPreview: FunctionComponent<CalendarPreviewProps>\n /** Content container with an optional overflow menu and a leading action slot. */\n Card: FunctionComponent<CardProps>\n /** Form field wrapping a single `<input type=\"checkbox\" />`. */\n Checkbox: FunctionComponent<CheckboxProps>\n /** Form field grouping `<input type=\"checkbox\" />` elements for multi-option selection. */\n CheckboxGroup: FunctionComponent<CheckboxGroupProps>\n /** Form field wrapping a typeahead `<input />` for single-option selection. */\n ComboBox: FunctionComponent<ComboBoxProps>\n /** Form field wrapping an `<input type=\"date\" />` with a calendar picker popover. */\n DatePicker: FunctionComponent<DatePickerProps>\n /** Form field wrapping paired `<input type=\"date\" />` elements for a date range. */\n DateRangePicker: FunctionComponent<DateRangePickerProps>\n /** HTML `<dl>` of term/description pairs in stacked or horizontal layout. */\n DescriptionList: FunctionComponent<DescriptionListProps>\n /** Modal confirmation dialog with a primary action and a cancel action. */\n Dialog: FunctionComponent<DialogProps>\n /** Form field wrapping an `<input type=\"file\" />`. */\n FileInput: FunctionComponent<FileInputProps>\n /** HTML `<h1>`–`<h6>` with visual style controlled independently from semantic level. */\n Heading: FunctionComponent<HeadingProps>\n /** HTML `<a>` for inline navigation. */\n Link: FunctionComponent<LinkProps>\n /** Spinner shown while data or an action is pending. */\n LoadingSpinner: FunctionComponent<LoadingSpinnerProps>\n /** Popover menu of actions anchored to a trigger element. */\n Menu: FunctionComponent<MenuProps>\n /** Overlay modal with customizable body content and footer. */\n Modal: FunctionComponent<ModalProps>\n /** Form field wrapping a typeahead `<input />` for multi-option selection. */\n MultiSelectComboBox: FunctionComponent<MultiSelectComboBoxProps>\n /** Form field wrapping a numeric `<input />` for currency, decimal, or percent values. */\n NumberInput: FunctionComponent<NumberInputProps>\n /** HTML `<ol>` for a numbered list of items. */\n OrderedList: FunctionComponent<OrderedListProps>\n /** Step-based progress indicator for multi-step flows. */\n ProgressBar: FunctionComponent<ProgressBarProps>\n /** Navigation breadcrumb trail showing the user's position in a multi-step flow. */\n Breadcrumbs: FunctionComponent<BreadcrumbsProps>\n /** Form field wrapping a single `<input type=\"radio\" />`. */\n Radio: FunctionComponent<RadioProps>\n /** Form field grouping `<input type=\"radio\" />` elements for single-option selection. */\n RadioGroup: FunctionComponent<RadioGroupProps>\n /** Form field wrapping a single-select dropdown. */\n Select: FunctionComponent<SelectProps>\n /** Form field wrapping an `<input type=\"checkbox\" />` styled as a toggle. */\n Switch: FunctionComponent<SwitchProps>\n /** Tabbed navigation with associated content panels. */\n Tabs: FunctionComponent<TabsProps>\n /** Tabular data display with headers, rows, optional footer, and empty state. */\n Table: FunctionComponent<TableProps>\n /** Body text element rendered as `<p>`, `<span>`, `<div>`, or `<pre>`. */\n Text: FunctionComponent<TextProps>\n /** Form field wrapping an `<input />`. */\n TextInput: FunctionComponent<TextInputProps>\n /** Form field wrapping a `<textarea>`. */\n TextArea: FunctionComponent<TextAreaProps>\n /** HTML `<ul>` for an unordered list of items. */\n UnorderedList: FunctionComponent<UnorderedListProps>\n\n /** Pagination controls for list views. Defaults to the SDK's built-in pagination UI when omitted. */\n PaginationControl?: FunctionComponent<PaginationControlProps>\n /** Loading indicator for payroll calculation. Defaults to the SDK's built-in loading state when omitted. */\n PayrollLoading?: FunctionComponent<PayrollLoadingProps>\n}\n\n/** @internal */\nexport const ComponentsContext = createContext<ComponentsContextType | null>(null)\n\n/** @internal */\nexport const useComponentContext = () => {\n const context = useContext(ComponentsContext)\n if (!context) {\n throw new Error('useComponentContext must be used within a ComponentsProvider')\n }\n return context\n}\n"],"names":["ComponentsContext","createContext","useComponentContext","context","useContext"],"mappings":";AAyLO,MAAMA,IAAoBC,EAA4C,IAAI,GAGpEC,IAAsB,MAAM;AACvC,QAAMC,IAAUC,EAAWJ,CAAiB;AAC5C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,8DAA8D;AAEhF,SAAOA;AACT;"}
|
|
1
|
+
{"version":3,"file":"useComponentContext.js","sources":["../../../src/contexts/ComponentAdapter/useComponentContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { FunctionComponent } from 'react'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport type { TextAreaProps } from '@/components/Common/UI/TextArea/TextAreaTypes'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport type { CheckboxGroupProps } from '@/components/Common/UI/CheckboxGroup/CheckboxGroupTypes'\nimport type { ComboBoxProps } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\nimport type { RadioProps } from '@/components/Common/UI/Radio/RadioTypes'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\nimport type { SwitchProps } from '@/components/Common/UI/Switch/SwitchTypes'\nimport type { ButtonIconProps, ButtonProps } from '@/components/Common/UI/Button/ButtonTypes'\nimport type { AlertProps } from '@/components/Common/UI/Alert/AlertTypes'\nimport type { CardProps } from '@/components/Common/UI/Card/CardTypes'\nimport type { BoxProps } from '@/components/Common/UI/Box/BoxTypes'\nimport type { FormBoxProps } from '@/components/Common/UI/FormBox/FormBoxTypes'\nimport type { LinkProps } from '@/components/Common/UI/Link/LinkTypes'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\nimport type { BannerProps } from '@/components/Common/UI/Banner/BannerTypes'\nimport type { MenuProps } from '@/components/Common/UI/Menu/MenuTypes'\nimport type { TableProps } from '@/components/Common/UI/Table/TableTypes'\nimport type { OrderedListProps, UnorderedListProps } from '@/components/Common/UI/List/ListTypes'\nimport type { HeadingProps } from '@/components/Common/UI/Heading/HeadingTypes'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport type { TextProps } from '@/components/Common/UI/Text/TextTypes'\nimport type { CalendarPreviewProps } from '@/components/Common/UI/CalendarPreview/CalendarPreviewTypes'\nimport type { DateRangePickerProps } from '@/components/Common/UI/DateRangePicker/DateRangePickerTypes'\nimport type { ProgressBarProps } from '@/components/Common/UI/ProgressBar/ProgressBarTypes'\nimport type { BreadcrumbsProps } from '@/components/Common/UI/Breadcrumbs/BreadcrumbsTypes'\nimport type { TabsProps } from '@/components/Common/UI/Tabs/TabsTypes'\nimport type { DialogProps } from '@/components/Common/UI/Dialog/DialogTypes'\nimport type { ModalProps } from '@/components/Common/UI/Modal/ModalTypes'\nimport type { LoadingSpinnerProps } from '@/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes'\nimport type { DescriptionListProps } from '@/components/Common/UI/DescriptionList/DescriptionListTypes'\nimport type { FileInputProps } from '@/components/Common/UI/FileInput/FileInputTypes'\nimport type { BoxHeaderProps } from '@/components/Common/UI/BoxHeader/BoxHeaderTypes'\nimport type { FormBoxHeaderProps } from '@/components/Common/UI/FormBoxHeader/FormBoxHeaderTypes'\nimport type { MultiSelectComboBoxProps } from '@/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes'\nimport type { PayrollLoadingProps } from '@/components/Common/PayrollLoading/PayrollLoadingTypes'\n\n/**\n * Full map of UI components used by the SDK. Every property is a React component that the\n * SDK renders internally — override any of them to substitute your own design system.\n *\n * Pass a `Partial<ComponentsContextType>` to {@link GustoProvider} via the `components` prop to\n * replace specific components while keeping SDK defaults for the rest.\n *\n * To take full control of every UI component (and eliminate the React Aria dependency),\n * pass a complete {@link ComponentsContextType} to {@link GustoProviderCustomUIAdapter} instead.\n * All properties are then required except `PaginationControl` and `PayrollLoading`,\n * which fall back to built-in SDK implementations when omitted.\n *\n * @public\n * @group Component adapter\n *\n * @example Partial override with GustoProvider\n * ```tsx\n * import { GustoProvider } from '@gusto/embedded-react-sdk'\n *\n * function App() {\n * return (\n * <GustoProvider\n * config={{ baseUrl: '/api/gusto/' }}\n * components={{\n * Button: MyButton,\n * TextInput: MyTextInput,\n * }}\n * >\n * <EmployeeOnboardingFlow companyId=\"company_123\" />\n * </GustoProvider>\n * )\n * }\n * ```\n *\n * @example Full replacement with GustoProviderCustomUIAdapter\n * ```tsx\n * import { GustoProviderCustomUIAdapter, type ComponentsContextType } from '@gusto/embedded-react-sdk'\n *\n * const myComponents: ComponentsContextType = {\n * Alert: props => <MyAlert {...props} />,\n * Button: props => <MyButton {...props} />,\n * // ... all required components\n * }\n *\n * function App() {\n * return (\n * <GustoProviderCustomUIAdapter\n * config={{ baseUrl: '/api/gusto/' }}\n * components={myComponents}\n * >\n * <EmployeeOnboardingFlow companyId=\"company_123\" />\n * </GustoProviderCustomUIAdapter>\n * )\n * }\n * ```\n */\nexport interface ComponentsContextType {\n /** Status message with an optional dismiss action; used for errors, warnings, success, and info. */\n Alert: FunctionComponent<AlertProps>\n /** Small inline label for status, counts, or tags; optionally dismissible. */\n Badge: FunctionComponent<BadgeProps>\n /** Full-width notification banner for prominent warnings and errors. */\n Banner: FunctionComponent<BannerProps>\n /** HTML `<button>` with primary, secondary, tertiary, and error variants. */\n Button: FunctionComponent<ButtonProps>\n /** Icon-only `<button>`; requires `aria-label` since there is no visible text for assistive technologies. */\n ButtonIcon: FunctionComponent<ButtonIconProps>\n /** Sectioned layout container with distinct header, body, and footer areas. */\n Box: FunctionComponent<BoxProps>\n /** Header section of a Box with a title, optional description, and optional inline action. */\n BoxHeader: FunctionComponent<BoxHeaderProps>\n /** Bordered container for grouping related form fields, with an optional header slot. */\n FormBox: FunctionComponent<FormBoxProps>\n /** Header section of a FormBox with a title, optional description, and optional inline action. */\n FormBoxHeader: FunctionComponent<FormBoxHeaderProps>\n /** Read-only calendar for visualizing a date range with optional highlighted dates. */\n CalendarPreview: FunctionComponent<CalendarPreviewProps>\n /** Content container with an optional overflow menu and a leading action slot. */\n Card: FunctionComponent<CardProps>\n /** Form field wrapping a single `<input type=\"checkbox\" />`. */\n Checkbox: FunctionComponent<CheckboxProps>\n /** Form field grouping `<input type=\"checkbox\" />` elements for multi-option selection. */\n CheckboxGroup: FunctionComponent<CheckboxGroupProps>\n /** Form field wrapping a typeahead `<input />` for single-option selection. */\n ComboBox: FunctionComponent<ComboBoxProps>\n /** Form field wrapping an `<input type=\"date\" />` with a calendar picker popover. */\n DatePicker: FunctionComponent<DatePickerProps>\n /** Form field wrapping paired `<input type=\"date\" />` elements for a date range. */\n DateRangePicker: FunctionComponent<DateRangePickerProps>\n /** HTML `<dl>` of term/description pairs in stacked or horizontal layout. */\n DescriptionList: FunctionComponent<DescriptionListProps>\n /** Modal confirmation dialog with a primary action and a cancel action. */\n Dialog: FunctionComponent<DialogProps>\n /** Form field wrapping an `<input type=\"file\" />`. */\n FileInput: FunctionComponent<FileInputProps>\n /** HTML `<h1>`–`<h6>` with visual style controlled independently from semantic level. */\n Heading: FunctionComponent<HeadingProps>\n /** HTML `<a>` for inline navigation. */\n Link: FunctionComponent<LinkProps>\n /** Spinner shown while data or an action is pending. */\n LoadingSpinner: FunctionComponent<LoadingSpinnerProps>\n /** Popover menu of actions anchored to a trigger element. */\n Menu: FunctionComponent<MenuProps>\n /** Overlay modal with customizable body content and footer. */\n Modal: FunctionComponent<ModalProps>\n /** Form field wrapping a typeahead `<input />` for multi-option selection. */\n MultiSelectComboBox: FunctionComponent<MultiSelectComboBoxProps>\n /** Form field wrapping a numeric `<input />` for currency, decimal, or percent values. */\n NumberInput: FunctionComponent<NumberInputProps>\n /** HTML `<ol>` for a numbered list of items. */\n OrderedList: FunctionComponent<OrderedListProps>\n /** Step-based progress indicator for multi-step flows. */\n ProgressBar: FunctionComponent<ProgressBarProps>\n /** Navigation breadcrumb trail showing the user's position in a multi-step flow. */\n Breadcrumbs: FunctionComponent<BreadcrumbsProps>\n /** Form field wrapping a single `<input type=\"radio\" />`. */\n Radio: FunctionComponent<RadioProps>\n /** Form field grouping `<input type=\"radio\" />` elements for single-option selection. */\n RadioGroup: FunctionComponent<RadioGroupProps>\n /** Form field wrapping a single-select dropdown. */\n Select: FunctionComponent<SelectProps>\n /** Form field wrapping an `<input type=\"checkbox\" />` styled as a toggle. */\n Switch: FunctionComponent<SwitchProps>\n /** Tabbed navigation with associated content panels. */\n Tabs: FunctionComponent<TabsProps>\n /** Tabular data display with headers, rows, optional footer, and empty state. */\n Table: FunctionComponent<TableProps>\n /** Body text element rendered as `<p>`, `<span>`, `<div>`, or `<pre>`. */\n Text: FunctionComponent<TextProps>\n /** Form field wrapping an `<input />`. */\n TextInput: FunctionComponent<TextInputProps>\n /** Form field wrapping a `<textarea>`. */\n TextArea: FunctionComponent<TextAreaProps>\n /** HTML `<ul>` for an unordered list of items. */\n UnorderedList: FunctionComponent<UnorderedListProps>\n\n /** Pagination controls for list views. Defaults to the SDK's built-in pagination UI when omitted. */\n PaginationControl?: FunctionComponent<PaginationControlProps>\n /** Loading indicator for payroll calculation. Defaults to the SDK's built-in loading state when omitted. */\n PayrollLoading?: FunctionComponent<PayrollLoadingProps>\n}\n\n/** @internal */\nexport const ComponentsContext = createContext<ComponentsContextType | null>(null)\n\n/** @internal */\nexport const useComponentContext = () => {\n const context = useContext(ComponentsContext)\n if (!context) {\n throw new Error('useComponentContext must be used within a ComponentsProvider')\n }\n return context\n}\n"],"names":["ComponentsContext","createContext","useComponentContext","context","useContext"],"mappings":";AAyLO,MAAMA,IAAoBC,EAA4C,IAAI,GAGpEC,IAAsB,MAAM;AACvC,QAAMC,IAAUC,EAAWJ,CAAiB;AAC5C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,8DAA8D;AAEhF,SAAOA;AACT;"}
|
|
@@ -34,5 +34,6 @@ export interface GustoProviderProps extends Omit<GustoBaseProviderProps, 'compon
|
|
|
34
34
|
* @param props - See {@link GustoProviderProps}.
|
|
35
35
|
* @returns The configured provider tree wrapping `children`.
|
|
36
36
|
* @public
|
|
37
|
+
* @group Providers
|
|
37
38
|
*/
|
|
38
39
|
export declare function GustoProvider(props: GustoProviderProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GustoProvider.js","sources":["../../../src/contexts/GustoProvider/GustoProvider.tsx"],"sourcesContent":["import type React from 'react'\n// GustoProvider uses react-aria as the default components so we need to include the react-aria I18nProvider here.\n// For use without react-aria, the GustoProviderCustomUIAdapter can be used which does not includes it.\n// eslint-disable-next-line no-restricted-imports\nimport { I18nProvider } from 'react-aria-components'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { createComponents } from '../ComponentAdapter/createComponentsWithDefaults'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport type { GustoBaseProviderProps } from './GustoProviderCustomUIAdapter'\nimport { GustoProviderCustomUIAdapter } from './GustoProviderCustomUIAdapter'\n\n/**\n * Props for {@link GustoProvider}.\n *\n * @remarks\n * Extends {@link GustoProviderProps} but makes `components` optional and partial: any components\n * you do not supply fall back to the SDK's built-in React Aria implementations.\n *\n * @public\n */\nexport interface GustoProviderProps extends Omit<GustoBaseProviderProps, 'components'> {\n /** Optional TanStack Query `QueryClient` to share with the rest of your app. When omitted, the SDK creates its own client configured for Gusto's API. */\n queryClient?: QueryClient\n /** Partial component overrides. Any component you do not supply uses the SDK's default React Aria implementation. */\n components?: Partial<ComponentsContextType>\n /** The application tree that should have access to the SDK. */\n children?: React.ReactNode\n}\n\n/**\n * Top-level provider that configures the SDK at the application level.\n *\n * @remarks\n * Wrap your application's component tree with `GustoProvider` so that any SDK component below it\n * has access to the API client, theme, locale, translations, and UI components. Components you\n * provide via the `components` prop override the SDK's React Aria defaults; any component you do\n * not supply uses the default.\n *\n * For full UI control without the bundled React Aria defaults, use {@link GustoProviderCustomUIAdapter}\n * instead and supply a complete component map.\n *\n * @param props - See {@link GustoProviderProps}.\n * @returns The configured provider tree wrapping `children`.\n * @public\n */\nexport function GustoProvider(props: GustoProviderProps) {\n const { children, components = {}, locale, queryClient, ...remainingProps } = props\n\n return (\n <GustoProviderCustomUIAdapter\n locale={locale}\n queryClient={queryClient}\n {...remainingProps}\n components={createComponents(components)}\n >\n {/* react-aria locale provider that exposes correct locale to number formatters */}\n <I18nProvider locale={locale}>{children}</I18nProvider>\n </GustoProviderCustomUIAdapter>\n )\n}\n"],"names":["GustoProvider","props","children","components","locale","queryClient","remainingProps","jsx","GustoProviderCustomUIAdapter","createComponents","I18nProvider"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"GustoProvider.js","sources":["../../../src/contexts/GustoProvider/GustoProvider.tsx"],"sourcesContent":["import type React from 'react'\n// GustoProvider uses react-aria as the default components so we need to include the react-aria I18nProvider here.\n// For use without react-aria, the GustoProviderCustomUIAdapter can be used which does not includes it.\n// eslint-disable-next-line no-restricted-imports\nimport { I18nProvider } from 'react-aria-components'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { createComponents } from '../ComponentAdapter/createComponentsWithDefaults'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport type { GustoBaseProviderProps } from './GustoProviderCustomUIAdapter'\nimport { GustoProviderCustomUIAdapter } from './GustoProviderCustomUIAdapter'\n\n/**\n * Props for {@link GustoProvider}.\n *\n * @remarks\n * Extends {@link GustoProviderProps} but makes `components` optional and partial: any components\n * you do not supply fall back to the SDK's built-in React Aria implementations.\n *\n * @public\n */\nexport interface GustoProviderProps extends Omit<GustoBaseProviderProps, 'components'> {\n /** Optional TanStack Query `QueryClient` to share with the rest of your app. When omitted, the SDK creates its own client configured for Gusto's API. */\n queryClient?: QueryClient\n /** Partial component overrides. Any component you do not supply uses the SDK's default React Aria implementation. */\n components?: Partial<ComponentsContextType>\n /** The application tree that should have access to the SDK. */\n children?: React.ReactNode\n}\n\n/**\n * Top-level provider that configures the SDK at the application level.\n *\n * @remarks\n * Wrap your application's component tree with `GustoProvider` so that any SDK component below it\n * has access to the API client, theme, locale, translations, and UI components. Components you\n * provide via the `components` prop override the SDK's React Aria defaults; any component you do\n * not supply uses the default.\n *\n * For full UI control without the bundled React Aria defaults, use {@link GustoProviderCustomUIAdapter}\n * instead and supply a complete component map.\n *\n * @param props - See {@link GustoProviderProps}.\n * @returns The configured provider tree wrapping `children`.\n * @public\n * @group Providers\n */\nexport function GustoProvider(props: GustoProviderProps) {\n const { children, components = {}, locale, queryClient, ...remainingProps } = props\n\n return (\n <GustoProviderCustomUIAdapter\n locale={locale}\n queryClient={queryClient}\n {...remainingProps}\n components={createComponents(components)}\n >\n {/* react-aria locale provider that exposes correct locale to number formatters */}\n <I18nProvider locale={locale}>{children}</I18nProvider>\n </GustoProviderCustomUIAdapter>\n )\n}\n"],"names":["GustoProvider","props","children","components","locale","queryClient","remainingProps","jsx","GustoProviderCustomUIAdapter","createComponents","I18nProvider"],"mappings":";;;;AA8CO,SAASA,EAAcC,GAA2B;AACvD,QAAM,EAAE,UAAAC,GAAU,YAAAC,IAAa,CAAA,GAAI,QAAAC,GAAQ,aAAAC,GAAa,GAAGC,EAAA,IAAmBL;AAE9E,SACE,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,QAAAJ;AAAA,MACA,aAAAC;AAAA,MACC,GAAGC;AAAA,MACJ,YAAYG,EAAiBN,CAAU;AAAA,MAGvC,UAAA,gBAAAI,EAACG,GAAA,EAAa,QAAAN,GAAiB,UAAAF,EAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAG9C;"}
|
|
@@ -70,5 +70,6 @@ export interface GustoProviderCustomUIAdapterProps extends GustoBaseProviderProp
|
|
|
70
70
|
* @param props - See {@link GustoProviderCustomUIAdapterProps}.
|
|
71
71
|
* @returns The configured provider tree wrapping `children`.
|
|
72
72
|
* @public
|
|
73
|
+
* @group Providers
|
|
73
74
|
*/
|
|
74
75
|
export declare function GustoProviderCustomUIAdapter(props: GustoProviderCustomUIAdapterProps): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport type { ErrorInfo, JSX, ReactNode } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect, useMemo } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport { ObservabilityProvider } from '../ObservabilityProvider'\nimport { sanitizeError } from '../ObservabilityProvider/sanitization'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GustoSDKTheme } from '@/contexts/ThemeProvider/theme'\nimport type { GlobalResourceDictionary, SupportedLanguages } from '@/types/Helpers'\nimport type { SDKHooks } from '@/types/hooks'\nimport type { ObservabilityHook } from '@/types/observability'\nimport { normalizeToSDKError } from '@/types/sdkError'\n\n/**\n * API client configuration passed to {@link GustoProvider} (and {@link GustoProviderCustomUIAdapter}).\n *\n * @public\n */\nexport interface APIConfig {\n /** URL of your backend proxy that forwards SDK requests to the Gusto Embedded API. SDK components never call Gusto directly. */\n baseUrl: string\n /** Extra headers applied to every API request. Combined with any headers your proxy adds. */\n headers?: HeadersInit\n /** Request interceptor hooks. Use these to inspect, modify, or react to requests and responses. See {@link SDKHooks}. */\n hooks?: SDKHooks\n /** Observability hook for surfacing errors and metrics from the SDK to your monitoring stack. See {@link ObservabilityHook}. */\n observability?: ObservabilityHook\n}\n\n/**\n * Shared configuration props accepted by {@link GustoProvider} and {@link GustoProviderCustomUIAdapter}.\n *\n * @public\n */\nexport interface GustoBaseProviderProps {\n /** API client configuration, including the proxy `baseUrl`, request hooks, and observability. See {@link APIConfig}. */\n config: APIConfig\n /** Translation overrides keyed by language and i18next namespace. Strings supplied here replace the SDK defaults for the matching keys. */\n dictionary?: GlobalResourceDictionary\n /** Active i18next language. Defaults to `'en'`. */\n lng?: string\n /** BCP 47 locale used for number, date, and currency formatting throughout the SDK. Defaults to `'en-US'`. */\n locale?: string\n /** ISO 4217 currency code used for monetary formatting. Defaults to `'USD'`. */\n currency?: string\n /** Theme overrides applied to SDK components. See {@link GustoSDKTheme}. */\n theme?: Partial<GustoSDKTheme>\n /** Element to use as the portal container for SDK popovers and dropdowns. Useful when rendering inside a modal or shadow root. */\n portalContainer?: HTMLElement\n /** Optional TanStack Query `QueryClient`. When omitted, the SDK creates its own client configured for Gusto's API. */\n queryClient?: QueryClient\n /** Complete map of UI components the SDK renders. Required because this adapter ships no defaults. */\n components: ComponentsContextType\n /** Loading indicator rendered while SDK queries are pending. Overrides the SDK default spinner. */\n LoaderComponent?: ({ children }: { children?: ReactNode }) => JSX.Element\n}\n\n/**\n * Props for {@link GustoProviderCustomUIAdapter}.\n *\n * @public\n */\nexport interface GustoProviderCustomUIAdapterProps extends GustoBaseProviderProps {\n /** The application tree that should have access to the SDK. */\n children?: React.ReactNode\n}\n\n/**\n * Top-level provider that requires a complete component map and ships no UI defaults.\n *\n * @remarks\n * Use this adapter when you want full control over every UI primitive the SDK renders, or when\n * you want to avoid the React Aria dependency for tree-shaking. Unlike {@link GustoProvider}, the\n * `components` prop on {@link GustoProviderProps} is required and must supply every component the\n * SDK renders.\n *\n * @param props - See {@link GustoProviderCustomUIAdapterProps}.\n * @returns The configured provider tree wrapping `children`.\n * @public\n */\nexport function GustoProviderCustomUIAdapter(props: GustoProviderCustomUIAdapterProps) {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n portalContainer,\n components,\n LoaderComponent,\n queryClient,\n } = props\n\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n const handleTopLevelError = useMemo(() => {\n if (!config.observability?.onError) return undefined\n\n return (error: unknown, errorInfo: ErrorInfo) => {\n if (!config.observability?.onError) return\n\n const sdkError = normalizeToSDKError(error)\n\n const observabilityError = {\n ...sdkError,\n timestamp: Date.now(),\n componentStack: errorInfo.componentStack ?? undefined,\n }\n\n const sanitizedError = sanitizeError(observabilityError, config.observability.sanitization)\n\n config.observability.onError(sanitizedError)\n }\n }, [config.observability])\n return (\n <ComponentsProvider value={components}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ObservabilityProvider observability={config.observability}>\n <ErrorBoundary FallbackComponent={InternalError} onError={handleTopLevelError}>\n <ThemeProvider theme={theme} portalContainer={portalContainer}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider\n url={config.baseUrl}\n headers={config.headers}\n hooks={config.hooks}\n queryClient={queryClient}\n >\n {children}\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </ObservabilityProvider>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n )\n}\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","portalContainer","components","LoaderComponent","queryClient","language","lang","ns","SDKI18next","useEffect","handleTopLevelError","useMemo","error","errorInfo","observabilityError","normalizeToSDKError","sanitizedError","sanitizeError","jsx","ComponentsProvider","LoadingIndicatorProvider","ObservabilityProvider","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider"],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport type { ErrorInfo, JSX, ReactNode } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect, useMemo } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport { ObservabilityProvider } from '../ObservabilityProvider'\nimport { sanitizeError } from '../ObservabilityProvider/sanitization'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GustoSDKTheme } from '@/contexts/ThemeProvider/theme'\nimport type { GlobalResourceDictionary, SupportedLanguages } from '@/types/Helpers'\nimport type { SDKHooks } from '@/types/hooks'\nimport type { ObservabilityHook } from '@/types/observability'\nimport { normalizeToSDKError } from '@/types/sdkError'\n\n/**\n * API client configuration passed to {@link GustoProvider} (and {@link GustoProviderCustomUIAdapter}).\n *\n * @public\n */\nexport interface APIConfig {\n /** URL of your backend proxy that forwards SDK requests to the Gusto Embedded API. SDK components never call Gusto directly. */\n baseUrl: string\n /** Extra headers applied to every API request. Combined with any headers your proxy adds. */\n headers?: HeadersInit\n /** Request interceptor hooks. Use these to inspect, modify, or react to requests and responses. See {@link SDKHooks}. */\n hooks?: SDKHooks\n /** Observability hook for surfacing errors and metrics from the SDK to your monitoring stack. See {@link ObservabilityHook}. */\n observability?: ObservabilityHook\n}\n\n/**\n * Shared configuration props accepted by {@link GustoProvider} and {@link GustoProviderCustomUIAdapter}.\n *\n * @public\n */\nexport interface GustoBaseProviderProps {\n /** API client configuration, including the proxy `baseUrl`, request hooks, and observability. See {@link APIConfig}. */\n config: APIConfig\n /** Translation overrides keyed by language and i18next namespace. Strings supplied here replace the SDK defaults for the matching keys. */\n dictionary?: GlobalResourceDictionary\n /** Active i18next language. Defaults to `'en'`. */\n lng?: string\n /** BCP 47 locale used for number, date, and currency formatting throughout the SDK. Defaults to `'en-US'`. */\n locale?: string\n /** ISO 4217 currency code used for monetary formatting. Defaults to `'USD'`. */\n currency?: string\n /** Theme overrides applied to SDK components. See {@link GustoSDKTheme}. */\n theme?: Partial<GustoSDKTheme>\n /** Element to use as the portal container for SDK popovers and dropdowns. Useful when rendering inside a modal or shadow root. */\n portalContainer?: HTMLElement\n /** Optional TanStack Query `QueryClient`. When omitted, the SDK creates its own client configured for Gusto's API. */\n queryClient?: QueryClient\n /** Complete map of UI components the SDK renders. Required because this adapter ships no defaults. */\n components: ComponentsContextType\n /** Loading indicator rendered while SDK queries are pending. Overrides the SDK default spinner. */\n LoaderComponent?: ({ children }: { children?: ReactNode }) => JSX.Element\n}\n\n/**\n * Props for {@link GustoProviderCustomUIAdapter}.\n *\n * @public\n */\nexport interface GustoProviderCustomUIAdapterProps extends GustoBaseProviderProps {\n /** The application tree that should have access to the SDK. */\n children?: React.ReactNode\n}\n\n/**\n * Top-level provider that requires a complete component map and ships no UI defaults.\n *\n * @remarks\n * Use this adapter when you want full control over every UI primitive the SDK renders, or when\n * you want to avoid the React Aria dependency for tree-shaking. Unlike {@link GustoProvider}, the\n * `components` prop on {@link GustoProviderProps} is required and must supply every component the\n * SDK renders.\n *\n * @param props - See {@link GustoProviderCustomUIAdapterProps}.\n * @returns The configured provider tree wrapping `children`.\n * @public\n * @group Providers\n */\nexport function GustoProviderCustomUIAdapter(props: GustoProviderCustomUIAdapterProps) {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n portalContainer,\n components,\n LoaderComponent,\n queryClient,\n } = props\n\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n const handleTopLevelError = useMemo(() => {\n if (!config.observability?.onError) return undefined\n\n return (error: unknown, errorInfo: ErrorInfo) => {\n if (!config.observability?.onError) return\n\n const sdkError = normalizeToSDKError(error)\n\n const observabilityError = {\n ...sdkError,\n timestamp: Date.now(),\n componentStack: errorInfo.componentStack ?? undefined,\n }\n\n const sanitizedError = sanitizeError(observabilityError, config.observability.sanitization)\n\n config.observability.onError(sanitizedError)\n }\n }, [config.observability])\n return (\n <ComponentsProvider value={components}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ObservabilityProvider observability={config.observability}>\n <ErrorBoundary FallbackComponent={InternalError} onError={handleTopLevelError}>\n <ThemeProvider theme={theme} portalContainer={portalContainer}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider\n url={config.baseUrl}\n headers={config.headers}\n hooks={config.hooks}\n queryClient={queryClient}\n >\n {children}\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </ObservabilityProvider>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n )\n}\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","portalContainer","components","LoaderComponent","queryClient","language","lang","ns","SDKI18next","useEffect","handleTopLevelError","useMemo","error","errorInfo","observabilityError","normalizeToSDKError","sanitizedError","sanitizeError","jsx","ComponentsProvider","LoadingIndicatorProvider","ObservabilityProvider","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider"],"mappings":";;;;;;;;;;;;;;;;AA0FO,SAASA,EAA6BC,GAA0C;AACrF,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,aAAAC;AAAA,EAAA,IACEX;AAEJ,MAAIG;AACF,eAAWS,KAAYT,GAAY;AACjC,YAAMU,IAAOD;AACb,iBAAWE,KAAMX,EAAWU,CAAI;AAC9B,QAAAE,EAAW;AAAA,UACTF;AAAA,UACAC;AAAA,UACCX,EAAWU,CAAI,EAA8BC,CAAE;AAAA,UAChD;AAAA,UACA;AAAA,QAAA;AAAA,IAGN;AAGF,EAAAE,EAAU,MAAM;AACd,KAAM,YACJ,MAAMD,EAAW,eAAeX,CAAG;AAAA,EAEvC,GAAG,CAACA,CAAG,CAAC;AAER,QAAMa,IAAsBC,EAAQ,MAAM;AACxC,QAAKhB,EAAO,eAAe;AAE3B,aAAO,CAACiB,GAAgBC,MAAyB;AAC/C,YAAI,CAAClB,EAAO,eAAe,QAAS;AAIpC,cAAMmB,IAAqB;AAAA,UACzB,GAHeC,EAAoBH,CAAK;AAAA,UAIxC,WAAW,KAAK,IAAA;AAAA,UAChB,gBAAgBC,EAAU,kBAAkB;AAAA,QAAA,GAGxCG,IAAiBC,EAAcH,GAAoBnB,EAAO,cAAc,YAAY;AAE1F,QAAAA,EAAO,cAAc,QAAQqB,CAAc;AAAA,MAC7C;AAAA,EACF,GAAG,CAACrB,EAAO,aAAa,CAAC;AACzB,SACE,gBAAAuB,EAACC,GAAA,EAAmB,OAAOjB,GACzB,UAAA,gBAAAgB,EAACE,GAAA,EAAyB,OAAOjB,GAC/B,UAAA,gBAAAe,EAACG,GAAA,EAAsB,eAAe1B,EAAO,eAC3C,UAAA,gBAAAuB,EAACI,GAAA,EAAc,mBAAmBC,GAAe,SAASb,GACxD,UAAA,gBAAAQ,EAACM,GAAA,EAAc,OAAAxB,GAAc,iBAAAC,GAC3B,UAAA,gBAAAiB,EAACO,GAAA,EAAe,QAAA3B,GAAgB,UAAAC,GAC9B,UAAA,gBAAAmB,EAACQ,GAAA,EAAgB,MAAMlB,GACrB,UAAA,gBAAAU;AAAA,IAACS;AAAA,IAAA;AAAA,MACC,KAAKhC,EAAO;AAAA,MACZ,SAASA,EAAO;AAAA,MAChB,OAAOA,EAAO;AAAA,MACd,aAAAS;AAAA,MAEC,UAAAV;AAAA,IAAA;AAAA,EAAA,KAPmCG,CASxC,GACF,GACF,EAAA,CACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Color tokens that can be overridden to customize the SDK's visual theme.
|
|
3
3
|
* Pass a `Partial<GustoSDKThemeColors>` when constructing a `Partial<GustoSDKTheme>`
|
|
4
|
-
* to supply to
|
|
4
|
+
* to supply to {@link GustoProvider}.
|
|
5
5
|
*
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
@@ -59,7 +59,7 @@ export interface GustoSDKThemeColors {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Complete set of design tokens that control the SDK's visual theme. Pass a
|
|
62
|
-
* `Partial<GustoSDKTheme>` to
|
|
62
|
+
* `Partial<GustoSDKTheme>` to {@link GustoProvider} to override specific tokens; any
|
|
63
63
|
* token not supplied falls back to the SDK default.
|
|
64
64
|
*
|
|
65
65
|
* @public
|