@frak-labs/core-sdk 0.0.19-beta.f259d7fc → 0.1.0-beta.263acd1e

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.
Files changed (139) hide show
  1. package/cdn/bundle.iife.js +14 -0
  2. package/dist/actions-CEEObPYc.js +1 -0
  3. package/dist/actions-DbQhWYx8.cjs +1 -0
  4. package/dist/actions.cjs +1 -1
  5. package/dist/actions.d.cts +3 -1400
  6. package/dist/actions.d.ts +3 -1400
  7. package/dist/actions.js +1 -1
  8. package/dist/bundle.cjs +1 -13
  9. package/dist/bundle.d.cts +6 -1927
  10. package/dist/bundle.d.ts +6 -1927
  11. package/dist/bundle.js +1 -13
  12. package/dist/index-7OZ39x1U.d.ts +195 -0
  13. package/dist/index-C6FxkWPC.d.cts +511 -0
  14. package/dist/index-UFX7xCg3.d.ts +351 -0
  15. package/dist/index-d8xS4ryI.d.ts +511 -0
  16. package/dist/index-p4FqSp8z.d.cts +351 -0
  17. package/dist/index-zDq-VlKx.d.cts +195 -0
  18. package/dist/index.cjs +1 -13
  19. package/dist/index.d.cts +4 -1269
  20. package/dist/index.d.ts +4 -1269
  21. package/dist/index.js +1 -13
  22. package/dist/interaction-DMJ3ZfaF.d.cts +45 -0
  23. package/dist/interaction-KX1h9a7V.d.ts +45 -0
  24. package/dist/interactions-DnfM3oe0.js +1 -0
  25. package/dist/interactions-EIXhNLf6.cjs +1 -0
  26. package/dist/interactions.cjs +1 -1
  27. package/dist/interactions.d.cts +2 -182
  28. package/dist/interactions.d.ts +2 -182
  29. package/dist/interactions.js +1 -1
  30. package/dist/openSso-D--Airj6.d.cts +1018 -0
  31. package/dist/openSso-DsKJ4y0j.d.ts +1018 -0
  32. package/dist/productTypes-BUkXJKZ7.cjs +1 -0
  33. package/dist/productTypes-CGb1MmBF.js +1 -0
  34. package/dist/src-B_xO0AR6.cjs +13 -0
  35. package/dist/src-D2d52OZa.js +13 -0
  36. package/dist/trackEvent-CHnYa85W.js +1 -0
  37. package/dist/trackEvent-GuQm_1Nm.cjs +1 -0
  38. package/package.json +24 -19
  39. package/src/actions/displayEmbeddedWallet.test.ts +194 -0
  40. package/src/actions/displayEmbeddedWallet.ts +20 -0
  41. package/src/actions/displayModal.test.ts +387 -0
  42. package/src/actions/displayModal.ts +131 -0
  43. package/src/actions/getProductInformation.test.ts +133 -0
  44. package/src/actions/getProductInformation.ts +14 -0
  45. package/src/actions/index.ts +29 -0
  46. package/src/actions/openSso.test.ts +407 -0
  47. package/src/actions/openSso.ts +116 -0
  48. package/src/actions/prepareSso.test.ts +223 -0
  49. package/src/actions/prepareSso.ts +48 -0
  50. package/src/actions/referral/processReferral.ts +230 -0
  51. package/src/actions/referral/referralInteraction.ts +57 -0
  52. package/src/actions/sendInteraction.test.ts +219 -0
  53. package/src/actions/sendInteraction.ts +32 -0
  54. package/src/actions/trackPurchaseStatus.test.ts +287 -0
  55. package/src/actions/trackPurchaseStatus.ts +53 -0
  56. package/src/actions/watchWalletStatus.test.ts +372 -0
  57. package/src/actions/watchWalletStatus.ts +94 -0
  58. package/src/actions/wrapper/modalBuilder.ts +212 -0
  59. package/src/actions/wrapper/sendTransaction.ts +62 -0
  60. package/src/actions/wrapper/siweAuthenticate.ts +94 -0
  61. package/src/bundle.ts +3 -0
  62. package/src/clients/DebugInfo.ts +182 -0
  63. package/src/clients/createIFrameFrakClient.ts +287 -0
  64. package/src/clients/index.ts +3 -0
  65. package/src/clients/setupClient.test.ts +343 -0
  66. package/src/clients/setupClient.ts +73 -0
  67. package/src/clients/transports/iframeLifecycleManager.test.ts +399 -0
  68. package/src/clients/transports/iframeLifecycleManager.ts +90 -0
  69. package/src/constants/interactionTypes.ts +44 -0
  70. package/src/constants/locales.ts +14 -0
  71. package/src/constants/productTypes.ts +33 -0
  72. package/src/index.ts +101 -0
  73. package/src/interactions/index.ts +5 -0
  74. package/src/interactions/pressEncoder.test.ts +215 -0
  75. package/src/interactions/pressEncoder.ts +53 -0
  76. package/src/interactions/purchaseEncoder.test.ts +291 -0
  77. package/src/interactions/purchaseEncoder.ts +99 -0
  78. package/src/interactions/referralEncoder.test.ts +170 -0
  79. package/src/interactions/referralEncoder.ts +47 -0
  80. package/src/interactions/retailEncoder.test.ts +107 -0
  81. package/src/interactions/retailEncoder.ts +37 -0
  82. package/src/interactions/webshopEncoder.test.ts +56 -0
  83. package/src/interactions/webshopEncoder.ts +30 -0
  84. package/src/types/client.ts +14 -0
  85. package/src/types/compression.ts +22 -0
  86. package/src/types/config.ts +111 -0
  87. package/src/types/context.ts +13 -0
  88. package/src/types/index.ts +71 -0
  89. package/src/types/lifecycle/client.ts +46 -0
  90. package/src/types/lifecycle/iframe.ts +35 -0
  91. package/src/types/lifecycle/index.ts +2 -0
  92. package/src/types/rpc/displayModal.ts +84 -0
  93. package/src/types/rpc/embedded/index.ts +68 -0
  94. package/src/types/rpc/embedded/loggedIn.ts +55 -0
  95. package/src/types/rpc/embedded/loggedOut.ts +28 -0
  96. package/src/types/rpc/interaction.ts +43 -0
  97. package/src/types/rpc/modal/final.ts +46 -0
  98. package/src/types/rpc/modal/generic.ts +46 -0
  99. package/src/types/rpc/modal/index.ts +20 -0
  100. package/src/types/rpc/modal/login.ts +32 -0
  101. package/src/types/rpc/modal/openSession.ts +25 -0
  102. package/src/types/rpc/modal/siweAuthenticate.ts +37 -0
  103. package/src/types/rpc/modal/transaction.ts +33 -0
  104. package/src/types/rpc/productInformation.ts +59 -0
  105. package/src/types/rpc/sso.ts +80 -0
  106. package/src/types/rpc/walletStatus.ts +35 -0
  107. package/src/types/rpc.ts +158 -0
  108. package/src/types/transport.ts +34 -0
  109. package/src/utils/FrakContext.test.ts +407 -0
  110. package/src/utils/FrakContext.ts +158 -0
  111. package/src/utils/compression/b64.test.ts +181 -0
  112. package/src/utils/compression/b64.ts +29 -0
  113. package/src/utils/compression/compress.test.ts +123 -0
  114. package/src/utils/compression/compress.ts +11 -0
  115. package/src/utils/compression/decompress.test.ts +145 -0
  116. package/src/utils/compression/decompress.ts +11 -0
  117. package/src/utils/compression/index.ts +3 -0
  118. package/src/utils/computeProductId.test.ts +80 -0
  119. package/src/utils/computeProductId.ts +11 -0
  120. package/src/utils/constants.test.ts +23 -0
  121. package/src/utils/constants.ts +4 -0
  122. package/src/utils/formatAmount.test.ts +113 -0
  123. package/src/utils/formatAmount.ts +18 -0
  124. package/src/utils/getCurrencyAmountKey.test.ts +44 -0
  125. package/src/utils/getCurrencyAmountKey.ts +15 -0
  126. package/src/utils/getSupportedCurrency.test.ts +51 -0
  127. package/src/utils/getSupportedCurrency.ts +14 -0
  128. package/src/utils/getSupportedLocale.test.ts +64 -0
  129. package/src/utils/getSupportedLocale.ts +16 -0
  130. package/src/utils/iframeHelper.test.ts +450 -0
  131. package/src/utils/iframeHelper.ts +143 -0
  132. package/src/utils/index.ts +21 -0
  133. package/src/utils/sso.test.ts +361 -0
  134. package/src/utils/sso.ts +119 -0
  135. package/src/utils/ssoUrlListener.ts +60 -0
  136. package/src/utils/trackEvent.test.ts +162 -0
  137. package/src/utils/trackEvent.ts +26 -0
  138. package/cdn/bundle.js +0 -19
  139. package/cdn/bundle.js.LICENSE.txt +0 -10
