@getpara/react-common 2.0.0-alpha.7 → 2.0.0-alpha.71
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 +13 -0
- package/dist/{chunk-GOCCUU3Z.js → chunk-MMUBH76A.js} +17 -0
- package/dist/classes/ParaInternal.d.ts +26 -7
- package/dist/classes/ParaInternal.js +22 -2
- package/dist/components/HeroSpinner.d.ts +4 -3
- package/dist/components/HeroSpinner.js +29 -15
- package/dist/components/KnownDevices.js +6 -7
- package/dist/components/MoonPayEmbed.d.ts +4 -2
- package/dist/components/MoonPayEmbed.js +57 -84
- package/dist/components/NetworkSpeedBanner.js +6 -6
- package/dist/components/QRCode.js +8 -8
- package/dist/components/RampEmbed.d.ts +2 -2
- package/dist/components/RampEmbed.js +17 -29
- package/dist/components/UserIdentifier.d.ts +8 -0
- package/dist/components/UserIdentifier.js +30 -22
- package/dist/components/WalletSelect.d.ts +33 -0
- package/dist/components/WalletSelect.js +171 -0
- package/dist/components/WalletTypeIcon.d.ts +9 -0
- package/dist/components/WalletTypeIcon.js +45 -0
- package/dist/components/WarningBanner.d.ts +7 -0
- package/dist/components/WarningBanner.js +60 -0
- package/dist/components/common.d.ts +3 -3
- package/dist/components/common.js +8 -8
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +3 -1
- package/dist/constants/aaguiMetadata.js +1 -1
- package/dist/constants/externalWalletDefaults.d.ts +50 -0
- package/dist/constants/externalWalletDefaults.js +52 -0
- package/dist/constants/index.d.ts +37 -0
- package/dist/constants/index.js +152 -0
- package/dist/constants/oAuthLogos.d.ts +12 -0
- package/dist/constants/oAuthLogos.js +160 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useCopyToClipboard.js +1 -1
- package/dist/hooks/useDropdownPosition.d.ts +7 -0
- package/dist/hooks/useDropdownPosition.js +33 -0
- package/dist/hooks/useUserAgent.d.ts +2 -0
- package/dist/hooks/useUserAgent.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/commonTypes.d.ts +15 -0
- package/dist/types/commonTypes.js +1 -0
- package/dist/types/externalWalletCommon.d.ts +75 -37
- package/dist/types/externalWalletCommon.js +0 -31
- package/dist/types/index.d.ts +8 -5
- package/dist/types/index.js +1 -0
- package/dist/utils/formatBiometricHints.d.ts +1 -1
- package/dist/utils/formatBiometricHints.js +3 -3
- package/dist/utils/getBrowserName.js +1 -1
- package/dist/utils/getDeviceLogo.js +1 -1
- package/dist/utils/getDeviceModelName.js +1 -1
- package/dist/utils/getExternalWalletDisplayName.d.ts +3 -1
- package/dist/utils/getExternalWalletDisplayName.js +7 -15
- package/dist/utils/getExternalWalletIcon.d.ts +5 -0
- package/dist/utils/getExternalWalletIcon.js +17 -0
- package/dist/utils/index.d.ts +18 -16
- package/dist/utils/index.js +27 -31
- package/dist/utils/openMobileUrl.d.ts +1 -0
- package/dist/utils/openMobileUrl.js +34 -0
- package/dist/utils/safeStyled.d.ts +2 -0
- package/dist/utils/safeStyled.js +25 -0
- package/package.json +22 -24
- package/dist/components/StripeEmbed.d.ts +0 -4
- package/dist/components/StripeEmbed.js +0 -138
- package/dist/utils/offRampSend.d.ts +0 -7
- package/dist/utils/offRampSend.js +0 -75
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__async
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MMUBH76A.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
7
7
|
import { RampInstantSDK } from "@ramp-network/ramp-instant-sdk";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
getChainId,
|
|
11
|
-
getContractAddressFromAsset,
|
|
12
|
-
getCurrencyCodes,
|
|
13
|
-
reverseCurrencyLookup,
|
|
14
|
-
offRampSend
|
|
15
|
-
} from "../utils/index.js";
|
|
8
|
+
import { OnRampProvider } from "@getpara/web-sdk";
|
|
9
|
+
import { getChainId, getContractAddressFromAsset, getCurrencyCodes, reverseCurrencyLookup } from "../utils/index.js";
|
|
16
10
|
const TEST_MODE_FORBIDDEN = ["ETH_ETH", "ETH_USDC"];
|
|
17
11
|
const RampEmbed = ({
|
|
18
|
-
para,
|
|
19
12
|
appName,
|
|
13
|
+
email,
|
|
20
14
|
onRampConfig,
|
|
21
15
|
onRampPurchase,
|
|
22
16
|
isEmbedded,
|
|
23
17
|
apiKey,
|
|
24
18
|
onClose,
|
|
25
|
-
|
|
19
|
+
onUpdate,
|
|
20
|
+
onDepositRequest
|
|
26
21
|
}) => {
|
|
27
22
|
const { currencyCodes } = getCurrencyCodes(onRampConfig, {
|
|
28
23
|
provider: OnRampProvider.RAMP,
|
|
@@ -38,10 +33,10 @@ const RampEmbed = ({
|
|
|
38
33
|
swapAsset: currencyCodes.filter((code) => !onRampPurchase.testMode || !TEST_MODE_FORBIDDEN.includes(code)).join(","),
|
|
39
34
|
fiatValue: onRampPurchase.fiatQuantity,
|
|
40
35
|
fiatCurrency: onRampPurchase.fiat,
|
|
41
|
-
hostLogoUrl: `${
|
|
36
|
+
hostLogoUrl: `${window.location.hostname}/wordmark_black.svg`,
|
|
42
37
|
hostApiKey: apiKey,
|
|
43
38
|
userAddress: onRampPurchase.address,
|
|
44
|
-
userEmailAddress:
|
|
39
|
+
userEmailAddress: email,
|
|
45
40
|
url: (onRampPurchase == null ? void 0 : onRampPurchase.testMode) ? "https://app.demo.ramp.network" : "https://app.ramp.network",
|
|
46
41
|
enabledFlows: [onRampPurchase.type === "BUY" ? "ONRAMP" : "OFFRAMP"],
|
|
47
42
|
useSendCryptoCallback: true,
|
|
@@ -49,22 +44,15 @@ const RampEmbed = ({
|
|
|
49
44
|
containerNode: document.getElementById("ramp-container")
|
|
50
45
|
}).on("PURCHASE_CREATED", (e) => __async(void 0, null, function* () {
|
|
51
46
|
const p = e.payload.purchase;
|
|
52
|
-
const [network, asset] = onRampPurchase.testMode ? [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
fiatQuantity: p.fiatValue,
|
|
61
|
-
fiat: p.fiatCurrency,
|
|
62
|
-
assetQuantity: p.cryptoAmount,
|
|
63
|
-
asset,
|
|
64
|
-
network
|
|
65
|
-
}
|
|
47
|
+
const [network, asset] = onRampPurchase.testMode ? ["ETHEREUM", "ETHEREUM"] : reverseCurrencyLookup(onRampConfig.assetInfo, OnRampProvider.RAMP, p.asset.symbol) || [];
|
|
48
|
+
onUpdate({
|
|
49
|
+
providerKey: p.id,
|
|
50
|
+
fiatQuantity: p.fiatValue,
|
|
51
|
+
fiat: p.fiatCurrency,
|
|
52
|
+
assetQuantity: p.cryptoAmount,
|
|
53
|
+
asset,
|
|
54
|
+
network
|
|
66
55
|
});
|
|
67
|
-
setOnRampPurchase(updated);
|
|
68
56
|
})).on("WIDGET_CLOSE", () => __async(void 0, null, function* () {
|
|
69
57
|
onClose == null ? void 0 : onClose();
|
|
70
58
|
if (!isEmbedded) {
|
|
@@ -77,7 +65,7 @@ const RampEmbed = ({
|
|
|
77
65
|
})).onSendCrypto((assetInfo, amount, address) => __async(void 0, null, function* () {
|
|
78
66
|
try {
|
|
79
67
|
const [network, asset] = reverseCurrencyLookup(onRampConfig.assetInfo, OnRampProvider.RAMP, assetInfo.symbol);
|
|
80
|
-
const txHash = yield
|
|
68
|
+
const txHash = yield onDepositRequest({
|
|
81
69
|
assetQuantity: amount,
|
|
82
70
|
destinationAddress: address,
|
|
83
71
|
contractAddress: getContractAddressFromAsset(network, asset),
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import { IconType } from '@getpara/react-components';
|
|
1
2
|
import { CoreAuthInfo } from '@getpara/web-sdk';
|
|
3
|
+
export declare function getAuthDisplay(authInfo: CoreAuthInfo, { withAddress }?: {
|
|
4
|
+
withAddress?: boolean;
|
|
5
|
+
}): {
|
|
6
|
+
name: string | null;
|
|
7
|
+
icon?: IconType;
|
|
8
|
+
src?: string;
|
|
9
|
+
};
|
|
2
10
|
export declare const UserIdentifier: ({ authInfo }: {
|
|
3
11
|
authInfo?: CoreAuthInfo;
|
|
4
12
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,39 +1,46 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-MMUBH76A.js";
|
|
3
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
import { CpslAvatar, CpslIcon, CpslText } from "@getpara/react-components";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const { authType, identifier, externalWallet } = authInfo;
|
|
7
|
+
import { displayPhoneNumber, truncateAddress } from "@getpara/web-sdk";
|
|
8
|
+
import { getExternalWalletDisplayName, getExternalWalletIcon, safeStyled } from "../utils/index.js";
|
|
9
|
+
function getAuthDisplay(authInfo, { withAddress = false } = {}) {
|
|
10
|
+
var _a;
|
|
11
|
+
const { authType, displayName, identifier, pfpUrl, externalWallet } = authInfo;
|
|
10
12
|
switch (authType) {
|
|
11
13
|
case "email":
|
|
12
|
-
return {
|
|
14
|
+
return { name: identifier.toLowerCase(), icon: "mail" };
|
|
13
15
|
case "phone":
|
|
14
|
-
return {
|
|
16
|
+
return { name: displayPhoneNumber(identifier), icon: "phone" };
|
|
15
17
|
case "farcaster":
|
|
16
|
-
return {
|
|
18
|
+
return __spreadValues({ name: displayName != null ? displayName : `@${identifier}` }, pfpUrl ? { src: pfpUrl } : { icon: "farcasterBrand" });
|
|
17
19
|
case "telegram":
|
|
18
|
-
return {
|
|
20
|
+
return __spreadValues({
|
|
21
|
+
name: displayName != null ? displayName : `Telegram User @${identifier}`
|
|
22
|
+
}, pfpUrl ? { src: pfpUrl } : { icon: "telegramBrand" });
|
|
19
23
|
case "externalWallet":
|
|
20
|
-
return {
|
|
24
|
+
return {
|
|
25
|
+
name: externalWallet ? getExternalWalletDisplayName(externalWallet, { withAddress }) : truncateAddress(identifier, "EVM"),
|
|
26
|
+
icon: (_a = getExternalWalletIcon(externalWallet == null ? void 0 : externalWallet.providerId)) != null ? _a : "wallet02"
|
|
27
|
+
};
|
|
21
28
|
default:
|
|
22
|
-
return {
|
|
29
|
+
return { name: null, icon: null };
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
32
|
const UserIdentifier = ({ authInfo }) => {
|
|
26
33
|
if (!authInfo) {
|
|
27
34
|
return null;
|
|
28
35
|
}
|
|
29
|
-
const { authType
|
|
30
|
-
const {
|
|
36
|
+
const { authType } = authInfo;
|
|
37
|
+
const { name, icon, src } = getAuthDisplay(authInfo, { withAddress: true });
|
|
31
38
|
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
32
|
-
/* @__PURE__ */ jsx(IconContainer, { children:
|
|
33
|
-
/* @__PURE__ */ jsx(IdentifierText, { variant: "bodyS", weight: "medium", children:
|
|
39
|
+
/* @__PURE__ */ jsx(IconContainer, { children: src ? /* @__PURE__ */ jsx(Avatar, { src, size: "20px", variant: "round" }) : /* @__PURE__ */ jsx(Icon, { icon, size: authType === "telegram" ? "20px" : "13px" }) }),
|
|
40
|
+
/* @__PURE__ */ jsx(IdentifierText, { variant: "bodyS", weight: "medium", children: name })
|
|
34
41
|
] });
|
|
35
42
|
};
|
|
36
|
-
const Container =
|
|
43
|
+
const Container = safeStyled.div`
|
|
37
44
|
padding: 8px 12px 8px 8px;
|
|
38
45
|
border-radius: 1000px;
|
|
39
46
|
background-color: var(--cpsl-color-background-4);
|
|
@@ -42,10 +49,10 @@ const Container = styled.div`
|
|
|
42
49
|
justify-content: flex-start;
|
|
43
50
|
gap: 4px;
|
|
44
51
|
`;
|
|
45
|
-
const IdentifierText =
|
|
52
|
+
const IdentifierText = safeStyled(CpslText)`
|
|
46
53
|
--color-override: var(--cpsl-color-background-96);
|
|
47
54
|
`;
|
|
48
|
-
const IconContainer =
|
|
55
|
+
const IconContainer = safeStyled.div`
|
|
49
56
|
display: flex;
|
|
50
57
|
background: var(--cpsl-color-background-0);
|
|
51
58
|
align-items: center;
|
|
@@ -54,13 +61,14 @@ const IconContainer = styled.div`
|
|
|
54
61
|
width: 20px;
|
|
55
62
|
height: 20px;
|
|
56
63
|
`;
|
|
57
|
-
const Icon =
|
|
64
|
+
const Icon = safeStyled(CpslIcon)`
|
|
58
65
|
--icon-color: var(--cpsl-color-text-primary);
|
|
59
66
|
`;
|
|
60
|
-
const Avatar =
|
|
67
|
+
const Avatar = safeStyled(CpslAvatar)`
|
|
61
68
|
--container-border-width: 0;
|
|
62
69
|
--container-padding: 0;
|
|
63
70
|
`;
|
|
64
71
|
export {
|
|
65
|
-
UserIdentifier
|
|
72
|
+
UserIdentifier,
|
|
73
|
+
getAuthDisplay
|
|
66
74
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AvailableWallet, TWalletType, TExternalWallet } from '@getpara/web-sdk';
|
|
2
|
+
type EntryProps = {
|
|
3
|
+
name?: string;
|
|
4
|
+
type?: TWalletType;
|
|
5
|
+
externalWallet?: TExternalWallet | string;
|
|
6
|
+
withCopy?: boolean;
|
|
7
|
+
withIcon?: boolean;
|
|
8
|
+
copyValue?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const WalletSelect: ({ isDark, style, className, value, onChange, options, getEntryProps, getSelectValue, helperText, }: {
|
|
11
|
+
isDark: any;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
className?: string;
|
|
14
|
+
value: AvailableWallet;
|
|
15
|
+
onChange: (_: AvailableWallet) => void;
|
|
16
|
+
options: AvailableWallet[];
|
|
17
|
+
getEntryProps: (wallet: AvailableWallet) => EntryProps;
|
|
18
|
+
getSelectValue: (wallet: AvailableWallet) => `${string}~${TWalletType}`;
|
|
19
|
+
helperText?: string;
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const Select: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Substitute<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
22
|
+
ref?: import("react").Ref<any>;
|
|
23
|
+
}, {
|
|
24
|
+
$width: number;
|
|
25
|
+
$top?: number;
|
|
26
|
+
}>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
27
|
+
export declare const SelectItem: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Substitute<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
28
|
+
ref?: import("react").Ref<any>;
|
|
29
|
+
}, {
|
|
30
|
+
isMultiOption?: boolean;
|
|
31
|
+
}>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
32
|
+
export declare const SelectContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-MMUBH76A.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useEffect, useRef } from "react";
|
|
8
|
+
import { useDropdownPosition, useCopyToClipboard } from "../hooks/index.js";
|
|
9
|
+
import { safeStyled } from "../utils/index.js";
|
|
10
|
+
import { CpslButton, CpslIcon, CpslSelect, CpslSelectItem, CpslText } from "@getpara/react-components";
|
|
11
|
+
import { WalletTypeIcon as WalletTypeIconBase } from "./WalletTypeIcon.js";
|
|
12
|
+
const Entry = ({
|
|
13
|
+
isDark = false,
|
|
14
|
+
withCopy,
|
|
15
|
+
slot,
|
|
16
|
+
withIcon,
|
|
17
|
+
name,
|
|
18
|
+
type,
|
|
19
|
+
externalWallet,
|
|
20
|
+
copyValue,
|
|
21
|
+
isMultiOption
|
|
22
|
+
}) => {
|
|
23
|
+
const [isCopied, copy] = useCopyToClipboard();
|
|
24
|
+
return /* @__PURE__ */ jsxs(WalletContainer, { slot, style: { flex: "1" }, isMultiOption, children: [
|
|
25
|
+
withIcon && /* @__PURE__ */ jsx(WalletTypeIcon, { isDark, externalWallet, walletType: type, size: "32px", inset: "6px" }),
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
CpslText,
|
|
28
|
+
{
|
|
29
|
+
variant: "bodyM",
|
|
30
|
+
color: "contrast",
|
|
31
|
+
style: { flex: "1", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "clip" },
|
|
32
|
+
children: name
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
withCopy && copyValue && /* @__PURE__ */ jsx(
|
|
36
|
+
CopyButton,
|
|
37
|
+
{
|
|
38
|
+
id: "ignore-click",
|
|
39
|
+
size: "small",
|
|
40
|
+
variant: "ghost",
|
|
41
|
+
onClick: (e) => {
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
copy(copyValue);
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ jsx(CpslIcon, { id: "ignore-click", slot: "start", icon: isCopied ? "check" : "copy" })
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
51
|
+
const WalletSelect = ({
|
|
52
|
+
isDark = false,
|
|
53
|
+
style,
|
|
54
|
+
className,
|
|
55
|
+
value,
|
|
56
|
+
onChange,
|
|
57
|
+
options,
|
|
58
|
+
getEntryProps,
|
|
59
|
+
getSelectValue,
|
|
60
|
+
helperText
|
|
61
|
+
}) => {
|
|
62
|
+
const containerRef = useRef(null);
|
|
63
|
+
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
64
|
+
const isMulti = options.length > 1;
|
|
65
|
+
const ActiveEntry = value ? /* @__PURE__ */ jsx(Entry, __spreadProps(__spreadValues({ isDark, withCopy: true, slot: "selected-item" }, getEntryProps(value)), { isMultiOption: isMulti })) : null;
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (dropdownMaxHeight && (value == null ? void 0 : value.address)) {
|
|
68
|
+
resize();
|
|
69
|
+
}
|
|
70
|
+
}, [value, options, dropdownMaxHeight]);
|
|
71
|
+
return /* @__PURE__ */ jsxs(Container, { className, style, children: [
|
|
72
|
+
isMulti && helperText && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "semiBold", children: helperText }),
|
|
73
|
+
/* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, id: "addressInputContainer", children: /* @__PURE__ */ jsxs(
|
|
74
|
+
Select,
|
|
75
|
+
{
|
|
76
|
+
selectedValue: getSelectValue(value),
|
|
77
|
+
onCpslSelectValueChange: (e) => {
|
|
78
|
+
const [id, type] = e.detail.split("~");
|
|
79
|
+
onChange(options.find((o) => o.id === id && o.type === type));
|
|
80
|
+
},
|
|
81
|
+
showFormattedSelectedItem: true,
|
|
82
|
+
placeholder: "Choose wallet...",
|
|
83
|
+
anchorElId: "addressInputContainer",
|
|
84
|
+
dropdownMaxHeight,
|
|
85
|
+
$width: dropdownWidth != null ? dropdownWidth : 0,
|
|
86
|
+
$top: (mobileAnchor != null ? mobileAnchor : 0) + 16 + 1,
|
|
87
|
+
selectedItemVariant: "bodyXS",
|
|
88
|
+
icon: isMulti ? "chevronUp" : null,
|
|
89
|
+
disabled: !isMulti,
|
|
90
|
+
isMultiOption: isMulti,
|
|
91
|
+
children: [
|
|
92
|
+
value && ActiveEntry,
|
|
93
|
+
(options || []).map((wallet) => {
|
|
94
|
+
const key = getSelectValue(wallet);
|
|
95
|
+
return /* @__PURE__ */ jsx(SelectItem, { slot: "items", value: key, children: /* @__PURE__ */ jsx(Entry, __spreadValues({ isDark }, getEntryProps(wallet))) }, key);
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
) })
|
|
100
|
+
] });
|
|
101
|
+
};
|
|
102
|
+
const Container = safeStyled.div`
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
gap: 8px;
|
|
106
|
+
align-items: center;
|
|
107
|
+
`;
|
|
108
|
+
const WalletContainer = safeStyled.div`
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: 8px;
|
|
112
|
+
max-width: 100%;
|
|
113
|
+
padding-inline-end: ${({ isMultiOption }) => isMultiOption ? "40px" : "0px"};
|
|
114
|
+
`;
|
|
115
|
+
const Select = safeStyled(CpslSelect)`
|
|
116
|
+
--icon-width: 32px;
|
|
117
|
+
--icon-height: 32px;
|
|
118
|
+
--container-border-color: var(--cpsl-color-background-16);
|
|
119
|
+
--container-background-color-disabled: var(--container-background-color);
|
|
120
|
+
width: 100%;
|
|
121
|
+
position: relative;
|
|
122
|
+
|
|
123
|
+
&::part(selected-text) {
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&::part(dropdown) {
|
|
128
|
+
min-width: ${({ $width }) => `${$width - 2}px`};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&::part(icon) {
|
|
132
|
+
--icon-color: var(--cpsl-color-text-primary);
|
|
133
|
+
position: absolute;
|
|
134
|
+
right: 12px;
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
const SelectItem = safeStyled(CpslSelectItem)`
|
|
138
|
+
--outer-container-padding-start: 0px;
|
|
139
|
+
--outer-container-padding-end: 0px;
|
|
140
|
+
--outer-container-padding-top: 0px;
|
|
141
|
+
--outer-container-padding-bottom: 0px;
|
|
142
|
+
--container-padding-start: 12px;
|
|
143
|
+
--container-padding-end: ${({ isMultiOption }) => isMultiOption ? "40px" : "12px"};
|
|
144
|
+
--container-padding-top: 8px;
|
|
145
|
+
--container-padding-bottom: 8px;
|
|
146
|
+
`;
|
|
147
|
+
const SelectContainer = safeStyled.div`
|
|
148
|
+
width: 100%;
|
|
149
|
+
position: relative;
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: 8px;
|
|
153
|
+
border-radius: var(--cpsl-border-radius-tile-button);
|
|
154
|
+
background-color: var(--cpsl-color-background-4);
|
|
155
|
+
`;
|
|
156
|
+
const WalletTypeIcon = safeStyled(WalletTypeIconBase)`
|
|
157
|
+
--border: 1px solid var(--cpsl-color-background-8);
|
|
158
|
+
--border-radius: 4px;
|
|
159
|
+
`;
|
|
160
|
+
const CopyButton = safeStyled(CpslButton)`
|
|
161
|
+
cpsl-icon {
|
|
162
|
+
--height: 24px;
|
|
163
|
+
--width: 24px;
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
export {
|
|
167
|
+
Select,
|
|
168
|
+
SelectContainer,
|
|
169
|
+
SelectItem,
|
|
170
|
+
WalletSelect
|
|
171
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CpslIcon } from '@getpara/react-components';
|
|
2
|
+
import { TExternalWallet, TWalletType } from '@getpara/web-sdk';
|
|
3
|
+
import { CommonWallet } from '../types/index.js';
|
|
4
|
+
export declare function WalletTypeIcon({ className, walletType, externalWallet, isDark, ...props }: {
|
|
5
|
+
className?: string;
|
|
6
|
+
walletType: TWalletType;
|
|
7
|
+
isDark?: boolean;
|
|
8
|
+
externalWallet?: TExternalWallet | CommonWallet | string;
|
|
9
|
+
} & Parameters<typeof CpslIcon>[0]): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../chunk-MMUBH76A.js";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { CpslIcon } from "@getpara/react-components";
|
|
9
|
+
import { ACCOUNT_TYPES } from "../constants/oAuthLogos.js";
|
|
10
|
+
import { WALLET_TYPES_METADATA } from "../constants/index.js";
|
|
11
|
+
function WalletTypeIcon(_a) {
|
|
12
|
+
var _b = _a, {
|
|
13
|
+
className,
|
|
14
|
+
walletType,
|
|
15
|
+
externalWallet,
|
|
16
|
+
isDark = false
|
|
17
|
+
} = _b, props = __objRest(_b, [
|
|
18
|
+
"className",
|
|
19
|
+
"walletType",
|
|
20
|
+
"externalWallet",
|
|
21
|
+
"isDark"
|
|
22
|
+
]);
|
|
23
|
+
var _a2, _b2;
|
|
24
|
+
if (typeof externalWallet === "object" && "iconUrl" in externalWallet) {
|
|
25
|
+
return /* @__PURE__ */ jsx(CpslIcon, __spreadProps(__spreadValues({ className, src: externalWallet.iconUrl }, props), { inset: (_a2 = props.inset) != null ? _a2 : "10%" }));
|
|
26
|
+
}
|
|
27
|
+
const data = (externalWallet ? ACCOUNT_TYPES[externalWallet] : WALLET_TYPES_METADATA[walletType]) || {
|
|
28
|
+
icon: "wallet02",
|
|
29
|
+
isDark: true
|
|
30
|
+
};
|
|
31
|
+
props.size;
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
CpslIcon,
|
|
34
|
+
__spreadProps(__spreadValues({
|
|
35
|
+
className,
|
|
36
|
+
icon: data.icon,
|
|
37
|
+
invert: isDark && data.isDark
|
|
38
|
+
}, props), {
|
|
39
|
+
inset: (_b2 = props.inset) != null ? _b2 : "10%"
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
WalletTypeIcon
|
|
45
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { CpslIcon } from "@getpara/react-components";
|
|
6
|
+
import { safeStyled } from "../utils/index.js";
|
|
7
|
+
const BannerContainer = safeStyled.div`
|
|
8
|
+
background: #fffcec;
|
|
9
|
+
border: 2px solid var(--cpsl-color-utility-yellow);
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
padding: 8px 8px;
|
|
12
|
+
`;
|
|
13
|
+
const Content = safeStyled.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
gap: 8px;
|
|
17
|
+
position: relative;
|
|
18
|
+
`;
|
|
19
|
+
const Text = safeStyled.div`
|
|
20
|
+
flex: 1;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
line-height: 1.4;
|
|
23
|
+
color: var(--cpsl-color-black);
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
`;
|
|
26
|
+
const CloseButton = safeStyled.button`
|
|
27
|
+
background-color: transparent;
|
|
28
|
+
border: none;
|
|
29
|
+
padding: 0;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
width: 20px;
|
|
36
|
+
height: 20px;
|
|
37
|
+
margin-top: 1px;
|
|
38
|
+
`;
|
|
39
|
+
const CloseIcon = safeStyled(CpslIcon)`
|
|
40
|
+
--icon-color: var(--cpsl-color-utility-yellow);
|
|
41
|
+
--height: 20px;
|
|
42
|
+
--width: 20px;
|
|
43
|
+
`;
|
|
44
|
+
const WarningBanner = ({ children, onClose }) => {
|
|
45
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
46
|
+
const handleClose = () => {
|
|
47
|
+
setIsVisible(false);
|
|
48
|
+
onClose == null ? void 0 : onClose();
|
|
49
|
+
};
|
|
50
|
+
if (!isVisible) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return /* @__PURE__ */ jsx(BannerContainer, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
54
|
+
/* @__PURE__ */ jsx(CloseButton, { onClick: handleClose, "aria-label": "Close warning", children: /* @__PURE__ */ jsx(CloseIcon, { icon: "x" }) }),
|
|
55
|
+
/* @__PURE__ */ jsx(Text, { children })
|
|
56
|
+
] }) });
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
WarningBanner
|
|
60
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CpslInput, CpslText } from '@getpara/react-components';
|
|
2
|
-
export declare const SpinnerContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
-
export declare const CenteredColumnContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
+
export declare const SpinnerContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const CenteredColumnContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
4
|
export declare const FilledDisabledInput: typeof CpslInput;
|
|
5
5
|
export declare const FullWidthFilledDisabledInput: typeof CpslInput;
|
|
6
6
|
export declare const CenteredText: typeof CpslText;
|
|
7
|
-
export declare const HeaderButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
7
|
+
export declare const HeaderButton: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
8
8
|
ref?: import("react").Ref<any>;
|
|
9
9
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../chunk-
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
3
|
import { CpslButton, CpslInput, CpslText } from "@getpara/react-components";
|
|
4
|
-
import
|
|
5
|
-
const SpinnerContainer =
|
|
4
|
+
import { safeStyled } from "../utils/index.js";
|
|
5
|
+
const SpinnerContainer = safeStyled.div`
|
|
6
6
|
display: flex;
|
|
7
7
|
align-items: center;
|
|
8
8
|
justify-content: center;
|
|
9
9
|
`;
|
|
10
|
-
const CenteredColumnContainer =
|
|
10
|
+
const CenteredColumnContainer = safeStyled.div`
|
|
11
11
|
width: 100%;
|
|
12
12
|
height: 100%;
|
|
13
13
|
align-self: center;
|
|
@@ -16,21 +16,21 @@ const CenteredColumnContainer = styled.div`
|
|
|
16
16
|
align-items: center;
|
|
17
17
|
gap: 8px;
|
|
18
18
|
`;
|
|
19
|
-
const FilledDisabledInput =
|
|
19
|
+
const FilledDisabledInput = safeStyled(CpslInput)`
|
|
20
20
|
--container-border-color: var(--cpsl-color-input-border-placeholder);
|
|
21
21
|
--container-background-color: var(--cpsl-color-background-0);
|
|
22
22
|
--input-background-color: transparent;
|
|
23
23
|
--input-font-weight: 500;
|
|
24
24
|
--input-color: var(--cpsl-color-text-secondary) !important;
|
|
25
25
|
`;
|
|
26
|
-
const FullWidthFilledDisabledInput =
|
|
26
|
+
const FullWidthFilledDisabledInput = safeStyled(FilledDisabledInput)`
|
|
27
27
|
width: 100%;
|
|
28
28
|
`;
|
|
29
|
-
const CenteredText =
|
|
29
|
+
const CenteredText = safeStyled(CpslText)`
|
|
30
30
|
width: 100%;
|
|
31
31
|
text-align: center;
|
|
32
32
|
`;
|
|
33
|
-
const HeaderButton =
|
|
33
|
+
const HeaderButton = safeStyled(CpslButton)`
|
|
34
34
|
flex: 0;
|
|
35
35
|
--button-padding-top: 2px;
|
|
36
36
|
--button-padding-bottom: 2px;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './MoonPayEmbed.js';
|
|
2
2
|
export * from './RampEmbed.js';
|
|
3
|
-
export * from './StripeEmbed.js';
|
|
4
3
|
export * from './common.js';
|
|
5
4
|
export * from './HeroSpinner.js';
|
|
6
5
|
export * from './KnownDevices.js';
|
|
7
6
|
export * from './QRCode.js';
|
|
8
7
|
export * from './UserIdentifier.js';
|
|
9
8
|
export * from './NetworkSpeedBanner.js';
|
|
9
|
+
export * from './WarningBanner.js';
|
|
10
|
+
export * from './WalletSelect.js';
|
|
11
|
+
export * from './WalletTypeIcon.js';
|
package/dist/components/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export * from "./MoonPayEmbed.js";
|
|
3
3
|
export * from "./RampEmbed.js";
|
|
4
|
-
export * from "./StripeEmbed.js";
|
|
5
4
|
export * from "./common.js";
|
|
6
5
|
export * from "./HeroSpinner.js";
|
|
7
6
|
export * from "./KnownDevices.js";
|
|
8
7
|
export * from "./QRCode.js";
|
|
9
8
|
export * from "./UserIdentifier.js";
|
|
10
9
|
export * from "./NetworkSpeedBanner.js";
|
|
10
|
+
export * from "./WarningBanner.js";
|
|
11
|
+
export * from "./WalletSelect.js";
|
|
12
|
+
export * from "./WalletTypeIcon.js";
|