@frak-labs/core-sdk 0.0.2 → 0.0.5

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,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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; }
1
+ 'use strict';
2
2
 
3
-
4
-
5
- var _chunkPR3T7O5Icjs = require('./chunk-PR3T7O5I.cjs');
3
+ var chunkPO6YSB4Q_cjs = require('./chunk-PO6YSB4Q.cjs');
4
+ var jsSha256 = require('js-sha256');
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 = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
8
+ var require_async_lz_string = chunkPO6YSB4Q_cjs.__commonJS({
9
9
  "../../node_modules/async-lz-string/libs/async-lz-string.js"(exports, module) {
10
- "use strict";
11
10
  !function(t, e) {
12
11
  if ("object" == typeof exports && "object" == typeof module) module.exports = e();
13
12
  else if ("function" == typeof define && define.amd) define([], e);
@@ -16,7 +15,6 @@ var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
16
15
  for (var r in n) ("object" == typeof exports ? exports : t)[r] = n[r];
17
16
  }
18
17
  }(exports, () => (() => {
19
- "use strict";
20
18
  var t = { 48: function(t2, e2, n) {
21
19
  var r = this && this.__awaiter || function(t3, e3, n2, r2) {
22
20
  return new (n2 || (n2 = Promise))(function(a2, o2) {
@@ -96,15 +94,15 @@ var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
96
94
  n2 = a2 = 0;
97
95
  }
98
96
  if (5 & s4[0]) throw s4[1];
99
- return { value: s4[0] ? s4[1] : void 0, done: true };
97
+ return { value: s4[0] ? s4[1] : undefined, done: true };
100
98
  }([s3, u2]);
101
99
  };
102
100
  }
103
101
  };
104
- Object.defineProperty(e2, "__esModule", { value: true }), e2.decompressFromUTF16 = e2.compressToUTF16 = e2.decompressFromBase64 = e2.compressToBase64 = void 0;
102
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.decompressFromUTF16 = e2.compressToUTF16 = e2.decompressFromBase64 = e2.compressToBase64 = undefined;
105
103
  var o = n(304), i = n(134), s = new o.CompressorImpl(), u = new i.DecompressorImpl(), c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", l = {};
106
104
  e2.compressToBase64 = function(t3) {
107
- return r(this, void 0, void 0, function() {
105
+ return r(this, undefined, undefined, function() {
108
106
  var e3;
109
107
  return a(this, function(n2) {
110
108
  switch (n2.label) {
@@ -129,7 +127,7 @@ var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
129
127
  });
130
128
  });
131
129
  }, e2.decompressFromBase64 = function(t3) {
132
- return r(this, void 0, void 0, function() {
130
+ return r(this, undefined, undefined, function() {
133
131
  return a(this, function(e3) {
134
132
  switch (e3.label) {
135
133
  case 0:
@@ -148,7 +146,7 @@ var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
148
146
  });
149
147
  });
150
148
  }, e2.compressToUTF16 = function(t3) {
151
- return r(this, void 0, void 0, function() {
149
+ return r(this, undefined, undefined, function() {
152
150
  return a(this, function(e3) {
153
151
  switch (e3.label) {
154
152
  case 0:
@@ -161,7 +159,7 @@ var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
161
159
  });
162
160
  });
163
161
  }, e2.decompressFromUTF16 = function(t3) {
164
- return r(this, void 0, void 0, function() {
162
+ return r(this, undefined, undefined, function() {
165
163
  return a(this, function(e3) {
166
164
  switch (e3.label) {
167
165
  case 0:
@@ -253,12 +251,12 @@ var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
253
251
  n2 = a2 = 0;
254
252
  }
255
253
  if (5 & s4[0]) throw s4[1];
256
- return { value: s4[0] ? s4[1] : void 0, done: true };
254
+ return { value: s4[0] ? s4[1] : undefined, done: true };
257
255
  }([s3, u]);
258
256
  };
259
257
  }
260
258
  };
261
- Object.defineProperty(e2, "__esModule", { value: true }), e2.CompressorImpl = void 0;
259
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.CompressorImpl = undefined;
262
260
  var o = n(658), i = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], s = function() {
263
261
  function t3() {
264
262
  }
@@ -278,7 +276,7 @@ var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
278
276
  }, t3.prototype.compress = function(e3, n2, i2) {
279
277
  var s2 = this;
280
278
  return new Promise(function(u) {
281
- return r(s2, void 0, void 0, function() {
279
+ return r(s2, undefined, undefined, function() {
282
280
  var r2, s3;
283
281
  return a(this, function(a2) {
284
282
  switch (a2.label) {
@@ -379,19 +377,19 @@ var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
379
377
  n2 = a2 = 0;
380
378
  }
381
379
  if (5 & s3[0]) throw s3[1];
382
- return { value: s3[0] ? s3[1] : void 0, done: true };
380
+ return { value: s3[0] ? s3[1] : undefined, done: true };
383
381
  }([s2, u]);
384
382
  };
385
383
  }
386
384
  };
387
- Object.defineProperty(e2, "__esModule", { value: true }), e2.DecompressorImpl = void 0;
385
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.DecompressorImpl = undefined;
388
386
  var o = n(658), i = function() {
389
387
  function t3() {
390
388
  }
391
389
  return t3.prototype.decompress = function(t4, e3, n2) {
392
390
  var i2 = this;
393
391
  return new Promise(function(s) {
394
- return r(i2, void 0, void 0, function() {
392
+ return r(i2, undefined, undefined, function() {
395
393
  var r2, i3, u;
396
394
  return a(this, function(a2) {
397
395
  switch (a2.label) {
@@ -524,13 +522,13 @@ var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
524
522
  n2 = a = 0;
525
523
  }
526
524
  if (5 & s3[0]) throw s3[1];
527
- return { value: s3[0] ? s3[1] : void 0, done: true };
525
+ return { value: s3[0] ? s3[1] : undefined, done: true };
528
526
  }([s2, u]);
529
527
  };
530
528
  }
531
529
  };
532
- Object.defineProperty(e2, "__esModule", { value: true }), e2.wait = void 0, e2.wait = function() {
533
- return n(this, void 0, void 0, function() {
530
+ Object.defineProperty(e2, "__esModule", { value: true }), e2.wait = undefined, e2.wait = function() {
531
+ return n(this, undefined, undefined, function() {
534
532
  return r(this, function(t3) {
535
533
  return [2, new Promise(function(t4) {
536
534
  setTimeout(t4, 0);
@@ -541,7 +539,7 @@ var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
541
539
  } }, e = {};
542
540
  return function n(r) {
543
541
  var a = e[r];
544
- if (void 0 !== a) return a.exports;
542
+ if (undefined !== a) return a.exports;
545
543
  var o = e[r] = { exports: {} };
546
544
  return t[r].call(o.exports, o, o.exports, n), o.exports;
547
545
  }(48);
@@ -587,14 +585,16 @@ var RpcErrorCodes = {
587
585
  // src/utils/Deferred.ts
588
586
  var Deferred = class {
589
587
  constructor() {
590
- _chunkPR3T7O5Icjs.__publicField.call(void 0, this, "_promise");
591
- _chunkPR3T7O5Icjs.__publicField.call(void 0, this, "_resolve");
592
- _chunkPR3T7O5Icjs.__publicField.call(void 0, this, "_reject");
593
- _chunkPR3T7O5Icjs.__publicField.call(void 0, this, "resolve", (value) => {
594
- _optionalChain([this, 'access', _2 => _2._resolve, 'optionalCall', _3 => _3(value)]);
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);
595
594
  });
596
- _chunkPR3T7O5Icjs.__publicField.call(void 0, this, "reject", (reason) => {
597
- _optionalChain([this, 'access', _4 => _4._reject, 'optionalCall', _5 => _5(reason)]);
595
+ chunkPO6YSB4Q_cjs.__publicField(this, "reject", (reason) => {
596
+ var _a;
597
+ (_a = this._reject) == null ? undefined : _a.call(this, reason);
598
598
  });
599
599
  this._promise = new Promise((resolve, reject) => {
600
600
  this._resolve = resolve;
@@ -607,16 +607,15 @@ var Deferred = class {
607
607
  };
608
608
 
609
609
  // src/utils/compression/compress.ts
610
- var import_async_lz_string = _chunkPR3T7O5Icjs.__toESM.call(void 0, require_async_lz_string(), 1);
611
- var _jssha256 = require('js-sha256');
610
+ var import_async_lz_string = chunkPO6YSB4Q_cjs.__toESM(require_async_lz_string(), 1);
612
611
  async function hashAndCompressData(data) {
613
- const validationHash = _jssha256.sha256.call(void 0, JSON.stringify(data));
612
+ const validationHash = jsSha256.sha256(JSON.stringify(data));
614
613
  const hashProtectedData = {
615
614
  ...data,
616
615
  validationHash
617
616
  };
618
617
  const compressed = await compressJson(hashProtectedData);
619
- const compressedHash = _jssha256.sha256.call(void 0, compressed);
618
+ const compressedHash = jsSha256.sha256(compressed);
620
619
  return {
621
620
  compressed,
622
621
  compressedHash
@@ -627,10 +626,9 @@ async function compressJson(data) {
627
626
  }
628
627
 
629
628
  // src/utils/compression/decompress.ts
630
- var import_async_lz_string2 = _chunkPR3T7O5Icjs.__toESM.call(void 0, require_async_lz_string(), 1);
631
-
629
+ var import_async_lz_string2 = chunkPO6YSB4Q_cjs.__toESM(require_async_lz_string(), 1);
632
630
  async function decompressDataAndCheckHash(compressedData) {
633
- if (!(_optionalChain([compressedData, 'optionalAccess', _6 => _6.compressed]) && _optionalChain([compressedData, 'optionalAccess', _7 => _7.compressedHash]))) {
631
+ if (!((compressedData == null ? undefined : compressedData.compressed) && (compressedData == null ? undefined : compressedData.compressedHash))) {
634
632
  throw new FrakRpcError(
635
633
  RpcErrorCodes.corruptedResponse,
636
634
  "Missing compressed data"
@@ -645,13 +643,13 @@ async function decompressDataAndCheckHash(compressedData) {
645
643
  "Invalid compressed data"
646
644
  );
647
645
  }
648
- if (!_optionalChain([parsedData, 'optionalAccess', _8 => _8.validationHash])) {
646
+ if (!(parsedData == null ? undefined : parsedData.validationHash)) {
649
647
  throw new FrakRpcError(
650
648
  RpcErrorCodes.corruptedResponse,
651
649
  "Missing validation hash"
652
650
  );
653
651
  }
654
- const expectedCompressedHash = _jssha256.sha256.call(void 0, compressedData.compressed);
652
+ const expectedCompressedHash = jsSha256.sha256(compressedData.compressed);
655
653
  if (expectedCompressedHash !== compressedData.compressedHash) {
656
654
  throw new FrakRpcError(
657
655
  RpcErrorCodes.corruptedResponse,
@@ -659,7 +657,7 @@ async function decompressDataAndCheckHash(compressedData) {
659
657
  );
660
658
  }
661
659
  const { validationHash: _, ...rawResultData } = parsedData;
662
- const expectedValidationHash = _jssha256.sha256.call(void 0, JSON.stringify(rawResultData));
660
+ const expectedValidationHash = jsSha256.sha256(JSON.stringify(rawResultData));
663
661
  if (expectedValidationHash !== parsedData.validationHash) {
664
662
  throw new FrakRpcError(
665
663
  RpcErrorCodes.corruptedResponse,
@@ -709,8 +707,9 @@ function createIframe({
709
707
  changeIframeVisibility({ iframe, isVisible: false });
710
708
  document.body.appendChild(iframe);
711
709
  return new Promise((resolve) => {
712
- _optionalChain([iframe, 'optionalAccess', _9 => _9.addEventListener, 'call', _10 => _10("load", () => resolve(iframe))]);
713
- iframe.src = `${_nullishCoalesce(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _11 => _11.walletUrl]), () => ( walletBaseUrl)), () => ( "https://wallet.frak.id"))}/listener`;
710
+ var _a, _b;
711
+ iframe == null ? undefined : iframe.addEventListener("load", () => resolve(iframe));
712
+ iframe.src = `${(_b = (_a = config == null ? undefined : config.walletUrl) != null ? _a : walletBaseUrl) != null ? _b : "https://wallet.frak.id"}/listener`;
714
713
  });
715
714
  }
716
715
  function changeIframeVisibility({
@@ -733,9 +732,6 @@ function changeIframeVisibility({
733
732
  iframe.style.height = "100%";
734
733
  iframe.style.pointerEvents = "auto";
735
734
  }
736
-
737
- // src/utils/FrakContext.ts
738
- var _viem = require('viem');
739
735
  var contextKey = "fCtx";
740
736
  function base64url_encode(buffer) {
741
737
  return btoa(Array.from(buffer, (b) => String.fromCharCode(b)).join("")).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
@@ -750,24 +746,24 @@ function base64url_decode(value) {
750
746
  );
751
747
  }
752
748
  function compress(context) {
753
- if (!_optionalChain([context, 'optionalAccess', _12 => _12.r])) return;
749
+ if (!(context == null ? undefined : context.r)) return;
754
750
  try {
755
- const bytes = _viem.hexToBytes.call(void 0, context.r);
751
+ const bytes = viem.hexToBytes(context.r);
756
752
  return base64url_encode(bytes);
757
753
  } catch (e) {
758
754
  console.error("Error compressing Frak context", { e, context });
759
755
  }
760
- return void 0;
756
+ return undefined;
761
757
  }
762
758
  function decompress(context) {
763
759
  if (!context || context.length === 0) return;
764
760
  try {
765
761
  const bytes = base64url_decode(context);
766
- return { r: _viem.bytesToHex.call(void 0, bytes, { size: 20 }) };
762
+ return { r: viem.bytesToHex(bytes, { size: 20 }) };
767
763
  } catch (e) {
768
764
  console.error("Error decompressing Frak context", { e, context });
769
765
  }
770
- return void 0;
766
+ return undefined;
771
767
  }
772
768
  function parse({ url }) {
773
769
  if (!url) return null;
@@ -799,11 +795,12 @@ function replaceUrl({
799
795
  url: baseUrl,
800
796
  context
801
797
  }) {
802
- if (!_optionalChain([window, 'access', _13 => _13.location, 'optionalAccess', _14 => _14.href]) || typeof window === "undefined") {
798
+ var _a;
799
+ if (!((_a = window.location) == null ? undefined : _a.href) || typeof window === "undefined") {
803
800
  console.error("No window found, can't update context");
804
801
  return;
805
802
  }
806
- const url = _nullishCoalesce(baseUrl, () => ( window.location.href));
803
+ const url = baseUrl != null ? baseUrl : window.location.href;
807
804
  let newUrl;
808
805
  if (context !== null) {
809
806
  newUrl = update({
@@ -825,18 +822,16 @@ var FrakContextManager = {
825
822
  replaceUrl
826
823
  };
827
824
 
828
-
829
-
830
-
831
-
832
-
833
-
834
-
835
-
836
-
837
-
838
-
839
-
840
-
841
-
842
- 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;
825
+ exports.ClientNotFound = ClientNotFound;
826
+ exports.Deferred = Deferred;
827
+ exports.FrakContextManager = FrakContextManager;
828
+ exports.FrakRpcError = FrakRpcError;
829
+ exports.InternalError = InternalError;
830
+ exports.RpcErrorCodes = RpcErrorCodes;
831
+ exports.baseIframeProps = baseIframeProps;
832
+ exports.changeIframeVisibility = changeIframeVisibility;
833
+ exports.compressJson = compressJson;
834
+ exports.createIframe = createIframe;
835
+ exports.decompressDataAndCheckHash = decompressDataAndCheckHash;
836
+ exports.decompressJson = decompressJson;
837
+ exports.hashAndCompressData = hashAndCompressData;
@@ -1,4 +1,6 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
1
+ 'use strict';
2
+
3
+ var __create = Object.create;
2
4
  var __defProp = Object.defineProperty;
3
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -32,6 +34,7 @@ var productTypes = {
32
34
  dapp: 1,
33
35
  press: 2,
34
36
  webshop: 3,
37
+ retail: 4,
35
38
  // feature type
36
39
  referral: 30,
37
40
  purchase: 31
@@ -65,15 +68,17 @@ var interactionTypes = {
65
68
  },
66
69
  purchase: {
67
70
  started: "0xd87e90c3",
68
- completed: "0x8403aeb4"
71
+ completed: "0x8403aeb4",
72
+ unsafeCompleted: "0x4d5b14e0"
73
+ },
74
+ retail: {
75
+ customerMeeting: "0x74489004"
69
76
  }
70
77
  };
71
78
 
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;
79
+ exports.__commonJS = __commonJS;
80
+ exports.__publicField = __publicField;
81
+ exports.__toESM = __toESM;
82
+ exports.interactionTypes = interactionTypes;
83
+ exports.productTypes = productTypes;
84
+ exports.productTypesMask = productTypesMask;
@@ -1,10 +1,6 @@
1
- import {
2
- interactionTypes,
3
- productTypes
4
- } from "./chunk-QZL2KCSB.js";
1
+ import { interactionTypes, productTypes } from './chunk-GDH3M5ZC.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,21 +33,14 @@ 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
- const interactionData = concatHex2([
49
- interactionTypes.referral.createLink,
50
- "0x"
51
- ]);
52
41
  return {
53
- handlerTypeDenominator: toHex2(productTypes.referral),
54
- interactionData
42
+ handlerTypeDenominator: toHex(productTypes.referral),
43
+ interactionData: interactionTypes.referral.createLink
55
44
  };
56
45
  },
57
46
  /**
@@ -60,19 +49,16 @@ var ReferralInteractionEncoder = {
60
49
  * @param args.referrer - The Ethereum address of the user who made the referral
61
50
  */
62
51
  referred({ referrer }) {
63
- const interactionData = concatHex2([
52
+ const interactionData = concatHex([
64
53
  interactionTypes.referral.referred,
65
- pad2(referrer, { size: 32 })
54
+ pad(referrer, { size: 32 })
66
55
  ]);
67
56
  return {
68
- handlerTypeDenominator: toHex2(productTypes.referral),
57
+ handlerTypeDenominator: toHex(productTypes.referral),
69
58
  interactionData
70
59
  };
71
60
  }
72
61
  };
73
-
74
- // src/interactions/purchaseEncoder.ts
75
- import { concatHex as concatHex3, encodeAbiParameters, pad as pad3, toHex as toHex3 } from "viem";
76
62
  var PurchaseInteractionEncoder = {
77
63
  /**
78
64
  * Encode a start purchase interaction
@@ -80,12 +66,12 @@ var PurchaseInteractionEncoder = {
80
66
  * @param args.purchaseId - The id of the purchase that is being started.
81
67
  */
82
68
  startPurchase({ purchaseId }) {
83
- const interactionData = concatHex3([
69
+ const interactionData = concatHex([
84
70
  interactionTypes.purchase.started,
85
- pad3(purchaseId, { size: 32 })
71
+ pad(purchaseId, { size: 32 })
86
72
  ]);
87
73
  return {
88
- handlerTypeDenominator: toHex3(productTypes.purchase),
74
+ handlerTypeDenominator: toHex(productTypes.purchase),
89
75
  interactionData
90
76
  };
91
77
  },
@@ -103,38 +89,61 @@ var PurchaseInteractionEncoder = {
103
89
  [{ type: "uint256" }, { type: "bytes32[]" }],
104
90
  [BigInt(purchaseId), proof]
105
91
  );
106
- const interactionData = concatHex3([
92
+ const interactionData = concatHex([
107
93
  interactionTypes.purchase.completed,
108
94
  innerData
109
95
  ]);
110
96
  return {
111
- handlerTypeDenominator: toHex3(productTypes.purchase),
97
+ handlerTypeDenominator: toHex(productTypes.purchase),
98
+ interactionData
99
+ };
100
+ },
101
+ /**
102
+ * Encode an unsafe complete purchase interaction (when we can't provide the proof)
103
+ * @param args
104
+ * @param args.purchaseId - The id of the purchase that is being completed.
105
+ */
106
+ unsafeCompletedPurchase({
107
+ purchaseId
108
+ }) {
109
+ const interactionData = concatHex([
110
+ interactionTypes.purchase.unsafeCompleted,
111
+ pad(purchaseId, { size: 32 })
112
+ ]);
113
+ return {
114
+ handlerTypeDenominator: toHex(productTypes.purchase),
112
115
  interactionData
113
116
  };
114
117
  }
115
118
  };
116
-
117
- // src/interactions/webshopEncoder.ts
118
- import { concatHex as concatHex4, toHex as toHex4 } from "viem";
119
119
  var WebShopInteractionEncoder = {
120
120
  /**
121
121
  * Encode an open webshop interaction
122
122
  */
123
123
  open() {
124
- const interactionData = concatHex4([
125
- interactionTypes.webshop.open,
126
- "0x"
124
+ return {
125
+ handlerTypeDenominator: toHex(productTypes.webshop),
126
+ interactionData: interactionTypes.webshop.open
127
+ };
128
+ }
129
+ };
130
+ var RetailInteractionEncoder = {
131
+ /**
132
+ * Encode a customer meeting retail interaction
133
+ * @param args
134
+ * @param args.agencyId - The id of the agency that the customer is meeting with
135
+ *
136
+ */
137
+ customerMeeting({ agencyId }) {
138
+ const interactionData = concatHex([
139
+ interactionTypes.retail.customerMeeting,
140
+ pad(agencyId, { size: 32 })
127
141
  ]);
128
142
  return {
129
- handlerTypeDenominator: toHex4(productTypes.webshop),
143
+ handlerTypeDenominator: toHex(productTypes.retail),
130
144
  interactionData
131
145
  };
132
146
  }
133
147
  };
134
148
 
135
- export {
136
- PressInteractionEncoder,
137
- ReferralInteractionEncoder,
138
- PurchaseInteractionEncoder,
139
- WebShopInteractionEncoder
140
- };
149
+ export { PressInteractionEncoder, PurchaseInteractionEncoder, ReferralInteractionEncoder, RetailInteractionEncoder, WebShopInteractionEncoder };