@capitalos/react 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.mts +79 -1
- package/dist/_tsup-dts-rollup.d.ts +79 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -265,6 +265,28 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
265
265
|
recipientName: z_2.ZodString;
|
|
266
266
|
returnReason: z_2.ZodNullable<z_2.ZodString>;
|
|
267
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">;
|
|
268
290
|
status: z_2.ZodEnum<["canceled", "pending", "rejected", "returned", "shipped"]>;
|
|
269
291
|
trackingNumber: z_2.ZodNullable<z_2.ZodString>;
|
|
270
292
|
trackingUrl: z_2.ZodNullable<z_2.ZodString>;
|
|
@@ -281,6 +303,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
281
303
|
recipientName: string;
|
|
282
304
|
returnReason: string | null;
|
|
283
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
|
+
}[];
|
|
284
314
|
trackingNumber: string | null;
|
|
285
315
|
trackingUrl: string | null;
|
|
286
316
|
}, {
|
|
@@ -296,6 +326,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
296
326
|
recipientName: string;
|
|
297
327
|
returnReason: string | null;
|
|
298
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
|
+
}[];
|
|
299
337
|
trackingNumber: string | null;
|
|
300
338
|
trackingUrl: string | null;
|
|
301
339
|
}>;
|
|
@@ -316,6 +354,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
316
354
|
recipientName: string;
|
|
317
355
|
returnReason: string | null;
|
|
318
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
|
+
}[];
|
|
319
365
|
trackingNumber: string | null;
|
|
320
366
|
trackingUrl: string | null;
|
|
321
367
|
};
|
|
@@ -335,6 +381,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
335
381
|
recipientName: string;
|
|
336
382
|
returnReason: string | null;
|
|
337
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
|
+
}[];
|
|
338
392
|
trackingNumber: string | null;
|
|
339
393
|
trackingUrl: string | null;
|
|
340
394
|
};
|
|
@@ -389,6 +443,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
389
443
|
recipientName: string;
|
|
390
444
|
returnReason: string | null;
|
|
391
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
|
+
}[];
|
|
392
454
|
trackingNumber: string | null;
|
|
393
455
|
trackingUrl: string | null;
|
|
394
456
|
};
|
|
@@ -444,6 +506,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
444
506
|
recipientName: string;
|
|
445
507
|
returnReason: string | null;
|
|
446
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
|
+
}[];
|
|
447
517
|
trackingNumber: string | null;
|
|
448
518
|
trackingUrl: string | null;
|
|
449
519
|
};
|
|
@@ -564,7 +634,7 @@ export declare type ConfigureAutoPayProps = CommonProps & {
|
|
|
564
634
|
/**
|
|
565
635
|
* Renders the CapitalOS Connect To Vendors experience.
|
|
566
636
|
*/
|
|
567
|
-
export declare function ConnectToVendors({ cardId, onClose, ...restOfProps }: ConnectToVendorsProps): JSX.Element;
|
|
637
|
+
export declare function ConnectToVendors({ cardId, onClose, inlineCardOnFile, ...restOfProps }: ConnectToVendorsProps): JSX.Element;
|
|
568
638
|
|
|
569
639
|
export declare type ConnectToVendorsProps = CommonProps & {
|
|
570
640
|
/**
|
|
@@ -575,6 +645,11 @@ export declare type ConnectToVendorsProps = CommonProps & {
|
|
|
575
645
|
* Callback to invoke when the user closes the connect to vendors screen.
|
|
576
646
|
*/
|
|
577
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;
|
|
578
653
|
};
|
|
579
654
|
|
|
580
655
|
export declare function ContactSupport({ onDone, onCancel, ...restOfProps }: ContactSupportProps): JSX.Element;
|
|
@@ -1070,12 +1145,15 @@ declare const renderingContextSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<
|
|
|
1070
1145
|
}>, z.ZodObject<{
|
|
1071
1146
|
entryPoint: z.ZodLiteral<"connectToVendors">;
|
|
1072
1147
|
cardId: z.ZodOptional<z.ZodString>;
|
|
1148
|
+
inlineCardOnFile: z.ZodOptional<z.ZodBoolean>;
|
|
1073
1149
|
}, "strip", z.ZodTypeAny, {
|
|
1074
1150
|
entryPoint: "connectToVendors";
|
|
1075
1151
|
cardId?: string | undefined;
|
|
1152
|
+
inlineCardOnFile?: boolean | undefined;
|
|
1076
1153
|
}, {
|
|
1077
1154
|
entryPoint: "connectToVendors";
|
|
1078
1155
|
cardId?: string | undefined;
|
|
1156
|
+
inlineCardOnFile?: boolean | undefined;
|
|
1079
1157
|
}>, z.ZodObject<{
|
|
1080
1158
|
entryPoint: z.ZodLiteral<"insightsDashboard">;
|
|
1081
1159
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -265,6 +265,28 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
265
265
|
recipientName: z_2.ZodString;
|
|
266
266
|
returnReason: z_2.ZodNullable<z_2.ZodString>;
|
|
267
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">;
|
|
268
290
|
status: z_2.ZodEnum<["canceled", "pending", "rejected", "returned", "shipped"]>;
|
|
269
291
|
trackingNumber: z_2.ZodNullable<z_2.ZodString>;
|
|
270
292
|
trackingUrl: z_2.ZodNullable<z_2.ZodString>;
|
|
@@ -281,6 +303,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
281
303
|
recipientName: string;
|
|
282
304
|
returnReason: string | null;
|
|
283
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
|
+
}[];
|
|
284
314
|
trackingNumber: string | null;
|
|
285
315
|
trackingUrl: string | null;
|
|
286
316
|
}, {
|
|
@@ -296,6 +326,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
296
326
|
recipientName: string;
|
|
297
327
|
returnReason: string | null;
|
|
298
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
|
+
}[];
|
|
299
337
|
trackingNumber: string | null;
|
|
300
338
|
trackingUrl: string | null;
|
|
301
339
|
}>;
|
|
@@ -316,6 +354,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
316
354
|
recipientName: string;
|
|
317
355
|
returnReason: string | null;
|
|
318
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
|
+
}[];
|
|
319
365
|
trackingNumber: string | null;
|
|
320
366
|
trackingUrl: string | null;
|
|
321
367
|
};
|
|
@@ -335,6 +381,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
335
381
|
recipientName: string;
|
|
336
382
|
returnReason: string | null;
|
|
337
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
|
+
}[];
|
|
338
392
|
trackingNumber: string | null;
|
|
339
393
|
trackingUrl: string | null;
|
|
340
394
|
};
|
|
@@ -389,6 +443,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
389
443
|
recipientName: string;
|
|
390
444
|
returnReason: string | null;
|
|
391
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
|
+
}[];
|
|
392
454
|
trackingNumber: string | null;
|
|
393
455
|
trackingUrl: string | null;
|
|
394
456
|
};
|
|
@@ -444,6 +506,14 @@ declare const cardApiDtoSchema: z_2.ZodObject<{
|
|
|
444
506
|
recipientName: string;
|
|
445
507
|
returnReason: string | null;
|
|
446
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
|
+
}[];
|
|
447
517
|
trackingNumber: string | null;
|
|
448
518
|
trackingUrl: string | null;
|
|
449
519
|
};
|
|
@@ -564,7 +634,7 @@ export declare type ConfigureAutoPayProps = CommonProps & {
|
|
|
564
634
|
/**
|
|
565
635
|
* Renders the CapitalOS Connect To Vendors experience.
|
|
566
636
|
*/
|
|
567
|
-
export declare function ConnectToVendors({ cardId, onClose, ...restOfProps }: ConnectToVendorsProps): JSX.Element;
|
|
637
|
+
export declare function ConnectToVendors({ cardId, onClose, inlineCardOnFile, ...restOfProps }: ConnectToVendorsProps): JSX.Element;
|
|
568
638
|
|
|
569
639
|
export declare type ConnectToVendorsProps = CommonProps & {
|
|
570
640
|
/**
|
|
@@ -575,6 +645,11 @@ export declare type ConnectToVendorsProps = CommonProps & {
|
|
|
575
645
|
* Callback to invoke when the user closes the connect to vendors screen.
|
|
576
646
|
*/
|
|
577
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;
|
|
578
653
|
};
|
|
579
654
|
|
|
580
655
|
export declare function ContactSupport({ onDone, onCancel, ...restOfProps }: ContactSupportProps): JSX.Element;
|
|
@@ -1070,12 +1145,15 @@ declare const renderingContextSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<
|
|
|
1070
1145
|
}>, z.ZodObject<{
|
|
1071
1146
|
entryPoint: z.ZodLiteral<"connectToVendors">;
|
|
1072
1147
|
cardId: z.ZodOptional<z.ZodString>;
|
|
1148
|
+
inlineCardOnFile: z.ZodOptional<z.ZodBoolean>;
|
|
1073
1149
|
}, "strip", z.ZodTypeAny, {
|
|
1074
1150
|
entryPoint: "connectToVendors";
|
|
1075
1151
|
cardId?: string | undefined;
|
|
1152
|
+
inlineCardOnFile?: boolean | undefined;
|
|
1076
1153
|
}, {
|
|
1077
1154
|
entryPoint: "connectToVendors";
|
|
1078
1155
|
cardId?: string | undefined;
|
|
1156
|
+
inlineCardOnFile?: boolean | undefined;
|
|
1079
1157
|
}>, z.ZodObject<{
|
|
1080
1158
|
entryPoint: z.ZodLiteral<"insightsDashboard">;
|
|
1081
1159
|
}, "strip", z.ZodTypeAny, {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";var ke=Object.defineProperty,be=Object.defineProperties;var Te=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var te=(e,n,t)=>n in e?ke(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,c=(e,n)=>{for(var t in n||(n={}))oe.call(n,t)&&te(e,t,n[t]);if(U)for(var t of U(n))re.call(n,t)&&te(e,t,n[t]);return e},d=(e,n)=>be(e,Te(n));var h=(e,n)=>{var t={};for(var o in e)oe.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&U)for(var o of U(e))n.indexOf(o)<0&&re.call(e,o)&&(t[o]=e[o]);return t};var L=(e,n,t)=>new Promise((o,r)=>{var i=l=>{try{a(t.next(l))}catch(m){r(m)}},s=l=>{try{a(t.throw(l))}catch(m){r(m)}},a=l=>l.done?o(l.value):Promise.resolve(l.value).then(i,s);a((t=t.apply(e,n)).next())});import f,{useMemo as g,useContext as dn}from"react";import B from"react";import z,{createContext as en,useContext as nn,useState as H,useMemo as xe,useCallback as S,useEffect as tn}from"react";import je,{useMemo as Ve,useRef as $e}from"react";var y=class extends Error{constructor({message:n,code:t}){super(n),this.name="CapitalOSError",this.code=t}},k={unauthorized:"unauthorized",invalid_account_status:"invalid_account_status",unsupported_entry_point:"unsupported_entry_point",internal_error:"internal_error"},D=class extends y{constructor(n){super({message:`Invalid token ${n!=null?n:""}`,code:k.unauthorized}),this.name="CapitalOSInvalidTokenError"}};import{connectToChild as De}from"penpal";import{useCallback as we,useEffect as J,useMemo as ae,useRef as W,useState as ce}from"react";var ie="1.3.2";function Ae(e){let n=JSON.stringify(e),t=btoa(n);return encodeURIComponent(t)}function K(e){try{let n=decodeURIComponent(e),t=atob(n);return JSON.parse(t)}catch(n){throw new D}}function Le(e){try{return decodeURIComponent(e)}catch(n){return e}}function se({tokenData:e,renderingContext:n,theme:t,onError:o}){try{let r=n?d(c({},n),{referer:window.location.href}):null,i=r?Ae(r):null,s=new URL(e.baseUrl),a=Le(e.token);return e.paramLocation==="search"?s.searchParams.set(e.paramKey,a):e.paramLocation==="hash"&&(s.hash=e.paramKey+"="+encodeURIComponent(a)),s.searchParams.set("sdkVersion",ie),i&&s.searchParams.set("renderingContext",i),t&&s.searchParams.set("theme",t),s.toString()}catch(r){o==null||o(new D);return}}function q(e){let t=K(e).path;if(!t||typeof t!="string")throw new D;return{token:e,tokenType:"oneTime",baseUrl:t,paramKey:"token",paramLocation:"search"}}var Se=1e4;function X({iframeRef:e,token:n,onError:t,methods:o}){let[r,i]=ce(null);return J(()=>{if(!e.current)return;let s=De({iframe:e.current,childOrigin:"*",debug:!0,timeout:Se,methods:o});return s.promise.then(()=>{i(s)}).catch(a=>{t==null||t(a),i(null)}),()=>{s.destroy(),i(null)}},[n,e]),r}function Z({tokenData:e,renderingContext:n,theme:t,onError:o}){let r=W(o),i=W(n);return ae(()=>{if(e)return se({tokenData:e,renderingContext:i.current,theme:t,onError:r.current})},[e,t,r,i])}function j(e){let{oneTimeToken:n,enableLogging:t,onError:o,renderingContext:r,theme:i,methods:s}=e,{tokenData:a,error:l,invalidateToken:m}=G(),{log:C,warn:P}=w(t),[v,b]=ce(!1),T=W(null);Re(l,o);let E=ae(()=>n?q(n):a,[n,a]),I=we(()=>{if(C("Token expired, invalidating..."),n){o==null||o(new y({message:"Token expired. Cannot automatically refresh when using token prop.",code:k.unauthorized}));return}m(),b(!1)},[n,m,C,o]);J(()=>{n&&a&&P("token was provided both from provider and from the token prop. the prop will take precedence")},[n,a,P]);let x=Z({tokenData:E,renderingContext:r,theme:i,onError:o}),u=X({iframeRef:T,token:E==null?void 0:E.token,onError:A=>{o==null||o(A),b(!0)},methods:c({onLoad:()=>{b(!0)},onError:A=>{let ve=new y(A);o==null||o(ve)},onTokenExpired:I},s)});return{isLoaded:v,url:x,tokenData:E,iframeRef:T,connection:u}}function Re(e,n){let t=W(!1);J(()=>{e&&!t.current&&(n==null||n(e),t.current=!0)},[e,n])}import{iframeResizer as Fe}from"iframe-resizer";import ze,{forwardRef as He,useEffect as Be,useImperativeHandle as Ne,useRef as _e}from"react";var M=He((e,n)=>{let t=e.title||"iframe",{iframeHTMLAttributes:o,resizerOptions:r}=We(e),i=_e(null);return Be(()=>{let s=i.current;return Fe(c({},r),s),()=>s.iFrameResizer&&s.iFrameResizer.removeListeners()}),Ne(n,()=>i.current),ze.createElement("iframe",d(c({},o),{title:t,ref:i}))});M.displayName="IframeResizer";var Ue=["autoResize","bodyBackground","bodyMargin","bodyPadding","checkOrigin","inPageLinks","heightCalculationMethod","interval","log","maxHeight","maxWidth","minHeight","minWidth","resizeFrom","scrolling","sizeHeight","sizeWidth","warningTimeout","tolerance","widthCalculationMethod","onClosed","onInit","onMessage","onResized","onScroll"],qe=new Set(Ue);function We(e){return Object.keys(e).reduce((t,o)=>{let r=e[o];return qe.has(o)?r!==void 0&&(t.resizerOptions[o]=e[o]):t.iframeHTMLAttributes[o]=e[o],t},{resizerOptions:{},iframeHTMLAttributes:{}})}function de(e){let{oneTimeToken:n,enableLogging:t,onExchangeComplete:o,onExchangeError:r}=e,i=R(t),s=$e(null),a=Ve(()=>q(n),[n]),m=Z({tokenData:a,onError:r,renderingContext:{entryPoint:"tokenExchange"}});return X({iframeRef:s,token:n,onError:r,methods:{onLoad:()=>{},onError:C=>{r==null||r(new y(C))},tokenExchange:{onLongLivedToken:o}}}),je.createElement(M,{src:m,checkOrigin:!1,style:{display:"none"},log:i,ref:s})}var Q={enableLogging:!1},Y="[CapitalOS] ",V={log:(e,n=Q)=>{n.enableLogging&&console.log(`${Y}${e}`)},warn:(e,n=Q)=>{n.enableLogging&&console.warn(`${Y}${e}`)},error:(e,n=Q)=>{n.enableLogging&&console.error(`${Y}${e}`)}};import F,{createContext as Ge,useState as Qe,useMemo as ge,useCallback as Ye}from"react";import Ke from"react";import{useMemo as Je}from"react";function le(l){var m=l,{onDone:e,onCancel:n,mfaId:t,destination:o,codeLength:r,canResendAfter:i,operationName:s}=m,a=h(m,["onDone","onCancel","mfaId","destination","codeLength","canResendAfter","operationName"]);let C="mfa",P=Je(()=>({entryPoint:C,mfaId:t,destination:o,codeLength:r,canResendAfter:i,operationName:s}),[C,t,o,r,i,s]);return Ke.createElement(p,d(c({},a),{renderingContext:P,methods:{mfa:{onDone:e,onCancel:n}}}))}import pe,{useEffect as Xe}from"react";var ue={backdrop:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(2px)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},container:{backgroundColor:"white",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05)",maxWidth:"600px",width:"100%",maxHeight:"90vh",overflow:"hidden",position:"relative"}};function me({onClose:e,children:n,ariaLabel:t="Modal dialog"}){Xe(()=>{let r=i=>{i.key==="Escape"&&e()};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[e]);let o=r=>{r.target===r.currentTarget&&e()};return pe.createElement("div",{style:ue.backdrop,onClick:o,role:"dialog","aria-modal":"true","aria-label":t},pe.createElement("div",{style:ue.container},n))}import{useState as Ze,useCallback as $}from"react";function fe(){var m;let[e,n]=Ze(null),{log:t}=w(),o=$(C=>(t("MFA requested"),new Promise((P,v)=>{n({context:C,resolve:P,reject:v})})),[t]),r=$(()=>{e&&(t("MFA completed successfully"),e.resolve({success:!0,canceled:!1,data:void 0}),n(null))},[e,t]),i=$(()=>{e&&(t("MFA canceled"),e.resolve({success:!1,canceled:!0}),n(null))},[e,t]),s=$(C=>{e&&(t("MFA error: "+C.message),e.resolve({success:!1,canceled:!1,error:C}),n(null))},[e,t]),a=!!e,l=(m=e==null?void 0:e.context)!=null?m:null;return{activeMfaRequest:e,isMfaActive:a,mfaContext:l,requestMfa:o,handleMfaDone:r,handleMfaCancel:i,handleMfaError:s}}var ee=Ge(null);function Ce({children:e}){let[n,t]=Qe(null),{log:o}=w(),{requestMfa:r,handleMfaDone:i,handleMfaCancel:s,isMfaActive:a,mfaContext:l}=fe(),m=Ye(x=>L(this,null,function*(){let u=yield r(x);return u.success?{success:!0}:u.canceled?{success:!1,canceled:!0}:{success:!1,error:u.error.message}}),[r]),C=ge(()=>n?{freezeCard:x=>L(this,null,function*(){try{let u=yield n.freezeCard(x);return u.success?{success:!0,canceled:!1,data:u.data}:u.canceled?{success:!1,canceled:!0}:{success:!1,canceled:!1,error:new y({code:k.internal_error,message:u.error})}}catch(u){return{success:!1,canceled:!1,error:new y({code:k.internal_error,message:u instanceof Error?u.message:"Communication error with iframe"})}}}),unfreezeCard:x=>L(this,null,function*(){try{let u=yield n.unfreezeCard(x);return u.success?{success:!0,canceled:!1,data:u.data}:u.canceled?{success:!1,canceled:!0}:{success:!1,canceled:!1,error:new y({code:k.internal_error,message:u.error})}}catch(u){return{success:!1,canceled:!1,error:new y({code:k.internal_error,message:u instanceof Error?u.message:"Communication error with iframe"})}}})}:null,[n]),P=ge(()=>({"system-messages":{requestMfa:m},mfa:{onDone:i,onCancel:s}}),[m,i,s]),{isLoaded:v,url:b,connection:T,iframeRef:E}=j({renderingContext:{entryPoint:"actions"},methods:P});F.useEffect(()=>{let x=!0;return T&&T.promise.then(u=>{x&&(t(u),o("Actions iframe child functions loaded"))}),()=>{x=!1}},[T,o]);let I=!v||!n;return F.createElement(ee.Provider,{value:{childFunctions:n,actions:C,isLoading:I}},e,b&&F.createElement(M,{src:b,style:{display:"none"},checkOrigin:!1,ref:E}),a&&l&&F.createElement(me,{onClose:s,ariaLabel:"Multi-factor authentication"},F.createElement(le,d(c({mfaId:l.mfaId,destination:l.destination,codeLength:l.codeLength,canResendAfter:l.canResendAfter},l.operationName&&{operationName:l.operationName}),{onDone:i,onCancel:s}))))}var he=en({isLoading:!1,invalidateToken:()=>{},enableLogging:!1}),on=({getToken:e,enableLogging:n,children:t})=>{let[o,r]=H(void 0),[i,s]=H(void 0),[a,l]=H(void 0),[m,C]=H(!1),[P,v]=H(void 0),b=S(()=>L(void 0,null,function*(){C(!0);try{let x=yield e();r(x),v(void 0);let u=K(x),A=new URL(u.path);A.pathname="",s(A.toString())}catch(x){v(x)}finally{C(!1)}}),[e]),T=S(()=>{l(void 0)},[]);tn(()=>{a||b()},[a,b]);let E=S(x=>{l(x),r(void 0),v(void 0)},[]),I=xe(()=>{if(a&&!i)throw new y({message:"baseUrl is required for long lived tokens",code:k.unauthorized});return{tokenData:a?{token:a,tokenType:"longLived",baseUrl:i,paramKey:"access_token",paramLocation:"hash"}:void 0,isLoading:m,error:P,invalidateToken:T,enableLogging:n!=null?n:!1}},[a,m,P,T,i,n]);return z.createElement(z.Fragment,null,z.createElement(he.Provider,{value:I},z.createElement(Ce,null,t)),o&&!a&&z.createElement(de,{oneTimeToken:o,onExchangeComplete:E,enableLogging:n,onExchangeError:v}))},G=()=>nn(he);function R(e){let{enableLogging:n}=G();return e!==void 0?e:n}function w(e){let n=R(e),t=S(i=>{V.log(i,{enableLogging:n})},[n]),o=S(i=>{V.warn(i,{enableLogging:n})},[n]),r=S(i=>{V.error(i,{enableLogging:n})},[n]);return xe(()=>({log:t,warn:o,error:r}),[t,o,r])}function p(e){let{token:n,className:t,enableLogging:o,onError:r,loadingComponent:i,renderingContext:s,methods:a,theme:l,sizeWidth:m}=e,C=R(o),{isLoaded:P,url:v,tokenData:b,iframeRef:T}=j({oneTimeToken:n,enableLogging:C,onError:r,renderingContext:s,theme:l,methods:a});if(!b||!v)return B.createElement(B.Fragment,null,i||null);let E=s.entryPoint!=="insightsWidget";return B.createElement(B.Fragment,null,!P&&i,B.createElement(M,{src:v,allow:"clipboard-write",checkOrigin:!1,style:{width:"1px",height:"0px",minWidth:"100%"},className:t,log:C,ref:T,hidden:!P,onResized:I=>{if(!E)return;let x=`${parseInt(I.height)+12}px`;I.iframe.style.height=x},sizeWidth:m}))}import _,{useMemo as rn}from"react";import{useState as sn}from"react";import O,{useState as ye}from"react";var N={bugButton:{position:"fixed",left:"12px",bottom:"12px",margin:"12px",padding:"4px",display:"inline-flex",alignItems:"center",borderRadius:"9999px",border:"1px solid transparent",backgroundColor:"#2563eb",color:"white",opacity:.4,boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1)",cursor:"pointer",zIndex:50,transition:"opacity 0.3s ease-in-out"},bugButtonHover:{backgroundColor:"#1d4ed8",opacity:1},bugButtonFocus:{outline:"none",boxShadow:"0 0 0 2px white, 0 0 0 4px #3b82f6"},bugIcon:{width:"20px",height:"20px"},loadingButton:{cursor:"default",opacity:1,animation:"pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite"}},Pe=()=>O.createElement("svg",{style:N.bugIcon,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor"},O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"}));function ne({onClick:e,isLoading:n=!1}){let[t,o]=ye(!1),[r,i]=ye(!1),s=c(c(c(c({},N.bugButton),n&&N.loadingButton),!n&&t&&N.bugButtonHover),!n&&r&&N.bugButtonFocus);return n?O.createElement("div",{style:s},O.createElement("style",null,`
|
|
1
|
+
"use client";var ke=Object.defineProperty,be=Object.defineProperties;var Te=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var oe=(e,n,o)=>n in e?ke(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,c=(e,n)=>{for(var o in n||(n={}))te.call(n,o)&&oe(e,o,n[o]);if(U)for(var o of U(n))re.call(n,o)&&oe(e,o,n[o]);return e},d=(e,n)=>be(e,Te(n));var h=(e,n)=>{var o={};for(var t in e)te.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&U)for(var t of U(e))n.indexOf(t)<0&&re.call(e,t)&&(o[t]=e[t]);return o};var L=(e,n,o)=>new Promise((t,i)=>{var r=l=>{try{a(o.next(l))}catch(m){i(m)}},s=l=>{try{a(o.throw(l))}catch(m){i(m)}},a=l=>l.done?t(l.value):Promise.resolve(l.value).then(r,s);a((o=o.apply(e,n)).next())});import f,{useMemo as g,useContext as dn}from"react";import B from"react";import z,{createContext as en,useContext as nn,useState as H,useMemo as xe,useCallback as S,useEffect as on}from"react";import je,{useMemo as Ve,useRef as $e}from"react";var y=class extends Error{constructor({message:n,code:o}){super(n),this.name="CapitalOSError",this.code=o}},k={unauthorized:"unauthorized",invalid_account_status:"invalid_account_status",unsupported_entry_point:"unsupported_entry_point",internal_error:"internal_error"},D=class extends y{constructor(n){super({message:`Invalid token ${n!=null?n:""}`,code:k.unauthorized}),this.name="CapitalOSInvalidTokenError"}};import{connectToChild as De}from"penpal";import{useCallback as we,useEffect as J,useMemo as ae,useRef as W,useState as ce}from"react";var ie="1.3.3";function Ae(e){let n=JSON.stringify(e),o=btoa(n);return encodeURIComponent(o)}function K(e){try{let n=decodeURIComponent(e),o=atob(n);return JSON.parse(o)}catch(n){throw new D}}function Le(e){try{return decodeURIComponent(e)}catch(n){return e}}function se({tokenData:e,renderingContext:n,theme:o,onError:t}){try{let i=n?d(c({},n),{referer:window.location.href}):null,r=i?Ae(i):null,s=new URL(e.baseUrl),a=Le(e.token);return e.paramLocation==="search"?s.searchParams.set(e.paramKey,a):e.paramLocation==="hash"&&(s.hash=e.paramKey+"="+encodeURIComponent(a)),s.searchParams.set("sdkVersion",ie),r&&s.searchParams.set("renderingContext",r),o&&s.searchParams.set("theme",o),s.toString()}catch(i){t==null||t(new D);return}}function q(e){let o=K(e).path;if(!o||typeof o!="string")throw new D;return{token:e,tokenType:"oneTime",baseUrl:o,paramKey:"token",paramLocation:"search"}}var Se=1e4;function X({iframeRef:e,token:n,onError:o,methods:t}){let[i,r]=ce(null);return J(()=>{if(!e.current)return;let s=De({iframe:e.current,childOrigin:"*",debug:!0,timeout:Se,methods:t});return s.promise.then(()=>{r(s)}).catch(a=>{o==null||o(a),r(null)}),()=>{s.destroy(),r(null)}},[n,e]),i}function Z({tokenData:e,renderingContext:n,theme:o,onError:t}){let i=W(t),r=W(n);return ae(()=>{if(e)return se({tokenData:e,renderingContext:r.current,theme:o,onError:i.current})},[e,o,i,r])}function j(e){let{oneTimeToken:n,enableLogging:o,onError:t,renderingContext:i,theme:r,methods:s}=e,{tokenData:a,error:l,invalidateToken:m}=G(),{log:C,warn:P}=w(o),[v,b]=ce(!1),T=W(null);Re(l,t);let E=ae(()=>n?q(n):a,[n,a]),I=we(()=>{if(C("Token expired, invalidating..."),n){t==null||t(new y({message:"Token expired. Cannot automatically refresh when using token prop.",code:k.unauthorized}));return}m(),b(!1)},[n,m,C,t]);J(()=>{n&&a&&P("token was provided both from provider and from the token prop. the prop will take precedence")},[n,a,P]);let x=Z({tokenData:E,renderingContext:i,theme:r,onError:t}),u=X({iframeRef:T,token:E==null?void 0:E.token,onError:A=>{t==null||t(A),b(!0)},methods:c({onLoad:()=>{b(!0)},onError:A=>{let ve=new y(A);t==null||t(ve)},onTokenExpired:I},s)});return{isLoaded:v,url:x,tokenData:E,iframeRef:T,connection:u}}function Re(e,n){let o=W(!1);J(()=>{e&&!o.current&&(n==null||n(e),o.current=!0)},[e,n])}import{iframeResizer as Fe}from"iframe-resizer";import ze,{forwardRef as He,useEffect as Be,useImperativeHandle as Ne,useRef as _e}from"react";var M=He((e,n)=>{let o=e.title||"iframe",{iframeHTMLAttributes:t,resizerOptions:i}=We(e),r=_e(null);return Be(()=>{let s=r.current;return Fe(c({},i),s),()=>s.iFrameResizer&&s.iFrameResizer.removeListeners()}),Ne(n,()=>r.current),ze.createElement("iframe",d(c({},t),{title:o,ref:r}))});M.displayName="IframeResizer";var Ue=["autoResize","bodyBackground","bodyMargin","bodyPadding","checkOrigin","inPageLinks","heightCalculationMethod","interval","log","maxHeight","maxWidth","minHeight","minWidth","resizeFrom","scrolling","sizeHeight","sizeWidth","warningTimeout","tolerance","widthCalculationMethod","onClosed","onInit","onMessage","onResized","onScroll"],qe=new Set(Ue);function We(e){return Object.keys(e).reduce((o,t)=>{let i=e[t];return qe.has(t)?i!==void 0&&(o.resizerOptions[t]=e[t]):o.iframeHTMLAttributes[t]=e[t],o},{resizerOptions:{},iframeHTMLAttributes:{}})}function de(e){let{oneTimeToken:n,enableLogging:o,onExchangeComplete:t,onExchangeError:i}=e,r=R(o),s=$e(null),a=Ve(()=>q(n),[n]),m=Z({tokenData:a,onError:i,renderingContext:{entryPoint:"tokenExchange"}});return X({iframeRef:s,token:n,onError:i,methods:{onLoad:()=>{},onError:C=>{i==null||i(new y(C))},tokenExchange:{onLongLivedToken:t}}}),je.createElement(M,{src:m,checkOrigin:!1,style:{display:"none"},log:r,ref:s})}var Q={enableLogging:!1},Y="[CapitalOS] ",V={log:(e,n=Q)=>{n.enableLogging&&console.log(`${Y}${e}`)},warn:(e,n=Q)=>{n.enableLogging&&console.warn(`${Y}${e}`)},error:(e,n=Q)=>{n.enableLogging&&console.error(`${Y}${e}`)}};import F,{createContext as Ge,useState as Qe,useMemo as ge,useCallback as Ye}from"react";import Ke from"react";import{useMemo as Je}from"react";function le(l){var m=l,{onDone:e,onCancel:n,mfaId:o,destination:t,codeLength:i,canResendAfter:r,operationName:s}=m,a=h(m,["onDone","onCancel","mfaId","destination","codeLength","canResendAfter","operationName"]);let C="mfa",P=Je(()=>({entryPoint:C,mfaId:o,destination:t,codeLength:i,canResendAfter:r,operationName:s}),[C,o,t,i,r,s]);return Ke.createElement(p,d(c({},a),{renderingContext:P,methods:{mfa:{onDone:e,onCancel:n}}}))}import pe,{useEffect as Xe}from"react";var ue={backdrop:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(2px)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},container:{backgroundColor:"white",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05)",maxWidth:"600px",width:"100%",maxHeight:"90vh",overflow:"hidden",position:"relative"}};function me({onClose:e,children:n,ariaLabel:o="Modal dialog"}){Xe(()=>{let i=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[e]);let t=i=>{i.target===i.currentTarget&&e()};return pe.createElement("div",{style:ue.backdrop,onClick:t,role:"dialog","aria-modal":"true","aria-label":o},pe.createElement("div",{style:ue.container},n))}import{useState as Ze,useCallback as $}from"react";function fe(){var m;let[e,n]=Ze(null),{log:o}=w(),t=$(C=>(o("MFA requested"),new Promise((P,v)=>{n({context:C,resolve:P,reject:v})})),[o]),i=$(()=>{e&&(o("MFA completed successfully"),e.resolve({success:!0,canceled:!1,data:void 0}),n(null))},[e,o]),r=$(()=>{e&&(o("MFA canceled"),e.resolve({success:!1,canceled:!0}),n(null))},[e,o]),s=$(C=>{e&&(o("MFA error: "+C.message),e.resolve({success:!1,canceled:!1,error:C}),n(null))},[e,o]),a=!!e,l=(m=e==null?void 0:e.context)!=null?m:null;return{activeMfaRequest:e,isMfaActive:a,mfaContext:l,requestMfa:t,handleMfaDone:i,handleMfaCancel:r,handleMfaError:s}}var ee=Ge(null);function Ce({children:e}){let[n,o]=Qe(null),{log:t}=w(),{requestMfa:i,handleMfaDone:r,handleMfaCancel:s,isMfaActive:a,mfaContext:l}=fe(),m=Ye(x=>L(this,null,function*(){let u=yield i(x);return u.success?{success:!0}:u.canceled?{success:!1,canceled:!0}:{success:!1,error:u.error.message}}),[i]),C=ge(()=>n?{freezeCard:x=>L(this,null,function*(){try{let u=yield n.freezeCard(x);return u.success?{success:!0,canceled:!1,data:u.data}:u.canceled?{success:!1,canceled:!0}:{success:!1,canceled:!1,error:new y({code:k.internal_error,message:u.error})}}catch(u){return{success:!1,canceled:!1,error:new y({code:k.internal_error,message:u instanceof Error?u.message:"Communication error with iframe"})}}}),unfreezeCard:x=>L(this,null,function*(){try{let u=yield n.unfreezeCard(x);return u.success?{success:!0,canceled:!1,data:u.data}:u.canceled?{success:!1,canceled:!0}:{success:!1,canceled:!1,error:new y({code:k.internal_error,message:u.error})}}catch(u){return{success:!1,canceled:!1,error:new y({code:k.internal_error,message:u instanceof Error?u.message:"Communication error with iframe"})}}})}:null,[n]),P=ge(()=>({"system-messages":{requestMfa:m},mfa:{onDone:r,onCancel:s}}),[m,r,s]),{isLoaded:v,url:b,connection:T,iframeRef:E}=j({renderingContext:{entryPoint:"actions"},methods:P});F.useEffect(()=>{let x=!0;return T&&T.promise.then(u=>{x&&(o(u),t("Actions iframe child functions loaded"))}),()=>{x=!1}},[T,t]);let I=!v||!n;return F.createElement(ee.Provider,{value:{childFunctions:n,actions:C,isLoading:I}},e,b&&F.createElement(M,{src:b,style:{display:"none"},checkOrigin:!1,ref:E}),a&&l&&F.createElement(me,{onClose:s,ariaLabel:"Multi-factor authentication"},F.createElement(le,d(c({mfaId:l.mfaId,destination:l.destination,codeLength:l.codeLength,canResendAfter:l.canResendAfter},l.operationName&&{operationName:l.operationName}),{onDone:r,onCancel:s}))))}var he=en({isLoading:!1,invalidateToken:()=>{},enableLogging:!1}),tn=({getToken:e,enableLogging:n,children:o})=>{let[t,i]=H(void 0),[r,s]=H(void 0),[a,l]=H(void 0),[m,C]=H(!1),[P,v]=H(void 0),b=S(()=>L(void 0,null,function*(){C(!0);try{let x=yield e();i(x),v(void 0);let u=K(x),A=new URL(u.path);A.pathname="",s(A.toString())}catch(x){v(x)}finally{C(!1)}}),[e]),T=S(()=>{l(void 0)},[]);on(()=>{a||b()},[a,b]);let E=S(x=>{l(x),i(void 0),v(void 0)},[]),I=xe(()=>{if(a&&!r)throw new y({message:"baseUrl is required for long lived tokens",code:k.unauthorized});return{tokenData:a?{token:a,tokenType:"longLived",baseUrl:r,paramKey:"access_token",paramLocation:"hash"}:void 0,isLoading:m,error:P,invalidateToken:T,enableLogging:n!=null?n:!1}},[a,m,P,T,r,n]);return z.createElement(z.Fragment,null,z.createElement(he.Provider,{value:I},z.createElement(Ce,null,o)),t&&!a&&z.createElement(de,{oneTimeToken:t,onExchangeComplete:E,enableLogging:n,onExchangeError:v}))},G=()=>nn(he);function R(e){let{enableLogging:n}=G();return e!==void 0?e:n}function w(e){let n=R(e),o=S(r=>{V.log(r,{enableLogging:n})},[n]),t=S(r=>{V.warn(r,{enableLogging:n})},[n]),i=S(r=>{V.error(r,{enableLogging:n})},[n]);return xe(()=>({log:o,warn:t,error:i}),[o,t,i])}function p(e){let{token:n,className:o,enableLogging:t,onError:i,loadingComponent:r,renderingContext:s,methods:a,theme:l,sizeWidth:m}=e,C=R(t),{isLoaded:P,url:v,tokenData:b,iframeRef:T}=j({oneTimeToken:n,enableLogging:C,onError:i,renderingContext:s,theme:l,methods:a});if(!b||!v)return B.createElement(B.Fragment,null,r||null);let E=s.entryPoint!=="insightsWidget";return B.createElement(B.Fragment,null,!P&&r,B.createElement(M,{src:v,allow:"clipboard-write",checkOrigin:!1,style:{width:"1px",height:"0px",minWidth:"100%"},className:o,log:C,ref:T,hidden:!P,onResized:I=>{if(!E)return;let x=`${parseInt(I.height)+12}px`;I.iframe.style.height=x},sizeWidth:m}))}import _,{useMemo as rn}from"react";import{useState as sn}from"react";import O,{useState as ye}from"react";var N={bugButton:{position:"fixed",left:"12px",bottom:"12px",margin:"12px",padding:"4px",display:"inline-flex",alignItems:"center",borderRadius:"9999px",border:"1px solid transparent",backgroundColor:"#2563eb",color:"white",opacity:.4,boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1)",cursor:"pointer",zIndex:50,transition:"opacity 0.3s ease-in-out"},bugButtonHover:{backgroundColor:"#1d4ed8",opacity:1},bugButtonFocus:{outline:"none",boxShadow:"0 0 0 2px white, 0 0 0 4px #3b82f6"},bugIcon:{width:"20px",height:"20px"},loadingButton:{cursor:"default",opacity:1,animation:"pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite"}},Pe=()=>O.createElement("svg",{style:N.bugIcon,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor"},O.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"}));function ne({onClick:e,isLoading:n=!1}){let[o,t]=ye(!1),[i,r]=ye(!1),s=c(c(c(c({},N.bugButton),n&&N.loadingButton),!n&&o&&N.bugButtonHover),!n&&i&&N.bugButtonFocus);return n?O.createElement("div",{style:s},O.createElement("style",null,`
|
|
2
2
|
@keyframes pulse {
|
|
3
3
|
0%, 100% {
|
|
4
4
|
opacity: 1;
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
opacity: 0.4;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
`),O.createElement(Pe,null)):O.createElement("button",{id:"dev-tools-button",onClick:e,type:"button",style:s,onMouseEnter:()=>
|
|
10
|
+
`),O.createElement(Pe,null)):O.createElement("button",{id:"dev-tools-button",onClick:e,type:"button",style:s,onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),onFocus:()=>r(!0),onBlur:()=>r(!1)},O.createElement(Pe,null))}var an={panel:{position:"fixed",bottom:"20px",left:"20px",zIndex:50}};function cn(e){let n="devTools",o=rn(()=>({entryPoint:n}),[n]),[t,i]=sn(!1);return _.createElement("aside",{"aria-label":"CapitalOS dev tools"},!t&&_.createElement(ne,{onClick:()=>i(!t)}),t&&_.createElement("div",{style:an.panel},_.createElement(p,d(c({},e),{renderingContext:o,methods:{devTools:{onClose:()=>i(!1)}},enableLogging:!0,sizeWidth:!0,loadingComponent:_.createElement(ne,{isLoading:!0})}))))}function ln(e){let n="cardsApp",o=g(()=>({entryPoint:n}),[n]);return f.createElement(p,d(c({},e),{renderingContext:o}))}var Zo=ln;function Go(i){var r=i,{cardholder:e,onDone:n,onCancel:o}=r,t=h(r,["cardholder","onDone","onCancel"]);let s="createCard",a=g(()=>({entryPoint:s,cardholder:e}),[e]);return f.createElement(p,d(c({},t),{renderingContext:a,methods:{createCard:{onDone:n,onCancel:o}}}))}function Qo(i){var r=i,{transactionId:e,onDone:n,onCancel:o}=r,t=h(r,["transactionId","onDone","onCancel"]);let s="createDispute",a=g(()=>({entryPoint:s,transactionId:e}),[e]);return f.createElement(p,d(c({},t),{renderingContext:a,methods:{createDispute:{onDone:n,onCancel:o}}}))}function Yo(e){let n="billPayApp",o=g(()=>({entryPoint:n}),[n]);return f.createElement(p,d(c({},e),{renderingContext:o}))}function et(e){let s=e,{onCardCanceled:n,onHideSensitiveDetails:o}=s,t=h(s,["onCardCanceled","onHideSensitiveDetails"]),i="cardDetails",r=g(()=>({entryPoint:i,cardId:e.cardId,cardOnly:e.cardOnly,backOnly:e.backOnly,hideAddress:e.hideAddress}),[i,e.cardId,e.cardOnly,e.backOnly,e.hideAddress]);return f.createElement(p,d(c({},t),{renderingContext:r,methods:{cardDetails:{onCardCanceled:n!=null?n:()=>{},onHideSensitiveDetails:o!=null?o:()=>{}}}}))}function nt(e){let n="accountDetails",o=g(()=>({entryPoint:n}),[n]);return f.createElement(p,d(c({},e),{renderingContext:o}))}function ot(e){let n="accountActions",o=g(()=>({entryPoint:n}),[n]);return f.createElement(p,d(c({},e),{renderingContext:o}))}function tt(o){var t=o,{onClose:e}=t,n=h(t,["onClose"]);let i="manageBankConnections",r=g(()=>({entryPoint:i}),[i]);return f.createElement(p,d(c({},n),{renderingContext:r,methods:{manageBankConnections:{onClose:e}}}))}function rt(o){var t=o,{onClose:e}=t,n=h(t,["onClose"]);let i="configureAutoPay",r=g(()=>({entryPoint:i}),[i]);return f.createElement(p,d(c({},n),{renderingContext:r,methods:{configureAutoPay:{onClose:e}}}))}function it(o){var t=o,{onClose:e}=t,n=h(t,["onClose"]);let i="policySettings",r=g(()=>({entryPoint:i}),[i]);return f.createElement(p,d(c({},n),{renderingContext:r,methods:{policySettings:{onClose:e}}}))}function st(i){var r=i,{cardId:e,onClose:n,inlineCardOnFile:o}=r,t=h(r,["cardId","onClose","inlineCardOnFile"]);let s="connectToVendors",a=g(()=>({entryPoint:s,cardId:e,inlineCardOnFile:o}),[s,e,o]);return f.createElement(p,d(c({},t),{renderingContext:a,methods:{connectToVendors:{onClose:n}}}))}function at(e){let n="insightsDashboard",o=g(()=>({entryPoint:n}),[n]);return f.createElement(p,d(c({},e),{renderingContext:o}))}function ct(e){let n="insightsWidget",{widget:o,hideTitle:t,height:i,width:r}=e,s=g(()=>({entryPoint:n,widget:o,hideTitle:t,height:i,width:r}),[n,o,t,i,r]);return f.createElement(p,d(c({},e),{renderingContext:s}))}function dt(i){var r=i,{onDone:e,entryPoint:n,exitPoint:o}=r,t=h(r,["onDone","entryPoint","exitPoint"]);let s="onboarding",a=g(()=>({entryPoint:s,onboardingEntryPoint:n,onboardingExitPoint:o}),[s,n,o]);return f.createElement(p,d(c({},t),{renderingContext:a,methods:{onboarding:{onDone:e}}}))}function lt(o){var t=o,{onDone:e}=t,n=h(t,["onDone"]);let i="makePayment",r=g(()=>({entryPoint:i}),[i]);return f.createElement(p,d(c({},n),{renderingContext:r,methods:{makePayment:{onDone:e}}}))}function pt(t){var i=t,{onDone:e,onCancel:n}=i,o=h(i,["onDone","onCancel"]);let r="contactSupport",s=g(()=>({entryPoint:r}),[r]);return f.createElement(p,d(c({},o),{renderingContext:s,methods:{contactSupport:{onDone:e,onCancel:n}}}))}function ut(o){var t=o,{onDone:e}=t,n=h(t,["onDone"]);let i="statements",r=g(()=>({entryPoint:i}),[i]);return f.createElement(p,d(c({},n),{renderingContext:r,methods:{statements:{onDone:e}}}))}function mt(o){var t=o,{onDone:e}=t,n=h(t,["onDone"]);let i="legalDocuments",r=g(()=>({entryPoint:i}),[i]);return f.createElement(p,d(c({},n),{renderingContext:r,methods:{legalDocuments:{onDone:e}}}))}function ft(i){var r=i,{cardId:e,onDone:n,onClose:o}=r,t=h(r,["cardId","onDone","onClose"]);let s="replaceCard",a=g(()=>({entryPoint:s,cardId:e}),[e]);return f.createElement(p,d(c({},t),{renderingContext:a,methods:{replaceCard:{onDone:n,onClose:o}}}))}function gt(i){var r=i,{cardId:e,onDone:n,onClose:o}=r,t=h(r,["cardId","onDone","onClose"]);let s="terminateCard",a=g(()=>({entryPoint:s,cardId:e}),[e]);return f.createElement(p,d(c({},t),{renderingContext:a,methods:{terminateCard:{onDone:n,onClose:o}}}))}function Ct(e){let n="transactions",o=g(()=>({entryPoint:n}),[n]);return f.createElement(p,d(c({},e),{renderingContext:o}))}function xt(){let e=dn(ee);if(!e)throw new y({message:"useActions must be used within a CapitalOsAuthenticationProvider",code:k.internal_error});let{childFunctions:n,isLoading:o}=e;return{actions:n,isLoading:o}}export{ot as AccountActions,nt as AccountDetails,Zo as App,Yo as BillPayApp,tn as CapitalOsAuthenticationProvider,et as CardDetails,ln as CardsApp,rt as ConfigureAutoPay,st as ConnectToVendors,pt as ContactSupport,cn as DevTools,Qo as DisputeTransaction,at as InsightsDashboard,ct as InsightsWidget,Go as IssueCard,mt as LegalDocuments,lt as MakePayment,tt as ManageBankConnections,dt as Onboarding,it as PolicySettings,ft as ReplaceCard,ut as Statements,gt as TerminateCard,Ct as Transactions,xt as useActions};
|
|
11
11
|
//# sourceMappingURL=index.js.map
|