@getpara/react-sdk 1.9.0 → 1.10.0
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/modal/components/Account/Account.js +4 -1
- package/dist/modal/components/AddFunds/AddFunds.d.ts +0 -2
- package/dist/modal/components/AddFunds/AddFunds.js +32 -187
- package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.js +119 -0
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
- package/dist/modal/components/AddFunds/AddFundsContext.js +154 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.js +105 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.js +66 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.js +233 -0
- package/dist/modal/components/AddFunds/common.d.ts +19 -0
- package/dist/modal/components/AddFunds/common.js +24 -0
- package/dist/modal/components/Body/Body.js +1 -1
- package/dist/modal/components/Controls/Selects.js +9 -59
- package/dist/modal/components/WalletCard/WalletCard.js +1 -1
- package/dist/modal/components/common.d.ts +28 -9
- package/dist/modal/components/common.js +74 -1
- package/dist/modal/constants/constants.d.ts +9 -2
- package/dist/modal/constants/constants.js +34 -8
- package/dist/modal/index.d.ts +1 -1
- package/dist/modal/index.js +2 -2
- package/dist/modal/stores/modal/actions.js +11 -1
- package/dist/modal/stores/modal/useModalStore.d.ts +7 -1
- package/dist/modal/stores/modal/useModalStore.js +7 -0
- package/package.json +6 -5
|
@@ -1,23 +1,42 @@
|
|
|
1
1
|
import { CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
2
|
+
import { Network, OnRampAsset } from '@getpara/web-sdk';
|
|
3
|
+
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;
|
|
4
|
+
export declare const QRContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
+
export declare const InfoBoxContent: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
export declare const InfoBoxHeader: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
7
|
export declare const FilledDisabledInput: typeof CpslInput;
|
|
7
8
|
export declare const FullWidthFilledDisabledInput: typeof CpslInput;
|
|
8
9
|
export declare const CenteredText: typeof CpslText;
|
|
9
|
-
export declare const InnerStepContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
10
|
-
export declare const StepContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
|
|
10
|
+
export declare const InnerStepContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
11
|
+
export declare const StepContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Substitute<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
|
|
11
12
|
ref?: import("react").Ref<HTMLDivElement>;
|
|
12
13
|
}, {
|
|
13
14
|
$wide?: boolean;
|
|
14
15
|
}>> & string;
|
|
15
16
|
export declare const Heading: typeof CpslText;
|
|
16
17
|
export declare const StyledCpslTileButton: typeof CpslTileButton;
|
|
17
|
-
export declare const HeroIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
18
|
+
export declare const HeroIcon: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
18
19
|
ref?: import("react").Ref<any>;
|
|
19
20
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
20
|
-
export declare const
|
|
21
|
-
|
|
21
|
+
export declare const HeaderSelect: 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 HeaderSelectItem: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
28
|
+
ref?: import("react").Ref<any>;
|
|
29
|
+
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
30
|
+
export declare const HeaderSelectContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
31
|
+
export declare function AssetIcon({ asset, size }: {
|
|
32
|
+
asset: OnRampAsset;
|
|
33
|
+
size?: string;
|
|
34
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare function NetworkIcon({ network, size }: {
|
|
36
|
+
network: Network;
|
|
37
|
+
size?: string;
|
|
38
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare const ErrorContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
40
|
+
export declare const ErrorIcon: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
22
41
|
ref?: import("react").Ref<any>;
|
|
23
42
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-MMUBH76A.js";
|
|
3
|
-
import {
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { CpslIcon, CpslInput, CpslSelect, CpslSelectItem, CpslText, CpslTileButton } from "@getpara/react-components";
|
|
4
5
|
import { styled } from "styled-components";
|
|
6
|
+
import { MOBILE_SIZE, NETWORKS, ON_RAMP_ASSETS } from "../constants/constants.js";
|
|
7
|
+
import { useThemeStore } from "../stores/index.js";
|
|
5
8
|
const SpinnerContainer = styled.div`
|
|
6
9
|
display: flex;
|
|
7
10
|
align-items: center;
|
|
@@ -67,6 +70,71 @@ const HeroIcon = styled(CpslIcon)`
|
|
|
67
70
|
--width: 80px;
|
|
68
71
|
--icon-color: var(--cpsl-color-text-primary);
|
|
69
72
|
`;
|
|
73
|
+
const HeaderSelect = styled(CpslSelect)`
|
|
74
|
+
--container-height: auto;
|
|
75
|
+
--container-border-width: 0px;
|
|
76
|
+
--container-padding-end: 0px;
|
|
77
|
+
--container-padding-start: 0px;
|
|
78
|
+
--container-background-color: transparent;
|
|
79
|
+
--container-box-shadow: none;
|
|
80
|
+
--container-gap: 2px;
|
|
81
|
+
--icon-width: 16px;
|
|
82
|
+
--icon-height: 16px;
|
|
83
|
+
position: relative;
|
|
84
|
+
|
|
85
|
+
&::part(selected-text) {
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&::part(dropdown) {
|
|
90
|
+
min-width: ${({ $width }) => `${$width - 2}px`};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&::part(popover) {
|
|
94
|
+
/* Have to adjust the top of the popover here since we're using a transform on the modal which causes fixed position items to not be relative to the viewport */
|
|
95
|
+
@media (max-width: ${MOBILE_SIZE}px) {
|
|
96
|
+
top: ${({ $top }) => $top ? `${$top}px` : "0px"};
|
|
97
|
+
bottom: 16px;
|
|
98
|
+
}
|
|
99
|
+
cpsl-auth-modal.force-mobile-media & {
|
|
100
|
+
top: ${({ $top }) => $top ? `${$top}px` : "0px"};
|
|
101
|
+
bottom: 16px;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&::part(icon) {
|
|
106
|
+
--icon-color: var(--cpsl-color-contrast);
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
const HeaderSelectItem = styled(CpslSelectItem)`
|
|
110
|
+
--outer-container-padding-start: 4px;
|
|
111
|
+
--outer-container-padding-end: 4px;
|
|
112
|
+
--outer-container-padding-top: 4px;
|
|
113
|
+
--outer-container-padding-bottom: 4px;
|
|
114
|
+
`;
|
|
115
|
+
const HeaderSelectContainer = styled.div`
|
|
116
|
+
position: relative;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
gap: 8px;
|
|
120
|
+
border-radius: 1000px;
|
|
121
|
+
background-color: var(--cpsl-color-background-8);
|
|
122
|
+
padding: 4px;
|
|
123
|
+
`;
|
|
124
|
+
const StyledIcon = styled(CpslIcon)`
|
|
125
|
+
background: var(--cpsl-color-background-0);
|
|
126
|
+
border-radius: 100%;
|
|
127
|
+
`;
|
|
128
|
+
function AssetIcon({ asset, size }) {
|
|
129
|
+
const isDark = useThemeStore((state) => state.isDark);
|
|
130
|
+
const data = ON_RAMP_ASSETS[asset];
|
|
131
|
+
return /* @__PURE__ */ jsx(StyledIcon, { size, icon: data.icon, inset: data.isCircular ? void 0 : "15%", invert: isDark && data.isDark });
|
|
132
|
+
}
|
|
133
|
+
function NetworkIcon({ network, size }) {
|
|
134
|
+
const isDark = useThemeStore((state) => state.isDark);
|
|
135
|
+
const data = NETWORKS[network];
|
|
136
|
+
return /* @__PURE__ */ jsx(StyledIcon, { size, icon: data.icon, inset: data.isCircular ? void 0 : "15%", invert: isDark && data.isDark });
|
|
137
|
+
}
|
|
70
138
|
const ErrorContainer = styled.div`
|
|
71
139
|
display: flex;
|
|
72
140
|
align-items: center;
|
|
@@ -79,16 +147,21 @@ const ErrorIcon = styled(CpslIcon)`
|
|
|
79
147
|
--icon-color: var(--cpsl-color-text-error);
|
|
80
148
|
`;
|
|
81
149
|
export {
|
|
150
|
+
AssetIcon,
|
|
82
151
|
CenteredText,
|
|
83
152
|
ErrorContainer,
|
|
84
153
|
ErrorIcon,
|
|
85
154
|
FilledDisabledInput,
|
|
86
155
|
FullWidthFilledDisabledInput,
|
|
156
|
+
HeaderSelect,
|
|
157
|
+
HeaderSelectContainer,
|
|
158
|
+
HeaderSelectItem,
|
|
87
159
|
Heading,
|
|
88
160
|
HeroIcon,
|
|
89
161
|
InfoBoxContent,
|
|
90
162
|
InfoBoxHeader,
|
|
91
163
|
InnerStepContainer,
|
|
164
|
+
NetworkIcon,
|
|
92
165
|
QRContainer,
|
|
93
166
|
SpinnerContainer,
|
|
94
167
|
StepContainer,
|
|
@@ -12,21 +12,28 @@ export interface OnRampProviderConfig {
|
|
|
12
12
|
backgroundColors: string[];
|
|
13
13
|
}
|
|
14
14
|
export declare const ON_RAMP_PROVIDERS: Record<OnRampProvider, OnRampProviderConfig>;
|
|
15
|
-
|
|
15
|
+
type Networks = Record<Network, {
|
|
16
16
|
name: string;
|
|
17
17
|
icon: IconType;
|
|
18
|
+
isCircular?: boolean;
|
|
19
|
+
isDark?: boolean;
|
|
18
20
|
}>;
|
|
21
|
+
export declare const NETWORKS: Networks;
|
|
19
22
|
export declare const ON_RAMP_ASSETS: Record<OnRampAsset, {
|
|
20
23
|
name: string;
|
|
21
24
|
code: string;
|
|
22
25
|
icon: IconType;
|
|
26
|
+
isCircular?: boolean;
|
|
27
|
+
isDark?: boolean;
|
|
23
28
|
}>;
|
|
24
29
|
export declare function getNetworkName(str: Network | string): string;
|
|
25
30
|
export declare function getNetworkIcon(str: Network | string): IconType;
|
|
31
|
+
export declare function getAssetCode(str: OnRampAsset | string): string;
|
|
26
32
|
export declare function getAssetName(str: OnRampAsset | string): string;
|
|
27
|
-
export declare function getAssetIcon(str: OnRampAsset | string): "
|
|
33
|
+
export declare function getAssetIcon(str: OnRampAsset | string): "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowNarrow" | "arrow" | "asterisk" | "backupKit" | "bank" | "baseBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "close" | "clubhouseBrand" | "clubhouse" | "code" | "copy07" | "copy" | "cosmos" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "discord" | "dot" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "farcaster" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "googleBrand" | "google" | "gridDots" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "key" | "laptop" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "optimismBrand" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "para" | "passcode" | "phone" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "search" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solana" | "spacingHeight" | "star04Filled" | "stars01Filled" | "stars" | "stopSquare" | "stripeBrand" | "telegramBrand" | "telegram" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "userCircle" | "user" | "wallet" | "x" | "youtubeBrand" | "youtube" | "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";
|
|
28
34
|
export declare const MOBILE_SIZE = 480;
|
|
29
35
|
export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
30
36
|
export declare const EMAIL_REGEX: RegExp;
|
|
31
37
|
export declare const BODY_MOTION_VARIANTS: Variants;
|
|
32
38
|
export declare const BODY_TRANSITION: Transition;
|
|
39
|
+
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../../chunk-MMUBH76A.js";
|
|
3
6
|
import { Network, OnRampAsset, OnRampMethod, OnRampProvider } from "@getpara/core-sdk";
|
|
4
7
|
const PARA_CONNECT = "https://connect.getpara.com/";
|
|
5
8
|
const PARA_TERMS_AND_CONDITIONS = "https://getpara.com/terms";
|
|
@@ -29,7 +32,17 @@ const ON_RAMP_PROVIDERS = {
|
|
|
29
32
|
backgroundColors: ["#7715F5", "#9647fd"]
|
|
30
33
|
}
|
|
31
34
|
};
|
|
32
|
-
const
|
|
35
|
+
const ICON_TYPES = {
|
|
36
|
+
ethereum: { isDark: true },
|
|
37
|
+
usdcBrand: { isCircular: true },
|
|
38
|
+
arbitrumBrand: { isCircular: true },
|
|
39
|
+
baseBrand: { isCircular: true },
|
|
40
|
+
optimismBrand: { isCircular: true },
|
|
41
|
+
cosmos: { isCircular: true, isDark: true },
|
|
42
|
+
celoBrand: { isCircular: true },
|
|
43
|
+
tetherBrand: { isCircular: true }
|
|
44
|
+
};
|
|
45
|
+
const NETWORKS = Object.entries({
|
|
33
46
|
[Network.ETHEREUM]: { name: "Ethereum", icon: "ethereum" },
|
|
34
47
|
[Network.SEPOLIA]: { name: "Sepolia", icon: "ethereum" },
|
|
35
48
|
[Network.ARBITRUM]: { name: "Arbitrum", icon: "arbitrumBrand" },
|
|
@@ -41,11 +54,15 @@ const NETWORKS = {
|
|
|
41
54
|
[Network.CELO]: { name: "Celo", icon: "celoBrand" },
|
|
42
55
|
[Network.SOLANA_DEVNET]: { name: "Solana Devnet", icon: "solana" },
|
|
43
56
|
[Network.NOBLE]: { name: "Noble", icon: "nobleBrand" }
|
|
44
|
-
}
|
|
45
|
-
|
|
57
|
+
}).reduce((acc, [key, entry]) => {
|
|
58
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
59
|
+
[key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
|
|
60
|
+
});
|
|
61
|
+
}, {});
|
|
62
|
+
const ON_RAMP_ASSETS = Object.entries({
|
|
46
63
|
[OnRampAsset.ETHEREUM]: { name: "Ethereum", code: "ETH", icon: "ethereum" },
|
|
47
|
-
[OnRampAsset.USDC]: { name: "
|
|
48
|
-
[OnRampAsset.POLYGON]: { name: "Polygon", code: "
|
|
64
|
+
[OnRampAsset.USDC]: { name: "USD Coin", code: "USDC", icon: "usdcBrand" },
|
|
65
|
+
[OnRampAsset.POLYGON]: { name: "Polygon", code: "POL", icon: "polygonBrand" },
|
|
49
66
|
[OnRampAsset.SOLANA]: { name: "Solana", code: "SOL", icon: "solana" },
|
|
50
67
|
[OnRampAsset.ATOM]: { name: "Atom", code: "ATOM", icon: "cosmos" },
|
|
51
68
|
[OnRampAsset.CELO]: { name: "Celo", code: "CELO", icon: "celoBrand" },
|
|
@@ -53,7 +70,11 @@ const ON_RAMP_ASSETS = {
|
|
|
53
70
|
[OnRampAsset.CUSD]: { name: "Celo Dollar", code: "CUSD", icon: "celoBrand" },
|
|
54
71
|
[OnRampAsset.CEUR]: { name: "Celo Euro", code: "CEUR", icon: "celoBrand" },
|
|
55
72
|
[OnRampAsset.CREAL]: { name: "Celo Real", code: "CREAL", icon: "celoBrand" }
|
|
56
|
-
}
|
|
73
|
+
}).reduce((acc, [key, entry]) => {
|
|
74
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
75
|
+
[key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
|
|
76
|
+
});
|
|
77
|
+
}, {});
|
|
57
78
|
function getNetworkName(str) {
|
|
58
79
|
var _a, _b;
|
|
59
80
|
return (_b = (_a = NETWORKS[str]) == null ? void 0 : _a.name) != null ? _b : `${str[0]}${str.slice(1).toLowerCase()}`;
|
|
@@ -62,10 +83,14 @@ function getNetworkIcon(str) {
|
|
|
62
83
|
var _a, _b;
|
|
63
84
|
return (_b = (_a = NETWORKS[str]) == null ? void 0 : _a.icon) != null ? _b : "globe";
|
|
64
85
|
}
|
|
65
|
-
function
|
|
86
|
+
function getAssetCode(str) {
|
|
66
87
|
var _a, _b;
|
|
67
88
|
return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.code) != null ? _b : str;
|
|
68
89
|
}
|
|
90
|
+
function getAssetName(str) {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.name) != null ? _b : str;
|
|
93
|
+
}
|
|
69
94
|
function getAssetIcon(str) {
|
|
70
95
|
var _a, _b;
|
|
71
96
|
return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.icon) != null ? _b : "emptyCircle";
|
|
@@ -105,6 +130,7 @@ export {
|
|
|
105
130
|
ON_RAMP_PROVIDERS,
|
|
106
131
|
PARA_CONNECT,
|
|
107
132
|
PARA_TERMS_AND_CONDITIONS,
|
|
133
|
+
getAssetCode,
|
|
108
134
|
getAssetIcon,
|
|
109
135
|
getAssetName,
|
|
110
136
|
getNetworkIcon,
|
package/dist/modal/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { ParaModalProps, ParaModalHandle, ParaModalTheme } from './types/mo
|
|
|
3
3
|
export { ModalStep, type ModalStepProp } from './utils/steps.js';
|
|
4
4
|
export { AuthLayout } from './types/modalProps.js';
|
|
5
5
|
export * from './utils/openPopup.js';
|
|
6
|
-
export { ON_RAMP_PROVIDERS, ON_RAMP_ASSETS, NETWORKS, getAssetIcon,
|
|
6
|
+
export { ON_RAMP_PROVIDERS, ON_RAMP_ASSETS, NETWORKS, getAssetIcon, getAssetCode, getNetworkIcon, getNetworkName, } from './constants/constants.js';
|
|
7
7
|
export { SaveRecoverySecret } from './components/RecoverySecretStep/RecoverySecretStep.js';
|
|
8
8
|
export * from './utils/validateOnRampConfig.js';
|
|
9
9
|
export * from './types/externalWallets.js';
|
package/dist/modal/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ON_RAMP_ASSETS,
|
|
10
10
|
NETWORKS,
|
|
11
11
|
getAssetIcon,
|
|
12
|
-
|
|
12
|
+
getAssetCode,
|
|
13
13
|
getNetworkIcon,
|
|
14
14
|
getNetworkName
|
|
15
15
|
} from "./constants/constants.js";
|
|
@@ -25,8 +25,8 @@ export {
|
|
|
25
25
|
ON_RAMP_ASSETS,
|
|
26
26
|
ON_RAMP_PROVIDERS,
|
|
27
27
|
SaveRecoverySecret,
|
|
28
|
+
getAssetCode,
|
|
28
29
|
getAssetIcon,
|
|
29
|
-
getAssetName,
|
|
30
30
|
getNetworkIcon,
|
|
31
31
|
getNetworkName,
|
|
32
32
|
useExternalWalletProviderStore
|
|
@@ -15,10 +15,15 @@ const getActions = (set, get) => ({
|
|
|
15
15
|
},
|
|
16
16
|
decrementStep: () => {
|
|
17
17
|
var _a;
|
|
18
|
+
const currentStep = get().step;
|
|
19
|
+
const onRampStep = get().onRampStep;
|
|
20
|
+
if ([ModalStep.ADD_FUNDS_BUY, ModalStep.ADD_FUNDS_WITHDRAW].includes(currentStep) && onRampStep > 0) {
|
|
21
|
+
set({ onRampStep: onRampStep - 1 });
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
18
24
|
const onModalStepChange = get().onModalStepChange;
|
|
19
25
|
const isLogin = get().flow === "login";
|
|
20
26
|
const isAccount = get().flow === "account";
|
|
21
|
-
const currentStep = get().step;
|
|
22
27
|
const webAuthURLForCreate = get().webAuthURLForCreate;
|
|
23
28
|
const iFrameUrl = get().iFrameUrl;
|
|
24
29
|
const refs = get().refs;
|
|
@@ -40,6 +45,10 @@ const getActions = (set, get) => ({
|
|
|
40
45
|
const isLogin = get().flow === "login";
|
|
41
46
|
const isAccount = get().flow === "account";
|
|
42
47
|
const currentStep = get().step;
|
|
48
|
+
const onRampStep = get().onRampStep;
|
|
49
|
+
if ([ModalStep.ADD_FUNDS_BUY, ModalStep.ADD_FUNDS_WITHDRAW].includes(currentStep) && onRampStep > 0) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
43
52
|
return !!(isAccount ? AccountPreviousStep[currentStep] : isLogin ? LoginPreviousStep[currentStep] : SignUpPreviousStep[currentStep]);
|
|
44
53
|
},
|
|
45
54
|
setFlow: (flow) => set({ flow }),
|
|
@@ -51,6 +60,7 @@ const getActions = (set, get) => ({
|
|
|
51
60
|
setSupportedAuthMethods: (supportedAuthMethods) => set({ supportedAuthMethods }),
|
|
52
61
|
setOnRampPurchase: (onRampPurchase) => set((state) => ({ onRampPurchase: __spreadValues(__spreadValues({}, state.onRampPurchase || {}), onRampPurchase) })),
|
|
53
62
|
setOnRampConfig: (onRampConfig) => set({ onRampConfig }),
|
|
63
|
+
setOnRampStep: (onRampStep) => set({ onRampStep }),
|
|
54
64
|
setIsFullyLoggedIn: (isFullyLoggedIn) => set({ isFullyLoggedIn }),
|
|
55
65
|
setAccountAddFundTab: (accountAddFundTab) => set({ accountAddFundTab }),
|
|
56
66
|
setSelectedExternalWalletId: (selectedExternalWalletId) => set({ selectedExternalWalletId }),
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { ModalStep } from '../../utils/steps.js';
|
|
2
2
|
import { OnRampConfig as OnRampConfigBase, OnRampPurchase, WalletType } from '@getpara/web-sdk';
|
|
3
|
-
import { Tab as AddFundsTabType } from '../../components/AddFunds/
|
|
3
|
+
import { Tab as AddFundsTabType } from '../../components/AddFunds/AddFundsContext.js';
|
|
4
4
|
import { AuthMethod } from '@getpara/core-sdk';
|
|
5
5
|
import { BiometricLocationHint } from '@getpara/user-management-client';
|
|
6
6
|
import { MutableRefObject } from 'react';
|
|
7
7
|
type Flow = 'login' | 'signUp' | 'account';
|
|
8
8
|
type ActiveWallet = [string | undefined, WalletType | undefined];
|
|
9
|
+
export declare enum OnRampStep {
|
|
10
|
+
SETTINGS = 0,
|
|
11
|
+
PROVIDER = 1
|
|
12
|
+
}
|
|
9
13
|
export type OnRampConfig = OnRampConfigBase & {
|
|
10
14
|
testMode?: boolean;
|
|
11
15
|
};
|
|
@@ -25,6 +29,7 @@ interface ModalState {
|
|
|
25
29
|
onModalStepChange: (value: OnModalStepChangeValue) => void | undefined;
|
|
26
30
|
onRampConfig: OnRampConfig | undefined;
|
|
27
31
|
onRampPurchase: Partial<OnRampPurchase> | undefined;
|
|
32
|
+
onRampStep: OnRampStep;
|
|
28
33
|
isFullyLoggedIn: boolean;
|
|
29
34
|
accountAddFundTab?: AddFundsTabType;
|
|
30
35
|
selectedExternalWalletId?: string;
|
|
@@ -62,6 +67,7 @@ export interface ModalActions {
|
|
|
62
67
|
setOnModalStepChange: (fn: (value: OnModalStepChangeValue) => void) => void;
|
|
63
68
|
setOnRampConfig: (_: OnRampConfig | undefined) => void;
|
|
64
69
|
setOnRampPurchase: (_: Partial<OnRampPurchase> | undefined) => void;
|
|
70
|
+
setOnRampStep: (_: OnRampStep) => void;
|
|
65
71
|
setIsFullyLoggedIn: (isFullyLoggedIn: boolean) => void;
|
|
66
72
|
setAccountAddFundTab: (accountAddFundTab: AddFundsTabType) => void;
|
|
67
73
|
setSelectedExternalWalletId: (id?: string) => void;
|
|
@@ -7,6 +7,11 @@ import { persist, createJSONStorage } from "zustand/middleware";
|
|
|
7
7
|
import { ModalStep } from "../../utils/steps.js";
|
|
8
8
|
import { getActions } from "./actions.js";
|
|
9
9
|
import { createRef } from "react";
|
|
10
|
+
var OnRampStep = /* @__PURE__ */ ((OnRampStep2) => {
|
|
11
|
+
OnRampStep2[OnRampStep2["SETTINGS"] = 0] = "SETTINGS";
|
|
12
|
+
OnRampStep2[OnRampStep2["PROVIDER"] = 1] = "PROVIDER";
|
|
13
|
+
return OnRampStep2;
|
|
14
|
+
})(OnRampStep || {});
|
|
10
15
|
const DEFAULT_MODAL_STATE = {
|
|
11
16
|
flow: void 0,
|
|
12
17
|
stepDirection: 1,
|
|
@@ -16,6 +21,7 @@ const DEFAULT_MODAL_STATE = {
|
|
|
16
21
|
supportedAuthMethods: /* @__PURE__ */ new Set(),
|
|
17
22
|
onModalStepChange: void 0,
|
|
18
23
|
onRampPurchase: void 0,
|
|
24
|
+
onRampStep: 0 /* SETTINGS */,
|
|
19
25
|
isFullyLoggedIn: false,
|
|
20
26
|
accountAddFundTab: void 0,
|
|
21
27
|
isExternalWalletConnecting: false,
|
|
@@ -61,5 +67,6 @@ const useModalStore = create()(
|
|
|
61
67
|
);
|
|
62
68
|
export {
|
|
63
69
|
DEFAULT_MODAL_STATE,
|
|
70
|
+
OnRampStep,
|
|
64
71
|
useModalStore
|
|
65
72
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"*.css"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@getpara/react-common": "1.
|
|
16
|
-
"@getpara/react-components": "1.
|
|
17
|
-
"@getpara/web-sdk": "1.
|
|
15
|
+
"@getpara/react-common": "1.10.0",
|
|
16
|
+
"@getpara/react-components": "1.10.0",
|
|
17
|
+
"@getpara/web-sdk": "1.10.0",
|
|
18
18
|
"@tanstack/react-query": "^5.0.0",
|
|
19
19
|
"date-fns": "^3.6.0",
|
|
20
20
|
"framer-motion": "11.3.28",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@testing-library/dom": "^10.1.0",
|
|
34
34
|
"@testing-library/react": "^16.0.0",
|
|
35
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
35
36
|
"@types/chrome": "^0.0.237",
|
|
36
37
|
"@types/react": "^18.0.31",
|
|
37
38
|
"@types/react-dom": "^18.2.7",
|
|
@@ -49,5 +50,5 @@
|
|
|
49
50
|
"resolutions": {
|
|
50
51
|
"styled-components": "^6"
|
|
51
52
|
},
|
|
52
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "617cf0aa1307a96ec5e91d39e306e8a0b3b86b82"
|
|
53
54
|
}
|