@frak-labs/components 0.0.23-beta.ebc9d3a3 → 0.0.23-beta.f3715ed5

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.
@@ -0,0 +1,48 @@
1
+ import { formatAmount, getCurrencyAmountKey } from "@frak-labs/core-sdk";
2
+ import { getMerchantInformation } from "@frak-labs/core-sdk/actions";
3
+ import { useEffect, useState } from "preact/hooks";
4
+
5
+ //#region src/utils/getCurrentReward.ts
6
+ function getFixedFiatAmount(estimated, key) {
7
+ if (!estimated || estimated.payoutType !== "fixed") return 0;
8
+ return estimated.amount[key];
9
+ }
10
+ function getMaxFixedReferrerReward(rewards, key) {
11
+ return rewards.reduce((max, reward) => Math.max(max, getFixedFiatAmount(reward.referrer, key)), 0);
12
+ }
13
+ async function getCurrentReward({ targetInteraction }) {
14
+ const client = window.FrakSetup?.client;
15
+ if (!client) {
16
+ console.warn("Frak client not ready yet");
17
+ return;
18
+ }
19
+ const { rewards } = await getMerchantInformation(client);
20
+ const currencyAmountKey = getCurrencyAmountKey(client.config.metadata?.currency);
21
+ const maxReward = getMaxFixedReferrerReward(targetInteraction ? rewards.filter((r) => r.interactionTypeKey === targetInteraction) : rewards, currencyAmountKey);
22
+ if (maxReward <= 0) return;
23
+ return formatAmount(Math.round(maxReward), client.config.metadata?.currency);
24
+ }
25
+
26
+ //#endregion
27
+ //#region src/hooks/useReward.ts
28
+ /**
29
+ * Hook to fetch and format the current reward value for a given interaction
30
+ * @param shouldUseReward - Flag to determine if reward should be fetched
31
+ * @param targetInteraction - Optional interaction type to get specific reward for
32
+ * @param currency - The currency to use for the reward (default is "eur")
33
+ * @returns Object containing the formatted reward value in euros
34
+ */
35
+ function useReward(shouldUseReward, targetInteraction) {
36
+ const [reward, setReward] = useState(void 0);
37
+ useEffect(() => {
38
+ if (!shouldUseReward) return;
39
+ getCurrentReward({ targetInteraction }).then((reward) => {
40
+ if (!reward) return;
41
+ setReward(reward);
42
+ });
43
+ }, [shouldUseReward, targetInteraction]);
44
+ return { reward };
45
+ }
46
+
47
+ //#endregion
48
+ export { useReward 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.23-beta.ebc9d3a3",
14
+ "version": "0.0.23-beta.f3715ed5",
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",
@@ -40,14 +40,38 @@
40
40
  ],
41
41
  "main": "./cdn/components.js",
42
42
  "browser": "./cdn/components.js",
43
+ "exports": {
44
+ "./buttonWallet": {
45
+ "development": "./src/components/ButtonWallet/index.ts",
46
+ "import": "./dist/buttonWallet.js",
47
+ "types": "./dist/buttonWallet.d.ts"
48
+ },
49
+ "./buttonShare": {
50
+ "development": "./src/components/ButtonShare/index.ts",
51
+ "import": "./dist/buttonShare.js",
52
+ "types": "./dist/buttonShare.d.ts"
53
+ },
54
+ "./openInApp": {
55
+ "development": "./src/components/OpenInAppButton/index.ts",
56
+ "import": "./dist/openInApp.js",
57
+ "types": "./dist/openInApp.d.ts"
58
+ },
59
+ "./cdn": {
60
+ "import": "./cdn/components.js"
61
+ },
62
+ "./dist/*": "./dist/*"
63
+ },
43
64
  "scripts": {
44
65
  "lint": "biome lint .",
45
66
  "format:check": "biome check .",
46
67
  "format": "biome check --write .",
47
68
  "clean": "rimraf cdn dist",
48
- "build": "rslib build",
49
- "build:watch": "rslib build --watch",
69
+ "build": "tsdown",
70
+ "build:watch": "tsdown --watch",
50
71
  "typecheck": "tsc --noEmit",
72
+ "test": "vitest",
73
+ "test:ui": "vitest --ui",
74
+ "test:coverage": "vitest --coverage",
51
75
  "prepublish": "bun run lint && bun run build",
52
76
  "publish": "echo 'Publishing components...'"
53
77
  },
@@ -55,21 +79,29 @@
55
79
  "@frak-labs/frame-connector": "0.1.0",
56
80
  "@frak-labs/core-sdk": "0.1.0",
57
81
  "class-variance-authority": "^0.7.1",
58
- "preact": "^10.27.2",
59
- "preact-custom-element": "^4.5.1"
82
+ "preact": "^10.28.3",
83
+ "preact-custom-element": "^4.6.0"
60
84
  },
61
85
  "devDependencies": {
62
- "@frak-labs/browserslist-config": "0.0.1",
86
+ "@bosh-code/tsdown-plugin-inject-css": "^2.0.0",
63
87
  "@frak-labs/dev-tooling": "0.0.0",
88
+ "@frak-labs/test-foundation": "0.1.0",
64
89
  "@frak-labs/ui": "0.0.0",
65
- "@rsbuild/plugin-preact": "^1.5.2",
66
- "@rsbuild/plugin-svgr": "^1.2.2",
67
- "@rslib/core": "^0.16.1",
68
- "@types/node": "^24.9.1",
90
+ "@preact/preset-vite": "^2.10.3",
91
+ "@rolldown/plugin-node-polyfills": "^1.0.3",
92
+ "@testing-library/jest-dom": "^6.9.1",
93
+ "@testing-library/preact": "^3.2.4",
94
+ "@testing-library/user-event": "^14.6.1",
95
+ "@types/jsdom": "^27.0.0",
96
+ "@types/node": "^24.10.13",
69
97
  "@types/preact-custom-element": "^4.0.4",
70
- "typescript": "^5"
71
- },
72
- "browserslist": [
73
- "extends @frak-labs/browserslist-config"
74
- ]
98
+ "@vitest/coverage-v8": "^4.0.18",
99
+ "@vitest/ui": "^4.0.18",
100
+ "jsdom": "^28.0.0",
101
+ "tsdown": "^0.20.3",
102
+ "typescript": "^5",
103
+ "unplugin-lightningcss": "^0.4.5",
104
+ "vite-tsconfig-paths": "^6.1.0",
105
+ "vitest": "^4.0.18"
106
+ }
75
107
  }
