@dubsdotapp/expo 0.5.21 → 0.5.23
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/index.d.mts +59 -6
- package/dist/index.d.ts +59 -6
- package/dist/index.js +68 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/chat/hooks.ts +44 -0
- package/src/chat/index.ts +3 -0
- package/src/chat/provider.tsx +33 -6
- package/src/chat/socket.ts +3 -0
- package/src/chat/types.ts +10 -0
- package/src/client.ts +10 -0
- package/src/hooks/usePushNotifications.ts +22 -3
- package/src/index.ts +3 -0
package/dist/index.d.mts
CHANGED
|
@@ -750,6 +750,12 @@ declare class DubsClient {
|
|
|
750
750
|
getPendingFriendRequests(): Promise<{
|
|
751
751
|
requests: any[];
|
|
752
752
|
}>;
|
|
753
|
+
/** Get pending friend requests this user has sent (still awaiting response) */
|
|
754
|
+
getSentFriendRequests(): Promise<{
|
|
755
|
+
requests: any[];
|
|
756
|
+
}>;
|
|
757
|
+
/** Cancel a pending friend request the user previously sent */
|
|
758
|
+
cancelFriendRequest(requestId: number): Promise<void>;
|
|
753
759
|
/** Accept a friend request */
|
|
754
760
|
acceptFriendRequest(requestId: number): Promise<void>;
|
|
755
761
|
/** Reject a friend request */
|
|
@@ -1212,11 +1218,29 @@ interface ShortVideo {
|
|
|
1212
1218
|
declare function useShorts(league?: string, limit?: number): QueryResult<ShortVideo[]>;
|
|
1213
1219
|
|
|
1214
1220
|
interface PushNotificationStatus {
|
|
1215
|
-
/**
|
|
1221
|
+
/**
|
|
1222
|
+
* Whether push is currently delivering to this user — the right signal for
|
|
1223
|
+
* UI bindings like a "Notifications: Enabled/Disabled" toggle.
|
|
1224
|
+
*
|
|
1225
|
+
* Equivalent to `enabled && !!pushToken`. Goes false after `unregister()`
|
|
1226
|
+
* even though OS permission is still granted. Goes true after `register()`
|
|
1227
|
+
* succeeds.
|
|
1228
|
+
*
|
|
1229
|
+
* Use this — NOT `hasPermission` — when binding switches/toggles.
|
|
1230
|
+
*/
|
|
1231
|
+
isActive: boolean;
|
|
1232
|
+
/** Whether push notifications are enabled in the SDK configuration (the `pushEnabled` prop on DubsProvider). */
|
|
1216
1233
|
enabled: boolean;
|
|
1217
|
-
/**
|
|
1234
|
+
/**
|
|
1235
|
+
* Whether OS-level notification permission has been granted on this device.
|
|
1236
|
+
*
|
|
1237
|
+
* Note: this stays true after `unregister()` because the OS doesn't revoke
|
|
1238
|
+
* permission when a server token is dropped. Useful for permission-flow
|
|
1239
|
+
* prompts (e.g. "Re-enable in Settings" hint), but NOT for "is push on" UI —
|
|
1240
|
+
* use `isActive` for that.
|
|
1241
|
+
*/
|
|
1218
1242
|
hasPermission: boolean;
|
|
1219
|
-
/** The push token (
|
|
1243
|
+
/** The native device push token (FCM/APNs), if currently registered with the server. */
|
|
1220
1244
|
pushToken: string | null;
|
|
1221
1245
|
/**
|
|
1222
1246
|
* @deprecated Use pushToken instead. Kept for backwards compatibility.
|
|
@@ -1825,6 +1849,15 @@ interface FriendRequest {
|
|
|
1825
1849
|
fromWallet: string;
|
|
1826
1850
|
createdAt: string;
|
|
1827
1851
|
}
|
|
1852
|
+
/** A friend request the current user has SENT (still pending). */
|
|
1853
|
+
interface SentFriendRequest {
|
|
1854
|
+
id: number;
|
|
1855
|
+
toUserId: number;
|
|
1856
|
+
toUsername: string;
|
|
1857
|
+
toAvatar: string | null;
|
|
1858
|
+
toWallet: string;
|
|
1859
|
+
createdAt: string;
|
|
1860
|
+
}
|
|
1828
1861
|
interface OnlineUser {
|
|
1829
1862
|
walletAddress: string;
|
|
1830
1863
|
username: string;
|
|
@@ -1917,6 +1950,11 @@ interface ChatSocketListeners {
|
|
|
1917
1950
|
requestId: number;
|
|
1918
1951
|
declinedBy: number;
|
|
1919
1952
|
}) => void;
|
|
1953
|
+
/** Recipient-side: the original sender cancelled a pending friend request */
|
|
1954
|
+
onFriendRequestCancelled?: (data: {
|
|
1955
|
+
requestId: number;
|
|
1956
|
+
cancelledBy: number;
|
|
1957
|
+
}) => void;
|
|
1920
1958
|
onFriendRemoved?: (data: {
|
|
1921
1959
|
removedBy: number;
|
|
1922
1960
|
}) => void;
|
|
@@ -1973,16 +2011,20 @@ interface ChatContextValue {
|
|
|
1973
2011
|
conversations: Conversation[];
|
|
1974
2012
|
/** Friends list */
|
|
1975
2013
|
friends: FriendUser[];
|
|
1976
|
-
/** Pending friend requests */
|
|
2014
|
+
/** Pending friend requests (received) */
|
|
1977
2015
|
pendingRequests: FriendRequest[];
|
|
2016
|
+
/** Pending friend requests this user has sent (still awaiting response) */
|
|
2017
|
+
sentFriendRequests: SentFriendRequest[];
|
|
1978
2018
|
/** Reload messages from REST */
|
|
1979
2019
|
refreshMessages: () => Promise<void>;
|
|
1980
2020
|
/** Reload conversations from REST */
|
|
1981
2021
|
refreshConversations: () => Promise<void>;
|
|
1982
2022
|
/** Reload friends from REST */
|
|
1983
2023
|
refreshFriends: () => Promise<void>;
|
|
1984
|
-
/** Reload pending friend requests from REST */
|
|
2024
|
+
/** Reload pending friend requests (received) from REST */
|
|
1985
2025
|
refreshPendingRequests: () => Promise<void>;
|
|
2026
|
+
/** Reload pending friend requests (sent) from REST */
|
|
2027
|
+
refreshSentFriendRequests: () => Promise<void>;
|
|
1986
2028
|
}
|
|
1987
2029
|
interface ChatProviderProps {
|
|
1988
2030
|
children: React$1.ReactNode;
|
|
@@ -2053,6 +2095,17 @@ declare function useFriendRequests(): {
|
|
|
2053
2095
|
loading: boolean;
|
|
2054
2096
|
refetch: () => Promise<void>;
|
|
2055
2097
|
};
|
|
2098
|
+
/** Get pending friend requests this user has SENT (still awaiting response). */
|
|
2099
|
+
declare function useSentFriendRequests(): {
|
|
2100
|
+
requests: SentFriendRequest[];
|
|
2101
|
+
loading: boolean;
|
|
2102
|
+
refetch: () => Promise<void>;
|
|
2103
|
+
};
|
|
2104
|
+
/** Cancel a pending friend request the current user previously sent. */
|
|
2105
|
+
declare function useCancelFriendRequest(): {
|
|
2106
|
+
cancel: (requestId: number) => Promise<void>;
|
|
2107
|
+
loading: boolean;
|
|
2108
|
+
};
|
|
2056
2109
|
/** Search for users by username */
|
|
2057
2110
|
declare function useSearchUsers(): {
|
|
2058
2111
|
results: FriendUser[];
|
|
@@ -2087,4 +2140,4 @@ declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAd
|
|
|
2087
2140
|
*/
|
|
2088
2141
|
declare function ensurePngAvatar(url: string | null | undefined): string | undefined;
|
|
2089
2142
|
|
|
2090
|
-
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolResult, type ArcadePoolStats, AuthGate, type ConnectWalletScreenProps$1 as AuthGateConnectWalletProps, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type BuildJackpotEnterResult, type ChatConnectionStatus, type ChatContextValue, type ChatMention, type ChatMessage, type ChatNotification, type ChatPayment, ChatProvider, type ChatProviderProps, ChatSocket, type ChatSocketConfig, type ChatSocketListeners, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, type ConfirmJackpotEnterResult, ConnectWalletButton, type ConnectWalletButtonProps, ConnectWalletScreen, type ConnectWalletScreenProps, type Conversation, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, CreateGameSheet, type CreateGameSheetProps, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, type DirectMessage, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, type EnterJackpotMutationResult, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type FriendRequest, type FriendUser, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, type HighlightVideo, JackpotCard, type JackpotCardProps, type JackpotConfig, type JackpotEntry, type JackpotLastWinner, type JackpotRound, type JackpotRoundResult, JackpotSheet, type JackpotSheetProps, JackpotWidget, type JackpotWidgetProps, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, JoinGameSheet, type JoinGameSheetProps, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type OnlineUser, type Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type PushNotificationStatus, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, type SendDMParams, type SendMessageParams, SettingsSheet, type SettingsSheetProps, type ShortVideo, SolSlider, type SolSliderProps, type SolanaErrorCode, type StartAttemptResult, type SubmitScoreResult, type TokenStorage, type TypingEvent, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseArcadeBridgeOptions, type UseArcadeBridgeResult, type UseArcadeGameResult, type UseArcadePoolResult, type UseArcadePoolsResult, type UseAuthResult, type UseJackpotHistoryResult, type UseJackpotResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useChatContext, useChatMessages, useChatStatus, useClaim, useConversations, useCreateCustomGame, useCreateGame, useDirectMessages, useDubs, useDubsTheme, useEnterArcadePool, useEnterJackpot, useEvents, useFriendRequests, useFriends, useGame, useGames, useHasClaimed, useHighlights, useJackpot, useJackpotHistory, useJoinGame, useNetworkGames, useOnlineUsers, usePushNotifications, useRespondToFriendRequest, useSearchUsers, useSendFriendRequest, useSendMessage, useShorts, useUFCFightCard, useUFCFighterDetail, useUnreadCount };
|
|
2143
|
+
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolResult, type ArcadePoolStats, AuthGate, type ConnectWalletScreenProps$1 as AuthGateConnectWalletProps, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type BuildJackpotEnterResult, type ChatConnectionStatus, type ChatContextValue, type ChatMention, type ChatMessage, type ChatNotification, type ChatPayment, ChatProvider, type ChatProviderProps, ChatSocket, type ChatSocketConfig, type ChatSocketListeners, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, type ConfirmJackpotEnterResult, ConnectWalletButton, type ConnectWalletButtonProps, ConnectWalletScreen, type ConnectWalletScreenProps, type Conversation, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, CreateGameSheet, type CreateGameSheetProps, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, type DirectMessage, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, type EnterJackpotMutationResult, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type FriendRequest, type FriendUser, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, type HighlightVideo, JackpotCard, type JackpotCardProps, type JackpotConfig, type JackpotEntry, type JackpotLastWinner, type JackpotRound, type JackpotRoundResult, JackpotSheet, type JackpotSheetProps, JackpotWidget, type JackpotWidgetProps, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, JoinGameSheet, type JoinGameSheetProps, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type OnlineUser, type Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type PushNotificationStatus, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, type SendDMParams, type SendMessageParams, type SentFriendRequest, SettingsSheet, type SettingsSheetProps, type ShortVideo, SolSlider, type SolSliderProps, type SolanaErrorCode, type StartAttemptResult, type SubmitScoreResult, type TokenStorage, type TypingEvent, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseArcadeBridgeOptions, type UseArcadeBridgeResult, type UseArcadeGameResult, type UseArcadePoolResult, type UseArcadePoolsResult, type UseAuthResult, type UseJackpotHistoryResult, type UseJackpotResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useCancelFriendRequest, useChatContext, useChatMessages, useChatStatus, useClaim, useConversations, useCreateCustomGame, useCreateGame, useDirectMessages, useDubs, useDubsTheme, useEnterArcadePool, useEnterJackpot, useEvents, useFriendRequests, useFriends, useGame, useGames, useHasClaimed, useHighlights, useJackpot, useJackpotHistory, useJoinGame, useNetworkGames, useOnlineUsers, usePushNotifications, useRespondToFriendRequest, useSearchUsers, useSendFriendRequest, useSendMessage, useSentFriendRequests, useShorts, useUFCFightCard, useUFCFighterDetail, useUnreadCount };
|
package/dist/index.d.ts
CHANGED
|
@@ -750,6 +750,12 @@ declare class DubsClient {
|
|
|
750
750
|
getPendingFriendRequests(): Promise<{
|
|
751
751
|
requests: any[];
|
|
752
752
|
}>;
|
|
753
|
+
/** Get pending friend requests this user has sent (still awaiting response) */
|
|
754
|
+
getSentFriendRequests(): Promise<{
|
|
755
|
+
requests: any[];
|
|
756
|
+
}>;
|
|
757
|
+
/** Cancel a pending friend request the user previously sent */
|
|
758
|
+
cancelFriendRequest(requestId: number): Promise<void>;
|
|
753
759
|
/** Accept a friend request */
|
|
754
760
|
acceptFriendRequest(requestId: number): Promise<void>;
|
|
755
761
|
/** Reject a friend request */
|
|
@@ -1212,11 +1218,29 @@ interface ShortVideo {
|
|
|
1212
1218
|
declare function useShorts(league?: string, limit?: number): QueryResult<ShortVideo[]>;
|
|
1213
1219
|
|
|
1214
1220
|
interface PushNotificationStatus {
|
|
1215
|
-
/**
|
|
1221
|
+
/**
|
|
1222
|
+
* Whether push is currently delivering to this user — the right signal for
|
|
1223
|
+
* UI bindings like a "Notifications: Enabled/Disabled" toggle.
|
|
1224
|
+
*
|
|
1225
|
+
* Equivalent to `enabled && !!pushToken`. Goes false after `unregister()`
|
|
1226
|
+
* even though OS permission is still granted. Goes true after `register()`
|
|
1227
|
+
* succeeds.
|
|
1228
|
+
*
|
|
1229
|
+
* Use this — NOT `hasPermission` — when binding switches/toggles.
|
|
1230
|
+
*/
|
|
1231
|
+
isActive: boolean;
|
|
1232
|
+
/** Whether push notifications are enabled in the SDK configuration (the `pushEnabled` prop on DubsProvider). */
|
|
1216
1233
|
enabled: boolean;
|
|
1217
|
-
/**
|
|
1234
|
+
/**
|
|
1235
|
+
* Whether OS-level notification permission has been granted on this device.
|
|
1236
|
+
*
|
|
1237
|
+
* Note: this stays true after `unregister()` because the OS doesn't revoke
|
|
1238
|
+
* permission when a server token is dropped. Useful for permission-flow
|
|
1239
|
+
* prompts (e.g. "Re-enable in Settings" hint), but NOT for "is push on" UI —
|
|
1240
|
+
* use `isActive` for that.
|
|
1241
|
+
*/
|
|
1218
1242
|
hasPermission: boolean;
|
|
1219
|
-
/** The push token (
|
|
1243
|
+
/** The native device push token (FCM/APNs), if currently registered with the server. */
|
|
1220
1244
|
pushToken: string | null;
|
|
1221
1245
|
/**
|
|
1222
1246
|
* @deprecated Use pushToken instead. Kept for backwards compatibility.
|
|
@@ -1825,6 +1849,15 @@ interface FriendRequest {
|
|
|
1825
1849
|
fromWallet: string;
|
|
1826
1850
|
createdAt: string;
|
|
1827
1851
|
}
|
|
1852
|
+
/** A friend request the current user has SENT (still pending). */
|
|
1853
|
+
interface SentFriendRequest {
|
|
1854
|
+
id: number;
|
|
1855
|
+
toUserId: number;
|
|
1856
|
+
toUsername: string;
|
|
1857
|
+
toAvatar: string | null;
|
|
1858
|
+
toWallet: string;
|
|
1859
|
+
createdAt: string;
|
|
1860
|
+
}
|
|
1828
1861
|
interface OnlineUser {
|
|
1829
1862
|
walletAddress: string;
|
|
1830
1863
|
username: string;
|
|
@@ -1917,6 +1950,11 @@ interface ChatSocketListeners {
|
|
|
1917
1950
|
requestId: number;
|
|
1918
1951
|
declinedBy: number;
|
|
1919
1952
|
}) => void;
|
|
1953
|
+
/** Recipient-side: the original sender cancelled a pending friend request */
|
|
1954
|
+
onFriendRequestCancelled?: (data: {
|
|
1955
|
+
requestId: number;
|
|
1956
|
+
cancelledBy: number;
|
|
1957
|
+
}) => void;
|
|
1920
1958
|
onFriendRemoved?: (data: {
|
|
1921
1959
|
removedBy: number;
|
|
1922
1960
|
}) => void;
|
|
@@ -1973,16 +2011,20 @@ interface ChatContextValue {
|
|
|
1973
2011
|
conversations: Conversation[];
|
|
1974
2012
|
/** Friends list */
|
|
1975
2013
|
friends: FriendUser[];
|
|
1976
|
-
/** Pending friend requests */
|
|
2014
|
+
/** Pending friend requests (received) */
|
|
1977
2015
|
pendingRequests: FriendRequest[];
|
|
2016
|
+
/** Pending friend requests this user has sent (still awaiting response) */
|
|
2017
|
+
sentFriendRequests: SentFriendRequest[];
|
|
1978
2018
|
/** Reload messages from REST */
|
|
1979
2019
|
refreshMessages: () => Promise<void>;
|
|
1980
2020
|
/** Reload conversations from REST */
|
|
1981
2021
|
refreshConversations: () => Promise<void>;
|
|
1982
2022
|
/** Reload friends from REST */
|
|
1983
2023
|
refreshFriends: () => Promise<void>;
|
|
1984
|
-
/** Reload pending friend requests from REST */
|
|
2024
|
+
/** Reload pending friend requests (received) from REST */
|
|
1985
2025
|
refreshPendingRequests: () => Promise<void>;
|
|
2026
|
+
/** Reload pending friend requests (sent) from REST */
|
|
2027
|
+
refreshSentFriendRequests: () => Promise<void>;
|
|
1986
2028
|
}
|
|
1987
2029
|
interface ChatProviderProps {
|
|
1988
2030
|
children: React$1.ReactNode;
|
|
@@ -2053,6 +2095,17 @@ declare function useFriendRequests(): {
|
|
|
2053
2095
|
loading: boolean;
|
|
2054
2096
|
refetch: () => Promise<void>;
|
|
2055
2097
|
};
|
|
2098
|
+
/** Get pending friend requests this user has SENT (still awaiting response). */
|
|
2099
|
+
declare function useSentFriendRequests(): {
|
|
2100
|
+
requests: SentFriendRequest[];
|
|
2101
|
+
loading: boolean;
|
|
2102
|
+
refetch: () => Promise<void>;
|
|
2103
|
+
};
|
|
2104
|
+
/** Cancel a pending friend request the current user previously sent. */
|
|
2105
|
+
declare function useCancelFriendRequest(): {
|
|
2106
|
+
cancel: (requestId: number) => Promise<void>;
|
|
2107
|
+
loading: boolean;
|
|
2108
|
+
};
|
|
2056
2109
|
/** Search for users by username */
|
|
2057
2110
|
declare function useSearchUsers(): {
|
|
2058
2111
|
results: FriendUser[];
|
|
@@ -2087,4 +2140,4 @@ declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAd
|
|
|
2087
2140
|
*/
|
|
2088
2141
|
declare function ensurePngAvatar(url: string | null | undefined): string | undefined;
|
|
2089
2142
|
|
|
2090
|
-
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolResult, type ArcadePoolStats, AuthGate, type ConnectWalletScreenProps$1 as AuthGateConnectWalletProps, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type BuildJackpotEnterResult, type ChatConnectionStatus, type ChatContextValue, type ChatMention, type ChatMessage, type ChatNotification, type ChatPayment, ChatProvider, type ChatProviderProps, ChatSocket, type ChatSocketConfig, type ChatSocketListeners, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, type ConfirmJackpotEnterResult, ConnectWalletButton, type ConnectWalletButtonProps, ConnectWalletScreen, type ConnectWalletScreenProps, type Conversation, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, CreateGameSheet, type CreateGameSheetProps, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, type DirectMessage, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, type EnterJackpotMutationResult, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type FriendRequest, type FriendUser, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, type HighlightVideo, JackpotCard, type JackpotCardProps, type JackpotConfig, type JackpotEntry, type JackpotLastWinner, type JackpotRound, type JackpotRoundResult, JackpotSheet, type JackpotSheetProps, JackpotWidget, type JackpotWidgetProps, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, JoinGameSheet, type JoinGameSheetProps, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type OnlineUser, type Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type PushNotificationStatus, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, type SendDMParams, type SendMessageParams, SettingsSheet, type SettingsSheetProps, type ShortVideo, SolSlider, type SolSliderProps, type SolanaErrorCode, type StartAttemptResult, type SubmitScoreResult, type TokenStorage, type TypingEvent, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseArcadeBridgeOptions, type UseArcadeBridgeResult, type UseArcadeGameResult, type UseArcadePoolResult, type UseArcadePoolsResult, type UseAuthResult, type UseJackpotHistoryResult, type UseJackpotResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useChatContext, useChatMessages, useChatStatus, useClaim, useConversations, useCreateCustomGame, useCreateGame, useDirectMessages, useDubs, useDubsTheme, useEnterArcadePool, useEnterJackpot, useEvents, useFriendRequests, useFriends, useGame, useGames, useHasClaimed, useHighlights, useJackpot, useJackpotHistory, useJoinGame, useNetworkGames, useOnlineUsers, usePushNotifications, useRespondToFriendRequest, useSearchUsers, useSendFriendRequest, useSendMessage, useShorts, useUFCFightCard, useUFCFighterDetail, useUnreadCount };
|
|
2143
|
+
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolResult, type ArcadePoolStats, AuthGate, type ConnectWalletScreenProps$1 as AuthGateConnectWalletProps, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type BuildJackpotEnterResult, type ChatConnectionStatus, type ChatContextValue, type ChatMention, type ChatMessage, type ChatNotification, type ChatPayment, ChatProvider, type ChatProviderProps, ChatSocket, type ChatSocketConfig, type ChatSocketListeners, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, type ConfirmJackpotEnterResult, ConnectWalletButton, type ConnectWalletButtonProps, ConnectWalletScreen, type ConnectWalletScreenProps, type Conversation, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, CreateGameSheet, type CreateGameSheetProps, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, type DirectMessage, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, type EnterJackpotMutationResult, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type FriendRequest, type FriendUser, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, type HighlightVideo, JackpotCard, type JackpotCardProps, type JackpotConfig, type JackpotEntry, type JackpotLastWinner, type JackpotRound, type JackpotRoundResult, JackpotSheet, type JackpotSheetProps, JackpotWidget, type JackpotWidgetProps, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, JoinGameSheet, type JoinGameSheetProps, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type OnlineUser, type Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type PushNotificationStatus, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, type SendDMParams, type SendMessageParams, type SentFriendRequest, SettingsSheet, type SettingsSheetProps, type ShortVideo, SolSlider, type SolSliderProps, type SolanaErrorCode, type StartAttemptResult, type SubmitScoreResult, type TokenStorage, type TypingEvent, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseArcadeBridgeOptions, type UseArcadeBridgeResult, type UseArcadeGameResult, type UseArcadePoolResult, type UseArcadePoolsResult, type UseAuthResult, type UseJackpotHistoryResult, type UseJackpotResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useCancelFriendRequest, useChatContext, useChatMessages, useChatStatus, useClaim, useConversations, useCreateCustomGame, useCreateGame, useDirectMessages, useDubs, useDubsTheme, useEnterArcadePool, useEnterJackpot, useEvents, useFriendRequests, useFriends, useGame, useGames, useHasClaimed, useHighlights, useJackpot, useJackpotHistory, useJoinGame, useNetworkGames, useOnlineUsers, usePushNotifications, useRespondToFriendRequest, useSearchUsers, useSendFriendRequest, useSendMessage, useSentFriendRequests, useShorts, useUFCFightCard, useUFCFighterDetail, useUnreadCount };
|
package/dist/index.js
CHANGED
|
@@ -78,6 +78,7 @@ __export(index_exports, {
|
|
|
78
78
|
useArcadePool: () => useArcadePool,
|
|
79
79
|
useArcadePools: () => useArcadePools,
|
|
80
80
|
useAuth: () => useAuth,
|
|
81
|
+
useCancelFriendRequest: () => useCancelFriendRequest,
|
|
81
82
|
useChatContext: () => useChatContext,
|
|
82
83
|
useChatMessages: () => useChatMessages,
|
|
83
84
|
useChatStatus: () => useChatStatus,
|
|
@@ -107,6 +108,7 @@ __export(index_exports, {
|
|
|
107
108
|
useSearchUsers: () => useSearchUsers,
|
|
108
109
|
useSendFriendRequest: () => useSendFriendRequest,
|
|
109
110
|
useSendMessage: () => useSendMessage,
|
|
111
|
+
useSentFriendRequests: () => useSentFriendRequests,
|
|
110
112
|
useShorts: () => useShorts,
|
|
111
113
|
useUFCFightCard: () => useUFCFightCard,
|
|
112
114
|
useUFCFighterDetail: () => useUFCFighterDetail,
|
|
@@ -828,6 +830,14 @@ var DubsClient = class {
|
|
|
828
830
|
async getPendingFriendRequests() {
|
|
829
831
|
return this.request("GET", "/social/friend-requests");
|
|
830
832
|
}
|
|
833
|
+
/** Get pending friend requests this user has sent (still awaiting response) */
|
|
834
|
+
async getSentFriendRequests() {
|
|
835
|
+
return this.request("GET", "/social/friend-requests/sent");
|
|
836
|
+
}
|
|
837
|
+
/** Cancel a pending friend request the user previously sent */
|
|
838
|
+
async cancelFriendRequest(requestId) {
|
|
839
|
+
await this.request("DELETE", `/social/friend-request/${requestId}`);
|
|
840
|
+
}
|
|
831
841
|
/** Accept a friend request */
|
|
832
842
|
async acceptFriendRequest(requestId) {
|
|
833
843
|
await this.request("POST", `/social/request/${requestId}/accept`);
|
|
@@ -2830,6 +2840,7 @@ function usePushNotifications() {
|
|
|
2830
2840
|
restoreIfGranted();
|
|
2831
2841
|
}, []);
|
|
2832
2842
|
return {
|
|
2843
|
+
isActive: pushEnabled && !!pushToken,
|
|
2833
2844
|
enabled: pushEnabled,
|
|
2834
2845
|
hasPermission,
|
|
2835
2846
|
pushToken,
|
|
@@ -8702,6 +8713,7 @@ var ChatSocket = class {
|
|
|
8702
8713
|
this.socket.on("dm:messages_read", (data) => this.listeners.onDMMessagesRead?.(data));
|
|
8703
8714
|
this.socket.on("friend_request_accepted", (data) => this.listeners.onFriendRequestAccepted?.(data));
|
|
8704
8715
|
this.socket.on("friend_request_declined", (data) => this.listeners.onFriendRequestDeclined?.(data));
|
|
8716
|
+
this.socket.on("friend_request_cancelled", (data) => this.listeners.onFriendRequestCancelled?.(data));
|
|
8705
8717
|
this.socket.on("friend_removed", (data) => this.listeners.onFriendRemoved?.(data));
|
|
8706
8718
|
this.socket.on("error", (err) => this.listeners.onError?.(err));
|
|
8707
8719
|
}
|
|
@@ -8768,6 +8780,7 @@ function ChatProvider({ children, autoConnect = true }) {
|
|
|
8768
8780
|
const [conversations, setConversations] = (0, import_react49.useState)([]);
|
|
8769
8781
|
const [friends, setFriends] = (0, import_react49.useState)([]);
|
|
8770
8782
|
const [pendingRequests, setPendingRequests] = (0, import_react49.useState)([]);
|
|
8783
|
+
const [sentFriendRequests, setSentFriendRequests] = (0, import_react49.useState)([]);
|
|
8771
8784
|
const refreshMessages = (0, import_react49.useCallback)(async () => {
|
|
8772
8785
|
try {
|
|
8773
8786
|
const res = await client.getChatMessages({ limit: 30 });
|
|
@@ -8797,6 +8810,13 @@ function ChatProvider({ children, autoConnect = true }) {
|
|
|
8797
8810
|
} catch (_) {
|
|
8798
8811
|
}
|
|
8799
8812
|
}, [client]);
|
|
8813
|
+
const refreshSentFriendRequests = (0, import_react49.useCallback)(async () => {
|
|
8814
|
+
try {
|
|
8815
|
+
const res = await client.getSentFriendRequests();
|
|
8816
|
+
setSentFriendRequests(res.requests);
|
|
8817
|
+
} catch (_) {
|
|
8818
|
+
}
|
|
8819
|
+
}, [client]);
|
|
8800
8820
|
(0, import_react49.useEffect)(() => {
|
|
8801
8821
|
const token = client.getToken();
|
|
8802
8822
|
if (!autoConnect || !token) return;
|
|
@@ -8822,9 +8842,18 @@ function ChatProvider({ children, autoConnect = true }) {
|
|
|
8822
8842
|
onNotification: (n) => {
|
|
8823
8843
|
setUnreadCount((prev) => prev + 1);
|
|
8824
8844
|
if (n.type === "friend_request") refreshPendingRequests();
|
|
8825
|
-
if (n.type === "friend_request_accepted")
|
|
8845
|
+
if (n.type === "friend_request_accepted") {
|
|
8846
|
+
refreshFriends();
|
|
8847
|
+
refreshSentFriendRequests();
|
|
8848
|
+
}
|
|
8849
|
+
if (n.type === "friend_request_declined") refreshSentFriendRequests();
|
|
8826
8850
|
},
|
|
8827
|
-
onFriendRequestAccepted: () =>
|
|
8851
|
+
onFriendRequestAccepted: () => {
|
|
8852
|
+
refreshFriends();
|
|
8853
|
+
refreshSentFriendRequests();
|
|
8854
|
+
},
|
|
8855
|
+
onFriendRequestDeclined: () => refreshSentFriendRequests(),
|
|
8856
|
+
onFriendRequestCancelled: () => refreshPendingRequests(),
|
|
8828
8857
|
onFriendRemoved: () => refreshFriends()
|
|
8829
8858
|
});
|
|
8830
8859
|
chatSocket.connect({ host, token });
|
|
@@ -8833,10 +8862,12 @@ function ChatProvider({ children, autoConnect = true }) {
|
|
|
8833
8862
|
});
|
|
8834
8863
|
refreshPendingRequests().catch(() => {
|
|
8835
8864
|
});
|
|
8865
|
+
refreshSentFriendRequests().catch(() => {
|
|
8866
|
+
});
|
|
8836
8867
|
return () => {
|
|
8837
8868
|
chatSocket.disconnect();
|
|
8838
8869
|
};
|
|
8839
|
-
}, [client, autoConnect, refreshMessages, refreshConversations, refreshFriends, refreshPendingRequests]);
|
|
8870
|
+
}, [client, autoConnect, refreshMessages, refreshConversations, refreshFriends, refreshPendingRequests, refreshSentFriendRequests]);
|
|
8840
8871
|
(0, import_react49.useEffect)(() => {
|
|
8841
8872
|
const handleAppState = (nextState) => {
|
|
8842
8873
|
if (nextState === "active") {
|
|
@@ -8866,12 +8897,14 @@ function ChatProvider({ children, autoConnect = true }) {
|
|
|
8866
8897
|
conversations,
|
|
8867
8898
|
friends,
|
|
8868
8899
|
pendingRequests,
|
|
8900
|
+
sentFriendRequests,
|
|
8869
8901
|
refreshMessages,
|
|
8870
8902
|
refreshConversations,
|
|
8871
8903
|
refreshFriends,
|
|
8872
|
-
refreshPendingRequests
|
|
8904
|
+
refreshPendingRequests,
|
|
8905
|
+
refreshSentFriendRequests
|
|
8873
8906
|
}),
|
|
8874
|
-
[status, messages, onlineUsers, onlineCount, unreadCount, conversations, friends, pendingRequests, refreshMessages, refreshConversations, refreshFriends, refreshPendingRequests]
|
|
8907
|
+
[status, messages, onlineUsers, onlineCount, unreadCount, conversations, friends, pendingRequests, sentFriendRequests, refreshMessages, refreshConversations, refreshFriends, refreshPendingRequests, refreshSentFriendRequests]
|
|
8875
8908
|
);
|
|
8876
8909
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChatContext.Provider, { value, children });
|
|
8877
8910
|
}
|
|
@@ -9021,6 +9054,34 @@ function useFriendRequests() {
|
|
|
9021
9054
|
}, [refreshPendingRequests]);
|
|
9022
9055
|
return { requests: pendingRequests, loading, refetch };
|
|
9023
9056
|
}
|
|
9057
|
+
function useSentFriendRequests() {
|
|
9058
|
+
const { sentFriendRequests, refreshSentFriendRequests } = useChatContext();
|
|
9059
|
+
const [loading, setLoading] = (0, import_react50.useState)(false);
|
|
9060
|
+
const refetch = (0, import_react50.useCallback)(async () => {
|
|
9061
|
+
setLoading(true);
|
|
9062
|
+
await refreshSentFriendRequests();
|
|
9063
|
+
setLoading(false);
|
|
9064
|
+
}, [refreshSentFriendRequests]);
|
|
9065
|
+
return { requests: sentFriendRequests, loading, refetch };
|
|
9066
|
+
}
|
|
9067
|
+
function useCancelFriendRequest() {
|
|
9068
|
+
const { client } = useDubs();
|
|
9069
|
+
const { refreshSentFriendRequests } = useChatContext();
|
|
9070
|
+
const [loading, setLoading] = (0, import_react50.useState)(false);
|
|
9071
|
+
const cancel = (0, import_react50.useCallback)(
|
|
9072
|
+
async (requestId) => {
|
|
9073
|
+
setLoading(true);
|
|
9074
|
+
try {
|
|
9075
|
+
await client.cancelFriendRequest(requestId);
|
|
9076
|
+
await refreshSentFriendRequests();
|
|
9077
|
+
} finally {
|
|
9078
|
+
setLoading(false);
|
|
9079
|
+
}
|
|
9080
|
+
},
|
|
9081
|
+
[client, refreshSentFriendRequests]
|
|
9082
|
+
);
|
|
9083
|
+
return { cancel, loading };
|
|
9084
|
+
}
|
|
9024
9085
|
function useSearchUsers() {
|
|
9025
9086
|
const { client } = useDubs();
|
|
9026
9087
|
const [results, setResults] = (0, import_react50.useState)([]);
|
|
@@ -9139,6 +9200,7 @@ function useRespondToFriendRequest() {
|
|
|
9139
9200
|
useArcadePool,
|
|
9140
9201
|
useArcadePools,
|
|
9141
9202
|
useAuth,
|
|
9203
|
+
useCancelFriendRequest,
|
|
9142
9204
|
useChatContext,
|
|
9143
9205
|
useChatMessages,
|
|
9144
9206
|
useChatStatus,
|
|
@@ -9168,6 +9230,7 @@ function useRespondToFriendRequest() {
|
|
|
9168
9230
|
useSearchUsers,
|
|
9169
9231
|
useSendFriendRequest,
|
|
9170
9232
|
useSendMessage,
|
|
9233
|
+
useSentFriendRequests,
|
|
9171
9234
|
useShorts,
|
|
9172
9235
|
useUFCFightCard,
|
|
9173
9236
|
useUFCFighterDetail,
|