@frak-labs/nexus-sdk 0.0.12 → 0.0.14

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 (31) hide show
  1. package/dist/chunk-22T2NHQK.js +22 -0
  2. package/dist/{chunk-HXVDI2IY.js → chunk-5LZQXBFJ.js} +4 -1
  3. package/dist/{chunk-BJ3CCN5P.cjs → chunk-5SGDBU5S.cjs} +4 -1
  4. package/dist/chunk-AANA3LEO.cjs +22 -0
  5. package/dist/{chunk-GUDT2W6I.js → chunk-IH3QWPWT.js} +10 -8
  6. package/dist/{chunk-IQQTTKJL.cjs → chunk-PURWUKEM.cjs} +9 -7
  7. package/dist/{chunk-5CFD5FM2.js → chunk-S223FMEJ.js} +5 -5
  8. package/dist/{chunk-S5FVCA2E.cjs → chunk-UOEVM7TR.cjs} +5 -5
  9. package/dist/{client-B6_BIGc3.d.ts → client-DJd7-ajw.d.ts} +6 -3
  10. package/dist/{client-Oily5ph8.d.cts → client-DXITs1Kf.d.cts} +6 -3
  11. package/dist/core/actions/index.cjs +2 -2
  12. package/dist/core/actions/index.d.cts +7 -7
  13. package/dist/core/actions/index.d.ts +7 -7
  14. package/dist/core/actions/index.js +1 -1
  15. package/dist/core/index.cjs +8 -2
  16. package/dist/core/index.d.cts +21 -4
  17. package/dist/core/index.d.ts +21 -4
  18. package/dist/core/index.js +8 -2
  19. package/dist/core/interactions/index.cjs +3 -2
  20. package/dist/core/interactions/index.d.cts +1 -1
  21. package/dist/core/interactions/index.d.ts +1 -1
  22. package/dist/core/interactions/index.js +2 -1
  23. package/dist/{interaction-D3-M3nBh.d.cts → interaction-BngPoHA0.d.cts} +1 -1
  24. package/dist/{interaction-D3-M3nBh.d.ts → interaction-BngPoHA0.d.ts} +1 -1
  25. package/dist/react/index.cjs +47 -52
  26. package/dist/react/index.d.cts +6 -6
  27. package/dist/react/index.d.ts +6 -6
  28. package/dist/react/index.js +20 -25
  29. package/dist/{sendTransaction-BKKYEt8p.d.cts → sendTransaction-C19oCc6X.d.cts} +1 -1
  30. package/dist/{sendTransaction-BHqCq_9X.d.ts → sendTransaction-fLvpfqaQ.d.ts} +1 -1
  31. package/package.json +3 -3
