@frak-labs/core-sdk 0.0.5 → 0.0.7
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/cdn/bundle.js +7 -7
- package/dist/actions/index.cjs +30 -34
- package/dist/actions/index.d.cts +1 -1
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +22 -26
- package/dist/{chunk-PO6YSB4Q.cjs → chunk-665P7NO4.cjs} +0 -3
- package/dist/{chunk-IVQL5N55.cjs → chunk-7YDJDVXY.cjs} +21 -25
- package/dist/{chunk-XDZMP74U.js → chunk-GTBCSNLF.js} +18 -22
- package/dist/{chunk-ZDGHKI3S.cjs → chunk-PHVGCFDX.cjs} +19 -19
- package/dist/{chunk-GDH3M5ZC.js → chunk-U2NTN5QZ.js} +1 -3
- package/dist/{chunk-RMOFMRZR.js → chunk-VE6URIIJ.js} +1 -1
- package/dist/{context-C7RkT8hA.d.cts → context-D7aZDKLT.d.cts} +4 -0
- package/dist/{context-CJ5ByAXa.d.ts → context-rDsQbSgB.d.ts} +4 -0
- package/dist/index.cjs +44 -51
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -20
- package/dist/interactions/index.cjs +6 -6
- package/dist/interactions/index.js +1 -1
- package/package.json +6 -8
package/dist/actions/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Deferred, FrakContextManager, FrakRpcError, RpcErrorCodes } from '../chunk-
|
|
2
|
-
import { ReferralInteractionEncoder } from '../chunk-
|
|
1
|
+
import { Deferred, FrakContextManager, FrakRpcError, RpcErrorCodes } from '../chunk-GTBCSNLF.js';
|
|
2
|
+
import { ReferralInteractionEncoder } from '../chunk-VE6URIIJ.js';
|
|
3
3
|
import { isAddressEqual, keccak256, toHex } from 'viem';
|
|
4
4
|
import { generateSiweNonce } from 'viem/siwe';
|
|
5
5
|
|
|
@@ -41,13 +41,13 @@ function savePotentialToken(interactionToken) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
function computeProductId({ domain }) {
|
|
44
|
-
const effectiveDomain = domain
|
|
44
|
+
const effectiveDomain = domain ?? window.location.host;
|
|
45
45
|
return keccak256(toHex(effectiveDomain));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// src/actions/sendInteraction.ts
|
|
49
49
|
async function sendInteraction(client, { productId, interaction, validation }) {
|
|
50
|
-
const pId = productId
|
|
50
|
+
const pId = productId ?? computeProductId(client.config);
|
|
51
51
|
return await client.request({
|
|
52
52
|
method: "frak_sendInteraction",
|
|
53
53
|
params: [pId, interaction, validation]
|
|
@@ -110,15 +110,14 @@ async function trackPurchaseStatus(args) {
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
async function siweAuthenticate(client, { siwe, metadata }) {
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
const realStatement = (_c = siwe == null ? undefined : siwe.statement) != null ? _c : `I confirm that I want to use my Frak wallet on: ${client.config.metadata.name}`;
|
|
113
|
+
const effectiveDomain = client.config?.domain ?? window.location.host;
|
|
114
|
+
const realStatement = siwe?.statement ?? `I confirm that I want to use my Frak wallet on: ${client.config.metadata.name}`;
|
|
116
115
|
const builtSiwe = {
|
|
117
116
|
...siwe,
|
|
118
117
|
statement: realStatement,
|
|
119
|
-
nonce:
|
|
120
|
-
uri:
|
|
121
|
-
version:
|
|
118
|
+
nonce: siwe?.nonce ?? generateSiweNonce(),
|
|
119
|
+
uri: siwe?.uri ?? `https://${effectiveDomain}`,
|
|
120
|
+
version: siwe?.version ?? "1",
|
|
122
121
|
domain: effectiveDomain
|
|
123
122
|
};
|
|
124
123
|
const result = await displayModal(client, {
|
|
@@ -153,8 +152,8 @@ function modalBuilder(client, {
|
|
|
153
152
|
}) {
|
|
154
153
|
const baseParams = {
|
|
155
154
|
steps: {
|
|
156
|
-
login: login
|
|
157
|
-
openSession: openSession
|
|
155
|
+
login: login ?? {},
|
|
156
|
+
openSession: openSession ?? {}
|
|
158
157
|
},
|
|
159
158
|
metadata
|
|
160
159
|
};
|
|
@@ -201,9 +200,8 @@ function modalStepsBuilder(client, params) {
|
|
|
201
200
|
);
|
|
202
201
|
}
|
|
203
202
|
async function display(metadataOverride) {
|
|
204
|
-
var _a;
|
|
205
203
|
if (metadataOverride) {
|
|
206
|
-
params.metadata = metadataOverride(
|
|
204
|
+
params.metadata = metadataOverride(params.metadata ?? {});
|
|
207
205
|
}
|
|
208
206
|
return await displayModal(client, params);
|
|
209
207
|
}
|
|
@@ -225,7 +223,6 @@ async function processReferral(client, {
|
|
|
225
223
|
productId,
|
|
226
224
|
options
|
|
227
225
|
}) {
|
|
228
|
-
var _a, _b;
|
|
229
226
|
let walletRequest = false;
|
|
230
227
|
async function getFreshWalletStatus() {
|
|
231
228
|
if (walletRequest) {
|
|
@@ -251,15 +248,15 @@ async function processReferral(client, {
|
|
|
251
248
|
frakContext
|
|
252
249
|
});
|
|
253
250
|
FrakContextManager.replaceUrl({
|
|
254
|
-
url:
|
|
255
|
-
context:
|
|
251
|
+
url: window.location?.href,
|
|
252
|
+
context: options?.alwaysAppendUrl ? { r: currentWallet } : null
|
|
256
253
|
});
|
|
257
254
|
return status;
|
|
258
255
|
} catch (error) {
|
|
259
256
|
console.log("Error processing referral", { error });
|
|
260
257
|
FrakContextManager.replaceUrl({
|
|
261
|
-
url:
|
|
262
|
-
context:
|
|
258
|
+
url: window.location?.href,
|
|
259
|
+
context: options?.alwaysAppendUrl ? { r: walletStatus?.wallet } : null
|
|
263
260
|
});
|
|
264
261
|
return mapErrorToState(error);
|
|
265
262
|
}
|
|
@@ -270,8 +267,8 @@ async function processReferralLogic({
|
|
|
270
267
|
pushReferralInteraction,
|
|
271
268
|
frakContext
|
|
272
269
|
}) {
|
|
273
|
-
let currentWallet = initialWalletStatus
|
|
274
|
-
if (!
|
|
270
|
+
let currentWallet = initialWalletStatus?.wallet;
|
|
271
|
+
if (!frakContext?.r) {
|
|
275
272
|
return { status: "no-referrer", currentWallet };
|
|
276
273
|
}
|
|
277
274
|
if (!currentWallet) {
|
|
@@ -280,7 +277,7 @@ async function processReferralLogic({
|
|
|
280
277
|
if (currentWallet && isAddressEqual(frakContext.r, currentWallet)) {
|
|
281
278
|
return { status: "self-referral", currentWallet };
|
|
282
279
|
}
|
|
283
|
-
if (!
|
|
280
|
+
if (!initialWalletStatus?.interactionSession) {
|
|
284
281
|
currentWallet = await getFreshWalletStatus();
|
|
285
282
|
}
|
|
286
283
|
await pushReferralInteraction(frakContext.r);
|
|
@@ -290,15 +287,14 @@ async function ensureWalletConnected(client, {
|
|
|
290
287
|
modalConfig,
|
|
291
288
|
walletStatus
|
|
292
289
|
}) {
|
|
293
|
-
|
|
294
|
-
if (!(walletStatus == null ? undefined : walletStatus.interactionSession)) {
|
|
290
|
+
if (!walletStatus?.interactionSession) {
|
|
295
291
|
if (!modalConfig) {
|
|
296
292
|
return undefined;
|
|
297
293
|
}
|
|
298
294
|
const result = await displayModal(client, modalConfig);
|
|
299
|
-
return
|
|
295
|
+
return result?.login?.wallet ?? undefined;
|
|
300
296
|
}
|
|
301
|
-
return
|
|
297
|
+
return walletStatus.wallet ?? undefined;
|
|
302
298
|
}
|
|
303
299
|
function mapErrorToState(error) {
|
|
304
300
|
if (error instanceof FrakRpcError) {
|
|
@@ -6,7 +6,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
9
|
var __commonJS = (cb, mod) => function __require() {
|
|
11
10
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
11
|
};
|
|
@@ -26,7 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
26
|
mod
|
|
28
27
|
));
|
|
29
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
30
28
|
|
|
31
29
|
// src/constants/productTypes.ts
|
|
32
30
|
var productTypes = {
|
|
@@ -77,7 +75,6 @@ var interactionTypes = {
|
|
|
77
75
|
};
|
|
78
76
|
|
|
79
77
|
exports.__commonJS = __commonJS;
|
|
80
|
-
exports.__publicField = __publicField;
|
|
81
78
|
exports.__toESM = __toESM;
|
|
82
79
|
exports.interactionTypes = interactionTypes;
|
|
83
80
|
exports.productTypes = productTypes;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk665P7NO4_cjs = require('./chunk-665P7NO4.cjs');
|
|
4
4
|
var jsSha256 = require('js-sha256');
|
|
5
5
|
var viem = require('viem');
|
|
6
6
|
|
|
7
7
|
// ../../node_modules/async-lz-string/libs/async-lz-string.js
|
|
8
|
-
var require_async_lz_string =
|
|
8
|
+
var require_async_lz_string = chunk665P7NO4_cjs.__commonJS({
|
|
9
9
|
"../../node_modules/async-lz-string/libs/async-lz-string.js"(exports, module) {
|
|
10
10
|
!function(t, e) {
|
|
11
11
|
if ("object" == typeof exports && "object" == typeof module) module.exports = e();
|
|
@@ -584,18 +584,10 @@ var RpcErrorCodes = {
|
|
|
584
584
|
|
|
585
585
|
// src/utils/Deferred.ts
|
|
586
586
|
var Deferred = class {
|
|
587
|
+
_promise;
|
|
588
|
+
_resolve;
|
|
589
|
+
_reject;
|
|
587
590
|
constructor() {
|
|
588
|
-
chunkPO6YSB4Q_cjs.__publicField(this, "_promise");
|
|
589
|
-
chunkPO6YSB4Q_cjs.__publicField(this, "_resolve");
|
|
590
|
-
chunkPO6YSB4Q_cjs.__publicField(this, "_reject");
|
|
591
|
-
chunkPO6YSB4Q_cjs.__publicField(this, "resolve", (value) => {
|
|
592
|
-
var _a;
|
|
593
|
-
(_a = this._resolve) == null ? undefined : _a.call(this, value);
|
|
594
|
-
});
|
|
595
|
-
chunkPO6YSB4Q_cjs.__publicField(this, "reject", (reason) => {
|
|
596
|
-
var _a;
|
|
597
|
-
(_a = this._reject) == null ? undefined : _a.call(this, reason);
|
|
598
|
-
});
|
|
599
591
|
this._promise = new Promise((resolve, reject) => {
|
|
600
592
|
this._resolve = resolve;
|
|
601
593
|
this._reject = reject;
|
|
@@ -604,10 +596,16 @@ var Deferred = class {
|
|
|
604
596
|
get promise() {
|
|
605
597
|
return this._promise;
|
|
606
598
|
}
|
|
599
|
+
resolve = (value) => {
|
|
600
|
+
this._resolve?.(value);
|
|
601
|
+
};
|
|
602
|
+
reject = (reason) => {
|
|
603
|
+
this._reject?.(reason);
|
|
604
|
+
};
|
|
607
605
|
};
|
|
608
606
|
|
|
609
607
|
// src/utils/compression/compress.ts
|
|
610
|
-
var import_async_lz_string =
|
|
608
|
+
var import_async_lz_string = chunk665P7NO4_cjs.__toESM(require_async_lz_string(), 1);
|
|
611
609
|
async function hashAndCompressData(data) {
|
|
612
610
|
const validationHash = jsSha256.sha256(JSON.stringify(data));
|
|
613
611
|
const hashProtectedData = {
|
|
@@ -626,9 +624,9 @@ async function compressJson(data) {
|
|
|
626
624
|
}
|
|
627
625
|
|
|
628
626
|
// src/utils/compression/decompress.ts
|
|
629
|
-
var import_async_lz_string2 =
|
|
627
|
+
var import_async_lz_string2 = chunk665P7NO4_cjs.__toESM(require_async_lz_string(), 1);
|
|
630
628
|
async function decompressDataAndCheckHash(compressedData) {
|
|
631
|
-
if (!(
|
|
629
|
+
if (!(compressedData?.compressed && compressedData?.compressedHash)) {
|
|
632
630
|
throw new FrakRpcError(
|
|
633
631
|
RpcErrorCodes.corruptedResponse,
|
|
634
632
|
"Missing compressed data"
|
|
@@ -643,7 +641,7 @@ async function decompressDataAndCheckHash(compressedData) {
|
|
|
643
641
|
"Invalid compressed data"
|
|
644
642
|
);
|
|
645
643
|
}
|
|
646
|
-
if (!
|
|
644
|
+
if (!parsedData?.validationHash) {
|
|
647
645
|
throw new FrakRpcError(
|
|
648
646
|
RpcErrorCodes.corruptedResponse,
|
|
649
647
|
"Missing validation hash"
|
|
@@ -686,7 +684,7 @@ var baseIframeProps = {
|
|
|
686
684
|
height: "0",
|
|
687
685
|
border: "0",
|
|
688
686
|
position: "absolute",
|
|
689
|
-
zIndex:
|
|
687
|
+
zIndex: 2000001,
|
|
690
688
|
top: "-1000px",
|
|
691
689
|
left: "-1000px"
|
|
692
690
|
}
|
|
@@ -707,9 +705,8 @@ function createIframe({
|
|
|
707
705
|
changeIframeVisibility({ iframe, isVisible: false });
|
|
708
706
|
document.body.appendChild(iframe);
|
|
709
707
|
return new Promise((resolve) => {
|
|
710
|
-
|
|
711
|
-
iframe
|
|
712
|
-
iframe.src = `${(_b = (_a = config == null ? undefined : config.walletUrl) != null ? _a : walletBaseUrl) != null ? _b : "https://wallet.frak.id"}/listener`;
|
|
708
|
+
iframe?.addEventListener("load", () => resolve(iframe));
|
|
709
|
+
iframe.src = `${config?.walletUrl ?? walletBaseUrl ?? "https://wallet.frak.id"}/listener`;
|
|
713
710
|
});
|
|
714
711
|
}
|
|
715
712
|
function changeIframeVisibility({
|
|
@@ -746,7 +743,7 @@ function base64url_decode(value) {
|
|
|
746
743
|
);
|
|
747
744
|
}
|
|
748
745
|
function compress(context) {
|
|
749
|
-
if (!
|
|
746
|
+
if (!context?.r) return;
|
|
750
747
|
try {
|
|
751
748
|
const bytes = viem.hexToBytes(context.r);
|
|
752
749
|
return base64url_encode(bytes);
|
|
@@ -795,12 +792,11 @@ function replaceUrl({
|
|
|
795
792
|
url: baseUrl,
|
|
796
793
|
context
|
|
797
794
|
}) {
|
|
798
|
-
|
|
799
|
-
if (!((_a = window.location) == null ? undefined : _a.href) || typeof window === "undefined") {
|
|
795
|
+
if (!window.location?.href || typeof window === "undefined") {
|
|
800
796
|
console.error("No window found, can't update context");
|
|
801
797
|
return;
|
|
802
798
|
}
|
|
803
|
-
const url = baseUrl
|
|
799
|
+
const url = baseUrl ?? window.location.href;
|
|
804
800
|
let newUrl;
|
|
805
801
|
if (context !== null) {
|
|
806
802
|
newUrl = update({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __commonJS, __toESM
|
|
1
|
+
import { __commonJS, __toESM } from './chunk-U2NTN5QZ.js';
|
|
2
2
|
import { sha256 } from 'js-sha256';
|
|
3
3
|
import { hexToBytes, bytesToHex } from 'viem';
|
|
4
4
|
|
|
@@ -582,18 +582,10 @@ var RpcErrorCodes = {
|
|
|
582
582
|
|
|
583
583
|
// src/utils/Deferred.ts
|
|
584
584
|
var Deferred = class {
|
|
585
|
+
_promise;
|
|
586
|
+
_resolve;
|
|
587
|
+
_reject;
|
|
585
588
|
constructor() {
|
|
586
|
-
__publicField(this, "_promise");
|
|
587
|
-
__publicField(this, "_resolve");
|
|
588
|
-
__publicField(this, "_reject");
|
|
589
|
-
__publicField(this, "resolve", (value) => {
|
|
590
|
-
var _a;
|
|
591
|
-
(_a = this._resolve) == null ? undefined : _a.call(this, value);
|
|
592
|
-
});
|
|
593
|
-
__publicField(this, "reject", (reason) => {
|
|
594
|
-
var _a;
|
|
595
|
-
(_a = this._reject) == null ? undefined : _a.call(this, reason);
|
|
596
|
-
});
|
|
597
589
|
this._promise = new Promise((resolve, reject) => {
|
|
598
590
|
this._resolve = resolve;
|
|
599
591
|
this._reject = reject;
|
|
@@ -602,6 +594,12 @@ var Deferred = class {
|
|
|
602
594
|
get promise() {
|
|
603
595
|
return this._promise;
|
|
604
596
|
}
|
|
597
|
+
resolve = (value) => {
|
|
598
|
+
this._resolve?.(value);
|
|
599
|
+
};
|
|
600
|
+
reject = (reason) => {
|
|
601
|
+
this._reject?.(reason);
|
|
602
|
+
};
|
|
605
603
|
};
|
|
606
604
|
|
|
607
605
|
// src/utils/compression/compress.ts
|
|
@@ -626,7 +624,7 @@ async function compressJson(data) {
|
|
|
626
624
|
// src/utils/compression/decompress.ts
|
|
627
625
|
var import_async_lz_string2 = __toESM(require_async_lz_string(), 1);
|
|
628
626
|
async function decompressDataAndCheckHash(compressedData) {
|
|
629
|
-
if (!(
|
|
627
|
+
if (!(compressedData?.compressed && compressedData?.compressedHash)) {
|
|
630
628
|
throw new FrakRpcError(
|
|
631
629
|
RpcErrorCodes.corruptedResponse,
|
|
632
630
|
"Missing compressed data"
|
|
@@ -641,7 +639,7 @@ async function decompressDataAndCheckHash(compressedData) {
|
|
|
641
639
|
"Invalid compressed data"
|
|
642
640
|
);
|
|
643
641
|
}
|
|
644
|
-
if (!
|
|
642
|
+
if (!parsedData?.validationHash) {
|
|
645
643
|
throw new FrakRpcError(
|
|
646
644
|
RpcErrorCodes.corruptedResponse,
|
|
647
645
|
"Missing validation hash"
|
|
@@ -684,7 +682,7 @@ var baseIframeProps = {
|
|
|
684
682
|
height: "0",
|
|
685
683
|
border: "0",
|
|
686
684
|
position: "absolute",
|
|
687
|
-
zIndex:
|
|
685
|
+
zIndex: 2000001,
|
|
688
686
|
top: "-1000px",
|
|
689
687
|
left: "-1000px"
|
|
690
688
|
}
|
|
@@ -705,9 +703,8 @@ function createIframe({
|
|
|
705
703
|
changeIframeVisibility({ iframe, isVisible: false });
|
|
706
704
|
document.body.appendChild(iframe);
|
|
707
705
|
return new Promise((resolve) => {
|
|
708
|
-
|
|
709
|
-
iframe
|
|
710
|
-
iframe.src = `${(_b = (_a = config == null ? undefined : config.walletUrl) != null ? _a : walletBaseUrl) != null ? _b : "https://wallet.frak.id"}/listener`;
|
|
706
|
+
iframe?.addEventListener("load", () => resolve(iframe));
|
|
707
|
+
iframe.src = `${config?.walletUrl ?? walletBaseUrl ?? "https://wallet.frak.id"}/listener`;
|
|
711
708
|
});
|
|
712
709
|
}
|
|
713
710
|
function changeIframeVisibility({
|
|
@@ -744,7 +741,7 @@ function base64url_decode(value) {
|
|
|
744
741
|
);
|
|
745
742
|
}
|
|
746
743
|
function compress(context) {
|
|
747
|
-
if (!
|
|
744
|
+
if (!context?.r) return;
|
|
748
745
|
try {
|
|
749
746
|
const bytes = hexToBytes(context.r);
|
|
750
747
|
return base64url_encode(bytes);
|
|
@@ -793,12 +790,11 @@ function replaceUrl({
|
|
|
793
790
|
url: baseUrl,
|
|
794
791
|
context
|
|
795
792
|
}) {
|
|
796
|
-
|
|
797
|
-
if (!((_a = window.location) == null ? undefined : _a.href) || typeof window === "undefined") {
|
|
793
|
+
if (!window.location?.href || typeof window === "undefined") {
|
|
798
794
|
console.error("No window found, can't update context");
|
|
799
795
|
return;
|
|
800
796
|
}
|
|
801
|
-
const url = baseUrl
|
|
797
|
+
const url = baseUrl ?? window.location.href;
|
|
802
798
|
let newUrl;
|
|
803
799
|
if (context !== null) {
|
|
804
800
|
newUrl = update({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk665P7NO4_cjs = require('./chunk-665P7NO4.cjs');
|
|
4
4
|
var viem = require('viem');
|
|
5
5
|
|
|
6
6
|
var PressInteractionEncoder = {
|
|
@@ -11,11 +11,11 @@ var PressInteractionEncoder = {
|
|
|
11
11
|
*/
|
|
12
12
|
openArticle({ articleId }) {
|
|
13
13
|
const interactionData = viem.concatHex([
|
|
14
|
-
|
|
14
|
+
chunk665P7NO4_cjs.interactionTypes.press.openArticle,
|
|
15
15
|
viem.pad(articleId, { size: 32 })
|
|
16
16
|
]);
|
|
17
17
|
return {
|
|
18
|
-
handlerTypeDenominator: viem.toHex(
|
|
18
|
+
handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.press),
|
|
19
19
|
interactionData
|
|
20
20
|
};
|
|
21
21
|
},
|
|
@@ -26,11 +26,11 @@ var PressInteractionEncoder = {
|
|
|
26
26
|
*/
|
|
27
27
|
readArticle({ articleId }) {
|
|
28
28
|
const interactionData = viem.concatHex([
|
|
29
|
-
|
|
29
|
+
chunk665P7NO4_cjs.interactionTypes.press.readArticle,
|
|
30
30
|
viem.pad(articleId, { size: 32 })
|
|
31
31
|
]);
|
|
32
32
|
return {
|
|
33
|
-
handlerTypeDenominator: viem.toHex(
|
|
33
|
+
handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.press),
|
|
34
34
|
interactionData
|
|
35
35
|
};
|
|
36
36
|
}
|
|
@@ -41,8 +41,8 @@ var ReferralInteractionEncoder = {
|
|
|
41
41
|
*/
|
|
42
42
|
createLink() {
|
|
43
43
|
return {
|
|
44
|
-
handlerTypeDenominator: viem.toHex(
|
|
45
|
-
interactionData:
|
|
44
|
+
handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.referral),
|
|
45
|
+
interactionData: chunk665P7NO4_cjs.interactionTypes.referral.createLink
|
|
46
46
|
};
|
|
47
47
|
},
|
|
48
48
|
/**
|
|
@@ -52,11 +52,11 @@ var ReferralInteractionEncoder = {
|
|
|
52
52
|
*/
|
|
53
53
|
referred({ referrer }) {
|
|
54
54
|
const interactionData = viem.concatHex([
|
|
55
|
-
|
|
55
|
+
chunk665P7NO4_cjs.interactionTypes.referral.referred,
|
|
56
56
|
viem.pad(referrer, { size: 32 })
|
|
57
57
|
]);
|
|
58
58
|
return {
|
|
59
|
-
handlerTypeDenominator: viem.toHex(
|
|
59
|
+
handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.referral),
|
|
60
60
|
interactionData
|
|
61
61
|
};
|
|
62
62
|
}
|
|
@@ -69,11 +69,11 @@ var PurchaseInteractionEncoder = {
|
|
|
69
69
|
*/
|
|
70
70
|
startPurchase({ purchaseId }) {
|
|
71
71
|
const interactionData = viem.concatHex([
|
|
72
|
-
|
|
72
|
+
chunk665P7NO4_cjs.interactionTypes.purchase.started,
|
|
73
73
|
viem.pad(purchaseId, { size: 32 })
|
|
74
74
|
]);
|
|
75
75
|
return {
|
|
76
|
-
handlerTypeDenominator: viem.toHex(
|
|
76
|
+
handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.purchase),
|
|
77
77
|
interactionData
|
|
78
78
|
};
|
|
79
79
|
},
|
|
@@ -92,11 +92,11 @@ var PurchaseInteractionEncoder = {
|
|
|
92
92
|
[BigInt(purchaseId), proof]
|
|
93
93
|
);
|
|
94
94
|
const interactionData = viem.concatHex([
|
|
95
|
-
|
|
95
|
+
chunk665P7NO4_cjs.interactionTypes.purchase.completed,
|
|
96
96
|
innerData
|
|
97
97
|
]);
|
|
98
98
|
return {
|
|
99
|
-
handlerTypeDenominator: viem.toHex(
|
|
99
|
+
handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.purchase),
|
|
100
100
|
interactionData
|
|
101
101
|
};
|
|
102
102
|
},
|
|
@@ -109,11 +109,11 @@ var PurchaseInteractionEncoder = {
|
|
|
109
109
|
purchaseId
|
|
110
110
|
}) {
|
|
111
111
|
const interactionData = viem.concatHex([
|
|
112
|
-
|
|
112
|
+
chunk665P7NO4_cjs.interactionTypes.purchase.unsafeCompleted,
|
|
113
113
|
viem.pad(purchaseId, { size: 32 })
|
|
114
114
|
]);
|
|
115
115
|
return {
|
|
116
|
-
handlerTypeDenominator: viem.toHex(
|
|
116
|
+
handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.purchase),
|
|
117
117
|
interactionData
|
|
118
118
|
};
|
|
119
119
|
}
|
|
@@ -124,8 +124,8 @@ var WebShopInteractionEncoder = {
|
|
|
124
124
|
*/
|
|
125
125
|
open() {
|
|
126
126
|
return {
|
|
127
|
-
handlerTypeDenominator: viem.toHex(
|
|
128
|
-
interactionData:
|
|
127
|
+
handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.webshop),
|
|
128
|
+
interactionData: chunk665P7NO4_cjs.interactionTypes.webshop.open
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
};
|
|
@@ -138,11 +138,11 @@ var RetailInteractionEncoder = {
|
|
|
138
138
|
*/
|
|
139
139
|
customerMeeting({ agencyId }) {
|
|
140
140
|
const interactionData = viem.concatHex([
|
|
141
|
-
|
|
141
|
+
chunk665P7NO4_cjs.interactionTypes.retail.customerMeeting,
|
|
142
142
|
viem.pad(agencyId, { size: 32 })
|
|
143
143
|
]);
|
|
144
144
|
return {
|
|
145
|
-
handlerTypeDenominator: viem.toHex(
|
|
145
|
+
handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.retail),
|
|
146
146
|
interactionData
|
|
147
147
|
};
|
|
148
148
|
}
|
|
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
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
7
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
8
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
9
|
};
|
|
@@ -24,7 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
23
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
24
|
mod
|
|
26
25
|
));
|
|
27
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
28
26
|
|
|
29
27
|
// src/constants/productTypes.ts
|
|
30
28
|
var productTypes = {
|
|
@@ -74,4 +72,4 @@ var interactionTypes = {
|
|
|
74
72
|
}
|
|
75
73
|
};
|
|
76
74
|
|
|
77
|
-
export { __commonJS,
|
|
75
|
+
export { __commonJS, __toESM, interactionTypes, productTypes, productTypesMask };
|