@frak-labs/nexus-sdk 0.0.25 → 0.0.26
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/README.md +2 -72
- package/dist/bundle/bundle.js +6 -6
- package/package.json +11 -64
- package/dist/FrakContext-DKSVaeVb.d.cts +0 -450
- package/dist/FrakContext-DjeuWC2U.d.ts +0 -450
- package/dist/chunk-2VNIEGOJ.js +0 -864
- package/dist/chunk-4MMSQL44.js +0 -351
- package/dist/chunk-4PVF24BB.cjs +0 -114
- package/dist/chunk-BOGCLEPR.js +0 -80
- package/dist/chunk-DE2KWQVP.cjs +0 -351
- package/dist/chunk-FETGS7X7.js +0 -114
- package/dist/chunk-H4BK3CNV.cjs +0 -864
- package/dist/chunk-P3J2BIUT.cjs +0 -80
- package/dist/chunk-QLM5NFMZ.cjs +0 -245
- package/dist/chunk-YPQA63LW.js +0 -245
- package/dist/core/actions/index.cjs +0 -29
- package/dist/core/actions/index.d.cts +0 -92
- package/dist/core/actions/index.d.ts +0 -92
- package/dist/core/actions/index.js +0 -29
- package/dist/core/index.cjs +0 -34
- package/dist/core/index.d.cts +0 -167
- package/dist/core/index.d.ts +0 -167
- package/dist/core/index.js +0 -34
- package/dist/core/interactions/index.cjs +0 -13
- package/dist/core/interactions/index.d.cts +0 -65
- package/dist/core/interactions/index.d.ts +0 -65
- package/dist/core/interactions/index.js +0 -13
- package/dist/error-Dflr3G5x.d.cts +0 -27
- package/dist/error-Dflr3G5x.d.ts +0 -27
- package/dist/interaction-BngPoHA0.d.cts +0 -22
- package/dist/interaction-BngPoHA0.d.ts +0 -22
- package/dist/processReferral-CJI_Rc4K.d.ts +0 -53
- package/dist/processReferral-DUP8imQV.d.cts +0 -53
- package/dist/react/index.cjs +0 -366
- package/dist/react/index.d.cts +0 -167
- package/dist/react/index.d.ts +0 -167
- package/dist/react/index.js +0 -366
package/dist/chunk-4MMSQL44.js
DELETED
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Deferred,
|
|
3
|
-
FrakContextManager,
|
|
4
|
-
FrakRpcError,
|
|
5
|
-
RpcErrorCodes
|
|
6
|
-
} from "./chunk-2VNIEGOJ.js";
|
|
7
|
-
import {
|
|
8
|
-
ReferralInteractionEncoder
|
|
9
|
-
} from "./chunk-FETGS7X7.js";
|
|
10
|
-
|
|
11
|
-
// src/core/actions/watchWalletStatus.ts
|
|
12
|
-
function watchWalletStatus(client, callback) {
|
|
13
|
-
if (!callback) {
|
|
14
|
-
return client.request({ method: "frak_listenToWalletStatus" }).then((result) => {
|
|
15
|
-
savePotentialToken(result.interactionToken);
|
|
16
|
-
return result;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
const firstResult = new Deferred();
|
|
20
|
-
let hasResolved = false;
|
|
21
|
-
return client.listenerRequest(
|
|
22
|
-
{
|
|
23
|
-
method: "frak_listenToWalletStatus"
|
|
24
|
-
},
|
|
25
|
-
(status) => {
|
|
26
|
-
callback(status);
|
|
27
|
-
savePotentialToken(status.interactionToken);
|
|
28
|
-
if (!hasResolved) {
|
|
29
|
-
firstResult.resolve(status);
|
|
30
|
-
hasResolved = true;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
).then(() => firstResult.promise);
|
|
34
|
-
}
|
|
35
|
-
function savePotentialToken(interactionToken) {
|
|
36
|
-
if (typeof window === "undefined") {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (interactionToken) {
|
|
40
|
-
window.sessionStorage.setItem(
|
|
41
|
-
"frak-wallet-interaction-token",
|
|
42
|
-
interactionToken
|
|
43
|
-
);
|
|
44
|
-
} else {
|
|
45
|
-
window.sessionStorage.removeItem("frak.interaction-token");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// src/core/utils/computeProductId.ts
|
|
50
|
-
import { keccak256, toHex } from "viem";
|
|
51
|
-
function computeProductId({ domain }) {
|
|
52
|
-
const effectiveDomain = domain ?? window.location.host;
|
|
53
|
-
return keccak256(toHex(effectiveDomain));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// src/core/actions/sendInteraction.ts
|
|
57
|
-
async function sendInteraction(client, { productId, interaction, validation }) {
|
|
58
|
-
const pId = productId ?? computeProductId(client.config);
|
|
59
|
-
return await client.request({
|
|
60
|
-
method: "frak_sendInteraction",
|
|
61
|
-
params: [pId, interaction, validation]
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// src/core/actions/displayModal.ts
|
|
66
|
-
async function displayModal(client, { steps, metadata }) {
|
|
67
|
-
return await client.request({
|
|
68
|
-
method: "frak_displayModal",
|
|
69
|
-
params: [steps, client.config.metadata.name, metadata]
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/core/actions/openSso.ts
|
|
74
|
-
async function openSso(client, args) {
|
|
75
|
-
const { metadata } = client.config;
|
|
76
|
-
await client.request({
|
|
77
|
-
method: "frak_sso",
|
|
78
|
-
params: [args, metadata.name, metadata.css]
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// src/core/actions/getProductInformation.ts
|
|
83
|
-
async function getProductInformation(client) {
|
|
84
|
-
return await client.request({
|
|
85
|
-
method: "frak_getProductInformation"
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// src/core/actions/trackPurchaseStatus.ts
|
|
90
|
-
async function trackPurchaseStatus(args) {
|
|
91
|
-
if (typeof window === "undefined") {
|
|
92
|
-
console.warn("[Frak] No window found, can't track purchase");
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const interactionToken = window.sessionStorage.getItem(
|
|
96
|
-
"frak-wallet-interaction-token"
|
|
97
|
-
);
|
|
98
|
-
if (!interactionToken) {
|
|
99
|
-
console.warn("[Frak] No frak session found, skipping purchase check");
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
await fetch("https://backend.frak.id/interactions/listenForPurchase", {
|
|
103
|
-
method: "POST",
|
|
104
|
-
headers: {
|
|
105
|
-
Accept: "application/json",
|
|
106
|
-
"Content-Type": "application/json",
|
|
107
|
-
"x-wallet-sdk-auth": interactionToken
|
|
108
|
-
},
|
|
109
|
-
body: JSON.stringify(args)
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// src/core/actions/wrapper/siweAuthenticate.ts
|
|
114
|
-
import { generateSiweNonce } from "viem/siwe";
|
|
115
|
-
async function siweAuthenticate(client, { siwe, metadata }) {
|
|
116
|
-
const effectiveDomain = client.config?.domain ?? window.location.host;
|
|
117
|
-
const realStatement = siwe?.statement ?? `I confirm that I want to use my Frak wallet on: ${client.config.metadata.name}`;
|
|
118
|
-
const builtSiwe = {
|
|
119
|
-
...siwe,
|
|
120
|
-
statement: realStatement,
|
|
121
|
-
nonce: siwe?.nonce ?? generateSiweNonce(),
|
|
122
|
-
uri: siwe?.uri ?? `https://${effectiveDomain}`,
|
|
123
|
-
version: siwe?.version ?? "1",
|
|
124
|
-
domain: effectiveDomain
|
|
125
|
-
};
|
|
126
|
-
const result = await displayModal(client, {
|
|
127
|
-
metadata,
|
|
128
|
-
steps: {
|
|
129
|
-
login: {},
|
|
130
|
-
siweAuthenticate: {
|
|
131
|
-
siwe: builtSiwe
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
return result.siweAuthenticate;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// src/core/actions/wrapper/sendTransaction.ts
|
|
139
|
-
async function sendTransaction(client, { tx, metadata }) {
|
|
140
|
-
const result = await displayModal(client, {
|
|
141
|
-
metadata,
|
|
142
|
-
steps: {
|
|
143
|
-
login: {},
|
|
144
|
-
sendTransaction: { tx }
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
return result.sendTransaction;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// src/core/actions/wrapper/modalBuilder.ts
|
|
151
|
-
function modalBuilder(client, {
|
|
152
|
-
metadata,
|
|
153
|
-
login,
|
|
154
|
-
openSession
|
|
155
|
-
}) {
|
|
156
|
-
const baseParams = {
|
|
157
|
-
steps: {
|
|
158
|
-
login: login ?? {},
|
|
159
|
-
openSession: openSession ?? {}
|
|
160
|
-
},
|
|
161
|
-
metadata
|
|
162
|
-
};
|
|
163
|
-
return modalStepsBuilder(client, baseParams);
|
|
164
|
-
}
|
|
165
|
-
function modalStepsBuilder(client, params) {
|
|
166
|
-
function sendTx(options) {
|
|
167
|
-
return modalStepsBuilder(client, {
|
|
168
|
-
...params,
|
|
169
|
-
steps: {
|
|
170
|
-
...params.steps,
|
|
171
|
-
sendTransaction: options
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
function reward(options) {
|
|
176
|
-
return modalStepsBuilder(
|
|
177
|
-
client,
|
|
178
|
-
{
|
|
179
|
-
...params,
|
|
180
|
-
steps: {
|
|
181
|
-
...params.steps,
|
|
182
|
-
final: {
|
|
183
|
-
...options,
|
|
184
|
-
action: { key: "reward" }
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
function sharing(sharingOptions, options) {
|
|
191
|
-
return modalStepsBuilder(
|
|
192
|
-
client,
|
|
193
|
-
{
|
|
194
|
-
...params,
|
|
195
|
-
steps: {
|
|
196
|
-
...params.steps,
|
|
197
|
-
final: {
|
|
198
|
-
...options,
|
|
199
|
-
action: { key: "sharing", options: sharingOptions }
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
async function display() {
|
|
206
|
-
return await displayModal(client, params);
|
|
207
|
-
}
|
|
208
|
-
return {
|
|
209
|
-
// Access current modal params
|
|
210
|
-
params,
|
|
211
|
-
// Function to add new steps
|
|
212
|
-
sendTx,
|
|
213
|
-
reward,
|
|
214
|
-
sharing,
|
|
215
|
-
// Display the modal
|
|
216
|
-
display
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// src/core/actions/referral/processReferral.ts
|
|
221
|
-
import { isAddressEqual } from "viem";
|
|
222
|
-
async function processReferral(client, {
|
|
223
|
-
walletStatus,
|
|
224
|
-
frakContext,
|
|
225
|
-
modalConfig,
|
|
226
|
-
productId,
|
|
227
|
-
options
|
|
228
|
-
}) {
|
|
229
|
-
let walletRequest = false;
|
|
230
|
-
async function getFreshWalletStatus() {
|
|
231
|
-
if (walletRequest) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
walletRequest = true;
|
|
235
|
-
return ensureWalletConnected(client, {
|
|
236
|
-
modalConfig,
|
|
237
|
-
walletStatus
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
async function pushReferralInteraction(referrer) {
|
|
241
|
-
const interaction = ReferralInteractionEncoder.referred({
|
|
242
|
-
referrer
|
|
243
|
-
});
|
|
244
|
-
await sendInteraction(client, { productId, interaction });
|
|
245
|
-
}
|
|
246
|
-
try {
|
|
247
|
-
const { status, currentWallet } = await processReferralLogic({
|
|
248
|
-
initialWalletStatus: walletStatus,
|
|
249
|
-
getFreshWalletStatus,
|
|
250
|
-
pushReferralInteraction,
|
|
251
|
-
frakContext
|
|
252
|
-
});
|
|
253
|
-
FrakContextManager.replaceUrl({
|
|
254
|
-
url: window.location?.href,
|
|
255
|
-
context: options?.alwaysAppendUrl ? { r: currentWallet } : null
|
|
256
|
-
});
|
|
257
|
-
return status;
|
|
258
|
-
} catch (error) {
|
|
259
|
-
console.log("Error processing referral", { error });
|
|
260
|
-
FrakContextManager.replaceUrl({
|
|
261
|
-
url: window.location?.href,
|
|
262
|
-
context: options?.alwaysAppendUrl ? { r: walletStatus?.wallet } : null
|
|
263
|
-
});
|
|
264
|
-
return mapErrorToState(error);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
async function processReferralLogic({
|
|
268
|
-
initialWalletStatus,
|
|
269
|
-
getFreshWalletStatus,
|
|
270
|
-
pushReferralInteraction,
|
|
271
|
-
frakContext
|
|
272
|
-
}) {
|
|
273
|
-
let currentWallet = initialWalletStatus?.wallet;
|
|
274
|
-
if (!frakContext?.r) {
|
|
275
|
-
return { status: "no-referrer", currentWallet };
|
|
276
|
-
}
|
|
277
|
-
if (!currentWallet) {
|
|
278
|
-
currentWallet = await getFreshWalletStatus();
|
|
279
|
-
}
|
|
280
|
-
if (currentWallet && isAddressEqual(frakContext.r, currentWallet)) {
|
|
281
|
-
return { status: "self-referral", currentWallet };
|
|
282
|
-
}
|
|
283
|
-
if (!initialWalletStatus?.interactionSession) {
|
|
284
|
-
currentWallet = await getFreshWalletStatus();
|
|
285
|
-
}
|
|
286
|
-
await pushReferralInteraction(frakContext.r);
|
|
287
|
-
return { status: "success", currentWallet };
|
|
288
|
-
}
|
|
289
|
-
async function ensureWalletConnected(client, {
|
|
290
|
-
modalConfig,
|
|
291
|
-
walletStatus
|
|
292
|
-
}) {
|
|
293
|
-
if (!walletStatus?.interactionSession) {
|
|
294
|
-
if (!modalConfig) {
|
|
295
|
-
return void 0;
|
|
296
|
-
}
|
|
297
|
-
const result = await displayModal(client, modalConfig);
|
|
298
|
-
return result?.login?.wallet ?? void 0;
|
|
299
|
-
}
|
|
300
|
-
return walletStatus.wallet ?? void 0;
|
|
301
|
-
}
|
|
302
|
-
function mapErrorToState(error) {
|
|
303
|
-
if (error instanceof FrakRpcError) {
|
|
304
|
-
switch (error.code) {
|
|
305
|
-
case RpcErrorCodes.walletNotConnected:
|
|
306
|
-
return "no-wallet";
|
|
307
|
-
case RpcErrorCodes.serverErrorForInteractionDelegation:
|
|
308
|
-
return "no-session";
|
|
309
|
-
default:
|
|
310
|
-
return "error";
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
return "error";
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// src/core/actions/referral/referralInteraction.ts
|
|
317
|
-
async function referralInteraction(client, {
|
|
318
|
-
productId,
|
|
319
|
-
modalConfig,
|
|
320
|
-
options
|
|
321
|
-
} = {}) {
|
|
322
|
-
const frakContext = FrakContextManager.parse({
|
|
323
|
-
url: window.location.href
|
|
324
|
-
});
|
|
325
|
-
const currentWalletStatus = await watchWalletStatus(client);
|
|
326
|
-
try {
|
|
327
|
-
return await processReferral(client, {
|
|
328
|
-
walletStatus: currentWalletStatus,
|
|
329
|
-
frakContext,
|
|
330
|
-
modalConfig,
|
|
331
|
-
productId,
|
|
332
|
-
options
|
|
333
|
-
});
|
|
334
|
-
} catch (error) {
|
|
335
|
-
return error;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
export {
|
|
340
|
-
watchWalletStatus,
|
|
341
|
-
sendInteraction,
|
|
342
|
-
displayModal,
|
|
343
|
-
openSso,
|
|
344
|
-
getProductInformation,
|
|
345
|
-
trackPurchaseStatus,
|
|
346
|
-
siweAuthenticate,
|
|
347
|
-
sendTransaction,
|
|
348
|
-
modalBuilder,
|
|
349
|
-
processReferral,
|
|
350
|
-
referralInteraction
|
|
351
|
-
};
|
package/dist/chunk-4PVF24BB.cjs
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkP3J2BIUTcjs = require('./chunk-P3J2BIUT.cjs');
|
|
5
|
-
|
|
6
|
-
// src/core/interactions/pressEncoder.ts
|
|
7
|
-
var _viem = require('viem');
|
|
8
|
-
function openArticle({ articleId }) {
|
|
9
|
-
const interactionData = _viem.concatHex.call(void 0, [
|
|
10
|
-
_chunkP3J2BIUTcjs.interactionTypes.press.openArticle,
|
|
11
|
-
_viem.pad.call(void 0, articleId, { size: 32 })
|
|
12
|
-
]);
|
|
13
|
-
return {
|
|
14
|
-
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkP3J2BIUTcjs.productTypes.press),
|
|
15
|
-
interactionData
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function readArticle({ articleId }) {
|
|
19
|
-
const interactionData = _viem.concatHex.call(void 0, [
|
|
20
|
-
_chunkP3J2BIUTcjs.interactionTypes.press.readArticle,
|
|
21
|
-
_viem.pad.call(void 0, articleId, { size: 32 })
|
|
22
|
-
]);
|
|
23
|
-
return {
|
|
24
|
-
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkP3J2BIUTcjs.productTypes.press),
|
|
25
|
-
interactionData
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
var PressInteractionEncoder = {
|
|
29
|
-
openArticle,
|
|
30
|
-
readArticle
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// src/core/interactions/referralEncoder.ts
|
|
34
|
-
|
|
35
|
-
function createLink() {
|
|
36
|
-
const interactionData = _viem.concatHex.call(void 0, [
|
|
37
|
-
_chunkP3J2BIUTcjs.interactionTypes.referral.createLink,
|
|
38
|
-
"0x"
|
|
39
|
-
]);
|
|
40
|
-
return {
|
|
41
|
-
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkP3J2BIUTcjs.productTypes.referral),
|
|
42
|
-
interactionData
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function referred({ referrer }) {
|
|
46
|
-
const interactionData = _viem.concatHex.call(void 0, [
|
|
47
|
-
_chunkP3J2BIUTcjs.interactionTypes.referral.referred,
|
|
48
|
-
_viem.pad.call(void 0, referrer, { size: 32 })
|
|
49
|
-
]);
|
|
50
|
-
return {
|
|
51
|
-
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkP3J2BIUTcjs.productTypes.referral),
|
|
52
|
-
interactionData
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
var ReferralInteractionEncoder = {
|
|
56
|
-
createLink,
|
|
57
|
-
referred
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// src/core/interactions/purchaseEncoder.ts
|
|
61
|
-
|
|
62
|
-
function startPurchase({
|
|
63
|
-
purchaseId
|
|
64
|
-
}) {
|
|
65
|
-
const interactionData = _viem.concatHex.call(void 0, [
|
|
66
|
-
_chunkP3J2BIUTcjs.interactionTypes.purchase.started,
|
|
67
|
-
_viem.pad.call(void 0, purchaseId, { size: 32 })
|
|
68
|
-
]);
|
|
69
|
-
return {
|
|
70
|
-
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkP3J2BIUTcjs.productTypes.purchase),
|
|
71
|
-
interactionData
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function completedPurchase({
|
|
75
|
-
purchaseId,
|
|
76
|
-
proof
|
|
77
|
-
}) {
|
|
78
|
-
const innerData = _viem.encodeAbiParameters.call(void 0,
|
|
79
|
-
[{ type: "uint256" }, { type: "bytes32[]" }],
|
|
80
|
-
[BigInt(purchaseId), proof]
|
|
81
|
-
);
|
|
82
|
-
const interactionData = _viem.concatHex.call(void 0, [
|
|
83
|
-
_chunkP3J2BIUTcjs.interactionTypes.purchase.completed,
|
|
84
|
-
innerData
|
|
85
|
-
]);
|
|
86
|
-
return {
|
|
87
|
-
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkP3J2BIUTcjs.productTypes.purchase),
|
|
88
|
-
interactionData
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
var PurchaseInteractionEncoder = {
|
|
92
|
-
startPurchase,
|
|
93
|
-
completedPurchase
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// src/core/interactions/webshopEncoder.ts
|
|
97
|
-
|
|
98
|
-
function open() {
|
|
99
|
-
const interactionData = _viem.concatHex.call(void 0, [_chunkP3J2BIUTcjs.interactionTypes.webshop.open, "0x"]);
|
|
100
|
-
return {
|
|
101
|
-
handlerTypeDenominator: _viem.toHex.call(void 0, _chunkP3J2BIUTcjs.productTypes.webshop),
|
|
102
|
-
interactionData
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
var WebShopInteractionEncoder = {
|
|
106
|
-
open
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
exports.PressInteractionEncoder = PressInteractionEncoder; exports.ReferralInteractionEncoder = ReferralInteractionEncoder; exports.PurchaseInteractionEncoder = PurchaseInteractionEncoder; exports.WebShopInteractionEncoder = WebShopInteractionEncoder;
|
package/dist/chunk-BOGCLEPR.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
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
|
-
unsafeCompleted: "0x4d5b14e0"
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export {
|
|
74
|
-
__commonJS,
|
|
75
|
-
__toESM,
|
|
76
|
-
__publicField,
|
|
77
|
-
productTypes,
|
|
78
|
-
productTypesMask,
|
|
79
|
-
interactionTypes
|
|
80
|
-
};
|