pleasenobugs 0.1.1 → 0.2.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 +63 -5
- package/dist/chunks/demo-nnvUgJyJ.js +107 -0
- package/dist/chunks/index-13DToKWI.js +1751 -0
- package/dist/client.js +103 -86
- package/dist/index.js +11 -1151
- package/dist/pleasenobugs.iife.js +2 -2
- package/dist/types/client.d.ts +23 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/demo.d.ts +17 -0
- package/dist/types/demo.d.ts.map +1 -0
- package/dist/types/element.d.ts +32 -4
- package/dist/types/element.d.ts.map +1 -1
- package/dist/types/i18n.d.ts +205 -0
- package/dist/types/i18n.d.ts.map +1 -1
- package/dist/types/index.d.ts +10 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/readonly.d.ts +17 -0
- package/dist/types/readonly.d.ts.map +1 -0
- package/dist/types/ui/App.d.ts +25 -1
- package/dist/types/ui/App.d.ts.map +1 -1
- package/dist/types/ui/Choose.d.ts +37 -0
- package/dist/types/ui/Choose.d.ts.map +1 -0
- package/dist/types/ui/Compose.d.ts +42 -15
- package/dist/types/ui/Compose.d.ts.map +1 -1
- package/dist/types/ui/PostCard.d.ts +31 -6
- package/dist/types/ui/PostCard.d.ts.map +1 -1
- package/dist/types/ui/Sheets.d.ts +30 -9
- package/dist/types/ui/Sheets.d.ts.map +1 -1
- package/dist/types/ui/icons.d.ts +13 -2
- package/dist/types/ui/icons.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -16,8 +16,12 @@ wallet by itself; everywhere else it reads, and your app can hand it a signer.
|
|
|
16
16
|
| `mode` | What it does |
|
|
17
17
|
|---|---|
|
|
18
18
|
| `inline` (default) | Fills the element. Give it a height, or it grows with its posts. |
|
|
19
|
-
| `floating` | A
|
|
20
|
-
| `overlay` | The board
|
|
19
|
+
| `floating` | A round button in the corner. It opens on the tiles (bug, idea, review), with the board one tap under them. |
|
|
20
|
+
| `overlay` | The board, right now. |
|
|
21
|
+
|
|
22
|
+
`floating` and `overlay` cover the whole screen on a phone. From 640 pixels
|
|
23
|
+
wide they are a panel in the bottom-right corner instead, 375 wide and up to
|
|
24
|
+
640 tall, over a dimmed page; a click beside it or Escape closes it.
|
|
21
25
|
|
|
22
26
|
From a button of your own:
|
|
23
27
|
|
|
@@ -33,10 +37,16 @@ menuItem.onclick = () => open({ project: 'YOUR_PROJECT_ID', server: 'https://YOU
|
|
|
33
37
|
| `project`, `server` | Required. |
|
|
34
38
|
| `mode` | `inline`, `floating` or `overlay`. |
|
|
35
39
|
| `lang` | `en`, `nl`, `de`, or any code you supply `strings` for. Defaults to Nimiq Pay's language, then the page's. |
|
|
36
|
-
| `theme` | `auto` (follows the phone), `light`, `dark`, `shitti
|
|
40
|
+
| `theme` | `auto` (follows the phone), `light`, `dark`, `pleasenobugs` (dark purple, the website's look), `nimiq` (gradient tiles and buttons, light only). Every theme has the same shapes: painted tiles with a white glyph, the same badges; only the colours differ. `shitti` is the old name of `pleasenobugs` and still works. |
|
|
37
41
|
| `accent` | One colour, e.g. `#e84a5f`. The text on it picks black or white by itself. |
|
|
38
42
|
| `app-name` | What answers are signed with ("Shitti says"). Defaults to the project's name. |
|
|
39
43
|
| `name` | A display name you already know, offered when the user chooses to show theirs. |
|
|
44
|
+
| `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. |
|
|
45
|
+
| `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. |
|
|
46
|
+
| `names` | `off` leaves out "Show my name", so every post is anonymous. For a board on a public page. |
|
|
47
|
+
| `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. |
|
|
48
|
+
| `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. |
|
|
49
|
+
| `screen` | With `demo` only: hold one screen in view, `button`, `tiles`, `board`, `write` or `sent`. What the website's configurator uses to show the part you are changing. |
|
|
40
50
|
|
|
41
51
|
| Property | |
|
|
42
52
|
|---|---|
|
|
@@ -48,6 +58,41 @@ menuItem.onclick = () => open({ project: 'YOUR_PROJECT_ID', server: 'https://YOU
|
|
|
48
58
|
|
|
49
59
|
Events: `pleasenobugs:posted` (`detail: { id, kind }`) and `pleasenobugs:close`.
|
|
50
60
|
|
|
61
|
+
## What your users see
|
|
62
|
+
|
|
63
|
+
Tapping **+** opens three tiles: **Report a bug**, **Share an idea** and
|
|
64
|
+
**Write a review**. A review is one to five stars and a few words, shown on the
|
|
65
|
+
board with the average on top, so people can see what others like about your
|
|
66
|
+
app. One review per wallet.
|
|
67
|
+
|
|
68
|
+
A bug or an idea can carry **a screenshot, shown on the board** under the
|
|
69
|
+
post, so everybody can see what is meant. Before picking one the user reads
|
|
70
|
+
that everyone will see it and should check it for a balance, an address or a
|
|
71
|
+
name; after picking, **nothing is sent until they tick "I checked it: everyone
|
|
72
|
+
may see this screenshot"** under the picture. The widget redraws it as a JPEG
|
|
73
|
+
before sending, which leaves the photo's location and camera details behind.
|
|
74
|
+
|
|
75
|
+
You see every screenshot in the sheet where you answer a post, and can **take
|
|
76
|
+
one off the board** there while the post stays up, or hide the whole post. A
|
|
77
|
+
screenshot is deleted by itself when you mark the post Done or Not doing, or
|
|
78
|
+
when the post is thrown away. Taking one off stops it being shown; it cannot
|
|
79
|
+
take it back from anybody who already saved it.
|
|
80
|
+
|
|
81
|
+
**Approving first.** On a project made with `PNB_PROJECT_APPROVE=on`, a new
|
|
82
|
+
post waits until an owner approves it. Its author sees it on the board marked
|
|
83
|
+
"Waiting for approval", and "Feedback sent!" says it shows once approved;
|
|
84
|
+
nobody else sees it yet. Owners see it too, and approve it in the sheet where
|
|
85
|
+
they answer it. Your own posts as an owner never wait.
|
|
86
|
+
|
|
87
|
+
With `screenshots="owners"` they stay yours alone, never the board and not
|
|
88
|
+
even their author: the warning says so instead, and there is nothing to tick.
|
|
89
|
+
Any screenshot sent without that tick keeps that promise, whatever you change
|
|
90
|
+
later.
|
|
91
|
+
|
|
92
|
+
If your page has a Content Security Policy, screenshots on the board load as
|
|
93
|
+
plain images from your server, so `img-src` needs your server next to
|
|
94
|
+
`connect-src`.
|
|
95
|
+
|
|
51
96
|
## Theming
|
|
52
97
|
|
|
53
98
|
The widget lives in a shadow root, so your CSS cannot break it. These custom
|
|
@@ -63,10 +108,20 @@ please-no-bugs {
|
|
|
63
108
|
--pnb-text: #1b1b24;
|
|
64
109
|
--pnb-text-quiet: #5a5a6b;
|
|
65
110
|
--pnb-accent: #2563eb;
|
|
111
|
+
--pnb-accent-fill: var(--pnb-accent); /* what buttons are painted with; may be a gradient */
|
|
66
112
|
--pnb-on-accent: #fff;
|
|
67
113
|
--pnb-danger: #d23b2f;
|
|
68
|
-
--pnb-bug: #e5484d; --pnb-idea: #e9a00b;
|
|
69
|
-
--pnb-planned: #
|
|
114
|
+
--pnb-bug: #e5484d; --pnb-idea: #8b5cf6; --pnb-review: #e9a00b;
|
|
115
|
+
--pnb-planned: #8a8fb8; --pnb-done: #21bca5; --pnb-declined: #8a8fb8;
|
|
116
|
+
--pnb-star: #f5a524;
|
|
117
|
+
--pnb-tile-bug: var(--pnb-bug); /* the three tiles; may be gradients */
|
|
118
|
+
--pnb-tile-idea: var(--pnb-idea);
|
|
119
|
+
--pnb-tile-review: var(--pnb-review);
|
|
120
|
+
--pnb-tile-ink: #fff; /* the words on them */
|
|
121
|
+
--pnb-sent: var(--pnb-bg); /* behind "Feedback sent!" */
|
|
122
|
+
--pnb-fab: var(--pnb-accent-fill); /* the round floating button */
|
|
123
|
+
--pnb-on-fab: var(--pnb-on-accent); /* its glyph */
|
|
124
|
+
--pnb-radius-panel: 16px; /* the panel on a wide screen */
|
|
70
125
|
--pnb-radius: 8px;
|
|
71
126
|
--pnb-radius-sheet: 16px;
|
|
72
127
|
--pnb-font: inherit; /* your app's font */
|
|
@@ -125,6 +180,9 @@ const client = createClient({ server: 'https://YOUR_SERVER', project: 'YOUR_PROJ
|
|
|
125
180
|
const board = await client.board(); // never asks the wallet
|
|
126
181
|
if (board.ok) render(sortPosts(board.data.posts, 'top'));
|
|
127
182
|
await client.post({ id: crypto.randomUUID(), kind: 'idea', text: 'Dark mode' }); // asks once, then remembers
|
|
183
|
+
await client.post({ id: crypto.randomUUID(), kind: 'review', text: 'Love it', rating: 5 });
|
|
184
|
+
const shot = await client.shot(postId); // the screenshot as a Blob: on the board, or yours as an owner
|
|
185
|
+
const src = client.shotUrl(postId); // a board screenshot's address, for an <img>
|
|
128
186
|
```
|
|
129
187
|
|
|
130
188
|
Every call answers `{ ok: true, data }` or `{ ok: false, status, error }`, and
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { D as h } from "./index-13DToKWI.js";
|
|
2
|
+
function p(g = "en") {
|
|
3
|
+
const u = Date.now();
|
|
4
|
+
let i = (c[g] ?? c.en).map((e, t) => ({
|
|
5
|
+
id: `demo-${t}`,
|
|
6
|
+
kind: e.kind,
|
|
7
|
+
text: e.text,
|
|
8
|
+
at: u - e.ago,
|
|
9
|
+
status: e.status ?? "open",
|
|
10
|
+
votes: e.votes,
|
|
11
|
+
voted: !1,
|
|
12
|
+
mine: !1,
|
|
13
|
+
...e.who ? { who: e.who } : {},
|
|
14
|
+
...e.rating ? { rating: e.rating } : {},
|
|
15
|
+
...e.reply ? { reply: { text: e.reply, at: u - e.ago / 2 } } : {}
|
|
16
|
+
})), o, l = h.perDay;
|
|
17
|
+
const v = /* @__PURE__ */ new Map(), a = (e) => k({ ok: !0, data: e }), d = (e, t) => k({ ok: !1, status: e, error: t }), m = (e) => i.find((t) => t.id === e);
|
|
18
|
+
return {
|
|
19
|
+
project: "demo",
|
|
20
|
+
canSign: !0,
|
|
21
|
+
address: () => w,
|
|
22
|
+
signIn: () => a(w),
|
|
23
|
+
signOut() {
|
|
24
|
+
},
|
|
25
|
+
board: () => a({
|
|
26
|
+
project: { id: "demo", name: "Demo app", rules: { ...h, kinds: [...h.kinds] } },
|
|
27
|
+
posts: i.map((e) => ({ ...e })),
|
|
28
|
+
me: { owner: !1, left: l, ...o ? { name: o } : {} }
|
|
29
|
+
}),
|
|
30
|
+
me: () => a({ owner: !1, left: l, ...o ? { name: o } : {} }),
|
|
31
|
+
answers: () => a({ answers: [] }),
|
|
32
|
+
post(e) {
|
|
33
|
+
return l <= 0 ? d(429, "too_many") : e.kind === "review" && i.some((t) => t.mine && t.kind === "review") ? d(409, "reviewed") : (l -= 1, i = [
|
|
34
|
+
{
|
|
35
|
+
id: e.id,
|
|
36
|
+
kind: e.kind,
|
|
37
|
+
text: e.text,
|
|
38
|
+
at: Date.now(),
|
|
39
|
+
status: "open",
|
|
40
|
+
votes: 1,
|
|
41
|
+
voted: !0,
|
|
42
|
+
mine: !0,
|
|
43
|
+
...!e.anon && o ? { who: o } : {},
|
|
44
|
+
...e.kind === "review" ? { rating: e.rating } : {},
|
|
45
|
+
...e.shot?.board ? { shot: !0 } : {}
|
|
46
|
+
},
|
|
47
|
+
...i
|
|
48
|
+
], e.shot?.board && v.set(e.id, `data:${e.shot.type};base64,${e.shot.data}`), a({ ok: !0, left: l }));
|
|
49
|
+
},
|
|
50
|
+
// The visitor's own screenshots on the board; nothing else exists here.
|
|
51
|
+
shot: async (e) => {
|
|
52
|
+
const t = v.get(e);
|
|
53
|
+
return t ? a(await (await fetch(t)).blob()) : d(404, "not_found");
|
|
54
|
+
},
|
|
55
|
+
shotUrl: (e) => v.get(e) ?? "",
|
|
56
|
+
vote(e, t) {
|
|
57
|
+
const r = m(e);
|
|
58
|
+
return r ? (r.voted !== t && (r.votes += t ? 1 : -1), r.voted = t, a({ ok: !0, votes: r.votes, voted: r.voted })) : d(404, "not_found");
|
|
59
|
+
},
|
|
60
|
+
remove(e) {
|
|
61
|
+
const t = m(e);
|
|
62
|
+
return t ? (i = i.filter((r) => r !== t), v.delete(e), a({ ok: !0 })) : d(404, "not_found");
|
|
63
|
+
},
|
|
64
|
+
setName(e) {
|
|
65
|
+
o = e.trim() || void 0;
|
|
66
|
+
for (const t of i) t.mine && t.who !== void 0 && (t.who = o);
|
|
67
|
+
return a({ ok: !0, ...o ? { name: o } : {} });
|
|
68
|
+
},
|
|
69
|
+
manage: () => d(403, "not_owner")
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const w = "NQ00 DEMO DEMO DEMO DEMO DEMO DEMO DEMO DEMO";
|
|
73
|
+
function k(g) {
|
|
74
|
+
return new Promise((u) => setTimeout(() => u(g), 250));
|
|
75
|
+
}
|
|
76
|
+
const s = 36e5, n = 24 * s, c = {
|
|
77
|
+
en: [
|
|
78
|
+
{ kind: "idea", text: "A dark mode that follows my phone", votes: 24, ago: 6 * n, status: "planned", who: "Mira", reply: "On its way in the next release." },
|
|
79
|
+
{ kind: "bug", text: "The send button does nothing after I switch accounts", votes: 17, ago: 2 * n, status: "done", reply: "Fixed in 1.4.2, thanks for the steps!" },
|
|
80
|
+
{ kind: "review", text: "Fast, simple and it never asks me twice. Love it.", votes: 9, ago: 3 * n, rating: 5, who: "Joost" },
|
|
81
|
+
{ kind: "idea", text: "Let me pin my favourite contacts to the top", votes: 12, ago: 4 * s },
|
|
82
|
+
{ kind: "review", text: "Does what it says. The history screen could be clearer.", votes: 4, ago: 9 * n, rating: 4 },
|
|
83
|
+
{ kind: "bug", text: "Amounts over 1,000 overlap the currency on small phones", votes: 6, ago: 20 * s, who: "Sam" },
|
|
84
|
+
{ kind: "idea", text: "Export my history as a CSV file", votes: 3, ago: 12 * n, status: "declined", reply: "Not for now: it would mean storing more than we want to." }
|
|
85
|
+
],
|
|
86
|
+
nl: [
|
|
87
|
+
{ kind: "idea", text: "Een donkere modus die mijn telefoon volgt", votes: 24, ago: 6 * n, status: "planned", who: "Mira", reply: "Komt in de volgende versie." },
|
|
88
|
+
{ kind: "bug", text: "De verstuurknop doet niets nadat ik van account wissel", votes: 17, ago: 2 * n, status: "done", reply: "Opgelost in 1.4.2, bedankt voor de stappen!" },
|
|
89
|
+
{ kind: "review", text: "Snel, simpel en hij vraagt nooit twee keer. Top.", votes: 9, ago: 3 * n, rating: 5, who: "Joost" },
|
|
90
|
+
{ kind: "idea", text: "Laat me mijn favoriete contacten bovenaan zetten", votes: 12, ago: 4 * s },
|
|
91
|
+
{ kind: "review", text: "Doet wat hij belooft. Het geschiedenisscherm kan duidelijker.", votes: 4, ago: 9 * n, rating: 4 },
|
|
92
|
+
{ kind: "bug", text: "Bedragen boven 1.000 vallen over de munt op kleine telefoons", votes: 6, ago: 20 * s, who: "Sam" },
|
|
93
|
+
{ kind: "idea", text: "Mijn geschiedenis exporteren als CSV-bestand", votes: 3, ago: 12 * n, status: "declined", reply: "Voorlopig niet: dan zouden we meer moeten bewaren dan we willen." }
|
|
94
|
+
],
|
|
95
|
+
de: [
|
|
96
|
+
{ kind: "idea", text: "Ein dunkler Modus, der meinem Handy folgt", votes: 24, ago: 6 * n, status: "planned", who: "Mira", reply: "Kommt mit der nächsten Version." },
|
|
97
|
+
{ kind: "bug", text: "Der Senden-Knopf tut nichts, nachdem ich das Konto wechsle", votes: 17, ago: 2 * n, status: "done", reply: "Behoben in 1.4.2, danke für die Schritte!" },
|
|
98
|
+
{ kind: "review", text: "Schnell, einfach und fragt nie zweimal. Super.", votes: 9, ago: 3 * n, rating: 5, who: "Joost" },
|
|
99
|
+
{ kind: "idea", text: "Lass mich meine Lieblingskontakte oben anheften", votes: 12, ago: 4 * s },
|
|
100
|
+
{ kind: "review", text: "Tut, was es verspricht. Der Verlauf könnte klarer sein.", votes: 4, ago: 9 * n, rating: 4 },
|
|
101
|
+
{ kind: "bug", text: "Beträge über 1.000 überlappen die Währung auf kleinen Handys", votes: 6, ago: 20 * s, who: "Sam" },
|
|
102
|
+
{ kind: "idea", text: "Meinen Verlauf als CSV-Datei exportieren", votes: 3, ago: 12 * n, status: "declined", reply: "Vorerst nicht: Dafür müssten wir mehr speichern, als wir wollen." }
|
|
103
|
+
]
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
p as createDemoClient
|
|
107
|
+
};
|