leadconduit-trustedform 2.4.8 → 2.5.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 CHANGED
@@ -2,11 +2,32 @@
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.3] - 2025-01-08
5
+ ## [2.5.0] - 2025-04-08
6
+ ### Added
7
+ - v4 now includes CPL token when present ([sc-87918](https://app.shortcut.com/active-prospect/story/87918/send-cpl-data-to-trustedform))
8
+
9
+ ## [2.4.8] - 2025-03-25
10
+ ### Added
11
+ - v4 Insights now supports `bot_detected` field
12
+ - v4 Verify now appends `min_font_size_px_satisfied` and `min_contrast_ratio_satisfied`
13
+
14
+ ## [2.4.7] - 2025-03-06
15
+ ### Added
16
+ - RUI now supports being re-opened
17
+
18
+ ## [2.4.4] - 2025-01-08
6
19
  ### Fixed
7
20
  - 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
21
  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
22
 
23
+ ## [2.4.3] - 2024-09-26
24
+ ### Added
25
+ - v4 now supports Advertiser Name mapping and appends `one_to_one`
26
+
27
+ ## [2.4.2] - 2024-09-17
28
+ ### Fixed
29
+ - fixed an issue with appended Verify fields
30
+
10
31
  ## [2.4.1] - 2024-08-12
11
32
  ### Added
12
33
  - added "|" to be the default scan delimiter for TF version 4
@@ -4,6 +4,7 @@ const { compact, get, pickBy, isUndefined } = require('lodash');
4
4
  const request = (vars) => {
5
5
  const { lead, trustedform, insights } = vars;
6
6
  const body = {};
7
+ vars.cplToken = vars.cplToken || process.env.TRUSTEDFORM_CPL_TOKEN;
7
8
 
8
9
  if (trustedform.retain.valueOf() && (lead.email || lead.phone_1)) {
9
10
  body.match_lead = {
@@ -34,16 +35,29 @@ const request = (vars) => {
34
35
  body.verify = pickBy({ advertiser_name: advertiserName }, (v) => { return !isUndefined(v); });
35
36
  }
36
37
 
37
- return {
38
+ const headers = {
39
+ 'Content-Type': 'application/json',
40
+ 'api-version': '4.0',
41
+ Authorization: `Basic ${Buffer.from(`X:${trustedform.api_key || vars.activeprospect.api_key}`).toString('base64')}`
42
+ };
43
+
44
+ if(vars.cplToken) {
45
+ headers['CPL-Token'] = vars.cplToken;
46
+ }
47
+
48
+ const req = {
38
49
  method: 'POST',
39
50
  url: lead.trustedform_cert_url.toString(),
40
51
  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
- }
52
+ headers
46
53
  };
54
+
55
+ if(vars.cplToken) {
56
+ // mask CPL Token
57
+ vars.cplToken = Array(vars.cplToken.length + 1).join('*');
58
+ }
59
+
60
+ return req;
47
61
  };
48
62
 
49
63
  const formatProperties = (insights) => {
@@ -130,7 +144,7 @@ const verifyEnabled = (vars) => vars.trustedform?.verify?.valueOf();
130
144
  const hasRequiredRetainProps = (vars) => !!(vars.lead.email || vars.lead.phone_1);
131
145
  const hasAtLeastOneInsightsProp = (vars) => formatProperties(vars.insights).length > 0 || vars.insights?.page_scan?.valueOf();
132
146
  const hasVerifyData = (data) => {
133
- return data.verify?.languages
147
+ return data.verify?.languages
134
148
  || data.verify?.result;
135
149
  };
136
150
 
@@ -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.env.NODE_ENV] || trustedFormUrl['development'];
13
+ const url = trustedFormUrl[process?.env.NODE_ENV] || trustedFormUrl['development'];
14
14
 
15
15
  const options = {
16
16
  url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leadconduit-trustedform",
3
- "version": "2.4.8",
3
+ "version": "2.5.0",
4
4
  "description": "LeadConduit integration with TrustedForm",
5
5
  "main": "index.js",
6
6
  "scripts": {