leadconduit-trustedform 2.4.6 → 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.
@@ -42,6 +42,13 @@ const initializePageScanFields = (mappings, field) => {
42
42
  }
43
43
  };
44
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
+
45
52
  const initStore = (config, ui) => createStore({
46
53
  state: {
47
54
  // field descriptions
@@ -116,14 +123,12 @@ const initStore = (config, ui) => createStore({
116
123
  context.state.ui.cancel();
117
124
  },
118
125
  getProducts (context) {
119
- // Bypassing the API call for local testing
120
126
  const availableProducts = [
121
127
  'retain',
122
128
  'insights',
123
129
  'verify'
124
130
  ];
125
131
 
126
- // Original API call - temporarily disabled for local testing
127
132
  return axios
128
133
  .get(`account?apiKey=${config.credential.token}`)
129
134
  .then(function (response) {
@@ -131,7 +136,7 @@ const initStore = (config, ui) => createStore({
131
136
  availableProducts.forEach(function (product) {
132
137
  context.commit('setProduct', { product, value: {
133
138
  enabled: products.includes(product),
134
- selected: false
139
+ selected: products.includes(product) && initializeProductSelection(config.mappings, product)
135
140
  }});
136
141
  });
137
142
  })