package/dist/index.js CHANGED
@@ -1,13 +1 @@
1
- import{Deferred as e,FrakRpcError as t,RpcErrorCodes as n,compressJson as r,createRpcClient as o,decompressJson as a}from"@frak-labs/frame-connector";import{createClientCompressionMiddleware as i}from"@frak-labs/frame-connector/middleware";import{OpenPanel as s}from"@openpanel/web";import{bytesToHex as c,hexToBytes as l}from"viem";let d="nexus-wallet-backup";class u{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(e,t){this.config=e,this.iframe=t,this.lastRequest=null,this.lastResponse=null}setLastResponse(e,t){this.lastResponse={message:e,response:t,timestamp:Date.now()}}setLastRequest(e){this.lastRequest={event:e,timestamp:Date.now()}}updateSetupStatus(e){this.isSetupDone=e}base64Encode(e){try{return btoa(JSON.stringify(e))}catch(e){return console.warn("Failed to encode debug data",e),btoa("Failed to encode data")}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute("loading"),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?+("complete"===this.iframe.contentDocument.readyState):-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(e){let n=this.getIframeStatus(),r=this.getNavigatorInfo(),o="Unknown";return e instanceof t?o=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?o=e.message:"string"==typeof e&&(o=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:r?this.base64Encode(r):"no-navigator",iframeStatus:n?this.base64Encode(n):"not-iframe",lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):"No Frak request logged",lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):"No Frak response logged",clientStatus:this.isSetupDone?"setup":"not-setup",error:o}}static empty(){return new u}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
2
- Debug Information:
3
- -----------------
4
- Timestamp: ${t.timestamp}
5
- URL: ${t.encodedUrl}
6
- Config: ${t.encodedConfig}
7
- Navigator Info: ${t.navigatorInfo}
8
- IFrame Status: ${t.iframeStatus}
9
- Last Request: ${t.lastRequest}
10
- Last Response: ${t.lastResponse}
11
- Client Status: ${t.clientStatus}
12
- Error: ${t.error}
13
- `.trim()}}let f={id:"frak-wallet",name:"frak-wallet",title:"Frak Wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:2000001,top:"-1000px",left:"-1000px",colorScheme:"auto"}};function p({walletBaseUrl:e,config:t}){let n=document.querySelector("#frak-wallet");n&&n.remove();let r=document.createElement("iframe");return r.id=f.id,r.name=f.name,r.allow=f.allow,r.style.zIndex=f.style.zIndex.toString(),m({iframe:r,isVisible:!1}),document.body.appendChild(r),new Promise(n=>{r?.addEventListener("load",()=>n(r)),r.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function m({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}function g({config:r,iframe:a}){let c,l=r?.walletUrl??"https://wallet.frak.id",f=function({iframe:t}){let n=new e;return{handleEvent:async e=>{if(!("iframeLifecycle"in e))return;let{iframeLifecycle:r,data:o}=e;switch(r){case"connected":n.resolve(!0);break;case"do-backup":o.backup?localStorage.setItem(d,o.backup):localStorage.removeItem(d);break;case"remove-backup":localStorage.removeItem(d);break;case"show":case"hide":m({iframe:t,isVisible:"show"===r});break;case"handshake":t.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:o.token,currentUrl:window.location.href}},"*");break;case"redirect":{let e=new URL(o.baseRedirectUrl);e.searchParams.has("u")?(e.searchParams.delete("u"),e.searchParams.append("u",window.location.href),window.location.href=e.toString()):window.location.href=o.baseRedirectUrl}}},isConnected:n.promise}}({iframe:a}),p=new u(r,a);if(!a.contentWindow)throw new t(n.configError,"The iframe does not have a content window");let g=o({emittingTransport:a.contentWindow,listeningTransport:window,targetOrigin:l,middleware:[{async onRequest(e,r){if(!await f.isConnected)throw new t(n.clientNotConnected,"The iframe provider isn't connected yet");return r}},i(),{onRequest:(e,t)=>(p.setLastRequest(e),t),onResponse:(e,t)=>(p.setLastResponse(e,t),t)}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await f.handleEvent(e)}}}),w=function(e,t){let n,r,o=()=>e.sendLifecycle({clientLifecycle:"heartbeat"});function a(){n&&clearInterval(n),r&&clearTimeout(r)}return async function(){o(),n=setInterval(o,1e3),r=setTimeout(()=>{a(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,a()}(),a}(g,f),y=async()=>{w(),g.cleanup(),a.remove()};console.log("[Frak SDK] Initializing OpenPanel"),(c=new s({apiUrl:"https://op-api.gcp.frak.id",clientId:"6eacc8d7-49ac-4936-95e9-81ef29449570",trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>!("track"===e&&t?.properties)||("sdkVersion"in t.properties||(t.properties={...t.properties,sdkVersion:"0.0.19"}),!0)})).setGlobalProperties({sdkVersion:"0.0.19"}),c.init();let b=h({config:r,rpcClient:g,lifecycleManager:f}).then(()=>p.updateSetupStatus(!0));return{config:r,debugInfo:p,waitForConnection:f.isConnected,waitForSetup:b,request:g.request,listenerRequest:g.listen,destroy:y,openPanel:c}}async function h({config:e,rpcClient:t,lifecycleManager:n}){async function r(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:"modal-css",data:{cssLink:n}})}async function o(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:"modal-i18n",data:{i18n:n}})}async function a(){if("undefined"==typeof window)return;let e=window.localStorage.getItem(d);e&&t.sendLifecycle({clientLifecycle:"restore-backup",data:{backup:e}})}await n.isConnected,function(e,t){if("undefined"==typeof window)return;let n=new URL(window.location.href),r=n.searchParams.get("sso");r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:"sso-redirect-complete",data:{compressed:r}}),console.log("[SSO URL Listener] Forwarded compressed SSO data to iframe")}).catch(e=>{console.error("[SSO URL Listener] Failed to forward SSO data:",e)}),n.searchParams.delete("sso"),window.history.replaceState({},"",n.toString()),console.log("[SSO URL Listener] SSO parameter detected and URL cleaned"))}(t,n.isConnected),await Promise.allSettled([r(),o(),a()])}let w={eur:"fr-FR",usd:"en-US",gbp:"en-GB"};function y(e){return e&&e in w?e:"eur"}async function b({config:e}){let t=function(e){let t=y(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}(e),n=await p({config:t});if(!n)return void console.error("Failed to create iframe");let r=g({config:t,iframe:n});return(await r.waitForSetup,await r.waitForConnection)?r:void console.error("Failed to connect to client")}function S(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function k(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(0===t?0:4-t),"=")),e=>e.charCodeAt(0))}function L(e){return S(r(e))}function R(e){return a(k(e))}let v="fCtx";function x(e){if(e?.r)try{let t=l(e.r);return S(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function I(e){if(e&&0!==e.length)try{let t=k(e);return{r:c(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function F({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(v);return t?I(t):null}function C({url:e,context:t}){if(!e)return null;let n=F({url:e}),r=n?{...n,...t}:t;if(!r.r)return null;let o=x(r);if(!o)return null;let a=new URL(e);return a.searchParams.set(v,o),a.toString()}function U(e){let t=new URL(e);return t.searchParams.delete(v),t.toString()}let E={compress:x,decompress:I,parse:F,update:C,remove:U,replaceUrl:function({url:e,context:t}){let n;if(!window.location?.href||"undefined"==typeof window)return void console.error("No window found, can't update context");let r=e??window.location.href;(n=null!==t?C({url:r,context:t}):U(r))&&window.history.replaceState(null,"",n.toString())}};function q(e){return e?w[e]??w.eur:w.eur}function D(e){return e?`${e}Amount`:"eurAmount"}function P(e,t){let n=q(t),r=y(t);return e.toLocaleString(n,{style:"currency",currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function $(e,t,n={}){if(!e)return void console.debug("[Frak] No client provided, skipping event tracking");try{e.openPanel?.track(t,n)}catch(e){console.debug("[Frak] Failed to track event:",t,e)}}let A={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},O=Object.entries(A).reduce((e,[t,n])=>(e[t]=BigInt(1)<<BigInt(n),e),{}),T={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4",unsafeCompleted:"0x4d5b14e0"},retail:{customerMeeting:"0x74489004"}};export{u as DebugInfoGatherer,E as FrakContextManager,k as base64urlDecode,S as base64urlEncode,f as baseIframeProps,L as compressJsonToB64,g as createIFrameFrakClient,p as createIframe,R as decompressJsonFromB64,P as formatAmount,D as getCurrencyAmountKey,y as getSupportedCurrency,q as getSupportedLocale,T as interactionTypes,w as locales,A as productTypes,O as productTypesMask,b as setupClient,$ as trackEvent};
1
+ import{a as e,c as t,i as n,l as r,n as i,o as a,s as o,t as s}from"./trackEvent-CHnYa85W.js";import{a as c,c as l,d as u,f as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y}from"./src-D2d52OZa.js";import{n as b,r as x,t as S}from"./productTypes-CGb1MmBF.js";export{d as DebugInfoGatherer,i as FrakContextManager,t as base64urlDecode,r as base64urlEncode,p as baseIframeProps,o as compressJsonToB64,l as createIFrameFrakClient,y as createIframe,_ as decompressJsonFromB64,u as findIframeInOpener,g as formatAmount,a as generateSsoUrl,m as getCurrencyAmountKey,c as getSupportedCurrency,f as getSupportedLocale,x as interactionTypes,h as locales,S as productTypes,b as productTypesMask,v as setupClient,n as ssoPopupFeatures,e as ssoPopupName,s as trackEvent};
@@ -0,0 +1,45 @@
1
+ import { Hex } from "viem";
2
+
3
+ //#region src/types/rpc/interaction.d.ts
4
+
5
+ /**
6
+ * Represent a prepared user interaction, ready to be sent on-chain via the wallet
7
+ */
8
+ type PreparedInteraction = {
9
+ handlerTypeDenominator: Hex;
10
+ interactionData: Hex;
11
+ };
12
+ /**
13
+ * Parameters that will be used to send an interaction to the blockchain
14
+ * @inline
15
+ */
16
+ type SendInteractionParamsType = {
17
+ /**
18
+ * The product id where this interaction has been made
19
+ * @defaultValue keccak256(toHex(window.location.host))
20
+ */
21
+ productId?: Hex;
22
+ /**
23
+ * The prepared interaction, built from an Interaction Encoder
24
+ */
25
+ interaction: PreparedInteraction;
26
+ /**
27
+ * A pre-computed interaction signature
28
+ * If none provided, the delegated interaction validator of your product will sign it (you can manage it in the business dashboard)
29
+ *
30
+ * @defaultValue undefined
31
+ */
32
+ validation?: Hex;
33
+ };
34
+ /**
35
+ * Return type of the send interaction rpc request
36
+ * @group RPC Schema
37
+ */
38
+ type SendInteractionReturnType = {
39
+ /**
40
+ * The id of the interaction in the interaction pool
41
+ */
42
+ delegationId: string;
43
+ };
44
+ //#endregion
45
+ export { SendInteractionParamsType as n, SendInteractionReturnType as r, PreparedInteraction as t };
@@ -0,0 +1,45 @@
1
+ import { Hex } from "viem";
2
+
3
+ //#region src/types/rpc/interaction.d.ts
4
+
5
+ /**
6
+ * Represent a prepared user interaction, ready to be sent on-chain via the wallet
7
+ */
8
+ type PreparedInteraction = {
9
+ handlerTypeDenominator: Hex;
10
+ interactionData: Hex;
11
+ };
12
+ /**
13
+ * Parameters that will be used to send an interaction to the blockchain
14
+ * @inline
15
+ */
16
+ type SendInteractionParamsType = {
17
+ /**
18
+ * The product id where this interaction has been made
19
+ * @defaultValue keccak256(toHex(window.location.host))
20
+ */
21
+ productId?: Hex;
22
+ /**
23
+ * The prepared interaction, built from an Interaction Encoder
24
+ */
25
+ interaction: PreparedInteraction;
26
+ /**
27
+ * A pre-computed interaction signature
28
+ * If none provided, the delegated interaction validator of your product will sign it (you can manage it in the business dashboard)
29
+ *
30
+ * @defaultValue undefined
31
+ */
32
+ validation?: Hex;
33
+ };
34
+ /**
35
+ * Return type of the send interaction rpc request
36
+ * @group RPC Schema
37
+ */
38
+ type SendInteractionReturnType = {
39
+ /**
40
+ * The id of the interaction in the interaction pool
41
+ */
42
+ delegationId: string;
43
+ };
44
+ //#endregion
45
+ export { SendInteractionParamsType as n, SendInteractionReturnType as r, PreparedInteraction as t };
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./productTypes-CGb1MmBF.js";import{concatHex as n,encodeAbiParameters as r,pad as i,toHex as a}from"viem";const o={openArticle({articleId:r}){let o=n([e.press.openArticle,i(r,{size:32})]);return{handlerTypeDenominator:a(t.press),interactionData:o}},readArticle({articleId:r}){let o=n([e.press.readArticle,i(r,{size:32})]);return{handlerTypeDenominator:a(t.press),interactionData:o}}},s={startPurchase({purchaseId:r}){let o=n([e.purchase.started,i(r,{size:32})]);return{handlerTypeDenominator:a(t.purchase),interactionData:o}},completedPurchase({purchaseId:i,proof:o}){let s=r([{type:`uint256`},{type:`bytes32[]`}],[BigInt(i),o]),c=n([e.purchase.completed,s]);return{handlerTypeDenominator:a(t.purchase),interactionData:c}},unsafeCompletedPurchase({purchaseId:r}){let o=n([e.purchase.unsafeCompleted,i(r,{size:32})]);return{handlerTypeDenominator:a(t.purchase),interactionData:o}}},c={createLink(){return{handlerTypeDenominator:a(t.referral),interactionData:e.referral.createLink}},referred({referrer:r}){let o=n([e.referral.referred,i(r,{size:32})]);return{handlerTypeDenominator:a(t.referral),interactionData:o}}},l={customerMeeting({agencyId:r}){let o=n([e.retail.customerMeeting,i(r,{size:32})]);return{handlerTypeDenominator:a(t.retail),interactionData:o}}},u={open(){return{handlerTypeDenominator:a(t.webshop),interactionData:e.webshop.open}}};export{o as a,s as i,l as n,c as r,u as t};
@@ -0,0 +1 @@
1
+ const e=require(`./productTypes-BUkXJKZ7.cjs`);let t=require(`viem`);const n={openArticle({articleId:n}){let r=(0,t.concatHex)([e.r.press.openArticle,(0,t.pad)(n,{size:32})]);return{handlerTypeDenominator:(0,t.toHex)(e.t.press),interactionData:r}},readArticle({articleId:n}){let r=(0,t.concatHex)([e.r.press.readArticle,(0,t.pad)(n,{size:32})]);return{handlerTypeDenominator:(0,t.toHex)(e.t.press),interactionData:r}}},r={startPurchase({purchaseId:n}){let r=(0,t.concatHex)([e.r.purchase.started,(0,t.pad)(n,{size:32})]);return{handlerTypeDenominator:(0,t.toHex)(e.t.purchase),interactionData:r}},completedPurchase({purchaseId:n,proof:r}){let i=(0,t.encodeAbiParameters)([{type:`uint256`},{type:`bytes32[]`}],[BigInt(n),r]),a=(0,t.concatHex)([e.r.purchase.completed,i]);return{handlerTypeDenominator:(0,t.toHex)(e.t.purchase),interactionData:a}},unsafeCompletedPurchase({purchaseId:n}){let r=(0,t.concatHex)([e.r.purchase.unsafeCompleted,(0,t.pad)(n,{size:32})]);return{handlerTypeDenominator:(0,t.toHex)(e.t.purchase),interactionData:r}}},i={createLink(){return{handlerTypeDenominator:(0,t.toHex)(e.t.referral),interactionData:e.r.referral.createLink}},referred({referrer:n}){let r=(0,t.concatHex)([e.r.referral.referred,(0,t.pad)(n,{size:32})]);return{handlerTypeDenominator:(0,t.toHex)(e.t.referral),interactionData:r}}},a={customerMeeting({agencyId:n}){let r=(0,t.concatHex)([e.r.retail.customerMeeting,(0,t.pad)(n,{size:32})]);return{handlerTypeDenominator:(0,t.toHex)(e.t.retail),interactionData:r}}},o={open(){return{handlerTypeDenominator:(0,t.toHex)(e.t.webshop),interactionData:e.r.webshop.open}}};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
@@ -1 +1 @@
1
- "use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,r)=>{for(var t in r)__webpack_require__.o(r,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},__webpack_require__.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{PressInteractionEncoder:()=>PressInteractionEncoder,ReferralInteractionEncoder:()=>ReferralInteractionEncoder,RetailInteractionEncoder:()=>RetailInteractionEncoder,PurchaseInteractionEncoder:()=>PurchaseInteractionEncoder,WebShopInteractionEncoder:()=>WebShopInteractionEncoder});let external_viem_namespaceObject=require("viem"),interactionTypes={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4",unsafeCompleted:"0x4d5b14e0"},retail:{customerMeeting:"0x74489004"}},productTypes={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},productTypesMask=Object.entries(productTypes).reduce((e,[r,t])=>(e[r]=BigInt(1)<<BigInt(t),e),{}),PressInteractionEncoder={openArticle({articleId:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.press.openArticle,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.press),interactionData:r}},readArticle({articleId:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.press.readArticle,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.press),interactionData:r}}},ReferralInteractionEncoder={createLink:()=>({handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.referral),interactionData:interactionTypes.referral.createLink}),referred({referrer:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.referral.referred,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.referral),interactionData:r}}},PurchaseInteractionEncoder={startPurchase({purchaseId:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.purchase.started,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.purchase),interactionData:r}},completedPurchase({purchaseId:e,proof:r}){let t=(0,external_viem_namespaceObject.encodeAbiParameters)([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),r]),a=(0,external_viem_namespaceObject.concatHex)([interactionTypes.purchase.completed,t]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.purchase),interactionData:a}},unsafeCompletedPurchase({purchaseId:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.purchase.unsafeCompleted,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.purchase),interactionData:r}}},WebShopInteractionEncoder={open:()=>({handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.webshop),interactionData:interactionTypes.webshop.open})},RetailInteractionEncoder={customerMeeting({agencyId:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.retail.customerMeeting,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.retail),interactionData:r}}};for(var __webpack_i__ in exports.PressInteractionEncoder=__webpack_exports__.PressInteractionEncoder,exports.PurchaseInteractionEncoder=__webpack_exports__.PurchaseInteractionEncoder,exports.ReferralInteractionEncoder=__webpack_exports__.ReferralInteractionEncoder,exports.RetailInteractionEncoder=__webpack_exports__.RetailInteractionEncoder,exports.WebShopInteractionEncoder=__webpack_exports__.WebShopInteractionEncoder,__webpack_exports__)-1===["PressInteractionEncoder","PurchaseInteractionEncoder","ReferralInteractionEncoder","RetailInteractionEncoder","WebShopInteractionEncoder"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
1
+ const e=require(`./interactions-EIXhNLf6.cjs`);exports.PressInteractionEncoder=e.a,exports.PurchaseInteractionEncoder=e.i,exports.ReferralInteractionEncoder=e.r,exports.RetailInteractionEncoder=e.n,exports.WebShopInteractionEncoder=e.t;
@@ -1,182 +1,2 @@
1
- import { Address } from 'viem';
2
- import { Hex } from 'viem';
3
-
4
- /**
5
- * Represent a prepared user interaction, ready to be sent on-chain via the wallet
6
- */
7
- declare type PreparedInteraction = {
8
- handlerTypeDenominator: Hex;
9
- interactionData: Hex;
10
- };
11
-
12
- /**
13
- * Press interactions allow you to track user engagement with articles or other press content on your platform.
14
- * After setting up these interactions, you can create acquisition campaign based on the user engagement with your press content.
15
- *
16
- * :::info
17
- * To properly handle press interactions, ensure that the "Press" product type is enabled in your Business dashboard.
18
- * :::
19
- *
20
- * @description Encode press related user interactions
21
- *
22
- * @group Interactions Encoder
23
- *
24
- * @see {@link PreparedInteraction} The prepared interaction object that can be sent
25
- * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
26
- */
27
- export declare const PressInteractionEncoder: {
28
- /**
29
- * Encode an open article interaction
30
- * @param args
31
- * @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
32
- */
33
- openArticle({ articleId }: {
34
- articleId: Hex;
35
- }): PreparedInteraction;
36
- /**
37
- * Encode a read article interaction
38
- * @param args
39
- * @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
40
- */
41
- readArticle({ articleId }: {
42
- articleId: Hex;
43
- }): PreparedInteraction;
44
- };
45
-
46
- /**
47
- * Purchase interactions allow you to track user purchases on your platform.
48
- * After setting up these interactions, you can create acquisition campaign based on the user purchase (starting a new one, completed, or even purchase dropped).
49
- *
50
- * :::info
51
- * To properly handle purchase interactions, ensure that the "Purchase" product type is enabled in your Business dashboard, and that you have set up everything correctly in the `Purchasetracker` section.
52
- * :::
53
- *
54
- * :::note
55
- * The `purchaseId` is used on both interactions. It can be computed like this:
56
- *
57
- * ```ts
58
- * const purchaseId = keccak256(concatHex([productId, toHex(externalPurchaseId)]));
59
- * ```
60
- *
61
- * With:
62
- * - `productId`: The id of your product, you can find it in the product dashboard.
63
- * - `externalPurchaseId`: The id of the purchase in your system (e.g. the shopify `order_id`).
64
- * :::
65
- *
66
- * @description Encode purchase related user interactions
67
- *
68
- * @group Interactions Encoder
69
- *
70
- * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
71
- * @see {@link PreparedInteraction} The prepared interaction object that can be sent
72
- * @see {@link !actions.trackPurchaseStatus | `trackPurchaseStatus()`} Action that will automatically send the purchase upon completion
73
- * @see [Purchase Webhooks](/wallet-sdk/references-api/webhook) Webhooks to be implemented on your side to confirm a purchase
74
- * @see [Purchase Proof](/wallet-sdk/references-api/purchaseProof) Get a merklee proof for the purchase
75
- */
76
- export declare const PurchaseInteractionEncoder: {
77
- /**
78
- * Encode a start purchase interaction
79
- * @param args
80
- * @param args.purchaseId - The id of the purchase that is being started.
81
- */
82
- startPurchase({ purchaseId }: {
83
- purchaseId: Hex;
84
- }): PreparedInteraction;
85
- /**
86
- * Encode a complete purchase interaction
87
- * @param args
88
- * @param args.purchaseId - The id of the purchase that is being completed.
89
- * @param args.proof - The merkle proof that the user has completed the purchase (see [Purchase Webhooks](/wallet-sdk/references-api/webhook) for more details).
90
- */
91
- completedPurchase({ purchaseId, proof, }: {
92
- purchaseId: Hex;
93
- proof: Hex[];
94
- }): PreparedInteraction;
95
- /**
96
- * Encode an unsafe complete purchase interaction (when we can't provide the proof)
97
- * @param args
98
- * @param args.purchaseId - The id of the purchase that is being completed.
99
- */
100
- unsafeCompletedPurchase({ purchaseId, }: {
101
- purchaseId: Hex;
102
- }): PreparedInteraction;
103
- };
104
-
105
- /**
106
- * Referral interactions allow you to track user sharing activities.
107
- * These interactions are essential for platforms looking to grow their user base through user-to-user referrals and reward systems.
108
- *
109
- * :::info
110
- * To properly handle referral interactions, ensure that the "Referral" product type is enabled in your Business dashboard.
111
- * :::
112
- *
113
- * @description Encode referral related user interactions
114
- *
115
- * @group Interactions Encoder
116
- *
117
- * @see {@link PreparedInteraction} The prepared interaction object that can be sent
118
- * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
119
- */
120
- export declare const ReferralInteractionEncoder: {
121
- /**
122
- * 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.
123
- */
124
- createLink(): PreparedInteraction;
125
- /**
126
- * Encode a referred interaction
127
- * @param args
128
- * @param args.referrer - The Ethereum address of the user who made the referral
129
- */
130
- referred({ referrer }: {
131
- referrer: Address;
132
- }): PreparedInteraction;
133
- };
134
-
135
- /**
136
- * Retail interactions allow you to track user activities on your retails products.
137
- *
138
- * :::info
139
- * To properly handle retail interactions, ensure that the "Retail" product type is enabled in your Business dashboard.
140
- * :::
141
- *
142
- * @description Encode retail related user interactions
143
- *
144
- * @group Interactions Encoder
145
- *
146
- * @see {@link PreparedInteraction} The prepared interaction object that can be sent
147
- * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
148
- */
149
- export declare const RetailInteractionEncoder: {
150
- /**
151
- * Encode a customer meeting retail interaction
152
- * @param args
153
- * @param args.agencyId - The id of the agency that the customer is meeting with
154
- *
155
- */
156
- customerMeeting({ agencyId }: {
157
- agencyId: Hex;
158
- }): PreparedInteraction;
159
- };
160
-
161
- /**
162
- * Webshop interactions allow you to track user activities on your webshop.
163
- *
164
- * :::info
165
- * To properly handle webshop interactions, ensure that the "WebShop" product type is enabled in your Business dashboard.
166
- * :::
167
- *
168
- * @description Encode webshop related user interactions
169
- *
170
- * @group Interactions Encoder
171
- *
172
- * @see {@link PreparedInteraction} The prepared interaction object that can be sent
173
- * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
174
- */
175
- export declare const WebShopInteractionEncoder: {
176
- /**
177
- * Encode an open webshop interaction
178
- */
179
- open(): PreparedInteraction;
180
- };
181
-
182
- export { }
1
+ import { a as PressInteractionEncoder, i as PurchaseInteractionEncoder, n as RetailInteractionEncoder, r as ReferralInteractionEncoder, t as WebShopInteractionEncoder } from "./index-zDq-VlKx.cjs";
2
+ export { PressInteractionEncoder, PurchaseInteractionEncoder, ReferralInteractionEncoder, RetailInteractionEncoder, WebShopInteractionEncoder };
@@ -1,182 +1,2 @@
1
- import { Address } from 'viem';
2
- import { Hex } from 'viem';
3
-
4
- /**
5
- * Represent a prepared user interaction, ready to be sent on-chain via the wallet
6
- */
7
- declare type PreparedInteraction = {
8
- handlerTypeDenominator: Hex;
9
- interactionData: Hex;
10
- };
11
-
12
- /**
13
- * Press interactions allow you to track user engagement with articles or other press content on your platform.
14
- * After setting up these interactions, you can create acquisition campaign based on the user engagement with your press content.
15
- *
16
- * :::info
17
- * To properly handle press interactions, ensure that the "Press" product type is enabled in your Business dashboard.
18
- * :::
19
- *
20
- * @description Encode press related user interactions
21
- *
22
- * @group Interactions Encoder
23
- *
24
- * @see {@link PreparedInteraction} The prepared interaction object that can be sent
25
- * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
26
- */
27
- export declare const PressInteractionEncoder: {
28
- /**
29
- * Encode an open article interaction
30
- * @param args
31
- * @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
32
- */
33
- openArticle({ articleId }: {
34
- articleId: Hex;
35
- }): PreparedInteraction;
36
- /**
37
- * Encode a read article interaction
38
- * @param args
39
- * @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
40
- */
41
- readArticle({ articleId }: {
42
- articleId: Hex;
43
- }): PreparedInteraction;
44
- };
45
-
46
- /**
47
- * Purchase interactions allow you to track user purchases on your platform.
48
- * After setting up these interactions, you can create acquisition campaign based on the user purchase (starting a new one, completed, or even purchase dropped).
49
- *
50
- * :::info
51
- * To properly handle purchase interactions, ensure that the "Purchase" product type is enabled in your Business dashboard, and that you have set up everything correctly in the `Purchasetracker` section.
52
- * :::
53
- *
54
- * :::note
55
- * The `purchaseId` is used on both interactions. It can be computed like this:
56
- *
57
- * ```ts
58
- * const purchaseId = keccak256(concatHex([productId, toHex(externalPurchaseId)]));
59
- * ```
60
- *
61
- * With:
62
- * - `productId`: The id of your product, you can find it in the product dashboard.
63
- * - `externalPurchaseId`: The id of the purchase in your system (e.g. the shopify `order_id`).
64
- * :::
65
- *
66
- * @description Encode purchase related user interactions
67
- *
68
- * @group Interactions Encoder
69
- *
70
- * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
71
- * @see {@link PreparedInteraction} The prepared interaction object that can be sent
72
- * @see {@link !actions.trackPurchaseStatus | `trackPurchaseStatus()`} Action that will automatically send the purchase upon completion
73
- * @see [Purchase Webhooks](/wallet-sdk/references-api/webhook) Webhooks to be implemented on your side to confirm a purchase
74
- * @see [Purchase Proof](/wallet-sdk/references-api/purchaseProof) Get a merklee proof for the purchase
75
- */
76
- export declare const PurchaseInteractionEncoder: {
77
- /**
78
- * Encode a start purchase interaction
79
- * @param args
80
- * @param args.purchaseId - The id of the purchase that is being started.
81
- */
82
- startPurchase({ purchaseId }: {
83
- purchaseId: Hex;
84
- }): PreparedInteraction;
85
- /**
86
- * Encode a complete purchase interaction
87
- * @param args
88
- * @param args.purchaseId - The id of the purchase that is being completed.
89
- * @param args.proof - The merkle proof that the user has completed the purchase (see [Purchase Webhooks](/wallet-sdk/references-api/webhook) for more details).
90
- */
91
- completedPurchase({ purchaseId, proof, }: {
92
- purchaseId: Hex;
93
- proof: Hex[];
94
- }): PreparedInteraction;
95
- /**
96
- * Encode an unsafe complete purchase interaction (when we can't provide the proof)
97
- * @param args
98
- * @param args.purchaseId - The id of the purchase that is being completed.
99
- */
100
- unsafeCompletedPurchase({ purchaseId, }: {
101
- purchaseId: Hex;
102
- }): PreparedInteraction;
103
- };
104
-
105
- /**
106
- * Referral interactions allow you to track user sharing activities.
107
- * These interactions are essential for platforms looking to grow their user base through user-to-user referrals and reward systems.
108
- *
109
- * :::info
110
- * To properly handle referral interactions, ensure that the "Referral" product type is enabled in your Business dashboard.
111
- * :::
112
- *
113
- * @description Encode referral related user interactions
114
- *
115
- * @group Interactions Encoder
116
- *
117
- * @see {@link PreparedInteraction} The prepared interaction object that can be sent
118
- * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
119
- */
120
- export declare const ReferralInteractionEncoder: {
121
- /**
122
- * 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.
123
- */
124
- createLink(): PreparedInteraction;
125
- /**
126
- * Encode a referred interaction
127
- * @param args
128
- * @param args.referrer - The Ethereum address of the user who made the referral
129
- */
130
- referred({ referrer }: {
131
- referrer: Address;
132
- }): PreparedInteraction;
133
- };
134
-
135
- /**
136
- * Retail interactions allow you to track user activities on your retails products.
137
- *
138
- * :::info
139
- * To properly handle retail interactions, ensure that the "Retail" product type is enabled in your Business dashboard.
140
- * :::
141
- *
142
- * @description Encode retail related user interactions
143
- *
144
- * @group Interactions Encoder
145
- *
146
- * @see {@link PreparedInteraction} The prepared interaction object that can be sent
147
- * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
148
- */
149
- export declare const RetailInteractionEncoder: {
150
- /**
151
- * Encode a customer meeting retail interaction
152
- * @param args
153
- * @param args.agencyId - The id of the agency that the customer is meeting with
154
- *
155
- */
156
- customerMeeting({ agencyId }: {
157
- agencyId: Hex;
158
- }): PreparedInteraction;
159
- };
160
-
161
- /**
162
- * Webshop interactions allow you to track user activities on your webshop.
163
- *
164
- * :::info
165
- * To properly handle webshop interactions, ensure that the "WebShop" product type is enabled in your Business dashboard.
166
- * :::
167
- *
168
- * @description Encode webshop related user interactions
169
- *
170
- * @group Interactions Encoder
171
- *
172
- * @see {@link PreparedInteraction} The prepared interaction object that can be sent
173
- * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
174
- */
175
- export declare const WebShopInteractionEncoder: {
176
- /**
177
- * Encode an open webshop interaction
178
- */
179
- open(): PreparedInteraction;
180
- };
181
-
182
- export { }
1
+ import { a as PressInteractionEncoder, i as PurchaseInteractionEncoder, n as RetailInteractionEncoder, r as ReferralInteractionEncoder, t as WebShopInteractionEncoder } from "./index-7OZ39x1U.js";
2
+ export { PressInteractionEncoder, PurchaseInteractionEncoder, ReferralInteractionEncoder, RetailInteractionEncoder, WebShopInteractionEncoder };
@@ -1 +1 @@
1
- import{concatHex as e,encodeAbiParameters as r,pad as t,toHex as n}from"viem";let a="0xc0a24ffb",o="0xd5bd0fbe",i="0xb311798f",c="0x010cc3b9",l="0xb2c0f17c",p="0xd87e90c3",s="0x8403aeb4",d="0x4d5b14e0",h="0x74489004",u={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31};Object.entries(u).reduce((e,[r,t])=>(e[r]=BigInt(1)<<BigInt(t),e),{});let m={openArticle({articleId:r}){let o=e([a,t(r,{size:32})]);return{handlerTypeDenominator:n(u.press),interactionData:o}},readArticle({articleId:r}){let a=e([o,t(r,{size:32})]);return{handlerTypeDenominator:n(u.press),interactionData:a}}},b={createLink:()=>({handlerTypeDenominator:n(u.referral),interactionData:l}),referred({referrer:r}){let a=e([c,t(r,{size:32})]);return{handlerTypeDenominator:n(u.referral),interactionData:a}}},f={startPurchase({purchaseId:r}){let a=e([p,t(r,{size:32})]);return{handlerTypeDenominator:n(u.purchase),interactionData:a}},completedPurchase({purchaseId:t,proof:a}){let o=r([{type:"uint256"},{type:"bytes32[]"}],[BigInt(t),a]),i=e([s,o]);return{handlerTypeDenominator:n(u.purchase),interactionData:i}},unsafeCompletedPurchase({purchaseId:r}){let a=e([d,t(r,{size:32})]);return{handlerTypeDenominator:n(u.purchase),interactionData:a}}},y={open:()=>({handlerTypeDenominator:n(u.webshop),interactionData:i})},D={customerMeeting({agencyId:r}){let a=e([h,t(r,{size:32})]);return{handlerTypeDenominator:n(u.retail),interactionData:a}}};export{m as PressInteractionEncoder,f as PurchaseInteractionEncoder,b as ReferralInteractionEncoder,D as RetailInteractionEncoder,y as WebShopInteractionEncoder};
1
+ import{a as e,i as t,n,r,t as i}from"./interactions-DnfM3oe0.js";export{e as PressInteractionEncoder,t as PurchaseInteractionEncoder,r as ReferralInteractionEncoder,n as RetailInteractionEncoder,i as WebShopInteractionEncoder};