@frak-labs/nexus-sdk 0.0.14 → 0.0.16

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.
Files changed (50) hide show
  1. package/README.md +4 -4
  2. package/dist/FrakContext-LbQht1ep.d.cts +10 -0
  3. package/dist/FrakContext-LbQht1ep.d.ts +10 -0
  4. package/dist/bundle/bundle.js +21 -0
  5. package/dist/chunk-A3XYA7S7.cjs +114 -0
  6. package/dist/{chunk-5LZQXBFJ.js → chunk-AHUMDUJC.js} +12 -196
  7. package/dist/chunk-D77BTQYS.js +210 -0
  8. package/dist/chunk-DAGCBEBQ.cjs +243 -0
  9. package/dist/chunk-FO2GFD5C.cjs +210 -0
  10. package/dist/chunk-FYMOOHMT.js +254 -0
  11. package/dist/chunk-HY6YATLS.js +53 -0
  12. package/dist/chunk-J655X6YR.cjs +254 -0
  13. package/dist/chunk-TIKEZMSD.js +114 -0
  14. package/dist/chunk-UFJ7W6CQ.cjs +53 -0
  15. package/dist/{client-DJd7-ajw.d.ts → client-ALy_TEwJ.d.ts} +34 -11
  16. package/dist/{client-DXITs1Kf.d.cts → client-DaEox5q4.d.cts} +34 -11
  17. package/dist/core/actions/index.cjs +11 -3
  18. package/dist/core/actions/index.d.cts +28 -5
  19. package/dist/core/actions/index.d.ts +28 -5
  20. package/dist/core/actions/index.js +10 -2
  21. package/dist/core/index.cjs +15 -4
  22. package/dist/core/index.d.cts +98 -4
  23. package/dist/core/index.d.ts +98 -4
  24. package/dist/core/index.js +15 -4
  25. package/dist/core/interactions/index.cjs +3 -4
  26. package/dist/core/interactions/index.d.cts +27 -15
  27. package/dist/core/interactions/index.d.ts +27 -15
  28. package/dist/core/interactions/index.js +8 -9
  29. package/dist/{error-C4Zm5nQe.d.cts → error-Dflr3G5x.d.cts} +1 -1
  30. package/dist/{error-C4Zm5nQe.d.ts → error-Dflr3G5x.d.ts} +1 -1
  31. package/dist/react/index.cjs +79 -155
  32. package/dist/react/index.d.cts +4 -5
  33. package/dist/react/index.d.ts +4 -5
  34. package/dist/react/index.js +78 -154
  35. package/dist/{sendTransaction-fLvpfqaQ.d.ts → sendTransaction-BOd-pvXr.d.ts} +2 -2
  36. package/dist/{sendTransaction-C19oCc6X.d.cts → sendTransaction-MhdJPTWd.d.cts} +2 -2
  37. package/package.json +6 -6
  38. package/dist/chunk-22T2NHQK.js +0 -22
  39. package/dist/chunk-5SGDBU5S.cjs +0 -427
  40. package/dist/chunk-AANA3LEO.cjs +0 -22
  41. package/dist/chunk-ETV4XYOV.cjs +0 -7
  42. package/dist/chunk-IH3QWPWT.js +0 -72
  43. package/dist/chunk-PKBMQBKP.js +0 -7
  44. package/dist/chunk-PURWUKEM.cjs +0 -72
  45. package/dist/chunk-S223FMEJ.js +0 -86
  46. package/dist/chunk-UOEVM7TR.cjs +0 -86
  47. package/dist/index.cjs +0 -1
  48. package/dist/index.d.cts +0 -2
  49. package/dist/index.d.ts +0 -2
  50. package/dist/index.js +0 -0
