@dubsdotapp/expo 0.2.74 → 0.2.76
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 +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useAuth.ts +10 -4
- package/src/index.ts +1 -0
- package/src/ui/UserProfileCard.tsx +2 -1
- package/src/ui/UserProfileSheet.tsx +5 -2
- package/src/ui/game/PlayersCard.tsx +2 -1
- package/src/utils/avatarUrl.ts +9 -0
package/dist/index.d.mts
CHANGED
|
@@ -1125,4 +1125,11 @@ declare function ClaimButton({ gameId, style, onSuccess, onError }: ClaimButtonP
|
|
|
1125
1125
|
*/
|
|
1126
1126
|
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
|
|
1127
1127
|
|
|
1128
|
-
|
|
1128
|
+
/**
|
|
1129
|
+
* Ensure a DiceBear avatar URL uses PNG format for React Native compatibility.
|
|
1130
|
+
* React Native's Image component cannot render SVGs.
|
|
1131
|
+
* This converts at render time only — the stored URL in the DB is never modified.
|
|
1132
|
+
*/
|
|
1133
|
+
declare function ensurePngAvatar(url: string | null | undefined): string | undefined;
|
|
1134
|
+
|
|
1135
|
+
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, 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 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, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useHasClaimed, useJoinGame, useNetworkGames, usePushNotifications, useUFCFightCard, useUFCFighterDetail };
|
package/dist/index.d.ts
CHANGED
|
@@ -1125,4 +1125,11 @@ declare function ClaimButton({ gameId, style, onSuccess, onError }: ClaimButtonP
|
|
|
1125
1125
|
*/
|
|
1126
1126
|
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
|
|
1127
1127
|
|
|
1128
|
-
|
|
1128
|
+
/**
|
|
1129
|
+
* Ensure a DiceBear avatar URL uses PNG format for React Native compatibility.
|
|
1130
|
+
* React Native's Image component cannot render SVGs.
|
|
1131
|
+
* This converts at render time only — the stored URL in the DB is never modified.
|
|
1132
|
+
*/
|
|
1133
|
+
declare function ensurePngAvatar(url: string | null | undefined): string | undefined;
|
|
1134
|
+
|
|
1135
|
+
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, 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 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, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useHasClaimed, useJoinGame, useNetworkGames, usePushNotifications, useUFCFightCard, useUFCFighterDetail };
|
package/dist/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __export(index_exports, {
|
|
|
55
55
|
UserProfileCard: () => UserProfileCard,
|
|
56
56
|
UserProfileSheet: () => UserProfileSheet,
|
|
57
57
|
createSecureStoreStorage: () => createSecureStoreStorage,
|
|
58
|
+
ensurePngAvatar: () => ensurePngAvatar,
|
|
58
59
|
getDeviceInfo: () => getDeviceInfo,
|
|
59
60
|
isSolanaSeeker: () => isSolanaSeeker,
|
|
60
61
|
mergeTheme: () => mergeTheme,
|
|
@@ -2182,6 +2183,12 @@ async function getDeviceInfo() {
|
|
|
2182
2183
|
}
|
|
2183
2184
|
}
|
|
2184
2185
|
|
|
2186
|
+
// src/utils/avatarUrl.ts
|
|
2187
|
+
function ensurePngAvatar(url) {
|
|
2188
|
+
if (!url) return void 0;
|
|
2189
|
+
return url.replace("/svg?", "/png?");
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2185
2192
|
// src/hooks/useAuth.ts
|
|
2186
2193
|
function useAuth() {
|
|
2187
2194
|
const sharedAuth = (0, import_react13.useContext)(AuthContext);
|
|
@@ -2192,6 +2199,10 @@ function useAuth() {
|
|
|
2192
2199
|
const [token, setToken] = (0, import_react13.useState)(null);
|
|
2193
2200
|
const [error, setError] = (0, import_react13.useState)(null);
|
|
2194
2201
|
const pendingAuth = (0, import_react13.useRef)(null);
|
|
2202
|
+
const normalizeUser = (u) => ({
|
|
2203
|
+
...u,
|
|
2204
|
+
avatar: ensurePngAvatar(u.avatar) ?? u.avatar
|
|
2205
|
+
});
|
|
2195
2206
|
const reset = (0, import_react13.useCallback)(() => {
|
|
2196
2207
|
setStatus("idle");
|
|
2197
2208
|
setUser(null);
|
|
@@ -2225,7 +2236,7 @@ function useAuth() {
|
|
|
2225
2236
|
setStatus("needsRegistration");
|
|
2226
2237
|
return;
|
|
2227
2238
|
}
|
|
2228
|
-
setUser(result.user);
|
|
2239
|
+
setUser(normalizeUser(result.user));
|
|
2229
2240
|
setToken(result.token);
|
|
2230
2241
|
setStatus("authenticated");
|
|
2231
2242
|
} catch (err) {
|
|
@@ -2260,7 +2271,7 @@ function useAuth() {
|
|
|
2260
2271
|
});
|
|
2261
2272
|
pendingAuth.current = null;
|
|
2262
2273
|
const user2 = avatarUrl && !result.user.avatar ? { ...result.user, avatar: avatarUrl } : result.user;
|
|
2263
|
-
setUser(user2);
|
|
2274
|
+
setUser(normalizeUser(user2));
|
|
2264
2275
|
setToken(result.token);
|
|
2265
2276
|
setStatus("authenticated");
|
|
2266
2277
|
} catch (err) {
|
|
@@ -2283,7 +2294,7 @@ function useAuth() {
|
|
|
2283
2294
|
try {
|
|
2284
2295
|
client.setToken(savedToken);
|
|
2285
2296
|
const me = await client.getMe();
|
|
2286
|
-
setUser(me);
|
|
2297
|
+
setUser(normalizeUser(me));
|
|
2287
2298
|
setToken(savedToken);
|
|
2288
2299
|
setStatus("authenticated");
|
|
2289
2300
|
return true;
|
|
@@ -2298,7 +2309,7 @@ function useAuth() {
|
|
|
2298
2309
|
const refreshUser = (0, import_react13.useCallback)(async () => {
|
|
2299
2310
|
try {
|
|
2300
2311
|
const me = await client.getMe();
|
|
2301
|
-
setUser(me);
|
|
2312
|
+
setUser(normalizeUser(me));
|
|
2302
2313
|
} catch {
|
|
2303
2314
|
}
|
|
2304
2315
|
}, [client]);
|
|
@@ -3354,7 +3365,7 @@ function UserProfileCard({
|
|
|
3354
3365
|
}) {
|
|
3355
3366
|
const t = useDubsTheme();
|
|
3356
3367
|
const imageUri = (0, import_react19.useMemo)(
|
|
3357
|
-
() => avatarUrl || `https://api.dicebear.com/9.x/avataaars/png?seed=${walletAddress}&size=128`,
|
|
3368
|
+
() => ensurePngAvatar(avatarUrl) || `https://api.dicebear.com/9.x/avataaars/png?seed=${walletAddress}&size=128`,
|
|
3358
3369
|
[avatarUrl, walletAddress]
|
|
3359
3370
|
);
|
|
3360
3371
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native8.View, { style: [styles2.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
@@ -3566,7 +3577,7 @@ function getAvatarUrl2(style, seed, size = 256) {
|
|
|
3566
3577
|
function parseAvatarUrl(url) {
|
|
3567
3578
|
if (!url) return { style: "adventurer", seed: generateSeed2() };
|
|
3568
3579
|
try {
|
|
3569
|
-
const match = url.match(
|
|
3580
|
+
const match = url.match(/\/\d+\.x\/([^/]+)\/(?:png|svg)\?seed=([^&]+)/);
|
|
3570
3581
|
if (match) return { style: match[1], seed: match[2] };
|
|
3571
3582
|
} catch {
|
|
3572
3583
|
}
|
|
@@ -3846,7 +3857,8 @@ var styles4 = import_react_native10.StyleSheet.create({
|
|
|
3846
3857
|
},
|
|
3847
3858
|
avatar: {
|
|
3848
3859
|
width: "100%",
|
|
3849
|
-
height: "100%"
|
|
3860
|
+
height: "100%",
|
|
3861
|
+
backgroundColor: "#1a1a2e"
|
|
3850
3862
|
},
|
|
3851
3863
|
avatarLoading: {
|
|
3852
3864
|
...import_react_native10.StyleSheet.absoluteFillObject,
|
|
@@ -3897,7 +3909,8 @@ var styles4 = import_react_native10.StyleSheet.create({
|
|
|
3897
3909
|
},
|
|
3898
3910
|
styleTileImage: {
|
|
3899
3911
|
width: "100%",
|
|
3900
|
-
height: "100%"
|
|
3912
|
+
height: "100%",
|
|
3913
|
+
backgroundColor: "#1a1a2e"
|
|
3901
3914
|
},
|
|
3902
3915
|
// Error
|
|
3903
3916
|
errorBox: {
|
|
@@ -4352,7 +4365,7 @@ function BettorRow({
|
|
|
4352
4365
|
const showAvatar = bettor.avatar && !imgFailed;
|
|
4353
4366
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native14.View, { style: [styles8.row, !isFirst && { borderTopColor: t.border, borderTopWidth: 1 }], children: [
|
|
4354
4367
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native14.View, { style: [styles8.dot, { backgroundColor: dotColor }] }),
|
|
4355
|
-
showAvatar ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Img, { source: { uri: bettor.avatar }, style: styles8.avatar, resizeMode: "cover", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native14.View, { style: [styles8.avatar, styles8.avatarPlaceholder] }),
|
|
4368
|
+
showAvatar ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Img, { source: { uri: ensurePngAvatar(bettor.avatar) }, style: styles8.avatar, resizeMode: "cover", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native14.View, { style: [styles8.avatar, styles8.avatarPlaceholder] }),
|
|
4356
4369
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native14.View, { style: styles8.nameCol, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native14.Text, { style: [styles8.username, { color: t.text }], numberOfLines: 1, children: bettor.username || truncateWallet(bettor.wallet, truncateChars) }) }),
|
|
4357
4370
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native14.Text, { style: [styles8.amount, { color: t.textSecondary }], children: [
|
|
4358
4371
|
bettor.amount,
|
|
@@ -5615,6 +5628,7 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
5615
5628
|
UserProfileCard,
|
|
5616
5629
|
UserProfileSheet,
|
|
5617
5630
|
createSecureStoreStorage,
|
|
5631
|
+
ensurePngAvatar,
|
|
5618
5632
|
getDeviceInfo,
|
|
5619
5633
|
isSolanaSeeker,
|
|
5620
5634
|
mergeTheme,
|