@getpara/react-common 2.0.0-alpha.64 → 2.0.0-alpha.66
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/dist/{chunk-GOCCUU3Z.js → chunk-MMUBH76A.js} +17 -0
- package/dist/classes/ParaInternal.js +1 -1
- package/dist/components/HeroSpinner.js +1 -1
- package/dist/components/KnownDevices.js +1 -1
- package/dist/components/MoonPayEmbed.js +1 -1
- package/dist/components/NetworkSpeedBanner.js +1 -1
- package/dist/components/QRCode.js +1 -1
- package/dist/components/RampEmbed.js +1 -1
- package/dist/components/UserIdentifier.js +1 -1
- package/dist/components/WalletSelect.d.ts +33 -0
- package/dist/components/WalletSelect.js +172 -0
- package/dist/components/WalletTypeIcon.d.ts +9 -0
- package/dist/components/WalletTypeIcon.js +45 -0
- package/dist/components/WarningBanner.js +1 -1
- package/dist/components/common.js +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/constants/aaguiMetadata.js +1 -1
- package/dist/constants/externalWalletDefaults.js +1 -1
- package/dist/constants/index.d.ts +37 -0
- package/dist/constants/index.js +152 -0
- package/dist/constants/oAuthLogos.js +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -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.js +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/utils/formatBiometricHints.js +1 -1
- 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.js +1 -1
- package/dist/utils/getExternalWalletIcon.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/safeStyled.js +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
3
5
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -15,6 +17,19 @@ var __spreadValues = (a, b) => {
|
|
|
15
17
|
}
|
|
16
18
|
return a;
|
|
17
19
|
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
18
33
|
var __async = (__this, __arguments, generator) => {
|
|
19
34
|
return new Promise((resolve, reject) => {
|
|
20
35
|
var fulfilled = (value) => {
|
|
@@ -38,5 +53,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
38
53
|
|
|
39
54
|
export {
|
|
40
55
|
__spreadValues,
|
|
56
|
+
__spreadProps,
|
|
57
|
+
__objRest,
|
|
41
58
|
__async
|
|
42
59
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../chunk-
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
|
|
5
5
|
import { CenteredColumnContainer, FullWidthFilledDisabledInput, CenteredText } from "./common.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { OnRampProvider } from "@getpara/web-sdk";
|
|
7
7
|
import { lazy, useCallback, useEffect, useMemo, useState } from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../chunk-
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
5
5
|
import { useCopyToClipboard } from "../hooks/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__spreadValues
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MMUBH76A.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { CpslAvatar, CpslIcon, CpslText } from "@getpara/react-components";
|
|
7
7
|
import { displayPhoneNumber, truncateAddress } from "@getpara/web-sdk";
|
|
@@ -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,172 @@
|
|
|
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
|
+
--background: var(--cpsl-color-background-0);
|
|
159
|
+
--border-radius: 4px;
|
|
160
|
+
`;
|
|
161
|
+
const CopyButton = safeStyled(CpslButton)`
|
|
162
|
+
cpsl-icon {
|
|
163
|
+
--height: 24px;
|
|
164
|
+
--width: 24px;
|
|
165
|
+
}
|
|
166
|
+
`;
|
|
167
|
+
export {
|
|
168
|
+
Select,
|
|
169
|
+
SelectContainer,
|
|
170
|
+
SelectItem,
|
|
171
|
+
WalletSelect
|
|
172
|
+
};
|
|
@@ -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
|
+
};
|
package/dist/components/index.js
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TNetwork, TOnRampAsset, OnRampMethod, OnRampProvider, TWalletType } from '@getpara/core-sdk';
|
|
2
|
+
import { IconType } from '@getpara/react-components';
|
|
3
|
+
import { Transition, Variants } from 'framer-motion';
|
|
4
|
+
import { DisplayMetadata } from '../types/commonTypes.js';
|
|
5
|
+
export declare const PARA_CONNECT = "https://connect.getpara.com/";
|
|
6
|
+
export declare const PARA_TERMS_AND_CONDITIONS = "https://getpara.com/terms";
|
|
7
|
+
export type OnRampProviderConfig = DisplayMetadata & {
|
|
8
|
+
feeLower: number;
|
|
9
|
+
feeUpper?: number;
|
|
10
|
+
methods: OnRampMethod[];
|
|
11
|
+
backgroundColors: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare const ON_RAMP_PROVIDERS: Record<OnRampProvider, OnRampProviderConfig>;
|
|
14
|
+
type Networks = Record<TNetwork, DisplayMetadata>;
|
|
15
|
+
export declare const WALLET_TYPES_METADATA: Record<TWalletType, DisplayMetadata>;
|
|
16
|
+
export declare const NETWORKS: Networks;
|
|
17
|
+
export declare const ON_RAMP_ASSETS: Record<TOnRampAsset, {
|
|
18
|
+
name: string;
|
|
19
|
+
code: string;
|
|
20
|
+
icon: IconType;
|
|
21
|
+
isCircular?: boolean;
|
|
22
|
+
isDark?: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function getNetworkName(str: TNetwork | string): string;
|
|
25
|
+
export declare function getNetworkIcon(str: TNetwork | string): IconType;
|
|
26
|
+
export declare function getAssetCode(str: TOnRampAsset | string): string;
|
|
27
|
+
export declare function getAssetName(str: TOnRampAsset | string): string;
|
|
28
|
+
export declare function getAssetIcon(str: TOnRampAsset | string): "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowCircleDown" | "arrowNarrow" | "arrow" | "asterisk" | "backpack" | "backupKit" | "bank" | "baseBrand" | "beraBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "close" | "clubhouseBrand" | "clubhouse" | "code" | "coinbase" | "copy07" | "copy" | "cosmosCircle" | "cosmos" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "discord" | "dot" | "dotsSquare" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "farcaster" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "glow" | "googleBrand" | "google" | "gridDots" | "haha" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "keplr" | "key" | "laptop" | "leap" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "metamask" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "okx" | "optimismBrand" | "paraArrow" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "para" | "passcode" | "phantom" | "phone" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rabby" | "rainbow" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "safe" | "samsung" | "search" | "send" | "settings" | "share" | "shield" | "shuffle" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solanaCircle" | "solana" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "telegram" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "user01" | "userCircle" | "userPlus" | "user" | "valora" | "wallet02" | "walletConnect" | "wallet" | "x" | "youtubeBrand" | "youtube" | "zerion" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
|
|
29
|
+
export declare const MOBILE_SIZE = 480;
|
|
30
|
+
export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
31
|
+
export declare const EMAIL_REGEX: RegExp;
|
|
32
|
+
export declare const BODY_MOTION_VARIANTS: Variants;
|
|
33
|
+
export declare const BODY_TRANSITION: Transition;
|
|
34
|
+
export declare const SDK_VERSION: string;
|
|
35
|
+
export * from './aaguiMetadata.js';
|
|
36
|
+
export * from './externalWalletDefaults.js';
|
|
37
|
+
export * from './oAuthLogos.js';
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-MMUBH76A.js";
|
|
6
|
+
var _a;
|
|
7
|
+
import { OnRampMethod, OnRampProvider } from "@getpara/core-sdk";
|
|
8
|
+
const PARA_CONNECT = "https://connect.getpara.com/";
|
|
9
|
+
const PARA_TERMS_AND_CONDITIONS = "https://getpara.com/terms";
|
|
10
|
+
const ON_RAMP_PROVIDERS = {
|
|
11
|
+
[OnRampProvider.STRIPE]: {
|
|
12
|
+
name: "Stripe",
|
|
13
|
+
feeLower: 0.99,
|
|
14
|
+
feeUpper: 4.49,
|
|
15
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
16
|
+
icon: "stripeBrand",
|
|
17
|
+
backgroundColors: ["#6772E5", "#808AF4"]
|
|
18
|
+
},
|
|
19
|
+
[OnRampProvider.RAMP]: {
|
|
20
|
+
name: "Ramp",
|
|
21
|
+
feeLower: 0.99,
|
|
22
|
+
feeUpper: 4.49,
|
|
23
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
24
|
+
icon: "rampNetworkBrand",
|
|
25
|
+
backgroundColors: ["#21BF73", "#3AE492"]
|
|
26
|
+
},
|
|
27
|
+
[OnRampProvider.MOONPAY]: {
|
|
28
|
+
name: "MoonPay",
|
|
29
|
+
feeLower: 1,
|
|
30
|
+
feeUpper: 4.5,
|
|
31
|
+
methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
|
|
32
|
+
icon: "moonpayBrand",
|
|
33
|
+
backgroundColors: ["#7715F5", "#9647fd"]
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const ICON_TYPES = {
|
|
37
|
+
ethereum: { isDark: true },
|
|
38
|
+
usdcBrand: { isCircular: true },
|
|
39
|
+
arbitrumBrand: { isCircular: true },
|
|
40
|
+
baseBrand: { isCircular: true },
|
|
41
|
+
optimismBrand: { isCircular: true },
|
|
42
|
+
cosmos: { isCircular: true, isDark: true },
|
|
43
|
+
celoBrand: { isCircular: true },
|
|
44
|
+
tetherBrand: { isCircular: true }
|
|
45
|
+
};
|
|
46
|
+
const WALLET_TYPES_METADATA = {
|
|
47
|
+
EVM: { name: "EVM", icon: "ethereum", isDark: true },
|
|
48
|
+
SOLANA: { name: "Solana", icon: "solana" },
|
|
49
|
+
COSMOS: { name: "Cosmos", icon: "cosmos", isCircular: true, isDark: true }
|
|
50
|
+
};
|
|
51
|
+
const NETWORKS = Object.entries({
|
|
52
|
+
["ETHEREUM"]: { name: "Ethereum", icon: "ethereum" },
|
|
53
|
+
["SEPOLIA"]: { name: "Sepolia", icon: "ethereum" },
|
|
54
|
+
["ARBITRUM"]: { name: "Arbitrum", icon: "arbitrumBrand" },
|
|
55
|
+
["BASE"]: { name: "Base", icon: "baseBrand" },
|
|
56
|
+
["OPTIMISM"]: { name: "Optimism", icon: "optimismBrand" },
|
|
57
|
+
["POLYGON"]: { name: "Polygon", icon: "polygonBrand" },
|
|
58
|
+
["SOLANA"]: { name: "Solana", icon: "solana" },
|
|
59
|
+
["COSMOS"]: { name: "Cosmos", icon: "cosmos" },
|
|
60
|
+
["CELO"]: { name: "Celo", icon: "celoBrand" },
|
|
61
|
+
["SOLANA_DEVNET"]: { name: "Solana Devnet", icon: "solana" },
|
|
62
|
+
["NOBLE"]: { name: "Noble", icon: "nobleBrand" },
|
|
63
|
+
["BERACHAIN"]: { name: "Berachain", icon: "beraBrand" }
|
|
64
|
+
}).reduce((acc, [key, entry]) => {
|
|
65
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
66
|
+
[key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
|
|
67
|
+
});
|
|
68
|
+
}, {});
|
|
69
|
+
const ON_RAMP_ASSETS = Object.entries({
|
|
70
|
+
["ETHEREUM"]: { name: "Ethereum", code: "ETH", icon: "ethereum" },
|
|
71
|
+
["USDC"]: { name: "USD Coin", code: "USDC", icon: "usdcBrand" },
|
|
72
|
+
["POLYGON"]: { name: "Polygon", code: "POL", icon: "polygonBrand" },
|
|
73
|
+
["SOLANA"]: { name: "Solana", code: "SOL", icon: "solana" },
|
|
74
|
+
["ATOM"]: { name: "Atom", code: "ATOM", icon: "cosmos" },
|
|
75
|
+
["CELO"]: { name: "Celo", code: "CELO", icon: "celoBrand" },
|
|
76
|
+
["TETHER"]: { name: "Tether", code: "USDT", icon: "tetherBrand" },
|
|
77
|
+
["CUSD"]: { name: "Celo Dollar", code: "CUSD", icon: "celoBrand" },
|
|
78
|
+
["CEUR"]: { name: "Celo Euro", code: "CEUR", icon: "celoBrand" },
|
|
79
|
+
["CREAL"]: { name: "Celo Real", code: "CREAL", icon: "celoBrand" },
|
|
80
|
+
["BERA"]: { name: "Berachain", code: "BERA", icon: "beraBrand" }
|
|
81
|
+
}).reduce((acc, [key, entry]) => {
|
|
82
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
83
|
+
[key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
|
|
84
|
+
});
|
|
85
|
+
}, {});
|
|
86
|
+
function getNetworkName(str) {
|
|
87
|
+
var _a2, _b;
|
|
88
|
+
return (_b = (_a2 = NETWORKS[str]) == null ? void 0 : _a2.name) != null ? _b : `${str[0]}${str.slice(1).toLowerCase()}`;
|
|
89
|
+
}
|
|
90
|
+
function getNetworkIcon(str) {
|
|
91
|
+
var _a2, _b;
|
|
92
|
+
return (_b = (_a2 = NETWORKS[str]) == null ? void 0 : _a2.icon) != null ? _b : "globe";
|
|
93
|
+
}
|
|
94
|
+
function getAssetCode(str) {
|
|
95
|
+
var _a2, _b;
|
|
96
|
+
return (_b = (_a2 = ON_RAMP_ASSETS[str]) == null ? void 0 : _a2.code) != null ? _b : str;
|
|
97
|
+
}
|
|
98
|
+
function getAssetName(str) {
|
|
99
|
+
var _a2, _b;
|
|
100
|
+
return (_b = (_a2 = ON_RAMP_ASSETS[str]) == null ? void 0 : _a2.name) != null ? _b : str;
|
|
101
|
+
}
|
|
102
|
+
function getAssetIcon(str) {
|
|
103
|
+
var _a2, _b;
|
|
104
|
+
return (_b = (_a2 = ON_RAMP_ASSETS[str]) == null ? void 0 : _a2.icon) != null ? _b : "emptyCircle";
|
|
105
|
+
}
|
|
106
|
+
const MOBILE_SIZE = 480;
|
|
107
|
+
const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
108
|
+
const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
109
|
+
const BODY_MOTION_VARIANTS = {
|
|
110
|
+
enter: (direction) => {
|
|
111
|
+
return {
|
|
112
|
+
scale: direction > 0 ? 0.9 : 1.1,
|
|
113
|
+
opacity: 0
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
center: {
|
|
117
|
+
scale: 1,
|
|
118
|
+
opacity: 1
|
|
119
|
+
},
|
|
120
|
+
exit: (direction) => {
|
|
121
|
+
return {
|
|
122
|
+
scale: direction < 0 ? 0.9 : 1.1,
|
|
123
|
+
opacity: 0
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const BODY_TRANSITION = {
|
|
128
|
+
duration: 0.2
|
|
129
|
+
};
|
|
130
|
+
const SDK_VERSION = (_a = process.env.PARA_REACT_SDK_VERSION) != null ? _a : "";
|
|
131
|
+
export * from "./aaguiMetadata.js";
|
|
132
|
+
export * from "./externalWalletDefaults.js";
|
|
133
|
+
export * from "./oAuthLogos.js";
|
|
134
|
+
export {
|
|
135
|
+
BODY_MOTION_VARIANTS,
|
|
136
|
+
BODY_TRANSITION,
|
|
137
|
+
EMAIL_REGEX,
|
|
138
|
+
MOBILE_SIZE,
|
|
139
|
+
NETWORKS,
|
|
140
|
+
NETWORK_NOT_SUPPORTED_ERROR,
|
|
141
|
+
ON_RAMP_ASSETS,
|
|
142
|
+
ON_RAMP_PROVIDERS,
|
|
143
|
+
PARA_CONNECT,
|
|
144
|
+
PARA_TERMS_AND_CONDITIONS,
|
|
145
|
+
SDK_VERSION,
|
|
146
|
+
WALLET_TYPES_METADATA,
|
|
147
|
+
getAssetCode,
|
|
148
|
+
getAssetIcon,
|
|
149
|
+
getAssetName,
|
|
150
|
+
getNetworkIcon,
|
|
151
|
+
getNetworkName
|
|
152
|
+
};
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
export declare const useDropdownPosition: (inputRef: MutableRefObject<HTMLCpslInputElement | HTMLDivElement | null>) => {
|
|
3
|
+
dropdownMaxHeight: number;
|
|
4
|
+
dropdownWidth: number;
|
|
5
|
+
mobileAnchor: number;
|
|
6
|
+
resize: () => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
const useDropdownPosition = (inputRef) => {
|
|
5
|
+
const [dropdownMaxHeight, setDropdownMaxHeight] = useState();
|
|
6
|
+
const [dropdownWidth, setDropdownWidth] = useState();
|
|
7
|
+
const [mobileAnchor, setMobileAnchor] = useState();
|
|
8
|
+
const resize = () => {
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
|
+
if (typeof window !== "undefined") {
|
|
11
|
+
const newMaxHeight = Math.max(
|
|
12
|
+
window.innerHeight - ((_b = (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.getBoundingClientRect().bottom) != null ? _b : 0) - 20,
|
|
13
|
+
window.innerHeight * 0.25
|
|
14
|
+
);
|
|
15
|
+
setDropdownMaxHeight(newMaxHeight);
|
|
16
|
+
setDropdownWidth((_c = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _c.getBoundingClientRect().width);
|
|
17
|
+
setMobileAnchor((_d = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _d.getBoundingClientRect().height);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
if (inputRef.current && !dropdownMaxHeight) {
|
|
21
|
+
resize();
|
|
22
|
+
}
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
typeof window !== "undefined" && window.addEventListener("resize", resize);
|
|
25
|
+
return () => {
|
|
26
|
+
typeof window !== "undefined" && window.removeEventListener("resize", resize);
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
return { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize };
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
useDropdownPosition
|
|
33
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,4 @@ export * from './components/index.js';
|
|
|
3
3
|
export * from './utils/index.js';
|
|
4
4
|
export * from './hooks/index.js';
|
|
5
5
|
export * from './types/index.js';
|
|
6
|
-
export * from './constants/
|
|
7
|
-
export * from './constants/oAuthLogos.js';
|
|
6
|
+
export * from './constants/index.js';
|
package/dist/index.js
CHANGED
|
@@ -4,5 +4,4 @@ export * from "./components/index.js";
|
|
|
4
4
|
export * from "./utils/index.js";
|
|
5
5
|
export * from "./hooks/index.js";
|
|
6
6
|
export * from "./types/index.js";
|
|
7
|
-
export * from "./constants/
|
|
8
|
-
export * from "./constants/oAuthLogos.js";
|
|
7
|
+
export * from "./constants/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../chunk-
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
3
|
import { truncateAddress } from "@getpara/web-sdk";
|
|
4
4
|
const getExternalWalletDisplayName = ({ address, type, providerId, addressBech32 }, { withAddress = false } = {}) => {
|
|
5
5
|
const walletType = type;
|
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__spreadValues
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MMUBH76A.js";
|
|
5
5
|
import { getOnRampNetworks, getOnRampAssets, toAssetInfoArray } from "@getpara/core-sdk";
|
|
6
6
|
function getCurrencyCode({ assetInfo }, { network, asset, provider }) {
|
|
7
7
|
var _a, _b, _c;
|
package/dist/utils/safeStyled.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-common",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.66",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@getpara/react-components": "2.0.0-alpha.
|
|
6
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
5
|
+
"@getpara/react-components": "2.0.0-alpha.66",
|
|
6
|
+
"@getpara/web-sdk": "2.0.0-alpha.66",
|
|
7
7
|
"@moonpay/moonpay-react": "^1.8.3",
|
|
8
8
|
"@ramp-network/ramp-instant-sdk": "^4.0.5",
|
|
9
9
|
"libphonenumber-js": "^1.11.7",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
],
|
|
41
41
|
"type": "module",
|
|
42
42
|
"types": "dist/index.d.ts",
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "07c8b7b68aa36dec6071e3b3b3a66de2870312c8"
|
|
44
44
|
}
|