@dubsdotapp/expo 0.5.1 → 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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useArcadeBridge.ts +6 -1
package/dist/index.d.mts
CHANGED
|
@@ -1128,6 +1128,8 @@ interface UseArcadeBridgeOptions {
|
|
|
1128
1128
|
startAttempt: () => Promise<StartAttemptResult>;
|
|
1129
1129
|
/** From useArcadeGame — submits a score for a completed life */
|
|
1130
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;
|
|
1131
1133
|
/** Called after a score is successfully submitted */
|
|
1132
1134
|
onScoreSubmitted?: (result: SubmitScoreResult) => void;
|
|
1133
1135
|
/** Called on any bridge error (network, invalid message, etc.) */
|
|
@@ -1148,7 +1150,7 @@ interface UseArcadeBridgeResult {
|
|
|
1148
1150
|
/** True while a startAttempt or submitScore request is in flight */
|
|
1149
1151
|
bridgeLoading: boolean;
|
|
1150
1152
|
}
|
|
1151
|
-
declare function useArcadeBridge({ canPlay, startAttempt, submitScore, onScoreSubmitted, onError, }: UseArcadeBridgeOptions): UseArcadeBridgeResult;
|
|
1153
|
+
declare function useArcadeBridge({ canPlay, startAttempt, submitScore, onPlayStarted, onScoreSubmitted, onError, }: UseArcadeBridgeOptions): UseArcadeBridgeResult;
|
|
1152
1154
|
|
|
1153
1155
|
interface ConnectWalletButtonProps {
|
|
1154
1156
|
/** Called when the user taps the button */
|
package/dist/index.d.ts
CHANGED
|
@@ -1128,6 +1128,8 @@ interface UseArcadeBridgeOptions {
|
|
|
1128
1128
|
startAttempt: () => Promise<StartAttemptResult>;
|
|
1129
1129
|
/** From useArcadeGame — submits a score for a completed life */
|
|
1130
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;
|
|
1131
1133
|
/** Called after a score is successfully submitted */
|
|
1132
1134
|
onScoreSubmitted?: (result: SubmitScoreResult) => void;
|
|
1133
1135
|
/** Called on any bridge error (network, invalid message, etc.) */
|
|
@@ -1148,7 +1150,7 @@ interface UseArcadeBridgeResult {
|
|
|
1148
1150
|
/** True while a startAttempt or submitScore request is in flight */
|
|
1149
1151
|
bridgeLoading: boolean;
|
|
1150
1152
|
}
|
|
1151
|
-
declare function useArcadeBridge({ canPlay, startAttempt, submitScore, onScoreSubmitted, onError, }: UseArcadeBridgeOptions): UseArcadeBridgeResult;
|
|
1153
|
+
declare function useArcadeBridge({ canPlay, startAttempt, submitScore, onPlayStarted, onScoreSubmitted, onError, }: UseArcadeBridgeOptions): UseArcadeBridgeResult;
|
|
1152
1154
|
|
|
1153
1155
|
interface ConnectWalletButtonProps {
|
|
1154
1156
|
/** Called when the user taps the button */
|
package/dist/index.js
CHANGED
|
@@ -2851,6 +2851,7 @@ function useArcadeBridge({
|
|
|
2851
2851
|
canPlay,
|
|
2852
2852
|
startAttempt,
|
|
2853
2853
|
submitScore,
|
|
2854
|
+
onPlayStarted,
|
|
2854
2855
|
onScoreSubmitted,
|
|
2855
2856
|
onError
|
|
2856
2857
|
}) {
|
|
@@ -2877,13 +2878,14 @@ function useArcadeBridge({
|
|
|
2877
2878
|
gameStartTimeRef.current = Date.now();
|
|
2878
2879
|
setLastResult(null);
|
|
2879
2880
|
injectSession(result.sessionToken, result.attemptNumber);
|
|
2881
|
+
onPlayStarted?.();
|
|
2880
2882
|
} catch (err) {
|
|
2881
2883
|
const e = err instanceof Error ? err : new Error(String(err));
|
|
2882
2884
|
onError?.(e);
|
|
2883
2885
|
} finally {
|
|
2884
2886
|
setBridgeLoading(false);
|
|
2885
2887
|
}
|
|
2886
|
-
}, [canPlay, startAttempt, injectSession, onError]);
|
|
2888
|
+
}, [canPlay, startAttempt, injectSession, onPlayStarted, onError]);
|
|
2887
2889
|
const handleMessage = (0, import_react22.useCallback)(
|
|
2888
2890
|
async (event) => {
|
|
2889
2891
|
let data;
|