@form-engine-ts/privacy 8.0.1 → 8.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/dist/index.cjs CHANGED
@@ -129,8 +129,8 @@ function createStandardPrivacyDetector(config = {}) {
129
129
  detect(schema, values) {
130
130
  const findings = [];
131
131
  for (const field of schema.fields) {
132
- if (field.type !== "text" && field.type !== "textarea") continue;
133
- const value = values[field.id];
132
+ const rawValue = values[field.id];
133
+ const value = field.type === "radio" && (0, import_core.isRadioTextAnswer)(rawValue) ? rawValue.text : field.type === "text" || field.type === "textarea" ? rawValue : void 0;
134
134
  if (typeof value !== "string" || value.length === 0) continue;
135
135
  for (const rule of rules) findings.push(...detectRule(field.id, value, rule));
136
136
  for (const detector of customDetectors) findings.push(...detector(field.id, value));
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  // src/index.ts
2
- import { FormSubmissionError } from "@form-engine-ts/core";
2
+ import {
3
+ FormSubmissionError,
4
+ isRadioTextAnswer
5
+ } from "@form-engine-ts/core";
3
6
  function normalizePiiFindingsToMetadata(findings, userConfirmed) {
4
7
  const piiFindingTypes = [...new Set(findings.map((finding) => finding.type))];
5
8
  return { piiConfirmed: userConfirmed, piiFindingTypes, piiDetectedCount: findings.length };
@@ -103,8 +106,8 @@ function createStandardPrivacyDetector(config = {}) {
103
106
  detect(schema, values) {
104
107
  const findings = [];
105
108
  for (const field of schema.fields) {
106
- if (field.type !== "text" && field.type !== "textarea") continue;
107
- const value = values[field.id];
109
+ const rawValue = values[field.id];
110
+ const value = field.type === "radio" && isRadioTextAnswer(rawValue) ? rawValue.text : field.type === "text" || field.type === "textarea" ? rawValue : void 0;
108
111
  if (typeof value !== "string" || value.length === 0) continue;
109
112
  for (const rule of rules) findings.push(...detectRule(field.id, value, rule));
110
113
  for (const detector of customDetectors) findings.push(...detector(field.id, value));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@form-engine-ts/privacy",
3
- "version": "8.0.1",
3
+ "version": "8.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,7 +38,7 @@
38
38
  "typescript"
39
39
  ],
40
40
  "dependencies": {
41
- "@form-engine-ts/core": "8.0.1"
41
+ "@form-engine-ts/core": "8.1.0"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --external @form-engine-ts/core",