New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@paperxyz/react-client-sdk

Package Overview
Dependencies
Maintainers
4
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paperxyz/react-client-sdk - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

dist/components/AddPaymentMethod.d.ts

3

dist/components/CreateWallet.d.ts

@@ -11,3 +11,6 @@ import React from 'react';

}
/**
* @deprecated - Paper currently doesn't plan to further develop the wallet product.
*/
export declare const CreateWallet: React.FC<CreateWalletProps>;
export {};

@@ -40,2 +40,4 @@ import React from 'react';

appName?: string;
onOpenCheckout?: () => void;
onCloseCheckout?: () => void;
onPaymentSuccess?: (result: PaymentSuccessResult) => void;

@@ -42,0 +44,0 @@ onTransferSuccess?: (result: TransferSuccessResult) => void;

@@ -12,3 +12,6 @@ import React from 'react';

}
/**
* @deprecated - Paper currently doesn't plan to further develop the wallet product.
*/
export declare const VerifyOwnershipWithPaper: React.FC<VerifyOwnershipWithPaperProps>;
export {};

14

dist/index.js

@@ -1,2 +0,2 @@

var X=Object.create;var L=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames,W=Object.getOwnPropertySymbols,j=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var V=(t,r,e)=>r in t?L(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,p=(t,r)=>{for(var e in r||(r={}))B.call(r,e)&&V(t,e,r[e]);if(W)for(var e of W(r))q.call(r,e)&&V(t,e,r[e]);return t};var J=(t,r)=>{for(var e in r)L(t,e,{get:r[e],enumerable:!0})},F=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Z(r))!B.call(t,a)&&a!==e&&L(t,a,{get:()=>r[a],enumerable:!(s=Y(r,a))||s.enumerable});return t};var D=(t,r,e)=>(e=t!=null?X(j(t)):{},F(r||!t||!t.__esModule?L(e,"default",{value:t,enumerable:!0}):e,t)),Q=t=>F(L({},"__esModule",{value:!0}),t);var ne={};J(ne,{CreateWallet:()=>re,LoginWithPaper:()=>G,PaperCheckout:()=>te,PaperCheckoutDisplay:()=>z,PaperSDKErrorCode:()=>A,PaperSDKProvider:()=>ee,PayWithCard:()=>ie,VerifyOwnershipWithPaper:()=>G,openCenteredPopup:()=>H,usePaperSDKContext:()=>S});module.exports=Q(ne);var y=D(require("react"));var x="https://paper.xyz",R={colorPrimary:"#cf3781",colorBackground:"#ffffff",colorText:"#1a202c",borderRadius:12,fontFamily:"Open Sans"};var A=(o=>(o.UserLoginFailed="User login failed",o.InvalidProps="The props you passed in to this component are not valid.",o.InvalidCard="The card information is invalid. Please double check that the Card, CVC, and Zip code are all correct.",o.EmailNotVerified="The email was unable to be verified.",o.NotEnoughSupply="There is not enough supply to claim.",o.AddressNotAllowed="This address is not on the allowlist.",o.NoActiveClaimPhase="There is no active claim phase at the moment.",o))(A||{});var E=D(require("react")),M=(0,E.createContext)({chainName:"Polygon",setChainName:()=>{},clientId:""}),ee=({chainName:t,clientId:r,children:e})=>{let[s,a]=(0,E.useState)(t),n=(0,E.useMemo)(()=>({chainName:s,setChainName:a,clientId:r||""}),[s,a]);return E.default.createElement(M.Provider,{value:n},e)},S=()=>(0,E.useContext)(M);var K=D(require("styled-components")),T=K.default.button`
"use strict";var Y=Object.create;var R=Object.defineProperty,Z=Object.defineProperties,j=Object.getOwnPropertyDescriptor,q=Object.getOwnPropertyDescriptors,J=Object.getOwnPropertyNames,V=Object.getOwnPropertySymbols,Q=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var B=(t,r,e)=>r in t?R(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,h=(t,r)=>{for(var e in r||(r={}))F.call(r,e)&&B(t,e,r[e]);if(V)for(var e of V(r))ee.call(r,e)&&B(t,e,r[e]);return t},O=(t,r)=>Z(t,q(r));var re=(t,r)=>{for(var e in r)R(t,e,{get:r[e],enumerable:!0})},M=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of J(r))!F.call(t,i)&&i!==e&&R(t,i,{get:()=>r[i],enumerable:!(n=j(r,i))||n.enumerable});return t};var L=(t,r,e)=>(e=t!=null?Y(Q(t)):{},M(r||!t||!t.__esModule?R(e,"default",{value:t,enumerable:!0}):e,t)),te=t=>M(R({},"__esModule",{value:!0}),t);var de={};re(de,{CreateWallet:()=>ie,LoginWithPaper:()=>G,PaperCheckout:()=>ae,PaperCheckoutDisplay:()=>z,PaperSDKErrorCode:()=>U,PaperSDKProvider:()=>oe,PayWithCard:()=>le,VerifyOwnershipWithPaper:()=>G,openCenteredPopup:()=>X,usePaperSDKContext:()=>D});module.exports=te(de);var v=L(require("react"));var k="https://paper.xyz",T={colorPrimary:"#cf3781",colorBackground:"#ffffff",colorText:"#1a202c",borderRadius:12,fontFamily:"Open Sans"};var U=(o=>(o.UserLoginFailed="User login failed",o.InvalidProps="The props you passed in to this component are not valid.",o.InvalidCard="The card information is invalid. Please double check that the Card, CVC, and Zip code are all correct.",o.EmailNotVerified="The email was unable to be verified.",o.NotEnoughSupply="There is not enough supply to claim.",o.AddressNotAllowed="This address is not on the allowlist.",o.NoActiveClaimPhase="There is no active claim phase at the moment.",o))(U||{});var S=L(require("react")),K=(0,S.createContext)({chainName:"Polygon",setChainName:()=>{},clientId:""}),oe=({chainName:t,clientId:r,children:e})=>{let[n,i]=(0,S.useState)(t),a=(0,S.useMemo)(()=>({chainName:n,setChainName:i,clientId:r||""}),[n,i]);return S.default.createElement(K.Provider,{value:a},e)},D=()=>(0,S.useContext)(K);var $=L(require("styled-components")),I=$.default.button`
font-weight: bold;

