autosolutions-os 0.4.1 → 0.4.2
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/CHANGELOG.md +46 -0
- package/README.md +11 -7
- package/dist/feedback.d.ts +3 -2
- package/dist/feedback.js +42 -16
- package/dist/feedbackAsk.d.ts +4 -0
- package/dist/feedbackAsk.js +47 -0
- package/dist/feedbackSend.d.ts +18 -0
- package/dist/feedbackSend.js +28 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.2 - 2026-11-05
|
|
4
|
+
|
|
5
|
+
The ? becomes a Feedback button that people see, and pasting a picture into
|
|
6
|
+
the feedback form works in every browser, Safari too (Didac asked for both on
|
|
7
|
+
5 November 2026, and picked the button's look: "B", with more space before
|
|
8
|
+
the company).
|
|
9
|
+
|
|
10
|
+
### The Feedback button
|
|
11
|
+
|
|
12
|
+
- The ? left of the company plate is now a pill in the logo's pink and
|
|
13
|
+
purple, with a chat icon and the word Feedback. Its name for screen readers
|
|
14
|
+
stays "Send feedback".
|
|
15
|
+
- 20px before the company plate (was 4px); 12px on a phone.
|
|
16
|
+
- For its first minute on a page its colour drifts slowly from pink to purple
|
|
17
|
+
and back. It stops for good once the person has opened the form in this
|
|
18
|
+
browser (localStorage `autosolutions-os:feedback-seen`; a browser that
|
|
19
|
+
keeps nothing still gets a working button). It never moves with reduced
|
|
20
|
+
motion.
|
|
21
|
+
- Phones (measured on the Hub's bar): the icon and the word from 410px, the
|
|
22
|
+
word alone from 380px (a 390px iPhone), the icon alone below. The search
|
|
23
|
+
gives way first; the plate stays whole.
|
|
24
|
+
- The button brings its own styles (a `<style>` inside it, `OS_FEEDBACK_ASK_CSS`),
|
|
25
|
+
drawn right on a server-rendered first page. Apps change nothing.
|
|
26
|
+
- An app that adds its own buttons to the bar leaves less room on a phone:
|
|
27
|
+
none does today.
|
|
28
|
+
|
|
29
|
+
### autosolutions-os/feedback
|
|
30
|
+
|
|
31
|
+
- A paste reads the picture from `clipboardData.files` and, when `files` has
|
|
32
|
+
no picture, from `clipboardData.items` (items of kind "file"). Safari, and
|
|
33
|
+
some "Copy image" menus, give the picture only in `items`. A browser that
|
|
34
|
+
fills both gives the same picture in each, so it is added once.
|
|
35
|
+
- A paste with no picture (text) goes on as normal: the form stops a paste
|
|
36
|
+
only when it adds a picture.
|
|
37
|
+
- Safari sends no paste event while a button or a radio has focus. Cmd+V or
|
|
38
|
+
Ctrl+V there now moves focus to the text box first, so the paste lands in
|
|
39
|
+
the form.
|
|
40
|
+
- A HEIC, GIF or TIFF picture is redrawn as a JPEG when the browser can read
|
|
41
|
+
it, as before; when it cannot, the form says "Use a PNG, JPEG or WebP
|
|
42
|
+
picture."
|
|
43
|
+
- New: `pastedPictures(clipboardData)` (also from `autosolutions-os`), the
|
|
44
|
+
pictures in a paste, and its type `OsPastedData`.
|
|
45
|
+
- Unchanged: the form, its limits (three pictures, 3 MB each), what it sends,
|
|
46
|
+
and the button's place (left of the company plate).
|
|
47
|
+
- Apps take this release with a lockfile bump.
|
|
48
|
+
|
|
3
49
|
## 0.4.1 - 2026-11-05
|
|
4
50
|
|
|
5
51
|
The owner's sheet has Commercial > Tools > Line form populator, which the
|
package/README.md
CHANGED
|
@@ -443,12 +443,16 @@ On the server there is no cookie to read, so the hook gives the fallback:
|
|
|
443
443
|
render the frame in the browser only (Asset Portal's staff face does), or
|
|
444
444
|
accept a first paint of the fallback.
|
|
445
445
|
|
|
446
|
-
### Feedback: the
|
|
447
|
-
|
|
448
|
-
Every app has one way to send feedback: the
|
|
449
|
-
of the company plate
|
|
450
|
-
|
|
451
|
-
|
|
446
|
+
### Feedback: the Feedback button in the top bar (0.4.0; the button 0.4.2)
|
|
447
|
+
|
|
448
|
+
Every app has one way to send feedback: the Feedback button in the top bar,
|
|
449
|
+
left of the company plate (a pink-to-purple pill with a chat icon; on a small
|
|
450
|
+
phone the word or the icon alone; its colour drifts for a page's first minute
|
|
451
|
+
until the person has opened the form once). It opens the same form
|
|
452
|
+
everywhere: a type (Bug, Idea, Question, Other), what happened, and up to
|
|
453
|
+
three pictures (picked, pasted or dropped; PNG, JPEG or WebP, 3 MB each, big
|
|
454
|
+
ones made smaller first; a paste reads the clipboard's files, or its items as
|
|
455
|
+
Safari gives them). Send adds
|
|
452
456
|
what the page knows (the app, the page's path, title and address, the company
|
|
453
457
|
on the plate, the browser, the screen, the language, the time zone, the app's
|
|
454
458
|
commit from Lovable's `data-commit-sha`, and this package's version) and posts
|
|
@@ -476,7 +480,7 @@ const core = useCoreFrame({
|
|
|
476
480
|
```
|
|
477
481
|
|
|
478
482
|
Without `feedback` the hook gives `core.feedback === null`, so an app shows
|
|
479
|
-
the
|
|
483
|
+
the button only once it hands its token. The form is a native `<dialog>` with its
|
|
480
484
|
own styles: it needs no stylesheet from the app, sits above the app's own
|
|
481
485
|
layout, and Escape closes it. Closing it keeps the draft until it is sent.
|
|
482
486
|
`autosolutions-os/feedback` also exports the form's logic (`sendFeedback`,
|
package/dist/feedback.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type OsFeedbackProps } from "./feedbackSend.js";
|
|
2
|
-
export {
|
|
3
|
-
|
|
2
|
+
export { OS_FEEDBACK_ASK_CSS } from "./feedbackAsk.js";
|
|
3
|
+
export { OS_FEEDBACK_LIMITS, OS_FEEDBACK_TYPES, feedbackContext, feedbackEndpoint, pastedPictures, readPicture, sendFeedback, type OsFeedbackPicture, type OsFeedbackProps, type OsFeedbackResult, type OsFeedbackTenant, type OsFeedbackType, type OsPastedData, } from "./feedbackSend.js";
|
|
4
|
+
/** The bar's Feedback button and its form. */
|
|
4
5
|
export declare function OsFeedbackButton({ appKey, token, tenant, endpoint }: OsFeedbackProps): import("react").JSX.Element;
|
package/dist/feedback.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
* autosolutions-os/feedback (0.4.0): the
|
|
4
|
-
* feedback form every app shares.
|
|
3
|
+
* autosolutions-os/feedback (0.4.0): the Feedback button in the top bar (a ?
|
|
4
|
+
* until 0.4.2), and the one feedback form every app shares.
|
|
5
5
|
*
|
|
6
|
-
* OsWorkspaceFrame draws the
|
|
6
|
+
* OsWorkspaceFrame draws the button by itself, left of the company plate.
|
|
7
7
|
* An app on its own project gets it from `useCoreFrame({ feedback })` as
|
|
8
8
|
* `core.feedback`, for its TopBar's `actions`.
|
|
9
9
|
*
|
|
@@ -23,10 +23,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
23
23
|
* is sent or the page reloads.
|
|
24
24
|
*/
|
|
25
25
|
import { useEffect, useId, useRef, useState } from "react";
|
|
26
|
-
import { OS_FEEDBACK_LIMITS, OS_FEEDBACK_TYPES, readPicture, sendFeedback, } from "./feedbackSend.js";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
import { OS_FEEDBACK_LIMITS, OS_FEEDBACK_TYPES, pastedPictures, readPicture, sendFeedback, } from "./feedbackSend.js";
|
|
27
|
+
import { keepSeen, OS_FEEDBACK_ASK_CSS, readSeen } from "./feedbackAsk.js";
|
|
28
|
+
export { OS_FEEDBACK_ASK_CSS } from "./feedbackAsk.js";
|
|
29
|
+
export { OS_FEEDBACK_LIMITS, OS_FEEDBACK_TYPES, feedbackContext, feedbackEndpoint, pastedPictures, readPicture, sendFeedback, } from "./feedbackSend.js";
|
|
30
|
+
/* Lucide's message-circle-more (ISC), inline so the bar fetches nothing. */
|
|
31
|
+
const GLYPH = (_jsxs("svg", { className: "osfb-ask__icon", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children: [_jsx("path", { d: "M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" }), _jsx("path", { d: "M8 12h.01" }), _jsx("path", { d: "M12 12h.01" }), _jsx("path", { d: "M16 12h.01" })] }));
|
|
30
32
|
const D = 'dialog[data-os-feedback="dialog"]';
|
|
31
33
|
const CSS = `
|
|
32
34
|
${D}{box-sizing:border-box;width:min(34rem,calc(100vw - 2rem));max-width:none;max-height:calc(100vh - 2rem);margin:auto;padding:0;border:1px solid var(--ws-color-panel-stroke,#E6E6E8);border-radius:var(--ws-radius-sheet,1rem);background:var(--ws-color-surface,#FFFFFF);color:var(--ws-color-text,#303030);font-family:var(--ws-font,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif);font-size:.875rem;line-height:1.45;text-align:start;box-shadow:0 1.25rem 3.75rem rgba(0,0,0,.25);overflow:auto}
|
|
@@ -66,12 +68,23 @@ ${D} .osfb-alert ul{margin:.375rem 0 0;padding-inline-start:1.25rem}
|
|
|
66
68
|
${D} .osfb-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
|
|
67
69
|
`;
|
|
68
70
|
const EMPTY = { type: "bug", message: "", pictures: [] };
|
|
69
|
-
/** The
|
|
71
|
+
/** The bar's Feedback button and its form. */
|
|
70
72
|
export function OsFeedbackButton({ appKey, token, tenant, endpoint }) {
|
|
71
73
|
const [open, setOpen] = useState(false);
|
|
72
74
|
/* Kept here, not in the dialog, so closing the form keeps what was typed. */
|
|
73
75
|
const [draft, setDraft] = useState(EMPTY);
|
|
74
|
-
|
|
76
|
+
const [seen, setSeen] = useState(false);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (readSeen())
|
|
79
|
+
setSeen(true);
|
|
80
|
+
}, []);
|
|
81
|
+
return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", className: seen ? "as-topbar__target osfb-ask is-seen" : "as-topbar__target osfb-ask", "aria-label": "Send feedback", title: "Send feedback", "aria-haspopup": "dialog", "data-os-feedback": "button", onClick: () => {
|
|
82
|
+
setOpen(true);
|
|
83
|
+
if (!seen) {
|
|
84
|
+
setSeen(true);
|
|
85
|
+
keepSeen();
|
|
86
|
+
}
|
|
87
|
+
}, children: [_jsx("style", { children: OS_FEEDBACK_ASK_CSS }), GLYPH, _jsx("span", { className: "osfb-ask__word", children: "Feedback" })] }), open && (_jsx(FeedbackDialog, { appKey: appKey, token: token, tenant: tenant ?? null, ...(endpoint ? { endpoint } : {}), draft: draft, setDraft: setDraft, onClose: () => setOpen(false) }))] }));
|
|
75
88
|
}
|
|
76
89
|
function FeedbackDialog({ appKey, token, tenant, endpoint, draft, setDraft, onClose, }) {
|
|
77
90
|
const ref = useRef(null);
|
|
@@ -114,13 +127,30 @@ function FeedbackDialog({ appKey, token, tenant, endpoint, draft, setDraft, onCl
|
|
|
114
127
|
if (good.length)
|
|
115
128
|
setDraft((d) => ({ ...d, pictures: [...d.pictures, ...good].slice(0, OS_FEEDBACK_LIMITS.pictures) }));
|
|
116
129
|
};
|
|
130
|
+
/* A paste with a picture adds the picture; any other paste (text) goes on
|
|
131
|
+
as normal. pastedPictures reads clipboardData.files, and items when files
|
|
132
|
+
has none (Safari). */
|
|
117
133
|
const onPaste = (e) => {
|
|
118
|
-
const files =
|
|
134
|
+
const files = pastedPictures(e.clipboardData);
|
|
119
135
|
if (files.length === 0)
|
|
120
136
|
return;
|
|
121
137
|
e.preventDefault();
|
|
122
138
|
void addFiles(files);
|
|
123
139
|
};
|
|
140
|
+
/* Keys typed in the form are the form's: the frame's and the app's own key
|
|
141
|
+
handlers above it (menus, search) never see them. Escape still closes the
|
|
142
|
+
dialog (its cancel event). Safari sends no paste event while a button or
|
|
143
|
+
a radio has focus, so Cmd+V or Ctrl+V there moves focus to the text box
|
|
144
|
+
first, and the paste (a picture or text) lands in the form. */
|
|
145
|
+
const onKeyDown = (e) => {
|
|
146
|
+
e.stopPropagation();
|
|
147
|
+
if (!(e.metaKey || e.ctrlKey) || e.altKey || e.key.toLowerCase() !== "v")
|
|
148
|
+
return;
|
|
149
|
+
const at = e.target;
|
|
150
|
+
const typing = at?.tagName === "TEXTAREA" || (at?.tagName === "INPUT" && at.type === "text") || at?.isContentEditable;
|
|
151
|
+
if (!typing)
|
|
152
|
+
text.current?.focus();
|
|
153
|
+
};
|
|
124
154
|
const onDrop = (e) => {
|
|
125
155
|
if (!e.dataTransfer?.files?.length)
|
|
126
156
|
return;
|
|
@@ -163,11 +193,7 @@ function FeedbackDialog({ appKey, token, tenant, endpoint, draft, setDraft, onCl
|
|
|
163
193
|
return (_jsxs("dialog", { ref: ref, "data-os-feedback": "dialog", "aria-labelledby": `${id}-title`, onCancel: (e) => {
|
|
164
194
|
e.preventDefault();
|
|
165
195
|
close();
|
|
166
|
-
},
|
|
167
|
-
/* Keys typed in the form are the form's: the frame's and the app's own
|
|
168
|
-
key handlers above it (menus, search) never see them. Escape still
|
|
169
|
-
closes the dialog (its cancel event). */
|
|
170
|
-
onKeyDown: (e) => e.stopPropagation(), onPaste: onPaste, onDragOver: (e) => {
|
|
196
|
+
}, onKeyDown: onKeyDown, onPaste: onPaste, onDragOver: (e) => {
|
|
171
197
|
if (e.dataTransfer?.types?.includes("Files"))
|
|
172
198
|
e.preventDefault();
|
|
173
199
|
}, onDrop: onDrop, children: [_jsx("style", { children: CSS }), _jsxs("form", { className: "osfb-form", method: "dialog", onSubmit: (e) => {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const OS_FEEDBACK_ASK_CSS = "\n.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask{width:auto;height:2.25rem;gap:.375rem;margin-inline-end:1rem;padding:0 .875rem 0 .6875rem;border:0;border-radius:999px;background:linear-gradient(110deg,#D1007C 0%,#6E3192 50%,#D1007C 100%);background-size:200% 100%;background-position:0% 50%;color:#FFFFFF;font:inherit;font-size:.8125rem;font-weight:600;line-height:1;white-space:nowrap;animation:osfb-ask-drift 6s ease-in-out 1s 10 alternate}\n.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask:hover{filter:brightness(1.1)}\n.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask:active{filter:brightness(.95)}\n.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.is-seen{animation:none}\n.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask .osfb-ask__icon{display:block;flex:0 0 auto}\n@keyframes osfb-ask-drift{from{background-position:0% 50%}to{background-position:100% 50%}}\n@media (max-width:767px){.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask{margin-inline-end:.5rem;gap:.3125rem;padding:0 .6875rem 0 .5rem}}\n@media (max-width:409px){.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask{padding:0 .75rem}.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask .osfb-ask__icon{display:none}}\n@media (max-width:379px){.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask{width:2.25rem;padding:0}.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask .osfb-ask__icon{display:block}.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask .osfb-ask__word{display:none}}\n@media (max-width:359px){.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask{margin-inline-end:.25rem}}\n@media (prefers-reduced-motion:reduce){.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask{animation:none}}\n@media (forced-colors:active){.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask{border:1px solid ButtonText;background:ButtonFace;color:ButtonText;forced-color-adjust:none}}\n";
|
|
2
|
+
export declare const OS_FEEDBACK_SEEN_KEY = "autosolutions-os:feedback-seen";
|
|
3
|
+
export declare function readSeen(): boolean;
|
|
4
|
+
export declare function keepSeen(): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The bar's Feedback button (0.4.2; Didac, 5 November 2026, picked "B" with
|
|
3
|
+
* more space before the company). A pill in the logo's pink and purple, with
|
|
4
|
+
* a chat icon and the word Feedback, 20px before the company plate (12px on
|
|
5
|
+
* a phone). For its first minute on a page its colour drifts slowly from pink
|
|
6
|
+
* to purple and back, until the person has opened the form once in this
|
|
7
|
+
* browser (`is-seen`, kept in localStorage); never with reduced motion.
|
|
8
|
+
* Phones: the icon and the word from 410px, the word alone from 380px (a
|
|
9
|
+
* 390px iPhone), the icon alone below (measured on the Hub's bar: the search
|
|
10
|
+
* gives way, the plate stays whole, the bar keeps its end padding).
|
|
11
|
+
* Six classes outrank the frame's `.as-frame.as-ws > ... .as-topbar__target`
|
|
12
|
+
* (five), which sizes every bar target as a 36px circle.
|
|
13
|
+
*/
|
|
14
|
+
const A = ".osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask.osfb-ask";
|
|
15
|
+
export const OS_FEEDBACK_ASK_CSS = `
|
|
16
|
+
${A}{width:auto;height:2.25rem;gap:.375rem;margin-inline-end:1rem;padding:0 .875rem 0 .6875rem;border:0;border-radius:999px;background:linear-gradient(110deg,#D1007C 0%,#6E3192 50%,#D1007C 100%);background-size:200% 100%;background-position:0% 50%;color:#FFFFFF;font:inherit;font-size:.8125rem;font-weight:600;line-height:1;white-space:nowrap;animation:osfb-ask-drift 6s ease-in-out 1s 10 alternate}
|
|
17
|
+
${A}:hover{filter:brightness(1.1)}
|
|
18
|
+
${A}:active{filter:brightness(.95)}
|
|
19
|
+
${A}.is-seen{animation:none}
|
|
20
|
+
${A} .osfb-ask__icon{display:block;flex:0 0 auto}
|
|
21
|
+
@keyframes osfb-ask-drift{from{background-position:0% 50%}to{background-position:100% 50%}}
|
|
22
|
+
@media (max-width:767px){${A}{margin-inline-end:.5rem;gap:.3125rem;padding:0 .6875rem 0 .5rem}}
|
|
23
|
+
@media (max-width:409px){${A}{padding:0 .75rem}${A} .osfb-ask__icon{display:none}}
|
|
24
|
+
@media (max-width:379px){${A}{width:2.25rem;padding:0}${A} .osfb-ask__icon{display:block}${A} .osfb-ask__word{display:none}}
|
|
25
|
+
@media (max-width:359px){${A}{margin-inline-end:.25rem}}
|
|
26
|
+
@media (prefers-reduced-motion:reduce){${A}{animation:none}}
|
|
27
|
+
@media (forced-colors:active){${A}{border:1px solid ButtonText;background:ButtonFace;color:ButtonText;forced-color-adjust:none}}
|
|
28
|
+
`;
|
|
29
|
+
/* Opened once in this browser: the button stops drifting for good. Storage can
|
|
30
|
+
be missing or refuse (private windows, blocked site data); then it drifts. */
|
|
31
|
+
export const OS_FEEDBACK_SEEN_KEY = "autosolutions-os:feedback-seen";
|
|
32
|
+
export function readSeen() {
|
|
33
|
+
try {
|
|
34
|
+
return globalThis.localStorage?.getItem(OS_FEEDBACK_SEEN_KEY) === "1";
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function keepSeen() {
|
|
41
|
+
try {
|
|
42
|
+
globalThis.localStorage?.setItem(OS_FEEDBACK_SEEN_KEY, "1");
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
/* nothing to keep it in */
|
|
46
|
+
}
|
|
47
|
+
}
|
package/dist/feedbackSend.d.ts
CHANGED
|
@@ -64,5 +64,23 @@ export declare function sendFeedback(input: {
|
|
|
64
64
|
endpoint?: string;
|
|
65
65
|
fetch?: typeof fetch;
|
|
66
66
|
}): Promise<OsFeedbackResult>;
|
|
67
|
+
/** What a paste or a drop carries: its files, and each item that is a file. */
|
|
68
|
+
export type OsPastedData = {
|
|
69
|
+
files?: ArrayLike<File> | null;
|
|
70
|
+
items?: ArrayLike<{
|
|
71
|
+
kind: string;
|
|
72
|
+
type: string;
|
|
73
|
+
getAsFile(): File | null;
|
|
74
|
+
}> | null;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* The pictures in a paste (0.4.2). Most browsers put a copied picture in
|
|
78
|
+
* `clipboardData.files`. Safari, and some "Copy image" menus, give it only in
|
|
79
|
+
* `clipboardData.items` (an item of kind "file"). This reads `files` first;
|
|
80
|
+
* only when `files` has no picture does it read `items`, because a browser
|
|
81
|
+
* that fills both puts the same picture in each. An item's file with no type
|
|
82
|
+
* takes the item's type. Text is never a picture, so a text paste gives [].
|
|
83
|
+
*/
|
|
84
|
+
export declare function pastedPictures(data: OsPastedData | null | undefined): File[];
|
|
67
85
|
/** One picture the person added, made ready to send, or a sentence saying why it cannot be. */
|
|
68
86
|
export declare function readPicture(file: File): Promise<OsFeedbackPicture | string>;
|
package/dist/feedbackSend.js
CHANGED
|
@@ -116,6 +116,34 @@ async function shrink(file) {
|
|
|
116
116
|
bitmap.close?.();
|
|
117
117
|
return await new Promise((resolve) => canvas.toBlob((blob) => resolve(blob), "image/jpeg", 0.85));
|
|
118
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* The pictures in a paste (0.4.2). Most browsers put a copied picture in
|
|
121
|
+
* `clipboardData.files`. Safari, and some "Copy image" menus, give it only in
|
|
122
|
+
* `clipboardData.items` (an item of kind "file"). This reads `files` first;
|
|
123
|
+
* only when `files` has no picture does it read `items`, because a browser
|
|
124
|
+
* that fills both puts the same picture in each. An item's file with no type
|
|
125
|
+
* takes the item's type. Text is never a picture, so a text paste gives [].
|
|
126
|
+
*/
|
|
127
|
+
export function pastedPictures(data) {
|
|
128
|
+
if (!data)
|
|
129
|
+
return [];
|
|
130
|
+
const files = Array.from(data.files ?? []).filter((f) => f.type.startsWith("image/"));
|
|
131
|
+
if (files.length)
|
|
132
|
+
return files;
|
|
133
|
+
const out = [];
|
|
134
|
+
for (const item of Array.from(data.items ?? [])) {
|
|
135
|
+
if (item.kind !== "file")
|
|
136
|
+
continue;
|
|
137
|
+
const f = item.getAsFile();
|
|
138
|
+
if (!f)
|
|
139
|
+
continue;
|
|
140
|
+
const type = f.type || item.type;
|
|
141
|
+
if (!type.startsWith("image/"))
|
|
142
|
+
continue;
|
|
143
|
+
out.push(f.type ? f : new File([f], f.name || "picture", { type }));
|
|
144
|
+
}
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
119
147
|
/** One picture the person added, made ready to send, or a sentence saying why it cannot be. */
|
|
120
148
|
export async function readPicture(file) {
|
|
121
149
|
if (!file.type.startsWith("image/"))
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export { loadOsContext, invalidateOsContext, refreshOsContext, retryOsContext, w
|
|
|
5
5
|
export { isEntitled, isActiveMember, appRole, appVariant, currentTenant, toolAllowed, myAdminScope, canManageCurrentCompany, type AdminScope, } from "./identity.js";
|
|
6
6
|
export { OsAppSwitcher, OsAppSwitcherPlate, OsCompanySwitcher, OsBar, useCompanySwitch } from "./chrome.js";
|
|
7
7
|
export { OsAuthGate, type OsAuthGateProps } from "./gate.js";
|
|
8
|
-
export { OsFeedbackButton, sendFeedback, feedbackContext, feedbackEndpoint, readPicture, OS_FEEDBACK_TYPES, OS_FEEDBACK_LIMITS, type OsFeedbackProps, type OsFeedbackResult, type OsFeedbackTenant, type OsFeedbackType, type OsFeedbackPicture, } from "./feedback.js";
|
|
8
|
+
export { OsFeedbackButton, sendFeedback, feedbackContext, feedbackEndpoint, readPicture, pastedPictures, OS_FEEDBACK_TYPES, OS_FEEDBACK_LIMITS, type OsFeedbackProps, type OsFeedbackResult, type OsFeedbackTenant, type OsFeedbackType, type OsFeedbackPicture, type OsPastedData, } from "./feedback.js";
|
|
9
9
|
export { osAccessToken } from "./client.js";
|
|
10
10
|
export { OS_VERSION } from "./version.js";
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,6 @@ export { loadOsContext, invalidateOsContext, refreshOsContext, retryOsContext, w
|
|
|
5
5
|
export { isEntitled, isActiveMember, appRole, appVariant, currentTenant, toolAllowed, myAdminScope, canManageCurrentCompany, } from "./identity.js";
|
|
6
6
|
export { OsAppSwitcher, OsAppSwitcherPlate, OsCompanySwitcher, OsBar, useCompanySwitch } from "./chrome.js";
|
|
7
7
|
export { OsAuthGate } from "./gate.js";
|
|
8
|
-
export { OsFeedbackButton, sendFeedback, feedbackContext, feedbackEndpoint, readPicture, OS_FEEDBACK_TYPES, OS_FEEDBACK_LIMITS, } from "./feedback.js";
|
|
8
|
+
export { OsFeedbackButton, sendFeedback, feedbackContext, feedbackEndpoint, readPicture, pastedPictures, OS_FEEDBACK_TYPES, OS_FEEDBACK_LIMITS, } from "./feedback.js";
|
|
9
9
|
export { osAccessToken } from "./client.js";
|
|
10
10
|
export { OS_VERSION } from "./version.js";
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** This package's version, sent with each feedback message. A test keeps it equal to package.json. */
|
|
2
|
-
export declare const OS_VERSION = "0.4.
|
|
2
|
+
export declare const OS_VERSION = "0.4.2";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** This package's version, sent with each feedback message. A test keeps it equal to package.json. */
|
|
2
|
-
export const OS_VERSION = "0.4.
|
|
2
|
+
export const OS_VERSION = "0.4.2";
|
package/package.json
CHANGED