@frak-labs/core-sdk 0.0.4 → 0.0.6

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.
@@ -1,13 +1,10 @@
1
- import {
2
- __commonJS,
3
- __publicField,
4
- __toESM
5
- } from "./chunk-GDH3M5ZC.js";
1
+ import { __commonJS, __toESM } from './chunk-U2NTN5QZ.js';
2
+ import { sha256 } from 'js-sha256';
3
+ import { hexToBytes, bytesToHex } from 'viem';
6
4
 
7
5
  // ../../node_modules/async-lz-string/libs/async-lz-string.js
8
6
  var require_async_lz_string = __commonJS({
9
7
  "../../node_modules/async-lz-string/libs/async-lz-string.js"(exports, module) {
10
- "use strict";
11
8
  !function(t, e) {
12
9
  if ("object" == typeof exports && "object" == typeof module) module.exports = e();
13
10
  else if ("function" == typeof define && define.amd) define([], e);
@@ -16,7 +13,6 @@ var require_async_lz_string = __commonJS({
16
13
  for (var r in n) ("object" == typeof exports ? exports : t)[r] = n[r];
17
14
  }
18
15
  }(exports, () => (() => {
19
- "use strict";
20
16
  var t = { 48: function(t2, e2, n) {
21
17
  var r = this && this.__awaiter || function(t3, e3, n2, r2) {
22
18
  return new (n2 || (n2 = Promise))(function(a2, o2) {
@@ -96,15 +92,15 @@ var require_async_lz_string = __commonJS({
96
92
  n2 = a2 = 0;
97
93
  }
98
94
  if (5 & s4[0]) throw s4[1];
99
- return { value: s4[0] ? s4[1] : void 0, done: true };
95
+ return { value: s4[0] ? s4[1] : undefined, done: true };
100
96
  }([s3, u2]);
101
97
  };
102
98
  }
103
99
  };
104
- Object.defineProperty(e2, "__esModule", { value: true }), e2.decompressFromUTF16 = e2.compressToUTF16 = e2.decompressFromBase64 = e2.compressToBase64 = void 0;
100
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.decompressFromUTF16 = e2.compressToUTF16 = e2.decompressFromBase64 = e2.compressToBase64 = undefined;
105
101
  var o = n(304), i = n(134), s = new o.CompressorImpl(), u = new i.DecompressorImpl(), c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", l = {};
106
102
  e2.compressToBase64 = function(t3) {
107
- return r(this, void 0, void 0, function() {
103
+ return r(this, undefined, undefined, function() {
108
104
  var e3;
109
105
  return a(this, function(n2) {
110
106
  switch (n2.label) {
@@ -129,7 +125,7 @@ var require_async_lz_string = __commonJS({
129
125
  });
130
126
  });
131
127
  }, e2.decompressFromBase64 = function(t3) {
132
- return r(this, void 0, void 0, function() {
128
+ return r(this, undefined, undefined, function() {
133
129
  return a(this, function(e3) {
134
130
  switch (e3.label) {
135
131
  case 0:
@@ -148,7 +144,7 @@ var require_async_lz_string = __commonJS({
148
144
  });
149
145
  });
150
146
  }, e2.compressToUTF16 = function(t3) {
151
- return r(this, void 0, void 0, function() {
147
+ return r(this, undefined, undefined, function() {
152
148
  return a(this, function(e3) {
153
149
  switch (e3.label) {
154
150
  case 0:
@@ -161,7 +157,7 @@ var require_async_lz_string = __commonJS({
161
157
  });
162
158
  });
163
159
  }, e2.decompressFromUTF16 = function(t3) {
164
- return r(this, void 0, void 0, function() {
160
+ return r(this, undefined, undefined, function() {
165
161
  return a(this, function(e3) {
166
162
  switch (e3.label) {
167
163
  case 0:
@@ -253,12 +249,12 @@ var require_async_lz_string = __commonJS({
253
249
  n2 = a2 = 0;
254
250
  }
255
251
  if (5 & s4[0]) throw s4[1];
256
- return { value: s4[0] ? s4[1] : void 0, done: true };
252
+ return { value: s4[0] ? s4[1] : undefined, done: true };
257
253
  }([s3, u]);
258
254
  };
259
255
  }
260
256
  };
261
- Object.defineProperty(e2, "__esModule", { value: true }), e2.CompressorImpl = void 0;
257
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.CompressorImpl = undefined;
262
258
  var o = n(658), i = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], s = function() {
263
259
  function t3() {
264
260
  }
@@ -278,7 +274,7 @@ var require_async_lz_string = __commonJS({
278
274
  }, t3.prototype.compress = function(e3, n2, i2) {
279
275
  var s2 = this;
280
276
  return new Promise(function(u) {
281
- return r(s2, void 0, void 0, function() {
277
+ return r(s2, undefined, undefined, function() {
282
278
  var r2, s3;
283
279
  return a(this, function(a2) {
284
280
  switch (a2.label) {
@@ -379,19 +375,19 @@ var require_async_lz_string = __commonJS({
379
375
  n2 = a2 = 0;
380
376
  }
381
377
  if (5 & s3[0]) throw s3[1];
382
- return { value: s3[0] ? s3[1] : void 0, done: true };
378
+ return { value: s3[0] ? s3[1] : undefined, done: true };
383
379
  }([s2, u]);
384
380
  };
385
381
  }
386
382
  };
387
- Object.defineProperty(e2, "__esModule", { value: true }), e2.DecompressorImpl = void 0;
383
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.DecompressorImpl = undefined;
388
384
  var o = n(658), i = function() {
389
385
  function t3() {
390
386
  }
391
387
  return t3.prototype.decompress = function(t4, e3, n2) {
392
388
  var i2 = this;
393
389
  return new Promise(function(s) {
394
- return r(i2, void 0, void 0, function() {
390
+ return r(i2, undefined, undefined, function() {
395
391
  var r2, i3, u;
396
392
  return a(this, function(a2) {
397
393
  switch (a2.label) {
@@ -524,13 +520,13 @@ var require_async_lz_string = __commonJS({
524
520
  n2 = a = 0;
525
521
  }
526
522
  if (5 & s3[0]) throw s3[1];
527
- return { value: s3[0] ? s3[1] : void 0, done: true };
523
+ return { value: s3[0] ? s3[1] : undefined, done: true };
528
524
  }([s2, u]);
529
525
  };
530
526
  }
531
527
  };
532
- Object.defineProperty(e2, "__esModule", { value: true }), e2.wait = void 0, e2.wait = function() {
533
- return n(this, void 0, void 0, function() {
528
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.wait = undefined, e2.wait = function() {
529
+ return n(this, undefined, undefined, function() {
534
530
  return r(this, function(t3) {
535
531
  return [2, new Promise(function(t4) {
536
532
  setTimeout(t4, 0);
@@ -541,7 +537,7 @@ var require_async_lz_string = __commonJS({
541
537
  } }, e = {};
542
538
  return function n(r) {
543
539
  var a = e[r];
544
- if (void 0 !== a) return a.exports;
540
+ if (undefined !== a) return a.exports;
545
541
  var o = e[r] = { exports: {} };
546
542
  return t[r].call(o.exports, o, o.exports, n), o.exports;
547
543
  }(48);
@@ -586,16 +582,10 @@ var RpcErrorCodes = {
586
582
 
587
583
  // src/utils/Deferred.ts
588
584
  var Deferred = class {
585
+ _promise;
586
+ _resolve;
587
+ _reject;
589
588
  constructor() {
590
- __publicField(this, "_promise");
591
- __publicField(this, "_resolve");
592
- __publicField(this, "_reject");
593
- __publicField(this, "resolve", (value) => {
594
- this._resolve?.(value);
595
- });
596
- __publicField(this, "reject", (reason) => {
597
- this._reject?.(reason);
598
- });
599
589
  this._promise = new Promise((resolve, reject) => {
600
590
  this._resolve = resolve;
601
591
  this._reject = reject;
@@ -604,11 +594,16 @@ var Deferred = class {
604
594
  get promise() {
605
595
  return this._promise;
606
596
  }
597
+ resolve = (value) => {
598
+ this._resolve?.(value);
599
+ };
600
+ reject = (reason) => {
601
+ this._reject?.(reason);
602
+ };
607
603
  };
608
604
 
609
605
  // src/utils/compression/compress.ts
610
606
  var import_async_lz_string = __toESM(require_async_lz_string(), 1);
611
- import { sha256 } from "js-sha256";
612
607
  async function hashAndCompressData(data) {
613
608
  const validationHash = sha256(JSON.stringify(data));
614
609
  const hashProtectedData = {
@@ -628,7 +623,6 @@ async function compressJson(data) {
628
623
 
629
624
  // src/utils/compression/decompress.ts
630
625
  var import_async_lz_string2 = __toESM(require_async_lz_string(), 1);
631
- import { sha256 as sha2562 } from "js-sha256";
632
626
  async function decompressDataAndCheckHash(compressedData) {
633
627
  if (!(compressedData?.compressed && compressedData?.compressedHash)) {
634
628
  throw new FrakRpcError(
@@ -651,7 +645,7 @@ async function decompressDataAndCheckHash(compressedData) {
651
645
  "Missing validation hash"
652
646
  );
653
647
  }
654
- const expectedCompressedHash = sha2562(compressedData.compressed);
648
+ const expectedCompressedHash = sha256(compressedData.compressed);
655
649
  if (expectedCompressedHash !== compressedData.compressedHash) {
656
650
  throw new FrakRpcError(
657
651
  RpcErrorCodes.corruptedResponse,
@@ -659,7 +653,7 @@ async function decompressDataAndCheckHash(compressedData) {
659
653
  );
660
654
  }
661
655
  const { validationHash: _, ...rawResultData } = parsedData;
662
- const expectedValidationHash = sha2562(JSON.stringify(rawResultData));
656
+ const expectedValidationHash = sha256(JSON.stringify(rawResultData));
663
657
  if (expectedValidationHash !== parsedData.validationHash) {
664
658
  throw new FrakRpcError(
665
659
  RpcErrorCodes.corruptedResponse,
@@ -688,7 +682,7 @@ var baseIframeProps = {
688
682
  height: "0",
689
683
  border: "0",
690
684
  position: "absolute",
691
- zIndex: 1e3,
685
+ zIndex: 2000001,
692
686
  top: "-1000px",
693
687
  left: "-1000px"
694
688
  }
@@ -733,9 +727,6 @@ function changeIframeVisibility({
733
727
  iframe.style.height = "100%";
734
728
  iframe.style.pointerEvents = "auto";
735
729
  }
736
-
737
- // src/utils/FrakContext.ts
738
- import { bytesToHex, hexToBytes } from "viem";
739
730
  var contextKey = "fCtx";
740
731
  function base64url_encode(buffer) {
741
732
  return btoa(Array.from(buffer, (b) => String.fromCharCode(b)).join("")).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
@@ -757,7 +748,7 @@ function compress(context) {
757
748
  } catch (e) {
758
749
  console.error("Error compressing Frak context", { e, context });
759
750
  }
760
- return void 0;
751
+ return undefined;
761
752
  }
762
753
  function decompress(context) {
763
754
  if (!context || context.length === 0) return;
@@ -767,7 +758,7 @@ function decompress(context) {
767
758
  } catch (e) {
768
759
  console.error("Error decompressing Frak context", { e, context });
769
760
  }
770
- return void 0;
761
+ return undefined;
771
762
  }
772
763
  function parse({ url }) {
773
764
  if (!url) return null;
@@ -825,18 +816,4 @@ var FrakContextManager = {
825
816
  replaceUrl
826
817
  };
827
818
 
828
- export {
829
- FrakRpcError,
830
- InternalError,
831
- ClientNotFound,
832
- RpcErrorCodes,
833
- Deferred,
834
- hashAndCompressData,
835
- compressJson,
836
- decompressDataAndCheckHash,
837
- decompressJson,
838
- baseIframeProps,
839
- createIframe,
840
- changeIframeVisibility,
841
- FrakContextManager
842
- };
819
+ export { ClientNotFound, Deferred, FrakContextManager, FrakRpcError, InternalError, RpcErrorCodes, baseIframeProps, changeIframeVisibility, compressJson, createIframe, decompressDataAndCheckHash, decompressJson, hashAndCompressData };
@@ -0,0 +1,155 @@
1
+ 'use strict';
2
+
3
+ var chunk665P7NO4_cjs = require('./chunk-665P7NO4.cjs');
4
+ var viem = require('viem');
5
+
6
+ var PressInteractionEncoder = {
7
+ /**
8
+ * Encode an open article interaction
9
+ * @param args
10
+ * @param args.articleId - The id of the article the user opened (32 bytes), could be a `keccak256` hash of the article slug, or your internal id
11
+ */
12
+ openArticle({ articleId }) {
13
+ const interactionData = viem.concatHex([
14
+ chunk665P7NO4_cjs.interactionTypes.press.openArticle,
15
+ viem.pad(articleId, { size: 32 })
16
+ ]);
17
+ return {
18
+ handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.press),
19
+ interactionData
20
+ };
21
+ },
22
+ /**
23
+ * Encode a read article interaction
24
+ * @param args
25
+ * @param args.articleId - The id of the article the user opened (32 bytes), could be a `keccak256` hash of the article slug, or your internal id
26
+ */
27
+ readArticle({ articleId }) {
28
+ const interactionData = viem.concatHex([
29
+ chunk665P7NO4_cjs.interactionTypes.press.readArticle,
30
+ viem.pad(articleId, { size: 32 })
31
+ ]);
32
+ return {
33
+ handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.press),
34
+ interactionData
35
+ };
36
+ }
37
+ };
38
+ var ReferralInteractionEncoder = {
39
+ /**
40
+ * Records the event of a user creating a referral link. Note that this interaction doesn't actually create the link itself; it only sends an event to track that a link was created.
41
+ */
42
+ createLink() {
43
+ return {
44
+ handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.referral),
45
+ interactionData: chunk665P7NO4_cjs.interactionTypes.referral.createLink
46
+ };
47
+ },
48
+ /**
49
+ * Encode a referred interaction
50
+ * @param args
51
+ * @param args.referrer - The Ethereum address of the user who made the referral
52
+ */
53
+ referred({ referrer }) {
54
+ const interactionData = viem.concatHex([
55
+ chunk665P7NO4_cjs.interactionTypes.referral.referred,
56
+ viem.pad(referrer, { size: 32 })
57
+ ]);
58
+ return {
59
+ handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.referral),
60
+ interactionData
61
+ };
62
+ }
63
+ };
64
+ var PurchaseInteractionEncoder = {
65
+ /**
66
+ * Encode a start purchase interaction
67
+ * @param args
68
+ * @param args.purchaseId - The id of the purchase that is being started.
69
+ */
70
+ startPurchase({ purchaseId }) {
71
+ const interactionData = viem.concatHex([
72
+ chunk665P7NO4_cjs.interactionTypes.purchase.started,
73
+ viem.pad(purchaseId, { size: 32 })
74
+ ]);
75
+ return {
76
+ handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.purchase),
77
+ interactionData
78
+ };
79
+ },
80
+ /**
81
+ * Encode a complete purchase interaction
82
+ * @param args
83
+ * @param args.purchaseId - The id of the purchase that is being completed.
84
+ * @param args.proof - The merkle proof that the user has completed the purchase (see [Purchase Webhooks](/wallet-sdk/references-api/webhook) for more details).
85
+ */
86
+ completedPurchase({
87
+ purchaseId,
88
+ proof
89
+ }) {
90
+ const innerData = viem.encodeAbiParameters(
91
+ [{ type: "uint256" }, { type: "bytes32[]" }],
92
+ [BigInt(purchaseId), proof]
93
+ );
94
+ const interactionData = viem.concatHex([
95
+ chunk665P7NO4_cjs.interactionTypes.purchase.completed,
96
+ innerData
97
+ ]);
98
+ return {
99
+ handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.purchase),
100
+ interactionData
101
+ };
102
+ },
103
+ /**
104
+ * Encode an unsafe complete purchase interaction (when we can't provide the proof)
105
+ * @param args
106
+ * @param args.purchaseId - The id of the purchase that is being completed.
107
+ */
108
+ unsafeCompletedPurchase({
109
+ purchaseId
110
+ }) {
111
+ const interactionData = viem.concatHex([
112
+ chunk665P7NO4_cjs.interactionTypes.purchase.unsafeCompleted,
113
+ viem.pad(purchaseId, { size: 32 })
114
+ ]);
115
+ return {
116
+ handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.purchase),
117
+ interactionData
118
+ };
119
+ }
120
+ };
121
+ var WebShopInteractionEncoder = {
122
+ /**
123
+ * Encode an open webshop interaction
124
+ */
125
+ open() {
126
+ return {
127
+ handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.webshop),
128
+ interactionData: chunk665P7NO4_cjs.interactionTypes.webshop.open
129
+ };
130
+ }
131
+ };
132
+ var RetailInteractionEncoder = {
133
+ /**
134
+ * Encode a customer meeting retail interaction
135
+ * @param args
136
+ * @param args.agencyId - The id of the agency that the customer is meeting with
137
+ *
138
+ */
139
+ customerMeeting({ agencyId }) {
140
+ const interactionData = viem.concatHex([
141
+ chunk665P7NO4_cjs.interactionTypes.retail.customerMeeting,
142
+ viem.pad(agencyId, { size: 32 })
143
+ ]);
144
+ return {
145
+ handlerTypeDenominator: viem.toHex(chunk665P7NO4_cjs.productTypes.retail),
146
+ interactionData
147
+ };
148
+ }
149
+ };
150
+
151
+ exports.PressInteractionEncoder = PressInteractionEncoder;
152
+ exports.PurchaseInteractionEncoder = PurchaseInteractionEncoder;
153
+ exports.ReferralInteractionEncoder = ReferralInteractionEncoder;
154
+ exports.RetailInteractionEncoder = RetailInteractionEncoder;
155
+ exports.WebShopInteractionEncoder = WebShopInteractionEncoder;
@@ -1,10 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
1
+ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  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,11 +72,4 @@ var interactionTypes = {
74
72
  }
75
73
  };
76
74
 
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
- exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.__publicField = __publicField; exports.productTypes = productTypes; exports.productTypesMask = productTypesMask; exports.interactionTypes = interactionTypes;
75
+ export { __commonJS, __toESM, interactionTypes, productTypes, productTypesMask };
@@ -1,10 +1,6 @@
1
- import {
2
- interactionTypes,
3
- productTypes
4
- } from "./chunk-GDH3M5ZC.js";
1
+ import { interactionTypes, productTypes } from './chunk-U2NTN5QZ.js';
2
+ import { concatHex, pad, toHex, encodeAbiParameters } from 'viem';
5
3
 
6
- // src/interactions/pressEncoder.ts
7
- import { concatHex, pad, toHex } from "viem";
8
4
  var PressInteractionEncoder = {
9
5
  /**
10
6
  * Encode an open article interaction
@@ -37,16 +33,13 @@ var PressInteractionEncoder = {
37
33
  };
38
34
  }
39
35
  };
40
-
41
- // src/interactions/referralEncoder.ts
42
- import { concatHex as concatHex2, pad as pad2, toHex as toHex2 } from "viem";
43
36
  var ReferralInteractionEncoder = {
44
37
  /**
45
38
  * Records the event of a user creating a referral link. Note that this interaction doesn't actually create the link itself; it only sends an event to track that a link was created.
46
39
  */
47
40
  createLink() {
48
41
  return {
49
- handlerTypeDenominator: toHex2(productTypes.referral),
42
+ handlerTypeDenominator: toHex(productTypes.referral),
50
43
  interactionData: interactionTypes.referral.createLink
51
44
  };
52
45
  },
@@ -56,19 +49,16 @@ var ReferralInteractionEncoder = {
56
49
  * @param args.referrer - The Ethereum address of the user who made the referral
57
50
  */
58
51
  referred({ referrer }) {
59
- const interactionData = concatHex2([
52
+ const interactionData = concatHex([
60
53
  interactionTypes.referral.referred,
61
- pad2(referrer, { size: 32 })
54
+ pad(referrer, { size: 32 })
62
55
  ]);
63
56
  return {
64
- handlerTypeDenominator: toHex2(productTypes.referral),
57
+ handlerTypeDenominator: toHex(productTypes.referral),
65
58
  interactionData
66
59
  };
67
60
  }
68
61
  };
69
-
70
- // src/interactions/purchaseEncoder.ts
71
- import { concatHex as concatHex3, encodeAbiParameters, pad as pad3, toHex as toHex3 } from "viem";
72
62
  var PurchaseInteractionEncoder = {
73
63
  /**
74
64
  * Encode a start purchase interaction
@@ -76,12 +66,12 @@ var PurchaseInteractionEncoder = {
76
66
  * @param args.purchaseId - The id of the purchase that is being started.
77
67
  */
78
68
  startPurchase({ purchaseId }) {
79
- const interactionData = concatHex3([
69
+ const interactionData = concatHex([
80
70
  interactionTypes.purchase.started,
81
- pad3(purchaseId, { size: 32 })
71
+ pad(purchaseId, { size: 32 })
82
72
  ]);
83
73
  return {
84
- handlerTypeDenominator: toHex3(productTypes.purchase),
74
+ handlerTypeDenominator: toHex(productTypes.purchase),
85
75
  interactionData
86
76
  };
87
77
  },
@@ -99,12 +89,12 @@ var PurchaseInteractionEncoder = {
99
89
  [{ type: "uint256" }, { type: "bytes32[]" }],
100
90
  [BigInt(purchaseId), proof]
101
91
  );
102
- const interactionData = concatHex3([
92
+ const interactionData = concatHex([
103
93
  interactionTypes.purchase.completed,
104
94
  innerData
105
95
  ]);
106
96
  return {
107
- handlerTypeDenominator: toHex3(productTypes.purchase),
97
+ handlerTypeDenominator: toHex(productTypes.purchase),
108
98
  interactionData
109
99
  };
110
100
  },
@@ -116,33 +106,27 @@ var PurchaseInteractionEncoder = {
116
106
  unsafeCompletedPurchase({
117
107
  purchaseId
118
108
  }) {
119
- const interactionData = concatHex3([
109
+ const interactionData = concatHex([
120
110
  interactionTypes.purchase.unsafeCompleted,
121
- pad3(purchaseId, { size: 32 })
111
+ pad(purchaseId, { size: 32 })
122
112
  ]);
123
113
  return {
124
- handlerTypeDenominator: toHex3(productTypes.purchase),
114
+ handlerTypeDenominator: toHex(productTypes.purchase),
125
115
  interactionData
126
116
  };
127
117
  }
128
118
  };
129
-
130
- // src/interactions/webshopEncoder.ts
131
- import { toHex as toHex4 } from "viem";
132
119
  var WebShopInteractionEncoder = {
133
120
  /**
134
121
  * Encode an open webshop interaction
135
122
  */
136
123
  open() {
137
124
  return {
138
- handlerTypeDenominator: toHex4(productTypes.webshop),
125
+ handlerTypeDenominator: toHex(productTypes.webshop),
139
126
  interactionData: interactionTypes.webshop.open
140
127
  };
141
128
  }
142
129
  };
143
-
144
- // src/interactions/retailEncoder.ts
145
- import { concatHex as concatHex4, pad as pad4, toHex as toHex5 } from "viem";
146
130
  var RetailInteractionEncoder = {
147
131
  /**
148
132
  * Encode a customer meeting retail interaction
@@ -151,21 +135,15 @@ var RetailInteractionEncoder = {
151
135
  *
152
136
  */
153
137
  customerMeeting({ agencyId }) {
154
- const interactionData = concatHex4([
138
+ const interactionData = concatHex([
155
139
  interactionTypes.retail.customerMeeting,
156
- pad4(agencyId, { size: 32 })
140
+ pad(agencyId, { size: 32 })
157
141
  ]);
158
142
  return {
159
- handlerTypeDenominator: toHex5(productTypes.retail),
143
+ handlerTypeDenominator: toHex(productTypes.retail),
160
144
  interactionData
161
145
  };
162
146
  }
163
147
  };
164
148
 
165
- export {
166
- PressInteractionEncoder,
167
- ReferralInteractionEncoder,
168
- PurchaseInteractionEncoder,
169
- WebShopInteractionEncoder,
170
- RetailInteractionEncoder
171
- };
149
+ export { PressInteractionEncoder, PurchaseInteractionEncoder, ReferralInteractionEncoder, RetailInteractionEncoder, WebShopInteractionEncoder };