@@ -18,3 +18,3 @@ display: flex;

}
`;var re=({emailAddress:t,onSuccess:r,onEmailVerificationInitiated:e,onError:s,children:a})=>{let[n,b]=(0,y.useState)(!1),{chainName:o}=S();(0,y.useEffect)(()=>{let f=u=>{let m=u.data;m.eventType==="verifyEmailEmailVerificationInitiated"?e&&e():m.eventType==="verifyEmailError"?(console.error("Error in Paper SDK VerifyEmail",m.error),s&&s({code:"The email was unable to be verified.",error:m.error})):m.eventType==="verifyEmailSuccess"&&r({emailAddress:m.emailAddress,walletAddress:m.walletAddress})};return window.addEventListener("message",f),()=>{window.removeEventListener("message",f)}},[]);let h=()=>{b(!0)};return y.default.createElement(y.default.Fragment,null,t&&n&&y.default.createElement(y.default.Fragment,null,y.default.createElement("iframe",{src:`${x}/sdk/v1/verify-email?email=${encodeURIComponent(t)}&chainName=${o}&date=${Date.now().toString()}`,style:{width:"0px",height:"0px",visibility:"hidden"}})),a?y.default.createElement("a",{onClick:h},a):y.default.createElement(T,{onClick:h},"Verify Email"))};var w=D(require("react"));function $({url:t,windowName:r,win:e,w:s,h:a}){var m,g,i,C;let n=((m=e==null?void 0:e.top)==null?void 0:m.outerHeight)||100,b=((g=e==null?void 0:e.top)==null?void 0:g.outerWidth)||100,o=((i=e==null?void 0:e.top)==null?void 0:i.screenX)||100,h=((C=e==null?void 0:e.top)==null?void 0:C.screenY)||100,f=n/2+h-a/2,u=b/2+o-s/2;return e.open(t,r,`toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=${s},height=${a},top=${f},left=${u}`)}var G=({onSuccess:t,onError:r,onWindowClose:e,className:s,children:a})=>{let{chainName:n,clientId:b}=S(),o=typeof a=="function";(0,w.useEffect)(()=>{let u=m=>{let g=m.data;switch(g.eventType){case"userLoginSuccess":t&&t(g.values.accessCode);break;case"userCloseLoginPage":{e&&e();break}case"userLoginFailed":r&&r({code:"User login failed",error:new Error("User login failed")});break;default:}};return window.addEventListener("message",u),()=>{window.removeEventListener("message",u)}},[]);let h=new URL("/sdk/v1/login-with-paper",x);h.searchParams.append("chainName",n),h.searchParams.append("clientId",b);let f=()=>{let u=$({url:h.href,windowName:"PaperLogin",win:window,w:400,h:600});u==null||u.focus()};return w.default.createElement(w.default.Fragment,null,a&&o?a({onClick:f}):a?w.default.createElement("a",{onClick:f},a," "):w.default.createElement(T,{onClick:f,className:s},w.default.createElement("span",{style:{marginRight:"10px"}},"Verify Ownership with Paper"),w.default.createElement("svg",{width:"15",height:"30",viewBox:"0 0 26 49",fill:"none",xmlns:"http://www.w3.org/2000/svg"},w.default.createElement("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M25.8824 8.91421C25.8824 8.47803 25.5996 8.09218 25.1838 7.96071L0 0V11.7963L14.7899 16.276L2.77311 24.5V34.4815L5.58074 37.3767L3.1009 39.6283C2.89214 39.8178 2.77311 40.0867 2.77311 40.3687V49L11.0924 42.6481V32.6667L8.60325 30.5207L25.8824 19.963V8.91421Z",fill:"#19A8D6"}),w.default.createElement("path",{d:"M25.8824 8.91421C25.8824 8.47803 25.5996 8.09218 25.1838 7.96071L0 0V11.7963L25.8824 19.963V8.91421Z",fill:"#39D0FF"}),w.default.createElement("path",{d:"M11.0924 32.6667L2.77311 24.5V34.4815L11.0924 42.6481V32.6667Z",fill:"#39D0FF"}))))};var l=D(require("react"));var z=(n=>(n.POPUP="POPUP",n.NEW_TAB="NEW_TAB",n.MODAL="MODAL",n.DRAWER="DRAWER",n.EMBED="EMBED",n))(z||{}),te=({checkoutId:t,display:r="POPUP",recipientWalletAddress:e,emailAddress:s,quantity:a,metadata:n,appName:b,options:o=p({width:400,height:800},R),onPaymentSuccess:h,onTransferSuccess:f,children:u})=>{let[m,g]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let k=d=>{let c=d.data;switch(c.eventType){case"paymentSuccess":h&&h({id:c.id});break;case"transferSuccess":f&&f({id:c.id});break;case"modalClosed":g(!1);break;default:}};return window.addEventListener("message",k),()=>{window.removeEventListener("message",k)}},[]);let i=new URL(`/checkout/${t}`,x);i.searchParams.append("display",r),o.colorPrimary&&i.searchParams.append("colorPrimary",o.colorPrimary),o.colorBackground&&i.searchParams.append("colorBackground",o.colorBackground),o.colorText&&i.searchParams.append("colorText",o.colorText),o.borderRadius!==void 0&&i.searchParams.append("borderRadius",o.borderRadius.toString()),o.fontFamily&&i.searchParams.append("fontFamily",o.fontFamily),b&&i.searchParams.append("appName",b),e&&i.searchParams.append("wallet",e),s&&i.searchParams.append("username",s),a&&i.searchParams.append("quantity",a.toString()),n&&i.searchParams.append("metadata",encodeURIComponent(JSON.stringify(n))),i.searchParams.append("date",Date.now().toString());let C=u||l.default.createElement("button",{style:{backgroundColor:"#cf3781",padding:"8px 20px 8px 20px",borderRadius:"8px",color:"white",fontWeight:"bold"}},"Buy Now");switch(r){case"POPUP":return l.default.createElement("a",{onClick:()=>{if(!(window!=null&&window.top))return;let d=window.top.outerHeight/2+window.top.screenY-o.height/2,c=window.top.outerWidth/2+window.top.screenX-o.width/2;window.open(i,"Paper Checkout",`toolbar=no,
`;var ie=({emailAddress:t,onSuccess:r,onEmailVerificationInitiated:e,onError:n,children:i})=>{let[a,P]=(0,v.useState)(!1),{chainName:o}=D();(0,v.useEffect)(()=>{let u=g=>{let f=g.data;f.eventType==="verifyEmailEmailVerificationInitiated"?e&&e():f.eventType==="verifyEmailError"?(console.error("Error in Paper SDK VerifyEmail",f.error),n&&n({code:"The email was unable to be verified.",error:f.error})):f.eventType==="verifyEmailSuccess"&&r({emailAddress:f.emailAddress,walletAddress:f.walletAddress})};return window.addEventListener("message",u),()=>{window.removeEventListener("message",u)}},[]);let l=()=>{P(!0)};return v.default.createElement(v.default.Fragment,null,t&&a&&v.default.createElement(v.default.Fragment,null,v.default.createElement("iframe",{src:`${k}/sdk/v1/verify-email?email=${encodeURIComponent(t)}&chainName=${o}&date=${Date.now().toString()}`,style:{width:"0px",height:"0px",visibility:"hidden"}})),i?v.default.createElement("a",{onClick:l},i):v.default.createElement(I,{onClick:l},"Verify Email"))};var w=L(require("react"));function H({url:t,windowName:r,win:e,w:n,h:i}){var f,x,c,E;let a=((f=e==null?void 0:e.top)==null?void 0:f.outerHeight)||100,P=((x=e==null?void 0:e.top)==null?void 0:x.outerWidth)||100,o=((c=e==null?void 0:e.top)==null?void 0:c.screenX)||100,l=((E=e==null?void 0:e.top)==null?void 0:E.screenY)||100,u=a/2+l-i/2,g=P/2+o-n/2;return e.open(t,r,`toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=${n},height=${i},top=${u},left=${g}`)}var G=({onSuccess:t,onError:r,onWindowClose:e,className:n,children:i})=>{let{chainName:a,clientId:P}=D(),o=typeof i=="function";(0,w.useEffect)(()=>{let g=f=>{let x=f.data;switch(x.eventType){case"userLoginSuccess":t&&t(x.values.accessCode);break;case"userCloseLoginPage":{e&&e();break}case"userLoginFailed":r&&r({code:"User login failed",error:new Error("User login failed")});break;default:}};return window.addEventListener("message",g),()=>{window.removeEventListener("message",g)}},[]);let l=new URL("/sdk/v1/login-with-paper",k);l.searchParams.append("chainName",a),l.searchParams.append("clientId",P);let u=()=>{let g=H({url:l.href,windowName:"PaperLogin",win:window,w:400,h:600});g==null||g.focus()};return w.default.createElement(w.default.Fragment,null,i&&o?i({onClick:u}):i?w.default.createElement("a",{onClick:u},i," "):w.default.createElement(I,{onClick:u,className:n},w.default.createElement("span",{style:{marginRight:"10px"}},"Verify Ownership with Paper"),w.default.createElement("svg",{width:"15",height:"30",viewBox:"0 0 26 49",fill:"none",xmlns:"http://www.w3.org/2000/svg"},w.default.createElement("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M25.8824 8.91421C25.8824 8.47803 25.5996 8.09218 25.1838 7.96071L0 0V11.7963L14.7899 16.276L2.77311 24.5V34.4815L5.58074 37.3767L3.1009 39.6283C2.89214 39.8178 2.77311 40.0867 2.77311 40.3687V49L11.0924 42.6481V32.6667L8.60325 30.5207L25.8824 19.963V8.91421Z",fill:"#19A8D6"}),w.default.createElement("path",{d:"M25.8824 8.91421C25.8824 8.47803 25.5996 8.09218 25.1838 7.96071L0 0V11.7963L25.8824 19.963V8.91421Z",fill:"#39D0FF"}),w.default.createElement("path",{d:"M11.0924 32.6667L2.77311 24.5V34.4815L11.0924 42.6481V32.6667Z",fill:"#39D0FF"}))))};var s=L(require("react"));var z=(a=>(a.POPUP="POPUP",a.NEW_TAB="NEW_TAB",a.MODAL="MODAL",a.DRAWER="DRAWER",a.EMBED="EMBED",a))(z||{}),ae=({checkoutId:t,display:r="POPUP",recipientWalletAddress:e,emailAddress:n,quantity:i,metadata:a,appName:P,options:o=h({width:400,height:800},T),onOpenCheckout:l,onCloseCheckout:u,onPaymentSuccess:g,onTransferSuccess:f,children:x})=>{let[c,E]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let d=C=>{let N=C.data;switch(N.eventType){case"paymentSuccess":g&&g({id:N.id});break;case"transferSuccess":f&&f({id:N.id});break;case"modalClosed":E(!1),u&&u();break;default:}};return window.addEventListener("message",d),()=>{window.removeEventListener("message",d)}},[]);let p=new URL(`/checkout/${t}`,k);p.searchParams.append("display",r),o.colorPrimary&&p.searchParams.append("colorPrimary",o.colorPrimary),o.colorBackground&&p.searchParams.append("colorBackground",o.colorBackground),o.colorText&&p.searchParams.append("colorText",o.colorText),o.borderRadius!==void 0&&p.searchParams.append("borderRadius",o.borderRadius.toString()),o.fontFamily&&p.searchParams.append("fontFamily",o.fontFamily),P&&p.searchParams.append("appName",P),e&&p.searchParams.append("wallet",e),n&&p.searchParams.append("username",n),i&&p.searchParams.append("quantity",i.toString()),a&&p.searchParams.append("metadata",encodeURIComponent(JSON.stringify(a)));let m=x||s.default.createElement("button",{style:{backgroundColor:"#cf3781",padding:"8px 20px 8px 20px",borderRadius:"8px",color:"white",fontWeight:"bold"}},"Buy Now");switch(r){case"POPUP":return s.default.createElement("a",{onClick:()=>{if(!(window!=null&&window.top))return;let C=window.top.outerHeight/2+window.top.screenY-o.height/2,N=window.top.outerWidth/2+window.top.screenX-o.width/2;window.open(p,"Paper Checkout",`toolbar=no,
location=no,