@@ -0,0 +1,22 @@
1
+ // src/core/constants/productTypes.ts
2
+ var productTypes = {
3
+ // content type
4
+ dapp: 1,
5
+ press: 2,
6
+ // feature type
7
+ referral: 30
8
+ };
9
+ var productTypesMask = Object.entries(
10
+ productTypes
11
+ ).reduce(
12
+ (acc, [key, value]) => {
13
+ acc[key] = BigInt(1) << BigInt(value);
14
+ return acc;
15
+ },
16
+ {}
17
+ );
18
+
19
+ export {
20
+ productTypes,
21
+ productTypesMask
22
+ };
@@ -212,9 +212,11 @@ function createIFrameLifecycleManager({
212
212
  const isConnectedDeferred = new Deferred();
213
213
  const handler = async (messageEvent) => {
214
214
  switch (messageEvent.iframeLifecycle) {
215
+ // Resolve the isConnected promise
215
216
  case "connected":
216
217
  isConnectedDeferred.resolve(true);
217
218
  break;
219
+ // Perform a nexus backup
218
220
  case "do-backup":
219
221
  if (messageEvent.data.backup) {
220
222
  localStorage.setItem(BACKUP_KEY, messageEvent.data.backup);
@@ -222,6 +224,7 @@ function createIFrameLifecycleManager({
222
224
  localStorage.removeItem(BACKUP_KEY);
223
225
  }
224
226
  break;
227
+ // Change iframe visibility
225
228
  case "show":
226
229
  case "hide":
227
230
  changeIframeVisibility({
@@ -253,7 +256,7 @@ function createIFrameMessageHandler({
253
256
  if (!iframe.contentWindow) {
254
257
  throw new FrakRpcError(
255
258
  RpcErrorCodes.configError,
256
- "The iframe does not have a content window"
259
+ "The iframe does not have a product window"
257
260
  );
258
261
  }
259
262
  const contentWindow = iframe.contentWindow;
@@ -212,9 +212,11 @@ function createIFrameLifecycleManager({
212
212
  const isConnectedDeferred = new Deferred();
213
213
  const handler = async (messageEvent) => {
214
214
  switch (messageEvent.iframeLifecycle) {
215
+ // Resolve the isConnected promise
215
216
  case "connected":
216
217
  isConnectedDeferred.resolve(true);
217
218
  break;
219
+ // Perform a nexus backup
218
220
  case "do-backup":
219
221
  if (messageEvent.data.backup) {
220
222
  localStorage.setItem(BACKUP_KEY, messageEvent.data.backup);
@@ -222,6 +224,7 @@ function createIFrameLifecycleManager({
222
224
  localStorage.removeItem(BACKUP_KEY);
223
225
  }
224
226
  break;
227
+ // Change iframe visibility
225
228
  case "show":
226
229
  case "hide":
227
230
  changeIframeVisibility({
@@ -253,7 +256,7 @@ function createIFrameMessageHandler({
253
256
  if (!iframe.contentWindow) {
254
257
  throw new FrakRpcError(
255
258
  RpcErrorCodes.configError,
256
- "The iframe does not have a content window"
259
+ "The iframe does not have a product window"
257
260
  );
258
261
  }
259
262
  const contentWindow = iframe.contentWindow;
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/core/constants/productTypes.ts
2
+ var productTypes = {
3
+ // content type
4
+ dapp: 1,
5
+ press: 2,
6
+ // feature type
7
+ referral: 30
8
+ };
9
+ var productTypesMask = Object.entries(
10
+ productTypes
11
+ ).reduce(
12
+ (acc, [key, value]) => {
13
+ acc[key] = BigInt(1) << BigInt(value);
14
+ return acc;
15
+ },
16
+ {}
17
+ );
18
+
19
+
20
+
21
+
22
+ exports.productTypes = productTypes; exports.productTypesMask = productTypesMask;
@@ -1,6 +1,9 @@
1
+ import {
2
+ productTypes
3
+ } from "./chunk-22T2NHQK.js";
4
+
1
5
  // src/core/interactions/pressEncoder.ts
2
- import { concatHex, pad } from "viem";
3
- var PressTypeSelector = "0x02";
6
+ import { concatHex, pad, toHex } from "viem";
4
7
  var PressActionsSelector = {
5
8
  OpenArticle: "0xc0a24ffb",
6
9
  ReadArticle: "0xd5bd0fbe"
@@ -11,7 +14,7 @@ function openArticle({ articleId }) {
11
14
  pad(articleId, { size: 32 })
12
15
  ]);
13
16
  return {
14
- handlerTypeDenominator: PressTypeSelector,
17
+ handlerTypeDenominator: toHex(productTypes.press),
15
18
  interactionData
16
19
  };
17
20
  }
@@ -21,7 +24,7 @@ function readArticle({ articleId }) {
21
24
  pad(articleId, { size: 32 })
22
25
  ]);
23
26
  return {
24
- handlerTypeDenominator: PressTypeSelector,
27
+ handlerTypeDenominator: toHex(productTypes.press),
25
28
  interactionData
26
29
  };
27
30
  }
@@ -31,8 +34,7 @@ var PressInteractionEncoder = {
31
34
  };
32
35
 
33
36
  // src/core/interactions/referralEncoder.ts
34
- import { concatHex as concatHex2, pad as pad2 } from "viem";
35
- var ReferralTypeSelector = "0x1E";
37
+ import { concatHex as concatHex2, pad as pad2, toHex as toHex2 } from "viem";
36
38
  var ReferralActionsSelector = {
37
39
  CreateLink: "0xb2c0f17c",
38
40
  Referred: "0x010cc3b9"
@@ -43,7 +45,7 @@ function createLink() {
43
45
  "0x"
44
46
  ]);
45
47
  return {
46
- handlerTypeDenominator: ReferralTypeSelector,
48
+ handlerTypeDenominator: toHex2(productTypes.referral),
47
49
  interactionData
48
50
  };
49
51
  }
@@ -53,7 +55,7 @@ function referred({ referrer }) {
53
55
  pad2(referrer, { size: 32 })
54
56
  ]);
55
57
  return {
56
- handlerTypeDenominator: ReferralTypeSelector,
58
+ handlerTypeDenominator: toHex2(productTypes.referral),
57
59
  interactionData
58
60
  };
59
61
  }
@@ -1,6 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/core/interactions/pressEncoder.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkAANA3LEOcjs = require('./chunk-AANA3LEO.cjs');
4
+
5
+ // src/core/interactions/pressEncoder.ts
2
6
  var _viem = require('viem');
3
- var PressTypeSelector = "0x02";
4
7
  var PressActionsSelector = {
5
8
  OpenArticle: "0xc0a24ffb",
6
9
  ReadArticle: "0xd5bd0fbe"
@@ -11,7 +14,7 @@ function openArticle({ articleId }) {
11
14
  _viem.pad.call(void 0, articleId, { size: 32 })
12
15
  ]);
13
16
  return {
14
- handlerTypeDenominator: PressTypeSelector,
17
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkAANA3LEOcjs.productTypes.press),
15
18
  interactionData
16
19
  };
17
20
  }
@@ -21,7 +24,7 @@ function readArticle({ articleId }) {
21
24
  _viem.pad.call(void 0, articleId, { size: 32 })
22
25
  ]);
23
26
  return {
24
- handlerTypeDenominator: PressTypeSelector,
27
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkAANA3LEOcjs.productTypes.press),
25
28
  interactionData
26
29
  };
27
30
  }
@@ -32,7 +35,6 @@ var PressInteractionEncoder = {
32
35
 
33
36
  // src/core/interactions/referralEncoder.ts
34
37
 
35
- var ReferralTypeSelector = "0x1E";
36
38
  var ReferralActionsSelector = {
37
39
  CreateLink: "0xb2c0f17c",
38
40
  Referred: "0x010cc3b9"
@@ -43,7 +45,7 @@ function createLink() {
43
45
  "0x"
44
46
  ]);
45
47
  return {
46
- handlerTypeDenominator: ReferralTypeSelector,
48
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkAANA3LEOcjs.productTypes.referral),
47
49
  interactionData
48
50
  };
49
51
  }
@@ -53,7 +55,7 @@ function referred({ referrer }) {
53
55
  _viem.pad.call(void 0, referrer, { size: 32 })
54
56
  ]);
55
57
  return {
56
- handlerTypeDenominator: ReferralTypeSelector,
58
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkAANA3LEOcjs.productTypes.referral),
57
59
  interactionData
58
60
  };
59
61
  }
@@ -8,18 +8,18 @@ function watchWalletStatus(client, callback) {
8
8
  );
9
9
  }
10
10
 
11
- // src/core/utils/computeContentId.ts
11
+ // src/core/utils/computeProductId.ts
12
12
  import { keccak256, toHex } from "viem";
13
- function computeContentId({ domain }) {
13
+ function computeProductId({ domain }) {
14
14
  return keccak256(toHex(domain));
15
15
  }
16
16
 
17
17
  // src/core/actions/sendInteraction.ts
18
- async function sendInteraction(client, { contentId, interaction, validation }) {
19
- const cId = contentId ?? computeContentId(client.config);
18
+ async function sendInteraction(client, { productId, interaction, validation }) {
19
+ const pId = productId ?? computeProductId(client.config);
20
20
  return await client.request({
21
21
  method: "frak_sendInteraction",
22
- params: [cId, interaction, validation]
22
+ params: [pId, interaction, validation]
23
23
  });
24
24
  }
25
25
 
@@ -8,18 +8,18 @@ function watchWalletStatus(client, callback) {
8
8
  );
9
9
  }
10
10
 
11
- // src/core/utils/computeContentId.ts
11
+ // src/core/utils/computeProductId.ts
12
12
  var _viem = require('viem');
13
- function computeContentId({ domain }) {
13
+ function computeProductId({ domain }) {
14
14
  return _viem.keccak256.call(void 0, _viem.toHex.call(void 0, domain));
15
15
  }
16
16
 
17
17
  // src/core/actions/sendInteraction.ts
18
- async function sendInteraction(client, { contentId, interaction, validation }) {
19
- const cId = _nullishCoalesce(contentId, () => ( computeContentId(client.config)));
18
+ async function sendInteraction(client, { productId, interaction, validation }) {
19
+ const pId = _nullishCoalesce(productId, () => ( computeProductId(client.config)));
20
20
  return await client.request({
21
21
  method: "frak_sendInteraction",
22
- params: [cId, interaction, validation]
22
+ params: [pId, interaction, validation]
23
23
  });
24
24
  }
25
25
 
@@ -1,7 +1,7 @@
1
1
  import { Address, Hex, RpcSchema } from 'viem';
2
2
  import { Prettify } from 'viem/chains';
3
3
  import { SiweMessage } from 'viem/siwe';
4
- import { P as PreparedInteraction, a as SendInteractionReturnType } from './interaction-D3-M3nBh.js';
4
+ import { P as PreparedInteraction, a as SendInteractionReturnType } from './interaction-BngPoHA0.js';
5
5
 
6
6
  /**
7
7
  * Configuration for the Nexus Wallet SDK
@@ -102,7 +102,10 @@ type LoginModalStepType = GenericModalStepType<"login", LoginWithSso | LoginWith
102
102
  /**
103
103
  * Parameters of the send transaction rpc request
104
104
  */
105
- type SiweAuthenticationParams = Omit<SiweMessage, "address" | "chainId">;
105
+ type SiweAuthenticationParams = Omit<SiweMessage, "address" | "chainId" | "expirationTime" | "issuedAt" | "notBefore"> & {
106
+ expirationTimeTimestamp?: number;
107
+ notBeforeTimestamp?: number;
108
+ };
106
109
  /**
107
110
  * Return type of the send transaction rpc request
108
111
  */
@@ -240,7 +243,7 @@ type IFrameRpcSchema = [
240
243
  {
241
244
  Method: "frak_sendInteraction";
242
245
  Parameters: [
243
- contentId: Hex,
246
+ productId: Hex,
244
247
  interaction: PreparedInteraction,
245
248
  signature?: Hex
246
249
  ];
@@ -1,7 +1,7 @@
1
1
  import { Address, Hex, RpcSchema } from 'viem';
2
2
  import { Prettify } from 'viem/chains';
3
3
  import { SiweMessage } from 'viem/siwe';
4
- import { P as PreparedInteraction, a as SendInteractionReturnType } from './interaction-D3-M3nBh.cjs';
4
+ import { P as PreparedInteraction, a as SendInteractionReturnType } from './interaction-BngPoHA0.cjs';
5
5
 
6
6
  /**
7
7
  * Configuration for the Nexus Wallet SDK
@@ -102,7 +102,10 @@ type LoginModalStepType = GenericModalStepType<"login", LoginWithSso | LoginWith
102
102
  /**
103
103
  * Parameters of the send transaction rpc request
104
104
  */
105
- type SiweAuthenticationParams = Omit<SiweMessage, "address" | "chainId">;
105
+ type SiweAuthenticationParams = Omit<SiweMessage, "address" | "chainId" | "expirationTime" | "issuedAt" | "notBefore"> & {
106
+ expirationTimeTimestamp?: number;
107
+ notBeforeTimestamp?: number;
108
+ };
106
109
  /**
107
110
  * Return type of the send transaction rpc request
108
111
  */
@@ -240,7 +243,7 @@ type IFrameRpcSchema = [
240
243
  {
241
244
  Method: "frak_sendInteraction";
242
245
  Parameters: [
243
- contentId: Hex,
246
+ productId: Hex,
244
247
  interaction: PreparedInteraction,
245
248
  signature?: Hex
246
249
  ];
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkS5FVCA2Ecjs = require('../../chunk-S5FVCA2E.cjs');
8
+ var _chunkUOEVM7TRcjs = require('../../chunk-UOEVM7TR.cjs');
9
9
  require('../../chunk-ETV4XYOV.cjs');
10
10
 
11
11
 
@@ -14,4 +14,4 @@ require('../../chunk-ETV4XYOV.cjs');
14
14
 
15
15
 
16
16
 
17
- exports.displayModal = _chunkS5FVCA2Ecjs.displayModal; exports.openSso = _chunkS5FVCA2Ecjs.openSso; exports.sendInteraction = _chunkS5FVCA2Ecjs.sendInteraction; exports.sendTransaction = _chunkS5FVCA2Ecjs.sendTransaction; exports.siweAuthenticate = _chunkS5FVCA2Ecjs.siweAuthenticate; exports.watchWalletStatus = _chunkS5FVCA2Ecjs.watchWalletStatus;
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;
@@ -1,6 +1,6 @@
1
- import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-Oily5ph8.cjs';
2
- import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-D3-M3nBh.cjs';
3
- export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-BKKYEt8p.cjs';
1
+ import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-DXITs1Kf.cjs';
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
4
  import 'viem';
5
5
  import 'viem/chains';
6
6
  import 'viem/siwe';
@@ -15,16 +15,16 @@ declare function watchWalletStatus(client: NexusClient, callback: (status: Walle
15
15
  /**
16
16
  * Function used to send an interaction
17
17
  * @param client
18
- * @param contentId
19
- * @param request
18
+ * @param productId
19
+ * @param interaction
20
20
  * @param validation
21
21
  */
22
- declare function sendInteraction(client: NexusClient, { contentId, interaction, validation }: SendInteractionParamsType): Promise<SendInteractionReturnType>;
22
+ declare function sendInteraction(client: NexusClient, { productId, interaction, validation }: SendInteractionParamsType): Promise<SendInteractionReturnType>;
23
23
 
24
24
  /**
25
25
  * Function used to display a modal
26
26
  * @param client
27
- * @param contentId
27
+ * @param args
28
28
  */
29
29
  declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(client: NexusClient, { steps, metadata }: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
30
30
 
@@ -1,6 +1,6 @@
1
- import { N as NexusClient, W as WalletStatusReturnType, d as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-B6_BIGc3.js';
2
- import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-D3-M3nBh.js';
3
- export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-BHqCq_9X.js';
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';
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
4
  import 'viem';
5
5
  import 'viem/chains';
6
6
  import 'viem/siwe';
@@ -15,16 +15,16 @@ declare function watchWalletStatus(client: NexusClient, callback: (status: Walle
15
15
  /**
16
16
  * Function used to send an interaction
17
17
  * @param client
18
- * @param contentId
19
- * @param request
18
+ * @param productId
19
+ * @param interaction
20
20
  * @param validation
21
21
  */
22
- declare function sendInteraction(client: NexusClient, { contentId, interaction, validation }: SendInteractionParamsType): Promise<SendInteractionReturnType>;
22
+ declare function sendInteraction(client: NexusClient, { productId, interaction, validation }: SendInteractionParamsType): Promise<SendInteractionReturnType>;
23
23
 
24
24
  /**
25
25
  * Function used to display a modal
26
26
  * @param client
27
- * @param contentId
27
+ * @param args
28
28
  */
29
29
  declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(client: NexusClient, { steps, metadata }: DisplayModalParamsType<T>): Promise<ModalRpcStepsResultType<T>>;
30
30
 
@@ -5,7 +5,7 @@ import {
5
5
  sendTransaction,
6
6
  siweAuthenticate,
7
7
  watchWalletStatus
8
- } from "../../chunk-5CFD5FM2.js";
8
+ } from "../../chunk-S223FMEJ.js";
9
9
  import "../../chunk-PKBMQBKP.js";
10
10
  export {
11
11
  displayModal,
@@ -5,7 +5,11 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkBJ3CCN5Pcjs = require('../chunk-BJ3CCN5P.cjs');
8
+ var _chunk5SGDBU5Scjs = require('../chunk-5SGDBU5S.cjs');
9
+
10
+
11
+
12
+ var _chunkAANA3LEOcjs = require('../chunk-AANA3LEO.cjs');
9
13
  require('../chunk-ETV4XYOV.cjs');
10
14
 
11
15
 
@@ -14,4 +18,6 @@ require('../chunk-ETV4XYOV.cjs');
14
18
 
15
19
 
16
20
 
17
- exports.FrakRpcError = _chunkBJ3CCN5Pcjs.FrakRpcError; exports.RpcErrorCodes = _chunkBJ3CCN5Pcjs.RpcErrorCodes; exports.createIFrameNexusClient = _chunkBJ3CCN5Pcjs.createIFrameNexusClient; exports.createIframe = _chunkBJ3CCN5Pcjs.createIframe; exports.decompressDataAndCheckHash = _chunkBJ3CCN5Pcjs.decompressDataAndCheckHash; exports.hashAndCompressData = _chunkBJ3CCN5Pcjs.hashAndCompressData;
21
+
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;
@@ -1,6 +1,6 @@
1
- import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-Oily5ph8.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-Oily5ph8.cjs';
3
- export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-D3-M3nBh.cjs';
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';
3
+ export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.cjs';
4
4
  export { F as FrakRpcError, R as RpcErrorCodes } from '../error-C4Zm5nQe.cjs';
5
5
  import 'viem';
6
6
  import 'viem/chains';
@@ -53,4 +53,21 @@ declare function hashAndCompressData<T>(data: T): Promise<CompressedData>;
53
53
  */
54
54
  declare function decompressDataAndCheckHash<T>(compressedData: CompressedData): Promise<HashProtectedData<T>>;
55
55
 
56
- export { type CompressedData, type HashProtectedData, type KeyProvider, NexusClient, NexusWalletSdkConfig, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, hashAndCompressData };
56
+ /**
57
+ * The keys for each product types
58
+ */
59
+ type ProductTypesKey = keyof typeof productTypes;
60
+ /**
61
+ * List of the product types per denominator
62
+ */
63
+ declare const productTypes: {
64
+ dapp: number;
65
+ press: number;
66
+ referral: number;
67
+ };
68
+ /**
69
+ * Bitmask for each product types
70
+ */
71
+ declare const productTypesMask: Record<ProductTypesKey, bigint>;
72
+
73
+ export { type CompressedData, type HashProtectedData, type KeyProvider, NexusClient, NexusWalletSdkConfig, type ProductTypesKey, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, hashAndCompressData, productTypes, productTypesMask };
@@ -1,6 +1,6 @@
1
- import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-B6_BIGc3.js';
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-B6_BIGc3.js';
3
- export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-D3-M3nBh.js';
1
+ import { f as NexusWalletSdkConfig, N as NexusClient } from '../client-DJd7-ajw.js';
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-DJd7-ajw.js';
3
+ export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.js';
4
4
  export { F as FrakRpcError, R as RpcErrorCodes } from '../error-C4Zm5nQe.js';
5
5
  import 'viem';
6
6
  import 'viem/chains';
@@ -53,4 +53,21 @@ declare function hashAndCompressData<T>(data: T): Promise<CompressedData>;
53
53
  */
54
54
  declare function decompressDataAndCheckHash<T>(compressedData: CompressedData): Promise<HashProtectedData<T>>;
55
55
 
56
- export { type CompressedData, type HashProtectedData, type KeyProvider, NexusClient, NexusWalletSdkConfig, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, hashAndCompressData };
56
+ /**
57
+ * The keys for each product types
58
+ */
59
+ type ProductTypesKey = keyof typeof productTypes;
60
+ /**
61
+ * List of the product types per denominator
62
+ */
63
+ declare const productTypes: {
64
+ dapp: number;
65
+ press: number;
66
+ referral: number;
67
+ };
68
+ /**
69
+ * Bitmask for each product types
70
+ */
71
+ declare const productTypesMask: Record<ProductTypesKey, bigint>;
72
+
73
+ export { type CompressedData, type HashProtectedData, type KeyProvider, NexusClient, NexusWalletSdkConfig, type ProductTypesKey, createIFrameNexusClient, createIframe, decompressDataAndCheckHash, hashAndCompressData, productTypes, productTypesMask };
@@ -5,7 +5,11 @@ import {
5
5
  createIframe,
6
6
  decompressDataAndCheckHash,
7
7
  hashAndCompressData
8
- } from "../chunk-HXVDI2IY.js";
8
+ } from "../chunk-5LZQXBFJ.js";
9
+ import {
10
+ productTypes,
11
+ productTypesMask
12
+ } from "../chunk-22T2NHQK.js";
9
13
  import "../chunk-PKBMQBKP.js";
10
14
  export {
11
15
  FrakRpcError,
@@ -13,5 +17,7 @@ export {
13
17
  createIFrameNexusClient,
14
18
  createIframe,
15
19
  decompressDataAndCheckHash,
16
- hashAndCompressData
20
+ hashAndCompressData,
21
+ productTypes,
22
+ productTypesMask
17
23
  };
@@ -3,11 +3,12 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkIQQTTKJLcjs = require('../../chunk-IQQTTKJL.cjs');
6
+ var _chunkPURWUKEMcjs = require('../../chunk-PURWUKEM.cjs');
7
+ require('../../chunk-AANA3LEO.cjs');
7
8
  require('../../chunk-ETV4XYOV.cjs');
8
9
 
9
10
 
10
11
 
11
12
 
12
13
 
13
- exports.PressActionsSelector = _chunkIQQTTKJLcjs.PressActionsSelector; exports.PressInteractionEncoder = _chunkIQQTTKJLcjs.PressInteractionEncoder; exports.ReferralActionsSelector = _chunkIQQTTKJLcjs.ReferralActionsSelector; exports.ReferralInteractionEncoder = _chunkIQQTTKJLcjs.ReferralInteractionEncoder;
14
+ exports.PressActionsSelector = _chunkPURWUKEMcjs.PressActionsSelector; exports.PressInteractionEncoder = _chunkPURWUKEMcjs.PressInteractionEncoder; exports.ReferralActionsSelector = _chunkPURWUKEMcjs.ReferralActionsSelector; exports.ReferralInteractionEncoder = _chunkPURWUKEMcjs.ReferralInteractionEncoder;
@@ -1,5 +1,5 @@
1
1
  import { Hex, Address } from 'viem';
2
- import { P as PreparedInteraction } from '../../interaction-D3-M3nBh.cjs';
2
+ import { P as PreparedInteraction } from '../../interaction-BngPoHA0.cjs';
3
3
 
4
4
  /**
5
5
  * All the press interactions actions
@@ -1,5 +1,5 @@
1
1
  import { Hex, Address } from 'viem';
2
- import { P as PreparedInteraction } from '../../interaction-D3-M3nBh.js';
2
+ import { P as PreparedInteraction } from '../../interaction-BngPoHA0.js';
3
3
 
4
4
  /**
5
5
  * All the press interactions actions
@@ -3,7 +3,8 @@ import {
3
3
  PressInteractionEncoder,
4
4
  ReferralActionsSelector,
5
5
  ReferralInteractionEncoder
6
- } from "../../chunk-GUDT2W6I.js";
6
+ } from "../../chunk-IH3QWPWT.js";
7
+ import "../../chunk-22T2NHQK.js";
7
8
  import "../../chunk-PKBMQBKP.js";
8
9
  export {
9
10
  PressActionsSelector,
@@ -8,7 +8,7 @@ type PreparedInteraction = Readonly<{
8
8
  * Parameters of an interaction handling request
9
9
  */
10
10
  type SendInteractionParamsType = {
11
- contentId?: Hex;
11
+ productId?: Hex;
12
12
  interaction: PreparedInteraction;
13
13
  validation?: Hex;
14
14
  };
@@ -8,7 +8,7 @@ type PreparedInteraction = Readonly<{
8
8
  * Parameters of an interaction handling request
9
9
  */
10
10
  type SendInteractionParamsType = {
11
- contentId?: Hex;
11
+ productId?: Hex;
12
12
  interaction: PreparedInteraction;
13
13
  validation?: Hex;
14
14
  };
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkBJ3CCN5Pcjs = require('../chunk-BJ3CCN5P.cjs');
10
+ var _chunk5SGDBU5Scjs = require('../chunk-5SGDBU5S.cjs');
11
11
 
12
12
 
13
13
 
@@ -15,10 +15,11 @@ var _chunkBJ3CCN5Pcjs = require('../chunk-BJ3CCN5P.cjs');
15
15
 
16
16
 
17
17
 
18
- var _chunkS5FVCA2Ecjs = require('../chunk-S5FVCA2E.cjs');
18
+ var _chunkUOEVM7TRcjs = require('../chunk-UOEVM7TR.cjs');
19
19
 
20
20
 
21
- var _chunkIQQTTKJLcjs = require('../chunk-IQQTTKJL.cjs');
21
+ var _chunkPURWUKEMcjs = require('../chunk-PURWUKEM.cjs');
22
+ require('../chunk-AANA3LEO.cjs');
22
23
  require('../chunk-ETV4XYOV.cjs');
23
24
 
24
25
  // src/react/provider/NexusConfigProvider.ts
@@ -51,8 +52,8 @@ function NexusConfigProvider(parameters) {
51
52
  function useNexusConfig() {
52
53
  const config = _react.useContext.call(void 0, NexusConfigContext);
53
54
  if (!config) {
54
- throw new (0, _chunkBJ3CCN5Pcjs.FrakRpcError)(
55
- _chunkBJ3CCN5Pcjs.RpcErrorCodes.configError,
55
+ throw new (0, _chunk5SGDBU5Scjs.FrakRpcError)(
56
+ _chunk5SGDBU5Scjs.RpcErrorCodes.configError,
56
57
  "Nexus config not found"
57
58
  );
58
59
  }
@@ -85,11 +86,11 @@ function useWalletStatus() {
85
86
  queryKey: ["nexus-sdk", "wallet-status-listener"],
86
87
  queryFn: async () => {
87
88
  if (!client) {
88
- throw new (0, _chunkBJ3CCN5Pcjs.ClientNotFound)();
89
+ throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
89
90
  }
90
- const firstResult = new (0, _chunkBJ3CCN5Pcjs.Deferred)();
91
+ const firstResult = new (0, _chunk5SGDBU5Scjs.Deferred)();
91
92
  let hasResolved = false;
92
- await _chunkS5FVCA2Ecjs.watchWalletStatus.call(void 0, client, (status) => {
93
+ await _chunkUOEVM7TRcjs.watchWalletStatus.call(void 0, client, (status) => {
93
94
  newStatusUpdated(status);
94
95
  if (!hasResolved) {
95
96
  firstResult.resolve(status);
@@ -113,9 +114,9 @@ function useSendTransactionAction({
113
114
  mutationKey: ["nexus-sdk", "send-transaction"],
114
115
  mutationFn: async (params) => {
115
116
  if (!client) {
116
- throw new (0, _chunkBJ3CCN5Pcjs.ClientNotFound)();
117
+ throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
117
118
  }
118
- return _chunkS5FVCA2Ecjs.sendTransaction.call(void 0, client, params);
119
+ return _chunkUOEVM7TRcjs.sendTransaction.call(void 0, client, params);
119
120
  }
120
121
  });
121
122
  }
@@ -135,9 +136,9 @@ function useSiweAuthenticate({
135
136
  ],
136
137
  mutationFn: async (params) => {
137
138
  if (!client) {
138
- throw new (0, _chunkBJ3CCN5Pcjs.ClientNotFound)();
139
+ throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
139
140
  }
140
- return _chunkS5FVCA2Ecjs.siweAuthenticate.call(void 0, client, params);
141
+ return _chunkUOEVM7TRcjs.siweAuthenticate.call(void 0, client, params);
141
142
  }
142
143
  });
143
144
  }
@@ -158,9 +159,9 @@ function useDisplayModal({
158
159
  mutationKey: ["nexus-sdk", "display-modal"],
159
160
  mutationFn: async (args) => {
160
161
  if (!client) {
161
- throw new (0, _chunkBJ3CCN5Pcjs.ClientNotFound)();
162
+ throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
162
163
  }
163
- return _chunkS5FVCA2Ecjs.displayModal.call(void 0, client, args);
164
+ return _chunkUOEVM7TRcjs.displayModal.call(void 0, client, args);
164
165
  }
165
166
  });
166
167
  }
@@ -176,9 +177,9 @@ function useSendInteraction({
176
177
  mutationKey: ["nexus-sdk", "send-interaction"],
177
178
  mutationFn: async (params) => {
178
179
  if (!client) {
179
- throw new (0, _chunkBJ3CCN5Pcjs.ClientNotFound)();
180
+ throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
180
181
  }
181
- return _chunkS5FVCA2Ecjs.sendInteraction.call(void 0, client, params);
182
+ return _chunkUOEVM7TRcjs.sendInteraction.call(void 0, client, params);
182
183
  }
183
184
  });
184
185
  }
@@ -233,7 +234,7 @@ function useNexusContext() {
233
234
  const url = new URL(location.href);
234
235
  const nexusContext2 = url.searchParams.get(contextKey);
235
236
  if (!nexusContext2) return null;
236
- const parsedContext = await _chunkBJ3CCN5Pcjs.decompressJson.call(void 0, nexusContext2);
237
+ const parsedContext = await _chunk5SGDBU5Scjs.decompressJson.call(void 0, nexusContext2);
237
238
  if (!parsedContext) return null;
238
239
  return parsedContext;
239
240
  },
@@ -244,7 +245,7 @@ function useNexusContext() {
244
245
  mutationFn: async (newContext) => {
245
246
  if (!location || typeof window === "undefined") return;
246
247
  const fullNewContext = nexusContext ? { ...nexusContext, ...newContext } : newContext;
247
- const compressedContext = await _chunkBJ3CCN5Pcjs.compressJson.call(void 0, fullNewContext);
248
+ const compressedContext = await _chunk5SGDBU5Scjs.compressJson.call(void 0, fullNewContext);
248
249
  if (!compressedContext) return;
249
250
  const url = new URL(location.href);
250
251
  url.searchParams.set(contextKey, compressedContext);
@@ -260,7 +261,7 @@ function useNexusContext() {
260
261
 
261
262
  // src/react/hook/helper/useReferralInteraction.ts
262
263
  function useReferralInteraction({
263
- contentId,
264
+ productId,
264
265
  modalConfig
265
266
  } = {}) {
266
267
  const { nexusContext, updateContextAsync } = useNexusContext();
@@ -272,27 +273,23 @@ function useReferralInteraction({
272
273
  });
273
274
  const processReferral = _react.useCallback.call(void 0, async () => {
274
275
  try {
275
- let currentWallet = await ensureWalletConnected({
276
- autoDisplay: false
277
- });
278
- if (!_optionalChain([nexusContext, 'optionalAccess', _10 => _10.r])) {
276
+ let currentWallet = _optionalChain([walletStatus, 'optionalAccess', _10 => _10.key]) === "connected" ? walletStatus.wallet : void 0;
277
+ if (!_optionalChain([nexusContext, 'optionalAccess', _11 => _11.r])) {
279
278
  if (currentWallet) {
280
279
  await updateContextAsync({ r: currentWallet });
281
280
  }
282
281
  return "no-referrer";
283
282
  }
284
283
  if (!currentWallet) {
285
- currentWallet = await ensureWalletConnected({
286
- autoDisplay: true
287
- });
284
+ currentWallet = await ensureWalletConnected();
288
285
  }
289
286
  if (currentWallet && _viem.isAddressEqual.call(void 0, nexusContext.r, currentWallet)) {
290
287
  return "self-referral";
291
288
  }
292
- const interaction = _chunkIQQTTKJLcjs.ReferralInteractionEncoder.referred({
289
+ const interaction = _chunkPURWUKEMcjs.ReferralInteractionEncoder.referred({
293
290
  referrer: nexusContext.r
294
291
  });
295
- await sendInteraction2({ contentId, interaction });
292
+ await sendInteraction2({ productId, interaction });
296
293
  if (currentWallet) {
297
294
  await updateContextAsync({ r: currentWallet });
298
295
  }
@@ -302,10 +299,11 @@ function useReferralInteraction({
302
299
  }
303
300
  }, [
304
301
  nexusContext,
305
- contentId,
302
+ productId,
306
303
  ensureWalletConnected,
307
304
  sendInteraction2,
308
- updateContextAsync
305
+ updateContextAsync,
306
+ walletStatus
309
307
  ]);
310
308
  const {
311
309
  data: referralState,
@@ -317,8 +315,8 @@ function useReferralInteraction({
317
315
  queryKey: [
318
316
  "nexus-sdk",
319
317
  "auto-referral-interaction",
320
- _nullishCoalesce(_optionalChain([nexusContext, 'optionalAccess', _11 => _11.r]), () => ( "no-referrer")),
321
- _nullishCoalesce(_optionalChain([walletStatus, 'optionalAccess', _12 => _12.key]), () => ( "no-wallet-status"))
318
+ _nullishCoalesce(_optionalChain([nexusContext, 'optionalAccess', _12 => _12.r]), () => ( "no-referrer")),
319
+ _nullishCoalesce(_optionalChain([walletStatus, 'optionalAccess', _13 => _13.key]), () => ( "no-wallet-status"))
322
320
  ],
323
321
  queryFn: processReferral,
324
322
  enabled: !!walletStatus
@@ -334,26 +332,23 @@ function useEnsureWalletConnected({
334
332
  walletStatus
335
333
  }) {
336
334
  const { mutateAsync: displayModal2 } = useDisplayModal();
337
- return _react.useCallback.call(void 0,
338
- async ({ autoDisplay }) => {
339
- if (_optionalChain([walletStatus, 'optionalAccess', _13 => _13.key]) !== "connected" || !walletStatus.interactionSession) {
340
- if (!(modalConfig && autoDisplay)) {
341
- return void 0;
342
- }
343
- const result = await displayModal2(modalConfig);
344
- return _nullishCoalesce(_optionalChain([result, 'optionalAccess', _14 => _14.login, 'optionalAccess', _15 => _15.wallet]), () => ( void 0));
335
+ return _react.useCallback.call(void 0, async () => {
336
+ if (_optionalChain([walletStatus, 'optionalAccess', _14 => _14.key]) !== "connected" || !walletStatus.interactionSession) {
337
+ if (!modalConfig) {
338
+ return void 0;
345
339
  }
346
- return _nullishCoalesce(walletStatus.wallet, () => ( void 0));
347
- },
348
- [walletStatus, modalConfig, displayModal2]
349
- );
340
+ const result = await displayModal2(modalConfig);
341
+ return _nullishCoalesce(_optionalChain([result, 'optionalAccess', _15 => _15.login, 'optionalAccess', _16 => _16.wallet]), () => ( void 0));
342
+ }
343
+ return _nullishCoalesce(walletStatus.wallet, () => ( void 0));
344
+ }, [walletStatus, modalConfig, displayModal2]);
350
345
  }
351
346
  function mapErrorToState(error) {
352
- if (error instanceof _chunkBJ3CCN5Pcjs.FrakRpcError) {
347
+ if (error instanceof _chunk5SGDBU5Scjs.FrakRpcError) {
353
348
  switch (error.code) {
354
- case _chunkBJ3CCN5Pcjs.RpcErrorCodes.walletNotConnected:
349
+ case _chunk5SGDBU5Scjs.RpcErrorCodes.walletNotConnected:
355
350
  return "no-wallet";
356
- case _chunkBJ3CCN5Pcjs.RpcErrorCodes.noInteractionSession:
351
+ case _chunk5SGDBU5Scjs.RpcErrorCodes.noInteractionSession:
357
352
  return "no-session";
358
353
  default:
359
354
  return "error";
@@ -371,9 +366,9 @@ function useOpenSso({ mutations } = {}) {
371
366
  mutationKey: ["nexus-sdk", "open-sso"],
372
367
  mutationFn: async (params) => {
373
368
  if (!client) {
374
- throw new (0, _chunkBJ3CCN5Pcjs.ClientNotFound)();
369
+ throw new (0, _chunk5SGDBU5Scjs.ClientNotFound)();
375
370
  }
376
- return _chunkS5FVCA2Ecjs.openSso.call(void 0, client, params);
371
+ return _chunkUOEVM7TRcjs.openSso.call(void 0, client, params);
377
372
  }
378
373
  });
379
374
  }
@@ -389,15 +384,15 @@ function NexusIFrameClientProvider({
389
384
  const config = useNexusConfig();
390
385
  const [client, setClient] = _react.useState.call(void 0, void 0);
391
386
  const iFrame = _react.createElement.call(void 0, "iframe", {
392
- ..._chunkBJ3CCN5Pcjs.baseIframeProps,
387
+ ..._chunk5SGDBU5Scjs.baseIframeProps,
393
388
  src: `${config.walletUrl}/listener`,
394
- style: _nullishCoalesce(style, () => ( _chunkBJ3CCN5Pcjs.baseIframeProps.style)),
389
+ style: _nullishCoalesce(style, () => ( _chunk5SGDBU5Scjs.baseIframeProps.style)),
395
390
  ref: (iframe) => {
396
391
  if (!iframe || client) {
397
392
  return;
398
393
  }
399
394
  setClient(
400
- _chunkBJ3CCN5Pcjs.createIFrameNexusClient.call(void 0, {
395
+ _chunk5SGDBU5Scjs.createIFrameNexusClient.call(void 0, {
401
396
  iframe,
402
397
  config
403
398
  })
@@ -1,13 +1,13 @@
1
1
  import * as react from 'react';
2
2
  import { PropsWithChildren, CSSProperties, ReactNode } from 'react';
3
- import { f as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, c as SendTransactionReturnType, a as SiweAuthenticateReturnType, D as DisplayModalParamsType, d as ModalStepTypes, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../client-Oily5ph8.cjs';
3
+ import { f as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, c as SendTransactionReturnType, a as SiweAuthenticateReturnType, D as DisplayModalParamsType, d as ModalStepTypes, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../client-DXITs1Kf.cjs';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { UseMutationOptions } from '@tanstack/react-query';
6
6
  import * as viem from 'viem';
7
7
  import { Hex } from 'viem';
8
8
  import { F as FrakRpcError } from '../error-C4Zm5nQe.cjs';
9
- import { b as SendTransactionParams, S as SiweAuthenticateModalParams } from '../sendTransaction-BKKYEt8p.cjs';
10
- import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-D3-M3nBh.cjs';
9
+ import { b as SendTransactionParams, S as SiweAuthenticateModalParams } from '../sendTransaction-C19oCc6X.cjs';
10
+ import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.cjs';
11
11
  import 'viem/chains';
12
12
  import 'viem/siwe';
13
13
 
@@ -116,11 +116,11 @@ type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-sessi
116
116
  /**
117
117
  * Helper hook to automatically submit a referral interaction when detected
118
118
  * -> And automatically set the referral context in the url
119
- * @param contentId
119
+ * @param productId
120
120
  * @param modalConfig
121
121
  */
122
- declare function useReferralInteraction({ contentId, modalConfig, }?: {
123
- contentId?: Hex;
122
+ declare function useReferralInteraction({ productId, modalConfig, }?: {
123
+ productId?: Hex;
124
124
  modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
125
125
  }): ReferralState;
126
126
 
@@ -1,13 +1,13 @@
1
1
  import * as react from 'react';
2
2
  import { PropsWithChildren, CSSProperties, ReactNode } from 'react';
3
- import { f as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, c as SendTransactionReturnType, a as SiweAuthenticateReturnType, D as DisplayModalParamsType, d as ModalStepTypes, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../client-B6_BIGc3.js';
3
+ import { f as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, c as SendTransactionReturnType, a as SiweAuthenticateReturnType, D as DisplayModalParamsType, d as ModalStepTypes, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../client-DJd7-ajw.js';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { UseMutationOptions } from '@tanstack/react-query';
6
6
  import * as viem from 'viem';
7
7
  import { Hex } from 'viem';
8
8
  import { F as FrakRpcError } from '../error-C4Zm5nQe.js';
9
- import { b as SendTransactionParams, S as SiweAuthenticateModalParams } from '../sendTransaction-BHqCq_9X.js';
10
- import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-D3-M3nBh.js';
9
+ import { b as SendTransactionParams, S as SiweAuthenticateModalParams } from '../sendTransaction-fLvpfqaQ.js';
10
+ import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-BngPoHA0.js';
11
11
  import 'viem/chains';
12
12
  import 'viem/siwe';
13
13
 
@@ -116,11 +116,11 @@ type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-sessi
116
116
  /**
117
117
  * Helper hook to automatically submit a referral interaction when detected
118
118
  * -> And automatically set the referral context in the url
119
- * @param contentId
119
+ * @param productId
120
120
  * @param modalConfig
121
121
  */
122
- declare function useReferralInteraction({ contentId, modalConfig, }?: {
123
- contentId?: Hex;
122
+ declare function useReferralInteraction({ productId, modalConfig, }?: {
123
+ productId?: Hex;
124
124
  modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
125
125
  }): ReferralState;
126
126
 
@@ -7,7 +7,7 @@ import {
7
7
  compressJson,
8
8
  createIFrameNexusClient,
9
9
  decompressJson
10
- } from "../chunk-HXVDI2IY.js";
10
+ } from "../chunk-5LZQXBFJ.js";
11
11
  import {
12
12
  displayModal,
13
13
  openSso,
@@ -15,10 +15,11 @@ import {
15
15
  sendTransaction,
16
16
  siweAuthenticate,
17
17
  watchWalletStatus
18
- } from "../chunk-5CFD5FM2.js";
18
+ } from "../chunk-S223FMEJ.js";
19
19
  import {
20
20
  ReferralInteractionEncoder
21
- } from "../chunk-GUDT2W6I.js";
21
+ } from "../chunk-IH3QWPWT.js";
22
+ import "../chunk-22T2NHQK.js";
22
23
  import "../chunk-PKBMQBKP.js";
23
24
 
24
25
  // src/react/provider/NexusConfigProvider.ts
@@ -260,7 +261,7 @@ function useNexusContext() {
260
261
 
261
262
  // src/react/hook/helper/useReferralInteraction.ts
262
263
  function useReferralInteraction({
263
- contentId,
264
+ productId,
264
265
  modalConfig
265
266
  } = {}) {
266
267
  const { nexusContext, updateContextAsync } = useNexusContext();
@@ -272,9 +273,7 @@ function useReferralInteraction({
272
273
  });
273
274
  const processReferral = useCallback2(async () => {
274
275
  try {
275
- let currentWallet = await ensureWalletConnected({
276
- autoDisplay: false
277
- });
276
+ let currentWallet = walletStatus?.key === "connected" ? walletStatus.wallet : void 0;
278
277
  if (!nexusContext?.r) {
279
278
  if (currentWallet) {
280
279
  await updateContextAsync({ r: currentWallet });
@@ -282,9 +281,7 @@ function useReferralInteraction({
282
281
  return "no-referrer";
283
282
  }
284
283
  if (!currentWallet) {
285
- currentWallet = await ensureWalletConnected({
286
- autoDisplay: true
287
- });
284
+ currentWallet = await ensureWalletConnected();
288
285
  }
289
286
  if (currentWallet && isAddressEqual(nexusContext.r, currentWallet)) {
290
287
  return "self-referral";
@@ -292,7 +289,7 @@ function useReferralInteraction({
292
289
  const interaction = ReferralInteractionEncoder.referred({
293
290
  referrer: nexusContext.r
294
291
  });
295
- await sendInteraction2({ contentId, interaction });
292
+ await sendInteraction2({ productId, interaction });
296
293
  if (currentWallet) {
297
294
  await updateContextAsync({ r: currentWallet });
298
295
  }
@@ -302,10 +299,11 @@ function useReferralInteraction({
302
299
  }
303
300
  }, [
304
301
  nexusContext,
305
- contentId,
302
+ productId,
306
303
  ensureWalletConnected,
307
304
  sendInteraction2,
308
- updateContextAsync
305
+ updateContextAsync,
306
+ walletStatus
309
307
  ]);
310
308
  const {
311
309
  data: referralState,
@@ -334,19 +332,16 @@ function useEnsureWalletConnected({
334
332
  walletStatus
335
333
  }) {
336
334
  const { mutateAsync: displayModal2 } = useDisplayModal();
337
- return useCallback2(
338
- async ({ autoDisplay }) => {
339
- if (walletStatus?.key !== "connected" || !walletStatus.interactionSession) {
340
- if (!(modalConfig && autoDisplay)) {
341
- return void 0;
342
- }
343
- const result = await displayModal2(modalConfig);
344
- return result?.login?.wallet ?? void 0;
335
+ return useCallback2(async () => {
336
+ if (walletStatus?.key !== "connected" || !walletStatus.interactionSession) {
337
+ if (!modalConfig) {
338
+ return void 0;
345
339
  }
346
- return walletStatus.wallet ?? void 0;
347
- },
348
- [walletStatus, modalConfig, displayModal2]
349
- );
340
+ const result = await displayModal2(modalConfig);
341
+ return result?.login?.wallet ?? void 0;
342
+ }
343
+ return walletStatus.wallet ?? void 0;
344
+ }, [walletStatus, modalConfig, displayModal2]);
350
345
  }
351
346
  function mapErrorToState(error) {
352
347
  if (error instanceof FrakRpcError) {
@@ -1,4 +1,4 @@
1
- import { S as SiweAuthenticationParams, M as ModalRpcMetadata, N as NexusClient, a as SiweAuthenticateReturnType, b as SendTransactionModalStepType, c as SendTransactionReturnType } from './client-Oily5ph8.cjs';
1
+ import { S as SiweAuthenticationParams, M as ModalRpcMetadata, N as NexusClient, a as SiweAuthenticateReturnType, b as SendTransactionModalStepType, c as SendTransactionReturnType } from './client-DXITs1Kf.cjs';
2
2
 
3
3
  /**
4
4
  * Partial SIWE params, since we can rebuild them from the SDK if they are empty
@@ -1,4 +1,4 @@
1
- import { S as SiweAuthenticationParams, M as ModalRpcMetadata, N as NexusClient, a as SiweAuthenticateReturnType, b as SendTransactionModalStepType, c as SendTransactionReturnType } from './client-B6_BIGc3.js';
1
+ import { S as SiweAuthenticationParams, M as ModalRpcMetadata, N as NexusClient, a as SiweAuthenticateReturnType, b as SendTransactionModalStepType, c as SendTransactionReturnType } from './client-DJd7-ajw.js';
2
2
 
3
3
  /**
4
4
  * Partial SIWE params, since we can rebuild them from the SDK if they are empty
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "0.0.12",
14
+ "version": "0.0.14",
15
15
  "description": "Nexus Wallet client SDK, helping any person to interact with the Frak wallet, and require the unlock of a premium article within the Frak ecosystem.",
16
16
  "repository": {
17
17
  "url": "https://github.com/frak-id/wallet",
@@ -81,9 +81,9 @@
81
81
  "js-sha256": "^0.11.0"
82
82
  },
83
83
  "devDependencies": {
84
- "@tanstack/react-query": ">=5.51.15",
84
+ "@tanstack/react-query": ">=5.53.3",
85
85
  "@types/node": "^22",
86
- "tsup": "^8.2.3",
86
+ "tsup": "^8.2.4",
87
87
  "typescript": "^5"
88
88
  }
89
89
  }