create-heresay 0.2.49 → 0.2.51

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.
@@ -1,13 +1,9 @@
1
1
  # Change how Heresay looks in an iOS or macOS app
2
2
 
3
- Goal: Heresay fits the app, with the fewest changes. **The defaults are the recommended
4
- setup.** Change something only when the person asks, or when the app clearly needs it (see
5
- "When to change what"). Everything is one `HeresayStyle`, passed to `Heresay.configure`, plus
6
- the accent colour. Needs the Swift package 0.2.11 or later.
7
-
8
- The easiest way to choose is the dashboard: open the app, then **Design**. It shows a likeness
9
- of the button and sheet with the choices applied and gives the exact Swift, plus a prompt for
10
- you. If the person pasted that prompt, do what it says and nothing more.
3
+ The defaults are the recommended setup. Change something only when the person asks or the app
4
+ clearly needs it. It is one `HeresayStyle`, passed to `Heresay.configure`, plus `accent`. Needs
5
+ the Swift package 0.2.11 or later. The dashboard's **Design** page previews it and gives the
6
+ Swift; if the person pasted its prompt, do exactly that.
11
7
 
12
8
  ```swift
13
9
  Heresay.configure(
@@ -18,107 +14,134 @@ Heresay.configure(
18
14
  )
19
15
  ```
20
16
 
21
- ## When to change what
17
+ ## Options
22
18
 
23
- | The app has... | Do this |
24
- | --- | --- |
25
- | Its own feedback or help button | `.heresay()` instead of `.heresayReportButton()`, and that button calls `Heresay.present()` |
26
- | A macOS app | keep the default: `.heresay()` plus `.commands { HeresayCommands() }` (Help › Report a Problem…, ⌥⌘R) |
27
- | A tab bar or toolbar in the bottom right | `position: .bottomLeading`, or `offset: 80` to sit above it |
28
- | A brand colour | `accent:` on `configure` (the mark follows it) |
29
- | Only a dark theme, or only a light one | `theme: .dark` or `.light`; otherwise leave it following the app |
30
- | French, Tamil or Hindi users | nothing, if the app is localised into `fr`, `ta` or `hi`; otherwise `language:` with that code |
31
- | An error screen | a button there that calls `Heresay.present(type: .broken, text: "<what failed>")` |
32
- | Screens where a corner button gets in the way (checkout, sign-in) | `hiddenOnScreens: ["Checkout"]`, and those screens call `Heresay.setScreen("Checkout")` |
33
-
34
- ## Every option
35
-
36
- `HeresayStyle(...)` takes these in this order (Swift needs the order); leave out any you don't
19
+ `HeresayStyle(...)` takes these **in this order** (Swift requires it); leave out any you don't
37
20
  change. The first value is the default.
38
21
 
39
22
  | Parameter | Values |
40
23
  | --- | --- |
41
24
  | `position` | `.bottomTrailing` · `.bottomLeading` · `.topTrailing` · `.topLeading` · `.bottom` |
42
25
  | `offset` | `16` points from the edges (at most 200) |
43
- | `label` | `nil` ("Report", in the sheet's language) · any text up to 40 characters |
44
- | `button` | `.pill` · `.icon` (the label stays as its accessibility label) |
45
- | `size` | `.regular` · `.small` · `.large` |
46
- | `fill` | `.accent` (filled with the accent, white text) · `.neutral` (system material, the mark in the accent) |
47
- | `shadow` | `.soft` · `.none` · `.strong` |
48
- | `hiddenOnScreens` | `[]` · screen names as set with `Heresay.setScreen` |
49
- | `markFollowsAccent` | `true` · `false` (keep the Heresay teal) |
26
+ | `label` | `nil` ("Report") · any text up to 40 characters |
27
+ | `hiddenOnScreens` | `[]` · screen names set with `Heresay.setScreen` |
50
28
  | `theme` | `.system` · `.light` · `.dark` |
51
- | `typeface` | `.system` · `.rounded` · `.serif` |
52
- | `language` | `nil` (the app's language) · `"en"` · `"fr"` · `"ta"` (Tamil) · `"hi"` (Hindi). Others show English. |
53
- | `placeholder` | `nil` · the question in the text box, up to 120 characters |
54
- | `types` | all four · some of `[.broken, .confusing, .improvement, .idea]`. Their names can't change: the type sets the priority. |
55
- | `thanks` | `nil` · a line after "Sent. Thank you.", up to 160 characters. Don't promise a fix. |
56
- | `sheet` | `.regular` · `.compact` (half height on iPhone; narrower on Mac) · `.large` (full screen on iPhone and iPad; wider on Mac) |
57
- | `showsPreferences` | `true` · `false` (hide it when the app calls `identify` and wants nothing else asked) |
58
-
59
- `Heresay.setStyle(_:)` changes it later, for example when the app's own theme setting changes.
60
-
61
- **The trail**
62
-
63
- With each report, Heresay attaches what happened in the app in the last few minutes: screens
64
- (named with `Heresay.setScreen` or `.heresayScreen("Settings")`), the app's own `Logger` errors,
65
- the last crash, going offline, and on macOS clicks (by their accessibility label) and menu
66
- commands. It is kept on disk as it happens, so after a crash the next report says what happened
67
- before the app closed and whether it was the first launch after an update. The reporter sees it in the sheet and can switch it off or leave parts out. Never what
68
- anyone typed. On by default; change it only when asked.
69
-
70
- | Option | Values |
71
- | --- | --- |
72
- | `configure(…, trail:)` | `.all` (default) · `[]` (off) · some of `[.screens, .clicks, .errors]` |
73
- | `.heresayPrivate()` | on a view whose controls are named after someone's data: clicks inside it are recorded as "button", without the label |
29
+ | `language` | `nil` (the app's language) · `"en"` · `"fr"` · `"ta"` · `"hi"`. Others show English. |
30
+ | `layout` | `.composer` · `.steps` · `.bar` (last parameter; see Layout) |
31
+
32
+ On `configure`: `accent:` (a `Color`; the mark follows it) and `style:`. `Heresay.setStyle(_:)`
33
+ changes it later.
74
34
 
75
- **Offering help**
35
+ ## Layout
76
36
 
77
- When someone seems stuck, a small note by the button (or in its corner on macOS) asks "Something
78
- not working?" and opens the sheet as Broken, with the trail. Watched on the device, never sent. At
79
- most once per launch. Off by default: it appears on the app's own screen, so add it only when
80
- asked.
37
+ `layout:` is the last `HeresayStyle` parameter and picks how a report opens. The reporter never
38
+ sees the choice. All three send the same data, need a type and some text before Send is enabled,
39
+ keep the same Sent view and the same Your reports view, show no trail, and hide the floating
40
+ Report button while open. `Heresay.present(type:text:)` preselects the type in all of them.
81
41
 
82
- | Option | Values |
42
+ ```swift
43
+ HeresayStyle(layout: .steps) // .composer (default) · .steps · .bar
44
+ ```
45
+
46
+ **`.composer` (default).** One sheet. Header: mark, "Report", Your reports (with a dot when there
47
+ is a reply), close. Then one row of the four type pills, a text box whose question follows the
48
+ type, Send, and a one-line footer. Choose it when you have no strong preference: one screen, all
49
+ choices visible. iPhone: a sheet that fits the form and rises with the keyboard. iPad and Mac: a
50
+ regular sheet.
51
+
52
+ **`.steps`.** Two screens. Screen 1: "What's going on?", Your reports (clock icon with a dot),
53
+ close, and four full-width rows (Broken, Confusing, Could be better, Idea), each with an icon and
54
+ a chevron, then "Powered by Heresay". Tapping a row goes to screen 2: back, the chosen type as a
55
+ pill, the text box, Send. Choose it for a guided, friendlier feel or for people who don't know what
56
+ to write until they have chosen a kind. `types:` shortens the list. With `present(type:)` it opens
57
+ on screen 2. iPhone: a sheet that fits each screen. iPad and Mac: a regular sheet.
58
+
59
+ **`.bar`.** Compact, not a sheet. A "Type" menu chip on the left (Broken, Confusing, Could be
60
+ better, Idea, with icons; it then shows the choice), a one-line text field "Tell the team..." that
61
+ grows, and a round send arrow, disabled until there is a type and text. Under it: Your reports,
62
+ "Powered by Heresay", close. After Send the bar shows a check, "Sent. Replies show under Your
63
+ reports." and Done. Your reports opens the normal Your reports sheet. Choose it when the screen
64
+ should stay visible and reports are usually one line. iPhone and iPad: docked at the bottom, above
65
+ the keyboard. Mac: a small panel in the window, in the corner `position` names (bottom corners
66
+ and `.bottom` dock at the bottom, top ones at the top).
67
+
68
+ **With no floating button** (`.heresay()` plus your own button calling `Heresay.present()`, or
69
+ macOS Help › Report a Problem… with `HeresayCommands`) every layout works the same. Every
70
+ `position` works with every layout.
71
+
72
+ ## How it opens
73
+
74
+ | How it's opened | iPhone | iPad / Mac |
75
+ | --- | --- | --- |
76
+ | The floating button (`.heresayReportButton()`, any position) | bottom sheet (bar layout: docked bar) | popover beside the button |
77
+ | Your own button calling `Heresay.present()`, no `.heresayAnchor()` (recommended) | bottom sheet (bar layout: docked bar) | centred sheet on the window (iPad: form sheet) |
78
+ | Your own button with `.heresayAnchor()` (opt-in), which calls `Heresay.present()` | bottom sheet (bar layout: docked bar) | popover pointing at that button |
79
+ | `Heresay.present()` from code with no anchor (an error screen, say) | bottom sheet | sheet on the window (iPad: form sheet) |
80
+ | Mac menu bar Help › Report a Problem… / ⌥⌘R (`HeresayCommands`) | n/a | sheet on the key window |
81
+
82
+ Tapping or clicking outside a popover, or swiping down a sheet, closes it; what was typed and the
83
+ chosen type are kept for next time (cleared after sending). A Mac window sheet can't be closed by
84
+ clicking outside, so use Escape or the close button. The bar layout stays a docked bar everywhere.
85
+
86
+ ## When to change what
87
+
88
+ | The app has... | Do this |
83
89
  | --- | --- |
84
- | `configure(…, nudge:)` | `[]` (default, off) · `.all` · `.clicks` (macOS: a disabled control clicked 3 times in 10 s, or one spot clicked 5 times in 2 s; leave it out for games and drawing apps) · `.crash` (the app crashed last time; once, at the next launch) · `.circles` (6 screen changes in a minute among at most 3 screens; needs named screens) · `.stalled` (typed, then 45 s still editing with nothing more: the keyboard still up on iOS; search fields don't count). The last two say "Stuck on something?" and open as Confusing. |
90
+ | Its own feedback or help button | `.heresay()` (no floating button) and the button calls `Heresay.present()`: a centred sheet (recommended). Add `.heresayAnchor()` to that button only if the person wants it next to the button (iPad and Mac popover). Ask: "Open Heresay as a centred window (recommended) or next to your button?" |
91
+ | macOS | the default: `.heresay()` plus `.commands { HeresayCommands() }` (Help › Report a Problem…, ⌥⌘R) |
92
+ | A tab bar or toolbar in the bottom right | `position: .bottomLeading`, or `offset: 80` |
93
+ | Screens where the button is in the way | `hiddenOnScreens: ["Checkout"]`, and those screens call `Heresay.setScreen("Checkout")` |
94
+ | An error screen | a button calling `Heresay.present(type: .broken, text: "<what failed>")` |
85
95
 
86
- **Crash reports**
96
+ ## The mark in your own button
87
97
 
88
- Off by default: a crash waits on the device and goes with the next report someone sends. Turn on
89
- `crashReports: .send` when the team wants every crash, including ones nobody reports, for example
90
- an app that crashes on launch for some people:
98
+ `HeresayMarkIcon()` is the mark sized to the surrounding text and tinted (`HeresayMarkIcon(color: .primary)`
99
+ follows the text). `HeresayMark()` is the bare `Shape` for a custom size.
91
100
 
92
101
  ```swift
93
- Heresay.configure(key: "KEY", url: URL(string: "HERESAY_URL")!, crashReports: .send)
102
+ Button { Heresay.present() } label: {
103
+ Label { Text("Report a problem") } icon: { HeresayMarkIcon() }
104
+ }
94
105
  ```
95
106
 
96
- At the next launch after a run that ended badly (a crash, a hang the system killed, running out
97
- of memory, a force quit), Heresay reports it as Broken, with that run's last five minutes, the
98
- app's logged errors and, once macOS or iOS hands it over, how it crashed. It shows in the inbox as
99
- "Sent automatically after a crash" and waits for a person like any report. Once per bad run, at
100
- most three a day per device. It goes as a background upload, so it arrives even if the app
101
- crashes again straight away, as long as `configure` runs first: keep it the first line of the
102
- `App`'s `init`, before anything that could crash.
107
+ ## What to recommend
108
+
109
+ The design choices worth proposing to the person (own-button mark, wording, where, error screens, brand) are listed with their reasons in guide `install-apple`, "What to recommend". Propose, explain in a sentence, accept their answer; never apply a design change unasked.
110
+
111
+ ## Calls
103
112
 
104
- It sends diagnostics without asking, so tell the person: their privacy policy should say so, and
105
- on the App Store their privacy details should list Crash Data and Other Diagnostic Data.
113
+ - `Heresay.identify(id:label:email:)`, `Heresay.identify()` on sign-out.
114
+ - `Heresay.introduce()`: the one-time introduction.
115
+ - `Heresay.setScreen(_:)`, or `.heresayScreen("Settings")` on a screen's root view.
116
+ - `Heresay.present(type:text:)`: opens the sheet, filled in. The person still reviews and sends.
117
+ - `Heresay.onSent { event in ... }`: after each send, with `event.id` and `event.type`, never the text.
106
118
 
107
- Screens make the trail readable: if the app has several screens and doesn't name them yet, add
108
- `.heresayScreen("<name>")` to each screen's root view.
119
+ ## The trail
109
120
 
110
- **Calls**
121
+ On by default, each report carries what happened in the last few minutes (screens, the app's
122
+ `Logger` errors, the last crash, going offline; on macOS clicks and menu commands) and never
123
+ what anyone typed. The sheet doesn't show or ask about it; it goes with every report. `.heresayPrivate()` on a view whose controls
124
+ are named after someone's data.
111
125
 
112
- - `Heresay.present(type:text:)`: opens the sheet, filled in. The person still reviews and sends it.
113
- - `Heresay.nudge()`: the app saw trouble itself (an error screen, a retry that failed): offer to report it. `Heresay.nudge(stuck: true)` for someone who seems unsure. Works without `nudge:`; the same limits apply.
114
- - `Heresay.onSent { event in ... }`: after each report is sent, with `event.id` and `event.type`, never the text.
115
- - `Heresay.introduce(title:message:)`: the one-time introduction in your own words. Leave the
116
- words out unless asked; the default says where to find it.
126
+ ## Crash reports
127
+
128
+ Off by default. `crashReports: .send` on `configure` reports a run that ended badly (a crash, a
129
+ hang, out of memory, a force quit) at the next launch, as Broken, waiting in the inbox for a
130
+ person. Keep `configure` the first line of `init`. It sends diagnostics without asking: the
131
+ privacy policy should say so, and App Store privacy details should list Crash Data and Other
132
+ Diagnostic Data.
133
+
134
+ ```swift
135
+ Heresay.configure(key: "KEY", url: URL(string: "HERESAY_URL")!, crashReports: .send)
136
+ ```
117
137
 
118
138
  ## Can't be changed
119
139
 
120
- The Heresay mark, the report types' names, the Your reports tab (people must be able to read why
121
- a report was declined), and "Powered by Heresay" in the sheet and the introduction. People
122
- should be able to tell the app uses an outside tool. Don't cover or remove them.
140
+ The Heresay mark, the report types' names, "Your reports" (people must be able to read
141
+ why a report was declined), and "Sent to this app's team · Powered by Heresay" at the foot of every view. Don't
142
+ cover or remove them.
123
143
 
124
- After changing it, run the app and look at the button, the open sheet and the introduction.
144
+ Other `HeresayStyle` parameters still work (button, size, fill, shadow, markFollowsAccent,
145
+ typeface, placeholder, types, thanks, sheet, showsPreferences; showsPreferences now hides the "Your name and email" row at the bottom of Your reports), as do `trail:` and `nudge:` on
146
+ `configure` and `Heresay.nudge()`. Leave them as they are in existing apps and don't add them
147
+ unless asked.
@@ -1,125 +1,161 @@
1
1
  # Change how Heresay looks in a web app
2
2
 
3
- Goal: the Report button fits the app, with the fewest changes. **The defaults are the
4
- recommended setup.** Change something only when the person asks, or when the app clearly needs
5
- it (see "When to change what"). Every option is a `data-` attribute on the same script tag;
6
- nothing needs CSS, and the app's CSS can't reach the widget anyway.
3
+ The defaults are the recommended setup. Change something only when the person asks or the app
4
+ clearly needs it. Options are `data-` attributes on the same script tag; no CSS is needed (and
5
+ the app's CSS can't reach the widget). The dashboard's **Design** page previews them and gives
6
+ the tag; if the person pasted its prompt, do exactly that.
7
7
 
8
- The easiest way to choose is the dashboard: open the app, then **Design**. It shows the real
9
- widget with the choices applied and gives the exact tag, plus a prompt for you. If the person
10
- pasted that prompt, do what it says and nothing more.
11
-
12
- ## When to change what
13
-
14
- | The app has... | Do this |
15
- | --- | --- |
16
- | Its own "Send feedback" or help menu | `data-button="none"`, and make that menu item call `window.Heresay?.open()` |
17
- | A chat bubble or cookie banner in the bottom right | `data-position="left"`, or `data-offset="20,96"` to sit above it |
18
- | A brand colour | `data-accent="#rrggbb"` (the logo follows it) |
19
- | Only a dark theme, or only a light one | `data-theme="dark"` or `"light"`; otherwise leave it following the device |
20
- | French, Tamil or Hindi users | nothing, if `<html lang>` is set (`fr`, `ta`, `hi`); otherwise `data-lang` with that code, or `"auto"` |
21
- | An error screen or "Something went wrong" page | a button there that calls `window.Heresay?.open({ type: 'broken', text: '<what failed>' })` |
22
- | Pages where a floating button gets in the way (checkout, login) | `data-hide-on="/checkout,/login"` |
23
-
24
- ## Every option
8
+ ## Options
25
9
 
26
10
  The first value is the default.
27
11
 
28
- **The button**
29
-
30
12
  | Attribute | Values |
31
13
  | --- | --- |
32
- | `data-position` | `right` · `left` · `top-right` · `top-left` · `center` (bottom centre) |
33
- | `data-offset` | `20` · any number of px, or `x,y` like `24,96` (at most 400) |
34
- | `data-button` | `always` · `none` (no button; open it yourself) · `desktop` (not on phones) · `scroll` (after the first scroll; after 10 s on a page that doesn't scroll) |
35
- | `data-label` | `Report` · any text up to 40 characters, e.g. `Feedback` |
36
- | `data-style` | `pill` · `icon` (icon only; the label stays as its accessible name) · `tab` (on the side edge) |
37
- | `data-size` | `regular` · `small` · `large` |
38
- | `data-fill` | `neutral` · `accent` (filled with the accent colour) |
39
- | `data-shadow` | `soft` · `none` · `strong` |
40
- | `data-hide-on` | comma-separated paths; each hides the button on that path and everything under it |
41
-
42
- **Look**
43
-
44
- | Attribute | Values |
45
- | --- | --- |
46
- | `data-accent` | Heresay peacock · any hex colour, `#rgb` or `#rrggbb`. Anything else is ignored. |
47
- | `data-mark` | `accent` (the logo follows the accent) · `heresay` (keep the Heresay teal) |
14
+ | `data-key` | the app's key (required) |
15
+ | `data-layout` | `composer` (type pills and a text box) · `steps` (pick what it is, then say it) · `bar` (a compact box beside the button); see Layout |
16
+ | `data-position` | `bottom-right` · `bottom-left` · `top-right` · `top-left` · `bottom-center` · `left-tab` · `right-tab` (a tab on the side edge) · `none` (no button) |
17
+ | `data-offset` | `20` · px from the edges, or `x,y` like `24,96` (at most 400) |
18
+ | `data-hide-on` | none · comma-separated paths; each hides the button on that path and under it |
19
+ | `data-label` | `Report` · any text up to 40 characters |
20
+ | `data-accent` | Heresay peacock · a hex colour (`#rgb` or `#rrggbb`). The logo follows it. |
48
21
  | `data-theme` | `auto` (follows the device) · `light` · `dark` |
49
- | `data-font` | `system` · `inherit` (the page's font) |
50
-
51
- **Words**
22
+ | `data-lang` | the page's `<html lang>` · `auto` (the browser's) · `en` · `fr` · `ta` · `hi`. Others show English. |
23
+ | `data-intro` | not set (the app calls `introduce()`) · `auto` (a few seconds after the first visit) |
24
+ | `data-version` | the app's version, attached to every report |
25
+
26
+ ## Layout
27
+
28
+ `data-layout` picks how the report form looks and behaves. The type is always required, Send stays
29
+ disabled until a type is chosen and something is typed, and the reporter never picks a priority
30
+ (the type sets it). Every layout has the same "Your reports" view (clock icon, or the "Your
31
+ reports" button in `composer`), the same types (`data-types` leaves some out: fewer pills, rows or
32
+ menu items), and the same words in English, French, Tamil and Hindi. It works with
33
+ `data-position`, `data-offset`, `data-accent`, `data-theme`, `data-lang`, `data-label` and
34
+ `Heresay.open({ type, text })`, which preselects the type and fills the text.
35
+
36
+ Choose `composer` unless the app clearly fits another, or the person asks. Compactness runs
37
+ bar (most compact), composer, steps; guidance runs the other way, steps (most guided), composer, bar.
38
+
39
+ **`composer`** (default). Best for most apps: web apps, sites, SaaS, anything with no strong reason
40
+ to pick another.
41
+ - The reporter taps the button. A panel opens beside it with a header (mark, "Report", "Your
42
+ reports" with a dot when something has an update, close), one row of four type pills (Broken,
43
+ Confusing, Could be better, Idea), a text box whose placeholder follows the type ("What went
44
+ wrong?"), Send, and one footer line.
45
+ - Tap a pill, type, tap Send. A check and "Sent. You'll see the reply under Your reports." appear,
46
+ with Done.
47
+ - On phones (under 600px) the panel is a bottom sheet over a dimmed page. On wider screens it
48
+ opens beside the button, away from the edge, and never covers the button.
49
+ - Tag: `<script src="SDK_URL" data-key="KEY" defer></script>` (no attribute needed), or
50
+ `data-layout="composer"`.
51
+
52
+ **`steps`**: one question at a time. Best for consumer apps, less-technical or mobile-first
53
+ audiences, and people who don't know what to write: picking "what is it" first makes the text easier.
54
+ - The reporter taps the button. Screen 1 reads "What's going on?" with four full-width rows (warning
55
+ triangle Broken, question circle Confusing, trending-up arrow Could be better, light bulb Idea),
56
+ a clock icon for Your reports (with an unread dot) and close. Tapping a row moves to screen 2:
57
+ a back arrow, the chosen type as a pill, a text box with that type's placeholder, Send and the
58
+ footer. Back returns to the rows and keeps what was typed.
59
+ - Two taps and some words. Sent view as in `composer`.
60
+ - With `data-types`, only those rows show. `Heresay.open({ type })` jumps straight to screen 2.
61
+ - On phones it is a bottom sheet over a dimmed page; the rows are large tap targets.
62
+ - Tag: `<script src="SDK_URL" data-key="KEY" data-layout="steps" defer></script>`
63
+
64
+ **`bar`**: a compact floating composer, not a panel. Best for dense or professional tools (dashboards,
65
+ editors, admin screens, data tables) where a panel would cover the work. The page behind stays usable.
66
+ - The reporter taps the button. A small bar opens beside it: a "Type" chip, a one-line text input
67
+ "Tell the team…" that grows as they type, and a round send arrow. Tapping the chip opens a small
68
+ menu of the four types with icons (arrow keys, Enter, Escape); the chip then shows the chosen
69
+ type and the placeholder follows it. The arrow is disabled until a type and some text exist
70
+ (Enter sends, Shift+Enter adds a line). A second row has the Your reports clock icon (with its
71
+ dot), "Powered by Heresay" and close.
72
+ - After sending, the bar shows a check, "Sent. Replies show under Your reports." and Done. Your
73
+ reports opens the normal Your reports panel, and its back arrow returns to the bar.
74
+ - On phones (under 600px) the bar docks to the bottom edge at full width and rides above the keyboard.
75
+ - `data-panel` is ignored by the bar, except `beside` (next to the app's own button). There is no backdrop.
76
+ - Tag: `<script src="SDK_URL" data-key="KEY" data-layout="bar" defer></script>`
77
+
78
+ **With `data-position`.** The panel or bar opens beside the button, in its corner, away from the
79
+ edge, with room for the button and the same `data-offset`; with `left-tab` or `right-tab` it sits
80
+ beside the tab, vertically centred. With `data-position="none"` the app opens it from its own
81
+ item (see How it opens): a centred window by default, or next to that item with `data-panel="beside"`; the named corner
82
+ is used only for the nudge note. Examples:
83
+ `data-layout="steps" data-position="bottom-left"`, `data-layout="bar" data-position="none"`.
84
+
85
+ ## How it opens
86
+
87
+ | How it is opened | Where the panel appears (web, any layout) |
88
+ | --- | --- |
89
+ | Floating button (any position or tab) | Beside the button |
90
+ | The app's own trigger (`Heresay.open()` called during a click or key press, or any element with `data-heresay-open`), no `data-panel` | **A centred window with the page dimmed (the default and the recommendation).** Bar layout: docked at the bottom centre |
91
+ | The app's own trigger with `data-panel="beside"` (opt-in) | A popover next to that trigger, on the side with the most room (right of a left-sidebar item, left of a right-sidebar item, below a header button, above a footer item), aligned to its edge and kept on screen |
92
+ | `data-panel="beside"` and a trigger inside a menu that closes when clicked | Next to where the trigger was at the moment of the click |
93
+ | Code with no click (an error screen, a timer) | Centred, page dimmed |
94
+ | The "Something not working?" note with no floating button | The note sits in the bottom corner; the panel then opens in that corner |
95
+ | Page scrolls or resizes while it is open (`beside`) | Stays attached to the trigger, always fully on screen |
96
+ | Phones (under 600px) | Bottom sheet (bar: docked bar), whatever the trigger |
97
+
98
+ `data-panel="sheet"` (full-height side), `data-panel="center"` and `data-panel="corner"` always win over the
99
+ trigger. Clicking outside the panel closes it and focus returns to the trigger; the typed text and chosen type
100
+ are kept until the report is sent. `Heresay.open({ anchor: element })` (an element or a rectangle
101
+ `{ left, top, width, height }`) also centres the window unless `data-panel="beside"` is set.
102
+
103
+ ## Placement
52
104
 
53
- | Attribute | Values |
105
+ | The app has... | Do this |
54
106
  | --- | --- |
55
- | `data-lang` | the page's `<html lang>` · `auto` (the browser's) · `en` · `fr` · `ta` (Tamil) · `hi` (Hindi). Other languages show English. |
56
- | `data-placeholder` | the question in the text box, up to 120 characters |
57
- | `data-types` | all four · a comma list of `broken`, `confusing`, `improvement`, `idea`. Their names can't change: the type sets the priority. |
58
- | `data-thanks` | none · a line shown after sending, up to 160 characters. Don't promise a fix. |
107
+ | Its own feedback or help menu item | `data-position="none"`, plus `data-heresay-open` on that element (preferred, no JavaScript; `data-heresay-open="broken"` starts as that type) or `onclick` calling `window.Heresay?.open()`. The panel opens as a centred window (recommended); ask the person "Open Heresay as a centred window (recommended) or next to your button?" and add `data-panel="beside"` only if they pick next to the button |
108
+ | A chat bubble, cookie banner or bottom nav in the bottom right | `data-position="bottom-left"` or `data-offset="20,96"` |
109
+ | A mobile bottom tab bar | `data-offset="16,72"` |
110
+ | Pages where it's in the way | `data-hide-on="/checkout,/login"` |
111
+ | An error screen | a button calling `window.Heresay?.open({ type: 'broken', text: '<what failed>' })` |
59
112
 
60
- Intro wording: `window.Heresay?.introduce({ title, body })`. Leave it out unless asked; the
61
- default says what matters.
113
+ ## The mark in your own button
62
114
 
63
- **The panel**
115
+ `data-heresay-mark` on any element (an empty `<span>` inside the app's own button) fills it with the
116
+ Heresay mark, 1em square and hidden from screen readers. It takes the accent (`data-accent`, unless
117
+ `data-mark="heresay"`); `data-heresay-mark="currentColor"` takes the text colour. Elements added later
118
+ are filled too; elements without the attribute are never touched.
64
119
 
65
- | Attribute | Values |
66
- | --- | --- |
67
- | `data-panel` | `corner` (next to the button) · `sheet` (full height on that side) · `center` |
68
- | `data-width` | `regular` · `narrow` · `wide` |
69
- | `data-backdrop` | `dim` · `clear` · `blur` |
70
- | `data-preferences` | `show` · `hide` (hide it when the app calls `identify()` and wants nothing else asked) |
71
- | `data-intro` | not set (the app calls `introduce()`) · `auto` (3 s after the first visit) |
72
-
73
- **The trail**
74
-
75
- With each report, the widget attaches what happened in the app in the last few minutes:
76
- pages visited (with their titles), what was clicked (by its label, and the dialog, form or menu
77
- it was in), forms sent and fields the browser refused (by label and why), requests that failed
78
- or took 3 s or more (with how long), errors, console warnings, alerts the app showed, freezes of
79
- a second or more, and leaving the tab and coming back. Each report also carries the device
80
- around the app: phone or desktop, touch or mouse, screen, light or dark, language, time zone,
81
- connection, and settings such as reduced motion. The reporter sees all of it in the form and can
82
- switch the trail off or leave parts out. Never what anyone typed, request bodies, headers or
83
- query strings. It survives a reload or a new page in the same tab (kept in that tab's
84
- `sessionStorage`), says "The page was reloaded", and, with `data-version`, "First visit since the
85
- app updated from 1.3 to 1.4". On by default; change it only when asked.
120
+ ```html
121
+ <button data-heresay-open><span data-heresay-mark></span> Report a problem</button>
122
+ ```
86
123
 
87
- | Attribute | Values |
88
- | --- | --- |
89
- | `data-trail` | on (default) · `off` · the parts to keep, e.g. `pages errors requests` (from `pages`, `clicks`, `requests`, `errors`) |
90
- | `data-heresay-private` | on any element of the app: clicks on it are recorded as "button", without its text |
124
+ ## What to recommend
91
125
 
92
- **Offering help**
126
+ The design choices worth proposing to the person (own-button mark, wording, where, error screens, brand) are listed with their reasons in guide `install-web`, "What to recommend". Propose, explain in a sentence, accept their answer; never apply a design change unasked.
93
127
 
94
- When someone seems stuck, a small note by the button asks "Something not working?" and opens the
95
- form as Broken, with the trail. Watched on the device, never sent. At most once per tab. Off by default:
96
- it appears on the app's own page, so add it only when asked.
128
+ ## Calls
97
129
 
98
- | Attribute | Values |
99
- | --- | --- |
100
- | `data-nudge` | off (default) · `on` (all of these) · the signals to watch, e.g. `clicks errors`. When something failed ("Something not working?", opens as Broken): `clicks`: the same button or link pressed 3 times in 10 s with no change to the page; `errors`: an uncaught error within 5 s of a click; `requests`: 2 requests failing with 5xx or no answer within 30 s. When someone seems unsure ("Stuck on something?", opens as Confusing): `stalled`: typed in a field, then 45 s with no more typing and nothing sent, while still moving or scrolling (search boxes don't count); `circles`: 6 page changes in a minute among at most 3 pages; `refused`: the same field refused 3 times in 2 minutes |
130
+ - `Heresay?.identify({ id, label, email })`, `identify()` on sign-out.
131
+ - `Heresay?.open({ type, text })`: opens the form, filled in. The person still reviews and sends.
132
+ - `Heresay?.introduce({ title, body })`: the one-time bubble; the default words are fine.
133
+ - `Heresay?.setScreen(name)`: for screens that change without the URL changing.
134
+ - `Heresay?.on('sent', ({ id, type }) => ...)`: after each send; never gets the text. Returns an unsubscribe function.
101
135
 
102
- **Calls**
136
+ ## The trail
103
137
 
104
- - `window.Heresay?.open({ type, text })`: opens the form, filled in. The person still reviews and sends it.
105
- - `window.Heresay?.nudge()`: the app saw trouble itself (an error screen, a retry that failed): offer to report it. `nudge({ stuck: true })` for someone who seems unsure. Works without `data-nudge`; the same limits apply.
106
- - `window.Heresay?.on('sent', ({ id, type }) => ...)`: after each report is sent, for example to thank them or count it in the app's analytics. It returns a function that stops listening. It never gets the report text.
138
+ On by default, each report carries what happened in the last few minutes (pages, clicks by
139
+ label, failed requests, errors, device) and never what anyone typed. It is collected without
140
+ being shown to the reporter, who has nothing to switch. You control it with `data-trail` (`off`, or
141
+ the parts to keep) and `data-heresay-private` on elements whose labels are personal data.
107
142
 
108
143
  ## Can't be changed
109
144
 
110
- The Heresay mark on the button, the report types' names, the "Your reports" tab (people must
111
- be able to read why a report was declined), and the "Powered by Heresay" line in the panel and
112
- the introduction. People should be able to tell the app uses an outside tool. Don't hide these
113
- with CSS, `::part` or scripts.
145
+ The Heresay mark on the button, the report types' names, the "Your reports" tab (people must be
146
+ able to read why a report was declined), and "Powered by Heresay" in the panel and the
147
+ introduction. People should be able to tell the app uses an outside tool. Don't hide these with
148
+ CSS, `::part` or scripts.
114
149
 
115
150
  ## Example
116
151
 
117
152
  ```html
118
153
  <script src="SDK_URL" data-key="KEY"
119
- data-position="left" data-accent="#7c3aed" data-label="Feedback"
154
+ data-position="bottom-left" data-accent="#7c3aed" data-label="Feedback"
120
155
  defer></script>
121
156
  ```
122
157
 
123
158
  In Next.js, Nuxt and the rest, add the same attributes to the tag's existing form (for example
124
- `<Script ... data-position="left" />`). After changing it, run the app and look at the button,
125
- the open panel and the introduction.
159
+ `<Script ... data-position="bottom-left" />`). Then run the app and look at the button and the panel.
160
+
161
+ Older attributes (data-button, data-style, data-size, data-fill, data-shadow, data-mark, data-font, data-panel, data-width, data-backdrop, data-preferences, data-placeholder, data-types, data-thanks, data-trail, data-nudge) still work; leave them as they are in existing apps and don't add them unless asked.
@@ -1,11 +1,11 @@
1
1
  {
2
- "skill_version": 5,
2
+ "skill_version": 13,
3
3
  "topics": {
4
4
  "start": "What Heresay is, the rules, and which topic to read next",
5
5
  "install-web": "Add the Heresay web SDK to an app, for any framework, and prove it works",
6
- "customize-web": "Change how the web widget looks and where it sits: every option, the recommended defaults, and when to change them",
6
+ "customize-web": "Change the web layout (composer, steps, bar), where the button sits and a few looks: position, offset, hide-on, label, accent, theme, language",
7
7
  "install-apple": "Add the Heresay Swift package to an iOS or macOS app",
8
- "customize-apple": "Change how Heresay looks in an iOS or macOS app: HeresayStyle, the recommended defaults, and when to change them",
8
+ "customize-apple": "Change where Heresay sits and a few looks in an iOS or macOS app: HeresayStyle position, offset, label, theme, language",
9
9
  "fix-brief": "Fix an accepted report: find, claim, fix, hand off, mark fixed",
10
10
  "write-note": "Write the note the reporter reads when a report is fixed",
11
11
  "uninstall": "Remove Heresay from an app, and disconnect the repo",