@frak-labs/components 0.0.26-beta.d04602ec → 0.0.26-beta.eb3cff34

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 (42) hide show
  1. package/cdn/Banner.Ws9o79lU.js +64 -0
  2. package/cdn/ButtonShare.BDS1fgma.js +1 -0
  3. package/cdn/ButtonWallet.Be1UyRm8.js +40 -0
  4. package/cdn/OpenInAppButton.Diqt07eo.js +1 -0
  5. package/cdn/PostPurchase.DqFhm-Jn.js +52 -0
  6. package/cdn/components.js +1 -1
  7. package/cdn/formatReward.CXxVsWN3.js +1 -0
  8. package/cdn/loader.js +3 -55
  9. package/cdn/sprinkles.css.ts.vanilla.BtFkD4B3.js +1175 -0
  10. package/cdn/useGlobalComponents.BRe8dKO7.js +1 -0
  11. package/cdn/useLightDomStyles.ZFa154u8.js +1 -0
  12. package/cdn/usePlacement.B7jMsQvP.js +58 -0
  13. package/cdn/useReward.qEKeySJG.js +1 -0
  14. package/cdn/useShareModal.B--64ELG.js +1 -0
  15. package/dist/GiftIcon-4sr9xXyq.js +1501 -0
  16. package/dist/banner.d.ts +24 -11
  17. package/dist/banner.js +347 -103
  18. package/dist/buttonShare.d.ts +2 -2
  19. package/dist/buttonShare.js +11 -14
  20. package/dist/buttonWallet.d.ts +2 -2
  21. package/dist/buttonWallet.js +3 -7
  22. package/dist/{formatReward-6JQldDEC.js → formatReward-Bub6Z6eY.js} +8 -3
  23. package/dist/openInApp.d.ts +2 -2
  24. package/dist/openInApp.js +3 -9
  25. package/dist/postPurchase.d.ts +8 -2
  26. package/dist/postPurchase.js +1464 -31
  27. package/dist/useGlobalComponents-Cmfszr7v.js +21 -0
  28. package/dist/{useLightDomStyles-DukxuNnJ.js → useLightDomStyles-hgYYZsTy.js} +2 -5
  29. package/dist/{usePlacement-BbMuz8_A.js → usePlacement-LqYjZLX_.js} +1 -93
  30. package/dist/{useReward-CI2yRrCj.js → useReward-DU3_yP8Q.js} +2 -4
  31. package/dist/{useShareModal-DHlayNqk.js → useShareModal-DgEf5WWG.js} +1 -3
  32. package/package.json +13 -9
  33. package/cdn/Banner.BfkMel9Q.js +0 -1
  34. package/cdn/ButtonShare.BM9Inhmf.js +0 -1
  35. package/cdn/ButtonWallet.B7UmJcbb.js +0 -40
  36. package/cdn/OpenInAppButton.B4mrsz6L.js +0 -1
  37. package/cdn/PostPurchase.BIc0C4Ma.js +0 -1
  38. package/cdn/formatReward.C8hlSKRj.js +0 -1
  39. package/cdn/jsxRuntime.module.5UNmmhNi.js +0 -138
  40. package/cdn/useLightDomStyles.D895e4W1.js +0 -1
  41. package/cdn/useReward.DEU0AF3P.js +0 -1
  42. package/cdn/useShareModal.CN9_P7Sl.js +0 -1
@@ -0,0 +1,21 @@
1
+ import { sdkConfigStore } from "@frak-labs/core-sdk";
2
+ import { useEffect, useMemo, useState } from "preact/hooks";
3
+ //#region src/hooks/useGlobalComponents.ts
4
+ /**
5
+ * Subscribe to the global component defaults from the SDK config store.
6
+ * These serve as fallbacks when no placement-level override exists.
7
+ */
8
+ function useGlobalComponents() {
9
+ const [configVersion, setConfigVersion] = useState(0);
10
+ useEffect(() => {
11
+ const onConfig = (_e) => {
12
+ setConfigVersion((v) => v + 1);
13
+ };
14
+ window.addEventListener("frak:config", onConfig);
15
+ setConfigVersion((v) => v + 1);
16
+ return () => window.removeEventListener("frak:config", onConfig);
17
+ }, []);
18
+ return useMemo(() => sdkConfigStore.getConfig().components, [configVersion]);
19
+ }
20
+ //#endregion
21
+ export { useGlobalComponents as t };
@@ -1,6 +1,5 @@
1
- import { i as lightDomBaseCss } from "./usePlacement-BbMuz8_A.js";
1
+ import { r as lightDomBaseCss } from "./usePlacement-LqYjZLX_.js";
2
2
  import { useEffect } from "preact/hooks";
3
-
4
3
  //#region src/utils/styleManager.ts
5
4
  function ensureStyle(id, css) {
6
5
  const existing = document.getElementById(id);
@@ -23,7 +22,6 @@ const styleManager = {
23
22
  injectBase,
24
23
  injectPlacement
25
24
  };
26
-
27
25
  //#endregion
28
26
  //#region src/hooks/useLightDomStyles.ts
29
27
  function useLightDomStyles(tag, placementId, placementCss, baseCss) {
@@ -39,6 +37,5 @@ function useLightDomStyles(tag, placementId, placementCss, baseCss) {
39
37
  placementCss
40
38
  ]);
41
39
  }
42
-
43
40
  //#endregion
44
- export { useLightDomStyles as t };
41
+ export { useLightDomStyles as t };
@@ -4,7 +4,6 @@ import { sdkConfigStore, setupClient, withCache } from "@frak-labs/core-sdk";
4
4
  import * as coreSdkActions from "@frak-labs/core-sdk/actions";
5
5
  import { displayEmbeddedWallet } from "@frak-labs/core-sdk/actions";
6
6
  import { useEffect, useMemo, useState } from "preact/hooks";
7
-
8
7
  //#region src/utils/embeddedWallet.ts
9
8
  async function openEmbeddedWallet(targetInteraction, placement) {
10
9
  if (!window.FrakSetup?.client) {
@@ -20,7 +19,6 @@ async function openEmbeddedWallet(targetInteraction, placement) {
20
19
  }
21
20
  } : modalWalletConfig, placement);
