@arthur2079/internal-profile 0.1.2-next.1

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.
Files changed (159) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/api/errors.d.ts +3 -0
  3. package/dist/api/errors.js +9 -0
  4. package/dist/api/mod.d.ts +4 -0
  5. package/dist/api/mod.js +2 -0
  6. package/dist/api/request.d.ts +19 -0
  7. package/dist/api/request.js +96 -0
  8. package/dist/api/types.d.ts +193 -0
  9. package/dist/api/types.js +1 -0
  10. package/dist/components/ConnectWalletModal/ConnectWalletFooter.d.ts +5 -0
  11. package/dist/components/ConnectWalletModal/ConnectWalletFooter.js +9 -0
  12. package/dist/components/ConnectWalletModal/ConnectWalletModal.constants.d.ts +5 -0
  13. package/dist/components/ConnectWalletModal/ConnectWalletModal.constants.js +8 -0
  14. package/dist/components/ConnectWalletModal/ConnectWalletModal.d.ts +3 -0
  15. package/dist/components/ConnectWalletModal/ConnectWalletModal.helpers.d.ts +2 -0
  16. package/dist/components/ConnectWalletModal/ConnectWalletModal.helpers.js +9 -0
  17. package/dist/components/ConnectWalletModal/ConnectWalletModal.js +194 -0
  18. package/dist/components/ConnectWalletModal/ConnectWalletModal.styles.d.ts +19 -0
  19. package/dist/components/ConnectWalletModal/ConnectWalletModal.styles.js +101 -0
  20. package/dist/components/ConnectWalletModal/ConnectWalletModal.types.d.ts +44 -0
  21. package/dist/components/ConnectWalletModal/ConnectWalletModal.types.js +1 -0
  22. package/dist/components/ConnectWalletModal/EmptyWalletList.d.ts +2 -0
  23. package/dist/components/ConnectWalletModal/EmptyWalletList.js +9 -0
  24. package/dist/components/ConnectWalletModal/StatefulConnectContainer.d.ts +3 -0
  25. package/dist/components/ConnectWalletModal/StatefulConnectContainer.js +37 -0
  26. package/dist/components/ConnectWalletModal/StatefulConnectContainer.styles.d.ts +1 -0
  27. package/dist/components/ConnectWalletModal/StatefulConnectContainer.styles.js +51 -0
  28. package/dist/components/ConnectWalletModal/StatefulConnectContainer.types.d.ts +12 -0
  29. package/dist/components/ConnectWalletModal/StatefulConnectContainer.types.js +1 -0
  30. package/dist/components/ConnectWalletModal/WalletsChainSelect.d.ts +3 -0
  31. package/dist/components/ConnectWalletModal/WalletsChainSelect.js +87 -0
  32. package/dist/components/ConnectWalletModal/WalletsChainSelect.styles.d.ts +21 -0
  33. package/dist/components/ConnectWalletModal/WalletsChainSelect.styles.js +83 -0
  34. package/dist/components/ConnectWalletModal/WalletsChainSelect.types.d.ts +12 -0
  35. package/dist/components/ConnectWalletModal/WalletsChainSelect.types.js +1 -0
  36. package/dist/components/ConnectWalletModal/index.d.ts +3 -0
  37. package/dist/components/ConnectWalletModal/index.js +2 -0
  38. package/dist/components/ProfileWallet/ProfileWallet.d.ts +3 -0
  39. package/dist/components/ProfileWallet/ProfileWallet.js +54 -0
  40. package/dist/components/ProfileWallet/ProfileWallet.styles.d.ts +6 -0
  41. package/dist/components/ProfileWallet/ProfileWallet.styles.js +54 -0
  42. package/dist/components/ProfileWallet/ProfileWallet.types.d.ts +11 -0
  43. package/dist/components/ProfileWallet/ProfileWallet.types.js +1 -0
  44. package/dist/components/ProfileWallet/index.d.ts +1 -0
  45. package/dist/components/ProfileWallet/index.js +1 -0
  46. package/dist/components/ProfileWallets/ConnectedWallets.d.ts +2 -0
  47. package/dist/components/ProfileWallets/ConnectedWallets.js +25 -0
  48. package/dist/components/ProfileWallets/ConnectedWallets.styles.d.ts +4 -0
  49. package/dist/components/ProfileWallets/ConnectedWallets.styles.js +30 -0
  50. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.d.ts +5 -0
  51. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.js +9 -0
  52. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.styles.d.ts +1 -0
  53. package/dist/components/ProfileWallets/ConnectedWalletsEmptyState.styles.js +8 -0
  54. package/dist/components/ProfileWallets/ProfileWallets.d.ts +4 -0
  55. package/dist/components/ProfileWallets/ProfileWallets.js +37 -0
  56. package/dist/components/ProfileWallets/ProfileWallets.styles.d.ts +5 -0
  57. package/dist/components/ProfileWallets/ProfileWallets.styles.js +17 -0
  58. package/dist/components/ProfileWallets/ProfileWallets.types.d.ts +14 -0
  59. package/dist/components/ProfileWallets/ProfileWallets.types.js +1 -0
  60. package/dist/components/ProfileWallets/index.d.ts +1 -0
  61. package/dist/components/ProfileWallets/index.js +1 -0
  62. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.constants.d.ts +3 -0
  63. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.constants.js +2 -0
  64. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.d.ts +3 -0
  65. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.js +23 -0
  66. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.styles.d.ts +4 -0
  67. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.styles.js +23 -0
  68. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.types.d.ts +23 -0
  69. package/dist/components/ProfileWalletsModal/ProfileWalletsModal.types.js +1 -0
  70. package/dist/components/ProfileWalletsModal/index.d.ts +2 -0
  71. package/dist/components/ProfileWalletsModal/index.js +1 -0
  72. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.d.ts +2 -0
  73. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.js +21 -0
  74. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.styles.d.ts +4 -0
  75. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.styles.js +49 -0
  76. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.types.d.ts +7 -0
  77. package/dist/components/SocialWalletIntroModal/SocialWalletIntroModal.types.js +1 -0
  78. package/dist/components/SocialWalletIntroModal/index.d.ts +1 -0
  79. package/dist/components/SocialWalletIntroModal/index.js +1 -0
  80. package/dist/components/StackModal/ModalContainer.d.ts +4 -0
  81. package/dist/components/StackModal/ModalContainer.js +33 -0
  82. package/dist/components/StackModal/ModalContainer.types.d.ts +6 -0
  83. package/dist/components/StackModal/ModalContainer.types.js +1 -0
  84. package/dist/components/StackModal/StackModal.d.ts +3 -0
  85. package/dist/components/StackModal/StackModal.js +90 -0
  86. package/dist/components/StackModal/StackModal.styles.d.ts +2 -0
  87. package/dist/components/StackModal/StackModal.styles.js +77 -0
  88. package/dist/components/StackModal/StackModal.types.d.ts +3 -0
  89. package/dist/components/StackModal/StackModal.types.js +1 -0
  90. package/dist/components/StackModal/index.d.ts +1 -0
  91. package/dist/components/StackModal/index.js +1 -0
  92. package/dist/components/WalletItem/WalletItem.d.ts +3 -0
  93. package/dist/components/WalletItem/WalletItem.js +60 -0
  94. package/dist/components/WalletItem/WalletItem.styles.d.ts +9 -0
  95. package/dist/components/WalletItem/WalletItem.styles.js +71 -0
  96. package/dist/components/WalletItem/WalletItem.types.d.ts +8 -0
  97. package/dist/components/WalletItem/WalletItem.types.js +1 -0
  98. package/dist/components/WalletItem/index.d.ts +1 -0
  99. package/dist/components/WalletItem/index.js +1 -0
  100. package/dist/components/mod.d.ts +5 -0
  101. package/dist/components/mod.js +3 -0
  102. package/dist/constants/errors.d.ts +1 -0
  103. package/dist/constants/errors.js +1 -0
  104. package/dist/constants/events.d.ts +3 -0
  105. package/dist/constants/events.js +3 -0
  106. package/dist/constants/links.d.ts +2 -0
  107. package/dist/constants/links.js +2 -0
  108. package/dist/constants/mod.d.ts +3 -0
  109. package/dist/constants/mod.js +3 -0
  110. package/dist/constants/modals.d.ts +3 -0
  111. package/dist/constants/modals.js +3 -0
  112. package/dist/fetcher.d.ts +3 -0
  113. package/dist/fetcher.js +10 -0
  114. package/dist/hooks/mod.d.ts +4 -0
  115. package/dist/hooks/mod.js +3 -0
  116. package/dist/hooks/useLocalStorage/index.d.ts +1 -0
  117. package/dist/hooks/useLocalStorage/index.js +1 -0
  118. package/dist/hooks/useLocalStorage/useLocalStorage.d.ts +1 -0
  119. package/dist/hooks/useLocalStorage/useLocalStorage.js +24 -0
  120. package/dist/hooks/useProfile/index.d.ts +1 -0
  121. package/dist/hooks/useProfile/index.js +1 -0
  122. package/dist/hooks/useProfile/useProfile.constants.d.ts +2 -0
  123. package/dist/hooks/useProfile/useProfile.constants.js +8 -0
  124. package/dist/hooks/useProfile/useProfile.d.ts +2 -0
  125. package/dist/hooks/useProfile/useProfile.helpers.d.ts +4 -0
  126. package/dist/hooks/useProfile/useProfile.helpers.js +3 -0
  127. package/dist/hooks/useProfile/useProfile.js +20 -0
  128. package/dist/hooks/useProfile/useProfile.types.d.ts +11 -0
  129. package/dist/hooks/useProfile/useProfile.types.js +1 -0
  130. package/dist/hooks/useStackModal.d.ts +38 -0
  131. package/dist/hooks/useStackModal.js +61 -0
  132. package/dist/hooks/useStatefulConnect.d.ts +7 -0
  133. package/dist/hooks/useStatefulConnect.js +15 -0
  134. package/dist/mod.d.ts +1 -0
  135. package/dist/mod.js +1 -0
  136. package/dist/store/helpers.d.ts +9 -0
  137. package/dist/store/helpers.js +69 -0
  138. package/dist/store/middlewares.d.ts +6 -0
  139. package/dist/store/middlewares.js +40 -0
  140. package/dist/store/mod.d.ts +4 -0
  141. package/dist/store/mod.js +3 -0
  142. package/dist/store/selectors.d.ts +47 -0
  143. package/dist/store/selectors.js +21 -0
  144. package/dist/store/slice.d.ts +134 -0
  145. package/dist/store/slice.js +230 -0
  146. package/dist/store/thunks.d.ts +153 -0
  147. package/dist/store/thunks.js +223 -0
  148. package/dist/store/types.d.ts +67 -0
  149. package/dist/store/types.js +1 -0
  150. package/dist/store/utils.d.ts +1 -0
  151. package/dist/store/utils.js +11 -0
  152. package/dist/types.d.ts +3 -0
  153. package/dist/types.js +1 -0
  154. package/dist/utils/mod.d.ts +1 -0
  155. package/dist/utils/mod.js +1 -0
  156. package/dist/utils/wallets.d.ts +16 -0
  157. package/dist/utils/wallets.js +34 -0
  158. package/package.json +64 -0
  159. package/tsconfig.json +21 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ ## [0.1.1](https://github.com/rango-exchange/app-v2/compare/internal-profile@0.1.0...internal-profile@0.1.1) (2026-05-18)
