@gusto/embedded-react-sdk 0.55.8 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
  3. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +43 -42
  4. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -1
  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/EmployeeList/management/ManagementEmployeeListView.js +70 -69
  34. package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -1
  35. package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js +2 -2
  36. package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js.map +1 -1
  37. package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js +51 -42
  38. package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js.map +1 -1
  39. package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js +29 -26
  40. package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js.map +1 -1
  41. package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +2 -2
  42. package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
  43. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +11 -11
  44. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -1
  45. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js +3 -3
  46. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js.map +1 -1
  47. package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +76 -79
  48. package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
  49. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +2 -2
  50. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
  51. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +2 -2
  52. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
  53. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js +10 -10
  54. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -1
  55. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +49 -45
  56. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  57. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +83 -76
  58. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
  59. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +63 -60
  60. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
  61. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +184 -165
  62. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  63. package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js +48 -34
  64. package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js.map +1 -1
  65. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +185 -171
  66. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  67. package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js +45 -34
  68. package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js.map +1 -1
  69. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +44 -44
  70. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  71. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.module.scss.js +14 -14
  72. package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js +16 -16
  73. package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js.map +1 -1
  74. package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js +52 -37
  75. package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js.map +1 -1
  76. package/dist/components/Payroll/usePreparedPayrollData.js +9 -8
  77. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  78. package/dist/contexts/ApiProvider/ApiProvider.js +29 -28
  79. package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
  80. package/dist/contexts/ApiProvider/apiVersionMismatchHook.js +15 -0
  81. package/dist/contexts/ApiProvider/apiVersionMismatchHook.js.map +1 -0
  82. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  83. package/dist/contexts/ThemeProvider/ThemeProvider.js +32 -26
  84. package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
  85. package/dist/hooks/usePollingTask/usePollingTask.js +53 -41
  86. package/dist/hooks/usePollingTask/usePollingTask.js.map +1 -1
  87. package/dist/i18n/en/Employee.ManagementEmployeeList.json.js +28 -24
  88. package/dist/i18n/en/Employee.ManagementEmployeeList.json.js.map +1 -1
  89. package/dist/i18n/en/Payroll.GrossUpModal.json.js +12 -10
  90. package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -1
  91. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +8 -8
  92. package/dist/i18n/en/Payroll.PayrollOverview.json.js +15 -15
  93. package/dist/package.json.js +1 -1
  94. package/dist/src/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +1 -1
  95. package/dist/src/components/Common/UI/DatePicker/DatePickerTypes.d.ts +2 -1
  96. package/dist/src/components/Common/UI/Menu/MenuTypes.d.ts +1 -1
  97. package/dist/src/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.d.ts +1 -1
  98. package/dist/src/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +5 -0
  99. package/dist/src/components/Common/UI/Select/SelectTypes.d.ts +2 -1
  100. package/dist/src/components/Employee/EmployeeList/shared/useEmployeeList.d.ts +7 -2
  101. package/dist/src/components/Employee/EmployeeListFlow/employeeListStateMachine.test.d.ts +1 -0
  102. package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
  103. package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +6 -0
  104. package/dist/src/components/Payroll/PayrollConfiguration/useCalculationPoll.d.ts +6 -1
  105. package/dist/src/components/Payroll/PayrollOverview/useSubmissionPoll.d.ts +10 -1
  106. package/dist/src/contexts/ApiProvider/ApiProvider.d.ts +5 -3
  107. package/dist/src/contexts/ApiProvider/apiVersionMismatchHook.d.ts +3 -0
  108. package/dist/src/contexts/ApiProvider/apiVersionMismatchHook.test.d.ts +1 -0
  109. package/dist/src/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +9 -1
  110. package/dist/src/contexts/ThemeProvider/ThemeProvider.d.ts +8 -3
  111. package/dist/src/hooks/usePollingTask/usePollingTask.d.ts +55 -14
  112. package/dist/src/i18n/types.d.ts +14 -0
  113. package/dist/style.css +1 -1
  114. package/docs/guides/endpoint-inventory.json +5 -0
  115. package/package.json +6 -6
