leadconduit-trustedform 2.4.0 → 2.4.2
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
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org)
|
|
4
4
|
|
|
5
|
+
## [2.4.1] - 2024-08-12
|
|
6
|
+
### Added
|
|
7
|
+
- added "|" to be the default scan delimiter for TF version 4
|
|
8
|
+
|
|
5
9
|
## [2.4.0] - 2024-04-10
|
|
6
10
|
### Added
|
|
7
11
|
- v4 integration now supports optional api key mapping
|
package/lib/trustedform.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { get } = require('lodash');
|
|
1
2
|
const helpers = require('./helpers');
|
|
2
3
|
const { compact, pickBy, isUndefined } = require('lodash');
|
|
3
4
|
|
|
@@ -24,7 +25,7 @@ const request = (vars) => {
|
|
|
24
25
|
body.insights.scans = {
|
|
25
26
|
required: trustedform.scan_required_text,
|
|
26
27
|
forbidden: trustedform.scan_forbidden_text,
|
|
27
|
-
delimiter: trustedform
|
|
28
|
+
delimiter: get(trustedform, 'scan_delimiter', '|'),
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
}
|
|
@@ -124,13 +125,22 @@ const insightsEnabled = (vars) => vars.trustedform?.insights?.valueOf();
|
|
|
124
125
|
const verifyEnabled = (vars) => vars.trustedform?.verify?.valueOf();
|
|
125
126
|
const hasRequiredRetainProps = (vars) => !!(vars.lead.email || vars.lead.phone_1);
|
|
126
127
|
const hasAtLeastOneInsightsProp = (vars) => formatProperties(vars.insights).length > 0 || vars.insights?.page_scan?.valueOf();
|
|
127
|
-
|
|
128
|
+
const hasVerifyData = (data) => {
|
|
129
|
+
return data.verify?.languages || data.verify?.result?.language_approved || data.verify?.result?.success;
|
|
130
|
+
};
|
|
128
131
|
|
|
129
132
|
const response = (vars, req, res) => {
|
|
130
133
|
if (res.status < 500) {
|
|
131
134
|
try {
|
|
132
135
|
const parsed = JSON.parse(res.body);
|
|
133
136
|
if (res.status === 200) {
|
|
137
|
+
const verify = hasVerifyData(parsed) ?
|
|
138
|
+
{
|
|
139
|
+
languages: parsed.verify.languages.map(lang => lang.text),
|
|
140
|
+
language_approved: parsed.verify.result.language_approved,
|
|
141
|
+
success: parsed.verify.result.success
|
|
142
|
+
} : undefined;
|
|
143
|
+
|
|
134
144
|
const appended = pickBy({
|
|
135
145
|
outcome: parsed.outcome,
|
|
136
146
|
reason: parsed.reason,
|
|
@@ -178,10 +188,7 @@ const response = (vars, req, res) => {
|
|
|
178
188
|
os_name: parsed.insights?.properties?.os?.name,
|
|
179
189
|
page_url: parsed.insights?.properties?.page_url,
|
|
180
190
|
parent_page_url: parsed.insights?.properties?.parent_page_url,
|
|
181
|
-
|
|
182
|
-
languages: parsed.insights?.properties?.languages,
|
|
183
|
-
language_approved: parsed.insights?.properties?.language_approved,
|
|
184
|
-
success: parsed.verify?.result?.success,
|
|
191
|
+
verify
|
|
185
192
|
}, (v) => { return !isUndefined(v); });
|
|
186
193
|
// only include this property if page scan was selected
|
|
187
194
|
if (vars.insights?.page_scan?.valueOf()) {
|
|
@@ -256,7 +263,7 @@ response.variables = () => [
|
|
|
256
263
|
{ name: 'page_url', type: 'string', description: 'The URL of the page hosting TrustedForm Certify.' },
|
|
257
264
|
{ name: 'parent_page_url', type: 'string', description: 'The parent URL of the page hosting TrustedForm Certify, if framed.' },
|
|
258
265
|
{ name: 'verify.languages', type: 'array', description: 'A list of the consent languages detected within the certificate' },
|
|
259
|
-
{ name: 'verify.language_approved', type: '
|
|
266
|
+
{ name: 'verify.language_approved', type: 'boolean', description: 'A boolean indicating if any of the consent languages found have been approved in your account\'s consent language manager.' },
|
|
260
267
|
{ name: 'verify.success', type: 'boolean', description: 'A boolean indicating if any of the consent languages found meet the success criteria defined for your account.' },
|
|
261
268
|
];
|
|
262
269
|
|