@crossmint/client-sdk-react-ui 0.2.5-alpha.0 → 0.2.6-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/README.md +18 -2
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +6 -2
- package/lib/index.js +1 -1
- package/package.json +3 -3
- package/src/CrossmintNFTCollectionView.tsx +30 -0
- package/src/CrossmintNFTDetail.tsx +26 -0
- package/src/index.ts +2 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@crossmint/client-sdk-react-ui`
|
|
2
2
|
|
|
3
|
-
## You can check the full documentation at [docs.crossmint.
|
|
3
|
+
## You can check the full documentation at [docs.crossmint.com](https://docs.crossmint.com/)
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -14,7 +14,23 @@ First, add the Crossmint Client SDK to your project with the following command:
|
|
|
14
14
|
yarn add @crossmint/client-sdk-react-ui
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
### Add payment button to your site
|
|
18
|
+
|
|
19
|
+
The next steps depend on which chain you're using for your project. For detailed integration instructions, visit our documentation for [Solana](https://docs.crossmint.com/accept-credit-cards/integration-guides/solana-candy-machine/b-i-have-an-existing-candy-machine-website/add-crossmint-for-solana-react.js-next.js), [Polygon](https://docs.crossmint.com/accept-credit-cards/integration-guides/polygon), or [Ethereum](https://docs.crossmint.com/accept-credit-cards/integration-guides/ethereum/add-crossmint-for-ethereum-react.js-next.js).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
### Wallet UI Components
|
|
24
|
+
|
|
25
|
+
We offer two components to help you quickly get up and running with your project using Crossmint wallets:
|
|
26
|
+
|
|
27
|
+
- `CrossmintNFTCollectionView` - Display a grid of NFTs.
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
- `CrossmintNFTDetail` - Display a card showing all NFT related details.
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
Visit [our documentation](https://docs.crossmint.com/docs/wallet-ui-components) for integration instructions.
|
|
18
34
|
|
|
19
35
|
## Migration guide to 0.1.X versions
|
|
20
36
|
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var nt=Object.create;var I=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf,lt=Object.prototype.hasOwnProperty;var ct=(t,o)=>{for(var s in o)I(t,s,{get:o[s],enumerable:!0})},$=(t,o,s,u)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of at(o))!lt.call(t,a)&&a!==s&&I(t,a,{get:()=>o[a],enumerable:!(u=it(o,a))||u.enumerable});return t};var y=(t,o,s)=>(s=t!=null?nt(mt(t)):{},$(o||!t||!t.__esModule?I(s,"default",{value:t,enumerable:!0}):s,t)),ut=t=>$(I({},"__esModule",{value:!0}),t);var Nt={};ct(Nt,{CrossmintNFTCollectionView:()=>St,CrossmintNFTDetail:()=>Ct,CrossmintPayButton:()=>ft,CrossmintStatusButton:()=>dt});module.exports=ut(Nt);var n=y(require("react"),1),A=require("react"),e=require("@crossmint/client-sdk-base");var W=require("react-jss"),pt="#1e1e1e",q=t=>t==="light",B=t=>({buttonBgColor:q(t)?"white":pt,paragraphColor:q(t)?"black":"white"}),x=(0,W.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 P=require("react");function f(){let[t,o]=(0,P.useState)(!0);return(0,P.useEffect)(()=>{o(!1)},[]),{isServerSideRendering:t}}var m="0.2.6-alpha.1";var gt={type:e.mintingContractTypes.CANDY_MACHINE},ft=({className:t,disabled:o,onClick:s,style:u,tabIndex:a,theme:E="dark",mintTo:T,emailTo:V,listingId:F,clientId:d,auctionId:R,hideMintOnInactiveClient:S=!1,showOverlay:M=!0,mintConfig:l=gt,whPassThroughArgs:U,environment:C,paymentMethod:N,preferredSigninMethod:b,dismissOverlayOnClick:k,prepay:_,locale:h="en-US",currency:D="USD",successCallbackURL:p="",failureCallbackURL:O="",...g})=>{let[L,Y]=(0,A.useState)(!1),[G,z]=(0,A.useState)(e.onboardingRequestStatusResponse.WAITING_SUBMISSION),{isServerSideRendering:J}=f(),{fetchClientIntegration:Q}=(0,e.crossmintStatusService)({libVersion:m,clientId:d,environment:C,auctionId:R,mintConfig:l,setStatus:z,clientName:e.clientNames.reactUi}),{connect:X}=(0,e.crossmintModalService)({clientId:d,showOverlay:M,dismissOverlayOnClick:k,setConnecting:Y,libVersion:m,environment:C,clientName:e.clientNames.reactUi,locale:h,currency:D,successCallbackURL:p,failureCallbackURL:O}),{getButtonText:Z,shouldHideButton:tt,handleClick:ot}=(0,e.crossmintPayButtonService)({onClick:s,connecting:L,paymentMethod:N,locale:h});(0,n.useEffect)(()=>{S&&Q()},[G]);let et=rt=>ot(rt,()=>{X(l,T,V,F,U,N,b,_)}),H=x(B(E)),st=(0,n.useMemo)(()=>n.default.createElement("span",{className:H.crossmintParagraph,role:"button-paragraph"},Z(L)),[L]);return tt({hideMintOnInactiveClient:S,status:G})?null:n.default.createElement(n.default.Fragment,null,!J&&n.default.createElement("button",{className:`${H.crossmintButton} ${t||""}`,disabled:o,onClick:et,style:{...u},tabIndex:a,...g},n.default.createElement("img",{className:H.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),st))};var r=y(require("react"),1),i=require("@crossmint/client-sdk-base");var dt=({className:t,disabled:o,onClick:s,style:u,tabIndex:a,theme:E="dark",clientId:T,auctionId:V,platformId:F,mintConfig:d,environment:R,locale:S="en-US",...M})=>{let[l,U]=(0,r.useState)(i.onboardingRequestStatusResponse.WAITING_SUBMISSION),{isServerSideRendering:C}=f(),{goToOnboarding:N,fetchClientIntegration:b}=(0,i.crossmintStatusService)({libVersion:m,clientId:T,environment:R,platformId:F,auctionId:V,mintConfig:d,setStatus:U,clientName:i.clientNames.reactUi}),{getButtonText:k,isButtonDisabled:_,handleClick:h}=(0,i.crossmintStatusButtonService)({onClick:s,locale:S}),D=g=>h(g,l,N);(0,r.useEffect)(()=>{b();let g=setInterval(()=>{b()},60*1e3);return()=>clearInterval(g)},[]);let p=x(B(E)),O=(0,r.useMemo)(()=>r.default.createElement("span",{className:p.crossmintParagraph},k(l)),[l]);return r.default.createElement(r.default.Fragment,null,!C&&r.default.createElement("button",{className:`${p.crossmintButton} ${t||""}`,disabled:_(l),onClick:D,style:{...u},tabIndex:a,...M},r.default.createElement("img",{className:p.crossmintImg,src:`${i.baseUrls.prod}/assets/crossmint/logo.svg`,alt:"Crossmint logo"}),O))};var j=y(require("react"),1),v=require("@crossmint/client-sdk-base");function St(t){(0,v.assertValidNFTCollectionViewProps)(t);let o=(0,v.getNFTCollectionViewSrc)(t,m);return j.createElement("iframe",{src:o,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}var K=y(require("react"),1),w=require("@crossmint/client-sdk-base");function Ct(t){(0,w.assertValidValidateNFTDetailProps)(t);let o=(0,w.getNFTDetailSrc)(t,m);return K.createElement("iframe",{src:o,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}0&&(module.exports={CrossmintNFTCollectionView,CrossmintNFTDetail,CrossmintPayButton,CrossmintStatusButton});
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MouseEvent, CSSProperties, FC } from 'react';
|
|
2
|
-
import { CrossmintPayButtonProps, BaseButtonProps } from '@crossmint/client-sdk-base';
|
|
2
|
+
import { CrossmintPayButtonProps, BaseButtonProps, NFTCollectionViewProps, NFTDetailProps } from '@crossmint/client-sdk-base';
|
|
3
3
|
|
|
4
4
|
interface CrossmintPayButtonReactProps extends CrossmintPayButtonProps {
|
|
5
5
|
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -14,4 +14,8 @@ declare const CrossmintPayButton: FC<CrossmintPayButtonReactProps>;
|
|
|
14
14
|
|
|
15
15
|
declare const CrossmintStatusButton: FC<CrossmintStatusButtonReactProps>;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
declare function CrossmintNFTCollectionView(props: NFTCollectionViewProps): JSX.Element;
|
|
18
|
+
|
|
19
|
+
declare function CrossmintNFTDetail(props: NFTDetailProps): JSX.Element;
|
|
20
|
+
|
|
21
|
+
export { CrossmintNFTCollectionView, CrossmintNFTDetail, CrossmintPayButton, CrossmintStatusButton };
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import l,{useEffect as et,useMemo as st}from"react";import{useState as D}from"react";import{clientNames as O,crossmintModalService as rt,crossmintPayButtonService as nt,crossmintStatusService as it,mintingContractTypes as at,onboardingRequestStatusResponse as mt}from"@crossmint/client-sdk-base";import{createUseStyles as X}from"react-jss";var Z="#1e1e1e",_=t=>t==="light",C=t=>({buttonBgColor:_(t)?"white":Z,paragraphColor:_(t)?"black":"white"}),N=X({"@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 tt,useState as ot}from"react";function m(){let[t,e]=ot(!0);return tt(()=>{e(!1)},[]),{isServerSideRendering:t}}var o="0.2.6-alpha.1";var lt={type:at.CANDY_MACHINE},kt=({className:t,disabled:e,onClick:b,style:h,tabIndex:I,theme:y="dark",mintTo:B,emailTo:x,listingId:P,clientId:u,auctionId:v,hideMintOnInactiveClient:p=!1,showOverlay:w=!0,mintConfig:s=lt,whPassThroughArgs:E,environment:g,paymentMethod:f,preferredSigninMethod:d,dismissOverlayOnClick:T,prepay:V,locale:S="en-US",currency:F="USD",successCallbackURL:i="",failureCallbackURL:R="",...a})=>{let[M,A]=D(!1),[k,G]=D(mt.WAITING_SUBMISSION),{isServerSideRendering:$}=m(),{fetchClientIntegration:q}=it({libVersion:o,clientId:u,environment:g,auctionId:v,mintConfig:s,setStatus:G,clientName:O.reactUi}),{connect:W}=rt({clientId:u,showOverlay:w,dismissOverlayOnClick:T,setConnecting:A,libVersion:o,environment:g,clientName:O.reactUi,locale:S,currency:F,successCallbackURL:i,failureCallbackURL:R}),{getButtonText:j,shouldHideButton:K,handleClick:Y}=nt({onClick:b,connecting:M,paymentMethod:f,locale:S});et(()=>{p&&q()},[k]);let z=Q=>Y(Q,()=>{W(s,B,x,P,E,f,d,V)}),U=N(C(y)),J=st(()=>l.createElement("span",{className:U.crossmintParagraph,role:"button-paragraph"},j(M)),[M]);return K({hideMintOnInactiveClient:p,status:k})?null:l.createElement(l.Fragment,null,!$&&l.createElement("button",{className:`${U.crossmintButton} ${t||""}`,disabled:e,onClick:z,style:{...h},tabIndex:I,...a},l.createElement("img",{className:U.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),J))};import c,{useEffect as ct,useMemo as ut,useState as pt}from"react";import{baseUrls as gt,clientNames as ft,crossmintStatusButtonService as dt,crossmintStatusService as St,onboardingRequestStatusResponse as Ct}from"@crossmint/client-sdk-base";var qt=({className:t,disabled:e,onClick:b,style:h,tabIndex:I,theme:y="dark",clientId:B,auctionId:x,platformId:P,mintConfig:u,environment:v,locale:p="en-US",...w})=>{let[s,E]=pt(Ct.WAITING_SUBMISSION),{isServerSideRendering:g}=m(),{goToOnboarding:f,fetchClientIntegration:d}=St({libVersion:o,clientId:B,environment:v,platformId:P,auctionId:x,mintConfig:u,setStatus:E,clientName:ft.reactUi}),{getButtonText:T,isButtonDisabled:V,handleClick:S}=dt({onClick:b,locale:p}),F=a=>S(a,s,f);ct(()=>{d();let a=setInterval(()=>{d()},60*1e3);return()=>clearInterval(a)},[]);let i=N(C(y)),R=ut(()=>c.createElement("span",{className:i.crossmintParagraph},T(s)),[s]);return c.createElement(c.Fragment,null,!g&&c.createElement("button",{className:`${i.crossmintButton} ${t||""}`,disabled:V(s),onClick:F,style:{...h},tabIndex:I,...w},c.createElement("img",{className:i.crossmintImg,src:`${gt.prod}/assets/crossmint/logo.svg`,alt:"Crossmint logo"}),R))};import*as L from"react";import{assertValidNFTCollectionViewProps as Nt,getNFTCollectionViewSrc as bt}from"@crossmint/client-sdk-base";function zt(t){Nt(t);let e=bt(t,o);return L.createElement("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}import*as H from"react";import{assertValidValidateNFTDetailProps as ht,getNFTDetailSrc as It}from"@crossmint/client-sdk-base";function to(t){ht(t);let e=It(t,o);return H.createElement("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}export{zt as CrossmintNFTCollectionView,to as CrossmintNFTDetail,kt as CrossmintPayButton,qt as CrossmintStatusButton};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossmint/client-sdk-react-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6-alpha.1",
|
|
4
4
|
"author": "Paella Labs Inc",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": "https://github.com/CrossMint/crossmint-client-sdk",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"test": "jest"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@crossmint/client-sdk-base": "^0.2.
|
|
35
|
+
"@crossmint/client-sdk-base": "^0.2.6-alpha.1",
|
|
36
36
|
"react-jss": "10.9.2",
|
|
37
37
|
"uuid": "^8.3.2"
|
|
38
38
|
},
|
|
@@ -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": "553b3f9876a13a008c837dc35fd5e8b315c568d8"
|
|
53
53
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
NFTCollectionViewProps,
|
|
5
|
+
assertValidNFTCollectionViewProps,
|
|
6
|
+
getNFTCollectionViewSrc,
|
|
7
|
+
} from "@crossmint/client-sdk-base";
|
|
8
|
+
|
|
9
|
+
import { LIB_VERSION } from "./version";
|
|
10
|
+
|
|
11
|
+
export function CrossmintNFTCollectionView(props: NFTCollectionViewProps) {
|
|
12
|
+
assertValidNFTCollectionViewProps(props);
|
|
13
|
+
|
|
14
|
+
const src = getNFTCollectionViewSrc(props, LIB_VERSION);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<iframe
|
|
18
|
+
src={src}
|
|
19
|
+
width="100%"
|
|
20
|
+
height="100%"
|
|
21
|
+
style={{
|
|
22
|
+
flexGrow: "1",
|
|
23
|
+
border: "none",
|
|
24
|
+
margin: "0",
|
|
25
|
+
padding: "0",
|
|
26
|
+
}}
|
|
27
|
+
role="nft-collection-view"
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { NFTDetailProps, assertValidValidateNFTDetailProps, getNFTDetailSrc } from "@crossmint/client-sdk-base";
|
|
4
|
+
|
|
5
|
+
import { LIB_VERSION } from "./version";
|
|
6
|
+
|
|
7
|
+
export function CrossmintNFTDetail(props: NFTDetailProps) {
|
|
8
|
+
assertValidValidateNFTDetailProps(props);
|
|
9
|
+
|
|
10
|
+
const src = getNFTDetailSrc(props, LIB_VERSION);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<iframe
|
|
14
|
+
src={src}
|
|
15
|
+
width="100%"
|
|
16
|
+
height="100%"
|
|
17
|
+
style={{
|
|
18
|
+
flexGrow: "1",
|
|
19
|
+
border: "none",
|
|
20
|
+
margin: "0",
|
|
21
|
+
padding: "0",
|
|
22
|
+
}}
|
|
23
|
+
role="nft-details"
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
}
|
package/src/index.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "0.2.
|
|
1
|
+
export const LIB_VERSION = "0.2.6-alpha.1";
|