@gusto/embedded-react-sdk 0.49.0 → 0.50.0
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 +26 -0
- package/dist/components/Base/createCompoundContext.d.ts +1 -1
- package/dist/components/Base/createCompoundContext.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/CalendarPreview/CalendarLegend.d.ts +1 -1
- package/dist/components/Common/UI/CalendarPreview/CalendarLegend.js.map +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/signCompanyFormSchema.d.ts +1 -0
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/signCompanyFormSchema.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +8 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingFlow/OnboardingFlow.d.ts +1 -1
- package/dist/components/Company/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.d.ts +1 -0
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/contractorAddressSchema.d.ts +1 -0
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/contractorAddressSchema.js.map +1 -1
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.d.ts +38 -0
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js.map +1 -1
- package/dist/components/Contractor/Documents/DocumentsList/useContractorDocumentsList/useContractorDocumentsList.d.ts +1 -0
- package/dist/components/Contractor/Documents/DocumentsList/useContractorDocumentsList/useContractorDocumentsList.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.d.ts +3 -3
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +5 -5
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +105 -108
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.module.scss.js +8 -0
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.module.scss.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/shared/index.d.ts +2 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/fields.d.ts +93 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/fields.js +22 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/fields.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/index.d.ts +5 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountForm.d.ts +127 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountForm.js +109 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountForm.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountFormSchema.d.ts +83 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountFormSchema.js +42 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountFormSchema.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/contractorPaymentMethodSchema.d.ts +58 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/contractorPaymentMethodSchema.js +21 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/contractorPaymentMethodSchema.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/fields.d.ts +20 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/fields.js +9 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/fields.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/index.d.ts +5 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/useContractorPaymentMethodForm.d.ts +117 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/useContractorPaymentMethodForm.js +91 -0
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/useContractorPaymentMethodForm.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/types.d.ts +0 -5
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.d.ts +2 -2
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.d.ts +1 -0
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.d.ts +45 -0
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.d.ts +1 -0
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js.map +1 -1
- package/dist/components/Employee/Dashboard/DashboardFlow.d.ts +1 -1
- package/dist/components/Employee/Dashboard/DashboardFlow.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.d.ts +1 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.d.ts +1 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/signEmployeeFormSchema.d.ts +1 -0
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/signEmployeeFormSchema.js.map +1 -1
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.d.ts +2 -2
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/federalTaxesSchema.d.ts +1 -0
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/federalTaxesSchema.js.map +1 -1
- package/dist/components/Employee/OnboardingExecutionFlow/OnboardingExecutionFlow.d.ts +2 -2
- package/dist/components/Employee/OnboardingExecutionFlow/OnboardingExecutionFlow.js.map +1 -1
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.d.ts +3 -3
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.d.ts +4 -4
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankFormSchema.d.ts +1 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankFormSchema.js +7 -6
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankFormSchema.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodFormSchema.d.ts +1 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodFormSchema.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/employeeDetailsSchema.d.ts +1 -0
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/employeeDetailsSchema.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.d.ts +11 -12
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.d.ts +1 -0
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.d.ts +36 -0
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.d.ts +31 -0
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/workAddressSchema.d.ts +1 -0
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/workAddressSchema.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.d.ts +2 -2
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldProps.d.ts +36 -18
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.d.ts +113 -13
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/index.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.d.ts +2 -7
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.js.map +1 -1
- package/dist/components/Flow/Flow.js +1 -1
- package/dist/components/InformationRequests/InformationRequests.d.ts +3 -3
- package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +10 -8
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/helpers/validations.d.ts +12 -0
- package/dist/helpers/validations.js +6 -4
- package/dist/helpers/validations.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +247 -237
- package/dist/index.js.map +1 -1
- package/dist/models/external.d.ts +6 -0
- package/dist/style.css +1 -1
- package/dist/types/sdkError.js +13 -6
- package/dist/types/sdkError.js.map +1 -1
- package/package.json +7 -7
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.d.ts +0 -3
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +0 -56
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +0 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +0 -2
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +0 -33
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +0 -1
- /package/docs/{appendix → guides}/endpoint-inventory.json +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.50.0](https://github.com/Gusto/embedded-react-sdk/compare/v0.49.0...v0.50.0) (2026-07-01)
|
|
4
|
+
|
|
5
|
+
### ⚠ Breaking Changes
|
|
6
|
+
|
|
7
|
+
- **The field exports `NameField`, `RoutingNumberField`, `AccountNumberField`, `AccountTypeField`, and `ContractorPaymentMethodTypeField` have been removed** ([#2303](https://github.com/Gusto/embedded-react-sdk/issues/2303)). These fields depend on their form's context and were never functional when imported and rendered on their own, so this only affects direct imports of the symbols. Access them from the relevant hook's `form.Fields`, which wires up the required context:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
const { form } = useContractorBankAccountForm({ contractorId })
|
|
11
|
+
const { Name, RoutingNumber, AccountNumber, AccountType } = form.Fields
|
|
12
|
+
// ...render <Name />, <RoutingNumber />, etc.
|
|
13
|
+
|
|
14
|
+
const paymentMethodForm = useContractorPaymentMethodForm({ contractorId })
|
|
15
|
+
const { Type } = paymentMethodForm.form.Fields // was ContractorPaymentMethodTypeField
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Features & Enhancements
|
|
19
|
+
|
|
20
|
+
- Add `useContractorBankAccountForm` and `useContractorPaymentMethodForm` hooks for building contractor payment-method and bank-account forms, each exposing its field components on `form.Fields` ([#2301](https://github.com/Gusto/embedded-react-sdk/issues/2301), [#2302](https://github.com/Gusto/embedded-react-sdk/issues/2302))
|
|
21
|
+
- `Contractor.PaymentMethod` now composes the new payment-method and bank-account hooks ([#2303](https://github.com/Gusto/embedded-react-sdk/issues/2303))
|
|
22
|
+
- Expand const-derived reference types and export `SDKErrorCategories` ([#2320](https://github.com/Gusto/embedded-react-sdk/issues/2320))
|
|
23
|
+
|
|
24
|
+
### Chores & Maintenance
|
|
25
|
+
|
|
26
|
+
- Bump `i18next` from 26.3.3 to 26.3.4 ([#2324](https://github.com/Gusto/embedded-react-sdk/issues/2324))
|
|
27
|
+
- Bump dev dependencies (`@commitlint/cli`, `@commitlint/config-conventional`, `typescript-eslint`)
|
|
28
|
+
|
|
3
29
|
## [0.49.0](https://github.com/Gusto/embedded-react-sdk/compare/v0.48.3...v0.49.0) (2026-06-30)
|
|
4
30
|
|
|
5
31
|
### ⚠ Breaking Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
5
|
* Used to build compound components that share state between a top-level container and its
|
|
6
|
-
*
|
|
6
|
+
* blocks. The returned hook reads the context value and throws an error referencing
|
|
7
7
|
* `contextName` when no provider is mounted, eliminating the need for a null-check at each call site.
|
|
8
8
|
*
|
|
9
9
|
* @typeParam T - The shape of the context value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCompoundContext.js","sources":["../../../src/components/Base/createCompoundContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\n\n/**\n * Creates a React context paired with a hook that throws if used outside of its provider.\n *\n * @remarks\n * Used to build compound components that share state between a top-level container and its\n *
|
|
1
|
+
{"version":3,"file":"createCompoundContext.js","sources":["../../../src/components/Base/createCompoundContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\n\n/**\n * Creates a React context paired with a hook that throws if used outside of its provider.\n *\n * @remarks\n * Used to build compound components that share state between a top-level container and its\n * blocks. The returned hook reads the context value and throws an error referencing\n * `contextName` when no provider is mounted, eliminating the need for a null-check at each call site.\n *\n * @typeParam T - The shape of the context value.\n * @param contextName - Human-readable name used in the error message when the hook is called outside a provider.\n * @param defaultValue - Optional default value for the underlying context; defaults to `null`.\n * @returns A tuple of `[useContext, Provider]` where `useContext` reads the value or throws, and `Provider` is the React context provider component.\n * @internal\n */\nexport function createCompoundContext<T>(contextName: string, defaultValue: T | null = null) {\n const context = createContext(defaultValue)\n\n const useCompoundContext = () => {\n const ctx = useContext(context)\n if (!ctx) {\n throw new Error(`${contextName} must be used within its Provider.`)\n }\n return ctx\n }\n\n return [useCompoundContext, context.Provider] as const\n}\n"],"names":["createCompoundContext","contextName","defaultValue","context","createContext","ctx","useContext"],"mappings":";AAgBO,SAASA,EAAyBC,GAAqBC,IAAyB,MAAM;AAC3F,QAAMC,IAAUC,EAAcF,CAAY;AAU1C,SAAO,CARoB,MAAM;AAC/B,UAAMG,IAAMC,EAAWH,CAAO;AAC9B,QAAI,CAACE;AACH,YAAM,IAAI,MAAM,GAAGJ,CAAW,oCAAoC;AAEpE,WAAOI;AAAA,EACT,GAE4BF,EAAQ,QAAQ;AAC9C;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import h from "classnames";
|
|
3
|
-
import { Flex as u } from "../../Flex/Flex.js";
|
|
4
3
|
import { BreadcrumbsDefaults as C } from "./BreadcrumbsTypes.js";
|
|
5
4
|
import i from "./Breadcrumbs.module.scss.js";
|
|
6
5
|
import { applyMissingDefaults as x } from "../../../../helpers/applyMissingDefaults.js";
|
|
6
|
+
import { Flex as u } from "../../Flex/Flex.js";
|
|
7
7
|
function P(f) {
|
|
8
8
|
const p = x(f, C), {
|
|
9
9
|
className: s,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CalendarPreviewProps } from './CalendarPreviewTypes';
|
|
2
2
|
/**
|
|
3
|
-
* Props for the CalendarLegend
|
|
3
|
+
* Props for the CalendarLegend block rendered alongside {@link CalendarPreviewProps | CalendarPreview}.
|
|
4
4
|
*
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarLegend.js","sources":["../../../../../src/components/Common/UI/CalendarPreview/CalendarLegend.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { VisuallyHidden } from '../../VisuallyHidden'\nimport { Flex } from '../../Flex/Flex'\nimport type { CalendarPreviewProps } from './CalendarPreviewTypes'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/**\n * Props for the CalendarLegend
|
|
1
|
+
{"version":3,"file":"CalendarLegend.js","sources":["../../../../../src/components/Common/UI/CalendarPreview/CalendarLegend.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { VisuallyHidden } from '../../VisuallyHidden'\nimport { Flex } from '../../Flex/Flex'\nimport type { CalendarPreviewProps } from './CalendarPreviewTypes'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/**\n * Props for the CalendarLegend block rendered alongside {@link CalendarPreviewProps | CalendarPreview}.\n *\n * @internal\n */\nexport type CalendarLegendProps = Pick<CalendarPreviewProps, 'highlightDates' | 'dateRange'>\n\n/**\n * Renders the legend portion of a {@link CalendarPreview}, listing each highlighted date with its color and label.\n *\n * @param props - The {@link CalendarLegendProps} controlling which dates appear in the legend.\n * @returns The rendered legend element.\n * @internal\n */\nexport const CalendarLegend = ({ highlightDates }: CalendarLegendProps) => {\n const { t } = useTranslation('Company.PaySchedule')\n const { Text } = useComponentContext()\n const getFormattedLegendDate = (date: Date) => {\n // adjust for timezone offset to prevent date shifting\n const userTimezoneOffset = date.getTimezoneOffset() * 60000\n const adjustedDate = new Date(date.getTime() + userTimezoneOffset)\n\n return new Intl.DateTimeFormat(undefined, {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n }).format(adjustedDate)\n }\n\n return (\n <div className=\"react-aria-CalendarLegend\" data-testid=\"calendar-legend\">\n <VisuallyHidden>{t('labels.legend')}</VisuallyHidden>\n <Flex flexDirection=\"column\" gap={24}>\n {highlightDates?.map((highlight, index) => (\n <Flex justifyContent=\"center\" alignItems=\"center\" key={index} gap={16}>\n <div\n data-highlight={highlight.highlightColor}\n className=\"react-aria-CalendarLegendMarker\"\n data-testid=\"calendar-legend-item\"\n />\n <Flex flexDirection=\"column\" gap={0}>\n <Text className=\"react-aria-CalendarLegendText\">{highlight.label}</Text>\n <Text size=\"sm\" className=\"react-aria-CalendarLegendSubText\">\n {getFormattedLegendDate(highlight.date)}\n </Text>\n </Flex>\n </Flex>\n ))}\n </Flex>\n </div>\n )\n}\n"],"names":["CalendarLegend","highlightDates","t","useTranslation","Text","useComponentContext","getFormattedLegendDate","date","userTimezoneOffset","adjustedDate","jsxs","jsx","VisuallyHidden","Flex","highlight","index"],"mappings":";;;;;AAoBO,MAAMA,IAAiB,CAAC,EAAE,gBAAAC,QAA0C;AACzE,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5C,EAAE,MAAAC,EAAA,IAASC,EAAA,GACXC,IAAyB,CAACC,MAAe;AAE7C,UAAMC,IAAqBD,EAAK,kBAAA,IAAsB,KAChDE,IAAe,IAAI,KAAKF,EAAK,QAAA,IAAYC,CAAkB;AAEjE,WAAO,IAAI,KAAK,eAAe,QAAW;AAAA,MACxC,SAAS;AAAA,MACT,OAAO;AAAA,MACP,KAAK;AAAA,MACL,MAAM;AAAA,IAAA,CACP,EAAE,OAAOC,CAAY;AAAA,EACxB;AAEA,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAU,6BAA4B,eAAY,mBACrD,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAgB,UAAAV,EAAE,eAAe,EAAA,CAAE;AAAA,sBACnCW,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,aAAgB,IAAI,CAACC,GAAWC,wBAC9BF,GAAA,EAAK,gBAAe,UAAS,YAAW,UAAqB,KAAK,IACjE,UAAA;AAAA,MAAA,gBAAAF;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,kBAAgBG,EAAU;AAAA,UAC1B,WAAU;AAAA,UACV,eAAY;AAAA,QAAA;AAAA,MAAA;AAAA,MAEd,gBAAAJ,EAACG,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,QAAA,gBAAAF,EAACP,GAAA,EAAK,WAAU,iCAAiC,UAAAU,EAAU,OAAM;AAAA,QACjE,gBAAAH,EAACP,KAAK,MAAK,MAAK,WAAU,oCACvB,UAAAE,EAAuBQ,EAAU,IAAI,EAAA,CACxC;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,EAAA,GAXqDC,CAYvD,CACD,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -7,13 +7,13 @@ import { FileInputDefaults as K } from "./FileInputTypes.js";
|
|
|
7
7
|
import n from "./FileInput.module.scss.js";
|
|
8
8
|
import { applyMissingDefaults as L } from "../../../../helpers/applyMissingDefaults.js";
|
|
9
9
|
import { FieldLayout as O } from "../../FieldLayout/FieldLayout.js";
|
|
10
|
-
import { Flex as y } from "../../Flex/Flex.js";
|
|
11
10
|
import { ButtonIcon as R } from "../Button/ButtonIcon.js";
|
|
12
11
|
import W from "../../../../assets/icons/icon-trashcan.svg.js";
|
|
13
12
|
import Z from "../../../../assets/icons/icon-file-outline.svg.js";
|
|
14
13
|
import $ from "../../../../assets/icons/icon-file-pdf.svg.js";
|
|
15
14
|
import H from "../../../../assets/icons/icon-file-png.svg.js";
|
|
16
15
|
import V from "../../../../assets/icons/icon-file-jpg.svg.js";
|
|
16
|
+
import { Flex as y } from "../../Flex/Flex.js";
|
|
17
17
|
function Q(i) {
|
|
18
18
|
return i === "application/pdf" ? $ : i === "image/png" ? H : i === "image/jpeg" || i === "image/jpg" ? V : Z;
|
|
19
19
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import c from "classnames";
|
|
3
|
-
import
|
|
4
|
-
import p from "
|
|
3
|
+
import n from "./ProgressBar.module.scss.js";
|
|
4
|
+
import { Flex as p } from "../../Flex/Flex.js";
|
|
5
5
|
import { VisuallyHidden as d } from "../../VisuallyHidden/VisuallyHidden.js";
|
|
6
6
|
function y({
|
|
7
7
|
className: i,
|
|
@@ -13,9 +13,9 @@ function y({
|
|
|
13
13
|
const s = Math.max(1, Math.min(m, e)), l = {
|
|
14
14
|
"--g-progress-bar-width": `${s * 100 / e}%`
|
|
15
15
|
};
|
|
16
|
-
return /* @__PURE__ */ t(
|
|
16
|
+
return /* @__PURE__ */ t(p, { flexDirection: "column", children: [
|
|
17
17
|
o && /* @__PURE__ */ r(o, {}),
|
|
18
|
-
/* @__PURE__ */ r("div", { className: c(
|
|
18
|
+
/* @__PURE__ */ r("div", { className: c(n.root, i), style: l, children: /* @__PURE__ */ r(d, { children: /* @__PURE__ */ r("progress", { "aria-label": a, value: s, max: e }) }) })
|
|
19
19
|
] });
|
|
20
20
|
}
|
|
21
21
|
export {
|
|
@@ -9,12 +9,14 @@ import "@gusto/embedded-api-v-2025-11-15/models/errors/gustoembeddederror";
|
|
|
9
9
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/sdkvalidationerror";
|
|
10
10
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/unprocessableentityerror";
|
|
11
11
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
12
14
|
import "../../../../shared/constants.js";
|
|
13
15
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
16
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
17
|
+
const [u, f] = t("CreateSignatoryContext");
|
|
16
18
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
f as CreateSignatoryProvider,
|
|
20
|
+
u as useCreateSignatory
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=useCreateSignatory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateSignatory.js","sources":["../../../../../src/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api-v-2025-11-15/models/components/signatory'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\n/**\n * Initial values for the {@link CreateSignatory} form fields. At least one field must be provided.\n *\n * @public\n */\nexport type CreateSignatoryDefaultValues = RequireAtLeastOne<\n Pick<Signatory, 'firstName' | 'lastName' | 'email' | 'title' | 'phone' | 'birthday'> &\n Pick<\n NonNullable<Signatory['homeAddress']>,\n 'street1' | 'street2' | 'city' | 'state' | 'zip'\n > & {\n ssn?: string\n }\n>\ntype CreateSignatoryContextType = {\n isPending: boolean\n currentSignatory?: Signatory\n}\n\nconst [useCreateSignatory, CreateSignatoryProvider] =\n createCompoundContext<CreateSignatoryContextType>('CreateSignatoryContext')\n\nexport {\n /** @internal */\n useCreateSignatory,\n /** @internal */\n CreateSignatoryProvider,\n}\n"],"names":["useCreateSignatory","CreateSignatoryProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCreateSignatory.js","sources":["../../../../../src/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api-v-2025-11-15/models/components/signatory'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\n/**\n * Initial values for the {@link CreateSignatory} form fields. At least one field must be provided.\n *\n * @public\n */\nexport type CreateSignatoryDefaultValues = RequireAtLeastOne<\n Pick<Signatory, 'firstName' | 'lastName' | 'email' | 'title' | 'phone' | 'birthday'> &\n Pick<\n NonNullable<Signatory['homeAddress']>,\n 'street1' | 'street2' | 'city' | 'state' | 'zip'\n > & {\n ssn?: string\n }\n>\ntype CreateSignatoryContextType = {\n isPending: boolean\n currentSignatory?: Signatory\n}\n\nconst [useCreateSignatory, CreateSignatoryProvider] =\n createCompoundContext<CreateSignatoryContextType>('CreateSignatoryContext')\n\nexport {\n /** @internal */\n useCreateSignatory,\n /** @internal */\n CreateSignatoryProvider,\n}\n"],"names":["useCreateSignatory","CreateSignatoryProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAuBA,MAAM,CAACA,GAAoBC,CAAuB,IAChDC,EAAkD,wBAAwB;"}
|
|
@@ -9,12 +9,14 @@ import "@gusto/embedded-api-v-2025-11-15/models/errors/gustoembeddederror";
|
|
|
9
9
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/sdkvalidationerror";
|
|
10
10
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/unprocessableentityerror";
|
|
11
11
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
12
14
|
import "../../../../shared/constants.js";
|
|
13
15
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
16
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
17
|
+
const [d, s] = t("InviteSignatoryContext");
|
|
16
18
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
s as InviteSignatoryProvider,
|
|
20
|
+
d as useInviteSignatory
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=useInviteSignatory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInviteSignatory.js","sources":["../../../../../src/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api-v-2025-11-15/models/components/signatory'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\ntype InviteSignatoryContextType = {\n isPending: boolean\n}\n\n/**\n * Default values for the invite signatory form fields: `firstName`, `lastName`, `email`,\n * `confirmEmail`, and `title`. At least one field is required.\n *\n * @public\n */\nexport type InviteSignatoryDefaultValues = RequireAtLeastOne<\n Pick<Signatory, 'firstName' | 'lastName' | 'email' | 'title'> & {\n confirmEmail: string\n }\n>\n\nconst [useInviteSignatory, InviteSignatoryProvider] =\n createCompoundContext<InviteSignatoryContextType>('InviteSignatoryContext')\n\nexport { useInviteSignatory, InviteSignatoryProvider }\n"],"names":["useInviteSignatory","InviteSignatoryProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useInviteSignatory.js","sources":["../../../../../src/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api-v-2025-11-15/models/components/signatory'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\ntype InviteSignatoryContextType = {\n isPending: boolean\n}\n\n/**\n * Default values for the invite signatory form fields: `firstName`, `lastName`, `email`,\n * `confirmEmail`, and `title`. At least one field is required.\n *\n * @public\n */\nexport type InviteSignatoryDefaultValues = RequireAtLeastOne<\n Pick<Signatory, 'firstName' | 'lastName' | 'email' | 'title'> & {\n confirmEmail: string\n }\n>\n\nconst [useInviteSignatory, InviteSignatoryProvider] =\n createCompoundContext<InviteSignatoryContextType>('InviteSignatoryContext')\n\nexport { useInviteSignatory, InviteSignatoryProvider }\n"],"names":["useInviteSignatory","InviteSignatoryProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAM,CAACA,GAAoBC,CAAuB,IAChDC,EAAkD,wBAAwB;"}
|
|
@@ -9,16 +9,18 @@ import "@gusto/embedded-api-v-2025-11-15/models/errors/gustoembeddederror";
|
|
|
9
9
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/sdkvalidationerror";
|
|
10
10
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/unprocessableentityerror";
|
|
11
11
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
12
14
|
import "../../../shared/constants.js";
|
|
13
15
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
16
|
import { createCompoundContext as t } from "../../Base/createCompoundContext.js";
|
|
15
|
-
const
|
|
17
|
+
const x = {
|
|
16
18
|
createSignatory: "createSignatory",
|
|
17
19
|
inviteSignatory: "inviteSignatory"
|
|
18
|
-
}, [
|
|
20
|
+
}, [C, u] = t("AssignSignatoryContext");
|
|
19
21
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
u as AssignSignatoryProvider,
|
|
23
|
+
x as SignatoryAssignmentMode,
|
|
24
|
+
C as useAssignSignatory
|
|
23
25
|
};
|
|
24
26
|
//# sourceMappingURL=useAssignSignatory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssignSignatory.js","sources":["../../../../src/components/Company/AssignSignatory/useAssignSignatory.ts"],"sourcesContent":["import { type CreateSignatoryDefaultValues } from './CreateSignatory'\nimport { type InviteSignatoryDefaultValues } from './InviteSignatory'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\n/** @internal */\nexport const SignatoryAssignmentMode = {\n createSignatory: 'createSignatory',\n inviteSignatory: 'inviteSignatory',\n} as const\n\n/**\n * Default values for the create and invite forms rendered by {@link AssignSignatory}.\n *\n * @remarks\n * At least one of `create` or `invite` must be provided.\n *\n * @public\n */\nexport type AssignSignatoryDefaultValues = RequireAtLeastOne<{\n create?: CreateSignatoryDefaultValues\n invite?: InviteSignatoryDefaultValues\n}>\n\ntype AssignSignatoryContextType = {\n companyId: string\n signatoryId?: string\n defaultValues?: AssignSignatoryDefaultValues\n onSignatoryAssignmentModeChange: (mode: string) => void\n onSignatoryFormEvent: BaseComponentInterface['onEvent']\n}\n\nconst [useAssignSignatory, AssignSignatoryProvider] =\n createCompoundContext<AssignSignatoryContextType>('AssignSignatoryContext')\n\nexport { useAssignSignatory, AssignSignatoryProvider }\n"],"names":["SignatoryAssignmentMode","useAssignSignatory","AssignSignatoryProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAssignSignatory.js","sources":["../../../../src/components/Company/AssignSignatory/useAssignSignatory.ts"],"sourcesContent":["import { type CreateSignatoryDefaultValues } from './CreateSignatory'\nimport { type InviteSignatoryDefaultValues } from './InviteSignatory'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\n/** @internal */\nexport const SignatoryAssignmentMode = {\n createSignatory: 'createSignatory',\n inviteSignatory: 'inviteSignatory',\n} as const\n\n/**\n * Default values for the create and invite forms rendered by {@link AssignSignatory}.\n *\n * @remarks\n * At least one of `create` or `invite` must be provided.\n *\n * @public\n */\nexport type AssignSignatoryDefaultValues = RequireAtLeastOne<{\n create?: CreateSignatoryDefaultValues\n invite?: InviteSignatoryDefaultValues\n}>\n\ntype AssignSignatoryContextType = {\n companyId: string\n signatoryId?: string\n defaultValues?: AssignSignatoryDefaultValues\n onSignatoryAssignmentModeChange: (mode: string) => void\n onSignatoryFormEvent: BaseComponentInterface['onEvent']\n}\n\nconst [useAssignSignatory, AssignSignatoryProvider] =\n createCompoundContext<AssignSignatoryContextType>('AssignSignatoryContext')\n\nexport { useAssignSignatory, AssignSignatoryProvider }\n"],"names":["SignatoryAssignmentMode","useAssignSignatory","AssignSignatoryProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAOO,MAAMA,IAA0B;AAAA,EACrC,iBAAiB;AAAA,EACjB,iBAAiB;AACnB,GAuBM,CAACC,GAAoBC,CAAuB,IAChDC,EAAkD,wBAAwB;"}
|
|
@@ -9,12 +9,14 @@ import "@gusto/embedded-api-v-2025-11-15/models/errors/gustoembeddederror";
|
|
|
9
9
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/sdkvalidationerror";
|
|
10
10
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/unprocessableentityerror";
|
|
11
11
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
12
14
|
import "../../../../shared/constants.js";
|
|
13
15
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
16
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
17
|
+
const [s, F] = o("BankAccountContext");
|
|
16
18
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
F as BankAccountFormProvider,
|
|
20
|
+
s as useBankAccountForm
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/BankAccount/BankAccountForm/context.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\nimport { type OnEventType } from '@/components/Base/useBase'\nimport { type EventType } from '@/shared/constants'\n\ntype BankAccountFormContextType = {\n isPending: boolean\n isEditing: boolean\n onEvent: OnEventType<EventType, unknown>\n}\n\nconst [useBankAccountForm, BankAccountFormProvider] =\n createCompoundContext<BankAccountFormContextType>('BankAccountContext')\n\nexport { useBankAccountForm, BankAccountFormProvider }\n"],"names":["useBankAccountForm","BankAccountFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../src/components/Company/BankAccount/BankAccountForm/context.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\nimport { type OnEventType } from '@/components/Base/useBase'\nimport { type EventType } from '@/shared/constants'\n\ntype BankAccountFormContextType = {\n isPending: boolean\n isEditing: boolean\n onEvent: OnEventType<EventType, unknown>\n}\n\nconst [useBankAccountForm, BankAccountFormProvider] =\n createCompoundContext<BankAccountFormContextType>('BankAccountContext')\n\nexport { useBankAccountForm, BankAccountFormProvider }\n"],"names":["useBankAccountForm","BankAccountFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAoBC,CAAuB,IAChDC,EAAkD,oBAAoB;"}
|
|
@@ -9,14 +9,16 @@ import "@gusto/embedded-api-v-2025-11-15/models/errors/gustoembeddederror";
|
|
|
9
9
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/sdkvalidationerror";
|
|
10
10
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/unprocessableentityerror";
|
|
11
11
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
12
14
|
import "../../../../shared/constants.js";
|
|
13
15
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
16
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
17
|
+
const [f, v] = t(
|
|
16
18
|
"CompanyDocumentListContext"
|
|
17
19
|
);
|
|
18
20
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
v as DocumentListProvider,
|
|
22
|
+
f as useDocumentList
|
|
21
23
|
};
|
|
22
24
|
//# sourceMappingURL=useDocumentList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Company/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api-v-2025-11-15/models/components/signatory'\nimport { type Form as FormSchema } from '@gusto/embedded-api-v-2025-11-15/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n companyForms: FormSchema[]\n documentListError: Error | null\n handleRequestFormToSign: (form: FormSchema) => void\n handleChangeSignatory: () => void\n handleContinue: () => void\n isSelfSignatory: boolean\n signatory?: Signatory\n}\n\nconst [useDocumentList, DocumentListProvider] = createCompoundContext<DocumentListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Company/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import { type Signatory } from '@gusto/embedded-api-v-2025-11-15/models/components/signatory'\nimport { type Form as FormSchema } from '@gusto/embedded-api-v-2025-11-15/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n companyForms: FormSchema[]\n documentListError: Error | null\n handleRequestFormToSign: (form: FormSchema) => void\n handleChangeSignatory: () => void\n handleContinue: () => void\n isSelfSignatory: boolean\n signatory?: Signatory\n}\n\nconst [useDocumentList, DocumentListProvider] = createCompoundContext<DocumentListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAM,CAACA,GAAiBC,CAAoB,IAAIC;AAAA,EAC9C;AACF;"}
|
package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/signCompanyFormSchema.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export type SignCompanyFormField = "signature" | "confirmSignature";
|
|
|
26
26
|
* Shape of the values managed by the sign-company form.
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
|
+
* @interface
|
|
29
30
|
*/
|
|
30
31
|
export type SignCompanyFormData = { signature: string; confirmSignature: boolean; };
|
|
31
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signCompanyFormSchema.js","sources":["../../../../../../src/components/Company/DocumentSigner/shared/useSignCompanyForm/signCompanyFormSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\n/**\n * Validation error codes emitted by the sign-company-form schema. Map these\n * codes to localized copy in `validationMessages` when composing the hook.\n *\n * @public\n */\nexport const SignCompanyFormErrorCodes = {\n REQUIRED: 'REQUIRED',\n} as const\n\n/**\n * Union of validation error code strings emitted by the sign-company-form\n * schema.\n *\n * @public\n */\nexport type SignCompanyFormErrorCode =\n (typeof SignCompanyFormErrorCodes)[keyof typeof SignCompanyFormErrorCodes]\n\n// ── Field validators ───────────────────────────────────────────────────\n\nconst fieldValidators = {\n signature: z.string().min(1, { message: SignCompanyFormErrorCodes.REQUIRED }),\n confirmSignature: z.boolean().refine(val => val, {\n message: SignCompanyFormErrorCodes.REQUIRED,\n }),\n}\n\n/**\n * Field names accepted by the sign-company form.\n *\n * @public\n */\nexport type SignCompanyFormField = keyof typeof fieldValidators\n\n/**\n * Shape of the values managed by the sign-company form.\n *\n * @public\n */\nexport type SignCompanyFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\n/**\n * Shape of the validated values produced by the sign-company form on submit.\n *\n * @public\n */\nexport type SignCompanyFormOutputs = SignCompanyFormData\n\n// ── Required fields config ─────────────────────────────────────────────\n\nconst requiredFieldsConfig = {} satisfies RequiredFieldConfig<typeof fieldValidators>\n\n// ── Schema factory ─────────────────────────────────────────────────────\n\n/**\n * Optional fields that may be promoted to required for the sign-company form.\n *\n * @remarks\n * Both fields of this form are already required by default, so passing this\n * is typically unnecessary.\n *\n * @public\n */\nexport type SignCompanyFormOptionalFieldsToRequire = OptionalFieldsToRequire<\n typeof requiredFieldsConfig\n>\n\ninterface SignCompanyFormSchemaOptions {\n optionalFieldsToRequire?: SignCompanyFormOptionalFieldsToRequire\n}\n\n/** @internal */\nexport function createSignCompanyFormSchema(options: SignCompanyFormSchemaOptions = {}) {\n const { optionalFieldsToRequire } = options\n\n return buildFormSchema(fieldValidators, {\n requiredFieldsConfig,\n requiredErrorCode: SignCompanyFormErrorCodes.REQUIRED,\n mode: 'create',\n optionalFieldsToRequire,\n })\n}\n"],"names":["SignCompanyFormErrorCodes","fieldValidators","z","val","requiredFieldsConfig","createSignCompanyFormSchema","options","optionalFieldsToRequire","buildFormSchema"],"mappings":";;AAeO,MAAMA,IAA4B;AAAA,EACvC,UAAU;AACZ,GAaMC,IAAkB;AAAA,EACtB,WAAWC,EAAE,OAAA,EAAS,IAAI,GAAG,EAAE,SAASF,EAA0B,UAAU;AAAA,EAC5E,kBAAkBE,EAAE,QAAA,EAAU,OAAO,OAAOC,GAAK;AAAA,IAC/C,SAASH,EAA0B;AAAA,EAAA,CACpC;AACH,
|
|
1
|
+
{"version":3,"file":"signCompanyFormSchema.js","sources":["../../../../../../src/components/Company/DocumentSigner/shared/useSignCompanyForm/signCompanyFormSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\n/**\n * Validation error codes emitted by the sign-company-form schema. Map these\n * codes to localized copy in `validationMessages` when composing the hook.\n *\n * @public\n */\nexport const SignCompanyFormErrorCodes = {\n REQUIRED: 'REQUIRED',\n} as const\n\n/**\n * Union of validation error code strings emitted by the sign-company-form\n * schema.\n *\n * @public\n */\nexport type SignCompanyFormErrorCode =\n (typeof SignCompanyFormErrorCodes)[keyof typeof SignCompanyFormErrorCodes]\n\n// ── Field validators ───────────────────────────────────────────────────\n\nconst fieldValidators = {\n signature: z.string().min(1, { message: SignCompanyFormErrorCodes.REQUIRED }),\n confirmSignature: z.boolean().refine(val => val, {\n message: SignCompanyFormErrorCodes.REQUIRED,\n }),\n}\n\n/**\n * Field names accepted by the sign-company form.\n *\n * @public\n */\nexport type SignCompanyFormField = keyof typeof fieldValidators\n\n/**\n * Shape of the values managed by the sign-company form.\n *\n * @public\n * @interface\n */\nexport type SignCompanyFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\n/**\n * Shape of the validated values produced by the sign-company form on submit.\n *\n * @public\n */\nexport type SignCompanyFormOutputs = SignCompanyFormData\n\n// ── Required fields config ─────────────────────────────────────────────\n\nconst requiredFieldsConfig = {} satisfies RequiredFieldConfig<typeof fieldValidators>\n\n// ── Schema factory ─────────────────────────────────────────────────────\n\n/**\n * Optional fields that may be promoted to required for the sign-company form.\n *\n * @remarks\n * Both fields of this form are already required by default, so passing this\n * is typically unnecessary.\n *\n * @public\n */\nexport type SignCompanyFormOptionalFieldsToRequire = OptionalFieldsToRequire<\n typeof requiredFieldsConfig\n>\n\ninterface SignCompanyFormSchemaOptions {\n optionalFieldsToRequire?: SignCompanyFormOptionalFieldsToRequire\n}\n\n/** @internal */\nexport function createSignCompanyFormSchema(options: SignCompanyFormSchemaOptions = {}) {\n const { optionalFieldsToRequire } = options\n\n return buildFormSchema(fieldValidators, {\n requiredFieldsConfig,\n requiredErrorCode: SignCompanyFormErrorCodes.REQUIRED,\n mode: 'create',\n optionalFieldsToRequire,\n })\n}\n"],"names":["SignCompanyFormErrorCodes","fieldValidators","z","val","requiredFieldsConfig","createSignCompanyFormSchema","options","optionalFieldsToRequire","buildFormSchema"],"mappings":";;AAeO,MAAMA,IAA4B;AAAA,EACvC,UAAU;AACZ,GAaMC,IAAkB;AAAA,EACtB,WAAWC,EAAE,OAAA,EAAS,IAAI,GAAG,EAAE,SAASF,EAA0B,UAAU;AAAA,EAC5E,kBAAkBE,EAAE,QAAA,EAAU,OAAO,OAAOC,GAAK;AAAA,IAC/C,SAASH,EAA0B;AAAA,EAAA,CACpC;AACH,GA2BMI,IAAuB,CAAA;AAsBtB,SAASC,EAA4BC,IAAwC,IAAI;AACtF,QAAM,EAAE,yBAAAC,MAA4BD;AAEpC,SAAOE,EAAgBP,GAAiB;AAAA,IACtC,sBAAAG;AAAA,IACA,mBAAmBJ,EAA0B;AAAA,IAC7C,MAAM;AAAA,IACN,yBAAAO;AAAA,EAAA,CACD;AACH;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z as o } from "zod";
|
|
2
|
-
import { FilingForm as r, TaxPayerType as
|
|
2
|
+
import { FilingForm as r, TaxPayerType as t } from "@gusto/embedded-api-v-2025-11-15/models/components/federaltaxdetails";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react-error-boundary";
|
|
@@ -11,20 +11,22 @@ import "@gusto/embedded-api-v-2025-11-15/models/errors/gustoembeddederror";
|
|
|
11
11
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/sdkvalidationerror";
|
|
12
12
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/unprocessableentityerror";
|
|
13
13
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/httpclienterrors";
|
|
14
|
+
import "dompurify";
|
|
15
|
+
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
14
16
|
import "../../../shared/constants.js";
|
|
15
17
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
16
|
-
import { createCompoundContext as
|
|
17
|
-
const
|
|
18
|
+
import { createCompoundContext as e } from "../../Base/createCompoundContext.js";
|
|
19
|
+
const j = o.object({
|
|
18
20
|
federalEin: o.string().optional(),
|
|
19
|
-
taxPayerType: o.enum(Object.values(
|
|
21
|
+
taxPayerType: o.enum(Object.values(t)).optional(),
|
|
20
22
|
filingForm: o.enum(Object.values(r)).optional(),
|
|
21
23
|
legalName: o.string().min(1)
|
|
22
|
-
}), [
|
|
24
|
+
}), [v, P] = e(
|
|
23
25
|
"CompanyFederalTaxesContext"
|
|
24
26
|
);
|
|
25
27
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
j as FederalTaxFormSchema,
|
|
29
|
+
P as FederalTaxesProvider,
|
|
30
|
+
v as useFederalTaxes
|
|
29
31
|
};
|
|
30
32
|
//# sourceMappingURL=useFederalTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFederalTaxes.js","sources":["../../../../src/components/Company/FederalTaxes/useFederalTaxes.ts"],"sourcesContent":["import { z } from 'zod'\nimport type { FederalTaxDetails } from '@gusto/embedded-api-v-2025-11-15/models/components/federaltaxdetails'\nimport {\n FilingForm,\n TaxPayerType,\n} from '@gusto/embedded-api-v-2025-11-15/models/components/federaltaxdetails'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\n/** @internal */\nexport const FederalTaxFormSchema = z.object({\n federalEin: z.string().optional(),\n taxPayerType: z.enum(Object.values(TaxPayerType) as [string, ...string[]]).optional(),\n filingForm: z.enum(Object.values(FilingForm) as [string, ...string[]]).optional(),\n legalName: z.string().min(1),\n})\n\n/** @internal */\nexport type FederalTaxFormInputs = z.input<typeof FederalTaxFormSchema>\n\n/**\n * Pre-populated values for the company federal tax form, supplied via {@link FederalTaxesProps}.\n * At least one of `taxPayerType`, `filingForm`, or `legalName` must be provided.\n *\n * @public\n */\nexport type FederalTaxesDefaultValues = RequireAtLeastOne<{\n taxPayerType?: FederalTaxFormInputs['taxPayerType']\n filingForm?: FederalTaxFormInputs['filingForm']\n legalName?: FederalTaxFormInputs['legalName']\n}>\n\ntype FederalTaxesContextType = {\n isPending: boolean\n federalTaxDetails?: FederalTaxDetails\n}\n\nconst [useFederalTaxes, FederalTaxesProvider] = createCompoundContext<FederalTaxesContextType>(\n 'CompanyFederalTaxesContext',\n)\n\nexport { useFederalTaxes, FederalTaxesProvider }\n"],"names":["FederalTaxFormSchema","z","TaxPayerType","FilingForm","useFederalTaxes","FederalTaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFederalTaxes.js","sources":["../../../../src/components/Company/FederalTaxes/useFederalTaxes.ts"],"sourcesContent":["import { z } from 'zod'\nimport type { FederalTaxDetails } from '@gusto/embedded-api-v-2025-11-15/models/components/federaltaxdetails'\nimport {\n FilingForm,\n TaxPayerType,\n} from '@gusto/embedded-api-v-2025-11-15/models/components/federaltaxdetails'\nimport { createCompoundContext } from '@/components/Base'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\n\n/** @internal */\nexport const FederalTaxFormSchema = z.object({\n federalEin: z.string().optional(),\n taxPayerType: z.enum(Object.values(TaxPayerType) as [string, ...string[]]).optional(),\n filingForm: z.enum(Object.values(FilingForm) as [string, ...string[]]).optional(),\n legalName: z.string().min(1),\n})\n\n/** @internal */\nexport type FederalTaxFormInputs = z.input<typeof FederalTaxFormSchema>\n\n/**\n * Pre-populated values for the company federal tax form, supplied via {@link FederalTaxesProps}.\n * At least one of `taxPayerType`, `filingForm`, or `legalName` must be provided.\n *\n * @public\n */\nexport type FederalTaxesDefaultValues = RequireAtLeastOne<{\n taxPayerType?: FederalTaxFormInputs['taxPayerType']\n filingForm?: FederalTaxFormInputs['filingForm']\n legalName?: FederalTaxFormInputs['legalName']\n}>\n\ntype FederalTaxesContextType = {\n isPending: boolean\n federalTaxDetails?: FederalTaxDetails\n}\n\nconst [useFederalTaxes, FederalTaxesProvider] = createCompoundContext<FederalTaxesContextType>(\n 'CompanyFederalTaxesContext',\n)\n\nexport { useFederalTaxes, FederalTaxesProvider }\n"],"names":["FederalTaxFormSchema","z","TaxPayerType","FilingForm","useFederalTaxes","FederalTaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;;;AAUO,MAAMA,IAAuBC,EAAE,OAAO;AAAA,EAC3C,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,cAAcA,EAAE,KAAK,OAAO,OAAOC,CAAY,CAA0B,EAAE,SAAA;AAAA,EAC3E,YAAYD,EAAE,KAAK,OAAO,OAAOE,CAAU,CAA0B,EAAE,SAAA;AAAA,EACvE,WAAWF,EAAE,OAAA,EAAS,IAAI,CAAC;AAC7B,CAAC,GAsBK,CAACG,GAAiBC,CAAoB,IAAIC;AAAA,EAC9C;AACF;"}
|
|
@@ -9,18 +9,20 @@ import "@gusto/embedded-api-v-2025-11-15/models/errors/gustoembeddederror";
|
|
|
9
9
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/sdkvalidationerror";
|
|
10
10
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/unprocessableentityerror";
|
|
11
11
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
12
14
|
import "../../../shared/constants.js";
|
|
13
15
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
16
|
import { createCompoundContext as t } from "../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
17
|
+
const [f, v] = t("IndustryItems", {
|
|
16
18
|
items: []
|
|
17
|
-
}), [
|
|
19
|
+
}), [x, C] = t("IndustryApi", {
|
|
18
20
|
isPending: !1
|
|
19
21
|
});
|
|
20
22
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
C as IndustryApiStateProvider,
|
|
24
|
+
v as IndustryItemsProvider,
|
|
25
|
+
x as useIndustryApiState,
|
|
26
|
+
f as useIndustryItems
|
|
25
27
|
};
|
|
26
28
|
//# sourceMappingURL=Context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sources":["../../../../src/components/Company/Industry/Context.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\nimport type { ComboBoxOption } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\n\nconst [useIndustryItems, IndustryItemsProvider] = createCompoundContext('IndustryItems', {\n items: [] as ComboBoxOption[],\n})\n\nconst [useIndustryApiState, IndustryApiStateProvider] = createCompoundContext('IndustryApi', {\n isPending: false,\n})\n\nexport { IndustryApiStateProvider, IndustryItemsProvider, useIndustryItems, useIndustryApiState }\n"],"names":["useIndustryItems","IndustryItemsProvider","createCompoundContext","useIndustryApiState","IndustryApiStateProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Context.js","sources":["../../../../src/components/Company/Industry/Context.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\nimport type { ComboBoxOption } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\n\nconst [useIndustryItems, IndustryItemsProvider] = createCompoundContext('IndustryItems', {\n items: [] as ComboBoxOption[],\n})\n\nconst [useIndustryApiState, IndustryApiStateProvider] = createCompoundContext('IndustryApi', {\n isPending: false,\n})\n\nexport { IndustryApiStateProvider, IndustryItemsProvider, useIndustryItems, useIndustryApiState }\n"],"names":["useIndustryItems","IndustryItemsProvider","createCompoundContext","useIndustryApiState","IndustryApiStateProvider"],"mappings":";;;;;;;;;;;;;;;;AAGA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC,EAAsB,iBAAiB;AAAA,EACvF,OAAO,CAAA;AACT,CAAC,GAEK,CAACC,GAAqBC,CAAwB,IAAIF,EAAsB,eAAe;AAAA,EAC3F,WAAW;AACb,CAAC;"}
|
|
@@ -9,14 +9,16 @@ import "@gusto/embedded-api-v-2025-11-15/models/errors/gustoembeddederror";
|
|
|
9
9
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/sdkvalidationerror";
|
|
10
10
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/unprocessableentityerror";
|
|
11
11
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
12
14
|
import "../../../../shared/constants.js";
|
|
13
15
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
16
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
17
|
+
const [f, v] = o(
|
|
16
18
|
"CompanyDocumentFormContext"
|
|
17
19
|
);
|
|
18
20
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
v as LocationsFormProvider,
|
|
22
|
+
f as useLocationsForm
|
|
21
23
|
};
|
|
22
24
|
//# sourceMappingURL=useLocationForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocationForm.js","sources":["../../../../../src/components/Company/Locations/LocationForm/useLocationForm.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\n\ntype LocationsFormContextType = {\n isPending: boolean\n handleCancel: () => void\n}\n\nconst [useLocationsForm, LocationsFormProvider] = createCompoundContext<LocationsFormContextType>(\n 'CompanyDocumentFormContext',\n)\n\nexport { useLocationsForm, LocationsFormProvider }\n"],"names":["useLocationsForm","LocationsFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocationForm.js","sources":["../../../../../src/components/Company/Locations/LocationForm/useLocationForm.ts"],"sourcesContent":["import { createCompoundContext } from '@/components/Base'\n\ntype LocationsFormContextType = {\n isPending: boolean\n handleCancel: () => void\n}\n\nconst [useLocationsForm, LocationsFormProvider] = createCompoundContext<LocationsFormContextType>(\n 'CompanyDocumentFormContext',\n)\n\nexport { useLocationsForm, LocationsFormProvider }\n"],"names":["useLocationsForm","LocationsFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAOA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC;AAAA,EAChD;AACF;"}
|
|
@@ -9,14 +9,16 @@ import "@gusto/embedded-api-v-2025-11-15/models/errors/gustoembeddederror";
|
|
|
9
9
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/sdkvalidationerror";
|
|
10
10
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/unprocessableentityerror";
|
|
11
11
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
12
14
|
import "../../../../shared/constants.js";
|
|
13
15
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
16
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
17
|
+
const [v, y] = o(
|
|
16
18
|
"CompanyDocumentListContext"
|
|
17
19
|
);
|
|
18
20
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
y as LocationsListProvider,
|
|
22
|
+
v as useLocationsList
|
|
21
23
|
};
|
|
22
24
|
//# sourceMappingURL=useLocationsList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/useLocationsList.ts"],"sourcesContent":["import { type Location } from '@gusto/embedded-api-v-2025-11-15/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype LocationsListContextType = {\n locationList: Location[]\n totalPages: number\n totalCount: number\n currentPage: number\n itemsPerPage: PaginationItemsPerPage\n handleItemsPerPageChange: (n: PaginationItemsPerPage) => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleEditLocation: (uuid: string) => void\n handleAddLocation: () => void\n handleContinue: () => void\n}\n\nconst [useLocationsList, LocationsListProvider] = createCompoundContext<LocationsListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useLocationsList, LocationsListProvider }\n"],"names":["useLocationsList","LocationsListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/useLocationsList.ts"],"sourcesContent":["import { type Location } from '@gusto/embedded-api-v-2025-11-15/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype LocationsListContextType = {\n locationList: Location[]\n totalPages: number\n totalCount: number\n currentPage: number\n itemsPerPage: PaginationItemsPerPage\n handleItemsPerPageChange: (n: PaginationItemsPerPage) => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleEditLocation: (uuid: string) => void\n handleAddLocation: () => void\n handleContinue: () => void\n}\n\nconst [useLocationsList, LocationsListProvider] = createCompoundContext<LocationsListContextType>(\n 'CompanyDocumentListContext',\n)\n\nexport { useLocationsList, LocationsListProvider }\n"],"names":["useLocationsList","LocationsListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAM,CAACA,GAAkBC,CAAqB,IAAIC;AAAA,EAChD;AACF;"}
|
|
@@ -25,7 +25,7 @@ export type { OnboardingFlowProps, OnboardingFlowDefaultValues } from './Onboard
|
|
|
25
25
|
* Each step is also exported as a standalone block (see the Sub-components
|
|
26
26
|
* table) for composing a custom workflow when this orchestration is the wrong
|
|
27
27
|
* fit. See the
|
|
28
|
-
* {@link https://sdk.gusto.com/docs/integration-guide/composition | Composition guide}
|
|
28
|
+
* {@link https://sdk.gusto.com/docs/guides/integration-guide/composition | Composition guide}
|
|
29
29
|
* for how to recompose these blocks into your own flow.
|
|
30
30
|
*
|
|
31
31
|
* @components
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingFlow.js","sources":["../../../../src/components/Company/OnboardingFlow/OnboardingFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { onboardingMachine } from './onboardingStateMachine'\nimport type { OnboardingFlowProps } from './OnboardingFlowComponents'\nimport {\n OnboardingOverviewContextual,\n type OnboardingFlowContextInterface,\n} from './OnboardingFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\n\nexport type { OnboardingFlowProps, OnboardingFlowDefaultValues } from './OnboardingFlowComponents'\n/**\n * Guided flow to onboard a company to Gusto.\n *\n * @remarks\n * The flow begins on the overview screen and steps through locations, federal taxes, industry,\n * bank account, employee onboarding, pay schedule, state taxes, and document signing before\n * returning to the overview.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `company/overview/continue` | User chose to continue to the next outstanding onboarding requirement | — |\n * | `company/overview/done` | User signaled they are done with the overview screen | — |\n * | `company/location/done` | User completed the locations step | — |\n * | `company/federalTaxes/done` | User completed the federal taxes step | — |\n * | `company/industry/selected` | User selected and saved an industry | The saved `industry` field from the update industry selection API |\n * | `company/bankAccount/done` | User completed the bank account step | — |\n * | `employee/onboarding/done` | User completed the embedded employee onboarding sub-flow | — |\n * | `paySchedule/done` | User completed the pay schedule step | — |\n * | `company/stateTaxes/done` | User completed the state taxes step | — |\n * | `company/forms/done` | User completed signing company documents | — |\n *\n * Each step is also exported as a standalone block (see the Sub-components\n * table) for composing a custom workflow when this orchestration is the wrong\n * fit. See the\n * {@link https://sdk.gusto.com/docs/integration-guide/composition | Composition guide}\n * for how to recompose these blocks into your own flow.\n *\n * @components\n * - {@link OnboardingOverview}\n * - {@link Locations}\n * - {@link FederalTaxes}\n * - {@link Industry}\n * - {@link BankAccount}\n * - {@link EmployeeOnboarding.OnboardingFlow}\n * - {@link PaySchedule}\n * - {@link StateTaxes}\n * - {@link DocumentSigner}\n *\n * @param props - See {@link OnboardingFlowProps}.\n * @returns The multi-step company onboarding flow with internal navigation between the overview and the per-step screens.\n * @public\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { CompanyOnboarding, type EventType } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <CompanyOnboarding.OnboardingFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * onEvent={(eventType: EventType) => {\n * if (eventType === 'company/overview/done') {\n * // Onboarding complete — navigate to your next screen\n * }\n * }}\n * />\n * )\n * }\n * ```\n */\nexport const OnboardingFlow = ({ companyId, onEvent, defaultValues }: OnboardingFlowProps) => {\n const onboardingFlow = useMemo(\n () =>\n createMachine(\n 'overview',\n onboardingMachine,\n (initialContext: OnboardingFlowContextInterface) => ({\n ...initialContext,\n component: OnboardingOverviewContextual,\n companyId,\n defaultValues,\n }),\n ),\n [companyId, defaultValues],\n )\n return <Flow machine={onboardingFlow} onEvent={onEvent} />\n}\n"],"names":["OnboardingFlow","companyId","onEvent","defaultValues","onboardingFlow","useMemo","createMachine","onboardingMachine","initialContext","OnboardingOverviewContextual","jsx","Flow"],"mappings":";;;;;;AAwEO,MAAMA,IAAiB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,eAAAC,QAAyC;AAC5F,QAAMC,IAAiBC;AAAA,IACrB,MACEC;AAAA,MACE;AAAA,MACAC;AAAA,MACA,CAACC,OAAoD;AAAA,QACnD,GAAGA;AAAA,QACH,WAAWC;AAAA,QACX,WAAAR;AAAA,QACA,eAAAE;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACF,GAAWE,CAAa;AAAA,EAAA;AAE3B,SAAO,gBAAAO,EAACC,GAAA,EAAK,SAASP,GAAgB,SAAAF,EAAA,CAAkB;AAC1D;"}
|
|
1
|
+
{"version":3,"file":"OnboardingFlow.js","sources":["../../../../src/components/Company/OnboardingFlow/OnboardingFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { onboardingMachine } from './onboardingStateMachine'\nimport type { OnboardingFlowProps } from './OnboardingFlowComponents'\nimport {\n OnboardingOverviewContextual,\n type OnboardingFlowContextInterface,\n} from './OnboardingFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\n\nexport type { OnboardingFlowProps, OnboardingFlowDefaultValues } from './OnboardingFlowComponents'\n/**\n * Guided flow to onboard a company to Gusto.\n *\n * @remarks\n * The flow begins on the overview screen and steps through locations, federal taxes, industry,\n * bank account, employee onboarding, pay schedule, state taxes, and document signing before\n * returning to the overview.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `company/overview/continue` | User chose to continue to the next outstanding onboarding requirement | — |\n * | `company/overview/done` | User signaled they are done with the overview screen | — |\n * | `company/location/done` | User completed the locations step | — |\n * | `company/federalTaxes/done` | User completed the federal taxes step | — |\n * | `company/industry/selected` | User selected and saved an industry | The saved `industry` field from the update industry selection API |\n * | `company/bankAccount/done` | User completed the bank account step | — |\n * | `employee/onboarding/done` | User completed the embedded employee onboarding sub-flow | — |\n * | `paySchedule/done` | User completed the pay schedule step | — |\n * | `company/stateTaxes/done` | User completed the state taxes step | — |\n * | `company/forms/done` | User completed signing company documents | — |\n *\n * Each step is also exported as a standalone block (see the Sub-components\n * table) for composing a custom workflow when this orchestration is the wrong\n * fit. See the\n * {@link https://sdk.gusto.com/docs/guides/integration-guide/composition | Composition guide}\n * for how to recompose these blocks into your own flow.\n *\n * @components\n * - {@link OnboardingOverview}\n * - {@link Locations}\n * - {@link FederalTaxes}\n * - {@link Industry}\n * - {@link BankAccount}\n * - {@link EmployeeOnboarding.OnboardingFlow}\n * - {@link PaySchedule}\n * - {@link StateTaxes}\n * - {@link DocumentSigner}\n *\n * @param props - See {@link OnboardingFlowProps}.\n * @returns The multi-step company onboarding flow with internal navigation between the overview and the per-step screens.\n * @public\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { CompanyOnboarding, type EventType } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <CompanyOnboarding.OnboardingFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * onEvent={(eventType: EventType) => {\n * if (eventType === 'company/overview/done') {\n * // Onboarding complete — navigate to your next screen\n * }\n * }}\n * />\n * )\n * }\n * ```\n */\nexport const OnboardingFlow = ({ companyId, onEvent, defaultValues }: OnboardingFlowProps) => {\n const onboardingFlow = useMemo(\n () =>\n createMachine(\n 'overview',\n onboardingMachine,\n (initialContext: OnboardingFlowContextInterface) => ({\n ...initialContext,\n component: OnboardingOverviewContextual,\n companyId,\n defaultValues,\n }),\n ),\n [companyId, defaultValues],\n )\n return <Flow machine={onboardingFlow} onEvent={onEvent} />\n}\n"],"names":["OnboardingFlow","companyId","onEvent","defaultValues","onboardingFlow","useMemo","createMachine","onboardingMachine","initialContext","OnboardingOverviewContextual","jsx","Flow"],"mappings":";;;;;;AAwEO,MAAMA,IAAiB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,eAAAC,QAAyC;AAC5F,QAAMC,IAAiBC;AAAA,IACrB,MACEC;AAAA,MACE;AAAA,MACAC;AAAA,MACA,CAACC,OAAoD;AAAA,QACnD,GAAGA;AAAA,QACH,WAAWC;AAAA,QACX,WAAAR;AAAA,QACA,eAAAE;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACF,GAAWE,CAAa;AAAA,EAAA;AAE3B,SAAO,gBAAAO,EAACC,GAAA,EAAK,SAASP,GAAgB,SAAAF,EAAA,CAAkB;AAC1D;"}
|
|
@@ -9,12 +9,14 @@ import "@gusto/embedded-api-v-2025-11-15/models/errors/gustoembeddederror";
|
|
|
9
9
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/sdkvalidationerror";
|
|
10
10
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/unprocessableentityerror";
|
|
11
11
|
import "@gusto/embedded-api-v-2025-11-15/models/errors/httpclienterrors";
|
|
12
|
+
import "dompurify";
|
|
13
|
+
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
12
14
|
import "../../../shared/constants.js";
|
|
13
15
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
16
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
17
|
+
const [c, s] = o("OnboardingOverviewContext");
|
|
16
18
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
s as OnboardingOverviewProvider,
|
|
20
|
+
c as useOnboardingOverview
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../src/components/Company/OnboardingOverview/context.ts"],"sourcesContent":["import type { OnboardingStep } from '@gusto/embedded-api-v-2025-11-15/models/components/companyonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\n\ntype OnboardingOverviewContextType = {\n onboardingCompleted?: boolean\n onboardingSteps?: OnboardingStep[]\n handleDone: () => void\n handleContinue: () => void\n}\n\nconst [useOnboardingOverview, OnboardingOverviewProvider] =\n createCompoundContext<OnboardingOverviewContextType>('OnboardingOverviewContext')\n\nexport { useOnboardingOverview, OnboardingOverviewProvider }\n"],"names":["useOnboardingOverview","OnboardingOverviewProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../src/components/Company/OnboardingOverview/context.ts"],"sourcesContent":["import type { OnboardingStep } from '@gusto/embedded-api-v-2025-11-15/models/components/companyonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\n\ntype OnboardingOverviewContextType = {\n onboardingCompleted?: boolean\n onboardingSteps?: OnboardingStep[]\n handleDone: () => void\n handleContinue: () => void\n}\n\nconst [useOnboardingOverview, OnboardingOverviewProvider] =\n createCompoundContext<OnboardingOverviewContextType>('OnboardingOverviewContext')\n\nexport { useOnboardingOverview, OnboardingOverviewProvider }\n"],"names":["useOnboardingOverview","OnboardingOverviewProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAuBC,CAA0B,IACtDC,EAAqD,2BAA2B;"}
|
package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export type PayScheduleField = "customName" | "frequency" | "customTwicePerMonth
|
|
|
34
34
|
* Shape of the values managed by the pay schedule form.
|
|
35
35
|
*
|
|
36
36
|
* @public
|
|
37
|
+
* @interface
|
|
37
38
|
*/
|
|
38
39
|
export type PayScheduleFormData = { customName: string; frequency: "Every week" | "Every other week" | "Twice per month" | "Monthly"; customTwicePerMonth: string; anchorPayDate: string | null; anchorEndOfPayPeriod: string | null; day1: number; day2: number; };
|
|
39
40
|
/**
|
package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payScheduleSchema.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\nimport { coerceNaN, coerceToISODate } from '@/partner-hook-utils/form/preprocessors'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\n/**\n * Validation error codes emitted by {@link usePayScheduleForm} fields.\n *\n * @remarks\n * Use these as `validationMessages` keys on the corresponding `Fields.*` components.\n *\n * @public\n */\nexport const PayScheduleErrorCodes = {\n REQUIRED: 'REQUIRED',\n DAY_RANGE: 'DAY_RANGE',\n} as const\n\n/**\n * Union of validation error code strings emitted by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleErrorCode =\n (typeof PayScheduleErrorCodes)[keyof typeof PayScheduleErrorCodes]\n\n// ── Field validators ───────────────────────────────────────────────────\n\nconst FREQUENCY_VALUES = ['Every week', 'Every other week', 'Twice per month', 'Monthly'] as const\n/**\n * Pay schedule frequency values accepted by {@link usePayScheduleForm}.\n *\n * @public\n */\nexport type PayScheduleFrequency = (typeof FREQUENCY_VALUES)[number]\n\nconst fieldValidators = {\n customName: z.string(),\n frequency: z.enum(FREQUENCY_VALUES),\n customTwicePerMonth: z.string(),\n anchorPayDate: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n anchorEndOfPayPeriod: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n day1: z.preprocess(coerceNaN(0), z.number()),\n day2: z.preprocess(coerceNaN(0), z.number()),\n}\n\n/**\n * Union of field names managed by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleField = keyof typeof fieldValidators\n\n/**\n * Shape of the values managed by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\n/**\n * Shape of the validated values produced by the pay schedule form on submit.\n *\n * @public\n */\nexport type PayScheduleFormOutputs = PayScheduleFormData\n\n// ── Required fields config ─────────────────────────────────────────────\n\nfunction needsDay1(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Monthly' || (freq === 'Twice per month' && custom === 'custom')\n}\n\nfunction needsDay2(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Twice per month' && custom === 'custom'\n}\n\nconst requiredFieldsConfig = {\n customTwicePerMonth: 'never',\n day1: needsDay1,\n day2: needsDay2,\n} satisfies RequiredFieldConfig<typeof fieldValidators>\n\n/**\n * coerceNaN(0) maps empty inputs to 0, which `isEmpty` does not catch\n * (it only recognizes undefined/null/blank-string). This superRefine\n * enforces the 1–31 range when the field is applicable, which also\n * rejects the 0 sentinel from empty inputs.\n */\nfunction validateDayRanges(data: PayScheduleFormData, ctx: z.RefinementCtx) {\n if (needsDay1(data) && (data.day1 < 1 || data.day1 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day1'],\n message: data.day1 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n if (needsDay2(data) && (data.day2 < 1 || data.day2 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day2'],\n message: data.day2 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n}\n\n// ── Schema factory ─────────────────────────────────────────────────────\n\n/**\n * Configuration for promoting optional pay schedule fields to required in a given mode.\n *\n * @remarks\n * Only fields that are optional by default can be promoted. Currently\n * `customTwicePerMonth` is the only configurable field.\n *\n * @public\n */\nexport type PayScheduleOptionalFieldsToRequire = OptionalFieldsToRequire<\n typeof requiredFieldsConfig\n>\n\n/** @internal */\ninterface PayScheduleSchemaOptions {\n mode?: 'create' | 'update'\n optionalFieldsToRequire?: PayScheduleOptionalFieldsToRequire\n}\n\n/** @internal */\nexport function createPayScheduleSchema(options: PayScheduleSchemaOptions = {}) {\n const { mode = 'create', optionalFieldsToRequire } = options\n\n return buildFormSchema(fieldValidators, {\n requiredFieldsConfig,\n requiredErrorCode: PayScheduleErrorCodes.REQUIRED,\n mode,\n optionalFieldsToRequire,\n superRefine: validateDayRanges,\n })\n}\n"],"names":["PayScheduleErrorCodes","FREQUENCY_VALUES","fieldValidators","z","coerceToISODate","coerceNaN","needsDay1","data","freq","custom","needsDay2","requiredFieldsConfig","validateDayRanges","ctx","createPayScheduleSchema","options","mode","optionalFieldsToRequire","buildFormSchema"],"mappings":";;;AAkBO,MAAMA,IAAwB;AAAA,EACnC,UAAU;AAAA,EACV,WAAW;AACb,GAYMC,IAAmB,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,GAQlFC,IAAkB;AAAA,EACtB,YAAYC,EAAE,OAAA;AAAA,EACd,WAAWA,EAAE,KAAKF,CAAgB;AAAA,EAClC,qBAAqBE,EAAE,OAAA;AAAA,EACvB,eAAeA,EAAE,WAAWC,GAAiBD,EAAE,IAAI,OAAO,UAAU;AAAA,EACpE,sBAAsBA,EAAE,WAAWC,GAAiBD,EAAE,IAAI,OAAO,UAAU;AAAA,EAC3E,MAAMA,EAAE,WAAWE,EAAU,CAAC,GAAGF,EAAE,QAAQ;AAAA,EAC3C,MAAMA,EAAE,WAAWE,EAAU,CAAC,GAAGF,EAAE,QAAQ;AAC7C;
|
|
1
|
+
{"version":3,"file":"payScheduleSchema.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\nimport { coerceNaN, coerceToISODate } from '@/partner-hook-utils/form/preprocessors'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\n/**\n * Validation error codes emitted by {@link usePayScheduleForm} fields.\n *\n * @remarks\n * Use these as `validationMessages` keys on the corresponding `Fields.*` components.\n *\n * @public\n */\nexport const PayScheduleErrorCodes = {\n REQUIRED: 'REQUIRED',\n DAY_RANGE: 'DAY_RANGE',\n} as const\n\n/**\n * Union of validation error code strings emitted by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleErrorCode =\n (typeof PayScheduleErrorCodes)[keyof typeof PayScheduleErrorCodes]\n\n// ── Field validators ───────────────────────────────────────────────────\n\nconst FREQUENCY_VALUES = ['Every week', 'Every other week', 'Twice per month', 'Monthly'] as const\n/**\n * Pay schedule frequency values accepted by {@link usePayScheduleForm}.\n *\n * @public\n */\nexport type PayScheduleFrequency = (typeof FREQUENCY_VALUES)[number]\n\nconst fieldValidators = {\n customName: z.string(),\n frequency: z.enum(FREQUENCY_VALUES),\n customTwicePerMonth: z.string(),\n anchorPayDate: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n anchorEndOfPayPeriod: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n day1: z.preprocess(coerceNaN(0), z.number()),\n day2: z.preprocess(coerceNaN(0), z.number()),\n}\n\n/**\n * Union of field names managed by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleField = keyof typeof fieldValidators\n\n/**\n * Shape of the values managed by the pay schedule form.\n *\n * @public\n * @interface\n */\nexport type PayScheduleFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\n/**\n * Shape of the validated values produced by the pay schedule form on submit.\n *\n * @public\n */\nexport type PayScheduleFormOutputs = PayScheduleFormData\n\n// ── Required fields config ─────────────────────────────────────────────\n\nfunction needsDay1(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Monthly' || (freq === 'Twice per month' && custom === 'custom')\n}\n\nfunction needsDay2(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Twice per month' && custom === 'custom'\n}\n\nconst requiredFieldsConfig = {\n customTwicePerMonth: 'never',\n day1: needsDay1,\n day2: needsDay2,\n} satisfies RequiredFieldConfig<typeof fieldValidators>\n\n/**\n * coerceNaN(0) maps empty inputs to 0, which `isEmpty` does not catch\n * (it only recognizes undefined/null/blank-string). This superRefine\n * enforces the 1–31 range when the field is applicable, which also\n * rejects the 0 sentinel from empty inputs.\n */\nfunction validateDayRanges(data: PayScheduleFormData, ctx: z.RefinementCtx) {\n if (needsDay1(data) && (data.day1 < 1 || data.day1 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day1'],\n message: data.day1 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n if (needsDay2(data) && (data.day2 < 1 || data.day2 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day2'],\n message: data.day2 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n}\n\n// ── Schema factory ─────────────────────────────────────────────────────\n\n/**\n * Configuration for promoting optional pay schedule fields to required in a given mode.\n *\n * @remarks\n * Only fields that are optional by default can be promoted. Currently\n * `customTwicePerMonth` is the only configurable field.\n *\n * @public\n */\nexport type PayScheduleOptionalFieldsToRequire = OptionalFieldsToRequire<\n typeof requiredFieldsConfig\n>\n\n/** @internal */\ninterface PayScheduleSchemaOptions {\n mode?: 'create' | 'update'\n optionalFieldsToRequire?: PayScheduleOptionalFieldsToRequire\n}\n\n/** @internal */\nexport function createPayScheduleSchema(options: PayScheduleSchemaOptions = {}) {\n const { mode = 'create', optionalFieldsToRequire } = options\n\n return buildFormSchema(fieldValidators, {\n requiredFieldsConfig,\n requiredErrorCode: PayScheduleErrorCodes.REQUIRED,\n mode,\n optionalFieldsToRequire,\n superRefine: validateDayRanges,\n })\n}\n"],"names":["PayScheduleErrorCodes","FREQUENCY_VALUES","fieldValidators","z","coerceToISODate","coerceNaN","needsDay1","data","freq","custom","needsDay2","requiredFieldsConfig","validateDayRanges","ctx","createPayScheduleSchema","options","mode","optionalFieldsToRequire","buildFormSchema"],"mappings":";;;AAkBO,MAAMA,IAAwB;AAAA,EACnC,UAAU;AAAA,EACV,WAAW;AACb,GAYMC,IAAmB,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,GAQlFC,IAAkB;AAAA,EACtB,YAAYC,EAAE,OAAA;AAAA,EACd,WAAWA,EAAE,KAAKF,CAAgB;AAAA,EAClC,qBAAqBE,EAAE,OAAA;AAAA,EACvB,eAAeA,EAAE,WAAWC,GAAiBD,EAAE,IAAI,OAAO,UAAU;AAAA,EACpE,sBAAsBA,EAAE,WAAWC,GAAiBD,EAAE,IAAI,OAAO,UAAU;AAAA,EAC3E,MAAMA,EAAE,WAAWE,EAAU,CAAC,GAAGF,EAAE,QAAQ;AAAA,EAC3C,MAAMA,EAAE,WAAWE,EAAU,CAAC,GAAGF,EAAE,QAAQ;AAC7C;AA2BA,SAASG,EAAUC,GAAoC;AACrD,QAAMC,IAAOD,EAAK,WACZE,IAASF,EAAK;AACpB,SAAOC,MAAS,aAAcA,MAAS,qBAAqBC,MAAW;AACzE;AAEA,SAASC,EAAUH,GAAoC;AACrD,QAAMC,IAAOD,EAAK,WACZE,IAASF,EAAK;AACpB,SAAOC,MAAS,qBAAqBC,MAAW;AAClD;AAEA,MAAME,IAAuB;AAAA,EAC3B,qBAAqB;AAAA,EACrB,MAAML;AAAA,EACN,MAAMI;AACR;AAQA,SAASE,EAAkBL,GAA2BM,GAAsB;AAC1E,EAAIP,EAAUC,CAAI,MAAMA,EAAK,OAAO,KAAKA,EAAK,OAAO,OACnDM,EAAI,SAAS;AAAA,IACX,MAAMV,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,MAAM;AAAA,IACb,SAASI,EAAK,OAAO,IAAIP,EAAsB,WAAWA,EAAsB;AAAA,EAAA,CACjF,GAECU,EAAUH,CAAI,MAAMA,EAAK,OAAO,KAAKA,EAAK,OAAO,OACnDM,EAAI,SAAS;AAAA,IACX,MAAMV,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,MAAM;AAAA,IACb,SAASI,EAAK,OAAO,IAAIP,EAAsB,WAAWA,EAAsB;AAAA,EAAA,CACjF;AAEL;AAwBO,SAASc,EAAwBC,IAAoC,IAAI;AAC9E,QAAM,EAAE,MAAAC,IAAO,UAAU,yBAAAC,EAAA,IAA4BF;AAErD,SAAOG,EAAgBhB,GAAiB;AAAA,IACtC,sBAAAS;AAAA,IACA,mBAAmBX,EAAsB;AAAA,IACzC,MAAAgB;AAAA,IACA,yBAAAC;AAAA,IACA,aAAaL;AAAA,EAAA,CACd;AACH;"}
|