@tesana/sdk 1.3.2 → 1.3.3
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/tesana.esm.js +21 -3
- package/dist/tesana.iife.js +22 -4
- package/package.json +1 -1
- package/src/tesana.js +21 -3
package/dist/tesana.esm.js
CHANGED
|
@@ -56,7 +56,11 @@
|
|
|
56
56
|
// refusal; if that fails, the held URL is offered once per drop (TES-2763), and
|
|
57
57
|
// a re-join that answers after the player left or moved rooms is dropped
|
|
58
58
|
// (TES-2764).
|
|
59
|
-
|
|
59
|
+
//
|
|
60
|
+
// 1.3.3 (TES-314, DEC-126): an offline build that was never given an endpoint
|
|
61
|
+
// (a desktop export with no play session) makes no play-service calls: its
|
|
62
|
+
// base would only be the page's own origin, the wrapper's loopback server.
|
|
63
|
+
const VERSION = "1.3.3";
|
|
60
64
|
|
|
61
65
|
const LOCAL_CACHE = "tesana.play.v1";
|
|
62
66
|
|
|
@@ -1997,7 +2001,8 @@ function mergedConfig() {
|
|
|
1997
2001
|
|
|
1998
2002
|
/** Turn a raw bootstrap + game config into the client's constructor options. */
|
|
1999
2003
|
function buildConfig(merged) {
|
|
2000
|
-
const
|
|
2004
|
+
const given = merged.endpoint || merged.apiBase || "";
|
|
2005
|
+
const endpoint = String(given || defaultEndpoint()).replace(/\/$/, "");
|
|
2001
2006
|
// Keep the type the host sent: a Tesana page posts a number, a room build
|
|
2002
2007
|
// bakes a string, and `tesana.gameId` is public surface a game may compare
|
|
2003
2008
|
// against. Only trim, never coerce.
|
|
@@ -2005,6 +2010,9 @@ function buildConfig(merged) {
|
|
|
2005
2010
|
const gameId = typeof rawGameId === "string" ? rawGameId.trim() : rawGameId;
|
|
2006
2011
|
return {
|
|
2007
2012
|
endpoint,
|
|
2013
|
+
// Whether anyone named a play service, rather than the page's own origin
|
|
2014
|
+
// standing in for one. See `_canReach`.
|
|
2015
|
+
endpointGiven: Boolean(given || (typeof window !== "undefined" && window.__TESANA__?.endpoint)),
|
|
2008
2016
|
gameId,
|
|
2009
2017
|
// The site hands this as `token`; the room build/server splice it as
|
|
2010
2018
|
// `playerToken`. Either way it is the play service's player token, and it
|
|
@@ -2075,6 +2083,8 @@ class TesanaClient {
|
|
|
2075
2083
|
*/
|
|
2076
2084
|
constructor(opts) {
|
|
2077
2085
|
this.endpoint = opts.endpoint;
|
|
2086
|
+
// Absent means a caller that predates the flag: it named its endpoint.
|
|
2087
|
+
this.endpointGiven = opts.endpointGiven !== false;
|
|
2078
2088
|
this.gameId = opts.gameId;
|
|
2079
2089
|
this.token = opts.token;
|
|
2080
2090
|
this.rail = opts.rail;
|
|
@@ -3078,6 +3088,7 @@ class TesanaClient {
|
|
|
3078
3088
|
*/
|
|
3079
3089
|
configure(config) {
|
|
3080
3090
|
this.endpoint = String(config.endpoint || "").replace(/\/$/, "");
|
|
3091
|
+
this.endpointGiven = config.endpointGiven !== false;
|
|
3081
3092
|
this.gameId = config.gameId ?? "";
|
|
3082
3093
|
this.token = config.token || "";
|
|
3083
3094
|
this.saveEndpoint = String(config.saveEndpoint || "").replace(/\/$/, "");
|
|
@@ -3181,6 +3192,13 @@ class TesanaClient {
|
|
|
3181
3192
|
* of taking the menu down with it.
|
|
3182
3193
|
*/
|
|
3183
3194
|
_canReach() {
|
|
3195
|
+
// An offline page that was never given an endpoint has no play service:
|
|
3196
|
+
// its base is only `location.origin` standing in. A desktop export with no
|
|
3197
|
+
// play session is exactly this (gameId baked, `offline: true`, no
|
|
3198
|
+
// endpoint), and its origin is the wrapper's loopback file server, so a
|
|
3199
|
+
// call there is a 404 on every launch. The boot contract: no endpoint, no
|
|
3200
|
+
// network (docs/deploy-play-services.md).
|
|
3201
|
+
if (this.offline && !this.endpointGiven) return false;
|
|
3184
3202
|
return Boolean(this._baseFor() && this.gameId);
|
|
3185
3203
|
}
|
|
3186
3204
|
|
|
@@ -3937,7 +3955,7 @@ class TesanaClient {
|
|
|
3937
3955
|
|
|
3938
3956
|
/** Whether a report has somewhere to go. A token is not needed; a game is. */
|
|
3939
3957
|
_feedbackReachable() {
|
|
3940
|
-
return
|
|
3958
|
+
return this._canReach();
|
|
3941
3959
|
}
|
|
3942
3960
|
|
|
3943
3961
|
/**
|
package/dist/tesana.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Tesana play-time SDK v1.3.
|
|
1
|
+
/* Tesana play-time SDK v1.3.3 */
|
|
2
2
|
(function (root) {
|
|
3
3
|
/**
|
|
4
4
|
* Tesana play-time SDK. Vanilla JS, no npm in games.
|
|
@@ -58,7 +58,11 @@
|
|
|
58
58
|
// refusal; if that fails, the held URL is offered once per drop (TES-2763), and
|
|
59
59
|
// a re-join that answers after the player left or moved rooms is dropped
|
|
60
60
|
// (TES-2764).
|
|
61
|
-
|
|
61
|
+
//
|
|
62
|
+
// 1.3.3 (TES-314, DEC-126): an offline build that was never given an endpoint
|
|
63
|
+
// (a desktop export with no play session) makes no play-service calls: its
|
|
64
|
+
// base would only be the page's own origin, the wrapper's loopback server.
|
|
65
|
+
const VERSION = "1.3.3";
|
|
62
66
|
|
|
63
67
|
const LOCAL_CACHE = "tesana.play.v1";
|
|
64
68
|
|
|
@@ -1999,7 +2003,8 @@ function mergedConfig() {
|
|
|
1999
2003
|
|
|
2000
2004
|
/** Turn a raw bootstrap + game config into the client's constructor options. */
|
|
2001
2005
|
function buildConfig(merged) {
|
|
2002
|
-
const
|
|
2006
|
+
const given = merged.endpoint || merged.apiBase || "";
|
|
2007
|
+
const endpoint = String(given || defaultEndpoint()).replace(/\/$/, "");
|
|
2003
2008
|
// Keep the type the host sent: a Tesana page posts a number, a room build
|
|
2004
2009
|
// bakes a string, and `tesana.gameId` is public surface a game may compare
|
|
2005
2010
|
// against. Only trim, never coerce.
|
|
@@ -2007,6 +2012,9 @@ function buildConfig(merged) {
|
|
|
2007
2012
|
const gameId = typeof rawGameId === "string" ? rawGameId.trim() : rawGameId;
|
|
2008
2013
|
return {
|
|
2009
2014
|
endpoint,
|
|
2015
|
+
// Whether anyone named a play service, rather than the page's own origin
|
|
2016
|
+
// standing in for one. See `_canReach`.
|
|
2017
|
+
endpointGiven: Boolean(given || (typeof window !== "undefined" && window.__TESANA__?.endpoint)),
|
|
2010
2018
|
gameId,
|
|
2011
2019
|
// The site hands this as `token`; the room build/server splice it as
|
|
2012
2020
|
// `playerToken`. Either way it is the play service's player token, and it
|
|
@@ -2077,6 +2085,8 @@ class TesanaClient {
|
|
|
2077
2085
|
*/
|
|
2078
2086
|
constructor(opts) {
|
|
2079
2087
|
this.endpoint = opts.endpoint;
|
|
2088
|
+
// Absent means a caller that predates the flag: it named its endpoint.
|
|
2089
|
+
this.endpointGiven = opts.endpointGiven !== false;
|
|
2080
2090
|
this.gameId = opts.gameId;
|
|
2081
2091
|
this.token = opts.token;
|
|
2082
2092
|
this.rail = opts.rail;
|
|
@@ -3080,6 +3090,7 @@ class TesanaClient {
|
|
|
3080
3090
|
*/
|
|
3081
3091
|
configure(config) {
|
|
3082
3092
|
this.endpoint = String(config.endpoint || "").replace(/\/$/, "");
|
|
3093
|
+
this.endpointGiven = config.endpointGiven !== false;
|
|
3083
3094
|
this.gameId = config.gameId ?? "";
|
|
3084
3095
|
this.token = config.token || "";
|
|
3085
3096
|
this.saveEndpoint = String(config.saveEndpoint || "").replace(/\/$/, "");
|
|
@@ -3183,6 +3194,13 @@ class TesanaClient {
|
|
|
3183
3194
|
* of taking the menu down with it.
|
|
3184
3195
|
*/
|
|
3185
3196
|
_canReach() {
|
|
3197
|
+
// An offline page that was never given an endpoint has no play service:
|
|
3198
|
+
// its base is only `location.origin` standing in. A desktop export with no
|
|
3199
|
+
// play session is exactly this (gameId baked, `offline: true`, no
|
|
3200
|
+
// endpoint), and its origin is the wrapper's loopback file server, so a
|
|
3201
|
+
// call there is a 404 on every launch. The boot contract: no endpoint, no
|
|
3202
|
+
// network (docs/deploy-play-services.md).
|
|
3203
|
+
if (this.offline && !this.endpointGiven) return false;
|
|
3186
3204
|
return Boolean(this._baseFor() && this.gameId);
|
|
3187
3205
|
}
|
|
3188
3206
|
|
|
@@ -3939,7 +3957,7 @@ class TesanaClient {
|
|
|
3939
3957
|
|
|
3940
3958
|
/** Whether a report has somewhere to go. A token is not needed; a game is. */
|
|
3941
3959
|
_feedbackReachable() {
|
|
3942
|
-
return
|
|
3960
|
+
return this._canReach();
|
|
3943
3961
|
}
|
|
3944
3962
|
|
|
3945
3963
|
/**
|
package/package.json
CHANGED
package/src/tesana.js
CHANGED
|
@@ -56,7 +56,11 @@
|
|
|
56
56
|
// refusal; if that fails, the held URL is offered once per drop (TES-2763), and
|
|
57
57
|
// a re-join that answers after the player left or moved rooms is dropped
|
|
58
58
|
// (TES-2764).
|
|
59
|
-
|
|
59
|
+
//
|
|
60
|
+
// 1.3.3 (TES-314, DEC-126): an offline build that was never given an endpoint
|
|
61
|
+
// (a desktop export with no play session) makes no play-service calls: its
|
|
62
|
+
// base would only be the page's own origin, the wrapper's loopback server.
|
|
63
|
+
const VERSION = "1.3.3";
|
|
60
64
|
|
|
61
65
|
const LOCAL_CACHE = "tesana.play.v1";
|
|
62
66
|
|
|
@@ -1997,7 +2001,8 @@ function mergedConfig() {
|
|
|
1997
2001
|
|
|
1998
2002
|
/** Turn a raw bootstrap + game config into the client's constructor options. */
|
|
1999
2003
|
function buildConfig(merged) {
|
|
2000
|
-
const
|
|
2004
|
+
const given = merged.endpoint || merged.apiBase || "";
|
|
2005
|
+
const endpoint = String(given || defaultEndpoint()).replace(/\/$/, "");
|
|
2001
2006
|
// Keep the type the host sent: a Tesana page posts a number, a room build
|
|
2002
2007
|
// bakes a string, and `tesana.gameId` is public surface a game may compare
|
|
2003
2008
|
// against. Only trim, never coerce.
|
|
@@ -2005,6 +2010,9 @@ function buildConfig(merged) {
|
|
|
2005
2010
|
const gameId = typeof rawGameId === "string" ? rawGameId.trim() : rawGameId;
|
|
2006
2011
|
return {
|
|
2007
2012
|
endpoint,
|
|
2013
|
+
// Whether anyone named a play service, rather than the page's own origin
|
|
2014
|
+
// standing in for one. See `_canReach`.
|
|
2015
|
+
endpointGiven: Boolean(given || (typeof window !== "undefined" && window.__TESANA__?.endpoint)),
|
|
2008
2016
|
gameId,
|
|
2009
2017
|
// The site hands this as `token`; the room build/server splice it as
|
|
2010
2018
|
// `playerToken`. Either way it is the play service's player token, and it
|
|
@@ -2075,6 +2083,8 @@ class TesanaClient {
|
|
|
2075
2083
|
*/
|
|
2076
2084
|
constructor(opts) {
|
|
2077
2085
|
this.endpoint = opts.endpoint;
|
|
2086
|
+
// Absent means a caller that predates the flag: it named its endpoint.
|
|
2087
|
+
this.endpointGiven = opts.endpointGiven !== false;
|
|
2078
2088
|
this.gameId = opts.gameId;
|
|
2079
2089
|
this.token = opts.token;
|
|
2080
2090
|
this.rail = opts.rail;
|
|
@@ -3078,6 +3088,7 @@ class TesanaClient {
|
|
|
3078
3088
|
*/
|
|
3079
3089
|
configure(config) {
|
|
3080
3090
|
this.endpoint = String(config.endpoint || "").replace(/\/$/, "");
|
|
3091
|
+
this.endpointGiven = config.endpointGiven !== false;
|
|
3081
3092
|
this.gameId = config.gameId ?? "";
|
|
3082
3093
|
this.token = config.token || "";
|
|
3083
3094
|
this.saveEndpoint = String(config.saveEndpoint || "").replace(/\/$/, "");
|
|
@@ -3181,6 +3192,13 @@ class TesanaClient {
|
|
|
3181
3192
|
* of taking the menu down with it.
|
|
3182
3193
|
*/
|
|
3183
3194
|
_canReach() {
|
|
3195
|
+
// An offline page that was never given an endpoint has no play service:
|
|
3196
|
+
// its base is only `location.origin` standing in. A desktop export with no
|
|
3197
|
+
// play session is exactly this (gameId baked, `offline: true`, no
|
|
3198
|
+
// endpoint), and its origin is the wrapper's loopback file server, so a
|
|
3199
|
+
// call there is a 404 on every launch. The boot contract: no endpoint, no
|
|
3200
|
+
// network (docs/deploy-play-services.md).
|
|
3201
|
+
if (this.offline && !this.endpointGiven) return false;
|
|
3184
3202
|
return Boolean(this._baseFor() && this.gameId);
|
|
3185
3203
|
}
|
|
3186
3204
|
|
|
@@ -3937,7 +3955,7 @@ class TesanaClient {
|
|
|
3937
3955
|
|
|
3938
3956
|
/** Whether a report has somewhere to go. A token is not needed; a game is. */
|
|
3939
3957
|
_feedbackReachable() {
|
|
3940
|
-
return
|
|
3958
|
+
return this._canReach();
|
|
3941
3959
|
}
|
|
3942
3960
|
|
|
3943
3961
|
/**
|