@@ -0,0 +1,53 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
5
+ // src/core/constants/productTypes.ts
6
+ var productTypes = {
7
+ // content type
8
+ dapp: 1,
9
+ press: 2,
10
+ webshop: 3,
11
+ // feature type
12
+ referral: 30,
13
+ purchase: 31
14
+ };
15
+ var productTypesMask = Object.entries(
16
+ productTypes
17
+ ).reduce(
18
+ (acc, [key, value]) => {
19
+ acc[key] = BigInt(1) << BigInt(value);
20
+ return acc;
21
+ },
22
+ {}
23
+ );
24
+
25
+ // src/core/constants/interactionTypes.ts
26
+ var interactionTypes = {
27
+ press: {
28
+ openArticle: "0xc0a24ffb",
29
+ readArticle: "0xd5bd0fbe"
30
+ },
31
+ dapp: {
32
+ proofVerifiableStorageUpdate: "0x2ab2aeef",
33
+ callableVerifiableStorageUpdate: "0xa07da986"
34
+ },
35
+ webshop: {
36
+ open: "0xb311798f"
37
+ },
38
+ referral: {
39
+ referred: "0x010cc3b9",
40
+ createLink: "0xb2c0f17c"
41
+ },
42
+ purchase: {
43
+ started: "0xd87e90c3",
44
+ completed: "0x8403aeb4"
45
+ }
46
+ };
47
+
48
+
49
+
50
+
51
+
52
+
53
+ exports.__publicField = __publicField; exports.productTypes = productTypes; exports.productTypesMask = productTypesMask; exports.interactionTypes = interactionTypes;
@@ -21,13 +21,16 @@ type NexusWalletSdkConfig = Readonly<{
21
21
  type IFrameLifecycleEvent = {
22
22
  iframeLifecycle: "connected" | "show" | "hide";
23
23
  data?: never;
24
- } | DoBackupEvent;
24
+ } | DoBackupEvent | RemoveBackupEvent;
25
25
  type DoBackupEvent = {
26
26
  iframeLifecycle: "do-backup";
27
27
  data: {
28
28
  backup?: string;
29
29
  };
30
30
  };
31
+ type RemoveBackupEvent = {
32
+ iframeLifecycle: "remove-backup";
33
+ };
31
34
 
32
35
  /**
33
36
  * Event related to the iframe lifecycle
@@ -50,8 +53,8 @@ type RestoreBackupEvent = {
50
53
  * SSO Metadata
51
54
  */
