stas-pay 0.0.2 → 0.0.3
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/dist/index.es.js +3 -1
- package/dist/index.umd.js +3 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -7024,6 +7024,8 @@ const tm = $.div`
|
|
|
7024
7024
|
align-items: center;
|
|
7025
7025
|
justify-content: center;
|
|
7026
7026
|
margin-left: 46px;
|
|
7027
|
+
transform: translateZ(0);
|
|
7028
|
+
will-change: opacity;
|
|
7027
7029
|
`, yo = $(yt.div)`
|
|
7028
7030
|
position: absolute;
|
|
7029
7031
|
font-family: "Inter";
|
|
@@ -7085,7 +7087,7 @@ const tm = $.div`
|
|
|
7085
7087
|
[0.2, 1]
|
|
7086
7088
|
), P = Ee(
|
|
7087
7089
|
g,
|
|
7088
|
-
[0,
|
|
7090
|
+
[0, 30],
|
|
7089
7091
|
[1, 0]
|
|
7090
7092
|
), T = Ee(
|
|
7091
7093
|
g,
|
package/dist/index.umd.js
CHANGED
|
@@ -233,6 +233,8 @@ See https://styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-sev
|
|
|
233
233
|
align-items: center;
|
|
234
234
|
justify-content: center;
|
|
235
235
|
margin-left: 46px;
|
|
236
|
+
transform: translateZ(0);
|
|
237
|
+
will-change: opacity;
|
|
236
238
|
`,yc=z(ft.div)`
|
|
237
239
|
position: absolute;
|
|
238
240
|
font-family: "Inter";
|
|
@@ -257,6 +259,6 @@ See https://styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-sev
|
|
|
257
259
|
`,vc=z.span`
|
|
258
260
|
font-weight: 700;
|
|
259
261
|
padding: 0px 4px;
|
|
260
|
-
`,em=({style:t})=>k.jsx(ft.svg,{style:{fill:"#000",...t},width:"8",height:"14",viewBox:"0 0 8 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:k.jsx("path",{d:"M7.3685 5.88108L1.70841 0.289514C1.31601 -0.0981307 0.684249 -0.0962069 0.294221 0.293821C-0.0974925 0.685534 -0.0974927 1.32063 0.294221 1.71234L5.20654 6.62466L0.292795 11.5384C-0.0979253 11.9291 -0.0979255 12.5626 0.292795 12.9533C0.683238 13.3438 1.31617 13.3441 1.70701 12.954L7.37211 7.30029C7.76499 6.9082 7.76336 6.27116 7.3685 5.88108Z",fill:"black"})}),nm=({style:t})=>k.jsx(ft.svg,{style:{position:"absolute",...t},width:"20",height:"14",viewBox:"0 0 20 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:k.jsx("path",{d:"M7.36528 13.4211L19.0033 1.70743C19.3923 1.3159 19.3913 0.683468 19.0011 0.293199C18.6099 -0.097955 17.9757 -0.0979677 17.5846 0.29317L6.62168 11.2551L1.70793 6.34139C1.31721 5.95067 0.683725 5.95067 0.293005 6.34139C-0.0974369 6.73183 -0.0977554 7.36477 0.292295 7.7556L5.94807 13.4227C6.33938 13.8148 6.97486 13.8141 7.36528 13.4211Z",fill:"black"})}),yi=t=>{if(t<1e4)return t.toString();const e=t/1e3,n=Math.floor(e*10)/10;return n%1===0?`~${n.toFixed(0)}k`:`~${n}k`},sm=({data:{chainId:t=null,address:e=null,count:n=0},close:s})=>{const[i,o]=Th("language",navigator.language==="ru-RU"?"ru":"en"),{balance:r,chain:a,token:c}=Fp({chainId:t,address:e}),[l,u]=g.useState(!1),[f,d]=g.useState(!0),h=i==="ru",p=bh(),y=Pa(0),w=230,v=50,C=w-v,m=r===null||r>=n,T=()=>{const L=y.get()/C;L>.85&&(m||window.open(`https://app.uniswap.org/swap?chain=${a}&inputCurrency=NATIVE&outputCurrency=${c}`),u(!0)),p.start({x:L>.85?C:0,transition:{type:"spring",stiffness:400,damping:30}})};g.useEffect(()=>{if(n||t||e){const L=setTimeout(()=>{d(!1)},100);return()=>clearTimeout(L)}},[n,t,e]),g.useEffect(()=>{if(l){const L=setTimeout(()=>{s(m),y.set(0),u(!1),d(!0)},1e3);return()=>clearTimeout(L)}},[l,m,s,y]);const b=Ie(y,[0,w-v],[.2,1]),P=Ie(y,[0,
|
|
262
|
+
`,em=({style:t})=>k.jsx(ft.svg,{style:{fill:"#000",...t},width:"8",height:"14",viewBox:"0 0 8 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:k.jsx("path",{d:"M7.3685 5.88108L1.70841 0.289514C1.31601 -0.0981307 0.684249 -0.0962069 0.294221 0.293821C-0.0974925 0.685534 -0.0974927 1.32063 0.294221 1.71234L5.20654 6.62466L0.292795 11.5384C-0.0979253 11.9291 -0.0979255 12.5626 0.292795 12.9533C0.683238 13.3438 1.31617 13.3441 1.70701 12.954L7.37211 7.30029C7.76499 6.9082 7.76336 6.27116 7.3685 5.88108Z",fill:"black"})}),nm=({style:t})=>k.jsx(ft.svg,{style:{position:"absolute",...t},width:"20",height:"14",viewBox:"0 0 20 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:k.jsx("path",{d:"M7.36528 13.4211L19.0033 1.70743C19.3923 1.3159 19.3913 0.683468 19.0011 0.293199C18.6099 -0.097955 17.9757 -0.0979677 17.5846 0.29317L6.62168 11.2551L1.70793 6.34139C1.31721 5.95067 0.683725 5.95067 0.293005 6.34139C-0.0974369 6.73183 -0.0977554 7.36477 0.292295 7.7556L5.94807 13.4227C6.33938 13.8148 6.97486 13.8141 7.36528 13.4211Z",fill:"black"})}),yi=t=>{if(t<1e4)return t.toString();const e=t/1e3,n=Math.floor(e*10)/10;return n%1===0?`~${n.toFixed(0)}k`:`~${n}k`},sm=({data:{chainId:t=null,address:e=null,count:n=0},close:s})=>{const[i,o]=Th("language",navigator.language==="ru-RU"?"ru":"en"),{balance:r,chain:a,token:c}=Fp({chainId:t,address:e}),[l,u]=g.useState(!1),[f,d]=g.useState(!0),h=i==="ru",p=bh(),y=Pa(0),w=230,v=50,C=w-v,m=r===null||r>=n,T=()=>{const L=y.get()/C;L>.85&&(m||window.open(`https://app.uniswap.org/swap?chain=${a}&inputCurrency=NATIVE&outputCurrency=${c}`),u(!0)),p.start({x:L>.85?C:0,transition:{type:"spring",stiffness:400,damping:30}})};g.useEffect(()=>{if(n||t||e){const L=setTimeout(()=>{d(!1)},100);return()=>clearTimeout(L)}},[n,t,e]),g.useEffect(()=>{if(l){const L=setTimeout(()=>{s(m),y.set(0),u(!1),d(!0)},1e3);return()=>clearTimeout(L)}},[l,m,s,y]);const b=Ie(y,[0,w-v],[.2,1]),P=Ie(y,[0,30],[1,0]),S=Ie(y,[w-v-10,w-v],[1,0]),A=Ie(y,[w-v-10,w-v],[0,1]),R=ph`
|
|
261
263
|
rgba(240, 213, 51, ${b})
|
|
262
264
|
`,M=n&&t&&e;return k.jsx(cd,{children:M&&k.jsx(_p,{initial:{backdropFilter:"blur(0px)",background:"rgba(29, 29, 29, 0)",opacity:0},animate:{backdropFilter:"blur(30px)",background:"rgba(29, 29, 29, 0.85)",opacity:1},exit:{backdropFilter:"blur(0px)",background:"rgba(29, 29, 29, 0)",opacity:0},transition:{duration:.25,ease:"easeOut"},children:k.jsx(mc,{width:250,height:320,starCount:30,maxOffset:120,color:"#F0D533",children:k.jsxs($p,{initial:{height:"250px"},animate:{height:r==null?"250px":"320px"},exit:{height:"250px"},children:[k.jsxs(zp,{children:[k.jsx(Hp,{onTap:()=>{s(!1),d(!0)}}),k.jsx(mc,{width:170,height:104,starCount:50,maxOffset:80,margin:10,color:"#000000",children:k.jsxs(Up,{children:[k.jsxs(Wp,{children:[k.jsx(Gp,{children:yi(n)}),k.jsx(Yp,{})]}),k.jsxs(Kp,{children:[k.jsx(gc,{initial:{opacity:0},animate:{opacity:h?1:0},transition:h?{delay:f?0:.2}:{delay:0},exit:{opacity:0},children:m?k.jsxs(k.Fragment,{children:["Вы оплатите ",k.jsxs(vc,{children:[yi(n)," STAS"]})," за это действие."]}):k.jsx(k.Fragment,{children:"Недостаточно STAS для оплаты действия."})}),k.jsx(gc,{initial:{opacity:1},animate:{opacity:h?0:1},transition:h?{delay:0}:{delay:f?0:.2},exit:{opacity:1},children:m?k.jsxs(k.Fragment,{children:["You will pay ",k.jsxs(vc,{children:[yi(n)," STAS"]})," for this action."]}):k.jsx(k.Fragment,{children:"Not enough STAS to pay for the action."})})]})]})}),k.jsxs(qp,{children:[k.jsx(gi,{onTap:()=>window.open("https://prohetamine.ru/web3","_blank"),children:"prohetamine.ru/web3"}),k.jsx(Xp,{}),k.jsxs(Zp,{children:[k.jsx(gi,{onTap:()=>o("ru"),active:h?"underline":"none",children:"ru"}),k.jsx(gi,{onTap:()=>o("en"),active:h?"none":"underline",children:"en"})]})]})]}),k.jsxs(Jp,{style:{background:R},children:[k.jsx(Qp,{drag:"x",dragElastic:0,dragMomentum:!1,dragConstraints:{left:0,right:C},onDragEnd:T,animate:p,style:{x:y},children:k.jsx(em,{style:{opacity:S}})}),k.jsxs(tm,{style:{opacity:P},children:[k.jsx(yc,{initial:{opacity:0},animate:{opacity:h?1:0},transition:h?{delay:f?0:.2}:{delay:0},exit:{opacity:0},children:m?"Подтвердить":"Uniswap"}),k.jsx(yc,{initial:{opacity:1},animate:{opacity:h?0:1},transition:h?{delay:0}:{delay:f?0:.2},exit:{opacity:1},children:m?"Confirm":"Uniswap"})]}),k.jsx(nm,{style:{opacity:A}})]})]})})})})},xc=g.createContext(null),wc={count:0,address:null,chainId:null},im=({children:t})=>{const e=g.useRef(null),[n,s]=g.useState(wc),i=g.useCallback(r=>new Promise(a=>{e.current=a,s(r)}),[]),o=r=>{e.current?.(r),e.current=null,s(wc)};return k.jsxs(xc.Provider,{value:i,children:[t,k.jsx(sm,{data:n,close:o})]})},rm=()=>{const t=g.useContext(xc);if(!t)throw new Error("usePay must be used inside Provider");return t};mt.StasPayProvider=im,mt.useStasPay=rm,Object.defineProperty(mt,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED