@genex-ai/embed-sdk 0.31.0 → 0.33.0
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/README.md +294 -0
- package/dist/{chunk-QNZZIJGP.js → chunk-NI554TIV.js} +955 -66
- package/dist/chunk-QBCWKMVQ.js +534 -0
- package/dist/development.js +1 -1
- package/dist/index.d.ts +316 -8
- package/dist/index.js +30 -2
- package/dist/sentry.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-MJPLBT3T.js +0 -264
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import { R as RuntimeJudgeQuestion, c as RuntimeJudgeAnswer, d as RuntimeJudgmentView, a as RuntimeWorkflowInput, e as RuntimeGenerationBilling, f as RuntimeGenerationFunding, g as RuntimeGrantView, b as RuntimeGenerationView, h as RuntimeGenerationModels, i as RuntimeWorkflowOfferings } from './runtime-generation-B3oFDmCp.js';
|
|
2
2
|
export { j as RuntimeBillingPolicy, k as RuntimeCurrency, l as RuntimeExternalProvider, m as RuntimeGenerationStatus, n as RuntimeGenerationStreamEvent, o as RuntimeGrantJudgeTerms, p as RuntimeGrantStatus, q as RuntimeGrantTerms, r as RuntimeJudgeCriterion } from './runtime-generation-B3oFDmCp.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Why a platform call did not happen. One vocabulary for every SDK function,
|
|
6
|
+
* whether the reason was found in the game's own page or sent back by the
|
|
7
|
+
* dashboard in `code`:
|
|
8
|
+
*
|
|
9
|
+
* - `unsupported`: this shell has no way to do it.
|
|
10
|
+
* - `needs_gesture`: the browser wants a click or a tap behind the call.
|
|
11
|
+
* - `dismissed`: the player said no.
|
|
12
|
+
* - `busy`: another confirmation is already on screen.
|
|
13
|
+
* - `rate_limited`: this game asked too often.
|
|
14
|
+
* - `invalid_request`: the arguments are outside the bounds below.
|
|
15
|
+
* - `too_large`: the file is over `SAVE_MAX_BYTES`.
|
|
16
|
+
* - `timeout`: no answer came back. Only the SDK reports this one.
|
|
17
|
+
*/
|
|
18
|
+
declare const PLATFORM_ERRORS: readonly ["unsupported", "needs_gesture", "dismissed", "busy", "rate_limited", "invalid_request", "too_large", "timeout"];
|
|
19
|
+
type PlatformError = (typeof PLATFORM_ERRORS)[number];
|
|
20
|
+
|
|
4
21
|
/** A thing the game sells. Resolved server-side; the game never sets a price. */
|
|
5
22
|
interface ShopItem {
|
|
6
23
|
id: string;
|
|
@@ -58,6 +75,43 @@ interface PurchaseResult {
|
|
|
58
75
|
entitlementId?: string;
|
|
59
76
|
message?: string;
|
|
60
77
|
}
|
|
78
|
+
/** A server-recorded payment request, scoped to this player and game. */
|
|
79
|
+
interface PaymentReceipt {
|
|
80
|
+
id: string;
|
|
81
|
+
/** The game's stable order key. Reusing it never creates another charge. */
|
|
82
|
+
orderId: string;
|
|
83
|
+
title: string;
|
|
84
|
+
description: string | null;
|
|
85
|
+
amountCoins: number;
|
|
86
|
+
/** Frozen real-money equivalent from the server, in USD cents. */
|
|
87
|
+
priceDisplayUsdCents: number;
|
|
88
|
+
status: 'requires_confirmation' | 'processing' | 'succeeded' | 'canceled' | 'expired' | 'failed';
|
|
89
|
+
failureCode: string | null;
|
|
90
|
+
createdAt: string;
|
|
91
|
+
paidAt: string | null;
|
|
92
|
+
expiresAt: string;
|
|
93
|
+
}
|
|
94
|
+
interface PaymentOptions {
|
|
95
|
+
/** Persist before asking. Reuse the same order and terms when retrying. */
|
|
96
|
+
orderId: string;
|
|
97
|
+
title: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
amountCoins: number;
|
|
100
|
+
/** How long to wait, including creating the request. Default 3 minutes. */
|
|
101
|
+
timeoutMs?: number;
|
|
102
|
+
}
|
|
103
|
+
type PaymentStatus = PurchaseStatus | 'pending';
|
|
104
|
+
interface PaymentResult {
|
|
105
|
+
/** `pending` is uncertain: recover with getPayment(orderId), never charge anew. */
|
|
106
|
+
status: PaymentStatus;
|
|
107
|
+
/** Latest authoritative server receipt, when one was received. */
|
|
108
|
+
payment?: PaymentReceipt;
|
|
109
|
+
message?: string;
|
|
110
|
+
}
|
|
111
|
+
interface PaymentPage {
|
|
112
|
+
payments: PaymentReceipt[];
|
|
113
|
+
nextCursor: string | null;
|
|
114
|
+
}
|
|
61
115
|
/**
|
|
62
116
|
* The items this game sells.
|
|
63
117
|
*
|
|
@@ -120,6 +174,32 @@ declare function buy(opts: {
|
|
|
120
174
|
/** How long to wait for the player to decide. Default 3 minutes. */
|
|
121
175
|
timeoutMs?: number;
|
|
122
176
|
}): Promise<PurchaseResult>;
|
|
177
|
+
/**
|
|
178
|
+
* Recover a saved order after a timeout, reload or lost response.
|
|
179
|
+
* Returns null when this player has no such order in this game. A failed read
|
|
180
|
+
* throws: a network failure is not evidence that the order was never paid.
|
|
181
|
+
*/
|
|
182
|
+
declare function getPayment(orderId: string): Promise<PaymentReceipt | null>;
|
|
183
|
+
/**
|
|
184
|
+
* This player's successful payments in this game, newest first.
|
|
185
|
+
* On boot, follow nextCursor until null and reconcile against saved delivered
|
|
186
|
+
* order IDs. A receipt is proof of payment, not automatic delivery of an item.
|
|
187
|
+
*/
|
|
188
|
+
declare function getPayments(opts?: {
|
|
189
|
+
cursor?: string;
|
|
190
|
+
limit?: number;
|
|
191
|
+
}): Promise<PaymentPage>;
|
|
192
|
+
/**
|
|
193
|
+
* Ask the player to approve a dynamic Coin payment. No catalog item required.
|
|
194
|
+
* Call directly from a click or tap, before any await: standalone games reserve
|
|
195
|
+
* the platform popup synchronously. Only Genex can confirm the charge.
|
|
196
|
+
*
|
|
197
|
+
* Save orderId before calling. Repeating the same order and terms returns its
|
|
198
|
+
* existing receipt; changing its terms fails with payment_conflict. Deliver
|
|
199
|
+
* once by orderId only after succeeded. `pending` means getPayment(orderId)
|
|
200
|
+
* must recover the outcome; it never means a fresh order is safe to charge.
|
|
201
|
+
*/
|
|
202
|
+
declare function requestPayment(opts: PaymentOptions): Promise<PaymentResult>;
|
|
123
203
|
|
|
124
204
|
interface GenerateOptions {
|
|
125
205
|
/**
|
|
@@ -402,6 +482,137 @@ declare function judge(options: JudgeOptions): Promise<JudgeResult>;
|
|
|
402
482
|
*/
|
|
403
483
|
declare function generationErrorMessage(code: string | undefined): string;
|
|
404
484
|
|
|
485
|
+
/** How a platform call ended: done, or not done and the one reason why. */
|
|
486
|
+
type PlatformOutcome = {
|
|
487
|
+
ok: true;
|
|
488
|
+
} | {
|
|
489
|
+
ok: false;
|
|
490
|
+
error: PlatformError;
|
|
491
|
+
};
|
|
492
|
+
interface ShareOptions {
|
|
493
|
+
/**
|
|
494
|
+
* A line to go with the link ("Join my room"). The system share sheet shows
|
|
495
|
+
* it; when the link is copied instead, only the link is copied.
|
|
496
|
+
*/
|
|
497
|
+
text?: string;
|
|
498
|
+
/**
|
|
499
|
+
* Your own parameters for the link, e.g. `{ room: 'abc' }`. Whoever opens it
|
|
500
|
+
* reads them back with `getEntry().params`. `embed`, `ref`, `s`, `from`,
|
|
501
|
+
* `remix`, `slug` and every name starting `genex_` are the platform's and
|
|
502
|
+
* are left out.
|
|
503
|
+
*/
|
|
504
|
+
params?: Record<string, string | number | boolean>;
|
|
505
|
+
}
|
|
506
|
+
interface ShareResult {
|
|
507
|
+
/**
|
|
508
|
+
* `shared`: the system share sheet took it. `copied`: no sheet here, the
|
|
509
|
+
* link is on the clipboard. `dismissed`: the player closed the sheet.
|
|
510
|
+
* `unavailable`: neither worked; show `url` so the player can copy it.
|
|
511
|
+
*/
|
|
512
|
+
status: 'shared' | 'copied' | 'dismissed' | 'unavailable';
|
|
513
|
+
/** The link, built by the SDK: the game's page, plus your `params`. */
|
|
514
|
+
url: string;
|
|
515
|
+
}
|
|
516
|
+
type HapticKind = 'selection' | 'light' | 'medium' | 'heavy' | 'success' | 'warning' | 'error';
|
|
517
|
+
/** What supports() can be asked about: one name per function in this module. */
|
|
518
|
+
type PlatformFeature = 'share' | 'copy' | 'awake' | 'haptic' | 'open' | 'save' | 'fullscreen';
|
|
519
|
+
/**
|
|
520
|
+
* Share this game. The link is the SDK's to build, never the caller's: the
|
|
521
|
+
* game's page on Genex (on a creator's own domain, that address), plus your
|
|
522
|
+
* `params`, which come back through `getEntry().params` for whoever opens it.
|
|
523
|
+
*
|
|
524
|
+
* **Call it from a click or tap handler.** It opens the system share sheet
|
|
525
|
+
* where the browser has one; where it has none it copies the link and says
|
|
526
|
+
* `copied`; and when neither works it hands the link back as `unavailable`,
|
|
527
|
+
* for the game to show. An open sheet is waited on for as long as the player
|
|
528
|
+
* keeps it open: no timer ends it. On a dev server (local test mode) the sheet
|
|
529
|
+
* is never opened, so an automated browser is not left waiting on it.
|
|
530
|
+
*
|
|
531
|
+
* ```ts
|
|
532
|
+
* inviteButton.addEventListener('click', async () => {
|
|
533
|
+
* const { status, url } = await share({ text: 'Join my room', params: { room } });
|
|
534
|
+
* if (status === 'copied') toast('Link copied');
|
|
535
|
+
* if (status === 'unavailable') showLink(url);
|
|
536
|
+
* });
|
|
537
|
+
* ```
|
|
538
|
+
*/
|
|
539
|
+
declare function share(options?: ShareOptions): Promise<ShareResult>;
|
|
540
|
+
/**
|
|
541
|
+
* Copy text to the clipboard. **Call it from a click or tap handler.**
|
|
542
|
+
*
|
|
543
|
+
* The Clipboard API first. In a frame it works only where the page around the
|
|
544
|
+
* game delegates it, so its refusal is followed by the older selection copy,
|
|
545
|
+
* which a frame is allowed after a tap either way.
|
|
546
|
+
*/
|
|
547
|
+
declare function copyText(text: string): Promise<PlatformOutcome>;
|
|
548
|
+
/**
|
|
549
|
+
* Keep the screen from dimming and locking (`true`), or stop (`false`): a
|
|
550
|
+
* cutscene, a tilt or gamepad game nobody is touching.
|
|
551
|
+
*
|
|
552
|
+
* The browser drops the lock whenever the tab is hidden; it is taken again
|
|
553
|
+
* when the player comes back, for as long as this is on. In the Genex app the
|
|
554
|
+
* screen already stays on while a game is open, so this resolves `ok` there
|
|
555
|
+
* without asking for anything.
|
|
556
|
+
*/
|
|
557
|
+
declare function keepAwake(on: boolean): Promise<PlatformOutcome>;
|
|
558
|
+
/**
|
|
559
|
+
* A short vibration, by kind. Fire and forget: no result, never throws.
|
|
560
|
+
*
|
|
561
|
+
* It buzzes where the browser can (Android browsers, after the player's first
|
|
562
|
+
* tap). It does nothing on an iPhone, whose browsers have no vibration, and
|
|
563
|
+
* nothing in the Genex app, whose own haptics are not open to games. Use it as
|
|
564
|
+
* a garnish, never as the only signal that something happened.
|
|
565
|
+
*/
|
|
566
|
+
declare function haptic(kind: HapticKind): void;
|
|
567
|
+
/**
|
|
568
|
+
* Open a link in a new tab: a Discord invite, the creator's site, credits.
|
|
569
|
+
* `https://` only, at most 2048 characters. **Call it from a click or tap
|
|
570
|
+
* handler.**
|
|
571
|
+
*
|
|
572
|
+
* On the Genex game page the dashboard asks the player first, showing where
|
|
573
|
+
* the link goes, and opens it on their click there; `dismissed` is their no.
|
|
574
|
+
* On the game's own address it is a new tab. In the Genex app links out of a
|
|
575
|
+
* game are not available (`unsupported`): show the address instead.
|
|
576
|
+
*/
|
|
577
|
+
declare function openExternal(url: string): Promise<PlatformOutcome>;
|
|
578
|
+
/**
|
|
579
|
+
* Save a file to the player's device: a screenshot, a replay, an export.
|
|
580
|
+
* **Call it from a click or tap handler.**
|
|
581
|
+
*
|
|
582
|
+
* The same bounds in every shell, so a save that works on the game's own link
|
|
583
|
+
* works on Genex: at most 50 MB; PNG, JPEG, WebP, WebM, MP4, JSON or plain
|
|
584
|
+
* text (the Blob's `type`); a file name of 1 to 128 characters with no path
|
|
585
|
+
* in it. The saved file's extension follows the type, whatever the name says.
|
|
586
|
+
*
|
|
587
|
+
* On the Genex game page the dashboard asks the player first and saves on
|
|
588
|
+
* their click there. In the Genex app it is not available (`unsupported`).
|
|
589
|
+
*/
|
|
590
|
+
declare function saveFile(file: Blob, name: string): Promise<PlatformOutcome>;
|
|
591
|
+
/**
|
|
592
|
+
* Enter (`true`) or leave (`false`) fullscreen. **Call it from a click or tap
|
|
593
|
+
* handler.**
|
|
594
|
+
*
|
|
595
|
+
* On the Genex game page this is the PAGE's fullscreen, the one its own
|
|
596
|
+
* button gives, so the page's controls stay on top of the game. A game's own
|
|
597
|
+
* `requestFullscreen()` fullscreens only the frame's document, and does
|
|
598
|
+
* nothing at all on a phone whose browser has no element fullscreen. On the
|
|
599
|
+
* game's own address it is the browser's fullscreen. In the Genex app the
|
|
600
|
+
* game already has the whole screen and there is nothing to toggle
|
|
601
|
+
* (`unsupported`).
|
|
602
|
+
*/
|
|
603
|
+
declare function setFullscreen(on: boolean): Promise<PlatformOutcome>;
|
|
604
|
+
/**
|
|
605
|
+
* Whether a function here can do its job in this shell and this browser:
|
|
606
|
+
* `supports('open')` for `openExternal()`, `'save'` for `saveFile()`, `'copy'`
|
|
607
|
+
* for `copyText()`, `'awake'` for `keepAwake()`, and the rest by name.
|
|
608
|
+
* Synchronous, for deciding whether to draw a button at all.
|
|
609
|
+
*
|
|
610
|
+
* On the Genex game page the answer for `open`, `save` and the page's
|
|
611
|
+
* fullscreen arrives with the identity handshake: ask after `waitForPlayer()`.
|
|
612
|
+
* A hint, not a promise. The call's own result is the truth.
|
|
613
|
+
*/
|
|
614
|
+
declare function supports(feature: PlatformFeature): boolean;
|
|
615
|
+
|
|
405
616
|
interface EmbedConfig {
|
|
406
617
|
/** This game's own slug (GENEX.slug) — identifies the project to /play/authorize. */
|
|
407
618
|
slug: string;
|
|
@@ -427,6 +638,39 @@ interface EmbedUser {
|
|
|
427
638
|
}
|
|
428
639
|
type AuthState = 'pending' | 'authenticated' | 'guest' | 'blocked';
|
|
429
640
|
type EmbedEvent = 'authenticated' | 'guest' | 'blocked' | 'error';
|
|
641
|
+
/** The link this page was opened with — see getEntry(). */
|
|
642
|
+
interface EmbedEntry {
|
|
643
|
+
/**
|
|
644
|
+
* The link's own query: `?room=abc&film`, or `''`. The pairs the visitor's
|
|
645
|
+
* link carried, in their order and byte for byte, minus the platform's keys:
|
|
646
|
+
* `embed` and everything starting `genex_`, wherever the game runs. A link
|
|
647
|
+
* to the game's page on Genex, and one opened in the Genex app, also loses
|
|
648
|
+
* `ref`, `s`, `from`, `remix` and `slug`, which Genex reads there itself; on
|
|
649
|
+
* the game's own address those five reach the game.
|
|
650
|
+
*/
|
|
651
|
+
search: string;
|
|
652
|
+
/** The same query, parsed. A fresh object on every call. */
|
|
653
|
+
params: URLSearchParams;
|
|
654
|
+
/**
|
|
655
|
+
* The link's own fragment: `#lobby`, or `''`. A fragment that contains
|
|
656
|
+
* `genex_` is never carried, and on the game's page on Genex neither is
|
|
657
|
+
* `#credits`, which opens Genex's own settings there.
|
|
658
|
+
*/
|
|
659
|
+
hash: string;
|
|
660
|
+
/**
|
|
661
|
+
* The origin of the site the visitor came from (`https://example.com`), or
|
|
662
|
+
* null when there is none or it is not known. Never a path or a query.
|
|
663
|
+
* Attribution data, not a credential: a link can claim any origin.
|
|
664
|
+
*/
|
|
665
|
+
referrer: string | null;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Where the game is running — see getShell(). `page`: in a frame, which is its
|
|
669
|
+
* Genex game page or any other page that embeds it. `app`: the Genex mobile
|
|
670
|
+
* app. `standalone`: its own tab on its own address. `local`: a dev server in
|
|
671
|
+
* local test mode.
|
|
672
|
+
*/
|
|
673
|
+
type EmbedShell = 'page' | 'app' | 'standalone' | 'local';
|
|
430
674
|
interface PlayerStateResult {
|
|
431
675
|
/** The saved blob, or null when this player never saved. For guests: the queued pending save, if any. */
|
|
432
676
|
data: unknown;
|
|
@@ -458,7 +702,8 @@ interface SaveStateResult {
|
|
|
458
702
|
conflict?: boolean;
|
|
459
703
|
/** True when the caller is a guest — accounts save, guests don't. */
|
|
460
704
|
guest?: boolean;
|
|
461
|
-
/** True when
|
|
705
|
+
/** True when a guest's value was held in memory for this page load. It is sent only if an
|
|
706
|
+
* account arrives without a reload, which no Genex shell does today: signing in loads the game again. */
|
|
462
707
|
queued?: boolean;
|
|
463
708
|
/**
|
|
464
709
|
* True when the build is running on the PREVIEW channel (the owner's draft
|
|
@@ -475,7 +720,8 @@ interface SubmitScoreResult {
|
|
|
475
720
|
/** True when this submit improved the player's best. */
|
|
476
721
|
improved?: boolean;
|
|
477
722
|
guest?: boolean;
|
|
478
|
-
/** True when
|
|
723
|
+
/** True when a guest's score was held in memory for this page load. It is sent only if an
|
|
724
|
+
* account arrives without a reload, which no Genex shell does today. */
|
|
479
725
|
queued?: boolean;
|
|
480
726
|
}
|
|
481
727
|
interface LeaderboardEntry {
|
|
@@ -596,6 +842,60 @@ declare function initEmbed(cfg: EmbedConfig): void;
|
|
|
596
842
|
* "is authenticated". True even before the handshake resolves.
|
|
597
843
|
*/
|
|
598
844
|
declare function isEmbedded(): boolean;
|
|
845
|
+
/**
|
|
846
|
+
* The link this page was opened with, and where the visitor came from: the
|
|
847
|
+
* same answer in every shell, whenever it is asked.
|
|
848
|
+
*
|
|
849
|
+
* Read the game's own URL parameters HERE rather than from `location`. On a
|
|
850
|
+
* standalone visit the page first loads with Genex's return fragment in the
|
|
851
|
+
* address bar; initEmbed() puts the game's own fragment back, but that rewrite
|
|
852
|
+
* fires no `hashchange`, so code that read `location.hash` before initEmbed()
|
|
853
|
+
* saw the wrong one and is never told. This is right before and after. And
|
|
854
|
+
* `document.referrer` is the Genex dashboard after the sign-in round trip (and
|
|
855
|
+
* inside the game page); `referrer` here is the site the visitor came from.
|
|
856
|
+
*
|
|
857
|
+
* `referrer` is resolved once per browser tab and kept in the tab's
|
|
858
|
+
* sessionStorage, so a reload answers the same. Where the browser withholds
|
|
859
|
+
* that storage from the game (site data blocked) there is nowhere to keep it,
|
|
860
|
+
* and a reload answers from what that load was handed: `null`, or Genex's own
|
|
861
|
+
* origin, never again the site the visitor first came from. A shell older
|
|
862
|
+
* than this SDK carries less: whatever it did not send is empty or null,
|
|
863
|
+
* never an error.
|
|
864
|
+
*/
|
|
865
|
+
declare function getEntry(): EmbedEntry;
|
|
866
|
+
/**
|
|
867
|
+
* Which shell the game is running in. Synchronous, and safe before
|
|
868
|
+
* initEmbed(): `page` inside a frame (the Genex game page, or any other page
|
|
869
|
+
* that embeds the game), `app` inside the Genex mobile app, `local` on a dev
|
|
870
|
+
* server in local test mode, `standalone` on the game's own address in a
|
|
871
|
+
* browser tab (and anywhere that is not a browser at all).
|
|
872
|
+
*
|
|
873
|
+
* `app` is read off the WebView itself: a top-level page with a
|
|
874
|
+
* `window.ReactNativeWebView` bridge, whether or not the address carries the
|
|
875
|
+
* app's entry marker. The app also opens games on an address without one, and
|
|
876
|
+
* what a game may do in that WebView (no new window, no download, no leaving
|
|
877
|
+
* the game) is the same either way. So the answer is `app` in any React Native
|
|
878
|
+
* WebView, and it can be `app` while the game signs in the way a browser tab
|
|
879
|
+
* does: identity takes the native handshake only on both signals.
|
|
880
|
+
*
|
|
881
|
+
* A fact about the page, not about the player: who is signed in is
|
|
882
|
+
* getAuthState(), and nothing here is a permission.
|
|
883
|
+
*/
|
|
884
|
+
declare function getShell(): EmbedShell;
|
|
885
|
+
/**
|
|
886
|
+
* Run `cb` when the shell is taking the page away: the browser's `pagehide`
|
|
887
|
+
* (the tab closed, reloaded or navigated away) and the mobile app's `cancel`.
|
|
888
|
+
* The moment for a last savePlayerState(). On the browser's `pagehide` a small
|
|
889
|
+
* save still lands (fetch keepalive). The app takes its WebView away a moment
|
|
890
|
+
* after `cancel`, and a save started there is not known to finish first.
|
|
891
|
+
* Called once per closing; a page the browser brings back from its
|
|
892
|
+
* back/forward cache can close again. Returns an unsubscribe function.
|
|
893
|
+
*
|
|
894
|
+
* The last chance to save, not the only one: a phone can drop a backgrounded
|
|
895
|
+
* tab without telling the page, so save as the game goes. `cb` cannot keep the
|
|
896
|
+
* page open and cannot ask the player anything.
|
|
897
|
+
*/
|
|
898
|
+
declare function onShellClosing(cb: () => void): () => void;
|
|
599
899
|
/**
|
|
600
900
|
* Current auth state. Synchronous; starts 'pending', ends 'authenticated',
|
|
601
901
|
* 'guest' (accountless guest play) or 'blocked'. A 'guest' session may still
|
|
@@ -673,8 +973,12 @@ declare function on(event: EmbedEvent, cb: (ctx?: EventContext) => void): () =>
|
|
|
673
973
|
declare function loadPlayerState(): Promise<PlayerStateResult>;
|
|
674
974
|
/**
|
|
675
975
|
* Save THIS player's own slot (any JSON ≤ 256KB; last-write-wins on their own
|
|
676
|
-
* row). Guests:
|
|
677
|
-
*
|
|
976
|
+
* row). Guests: nothing is saved. The value is held in memory for this page
|
|
977
|
+
* load ({ saved: false, guest: true, queued: true }) and flushed only if an
|
|
978
|
+
* account arrives without a reload. No Genex shell does that today (signing in
|
|
979
|
+
* loads the game again), so a game that wants a guest's progress to survive
|
|
980
|
+
* keeps its own copy and starts from it, saving it, when the account loads
|
|
981
|
+
* with no save of its own.
|
|
678
982
|
* On the preview channel: { saved: false, staging: true }, nothing queued
|
|
679
983
|
* (nothing would ever flush it) and no `error` event — keep it in localStorage.
|
|
680
984
|
* Pass { ifVersion } (from the last load/save) to detect same-account
|
|
@@ -710,8 +1014,9 @@ declare function saveWorldState(data: unknown, opts?: {
|
|
|
710
1014
|
* Submit a score (soft-trust leaderboards: identity is verified server-side,
|
|
711
1015
|
* one row per real player per board). Keep-best: only a strictly better score
|
|
712
1016
|
* moves the row — `mode: "min"` for lap-time-style boards (send a consistent
|
|
713
|
-
* mode per board). Guests:
|
|
714
|
-
*
|
|
1017
|
+
* mode per board). Guests: nothing is posted. The BEST value per board is
|
|
1018
|
+
* held in memory for this page load and submitted only if an account arrives
|
|
1019
|
+
* without a reload, which no Genex shell does today.
|
|
715
1020
|
*/
|
|
716
1021
|
declare function submitScore(score: number, opts?: {
|
|
717
1022
|
board?: string;
|
|
@@ -794,7 +1099,8 @@ declare function listEvents<T = unknown>(stream: string, opts?: {
|
|
|
794
1099
|
* @internal — for ./sentry.ts ONLY, not public API (games never call this).
|
|
795
1100
|
* If the URL fragment carries any genex marker (`genex_ticket` — a secret —
|
|
796
1101
|
* or the inert `genex_guest`), move it out of the URL (so no recorder/logger
|
|
797
|
-
* ever sees it) into a stash the standalone flow reads.
|
|
1102
|
+
* ever sees it) into a stash the standalone flow reads. The game's own
|
|
1103
|
+
* fragment, carried inside it, goes back into the URL in the same step.
|
|
798
1104
|
*/
|
|
799
1105
|
declare function _stashTicketFromUrl(): void;
|
|
800
1106
|
declare function __resetForTests(overrides?: {
|
|
@@ -805,6 +1111,8 @@ declare function __resetForTests(overrides?: {
|
|
|
805
1111
|
overlayTextDelayMs?: number;
|
|
806
1112
|
nativeReauthTimeoutMs?: number;
|
|
807
1113
|
heartbeatIntervalMs?: number;
|
|
1114
|
+
platformReplyTimeoutMs?: number;
|
|
1115
|
+
platformConfirmTimeoutMs?: number;
|
|
808
1116
|
}): void;
|
|
809
1117
|
|
|
810
|
-
export { type AppendEventResult, type AuthState, type DeleteSharedResult, type EmbedConfig, type EmbedEvent, type EmbedUser, type Entitlement, type GenerateOptions, type GenerateStreamOptions, type JudgeOptions, type JudgeResult, type Leaderboard, type LeaderboardEntry, type PlayerStateResult, type PurchaseResult, type PurchaseStatus, type PutSharedResult, type RequestWorkflowOptions, RuntimeGenerationBilling, RuntimeGenerationFunding, RuntimeGenerationModels, type RuntimeGenerationResult, RuntimeGenerationView, RuntimeGrantView, RuntimeJudgeAnswer, RuntimeJudgeQuestion, RuntimeJudgmentView, type RuntimeWorkflowAuthorization, RuntimeWorkflowInput, RuntimeWorkflowOfferings, type SaveStateResult, type SharedEventPage, type SharedEventRecord, type SharedObject, type SharedObjectInfo, type SharedPage, type ShopItem, type SpendGrantDisclosure, type SpendGrantOptions, type SpendGrantResult, type SubmitScoreResult, type WorldStateResult, __resetForTests, _stashTicketFromUrl, appendEvent, buy, consumeEntitlement, deleteShared, generate, generateStream, generationErrorMessage, getActiveSpendGrant, getAuthState, getColyseusAuth, getColyseusUrls, getEmbedToken, getEntitlements, getGeneration, getGenerationModels, getLeaderboard, getShared, getShop, getSpendGrant, getUser, getWorkflowOfferings, initEmbed, isEmbedded, judge, listEvents, listShared, loadPlayerState, loadWorldState, on, putShared, requestSpendGrant, requestWorkflow, resumeWorkflow, savePlayerState, saveWorldState, stopSpendGrant, submitScore, waitForAuth, waitForGeneration, waitForPlayer };
|
|
1118
|
+
export { type AppendEventResult, type AuthState, type DeleteSharedResult, type EmbedConfig, type EmbedEntry, type EmbedEvent, type EmbedShell, type EmbedUser, type Entitlement, type GenerateOptions, type GenerateStreamOptions, type HapticKind, type JudgeOptions, type JudgeResult, type Leaderboard, type LeaderboardEntry, type PaymentOptions, type PaymentPage, type PaymentReceipt, type PaymentResult, type PaymentStatus, type PlatformError, type PlatformFeature, type PlatformOutcome, type PlayerStateResult, type PurchaseResult, type PurchaseStatus, type PutSharedResult, type RequestWorkflowOptions, RuntimeGenerationBilling, RuntimeGenerationFunding, RuntimeGenerationModels, type RuntimeGenerationResult, RuntimeGenerationView, RuntimeGrantView, RuntimeJudgeAnswer, RuntimeJudgeQuestion, RuntimeJudgmentView, type RuntimeWorkflowAuthorization, RuntimeWorkflowInput, RuntimeWorkflowOfferings, type SaveStateResult, type ShareOptions, type ShareResult, type SharedEventPage, type SharedEventRecord, type SharedObject, type SharedObjectInfo, type SharedPage, type ShopItem, type SpendGrantDisclosure, type SpendGrantOptions, type SpendGrantResult, type SubmitScoreResult, type WorldStateResult, __resetForTests, _stashTicketFromUrl, appendEvent, buy, consumeEntitlement, copyText, deleteShared, generate, generateStream, generationErrorMessage, getActiveSpendGrant, getAuthState, getColyseusAuth, getColyseusUrls, getEmbedToken, getEntitlements, getEntry, getGeneration, getGenerationModels, getLeaderboard, getPayment, getPayments, getShared, getShell, getShop, getSpendGrant, getUser, getWorkflowOfferings, haptic, initEmbed, isEmbedded, judge, keepAwake, listEvents, listShared, loadPlayerState, loadWorldState, on, onShellClosing, openExternal, putShared, requestPayment, requestSpendGrant, requestWorkflow, resumeWorkflow, saveFile, savePlayerState, saveWorldState, setFullscreen, share, stopSpendGrant, submitScore, supports, waitForAuth, waitForGeneration, waitForPlayer };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
appendEvent,
|
|
5
5
|
buy,
|
|
6
6
|
consumeEntitlement,
|
|
7
|
+
copyText,
|
|
7
8
|
deleteShared,
|
|
8
9
|
generate,
|
|
9
10
|
generateStream,
|
|
@@ -14,41 +15,55 @@ import {
|
|
|
14
15
|
getColyseusUrls,
|
|
15
16
|
getEmbedToken,
|
|
16
17
|
getEntitlements,
|
|
18
|
+
getEntry,
|
|
17
19
|
getGeneration,
|
|
18
20
|
getGenerationModels,
|
|
19
21
|
getLeaderboard,
|
|
22
|
+
getPayment,
|
|
23
|
+
getPayments,
|
|
20
24
|
getShared,
|
|
25
|
+
getShell,
|
|
21
26
|
getShop,
|
|
22
27
|
getSpendGrant,
|
|
23
28
|
getUser,
|
|
24
29
|
getWorkflowOfferings,
|
|
30
|
+
haptic,
|
|
25
31
|
initEmbed,
|
|
26
32
|
isEmbedded,
|
|
27
33
|
judge,
|
|
34
|
+
keepAwake,
|
|
28
35
|
listEvents,
|
|
29
36
|
listShared,
|
|
30
37
|
loadPlayerState,
|
|
31
38
|
loadWorldState,
|
|
32
39
|
on,
|
|
40
|
+
onShellClosing,
|
|
41
|
+
openExternal,
|
|
33
42
|
putShared,
|
|
43
|
+
requestPayment,
|
|
34
44
|
requestSpendGrant,
|
|
35
45
|
requestWorkflow,
|
|
36
46
|
resumeWorkflow,
|
|
47
|
+
saveFile,
|
|
37
48
|
savePlayerState,
|
|
38
49
|
saveWorldState,
|
|
50
|
+
setFullscreen,
|
|
51
|
+
share,
|
|
39
52
|
stopSpendGrant,
|
|
40
53
|
submitScore,
|
|
54
|
+
supports,
|
|
41
55
|
waitForAuth,
|
|
42
56
|
waitForGeneration,
|
|
43
57
|
waitForPlayer
|
|
44
|
-
} from "./chunk-
|
|
45
|
-
import "./chunk-
|
|
58
|
+
} from "./chunk-NI554TIV.js";
|
|
59
|
+
import "./chunk-QBCWKMVQ.js";
|
|
46
60
|
export {
|
|
47
61
|
__resetForTests,
|
|
48
62
|
_stashTicketFromUrl,
|
|
49
63
|
appendEvent,
|
|
50
64
|
buy,
|
|
51
65
|
consumeEntitlement,
|
|
66
|
+
copyText,
|
|
52
67
|
deleteShared,
|
|
53
68
|
generate,
|
|
54
69
|
generateStream,
|
|
@@ -59,30 +74,43 @@ export {
|
|
|
59
74
|
getColyseusUrls,
|
|
60
75
|
getEmbedToken,
|
|
61
76
|
getEntitlements,
|
|
77
|
+
getEntry,
|
|
62
78
|
getGeneration,
|
|
63
79
|
getGenerationModels,
|
|
64
80
|
getLeaderboard,
|
|
81
|
+
getPayment,
|
|
82
|
+
getPayments,
|
|
65
83
|
getShared,
|
|
84
|
+
getShell,
|
|
66
85
|
getShop,
|
|
67
86
|
getSpendGrant,
|
|
68
87
|
getUser,
|
|
69
88
|
getWorkflowOfferings,
|
|
89
|
+
haptic,
|
|
70
90
|
initEmbed,
|
|
71
91
|
isEmbedded,
|
|
72
92
|
judge,
|
|
93
|
+
keepAwake,
|
|
73
94
|
listEvents,
|
|
74
95
|
listShared,
|
|
75
96
|
loadPlayerState,
|
|
76
97
|
loadWorldState,
|
|
77
98
|
on,
|
|
99
|
+
onShellClosing,
|
|
100
|
+
openExternal,
|
|
78
101
|
putShared,
|
|
102
|
+
requestPayment,
|
|
79
103
|
requestSpendGrant,
|
|
80
104
|
requestWorkflow,
|
|
81
105
|
resumeWorkflow,
|
|
106
|
+
saveFile,
|
|
82
107
|
savePlayerState,
|
|
83
108
|
saveWorldState,
|
|
109
|
+
setFullscreen,
|
|
110
|
+
share,
|
|
84
111
|
stopSpendGrant,
|
|
85
112
|
submitScore,
|
|
113
|
+
supports,
|
|
86
114
|
waitForAuth,
|
|
87
115
|
waitForGeneration,
|
|
88
116
|
waitForPlayer
|
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
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Player identity + durable game state for genex games \u2014 signed-in or guest play, per-player save slots, shared world state, soft-trust leaderboards, and shared collections and event streams.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|