leadconduit-trustedform 2.4.8 → 2.6.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 +26 -1
- package/lib/trustedform.js +25 -8
- package/lib/ui/api/account.js +1 -1
- package/lib/ui/public/dist/index.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,36 @@
|
|
|
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.
|
|
5
|
+
## [2.6.0] - 2025-05-05
|
|
6
|
+
### Added
|
|
7
|
+
- v4 Verify now appends `opt_in_type`, based on `opt_in_types_satisfied` ([sc-90678](https://app.shortcut.com/active-prospect/story/90678/trustedform-v4-verify-include-opt-in-types-satisfied-as-an-appended-field))
|
|
8
|
+
|
|
9
|
+
## [2.5.0] - 2025-04-08
|
|
10
|
+
### Added
|
|
11
|
+
- v4 now includes CPL token when present ([sc-87918](https://app.shortcut.com/active-prospect/story/87918/send-cpl-data-to-trustedform))
|
|
12
|
+
|
|
13
|
+
## [2.4.8] - 2025-03-25
|
|
14
|
+
### Added
|
|
15
|
+
- v4 Insights now supports `bot_detected` field
|
|
16
|
+
- v4 Verify now appends `min_font_size_px_satisfied` and `min_contrast_ratio_satisfied`
|
|
17
|
+
|
|
18
|
+
## [2.4.7] - 2025-03-06
|
|
19
|
+
### Added
|
|
20
|
+
- RUI now supports being re-opened
|
|
21
|
+
|
|
22
|
+
## [2.4.4] - 2025-01-08
|
|
6
23
|
### Fixed
|
|
7
24
|
- v4 now appends `share_url` ([sc-84484](https://app.shortcut.com/active-prospect/story/84484/trustedform-v4-retain-include-trustedform-share-url-as-an-appended-field))
|
|
8
25
|
and `verify.form_submitted` ([sc-84576](https://app.shortcut.com/active-prospect/story/84576/trustedform-v4-verify-include-form-submitted-as-an-appended-field))
|
|
9
26
|
|
|
27
|
+
## [2.4.3] - 2024-09-26
|
|
28
|
+
### Added
|
|
29
|
+
- v4 now supports Advertiser Name mapping and appends `one_to_one`
|
|
30
|
+
|
|
31
|
+
## [2.4.2] - 2024-09-17
|
|
32
|
+
### Fixed
|
|
33
|
+
- fixed an issue with appended Verify fields
|
|
34
|
+
|
|
10
35
|
## [2.4.1] - 2024-08-12
|
|
11
36
|
### Added
|
|
12
37
|
- added "|" to be the default scan delimiter for TF version 4
|
package/lib/trustedform.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
const helpers = require('./helpers');
|
|
2
2
|
const { compact, get, pickBy, isUndefined } = require('lodash');
|
|
3
3
|
|
|
4
|
+
/* eslint-disable-next-line complexity */
|
|
4
5
|
const request = (vars) => {
|
|
5
6
|
const { lead, trustedform, insights } = vars;
|
|
6
7
|
const body = {};
|
|
8
|
+
vars.cplToken = vars.cplToken || process.env.TRUSTEDFORM_CPL_TOKEN;
|
|
7
9
|
|
|
8
10
|
if (trustedform.retain.valueOf() && (lead.email || lead.phone_1)) {
|
|
9
11
|
body.match_lead = {
|
|
@@ -34,16 +36,29 @@ const request = (vars) => {
|
|
|
34
36
|
body.verify = pickBy({ advertiser_name: advertiserName }, (v) => { return !isUndefined(v); });
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
const headers = {
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
'api-version': '4.0',
|
|
42
|
+
Authorization: `Basic ${Buffer.from(`X:${trustedform.api_key || vars.activeprospect.api_key}`).toString('base64')}`
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
if(vars.cplToken) {
|
|
46
|
+
headers['CPL-Token'] = vars.cplToken;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const req = {
|
|
38
50
|
method: 'POST',
|
|
39
51
|
url: lead.trustedform_cert_url.toString(),
|
|
40
52
|
body: JSON.stringify(body),
|
|
41
|
-
headers
|
|
42
|
-
'Content-Type': 'application/json',
|
|
43
|
-
'api-version': '4.0',
|
|
44
|
-
Authorization: `Basic ${Buffer.from(`X:${trustedform.api_key || vars.activeprospect.api_key}`).toString('base64')}`
|
|
45
|
-
}
|
|
53
|
+
headers
|
|
46
54
|
};
|
|
55
|
+
|
|
56
|
+
if(vars.cplToken) {
|
|
57
|
+
// mask CPL Token
|
|
58
|
+
vars.cplToken = Array(vars.cplToken.length + 1).join('*');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return req;
|
|
47
62
|
};
|
|
48
63
|
|
|
49
64
|
const formatProperties = (insights) => {
|
|
@@ -130,7 +145,7 @@ const verifyEnabled = (vars) => vars.trustedform?.verify?.valueOf();
|
|
|
130
145
|
const hasRequiredRetainProps = (vars) => !!(vars.lead.email || vars.lead.phone_1);
|
|
131
146
|
const hasAtLeastOneInsightsProp = (vars) => formatProperties(vars.insights).length > 0 || vars.insights?.page_scan?.valueOf();
|
|
132
147
|
const hasVerifyData = (data) => {
|
|
133
|
-
return data.verify?.languages
|
|
148
|
+
return data.verify?.languages
|
|
134
149
|
|| data.verify?.result;
|
|
135
150
|
};
|
|
136
151
|
|
|
@@ -146,6 +161,7 @@ const response = (vars, req, res) => {
|
|
|
146
161
|
language_approved: parsed.verify.result?.language_approved,
|
|
147
162
|
font_size: parsed.verify.result?.min_font_size_px_satisfied,
|
|
148
163
|
contrast_ratio: parsed.verify.result?.min_contrast_ratio_satisfied,
|
|
164
|
+
opt_in_type: parsed.verify.result?.opt_in_types_satisfied,
|
|
149
165
|
// note that the Verify one_to_one value is handled separately
|
|
150
166
|
success: parsed.verify.result?.success,
|
|
151
167
|
}, (v) => !isUndefined(v))
|
|
@@ -283,7 +299,8 @@ response.variables = () => [
|
|
|
283
299
|
{ name: 'verify.form_submitted', type: 'boolean', description: 'A boolean indicating whether the form was successfully submitted by the consumer.' },
|
|
284
300
|
{ name: 'verify.success', type: 'boolean', description: 'A boolean indicating if any of the consent languages found meet the success criteria defined for your account.' },
|
|
285
301
|
{ name: 'verify.font_size', type: 'boolean', description: 'True when the consent language font size meets or exceeds the value configured in TrustedForm.' },
|
|
286
|
-
{ name: 'verify.contrast_ratio', type: 'boolean', description: 'True when the contrast ratio between the consent language text and background meets or exceeds the value configured in TrustedForm
|
|
302
|
+
{ name: 'verify.contrast_ratio', type: 'boolean', description: 'True when the contrast ratio between the consent language text and background meets or exceeds the value configured in TrustedForm' },
|
|
303
|
+
{ name: 'verify.opt_in_type', type: 'boolean', description: 'True when all opt-in types on the form match one or more of the values configured in TrustedForm' }
|
|
287
304
|
];
|
|
288
305
|
|
|
289
306
|
const editable = true;
|
package/lib/ui/api/account.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = (req, res) => {
|
|
|
10
10
|
'test': 'https://app.staging.trustedform.com/account',
|
|
11
11
|
'development': 'https://app.trustedform-dev.com/account',
|
|
12
12
|
};
|
|
13
|
-
const url = trustedFormUrl[process
|
|
13
|
+
const url = trustedFormUrl[process?.env.NODE_ENV] || trustedFormUrl['development'];
|
|
14
14
|
|
|
15
15
|
const options = {
|
|
16
16
|
url,
|