@hadoku/prefs-client 1.1.19 → 1.1.21

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/cosmetics.js CHANGED
@@ -6,7 +6,7 @@ var archived = { hidden: true };
6
6
  var COSMETICS = [
7
7
  item("effect", "glint", "Glint"),
8
8
  item("effect", "aura", "Aura"),
9
- item("effect", "hop", "Hop"),
9
+ item("effect", "hop", "Hop", archived),
10
10
  item("effect", "outline", "Outline"),
11
11
  item("effect", "twinkle", "Twinkle", { earn: "Bronze or better in a Major" }),
12
12
  item("gradient", "gild", "Gilded"),
package/dist/index.d.ts CHANGED
@@ -82,6 +82,13 @@ interface WhoamiResult {
82
82
  * 'anon' means the key is shared with every other browser user.
83
83
  */
84
84
  scope: IdentityScope;
85
+ /**
86
+ * The operator vouches for this person (the edge's `isVouched`, the same
87
+ * answer as the `X-Hadoku-Vouched` header): every tier above member, and a
88
+ * member the operator made or vouched for. Present only as `true`; absent
89
+ * means not vouched, as the header's absence does.
90
+ */
91
+ vouched?: true;
85
92
  }
86
93
  interface WhoamiOpts {
87
94
  /** Override the base URL for testing. Default: edge-router origin. */
package/dist/index.js CHANGED
@@ -116,18 +116,20 @@ function adaptWhoami(body) {
116
116
  }
117
117
  const userType = body.userType === "admin" || body.userType === "wife" || body.userType === "service" || body.userType === "friend" || body.userType === "member" || body.userType === "public" ? body.userType : "public";
118
118
  const name = typeof body.name === "string" ? body.name : null;
119
+ const vouched = body.vouched === true ? { vouched: true } : {};
119
120
  if (typeof body.userId === "string" && body.userId) {
120
- return { userId: body.userId, userType, name, scope: "user" };
121
+ return { userId: body.userId, userType, name, scope: "user", ...vouched };
121
122
  }
122
123
  if (typeof body.sessionId === "string" && body.sessionId) {
123
124
  return {
124
125
  userId: `${SESSION_SCOPE_PREFIX}${body.sessionId}`,
125
126
  userType,
126
127
  name,
127
- scope: "session"
128
+ scope: "session",
129
+ ...vouched
128
130
  };
129
131
  }
130
- return { userId: UNSCOPED_ID, userType, name, scope: "none" };
132
+ return { userId: UNSCOPED_ID, userType, name, scope: "none", ...vouched };
131
133
  }
132
134
  async function fetchWhoamiRaw(url, userKey) {
133
135
  const headers = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/prefs-client",
3
- "version": "1.1.19",
4
- "gitHead": "7a6d244048846eb0251c27c223d732aae2abde61",
3
+ "version": "1.1.21",
4
+ "gitHead": "9ec40665c66d6d0dbeb95a2c9e1561aaccb300b8",
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",