@frak-labs/nexus-sdk 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{NexusContext-CSlCNW-G.d.cts → FrakContext-LbQht1ep.d.cts} +2 -2
  2. package/dist/{NexusContext-CSlCNW-G.d.ts → FrakContext-LbQht1ep.d.ts} +2 -2
  3. package/dist/bundle/bundle.js +3 -3
  4. package/dist/{chunk-C25NTD45.cjs → chunk-A3XYA7S7.cjs} +28 -14
  5. package/dist/{chunk-ARQTOP44.js → chunk-AHUMDUJC.js} +1 -1
  6. package/dist/{chunk-VMNURFPI.js → chunk-D77BTQYS.js} +19 -16
  7. package/dist/{chunk-4ADWI2GG.cjs → chunk-DAGCBEBQ.cjs} +18 -18
  8. package/dist/{chunk-KEATMEOW.cjs → chunk-FO2GFD5C.cjs} +26 -23
  9. package/dist/{chunk-2LAGZ6S5.js → chunk-FYMOOHMT.js} +35 -27
  10. package/dist/{chunk-K4FOGADW.js → chunk-HY6YATLS.js} +3 -1
  11. package/dist/{chunk-4LT3U3H4.cjs → chunk-J655X6YR.cjs} +38 -30
  12. package/dist/{chunk-I47XQDS3.js → chunk-TIKEZMSD.js} +16 -2
  13. package/dist/{chunk-DILTMQBI.cjs → chunk-UFJ7W6CQ.cjs} +3 -1
  14. package/dist/{client-B3Guoe3I.d.ts → client-ALy_TEwJ.d.ts} +28 -8
  15. package/dist/{client-Of9uIxuI.d.cts → client-DaEox5q4.d.cts} +28 -8
  16. package/dist/core/actions/index.cjs +5 -5
  17. package/dist/core/actions/index.d.cts +6 -7
  18. package/dist/core/actions/index.d.ts +6 -7
  19. package/dist/core/actions/index.js +4 -4
  20. package/dist/core/index.cjs +10 -4
  21. package/dist/core/index.d.cts +41 -9
  22. package/dist/core/index.d.ts +41 -9
  23. package/dist/core/index.js +11 -5
  24. package/dist/core/interactions/index.cjs +5 -3
  25. package/dist/core/interactions/index.d.cts +9 -1
  26. package/dist/core/interactions/index.d.ts +9 -1
  27. package/dist/core/interactions/index.js +6 -4
  28. package/dist/react/index.cjs +34 -34
  29. package/dist/react/index.d.cts +3 -3
  30. package/dist/react/index.d.ts +3 -3
  31. package/dist/react/index.js +16 -16
  32. package/dist/{sendTransaction-3d8jO9CJ.d.ts → sendTransaction-BOd-pvXr.d.ts} +2 -2
  33. package/dist/{sendTransaction-Cz6FoB9_.d.cts → sendTransaction-MhdJPTWd.d.cts} +2 -2
  34. package/package.json +3 -3
@@ -3,10 +3,10 @@
3
3
 
4
4
 
5
5
 
6
- var _chunk4LT3U3H4cjs = require('./chunk-4LT3U3H4.cjs');
6
+ var _chunkJ655X6YRcjs = require('./chunk-J655X6YR.cjs');
7
7
 
8
8
 
9
- var _chunkC25NTD45cjs = require('./chunk-C25NTD45.cjs');
9
+ var _chunkA3XYA7S7cjs = require('./chunk-A3XYA7S7.cjs');
10
10
 
11
11
  // src/core/actions/watchWalletStatus.ts
