ai-widget-sdk 1.0.3
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/index.d.ts +6 -0
- package/dist/index.js +26 -0
- package/package.json +19 -0
- package/src/index.d.ts +7 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +27 -0
- package/src/index.js.map +1 -0
- package/src/index.tsx +40 -0
- package/tsconfig.json +14 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
const AIWidget = ({ token }) => {
|
|
4
|
+
const [isValid, setIsValid] = useState(false);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
// Simulate token verification
|
|
7
|
+
if (token === "demo-token") {
|
|
8
|
+
setIsValid(true);
|
|
9
|
+
}
|
|
10
|
+
}, [token]);
|
|
11
|
+
if (!isValid)
|
|
12
|
+
return null;
|
|
13
|
+
return (_jsx("button", { style: {
|
|
14
|
+
position: "fixed",
|
|
15
|
+
bottom: "20px",
|
|
16
|
+
right: "20px",
|
|
17
|
+
padding: "12px 16px",
|
|
18
|
+
borderRadius: "50px",
|
|
19
|
+
border: "none",
|
|
20
|
+
background: "#7c3aed",
|
|
21
|
+
color: "white",
|
|
22
|
+
cursor: "pointer",
|
|
23
|
+
zIndex: 9999
|
|
24
|
+
}, onClick: () => alert("AI Widget Activated 🚀"), children: "AI" }));
|
|
25
|
+
};
|
|
26
|
+
export default AIWidget;
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-widget-sdk",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "AI Widget SDK",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"react": "^18.0.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/react": "^18.0.0",
|
|
16
|
+
"typescript": "^5.0.0"
|
|
17
|
+
},
|
|
18
|
+
"license": "ISC"
|
|
19
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA+BrC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
const AIWidget = ({ token }) => {
|
|
4
|
+
const [isValid, setIsValid] = useState(false);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
// Simulate token verification
|
|
7
|
+
if (token === "demo-token") {
|
|
8
|
+
setIsValid(true);
|
|
9
|
+
}
|
|
10
|
+
}, [token]);
|
|
11
|
+
if (!isValid)
|
|
12
|
+
return null;
|
|
13
|
+
return (_jsx("button", { style: {
|
|
14
|
+
position: "fixed",
|
|
15
|
+
bottom: "20px",
|
|
16
|
+
right: "20px",
|
|
17
|
+
padding: "12px 16px",
|
|
18
|
+
borderRadius: "50px",
|
|
19
|
+
border: "none",
|
|
20
|
+
background: "#7c3aed",
|
|
21
|
+
color: "white",
|
|
22
|
+
cursor: "pointer",
|
|
23
|
+
zIndex: 9999
|
|
24
|
+
}, onClick: () => alert("AI Widget Activated 🚀"), children: "AI" }));
|
|
25
|
+
};
|
|
26
|
+
export default AIWidget;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMnD,MAAM,QAAQ,GAA4B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACtD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,SAAS,CAAC,GAAG,EAAE;QACb,8BAA8B;QAC9B,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;YAC3B,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,OAAO,CACL,iBACE,KAAK,EAAE;YACL,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,WAAW;YACpB,YAAY,EAAE,MAAM;YACpB,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,SAAS;YACrB,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,IAAI;SACb,EACD,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,mBAGvC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
interface AIWidgetProps {
|
|
4
|
+
token: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const AIWidget: React.FC<AIWidgetProps> = ({ token }) => {
|
|
8
|
+
const [isValid, setIsValid] = useState(false);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
// Simulate token verification
|
|
12
|
+
if (token === "demo-token") {
|
|
13
|
+
setIsValid(true);
|
|
14
|
+
}
|
|
15
|
+
}, [token]);
|
|
16
|
+
|
|
17
|
+
if (!isValid) return null;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<button
|
|
21
|
+
style={{
|
|
22
|
+
position: "fixed",
|
|
23
|
+
bottom: "20px",
|
|
24
|
+
right: "20px",
|
|
25
|
+
padding: "12px 16px",
|
|
26
|
+
borderRadius: "50px",
|
|
27
|
+
border: "none",
|
|
28
|
+
background: "#7c3aed",
|
|
29
|
+
color: "white",
|
|
30
|
+
cursor: "pointer",
|
|
31
|
+
zIndex: 9999
|
|
32
|
+
}}
|
|
33
|
+
onClick={() => alert("AI Widget Activated 🚀")}
|
|
34
|
+
>
|
|
35
|
+
AI
|
|
36
|
+
</button>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default AIWidget;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2019",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|