leadconduit-trustedform 2.4.5 → 2.4.6

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.
@@ -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
  };
@@ -37,7 +37,7 @@
37
37
  data() {
38
38
  return {
39
39
  /** @type {string} */
40
- advertiserName: "",
40
+ advertiserName: this.$store.state.advertiserName || "",
41
41
  /** @type {string[]} */
42
42
  navHistory: this.$store.getters.getNavHistory
43
43
  };
@@ -1,16 +1,55 @@
1
1
  import { createStore } from 'vuex';
2
2
  import fieldData from './fieldData';
3
- import v4Fields from './v4fields';
3
+ import v4FieldsDefault from './v4fields';
4
4
  import axios from 'axios';
5
- import { castArray, get, includes, set, uniq } from 'lodash';
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
+
8
45
  const initStore = (config, ui) => createStore({
9
46
  state: {
10
47
  // field descriptions
11
48
  fieldData,
12
- v4Fields,
13
-
49
+ v4Fields: initializeV4Fields(v4FieldsDefault, config.mappings),
50
+ advertiserName: initializeAdvertiserName(config.mappings),
51
+ requiredTags: initializePageScanFields(config.mappings,'scan_required_text'),
52
+ forbiddenTags: initializePageScanFields(config.mappings,'scan_forbidden_text'),
14
53
  // integration state
15
54
  ui,
16
55
  config,
@@ -23,7 +62,6 @@ const initStore = (config, ui) => createStore({
23
62
  filters: [],
24
63
  pageScanForbidden: [],
25
64
  pageScanRequired: [],
26
- advertiserName: undefined,
27
65
  shouldConfigVerify: false,
28
66
  navHistory: []
29
67
  },
@@ -67,7 +105,10 @@ const initStore = (config, ui) => createStore({
67
105
  return state.shouldConfigVerify;
68
106
  },
69
107
  getNavHistory: (state) => {
70
- return state.navHistory
108
+ return state.navHistory;
109
+ },
110
+ getAdvertiserName: (state) => {
111
+ return state.advertiserName;
71
112
  }
72
113
  },
73
114
  actions: {
@@ -75,15 +116,18 @@ const initStore = (config, ui) => createStore({
75
116
  context.state.ui.cancel();
76
117
  },
77
118
  getProducts (context) {
119
+ // Bypassing the API call for local testing
120
+ const availableProducts = [
121
+ 'retain',
122
+ 'insights',
123
+ 'verify'
124
+ ];
125
+
126
+ // Original API call - temporarily disabled for local testing
78
127
  return axios
79
128
  .get(`account?apiKey=${config.credential.token}`)
80
129
  .then(function (response) {
81
- const availableProducts = [
82
- 'retain',
83
- 'insights',
84
- 'verify'
85
- ];
86
- const products = get(response, 'data.product_components');
130
+ const products = get(response, 'data.product_components');
87
131
  availableProducts.forEach(function (product) {
88
132
  context.commit('setProduct', { product, value: {
89
133
  enabled: products.includes(product),
@@ -209,7 +253,7 @@ const initStore = (config, ui) => createStore({
209
253
  });
210
254
  }
211
255
  context.state.ui.create({ flow });
212
- },
256
+ }
213
257
  }
214
258
  });
215
259