@gluwa/connect-kit 0.2.0-next.8 → 0.2.1-next.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/CHANGELOG.md +37 -0
- package/assets/wc.png +0 -0
- package/dist/{chunk-VE5LB7BN.js → chunk-CJANPJHY.js} +4 -2
- package/dist/credit-connect.js +1 -1
- package/dist/index.css +211 -156
- package/dist/index.d.ts +4 -1
- package/dist/index.js +521 -197
- package/dist/package.json +1 -1
- package/package.json +6 -6
- package/src/ConnectKitProvider.tsx +8 -1
- package/src/components/qrArea/index.tsx +28 -4
- package/src/components/qrArea/style.scss +85 -34
- package/src/components/toast/index.tsx +41 -0
- package/src/components/toast/style.scss +108 -0
- package/src/core/config.ts +23 -2
- package/src/core/deeplinkSignal.ts +25 -0
- package/src/creditConnectConnector.ts +15 -5
- package/src/events/account.ts +15 -6
- package/src/hooks/useConnectBanner.ts +79 -0
- package/src/hooks/useConnectTimeout.ts +21 -9
- package/src/hooks/useMetaMaskExtension.ts +30 -0
- package/src/hooks/useWCState.ts +14 -10
- package/src/hooks/useWagmiConnect.ts +42 -20
- package/src/index.ts +1 -0
- package/src/layout/allWallets/index.tsx +17 -3
- package/src/layout/allWallets/style.scss +2 -7
- package/src/layout/connectDialog/asset/warningIcon.tsx +21 -0
- package/src/layout/connectDialog/idle/assets/banner-placeholder.png +0 -0
- package/src/layout/connectDialog/idle/index.tsx +40 -16
- package/src/layout/connectDialog/idle/style.scss +42 -51
- package/src/layout/connectDialog/index.tsx +196 -47
- package/src/layout/connectDialog/metaMask/index.tsx +3 -2
- package/src/layout/connectDialog/qr/index.tsx +3 -1
- package/src/layout/connectDialog/style.scss +2 -49
- package/src/layout/connectDialog/timeout/index.tsx +0 -5
- package/src/layout/connectDialog/timeout/style.scss +0 -5
- package/src/layout/connectDialog/walletQR/index.tsx +3 -1
- package/src/layout/detailPanel/index.tsx +39 -6
- package/src/layout/detailPanel/style.scss +7 -1
- package/src/layout/selectorPanel/index.tsx +1 -0
- package/src/types.ts +20 -0
- package/src/utils/platform.ts +7 -4
- package/src/wallet-display-override.ts +15 -0
- package/src/components/snackbar/index.tsx +0 -25
- package/src/components/snackbar/style.scss +0 -51
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
.ck-detail {
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
|
+
min-width: 0;
|
|
6
7
|
background: var(--semantic-paper-dialog);
|
|
7
8
|
min-height: 0;
|
|
8
9
|
position: relative;
|
|
@@ -12,11 +13,12 @@
|
|
|
12
13
|
.ck-detail-header {
|
|
13
14
|
display: flex;
|
|
14
15
|
align-items: center;
|
|
16
|
+
position: relative;
|
|
17
|
+
z-index: 1;
|
|
15
18
|
gap: 10px;
|
|
16
19
|
height: 60px;
|
|
17
20
|
padding: 0 20px;
|
|
18
21
|
flex-shrink: 0;
|
|
19
|
-
background: var(--semantic-paper-sheet);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
.ck-btn-back {
|
|
@@ -61,4 +63,8 @@
|
|
|
61
63
|
overflow-y: auto;
|
|
62
64
|
padding: 20px;
|
|
63
65
|
@include themedScrollbar;
|
|
66
|
+
|
|
67
|
+
&:has(.ck-all-wallets) {
|
|
68
|
+
padding-bottom: 0;
|
|
69
|
+
}
|
|
64
70
|
}
|
package/src/types.ts
CHANGED
|
@@ -37,6 +37,26 @@ export type WCSubView = 'qr' | 'list' | 'wallet';
|
|
|
37
37
|
|
|
38
38
|
export type ConnectKitTheme = 'light' | 'dark';
|
|
39
39
|
|
|
40
|
+
export type ConnectBannerSiteKey =
|
|
41
|
+
| 'penguin-swap'
|
|
42
|
+
| 'penguin-bridge'
|
|
43
|
+
| 'penguin-base'
|
|
44
|
+
| 'penguin-wallet';
|
|
45
|
+
|
|
46
|
+
export interface ConnectBanner {
|
|
47
|
+
id: number;
|
|
48
|
+
siteKey: ConnectBannerSiteKey;
|
|
49
|
+
title: string;
|
|
50
|
+
subtitle: string;
|
|
51
|
+
linkText: string;
|
|
52
|
+
linkUrl: string;
|
|
53
|
+
imageUrl: string;
|
|
54
|
+
titleColor: string;
|
|
55
|
+
subtitleColor: string;
|
|
56
|
+
linkTextColor: string;
|
|
57
|
+
closeColor: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
40
60
|
export interface ConnectResult {
|
|
41
61
|
address: `0x${string}`;
|
|
42
62
|
connectorId: ConnectorId;
|
package/src/utils/platform.ts
CHANGED
|
@@ -3,6 +3,13 @@ export const isMobileDevice = (): boolean => {
|
|
|
3
3
|
return /android|iphone|ipad|ipod/i.test(navigator.userAgent);
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
+
// 인앱 지갑 웹뷰 판별: 모바일 + 호스트가 window.ethereum(EIP-1193) 을 주입한 경우.
|
|
7
|
+
export const hasInjectedMobileProvider = (): boolean => {
|
|
8
|
+
if (!isMobileDevice()) return false;
|
|
9
|
+
if (typeof window === 'undefined') return false;
|
|
10
|
+
return typeof (window as Window & { ethereum?: unknown }).ethereum !== 'undefined';
|
|
11
|
+
};
|
|
12
|
+
|
|
6
13
|
export const tryOpenDeepLink = (uri: string, deepLinkBase: string): void => {
|
|
7
14
|
const sep = deepLinkBase.endsWith('/') ? '' : '/';
|
|
8
15
|
window.location.replace(`${deepLinkBase}${sep}wc?uri=${encodeURIComponent(uri)}`);
|
|
@@ -13,7 +20,3 @@ export const tryOpenDeepLink = (uri: string, deepLinkBase: string): void => {
|
|
|
13
20
|
export const tryOpenCreditWalletDeeplink = (payloadUrl: string): void => {
|
|
14
21
|
window.location.replace(`creditwallet://?uri=${encodeURIComponent(payloadUrl)}`);
|
|
15
22
|
};
|
|
16
|
-
|
|
17
|
-
export const detectMetaMaskExtension = (): boolean =>
|
|
18
|
-
typeof window !== 'undefined' &&
|
|
19
|
-
Boolean((window as Window & { ethereum?: { isMetaMask?: boolean } }).ethereum?.isMetaMask);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import penguinWalletIcon from '../assets/penguinwallet.png';
|
|
2
|
+
import type { WCWallet } from './types';
|
|
3
|
+
|
|
4
|
+
// TODO-CRCN-11: WC에 PenguinWallet 추가 시 삭제
|
|
5
|
+
export const CREDIT_WALLET_LISTING_ID =
|
|
6
|
+
'ce02f1ae74686234eabfa7d31876c442779b730dfe7924a3ca0e6559a7afa30f';
|
|
7
|
+
|
|
8
|
+
export const overrideWalletDisplay = (wallet: WCWallet): WCWallet =>
|
|
9
|
+
wallet.id === CREDIT_WALLET_LISTING_ID
|
|
10
|
+
? {
|
|
11
|
+
...wallet,
|
|
12
|
+
name: 'PenguinWallet',
|
|
13
|
+
imageUrl: penguinWalletIcon,
|
|
14
|
+
}
|
|
15
|
+
: wallet;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type FC } from 'react';
|
|
2
|
-
import './style.scss';
|
|
3
|
-
import { CloseIcon } from '../../layout/connectDialog/asset/closeIcon';
|
|
4
|
-
import { CheckIcon } from '../../layout/connectDialog/asset/checkIcon';
|
|
5
|
-
|
|
6
|
-
interface SnackbarProps {
|
|
7
|
-
message: string;
|
|
8
|
-
onClose?: () => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const Snackbar: FC<SnackbarProps> = ({ message, onClose }) => {
|
|
12
|
-
return (
|
|
13
|
-
<div className="ck-snackbar" role="status" aria-live="polite">
|
|
14
|
-
<div className="ck-snackbar-content">
|
|
15
|
-
<CheckIcon className="ck-snackbar-check" />
|
|
16
|
-
<p className="ck-snackbar-message">{message}</p>
|
|
17
|
-
</div>
|
|
18
|
-
{onClose && (
|
|
19
|
-
<button type="button" className="ck-snackbar-close" onClick={onClose} aria-label="Close">
|
|
20
|
-
<CloseIcon width={20} height={20} />
|
|
21
|
-
</button>
|
|
22
|
-
)}
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
@use '../../style/mixin.scss' as *;
|
|
2
|
-
|
|
3
|
-
.ck-snackbar {
|
|
4
|
-
display: flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
gap: 16px;
|
|
7
|
-
padding: 12px 16px;
|
|
8
|
-
border-radius: 8px;
|
|
9
|
-
background: var(--semantic-paper-sheet);
|
|
10
|
-
border: 1px solid var(--semantic-divider-divider-1);
|
|
11
|
-
width: 100%;
|
|
12
|
-
max-width: 400px;
|
|
13
|
-
|
|
14
|
-
@include tablet {
|
|
15
|
-
max-width: none;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.ck-snackbar-content {
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
gap: 8px;
|
|
23
|
-
flex: 1;
|
|
24
|
-
min-width: 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.ck-snackbar-check {
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
justify-content: center;
|
|
31
|
-
width: 24px;
|
|
32
|
-
height: 24px;
|
|
33
|
-
flex-shrink: 0;
|
|
34
|
-
color: var(--semantic-information-success);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.ck-snackbar-message {
|
|
38
|
-
@include textToken('body3-l1-medium');
|
|
39
|
-
color: var(--scale-gray-900);
|
|
40
|
-
flex: 1;
|
|
41
|
-
min-width: 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.ck-root .ck-snackbar-close {
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
justify-content: center;
|
|
48
|
-
flex-shrink: 0;
|
|
49
|
-
color: var(--scale-gray-700);
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
}
|