@frak-labs/core-sdk 0.0.2 → 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-QZL2KCSB.js → chunk-GDH3M5ZC.js} +7 -9
- package/dist/{chunk-NJJQPEEL.cjs → chunk-IVQL5N55.cjs} +62 -67
- package/dist/{chunk-PR3T7O5I.cjs → chunk-PO6YSB4Q.cjs} +15 -10
- package/dist/{chunk-VAINYZSV.js → chunk-RMOFMRZR.js} +48 -39
- package/dist/{chunk-K5SAPMC2.js → chunk-XDZMP74U.js} +37 -56
- package/dist/chunk-ZDGHKI3S.cjs +155 -0
- package/dist/{context-GkNATUkF.d.cts → context-C7RkT8hA.d.cts} +206 -23
- package/dist/{context-B0trlYGx.d.ts → context-CJ5ByAXa.d.ts} +206 -23
- package/dist/index.cjs +238 -68
- package/dist/index.d.cts +49 -63
- package/dist/index.d.ts +49 -63
- package/dist/index.js +164 -52
- package/dist/interactions/index.cjs +26 -13
- package/dist/interactions/index.d.cts +35 -1
- package/dist/interactions/index.d.ts +35 -1
- package/dist/interactions/index.js +1 -13
- package/package.json +14 -5
- package/dist/chunk-RAPLRHQ4.cjs +0 -140
|
@@ -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
|
|
@@ -356,6 +505,7 @@ declare const productTypes: {
|
|
|
356
505
|
dapp: number;
|
|
357
506
|
press: number;
|
|
358
507
|
webshop: number;
|
|
508
|
+
retail: number;
|
|
359
509
|
referral: number;
|
|
360
510
|
purchase: number;
|
|
361
511
|
};
|
|
@@ -391,9 +541,27 @@ type GetProductInformationReturnType = {
|
|
|
391
541
|
productTypes: ProductTypesKey[];
|
|
392
542
|
};
|
|
393
543
|
/**
|
|
394
|
-
*
|
|
544
|
+
* The max potential reward in EUR for the given product
|
|
395
545
|
*/
|
|
396
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
|
+
}[];
|
|
397
565
|
};
|
|
398
566
|
|
|
399
567
|
/**
|
|
@@ -454,6 +622,10 @@ type WalletNotConnected = {
|
|
|
454
622
|
* ### frak_getProductInformation
|
|
455
623
|
* - Params: None
|
|
456
624
|
* - Returns: {@link GetProductInformationReturnType}
|
|
625
|
+
*
|
|
626
|
+
* ### frak_displayEmbededWallet
|
|
627
|
+
* - Params: [{@link DisplayEmbededWalletParamsType}]
|
|
628
|
+
* - Returns: undefined
|
|
457
629
|
*/
|
|
458
630
|
type IFrameRpcSchema = [
|
|
459
631
|
/**
|
|
@@ -465,7 +637,7 @@ type IFrameRpcSchema = [
|
|
|
465
637
|
ReturnType: WalletStatusReturnType;
|
|
466
638
|
},
|
|
467
639
|
/**
|
|
468
|
-
* Method to
|
|
640
|
+
* Method to display a modal with the provided steps
|
|
469
641
|
*/
|
|
470
642
|
{
|
|
471
643
|
Method: "frak_displayModal";
|
|
@@ -511,6 +683,14 @@ type IFrameRpcSchema = [
|
|
|
511
683
|
Method: "frak_getProductInformation";
|
|
512
684
|
Parameters?: undefined;
|
|
513
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;
|
|
514
694
|
}
|
|
515
695
|
];
|
|
516
696
|
|
|
@@ -612,6 +792,9 @@ type IFrameRpcEvent = {
|
|
|
612
792
|
*/
|
|
613
793
|
type FrakClient = {
|
|
614
794
|
config: FrakWalletSdkConfig;
|
|
795
|
+
debugInfo: {
|
|
796
|
+
formatDebugInfo: (error: Error | unknown | string) => string;
|
|
797
|
+
};
|
|
615
798
|
} & IFrameTransport;
|
|
616
799
|
|
|
617
800
|
/**
|
|
@@ -623,4 +806,4 @@ type FrakContext = {
|
|
|
623
806
|
r: Address;
|
|
624
807
|
};
|
|
625
808
|
|
|
626
|
-
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
|
|
@@ -356,6 +505,7 @@ declare const productTypes: {
|
|
|
356
505
|
dapp: number;
|
|
357
506
|
press: number;
|
|
358
507
|
webshop: number;
|
|
508
|
+
retail: number;
|
|
359
509
|
referral: number;
|
|
360
510
|
purchase: number;
|
|
361
511
|
};
|
|
@@ -391,9 +541,27 @@ type GetProductInformationReturnType = {
|
|
|
391
541
|
productTypes: ProductTypesKey[];
|
|
392
542
|
};
|
|
393
543
|
/**
|
|
394
|
-
*
|
|
544
|
+
* The max potential reward in EUR for the given product
|
|
395
545
|
*/
|
|
396
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
|
+
}[];
|
|
397
565
|
};
|
|
398
566
|
|
|
399
567
|
/**
|
|
@@ -454,6 +622,10 @@ type WalletNotConnected = {
|
|
|
454
622
|
* ### frak_getProductInformation
|
|
455
623
|
* - Params: None
|
|
456
624
|
* - Returns: {@link GetProductInformationReturnType}
|
|
625
|
+
*
|
|
626
|
+
* ### frak_displayEmbededWallet
|
|
627
|
+
* - Params: [{@link DisplayEmbededWalletParamsType}]
|
|
628
|
+
* - Returns: undefined
|
|
457
629
|
*/
|
|
458
630
|
type IFrameRpcSchema = [
|
|
459
631
|
/**
|
|
@@ -465,7 +637,7 @@ type IFrameRpcSchema = [
|
|
|
465
637
|
ReturnType: WalletStatusReturnType;
|
|
466
638
|
},
|
|
467
639
|
/**
|
|
468
|
-
* Method to
|
|
640
|
+
* Method to display a modal with the provided steps
|
|
469
641
|
*/
|
|
470
642
|
{
|
|
471
643
|
Method: "frak_displayModal";
|
|
@@ -511,6 +683,14 @@ type IFrameRpcSchema = [
|
|
|
511
683
|
Method: "frak_getProductInformation";
|
|
512
684
|
Parameters?: undefined;
|
|
513
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;
|
|
514
694
|
}
|
|
515
695
|
];
|
|
516
696
|
|
|
@@ -612,6 +792,9 @@ type IFrameRpcEvent = {
|
|
|
612
792
|
*/
|
|
613
793
|
type FrakClient = {
|
|
614
794
|
config: FrakWalletSdkConfig;
|
|
795
|
+
debugInfo: {
|
|
796
|
+
formatDebugInfo: (error: Error | unknown | string) => string;
|
|
797
|
+
};
|
|
615
798
|
} & IFrameTransport;
|
|
616
799
|
|
|
617
800
|
/**
|
|
@@ -623,4 +806,4 @@ type FrakContext = {
|
|
|
623
806
|
r: Address;
|
|
624
807
|
};
|
|
625
808
|
|
|
626
|
-
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 };
|