@discloai/react 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/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/index.d.mts +38 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +105 -0
- package/dist/index.mjs +66 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DiscloAI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @discloai/react
|
|
2
|
+
|
|
3
|
+
React wrapper for [@discloai/core](../core/README.md) — EU AI Act Article 50 disclosures.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @discloai/react
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { DiscloAIProvider } from '@discloai/react';
|
|
11
|
+
|
|
12
|
+
<DiscloAIProvider siteId="YOUR_SITE_ID" />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
See full documentation in [@discloai/core README](../core/README.md).
|
|
16
|
+
|
|
17
|
+
MIT © 2026 DiscloAI
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { AIGuardInitOptions, ChatbotDisclosureConfig, AIContentLabelConfig, DeepfakeLabelConfig, BiometricNoticeConfig } from '@aiGuard/core';
|
|
3
|
+
|
|
4
|
+
interface AIGuardProviderProps extends Partial<AIGuardInitOptions> {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* AIGuardProvider — call init() once on mount.
|
|
9
|
+
* Must be a Client Component (uses useEffect).
|
|
10
|
+
* SSR-safe: init() is only called in browser.
|
|
11
|
+
*/
|
|
12
|
+
declare function AIGuardProvider({ children, ...options }: AIGuardProviderProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
interface ChatbotDisclosureProps {
|
|
15
|
+
siteId: string;
|
|
16
|
+
config?: ChatbotDisclosureConfig;
|
|
17
|
+
}
|
|
18
|
+
declare function ChatbotDisclosure({ siteId, config }: ChatbotDisclosureProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
interface AIContentLabelProps {
|
|
21
|
+
siteId: string;
|
|
22
|
+
config?: AIContentLabelConfig;
|
|
23
|
+
}
|
|
24
|
+
declare function AIContentLabel({ siteId, config }: AIContentLabelProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
interface DeepfakeLabelProps {
|
|
27
|
+
siteId: string;
|
|
28
|
+
config?: DeepfakeLabelConfig;
|
|
29
|
+
}
|
|
30
|
+
declare function DeepfakeLabel({ siteId, config }: DeepfakeLabelProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
interface BiometricNoticeProps {
|
|
33
|
+
siteId: string;
|
|
34
|
+
config?: BiometricNoticeConfig;
|
|
35
|
+
}
|
|
36
|
+
declare function BiometricNotice({ siteId, config }: BiometricNoticeProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
|
|
38
|
+
export { AIContentLabel, type AIContentLabelProps, AIGuardProvider, type AIGuardProviderProps, BiometricNotice, type BiometricNoticeProps, ChatbotDisclosure, type ChatbotDisclosureProps, DeepfakeLabel, type DeepfakeLabelProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DiscloAIInitOptions, ChatbotDisclosureConfig, AIContentLabelConfig, DeepfakeLabelConfig, BiometricNoticeConfig } from '@discloai/core';
|
|
3
|
+
|
|
4
|
+
interface DiscloAIProviderProps extends Partial<DiscloAIInitOptions> {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* DiscloAIProvider — call init() once on mount.
|
|
9
|
+
* Must be a Client Component (uses useEffect).
|
|
10
|
+
* SSR-safe: init() is only called in browser.
|
|
11
|
+
*/
|
|
12
|
+
declare function DiscloAIProvider({ children, ...options }: DiscloAIProviderProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
interface ChatbotDisclosureProps {
|
|
15
|
+
siteId: string;
|
|
16
|
+
config?: ChatbotDisclosureConfig;
|
|
17
|
+
}
|
|
18
|
+
declare function ChatbotDisclosure({ siteId, config }: ChatbotDisclosureProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
interface AIContentLabelProps {
|
|
21
|
+
siteId: string;
|
|
22
|
+
config?: AIContentLabelConfig;
|
|
23
|
+
}
|
|
24
|
+
declare function AIContentLabel({ siteId, config }: AIContentLabelProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
interface DeepfakeLabelProps {
|
|
27
|
+
siteId: string;
|
|
28
|
+
config?: DeepfakeLabelConfig;
|
|
29
|
+
}
|
|
30
|
+
declare function DeepfakeLabel({ siteId, config }: DeepfakeLabelProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
interface BiometricNoticeProps {
|
|
33
|
+
siteId: string;
|
|
34
|
+
config?: BiometricNoticeConfig;
|
|
35
|
+
}
|
|
36
|
+
declare function BiometricNotice({ siteId, config }: BiometricNoticeProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
|
|
38
|
+
export { AIContentLabel, type AIContentLabelProps, DiscloAIProvider, type DiscloAIProviderProps, BiometricNotice, type BiometricNoticeProps, ChatbotDisclosure, type ChatbotDisclosureProps, DeepfakeLabel, type DeepfakeLabelProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
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 __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __objRest = (source, exclude) => {
|
|
11
|
+
var target = {};
|
|
12
|
+
for (var prop in source)
|
|
13
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
14
|
+
target[prop] = source[prop];
|
|
15
|
+
if (source != null && __getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
17
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
18
|
+
target[prop] = source[prop];
|
|
19
|
+
}
|
|
20
|
+
return target;
|
|
21
|
+
};
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
42
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
+
|
|
44
|
+
// src/index.ts
|
|
45
|
+
var index_exports = {};
|
|
46
|
+
__export(index_exports, {
|
|
47
|
+
AIContentLabel: () => AIContentLabel,
|
|
48
|
+
DiscloAIProvider: () => DiscloAIProvider,
|
|
49
|
+
BiometricNotice: () => BiometricNotice,
|
|
50
|
+
ChatbotDisclosure: () => ChatbotDisclosure,
|
|
51
|
+
DeepfakeLabel: () => DeepfakeLabel
|
|
52
|
+
});
|
|
53
|
+
module.exports = __toCommonJS(index_exports);
|
|
54
|
+
|
|
55
|
+
// src/DiscloAIProvider.tsx
|
|
56
|
+
var import_react = require("react");
|
|
57
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
58
|
+
function DiscloAIProvider(_a) {
|
|
59
|
+
var _b = _a, { children } = _b, options = __objRest(_b, ["children"]);
|
|
60
|
+
const initialised = (0, import_react.useRef)(false);
|
|
61
|
+
(0, import_react.useEffect)(() => {
|
|
62
|
+
if (initialised.current) return;
|
|
63
|
+
initialised.current = true;
|
|
64
|
+
if (!options.siteId) {
|
|
65
|
+
console.warn("[DiscloAI] DiscloAIProvider: siteId is required");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
import("@discloai/core").then(({ init }) => {
|
|
69
|
+
init(options);
|
|
70
|
+
});
|
|
71
|
+
}, []);
|
|
72
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/ChatbotDisclosure.tsx
|
|
76
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
77
|
+
function ChatbotDisclosure({ siteId, config }) {
|
|
78
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DiscloAIProvider, { siteId, chatbotDisclosure: config });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/AIContentLabel.tsx
|
|
82
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
83
|
+
function AIContentLabel({ siteId, config }) {
|
|
84
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DiscloAIProvider, { siteId, aiContentLabel: config });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/DeepfakeLabel.tsx
|
|
88
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
89
|
+
function DeepfakeLabel({ siteId, config }) {
|
|
90
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DiscloAIProvider, { siteId, deepfakeLabel: config });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/BiometricNotice.tsx
|
|
94
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
95
|
+
function BiometricNotice({ siteId, config }) {
|
|
96
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DiscloAIProvider, { siteId, biometricNotice: config });
|
|
97
|
+
}
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
AIContentLabel,
|
|
101
|
+
DiscloAIProvider,
|
|
102
|
+
BiometricNotice,
|
|
103
|
+
ChatbotDisclosure,
|
|
104
|
+
DeepfakeLabel
|
|
105
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var __objRest = (source, exclude) => {
|
|
5
|
+
var target = {};
|
|
6
|
+
for (var prop in source)
|
|
7
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
8
|
+
target[prop] = source[prop];
|
|
9
|
+
if (source != null && __getOwnPropSymbols)
|
|
10
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
11
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
12
|
+
target[prop] = source[prop];
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// src/DiscloAIProvider.tsx
|
|
18
|
+
import { useEffect, useRef } from "react";
|
|
19
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
20
|
+
function DiscloAIProvider(_a) {
|
|
21
|
+
var _b = _a, { children } = _b, options = __objRest(_b, ["children"]);
|
|
22
|
+
const initialised = useRef(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (initialised.current) return;
|
|
25
|
+
initialised.current = true;
|
|
26
|
+
if (!options.siteId) {
|
|
27
|
+
console.warn("[DiscloAI] DiscloAIProvider: siteId is required");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
import("@discloai/core").then(({ init }) => {
|
|
31
|
+
init(options);
|
|
32
|
+
});
|
|
33
|
+
}, []);
|
|
34
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/ChatbotDisclosure.tsx
|
|
38
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
39
|
+
function ChatbotDisclosure({ siteId, config }) {
|
|
40
|
+
return /* @__PURE__ */ jsx2(DiscloAIProvider, { siteId, chatbotDisclosure: config });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// src/AIContentLabel.tsx
|
|
44
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
45
|
+
function AIContentLabel({ siteId, config }) {
|
|
46
|
+
return /* @__PURE__ */ jsx3(DiscloAIProvider, { siteId, aiContentLabel: config });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/DeepfakeLabel.tsx
|
|
50
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
51
|
+
function DeepfakeLabel({ siteId, config }) {
|
|
52
|
+
return /* @__PURE__ */ jsx4(DiscloAIProvider, { siteId, deepfakeLabel: config });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/BiometricNotice.tsx
|
|
56
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
57
|
+
function BiometricNotice({ siteId, config }) {
|
|
58
|
+
return /* @__PURE__ */ jsx5(DiscloAIProvider, { siteId, biometricNotice: config });
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
AIContentLabel,
|
|
62
|
+
DiscloAIProvider,
|
|
63
|
+
BiometricNotice,
|
|
64
|
+
ChatbotDisclosure,
|
|
65
|
+
DeepfakeLabel
|
|
66
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@discloai/react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React wrapper for @discloai/core \u2014 EU AI Act Article 50 disclosures",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://discloai.com",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/DiscloAI/sdk",
|
|
10
|
+
"directory": "packages/react"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"EU AI Act",
|
|
14
|
+
"Article 50",
|
|
15
|
+
"disclosure",
|
|
16
|
+
"AI compliance",
|
|
17
|
+
"react"
|
|
18
|
+
],
|
|
19
|
+
"main": "dist/index.js",
|
|
20
|
+
"module": "dist/index.mjs",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.mjs",
|
|
26
|
+
"require": "./dist/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": ">=18.0.0",
|
|
34
|
+
"react-dom": ">=18.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/react": "^18.0.0",
|
|
38
|
+
"react": "^18.0.0",
|
|
39
|
+
"tsup": "^8.0.0",
|
|
40
|
+
"typescript": "^5.4.5"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@discloai/core": "workspace:*"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public",
|
|
47
|
+
"registry": "https://registry.npmjs.org"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsup",
|
|
51
|
+
"typecheck": "tsc --noEmit"
|
|
52
|
+
}
|
|
53
|
+
}
|