2
+ # 0.1.0 (2026-05-18)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * adjust initial and detached modal styles ([c4d57b0](https://github.com/rango-exchange/app-v2/commit/c4d57b0c9be814d88eb31b7ad4da933eaa320141))
8
+ * adjust wallet connect modal styles ([c90c2c9](https://github.com/rango-exchange/app-v2/commit/c90c2c97f0238abd1b63478b1426ec0e5158ee8c))
9
+ * convert social wallet image URLs from relative to absolute paths ([f84d2d7](https://github.com/rango-exchange/app-v2/commit/f84d2d798c13151c24deae9e0cb231ceaca134dd))
10
+ * disable partial state in wallet item on force connect to namespace ([32b4aba](https://github.com/rango-exchange/app-v2/commit/32b4abaf9eb0d93cd069ba04e09a1e1bc82a34a2))
11
+ * fix bug in connecting wallet flow in profile wallets ([91ba63c](https://github.com/rango-exchange/app-v2/commit/91ba63c96bd43cf727a6e796e0f40908ad63b775))
12
+ * fix widget height in small devices ([3221cf8](https://github.com/rango-exchange/app-v2/commit/3221cf84baad83daab6e74e3c769aa585a944d6a))
13
+ * improve profile sign message callback ([77e2686](https://github.com/rango-exchange/app-v2/commit/77e268625d8f7999295b715f74326cd660754c37))
14
+ * prevent scroll-to-top on connect wallet and keep modal fixed on scroll ([de6f068](https://github.com/rango-exchange/app-v2/commit/de6f068fdf71a0c0ab8462f1f14239e1e74e8d62))
15
+ * remove tailwind classes from profile package components ([9281ab2](https://github.com/rango-exchange/app-v2/commit/9281ab237e219ee4228bbd45e17f6d996dfc9e44))
16
+ * resolve connect wallet modal style issues ([746df42](https://github.com/rango-exchange/app-v2/commit/746df4204a898bbe1829903806fc7d3cd50a51c5))
17
+ * resolve dependency cycle in http service ([7bfa0ef](https://github.com/rango-exchange/app-v2/commit/7bfa0ef35e71815922d463d6d7c8eb097736ad2a))
18
+ * show social wallet intro modal only once ([23c728d](https://github.com/rango-exchange/app-v2/commit/23c728d1d7a116227221f84bf94d10c68d1060bf))
19
+
20
+
21
+ ### Features
22
+
23
+ * add cosmos to profile as signer ([f26c504](https://github.com/rango-exchange/app-v2/commit/f26c5042c17457a120e6a81e7e2411f819b458f9))
24
+ * add error handler to profile sign message ([5d9e13f](https://github.com/rango-exchange/app-v2/commit/5d9e13fd0318853a4c556f136130c7bdae1941ed))
25
+ * add intro modal for social wallet ([4665fc6](https://github.com/rango-exchange/app-v2/commit/4665fc6d05a79db7a961ce99c2e5298403eaa347))
26
+ * add providers config to Connect Wallets modal props to hide social wallet banners ([482bd82](https://github.com/rango-exchange/app-v2/commit/482bd82e88ccbaf86a14665d8d0f3fee32dfec79))
27
+ * add zeta campaign banner and tag ([2189bb1](https://github.com/rango-exchange/app-v2/commit/2189bb130d0fd8f5259c2c8eac30d141153ac7bb))
28
+ * enable force connect to namespaces and improve connect wallet modal ([58a76b5](https://github.com/rango-exchange/app-v2/commit/58a76b5e9648b51cdaf09589314c936bb348895f))
29
+ * enable force connect to namespaces for social wallet ([2485855](https://github.com/rango-exchange/app-v2/commit/2485855b8650917e0b019d8b4439e688bff9b368))
30
+ * enable terra to sign and be merged in profile ([900a898](https://github.com/rango-exchange/app-v2/commit/900a898d99989767f37e26cb056279c9b6b1159a))
31
+ * improve social wallet user experience and design ([27e7287](https://github.com/rango-exchange/app-v2/commit/27e7287e768e2248b41ca34106e5ceafd5bb5290))
32
+ * upgrade rango dependencies ([1e098cf](https://github.com/rango-exchange/app-v2/commit/1e098cf0abfcb4ab5ce00a3000c72e60a1298a70))
@@ -0,0 +1,3 @@
1
+ export declare class UserUnauthorizedError extends Error {
2
+ constructor();
3
+ }
@@ -0,0 +1,9 @@
1
+ export class UserUnauthorizedError extends Error {
2
+ constructor() {
3
+ super('User unauthorized.');
4
+ if (Error.captureStackTrace) {
5
+ Error.captureStackTrace(this, UserUnauthorizedError);
6
+ }
7
+ this.name = 'UserProfileUnauthorizedError';
8
+ }
9
+ }
@@ -0,0 +1,4 @@
1
+ export type { LoginMessageRequest, PublicLeaderboardType, PublicLeaderboardRequest, MergeMessageRequest, LoginMessageResponse, MergeMessageResponse, ProfileDetailsResponse, ProfileDetails, Bridge, ChainDailyData, SwapperDailyData, Chain, ProfileSummaryResponse, ProfileLeaderboardResponse, ProfileSummary, ProfileLeaderboard, LoginRequest, MergeRequest, MergeResponse, LoginResponse, LogoutResponse, UpdateProfileDataResponse, ProfileAccount, ResponseWithError, } from './types';
2
+ export { BASE_PROFILE_URL, getLoginMessage, logIn, logOut, getProfileSummary, getPublicProfileSummary, getProfileLeaderboard, getPublicLeaderboard, getPublicProfileLeaderboard, getProfileDetails, updateProfileData, getMergeAccountMessage, mergeAccount, setClaimWallet, getSetClaimMessage, } from './request';
3
+ export type { UpdateProfileData } from './request';
4
+ export { UserUnauthorizedError } from './errors';
@@ -0,0 +1,2 @@
1
+ export { BASE_PROFILE_URL, getLoginMessage, logIn, logOut, getProfileSummary, getPublicProfileSummary, getProfileLeaderboard, getPublicLeaderboard, getPublicProfileLeaderboard, getProfileDetails, updateProfileData, getMergeAccountMessage, mergeAccount, setClaimWallet, getSetClaimMessage, } from './request';
2
+ export { UserUnauthorizedError } from './errors';
@@ -0,0 +1,19 @@
1
+ import type { LoginMessageRequest, LoginMessageResponse, LoginRequest, LoginResponse, LogoutResponse, MergeMessageRequest, MergeMessageResponse, MergeRequest, MergeResponse, ProfileDetailsResponse, ProfileLeaderboardResponse, ProfileSummaryResponse, PublicLeaderboardRequest, SetClaimMessageRequest, SetClaimMessageResponse, SetClaimRequest, SetClaimResponse, UpdateProfileDataResponse } from './types';
2
+ export declare const BASE_PROFILE_URL = "profile";
3
+ export declare function getLoginMessage(body: LoginMessageRequest, signal?: AbortSignal): Promise<LoginMessageResponse>;
4
+ export declare function logIn(body: LoginRequest, signal?: AbortSignal): Promise<LoginResponse>;
5
+ export declare function logOut(signal?: AbortSignal): Promise<LogoutResponse>;
6
+ export declare function getProfileSummary(signal?: AbortSignal): Promise<ProfileSummaryResponse>;
7
+ export declare function getPublicProfileSummary(username: string, signal?: AbortSignal): Promise<ProfileSummaryResponse>;
8
+ export declare function getProfileLeaderboard(signal?: AbortSignal): Promise<ProfileLeaderboardResponse>;
9
+ export declare function getPublicLeaderboard(params: PublicLeaderboardRequest, signal?: AbortSignal): Promise<ProfileLeaderboardResponse>;
10
+ export declare function getPublicProfileLeaderboard(username: string, signal?: AbortSignal): Promise<ProfileLeaderboardResponse>;
11
+ export declare function getProfileDetails(signal?: AbortSignal): Promise<ProfileDetailsResponse>;
12
+ export type UpdateProfileData = {
13
+ userName: string;
14
+ };
15
+ export declare function updateProfileData(body: UpdateProfileData, signal?: AbortSignal): Promise<UpdateProfileDataResponse>;
16
+ export declare function getMergeAccountMessage(body: MergeMessageRequest, signal?: AbortSignal): Promise<MergeMessageResponse>;
17
+ export declare function mergeAccount(body: MergeRequest, signal?: AbortSignal): Promise<MergeResponse>;
18
+ export declare function getSetClaimMessage(body: SetClaimMessageRequest, signal?: AbortSignal): Promise<SetClaimMessageResponse>;
19
+ export declare function setClaimWallet(body: SetClaimRequest, signal?: AbortSignal): Promise<SetClaimResponse>;
@@ -0,0 +1,96 @@
1
+ import { fetcher } from '../fetcher';
2
+ export const BASE_PROFILE_URL = 'profile';
3
+ const requestConfig = { withCredentials: true };
4
+ export async function getLoginMessage(body, signal) {
5
+ const { data } = await fetcher().post(`${BASE_PROFILE_URL}/login-message`, body, { ...requestConfig, signal });
6
+ return data;
7
+ }
8
+ export async function logIn(body, signal) {
9
+ const { data } = await fetcher().post(`${BASE_PROFILE_URL}/login`, body, {
10
+ ...requestConfig,
11
+ signal,
12
+ });
13
+ return data;
14
+ }
15
+ export async function logOut(signal) {
16
+ const { data } = await fetcher().get(`${BASE_PROFILE_URL}/logout`, {
17
+ ...requestConfig,
18
+ signal,
19
+ });
20
+ return data;
21
+ }
22
+ export async function getProfileSummary(signal) {
23
+ const { data } = await fetcher().get(`${BASE_PROFILE_URL}/summary`, {
24
+ ...requestConfig,
25
+ signal,
26
+ });
27
+ return data;
28
+ }
29
+ export async function getPublicProfileSummary(username, signal) {
30
+ const { data } = await fetcher().get(`${BASE_PROFILE_URL}/public/${username}/summary`, {
31
+ ...requestConfig,
32
+ signal,
33
+ });
34
+ return data;
35
+ }
36
+ export async function getProfileLeaderboard(signal) {
37
+ const { data } = await fetcher().get(`${BASE_PROFILE_URL}/user-leaderboard`, {
38
+ ...requestConfig,
39
+ signal,
40
+ });
41
+ return data;
42
+ }
43
+ export async function getPublicLeaderboard(params, signal) {
44
+ const { data } = await fetcher().get(`${BASE_PROFILE_URL}/public/leaderboard`, {
45
+ ...requestConfig,
46
+ signal,
47
+ params,
48
+ });
49
+ return data;
50
+ }
51
+ export async function getPublicProfileLeaderboard(username, signal) {
52
+ const { data } = await fetcher().get(`${BASE_PROFILE_URL}/public/${username}/user-leaderboard`, {
53
+ ...requestConfig,
54
+ signal,
55
+ });
56
+ return data;
57
+ }
58
+ export async function getProfileDetails(signal) {
59
+ const { data } = await fetcher().get(`${BASE_PROFILE_URL}/details`, {
60
+ ...requestConfig,
61
+ signal,
62
+ });
63
+ return data;
64
+ }
65
+ export async function updateProfileData(body, signal) {
66
+ const { data } = await fetcher().post(`${BASE_PROFILE_URL}/update`, body, {
67
+ ...requestConfig,
68
+ signal,
69
+ });
70
+ return data;
71
+ }
72
+ export async function getMergeAccountMessage(body, signal) {
73
+ const { data } = await fetcher().post(`${BASE_PROFILE_URL}/merge-request`, body, {
74
+ ...requestConfig,
75
+ signal,
76
+ });
77
+ return data;
78
+ }
79
+ export async function mergeAccount(body, signal) {
80
+ const { data } = await fetcher().post(`${BASE_PROFILE_URL}/merge`, body, {
81
+ ...requestConfig,
82
+ signal,
83
+ });
84
+ return data;
85
+ }
86
+ export async function getSetClaimMessage(body, signal) {
87
+ const { data } = await fetcher().post(`${BASE_PROFILE_URL}/set-airdrop-wallet-request`, body, { ...requestConfig, signal });
88
+ return data;
89
+ }
90
+ export async function setClaimWallet(body, signal) {
91
+ const { data } = await fetcher().post(`${BASE_PROFILE_URL}/set-airdrop-wallet`, body, {
92
+ ...requestConfig,
93
+ signal,
94
+ });
95
+ return data;
96
+ }
@@ -0,0 +1,193 @@
1
+ import type { Asset } from 'rango-types';
2
+ interface CosmosRequest {
3
+ pubKeyBase64?: string;
4
+ }
5
+ export interface LoginMessageRequest extends CosmosRequest {
6
+ address: string;
7
+ blockchain: string;
8
+ }
9
+ export type PublicLeaderboardType = 'SCORE' | 'REFERRAL';
10
+ export interface PublicLeaderboardRequest {
11
+ page: number;
12
+ offset: number;
13
+ type?: PublicLeaderboardType;
14
+ }
15
+ export type MergeMessageRequest = LoginMessageRequest;
16
+ export interface LoginMessageResponse {
17
+ messageId: number;
18
+ message: string;
19
+ }
20
+ export type MergeMessageResponse = LoginMessageResponse;
21
+ export interface ProfileDetailsResponse {
22
+ profile: ProfileDetails;
23
+ }
24
+ export interface SetClaimMessageRequest {
25
+ address: string;
26
+ blockchain: string;
27
+ }
28
+ export type SetClaimRequest = LoginRequest;
29
+ export type SetClaimMessageResponse = LoginMessageResponse;
30
+ export type SetClaimResponse = LoginResponse;
31
+ export interface ProfileDetails {
32
+ id: string;
33
+ wallets: string[];
34
+ chains: Chain[];
35
+ bridges: Bridge[];
36
+ dexes: Bridge[];
37
+ chainsDaily: ChainDailyData[];
38
+ bridgesDaily: SwapperDailyData[];
39
+ dexesDaily: SwapperDailyData[];
40
+ lastSwapUpdateDate: number;
41
+ updateDate: number;
42
+ }
43
+ export interface Bridge {
44
+ swapper: {
45
+ group: string;
46
+ title: string;
47
+ logo: string;
48
+ };
49
+ txCount: number;
50
+ txCountEffective: number;
51
+ volume: number;
52
+ volumeEffective: number;
53
+ favoriteToken: {
54
+ blockchain: string;
55
+ symbol: string;
56
+ address: string | null;
57
+ logo: string;
58
+ };
59
+ }
60
+ export interface ChainDailyData {
61
+ date: string;
62
+ bucket: string;
63
+ count: number;
64
+ volume: number;
65
+ }
66
+ export interface SwapperDailyData extends ChainDailyData {
67
+ countEffective: number;
68
+ volumeEffective: number;
69
+ }
70
+ export interface Chain {
71
+ blockchain: {
72
+ blockchain: string;
73
+ displayName: string;
74
+ shortName: string;
75
+ logo: string;
76
+ };
77
+ swapCount: number;
78
+ bridgeCount: number;
79
+ volume: number;
80
+ favoriteToken: {
81
+ blockchain: string;
82
+ symbol: string;
83
+ address: string | null;
84
+ logo: string;
85
+ } | null;
86
+ favoriteBridge: {
87
+ group: string;
88
+ title: string;
89
+ logo: string;
90
+ } | null;
91
+ favoriteDex: {
92
+ group: string;
93
+ title: string;
94
+ logo: string;
95
+ } | null;
96
+ }
97
+ export interface ProfileSummaryResponse {
98
+ profile: ProfileSummary | null;
99
+ error: null;
100
+ errorCode: null;
101
+ traceId: null;
102
+ }
103
+ export interface ProfileLeaderboardResponse {
104
+ data: ProfileLeaderboard[] | null;
105
+ totalPages: number;
106
+ error: null;
107
+ errorCode: null;
108
+ traceId: null;
109
+ }
110
+ interface Blockchain {
111
+ blockchain: string;
112
+ displayName: string;
113
+ logo: string;
114
+ shortName: string;
115
+ }
116
+ interface Swapper {
117
+ group: string;
118
+ logo: string;
119
+ title: string;
120
+ }
121
+ export interface ProfileSummary {
122
+ id: string;
123
+ avatar: string;
124
+ username: string;
125
+ airdropWallet: string;
126
+ wallets: {
127
+ address: string;
128
+ blockchain: string;
129
+ }[];
130
+ score: number;
131
+ rank: number;
132
+ txCount: number;
133
+ txCountEffective: number;
134
+ totalVolume: number;
135
+ totalVolumeEffective: number;
136
+ interactedBlockchains: number;
137
+ referralVolume: number;
138
+ referralIncome: number;
139
+ referralRank: number;
140
+ invitedFriends: number;
141
+ mostUsedToken: (Asset & {
142
+ logo: string;
143
+ }) | null;
144
+ mostUsedBridge: Swapper | null;
145
+ mostUsedDex: Swapper | null;
146
+ mostUsedBlockchain: Blockchain | null;
147
+ lastSwapUpdateDate: number;
148
+ primaryWallet: string;
149
+ updateDate: number;
150
+ level: {
151
+ tier: number;
152
+ level: number;
153
+ title: string;
154
+ from: number;
155
+ to: number;
156
+ };
157
+ levelProgress: number;
158
+ }
159
+ export interface ProfileLeaderboard {
160
+ avatar: string;
161
+ id: string;
162
+ rank: number;
163
+ score: number;
164
+ username: string;
165
+ level: number;
166
+ referralVolume: number;
167
+ }
168
+ export interface LoginRequest {
169
+ messageId: number;
170
+ signature: string;
171
+ }
172
+ export type MergeRequest = LoginRequest & CosmosRequest;
173
+ export type MergeResponse = LoginResponse;
174
+ export interface LoginResponse extends ProfileSummaryResponse {
175
+ status: string;
176
+ }
177
+ export interface LogoutResponse {
178
+ status: string;
179
+ }
180
+ export interface UpdateProfileDataResponse {
181
+ success: boolean;
182
+ }
183
+ export type ProfileAccount = {
184
+ address: string;
185
+ blockchain: string;
186
+ walletType: string;
187
+ };
188
+ export interface ResponseWithError {
189
+ error: string | null;
190
+ errorCode: number | null;
191
+ traceId: number | null;
192
+ }
193
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ type PropTypes = {
2
+ isDarkMode: boolean;
3
+ };
4
+ declare const ConnectWalletFooter: (props: PropTypes) => import("react/jsx-runtime").JSX.Element;
5
+ export default ConnectWalletFooter;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Typography } from '@rango-dev/ui';
3
+ import { Trans } from 'react-i18next';
4
+ import { PRIVACY_POLICY, TERMS_OF_SERVICE } from '../../constants/links';
5
+ import { ConnectWalletFooterTypographyStyles, TextLink } from './ConnectWalletModal.styles';
6
+ const ConnectWalletFooter = (props) => {
7
+ return (_jsx(Typography, { variant: "body", size: "small", color: props.isDarkMode ? '$colors$neutral900' : '$colors$neutral700', style: ConnectWalletFooterTypographyStyles, children: _jsxs(Trans, { i18nKey: "By connecting your wallet, you agree to Terms of Services and Privacy Policy", children: ["By connecting your wallet, you agree to our", _jsx(TextLink, { href: TERMS_OF_SERVICE, target: "_blank", children: "Terms of Services" }), "and", _jsx(TextLink, { href: PRIVACY_POLICY, target: "_blank", children: "Privacy Policy" })] }) }));
8
+ };
9
+ export default ConnectWalletFooter;
@@ -0,0 +1,5 @@
1
+ import type { SocialNetwork } from './ConnectWalletModal.types';
2
+ export declare const PRIVY_COMPATIBLE_SOCIAL_NETWORK: SocialNetwork[];
3
+ export declare const DEFAULT_SOCIAL_WALLET_IMAGE = "https://app.rango.exchange/imgs/wallets/social-wallet-email.svg";
4
+ export declare const SOCIAL_WALLET_IMAGE_BY_SOCIAL_NETWORKS: Record<SocialNetwork, string>;
5
+ export declare const SOCIAL_WALLET_INTRO_CONFIRMED = "social-wallet-intro-confirmed";
@@ -0,0 +1,8 @@
1
+ export const PRIVY_COMPATIBLE_SOCIAL_NETWORK = ['google', 'twitter'];
2
+ const SOCIAL_WALLET_IMAGE_BASE_URL = 'https://app.rango.exchange';
3
+ export const DEFAULT_SOCIAL_WALLET_IMAGE = `${SOCIAL_WALLET_IMAGE_BASE_URL}/imgs/wallets/social-wallet-email.svg`;
4
+ export const SOCIAL_WALLET_IMAGE_BY_SOCIAL_NETWORKS = {
5
+ google: `${SOCIAL_WALLET_IMAGE_BASE_URL}/imgs/wallets/social-wallet-google.svg`,
6
+ twitter: `${SOCIAL_WALLET_IMAGE_BASE_URL}/imgs/wallets/social-wallet-twitter.svg`,
7
+ };
8
+ export const SOCIAL_WALLET_INTRO_CONFIRMED = 'social-wallet-intro-confirmed';
@@ -0,0 +1,3 @@
1
+ import { type ConnectWalletModalProps } from './ConnectWalletModal.types';
2
+ declare const ConnectWalletModal: (props: ConnectWalletModalProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default ConnectWalletModal;
@@ -0,0 +1,2 @@
1
+ import type { SocialUser } from './ConnectWalletModal.types';
2
+ export declare function getSocialWalletImage(user: SocialUser): string;
@@ -0,0 +1,9 @@
1
+ import { DEFAULT_SOCIAL_WALLET_IMAGE, PRIVY_COMPATIBLE_SOCIAL_NETWORK, SOCIAL_WALLET_IMAGE_BY_SOCIAL_NETWORKS, } from './ConnectWalletModal.constants';
2
+ export function getSocialWalletImage(user) {
3
+ for (const network of PRIVY_COMPATIBLE_SOCIAL_NETWORK) {
4
+ if (user?.[network]) {
5
+ return SOCIAL_WALLET_IMAGE_BY_SOCIAL_NETWORKS[network];
6
+ }
7
+ }
8
+ return DEFAULT_SOCIAL_WALLET_IMAGE;
9
+ }
@@ -0,0 +1,194 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { SOCIAL_WALLET_TYPE, useSocialWallet } from '@arthur2079/internal-social-wallet';
3
+ import { Divider, SearchIcon, TextField, Typography, WalletState } from '@rango-dev/ui';
4
+ import { useWalletList, useWallets, } from '@rango-dev/widget-embedded';
5
+ import { useEffect, useState } from 'react';
6
+ import { useTranslation } from 'react-i18next';
7
+ import { DEFAULT_WALLET_INJECTION_ERROR } from '../../constants/errors';
8
+ import { GTMEvents } from '../../constants/events';
9
+ import { STATEFUL_CONNECT_MODAL_ID } from '../../constants/modals';
10
+ import { useLocalStorage } from '../../hooks/useLocalStorage';
11
+ import { useStackModal } from '../../hooks/useStackModal';
12
+ import { useStatefulConnect } from '../../hooks/useStatefulConnect';
13
+ import { walletAndSupportedChainsNames } from '../../utils/wallets';
14
+ import { SocialWalletIntroModal } from '../SocialWalletIntroModal';
15
+ import { WalletItem } from '../WalletItem';
16
+ import ConnectWalletFooter from './ConnectWalletFooter';
17
+ import { SOCIAL_WALLET_INTRO_CONFIRMED } from './ConnectWalletModal.constants';
18
+ import { getSocialWalletImage } from './ConnectWalletModal.helpers';
19
+ import { FiltersContainer, ModalContent, SearchIconContainer, SearchWalletContainer, searchWalletTextFieldStyles, SocialWalletBanner, WalletListContainer, WalletListContent, } from './ConnectWalletModal.styles';
20
+ import EmptyWalletList from './EmptyWalletList';
21
+ import StatefulConnectContainer from './StatefulConnectContainer';
22
+ import { WalletsChainSelect } from './WalletsChainSelect';
23
+ const AUTO_HIDE_WALLET_ERROR_DURATION = 10_000;
24
+ const ConnectWalletModal = (props) => {
25
+ const { pop, push, stack } = useStackModal();
26
+ const { t } = useTranslation();
27
+ const { getState, handleConnect, resetState } = useStatefulConnect();
28
+ const [socialWalletIntroConfirmed, setSocialWalletIntroConfirmed] = useLocalStorage(SOCIAL_WALLET_INTRO_CONFIRMED, false);
29
+ const [searchValue, setSearchValue] = useState('');
30
+ const [selectedChain, setSelectedChain] = useState(null);
31
+ const [isWalletChainSelectOpen, setIsWalletChainSelectOpen] = useState(false);
32
+ const [selectedWallet, setSelectedWallet] = useState(null);
33
+ const [errors, setErrors] = useState([]);
34
+ const { list } = useWalletList({});
35
+ const { getWalletInfo, state, disconnect } = useWallets();
36
+ const { getSocialUser } = useSocialWallet();
37
+ const [showSocialWalletIntroModal, setShowSocialWalletIntroModal] = useState(false);
38
+ const toggleSocialWalletIntroModal = () => setShowSocialWalletIntroModal((prevState) => !prevState);
39
+ const { indexInStack = 0, afterConnect, onDetachedConfirm, detachedConfirmText, forceConnectToNamespaces, renderNotification, renderHeader, isMobile, isDarkMode, allBlockchains, options, renderModal, shouldExcludeWallet, } = props;
40
+ const lastStackItemId = stack[stack.length - 1]?.id;
41
+ const showSocialWalletBanner = !options?.hideSocialWalletPromotionBanner &&
42
+ list.some((wallet) => wallet.type === SOCIAL_WALLET_TYPE && wallet.state === WalletState.DISCONNECTED);
43
+ const handleCloseMessages = (removeAll, message) => {
44
+ const updatedMessages = errors.map((error) => {
45
+ if (error.message === message || removeAll) {
46
+ return { ...error, open: false };
47
+ }
48
+ return error;
49
+ });
50
+ setErrors(updatedMessages);
51
+ };
52
+ const catchErrorsWhileConnect = (error, wallet) => {
53
+ let message = error instanceof Error ? error.message : error;
54
+ message ||= !!error ? error.toString() : error;
55
+ message ||= DEFAULT_WALLET_INJECTION_ERROR;
56
+ // Handling various wallet error events for Google Tag Manager
57
+ if (message && wallet) {
58
+ // TODO: Properly type window to have `data layer`
59
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
+ window.dataLayer = window.dataLayer || [];
61
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
+ window.dataLayer.push({
63
+ event: GTMEvents.WALLET_FAILED,
64
+ type: wallet.type,
65
+ message,
66
+ });
67
+ }
68
+ setErrors((prev) => [...prev, { open: true, message }]);
69
+ };
70
+ const displayedWallets = list
71
+ .filter((wallet) => {
72
+ const walletInfo = getWalletInfo(wallet.type);
73
+ const supportedChainNames = walletAndSupportedChainsNames(walletInfo.supportedChains);
74
+ // Drop wallet if it should be excluded
75
+ if (!!shouldExcludeWallet && shouldExcludeWallet(walletInfo)) {
76
+ return false;
77
+ }
78
+ // Drop wallet if its title does not contain the search value
79
+ const isWalletSearched = wallet.title.toLowerCase().includes(searchValue.toLowerCase());
80
+ if (!isWalletSearched) {
81
+ return false;
82
+ }
83
+ // Drop wallet if it does not support the selected blockchain
84
+ const walletSupportsSelectedBlockchain = !selectedChain || supportedChainNames?.includes(selectedChain);
85
+ if (!walletSupportsSelectedBlockchain) {
86
+ return false;
87
+ }
88
+ return true;
89
+ })
90
+ .map((wallet) => {
91
+ /**
92
+ * We want to display a different image for a social wallet
93
+ * based on which social network (google, twitter, …) the user connected with.
94
+ */
95
+ if (wallet.type !== SOCIAL_WALLET_TYPE) {
96
+ return wallet;
97
+ }
98
+ if (wallet.state !== WalletState.CONNECTED) {
99
+ return wallet;
100
+ }
101
+ return {
102
+ ...wallet,
103
+ image: getSocialWalletImage(getSocialUser()),
104
+ };
105
+ });
106
+ const handleSocialWalletConnect = () => {
107
+ const showSocialWalletIntroModal = !options?.skipSocialWalletIntroModal && !socialWalletIntroConfirmed;
108
+ if (showSocialWalletIntroModal) {
109
+ toggleSocialWalletIntroModal();
110
+ return;
111
+ }
112
+ connectToSocialWallet();
113
+ };
114
+ const handleWalletItemClick = (wallet) => {
115
+ if (wallet.type !== SOCIAL_WALLET_TYPE) {
116
+ setSelectedWallet(wallet);
117
+ return;
118
+ }
119
+ const isConnected = state(wallet.type).connected;
120
+ if (isConnected) {
121
+ void disconnect(wallet.type);
122
+ return;
123
+ }
124
+ handleSocialWalletConnect();
125
+ };
126
+ const connectToSocialWallet = () => {
127
+ const socialWalletInfo = displayedWallets.find((wallet) => wallet.type === SOCIAL_WALLET_TYPE);
128
+ if (socialWalletInfo) {
129
+ void handleConnect(socialWalletInfo, {
130
+ disconnectIfConnected: true,
131
+ forceConnectToNamespaces: ['EVM', 'Solana'],
132
+ });
133
+ }
134
+ };
135
+ const onConfirmSocialWalletIntroModal = () => {
136
+ setSocialWalletIntroConfirmed(true);
137
+ setShowSocialWalletIntroModal(false);
138
+ connectToSocialWallet();
139
+ };
140
+ useEffect(() => {
141
+ const state = getState();
142
+ if (state?.status !== 'init' &&
143
+ selectedWallet &&
144
+ lastStackItemId !== STATEFUL_CONNECT_MODAL_ID) {
145
+ push({
146
+ id: STATEFUL_CONNECT_MODAL_ID,
147
+ renderContent: (index) => (_jsx(StatefulConnectContainer, { selectedWallet: selectedWallet, catchErrorsWhileConnect: catchErrorsWhileConnect, indexInStack: index, onClose: () => {
148
+ setSelectedWallet(null);
149
+ }, detachedConfirmText: detachedConfirmText, onDetachedConfirm: () => {
150
+ if (onDetachedConfirm) {
151
+ onDetachedConfirm();
152
+ }
153
+ else {
154
+ resetState();
155
+ setSelectedWallet(null);
156
+ }
157
+ }, renderHeader: renderHeader, forceConnectToNamespaces: forceConnectToNamespaces })),
158
+ });
159
+ }
160
+ }, [getState()]);
161
+ useEffect(() => {
162
+ if (lastStackItemId === STATEFUL_CONNECT_MODAL_ID &&
163
+ (!selectedWallet || getState().status === 'init')) {
164
+ pop();
165
+ }
166
+ }, [getState(), selectedWallet, lastStackItemId]);
167
+ useEffect(() => {
168
+ if (selectedWallet) {
169
+ handleConnect(selectedWallet, {
170
+ disconnectIfConnected: true,
171
+ forceConnectToNamespaces,
172
+ })
173
+ .then((result) => {
174
+ if (result.status === 'connected') {
175
+ afterConnect?.();
176
+ }
177
+ })
178
+ .catch((e) => {
179
+ catchErrorsWhileConnect(e, selectedWallet);
180
+ });
181
+ }
182
+ }, [selectedWallet]);
183
+ return (_jsxs(_Fragment, { children: [_jsx(SocialWalletIntroModal, { isDarkMode: isDarkMode, isMobile: isMobile, open: showSocialWalletIntroModal, onClose: toggleSocialWalletIntroModal, onConfirm: onConfirmSocialWalletIntroModal }), _jsxs(ModalContent, { children: [renderHeader({
184
+ showBackButton: indexInStack > 0,
185
+ handleClose: () => {
186
+ pop();
187
+ },
188
+ }), showSocialWalletBanner ? (_jsxs(_Fragment, { children: [_jsx(Divider, { size: isMobile ? '20' : '4' }), _jsx(Typography, { className: "social-wallet-description", variant: "body", size: "medium", color: "neutral700", children: t('Create a wallet quickly and easily using your social media accounts for a fast and seamless experience.') }), _jsx(Divider, { size: "16" }), _jsx(SocialWalletBanner, { role: "button", tabIndex: "0", src: `/imgs/wallets/social-wallet-banner-${isDarkMode ? 'dark' : 'light'}.svg`, onClick: handleSocialWalletConnect }), _jsx(Divider, { size: "16" }), _jsxs("div", { className: "social-wallet-banner-separator", children: [_jsx(Typography, { variant: "body", size: "medium", color: "neutral700", children: t('All Wallets') }), _jsx(Divider, { size: "8", direction: "horizontal" }), _jsx("div", { className: "separator" })] })] })) : (_jsx(Divider, { size: isMobile ? '40' : '24' })), _jsxs(FiltersContainer, { children: [_jsx(SearchWalletContainer, { children: _jsx(TextField, { id: "app-connect-wallet-modal-search-wallet-input", variant: "ghost", value: searchValue, onChange: (e) => setSearchValue(e.target.value), placeholder: t('Search Wallet'), prefix: _jsx(SearchIconContainer, { children: _jsx(SearchIcon, { color: "black", size: 16 }) }), style: searchWalletTextFieldStyles }) }), !forceConnectToNamespaces?.length && (_jsx(WalletsChainSelect, { isOpen: isWalletChainSelectOpen, setIsOpen: setIsWalletChainSelectOpen, selectedChain: selectedChain, handleSelectedChainChange: (value) => setSelectedChain(value), shouldExcludeWallet: shouldExcludeWallet, isMobile: isMobile, renderModal: renderModal, renderHeader: renderHeader, allBlockchains: allBlockchains }))] }), errors.map((error) => renderNotification({
189
+ message: error,
190
+ setOpen: () => handleCloseMessages(false, error.message),
191
+ autoHideDuration: AUTO_HIDE_WALLET_ERROR_DURATION,
192
+ })), _jsx(Divider, { size: "8" }), _jsx(WalletListContainer, { children: displayedWallets.length > 0 ? (_jsx(WalletListContent, { isEmpty: displayedWallets.length === 0, children: displayedWallets.map((wallet) => (_jsx(WalletItem, { wallet: wallet, handleClick: handleWalletItemClick, disabled: false, disablePartialState: !!forceConnectToNamespaces?.length }, wallet.type))) })) : (_jsx(EmptyWalletList, {})) }), _jsx(Divider, { size: isMobile ? '16' : '24' }), _jsx(ConnectWalletFooter, { isDarkMode: isDarkMode })] })] }));
193
+ };
194
+ export default ConnectWalletModal;
@@ -0,0 +1,19 @@
1
+ export declare const TextLink: any;
2
+ export declare const ModalContent: any;
3
+ export declare const SocialWalletBanner: any;
4
+ export declare const WalletListContainer: any;
5
+ export declare const WalletListContent: any;
6
+ export declare const SearchWalletContainer: any;
7
+ export declare const searchWalletTextFieldStyles: {
8
+ height: string;
9
+ '& input': {
10
+ width: string;
11
+ };
12
+ };
13
+ export declare const NoWalletFoundContainer: any;
14
+ export declare const NoResultImage: any;
15
+ export declare const ConnectWalletFooterTypographyStyles: {
16
+ padding: string;
17
+ };
18
+ export declare const FiltersContainer: any;
19
+ export declare const SearchIconContainer: any;