@frak-labs/nexus-sdk 0.0.8 → 0.0.9

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.
@@ -4,18 +4,18 @@
4
4
 
5
5
 
6
6
 
7
- var _chunk2XUJYDD3cjs = require('./chunk-2XUJYDD3.cjs');
7
+ var _chunkZOLP2FJZcjs = require('./chunk-ZOLP2FJZ.cjs');
8
8
 
9
9
  // src/core/utils/Deferred.ts
10
10
  var Deferred = class {
11
11
  constructor() {
12
- _chunk2XUJYDD3cjs.__publicField.call(void 0, this, "_promise");
13
- _chunk2XUJYDD3cjs.__publicField.call(void 0, this, "_resolve");
14
- _chunk2XUJYDD3cjs.__publicField.call(void 0, this, "_reject");
15
- _chunk2XUJYDD3cjs.__publicField.call(void 0, this, "resolve", (value) => {
12
+ _chunkZOLP2FJZcjs.__publicField.call(void 0, this, "_promise");
13
+ _chunkZOLP2FJZcjs.__publicField.call(void 0, this, "_resolve");
14
+ _chunkZOLP2FJZcjs.__publicField.call(void 0, this, "_reject");
15
+ _chunkZOLP2FJZcjs.__publicField.call(void 0, this, "resolve", (value) => {
16
16
  _optionalChain([this, 'access', _ => _._resolve, 'optionalCall', _2 => _2(value)]);
17
17
  });
18
- _chunk2XUJYDD3cjs.__publicField.call(void 0, this, "reject", (reason) => {
18
+ _chunkZOLP2FJZcjs.__publicField.call(void 0, this, "reject", (reason) => {
19
19
  _optionalChain([this, 'access', _3 => _3._reject, 'optionalCall', _4 => _4(reason)]);
20
20
  });
21
21
  this._promise = new Promise((resolve, reject) => {
@@ -109,18 +109,18 @@ function createIFrameNexusClient({
109
109
  throw new Error("The iframe provider isn't connected yet");
110
110
  }
111
111
  const result = new Deferred();
112
- const resultCompressionKeyProvider = _chunk2XUJYDD3cjs.getIFrameResponseKeyProvider.call(void 0, args);
112
+ const resultCompressionKeyProvider = _chunkZOLP2FJZcjs.getIFrameResponseKeyProvider.call(void 0, args);
113
113
  const channelId = channelManager.createChannel(async (message) => {
114
- const decompressed = await _chunk2XUJYDD3cjs.decompressDataAndCheckHash.call(void 0,
114
+ const decompressed = await _chunkZOLP2FJZcjs.decompressDataAndCheckHash.call(void 0,
115
115
  message.data,
116
116
  resultCompressionKeyProvider
117
117
  );
118
118
  result.resolve(decompressed);
119
119
  channelManager.removeChannel(channelId);
120
120
  });
121
- const compressedMessage = await _chunk2XUJYDD3cjs.hashAndCompressData.call(void 0,
121
+ const compressedMessage = await _chunkZOLP2FJZcjs.hashAndCompressData.call(void 0,
122
122
  args,
123
- _chunk2XUJYDD3cjs.iFrameRequestKeyProvider
123
+ _chunkZOLP2FJZcjs.iFrameRequestKeyProvider
124
124
  );
125
125
  messageHandler.sendEvent({
126
126
  id: channelId,
@@ -134,17 +134,17 @@ function createIFrameNexusClient({
134
134
  if (!isConnected) {
135
135
  throw new Error("The iframe provider isn't connected yet");
136
136
  }
137
- const resultCompressionKeyProvider = _chunk2XUJYDD3cjs.getIFrameResponseKeyProvider.call(void 0, args);
137
+ const resultCompressionKeyProvider = _chunkZOLP2FJZcjs.getIFrameResponseKeyProvider.call(void 0, args);
138
138
  const channelId = channelManager.createChannel(async (message) => {
139
- const decompressed = await _chunk2XUJYDD3cjs.decompressDataAndCheckHash.call(void 0,
139
+ const decompressed = await _chunkZOLP2FJZcjs.decompressDataAndCheckHash.call(void 0,
140
140
  message.data,
141
141
  resultCompressionKeyProvider
142
142
  );
143
143
  callback(decompressed);
144
144
  });
145
- const compressedMessage = await _chunk2XUJYDD3cjs.hashAndCompressData.call(void 0,
145
+ const compressedMessage = await _chunkZOLP2FJZcjs.hashAndCompressData.call(void 0,
146
146
  args,
147
- _chunk2XUJYDD3cjs.iFrameRequestKeyProvider
147
+ _chunkZOLP2FJZcjs.iFrameRequestKeyProvider
148
148
  );
149
149
  messageHandler.sendEvent({
150
150
  id: channelId,
@@ -3,7 +3,7 @@ import {
3
3
  getRedirectResponseResponseKeyProvider,
4
4
  hashAndCompressData,
5
5
  redirectRequestKeyProvider
6
- } from "./chunk-5QWG35A2.js";
6
+ } from "./chunk-VK7GPKK4.js";
7
7
 
8
8
  // src/core/actions/getUnlockOptions.ts
9
9
  function getArticleUnlockOptions(client, { articleId, contentId }) {
@@ -65,10 +65,22 @@ async function decodeStartUnlockReturn({
65
65
  );
66
66
  }
67
67
 
68
+ // src/core/actions/setUserReferred.ts
69
+ function setUserReferred(client, { contentId, walletAddress }, callback) {
70
+ return client.listenerRequest(
71
+ {
72
+ method: "frak_listenToSetUserReferred",
73
+ params: [contentId, walletAddress]
74
+ },
75
+ callback
76
+ );
77
+ }
78
+
68
79
  export {
69
80
  getArticleUnlockOptions,
70
81
  watchUnlockStatus,
71
82
  watchWalletStatus,
72
83
  getStartArticleUnlockUrl,
73
- decodeStartUnlockReturn
84
+ decodeStartUnlockReturn,
85
+ setUserReferred
74
86
  };
@@ -4,7 +4,7 @@ import {
4
4
  getIFrameResponseKeyProvider,
5
5
  hashAndCompressData,
6
6
  iFrameRequestKeyProvider
7
- } from "./chunk-5QWG35A2.js";
7
+ } from "./chunk-VK7GPKK4.js";
8
8
 
9
9
  // src/core/utils/Deferred.ts
10
10
  var Deferred = class {
@@ -74,6 +74,9 @@ var iFrameRequestKeyProvider = (args) => {
74
74
  if (args.method === "frak_listenToArticleUnlockStatus") {
75
75
  return ["article-unlock-status", args.params[0], args.params[1]];
76
76
  }
77
+ if (args.method === "frak_listenToSetUserReferred") {
78
+ return ["user-referred", args.params[0], args.params[1]];
79
+ }
77
80
  throw new Error(`No key provider found for the arguments ${args}`);
78
81
  };
79
82
  function getIFrameResponseKeyProvider(param) {
@@ -97,6 +100,12 @@ function getIFrameResponseKeyProvider(param) {
97
100
  response.key === "valid" ? response.allowedUntil.toString(16) : "deadbeef"
98
101
  ];
99
102
  }
103
+ if (param.method === "frak_listenToSetUserReferred") {
104
+ return (response) => [
105
+ "user-referred",
106
+ response.key
107
+ ];
108
+ }
100
109
  throw new Error(`No key provider found for the request ${param}`);
101
110
  }
102
111
 
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunk2XUJYDD3cjs = require('./chunk-2XUJYDD3.cjs');
6
+ var _chunkZOLP2FJZcjs = require('./chunk-ZOLP2FJZ.cjs');
7
7
 
8
8
  // src/core/actions/getUnlockOptions.ts
9
9
  function getArticleUnlockOptions(client, { articleId, contentId }) {
@@ -36,12 +36,12 @@ function watchWalletStatus(client, callback) {
36
36
 
37
37
  // src/core/actions/startUnlock.ts
38
38
  async function getStartArticleUnlockUrl(config, params) {
39
- const { compressed, compressedHash } = await _chunk2XUJYDD3cjs.hashAndCompressData.call(void 0,
39
+ const { compressed, compressedHash } = await _chunkZOLP2FJZcjs.hashAndCompressData.call(void 0,
40
40
  {
41
41
  method: "frak_startArticleUnlock",
42
42
  params
43
43
  },
44
- _chunk2XUJYDD3cjs.redirectRequestKeyProvider
44
+ _chunkZOLP2FJZcjs.redirectRequestKeyProvider
45
45
  );
46
46
  const outputUrl = new URL(config.walletUrl);
47
47
  outputUrl.pathname = "/paywall";
@@ -53,10 +53,10 @@ async function decodeStartUnlockReturn({
53
53
  result,
54
54
  hash
55
55
  }) {
56
- const keyProvider = _chunk2XUJYDD3cjs.getRedirectResponseResponseKeyProvider.call(void 0,
56
+ const keyProvider = _chunkZOLP2FJZcjs.getRedirectResponseResponseKeyProvider.call(void 0,
57
57
  "frak_startArticleUnlock"
58
58
  );
59
- return _chunk2XUJYDD3cjs.decompressDataAndCheckHash.call(void 0,
59
+ return _chunkZOLP2FJZcjs.decompressDataAndCheckHash.call(void 0,
60
60
  {
61
61
  compressed: decodeURIComponent(result),
62
62
  compressedHash: decodeURIComponent(hash)
@@ -65,10 +65,22 @@ async function decodeStartUnlockReturn({
65
65
  );
66
66
  }
67
67
 
68
+ // src/core/actions/setUserReferred.ts
69
+ function setUserReferred(client, { contentId, walletAddress }, callback) {
70
+ return client.listenerRequest(
71
+ {
72
+ method: "frak_listenToSetUserReferred",
73
+ params: [contentId, walletAddress]
74
+ },
75
+ callback
76
+ );
77
+ }
78
+
79
+
68
80
 
69
81
 
70
82
 
71
83
 
72
84
 
73
85
 
74
- exports.getArticleUnlockOptions = getArticleUnlockOptions; exports.watchUnlockStatus = watchUnlockStatus; exports.watchWalletStatus = watchWalletStatus; exports.getStartArticleUnlockUrl = getStartArticleUnlockUrl; exports.decodeStartUnlockReturn = decodeStartUnlockReturn;
86
+ exports.getArticleUnlockOptions = getArticleUnlockOptions; exports.watchUnlockStatus = watchUnlockStatus; exports.watchWalletStatus = watchWalletStatus; exports.getStartArticleUnlockUrl = getStartArticleUnlockUrl; exports.decodeStartUnlockReturn = decodeStartUnlockReturn; exports.setUserReferred = setUserReferred;
@@ -74,6 +74,9 @@ var iFrameRequestKeyProvider = (args) => {
74
74
  if (args.method === "frak_listenToArticleUnlockStatus") {
75
75
  return ["article-unlock-status", args.params[0], args.params[1]];
76
76
  }
77
+ if (args.method === "frak_listenToSetUserReferred") {
78
+ return ["user-referred", args.params[0], args.params[1]];
79
+ }
77
80
  throw new Error(`No key provider found for the arguments ${args}`);
78
81
  };
79
82
  function getIFrameResponseKeyProvider(param) {
@@ -97,6 +100,12 @@ function getIFrameResponseKeyProvider(param) {
97
100
  response.key === "valid" ? response.allowedUntil.toString(16) : "deadbeef"
98
101
  ];
99
102
  }
103
+ if (param.method === "frak_listenToSetUserReferred") {
104
+ return (response) => [
105
+ "user-referred",
106
+ response.key
107
+ ];
108
+ }
100
109
  throw new Error(`No key provider found for the request ${param}`);
101
110
  }
102
111
 
@@ -11,6 +11,26 @@ type NexusWalletSdkConfig = Readonly<{
11
11
  };
12
12
  }>;
13
13
 
14
+ /**
15
+ * Parameters of the referred request
16
+ */
17
+ type SetUserReferredParams = Readonly<{
18
+ contentId: Hex;
19
+ }>;
20
+ /**
21
+ * Return type of the referred request
22
+ */
23
+ type SetUserReferredReturnType = UserIsSameWallet | UserReferredSuccessful | UserReferredHistory;
24
+ type UserIsSameWallet = {
25
+ key: "same-wallet";
26
+ };
27
+ type UserReferredSuccessful = {
28
+ key: "referred-successful";
29
+ };
30
+ type UserReferredHistory = {
31
+ key: "referred-history";
32
+ };
33
+
14
34
  type PaidArticleUnlockPrice = Readonly<{
15
35
  index: number;
16
36
  unlockDurationInSec: number;
@@ -150,6 +170,14 @@ type IFrameRpcSchema = [
150
170
  Method: "frak_listenToArticleUnlockStatus";
151
171
  Parameters: [contentId: Hex, articleId: Hex];
152
172
  ReturnType: ArticleUnlockStatusReturnType;
173
+ },
174
+ /**
175
+ * Method used to set the referred user
176
+ */
177
+ {
178
+ Method: "frak_listenToSetUserReferred";
179
+ Parameters: [contentId: Hex, walletAddress: Address];
180
+ ReturnType: SetUserReferredReturnType;
153
181
  }
154
182
  ];
155
183
  /**
@@ -247,4 +275,4 @@ type NexusClient = {
247
275
  config: NexusWalletSdkConfig;
248
276
  } & IFrameTransport;
249
277
 
250
- export type { ArticleUnlockStatusReturnType as A, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, NexusClient as N, PaidArticleUnlockPrice as P, RedirectRpcSchema as R, StartArticleUnlockReturnType as S, UnlockOptionsReturnType as U, WalletStatusReturnType as W, NexusWalletSdkConfig as a, StartArticleUnlockParams as b, ExtractedReturnTypeFromRpc as c, IFrameTransport as d, IFrameRpcEvent as e, IFrameEvent as f };
278
+ export type { ArticleUnlockStatusReturnType as A, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, NexusClient as N, PaidArticleUnlockPrice as P, RedirectRpcSchema as R, StartArticleUnlockReturnType as S, UnlockOptionsReturnType as U, WalletStatusReturnType as W, NexusWalletSdkConfig as a, StartArticleUnlockParams as b, SetUserReferredReturnType as c, ExtractedReturnTypeFromRpc as d, SetUserReferredParams as e, IFrameTransport as f, IFrameRpcEvent as g, IFrameEvent as h };
@@ -11,6 +11,26 @@ type NexusWalletSdkConfig = Readonly<{
11
11
  };
12
12
  }>;
13
13
 
14
+ /**
15
+ * Parameters of the referred request
16
+ */
17
+ type SetUserReferredParams = Readonly<{
18
+ contentId: Hex;
19
+ }>;
20
+ /**
21
+ * Return type of the referred request
22
+ */
23
+ type SetUserReferredReturnType = UserIsSameWallet | UserReferredSuccessful | UserReferredHistory;
24
+ type UserIsSameWallet = {
25
+ key: "same-wallet";
26
+ };
27
+ type UserReferredSuccessful = {
28
+ key: "referred-successful";
29
+ };
30
+ type UserReferredHistory = {
31
+ key: "referred-history";
32
+ };
33
+
14
34
  type PaidArticleUnlockPrice = Readonly<{
15
35
  index: number;
16
36
  unlockDurationInSec: number;
@@ -150,6 +170,14 @@ type IFrameRpcSchema = [
150
170
  Method: "frak_listenToArticleUnlockStatus";
151
171
  Parameters: [contentId: Hex, articleId: Hex];
152
172
  ReturnType: ArticleUnlockStatusReturnType;
173
+ },
174
+ /**
175
+ * Method used to set the referred user
176
+ */
177
+ {
178
+ Method: "frak_listenToSetUserReferred";
179
+ Parameters: [contentId: Hex, walletAddress: Address];
180
+ ReturnType: SetUserReferredReturnType;
153
181
  }
154
182
  ];
155
183
  /**
@@ -247,4 +275,4 @@ type NexusClient = {
247
275
  config: NexusWalletSdkConfig;
248
276
  } & IFrameTransport;
249
277
 
250
- export type { ArticleUnlockStatusReturnType as A, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, NexusClient as N, PaidArticleUnlockPrice as P, RedirectRpcSchema as R, StartArticleUnlockReturnType as S, UnlockOptionsReturnType as U, WalletStatusReturnType as W, NexusWalletSdkConfig as a, StartArticleUnlockParams as b, ExtractedReturnTypeFromRpc as c, IFrameTransport as d, IFrameRpcEvent as e, IFrameEvent as f };
278
+ export type { ArticleUnlockStatusReturnType as A, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, NexusClient as N, PaidArticleUnlockPrice as P, RedirectRpcSchema as R, StartArticleUnlockReturnType as S, UnlockOptionsReturnType as U, WalletStatusReturnType as W, NexusWalletSdkConfig as a, StartArticleUnlockParams as b, SetUserReferredReturnType as c, ExtractedReturnTypeFromRpc as d, SetUserReferredParams as e, IFrameTransport as f, IFrameRpcEvent as g, IFrameEvent as h };
@@ -4,12 +4,14 @@
4
4
 
5
5
 
6
6
 
7
- var _chunk6V4UCVTDcjs = require('../../chunk-6V4UCVTD.cjs');
8
- require('../../chunk-2XUJYDD3.cjs');
9
7
 
8
+ var _chunkX4JNNWJ4cjs = require('../../chunk-X4JNNWJ4.cjs');
9
+ require('../../chunk-ZOLP2FJZ.cjs');
10
10
 
11
11
 
12
12
 
13
13
 
14
14
 
15
- exports.decodeStartUnlockReturn = _chunk6V4UCVTDcjs.decodeStartUnlockReturn; exports.getArticleUnlockOptions = _chunk6V4UCVTDcjs.getArticleUnlockOptions; exports.getStartArticleUnlockUrl = _chunk6V4UCVTDcjs.getStartArticleUnlockUrl; exports.watchUnlockStatus = _chunk6V4UCVTDcjs.watchUnlockStatus; exports.watchWalletStatus = _chunk6V4UCVTDcjs.watchWalletStatus;
15
+
16
+
17
+ exports.decodeStartUnlockReturn = _chunkX4JNNWJ4cjs.decodeStartUnlockReturn; exports.getArticleUnlockOptions = _chunkX4JNNWJ4cjs.getArticleUnlockOptions; exports.getStartArticleUnlockUrl = _chunkX4JNNWJ4cjs.getStartArticleUnlockUrl; exports.setUserReferred = _chunkX4JNNWJ4cjs.setUserReferred; exports.watchUnlockStatus = _chunkX4JNNWJ4cjs.watchUnlockStatus; exports.watchWalletStatus = _chunkX4JNNWJ4cjs.watchWalletStatus;
@@ -1,6 +1,6 @@
1
- export { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams, g as getArticleUnlockOptions, w as watchUnlockStatus } from '../../watchUnlockStatus-DqWkImYK.cjs';
2
- import { N as NexusClient, W as WalletStatusReturnType, a as NexusWalletSdkConfig, S as StartArticleUnlockReturnType, b as StartArticleUnlockParams } from '../../client-MgLVRfPw.cjs';
3
- import 'viem';
1
+ export { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams, g as getArticleUnlockOptions, w as watchUnlockStatus } from '../../watchUnlockStatus-DXClCYH9.cjs';
2
+ import { N as NexusClient, W as WalletStatusReturnType, a as NexusWalletSdkConfig, S as StartArticleUnlockReturnType, b as StartArticleUnlockParams, c as SetUserReferredReturnType } from '../../client-BwzXSgqQ.cjs';
3
+ import { Hex, Address } from 'viem';
4
4
  import 'viem/chains';
5
5
 
6
6
  /**
@@ -27,4 +27,20 @@ declare function decodeStartUnlockReturn({ result, hash, }: {
27
27
  validationHash: string;
28
28
  }>>;
29
29
 
30
- export { decodeStartUnlockReturn, getStartArticleUnlockUrl, watchWalletStatus };
30
+ /**
31
+ * Type used to get the user referred options
32
+ */
33
+ type SetUserReferredParams = {
34
+ contentId: Hex;
35
+ walletAddress: Address;
36
+ };
37
+ /**
38
+ * Function used to watch a current user referred
39
+ * @param client
40
+ * @param contentId
41
+ * @param walletAddress
42
+ * @param callback
43
+ */
44
+ declare function setUserReferred(client: NexusClient, { contentId, walletAddress }: SetUserReferredParams, callback: (status: SetUserReferredReturnType) => void): Promise<void>;
45
+
46
+ export { decodeStartUnlockReturn, getStartArticleUnlockUrl, setUserReferred, watchWalletStatus };
@@ -1,6 +1,6 @@
1
- export { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams, g as getArticleUnlockOptions, w as watchUnlockStatus } from '../../watchUnlockStatus-DQYfUj46.js';
2
- import { N as NexusClient, W as WalletStatusReturnType, a as NexusWalletSdkConfig, S as StartArticleUnlockReturnType, b as StartArticleUnlockParams } from '../../client-MgLVRfPw.js';
3
- import 'viem';
1
+ export { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams, g as getArticleUnlockOptions, w as watchUnlockStatus } from '../../watchUnlockStatus-WJxoDliF.js';
2
+ import { N as NexusClient, W as WalletStatusReturnType, a as NexusWalletSdkConfig, S as StartArticleUnlockReturnType, b as StartArticleUnlockParams, c as SetUserReferredReturnType } from '../../client-BwzXSgqQ.js';
3
+ import { Hex, Address } from 'viem';
4
4
  import 'viem/chains';
5
5
 
6
6
  /**
@@ -27,4 +27,20 @@ declare function decodeStartUnlockReturn({ result, hash, }: {
27
27
  validationHash: string;
28
28
  }>>;
29
29
 
30
- export { decodeStartUnlockReturn, getStartArticleUnlockUrl, watchWalletStatus };
30
+ /**
31
+ * Type used to get the user referred options
32
+ */
33
+ type SetUserReferredParams = {
34
+ contentId: Hex;
35
+ walletAddress: Address;
36
+ };
37
+ /**
38
+ * Function used to watch a current user referred
39
+ * @param client
40
+ * @param contentId
41
+ * @param walletAddress
42
+ * @param callback
43
+ */
44
+ declare function setUserReferred(client: NexusClient, { contentId, walletAddress }: SetUserReferredParams, callback: (status: SetUserReferredReturnType) => void): Promise<void>;
45
+
46
+ export { decodeStartUnlockReturn, getStartArticleUnlockUrl, setUserReferred, watchWalletStatus };
@@ -2,14 +2,16 @@ import {
2
2
  decodeStartUnlockReturn,
3
3
  getArticleUnlockOptions,
4
4
  getStartArticleUnlockUrl,
5
+ setUserReferred,
5
6
  watchUnlockStatus,
6
7
  watchWalletStatus
7
- } from "../../chunk-4VFMYMTH.js";
8
- import "../../chunk-5QWG35A2.js";
8
+ } from "../../chunk-PDR3CF3P.js";
9
+ import "../../chunk-VK7GPKK4.js";
9
10
  export {
10
11
  decodeStartUnlockReturn,
11
12
  getArticleUnlockOptions,
12
13
  getStartArticleUnlockUrl,
14
+ setUserReferred,
13
15
  watchUnlockStatus,
14
16
  watchWalletStatus
15
17
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJXQKTLEEcjs = require('../chunk-JXQKTLEE.cjs');
3
+ var _chunkAYZHGMEVcjs = require('../chunk-AYZHGMEV.cjs');
4
4
 
5
5
 
6
6
 
@@ -9,7 +9,7 @@ var _chunkJXQKTLEEcjs = require('../chunk-JXQKTLEE.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunk2XUJYDD3cjs = require('../chunk-2XUJYDD3.cjs');
12
+ var _chunkZOLP2FJZcjs = require('../chunk-ZOLP2FJZ.cjs');
13
13
 
14
14
 
15
15
 
@@ -19,4 +19,4 @@ var _chunk2XUJYDD3cjs = require('../chunk-2XUJYDD3.cjs');
19
19
 
20
20
 
21
21
 
22
- exports.createIFrameNexusClient = _chunkJXQKTLEEcjs.createIFrameNexusClient; exports.createIframe = _chunk2XUJYDD3cjs.createIframe; exports.decompressDataAndCheckHash = _chunk2XUJYDD3cjs.decompressDataAndCheckHash; exports.getIFrameResponseKeyProvider = _chunk2XUJYDD3cjs.getIFrameResponseKeyProvider; exports.getRedirectResponseResponseKeyProvider = _chunk2XUJYDD3cjs.getRedirectResponseResponseKeyProvider; exports.hashAndCompressData = _chunk2XUJYDD3cjs.hashAndCompressData; exports.iFrameRequestKeyProvider = _chunk2XUJYDD3cjs.iFrameRequestKeyProvider; exports.redirectRequestKeyProvider = _chunk2XUJYDD3cjs.redirectRequestKeyProvider;
22
+ exports.createIFrameNexusClient = _chunkAYZHGMEVcjs.createIFrameNexusClient; exports.createIframe = _chunkZOLP2FJZcjs.createIframe; exports.decompressDataAndCheckHash = _chunkZOLP2FJZcjs.decompressDataAndCheckHash; exports.getIFrameResponseKeyProvider = _chunkZOLP2FJZcjs.getIFrameResponseKeyProvider; exports.getRedirectResponseResponseKeyProvider = _chunkZOLP2FJZcjs.getRedirectResponseResponseKeyProvider; exports.hashAndCompressData = _chunkZOLP2FJZcjs.hashAndCompressData; exports.iFrameRequestKeyProvider = _chunkZOLP2FJZcjs.iFrameRequestKeyProvider; exports.redirectRequestKeyProvider = _chunkZOLP2FJZcjs.redirectRequestKeyProvider;
@@ -1,5 +1,5 @@
1
- import { a as NexusWalletSdkConfig, N as NexusClient, E as ExtractedParametersFromRpc, I as IFrameRpcSchema, c as ExtractedReturnTypeFromRpc, R as RedirectRpcSchema } from '../client-MgLVRfPw.cjs';
2
- export { A as ArticleUnlockStatusReturnType, f as IFrameEvent, e as IFrameRpcEvent, d as IFrameTransport, P as PaidArticleUnlockPrice, b as StartArticleUnlockParams, S as StartArticleUnlockReturnType, U as UnlockOptionsReturnType, W as WalletStatusReturnType } from '../client-MgLVRfPw.cjs';
1
+ import { a as NexusWalletSdkConfig, N as NexusClient, E as ExtractedParametersFromRpc, I as IFrameRpcSchema, d as ExtractedReturnTypeFromRpc, R as RedirectRpcSchema } from '../client-BwzXSgqQ.cjs';
2
+ export { A as ArticleUnlockStatusReturnType, h as IFrameEvent, g as IFrameRpcEvent, f as IFrameTransport, P as PaidArticleUnlockPrice, e as SetUserReferredParams, c as SetUserReferredReturnType, b as StartArticleUnlockParams, S as StartArticleUnlockReturnType, U as UnlockOptionsReturnType, W as WalletStatusReturnType } from '../client-BwzXSgqQ.cjs';
3
3
  import 'viem';
4
4
  import 'viem/chains';
5
5
 
@@ -1,5 +1,5 @@
1
- import { a as NexusWalletSdkConfig, N as NexusClient, E as ExtractedParametersFromRpc, I as IFrameRpcSchema, c as ExtractedReturnTypeFromRpc, R as RedirectRpcSchema } from '../client-MgLVRfPw.js';
2
- export { A as ArticleUnlockStatusReturnType, f as IFrameEvent, e as IFrameRpcEvent, d as IFrameTransport, P as PaidArticleUnlockPrice, b as StartArticleUnlockParams, S as StartArticleUnlockReturnType, U as UnlockOptionsReturnType, W as WalletStatusReturnType } from '../client-MgLVRfPw.js';
1
+ import { a as NexusWalletSdkConfig, N as NexusClient, E as ExtractedParametersFromRpc, I as IFrameRpcSchema, d as ExtractedReturnTypeFromRpc, R as RedirectRpcSchema } from '../client-BwzXSgqQ.js';
2
+ export { A as ArticleUnlockStatusReturnType, h as IFrameEvent, g as IFrameRpcEvent, f as IFrameTransport, P as PaidArticleUnlockPrice, e as SetUserReferredParams, c as SetUserReferredReturnType, b as StartArticleUnlockParams, S as StartArticleUnlockReturnType, U as UnlockOptionsReturnType, W as WalletStatusReturnType } from '../client-BwzXSgqQ.js';
3
3
  import 'viem';
4
4
  import 'viem/chains';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createIFrameNexusClient
3
- } from "../chunk-OXP3VK26.js";
3
+ } from "../chunk-SZUN32YC.js";
4
4
  import {
5
5
  createIframe,
6
6
  decompressDataAndCheckHash,
@@ -9,7 +9,7 @@ import {
9
9
  hashAndCompressData,
10
10
  iFrameRequestKeyProvider,
11
11
  redirectRequestKeyProvider
12
- } from "../chunk-5QWG35A2.js";
12
+ } from "../chunk-VK7GPKK4.js";
13
13
  export {
14
14
  createIFrameNexusClient,
15
15
  createIframe,
@@ -1,12 +1,13 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkJXQKTLEEcjs = require('../chunk-JXQKTLEE.cjs');
3
+ var _chunkAYZHGMEVcjs = require('../chunk-AYZHGMEV.cjs');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunk6V4UCVTDcjs = require('../chunk-6V4UCVTD.cjs');
9
- require('../chunk-2XUJYDD3.cjs');
8
+
9
+ var _chunkX4JNNWJ4cjs = require('../chunk-X4JNNWJ4.cjs');
10
+ require('../chunk-ZOLP2FJZ.cjs');
10
11
 
11
12
  // src/react/provider/NexusConfigProvider.ts
12
13
  var _react = require('react');
@@ -62,7 +63,7 @@ function useArticleUnlockOptions({
62
63
  if (!(articleId && contentId)) {
63
64
  throw new Error("No article id provided");
64
65
  }
65
- return await _chunk6V4UCVTDcjs.getArticleUnlockOptions.call(void 0, client, {
66
+ return await _chunkX4JNNWJ4cjs.getArticleUnlockOptions.call(void 0, client, {
66
67
  articleId,
67
68
  contentId
68
69
  });
@@ -88,7 +89,7 @@ function useWalletStatus() {
88
89
  gcTime: 0,
89
90
  queryKey: ["walletStatusListener"],
90
91
  queryFn: async () => {
91
- await _chunk6V4UCVTDcjs.watchWalletStatus.call(void 0, client, newStatusUpdated);
92
+ await _chunkX4JNNWJ4cjs.watchWalletStatus.call(void 0, client, newStatusUpdated);
92
93
  return { key: "waiting-response" };
93
94
  }
94
95
  });
@@ -127,7 +128,7 @@ function useArticleUnlockStatus({
127
128
  if (!(articleId && contentId)) {
128
129
  return null;
129
130
  }
130
- await _chunk6V4UCVTDcjs.watchUnlockStatus.call(void 0,
131
+ await _chunkX4JNNWJ4cjs.watchUnlockStatus.call(void 0,
131
132
  client,
132
133
  { articleId, contentId },
133
134
  newStatusUpdated
@@ -141,6 +142,113 @@ function useArticleUnlockStatus({
141
142
  });
142
143
  }
143
144
 
145
+ // src/react/hook/useNexusReferral.ts
146
+
147
+
148
+ var _viem = require('viem');
149
+
150
+ // src/react/hook/useWindowLocation.ts
151
+
152
+
153
+ // src/react/hook/useMounted.ts
154
+
155
+ function useMounted() {
156
+ const [mounted, setMounted] = _react.useState.call(void 0, false);
157
+ _react.useEffect.call(void 0, () => {
158
+ setMounted(true);
159
+ }, []);
160
+ return mounted;
161
+ }
162
+
163
+ // src/react/hook/useWindowLocation.ts
164
+ var useWindowLocation = () => {
165
+ const isMounted = useMounted();
166
+ const [location, setLocation] = _react.useState.call(void 0,
167
+ isMounted ? window.location : void 0
168
+ );
169
+ const [href, setHref] = _react.useState.call(void 0,
170
+ isMounted ? window.location.href : void 0
171
+ );
172
+ _react.useEffect.call(void 0, () => {
173
+ if (!isMounted)
174
+ return;
175
+ const setWindowLocation = () => {
176
+ setLocation(window.location);
177
+ setHref(window.location.href);
178
+ };
179
+ if (!location) {
180
+ setWindowLocation();
181
+ }
182
+ window.addEventListener("popstate", setWindowLocation);
183
+ return () => {
184
+ window.removeEventListener("popstate", setWindowLocation);
185
+ };
186
+ }, [isMounted, location]);
187
+ return { location, href };
188
+ };
189
+
190
+ // src/react/hook/useNexusReferral.ts
191
+ function useNexusReferral({ contentId }) {
192
+ const { href } = useWindowLocation();
193
+ const queryClient = _reactquery.useQueryClient.call(void 0, );
194
+ const client = useNexusClient();
195
+ const { data: walletStatus } = useWalletStatus();
196
+ const [referrerAddress, setReferrerAddress] = _react.useState.call(void 0, );
197
+ const newStatusUpdated = _react.useCallback.call(void 0,
198
+ (event) => {
199
+ queryClient.setQueryData(
200
+ ["setUserReferredQueryReturnTypeListener"],
201
+ event
202
+ );
203
+ if (event.key === "referred-successful" || event.key === "referred-history") {
204
+ if (!href)
205
+ return;
206
+ const url = new URL(href);
207
+ if (_optionalChain([walletStatus, 'optionalAccess', _ => _.key]) === "connected") {
208
+ url.searchParams.set("nexusContext", _optionalChain([walletStatus, 'optionalAccess', _2 => _2.wallet]));
209
+ }
210
+ if (_optionalChain([walletStatus, 'optionalAccess', _3 => _3.key]) === "not-connected") {
211
+ url.searchParams.delete("nexusContext");
212
+ }
213
+ window.history.replaceState(null, "", url.toString());
214
+ }
215
+ },
216
+ [queryClient, href, walletStatus]
217
+ );
218
+ _react.useEffect.call(void 0, () => {
219
+ if (!href)
220
+ return;
221
+ const url = new URL(href);
222
+ const context = url.searchParams.get("nexusContext");
223
+ if (!context && _optionalChain([walletStatus, 'optionalAccess', _4 => _4.key]) === "connected") {
224
+ url.searchParams.set("nexusContext", _optionalChain([walletStatus, 'optionalAccess', _5 => _5.wallet]));
225
+ window.history.replaceState(null, "", url.toString());
226
+ }
227
+ if (context) {
228
+ setReferrerAddress(context);
229
+ }
230
+ }, [href, walletStatus]);
231
+ return _reactquery.useQuery.call(void 0, {
232
+ gcTime: 0,
233
+ queryKey: ["setUserReferredQueryReturnTypeListener"],
234
+ queryFn: async () => {
235
+ if (!(contentId && referrerAddress)) {
236
+ return { key: "no-referrer" };
237
+ }
238
+ if (_optionalChain([walletStatus, 'optionalAccess', _6 => _6.key]) === "connected" && _optionalChain([walletStatus, 'optionalAccess', _7 => _7.wallet]) && _viem.isAddressEqual.call(void 0, _optionalChain([walletStatus, 'optionalAccess', _8 => _8.wallet]), referrerAddress)) {
239
+ return { key: "same-wallet" };
240
+ }
241
+ await _chunkX4JNNWJ4cjs.setUserReferred.call(void 0,
242
+ client,
243
+ { contentId, walletAddress: referrerAddress },
244
+ newStatusUpdated
245
+ );
246
+ return { key: "waiting-response" };
247
+ },
248
+ enabled: !!contentId && !!referrerAddress && _optionalChain([walletStatus, 'optionalAccess', _9 => _9.key]) !== void 0 && _optionalChain([walletStatus, 'optionalAccess', _10 => _10.key]) !== "waiting-response"
249
+ });
250
+ }
251
+
144
252
  // src/react/provider/NexusIFrameClientProvider.ts
145
253
  var NexusIFrameClientContext = _react.createContext.call(void 0,
146
254
  void 0
@@ -153,7 +261,7 @@ function NexusIFrameClientProvider({
153
261
  void 0
154
262
  );
155
263
  const client = _react.useMemo.call(void 0,
156
- () => iframeElem ? _chunkJXQKTLEEcjs.createIFrameNexusClient.call(void 0, { iframe: iframeElem, config }) : void 0,
264
+ () => iframeElem ? _chunkAYZHGMEVcjs.createIFrameNexusClient.call(void 0, { iframe: iframeElem, config }) : void 0,
157
265
  [iframeElem, config]
158
266
  );
159
267
  const iFrame = _react.createElement.call(void 0, "iframe", {
@@ -193,4 +301,5 @@ function NexusIFrameClientProvider({
193
301
 
194
302
 
195
303
 
196
- exports.NexusConfigContext = NexusConfigContext; exports.NexusConfigProvider = NexusConfigProvider; exports.NexusIFrameClientContext = NexusIFrameClientContext; exports.NexusIFrameClientProvider = NexusIFrameClientProvider; exports.useArticleUnlockOptions = useArticleUnlockOptions; exports.useArticleUnlockStatus = useArticleUnlockStatus; exports.useNexusClient = useNexusClient; exports.useNexusConfig = useNexusConfig; exports.useWalletStatus = useWalletStatus;
304
+
305
+ exports.NexusConfigContext = NexusConfigContext; exports.NexusConfigProvider = NexusConfigProvider; exports.NexusIFrameClientContext = NexusIFrameClientContext; exports.NexusIFrameClientProvider = NexusIFrameClientProvider; exports.useArticleUnlockOptions = useArticleUnlockOptions; exports.useArticleUnlockStatus = useArticleUnlockStatus; exports.useNexusClient = useNexusClient; exports.useNexusConfig = useNexusConfig; exports.useNexusReferral = useNexusReferral; exports.useWalletStatus = useWalletStatus;
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { PropsWithChildren, ReactNode } from 'react';
3
- import { a as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, A as ArticleUnlockStatusReturnType } from '../client-MgLVRfPw.cjs';
3
+ import { a as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, A as ArticleUnlockStatusReturnType, e as SetUserReferredParams, c as SetUserReferredReturnType } from '../client-BwzXSgqQ.cjs';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
- import { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams } from '../watchUnlockStatus-DqWkImYK.cjs';
5
+ import { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams } from '../watchUnlockStatus-DXClCYH9.cjs';
6
6
  import 'viem';
7
7
  import 'viem/chains';
8
8
 
@@ -100,4 +100,14 @@ type ArticleUnlockStatusQueryReturnType = ArticleUnlockStatusReturnType | {
100
100
  */
101
101
  declare function useArticleUnlockStatus({ articleId, contentId, }: WatchUnlockStatusParams): _tanstack_react_query.UseQueryResult<ArticleUnlockStatusQueryReturnType | null, Error>;
102
102
 
103
- export { type ArticleUnlockStatusQueryReturnType, NexusConfigContext, NexusConfigProvider, type NexusConfigProviderProps, NexusIFrameClientContext, type NexusIFrameClientProps, NexusIFrameClientProvider, type WalletStatusQueryReturnType, useArticleUnlockOptions, useArticleUnlockStatus, useNexusClient, useNexusConfig, useWalletStatus };
103
+ type SetUserReferredQueryReturnType = SetUserReferredReturnType | {
104
+ key: "waiting-response";
105
+ } | {
106
+ key: "no-referrer";
107
+ };
108
+ /**
109
+ * Use the current nexus referral
110
+ */
111
+ declare function useNexusReferral({ contentId }: SetUserReferredParams): _tanstack_react_query.UseQueryResult<SetUserReferredQueryReturnType, Error>;
112
+
113
+ export { type ArticleUnlockStatusQueryReturnType, NexusConfigContext, NexusConfigProvider, type NexusConfigProviderProps, NexusIFrameClientContext, type NexusIFrameClientProps, NexusIFrameClientProvider, type WalletStatusQueryReturnType, useArticleUnlockOptions, useArticleUnlockStatus, useNexusClient, useNexusConfig, useNexusReferral, useWalletStatus };
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { PropsWithChildren, ReactNode } from 'react';
3
- import { a as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, A as ArticleUnlockStatusReturnType } from '../client-MgLVRfPw.js';
3
+ import { a as NexusWalletSdkConfig, N as NexusClient, W as WalletStatusReturnType, A as ArticleUnlockStatusReturnType, e as SetUserReferredParams, c as SetUserReferredReturnType } from '../client-BwzXSgqQ.js';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
- import { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams } from '../watchUnlockStatus-DQYfUj46.js';
5
+ import { G as GetUnlockOptionsParams, W as WatchUnlockStatusParams } from '../watchUnlockStatus-WJxoDliF.js';
6
6
  import 'viem';
7
7
  import 'viem/chains';
8
8
 
@@ -100,4 +100,14 @@ type ArticleUnlockStatusQueryReturnType = ArticleUnlockStatusReturnType | {
100
100
  */
101
101
  declare function useArticleUnlockStatus({ articleId, contentId, }: WatchUnlockStatusParams): _tanstack_react_query.UseQueryResult<ArticleUnlockStatusQueryReturnType | null, Error>;
102
102
 
103
- export { type ArticleUnlockStatusQueryReturnType, NexusConfigContext, NexusConfigProvider, type NexusConfigProviderProps, NexusIFrameClientContext, type NexusIFrameClientProps, NexusIFrameClientProvider, type WalletStatusQueryReturnType, useArticleUnlockOptions, useArticleUnlockStatus, useNexusClient, useNexusConfig, useWalletStatus };
103
+ type SetUserReferredQueryReturnType = SetUserReferredReturnType | {
104
+ key: "waiting-response";
105
+ } | {
106
+ key: "no-referrer";
107
+ };
108
+ /**
109
+ * Use the current nexus referral
110
+ */
111
+ declare function useNexusReferral({ contentId }: SetUserReferredParams): _tanstack_react_query.UseQueryResult<SetUserReferredQueryReturnType, Error>;
112
+
113
+ export { type ArticleUnlockStatusQueryReturnType, NexusConfigContext, NexusConfigProvider, type NexusConfigProviderProps, NexusIFrameClientContext, type NexusIFrameClientProps, NexusIFrameClientProvider, type WalletStatusQueryReturnType, useArticleUnlockOptions, useArticleUnlockStatus, useNexusClient, useNexusConfig, useNexusReferral, useWalletStatus };
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  createIFrameNexusClient
3
- } from "../chunk-OXP3VK26.js";
3
+ } from "../chunk-SZUN32YC.js";
4
4
  import {
5
5
  getArticleUnlockOptions,
6
+ setUserReferred,
6
7
  watchUnlockStatus,
7
8
  watchWalletStatus
8
- } from "../chunk-4VFMYMTH.js";
9
- import "../chunk-5QWG35A2.js";
9
+ } from "../chunk-PDR3CF3P.js";
10
+ import "../chunk-VK7GPKK4.js";
10
11
 
11
12
  // src/react/provider/NexusConfigProvider.ts
12
13
  import { createContext, createElement } from "react";
@@ -26,7 +27,7 @@ import {
26
27
  createContext as createContext2,
27
28
  createElement as createElement2,
28
29
  useMemo,
29
- useState
30
+ useState as useState4
30
31
  } from "react";
31
32
 
32
33
  // src/react/hook/useNexusConfig.ts
@@ -141,6 +142,113 @@ function useArticleUnlockStatus({
141
142
  });
142
143
  }
143
144
 
145
+ // src/react/hook/useNexusReferral.ts
146
+ import { useQuery as useQuery4, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
147
+ import { useCallback as useCallback3, useEffect as useEffect3, useState as useState3 } from "react";
148
+ import { isAddressEqual } from "viem";
149
+
150
+ // src/react/hook/useWindowLocation.ts
151
+ import { useEffect as useEffect2, useState as useState2 } from "react";
152
+
153
+ // src/react/hook/useMounted.ts
154
+ import { useEffect, useState } from "react";
155
+ function useMounted() {
156
+ const [mounted, setMounted] = useState(false);
157
+ useEffect(() => {
158
+ setMounted(true);
159
+ }, []);
160
+ return mounted;
161
+ }
162
+
163
+ // src/react/hook/useWindowLocation.ts
164
+ var useWindowLocation = () => {
165
+ const isMounted = useMounted();
166
+ const [location, setLocation] = useState2(
167
+ isMounted ? window.location : void 0
168
+ );
169
+ const [href, setHref] = useState2(
170
+ isMounted ? window.location.href : void 0
171
+ );
172
+ useEffect2(() => {
173
+ if (!isMounted)
174
+ return;
175
+ const setWindowLocation = () => {
176
+ setLocation(window.location);
177
+ setHref(window.location.href);
178
+ };
179
+ if (!location) {
180
+ setWindowLocation();
181
+ }
182
+ window.addEventListener("popstate", setWindowLocation);
183
+ return () => {
184
+ window.removeEventListener("popstate", setWindowLocation);
185
+ };
186
+ }, [isMounted, location]);
187
+ return { location, href };
188
+ };
189
+
190
+ // src/react/hook/useNexusReferral.ts
191
+ function useNexusReferral({ contentId }) {
192
+ const { href } = useWindowLocation();
193
+ const queryClient = useQueryClient3();
194
+ const client = useNexusClient();
195
+ const { data: walletStatus } = useWalletStatus();
196
+ const [referrerAddress, setReferrerAddress] = useState3();
197
+ const newStatusUpdated = useCallback3(
198
+ (event) => {
199
+ queryClient.setQueryData(
200
+ ["setUserReferredQueryReturnTypeListener"],
201
+ event
202
+ );
203
+ if (event.key === "referred-successful" || event.key === "referred-history") {
204
+ if (!href)
205
+ return;
206
+ const url = new URL(href);
207
+ if (walletStatus?.key === "connected") {
208
+ url.searchParams.set("nexusContext", walletStatus?.wallet);
209
+ }
210
+ if (walletStatus?.key === "not-connected") {
211
+ url.searchParams.delete("nexusContext");
212
+ }
213
+ window.history.replaceState(null, "", url.toString());
214
+ }
215
+ },
216
+ [queryClient, href, walletStatus]
217
+ );
218
+ useEffect3(() => {
219
+ if (!href)
220
+ return;
221
+ const url = new URL(href);
222
+ const context = url.searchParams.get("nexusContext");
223
+ if (!context && walletStatus?.key === "connected") {
224
+ url.searchParams.set("nexusContext", walletStatus?.wallet);
225
+ window.history.replaceState(null, "", url.toString());
226
+ }
227
+ if (context) {
228
+ setReferrerAddress(context);
229
+ }
230
+ }, [href, walletStatus]);
231
+ return useQuery4({
232
+ gcTime: 0,
233
+ queryKey: ["setUserReferredQueryReturnTypeListener"],
234
+ queryFn: async () => {
235
+ if (!(contentId && referrerAddress)) {
236
+ return { key: "no-referrer" };
237
+ }
238
+ if (walletStatus?.key === "connected" && walletStatus?.wallet && isAddressEqual(walletStatus?.wallet, referrerAddress)) {
239
+ return { key: "same-wallet" };
240
+ }
241
+ await setUserReferred(
242
+ client,
243
+ { contentId, walletAddress: referrerAddress },
244
+ newStatusUpdated
245
+ );
246
+ return { key: "waiting-response" };
247
+ },
248
+ enabled: !!contentId && !!referrerAddress && walletStatus?.key !== void 0 && walletStatus?.key !== "waiting-response"
249
+ });
250
+ }
251
+
144
252
  // src/react/provider/NexusIFrameClientProvider.ts
145
253
  var NexusIFrameClientContext = createContext2(
146
254
  void 0
@@ -149,7 +257,7 @@ function NexusIFrameClientProvider({
149
257
  children
150
258
  }) {
151
259
  const config = useNexusConfig();
152
- const [iframeElem, setIframeElem] = useState(
260
+ const [iframeElem, setIframeElem] = useState4(
153
261
  void 0
154
262
  );
155
263
  const client = useMemo(
@@ -192,5 +300,6 @@ export {
192
300
  useArticleUnlockStatus,
193
301
  useNexusClient,
194
302
  useNexusConfig,
303
+ useNexusReferral,
195
304
  useWalletStatus
196
305
  };
@@ -1,5 +1,5 @@
1
1
  import { Hex } from 'viem';
2
- import { N as NexusClient, A as ArticleUnlockStatusReturnType } from './client-MgLVRfPw.cjs';
2
+ import { N as NexusClient, A as ArticleUnlockStatusReturnType } from './client-BwzXSgqQ.cjs';
3
3
 
4
4
  /**
5
5
  * Type used to get the unlock options
@@ -1,5 +1,5 @@
1
1
  import { Hex } from 'viem';
2
- import { N as NexusClient, A as ArticleUnlockStatusReturnType } from './client-MgLVRfPw.js';
2
+ import { N as NexusClient, A as ArticleUnlockStatusReturnType } from './client-BwzXSgqQ.js';
3
3
 
4
4
  /**
5
5
  * Type used to get the unlock options
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "0.0.8",
14
+ "version": "0.0.9",
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": "https://github.com/frak-id/wallet",
17
17
  "homepage": "https://docs.frak.id/wallet-sdk",