leadconduit-trustedform 2.3.0 → 2.3.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.
@@ -5,7 +5,7 @@ jobs:
5
5
  runs-on: ubuntu-latest
6
6
  strategy:
7
7
  matrix:
8
- node-version: [16.x, 18.x, latest]
8
+ node-version: [18.x, 20.x, latest]
9
9
  env:
10
10
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
11
11
  steps:
package/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
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.3.1] - 2024-01-10
6
+ ### Fixed
7
+ - v4 `validate` function will properly handle missing `insights` vars ([sc-65226](https://app.shortcut.com/active-prospect/story/65226/trustedform-v4-insights-add-on-with-no-field-mappings-errors-in-validation))
8
+
9
+ ## [2.3.0] - 2023-11-20
10
+ ### Fixed
11
+ - Re-add fixed TrustedForm v4 Verify Add-On ([#105](https://github.com/activeprospect/leadconduit-integration-trustedform/pull/105), [sc-63442](https://app.shortcut.com/active-prospect/story/63442/trustedform-v4-add-verify-to-add-on))
12
+
13
+ ## [2.2.2] - 2023-11-17
14
+ ### Fixed
15
+ - Revert [#102](https://github.com/activeprospect/leadconduit-integration-trustedform/pull/102)
16
+
17
+ ## [2.2.1] - 2023-11-17
18
+ ### Fixed
19
+ - Page scan variables are now typed as arrays ([#103](https://github.com/activeprospect/leadconduit-integration-trustedform/pull/103))
20
+
21
+ ## [2.2.0] - 2023-11-15
22
+ ### Added
23
+ - TrustedForm v4 Verify Add-On ([sc-63442](https://app.shortcut.com/active-prospect/story/63442/trustedform-v4-add-verify-to-add-on))
24
+
25
+ ## [2.1.1] - 2023-07-14
26
+ ### Fixed
27
+ - Updated "Age" and "Age in Seconds" description for TF Inisights and TF Consent + Insights ([sc-48650](https://app.shortcut.com/active-prospect/story/48650/incorrect-description-for-age-in-the-trustedform-enhancements))
28
+
29
+ ## [2.1.0] - 2023-06-20
30
+ ### Added
31
+ - TrustedForm v4 Integration ([sc-50245](https://app.shortcut.com/active-prospect/story/50245/trustedform-v4-new-integration-trustedform))
32
+
5
33
  ## [2.0.3] - 2023-02-21
6
34
  ### Fixed
7
35
  - `domain` data is now appended if returned as part of insights data
package/lib/claim.js CHANGED
@@ -34,6 +34,7 @@ const requestVariables = () => [
34
34
  { name: 'lead.phone_3', type: 'string', required: false, description: 'Lead phone 3 that will be fingerprinted, defaults to the lead\'s "Phone 3" field' }
35
35
  ];
36
36
 
37
+ // eslint-disable-next-line complexity
37
38
  const parseResponse = (res, body, vars) => {
38
39
  let appended = {};
39
40
  const event = body;
package/lib/consent.js CHANGED
@@ -64,6 +64,7 @@ const parseCertData = (cert) => {
64
64
  };
65
65
  };
66
66
 
67
+ // eslint-disable-next-line complexity
67
68
  const parseResponse = (statusCode, body, vars) => {
68
69
  let appended = {};
69
70
  const event = body;
@@ -67,7 +67,7 @@ const formatProperties = (insights) => {
67
67
  ];
68
68
 
69
69
  let selectedProps = insightsProps.map((field) => {
70
- if (insights[field.mapping]?.valueOf()) return field.value;
70
+ if (insights?.[field.mapping]?.valueOf()) return field.value;
71
71
  });
72
72
 
73
73
  return compact(selectedProps);
@@ -113,13 +113,18 @@ const validate = (vars) => {
113
113
  const certError = helpers.validate(vars);
114
114
  if (certError) return certError;
115
115
  if (!hasTrustedFormProduct(vars)) return 'a TrustedForm product must be selected';
116
- if (!vars.trustedform?.insights?.valueOf() && !(vars.lead.email || vars.lead.phone_1)) return 'an email address or phone number is required to use TrustedForm Retain';
117
- if (!vars.trustedform?.retain?.valueOf() && !vars.trustedform?.verify?.valueOf() && formatProperties(vars.insights).length === 0 && !vars.insights.page_scan?.valueOf()) return 'no properties selected for TrustedForm Insights';
116
+ if (retainEnabled(vars) && !hasRequiredRetainProps(vars)) return 'an email address or phone number is required to use TrustedForm Retain';
117
+ if (insightsEnabled(vars) && !hasAtLeastOneInsightsProp(vars)) return 'no properties selected for TrustedForm Insights';
118
118
  };
119
119
 
120
- const hasTrustedFormProduct = (vars) => {
121
- return vars.trustedform?.retain?.valueOf() || vars.trustedform?.insights?.valueOf() || vars.trustedform?.verify?.valueOf();
122
- };
120
+ const hasTrustedFormProduct = (vars) => retainEnabled(vars) || insightsEnabled(vars) || verifyEnabled(vars);
121
+ const retainEnabled = (vars) => vars.trustedform?.retain?.valueOf();
122
+ const insightsEnabled = (vars) => vars.trustedform?.insights?.valueOf();
123
+ const verifyEnabled = (vars) => vars.trustedform?.verify?.valueOf();
124
+ const hasRequiredRetainProps = (vars) => !!(vars.lead.email || vars.lead.phone_1);
125
+ const hasAtLeastOneInsightsProp = (vars) => formatProperties(vars.insights).length > 0 || vars.insights?.page_scan?.valueOf();
126
+
127
+
123
128
  const response = (vars, req, res) => {
124
129
  if (res.status < 500) {
125
130
  try {
@@ -1,4 +1,3 @@
1
- const { get } = require('lodash');
2
1
  const request = require('request');
3
2
 
4
3
  module.exports = (req, res) => {
@@ -11,8 +10,7 @@ module.exports = (req, res) => {
11
10
  'test': 'https://app.staging.trustedform.com/account',
12
11
  'development': 'https://app.trustedform-dev.com/account',
13
12
  };
14
- const environment = get(process, 'env.NODE_ENV') || 'development';
15
- const url = trustedFormUrl[environment];
13
+ const url = trustedFormUrl[process.env.NODE_ENV] || trustedFormUrl['development'];
16
14
 
17
15
  const options = {
18
16
  url,
@@ -16,7 +16,7 @@
16
16
  their lead forms.
17
17
  </p>
18
18
  </section>
19
- <Navigation :onNext="onNext"/>
19
+ <Navigation :onConfirm="onConfirm"/>
20
20
  </div>
21
21
  <div v-else-if="!isDataService">
22
22
  <LoadingScreen :module-name="'TrustedForm ' + moduleName"/>
@@ -53,7 +53,7 @@ export default {
53
53
  }
54
54
  },
55
55
  methods: {
56
- onNext () {
56
+ onConfirm () {
57
57
  this.$router.push('/2');
58
58
  }
59
59
  },
@@ -27,7 +27,7 @@
27
27
  </table>
28
28
  </div>
29
29
  </section>
30
- <Navigation :onNext="onNext"/>
30
+ <Navigation :onConfirm="confirm"/>
31
31
  </div>
32
32
  </template>
33
33
 
@@ -44,7 +44,7 @@ export default {
44
44
  Navigation
45
45
  },
46
46
  methods: {
47
- onNext () {
47
+ confirm () {
48
48
  this.$router.push('/3');
49
49
  }
50
50
  }
@@ -8,7 +8,7 @@
8
8
  Now you’re ready to map your fields and set up the associated filters in your LeadConduit flow.
9
9
  </p>
10
10
  </section>
11
- <Navigation :onFinish="finish"/>
11
+ <Navigation :onConfirm="confirm"/>
12
12
  </div>
13
13
  </template>
14
14
 
@@ -17,8 +17,8 @@ import { Navigation } from '@activeprospect/integration-components';
17
17
 
18
18
  export default {
19
19
  methods: {
20
- finish () {
21
- this.$store.dispatch('finish');
20
+ confirm () {
21
+ this.$store.dispatch('confirm');
22
22
  }
23
23
  },
24
24
  components: {
@@ -9,25 +9,30 @@
9
9
  <p>You may select all products that you would like to add to your flow. Each product will be charged depending on your contract. {{errors}}</p>
10
10
  <ul>
11
11
  <li>
12
- <input type="checkbox" :disabled="!products.retain.enabled" v-model="products.retain.selected"><span> Retain</span>
13
- <p class="help-text">Store consent in TrustedForm certificates for legal (TCPA) compliance.</p>
12
+ <label>
13
+ <input type="checkbox" class="fancy-checkbox" :disabled="!products.retain.enabled" v-model="products.retain.selected" id="retain"><label for="retain">Retain</label>
14
+ <p class="help-text">Store consent in TrustedForm certificates for legal (TCPA) compliance.</p>
15
+ </label>
14
16
  </li>
15
17
  <li>
16
- <input type="checkbox" :disabled="!products.insights.enabled" v-model="products.insights.selected"><span> Insights</span>
17
- <p class="help-text">TrustedForm Insights helps buyers identify the leads that are most likely to convert and effectively manage returns and rejections.</p>
18
+ <label>
19
+ <input type="checkbox" class="fancy-checkbox" :disabled="!products.insights.enabled" v-model="products.insights.selected" id="insights"><label for="insights">Insights</label>
20
+ <p class="help-text">TrustedForm Insights helps buyers identify the leads that are most likely to convert and effectively manage returns and rejections.</p>
21
+ </label>
18
22
  </li>
19
23
  <li>
20
- <input type="checkbox" :disabled="!products.verify.enabled" v-model="products.verify.selected"><span> Verify</span>
21
- <p class="help-text">Confirm that your leads were shown consent language that meets your compliance requirements.</p>
24
+ <label>
25
+ <input type="checkbox" class="fancy-checkbox" :disabled="!products.verify.enabled" v-model="products.verify.selected" id="verify"><label for="verify">Verify</label>
26
+ <p class="help-text">Confirm that your leads were shown consent language that meets your compliance requirements.</p>
27
+ </label>
22
28
  </li>
23
29
  </ul>
24
30
  </form>
25
31
  </section>
26
32
  <Navigation
27
33
  :showPrevious="false"
28
- :onNext="!showFinish ? next : undefined"
29
- :onFinish="showFinish ? finish : undefined"
30
- :disableNext="!products.retain.selected && !products.insights.selected && !products.verify.selected"
34
+ :onConfirm="confirm"
35
+ :disableConfirm="!products.retain.selected && !products.insights.selected && !products.verify.selected"
31
36
  />
32
37
  </div>
33
38
  </template>
@@ -44,19 +49,14 @@ export default {
44
49
  components: {
45
50
  Navigation
46
51
  },
47
- computed: {
48
- showFinish () {
49
- return (this.products.retain.selected ||this.products.verify.selected ) && !this.products.insights.selected;
50
- }
51
- },
52
52
  methods: {
53
- next () {
53
+ confirm () {
54
54
  this.$store.state.products = this.products;
55
- this.$router.push('/5');
56
- },
57
- finish () {
58
- this.$store.state.products = this.products;
59
- this.$store.dispatch('finish');
55
+ if (this.products.insights.selected) {
56
+ this.$router.push('/5');
57
+ } else {
58
+ this.$store.dispatch('confirm');
59
+ }
60
60
  }
61
61
  },
62
62
  created () {
@@ -64,3 +64,9 @@ export default {
64
64
  }
65
65
  };
66
66
  </script>
67
+
68
+ <style scoped>
69
+ ul {
70
+ padding-top: 1em;
71
+ }
72
+ </style>
@@ -1,24 +1,30 @@
1
1
  <template>
2
2
  <div>
3
3
  <header>
4
- TrustedForm Insights Configuration
4
+ Configure TrustedForm Insights
5
5
  </header>
6
6
  <section>
7
7
  <form>
8
- <h3>Select Data Points</h3>
8
+ <h3>Select Insights Data Points</h3>
9
9
  <p>TrustedForm Insights provides the following data related to the lead that filled out the form. Each selection of data points will be charged individually.</p>
10
10
  <table>
11
11
  <thead>
12
12
  <tr>
13
- <th><input type="checkbox" v-model="header" :indeterminate.prop="selected === 'some'" @click="toggleAll"></th>
14
- <th>Select All</th>
15
- <th></th>
13
+ <th>
14
+ <input id="select-all" type="checkbox" class="fancy-checkbox" v-model="header" :indeterminate.prop="selected === 'some'" @click="toggleAll">
15
+ <label for="select-all" class="checkbox-label"></label>
16
+ </th>
17
+ <th><label for="select-all" class="text-label">Data Point</label></th>
18
+ <th>Description</th>
16
19
  </tr>
17
20
  </thead>
18
21
  <tbody>
19
22
  <tr v-for="field in Object.keys(fields)" :key="fields[field].name">
20
- <td><input type="checkbox" v-model="fields[field].selected" @change="updateHeader"></td>
21
- <td>{{fields[field].name}}</td>
23
+ <td>
24
+ <input :id="field" type="checkbox" class="fancy-checkbox" v-model="fields[field].selected" @change="updateHeader">
25
+ <label :for="field" class="checkbox-label"></label>
26
+ </td>
27
+ <td><label :for="field" class="text-label">{{fields[field].name}}</label></td>
22
28
  <td v-html="fields[field].description"></td>
23
29
  </tr>
24
30
  </tbody>
@@ -26,8 +32,8 @@
26
32
  </form>
27
33
  </section>
28
34
  <Navigation
29
- :onFinish="finish"
30
- :disableFinish="selected === 'none'"
35
+ :onConfirm="confirm"
36
+ :disableConfirm="selected === 'none'"
31
37
  />
32
38
  </div>
33
39
  </template>
@@ -67,9 +73,9 @@ export default {
67
73
  this.selected = this.amountSelected();
68
74
  this.header = this.selected === 'all';
69
75
  },
70
- finish () {
76
+ confirm () {
71
77
  this.$store.state.v4Fields = this.fields;
72
- this.$store.dispatch('finish');
78
+ this.$store.dispatch('confirm');
73
79
  }
74
80
  },
75
81
  mounted () {
@@ -78,3 +84,32 @@ export default {
78
84
  }
79
85
  }
80
86
  </script>
87
+
88
+ <style scoped>
89
+ table {
90
+ position: relative;
91
+ }
92
+
93
+ th {
94
+ position: sticky;
95
+ top: 0;
96
+ background-color: #f4f6f8;
97
+ border-bottom: 1px solid #dfe4e8;
98
+ }
99
+
100
+ /*
101
+ We are using "fancy-checkbox" in an atypical way;
102
+ Typically, the <label> and <input> components are siblings, and there is only 1 label for the checkbox.
103
+ However, since our fancy-checkbox is supposed to be placed in a separate <td> and have additional padding,
104
+ We have to add some additional styling and a second <label> element.
105
+ */
106
+ .checkbox-label {
107
+ /* !important is needed because of this style https://github.com/activeprospect/leadconduit-client/blob/618797873a9fc485bf2d51873043700aae9d496e/public/css/core/forms.styl#L495 */
108
+ padding: 1.2em !important;
109
+ }
110
+
111
+ .text-label {
112
+ /* !important is needed because of this style https://github.com/activeprospect/leadconduit-client/blob/618797873a9fc485bf2d51873043700aae9d496e/public/css/core/forms.styl#L429 */
113
+ margin: 0 !important;
114
+ }
115
+ </style>
@@ -87,7 +87,7 @@ const initStore = (config, ui) => new Vuex.Store({
87
87
  };
88
88
  context.commit('setFilters', [...context.state.filters, filter]);
89
89
  },
90
- async finish (context) {
90
+ async confirm (context) {
91
91
  const { products, v4Fields } = context.state;
92
92
  const flow = {
93
93
  steps: [{