52
55
  type SsoMetadata = {
53
- logoUrl: string;
54
- homepageLink: string;
56
+ logoUrl?: string;
57
+ homepageLink?: string;
55
58
  links?: {
56
59
  confidentialityLink?: string;
57
60
  helpLink?: string;
@@ -64,6 +67,7 @@ type SsoMetadata = {
64
67
  type OpenSsoParamsType = {
65
68
  redirectUrl?: string;
66
69
  directExit?: boolean;
70
+ lang?: "en" | "fr";
67
71
  metadata: SsoMetadata;
68
72
  };
69
73
 
@@ -122,7 +126,6 @@ type SiweAuthenticateModalStepType = GenericModalStepType<"siweAuthenticate", {
122
126
 
123
127
  /**
124
128
  * Generic format representing a tx to be sent
125
- * todo: exploit the EIP-5792 here? https://eips.ethereum.org/EIPS/eip-5792
126
129
  */
127
130
  type SendTransactionTxType = Readonly<{
128
131
  to: Address;
@@ -152,20 +155,29 @@ type OpenInteractionSessionReturnType = Readonly<{
152
155
  type OpenInteractionSessionModalStepType = GenericModalStepType<"openSession", object, OpenInteractionSessionReturnType>;
153
156
 
154
157
  /**
155
- * Generic type of modal we will display to the end user
158
+ * The final modal step type (displayed on success or dimissed)
156
159
  */
157
- type SuccessModalStepType = GenericModalStepType<"success", {
158
- sharing?: {
160
+ type FinalModalStepType = GenericModalStepType<"final", {
161
+ dismissedMetadata?: ModalStepMetadata["metadata"];
162
+ action: FinalActionType;
163
+ autoSkip?: boolean;
164
+ }, object>;
165
+ type FinalActionType = {
166
+ key: "sharing";
167
+ options?: {
159
168
  popupTitle?: string;
160
169
  text?: string;
161
170
  link?: string;
162
171
  };
163
- }, object>;
172
+ } | {
173
+ key: "reward";
174
+ options?: never;
175
+ };
164
176
 
165
177
  /**
166
178
  * Generic type of steps we will display in the modal to the end user
167
179
  */
168
- type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | OpenInteractionSessionModalStepType | SuccessModalStepType;
180
+ type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | OpenInteractionSessionModalStepType | FinalModalStepType;
169
181
  /**
170
182
  * Type for the result of a modal request
171
183
  */
@@ -191,7 +203,14 @@ type ModalRpcMetadata = Readonly<{
191
203
  icon?: string;
192
204
  };
193
205
  context?: string;
194
- }>;
206
+ lang?: "en" | "fr";
207
+ } & ({
208
+ isDismissible: true;
209
+ dismissActionTxt?: string;
210
+ } | {
211
+ isDismissible?: false;
212
+ dismissActionTxt?: never;
213
+ })>;
195
214
  /**
196
215
  * Generic params used to display modals
197
216
  */
@@ -204,6 +223,7 @@ type WalletStatusReturnType = Readonly<WalletConnected | WalletNotConnected>;
204
223
  type WalletConnected = {
205
224
  key: "connected";
206
225
  wallet: Address;
226
+ interactionToken?: string;
207
227
  interactionSession?: {
208
228
  startTimestamp: number;
209
229
  endTimestamp: number;
@@ -211,6 +231,9 @@ type WalletConnected = {
211
231
  };
212
232
  type WalletNotConnected = {
213
233
  key: "not-connected";
234
+ wallet?: never;
235
+ interactionToken?: never;
236
+ interactionSession?: never;
214
237
  };
215
238
 
216
239
  /**
@@ -357,4 +380,4 @@ type NexusClient = {
357
380
  config: NexusWalletSdkConfig;
358
381
  } & IFrameTransport;
359
382
 
360
- export type { ClientLifecycleEvent as C, DisplayModalParamsType as D, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, LoginModalStepType as L, ModalRpcMetadata as M, NexusClient as N, OpenSsoParamsType as O, RpcResponse as R, SiweAuthenticationParams as S, WalletStatusReturnType as W, SiweAuthenticateReturnType as a, SendTransactionModalStepType as b, SendTransactionReturnType as c, ModalStepTypes as d, ModalRpcStepsResultType as e, NexusWalletSdkConfig as f, SuccessModalStepType as g, SsoMetadata as h, ModalRpcStepsInput as i, ModalStepMetadata as j, SiweAuthenticateModalStepType as k, SendTransactionTxType as l, OpenInteractionSessionReturnType as m, OpenInteractionSessionModalStepType as n, IFrameTransport as o, IFrameRpcEvent as p, IFrameEvent as q, IFrameLifecycleEvent as r, ExtractedReturnTypeFromRpc as s };
383
+ export type { ClientLifecycleEvent as C, DisplayModalParamsType as D, ExtractedParametersFromRpc as E, FinalModalStepType as F, IFrameRpcSchema as I, LoginModalStepType as L, ModalStepTypes as M, NexusWalletSdkConfig as N, OpenSsoParamsType as O, RpcResponse as R, SsoMetadata as S, WalletStatusReturnType as W, NexusClient as a, ModalRpcMetadata as b, ModalRpcStepsInput as c, ModalRpcStepsResultType as d, ModalStepMetadata as e, SiweAuthenticateModalStepType as f, SiweAuthenticationParams as g, SiweAuthenticateReturnType as h, SendTransactionTxType as i, SendTransactionModalStepType as j, SendTransactionReturnType as k, OpenInteractionSessionReturnType as l, OpenInteractionSessionModalStepType as m, FinalActionType as n, IFrameTransport as o, IFrameRpcEvent as p, IFrameEvent as q, IFrameLifecycleEvent as r, ExtractedReturnTypeFromRpc as s };
@@ -21,13 +21,16 @@ type NexusWalletSdkConfig = Readonly<{
21
21
  type IFrameLifecycleEvent = {
22
22
  iframeLifecycle: "connected" | "show" | "hide";
23
23
  data?: never;
24
- } | DoBackupEvent;
24
+ } | DoBackupEvent | RemoveBackupEvent;
25
25
  type DoBackupEvent = {
26
26
  iframeLifecycle: "do-backup";
27
27
  data: {
28
28
  backup?: string;
29
29
  };
30
30
  };
31
+ type RemoveBackupEvent = {
32
+ iframeLifecycle: "remove-backup";
33
+ };
31
34
 
32
35
  /**
33
36
  * Event related to the iframe lifecycle
@@ -50,8 +53,8 @@ type RestoreBackupEvent = {
50
53
  * SSO Metadata
51
54
  */
52
55
  type SsoMetadata = {
53
- logoUrl: string;
54
- homepageLink: string;
56
+ logoUrl?: string;
57
+ homepageLink?: string;
55
58
  links?: {
56
59
  confidentialityLink?: string;
57
60
  helpLink?: string;
@@ -64,6 +67,7 @@ type SsoMetadata = {
64
67
  type OpenSsoParamsType = {
65
68
  redirectUrl?: string;
66
69
  directExit?: boolean;
70
+ lang?: "en" | "fr";
67
71
  metadata: SsoMetadata;
68
72
  };
69
73
 
@@ -122,7 +126,6 @@ type SiweAuthenticateModalStepType = GenericModalStepType<"siweAuthenticate", {
122
126
 
123
127
  /**
124
128
  * Generic format representing a tx to be sent
125
- * todo: exploit the EIP-5792 here? https://eips.ethereum.org/EIPS/eip-5792
126
129
  */
127
130
  type SendTransactionTxType = Readonly<{
128
131
  to: Address;
@@ -152,20 +155,29 @@ type OpenInteractionSessionReturnType = Readonly<{
152
155
  type OpenInteractionSessionModalStepType = GenericModalStepType<"openSession", object, OpenInteractionSessionReturnType>;
153
156
 
154
157
  /**
155
- * Generic type of modal we will display to the end user
158
+ * The final modal step type (displayed on success or dimissed)
156
159
  */
157
- type SuccessModalStepType = GenericModalStepType<"success", {
158
- sharing?: {
160
+ type FinalModalStepType = GenericModalStepType<"final", {
161
+ dismissedMetadata?: ModalStepMetadata["metadata"];
162
+ action: FinalActionType;
163
+ autoSkip?: boolean;
164
+ }, object>;
165
+ type FinalActionType = {
166
+ key: "sharing";
167
+ options?: {
159
168
  popupTitle?: string;
160
169
  text?: string;
161
170
  link?: string;
162
171
  };
163
- }, object>;
172
+ } | {
173
+ key: "reward";
174
+ options?: never;
175
+ };
164
176
 
165
177
  /**
166
178
  * Generic type of steps we will display in the modal to the end user
167
179
  */
168
- type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | OpenInteractionSessionModalStepType | SuccessModalStepType;
180
+ type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | OpenInteractionSessionModalStepType | FinalModalStepType;
169
181
  /**
170
182
  * Type for the result of a modal request
171
183
  */
@@ -191,7 +203,14 @@ type ModalRpcMetadata = Readonly<{
191
203
  icon?: string;
192
204
  };
193
205
  context?: string;
194
- }>;
206
+ lang?: "en" | "fr";
207
+ } & ({
208
+ isDismissible: true;
209
+ dismissActionTxt?: string;
210
+ } | {
211
+ isDismissible?: false;
212
+ dismissActionTxt?: never;
213
+ })>;
195
214
  /**
196
215
  * Generic params used to display modals
197
216
  */
@@ -204,6 +223,7 @@ type WalletStatusReturnType = Readonly<WalletConnected | WalletNotConnected>;
204
223
  type WalletConnected = {
205
224
  key: "connected";
206
225
  wallet: Address;
226
+ interactionToken?: string;
207
227
  interactionSession?: {
208
228
  startTimestamp: number;
209
229
  endTimestamp: number;
@@ -211,6 +231,9 @@ type WalletConnected = {
211
231
  };
212
232
  type WalletNotConnected = {
213
233
  key: "not-connected";
234
+ wallet?: never;
235
+ interactionToken?: never;
236
+ interactionSession?: never;
214
237
  };
215
238
 
216
239
  /**
@@ -357,4 +380,4 @@ type NexusClient = {
357
380
  config: NexusWalletSdkConfig;
358
381
  } & IFrameTransport;
359
382
 
360
- export type { ClientLifecycleEvent as C, DisplayModalParamsType as D, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, LoginModalStepType as L, ModalRpcMetadata as M, NexusClient as N, OpenSsoParamsType as O, RpcResponse as R, SiweAuthenticationParams as S, WalletStatusReturnType as W, SiweAuthenticateReturnType as a, SendTransactionModalStepType as b, SendTransactionReturnType as c, ModalStepTypes as d, ModalRpcStepsResultType as e, NexusWalletSdkConfig as f, SuccessModalStepType as g, SsoMetadata as h, ModalRpcStepsInput as i, ModalStepMetadata as j, SiweAuthenticateModalStepType as k, SendTransactionTxType as l, OpenInteractionSessionReturnType as m, OpenInteractionSessionModalStepType as n, IFrameTransport as o, IFrameRpcEvent as p, IFrameEvent as q, IFrameLifecycleEvent as r, ExtractedReturnTypeFromRpc as s };
383
+ export type { ClientLifecycleEvent as C, DisplayModalParamsType as D, ExtractedParametersFromRpc as E, FinalModalStepType as F, IFrameRpcSchema as I, LoginModalStepType as L, ModalStepTypes as M, NexusWalletSdkConfig as N, OpenSsoParamsType as O, RpcResponse as R, SsoMetadata as S, WalletStatusReturnType as W, NexusClient as a, ModalRpcMetadata as b, ModalRpcStepsInput as c, ModalRpcStepsResultType as d, ModalStepMetadata as e, SiweAuthenticateModalStepType as f, SiweAuthenticationParams as g, SiweAuthenticateReturnType as h, SendTransactionTxType as i, SendTransactionModalStepType as j, SendTransactionReturnType as k, OpenInteractionSessionReturnType as l, OpenInteractionSessionModalStepType as m, FinalActionType as n, IFrameTransport as o, IFrameRpcEvent as p, IFrameEvent as q, IFrameLifecycleEvent as r, ExtractedReturnTypeFromRpc as s };
@@ -5,13 +5,21 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkUOEVM7TRcjs = require('../../chunk-UOEVM7TR.cjs');
9
- require('../../chunk-ETV4XYOV.cjs');
10
8
 
11
9
 
12
10
 
11
+ var _chunkFO2GFD5Ccjs = require('../../chunk-FO2GFD5C.cjs');
12
+ require('../../chunk-J655X6YR.cjs');
13
+ require('../../chunk-A3XYA7S7.cjs');
14
+ require('../../chunk-UFJ7W6CQ.cjs');
13
15
 
14
16
 
15
17
 
16
18
 
17
- exports.displayModal = _chunkUOEVM7TRcjs.displayModal; exports.openSso = _chunkUOEVM7TRcjs.openSso; exports.sendInteraction = _chunkUOEVM7TRcjs.sendInteraction; exports.sendTransaction = _chunkUOEVM7TRcjs.sendTransaction; exports.siweAuthenticate = _chunkUOEVM7TRcjs.siweAuthenticate; exports.watchWalletStatus = _chunkUOEVM7TRcjs.watchWalletStatus;
19
+
20
+
21
+
22
+
23
+
24
+
25
+ exports.displayModal = _chunkFO2GFD5Ccjs.displayModal; exports.openSso = _chunkFO2GFD5Ccjs.openSso; exports.processReferral = _chunkFO2GFD5Ccjs.processReferral; exports.referralInteraction = _chunkFO2GFD5Ccjs.referralInteraction; exports.sendInteraction = _chunkFO2GFD5Ccjs.sendInteraction; exports.sendTransaction = _chunkFO2GFD5Ccjs.sendTransaction; exports.siweAuthenticate = _chunkFO2GFD5Ccjs.siweAuthenticate; exports.walletStatus = _chunkFO2GFD5Ccjs.walletStatus; exports.watchWalletStatus = _chunkFO2GFD5Ccjs.watchWalletStatus;
@@ -1,7 +1,8 @@
1
- import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-DXITs1Kf.cjs';
1
+ import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-DaEox5q4.cjs';
2
2
  import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.cjs';
3
- export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-C19oCc6X.cjs';
4
- import 'viem';
3
+ export { S as SendTransactionParams, a as SiweAuthenticateModalParams, b as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-MhdJPTWd.cjs';
4
+ import { Hex } from 'viem';
5
+ import { F as FrakContext } from '../../FrakContext-LbQht1ep.cjs';
5
6
  import 'viem/chains';
6
7
  import 'viem/siwe';
7
8
 
@@ -30,10 +31,32 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
30
31
 
31
32
  /**
32
33
  * Function used to open the SSO
33
- * todo: We are using the iframe here, since we need to send potentially load of datas, and it couldn't fit inside the query params of an url
34
34
  * @param client
35
35
  * @param args
36
36
  */
37
37
  declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<void>;
38
38
 
39
- export { displayModal, openSso, sendInteraction, watchWalletStatus };
39
+ declare function walletStatus(client: NexusClient, callback?: (status: WalletStatusReturnType) => void): Promise<WalletStatusReturnType>;
40
+
41
+ declare function referralInteraction(client: NexusClient, { productId, modalConfig, }?: {
42
+ productId?: Hex;
43
+ modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
44
+ }): Promise<unknown>;
45
+
46
+ type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-session" | "error" | "no-referrer" | "self-referral";
47
+ /**
48
+ * Automatically submit a referral interaction when detected
49
+ * -> And automatically set the referral context in the url
50
+ * @param walletStatus
51
+ * @param frakContext
52
+ * @param modalConfig
53
+ * @param productId
54
+ */
55
+ declare function processReferral(client: NexusClient, { walletStatus, frakContext, modalConfig, productId, }: {
56
+ walletStatus?: WalletStatusReturnType;
57
+ frakContext?: Partial<FrakContext> | null;
58
+ modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
59
+ productId?: Hex;
60
+ }): Promise<ReferralState>;
61
+
62
+ export { displayModal, openSso, processReferral, referralInteraction, sendInteraction, walletStatus, watchWalletStatus };
@@ -1,7 +1,8 @@
1
- import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-DJd7-ajw.js';
1
+ import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-ALy_TEwJ.js';
2
2
  import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.js';
3
- export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-fLvpfqaQ.js';
4
- import 'viem';
3
+ export { S as SendTransactionParams, a as SiweAuthenticateModalParams, b as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-BOd-pvXr.js';
4
+ import { Hex } from 'viem';
5
+ import { F as FrakContext } from '../../FrakContext-LbQht1ep.js';
5
6
  import 'viem/chains';
6
7
  import 'viem/siwe';
7
8
 
@@ -30,10 +31,32 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
30
31
 
31
32
  /**
32
33
  * Function used to open the SSO
33
- * todo: We are using the iframe here, since we need to send potentially load of datas, and it couldn't fit inside the query params of an url
34
34
  * @param client
35
35
  * @param args
36
36
  */
37
37
  declare function openSso(client: NexusClient, args: OpenSsoParamsType): Promise<void>;
38
38
 
39
- export { displayModal, openSso, sendInteraction, watchWalletStatus };
39
+ declare function walletStatus(client: NexusClient, callback?: (status: WalletStatusReturnType) => void): Promise<WalletStatusReturnType>;
40
+
41
+ declare function referralInteraction(client: NexusClient, { productId, modalConfig, }?: {
42
+ productId?: Hex;
43
+ modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
44
+ }): Promise<unknown>;
45
+
46
+ type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-session" | "error" | "no-referrer" | "self-referral";
47
+ /**
48
+ * Automatically submit a referral interaction when detected
49
+ * -> And automatically set the referral context in the url
50
+ * @param walletStatus
51
+ * @param frakContext
52
+ * @param modalConfig
53
+ * @param productId
54
+ */
55
+ declare function processReferral(client: NexusClient, { walletStatus, frakContext, modalConfig, productId, }: {
56
+ walletStatus?: WalletStatusReturnType;
57
+ frakContext?: Partial<FrakContext> | null;
58
+ modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
59
+ productId?: Hex;
60
+ }): Promise<ReferralState>;
61
+
62
+ export { displayModal, openSso, processReferral, referralInteraction, sendInteraction, walletStatus, watchWalletStatus };
@@ -1,17 +1,25 @@
1
1
  import {
2
2
  displayModal,
3
3
  openSso,
4
+ processReferral,
5
+ referralInteraction,
4
6
  sendInteraction,
5
7
  sendTransaction,
6
8
  siweAuthenticate,
9
+ walletStatus,
7
10
  watchWalletStatus
8
- } from "../../chunk-S223FMEJ.js";
9
- import "../../chunk-PKBMQBKP.js";
11
+ } from "../../chunk-D77BTQYS.js";
12
+ import "../../chunk-FYMOOHMT.js";
13
+ import "../../chunk-TIKEZMSD.js";
14
+ import "../../chunk-HY6YATLS.js";
10
15
  export {
11
16
  displayModal,
12
17
  openSso,
18
+ processReferral,
19
+ referralInteraction,
13
20
  sendInteraction,
14
21
  sendTransaction,
15
22
  siweAuthenticate,
23
+ walletStatus,
16
24
  watchWalletStatus
17
25
  };
@@ -1,23 +1,34 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
+ var _chunkDAGCBEBQcjs = require('../chunk-DAGCBEBQ.cjs');
3
4
 
4
5
 
5
6
 
6
7
 
7
8
 
8
- var _chunk5SGDBU5Scjs = require('../chunk-5SGDBU5S.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunkAANA3LEOcjs = require('../chunk-AANA3LEO.cjs');
13
- require('../chunk-ETV4XYOV.cjs');
14
12
 
15
13
 
14
+ var _chunkJ655X6YRcjs = require('../chunk-J655X6YR.cjs');
16
15
 
17
16
 
18
17
 
19
18
 
19
+ var _chunkUFJ7W6CQcjs = require('../chunk-UFJ7W6CQ.cjs');
20
20
 
21
21
 
22
22
 
23
- exports.FrakRpcError = _chunk5SGDBU5Scjs.FrakRpcError; exports.RpcErrorCodes = _chunk5SGDBU5Scjs.RpcErrorCodes; exports.createIFrameNexusClient = _chunk5SGDBU5Scjs.createIFrameNexusClient; exports.createIframe = _chunk5SGDBU5Scjs.createIframe; exports.decompressDataAndCheckHash = _chunk5SGDBU5Scjs.decompressDataAndCheckHash; exports.hashAndCompressData = _chunk5SGDBU5Scjs.hashAndCompressData; exports.productTypes = _chunkAANA3LEOcjs.productTypes; exports.productTypesMask = _chunkAANA3LEOcjs.productTypesMask;
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+ exports.Deferred = _chunkJ655X6YRcjs.Deferred; exports.FrakContextManager = _chunkJ655X6YRcjs.FrakContextManager; exports.FrakRpcError = _chunkJ655X6YRcjs.FrakRpcError; exports.RpcErrorCodes = _chunkJ655X6YRcjs.RpcErrorCodes; exports.compressJson = _chunkJ655X6YRcjs.compressJson; exports.createIFrameNexusClient = _chunkDAGCBEBQcjs.createIFrameNexusClient; exports.createIframe = _chunkJ655X6YRcjs.createIframe; exports.decompressDataAndCheckHash = _chunkJ655X6YRcjs.decompressDataAndCheckHash; exports.decompressJson = _chunkJ655X6YRcjs.decompressJson; exports.hashAndCompressData = _chunkJ655X6YRcjs.hashAndCompressData; exports.interactionTypes = _chunkUFJ7W6CQcjs.interactionTypes; exports.productTypes = _chunkUFJ7W6CQcjs.productTypes; exports.productTypesMask = _chunkUFJ7W6CQcjs.productTypesMask;
@@ -1,7 +1,9 @@
1
- import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-DXITs1Kf.cjs';
2
- export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, s as ExtractedReturnTypeFromRpc, q as IFrameEvent, r as IFrameLifecycleEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, M as ModalRpcMetadata, i as ModalRpcStepsInput, e as ModalRpcStepsResultType, j as ModalStepMetadata, d as ModalStepTypes, n as OpenInteractionSessionModalStepType, m as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, b as SendTransactionModalStepType, c as SendTransactionReturnType, l as SendTransactionTxType, k as SiweAuthenticateModalStepType, a as SiweAuthenticateReturnType, S as SiweAuthenticationParams, h as SsoMetadata, g as SuccessModalStepType, W as WalletStatusReturnType } from '../client-DXITs1Kf.cjs';
1
+ import { N as NexusWalletSdkConfig, a as NexusClient } from '../client-DaEox5q4.cjs';
2
+ export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, s as ExtractedReturnTypeFromRpc, n as FinalActionType, F as FinalModalStepType, q as IFrameEvent, r as IFrameLifecycleEvent, p as IFrameRpcEvent, I as IFrameRpcSchema, o as IFrameTransport, L as LoginModalStepType, b as ModalRpcMetadata, c as ModalRpcStepsInput, d as ModalRpcStepsResultType, e as ModalStepMetadata, M as ModalStepTypes, m as OpenInteractionSessionModalStepType, l as OpenInteractionSessionReturnType, O as OpenSsoParamsType, R as RpcResponse, j as SendTransactionModalStepType, k as SendTransactionReturnType, i as SendTransactionTxType, f as SiweAuthenticateModalStepType, h as SiweAuthenticateReturnType, g as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType } from '../client-DaEox5q4.cjs';
3
+ import { Address } from '../abi.js';
4
+ import { F as FrakContext } from '../FrakContext-LbQht1ep.cjs';
3
5
  export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.cjs';
4
- export { F as FrakRpcError, R as RpcErrorCodes } from '../error-C4Zm5nQe.cjs';
6
+ export { F as FrakRpcError, R as RpcErrorCodes } from '../error-Dflr3G5x.cjs';
5
7
  import 'viem';
6
8
  import 'viem/chains';
7
9
  import 'viem/siwe';
@@ -46,12 +48,71 @@ declare function createIframe({ walletBaseUrl, }: {
46
48
  * @param data The params to encode
47
49
  */
48
50
  declare function hashAndCompressData<T>(data: T): Promise<CompressedData>;
51
+ /**
52
+ * Compress json data
53
+ * @param data
54
+ */
55
+ declare function compressJson(data: unknown): Promise<string>;
49
56
 
50
57
  /**
51
58
  * Decompress the given string
52
59
  * @param compressedData The params to encode
53
60
  */
54
61
  declare function decompressDataAndCheckHash<T>(compressedData: CompressedData): Promise<HashProtectedData<T>>;
62
+ /**
63
+ * Decompress json data
64
+ * @param data
65
+ */
66
+ declare function decompressJson<T>(data: string): Promise<T | null>;
67
+
68
+ /**
69
+ * Parse the current Nexus context in the given url
70
+ * @param url
71
+ */
72
+ declare function parse({ url }: {
73
+ url: string;
74
+ }): Promise<Readonly<{
75
+ r: Address;
76
+ }> | null>;
77
+ /**
78
+ * Populate the current url with the given Nexus context
79
+ */
80
+ declare function update({ url, context, }: {
81
+ url?: string;
82
+ context: Partial<FrakContext>;
83
+ }): Promise<string | null | undefined>;
84
+ /**
85
+ * Remove Nexus context from current url
86
+ */
87
+ declare function remove(url: string): string;
88
+ /**
89
+ * Replace the current url with the given Nexus context
90
+ * @param url
91
+ * @param context
92
+ */
93
+ declare function replaceUrl({ url, context, }: {
94
+ url?: string;
95
+ context: Partial<FrakContext>;
96
+ }): Promise<void>;
97
+ /**
98
+ * Export our frak context "class"
99
+ */
100
+ declare const FrakContextManager: {
101
+ parse: typeof parse;
102
+ update: typeof update;
103
+ remove: typeof remove;
104
+ replaceUrl: typeof replaceUrl;
105
+ };
106
+
107
+ declare class Deferred<T> {
108
+ private readonly _promise;
109
+ private _resolve;
110
+ private _reject;
111
+ constructor();
112
+ get promise(): Promise<T>;
113
+ resolve: (value: T | PromiseLike<T>) => void;
114
+ reject: (reason?: unknown) => void;
115
+ }
55
116
 
56
117
  /**
57
118
  * The keys for each product types
@@ -63,11 +124,44 @@ type ProductTypesKey = keyof typeof productTypes;
63
124
  declare const productTypes: {
64
125
  dapp: number;
65
126
  press: number;
127
+ webshop: number;
66
128
  referral: number;
129
+ purchase: number;
67
130
  };
68
131
  /**
69
132
  * Bitmask for each product types
70
133
  */
71
134
  declare const productTypesMask: Record<ProductTypesKey, bigint>;
72
135
 
73
- export { type CompressedData, type HashProtectedData, type KeyProvider, NexusClient, NexusWalletSdkConfig, type ProductTypesKey, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, hashAndCompressData, productTypes, productTypesMask };
136
+ /**
137
+ * The keys for each interaction types
138
+ */
139
+ type InteractionTypesKey = {
140
+ [K in keyof typeof interactionTypes]: keyof (typeof interactionTypes)[K];
141
+ }[keyof typeof interactionTypes];
142
+ /**
143
+ * Each interactions types according to the product types
144
+ */
145
+ declare const interactionTypes: {
146
+ readonly press: {
147
+ readonly openArticle: "0xc0a24ffb";
148
+ readonly readArticle: "0xd5bd0fbe";
149
+ };
150
+ readonly dapp: {
151
+ readonly proofVerifiableStorageUpdate: "0x2ab2aeef";
152
+ readonly callableVerifiableStorageUpdate: "0xa07da986";
153
+ };
154
+ readonly webshop: {
155
+ readonly open: "0xb311798f";
156
+ };
157
+ readonly referral: {
158
+ readonly referred: "0x010cc3b9";
159
+ readonly createLink: "0xb2c0f17c";
160
+ };
161
+ readonly purchase: {
162
+ readonly started: "0xd87e90c3";
163
+ readonly completed: "0x8403aeb4";
164
+ };
165
+ };
166
+
167
+ export { type CompressedData, Deferred, FrakContextManager, type HashProtectedData, type InteractionTypesKey, type KeyProvider, NexusClient, NexusWalletSdkConfig, type ProductTypesKey, compressJson, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, decompressJson, hashAndCompressData, interactionTypes, productTypes, productTypesMask };