@@ -27,4 +27,4 @@ status=no,

height=${o.height},
top=${d},
left=${c}`)}},C);case"NEW_TAB":return l.default.createElement("a",{onClick:()=>window.open(i,"_blank")},C);case"MODAL":return l.default.createElement(ae,{clickableElement:C,checkoutUrl:i.href,width:o.width,height:o.height,isOpen:m,setIsOpen:g});case"DRAWER":return l.default.createElement(oe,{clickableElement:C,checkoutUrl:i.href,width:o.width,isOpen:m,setIsOpen:g});case"EMBED":return l.default.createElement("iframe",{src:i.href,width:o.width,height:o.height});default:return console.error(`Invalid or unimplemented display type: ${r}`),l.default.createElement(l.default.Fragment,null)}},v={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,margin:0,zIndex:1,overflow:"hidden",display:"flex",visibility:"hidden",opacity:0,transition:"all 0.2s ease"},overlayIsVisible:{visibility:"visible",opacity:1,backdropFilter:"blur(2px)",background:"#0008"},modalOverlay:{alignItems:"center",justifyContent:"center"},drawerOverlay:{justifyContent:"flex-end"},modalDialog:{position:"relative",overflow:"hidden",borderRadius:"8px",visibility:"hidden",opacity:0,top:"5%",transition:"all 0.2s ease"},modalDialogIsVisible:{visibility:"visible",opacity:1,top:0},drawerDialog:{position:"relative",visibility:"hidden",opacity:0,right:"-10%",transition:"all 0.2s ease"},drawerDialogIsVisible:{visibility:"visible",opacity:1,right:0},modalCloseButton:{position:"absolute",top:"0.1em",right:"0.2em",borderRadius:"8px",fontSize:"x-large",padding:"0 0.4em",color:"#888"}},oe=({clickableElement:t,checkoutUrl:r,width:e,isOpen:s,setIsOpen:a})=>l.default.createElement(l.default.Fragment,null,l.default.createElement("a",{onClick:()=>a(!0)},t),l.default.createElement("div",{className:"paper-overlay",style:p(p(p({},v.overlay),s?v.overlayIsVisible:{}),v.drawerOverlay)},l.default.createElement("div",{className:"paper-drawer",style:p(p({},v.drawerDialog),s?v.drawerDialogIsVisible:{})},l.default.createElement("button",{onClick:()=>a(!1),style:v.modalCloseButton},"\xD7"),l.default.createElement("iframe",{src:r,width:e,height:"100%"})))),ae=({clickableElement:t,checkoutUrl:r,width:e,height:s,isOpen:a,setIsOpen:n})=>l.default.createElement(l.default.Fragment,null,l.default.createElement("a",{onClick:()=>n(!0)},t),l.default.createElement("div",{className:"paper-overlay",style:p(p(p({},v.overlay),a?v.overlayIsVisible:{}),v.modalOverlay)},l.default.createElement("div",{className:"paper-modal",style:p(p({},v.modalDialog),a?v.modalDialogIsVisible:{})},l.default.createElement("button",{onClick:()=>n(!1),style:v.modalCloseButton},"\xD7"),l.default.createElement("iframe",{src:r,width:e,height:s}))));var N=D(require("react"));var H=({url:t,title:r="Paper Checkout",width:e,height:s})=>{if(!(window!=null&&window.top))return null;let a=window.top.outerHeight/2+window.top.screenY-s/2,n=window.top.outerWidth/2+window.top.screenX-e/2;return window.open(t,r,`toolbar=no,
top=${C},
left=${N}`),l&&l()}},m);case"NEW_TAB":return s.default.createElement("a",{onClick:()=>{window.open(p,"_blank"),l&&l()}},m);case"MODAL":{let d=()=>{E(!0),l&&l()},C=()=>{E(!1),u&&u()};return s.default.createElement(se,{clickableElement:m,checkoutUrl:p.href,width:o.width,height:o.height,isOpen:c,onOpen:d,onClose:C})}case"DRAWER":{let d=()=>{E(!0),l&&l()},C=()=>{E(!1),u&&u()};return s.default.createElement(ne,{clickableElement:m,checkoutUrl:p.href,width:o.width,isOpen:c,onOpen:d,onClose:C})}case"EMBED":return s.default.createElement("iframe",{src:p.href,width:o.width,height:o.height});default:return console.error(`Invalid or unimplemented display type: ${r}`),s.default.createElement(s.default.Fragment,null)}},b={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,margin:0,zIndex:1e3,overflow:"hidden",display:"flex",visibility:"hidden",opacity:0,transition:"all 0.2s ease"},overlayIsVisible:{visibility:"visible",opacity:1,backdropFilter:"blur(2px)",background:"#0008"},modalOverlay:{alignItems:"center",justifyContent:"center"},drawerOverlay:{justifyContent:"flex-end"},modalDialog:{position:"relative",overflow:"hidden",borderRadius:"8px",visibility:"hidden",opacity:0,top:"5%",transition:"all 0.2s ease",maxWidth:"100vw"},modalDialogIsVisible:{visibility:"visible",opacity:1,top:0},drawerDialog:{position:"relative",visibility:"hidden",opacity:0,right:"-10%",transition:"all 0.2s ease"},drawerDialogIsVisible:{visibility:"visible",opacity:1,right:0},modalCloseButton:{position:"absolute",top:"0.1em",right:"0.2em",borderRadius:"8px",fontSize:"x-large",padding:"0 0.4em",color:"#888"}},ne=({clickableElement:t,checkoutUrl:r,width:e,isOpen:n,onOpen:i,onClose:a})=>s.default.createElement(s.default.Fragment,null,s.default.createElement("a",{onClick:i},t),s.default.createElement("div",{className:"paper-overlay",style:h(h(h({},b.overlay),n?b.overlayIsVisible:{}),b.drawerOverlay)},s.default.createElement("div",{className:"paper-drawer",style:O(h(h({},b.drawerDialog),n?b.drawerDialogIsVisible:{}),{width:e})},s.default.createElement("button",{onClick:a,style:b.modalCloseButton},"\xD7"),n&&s.default.createElement("iframe",{src:r,width:"100%",height:"100%"})))),se=({clickableElement:t,checkoutUrl:r,width:e,height:n,isOpen:i,onOpen:a,onClose:P})=>{let[o,l]=(0,s.useState)(n);return(0,s.useEffect)(()=>l(window.innerHeight),[]),s.default.createElement(s.default.Fragment,null,s.default.createElement("a",{onClick:a},t),s.default.createElement("div",{className:"paper-overlay",style:h(h(h({},b.overlay),i?b.overlayIsVisible:{}),b.modalOverlay)},s.default.createElement("div",{className:"paper-modal",style:O(h(h({},b.modalDialog),i?b.modalDialogIsVisible:{}),{width:e,height:n,maxHeight:o})},s.default.createElement("button",{onClick:P,style:b.modalCloseButton},"\xD7"),i&&s.default.createElement("iframe",{src:r,width:"100%",height:"100%"}))))};var A=L(require("react"));var X=({url:t,title:r="Paper Checkout",width:e,height:n})=>{if(!(window!=null&&window.top))return null;let i=window.top.outerHeight/2+window.top.screenY-n/2,a=window.top.outerWidth/2+window.top.screenX-e/2;return window.open(t,r,`toolbar=no,
location=no,

