@frak-labs/core-sdk 0.0.4 → 0.0.6
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/cdn/bundle.js +18 -6
- package/dist/actions/index.cjs +61 -63
- package/dist/actions/index.d.cts +11 -13
- package/dist/actions/index.d.ts +11 -13
- package/dist/actions/index.js +21 -36
- package/dist/{chunk-GDH3M5ZC.js → chunk-665P7NO4.cjs} +7 -10
- package/dist/{chunk-HDFNBQ4E.cjs → chunk-7YDJDVXY.cjs} +61 -70
- package/dist/{chunk-AFLVOY5H.js → chunk-GTBCSNLF.js} +34 -57
- package/dist/chunk-PHVGCFDX.cjs +155 -0
- package/dist/{chunk-PO6YSB4Q.cjs → chunk-U2NTN5QZ.js} +2 -11
- package/dist/{chunk-RMOFMRZR.js → chunk-VE6URIIJ.js} +19 -41
- package/dist/{context-BjKowynW.d.cts → context-D7aZDKLT.d.cts} +209 -23
- package/dist/{context-DjVVznrf.d.ts → context-rDsQbSgB.d.ts} +209 -23
- package/dist/index.cjs +231 -68
- package/dist/index.d.cts +49 -67
- package/dist/index.d.ts +49 -67
- package/dist/index.js +154 -50
- package/dist/interactions/index.cjs +26 -15
- package/dist/interactions/index.js +1 -15
- package/package.json +9 -4
- package/dist/chunk-ZDGHKI3S.cjs +0 -171
|
@@ -37,9 +37,9 @@ type FrakWalletSdkConfig = {
|
|
|
37
37
|
* @ignore
|
|
38
38
|
*/
|
|
39
39
|
type IFrameLifecycleEvent = {
|
|
40
|
-
iframeLifecycle: "connected" | "
|
|
40
|
+
iframeLifecycle: "connected" | "show" | "hide";
|
|
41
41
|
data?: never;
|
|
42
|
-
} | DoBackupEvent | RemoveBackupEvent;
|
|
42
|
+
} | DoBackupEvent | RemoveBackupEvent | HandshakeRequestEvent;
|
|
43
43
|
type DoBackupEvent = {
|
|
44
44
|
iframeLifecycle: "do-backup";
|
|
45
45
|
data: {
|
|
@@ -49,12 +49,18 @@ type DoBackupEvent = {
|
|
|
49
49
|
type RemoveBackupEvent = {
|
|
50
50
|
iframeLifecycle: "remove-backup";
|
|
51
51
|
};
|
|
52
|
+
type HandshakeRequestEvent = {
|
|
53
|
+
iframeLifecycle: "handshake";
|
|
54
|
+
data: {
|
|
55
|
+
token: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
52
58
|
|
|
53
59
|
/**
|
|
54
60
|
* Event related to the iframe lifecycle
|
|
55
61
|
* @ignore
|
|
56
62
|
*/
|
|
57
|
-
type ClientLifecycleEvent = CustomCssEvent | RestoreBackupEvent;
|
|
63
|
+
type ClientLifecycleEvent = CustomCssEvent | RestoreBackupEvent | HearbeatEvent | HandshakeResponse;
|
|
58
64
|
type CustomCssEvent = {
|
|
59
65
|
clientLifecycle: "modal-css";
|
|
60
66
|
data: {
|
|
@@ -67,6 +73,59 @@ type RestoreBackupEvent = {
|
|
|
67
73
|
backup: string;
|
|
68
74
|
};
|
|
69
75
|
};
|
|
76
|
+
type HearbeatEvent = {
|
|
77
|
+
clientLifecycle: "heartbeat";
|
|
78
|
+
};
|
|
79
|
+
type HandshakeResponse = {
|
|
80
|
+
clientLifecycle: "handshake-response";
|
|
81
|
+
data: {
|
|
82
|
+
token: string;
|
|
83
|
+
currentUrl: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The final keys for each interaction types (e.g. `openArticle`) -> interaction type
|
|
89
|
+
* @inline
|
|
90
|
+
*/
|
|
91
|
+
type InteractionTypesKey = {
|
|
92
|
+
[K in keyof typeof interactionTypes]: keyof (typeof interactionTypes)[K];
|
|
93
|
+
}[keyof typeof interactionTypes];
|
|
94
|
+
/**
|
|
95
|
+
* The keys for each interaction types (e.g. `press.openArticle`) -> category_type.interaction_type
|
|
96
|
+
* @inline
|
|
97
|
+
*/
|
|
98
|
+
type FullInteractionTypesKey = {
|
|
99
|
+
[Category in keyof typeof interactionTypes]: `${Category & string}.${keyof (typeof interactionTypes)[Category] & string}`;
|
|
100
|
+
}[keyof typeof interactionTypes];
|
|
101
|
+
/**
|
|
102
|
+
* Each interactions types according to the product types
|
|
103
|
+
*/
|
|
104
|
+
declare const interactionTypes: {
|
|
105
|
+
readonly press: {
|
|
106
|
+
readonly openArticle: "0xc0a24ffb";
|
|
107
|
+
readonly readArticle: "0xd5bd0fbe";
|
|
108
|
+
};
|
|
109
|
+
readonly dapp: {
|
|
110
|
+
readonly proofVerifiableStorageUpdate: "0x2ab2aeef";
|
|
111
|
+
readonly callableVerifiableStorageUpdate: "0xa07da986";
|
|
112
|
+
};
|
|
113
|
+
readonly webshop: {
|
|
114
|
+
readonly open: "0xb311798f";
|
|
115
|
+
};
|
|
116
|
+
readonly referral: {
|
|
117
|
+
readonly referred: "0x010cc3b9";
|
|
118
|
+
readonly createLink: "0xb2c0f17c";
|
|
119
|
+
};
|
|
120
|
+
readonly purchase: {
|
|
121
|
+
readonly started: "0xd87e90c3";
|
|
122
|
+
readonly completed: "0x8403aeb4";
|
|
123
|
+
readonly unsafeCompleted: "0x4d5b14e0";
|
|
124
|
+
};
|
|
125
|
+
readonly retail: {
|
|
126
|
+
readonly customerMeeting: "0x74489004";
|
|
127
|
+
};
|
|
128
|
+
};
|
|
70
129
|
|
|
71
130
|
/**
|
|
72
131
|
* SSO Metadata
|
|
@@ -80,23 +139,6 @@ type SsoMetadata = {
|
|
|
80
139
|
* Link to your homepage, if referenced your app name will contain a link on the sso page
|
|
81
140
|
*/
|
|
82
141
|
homepageLink?: string;
|
|
83
|
-
/**
|
|
84
|
-
* A few links that will be displayed in the footer
|
|
85
|
-
*/
|
|
86
|
-
links?: {
|
|
87
|
-
/**
|
|
88
|
-
* URL to your confidentiality page
|
|
89
|
-
*/
|
|
90
|
-
confidentialityLink?: string;
|
|
91
|
-
/**
|
|
92
|
-
* URL to your help page
|
|
93
|
-
*/
|
|
94
|
-
helpLink?: string;
|
|
95
|
-
/**
|
|
96
|
-
* URL to your CGU page
|
|
97
|
-
*/
|
|
98
|
-
cguLink?: string;
|
|
99
|
-
};
|
|
100
142
|
};
|
|
101
143
|
/**
|
|
102
144
|
* Params to start a SSO
|
|
@@ -327,6 +369,7 @@ type ModalRpcMetadata = {
|
|
|
327
369
|
};
|
|
328
370
|
context?: string;
|
|
329
371
|
lang?: "en" | "fr";
|
|
372
|
+
targetInteraction?: FullInteractionTypesKey;
|
|
330
373
|
} & ({
|
|
331
374
|
isDismissible: true;
|
|
332
375
|
dismissActionTxt?: string;
|
|
@@ -344,6 +387,116 @@ type DisplayModalParamsType<T extends ModalStepTypes[]> = {
|
|
|
344
387
|
metadata?: ModalRpcMetadata;
|
|
345
388
|
};
|
|
346
389
|
|
|
390
|
+
/**
|
|
391
|
+
* The different type of action we can have on the embeded view (once the user is logged in)
|
|
392
|
+
*
|
|
393
|
+
* @group Embeded wallet
|
|
394
|
+
*/
|
|
395
|
+
type EmbededViewAction = {
|
|
396
|
+
key: "sharing";
|
|
397
|
+
/**
|
|
398
|
+
* Some sharing options
|
|
399
|
+
*/
|
|
400
|
+
options?: {
|
|
401
|
+
/**
|
|
402
|
+
* The title that will be displayed on the system popup once the system sharing window is open
|
|
403
|
+
*/
|
|
404
|
+
popupTitle?: string;
|
|
405
|
+
/**
|
|
406
|
+
* The text that will be shared alongside the link.
|
|
407
|
+
* Can contain the variable {LINK} to specify where the link is placed, otherwise it will be added at the end
|
|
408
|
+
*/
|
|
409
|
+
text?: string;
|
|
410
|
+
/**
|
|
411
|
+
* The link to be shared (will be suffixed with the Frak sharing context)
|
|
412
|
+
*/
|
|
413
|
+
link?: string;
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* Some configuration options for the embeded view
|
|
418
|
+
*
|
|
419
|
+
* @group Embeded wallet
|
|
420
|
+
*/
|
|
421
|
+
type LoggedInEmbededView = {
|
|
422
|
+
/**
|
|
423
|
+
* The main action to display on the logged in embeded view
|
|
424
|
+
* If none specified, the user will see his wallet with the activation button
|
|
425
|
+
*/
|
|
426
|
+
action?: EmbededViewAction;
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* The view when a user is logged out
|
|
431
|
+
* @group Embeded wallet
|
|
432
|
+
*/
|
|
433
|
+
type LoggedOutEmbededView = {
|
|
434
|
+
/**
|
|
435
|
+
* Metadata option when displaying the embeded view
|
|
436
|
+
*/
|
|
437
|
+
metadata?: {
|
|
438
|
+
/**
|
|
439
|
+
* The main CTA for the logged out view
|
|
440
|
+
* - can include some variable, available ones are:
|
|
441
|
+
* - {REWARD} -> The maximum reward a user can receive when itneracting on your website
|
|
442
|
+
* - can be formatted in markdown
|
|
443
|
+
*
|
|
444
|
+
* If not sert, it will default to a internalised message
|
|
445
|
+
*/
|
|
446
|
+
text?: string;
|
|
447
|
+
/**
|
|
448
|
+
* The text that will be displayed on the login button
|
|
449
|
+
*
|
|
450
|
+
* If not set, it will default to a internalised message
|
|
451
|
+
*/
|
|
452
|
+
buttonText?: string;
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* The params used to display the embeded wallet
|
|
458
|
+
*
|
|
459
|
+
* @group Embeded wallet
|
|
460
|
+
*/
|
|
461
|
+
type DisplayEmbededWalletParamsType = {
|
|
462
|
+
/**
|
|
463
|
+
* The embeded view to display once the user is logged in
|
|
464
|
+
*/
|
|
465
|
+
loggedIn?: LoggedInEmbededView;
|
|
466
|
+
/**
|
|
467
|
+
* The embeded view to display once the user is logged out
|
|
468
|
+
*/
|
|
469
|
+
loggedOut?: LoggedOutEmbededView;
|
|
470
|
+
/**
|
|
471
|
+
* Some metadata to customise the embeded view
|
|
472
|
+
*/
|
|
473
|
+
metadata?: {
|
|
474
|
+
/**
|
|
475
|
+
* Language of the embeded wallet
|
|
476
|
+
* If undefined, will default to the browser language
|
|
477
|
+
*/
|
|
478
|
+
lang?: "fr" | "en";
|
|
479
|
+
/**
|
|
480
|
+
* The logo to display on the embeded wallet
|
|
481
|
+
* If undefined, will default to no logo displayed
|
|
482
|
+
*/
|
|
483
|
+
logo?: string;
|
|
484
|
+
/**
|
|
485
|
+
* Link to the homepage of the calling website
|
|
486
|
+
* If unedfined, will default to the domain of the calling website
|
|
487
|
+
*/
|
|
488
|
+
homepageLink?: string;
|
|
489
|
+
/**
|
|
490
|
+
* The target interaction behind this modal
|
|
491
|
+
*/
|
|
492
|
+
targetInteraction?: FullInteractionTypesKey;
|
|
493
|
+
/**
|
|
494
|
+
* The position of the component
|
|
495
|
+
*/
|
|
496
|
+
position?: "left" | "right";
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
|
|
347
500
|
/**
|
|
348
501
|
* The keys for each product types
|
|
349
502
|
* @inline
|
|
@@ -392,9 +545,27 @@ type GetProductInformationReturnType = {
|
|
|
392
545
|
productTypes: ProductTypesKey[];
|
|
393
546
|
};
|
|
394
547
|
/**
|
|
395
|
-
*
|
|
548
|
+
* The max potential reward in EUR for the given product
|
|
396
549
|
*/
|
|
397
550
|
estimatedEurReward?: string;
|
|
551
|
+
/**
|
|
552
|
+
* List of all the potentials reward arround this product
|
|
553
|
+
*/
|
|
554
|
+
rewards: {
|
|
555
|
+
token: Address;
|
|
556
|
+
campaign: Address;
|
|
557
|
+
interactionTypeKey: FullInteractionTypesKey;
|
|
558
|
+
referrer: {
|
|
559
|
+
amount: number;
|
|
560
|
+
eurAmount: number;
|
|
561
|
+
usdAmount: number;
|
|
562
|
+
};
|
|
563
|
+
referee: {
|
|
564
|
+
amount: number;
|
|
565
|
+
eurAmount: number;
|
|
566
|
+
usdAmount: number;
|
|
567
|
+
};
|
|
568
|
+
}[];
|
|
398
569
|
};
|
|
399
570
|
|
|
400
571
|
/**
|
|
@@ -455,6 +626,10 @@ type WalletNotConnected = {
|
|
|
455
626
|
* ### frak_getProductInformation
|
|
456
627
|
* - Params: None
|
|
457
628
|
* - Returns: {@link GetProductInformationReturnType}
|
|
629
|
+
*
|
|
630
|
+
* ### frak_displayEmbededWallet
|
|
631
|
+
* - Params: [{@link DisplayEmbededWalletParamsType}]
|
|
632
|
+
* - Returns: undefined
|
|
458
633
|
*/
|
|
459
634
|
type IFrameRpcSchema = [
|
|
460
635
|
/**
|
|
@@ -466,7 +641,7 @@ type IFrameRpcSchema = [
|
|
|
466
641
|
ReturnType: WalletStatusReturnType;
|
|
467
642
|
},
|
|
468
643
|
/**
|
|
469
|
-
* Method to
|
|
644
|
+
* Method to display a modal with the provided steps
|
|
470
645
|
*/
|
|
471
646
|
{
|
|
472
647
|
Method: "frak_displayModal";
|
|
@@ -512,6 +687,14 @@ type IFrameRpcSchema = [
|
|
|
512
687
|
Method: "frak_getProductInformation";
|
|
513
688
|
Parameters?: undefined;
|
|
514
689
|
ReturnType: GetProductInformationReturnType;
|
|
690
|
+
},
|
|
691
|
+
/**
|
|
692
|
+
* Method to show the embeded wallet, with potential customisation
|
|
693
|
+
*/
|
|
694
|
+
{
|
|
695
|
+
Method: "frak_displayEmbededWallet";
|
|
696
|
+
Parameters: [DisplayEmbededWalletParamsType, name: string];
|
|
697
|
+
ReturnType: undefined;
|
|
515
698
|
}
|
|
516
699
|
];
|
|
517
700
|
|
|
@@ -613,6 +796,9 @@ type IFrameRpcEvent = {
|
|
|
613
796
|
*/
|
|
614
797
|
type FrakClient = {
|
|
615
798
|
config: FrakWalletSdkConfig;
|
|
799
|
+
debugInfo: {
|
|
800
|
+
formatDebugInfo: (error: Error | unknown | string) => string;
|
|
801
|
+
};
|
|
616
802
|
} & IFrameTransport;
|
|
617
803
|
|
|
618
804
|
/**
|
|
@@ -624,4 +810,4 @@ type FrakContext = {
|
|
|
624
810
|
r: Address;
|
|
625
811
|
};
|
|
626
812
|
|
|
627
|
-
export { type ClientLifecycleEvent as C, type
|
|
813
|
+
export { type IFrameRpcEvent as A, type IFrameLifecycleEvent as B, type ClientLifecycleEvent as C, type DisplayEmbededWalletParamsType as D, type EmbededViewAction as E, type FrakWalletSdkConfig as F, type GetProductInformationReturnType as G, type ExtractedParametersFromRpc as H, type IFrameEvent as I, type ExtractedReturnTypeFromRpc as J, type LoggedOutEmbededView as L, type ModalStepTypes as M, type OpenSsoParamsType as O, type ProductTypesKey as P, type RpcResponse as R, type SsoMetadata as S, type WalletStatusReturnType as W, type FrakClient as a, type FrakContext as b, productTypesMask as c, type InteractionTypesKey as d, type FullInteractionTypesKey as e, type IFrameRpcSchema as f, type LoggedInEmbededView as g, type ModalRpcMetadata as h, interactionTypes as i, type DisplayModalParamsType as j, type ModalRpcStepsInput as k, type ModalRpcStepsResultType as l, type ModalStepMetadata as m, type LoginModalStepType as n, type SiweAuthenticateModalStepType as o, productTypes as p, type SiweAuthenticationParams as q, type SiweAuthenticateReturnType as r, type SendTransactionTxType as s, type SendTransactionModalStepType as t, type SendTransactionReturnType as u, type OpenInteractionSessionReturnType as v, type OpenInteractionSessionModalStepType as w, type FinalModalStepType as x, type FinalActionType as y, type IFrameTransport as z };
|
|
@@ -37,9 +37,9 @@ type FrakWalletSdkConfig = {
|
|
|
37
37
|
* @ignore
|
|
38
38
|
*/
|
|
39
39
|
type IFrameLifecycleEvent = {
|
|
40
|
-
iframeLifecycle: "connected" | "
|
|
40
|
+
iframeLifecycle: "connected" | "show" | "hide";
|
|
41
41
|
data?: never;
|
|
42
|
-
} | DoBackupEvent | RemoveBackupEvent;
|
|
42
|
+
} | DoBackupEvent | RemoveBackupEvent | HandshakeRequestEvent;
|
|
43
43
|
type DoBackupEvent = {
|
|
44
44
|
iframeLifecycle: "do-backup";
|
|
45
45
|
data: {
|
|
@@ -49,12 +49,18 @@ type DoBackupEvent = {
|
|
|
49
49
|
type RemoveBackupEvent = {
|
|
50
50
|
iframeLifecycle: "remove-backup";
|
|
51
51
|
};
|
|
52
|
+
type HandshakeRequestEvent = {
|
|
53
|
+
iframeLifecycle: "handshake";
|
|
54
|
+
data: {
|
|
55
|
+
token: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
52
58
|
|
|
53
59
|
/**
|
|
54
60
|
* Event related to the iframe lifecycle
|
|
55
61
|
* @ignore
|
|
56
62
|
*/
|
|
57
|
-
type ClientLifecycleEvent = CustomCssEvent | RestoreBackupEvent;
|
|
63
|
+
type ClientLifecycleEvent = CustomCssEvent | RestoreBackupEvent | HearbeatEvent | HandshakeResponse;
|
|
58
64
|
type CustomCssEvent = {
|
|
59
65
|
clientLifecycle: "modal-css";
|
|
60
66
|
data: {
|
|
@@ -67,6 +73,59 @@ type RestoreBackupEvent = {
|
|
|
67
73
|
backup: string;
|
|
68
74
|
};
|
|
69
75
|
};
|
|
76
|
+
type HearbeatEvent = {
|
|
77
|
+
clientLifecycle: "heartbeat";
|
|
78
|
+
};
|
|
79
|
+
type HandshakeResponse = {
|
|
80
|
+
clientLifecycle: "handshake-response";
|
|
81
|
+
data: {
|
|
82
|
+
token: string;
|
|
83
|
+
currentUrl: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The final keys for each interaction types (e.g. `openArticle`) -> interaction type
|
|
89
|
+
* @inline
|
|
90
|
+
*/
|
|
91
|
+
type InteractionTypesKey = {
|
|
92
|
+
[K in keyof typeof interactionTypes]: keyof (typeof interactionTypes)[K];
|
|
93
|
+
}[keyof typeof interactionTypes];
|
|
94
|
+
/**
|
|
95
|
+
* The keys for each interaction types (e.g. `press.openArticle`) -> category_type.interaction_type
|
|
96
|
+
* @inline
|
|
97
|
+
*/
|
|
98
|
+
type FullInteractionTypesKey = {
|
|
99
|
+
[Category in keyof typeof interactionTypes]: `${Category & string}.${keyof (typeof interactionTypes)[Category] & string}`;
|
|
100
|
+
}[keyof typeof interactionTypes];
|
|
101
|
+
/**
|
|
102
|
+
* Each interactions types according to the product types
|
|
103
|
+
*/
|
|
104
|
+
declare const interactionTypes: {
|
|
105
|
+
readonly press: {
|
|
106
|
+
readonly openArticle: "0xc0a24ffb";
|
|
107
|
+
readonly readArticle: "0xd5bd0fbe";
|
|
108
|
+
};
|
|
109
|
+
readonly dapp: {
|
|
110
|
+
readonly proofVerifiableStorageUpdate: "0x2ab2aeef";
|
|
111
|
+
readonly callableVerifiableStorageUpdate: "0xa07da986";
|
|
112
|
+
};
|
|
113
|
+
readonly webshop: {
|
|
114
|
+
readonly open: "0xb311798f";
|
|
115
|
+
};
|
|
116
|
+
readonly referral: {
|
|
117
|
+
readonly referred: "0x010cc3b9";
|
|
118
|
+
readonly createLink: "0xb2c0f17c";
|
|
119
|
+
};
|
|
120
|
+
readonly purchase: {
|
|
121
|
+
readonly started: "0xd87e90c3";
|
|
122
|
+
readonly completed: "0x8403aeb4";
|
|
123
|
+
readonly unsafeCompleted: "0x4d5b14e0";
|
|
124
|
+
};
|
|
125
|
+
readonly retail: {
|
|
126
|
+
readonly customerMeeting: "0x74489004";
|
|
127
|
+
};
|
|
128
|
+
};
|
|
70
129
|
|
|
71
130
|
/**
|
|
72
131
|
* SSO Metadata
|
|
@@ -80,23 +139,6 @@ type SsoMetadata = {
|
|
|
80
139
|
* Link to your homepage, if referenced your app name will contain a link on the sso page
|
|
81
140
|
*/
|
|
82
141
|
homepageLink?: string;
|
|
83
|
-
/**
|
|
84
|
-
* A few links that will be displayed in the footer
|
|
85
|
-
*/
|
|
86
|
-
links?: {
|
|
87
|
-
/**
|
|
88
|
-
* URL to your confidentiality page
|
|
89
|
-
*/
|
|
90
|
-
confidentialityLink?: string;
|
|
91
|
-
/**
|
|
92
|
-
* URL to your help page
|
|
93
|
-
*/
|
|
94
|
-
helpLink?: string;
|
|
95
|
-
/**
|
|
96
|
-
* URL to your CGU page
|
|
97
|
-
*/
|
|
98
|
-
cguLink?: string;
|
|
99
|
-
};
|
|
100
142
|
};
|
|
101
143
|
/**
|
|
102
144
|
* Params to start a SSO
|
|
@@ -327,6 +369,7 @@ type ModalRpcMetadata = {
|
|
|
327
369
|
};
|
|
328
370
|
context?: string;
|
|
329
371
|
lang?: "en" | "fr";
|
|
372
|
+
targetInteraction?: FullInteractionTypesKey;
|
|
330
373
|
} & ({
|
|
331
374
|
isDismissible: true;
|
|
332
375
|
dismissActionTxt?: string;
|
|
@@ -344,6 +387,116 @@ type DisplayModalParamsType<T extends ModalStepTypes[]> = {
|
|
|
344
387
|
metadata?: ModalRpcMetadata;
|
|
345
388
|
};
|
|
346
389
|
|
|
390
|
+
/**
|
|
391
|
+
* The different type of action we can have on the embeded view (once the user is logged in)
|
|
392
|
+
*
|
|
393
|
+
* @group Embeded wallet
|
|
394
|
+
*/
|
|
395
|
+
type EmbededViewAction = {
|
|
396
|
+
key: "sharing";
|
|
397
|
+
/**
|
|
398
|
+
* Some sharing options
|
|
399
|
+
*/
|
|
400
|
+
options?: {
|
|
401
|
+
/**
|
|
402
|
+
* The title that will be displayed on the system popup once the system sharing window is open
|
|
403
|
+
*/
|
|
404
|
+
popupTitle?: string;
|
|
405
|
+
/**
|
|
406
|
+
* The text that will be shared alongside the link.
|
|
407
|
+
* Can contain the variable {LINK} to specify where the link is placed, otherwise it will be added at the end
|
|
408
|
+
*/
|
|
409
|
+
text?: string;
|
|
410
|
+
/**
|
|
411
|
+
* The link to be shared (will be suffixed with the Frak sharing context)
|
|
412
|
+
*/
|
|
413
|
+
link?: string;
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* Some configuration options for the embeded view
|
|
418
|
+
*
|
|
419
|
+
* @group Embeded wallet
|
|
420
|
+
*/
|
|
421
|
+
type LoggedInEmbededView = {
|
|
422
|
+
/**
|
|
423
|
+
* The main action to display on the logged in embeded view
|
|
424
|
+
* If none specified, the user will see his wallet with the activation button
|
|
425
|
+
*/
|
|
426
|
+
action?: EmbededViewAction;
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* The view when a user is logged out
|
|
431
|
+
* @group Embeded wallet
|
|
432
|
+
*/
|
|
433
|
+
type LoggedOutEmbededView = {
|
|
434
|
+
/**
|
|
435
|
+
* Metadata option when displaying the embeded view
|
|
436
|
+
*/
|
|
437
|
+
metadata?: {
|
|
438
|
+
/**
|
|
439
|
+
* The main CTA for the logged out view
|
|
440
|
+
* - can include some variable, available ones are:
|
|
441
|
+
* - {REWARD} -> The maximum reward a user can receive when itneracting on your website
|
|
442
|
+
* - can be formatted in markdown
|
|
443
|
+
*
|
|
444
|
+
* If not sert, it will default to a internalised message
|
|
445
|
+
*/
|
|
446
|
+
text?: string;
|
|
447
|
+
/**
|
|
448
|
+
* The text that will be displayed on the login button
|
|
449
|
+
*
|
|
450
|
+
* If not set, it will default to a internalised message
|
|
451
|
+
*/
|
|
452
|
+
buttonText?: string;
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* The params used to display the embeded wallet
|
|
458
|
+
*
|
|
459
|
+
* @group Embeded wallet
|
|
460
|
+
*/
|
|
461
|
+
type DisplayEmbededWalletParamsType = {
|
|
462
|
+
/**
|
|
463
|
+
* The embeded view to display once the user is logged in
|
|
464
|
+
*/
|
|
465
|
+
loggedIn?: LoggedInEmbededView;
|
|
466
|
+
/**
|
|
467
|
+
* The embeded view to display once the user is logged out
|
|
468
|
+
*/
|
|
469
|
+
loggedOut?: LoggedOutEmbededView;
|
|
470
|
+
/**
|
|
471
|
+
* Some metadata to customise the embeded view
|
|
472
|
+
*/
|
|
473
|
+
metadata?: {
|
|
474
|
+
/**
|
|
475
|
+
* Language of the embeded wallet
|
|
476
|
+
* If undefined, will default to the browser language
|
|
477
|
+
*/
|
|
478
|
+
lang?: "fr" | "en";
|
|
479
|
+
/**
|
|
480
|
+
* The logo to display on the embeded wallet
|
|
481
|
+
* If undefined, will default to no logo displayed
|
|
482
|
+
*/
|
|
483
|
+
logo?: string;
|
|
484
|
+
/**
|
|
485
|
+
* Link to the homepage of the calling website
|
|
486
|
+
* If unedfined, will default to the domain of the calling website
|
|
487
|
+
*/
|
|
488
|
+
homepageLink?: string;
|
|
489
|
+
/**
|
|
490
|
+
* The target interaction behind this modal
|
|
491
|
+
*/
|
|
492
|
+
targetInteraction?: FullInteractionTypesKey;
|
|
493
|
+
/**
|
|
494
|
+
* The position of the component
|
|
495
|
+
*/
|
|
496
|
+
position?: "left" | "right";
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
|
|
347
500
|
/**
|
|
348
501
|
* The keys for each product types
|
|
349
502
|
* @inline
|
|
@@ -392,9 +545,27 @@ type GetProductInformationReturnType = {
|
|
|
392
545
|
productTypes: ProductTypesKey[];
|
|
393
546
|
};
|
|
394
547
|
/**
|
|
395
|
-
*
|
|
548
|
+
* The max potential reward in EUR for the given product
|
|
396
549
|
*/
|
|
397
550
|
estimatedEurReward?: string;
|
|
551
|
+
/**
|
|
552
|
+
* List of all the potentials reward arround this product
|
|
553
|
+
*/
|
|
554
|
+
rewards: {
|
|
555
|
+
token: Address;
|
|
556
|
+
campaign: Address;
|
|
557
|
+
interactionTypeKey: FullInteractionTypesKey;
|
|
558
|
+
referrer: {
|
|
559
|
+
amount: number;
|
|
560
|
+
eurAmount: number;
|
|
561
|
+
usdAmount: number;
|
|
562
|
+
};
|
|
563
|
+
referee: {
|
|
564
|
+
amount: number;
|
|
565
|
+
eurAmount: number;
|
|
566
|
+
usdAmount: number;
|
|
567
|
+
};
|
|
568
|
+
}[];
|
|
398
569
|
};
|
|
399
570
|
|
|
400
571
|
/**
|
|
@@ -455,6 +626,10 @@ type WalletNotConnected = {
|
|
|
455
626
|
* ### frak_getProductInformation
|
|
456
627
|
* - Params: None
|
|
457
628
|
* - Returns: {@link GetProductInformationReturnType}
|
|
629
|
+
*
|
|
630
|
+
* ### frak_displayEmbededWallet
|
|
631
|
+
* - Params: [{@link DisplayEmbededWalletParamsType}]
|
|
632
|
+
* - Returns: undefined
|
|
458
633
|
*/
|
|
459
634
|
type IFrameRpcSchema = [
|
|
460
635
|
/**
|
|
@@ -466,7 +641,7 @@ type IFrameRpcSchema = [
|
|
|
466
641
|
ReturnType: WalletStatusReturnType;
|
|
467
642
|
},
|
|
468
643
|
/**
|
|
469
|
-
* Method to
|
|
644
|
+
* Method to display a modal with the provided steps
|
|
470
645
|
*/
|
|
471
646
|
{
|
|
472
647
|
Method: "frak_displayModal";
|
|
@@ -512,6 +687,14 @@ type IFrameRpcSchema = [
|
|
|
512
687
|
Method: "frak_getProductInformation";
|
|
513
688
|
Parameters?: undefined;
|
|
514
689
|
ReturnType: GetProductInformationReturnType;
|
|
690
|
+
},
|
|
691
|
+
/**
|
|
692
|
+
* Method to show the embeded wallet, with potential customisation
|
|
693
|
+
*/
|
|
694
|
+
{
|
|
695
|
+
Method: "frak_displayEmbededWallet";
|
|
696
|
+
Parameters: [DisplayEmbededWalletParamsType, name: string];
|
|
697
|
+
ReturnType: undefined;
|
|
515
698
|
}
|
|
516
699
|
];
|
|
517
700
|
|
|
@@ -613,6 +796,9 @@ type IFrameRpcEvent = {
|
|
|
613
796
|
*/
|
|
614
797
|
type FrakClient = {
|
|
615
798
|
config: FrakWalletSdkConfig;
|
|
799
|
+
debugInfo: {
|
|
800
|
+
formatDebugInfo: (error: Error | unknown | string) => string;
|
|
801
|
+
};
|
|
616
802
|
} & IFrameTransport;
|
|
617
803
|
|
|
618
804
|
/**
|
|
@@ -624,4 +810,4 @@ type FrakContext = {
|
|
|
624
810
|
r: Address;
|
|
625
811
|
};
|
|
626
812
|
|
|
627
|
-
export { type ClientLifecycleEvent as C, type
|
|
813
|
+
export { type IFrameRpcEvent as A, type IFrameLifecycleEvent as B, type ClientLifecycleEvent as C, type DisplayEmbededWalletParamsType as D, type EmbededViewAction as E, type FrakWalletSdkConfig as F, type GetProductInformationReturnType as G, type ExtractedParametersFromRpc as H, type IFrameEvent as I, type ExtractedReturnTypeFromRpc as J, type LoggedOutEmbededView as L, type ModalStepTypes as M, type OpenSsoParamsType as O, type ProductTypesKey as P, type RpcResponse as R, type SsoMetadata as S, type WalletStatusReturnType as W, type FrakClient as a, type FrakContext as b, productTypesMask as c, type InteractionTypesKey as d, type FullInteractionTypesKey as e, type IFrameRpcSchema as f, type LoggedInEmbededView as g, type ModalRpcMetadata as h, interactionTypes as i, type DisplayModalParamsType as j, type ModalRpcStepsInput as k, type ModalRpcStepsResultType as l, type ModalStepMetadata as m, type LoginModalStepType as n, type SiweAuthenticateModalStepType as o, productTypes as p, type SiweAuthenticationParams as q, type SiweAuthenticateReturnType as r, type SendTransactionTxType as s, type SendTransactionModalStepType as t, type SendTransactionReturnType as u, type OpenInteractionSessionReturnType as v, type OpenInteractionSessionModalStepType as w, type FinalModalStepType as x, type FinalActionType as y, type IFrameTransport as z };
|