UNPKG

@frak-labs/components

Version:

Frak Wallet components, helping any person to interact with the Frak wallet.

1 lines 7.16 kB
export const __webpack_ids__=["438"];export const __webpack_modules__={"./src/components/ButtonWallet/index.ts":function(e,t,n){n.r(t),n.d(t,{ButtonWallet:()=>N});var o=n("./src/utils/registerWebComponent.ts"),r=n("../../node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js"),_=n("./src/hooks/useClientReady.ts"),l=n("./src/hooks/useReward.ts"),i=n("../../node_modules/class-variance-authority/dist/index.mjs"),a=n("../../node_modules/preact/hooks/dist/hooks.module.js");let u={button:"button-aPZnsb",button__left:"button__left-fQJUnK",button__right:"button__right-TkFFFK",reward:"reward-w5dm3K"};var s=n("../../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 f(e,t){this.props=e,this.context=t}(f.prototype=new s.wA).isPureReactComponent=!0,f.prototype.shouldComponentUpdate=function(e,t){return c(this.props,e)||c(this.state,t)};var p=s.YM.__b;s.YM.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),p&&p(e)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var d=s.YM.__e;s.YM.__e=function(e,t,n,o){if(e.then){for(var r,_=t;_=_.__;)if((r=_.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t)}d(e,t,n,o)};var v=s.YM.unmount;function h(){this.__u=0,this.o=null,this.__b=null}function m(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function b(){this.i=null,this.l=null}s.YM.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),v&&v(e)},(h.prototype=new s.wA).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=m(o.__v),_=!1,l=function(){_||(_=!0,n.__R=null,r?r(i):i())};n.__R=l;var i=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)},h.prototype.componentWillUnmount=function(){this.o=[]},h.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=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.az)(s.HY,null,e.fallback);return r&&(r.__u&=-33),[(0,s.az)(s.HY,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.wA).__a=function(e){var t=this,n=m(t.__v),o=t.l.get(e);return o[0]++,function(r){var _=function(){t.props.revealOrder?(o.push(r),y(t,e,o)):r()};n?n(_):_()}},b.prototype.render=function(e){this.i=null,this.l=new Map;var t=(0,s.bR)(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 w="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,k=/^(?: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)/,M=/[A-Z0-9]/g,x="undefined"!=typeof document;s.wA.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(s.wA.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Y=s.YM.event;function P(){}function R(){return this.cancelBubble}function O(){return this.defaultPrevented}s.YM.event=function(e){return Y&&(e=Y(e)),e.persist=P,e.isPropagationStopped=R,e.isDefaultPrevented=O,e.nativeEvent=e};var S={enumerable:!1,configurable:!0,get:function(){return this.class}},C=s.YM.vnode;s.YM.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1===n.indexOf("-");for(var _ in t){var l=t[_];if(!("value"===_&&"defaultValue"in t&&null==l||x&&"children"===_&&"noscript"===n||"class"===_||"className"===_)){var i,a=_.toLowerCase();"defaultValue"===_&&"value"in t&&null==t.value?_="value":"download"===_&&!0===l?l="":"translate"===a&&"no"===l?l=!1:"o"===a[0]&&"n"===a[1]?"ondoubleclick"===a?_="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||(i=t.type,("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(i))?"onfocus"===a?_="onfocusin":"onblur"===a?_="onfocusout":g.test(_)&&(_=a):a=_="oninput":r&&k.test(_)?_=_.replace(M,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===a&&o[_=a]&&(_="oninputCapture"),o[_]=l}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,s.bR)(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),"select"==n&&null!=o.defaultValue&&(o.value=(0,s.bR)(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",S)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=w,C&&C(e)};var A=s.YM.__r;s.YM.__r=function(e){A&&A(e),e.__c};var j=s.YM.diffed;s.YM.diffed=function(e){j&&j(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 W=e=>(0,r.tZ)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 28 28",...e,children:(0,r.tZ)("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 H=n("./src/components/ButtonWallet/utils.ts");function N({classname:e="",useReward:t,targetInteraction:n}){let o=(0,a.Ye)(()=>void 0!==t,[t]),{isClientReady:s}=(0,_.t)(),{reward:c}=(0,l.w)(o&&s,n),[f,p]=(0,a.eJ)("right");return(0,a.d4)(()=>{p(window.FrakSetup?.modalWalletConfig?.metadata?.position??"right")},[]),(0,r.BX)("button",{type:"button","aria-label":"Open wallet",class:(0,i.cx)(u.button,"left"===f?u.button__left:u.button__right,e,"override"),disabled:!s,onClick:H.G,children:[(0,r.tZ)(W,{}),c&&(0,r.tZ)("span",{className:u.reward,children:c})]})}(0,o.A)(N,"frak-button-wallet",[],{shadow:!1})}};