@frak-labs/nexus-sdk 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{FrakContext-p0Jtv9gl.d.ts → FrakContext-CDVlUN75.d.ts} +1 -0
- package/dist/{FrakContext-BsezWx2F.d.cts → FrakContext-DBdWC7ls.d.cts} +1 -0
- package/dist/bundle/bundle.js +3 -3
- package/dist/{chunk-BSCR57ZI.cjs → chunk-4CWA7EWX.cjs} +10 -10
- package/dist/{chunk-A3XYA7S7.cjs → chunk-4OJ2NPAS.cjs} +15 -15
- package/dist/chunk-F3F4BCGV.cjs +860 -0
- package/dist/chunk-H3T2GAEC.js +79 -0
- package/dist/{chunk-TIKEZMSD.js → chunk-P4QEVLVV.js} +1 -1
- package/dist/{chunk-MDGMJ6EQ.js → chunk-Q3SIIAX2.js} +2 -2
- package/dist/chunk-QSXZKZJA.cjs +79 -0
- package/dist/{chunk-WXNW7ZMU.cjs → chunk-QYOOKB34.cjs} +20 -18
- package/dist/{chunk-ZZ7LUFNV.js → chunk-VVF4NKYR.js} +3 -1
- package/dist/chunk-ZQSA2VQ4.js +860 -0
- package/dist/core/actions/index.cjs +5 -5
- package/dist/core/actions/index.d.cts +3 -3
- package/dist/core/actions/index.d.ts +3 -3
- package/dist/core/actions/index.js +4 -4
- package/dist/core/index.cjs +4 -4
- package/dist/core/index.d.cts +5 -3
- package/dist/core/index.d.ts +5 -3
- package/dist/core/index.js +3 -3
- package/dist/core/interactions/index.cjs +3 -3
- package/dist/core/interactions/index.js +2 -2
- package/dist/{processReferral-YbCg90hu.d.cts → processReferral-BWSIamn2.d.cts} +1 -1
- package/dist/{processReferral-t3gUNwJu.d.ts → processReferral-CFyGAENf.d.ts} +1 -1
- package/dist/react/index.cjs +26 -26
- package/dist/react/index.d.cts +5 -2
- package/dist/react/index.d.ts +5 -2
- package/dist/react/index.js +5 -5
- package/package.json +2 -11
- package/dist/chunk-E527CMMJ.cjs +0 -294
- package/dist/chunk-HY6YATLS.js +0 -53
- package/dist/chunk-UFJ7W6CQ.cjs +0 -53
- package/dist/chunk-ZRPCX25Q.js +0 -294
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
28
|
+
|
|
29
|
+
// src/core/constants/productTypes.ts
|
|
30
|
+
var productTypes = {
|
|
31
|
+
// content type
|
|
32
|
+
dapp: 1,
|
|
33
|
+
press: 2,
|
|
34
|
+
webshop: 3,
|
|
35
|
+
// feature type
|
|
36
|
+
referral: 30,
|
|
37
|
+
purchase: 31
|
|
38
|
+
};
|
|
39
|
+
var productTypesMask = Object.entries(
|
|
40
|
+
productTypes
|
|
41
|
+
).reduce(
|
|
42
|
+
(acc, [key, value]) => {
|
|
43
|
+
acc[key] = BigInt(1) << BigInt(value);
|
|
44
|
+
return acc;
|
|
45
|
+
},
|
|
46
|
+
{}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// src/core/constants/interactionTypes.ts
|
|
50
|
+
var interactionTypes = {
|
|
51
|
+
press: {
|
|
52
|
+
openArticle: "0xc0a24ffb",
|
|
53
|
+
readArticle: "0xd5bd0fbe"
|
|
54
|
+
},
|
|
55
|
+
dapp: {
|
|
56
|
+
proofVerifiableStorageUpdate: "0x2ab2aeef",
|
|
57
|
+
callableVerifiableStorageUpdate: "0xa07da986"
|
|
58
|
+
},
|
|
59
|
+
webshop: {
|
|
60
|
+
open: "0xb311798f"
|
|
61
|
+
},
|
|
62
|
+
referral: {
|
|
63
|
+
referred: "0x010cc3b9",
|
|
64
|
+
createLink: "0xb2c0f17c"
|
|
65
|
+
},
|
|
66
|
+
purchase: {
|
|
67
|
+
started: "0xd87e90c3",
|
|
68
|
+
completed: "0x8403aeb4"
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
__commonJS,
|
|
74
|
+
__toESM,
|
|
75
|
+
__publicField,
|
|
76
|
+
productTypes,
|
|
77
|
+
productTypesMask,
|
|
78
|
+
interactionTypes
|
|
79
|
+
};
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
FrakContextManager,
|
|
4
4
|
FrakRpcError,
|
|
5
5
|
RpcErrorCodes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZQSA2VQ4.js";
|
|
7
7
|
import {
|
|
8
8
|
ReferralInteractionEncoder
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-P4QEVLVV.js";
|
|
10
10
|
|
|
11
11
|
// src/core/actions/watchWalletStatus.ts
|
|
12
12
|
function watchWalletStatus(client, callback) {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
28
|
+
|
|
29
|
+
// src/core/constants/productTypes.ts
|
|
30
|
+
var productTypes = {
|
|
31
|
+
// content type
|
|
32
|
+
dapp: 1,
|
|
33
|
+
press: 2,
|
|
34
|
+
webshop: 3,
|
|
35
|
+
// feature type
|
|
36
|
+
referral: 30,
|
|
37
|
+
purchase: 31
|
|
38
|
+
};
|
|
39
|
+
var productTypesMask = Object.entries(
|
|
40
|
+
productTypes
|
|
41
|
+
).reduce(
|
|
42
|
+
(acc, [key, value]) => {
|
|
43
|
+
acc[key] = BigInt(1) << BigInt(value);
|
|
44
|
+
return acc;
|
|
45
|
+
},
|
|
46
|
+
{}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// src/core/constants/interactionTypes.ts
|
|
50
|
+
var interactionTypes = {
|
|
51
|
+
press: {
|
|
52
|
+
openArticle: "0xc0a24ffb",
|
|
53
|
+
readArticle: "0xd5bd0fbe"
|
|
54
|
+
},
|
|
55
|
+
dapp: {
|
|
56
|
+
proofVerifiableStorageUpdate: "0x2ab2aeef",
|
|
57
|
+
callableVerifiableStorageUpdate: "0xa07da986"
|
|
58
|
+
},
|
|
59
|
+
webshop: {
|
|
60
|
+
open: "0xb311798f"
|
|
61
|
+
},
|
|
62
|
+
referral: {
|
|
63
|
+
referred: "0x010cc3b9",
|
|
64
|
+
createLink: "0xb2c0f17c"
|
|
65
|
+
},
|
|
66
|
+
purchase: {
|
|
67
|
+
started: "0xd87e90c3",
|
|
68
|
+
completed: "0x8403aeb4"
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.__publicField = __publicField; exports.productTypes = productTypes; exports.productTypesMask = productTypesMask; exports.interactionTypes = interactionTypes;
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
var _chunkF3F4BCGVcjs = require('./chunk-F3F4BCGV.cjs');
|
|
10
11
|
|
|
11
12
|
// src/core/utils/constants.ts
|
|
12
13
|
var BACKUP_KEY = "nexus-wallet-backup";
|
|
@@ -31,7 +32,7 @@ function createIFrameChannelManager() {
|
|
|
31
32
|
function createIFrameLifecycleManager({
|
|
32
33
|
iframe
|
|
33
34
|
}) {
|
|
34
|
-
const isConnectedDeferred = new (0,
|
|
35
|
+
const isConnectedDeferred = new (0, _chunkF3F4BCGVcjs.Deferred)();
|
|
35
36
|
const handler = async (messageEvent) => {
|
|
36
37
|
switch (messageEvent.iframeLifecycle) {
|
|
37
38
|
// Resolve the isConnected promise
|
|
@@ -53,7 +54,7 @@ function createIFrameLifecycleManager({
|
|
|
53
54
|
// Change iframe visibility
|
|
54
55
|
case "show":
|
|
55
56
|
case "hide":
|
|
56
|
-
|
|
57
|
+
_chunkF3F4BCGVcjs.changeIframeVisibility.call(void 0, {
|
|
57
58
|
iframe,
|
|
58
59
|
isVisible: messageEvent.iframeLifecycle === "show"
|
|
59
60
|
});
|
|
@@ -74,14 +75,14 @@ function createIFrameMessageHandler({
|
|
|
74
75
|
iframeLifecycleManager
|
|
75
76
|
}) {
|
|
76
77
|
if (typeof window === "undefined") {
|
|
77
|
-
throw new (0,
|
|
78
|
-
|
|
78
|
+
throw new (0, _chunkF3F4BCGVcjs.FrakRpcError)(
|
|
79
|
+
_chunkF3F4BCGVcjs.RpcErrorCodes.configError,
|
|
79
80
|
"iframe client should be used in the browser"
|
|
80
81
|
);
|
|
81
82
|
}
|
|
82
83
|
if (!iframe.contentWindow) {
|
|
83
|
-
throw new (0,
|
|
84
|
-
|
|
84
|
+
throw new (0, _chunkF3F4BCGVcjs.FrakRpcError)(
|
|
85
|
+
_chunkF3F4BCGVcjs.RpcErrorCodes.configError,
|
|
85
86
|
"The iframe does not have a product window"
|
|
86
87
|
);
|
|
87
88
|
}
|
|
@@ -141,17 +142,17 @@ function createIFrameNexusClient({
|
|
|
141
142
|
const request = async (args) => {
|
|
142
143
|
const isConnected = await lifecycleManager.isConnected;
|
|
143
144
|
if (!isConnected) {
|
|
144
|
-
throw new (0,
|
|
145
|
-
|
|
145
|
+
throw new (0, _chunkF3F4BCGVcjs.FrakRpcError)(
|
|
146
|
+
_chunkF3F4BCGVcjs.RpcErrorCodes.clientNotConnected,
|
|
146
147
|
"The iframe provider isn't connected yet"
|
|
147
148
|
);
|
|
148
149
|
}
|
|
149
|
-
const result = new (0,
|
|
150
|
+
const result = new (0, _chunkF3F4BCGVcjs.Deferred)();
|
|
150
151
|
const channelId = channelManager.createChannel(async (message) => {
|
|
151
|
-
const decompressed = await
|
|
152
|
+
const decompressed = await _chunkF3F4BCGVcjs.decompressDataAndCheckHash.call(void 0, message.data);
|
|
152
153
|
if (decompressed.error) {
|
|
153
154
|
result.reject(
|
|
154
|
-
new (0,
|
|
155
|
+
new (0, _chunkF3F4BCGVcjs.FrakRpcError)(
|
|
155
156
|
decompressed.error.code,
|
|
156
157
|
decompressed.error.message,
|
|
157
158
|
_optionalChain([decompressed, 'access', _ => _.error, 'optionalAccess', _2 => _2.data])
|
|
@@ -162,7 +163,7 @@ function createIFrameNexusClient({
|
|
|
162
163
|
}
|
|
163
164
|
channelManager.removeChannel(channelId);
|
|
164
165
|
});
|
|
165
|
-
const compressedMessage = await
|
|
166
|
+
const compressedMessage = await _chunkF3F4BCGVcjs.hashAndCompressData.call(void 0, args);
|
|
166
167
|
messageHandler.sendEvent({
|
|
167
168
|
id: channelId,
|
|
168
169
|
topic: args.method,
|
|
@@ -173,20 +174,20 @@ function createIFrameNexusClient({
|
|
|
173
174
|
const listenerRequest = async (args, callback) => {
|
|
174
175
|
const isConnected = await lifecycleManager.isConnected;
|
|
175
176
|
if (!isConnected) {
|
|
176
|
-
throw new (0,
|
|
177
|
-
|
|
177
|
+
throw new (0, _chunkF3F4BCGVcjs.FrakRpcError)(
|
|
178
|
+
_chunkF3F4BCGVcjs.RpcErrorCodes.clientNotConnected,
|
|
178
179
|
"The iframe provider isn't connected yet"
|
|
179
180
|
);
|
|
180
181
|
}
|
|
181
182
|
const channelId = channelManager.createChannel(async (message) => {
|
|
182
|
-
const decompressed = await
|
|
183
|
+
const decompressed = await _chunkF3F4BCGVcjs.decompressDataAndCheckHash.call(void 0, message.data);
|
|
183
184
|
if (decompressed.result) {
|
|
184
185
|
callback(decompressed.result);
|
|
185
186
|
} else {
|
|
186
|
-
throw new (0,
|
|
187
|
+
throw new (0, _chunkF3F4BCGVcjs.InternalError)("No valid result in the response");
|
|
187
188
|
}
|
|
188
189
|
});
|
|
189
|
-
const compressedMessage = await
|
|
190
|
+
const compressedMessage = await _chunkF3F4BCGVcjs.hashAndCompressData.call(void 0, args);
|
|
190
191
|
messageHandler.sendEvent({
|
|
191
192
|
id: channelId,
|
|
192
193
|
topic: args.method,
|
|
@@ -218,6 +219,7 @@ async function postConnectionSetup({
|
|
|
218
219
|
lifecycleManager
|
|
219
220
|
}) {
|
|
220
221
|
await lifecycleManager.isConnected;
|
|
222
|
+
_chunkF3F4BCGVcjs.enableButtonShare.call(void 0, config);
|
|
221
223
|
const pushCss = async () => {
|
|
222
224
|
const cssLink = config.metadata.css;
|
|
223
225
|
if (!cssLink) return;
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
RpcErrorCodes,
|
|
6
6
|
changeIframeVisibility,
|
|
7
7
|
decompressDataAndCheckHash,
|
|
8
|
+
enableButtonShare,
|
|
8
9
|
hashAndCompressData
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZQSA2VQ4.js";
|
|
10
11
|
|
|
11
12
|
// src/core/utils/constants.ts
|
|
12
13
|
var BACKUP_KEY = "nexus-wallet-backup";
|
|
@@ -218,6 +219,7 @@ async function postConnectionSetup({
|
|
|
218
219
|
lifecycleManager
|
|
219
220
|
}) {
|
|
220
221
|
await lifecycleManager.isConnected;
|
|
222
|
+
enableButtonShare(config);
|
|
221
223
|
const pushCss = async () => {
|
|
222
224
|
const cssLink = config.metadata.css;
|
|
223
225
|
if (!cssLink) return;
|