@crossmint/client-sdk-react-ui 0.2.7-alpha.14 → 0.2.7-alpha.15

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.
@@ -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,58 +1,58 @@
1
- import React, { useEffect, useState } from "react";
2
-
3
- import { crossmintPaymentService, crossmintUiService } from "@crossmint/client-sdk-base";
4
- import type { CrossmintCheckoutEvent, PaymentElement } from "@crossmint/client-sdk-base";
5
-
6
- export function CrossmintPaymentElement(props: PaymentElement) {
7
- const [height, setHeight] = useState(0);
8
- const { getIframeUrl, listenToEvents, emitQueryParams } = crossmintPaymentService(props);
9
- const { listenToEvents: listenToUiEvents } = crossmintUiService({ environment: props.environment });
10
-
11
- useEffect(() => {
12
- listenToEvents((event: MessageEvent<CrossmintCheckoutEvent>) => props.onEvent?.(event.data));
13
- }, [listenToEvents, props.onEvent]);
14
-
15
- useEffect(() => {
16
- listenToUiEvents((event: MessageEvent<any>) => {
17
- const { type, payload } = event.data;
18
-
19
- switch (type) {
20
- case "ui:height.changed":
21
- setHeight(payload.height);
22
- break;
23
- default:
24
- return;
25
- }
26
- });
27
- }, []);
28
-
29
- useEffect(() => {
30
- emitQueryParams({
31
- recipient: props.recipient,
32
- mintConfig: props.mintConfig,
33
- locale: props.locale,
34
- });
35
- }, [emitQueryParams, props.recipient, props.mintConfig, props.locale]);
36
-
37
- const iframeUrl = getIframeUrl();
38
-
39
- return (
40
- <iframe
41
- src={iframeUrl}
42
- id="iframe-crossmint-payment-element"
43
- style={{
44
- border: "none !important",
45
- padding: "0px !important",
46
- width: "100% !important",
47
- minWidth: "100% !important",
48
- overflow: "hidden !important",
49
- display: "block !important",
50
- userSelect: "none",
51
- transform: "translate(0px) !important",
52
- opacity: "1",
53
- transition: "ease 0s, opacity 0.4s ease 0.1s",
54
- height: `${height}px`,
55
- }}
56
- ></iframe>
57
- );
58
- }
1
+ import React, { useEffect, useState } from "react";
2
+
3
+ import { crossmintPaymentService, crossmintUiService } from "@crossmint/client-sdk-base";
4
+ import type { CrossmintCheckoutEvent, PaymentElement } from "@crossmint/client-sdk-base";
5
+
6
+ export function CrossmintPaymentElement(props: PaymentElement) {
7
+ const [height, setHeight] = useState(0);
8
+ const { getIframeUrl, listenToEvents, emitQueryParams } = crossmintPaymentService(props);
9
+ const { listenToEvents: listenToUiEvents } = crossmintUiService({ environment: props.environment });
10
+
11
+ useEffect(() => {
12
+ listenToEvents((event: MessageEvent<CrossmintCheckoutEvent>) => props.onEvent?.(event.data));
13
+ }, [listenToEvents, props.onEvent]);
14
+
15
+ useEffect(() => {
16
+ listenToUiEvents((event: MessageEvent<any>) => {
17
+ const { type, payload } = event.data;
18
+
19
+ switch (type) {
20
+ case "ui:height.changed":
21
+ setHeight(payload.height);
22
+ break;
23
+ default:
24
+ return;
25
+ }
26
+ });
27
+ }, []);
28
+
29
+ useEffect(() => {
30
+ emitQueryParams({
31
+ recipient: props.recipient,
32
+ mintConfig: props.mintConfig,
33
+ locale: props.locale,
34
+ });
35
+ }, [emitQueryParams, props.recipient, props.mintConfig, props.locale]);
36
+
37
+ const iframeUrl = getIframeUrl();
38
+
39
+ return (
40
+ <iframe
41
+ src={iframeUrl}
42
+ id="iframe-crossmint-payment-element"
43
+ style={{
44
+ border: "none !important",
45
+ padding: "0px !important",
46
+ width: "100% !important",
47
+ minWidth: "100% !important",
48
+ overflow: "hidden !important",
49
+ display: "block !important",
50
+ userSelect: "none",
51
+ transform: "translate(0px) !important",
52
+ opacity: "1",
53
+ transition: "ease 0s, opacity 0.4s ease 0.1s",
54
+ height: `${height}px`,
55
+ }}
56
+ ></iframe>
57
+ );
58
+ }