@tight-embedded/react 6.3.1 → 6.4.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.
- package/dist/index.css +672 -650
- package/dist/index.css.gz +0 -0
- package/dist/index.d.ts +231 -5
- package/dist/index.js +1 -1
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/dist/index.js.map.gz +0 -0
- package/package.json +4 -2
package/dist/index.css.gz
CHANGED
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
1
2
|
import { JSX } from 'react/jsx-runtime';
|
|
2
3
|
import { PropsWithChildren } from 'react';
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* A valid anchor target string across all pages that define anchor sections.
|
|
7
|
+
*
|
|
8
|
+
* @see PAGE_ANCHOR_MAP
|
|
9
|
+
* @see AnchorFor
|
|
10
|
+
*/
|
|
11
|
+
export declare type Anchor = AnchorFor<keyof PageAnchorMap>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Extracts the valid anchor string values for a specific page `T`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```TypeScript
|
|
18
|
+
* type BODAnchors = AnchorFor<"FinancialOverviewDashboard">;
|
|
19
|
+
* // = "conversations-section" | "transactions-section"
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare type AnchorFor<T extends keyof PageAnchorMap> = T extends keyof PageAnchorMap ? PageAnchorMap[T][keyof PageAnchorMap[T]] : never;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Props for the `<TightApp />` component.
|
|
26
|
+
*
|
|
27
|
+
* @see TightApp
|
|
28
|
+
* @see NavState
|
|
29
|
+
*/
|
|
30
|
+
declare type AppProps = {
|
|
31
|
+
/** The current navigation target. Controls which page, anchor, and drawer are active. */
|
|
32
|
+
navState: NavState;
|
|
33
|
+
/** Called when the user triggers an internal navigation event. The host must update `navState` in response. */
|
|
34
|
+
onNavigate: (navState: NavState) => void;
|
|
35
|
+
/** Bearer token used to authenticate API requests. Obtain one from the Tight Authentication Endpoint. */
|
|
36
|
+
accessToken: string;
|
|
37
|
+
/** Selects the Tight API environment. Defaults to `"PRODUCTION"`. Use `"SANDBOX"` for development and testing. */
|
|
38
|
+
environment?: Environment;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
declare function BankAccountForm({ bankAccountId }: BankAccountFormProps): JSX.Element;
|
|
42
|
+
|
|
43
|
+
declare type BankAccountFormProps = {
|
|
44
|
+
bankAccountId: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
4
47
|
export declare function BanksAndIntegrations({ onPlaidLink }: BanksAndIntegrationsComponentProps): JSX.Element;
|
|
5
48
|
|
|
6
49
|
declare type BanksAndIntegrationsComponentProps = {
|
|
@@ -13,6 +56,25 @@ declare type BanksAndIntegrationsOptions = {
|
|
|
13
56
|
hideManualBanks?: boolean;
|
|
14
57
|
};
|
|
15
58
|
|
|
59
|
+
declare function BankTransactionForm({ transactionId, initialTab, initialType }: BankTransactionFormProps): JSX.Element | undefined;
|
|
60
|
+
|
|
61
|
+
declare type BankTransactionFormProps = {
|
|
62
|
+
transactionId?: string;
|
|
63
|
+
initialTab?: FormTab;
|
|
64
|
+
initialType?: BankTransactionType;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
declare type BankTransactionType = "EXPENSE" | "REVENUE" | "TRANSFER_IN" | "TRANSFER_OUT";
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A top-level page name within the Tight application.
|
|
71
|
+
*
|
|
72
|
+
* Each value corresponds to one of the primary dashboard views rendered by `<TightApp />`.
|
|
73
|
+
*
|
|
74
|
+
* @see NavState
|
|
75
|
+
*/
|
|
76
|
+
export declare type BasePage = "FinancialOverviewDashboard";
|
|
77
|
+
|
|
16
78
|
export declare function BusinessOwnerDashboard(props: BusinessOwnerDashboardProps): JSX.Element;
|
|
17
79
|
|
|
18
80
|
declare type BusinessOwnerDashboardProps = {
|
|
@@ -20,6 +82,43 @@ declare type BusinessOwnerDashboardProps = {
|
|
|
20
82
|
onChangePeriod?: (period: Period) => void;
|
|
21
83
|
};
|
|
22
84
|
|
|
85
|
+
/**
|
|
86
|
+
* A standalone drawer for rendering a conversation that is not attached to an entity.
|
|
87
|
+
* @param conversationId
|
|
88
|
+
* @param defaultValues
|
|
89
|
+
* @constructor
|
|
90
|
+
*/
|
|
91
|
+
declare function ConversationDrawer({ conversationId, defaultValues }: ConversationDrawerProps): JSX.Element;
|
|
92
|
+
|
|
93
|
+
declare type ConversationDrawerProps = {
|
|
94
|
+
conversationId: Nullable<string>;
|
|
95
|
+
defaultValues?: MessageFormValues;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export declare type DrawerNavObject = {
|
|
99
|
+
[K in DrawerRouteNames]: {
|
|
100
|
+
name: K;
|
|
101
|
+
props?: DrawerProps[K];
|
|
102
|
+
};
|
|
103
|
+
}[DrawerRouteNames];
|
|
104
|
+
|
|
105
|
+
declare type DrawerProps = {
|
|
106
|
+
BankTransactionForm: ComponentPropsWithoutRef<typeof BankTransactionForm>;
|
|
107
|
+
Conversation: ComponentPropsWithoutRef<typeof ConversationDrawer>;
|
|
108
|
+
MobileConversation: ComponentPropsWithoutRef<typeof MobileConversationDrawer>;
|
|
109
|
+
BankAccountForm: ComponentPropsWithoutRef<typeof BankAccountForm>;
|
|
110
|
+
NewConnection: EmptyObject;
|
|
111
|
+
FinancialSummary: ComponentPropsWithoutRef<typeof FinancialSummaryDrawer>;
|
|
112
|
+
BanksAndIntegrations: EmptyObject;
|
|
113
|
+
TransactionsFilterList: EmptyObject;
|
|
114
|
+
RevenueFilterList: EmptyObject;
|
|
115
|
+
ExpensesFilterList: EmptyObject;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
declare type DrawerRouteNames = keyof DrawerProps;
|
|
119
|
+
|
|
120
|
+
declare type EmptyObject = Record<string, never>;
|
|
121
|
+
|
|
23
122
|
export declare type Environment = ValueOf<typeof Environments>;
|
|
24
123
|
|
|
25
124
|
declare const Environments: {
|
|
@@ -42,6 +141,15 @@ declare type ExternalOptions = {
|
|
|
42
141
|
banksAndIntegrations?: BanksAndIntegrationsOptions;
|
|
43
142
|
};
|
|
44
143
|
|
|
144
|
+
declare function FinancialSummaryDrawer({ summaryId, conversationId }: FinancialSummaryDrawerProps): JSX.Element;
|
|
145
|
+
|
|
146
|
+
declare type FinancialSummaryDrawerProps = {
|
|
147
|
+
summaryId: string;
|
|
148
|
+
conversationId?: string;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
declare type FormTab = "conversation" | "audit trail";
|
|
152
|
+
|
|
45
153
|
export declare const IncomeDashboard: (props: IncomeDashboardProps) => JSX.Element;
|
|
46
154
|
|
|
47
155
|
declare type IncomeDashboardProps = {
|
|
@@ -51,6 +159,60 @@ declare type IncomeDashboardProps = {
|
|
|
51
159
|
|
|
52
160
|
declare type IntegrationIdentifier = typeof SUPPORTED_INTEGRATION_IDENTIFIERS[number];
|
|
53
161
|
|
|
162
|
+
declare type MessageFormValues = {
|
|
163
|
+
message: {
|
|
164
|
+
text: string;
|
|
165
|
+
attachments: UploadedAttachmentInfo[];
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
declare function MobileConversationDrawer({ conversationId, transactionId }: MobileConversationDrawerProps): JSX.Element;
|
|
170
|
+
|
|
171
|
+
declare type MobileConversationDrawerProps = {
|
|
172
|
+
conversationId: Nullable<string>;
|
|
173
|
+
transactionId: Nullable<string>;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Describes a navigation target within the Tight application.
|
|
178
|
+
*
|
|
179
|
+
* `NavState` is a discriminated union keyed on `page`. The `anchor` field is
|
|
180
|
+
* constrained to strings that are valid for the specified page — pages with no
|
|
181
|
+
* defined anchors do not accept an `anchor` value at all. The optional `drawer`
|
|
182
|
+
* field opens a specific drawer on top of the page when present.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```TypeScript
|
|
186
|
+
* // Navigate to a top-level page
|
|
187
|
+
* const nav: NavState = { page: "FinancialOverviewDashboard" };
|
|
188
|
+
*
|
|
189
|
+
* // Navigate to a specific anchor section
|
|
190
|
+
* const navWithAnchor: NavState = {
|
|
191
|
+
* page: "FinancialOverviewDashboard",
|
|
192
|
+
* anchor: "conversations-section",
|
|
193
|
+
* };
|
|
194
|
+
*
|
|
195
|
+
* // Navigate to a page with a drawer open
|
|
196
|
+
* const navWithDrawer: NavState = {
|
|
197
|
+
* page: "TransactionsDashboard",
|
|
198
|
+
* drawer: { name: "BankTransactionForm" },
|
|
199
|
+
* };
|
|
200
|
+
*
|
|
201
|
+
* // TypeScript error — "conversations-section" is not valid on this page
|
|
202
|
+
* const invalid: NavState = {
|
|
203
|
+
* page: "TransactionsDashboard",
|
|
204
|
+
* anchor: "conversations-section", // ← type error
|
|
205
|
+
* };
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
export declare type NavState = {
|
|
209
|
+
[P in BasePage]: {
|
|
210
|
+
page: P;
|
|
211
|
+
anchor?: P extends keyof PageAnchorMap ? AnchorFor<P> : never;
|
|
212
|
+
drawer?: DrawerNavObject;
|
|
213
|
+
};
|
|
214
|
+
}[BasePage];
|
|
215
|
+
|
|
54
216
|
declare type Nullable<T> = T | null;
|
|
55
217
|
|
|
56
218
|
declare type ObjectKey = string | number | symbol;
|
|
@@ -69,6 +231,41 @@ declare type OnPlaidLinkEventData = {
|
|
|
69
231
|
|
|
70
232
|
declare type OptionSetter = (options: Partial<ExternalOptions>, replace?: boolean) => void;
|
|
71
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Maps each page to its available anchor targets, keyed by semantic name.
|
|
236
|
+
*
|
|
237
|
+
*/
|
|
238
|
+
declare const PAGE_ANCHOR_MAP: {
|
|
239
|
+
readonly FinancialOverviewDashboard: {
|
|
240
|
+
readonly CONVERSATIONS: "conversations-section";
|
|
241
|
+
readonly TRANSACTIONS: "transactions-section";
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
declare type PageAnchorMap = typeof PAGE_ANCHOR_MAP;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Parses a URL string into a `NavObject` for use as the `navObject` prop on `<App />`.
|
|
249
|
+
*
|
|
250
|
+
* Returns `undefined` if the URL is malformed, the `bkPage` param is missing or
|
|
251
|
+
* invalid, or a drawer is specified but its required props are invalid.
|
|
252
|
+
*
|
|
253
|
+
* @param url - A fully-qualified URL string containing Tight navigation params.
|
|
254
|
+
* @returns A typed `NavObject`, or `undefined` if the URL cannot be parsed.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```TypeScript
|
|
258
|
+
* const nav = parseNavUrl("https://app.example.com?bkPage=FinancialOverviewDashboard");
|
|
259
|
+
* // nav = { page: "FinancialOverviewDashboard" }
|
|
260
|
+
*
|
|
261
|
+
* const navWithAnchor = parseNavUrl(
|
|
262
|
+
* "https://app.example.com?bkPage=FinancialOverviewDashboard&bkAnchor=conversations-section"
|
|
263
|
+
* );
|
|
264
|
+
* // navWithAnchor = { page: "FinancialOverviewDashboard", anchor: "conversations-section" }
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
export declare function parseNavUrl(url: string): NavState | undefined;
|
|
268
|
+
|
|
72
269
|
declare type Period = {
|
|
73
270
|
month: number;
|
|
74
271
|
year: number;
|
|
@@ -88,6 +285,27 @@ declare const SUPPORTED_INTEGRATION_IDENTIFIERS: readonly ["UNIT", "STRIPE", "GU
|
|
|
88
285
|
|
|
89
286
|
export declare function Tight({ children, environment, accessToken }: TightProps): JSX.Element;
|
|
90
287
|
|
|
288
|
+
/**
|
|
289
|
+
* The root component of the Tight application.
|
|
290
|
+
*
|
|
291
|
+
* Wraps all dashboard views in a shared `MemoryRouter` and navigation context.
|
|
292
|
+
* Navigation state is driven externally via the `navState` prop, making the
|
|
293
|
+
* component fully controlled — the host application owns navigation state.
|
|
294
|
+
*
|
|
295
|
+
* @param accessToken - Bearer token used to authenticate API requests.
|
|
296
|
+
* @param environment - Selects the Tight API environment (`"PRODUCTION"` or `"SANDBOX"`). Defaults to `"PRODUCTION"`.
|
|
297
|
+
* @param navState - The current navigation target. Controls page, anchor, and open drawer.
|
|
298
|
+
* @param onNavigate - Callback fired when the user triggers an internal navigation event.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* ```TypeScript
|
|
302
|
+
* const [nav, setNav] = useState<NavState>({ page: "FinancialOverviewDashboard" });
|
|
303
|
+
*
|
|
304
|
+
* <TightApp accessToken={accessToken} navState={nav} onNavigate={setNav} />
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
export declare function TightApp({ accessToken, environment, navState, onNavigate }: AppProps): JSX.Element;
|
|
308
|
+
|
|
91
309
|
declare type TightProps = PropsWithChildren<{
|
|
92
310
|
environment: Environment;
|
|
93
311
|
accessToken: string;
|
|
@@ -117,14 +335,22 @@ declare const TransactionTableColumns: {
|
|
|
117
335
|
readonly COMMENTS: "comments";
|
|
118
336
|
};
|
|
119
337
|
|
|
338
|
+
declare type UploadedAttachmentInfo = {
|
|
339
|
+
localId: string;
|
|
340
|
+
id: number | null;
|
|
341
|
+
file: File;
|
|
342
|
+
displayFileName: string;
|
|
343
|
+
displayText: string;
|
|
344
|
+
isPending: boolean;
|
|
345
|
+
hasError: boolean;
|
|
346
|
+
fileSize: Nullable<string>;
|
|
347
|
+
iconUrl: Nullable<string>;
|
|
348
|
+
publicFileUrl: Nullable<string>;
|
|
349
|
+
};
|
|
350
|
+
|
|
120
351
|
/**
|
|
121
352
|
* Set library-wide options for various components.
|
|
122
353
|
*
|
|
123
|
-
* For Developers:
|
|
124
|
-
* This hook subscribes a component to Tight Embedded's option store, which is shared across all Tight Components
|
|
125
|
-
* The initial options passed into the hook will be set as the value of options on the hook's first render.
|
|
126
|
-
* When a component modifies these options by calling setOptions, all subscribed components will re-render with the new options
|
|
127
|
-
*
|
|
128
354
|
* @param initialOptions - options to pass into the store on first render of this hook.
|
|
129
355
|
*
|
|
130
356
|
* @example
|