autosolutions-os 0.3.14 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0 - 2026-11-05
4
+
5
+ One way to send feedback in every app (Didac, 5 November 2026: "Yes, all A").
6
+ Until now Ops Hub, Create Studio and the CRM each had their own form and the
7
+ other apps had none.
8
+
9
+ ### autosolutions-os/feedback (new)
10
+
11
+ - `OsFeedbackButton`: the ? in the top bar and the one feedback form: a type
12
+ (Bug, Idea, Question, Other), what happened, up to three pictures. Send posts
13
+ it with the person's own token, the page and the browser to the core's
14
+ `feedback-submit` (autosolutions-core#43), which keeps it for
15
+ Hub > Admin > Feedback and sends the Slack DM. A native `<dialog>` with its
16
+ own styles; a closed form keeps its draft.
17
+ - `sendFeedback`, `feedbackContext`, `feedbackEndpoint`, `readPicture`,
18
+ `OS_FEEDBACK_TYPES`, `OS_FEEDBACK_LIMITS`: the form's logic, without React.
19
+ - `OS_VERSION` (also from `autosolutions-os`): this package's version, sent
20
+ with each message. `osAccessToken()`: the page's core session token.
21
+
22
+ ### autosolutions-os/frame
23
+
24
+ - OsWorkspaceFrame draws the ? after the app's own `actions`, directly left of
25
+ the company plate. New prop `feedback` (default true); `auth` may carry
26
+ `getSession`, which gives the form its token (else the page's
27
+ `createOsClient`).
28
+
29
+ ### autosolutions-os/core-view
30
+
31
+ - `useCoreFrame({ feedback: { token } })` gives `core.feedback`, the ? for the
32
+ TopBar's `actions`, sending the app's own project token and the company the
33
+ plate shows. Without `feedback`, `core.feedback` is null.
34
+
35
+ ### For the apps
36
+
37
+ - 0.4.0, not 0.3.15: an app gets the ? only when it takes this release, in the
38
+ same PR that removes its old feedback button and form (Ops Hub, Create
39
+ Studio, the CRM), so no app shows two.
40
+ - Apps on the core: a lockfile bump, and remove the old form. Apps on their own
41
+ project: pass `feedback.token` and `actions={core.feedback}`.
42
+ - Unchanged: the menu, every id, tab, route and link.
43
+
3
44
  ## 0.3.14 - 2026-11-04
4
45
 
5
46
  Operations > Forecast accuracy opened its sample page in the Hub, marked
package/README.md CHANGED
@@ -442,6 +442,45 @@ On the server there is no cookie to read, so the hook gives the fallback:
442
442
  render the frame in the browser only (Asset Portal's staff face does), or
443
443
  accept a first paint of the fallback.
444
444
 
445
+ ### Feedback: the ? in the top bar (0.4.0)
446
+
447
+ Every app has one way to send feedback: the ? in the top bar, directly left
448
+ of the company plate. It opens the same form everywhere: a type (Bug, Idea,
449
+ Question, Other), what happened, and up to three pictures (picked, pasted or
450
+ dropped; PNG, JPEG or WebP, 3 MB each, big ones made smaller first). Send adds
451
+ what the page knows (the app, the page's path, title and address, the company
452
+ on the plate, the browser, the screen, the language, the time zone, the app's
453
+ commit from Lovable's `data-commit-sha`, and this package's version) and posts
454
+ it with the person's own access token to the core's edge function
455
+ `feedback-submit`. The core checks the token, adds the person's name and
456
+ email, keeps the message for Hub > Admin > Feedback and sends the Slack DM.
457
+
458
+ OsWorkspaceFrame draws it by itself, after the app's own `actions`. Its token
459
+ is the app's `auth` client's session (or the page's `createOsClient`). Leave it
460
+ out with `feedback={false}`.
461
+
462
+ An app on its own project hands its own project's token to `useCoreFrame` and
463
+ puts `core.feedback` in its TopBar's `actions`; the core asks that project who
464
+ the token belongs to (Ops Hub, Key Accounts and Asset Portal):
465
+
466
+ ```tsx
467
+ const core = useCoreFrame({
468
+ appKey: "ops_hub",
469
+ email: user?.email,
470
+ fallback,
471
+ feedback: { token: async () => (await supabase.auth.getSession()).data.session?.access_token },
472
+ });
473
+
474
+ <TopBar variant="workspace" actions={core.feedback} {...core.plate} />
475
+ ```
476
+
477
+ Without `feedback` the hook gives `core.feedback === null`, so an app shows
478
+ the ? only once it hands its token. The form is a native `<dialog>` with its
479
+ own styles: it needs no stylesheet from the app, sits above the app's own
480
+ layout, and Escape closes it. Closing it keeps the draft until it is sent.
481
+ `autosolutions-os/feedback` also exports the form's logic (`sendFeedback`,
482
+ `feedbackContext`, `readPicture`) for tests.
483
+
445
484
  ## On the server
446
485
 
447
486
  The package is plain ES modules, so Node, a test runner and a dev server's SSR
package/dist/client.d.ts CHANGED
@@ -23,4 +23,10 @@ export declare function createOsClient(options: {
23
23
  }): OsClient;
24
24
  /** Test seam: forget the cached client. */
25
25
  export declare function resetOsClient(): void;
26
+ /**
27
+ * The page's core session token, for the feedback form (0.4.0): from this
28
+ * page's createOsClient when the app made one, else from the session
29
+ * supabase-js keeps in storage. Null when nobody is signed in.
30
+ */
31
+ export declare function osAccessToken(): Promise<string | null>;
26
32
  export {};
package/dist/client.js CHANGED
@@ -43,3 +43,24 @@ export function createOsClient(options) {
43
43
  export function resetOsClient() {
44
44
  cached = undefined;
45
45
  }
46
+ /**
47
+ * The page's core session token, for the feedback form (0.4.0): from this
48
+ * page's createOsClient when the app made one, else from the session
49
+ * supabase-js keeps in storage. Null when nobody is signed in.
50
+ */
51
+ export async function osAccessToken() {
52
+ if (cached) {
53
+ const { data } = await cached.supabase.auth.getSession();
54
+ return data.session?.access_token ?? null;
55
+ }
56
+ try {
57
+ if (typeof localStorage === "undefined")
58
+ return null;
59
+ const raw = localStorage.getItem(`sb-${coreProjectRef()}-auth-token`);
60
+ const session = raw ? JSON.parse(raw) : null;
61
+ return typeof session?.access_token === "string" ? session.access_token : null;
62
+ }
63
+ catch {
64
+ return null;
65
+ }
66
+ }
@@ -1,3 +1,33 @@
1
+ /**
2
+ * autosolutions-os/core-view (0.3.4): the Hub's frame in an app that keeps its
3
+ * own Supabase project, for a person who is signed in at the Hub.
4
+ *
5
+ * Asset Portal and Ops Hub build their frame from `osFrame` and the design
6
+ * system's WorkspaceFrame, because their own client cannot read the core. On
7
+ * an autosolutions.app address the core's shared cookie holds the Hub's
8
+ * session, so `useCoreFrame` reads the core's own view of the person through
9
+ * it (coreReader.ts: os_context(), my_admin_scope() and the company switch,
10
+ * nothing else, never signing in, refreshing or writing anything) and hands
11
+ * back exactly what OsWorkspaceFrame gives an app on the core:
12
+ *
13
+ * - the menu links from the catalogue (`catalogueLinks`): a tool whose app
14
+ * the person holds opens it, with the acting company as ?tenant=; a tool
15
+ * whose app they do not hold is locked; a held app with no address yet
16
+ * opens its page in the Hub;
17
+ * - the Admin row, for someone who manages something;
18
+ * - the company plate from the acting company, and with more than one company
19
+ * its switcher (plate.tsx, the same code as OsWorkspaceFrame's), which
20
+ * switches as the Hub does: a reload here when the new company holds this
21
+ * app at this address, its deployment elsewhere, or the Hub when it does
22
+ * not hold the app.
23
+ *
24
+ * Without a Hub session for the app's person (signed out at the Hub, someone
25
+ * else at the Hub, a partner, cookies blocked, or off autosolutions.app) it
26
+ * hands back today's frame instead: the fixed addresses (`staticLinks`) with
27
+ * the app's own company, no Admin row, and a static plate. The app's own
28
+ * sign-in, data and rules are untouched either way.
29
+ */
30
+ import { type ReactNode } from "react";
1
31
  import { type OsCompanySwitch, type OsPlateProps } from "./plate.js";
2
32
  export { CORE_VIEW_FUNCTIONS, createCoreViewClient, hubSession, type CoreViewClient, type CoreViewClientOptions, type CoreViewFunction, type CoreViewResult, type HubSession, } from "./coreReader.js";
3
33
  export type { OsCompanySwitch, OsPlateProps } from "./plate.js";
@@ -21,6 +51,14 @@ export type CoreFrameOptions = {
21
51
  };
22
52
  /** How the plate switches company with a Hub session. Default "os", as in the Hub. */
23
53
  companySwitch?: OsCompanySwitch;
54
+ /**
55
+ * The ? in the top bar (0.4.0): the one feedback form every app shares.
56
+ * `token` gives the app's own access token (its own project's session); the
57
+ * core asks that project who it is. Without it `feedback` is null.
58
+ */
59
+ feedback?: {
60
+ token: () => Promise<string | null | undefined>;
61
+ };
24
62
  };
25
63
  /**
26
64
  * Where the frame comes from:
@@ -49,10 +87,17 @@ export type CoreFrame = {
49
87
  frameOptions: CoreFrameOptionsForOsFrame;
50
88
  /** For `<TopBar variant="workspace" {...plate} />`. */
51
89
  plate: CorePlateProps;
90
+ /**
91
+ * The ? button and its form (0.4.0), for the TopBar's `actions`, so it sits
92
+ * directly left of the company plate: `<TopBar variant="workspace"
93
+ * actions={core.feedback} {...core.plate} />`. Null without the `feedback`
94
+ * option.
95
+ */
96
+ feedback: ReactNode;
52
97
  };
53
98
  /**
54
99
  * The frame's links, Admin row and company plate from the core's own view of
55
100
  * the person signed in to the app, when they are signed in at the Hub;
56
101
  * otherwise the app's fallback frame. See the top of this file.
57
102
  */
58
- export declare function useCoreFrame({ appKey, email, fallback, companySwitch }: CoreFrameOptions): CoreFrame;
103
+ export declare function useCoreFrame({ appKey, email, fallback, companySwitch, feedback }: CoreFrameOptions): CoreFrame;
package/dist/coreView.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  /**
2
3
  * autosolutions-os/core-view (0.3.4): the Hub's frame in an app that keeps its
3
4
  * own Supabase project, for a person who is signed in at the Hub.
@@ -31,6 +32,7 @@ import { useEffect, useMemo, useRef, useState } from "react";
31
32
  import { retryOsContext } from "./context.js";
32
33
  import { followOsPerson } from "./contextCache.js";
33
34
  import { createCoreViewClient, hubSession } from "./coreReader.js";
35
+ import { OsFeedbackButton } from "./feedback.js";
34
36
  import { myAdminScope } from "./identity.js";
35
37
  import { catalogueLinks, hubPanelLocks, staticLinks, withItemLocks } from "./nav.js";
36
38
  import { useOsPlate } from "./plate.js";
@@ -43,7 +45,7 @@ const sameHub = (a, b) => (a === b || (a !== null && b !== null && a.userId ===
43
45
  * the person signed in to the app, when they are signed in at the Hub;
44
46
  * otherwise the app's fallback frame. See the top of this file.
45
47
  */
46
- export function useCoreFrame({ appKey, email, fallback, companySwitch = "os" }) {
48
+ export function useCoreFrame({ appKey, email, fallback, companySwitch = "os", feedback }) {
47
49
  /* One reader per mounted frame, asking with the app's person as they are now. */
48
50
  const emailNow = useRef(email);
49
51
  emailNow.current = email;
@@ -133,5 +135,13 @@ export function useCoreFrame({ appKey, email, fallback, companySwitch = "os" })
133
135
  ...(fallback.companySrc ? { companySrc: fallback.companySrc } : {}),
134
136
  ...(fallback.companyName ? { companyName: fallback.companyName } : {}),
135
137
  }), [fallback.companySrc, fallback.companyName]);
136
- return { source, frameOptions, plate: source === "static" ? staticPlate : plate };
138
+ /* The company the bar shows: the core's acting one, or the app's own. */
139
+ const feedbackToken = feedback?.token;
140
+ const tenantId = source === "core" ? current?.id ?? null : null;
141
+ const tenantSlug = source === "core" ? current?.slug ?? null : fallback.tenantSlug;
142
+ const tenantName = source === "core" ? current?.name ?? null : fallback.companyName ?? null;
143
+ const feedbackButton = useMemo(() => (feedbackToken
144
+ ? _jsx(OsFeedbackButton, { appKey: appKey, token: feedbackToken, tenant: { id: tenantId, slug: tenantSlug, name: tenantName } })
145
+ : null), [appKey, feedbackToken, tenantId, tenantSlug, tenantName]);
146
+ return { source, frameOptions, plate: source === "static" ? staticPlate : plate, feedback: feedbackButton };
137
147
  }
@@ -0,0 +1,4 @@
1
+ import { type OsFeedbackProps } from "./feedbackSend.js";
2
+ export { OS_FEEDBACK_LIMITS, OS_FEEDBACK_TYPES, feedbackContext, feedbackEndpoint, readPicture, sendFeedback, type OsFeedbackPicture, type OsFeedbackProps, type OsFeedbackResult, type OsFeedbackTenant, type OsFeedbackType, } from "./feedbackSend.js";
3
+ /** The ? button and its form. */
4
+ export declare function OsFeedbackButton({ appKey, token, tenant, endpoint }: OsFeedbackProps): import("react").JSX.Element;
@@ -0,0 +1,185 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * autosolutions-os/feedback (0.4.0): the ? in the top bar, and the one
4
+ * feedback form every app shares.
5
+ *
6
+ * OsWorkspaceFrame draws the ? by itself, directly left of the company plate.
7
+ * An app on its own project gets it from `useCoreFrame({ feedback })` as
8
+ * `core.feedback`, for its TopBar's `actions`.
9
+ *
10
+ * The form asks for a type (Bug, Idea, Question, Other), what happened, and up
11
+ * to three pictures (picked, pasted or dropped). When the person presses Send
12
+ * it adds what the page knows: the app, the page's path, title and address,
13
+ * the company the bar shows, the browser, the screen, the language, the time
14
+ * zone, the app's commit (Lovable's `data-commit-sha`) and this package's
15
+ * version. It sends all of it with the person's own access token to the core
16
+ * edge function `feedback-submit`, which checks the token, adds the person's
17
+ * name and email, saves it for Hub > Admin > Feedback, and sends the Slack DM.
18
+ *
19
+ * The dialog is a native <dialog> opened with showModal(), so it sits above
20
+ * everything on the page whatever the app's own layout does, and Escape closes
21
+ * it. It carries its own styles (the frame's tokens where they reach it), so
22
+ * it needs no stylesheet from the app. A closed form keeps its draft until it
23
+ * is sent or the page reloads.
24
+ */
25
+ import { useEffect, useId, useRef, useState } from "react";
26
+ import { OS_FEEDBACK_LIMITS, OS_FEEDBACK_TYPES, readPicture, sendFeedback, } from "./feedbackSend.js";
27
+ export { OS_FEEDBACK_LIMITS, OS_FEEDBACK_TYPES, feedbackContext, feedbackEndpoint, readPicture, sendFeedback, } from "./feedbackSend.js";
28
+ /* Heroicons' outline question-mark-circle, inline so the bar fetches nothing. */
29
+ const GLYPH = (_jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", focusable: "false", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z" }) }));
30
+ const D = 'dialog[data-os-feedback="dialog"]';
31
+ const CSS = `
32
+ ${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}
33
+ ${D}::backdrop{background:rgba(26,26,26,.45)}
34
+ ${D} *{box-sizing:border-box}
35
+ ${D} .osfb-form{display:flex;flex-direction:column;gap:1rem;margin:0;padding:1.25rem 1.5rem 1.5rem}
36
+ ${D} .osfb-head{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}
37
+ ${D} .osfb-title{margin:0;font-size:1.125rem;line-height:1.3;font-weight:600;color:inherit}
38
+ ${D} .osfb-sub,${D} .osfb-note{margin:.25rem 0 0;font-size:.8125rem;color:var(--ws-color-text-secondary,#616161)}
39
+ ${D} .osfb-close{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;margin:-.25rem -.5rem 0 0;padding:0;border:0;border-radius:999px;background:transparent;color:inherit;font:inherit;font-size:1.25rem;line-height:1;cursor:pointer}
40
+ ${D} .osfb-close:hover{background:var(--ws-color-fill-hover,rgba(0,0,0,.05))}
41
+ ${D} .osfb-label{display:block;margin:0 0 .375rem;font-weight:600;font-size:.8125rem;color:inherit}
42
+ ${D} fieldset.osfb-group{margin:0;padding:0;border:0;min-width:0}
43
+ ${D} .osfb-types{display:flex;flex-wrap:wrap;gap:.5rem}
44
+ ${D} .osfb-type{position:relative;display:inline-flex;align-items:center;height:2rem;padding:0 .875rem;border:1px solid var(--ws-color-border,#E6E6E8);border-radius:999px;background:var(--ws-color-surface,#FFFFFF);color:inherit;font-weight:550;cursor:pointer;user-select:none}
45
+ ${D} .osfb-type:hover{background:var(--ws-color-fill-hover,rgba(0,0,0,.05))}
46
+ ${D} .osfb-type.is-on{border-color:var(--ws-color-pill-ink,#2B5BE3);background:var(--ws-color-pill,#E3EAFD);color:var(--ws-color-pill-ink,#2B5BE3)}
47
+ ${D} .osfb-type input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
48
+ ${D} .osfb-type:has(input:focus-visible){outline:2px solid var(--ws-color-focus,#2B5BE3);outline-offset:2px}
49
+ ${D} textarea.osfb-text{display:block;width:100%;min-height:8rem;margin:0;padding:.5rem .75rem;border:1px solid var(--ws-color-sheet-stroke,#D1D1D1);border-radius:.5rem;background:#FFFFFF;color:inherit;font:inherit;line-height:1.45;resize:vertical}
50
+ ${D} textarea.osfb-text:focus{outline:2px solid var(--ws-color-focus,#2B5BE3);outline-offset:0;border-color:transparent}
51
+ ${D} .osfb-pics{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}
52
+ ${D} .osfb-pic{position:relative;width:4.5rem;height:4.5rem;border:1px solid var(--ws-color-border,#E6E6E8);border-radius:.5rem;overflow:hidden;background:#F4F4F5}
53
+ ${D} .osfb-pic img{display:block;width:100%;height:100%;object-fit:cover}
54
+ ${D} .osfb-pic button{position:absolute;top:.125rem;right:.125rem;display:inline-flex;align-items:center;justify-content:center;width:1.375rem;height:1.375rem;padding:0;border:0;border-radius:999px;background:rgba(26,26,26,.75);color:#FFFFFF;font:inherit;font-size:.875rem;line-height:1;cursor:pointer}
55
+ ${D} .osfb-btn{display:inline-flex;align-items:center;justify-content:center;gap:.375rem;height:2.25rem;padding:0 1rem;border:0;border-radius:.5rem;background:var(--ws-color-button,#E3E3E3);color:var(--ws-color-text,#303030);font:inherit;font-weight:600;cursor:pointer;text-decoration:none}
56
+ ${D} .osfb-btn:hover{background:var(--ws-color-button-hover,#D4D4D4)}
57
+ ${D} .osfb-btn:disabled{cursor:default;opacity:.6}
58
+ ${D} .osfb-btn.is-primary{background:var(--ws-color-badge,#303030);color:var(--ws-color-badge-text,#FFFFFF)}
59
+ ${D} .osfb-btn.is-primary:hover{background:#1A1A1A}
60
+ ${D} .osfb-btn:focus-visible,${D} .osfb-close:focus-visible,${D} .osfb-pic button:focus-visible{outline:2px solid var(--ws-color-focus,#2B5BE3);outline-offset:2px}
61
+ ${D} .osfb-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}
62
+ ${D} .osfb-alert{margin:0;padding:.625rem .75rem;border-radius:.5rem;font-size:.8125rem}
63
+ ${D} .osfb-alert.is-error{background:#FDECEE;color:var(--ws-color-text-critical,#8E0B21)}
64
+ ${D} .osfb-alert.is-ok{background:#E7F5EC;color:#14532D}
65
+ ${D} .osfb-alert ul{margin:.375rem 0 0;padding-inline-start:1.25rem}
66
+ ${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
+ `;
68
+ const EMPTY = { type: "bug", message: "", pictures: [] };
69
+ /** The ? button and its form. */
70
+ export function OsFeedbackButton({ appKey, token, tenant, endpoint }) {
71
+ const [open, setOpen] = useState(false);
72
+ /* Kept here, not in the dialog, so closing the form keeps what was typed. */
73
+ const [draft, setDraft] = useState(EMPTY);
74
+ return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "as-topbar__target", "aria-label": "Send feedback", title: "Send feedback", "aria-haspopup": "dialog", "data-os-feedback": "button", onClick: () => setOpen(true), children: GLYPH }), open && (_jsx(FeedbackDialog, { appKey: appKey, token: token, tenant: tenant ?? null, ...(endpoint ? { endpoint } : {}), draft: draft, setDraft: setDraft, onClose: () => setOpen(false) }))] }));
75
+ }
76
+ function FeedbackDialog({ appKey, token, tenant, endpoint, draft, setDraft, onClose, }) {
77
+ const ref = useRef(null);
78
+ const text = useRef(null);
79
+ const file = useRef(null);
80
+ const id = useId();
81
+ const [sending, setSending] = useState(false);
82
+ const [error, setError] = useState(null);
83
+ const [sent, setSent] = useState(null);
84
+ const live = useRef(true);
85
+ useEffect(() => {
86
+ live.current = true;
87
+ const dialog = ref.current;
88
+ if (dialog && !dialog.open) {
89
+ if (typeof dialog.showModal === "function")
90
+ dialog.showModal();
91
+ else
92
+ dialog.setAttribute("open", "");
93
+ }
94
+ text.current?.focus();
95
+ return () => {
96
+ live.current = false;
97
+ };
98
+ }, []);
99
+ const addFiles = async (files) => {
100
+ const list = Array.from(files).filter((f) => f.type.startsWith("image/"));
101
+ if (list.length === 0)
102
+ return;
103
+ const room = OS_FEEDBACK_LIMITS.pictures - draft.pictures.length;
104
+ if (room <= 0) {
105
+ setError(`You can add up to ${OS_FEEDBACK_LIMITS.pictures} pictures.`);
106
+ return;
107
+ }
108
+ const read = await Promise.all(list.slice(0, room).map(readPicture));
109
+ if (!live.current)
110
+ return;
111
+ const good = read.filter((r) => typeof r !== "string");
112
+ const bad = read.find((r) => typeof r === "string");
113
+ setError(bad ?? (list.length > room ? `You can add up to ${OS_FEEDBACK_LIMITS.pictures} pictures.` : null));
114
+ if (good.length)
115
+ setDraft((d) => ({ ...d, pictures: [...d.pictures, ...good].slice(0, OS_FEEDBACK_LIMITS.pictures) }));
116
+ };
117
+ const onPaste = (e) => {
118
+ const files = Array.from(e.clipboardData?.files ?? []).filter((f) => f.type.startsWith("image/"));
119
+ if (files.length === 0)
120
+ return;
121
+ e.preventDefault();
122
+ void addFiles(files);
123
+ };
124
+ const onDrop = (e) => {
125
+ if (!e.dataTransfer?.files?.length)
126
+ return;
127
+ e.preventDefault();
128
+ void addFiles(Array.from(e.dataTransfer.files));
129
+ };
130
+ const close = () => {
131
+ const dialog = ref.current;
132
+ if (dialog?.open && typeof dialog.close === "function")
133
+ dialog.close();
134
+ onClose();
135
+ };
136
+ const send = async () => {
137
+ const message = draft.message.trim();
138
+ if (!message) {
139
+ setError("Write what happened or what you would like.");
140
+ text.current?.focus();
141
+ return;
142
+ }
143
+ if (message.length > OS_FEEDBACK_LIMITS.message) {
144
+ setError(`Keep it under ${OS_FEEDBACK_LIMITS.message} characters.`);
145
+ return;
146
+ }
147
+ setSending(true);
148
+ setError(null);
149
+ const result = await sendFeedback({
150
+ appKey, type: draft.type, message, pictures: draft.pictures, tenant, token, ...(endpoint ? { endpoint } : {}),
151
+ });
152
+ if (!live.current)
153
+ return;
154
+ setSending(false);
155
+ if (result.ok) {
156
+ setDraft(() => EMPTY);
157
+ setSent({ warnings: result.warnings });
158
+ }
159
+ else {
160
+ setError(result.error);
161
+ }
162
+ };
163
+ return (_jsxs("dialog", { ref: ref, "data-os-feedback": "dialog", "aria-labelledby": `${id}-title`, onCancel: (e) => {
164
+ e.preventDefault();
165
+ 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) => {
171
+ if (e.dataTransfer?.types?.includes("Files"))
172
+ e.preventDefault();
173
+ }, onDrop: onDrop, children: [_jsx("style", { children: CSS }), _jsxs("form", { className: "osfb-form", method: "dialog", onSubmit: (e) => {
174
+ e.preventDefault();
175
+ if (!sending && !sent)
176
+ void send();
177
+ }, children: [_jsxs("div", { className: "osfb-head", children: [_jsxs("div", { children: [_jsx("h2", { className: "osfb-title", id: `${id}-title`, children: "Send feedback" }), _jsx("p", { className: "osfb-sub", children: "Tell us what went wrong or what would help." })] }), _jsx("button", { type: "button", className: "osfb-close", "aria-label": "Close", onClick: close, children: "\u00D7" })] }), sent ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "osfb-alert is-ok", role: "status", children: ["Thanks. We got your feedback.", sent.warnings.length > 0 && (_jsx("ul", { children: sent.warnings.map((w) => _jsx("li", { children: w }, w)) }))] }), _jsxs("div", { className: "osfb-actions", children: [_jsx("button", { type: "button", className: "osfb-btn", onClick: () => setSent(null), children: "Send more" }), _jsx("button", { type: "button", className: "osfb-btn is-primary", onClick: close, children: "Close" })] })] })) : (_jsxs(_Fragment, { children: [_jsxs("fieldset", { className: "osfb-group", children: [_jsx("legend", { className: "osfb-label", children: "Type" }), _jsx("div", { className: "osfb-types", children: OS_FEEDBACK_TYPES.map((t) => (_jsxs("label", { className: draft.type === t.value ? "osfb-type is-on" : "osfb-type", children: [_jsx("input", { type: "radio", name: `${id}-type`, value: t.value, checked: draft.type === t.value, onChange: () => setDraft((d) => ({ ...d, type: t.value })) }), t.label] }, t.value))) })] }), _jsxs("div", { children: [_jsx("label", { className: "osfb-label", htmlFor: `${id}-text`, children: "What happened?" }), _jsx("textarea", { ref: text, id: `${id}-text`, className: "osfb-text", value: draft.message, maxLength: OS_FEEDBACK_LIMITS.message, placeholder: "What did you do, what did you expect, and what happened instead?", onChange: (e) => {
178
+ const message = e.target.value;
179
+ setDraft((d) => ({ ...d, message }));
180
+ } })] }), _jsxs("div", { children: [_jsx("span", { className: "osfb-label", id: `${id}-pics`, children: "Pictures (optional)" }), _jsxs("div", { className: "osfb-pics", role: "group", "aria-labelledby": `${id}-pics`, children: [draft.pictures.map((p, i) => (_jsxs("div", { className: "osfb-pic", children: [_jsx("img", { src: p.data, alt: `Picture ${i + 1}` }), _jsx("button", { type: "button", "aria-label": `Remove picture ${i + 1}`, onClick: () => setDraft((d) => ({ ...d, pictures: d.pictures.filter((_, j) => j !== i) })), children: "\u00D7" })] }, `${i}-${p.size}`))), draft.pictures.length < OS_FEEDBACK_LIMITS.pictures && (_jsx("button", { type: "button", className: "osfb-btn", onClick: () => file.current?.click(), children: "Add a picture" })), _jsx("input", { ref: file, className: "osfb-sr", type: "file", accept: "image/png,image/jpeg,image/webp", multiple: true, tabIndex: -1, "aria-hidden": "true", onChange: (e) => {
181
+ const files = Array.from(e.target.files ?? []);
182
+ e.target.value = "";
183
+ void addFiles(files);
184
+ } })] }), _jsxs("p", { className: "osfb-note", children: ["You can also paste or drop up to ", OS_FEEDBACK_LIMITS.pictures, " pictures here."] })] }), _jsx("p", { className: "osfb-note", children: "We also send the app, this page's address, your company, your name and email, your browser and the time." }), error && _jsx("p", { className: "osfb-alert is-error", role: "alert", children: error }), _jsxs("div", { className: "osfb-actions", children: [_jsx("button", { type: "button", className: "osfb-btn", onClick: close, children: "Cancel" }), _jsx("button", { type: "submit", className: "osfb-btn is-primary", disabled: sending, children: sending ? "Sending" : "Send" })] })] }))] })] }));
185
+ }
@@ -0,0 +1,68 @@
1
+ export type OsFeedbackType = "bug" | "idea" | "question" | "other";
2
+ export declare const OS_FEEDBACK_TYPES: ReadonlyArray<{
3
+ value: OsFeedbackType;
4
+ label: string;
5
+ }>;
6
+ export declare const OS_FEEDBACK_LIMITS: {
7
+ readonly message: 8000;
8
+ readonly pictures: 3;
9
+ readonly pictureBytes: number;
10
+ };
11
+ /** The company the bar shows; the core keeps it when the sender may see it. */
12
+ export type OsFeedbackTenant = {
13
+ id?: string | null;
14
+ slug?: string | null;
15
+ name?: string | null;
16
+ };
17
+ /** A picture ready to send: a data: URL of a PNG, JPEG or WebP. */
18
+ export type OsFeedbackPicture = {
19
+ name: string;
20
+ type: string;
21
+ size: number;
22
+ data: string;
23
+ };
24
+ export type OsFeedbackProps = {
25
+ /** This app's catalogue key ("hub" for the Hub). */
26
+ appKey: string;
27
+ /**
28
+ * The signed-in person's access token. In an app on the core, the core's;
29
+ * in Ops Hub, Key Accounts and Asset Portal, their own project's (the core
30
+ * asks that project who it is).
31
+ */
32
+ token: () => Promise<string | null | undefined>;
33
+ tenant?: OsFeedbackTenant | null;
34
+ /** Where the form sends. Default: the core's feedback-submit. */
35
+ endpoint?: string;
36
+ };
37
+ export type OsFeedbackResult = {
38
+ ok: true;
39
+ id: string;
40
+ warnings: string[];
41
+ } | {
42
+ ok: false;
43
+ error: string;
44
+ };
45
+ /** Where the form sends by default. */
46
+ export declare function feedbackEndpoint(): string;
47
+ /** What the form sends besides what the person types, read when they press Send. */
48
+ export declare function feedbackContext(): {
49
+ page: {
50
+ path?: string;
51
+ title?: string | null;
52
+ url?: string;
53
+ };
54
+ client: Record<string, string | null>;
55
+ };
56
+ /** Sends one message. Never throws: a failure comes back as a sentence to show. */
57
+ export declare function sendFeedback(input: {
58
+ appKey: string;
59
+ type: OsFeedbackType;
60
+ message: string;
61
+ pictures: OsFeedbackPicture[];
62
+ tenant?: OsFeedbackTenant | null;
63
+ token: () => Promise<string | null | undefined>;
64
+ endpoint?: string;
65
+ fetch?: typeof fetch;
66
+ }): Promise<OsFeedbackResult>;
67
+ /** One picture the person added, made ready to send, or a sentence saying why it cannot be. */
68
+ export declare function readPicture(file: File): Promise<OsFeedbackPicture | string>;
@@ -0,0 +1,139 @@
1
+ /**
2
+ * The feedback form's logic, without React (0.4.0): what it sends, to where,
3
+ * and the pictures it can take. The ? and the form are feedback.tsx.
4
+ */
5
+ import { corePublishableKey, coreUrl } from "./config.js";
6
+ import { OS_VERSION } from "./version.js";
7
+ export const OS_FEEDBACK_TYPES = [
8
+ { value: "bug", label: "Bug" },
9
+ { value: "idea", label: "Idea" },
10
+ { value: "question", label: "Question" },
11
+ { value: "other", label: "Other" },
12
+ ];
13
+ export const OS_FEEDBACK_LIMITS = { message: 8000, pictures: 3, pictureBytes: 3 * 1024 * 1024 };
14
+ const PICTURE_TYPES = ["image/png", "image/jpeg", "image/webp"];
15
+ /** Where the form sends by default. */
16
+ export function feedbackEndpoint() {
17
+ return `${coreUrl().replace(/\/+$/, "")}/functions/v1/feedback-submit`;
18
+ }
19
+ /** What the form sends besides what the person types, read when they press Send. */
20
+ export function feedbackContext() {
21
+ if (typeof window === "undefined" || typeof document === "undefined") {
22
+ return { page: {}, client: { os_version: OS_VERSION } };
23
+ }
24
+ const where = window.location;
25
+ /* A hash router's place is in the hash ("#/assets"); keep it in the path. */
26
+ const route = where.hash.startsWith("#/") ? where.hash.split("?")[0] : "";
27
+ const ratio = window.devicePixelRatio || 1;
28
+ const commit = document.querySelector("script[data-commit-sha]")?.getAttribute("data-commit-sha")
29
+ ?? document.documentElement.getAttribute("data-commit-sha")
30
+ ?? document.querySelector('meta[name="commit"]')?.getAttribute("content")
31
+ ?? null;
32
+ let zone = null;
33
+ try {
34
+ zone = Intl.DateTimeFormat().resolvedOptions().timeZone || null;
35
+ }
36
+ catch {
37
+ zone = null;
38
+ }
39
+ const screen = typeof window.screen === "object" && window.screen
40
+ ? `${Math.round(window.screen.width * ratio)}x${Math.round(window.screen.height * ratio)}`
41
+ : null;
42
+ return {
43
+ page: { path: where.pathname + route, title: document.title || null, url: where.href },
44
+ client: {
45
+ user_agent: typeof navigator === "object" ? navigator.userAgent : null,
46
+ viewport: `${window.innerWidth}x${window.innerHeight}`,
47
+ screen,
48
+ locale: typeof navigator === "object" ? navigator.language || null : null,
49
+ time_zone: zone,
50
+ commit,
51
+ os_version: OS_VERSION,
52
+ },
53
+ };
54
+ }
55
+ /** Sends one message. Never throws: a failure comes back as a sentence to show. */
56
+ export async function sendFeedback(input) {
57
+ const token = await input.token().catch(() => null);
58
+ if (!token)
59
+ return { ok: false, error: "Sign in to send feedback." };
60
+ const context = feedbackContext();
61
+ const body = {
62
+ app_key: input.appKey,
63
+ type: input.type,
64
+ message: input.message.trim(),
65
+ page: context.page,
66
+ tenant: {
67
+ id: input.tenant?.id ?? null,
68
+ slug: input.tenant?.slug ?? null,
69
+ name: input.tenant?.name ?? null,
70
+ },
71
+ client: context.client,
72
+ pictures: input.pictures.map((picture) => ({ type: picture.type, data: picture.data })),
73
+ };
74
+ let res;
75
+ try {
76
+ res = await (input.fetch ?? fetch)(input.endpoint ?? feedbackEndpoint(), {
77
+ method: "POST",
78
+ headers: { Authorization: `Bearer ${token}`, apikey: corePublishableKey(), "Content-Type": "application/json" },
79
+ body: JSON.stringify(body),
80
+ });
81
+ }
82
+ catch {
83
+ return { ok: false, error: "No connection. Check your internet, then send again." };
84
+ }
85
+ const out = await res.json().catch(() => null);
86
+ if (res.ok && out?.ok && typeof out.id === "string") {
87
+ const warnings = Array.isArray(out.warnings) ? out.warnings.filter((w) => typeof w === "string") : [];
88
+ return { ok: true, id: out.id, warnings };
89
+ }
90
+ const error = typeof out?.error === "string" && out.error ? out.error : `The feedback was not sent (error ${res.status}). Try again.`;
91
+ return { ok: false, error };
92
+ }
93
+ function dataUrl(blob) {
94
+ return new Promise((resolve, reject) => {
95
+ const reader = new FileReader();
96
+ reader.onload = () => resolve(String(reader.result));
97
+ reader.onerror = () => reject(reader.error ?? new Error("read failed"));
98
+ reader.readAsDataURL(blob);
99
+ });
100
+ }
101
+ /* A large or unusual picture, redrawn as a JPEG of at most 2,000 pixels a side. */
102
+ async function shrink(file) {
103
+ if (typeof createImageBitmap !== "function" || typeof document === "undefined")
104
+ return null;
105
+ const bitmap = await createImageBitmap(file);
106
+ const scale = Math.min(1, 2000 / Math.max(bitmap.width, bitmap.height));
107
+ const canvas = document.createElement("canvas");
108
+ canvas.width = Math.max(1, Math.round(bitmap.width * scale));
109
+ canvas.height = Math.max(1, Math.round(bitmap.height * scale));
110
+ const paint = canvas.getContext("2d");
111
+ if (!paint)
112
+ return null;
113
+ paint.fillStyle = "#FFFFFF";
114
+ paint.fillRect(0, 0, canvas.width, canvas.height);
115
+ paint.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
116
+ bitmap.close?.();
117
+ return await new Promise((resolve) => canvas.toBlob((blob) => resolve(blob), "image/jpeg", 0.85));
118
+ }
119
+ /** One picture the person added, made ready to send, or a sentence saying why it cannot be. */
120
+ export async function readPicture(file) {
121
+ if (!file.type.startsWith("image/"))
122
+ return "Only pictures can be added.";
123
+ let blob = file;
124
+ if (file.size > 1.5 * 1024 * 1024 || !PICTURE_TYPES.includes(file.type)) {
125
+ const smaller = await shrink(file).catch(() => null);
126
+ if (smaller)
127
+ blob = smaller;
128
+ }
129
+ if (!PICTURE_TYPES.includes(blob.type))
130
+ return "Use a PNG, JPEG or WebP picture.";
131
+ if (blob.size > OS_FEEDBACK_LIMITS.pictureBytes)
132
+ return "That picture is too big. Use one under 3 MB.";
133
+ try {
134
+ return { name: file.name || "picture", type: blob.type, size: blob.size, data: await dataUrl(blob) };
135
+ }
136
+ catch {
137
+ return "That picture could not be read.";
138
+ }
139
+ }
package/dist/frame.d.ts CHANGED
@@ -42,6 +42,14 @@ export type OsWorkspaceFrameProps = {
42
42
  auth?: {
43
43
  signOut: () => Promise<unknown>;
44
44
  onAuthStateChange?: (...args: never[]) => unknown;
45
+ /** The session, for the feedback form's token (0.4.0). */
46
+ getSession?: () => Promise<{
47
+ data: {
48
+ session: {
49
+ access_token?: string;
50
+ } | null;
51
+ };
52
+ }>;
45
53
  };
46
54
  /** This app's catalogue key; "hub" for the Hub. */
47
55
  appKey: string;
@@ -88,8 +96,15 @@ export type OsWorkspaceFrameProps = {
88
96
  value?: string;
89
97
  onChange?: (value: string) => void;
90
98
  };
91
- /** Extra controls in the top bar, before the company plate (What's new, a notification bell). */
99
+ /** Extra controls in the top bar, before the ? and the company plate (What's new, a notification bell). */
92
100
  actions?: ReactNode;
101
+ /**
102
+ * The ? in the top bar, directly left of the company plate (0.4.0): it
103
+ * opens the one feedback form every app shares (`autosolutions-os/feedback`),
104
+ * which sends with the signed-in person's core token. Default true. `false`
105
+ * leaves it out.
106
+ */
107
+ feedback?: boolean;
93
108
  /** How the plate switches company. Default "os". */
94
109
  companySwitch?: OsCompanySwitch;
95
110
  /** Rendered in the tool's panel under its tabs, in the panel's padding (a session list, say). */
@@ -126,4 +141,4 @@ export type OsWorkspaceFrameProps = {
126
141
  } & {
127
142
  [key: `aria-${string}`]: string | number | boolean | undefined;
128
143
  };
129
- export declare function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location, onNavigate, hrefFor, search, actions, companySwitch, panelFooter, onSignOut, homePath, admin, favicon, initialOpen, className, children, ...rest }: OsWorkspaceFrameProps): import("react").JSX.Element;
144
+ export declare function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location, onNavigate, hrefFor, search, actions, feedback, companySwitch, panelFooter, onSignOut, homePath, admin, favicon, initialOpen, className, children, ...rest }: OsWorkspaceFrameProps): import("react").JSX.Element;
package/dist/frame.js CHANGED
@@ -28,7 +28,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
28
28
  */
29
29
  import { useCallback, useEffect, useId, useMemo, useState } from "react";
30
30
  import { TopBar, WorkspaceFrame } from "autosolutions-design-system";
31
+ import { osAccessToken } from "./client.js";
31
32
  import { retryOsContext, watchOsAuth } from "./context.js";
33
+ import { OsFeedbackButton } from "./feedback.js";
32
34
  import { myAdminScope } from "./identity.js";
33
35
  import { catalogueLinks, hubPanelLocks, osFrame, withItemLocks } from "./nav.js";
34
36
  import { useOsPlate } from "./plate.js";
@@ -57,7 +59,7 @@ function linked(sections, hrefFor) {
57
59
  }
58
60
  /* Where the address bar is: a navigation the app does not make leaves it. */
59
61
  const here = () => (typeof window === "undefined" ? "" : window.location.pathname + window.location.search + window.location.hash);
60
- export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location, onNavigate, hrefFor, search, actions, companySwitch = "os", panelFooter, onSignOut, homePath, admin, favicon = true, initialOpen, className, children, ...rest }) {
62
+ export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location, onNavigate, hrefFor, search, actions, feedback = true, companySwitch = "os", panelFooter, onSignOut, homePath, admin, favicon = true, initialOpen, className, children, ...rest }) {
61
63
  /* Only data-* and aria-* reach the frame's root. */
62
64
  const attributes = Object.fromEntries(Object.entries(rest).filter(([key]) => /^(data|aria)-/.test(key)));
63
65
  /* The company plate and its menu (plate.tsx, shared with useCoreFrame). */
@@ -143,12 +145,26 @@ export function OsWorkspaceFrame({ os, auth, appKey, tools, hubItems, location,
143
145
  placeholder: search?.placeholder ?? "Search",
144
146
  field,
145
147
  }, !own);
148
+ /* The feedback form's token: the app's auth client when it handed one (or
149
+ an `os` that is a whole client), else this page's createOsClient. */
150
+ const feedbackToken = useCallback(async () => {
151
+ const own = auth?.getSession ? auth : os?.auth;
152
+ if (own && typeof own.getSession === "function") {
153
+ const { data } = await own.getSession();
154
+ return data.session?.access_token ?? null;
155
+ }
156
+ return osAccessToken();
157
+ }, [auth, os]);
158
+ const tenant = useMemo(() => (current ? { id: current.id, slug: current.slug, name: current.name } : null), [current]);
159
+ const barActions = feedback
160
+ ? _jsxs(_Fragment, { children: [actions, _jsx(OsFeedbackButton, { appKey: appKey, token: feedbackToken, tenant: tenant })] })
161
+ : actions;
146
162
  const signOut = onSignOut ?? (() => {
147
163
  void auth?.signOut().then(() => window.location.reload());
148
164
  });
149
165
  const topBar = (_jsx(TopBar, { variant: "workspace", "data-os-bar": barId, ...(own
150
166
  ? { searchPlaceholder: search?.placeholder ?? "Search", searchValue: search?.value, onSearchChange: search?.onChange }
151
- : menuSearch.topBar), actions: actions, ...plate }));
167
+ : menuSearch.topBar), actions: barActions, ...plate }));
152
168
  /* The menu search's matches hang under the bar's field, drawn after the
153
169
  frame; nothing while they are closed. */
154
170
  return (_jsxs(_Fragment, { children: [_jsx(WorkspaceFrame, { className: className, topBar: topBar, functions: frame.functions, sections: sections, footerItems: frame.footerItems, homeFunction: frame.homeFunction, location: { ...frame.locate(location), href: location }, onNavigate: navigate, onSignOut: signOut, favicon: favicon, panelFooter: panelFooter, ...(initialOpen === undefined ? {} : { initialOpen }), ...attributes, children: children }), menuSearch.results] }));
package/dist/index.d.ts CHANGED
@@ -5,3 +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";
9
+ export { osAccessToken } from "./client.js";
10
+ export { OS_VERSION } from "./version.js";
package/dist/index.js CHANGED
@@ -5,3 +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";
9
+ export { osAccessToken } from "./client.js";
10
+ export { OS_VERSION } from "./version.js";
@@ -0,0 +1,2 @@
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.0";
@@ -0,0 +1,2 @@
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.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosolutions-os",
3
- "version": "0.3.14",
3
+ "version": "0.4.0",
4
4
  "description": "One sign-in, one company switcher, one app grid. What every AutoSolutions app imports instead of copying.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -14,6 +14,7 @@
14
14
  "./federation": { "types": "./dist/federation.d.ts", "import": "./dist/federation.js" },
15
15
  "./search": { "types": "./dist/search.d.ts", "import": "./dist/search.js" },
16
16
  "./core-view": { "types": "./dist/coreView.d.ts", "import": "./dist/coreView.js" },
17
+ "./feedback": { "types": "./dist/feedback.d.ts", "import": "./dist/feedback.js" },
17
18
  "./chrome.css": "./dist/chrome.css"
18
19
  },
19
20
  "files": ["dist", "CHANGELOG.md"],