@hadoku/prefs-client 1.1.29 → 1.1.31

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/index.d.ts CHANGED
@@ -84,12 +84,11 @@ interface WhoamiResult {
84
84
  */
85
85
  scope: IdentityScope;
86
86
  /**
87
- * The operator verifies this person (the edge's `isVerified`, the same
88
- * answer as the `X-Hadoku-Verified` header): every tier above member, and a
89
- * member the operator made or verified. Present only as `true`; absent
90
- * means not verified, as the header's absence does.
87
+ * This browser is a TV (the edge's `isTvUserAgent`, on every answer, signed
88
+ * in or not): an app may start in its 10-foot layout. Present only as
89
+ * `true`.
91
90
  */
92
- verified?: true;
91
+ tv?: true;
93
92
  }
94
93
  interface WhoamiOpts {
95
94
  /** Override the base URL for testing. Default: edge-router origin. */
package/dist/index.js CHANGED
@@ -125,14 +125,14 @@ var WHOAMI_GLOBAL = "__hadokuWhoami";
125
125
  var SESSION_SCOPE_PREFIX = "sess:";
126
126
  var UNSCOPED_ID = "unscoped";
127
127
  function adaptWhoami(body) {
128
+ const tv = body?.tv === true ? { tv: true } : {};
128
129
  if (!body || body.valid === false) {
129
- return { userId: ANON_USER_ID, userType: "public", scope: "anon" };
130
+ return { userId: ANON_USER_ID, userType: "public", scope: "anon", ...tv };
130
131
  }
131
132
  const userType = body.userType === "admin" || body.userType === "wife" || body.userType === "service" || body.userType === "friend" || body.userType === "member" || body.userType === "guest" || body.userType === "public" ? body.userType : "public";
132
133
  const name = typeof body.name === "string" ? body.name : null;
133
- const verified = body.verified === true ? { verified: true } : {};
134
134
  if (typeof body.userId === "string" && body.userId) {
135
- return { userId: body.userId, userType, name, scope: "user", ...verified };
135
+ return { userId: body.userId, userType, name, scope: "user", ...tv };
136
136
  }
137
137
  if (typeof body.sessionId === "string" && body.sessionId) {
138
138
  return {
@@ -140,10 +140,10 @@ function adaptWhoami(body) {
140
140
  userType,
141
141
  name,
142
142
  scope: "session",
143
- ...verified
143
+ ...tv
144
144
  };
145
145
  }
146
- return { userId: UNSCOPED_ID, userType, name, scope: "none", ...verified };
146
+ return { userId: UNSCOPED_ID, userType, name, scope: "none", ...tv };
147
147
  }
148
148
  var WHOAMI_TIMEOUT_MS = 3e3;
149
149
  async function fetchWhoamiRaw(url, userKey) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/prefs-client",
3
- "version": "1.1.29",
4
- "gitHead": "1a8adf4b1717bfa1bb9a18d7680d0fc7db2d7a5b",
3
+ "version": "1.1.31",
4
+ "gitHead": "04fd486bdf484dd5655e0bb12fd21071b8e68607",
5
5
  "description": "Client SDK for the hadoku unified preferences store. Wraps /prefs/api/v1/* with localStorage caching, debounced writes, Zod-validated reads, and a usePrefs() React hook, plus match history, ratings and leaderboards for every game (./games), the one resolved avatar per user (./avatar), and the avatar cosmetics renderer (./cosmetics).",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",