@crossmint/client-sdk-react-ui 0.1.7-alpha.0 → 0.1.7-alpha.1
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/lib/index.cjs +1 -1
- package/lib/index.js +1 -1
- package/package.json +9 -9
- package/src/CrossmintPayButton.tsx +5 -4
- package/src/CrossmintStatusButton.tsx +4 -3
- package/src/useEnvironment.ts +10 -0
- package/src/version.ts +1 -1
- package/src/utils.ts +0 -1
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var lt=Object.create;var b=Object.defineProperty;var ut=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames,v=Object.getOwnPropertySymbols,gt=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var D=(t,s,e)=>s in t?b(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e,u=(t,s)=>{for(var e in s||(s={}))F.call(s,e)&&D(t,e,s[e]);if(v)for(var e of v(s))W.call(s,e)&&D(t,e,s[e]);return t};var P=(t,s)=>{var e={};for(var o in t)F.call(t,o)&&s.indexOf(o)<0&&(e[o]=t[o]);if(t!=null&&v)for(var o of v(t))s.indexOf(o)<0&&W.call(t,o)&&(e[o]=t[o]);return e};var ft=(t,s)=>{for(var e in s)b(t,e,{get:s[e],enumerable:!0})},j=(t,s,e,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let m of pt(s))!F.call(t,m)&&m!==e&&b(t,m,{get:()=>s[m],enumerable:!(o=ut(s,m))||o.enumerable});return t};var K=(t,s,e)=>(e=t!=null?lt(gt(t)):{},j(s||!t||!t.__esModule?b(e,"default",{value:t,enumerable:!0}):e,t)),St=t=>j(b({},"__esModule",{value:!0}),t);var ht={};ft(ht,{CrossmintPayButton:()=>bt,CrossmintStatusButton:()=>It});module.exports=St(ht);var i=K(require("react"),1),$=require("react"),n=require("@crossmint/client-sdk-base");var z=require("react-jss"),dt="#1e1e1e",Y=t=>t==="light",E=t=>({buttonBgColor:Y(t)?"white":dt,paragraphColor:Y(t)?"black":"white"}),w=(0,z.createUseStyles)({"@global":{"@import":"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')"},crossmintButton:{display:"flex","flex-direction":"row","align-items":"center",padding:"0.875rem 0.875rem","font-weight":"900",transition:"opacity ease-in-out 0.25s","border-radius":"0.5rem","font-family":'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif',outline:"none",border:"none","box-shadow":"0px 8px 15px rgba(0, 0, 0, 0.1)","justify-content":"center",background:({buttonBgColor:t})=>t,"&:hover:enabled":{opacity:"0.6",cursor:"pointer"}},crossmintImg:{width:"21px",height:"21px","margin-right":"0.875rem"},crossmintParagraph:{color:({paragraphColor:t})=>t,margin:"0"}});var k=require("react");function h(){let[t,s]=(0,k.useState)(!0);return(0,k.useEffect)(()=>{s(!1)},[]),{isServerSideRendering:t}}var y="0.1.7-alpha.0";var Ct={type:n.mintingContractTypes.CANDY_MACHINE},bt=G=>{var l=G,{className:t,disabled:s,onClick:e,style:o,tabIndex:m,theme:M="dark",collectionTitle:p,collectionDescription:g,collectionPhoto:f,mintTo:R,emailTo:U,listingId:_,clientId:H,auctionId:B,hideMintOnInactiveClient:c=!1,showOverlay:O=!0,mintConfig:x=Ct,whPassThroughArgs:T,environment:S,paymentMethod:N,preferredSigninMethod:L}=l,V=P(l,["className","disabled","onClick","style","tabIndex","theme","collectionTitle","collectionDescription","collectionPhoto","mintTo","emailTo","listingId","clientId","auctionId","hideMintOnInactiveClient","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod"]);let[d,C]=(0,$.useState)(!1),[q,J]=(0,$.useState)(n.onboardingRequestStatusResponse.WAITING_SUBMISSION),{isServerSideRendering:Q}=h(),{fetchClientIntegration:X}=(0,n.crossmintStatusService)({libVersion:y,clientId:H,environment:S,auctionId:B,mintConfig:x,setStatus:J,clientName:n.clientNames.reactUi}),{connect:Z}=(0,n.crossmintModalService)({clientId:H,showOverlay:O,setConnecting:C,libVersion:y,environment:S,clientName:n.clientNames.reactUi}),{checkProps:tt,getButtonText:st,shouldHideButton:et,handleClick:ot}=(0,n.crossmintPayButtonService)({onClick:e,connecting:d,paymentMethod:N}),[nt,rt,it]=tt({collectionTitle:p,collectionPhoto:f,collectionDescription:g});p=nt,g=rt,f=it,(0,i.useEffect)(()=>{c&&X()},[q]);let at=ct=>ot(ct,()=>{Z(x,p,g,f,R,U,_,T,N,L)}),A=w(E(M)),mt=(0,i.useMemo)(()=>i.default.createElement("span",{className:A.crossmintParagraph,role:"button-paragraph"},st(d)),[d]);return et({hideMintOnInactiveClient:c,status:q})?null:i.default.createElement(i.default.Fragment,null,!Q&&i.default.createElement("button",u({className:`${A.crossmintButton} ${t||""}`,disabled:s,onClick:at,style:u({},o),tabIndex:m},V),i.default.createElement("img",{className:A.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.png",alt:"Crossmint logo"}),mt))};var r=K(require("react"),1),a=require("@crossmint/client-sdk-base");var It=H=>{var B=H,{className:t,disabled:s,onClick:e,style:o,tabIndex:m,theme:M="dark",clientId:p,auctionId:g,platformId:f,mintConfig:R,environment:U}=B,_=P(B,["className","disabled","onClick","style","tabIndex","theme","clientId","auctionId","platformId","mintConfig","environment"]);let[c,O]=(0,r.useState)(a.onboardingRequestStatusResponse.WAITING_SUBMISSION),{isServerSideRendering:x}=h(),{goToOnboarding:T,fetchClientIntegration:S}=(0,a.crossmintStatusService)({libVersion:y,clientId:p,environment:U,platformId:f,auctionId:g,mintConfig:R,setStatus:O,clientName:a.clientNames.reactUi}),{getButtonText:N,isButtonDisabled:L,handleClick:V}=(0,a.crossmintStatusButtonService)({onClick:e}),G=C=>V(C,c,T);(0,r.useEffect)(()=>{S();let C=setInterval(()=>{S()},60*1e3);return()=>clearInterval(C)},[]);let l=w(E(M)),d=(0,r.useMemo)(()=>r.default.createElement("span",{className:l.crossmintParagraph},N(c)),[c]);return r.default.createElement(r.default.Fragment,null,!x&&r.default.createElement("button",u({className:`${l.crossmintButton} ${t||""}`,disabled:L(c),onClick:G,style:u({},o),tabIndex:m},_),r.default.createElement("img",{className:l.crossmintImg,src:`${a.baseUrls.prod}/assets/crossmint/logo.png`,alt:"Crossmint logo"}),d))};0&&(module.exports={CrossmintPayButton,CrossmintStatusButton});
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var rt=Object.defineProperty;var B=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var A=(t,s,e)=>s in t?rt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e,i=(t,s)=>{for(var e in s||(s={}))F.call(s,e)&&A(t,e,s[e]);if(B)for(var e of B(s))$.call(s,e)&&A(t,e,s[e]);return t};var x=(t,s)=>{var e={};for(var o in t)F.call(t,o)&&s.indexOf(o)<0&&(e[o]=t[o]);if(t!=null&&B)for(var o of B(t))s.indexOf(o)<0&&$.call(t,o)&&(e[o]=t[o]);return e};import C,{useEffect as lt,useMemo as ut}from"react";import{useState as q}from"react";import{clientNames as D,crossmintModalService as pt,crossmintPayButtonService as gt,crossmintStatusService as ft,mintingContractTypes as St,onboardingRequestStatusResponse as dt}from"@crossmint/client-sdk-base";import{createUseStyles as it}from"react-jss";var at="#1e1e1e",G=t=>t==="light",N=t=>({buttonBgColor:G(t)?"white":at,paragraphColor:G(t)?"black":"white"}),v=it({"@global":{"@import":"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')"},crossmintButton:{display:"flex","flex-direction":"row","align-items":"center",padding:"0.875rem 0.875rem","font-weight":"900",transition:"opacity ease-in-out 0.25s","border-radius":"0.5rem","font-family":'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif',outline:"none",border:"none","box-shadow":"0px 8px 15px rgba(0, 0, 0, 0.1)","justify-content":"center",background:({buttonBgColor:t})=>t,"&:hover:enabled":{opacity:"0.6",cursor:"pointer"}},crossmintImg:{width:"21px",height:"21px","margin-right":"0.875rem"},crossmintParagraph:{color:({paragraphColor:t})=>t,margin:"0"}});import{useEffect as mt,useState as ct}from"react";function S(){let[t,s]=ct(!0);return mt(()=>{s(!1)},[]),{isServerSideRendering:t}}var d="0.1.7-alpha.0";var Ct={type:St.CANDY_MACHINE},Ft=L=>{var r=L,{className:t,disabled:s,onClick:e,style:o,tabIndex:P,theme:E="dark",collectionTitle:a,collectionDescription:m,collectionPhoto:c,mintTo:w,emailTo:k,listingId:M,clientId:R,auctionId:I,hideMintOnInactiveClient:n=!1,showOverlay:U=!0,mintConfig:h=Ct,whPassThroughArgs:_,environment:l,paymentMethod:y,preferredSigninMethod:H}=r,O=x(r,["className","disabled","onClick","style","tabIndex","theme","collectionTitle","collectionDescription","collectionPhoto","mintTo","emailTo","listingId","clientId","auctionId","hideMintOnInactiveClient","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod"]);let[u,p]=q(!1),[V,W]=q(dt.WAITING_SUBMISSION),{isServerSideRendering:j}=S(),{fetchClientIntegration:K}=ft({libVersion:d,clientId:R,environment:l,auctionId:I,mintConfig:h,setStatus:W,clientName:D.reactUi}),{connect:Y}=pt({clientId:R,showOverlay:U,setConnecting:p,libVersion:d,environment:l,clientName:D.reactUi}),{checkProps:z,getButtonText:J,shouldHideButton:Q,handleClick:X}=gt({onClick:e,connecting:u,paymentMethod:y}),[Z,tt,st]=z({collectionTitle:a,collectionPhoto:c,collectionDescription:m});a=Z,m=tt,c=st,lt(()=>{n&&K()},[V]);let et=nt=>X(nt,()=>{Y(h,a,m,c,w,k,M,_,y,H)}),T=v(N(E)),ot=ut(()=>C.createElement("span",{className:T.crossmintParagraph,role:"button-paragraph"},J(u)),[u]);return Q({hideMintOnInactiveClient:n,status:V})?null:C.createElement(C.Fragment,null,!j&&C.createElement("button",i({className:`${T.crossmintButton} ${t||""}`,disabled:s,onClick:et,style:i({},o),tabIndex:P},O),C.createElement("img",{className:T.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.png",alt:"Crossmint logo"}),ot))};import b,{useEffect as bt,useMemo as It,useState as ht}from"react";import{baseUrls as yt,clientNames as Bt,crossmintStatusButtonService as xt,crossmintStatusService as Nt,onboardingRequestStatusResponse as vt}from"@crossmint/client-sdk-base";var Jt=R=>{var I=R,{className:t,disabled:s,onClick:e,style:o,tabIndex:P,theme:E="dark",clientId:a,auctionId:m,platformId:c,mintConfig:w,environment:k}=I,M=x(I,["className","disabled","onClick","style","tabIndex","theme","clientId","auctionId","platformId","mintConfig","environment"]);let[n,U]=ht(vt.WAITING_SUBMISSION),{isServerSideRendering:h}=S(),{goToOnboarding:_,fetchClientIntegration:l}=Nt({libVersion:d,clientId:a,environment:k,platformId:c,auctionId:m,mintConfig:w,setStatus:U,clientName:Bt.reactUi}),{getButtonText:y,isButtonDisabled:H,handleClick:O}=xt({onClick:e}),L=p=>O(p,n,_);bt(()=>{l();let p=setInterval(()=>{l()},60*1e3);return()=>clearInterval(p)},[]);let r=v(N(E)),u=It(()=>b.createElement("span",{className:r.crossmintParagraph},y(n)),[n]);return b.createElement(b.Fragment,null,!h&&b.createElement("button",i({className:`${r.crossmintButton} ${t||""}`,disabled:H(n),onClick:L,style:i({},o),tabIndex:P},M),b.createElement("img",{className:r.crossmintImg,src:`${yt.prod}/assets/crossmint/logo.png`,alt:"Crossmint logo"}),u))};export{Ft as CrossmintPayButton,Jt as CrossmintStatusButton};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossmint/client-sdk-react-ui",
|
|
3
|
-
"version": "0.1.7-alpha.
|
|
3
|
+
"version": "0.1.7-alpha.1",
|
|
4
4
|
"author": "Paella Labs Inc",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": "https://github.com/CrossMint/crossmint-client-sdk",
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"version": "yarn run create-version-file && git add .",
|
|
29
29
|
"prebuild": "yarn run create-version-file",
|
|
30
30
|
"clean": "shx rm -rf lib/*",
|
|
31
|
-
"build": "yarn clean && tsup src/index.ts --format esm,cjs --outDir ./lib --minify --dts",
|
|
31
|
+
"build": "yarn clean && tsup src/index.ts --external react,react-dom --format esm,cjs --outDir ./lib --minify --dts",
|
|
32
32
|
"test": "jest"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@crossmint/client-sdk-base": "^0.1.3-alpha.
|
|
36
|
-
"react": "
|
|
37
|
-
"react-dom": "^17.0.2",
|
|
38
|
-
"react-jss": "^10.9.0",
|
|
35
|
+
"@crossmint/client-sdk-base": "^0.1.3-alpha.1",
|
|
36
|
+
"react-jss": "10.9.1-alpha.1",
|
|
39
37
|
"uuid": "^8.3.2"
|
|
40
38
|
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": ">=17.0.2",
|
|
41
|
+
"react-dom": ">=17.0.2"
|
|
42
|
+
},
|
|
41
43
|
"devDependencies": {
|
|
42
|
-
"@testing-library/jest-dom": "^5.16.2",
|
|
43
|
-
"@testing-library/react": "^12.1.3",
|
|
44
44
|
"@types/jest": "^27.4.1",
|
|
45
45
|
"@types/react": "^17.0.24",
|
|
46
46
|
"@types/react-dom": "^17.0.11",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"ts-jest": "^27.1.3",
|
|
50
50
|
"ts-node-dev": "^1.1.8"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "e385eef7fa9c9c995352993f92352d03af1d8eef"
|
|
53
53
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import { formatProps, useStyles } from "./styles";
|
|
14
14
|
import { CrossmintPayButtonReactProps } from "./types";
|
|
15
|
-
import
|
|
15
|
+
import useEnvironment from "./useEnvironment";
|
|
16
16
|
import { LIB_VERSION } from "./version";
|
|
17
17
|
|
|
18
18
|
const defaultMintConfig: any = {
|
|
@@ -45,6 +45,7 @@ export const CrossmintPayButton: FC<CrossmintPayButtonReactProps> = ({
|
|
|
45
45
|
}) => {
|
|
46
46
|
const [connecting, setConnecting] = useState(false);
|
|
47
47
|
const [status, setStatus] = useState(onboardingRequestStatusResponse.WAITING_SUBMISSION);
|
|
48
|
+
const { isServerSideRendering } = useEnvironment();
|
|
48
49
|
|
|
49
50
|
const { fetchClientIntegration } = crossmintStatusService({
|
|
50
51
|
libVersion: LIB_VERSION,
|
|
@@ -106,9 +107,9 @@ export const CrossmintPayButton: FC<CrossmintPayButtonReactProps> = ({
|
|
|
106
107
|
|
|
107
108
|
const content = useMemo(() => {
|
|
108
109
|
return (
|
|
109
|
-
<
|
|
110
|
+
<span className={classes.crossmintParagraph} role="button-paragraph">
|
|
110
111
|
{getButtonText(connecting)}
|
|
111
|
-
</
|
|
112
|
+
</span>
|
|
112
113
|
);
|
|
113
114
|
}, [connecting]);
|
|
114
115
|
|
|
@@ -118,7 +119,7 @@ export const CrossmintPayButton: FC<CrossmintPayButtonReactProps> = ({
|
|
|
118
119
|
|
|
119
120
|
return (
|
|
120
121
|
<>
|
|
121
|
-
{
|
|
122
|
+
{!isServerSideRendering && (
|
|
122
123
|
<button
|
|
123
124
|
className={`${classes.crossmintButton} ${className || ""}`}
|
|
124
125
|
disabled={disabled}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import { formatProps, useStyles } from "./styles";
|
|
12
12
|
import { CrossmintStatusButtonReactProps } from "./types";
|
|
13
|
-
import
|
|
13
|
+
import useEnvironment from "./useEnvironment";
|
|
14
14
|
import { LIB_VERSION } from "./version";
|
|
15
15
|
|
|
16
16
|
export const CrossmintStatusButton: FC<CrossmintStatusButtonReactProps> = ({
|
|
@@ -28,6 +28,7 @@ export const CrossmintStatusButton: FC<CrossmintStatusButtonReactProps> = ({
|
|
|
28
28
|
...props
|
|
29
29
|
}) => {
|
|
30
30
|
const [status, setStatus] = useState(onboardingRequestStatusResponse.WAITING_SUBMISSION);
|
|
31
|
+
const { isServerSideRendering } = useEnvironment();
|
|
31
32
|
|
|
32
33
|
const { goToOnboarding, fetchClientIntegration } = crossmintStatusService({
|
|
33
34
|
libVersion: LIB_VERSION,
|
|
@@ -56,12 +57,12 @@ export const CrossmintStatusButton: FC<CrossmintStatusButtonReactProps> = ({
|
|
|
56
57
|
const classes = useStyles(formatProps(theme));
|
|
57
58
|
|
|
58
59
|
const content = useMemo(() => {
|
|
59
|
-
return <
|
|
60
|
+
return <span className={classes.crossmintParagraph}>{getButtonText(status)}</span>;
|
|
60
61
|
}, [status]);
|
|
61
62
|
|
|
62
63
|
return (
|
|
63
64
|
<>
|
|
64
|
-
{
|
|
65
|
+
{!isServerSideRendering && (
|
|
65
66
|
<button
|
|
66
67
|
className={`${classes.crossmintButton} ${className || ""}`}
|
|
67
68
|
disabled={isButtonDisabled(status)}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export default function useEnvironment() {
|
|
4
|
+
const [isServerSideRendering, setIsServerSideRendering] = useState(true);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
setIsServerSideRendering(false);
|
|
7
|
+
}, []);
|
|
8
|
+
|
|
9
|
+
return { isServerSideRendering };
|
|
10
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "0.1.7-alpha.
|
|
1
|
+
export const LIB_VERSION = "0.1.7-alpha.1";
|
package/src/utils.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const isClientSide = typeof window !== "undefined";
|