leadconduit-trustedform 2.4.2 → 2.4.4

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,11 @@
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
6
+ ### Fixed
7
+ - 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
+ 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
+
5
10
  ## [2.4.1] - 2024-08-12
6
11
  ### Added
7
12
  - added "|" to be the default scan delimiter for TF version 4
@@ -1,6 +1,5 @@
1
- const { get } = require('lodash');
2
1
  const helpers = require('./helpers');
3
- const { compact, pickBy, isUndefined } = require('lodash');
2
+ const { compact, get, pickBy, isUndefined } = require('lodash');
4
3
 
5
4
  const request = (vars) => {
6
5
  const { lead, trustedform, insights } = vars;
@@ -29,8 +28,10 @@ const request = (vars) => {
29
28
  };
30
29
  }
31
30
  }
31
+
32
32
  if (trustedform.verify?.valueOf()) {
33
- body.verify = {};
33
+ const advertiserName = trustedform?.advertiser_name;
34
+ body.verify = pickBy({ advertiser_name: advertiserName }, (v) => { return !isUndefined(v); });
34
35
  }
35
36
 
36
37
  return {
@@ -108,7 +109,8 @@ request.variables = () => [
108
109
  { name: 'trustedform.scan_forbidden_text', type: 'array', required: false, description: 'A list of forbidden text to scan for. TrustedForm will then perform a case and whitespace insensitive search for the string.' },
109
110
  { name: 'trustedform.scan_delimiter', type: 'string', required: false, description: 'Use this parameter to designate a delimiter when wrapping wildcards or template variables; defaults to |.' },
110
111
 
111
- { name: 'trustedform.verify', type: 'boolean', required: true, description: 'If true, a request to the Verify product will be made'}
112
+ { name: 'trustedform.verify', type: 'boolean', required: true, description: 'If true, a request to the Verify product will be made'},
113
+ { name: 'trustedform.advertiser_name', type: 'string', required: false, description: 'The name of the legal entity for an advertiser that will be used to determine if they were given consent in a one to one manner. This value will be normalized to be case insensitive, ignore redundant white space and omit non ascii characters. Both \'Acme Inc.\' and \'acme inc\' would result in the same processed value.' }
112
114
  ];
113
115
 
114
116
  const validate = (vars) => {
@@ -126,7 +128,7 @@ const verifyEnabled = (vars) => vars.trustedform?.verify?.valueOf();
126
128
  const hasRequiredRetainProps = (vars) => !!(vars.lead.email || vars.lead.phone_1);
127
129
  const hasAtLeastOneInsightsProp = (vars) => formatProperties(vars.insights).length > 0 || vars.insights?.page_scan?.valueOf();
128
130
  const hasVerifyData = (data) => {
129
- return data.verify?.languages || data.verify?.result?.language_approved || data.verify?.result?.success;
131
+ return data.verify?.languages || data.verify?.result?.language_approved || data.verify?.result?.success || data.verify?.result?.one_to_one;
130
132
  };
131
133
 
132
134
  const response = (vars, req, res) => {
@@ -134,13 +136,16 @@ const response = (vars, req, res) => {
134
136
  try {
135
137
  const parsed = JSON.parse(res.body);
136
138
  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
-
139
+ const verify = hasVerifyData(parsed)
140
+ ? pickBy({
141
+ languages: parsed.verify.languages.map(lang => lang.text),
142
+ form_submitted: parsed.verify.result.form_submitted,
143
+ language_approved: parsed.verify.result.language_approved,
144
+ // note that the Verify one_to_one value is handled separately
145
+ success: parsed.verify.result.success,
146
+ }, (v) => !isUndefined(v))
147
+ : undefined;
148
+
144
149
  const appended = pickBy({
145
150
  outcome: parsed.outcome,
146
151
  reason: parsed.reason,
@@ -150,12 +155,13 @@ const response = (vars, req, res) => {
150
155
  successful_match: parsed.match_lead?.result?.success,
151
156
  email_fingerprint_matched: parsed.match_lead?.result?.email_match,
152
157
  phone_fingerprint_matched: parsed.match_lead?.result?.phone_match,
158
+
153
159
  reference_code: parsed.retain?.reference,
154
160
  vendor: parsed.retain?.vendor,
155
-
156
161
  previously_retained: parsed.retain?.results?.previously_retained,
157
- expires_at: parsed.retain?.results?.expires_at || parsed.insights?.properties?.expires_at,
158
162
  masked_cert_url: parsed.retain?.results?.masked_cert_url,
163
+ share_url: parsed.retain?.results?.share_url,
164
+ expires_at: parsed.retain?.results?.expires_at || parsed.insights?.properties?.expires_at,
159
165
 
160
166
  scans_result: parsed.insights?.scans?.result?.success,
161
167
  required_scans_found: parsed.insights?.scans?.result?.required?.found,
@@ -188,6 +194,7 @@ const response = (vars, req, res) => {
188
194
  os_name: parsed.insights?.properties?.os?.name,
189
195
  page_url: parsed.insights?.properties?.page_url,
190
196
  parent_page_url: parsed.insights?.properties?.parent_page_url,
197
+ one_to_one: parsed.verify?.result?.one_to_one,
191
198
  verify
192
199
  }, (v) => { return !isUndefined(v); });
193
200
  // only include this property if page scan was selected
@@ -229,6 +236,7 @@ response.variables = () => [
229
236
  { name: 'previously_retained', type: 'boolean', description: 'A boolean indicating whether your account had already retained this certificate.' },
230
237
  { name: 'expires_at', type: 'time', description: 'The UTC ISO8601 formatted date and time when this certificate will no longer be available for API requests.' },
231
238
  { name: 'masked_cert_url', type: 'url', description: 'The certificate url that masks the lead source url and snapshot' },
239
+ { name: 'share_url', type: 'url', description: 'The expiring share URL of the certificate' },
232
240
  { name: 'scans_result', type: 'boolean', description: 'A boolean indicating if all required text was found and none of the forbidden text was found.' },
233
241
  { name: 'required_scans_found', type: 'array', description: 'A list of required scan terms that were found in the recorded content.' },
234
242
  { name: 'required_scans_not_found', type: 'array', description: 'A list of required scan terms that were not found in the recorded content.' },
@@ -262,8 +270,10 @@ response.variables = () => [
262
270
  { name: 'os_name', type: 'string', description: 'Operating system name' },
263
271
  { name: 'page_url', type: 'string', description: 'The URL of the page hosting TrustedForm Certify.' },
264
272
  { name: 'parent_page_url', type: 'string', description: 'The parent URL of the page hosting TrustedForm Certify, if framed.' },
273
+ { name: 'one_to_one', type: 'boolean', description: 'A boolean indicating if the cert structure satisfied the requirements for 1:1 consent.' },
265
274
  { name: 'verify.languages', type: 'array', description: 'A list of the consent languages detected within the certificate' },
266
275
  { 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.' },
276
+ { name: 'verify.form_submitted', type: 'boolean', description: 'A boolean indicating whether the form was successfully submitted by the consumer.' },
267
277
  { name: 'verify.success', type: 'boolean', description: 'A boolean indicating if any of the consent languages found meet the success criteria defined for your account.' },
268
278
  ];
269
279
 
@@ -62,7 +62,9 @@ export default {
62
62
  },
63
63
  mounted () {
64
64
  const { integration } = this.$store.state.config;
65
- if (integration.includes('outbound.trustedform')) this.$router.push('/4');
65
+ if (integration.includes('outbound.trustedform')) {
66
+ this.$router.push('/4');
67
+ }
66
68
  else if (!integration.includes('insights')) {
67
69
  this.isDataService = false;
68
70
  }
@@ -43,6 +43,7 @@
43
43
  :showPrevious="false"
44
44
  :onConfirm="confirm"
45
45
  :disableConfirm="!products.retain.selected && !products.insights.selected && !products.verify.selected"
46
+ :navHistory="navHistory"
46
47
  />
47
48
  </div>
48
49
  </template>
@@ -54,7 +55,8 @@ export default {
54
55
  return {
55
56
  loading: true,
56
57
  products: this.$store.getters.getProducts,
57
- errors: this.$store.getters.getErrors
58
+ errors: this.$store.getters.getErrors,
59
+ navHistory: this.$store.getters.getNavHistory
58
60
  };
59
61
  },
60
62
  components: {
@@ -67,9 +69,17 @@ export default {
67
69
  },
68
70
  methods: {
69
71
  confirm () {
72
+ this.$store.commit('resetNavHistory');
73
+ this.$store.commit('setNavHistory', '/4');
70
74
  this.$store.state.products = this.products;
71
- if (this.products.insights.selected) {
75
+ if (this.products.insights.selected && this.products.verify.selected) {
76
+ this.$router.push('/5');
77
+ this.$store.commit('setShouldConfigVerify', true);
78
+ } else if (this.products.insights.selected) {
79
+ this.$store.commit('setShouldConfigVerify', false);
72
80
  this.$router.push('/5');
81
+ } else if (this.products.verify.selected) {
82
+ this.$router.push('/7');
73
83
  } else {
74
84
  this.$store.dispatch('confirm');
75
85
  }
@@ -34,6 +34,7 @@
34
34
  <Navigation
35
35
  :onConfirm="confirm"
36
36
  :disableConfirm="selected === 'none'"
37
+ :navHistory="navHistory"
37
38
  />
38
39
  </div>
39
40
  </template>
@@ -46,7 +47,8 @@ export default {
46
47
  return {
47
48
  fields: this.$store.state.v4Fields,
48
49
  header: false,
49
- selected: 'none'
50
+ selected: 'none',
51
+ navHistory: this.$store.getters.getNavHistory
50
52
  };
51
53
  },
52
54
  components: {
@@ -74,10 +76,15 @@ export default {
74
76
  this.header = this.selected === 'all';
75
77
  },
76
78
  confirm () {
79
+ this.$store.commit('setNavHistory', '/5');
80
+ const shouldConfigVerify = this.$store.getters.getShouldConfigVerify;
77
81
  this.$store.state.v4Fields = this.fields;
78
82
  if (this.fields.page_scan?.selected) {
79
- this.$router.push('/6')
80
- return
83
+ this.$router.push('/6');
84
+ return;
85
+ } else if (shouldConfigVerify) {
86
+ this.$router.push('/7');
87
+ return;
81
88
  }
82
89
  this.$store.dispatch('confirm');
83
90
  }
@@ -35,6 +35,7 @@
35
35
  <Navigation
36
36
  :onConfirm="confirm"
37
37
  :disableConfirm="false"
38
+ :navHistory="navHistory"
38
39
  />
39
40
  </div>
40
41
  </template>
@@ -59,7 +60,9 @@ export default {
59
60
  forbiddenTags: [],
60
61
  /** @type {string[]} */
61
62
  forbiddenOptions: [],
62
- }
63
+ /** @type {string[]} */
64
+ navHistory: this.$store.getters.getNavHistory
65
+ };
63
66
  },
64
67
  methods: {
65
68
  handleRequiredTag(tag) {
@@ -71,14 +74,19 @@ export default {
71
74
  this.forbiddenOptions.push(tag);
72
75
  },
73
76
  confirm() {
77
+ this.$store.commit('setNavHistory', '/6')
74
78
  this.$store.commit('setPageScan', {
75
79
  required: this.requiredTags,
76
80
  forbidden: this.forbiddenTags
77
81
  });
78
- this.$store.dispatch('confirm');
82
+ if (this.$store.getters.getShouldConfigVerify) {
83
+ this.$router.push('/7');
84
+ } else {
85
+ this.$store.dispatch('confirm');
86
+ }
79
87
  },
80
88
  }
81
- }
89
+ };
82
90
  </script>
83
91
 
84
92
  <style scoped>
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div>
3
+ <header>
4
+ Configure TrustedForm Verify
5
+ </header>
6
+ <section>
7
+ <p>
8
+ Enter the name of the legal entity for an advertiser that will be used to determine if they
9
+ were given consent in a one to one manner.
10
+ </p>
11
+ <Form :actions="false">
12
+ <input
13
+ v-model="advertiserName"
14
+ type="text"
15
+ placeholder="(optional) keep empty if you don't need to check one-to-one consent"
16
+ ></input>
17
+ </Form>
18
+ </section>
19
+ <Navigation
20
+ :onConfirm="confirm"
21
+ :disableConfirm="false"
22
+ :navHistory="navHistory"
23
+ />
24
+ </div>
25
+ </template>
26
+
27
+ <script>
28
+ import { Navigation } from '@activeprospect/integration-components';
29
+ import { TextField, Form } from '@activeprospect/ui-components';
30
+
31
+ export default {
32
+ components: {
33
+ Navigation,
34
+ TextField,
35
+ Form
36
+ },
37
+ data() {
38
+ return {
39
+ /** @type {string} */
40
+ advertiserName: "",
41
+ /** @type {string[]} */
42
+ navHistory: this.$store.getters.getNavHistory
43
+ };
44
+ },
45
+ methods: {
46
+ confirm() {
47
+ this.$store.commit('setAdvertiserName', {
48
+ advertiserName: this.advertiserName
49
+ });
50
+ this.$store.dispatch('confirm');
51
+ },
52
+ }
53
+ };
54
+ </script>
55
+
56
+ <style scoped>
57
+
58
+ input {
59
+ width: 65%;
60
+ }
61
+
62
+ </style>
@@ -6,6 +6,7 @@ import PageThree from './config/Page3.vue';
6
6
  import PageFour from './config/Page4.vue';
7
7
  import PageFive from './config/Page5.vue';
8
8
  import PageSix from './config/Page6.vue';
9
+ import PageSeven from './config/Page7.vue';
9
10
 
10
11
  export default createRouter({
11
12
  history: createMemoryHistory(),
@@ -45,6 +46,11 @@ export default createRouter({
45
46
  path: '6',
46
47
  name: 'PageSix',
47
48
  component: PageSix
49
+ },
50
+ {
51
+ path: '7',
52
+ name: 'PageSeven',
53
+ component: PageSeven
48
54
  }
49
55
  ]
50
56
  }
@@ -2,7 +2,7 @@ import { createStore } from 'vuex';
2
2
  import fieldData from './fieldData';
3
3
  import v4Fields from './v4fields';
4
4
  import axios from 'axios';
5
- import { castArray, get } from 'lodash';
5
+ import { castArray, get, includes, set, uniq } from 'lodash';
6
6
  import { toRaw } from 'vue';
7
7
 
8
8
  const initStore = (config, ui) => createStore({
@@ -23,6 +23,9 @@ const initStore = (config, ui) => createStore({
23
23
  filters: [],
24
24
  pageScanForbidden: [],
25
25
  pageScanRequired: [],
26
+ advertiserName: undefined,
27
+ shouldConfigVerify: false,
28
+ navHistory: []
26
29
  },
27
30
  mutations: {
28
31
  setErrors (state, errors) {
@@ -37,6 +40,20 @@ const initStore = (config, ui) => createStore({
37
40
  setPageScan(state, { required, forbidden }) {
38
41
  state.pageScanRequired = required;
39
42
  state.pageScanForbidden = forbidden;
43
+ },
44
+ setAdvertiserName(state, {advertiserName}) {
45
+ state.advertiserName = advertiserName;
46
+ },
47
+ setShouldConfigVerify(state, shouldConfigVerify) {
48
+ state.shouldConfigVerify = shouldConfigVerify;
49
+ },
50
+ setNavHistory(state, navHistory) {
51
+ if (!includes(state.navHistory, navHistory)) {
52
+ state.navHistory.push(navHistory);
53
+ }
54
+ },
55
+ resetNavHistory(state) {
56
+ state.navHistory = [];
40
57
  }
41
58
  },
42
59
  getters: {
@@ -45,6 +62,12 @@ const initStore = (config, ui) => createStore({
45
62
  },
46
63
  getErrors: (state) => {
47
64
  return state.errors;
65
+ },
66
+ getShouldConfigVerify: (state) => {
67
+ return state.shouldConfigVerify;
68
+ },
69
+ getNavHistory: (state) => {
70
+ return state.navHistory
48
71
  }
49
72
  },
50
73
  actions: {
@@ -77,17 +100,21 @@ const initStore = (config, ui) => createStore({
77
100
  });
78
101
  },
79
102
  createFilter(context, filterConfig) {
103
+ const rules = filterConfig.rules.map(rule => {
104
+ return {
105
+ op: rule.rulesOp,
106
+ lhv: rule.lhv,
107
+ rhv: rule.rhv
108
+ };
109
+ });
110
+
80
111
  const filter = {
81
112
  type: 'filter',
82
113
  reason: filterConfig.reason,
83
114
  outcome: filterConfig.outcome,
84
115
  rule_set: {
85
116
  op: 'and',
86
- rules: [{
87
- op: filterConfig.rulesOp,
88
- lhv: filterConfig.lhv,
89
- rhv: filterConfig.rhv
90
- }]
117
+ rules
91
118
  },
92
119
  description: filterConfig.description,
93
120
  enabled: true
@@ -95,7 +122,7 @@ const initStore = (config, ui) => createStore({
95
122
  context.commit('setFilters', [...context.state.filters, filter]);
96
123
  },
97
124
  async confirm (context) {
98
- const { products, v4Fields, pageScanForbidden, pageScanRequired } = context.state;
125
+ const { products, v4Fields, pageScanForbidden, pageScanRequired, advertiserName } = context.state;
99
126
  const flow = {
100
127
  steps: [{
101
128
  type: 'recipient',
@@ -142,14 +169,37 @@ const initStore = (config, ui) => createStore({
142
169
  }
143
170
 
144
171
  if (products.verify.selected) {
145
- const filterConfig = {
146
- reason: '{{trustedform.reason}}',
172
+
173
+ if(advertiserName) {
174
+ flow.steps[0].integration.mappings.push({
175
+ property: 'trustedform.advertiser_name',
176
+ value: advertiserName
177
+ });
178
+ }
179
+
180
+ const verifyRules = {
147
181
  rulesOp: 'is not equal to',
148
182
  lhv: 'trustedform.outcome',
149
183
  rhv: 'success',
184
+ };
185
+
186
+ const oneToOneRules = [
187
+ { ...verifyRules },
188
+ {
189
+ rulesOp: 'is false',
190
+ lhv: 'trustedform.one_to_one',
191
+ }
192
+ ];
193
+
194
+ const rules = advertiserName ? oneToOneRules : [verifyRules];
195
+
196
+ const filterConfig = {
197
+ reason: '{{trustedform.reason}}',
150
198
  outcome: 'failure',
151
- description: 'Filter leads that fail on Trustedform Verify check'
199
+ description: 'Filter leads that fail on Trustedform Verify check',
200
+ rules
152
201
  };
202
+
153
203
  await context.dispatch('createFilter', filterConfig);
154
204
  }
155
205
  context.state.filters.forEach(filter => {
@@ -159,7 +209,7 @@ const initStore = (config, ui) => createStore({
159
209
  });
160
210
  }
161
211
  context.state.ui.create({ flow });
162
- }
212
+ },
163
213
  }
164
214
  });
165
215