leadconduit-trustedform 2.4.5 → 2.4.7
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/trustedform.js
CHANGED
|
@@ -277,8 +277,11 @@ response.variables = () => [
|
|
|
277
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.' },
|
|
278
278
|
];
|
|
279
279
|
|
|
280
|
+
const editable = true;
|
|
281
|
+
|
|
280
282
|
module.exports = {
|
|
281
283
|
request,
|
|
282
284
|
response,
|
|
283
|
-
validate
|
|
285
|
+
validate,
|
|
286
|
+
editable
|
|
284
287
|
};
|
|
@@ -53,13 +53,13 @@ export default {
|
|
|
53
53
|
data() {
|
|
54
54
|
return {
|
|
55
55
|
/** @type {string[]} */
|
|
56
|
-
requiredTags: [],
|
|
56
|
+
requiredTags: this.$store.state.requiredTags || [],
|
|
57
57
|
/** @type {string[]} */
|
|
58
|
-
requiredOptions: [],
|
|
58
|
+
requiredOptions: this.$store.state.requiredTags || [],
|
|
59
59
|
/** @type {string[]} */
|
|
60
|
-
forbiddenTags: [],
|
|
60
|
+
forbiddenTags: this.$store.state.forbiddenTags || [],
|
|
61
61
|
/** @type {string[]} */
|
|
62
|
-
forbiddenOptions: [],
|
|
62
|
+
forbiddenOptions: this.$store.state.forbiddenTags || [],
|
|
63
63
|
/** @type {string[]} */
|
|
64
64
|
navHistory: this.$store.getters.getNavHistory
|
|
65
65
|
};
|
|
@@ -1,16 +1,62 @@
|
|
|
1
1
|
import { createStore } from 'vuex';
|
|
2
2
|
import fieldData from './fieldData';
|
|
3
|
-
import
|
|
3
|
+
import v4FieldsDefault from './v4fields';
|
|
4
4
|
import axios from 'axios';
|
|
5
|
-
import { castArray, get, includes
|
|
5
|
+
import { castArray, get, includes } from 'lodash';
|
|
6
6
|
import { toRaw } from 'vue';
|
|
7
7
|
|
|
8
|
+
const initializeV4Fields = (defaultFields, mappings) => {
|
|
9
|
+
const newFields = {};
|
|
10
|
+
Object.keys(defaultFields).forEach(key => {
|
|
11
|
+
newFields[key] = {
|
|
12
|
+
...defaultFields[key],
|
|
13
|
+
selected: defaultFields[key].enabled
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
if (mappings && Array.isArray(mappings)) {
|
|
18
|
+
mappings.forEach(mapping => {
|
|
19
|
+
if (mapping.property.startsWith('insights.')) {
|
|
20
|
+
const fieldKey = mapping.property.replace('insights.', '');
|
|
21
|
+
if (newFields[fieldKey]) {
|
|
22
|
+
newFields[fieldKey].selected = mapping.value === 'true';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return newFields;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const initializeAdvertiserName = (mappings) => {
|
|
31
|
+
if (mappings && Array.isArray(mappings)) {
|
|
32
|
+
const mapping = mappings.find(item => item.property === 'trustedform.advertiser_name');
|
|
33
|
+
return mapping ? mapping.value : undefined;
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const initializePageScanFields = (mappings, field) => {
|
|
39
|
+
if (mappings && Array.isArray(mappings)) {
|
|
40
|
+
const mapping = mappings.find(item => item.property === `trustedform.${field}`);
|
|
41
|
+
return mapping ? mapping.value : undefined;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const initializeProductSelection = (mappings, product) => {
|
|
46
|
+
if (Array.isArray(mappings)) {
|
|
47
|
+
const mapping = mappings.find(item => item.property === `trustedform.${product}`);
|
|
48
|
+
return mapping ? mapping.value === 'true' : false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
8
52
|
const initStore = (config, ui) => createStore({
|
|
9
53
|
state: {
|
|
10
54
|
// field descriptions
|
|
11
55
|
fieldData,
|
|
12
|
-
v4Fields,
|
|
13
|
-
|
|
56
|
+
v4Fields: initializeV4Fields(v4FieldsDefault, config.mappings),
|
|
57
|
+
advertiserName: initializeAdvertiserName(config.mappings),
|
|
58
|
+
requiredTags: initializePageScanFields(config.mappings,'scan_required_text'),
|
|
59
|
+
forbiddenTags: initializePageScanFields(config.mappings,'scan_forbidden_text'),
|
|
14
60
|
// integration state
|
|
15
61
|
ui,
|
|
16
62
|
config,
|
|
@@ -23,7 +69,6 @@ const initStore = (config, ui) => createStore({
|
|
|
23
69
|
filters: [],
|
|
24
70
|
pageScanForbidden: [],
|
|
25
71
|
pageScanRequired: [],
|
|
26
|
-
advertiserName: undefined,
|
|
27
72
|
shouldConfigVerify: false,
|
|
28
73
|
navHistory: []
|
|
29
74
|
},
|
|
@@ -67,7 +112,10 @@ const initStore = (config, ui) => createStore({
|
|
|
67
112
|
return state.shouldConfigVerify;
|
|
68
113
|
},
|
|
69
114
|
getNavHistory: (state) => {
|
|
70
|
-
return state.navHistory
|
|
115
|
+
return state.navHistory;
|
|
116
|
+
},
|
|
117
|
+
getAdvertiserName: (state) => {
|
|
118
|
+
return state.advertiserName;
|
|
71
119
|
}
|
|
72
120
|
},
|
|
73
121
|
actions: {
|
|
@@ -75,19 +123,20 @@ const initStore = (config, ui) => createStore({
|
|
|
75
123
|
context.state.ui.cancel();
|
|
76
124
|
},
|
|
77
125
|
getProducts (context) {
|
|
126
|
+
const availableProducts = [
|
|
127
|
+
'retain',
|
|
128
|
+
'insights',
|
|
129
|
+
'verify'
|
|
130
|
+
];
|
|
131
|
+
|
|
78
132
|
return axios
|
|
79
133
|
.get(`account?apiKey=${config.credential.token}`)
|
|
80
134
|
.then(function (response) {
|
|
81
|
-
const
|
|
82
|
-
'retain',
|
|
83
|
-
'insights',
|
|
84
|
-
'verify'
|
|
85
|
-
];
|
|
86
|
-
const products = get(response, 'data.product_components');
|
|
135
|
+
const products = get(response, 'data.product_components');
|
|
87
136
|
availableProducts.forEach(function (product) {
|
|
88
137
|
context.commit('setProduct', { product, value: {
|
|
89
138
|
enabled: products.includes(product),
|
|
90
|
-
selected:
|
|
139
|
+
selected: products.includes(product) && initializeProductSelection(config.mappings, product)
|
|
91
140
|
}});
|
|
92
141
|
});
|
|
93
142
|
})
|
|
@@ -209,7 +258,7 @@ const initStore = (config, ui) => createStore({
|
|
|
209
258
|
});
|
|
210
259
|
}
|
|
211
260
|
context.state.ui.create({ flow });
|
|
212
|
-
}
|
|
261
|
+
}
|
|
213
262
|
}
|
|
214
263
|
});
|
|
215
264
|
|