@frak-labs/components 0.0.23-beta.afa252b0 → 0.0.23-beta.c7e026e5
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.
- package/cdn/ButtonShare.B47PURL1.js +1 -0
- package/cdn/ButtonWallet.mI8LYqkU.js +1 -0
- package/cdn/components.js +1 -1
- package/cdn/loader.css +7 -0
- package/cdn/loader.js +7 -21
- package/dist/buttonShare.css +2 -1
- package/dist/buttonShare.d.ts +100 -85
- package/dist/buttonShare.js +343 -1
- package/dist/buttonWallet.css +1 -1
- package/dist/buttonWallet.d.ts +76 -64
- package/dist/buttonWallet.js +109 -1
- package/dist/useReward-1io3tiHR.js +239 -0
- package/package.json +43 -14
- package/cdn/564.74bbd23d.js +0 -1
- package/cdn/button-share.4d8a18a0.js +0 -1
- package/cdn/button-share.823884d0.css +0 -1
- package/cdn/button-wallet.0a2b7d12.js +0 -1
- package/cdn/button-wallet.390d543a.css +0 -1
- package/cdn/loader.js.LICENSE.txt +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const __webpack_ids__=["766"];export const __webpack_modules__={"./src/components/ButtonShare/index.ts":function(e,t,o){o.r(t),o.d(t,{ButtonShare:()=>_});var n=o("./src/utils/registerWebComponent.ts"),r=o("../../node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js"),s=o("../../node_modules/class-variance-authority/dist/index.mjs");let i="spinner__leaf-xtOJmT",a=({ref:e,className:t,...o})=>(0,r.BX)("span",{...o,ref:e,className:(0,s.cx)("spinner-KHk8mw"),children:[(0,r.tZ)("span",{className:i}),(0,r.tZ)("span",{className:i}),(0,r.tZ)("span",{className:i}),(0,r.tZ)("span",{className:i}),(0,r.tZ)("span",{className:i}),(0,r.tZ)("span",{className:i}),(0,r.tZ)("span",{className:i}),(0,r.tZ)("span",{className:i})]});a.displayName="Spinner";var l=o("./src/hooks/useClientReady.ts"),d=o("./src/hooks/useReward.ts"),c=o("../core/dist/index.js"),u=o("../core/dist/actions.js"),p=o("../../node_modules/preact/hooks/dist/hooks.module.js");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},w={fontSize:"14px",lineHeight:"1.5",margin:"0 0 12px 0"},y={color:"#991B1B",textDecoration:"underline",textUnderlineOffset:"2px"},x={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 b({debugInfo:e}){let[t,o]=(0,p.eJ)(!1);return(0,r.BX)("div",{children:[(0,r.tZ)("button",{type:"button",style:x,onClick:()=>o(!t),children:"Ouvrir les informations"}),t&&(0,r.tZ)("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,p.eJ)(!1);return{copy:(0,p.I4)(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.BX)("div",{style:m,children:[(0,r.tZ)("div",{style:f,children:(0,r.tZ)("h3",{style:h,children:"Oups ! Nous avons rencontr\xe9 un petit probl\xe8me"})}),(0,r.BX)("p",{style:w,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.tZ)("a",{href:"mailto:help@frak-labs.com?subject=Debug",style:y,children:"help@frak-labs.com"})," ",(0,r.tZ)("br",{}),"Merci pour votre retour, nous traitons votre demande dans les plus brefs d\xe9lais."]}),(0,r.tZ)("button",{type:"button",onClick:()=>o(e??""),style:x,children:t?"Informations copi\xe9es !":"Copier les informations de d\xe9bogage"}),(0,r.tZ)(b,{debugInfo:e})]})}var k=o("./src/utils/setup.ts"),v=o("../../packages/rpc/dist/index.js");async function S(){if(!window.FrakSetup?.client)throw Error("Frak client not found");await (0,u.s9)(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function _({text:e="Share and earn!",classname:t="",useReward:o,noRewardText:n,targetInteraction:i,showWallet:u}){let m=(0,p.Ye)(()=>void 0!==o,[o]),f=(0,p.Ye)(()=>void 0!==u,[u]),{isClientReady:h}=(0,l.t)(),{reward:w}=(0,d.w)(m&&h,i),{handleShare:y,isError:x,debugInfo:b}=function(e){let[t,o]=(0,p.eJ)(void 0),[n,r]=(0,p.eJ)(!1);return{handleShare:(0,p.I4)(async()=>{if(!window.FrakSetup?.client){console.error("Frak client not found"),o(c.oC.empty().formatDebugInfo("Frak client not found")),r(!0);return}let t=(0,k.Gt)();if(!t)throw Error("modalBuilderSteps not found");try{await t.sharing(window.FrakSetup?.modalShareConfig??{}).display(t=>({...t,targetInteraction:e}))}catch(t){if(t instanceof v.u&&t.code===v.ss.clientAborted)return void console.debug("User aborted the modal");let e=window.FrakSetup.client.debugInfo.formatDebugInfo(t);(0,c.L9)(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}}(i),_=(0,p.Ye)(()=>m?w?e.includes("{REWARD}")?e.replace("{REWARD}",w):`${e} ${w}`:n??e.replace("{REWARD}",""):e,[m,e,n,w]),F=(0,p.I4)(async()=>{(0,c.L9)(window.FrakSetup.client,"share_button_clicked"),f?await S():await y()},[f,y]);return(0,r.BX)(r.HY,{children:[(0,r.BX)("button",{type:"button",className:(0,s.cx)("buttonShare-F23Y9m",t,"override"),onClick:F,children:[!h&&(0,r.tZ)(a,{})," ",_]}),x&&(0,r.tZ)(g,{debugInfo:b})]})}(0,n.A)(_,"frak-button-share",["text"],{shadow:!1})},"./src/hooks/useClientReady.ts":function(e,t,o){o.d(t,{t:()=>s});var n=o("./src/utils/clientReady.ts"),r=o("../../node_modules/preact/hooks/dist/hooks.module.js");function s(){let[e,t]=(0,r.eJ)(!0),o=(0,r.I4)(()=>{t(!1)},[]);return(0,r.d4)(()=>((0,n.D)("add",o),()=>(0,n.D)("remove",o)),[o]),{isClientReady:!e}}},"./src/hooks/useReward.ts":function(e,t,o){o.d(t,{w:()=>a});var n=o("../core/dist/index.js"),r=o("../core/dist/actions.js");async function s({targetInteraction:e}){let t=window.FrakSetup?.client;if(!t)return void console.warn("Frak client not ready yet");let{maxReferrer:o,rewards:s}=await (0,r.pO)(t);if(!o)return;let i=(0,n.Up)(t.config.metadata?.currency),a=Math.round(o[i]);if(e){let t=s.filter(t=>t.interactionTypeKey===e).map(e=>e.referrer[i]).reduce((e,t)=>t>e?t:e,0);t>0&&(a=Math.round(t))}return(0,n.dN)(a,t.config.metadata?.currency)}var i=o("../../node_modules/preact/hooks/dist/hooks.module.js");function a(e,t){let[o,n]=(0,i.eJ)(void 0);return(0,i.d4)(()=>{e&&s({targetInteraction:t}).then(e=>{e&&n(e)})},[e,t]),{reward:o}}},"./src/utils/registerWebComponent.ts":function(e,t,o){o.d(t,{A:()=>i});var n=o("../../packages/ui/utils/onDocumentReady.ts"),r=o("../../node_modules/preact-custom-element/dist/preact-custom-element.esm.js"),s=o("./src/utils/initFrakSdk.ts");function i(e,t,o=[],a={shadow:!1}){"undefined"!=typeof window&&((0,n.E)(s.m),customElements.get(t)||(0,r.Z)(e,t,o,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
|
-
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:()=>U});var o=n("./src/utils/registerWebComponent.ts"),r=n("../../node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js"),i=n("./src/hooks/useClientReady.ts"),l=n("./src/hooks/useReward.ts"),a=n("../core/dist/index.js"),_=n("../../node_modules/class-variance-authority/dist/index.mjs"),u=n("../../node_modules/preact/hooks/dist/hooks.module.js");let s={button:"button-aPZnsb",button__left:"button__left-fQJUnK",button__right:"button__right-TkFFFK",reward:"reward-w5dm3K"};var c=n("../../node_modules/preact/dist/preact.module.js");function d(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 c.wA).isPureReactComponent=!0,f.prototype.shouldComponentUpdate=function(e,t){return d(this.props,e)||d(this.state,t)};var p=c.YM.__b;c.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 v=c.YM.__e;c.YM.__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)}v(e,t,n,o)};var h=c.YM.unmount;function m(){this.__u=0,this.o=null,this.__b=null}function b(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function y(){this.i=null,this.l=null}c.YM.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),h&&h(e)},(m.prototype=new c.wA).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=b(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,c.az)(c.HY,null,e.fallback);return r&&(r.__u&=-33),[(0,c.az)(c.HY,null,t.__a?null:e.children),r]};var w=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]}};(y.prototype=new c.wA).__a=function(e){var t=this,n=b(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),w(t,e,o)):r()};n?n(i):i()}},y.prototype.render=function(e){this.i=null,this.l=new Map;var t=(0,c.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},y.prototype.componentDidUpdate=y.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){w(e,n,t)})};var k="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,g=/^(?: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]/,M=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,R=/[A-Z0-9]/g,x="undefined"!=typeof document;c.wA.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(c.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 S=c.YM.event;function Y(){}function j(){return this.cancelBubble}function C(){return this.defaultPrevented}c.YM.event=function(e){return S&&(e=S(e)),e.persist=Y,e.isPropagationStopped=j,e.isDefaultPrevented=C,e.nativeEvent=e};var P={enumerable:!1,configurable:!0,get:function(){return this.class}},O=c.YM.vnode;c.YM.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,_=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===l?l="":"translate"===_&&"no"===l?l=!1:"o"===_[0]&&"n"===_[1]?"ondoubleclick"===_?i="ondblclick":"onchange"!==_||"input"!==n&&"textarea"!==n||(a=t.type,("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(a))?"onfocus"===_?i="onfocusin":"onblur"===_?i="onfocusout":M.test(i)&&(i=_):_=i="oninput":r&&g.test(i)?i=i.replace(R,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===_&&o[i=_]&&(i="oninputCapture"),o[i]=l}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,c.bR)(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),"select"==n&&null!=o.defaultValue&&(o.value=(0,c.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",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=c.YM.__r;c.YM.__r=function(e){A&&A(e),e.__c};var W=c.YM.diffed;c.YM.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.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 N=n("./src/components/ButtonWallet/utils.ts");function U({classname:e="",useReward:t,targetInteraction:n}){let o=(0,u.Ye)(()=>void 0!==t,[t]),{isClientReady:c}=(0,i.t)(),{reward:d}=(0,l.w)(o&&c,n),[f,p]=(0,u.eJ)("right");return(0,u.d4)(()=>{p(window.FrakSetup?.modalWalletConfig?.metadata?.position??"right")},[]),(0,r.BX)("button",{type:"button","aria-label":"Open wallet",class:(0,_.cx)(s.button,"left"===f?s.button__left:s.button__right,e,"override"),disabled:!c,onClick:()=>{(0,a.L9)(window.FrakSetup.client,"wallet_button_clicked"),(0,N.G)()},children:[(0,r.tZ)(E,{}),d&&(0,r.tZ)("span",{className:s.reward,children:d})]})}(0,o.A)(U,"frak-button-wallet",[],{shadow:!1})},"./src/hooks/useClientReady.ts":function(e,t,n){n.d(t,{t:()=>i});var o=n("./src/utils/clientReady.ts"),r=n("../../node_modules/preact/hooks/dist/hooks.module.js");function i(){let[e,t]=(0,r.eJ)(!0),n=(0,r.I4)(()=>{t(!1)},[]);return(0,r.d4)(()=>((0,o.D)("add",n),()=>(0,o.D)("remove",n)),[n]),{isClientReady:!e}}},"./src/hooks/useReward.ts":function(e,t,n){n.d(t,{w:()=>a});var o=n("../core/dist/index.js"),r=n("../core/dist/actions.js");async function i({targetInteraction:e}){let t=window.FrakSetup?.client;if(!t)return void console.warn("Frak client not ready yet");let{maxReferrer:n,rewards:i}=await (0,r.pO)(t);if(!n)return;let l=(0,o.Up)(t.config.metadata?.currency),a=Math.round(n[l]);if(e){let t=i.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,o.dN)(a,t.config.metadata?.currency)}var l=n("../../node_modules/preact/hooks/dist/hooks.module.js");function a(e,t){let[n,o]=(0,l.eJ)(void 0);return(0,l.d4)(()=>{e&&i({targetInteraction:t}).then(e=>{e&&o(e)})},[e,t]),{reward:n}}},"./src/utils/registerWebComponent.ts":function(e,t,n){n.d(t,{A:()=>l});var o=n("../../packages/ui/utils/onDocumentReady.ts"),r=n("../../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.E)(i.m),customElements.get(t)||(0,r.Z)(e,t,n,a))}}};
|
|
@@ -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) */
|