@looplay/sdk 0.8.7 → 0.8.8
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/looplay-sdk.cjs.js +22 -12
- package/dist/looplay-sdk.cjs.js.map +1 -1
- package/dist/looplay-sdk.esm.js +22 -12
- package/dist/looplay-sdk.esm.js.map +1 -1
- package/dist/looplay-sdk.min.js +3 -3
- package/dist/looplay-sdk.min.js.map +1 -1
- package/dist/types/iframe/iframe-auth.d.ts +7 -6
- package/dist/types/looplay-sdk.d.ts +7 -0
- package/package.json +1 -1
package/dist/looplay-sdk.esm.js
CHANGED
|
@@ -774,9 +774,23 @@ var LooplaySDK = class {
|
|
|
774
774
|
if (!this.api) throw new MissingBaseUrlError();
|
|
775
775
|
await this.api.listGameAssets(params.gameId);
|
|
776
776
|
}
|
|
777
|
+
/**
|
|
778
|
+
* Best-effort self-report — must never block init(). A missing/misconfigured
|
|
779
|
+
* whitelist (a separate setup step from SDK integration) makes the backend
|
|
780
|
+
* reject this call; if that rejection propagated, the whole init() would
|
|
781
|
+
* reject too and every other SDK method would throw NotInitializedError,
|
|
782
|
+
* breaking a game over what's really just an unfinished onboarding step.
|
|
783
|
+
*/
|
|
777
784
|
async detectIntegration(params) {
|
|
778
785
|
if (!this.api) return;
|
|
779
|
-
|
|
786
|
+
try {
|
|
787
|
+
await this.api.detectIntegration(params.gameId);
|
|
788
|
+
} catch (error) {
|
|
789
|
+
console.warn(
|
|
790
|
+
"[LooplaySDK] detectIntegration failed (SDK will still initialize) \u2014 check that this game has a whitelisted origin/domain configured:",
|
|
791
|
+
error
|
|
792
|
+
);
|
|
793
|
+
}
|
|
780
794
|
}
|
|
781
795
|
};
|
|
782
796
|
|
|
@@ -1150,12 +1164,13 @@ var LooplayIframeAuth = class {
|
|
|
1150
1164
|
}
|
|
1151
1165
|
/**
|
|
1152
1166
|
* Idempotent; auto-emits GAME_STARTED exactly once per distinct auth
|
|
1153
|
-
* session (bearer or anonymous)
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1167
|
+
* session (bearer or anonymous). SDK integration self-reporting for the
|
|
1168
|
+
* iframe path lives in `detectIntegrationOnce()` (fired from `setState()`
|
|
1169
|
+
* on every auth/config change, not gated behind lifecycle tracking being
|
|
1170
|
+
* enabled at all) — without it, games embedded via iframe would never
|
|
1171
|
+
* trigger the active detect call, only the passive heartbeat that
|
|
1172
|
+
* tracking calls leave behind (which doesn't fire while the game is still
|
|
1173
|
+
* IN_REVIEW/not LIVE, since tracking is blocked until then).
|
|
1159
1174
|
*/
|
|
1160
1175
|
initLifecycleTracking() {
|
|
1161
1176
|
if (this.lifecycleTrackingInitialized || typeof window === "undefined")
|
|
@@ -1166,11 +1181,6 @@ var LooplayIframeAuth = class {
|
|
|
1166
1181
|
const key = this.getTrackingKey();
|
|
1167
1182
|
if (!key || this.lastGameStartedKey === key) return;
|
|
1168
1183
|
this.lastGameStartedKey = key;
|
|
1169
|
-
const gameId = this.getGameId();
|
|
1170
|
-
if (gameId) {
|
|
1171
|
-
this.debug("auto detectIntegration dispatch", { gameId });
|
|
1172
|
-
void this.getClient().detectIntegration(gameId).catch(() => void 0);
|
|
1173
|
-
}
|
|
1174
1184
|
this.debug("auto GAME_STARTED dispatch");
|
|
1175
1185
|
void this.emitGameEvent("GAME_STARTED");
|
|
1176
1186
|
});
|