@@ -45,7 +45,15 @@ export interface GustoBaseProviderProps {
45
45
  * Also exposed to custom UI components via `useNonce`.
46
46
  */
47
47
  nonce?: string;
48
- /** Element to use as the portal container for SDK popovers and dropdowns. Useful when rendering inside a modal or shadow root. */
48
+ /**
49
+ * Element to use as the portal container for SDK popovers and dropdowns.
50
+ * Defaults to a themed root element the SDK appends to `document.body`.
51
+ *
52
+ * Pass an element here if rendering inside a modal, or **required** if
53
+ * rendering inside a shadow root — `document.body` sits outside every
54
+ * shadow boundary, so without an explicit container overlays would
55
+ * otherwise escape your shadow root's style encapsulation.
56
+ */
49
57
  portalContainer?: HTMLElement;
50
58
  /** Optional TanStack Query `QueryClient`. When omitted, the SDK creates its own client configured for Gusto's API. */
51
59
  queryClient?: QueryClient;
@@ -6,10 +6,15 @@ export interface ThemeProviderProps {
6
6
  theme?: Partial<GustoSDKTheme>;
7
7
  /**
8
8
  * Element to use as the portal container for all SDK overlays (Select, ComboBox,
9
- * DatePicker, Menu, etc.). Defaults to the SDK's root article element.
9
+ * DatePicker, Menu, etc.). Defaults to a themed root element the SDK appends
10
+ * directly to `document.body`, so overlays are never affected by a host page's
11
+ * `position`, `transform`, `filter`, or `contain` on an intervening ancestor.
12
+ * That default root carries both the `GSDK` and `GSDK-portal-root` classes —
13
+ * the latter lets a host page's own `.GSDK` overrides exclude it
14
+ * (`.GSDK:not(.GSDK-portal-root)`) instead of reaching overlay content.
10
15
  *
11
- * Pass `document.body` (or another stable element outside the SDK's container)
12
- * when your app's scroll or clipping context interferes with overlay positioning.
16
+ * Pass a specific element (e.g. when rendering inside a modal or shadow root)
17
+ * to portal overlays there instead.
13
18
  */
14
19
  portalContainer?: HTMLElement;
15
20
  /** Subtree rendered inside the SDK's themed root element. */
@@ -1,15 +1,54 @@
1
1
  /**
2
2
  * The outcome of evaluating a single poll tick.
3
3
  *
4
+ * @remarks
5
+ * `'done'` (a domain-understood outcome, success or real failure) and `'error'` (the read failed
6
+ * in a way not worth retrying, so the poll never learned what happened) are both terminal but go
7
+ * to different callbacks — `onDone` and `onError` — so callers can't conflate the two.
8
+ *
4
9
  * @typeParam TValue - The terminal value handed to `onDone`.
5
10
  * @internal
6
11
  */
7
12
  export type PollTickResult<TValue> = {
8
- done: true;
13
+ status: 'polling';
14
+ } | {
15
+ status: 'done';
9
16
  value: TValue;
10
17
  } | {
11
- done: false;
18
+ status: 'error';
19
+ error: unknown;
12
20
  };
21
+ /**
22
+ * The result of one poll tick's read — the data it resolved to, or the error it rejected with.
23
+ *
24
+ * @remarks
25
+ * `lastData` (rejection only) is the most recent successfully-read data, or `null` if none has
26
+ * succeeded yet — the same value `onDeadline` receives, and worth verifying against for the same
27
+ * reason.
28
+ *
29
+ * @typeParam TData - The value a successful read resolves to.
30
+ * @internal
31
+ */
32
+ export type PollReadOutcome<TData> = {
33
+ success: true;
34
+ data: TData;
35
+ } | {
36
+ success: false;
37
+ error: unknown;
38
+ lastData: TData | null;
39
+ };
40
+ /**
41
+ * Whether a poll read's error is not worth retrying.
42
+ *
43
+ * @remarks
44
+ * `SDKValidationError` (also matches `ResponseValidationError`) means the response failed schema
45
+ * validation. A 401/403 means the session that started the poll expired mid-poll (SDK-1291) --
46
+ * neither recovers by retrying. Everything else (network blips, timeouts, transient 5xx) may
47
+ * still succeed on the next tick.
48
+ *
49
+ * @internal
50
+ */
51
+ export declare function isNonRetryablePollError(error: unknown): boolean;
13
52
  /**
14
53
  * Configuration for {@link usePollingTask}.
15
54
  *
@@ -18,16 +57,18 @@ export type PollTickResult<TValue> = {
18
57
  * @internal
19
58
  */
20
59
  export interface UsePollingTaskOptions<TData, TValue> {
21
- /** Reads the current server state for one tick. Rejections are tolerated and retried next tick. */
60
+ /** Reads the current server state for one tick. Rejections are passed to `evaluate`, not thrown. */
22
61
  fetch: (signal: AbortSignal) => Promise<TData>;
23
62
  /**
24
- * Decides whether the operation has reached a terminal state, from the data this tick just
25
- * read. Must not depend on rendered state — that dependency is the bug this hook exists to
26
- * avoid.
63
+ * Decides whether the operation has reached a terminal state, from this tick's read outcome.
64
+ * Called on every tick, including ones where `fetch` rejected — see {@link PollReadOutcome} and
65
+ * {@link isNonRetryablePollError}.
27
66
  */
28
- evaluate: (data: TData) => PollTickResult<TValue>;
29
- /** Called once, from the poll loop, when `evaluate` reports a terminal state. */
67
+ evaluate: (outcome: PollReadOutcome<TData>) => PollTickResult<TValue>;
68
+ /** Called once, from the poll loop, when `evaluate` reports a `'done'` terminal state. */
30
69
  onDone: (value: TValue) => void;
70
+ /** Called once, from the poll loop, when `evaluate` reports an `'error'` terminal state. */
71
+ onError: (error: unknown) => void;
31
72
  /**
32
73
  * Called once when `deadlineMs` elapses without a terminal state, with the most recent data
33
74
  * successfully read (or `null` if no read ever succeeded). Verify against that data before
@@ -79,12 +120,12 @@ export interface PollingTask {
79
120
  *
80
121
  * - `start()` reads immediately, then every `intervalMs` after the previous read settles, so a
81
122
  * slow read never stacks up overlapping requests.
82
- * - A rejected read is not a failed task. It is ignored and retried on the next tick, which
83
- * matters because SDK queries are configured with `retry: false`. Note that when `fetch` reads
84
- * through a shared query key, the failure is still recorded on that key, so observers of it
85
- * see the error state even though the task carries on.
86
- * - A terminal result on the deadline tick wins over the deadline, and `onDeadline` receives the
87
- * last data read so the caller can verify before declaring failure.
123
+ * - A rejected read isn't thrown; it's handed to `evaluate` as a {@link PollReadOutcome}, since
124
+ * SDK queries are configured with `retry: false`. See {@link PollTickResult} for how `evaluate`
125
+ * routes a read error to `'polling'` (retry) vs `'error'` (give up). When `fetch` reads through
126
+ * a shared query key, observers of that key still see the error even though the task carries on.
127
+ * - A `'done'` or `'error'` result on the deadline tick wins over the deadline, and `onDeadline`
128
+ * receives the last data read so the caller can verify before declaring failure.
88
129
  * - Each tick bumps internal state, which gives the calling component a render source
89
130
  * independent of any query observer. Fresh cache data is then picked up on that render.
90
131
  * - `stop()` and unmount abort the in-flight read and guarantee no further callbacks fire.
@@ -6121,6 +6121,10 @@ export namespace Translations {
6121
6121
  statusLabel: string
6122
6122
  /** @defaultValue `"Last day"` */
6123
6123
  lastDayLabel: string
6124
+ /** @defaultValue `"Pending dismissal"` */
6125
+ pendingDismissalLabel: string
6126
+ /** @defaultValue `"Last day {{date}}"` */
6127
+ pendingDismissalBadge: string
6124
6128
  /** @defaultValue `"Edit employee"` */
6125
6129
  editCta: string
6126
6130
  /** @defaultValue `"Dismiss employee"` */
@@ -6977,6 +6981,8 @@ export namespace Translations {
6977
6981
  calculatingCta: string
6978
6982
  /** @defaultValue `"Apply"` */
6979
6983
  applyCta: string
6984
+ /** @defaultValue `"Calculate a gross amount first to apply it."` */
6985
+ applyHint: string
6980
6986
  /** @defaultValue `"Cancel"` */
6981
6987
  cancelCta: string
6982
6988
  /** @defaultValue `"Calculated gross pay"` */
@@ -7520,6 +7526,12 @@ export namespace Translations {
7520
7526
  /** @defaultValue `"{{employeeName}} updated successfully"` */
7521
7527
  label: string
7522
7528
  }
7529
+ processingFailed: {
7530
+ /** @defaultValue `"This payroll couldn't be calculated"` */
7531
+ label: string
7532
+ /** @defaultValue `"Please try calculating again."` */
7533
+ message: string
7534
+ }
7523
7535
  }
7524
7536
  /** @defaultValue `"Preparing payroll..."` */
7525
7537
  loadingTitle: string
@@ -7904,6 +7916,8 @@ export namespace Translations {
7904
7916
  alerts: {
7905
7917
  /** @defaultValue `"Payroll is not calculated"` */
7906
7918
  payrollNotCalculated: string
7919
+ /** @defaultValue `"There was an issue loading this payroll. Please try again."` */
7920
+ payrollLoadFailed: string
7907
7921
  /** @defaultValue `"To pay your employees with direct deposit by {{payDate}}, you'll need to run payroll by {{time}} on {{date}}."` */
7908
7922
  directDepositDeadline: string
7909
7923
  /** @defaultValue `"Make sure to submit before the deadline to ensure timely payments."` */