@dubsdotapp/expo 0.5.0 → 0.5.2
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 +33 -47
- package/dist/index.d.ts +33 -47
- package/dist/index.js +53 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +190 -188
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useArcadeBridge.ts +10 -10
- package/src/index.ts +1 -1
- package/src/ui/AuthGate.tsx +0 -27
- package/src/ui/ConnectWalletButton.tsx +79 -74
- package/src/ui/index.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -662,14 +662,6 @@ interface RegistrationScreenProps {
|
|
|
662
662
|
error: Error | null;
|
|
663
663
|
client: DubsClient;
|
|
664
664
|
}
|
|
665
|
-
interface ConnectWalletScreenProps$1 {
|
|
666
|
-
/** Call this to trigger the wallet connection flow */
|
|
667
|
-
onConnect: () => void;
|
|
668
|
-
/** True while the wallet is connecting/signing */
|
|
669
|
-
connecting: boolean;
|
|
670
|
-
/** Error from a failed connection attempt */
|
|
671
|
-
error: Error | null;
|
|
672
|
-
}
|
|
673
665
|
interface AuthGateProps {
|
|
674
666
|
children: React$1.ReactNode;
|
|
675
667
|
onSaveToken: (token: string | null) => void | Promise<void>;
|
|
@@ -677,17 +669,11 @@ interface AuthGateProps {
|
|
|
677
669
|
renderLoading?: (status: AuthStatus) => React$1.ReactNode;
|
|
678
670
|
renderError?: (error: Error, retry: () => void) => React$1.ReactNode;
|
|
679
671
|
renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
|
|
680
|
-
/**
|
|
681
|
-
* Render your own connect-wallet screen.
|
|
682
|
-
* Receives { onConnect, connecting, error }.
|
|
683
|
-
* If omitted, the default ConnectWalletScreen is shown.
|
|
684
|
-
*/
|
|
685
|
-
renderConnectWallet?: (props: ConnectWalletScreenProps$1) => React$1.ReactNode;
|
|
686
672
|
appName?: string;
|
|
687
673
|
/** Override accent color for registration screens (from developer UI config) */
|
|
688
674
|
accentColor?: string;
|
|
689
675
|
}
|
|
690
|
-
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration,
|
|
676
|
+
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration, appName, accentColor, }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
691
677
|
|
|
692
678
|
interface ConnectWalletScreenProps {
|
|
693
679
|
/** Called when the user taps Connect Wallet */
|
|
@@ -1142,6 +1128,8 @@ interface UseArcadeBridgeOptions {
|
|
|
1142
1128
|
startAttempt: () => Promise<StartAttemptResult>;
|
|
1143
1129
|
/** From useArcadeGame — submits a score for a completed life */
|
|
1144
1130
|
submitScore: (sessionToken: string, score: number, durationMs?: number) => Promise<SubmitScoreResult>;
|
|
1131
|
+
/** Called when a new life starts (after startAttempt succeeds and session is injected) */
|
|
1132
|
+
onPlayStarted?: () => void;
|
|
1145
1133
|
/** Called after a score is successfully submitted */
|
|
1146
1134
|
onScoreSubmitted?: (result: SubmitScoreResult) => void;
|
|
1147
1135
|
/** Called on any bridge error (network, invalid message, etc.) */
|
|
@@ -1162,45 +1150,43 @@ interface UseArcadeBridgeResult {
|
|
|
1162
1150
|
/** True while a startAttempt or submitScore request is in flight */
|
|
1163
1151
|
bridgeLoading: boolean;
|
|
1164
1152
|
}
|
|
1165
|
-
declare function useArcadeBridge({ canPlay, startAttempt, submitScore, onScoreSubmitted, onError, }: UseArcadeBridgeOptions): UseArcadeBridgeResult;
|
|
1153
|
+
declare function useArcadeBridge({ canPlay, startAttempt, submitScore, onPlayStarted, onScoreSubmitted, onError, }: UseArcadeBridgeOptions): UseArcadeBridgeResult;
|
|
1166
1154
|
|
|
1167
1155
|
interface ConnectWalletButtonProps {
|
|
1168
|
-
/**
|
|
1169
|
-
|
|
1170
|
-
/**
|
|
1156
|
+
/** Called when the user taps the button */
|
|
1157
|
+
onConnect: () => void | Promise<void>;
|
|
1158
|
+
/** Show a loading spinner while connecting */
|
|
1159
|
+
connecting?: boolean;
|
|
1160
|
+
/** Error message to display below the button */
|
|
1161
|
+
error?: string | null;
|
|
1162
|
+
/** Override accent color (e.g. from developer UI config) */
|
|
1171
1163
|
accentColor?: string;
|
|
1172
|
-
/** Override
|
|
1173
|
-
|
|
1174
|
-
/**
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
|
|
1178
|
-
/** Override font size */
|
|
1179
|
-
fontSize?: number;
|
|
1180
|
-
/** Full width. Defaults to true */
|
|
1181
|
-
fullWidth?: boolean;
|
|
1182
|
-
/** Called after authenticate() is triggered (not after it completes) */
|
|
1183
|
-
onPress?: () => void;
|
|
1164
|
+
/** Override button label. Defaults to "Connect Wallet" */
|
|
1165
|
+
label?: string;
|
|
1166
|
+
/** Additional style applied to the outer container */
|
|
1167
|
+
style?: ViewStyle;
|
|
1168
|
+
/** Additional style applied to the button itself */
|
|
1169
|
+
buttonStyle?: ViewStyle;
|
|
1184
1170
|
}
|
|
1185
1171
|
/**
|
|
1186
|
-
*
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1189
|
-
* Use this when you want to own the connect-wallet screen UI (e.g. inside
|
|
1190
|
-
* your own onboarding) but still hand off the wallet picker, signing, and
|
|
1191
|
-
* registration flow to the SDK.
|
|
1172
|
+
* Drop-in wallet connect button that triggers the same MWA / Phantom
|
|
1173
|
+
* connection flow as ConnectWalletScreen, but renders as a single button
|
|
1174
|
+
* instead of a full-screen layout.
|
|
1192
1175
|
*
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
1176
|
+
* Use with `renderConnectScreen` on DubsProvider to embed the button
|
|
1177
|
+
* inside your own custom onboarding or home screen:
|
|
1195
1178
|
*
|
|
1196
|
-
*
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
1199
|
-
*
|
|
1200
|
-
*
|
|
1201
|
-
*
|
|
1179
|
+
* ```tsx
|
|
1180
|
+
* <DubsProvider
|
|
1181
|
+
* renderConnectScreen={({ onConnect, connecting, error }) => (
|
|
1182
|
+
* <MyScreen>
|
|
1183
|
+
* <ConnectWalletButton onConnect={onConnect} connecting={connecting} error={error} />
|
|
1184
|
+
* </MyScreen>
|
|
1185
|
+
* )}
|
|
1186
|
+
* >
|
|
1187
|
+
* ```
|
|
1202
1188
|
*/
|
|
1203
|
-
declare function ConnectWalletButton({
|
|
1189
|
+
declare function ConnectWalletButton({ onConnect, connecting, error, accentColor, label, style, buttonStyle, }: ConnectWalletButtonProps): react_jsx_runtime.JSX.Element;
|
|
1204
1190
|
|
|
1205
1191
|
interface UserProfileCardProps {
|
|
1206
1192
|
walletAddress: string;
|
|
@@ -1426,4 +1412,4 @@ declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAd
|
|
|
1426
1412
|
*/
|
|
1427
1413
|
declare function ensurePngAvatar(url: string | null | undefined): string | undefined;
|
|
1428
1414
|
|
|
1429
|
-
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolStats, AuthGate, type
|
|
1415
|
+
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolStats, AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletButton, type ConnectWalletButtonProps, 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 EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, 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 StartAttemptResult, type SubmitScoreResult, type TokenStorage, 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, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEnterArcadePool, useEvents, useGame, useGames, useHasClaimed, useJoinGame, useNetworkGames, usePushNotifications, useUFCFightCard, useUFCFighterDetail };
|
package/dist/index.d.ts
CHANGED
|
@@ -662,14 +662,6 @@ interface RegistrationScreenProps {
|
|
|
662
662
|
error: Error | null;
|
|
663
663
|
client: DubsClient;
|
|
664
664
|
}
|
|
665
|
-
interface ConnectWalletScreenProps$1 {
|
|
666
|
-
/** Call this to trigger the wallet connection flow */
|
|
667
|
-
onConnect: () => void;
|
|
668
|
-
/** True while the wallet is connecting/signing */
|
|
669
|
-
connecting: boolean;
|
|
670
|
-
/** Error from a failed connection attempt */
|
|
671
|
-
error: Error | null;
|
|
672
|
-
}
|
|
673
665
|
interface AuthGateProps {
|
|
674
666
|
children: React$1.ReactNode;
|
|
675
667
|
onSaveToken: (token: string | null) => void | Promise<void>;
|
|
@@ -677,17 +669,11 @@ interface AuthGateProps {
|
|
|
677
669
|
renderLoading?: (status: AuthStatus) => React$1.ReactNode;
|
|
678
670
|
renderError?: (error: Error, retry: () => void) => React$1.ReactNode;
|
|
679
671
|
renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
|
|
680
|
-
/**
|
|
681
|
-
* Render your own connect-wallet screen.
|
|
682
|
-
* Receives { onConnect, connecting, error }.
|
|
683
|
-
* If omitted, the default ConnectWalletScreen is shown.
|
|
684
|
-
*/
|
|
685
|
-
renderConnectWallet?: (props: ConnectWalletScreenProps$1) => React$1.ReactNode;
|
|
686
672
|
appName?: string;
|
|
687
673
|
/** Override accent color for registration screens (from developer UI config) */
|
|
688
674
|
accentColor?: string;
|
|
689
675
|
}
|
|
690
|
-
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration,
|
|
676
|
+
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration, appName, accentColor, }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
691
677
|
|
|
692
678
|
interface ConnectWalletScreenProps {
|
|
693
679
|
/** Called when the user taps Connect Wallet */
|
|
@@ -1142,6 +1128,8 @@ interface UseArcadeBridgeOptions {
|
|
|
1142
1128
|
startAttempt: () => Promise<StartAttemptResult>;
|
|
1143
1129
|
/** From useArcadeGame — submits a score for a completed life */
|
|
1144
1130
|
submitScore: (sessionToken: string, score: number, durationMs?: number) => Promise<SubmitScoreResult>;
|
|
1131
|
+
/** Called when a new life starts (after startAttempt succeeds and session is injected) */
|
|
1132
|
+
onPlayStarted?: () => void;
|
|
1145
1133
|
/** Called after a score is successfully submitted */
|
|
1146
1134
|
onScoreSubmitted?: (result: SubmitScoreResult) => void;
|
|
1147
1135
|
/** Called on any bridge error (network, invalid message, etc.) */
|
|
@@ -1162,45 +1150,43 @@ interface UseArcadeBridgeResult {
|
|
|
1162
1150
|
/** True while a startAttempt or submitScore request is in flight */
|
|
1163
1151
|
bridgeLoading: boolean;
|
|
1164
1152
|
}
|
|
1165
|
-
declare function useArcadeBridge({ canPlay, startAttempt, submitScore, onScoreSubmitted, onError, }: UseArcadeBridgeOptions): UseArcadeBridgeResult;
|
|
1153
|
+
declare function useArcadeBridge({ canPlay, startAttempt, submitScore, onPlayStarted, onScoreSubmitted, onError, }: UseArcadeBridgeOptions): UseArcadeBridgeResult;
|
|
1166
1154
|
|
|
1167
1155
|
interface ConnectWalletButtonProps {
|
|
1168
|
-
/**
|
|
1169
|
-
|
|
1170
|
-
/**
|
|
1156
|
+
/** Called when the user taps the button */
|
|
1157
|
+
onConnect: () => void | Promise<void>;
|
|
1158
|
+
/** Show a loading spinner while connecting */
|
|
1159
|
+
connecting?: boolean;
|
|
1160
|
+
/** Error message to display below the button */
|
|
1161
|
+
error?: string | null;
|
|
1162
|
+
/** Override accent color (e.g. from developer UI config) */
|
|
1171
1163
|
accentColor?: string;
|
|
1172
|
-
/** Override
|
|
1173
|
-
|
|
1174
|
-
/**
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
|
|
1178
|
-
/** Override font size */
|
|
1179
|
-
fontSize?: number;
|
|
1180
|
-
/** Full width. Defaults to true */
|
|
1181
|
-
fullWidth?: boolean;
|
|
1182
|
-
/** Called after authenticate() is triggered (not after it completes) */
|
|
1183
|
-
onPress?: () => void;
|
|
1164
|
+
/** Override button label. Defaults to "Connect Wallet" */
|
|
1165
|
+
label?: string;
|
|
1166
|
+
/** Additional style applied to the outer container */
|
|
1167
|
+
style?: ViewStyle;
|
|
1168
|
+
/** Additional style applied to the button itself */
|
|
1169
|
+
buttonStyle?: ViewStyle;
|
|
1184
1170
|
}
|
|
1185
1171
|
/**
|
|
1186
|
-
*
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1189
|
-
* Use this when you want to own the connect-wallet screen UI (e.g. inside
|
|
1190
|
-
* your own onboarding) but still hand off the wallet picker, signing, and
|
|
1191
|
-
* registration flow to the SDK.
|
|
1172
|
+
* Drop-in wallet connect button that triggers the same MWA / Phantom
|
|
1173
|
+
* connection flow as ConnectWalletScreen, but renders as a single button
|
|
1174
|
+
* instead of a full-screen layout.
|
|
1192
1175
|
*
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
1176
|
+
* Use with `renderConnectScreen` on DubsProvider to embed the button
|
|
1177
|
+
* inside your own custom onboarding or home screen:
|
|
1195
1178
|
*
|
|
1196
|
-
*
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
1199
|
-
*
|
|
1200
|
-
*
|
|
1201
|
-
*
|
|
1179
|
+
* ```tsx
|
|
1180
|
+
* <DubsProvider
|
|
1181
|
+
* renderConnectScreen={({ onConnect, connecting, error }) => (
|
|
1182
|
+
* <MyScreen>
|
|
1183
|
+
* <ConnectWalletButton onConnect={onConnect} connecting={connecting} error={error} />
|
|
1184
|
+
* </MyScreen>
|
|
1185
|
+
* )}
|
|
1186
|
+
* >
|
|
1187
|
+
* ```
|
|
1202
1188
|
*/
|
|
1203
|
-
declare function ConnectWalletButton({
|
|
1189
|
+
declare function ConnectWalletButton({ onConnect, connecting, error, accentColor, label, style, buttonStyle, }: ConnectWalletButtonProps): react_jsx_runtime.JSX.Element;
|
|
1204
1190
|
|
|
1205
1191
|
interface UserProfileCardProps {
|
|
1206
1192
|
walletAddress: string;
|
|
@@ -1426,4 +1412,4 @@ declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAd
|
|
|
1426
1412
|
*/
|
|
1427
1413
|
declare function ensurePngAvatar(url: string | null | undefined): string | undefined;
|
|
1428
1414
|
|
|
1429
|
-
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolStats, AuthGate, type
|
|
1415
|
+
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolStats, AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletButton, type ConnectWalletButtonProps, 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 EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, 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 StartAttemptResult, type SubmitScoreResult, type TokenStorage, 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, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEnterArcadePool, useEvents, useGame, useGames, useHasClaimed, useJoinGame, useNetworkGames, usePushNotifications, useUFCFightCard, useUFCFighterDetail };
|
package/dist/index.js
CHANGED
|
@@ -2851,14 +2851,13 @@ function useArcadeBridge({
|
|
|
2851
2851
|
canPlay,
|
|
2852
2852
|
startAttempt,
|
|
2853
2853
|
submitScore,
|
|
2854
|
+
onPlayStarted,
|
|
2854
2855
|
onScoreSubmitted,
|
|
2855
2856
|
onError
|
|
2856
2857
|
}) {
|
|
2857
2858
|
const webviewRef = (0, import_react22.useRef)(null);
|
|
2858
2859
|
const sessionTokenRef = (0, import_react22.useRef)(null);
|
|
2859
2860
|
const gameStartTimeRef = (0, import_react22.useRef)(0);
|
|
2860
|
-
const canPlayRef = (0, import_react22.useRef)(canPlay);
|
|
2861
|
-
canPlayRef.current = canPlay;
|
|
2862
2861
|
const [lastResult, setLastResult] = (0, import_react22.useState)(null);
|
|
2863
2862
|
const [bridgeLoading, setBridgeLoading] = (0, import_react22.useState)(false);
|
|
2864
2863
|
const injectSession = (0, import_react22.useCallback)((token, attemptNumber) => {
|
|
@@ -2879,13 +2878,14 @@ function useArcadeBridge({
|
|
|
2879
2878
|
gameStartTimeRef.current = Date.now();
|
|
2880
2879
|
setLastResult(null);
|
|
2881
2880
|
injectSession(result.sessionToken, result.attemptNumber);
|
|
2881
|
+
onPlayStarted?.();
|
|
2882
2882
|
} catch (err) {
|
|
2883
2883
|
const e = err instanceof Error ? err : new Error(String(err));
|
|
2884
2884
|
onError?.(e);
|
|
2885
2885
|
} finally {
|
|
2886
2886
|
setBridgeLoading(false);
|
|
2887
2887
|
}
|
|
2888
|
-
}, [canPlay, startAttempt, injectSession, onError]);
|
|
2888
|
+
}, [canPlay, startAttempt, injectSession, onPlayStarted, onError]);
|
|
2889
2889
|
const handleMessage = (0, import_react22.useCallback)(
|
|
2890
2890
|
async (event) => {
|
|
2891
2891
|
let data;
|
|
@@ -2894,10 +2894,10 @@ function useArcadeBridge({
|
|
|
2894
2894
|
} catch {
|
|
2895
2895
|
return;
|
|
2896
2896
|
}
|
|
2897
|
-
if (data.dubsArcade !==
|
|
2897
|
+
if (data.dubsArcade !== PROTOCOL_VERSION) return;
|
|
2898
2898
|
switch (data.type) {
|
|
2899
2899
|
case "TAP_PLAY": {
|
|
2900
|
-
if (
|
|
2900
|
+
if (canPlay) {
|
|
2901
2901
|
triggerPlay();
|
|
2902
2902
|
}
|
|
2903
2903
|
return;
|
|
@@ -2926,7 +2926,7 @@ function useArcadeBridge({
|
|
|
2926
2926
|
return;
|
|
2927
2927
|
}
|
|
2928
2928
|
},
|
|
2929
|
-
[triggerPlay, submitScore, onScoreSubmitted, onError]
|
|
2929
|
+
[canPlay, triggerPlay, submitScore, onScoreSubmitted, onError]
|
|
2930
2930
|
);
|
|
2931
2931
|
return { webviewRef, handleMessage, triggerPlay, lastResult, bridgeLoading };
|
|
2932
2932
|
}
|
|
@@ -3086,7 +3086,6 @@ function AuthGate({
|
|
|
3086
3086
|
renderLoading,
|
|
3087
3087
|
renderError,
|
|
3088
3088
|
renderRegistration,
|
|
3089
|
-
renderConnectWallet,
|
|
3090
3089
|
appName = "Dubs",
|
|
3091
3090
|
accentColor
|
|
3092
3091
|
}) {
|
|
@@ -3187,14 +3186,6 @@ function AuthGate({
|
|
|
3187
3186
|
if (renderError) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: renderError(auth.error, retry) });
|
|
3188
3187
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DefaultErrorScreen, { error: auth.error, onRetry: retry, appName, accentColor });
|
|
3189
3188
|
}
|
|
3190
|
-
if (auth.status === "idle") {
|
|
3191
|
-
const connectProps = {
|
|
3192
|
-
onConnect: auth.authenticate,
|
|
3193
|
-
connecting: false,
|
|
3194
|
-
error: null
|
|
3195
|
-
};
|
|
3196
|
-
if (renderConnectWallet) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: renderConnectWallet(connectProps) });
|
|
3197
|
-
}
|
|
3198
3189
|
if (renderLoading) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: renderLoading(auth.status) });
|
|
3199
3190
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DefaultLoadingScreen, { status: auth.status, appName, accentColor });
|
|
3200
3191
|
}
|
|
@@ -3897,52 +3888,62 @@ function useAppConfig() {
|
|
|
3897
3888
|
var import_react_native9 = require("react-native");
|
|
3898
3889
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3899
3890
|
function ConnectWalletButton({
|
|
3900
|
-
|
|
3891
|
+
onConnect,
|
|
3892
|
+
connecting = false,
|
|
3893
|
+
error = null,
|
|
3901
3894
|
accentColor,
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
fontSize = 17,
|
|
3906
|
-
fullWidth = true,
|
|
3907
|
-
onPress
|
|
3895
|
+
label = "Connect Wallet",
|
|
3896
|
+
style,
|
|
3897
|
+
buttonStyle
|
|
3908
3898
|
}) {
|
|
3909
3899
|
const t = useDubsTheme();
|
|
3910
|
-
const { authenticate, status } = useAuth();
|
|
3911
|
-
const connecting = status === "authenticating" || status === "signing" || status === "verifying";
|
|
3912
3900
|
const accent = accentColor || t.accent;
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
}
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
);
|
|
3901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native9.View, { style, children: [
|
|
3902
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3903
|
+
import_react_native9.View,
|
|
3904
|
+
{
|
|
3905
|
+
style: [
|
|
3906
|
+
styles3.errorBox,
|
|
3907
|
+
{ backgroundColor: t.errorBg, borderColor: t.errorBorder }
|
|
3908
|
+
],
|
|
3909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles3.errorText, { color: t.errorText }], children: error })
|
|
3910
|
+
}
|
|
3911
|
+
) : null,
|
|
3912
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3913
|
+
import_react_native9.TouchableOpacity,
|
|
3914
|
+
{
|
|
3915
|
+
style: [styles3.button, { backgroundColor: accent }, buttonStyle],
|
|
3916
|
+
onPress: onConnect,
|
|
3917
|
+
disabled: connecting,
|
|
3918
|
+
activeOpacity: 0.8,
|
|
3919
|
+
children: connecting ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.ActivityIndicator, { color: "#FFFFFF", size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: styles3.buttonText, children: label })
|
|
3920
|
+
}
|
|
3921
|
+
)
|
|
3922
|
+
] });
|
|
3936
3923
|
}
|
|
3937
3924
|
var styles3 = import_react_native9.StyleSheet.create({
|
|
3938
|
-
|
|
3939
|
-
|
|
3925
|
+
button: {
|
|
3926
|
+
height: 56,
|
|
3927
|
+
borderRadius: 16,
|
|
3940
3928
|
justifyContent: "center",
|
|
3929
|
+
alignItems: "center",
|
|
3941
3930
|
paddingHorizontal: 24
|
|
3942
3931
|
},
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3932
|
+
buttonText: {
|
|
3933
|
+
color: "#FFFFFF",
|
|
3934
|
+
fontSize: 18,
|
|
3935
|
+
fontWeight: "700"
|
|
3936
|
+
},
|
|
3937
|
+
errorBox: {
|
|
3938
|
+
borderWidth: 1,
|
|
3939
|
+
borderRadius: 12,
|
|
3940
|
+
paddingHorizontal: 16,
|
|
3941
|
+
paddingVertical: 12,
|
|
3942
|
+
marginBottom: 12
|
|
3943
|
+
},
|
|
3944
|
+
errorText: {
|
|
3945
|
+
fontSize: 14,
|
|
3946
|
+
textAlign: "center"
|
|
3946
3947
|
}
|
|
3947
3948
|
});
|
|
3948
3949
|
|