@gusto/embedded-react-sdk 0.55.1 → 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.
Files changed (131) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  3. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  4. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  5. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
  6. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  7. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
  8. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  9. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
  10. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  11. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
  12. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  13. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  14. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  15. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
  16. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  17. package/dist/components/Company/Industry/Context.js +7 -6
  18. package/dist/components/Company/Industry/Context.js.map +1 -1
  19. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
  20. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  21. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
  22. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  23. package/dist/components/Company/OnboardingOverview/context.js +4 -3
  24. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  25. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
  26. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  27. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
  28. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  29. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +4 -3
  30. package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
  31. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  32. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  33. package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
  34. package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
  35. package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
  36. package/dist/components/Flow/Flow.js +1 -1
  37. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +3 -2
  38. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  39. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +7 -0
  40. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +191 -153
  41. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  42. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +1 -0
  43. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +87 -81
  44. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  45. package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +1 -0
  46. package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
  47. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +73 -48
  48. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
  49. package/dist/components/Payroll/PayrollFlow/PayrollFlow.d.ts +1 -1
  50. package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +22 -20
  51. package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
  52. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +3 -0
  53. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +22 -20
  54. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  55. package/dist/components/Payroll/PayrollLanding/PayrollLanding.d.ts +2 -0
  56. package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +34 -26
  57. package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
  58. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +4 -0
  59. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +51 -43
  60. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  61. package/dist/components/Payroll/PayrollList/PayrollList.d.ts +2 -0
  62. package/dist/components/Payroll/PayrollList/PayrollList.js +48 -47
  63. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  64. package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -1
  65. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +44 -43
  66. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  67. package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +7 -0
  68. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +115 -112
  69. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  70. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
  71. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +94 -103
  72. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  73. package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +22 -16
  74. package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
  75. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +58 -49
  76. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  77. package/dist/components/Payroll/PrintChecks/PrintChecks.d.ts +21 -0
  78. package/dist/components/Payroll/PrintChecks/PrintChecks.js +68 -0
  79. package/dist/components/Payroll/PrintChecks/PrintChecks.js.map +1 -0
  80. package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.d.ts +9 -0
  81. package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js +34 -0
  82. package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js.map +1 -0
  83. package/dist/components/Payroll/PrintChecks/PrintChecksBanner/index.d.ts +1 -0
  84. package/dist/components/Payroll/PrintChecks/PrintChecksComponents.d.ts +48 -0
  85. package/dist/components/Payroll/PrintChecks/PrintChecksComponents.js +26 -0
  86. package/dist/components/Payroll/PrintChecks/PrintChecksComponents.js.map +1 -0
  87. package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.d.ts +14 -0
  88. package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js +47 -0
  89. package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js.map +1 -0
  90. package/dist/components/Payroll/PrintChecks/PrintChecksFailure/index.d.ts +1 -0
  91. package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.d.ts +16 -0
  92. package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js +144 -0
  93. package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js.map +1 -0
  94. package/dist/components/Payroll/PrintChecks/PrintChecksForm/index.d.ts +1 -0
  95. package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.d.ts +14 -0
  96. package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js +39 -0
  97. package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js.map +1 -0
  98. package/dist/components/Payroll/PrintChecks/PrintChecksSummary/index.d.ts +1 -0
  99. package/dist/components/Payroll/PrintChecks/index.d.ts +2 -0
  100. package/dist/components/Payroll/PrintChecks/printChecksStateMachine.d.ts +33 -0
  101. package/dist/components/Payroll/PrintChecks/printChecksStateMachine.js +93 -0
  102. package/dist/components/Payroll/PrintChecks/printChecksStateMachine.js.map +1 -0
  103. package/dist/components/Payroll/PrintChecks/types.d.ts +14 -0
  104. package/dist/components/Payroll/index.d.ts +2 -0
  105. package/dist/components/Payroll/index.js +26 -24
  106. package/dist/components/Payroll/index.js.map +1 -1
  107. package/dist/components/Payroll/usePreparedPayrollData.js +9 -8
  108. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  109. package/dist/i18n/I18n.js +4 -0
  110. package/dist/i18n/I18n.js.map +1 -1
  111. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +9 -9
  112. package/dist/i18n/en/Payroll.PayrollOverview.json.js +38 -38
  113. package/dist/i18n/en/Payroll.PayrollReceipts.json.js +2 -2
  114. package/dist/i18n/en/Payroll.PrintChecksBanner.json.js +14 -0
  115. package/dist/i18n/en/Payroll.PrintChecksBanner.json.js.map +1 -0
  116. package/dist/i18n/en/Payroll.PrintChecksFailure.json.js +12 -0
  117. package/dist/i18n/en/Payroll.PrintChecksFailure.json.js.map +1 -0
  118. package/dist/i18n/en/Payroll.PrintChecksForm.json.js +28 -0
  119. package/dist/i18n/en/Payroll.PrintChecksForm.json.js.map +1 -0
  120. package/dist/i18n/en/Payroll.PrintChecksSummary.json.js +14 -0
  121. package/dist/i18n/en/Payroll.PrintChecksSummary.json.js.map +1 -0
  122. package/dist/i18n/types.d.ts +65 -7
  123. package/dist/models/external.d.ts +3 -0
  124. package/dist/partner-hook-utils/form/buildFormSchema.js +60 -54
  125. package/dist/partner-hook-utils/form/buildFormSchema.js.map +1 -1
  126. package/dist/shared/constants.d.ts +28 -0
  127. package/dist/shared/constants.js +61 -50
  128. package/dist/shared/constants.js.map +1 -1
  129. package/dist/style.css +1 -1
  130. package/docs/guides/endpoint-inventory.json +26 -0
  131. package/package.json +2 -2