22
21
  }
23
-
24
22
  //#endregion
25
23
  //#region src/utils/safeVibrate.ts
26
24
  /**
@@ -30,14 +28,12 @@ function safeVibrate() {
30
28
  if ("vibrate" in navigator) navigator.vibrate(10);
31
29
  else console.log("Vibration not supported");
32
30
  }
33
-
34
31
  //#endregion
35
32
  //#region src/components/ButtonWallet/utils.ts
36
33
  function openWalletModal(targetInteraction, placement) {
37
34
  safeVibrate();
38
35
  openEmbeddedWallet(targetInteraction, placement);
39
36
  }
40
-
41
37
  //#endregion
42
38
  //#region src/utils/clientReady.ts
43
39
  const CUSTOM_EVENT_NAME = "frak:client";
@@ -60,7 +56,6 @@ function onClientReady(action, callback) {
60
56
  }
61
57
  (action === "add" ? window.addEventListener : window.removeEventListener)(CUSTOM_EVENT_NAME, callback, false);
62
58
  }
63
-
64
59
  //#endregion
65
60
  //#region src/utils/initFrakSdk.ts
66
61
  /**
@@ -107,7 +102,6 @@ function handleActionQueryParam() {
107
102
  openWalletModal();
108
103
  }
109
104
  }
110
-
111
105
  //#endregion
112
106
  //#region src/utils/onDocumentReady.ts
113
107
  /**
@@ -118,7 +112,6 @@ function onDocumentReady(callback) {
118
112
  if (document.readyState === "complete" || document.readyState === "interactive") setTimeout(callback, 1);
119
113
  else document.addEventListener("DOMContentLoaded", callback);
120
114
  }
121
-
122
115
  //#endregion
123
116
  //#region src/utils/registerWebComponent.ts
124
117
  /**
@@ -135,7 +128,6 @@ function registerWebComponent(component, tagName, observedAttributes = [], optio
135
128
  if (!customElements.get(tagName)) register(component, tagName, observedAttributes, options);
136
129
  }
137
130
  }
138
-
139
131
  //#endregion
140
132
  //#region src/hooks/useClientReady.ts
141
133
  function useClientReady() {
@@ -171,7 +163,6 @@ function useClientReady() {
171
163
  isClientReady
172
164
  };
173
165
  }
174
-
175
166
  //#endregion
176
167
  //#region src/utils/sharedCss.ts
177
168
  const sharedCss = `
@@ -236,88 +227,6 @@ const lightDomBaseCss = `
236
227
  }
237
228
  }
238
229
  `;
239
- const bannerBaseCss = `
240
- :where(frak-banner) {
241
- display: block;
242
- }
243
-
244
- :where(frak-banner .banner) {
245
- display: flex;
246
- align-items: center;
247
- gap: 12px;
248
- padding: 12px 16px;
249
- border-top: 2px solid #3b82f6;
250
- border-bottom: 2px solid #3b82f6;
251
- font-family: inherit;
252
- line-height: 1.4;
253
- }
254
-
255
- :where(frak-banner .banner__fadeIn) {
256
- animation: frak-fadeIn 300ms ease-in;
257
- }
258
-
259
- @keyframes frak-fadeIn {
260
- from {
261
- opacity: 0;
262
- }
263
-
264
- to {
265
- opacity: 1;
266
- }
267
- }
268
-
269
- :where(frak-banner .banner__icon) {
270
- flex-shrink: 0;
271
- display: flex;
272
- align-items: center;
273
- justify-content: center;
274
- width: 32px;
275
- height: 32px;
276
- color: #3b82f6;
277
- }
278
-
279
- :where(frak-banner .banner__icon svg) {
280
- width: 100%;
281
- height: 100%;
282
- }
283
-
284
- :where(frak-banner .banner__content) {
285
- flex: 1;
286
- min-width: 0;
287
- }
288
-
289
- :where(frak-banner .banner__title) {
290
- font-weight: 700;
291
- font-size: 0.875rem;
292
- margin: 0 0 2px;
293
- }
294
-
295
- :where(frak-banner .banner__description) {
296
- font-size: 0.75rem;
297
- margin: 0;
298
- opacity: 0.7;
299
- }
300
-
301
- :where(frak-banner .banner__cta) {
302
- flex-shrink: 0;
303
- padding: 8px 16px;
304
- font-weight: 700;
305
- font-size: 0.75rem;
306
- text-transform: uppercase;
307
- letter-spacing: 0.05em;
308
- border: 2px solid #eab308;
309
- border-radius: 0;
310
- background: #eab308;
311
- color: #1e293b;
312
- cursor: pointer;
313
- white-space: nowrap;
314
- }
315
-
316
- :where(frak-banner .banner__cta:hover) {
317
- opacity: 0.9;
318
- }
319
- `;
320
-
321
230
  //#endregion
322
231
  //#region src/hooks/usePlacement.ts
323
232
  function getPlacement(id) {
@@ -335,6 +244,5 @@ function usePlacement(placementId) {
335
244
  }, []);
336
245
  return useMemo(() => placementId ? getPlacement(placementId) : void 0, [placementId, configVersion]);
337
246
  }
338
-
339
247
  //#endregion
340
- export { useClientReady as a, openEmbeddedWallet as c, lightDomBaseCss as i, bannerBaseCss as n, registerWebComponent as o, buildStyleContent as r, openWalletModal as s, usePlacement as t };
248
+ export { registerWebComponent as a, useClientReady as i, buildStyleContent as n, openWalletModal as o, lightDomBaseCss as r, openEmbeddedWallet as s, usePlacement as t };
@@ -1,8 +1,7 @@
1
- import { t as formatEstimatedReward } from "./formatReward-6JQldDEC.js";
1
+ import { n as formatEstimatedReward } from "./formatReward-Bub6Z6eY.js";
2
2
  import { getCurrencyAmountKey, getSupportedCurrency } from "@frak-labs/core-sdk";
3
3
  import { getMerchantInformation } from "@frak-labs/core-sdk/actions";
4
4
  import { useEffect, useState } from "preact/hooks";
5
-
6
5
  //#region src/hooks/useReward.ts
7
6
  /**
8
7
  * Get the comparable fiat value of a reward for ranking purposes.
@@ -62,6 +61,5 @@ function useReward(shouldUseReward, targetInteraction) {
62
61
  }, [shouldUseReward, targetInteraction]);
63
62
  return { reward };
64
63
  }
65
-
66
64
  //#endregion
67
- export { useReward as t };
65
+ export { useReward as t };
@@ -2,7 +2,6 @@ import { DebugInfoGatherer, trackEvent } from "@frak-labs/core-sdk";
2
2
  import { modalBuilder } from "@frak-labs/core-sdk/actions";
3
3
  import { useCallback, useState } from "preact/hooks";
4
4
  import { FrakRpcError, RpcErrorCodes } from "@frak-labs/frame-connector";
5
-
6
5
  //#region src/components/ButtonShare/hooks/useShareModal.ts
7
6
  /**
8
7
  * Open the share modal
@@ -50,6 +49,5 @@ function useShareModal(targetInteraction, placement, sharingLink) {
50
49
  debugInfo
51
50
  };
52
51
  }
53
-
54
52
  //#endregion
55
- export { useShareModal as t };
53
+ export { useShareModal as t };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "0.0.26-beta.d04602ec",
14
+ "version": "0.0.26-beta.eb3cff34",
15
15
  "description": "Frak Wallet components, helping any person to interact with the Frak wallet.",
16
16
  "repository": {
17
17
  "url": "https://github.com/frak-id/wallet",
@@ -86,13 +86,13 @@
86
86
  "publish": "echo 'Publishing components...'"
87
87
  },
88
88
  "dependencies": {
89
- "@frak-labs/core-sdk": "0.2.1-beta.d04602ec",
90
- "@frak-labs/frame-connector": "0.2.0-beta.d04602ec",
89
+ "@frak-labs/core-sdk": "0.2.1-beta.eb3cff34",
90
+ "@frak-labs/frame-connector": "0.2.0-beta.eb3cff34",
91
91
  "preact": "^10.29.0",
92
- "preact-custom-element": "^4.6.0"
92
+ "preact-custom-element": "^4.6.0",
93
+ "@frak-labs/design-system": "0.0.0"
93
94
  },
94
95
  "devDependencies": {
95
- "@frak-labs/dev-tooling": "0.0.0",
96
96
  "@frak-labs/test-foundation": "0.1.0",
97
97
  "@preact/preset-vite": "^2.10.4",
98
98
  "@rolldown/plugin-node-polyfills": "^1.0.3",
@@ -100,13 +100,17 @@
100
100
  "@testing-library/preact": "^3.2.4",
101
101
  "@testing-library/user-event": "^14.6.1",
102
102
  "@types/jsdom": "^28.0.0",
103
- "@types/node": "^24.10.13",
103
+ "@types/node": "^25.6.0",
104
104
  "@types/preact-custom-element": "^4.0.4",
105
+ "@vanilla-extract/css": "^1.20.1",
106
+ "@vanilla-extract/integration": "^8.0.10",
107
+ "@vanilla-extract/vite-plugin": "^5.2.1",
108
+ "@vanilla-extract/sprinkles": "^1.6.5",
105
109
  "@vitest/coverage-v8": "^4.1.0",
106
110
  "@vitest/ui": "^4.1.0",
107
111
  "jsdom": "^29.0.0",
108
- "tsdown": "^0.20.3",
109
- "typescript": "^5.9.3",
110
- "vitest": "^4.1.0"
112
+ "tsdown": "^0.21.8",
113
+ "typescript": "^6.0.2",
114
+ "vitest": "^4.1.4"
111
115
  }
112
116
  }
@@ -1 +0,0 @@
1
- import{f as e,m as t,p as n}from"./loader.js";import{c as r,d as i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./jsxRuntime.module.5UNmmhNi.js";import{t as f}from"./useLightDomStyles.D895e4W1.js";import{t as p}from"./useReward.DEU0AF3P.js";function m(){return u(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:[u(`rect`,{x:`3`,y:`11`,width:`18`,height:`11`,rx:`1`}),u(`path`,{d:`M12 11v11`}),u(`rect`,{x:`5`,y:`7`,width:`14`,height:`4`,rx:`1`}),u(`path`,{d:`M12 7c0 0-1.5-4-4.5-4S5 5 7.5 7`}),u(`path`,{d:`M12 7c0 0 1.5-4 4.5-4S19 5 16.5 7`})]})}function h(){return u(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:[u(`path`,{d:`M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6`}),u(`polyline`,{points:`15 3 21 3 21 9`}),u(`line`,{x1:`10`,y1:`14`,x2:`21`,y2:`3`})]})}function g({placement:i,classname:g=``,interaction:_,referralTitle:v,referralDescription:y,referralCta:b,inappTitle:x,inappDescription:S,inappCta:C}){let w=o(i),{shouldRender:T,isHidden:E,isClientReady:D}=s();f(`frak-banner`,i,w?.components?.banner?.css,c);let[O,k]=r(!1),[A,j]=r(()=>t?`inapp`:null),{reward:M}=p(A===`referral`&&D,_);d(()=>{if(A===`inapp`)return;let t=()=>j(`referral`);return window.addEventListener(e,t),()=>window.removeEventListener(e,t)},[A]);let N=a(()=>{A===`referral`?k(!0):n(window.location.href)},[A]),P=w?.components?.banner,F=l(()=>{if(A===`referral`){let e=M?`Earn ${M} on purchases on this site`:`You've been referred!`;return{title:v??P?.referralTitle??e,description:y??P?.referralDescription??`Earn rewards after your purchase via the Frak partner app.`,cta:b??P?.referralCta??`Got it`}}return{title:x??P?.inappTitle??`Open in your browser`,description:S??P?.inappDescription??`For a better experience and to earn your rewards, open this page in your default browser.`,cta:C??P?.inappCta??`Open browser`}},[A,M,P,v,y,b,x,S,C]);return!T||E||O||!A?null:u(`div`,{class:[`banner`,`banner__fadeIn`,g].filter(Boolean).join(` `),role:`alert`,children:[u(`div`,{class:`banner__icon`,children:u(A===`referral`?m:h,{})}),u(`div`,{class:`banner__content`,children:[u(`p`,{class:`banner__title`,children:F.title}),u(`p`,{class:`banner__description`,children:F.description})]}),u(`button`,{type:`button`,class:`banner__cta`,onClick:N,children:F.cta})]})}i(g,`frak-banner`,[`placement`,`classname`,`interaction`,`referralTitle`,`referralDescription`,`referralCta`,`inappTitle`,`inappDescription`,`inappCta`],{shadow:!1});export{g as Banner};
@@ -1 +0,0 @@
1
- import{S as e,d as t,o as n}from"./loader.js";import{c as r,d as i,f as a,l as o,n as s,o as c,s as l,t as u}from"./jsxRuntime.module.5UNmmhNi.js";import{t as d}from"./useLightDomStyles.D895e4W1.js";import{t as f}from"./useReward.DEU0AF3P.js";import{t as p}from"./useShareModal.CN9_P7Sl.js";async function m(e,n){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}await t(window.FrakSetup.client,{metadata:{...e&&{targetInteraction:e}}},n)}function h(e={}){let{successDuration:t=2e3}=e,[n,i]=r(!1);return{copy:o(async e=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e),i(!0);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();try{document.execCommand(`copy`),i(!0)}catch(e){return console.error(`Failed to copy text:`,e),!1}finally{t.remove()}}return setTimeout(()=>{i(!1)},t),!0}catch(e){return console.error(`Failed to copy text:`,e),!1}},[t]),copied:n}}const g={errorContainer:{marginTop:`16px`,padding:`16px`,backgroundColor:`#FEE2E2`,border:`1px solid #FCA5A5`,borderRadius:`4px`,color:`#991B1B`},header:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`12px`},title:{margin:0,fontSize:`16px`,fontWeight:500},message:{fontSize:`14px`,lineHeight:`1.5`,margin:`0 0 12px 0`},link:{color:`#991B1B`,textDecoration:`underline`,textUnderlineOffset:`2px`},copyButton:{display:`inline-flex`,alignItems:`center`,gap:`8px`,marginBottom:`10px`,padding:`8px 12px`,backgroundColor:`white`,border:`1px solid #D1D5DB`,borderRadius:`4px`,color:`black`,fontSize:`14px`,fontWeight:500}};function _({debugInfo:e}){let[t,n]=r(!1);return u(`div`,{children:[u(`button`,{type:`button`,style:g.copyButton,onClick:()=>n(!t),children:`Ouvrir les informations`}),t&&u(`textarea`,{style:{display:`block`,width:`100%`,height:`200px`,fontSize:`12px`},children:e})]})}function v({debugInfo:e}){let{copied:t,copy:n}=h();return u(`div`,{style:g.errorContainer,children:[u(`div`,{style:g.header,children:u(`h3`,{style:g.title,children:`Oups ! Nous avons rencontré un petit problème`})}),u(`p`,{style:g.message,children:[`Impossible d'ouvrir le menu de partage pour le moment. Si le problème persiste, copiez les informations ci-dessous et collez-les dans votre mail à`,` `,u(`a`,{href:`mailto:help@frak-labs.com?subject=Debug`,style:g.link,children:`help@frak-labs.com`}),` `,u(`br`,{}),`Merci pour votre retour, nous traitons votre demande dans les plus brefs délais.`]}),u(`button`,{type:`button`,onClick:()=>n(e??``),style:g.copyButton,children:t?`Informations copiées !`:`Copier les informations de débogage`}),u(_,{debugInfo:e})]})}function y({placement:t,text:r=`Share and earn!`,classname:i=``,useReward:h,noRewardText:g,targetInteraction:_,clickAction:y}){let b=s(t),x=b?.components?.buttonShare;d(`frak-button-share`,t,x?.css);let S=l(()=>b?.targetInteraction===void 0?_:b.targetInteraction,[b?.targetInteraction,_]),C=x?.text??r,w=x?.noRewardText??g,T=l(()=>x?.useReward??h===!0,[x?.useReward,h]),E=l(()=>x?.clickAction??y??`sharing-page`,[x?.clickAction,y]),{shouldRender:D,isHidden:O,isClientReady:k}=c(),{reward:A}=f(T&&k,S),{handleShare:j,isError:M,debugInfo:N}=p(S,t),P=l(()=>T?A?C.includes(`{REWARD}`)?C.replace(`{REWARD}`,A):`${C} ${A}`:w??C.replace(`{REWARD}`,``):C,[T,C,w,A]),F=o(async()=>{e(window.FrakSetup.client,`share_button_clicked`),E===`embedded-wallet`?n(S,t):E===`share-modal`?await j():m(S,t)},[E,j,S,t]);if(!D||O)return null;let I=[`button`,`button__fadeIn`,i].filter(Boolean).join(` `);return u(a,{children:[u(`button`,{type:`button`,disabled:!k,class:I,onClick:F,children:P}),M&&u(v,{debugInfo:N})]})}i(y,`frak-button-share`,[`text`,`placement`,`classname`,`clickAction`,`useReward`,`noRewardText`,`targetInteraction`],{shadow:!1});export{y as ButtonShare};
@@ -1,40 +0,0 @@
1
- import{S as e,a as t}from"./loader.js";import{c as n,d as r,f as i,i as a,n as o,o as s,s as c,t as l,u}from"./jsxRuntime.module.5UNmmhNi.js";import{t as d}from"./useReward.DEU0AF3P.js";function f(e){return l(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[l(`title`,{children:`Gift icon`}),l(`path`,{d:`m23.1427 13.9999v11.4285h-18.2857v-11.4285m9.1429 11.4285v-17.14282m0 0h-5.1429c-.75776 0-1.48448-.30102-2.0203-.83684s-.83684-1.26255-.83684-2.02031.30102-1.48448.83684-2.0203 1.26254-.83684 2.0203-.83684c4 0 5.1429 5.71429 5.1429 5.71429zm0 0h5.1428c.7578 0 1.4845-.30102 2.0203-.83684s.8369-1.26255.8369-2.02031-.3011-1.48448-.8369-2.0203-1.2625-.83684-2.0203-.83684c-4 0-5.1428 5.71429-5.1428 5.71429zm-11.42861 0h22.85711v5.71432h-22.85711z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}function p({placement:r,classname:p=``,useReward:m,targetInteraction:h}){let g=o(r),_=c(()=>g?.targetInteraction===void 0?h:g.targetInteraction,[g?.targetInteraction,h]),v=c(()=>m===!0,[m]),{shouldRender:y,isHidden:b,isClientReady:x}=s(),{reward:S}=d(v&&x,_),[C,w]=n(`right`);if(u(()=>{let e=g?.components?.buttonWallet?.position,t=window.FrakSetup?.modalWalletConfig?.metadata?.position;w(e??t??`right`)},[g?.components?.buttonWallet?.position]),!y||b)return null;let T=[`button`,`button__fadeIn`,C===`left`?`button__left`:`button__right`,p].filter(Boolean).join(` `);return l(i,{children:[l(`style`,{children:a(`
2
- .button {
3
- all: unset;
4
- position: fixed;
5
- bottom: 20px;
6
- z-index: 2000000;
7
- display: flex;
8
- justify-content: center;
9
- align-items: center;
10
- background-color: #3e557e;
11
- width: 45px;
12
- height: 45px;
13
- border-radius: 50%;
14
- cursor: pointer;
15
- text-align: center;
16
- font-size: 24px;
17
- }
18
-
19
- .button__left {
20
- left: 20px;
21
- }
22
-
23
- .button__right {
24
- right: 20px;
25
- }
26
-
27
- .reward {
28
- position: absolute;
29
- top: -4px;
30
- right: 27px;
31
- padding: 2px 3px;
32
- border-radius: 5px;
33
- background: #ff3f3f;
34
- font-size: 9px;
35
- color: #fff;
36
- font-weight: 600;
37
- white-space: nowrap;
38
- line-height: 9px;
39
- }
40
- `,g?.components?.buttonWallet?.css)}),l(`button`,{type:`button`,"aria-label":`Open wallet`,part:`button`,disabled:!x,class:T,onClick:()=>{e(window.FrakSetup.client,`wallet_button_clicked`),t(_,r)},children:[l(f,{}),S&&l(`span`,{class:`reward`,children:S})]})]})}r(p,`frak-button-wallet`,[`placement`,`classname`,`useReward`,`targetInteraction`],{shadow:!0});export{p as ButtonWallet};
@@ -1 +0,0 @@
1
- import{S as e,g as t,y as n}from"./loader.js";import{d as r,n as i,o as a,s as o,t as s}from"./jsxRuntime.module.5UNmmhNi.js";import{t as c}from"./useLightDomStyles.D895e4W1.js";function l(){return typeof navigator>`u`?!1:!!(/iPhone|iPad|iPod|Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}function u(){return{isMobile:o(()=>l(),[])}}function d(r=`wallet`){let i=window.FrakSetup?.client;i&&e(i,`open_in_app_clicked`),t(`${n}${r}`,{onFallback:()=>{i&&e(i,`app_not_installed`)}})}function f({placement:e,text:t=`Open in App`,classname:n=``}){let r=i(e),{shouldRender:o,isHidden:l,isClientReady:f}=a(),{isMobile:p}=u();c(`frak-open-in-app`,e,r?.components?.openInApp?.css);let m=r?.components?.openInApp?.text??t;if(!p||!o||l)return null;let h=()=>{d()},g=[`button`,`button__fadeIn`,n].filter(Boolean).join(` `);return s(`button`,{type:`button`,"aria-label":`Open in Frak Wallet app`,disabled:!f,class:g,onClick:h,children:m})}r(f,`frak-open-in-app`,[`text`,`placement`,`classname`],{shadow:!1});export{f as OpenInAppButton};
@@ -1 +0,0 @@
1
- import{C as e,c as t,l as n,s as r,w as i}from"./loader.js";import{c as a,d as o,n as s,o as c,s as l,t as u,u as d}from"./jsxRuntime.module.5UNmmhNi.js";import{t as f}from"./useLightDomStyles.D895e4W1.js";import{t as p}from"./formatReward.C8hlSKRj.js";import{t as m}from"./useShareModal.CN9_P7Sl.js";function h(e,t){let n=t.rewards.find(e=>e.interactionTypeKey===`purchase`&&(e.referrer||e.referee));if(!n)return null;let r=e?.isReferred&&n.referee?`referee`:`referrer`;return{variant:r,reward:r===`referee`?n.referee:n.referrer,merchantDomain:t.onChainMetadata.domain}}function g({customerId:o,orderId:g,token:_,sharingUrl:v,merchantId:y,placement:b,classname:x=``,variant:S,referrerText:C,refereeText:w,ctaText:T}){let{shouldRender:E,isHidden:D,isClientReady:O}=c(),k=s(b);f(`frak-post-purchase`,b,k?.components?.postPurchase?.css);let[A,j]=a(null),[M,N]=a(!1);d(()=>{!O||!o||!g||!_||r({customerId:o,orderId:g,token:_,merchantId:y}).catch(()=>{})},[O,o,g,_,y]),d(()=>{if(!O||M)return;let r=window.FrakSetup?.client;r&&(N(!0),Promise.all([t(r),n(r)]).then(([e,t])=>{j(h(e,t))}).catch(t=>{t instanceof i&&t.code===e.configError||console.warn(`[Frak] Post-purchase context error`,t)}))},[O,M]);let P=S??A?.variant,F=v??A?.merchantDomain,I=l(()=>{if(!A?.reward)return;let e=window.FrakSetup?.client?.config?.metadata?.currency;return p(A.reward,e)},[A?.reward]),L=k?.components?.postPurchase,R=l(()=>{let e=e=>I?e.replace(`{REWARD}`,I):e;return{message:P===`referee`?I?e(w??L?.refereeText??`You just earned {REWARD}! Share with friends to earn even more.`):w??L?.refereeNoRewardText??`You just earned a reward! Share with friends to earn even more.`:I?e(C??L?.referrerText??`Earn {REWARD} by sharing this with your friends!`):C??L?.referrerNoRewardText??`Share this with your friends and earn rewards!`,cta:I?e(T??L?.ctaText??`Share & earn {REWARD}`):T??L?.ctaNoRewardText??`Share & earn`}},[P,I,L,C,w,T]),{handleShare:z}=m(void 0,b,F);return!E||D||!A||!P?null:u(`div`,{class:[`post-purchase`,x].filter(Boolean).join(` `),children:[u(`div`,{class:`post-purchase__content`,children:u(`p`,{class:`post-purchase__message`,children:R.message})}),u(`button`,{type:`button`,class:`post-purchase__cta button`,disabled:!O,onClick:z,children:R.cta})]})}o(g,`frak-post-purchase`,[`customerId`,`orderId`,`token`,`sharingUrl`,`merchantId`,`placement`,`classname`,`variant`,`referrerText`,`refereeText`,`ctaText`],{shadow:!1});export{g as PostPurchase};
@@ -1 +0,0 @@
1
- import{_ as e,b as t,h as n}from"./loader.js";function r(r,i,a){let o=e(i),s=t(o);switch(r.payoutType){case`fixed`:return n(Math.round(r.amount[s]),o);case`percentage`:return a===void 0?`${r.percent} %`:n(Math.round(r.percent*a/100),o);case`tiered`:{let e=r.tiers.reduce((e,t)=>Math.max(e,t.amount[s]),0);return n(Math.round(e),o)}}}export{r as t};
@@ -1,138 +0,0 @@
1
- import{i as e,n as t,r as n,x as r}from"./loader.js";var i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function y(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(e,t,n){var r,a,o,s={};for(o in t)o==`key`?r=t[o]:o==`ref`?a=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?i.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return S(e,s,r,a,null)}function S(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++o,__i:-1,__u:0};return i==null&&a.vnode!=null&&a.vnode(s),s}function C(e){return e.children}function w(e,t){this.props=e,this.context=t}function T(e,t){if(t==null)return e.__?T(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?T(e):null}function E(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=y({},t);o.__v=t.__v+1,a.vnode&&a.vnode(o),P(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??T(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,re(r,o,i),t.__e=t.__=null,o.__e!=n&&D(o)}}function D(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),D(e)}function O(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!k.__r++||c!=a.debounceRendering)&&((c=a.debounceRendering)||l)(k)}function k(){try{for(var e,t=1;s.length;)s.length>t&&s.sort(u),e=s.shift(),t=s.length,E(e)}finally{s.length=k.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y,b=r&&r.__k||g,x=t.length;for(c=A(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||h,p.__i=d,v=P(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&I(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_==null&&m!=null&&(_=m),(y=!!(4&p.__u))||f.__k===p.__k?c=j(p,c,e,y):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function A(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=S(null,o,null,null,null):v(o)?o=e.__k[a]=S(C,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=S(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=M(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=T(s)),oe(s,s));return r}function j(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=j(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=T(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function te(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||_.test(t)?n:n+`px`}function N(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||te(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||te(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(d,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n.u=r.u:(n.u=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ne(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=f++;else if(t.t<n.u)return;return n(a.event?a.event(t):t)}}}function P(e,t,n,r,i,o,s,c,l,u){var d,f,p,m,h,_,x,S,T,E,D,O,k,A,j,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[c=t.__e=n.__e]),(d=a.__b)&&d(t);n:if(typeof M==`function`)try{if(S=t.props,T=M.prototype&&M.prototype.render,E=(d=M.contextType)&&r[d.__c],D=d?E?E.props.value:d.__:r,n.__c?x=(f=t.__c=n.__c).__=f.__E:(T?t.__c=f=new M(S,D):(t.__c=f=new w(S,D),f.constructor=M,f.render=se),E&&E.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),T&&f.__s==null&&(f.__s=f.state),T&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=y({},f.__s)),y(f.__s,M.getDerivedStateFromProps(S,f.__s))),m=f.props,h=f.state,f.__v=t,p)T&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),T&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(T&&M.getDerivedStateFromProps==null&&S!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(S,D),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(S,f.__s,D)){t.__v!=n.__v&&(f.props=S,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(S,f.__s,D),T&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,_)})}if(f.context=D,f.props=S,f.__P=e,f.__e=!1,O=a.__r,k=0,T)f.state=f.__s,f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),g.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(r=y(y({},r),f.getChildContext())),T&&!p&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(m,h)),A=d!=null&&d.type===C&&d.key==null?ie(d.props.children):d,c=ee(e,v(A)?A:[A],t,n,r,i,o,s,c,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&s.push(f),x&&(f.__E=f.__=null)}catch(e){if(t.__v=null,l||o!=null)if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,t.__e=c}else{for(j=o.length;j--;)b(o[j]);F(t)}else t.__e=n.__e,t.__k=n.__k,e.then||F(t);a.__e(e,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ae(n.__e,t,n,r,i,o,s,l,u);return(d=a.diffed)&&d(t),128&t.__u?void 0:c}function F(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(F))}function re(e,t,n){for(var r=0;r<n.length;r++)I(n[r],n[++r],n[++r]);a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function ie(e){return typeof e!=`object`||!e||e.__b>0?e:v(e)?e.map(ie):y({},e)}function ae(e,t,n,r,o,s,c,l,u){var d,f,p,m,g,_,y,x=n.props||h,S=t.props,C=t.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){e=g,s[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(S);e=document.createElementNS(o,C,S.is&&S),l&&=(a.__m&&a.__m(t,s),!1),s=null}if(C==null)x===S||l&&e.data==S||(e.data=S);else{if(s&&=i.call(e.childNodes),!l&&s!=null)for(x={},d=0;d<e.attributes.length;d++)x[(g=e.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||N(e,d,null,g,o);for(d in S)g=S[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?_=g:d==`checked`?y=g:l&&typeof g!=`function`||x[d]===g||N(e,d,g,x[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),ee(t.type==`template`?e.content:e,v(m)?m:[m],t,n,r,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:n.__k&&T(n,0),l,u),s!=null)for(d=s.length;d--;)b(s[d]);l||(d=`value`,C==`progress`&&_==null?e.removeAttribute(`value`):_!=null&&(_!==e[d]||C==`progress`&&!_||C==`option`&&_!=x[d])&&N(e,d,_,x[d],o),d=`checked`,y!=null&&y!=e[d]&&N(e,d,y,x[d],o))}return e}function I(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){a.__e(e,n)}}function oe(e,t,n){var r,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||I(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&oe(r[i],t,n||typeof e.type!=`function`);n||b(e.__e),e.__c=e.__=e.__e=void 0}function se(e,t,n){return this.constructor(e,n)}function L(e,t,n){var r,o,s,c;t==document&&(t=document.documentElement),a.__&&a.__(e,t),o=(r=typeof n==`function`)?null:n&&n.__k||t.__k,s=[],c=[],P(t,e=(!r&&n||t).__k=x(C,null,[e]),o||h,h,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?i.call(t.childNodes):null,s,!r&&n?n:o?o.__e:t.firstChild,r,c),re(s,e,c)}function ce(e,t){L(e,t,ce)}function le(e,t,n){var r,a,o,s,c=y({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)o==`key`?r=t[o]:o==`ref`?a=t[o]:c[o]=t[o]===void 0&&s!=null?s[o]:t[o];return arguments.length>2&&(c.children=arguments.length>3?i.call(arguments,2):n),S(e.type,c,r||e.key,a||e.ref,null)}i=g.slice,a={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},o=0,w.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=y({},this.state);typeof e==`function`&&(e=e(y({},n),this.props)),e&&y(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),O(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),O(this))},w.prototype.render=C,s=[],l=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},k.__r=0,d=/(PointerCapture)$|Capture$/i,f=0,p=ne(!1),m=ne(!0);function R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},R.apply(this,arguments)}function ue(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var de=[`context`,`children`],fe=[`useFragment`];function pe(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){he.call(this,r)},i.prototype.attributeChangedCallback=ge,i.prototype.disconnectedCallback=_e,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function me(e){this.getChildContext=function(){return e.context};var t=e.children;return le(t,ue(e,de))}function he(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=x(me,R({},this._props,{context:t.detail.context}),ve(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?ce:L)(this._vdom,this._root)}function z(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function ge(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[z(e)]=n,this._vdom=le(this._vdom,r),L(this._vdom,this._root)}}function _e(){L(this._vdom=null,this._root)}function B(e,t){var n=this,r=e.useFragment,i=ue(e,fe);return x(r?C:`slot`,R({},i,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,n._listener))):n.ref.removeEventListener(`_preact`,n._listener)}}))}function ve(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[z(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=ve(s[a],null,n),l=s[a].slot;l?i[l]=x(B,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?x(B,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),x(t||e.nodeName.toLowerCase(),i,d)}function ye(e,r,i=[],a={shadow:!0}){typeof window<`u`&&(t(n),customElements.get(r)||pe(e,r,i,a))}var V,H,U,be,W=0,xe=[],G=a,Se=G.__b,Ce=G.__r,we=G.diffed,Te=G.__c,Ee=G.unmount,De=G.__;function K(e,t){G.__h&&G.__h(H,e,W||t),W=0;var n=H.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function q(e){return W=1,Oe(Q,e)}function Oe(e,t,n){var r=K(V++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Q(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=H,!H.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};H.__f=!0;var a=H.shouldComponentUpdate,o=H.componentWillUpdate;H.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},H.shouldComponentUpdate=i}return r.__N||r.__}function J(e,t){var n=K(V++,3);!G.__s&&Ne(n.__H,t)&&(n.__=e,n.u=t,H.__H.__h.push(n))}function Y(e,t){var n=K(V++,7);return Ne(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ke(e,t){return W=8,Y(function(){return e},t)}function Ae(){for(var e;e=xe.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(X),t.__h.some(Z),t.__h=[]}catch(n){t.__h=[],G.__e(n,e.__v)}}}G.__b=function(e){H=null,Se&&Se(e)},G.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),De&&De(e,t)},G.__r=function(e){Ce&&Ce(e),V=0;var t=(H=e.__c).__H;t&&(U===H?(t.__h=[],H.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(X),t.__h.some(Z),t.__h=[],V=0)),U=H},G.diffed=function(e){we&&we(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(xe.push(t)!==1&&be===G.requestAnimationFrame||((be=G.requestAnimationFrame)||Me)(Ae)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),U=H=null},G.__c=function(e,t){t.some(function(e){try{e.__h.some(X),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],G.__e(n,e.__v)}}),Te&&Te(e,t)},G.unmount=function(e){Ee&&Ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{X(e)}catch(e){t=e}}),n.__H=void 0,t&&G.__e(t,n.__v))};var je=typeof requestAnimationFrame==`function`;function Me(e){var t,n=function(){clearTimeout(r),je&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);je&&(t=requestAnimationFrame(n))}function X(e){var t=H,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),H=t}function Z(e){var t=H;e.__c=e.__(),H=t}function Ne(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Q(e,t){return typeof t==`function`?t(e):t}function Pe(){let[t,n]=q(()=>window.FrakSetup?.config?.waitForBackendConfig===!1?!0:r.isResolved),[i,a]=q(()=>r.getConfig().hidden??!1),[o,s]=q(()=>!!window.FrakSetup?.client);return J(()=>{let t=r.getConfig();t.isResolved&&(n(!0),a(t.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&n(!0),a(t.hidden??!1)};window.addEventListener(`frak:config`,i);let o=()=>s(!0);return e(`add`,o),()=>{window.removeEventListener(`frak:config`,i),e(`remove`,o)}},[]),{shouldRender:t,isHidden:i,isClientReady:o}}const $=`
2
- :host {
3
- display: contents;
4
- }
5
-
6
- :host([hidden]) {
7
- display: none;
8
- }
9
-
10
- .button:disabled {
11
- opacity: 0.7;
12
- cursor: default;
13
- }
14
-
15
- .button__fadeIn {
16
- animation: frak-fadeIn 300ms ease-in;
17
- }
18
-
19
- @keyframes frak-fadeIn {
20
- from {
21
- opacity: 0;
22
- }
23
-
24
- to {
25
- opacity: 1;
26
- }
27
- }
28
- `;function Fe(e,t){return t?`${$}\n${e}\n${t}`:`${$}\n${e}`}const Ie=`
29
- :where(frak-button-share, frak-open-in-app) {
30
- display: contents;
31
- }
32
-
33
- :where(frak-button-share .button, frak-open-in-app .button) {
34
- display: flex;
35
- align-items: center;
36
- justify-content: center;
37
- gap: 10px;
38
- }
39
-
40
- :where(frak-button-share .button:disabled, frak-open-in-app .button:disabled) {
41
- opacity: 0.7;
42
- cursor: default;
43
- }
44
-
45
- :where(frak-button-share .button__fadeIn, frak-open-in-app .button__fadeIn) {
46
- animation: frak-fadeIn 300ms ease-in;
47
- }
48
-
49
- @keyframes frak-fadeIn {
50
- from {
51
- opacity: 0;
52
- }
53
-
54
- to {
55
- opacity: 1;
56
- }
57
- }
58
- `,Le=`
59
- :where(frak-banner) {
60
- display: block;
61
- }
62
-
63
- :where(frak-banner .banner) {
64
- display: flex;
65
- align-items: center;
66
- gap: 12px;
67
- padding: 12px 16px;
68
- border-top: 2px solid #3b82f6;
69
- border-bottom: 2px solid #3b82f6;
70
- font-family: inherit;
71
- line-height: 1.4;
72
- }
73
-
74
- :where(frak-banner .banner__fadeIn) {
75
- animation: frak-fadeIn 300ms ease-in;
76
- }
77
-
78
- @keyframes frak-fadeIn {
79
- from {
80
- opacity: 0;
81
- }
82
-
83
- to {
84
- opacity: 1;
85
- }
86
- }
87
-
88
- :where(frak-banner .banner__icon) {
89
- flex-shrink: 0;
90
- display: flex;
91
- align-items: center;
92
- justify-content: center;
93
- width: 32px;
94
- height: 32px;
95
- color: #3b82f6;
96
- }
97
-
98
- :where(frak-banner .banner__icon svg) {
99
- width: 100%;
100
- height: 100%;
101
- }
102
-
103
- :where(frak-banner .banner__content) {
104
- flex: 1;
105
- min-width: 0;
106
- }
107
-
108
- :where(frak-banner .banner__title) {
109
- font-weight: 700;
110
- font-size: 0.875rem;
111
- margin: 0 0 2px;
112
- }
113
-
114
- :where(frak-banner .banner__description) {
115
- font-size: 0.75rem;
116
- margin: 0;
117
- opacity: 0.7;
118
- }
119
-
120
- :where(frak-banner .banner__cta) {
121
- flex-shrink: 0;
122
- padding: 8px 16px;
123
- font-weight: 700;
124
- font-size: 0.75rem;
125
- text-transform: uppercase;
126
- letter-spacing: 0.05em;
127
- border: 2px solid #eab308;
128
- border-radius: 0;
129
- background: #eab308;
130
- color: #1e293b;
131
- cursor: pointer;
132
- white-space: nowrap;
133
- }
134
-
135
- :where(frak-banner .banner__cta:hover) {
136
- opacity: 0.9;
137
- }
138
- `;function Re(e){return r.getConfig().placements?.[e]}function ze(e){let[t,n]=q(0);return J(()=>{let e=e=>{n(e=>e+1)};return window.addEventListener(`frak:config`,e),n(e=>e+1),()=>window.removeEventListener(`frak:config`,e)},[]),Y(()=>e?Re(e):void 0,[e,t])}var Be=0;Array.isArray;function Ve(e,t,n,r,i,o){t||={};var s,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Be,__i:-1,__u:0,__source:i,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return a.vnode&&a.vnode(u),u}export{Ie as a,q as c,ye as d,C as f,Fe as i,ke as l,ze as n,Pe as o,Le as r,Y as s,Ve as t,J as u};
@@ -1 +0,0 @@
1
- import{t as e}from"./loader.js";import{a as t,u as n}from"./jsxRuntime.module.5UNmmhNi.js";function r(r,i,a,o){n(()=>{e.injectBase(r,o??t)},[r]),n(()=>{!i||!a||e.injectPlacement(r,i,a)},[r,i,a])}export{r as t};
@@ -1 +0,0 @@
1
- import{_ as e,b as t,l as n}from"./loader.js";import{c as r,u as i}from"./jsxRuntime.module.5UNmmhNi.js";import{t as a}from"./formatReward.C8hlSKRj.js";function o(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`tiered`:return e.tiers.reduce((e,n)=>Math.max(e,n.amount[t]),0);case`percentage`:return 0}}function s({rewards:n},r,i){let s=(i?n.filter(e=>e.interactionTypeKey===i):n).map(e=>e.referrer).filter(e=>e!==void 0);if(s.length===0)return;let c=t(e(r)),l=s[0],u=o(l,c);for(let e=1;e<s.length;e++){let t=o(s[e],c);t>u&&(l=s[e],u=t)}if(u<=0){let e=s.find(e=>e.payoutType===`percentage`);if(!e)return;l=e}return a(l,r)}function c(e,t){let[a,o]=r(void 0);return i(()=>{if(!e)return;let r=window.FrakSetup?.client;r&&n(r).then(e=>{let n=r.config.metadata?.currency,i=s(e,n,t);i&&o(i)}).catch(()=>{})},[e,t]),{reward:a}}export{c as t};
@@ -1 +0,0 @@
1
- import{C as e,S as t,u as n,v as r,w as i}from"./loader.js";import{c as a,l as o}from"./jsxRuntime.module.5UNmmhNi.js";function s(s,c,l){let[u,d]=a(void 0),[f,p]=a(!1);return{handleShare:o(async()=>{if(!window.FrakSetup?.client){console.error(`Frak client not found`),d(r.empty().formatDebugInfo(`Frak client not found`)),p(!0);return}let a=n(window.FrakSetup.client,{});try{await a.sharing(l?{link:l}:{}).display(e=>({...e,targetInteraction:s}),c)}catch(n){if(n instanceof i&&n.code===e.clientAborted){console.debug(`User aborted the modal`);return}let r=window.FrakSetup.client.debugInfo.formatDebugInfo(n);t(window.FrakSetup.client,`share_modal_error`,{error:n instanceof Object&&`message`in n?n.message:`Unknown error`,debugInfo:r}),d(r),p(!0),console.error(`Error while opening the modal`,n)}},[s,c,l]),isError:f,debugInfo:u}}export{s as t};