12
12
  function watchWalletStatus(client, callback) {
@@ -88,7 +88,7 @@ async function sendTransaction(client, { tx, metadata }) {
88
88
 
89
89
  // src/core/actions/wrapper/walletStatus.ts
90
90
  async function walletStatus(client, callback) {
91
- const firstResult = new (0, _chunk4LT3U3H4cjs.Deferred)();
91
+ const firstResult = new (0, _chunkJ655X6YRcjs.Deferred)();
92
92
  let hasResolved = false;
93
93
  await watchWalletStatus(client, (status) => {
94
94
  _optionalChain([callback, 'optionalCall', _5 => _5(status)]);
@@ -104,16 +104,16 @@ async function walletStatus(client, callback) {
104
104
 
105
105
  async function processReferral(client, {
106
106
  walletStatus: walletStatus2,
107
- nexusContext,
107
+ frakContext,
108
108
  modalConfig,
109
109
  productId
110
110
  }) {
111
111
  try {
112
- let currentWallet = getCurrentWallet(walletStatus2);
113
- if (!_optionalChain([nexusContext, 'optionalAccess', _6 => _6.r])) {
112
+ let currentWallet = _optionalChain([walletStatus2, 'optionalAccess', _6 => _6.wallet]);
113
+ if (!_optionalChain([frakContext, 'optionalAccess', _7 => _7.r])) {
114
114
  if (currentWallet) {
115
- await _chunk4LT3U3H4cjs.NexusContextManager.replaceUrl({
116
- url: _optionalChain([window, 'access', _7 => _7.location, 'optionalAccess', _8 => _8.href]),
115
+ await _chunkJ655X6YRcjs.FrakContextManager.replaceUrl({
116
+ url: _optionalChain([window, 'access', _8 => _8.location, 'optionalAccess', _9 => _9.href]),
117
117
  context: { r: currentWallet }
118
118
  });
119
119
  }
@@ -125,17 +125,23 @@ async function processReferral(client, {
125
125
  walletStatus: walletStatus2
126
126
  });
127
127
  }
128
- if (currentWallet && _viem.isAddressEqual.call(void 0, nexusContext.r, currentWallet)) {
128
+ if (currentWallet && _viem.isAddressEqual.call(void 0, frakContext.r, currentWallet)) {
129
129
  return "self-referral";
130
130
  }
131
+ if (!_optionalChain([walletStatus2, 'optionalAccess', _10 => _10.interactionSession])) {
132
+ currentWallet = await ensureWalletConnected(client, {
133
+ modalConfig,
134
+ walletStatus: walletStatus2
135
+ });
136
+ }
131
137
  if (currentWallet) {
132
- await _chunk4LT3U3H4cjs.NexusContextManager.replaceUrl({
133
- url: _optionalChain([window, 'access', _9 => _9.location, 'optionalAccess', _10 => _10.href]),
138
+ await _chunkJ655X6YRcjs.FrakContextManager.replaceUrl({
139
+ url: _optionalChain([window, 'access', _11 => _11.location, 'optionalAccess', _12 => _12.href]),
134
140
  context: { r: currentWallet }
135
141
  });
136
142
  }
137
- const interaction = _chunkC25NTD45cjs.ReferralInteractionEncoder.referred({
138
- referrer: nexusContext.r
143
+ const interaction = _chunkA3XYA7S7cjs.ReferralInteractionEncoder.referred({
144
+ referrer: frakContext.r
139
145
  });
140
146
  await sendInteraction(client, { productId, interaction });
141
147
  return "success";
@@ -143,28 +149,25 @@ async function processReferral(client, {
143
149
  return mapErrorToState(error);
144
150
  }
145
151
  }
146
- function getCurrentWallet(walletStatus2) {
147
- return _optionalChain([walletStatus2, 'optionalAccess', _11 => _11.key]) === "connected" ? walletStatus2.wallet : void 0;
148
- }
149
152
  async function ensureWalletConnected(client, {
150
153
  modalConfig,
151
154
  walletStatus: walletStatus2
152
155
  }) {
153
- if (_optionalChain([walletStatus2, 'optionalAccess', _12 => _12.key]) !== "connected" || !walletStatus2.interactionSession) {
156
+ if (!_optionalChain([walletStatus2, 'optionalAccess', _13 => _13.interactionSession])) {
154
157
  if (!modalConfig) {
155
158
  return void 0;
156
159
  }
157
160
  const result = await displayModal(client, modalConfig);
158
- return _nullishCoalesce(_optionalChain([result, 'optionalAccess', _13 => _13.login, 'optionalAccess', _14 => _14.wallet]), () => ( void 0));
161
+ return _nullishCoalesce(_optionalChain([result, 'optionalAccess', _14 => _14.login, 'optionalAccess', _15 => _15.wallet]), () => ( void 0));
159
162
  }
160
163
  return _nullishCoalesce(walletStatus2.wallet, () => ( void 0));
161
164
  }
162
165
  function mapErrorToState(error) {
163
- if (error instanceof _chunk4LT3U3H4cjs.FrakRpcError) {
166
+ if (error instanceof _chunkJ655X6YRcjs.FrakRpcError) {
164
167
  switch (error.code) {
165
- case _chunk4LT3U3H4cjs.RpcErrorCodes.walletNotConnected:
168
+ case _chunkJ655X6YRcjs.RpcErrorCodes.walletNotConnected:
166
169
  return "no-wallet";
167
- case _chunk4LT3U3H4cjs.RpcErrorCodes.serverErrorForInteractionDelegation:
170
+ case _chunkJ655X6YRcjs.RpcErrorCodes.serverErrorForInteractionDelegation:
168
171
  return "no-session";
169
172
  default:
170
173
  return "error";
@@ -178,14 +181,14 @@ async function referralInteraction(client, {
178
181
  productId,
179
182
  modalConfig
180
183
  } = {}) {
181
- const nexusContext = await _chunk4LT3U3H4cjs.NexusContextManager.parse({
184
+ const frakContext = await _chunkJ655X6YRcjs.FrakContextManager.parse({
182
185
  url: window.location.href
183
186
  });
184
187
  const currentWalletStatus = await walletStatus(client);
185
188
  try {
186
189
  return await processReferral(client, {
187
190
  walletStatus: currentWalletStatus,
188
- nexusContext,
191
+ frakContext,
189
192
  modalConfig,
190
193
  productId
191
194
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __publicField
3
- } from "./chunk-K4FOGADW.js";
3
+ } from "./chunk-HY6YATLS.js";
4
4
 
5
5
  // src/core/types/rpc/error.ts
6
6
  var FrakRpcError = class extends Error {
@@ -37,6 +37,28 @@ var RpcErrorCodes = {
37
37
  serverErrorForInteractionDelegation: -32006
38
38
  };
39
39
 
40
+ // src/core/utils/Deferred.ts
41
+ var Deferred = class {
42
+ constructor() {
43
+ __publicField(this, "_promise");
44
+ __publicField(this, "_resolve");
45
+ __publicField(this, "_reject");
46
+ __publicField(this, "resolve", (value) => {
47
+ this._resolve?.(value);
48
+ });
49
+ __publicField(this, "reject", (reason) => {
50
+ this._reject?.(reason);
51
+ });
52
+ this._promise = new Promise((resolve, reject) => {
53
+ this._resolve = resolve;
54
+ this._reject = reject;
55
+ });
56
+ }
57
+ get promise() {
58
+ return this._promise;
59
+ }
60
+ };
61
+
40
62
  // src/core/utils/compression/compress.ts
41
63
  import { compressToBase64 } from "async-lz-string";
42
64
  import { sha256 } from "js-sha256";
@@ -164,8 +186,8 @@ function changeIframeVisibility({
164
186
  iframe.style.pointerEvents = "auto";
165
187
  }
166
188
 
167
- // src/core/utils/NexusContext.ts
168
- var contextKey = "nCtx";
189
+ // src/core/utils/FrakContext.ts
190
+ var contextKey = "fCtx";
169
191
  async function parse({ url }) {
170
192
  if (!url) return null;
171
193
  const urlObj = new URL(url);
@@ -188,6 +210,11 @@ async function update({
188
210
  urlObj.searchParams.set(contextKey, compressedContext);
189
211
  return urlObj.toString();
190
212
  }
213
+ function remove(url) {
214
+ const urlObj = new URL(url);
215
+ urlObj.searchParams.delete(contextKey);
216
+ return urlObj.toString();
217
+ }
191
218
  async function replaceUrl({
192
219
  url,
193
220
  context
@@ -203,34 +230,13 @@ async function replaceUrl({
203
230
  if (!newUrl) return;
204
231
  window.history.replaceState(null, "", newUrl.toString());
205
232
  }
206
- var NexusContextManager = {
233
+ var FrakContextManager = {
207
234
  parse,
208
235
  update,
236
+ remove,
209
237
  replaceUrl
210
238
  };
211
239
 
212
- // src/core/utils/Deferred.ts
213
- var Deferred = class {
214
- constructor() {
215
- __publicField(this, "_promise");
216
- __publicField(this, "_resolve");
217
- __publicField(this, "_reject");
218
- __publicField(this, "resolve", (value) => {
219
- this._resolve?.(value);
220
- });
221
- __publicField(this, "reject", (reason) => {
222
- this._reject?.(reason);
223
- });
224
- this._promise = new Promise((resolve, reject) => {
225
- this._resolve = resolve;
226
- this._reject = reject;
227
- });
228
- }
229
- get promise() {
230
- return this._promise;
231
- }
232
- };
233
-
234
240
  export {
235
241
  FrakRpcError,
236
242
  InternalError,
@@ -238,9 +244,11 @@ export {
238
244
  RpcErrorCodes,
239
245
  Deferred,
240
246
  hashAndCompressData,
247
+ compressJson,
241
248
  decompressDataAndCheckHash,
249
+ decompressJson,
242
250
  baseIframeProps,
243
251
  createIframe,
244
252
  changeIframeVisibility,
245
- NexusContextManager
253
+ FrakContextManager
246
254
  };
@@ -32,7 +32,9 @@ var interactionTypes = {
32
32
  proofVerifiableStorageUpdate: "0x2ab2aeef",
33
33
  callableVerifiableStorageUpdate: "0xa07da986"
34
34
  },
35
- webshop: {},
35
+ webshop: {
36
+ open: "0xb311798f"
37
+ },
36
38
  referral: {
37
39
  referred: "0x010cc3b9",
38
40
  createLink: "0xb2c0f17c"
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkDILTMQBIcjs = require('./chunk-DILTMQBI.cjs');
3
+ var _chunkUFJ7W6CQcjs = require('./chunk-UFJ7W6CQ.cjs');
4
4
 
5
5
  // src/core/types/rpc/error.ts
6
6
  var FrakRpcError = class extends Error {
@@ -37,6 +37,28 @@ var RpcErrorCodes = {
37
37
  serverErrorForInteractionDelegation: -32006
38
38
  };
39
39
 
40
+ // src/core/utils/Deferred.ts
41
+ var Deferred = class {
42
+ constructor() {
43
+ _chunkUFJ7W6CQcjs.__publicField.call(void 0, this, "_promise");
44
+ _chunkUFJ7W6CQcjs.__publicField.call(void 0, this, "_resolve");
45
+ _chunkUFJ7W6CQcjs.__publicField.call(void 0, this, "_reject");
46
+ _chunkUFJ7W6CQcjs.__publicField.call(void 0, this, "resolve", (value) => {
47
+ _optionalChain([this, 'access', _2 => _2._resolve, 'optionalCall', _3 => _3(value)]);
48
+ });
49
+ _chunkUFJ7W6CQcjs.__publicField.call(void 0, this, "reject", (reason) => {
50
+ _optionalChain([this, 'access', _4 => _4._reject, 'optionalCall', _5 => _5(reason)]);
51
+ });
52
+ this._promise = new Promise((resolve, reject) => {
53
+ this._resolve = resolve;
54
+ this._reject = reject;
55
+ });
56
+ }
57
+ get promise() {
58
+ return this._promise;
59
+ }
60
+ };
61
+
40
62
  // src/core/utils/compression/compress.ts
41
63
  var _asynclzstring = require('async-lz-string');
42
64
  var _jssha256 = require('js-sha256');
@@ -61,7 +83,7 @@ async function compressJson(data) {
61
83
 
62
84
 
63
85
  async function decompressDataAndCheckHash(compressedData) {
64
- if (!(_optionalChain([compressedData, 'optionalAccess', _2 => _2.compressed]) && _optionalChain([compressedData, 'optionalAccess', _3 => _3.compressedHash]))) {
86
+ if (!(_optionalChain([compressedData, 'optionalAccess', _6 => _6.compressed]) && _optionalChain([compressedData, 'optionalAccess', _7 => _7.compressedHash]))) {
65
87
  throw new FrakRpcError(
66
88
  RpcErrorCodes.corruptedResponse,
67
89
  "Missing compressed data"
@@ -76,7 +98,7 @@ async function decompressDataAndCheckHash(compressedData) {
76
98
  "Invalid compressed data"
77
99
  );
78
100
  }
79
- if (!_optionalChain([parsedData, 'optionalAccess', _4 => _4.validationHash])) {
101
+ if (!_optionalChain([parsedData, 'optionalAccess', _8 => _8.validationHash])) {
80
102
  throw new FrakRpcError(
81
103
  RpcErrorCodes.corruptedResponse,
82
104
  "Missing validation hash"
@@ -139,7 +161,7 @@ function createIframe({
139
161
  changeIframeVisibility({ iframe, isVisible: false });
140
162
  document.body.appendChild(iframe);
141
163
  return new Promise((resolve) => {
142
- _optionalChain([iframe, 'optionalAccess', _5 => _5.addEventListener, 'call', _6 => _6("load", () => resolve(iframe))]);
164
+ _optionalChain([iframe, 'optionalAccess', _9 => _9.addEventListener, 'call', _10 => _10("load", () => resolve(iframe))]);
143
165
  iframe.src = `${walletBaseUrl}/listener`;
144
166
  });
145
167
  }
@@ -164,8 +186,8 @@ function changeIframeVisibility({
164
186
  iframe.style.pointerEvents = "auto";
165
187
  }
166
188
 
167
- // src/core/utils/NexusContext.ts
168
- var contextKey = "nCtx";
189
+ // src/core/utils/FrakContext.ts
190
+ var contextKey = "fCtx";
169
191
  async function parse({ url }) {
170
192
  if (!url) return null;
171
193
  const urlObj = new URL(url);
@@ -188,11 +210,16 @@ async function update({
188
210
  urlObj.searchParams.set(contextKey, compressedContext);
189
211
  return urlObj.toString();
190
212
  }
213
+ function remove(url) {
214
+ const urlObj = new URL(url);
215
+ urlObj.searchParams.delete(contextKey);
216
+ return urlObj.toString();
217
+ }
191
218
  async function replaceUrl({
192
219
  url,
193
220
  context
194
221
  }) {
195
- if (!_optionalChain([window, 'access', _7 => _7.location, 'optionalAccess', _8 => _8.href]) || typeof window === "undefined") {
222
+ if (!_optionalChain([window, 'access', _11 => _11.location, 'optionalAccess', _12 => _12.href]) || typeof window === "undefined") {
196
223
  console.error("No window found, can't update context");
197
224
  return;
198
225
  }
@@ -203,33 +230,13 @@ async function replaceUrl({
203
230
  if (!newUrl) return;
204
231
  window.history.replaceState(null, "", newUrl.toString());
205
232
  }
206
- var NexusContextManager = {
233
+ var FrakContextManager = {
207
234
  parse,
208
235
  update,
236
+ remove,
209
237
  replaceUrl
210
238
  };
211
239
 
212
- // src/core/utils/Deferred.ts
213
- var Deferred = class {
214
- constructor() {
215
- _chunkDILTMQBIcjs.__publicField.call(void 0, this, "_promise");
216
- _chunkDILTMQBIcjs.__publicField.call(void 0, this, "_resolve");
217
- _chunkDILTMQBIcjs.__publicField.call(void 0, this, "_reject");
218
- _chunkDILTMQBIcjs.__publicField.call(void 0, this, "resolve", (value) => {
219
- _optionalChain([this, 'access', _9 => _9._resolve, 'optionalCall', _10 => _10(value)]);
220
- });
221
- _chunkDILTMQBIcjs.__publicField.call(void 0, this, "reject", (reason) => {
222
- _optionalChain([this, 'access', _11 => _11._reject, 'optionalCall', _12 => _12(reason)]);
223
- });
224
- this._promise = new Promise((resolve, reject) => {
225
- this._resolve = resolve;
226
- this._reject = reject;
227
- });
228
- }
229
- get promise() {
230
- return this._promise;
231
- }
232
- };
233
240
 
234
241
 
235
242
 
@@ -243,4 +250,5 @@ var Deferred = class {
243
250
 
244
251
 
245
252
 
246
- exports.FrakRpcError = FrakRpcError; exports.InternalError = InternalError; exports.ClientNotFound = ClientNotFound; exports.RpcErrorCodes = RpcErrorCodes; exports.Deferred = Deferred; exports.hashAndCompressData = hashAndCompressData; exports.decompressDataAndCheckHash = decompressDataAndCheckHash; exports.baseIframeProps = baseIframeProps; exports.createIframe = createIframe; exports.changeIframeVisibility = changeIframeVisibility; exports.NexusContextManager = NexusContextManager;
253
+
254
+ exports.FrakRpcError = FrakRpcError; exports.InternalError = InternalError; exports.ClientNotFound = ClientNotFound; exports.RpcErrorCodes = RpcErrorCodes; exports.Deferred = Deferred; exports.hashAndCompressData = hashAndCompressData; exports.compressJson = compressJson; exports.decompressDataAndCheckHash = decompressDataAndCheckHash; exports.decompressJson = decompressJson; exports.baseIframeProps = baseIframeProps; exports.createIframe = createIframe; exports.changeIframeVisibility = changeIframeVisibility; exports.FrakContextManager = FrakContextManager;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  interactionTypes,
3
3
  productTypes
4
- } from "./chunk-K4FOGADW.js";
4
+ } from "./chunk-HY6YATLS.js";
5
5
 
6
6
  // src/core/interactions/pressEncoder.ts
7
7
  import { concatHex, pad, toHex } from "viem";
@@ -93,8 +93,22 @@ var PurchaseInteractionEncoder = {
93
93
  completedPurchase
94
94
  };
95
95
 
96
+ // src/core/interactions/webshopEncoder.ts
97
+ import { concatHex as concatHex4, toHex as toHex4 } from "viem";
98
+ function open() {
99
+ const interactionData = concatHex4([interactionTypes.webshop.open, "0x"]);
100
+ return {
101
+ handlerTypeDenominator: toHex4(productTypes.webshop),
102
+ interactionData
103
+ };
104
+ }
105
+ var WebShopInteractionEncoder = {
106
+ open
107
+ };
108
+
96
109
  export {
97
110
  PressInteractionEncoder,
98
111
  ReferralInteractionEncoder,
99
- PurchaseInteractionEncoder
112
+ PurchaseInteractionEncoder,
113
+ WebShopInteractionEncoder
100
114
  };
@@ -32,7 +32,9 @@ var interactionTypes = {
32
32
  proofVerifiableStorageUpdate: "0x2ab2aeef",
33
33
  callableVerifiableStorageUpdate: "0xa07da986"
34
34
  },
35
- webshop: {},
35
+ webshop: {
36
+ open: "0xb311798f"
37
+ },
36
38
  referral: {
37
39
  referred: "0x010cc3b9",
38
40
  createLink: "0xb2c0f17c"
@@ -67,6 +67,7 @@ type SsoMetadata = {
67
67
  type OpenSsoParamsType = {
68
68
  redirectUrl?: string;
69
69
  directExit?: boolean;
70
+ lang?: "en" | "fr";
70
71
  metadata: SsoMetadata;
71
72
  };
72
73
 
@@ -125,7 +126,6 @@ type SiweAuthenticateModalStepType = GenericModalStepType<"siweAuthenticate", {
125
126
 
126
127
  /**
127
128
  * Generic format representing a tx to be sent
128
- * todo: exploit the EIP-5792 here? https://eips.ethereum.org/EIPS/eip-5792
129
129
  */
130
130
  type SendTransactionTxType = Readonly<{
131
131
  to: Address;
@@ -155,20 +155,29 @@ type OpenInteractionSessionReturnType = Readonly<{
155
155
  type OpenInteractionSessionModalStepType = GenericModalStepType<"openSession", object, OpenInteractionSessionReturnType>;
156
156
 
157
157
  /**
158
- * Generic type of modal we will display to the end user
158
+ * The final modal step type (displayed on success or dimissed)
159
159
  */
160
- type SuccessModalStepType = GenericModalStepType<"success", {
161
- sharing?: {
160
+ type FinalModalStepType = GenericModalStepType<"final", {
161
+ dismissedMetadata?: ModalStepMetadata["metadata"];
162
+ action: FinalActionType;
163
+ autoSkip?: boolean;
164
+ }, object>;
165
+ type FinalActionType = {
166
+ key: "sharing";
167
+ options?: {
162
168
  popupTitle?: string;
163
169
  text?: string;
164
170
  link?: string;
165
171
  };
166
- }, object>;
172
+ } | {
173
+ key: "reward";
174
+ options?: never;
175
+ };
167
176
 
168
177
  /**
169
178
  * Generic type of steps we will display in the modal to the end user
170
179
  */
171
- type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | OpenInteractionSessionModalStepType | SuccessModalStepType;
180
+ type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | OpenInteractionSessionModalStepType | FinalModalStepType;
172
181
  /**
173
182
  * Type for the result of a modal request
174
183
  */
@@ -194,7 +203,14 @@ type ModalRpcMetadata = Readonly<{
194
203
  icon?: string;
195
204
  };
196
205
  context?: string;
197
- }>;
206
+ lang?: "en" | "fr";
207
+ } & ({
208
+ isDismissible: true;
209
+ dismissActionTxt?: string;
210
+ } | {
211
+ isDismissible?: false;
212
+ dismissActionTxt?: never;
213
+ })>;
198
214
  /**
199
215
  * Generic params used to display modals
200
216
  */
@@ -207,6 +223,7 @@ type WalletStatusReturnType = Readonly<WalletConnected | WalletNotConnected>;
207
223
  type WalletConnected = {
208
224
  key: "connected";
209
225
  wallet: Address;
226
+ interactionToken?: string;
210
227
  interactionSession?: {
211
228
  startTimestamp: number;
212
229
  endTimestamp: number;
@@ -214,6 +231,9 @@ type WalletConnected = {
214
231
  };
215
232
  type WalletNotConnected = {
216
233
  key: "not-connected";
234
+ wallet?: never;
235
+ interactionToken?: never;
236
+ interactionSession?: never;
217
237
  };
218
238
 
219
239
  /**
@@ -360,4 +380,4 @@ type NexusClient = {
360
380
  config: NexusWalletSdkConfig;
361
381
  } & IFrameTransport;
362
382
 
363
- export type { ClientLifecycleEvent as C, DisplayModalParamsType as D, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, LoginModalStepType as L, ModalStepTypes as M, NexusWalletSdkConfig as N, OpenSsoParamsType as O, RpcResponse as R, SuccessModalStepType as S, WalletStatusReturnType as W, NexusClient as a, SsoMetadata as b, ModalRpcMetadata as c, ModalRpcStepsInput as d, ModalRpcStepsResultType as e, ModalStepMetadata as f, SiweAuthenticateModalStepType as g, SiweAuthenticationParams as h, SiweAuthenticateReturnType as i, SendTransactionTxType as j, SendTransactionModalStepType as k, SendTransactionReturnType as l, OpenInteractionSessionReturnType as m, OpenInteractionSessionModalStepType as n, IFrameTransport as o, IFrameRpcEvent as p, IFrameEvent as q, IFrameLifecycleEvent as r, ExtractedReturnTypeFromRpc as s };
383
+ export type { ClientLifecycleEvent as C, DisplayModalParamsType as D, ExtractedParametersFromRpc as E, FinalModalStepType as F, IFrameRpcSchema as I, LoginModalStepType as L, ModalStepTypes as M, NexusWalletSdkConfig as N, OpenSsoParamsType as O, RpcResponse as R, SsoMetadata as S, WalletStatusReturnType as W, NexusClient as a, ModalRpcMetadata as b, ModalRpcStepsInput as c, ModalRpcStepsResultType as d, ModalStepMetadata as e, SiweAuthenticateModalStepType as f, SiweAuthenticationParams as g, SiweAuthenticateReturnType as h, SendTransactionTxType as i, SendTransactionModalStepType as j, SendTransactionReturnType as k, OpenInteractionSessionReturnType as l, OpenInteractionSessionModalStepType as m, FinalActionType as n, IFrameTransport as o, IFrameRpcEvent as p, IFrameEvent as q, IFrameLifecycleEvent as r, ExtractedReturnTypeFromRpc as s };
@@ -67,6 +67,7 @@ type SsoMetadata = {
67
67
  type OpenSsoParamsType = {
68
68
  redirectUrl?: string;
69
69
  directExit?: boolean;
70
+ lang?: "en" | "fr";
70
71
  metadata: SsoMetadata;
71
72
  };
72
73
 
@@ -125,7 +126,6 @@ type SiweAuthenticateModalStepType = GenericModalStepType<"siweAuthenticate", {
125
126
 
126
127
  /**
127
128
  * Generic format representing a tx to be sent
128
- * todo: exploit the EIP-5792 here? https://eips.ethereum.org/EIPS/eip-5792
129
129
  */
130
130
  type SendTransactionTxType = Readonly<{
131
131
  to: Address;
@@ -155,20 +155,29 @@ type OpenInteractionSessionReturnType = Readonly<{
155
155
  type OpenInteractionSessionModalStepType = GenericModalStepType<"openSession", object, OpenInteractionSessionReturnType>;
156
156
 
157
157
  /**
158
- * Generic type of modal we will display to the end user
158
+ * The final modal step type (displayed on success or dimissed)
159
159
  */
160
- type SuccessModalStepType = GenericModalStepType<"success", {
161
- sharing?: {
160
+ type FinalModalStepType = GenericModalStepType<"final", {
161
+ dismissedMetadata?: ModalStepMetadata["metadata"];
162
+ action: FinalActionType;
163
+ autoSkip?: boolean;
164
+ }, object>;
165
+ type FinalActionType = {
166
+ key: "sharing";
167
+ options?: {
162
168
  popupTitle?: string;
163
169
  text?: string;
164
170
  link?: string;
165
171
  };
166
- }, object>;
172
+ } | {
173
+ key: "reward";
174
+ options?: never;
175
+ };
167
176
 
168
177
  /**
169
178
  * Generic type of steps we will display in the modal to the end user
170
179
  */
171
- type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | OpenInteractionSessionModalStepType | SuccessModalStepType;
180
+ type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | OpenInteractionSessionModalStepType | FinalModalStepType;
172
181
  /**
173
182
  * Type for the result of a modal request
174
183
  */
@@ -194,7 +203,14 @@ type ModalRpcMetadata = Readonly<{
194
203
  icon?: string;
195
204
  };
196
205
  context?: string;
197
- }>;
206
+ lang?: "en" | "fr";
207
+ } & ({
208
+ isDismissible: true;
209
+ dismissActionTxt?: string;
210
+ } | {
211
+ isDismissible?: false;
212
+ dismissActionTxt?: never;
213
+ })>;
198
214
  /**
199
215
  * Generic params used to display modals
200
216
  */
@@ -207,6 +223,7 @@ type WalletStatusReturnType = Readonly<WalletConnected | WalletNotConnected>;
207
223
  type WalletConnected = {
208
224
  key: "connected";
209
225
  wallet: Address;
226
+ interactionToken?: string;
210
227
  interactionSession?: {
211
228
  startTimestamp: number;
212
229
  endTimestamp: number;
@@ -214,6 +231,9 @@ type WalletConnected = {
214
231
  };
215
232
  type WalletNotConnected = {
216
233
  key: "not-connected";
234
+ wallet?: never;
235
+ interactionToken?: never;
236
+ interactionSession?: never;
217
237
  };
218
238
 
219
239
  /**
@@ -360,4 +380,4 @@ type NexusClient = {
360
380
  config: NexusWalletSdkConfig;
361
381
  } & IFrameTransport;
362
382
 
363
- export type { ClientLifecycleEvent as C, DisplayModalParamsType as D, ExtractedParametersFromRpc as E, IFrameRpcSchema as I, LoginModalStepType as L, ModalStepTypes as M, NexusWalletSdkConfig as N, OpenSsoParamsType as O, RpcResponse as R, SuccessModalStepType as S, WalletStatusReturnType as W, NexusClient as a, SsoMetadata as b, ModalRpcMetadata as c, ModalRpcStepsInput as d, ModalRpcStepsResultType as e, ModalStepMetadata as f, SiweAuthenticateModalStepType as g, SiweAuthenticationParams as h, SiweAuthenticateReturnType as i, SendTransactionTxType as j, SendTransactionModalStepType as k, SendTransactionReturnType as l, OpenInteractionSessionReturnType as m, OpenInteractionSessionModalStepType as n, IFrameTransport as o, IFrameRpcEvent as p, IFrameEvent as q, IFrameLifecycleEvent as r, ExtractedReturnTypeFromRpc as s };
383
+ export type { ClientLifecycleEvent as C, DisplayModalParamsType as D, ExtractedParametersFromRpc as E, FinalModalStepType as F, IFrameRpcSchema as I, LoginModalStepType as L, ModalStepTypes as M, NexusWalletSdkConfig as N, OpenSsoParamsType as O, RpcResponse as R, SsoMetadata as S, WalletStatusReturnType as W, NexusClient as a, ModalRpcMetadata as b, ModalRpcStepsInput as c, ModalRpcStepsResultType as d, ModalStepMetadata as e, SiweAuthenticateModalStepType as f, SiweAuthenticationParams as g, SiweAuthenticateReturnType as h, SendTransactionTxType as i, SendTransactionModalStepType as j, SendTransactionReturnType as k, OpenInteractionSessionReturnType as l, OpenInteractionSessionModalStepType as m, FinalActionType as n, IFrameTransport as o, IFrameRpcEvent as p, IFrameEvent as q, IFrameLifecycleEvent as r, ExtractedReturnTypeFromRpc as s };
@@ -8,10 +8,10 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkKEATMEOWcjs = require('../../chunk-KEATMEOW.cjs');
12
- require('../../chunk-4LT3U3H4.cjs');
13
- require('../../chunk-C25NTD45.cjs');
14
- require('../../chunk-DILTMQBI.cjs');
11
+ var _chunkFO2GFD5Ccjs = require('../../chunk-FO2GFD5C.cjs');
12
+ require('../../chunk-J655X6YR.cjs');
13
+ require('../../chunk-A3XYA7S7.cjs');
14
+ require('../../chunk-UFJ7W6CQ.cjs');
15
15
 
16
16
 
17
17
 
@@ -22,4 +22,4 @@ require('../../chunk-DILTMQBI.cjs');
22
22
 
23
23
 
24
24
 
25
- exports.displayModal = _chunkKEATMEOWcjs.displayModal; exports.openSso = _chunkKEATMEOWcjs.openSso; exports.processReferral = _chunkKEATMEOWcjs.processReferral; exports.referralInteraction = _chunkKEATMEOWcjs.referralInteraction; exports.sendInteraction = _chunkKEATMEOWcjs.sendInteraction; exports.sendTransaction = _chunkKEATMEOWcjs.sendTransaction; exports.siweAuthenticate = _chunkKEATMEOWcjs.siweAuthenticate; exports.walletStatus = _chunkKEATMEOWcjs.walletStatus; exports.watchWalletStatus = _chunkKEATMEOWcjs.watchWalletStatus;
25
+ exports.displayModal = _chunkFO2GFD5Ccjs.displayModal; exports.openSso = _chunkFO2GFD5Ccjs.openSso; exports.processReferral = _chunkFO2GFD5Ccjs.processReferral; exports.referralInteraction = _chunkFO2GFD5Ccjs.referralInteraction; exports.sendInteraction = _chunkFO2GFD5Ccjs.sendInteraction; exports.sendTransaction = _chunkFO2GFD5Ccjs.sendTransaction; exports.siweAuthenticate = _chunkFO2GFD5Ccjs.siweAuthenticate; exports.walletStatus = _chunkFO2GFD5Ccjs.walletStatus; exports.watchWalletStatus = _chunkFO2GFD5Ccjs.watchWalletStatus;
@@ -1,8 +1,8 @@
1
- import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, e as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-Of9uIxuI.cjs';
1
+ import { a as NexusClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, d as ModalRpcStepsResultType, O as OpenSsoParamsType } from '../../client-DaEox5q4.cjs';
2
2
  import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../../interaction-BngPoHA0.cjs';
3
- export { b as SendTransactionParams, S as SiweAuthenticateModalParams, a as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-Cz6FoB9_.cjs';
3
+ export { S as SendTransactionParams, a as SiweAuthenticateModalParams, b as sendTransaction, s as siweAuthenticate } from '../../sendTransaction-MhdJPTWd.cjs';
4
4
  import { Hex } from 'viem';
5
- import { N as NexusContext } from '../../NexusContext-CSlCNW-G.cjs';
5
+ import { F as FrakContext } from '../../FrakContext-LbQht1ep.cjs';
6
6
  import 'viem/chains';
7
7
  import 'viem/siwe';
8
8
 
@@ -31,7 +31,6 @@ declare function displayModal<T extends ModalStepTypes[] = ModalStepTypes[]>(cli
31
31
 
32
32
  /**
33
33
  * Function used to open the SSO
34
- * todo: We are using the iframe here, since we need to send potentially load of datas, and it couldn't fit inside the query params of an url
35
34
  * @param client
36
35
  * @param args
37
36
  */
@@ -49,13 +48,13 @@ type ReferralState = "idle" | "processing" | "success" | "no-wallet" | "no-sessi
49
48
  * Automatically submit a referral interaction when detected
50
49
  * -> And automatically set the referral context in the url
51
50
  * @param walletStatus
52
- * @param nexusContext
51
+ * @param frakContext
53
52
  * @param modalConfig
54
53
  * @param productId
55
54
  */
56
- declare function processReferral(client: NexusClient, { walletStatus, nexusContext, modalConfig, productId, }: {
55
+ declare function processReferral(client: NexusClient, { walletStatus, frakContext, modalConfig, productId, }: {
57
56
  walletStatus?: WalletStatusReturnType;
58
- nexusContext?: Partial<NexusContext> | null;
57
+ frakContext?: Partial<FrakContext> | null;
59
58
  modalConfig?: DisplayModalParamsType<ModalStepTypes[]>;
60
59
  productId?: Hex;
61
60
  }): Promise<ReferralState>;