@capitalos/react 1.3.3 → 1.4.5-rc.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.
@@ -1,1478 +1,1527 @@
1
- import { Connection } from 'penpal';
2
- import { IFrameComponent } from 'iframe-resizer';
3
- import { IFrameMessageData } from 'iframe-resizer';
4
- import { IFrameOptions } from 'iframe-resizer';
5
- import { IFrameResizedData } from 'iframe-resizer';
6
- import { IFrameScrollData } from 'iframe-resizer';
7
- import { default as React_2 } from 'react';
8
- import { ReactNode } from 'react';
9
- import { RefObject } from 'react';
10
- import { z } from 'zod';
11
- import * as z_2 from 'zod';
12
-
13
- export declare type Account = {
14
- status: AccountStatus;
15
- };
16
-
17
- /**
18
- * Renders the CapitalOS Account Actions experience.
19
- */
20
- export declare function AccountActions(props: AccountActionsProps): JSX.Element;
21
-
22
- export declare type AccountActionsProps = CommonProps;
23
-
24
- /**
25
- * Renders the CapitalOS Account Details experience.
26
- */
27
- export declare function AccountDetails(props: AccountDetailsProps): JSX.Element;
28
-
29
- export declare type AccountDetailsProps = CommonProps;
30
-
31
- export declare type AccountStatus = z_2.infer<typeof accountStatusSchema>;
32
-
33
- declare const accountStatusSchema: z_2.ZodEnum<["eligible", "ineligible", "engaged", "onboarding", "approved", "processing", "pending", "declined", "closed", "waiting"]>;
34
-
35
- export declare type ActionResult<T = void> = {
36
- success: true;
37
- canceled: false;
38
- data: T;
39
- } | {
40
- success: false;
41
- canceled: true;
42
- } | {
43
- success: false;
44
- canceled: false;
45
- error: CapitalOSError;
46
- };
47
-
48
- export declare const ActionsIframeContext: React_2.Context<ActionsIframeContextValue | null>;
49
-
50
- declare interface ActionsIframeContextValue {
51
- childFunctions: ChildFunctions | null;
52
- actions: {
53
- freezeCard: (cardId: string) => Promise<ActionResult<Card>>;
54
- unfreezeCard: (cardId: string) => Promise<ActionResult<Card>>;
55
- } | null;
56
- isLoading: boolean;
57
- }
58
-
59
- export declare function ActionsIframeProvider({ children }: {
60
- children: React_2.ReactNode;
61
- }): JSX.Element;
62
-
63
- declare type AllowedExitPoints = {
64
- welcome: 'application' | 'activation';
65
- application: 'application' | 'activation';
66
- };
67
-
68
- /** @deprecated Use {@link CardsApp} instead */
69
- export declare const App: typeof CardsApp;
70
-
71
- /**
72
- * Renders the CapitalOS Bill Payment Dashboard experience.
73
- */
74
- export declare function BillPayApp(props: BillPayAppProps): JSX.Element;
75
-
76
- export declare type BillPayAppProps = CommonProps;
77
-
78
- /**
79
- * Builds the iframe url from token data, rendering context, and theme.
80
- */
81
- export declare function buildIframeUrl({ tokenData, renderingContext, theme, onError, }: {
82
- tokenData: TokenData;
83
- renderingContext: CapitalOsRenderingContext;
84
- theme?: ThemeColorScheme | undefined;
85
- onError?: ((error: Error) => void) | undefined;
86
- }): string | undefined;
87
-
88
- /**
89
- * The internal component that handles all the heavy lifting of connecting to the iframe and rendering the app.
90
- * all user facing components are basically a syntactic sugar on top of this.
91
- */
92
- export declare function CapitalOS<T extends CapitalOsRenderingContext>(props: CapitalOsProps<T>): JSX.Element;
93
-
94
- declare type CapitalOsAuthenticationContextType = {
95
- tokenData?: TokenData | undefined;
96
- isLoading: boolean;
97
- error?: Error | undefined;
98
- /**
99
- * Invalidates the current token..
100
- * This is used when the iframe signals that the token has expired.
101
- * The authentication flow will automatically refresh the token after invalidation.
102
- */
103
- invalidateToken: () => void;
104
- /**
105
- * Optional flag indicating whether to log events to the console.
106
- */
107
- enableLogging: boolean;
108
- };
109
-
110
- declare const CapitalOsAuthenticationProvider: React_2.FC<ProviderProps>;
111
- export { CapitalOsAuthenticationProvider }
112
- export { CapitalOsAuthenticationProvider as CapitalOsAuthenticationProvider_alias_1 }
113
-
114
- /**
115
- * Base class for all SDK errors
116
- */
117
- export declare class CapitalOSError extends Error {
118
- code: ErrorCode;
119
- constructor({ message, code }: {
120
- message: string;
121
- code: ErrorCode;
122
- });
123
- }
124
-
125
- declare type CapitalOsProps<T extends CapitalOsRenderingContext> = CommonProps & {
126
- renderingContext: T;
127
- methods?: Partial<ParentFunctions>;
128
- sizeWidth?: boolean;
129
- };
130
-
131
- export declare type CapitalOsRenderingContext = {
132
- entryPoint?: EntryPoint;
133
- referer?: string;
134
- };
135
-
136
- export declare type Card = {
137
- status: 'active' | 'inactive' | 'canceled' | 'frozen';
138
- };
139
-
140
- export declare type CardApiDto = z_2.infer<typeof cardApiDtoSchema>;
141
-
142
- declare const cardApiDtoSchema: z_2.ZodObject<{
143
- accountUserId: z_2.ZodNullable<z_2.ZodString>;
144
- status: z_2.ZodEnum<["active", "inactive", "canceled", "frozen"]>;
145
- id: z_2.ZodString;
146
- last4: z_2.ZodString;
147
- platformId: z_2.ZodString;
148
- cardholderFirstName: z_2.ZodString;
149
- cardholderLastName: z_2.ZodString;
150
- cardholderPhoneNumber: z_2.ZodEffects<z_2.ZodString, string, string>;
151
- nickname: z_2.ZodOptional<z_2.ZodNullable<z_2.ZodString>>;
152
- spend: z_2.ZodObject<{
153
- daily: z_2.ZodObject<{
154
- limit: z_2.ZodOptional<z_2.ZodNumber>;
155
- amount: z_2.ZodNumber;
156
- }, "strip", z_2.ZodTypeAny, {
157
- amount: number;
158
- limit?: number | undefined;
159
- }, {
160
- amount: number;
161
- limit?: number | undefined;
162
- }>;
163
- weekly: z_2.ZodObject<{
164
- limit: z_2.ZodOptional<z_2.ZodNumber>;
165
- amount: z_2.ZodNumber;
166
- }, "strip", z_2.ZodTypeAny, {
167
- amount: number;
168
- limit?: number | undefined;
169
- }, {
170
- amount: number;
171
- limit?: number | undefined;
172
- }>;
173
- monthly: z_2.ZodObject<{
174
- limit: z_2.ZodOptional<z_2.ZodNumber>;
175
- amount: z_2.ZodNumber;
176
- }, "strip", z_2.ZodTypeAny, {
177
- amount: number;
178
- limit?: number | undefined;
179
- }, {
180
- amount: number;
181
- limit?: number | undefined;
182
- }>;
183
- lifetime: z_2.ZodObject<{
184
- limit: z_2.ZodOptional<z_2.ZodNumber>;
185
- amount: z_2.ZodNumber;
186
- }, "strip", z_2.ZodTypeAny, {
187
- amount: number;
188
- limit?: number | undefined;
189
- }, {
190
- amount: number;
191
- limit?: number | undefined;
192
- }>;
193
- }, "strip", z_2.ZodTypeAny, {
194
- daily: {
195
- amount: number;
196
- limit?: number | undefined;
197
- };
198
- weekly: {
199
- amount: number;
200
- limit?: number | undefined;
201
- };
202
- monthly: {
203
- amount: number;
204
- limit?: number | undefined;
205
- };
206
- lifetime: {
207
- amount: number;
208
- limit?: number | undefined;
209
- };
210
- }, {
211
- daily: {
212
- amount: number;
213
- limit?: number | undefined;
214
- };
215
- weekly: {
216
- amount: number;
217
- limit?: number | undefined;
218
- };
219
- monthly: {
220
- amount: number;
221
- limit?: number | undefined;
222
- };
223
- lifetime: {
224
- amount: number;
225
- limit?: number | undefined;
226
- };
227
- }>;
228
- allowedSpendCategories: z_2.ZodArray<z_2.ZodEnum<["advertisingAndMarketing", "airlines", "carRental", "carService", "education", "electronics", "gasPump", "gasStation", "generalMerchandise", "government", "hardwareAndConstruction", "insurance", "legal", "lodging", "medical", "other", "parking", "phoneAndInternet", "professionalServices", "recreationAndEntertainment", "restaurants", "shipping", "software", "taxisAndRideshare", "transportation", "travelMisc", "utilities"]>, "many">;
229
- allowedMerchants: z_2.ZodArray<z_2.ZodObject<{
230
- id: z_2.ZodUnion<[z_2.ZodString, z_2.ZodString]>;
231
- name: z_2.ZodString;
232
- logoUrl: z_2.ZodNullable<z_2.ZodString>;
233
- }, "strip", z_2.ZodTypeAny, {
234
- id: string;
235
- name: string;
236
- logoUrl: string | null;
237
- }, {
238
- id: string;
239
- name: string;
240
- logoUrl: string | null;
241
- }>, "many">;
242
- physicalCard: z_2.ZodNullable<z_2.ZodObject<z_2.objectUtil.extendShape<{
243
- status: z_2.ZodEnum<["active", "disabled", "canceled"]>;
244
- shipment: z_2.ZodObject<{
245
- address: z_2.ZodObject<{
246
- addressLine1: z_2.ZodString;
247
- addressLine2: z_2.ZodOptional<z_2.ZodNullable<z_2.ZodEffects<z_2.ZodNullable<z_2.ZodString>, string | null, string | null>>>;
248
- city: z_2.ZodString;
249
- state: z_2.ZodEffects<z_2.ZodString, string, string>;
250
- zipcode: z_2.ZodString;
251
- }, "strip", z_2.ZodTypeAny, {
252
- addressLine1: string;
253
- city: string;
254
- state: string;
255
- zipcode: string;
256
- addressLine2?: string | null | undefined;
257
- }, {
258
- addressLine1: string;
259
- city: string;
260
- state: string;
261
- zipcode: string;
262
- addressLine2?: string | null | undefined;
263
- }>;
264
- method: z_2.ZodEnum<["usps", "fedexPriorityOvernight", "fedexTwoDay"]>;
265
- recipientName: z_2.ZodString;
266
- returnReason: z_2.ZodNullable<z_2.ZodString>;
267
- shippedAt: z_2.ZodNullable<z_2.ZodString>;
268
- trackingUpdates: z_2.ZodArray<z_2.ZodObject<{
269
- estimatedDeliveryAt: z_2.ZodNullable<z_2.ZodEffects<z_2.ZodUnion<[z_2.ZodString, z_2.ZodDate]>, string, string | Date>>;
270
- trackingStatus: z_2.ZodEnum<["inTransit", "processedForDelivery", "delivered", "returnedToSender"]>;
271
- city: z_2.ZodNullable<z_2.ZodString>;
272
- createdAt: z_2.ZodEffects<z_2.ZodUnion<[z_2.ZodString, z_2.ZodDate]>, string, string | Date>;
273
- zipcode: z_2.ZodNullable<z_2.ZodString>;
274
- state: z_2.ZodNullable<z_2.ZodString>;
275
- }, "strip", z_2.ZodTypeAny, {
276
- city: string | null;
277
- state: string | null;
278
- zipcode: string | null;
279
- estimatedDeliveryAt: string | null;
280
- trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
281
- createdAt: string;
282
- }, {
283
- city: string | null;
284
- state: string | null;
285
- zipcode: string | null;
286
- estimatedDeliveryAt: string | Date | null;
287
- trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
288
- createdAt: string | Date;
289
- }>, "many">;
290
- status: z_2.ZodEnum<["canceled", "pending", "rejected", "returned", "shipped"]>;
291
- trackingNumber: z_2.ZodNullable<z_2.ZodString>;
292
- trackingUrl: z_2.ZodNullable<z_2.ZodString>;
293
- }, "strip", z_2.ZodTypeAny, {
294
- status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
295
- method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
296
- address: {
297
- addressLine1: string;
298
- city: string;
299
- state: string;
300
- zipcode: string;
301
- addressLine2?: string | null | undefined;
302
- };
303
- recipientName: string;
304
- returnReason: string | null;
305
- shippedAt: string | null;
306
- trackingUpdates: {
307
- city: string | null;
308
- state: string | null;
309
- zipcode: string | null;
310
- estimatedDeliveryAt: string | null;
311
- trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
312
- createdAt: string;
313
- }[];
314
- trackingNumber: string | null;
315
- trackingUrl: string | null;
316
- }, {
317
- status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
318
- method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
319
- address: {
320
- addressLine1: string;
321
- city: string;
322
- state: string;
323
- zipcode: string;
324
- addressLine2?: string | null | undefined;
325
- };
326
- recipientName: string;
327
- returnReason: string | null;
328
- shippedAt: string | null;
329
- trackingUpdates: {
330
- city: string | null;
331
- state: string | null;
332
- zipcode: string | null;
333
- estimatedDeliveryAt: string | Date | null;
334
- trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
335
- createdAt: string | Date;
336
- }[];
337
- trackingNumber: string | null;
338
- trackingUrl: string | null;
339
- }>;
340
- }, {
341
- id: z_2.ZodOptional<z_2.ZodNullable<z_2.ZodString>>;
342
- }>, "strip", z_2.ZodTypeAny, {
343
- status: "active" | "canceled" | "disabled";
344
- shipment: {
345
- status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
346
- method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
347
- address: {
348
- addressLine1: string;
349
- city: string;
350
- state: string;
351
- zipcode: string;
352
- addressLine2?: string | null | undefined;
353
- };
354
- recipientName: string;
355
- returnReason: string | null;
356
- shippedAt: string | null;
357
- trackingUpdates: {
358
- city: string | null;
359
- state: string | null;
360
- zipcode: string | null;
361
- estimatedDeliveryAt: string | null;
362
- trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
363
- createdAt: string;
364
- }[];
365
- trackingNumber: string | null;
366
- trackingUrl: string | null;
367
- };
368
- id?: string | null | undefined;
369
- }, {
370
- status: "active" | "canceled" | "disabled";
371
- shipment: {
372
- status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
373
- method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
374
- address: {
375
- addressLine1: string;
376
- city: string;
377
- state: string;
378
- zipcode: string;
379
- addressLine2?: string | null | undefined;
380
- };
381
- recipientName: string;
382
- returnReason: string | null;
383
- shippedAt: string | null;
384
- trackingUpdates: {
385
- city: string | null;
386
- state: string | null;
387
- zipcode: string | null;
388
- estimatedDeliveryAt: string | Date | null;
389
- trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
390
- createdAt: string | Date;
391
- }[];
392
- trackingNumber: string | null;
393
- trackingUrl: string | null;
394
- };
395
- id?: string | null | undefined;
396
- }>>;
397
- cardSpendPolicyId: z_2.ZodOptional<z_2.ZodNullable<z_2.ZodString>>;
398
- }, "strip", z_2.ZodTypeAny, {
399
- status: "active" | "inactive" | "canceled" | "frozen";
400
- id: string;
401
- platformId: string;
402
- accountUserId: string | null;
403
- last4: string;
404
- cardholderFirstName: string;
405
- cardholderLastName: string;
406
- cardholderPhoneNumber: string;
407
- spend: {
408
- daily: {
409
- amount: number;
410
- limit?: number | undefined;
411
- };
412
- weekly: {
413
- amount: number;
414
- limit?: number | undefined;
415
- };
416
- monthly: {
417
- amount: number;
418
- limit?: number | undefined;
419
- };
420
- lifetime: {
421
- amount: number;
422
- limit?: number | undefined;
423
- };
424
- };
425
- allowedSpendCategories: ("advertisingAndMarketing" | "airlines" | "carRental" | "carService" | "education" | "electronics" | "gasPump" | "gasStation" | "generalMerchandise" | "government" | "hardwareAndConstruction" | "insurance" | "legal" | "lodging" | "medical" | "other" | "parking" | "phoneAndInternet" | "professionalServices" | "recreationAndEntertainment" | "restaurants" | "shipping" | "software" | "taxisAndRideshare" | "transportation" | "travelMisc" | "utilities")[];
426
- allowedMerchants: {
427
- id: string;
428
- name: string;
429
- logoUrl: string | null;
430
- }[];
431
- physicalCard: {
432
- status: "active" | "canceled" | "disabled";
433
- shipment: {
434
- status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
435
- method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
436
- address: {
437
- addressLine1: string;
438
- city: string;
439
- state: string;
440
- zipcode: string;
441
- addressLine2?: string | null | undefined;
442
- };
443
- recipientName: string;
444
- returnReason: string | null;
445
- shippedAt: string | null;
446
- trackingUpdates: {
447
- city: string | null;
448
- state: string | null;
449
- zipcode: string | null;
450
- estimatedDeliveryAt: string | null;
451
- trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
452
- createdAt: string;
453
- }[];
454
- trackingNumber: string | null;
455
- trackingUrl: string | null;
456
- };
457
- id?: string | null | undefined;
458
- } | null;
459
- nickname?: string | null | undefined;
460
- cardSpendPolicyId?: string | null | undefined;
461
- }, {
462
- status: "active" | "inactive" | "canceled" | "frozen";
463
- id: string;
464
- platformId: string;
465
- accountUserId: string | null;
466
- last4: string;
467
- cardholderFirstName: string;
468
- cardholderLastName: string;
469
- cardholderPhoneNumber: string;
470
- spend: {
471
- daily: {
472
- amount: number;
473
- limit?: number | undefined;
474
- };
475
- weekly: {
476
- amount: number;
477
- limit?: number | undefined;
478
- };
479
- monthly: {
480
- amount: number;
481
- limit?: number | undefined;
482
- };
483
- lifetime: {
484
- amount: number;
485
- limit?: number | undefined;
486
- };
487
- };
488
- allowedSpendCategories: ("advertisingAndMarketing" | "airlines" | "carRental" | "carService" | "education" | "electronics" | "gasPump" | "gasStation" | "generalMerchandise" | "government" | "hardwareAndConstruction" | "insurance" | "legal" | "lodging" | "medical" | "other" | "parking" | "phoneAndInternet" | "professionalServices" | "recreationAndEntertainment" | "restaurants" | "shipping" | "software" | "taxisAndRideshare" | "transportation" | "travelMisc" | "utilities")[];
489
- allowedMerchants: {
490
- id: string;
491
- name: string;
492
- logoUrl: string | null;
493
- }[];
494
- physicalCard: {
495
- status: "active" | "canceled" | "disabled";
496
- shipment: {
497
- status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
498
- method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
499
- address: {
500
- addressLine1: string;
501
- city: string;
502
- state: string;
503
- zipcode: string;
504
- addressLine2?: string | null | undefined;
505
- };
506
- recipientName: string;
507
- returnReason: string | null;
508
- shippedAt: string | null;
509
- trackingUpdates: {
510
- city: string | null;
511
- state: string | null;
512
- zipcode: string | null;
513
- estimatedDeliveryAt: string | Date | null;
514
- trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
515
- createdAt: string | Date;
516
- }[];
517
- trackingNumber: string | null;
518
- trackingUrl: string | null;
519
- };
520
- id?: string | null | undefined;
521
- } | null;
522
- nickname?: string | null | undefined;
523
- cardSpendPolicyId?: string | null | undefined;
524
- }>;
525
-
526
- /**
527
- * Renders the CapitalOS Manage Card experience.
528
- */
529
- export declare function CardDetails(props: CardDetailsProps): JSX.Element;
530
-
531
- declare type CardDetailsConditionalProps = {
532
- /**
533
- * Whether to render only the card component, without the surrounding UI.
534
- * @default false
535
- */
536
- cardOnly?: false;
537
- /** This prop can only be used when `cardOnly` is true. */
538
- backOnly?: never;
539
- } | {
540
- /**
541
- * Whether to render only the card component, without the surrounding UI.
542
- * @default false
543
- */
544
- cardOnly: true;
545
- /**
546
- * Whether to render only the back of the card.
547
- * This is only applicable when `cardOnly` is true.
548
- * @default false
549
- */
550
- backOnly?: boolean;
551
- };
552
-
553
- export declare type CardDetailsProps = CommonProps & {
554
- /**
555
- * The ID of the card to manage.
556
- */
557
- cardId: string;
558
- /**
559
- * Whether to hide the address on the back of the card.
560
- */
561
- hideAddress?: boolean | undefined;
562
- /**
563
- * Callback to invoke when the card has been successfully canceled.
564
- */
565
- onCardCanceled?: () => void;
566
- /**
567
- * Callback to invoke when the user requests to hide sensitive details.
568
- */
569
- onHideSensitiveDetails?: () => void;
570
- } & CardDetailsConditionalProps;
571
-
572
- /**
573
- * Renders the CapitalOS CardsApp.
574
- */
575
- export declare function CardsApp(props: CommonProps): JSX.Element;
576
-
577
- export declare type ChildFunctions = {
578
- freezeCard: (cardId: string) => Promise<ClientActionResult<Card>>;
579
- unfreezeCard: (cardId: string) => Promise<ClientActionResult<Card>>;
580
- };
581
-
582
- export declare type ClientActionResult<T> = {
583
- success: true;
584
- canceled: false;
585
- data: T;
586
- } | {
587
- success: false;
588
- canceled: true;
589
- } | {
590
- success: false;
591
- canceled: false;
592
- error: string;
593
- };
594
-
595
- export declare type CommonProps = {
596
- /**
597
- * The token provided by initiate-login.
598
- */
599
- token?: string;
600
- /**
601
- * Optional CSS class name for the component.
602
- */
603
- className?: string;
604
- /**
605
- * Optional flag indicating whether to log events to the console.
606
- */
607
- enableLogging?: boolean;
608
- /**
609
- * Optional callback for when the app encounters an error.
610
- */
611
- onError?: (error: Error) => void;
612
- /**
613
- * Optional component to render while the app is loading.
614
- */
615
- loadingComponent?: ReactNode;
616
- /**
617
- * Optional theme color scheme to apply to the app or component.
618
- */
619
- theme?: ThemeColorScheme;
620
- };
621
-
622
- /**
623
- * Renders the CapitalOS Configure Autopay experience.
624
- */
625
- export declare function ConfigureAutoPay({ onClose, ...restOfProps }: ConfigureAutoPayProps): JSX.Element;
626
-
627
- export declare type ConfigureAutoPayProps = CommonProps & {
628
- /**
629
- * Callback to invoke when the user closes the autopay configuration screen.
630
- */
631
- onClose: () => void;
632
- };
633
-
634
- /**
635
- * Renders the CapitalOS Connect To Vendors experience.
636
- */
637
- export declare function ConnectToVendors({ cardId, onClose, inlineCardOnFile, ...restOfProps }: ConnectToVendorsProps): JSX.Element;
638
-
639
- export declare type ConnectToVendorsProps = CommonProps & {
640
- /**
641
- * The ID of the card to connect to vendor services. If not provided, uses the default card.
642
- */
643
- cardId?: string;
644
- /**
645
- * Callback to invoke when the user closes the connect to vendors screen.
646
- */
647
- onClose: () => void;
648
- /**
649
- * Whether to render the card-on-file experience inline instead of opening it in a separate modal.
650
- * When true, the card-on-file flow will replace the current content rather than stacking modals.
651
- */
652
- inlineCardOnFile?: boolean;
653
- };
654
-
655
- export declare function ContactSupport({ onDone, onCancel, ...restOfProps }: ContactSupportProps): JSX.Element;
656
-
657
- export declare type ContactSupportProps = CommonProps & {
658
- onDone: () => void;
659
- onCancel: () => void;
660
- };
661
-
662
- export declare function decodeOneTimeToken(token: string): any;
663
-
664
- /**
665
- * Renders the CapitalOS Dev Tools experience.
666
- * Allows for simulating transactions, etc.
667
- */
668
- declare function DevTools(props: DevToolsProps): JSX.Element;
669
- export { DevTools }
670
- export { DevTools as DevTools_alias_1 }
671
-
672
- export declare function DevToolsButton({ onClick, isLoading }: DevToolsButtonProps): JSX.Element;
673
-
674
- declare interface DevToolsButtonProps {
675
- onClick?: () => void;
676
- isLoading?: boolean;
677
- }
678
-
679
- export declare type DevToolsProps = CommonProps;
680
-
681
- /**
682
- * Renders the CapitalOS Dispute Transaction experience.
683
- */
684
- export declare function DisputeTransaction({ transactionId, onDone, onCancel, ...restOfProps }: DisputeTransactionProps): JSX.Element;
685
-
686
- export declare type DisputeTransactionProps = CommonProps & {
687
- /**
688
- * The ID of the transaction to dispute.
689
- */
690
- transactionId: string;
691
- /**
692
- * Callback to invoke when the dispute was successfully submitted.
693
- */
694
- onDone: () => void;
695
- /**
696
- * Callback to invoke when the user cancels the dispute submission.
697
- */
698
- onCancel: () => void;
699
- };
700
-
701
- /**
702
- * Encodes the rendering context as base64 and then URI encodes it.
703
- */
704
- export declare function encodeRenderingContext<T>(renderingContext: NonNullable<T>): string;
705
-
706
- export declare type EntryPoint = RenderingContext_2['entryPoint'];
707
-
708
- export declare const ErrorCode: {
709
- readonly unauthorized: "unauthorized";
710
- readonly invalid_account_status: "invalid_account_status";
711
- readonly unsupported_entry_point: "unsupported_entry_point";
712
- readonly internal_error: "internal_error";
713
- };
714
-
715
- export declare type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
716
-
717
- export declare const IframeResizer: React_2.ForwardRefExoticComponent<Omit<IFrameOptions, "closedCallback" | "scrollCallback" | "resizedCallback" | "messageCallback" | "initCallback"> & {
718
- onClosed?(iframeId: string): void;
719
- onInit?(iframe: IFrameComponent): void;
720
- onMessage?(data: IFrameMessageData): void;
721
- onResized?(data: IFrameResizedData): void;
722
- onScroll?(data: IFrameScrollData): boolean;
723
- } & React_2.IframeHTMLAttributes<HTMLIFrameElement> & React_2.RefAttributes<HTMLIFrameElement>>;
724
-
725
- /**
726
- * Renders the CapitalOS Insights Dashboard experience
727
- */
728
- export declare function InsightsDashboard(props: InsightsDashboardProps): JSX.Element;
729
-
730
- export declare type InsightsDashboardProps = CommonProps;
731
-
732
- /**
733
- * Renders a specific CapitalOS Insights Widget
734
- */
735
- export declare function InsightsWidget(props: InsightsWidgetProps): JSX.Element;
736
-
737
- export declare type InsightsWidgetProps = CommonProps & {
738
- /**
739
- * The specific widget to render.
740
- * naming convention:
741
- * 1. Over-time Widgets
742
- * over-time-{metric}-by-{dimension}-per-{time-granularity}
743
- * 2. Top/Ranking Widgets
744
- * top-{entities}-by-{metric}-{timeframe}
745
- * 3. Comparison Widgets
746
- * comparison-{metric}-{primary-timeframe}-vs-{secondary-timeframe}
747
- */
748
- widget: 'over-time-spend-by-card-per-month' | 'over-time-spend-by-category-per-month' | 'top-cards-by-spend-this-month' | 'top-categories-by-spend-this-month' | 'top-transactions-by-amount-this-month' | 'comparison-spend-this-month-vs-last-month';
749
- /**
750
- * Whether to hide the title of the widget.
751
- */
752
- hideTitle?: boolean | undefined;
753
- /**
754
- * The height of the widget.
755
- */
756
- height?: number | undefined;
757
- /**
758
- * The width of the widget.
759
- */
760
- width?: number | undefined;
761
- };
762
-
763
- /**
764
- * Represents an error that occurs when an invalid token is encountered.
765
- */
766
- export declare class InvalidTokenError extends CapitalOSError {
767
- constructor(message?: string);
768
- }
769
-
770
- /**
771
- * Renders the CapitalOS Issue Card experience.
772
- */
773
- export declare function IssueCard({ cardholder, onDone, onCancel, ...restOfProps }: IssueCardProps): JSX.Element;
774
-
775
- export declare type IssueCardDefaultValues = z.infer<typeof issueCardDefaultValuesSchema>;
776
-
777
- declare const issueCardDefaultValuesSchema: z.ZodUnion<[z.ZodObject<{
778
- firstName: z.ZodString;
779
- lastName: z.ZodString;
780
- phone: z.ZodString;
781
- }, "strip", z.ZodTypeAny, {
782
- firstName: string;
783
- lastName: string;
784
- phone: string;
785
- }, {
786
- firstName: string;
787
- lastName: string;
788
- phone: string;
789
- }>, z.ZodObject<{
790
- userId: z.ZodString;
791
- }, "strip", z.ZodTypeAny, {
792
- userId: string;
793
- }, {
794
- userId: string;
795
- }>]>;
796
-
797
- export declare type IssueCardProps = CommonProps & {
798
- /**
799
- * Default values to prefill the form with.
800
- *
801
- * Either provide a userId, in which case the default values will be taken from that user's profile, or provide the cardholder's details directly.
802
- */
803
- cardholder?: IssueCardDefaultValues;
804
- /**
805
- * Callback to invoke when the card was created successfully.
806
- */
807
- onDone: () => void;
808
- /**
809
- * Callback to invoke when the card creation was cancelled by the user.
810
- */
811
- onCancel: () => void;
812
- };
813
-
814
- export declare function LegalDocuments({ onDone, ...restOfProps }: LegalDocumentsProps): JSX.Element;
815
-
816
- export declare type LegalDocumentsProps = CommonProps & {
817
- onDone: () => void;
818
- };
819
-
820
- export declare const logger: {
821
- log: (message: string, options?: LoggerOptions) => void;
822
- warn: (message: string, options?: LoggerOptions) => void;
823
- error: (message: string, options?: LoggerOptions) => void;
824
- };
825
-
826
- declare type LoggerOptions = {
827
- enableLogging: boolean | undefined;
828
- };
829
-
830
- /**
831
- * Renders the CapitalOS Make a Payment experience.
832
- */
833
- export declare function MakePayment({ onDone, ...restOfProps }: MakePaymentProps): JSX.Element;
834
-
835
- export declare type MakePaymentProps = CommonProps & {
836
- /**
837
- * Callback to invoke when the payment was made successfully.
838
- */
839
- onDone: () => void;
840
- };
841
-
842
- /**
843
- * Renders the CapitalOS Manage Bank Connections experience.
844
- */
845
- export declare function ManageBankConnections({ onClose, ...restOfProps }: ManageBankConnectionsProps): JSX.Element;
846
-
847
- export declare type ManageBankConnectionsProps = CommonProps & {
848
- /**
849
- * Callback to invoke when the user closes the bank connections management interface.
850
- */
851
- onClose: () => void;
852
- };
853
-
854
- export declare function Mfa({ onDone, onCancel, mfaId, destination, codeLength, canResendAfter, operationName, ...restOfProps }: MfaProps): JSX.Element;
855
-
856
- export declare type MfaActionResult = ActionResult<void>;
857
-
858
- export declare type MfaProps = CommonProps & {
859
- /**
860
- * The ID of the MFA request.
861
- */
862
- mfaId: string;
863
- /**
864
- * The destination of the MFA request.
865
- */
866
- destination: string;
867
- /**
868
- * The length of the code to be entered.
869
- */
870
- codeLength: number;
871
- /**
872
- * ISO string representation of DateTime in UTC
873
- */
874
- canResendAfter: string;
875
- /**
876
- * The name of the operation that is being performed.
877
- */
878
- operationName?: string;
879
- /**
880
- * Callback to invoke when the MFA was successfully completed.
881
- */
882
- onDone: () => void;
883
- /**
884
- * Callback to invoke when the MFA was cancelled by the user.
885
- */
886
- onCancel: () => void;
887
- };
888
-
889
- export declare interface MfaRequestContext {
890
- mfaId: string;
891
- destination: string;
892
- codeLength: number;
893
- canResendAfter: string;
894
- operationName?: string;
895
- }
896
-
897
- export declare interface MfaResult {
898
- success: boolean;
899
- canceled?: boolean;
900
- error?: string;
901
- }
902
-
903
- declare interface MfaState {
904
- context: MfaRequestContext;
905
- resolve: (result: MfaActionResult) => void;
906
- reject: (error: Error) => void;
907
- }
908
-
909
- /**
910
- * Generic modal component that displays content with backdrop/blur
911
- */
912
- export declare function Modal({ onClose, children, ariaLabel }: ModalProps): JSX.Element;
913
-
914
- export declare interface ModalProps {
915
- /**
916
- * Callback when modal should be closed (backdrop click)
917
- */
918
- onClose: () => void;
919
- /**
920
- * Content to render inside the modal
921
- */
922
- children: ReactNode;
923
- /**
924
- * Accessible label for screen readers
925
- */
926
- ariaLabel?: string;
927
- }
928
-
929
- export declare function Onboarding<T extends OnboardingEntryPoint>({ onDone, entryPoint: onboardingEntryPoint, exitPoint: onboardingExitPoint, ...restOfProps }: OnboardingProps<T>): JSX.Element;
930
-
931
- declare type OnboardingEntryPoint = keyof AllowedExitPoints;
932
-
933
- declare type OnboardingProps<T extends keyof AllowedExitPoints> = CommonProps & {
934
- entryPoint?: T;
935
- exitPoint?: AllowedExitPoints[T];
936
- onDone: (account: Account) => void;
937
- };
938
-
939
- export declare type ParentFunctions = {
940
- onLoad: () => void;
941
- onError: (error: RawErrorDetails) => void;
942
- /**
943
- * Called when the iframe detects that the JWT token has expired.
944
- * This triggers the token refresh flow, which will obtain a new token
945
- * and reload the iframe with the fresh token.
946
- */
947
- onTokenExpired?: () => void;
948
- cardDetails?: {
949
- onCardCanceled?: () => void;
950
- onHideSensitiveDetails?: () => void;
951
- };
952
- contactSupport?: {
953
- onDone?: () => void;
954
- onCancel?: () => void;
955
- };
956
- createCard?: {
957
- onDone?: () => void;
958
- onCancel?: () => void;
959
- };
960
- createDispute?: {
961
- onDone?: () => void;
962
- onCancel?: () => void;
963
- };
964
- devTools?: {
965
- onClose?: () => void;
966
- };
967
- legalDocuments?: {
968
- onDone?: () => void;
969
- };
970
- makePayment?: {
971
- onDone?: () => void;
972
- };
973
- manageBankConnections?: {
974
- onClose?: () => void;
975
- };
976
- configureAutoPay?: {
977
- onClose?: () => void;
978
- };
979
- policySettings?: {
980
- onClose?: () => void;
981
- };
982
- connectToVendors?: {
983
- onClose?: () => void;
984
- };
985
- mfa?: {
986
- onDone?: () => void;
987
- onCancel?: () => void;
988
- };
989
- onboarding?: {
990
- onDone?: (account: Account) => void;
991
- };
992
- replaceCard?: {
993
- onDone?: (result: {
994
- oldCardId: string;
995
- newCardId: string;
996
- }) => void;
997
- onClose?: () => void;
998
- };
999
- 'system-messages'?: {
1000
- requestMfa?: (context: MfaRequestContext) => Promise<MfaResult>;
1001
- };
1002
- statements?: {
1003
- onDone?: () => void;
1004
- };
1005
- terminateCard?: {
1006
- onDone?: () => void;
1007
- onClose?: () => void;
1008
- };
1009
- tokenExchange?: {
1010
- onLongLivedToken?: (jwtToken: string) => void;
1011
- };
1012
- };
1013
-
1014
- /**
1015
- * Renders the CapitalOS Policy Settings experience.
1016
- */
1017
- export declare function PolicySettings({ onClose, ...restOfProps }: PolicySettingsProps): JSX.Element;
1018
-
1019
- export declare type PolicySettingsProps = CommonProps & {
1020
- /**
1021
- * Callback to invoke when the user closes the policy settings screen.
1022
- */
1023
- onClose: () => void;
1024
- };
1025
-
1026
- declare type ProviderProps = {
1027
- getToken: () => Promise<string>;
1028
- enableLogging?: boolean | undefined;
1029
- children: React_2.ReactNode;
1030
- };
1031
-
1032
- /**
1033
- * An error type providing a reason code and message.
1034
- * Penpal only passes plain objects, so this does not inherit from Error.
1035
- */
1036
- export declare type RawErrorDetails = {
1037
- code: ErrorCode;
1038
- message: string;
1039
- };
1040
-
1041
- declare type RenderingContext_2 = z.infer<typeof renderingContextSchema>;
1042
-
1043
- declare const renderingContextSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<"entryPoint", [z.ZodObject<{
1044
- entryPoint: z.ZodLiteral<"createCard">;
1045
- cardholder: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
1046
- firstName: z.ZodString;
1047
- lastName: z.ZodString;
1048
- phone: z.ZodString;
1049
- }, "strip", z.ZodTypeAny, {
1050
- firstName: string;
1051
- lastName: string;
1052
- phone: string;
1053
- }, {
1054
- firstName: string;
1055
- lastName: string;
1056
- phone: string;
1057
- }>, z.ZodObject<{
1058
- userId: z.ZodString;
1059
- }, "strip", z.ZodTypeAny, {
1060
- userId: string;
1061
- }, {
1062
- userId: string;
1063
- }>]>>>;
1064
- }, "strip", z.ZodTypeAny, {
1065
- entryPoint: "createCard";
1066
- cardholder?: {
1067
- firstName: string;
1068
- lastName: string;
1069
- phone: string;
1070
- } | {
1071
- userId: string;
1072
- } | null | undefined;
1073
- }, {
1074
- entryPoint: "createCard";
1075
- cardholder?: {
1076
- firstName: string;
1077
- lastName: string;
1078
- phone: string;
1079
- } | {
1080
- userId: string;
1081
- } | null | undefined;
1082
- }>, z.ZodObject<{
1083
- entryPoint: z.ZodLiteral<"createDispute">;
1084
- transactionId: z.ZodString;
1085
- }, "strip", z.ZodTypeAny, {
1086
- entryPoint: "createDispute";
1087
- transactionId: string;
1088
- }, {
1089
- entryPoint: "createDispute";
1090
- transactionId: string;
1091
- }>, z.ZodObject<{
1092
- entryPoint: z.ZodLiteral<"billPayApp">;
1093
- }, "strip", z.ZodTypeAny, {
1094
- entryPoint: "billPayApp";
1095
- }, {
1096
- entryPoint: "billPayApp";
1097
- }>, z.ZodObject<{
1098
- entryPoint: z.ZodLiteral<"cardDetails">;
1099
- cardId: z.ZodString;
1100
- cardOnly: z.ZodOptional<z.ZodBoolean>;
1101
- hideAddress: z.ZodOptional<z.ZodBoolean>;
1102
- backOnly: z.ZodOptional<z.ZodBoolean>;
1103
- }, "strip", z.ZodTypeAny, {
1104
- cardId: string;
1105
- entryPoint: "cardDetails";
1106
- cardOnly?: boolean | undefined;
1107
- hideAddress?: boolean | undefined;
1108
- backOnly?: boolean | undefined;
1109
- }, {
1110
- cardId: string;
1111
- entryPoint: "cardDetails";
1112
- cardOnly?: boolean | undefined;
1113
- hideAddress?: boolean | undefined;
1114
- backOnly?: boolean | undefined;
1115
- }>, z.ZodObject<{
1116
- entryPoint: z.ZodLiteral<"accountDetails">;
1117
- }, "strip", z.ZodTypeAny, {
1118
- entryPoint: "accountDetails";
1119
- }, {
1120
- entryPoint: "accountDetails";
1121
- }>, z.ZodObject<{
1122
- entryPoint: z.ZodLiteral<"accountActions">;
1123
- }, "strip", z.ZodTypeAny, {
1124
- entryPoint: "accountActions";
1125
- }, {
1126
- entryPoint: "accountActions";
1127
- }>, z.ZodObject<{
1128
- entryPoint: z.ZodLiteral<"manageBankConnections">;
1129
- }, "strip", z.ZodTypeAny, {
1130
- entryPoint: "manageBankConnections";
1131
- }, {
1132
- entryPoint: "manageBankConnections";
1133
- }>, z.ZodObject<{
1134
- entryPoint: z.ZodLiteral<"configureAutoPay">;
1135
- }, "strip", z.ZodTypeAny, {
1136
- entryPoint: "configureAutoPay";
1137
- }, {
1138
- entryPoint: "configureAutoPay";
1139
- }>, z.ZodObject<{
1140
- entryPoint: z.ZodLiteral<"policySettings">;
1141
- }, "strip", z.ZodTypeAny, {
1142
- entryPoint: "policySettings";
1143
- }, {
1144
- entryPoint: "policySettings";
1145
- }>, z.ZodObject<{
1146
- entryPoint: z.ZodLiteral<"connectToVendors">;
1147
- cardId: z.ZodOptional<z.ZodString>;
1148
- inlineCardOnFile: z.ZodOptional<z.ZodBoolean>;
1149
- }, "strip", z.ZodTypeAny, {
1150
- entryPoint: "connectToVendors";
1151
- cardId?: string | undefined;
1152
- inlineCardOnFile?: boolean | undefined;
1153
- }, {
1154
- entryPoint: "connectToVendors";
1155
- cardId?: string | undefined;
1156
- inlineCardOnFile?: boolean | undefined;
1157
- }>, z.ZodObject<{
1158
- entryPoint: z.ZodLiteral<"insightsDashboard">;
1159
- }, "strip", z.ZodTypeAny, {
1160
- entryPoint: "insightsDashboard";
1161
- }, {
1162
- entryPoint: "insightsDashboard";
1163
- }>, z.ZodObject<{
1164
- entryPoint: z.ZodLiteral<"insightsWidget">;
1165
- widget: z.ZodEnum<["over-time-spend-by-card-per-month", "over-time-spend-by-category-per-month", "top-cards-by-spend-this-month", "top-categories-by-spend-this-month", "top-transactions-by-amount-this-month", "comparison-spend-this-month-vs-last-month"]>;
1166
- hideTitle: z.ZodOptional<z.ZodBoolean>;
1167
- height: z.ZodOptional<z.ZodNumber>;
1168
- width: z.ZodOptional<z.ZodNumber>;
1169
- }, "strip", z.ZodTypeAny, {
1170
- entryPoint: "insightsWidget";
1171
- widget: "over-time-spend-by-card-per-month" | "over-time-spend-by-category-per-month" | "top-cards-by-spend-this-month" | "top-categories-by-spend-this-month" | "top-transactions-by-amount-this-month" | "comparison-spend-this-month-vs-last-month";
1172
- hideTitle?: boolean | undefined;
1173
- height?: number | undefined;
1174
- width?: number | undefined;
1175
- }, {
1176
- entryPoint: "insightsWidget";
1177
- widget: "over-time-spend-by-card-per-month" | "over-time-spend-by-category-per-month" | "top-cards-by-spend-this-month" | "top-categories-by-spend-this-month" | "top-transactions-by-amount-this-month" | "comparison-spend-this-month-vs-last-month";
1178
- hideTitle?: boolean | undefined;
1179
- height?: number | undefined;
1180
- width?: number | undefined;
1181
- }>, z.ZodObject<{
1182
- entryPoint: z.ZodLiteral<"onboarding">;
1183
- onboardingEntryPoint: z.ZodDefault<z.ZodEnum<["welcome", "application"]>>;
1184
- onboardingExitPoint: z.ZodDefault<z.ZodEnum<["application", "activation"]>>;
1185
- }, "strip", z.ZodTypeAny, {
1186
- entryPoint: "onboarding";
1187
- onboardingEntryPoint: "welcome" | "application";
1188
- onboardingExitPoint: "application" | "activation";
1189
- }, {
1190
- entryPoint: "onboarding";
1191
- onboardingEntryPoint?: "welcome" | "application" | undefined;
1192
- onboardingExitPoint?: "application" | "activation" | undefined;
1193
- }>, z.ZodObject<{
1194
- entryPoint: z.ZodLiteral<"cardsApp">;
1195
- }, "strip", z.ZodTypeAny, {
1196
- entryPoint: "cardsApp";
1197
- }, {
1198
- entryPoint: "cardsApp";
1199
- }>, z.ZodObject<{
1200
- entryPoint: z.ZodLiteral<"tokenExchange">;
1201
- }, "strip", z.ZodTypeAny, {
1202
- entryPoint: "tokenExchange";
1203
- }, {
1204
- entryPoint: "tokenExchange";
1205
- }>, z.ZodObject<{
1206
- entryPoint: z.ZodLiteral<"makePayment">;
1207
- }, "strip", z.ZodTypeAny, {
1208
- entryPoint: "makePayment";
1209
- }, {
1210
- entryPoint: "makePayment";
1211
- }>, z.ZodObject<{
1212
- entryPoint: z.ZodLiteral<"devTools">;
1213
- }, "strip", z.ZodTypeAny, {
1214
- entryPoint: "devTools";
1215
- }, {
1216
- entryPoint: "devTools";
1217
- }>, z.ZodObject<{
1218
- entryPoint: z.ZodLiteral<"contactSupport">;
1219
- }, "strip", z.ZodTypeAny, {
1220
- entryPoint: "contactSupport";
1221
- }, {
1222
- entryPoint: "contactSupport";
1223
- }>, z.ZodObject<{
1224
- entryPoint: z.ZodLiteral<"statements">;
1225
- }, "strip", z.ZodTypeAny, {
1226
- entryPoint: "statements";
1227
- }, {
1228
- entryPoint: "statements";
1229
- }>, z.ZodObject<{
1230
- entryPoint: z.ZodLiteral<"legalDocuments">;
1231
- }, "strip", z.ZodTypeAny, {
1232
- entryPoint: "legalDocuments";
1233
- }, {
1234
- entryPoint: "legalDocuments";
1235
- }>, z.ZodObject<{
1236
- entryPoint: z.ZodLiteral<"replaceCard">;
1237
- cardId: z.ZodString;
1238
- }, "strip", z.ZodTypeAny, {
1239
- cardId: string;
1240
- entryPoint: "replaceCard";
1241
- }, {
1242
- cardId: string;
1243
- entryPoint: "replaceCard";
1244
- }>, z.ZodObject<{
1245
- entryPoint: z.ZodLiteral<"terminateCard">;
1246
- cardId: z.ZodString;
1247
- }, "strip", z.ZodTypeAny, {
1248
- cardId: string;
1249
- entryPoint: "terminateCard";
1250
- }, {
1251
- cardId: string;
1252
- entryPoint: "terminateCard";
1253
- }>, z.ZodObject<{
1254
- entryPoint: z.ZodLiteral<"actions">;
1255
- }, "strip", z.ZodTypeAny, {
1256
- entryPoint: "actions";
1257
- }, {
1258
- entryPoint: "actions";
1259
- }>, z.ZodObject<{
1260
- entryPoint: z.ZodLiteral<"mfa">;
1261
- mfaId: z.ZodString;
1262
- destination: z.ZodString;
1263
- codeLength: z.ZodNumber;
1264
- canResendAfter: z.ZodString;
1265
- operationName: z.ZodOptional<z.ZodString>;
1266
- }, "strip", z.ZodTypeAny, {
1267
- entryPoint: "mfa";
1268
- mfaId: string;
1269
- destination: string;
1270
- codeLength: number;
1271
- canResendAfter: string;
1272
- operationName?: string | undefined;
1273
- }, {
1274
- entryPoint: "mfa";
1275
- mfaId: string;
1276
- destination: string;
1277
- codeLength: number;
1278
- canResendAfter: string;
1279
- operationName?: string | undefined;
1280
- }>, z.ZodObject<{
1281
- entryPoint: z.ZodLiteral<"transactions">;
1282
- }, "strip", z.ZodTypeAny, {
1283
- entryPoint: "transactions";
1284
- }, {
1285
- entryPoint: "transactions";
1286
- }>]>, z.ZodObject<{
1287
- referer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1288
- }, "strip", z.ZodTypeAny, {
1289
- referer?: string | null | undefined;
1290
- }, {
1291
- referer?: string | null | undefined;
1292
- }>>;
1293
-
1294
- export declare function ReplaceCard({ cardId, onDone, onClose, ...restOfProps }: ReplaceCardProps): JSX.Element;
1295
-
1296
- export declare type ReplaceCardProps = CommonProps & {
1297
- cardId: string;
1298
- onDone: (result: {
1299
- oldCardId: string;
1300
- newCardId: string;
1301
- }) => void;
1302
- onClose: () => void;
1303
- };
1304
-
1305
- /**
1306
- * Safely decodes a URL component, handling potential errors
1307
- */
1308
- export declare function safeDecodeURIComponent(str: string): string;
1309
-
1310
- export declare function Statements({ onDone, ...restOfProps }: StatementsProps): JSX.Element;
1311
-
1312
- export declare type StatementsProps = CommonProps & {
1313
- onDone: () => void;
1314
- };
1315
-
1316
- export declare function TerminateCard({ cardId, onDone, onClose, ...restOfProps }: TerminateCardProps): JSX.Element;
1317
-
1318
- export declare type TerminateCardProps = CommonProps & {
1319
- cardId: string;
1320
- onDone: () => void;
1321
- onClose: () => void;
1322
- };
1323
-
1324
- export declare type ThemeColorScheme = 'light' | 'dark' | 'system';
1325
-
1326
- export declare type TokenData = {
1327
- token: string;
1328
- tokenType: TokenType;
1329
- baseUrl: string;
1330
- paramKey: TokenParamKey;
1331
- paramLocation: TokenParamLocation;
1332
- };
1333
-
1334
- export declare function tokenDataFromOneTimeToken(oneTimeToken: string): TokenData;
1335
-
1336
- /**
1337
- * The component is hidden from the user and is only used to exchange a one-time token for a JWT in the authentication context.
1338
- *
1339
- * The token exchange process works as follows:
1340
- * 1. Component renders a hidden iframe with the one-time token in the URL
1341
- * 2. The iframe loads with the long-lived token as part of its url redirect response and establishes a secure connection with the parent window
1342
- * 3. The iframe passes the long-lived token to the parent via postMessage
1343
- * 4. onExchangeComplete callback is triggered with the new JWT
1344
- *
1345
- * If any errors occur during this process, they are passed to onExchangeError.
1346
- */
1347
- export declare function TokenExchangeIframe(props: TokenExchangeIframeProps): JSX.Element;
1348
-
1349
- export declare interface TokenExchangeIframeProps {
1350
- oneTimeToken: string;
1351
- enableLogging?: boolean | undefined;
1352
- onExchangeComplete: (jwtToken: string) => void;
1353
- onExchangeError?: (error: Error) => void;
1354
- }
1355
-
1356
- export declare enum TokenParamKey {
1357
- token = "token",
1358
- accessToken = "access_token"
1359
- }
1360
-
1361
- export declare enum TokenParamLocation {
1362
- search = "search",
1363
- hash = "hash"
1364
- }
1365
-
1366
- export declare class TokenRefreshError extends CapitalOSError {
1367
- constructor(originalError?: Error);
1368
- }
1369
-
1370
- export declare enum TokenType {
1371
- oneTime = "oneTime",
1372
- longLived = "longLived"
1373
- }
1374
-
1375
- /**
1376
- * Renders the CapitalOS Transactions experience.
1377
- */
1378
- export declare function Transactions(props: TransactionsProps): JSX.Element;
1379
-
1380
- export declare type TransactionsProps = CommonProps;
1381
-
1382
- /**
1383
- * Hook to access the actions iframe functions.
1384
- *
1385
- * @returns An object containing the actions functions and loading state
1386
- * @throws {CapitalOSError} If the hook is used outside of a CapitalOS component
1387
- *
1388
- * @example
1389
- * ```tsx
1390
- * const { actions, isLoading } = useActions()
1391
- *
1392
- * if (isLoading) {
1393
- * return <LoadingSpinner />
1394
- * }
1395
- *
1396
- * // Use the actions
1397
- * await actions.freezeCard()
1398
- * ```
1399
- */
1400
- export declare function useActions(): {
1401
- actions: ChildFunctions | null;
1402
- isLoading: boolean;
1403
- };
1404
-
1405
- export declare const useCapitalOsAuthContext: () => CapitalOsAuthenticationContextType;
1406
-
1407
- /**
1408
- * Hook to resolve logging preference, with direct prop taking precedence over context.
1409
- * @param enableLoggingProp Direct prop for enableLogging.
1410
- * @returns Effective logging flag.
1411
- */
1412
- export declare function useEnableLogging(enableLoggingProp?: boolean): boolean;
1413
-
1414
- /**
1415
- * A React hook that manages the iframe connection lifecycle, including:
1416
- * - Establishing and maintaining the iframe connection
1417
- * - Handling token expiration and refresh flows
1418
- * - Managing loading states
1419
- * - Coordinating between one-time tokens and context-based authentication
1420
- * - Providing error handling and logging capabilities
1421
- */
1422
- export declare function useIframe(props: {
1423
- renderingContext: CapitalOsRenderingContext;
1424
- oneTimeToken?: string | undefined;
1425
- enableLogging?: boolean | undefined;
1426
- onError?: ((error: Error) => void) | undefined;
1427
- theme?: ThemeColorScheme | undefined;
1428
- methods?: Partial<Omit<ParentFunctions, 'onLoad' | 'onError' | 'onTokenExpired'>> | undefined;
1429
- }): {
1430
- isLoaded: boolean;
1431
- url: string | undefined;
1432
- tokenData: TokenData | undefined;
1433
- iframeRef: RefObject<HTMLIFrameElement>;
1434
- connection: Connection<ChildFunctions> | null;
1435
- };
1436
-
1437
- /**
1438
- * connects to child iframe and returns whether the iframe is loaded or not.
1439
- * token was added to the list of dependencies to make sure that the connection is re-established when the token changes.
1440
- */
1441
- export declare function useIframeConnection({ iframeRef, token, onError, methods, }: {
1442
- iframeRef: React.RefObject<HTMLIFrameElement>;
1443
- token: string | undefined;
1444
- onError: ((error: Error) => void) | undefined | null;
1445
- methods: ParentFunctions;
1446
- }): Connection<ChildFunctions> | null;
1447
-
1448
- /**
1449
- * returns a memoized url of the iframe or undefined if the token is not available yet.
1450
- */
1451
- export declare function useIframeUrl({ tokenData, renderingContext, theme, onError, }: {
1452
- tokenData: TokenData | undefined;
1453
- renderingContext: CapitalOsRenderingContext;
1454
- theme?: ThemeColorScheme | undefined;
1455
- onError?: ((error: Error) => void) | undefined;
1456
- }): string | undefined;
1457
-
1458
- /**
1459
- * Hook that provides stable logging functions (log, warn, error), scoped to the resolved enableLogging flag.
1460
- * @param enableLoggingProp Optional direct prop to override logging.
1461
- */
1462
- export declare function useLogger(enableLoggingProp?: boolean): {
1463
- log: (message: string) => void;
1464
- warn: (message: string) => void;
1465
- error: (message: string) => void;
1466
- };
1467
-
1468
- export declare function useMfaState(): {
1469
- activeMfaRequest: MfaState | null;
1470
- isMfaActive: boolean;
1471
- mfaContext: MfaRequestContext | null;
1472
- requestMfa: (context: MfaRequestContext) => Promise<MfaActionResult>;
1473
- handleMfaDone: () => void;
1474
- handleMfaCancel: () => void;
1475
- handleMfaError: (error: CapitalOSError) => void;
1476
- };
1477
-
1478
- export { }
1
+ import { Connection } from 'penpal';
2
+ import { IFrameComponent } from 'iframe-resizer';
3
+ import { IFrameMessageData } from 'iframe-resizer';
4
+ import { IFrameOptions } from 'iframe-resizer';
5
+ import { IFrameResizedData } from 'iframe-resizer';
6
+ import { IFrameScrollData } from 'iframe-resizer';
7
+ import { default as React_2 } from 'react';
8
+ import { ReactNode } from 'react';
9
+ import { RefObject } from 'react';
10
+ import { z } from 'zod';
11
+ import * as z_2 from 'zod';
12
+
13
+ export declare type Account = {
14
+ status: AccountStatus;
15
+ };
16
+
17
+ /**
18
+ * Renders the CapitalOS Account Actions experience.
19
+ */
20
+ export declare function AccountActions(props: AccountActionsProps): JSX.Element;
21
+
22
+ export declare type AccountActionsProps = CommonProps;
23
+
24
+ /**
25
+ * Renders the CapitalOS Account Details experience.
26
+ */
27
+ export declare function AccountDetails(props: AccountDetailsProps): JSX.Element;
28
+
29
+ export declare type AccountDetailsProps = CommonProps;
30
+
31
+ export declare type AccountStatus = z_2.infer<typeof accountStatusSchema>;
32
+
33
+ declare const accountStatusSchema: z_2.ZodEnum<["eligible", "ineligible", "engaged", "onboarding", "approved", "processing", "pending", "declined", "closed", "waiting"]>;
34
+
35
+ export declare type ActionResult<T = void> = {
36
+ success: true;
37
+ canceled: false;
38
+ data: T;
39
+ } | {
40
+ success: false;
41
+ canceled: true;
42
+ } | {
43
+ success: false;
44
+ canceled: false;
45
+ error: CapitalOSError;
46
+ };
47
+
48
+ export declare const ActionsIframeContext: React_2.Context<ActionsIframeContextValue | null>;
49
+
50
+ declare interface ActionsIframeContextValue {
51
+ childFunctions: ChildFunctions | null;
52
+ actions: {
53
+ freezeCard: (cardId: string) => Promise<ActionResult<Card>>;
54
+ unfreezeCard: (cardId: string) => Promise<ActionResult<Card>>;
55
+ } | null;
56
+ isLoading: boolean;
57
+ }
58
+
59
+ export declare function ActionsIframeProvider({ children }: {
60
+ children: React_2.ReactNode;
61
+ }): JSX.Element;
62
+
63
+ declare type AllowedExitPoints = {
64
+ welcome: 'application' | 'activation';
65
+ application: 'application' | 'activation';
66
+ };
67
+
68
+ /** @deprecated Use {@link CardsApp} instead */
69
+ export declare const App: typeof CardsApp;
70
+
71
+ /**
72
+ * Renders the CapitalOS Bill Payment Dashboard experience.
73
+ */
74
+ export declare function BillPayApp(props: BillPayAppProps): JSX.Element;
75
+
76
+ export declare type BillPayAppProps = CommonProps;
77
+
78
+ /**
79
+ * Builds the iframe url from token data, rendering context, and theme.
80
+ */
81
+ export declare function buildIframeUrl({ tokenData, renderingContext, theme, onError, }: {
82
+ tokenData: TokenData;
83
+ renderingContext: CapitalOsRenderingContext;
84
+ theme?: ThemeColorScheme | undefined;
85
+ onError?: ((error: Error) => void) | undefined;
86
+ }): string | undefined;
87
+
88
+ /**
89
+ * The internal component that handles all the heavy lifting of connecting to the iframe and rendering the app.
90
+ * all user facing components are basically a syntactic sugar on top of this.
91
+ */
92
+ export declare function CapitalOS<T extends CapitalOsRenderingContext>(props: CapitalOsProps<T>): JSX.Element;
93
+
94
+ declare type CapitalOsAuthenticationContextType = {
95
+ tokenData?: TokenData | undefined;
96
+ isLoading: boolean;
97
+ error?: Error | undefined;
98
+ /**
99
+ * Invalidates the current token..
100
+ * This is used when the iframe signals that the token has expired.
101
+ * The authentication flow will automatically refresh the token after invalidation.
102
+ */
103
+ invalidateToken: () => void;
104
+ /**
105
+ * Optional flag indicating whether to log events to the console.
106
+ */
107
+ enableLogging: boolean;
108
+ /**
109
+ * Optional logger for capturing all SDK logs including Penpal.
110
+ */
111
+ logger?: Logger | undefined;
112
+ };
113
+
114
+ declare const CapitalOsAuthenticationProvider: React_2.FC<ProviderProps>;
115
+ export { CapitalOsAuthenticationProvider }
116
+ export { CapitalOsAuthenticationProvider as CapitalOsAuthenticationProvider_alias_1 }
117
+
118
+ /**
119
+ * Base class for all SDK errors
120
+ */
121
+ export declare class CapitalOSError extends Error {
122
+ code: ErrorCode;
123
+ constructor({ message, code }: {
124
+ message: string;
125
+ code: ErrorCode;
126
+ });
127
+ }
128
+
129
+ declare type CapitalOsProps<T extends CapitalOsRenderingContext> = CommonProps & {
130
+ renderingContext: T;
131
+ methods?: Partial<ParentFunctions>;
132
+ sizeWidth?: boolean;
133
+ };
134
+
135
+ export declare type CapitalOsRenderingContext = {
136
+ entryPoint?: EntryPoint;
137
+ referer?: string;
138
+ };
139
+
140
+ export declare type Card = {
141
+ status: 'active' | 'inactive' | 'canceled' | 'frozen';
142
+ };
143
+
144
+ export declare type CardApiDto = z_2.infer<typeof cardApiDtoSchema>;
145
+
146
+ declare const cardApiDtoSchema: z_2.ZodObject<{
147
+ accountUserId: z_2.ZodNullable<z_2.ZodString>;
148
+ status: z_2.ZodEnum<["active", "inactive", "canceled", "frozen"]>;
149
+ id: z_2.ZodString;
150
+ last4: z_2.ZodString;
151
+ platformId: z_2.ZodString;
152
+ cardholderFirstName: z_2.ZodString;
153
+ cardholderLastName: z_2.ZodString;
154
+ cardholderPhoneNumber: z_2.ZodEffects<z_2.ZodString, string, string>;
155
+ nickname: z_2.ZodOptional<z_2.ZodNullable<z_2.ZodString>>;
156
+ spend: z_2.ZodObject<{
157
+ daily: z_2.ZodObject<{
158
+ limit: z_2.ZodOptional<z_2.ZodNumber>;
159
+ amount: z_2.ZodNumber;
160
+ }, "strip", z_2.ZodTypeAny, {
161
+ amount: number;
162
+ limit?: number | undefined;
163
+ }, {
164
+ amount: number;
165
+ limit?: number | undefined;
166
+ }>;
167
+ weekly: z_2.ZodObject<{
168
+ limit: z_2.ZodOptional<z_2.ZodNumber>;
169
+ amount: z_2.ZodNumber;
170
+ }, "strip", z_2.ZodTypeAny, {
171
+ amount: number;
172
+ limit?: number | undefined;
173
+ }, {
174
+ amount: number;
175
+ limit?: number | undefined;
176
+ }>;
177
+ monthly: z_2.ZodObject<{
178
+ limit: z_2.ZodOptional<z_2.ZodNumber>;
179
+ amount: z_2.ZodNumber;
180
+ }, "strip", z_2.ZodTypeAny, {
181
+ amount: number;
182
+ limit?: number | undefined;
183
+ }, {
184
+ amount: number;
185
+ limit?: number | undefined;
186
+ }>;
187
+ lifetime: z_2.ZodObject<{
188
+ limit: z_2.ZodOptional<z_2.ZodNumber>;
189
+ amount: z_2.ZodNumber;
190
+ }, "strip", z_2.ZodTypeAny, {
191
+ amount: number;
192
+ limit?: number | undefined;
193
+ }, {
194
+ amount: number;
195
+ limit?: number | undefined;
196
+ }>;
197
+ }, "strip", z_2.ZodTypeAny, {
198
+ daily: {
199
+ amount: number;
200
+ limit?: number | undefined;
201
+ };
202
+ weekly: {
203
+ amount: number;
204
+ limit?: number | undefined;
205
+ };
206
+ monthly: {
207
+ amount: number;
208
+ limit?: number | undefined;
209
+ };
210
+ lifetime: {
211
+ amount: number;
212
+ limit?: number | undefined;
213
+ };
214
+ }, {
215
+ daily: {
216
+ amount: number;
217
+ limit?: number | undefined;
218
+ };
219
+ weekly: {
220
+ amount: number;
221
+ limit?: number | undefined;
222
+ };
223
+ monthly: {
224
+ amount: number;
225
+ limit?: number | undefined;
226
+ };
227
+ lifetime: {
228
+ amount: number;
229
+ limit?: number | undefined;
230
+ };
231
+ }>;
232
+ allowedSpendCategories: z_2.ZodArray<z_2.ZodEnum<["advertisingAndMarketing", "airlines", "carRental", "carService", "education", "electronics", "gasPump", "gasStation", "generalMerchandise", "government", "hardwareAndConstruction", "insurance", "legal", "lodging", "medical", "other", "parking", "phoneAndInternet", "professionalServices", "recreationAndEntertainment", "restaurants", "shipping", "software", "taxisAndRideshare", "transportation", "travelMisc", "utilities"]>, "many">;
233
+ allowedMerchants: z_2.ZodArray<z_2.ZodObject<{
234
+ id: z_2.ZodUnion<[z_2.ZodString, z_2.ZodString]>;
235
+ name: z_2.ZodString;
236
+ logoUrl: z_2.ZodNullable<z_2.ZodString>;
237
+ }, "strip", z_2.ZodTypeAny, {
238
+ id: string;
239
+ name: string;
240
+ logoUrl: string | null;
241
+ }, {
242
+ id: string;
243
+ name: string;
244
+ logoUrl: string | null;
245
+ }>, "many">;
246
+ physicalCard: z_2.ZodNullable<z_2.ZodObject<z_2.objectUtil.extendShape<{
247
+ status: z_2.ZodEnum<["active", "disabled", "canceled"]>;
248
+ shipment: z_2.ZodObject<{
249
+ address: z_2.ZodObject<{
250
+ addressLine1: z_2.ZodString;
251
+ addressLine2: z_2.ZodOptional<z_2.ZodNullable<z_2.ZodEffects<z_2.ZodNullable<z_2.ZodString>, string | null, string | null>>>;
252
+ city: z_2.ZodString;
253
+ state: z_2.ZodEffects<z_2.ZodString, string, string>;
254
+ zipcode: z_2.ZodString;
255
+ }, "strip", z_2.ZodTypeAny, {
256
+ addressLine1: string;
257
+ city: string;
258
+ state: string;
259
+ zipcode: string;
260
+ addressLine2?: string | null | undefined;
261
+ }, {
262
+ addressLine1: string;
263
+ city: string;
264
+ state: string;
265
+ zipcode: string;
266
+ addressLine2?: string | null | undefined;
267
+ }>;
268
+ method: z_2.ZodEnum<["usps", "fedexPriorityOvernight", "fedexTwoDay"]>;
269
+ recipientName: z_2.ZodString;
270
+ returnReason: z_2.ZodNullable<z_2.ZodString>;
271
+ shippedAt: z_2.ZodNullable<z_2.ZodString>;
272
+ trackingUpdates: z_2.ZodArray<z_2.ZodObject<{
273
+ estimatedDeliveryAt: z_2.ZodNullable<z_2.ZodEffects<z_2.ZodUnion<[z_2.ZodString, z_2.ZodDate]>, string, string | Date>>;
274
+ trackingStatus: z_2.ZodEnum<["inTransit", "processedForDelivery", "delivered", "returnedToSender"]>;
275
+ city: z_2.ZodNullable<z_2.ZodString>;
276
+ createdAt: z_2.ZodEffects<z_2.ZodUnion<[z_2.ZodString, z_2.ZodDate]>, string, string | Date>;
277
+ zipcode: z_2.ZodNullable<z_2.ZodString>;
278
+ state: z_2.ZodNullable<z_2.ZodString>;
279
+ }, "strip", z_2.ZodTypeAny, {
280
+ city: string | null;
281
+ state: string | null;
282
+ zipcode: string | null;
283
+ estimatedDeliveryAt: string | null;
284
+ trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
285
+ createdAt: string;
286
+ }, {
287
+ city: string | null;
288
+ state: string | null;
289
+ zipcode: string | null;
290
+ estimatedDeliveryAt: string | Date | null;
291
+ trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
292
+ createdAt: string | Date;
293
+ }>, "many">;
294
+ status: z_2.ZodEnum<["canceled", "pending", "rejected", "returned", "shipped"]>;
295
+ trackingNumber: z_2.ZodNullable<z_2.ZodString>;
296
+ trackingUrl: z_2.ZodNullable<z_2.ZodString>;
297
+ }, "strip", z_2.ZodTypeAny, {
298
+ status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
299
+ method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
300
+ address: {
301
+ addressLine1: string;
302
+ city: string;
303
+ state: string;
304
+ zipcode: string;
305
+ addressLine2?: string | null | undefined;
306
+ };
307
+ recipientName: string;
308
+ returnReason: string | null;
309
+ shippedAt: string | null;
310
+ trackingUpdates: {
311
+ city: string | null;
312
+ state: string | null;
313
+ zipcode: string | null;
314
+ estimatedDeliveryAt: string | null;
315
+ trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
316
+ createdAt: string;
317
+ }[];
318
+ trackingNumber: string | null;
319
+ trackingUrl: string | null;
320
+ }, {
321
+ status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
322
+ method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
323
+ address: {
324
+ addressLine1: string;
325
+ city: string;
326
+ state: string;
327
+ zipcode: string;
328
+ addressLine2?: string | null | undefined;
329
+ };
330
+ recipientName: string;
331
+ returnReason: string | null;
332
+ shippedAt: string | null;
333
+ trackingUpdates: {
334
+ city: string | null;
335
+ state: string | null;
336
+ zipcode: string | null;
337
+ estimatedDeliveryAt: string | Date | null;
338
+ trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
339
+ createdAt: string | Date;
340
+ }[];
341
+ trackingNumber: string | null;
342
+ trackingUrl: string | null;
343
+ }>;
344
+ }, {
345
+ id: z_2.ZodOptional<z_2.ZodNullable<z_2.ZodString>>;
346
+ }>, "strip", z_2.ZodTypeAny, {
347
+ status: "active" | "canceled" | "disabled";
348
+ shipment: {
349
+ status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
350
+ method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
351
+ address: {
352
+ addressLine1: string;
353
+ city: string;
354
+ state: string;
355
+ zipcode: string;
356
+ addressLine2?: string | null | undefined;
357
+ };
358
+ recipientName: string;
359
+ returnReason: string | null;
360
+ shippedAt: string | null;
361
+ trackingUpdates: {
362
+ city: string | null;
363
+ state: string | null;
364
+ zipcode: string | null;
365
+ estimatedDeliveryAt: string | null;
366
+ trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
367
+ createdAt: string;
368
+ }[];
369
+ trackingNumber: string | null;
370
+ trackingUrl: string | null;
371
+ };
372
+ id?: string | null | undefined;
373
+ }, {
374
+ status: "active" | "canceled" | "disabled";
375
+ shipment: {
376
+ status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
377
+ method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
378
+ address: {
379
+ addressLine1: string;
380
+ city: string;
381
+ state: string;
382
+ zipcode: string;
383
+ addressLine2?: string | null | undefined;
384
+ };
385
+ recipientName: string;
386
+ returnReason: string | null;
387
+ shippedAt: string | null;
388
+ trackingUpdates: {
389
+ city: string | null;
390
+ state: string | null;
391
+ zipcode: string | null;
392
+ estimatedDeliveryAt: string | Date | null;
393
+ trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
394
+ createdAt: string | Date;
395
+ }[];
396
+ trackingNumber: string | null;
397
+ trackingUrl: string | null;
398
+ };
399
+ id?: string | null | undefined;
400
+ }>>;
401
+ cardSpendPolicyId: z_2.ZodOptional<z_2.ZodNullable<z_2.ZodString>>;
402
+ }, "strip", z_2.ZodTypeAny, {
403
+ status: "active" | "inactive" | "canceled" | "frozen";
404
+ id: string;
405
+ platformId: string;
406
+ accountUserId: string | null;
407
+ last4: string;
408
+ cardholderFirstName: string;
409
+ cardholderLastName: string;
410
+ cardholderPhoneNumber: string;
411
+ spend: {
412
+ daily: {
413
+ amount: number;
414
+ limit?: number | undefined;
415
+ };
416
+ weekly: {
417
+ amount: number;
418
+ limit?: number | undefined;
419
+ };
420
+ monthly: {
421
+ amount: number;
422
+ limit?: number | undefined;
423
+ };
424
+ lifetime: {
425
+ amount: number;
426
+ limit?: number | undefined;
427
+ };
428
+ };
429
+ allowedSpendCategories: ("other" | "advertisingAndMarketing" | "airlines" | "carRental" | "carService" | "education" | "electronics" | "gasPump" | "gasStation" | "generalMerchandise" | "government" | "hardwareAndConstruction" | "insurance" | "legal" | "lodging" | "medical" | "parking" | "phoneAndInternet" | "professionalServices" | "recreationAndEntertainment" | "restaurants" | "shipping" | "software" | "taxisAndRideshare" | "transportation" | "travelMisc" | "utilities")[];
430
+ allowedMerchants: {
431
+ id: string;
432
+ name: string;
433
+ logoUrl: string | null;
434
+ }[];
435
+ physicalCard: {
436
+ status: "active" | "canceled" | "disabled";
437
+ shipment: {
438
+ status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
439
+ method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
440
+ address: {
441
+ addressLine1: string;
442
+ city: string;
443
+ state: string;
444
+ zipcode: string;
445
+ addressLine2?: string | null | undefined;
446
+ };
447
+ recipientName: string;
448
+ returnReason: string | null;
449
+ shippedAt: string | null;
450
+ trackingUpdates: {
451
+ city: string | null;
452
+ state: string | null;
453
+ zipcode: string | null;
454
+ estimatedDeliveryAt: string | null;
455
+ trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
456
+ createdAt: string;
457
+ }[];
458
+ trackingNumber: string | null;
459
+ trackingUrl: string | null;
460
+ };
461
+ id?: string | null | undefined;
462
+ } | null;
463
+ nickname?: string | null | undefined;
464
+ cardSpendPolicyId?: string | null | undefined;
465
+ }, {
466
+ status: "active" | "inactive" | "canceled" | "frozen";
467
+ id: string;
468
+ platformId: string;
469
+ accountUserId: string | null;
470
+ last4: string;
471
+ cardholderFirstName: string;
472
+ cardholderLastName: string;
473
+ cardholderPhoneNumber: string;
474
+ spend: {
475
+ daily: {
476
+ amount: number;
477
+ limit?: number | undefined;
478
+ };
479
+ weekly: {
480
+ amount: number;
481
+ limit?: number | undefined;
482
+ };
483
+ monthly: {
484
+ amount: number;
485
+ limit?: number | undefined;
486
+ };
487
+ lifetime: {
488
+ amount: number;
489
+ limit?: number | undefined;
490
+ };
491
+ };
492
+ allowedSpendCategories: ("other" | "advertisingAndMarketing" | "airlines" | "carRental" | "carService" | "education" | "electronics" | "gasPump" | "gasStation" | "generalMerchandise" | "government" | "hardwareAndConstruction" | "insurance" | "legal" | "lodging" | "medical" | "parking" | "phoneAndInternet" | "professionalServices" | "recreationAndEntertainment" | "restaurants" | "shipping" | "software" | "taxisAndRideshare" | "transportation" | "travelMisc" | "utilities")[];
493
+ allowedMerchants: {
494
+ id: string;
495
+ name: string;
496
+ logoUrl: string | null;
497
+ }[];
498
+ physicalCard: {
499
+ status: "active" | "canceled" | "disabled";
500
+ shipment: {
501
+ status: "pending" | "canceled" | "rejected" | "returned" | "shipped";
502
+ method: "usps" | "fedexPriorityOvernight" | "fedexTwoDay";
503
+ address: {
504
+ addressLine1: string;
505
+ city: string;
506
+ state: string;
507
+ zipcode: string;
508
+ addressLine2?: string | null | undefined;
509
+ };
510
+ recipientName: string;
511
+ returnReason: string | null;
512
+ shippedAt: string | null;
513
+ trackingUpdates: {
514
+ city: string | null;
515
+ state: string | null;
516
+ zipcode: string | null;
517
+ estimatedDeliveryAt: string | Date | null;
518
+ trackingStatus: "inTransit" | "processedForDelivery" | "delivered" | "returnedToSender";
519
+ createdAt: string | Date;
520
+ }[];
521
+ trackingNumber: string | null;
522
+ trackingUrl: string | null;
523
+ };
524
+ id?: string | null | undefined;
525
+ } | null;
526
+ nickname?: string | null | undefined;
527
+ cardSpendPolicyId?: string | null | undefined;
528
+ }>;
529
+
530
+ /**
531
+ * Renders the CapitalOS Manage Card experience.
532
+ */
533
+ export declare function CardDetails(props: CardDetailsProps): JSX.Element;
534
+
535
+ declare type CardDetailsConditionalProps = {
536
+ /**
537
+ * Whether to render only the card component, without the surrounding UI.
538
+ * @default false
539
+ */
540
+ cardOnly?: false;
541
+ /** This prop can only be used when `cardOnly` is true. */
542
+ backOnly?: never;
543
+ } | {
544
+ /**
545
+ * Whether to render only the card component, without the surrounding UI.
546
+ * @default false
547
+ */
548
+ cardOnly: true;
549
+ /**
550
+ * Whether to render only the back of the card.
551
+ * This is only applicable when `cardOnly` is true.
552
+ * @default false
553
+ */
554
+ backOnly?: boolean;
555
+ };
556
+
557
+ export declare type CardDetailsProps = CommonProps & {
558
+ /**
559
+ * The ID of the card to manage.
560
+ */
561
+ cardId: string;
562
+ /**
563
+ * Whether to hide the address on the back of the card.
564
+ */
565
+ hideAddress?: boolean | undefined;
566
+ /**
567
+ * Callback to invoke when the card has been successfully canceled.
568
+ */
569
+ onCardCanceled?: () => void;
570
+ /**
571
+ * Callback to invoke when the user requests to hide sensitive details.
572
+ */
573
+ onHideSensitiveDetails?: () => void;
574
+ } & CardDetailsConditionalProps;
575
+
576
+ /**
577
+ * Renders the CapitalOS CardsApp.
578
+ */
579
+ export declare function CardsApp(props: CommonProps): JSX.Element;
580
+
581
+ export declare type ChildFunctions = {
582
+ freezeCard: (cardId: string) => Promise<ClientActionResult<Card>>;
583
+ unfreezeCard: (cardId: string) => Promise<ClientActionResult<Card>>;
584
+ };
585
+
586
+ export declare type ClientActionResult<T> = {
587
+ success: true;
588
+ canceled: false;
589
+ data: T;
590
+ } | {
591
+ success: false;
592
+ canceled: true;
593
+ } | {
594
+ success: false;
595
+ canceled: false;
596
+ error: string;
597
+ };
598
+
599
+ export declare type CommonProps = {
600
+ /**
601
+ * The token provided by initiate-login.
602
+ */
603
+ token?: string;
604
+ /**
605
+ * Optional CSS class name for the component.
606
+ */
607
+ className?: string;
608
+ /**
609
+ * Optional flag indicating whether to log events to the console.
610
+ */
611
+ enableLogging?: boolean;
612
+ /**
613
+ * Optional logger to capture SDK logs.
614
+ * When provided, logs will be sent to this logger instead of console.
615
+ */
616
+ logger?: Logger;
617
+ /**
618
+ * Optional callback for when the app encounters an error.
619
+ */
620
+ onError?: (error: Error) => void;
621
+ /**
622
+ * Optional component to render while the app is loading.
623
+ */
624
+ loadingComponent?: ReactNode;
625
+ /**
626
+ * Optional theme color scheme to apply to the app or component.
627
+ */
628
+ theme?: ThemeColorScheme;
629
+ };
630
+
631
+ /**
632
+ * Renders the CapitalOS Configure Autopay experience.
633
+ */
634
+ export declare function ConfigureAutoPay({ onClose, ...restOfProps }: ConfigureAutoPayProps): JSX.Element;
635
+
636
+ export declare type ConfigureAutoPayProps = CommonProps & {
637
+ /**
638
+ * Callback to invoke when the user closes the autopay configuration screen.
639
+ */
640
+ onClose: () => void;
641
+ };
642
+
643
+ /**
644
+ * Renders the CapitalOS Connect To Vendors experience.
645
+ */
646
+ export declare function ConnectToVendors({ cardId, onClose, inlineCardOnFile, ...restOfProps }: ConnectToVendorsProps): JSX.Element;
647
+
648
+ export declare type ConnectToVendorsProps = CommonProps & {
649
+ /**
650
+ * The ID of the card to connect to vendor services. If not provided, uses the default card.
651
+ */
652
+ cardId?: string;
653
+ /**
654
+ * Callback to invoke when the user closes the connect to vendors screen.
655
+ */
656
+ onClose: () => void;
657
+ /**
658
+ * Whether to render the card-on-file experience inline instead of opening it in a separate modal.
659
+ * When true, the card-on-file flow will replace the current content rather than stacking modals.
660
+ */
661
+ inlineCardOnFile?: boolean;
662
+ };
663
+
664
+ export declare function ContactSupport({ onDone, onCancel, ...restOfProps }: ContactSupportProps): JSX.Element;
665
+
666
+ export declare type ContactSupportProps = CommonProps & {
667
+ onDone: () => void;
668
+ onCancel: () => void;
669
+ };
670
+
671
+ export declare function decodeOneTimeToken(token: string): any;
672
+
673
+ /**
674
+ * Renders the CapitalOS Dev Tools experience.
675
+ * Allows for simulating transactions, etc.
676
+ */
677
+ declare function DevTools(props: DevToolsProps): JSX.Element;
678
+ export { DevTools }
679
+ export { DevTools as DevTools_alias_1 }
680
+
681
+ export declare function DevToolsButton({ onClick, isLoading }: DevToolsButtonProps): JSX.Element;
682
+
683
+ declare interface DevToolsButtonProps {
684
+ onClick?: () => void;
685
+ isLoading?: boolean;
686
+ }
687
+
688
+ export declare type DevToolsProps = CommonProps;
689
+
690
+ /**
691
+ * Renders the CapitalOS Dispute Transaction experience.
692
+ */
693
+ export declare function DisputeTransaction({ transactionId, onDone, onCancel, ...restOfProps }: DisputeTransactionProps): JSX.Element;
694
+
695
+ export declare type DisputeTransactionProps = CommonProps & {
696
+ /**
697
+ * The ID of the transaction to dispute.
698
+ */
699
+ transactionId: string;
700
+ /**
701
+ * Callback to invoke when the dispute was successfully submitted.
702
+ */
703
+ onDone: () => void;
704
+ /**
705
+ * Callback to invoke when the user cancels the dispute submission.
706
+ */
707
+ onCancel: () => void;
708
+ };
709
+
710
+ /**
711
+ * Encodes the rendering context as base64 and then URI encodes it.
712
+ */
713
+ export declare function encodeRenderingContext<T>(renderingContext: NonNullable<T>): string;
714
+
715
+ export declare type EntryPoint = RenderingContext_2['entryPoint'];
716
+
717
+ export declare const ErrorCode: {
718
+ readonly unauthorized: "unauthorized";
719
+ readonly invalid_account_status: "invalid_account_status";
720
+ readonly unsupported_entry_point: "unsupported_entry_point";
721
+ readonly internal_error: "internal_error";
722
+ };
723
+
724
+ export declare type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
725
+
726
+ export declare const IframeResizer: React_2.ForwardRefExoticComponent<Omit<IFrameOptions, "closedCallback" | "scrollCallback" | "resizedCallback" | "messageCallback" | "initCallback"> & {
727
+ onClosed?(iframeId: string): void;
728
+ onInit?(iframe: IFrameComponent): void;
729
+ onMessage?(data: IFrameMessageData): void;
730
+ onResized?(data: IFrameResizedData): void;
731
+ onScroll?(data: IFrameScrollData): boolean;
732
+ } & React_2.IframeHTMLAttributes<HTMLIFrameElement> & React_2.RefAttributes<HTMLIFrameElement>>;
733
+
734
+ /**
735
+ * Renders the CapitalOS Insights Dashboard experience
736
+ */
737
+ export declare function InsightsDashboard(props: InsightsDashboardProps): JSX.Element;
738
+
739
+ export declare type InsightsDashboardProps = CommonProps;
740
+
741
+ /**
742
+ * Renders a specific CapitalOS Insights Widget
743
+ */
744
+ export declare function InsightsWidget(props: InsightsWidgetProps): JSX.Element;
745
+
746
+ export declare type InsightsWidgetProps = CommonProps & {
747
+ /**
748
+ * The specific widget to render.
749
+ * naming convention:
750
+ * 1. Over-time Widgets
751
+ * over-time-{metric}-by-{dimension}-per-{time-granularity}
752
+ * 2. Top/Ranking Widgets
753
+ * top-{entities}-by-{metric}-{timeframe}
754
+ * 3. Comparison Widgets
755
+ * comparison-{metric}-{primary-timeframe}-vs-{secondary-timeframe}
756
+ */
757
+ widget: 'over-time-spend-by-card-per-month' | 'over-time-spend-by-category-per-month' | 'top-cards-by-spend-this-month' | 'top-categories-by-spend-this-month' | 'top-transactions-by-amount-this-month' | 'comparison-spend-this-month-vs-last-month';
758
+ /**
759
+ * Whether to hide the title of the widget.
760
+ */
761
+ hideTitle?: boolean | undefined;
762
+ /**
763
+ * The height of the widget.
764
+ */
765
+ height?: number | undefined;
766
+ /**
767
+ * The width of the widget.
768
+ */
769
+ width?: number | undefined;
770
+ };
771
+
772
+ export declare const internalLogger: {
773
+ log: (message: string, options?: LoggerOptions) => void;
774
+ warn: (message: string, options?: LoggerOptions) => void;
775
+ error: (message: string, options?: LoggerOptions) => void;
776
+ };
777
+
778
+ /**
779
+ * Represents an error that occurs when an invalid token is encountered.
780
+ */
781
+ export declare class InvalidTokenError extends CapitalOSError {
782
+ constructor(message?: string);
783
+ }
784
+
785
+ /**
786
+ * Renders the CapitalOS Issue Card experience.
787
+ */
788
+ export declare function IssueCard({ cardholder, onDone, onCancel, ...restOfProps }: IssueCardProps): JSX.Element;
789
+
790
+ export declare type IssueCardDefaultValues = z.infer<typeof issueCardDefaultValuesSchema>;
791
+
792
+ declare const issueCardDefaultValuesSchema: z.ZodUnion<[z.ZodObject<{
793
+ firstName: z.ZodString;
794
+ lastName: z.ZodString;
795
+ phone: z.ZodString;
796
+ }, "strip", z.ZodTypeAny, {
797
+ firstName: string;
798
+ lastName: string;
799
+ phone: string;
800
+ }, {
801
+ firstName: string;
802
+ lastName: string;
803
+ phone: string;
804
+ }>, z.ZodObject<{
805
+ userId: z.ZodString;
806
+ }, "strip", z.ZodTypeAny, {
807
+ userId: string;
808
+ }, {
809
+ userId: string;
810
+ }>]>;
811
+
812
+ export declare type IssueCardProps = CommonProps & {
813
+ /**
814
+ * Default values to prefill the form with.
815
+ *
816
+ * Either provide a userId, in which case the default values will be taken from that user's profile, or provide the cardholder's details directly.
817
+ */
818
+ cardholder?: IssueCardDefaultValues;
819
+ /**
820
+ * Callback to invoke when the card was created successfully.
821
+ *
822
+ * @param result - Object containing the created card's ID
823
+ * @param result.cardId - The ID of the newly created card
824
+ */
825
+ onDone: (result: {
826
+ cardId: string;
827
+ }) => void;
828
+ /**
829
+ * Callback to invoke when the card creation was cancelled by the user.
830
+ */
831
+ onCancel: () => void;
832
+ };
833
+
834
+ export declare function LegalDocuments({ onDone, ...restOfProps }: LegalDocumentsProps): JSX.Element;
835
+
836
+ export declare type LegalDocumentsProps = CommonProps & {
837
+ onDone: () => void;
838
+ };
839
+
840
+ /**
841
+ * Logger interface for capturing SDK logs.
842
+ * If provided, all SDK logs (including Penpal communication logs) will be sent to this logger.
843
+ */
844
+ declare type Logger = {
845
+ [LogLevel_2.log]: (message: string) => void;
846
+ [LogLevel_2.warn]: (message: string) => void;
847
+ [LogLevel_2.error]: (message: string) => void;
848
+ };
849
+ export { Logger }
850
+ export { Logger as Logger_alias_1 }
851
+
852
+ declare type LoggerOptions = {
853
+ enableLogging: boolean | undefined;
854
+ logger?: Logger | undefined;
855
+ };
856
+
857
+ declare type LogLevel = (typeof LogLevel_2)[keyof typeof LogLevel_2];
858
+ export { LogLevel }
859
+ export { LogLevel as LogLevel_alias_1 }
860
+
861
+ declare const LogLevel_2: {
862
+ readonly log: "log";
863
+ readonly warn: "warn";
864
+ readonly error: "error";
865
+ };
866
+
867
+ declare type LogLevel = (typeof LogLevel_2)[keyof typeof LogLevel_2];
868
+
869
+ /**
870
+ * Renders the CapitalOS Make a Payment experience.
871
+ */
872
+ export declare function MakePayment({ onDone, ...restOfProps }: MakePaymentProps): JSX.Element;
873
+
874
+ export declare type MakePaymentProps = CommonProps & {
875
+ /**
876
+ * Callback to invoke when the payment was made successfully.
877
+ */
878
+ onDone: () => void;
879
+ };
880
+
881
+ /**
882
+ * Renders the CapitalOS Manage Bank Connections experience.
883
+ */
884
+ export declare function ManageBankConnections({ onClose, ...restOfProps }: ManageBankConnectionsProps): JSX.Element;
885
+
886
+ export declare type ManageBankConnectionsProps = CommonProps & {
887
+ /**
888
+ * Callback to invoke when the user closes the bank connections management interface.
889
+ */
890
+ onClose: () => void;
891
+ };
892
+
893
+ export declare function Mfa({ onDone, onCancel, mfaId, destination, codeLength, canResendAfter, operationName, ...restOfProps }: MfaProps): JSX.Element;
894
+
895
+ export declare type MfaActionResult = ActionResult<void>;
896
+
897
+ export declare type MfaProps = CommonProps & {
898
+ /**
899
+ * The ID of the MFA request.
900
+ */
901
+ mfaId: string;
902
+ /**
903
+ * The destination of the MFA request.
904
+ */
905
+ destination: string;
906
+ /**
907
+ * The length of the code to be entered.
908
+ */
909
+ codeLength: number;
910
+ /**
911
+ * ISO string representation of DateTime in UTC
912
+ */
913
+ canResendAfter: string;
914
+ /**
915
+ * The name of the operation that is being performed.
916
+ */
917
+ operationName?: string;
918
+ /**
919
+ * Callback to invoke when the MFA was successfully completed.
920
+ */
921
+ onDone: () => void;
922
+ /**
923
+ * Callback to invoke when the MFA was cancelled by the user.
924
+ */
925
+ onCancel: () => void;
926
+ };
927
+
928
+ export declare interface MfaRequestContext {
929
+ mfaId: string;
930
+ destination: string;
931
+ codeLength: number;
932
+ canResendAfter: string;
933
+ operationName?: string;
934
+ }
935
+
936
+ export declare interface MfaResult {
937
+ success: boolean;
938
+ canceled?: boolean;
939
+ error?: string;
940
+ }
941
+
942
+ declare interface MfaState {
943
+ context: MfaRequestContext;
944
+ resolve: (result: MfaActionResult) => void;
945
+ reject: (error: Error) => void;
946
+ }
947
+
948
+ /**
949
+ * Generic modal component that displays content with backdrop/blur
950
+ */
951
+ export declare function Modal({ onClose, children, ariaLabel }: ModalProps): JSX.Element;
952
+
953
+ export declare interface ModalProps {
954
+ /**
955
+ * Callback when modal should be closed (backdrop click)
956
+ */
957
+ onClose: () => void;
958
+ /**
959
+ * Content to render inside the modal
960
+ */
961
+ children: ReactNode;
962
+ /**
963
+ * Accessible label for screen readers
964
+ */
965
+ ariaLabel?: string;
966
+ }
967
+
968
+ export declare function Onboarding<T extends OnboardingEntryPoint>({ onDone, entryPoint: onboardingEntryPoint, exitPoint: onboardingExitPoint, ...restOfProps }: OnboardingProps<T>): JSX.Element;
969
+
970
+ declare type OnboardingEntryPoint = keyof AllowedExitPoints;
971
+
972
+ declare type OnboardingProps<T extends keyof AllowedExitPoints> = CommonProps & {
973
+ entryPoint?: T;
974
+ exitPoint?: AllowedExitPoints[T];
975
+ onDone: (account: Account) => void;
976
+ };
977
+
978
+ export declare type ParentFunctions = {
979
+ onLoad: () => void;
980
+ onError: (error: RawErrorDetails) => void;
981
+ /**
982
+ * Called when the iframe detects that the JWT token has expired.
983
+ * This triggers the token refresh flow, which will obtain a new token
984
+ * and reload the iframe with the fresh token.
985
+ */
986
+ onTokenExpired?: () => void;
987
+ cardDetails?: {
988
+ onCardCanceled?: () => void;
989
+ onHideSensitiveDetails?: () => void;
990
+ };
991
+ contactSupport?: {
992
+ onDone?: () => void;
993
+ onCancel?: () => void;
994
+ };
995
+ createCard?: {
996
+ onDone?: (result: {
997
+ cardId: string;
998
+ }) => void;
999
+ onCancel?: () => void;
1000
+ };
1001
+ createDispute?: {
1002
+ onDone?: () => void;
1003
+ onCancel?: () => void;
1004
+ };
1005
+ devTools?: {
1006
+ onClose?: () => void;
1007
+ };
1008
+ legalDocuments?: {
1009
+ onDone?: () => void;
1010
+ };
1011
+ makePayment?: {
1012
+ onDone?: () => void;
1013
+ };
1014
+ manageBankConnections?: {
1015
+ onClose?: () => void;
1016
+ };
1017
+ configureAutoPay?: {
1018
+ onClose?: () => void;
1019
+ };
1020
+ policySettings?: {
1021
+ onClose?: () => void;
1022
+ };
1023
+ connectToVendors?: {
1024
+ onClose?: () => void;
1025
+ };
1026
+ mfa?: {
1027
+ onDone?: () => void;
1028
+ onCancel?: () => void;
1029
+ };
1030
+ onboarding?: {
1031
+ onDone?: (account: Account) => void;
1032
+ };
1033
+ replaceCard?: {
1034
+ onDone?: (result: {
1035
+ oldCardId: string;
1036
+ newCardId: string;
1037
+ }) => void;
1038
+ onClose?: () => void;
1039
+ };
1040
+ 'system-messages'?: {
1041
+ requestMfa?: (context: MfaRequestContext) => Promise<MfaResult>;
1042
+ };
1043
+ statements?: {
1044
+ onDone?: () => void;
1045
+ };
1046
+ terminateCard?: {
1047
+ onDone?: () => void;
1048
+ onClose?: () => void;
1049
+ };
1050
+ tokenExchange?: {
1051
+ onLongLivedToken?: (jwtToken: string) => void;
1052
+ };
1053
+ };
1054
+
1055
+ /**
1056
+ * Renders the CapitalOS Policy Settings experience.
1057
+ */
1058
+ export declare function PolicySettings({ onClose, ...restOfProps }: PolicySettingsProps): JSX.Element;
1059
+
1060
+ export declare type PolicySettingsProps = CommonProps & {
1061
+ /**
1062
+ * Callback to invoke when the user closes the policy settings screen.
1063
+ */
1064
+ onClose: () => void;
1065
+ };
1066
+
1067
+ declare type ProviderProps = {
1068
+ getToken: () => Promise<string>;
1069
+ enableLogging?: boolean | undefined;
1070
+ logger?: Logger | undefined;
1071
+ children: React_2.ReactNode;
1072
+ };
1073
+
1074
+ /**
1075
+ * An error type providing a reason code and message.
1076
+ * Penpal only passes plain objects, so this does not inherit from Error.
1077
+ */
1078
+ export declare type RawErrorDetails = {
1079
+ code: ErrorCode;
1080
+ message: string;
1081
+ };
1082
+
1083
+ /**
1084
+ * Redacts token values from a string, keeping first 4 and last 4 characters for debugging
1085
+ * Safe to use - will not throw even with malformed input
1086
+ */
1087
+ export declare function redactToken(str: string): string;
1088
+
1089
+ declare type RenderingContext_2 = z.infer<typeof renderingContextSchema>;
1090
+
1091
+ declare const renderingContextSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<"entryPoint", [z.ZodObject<{
1092
+ entryPoint: z.ZodLiteral<"createCard">;
1093
+ cardholder: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
1094
+ firstName: z.ZodString;
1095
+ lastName: z.ZodString;
1096
+ phone: z.ZodString;
1097
+ }, "strip", z.ZodTypeAny, {
1098
+ firstName: string;
1099
+ lastName: string;
1100
+ phone: string;
1101
+ }, {
1102
+ firstName: string;
1103
+ lastName: string;
1104
+ phone: string;
1105
+ }>, z.ZodObject<{
1106
+ userId: z.ZodString;
1107
+ }, "strip", z.ZodTypeAny, {
1108
+ userId: string;
1109
+ }, {
1110
+ userId: string;
1111
+ }>]>>>;
1112
+ }, "strip", z.ZodTypeAny, {
1113
+ entryPoint: "createCard";
1114
+ cardholder?: {
1115
+ firstName: string;
1116
+ lastName: string;
1117
+ phone: string;
1118
+ } | {
1119
+ userId: string;
1120
+ } | null | undefined;
1121
+ }, {
1122
+ entryPoint: "createCard";
1123
+ cardholder?: {
1124
+ firstName: string;
1125
+ lastName: string;
1126
+ phone: string;
1127
+ } | {
1128
+ userId: string;
1129
+ } | null | undefined;
1130
+ }>, z.ZodObject<{
1131
+ entryPoint: z.ZodLiteral<"createDispute">;
1132
+ transactionId: z.ZodString;
1133
+ }, "strip", z.ZodTypeAny, {
1134
+ entryPoint: "createDispute";
1135
+ transactionId: string;
1136
+ }, {
1137
+ entryPoint: "createDispute";
1138
+ transactionId: string;
1139
+ }>, z.ZodObject<{
1140
+ entryPoint: z.ZodLiteral<"billPayApp">;
1141
+ }, "strip", z.ZodTypeAny, {
1142
+ entryPoint: "billPayApp";
1143
+ }, {
1144
+ entryPoint: "billPayApp";
1145
+ }>, z.ZodObject<{
1146
+ entryPoint: z.ZodLiteral<"cardDetails">;
1147
+ cardId: z.ZodString;
1148
+ cardOnly: z.ZodOptional<z.ZodBoolean>;
1149
+ hideAddress: z.ZodOptional<z.ZodBoolean>;
1150
+ backOnly: z.ZodOptional<z.ZodBoolean>;
1151
+ }, "strip", z.ZodTypeAny, {
1152
+ cardId: string;
1153
+ entryPoint: "cardDetails";
1154
+ cardOnly?: boolean | undefined;
1155
+ hideAddress?: boolean | undefined;
1156
+ backOnly?: boolean | undefined;
1157
+ }, {
1158
+ cardId: string;
1159
+ entryPoint: "cardDetails";
1160
+ cardOnly?: boolean | undefined;
1161
+ hideAddress?: boolean | undefined;
1162
+ backOnly?: boolean | undefined;
1163
+ }>, z.ZodObject<{
1164
+ entryPoint: z.ZodLiteral<"accountDetails">;
1165
+ }, "strip", z.ZodTypeAny, {
1166
+ entryPoint: "accountDetails";
1167
+ }, {
1168
+ entryPoint: "accountDetails";
1169
+ }>, z.ZodObject<{
1170
+ entryPoint: z.ZodLiteral<"accountActions">;
1171
+ }, "strip", z.ZodTypeAny, {
1172
+ entryPoint: "accountActions";
1173
+ }, {
1174
+ entryPoint: "accountActions";
1175
+ }>, z.ZodObject<{
1176
+ entryPoint: z.ZodLiteral<"manageBankConnections">;
1177
+ }, "strip", z.ZodTypeAny, {
1178
+ entryPoint: "manageBankConnections";
1179
+ }, {
1180
+ entryPoint: "manageBankConnections";
1181
+ }>, z.ZodObject<{
1182
+ entryPoint: z.ZodLiteral<"configureAutoPay">;
1183
+ }, "strip", z.ZodTypeAny, {
1184
+ entryPoint: "configureAutoPay";
1185
+ }, {
1186
+ entryPoint: "configureAutoPay";
1187
+ }>, z.ZodObject<{
1188
+ entryPoint: z.ZodLiteral<"policySettings">;
1189
+ }, "strip", z.ZodTypeAny, {
1190
+ entryPoint: "policySettings";
1191
+ }, {
1192
+ entryPoint: "policySettings";
1193
+ }>, z.ZodObject<{
1194
+ entryPoint: z.ZodLiteral<"connectToVendors">;
1195
+ cardId: z.ZodOptional<z.ZodString>;
1196
+ inlineCardOnFile: z.ZodOptional<z.ZodBoolean>;
1197
+ }, "strip", z.ZodTypeAny, {
1198
+ entryPoint: "connectToVendors";
1199
+ cardId?: string | undefined;
1200
+ inlineCardOnFile?: boolean | undefined;
1201
+ }, {
1202
+ entryPoint: "connectToVendors";
1203
+ cardId?: string | undefined;
1204
+ inlineCardOnFile?: boolean | undefined;
1205
+ }>, z.ZodObject<{
1206
+ entryPoint: z.ZodLiteral<"insightsDashboard">;
1207
+ }, "strip", z.ZodTypeAny, {
1208
+ entryPoint: "insightsDashboard";
1209
+ }, {
1210
+ entryPoint: "insightsDashboard";
1211
+ }>, z.ZodObject<{
1212
+ entryPoint: z.ZodLiteral<"insightsWidget">;
1213
+ widget: z.ZodEnum<["over-time-spend-by-card-per-month", "over-time-spend-by-category-per-month", "top-cards-by-spend-this-month", "top-categories-by-spend-this-month", "top-transactions-by-amount-this-month", "comparison-spend-this-month-vs-last-month"]>;
1214
+ hideTitle: z.ZodOptional<z.ZodBoolean>;
1215
+ height: z.ZodOptional<z.ZodNumber>;
1216
+ width: z.ZodOptional<z.ZodNumber>;
1217
+ }, "strip", z.ZodTypeAny, {
1218
+ entryPoint: "insightsWidget";
1219
+ widget: "over-time-spend-by-card-per-month" | "over-time-spend-by-category-per-month" | "top-cards-by-spend-this-month" | "top-categories-by-spend-this-month" | "top-transactions-by-amount-this-month" | "comparison-spend-this-month-vs-last-month";
1220
+ hideTitle?: boolean | undefined;
1221
+ height?: number | undefined;
1222
+ width?: number | undefined;
1223
+ }, {
1224
+ entryPoint: "insightsWidget";
1225
+ widget: "over-time-spend-by-card-per-month" | "over-time-spend-by-category-per-month" | "top-cards-by-spend-this-month" | "top-categories-by-spend-this-month" | "top-transactions-by-amount-this-month" | "comparison-spend-this-month-vs-last-month";
1226
+ hideTitle?: boolean | undefined;
1227
+ height?: number | undefined;
1228
+ width?: number | undefined;
1229
+ }>, z.ZodObject<{
1230
+ entryPoint: z.ZodLiteral<"onboarding">;
1231
+ onboardingEntryPoint: z.ZodDefault<z.ZodEnum<["welcome", "application"]>>;
1232
+ onboardingExitPoint: z.ZodDefault<z.ZodEnum<["application", "activation"]>>;
1233
+ }, "strip", z.ZodTypeAny, {
1234
+ entryPoint: "onboarding";
1235
+ onboardingEntryPoint: "welcome" | "application";
1236
+ onboardingExitPoint: "application" | "activation";
1237
+ }, {
1238
+ entryPoint: "onboarding";
1239
+ onboardingEntryPoint?: "welcome" | "application" | undefined;
1240
+ onboardingExitPoint?: "application" | "activation" | undefined;
1241
+ }>, z.ZodObject<{
1242
+ entryPoint: z.ZodLiteral<"cardsApp">;
1243
+ }, "strip", z.ZodTypeAny, {
1244
+ entryPoint: "cardsApp";
1245
+ }, {
1246
+ entryPoint: "cardsApp";
1247
+ }>, z.ZodObject<{
1248
+ entryPoint: z.ZodLiteral<"tokenExchange">;
1249
+ }, "strip", z.ZodTypeAny, {
1250
+ entryPoint: "tokenExchange";
1251
+ }, {
1252
+ entryPoint: "tokenExchange";
1253
+ }>, z.ZodObject<{
1254
+ entryPoint: z.ZodLiteral<"makePayment">;
1255
+ }, "strip", z.ZodTypeAny, {
1256
+ entryPoint: "makePayment";
1257
+ }, {
1258
+ entryPoint: "makePayment";
1259
+ }>, z.ZodObject<{
1260
+ entryPoint: z.ZodLiteral<"devTools">;
1261
+ }, "strip", z.ZodTypeAny, {
1262
+ entryPoint: "devTools";
1263
+ }, {
1264
+ entryPoint: "devTools";
1265
+ }>, z.ZodObject<{
1266
+ entryPoint: z.ZodLiteral<"contactSupport">;
1267
+ }, "strip", z.ZodTypeAny, {
1268
+ entryPoint: "contactSupport";
1269
+ }, {
1270
+ entryPoint: "contactSupport";
1271
+ }>, z.ZodObject<{
1272
+ entryPoint: z.ZodLiteral<"statements">;
1273
+ }, "strip", z.ZodTypeAny, {
1274
+ entryPoint: "statements";
1275
+ }, {
1276
+ entryPoint: "statements";
1277
+ }>, z.ZodObject<{
1278
+ entryPoint: z.ZodLiteral<"legalDocuments">;
1279
+ }, "strip", z.ZodTypeAny, {
1280
+ entryPoint: "legalDocuments";
1281
+ }, {
1282
+ entryPoint: "legalDocuments";
1283
+ }>, z.ZodObject<{
1284
+ entryPoint: z.ZodLiteral<"replaceCard">;
1285
+ cardId: z.ZodString;
1286
+ }, "strip", z.ZodTypeAny, {
1287
+ cardId: string;
1288
+ entryPoint: "replaceCard";
1289
+ }, {
1290
+ cardId: string;
1291
+ entryPoint: "replaceCard";
1292
+ }>, z.ZodObject<{
1293
+ entryPoint: z.ZodLiteral<"terminateCard">;
1294
+ cardId: z.ZodString;
1295
+ }, "strip", z.ZodTypeAny, {
1296
+ cardId: string;
1297
+ entryPoint: "terminateCard";
1298
+ }, {
1299
+ cardId: string;
1300
+ entryPoint: "terminateCard";
1301
+ }>, z.ZodObject<{
1302
+ entryPoint: z.ZodLiteral<"actions">;
1303
+ }, "strip", z.ZodTypeAny, {
1304
+ entryPoint: "actions";
1305
+ }, {
1306
+ entryPoint: "actions";
1307
+ }>, z.ZodObject<{
1308
+ entryPoint: z.ZodLiteral<"mfa">;
1309
+ mfaId: z.ZodString;
1310
+ destination: z.ZodString;
1311
+ codeLength: z.ZodNumber;
1312
+ canResendAfter: z.ZodString;
1313
+ operationName: z.ZodOptional<z.ZodString>;
1314
+ }, "strip", z.ZodTypeAny, {
1315
+ entryPoint: "mfa";
1316
+ mfaId: string;
1317
+ destination: string;
1318
+ codeLength: number;
1319
+ canResendAfter: string;
1320
+ operationName?: string | undefined;
1321
+ }, {
1322
+ entryPoint: "mfa";
1323
+ mfaId: string;
1324
+ destination: string;
1325
+ codeLength: number;
1326
+ canResendAfter: string;
1327
+ operationName?: string | undefined;
1328
+ }>, z.ZodObject<{
1329
+ entryPoint: z.ZodLiteral<"transactions">;
1330
+ }, "strip", z.ZodTypeAny, {
1331
+ entryPoint: "transactions";
1332
+ }, {
1333
+ entryPoint: "transactions";
1334
+ }>]>, z.ZodObject<{
1335
+ referer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1336
+ }, "strip", z.ZodTypeAny, {
1337
+ referer?: string | null | undefined;
1338
+ }, {
1339
+ referer?: string | null | undefined;
1340
+ }>>;
1341
+
1342
+ export declare function ReplaceCard({ cardId, onDone, onClose, ...restOfProps }: ReplaceCardProps): JSX.Element;
1343
+
1344
+ export declare type ReplaceCardProps = CommonProps & {
1345
+ cardId: string;
1346
+ onDone: (result: {
1347
+ oldCardId: string;
1348
+ newCardId: string;
1349
+ }) => void;
1350
+ onClose: () => void;
1351
+ };
1352
+
1353
+ /**
1354
+ * Safely decodes a URL component, handling potential errors
1355
+ */
1356
+ export declare function safeDecodeURIComponent(str: string): string;
1357
+
1358
+ export declare function Statements({ onDone, ...restOfProps }: StatementsProps): JSX.Element;
1359
+
1360
+ export declare type StatementsProps = CommonProps & {
1361
+ onDone: () => void;
1362
+ };
1363
+
1364
+ export declare function TerminateCard({ cardId, onDone, onClose, ...restOfProps }: TerminateCardProps): JSX.Element;
1365
+
1366
+ export declare type TerminateCardProps = CommonProps & {
1367
+ cardId: string;
1368
+ onDone: () => void;
1369
+ onClose: () => void;
1370
+ };
1371
+
1372
+ export declare type ThemeColorScheme = 'light' | 'dark' | 'system';
1373
+
1374
+ export declare type TokenData = {
1375
+ token: string;
1376
+ tokenType: TokenType;
1377
+ baseUrl: string;
1378
+ paramKey: TokenParamKey;
1379
+ paramLocation: TokenParamLocation;
1380
+ };
1381
+
1382
+ export declare function tokenDataFromOneTimeToken(oneTimeToken: string): TokenData;
1383
+
1384
+ /**
1385
+ * The component is hidden from the user and is only used to exchange a one-time token for a JWT in the authentication context.
1386
+ *
1387
+ * The token exchange process works as follows:
1388
+ * 1. Component renders a hidden iframe with the one-time token in the URL
1389
+ * 2. The iframe loads with the long-lived token as part of its url redirect response and establishes a secure connection with the parent window
1390
+ * 3. The iframe passes the long-lived token to the parent via postMessage
1391
+ * 4. onExchangeComplete callback is triggered with the new JWT
1392
+ *
1393
+ * If any errors occur during this process, they are passed to onExchangeError.
1394
+ */
1395
+ export declare function TokenExchangeIframe(props: TokenExchangeIframeProps): JSX.Element;
1396
+
1397
+ export declare interface TokenExchangeIframeProps {
1398
+ oneTimeToken: string;
1399
+ enableLogging?: boolean | undefined;
1400
+ onExchangeComplete: (jwtToken: string) => void;
1401
+ onExchangeError?: (error: Error) => void;
1402
+ }
1403
+
1404
+ export declare enum TokenParamKey {
1405
+ token = "token",
1406
+ accessToken = "access_token"
1407
+ }
1408
+
1409
+ export declare enum TokenParamLocation {
1410
+ search = "search",
1411
+ hash = "hash"
1412
+ }
1413
+
1414
+ export declare class TokenRefreshError extends CapitalOSError {
1415
+ constructor(originalError?: Error);
1416
+ }
1417
+
1418
+ export declare enum TokenType {
1419
+ oneTime = "oneTime",
1420
+ longLived = "longLived"
1421
+ }
1422
+
1423
+ /**
1424
+ * Renders the CapitalOS Transactions experience.
1425
+ */
1426
+ export declare function Transactions(props: TransactionsProps): JSX.Element;
1427
+
1428
+ export declare type TransactionsProps = CommonProps;
1429
+
1430
+ /**
1431
+ * Hook to access the actions iframe functions.
1432
+ *
1433
+ * @returns An object containing the actions functions and loading state
1434
+ * @throws {CapitalOSError} If the hook is used outside of a CapitalOS component
1435
+ *
1436
+ * @example
1437
+ * ```tsx
1438
+ * const { actions, isLoading } = useActions()
1439
+ *
1440
+ * if (isLoading) {
1441
+ * return <LoadingSpinner />
1442
+ * }
1443
+ *
1444
+ * // Use the actions
1445
+ * await actions.freezeCard()
1446
+ * ```
1447
+ */
1448
+ export declare function useActions(): {
1449
+ actions: ChildFunctions | null;
1450
+ isLoading: boolean;
1451
+ };
1452
+
1453
+ export declare const useCapitalOsAuthContext: () => CapitalOsAuthenticationContextType;
1454
+
1455
+ /**
1456
+ * Hook to resolve logging preference, with direct prop taking precedence over context.
1457
+ * @param enableLoggingProp Direct prop for enableLogging.
1458
+ * @returns Effective logging flag.
1459
+ */
1460
+ export declare function useEnableLogging(enableLoggingProp?: boolean): boolean;
1461
+
1462
+ /**
1463
+ * A React hook that manages the iframe connection lifecycle, including:
1464
+ * - Establishing and maintaining the iframe connection
1465
+ * - Handling token expiration and refresh flows
1466
+ * - Managing loading states
1467
+ * - Coordinating between one-time tokens and context-based authentication
1468
+ * - Providing error handling and logging capabilities
1469
+ */
1470
+ export declare function useIframe(props: {
1471
+ renderingContext: CapitalOsRenderingContext;
1472
+ oneTimeToken?: string | undefined;
1473
+ enableLogging?: boolean | undefined;
1474
+ onError?: ((error: Error) => void) | undefined;
1475
+ theme?: ThemeColorScheme | undefined;
1476
+ methods?: Partial<Omit<ParentFunctions, 'onLoad' | 'onError' | 'onTokenExpired'>> | undefined;
1477
+ }): {
1478
+ isLoaded: boolean;
1479
+ url: string | undefined;
1480
+ tokenData: TokenData | undefined;
1481
+ iframeRef: RefObject<HTMLIFrameElement>;
1482
+ connection: Connection<ChildFunctions> | null;
1483
+ };
1484
+
1485
+ /**
1486
+ * connects to child iframe and returns whether the iframe is loaded or not.
1487
+ * token was added to the list of dependencies to make sure that the connection is re-established when the token changes.
1488
+ */
1489
+ export declare function useIframeConnection({ iframeRef, token, onError, methods, iframeLabel, }: {
1490
+ iframeRef: React.RefObject<HTMLIFrameElement>;
1491
+ token: string | undefined;
1492
+ onError: ((error: Error) => void) | undefined | null;
1493
+ methods: ParentFunctions;
1494
+ iframeLabel?: string | undefined;
1495
+ }): Connection<ChildFunctions> | null;
1496
+
1497
+ /**
1498
+ * returns a memoized url of the iframe or undefined if the token is not available yet.
1499
+ */
1500
+ export declare function useIframeUrl({ tokenData, renderingContext, theme, onError, }: {
1501
+ tokenData: TokenData | undefined;
1502
+ renderingContext: CapitalOsRenderingContext;
1503
+ theme?: ThemeColorScheme | undefined;
1504
+ onError?: ((error: Error) => void) | undefined;
1505
+ }): string | undefined;
1506
+
1507
+ /**
1508
+ * Hook that provides stable logging functions (log, warn, error), scoped to the resolved enableLogging flag.
1509
+ * @param enableLoggingProp Optional direct prop to override logging.
1510
+ */
1511
+ export declare function useLogger(enableLoggingProp?: boolean): {
1512
+ log: (message: string) => void;
1513
+ warn: (message: string) => void;
1514
+ error: (message: string) => void;
1515
+ };
1516
+
1517
+ export declare function useMfaState(): {
1518
+ activeMfaRequest: MfaState | null;
1519
+ isMfaActive: boolean;
1520
+ mfaContext: MfaRequestContext | null;
1521
+ requestMfa: (context: MfaRequestContext) => Promise<MfaActionResult>;
1522
+ handleMfaDone: () => void;
1523
+ handleMfaCancel: () => void;
1524
+ handleMfaError: (error: CapitalOSError) => void;
1525
+ };
1526
+
1527
+ export { }