@frak-labs/core-sdk 0.0.4 → 0.0.5
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 +65 -63
- package/dist/actions/index.d.cts +11 -13
- package/dist/actions/index.d.ts +11 -13
- package/dist/actions/index.js +42 -53
- package/dist/chunk-GDH3M5ZC.js +1 -8
- package/dist/{chunk-HDFNBQ4E.cjs → chunk-IVQL5N55.cjs} +62 -67
- package/dist/chunk-PO6YSB4Q.cjs +9 -9
- package/dist/chunk-RMOFMRZR.js +19 -41
- package/dist/{chunk-AFLVOY5H.js → chunk-XDZMP74U.js} +37 -56
- package/dist/chunk-ZDGHKI3S.cjs +40 -56
- package/dist/{context-BjKowynW.d.cts → context-C7RkT8hA.d.cts} +205 -23
- package/dist/{context-DjVVznrf.d.ts → context-CJ5ByAXa.d.ts} +205 -23
- package/dist/index.cjs +238 -68
- package/dist/index.d.cts +49 -67
- package/dist/index.d.ts +49 -67
- package/dist/index.js +164 -52
- package/dist/interactions/index.cjs +26 -15
- package/dist/interactions/index.js +1 -15
- package/package.json +10 -3
|
@@ -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,112 @@ 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
|
+
};
|
|
495
|
+
|
|
347
496
|
/**
|
|
348
497
|
* The keys for each product types
|
|
349
498
|
* @inline
|
|
@@ -392,9 +541,27 @@ type GetProductInformationReturnType = {
|
|
|
392
541
|
productTypes: ProductTypesKey[];
|
|
393
542
|
};
|
|
394
543
|
/**
|
|
395
|
-
*
|
|
544
|
+
* The max potential reward in EUR for the given product
|
|
396
545
|
*/
|
|
397
546
|
estimatedEurReward?: string;
|
|
547
|
+
/**
|
|
548
|
+
* List of all the potentials reward arround this product
|
|
549
|
+
*/
|
|
550
|
+
rewards: {
|
|
551
|
+
token: Address;
|
|
552
|
+
campaign: Address;
|
|
553
|
+
interactionTypeKey: FullInteractionTypesKey;
|
|
554
|
+
referrer: {
|
|
555
|
+
amount: number;
|
|
556
|
+
eurAmount: number;
|
|
557
|
+
usdAmount: number;
|
|
558
|
+
};
|
|
559
|
+
referee: {
|
|
560
|
+
amount: number;
|
|
561
|
+
eurAmount: number;
|
|
562
|
+
usdAmount: number;
|
|
563
|
+
};
|
|
564
|
+
}[];
|
|
398
565
|
};
|
|
399
566
|
|
|
400
567
|
/**
|
|
@@ -455,6 +622,10 @@ type WalletNotConnected = {
|
|
|
455
622
|
* ### frak_getProductInformation
|
|
456
623
|
* - Params: None
|
|
457
624
|
* - Returns: {@link GetProductInformationReturnType}
|
|
625
|
+
*
|
|
626
|
+
* ### frak_displayEmbededWallet
|
|
627
|
+
* - Params: [{@link DisplayEmbededWalletParamsType}]
|
|
628
|
+
* - Returns: undefined
|
|
458
629
|
*/
|
|
459
630
|
type IFrameRpcSchema = [
|
|
460
631
|
/**
|
|
@@ -466,7 +637,7 @@ type IFrameRpcSchema = [
|
|
|
466
637
|
ReturnType: WalletStatusReturnType;
|
|
467
638
|
},
|
|
468
639
|
/**
|
|
469
|
-
* Method to
|
|
640
|
+
* Method to display a modal with the provided steps
|
|
470
641
|
*/
|
|
471
642
|
{
|
|
472
643
|
Method: "frak_displayModal";
|
|
@@ -512,6 +683,14 @@ type IFrameRpcSchema = [
|
|
|
512
683
|
Method: "frak_getProductInformation";
|
|
513
684
|
Parameters?: undefined;
|
|
514
685
|
ReturnType: GetProductInformationReturnType;
|
|
686
|
+
},
|
|
687
|
+
/**
|
|
688
|
+
* Method to show the embeded wallet, with potential customisation
|
|
689
|
+
*/
|
|
690
|
+
{
|
|
691
|
+
Method: "frak_displayEmbededWallet";
|
|
692
|
+
Parameters: [DisplayEmbededWalletParamsType, name: string];
|
|
693
|
+
ReturnType: undefined;
|
|
515
694
|
}
|
|
516
695
|
];
|
|
517
696
|
|
|
@@ -613,6 +792,9 @@ type IFrameRpcEvent = {
|
|
|
613
792
|
*/
|
|
614
793
|
type FrakClient = {
|
|
615
794
|
config: FrakWalletSdkConfig;
|
|
795
|
+
debugInfo: {
|
|
796
|
+
formatDebugInfo: (error: Error | unknown | string) => string;
|
|
797
|
+
};
|
|
616
798
|
} & IFrameTransport;
|
|
617
799
|
|
|
618
800
|
/**
|
|
@@ -624,4 +806,4 @@ type FrakContext = {
|
|
|
624
806
|
r: Address;
|
|
625
807
|
};
|
|
626
808
|
|
|
627
|
-
export { type ClientLifecycleEvent as C, type
|
|
809
|
+
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,112 @@ 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
|
+
};
|
|
495
|
+
|
|
347
496
|
/**
|
|
348
497
|
* The keys for each product types
|
|
349
498
|
* @inline
|
|
@@ -392,9 +541,27 @@ type GetProductInformationReturnType = {
|
|
|
392
541
|
productTypes: ProductTypesKey[];
|
|
393
542
|
};
|
|
394
543
|
/**
|
|
395
|
-
*
|
|
544
|
+
* The max potential reward in EUR for the given product
|
|
396
545
|
*/
|
|
397
546
|
estimatedEurReward?: string;
|
|
547
|
+
/**
|
|
548
|
+
* List of all the potentials reward arround this product
|
|
549
|
+
*/
|
|
550
|
+
rewards: {
|
|
551
|
+
token: Address;
|
|
552
|
+
campaign: Address;
|
|
553
|
+
interactionTypeKey: FullInteractionTypesKey;
|
|
554
|
+
referrer: {
|
|
555
|
+
amount: number;
|
|
556
|
+
eurAmount: number;
|
|
557
|
+
usdAmount: number;
|
|
558
|
+
};
|
|
559
|
+
referee: {
|
|
560
|
+
amount: number;
|
|
561
|
+
eurAmount: number;
|
|
562
|
+
usdAmount: number;
|
|
563
|
+
};
|
|
564
|
+
}[];
|
|
398
565
|
};
|
|
399
566
|
|
|
400
567
|
/**
|
|
@@ -455,6 +622,10 @@ type WalletNotConnected = {
|
|
|
455
622
|
* ### frak_getProductInformation
|
|
456
623
|
* - Params: None
|
|
457
624
|
* - Returns: {@link GetProductInformationReturnType}
|
|
625
|
+
*
|
|
626
|
+
* ### frak_displayEmbededWallet
|
|
627
|
+
* - Params: [{@link DisplayEmbededWalletParamsType}]
|
|
628
|
+
* - Returns: undefined
|
|
458
629
|
*/
|
|
459
630
|
type IFrameRpcSchema = [
|
|
460
631
|
/**
|
|
@@ -466,7 +637,7 @@ type IFrameRpcSchema = [
|
|
|
466
637
|
ReturnType: WalletStatusReturnType;
|
|
467
638
|
},
|
|
468
639
|
/**
|
|
469
|
-
* Method to
|
|
640
|
+
* Method to display a modal with the provided steps
|
|
470
641
|
*/
|
|
471
642
|
{
|
|
472
643
|
Method: "frak_displayModal";
|
|
@@ -512,6 +683,14 @@ type IFrameRpcSchema = [
|
|
|
512
683
|
Method: "frak_getProductInformation";
|
|
513
684
|
Parameters?: undefined;
|
|
514
685
|
ReturnType: GetProductInformationReturnType;
|
|
686
|
+
},
|
|
687
|
+
/**
|
|
688
|
+
* Method to show the embeded wallet, with potential customisation
|
|
689
|
+
*/
|
|
690
|
+
{
|
|
691
|
+
Method: "frak_displayEmbededWallet";
|
|
692
|
+
Parameters: [DisplayEmbededWalletParamsType, name: string];
|
|
693
|
+
ReturnType: undefined;
|
|
515
694
|
}
|
|
516
695
|
];
|
|
517
696
|
|
|
@@ -613,6 +792,9 @@ type IFrameRpcEvent = {
|
|
|
613
792
|
*/
|
|
614
793
|
type FrakClient = {
|
|
615
794
|
config: FrakWalletSdkConfig;
|
|
795
|
+
debugInfo: {
|
|
796
|
+
formatDebugInfo: (error: Error | unknown | string) => string;
|
|
797
|
+
};
|
|
616
798
|
} & IFrameTransport;
|
|
617
799
|
|
|
618
800
|
/**
|
|
@@ -624,4 +806,4 @@ type FrakContext = {
|
|
|
624
806
|
r: Address;
|
|
625
807
|
};
|
|
626
808
|
|
|
627
|
-
export { type ClientLifecycleEvent as C, type
|
|
809
|
+
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 };
|