@@ -1,82 +1,82 @@
1
- const e = "Submit", a = "Back", t = "Save and exit", o = "Review payroll", l = "Payroll summary", s = "{{payrollType}} payroll for <dateWrapper>{{startDate}} - {{endDate}}</dateWrapper>", n = "{{payrollType}} payroll", i = "Submit", r = "Edit", y = "Cancel payroll", c = "Cancel {{startDate}} - {{endDate}} payroll?", p = "Cancel payroll?", d = "Any changes you have made to this payroll will be saved.", m = "Run this payroll by {{deadline}} to ensure your employees are paid on time.", u = " Yes, cancel payroll", b = "No, go back", h = "View payroll receipt", T = "Download paystub pdf", g = "Submitting payroll...", D = "This may take a minute or two. You can navigate away while this happens.", w = "Loading payroll...", f = "Cancelling payroll...", P = "This payroll has been cancelled.", k = "Skipped", x = { payrollNotCalculated: "Payroll is not calculated", directDepositDeadline: "To pay your employees with direct deposit by {{payDate}}, you'll need to run payroll by {{time}} on {{date}}", paystubPdfError: "There was an issue generating the paystub PDF. Please try again later.", checkPaymentWarning_one: "You noted {{count}} employee who should be paid by check.", checkPaymentWarning_other: "You noted {{count}} employees who should be paid by check.", checkPaymentWarningDescription: "Employees with this payment method will need their checks delivered to them.", payrollProcessedTitle: "Payroll submitted", payrollProcessedMessage: "{{amount}} will be debited on {{date}}. Make sure you have these funds available.", payrollProcessingFailedTitle: "There was an error submitting payroll", payrollProcessingFailedCtaLabel: "Recalculate payroll", wireDetailsSubmittedTitle: "Wire details submitted", wireDetailsSubmittedMessage: "Once we receive the funds from your bank we'll pay your team on {{checkDate}}" }, C = "Payroll Summary", v = "Payroll summary (Wire funds)", S = "Payroll summary (4-day direct deposit)", L = "Payroll summary table", E = { label: "Payroll details", companyPaysTab: "Company pays", companyPaysTable: "Company pays by employee", hoursWorkedTab: "Hours worked", hoursWorkedTable: "Hours worked by employee", employeeTakeHomeTab: "Employee take home", employeeTakeHomeTable: "Employee take home by employee", taxesTab: "Taxed and debited", taxesTable: "Taxes breakdown", debitedTable: "Debited totals by company" }, W = { totalPayroll: "Total payroll", debitAmount: "Debit amount", wireAmount: "Wire amount", wireTransferDeadline: "Wire transfer deadline", employees: "Employees", grossPay: "Gross Pay", reimbursements: "Reimbursements", debitAccount: "Debit account", debitDate: "Debit date", employeePayDate: "Employee pay date", companyTaxes: "Company taxes", companyBenefits: "Company benefits", companyPays: "Company pays", compensationType: "Compensation type", regular: "Regular", overtime: "Overtime (1.5x)", doubleOT: "Overtime (2x)", timeOff: "Paid time off", totalHours: "Total hours", paymentType: "Payment type", employeeTaxes: "Employee taxes", employeeBenefits: "Employee benefits", payment: "Payment", deductions: "Deductions", taxDescription: "Tax description", byYourEmployees: "By your employees", byYourCompany: "By your company", debitedByGusto: "Debited by Gusto", taxesTotal: "Total", paystub: "Paystub", footerTotalsLabel: "Totals", footerTotalsDescription: "All employees in this payroll" }, B = "Totals", _ = "Direct deposits", F = "Reimbursements", O = "Garnishments", Y = "Taxes (Employees and Employers)", H = { exempt: "Salaried / Exempt", nonexempt: "Hourly / Nonexempt" }, R = { genericBlockerTitle: "Submission blocked", genericBlockerMessage: "This payroll cannot be submitted. Please contact support for assistance.", fastAchOptions: { description: "Payroll can still be funded by selecting one of the options below. The selected funding method will only be used for this cycle and will not apply to future payroll.", fundingOptionsLabel: "Funding options", wireLabel: "Wire funds", wireFastestBadge: "Fastest", wireDescription: "Pay your employees on time by sending a wire transfer. We'll provide instructions on the next step.", directDepositLabel: "Switch to 4-day direct deposit", directDepositDescription: "Delay your employees pay date by four days and process using regular debits.", employeePayDate: "Employee pay date: {{date}}" }, fast_ach_threshold_exceeded: { title: "You have exceeded the limit at which you can process {{days}} payroll." }, needs_earned_access_for_fast_ach: { title: "You have not yet earned access to faster payroll." } }, A = {
1
+ const e = "Submit", a = "Back", t = "Save and exit", o = "Review payroll", l = "Payroll summary", s = "{{payrollType}} payroll for <dateWrapper>{{startDate}} - {{endDate}}</dateWrapper>", i = "{{payrollType}} payroll", n = "Submit", r = "Edit", y = "Cancel payroll", p = "Cancel {{startDate}} - {{endDate}} payroll?", c = "Cancel payroll?", d = "Any changes you have made to this payroll will be saved.", m = "Run this payroll by {{deadline}} to ensure your employees are paid on time.", u = " Yes, cancel payroll", b = "No, go back", T = "View payroll receipt", h = "Download paystub pdf", D = "Submitting payroll...", g = "This may take a minute or two. You can navigate away while this happens.", f = "Loading payroll...", w = "Cancelling payroll...", P = "This payroll has been cancelled.", x = "Skipped", C = { payrollNotCalculated: "Payroll is not calculated", directDepositDeadline: "To pay your employees with direct deposit by {{payDate}}, you'll need to run payroll by {{time}} on {{date}}", paystubPdfError: "There was an issue generating the paystub PDF. Please try again later.", payrollProcessedTitle: "Payroll submitted", payrollProcessedMessage: "{{amount}} will be debited on {{date}}. Make sure you have these funds available.", payrollProcessingFailedTitle: "There was an error submitting payroll", payrollProcessingFailedCtaLabel: "Recalculate payroll", wireDetailsSubmittedTitle: "Wire details submitted", wireDetailsSubmittedMessage: "Once we receive the funds from your bank we'll pay your team on {{checkDate}}" }, k = "Payroll Summary", v = "Payroll summary (Wire funds)", S = "Payroll summary (4-day direct deposit)", L = "Payroll summary table", E = { label: "Payroll details", companyPaysTab: "Company pays", companyPaysTable: "Company pays by employee", hoursWorkedTab: "Hours worked", hoursWorkedTable: "Hours worked by employee", employeeTakeHomeTab: "Employee take home", employeeTakeHomeTable: "Employee take home by employee", taxesTab: "Taxed and debited", taxesTable: "Taxes breakdown", debitedTable: "Debited totals by company" }, B = { totalPayroll: "Total payroll", debitAmount: "Debit amount", wireAmount: "Wire amount", wireTransferDeadline: "Wire transfer deadline", employees: "Employees", grossPay: "Gross Pay", reimbursements: "Reimbursements", debitAccount: "Debit account", debitDate: "Debit date", employeePayDate: "Employee pay date", companyTaxes: "Company taxes", companyBenefits: "Company benefits", companyPays: "Company pays", compensationType: "Compensation type", regular: "Regular", overtime: "Overtime (1.5x)", doubleOT: "Overtime (2x)", timeOff: "Paid time off", totalHours: "Total hours", paymentType: "Payment type", employeeTaxes: "Employee taxes", employeeBenefits: "Employee benefits", payment: "Payment", deductions: "Deductions", taxDescription: "Tax description", byYourEmployees: "By your employees", byYourCompany: "By your company", debitedByGusto: "Debited by Gusto", taxesTotal: "Total", paystub: "Paystub", footerTotalsLabel: "Totals", footerTotalsDescription: "All employees in this payroll" }, W = "Totals", _ = "Direct deposits", F = "Reimbursements", O = "Garnishments", H = "Taxes (Employees and Employers)", R = { exempt: "Salaried / Exempt", nonexempt: "Hourly / Nonexempt" }, A = { genericBlockerTitle: "Submission blocked", genericBlockerMessage: "This payroll cannot be submitted. Please contact support for assistance.", fastAchOptions: { description: "Payroll can still be funded by selecting one of the options below. The selected funding method will only be used for this cycle and will not apply to future payroll.", fundingOptionsLabel: "Funding options", wireLabel: "Wire funds", wireFastestBadge: "Fastest", wireDescription: "Pay your employees on time by sending a wire transfer. We'll provide instructions on the next step.", directDepositLabel: "Switch to 4-day direct deposit", directDepositDescription: "Delay your employees pay date by four days and process using regular debits.", employeePayDate: "Employee pay date: {{date}}" }, fast_ach_threshold_exceeded: { title: "You have exceeded the limit at which you can process {{days}} payroll." }, needs_earned_access_for_fast_ach: { title: "You have not yet earned access to faster payroll." } }, Y = {
2
2
  breadcrumbLabel: e,
3
3
  backCta: a,
4
4
  exitFlowCta: t,
5
5
  overviewTitle: o,
6
6
  summaryTitle: l,
7
7
  pageSubtitle: s,
8
- pageSubtitleDismissal: n,
9
- submitCta: i,
8
+ pageSubtitleDismissal: i,
9
+ submitCta: n,
10
10
  editCta: r,
11
11
  cancelCta: y,
12
- cancelDialogTitle: c,
13
- cancelDialogTitleDismissal: p,
12
+ cancelDialogTitle: p,
13
+ cancelDialogTitleDismissal: c,
14
14
  cancelDialogDescription: d,
15
15
  cancelDialogDescriptionDeadline: m,
16
16
  confirmCancelCta: u,
17
17
  declineCancelCta: b,
18
- payrollReceiptCta: h,
19
- downloadPaystubLabel: T,
20
- loadingTitle: g,
21
- loadingDescription: D,
22
- dataLoadingTitle: w,
23
- cancellingTitle: f,
18
+ payrollReceiptCta: T,
19
+ downloadPaystubLabel: h,
20
+ loadingTitle: D,
21
+ loadingDescription: g,
22
+ dataLoadingTitle: f,
23
+ cancellingTitle: w,
24
24
  cancelledEmptyState: P,
25
- skippedBadge: k,
26
- alerts: x,
27
- payrollSummaryTitle: C,
25
+ skippedBadge: x,
26
+ alerts: C,
27
+ payrollSummaryTitle: k,
28
28
  payrollSummaryTitleWire: v,
29
29
  payrollSummaryTitleFourDay: S,
30
30
  payrollSummaryLabel: L,
31
31
  dataViews: E,
32
- tableHeaders: W,
33
- totalsLabel: B,
32
+ tableHeaders: B,
33
+ totalsLabel: W,
34
34
  directDepositLabel: _,
35
35
  reimbursementLabel: F,
36
36
  garnishmentsLabel: O,
37
- taxesLabel: Y,
38
- compensationTypeLabels: H,
39
- submissionBlockers: R
37
+ taxesLabel: H,
38
+ compensationTypeLabels: R,
39
+ submissionBlockers: A
40
40
  };
41
41
  export {
42
- x as alerts,
42
+ C as alerts,
43
43
  a as backCta,
44
44
  e as breadcrumbLabel,
45
45
  y as cancelCta,
46
46
  d as cancelDialogDescription,
47
47
  m as cancelDialogDescriptionDeadline,
48
- c as cancelDialogTitle,
49
- p as cancelDialogTitleDismissal,
48
+ p as cancelDialogTitle,
49
+ c as cancelDialogTitleDismissal,
50
50
  P as cancelledEmptyState,
51
- f as cancellingTitle,
52
- H as compensationTypeLabels,
51
+ w as cancellingTitle,
52
+ R as compensationTypeLabels,
53
53
  u as confirmCancelCta,
54
- w as dataLoadingTitle,
54
+ f as dataLoadingTitle,
55
55
  E as dataViews,
56
56
  b as declineCancelCta,
57
- A as default,
57
+ Y as default,
58
58
  _ as directDepositLabel,
59
- T as downloadPaystubLabel,
59
+ h as downloadPaystubLabel,
60
60
  r as editCta,
61
61
  t as exitFlowCta,
62
62
  O as garnishmentsLabel,
63
- D as loadingDescription,
64
- g as loadingTitle,
63
+ g as loadingDescription,
64
+ D as loadingTitle,
65
65
  o as overviewTitle,
66
66
  s as pageSubtitle,
67
- n as pageSubtitleDismissal,
68
- h as payrollReceiptCta,
67
+ i as pageSubtitleDismissal,
68
+ T as payrollReceiptCta,
69
69
  L as payrollSummaryLabel,
70
- C as payrollSummaryTitle,
70
+ k as payrollSummaryTitle,
71
71
  S as payrollSummaryTitleFourDay,
72
72
  v as payrollSummaryTitleWire,
73
73
  F as reimbursementLabel,
74
- k as skippedBadge,
75
- R as submissionBlockers,
76
- i as submitCta,
74
+ x as skippedBadge,
75
+ A as submissionBlockers,
76
+ n as submitCta,
77
77
  l as summaryTitle,
78
- W as tableHeaders,
79
- Y as taxesLabel,
80
- B as totalsLabel
78
+ B as tableHeaders,
79
+ H as taxesLabel,
80
+ W as totalsLabel
81
81
  };
82
82
  //# sourceMappingURL=Payroll.PayrollOverview.json.js.map
@@ -1,4 +1,4 @@
1
- const e = "Back", t = "Exit", o = "Receipts", a = { totalLabel: "Total", detailsLabel: "Receipt Details", receiptId: "Receipt ID", from: "From", to: "To", debitDate: "Debit date", employeeCount: "{{count}} employees", employeeCount_one: "{{count}} employee", employeeCount_other: "{{count}} employees", disclaimer: "These amounts may not represent all monies due to government tax authorities from you, and do not include any amounts transmitted outside the platform.", companyInfo: "Your payroll provider partners with Gusto Inc. for payments processing. Gusto Inc. is a licensed money transmitter. Learn more on our license page.", address: "525 20th St, San Francisco, CA 94107 | 415-777-8888" }, s = { debitedLabel: "Debited", taxLabel: "Tax", employeesLabel: "Employees" }, n = { directDeposits: "Direct deposits", reimbursements: "Reimbursements", garnishments: "Garnishments", taxes: "Taxes (Employee and Employer)", totals: "Totals", category: "Category", amount: "Amount" }, l = { name: "Tax Type", amount: "Amount" }, m = { name: "Employee", paymentMethod: "Payment method", childSupport: "Child support", reimbursement: "Reimbursement", totalTaxes: "Total taxes", netPay: "Net pay", totalEmployees: "{{count}} employees in this payroll", totalEmployees_one: "{{count}} employee in this payroll", totalEmployees_other: "{{count}} employees in this payroll" }, r = {
1
+ const e = "Back", t = "Exit", o = "Receipts", a = { totalLabel: "Total", detailsLabel: "Receipt Details", receiptId: "Receipt ID", from: "From", to: "To", debitDate: "Debit date", employeeCount: "{{count}} employees", employeeCount_one: "{{count}} employee", employeeCount_other: "{{count}} employees", disclaimer: "These amounts may not represent all monies due to government tax authorities from you, and do not include any amounts transmitted outside the platform.", companyInfo: "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>.", address: "525 20th St, San Francisco, CA 94107 | 415-777-8888" }, s = { debitedLabel: "Debited", taxLabel: "Tax", employeesLabel: "Employees" }, n = { directDeposits: "Direct deposits", reimbursements: "Reimbursements", garnishments: "Garnishments", taxes: "Taxes (Employee and Employer)", totals: "Totals", category: "Category", amount: "Amount" }, l = { name: "Tax Type", amount: "Amount" }, m = { name: "Employee", paymentMethod: "Payment method", childSupport: "Child support", reimbursement: "Reimbursement", totalTaxes: "Total taxes", netPay: "Net pay", totalEmployees: "{{count}} employees in this payroll", totalEmployees_one: "{{count}} employee in this payroll", totalEmployees_other: "{{count}} employees in this payroll" }, i = {
2
2
  backCta: e,
3
3
  exitFlowCta: t,
4
4
  breadcrumbLabel: o,
@@ -12,7 +12,7 @@ export {
12
12
  e as backCta,
13
13
  o as breadcrumbLabel,
14
14
  n as breakdown,
15
- r as default,
15
+ i as default,
16
16
  m as employee,
17
17
  t as exitFlowCta,
18
18
  a as receipt,
@@ -0,0 +1,14 @@
1
+ const e = "You noted {{count}} employee that should be paid by check.", t = "You noted {{count}} employees that should be paid by check.", o = "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.", n = "View and print checks", c = {
2
+ title_one: e,
3
+ title_other: t,
4
+ description: o,
5
+ cta: n
6
+ };
7
+ export {
8
+ n as cta,
9
+ c as default,
10
+ o as description,
11
+ e as title_one,
12
+ t as title_other
13
+ };
14
+ //# sourceMappingURL=Payroll.PrintChecksBanner.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Payroll.PrintChecksBanner.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,12 @@
1
+ const e = "We couldn't generate your checks", t = "Try again", a = "Close", o = {
2
+ failedTitle: e,
3
+ retryCta: t,
4
+ closeCta: a
5
+ };
6
+ export {
7
+ a as closeCta,
8
+ o as default,
9
+ e as failedTitle,
10
+ t as retryCta
11
+ };
12
+ //# sourceMappingURL=Payroll.PrintChecksFailure.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Payroll.PrintChecksFailure.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -0,0 +1,28 @@
1
+ const c = "Choose check stock", t = "Custom check stock", e = "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.", o = "Blank check stock", s = "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.", n = "Check number starts with", a = "This will be the first check number, all other checks will follow sequentially.", h = "Cancel", i = "View checks", k = "Generating...", l = { startingCheckNumber: "Enter a valid check number" }, r = {
2
+ modalTitle: c,
3
+ customStockLabel: t,
4
+ customStockDescription: e,
5
+ blankStockLabel: o,
6
+ blankStockDescription: s,
7
+ startingCheckNumberLabel: n,
8
+ startingCheckNumberDescription: a,
9
+ cancelCta: h,
10
+ submitCta: i,
11
+ submitCtaLoading: k,
12
+ validations: l
13
+ };
14
+ export {
15
+ s as blankStockDescription,
16
+ o as blankStockLabel,
17
+ h as cancelCta,
18
+ e as customStockDescription,
19
+ t as customStockLabel,
20
+ r as default,
21
+ c as modalTitle,
22
+ a as startingCheckNumberDescription,
23
+ n as startingCheckNumberLabel,
24
+ i as submitCta,
25
+ k as submitCtaLoading,
26
+ l as validations
27
+ };
28
+ //# sourceMappingURL=Payroll.PrintChecksForm.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Payroll.PrintChecksForm.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -0,0 +1,14 @@
1
+ const e = "Your checks are ready", c = "The download should have started automatically. If not, use the link below.", s = "View checks", t = "Close", o = {
2
+ succeededTitle: e,
3
+ succeededDescription: c,
4
+ viewChecksCta: s,
5
+ closeCta: t
6
+ };
7
+ export {
8
+ t as closeCta,
9
+ o as default,
10
+ c as succeededDescription,
11
+ e as succeededTitle,
12
+ s as viewChecksCta
13
+ };
14
+ //# sourceMappingURL=Payroll.PrintChecksSummary.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Payroll.PrintChecksSummary.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -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
@@ -7015,6 +7019,8 @@ export namespace Translations {
7015
7019
  setNetEarnings: string
7016
7020
  }
7017
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
7018
7024
  /** @defaultValue `"Your progress has been saved"` */
7019
7025
  progressSaved: string
7020
7026
  /** @defaultValue `"To pay your employees with direct deposit by {{payDate}}, you'll need to run payroll by {{time}} on {{date}}."` */
@@ -7421,12 +7427,6 @@ export namespace Translations {
7421
7427
  directDepositDeadline: string
7422
7428
  /** @defaultValue `"There was an issue generating the paystub PDF. Please try again later."` */
7423
7429
  paystubPdfError: string
7424
- /** @defaultValue `"You noted {{count}} employee who should be paid by check."` */
7425
- checkPaymentWarning_one: string
7426
- /** @defaultValue `"You noted {{count}} employees who should be paid by check."` */
7427
- checkPaymentWarning_other: string
7428
- /** @defaultValue `"Employees with this payment method will need their checks delivered to them."` */
7429
- checkPaymentWarningDescription: string
7430
7430
  /** @defaultValue `"Payroll submitted"` */
7431
7431
  payrollProcessedTitle: string
7432
7432
  /** @defaultValue `"{{amount}} will be debited on {{date}}. Make sure you have these funds available."` */
@@ -7614,7 +7614,7 @@ export namespace Translations {
7614
7614
  employeeCount_other: string
7615
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."` */
7616
7616
  disclaimer: string
7617
- /** @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>."` */
7618
7618
  companyInfo: string
7619
7619
  /** @defaultValue `"525 20th St, San Francisco, CA 94107 | 415-777-8888"` */
7620
7620
  address: string
@@ -7670,6 +7670,64 @@ export namespace Translations {
7670
7670
  totalEmployees_other: string
7671
7671
  }
7672
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
+ }
7673
7731
  /** Translation keys for the `Payroll.RecoveryCasesList` i18n namespace. */
7674
7732
  export interface PayrollRecoveryCasesList {
7675
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 h } from "zod";
2
- function O(e, r) {
1
+ import { z as y } from "zod";
2
+ function I(r, n) {
3
3
  const {
4
- mode: i,
5
- requiredFieldsConfig: u = {},
4
+ mode: s,
5
+ requiredFieldsConfig: d = {},
6
6
  requiredErrorCode: c = "REQUIRED",
7
7
  excludeFields: a = []
8
- } = r, d = typeof a == "function" ? a : void 0, p = new Set((Array.isArray(a) ? a : []).map(String)), m = new Set((r.fieldsWithRedactedValues ?? []).map(String)), R = new Set(
9
- N(r.optionalFieldsToRequire, i)
10
- ), g = {}, f = [], q = [], w = u;
11
- for (const [n, s] of Object.entries(e)) {
12
- if (p.has(n)) continue;
13
- q.push(n);
14
- const t = w[n] ?? "always";
15
- if (g[n] = P(s), !m.has(n)) {
16
- const o = R.has(n);
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: n,
18
+ name: e,
19
19
  predicate: o ? () => !0 : t
20
- }) : (t === "always" || t === i || o) && f.push({ name: n, predicate: () => !0 });
20
+ }) : (t === "always" || t === s || o) && f.push({ name: e, predicate: () => !0 });
21
21
  }
22
22
  }
23
- const F = f.length > 0 || r.superRefine;
24
- let y = h.object(g);
25
- F && (y = y.superRefine(
26
- (n, s) => {
27
- const t = n, o = d ? new Set(d(t, i).map(String)) : void 0;
28
- for (const { name: l, predicate: E } of f)
29
- o?.has(l) || E(n, i) && S(n[l]) && s.addIssue({
30
- code: h.ZodIssueCode.custom,
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
- r.superRefine?.(t, s);
40
+ n.superRefine?.(t, i);
35
41
  }
36
42
  ));
37
- const x = C(f, i);
38
- function b(n) {
39
- const s = {};
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) ? s[t] = { name: t, isRequired: !0 } : typeof o == "function" ? s[t] = { name: t, isRequired: n ? o(n, i) : !1 } : s[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 === i
45
- }, m.has(t) && (s[t].hasRedactedValue = !0);
50
+ isRequired: o === "always" || o === s
51
+ }, m.has(t) && (i[t].hasRedactedValue = !0);
46
52
  }
47
- return s;
53
+ return i;
48
54
  }
49
55
  return [
50
- y,
51
- { getFieldsMetadata: b, predicateDeps: x }
56
+ h,
57
+ { getFieldsMetadata: E, predicateDeps: b }
52
58
  ];
53
59
  }
54
- function N(e, r) {
55
- return e ? (r === "create" ? e.create : e.update) ?? [] : [];
60
+ function P(r, n) {
61
+ return r ? (n === "create" ? r.create : r.update) ?? [] : [];
56
62
  }
57
- function P(e) {
58
- return h.preprocess((r) => S(r) ? void 0 : r, e.optional());
63
+ function j(r) {
64
+ return y.preprocess((n) => F(n) ? void 0 : n, r.optional());
59
65
  }
60
- function S(e) {
61
- return !!(e == null || typeof e == "string" && e.trim() === "" || typeof e == "number" && Number.isNaN(e));
66
+ function F(r) {
67
+ return !!(r == null || typeof r == "string" && r.trim() === "" || typeof r == "number" && Number.isNaN(r));
62
68
  }
63
- function C(e, r) {
64
- const i = /* @__PURE__ */ new Set();
65
- for (const { predicate: u } of e) {
66
- if (D(u)) continue;
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(d, p) {
74
+ get(u, p) {
69
75
  typeof p == "string" && c.push(p);
70
76
  }
71
77
  });
72
78
  try {
73
- u(a, r);
79
+ d(a, n);
74
80
  } catch {
75
81
  }
76
- for (const d of c) i.add(d);
82
+ for (const u of c) s.add(u);
77
83
  }
78
- return [...i];
84
+ return [...s];
79
85
  }
80
- function D(e) {
81
- const r = [], i = new Proxy({}, {
82
- get(u, c) {
83
- typeof c == "string" && r.push(c);
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
- e(i, "create");
93
+ r(s, "create");
88
94
  } catch {
89
95
  }
90
- return r.length === 0;
96
+ return n.length === 0;
91
97
  }
92
98
  export {
93
- O as buildFormSchema
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,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,IAC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AIwB,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,G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