acai-ui-library 0.1.21 → 0.1.23
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/components/ai-chatbot-logo-glyph.cjs +31 -0
- package/dist/components/ai-chatbot-logo-glyph.cjs.map +1 -0
- package/dist/components/ai-chatbot-logo-glyph.d.cts +3 -0
- package/dist/components/ai-chatbot-logo-glyph.d.ts +3 -0
- package/dist/components/ai-chatbot-logo-glyph.js +6 -0
- package/dist/components/ai-chatbot-logo-glyph.js.map +1 -0
- package/dist/components/ai-chatbot-logo.cjs +136 -0
- package/dist/components/ai-chatbot-logo.cjs.map +1 -0
- package/dist/components/ai-chatbot-logo.d.cts +13 -0
- package/dist/components/ai-chatbot-logo.d.ts +13 -0
- package/dist/components/ai-chatbot-logo.js +102 -0
- package/dist/components/ai-chatbot-logo.js.map +1 -0
- package/dist/components/app-launcher.cjs +224 -0
- package/dist/components/app-launcher.cjs.map +1 -0
- package/dist/components/app-launcher.d.cts +24 -0
- package/dist/components/app-launcher.d.ts +24 -0
- package/dist/components/app-launcher.js +190 -0
- package/dist/components/app-launcher.js.map +1 -0
- package/dist/components/calendar.cjs +13 -5
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.js +15 -7
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/date-picker.cjs +17 -7
- package/dist/components/date-picker.cjs.map +1 -1
- package/dist/components/date-picker.js +23 -13
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-time-picker.cjs +13 -5
- package/dist/components/date-time-picker.cjs.map +1 -1
- package/dist/components/date-time-picker.js +28 -20
- package/dist/components/date-time-picker.js.map +1 -1
- package/dist/components/help-widget/app-id-typecheck.cjs +34 -0
- package/dist/components/help-widget/app-id-typecheck.cjs.map +1 -0
- package/dist/components/help-widget/app-id-typecheck.d.cts +17 -0
- package/dist/components/help-widget/app-id-typecheck.d.ts +17 -0
- package/dist/components/help-widget/app-id-typecheck.js +8 -0
- package/dist/components/help-widget/app-id-typecheck.js.map +1 -0
- package/dist/components/help-widget/consent-dialog.cjs +276 -0
- package/dist/components/help-widget/consent-dialog.cjs.map +1 -0
- package/dist/components/help-widget/consent-dialog.d.cts +17 -0
- package/dist/components/help-widget/consent-dialog.d.ts +17 -0
- package/dist/components/help-widget/consent-dialog.js +239 -0
- package/dist/components/help-widget/consent-dialog.js.map +1 -0
- package/dist/components/help-widget/help-session-banner.cjs +85 -0
- package/dist/components/help-widget/help-session-banner.cjs.map +1 -0
- package/dist/components/help-widget/help-session-banner.d.cts +17 -0
- package/dist/components/help-widget/help-session-banner.d.ts +17 -0
- package/dist/components/help-widget/help-session-banner.js +50 -0
- package/dist/components/help-widget/help-session-banner.js.map +1 -0
- package/dist/components/help-widget/help-widget.cjs +503 -0
- package/dist/components/help-widget/help-widget.cjs.map +1 -0
- package/dist/components/help-widget/help-widget.d.cts +32 -0
- package/dist/components/help-widget/help-widget.d.ts +32 -0
- package/dist/components/help-widget/help-widget.js +468 -0
- package/dist/components/help-widget/help-widget.js.map +1 -0
- package/dist/components/help-widget/highlight-overlay.cjs +84 -0
- package/dist/components/help-widget/highlight-overlay.cjs.map +1 -0
- package/dist/components/help-widget/highlight-overlay.d.cts +24 -0
- package/dist/components/help-widget/highlight-overlay.d.ts +24 -0
- package/dist/components/help-widget/highlight-overlay.js +49 -0
- package/dist/components/help-widget/highlight-overlay.js.map +1 -0
- package/dist/components/help-widget/use-help-session.cjs +85 -0
- package/dist/components/help-widget/use-help-session.cjs.map +1 -0
- package/dist/components/help-widget/use-help-session.d.cts +46 -0
- package/dist/components/help-widget/use-help-session.d.ts +46 -0
- package/dist/components/help-widget/use-help-session.js +50 -0
- package/dist/components/help-widget/use-help-session.js.map +1 -0
- package/dist/index.cjs +665 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +699 -126
- package/dist/index.js.map +1 -1
- package/dist/lib/app-ids.cjs +58 -0
- package/dist/lib/app-ids.cjs.map +1 -0
- package/dist/lib/app-ids.d.cts +12 -0
- package/dist/lib/app-ids.d.ts +12 -0
- package/dist/lib/app-ids.js +32 -0
- package/dist/lib/app-ids.js.map +1 -0
- package/dist/lib/mask-snapshot.cjs +66 -0
- package/dist/lib/mask-snapshot.cjs.map +1 -0
- package/dist/lib/mask-snapshot.d.cts +16 -0
- package/dist/lib/mask-snapshot.d.ts +16 -0
- package/dist/lib/mask-snapshot.js +41 -0
- package/dist/lib/mask-snapshot.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,58 @@
|
|
|
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/lib/app-ids.ts
|
|
21
|
+
var app_ids_exports = {};
|
|
22
|
+
__export(app_ids_exports, {
|
|
23
|
+
SUPPORT_APP_IDS: () => SUPPORT_APP_IDS,
|
|
24
|
+
isSupportAppId: () => isSupportAppId
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(app_ids_exports);
|
|
27
|
+
var SUPPORT_APP_IDS = [
|
|
28
|
+
"bill",
|
|
29
|
+
"books",
|
|
30
|
+
"contract",
|
|
31
|
+
"crm",
|
|
32
|
+
"hear",
|
|
33
|
+
"hire",
|
|
34
|
+
"interviewer",
|
|
35
|
+
"itam",
|
|
36
|
+
"itom",
|
|
37
|
+
"itsm",
|
|
38
|
+
"mobile",
|
|
39
|
+
"notes",
|
|
40
|
+
"pay",
|
|
41
|
+
"people",
|
|
42
|
+
"procure",
|
|
43
|
+
"projects",
|
|
44
|
+
"sign",
|
|
45
|
+
"space",
|
|
46
|
+
"spend",
|
|
47
|
+
"transcribe",
|
|
48
|
+
"workspace"
|
|
49
|
+
];
|
|
50
|
+
function isSupportAppId(value) {
|
|
51
|
+
return typeof value === "string" && SUPPORT_APP_IDS.includes(value);
|
|
52
|
+
}
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
SUPPORT_APP_IDS,
|
|
56
|
+
isSupportAppId
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=app-ids.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/app-ids.ts"],"sourcesContent":["/**\n * Canonical product app ids for HelpWidget (acai-ai-platform#2831).\n *\n * No shared app-id registry exists anywhere in the estate yet (checked this repo and the\n * referenced #2827/#2828 tickets). This is the first definition; if a canonical registry\n * lands elsewhere, HelpWidget should import from there instead of here.\n */\nexport const SUPPORT_APP_IDS = [\n \"bill\",\n \"books\",\n \"contract\",\n \"crm\",\n \"hear\",\n \"hire\",\n \"interviewer\",\n \"itam\",\n \"itom\",\n \"itsm\",\n \"mobile\",\n \"notes\",\n \"pay\",\n \"people\",\n \"procure\",\n \"projects\",\n \"sign\",\n \"space\",\n \"spend\",\n \"transcribe\",\n \"workspace\",\n] as const\n\nexport type SupportAppId = (typeof SUPPORT_APP_IDS)[number]\n\nexport function isSupportAppId(value: unknown): value is SupportAppId {\n return typeof value === \"string\" && (SUPPORT_APP_IDS as readonly string[]).includes(value)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,SAAS,eAAe,OAAuC;AACpE,SAAO,OAAO,UAAU,YAAa,gBAAsC,SAAS,KAAK;AAC3F;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical product app ids for HelpWidget (acai-ai-platform#2831).
|
|
3
|
+
*
|
|
4
|
+
* No shared app-id registry exists anywhere in the estate yet (checked this repo and the
|
|
5
|
+
* referenced #2827/#2828 tickets). This is the first definition; if a canonical registry
|
|
6
|
+
* lands elsewhere, HelpWidget should import from there instead of here.
|
|
7
|
+
*/
|
|
8
|
+
declare const SUPPORT_APP_IDS: readonly ["bill", "books", "contract", "crm", "hear", "hire", "interviewer", "itam", "itom", "itsm", "mobile", "notes", "pay", "people", "procure", "projects", "sign", "space", "spend", "transcribe", "workspace"];
|
|
9
|
+
type SupportAppId = (typeof SUPPORT_APP_IDS)[number];
|
|
10
|
+
declare function isSupportAppId(value: unknown): value is SupportAppId;
|
|
11
|
+
|
|
12
|
+
export { SUPPORT_APP_IDS, type SupportAppId, isSupportAppId };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical product app ids for HelpWidget (acai-ai-platform#2831).
|
|
3
|
+
*
|
|
4
|
+
* No shared app-id registry exists anywhere in the estate yet (checked this repo and the
|
|
5
|
+
* referenced #2827/#2828 tickets). This is the first definition; if a canonical registry
|
|
6
|
+
* lands elsewhere, HelpWidget should import from there instead of here.
|
|
7
|
+
*/
|
|
8
|
+
declare const SUPPORT_APP_IDS: readonly ["bill", "books", "contract", "crm", "hear", "hire", "interviewer", "itam", "itom", "itsm", "mobile", "notes", "pay", "people", "procure", "projects", "sign", "space", "spend", "transcribe", "workspace"];
|
|
9
|
+
type SupportAppId = (typeof SUPPORT_APP_IDS)[number];
|
|
10
|
+
declare function isSupportAppId(value: unknown): value is SupportAppId;
|
|
11
|
+
|
|
12
|
+
export { SUPPORT_APP_IDS, type SupportAppId, isSupportAppId };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/lib/app-ids.ts
|
|
2
|
+
var SUPPORT_APP_IDS = [
|
|
3
|
+
"bill",
|
|
4
|
+
"books",
|
|
5
|
+
"contract",
|
|
6
|
+
"crm",
|
|
7
|
+
"hear",
|
|
8
|
+
"hire",
|
|
9
|
+
"interviewer",
|
|
10
|
+
"itam",
|
|
11
|
+
"itom",
|
|
12
|
+
"itsm",
|
|
13
|
+
"mobile",
|
|
14
|
+
"notes",
|
|
15
|
+
"pay",
|
|
16
|
+
"people",
|
|
17
|
+
"procure",
|
|
18
|
+
"projects",
|
|
19
|
+
"sign",
|
|
20
|
+
"space",
|
|
21
|
+
"spend",
|
|
22
|
+
"transcribe",
|
|
23
|
+
"workspace"
|
|
24
|
+
];
|
|
25
|
+
function isSupportAppId(value) {
|
|
26
|
+
return typeof value === "string" && SUPPORT_APP_IDS.includes(value);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
SUPPORT_APP_IDS,
|
|
30
|
+
isSupportAppId
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=app-ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/app-ids.ts"],"sourcesContent":["/**\n * Canonical product app ids for HelpWidget (acai-ai-platform#2831).\n *\n * No shared app-id registry exists anywhere in the estate yet (checked this repo and the\n * referenced #2827/#2828 tickets). This is the first definition; if a canonical registry\n * lands elsewhere, HelpWidget should import from there instead of here.\n */\nexport const SUPPORT_APP_IDS = [\n \"bill\",\n \"books\",\n \"contract\",\n \"crm\",\n \"hear\",\n \"hire\",\n \"interviewer\",\n \"itam\",\n \"itom\",\n \"itsm\",\n \"mobile\",\n \"notes\",\n \"pay\",\n \"people\",\n \"procure\",\n \"projects\",\n \"sign\",\n \"space\",\n \"spend\",\n \"transcribe\",\n \"workspace\",\n] as const\n\nexport type SupportAppId = (typeof SUPPORT_APP_IDS)[number]\n\nexport function isSupportAppId(value: unknown): value is SupportAppId {\n return typeof value === \"string\" && (SUPPORT_APP_IDS as readonly string[]).includes(value)\n}\n"],"mappings":";AAOO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,SAAS,eAAe,OAAuC;AACpE,SAAO,OAAO,UAAU,YAAa,gBAAsC,SAAS,KAAK;AAC3F;","names":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
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/lib/mask-snapshot.ts
|
|
21
|
+
var mask_snapshot_exports = {};
|
|
22
|
+
__export(mask_snapshot_exports, {
|
|
23
|
+
maskSnapshot: () => maskSnapshot
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(mask_snapshot_exports);
|
|
26
|
+
var MASK = "[masked]";
|
|
27
|
+
var PATTERNS = [
|
|
28
|
+
// PAN: AAAAA9999A
|
|
29
|
+
/\b[A-Z]{5}[0-9]{4}[A-Z]\b/g,
|
|
30
|
+
// Aadhaar: 12 digits, optionally grouped as 4-4-4 with spaces or hyphens
|
|
31
|
+
/\b\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g,
|
|
32
|
+
// IFSC: AAAA0999999
|
|
33
|
+
/\b[A-Z]{4}0[A-Z0-9]{6}\b/g,
|
|
34
|
+
// Bare bank account numbers: 9 to 18 digits not already matched as Aadhaar above
|
|
35
|
+
/\b\d{9,18}\b/g
|
|
36
|
+
];
|
|
37
|
+
function redactText(text) {
|
|
38
|
+
return PATTERNS.reduce((acc, pattern) => acc.replace(pattern, MASK), text);
|
|
39
|
+
}
|
|
40
|
+
function maskControls(root) {
|
|
41
|
+
const controls = root.querySelectorAll(
|
|
42
|
+
"input, textarea, select"
|
|
43
|
+
);
|
|
44
|
+
controls.forEach((el) => {
|
|
45
|
+
if ("value" in el) el.setAttribute("data-help-widget-masked-value", MASK);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function maskSnapshot(root = document.body) {
|
|
49
|
+
const clone = root.cloneNode(true);
|
|
50
|
+
const container = clone instanceof Document ? clone.body : clone;
|
|
51
|
+
maskControls(container);
|
|
52
|
+
const controls = container.querySelectorAll(
|
|
53
|
+
"input, textarea, select"
|
|
54
|
+
);
|
|
55
|
+
controls.forEach((el) => {
|
|
56
|
+
const replacement = container.ownerDocument?.createTextNode(MASK) ?? document.createTextNode(MASK);
|
|
57
|
+
el.replaceWith(replacement);
|
|
58
|
+
});
|
|
59
|
+
const text = container.textContent ?? "";
|
|
60
|
+
return redactText(text);
|
|
61
|
+
}
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
maskSnapshot
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=mask-snapshot.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/mask-snapshot.ts"],"sourcesContent":["/**\n * Masks a DOM snapshot before it is sent to the support AI agent (acai-ai-platform#2831).\n *\n * Every form control's value is replaced regardless of its type or name - the widget must\n * never rely on guessing which fields are sensitive. The remaining text is then redacted\n * for PAN, Aadhaar, and bank account/IFSC patterns, in case those values are rendered as\n * plain text rather than held in a control (e.g. a read-only profile page).\n */\n\nconst MASK = \"[masked]\"\n\nconst PATTERNS: readonly RegExp[] = [\n // PAN: AAAAA9999A\n /\\b[A-Z]{5}[0-9]{4}[A-Z]\\b/g,\n // Aadhaar: 12 digits, optionally grouped as 4-4-4 with spaces or hyphens\n /\\b\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}\\b/g,\n // IFSC: AAAA0999999\n /\\b[A-Z]{4}0[A-Z0-9]{6}\\b/g,\n // Bare bank account numbers: 9 to 18 digits not already matched as Aadhaar above\n /\\b\\d{9,18}\\b/g,\n]\n\nfunction redactText(text: string): string {\n return PATTERNS.reduce((acc, pattern) => acc.replace(pattern, MASK), text)\n}\n\nfunction maskControls(root: ParentNode): void {\n const controls = root.querySelectorAll<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>(\n \"input, textarea, select\"\n )\n controls.forEach((el) => {\n if (\"value\" in el) el.setAttribute(\"data-help-widget-masked-value\", MASK)\n })\n}\n\n/**\n * Returns a masked text snapshot of `root` (default `document.body`): every form control\n * value is reported as \"[masked]\", and PAN/Aadhaar/bank-account/IFSC patterns are redacted\n * out of the remaining visible text. Does not mutate the DOM.\n */\nexport function maskSnapshot(root: Document | HTMLElement = document.body): string {\n const clone = root.cloneNode(true) as HTMLElement | Document\n const container = clone instanceof Document ? clone.body : clone\n maskControls(container)\n\n const controls = container.querySelectorAll<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>(\n \"input, textarea, select\"\n )\n controls.forEach((el) => {\n const replacement = container.ownerDocument?.createTextNode(MASK) ?? document.createTextNode(MASK)\n el.replaceWith(replacement)\n })\n\n const text = container.textContent ?? \"\"\n return redactText(text)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,OAAO;AAEb,IAAM,WAA8B;AAAA;AAAA,EAElC;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AACF;AAEA,SAAS,WAAW,MAAsB;AACxC,SAAO,SAAS,OAAO,CAAC,KAAK,YAAY,IAAI,QAAQ,SAAS,IAAI,GAAG,IAAI;AAC3E;AAEA,SAAS,aAAa,MAAwB;AAC5C,QAAM,WAAW,KAAK;AAAA,IACpB;AAAA,EACF;AACA,WAAS,QAAQ,CAAC,OAAO;AACvB,QAAI,WAAW,GAAI,IAAG,aAAa,iCAAiC,IAAI;AAAA,EAC1E,CAAC;AACH;AAOO,SAAS,aAAa,OAA+B,SAAS,MAAc;AACjF,QAAM,QAAQ,KAAK,UAAU,IAAI;AACjC,QAAM,YAAY,iBAAiB,WAAW,MAAM,OAAO;AAC3D,eAAa,SAAS;AAEtB,QAAM,WAAW,UAAU;AAAA,IACzB;AAAA,EACF;AACA,WAAS,QAAQ,CAAC,OAAO;AACvB,UAAM,cAAc,UAAU,eAAe,eAAe,IAAI,KAAK,SAAS,eAAe,IAAI;AACjG,OAAG,YAAY,WAAW;AAAA,EAC5B,CAAC;AAED,QAAM,OAAO,UAAU,eAAe;AACtC,SAAO,WAAW,IAAI;AACxB;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Masks a DOM snapshot before it is sent to the support AI agent (acai-ai-platform#2831).
|
|
3
|
+
*
|
|
4
|
+
* Every form control's value is replaced regardless of its type or name - the widget must
|
|
5
|
+
* never rely on guessing which fields are sensitive. The remaining text is then redacted
|
|
6
|
+
* for PAN, Aadhaar, and bank account/IFSC patterns, in case those values are rendered as
|
|
7
|
+
* plain text rather than held in a control (e.g. a read-only profile page).
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Returns a masked text snapshot of `root` (default `document.body`): every form control
|
|
11
|
+
* value is reported as "[masked]", and PAN/Aadhaar/bank-account/IFSC patterns are redacted
|
|
12
|
+
* out of the remaining visible text. Does not mutate the DOM.
|
|
13
|
+
*/
|
|
14
|
+
declare function maskSnapshot(root?: Document | HTMLElement): string;
|
|
15
|
+
|
|
16
|
+
export { maskSnapshot };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Masks a DOM snapshot before it is sent to the support AI agent (acai-ai-platform#2831).
|
|
3
|
+
*
|
|
4
|
+
* Every form control's value is replaced regardless of its type or name - the widget must
|
|
5
|
+
* never rely on guessing which fields are sensitive. The remaining text is then redacted
|
|
6
|
+
* for PAN, Aadhaar, and bank account/IFSC patterns, in case those values are rendered as
|
|
7
|
+
* plain text rather than held in a control (e.g. a read-only profile page).
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Returns a masked text snapshot of `root` (default `document.body`): every form control
|
|
11
|
+
* value is reported as "[masked]", and PAN/Aadhaar/bank-account/IFSC patterns are redacted
|
|
12
|
+
* out of the remaining visible text. Does not mutate the DOM.
|
|
13
|
+
*/
|
|
14
|
+
declare function maskSnapshot(root?: Document | HTMLElement): string;
|
|
15
|
+
|
|
16
|
+
export { maskSnapshot };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/lib/mask-snapshot.ts
|
|
2
|
+
var MASK = "[masked]";
|
|
3
|
+
var PATTERNS = [
|
|
4
|
+
// PAN: AAAAA9999A
|
|
5
|
+
/\b[A-Z]{5}[0-9]{4}[A-Z]\b/g,
|
|
6
|
+
// Aadhaar: 12 digits, optionally grouped as 4-4-4 with spaces or hyphens
|
|
7
|
+
/\b\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g,
|
|
8
|
+
// IFSC: AAAA0999999
|
|
9
|
+
/\b[A-Z]{4}0[A-Z0-9]{6}\b/g,
|
|
10
|
+
// Bare bank account numbers: 9 to 18 digits not already matched as Aadhaar above
|
|
11
|
+
/\b\d{9,18}\b/g
|
|
12
|
+
];
|
|
13
|
+
function redactText(text) {
|
|
14
|
+
return PATTERNS.reduce((acc, pattern) => acc.replace(pattern, MASK), text);
|
|
15
|
+
}
|
|
16
|
+
function maskControls(root) {
|
|
17
|
+
const controls = root.querySelectorAll(
|
|
18
|
+
"input, textarea, select"
|
|
19
|
+
);
|
|
20
|
+
controls.forEach((el) => {
|
|
21
|
+
if ("value" in el) el.setAttribute("data-help-widget-masked-value", MASK);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function maskSnapshot(root = document.body) {
|
|
25
|
+
const clone = root.cloneNode(true);
|
|
26
|
+
const container = clone instanceof Document ? clone.body : clone;
|
|
27
|
+
maskControls(container);
|
|
28
|
+
const controls = container.querySelectorAll(
|
|
29
|
+
"input, textarea, select"
|
|
30
|
+
);
|
|
31
|
+
controls.forEach((el) => {
|
|
32
|
+
const replacement = container.ownerDocument?.createTextNode(MASK) ?? document.createTextNode(MASK);
|
|
33
|
+
el.replaceWith(replacement);
|
|
34
|
+
});
|
|
35
|
+
const text = container.textContent ?? "";
|
|
36
|
+
return redactText(text);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
maskSnapshot
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=mask-snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/mask-snapshot.ts"],"sourcesContent":["/**\n * Masks a DOM snapshot before it is sent to the support AI agent (acai-ai-platform#2831).\n *\n * Every form control's value is replaced regardless of its type or name - the widget must\n * never rely on guessing which fields are sensitive. The remaining text is then redacted\n * for PAN, Aadhaar, and bank account/IFSC patterns, in case those values are rendered as\n * plain text rather than held in a control (e.g. a read-only profile page).\n */\n\nconst MASK = \"[masked]\"\n\nconst PATTERNS: readonly RegExp[] = [\n // PAN: AAAAA9999A\n /\\b[A-Z]{5}[0-9]{4}[A-Z]\\b/g,\n // Aadhaar: 12 digits, optionally grouped as 4-4-4 with spaces or hyphens\n /\\b\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}\\b/g,\n // IFSC: AAAA0999999\n /\\b[A-Z]{4}0[A-Z0-9]{6}\\b/g,\n // Bare bank account numbers: 9 to 18 digits not already matched as Aadhaar above\n /\\b\\d{9,18}\\b/g,\n]\n\nfunction redactText(text: string): string {\n return PATTERNS.reduce((acc, pattern) => acc.replace(pattern, MASK), text)\n}\n\nfunction maskControls(root: ParentNode): void {\n const controls = root.querySelectorAll<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>(\n \"input, textarea, select\"\n )\n controls.forEach((el) => {\n if (\"value\" in el) el.setAttribute(\"data-help-widget-masked-value\", MASK)\n })\n}\n\n/**\n * Returns a masked text snapshot of `root` (default `document.body`): every form control\n * value is reported as \"[masked]\", and PAN/Aadhaar/bank-account/IFSC patterns are redacted\n * out of the remaining visible text. Does not mutate the DOM.\n */\nexport function maskSnapshot(root: Document | HTMLElement = document.body): string {\n const clone = root.cloneNode(true) as HTMLElement | Document\n const container = clone instanceof Document ? clone.body : clone\n maskControls(container)\n\n const controls = container.querySelectorAll<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>(\n \"input, textarea, select\"\n )\n controls.forEach((el) => {\n const replacement = container.ownerDocument?.createTextNode(MASK) ?? document.createTextNode(MASK)\n el.replaceWith(replacement)\n })\n\n const text = container.textContent ?? \"\"\n return redactText(text)\n}\n"],"mappings":";AASA,IAAM,OAAO;AAEb,IAAM,WAA8B;AAAA;AAAA,EAElC;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AACF;AAEA,SAAS,WAAW,MAAsB;AACxC,SAAO,SAAS,OAAO,CAAC,KAAK,YAAY,IAAI,QAAQ,SAAS,IAAI,GAAG,IAAI;AAC3E;AAEA,SAAS,aAAa,MAAwB;AAC5C,QAAM,WAAW,KAAK;AAAA,IACpB;AAAA,EACF;AACA,WAAS,QAAQ,CAAC,OAAO;AACvB,QAAI,WAAW,GAAI,IAAG,aAAa,iCAAiC,IAAI;AAAA,EAC1E,CAAC;AACH;AAOO,SAAS,aAAa,OAA+B,SAAS,MAAc;AACjF,QAAM,QAAQ,KAAK,UAAU,IAAI;AACjC,QAAM,YAAY,iBAAiB,WAAW,MAAM,OAAO;AAC3D,eAAa,SAAS;AAEtB,QAAM,WAAW,UAAU;AAAA,IACzB;AAAA,EACF;AACA,WAAS,QAAQ,CAAC,OAAO;AACvB,UAAM,cAAc,UAAU,eAAe,eAAe,IAAI,KAAK,SAAS,eAAe,IAAI;AACjG,OAAG,YAAY,WAAW;AAAA,EAC5B,CAAC;AAED,QAAM,OAAO,UAAU,eAAe;AACtC,SAAO,WAAW,IAAI;AACxB;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "acai-ui-library",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"description": "A production-ready, fully-branded React component library.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org",
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
"cmdk": "^1.0.0",
|
|
91
91
|
"embla-carousel-react": "^8.5.0",
|
|
92
92
|
"input-otp": "^1.4.0",
|
|
93
|
+
"livekit-client": "^2.7.0",
|
|
93
94
|
"lucide-react": "^0.468.0",
|
|
94
95
|
"react-day-picker": "^9.4.0",
|
|
95
96
|
"react-hook-form": "^7.54.0",
|