@gusto/embedded-react-sdk 0.55.0 → 0.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/components/Common/TaxInputs/TaxInputs.js +65 -64
- package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Common/UI/Select/Select.module.scss.js +5 -5
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -4
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.d.ts +4 -2
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js +148 -117
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +56 -55
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.d.ts +1 -1
- package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.js +15 -12
- package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.js.map +1 -1
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.d.ts +69 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.js +48 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.js.map +1 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.d.ts +20 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.js +25 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.js.map +1 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.d.ts +20 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.js +24 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.js.map +1 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/index.d.ts +2 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js +16 -15
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +2 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +36 -23
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +10 -8
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +46 -25
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +53 -52
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +37 -47
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +47 -44
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +2 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +65 -53
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js +6 -4
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js.map +1 -1
- package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.d.ts +1 -1
- package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.js +22 -19
- package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.js.map +1 -1
- package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.d.ts +2 -8
- package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.js +43 -42
- package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.js.map +1 -1
- package/dist/components/Contractor/Payments/shared/paymentAmounts.d.ts +32 -0
- package/dist/components/Contractor/Payments/shared/paymentAmounts.js +11 -0
- package/dist/components/Contractor/Payments/shared/paymentAmounts.js.map +1 -0
- package/dist/components/Contractor/Payments/shared/paymentAmounts.test.d.ts +1 -0
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.d.ts +13 -4
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.js +43 -38
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.js.map +1 -1
- package/dist/components/Contractor/exports/contractorManagement.d.ts +1 -0
- package/dist/components/Contractor/exports/contractorManagement.js +34 -32
- package/dist/components/Contractor/exports/contractorManagement.js.map +1 -1
- package/dist/components/Contractor/shared/SelectContractors/SelectContractors.d.ts +6 -1
- package/dist/components/Contractor/shared/SelectContractors/SelectContractors.js +13 -12
- package/dist/components/Contractor/shared/SelectContractors/SelectContractors.js.map +1 -1
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.d.ts +5 -1
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js +34 -32
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
- package/dist/components/Flow/Flow.js +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +2 -3
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +8 -9
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +6 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +36 -34
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.d.ts +22 -0
- package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.js +14 -0
- package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.js.map +1 -0
- package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.d.ts +19 -0
- package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.js +8 -0
- package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.js.map +1 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +41 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js +14 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/i18n/en/Contractor.Payments.CreateHistoricalPayment.json.js +34 -32
- package/dist/i18n/en/Contractor.Payments.CreateHistoricalPayment.json.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +20 -18
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js.map +1 -1
- package/dist/i18n/en/common.json.d.ts +0 -21
- package/dist/i18n/types.d.ts +10 -2
- package/dist/shared/constants.d.ts +2 -0
- package/dist/shared/constants.js +1 -0
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/test-utils/renderWithProviders.d.ts +4 -1
- package/dist/test-utils/tableQueries.d.ts +9 -0
- package/docs/guides/endpoint-inventory.json +7 -0
- package/package.json +18 -18
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { ErrorBoundary as
|
|
3
|
-
import { I18nextProvider as
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { ComponentsProvider as
|
|
6
|
-
import { ApiProvider as
|
|
7
|
-
import { LoadingIndicatorProvider as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { ErrorBoundary as k } from "react-error-boundary";
|
|
3
|
+
import { I18nextProvider as C } from "react-i18next";
|
|
4
|
+
import { useEffect as S, useMemo as x } from "react";
|
|
5
|
+
import { ComponentsProvider as I } from "../ComponentAdapter/ComponentsProvider.js";
|
|
6
|
+
import { ApiProvider as L } from "../ApiProvider/ApiProvider.js";
|
|
7
|
+
import { LoadingIndicatorProvider as U } from "../LoadingIndicatorProvider/LoadingIndicatorProvider.js";
|
|
8
8
|
import { sanitizeError as z } from "../ObservabilityProvider/sanitization.js";
|
|
9
|
+
import { UnstableFeaturesProvider as D } from "../UnstableFeaturesProvider/UnstableFeaturesProvider.js";
|
|
9
10
|
import { SDKI18next as m } from "./SDKI18next.js";
|
|
10
|
-
import { InternalError as
|
|
11
|
-
import { LocaleProvider as
|
|
11
|
+
import { InternalError as F } from "../../components/Common/InternalError/InternalError.js";
|
|
12
|
+
import { LocaleProvider as T } from "../LocaleProvider/LocaleProvider.js";
|
|
12
13
|
import "../LocaleProvider/useLocale.js";
|
|
13
|
-
import { ThemeProvider as
|
|
14
|
-
import { normalizeToSDKError as
|
|
15
|
-
import { NonceContext as
|
|
16
|
-
import { ObservabilityProvider as
|
|
17
|
-
function
|
|
14
|
+
import { ThemeProvider as w } from "../ThemeProvider/ThemeProvider.js";
|
|
15
|
+
import { normalizeToSDKError as A } from "../../types/sdkError.js";
|
|
16
|
+
import { NonceContext as B } from "../NonceProvider/useNonce.js";
|
|
17
|
+
import { ObservabilityProvider as K } from "../ObservabilityProvider/ObservabilityProvider.js";
|
|
18
|
+
function rr(l) {
|
|
18
19
|
const {
|
|
19
20
|
children: s,
|
|
20
|
-
config:
|
|
21
|
+
config: o,
|
|
21
22
|
dictionary: i,
|
|
22
23
|
lng: n = "en",
|
|
23
24
|
locale: c = "en-US",
|
|
24
25
|
currency: d = "USD",
|
|
25
26
|
theme: p,
|
|
26
27
|
nonce: v,
|
|
27
|
-
portalContainer:
|
|
28
|
-
components:
|
|
28
|
+
portalContainer: u,
|
|
29
|
+
components: f,
|
|
29
30
|
LoaderComponent: b,
|
|
30
|
-
queryClient: h
|
|
31
|
+
queryClient: h,
|
|
32
|
+
unstableFeatures: y
|
|
31
33
|
} = l;
|
|
32
34
|
if (i)
|
|
33
35
|
for (const t in i) {
|
|
@@ -41,33 +43,33 @@ function Z(l) {
|
|
|
41
43
|
!0
|
|
42
44
|
);
|
|
43
45
|
}
|
|
44
|
-
|
|
46
|
+
S(() => {
|
|
45
47
|
(async () => await m.changeLanguage(n))();
|
|
46
48
|
}, [n]);
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
+
const E = x(() => {
|
|
50
|
+
if (o.observability?.onError)
|
|
49
51
|
return (t, e) => {
|
|
50
|
-
if (!
|
|
51
|
-
const
|
|
52
|
-
...
|
|
52
|
+
if (!o.observability?.onError) return;
|
|
53
|
+
const P = {
|
|
54
|
+
...A(t),
|
|
53
55
|
timestamp: Date.now(),
|
|
54
56
|
componentStack: e.componentStack ?? void 0
|
|
55
|
-
}, g = z(
|
|
56
|
-
|
|
57
|
+
}, g = z(P, o.observability.sanitization);
|
|
58
|
+
o.observability.onError(g);
|
|
57
59
|
};
|
|
58
|
-
}, [
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
|
|
60
|
+
}, [o.observability]);
|
|
61
|
+
return /* @__PURE__ */ r(B.Provider, { value: v, children: /* @__PURE__ */ r(I, { value: f, children: /* @__PURE__ */ r(U, { value: b, children: /* @__PURE__ */ r(K, { observability: o.observability, children: /* @__PURE__ */ r(k, { FallbackComponent: F, onError: E, children: /* @__PURE__ */ r(w, { theme: p, portalContainer: u, children: /* @__PURE__ */ r(T, { locale: c, currency: d, children: /* @__PURE__ */ r(C, { i18n: m, children: /* @__PURE__ */ r(
|
|
62
|
+
L,
|
|
61
63
|
{
|
|
62
|
-
url:
|
|
63
|
-
headers:
|
|
64
|
-
hooks:
|
|
64
|
+
url: o.baseUrl,
|
|
65
|
+
headers: o.headers,
|
|
66
|
+
hooks: o.hooks,
|
|
65
67
|
queryClient: h,
|
|
66
|
-
children: s
|
|
68
|
+
children: /* @__PURE__ */ r(D, { value: y, children: s })
|
|
67
69
|
}
|
|
68
70
|
) }, n) }) }) }) }) }) }) });
|
|
69
71
|
}
|
|
70
72
|
export {
|
|
71
|
-
|
|
73
|
+
rr as GustoProviderCustomUIAdapter
|
|
72
74
|
};
|
|
73
75
|
//# sourceMappingURL=GustoProviderCustomUIAdapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport type { ErrorInfo, JSX, ReactNode } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect, useMemo } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport { ObservabilityProvider } from '../ObservabilityProvider'\nimport { sanitizeError } from '../ObservabilityProvider/sanitization'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { NonceContext } from '@/contexts/NonceProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GustoSDKTheme } from '@/contexts/ThemeProvider/theme'\nimport type { GlobalResourceDictionary, SupportedLanguages } from '@/types/Helpers'\nimport type { SDKHooks } from '@/types/hooks'\nimport type { ObservabilityHook } from '@/types/observability'\nimport { normalizeToSDKError } from '@/types/sdkError'\n\n/**\n * API client configuration passed to {@link GustoProvider} (and {@link GustoProviderCustomUIAdapter}).\n *\n * @public\n */\nexport interface APIConfig {\n /** URL of your backend proxy that forwards SDK requests to the Gusto Embedded API. SDK components never call Gusto directly. */\n baseUrl: string\n /** Extra headers applied to every API request. Combined with any headers your proxy adds. */\n headers?: HeadersInit\n /** Request interceptor hooks. Use these to inspect, modify, or react to requests and responses. See {@link SDKHooks}. */\n hooks?: SDKHooks\n /** Observability hook for surfacing errors and metrics from the SDK to your monitoring stack. See {@link ObservabilityHook}. */\n observability?: ObservabilityHook\n}\n\n/**\n * Shared configuration props accepted by {@link GustoProvider} and {@link GustoProviderCustomUIAdapter}.\n *\n * @public\n */\nexport interface GustoBaseProviderProps {\n /** API client configuration, including the proxy `baseUrl`, request hooks, and observability. See {@link APIConfig}. */\n config: APIConfig\n /** Translation overrides keyed by language and i18next namespace. Strings supplied here replace the SDK defaults for the matching keys. */\n dictionary?: GlobalResourceDictionary\n /** Active i18next language. Defaults to `'en'`. */\n lng?: string\n /** BCP 47 locale used for number, date, and currency formatting throughout the SDK. Defaults to `'en-US'`. */\n locale?: string\n /** ISO 4217 currency code used for monetary formatting. Defaults to `'USD'`. */\n currency?: string\n /** Theme overrides applied to SDK components. See {@link GustoSDKTheme}. */\n theme?: Partial<GustoSDKTheme>\n /**\n * CSP nonce to apply to runtime-injected `<style>` elements (theming, PDF download window).\n * Pass the same per-request nonce your app uses in its `style-src 'nonce-…'` directive.\n * Also exposed to custom UI components via `useNonce`.\n */\n nonce?: string\n /** Element to use as the portal container for SDK popovers and dropdowns. Useful when rendering inside a modal or shadow root. */\n portalContainer?: HTMLElement\n /** Optional TanStack Query `QueryClient`. When omitted, the SDK creates its own client configured for Gusto's API. */\n queryClient?: QueryClient\n /** Complete map of UI components the SDK renders. Required because this adapter ships no defaults. */\n components: ComponentsContextType\n /** Loading indicator rendered while SDK queries are pending. Overrides the SDK default spinner. */\n LoaderComponent?: ({ children }: { children?: ReactNode }) => JSX.Element\n}\n\n/**\n * Props for {@link GustoProviderCustomUIAdapter}.\n *\n * @public\n */\nexport interface GustoProviderCustomUIAdapterProps extends GustoBaseProviderProps {\n /** The application tree that should have access to the SDK. */\n children?: React.ReactNode\n}\n\n/**\n * Top-level provider that requires a complete component map and ships no UI defaults.\n *\n * @remarks\n * Use this adapter when you want full control over every UI primitive the SDK renders, or when\n * you want to avoid the React Aria dependency for tree-shaking. Unlike {@link GustoProvider}, the\n * `components` prop on {@link GustoProviderProps} is required and must supply every component the\n * SDK renders.\n *\n * @param props - See {@link GustoProviderCustomUIAdapterProps}.\n * @returns The configured provider tree wrapping `children`.\n * @public\n * @group Providers\n */\nexport function GustoProviderCustomUIAdapter(props: GustoProviderCustomUIAdapterProps) {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n nonce,\n portalContainer,\n components,\n LoaderComponent,\n queryClient,\n } = props\n\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n const handleTopLevelError = useMemo(() => {\n if (!config.observability?.onError) return undefined\n\n return (error: unknown, errorInfo: ErrorInfo) => {\n if (!config.observability?.onError) return\n\n const sdkError = normalizeToSDKError(error)\n\n const observabilityError = {\n ...sdkError,\n timestamp: Date.now(),\n componentStack: errorInfo.componentStack ?? undefined,\n }\n\n const sanitizedError = sanitizeError(observabilityError, config.observability.sanitization)\n\n config.observability.onError(sanitizedError)\n }\n }, [config.observability])\n return (\n <NonceContext.Provider value={nonce}>\n <ComponentsProvider value={components}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ObservabilityProvider observability={config.observability}>\n <ErrorBoundary FallbackComponent={InternalError} onError={handleTopLevelError}>\n <ThemeProvider theme={theme} portalContainer={portalContainer}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider\n url={config.baseUrl}\n headers={config.headers}\n hooks={config.hooks}\n queryClient={queryClient}\n >\n {children}\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </ObservabilityProvider>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n </NonceContext.Provider>\n )\n}\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","nonce","portalContainer","components","LoaderComponent","queryClient","language","lang","ns","SDKI18next","useEffect","handleTopLevelError","useMemo","error","errorInfo","observabilityError","normalizeToSDKError","sanitizedError","sanitizeError","NonceContext","jsx","ComponentsProvider","LoadingIndicatorProvider","ObservabilityProvider","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider"],"mappings":";;;;;;;;;;;;;;;;AAiGO,SAASA,EAA6BC,GAA0C;AACrF,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,aAAAC;AAAA,EAAA,IACEZ;AAEJ,MAAIG;AACF,eAAWU,KAAYV,GAAY;AACjC,YAAMW,IAAOD;AACb,iBAAWE,KAAMZ,EAAWW,CAAI;AAC9B,QAAAE,EAAW;AAAA,UACTF;AAAA,UACAC;AAAA,UACCZ,EAAWW,CAAI,EAA8BC,CAAE;AAAA,UAChD;AAAA,UACA;AAAA,QAAA;AAAA,IAGN;AAGF,EAAAE,EAAU,MAAM;AACd,KAAM,YACJ,MAAMD,EAAW,eAAeZ,CAAG;AAAA,EAEvC,GAAG,CAACA,CAAG,CAAC;AAER,QAAMc,IAAsBC,EAAQ,MAAM;AACxC,QAAKjB,EAAO,eAAe;AAE3B,aAAO,CAACkB,GAAgBC,MAAyB;AAC/C,YAAI,CAACnB,EAAO,eAAe,QAAS;AAIpC,cAAMoB,IAAqB;AAAA,UACzB,GAHeC,EAAoBH,CAAK;AAAA,UAIxC,WAAW,KAAK,IAAA;AAAA,UAChB,gBAAgBC,EAAU,kBAAkB;AAAA,QAAA,GAGxCG,IAAiBC,EAAcH,GAAoBpB,EAAO,cAAc,YAAY;AAE1F,QAAAA,EAAO,cAAc,QAAQsB,CAAc;AAAA,MAC7C;AAAA,EACF,GAAG,CAACtB,EAAO,aAAa,CAAC;AACzB,2BACGwB,EAAa,UAAb,EAAsB,OAAOlB,GAC5B,UAAA,gBAAAmB,EAACC,GAAA,EAAmB,OAAOlB,GACzB,4BAACmB,GAAA,EAAyB,OAAOlB,GAC/B,UAAA,gBAAAgB,EAACG,KAAsB,eAAe5B,EAAO,eAC3C,UAAA,gBAAAyB,EAACI,KAAc,mBAAmBC,GAAe,SAASd,GACxD,4BAACe,GAAA,EAAc,OAAA1B,GAAc,iBAAAE,GAC3B,UAAA,gBAAAkB,EAACO,KAAe,QAAA7B,GAAgB,UAAAC,GAC9B,UAAA,gBAAAqB,EAACQ,GAAA,EAAgB,MAAMnB,GACrB,UAAA,gBAAAW;AAAA,IAACS;AAAA,IAAA;AAAA,MACC,KAAKlC,EAAO;AAAA,MACZ,SAASA,EAAO;AAAA,MAChB,OAAOA,EAAO;AAAA,MACd,aAAAU;AAAA,MAEC,UAAAX;AAAA,IAAA;AAAA,EAAA,KAPmCG,CASxC,EAAA,CACF,EAAA,CACF,GACF,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"GustoProviderCustomUIAdapter.js","sources":["../../../src/contexts/GustoProvider/GustoProviderCustomUIAdapter.tsx"],"sourcesContent":["import type React from 'react'\nimport type { ErrorInfo, JSX, ReactNode } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { I18nextProvider } from 'react-i18next'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useEffect, useMemo } from 'react'\nimport { ComponentsProvider } from '../ComponentAdapter/ComponentsProvider'\nimport type { ComponentsContextType } from '../ComponentAdapter/useComponentContext'\nimport { ApiProvider } from '../ApiProvider/ApiProvider'\nimport { LoadingIndicatorProvider } from '../LoadingIndicatorProvider/LoadingIndicatorProvider'\nimport { ObservabilityProvider } from '../ObservabilityProvider'\nimport { sanitizeError } from '../ObservabilityProvider/sanitization'\nimport { UnstableFeaturesProvider } from '../UnstableFeaturesProvider/UnstableFeaturesProvider'\nimport type { UnstableFeatures } from '../UnstableFeaturesProvider/useUnstableFeature'\nimport { SDKI18next } from './SDKI18next'\nimport { InternalError } from '@/components/Common'\nimport { LocaleProvider } from '@/contexts/LocaleProvider'\nimport { NonceContext } from '@/contexts/NonceProvider'\nimport { ThemeProvider } from '@/contexts/ThemeProvider'\nimport type { GustoSDKTheme } from '@/contexts/ThemeProvider/theme'\nimport type { GlobalResourceDictionary, SupportedLanguages } from '@/types/Helpers'\nimport type { SDKHooks } from '@/types/hooks'\nimport type { ObservabilityHook } from '@/types/observability'\nimport { normalizeToSDKError } from '@/types/sdkError'\n\n/**\n * API client configuration passed to {@link GustoProvider} (and {@link GustoProviderCustomUIAdapter}).\n *\n * @public\n */\nexport interface APIConfig {\n /** URL of your backend proxy that forwards SDK requests to the Gusto Embedded API. SDK components never call Gusto directly. */\n baseUrl: string\n /** Extra headers applied to every API request. Combined with any headers your proxy adds. */\n headers?: HeadersInit\n /** Request interceptor hooks. Use these to inspect, modify, or react to requests and responses. See {@link SDKHooks}. */\n hooks?: SDKHooks\n /** Observability hook for surfacing errors and metrics from the SDK to your monitoring stack. See {@link ObservabilityHook}. */\n observability?: ObservabilityHook\n}\n\n/**\n * Shared configuration props accepted by {@link GustoProvider} and {@link GustoProviderCustomUIAdapter}.\n *\n * @public\n */\nexport interface GustoBaseProviderProps {\n /** API client configuration, including the proxy `baseUrl`, request hooks, and observability. See {@link APIConfig}. */\n config: APIConfig\n /** Translation overrides keyed by language and i18next namespace. Strings supplied here replace the SDK defaults for the matching keys. */\n dictionary?: GlobalResourceDictionary\n /** Active i18next language. Defaults to `'en'`. */\n lng?: string\n /** BCP 47 locale used for number, date, and currency formatting throughout the SDK. Defaults to `'en-US'`. */\n locale?: string\n /** ISO 4217 currency code used for monetary formatting. Defaults to `'USD'`. */\n currency?: string\n /** Theme overrides applied to SDK components. See {@link GustoSDKTheme}. */\n theme?: Partial<GustoSDKTheme>\n /**\n * CSP nonce to apply to runtime-injected `<style>` elements (theming, PDF download window).\n * Pass the same per-request nonce your app uses in its `style-src 'nonce-…'` directive.\n * Also exposed to custom UI components via `useNonce`.\n */\n nonce?: string\n /** Element to use as the portal container for SDK popovers and dropdowns. Useful when rendering inside a modal or shadow root. */\n portalContainer?: HTMLElement\n /** Optional TanStack Query `QueryClient`. When omitted, the SDK creates its own client configured for Gusto's API. */\n queryClient?: QueryClient\n /** Complete map of UI components the SDK renders. Required because this adapter ships no defaults. */\n components: ComponentsContextType\n /** Loading indicator rendered while SDK queries are pending. Overrides the SDK default spinner. */\n LoaderComponent?: ({ children }: { children?: ReactNode }) => JSX.Element\n /**\n * Opt-in flags for alpha SDK functionality. See {@link UnstableFeatures}.\n * @alpha\n */\n unstableFeatures?: UnstableFeatures\n}\n\n/**\n * Props for {@link GustoProviderCustomUIAdapter}.\n *\n * @public\n */\nexport interface GustoProviderCustomUIAdapterProps extends GustoBaseProviderProps {\n /** The application tree that should have access to the SDK. */\n children?: React.ReactNode\n}\n\n/**\n * Top-level provider that requires a complete component map and ships no UI defaults.\n *\n * @remarks\n * Use this adapter when you want full control over every UI primitive the SDK renders, or when\n * you want to avoid the React Aria dependency for tree-shaking. Unlike {@link GustoProvider}, the\n * `components` prop on {@link GustoProviderProps} is required and must supply every component the\n * SDK renders.\n *\n * @param props - See {@link GustoProviderCustomUIAdapterProps}.\n * @returns The configured provider tree wrapping `children`.\n * @public\n * @group Providers\n */\nexport function GustoProviderCustomUIAdapter(props: GustoProviderCustomUIAdapterProps) {\n const {\n children,\n config,\n dictionary,\n lng = 'en',\n locale = 'en-US',\n currency = 'USD',\n theme,\n nonce,\n portalContainer,\n components,\n LoaderComponent,\n queryClient,\n unstableFeatures,\n } = props\n\n if (dictionary) {\n for (const language in dictionary) {\n const lang = language as SupportedLanguages\n for (const ns in dictionary[lang]) {\n SDKI18next.addResourceBundle(\n lang,\n ns,\n (dictionary[lang] as Record<string, unknown>)[ns],\n true,\n true,\n )\n }\n }\n }\n\n useEffect(() => {\n void (async () => {\n await SDKI18next.changeLanguage(lng)\n })()\n }, [lng])\n\n const handleTopLevelError = useMemo(() => {\n if (!config.observability?.onError) return undefined\n\n return (error: unknown, errorInfo: ErrorInfo) => {\n if (!config.observability?.onError) return\n\n const sdkError = normalizeToSDKError(error)\n\n const observabilityError = {\n ...sdkError,\n timestamp: Date.now(),\n componentStack: errorInfo.componentStack ?? undefined,\n }\n\n const sanitizedError = sanitizeError(observabilityError, config.observability.sanitization)\n\n config.observability.onError(sanitizedError)\n }\n }, [config.observability])\n return (\n <NonceContext.Provider value={nonce}>\n <ComponentsProvider value={components}>\n <LoadingIndicatorProvider value={LoaderComponent}>\n <ObservabilityProvider observability={config.observability}>\n <ErrorBoundary FallbackComponent={InternalError} onError={handleTopLevelError}>\n <ThemeProvider theme={theme} portalContainer={portalContainer}>\n <LocaleProvider locale={locale} currency={currency}>\n <I18nextProvider i18n={SDKI18next} key={lng}>\n <ApiProvider\n url={config.baseUrl}\n headers={config.headers}\n hooks={config.hooks}\n queryClient={queryClient}\n >\n <UnstableFeaturesProvider value={unstableFeatures}>\n {children}\n </UnstableFeaturesProvider>\n </ApiProvider>\n </I18nextProvider>\n </LocaleProvider>\n </ThemeProvider>\n </ErrorBoundary>\n </ObservabilityProvider>\n </LoadingIndicatorProvider>\n </ComponentsProvider>\n </NonceContext.Provider>\n )\n}\n"],"names":["GustoProviderCustomUIAdapter","props","children","config","dictionary","lng","locale","currency","theme","nonce","portalContainer","components","LoaderComponent","queryClient","unstableFeatures","language","lang","ns","SDKI18next","useEffect","handleTopLevelError","useMemo","error","errorInfo","observabilityError","normalizeToSDKError","sanitizedError","sanitizeError","NonceContext","jsx","ComponentsProvider","LoadingIndicatorProvider","ObservabilityProvider","ErrorBoundary","InternalError","ThemeProvider","LocaleProvider","I18nextProvider","ApiProvider","UnstableFeaturesProvider"],"mappings":";;;;;;;;;;;;;;;;;AAwGO,SAASA,GAA6BC,GAA0C;AACrF,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,kBAAAC;AAAA,EAAA,IACEb;AAEJ,MAAIG;AACF,eAAWW,KAAYX,GAAY;AACjC,YAAMY,IAAOD;AACb,iBAAWE,KAAMb,EAAWY,CAAI;AAC9B,QAAAE,EAAW;AAAA,UACTF;AAAA,UACAC;AAAA,UACCb,EAAWY,CAAI,EAA8BC,CAAE;AAAA,UAChD;AAAA,UACA;AAAA,QAAA;AAAA,IAGN;AAGF,EAAAE,EAAU,MAAM;AACd,KAAM,YACJ,MAAMD,EAAW,eAAeb,CAAG;AAAA,EAEvC,GAAG,CAACA,CAAG,CAAC;AAER,QAAMe,IAAsBC,EAAQ,MAAM;AACxC,QAAKlB,EAAO,eAAe;AAE3B,aAAO,CAACmB,GAAgBC,MAAyB;AAC/C,YAAI,CAACpB,EAAO,eAAe,QAAS;AAIpC,cAAMqB,IAAqB;AAAA,UACzB,GAHeC,EAAoBH,CAAK;AAAA,UAIxC,WAAW,KAAK,IAAA;AAAA,UAChB,gBAAgBC,EAAU,kBAAkB;AAAA,QAAA,GAGxCG,IAAiBC,EAAcH,GAAoBrB,EAAO,cAAc,YAAY;AAE1F,QAAAA,EAAO,cAAc,QAAQuB,CAAc;AAAA,MAC7C;AAAA,EACF,GAAG,CAACvB,EAAO,aAAa,CAAC;AACzB,2BACGyB,EAAa,UAAb,EAAsB,OAAOnB,GAC5B,UAAA,gBAAAoB,EAACC,GAAA,EAAmB,OAAOnB,GACzB,4BAACoB,GAAA,EAAyB,OAAOnB,GAC/B,UAAA,gBAAAiB,EAACG,KAAsB,eAAe7B,EAAO,eAC3C,UAAA,gBAAA0B,EAACI,KAAc,mBAAmBC,GAAe,SAASd,GACxD,4BAACe,GAAA,EAAc,OAAA3B,GAAc,iBAAAE,GAC3B,UAAA,gBAAAmB,EAACO,KAAe,QAAA9B,GAAgB,UAAAC,GAC9B,UAAA,gBAAAsB,EAACQ,GAAA,EAAgB,MAAMnB,GACrB,UAAA,gBAAAW;AAAA,IAACS;AAAA,IAAA;AAAA,MACC,KAAKnC,EAAO;AAAA,MACZ,SAASA,EAAO;AAAA,MAChB,OAAOA,EAAO;AAAA,MACd,aAAAU;AAAA,MAEA,UAAA,gBAAAgB,EAACU,GAAA,EAAyB,OAAOzB,GAC9B,UAAAZ,EAAA,CACH;AAAA,IAAA;AAAA,EAAA,KAToCG,CAWxC,EAAA,CACF,EAAA,CACF,GACF,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { UnstableFeatures } from './useUnstableFeature';
|
|
3
|
+
/** @internal */
|
|
4
|
+
export interface UnstableFeaturesProviderProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
value?: UnstableFeatures;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Provides the {@link UnstableFeatures} flags to SDK components via {@link UnstableFeaturesContext}.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Composed by `GustoProvider` so the `unstableFeatures` prop flows down to any SDK Flow or Block
|
|
13
|
+
* that checks {@link useUnstableFeature} before rendering alpha functionality. The context
|
|
14
|
+
* value is keyed on its sorted, serialized content rather than the `value` object's identity —
|
|
15
|
+
* the returned reference only changes when a flag's value actually changes, and adding a new flag to
|
|
16
|
+
* {@link UnstableFeatures} needs no update here.
|
|
17
|
+
*
|
|
18
|
+
* @param props - See {@link UnstableFeaturesProviderProps}.
|
|
19
|
+
* @returns A React subtree with the unstable-features context applied.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function UnstableFeaturesProvider({ children, value }: UnstableFeaturesProviderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as u } from "react";
|
|
3
|
+
import { UnstableFeaturesContext as a } from "./useUnstableFeature.js";
|
|
4
|
+
function f({ children: o, value: s }) {
|
|
5
|
+
const e = s ?? {}, r = JSON.stringify(e, Object.keys(e).sort()), t = u({
|
|
6
|
+
key: r,
|
|
7
|
+
value: e
|
|
8
|
+
});
|
|
9
|
+
return t.current.key !== r && (t.current = { key: r, value: e }), /* @__PURE__ */ n(a.Provider, { value: t.current.value, children: o });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
f as UnstableFeaturesProvider
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=UnstableFeaturesProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnstableFeaturesProvider.js","sources":["../../../src/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useRef } from 'react'\nimport { UnstableFeaturesContext, type UnstableFeatures } from './useUnstableFeature'\n\n/** @internal */\nexport interface UnstableFeaturesProviderProps {\n children: ReactNode\n value?: UnstableFeatures\n}\n\n/**\n * Provides the {@link UnstableFeatures} flags to SDK components via {@link UnstableFeaturesContext}.\n *\n * @remarks\n * Composed by `GustoProvider` so the `unstableFeatures` prop flows down to any SDK Flow or Block\n * that checks {@link useUnstableFeature} before rendering alpha functionality. The context\n * value is keyed on its sorted, serialized content rather than the `value` object's identity —\n * the returned reference only changes when a flag's value actually changes, and adding a new flag to\n * {@link UnstableFeatures} needs no update here.\n *\n * @param props - See {@link UnstableFeaturesProviderProps}.\n * @returns A React subtree with the unstable-features context applied.\n * @internal\n */\nexport function UnstableFeaturesProvider({ children, value }: UnstableFeaturesProviderProps) {\n const resolvedValue = value ?? {}\n const key = JSON.stringify(resolvedValue, Object.keys(resolvedValue).sort())\n\n const stableRef = useRef<{ key: string; value: UnstableFeatures }>({\n key,\n value: resolvedValue,\n })\n if (stableRef.current.key !== key) {\n stableRef.current = { key, value: resolvedValue }\n }\n\n return (\n <UnstableFeaturesContext.Provider value={stableRef.current.value}>\n {children}\n </UnstableFeaturesContext.Provider>\n )\n}\n"],"names":["UnstableFeaturesProvider","children","value","resolvedValue","key","stableRef","useRef","jsx","UnstableFeaturesContext"],"mappings":";;;AAwBO,SAASA,EAAyB,EAAE,UAAAC,GAAU,OAAAC,KAAwC;AAC3F,QAAMC,IAAgBD,KAAS,CAAA,GACzBE,IAAM,KAAK,UAAUD,GAAe,OAAO,KAAKA,CAAa,EAAE,MAAM,GAErEE,IAAYC,EAAiD;AAAA,IACjE,KAAAF;AAAA,IACA,OAAOD;AAAA,EAAA,CACR;AACD,SAAIE,EAAU,QAAQ,QAAQD,MAC5BC,EAAU,UAAU,EAAE,KAAAD,GAAK,OAAOD,EAAA,IAIlC,gBAAAI,EAACC,EAAwB,UAAxB,EAAiC,OAAOH,EAAU,QAAQ,OACxD,UAAAJ,GACH;AAEJ;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { UnstableFeatures } from './useUnstableFeature';
|
|
3
|
+
/** @internal */
|
|
4
|
+
export interface WithUnstableFeatureProps {
|
|
5
|
+
feature: keyof UnstableFeatures;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders `children` only when `feature` is enabled in {@link UnstableFeatures}.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* `null` is a silent no-op, not an error — this gates new UX inside an already-released
|
|
13
|
+
* component, so the flag being off must leave that component's public behavior unchanged.
|
|
14
|
+
*
|
|
15
|
+
* @param props - See {@link WithUnstableFeatureProps}.
|
|
16
|
+
* @returns `children` when the flag is enabled, otherwise `null`.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function WithUnstableFeature({ feature, children }: WithUnstableFeatureProps): ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WithUnstableFeature.js","sources":["../../../src/contexts/UnstableFeaturesProvider/WithUnstableFeature.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useUnstableFeature, type UnstableFeatures } from './useUnstableFeature'\n\n/** @internal */\nexport interface WithUnstableFeatureProps {\n feature: keyof UnstableFeatures\n children: ReactNode\n}\n\n/**\n * Renders `children` only when `feature` is enabled in {@link UnstableFeatures}.\n *\n * @remarks\n * `null` is a silent no-op, not an error — this gates new UX inside an already-released\n * component, so the flag being off must leave that component's public behavior unchanged.\n *\n * @param props - See {@link WithUnstableFeatureProps}.\n * @returns `children` when the flag is enabled, otherwise `null`.\n * @internal\n */\nexport function WithUnstableFeature({ feature, children }: WithUnstableFeatureProps) {\n const isEnabled = useUnstableFeature(feature)\n return isEnabled ? children : null\n}\n"],"names":["WithUnstableFeature","feature","children","useUnstableFeature"],"mappings":";AAoBO,SAASA,EAAoB,EAAE,SAAAC,GAAS,UAAAC,KAAsC;AAEnF,SADkBC,EAAmBF,CAAO,IACzBC,IAAW;AAChC;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in flags for SDK functionality that is still in active development.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Pass to {@link GustoProvider} via the `unstableFeatures` prop to enable a feature ahead of its
|
|
6
|
+
* public release. Every flag defaults to disabled when omitted. When a feature graduates to
|
|
7
|
+
* public release, its flag is deleted from this interface along with the conditional checks that
|
|
8
|
+
* read it — there is no deprecation step. This interface may have no flags at all at any given
|
|
9
|
+
* time — e.g. immediately after the last active flag graduates and before the next one is added —
|
|
10
|
+
* the opt-in mechanism itself is permanent even when nothing is currently gated behind it.
|
|
11
|
+
*
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export interface UnstableFeatures {
|
|
15
|
+
/** Enables recording past payments to contractors within the `ContractorManagement` flows. */
|
|
16
|
+
historicalPayments?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* React context backing {@link useUnstableFeature}.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare const UnstableFeaturesContext: import('react').Context<UnstableFeatures>;
|
|
24
|
+
/**
|
|
25
|
+
* Reads whether `feature` is enabled via {@link GustoProvider}'s `unstableFeatures` prop.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* With `throwIfDisabled: true`, call unconditionally at the top of an alpha component's body —
|
|
29
|
+
* not inside {@link WithUnstableFeature} — so mounting the component without opting in fails
|
|
30
|
+
* loudly and immediately. This throws in every environment, including production: using an alpha
|
|
31
|
+
* component without its flag is an integration mistake, not a runtime state, the same as
|
|
32
|
+
* {@link useComponentContext} throwing when called outside a `ComponentsProvider`.
|
|
33
|
+
*
|
|
34
|
+
* @param feature - The {@link UnstableFeatures} flag to read.
|
|
35
|
+
* @param options - Set `throwIfDisabled` to throw instead of returning `false` when `feature` is disabled.
|
|
36
|
+
* @throws When `options.throwIfDisabled` is set and `feature` is not enabled.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare const useUnstableFeature: (feature: keyof UnstableFeatures, options?: {
|
|
40
|
+
throwIfDisabled?: boolean;
|
|
41
|
+
}) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useContext as s, createContext as o } from "react";
|
|
2
|
+
const a = o({}), l = (e, r = { throwIfDisabled: !1 }) => {
|
|
3
|
+
const t = !!s(a)[e];
|
|
4
|
+
if (r.throwIfDisabled && !t)
|
|
5
|
+
throw new Error(
|
|
6
|
+
`This component requires the unstable feature flag "${e}" to be enabled via GustoProvider's \`unstableFeatures\` prop.`
|
|
7
|
+
);
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
a as UnstableFeaturesContext,
|
|
12
|
+
l as useUnstableFeature
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useUnstableFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnstableFeature.js","sources":["../../../src/contexts/UnstableFeaturesProvider/useUnstableFeature.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\n/**\n * Opt-in flags for SDK functionality that is still in active development.\n *\n * @remarks\n * Pass to {@link GustoProvider} via the `unstableFeatures` prop to enable a feature ahead of its\n * public release. Every flag defaults to disabled when omitted. When a feature graduates to\n * public release, its flag is deleted from this interface along with the conditional checks that\n * read it — there is no deprecation step. This interface may have no flags at all at any given\n * time — e.g. immediately after the last active flag graduates and before the next one is added —\n * the opt-in mechanism itself is permanent even when nothing is currently gated behind it.\n *\n * @alpha\n */\nexport interface UnstableFeatures {\n /** Enables recording past payments to contractors within the `ContractorManagement` flows. */\n historicalPayments?: boolean\n}\n\n/**\n * React context backing {@link useUnstableFeature}.\n *\n * @internal\n */\nexport const UnstableFeaturesContext = createContext<UnstableFeatures>({})\n\n/**\n * Reads whether `feature` is enabled via {@link GustoProvider}'s `unstableFeatures` prop.\n *\n * @remarks\n * With `throwIfDisabled: true`, call unconditionally at the top of an alpha component's body —\n * not inside {@link WithUnstableFeature} — so mounting the component without opting in fails\n * loudly and immediately. This throws in every environment, including production: using an alpha\n * component without its flag is an integration mistake, not a runtime state, the same as\n * {@link useComponentContext} throwing when called outside a `ComponentsProvider`.\n *\n * @param feature - The {@link UnstableFeatures} flag to read.\n * @param options - Set `throwIfDisabled` to throw instead of returning `false` when `feature` is disabled.\n * @throws When `options.throwIfDisabled` is set and `feature` is not enabled.\n * @internal\n */\nexport const useUnstableFeature = (\n feature: keyof UnstableFeatures,\n options: { throwIfDisabled?: boolean } = { throwIfDisabled: false },\n): boolean => {\n const features = useContext(UnstableFeaturesContext)\n const isEnabled = !!features[feature]\n\n if (options.throwIfDisabled && !isEnabled) {\n throw new Error(\n `This component requires the unstable feature flag \"${feature}\" to be enabled via GustoProvider's \\`unstableFeatures\\` prop.`,\n )\n }\n\n return isEnabled\n}\n"],"names":["UnstableFeaturesContext","createContext","useUnstableFeature","feature","options","isEnabled","useContext"],"mappings":";AAyBO,MAAMA,IAA0BC,EAAgC,CAAA,CAAE,GAiB5DC,IAAqB,CAChCC,GACAC,IAAyC,EAAE,iBAAiB,SAChD;AAEZ,QAAMC,IAAY,CAAC,CADFC,EAAWN,CAAuB,EACtBG,CAAO;AAEpC,MAAIC,EAAQ,mBAAmB,CAACC;AAC9B,UAAM,IAAI;AAAA,MACR,sDAAsDF,CAAO;AAAA,IAAA;AAIjE,SAAOE;AACT;"}
|
package/dist/contexts/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export type { ComponentsContextType } from './ComponentAdapter/useComponentConte
|
|
|
5
5
|
export * from './ComponentAdapter/componentAdapterTypes';
|
|
6
6
|
export type { GustoSDKTheme, GustoSDKThemeColors } from './ThemeProvider/theme';
|
|
7
7
|
export { useNonce } from './NonceProvider';
|
|
8
|
+
export type { UnstableFeatures } from './UnstableFeaturesProvider/useUnstableFeature';
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
const t = { heading: "Record a historical payment", subtitle: "Log a contractor payment that already happened outside Gusto. Pick a paid date and the contractors you paid.", dateLabel: "Payment date", dateInFutureError: "You cannot issue historical payments for the future. Please choose a date in the past.", dateTooEarlyError: "You cannot create a payment in {{year}}. Please select a {{allowedYear}} date.", continueButton: "Continue" },
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
const t = "Back", e = { heading: "Record a historical payment", subtitle: "Log a contractor payment that already happened outside Gusto. Pick a paid date and the contractors you paid.", dateLabel: "Payment date", dateInFutureError: "You cannot issue historical payments for the future. Please choose a date in the past.", dateTooEarlyError: "You cannot create a payment in {{year}}. Please select a {{allowedYear}} date.", continueButton: "Continue" }, a = { heading: "Enter payment amounts", subtitle: "Enter the hours or wage paid to each contractor along with any bonuses and reimbursements.", continueButton: "Continue" }, o = "Hours and payments", n = { contractor: "Contractor", wageType: "Wage", paymentMethod: "Payment method", hours: "Hours", wage: "Fixed amount", bonus: "Bonus", reimbursement: "Reimbursement", total: "Total" }, r = "No contractors selected", s = "Select at least one contractor to record a payment.", c = "N/A", i = "Totals", l = "Edit contractor payment", m = "/hr", u = { fixed: "Fixed", hourly: "Hourly" }, d = { directDeposit: "Direct Deposit", check: "Check", historicalPayment: "Historical Payment" }, y = { contractorPaymentUpdated: "Pay updated for {{contractorName}}" }, p = { title: "Edit contractor pay", subtitle: `Edit contractor's hours, additional earnings, and reimbursements. Inputs not applicable to this contractor are disabled. Please click "Done" to apply the change.`, hoursLabel: "Hours", hoursAdornment: "hrs", hoursPayDescription: "{{rate}}/hr × hours = {{total}}", wageLabel: "Fixed amount", bonusLabel: "Bonus", reimbursementLabel: "Reimbursement", paymentMethodLabel: "Payment Method", cancelCta: "Cancel", saveCta: "Done", paymentMethods: { check: "Check", directDeposit: "Direct deposit", historicalPayment: "Historical payment" }, errors: { directDepositNotAvailable: "Direct Deposit is not available for contractors set up for Check payments", unsupportedPaymentMethod: "This payment method is not supported. Please select Check or Direct Deposit." } }, h = { title: "Review and submit", subtitle: "Historical payment for {{checkDate}}", submitButton: "Submit historical payment", successTitle: "Historical payment recorded successfully", successMessage: "This payment has been recorded. View it from the payments list to see its full details.", paymentSummaryTitle: "Payment Summary", totalAmount: "Total Amount", contractorPayDate: "Contractor Pay Date", contractorPaymentsTitle: "Contractor Payments", contractor: "Contractor", wageType: "Wage Type", paymentMethod: "Payment Method", paymentMethods: { directDeposit: "Direct Deposit", check: "Check", historicalPayment: "Historical Payment" }, hours: "Hours", wage: "Wage", bonus: "Bonus", reimbursement: "Reimbursement", total: "Total", totalsLabel: "Totals", notAvailable: "N/A" }, b = {
|
|
2
|
+
backButton: t,
|
|
3
|
+
select: e,
|
|
4
|
+
amounts: a,
|
|
5
|
+
hoursAndPaymentsLabel: o,
|
|
6
|
+
contractorTableHeaders: n,
|
|
7
|
+
emptyTableTitle: r,
|
|
8
|
+
emptyTableDescription: s,
|
|
9
|
+
na: c,
|
|
10
|
+
totalsLabel: i,
|
|
11
|
+
editContractor: l,
|
|
12
|
+
perHour: m,
|
|
13
|
+
wageTypes: u,
|
|
14
|
+
paymentMethods: d,
|
|
15
|
+
alerts: y,
|
|
16
|
+
editContractorPayment: p,
|
|
17
|
+
review: h
|
|
17
18
|
};
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
y as alerts,
|
|
21
|
+
a as amounts,
|
|
22
|
+
t as backButton,
|
|
23
|
+
n as contractorTableHeaders,
|
|
24
|
+
b as default,
|
|
25
|
+
l as editContractor,
|
|
26
|
+
p as editContractorPayment,
|
|
27
|
+
s as emptyTableDescription,
|
|
28
|
+
r as emptyTableTitle,
|
|
29
|
+
o as hoursAndPaymentsLabel,
|
|
30
|
+
c as na,
|
|
31
|
+
d as paymentMethods,
|
|
32
|
+
m as perHour,
|
|
33
|
+
h as review,
|
|
34
|
+
e as select,
|
|
35
|
+
i as totalsLabel,
|
|
36
|
+
u as wageTypes
|
|
35
37
|
};
|
|
36
38
|
//# sourceMappingURL=Contractor.Payments.CreateHistoricalPayment.json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contractor.Payments.CreateHistoricalPayment.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Contractor.Payments.CreateHistoricalPayment.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
const
|
|
2
|
-
title:
|
|
3
|
-
subtitle:
|
|
1
|
+
const t = "Contractor payments", e = "Upcoming and past payments", n = "Contractor payments", a = "New payment", o = "Start date", s = "Apply date", c = "Payment date", r = "Reimbursement total", i = "Wage total", m = "Actions", l = "View payment", y = "No payments found", u = "No contractor payments have been created yet. Create your first payment to get started.", d = { paymentCreatedSuccessfully_one: "Successfully created {{count}} contractor payment.", paymentCreatedSuccessfully_other: "Successfully created {{count}} contractor payments.", paymentCancelledSuccessfully: "Contractor payment cancelled successfully", wireDetailsSubmitted: "Wire details submitted", rfiPendingResponseTitle: "Payments may be blocked: Provide more information to run payments", rfiPendingResponseDescription: "We need some more information about your business. Please respond as soon as possible to run payments on time.", rfiPendingReviewTitle: "Payments may be blocked", rfiPendingReviewDescription: "We're reviewing information about your business. Payments may be blocked until review is complete.", rfiRespondCta: "Respond" }, p = { last3Months: "Last 3 months", last6Months: "Last 6 months", last12Months: "Last 12 months" }, b = { title: "Record a historical payment", description: "Add a contractor payment that was made outside of Gusto to keep your records complete.", button: "Record a historical payment" }, f = {
|
|
2
|
+
title: t,
|
|
3
|
+
subtitle: e,
|
|
4
4
|
breadcrumbLabel: n,
|
|
5
5
|
createPaymentCta: a,
|
|
6
|
-
startDate:
|
|
7
|
-
applyDate:
|
|
6
|
+
startDate: o,
|
|
7
|
+
applyDate: s,
|
|
8
8
|
paymentDateColumnLabel: c,
|
|
9
9
|
reimbursementTotalColumnLabel: r,
|
|
10
|
-
wageTotalColumnLabel:
|
|
11
|
-
actionColumnLabel:
|
|
10
|
+
wageTotalColumnLabel: i,
|
|
11
|
+
actionColumnLabel: m,
|
|
12
12
|
viewPaymentCta: l,
|
|
13
13
|
noPaymentsFound: y,
|
|
14
14
|
noPaymentsDescription: u,
|
|
15
|
-
alerts:
|
|
16
|
-
dateRanges:
|
|
15
|
+
alerts: d,
|
|
16
|
+
dateRanges: p,
|
|
17
|
+
historicalPaymentCta: b
|
|
17
18
|
};
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
m as actionColumnLabel,
|
|
21
|
+
d as alerts,
|
|
22
|
+
s as applyDate,
|
|
22
23
|
n as breadcrumbLabel,
|
|
23
24
|
a as createPaymentCta,
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
p as dateRanges,
|
|
26
|
+
f as default,
|
|
27
|
+
b as historicalPaymentCta,
|
|
26
28
|
u as noPaymentsDescription,
|
|
27
29
|
y as noPaymentsFound,
|
|
28
30
|
c as paymentDateColumnLabel,
|
|
29
31
|
r as reimbursementTotalColumnLabel,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
o as startDate,
|
|
33
|
+
e as subtitle,
|
|
34
|
+
t as title,
|
|
33
35
|
l as viewPaymentCta,
|
|
34
|
-
|
|
36
|
+
i as wageTotalColumnLabel
|
|
35
37
|
};
|
|
36
38
|
//# sourceMappingURL=Contractor.Payments.PaymentsList.json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contractor.Payments.PaymentsList.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Contractor.Payments.PaymentsList.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -85,27 +85,6 @@ declare const _default: {
|
|
|
85
85
|
"yearly": "{{amount}} per year",
|
|
86
86
|
"paycheck": "{{amount}} per paycheck"
|
|
87
87
|
},
|
|
88
|
-
"compensationRateFormats": {
|
|
89
|
-
"hourly": "{{amount}} per hour",
|
|
90
|
-
"weekly": "{{amount}} per week",
|
|
91
|
-
"monthly": "{{amount}} per month",
|
|
92
|
-
"yearly": "{{amount}} per year",
|
|
93
|
-
"paycheck": "{{amount}} per paycheck"
|
|
94
|
-
},
|
|
95
|
-
"compensationRateFormats": {
|
|
96
|
-
"hourly": "{{amount}} per hour",
|
|
97
|
-
"weekly": "{{amount}} per week",
|
|
98
|
-
"monthly": "{{amount}} per month",
|
|
99
|
-
"yearly": "{{amount}} per year",
|
|
100
|
-
"paycheck": "{{amount}} per paycheck"
|
|
101
|
-
},
|
|
102
|
-
"compensationRateFormats": {
|
|
103
|
-
"hourly": "{{amount}} per hour",
|
|
104
|
-
"weekly": "{{amount}} per week",
|
|
105
|
-
"monthly": "{{amount}} per month",
|
|
106
|
-
"yearly": "{{amount}} per year",
|
|
107
|
-
"paycheck": "{{amount}} per paycheck"
|
|
108
|
-
},
|
|
109
88
|
"validations": {
|
|
110
89
|
"accountName": "Account name is required",
|
|
111
90
|
"routingNumber": "Routing number should be a number (9 digits)",
|
package/dist/i18n/types.d.ts
CHANGED
|
@@ -2411,6 +2411,8 @@ export namespace Translations {
|
|
|
2411
2411
|
}
|
|
2412
2412
|
/** Translation keys for the `Contractor.Payments.CreateHistoricalPayment` i18n namespace. */
|
|
2413
2413
|
export interface ContractorPaymentsCreateHistoricalPayment {
|
|
2414
|
+
/** @defaultValue `"Back"` */
|
|
2415
|
+
backButton: string
|
|
2414
2416
|
select: {
|
|
2415
2417
|
/** @defaultValue `"Record a historical payment"` */
|
|
2416
2418
|
heading: string
|
|
@@ -2526,8 +2528,6 @@ export namespace Translations {
|
|
|
2526
2528
|
title: string
|
|
2527
2529
|
/** @defaultValue `"Historical payment for {{checkDate}}"` */
|
|
2528
2530
|
subtitle: string
|
|
2529
|
-
/** @defaultValue `"Edit"` */
|
|
2530
|
-
editButton: string
|
|
2531
2531
|
/** @defaultValue `"Submit historical payment"` */
|
|
2532
2532
|
submitButton: string
|
|
2533
2533
|
/** @defaultValue `"Historical payment recorded successfully"` */
|
|
@@ -3071,6 +3071,14 @@ export namespace Translations {
|
|
|
3071
3071
|
/** @defaultValue `"Last 12 months"` */
|
|
3072
3072
|
last12Months: string
|
|
3073
3073
|
}
|
|
3074
|
+
historicalPaymentCta: {
|
|
3075
|
+
/** @defaultValue `"Record a historical payment"` */
|
|
3076
|
+
title: string
|
|
3077
|
+
/** @defaultValue `"Add a contractor payment that was made outside of Gusto to keep your records complete."` */
|
|
3078
|
+
description: string
|
|
3079
|
+
/** @defaultValue `"Record a historical payment"` */
|
|
3080
|
+
button: string
|
|
3081
|
+
}
|
|
3074
3082
|
}
|
|
3075
3083
|
/** Translation keys for the `Contractor.Profile` i18n namespace. */
|
|
3076
3084
|
export interface ContractorProfile {
|
|
@@ -270,6 +270,7 @@ export declare const contractorPaymentEvents: {
|
|
|
270
270
|
* @public
|
|
271
271
|
*/
|
|
272
272
|
export declare const contractorHistoricalPaymentEvents: {
|
|
273
|
+
readonly CONTRACTOR_HISTORICAL_PAYMENT_CREATE: "contractor/historicalPayments/create";
|
|
273
274
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_EDIT: "contractor/historicalPayments/edit";
|
|
274
275
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_UPDATE: "contractor/historicalPayments/update";
|
|
275
276
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_PREVIEW: "contractor/historicalPayments/preview";
|
|
@@ -541,6 +542,7 @@ export declare const componentEvents: {
|
|
|
541
542
|
readonly TRANSITION_CREATED: "transition/created";
|
|
542
543
|
readonly RUN_TRANSITION_PAYROLL: "transition/runPayroll";
|
|
543
544
|
readonly TRANSITION_PAYROLL_SKIPPED: "transition/payrollSkipped";
|
|
545
|
+
readonly CONTRACTOR_HISTORICAL_PAYMENT_CREATE: "contractor/historicalPayments/create";
|
|
544
546
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_EDIT: "contractor/historicalPayments/edit";
|
|
545
547
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_UPDATE: "contractor/historicalPayments/update";
|
|
546
548
|
readonly CONTRACTOR_HISTORICAL_PAYMENT_PREVIEW: "contractor/historicalPayments/preview";
|
package/dist/shared/constants.js
CHANGED
|
@@ -217,6 +217,7 @@ const t = {
|
|
|
217
217
|
CONTRACTOR_PAYMENT_EXIT: "contractor/payments/exit",
|
|
218
218
|
CONTRACTOR_PAYMENT_RFI_RESPOND: "contractor/payments/rfi/respond"
|
|
219
219
|
}, a = {
|
|
220
|
+
CONTRACTOR_HISTORICAL_PAYMENT_CREATE: "contractor/historicalPayments/create",
|
|
220
221
|
CONTRACTOR_HISTORICAL_PAYMENT_EDIT: "contractor/historicalPayments/edit",
|
|
221
222
|
CONTRACTOR_HISTORICAL_PAYMENT_UPDATE: "contractor/historicalPayments/update",
|
|
222
223
|
CONTRACTOR_HISTORICAL_PAYMENT_PREVIEW: "contractor/historicalPayments/preview",
|