@gusto/embedded-react-sdk 0.55.0 → 0.55.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 +36 -0
- package/dist/components/Common/TaxInputs/TaxInputs.js +65 -64
- package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
- package/dist/components/Common/UI/Select/Select.module.scss.js +5 -5
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.d.ts +4 -2
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js +148 -117
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +56 -55
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.d.ts +1 -1
- package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.js +15 -12
- package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.js.map +1 -1
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.d.ts +69 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.js +48 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.js.map +1 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.d.ts +20 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.js +25 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.js.map +1 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.d.ts +20 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.js +24 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.js.map +1 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/index.d.ts +2 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js +16 -15
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +2 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +36 -23
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +10 -8
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +46 -25
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +53 -52
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +37 -47
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +47 -44
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +2 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +65 -53
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js +6 -4
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js.map +1 -1
- package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.d.ts +1 -1
- package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.js +22 -19
- package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.js.map +1 -1
- package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.d.ts +2 -8
- package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.js +43 -42
- package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.js.map +1 -1
- package/dist/components/Contractor/Payments/shared/paymentAmounts.d.ts +32 -0
- package/dist/components/Contractor/Payments/shared/paymentAmounts.js +11 -0
- package/dist/components/Contractor/Payments/shared/paymentAmounts.js.map +1 -0
- package/dist/components/Contractor/Payments/shared/paymentAmounts.test.d.ts +1 -0
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.d.ts +13 -4
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.js +43 -38
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.js.map +1 -1
- package/dist/components/Contractor/exports/contractorManagement.d.ts +1 -0
- package/dist/components/Contractor/exports/contractorManagement.js +34 -32
- package/dist/components/Contractor/exports/contractorManagement.js.map +1 -1
- package/dist/components/Contractor/shared/SelectContractors/SelectContractors.d.ts +6 -1
- package/dist/components/Contractor/shared/SelectContractors/SelectContractors.js +13 -12
- package/dist/components/Contractor/shared/SelectContractors/SelectContractors.js.map +1 -1
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.d.ts +5 -1
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js +34 -32
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +7 -0
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +191 -153
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +1 -0
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +87 -81
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +1 -0
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +73 -48
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.d.ts +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +22 -20
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +3 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +22 -20
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.d.ts +2 -0
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +34 -26
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +4 -0
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +51 -43
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.d.ts +2 -0
- package/dist/components/Payroll/PayrollList/PayrollList.js +48 -47
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +44 -43
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +7 -0
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +115 -112
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +94 -103
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +22 -16
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +58 -49
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecks.d.ts +21 -0
- package/dist/components/Payroll/PrintChecks/PrintChecks.js +68 -0
- package/dist/components/Payroll/PrintChecks/PrintChecks.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.d.ts +9 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js +34 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/index.d.ts +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksComponents.d.ts +48 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksComponents.js +26 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksComponents.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.d.ts +14 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js +47 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/index.d.ts +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.d.ts +16 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js +144 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/index.d.ts +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.d.ts +14 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js +39 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/index.d.ts +1 -0
- package/dist/components/Payroll/PrintChecks/index.d.ts +2 -0
- package/dist/components/Payroll/PrintChecks/printChecksStateMachine.d.ts +33 -0
- package/dist/components/Payroll/PrintChecks/printChecksStateMachine.js +93 -0
- package/dist/components/Payroll/PrintChecks/printChecksStateMachine.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/types.d.ts +14 -0
- package/dist/components/Payroll/index.d.ts +2 -0
- package/dist/components/Payroll/index.js +26 -24
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +6 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +36 -34
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.d.ts +22 -0
- package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.js +14 -0
- package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.js.map +1 -0
- package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.d.ts +19 -0
- package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.js +8 -0
- package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.js.map +1 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +41 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js +14 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/i18n/I18n.js +4 -0
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.CreateHistoricalPayment.json.js +34 -32
- package/dist/i18n/en/Contractor.Payments.CreateHistoricalPayment.json.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +20 -18
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +9 -9
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +38 -38
- package/dist/i18n/en/Payroll.PayrollReceipts.json.js +2 -2
- package/dist/i18n/en/Payroll.PrintChecksBanner.json.js +14 -0
- package/dist/i18n/en/Payroll.PrintChecksBanner.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PrintChecksFailure.json.js +12 -0
- package/dist/i18n/en/Payroll.PrintChecksFailure.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PrintChecksForm.json.js +28 -0
- package/dist/i18n/en/Payroll.PrintChecksForm.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PrintChecksSummary.json.js +14 -0
- package/dist/i18n/en/Payroll.PrintChecksSummary.json.js.map +1 -0
- package/dist/i18n/en/common.json.d.ts +0 -21
- package/dist/i18n/types.d.ts +75 -9
- package/dist/models/external.d.ts +3 -0
- package/dist/partner-hook-utils/form/buildFormSchema.js +60 -54
- package/dist/partner-hook-utils/form/buildFormSchema.js.map +1 -1
- package/dist/shared/constants.d.ts +30 -0
- package/dist/shared/constants.js +62 -50
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/test-utils/renderWithProviders.d.ts +4 -1
- package/dist/test-utils/tableQueries.d.ts +9 -0
- package/docs/guides/endpoint-inventory.json +33 -0
- package/package.json +18 -18
package/dist/i18n/types.d.ts
CHANGED
|
@@ -124,6 +124,10 @@ export interface Resources {
|
|
|
124
124
|
'Payroll.PayrollList': Translations.PayrollPayrollList
|
|
125
125
|
'Payroll.PayrollOverview': Translations.PayrollPayrollOverview
|
|
126
126
|
'Payroll.PayrollReceipts': Translations.PayrollPayrollReceipts
|
|
127
|
+
'Payroll.PrintChecksBanner': Translations.PayrollPrintChecksBanner
|
|
128
|
+
'Payroll.PrintChecksFailure': Translations.PayrollPrintChecksFailure
|
|
129
|
+
'Payroll.PrintChecksForm': Translations.PayrollPrintChecksForm
|
|
130
|
+
'Payroll.PrintChecksSummary': Translations.PayrollPrintChecksSummary
|
|
127
131
|
'Payroll.RecoveryCasesList': Translations.PayrollRecoveryCasesList
|
|
128
132
|
'Payroll.RecoveryCasesResubmit': Translations.PayrollRecoveryCasesResubmit
|
|
129
133
|
'Payroll.Transition': Translations.PayrollTransition
|
|
@@ -2411,6 +2415,8 @@ export namespace Translations {
|
|
|
2411
2415
|
}
|
|
2412
2416
|
/** Translation keys for the `Contractor.Payments.CreateHistoricalPayment` i18n namespace. */
|
|
2413
2417
|
export interface ContractorPaymentsCreateHistoricalPayment {
|
|
2418
|
+
/** @defaultValue `"Back"` */
|
|
2419
|
+
backButton: string
|
|
2414
2420
|
select: {
|
|
2415
2421
|
/** @defaultValue `"Record a historical payment"` */
|
|
2416
2422
|
heading: string
|
|
@@ -2526,8 +2532,6 @@ export namespace Translations {
|
|
|
2526
2532
|
title: string
|
|
2527
2533
|
/** @defaultValue `"Historical payment for {{checkDate}}"` */
|
|
2528
2534
|
subtitle: string
|
|
2529
|
-
/** @defaultValue `"Edit"` */
|
|
2530
|
-
editButton: string
|
|
2531
2535
|
/** @defaultValue `"Submit historical payment"` */
|
|
2532
2536
|
submitButton: string
|
|
2533
2537
|
/** @defaultValue `"Historical payment recorded successfully"` */
|
|
@@ -3071,6 +3075,14 @@ export namespace Translations {
|
|
|
3071
3075
|
/** @defaultValue `"Last 12 months"` */
|
|
3072
3076
|
last12Months: string
|
|
3073
3077
|
}
|
|
3078
|
+
historicalPaymentCta: {
|
|
3079
|
+
/** @defaultValue `"Record a historical payment"` */
|
|
3080
|
+
title: string
|
|
3081
|
+
/** @defaultValue `"Add a contractor payment that was made outside of Gusto to keep your records complete."` */
|
|
3082
|
+
description: string
|
|
3083
|
+
/** @defaultValue `"Record a historical payment"` */
|
|
3084
|
+
button: string
|
|
3085
|
+
}
|
|
3074
3086
|
}
|
|
3075
3087
|
/** Translation keys for the `Contractor.Profile` i18n namespace. */
|
|
3076
3088
|
export interface ContractorProfile {
|
|
@@ -7007,6 +7019,8 @@ export namespace Translations {
|
|
|
7007
7019
|
setNetEarnings: string
|
|
7008
7020
|
}
|
|
7009
7021
|
alerts: {
|
|
7022
|
+
/** @defaultValue `"This payroll is already processed. If you'd like to make changes, please cancel and re-run it."` */
|
|
7023
|
+
alreadyProcessed: string
|
|
7010
7024
|
/** @defaultValue `"Your progress has been saved"` */
|
|
7011
7025
|
progressSaved: string
|
|
7012
7026
|
/** @defaultValue `"To pay your employees with direct deposit by {{payDate}}, you'll need to run payroll by {{time}} on {{date}}."` */
|
|
@@ -7413,12 +7427,6 @@ export namespace Translations {
|
|
|
7413
7427
|
directDepositDeadline: string
|
|
7414
7428
|
/** @defaultValue `"There was an issue generating the paystub PDF. Please try again later."` */
|
|
7415
7429
|
paystubPdfError: string
|
|
7416
|
-
/** @defaultValue `"You noted {{count}} employee who should be paid by check."` */
|
|
7417
|
-
checkPaymentWarning_one: string
|
|
7418
|
-
/** @defaultValue `"You noted {{count}} employees who should be paid by check."` */
|
|
7419
|
-
checkPaymentWarning_other: string
|
|
7420
|
-
/** @defaultValue `"Employees with this payment method will need their checks delivered to them."` */
|
|
7421
|
-
checkPaymentWarningDescription: string
|
|
7422
7430
|
/** @defaultValue `"Payroll submitted"` */
|
|
7423
7431
|
payrollProcessedTitle: string
|
|
7424
7432
|
/** @defaultValue `"{{amount}} will be debited on {{date}}. Make sure you have these funds available."` */
|
|
@@ -7606,7 +7614,7 @@ export namespace Translations {
|
|
|
7606
7614
|
employeeCount_other: string
|
|
7607
7615
|
/** @defaultValue `"These amounts may not represent all monies due to government tax authorities from you, and do not include any amounts transmitted outside the platform."` */
|
|
7608
7616
|
disclaimer: string
|
|
7609
|
-
/** @defaultValue `"Your payroll provider partners with Gusto Inc. for payments processing. Gusto Inc. is a licensed money transmitter. Learn more on our license page
|
|
7617
|
+
/** @defaultValue `"Your payroll provider partners with Gusto Inc. for payments processing. Gusto Inc. is a licensed money transmitter. Learn more on our <licensesLink>license page</licensesLink>."` */
|
|
7610
7618
|
companyInfo: string
|
|
7611
7619
|
/** @defaultValue `"525 20th St, San Francisco, CA 94107 | 415-777-8888"` */
|
|
7612
7620
|
address: string
|
|
@@ -7662,6 +7670,64 @@ export namespace Translations {
|
|
|
7662
7670
|
totalEmployees_other: string
|
|
7663
7671
|
}
|
|
7664
7672
|
}
|
|
7673
|
+
/** Translation keys for the `Payroll.PrintChecksBanner` i18n namespace. */
|
|
7674
|
+
export interface PayrollPrintChecksBanner {
|
|
7675
|
+
/** @defaultValue `"You noted {{count}} employee that should be paid by check."` */
|
|
7676
|
+
title_one: string
|
|
7677
|
+
/** @defaultValue `"You noted {{count}} employees that should be paid by check."` */
|
|
7678
|
+
title_other: string
|
|
7679
|
+
/** @defaultValue `"Employees with this payment method will need their checks delivered to them. If you aren't using your own checks, you can view and print checks."` */
|
|
7680
|
+
description: string
|
|
7681
|
+
/** @defaultValue `"View and print checks"` */
|
|
7682
|
+
cta: string
|
|
7683
|
+
}
|
|
7684
|
+
/** Translation keys for the `Payroll.PrintChecksFailure` i18n namespace. */
|
|
7685
|
+
export interface PayrollPrintChecksFailure {
|
|
7686
|
+
/** @defaultValue `"We couldn't generate your checks"` */
|
|
7687
|
+
failedTitle: string
|
|
7688
|
+
/** @defaultValue `"Try again"` */
|
|
7689
|
+
retryCta: string
|
|
7690
|
+
/** @defaultValue `"Close"` */
|
|
7691
|
+
closeCta: string
|
|
7692
|
+
}
|
|
7693
|
+
/** Translation keys for the `Payroll.PrintChecksForm` i18n namespace. */
|
|
7694
|
+
export interface PayrollPrintChecksForm {
|
|
7695
|
+
/** @defaultValue `"Choose check stock"` */
|
|
7696
|
+
modalTitle: string
|
|
7697
|
+
/** @defaultValue `"Custom check stock"` */
|
|
7698
|
+
customStockLabel: string
|
|
7699
|
+
/** @defaultValue `"Use this check stock if you have check stock that is pre-printed with your company and bank information. The physical check will appear on the top of the check PDF. Check numbers should already be pre-printed on the check stock you purchased."` */
|
|
7700
|
+
customStockDescription: string
|
|
7701
|
+
/** @defaultValue `"Blank check stock"` */
|
|
7702
|
+
blankStockLabel: string
|
|
7703
|
+
/** @defaultValue `"Use this check stock if you have blank check stock and need us to populate your company and bank information. The physical check will always be on the bottom of the check PDF."` */
|
|
7704
|
+
blankStockDescription: string
|
|
7705
|
+
/** @defaultValue `"Check number starts with"` */
|
|
7706
|
+
startingCheckNumberLabel: string
|
|
7707
|
+
/** @defaultValue `"This will be the first check number, all other checks will follow sequentially."` */
|
|
7708
|
+
startingCheckNumberDescription: string
|
|
7709
|
+
/** @defaultValue `"Cancel"` */
|
|
7710
|
+
cancelCta: string
|
|
7711
|
+
/** @defaultValue `"View checks"` */
|
|
7712
|
+
submitCta: string
|
|
7713
|
+
/** @defaultValue `"Generating..."` */
|
|
7714
|
+
submitCtaLoading: string
|
|
7715
|
+
validations: {
|
|
7716
|
+
/** @defaultValue `"Enter a valid check number"` */
|
|
7717
|
+
startingCheckNumber: string
|
|
7718
|
+
}
|
|
7719
|
+
}
|
|
7720
|
+
/** Translation keys for the `Payroll.PrintChecksSummary` i18n namespace. */
|
|
7721
|
+
export interface PayrollPrintChecksSummary {
|
|
7722
|
+
/** @defaultValue `"Your checks are ready"` */
|
|
7723
|
+
succeededTitle: string
|
|
7724
|
+
/** @defaultValue `"The download should have started automatically. If not, use the link below."` */
|
|
7725
|
+
succeededDescription: string
|
|
7726
|
+
/** @defaultValue `"View checks"` */
|
|
7727
|
+
viewChecksCta: string
|
|
7728
|
+
/** @defaultValue `"Close"` */
|
|
7729
|
+
closeCta: string
|
|
7730
|
+
}
|
|
7665
7731
|
/** Translation keys for the `Payroll.RecoveryCasesList` i18n namespace. */
|
|
7666
7732
|
export interface PayrollRecoveryCasesList {
|
|
7667
7733
|
/** @defaultValue `"Recovery cases"` */
|
|
@@ -140,6 +140,7 @@ export { GarnishmentType } from '@gusto/embedded-api/models/components/garnishme
|
|
|
140
140
|
export type { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
|
|
141
141
|
export type { GarnishmentChildSupport } from '@gusto/embedded-api/models/components/garnishmentchildsupport';
|
|
142
142
|
export { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport';
|
|
143
|
+
export { GeneratedDocumentStatus } from '@gusto/embedded-api/models/components/generateddocument';
|
|
143
144
|
/** `ChristmasDay` entity from the Gusto Embedded API. */
|
|
144
145
|
export type { ChristmasDay } from '@gusto/embedded-api/models/components/holidaypaypolicy';
|
|
145
146
|
/** `ColumbusDay` entity from the Gusto Embedded API. */
|
|
@@ -290,6 +291,8 @@ export type { PayScheduleAutoPayrollEnablementBlocker, PayScheduleAutoPayrollEna
|
|
|
290
291
|
export { PayScheduleFrequency } from '@gusto/embedded-api/models/components/payschedulefrequency';
|
|
291
292
|
export type { PaySchedulePreviewPayPeriod } from '@gusto/embedded-api/models/components/payschedulepreviewpayperiod';
|
|
292
293
|
export type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow';
|
|
294
|
+
export type { PrintablePayrollChecksBody } from '@gusto/embedded-api/models/components/printablepayrollchecksbody';
|
|
295
|
+
export { PrintingFormat } from '@gusto/embedded-api/models/components/printablepayrollchecksbody';
|
|
293
296
|
export type { RecoveryCase } from '@gusto/embedded-api/models/components/recoverycase';
|
|
294
297
|
export { RecoveryCaseStatus } from '@gusto/embedded-api/models/components/recoverycase';
|
|
295
298
|
/** `IdentityVerificationStatus` entity from the Gusto Embedded API. */
|
|
@@ -1,95 +1,101 @@
|
|
|
1
|
-
import { z as
|
|
2
|
-
function
|
|
1
|
+
import { z as y } from "zod";
|
|
2
|
+
function I(r, n) {
|
|
3
3
|
const {
|
|
4
|
-
mode:
|
|
5
|
-
requiredFieldsConfig:
|
|
4
|
+
mode: s,
|
|
5
|
+
requiredFieldsConfig: d = {},
|
|
6
6
|
requiredErrorCode: c = "REQUIRED",
|
|
7
7
|
excludeFields: a = []
|
|
8
|
-
} =
|
|
9
|
-
|
|
10
|
-
), g = {}, f = [], q = [], w =
|
|
11
|
-
for (const [
|
|
12
|
-
if (p.has(
|
|
13
|
-
q.push(
|
|
14
|
-
const t = w[
|
|
15
|
-
if (g[
|
|
16
|
-
const o = R.has(
|
|
8
|
+
} = n, u = typeof a == "function" ? a : void 0, p = new Set((Array.isArray(a) ? a : []).map(String)), m = new Set((n.fieldsWithRedactedValues ?? []).map(String)), R = new Set(
|
|
9
|
+
P(n.optionalFieldsToRequire, s)
|
|
10
|
+
), g = {}, f = [], q = [], w = d;
|
|
11
|
+
for (const [e, i] of Object.entries(r)) {
|
|
12
|
+
if (p.has(e)) continue;
|
|
13
|
+
q.push(e);
|
|
14
|
+
const t = w[e] ?? "always";
|
|
15
|
+
if (g[e] = j(i), !m.has(e)) {
|
|
16
|
+
const o = R.has(e);
|
|
17
17
|
typeof t == "function" ? f.push({
|
|
18
|
-
name:
|
|
18
|
+
name: e,
|
|
19
19
|
predicate: o ? () => !0 : t
|
|
20
|
-
}) : (t === "always" || t ===
|
|
20
|
+
}) : (t === "always" || t === s || o) && f.push({ name: e, predicate: () => !0 });
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
const x = f.length > 0 || n.superRefine, S = y.object(g);
|
|
24
|
+
let h = u ? y.preprocess((e) => {
|
|
25
|
+
if (typeof e != "object" || e === null) return e;
|
|
26
|
+
const i = { ...e };
|
|
27
|
+
for (const t of u(i, s))
|
|
28
|
+
i[t] = void 0;
|
|
29
|
+
return i;
|
|
30
|
+
}, S) : S;
|
|
31
|
+
x && (h = h.superRefine(
|
|
32
|
+
(e, i) => {
|
|
33
|
+
const t = e, o = u ? new Set(u(t, s).map(String)) : void 0;
|
|
34
|
+
for (const { name: l, predicate: N } of f)
|
|
35
|
+
o?.has(l) || N(e, s) && F(e[l]) && i.addIssue({
|
|
36
|
+
code: y.ZodIssueCode.custom,
|
|
31
37
|
path: [l],
|
|
32
38
|
message: c
|
|
33
39
|
});
|
|
34
|
-
|
|
40
|
+
n.superRefine?.(t, i);
|
|
35
41
|
}
|
|
36
42
|
));
|
|
37
|
-
const
|
|
38
|
-
function
|
|
39
|
-
const
|
|
43
|
+
const b = C(f, s);
|
|
44
|
+
function E(e) {
|
|
45
|
+
const i = {};
|
|
40
46
|
for (const t of q) {
|
|
41
47
|
const o = w[t] ?? "always";
|
|
42
|
-
R.has(t) ?
|
|
48
|
+
R.has(t) ? i[t] = { name: t, isRequired: !0 } : typeof o == "function" ? i[t] = { name: t, isRequired: e ? o(e, s) : !1 } : i[t] = {
|
|
43
49
|
name: t,
|
|
44
|
-
isRequired: o === "always" || o ===
|
|
45
|
-
}, m.has(t) && (
|
|
50
|
+
isRequired: o === "always" || o === s
|
|
51
|
+
}, m.has(t) && (i[t].hasRedactedValue = !0);
|
|
46
52
|
}
|
|
47
|
-
return
|
|
53
|
+
return i;
|
|
48
54
|
}
|
|
49
55
|
return [
|
|
50
|
-
|
|
51
|
-
{ getFieldsMetadata:
|
|
56
|
+
h,
|
|
57
|
+
{ getFieldsMetadata: E, predicateDeps: b }
|
|
52
58
|
];
|
|
53
59
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
60
|
+
function P(r, n) {
|
|
61
|
+
return r ? (n === "create" ? r.create : r.update) ?? [] : [];
|
|
56
62
|
}
|
|
57
|
-
function
|
|
58
|
-
return
|
|
63
|
+
function j(r) {
|
|
64
|
+
return y.preprocess((n) => F(n) ? void 0 : n, r.optional());
|
|
59
65
|
}
|
|
60
|
-
function
|
|
61
|
-
return !!(
|
|
66
|
+
function F(r) {
|
|
67
|
+
return !!(r == null || typeof r == "string" && r.trim() === "" || typeof r == "number" && Number.isNaN(r));
|
|
62
68
|
}
|
|
63
|
-
function C(
|
|
64
|
-
const
|
|
65
|
-
for (const { predicate:
|
|
66
|
-
if (D(
|
|
69
|
+
function C(r, n) {
|
|
70
|
+
const s = /* @__PURE__ */ new Set();
|
|
71
|
+
for (const { predicate: d } of r) {
|
|
72
|
+
if (D(d)) continue;
|
|
67
73
|
const c = [], a = new Proxy({}, {
|
|
68
|
-
get(
|
|
74
|
+
get(u, p) {
|
|
69
75
|
typeof p == "string" && c.push(p);
|
|
70
76
|
}
|
|
71
77
|
});
|
|
72
78
|
try {
|
|
73
|
-
|
|
79
|
+
d(a, n);
|
|
74
80
|
} catch {
|
|
75
81
|
}
|
|
76
|
-
for (const
|
|
82
|
+
for (const u of c) s.add(u);
|
|
77
83
|
}
|
|
78
|
-
return [...
|
|
84
|
+
return [...s];
|
|
79
85
|
}
|
|
80
|
-
function D(
|
|
81
|
-
const
|
|
82
|
-
get(
|
|
83
|
-
typeof c == "string" &&
|
|
86
|
+
function D(r) {
|
|
87
|
+
const n = [], s = new Proxy({}, {
|
|
88
|
+
get(d, c) {
|
|
89
|
+
typeof c == "string" && n.push(c);
|
|
84
90
|
}
|
|
85
91
|
});
|
|
86
92
|
try {
|
|
87
|
-
|
|
93
|
+
r(s, "create");
|
|
88
94
|
} catch {
|
|
89
95
|
}
|
|
90
|
-
return
|
|
96
|
+
return n.length === 0;
|
|
91
97
|
}
|
|
92
98
|
export {
|
|
93
|
-
|
|
99
|
+
I as buildFormSchema
|
|
94
100
|
};
|
|
95
101
|
//# sourceMappingURL=buildFormSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFormSchema.js","sources":["../../../src/partner-hook-utils/form/buildFormSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport type { FieldMetadata } from '../types'\n\n// ── Types ────────────────────────────────────────────────────────────\n\n/**\n * Form lifecycle mode used to vary requiredness and validation rules.\n *\n * @internal\n */\ntype FormMode = 'create' | 'update'\n\n/**\n * Per-field requiredness rule.\n *\n * String values apply requiredness in a fixed mode (`'always'`, `'create'`,\n * `'update'`, or `'never'`). A function form receives the current form data\n * and mode so requiredness can depend on other field values at runtime.\n *\n * @typeParam TData - The shape of the form data passed to predicate rules.\n * @internal\n */\ntype RequiredFieldRule<TData = Record<string, unknown>> =\n 'create' | 'update' | 'always' | 'never' | ((data: TData, mode: FormMode) => boolean)\n\n/**\n * Mapping from each field name in a schema to its {@link RequiredFieldRule}.\n *\n * @typeParam TSchema - The map of field names to their Zod validators.\n * @internal\n */\nexport type RequiredFieldConfig<TSchema extends Record<string, z.ZodType>> = Partial<{\n [K in keyof TSchema & string]: RequiredFieldRule<{\n [F in keyof TSchema]: z.infer<TSchema[F]>\n }>\n}>\n\n/**\n * A predicate (value-conditional) requiredness rule. Matches any function\n * signature so predicate rules are recognized regardless of their parameter or\n * return types. Such fields are never statically required in a given mode, so\n * they're eligible for promotion — see {@link OptionalOnCreate}.\n */\ntype PredicateRule = (...args: never[]) => unknown\n\n/**\n * Union of field names in `TConfig` that are not statically required in create\n * mode and are therefore eligible to be promoted to required in create mode:\n * fields whose base rule is `'update'`, `'never'`, or a predicate. Promoting a\n * predicate field upgrades it from conditionally required to always required.\n *\n * The template-literal wrapper \\`\\` `${...}` \\`\\` is intentional: wrapping a\n * conditional-mapped-type index access in a template literal forces TypeScript\n * to eagerly evaluate and materialize the string union rather than deferring\n * it. Without the wrapper, TypeScript preserves the alias name in hover\n * tooltips and generated docs (`OptionalOnCreate<{ ... }>`), making the type\n * opaque to callers. With it, both IntelliSense and TypeDoc display the\n * resolved concrete union (e.g. `\"stateWcCovered\" | \"twoPercentShareholder\"`).\n */\ntype OptionalOnCreate<TConfig> = `${{\n [K in keyof TConfig & string]: TConfig[K] extends 'update' | 'never' | PredicateRule ? K : never\n}[keyof TConfig & string]}`\n\n/**\n * Union of field names in `TConfig` that are not statically required in update\n * mode and are therefore eligible to be promoted to required in update mode:\n * fields whose base rule is `'create'`, `'never'`, or a predicate.\n *\n * See {@link OptionalOnCreate} for why the template-literal wrapper is here.\n */\ntype OptionalOnUpdate<TConfig> = `${{\n [K in keyof TConfig & string]: TConfig[K] extends 'create' | 'never' | PredicateRule ? K : never\n}[keyof TConfig & string]}`\n\n/**\n * Per-mode list of optional fields a caller can promote to required.\n *\n * Only fields whose base rule allows the override appear in the `create` /\n * `update` arrays — fields that are already required in a given mode are\n * excluded from that mode's list at the type level. Value-conditional\n * (predicate) fields are eligible in both modes; listing one promotes it from\n * conditionally required to always required for that mode.\n *\n * @typeParam TConfig - The {@link RequiredFieldConfig} that constrains which fields are eligible.\n * @internal\n * @interface\n */\nexport type OptionalFieldsToRequire<TConfig> = {\n /** Fields that can be required in create mode */\n create?: Array<OptionalOnCreate<TConfig>>\n /** Fields that can be required in update mode */\n update?: Array<OptionalOnUpdate<TConfig>>\n}\n\n// ── buildFormSchema ──────────────────────────────────────────────────\n\ninterface BuildFormSchemaOptions<\n T extends Record<string, z.ZodType>,\n TConfig extends RequiredFieldConfig<T>,\n> {\n requiredFieldsConfig?: TConfig\n requiredErrorCode?: string\n mode: FormMode\n optionalFieldsToRequire?: OptionalFieldsToRequire<TConfig>\n /**\n * Fields that don't apply and should be dropped from required validation.\n *\n * An **array** removes the fields at build time — they're absent from the\n * schema shape entirely (use when applicability is fixed by a config flag).\n *\n * A **function** is evaluated against the values under validation, so a field\n * can flip in/out of applicability as other values change. The field stays in\n * the schema (validated as optional) but its required check is skipped while\n * the function reports it as excluded.\n */\n excludeFields?:\n | Array<keyof T & string>\n | ((data: { [K in keyof T]: z.infer<T[K]> }, mode: FormMode) => Array<keyof T & string>)\n /** Fields with existing server-side values that are redacted in the API response\n * (e.g. SSN, EIN). These fields remain in the schema for format validation and\n * appear in metadata (with `hasRedactedValue: true`) but are exempt from required\n * validation — an empty submission is valid because a value already exists. */\n fieldsWithRedactedValues?: Array<keyof T & string>\n superRefine?: (data: { [K in keyof T]: z.infer<T[K]> }, ctx: z.RefinementCtx) => void\n}\n\n/**\n * Companion config returned alongside a built schema, used to derive per-field\n * metadata and to identify which form values predicate-based rules depend on.\n *\n * @typeParam T - The map of field names to their Zod validators.\n * @internal\n */\nexport interface FieldsMetadataConfig<T extends Record<string, z.ZodType>> {\n getFieldsMetadata: (data?: Record<string, unknown>) => Record<keyof T, FieldMetadata>\n /** Form field names that predicate-based requiredness rules read at runtime. */\n predicateDeps: string[]\n}\n\ntype FormDataFromValidators<T extends Record<string, z.ZodType>> = {\n [K in keyof T]: z.infer<T[K]>\n}\n\n/**\n * Tuple returned by {@link buildFormSchema}: the composed Zod schema followed\n * by its {@link FieldsMetadataConfig}.\n *\n * @typeParam T - The map of field names to their Zod validators.\n * @internal\n */\nexport type BuildFormSchemaResult<T extends Record<string, z.ZodType>> = [\n schema: z.ZodType<FormDataFromValidators<T>, FormDataFromValidators<T>>,\n metadataConfig: FieldsMetadataConfig<T>,\n]\n\n/**\n * Composes a Zod object schema and matching metadata config from a map of\n * per-field validators, applying mode-aware requiredness rules.\n *\n * @remarks\n * Every field is wrapped to coerce empty strings, `null`, `undefined`, and\n * `NaN` to `undefined` before validation, so blank inputs surface as missing\n * rather than as type-mismatch errors. Required-field checks run in a\n * `superRefine` pass that emits an issue keyed by `requiredErrorCode` (defaults\n * to `REQUIRED`) for each unfilled required field.\n *\n * Fields listed in `fieldsWithRedactedValues` remain in the schema for format\n * validation and appear in metadata with `hasRedactedValue: true`, but are\n * exempt from required-field validation because a server-side value already\n * exists.\n *\n * @typeParam T - The map of field names to their Zod validators.\n * @typeParam TConfig - The shape of the requiredness configuration.\n * @param fieldValidators - Map from field name to the validator that runs when a value is present.\n * @param options - Mode, required-field config, redaction list, and optional `superRefine`.\n * @returns A {@link BuildFormSchemaResult} tuple: the schema and its metadata config.\n * @internal\n */\nexport function buildFormSchema<\n T extends Record<string, z.ZodType>,\n TConfig extends RequiredFieldConfig<T>,\n>(fieldValidators: T, options: BuildFormSchemaOptions<T, TConfig>): BuildFormSchemaResult<T> {\n const {\n mode,\n requiredFieldsConfig = {} as Record<string, RequiredFieldRule>,\n requiredErrorCode = 'REQUIRED',\n excludeFields = [],\n } = options\n // The array form removes fields at build time; the function form is resolved\n // per-validation in the superRefine pass below.\n const excludeFieldsFn = typeof excludeFields === 'function' ? excludeFields : undefined\n const staticExcluded = new Set((Array.isArray(excludeFields) ? excludeFields : []).map(String))\n const redacted = new Set((options.fieldsWithRedactedValues ?? []).map(String))\n const partnerRequired = new Set(\n resolveOptionalFieldsToRequire(options.optionalFieldsToRequire, mode),\n )\n\n const shape: Record<string, z.ZodType> = {}\n const dynamicRequired: Array<{\n name: string\n predicate: (data: Record<string, unknown>, mode: FormMode) => boolean\n }> = []\n const includedFieldNames: string[] = []\n const config = requiredFieldsConfig as Record<string, RequiredFieldRule>\n\n for (const [name, validator] of Object.entries(fieldValidators)) {\n if (staticExcluded.has(name)) continue\n includedFieldNames.push(name)\n\n const effectiveRule = config[name] ?? 'always'\n\n shape[name] = makeOptional(validator)\n\n if (!redacted.has(name)) {\n const isPartnerRequired = partnerRequired.has(name)\n\n if (typeof effectiveRule === 'function') {\n dynamicRequired.push({\n name,\n predicate: isPartnerRequired ? () => true : effectiveRule,\n })\n } else {\n const isRequired = effectiveRule === 'always' || effectiveRule === mode || isPartnerRequired\n if (isRequired) {\n dynamicRequired.push({ name, predicate: () => true })\n }\n }\n }\n }\n\n const hasSuperRefine = dynamicRequired.length > 0 || options.superRefine\n let schema: z.ZodType = z.object(shape)\n\n if (hasSuperRefine) {\n schema = (schema as z.ZodObject).superRefine(\n (data: Record<string, unknown>, ctx: z.RefinementCtx) => {\n const typedData = data as FormDataFromValidators<T>\n const excludedNow = excludeFieldsFn\n ? new Set(excludeFieldsFn(typedData, mode).map(String))\n : undefined\n\n for (const { name, predicate } of dynamicRequired) {\n if (excludedNow?.has(name)) continue\n if (predicate(data, mode) && isEmpty(data[name])) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [name],\n message: requiredErrorCode,\n })\n }\n }\n\n options.superRefine?.(typedData, ctx)\n },\n )\n }\n\n const predicateDeps = detectPredicateDeps(dynamicRequired, mode)\n\n function getFieldsMetadata(data?: Record<string, unknown>) {\n const metadata: Record<string, FieldMetadata> = {}\n\n for (const name of includedFieldNames) {\n const effectiveRule = config[name] ?? 'always'\n\n if (partnerRequired.has(name)) {\n metadata[name] = { name, isRequired: true }\n } else if (typeof effectiveRule === 'function') {\n metadata[name] = { name, isRequired: data ? effectiveRule(data, mode) : false }\n } else {\n metadata[name] = {\n name,\n isRequired: effectiveRule === 'always' || effectiveRule === mode,\n }\n }\n\n if (redacted.has(name)) {\n metadata[name].hasRedactedValue = true\n }\n }\n\n return metadata as Record<keyof T, FieldMetadata>\n }\n\n // makeOptional wraps fields with z.preprocess, which causes z.input to infer\n // `unknown`. Cast the schema to carry the original field types so zodResolver\n // infers correct form data types — consumers don't need per-hook casts.\n return [\n schema as z.ZodType<FormDataFromValidators<T>, FormDataFromValidators<T>>,\n { getFieldsMetadata, predicateDeps },\n ]\n}\n\n// ── Internal helpers ─────────────────────────────────────────────────\n\nfunction resolveOptionalFieldsToRequire<TConfig>(\n value: OptionalFieldsToRequire<TConfig> | undefined,\n mode: FormMode,\n): string[] {\n if (!value) return []\n return ((mode === 'create' ? value.create : value.update) ?? []) as string[]\n}\n\nfunction makeOptional(validator: z.ZodType): z.ZodType {\n return z.preprocess(v => (isEmpty(v) ? undefined : v), validator.optional())\n}\n\nfunction isEmpty(value: unknown): boolean {\n if (value === undefined || value === null) return true\n if (typeof value === 'string' && value.trim() === '') return true\n if (typeof value === 'number' && Number.isNaN(value)) return true\n return false\n}\n\n/**\n * Determines which form field names are read by predicate-based requiredness\n * rules. This enables `useDeriveFieldsMetadata` to watch only the specific\n * fields that predicates depend on, rather than subscribing to every form\n * value change (which defeats react-hook-form's per-field render optimization).\n *\n * Works by running each predicate against a recording Proxy. The Proxy\n * intercepts property access and logs the keys, giving us the dependency list\n * without requiring manual declaration.\n *\n * Limitation: JavaScript short-circuit evaluation (`a && b`) can prevent the\n * Proxy from seeing later operands when earlier ones are falsy. In practice\n * this is acceptable — our predicate rules read a single form value each\n * (e.g. `data => data.adjustForMinimumWage`). Multi-field predicates with\n * equality guards should be expressed as `superRefine` rules instead.\n */\nfunction detectPredicateDeps(\n dynamicRequired: Array<{\n name: string\n predicate: (data: Record<string, unknown>, mode: FormMode) => boolean\n }>,\n mode: FormMode,\n): string[] {\n const deps = new Set<string>()\n\n for (const { predicate } of dynamicRequired) {\n if (isConstantPredicate(predicate)) continue\n\n const accessed: string[] = []\n const proxy = new Proxy({} as Record<string, unknown>, {\n get(_target, prop) {\n if (typeof prop === 'string') accessed.push(prop)\n return undefined\n },\n })\n\n try {\n predicate(proxy, mode)\n } catch {\n /* Predicate may throw on undefined values — that's fine, we already captured the property accesses */\n }\n\n for (const key of accessed) deps.add(key)\n }\n\n return [...deps]\n}\n\n/**\n * Static predicates (e.g. `() => true` from 'always' / mode rules / partner\n * overrides) don't access form data, so we skip them during dependency\n * detection. We identify them by running against an empty proxy and checking\n * whether any properties were accessed.\n */\nfunction isConstantPredicate(\n predicate: (data: Record<string, unknown>, mode: FormMode) => boolean,\n): boolean {\n const accessed: string[] = []\n const proxy = new Proxy({} as Record<string, unknown>, {\n get(_target, prop) {\n if (typeof prop === 'string') accessed.push(prop)\n return undefined\n },\n })\n try {\n predicate(proxy, 'create')\n } catch {\n /* ignore */\n }\n return accessed.length === 0\n}\n"],"names":["buildFormSchema","fieldValidators","options","mode","requiredFieldsConfig","requiredErrorCode","excludeFields","excludeFieldsFn","staticExcluded","redacted","partnerRequired","resolveOptionalFieldsToRequire","shape","dynamicRequired","includedFieldNames","config","name","validator","effectiveRule","makeOptional","isPartnerRequired","hasSuperRefine","schema","z","data","ctx","typedData","excludedNow","predicate","isEmpty","predicateDeps","detectPredicateDeps","getFieldsMetadata","metadata","value","v","deps","isConstantPredicate","accessed","proxy","_target","prop","key"],"mappings":";AAkLO,SAASA,EAGdC,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AAErB;AAEA,SAASf,EAAaF,GAAiC;AACrD,SAAOM,EAAE,WAAW,CAAAY,MAAMN,EAAQM,CAAC,IAAI,SAAYA,GAAIlB,EAAU,SAAA,CAAU;AAC7E;AAEA,SAASY,EAAQK,GAAyB;AAGxC,SAFI,GAAuBA,KAAU,QACjC,OAAOA,KAAU,YAAYA,EAAM,KAAA,MAAW,MAC9C,OAAOA,KAAU,YAAY,OAAO,MAAMA,CAAK;AAErD;AAkBA,SAASH,EACPlB,GAIAV,GACU;AACV,QAAMiC,wBAAW,IAAA;AAEjB,aAAW,EAAE,WAAAR,EAAA,KAAef,GAAiB;AAC3C,QAAIwB,EAAoBT,CAAS,EAAG;AAEpC,UAAMU,IAAqB,CAAA,GACrBC,IAAQ,IAAI,MAAM,IAA+B;AAAA,MACrD,IAAIC,GAASC,GAAM;AACjB,QAAI,OAAOA,KAAS,YAAUH,EAAS,KAAKG,CAAI;AAAA,MAElD;AAAA,IAAA,CACD;AAED,QAAI;AACF,MAAAb,EAAUW,GAAOpC,CAAI;AAAA,IACvB,QAAQ;AAAA,IAER;AAEA,eAAWuC,KAAOJ,EAAU,CAAAF,EAAK,IAAIM,CAAG;AAAA,EAC1C;AAEA,SAAO,CAAC,GAAGN,CAAI;AACjB;AAQA,SAASC,EACPT,GACS;AACT,QAAMU,IAAqB,CAAA,GACrBC,IAAQ,IAAI,MAAM,IAA+B;AAAA,IACrD,IAAIC,GAASC,GAAM;AACjB,MAAI,OAAOA,KAAS,YAAUH,EAAS,KAAKG,CAAI;AAAA,IAElD;AAAA,EAAA,CACD;AACD,MAAI;AACF,IAAAb,EAAUW,GAAO,QAAQ;AAAA,EAC3B,QAAQ;AAAA,EAER;AACA,SAAOD,EAAS,WAAW;AAC7B;"}
|
|
1
|
+
{"version":3,"file":"buildFormSchema.js","sources":["../../../src/partner-hook-utils/form/buildFormSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport type { FieldMetadata } from '../types'\n\n// ── Types ────────────────────────────────────────────────────────────\n\n/**\n * Form lifecycle mode used to vary requiredness and validation rules.\n *\n * @internal\n */\ntype FormMode = 'create' | 'update'\n\n/**\n * Per-field requiredness rule.\n *\n * String values apply requiredness in a fixed mode (`'always'`, `'create'`,\n * `'update'`, or `'never'`). A function form receives the current form data\n * and mode so requiredness can depend on other field values at runtime.\n *\n * @typeParam TData - The shape of the form data passed to predicate rules.\n * @internal\n */\ntype RequiredFieldRule<TData = Record<string, unknown>> =\n 'create' | 'update' | 'always' | 'never' | ((data: TData, mode: FormMode) => boolean)\n\n/**\n * Mapping from each field name in a schema to its {@link RequiredFieldRule}.\n *\n * @typeParam TSchema - The map of field names to their Zod validators.\n * @internal\n */\nexport type RequiredFieldConfig<TSchema extends Record<string, z.ZodType>> = Partial<{\n [K in keyof TSchema & string]: RequiredFieldRule<{\n [F in keyof TSchema]: z.infer<TSchema[F]>\n }>\n}>\n\n/**\n * A predicate (value-conditional) requiredness rule. Matches any function\n * signature so predicate rules are recognized regardless of their parameter or\n * return types. Such fields are never statically required in a given mode, so\n * they're eligible for promotion — see {@link OptionalOnCreate}.\n */\ntype PredicateRule = (...args: never[]) => unknown\n\n/**\n * Union of field names in `TConfig` that are not statically required in create\n * mode and are therefore eligible to be promoted to required in create mode:\n * fields whose base rule is `'update'`, `'never'`, or a predicate. Promoting a\n * predicate field upgrades it from conditionally required to always required.\n *\n * The template-literal wrapper \\`\\` `${...}` \\`\\` is intentional: wrapping a\n * conditional-mapped-type index access in a template literal forces TypeScript\n * to eagerly evaluate and materialize the string union rather than deferring\n * it. Without the wrapper, TypeScript preserves the alias name in hover\n * tooltips and generated docs (`OptionalOnCreate<{ ... }>`), making the type\n * opaque to callers. With it, both IntelliSense and TypeDoc display the\n * resolved concrete union (e.g. `\"stateWcCovered\" | \"twoPercentShareholder\"`).\n */\ntype OptionalOnCreate<TConfig> = `${{\n [K in keyof TConfig & string]: TConfig[K] extends 'update' | 'never' | PredicateRule ? K : never\n}[keyof TConfig & string]}`\n\n/**\n * Union of field names in `TConfig` that are not statically required in update\n * mode and are therefore eligible to be promoted to required in update mode:\n * fields whose base rule is `'create'`, `'never'`, or a predicate.\n *\n * See {@link OptionalOnCreate} for why the template-literal wrapper is here.\n */\ntype OptionalOnUpdate<TConfig> = `${{\n [K in keyof TConfig & string]: TConfig[K] extends 'create' | 'never' | PredicateRule ? K : never\n}[keyof TConfig & string]}`\n\n/**\n * Per-mode list of optional fields a caller can promote to required.\n *\n * Only fields whose base rule allows the override appear in the `create` /\n * `update` arrays — fields that are already required in a given mode are\n * excluded from that mode's list at the type level. Value-conditional\n * (predicate) fields are eligible in both modes; listing one promotes it from\n * conditionally required to always required for that mode.\n *\n * @typeParam TConfig - The {@link RequiredFieldConfig} that constrains which fields are eligible.\n * @internal\n * @interface\n */\nexport type OptionalFieldsToRequire<TConfig> = {\n /** Fields that can be required in create mode */\n create?: Array<OptionalOnCreate<TConfig>>\n /** Fields that can be required in update mode */\n update?: Array<OptionalOnUpdate<TConfig>>\n}\n\n// ── buildFormSchema ──────────────────────────────────────────────────\n\ninterface BuildFormSchemaOptions<\n T extends Record<string, z.ZodType>,\n TConfig extends RequiredFieldConfig<T>,\n> {\n requiredFieldsConfig?: TConfig\n requiredErrorCode?: string\n mode: FormMode\n optionalFieldsToRequire?: OptionalFieldsToRequire<TConfig>\n /**\n * Fields that don't apply and should be dropped from required validation.\n *\n * An **array** removes the fields at build time — they're absent from the\n * schema shape entirely (use when applicability is fixed by a config flag).\n *\n * A **function** is evaluated against the values under validation, so a field\n * can flip in/out of applicability as other values change. The field stays in\n * the schema (validated as optional) but its required check is skipped while\n * the function reports it as excluded.\n */\n excludeFields?:\n | Array<keyof T & string>\n | ((data: { [K in keyof T]: z.infer<T[K]> }, mode: FormMode) => Array<keyof T & string>)\n /** Fields with existing server-side values that are redacted in the API response\n * (e.g. SSN, EIN). These fields remain in the schema for format validation and\n * appear in metadata (with `hasRedactedValue: true`) but are exempt from required\n * validation — an empty submission is valid because a value already exists. */\n fieldsWithRedactedValues?: Array<keyof T & string>\n superRefine?: (data: { [K in keyof T]: z.infer<T[K]> }, ctx: z.RefinementCtx) => void\n}\n\n/**\n * Companion config returned alongside a built schema, used to derive per-field\n * metadata and to identify which form values predicate-based rules depend on.\n *\n * @typeParam T - The map of field names to their Zod validators.\n * @internal\n */\nexport interface FieldsMetadataConfig<T extends Record<string, z.ZodType>> {\n getFieldsMetadata: (data?: Record<string, unknown>) => Record<keyof T, FieldMetadata>\n /** Form field names that predicate-based requiredness rules read at runtime. */\n predicateDeps: string[]\n}\n\ntype FormDataFromValidators<T extends Record<string, z.ZodType>> = {\n [K in keyof T]: z.infer<T[K]>\n}\n\n/**\n * Tuple returned by {@link buildFormSchema}: the composed Zod schema followed\n * by its {@link FieldsMetadataConfig}.\n *\n * @typeParam T - The map of field names to their Zod validators.\n * @internal\n */\nexport type BuildFormSchemaResult<T extends Record<string, z.ZodType>> = [\n schema: z.ZodType<FormDataFromValidators<T>, FormDataFromValidators<T>>,\n metadataConfig: FieldsMetadataConfig<T>,\n]\n\n/**\n * Composes a Zod object schema and matching metadata config from a map of\n * per-field validators, applying mode-aware requiredness rules.\n *\n * @remarks\n * Every field is wrapped to coerce empty strings, `null`, `undefined`, and\n * `NaN` to `undefined` before validation, so blank inputs surface as missing\n * rather than as type-mismatch errors. Required-field checks run in a\n * `superRefine` pass that emits an issue keyed by `requiredErrorCode` (defaults\n * to `REQUIRED`) for each unfilled required field.\n *\n * Fields listed in `fieldsWithRedactedValues` remain in the schema for format\n * validation and appear in metadata with `hasRedactedValue: true`, but are\n * exempt from required-field validation because a server-side value already\n * exists.\n *\n * @typeParam T - The map of field names to their Zod validators.\n * @typeParam TConfig - The shape of the requiredness configuration.\n * @param fieldValidators - Map from field name to the validator that runs when a value is present.\n * @param options - Mode, required-field config, redaction list, and optional `superRefine`.\n * @returns A {@link BuildFormSchemaResult} tuple: the schema and its metadata config.\n * @internal\n */\nexport function buildFormSchema<\n T extends Record<string, z.ZodType>,\n TConfig extends RequiredFieldConfig<T>,\n>(fieldValidators: T, options: BuildFormSchemaOptions<T, TConfig>): BuildFormSchemaResult<T> {\n const {\n mode,\n requiredFieldsConfig = {} as Record<string, RequiredFieldRule>,\n requiredErrorCode = 'REQUIRED',\n excludeFields = [],\n } = options\n // The array form removes fields at build time; the function form is resolved\n // per-validation in the superRefine pass below.\n const excludeFieldsFn = typeof excludeFields === 'function' ? excludeFields : undefined\n const staticExcluded = new Set((Array.isArray(excludeFields) ? excludeFields : []).map(String))\n const redacted = new Set((options.fieldsWithRedactedValues ?? []).map(String))\n const partnerRequired = new Set(\n resolveOptionalFieldsToRequire(options.optionalFieldsToRequire, mode),\n )\n\n const shape: Record<string, z.ZodType> = {}\n const dynamicRequired: Array<{\n name: string\n predicate: (data: Record<string, unknown>, mode: FormMode) => boolean\n }> = []\n const includedFieldNames: string[] = []\n const config = requiredFieldsConfig as Record<string, RequiredFieldRule>\n\n for (const [name, validator] of Object.entries(fieldValidators)) {\n if (staticExcluded.has(name)) continue\n includedFieldNames.push(name)\n\n const effectiveRule = config[name] ?? 'always'\n\n shape[name] = makeOptional(validator)\n\n if (!redacted.has(name)) {\n const isPartnerRequired = partnerRequired.has(name)\n\n if (typeof effectiveRule === 'function') {\n dynamicRequired.push({\n name,\n predicate: isPartnerRequired ? () => true : effectiveRule,\n })\n } else {\n const isRequired = effectiveRule === 'always' || effectiveRule === mode || isPartnerRequired\n if (isRequired) {\n dynamicRequired.push({ name, predicate: () => true })\n }\n }\n }\n }\n\n const hasSuperRefine = dynamicRequired.length > 0 || options.superRefine\n const objectSchema = z.object(shape)\n\n let schema: z.ZodType = excludeFieldsFn\n ? z.preprocess((val: unknown) => {\n if (typeof val !== 'object' || val === null) return val\n const data = { ...(val as Record<string, unknown>) }\n for (const key of excludeFieldsFn(data as FormDataFromValidators<T>, mode)) {\n data[key as string] = undefined\n }\n return data\n }, objectSchema)\n : objectSchema\n\n if (hasSuperRefine) {\n schema = (schema as z.ZodObject).superRefine(\n (data: Record<string, unknown>, ctx: z.RefinementCtx) => {\n const typedData = data as FormDataFromValidators<T>\n const excludedNow = excludeFieldsFn\n ? new Set(excludeFieldsFn(typedData, mode).map(String))\n : undefined\n\n for (const { name, predicate } of dynamicRequired) {\n if (excludedNow?.has(name)) continue\n if (predicate(data, mode) && isEmpty(data[name])) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [name],\n message: requiredErrorCode,\n })\n }\n }\n\n options.superRefine?.(typedData, ctx)\n },\n )\n }\n\n const predicateDeps = detectPredicateDeps(dynamicRequired, mode)\n\n function getFieldsMetadata(data?: Record<string, unknown>) {\n const metadata: Record<string, FieldMetadata> = {}\n\n for (const name of includedFieldNames) {\n const effectiveRule = config[name] ?? 'always'\n\n if (partnerRequired.has(name)) {\n metadata[name] = { name, isRequired: true }\n } else if (typeof effectiveRule === 'function') {\n metadata[name] = { name, isRequired: data ? effectiveRule(data, mode) : false }\n } else {\n metadata[name] = {\n name,\n isRequired: effectiveRule === 'always' || effectiveRule === mode,\n }\n }\n\n if (redacted.has(name)) {\n metadata[name].hasRedactedValue = true\n }\n }\n\n return metadata as Record<keyof T, FieldMetadata>\n }\n\n // makeOptional wraps fields with z.preprocess, which causes z.input to infer\n // `unknown`. Cast the schema to carry the original field types so zodResolver\n // infers correct form data types — consumers don't need per-hook casts.\n return [\n schema as z.ZodType<FormDataFromValidators<T>, FormDataFromValidators<T>>,\n { getFieldsMetadata, predicateDeps },\n ]\n}\n\n// ── Internal helpers ─────────────────────────────────────────────────\n\nfunction resolveOptionalFieldsToRequire<TConfig>(\n value: OptionalFieldsToRequire<TConfig> | undefined,\n mode: FormMode,\n): string[] {\n if (!value) return []\n return ((mode === 'create' ? value.create : value.update) ?? []) as string[]\n}\n\nfunction makeOptional(validator: z.ZodType): z.ZodType {\n return z.preprocess(v => (isEmpty(v) ? undefined : v), validator.optional())\n}\n\nfunction isEmpty(value: unknown): boolean {\n if (value === undefined || value === null) return true\n if (typeof value === 'string' && value.trim() === '') return true\n if (typeof value === 'number' && Number.isNaN(value)) return true\n return false\n}\n\n/**\n * Determines which form field names are read by predicate-based requiredness\n * rules. This enables `useDeriveFieldsMetadata` to watch only the specific\n * fields that predicates depend on, rather than subscribing to every form\n * value change (which defeats react-hook-form's per-field render optimization).\n *\n * Works by running each predicate against a recording Proxy. The Proxy\n * intercepts property access and logs the keys, giving us the dependency list\n * without requiring manual declaration.\n *\n * Limitation: JavaScript short-circuit evaluation (`a && b`) can prevent the\n * Proxy from seeing later operands when earlier ones are falsy. In practice\n * this is acceptable — our predicate rules read a single form value each\n * (e.g. `data => data.adjustForMinimumWage`). Multi-field predicates with\n * equality guards should be expressed as `superRefine` rules instead.\n */\nfunction detectPredicateDeps(\n dynamicRequired: Array<{\n name: string\n predicate: (data: Record<string, unknown>, mode: FormMode) => boolean\n }>,\n mode: FormMode,\n): string[] {\n const deps = new Set<string>()\n\n for (const { predicate } of dynamicRequired) {\n if (isConstantPredicate(predicate)) continue\n\n const accessed: string[] = []\n const proxy = new Proxy({} as Record<string, unknown>, {\n get(_target, prop) {\n if (typeof prop === 'string') accessed.push(prop)\n return undefined\n },\n })\n\n try {\n predicate(proxy, mode)\n } catch {\n /* Predicate may throw on undefined values — that's fine, we already captured the property accesses */\n }\n\n for (const key of accessed) deps.add(key)\n }\n\n return [...deps]\n}\n\n/**\n * Static predicates (e.g. `() => true` from 'always' / mode rules / partner\n * overrides) don't access form data, so we skip them during dependency\n * detection. We identify them by running against an empty proxy and checking\n * whether any properties were accessed.\n */\nfunction isConstantPredicate(\n predicate: (data: Record<string, unknown>, mode: FormMode) => boolean,\n): boolean {\n const accessed: string[] = []\n const proxy = new Proxy({} as Record<string, unknown>, {\n get(_target, prop) {\n if (typeof prop === 'string') accessed.push(prop)\n return undefined\n },\n })\n try {\n predicate(proxy, 'create')\n } catch {\n /* ignore */\n }\n return accessed.length === 0\n}\n"],"names":["buildFormSchema","fieldValidators","options","mode","requiredFieldsConfig","requiredErrorCode","excludeFields","excludeFieldsFn","staticExcluded","redacted","partnerRequired","resolveOptionalFieldsToRequire","shape","dynamicRequired","includedFieldNames","config","name","validator","effectiveRule","makeOptional","isPartnerRequired","hasSuperRefine","objectSchema","z","schema","val","data","key","ctx","typedData","excludedNow","predicate","isEmpty","predicateDeps","detectPredicateDeps","getFieldsMetadata","metadata","value","v","deps","isConstantPredicate","accessed","proxy","_target","prop"],"mappings":";AAkLO,SAASA,EAGdC,GAAoBC,GAAuE;AAC3F,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,sBAAAC,IAAuB,CAAA;AAAA,IACvB,mBAAAC,IAAoB;AAAA,IACpB,eAAAC,IAAgB,CAAA;AAAA,EAAC,IACfJ,GAGEK,IAAkB,OAAOD,KAAkB,aAAaA,IAAgB,QACxEE,IAAiB,IAAI,KAAK,MAAM,QAAQF,CAAa,IAAIA,IAAgB,CAAA,GAAI,IAAI,MAAM,CAAC,GACxFG,IAAW,IAAI,KAAKP,EAAQ,4BAA4B,CAAA,GAAI,IAAI,MAAM,CAAC,GACvEQ,IAAkB,IAAI;AAAA,IAC1BC,EAA+BT,EAAQ,yBAAyBC,CAAI;AAAA,EAAA,GAGhES,IAAmC,CAAA,GACnCC,IAGD,CAAA,GACCC,IAA+B,CAAA,GAC/BC,IAASX;AAEf,aAAW,CAACY,GAAMC,CAAS,KAAK,OAAO,QAAQhB,CAAe,GAAG;AAC/D,QAAIO,EAAe,IAAIQ,CAAI,EAAG;AAC9B,IAAAF,EAAmB,KAAKE,CAAI;AAE5B,UAAME,IAAgBH,EAAOC,CAAI,KAAK;AAItC,QAFAJ,EAAMI,CAAI,IAAIG,EAAaF,CAAS,GAEhC,CAACR,EAAS,IAAIO,CAAI,GAAG;AACvB,YAAMI,IAAoBV,EAAgB,IAAIM,CAAI;AAElD,MAAI,OAAOE,KAAkB,aAC3BL,EAAgB,KAAK;AAAA,QACnB,MAAAG;AAAA,QACA,WAAWI,IAAoB,MAAM,KAAOF;AAAA,MAAA,CAC7C,KAEkBA,MAAkB,YAAYA,MAAkBf,KAAQ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,CAAG;AAAA,EAC1C;AAEA,SAAO,CAAC,GAAGY,CAAI;AACjB;AAQA,SAASC,EACPT,GACS;AACT,QAAMU,IAAqB,CAAA,GACrBC,IAAQ,IAAI,MAAM,IAA+B;AAAA,IACrD,IAAIC,GAASC,GAAM;AACjB,MAAI,OAAOA,KAAS,YAAUH,EAAS,KAAKG,CAAI;AAAA,IAElD;AAAA,EAAA,CACD;AACD,MAAI;AACF,IAAAb,EAAUW,GAAO,QAAQ;AAAA,EAC3B,QAAQ;AAAA,EAER;AACA,SAAOD,EAAS,WAAW;AAC7B;"}
|
|
@@ -270,6 +270,7 @@ export declare const contractorPaymentEvents: {
|
|
|
270
270
|
* @public
|
|
271
271
|
*/
|
|
272
272
|
export declare const contractorHistoricalPaymentEvents: {
|
|
273
|
+
readonly CONTRACTOR_HISTORICAL_PAYMENT_CREATE: "contractor/historicalPayments/create";
|
|
273
274
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_EDIT: "contractor/historicalPayments/edit";
|
|
274
275
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_UPDATE: "contractor/historicalPayments/update";
|
|
275
276
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_PREVIEW: "contractor/historicalPayments/preview";
|
|
@@ -332,6 +333,7 @@ export declare const payScheduleEvents: {
|
|
|
332
333
|
export declare const runPayrollEvents: {
|
|
333
334
|
readonly RUN_PAYROLL_BACK: "runPayroll/back";
|
|
334
335
|
readonly RUN_PAYROLL_CALCULATED: "runPayroll/calculated";
|
|
336
|
+
readonly RUN_PAYROLL_ALREADY_PROCESSED: "runPayroll/alreadyProcessed";
|
|
335
337
|
readonly RUN_PAYROLL_CANCELLED: "runPayroll/cancelled";
|
|
336
338
|
readonly RUN_PAYROLL_CANCELLED_ALERT_DISMISSED: "runPayroll/cancelled/alertDismissed";
|
|
337
339
|
readonly RUN_PAYROLL_EDIT: "runPayroll/edit";
|
|
@@ -412,6 +414,25 @@ export declare const recoveryCasesEvents: {
|
|
|
412
414
|
readonly RECOVERY_CASE_RESUBMIT_CANCEL: "recoveryCase/resubmit/cancel";
|
|
413
415
|
readonly RECOVERY_CASE_RESUBMIT_DONE: "recoveryCase/resubmit/done";
|
|
414
416
|
};
|
|
417
|
+
/**
|
|
418
|
+
* Event keys emitted by the print-checks component.
|
|
419
|
+
*
|
|
420
|
+
* @remarks
|
|
421
|
+
* These keys are merged into {@link componentEvents}. Consume them through the
|
|
422
|
+
* `onEvent` handler of the print-checks component and compare against the
|
|
423
|
+
* value of an entry on this object.
|
|
424
|
+
*
|
|
425
|
+
* @public
|
|
426
|
+
*/
|
|
427
|
+
export declare const printChecksEvents: {
|
|
428
|
+
readonly PRINT_CHECKS_START: "payroll/printChecks/start";
|
|
429
|
+
readonly PRINT_CHECKS_GENERATE_START: "payroll/printChecks/generate/start";
|
|
430
|
+
readonly PRINT_CHECKS_GENERATE_SUCCEEDED: "payroll/printChecks/generate/succeeded";
|
|
431
|
+
readonly PRINT_CHECKS_GENERATE_FAILED: "payroll/printChecks/generate/failed";
|
|
432
|
+
readonly PRINT_CHECKS_RETRY: "payroll/printChecks/retry";
|
|
433
|
+
readonly PRINT_CHECKS_CANCEL: "payroll/printChecks/cancel";
|
|
434
|
+
readonly PRINT_CHECKS_CLOSE: "payroll/printChecks/close";
|
|
435
|
+
};
|
|
415
436
|
/**
|
|
416
437
|
* Event keys emitted by off-cycle payroll and transition components.
|
|
417
438
|
*
|
|
@@ -541,6 +562,7 @@ export declare const componentEvents: {
|
|
|
541
562
|
readonly TRANSITION_CREATED: "transition/created";
|
|
542
563
|
readonly RUN_TRANSITION_PAYROLL: "transition/runPayroll";
|
|
543
564
|
readonly TRANSITION_PAYROLL_SKIPPED: "transition/payrollSkipped";
|
|
565
|
+
readonly CONTRACTOR_HISTORICAL_PAYMENT_CREATE: "contractor/historicalPayments/create";
|
|
544
566
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_EDIT: "contractor/historicalPayments/edit";
|
|
545
567
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_UPDATE: "contractor/historicalPayments/update";
|
|
546
568
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_PREVIEW: "contractor/historicalPayments/preview";
|
|
@@ -559,6 +581,13 @@ export declare const componentEvents: {
|
|
|
559
581
|
readonly CONTRACTOR_PAYMENT_CANCEL: "contractor/payments/cancel";
|
|
560
582
|
readonly CONTRACTOR_PAYMENT_EXIT: "contractor/payments/exit";
|
|
561
583
|
readonly CONTRACTOR_PAYMENT_RFI_RESPOND: "contractor/payments/rfi/respond";
|
|
584
|
+
readonly PRINT_CHECKS_START: "payroll/printChecks/start";
|
|
585
|
+
readonly PRINT_CHECKS_GENERATE_START: "payroll/printChecks/generate/start";
|
|
586
|
+
readonly PRINT_CHECKS_GENERATE_SUCCEEDED: "payroll/printChecks/generate/succeeded";
|
|
587
|
+
readonly PRINT_CHECKS_GENERATE_FAILED: "payroll/printChecks/generate/failed";
|
|
588
|
+
readonly PRINT_CHECKS_RETRY: "payroll/printChecks/retry";
|
|
589
|
+
readonly PRINT_CHECKS_CANCEL: "payroll/printChecks/cancel";
|
|
590
|
+
readonly PRINT_CHECKS_CLOSE: "payroll/printChecks/close";
|
|
562
591
|
readonly RECOVERY_CASE_RESOLVE: "recoveryCase/resolve";
|
|
563
592
|
readonly RECOVERY_CASE_RESUBMIT: "recoveryCase/resubmit";
|
|
564
593
|
readonly RECOVERY_CASE_RESUBMIT_CANCEL: "recoveryCase/resubmit/cancel";
|
|
@@ -575,6 +604,7 @@ export declare const componentEvents: {
|
|
|
575
604
|
readonly PAYROLL_WIRE_FORM_CANCEL: "payroll/wire/form/cancel";
|
|
576
605
|
readonly RUN_PAYROLL_BACK: "runPayroll/back";
|
|
577
606
|
readonly RUN_PAYROLL_CALCULATED: "runPayroll/calculated";
|
|
607
|
+
readonly RUN_PAYROLL_ALREADY_PROCESSED: "runPayroll/alreadyProcessed";
|
|
578
608
|
readonly RUN_PAYROLL_CANCELLED: "runPayroll/cancelled";
|
|
579
609
|
readonly RUN_PAYROLL_CANCELLED_ALERT_DISMISSED: "runPayroll/cancelled/alertDismissed";
|
|
580
610
|
readonly RUN_PAYROLL_EDIT: "runPayroll/edit";
|