@npm-zenwork/tax-remittance-ui 0.1.8 → 0.1.10
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/dist/api/client.d.ts +1 -0
- package/dist/api/paymentPdf.d.ts +4 -0
- package/dist/api/paymentTransactions.d.ts +2 -0
- package/dist/components/payments/PaymentRowActions.d.ts +3 -1
- package/dist/components/pdf/PaymentPdfModal.d.ts +12 -0
- package/dist/embedded/EmbeddedContext.d.ts +4 -1
- package/dist/embedded/EmbeddedWidgetBase.d.ts +3 -2
- package/dist/embedded/TaxRemittanceEmbedded.d.ts +26 -0
- package/dist/index.cjs +32 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4071 -3777
- package/dist/index.mjs.map +1 -1
- package/dist/pages/PaymentsPage.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/dist/types/api.d.ts +3 -1
- package/dist/types/federalPayment.d.ts +1 -0
- package/dist/types/paymentHistory.d.ts +15 -0
- package/dist/types/statePayment.d.ts +1 -0
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type RequestOptions = Omit<RequestInit, 'body'> & {
|
|
2
2
|
body?: unknown;
|
|
3
3
|
auth?: boolean;
|
|
4
|
+
responseType?: 'json' | 'blob' | 'text';
|
|
4
5
|
};
|
|
5
6
|
export declare function apiRequest<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
6
7
|
export declare function apiData<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function fetchFederalPaymentPdf(federalPaymentId: number): Promise<Blob>;
|
|
2
|
+
export declare function fetchStatePaymentPdf(statePaymentDetailId: number): Promise<Blob>;
|
|
3
|
+
export declare function fetchFederalPaymentPdfHtml(federalPaymentId: number): Promise<string>;
|
|
4
|
+
export declare function fetchStatePaymentPdfHtml(statePaymentDetailId: number): Promise<string>;
|
|
@@ -2,10 +2,12 @@ import { PaymentActionType } from './paymentsTableConfig';
|
|
|
2
2
|
interface PaymentRowActionsProps {
|
|
3
3
|
actionType: PaymentActionType;
|
|
4
4
|
onView?: () => void;
|
|
5
|
+
onViewPdf?: () => void;
|
|
5
6
|
onEdit?: () => void;
|
|
6
7
|
onSubmit?: () => void;
|
|
7
8
|
isSubmitting?: boolean;
|
|
9
|
+
isViewPdfLoading?: boolean;
|
|
8
10
|
}
|
|
9
11
|
/** Row actions per tab — used when payment list API is wired. */
|
|
10
|
-
export declare function PaymentRowActions({ actionType, onView, onEdit, onSubmit, isSubmitting, }: PaymentRowActionsProps): import("react").JSX.Element;
|
|
12
|
+
export declare function PaymentRowActions({ actionType, onView, onViewPdf, onEdit, onSubmit, isSubmitting, isViewPdfLoading, }: PaymentRowActionsProps): import("react").JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface PaymentPdfModalProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
title: string;
|
|
4
|
+
html: string | null;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
error?: string | null;
|
|
7
|
+
downloadFileName?: string;
|
|
8
|
+
onDownload?: () => Promise<Blob>;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function PaymentPdfModal({ open, title, html, isLoading, error, downloadFileName, onDownload, onClose, }: PaymentPdfModalProps): import("react").JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { EntityDetailsResponse } from '../types/entity';
|
|
3
|
+
import { PaymentRequiredInfo } from './TaxRemittanceEmbedded';
|
|
3
4
|
export type PaymentType = 'federal' | 'state';
|
|
4
5
|
interface EmbeddedContextValue {
|
|
5
6
|
entities: EntityDetailsResponse[];
|
|
@@ -9,12 +10,14 @@ interface EmbeddedContextValue {
|
|
|
9
10
|
setSelectedEntityId: (id: number) => void;
|
|
10
11
|
refetchEntities: () => Promise<void>;
|
|
11
12
|
enabledPayments: PaymentType[];
|
|
13
|
+
onPaymentRequired?: (info: PaymentRequiredInfo) => void;
|
|
12
14
|
}
|
|
13
15
|
interface EmbeddedContextProviderProps {
|
|
14
16
|
onOrganizationCreated?: (org: EntityDetailsResponse) => void;
|
|
15
17
|
enabledPayments?: PaymentType[];
|
|
18
|
+
onPaymentRequired?: (info: PaymentRequiredInfo) => void;
|
|
16
19
|
children: ReactNode;
|
|
17
20
|
}
|
|
18
|
-
export declare function EmbeddedContextProvider({ onOrganizationCreated, enabledPayments, children, }: EmbeddedContextProviderProps): import("react").JSX.Element;
|
|
21
|
+
export declare function EmbeddedContextProvider({ onOrganizationCreated, enabledPayments, onPaymentRequired, children, }: EmbeddedContextProviderProps): import("react").JSX.Element;
|
|
19
22
|
export declare function useEmbeddedContext(): EmbeddedContextValue;
|
|
20
23
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MutableRefObject, ReactNode } from 'react';
|
|
2
2
|
import { PaymentType } from './EmbeddedContext';
|
|
3
3
|
import { TaxRemittanceTheme } from './ThemeProvider';
|
|
4
|
-
import { EmbeddedRouteKey } from './TaxRemittanceEmbedded';
|
|
4
|
+
import { EmbeddedRouteKey, PaymentRequiredInfo } from './TaxRemittanceEmbedded';
|
|
5
5
|
import { EntityDetailsResponse } from '../types/entity';
|
|
6
6
|
export type { TaxRemittanceTheme };
|
|
7
7
|
export interface EmbeddedWidgetBaseProps {
|
|
@@ -12,6 +12,7 @@ export interface EmbeddedWidgetBaseProps {
|
|
|
12
12
|
onSessionExpired?: () => void;
|
|
13
13
|
onOrganizationCreated?: (org: EntityDetailsResponse) => void;
|
|
14
14
|
onNavigate?: (routeKey: EmbeddedRouteKey, pathname: string) => void;
|
|
15
|
+
onPaymentRequired?: (info: PaymentRequiredInfo) => void;
|
|
15
16
|
navigateFnRef: MutableRefObject<((path: string) => void) | null>;
|
|
16
17
|
selectEntityFnRef: MutableRefObject<((id: number) => void) | null>;
|
|
17
18
|
/** Payment types this widget instance supports. Controls which dashboard action cards appear. */
|
|
@@ -29,4 +30,4 @@ export interface EmbeddedWidgetBaseProps {
|
|
|
29
30
|
*
|
|
30
31
|
* Children should be a <Routes> element with the widget-specific route tree.
|
|
31
32
|
*/
|
|
32
|
-
export declare function EmbeddedWidgetBase({ appKey, accessToken, apiBaseUrl, theme, onSessionExpired, onOrganizationCreated, onNavigate, navigateFnRef, selectEntityFnRef, enabledPayments, children, }: EmbeddedWidgetBaseProps): import("react").JSX.Element;
|
|
33
|
+
export declare function EmbeddedWidgetBase({ appKey, accessToken, apiBaseUrl, theme, onSessionExpired, onOrganizationCreated, onNavigate, onPaymentRequired, navigateFnRef, selectEntityFnRef, enabledPayments, children, }: EmbeddedWidgetBaseProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { TaxRemittanceTheme } from './EmbeddedWidgetBase';
|
|
2
2
|
import { EntityDetailsResponse } from '../types/entity';
|
|
3
3
|
export type { TaxRemittanceTheme };
|
|
4
|
+
/**
|
|
5
|
+
* Payload emitted via `onPaymentRequired` when the backend returns a 402.
|
|
6
|
+
* Contains enough information for the host to render a payment UI.
|
|
7
|
+
*/
|
|
8
|
+
export interface PaymentRequiredInfo {
|
|
9
|
+
paymentType: 'federal' | 'state';
|
|
10
|
+
paymentId: number;
|
|
11
|
+
expectedAmount: string;
|
|
12
|
+
currency: string;
|
|
13
|
+
federalRecordCount: number;
|
|
14
|
+
stateRecordCount: number;
|
|
15
|
+
feePerFederal: string | null;
|
|
16
|
+
feePerState: string | null;
|
|
17
|
+
}
|
|
4
18
|
/**
|
|
5
19
|
* The top-level section the widget is currently showing.
|
|
6
20
|
* Returned by `onNavigate` so the host can highlight the correct sidebar item.
|
|
@@ -19,6 +33,11 @@ export interface TaxRemittanceEmbeddedHandle {
|
|
|
19
33
|
navigate: (path: string) => void;
|
|
20
34
|
/** Switch the active entity context inside the widget. */
|
|
21
35
|
selectEntity: (id: number) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Call this after the host completes payment (Stripe charge succeeded + schedule-after-payment called).
|
|
38
|
+
* Invalidates the payment list so the widget refreshes from Scheduled status.
|
|
39
|
+
*/
|
|
40
|
+
notifyPaymentComplete: (paymentId: number) => void;
|
|
22
41
|
}
|
|
23
42
|
export interface TaxRemittanceEmbeddedProps {
|
|
24
43
|
/**
|
|
@@ -51,6 +70,12 @@ export interface TaxRemittanceEmbeddedProps {
|
|
|
51
70
|
* Use this to keep the host app's sidebar selection in sync with the widget.
|
|
52
71
|
*/
|
|
53
72
|
onNavigate?: (routeKey: EmbeddedRouteKey, pathname: string) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Called when the backend returns 402 Payment Required for a submission.
|
|
75
|
+
* The host should show a payment UI and call `widgetRef.current?.notifyPaymentComplete(paymentId)`
|
|
76
|
+
* after the payment succeeds and schedule-after-payment has been called.
|
|
77
|
+
*/
|
|
78
|
+
onPaymentRequired?: (info: PaymentRequiredInfo) => void;
|
|
54
79
|
}
|
|
55
80
|
/**
|
|
56
81
|
* Full embedded widget — all sections (dashboard, payments, tax forms, settings).
|
|
@@ -59,4 +84,5 @@ export interface TaxRemittanceEmbeddedProps {
|
|
|
59
84
|
* - FederalPaymentWidget — federal payments + dashboard + settings
|
|
60
85
|
* - StatePaymentWidget — state payments + dashboard + settings
|
|
61
86
|
*/
|
|
87
|
+
export declare const PAYMENT_COMPLETE_EVENT = "tax-remittance:payment-complete";
|
|
62
88
|
export declare const TaxRemittanceEmbedded: import('react').ForwardRefExoticComponent<TaxRemittanceEmbeddedProps & import('react').RefAttributes<TaxRemittanceEmbeddedHandle>>;
|