leadconduit-trustedform 2.2.1 → 2.3.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/lib/helpers.js CHANGED
@@ -88,8 +88,7 @@ const validate = (vars) => {
88
88
  if (!certUrl) return 'TrustedForm cert URL must not be blank';
89
89
  const productionValid = (tfRegex.test(getUrlString(certUrl)) || tfFacebookRegex.test(getUrlString(certUrl)));
90
90
  const developmentValid = (process.env.NODE_ENV === 'development' && (tfDevelopmentRegex.test(getUrlString(certUrl)) || tfDevelopmentFacebook.test(getUrlString(certUrl))));
91
- const stagingValid = (process.env.NODE_ENV === 'staging' && (tfStagingRegex.test(getUrlString(certUrl)) || tfStagingFacebook.test(getUrlString(certUrl))));
92
-
91
+ const stagingValid = (!['production', 'development'].includes(process.env.NODE_ENV) && (tfStagingRegex.test(getUrlString(certUrl)) || tfStagingFacebook.test(getUrlString(certUrl))));
93
92
  if (!productionValid && !stagingValid && !developmentValid) return 'TrustedForm cert URL must be valid';
94
93
  };
95
94
 
@@ -102,6 +101,7 @@ const getLeadConduitUrl = (env = process.env.NODE_ENV) => {
102
101
  case 'localhost': return 'http://leadconduit.localhost';
103
102
  case 'development': return 'https://app.leadconduit-development.com';
104
103
  case 'staging': return 'https://app.leadconduit-staging.com';
104
+ case 'test': return 'https://app.leadconduit-staging.com';
105
105
  case 'production': return 'https://app.leadconduit.com';
106
106
  default: return 'https://app.leadconduit.com';
107
107
  }
@@ -28,7 +28,7 @@ const request = (vars) => {
28
28
  };
29
29
  }
30
30
  }
31
- if (trustedform.verify.valueOf()) {
31
+ if (trustedform.verify?.valueOf()) {
32
32
  body.verify = {};
33
33
  }
34
34
 
@@ -171,10 +171,10 @@ const response = (vars, req, res) => {
171
171
  os_name: parsed.insights?.properties?.os?.name,
172
172
  page_url: parsed.insights?.properties?.page_url,
173
173
  parent_page_url: parsed.insights?.properties?.parent_page_url,
174
-
174
+
175
175
  languages: parsed.insights?.properties?.languages,
176
176
  language_approved: parsed.insights?.properties?.language_approved,
177
- success: parsed.verify?.results?.success,
177
+ success: parsed.verify?.result?.success,
178
178
  }, (v) => { return !isUndefined(v); });
179
179
  } else {
180
180
  return {
@@ -8,6 +8,7 @@ module.exports = (req, res) => {
8
8
  const trustedFormUrl = {
9
9
  'production': 'https://app.trustedform.com/account',
10
10
  'staging': 'https://app.staging.trustedform.com/account',
11
+ 'test': 'https://app.staging.trustedform.com/account',
11
12
  'development': 'https://app.trustedform-dev.com/account',
12
13
  };
13
14
  const environment = get(process, 'env.NODE_ENV') || 'development';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leadconduit-trustedform",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "LeadConduit integration with TrustedForm",
5
5
  "main": "index.js",
6
6
  "scripts": {