@getpara/react-common 2.0.0-alpha.19 → 2.0.0-alpha.21

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.
@@ -1,10 +1,9 @@
1
- import ParaWeb from '@getpara/web-sdk';
2
- export declare class ParaInternal extends ParaWeb {
1
+ import ParaWeb, { InternalInterface } from '@getpara/web-sdk';
2
+ export declare class ParaInternal extends ParaWeb implements InternalInterface {
3
3
  setupAfterLogin: ({ temporaryShares, skipSessionRefresh, }?: {
4
4
  temporaryShares?: any[];
5
5
  skipSessionRefresh?: boolean;
6
6
  }) => Promise<void>;
7
- getSupportedCreateAuthMethods: () => Promise<Set<import("@getpara/web-sdk").AuthMethod>>;
8
7
  getTransmissionKeyShares: ({ isForNewDevice }?: {
9
8
  isForNewDevice?: boolean;
10
9
  }) => Promise<any>;
@@ -16,10 +15,17 @@ export declare class ParaInternal extends ParaWeb {
16
15
  extras?: import("@getpara/web-sdk").AuthExtras;
17
16
  userId?: string;
18
17
  }) => Promise<typeof this.authInfo>;
19
- supportedAuthMethods: (auth: import("@getpara/user-management-client").Auth<import("@getpara/user-management-client").PrimaryAuthType | "userId">) => Promise<Set<import("@getpara/web-sdk").AuthMethod>>;
18
+ supportedAuthMethods: (auth: import("@getpara/web-sdk").Auth<import("@getpara/user-management-client").PrimaryAuthType | "userId">) => Promise<Set<import("@getpara/web-sdk").AuthMethod>>;
20
19
  constructPortalUrl: (type: import("@getpara/core-sdk/dist/types/types").PortalUrlType, opts?: import("@getpara/core-sdk/dist/types/types").PortalUrlOptions) => Promise<string>;
21
20
  getNewCredentialAndUrl: ({ authMethod, isForNewDevice, portalTheme, shorten, }?: import("@getpara/core-sdk/dist/types/types").NewCredentialUrlParams) => Promise<{
22
21
  credentialId: string;
23
22
  url?: string;
24
23
  }>;
24
+ linkAccount: (opts: import("@getpara/web-sdk").InternalMethodParams<"linkAccount">) => import("@getpara/web-sdk").InternalMethodResponse<"linkAccount">;
25
+ unlinkAccount: ({ linkedAccountId, }: import("@getpara/web-sdk").InternalMethodParams<"unlinkAccount">) => import("@getpara/web-sdk").InternalMethodResponse<"unlinkAccount">;
26
+ verifyEmailOrPhoneLink: ({ verificationCode, }: import("@getpara/web-sdk").InternalMethodParams<"verifyEmailOrPhoneLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyEmailOrPhoneLink">;
27
+ verifyOAuthLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyOAuthLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyOAuthLink">;
28
+ verifyTelegramLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyTelegramLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyTelegramLink">;
29
+ verifyFarcasterLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyFarcasterLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyFarcasterLink">;
30
+ verifyExternalWalletLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyExternalWalletLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyExternalWalletLink">;
25
31
  }
@@ -5,7 +5,6 @@ class ParaInternal extends ParaWeb {
5
5
  constructor() {
6
6
  super(...arguments);
7
7
  this.setupAfterLogin = super.setupAfterLogin;
8
- this.getSupportedCreateAuthMethods = super.getSupportedCreateAuthMethods;
9
8
  this.getTransmissionKeyShares = super.getTransmissionKeyShares;
10
9
  this.userSetupAfterLogin = super.userSetupAfterLogin;
11
10
  this.setLoginEncryptionKeyPair = super.setLoginEncryptionKeyPair;
@@ -15,6 +14,13 @@ class ParaInternal extends ParaWeb {
15
14
  this.supportedAuthMethods = super.supportedAuthMethods;
16
15
  this.constructPortalUrl = super.constructPortalUrl;
17
16
  this.getNewCredentialAndUrl = super.getNewCredentialAndUrl;
17
+ this.linkAccount = super.linkAccount;
18
+ this.unlinkAccount = super.unlinkAccount;
19
+ this.verifyEmailOrPhoneLink = super.verifyEmailOrPhoneLink;
20
+ this.verifyOAuthLink = super.verifyOAuthLink;
21
+ this.verifyTelegramLink = super.verifyTelegramLink;
22
+ this.verifyFarcasterLink = super.verifyFarcasterLink;
23
+ this.verifyExternalWalletLink = super.verifyExternalWalletLink;
18
24
  }
19
25
  }
20
26
  export {
@@ -1,8 +1,8 @@
1
1
  import { IconType } from '@getpara/react-components';
2
2
  import { PropsWithChildren, ReactNode } from 'react';
3
- type Status = 'loading' | 'error' | 'inactive';
3
+ type Status = 'pending' | 'error' | 'idle' | 'success';
4
4
  export declare function HeroSpinner({ icon, status, text, }: PropsWithChildren<{
5
- icon?: IconType;
5
+ icon?: IconType | ReactNode;
6
6
  status?: Status;
7
7
  text?: ReactNode;
8
8
  }>): import("react/jsx-runtime").JSX.Element;
@@ -5,27 +5,34 @@ import { CpslIcon, CpslSpinner, CpslText } from "@getpara/react-components";
5
5
  import { safeStyled } from "../utils/index.js";
6
6
  function HeroSpinner({
7
7
  icon,
8
- status = "inactive",
8
+ status = "idle",
9
9
  text
10
10
  }) {
11
11
  return /* @__PURE__ */ jsxs(Root, { children: [
12
12
  /* @__PURE__ */ jsxs(Hero, { children: [
13
- /* @__PURE__ */ jsx(Spinner, { size: 150, barWidth: 9, variant: status === "loading" ? "default" : status }),
14
- icon && /* @__PURE__ */ jsx(CpslIcon, { icon, size: "80px" })
13
+ /* @__PURE__ */ jsx(Spinner, { size: 155, barWidth: 8, variant: status }),
14
+ typeof icon === "string" ? /* @__PURE__ */ jsx(CpslIcon, { icon, size: "80px" }) : icon
15
15
  ] }),
16
16
  /* @__PURE__ */ jsxs(Text, { status, children: [
17
17
  status === "error" && /* @__PURE__ */ jsx(CpslIcon, { icon: "alertCircle", size: "16px", style: { stroke: "currentColor" } }),
18
- /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", weight: "semiBold", color: status === "error" ? "error" : "primary", children: text })
18
+ status === "success" && /* @__PURE__ */ jsx(CpslIcon, { icon: "checkCircle", size: "16px", style: { stroke: "currentColor" } }),
19
+ /* @__PURE__ */ jsx(
20
+ CpslText,
21
+ {
22
+ variant: "bodyM",
23
+ weight: "semiBold",
24
+ color: status === "error" ? "error" : status === "success" ? "success" : "primary",
25
+ children: text
26
+ }
27
+ )
19
28
  ] })
20
29
  ] });
21
30
  }
22
31
  const Root = safeStyled.div`
23
- height: 276px;
24
32
  display: flex;
25
33
  flex-direction: column;
26
34
  justify-content: center;
27
35
  align-items: center;
28
- gap: 16px;
29
36
  `;
30
37
  const Hero = safeStyled.div`
31
38
  width: 150px;
@@ -40,7 +47,7 @@ const Text = safeStyled.div`
40
47
  display: flex;
41
48
  gap: 4px;
42
49
  align-items: center;
43
- color: ${({ status }) => status === "error" ? "var(--cpsl-color-utility-red)" : "auto"};
50
+ color: ${({ status }) => status === "error" ? "var(--cpsl-color-utility-red)" : status === "success" ? "var(--cpsl-color-utility-green)" : "auto"};
44
51
  `;
45
52
  const Spinner = safeStyled(CpslSpinner)`
46
53
  position: absolute;
@@ -49,6 +56,7 @@ const Spinner = safeStyled(CpslSpinner)`
49
56
  top: 0;
50
57
  left: 0;
51
58
  right: 0;
59
+ transition: 0.2s color;
52
60
  `;
53
61
  export {
54
62
  HeroSpinner
@@ -1,6 +1,7 @@
1
- import { AuthStateLogin, AuthStateVerify, TWalletType } from '@getpara/web-sdk';
1
+ import ParaWeb, { AuthStateLogin, AuthStateVerify, ExternalWalletInfo, TExternalWallet, TWalletType, Wallet } from '@getpara/web-sdk';
2
2
  export type WalletMetadata = {
3
3
  id: string;
4
+ internalId: TExternalWallet;
4
5
  name: string;
5
6
  iconUrl: string;
6
7
  rdns?: string;
@@ -26,6 +27,7 @@ export type WalletMetadata = {
26
27
  linux?: string;
27
28
  desktop?: string;
28
29
  };
30
+ hasIosSafariExtension?: boolean;
29
31
  };
30
32
  export type CommonWallet = {
31
33
  connect: (isConnectionOnly?: boolean) => Promise<{
@@ -46,45 +48,53 @@ export type CommonChain = {
46
48
  id: string | number;
47
49
  name: string;
48
50
  };
49
- export declare enum EvmWallet {
50
- METAMASK = "METAMASK",
51
- RAINBOW = "RAINBOW",
52
- COINBASE = "COINBASE",
53
- WALLETCONNECT = "WALLETCONNECT",
54
- ZERION = "ZERION",
55
- SAFE = "SAFE",
56
- RABBY = "RABBY",
57
- OKX = "OKX",
58
- HAHA = "HAHA",
59
- BACKPACK = "BACKPACK"
60
- }
61
- export declare enum SolanaWallet {
62
- PHANTOM = "PHANTOM",
63
- GLOW = "GLOW",
64
- BACKPACK = "BACKPACK",
65
- SOLFLARE = "SOLFLARE"
66
- }
67
- export declare enum CosmosWallet {
68
- KEPLR = "KEPLR",
69
- LEAP = "LEAP",
70
- COSMOSTATION = "COSMOSTATION"
71
- }
72
- export declare const ExternalWallet: {
73
- KEPLR: CosmosWallet.KEPLR;
74
- LEAP: CosmosWallet.LEAP;
75
- COSMOSTATION: CosmosWallet.COSMOSTATION;
76
- PHANTOM: SolanaWallet.PHANTOM;
77
- GLOW: SolanaWallet.GLOW;
78
- BACKPACK: SolanaWallet.BACKPACK;
79
- SOLFLARE: SolanaWallet.SOLFLARE;
80
- METAMASK: EvmWallet.METAMASK;
81
- RAINBOW: EvmWallet.RAINBOW;
82
- COINBASE: EvmWallet.COINBASE;
83
- WALLETCONNECT: EvmWallet.WALLETCONNECT;
84
- ZERION: EvmWallet.ZERION;
85
- SAFE: EvmWallet.SAFE;
86
- RABBY: EvmWallet.RABBY;
87
- OKX: EvmWallet.OKX;
88
- HAHA: EvmWallet.HAHA;
51
+ export type SignArgs = {
52
+ message: string;
53
+ externalWallet?: ExternalWalletInfo;
89
54
  };
90
- export type TExternalWallet = keyof typeof ExternalWallet;
55
+ export type SignResult = {
56
+ address?: string;
57
+ signature?: string;
58
+ error?: string;
59
+ };
60
+ export type SwitchChainResult = {
61
+ error: string[];
62
+ } | void;
63
+ export type ConnectParaEmbedded = {
64
+ connectParaEmbedded: () => Promise<{
65
+ result?: unknown;
66
+ error?: string;
67
+ }>;
68
+ };
69
+ export type ChainManagement<ChainId, R extends SwitchChainResult = SwitchChainResult> = {
70
+ chains: CommonChain[];
71
+ chainId?: ChainId;
72
+ switchChain: (_: ChainId) => Promise<R>;
73
+ };
74
+ export type BalanceManagement<B = string> = {
75
+ balance?: B;
76
+ getWalletBalance: () => Promise<B | undefined>;
77
+ };
78
+ export type ExternalWalletContextType<S extends SignResult = SignResult> = {
79
+ wallets: CommonWallet[];
80
+ disconnect: () => Promise<void>;
81
+ signMessage: (_: SignArgs) => Promise<S>;
82
+ signVerificationMessage: () => Promise<S>;
83
+ requestInfo: (_: TExternalWallet) => Promise<ExternalWalletInfo>;
84
+ disconnectBase: (_?: TExternalWallet) => Promise<void>;
85
+ };
86
+ export type ExternalWalletProviderConfigBase = {
87
+ onSwitchWallet?: (args: {
88
+ address?: string;
89
+ error?: string;
90
+ }) => void;
91
+ para: ParaWeb;
92
+ walletsWithFullAuth: TExternalWallet[];
93
+ includeWalletVerification?: boolean;
94
+ connectionOnly?: boolean;
95
+ connectedWallet?: Omit<Wallet, 'signer'> | null;
96
+ };
97
+ export type ExternalWalletProviderConfig<W, P = {}> = ExternalWalletProviderConfigBase & {
98
+ wallets: W[];
99
+ } & P;
100
+ export { type TExternalWallet };
@@ -1,37 +1 @@
1
1
  "use client";
2
- import {
3
- __spreadValues
4
- } from "../chunk-GOCCUU3Z.js";
5
- var EvmWallet = /* @__PURE__ */ ((EvmWallet2) => {
6
- EvmWallet2["METAMASK"] = "METAMASK";
7
- EvmWallet2["RAINBOW"] = "RAINBOW";
8
- EvmWallet2["COINBASE"] = "COINBASE";
9
- EvmWallet2["WALLETCONNECT"] = "WALLETCONNECT";
10
- EvmWallet2["ZERION"] = "ZERION";
11
- EvmWallet2["SAFE"] = "SAFE";
12
- EvmWallet2["RABBY"] = "RABBY";
13
- EvmWallet2["OKX"] = "OKX";
14
- EvmWallet2["HAHA"] = "HAHA";
15
- EvmWallet2["BACKPACK"] = "BACKPACK";
16
- return EvmWallet2;
17
- })(EvmWallet || {});
18
- var SolanaWallet = /* @__PURE__ */ ((SolanaWallet2) => {
19
- SolanaWallet2["PHANTOM"] = "PHANTOM";
20
- SolanaWallet2["GLOW"] = "GLOW";
21
- SolanaWallet2["BACKPACK"] = "BACKPACK";
22
- SolanaWallet2["SOLFLARE"] = "SOLFLARE";
23
- return SolanaWallet2;
24
- })(SolanaWallet || {});
25
- var CosmosWallet = /* @__PURE__ */ ((CosmosWallet2) => {
26
- CosmosWallet2["KEPLR"] = "KEPLR";
27
- CosmosWallet2["LEAP"] = "LEAP";
28
- CosmosWallet2["COSMOSTATION"] = "COSMOSTATION";
29
- return CosmosWallet2;
30
- })(CosmosWallet || {});
31
- const ExternalWallet = __spreadValues(__spreadValues(__spreadValues({}, EvmWallet), SolanaWallet), CosmosWallet);
32
- export {
33
- CosmosWallet,
34
- EvmWallet,
35
- ExternalWallet,
36
- SolanaWallet
37
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/react-common",
3
- "version": "2.0.0-alpha.19",
3
+ "version": "2.0.0-alpha.21",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,8 +11,8 @@
11
11
  "*.css"
12
12
  ],
13
13
  "dependencies": {
14
- "@getpara/react-components": "2.0.0-alpha.19",
15
- "@getpara/web-sdk": "2.0.0-alpha.19",
14
+ "@getpara/react-components": "2.0.0-alpha.21",
15
+ "@getpara/web-sdk": "2.0.0-alpha.21",
16
16
  "@moonpay/moonpay-react": "^1.8.3",
17
17
  "@ramp-network/ramp-instant-sdk": "^4.0.5",
18
18
  "libphonenumber-js": "^1.11.1",
@@ -40,5 +40,5 @@
40
40
  "resolutions": {
41
41
  "styled-components": "^6"
42
42
  },
43
- "gitHead": "80d2c5d7e1203fb12378aa29bfd4d7003c7d7075"
43
+ "gitHead": "03daa3537312bc52e0640225c8abdbf8047c15da"
44
44
  }