@crossmint/client-sdk-react-ui 0.2.7-alpha.6 → 0.2.7-alpha.7
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/LICENSE +201 -201
- package/README.md +43 -43
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +7 -7
- package/lib/index.js +1 -1
- package/package.json +3 -3
- package/src/CrossmintNFTCollectionView.tsx +30 -30
- package/src/CrossmintNFTDetail.tsx +26 -26
- package/src/CrossmintPayButton.tsx +139 -139
- package/src/CrossmintStatusButton.tsx +85 -85
- package/src/index.ts +4 -4
- package/src/styles/index.ts +50 -50
- package/src/types.ts +12 -12
- package/src/useEnvironment.ts +10 -10
- package/src/version.ts +1 -1
|
@@ -1,30 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,26 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
import React, { FC, MouseEvent, useEffect, useMemo } from "react";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
clientNames,
|
|
6
|
-
crossmintModalService,
|
|
7
|
-
crossmintPayButtonService,
|
|
8
|
-
crossmintStatusService,
|
|
9
|
-
mintingContractTypes,
|
|
10
|
-
onboardingRequestStatusResponse,
|
|
11
|
-
} from "@crossmint/client-sdk-base";
|
|
12
|
-
|
|
13
|
-
import { formatProps, useStyles } from "./styles";
|
|
14
|
-
import { CrossmintPayButtonReactProps } from "./types";
|
|
15
|
-
import useEnvironment from "./useEnvironment";
|
|
16
|
-
import { LIB_VERSION } from "./version";
|
|
17
|
-
|
|
18
|
-
const defaultMintConfig: any = {
|
|
19
|
-
type: mintingContractTypes.CANDY_MACHINE,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export function CrossmintPayButton({
|
|
23
|
-
className,
|
|
24
|
-
disabled,
|
|
25
|
-
onClick,
|
|
26
|
-
style,
|
|
27
|
-
tabIndex,
|
|
28
|
-
theme = "dark",
|
|
29
|
-
mintTo,
|
|
30
|
-
emailTo,
|
|
31
|
-
listingId,
|
|
32
|
-
clientId,
|
|
33
|
-
auctionId,
|
|
34
|
-
hideMintOnInactiveClient = false,
|
|
35
|
-
showOverlay = true,
|
|
36
|
-
mintConfig = defaultMintConfig,
|
|
37
|
-
whPassThroughArgs,
|
|
38
|
-
environment,
|
|
39
|
-
paymentMethod,
|
|
40
|
-
preferredSigninMethod,
|
|
41
|
-
dismissOverlayOnClick,
|
|
42
|
-
prepay,
|
|
43
|
-
locale = "en-US",
|
|
44
|
-
currency = "USD",
|
|
45
|
-
successCallbackURL = "",
|
|
46
|
-
failureCallbackURL = "",
|
|
47
|
-
...props
|
|
48
|
-
}: CrossmintPayButtonReactProps) {
|
|
49
|
-
const [connecting, setConnecting] = useState(false);
|
|
50
|
-
const [status, setStatus] = useState(onboardingRequestStatusResponse.WAITING_SUBMISSION);
|
|
51
|
-
const { isServerSideRendering } = useEnvironment();
|
|
52
|
-
|
|
53
|
-
const { fetchClientIntegration } = crossmintStatusService({
|
|
54
|
-
libVersion: LIB_VERSION,
|
|
55
|
-
clientId,
|
|
56
|
-
environment,
|
|
57
|
-
auctionId,
|
|
58
|
-
mintConfig,
|
|
59
|
-
setStatus,
|
|
60
|
-
clientName: clientNames.reactUi,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const { connect } = crossmintModalService({
|
|
64
|
-
clientId,
|
|
65
|
-
showOverlay,
|
|
66
|
-
dismissOverlayOnClick,
|
|
67
|
-
setConnecting,
|
|
68
|
-
libVersion: LIB_VERSION,
|
|
69
|
-
environment,
|
|
70
|
-
clientName: clientNames.reactUi,
|
|
71
|
-
locale,
|
|
72
|
-
currency,
|
|
73
|
-
successCallbackURL,
|
|
74
|
-
failureCallbackURL,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const { getButtonText, shouldHideButton, handleClick } = crossmintPayButtonService({
|
|
78
|
-
onClick,
|
|
79
|
-
connecting,
|
|
80
|
-
paymentMethod,
|
|
81
|
-
locale,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
if (hideMintOnInactiveClient) {
|
|
86
|
-
fetchClientIntegration();
|
|
87
|
-
}
|
|
88
|
-
}, [status]);
|
|
89
|
-
|
|
90
|
-
const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>
|
|
91
|
-
handleClick(event, () => {
|
|
92
|
-
connect(
|
|
93
|
-
mintConfig,
|
|
94
|
-
mintTo,
|
|
95
|
-
emailTo,
|
|
96
|
-
listingId,
|
|
97
|
-
whPassThroughArgs,
|
|
98
|
-
paymentMethod,
|
|
99
|
-
preferredSigninMethod,
|
|
100
|
-
prepay
|
|
101
|
-
);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
const classes = useStyles(formatProps(theme));
|
|
105
|
-
|
|
106
|
-
const content = useMemo(() => {
|
|
107
|
-
return (
|
|
108
|
-
<span className={classes.crossmintParagraph} role="button-paragraph">
|
|
109
|
-
{getButtonText(connecting)}
|
|
110
|
-
</span>
|
|
111
|
-
);
|
|
112
|
-
}, [connecting]);
|
|
113
|
-
|
|
114
|
-
if (shouldHideButton({ hideMintOnInactiveClient, status })) {
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return (
|
|
119
|
-
<>
|
|
120
|
-
{!isServerSideRendering && (
|
|
121
|
-
<button
|
|
122
|
-
className={`${classes.crossmintButton} ${className || ""}`}
|
|
123
|
-
disabled={disabled}
|
|
124
|
-
onClick={_handleClick}
|
|
125
|
-
style={{ ...style }}
|
|
126
|
-
tabIndex={tabIndex}
|
|
127
|
-
{...props}
|
|
128
|
-
>
|
|
129
|
-
<img
|
|
130
|
-
className={classes.crossmintImg}
|
|
131
|
-
src="https://www.crossmint.io/assets/crossmint/logo.svg"
|
|
132
|
-
alt="Crossmint logo"
|
|
133
|
-
/>
|
|
134
|
-
{content}
|
|
135
|
-
</button>
|
|
136
|
-
)}
|
|
137
|
-
</>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
1
|
+
import React, { FC, MouseEvent, useEffect, useMemo } from "react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
clientNames,
|
|
6
|
+
crossmintModalService,
|
|
7
|
+
crossmintPayButtonService,
|
|
8
|
+
crossmintStatusService,
|
|
9
|
+
mintingContractTypes,
|
|
10
|
+
onboardingRequestStatusResponse,
|
|
11
|
+
} from "@crossmint/client-sdk-base";
|
|
12
|
+
|
|
13
|
+
import { formatProps, useStyles } from "./styles";
|
|
14
|
+
import { CrossmintPayButtonReactProps } from "./types";
|
|
15
|
+
import useEnvironment from "./useEnvironment";
|
|
16
|
+
import { LIB_VERSION } from "./version";
|
|
17
|
+
|
|
18
|
+
const defaultMintConfig: any = {
|
|
19
|
+
type: mintingContractTypes.CANDY_MACHINE,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function CrossmintPayButton({
|
|
23
|
+
className,
|
|
24
|
+
disabled,
|
|
25
|
+
onClick,
|
|
26
|
+
style,
|
|
27
|
+
tabIndex,
|
|
28
|
+
theme = "dark",
|
|
29
|
+
mintTo,
|
|
30
|
+
emailTo,
|
|
31
|
+
listingId,
|
|
32
|
+
clientId,
|
|
33
|
+
auctionId,
|
|
34
|
+
hideMintOnInactiveClient = false,
|
|
35
|
+
showOverlay = true,
|
|
36
|
+
mintConfig = defaultMintConfig,
|
|
37
|
+
whPassThroughArgs,
|
|
38
|
+
environment,
|
|
39
|
+
paymentMethod,
|
|
40
|
+
preferredSigninMethod,
|
|
41
|
+
dismissOverlayOnClick,
|
|
42
|
+
prepay,
|
|
43
|
+
locale = "en-US",
|
|
44
|
+
currency = "USD",
|
|
45
|
+
successCallbackURL = "",
|
|
46
|
+
failureCallbackURL = "",
|
|
47
|
+
...props
|
|
48
|
+
}: CrossmintPayButtonReactProps) {
|
|
49
|
+
const [connecting, setConnecting] = useState(false);
|
|
50
|
+
const [status, setStatus] = useState(onboardingRequestStatusResponse.WAITING_SUBMISSION);
|
|
51
|
+
const { isServerSideRendering } = useEnvironment();
|
|
52
|
+
|
|
53
|
+
const { fetchClientIntegration } = crossmintStatusService({
|
|
54
|
+
libVersion: LIB_VERSION,
|
|
55
|
+
clientId,
|
|
56
|
+
environment,
|
|
57
|
+
auctionId,
|
|
58
|
+
mintConfig,
|
|
59
|
+
setStatus,
|
|
60
|
+
clientName: clientNames.reactUi,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const { connect } = crossmintModalService({
|
|
64
|
+
clientId,
|
|
65
|
+
showOverlay,
|
|
66
|
+
dismissOverlayOnClick,
|
|
67
|
+
setConnecting,
|
|
68
|
+
libVersion: LIB_VERSION,
|
|
69
|
+
environment,
|
|
70
|
+
clientName: clientNames.reactUi,
|
|
71
|
+
locale,
|
|
72
|
+
currency,
|
|
73
|
+
successCallbackURL,
|
|
74
|
+
failureCallbackURL,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const { getButtonText, shouldHideButton, handleClick } = crossmintPayButtonService({
|
|
78
|
+
onClick,
|
|
79
|
+
connecting,
|
|
80
|
+
paymentMethod,
|
|
81
|
+
locale,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (hideMintOnInactiveClient) {
|
|
86
|
+
fetchClientIntegration();
|
|
87
|
+
}
|
|
88
|
+
}, [status]);
|
|
89
|
+
|
|
90
|
+
const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>
|
|
91
|
+
handleClick(event, () => {
|
|
92
|
+
connect(
|
|
93
|
+
mintConfig,
|
|
94
|
+
mintTo,
|
|
95
|
+
emailTo,
|
|
96
|
+
listingId,
|
|
97
|
+
whPassThroughArgs,
|
|
98
|
+
paymentMethod,
|
|
99
|
+
preferredSigninMethod,
|
|
100
|
+
prepay
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const classes = useStyles(formatProps(theme));
|
|
105
|
+
|
|
106
|
+
const content = useMemo(() => {
|
|
107
|
+
return (
|
|
108
|
+
<span className={classes.crossmintParagraph} role="button-paragraph">
|
|
109
|
+
{getButtonText(connecting)}
|
|
110
|
+
</span>
|
|
111
|
+
);
|
|
112
|
+
}, [connecting]);
|
|
113
|
+
|
|
114
|
+
if (shouldHideButton({ hideMintOnInactiveClient, status })) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<>
|
|
120
|
+
{!isServerSideRendering && (
|
|
121
|
+
<button
|
|
122
|
+
className={`${classes.crossmintButton} ${className || ""}`}
|
|
123
|
+
disabled={disabled}
|
|
124
|
+
onClick={_handleClick}
|
|
125
|
+
style={{ ...style }}
|
|
126
|
+
tabIndex={tabIndex}
|
|
127
|
+
{...props}
|
|
128
|
+
>
|
|
129
|
+
<img
|
|
130
|
+
className={classes.crossmintImg}
|
|
131
|
+
src="https://www.crossmint.io/assets/crossmint/logo.svg"
|
|
132
|
+
alt="Crossmint logo"
|
|
133
|
+
/>
|
|
134
|
+
{content}
|
|
135
|
+
</button>
|
|
136
|
+
)}
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import React, { FC, MouseEventHandler, useEffect, useMemo, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
baseUrls,
|
|
5
|
-
clientNames,
|
|
6
|
-
crossmintStatusButtonService,
|
|
7
|
-
crossmintStatusService,
|
|
8
|
-
onboardingRequestStatusResponse,
|
|
9
|
-
} from "@crossmint/client-sdk-base";
|
|
10
|
-
|
|
11
|
-
import { formatProps, useStyles } from "./styles";
|
|
12
|
-
import { CrossmintStatusButtonReactProps } from "./types";
|
|
13
|
-
import useEnvironment from "./useEnvironment";
|
|
14
|
-
import { LIB_VERSION } from "./version";
|
|
15
|
-
|
|
16
|
-
export function CrossmintStatusButton({
|
|
17
|
-
className,
|
|
18
|
-
disabled,
|
|
19
|
-
onClick,
|
|
20
|
-
style,
|
|
21
|
-
tabIndex,
|
|
22
|
-
theme = "dark",
|
|
23
|
-
clientId,
|
|
24
|
-
auctionId,
|
|
25
|
-
platformId,
|
|
26
|
-
mintConfig,
|
|
27
|
-
environment,
|
|
28
|
-
locale = "en-US",
|
|
29
|
-
...props
|
|
30
|
-
}: CrossmintStatusButtonReactProps) {
|
|
31
|
-
const [status, setStatus] = useState(onboardingRequestStatusResponse.WAITING_SUBMISSION);
|
|
32
|
-
const { isServerSideRendering } = useEnvironment();
|
|
33
|
-
|
|
34
|
-
const { goToOnboarding, fetchClientIntegration } = crossmintStatusService({
|
|
35
|
-
libVersion: LIB_VERSION,
|
|
36
|
-
clientId,
|
|
37
|
-
environment,
|
|
38
|
-
platformId,
|
|
39
|
-
auctionId,
|
|
40
|
-
mintConfig,
|
|
41
|
-
setStatus,
|
|
42
|
-
clientName: clientNames.reactUi,
|
|
43
|
-
});
|
|
44
|
-
const { getButtonText, isButtonDisabled, handleClick } = crossmintStatusButtonService({ onClick, locale });
|
|
45
|
-
|
|
46
|
-
const _handleClick: MouseEventHandler<HTMLButtonElement> = (e) => handleClick(e, status, goToOnboarding);
|
|
47
|
-
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
fetchClientIntegration();
|
|
50
|
-
|
|
51
|
-
const interval = setInterval(() => {
|
|
52
|
-
fetchClientIntegration();
|
|
53
|
-
}, 60 * 1000);
|
|
54
|
-
|
|
55
|
-
return () => clearInterval(interval);
|
|
56
|
-
}, []);
|
|
57
|
-
|
|
58
|
-
const classes = useStyles(formatProps(theme));
|
|
59
|
-
|
|
60
|
-
const content = useMemo(() => {
|
|
61
|
-
return <span className={classes.crossmintParagraph}>{getButtonText(status)}</span>;
|
|
62
|
-
}, [status]);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<>
|
|
66
|
-
{!isServerSideRendering && (
|
|
67
|
-
<button
|
|
68
|
-
className={`${classes.crossmintButton} ${className || ""}`}
|
|
69
|
-
disabled={isButtonDisabled(status)}
|
|
70
|
-
onClick={_handleClick}
|
|
71
|
-
style={{ ...style }}
|
|
72
|
-
tabIndex={tabIndex}
|
|
73
|
-
{...props}
|
|
74
|
-
>
|
|
75
|
-
<img
|
|
76
|
-
className={classes.crossmintImg}
|
|
77
|
-
src={`${baseUrls.prod}/assets/crossmint/logo.svg`}
|
|
78
|
-
alt="Crossmint logo"
|
|
79
|
-
/>
|
|
80
|
-
{content}
|
|
81
|
-
</button>
|
|
82
|
-
)}
|
|
83
|
-
</>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
1
|
+
import React, { FC, MouseEventHandler, useEffect, useMemo, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
baseUrls,
|
|
5
|
+
clientNames,
|
|
6
|
+
crossmintStatusButtonService,
|
|
7
|
+
crossmintStatusService,
|
|
8
|
+
onboardingRequestStatusResponse,
|
|
9
|
+
} from "@crossmint/client-sdk-base";
|
|
10
|
+
|
|
11
|
+
import { formatProps, useStyles } from "./styles";
|
|
12
|
+
import { CrossmintStatusButtonReactProps } from "./types";
|
|
13
|
+
import useEnvironment from "./useEnvironment";
|
|
14
|
+
import { LIB_VERSION } from "./version";
|
|
15
|
+
|
|
16
|
+
export function CrossmintStatusButton({
|
|
17
|
+
className,
|
|
18
|
+
disabled,
|
|
19
|
+
onClick,
|
|
20
|
+
style,
|
|
21
|
+
tabIndex,
|
|
22
|
+
theme = "dark",
|
|
23
|
+
clientId,
|
|
24
|
+
auctionId,
|
|
25
|
+
platformId,
|
|
26
|
+
mintConfig,
|
|
27
|
+
environment,
|
|
28
|
+
locale = "en-US",
|
|
29
|
+
...props
|
|
30
|
+
}: CrossmintStatusButtonReactProps) {
|
|
31
|
+
const [status, setStatus] = useState(onboardingRequestStatusResponse.WAITING_SUBMISSION);
|
|
32
|
+
const { isServerSideRendering } = useEnvironment();
|
|
33
|
+
|
|
34
|
+
const { goToOnboarding, fetchClientIntegration } = crossmintStatusService({
|
|
35
|
+
libVersion: LIB_VERSION,
|
|
36
|
+
clientId,
|
|
37
|
+
environment,
|
|
38
|
+
platformId,
|
|
39
|
+
auctionId,
|
|
40
|
+
mintConfig,
|
|
41
|
+
setStatus,
|
|
42
|
+
clientName: clientNames.reactUi,
|
|
43
|
+
});
|
|
44
|
+
const { getButtonText, isButtonDisabled, handleClick } = crossmintStatusButtonService({ onClick, locale });
|
|
45
|
+
|
|
46
|
+
const _handleClick: MouseEventHandler<HTMLButtonElement> = (e) => handleClick(e, status, goToOnboarding);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
fetchClientIntegration();
|
|
50
|
+
|
|
51
|
+
const interval = setInterval(() => {
|
|
52
|
+
fetchClientIntegration();
|
|
53
|
+
}, 60 * 1000);
|
|
54
|
+
|
|
55
|
+
return () => clearInterval(interval);
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
const classes = useStyles(formatProps(theme));
|
|
59
|
+
|
|
60
|
+
const content = useMemo(() => {
|
|
61
|
+
return <span className={classes.crossmintParagraph}>{getButtonText(status)}</span>;
|
|
62
|
+
}, [status]);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
{!isServerSideRendering && (
|
|
67
|
+
<button
|
|
68
|
+
className={`${classes.crossmintButton} ${className || ""}`}
|
|
69
|
+
disabled={isButtonDisabled(status)}
|
|
70
|
+
onClick={_handleClick}
|
|
71
|
+
style={{ ...style }}
|
|
72
|
+
tabIndex={tabIndex}
|
|
73
|
+
{...props}
|
|
74
|
+
>
|
|
75
|
+
<img
|
|
76
|
+
className={classes.crossmintImg}
|
|
77
|
+
src={`${baseUrls.prod}/assets/crossmint/logo.svg`}
|
|
78
|
+
alt="Crossmint logo"
|
|
79
|
+
/>
|
|
80
|
+
{content}
|
|
81
|
+
</button>
|
|
82
|
+
)}
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./CrossmintPayButton";
|
|
2
|
-
export * from "./CrossmintStatusButton";
|
|
3
|
-
export * from "./CrossmintNFTCollectionView";
|
|
4
|
-
export * from "./CrossmintNFTDetail";
|
|
1
|
+
export * from "./CrossmintPayButton";
|
|
2
|
+
export * from "./CrossmintStatusButton";
|
|
3
|
+
export * from "./CrossmintNFTCollectionView";
|
|
4
|
+
export * from "./CrossmintNFTDetail";
|
package/src/styles/index.ts
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { createUseStyles } from "react-jss";
|
|
2
|
-
|
|
3
|
-
const DARK_BG = "#1e1e1e";
|
|
4
|
-
|
|
5
|
-
interface CustomStylingProps {
|
|
6
|
-
buttonBgColor?: string;
|
|
7
|
-
paragraphColor?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const themeIsLight = (theme: string) => theme === "light";
|
|
11
|
-
export const formatProps = (theme: string): CustomStylingProps => ({
|
|
12
|
-
buttonBgColor: themeIsLight(theme) ? "white" : DARK_BG,
|
|
13
|
-
paragraphColor: themeIsLight(theme) ? "black" : "white",
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const useStyles = createUseStyles({
|
|
17
|
-
"@global": {
|
|
18
|
-
"@import":
|
|
19
|
-
"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')",
|
|
20
|
-
},
|
|
21
|
-
crossmintButton: {
|
|
22
|
-
display: "flex",
|
|
23
|
-
"flex-direction": "row",
|
|
24
|
-
"align-items": "center",
|
|
25
|
-
padding: "0.875rem 0.875rem",
|
|
26
|
-
"font-weight": "900",
|
|
27
|
-
transition: "opacity ease-in-out 0.25s",
|
|
28
|
-
"border-radius": "0.5rem",
|
|
29
|
-
"font-family": `"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif`,
|
|
30
|
-
outline: "none",
|
|
31
|
-
border: "none",
|
|
32
|
-
"box-shadow": "0px 8px 15px rgba(0, 0, 0, 0.1)",
|
|
33
|
-
"justify-content": "center",
|
|
34
|
-
background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,
|
|
35
|
-
|
|
36
|
-
"&:hover:enabled": {
|
|
37
|
-
opacity: "0.6",
|
|
38
|
-
cursor: "pointer",
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
crossmintImg: {
|
|
42
|
-
width: "21px",
|
|
43
|
-
height: "21px",
|
|
44
|
-
"margin-right": "0.875rem",
|
|
45
|
-
},
|
|
46
|
-
crossmintParagraph: {
|
|
47
|
-
color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,
|
|
48
|
-
margin: "0",
|
|
49
|
-
},
|
|
50
|
-
});
|
|
1
|
+
import { createUseStyles } from "react-jss";
|
|
2
|
+
|
|
3
|
+
const DARK_BG = "#1e1e1e";
|
|
4
|
+
|
|
5
|
+
interface CustomStylingProps {
|
|
6
|
+
buttonBgColor?: string;
|
|
7
|
+
paragraphColor?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const themeIsLight = (theme: string) => theme === "light";
|
|
11
|
+
export const formatProps = (theme: string): CustomStylingProps => ({
|
|
12
|
+
buttonBgColor: themeIsLight(theme) ? "white" : DARK_BG,
|
|
13
|
+
paragraphColor: themeIsLight(theme) ? "black" : "white",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const useStyles = createUseStyles({
|
|
17
|
+
"@global": {
|
|
18
|
+
"@import":
|
|
19
|
+
"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')",
|
|
20
|
+
},
|
|
21
|
+
crossmintButton: {
|
|
22
|
+
display: "flex",
|
|
23
|
+
"flex-direction": "row",
|
|
24
|
+
"align-items": "center",
|
|
25
|
+
padding: "0.875rem 0.875rem",
|
|
26
|
+
"font-weight": "900",
|
|
27
|
+
transition: "opacity ease-in-out 0.25s",
|
|
28
|
+
"border-radius": "0.5rem",
|
|
29
|
+
"font-family": `"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif`,
|
|
30
|
+
outline: "none",
|
|
31
|
+
border: "none",
|
|
32
|
+
"box-shadow": "0px 8px 15px rgba(0, 0, 0, 0.1)",
|
|
33
|
+
"justify-content": "center",
|
|
34
|
+
background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,
|
|
35
|
+
|
|
36
|
+
"&:hover:enabled": {
|
|
37
|
+
opacity: "0.6",
|
|
38
|
+
cursor: "pointer",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
crossmintImg: {
|
|
42
|
+
width: "21px",
|
|
43
|
+
height: "21px",
|
|
44
|
+
"margin-right": "0.875rem",
|
|
45
|
+
},
|
|
46
|
+
crossmintParagraph: {
|
|
47
|
+
color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,
|
|
48
|
+
margin: "0",
|
|
49
|
+
},
|
|
50
|
+
});
|