pleasenobugs 0.4.0 → 0.5.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 CHANGED
@@ -22,9 +22,12 @@ wallet by itself; everywhere else it reads, and your app can hand it a signer.
22
22
  Each opens on the tiles (bug, idea, review), with the board one tap under
23
23
  them. `start="board"` opens on the board instead.
24
24
 
25
- `floating` and `overlay` cover the whole screen on a phone. From 640 pixels
26
- wide they are a panel in the bottom-right corner instead, 375 wide and up to
27
- 640 tall, over a dimmed page; a click beside it or Escape closes it.
25
+ `floating` and `overlay` are a sheet from the bottom on a phone: nearly the
26
+ whole screen, with a strip of your app still in view above it, dimmed
27
+ (`--pnb-sheet-top`). A tap on that strip, a swipe down on the sheet's top or
28
+ its X closes it. From 640 pixels wide they are a panel in the bottom-right
29
+ corner instead, 375 wide and up to 640 tall, over a dimmed page; a click
30
+ beside it or Escape closes it.
28
31
 
29
32
  From a button of your own:
30
33
 
@@ -39,16 +42,17 @@ menuItem.onclick = () => open({ project: 'YOUR_PROJECT_ID', server: 'https://YOU
39
42
  |---|---|
40
43
  | `project`, `server` | Required. |
41
44
  | `mode` | `inline`, `floating` or `overlay`. |
42
- | `start` | `tiles` (default) or `board`: what opens first. A `readonly` board is always the board. |
43
- | `theme` | `nimiq` (default): the Nimiq Foundation's 2026 brand, navy on white with a gold round button. `nimiq-dark`: the same on navy. |
45
+ | `start` | `tiles` (default) or `board`: what opens first. A `readonly` board is always the board, and so is the board for somebody not signed in outside Nimiq Pay: they read first, and **Send feedback** (or a vote) asks them to sign in, in a sheet, before the tiles. |
46
+ | `theme` | `light` (default): minimal, white with near-black words and buttons. `dark`: the same on near-black. `pleasenobugs`: dark purple with raised turquoise buttons. `nimiq`: the Nimiq Foundation's 2026 brand, navy on white with a gold round button. `nimiq-dark`: the same on navy. |
44
47
  | `lang` | The language of your `strings`, so dates follow it: `nl` writes "14 sep". English by default. |
45
48
  | `app-name` | What answers are signed with ("My app says"). Defaults to the project's name. |
46
- | `name` | A display name you already know, filled in for a user who has not chosen one on this board yet. |
49
+ | `name` | A display name you already know, filled in when a user who has not chosen one on this board is asked for one on their first post. |
50
+ | `logo` | The image before the board's title. PleaseNoBugs' own little bug when absent; a URL for your app's own logo (about 22px high is how it shows); `none` for no logo. |
47
51
  | `kinds` | Which kinds to offer, of the ones your project takes: `bug,idea,review` by default. `kinds="bug,idea"` leaves reviews off the tiles and out of the list. |
48
52
  | `screenshots` | Who sees screenshots on bugs and ideas. On the board for everyone by default, each one only after its author ticks that everyone may see it. `owners` keeps them for your eyes only; `off` leaves the "Add a screenshot" button out. An unknown value counts as `owners`. The project's own rule (`PNB_PROJECT_SCREENSHOTS` on the server) wins when it is stricter. |
49
- | `names` | `off` leaves out the name field and the "Post anonymously" switch: every post is anonymous, with no name and no identicon. |
50
- | `readonly` | The board to read and scroll through, nothing else: no **+**, no votes (the count still shows), no "Sign in", and it never asks a wallet or sends a proof, not even inside Nimiq Pay. Every post shows as anonymous and without its screenshot, whatever its author chose, because a read-only board is usually shown somewhere other than the app its authors wrote for. |
51
- | `demo` | A board of sample posts in the page's memory, with no server: `<please-no-bugs demo>`. Voting and writing work, nothing is sent or stored, and a reload starts over. For trying the widget, or showing it off. `demo="owner"` is the same board as its owner sees it: answer, set a status and "Fixed in", write updates. |
53
+ | `names` | `off` leaves the name and "Post anonymously" out of Settings and never asks for a name: every post is anonymous, with no name and no identicon. |
54
+ | `readonly` | The board to read and scroll through, nothing else: no **Send feedback**, no votes (the count still shows), no "Sign in", and it never asks a wallet or sends a proof, not even inside Nimiq Pay. Every post shows as anonymous and without its screenshot, whatever its author chose, because a read-only board is usually shown somewhere other than the app its authors wrote for. |
55
+ | `demo` | A board of sample posts in the page's memory, with no server: `<please-no-bugs demo>`. Voting and writing work, nothing is sent or stored, and a reload starts over. For trying the widget, or showing it off. `demo="owner"` is the same board as its owner sees it: answer, set a status and "Fixed in", write updates. With a `server`, a demo still keeps its posts in the page and asks that server only for the identicons. |
52
56
  | `screen` | With `demo` only: hold one screen in view, `button`, `tiles`, `board`, `write`, `sent` or `updates`. What the website's Make it yours uses to show each part. |
53
57
 
54
58
  | Property | |
@@ -64,14 +68,19 @@ Events: `pleasenobugs:posted` (`detail: { id, kind }`) and `pleasenobugs:close`.
64
68
 
65
69
  ## What your users see
66
70
 
67
- Tapping **+** opens three tiles: **Report a bug**, **Share an idea** and
71
+ Tapping **Send feedback**, at the foot of the board, opens three tiles: **Report a bug**, **Share an idea** and
68
72
  **Write a review**. A review is one to five stars and a few words, shown on the
69
73
  board with the average on top, so people can see what others like about your
70
74
  app. One review per wallet.
71
75
 
72
- A post goes out with **the user's wallet identicon and a name** they fill in
73
- once per board, never their address. Changing the name changes it on their
74
- earlier posts too. **"Post anonymously"** leaves both off. The identicon is
76
+ A post goes out with **the user's wallet identicon and a name**, never their
77
+ whole address. The name is asked for once, as their first post goes up, and
78
+ changed any time in **Settings**, behind their identicon in the top right;
79
+ changing it changes it on their earlier posts too. Without a name, others see
80
+ the address cut short (`NQ12 … AB34`). **"Post anonymously"**, also in
81
+ Settings, leaves name and identicon off every post. Outside Nimiq Pay,
82
+ Settings also has **Log out**. Top or Newest is chosen in the **Filter**
83
+ panel, with the kind and the status. The identicon is
75
84
  drawn by your PleaseNoBugs server (`/v1/identicons/…`), like screenshots, so
76
85
  the page needs that server in its `img-src`.
77
86
 
@@ -124,32 +133,33 @@ authors get the note. Until you write the first one, only you see the button.
124
133
 
125
134
  The widget lives in a shadow root, so your CSS cannot break it. These custom
126
135
  properties cross that boundary on purpose and are the theming API. The
127
- defaults below are the `nimiq` look; `nimiq-dark` sets the colours again on
128
- navy:
136
+ defaults below are the `light` look; `dark`, `pleasenobugs`, `nimiq` and
137
+ `nimiq-dark` set the colours again:
129
138
 
130
139
  ```css
131
140
  please-no-bugs {
132
- --pnb-bg: #ffffff; /* the page */
133
- --pnb-surface: #fafaf8; /* a card */
134
- --pnb-surface-2: #f2f3f4; /* a chip or field inside a card */
135
- --pnb-sunken: #f2f3f4; /* the Top/New trough */
136
- --pnb-line: #e6e6e9;
137
- --pnb-text: #040724;
138
- --pnb-text-quiet: #686a7c;
139
- --pnb-accent: #040724;
140
- --pnb-on-accent: #ffffff;
141
- --pnb-danger: #cb0015;
142
- --pnb-bug: #cb0015; --pnb-idea: #ffb700; --pnb-review: #4f5166;
143
- --pnb-planned: #ffc758; --pnb-done: #040724; --pnb-declined: #9b9ca7;
144
- --pnb-on-dot: #ffffff; /* the glyph on a chip's dot; or per kind and status: */
141
+ --pnb-bg: #fff; /* the page */
142
+ --pnb-surface: #f4f4f5; /* a card */
143
+ --pnb-surface-2: #ececee; /* a chip or field inside a card */
144
+ --pnb-sunken: #ececee; /* the Top/New trough */
145
+ --pnb-line: #e4e4e7;
146
+ --pnb-text: #111;
147
+ --pnb-text-quiet: #6b6b72;
148
+ --pnb-accent: #111;
149
+ --pnb-accent-fill: var(--pnb-accent); /* what buttons are painted with; may be a gradient */
150
+ --pnb-on-accent: #fff;
151
+ --pnb-danger: #d23b2f;
152
+ --pnb-bug: #e5484d; --pnb-idea: #8b5cf6; --pnb-review: #e9a00b;
153
+ --pnb-planned: #8a8fb8; --pnb-done: #21bca5; --pnb-declined: #8a8fb8;
154
+ --pnb-on-dot: #fff; /* the glyph on a chip's dot; or per kind and status: */
145
155
  --pnb-on-bug: var(--pnb-on-dot); /* --pnb-on-idea, -review, -planned, -done, -declined */
146
- --pnb-star: #ffb700;
147
- --pnb-filter: var(--pnb-text); /* the chosen filter, and the chosen status in your answer sheet */
148
- --pnb-on-filter: var(--pnb-bg); /* its words: set both, as they are not picked for you */
156
+ --pnb-star: #f5a524;
157
+ --pnb-filter: color-mix(in srgb, var(--pnb-text) 16%, var(--pnb-bg)); /* the chosen filter, and the chosen status in your answer sheet: a state, so grey, not the button black */
158
+ --pnb-on-filter: var(--pnb-text); /* and its words */
149
159
  --pnb-tile-bug: var(--pnb-bug); /* the three tiles; may be gradients */
150
160
  --pnb-tile-idea: var(--pnb-idea);
151
161
  --pnb-tile-review: var(--pnb-review);
152
- --pnb-tile-ink: #ffffff; /* the words on them */
162
+ --pnb-tile-ink: #fff; /* the words on them */
153
163
  --pnb-tile-ink-bug: var(--pnb-tile-ink); /* the words on one tile (-idea, -review too) */
154
164
  --pnb-tile-dot-bug: transparent; /* a disc behind each tile's glyph (-idea, -review too) */
155
165
  --pnb-tile-glyph-bug: var(--pnb-tile-ink-bug); /* and the glyph's colour (-idea, -review too) */
@@ -157,25 +167,24 @@ please-no-bugs {
157
167
  --pnb-choose-title: var(--pnb-text); /* the question above the tiles */
158
168
  --pnb-title-board: var(--pnb-text); /* the title in the board's bar */
159
169
  --pnb-title-write: var(--pnb-text); /* the title above the form */
160
- --pnb-card: #ffffff; /* the posts and the rating on the board, */
170
+ --pnb-card: #fff; /* the posts and the rating on the board, */
161
171
  --pnb-card-text: var(--pnb-text); /* their words, */
162
172
  --pnb-card-quiet: var(--pnb-text-quiet); /* and their names, dates and counts */
163
- --pnb-field: #f2f3f4; /* every field you type in (form, search, answer, update), */
173
+ --pnb-field: var(--pnb-surface); /* every field you type in (form, search, answer, update), */
164
174
  --pnb-field-text: var(--pnb-text); /* what is typed in it, */
165
175
  --pnb-field-quiet: var(--pnb-text-quiet); /* its hint while empty, */
166
176
  --pnb-field-line: var(--pnb-line); /* and the line round it */
177
+ --pnb-field-in-card: var(--pnb-surface); /* a field inside a card: the version and link under "Fixed in" */
167
178
  --pnb-news: var(--pnb-surface-2); /* the note on top of the board ("... answered your idea"), */
168
179
  --pnb-news-line: var(--pnb-accent); /* its line, */
169
180
  --pnb-news-text: var(--pnb-text); /* its words, */
170
181
  --pnb-news-link: var(--pnb-accent); /* its link, */
171
182
  --pnb-news-quiet: var(--pnb-text-quiet); /* and its small words and close */
172
- --pnb-filter-btn: #ffffff; /* the Filter button: its ground, */
183
+ --pnb-filter-btn: #fff; /* the Filter button: its ground, */
173
184
  --pnb-filter-btn-text: var(--pnb-text); /* its word, */
174
- --pnb-filter-btn-line: #cdcdd3; /* and its line */
185
+ --pnb-filter-btn-line: var(--pnb-line); /* and its line */
175
186
  --pnb-bar-icon: var(--pnb-text); /* the icons in every bar: close, back, updates, new post */
176
- --pnb-order: var(--pnb-sunken); /* behind Top / New, */
177
- --pnb-order-text: var(--pnb-text-quiet); /* and the word not chosen */
178
- --pnb-vote: #f2f3f4; /* the vote button, */
187
+ --pnb-vote: var(--pnb-surface-2); /* the vote button, */
179
188
  --pnb-vote-text: var(--pnb-card-text); /* its count, */
180
189
  --pnb-vote-on: var(--pnb-accent); /* a vote you gave, */
181
190
  --pnb-on-vote-on: var(--pnb-on-accent); /* and its count */
@@ -187,21 +196,23 @@ please-no-bugs {
187
196
  --pnb-switch-on: var(--pnb-accent); /* the switch when on, */
188
197
  --pnb-on-switch-on: var(--pnb-on-accent); /* and its knob */
189
198
  --pnb-shot-line: var(--pnb-line); /* the line round "Add screenshot" */
190
- --pnb-order-on: var(--pnb-surface); /* the chosen half of Top/New, */
191
- --pnb-on-order: var(--pnb-text); /* and its words */
192
199
  --pnb-sent: var(--pnb-bg); /* behind "Feedback sent!" */
193
200
  --pnb-sent-title: var(--pnb-text); /* its title, */
194
201
  --pnb-sent-note: var(--pnb-text-quiet); /* its small words and "Back to the board", */
195
- --pnb-sent-check: #040724; /* and the disc behind its tick */
196
- --pnb-on-sent-check: #ffffff; /* the tick itself */
197
- --pnb-fab: #ffb700; /* the round floating button */
198
- --pnb-on-fab: #040724; /* its glyph */
199
- --pnb-fab-shadow: var(--pnb-shadow); /* its shadow, */
202
+ --pnb-sent-check: var(--pnb-done); /* and the disc behind its tick */
203
+ --pnb-on-sent-check: #fff; /* the tick itself */
204
+ --pnb-raise: none; /* a filled button's shadow; `pleasenobugs` raises it */
205
+ --pnb-raise-pressed: none; /* its shadow while pressed */
206
+ --pnb-raise-sink: 0px; /* how far it sinks when pressed */
207
+ --pnb-fab: var(--pnb-accent-fill); /* the round floating button, and Send feedback at the foot of the board */
208
+ --pnb-on-fab: #fff; /* its glyph */
209
+ --pnb-fab-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); /* its shadow, */
200
210
  --pnb-fab-shadow-pressed: var(--pnb-fab-shadow); /* pressed, */
201
- --pnb-fab-squeeze: 0.94; /* and how small it gets pressed */
211
+ --pnb-fab-squeeze: 0.94; /* and how small it gets pressed */
202
212
  --pnb-radius-panel: 16px; /* the panel on a wide screen */
203
213
  --pnb-radius: 10px;
204
- --pnb-radius-sheet: 16px;
214
+ --pnb-radius-sheet: 16px; /* the sheet on a phone, and sheets inside */
215
+ --pnb-sheet-top: 48px; /* how much of your app stays in view above the sheet on a phone */
205
216
  --pnb-radius-pill: 999px; /* filters, chips, votes, Top/New, buttons */
206
217
  --pnb-font: inherit; /* your app's font */
207
218
  --pnb-z: 2147483000; /* overlay and floating button */
@@ -211,8 +222,8 @@ please-no-bugs {
211
222
  ```
212
223
 
213
224
  **Inside Nimiq Pay, set the two insets yourself if you measure Pay's bar.**
214
- Pay draws its own bar over the page and `env()` cannot see it, so a full-screen
215
- board can end up underneath it. Only the overlay and the floating button use
225
+ Pay draws its own bar over the page and `env()` cannot see it, so the sheet can
226
+ end up underneath it. Only the overlay and the floating button use
216
227
  them; an inline board ignores both.
217
228
 
218
229
  ## Reusing your app's own login
@@ -1,6 +1,10 @@
1
- function T(t) {
1
+ function b(t) {
2
2
  return t.replace(/\s+/g, "").toUpperCase();
3
3
  }
4
+ function Z(t) {
5
+ const n = b(t);
6
+ return `${n.slice(0, 4)} … ${n.slice(-4)}`;
7
+ }
4
8
  const M = 30 * 24 * 60 * 60 * 1e3, x = 5 * 60 * 1e3;
5
9
  function J(t) {
6
10
  return [
@@ -18,7 +22,7 @@ function D(t) {
18
22
  return t;
19
23
  }
20
24
  }
21
- function A(t, n = Date.now()) {
25
+ function U(t, n = Date.now()) {
22
26
  return Number.isFinite(t) && t <= n + x && n - t <= M;
23
27
  }
24
28
  function F(t) {
@@ -27,8 +31,8 @@ function F(t) {
27
31
  function K(t) {
28
32
  const n = new TextEncoder().encode(t);
29
33
  let o = "";
30
- for (const a of n)
31
- o += String.fromCharCode(a);
34
+ for (const s of n)
35
+ o += String.fromCharCode(s);
32
36
  return btoa(o).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
33
37
  }
34
38
  const W = [
@@ -111,13 +115,13 @@ const W = [
111
115
  // Every board is about an app
112
116
  "app"
113
117
  ];
114
- function Z(t = []) {
115
- const n = /* @__PURE__ */ new Set([...W, ...[...t].map((r) => r.toLowerCase())]), o = /* @__PURE__ */ new WeakMap(), a = (r) => new Set(r.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu, " ").split(/\s+/).filter((m) => m.length >= 4 && !n.has(m)));
116
- return function(m, q, w = 3) {
117
- const p = a(q);
118
+ function ee(t = []) {
119
+ const n = /* @__PURE__ */ new Set([...W, ...[...t].map((r) => r.toLowerCase())]), o = /* @__PURE__ */ new WeakMap(), s = (r) => new Set(r.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu, " ").split(/\s+/).filter((m) => m.length >= 4 && !n.has(m)));
120
+ return function(m, T, w = 3) {
121
+ const p = s(T);
118
122
  return p.size < 2 ? [] : m.map((u) => {
119
123
  let l = o.get(u);
120
- l || (l = a(u.text), o.set(u, l));
124
+ l || (l = s(u.text), o.set(u, l));
121
125
  let d = 0;
122
126
  for (const h of p)
123
127
  l.has(h) && d++;
@@ -125,9 +129,9 @@ function Z(t = []) {
125
129
  }).filter((u) => u.shared >= 2).sort((u, l) => l.shared - u.shared || l.post.votes - u.post.votes).slice(0, w).map((u) => u.post);
126
130
  };
127
131
  }
128
- function ee(t, n) {
132
+ function te(t, n) {
129
133
  const o = [...t];
130
- return n === "new" ? o.sort((a, r) => r.at - a.at) : o.sort((a, r) => r.votes - a.votes || r.at - a.at);
134
+ return n === "new" ? o.sort((s, r) => r.at - s.at) : o.sort((s, r) => r.votes - s.votes || r.at - s.at);
131
135
  }
132
136
  class E extends Error {
133
137
  constructor(n, o) {
@@ -140,19 +144,19 @@ function j() {
140
144
  }
141
145
  function H(t) {
142
146
  return window.nimiq ? Promise.resolve(window.nimiq) : new Promise((n, o) => {
143
- const a = Date.now(), r = setInterval(() => {
144
- window.nimiq ? (clearInterval(r), n(window.nimiq)) : Date.now() - a > t && (clearInterval(r), o(new E("no_wallet", "Not running inside Nimiq Pay")));
147
+ const s = Date.now(), r = setInterval(() => {
148
+ window.nimiq ? (clearInterval(r), n(window.nimiq)) : Date.now() - s > t && (clearInterval(r), o(new E("no_wallet", "Not running inside Nimiq Pay")));
145
149
  }, 50);
146
150
  });
147
151
  }
148
152
  function Q(t = B) {
149
153
  return async (n) => {
150
- const o = await H(t), a = await o.listAccounts();
151
- if (!Array.isArray(a) || !a.length) throw new E("no_account");
154
+ const o = await H(t), s = await o.listAccounts();
155
+ if (!Array.isArray(s) || !s.length) throw new E("no_account");
152
156
  const r = await o.sign(n);
153
157
  if (!r || !("signature" in r))
154
158
  throw new E("declined", r && "error" in r ? r.error.message : void 0);
155
- return { address: a[0], publicKey: r.publicKey, signature: r.signature };
159
+ return { address: s[0], publicKey: r.publicKey, signature: r.signature };
156
160
  };
157
161
  }
158
162
  async function V() {
@@ -163,25 +167,25 @@ async function V() {
163
167
  return null;
164
168
  }
165
169
  }
166
- function te(t) {
167
- const n = t.server.replace(/\/+$/, ""), o = t.project, a = D(t.origin ?? (typeof location < "u" ? location.origin : "")), r = t.signer === null ? void 0 : t.signer ?? (j() ? Q() : void 0), m = t.fetch ?? globalThis.fetch.bind(globalThis), q = j(), w = `pleasenobugs.proof.${o}.${a}`, p = t.storage === void 0 ? q ? Y() : X(w) : t.storage, u = t.account ?? (t.signer === void 0 && q ? V : void 0);
170
+ function ne(t) {
171
+ const n = t.server.replace(/\/+$/, ""), o = t.project, s = D(t.origin ?? (typeof location < "u" ? location.origin : "")), r = t.signer === null ? void 0 : t.signer ?? (j() ? Q() : void 0), m = t.fetch ?? globalThis.fetch.bind(globalThis), T = j(), w = `pleasenobugs.proof.${o}.${s}`, p = t.storage === void 0 ? T ? Y() : X(w) : t.storage, u = t.account ?? (t.signer === void 0 && T ? V : void 0);
168
172
  let l = 0, d = R(), h = null, N = !1;
169
173
  function P() {
170
174
  if (N || !t.appLogin) return null;
171
175
  const e = typeof t.appLogin == "function" ? t.appLogin() : t.appLogin;
172
- return e ? { ...e, origin: a, issued: 0 } : null;
176
+ return e ? { ...e, origin: s, issued: 0 } : null;
173
177
  }
174
178
  function R() {
175
179
  try {
176
180
  const e = p?.getItem(w);
177
181
  if (!e) return null;
178
- const s = JSON.parse(e);
179
- return A(s.issued) ? s : null;
182
+ const a = JSON.parse(e);
183
+ return U(a.issued) ? a : null;
180
184
  } catch {
181
185
  return null;
182
186
  }
183
187
  }
184
- function b(e) {
188
+ function v(e) {
185
189
  d = e;
186
190
  try {
187
191
  e ? p?.setItem(w, JSON.stringify(e)) : p?.removeItem(w);
@@ -192,33 +196,33 @@ function te(t) {
192
196
  if (!u || !d || Date.now() - l < 3e4) return;
193
197
  l = Date.now();
194
198
  const e = await u();
195
- e && d && T(e) !== T(d.address) && b(null);
199
+ e && d && b(e) !== b(d.address) && v(null);
196
200
  }
197
- function $() {
201
+ function q() {
198
202
  const e = P();
199
- return e || (d && !A(d.issued) && b(null), d);
203
+ return e || (d && !U(d.issued) && v(null), d);
200
204
  }
201
205
  function _() {
202
206
  const e = P();
203
- return e ? Promise.resolve({ ok: !0, data: T(e.address) }) : r ? h || (h = (async () => {
207
+ return e ? Promise.resolve({ ok: !0, data: b(e.address) }) : r ? h || (h = (async () => {
204
208
  try {
205
- const s = Date.now(), c = await r(J({ project: o, origin: a, issued: s }));
206
- return b({ ...c, origin: a, issued: s }), { ok: !0, data: T(c.address) };
207
- } catch (s) {
208
- return s instanceof E && s.reason === "no_wallet" ? { ok: !1, status: 0, error: "no_signer" } : { ok: !1, status: 0, error: "declined" };
209
+ const a = Date.now(), c = await r(J({ project: o, origin: s, issued: a }));
210
+ return v({ ...c, origin: s, issued: a }), { ok: !0, data: b(c.address) };
211
+ } catch (a) {
212
+ return a instanceof E && a.reason === "no_wallet" ? { ok: !1, status: 0, error: "no_signer" } : { ok: !1, status: 0, error: "declined" };
209
213
  } finally {
210
214
  h = null;
211
215
  }
212
216
  })(), h) : Promise.resolve({ ok: !1, status: 0, error: "no_signer" });
213
217
  }
214
- async function i(e, s, c) {
218
+ async function i(e, a, c) {
215
219
  c.auth !== "none" && await z();
216
- const I = async (S) => {
220
+ const I = async ($) => {
217
221
  const O = {};
218
- c.body !== void 0 && (O["content-type"] = "application/json"), S && (O.authorization = F(S));
222
+ c.body !== void 0 && (O["content-type"] = "application/json"), $ && (O.authorization = F($));
219
223
  let y;
220
224
  try {
221
- y = await m(`${n}${s}`, {
225
+ y = await m(`${n}${a}`, {
222
226
  method: e,
223
227
  headers: O,
224
228
  ...c.body !== void 0 ? { body: JSON.stringify(c.body) } : {}
@@ -227,8 +231,8 @@ function te(t) {
227
231
  return { ok: !1, status: 0, error: "network" };
228
232
  }
229
233
  if (y.ok && c.blob) {
230
- const U = await y.blob().catch(() => null);
231
- return U ? { ok: !0, data: U } : { ok: !1, status: 0, error: "network" };
234
+ const C = await y.blob().catch(() => null);
235
+ return C ? { ok: !0, data: C } : { ok: !1, status: 0, error: "network" };
232
236
  }
233
237
  const k = await y.json().catch(() => null);
234
238
  if (y.ok) return { ok: !0, data: k };
@@ -236,17 +240,17 @@ function te(t) {
236
240
  return { ok: !1, status: y.status, error: G, body: k };
237
241
  };
238
242
  if (c.auth === "none") return I(null);
239
- let v = $();
240
- if (!v && c.auth === "required") {
241
- const S = await _();
242
- if (!S.ok) return S;
243
- v = $();
243
+ let S = q();
244
+ if (!S && c.auth === "required") {
245
+ const $ = await _();
246
+ if (!$.ok) return $;
247
+ S = q();
244
248
  }
245
- const L = await I(v);
246
- if (L.ok || L.status !== 401 || !v) return L;
247
- if (v.message !== void 0 ? N = !0 : b(null), c.auth === "optional") return I(null);
248
- const C = await _();
249
- return C.ok ? I($()) : C;
249
+ const L = await I(S);
250
+ if (L.ok || L.status !== 401 || !S) return L;
251
+ if (S.message !== void 0 ? N = !0 : v(null), c.auth === "optional") return I(null);
252
+ const A = await _();
253
+ return A.ok ? I(q()) : A;
250
254
  }
251
255
  const f = (e = "") => `/v1/projects/${encodeURIComponent(o)}${e}`, g = (e) => f(`/posts/${encodeURIComponent(e)}`);
252
256
  return {
@@ -258,13 +262,13 @@ function te(t) {
258
262
  },
259
263
  /** The signed-in address, if a proof is stored. */
260
264
  address() {
261
- const e = $();
262
- return e ? T(e.address) : null;
265
+ const e = q();
266
+ return e ? b(e.address) : null;
263
267
  },
264
268
  signIn: _,
265
269
  /** Forget the stored proof. The next write asks the wallet again. */
266
270
  signOut() {
267
- b(null);
271
+ v(null);
268
272
  },
269
273
  /** The whole board, plus `me` when signed in. Never prompts. */
270
274
  board: () => i("GET", f("/posts"), { auth: "optional" }),
@@ -286,8 +290,8 @@ function te(t) {
286
290
  shotUrl: (e) => `${n}${g(e)}/shot`,
287
291
  /** Where the server draws an identicon, by the code a post carries in `face`. */
288
292
  faceUrl: (e) => `${n}/v1/identicons/${encodeURIComponent(e)}.svg`,
289
- vote: (e, s) => i("POST", `${g(e)}/vote`, {
290
- body: { up: s },
293
+ vote: (e, a) => i("POST", `${g(e)}/vote`, {
294
+ body: { up: a },
291
295
  auth: "required"
292
296
  }),
293
297
  remove: (e) => i("DELETE", g(e), { auth: "required" }),
@@ -297,24 +301,24 @@ function te(t) {
297
301
  * idea set to done: `{ version?, link? }`, the link on github.com or
298
302
  * gitlab.com. Moving a post away from done takes its fix away by itself.
299
303
  */
300
- manage: (e, s) => i("POST", `${g(e)}/manage`, { body: s, auth: "required" }),
304
+ manage: (e, a) => i("POST", `${g(e)}/manage`, { body: a, auth: "required" }),
301
305
  /**
302
306
  * Write under a post: an owner for the app, whenever they like; its
303
307
  * author only right after the app, on a bug or an idea that is not done
304
308
  * (`not_your_turn`, `closed` otherwise). `message.id` is yours to mint.
305
309
  */
306
- say: (e, s) => i("POST", `${g(e)}/messages`, { body: s, auth: "required" }),
310
+ say: (e, a) => i("POST", `${g(e)}/messages`, { body: a, auth: "required" }),
307
311
  /**
308
312
  * Change your own last message before anybody answered it (`text`), or,
309
313
  * as an owner, take an author's message off the board or put it back
310
314
  * (`hidden`).
311
315
  */
312
- editMessage: (e, s, c) => i("PATCH", `${g(e)}/messages/${encodeURIComponent(s)}`, {
316
+ editMessage: (e, a, c) => i("PATCH", `${g(e)}/messages/${encodeURIComponent(a)}`, {
313
317
  body: c,
314
318
  auth: "required"
315
319
  }),
316
320
  /** Take your own last message back, before anybody answered it. */
317
- unsay: (e, s) => i("DELETE", `${g(e)}/messages/${encodeURIComponent(s)}`, { auth: "required" }),
321
+ unsay: (e, a) => i("DELETE", `${g(e)}/messages/${encodeURIComponent(a)}`, { auth: "required" }),
318
322
  /** What changed in the app, newest first. Anybody's to read; never prompts. */
319
323
  updates: () => i("GET", f("/updates"), { auth: "optional" }),
320
324
  /**
@@ -349,10 +353,11 @@ function Y() {
349
353
  }
350
354
  export {
351
355
  E as S,
352
- te as a,
353
- T as b,
354
- Z as c,
356
+ ne as a,
357
+ b,
358
+ ee as c,
359
+ Z as d,
355
360
  j as i,
356
361
  Q as n,
357
- ee as s
362
+ te as s
358
363
  };