@genex-ai/embed-sdk 0.3.0 → 0.3.1
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/{chunk-IB4PTSH5.js → chunk-S7JLPCNE.js} +6 -23
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/sentry.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
var PROTOCOL_VERSION = 1;
|
|
3
3
|
var RETRY_FLAG = "genex:embed:retry";
|
|
4
|
-
var PREFER_AUTH_FLAG = "genex:prefer-auth";
|
|
5
4
|
var POPOVER_DISMISSED_FLAG = "genex:guest:popover-dismissed";
|
|
6
5
|
var config = null;
|
|
7
6
|
var state = "pending";
|
|
@@ -51,19 +50,6 @@ function clearRetryFlag() {
|
|
|
51
50
|
} catch {
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
function readPreferAuth() {
|
|
55
|
-
try {
|
|
56
|
-
return win()?.localStorage?.getItem(PREFER_AUTH_FLAG) === "1";
|
|
57
|
-
} catch {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function writePreferAuth() {
|
|
62
|
-
try {
|
|
63
|
-
win()?.localStorage?.setItem(PREFER_AUTH_FLAG, "1");
|
|
64
|
-
} catch {
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
53
|
function readPopoverDismissed() {
|
|
68
54
|
try {
|
|
69
55
|
return win()?.sessionStorage?.getItem(POPOVER_DISMISSED_FLAG) === "1";
|
|
@@ -207,12 +193,8 @@ async function startStandaloneFlow(w) {
|
|
|
207
193
|
await requestGuestSession();
|
|
208
194
|
return;
|
|
209
195
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
await redirectToAuthorize(w, { guestOk: true });
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
await requestGuestSession();
|
|
196
|
+
showOverlay("redirecting");
|
|
197
|
+
await redirectToAuthorize(w, { guestOk: true });
|
|
216
198
|
}
|
|
217
199
|
var stashedTicketHash = null;
|
|
218
200
|
function _stashTicketFromUrl() {
|
|
@@ -295,7 +277,6 @@ async function redeemTicket(ticket) {
|
|
|
295
277
|
void colyseusUrl;
|
|
296
278
|
state = "authenticated";
|
|
297
279
|
clearRetryFlag();
|
|
298
|
-
writePreferAuth();
|
|
299
280
|
removeOverlay();
|
|
300
281
|
removeGuestPopover();
|
|
301
282
|
scheduleRefresh();
|
|
@@ -365,7 +346,7 @@ async function handleRedeemFailure() {
|
|
|
365
346
|
if (w && !isEmbedded() && !readRetryFlag()) {
|
|
366
347
|
writeRetryFlag();
|
|
367
348
|
showOverlay("redirecting");
|
|
368
|
-
await redirectToAuthorize(w);
|
|
349
|
+
await redirectToAuthorize(w, { guestOk: true });
|
|
369
350
|
return;
|
|
370
351
|
}
|
|
371
352
|
enterBlocked();
|
|
@@ -430,7 +411,9 @@ function enterBlocked() {
|
|
|
430
411
|
}
|
|
431
412
|
var OVERLAY_TEXT = {
|
|
432
413
|
connecting: { title: "Connecting to Genex\u2026" },
|
|
433
|
-
|
|
414
|
+
// Neutral on purpose: the automatic bounce precedes GUEST play as often as
|
|
415
|
+
// sign-in — "signing you in" would be wrong for most visitors.
|
|
416
|
+
redirecting: { title: "Loading\u2026" },
|
|
434
417
|
"blocked-standalone": { title: "Sign in to play", button: "Sign in" },
|
|
435
418
|
"blocked-embedded": { title: "Sign in on the Genex dashboard to continue" }
|
|
436
419
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -28,10 +28,10 @@ interface EventContext {
|
|
|
28
28
|
* identity (multiplayer connect, name UI) and waitForAuth() for anything that
|
|
29
29
|
* needs a signed-in ACCOUNT (/state saves).
|
|
30
30
|
*
|
|
31
|
-
* Standalone (not in an iframe) with no return-trip
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* (
|
|
31
|
+
* Standalone (not in an iframe) with no return-trip fragment present, this
|
|
32
|
+
* bounces once through the dashboard's /play/authorize and comes straight
|
|
33
|
+
* back — signed-in visitors arrive authenticated (zero clicks, any game),
|
|
34
|
+
* everyone else arrives as a guest (published games; no login wall).
|
|
35
35
|
*/
|
|
36
36
|
declare function initEmbed(cfg: EmbedConfig): void;
|
|
37
37
|
/**
|
package/dist/index.js
CHANGED
package/dist/sentry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genex-ai/embed-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Player identity for genex games — signed-in (dashboard iframe postMessage handshake or sign-in redirect) or guest (accountless play for published games, sign in to save).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|