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