@@ -1 +0,0 @@
1
- export const __webpack_id__="767";export const __webpack_ids__=["767"];export const __webpack_modules__={"../../node_modules/.bun/preact-custom-element@4.5.1+e9f4a629fd396517/node_modules/preact-custom-element/dist/preact-custom-element.esm.js":function(e,t,n){n.d(t,{A:()=>i});var _=n("../../node_modules/.bun/preact@10.27.2/node_modules/preact/dist/preact.module.js");function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var _ in n)Object.prototype.hasOwnProperty.call(n,_)&&(e[_]=n[_])}return e}).apply(this,arguments)}function r(e,t){if(null==e)return{};var n,_,o={},r=Object.keys(e);for(_=0;_<r.length;_++)t.indexOf(n=r[_])>=0||(o[n]=e[n]);return o}var u=["context","children"],l=["useFragment"];function i(e,t,n,_){function o(){var t=Reflect.construct(HTMLElement,[],o);return t._vdomComponent=e,t._root=_&&_.shadow?t.attachShadow({mode:_.mode||"open"}):t,_&&_.adoptedStyleSheets&&(t._root.adoptedStyleSheets=_.adoptedStyleSheets),t}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=function(){s.call(this,_)},o.prototype.attributeChangedCallback=a,o.prototype.disconnectedCallback=p,o.observedAttributes=n=n||e.observedAttributes||Object.keys(e.propTypes||{}),e.formAssociated&&(o.formAssociated=!0),n.forEach(function(e){Object.defineProperty(o.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={}),this._props[e]=t);var n=typeof t;null!=t&&"string"!==n&&"boolean"!==n&&"number"!==n||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o),o}function c(e){this.getChildContext=function(){return e.context};var t=e.children,n=r(e,u);return(0,_.Ob)(t,n)}function s(e){var t=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=(0,_.h)(c,o({},this._props,{context:t.detail.context}),function e(t,n,o){if(3===t.nodeType)return t.data;if(1!==t.nodeType)return null;var r=[],u={},l=0,i=t.attributes,c=t.childNodes;for(l=i.length;l--;)"slot"!==i[l].name&&(u[i[l].name]=i[l].value,u[f(i[l].name)]=i[l].value);for(l=c.length;l--;){var s=e(c[l],null,o),a=c[l].slot;a?u[a]=(0,_.h)(d,{name:a},s):r[l]=s}var p=!(!o||!o.shadow),h=n?(0,_.h)(d,{useFragment:!p},r):r;return!p&&n&&(t.innerHTML=""),(0,_.h)(n||t.nodeName.toLowerCase(),u,h)}(this,this._vdomComponent,e)),(this.hasAttribute("hydrate")?_.Qv:_.XX)(this._vdom,this._root)}function f(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():""})}function a(e,t,n){if(this._vdom){var o={};o[e]=n=null==n?void 0:n,o[f(e)]=n,this._vdom=(0,_.Ob)(this._vdom,o),(0,_.XX)(this._vdom,this._root)}}function p(){(0,_.XX)(this._vdom=null,this._root)}function d(e,t){var n=this,u=e.useFragment,i=r(e,l);return(0,_.h)(u?_.FK:"slot",o({},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)}}))}},"../../node_modules/.bun/preact@10.27.2/node_modules/preact/dist/preact.module.js":function(e,t,n){n.d(t,{FK:()=>w,Ob:()=>D,Qv:()=>O,XX:()=>M,fF:()=>o,h:()=>g,n:()=>g,uA:()=>x,v2:()=>function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(m(t)?t.some(function(t){e(t,n)}):n.push(t)),n}});var _,o,r,u,l,i,c,s,f,a,p,d={},h=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,m=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 g(e,t,n){var o,r,u,l={};for(u in t)"key"==u?o=t[u]:"ref"==u?r=t[u]:l[u]=t[u];if(arguments.length>2&&(l.children=arguments.length>3?_.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(u in e.defaultProps)void 0===l[u]&&(l[u]=e.defaultProps[u]);return k(e,l,o,r,null)}function k(e,t,n,_,u){var l={type:e,props:t,key:n,ref:_,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==u?++r:u,__i:-1,__u:0};return null==u&&null!=o.vnode&&o.vnode(l),l}function w(e){return e.children}function x(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?C(e):null}function H(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!S.__r++||l!=o.debounceRendering)&&((l=o.debounceRendering)||i)(S)}function S(){for(var e,t,n,_,r,l,i=1;u.length;)u.length>i&&u.sort(c),e=u.shift(),i=u.length,e.__d&&(t=void 0,n=void 0,_=(n=e.__v).__e,r=[],l=[],e.__P&&((t=y({},n)).__v=n.__v+1,o.vnode&&o.vnode(t),A(e.__P,t,n,e.__n,e.__P.namespaceURI,32&n.__u?[_]:null,r,null==_?C(n):_,!!(32&n.__u),l),t.__v=n.__v,t.__.__k[t.__i]=t,j(r,t,l),n.__e=n.__=null,t.__e!=_&&function e(t){var n,_;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,n=0;n<t.__k.length;n++)if(null!=(_=t.__k[n])&&null!=_.__e){t.__e=t.__c.base=_.__e;break}return e(t)}}(t)));S.__r=0}function E(e,t,n,_,r,u,l,i,c,s,f){var a,p,v,y,g,x,H,S=_&&_.__k||h,E=t.length;for(c=function(e,t,n,_,r){var u,l,i,c,s,f=n.length,a=f,p=0;for(e.__k=Array(r),u=0;u<r;u++)null!=(l=t[u])&&"boolean"!=typeof l&&"function"!=typeof l?(c=u+p,(l=e.__k[u]="string"==typeof l||"number"==typeof l||"bigint"==typeof l||l.constructor==String?k(null,l,null,null,null):m(l)?k(w,{children:l},null,null,null):null==l.constructor&&l.__b>0?k(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):l).__=e,l.__b=e.__b+1,i=null,-1!=(s=l.__i=function(e,t,n,_){var o,r,u,l=e.key,i=e.type,c=t[n],s=null!=c&&0==(2&c.__u);if(null===c&&null==e.key||s&&l==c.key&&i==c.type)return n;if(_>+!!s){for(o=n-1,r=n+1;o>=0||r<t.length;)if(null!=(c=t[u=o>=0?o--:r++])&&0==(2&c.__u)&&l==c.key&&i==c.type)return u}return -1}(l,n,c,a))&&(a--,(i=n[s])&&(i.__u|=2)),null==i||null==i.__v?(-1==s&&(r>f?p--:r<f&&p++),"function"!=typeof l.type&&(l.__u|=4)):s!=c&&(s==c-1?p--:s==c+1?p++:(s>c?p--:p++,l.__u|=4))):e.__k[u]=null;if(a)for(u=0;u<f;u++)null!=(i=n[u])&&0==(2&i.__u)&&(i.__e==_&&(_=C(i)),function e(t,n,_){var r,u;if(o.unmount&&o.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||U(r,null,n)),null!=(r=t.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){o.__e(e,n)}r.base=r.__P=null}if(r=t.__k)for(u=0;u<r.length;u++)r[u]&&e(r[u],n,_||"function"!=typeof t.type);_||b(t.__e),t.__c=t.__=t.__e=void 0}(i,i));return _}(n,t,S,c,E),a=0;a<E;a++)null!=(v=n.__k[a])&&(p=-1==v.__i?d:S[v.__i]||d,v.__i=a,x=A(e,v,p,r,u,l,i,c,s,f),y=v.__e,v.ref&&p.ref!=v.ref&&(p.ref&&U(p.ref,null,v),f.push(v.ref,v.__c||y,v)),null==g&&null!=y&&(g=y),(H=!!(4&v.__u))||p.__k===v.__k?c=function e(t,n,_,o){var r,u;if("function"==typeof t.type){for(r=t.__k,u=0;r&&u<r.length;u++)r[u]&&(r[u].__=t,n=e(r[u],n,_,o));return n}t.__e!=n&&(o&&(n&&t.type&&!n.parentNode&&(n=C(t)),_.insertBefore(t.__e,n||null)),n=t.__e);do n=n&&n.nextSibling;while(null!=n&&8==n.nodeType);return n}(v,c,e,H):"function"==typeof v.type&&void 0!==x?c=x:y&&(c=y.nextSibling),v.__u&=-7);return n.__e=g,c}function P(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.test(t)?n:n+"px"}function F(e,t,n,_,o){var r,u;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof _&&(e.style.cssText=_=""),_)for(t in _)n&&t in n||P(e.style,t,"");if(n)for(t in n)_&&n[t]==_[t]||P(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(s,"$1")),t=(u=t.toLowerCase())in e||"onFocusOut"==t||"onFocusIn"==t?u.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?_?n.u=_.u:(n.u=f,e.addEventListener(t,r?p:a,r)):e.removeEventListener(t,r?p:a,r);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function N(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=f++;else if(t.t<n.u)return;return n(o.event?o.event(t):t)}}}function A(e,t,n,r,u,l,i,c,s,f){var a,p,h,v,g,k,H,S,P,N,A,j,U,M,O,D,W,R=t.type;if(null!=t.constructor)return null;128&n.__u&&(s=!!(32&n.__u),l=[c=t.__e=n.__e]),(a=o.__b)&&a(t);e:if("function"==typeof R)try{if(S=t.props,P="prototype"in R&&R.prototype.render,N=(a=R.contextType)&&r[a.__c],A=a?N?N.props.value:a.__:r,n.__c?H=(p=t.__c=n.__c).__=p.__E:(P?t.__c=p=new R(S,A):(t.__c=p=new x(S,A),p.constructor=R,p.render=L),N&&N.sub(p),p.props=S,p.state||(p.state={}),p.context=A,p.__n=r,h=p.__d=!0,p.__h=[],p._sb=[]),P&&null==p.__s&&(p.__s=p.state),P&&null!=R.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=y({},p.__s)),y(p.__s,R.getDerivedStateFromProps(S,p.__s))),v=p.props,g=p.state,p.__v=t,h)P&&null==R.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),P&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(P&&null==R.getDerivedStateFromProps&&S!==v&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(S,A),!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(S,p.__s,A)||t.__v==n.__v){for(t.__v!=n.__v&&(p.props=S,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),j=0;j<p._sb.length;j++)p.__h.push(p._sb[j]);p._sb=[],p.__h.length&&i.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(S,p.__s,A),P&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(v,g,k)})}if(p.context=A,p.props=S,p.__P=e,p.__e=!1,U=o.__r,M=0,P){for(p.state=p.__s,p.__d=!1,U&&U(t),a=p.render(p.props,p.state,p.context),O=0;O<p._sb.length;O++)p.__h.push(p._sb[O]);p._sb=[]}else do p.__d=!1,U&&U(t),a=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++M<25);p.state=p.__s,null!=p.getChildContext&&(r=y(y({},r),p.getChildContext())),P&&!h&&null!=p.getSnapshotBeforeUpdate&&(k=p.getSnapshotBeforeUpdate(v,g)),D=a,null!=a&&a.type===w&&null==a.key&&(D=function e(t){return"object"!=typeof t||null==t||t.__b&&t.__b>0?t:m(t)?t.map(e):y({},t)}(a.props.children)),c=E(e,m(D)?D:[D],t,n,r,u,l,i,c,s,f),p.base=t.__e,t.__u&=-161,p.__h.length&&i.push(p),H&&(p.__E=p.__=null)}catch(e){if(t.__v=null,s||null!=l)if(e.then){for(t.__u|=s?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;l[l.indexOf(c)]=null,t.__e=c}else{for(W=l.length;W--;)b(l[W]);T(t)}else t.__e=n.__e,t.__k=n.__k,e.then||T(t);o.__e(e,t,n)}else null==l&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=function(e,t,n,r,u,l,i,c,s){var f,a,p,h,v,y,g,k=n.props,w=t.props,x=t.type;if("svg"==x?u="http://www.w3.org/2000/svg":"math"==x?u="http://www.w3.org/1998/Math/MathML":u||(u="http://www.w3.org/1999/xhtml"),null!=l){for(f=0;f<l.length;f++)if((v=l[f])&&"setAttribute"in v==!!x&&(x?v.localName==x:3==v.nodeType)){e=v,l[f]=null;break}}if(null==e){if(null==x)return document.createTextNode(w);e=document.createElementNS(u,x,w.is&&w),c&&(o.__m&&o.__m(t,l),c=!1),l=null}if(null==x)k===w||c&&e.data==w||(e.data=w);else{if(l=l&&_.call(e.childNodes),k=n.props||d,!c&&null!=l)for(k={},f=0;f<e.attributes.length;f++)k[(v=e.attributes[f]).name]=v.value;for(f in k)if(v=k[f],"children"==f);else if("dangerouslySetInnerHTML"==f)p=v;else if(!(f in w)){if("value"==f&&"defaultValue"in w||"checked"==f&&"defaultChecked"in w)continue;F(e,f,null,v,u)}for(f in w)v=w[f],"children"==f?h=v:"dangerouslySetInnerHTML"==f?a=v:"value"==f?y=v:"checked"==f?g=v:c&&"function"!=typeof v||k[f]===v||F(e,f,v,k[f],u);if(a)c||p&&(a.__html==p.__html||a.__html==e.innerHTML)||(e.innerHTML=a.__html),t.__k=[];else if(p&&(e.innerHTML=""),E("template"==t.type?e.content:e,m(h)?h:[h],t,n,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":u,l,i,l?l[0]:n.__k&&C(n,0),c,s),null!=l)for(f=l.length;f--;)b(l[f]);c||(f="value","progress"==x&&null==y?e.removeAttribute("value"):null==y||y===e[f]&&("progress"!=x||y)&&("option"!=x||y==k[f])||F(e,f,y,k[f],u),f="checked",null!=g&&g!=e[f]&&F(e,f,g,k[f],u))}return e}(n.__e,t,n,r,u,l,i,s,f);return(a=o.diffed)&&a(t),128&t.__u?void 0:c}function T(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(T)}function j(e,t,n){for(var _=0;_<n.length;_++)U(n[_],n[++_],n[++_]);o.__c&&o.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){o.__e(e,t.__v)}})}function U(e,t,n){try{if("function"==typeof e){var _="function"==typeof e.__u;_&&e.__u(),_&&null==t||(e.__u=e(t))}else e.current=t}catch(e){o.__e(e,n)}}function L(e,t,n){return this.constructor(e,n)}function M(e,t,n){var r,u,l,i;t==document&&(t=document.documentElement),o.__&&o.__(e,t),u=(r="function"==typeof n)?null:n&&n.__k||t.__k,l=[],i=[],A(t,e=(!r&&n||t).__k=g(w,null,[e]),u||d,d,t.namespaceURI,!r&&n?[n]:u?null:t.firstChild?_.call(t.childNodes):null,l,!r&&n?n:u?u.__e:t.firstChild,r,i),j(l,e,i)}function O(e,t){M(e,t,O)}function D(e,t,n){var o,r,u,l,i=y({},e.props);for(u in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)"key"==u?o=t[u]:"ref"==u?r=t[u]:i[u]=void 0===t[u]&&null!=l?l[u]:t[u];return arguments.length>2&&(i.children=arguments.length>3?_.call(arguments,2):n),k(e.type,i,o||e.key,r||e.ref,null)}_=h.slice,o={__e:function(e,t,n,_){for(var o,r,u;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(e)),u=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,_||{}),u=o.__d),u)return o.__E=o}catch(t){e=t}throw e}},r=0,x.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=y({},this.state),"function"==typeof e&&(e=e(y({},n),this.props)),e&&y(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),H(this))},x.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),H(this))},x.prototype.render=w,u=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,c=function(e,t){return e.__v.__b-t.__v.__b},S.__r=0,s=/(PointerCapture)$|Capture$/i,f=0,a=N(!1),p=N(!0)},"../../node_modules/.bun/preact@10.27.2/node_modules/preact/hooks/dist/hooks.module.js":function(e,t,n){n.d(t,{J0:()=>y,Kr:()=>g,hb:()=>k,vJ:()=>b});var _,o,r,u,l=n("../../node_modules/.bun/preact@10.27.2/node_modules/preact/dist/preact.module.js"),i=0,c=[],s=l.fF,f=s.__b,a=s.__r,p=s.diffed,d=s.__c,h=s.unmount,v=s.__;function m(e,t){s.__h&&s.__h(o,e,i||t),i=0;var n=o.__H||(o.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function y(e){return i=1,function(e,t,n){var r=m(_++,2);if(r.t=e,!r.__c&&(r.__=[E(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=o,!o.__f)){var u=function(e,t,n){if(!r.__c.__H)return!0;var _=r.__c.__H.__.filter(function(e){return!!e.__c});if(_.every(function(e){return!e.__N}))return!l||l.call(this,e,t,n);var o=r.__c.props!==e;return _.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),l&&l.call(this,e,t,n)||o};o.__f=!0;var l=o.shouldComponentUpdate,i=o.componentWillUpdate;o.componentWillUpdate=function(e,t,n){if(this.__e){var _=l;l=void 0,u(e,t,n),l=_}i&&i.call(this,e,t,n)},o.shouldComponentUpdate=u}return r.__N||r.__}(E,e)}function b(e,t){var n=m(_++,3);!s.__s&&S(n.__H,t)&&(n.__=e,n.u=t,o.__H.__h.push(n))}function g(e,t){var n=m(_++,7);return S(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function k(e,t){return i=8,g(function(){return e},t)}function w(){for(var e;e=c.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(C),e.__H.__h.forEach(H),e.__H.__h=[]}catch(t){e.__H.__h=[],s.__e(t,e.__v)}}s.__b=function(e){o=null,f&&f(e)},s.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),v&&v(e,t)},s.__r=function(e){a&&a(e),_=0;var t=(o=e.__c).__H;t&&(r===o?(t.__h=[],o.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(C),t.__h.forEach(H),t.__h=[],_=0)),r=o},s.diffed=function(e){p&&p(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==c.push(t)&&u===s.requestAnimationFrame||((u=s.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(_),x&&cancelAnimationFrame(t),setTimeout(e)},_=setTimeout(n,35);x&&(t=requestAnimationFrame(n))})(w)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),r=o=null},s.__c=function(e,t){t.some(function(e){try{e.__h.forEach(C),e.__h=e.__h.filter(function(e){return!e.__||H(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],s.__e(n,e.__v)}}),d&&d(e,t)},s.unmount=function(e){h&&h(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{C(e)}catch(e){t=e}}),n.__H=void 0,t&&s.__e(t,n.__v))};var x="function"==typeof requestAnimationFrame;function C(e){var t=o,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),o=t}function H(e){var t=o;e.__c=e.__(),o=t}function S(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function E(e,t){return"function"==typeof t?t(e):t}},"../../node_modules/.bun/preact@10.27.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js":function(e,t,n){n.d(t,{FD:()=>r,FK:()=>_.FK,Y:()=>r});var _=n("../../node_modules/.bun/preact@10.27.2/node_modules/preact/dist/preact.module.js"),o=0;function r(e,t,n,r,u,l){t||(t={});var i,c,s=t;if("ref"in s)for(c in s={},t)"ref"==c?i=t[c]:s[c]=t[c];var f={type:e,props:s,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--o,__i:-1,__u:0,__source:u,__self:l};if("function"==typeof e&&(i=e.defaultProps))for(c in i)void 0===s[c]&&(s[c]=i[c]);return _.fF.vnode&&_.fF.vnode(f),f}},"../../node_modules/.bun/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs":function(e,t,n){n.d(t,{cx:()=>_});let _=function(){for(var e,t,n=0,_="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=function e(t){var n,_,o="";if("string"==typeof t||"number"==typeof t)o+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(n=0;n<r;n++)t[n]&&(_=e(t[n]))&&(o&&(o+=" "),o+=_)}else for(_ in t)t[_]&&(o&&(o+=" "),o+=_);return o}(e))&&(_&&(_+=" "),_+=t);return _}}};
@@ -1 +0,0 @@
1
- export const __webpack_id__="286";export const __webpack_ids__=["286"];export const __webpack_modules__={"./src/components/ButtonShare/index.ts":function(e,t,o){o.r(t),o.d(t,{ButtonShare:()=>S});var n=o("./src/utils/registerWebComponent.ts"),r=o("../../node_modules/.bun/preact@10.27.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js"),s=o("../core/dist/index.js"),a=o("../core/dist/actions.js"),i=o("../../node_modules/.bun/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs"),l=o("../../node_modules/.bun/preact@10.27.2/node_modules/preact/hooks/dist/hooks.module.js");let d="spinner__leaf-xtOJmT",c=({ref:e,className:t,...o})=>(0,r.FD)("span",{...o,ref:e,className:(0,i.cx)("spinner-KHk8mw"),children:[(0,r.Y)("span",{className:d}),(0,r.Y)("span",{className:d}),(0,r.Y)("span",{className:d}),(0,r.Y)("span",{className:d}),(0,r.Y)("span",{className:d}),(0,r.Y)("span",{className:d}),(0,r.Y)("span",{className:d}),(0,r.Y)("span",{className:d})]});c.displayName="Spinner";var u=o("./src/hooks/useClientReady.ts"),p=o("./src/hooks/useReward.ts");let m={marginTop:"16px",padding:"16px",backgroundColor:"#FEE2E2",border:"1px solid #FCA5A5",borderRadius:"4px",color:"#991B1B"},f={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},h={margin:0,fontSize:"16px",fontWeight:500},b={fontSize:"14px",lineHeight:"1.5",margin:"0 0 12px 0"},y={color:"#991B1B",textDecoration:"underline",textUnderlineOffset:"2px"},w={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 x({debugInfo:e}){let[t,o]=(0,l.J0)(!1);return(0,r.FD)("div",{children:[(0,r.Y)("button",{type:"button",style:w,onClick:()=>o(!t),children:"Ouvrir les informations"}),t&&(0,r.Y)("textarea",{style:{display:"block",width:"100%",height:"200px",fontSize:"12px"},children:e})]})}function g({debugInfo:e}){let{copied:t,copy:o}=function(e={}){let{successDuration:t=2e3}=e,[o,n]=(0,l.J0)(!1);return{copy:(0,l.hb)(async e=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e),n(!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"),n(!0)}catch(e){return console.error("Failed to copy text:",e),!1}finally{t.remove()}}return setTimeout(()=>{n(!1)},t),!0}catch(e){return console.error("Failed to copy text:",e),!1}},[t]),copied:o}}();return(0,r.FD)("div",{style:m,children:[(0,r.Y)("div",{style:f,children:(0,r.Y)("h3",{style:h,children:"Oups ! Nous avons rencontr\xe9 un petit probl\xe8me"})}),(0,r.FD)("p",{style:b,children:["Impossible d'ouvrir le menu de partage pour le moment. Si le probl\xe8me persiste, copiez les informations ci-dessous et collez-les dans votre mail \xe0"," ",(0,r.Y)("a",{href:"mailto:help@frak-labs.com?subject=Debug",style:y,children:"help@frak-labs.com"})," ",(0,r.Y)("br",{}),"Merci pour votre retour, nous traitons votre demande dans les plus brefs d\xe9lais."]}),(0,r.Y)("button",{type:"button",onClick:()=>o(e??""),style:w,children:t?"Informations copi\xe9es !":"Copier les informations de d\xe9bogage"}),(0,r.Y)(x,{debugInfo:e})]})}var k=o("../../packages/rpc/dist/middleware-B51Ll_ty.js"),_=o("./src/utils/setup.ts");async function v(){if(!window.FrakSetup?.client)throw Error("Frak client not found");await (0,a.wS)(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function S({text:e="Share and earn!",classname:t="",useReward:o,noRewardText:n,targetInteraction:a,showWallet:d}){let m=(0,l.Kr)(()=>void 0!==o,[o]),f=(0,l.Kr)(()=>void 0!==d,[d]),{isClientReady:h}=(0,u.g)(),{reward:b}=(0,p.b)(m&&h,a),{handleShare:y,isError:w,debugInfo:x}=function(e){let[t,o]=(0,l.J0)(void 0),[n,r]=(0,l.J0)(!1);return{handleShare:(0,l.hb)(async()=>{if(!window.FrakSetup?.client){console.error("Frak client not found"),o(s.Om.empty().formatDebugInfo("Frak client not found")),r(!0);return}let t=(0,_.et)();if(!t)throw Error("modalBuilderSteps not found");try{await t.sharing(window.FrakSetup?.modalShareConfig??{}).display(t=>({...t,targetInteraction:e}))}catch(t){if(t instanceof k.c&&t.code===k.d.clientAborted)return void console.debug("User aborted the modal");let e=window.FrakSetup.client.debugInfo.formatDebugInfo(t);(0,s.sx)(window.FrakSetup.client,"share_modal_error",{error:t instanceof Object&&"message"in t?t.message:"Unknown error",debugInfo:e}),o(e),r(!0),console.error("Error while opening the modal",t)}},[e]),isError:n,debugInfo:t}}(a),S=(0,l.Kr)(()=>m?b?e.includes("{REWARD}")?e.replace("{REWARD}",b):`${e} ${b}`:n??e.replace("{REWARD}",""):e,[m,e,n,b]),F=(0,l.hb)(async()=>{(0,s.sx)(window.FrakSetup.client,"share_button_clicked"),f?await v():await y()},[f,y]);return(0,r.FD)(r.FK,{children:[(0,r.FD)("button",{type:"button",className:(0,i.cx)("buttonShare-F23Y9m",t,"override"),onClick:F,children:[!h&&(0,r.Y)(c,{})," ",S]}),w&&(0,r.Y)(g,{debugInfo:x})]})}(0,n.$)(S,"frak-button-share",["text"],{shadow:!1})},"./src/hooks/useClientReady.ts":function(e,t,o){o.d(t,{g:()=>s});var n=o("../../node_modules/.bun/preact@10.27.2/node_modules/preact/hooks/dist/hooks.module.js"),r=o("./src/utils/clientReady.ts");function s(){let[e,t]=(0,n.J0)(!0),o=(0,n.hb)(()=>{t(!1)},[]);return(0,n.vJ)(()=>((0,r.S)("add",o),()=>(0,r.S)("remove",o)),[o]),{isClientReady:!e}}},"./src/hooks/useReward.ts":function(e,t,o){o.d(t,{b:()=>i});var n=o("../../node_modules/.bun/preact@10.27.2/node_modules/preact/hooks/dist/hooks.module.js"),r=o("../core/dist/index.js"),s=o("../core/dist/actions.js");async function a({targetInteraction:e}){let t=window.FrakSetup?.client;if(!t)return void console.warn("Frak client not ready yet");let{maxReferrer:o,rewards:n}=await (0,s.k9)(t);if(!o)return;let a=(0,r.hr)(t.config.metadata?.currency),i=Math.round(o[a]);if(e){let t=n.filter(t=>t.interactionTypeKey===e).map(e=>e.referrer[a]).reduce((e,t)=>t>e?t:e,0);t>0&&(i=Math.round(t))}return(0,r.ej)(i,t.config.metadata?.currency)}function i(e,t){let[o,r]=(0,n.J0)(void 0);return(0,n.vJ)(()=>{e&&a({targetInteraction:t}).then(e=>{e&&r(e)})},[e,t]),{reward:o}}},"./src/utils/registerWebComponent.ts":function(e,t,o){o.d(t,{$:()=>a});var n=o("../../packages/ui/utils/onDocumentReady.ts"),r=o("../../node_modules/.bun/preact-custom-element@4.5.1+e9f4a629fd396517/node_modules/preact-custom-element/dist/preact-custom-element.esm.js"),s=o("./src/utils/initFrakSdk.ts");function a(e,t,o=[],i={shadow:!1}){"undefined"!=typeof window&&((0,n.q)(s.$),customElements.get(t)||(0,r.A)(e,t,o,i))}}};
@@ -1 +0,0 @@
1
- export const __webpack_id__="72";export const __webpack_ids__=["72"];export const __webpack_modules__={"./src/components/ButtonWallet/index.ts":function(e,t,n){n.r(t),n.d(t,{ButtonWallet:()=>U});var o=n("./src/utils/registerWebComponent.ts"),r=n("../../node_modules/.bun/preact@10.27.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js"),i=n("../core/dist/index.js"),l=n("../../node_modules/.bun/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs"),a=n("../../node_modules/.bun/preact@10.27.2/node_modules/preact/hooks/dist/hooks.module.js"),u=n("./src/hooks/useClientReady.ts"),_=n("./src/hooks/useReward.ts"),s=n("../../node_modules/.bun/preact@10.27.2/node_modules/preact/dist/preact.module.js");function c(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function d(e,t){this.props=e,this.context=t}(d.prototype=new s.uA).isPureReactComponent=!0,d.prototype.shouldComponentUpdate=function(e,t){return c(this.props,e)||c(this.state,t)};var f=s.fF.__b;s.fF.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),f&&f(e)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var p=s.fF.__e;s.fF.__e=function(e,t,n,o){if(e.then){for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t)}p(e,t,n,o)};var v=s.fF.unmount;function m(){this.__u=0,this.o=null,this.__b=null}function h(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function b(){this.i=null,this.l=null}s.fF.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),v&&v(e)},(m.prototype=new s.uA).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=h(o.__v),i=!1,l=function(){i||(i=!0,n.__R=null,r?r(a):a())};n.__R=l;var a=function(){if(!--o.__u){if(o.state.__a){var e,t=o.state.__a;o.__v.__k[0]=function e(t,n,o){return t&&o&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(t){return e(t,n,o)}),t.__c&&t.__c.__P===n&&(t.__e&&o.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=o)),t}(t,t.__c.__P,t.__c.__O)}for(o.setState({__a:o.__b=null});e=o.o.pop();)e.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(l,l)},m.prototype.componentWillUnmount=function(){this.o=[]},m.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=function e(t,n,o){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),t.__c.__H=null),null!=(t=function(e,t){for(var n in t)e[n]=t[n];return e}({},t)).__c&&(t.__c.__P===o&&(t.__c.__P=n),t.__c.__e=!0,t.__c=null),t.__k=t.__k&&t.__k.map(function(t){return e(t,n,o)})),t}(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&(0,s.n)(s.FK,null,e.fallback);return r&&(r.__u&=-33),[(0,s.n)(s.FK,null,t.__a?null:e.children),r]};var y=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(b.prototype=new s.uA).__a=function(e){var t=this,n=h(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),y(t,e,o)):r()};n?n(i):i()}},b.prototype.render=function(e){this.i=null,this.l=new Map;var t=(0,s.v2)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},b.prototype.componentDidUpdate=b.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){y(e,n,t)})};var k="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,w=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,g=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,F=/[A-Z0-9]/g,x="undefined"!=typeof document;s.uA.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(s.uA.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var S=s.fF.event;function j(){}function R(){return this.cancelBubble}function C(){return this.defaultPrevented}s.fF.event=function(e){return S&&(e=S(e)),e.persist=j,e.isPropagationStopped=R,e.isDefaultPrevented=C,e.nativeEvent=e};var P={enumerable:!1,configurable:!0,get:function(){return this.class}},O=s.fF.vnode;s.fF.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1===n.indexOf("-");for(var i in t){var l=t[i];if(!("value"===i&&"defaultValue"in t&&null==l||x&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var a,u=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===l?l="":"translate"===u&&"no"===l?l=!1:"o"===u[0]&&"n"===u[1]?"ondoubleclick"===u?i="ondblclick":"onchange"!==u||"input"!==n&&"textarea"!==n||(a=t.type,("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(a))?"onfocus"===u?i="onfocusin":"onblur"===u?i="onfocusout":g.test(i)&&(i=u):u=i="oninput":r&&w.test(i)?i=i.replace(F,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===u&&o[i=u]&&(i="oninputCapture"),o[i]=l}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,s.v2)(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),"select"==n&&null!=o.defaultValue&&(o.value=(0,s.v2)(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value})),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",P)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=k,O&&O(e)};var A=s.fF.__r;s.fF.__r=function(e){A&&A(e),e.__c};var W=s.fF.diffed;s.fF.diffed=function(e){W&&W(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};let E=e=>(0,r.Y)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 28 28",...e,children:(0,r.Y)("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M23.143 14v11.428H4.857V14M14 25.428V8.286m0 0H8.857a2.857 2.857 0 0 1 0-5.715c4 0 5.143 5.715 5.143 5.715m0 0h5.143a2.857 2.857 0 1 0 0-5.715c-4 0-5.143 5.715-5.143 5.715m-11.429 0h22.857V14H2.571z"})});var N=n("./src/components/ButtonWallet/utils.ts");function U({classname:e="",useReward:t,targetInteraction:n}){let o=(0,a.Kr)(()=>void 0!==t,[t]),{isClientReady:s}=(0,u.g)(),{reward:c}=(0,_.b)(o&&s,n),[d,f]=(0,a.J0)("right");return(0,a.vJ)(()=>{f(window.FrakSetup?.modalWalletConfig?.metadata?.position??"right")},[]),(0,r.FD)("button",{type:"button","aria-label":"Open wallet",class:(0,l.cx)("button-aPZnsb","left"===d?"button__left-fQJUnK":"button__right-TkFFFK",e,"override"),disabled:!s,onClick:()=>{(0,i.sx)(window.FrakSetup.client,"wallet_button_clicked"),(0,N.h)()},children:[(0,r.Y)(E,{}),c&&(0,r.Y)("span",{className:"reward-w5dm3K",children:c})]})}(0,o.$)(U,"frak-button-wallet",[],{shadow:!1})},"./src/hooks/useClientReady.ts":function(e,t,n){n.d(t,{g:()=>i});var o=n("../../node_modules/.bun/preact@10.27.2/node_modules/preact/hooks/dist/hooks.module.js"),r=n("./src/utils/clientReady.ts");function i(){let[e,t]=(0,o.J0)(!0),n=(0,o.hb)(()=>{t(!1)},[]);return(0,o.vJ)(()=>((0,r.S)("add",n),()=>(0,r.S)("remove",n)),[n]),{isClientReady:!e}}},"./src/hooks/useReward.ts":function(e,t,n){n.d(t,{b:()=>a});var o=n("../../node_modules/.bun/preact@10.27.2/node_modules/preact/hooks/dist/hooks.module.js"),r=n("../core/dist/index.js"),i=n("../core/dist/actions.js");async function l({targetInteraction:e}){let t=window.FrakSetup?.client;if(!t)return void console.warn("Frak client not ready yet");let{maxReferrer:n,rewards:o}=await (0,i.k9)(t);if(!n)return;let l=(0,r.hr)(t.config.metadata?.currency),a=Math.round(n[l]);if(e){let t=o.filter(t=>t.interactionTypeKey===e).map(e=>e.referrer[l]).reduce((e,t)=>t>e?t:e,0);t>0&&(a=Math.round(t))}return(0,r.ej)(a,t.config.metadata?.currency)}function a(e,t){let[n,r]=(0,o.J0)(void 0);return(0,o.vJ)(()=>{e&&l({targetInteraction:t}).then(e=>{e&&r(e)})},[e,t]),{reward:n}}},"./src/utils/registerWebComponent.ts":function(e,t,n){n.d(t,{$:()=>l});var o=n("../../packages/ui/utils/onDocumentReady.ts"),r=n("../../node_modules/.bun/preact-custom-element@4.5.1+e9f4a629fd396517/node_modules/preact-custom-element/dist/preact-custom-element.esm.js"),i=n("./src/utils/initFrakSdk.ts");function l(e,t,n=[],a={shadow:!1}){"undefined"!=typeof window&&((0,o.q)(i.$),customElements.get(t)||(0,r.A)(e,t,n,a))}}};
@@ -1 +0,0 @@
1
- .spinner-KHk8mw{--spinner-opacity:.65;opacity:var(--spinner-opacity);width:16px;height:16px;display:block;position:relative}.spinner__leaf-xtOJmT{--spinner-animation-duration:.8s;width:12.5%;height:100%;animation:rt-spinner-leaf-fade-OXYBVY var(--spinner-animation-duration)linear infinite;position:absolute;top:0;left:43.75%}.spinner__leaf-xtOJmT:before{content:"";background-color:currentColor;border-radius:3px;width:100%;height:30%;display:block}.spinner__leaf-xtOJmT:where(:first-child){animation-delay:calc(-8/8*var(--spinner-animation-duration));transform:rotate(0)}.spinner__leaf-xtOJmT:where(:nth-child(2)){animation-delay:calc(-7/8*var(--spinner-animation-duration));transform:rotate(45deg)}.spinner__leaf-xtOJmT:where(:nth-child(3)){animation-delay:calc(-6/8*var(--spinner-animation-duration));transform:rotate(90deg)}.spinner__leaf-xtOJmT:where(:nth-child(4)){animation-delay:calc(-5/8*var(--spinner-animation-duration));transform:rotate(135deg)}.spinner__leaf-xtOJmT:where(:nth-child(5)){animation-delay:calc(-4/8*var(--spinner-animation-duration));transform:rotate(180deg)}.spinner__leaf-xtOJmT:where(:nth-child(6)){animation-delay:calc(-3/8*var(--spinner-animation-duration));transform:rotate(225deg)}.spinner__leaf-xtOJmT:where(:nth-child(7)){animation-delay:calc(-2/8*var(--spinner-animation-duration));transform:rotate(270deg)}.spinner__leaf-xtOJmT:where(:nth-child(8)){animation-delay:calc(-1/8*var(--spinner-animation-duration));transform:rotate(315deg)}@keyframes rt-spinner-leaf-fade-OXYBVY{0%{opacity:1}to{opacity:.25}}.buttonShare-F23Y9m{justify-content:center;align-items:center;gap:10px;display:flex}
@@ -1 +0,0 @@
1
- .button-aPZnsb{all:unset;z-index:2000000;cursor:pointer;text-align:center;background-color:#3e557e;border-radius:50%;justify-content:center;align-items:center;width:45px;height:45px;font-size:24px;display:flex;position:fixed;bottom:20px}.button__left-fQJUnK{left:20px}.button__right-TkFFFK{right:20px}.reward-w5dm3K{color:#fff;white-space:nowrap;background:#ff3f3f;border-radius:5px;padding:2px 3px;font-size:9px;font-weight:600;line-height:9px;position:absolute;top:-4px;right:27px}
@@ -1 +0,0 @@
1
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */