create-heresay 0.2.10 → 0.2.11
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/package.json +1 -1
- package/release/VERSION +1 -1
- package/release/functions/lib/core/version.js +1 -1
- package/release/public/dashboard.css +80 -0
- package/release/public/dashboard.js +423 -0
- package/release/public/demo.html +5 -1
- package/release/public/docs.html +32 -6
- package/release/public/guides/changes.json +18 -0
- package/release/public/guides/customize-apple.md +74 -0
- package/release/public/guides/customize-web.md +95 -0
- package/release/public/guides/index.json +3 -1
- package/release/public/guides/install-apple.md +4 -2
- package/release/public/guides/install-web.md +6 -2
- package/release/public/guides/start.md +3 -0
- package/release/public/llms.txt +2 -0
- package/release/public/sdk.js +429 -97
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-heresay",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Set up your own Heresay: in-app feedback that every report gets a hearing. Creates a Firebase project in your Google account and deploys the dashboard, API and SDK to it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/release/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.11
|
|
@@ -232,3 +232,83 @@ a.platform:hover { border-color:var(--acc); box-shadow:0 0 0 3px var(--mist); }
|
|
|
232
232
|
.update-in p { margin:0; flex:1 1 360px; font-size:14px; color:var(--deep); }
|
|
233
233
|
.update-in b { margin-right:4px; }
|
|
234
234
|
.update-in code { white-space:nowrap; }
|
|
235
|
+
|
|
236
|
+
/* design */
|
|
237
|
+
#view.wide { max-width:1280px; }
|
|
238
|
+
.design { display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1.15fr); gap:28px; align-items:start; }
|
|
239
|
+
.design-group { font-size:13px; font-family:inherit; text-transform:uppercase; letter-spacing:.08em; color:var(--mute); margin:26px 0 4px; }
|
|
240
|
+
.design-group:first-child { margin-top:0; }
|
|
241
|
+
.design-item { padding:12px 0; border-bottom:1px solid var(--line); }
|
|
242
|
+
.design-item > b { display:block; margin-bottom:8px; }
|
|
243
|
+
.design-item .filters { margin:0; align-items:center; }
|
|
244
|
+
.design-item .filters input[type=text] { padding:4px 10px; border-radius:999px; font-size:14px; width:180px; }
|
|
245
|
+
.design-item .hint { margin-top:6px; }
|
|
246
|
+
.swatch { display:inline-block; width:11px; height:11px; border-radius:50%; margin-right:6px; vertical-align:-1px; }
|
|
247
|
+
.pick-colour { display:inline-flex; align-items:center; gap:6px; font-size:14px; color:var(--mute); }
|
|
248
|
+
.pick-colour input { width:28px; height:28px; padding:0; border-radius:50%; border:1px solid var(--line); overflow:hidden; }
|
|
249
|
+
.design-fixed { margin-top:18px; }
|
|
250
|
+
.design-side { position:sticky; top:76px; display:flex; flex-direction:column; gap:10px; }
|
|
251
|
+
.design-toolbar { margin-top:0; justify-content:space-between; }
|
|
252
|
+
.design-toolbar .seg { margin:0; }
|
|
253
|
+
.design-frame { width:100%; height:calc(100vh - 260px); min-height:480px; max-height:720px; border:1px solid var(--line); border-radius:14px; background:#fff; }
|
|
254
|
+
.design-side .row { margin-top:0; }
|
|
255
|
+
.design-side .code pre { max-height:220px; }
|
|
256
|
+
@media (max-width:960px) { .design { grid-template-columns:1fr; } .design-side { position:static; } }
|
|
257
|
+
|
|
258
|
+
/* design: a likeness of the Swift package on iPhone and Mac */
|
|
259
|
+
.apple-frame { position:relative; overflow:hidden; display:grid; place-items:center; background:var(--soft); }
|
|
260
|
+
.am { --bg:#fff; --fg:#111; --mute:#6e6e73; --fill:rgba(120,120,128,.08); --line:rgba(60,60,67,.14); --card:#fff; color:var(--fg); font-size:13px; line-height:1.35; }
|
|
261
|
+
.am.dark { --bg:#1c1c1e; --fg:#f2f2f7; --mute:#98989f; --fill:rgba(120,120,128,.18); --line:rgba(84,84,88,.5); --card:#2c2c2e; }
|
|
262
|
+
.am b { font-weight:600; }
|
|
263
|
+
.am-mark { display:inline-block; flex:none; -webkit-mask:url(/mark.svg) center / contain no-repeat; mask:url(/mark.svg) center / contain no-repeat; }
|
|
264
|
+
.am-phone { position:relative; width:300px; height:610px; border-radius:44px; background:#f2f2f7; border:10px solid #111; overflow:hidden; box-shadow:0 20px 50px rgb(0 0 0 / .18); }
|
|
265
|
+
.am.app-dark .am-phone, .am.app-dark .am-window { background:#000; color:#f2f2f7; }
|
|
266
|
+
.am-status { display:flex; justify-content:space-between; align-items:center; padding:14px 26px 0; font-weight:600; font-size:14px; }
|
|
267
|
+
.am-status i { width:86px; height:24px; border-radius:14px; background:#111; position:absolute; left:50%; top:9px; transform:translateX(-50%); }
|
|
268
|
+
.am-content { padding:22px 16px; }
|
|
269
|
+
.am-content h3 { font:700 28px/1.1 -apple-system,system-ui,sans-serif; margin:10px 4px 12px; }
|
|
270
|
+
.am-content ul { list-style:none; margin:0; padding:0; background:#fff; border-radius:12px; }
|
|
271
|
+
.am.app-dark .am-content ul { background:#1c1c1e; }
|
|
272
|
+
.am-content li { padding:11px 14px; border-bottom:1px solid rgba(60,60,67,.12); font-size:15px; }
|
|
273
|
+
.am-content li:last-child { border:0; }
|
|
274
|
+
.am-btn { position:absolute; z-index:2; display:flex; align-items:center; gap:6px; white-space:nowrap; }
|
|
275
|
+
.am-dim { position:absolute; inset:0; background:rgb(0 0 0 / .3); z-index:3; }
|
|
276
|
+
.am-sheet { position:absolute; z-index:4; left:0; right:0; bottom:0; top:44px; background:var(--bg); color:var(--fg); border-radius:14px 14px 0 0; display:flex; flex-direction:column; overflow:hidden; }
|
|
277
|
+
.am-sheet.compact { top:48%; }
|
|
278
|
+
.am-sheet.large { top:0; border-radius:0; padding-top:30px; }
|
|
279
|
+
.am-sheet.mac { left:50%; right:auto; top:28px; bottom:12px; transform:translateX(-50%); width:380px; border-radius:0 0 12px 12px; box-shadow:0 16px 40px rgb(0 0 0 / .3); }
|
|
280
|
+
.am-sheet.mac.compact { width:340px; } .am-sheet.mac.large { width:460px; padding-top:0; }
|
|
281
|
+
.am-head { display:flex; align-items:center; gap:10px; padding:16px 16px 10px; }
|
|
282
|
+
.am-head div { flex:1; } .am-head b { display:block; font-size:15px; } .am-head span { color:var(--mute); font-size:12px; }
|
|
283
|
+
.am-head em { font-style:normal; color:var(--mute); width:24px; height:24px; border-radius:50%; background:var(--fill); display:grid; place-items:center; font-size:11px; }
|
|
284
|
+
.am-seg { display:flex; margin:0 16px 10px; padding:2px; border-radius:8px; background:var(--fill); }
|
|
285
|
+
.am-seg span { flex:1; text-align:center; padding:4px 2px; font-size:11.5px; border-radius:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
286
|
+
.am-seg span.on { background:var(--card); box-shadow:0 1px 2px rgb(0 0 0 / .12); font-weight:600; }
|
|
287
|
+
.am-body { flex:1; overflow:hidden; padding:10px 16px; border-top:1px solid var(--line); }
|
|
288
|
+
.am-lab { margin:4px 0 6px; color:var(--mute); font-weight:600; font-size:12px; }
|
|
289
|
+
.am-types { display:grid; gap:6px; margin-bottom:10px; } .am-types.grid { grid-template-columns:1fr 1fr; }
|
|
290
|
+
.am-type { display:flex; gap:8px; align-items:flex-start; padding:8px; border-radius:10px; background:var(--fill); border:1px solid var(--line); }
|
|
291
|
+
.am-type b { display:block; font-size:12.5px; } .am-type i { font-style:normal; color:var(--mute); font-size:11px; }
|
|
292
|
+
.am-ti { flex:none; width:24px; height:24px; border-radius:50%; display:grid; place-items:center; font-size:12px; font-weight:700; }
|
|
293
|
+
.am-text { min-height:48px; padding:8px; border-radius:10px; background:var(--fill); border:1px solid var(--line); color:var(--mute); }
|
|
294
|
+
.am-powered { display:flex; justify-content:center; align-items:center; gap:5px; padding:6px; color:var(--mute); font-size:11px; font-weight:500; }
|
|
295
|
+
.am-foot { display:flex; align-items:center; gap:8px; padding:10px 16px 14px; border-top:1px solid var(--line); background:var(--fill); }
|
|
296
|
+
.am-foot span { flex:1; color:var(--mute); font-size:11px; }
|
|
297
|
+
.am-foot u, .am-sent u { text-decoration:none; padding:5px 10px; border-radius:7px; background:var(--card); border:1px solid var(--line); font-size:12px; }
|
|
298
|
+
.am-foot strong, .am-sent strong { color:#fff; padding:6px 14px; border-radius:8px; font-size:12.5px; opacity:.55; }
|
|
299
|
+
.am-sent { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; text-align:center; }
|
|
300
|
+
.am-sent b { font-size:17px; } .am-sent p { margin:0; max-width:240px; } .am-sent div { display:flex; gap:8px; margin-top:6px; } .am-sent strong { opacity:1; }
|
|
301
|
+
.am-alert { position:absolute; z-index:4; left:50%; top:50%; transform:translate(-50%, -50%); width:250px; padding:18px 16px 12px; border-radius:22px; background:var(--card); color:var(--fg); box-shadow:0 20px 40px rgb(0 0 0 / .25); }
|
|
302
|
+
.am-alert b { display:block; font-size:15px; margin-bottom:6px; } .am-alert p { margin:0 0 8px; color:var(--mute); font-size:12.5px; }
|
|
303
|
+
.am-alert div { display:flex; gap:8px; margin-top:12px; } .am-alert div span { flex:1; text-align:center; padding:8px; border-radius:999px; background:var(--fill); font-weight:600; }
|
|
304
|
+
.am-mac { width:100%; height:100%; display:flex; flex-direction:column; align-items:center; padding:0 0 24px; }
|
|
305
|
+
.am-menubar { align-self:stretch; display:flex; gap:16px; align-items:center; padding:4px 14px; background:rgb(246 246 246 / .95); border-bottom:1px solid #ddd; font-size:13px; color:#111; }
|
|
306
|
+
.am-menubar b:first-child { width:12px; height:14px; background:#111; border-radius:3px; } .am-menubar span.on { background:#2d6cdf; color:#fff; border-radius:4px; padding:0 6px; }
|
|
307
|
+
.am-menu { position:absolute; z-index:5; top:24px; left:196px; min-width:220px; display:flex; justify-content:space-between; padding:5px 10px; margin:4px; border-radius:6px; background:#2d6cdf; color:#fff; box-shadow:0 0 0 5px rgb(246 246 246), 0 10px 24px rgb(0 0 0 / .2); font-size:13px; }
|
|
308
|
+
.am-menu kbd { font:inherit; opacity:.85; }
|
|
309
|
+
.am-window { position:relative; margin-top:26px; width:min(560px, 92%); flex:1; border-radius:12px; background:#fff; border:1px solid #d4d4d8; overflow:hidden; box-shadow:0 20px 50px rgb(0 0 0 / .18); }
|
|
310
|
+
.am-titlebar { height:28px; display:flex; align-items:center; gap:7px; padding:0 12px; background:#ececee; border-bottom:1px solid #d4d4d8; font-size:12px; color:#555; }
|
|
311
|
+
.am.app-dark .am-titlebar { background:#2a2a2c; border-color:#3a3a3c; color:#ccc; }
|
|
312
|
+
.am-titlebar i { width:11px; height:11px; border-radius:50%; background:#ff5f57; } .am-titlebar i:nth-child(2) { background:#febc2e; } .am-titlebar i:nth-child(3) { background:#28c840; }
|
|
313
|
+
.am-titlebar span { flex:1; text-align:center; margin-right:40px; }
|
|
314
|
+
.am-mac .am-content h3 { font-size:22px; }
|
|
@@ -199,12 +199,14 @@
|
|
|
199
199
|
});
|
|
200
200
|
var view = $('view');
|
|
201
201
|
view.textContent = '';
|
|
202
|
+
view.classList.remove('wide');
|
|
202
203
|
if (parts[0] === 'team') return teamView(view);
|
|
203
204
|
if (parts[0] === 'connect') return connectView(view, query);
|
|
204
205
|
if (parts[0] === 'new') return newAppView(view, parts[1], query);
|
|
205
206
|
if (parts[0] === 'apps' && parts[1]) {
|
|
206
207
|
return withProject(parts[1], function (p) {
|
|
207
208
|
if (parts[2] === 'setup') setupView(view, p);
|
|
209
|
+
else if (parts[2] === 'design' && (p.platform === 'web' || platformOf(p.platform).apple)) designView(view, p);
|
|
208
210
|
else if (parts[2] === 'delete') deleteView(view, p);
|
|
209
211
|
else reportsView(view, p);
|
|
210
212
|
});
|
|
@@ -235,6 +237,8 @@
|
|
|
235
237
|
{ id: 'flutter', label: 'Flutter', note: 'Dart, any platform',
|
|
236
238
|
icon: '<path d="M14 3 5 12l3 3L20 3zM14 12l-5 5 5 5h6l-5-5 5-5z"/>' },
|
|
237
239
|
];
|
|
240
|
+
/** Platforms with an SDK whose look can be designed. */
|
|
241
|
+
var designable = function (p) { return p.platform === 'web' || !!platformOf(p.platform).apple; };
|
|
238
242
|
var platformOf = function (id) { return PLATFORMS.filter(function (x) { return x.id === id; })[0] || PLATFORMS[0]; };
|
|
239
243
|
/** Apps that are platforms of one product share its id: the first app's. */
|
|
240
244
|
var productOf = function (p) { return p.product_id || p.id; };
|
|
@@ -432,6 +436,422 @@
|
|
|
432
436
|
form.name.focus();
|
|
433
437
|
}
|
|
434
438
|
|
|
439
|
+
// ---- design ----------------------------------------------------------------------------
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* What a developer can change about the web widget, and the value we recommend first. Only
|
|
443
|
+
* what differs from the recommendation goes in the tag. The full list: public/guides/customize-web.md.
|
|
444
|
+
*/
|
|
445
|
+
var DESIGN = [
|
|
446
|
+
{ group: 'The button', items: [
|
|
447
|
+
{ a: 'position', label: 'Where it sits', c: [['', 'Bottom right'], ['left', 'Bottom left'], ['top-right', 'Top right'], ['top-left', 'Top left'], ['center', 'Bottom centre']] },
|
|
448
|
+
{ a: 'offset', label: 'Distance from the edge', c: [['', '20px'], ['40', '40px'], ['96', '96px, above a chat bubble']], text: 'or x,y like 24,96', pattern: /^\d{1,3}(\s*,\s*\d{1,3})?$/ },
|
|
449
|
+
{ a: 'button', label: 'When it shows', c: [['', 'Always'], ['none', 'Never: my app has its own menu item'], ['desktop', 'Not on phones'], ['scroll', 'After the first scroll']] },
|
|
450
|
+
{ a: 'label', label: 'Text', c: [['', 'Report'], ['Feedback', 'Feedback'], ['Help us improve', 'Help us improve'], ['Found a bug?', 'Found a bug?']], text: 'or your own words', max: 40 },
|
|
451
|
+
{ a: 'style', label: 'Style', c: [['', 'Pill with text'], ['icon', 'Icon only'], ['tab', 'Tab on the side']] },
|
|
452
|
+
{ a: 'size', label: 'Size', c: [['', 'Regular'], ['small', 'Small'], ['large', 'Large']] },
|
|
453
|
+
{ a: 'fill', label: 'Button colour', c: [['', 'White, or dark in dark mode'], ['accent', 'Filled with your colour']] },
|
|
454
|
+
{ a: 'shadow', label: 'Shadow', c: [['', 'Soft'], ['none', 'None'], ['strong', 'Strong']] },
|
|
455
|
+
{ a: 'hide-on', label: 'Hide it on these pages', c: [], text: '/checkout, /login', max: 300, hint: 'That path and everything under it.' },
|
|
456
|
+
]},
|
|
457
|
+
{ group: 'Look', items: [
|
|
458
|
+
{ a: 'accent', label: 'Your colour', color: true, c: [['', 'Heresay peacock', '#0f766e'], ['#7c3aed', 'Purple', '#7c3aed'], ['#2563eb', 'Blue', '#2563eb'], ['#e11d48', 'Rose', '#e11d48'], ['#15171c', 'Ink', '#15171c']] },
|
|
459
|
+
{ a: 'mark', label: 'Logo colour', c: [['', 'Follows your colour'], ['heresay', 'Heresay teal']] },
|
|
460
|
+
{ a: 'theme', label: 'Light or dark', c: [['', 'Follow the device'], ['light', 'Always light'], ['dark', 'Always dark']] },
|
|
461
|
+
{ a: 'font', label: 'Font', c: [['', 'System font'], ['inherit', 'My page’s font']] },
|
|
462
|
+
]},
|
|
463
|
+
{ group: 'Words', items: [
|
|
464
|
+
{ a: 'lang', label: 'Language', c: [['', 'My page’s language'], ['auto', 'The browser’s'], ['en', 'English'], ['fr', 'Français'], ['ta', 'தமிழ்'], ['hi', 'हिन्दी']], hint: 'English, French, Tamil and Hindi today; any other language shows English.' },
|
|
465
|
+
{ a: 'placeholder', label: 'Question in the text box', c: [['', 'What happened, or what would you change?']], text: 'or your own words', max: 120 },
|
|
466
|
+
{ a: 'types', label: 'Report types', c: [['', 'All four'], ['broken,confusing,improvement', 'No “Idea”'], ['broken,confusing', 'Only Broken and Confusing']], hint: 'Their names can’t change: the type sets the priority.' },
|
|
467
|
+
{ a: 'thanks', label: 'Thank-you line after sending', c: [['', 'None']], text: 'e.g. Thanks! We read every one.', max: 160 },
|
|
468
|
+
]},
|
|
469
|
+
{ group: 'The panel', items: [
|
|
470
|
+
{ a: 'panel', label: 'Where it opens', c: [['', 'Next to the button'], ['sheet', 'Side sheet'], ['center', 'Middle of the screen']] },
|
|
471
|
+
{ a: 'width', label: 'Width', c: [['', 'Regular'], ['narrow', 'Narrow'], ['wide', 'Wide']] },
|
|
472
|
+
{ a: 'backdrop', label: 'Behind it', c: [['', 'Dim the page'], ['clear', 'Leave the page clear'], ['blur', 'Blur']] },
|
|
473
|
+
{ a: 'preferences', label: 'Preferences tab', c: [['', 'Show'], ['hide', 'Hide']], hint: 'Hide it if your app calls identify() and asks nothing else.' },
|
|
474
|
+
{ a: 'intro', label: 'Introduce the button', c: [['', 'When my app calls introduce()'], ['auto', '3 seconds after the first visit']] },
|
|
475
|
+
]},
|
|
476
|
+
];
|
|
477
|
+
var DESIGN_ITEMS = [].concat.apply([], DESIGN.map(function (g) { return g.items; }));
|
|
478
|
+
|
|
479
|
+
function esc(s) { return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); }
|
|
480
|
+
|
|
481
|
+
/** The data- attributes a design adds to the tag, in the order the list shows them. */
|
|
482
|
+
function designAttrs(cfg) {
|
|
483
|
+
return DESIGN_ITEMS.filter(function (it) { return cfg[it.a]; }).map(function (it) { return ['data-' + it.a, cfg[it.a]]; });
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function designTag(p, cfg) {
|
|
487
|
+
var a = designAttrs(cfg);
|
|
488
|
+
if (!a.length) return tag(p);
|
|
489
|
+
return '<script src="' + SDK_URL + '"\n data-key="' + p.key + '"' +
|
|
490
|
+
a.map(function (x) { return '\n ' + x[0] + '="' + esc(x[1]) + '"'; }).join('') + '\n defer></scr' + 'ipt>';
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/** A made-up page in the app's name, with the real widget on it in preview mode. */
|
|
494
|
+
function previewDoc(p, cfg, show, dark) {
|
|
495
|
+
var own = cfg.button === 'none';
|
|
496
|
+
var attrs = designAttrs(cfg).map(function (x) { return ' ' + x[0] + '="' + esc(x[1]) + '"'; }).join('');
|
|
497
|
+
var then = {
|
|
498
|
+
panel: 'H.open();',
|
|
499
|
+
intro: 'if(!H.introduce())document.getElementById("note").hidden=false;',
|
|
500
|
+
sent: 'H.open({type:"broken",text:"The export button does nothing."});' +
|
|
501
|
+
'document.querySelector("[data-feedback-sdk]").shadowRoot.querySelector(".send").click();',
|
|
502
|
+
}[show] || '';
|
|
503
|
+
return '<!doctype html><html lang="en"><head><meta charset="utf-8"><style>' +
|
|
504
|
+
'body{margin:0;min-height:1400px;font:15px/1.6 Georgia,serif;background:' + (dark ? '#111317;color:#e6e8eb' : '#fff;color:#1d2127') + '}' +
|
|
505
|
+
'header{display:flex;justify-content:space-between;align-items:center;padding:14px 22px;border-bottom:1px solid ' + (dark ? '#262a31' : '#e6e8eb') + ';font-weight:700;font-size:17px}' +
|
|
506
|
+
'nav{display:flex;gap:16px;font:14px system-ui;font-weight:400;opacity:.8}nav a{color:inherit;text-decoration:none}nav a.own{border:1px dashed currentColor;padding:1px 8px;border-radius:6px}' +
|
|
507
|
+
'main{padding:22px;max-width:620px}.bar{height:12px;border-radius:6px;margin:12px 0;background:' + (dark ? '#262a31' : '#eceef1') + '}' +
|
|
508
|
+
'#note{position:fixed;left:22px;bottom:22px;font:13px system-ui;opacity:.7}</style></head><body>' +
|
|
509
|
+
'<header>' + esc(productName(p)) + '<nav><a>Docs</a><a>Settings</a>' + (own ? '<a class="own" href="#" onclick="Heresay.open();return false">Feedback</a>' : '') + '</nav></header>' +
|
|
510
|
+
'<main><h2 style="margin:0 0 8px">Welcome back</h2><p>A paragraph in this page’s own font, so you can see whether the widget matches it.</p>' +
|
|
511
|
+
'<div class="bar" style="width:70%"></div><div class="bar" style="width:52%"></div><div class="bar" style="width:84%"></div></main>' +
|
|
512
|
+
'<p id="note" hidden>' + (own ? 'No button, so no introduction. People open it from “Feedback” in your menu.' : 'No introduction here: the button is hidden on this page.') + '</p>' +
|
|
513
|
+
'<script src="' + SDK_URL + '" data-key="' + p.key + '" data-preview' + attrs + '></scr' + 'ipt>' +
|
|
514
|
+
'<script>var H=window.Heresay;' + then + '</scr' + 'ipt></body></html>';
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** The web kit: the real sdk.js in a sandboxed iframe, and a script tag. */
|
|
518
|
+
function webKit(p) {
|
|
519
|
+
return {
|
|
520
|
+
groups: DESIGN,
|
|
521
|
+
shows: [['button', 'Button'], ['panel', 'Panel'], ['intro', 'Introduction'], ['sent', 'After sending']],
|
|
522
|
+
darkLabel: 'Dark app',
|
|
523
|
+
changes: function (cfg) { return designAttrs(cfg).length; },
|
|
524
|
+
preview: function () {
|
|
525
|
+
var frame = el('iframe', { class: 'design-frame', title: 'Preview', sandbox: 'allow-scripts allow-popups allow-popups-to-escape-sandbox' });
|
|
526
|
+
return { el: frame, draw: function (cfg, show, dark) { frame.srcdoc = previewDoc(p, cfg, show, dark); } };
|
|
527
|
+
},
|
|
528
|
+
code: function (cfg) {
|
|
529
|
+
var out = [codeBlock(designTag(p, cfg))];
|
|
530
|
+
if (cfg.button === 'none') {
|
|
531
|
+
out.push(el('p', { class: 'hint', text: 'Then open it from your own menu item:' }));
|
|
532
|
+
out.push(codeBlock('window.Heresay?.open();'));
|
|
533
|
+
}
|
|
534
|
+
return out;
|
|
535
|
+
},
|
|
536
|
+
prompt: function (cfg) {
|
|
537
|
+
var a = designAttrs(cfg);
|
|
538
|
+
return 'Update the Heresay script tag in this app (the one with data-key="' + p.key + '") so it looks like this. ' +
|
|
539
|
+
'Keep it where it is and keep the framework\'s own way of writing it (for example next/script in Next.js). ' +
|
|
540
|
+
'Remove any other design attributes it has (data-position, data-offset, data-button, data-label, data-style, data-size, data-fill, data-shadow, data-hide-on, data-accent, data-mark, data-theme, data-font, data-lang, data-placeholder, data-types, data-thanks, data-panel, data-width, data-backdrop, data-preferences, data-intro); keep data-key, data-version and anything about the signed-in user.\n\n' +
|
|
541
|
+
designTag(p, cfg) + '\n' +
|
|
542
|
+
(cfg.button === 'none' ? '\nThere is no floating button now, so add a "Send feedback" item to the app\'s own help or account menu that calls window.Heresay?.open().\n' : '') +
|
|
543
|
+
(a.some(function (x) { return x[0] === 'data-intro'; }) ? '' : '\nIf the app doesn\'t call window.Heresay?.introduce() yet, call it once the main screen appears.\n') +
|
|
544
|
+
'\nFor what each option does, read the Heresay guide customize-web (heresay_guide, or npx -y heresay@latest guide customize-web).';
|
|
545
|
+
},
|
|
546
|
+
fixed: 'Always there, whatever you choose: the Heresay mark on the button, the “Your reports” tab (people read why a report was declined), and “Powered by Heresay”, so people can tell your app uses an outside tool.',
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function designView(view, p) {
|
|
551
|
+
var apple = platformOf(p.platform).apple;
|
|
552
|
+
var kit = apple ? appleKit(p) : webKit(p);
|
|
553
|
+
var KEY = 'heresay.design.' + p.id;
|
|
554
|
+
var cfg = {};
|
|
555
|
+
try { cfg = JSON.parse(localStorage.getItem(KEY) || '{}') || {}; } catch (e) { cfg = {}; }
|
|
556
|
+
var show = kit.shows[0][0], dark = false;
|
|
557
|
+
|
|
558
|
+
view.classList.add('wide');
|
|
559
|
+
view.appendChild(el('a', { class: 'back', href: '#/apps/' + p.id, text: '← ' + productName(p) }));
|
|
560
|
+
view.appendChild(el('div', { class: 'head' }, [el('div', {}, [
|
|
561
|
+
el('h1', { text: 'Design the Report button' }),
|
|
562
|
+
el('p', { class: 'mute', text: apple
|
|
563
|
+
? 'Every choice starts on what we recommend. Change what your app needs, then copy the Swift or the prompt for your coding agent. The preview is a close likeness of the ' + platformOf(p.platform).label + ' sheet, with your choices.'
|
|
564
|
+
: 'Every choice starts on what we recommend. Change what your app needs, then copy the tag or the prompt for your coding agent.' }),
|
|
565
|
+
])]));
|
|
566
|
+
|
|
567
|
+
var controls = el('div', { class: 'design-controls' });
|
|
568
|
+
var preview = kit.preview();
|
|
569
|
+
var codeBox = el('div');
|
|
570
|
+
var changed = el('span', { class: 'hint' });
|
|
571
|
+
|
|
572
|
+
function save() { try { localStorage.setItem(KEY, JSON.stringify(cfg)); } catch (e) { /* private mode */ } }
|
|
573
|
+
function redraw() {
|
|
574
|
+
save();
|
|
575
|
+
preview.draw(cfg, show, dark);
|
|
576
|
+
var n = kit.changes(cfg);
|
|
577
|
+
changed.textContent = n ? n + ' change' + (n === 1 ? '' : 's') + ' from the recommended setup' : 'The recommended setup';
|
|
578
|
+
codeBox.textContent = '';
|
|
579
|
+
kit.code(cfg).forEach(function (x) { codeBox.appendChild(x); });
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
kit.groups.forEach(function (g) {
|
|
583
|
+
controls.appendChild(el('h2', { class: 'design-group', text: g.group }));
|
|
584
|
+
g.items.forEach(function (it) {
|
|
585
|
+
var chips = el('div', { class: 'filters' });
|
|
586
|
+
var input = it.text ? el('input', { type: 'text', placeholder: it.text, maxlength: String(it.max || 20), 'aria-label': it.label }) : null;
|
|
587
|
+
var colour = it.color ? el('input', { type: 'color', 'aria-label': 'Any colour', value: cfg[it.a] || '#0f766e' }) : null;
|
|
588
|
+
function sync() {
|
|
589
|
+
var v = cfg[it.a] || '';
|
|
590
|
+
var known = it.c.some(function (c) { return c[0] === v; });
|
|
591
|
+
chips.querySelectorAll('button').forEach(function (b) { b.setAttribute('aria-pressed', String(b.dataset.v === v)); });
|
|
592
|
+
if (input && document.activeElement !== input) input.value = known ? '' : v;
|
|
593
|
+
}
|
|
594
|
+
it.c.forEach(function (c) {
|
|
595
|
+
chips.appendChild(el('button', { type: 'button', 'data-v': c[0], onclick: function () { cfg[it.a] = c[0]; sync(); redraw(); } },
|
|
596
|
+
[c[2] ? el('span', { class: 'swatch', style: 'background:' + c[2] }) : null, c[1] + (c[0] === '' && it.c.length > 1 ? ' ' : ''),
|
|
597
|
+
c[0] === '' && it.c.length > 1 ? el('span', { class: 'n', text: '· recommended' }) : null]));
|
|
598
|
+
});
|
|
599
|
+
if (colour) {
|
|
600
|
+
colour.oninput = function () { cfg[it.a] = colour.value; sync(); redraw(); };
|
|
601
|
+
chips.appendChild(el('label', { class: 'pick-colour' }, [colour, 'Any colour']));
|
|
602
|
+
}
|
|
603
|
+
if (input) {
|
|
604
|
+
input.oninput = function () {
|
|
605
|
+
var v = input.value.trim();
|
|
606
|
+
if (!v) cfg[it.a] = '';
|
|
607
|
+
else if (!it.pattern || it.pattern.test(v)) cfg[it.a] = it.list ? v.split(',').map(function (s) { return s.trim(); }).filter(Boolean).join(',') : v;
|
|
608
|
+
else return;
|
|
609
|
+
sync(); redraw();
|
|
610
|
+
};
|
|
611
|
+
chips.appendChild(input);
|
|
612
|
+
}
|
|
613
|
+
controls.appendChild(el('div', { class: 'design-item' }, [el('b', { text: it.label }), chips, it.hint ? el('p', { class: 'hint', text: it.hint }) : null]));
|
|
614
|
+
sync();
|
|
615
|
+
});
|
|
616
|
+
});
|
|
617
|
+
controls.appendChild(el('p', { class: 'hint design-fixed', text: kit.fixed }));
|
|
618
|
+
|
|
619
|
+
var showSeg = el('div', { class: 'seg', role: 'tablist', 'aria-label': 'Show' });
|
|
620
|
+
kit.shows.forEach(function (s) {
|
|
621
|
+
showSeg.appendChild(el('button', { type: 'button', role: 'tab', 'aria-selected': String(s[0] === show), text: s[1], onclick: function () {
|
|
622
|
+
show = s[0];
|
|
623
|
+
showSeg.querySelectorAll('button').forEach(function (b) { b.setAttribute('aria-selected', String(b === this)); }, this);
|
|
624
|
+
redraw();
|
|
625
|
+
} }));
|
|
626
|
+
});
|
|
627
|
+
var darkBox = el('input', { type: 'checkbox', onchange: function () { dark = darkBox.checked; redraw(); } });
|
|
628
|
+
|
|
629
|
+
view.appendChild(el('div', { class: 'design' }, [
|
|
630
|
+
controls,
|
|
631
|
+
el('div', { class: 'design-side' }, [
|
|
632
|
+
el('div', { class: 'row tight design-toolbar' }, [showSeg, el('label', { class: 'small mute' }, [darkBox, ' ' + kit.darkLabel])]),
|
|
633
|
+
preview.el,
|
|
634
|
+
el('div', { class: 'row tight' }, [changed, el('span', { class: 'spacer' }),
|
|
635
|
+
el('button', { class: 'btn ghost', type: 'button', text: 'Start over', onclick: function () { try { localStorage.removeItem(KEY); } catch (e) { /* private mode */ } view.textContent = ''; designView(view, p); } }),
|
|
636
|
+
copyButton(function () { return kit.prompt(cfg); }, 'Copy prompt for your agent')]),
|
|
637
|
+
codeBox,
|
|
638
|
+
]),
|
|
639
|
+
]));
|
|
640
|
+
redraw();
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// ---- design, iOS and macOS ------------------------------------------------------------
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* The same choices for the Swift package, as `HeresayStyle`. Keys are the Swift parameter
|
|
647
|
+
* names; the order is HeresayStyle.init's, which Swift requires.
|
|
648
|
+
*/
|
|
649
|
+
function appleDesign(mac) {
|
|
650
|
+
return [
|
|
651
|
+
{ group: 'The button', items: [
|
|
652
|
+
{ a: 'entry', label: mac ? 'How people open it' : 'The button', c: mac
|
|
653
|
+
? [['', 'Help › Report a Problem… (⌥⌘R)'], ['button', 'That, and a corner button'], ['none', 'My own button or menu item']]
|
|
654
|
+
: [['', 'A button in the corner'], ['none', 'No button: my own button or menu item']],
|
|
655
|
+
hint: mac ? 'Mac apps usually keep it in the Help menu, where people look for it.' : null },
|
|
656
|
+
{ a: 'position', label: 'Where the button sits', c: [['', 'Bottom right'], ['bottomLeading', 'Bottom left'], ['topTrailing', 'Top right'], ['topLeading', 'Top left'], ['bottom', 'Bottom centre']] },
|
|
657
|
+
{ a: 'offset', label: 'Distance from the edge', c: [['', '16 pt'], ['24', '24 pt'], ['80', '80 pt, above a tab bar']], text: 'or any number', pattern: /^\d{1,3}$/ },
|
|
658
|
+
{ a: 'label', label: 'Text', c: [['', 'Report'], ['Feedback', 'Feedback'], ['Help us improve', 'Help us improve'], ['Found a bug?', 'Found a bug?']], text: 'or your own words', max: 40 },
|
|
659
|
+
{ a: 'button', label: 'Style', c: [['', 'Pill with text'], ['icon', 'Icon only']] },
|
|
660
|
+
{ a: 'size', label: 'Size', c: [['', 'Regular'], ['small', 'Small'], ['large', 'Large']] },
|
|
661
|
+
{ a: 'fill', label: 'Button colour', c: [['', 'Filled with your colour'], ['neutral', 'System background']] },
|
|
662
|
+
{ a: 'shadow', label: 'Shadow', c: [['', 'Soft'], ['none', 'None'], ['strong', 'Strong']] },
|
|
663
|
+
{ a: 'hiddenOnScreens', label: 'Hide it on these screens', c: [], text: 'Checkout, Sign in', max: 200, list: true, hint: 'Screen names as your app sets them with Heresay.setScreen(…).' },
|
|
664
|
+
]},
|
|
665
|
+
{ group: 'Look', items: [
|
|
666
|
+
{ a: 'accent', label: 'Your colour', color: true, c: [['', 'Heresay peacock', '#0f766e'], ['#7c3aed', 'Purple', '#7c3aed'], ['#2563eb', 'Blue', '#2563eb'], ['#e11d48', 'Rose', '#e11d48'], ['#15171c', 'Ink', '#15171c']] },
|
|
667
|
+
{ a: 'markFollowsAccent', label: 'Logo colour', c: [['', 'Follows your colour'], ['false', 'Heresay teal']] },
|
|
668
|
+
{ a: 'theme', label: 'Light or dark', c: [['', 'Follow the app'], ['light', 'Always light'], ['dark', 'Always dark']] },
|
|
669
|
+
{ a: 'typeface', label: 'Typeface', c: [['', 'System'], ['rounded', 'Rounded'], ['serif', 'Serif']] },
|
|
670
|
+
]},
|
|
671
|
+
{ group: 'Words', items: [
|
|
672
|
+
{ a: 'language', label: 'Language', c: [['', 'My app’s language'], ['en', 'English'], ['fr', 'Français'], ['ta', 'தமிழ்'], ['hi', 'हिन्दी']], hint: 'English, French, Tamil and Hindi today; any other language shows English.' },
|
|
673
|
+
{ a: 'placeholder', label: 'Question in the text box', c: [['', 'What happened, or what would you change?']], text: 'or your own words', max: 120 },
|
|
674
|
+
{ a: 'types', label: 'Report types', c: [['', 'All four'], ['broken,confusing,improvement', 'No “Idea”'], ['broken,confusing', 'Only Broken and Confusing']], hint: 'Their names can’t change: the type sets the priority.' },
|
|
675
|
+
{ a: 'thanks', label: 'Thank-you line after sending', c: [['', 'None']], text: 'e.g. Thanks! We read every one.', max: 160 },
|
|
676
|
+
]},
|
|
677
|
+
{ group: 'The sheet', items: [
|
|
678
|
+
{ a: 'sheet', label: 'Size', c: mac ? [['', 'Regular'], ['compact', 'Narrow'], ['large', 'Wide']]
|
|
679
|
+
: [['', 'Full height'], ['compact', 'Half height, pull up for more'], ['large', 'Full screen']] },
|
|
680
|
+
{ a: 'showsPreferences', label: 'Preferences tab', c: [['', 'Show'], ['false', 'Hide']], hint: 'Hide it if your app calls identify() and asks nothing else.' },
|
|
681
|
+
]},
|
|
682
|
+
];
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
var SWIFT_ORDER = ['position', 'offset', 'label', 'button', 'size', 'fill', 'shadow', 'hiddenOnScreens', 'markFollowsAccent',
|
|
686
|
+
'theme', 'typeface', 'language', 'placeholder', 'types', 'thanks', 'sheet', 'showsPreferences'];
|
|
687
|
+
|
|
688
|
+
function swiftString(s) { return '"' + String(s).replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"'; }
|
|
689
|
+
|
|
690
|
+
/** One HeresayStyle argument, in Swift. */
|
|
691
|
+
function swiftArg(k, v) {
|
|
692
|
+
if (k === 'offset') return k + ': ' + (+v);
|
|
693
|
+
if (k === 'label' || k === 'placeholder' || k === 'thanks' || k === 'language') return k + ': ' + swiftString(v);
|
|
694
|
+
if (k === 'hiddenOnScreens') return k + ': [' + v.split(',').map(swiftString).join(', ') + ']';
|
|
695
|
+
if (k === 'types') return k + ': [' + v.split(',').map(function (t) { return '.' + t; }).join(', ') + ']';
|
|
696
|
+
if (k === 'markFollowsAccent' || k === 'showsPreferences') return k + ': ' + v;
|
|
697
|
+
return k + ': .' + v;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function swiftColor(hex) {
|
|
701
|
+
var n = parseInt(hex.slice(1), 16);
|
|
702
|
+
var c = [n >> 16 & 255, n >> 8 & 255, n & 255].map(function (x) { return (x / 255).toFixed(3).replace(/0+$/, '').replace(/\.$/, '.0'); });
|
|
703
|
+
return 'Color(red: ' + c[0] + ', green: ' + c[1] + ', blue: ' + c[2] + ')';
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
function swiftConfigure(p, cfg) {
|
|
707
|
+
var args = SWIFT_ORDER.filter(function (k) { return cfg[k]; }).map(function (k) { return swiftArg(k, cfg[k]); });
|
|
708
|
+
var lines = ['key: "' + p.key + '"', 'url: URL(string: "' + location.origin + '")!'];
|
|
709
|
+
if (cfg.accent) lines.push('accent: ' + swiftColor(cfg.accent));
|
|
710
|
+
if (args.length) lines.push('style: HeresayStyle(\n ' + args.join(',\n ') + '\n )');
|
|
711
|
+
return 'Heresay.configure(\n ' + lines.join(',\n ') + '\n)';
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/** Where the sheet (and the button) attach: the root view, and on the Mac the menu. */
|
|
715
|
+
function swiftAttach(p, cfg) {
|
|
716
|
+
var mac = p.platform === 'macos';
|
|
717
|
+
var button = mac ? cfg.entry === 'button' : cfg.entry !== 'none';
|
|
718
|
+
var view = 'ContentView().' + (button ? 'heresayReportButton()' : 'heresay()');
|
|
719
|
+
if (mac && cfg.entry !== 'none') return 'WindowGroup {\n ' + view + '\n}\n.commands { HeresayCommands() } // Help › Report a Problem… (⌥⌘R)';
|
|
720
|
+
return 'WindowGroup {\n ' + view + '\n}' + (button ? '' : '\n\n// Then, from your own button or menu item:\nHeresay.present()');
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
function appleKit(p) {
|
|
724
|
+
var mac = p.platform === 'macos';
|
|
725
|
+
var groups = appleDesign(mac);
|
|
726
|
+
return {
|
|
727
|
+
groups: groups,
|
|
728
|
+
shows: [['button', mac ? 'Window' : 'Button'], ['panel', 'Sheet'], ['intro', 'Introduction'], ['sent', 'After sending']],
|
|
729
|
+
darkLabel: 'Dark mode',
|
|
730
|
+
changes: function (cfg) { return Object.keys(cfg).filter(function (k) { return cfg[k]; }).length; },
|
|
731
|
+
preview: function () {
|
|
732
|
+
var box = el('div', { class: 'design-frame apple-frame', role: 'img', 'aria-label': 'Preview' });
|
|
733
|
+
// The phone is drawn at its real size, then zoomed to fit the box.
|
|
734
|
+
var fit = function () {
|
|
735
|
+
var ph = box.querySelector('.am-phone');
|
|
736
|
+
if (ph) ph.style.zoom = String(Math.min(1, (box.clientHeight - 28) / 630));
|
|
737
|
+
};
|
|
738
|
+
window.addEventListener('resize', fit);
|
|
739
|
+
return { el: box, draw: function (cfg, show, dark) { box.innerHTML = appleMock(p, cfg, show, dark); fit(); } };
|
|
740
|
+
},
|
|
741
|
+
code: function (cfg) {
|
|
742
|
+
return [el('p', { class: 'hint', text: 'In your App’s init():' }), codeBlock(swiftConfigure(p, cfg)),
|
|
743
|
+
el('p', { class: 'hint', text: 'And on the root view:' }), codeBlock(swiftAttach(p, cfg))];
|
|
744
|
+
},
|
|
745
|
+
prompt: function (cfg) {
|
|
746
|
+
return 'Update how Heresay is set up in this ' + (mac ? 'macOS' : 'iOS') + ' app (the Heresay.configure call with key "' + p.key + '") so it matches this. ' +
|
|
747
|
+
'Keep the key, the URL and anything else it passes (version, session). Replace any existing accent: and style: arguments with these. ' +
|
|
748
|
+
'Heresay 0.2.11 or later is needed for style:; update the Swift package if it is older.\n\n' +
|
|
749
|
+
swiftConfigure(p, cfg) + '\n\nThe root view and scene:\n\n' + swiftAttach(p, cfg) + '\n' +
|
|
750
|
+
(cfg.hiddenOnScreens ? '\nThe button hides on screens named with Heresay.setScreen(…). Make sure those screens call it with exactly these names: ' + cfg.hiddenOnScreens + '.\n' : '') +
|
|
751
|
+
'\nIf the app doesn\'t call Heresay.introduce() yet, call it once the main screen appears.' +
|
|
752
|
+
'\nFor what each option does, read the Heresay guide customize-apple (heresay_guide, or npx -y heresay@latest guide customize-apple).';
|
|
753
|
+
},
|
|
754
|
+
fixed: 'Always there, whatever you choose: the Heresay mark, the “Your reports” tab (people read why a report was declined), and “Powered by Heresay” in the sheet and the introduction, so people can tell your app uses an outside tool.',
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/** The words the preview shows, from Words.swift. Only a likeness needs these few. */
|
|
759
|
+
var APPLE_WORDS = {
|
|
760
|
+
en: { report: 'Report', send: 'Send', sendFeedback: 'Send feedback', straight: 'Straight to the {app} team', tabs: ['Report', 'Your reports', 'Preferences'],
|
|
761
|
+
what: 'What is it?', happened: 'What happened?', ph: 'What happened, or what would you change?', attached: 'Sent with this screen and the app version.',
|
|
762
|
+
types: [['Broken', 'Something doesn’t work'], ['Confusing', 'I couldn’t tell how'], ['Could be better', 'It works, and could be better'], ['Idea', 'Something that isn’t there yet']],
|
|
763
|
+
powered: 'Powered by Heresay', introTitle: 'Something not right? Tell the team.',
|
|
764
|
+
introBody: '{reach} to tell the team what’s broken, confusing or could be better. A person reads every report, and you’ll see what happens to yours.',
|
|
765
|
+
reachTap: 'Tap {label} in the corner any time', reachClick: 'Click {label} any time', reachMenu: 'Choose Help › Report a Problem… (⌥⌘R) any time', reachUse: 'Use {label} any time',
|
|
766
|
+
tryIt: 'Try it', gotIt: 'Got it', cancel: 'Cancel', sentTitle: 'Sent. Thank you.', sentBody: 'A person on the team reads every report. You’ll see what happens to it under Your reports.',
|
|
767
|
+
another: 'Send another', see: 'See your reports', menu: 'Report a Problem…' },
|
|
768
|
+
fr: { report: 'Signaler', send: 'Envoyer', sendFeedback: 'Envoyer un retour', straight: 'Directement à l’équipe {app}', tabs: ['Signaler', 'Vos signalements', 'Préférences'],
|
|
769
|
+
what: 'De quoi s’agit-il ?', happened: 'Que s’est-il passé ?', ph: 'Que s’est-il passé, ou que changeriez-vous ?', attached: 'Envoyé avec cet écran et la version de l’app.',
|
|
770
|
+
types: [['Cassé', 'Quelque chose ne marche pas'], ['Déroutant', 'Je ne voyais pas comment faire'], ['Pourrait être mieux', 'Ça marche, mais ça pourrait être mieux'], ['Idée', 'Quelque chose qui n’existe pas encore']],
|
|
771
|
+
powered: 'Propulsé par Heresay', introTitle: 'Un souci ? Dites-le à l’équipe.',
|
|
772
|
+
introBody: '{reach} pour dire à l’équipe ce qui ne marche pas, ce qui est déroutant ou ce qui pourrait être mieux. Une personne lit chaque signalement, et vous verrez ce qu’il devient.',
|
|
773
|
+
reachTap: 'Touchez {label} dans le coin à tout moment', reachClick: 'Cliquez sur {label} à tout moment', reachMenu: 'Choisissez Aide › Signaler un problème… (⌥⌘R) à tout moment', reachUse: 'Utilisez {label} à tout moment',
|
|
774
|
+
tryIt: 'Essayer', gotIt: 'Compris', cancel: 'Annuler', sentTitle: 'Envoyé. Merci.', sentBody: 'Une personne de l’équipe lit chaque signalement. Vous verrez ce qu’il devient dans Vos signalements.',
|
|
775
|
+
another: 'En envoyer un autre', see: 'Voir vos signalements', menu: 'Signaler un problème…' },
|
|
776
|
+
ta: { report: 'தெரிவி', send: 'அனுப்பு', sendFeedback: 'கருத்து அனுப்பு', straight: 'நேராக {app} குழுவுக்கு', tabs: ['தெரிவி', 'உங்கள் புகார்கள்', 'விருப்பங்கள்'],
|
|
777
|
+
what: 'இது என்ன வகை?', happened: 'என்ன நடந்தது?', ph: 'என்ன நடந்தது, அல்லது எதை மாற்ற விரும்புகிறீர்கள்?', attached: 'இந்தத் திரை மற்றும் ஆப் பதிப்புடன் அனுப்பப்படும்.',
|
|
778
|
+
types: [['வேலை செய்யவில்லை', 'ஏதோ ஒன்று சரியாக இயங்கவில்லை'], ['குழப்பமாக உள்ளது', 'எப்படிச் செய்வது என்று புரியவில்லை'], ['இன்னும் சிறப்பாக்கலாம்', 'வேலை செய்கிறது, ஆனால் மேம்படுத்தலாம்'], ['யோசனை', 'இன்னும் இல்லாத ஒன்று']],
|
|
779
|
+
powered: 'Heresay மூலம் இயங்குகிறது', introTitle: 'ஏதாவது சரியில்லையா? குழுவிடம் சொல்லுங்கள்.',
|
|
780
|
+
introBody: 'எது வேலை செய்யவில்லை, எது குழப்பமாக உள்ளது, எதை மேம்படுத்தலாம் என்று குழுவிடம் சொல்ல, {reach}. ஒவ்வொரு புகாரையும் ஒருவர் படிக்கிறார்; உங்களுடையதற்கு என்ன ஆனது என்பதைப் பார்க்கலாம்.',
|
|
781
|
+
reachTap: 'எப்போது வேண்டுமானாலும் மூலையில் உள்ள {label} ஐத் தட்டுங்கள்', reachClick: 'எப்போது வேண்டுமானாலும் {label} ஐக் கிளிக் செய்யுங்கள்', reachMenu: 'எப்போது வேண்டுமானாலும் Help › சிக்கலைத் தெரிவி… (⌥⌘R) என்பதைத் தேர்ந்தெடுங்கள்', reachUse: 'எப்போது வேண்டுமானாலும் {label} ஐப் பயன்படுத்துங்கள்',
|
|
782
|
+
tryIt: 'முயன்று பாருங்கள்', gotIt: 'சரி', cancel: 'ரத்துசெய்', sentTitle: 'அனுப்பப்பட்டது. நன்றி.', sentBody: 'குழுவில் ஒருவர் ஒவ்வொரு புகாரையும் படிக்கிறார். அதற்கு என்ன ஆனது என்பதை “உங்கள் புகார்கள்” பகுதியில் பார்க்கலாம்.',
|
|
783
|
+
another: 'இன்னொன்று அனுப்பு', see: 'உங்கள் புகார்களைப் பார்', menu: 'சிக்கலைத் தெரிவி…' },
|
|
784
|
+
hi: { report: 'रिपोर्ट करें', send: 'भेजें', sendFeedback: 'फ़ीडबैक भेजें', straight: 'सीधे {app} टीम को', tabs: ['रिपोर्ट', 'आपकी रिपोर्ट', 'प्राथमिकताएँ'],
|
|
785
|
+
what: 'यह क्या है?', happened: 'क्या हुआ?', ph: 'क्या हुआ, या आप क्या बदलना चाहेंगे?', attached: 'इस स्क्रीन और ऐप के वर्शन के साथ भेजा जाता है।',
|
|
786
|
+
types: [['टूटा हुआ', 'कुछ काम नहीं कर रहा'], ['उलझन भरा', 'समझ नहीं आया कि कैसे करें'], ['बेहतर हो सकता है', 'काम करता है, पर बेहतर हो सकता है'], ['सुझाव', 'कुछ ऐसा जो अभी नहीं है']],
|
|
787
|
+
powered: 'Heresay द्वारा संचालित', introTitle: 'कुछ ठीक नहीं लग रहा? टीम को बताइए।',
|
|
788
|
+
introBody: 'टीम को यह बताने के लिए कि क्या टूटा है, क्या उलझन भरा है या क्या बेहतर हो सकता है, {reach}। हर रिपोर्ट कोई इंसान पढ़ता है, और आपकी रिपोर्ट का क्या हुआ, यह आप देखेंगे।',
|
|
789
|
+
reachTap: 'कभी भी कोने में {label} पर टैप करें', reachClick: 'कभी भी {label} पर क्लिक करें', reachMenu: 'कभी भी Help › समस्या की रिपोर्ट करें… (⌥⌘R) चुनें', reachUse: 'कभी भी {label} का इस्तेमाल करें',
|
|
790
|
+
tryIt: 'आज़माएँ', gotIt: 'ठीक है', cancel: 'रद्द करें', sentTitle: 'भेज दिया गया। धन्यवाद।', sentBody: 'टीम का कोई व्यक्ति हर रिपोर्ट पढ़ता है। इसका क्या हुआ, यह आप “आपकी रिपोर्ट” में देखेंगे।',
|
|
791
|
+
another: 'एक और भेजें', see: 'अपनी रिपोर्ट देखें', menu: 'समस्या की रिपोर्ट करें…' },
|
|
792
|
+
};
|
|
793
|
+
var TYPE_IDS = ['broken', 'confusing', 'improvement', 'idea'];
|
|
794
|
+
var TYPE_ICON = { broken: '⚠︎', confusing: '?', improvement: '✦', idea: '💡' };
|
|
795
|
+
|
|
796
|
+
/** A likeness of the Swift package's button, sheet, alert and sent view, as HTML. */
|
|
797
|
+
function appleMock(p, cfg, show, darkMode) {
|
|
798
|
+
var mac = p.platform === 'macos';
|
|
799
|
+
var w = APPLE_WORDS[cfg.language] || APPLE_WORDS.en;
|
|
800
|
+
var fmt = function (s, o) { return s.replace(/\{(\w+)\}/g, function (_, k) { return o[k]; }); };
|
|
801
|
+
var acc = cfg.accent || '#0f766e';
|
|
802
|
+
var dark = cfg.theme === 'dark' || (cfg.theme !== 'light' && darkMode);
|
|
803
|
+
var markC = cfg.markFollowsAccent === 'false' || !cfg.accent ? (dark ? '#2dd4bf' : '#0b5e57') : acc;
|
|
804
|
+
var mark = function (c, s) { return '<span class="am-mark" style="width:' + s + 'px;height:' + s + 'px;background:' + c + '"></span>'; };
|
|
805
|
+
var label = cfg.label || w.report;
|
|
806
|
+
var hasButton = mac ? cfg.entry === 'button' : cfg.entry !== 'none';
|
|
807
|
+
var face = { rounded: 'ui-rounded,"SF Pro Rounded",system-ui', serif: 'ui-serif,Georgia,serif' }[cfg.typeface] || '-apple-system,system-ui,sans-serif';
|
|
808
|
+
var off = +(cfg.offset || 16);
|
|
809
|
+
var pos = cfg.position || 'bottomTrailing';
|
|
810
|
+
var place = (/top/.test(pos) ? 'top:' + (off + (mac ? 34 : 54)) + 'px;' : 'bottom:' + (off + (mac ? 0 : 20)) + 'px;') +
|
|
811
|
+
(pos === 'bottom' ? 'left:50%;transform:translateX(-50%);' : /Leading/.test(pos) ? 'left:' + off + 'px;' : 'right:' + off + 'px;');
|
|
812
|
+
var sz = { small: [11, 10, 6, 13], large: [16, 18, 12, 21] }[cfg.size] || [13, 14, 9, 17];
|
|
813
|
+
var neutral = cfg.fill === 'neutral';
|
|
814
|
+
var icon = cfg.button === 'icon';
|
|
815
|
+
var btnDark = dark || darkMode;
|
|
816
|
+
var shadow = { none: 'none', strong: '0 6px 16px rgba(0,0,0,.35)' }[cfg.shadow] || '0 3px 8px rgba(0,0,0,.18)';
|
|
817
|
+
var button = hasButton && show !== 'panel' && show !== 'sent'
|
|
818
|
+
? '<div class="am-btn" style="' + place + 'font-size:' + sz[0] + 'px;padding:' + (icon ? (sz[2] + 1) + 'px' : sz[2] + 'px ' + sz[1] + 'px') + ';border-radius:999px;box-shadow:' + shadow + ';' +
|
|
819
|
+
(neutral ? 'background:' + (btnDark ? 'rgba(40,42,48,.92)' : 'rgba(255,255,255,.92)') + ';color:' + (btnDark ? '#f2f2f7' : '#111') + ';border:1px solid rgba(127,127,127,.25)' : 'background:' + acc + ';color:#fff') + '">' +
|
|
820
|
+
mark(neutral ? markC : '#fff', sz[3]) + (icon ? '' : '<b>' + esc(label) + '</b>') + '</div>' : '';
|
|
821
|
+
|
|
822
|
+
var types = (cfg.types || TYPE_IDS.join(',')).split(',');
|
|
823
|
+
var typeCards = types.map(function (t) {
|
|
824
|
+
var tw = w.types[TYPE_IDS.indexOf(t)];
|
|
825
|
+
return '<div class="am-type"><span class="am-ti" style="color:' + acc + ';background:' + acc + '1f">' + TYPE_ICON[t] + '</span><span><b>' + esc(tw[0]) + '</b><i>' + esc(tw[1]) + '</i></span></div>';
|
|
826
|
+
}).join('');
|
|
827
|
+
var tabs = [w.tabs[0], w.tabs[1]].concat(cfg.showsPreferences === 'false' ? [] : [w.tabs[2]]);
|
|
828
|
+
var powered = '<div class="am-powered">' + mark(markC, 11) + esc(w.powered) + '</div>';
|
|
829
|
+
var head = '<div class="am-head">' + mark(markC, 28) + '<div><b>' + esc(w.sendFeedback) + '</b><span>' + esc(fmt(w.straight, { app: productName(p) })) + '</span></div>' + (mac ? '' : '<em>✕</em>') + '</div>' +
|
|
830
|
+
'<div class="am-seg">' + tabs.map(function (t, i) { return '<span' + (i === 0 ? ' class="on"' : '') + '>' + esc(t) + '</span>'; }).join('') + '</div>';
|
|
831
|
+
var form = '<div class="am-body"><p class="am-lab">' + esc(w.what) + '</p><div class="am-types' + (mac ? ' grid' : '') + '">' + typeCards + '</div>' +
|
|
832
|
+
'<p class="am-lab">' + esc(w.happened) + '</p><div class="am-text">' + esc(cfg.placeholder || w.ph) + '</div></div>' + powered +
|
|
833
|
+
'<div class="am-foot"><span>' + esc(w.attached) + '</span>' + (mac ? '<u>' + esc(w.cancel) + '</u>' : '') + '<strong style="background:' + acc + '">' + esc(w.send) + '</strong></div>';
|
|
834
|
+
var sent = '<div class="am-body am-sent">' + mark(markC, 56) + '<b>' + esc(w.sentTitle) + '</b>' + (cfg.thanks ? '<p>' + esc(cfg.thanks) + '</p>' : '') +
|
|
835
|
+
'<p class="mute">' + esc(w.sentBody) + '</p><div><u>' + esc(w.another) + '</u><strong style="background:' + acc + '">' + esc(w.see) + '</strong></div></div>' + powered;
|
|
836
|
+
var sheetSize = cfg.sheet || '';
|
|
837
|
+
var sheet = show === 'panel' || show === 'sent'
|
|
838
|
+
? '<div class="am-dim"></div><div class="am-sheet ' + (mac ? 'mac ' : '') + (sheetSize || 'regular') + '">' + head + (show === 'sent' ? sent : form) + '</div>' : '';
|
|
839
|
+
var reach = mac ? (cfg.entry !== 'none' ? w.reachMenu : fmt(hasButton ? w.reachClick : w.reachUse, { label: cfg.label ? '“' + cfg.label + '”' : w.report }))
|
|
840
|
+
: fmt(hasButton ? w.reachTap : w.reachUse, { label: cfg.label ? '“' + cfg.label + '”' : w.report });
|
|
841
|
+
var alert = show === 'intro'
|
|
842
|
+
? '<div class="am-dim"></div><div class="am-alert"><b>' + esc(w.introTitle) + '</b><p>' + esc(fmt(w.introBody, { reach: reach })) + '</p><p>' + esc(w.powered) + '</p>' +
|
|
843
|
+
'<div><span>' + esc(w.gotIt) + '</span><span>' + esc(w.tryIt) + '</span></div></div>' : '';
|
|
844
|
+
var menu = mac && cfg.entry !== 'none' && show === 'button'
|
|
845
|
+
? '<div class="am-menu"><span>' + esc(w.menu) + '</span><kbd>⌥⌘R</kbd></div>' : '';
|
|
846
|
+
var rows = ['Groceries', 'Trip to Ooty', 'Quarterly plan', 'Book list'].map(function (r) { return '<li>' + r + '</li>'; }).join('');
|
|
847
|
+
var app = mac
|
|
848
|
+
? '<div class="am-menubar"><b></b><b>' + esc(productName(p)) + '</b><span>File</span><span>Edit</span><span' + (menu ? ' class="on"' : '') + '>Help</span></div>' + menu +
|
|
849
|
+
'<div class="am-window"><div class="am-titlebar"><i></i><i></i><i></i><span>' + esc(productName(p)) + '</span></div><div class="am-content"><h3>Notes</h3><ul>' + rows + '</ul></div>' + button + sheet + alert + '</div>'
|
|
850
|
+
: '<div class="am-phone"><div class="am-status"><span>9:41</span><i></i></div><div class="am-content"><h3>Notes</h3><ul>' + rows + '</ul></div>' + button + sheet + alert + '</div>';
|
|
851
|
+
return '<div class="am ' + (mac ? 'am-mac' : 'am-ios') + (darkMode ? ' app-dark' : '') + (dark ? ' dark' : '') + '" style="--acc:' + acc + ';font-family:' + face + '">' + app + '</div>';
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
|
|
435
855
|
// ---- install and test ------------------------------------------------------------------
|
|
436
856
|
|
|
437
857
|
function tag(p) { return '<script src="' + SDK_URL + '" data-key="' + p.key + '" defer></scr' + 'ipt>'; }
|
|
@@ -773,6 +1193,7 @@
|
|
|
773
1193
|
: (p.framework ? frameworkLabel(p.framework) + (p.framework_detected ? ' (detected)' : '') : platformOf(p.platform).label) })])]));
|
|
774
1194
|
head.appendChild(el('div', { class: 'row tight' }, [
|
|
775
1195
|
el('a', { class: 'btn ghost', href: '#/new?product=' + productOf(p), text: '+ Add a platform' }),
|
|
1196
|
+
many || !designable(p) ? null : el('a', { class: 'btn ghost', href: '#/apps/' + p.id + '/design', text: 'Design' }),
|
|
776
1197
|
many ? null : el('a', { class: 'btn', href: '#/apps/' + p.id + '/setup', text: 'Install' }),
|
|
777
1198
|
many ? null : el('a', { class: 'btn ghost', href: '#/apps/' + p.id + '/delete', text: 'Delete…' }),
|
|
778
1199
|
]));
|
|
@@ -790,6 +1211,8 @@
|
|
|
790
1211
|
el('a', { href: '#/connect?app=' + x.id, text: 'Connect a repo' }),
|
|
791
1212
|
many ? document.createTextNode(' · ') : null,
|
|
792
1213
|
many ? el('a', { href: '#/apps/' + x.id + '/setup', text: 'Install' }) : null,
|
|
1214
|
+
many && designable(x) ? document.createTextNode(' · ') : null,
|
|
1215
|
+
many && designable(x) ? el('a', { href: '#/apps/' + x.id + '/design', text: 'Design' }) : null,
|
|
793
1216
|
many ? document.createTextNode(' · ') : null,
|
|
794
1217
|
many ? el('a', { href: '#/apps/' + x.id + '/delete', text: 'Delete…' }) : null,
|
|
795
1218
|
]));
|
package/release/public/demo.html
CHANGED
|
@@ -23,7 +23,11 @@
|
|
|
23
23
|
s.src = '/sdk/v1.js';
|
|
24
24
|
s.dataset.key = q.get('key') || '';
|
|
25
25
|
s.dataset.version = '0.0.1-demo';
|
|
26
|
-
|
|
26
|
+
// The design options, so a look can be tried here before it goes in the app's code.
|
|
27
|
+
['accent', 'position', 'offset', 'button', 'label', 'style', 'size', 'fill', 'shadow', 'mark', 'theme',
|
|
28
|
+
'font', 'lang', 'placeholder', 'types', 'thanks', 'panel', 'width', 'backdrop', 'preferences', 'intro']
|
|
29
|
+
.forEach(function (k) { if (q.get(k) != null) s.setAttribute('data-' + k, q.get(k)); });
|
|
30
|
+
if (q.has('preview')) s.setAttribute('data-preview', '');
|
|
27
31
|
document.body.appendChild(s);
|
|
28
32
|
</script>
|
|
29
33
|
</body>
|