@@ -36,5 +36,5 @@ status=no,

width=${e},
height=${s},
top=${a},
left=${n}`)},ie=({checkoutId:t,recipientWalletAddress:r,emailAddress:e,quantity:s,metadata:a,options:n=p({},R),onPaymentSuccess:b,onTransferSuccess:o,onReview:h,onCancel:f,onError:u})=>{let{chainName:m}=S(),g=(0,N.useRef)(null);(0,N.useEffect)(()=>{let C=k=>{var U,O,I,_;if(!k.origin.startsWith(x))return;let d=k.data,c=document.getElementById("payWithCardIframe");switch(d.eventType){case"payWithCardError":console.error("Error in Paper SDK PayWithCard",d.error),u&&u({code:d.code,error:d.error}),(U=c==null?void 0:c.contentWindow)==null||U.postMessage(p({},d),"*");break;case"payWithCardCancel":console.error("Paper SDK PayWithCard cancelled"),f&&f(),(O=c==null?void 0:c.contentWindow)==null||O.postMessage(p({},d),"*");break;case"paymentSuccess":b&&(g.current&&g.current.close(),b({id:d.id})),(I=c==null?void 0:c.contentWindow)==null||I.postMessage(p({},d),"*");break;case"transferSuccess":o&&o({id:d.id}),(_=c==null?void 0:c.contentWindow)==null||_.postMessage(p({},d),"*");break;case"review":h&&h({id:d.id});break;case"openReviewPaymentPopupWindow":g.current=H({url:d.url,width:d.width,height:d.height});break;default:}};return window.addEventListener("message",C),()=>{window.removeEventListener("message",C)}},[]);let i=new URL("/sdk/v1/pay-with-card",x);return i.searchParams.append("checkoutId",t),i.searchParams.append("recipientWalletAddress",r),i.searchParams.append("chainName",m),e&&i.searchParams.append("emailAddress",e),s&&i.searchParams.append("quantity",s.toString()),a&&i.searchParams.append("metadata",encodeURIComponent(JSON.stringify(a))),n.colorPrimary&&i.searchParams.append("colorPrimary",n.colorPrimary),n.colorBackground&&i.searchParams.append("colorBackground",n.colorBackground),n.colorText&&i.searchParams.append("colorText",n.colorText),n.borderRadius!==void 0&&i.searchParams.append("borderRadius",n.borderRadius.toString()),n.fontFamily&&i.searchParams.append("fontFamily",n.fontFamily),i.searchParams.append("date",Date.now().toString()),N.default.createElement("iframe",{id:"payWithCardIframe",src:i.href,width:"100%",height:"100%",allowTransparency:!0})};0&&(module.exports={CreateWallet,LoginWithPaper,PaperCheckout,PaperCheckoutDisplay,PaperSDKErrorCode,PaperSDKProvider,PayWithCard,VerifyOwnershipWithPaper,openCenteredPopup,usePaperSDKContext});
height=${n},
top=${i},
left=${a}`)},le=({checkoutId:t,recipientWalletAddress:r,emailAddress:e,quantity:n,metadata:i,options:a=h({},T),onPaymentSuccess:P,onTransferSuccess:o,onReview:l,onCancel:u,onError:g})=>{let{chainName:f}=D(),x=(0,A.useRef)(null);(0,A.useEffect)(()=>{let E=p=>{var C,N,_,W;if(!p.origin.startsWith(k))return;let m=p.data,d=document.getElementById("payWithCardIframe");switch(m.eventType){case"payWithCardError":console.error("Error in Paper SDK PayWithCard",m.error),g&&g({code:m.code,error:m.error}),(C=d==null?void 0:d.contentWindow)==null||C.postMessage(h({},m),"*");break;case"payWithCardCancel":console.error("Paper SDK PayWithCard cancelled"),u&&u(),(N=d==null?void 0:d.contentWindow)==null||N.postMessage(h({},m),"*");break;case"paymentSuccess":P&&(x.current&&x.current.close(),P({id:m.id})),(_=d==null?void 0:d.contentWindow)==null||_.postMessage(h({},m),"*");break;case"transferSuccess":o&&o({id:m.id}),(W=d==null?void 0:d.contentWindow)==null||W.postMessage(h({},m),"*");break;case"review":l&&l({id:m.id});break;case"openReviewPaymentPopupWindow":x.current=X({url:m.url,width:m.width,height:m.height});break;default:}};return window.addEventListener("message",E),()=>{window.removeEventListener("message",E)}},[]);let c=new URL("/sdk/v1/pay-with-card",k);return c.searchParams.append("checkoutId",t),c.searchParams.append("recipientWalletAddress",r),c.searchParams.append("chainName",f),e&&c.searchParams.append("emailAddress",e),n&&c.searchParams.append("quantity",n.toString()),i&&c.searchParams.append("metadata",encodeURIComponent(JSON.stringify(i))),a.colorPrimary&&c.searchParams.append("colorPrimary",a.colorPrimary),a.colorBackground&&c.searchParams.append("colorBackground",a.colorBackground),a.colorText&&c.searchParams.append("colorText",a.colorText),a.borderRadius!==void 0&&c.searchParams.append("borderRadius",a.borderRadius.toString()),a.fontFamily&&c.searchParams.append("fontFamily",a.fontFamily),c.searchParams.append("date",Date.now().toString()),A.default.createElement("iframe",{id:"payWithCardIframe",src:c.href,width:"100%",height:"100%",allowTransparency:!0})};0&&(module.exports={CreateWallet,LoginWithPaper,PaperCheckout,PaperCheckoutDisplay,PaperSDKErrorCode,PaperSDKProvider,PayWithCard,VerifyOwnershipWithPaper,openCenteredPopup,usePaperSDKContext});
//# sourceMappingURL=index.js.map

@@ -0,1 +1,4 @@

/**
* @deprecated - Paper currently doesn't plan to further develop the wallet product.
*/
export declare type PaperUser = {

@@ -2,0 +5,0 @@ /**

{
"name": "@paperxyz/react-client-sdk",
"version": "0.0.16",
"version": "0.0.17",
"description": "Paper.xyz React Client SDK",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

@@ -0,1 +1,4 @@

/**
* @deprecated - Paper currently doesn't plan to further develop the wallet product.
*/
export type PaperUser = {

@@ -2,0 +5,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc