@mhosaic/feedback 0.33.0 → 0.34.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/dist/{chunk-RR6UB75B.mjs → chunk-J45ACCSP.mjs} +85 -4
- package/dist/chunk-J45ACCSP.mjs.map +1 -0
- package/dist/embed.min.js +21 -5
- package/dist/embed.min.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react.mjs +1 -1
- package/dist/vue.d.ts +29 -0
- package/dist/vue.mjs +44 -0
- package/dist/vue.mjs.map +1 -0
- package/dist/widget.min.js +22 -6
- package/dist/widget.min.js.map +1 -1
- package/package.json +16 -7
- package/dist/chunk-RR6UB75B.mjs.map +0 -1
package/dist/index.mjs
CHANGED
package/dist/react.mjs
CHANGED
package/dist/vue.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { InjectionKey, App } from 'vue';
|
|
2
|
+
import { I as InternalConfig } from './index-Dp0nfVYj.js';
|
|
3
|
+
import { ErrorTrackingOptions } from './error-tracking.js';
|
|
4
|
+
import { F as FeedbackApi } from './types-Cg1v8AbB.js';
|
|
5
|
+
import './types-CRbb2Pp0.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Vue 3 adapter (roadmap #11) — the second framework wrapper, mirroring
|
|
9
|
+
* `@mhosaic/feedback/react`. Vigilance's Cortex (Vue) hand-wires
|
|
10
|
+
* `createFeedback` in `main.ts` today; this gives Vue hosts the same
|
|
11
|
+
* batteries-included two-liner React hosts get:
|
|
12
|
+
*
|
|
13
|
+
* app.use(feedbackPlugin, { apiKey, endpoint })
|
|
14
|
+
* const fb = useFeedback() // in any setup()
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
interface FeedbackPluginOptions extends InternalConfig {
|
|
18
|
+
/** Auto-capture uncaught errors as synthetic reports — on by default,
|
|
19
|
+
* same contract as the React provider. `false` opts out; an options
|
|
20
|
+
* object tunes cooldown / sampling / caps. */
|
|
21
|
+
errorTracking?: boolean | ErrorTrackingOptions;
|
|
22
|
+
}
|
|
23
|
+
declare const FEEDBACK_KEY: InjectionKey<FeedbackApi>;
|
|
24
|
+
declare const feedbackPlugin: {
|
|
25
|
+
install(app: App, options: FeedbackPluginOptions): void;
|
|
26
|
+
};
|
|
27
|
+
declare function useFeedback(): FeedbackApi;
|
|
28
|
+
|
|
29
|
+
export { FEEDBACK_KEY, type FeedbackPluginOptions, feedbackPlugin, useFeedback };
|
package/dist/vue.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createFeedback
|
|
3
|
+
} from "./chunk-J45ACCSP.mjs";
|
|
4
|
+
import {
|
|
5
|
+
withErrorTracking
|
|
6
|
+
} from "./chunk-QJ562NTG.mjs";
|
|
7
|
+
import "./chunk-4QOIFIT5.mjs";
|
|
8
|
+
import "./chunk-FGA63IEZ.mjs";
|
|
9
|
+
|
|
10
|
+
// src/vue/index.ts
|
|
11
|
+
import { inject } from "vue";
|
|
12
|
+
var FEEDBACK_KEY = /* @__PURE__ */ Symbol("mhosaic-feedback");
|
|
13
|
+
var feedbackPlugin = {
|
|
14
|
+
install(app, options) {
|
|
15
|
+
const { errorTracking = true, ...config } = options;
|
|
16
|
+
const instance = createFeedback(config);
|
|
17
|
+
if (errorTracking !== false) {
|
|
18
|
+
withErrorTracking(
|
|
19
|
+
instance,
|
|
20
|
+
errorTracking === true ? void 0 : errorTracking
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
app.provide(FEEDBACK_KEY, instance);
|
|
24
|
+
const onUnmount = app.onUnmount;
|
|
25
|
+
if (typeof onUnmount === "function") {
|
|
26
|
+
onUnmount.call(app, () => instance.shutdown());
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
function useFeedback() {
|
|
31
|
+
const api = inject(FEEDBACK_KEY, null);
|
|
32
|
+
if (!api) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
"useFeedback() requires app.use(feedbackPlugin, { apiKey, endpoint }) first"
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return api;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
FEEDBACK_KEY,
|
|
41
|
+
feedbackPlugin,
|
|
42
|
+
useFeedback
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=vue.mjs.map
|
package/dist/vue.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vue/index.ts"],"sourcesContent":["/**\n * Vue 3 adapter (roadmap #11) — the second framework wrapper, mirroring\n * `@mhosaic/feedback/react`. Vigilance's Cortex (Vue) hand-wires\n * `createFeedback` in `main.ts` today; this gives Vue hosts the same\n * batteries-included two-liner React hosts get:\n *\n * app.use(feedbackPlugin, { apiKey, endpoint })\n * const fb = useFeedback() // in any setup()\n */\nimport { inject, type App, type InjectionKey } from 'vue'\n\nimport { createFeedback, type InternalConfig } from '../core'\nimport {\n withErrorTracking,\n type ErrorTrackingOptions,\n} from '../modules/error-tracking'\nimport type { FeedbackApi } from '../types'\n\nexport interface FeedbackPluginOptions extends InternalConfig {\n /** Auto-capture uncaught errors as synthetic reports — on by default,\n * same contract as the React provider. `false` opts out; an options\n * object tunes cooldown / sampling / caps. */\n errorTracking?: boolean | ErrorTrackingOptions\n}\n\nexport const FEEDBACK_KEY: InjectionKey<FeedbackApi> = Symbol('mhosaic-feedback')\n\nexport const feedbackPlugin = {\n install(app: App, options: FeedbackPluginOptions) {\n const { errorTracking = true, ...config } = options\n const instance = createFeedback(config)\n if (errorTracking !== false) {\n withErrorTracking(\n instance,\n errorTracking === true ? undefined : errorTracking,\n )\n }\n app.provide(FEEDBACK_KEY, instance)\n // Vue ≥ 3.5 exposes onUnmount on the app; tear the widget down with\n // the app when available (older Vues leak-free too — shutdown() is\n // idempotent and the FAB dies with the document).\n const onUnmount = (app as { onUnmount?: (fn: () => void) => void }).onUnmount\n if (typeof onUnmount === 'function') {\n onUnmount.call(app, () => instance.shutdown())\n }\n },\n}\n\nexport function useFeedback(): FeedbackApi {\n const api = inject(FEEDBACK_KEY, null)\n if (!api) {\n throw new Error(\n 'useFeedback() requires app.use(feedbackPlugin, { apiKey, endpoint }) first',\n )\n }\n return api\n}\n"],"mappings":";;;;;;;;;;AASA,SAAS,cAA2C;AAgB7C,IAAM,eAA0C,uBAAO,kBAAkB;AAEzE,IAAM,iBAAiB;AAAA,EAC5B,QAAQ,KAAU,SAAgC;AAChD,UAAM,EAAE,gBAAgB,MAAM,GAAG,OAAO,IAAI;AAC5C,UAAM,WAAW,eAAe,MAAM;AACtC,QAAI,kBAAkB,OAAO;AAC3B;AAAA,QACE;AAAA,QACA,kBAAkB,OAAO,SAAY;AAAA,MACvC;AAAA,IACF;AACA,QAAI,QAAQ,cAAc,QAAQ;AAIlC,UAAM,YAAa,IAAiD;AACpE,QAAI,OAAO,cAAc,YAAY;AACnC,gBAAU,KAAK,KAAK,MAAM,SAAS,SAAS,CAAC;AAAA,IAC/C;AAAA,EACF;AACF;AAEO,SAAS,cAA2B;AACzC,QAAM,MAAM,OAAO,cAAc,IAAI;AACrC,MAAI,CAAC,KAAK;AACR,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|