@duvandroid/react-blind-agents 0.1.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/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # react-blind-agents
2
+
3
+ React component for the [Blind Agents](https://blindagents.com) pixel widget — AI bug reporter, webchat, and product guides.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install react-blind-agents
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Plain React (Vite, CRA)
14
+
15
+ ```tsx
16
+ import { BlindAgentsWidget } from 'react-blind-agents';
17
+
18
+ export default function App() {
19
+ return (
20
+ <>
21
+ <MyRoutes />
22
+ <BlindAgentsWidget
23
+ apiKey="ba_YOUR_API_KEY"
24
+ primaryColor="#e11d48"
25
+ title="Help Center"
26
+ reportBtnText="Report an issue"
27
+ btnEmoji="🔴"
28
+ btnTooltip="Report an issue"
29
+ emptyText="No issues reported yet."
30
+ />
31
+ </>
32
+ );
33
+ }
34
+ ```
35
+
36
+ ### Next.js App Router
37
+
38
+ ```tsx
39
+ // app/layout.tsx
40
+ import { BlindAgentsWidget } from 'react-blind-agents/next';
41
+
42
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
43
+ return (
44
+ <html lang="en">
45
+ <body>
46
+ {children}
47
+ <BlindAgentsWidget
48
+ apiKey="ba_YOUR_API_KEY"
49
+ primaryColor="#e11d48"
50
+ title="Help Center"
51
+ reportBtnText="Report an issue"
52
+ btnEmoji="🔴"
53
+ strategy="afterInteractive"
54
+ />
55
+ </body>
56
+ </html>
57
+ );
58
+ }
59
+ ```
60
+
61
+ ### Next.js with authenticated user (skip identity verification)
62
+
63
+ ```tsx
64
+ // components/ReportWidget.tsx
65
+ 'use client';
66
+ import { BlindAgentsWidget } from 'react-blind-agents/next';
67
+ import { useAuth } from './AuthProvider';
68
+
69
+ export function ReportWidget() {
70
+ const { user } = useAuth();
71
+ return (
72
+ <BlindAgentsWidget
73
+ apiKey="ba_YOUR_API_KEY"
74
+ primaryColor="#e11d48"
75
+ userWhatsapp={user?.whatsapp_number ?? user?.email ?? ''}
76
+ />
77
+ );
78
+ }
79
+ ```
80
+
81
+ ### Next.js Pages Router
82
+
83
+ ```tsx
84
+ // pages/_app.tsx
85
+ import type { AppProps } from 'next/app';
86
+ import { BlindAgentsWidget } from 'react-blind-agents/next';
87
+
88
+ export default function App({ Component, pageProps }: AppProps) {
89
+ return (
90
+ <>
91
+ <Component {...pageProps} />
92
+ <BlindAgentsWidget apiKey="ba_YOUR_API_KEY" primaryColor="#e11d48" />
93
+ </>
94
+ );
95
+ }
96
+ ```
97
+
98
+ ## Props
99
+
100
+ | Prop | Type | Default | Description |
101
+ |-----------------|---------------------------------------------------|--------------------------------------------|-----------------------------------------------------|
102
+ | `apiKey` | `string` | **required** | Your Blind Agents public API key (`ba_...`) |
103
+ | `primaryColor` | `string` | — | Accent color (any valid CSS color) |
104
+ | `title` | `string` | `"Help Center"` | Widget panel header title |
105
+ | `reportBtnText` | `string` | `"Report an issue"` | Report button label |
106
+ | `btnEmoji` | `string` | — | Emoji on the floating launcher button |
107
+ | `btnTooltip` | `string` | — | Tooltip on the launcher button |
108
+ | `emptyText` | `string` | `"No issues reported yet."` | Text shown when there are no reports |
109
+ | `userWhatsapp` | `string` | — | Pre-fill user identity (WhatsApp number or email) |
110
+ | `strategy` | `"afterInteractive" \| "lazyOnload" \| "beforeInteractive"` | `"afterInteractive"` | Script loading strategy |
111
+ | `src` | `string` | `"https://cdn.blindagents.com/report.js"` | Override CDN URL (self-hosting) |
112
+ | `onLoad` | `() => void` | — | Called when the script loads successfully |
113
+ | `onError` | `(error: Error) => void` | — | Called if the script fails to load |
114
+
115
+ ## Why two import paths?
116
+
117
+ - `react-blind-agents` — plain React. Injects the script via `useEffect`. Works anywhere React runs.
118
+ - `react-blind-agents/next` — Next.js only. Uses `next/script` for correct hydration, strategy support, and deduplication across navigations.
119
+
120
+ Importing `react-blind-agents/next` in a non-Next.js app will throw because `next/script` won't be available.
121
+
122
+ ## License
123
+
124
+ MIT
@@ -0,0 +1,30 @@
1
+ interface BlindAgentsWidgetProps {
2
+ /** Your Blind Agents public API key (ba_...) */
3
+ apiKey: string;
4
+ /** Accent color for the widget UI — any valid CSS color */
5
+ primaryColor?: string;
6
+ /** Title displayed in the widget panel header @default "Help Center" */
7
+ title?: string;
8
+ /** Label for the report button @default "Report an issue" */
9
+ reportBtnText?: string;
10
+ /** Emoji on the launcher floating button */
11
+ btnEmoji?: string;
12
+ /** Tooltip on the launcher button */
13
+ btnTooltip?: string;
14
+ /** Text shown when there are no reports @default "No issues reported yet." */
15
+ emptyText?: string;
16
+ /** Pre-fill the user's WhatsApp number or email to skip identity verification */
17
+ userWhatsapp?: string;
18
+ /** Script loading strategy @default "afterInteractive" */
19
+ strategy?: 'afterInteractive' | 'lazyOnload' | 'beforeInteractive';
20
+ /** Override the CDN URL (useful for self-hosting) @default "https://cdn.blindagents.com/report.js" */
21
+ src?: string;
22
+ /** Called once the script finishes loading */
23
+ onLoad?: () => void;
24
+ /** Called if the script fails to load */
25
+ onError?: (error: Error) => void;
26
+ }
27
+
28
+ declare function BlindAgentsWidget({ apiKey, primaryColor, title, reportBtnText, btnEmoji, btnTooltip, emptyText, userWhatsapp, strategy, src, onLoad, onError, }: BlindAgentsWidgetProps): null;
29
+
30
+ export { BlindAgentsWidget, type BlindAgentsWidgetProps };
@@ -0,0 +1,30 @@
1
+ interface BlindAgentsWidgetProps {
2
+ /** Your Blind Agents public API key (ba_...) */
3
+ apiKey: string;
4
+ /** Accent color for the widget UI — any valid CSS color */
5
+ primaryColor?: string;
6
+ /** Title displayed in the widget panel header @default "Help Center" */
7
+ title?: string;
8
+ /** Label for the report button @default "Report an issue" */
9
+ reportBtnText?: string;
10
+ /** Emoji on the launcher floating button */
11
+ btnEmoji?: string;
12
+ /** Tooltip on the launcher button */
13
+ btnTooltip?: string;
14
+ /** Text shown when there are no reports @default "No issues reported yet." */
15
+ emptyText?: string;
16
+ /** Pre-fill the user's WhatsApp number or email to skip identity verification */
17
+ userWhatsapp?: string;
18
+ /** Script loading strategy @default "afterInteractive" */
19
+ strategy?: 'afterInteractive' | 'lazyOnload' | 'beforeInteractive';
20
+ /** Override the CDN URL (useful for self-hosting) @default "https://cdn.blindagents.com/report.js" */
21
+ src?: string;
22
+ /** Called once the script finishes loading */
23
+ onLoad?: () => void;
24
+ /** Called if the script fails to load */
25
+ onError?: (error: Error) => void;
26
+ }
27
+
28
+ declare function BlindAgentsWidget({ apiKey, primaryColor, title, reportBtnText, btnEmoji, btnTooltip, emptyText, userWhatsapp, strategy, src, onLoad, onError, }: BlindAgentsWidgetProps): null;
29
+
30
+ export { BlindAgentsWidget, type BlindAgentsWidgetProps };
package/dist/index.js ADDED
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ BlindAgentsWidget: () => BlindAgentsWidget
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+
27
+ // src/ReactBlindAgentsWidget.tsx
28
+ var import_react = require("react");
29
+ var CDN_DEFAULT = "https://cdn.blindagents.com/report.js";
30
+ function BlindAgentsWidget({
31
+ apiKey,
32
+ primaryColor,
33
+ title,
34
+ reportBtnText,
35
+ btnEmoji,
36
+ btnTooltip,
37
+ emptyText,
38
+ userWhatsapp,
39
+ strategy = "afterInteractive",
40
+ src = CDN_DEFAULT,
41
+ onLoad,
42
+ onError
43
+ }) {
44
+ const injected = (0, import_react.useRef)(false);
45
+ (0, import_react.useEffect)(() => {
46
+ if (injected.current) return;
47
+ injected.current = true;
48
+ const existing = document.querySelector(
49
+ `script[src="${src}"][data-ba-managed]`
50
+ );
51
+ if (existing) return;
52
+ const el = document.createElement("script");
53
+ el.src = src;
54
+ el.setAttribute("data-ba-managed", "true");
55
+ el.setAttribute("data-api-key", apiKey);
56
+ if (primaryColor) el.setAttribute("data-primary-color", primaryColor);
57
+ if (title) el.setAttribute("data-title", title);
58
+ if (reportBtnText) el.setAttribute("data-report-btn-text", reportBtnText);
59
+ if (btnEmoji) el.setAttribute("data-btn-emoji", btnEmoji);
60
+ if (btnTooltip) el.setAttribute("data-btn-tooltip", btnTooltip);
61
+ if (emptyText) el.setAttribute("data-empty-text", emptyText);
62
+ if (userWhatsapp) el.setAttribute("data-user-whatsapp", userWhatsapp);
63
+ if (onLoad) el.addEventListener("load", () => onLoad());
64
+ if (onError) el.addEventListener("error", () => onError(new Error(`Failed to load ${src}`)));
65
+ const inject = () => {
66
+ if (strategy === "afterInteractive") el.defer = true;
67
+ if (strategy === "lazyOnload") el.async = true;
68
+ document.head.appendChild(el);
69
+ };
70
+ if (strategy === "lazyOnload" && typeof window !== "undefined" && "requestIdleCallback" in window) {
71
+ window.requestIdleCallback(inject);
72
+ } else {
73
+ inject();
74
+ }
75
+ return () => {
76
+ el.parentNode?.removeChild(el);
77
+ injected.current = false;
78
+ };
79
+ }, [apiKey, src]);
80
+ return null;
81
+ }
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ BlindAgentsWidget
85
+ });
86
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/ReactBlindAgentsWidget.tsx"],"sourcesContent":["// Plain React entry — Vite, CRA, etc.\n// For Next.js use: import { BlindAgentsWidget } from 'react-blind-agents/next'\nexport { BlindAgentsWidget } from './ReactBlindAgentsWidget';\nexport type { BlindAgentsWidgetProps } from './types';\n","'use client';\n\nimport { useEffect, useRef } from 'react';\nimport type { BlindAgentsWidgetProps } from './types';\n\nconst CDN_DEFAULT = 'https://cdn.blindagents.com/report.js';\n\nexport function BlindAgentsWidget({\n apiKey,\n primaryColor,\n title,\n reportBtnText,\n btnEmoji,\n btnTooltip,\n emptyText,\n userWhatsapp,\n strategy = 'afterInteractive',\n src = CDN_DEFAULT,\n onLoad,\n onError,\n}: BlindAgentsWidgetProps) {\n const injected = useRef(false);\n\n useEffect(() => {\n if (injected.current) return;\n injected.current = true;\n\n // Deduplicate across multiple widget instances\n const existing = document.querySelector<HTMLScriptElement>(\n `script[src=\"${src}\"][data-ba-managed]`\n );\n if (existing) return;\n\n const el = document.createElement('script');\n el.src = src;\n el.setAttribute('data-ba-managed', 'true');\n el.setAttribute('data-api-key', apiKey);\n if (primaryColor) el.setAttribute('data-primary-color', primaryColor);\n if (title) el.setAttribute('data-title', title);\n if (reportBtnText) el.setAttribute('data-report-btn-text', reportBtnText);\n if (btnEmoji) el.setAttribute('data-btn-emoji', btnEmoji);\n if (btnTooltip) el.setAttribute('data-btn-tooltip', btnTooltip);\n if (emptyText) el.setAttribute('data-empty-text', emptyText);\n if (userWhatsapp) el.setAttribute('data-user-whatsapp', userWhatsapp);\n\n if (onLoad) el.addEventListener('load', () => onLoad());\n if (onError) el.addEventListener('error', () => onError(new Error(`Failed to load ${src}`)));\n\n const inject = () => {\n if (strategy === 'afterInteractive') el.defer = true;\n if (strategy === 'lazyOnload') el.async = true;\n document.head.appendChild(el);\n };\n\n if (strategy === 'lazyOnload' && typeof window !== 'undefined' && 'requestIdleCallback' in window) {\n (window as Window & { requestIdleCallback: (cb: () => void) => void }).requestIdleCallback(inject);\n } else {\n inject();\n }\n\n return () => {\n el.parentNode?.removeChild(el);\n injected.current = false;\n };\n }, [apiKey, src]); // eslint-disable-line react-hooks/exhaustive-deps\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAAkC;AAGlC,IAAM,cAAc;AAEb,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,MAAM;AAAA,EACN;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,eAAW,qBAAO,KAAK;AAE7B,8BAAU,MAAM;AACd,QAAI,SAAS,QAAS;AACtB,aAAS,UAAU;AAGnB,UAAM,WAAW,SAAS;AAAA,MACxB,eAAe,GAAG;AAAA,IACpB;AACA,QAAI,SAAU;AAEd,UAAM,KAAK,SAAS,cAAc,QAAQ;AAC1C,OAAG,MAAM;AACT,OAAG,aAAa,mBAAmB,MAAM;AACzC,OAAG,aAAa,gBAAgB,MAAM;AACtC,QAAI,aAAe,IAAG,aAAa,sBAAsB,YAAY;AACrE,QAAI,MAAe,IAAG,aAAa,cAAc,KAAK;AACtD,QAAI,cAAe,IAAG,aAAa,wBAAwB,aAAa;AACxE,QAAI,SAAe,IAAG,aAAa,kBAAkB,QAAQ;AAC7D,QAAI,WAAe,IAAG,aAAa,oBAAoB,UAAU;AACjE,QAAI,UAAe,IAAG,aAAa,mBAAmB,SAAS;AAC/D,QAAI,aAAe,IAAG,aAAa,sBAAsB,YAAY;AAErE,QAAI,OAAS,IAAG,iBAAiB,QAAQ,MAAM,OAAO,CAAC;AACvD,QAAI,QAAS,IAAG,iBAAiB,SAAS,MAAM,QAAQ,IAAI,MAAM,kBAAkB,GAAG,EAAE,CAAC,CAAC;AAE3F,UAAM,SAAS,MAAM;AACnB,UAAI,aAAa,mBAAoB,IAAG,QAAQ;AAChD,UAAI,aAAa,aAAoB,IAAG,QAAQ;AAChD,eAAS,KAAK,YAAY,EAAE;AAAA,IAC9B;AAEA,QAAI,aAAa,gBAAgB,OAAO,WAAW,eAAe,yBAAyB,QAAQ;AACjG,MAAC,OAAsE,oBAAoB,MAAM;AAAA,IACnG,OAAO;AACL,aAAO;AAAA,IACT;AAEA,WAAO,MAAM;AACX,SAAG,YAAY,YAAY,EAAE;AAC7B,eAAS,UAAU;AAAA,IACrB;AAAA,EACF,GAAG,CAAC,QAAQ,GAAG,CAAC;AAEhB,SAAO;AACT;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,59 @@
1
+ // src/ReactBlindAgentsWidget.tsx
2
+ import { useEffect, useRef } from "react";
3
+ var CDN_DEFAULT = "https://cdn.blindagents.com/report.js";
4
+ function BlindAgentsWidget({
5
+ apiKey,
6
+ primaryColor,
7
+ title,
8
+ reportBtnText,
9
+ btnEmoji,
10
+ btnTooltip,
11
+ emptyText,
12
+ userWhatsapp,
13
+ strategy = "afterInteractive",
14
+ src = CDN_DEFAULT,
15
+ onLoad,
16
+ onError
17
+ }) {
18
+ const injected = useRef(false);
19
+ useEffect(() => {
20
+ if (injected.current) return;
21
+ injected.current = true;
22
+ const existing = document.querySelector(
23
+ `script[src="${src}"][data-ba-managed]`
24
+ );
25
+ if (existing) return;
26
+ const el = document.createElement("script");
27
+ el.src = src;
28
+ el.setAttribute("data-ba-managed", "true");
29
+ el.setAttribute("data-api-key", apiKey);
30
+ if (primaryColor) el.setAttribute("data-primary-color", primaryColor);
31
+ if (title) el.setAttribute("data-title", title);
32
+ if (reportBtnText) el.setAttribute("data-report-btn-text", reportBtnText);
33
+ if (btnEmoji) el.setAttribute("data-btn-emoji", btnEmoji);
34
+ if (btnTooltip) el.setAttribute("data-btn-tooltip", btnTooltip);
35
+ if (emptyText) el.setAttribute("data-empty-text", emptyText);
36
+ if (userWhatsapp) el.setAttribute("data-user-whatsapp", userWhatsapp);
37
+ if (onLoad) el.addEventListener("load", () => onLoad());
38
+ if (onError) el.addEventListener("error", () => onError(new Error(`Failed to load ${src}`)));
39
+ const inject = () => {
40
+ if (strategy === "afterInteractive") el.defer = true;
41
+ if (strategy === "lazyOnload") el.async = true;
42
+ document.head.appendChild(el);
43
+ };
44
+ if (strategy === "lazyOnload" && typeof window !== "undefined" && "requestIdleCallback" in window) {
45
+ window.requestIdleCallback(inject);
46
+ } else {
47
+ inject();
48
+ }
49
+ return () => {
50
+ el.parentNode?.removeChild(el);
51
+ injected.current = false;
52
+ };
53
+ }, [apiKey, src]);
54
+ return null;
55
+ }
56
+ export {
57
+ BlindAgentsWidget
58
+ };
59
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ReactBlindAgentsWidget.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\nimport type { BlindAgentsWidgetProps } from './types';\n\nconst CDN_DEFAULT = 'https://cdn.blindagents.com/report.js';\n\nexport function BlindAgentsWidget({\n apiKey,\n primaryColor,\n title,\n reportBtnText,\n btnEmoji,\n btnTooltip,\n emptyText,\n userWhatsapp,\n strategy = 'afterInteractive',\n src = CDN_DEFAULT,\n onLoad,\n onError,\n}: BlindAgentsWidgetProps) {\n const injected = useRef(false);\n\n useEffect(() => {\n if (injected.current) return;\n injected.current = true;\n\n // Deduplicate across multiple widget instances\n const existing = document.querySelector<HTMLScriptElement>(\n `script[src=\"${src}\"][data-ba-managed]`\n );\n if (existing) return;\n\n const el = document.createElement('script');\n el.src = src;\n el.setAttribute('data-ba-managed', 'true');\n el.setAttribute('data-api-key', apiKey);\n if (primaryColor) el.setAttribute('data-primary-color', primaryColor);\n if (title) el.setAttribute('data-title', title);\n if (reportBtnText) el.setAttribute('data-report-btn-text', reportBtnText);\n if (btnEmoji) el.setAttribute('data-btn-emoji', btnEmoji);\n if (btnTooltip) el.setAttribute('data-btn-tooltip', btnTooltip);\n if (emptyText) el.setAttribute('data-empty-text', emptyText);\n if (userWhatsapp) el.setAttribute('data-user-whatsapp', userWhatsapp);\n\n if (onLoad) el.addEventListener('load', () => onLoad());\n if (onError) el.addEventListener('error', () => onError(new Error(`Failed to load ${src}`)));\n\n const inject = () => {\n if (strategy === 'afterInteractive') el.defer = true;\n if (strategy === 'lazyOnload') el.async = true;\n document.head.appendChild(el);\n };\n\n if (strategy === 'lazyOnload' && typeof window !== 'undefined' && 'requestIdleCallback' in window) {\n (window as Window & { requestIdleCallback: (cb: () => void) => void }).requestIdleCallback(inject);\n } else {\n inject();\n }\n\n return () => {\n el.parentNode?.removeChild(el);\n injected.current = false;\n };\n }, [apiKey, src]); // eslint-disable-line react-hooks/exhaustive-deps\n\n return null;\n}\n"],"mappings":";AAEA,SAAS,WAAW,cAAc;AAGlC,IAAM,cAAc;AAEb,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,MAAM;AAAA,EACN;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,WAAW,OAAO,KAAK;AAE7B,YAAU,MAAM;AACd,QAAI,SAAS,QAAS;AACtB,aAAS,UAAU;AAGnB,UAAM,WAAW,SAAS;AAAA,MACxB,eAAe,GAAG;AAAA,IACpB;AACA,QAAI,SAAU;AAEd,UAAM,KAAK,SAAS,cAAc,QAAQ;AAC1C,OAAG,MAAM;AACT,OAAG,aAAa,mBAAmB,MAAM;AACzC,OAAG,aAAa,gBAAgB,MAAM;AACtC,QAAI,aAAe,IAAG,aAAa,sBAAsB,YAAY;AACrE,QAAI,MAAe,IAAG,aAAa,cAAc,KAAK;AACtD,QAAI,cAAe,IAAG,aAAa,wBAAwB,aAAa;AACxE,QAAI,SAAe,IAAG,aAAa,kBAAkB,QAAQ;AAC7D,QAAI,WAAe,IAAG,aAAa,oBAAoB,UAAU;AACjE,QAAI,UAAe,IAAG,aAAa,mBAAmB,SAAS;AAC/D,QAAI,aAAe,IAAG,aAAa,sBAAsB,YAAY;AAErE,QAAI,OAAS,IAAG,iBAAiB,QAAQ,MAAM,OAAO,CAAC;AACvD,QAAI,QAAS,IAAG,iBAAiB,SAAS,MAAM,QAAQ,IAAI,MAAM,kBAAkB,GAAG,EAAE,CAAC,CAAC;AAE3F,UAAM,SAAS,MAAM;AACnB,UAAI,aAAa,mBAAoB,IAAG,QAAQ;AAChD,UAAI,aAAa,aAAoB,IAAG,QAAQ;AAChD,eAAS,KAAK,YAAY,EAAE;AAAA,IAC9B;AAEA,QAAI,aAAa,gBAAgB,OAAO,WAAW,eAAe,yBAAyB,QAAQ;AACjG,MAAC,OAAsE,oBAAoB,MAAM;AAAA,IACnG,OAAO;AACL,aAAO;AAAA,IACT;AAEA,WAAO,MAAM;AACX,SAAG,YAAY,YAAY,EAAE;AAC7B,eAAS,UAAU;AAAA,IACrB;AAAA,EACF,GAAG,CAAC,QAAQ,GAAG,CAAC;AAEhB,SAAO;AACT;","names":[]}
@@ -0,0 +1,32 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface BlindAgentsWidgetProps {
4
+ /** Your Blind Agents public API key (ba_...) */
5
+ apiKey: string;
6
+ /** Accent color for the widget UI — any valid CSS color */
7
+ primaryColor?: string;
8
+ /** Title displayed in the widget panel header @default "Help Center" */
9
+ title?: string;
10
+ /** Label for the report button @default "Report an issue" */
11
+ reportBtnText?: string;
12
+ /** Emoji on the launcher floating button */
13
+ btnEmoji?: string;
14
+ /** Tooltip on the launcher button */
15
+ btnTooltip?: string;
16
+ /** Text shown when there are no reports @default "No issues reported yet." */
17
+ emptyText?: string;
18
+ /** Pre-fill the user's WhatsApp number or email to skip identity verification */
19
+ userWhatsapp?: string;
20
+ /** Script loading strategy @default "afterInteractive" */
21
+ strategy?: 'afterInteractive' | 'lazyOnload' | 'beforeInteractive';
22
+ /** Override the CDN URL (useful for self-hosting) @default "https://cdn.blindagents.com/report.js" */
23
+ src?: string;
24
+ /** Called once the script finishes loading */
25
+ onLoad?: () => void;
26
+ /** Called if the script fails to load */
27
+ onError?: (error: Error) => void;
28
+ }
29
+
30
+ declare function BlindAgentsWidget({ apiKey, primaryColor, title, reportBtnText, btnEmoji, btnTooltip, emptyText, userWhatsapp, strategy, src, onLoad, onError, }: BlindAgentsWidgetProps): react_jsx_runtime.JSX.Element;
31
+
32
+ export { BlindAgentsWidget, type BlindAgentsWidgetProps };
package/dist/next.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface BlindAgentsWidgetProps {
4
+ /** Your Blind Agents public API key (ba_...) */
5
+ apiKey: string;
6
+ /** Accent color for the widget UI — any valid CSS color */
7
+ primaryColor?: string;
8
+ /** Title displayed in the widget panel header @default "Help Center" */
9
+ title?: string;
10
+ /** Label for the report button @default "Report an issue" */
11
+ reportBtnText?: string;
12
+ /** Emoji on the launcher floating button */
13
+ btnEmoji?: string;
14
+ /** Tooltip on the launcher button */
15
+ btnTooltip?: string;
16
+ /** Text shown when there are no reports @default "No issues reported yet." */
17
+ emptyText?: string;
18
+ /** Pre-fill the user's WhatsApp number or email to skip identity verification */
19
+ userWhatsapp?: string;
20
+ /** Script loading strategy @default "afterInteractive" */
21
+ strategy?: 'afterInteractive' | 'lazyOnload' | 'beforeInteractive';
22
+ /** Override the CDN URL (useful for self-hosting) @default "https://cdn.blindagents.com/report.js" */
23
+ src?: string;
24
+ /** Called once the script finishes loading */
25
+ onLoad?: () => void;
26
+ /** Called if the script fails to load */
27
+ onError?: (error: Error) => void;
28
+ }
29
+
30
+ declare function BlindAgentsWidget({ apiKey, primaryColor, title, reportBtnText, btnEmoji, btnTooltip, emptyText, userWhatsapp, strategy, src, onLoad, onError, }: BlindAgentsWidgetProps): react_jsx_runtime.JSX.Element;
31
+
32
+ export { BlindAgentsWidget, type BlindAgentsWidgetProps };
package/dist/next.js ADDED
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/next.ts
31
+ var next_exports = {};
32
+ __export(next_exports, {
33
+ BlindAgentsWidget: () => BlindAgentsWidget
34
+ });
35
+ module.exports = __toCommonJS(next_exports);
36
+
37
+ // src/NextBlindAgentsWidget.tsx
38
+ var import_script = __toESM(require("next/script"));
39
+ var import_jsx_runtime = require("react/jsx-runtime");
40
+ var CDN_DEFAULT = "https://cdn.blindagents.com/report.js";
41
+ function BlindAgentsWidget({
42
+ apiKey,
43
+ primaryColor,
44
+ title,
45
+ reportBtnText,
46
+ btnEmoji,
47
+ btnTooltip,
48
+ emptyText,
49
+ userWhatsapp,
50
+ strategy = "afterInteractive",
51
+ src = CDN_DEFAULT,
52
+ onLoad,
53
+ onError
54
+ }) {
55
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
+ import_script.default,
57
+ {
58
+ src,
59
+ strategy,
60
+ "data-api-key": apiKey,
61
+ "data-primary-color": primaryColor,
62
+ "data-title": title,
63
+ "data-report-btn-text": reportBtnText,
64
+ "data-btn-emoji": btnEmoji,
65
+ "data-btn-tooltip": btnTooltip,
66
+ "data-empty-text": emptyText,
67
+ "data-user-whatsapp": userWhatsapp ?? "",
68
+ onLoad,
69
+ onError: onError ? () => onError(new Error(`Failed to load ${src}`)) : void 0
70
+ }
71
+ );
72
+ }
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ BlindAgentsWidget
76
+ });
77
+ //# sourceMappingURL=next.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/next.ts","../src/NextBlindAgentsWidget.tsx"],"sourcesContent":["// Next.js entry (App Router + Pages Router)\n// Uses next/script for correct hydration and strategy support.\nexport { BlindAgentsWidget } from './NextBlindAgentsWidget';\nexport type { BlindAgentsWidgetProps } from './types';\n","'use client';\n\n// This file is only included in the `react-blind-agents/next` subpath entry.\n// It relies on `next/script` which is NOT available in plain React apps.\nimport Script from 'next/script';\nimport type { BlindAgentsWidgetProps } from './types';\n\nconst CDN_DEFAULT = 'https://cdn.blindagents.com/report.js';\n\nexport function BlindAgentsWidget({\n apiKey,\n primaryColor,\n title,\n reportBtnText,\n btnEmoji,\n btnTooltip,\n emptyText,\n userWhatsapp,\n strategy = 'afterInteractive',\n src = CDN_DEFAULT,\n onLoad,\n onError,\n}: BlindAgentsWidgetProps) {\n return (\n <Script\n src={src}\n strategy={strategy}\n data-api-key={apiKey}\n data-primary-color={primaryColor}\n data-title={title}\n data-report-btn-text={reportBtnText}\n data-btn-emoji={btnEmoji}\n data-btn-tooltip={btnTooltip}\n data-empty-text={emptyText}\n data-user-whatsapp={userWhatsapp ?? ''}\n onLoad={onLoad}\n onError={onError ? () => onError(new Error(`Failed to load ${src}`)) : undefined}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIA,oBAAmB;AAoBf;AAjBJ,IAAM,cAAc;AAEb,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,MAAM;AAAA,EACN;AAAA,EACA;AACF,GAA2B;AACzB,SACE;AAAA,IAAC,cAAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,gBAAc;AAAA,MACd,sBAAoB;AAAA,MACpB,cAAY;AAAA,MACZ,wBAAsB;AAAA,MACtB,kBAAgB;AAAA,MAChB,oBAAkB;AAAA,MAClB,mBAAiB;AAAA,MACjB,sBAAoB,gBAAgB;AAAA,MACpC;AAAA,MACA,SAAS,UAAU,MAAM,QAAQ,IAAI,MAAM,kBAAkB,GAAG,EAAE,CAAC,IAAI;AAAA;AAAA,EACzE;AAEJ;","names":["Script"]}
package/dist/next.mjs ADDED
@@ -0,0 +1,40 @@
1
+ // src/NextBlindAgentsWidget.tsx
2
+ import Script from "next/script";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var CDN_DEFAULT = "https://cdn.blindagents.com/report.js";
5
+ function BlindAgentsWidget({
6
+ apiKey,
7
+ primaryColor,
8
+ title,
9
+ reportBtnText,
10
+ btnEmoji,
11
+ btnTooltip,
12
+ emptyText,
13
+ userWhatsapp,
14
+ strategy = "afterInteractive",
15
+ src = CDN_DEFAULT,
16
+ onLoad,
17
+ onError
18
+ }) {
19
+ return /* @__PURE__ */ jsx(
20
+ Script,
21
+ {
22
+ src,
23
+ strategy,
24
+ "data-api-key": apiKey,
25
+ "data-primary-color": primaryColor,
26
+ "data-title": title,
27
+ "data-report-btn-text": reportBtnText,
28
+ "data-btn-emoji": btnEmoji,
29
+ "data-btn-tooltip": btnTooltip,
30
+ "data-empty-text": emptyText,
31
+ "data-user-whatsapp": userWhatsapp ?? "",
32
+ onLoad,
33
+ onError: onError ? () => onError(new Error(`Failed to load ${src}`)) : void 0
34
+ }
35
+ );
36
+ }
37
+ export {
38
+ BlindAgentsWidget
39
+ };
40
+ //# sourceMappingURL=next.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NextBlindAgentsWidget.tsx"],"sourcesContent":["'use client';\n\n// This file is only included in the `react-blind-agents/next` subpath entry.\n// It relies on `next/script` which is NOT available in plain React apps.\nimport Script from 'next/script';\nimport type { BlindAgentsWidgetProps } from './types';\n\nconst CDN_DEFAULT = 'https://cdn.blindagents.com/report.js';\n\nexport function BlindAgentsWidget({\n apiKey,\n primaryColor,\n title,\n reportBtnText,\n btnEmoji,\n btnTooltip,\n emptyText,\n userWhatsapp,\n strategy = 'afterInteractive',\n src = CDN_DEFAULT,\n onLoad,\n onError,\n}: BlindAgentsWidgetProps) {\n return (\n <Script\n src={src}\n strategy={strategy}\n data-api-key={apiKey}\n data-primary-color={primaryColor}\n data-title={title}\n data-report-btn-text={reportBtnText}\n data-btn-emoji={btnEmoji}\n data-btn-tooltip={btnTooltip}\n data-empty-text={emptyText}\n data-user-whatsapp={userWhatsapp ?? ''}\n onLoad={onLoad}\n onError={onError ? () => onError(new Error(`Failed to load ${src}`)) : undefined}\n />\n );\n}\n"],"mappings":";AAIA,OAAO,YAAY;AAoBf;AAjBJ,IAAM,cAAc;AAEb,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,MAAM;AAAA,EACN;AAAA,EACA;AACF,GAA2B;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,gBAAc;AAAA,MACd,sBAAoB;AAAA,MACpB,cAAY;AAAA,MACZ,wBAAsB;AAAA,MACtB,kBAAgB;AAAA,MAChB,oBAAkB;AAAA,MAClB,mBAAiB;AAAA,MACjB,sBAAoB,gBAAgB;AAAA,MACpC;AAAA,MACA,SAAS,UAAU,MAAM,QAAQ,IAAI,MAAM,kBAAkB,GAAG,EAAE,CAAC,IAAI;AAAA;AAAA,EACzE;AAEJ;","names":[]}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@duvandroid/react-blind-agents",
3
+ "version": "0.1.0",
4
+ "description": "React component for the Blind Agents pixel widget — bug reporter, webchat, and product guides.",
5
+ "author": "Blind Agents <hola@blindagents.com>",
6
+ "license": "MIT",
7
+ "keywords": ["react", "blind-agents", "widget", "bug-reporter", "webchat", "next"],
8
+ "main": "./dist/index.cjs",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.cjs"
16
+ },
17
+ "./next": {
18
+ "types": "./dist/next.d.ts",
19
+ "import": "./dist/next.js",
20
+ "require": "./dist/next.cjs"
21
+ }
22
+ },
23
+ "sideEffects": false,
24
+ "files": [
25
+ "dist",
26
+ "README.md"
27
+ ],
28
+ "scripts": {
29
+ "build": "tsup",
30
+ "dev": "tsup --watch",
31
+ "typecheck": "tsc --noEmit -p tsconfig.build.json",
32
+ "prepublishOnly": "npm run typecheck && npm run build"
33
+ },
34
+ "peerDependencies": {
35
+ "react": ">=17.0.0",
36
+ "react-dom": ">=17.0.0",
37
+ "next": ">=13.0.0"
38
+ },
39
+ "peerDependenciesMeta": {
40
+ "next": {
41
+ "optional": true
42
+ }
43
+ },
44
+ "devDependencies": {
45
+ "@types/react": "^19.0.0",
46
+ "@types/react-dom": "^19.0.0",
47
+ "next": "^15.0.0",
48
+ "react": "^19.0.0",
49
+ "react-dom": "^19.0.0",
50
+ "tsup": "^8.5.0",
51
+ "typescript": "^5.0.0"
52
+ }
53
+ }