@launchsecure/launch-beacon 0.0.1

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.
@@ -0,0 +1,3 @@
1
+ import type { FeedbackPayload, SubmitResponse } from '../types';
2
+ export declare function submitFeedback(endpoint: string, payload: FeedbackPayload, headers?: Record<string, string>): Promise<SubmitResponse>;
3
+ //# sourceMappingURL=submit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../src/transport/submit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhE,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,eAAe,EACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,cAAc,CAAC,CAgCzB"}
@@ -0,0 +1,88 @@
1
+ export type Severity = 'bug' | 'idea' | 'ux' | 'a11y';
2
+ export interface Pin {
3
+ number: number;
4
+ note?: string;
5
+ selector: string;
6
+ tagName: string;
7
+ id: string | null;
8
+ classList: string[];
9
+ outerHTML: string;
10
+ parentOuterHTML?: string;
11
+ computedStyles: Record<string, string>;
12
+ boundingRect: {
13
+ x: number;
14
+ y: number;
15
+ w: number;
16
+ h: number;
17
+ };
18
+ framework?: {
19
+ lib: 'react' | 'vue' | 'angular' | 'svelte' | null;
20
+ name?: string;
21
+ };
22
+ }
23
+ export interface Metadata {
24
+ url: string;
25
+ referrer?: string;
26
+ userAgent: string;
27
+ uaData?: {
28
+ brand: string;
29
+ mobile: boolean;
30
+ platform: string;
31
+ };
32
+ viewport: {
33
+ w: number;
34
+ h: number;
35
+ dpr: number;
36
+ };
37
+ screen: {
38
+ w: number;
39
+ h: number;
40
+ };
41
+ timezone: string;
42
+ locale: string;
43
+ theme?: 'light' | 'dark';
44
+ capturedAt: string;
45
+ }
46
+ export interface FeedbackPayload {
47
+ description: string;
48
+ severity: Severity;
49
+ screenshot?: {
50
+ dataUrl: string;
51
+ mime: 'image/jpeg';
52
+ };
53
+ metadata: Metadata;
54
+ pins: Pin[];
55
+ context?: Record<string, unknown>;
56
+ }
57
+ export type HeaderProvider = Record<string, string> | (() => Record<string, string>);
58
+ export type ContextProvider = Record<string, unknown> | (() => Record<string, unknown>);
59
+ export interface BeaconConfig {
60
+ endpoint: string;
61
+ headers?: HeaderProvider;
62
+ context?: ContextProvider;
63
+ }
64
+ export interface SubmitResponse {
65
+ ok: boolean;
66
+ status: number;
67
+ body: unknown;
68
+ }
69
+ export interface RawPinCapture {
70
+ selector: string;
71
+ tagName: string;
72
+ id: string | null;
73
+ classList: string[];
74
+ outerHTML: string;
75
+ parentOuterHTML?: string;
76
+ computedStyles: Record<string, string>;
77
+ boundingRect: {
78
+ x: number;
79
+ y: number;
80
+ w: number;
81
+ h: number;
82
+ };
83
+ framework?: {
84
+ lib: 'react' | 'vue' | 'angular' | 'svelte' | null;
85
+ name?: string;
86
+ };
87
+ }
88
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;AAEtD,MAAM,WAAW,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,YAAY,EAAE;QAAE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","sourceRoot":"","sources":["../../src/ui/button.ts"],"names":[],"mappings":"AAKA,wBAAgB,mBAAmB,CAAC,KAAK,SAAa,GAAG,iBAAiB,CAOzE"}
@@ -0,0 +1,29 @@
1
+ import type { Pin, Severity } from '../types';
2
+ export interface DrawerCallbacks {
3
+ onClose: () => void;
4
+ onAnnotate: () => void;
5
+ onSubmit: () => void;
6
+ onPinNoteChange: (pinNumber: number, note: string) => void;
7
+ onPinDelete: (pinNumber: number) => void;
8
+ onDescriptionChange: (value: string) => void;
9
+ onSeverityChange: (sev: Severity) => void;
10
+ }
11
+ export declare class DrawerView {
12
+ readonly root: HTMLDivElement;
13
+ readonly bodyEl: HTMLDivElement;
14
+ private severities;
15
+ private callbacks;
16
+ private state;
17
+ constructor(severities: Severity[], callbacks: DrawerCallbacks);
18
+ open(): void;
19
+ close(): void;
20
+ minimize(): void;
21
+ setPins(pins: Pin[], annotatedScreenshot?: string): void;
22
+ setSubmitting(submitting: boolean): void;
23
+ setStatus(status: string, kind?: '' | 'error' | 'success'): void;
24
+ reset(): void;
25
+ getDescription(): string;
26
+ getSeverity(): Severity;
27
+ private render;
28
+ }
29
+ //# sourceMappingURL=drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/ui/drawer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAI9C,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,gBAAgB,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC3C;AAED,qBAAa,UAAU;IACrB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,KAAK,CAQX;gBAEU,UAAU,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,eAAe;IAiB9D,IAAI;IAKJ,KAAK;IAIL,QAAQ;IAKR,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,mBAAmB,CAAC,EAAE,MAAM;IAMjD,aAAa,CAAC,UAAU,EAAE,OAAO;IAKjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,EAAE,GAAG,OAAO,GAAG,SAAc;IAM7D,KAAK;IAaL,cAAc;IACd,WAAW;IAEX,OAAO,CAAC,MAAM;CAiGf"}
@@ -0,0 +1,9 @@
1
+ export declare const ICONS: {
2
+ readonly feedback: "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"/></svg>";
3
+ readonly pin: "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M12 17v5\"/><path d=\"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z\"/></svg>";
4
+ readonly close: "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>";
5
+ readonly trash: "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M3 6h18\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\"/><path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/></svg>";
6
+ readonly send: "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"m22 2-7 20-4-9-9-4Z\"/><path d=\"M22 2 11 13\"/></svg>";
7
+ readonly check: "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"20 6 9 17 4 12\"/></svg>";
8
+ };
9
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/ui/icons.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK;;;;;;;CAOR,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface PinPopoverResult {
2
+ note?: string;
3
+ cancelled: boolean;
4
+ }
5
+ export declare function showPinPopover(opts: {
6
+ shadowRoot: ShadowRoot;
7
+ anchor: {
8
+ x: number;
9
+ y: number;
10
+ };
11
+ pinNumber: number;
12
+ }): Promise<PinPopoverResult>;
13
+ //# sourceMappingURL=pin-popover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pin-popover.d.ts","sourceRoot":"","sources":["../../src/ui/pin-popover.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAsD5B"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@launchsecure/launch-beacon",
3
+ "version": "0.0.1",
4
+ "description": "Generic vanilla Web Component for in-app user feedback (screenshot + element pins + browser metadata).",
5
+ "license": "MIT",
6
+ "author": "LaunchSecure - AutomateWithUs",
7
+ "homepage": "https://automatewith.us",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/launchsecure/launchsecure-v2",
11
+ "directory": "packages/beacon"
12
+ },
13
+ "keywords": [
14
+ "feedback",
15
+ "bug-report",
16
+ "screenshot",
17
+ "annotation",
18
+ "web-component",
19
+ "vanilla",
20
+ "shadow-dom",
21
+ "launchsecure",
22
+ "launch-kit"
23
+ ],
24
+ "type": "module",
25
+ "main": "./dist/beacon.umd.js",
26
+ "module": "./dist/beacon.es.js",
27
+ "types": "./dist/index.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/beacon.es.js",
32
+ "require": "./dist/beacon.umd.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "README.md"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "dependencies": {
43
+ "html-to-image": "^1.11.13"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^20.0.0",
47
+ "happy-dom": "^20.8.8",
48
+ "typescript": "^5.5.0",
49
+ "vite": "^5.4.11",
50
+ "vitest": "^1.6.0"
51
+ },
52
+ "engines": {
53
+ "node": ">=18.0.0"
54
+ },
55
+ "scripts": {
56
+ "build": "vite build && tsc --emitDeclarationOnly --outDir dist",
57
+ "dev": "vite build --watch",
58
+ "test": "vitest run",
59
+ "test:watch": "vitest"
60
+ }
61
+ }