@gusto/embedded-react-sdk 0.56.7-rc.1 → 0.57.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/CHANGELOG.md +37 -0
- package/README.md +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +8 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +5 -3
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js +113 -111
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +27 -31
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +31 -35
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js +5 -9
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +4 -2
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ObservabilityProvider/sanitization.js +98 -47
- package/dist/contexts/ObservabilityProvider/sanitization.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/contexts/ObservabilityProvider/sanitization.d.ts +8 -17
- package/dist/src/contexts/ObservabilityProvider/useSanitizedObservability.test.d.ts +1 -0
- package/dist/src/types/observability.d.ts +59 -20
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const d = [
|
|
2
2
|
{ pattern: /\b\d{3}-\d{2}-\d{4}\b/g, replacement: "[SSN-REDACTED]" },
|
|
3
3
|
{ pattern: /\b\d{9}\b/g, replacement: "[SSN-REDACTED]" },
|
|
4
4
|
{
|
|
@@ -9,7 +9,7 @@ const o = [
|
|
|
9
9
|
{ pattern: /\(\d{3}\)\s*\d{3}[-.\s]?\d{4}/g, replacement: "[PHONE-REDACTED]" },
|
|
10
10
|
{ pattern: /\b\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}\b/g, replacement: "[CC-REDACTED]" },
|
|
11
11
|
{ pattern: /\b[A-Za-z0-9_-]{32,}\b/g, replacement: "[TOKEN-REDACTED]" }
|
|
12
|
-
],
|
|
12
|
+
], _ = [
|
|
13
13
|
"password",
|
|
14
14
|
"token",
|
|
15
15
|
"apiKey",
|
|
@@ -26,70 +26,121 @@ const o = [
|
|
|
26
26
|
"routingNumber",
|
|
27
27
|
"routing_number",
|
|
28
28
|
"accountNumber",
|
|
29
|
-
"account_number"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
"account_number",
|
|
30
|
+
"dateOfBirth",
|
|
31
|
+
"date_of_birth",
|
|
32
|
+
"birthDate",
|
|
33
|
+
"birth_date",
|
|
34
|
+
"birthday",
|
|
35
|
+
"firstName",
|
|
36
|
+
"first_name",
|
|
37
|
+
"lastName",
|
|
38
|
+
"last_name",
|
|
39
|
+
"middleName",
|
|
40
|
+
"middle_name",
|
|
41
|
+
"fullName",
|
|
42
|
+
"full_name",
|
|
43
|
+
"employeeName",
|
|
44
|
+
"employee_name",
|
|
45
|
+
"signatureText",
|
|
46
|
+
"signature_text",
|
|
47
|
+
"retirementLoanIdentifier",
|
|
48
|
+
"retirement_loan_identifier",
|
|
49
|
+
"phone",
|
|
50
|
+
"zipCode",
|
|
51
|
+
"zip_code",
|
|
52
|
+
"postalCode",
|
|
53
|
+
"postal_code",
|
|
54
|
+
"preparerCity",
|
|
55
|
+
"preparer_city",
|
|
56
|
+
"preparerZip",
|
|
57
|
+
"preparer_zip",
|
|
58
|
+
"preparer2City",
|
|
59
|
+
"preparer2_city",
|
|
60
|
+
"preparer2Zip",
|
|
61
|
+
"preparer2_zip",
|
|
62
|
+
"preparer3City",
|
|
63
|
+
"preparer3_city",
|
|
64
|
+
"preparer3Zip",
|
|
65
|
+
"preparer3_zip",
|
|
66
|
+
"preparer4City",
|
|
67
|
+
"preparer4_city",
|
|
68
|
+
"preparer4Zip",
|
|
69
|
+
"preparer4_zip",
|
|
70
|
+
"address",
|
|
71
|
+
"street1",
|
|
72
|
+
"street_1",
|
|
73
|
+
"street2",
|
|
74
|
+
"street_2",
|
|
75
|
+
"caseNumber",
|
|
76
|
+
"case_number",
|
|
77
|
+
"orderNumber",
|
|
78
|
+
"order_number",
|
|
79
|
+
"remittanceNumber",
|
|
80
|
+
"remittance_number",
|
|
81
|
+
"documentNumber",
|
|
82
|
+
"document_number"
|
|
83
|
+
], E = /* @__PURE__ */ new Set(["ein", "dob", "zip", "city"]);
|
|
84
|
+
function s(e) {
|
|
85
|
+
let r = e;
|
|
86
|
+
for (const { pattern: t, replacement: i } of d)
|
|
87
|
+
r = r.replace(t, i);
|
|
88
|
+
return r;
|
|
36
89
|
}
|
|
37
|
-
function
|
|
90
|
+
function p(e, r = []) {
|
|
38
91
|
if (e == null)
|
|
39
92
|
return e;
|
|
40
93
|
if (typeof e == "string")
|
|
41
|
-
return
|
|
94
|
+
return s(e);
|
|
42
95
|
if (typeof e == "number" || typeof e == "boolean")
|
|
43
96
|
return e;
|
|
44
97
|
if (Array.isArray(e))
|
|
45
|
-
return e.map((
|
|
98
|
+
return e.map((t) => p(t, r));
|
|
46
99
|
if (typeof e == "object") {
|
|
47
|
-
const
|
|
48
|
-
for (const [a,
|
|
49
|
-
|
|
50
|
-
|
|
100
|
+
const t = {}, i = [..._, ...r];
|
|
101
|
+
for (const [a, n] of Object.entries(e)) {
|
|
102
|
+
const c = a.toLowerCase();
|
|
103
|
+
if (E.has(c) || i.some((o) => c.includes(o.toLowerCase()))) {
|
|
104
|
+
t[a] = "[REDACTED]";
|
|
51
105
|
continue;
|
|
52
106
|
}
|
|
53
|
-
|
|
107
|
+
t[a] = p(n, r);
|
|
54
108
|
}
|
|
55
|
-
return
|
|
109
|
+
return t;
|
|
56
110
|
}
|
|
57
111
|
return e;
|
|
58
112
|
}
|
|
59
|
-
function
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
includeRawError: r = !1,
|
|
63
|
-
customErrorSanitizer: a,
|
|
64
|
-
additionalSensitiveFields: c = []
|
|
65
|
-
} = t;
|
|
66
|
-
if (a)
|
|
67
|
-
return a(e);
|
|
68
|
-
if (!n)
|
|
69
|
-
return r ? e : { ...e, raw: void 0 };
|
|
70
|
-
const u = e.fieldErrors.map((i) => ({
|
|
71
|
-
...i,
|
|
72
|
-
message: d(i.message),
|
|
73
|
-
metadata: i.metadata ? s(i.metadata, c) : void 0
|
|
74
|
-
}));
|
|
75
|
-
return {
|
|
113
|
+
function u(e, { enabled: r = !0, includeRawError: t = !1, additionalSensitiveFields: i = [] }) {
|
|
114
|
+
const a = t ? e.raw : void 0;
|
|
115
|
+
return r ? {
|
|
76
116
|
...e,
|
|
77
|
-
message:
|
|
78
|
-
fieldErrors:
|
|
79
|
-
|
|
80
|
-
|
|
117
|
+
message: s(e.message),
|
|
118
|
+
fieldErrors: e.fieldErrors.map((n) => ({
|
|
119
|
+
...n,
|
|
120
|
+
message: s(n.message),
|
|
121
|
+
metadata: n.metadata ? p(n.metadata, i) : void 0
|
|
122
|
+
})),
|
|
123
|
+
raw: a
|
|
124
|
+
} : { ...e, raw: a };
|
|
81
125
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
return r ? r(e) : n ? {
|
|
126
|
+
function m(e, { enabled: r = !0, additionalSensitiveFields: t = [] }) {
|
|
127
|
+
return r ? {
|
|
85
128
|
...e,
|
|
86
|
-
tags: e.tags ?
|
|
129
|
+
tags: e.tags ? p(e.tags, t) : void 0
|
|
87
130
|
} : e;
|
|
88
131
|
}
|
|
132
|
+
function l(e, r = {}) {
|
|
133
|
+
const t = u(e, r);
|
|
134
|
+
return r.customErrorSanitizer ? u(r.customErrorSanitizer(t), r) : t;
|
|
135
|
+
}
|
|
136
|
+
function b(e, r = {}) {
|
|
137
|
+
const t = m(e, r);
|
|
138
|
+
return r.customMetricSanitizer ? m(r.customMetricSanitizer(t), r) : t;
|
|
139
|
+
}
|
|
89
140
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
141
|
+
l as sanitizeError,
|
|
142
|
+
b as sanitizeMetric,
|
|
143
|
+
p as sanitizeObject,
|
|
144
|
+
s as sanitizeString
|
|
94
145
|
};
|
|
95
146
|
//# sourceMappingURL=sanitization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitization.js","sources":["../../../src/contexts/ObservabilityProvider/sanitization.ts"],"sourcesContent":["import type {\n ObservabilityError,\n ObservabilityMetric,\n SanitizationConfig,\n} from '@/types/observability'\n\nconst PII_PATTERNS = [\n { pattern: /\\b\\d{3}-\\d{2}-\\d{4}\\b/g, replacement: '[SSN-REDACTED]' },\n { pattern: /\\b\\d{9}\\b/g, replacement: '[SSN-REDACTED]' },\n {\n pattern: /\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b/g,\n replacement: '[EMAIL-REDACTED]',\n },\n { pattern: /\\b\\d{3}[-.\\s]?\\d{3}[-.\\s]?\\d{4}\\b/g, replacement: '[PHONE-REDACTED]' },\n { pattern: /\\(\\d{3}\\)\\s*\\d{3}[-.\\s]?\\d{4}/g, replacement: '[PHONE-REDACTED]' },\n { pattern: /\\b\\d{4}[-\\s]?\\d{4}[-\\s]?\\d{4}[-\\s]?\\d{4}\\b/g, replacement: '[CC-REDACTED]' },\n { pattern: /\\b[A-Za-z0-9_-]{32,}\\b/g, replacement: '[TOKEN-REDACTED]' },\n]\n\nconst SENSITIVE_FIELD_NAMES = [\n 'password',\n 'token',\n 'apiKey',\n 'api_key',\n 'secret',\n 'ssn',\n 'social_security_number',\n 'creditCard',\n 'credit_card',\n 'cvv',\n 'pin',\n 'bankAccount',\n 'bank_account',\n 'routingNumber',\n 'routing_number',\n 'accountNumber',\n 'account_number',\n]\n\n/**\n * Replaces PII patterns (SSN, email, phone, credit card, long tokens) in a string with redacted placeholders.\n *\n * @param value - The string to scan and redact.\n * @returns The input with each matched pattern replaced by a `[TYPE-REDACTED]` placeholder.\n * @internal\n */\nexport function sanitizeString(value: string): string {\n let sanitized = value\n\n for (const { pattern, replacement } of PII_PATTERNS) {\n sanitized = sanitized.replace(pattern, replacement)\n }\n\n return sanitized\n}\n\n/**\n * Recursively walks a value, redacting sensitive object keys and PII patterns in nested strings.\n *\n * @remarks\n * Keys whose names match (case-insensitively contain) any built-in sensitive field name or any\n * entry in `additionalSensitiveFields` have their values replaced with `[REDACTED]`. String\n * values are passed through {@link sanitizeString} so PII patterns inside them are also redacted.\n * Numbers, booleans, `null`, and `undefined` pass through unchanged.\n *\n * @param obj - The value to sanitize. May be any JSON-shaped structure.\n * @param additionalSensitiveFields - Extra field names to treat as sensitive (case-insensitive substring match).\n * @returns A new value of the same shape with sensitive fields and PII patterns redacted.\n * @internal\n */\nexport function sanitizeObject(obj: unknown, additionalSensitiveFields: string[] = []): unknown {\n if (obj === null || obj === undefined) {\n return obj\n }\n\n if (typeof obj === 'string') {\n return sanitizeString(obj)\n }\n\n if (typeof obj === 'number' || typeof obj === 'boolean') {\n return obj\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => sanitizeObject(item, additionalSensitiveFields))\n }\n\n if (typeof obj === 'object') {\n const sanitized: Record<string, unknown> = {}\n\n const allSensitiveFields = [...SENSITIVE_FIELD_NAMES, ...additionalSensitiveFields]\n\n for (const [key, value] of Object.entries(obj)) {\n if (allSensitiveFields.some(field => key.toLowerCase().includes(field.toLowerCase()))) {\n sanitized[key] = '[REDACTED]'\n continue\n }\n\n sanitized[key] = sanitizeObject(value, additionalSensitiveFields)\n }\n\n return sanitized\n }\n\n return obj\n}\n\n/**\n * Returns a copy of an observability error with PII redacted from messages and field-error metadata.\n *\n * @remarks\n * If `config.customErrorSanitizer` is provided, it is invoked and its result returned directly.\n * When sanitization is disabled, the error passes through unchanged except that `raw` is stripped\n * unless `includeRawError` is true. When enabled, `message` and each `fieldErrors[].message` run\n * through {@link sanitizeString}, and each `fieldErrors[].metadata` runs through {@link sanitizeObject}\n * with `additionalSensitiveFields` applied.\n *\n * @param error - The error reported by SDK error boundaries or form submissions.\n * @param config - Optional sanitization configuration; defaults to enabled with `raw` stripped.\n * @returns The sanitized error suitable for forwarding to a partner observability hook.\n * @internal\n */\nexport function sanitizeError(\n error: ObservabilityError,\n config: SanitizationConfig = {},\n): ObservabilityError {\n const {\n enabled = true,\n includeRawError = false,\n customErrorSanitizer,\n additionalSensitiveFields = [],\n } = config\n\n if (customErrorSanitizer) {\n return customErrorSanitizer(error)\n }\n\n if (!enabled) {\n return includeRawError ? error : { ...error, raw: undefined }\n }\n\n const sanitizedFieldErrors = error.fieldErrors.map(fe => ({\n ...fe,\n message: sanitizeString(fe.message),\n metadata: fe.metadata\n ? (sanitizeObject(fe.metadata, additionalSensitiveFields) as Record<string, unknown>)\n : undefined,\n }))\n\n return {\n ...error,\n message: sanitizeString(error.message),\n fieldErrors: sanitizedFieldErrors,\n raw: includeRawError ? error.raw : undefined,\n }\n}\n\n/**\n * Returns a copy of an observability metric with sensitive values redacted from its tags.\n *\n * @remarks\n * If `config.customMetricSanitizer` is provided, it is invoked and its result returned directly.\n * When sanitization is disabled, the metric passes through unchanged. Otherwise the `tags` record\n * is run through {@link sanitizeObject} with `additionalSensitiveFields` applied.\n *\n * @param metric - The metric reported by SDK component instrumentation.\n * @param config - Optional sanitization configuration; defaults to enabled.\n * @returns The sanitized metric suitable for forwarding to a partner observability hook.\n * @internal\n */\nexport function sanitizeMetric(\n metric: ObservabilityMetric,\n config: SanitizationConfig = {},\n): ObservabilityMetric {\n const { enabled = true, customMetricSanitizer, additionalSensitiveFields = [] } = config\n\n if (customMetricSanitizer) {\n return customMetricSanitizer(metric)\n }\n\n if (!enabled) {\n return metric\n }\n\n return {\n ...metric,\n tags: metric.tags\n ? (sanitizeObject(metric.tags, additionalSensitiveFields) as Record<string, string>)\n : undefined,\n }\n}\n"],"names":["PII_PATTERNS","SENSITIVE_FIELD_NAMES","sanitizeString","value","sanitized","pattern","replacement","sanitizeObject","obj","additionalSensitiveFields","item","allSensitiveFields","key","field","sanitizeError","error","config","enabled","includeRawError","customErrorSanitizer","sanitizedFieldErrors","fe","sanitizeMetric","metric","customMetricSanitizer"],"mappings":"AAMA,MAAMA,IAAe;AAAA,EACnB,EAAE,SAAS,0BAA0B,aAAa,iBAAA;AAAA,EAClD,EAAE,SAAS,cAAc,aAAa,iBAAA;AAAA,EACtC;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EAAA;AAAA,EAEf,EAAE,SAAS,sCAAsC,aAAa,mBAAA;AAAA,EAC9D,EAAE,SAAS,kCAAkC,aAAa,mBAAA;AAAA,EAC1D,EAAE,SAAS,+CAA+C,aAAa,gBAAA;AAAA,EACvE,EAAE,SAAS,2BAA2B,aAAa,mBAAA;AACrD,GAEMC,IAAwB;AAAA,EAC5B;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;AASO,SAASC,EAAeC,GAAuB;AACpD,MAAIC,IAAYD;AAEhB,aAAW,EAAE,SAAAE,GAAS,aAAAC,EAAA,KAAiBN;AACrC,IAAAI,IAAYA,EAAU,QAAQC,GAASC,CAAW;AAGpD,SAAOF;AACT;AAgBO,SAASG,EAAeC,GAAcC,IAAsC,IAAa;AAC9F,MAAID,KAAQ;AACV,WAAOA;AAGT,MAAI,OAAOA,KAAQ;AACjB,WAAON,EAAeM,CAAG;AAG3B,MAAI,OAAOA,KAAQ,YAAY,OAAOA,KAAQ;AAC5C,WAAOA;AAGT,MAAI,MAAM,QAAQA,CAAG;AACnB,WAAOA,EAAI,IAAI,CAAAE,MAAQH,EAAeG,GA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M,IAGhCN,IAIE;AAAA,IACL,GAAGM;AAAA,IACH,MAAMA,EAAO,OACRhB,EAAegB,EAAO,MAAMd,CAAyB,IACtD;AAAA,EAAA,IAPGc;AASX;"}
|
|
1
|
+
{"version":3,"file":"sanitization.js","sources":["../../../src/contexts/ObservabilityProvider/sanitization.ts"],"sourcesContent":["import type {\n ObservabilityError,\n ObservabilityMetric,\n SanitizationConfig,\n} from '@/types/observability'\n\nconst PII_PATTERNS = [\n { pattern: /\\b\\d{3}-\\d{2}-\\d{4}\\b/g, replacement: '[SSN-REDACTED]' },\n { pattern: /\\b\\d{9}\\b/g, replacement: '[SSN-REDACTED]' },\n {\n pattern: /\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b/g,\n replacement: '[EMAIL-REDACTED]',\n },\n { pattern: /\\b\\d{3}[-.\\s]?\\d{3}[-.\\s]?\\d{4}\\b/g, replacement: '[PHONE-REDACTED]' },\n { pattern: /\\(\\d{3}\\)\\s*\\d{3}[-.\\s]?\\d{4}/g, replacement: '[PHONE-REDACTED]' },\n { pattern: /\\b\\d{4}[-\\s]?\\d{4}[-\\s]?\\d{4}[-\\s]?\\d{4}\\b/g, replacement: '[CC-REDACTED]' },\n { pattern: /\\b[A-Za-z0-9_-]{32,}\\b/g, replacement: '[TOKEN-REDACTED]' },\n]\n\nconst SENSITIVE_FIELD_NAMES = [\n 'password',\n 'token',\n 'apiKey',\n 'api_key',\n 'secret',\n 'ssn',\n 'social_security_number',\n 'creditCard',\n 'credit_card',\n 'cvv',\n 'pin',\n 'bankAccount',\n 'bank_account',\n 'routingNumber',\n 'routing_number',\n 'accountNumber',\n 'account_number',\n 'dateOfBirth',\n 'date_of_birth',\n 'birthDate',\n 'birth_date',\n 'birthday',\n 'firstName',\n 'first_name',\n 'lastName',\n 'last_name',\n 'middleName',\n 'middle_name',\n 'fullName',\n 'full_name',\n 'employeeName',\n 'employee_name',\n 'signatureText',\n 'signature_text',\n 'retirementLoanIdentifier',\n 'retirement_loan_identifier',\n 'phone',\n 'zipCode',\n 'zip_code',\n 'postalCode',\n 'postal_code',\n 'preparerCity',\n 'preparer_city',\n 'preparerZip',\n 'preparer_zip',\n 'preparer2City',\n 'preparer2_city',\n 'preparer2Zip',\n 'preparer2_zip',\n 'preparer3City',\n 'preparer3_city',\n 'preparer3Zip',\n 'preparer3_zip',\n 'preparer4City',\n 'preparer4_city',\n 'preparer4Zip',\n 'preparer4_zip',\n 'address',\n 'street1',\n 'street_1',\n 'street2',\n 'street_2',\n 'caseNumber',\n 'case_number',\n 'orderNumber',\n 'order_number',\n 'remittanceNumber',\n 'remittance_number',\n 'documentNumber',\n 'document_number',\n]\n\nconst EXACT_SENSITIVE_FIELD_NAMES = new Set(['ein', 'dob', 'zip', 'city'])\n\n/**\n * Replaces PII patterns (SSN, email, phone, credit card, long tokens) in a string with redacted placeholders.\n *\n * @param value - The string to scan and redact.\n * @returns The input with each matched pattern replaced by a `[TYPE-REDACTED]` placeholder.\n * @internal\n */\nexport function sanitizeString(value: string): string {\n let sanitized = value\n\n for (const { pattern, replacement } of PII_PATTERNS) {\n sanitized = sanitized.replace(pattern, replacement)\n }\n\n return sanitized\n}\n\n/**\n * Recursively walks a value, redacting sensitive object keys and PII patterns in nested strings.\n *\n * @remarks\n * Keys whose names match (case-insensitively contain) any built-in sensitive field name or any\n * entry in `additionalSensitiveFields` have their values replaced with `[REDACTED]`. Short names\n * (`ein`, `dob`, `zip`, `city`) match the whole key, case-insensitively. String\n * values are passed through {@link sanitizeString} so PII patterns inside them are also redacted.\n * Numbers, booleans, `null`, and `undefined` pass through unchanged.\n *\n * @param obj - The value to sanitize. May be any JSON-shaped structure.\n * @param additionalSensitiveFields - Extra field names to treat as sensitive (case-insensitive substring match).\n * @returns A new value of the same shape with sensitive fields and PII patterns redacted.\n * @internal\n */\nexport function sanitizeObject(obj: unknown, additionalSensitiveFields: string[] = []): unknown {\n if (obj === null || obj === undefined) {\n return obj\n }\n\n if (typeof obj === 'string') {\n return sanitizeString(obj)\n }\n\n if (typeof obj === 'number' || typeof obj === 'boolean') {\n return obj\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => sanitizeObject(item, additionalSensitiveFields))\n }\n\n if (typeof obj === 'object') {\n const sanitized: Record<string, unknown> = {}\n\n const allSensitiveFields = [...SENSITIVE_FIELD_NAMES, ...additionalSensitiveFields]\n\n for (const [key, value] of Object.entries(obj)) {\n const lowerKey = key.toLowerCase()\n if (\n EXACT_SENSITIVE_FIELD_NAMES.has(lowerKey) ||\n allSensitiveFields.some(field => lowerKey.includes(field.toLowerCase()))\n ) {\n sanitized[key] = '[REDACTED]'\n continue\n }\n\n sanitized[key] = sanitizeObject(value, additionalSensitiveFields)\n }\n\n return sanitized\n }\n\n return obj\n}\n\nfunction redactError(\n error: ObservabilityError,\n { enabled = true, includeRawError = false, additionalSensitiveFields = [] }: SanitizationConfig,\n): ObservabilityError {\n const raw = includeRawError ? error.raw : undefined\n\n if (!enabled) {\n return { ...error, raw }\n }\n\n return {\n ...error,\n message: sanitizeString(error.message),\n fieldErrors: error.fieldErrors.map(fieldError => ({\n ...fieldError,\n message: sanitizeString(fieldError.message),\n metadata: fieldError.metadata\n ? (sanitizeObject(fieldError.metadata, additionalSensitiveFields) as Record<\n string,\n unknown\n >)\n : undefined,\n })),\n raw,\n }\n}\n\nfunction redactMetric(\n metric: ObservabilityMetric,\n { enabled = true, additionalSensitiveFields = [] }: SanitizationConfig,\n): ObservabilityMetric {\n if (!enabled) {\n return metric\n }\n\n return {\n ...metric,\n tags: metric.tags\n ? (sanitizeObject(metric.tags, additionalSensitiveFields) as Record<string, string>)\n : undefined,\n }\n}\n\n/**\n * Redacts error messages and field-error metadata before and after a custom sanitizer runs.\n *\n * @remarks\n * `enabled: false` skips redaction. Independently, `raw` is excluded before and after the\n * custom sanitizer unless `includeRawError: true`. Opted-in `raw` is passed through unchanged.\n * Other error properties are preserved without redaction.\n *\n * @internal\n */\nexport function sanitizeError(\n error: ObservabilityError,\n config: SanitizationConfig = {},\n): ObservabilityError {\n const sanitized = redactError(error, config)\n return config.customErrorSanitizer\n ? redactError(config.customErrorSanitizer(sanitized), config)\n : sanitized\n}\n\n/**\n * Redacts metric tags before and after a custom sanitizer runs, unless `enabled: false`.\n *\n * @remarks\n * Other metric properties are preserved without redaction.\n *\n * @internal\n */\nexport function sanitizeMetric(\n metric: ObservabilityMetric,\n config: SanitizationConfig = {},\n): ObservabilityMetric {\n const sanitized = redactMetric(metric, config)\n return config.customMetricSanitizer\n ? redactMetric(config.customMetricSanitizer(sanitized), config)\n : sanitized\n}\n"],"names":["PII_PATTERNS","SENSITIVE_FIELD_NAMES","EXACT_SENSITIVE_FIELD_NAMES","sanitizeString","value","sanitized","pattern","replacement","sanitizeObject","obj","additionalSensitiveFields","item","allSensitiveFields","key","lowerKey","field","redactError","error","enabled","includeRawError","raw","fieldError","redactMetric","metric","sanitizeError","config","sanitizeMetric"],"mappings":"AAMA,MAAMA,IAAe;AAAA,EACnB,EAAE,SAAS,0BAA0B,aAAa,iBAAA;AAAA,EAClD,EAAE,SAAS,cAAc,aAAa,iBAAA;AAAA,EACtC;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,EAAA;AAAA,EAEf,EAAE,SAAS,sCAAsC,aAAa,mBAAA;AAAA,EAC9D,EAAE,SAAS,kCAAkC,aAAa,mBAAA;AAAA,EAC1D,EAAE,SAAS,+CAA+C,aAAa,gBAAA;AAAA,EACvE,EAAE,SAAS,2BAA2B,aAAa,mBAAA;AACrD,GAEMC,IAAwB;AAAA,EAC5B;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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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BpB,CAAS,GAAGoB,CAAM,IAC5DpB;AACN;"}
|
package/dist/package.json.js
CHANGED
|
@@ -12,7 +12,8 @@ export declare function sanitizeString(value: string): string;
|
|
|
12
12
|
*
|
|
13
13
|
* @remarks
|
|
14
14
|
* Keys whose names match (case-insensitively contain) any built-in sensitive field name or any
|
|
15
|
-
* entry in `additionalSensitiveFields` have their values replaced with `[REDACTED]`.
|
|
15
|
+
* entry in `additionalSensitiveFields` have their values replaced with `[REDACTED]`. Short names
|
|
16
|
+
* (`ein`, `dob`, `zip`, `city`) match the whole key, case-insensitively. String
|
|
16
17
|
* values are passed through {@link sanitizeString} so PII patterns inside them are also redacted.
|
|
17
18
|
* Numbers, booleans, `null`, and `undefined` pass through unchanged.
|
|
18
19
|
*
|
|
@@ -23,32 +24,22 @@ export declare function sanitizeString(value: string): string;
|
|
|
23
24
|
*/
|
|
24
25
|
export declare function sanitizeObject(obj: unknown, additionalSensitiveFields?: string[]): unknown;
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
+
* Redacts error messages and field-error metadata before and after a custom sanitizer runs.
|
|
27
28
|
*
|
|
28
29
|
* @remarks
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* through {@link sanitizeString}, and each `fieldErrors[].metadata` runs through {@link sanitizeObject}
|
|
33
|
-
* with `additionalSensitiveFields` applied.
|
|
30
|
+
* `enabled: false` skips redaction. Independently, `raw` is excluded before and after the
|
|
31
|
+
* custom sanitizer unless `includeRawError: true`. Opted-in `raw` is passed through unchanged.
|
|
32
|
+
* Other error properties are preserved without redaction.
|
|
34
33
|
*
|
|
35
|
-
* @param error - The error reported by SDK error boundaries or form submissions.
|
|
36
|
-
* @param config - Optional sanitization configuration; defaults to enabled with `raw` stripped.
|
|
37
|
-
* @returns The sanitized error suitable for forwarding to a partner observability hook.
|
|
38
34
|
* @internal
|
|
39
35
|
*/
|
|
40
36
|
export declare function sanitizeError(error: ObservabilityError, config?: SanitizationConfig): ObservabilityError;
|
|
41
37
|
/**
|
|
42
|
-
*
|
|
38
|
+
* Redacts metric tags before and after a custom sanitizer runs, unless `enabled: false`.
|
|
43
39
|
*
|
|
44
40
|
* @remarks
|
|
45
|
-
*
|
|
46
|
-
* When sanitization is disabled, the metric passes through unchanged. Otherwise the `tags` record
|
|
47
|
-
* is run through {@link sanitizeObject} with `additionalSensitiveFields` applied.
|
|
41
|
+
* Other metric properties are preserved without redaction.
|
|
48
42
|
*
|
|
49
|
-
* @param metric - The metric reported by SDK component instrumentation.
|
|
50
|
-
* @param config - Optional sanitization configuration; defaults to enabled.
|
|
51
|
-
* @returns The sanitized metric suitable for forwarding to a partner observability hook.
|
|
52
43
|
* @internal
|
|
53
44
|
*/
|
|
54
45
|
export declare function sanitizeMetric(metric: ObservabilityMetric, config?: SanitizationConfig): ObservabilityMetric;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -47,37 +47,76 @@ export interface ObservabilityMetric {
|
|
|
47
47
|
timestamp: number;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Configures redaction and raw-error inclusion for observability callbacks.
|
|
51
51
|
*
|
|
52
52
|
* @remarks
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* names
|
|
57
|
-
*
|
|
53
|
+
* By default, the SDK redacts recognized string patterns in error `message` and
|
|
54
|
+
* `fieldErrors[].message`, and recursively redacts sensitive keys and recognized string
|
|
55
|
+
* patterns in `fieldErrors[].metadata` and metric `tags`. Sensitive keys include credentials,
|
|
56
|
+
* financial identifiers, personal names, birth dates, addresses, and document identifiers.
|
|
57
|
+
* Values are replaced with placeholders; keys are retained. Other properties are not redacted.
|
|
58
|
+
*
|
|
59
|
+
* Pattern and key matching do not detect every sensitive value. Free-text names and addresses,
|
|
60
|
+
* for example, may remain in messages. Select which fields to forward in your callbacks and
|
|
61
|
+
* use additional sensitive keys or custom sanitizers for further processing.
|
|
62
|
+
*
|
|
63
|
+
* Processing order is SDK redaction/raw exclusion, custom sanitizer, SDK redaction/raw
|
|
64
|
+
* exclusion again, then the observability callback. Custom functions receive processed input
|
|
65
|
+
* and their output follows the same configuration. `enabled` controls redaction independently
|
|
66
|
+
* of `includeRawError`; opted-in raw errors pass through without redaction.
|
|
67
|
+
*
|
|
68
|
+
* This configuration applies only to observability callbacks. It does not sanitize form-hook
|
|
69
|
+
* errors, component events, request hooks, or data added by your monitoring integration.
|
|
58
70
|
*
|
|
59
71
|
* @public
|
|
60
72
|
*/
|
|
61
73
|
export interface SanitizationConfig {
|
|
62
74
|
/**
|
|
63
|
-
* Whether to
|
|
75
|
+
* Whether to redact recognized sensitive values in messages, field-error metadata, and
|
|
76
|
+
* metric tags. Default: true.
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* When `false`, built-in and additional-sensitive-key redaction is skipped before and after
|
|
80
|
+
* custom sanitizers. Custom sanitizers still run. Raw errors remain excluded unless
|
|
81
|
+
* `includeRawError` is `true`.
|
|
64
82
|
*/
|
|
65
83
|
enabled?: boolean;
|
|
66
84
|
/**
|
|
67
|
-
* Whether to include the
|
|
68
|
-
*
|
|
85
|
+
* Whether to include the original error as `raw` in observability errors. Default: false.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* When `false`, `raw` is set to `undefined` before and after a custom error sanitizer,
|
|
89
|
+
* regardless of `enabled`. When `true`, `raw` passes through without redaction and can
|
|
90
|
+
* contain form inputs, API response bodies, and request headers, including credentials.
|
|
69
91
|
*/
|
|
70
92
|
includeRawError?: boolean;
|
|
71
93
|
/**
|
|
72
|
-
*
|
|
94
|
+
* Transforms an error between applications of the configured SDK processing.
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* Receives an error after configured redaction and raw exclusion. The SDK processes the
|
|
98
|
+
* returned `message`, `fieldErrors[].message`, `fieldErrors[].metadata`, and `raw` again
|
|
99
|
+
* according to `enabled`, `includeRawError`, and `additionalSensitiveFields`. Other properties
|
|
100
|
+
* are preserved without redaction. Return an error of the same type; messages may be replaced
|
|
101
|
+
* and metadata omitted for additional control over emitted data.
|
|
73
102
|
*/
|
|
74
103
|
customErrorSanitizer?: (error: ObservabilityError) => ObservabilityError;
|
|
75
104
|
/**
|
|
76
|
-
*
|
|
105
|
+
* Transforms a metric between applications of the configured SDK redaction.
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* Receives a metric after configured tag redaction. Returned `tags` are redacted again,
|
|
109
|
+
* including keys added by your function. Both passes honor `enabled` and
|
|
110
|
+
* `additionalSensitiveFields`. Other properties are preserved without redaction.
|
|
77
111
|
*/
|
|
78
112
|
customMetricSanitizer?: (metric: ObservabilityMetric) => ObservabilityMetric;
|
|
79
113
|
/**
|
|
80
|
-
* Additional
|
|
114
|
+
* Additional sensitive keys in field-error metadata and metric tags.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* Uses case-insensitive substring matching in nested objects and arrays, before and after
|
|
118
|
+
* custom sanitizers when redaction is enabled. Matching values are replaced with `[REDACTED]`.
|
|
119
|
+
* Does not match field-error paths, message text, or properties outside metadata and tags.
|
|
81
120
|
*/
|
|
82
121
|
additionalSensitiveFields?: string[];
|
|
83
122
|
}
|
|
@@ -87,8 +126,10 @@ export interface SanitizationConfig {
|
|
|
87
126
|
* @remarks
|
|
88
127
|
* Pass an instance to {@link GustoProvider} via `config.observability` to forward
|
|
89
128
|
* errors to services like Sentry or Datadog and to capture performance metrics
|
|
90
|
-
* for form submissions and component loading.
|
|
91
|
-
*
|
|
129
|
+
* for form submissions and component loading. Recognized sensitive values are redacted and
|
|
130
|
+
* raw errors excluded by default before callbacks run; see {@link SanitizationConfig}.
|
|
131
|
+
* Select which payload fields to forward. This processing does not detect every PII value
|
|
132
|
+
* or cover data independently collected by your monitoring tool.
|
|
92
133
|
*
|
|
93
134
|
* @public
|
|
94
135
|
* @group Observability
|
|
@@ -96,11 +137,11 @@ export interface SanitizationConfig {
|
|
|
96
137
|
* @example
|
|
97
138
|
* ```tsx
|
|
98
139
|
* import * as Sentry from '@sentry/react'
|
|
99
|
-
* import {
|
|
140
|
+
* import type { ObservabilityHook } from '@gusto/embedded-react-sdk'
|
|
100
141
|
*
|
|
101
|
-
* const observability: ObservabilityHook = {
|
|
142
|
+
* export const observability: ObservabilityHook = {
|
|
102
143
|
* onError: error => {
|
|
103
|
-
* Sentry.captureException(
|
|
144
|
+
* Sentry.captureException(new Error(error.message), {
|
|
104
145
|
* level: error.category === 'validation_error' ? 'warning' : 'error',
|
|
105
146
|
* tags: {
|
|
106
147
|
* error_category: error.category,
|
|
@@ -114,9 +155,7 @@ export interface SanitizationConfig {
|
|
|
114
155
|
* },
|
|
115
156
|
* }
|
|
116
157
|
*
|
|
117
|
-
*
|
|
118
|
-
* <YourApp />
|
|
119
|
-
* </GustoProvider>
|
|
158
|
+
* // Pass observability to GustoProvider through config.observability.
|
|
120
159
|
* ```
|
|
121
160
|
*/
|
|
122
161
|
export interface ObservabilityHook {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gusto/embedded-react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"homepage": "https://github.com/Gusto/embedded-react-sdk",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/Gusto/embedded-react-sdk/issues"
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"@microsoft/api-extractor": "^7.59.1",
|
|
103
103
|
"@playwright/test": "^1.64.0",
|
|
104
104
|
"@release-it/conventional-changelog": "^12.0.2",
|
|
105
|
-
"@storybook/addon-a11y": "^10.6.
|
|
105
|
+
"@storybook/addon-a11y": "^10.6.1",
|
|
106
106
|
"@storybook/addon-docs": "^10.6.0",
|
|
107
107
|
"@storybook/addon-onboarding": "^10.6.1",
|
|
108
108
|
"@storybook/react-vite": "^10.6.0",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"@vitejs/plugin-react-swc": "^4.3.3",
|
|
124
124
|
"@vitest/coverage-v8": "^5.0.0",
|
|
125
125
|
"ajv": "^8.20.0",
|
|
126
|
-
"axe-core": "^4.
|
|
126
|
+
"axe-core": "^4.14.0",
|
|
127
127
|
"cspell": "^10.3.6",
|
|
128
128
|
"dotenv": "^18.0.3",
|
|
129
129
|
"eslint": "^9.39.5",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"json-schema-to-typescript": "^16.0.0",
|
|
144
144
|
"lint-staged": "^17.5.1",
|
|
145
145
|
"markdownlint-cli2": "^0.23.3",
|
|
146
|
-
"msw": "^
|
|
146
|
+
"msw": "^3.0.3",
|
|
147
147
|
"npm-run-all": "^4.1.5",
|
|
148
148
|
"pixelmatch": "^7.2.0",
|
|
149
149
|
"pngjs": "^7.0.0",
|
|
@@ -159,10 +159,10 @@
|
|
|
159
159
|
"ts-morph": "^28.0.0",
|
|
160
160
|
"tsx": "^4.23.15",
|
|
161
161
|
"typescript-eslint": "^8.70.1",
|
|
162
|
-
"vite": "^6.4.
|
|
162
|
+
"vite": "^6.4.4",
|
|
163
163
|
"vite-plugin-checker": "^0.14.5",
|
|
164
164
|
"vite-plugin-circular-dependency": "^0.6.0",
|
|
165
|
-
"vite-plugin-dts": "^5.1.
|
|
165
|
+
"vite-plugin-dts": "^5.1.2",
|
|
166
166
|
"vite-plugin-externalize-deps": "^0.10.0",
|
|
167
167
|
"vite-plugin-stylelint": "^6.3.0",
|
|
168
168
|
"vite-plugin-svgr": "^5.2.0",
|