@getpara/react-common 2.0.0-alpha.39 → 2.0.0-alpha.40
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/classes/ParaInternal.d.ts +3 -0
- package/dist/classes/ParaInternal.js +7 -0
- package/dist/components/HeroSpinner.d.ts +2 -1
- package/dist/components/HeroSpinner.js +8 -2
- package/dist/components/UserIdentifier.d.ts +6 -0
- package/dist/components/UserIdentifier.js +19 -14
- package/package.json +4 -4
|
@@ -29,4 +29,7 @@ export declare class ParaInternal extends ParaWeb implements InternalInterface {
|
|
|
29
29
|
verifyTelegramLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyTelegramLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyTelegramLink">;
|
|
30
30
|
verifyFarcasterLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyFarcasterLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyFarcasterLink">;
|
|
31
31
|
verifyExternalWalletLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyExternalWalletLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyExternalWalletLink">;
|
|
32
|
+
sendLoginCode: () => Promise<void>;
|
|
33
|
+
get partnerLogo(): string;
|
|
34
|
+
get partnerName(): string;
|
|
32
35
|
}
|
|
@@ -22,6 +22,13 @@ class ParaInternal extends ParaWeb {
|
|
|
22
22
|
this.verifyTelegramLink = super.verifyTelegramLink;
|
|
23
23
|
this.verifyFarcasterLink = super.verifyFarcasterLink;
|
|
24
24
|
this.verifyExternalWalletLink = super.verifyExternalWalletLink;
|
|
25
|
+
this.sendLoginCode = super.sendLoginCode;
|
|
26
|
+
}
|
|
27
|
+
get partnerLogo() {
|
|
28
|
+
return super.partnerLogo;
|
|
29
|
+
}
|
|
30
|
+
get partnerName() {
|
|
31
|
+
return super.partnerName;
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
export {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { IconType } from '@getpara/react-components';
|
|
2
2
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
type Status = 'pending' | 'error' | 'idle' | 'success';
|
|
4
|
-
export declare function HeroSpinner({ icon, status, text, }: PropsWithChildren<{
|
|
4
|
+
export declare function HeroSpinner({ icon, status, text, secondaryText, }: PropsWithChildren<{
|
|
5
5
|
icon?: IconType | ReactNode;
|
|
6
6
|
status?: Status;
|
|
7
7
|
text?: ReactNode;
|
|
8
|
+
secondaryText?: ReactNode;
|
|
8
9
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -6,7 +6,8 @@ import { safeStyled } from "../utils/index.js";
|
|
|
6
6
|
function HeroSpinner({
|
|
7
7
|
icon,
|
|
8
8
|
status = "idle",
|
|
9
|
-
text
|
|
9
|
+
text,
|
|
10
|
+
secondaryText
|
|
10
11
|
}) {
|
|
11
12
|
return /* @__PURE__ */ jsxs(Root, { children: [
|
|
12
13
|
/* @__PURE__ */ jsxs(Hero, { children: [
|
|
@@ -21,11 +22,13 @@ function HeroSpinner({
|
|
|
21
22
|
{
|
|
22
23
|
variant: "bodyM",
|
|
23
24
|
weight: "semiBold",
|
|
25
|
+
align: "center",
|
|
24
26
|
color: status === "error" ? "error" : status === "success" ? "success" : "primary",
|
|
25
27
|
children: text
|
|
26
28
|
}
|
|
27
29
|
)
|
|
28
|
-
] })
|
|
30
|
+
] }),
|
|
31
|
+
secondaryText && /* @__PURE__ */ jsx(SecondaryText, { align: "center", color: "secondary", variant: "semiBold", children: secondaryText })
|
|
29
32
|
] });
|
|
30
33
|
}
|
|
31
34
|
const Root = safeStyled.div`
|
|
@@ -49,6 +52,9 @@ const Text = safeStyled.div`
|
|
|
49
52
|
align-items: center;
|
|
50
53
|
color: ${({ status }) => status === "error" ? "var(--cpsl-color-utility-red)" : status === "success" ? "var(--cpsl-color-utility-green)" : "auto"};
|
|
51
54
|
`;
|
|
55
|
+
const SecondaryText = safeStyled(CpslText)`
|
|
56
|
+
margin-top: 8px;
|
|
57
|
+
`;
|
|
52
58
|
const Spinner = safeStyled(CpslSpinner)`
|
|
53
59
|
position: absolute;
|
|
54
60
|
width: 150px;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { IconType } from '@getpara/react-components';
|
|
1
2
|
import { CoreAuthInfo } from '@getpara/web-sdk';
|
|
3
|
+
export declare function getAuthDisplay(authInfo: CoreAuthInfo): {
|
|
4
|
+
name: string | null;
|
|
5
|
+
icon?: IconType;
|
|
6
|
+
src?: string;
|
|
7
|
+
};
|
|
2
8
|
export declare const UserIdentifier: ({ authInfo }: {
|
|
3
9
|
authInfo?: CoreAuthInfo;
|
|
4
10
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-GOCCUU3Z.js";
|
|
3
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
import { CpslAvatar, CpslIcon, CpslText } from "@getpara/react-components";
|
|
5
7
|
import { displayPhoneNumber } from "@getpara/web-sdk";
|
|
6
8
|
import { getExternalWalletDisplayName, safeStyled } from "../utils/index.js";
|
|
7
|
-
function
|
|
8
|
-
const { authType, identifier, externalWallet } = authInfo;
|
|
9
|
+
function getAuthDisplay(authInfo) {
|
|
10
|
+
const { authType, displayName, identifier, pfpUrl, externalWallet } = authInfo;
|
|
9
11
|
switch (authType) {
|
|
10
12
|
case "email":
|
|
11
|
-
return {
|
|
13
|
+
return { name: identifier.toLowerCase(), icon: "mail" };
|
|
12
14
|
case "phone":
|
|
13
|
-
return {
|
|
15
|
+
return { name: displayPhoneNumber(identifier), icon: "phone" };
|
|
14
16
|
case "farcaster":
|
|
15
|
-
return {
|
|
17
|
+
return __spreadValues({ name: displayName != null ? displayName : `@${identifier}` }, pfpUrl ? { src: pfpUrl } : { icon: "farcasterBrand" });
|
|
16
18
|
case "telegram":
|
|
17
|
-
return {
|
|
19
|
+
return __spreadValues({
|
|
20
|
+
name: displayName != null ? displayName : `Telegram User @${identifier}`
|
|
21
|
+
}, pfpUrl ? { src: pfpUrl } : { icon: "telegramBrand" });
|
|
18
22
|
case "externalWallet":
|
|
19
|
-
return {
|
|
23
|
+
return { name: getExternalWalletDisplayName(externalWallet), icon: "wallet" };
|
|
20
24
|
default:
|
|
21
|
-
return {
|
|
25
|
+
return { name: null, icon: null };
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
28
|
const UserIdentifier = ({ authInfo }) => {
|
|
25
29
|
if (!authInfo) {
|
|
26
30
|
return null;
|
|
27
31
|
}
|
|
28
|
-
const { authType
|
|
29
|
-
const {
|
|
32
|
+
const { authType } = authInfo;
|
|
33
|
+
const { name, icon, src } = getAuthDisplay(authInfo);
|
|
30
34
|
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
31
|
-
/* @__PURE__ */ jsx(IconContainer, { children:
|
|
32
|
-
/* @__PURE__ */ jsx(IdentifierText, { variant: "bodyS", weight: "medium", children:
|
|
35
|
+
/* @__PURE__ */ jsx(IconContainer, { children: src ? /* @__PURE__ */ jsx(Avatar, { src, size: "20px", variant: "round" }) : /* @__PURE__ */ jsx(Icon, { icon, size: authType === "telegram" ? "20px" : "13px" }) }),
|
|
36
|
+
/* @__PURE__ */ jsx(IdentifierText, { variant: "bodyS", weight: "medium", children: name })
|
|
33
37
|
] });
|
|
34
38
|
};
|
|
35
39
|
const Container = safeStyled.div`
|
|
@@ -61,5 +65,6 @@ const Avatar = safeStyled(CpslAvatar)`
|
|
|
61
65
|
--container-padding: 0;
|
|
62
66
|
`;
|
|
63
67
|
export {
|
|
64
|
-
UserIdentifier
|
|
68
|
+
UserIdentifier,
|
|
69
|
+
getAuthDisplay
|
|
65
70
|
};
|
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.40",
|
|
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.40",
|
|
6
|
+
"@getpara/web-sdk": "2.0.0-alpha.40",
|
|
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": "2506044cd3ed127774fb7d537ae850b43acfe8b7"
|
|
44
44
|
}
|