leadconduit-trustedform 2.3.2 → 2.3.3
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 +10 -0
- package/README.md +9 -0
- package/lib/helpers.js +1 -0
- package/lib/trustedform.js +10 -2
- package/lib/ui/public/app/config/Page1.vue +1 -1
- package/lib/ui/public/app/config/Page4.vue +20 -3
- package/lib/ui/public/app/config/Page5.vue +4 -0
- package/lib/ui/public/app/config/Page6.vue +95 -0
- package/lib/ui/public/app/index.js +8 -10
- package/lib/ui/public/app/router.js +9 -5
- package/lib/ui/public/app/store.js +31 -8
- package/lib/ui/public/dist/index.js +1 -1
- package/lib/ui/public/dist/index.js.LICENSE.txt +18 -5
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
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.3] - 2024-02-05
|
|
6
|
+
### Added
|
|
7
|
+
- added `amount_required_matched` field to v4 integration for requests with required scans ([sc-65371](https://app.shortcut.com/active-prospect/story/65371/trustedform-v4-page-scan-rule-improvements))
|
|
8
|
+
- PageScan required/forbidden text configuration screen. ([sc-65261](https://app.shortcut.com/active-prospect/story/65261/trustedform-v4-insights-add-on-ui-should-prompt-for-required-and-forbidden-scan-text))
|
|
9
|
+
- Add notice when account has no TF products available ([sc-67604](https://app.shortcut.com/active-prospect/story/67604/trustedform-v4-fix-add-on-ui-to-handle-no-products))
|
|
10
|
+
|
|
11
|
+
## [2.3.2] - 2024-01-19
|
|
12
|
+
### Fixed
|
|
13
|
+
- improvements to v4 UI styling ([sc-59650](https://app.shortcut.com/active-prospect/story/59650/trustedform-v4-improve-rich-ui-styling))
|
|
14
|
+
|
|
5
15
|
## [2.3.1] - 2024-01-10
|
|
6
16
|
### Fixed
|
|
7
17
|
- 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))
|
package/README.md
CHANGED
|
@@ -4,3 +4,12 @@ This module is for use on the [LeadConduit](http://activeprospect.com/products/l
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
[](https://github.com/activeprospect/leadconduit-integration-trustedform/actions)
|
|
7
|
+
|
|
8
|
+
## Testing on Development and Staging
|
|
9
|
+
|
|
10
|
+
Certificates for testing on development and staging can be generated by the following form. The cert URL will be output in the browser's console.
|
|
11
|
+
|
|
12
|
+
- for development: https://activeprospect.github.io/trustedform.html?env=api.trustedform-dev.com
|
|
13
|
+
- for staging: https://activeprospect.github.io/trustedform.html?env=api.staging.trustedform.com
|
|
14
|
+
|
|
15
|
+
Consent language management can be found [here for development](https://app.trustedform-dev.com/consent_languages/approved) and [here for staging](https://app.staging.trustedform.com/consent_languages/approved).
|
package/lib/helpers.js
CHANGED
|
@@ -21,6 +21,7 @@ const formatScanReason = (scannedFor, textArray) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const countRequiredMatched = (requiredStrings, scans) => {
|
|
24
|
+
if (!requiredStrings || !scans) return undefined;
|
|
24
25
|
// normalize data
|
|
25
26
|
if (!(requiredStrings instanceof Array)) {
|
|
26
27
|
requiredStrings = [requiredStrings];
|
package/lib/trustedform.js
CHANGED
|
@@ -130,7 +130,7 @@ const response = (vars, req, res) => {
|
|
|
130
130
|
try {
|
|
131
131
|
const parsed = JSON.parse(res.body);
|
|
132
132
|
if (res.status === 200) {
|
|
133
|
-
|
|
133
|
+
const appended = pickBy({
|
|
134
134
|
outcome: parsed.outcome,
|
|
135
135
|
reason: parsed.reason,
|
|
136
136
|
|
|
@@ -176,11 +176,17 @@ const response = (vars, req, res) => {
|
|
|
176
176
|
os_name: parsed.insights?.properties?.os?.name,
|
|
177
177
|
page_url: parsed.insights?.properties?.page_url,
|
|
178
178
|
parent_page_url: parsed.insights?.properties?.parent_page_url,
|
|
179
|
-
|
|
179
|
+
|
|
180
180
|
languages: parsed.insights?.properties?.languages,
|
|
181
181
|
language_approved: parsed.insights?.properties?.language_approved,
|
|
182
182
|
success: parsed.verify?.result?.success,
|
|
183
183
|
}, (v) => { return !isUndefined(v); });
|
|
184
|
+
// only include this property if page scan was selected
|
|
185
|
+
if (vars.insights?.page_scan?.valueOf()) {
|
|
186
|
+
appended.amount_required_matched = helpers.countRequiredMatched(parsed.insights?.scans?.required, parsed.insights?.scans?.result?.required?.found);
|
|
187
|
+
appended.amount_forbidden_matched = helpers.countRequiredMatched(parsed.insights?.scans?.forbidden, parsed.insights?.scans?.result?.forbidden?.found);
|
|
188
|
+
}
|
|
189
|
+
return appended;
|
|
184
190
|
} else {
|
|
185
191
|
return {
|
|
186
192
|
outcome: parsed.outcome,
|
|
@@ -218,6 +224,8 @@ response.variables = () => [
|
|
|
218
224
|
{ name: 'required_scans_not_found', type: 'array', description: 'A list of required scan terms that were not found in the recorded content.' },
|
|
219
225
|
{ name: 'forbidden_scans_found', type: 'array', description: 'A list of forbidden scan terms that were found in the recorded content.' },
|
|
220
226
|
{ name: 'forbidden_scans_not_found', type: 'array', description: 'A list of forbidden scan terms that were not found in the recorded content.' },
|
|
227
|
+
{ name: 'amount_required_matched', type: 'string', description: 'How many of the required strings were matched? (all, some, none)' },
|
|
228
|
+
{ name: 'amount_forbidden_matched', type: 'string', description: 'How many of the forbidden strings were scanned? (all, some, none)' },
|
|
221
229
|
{ name: 'age_in_seconds', type: 'number', description: 'Number of seconds since the last user interaction with the certificate.' },
|
|
222
230
|
{ name: 'city', type: 'string', description: 'City name based on consumer\'s public IP address' },
|
|
223
231
|
{ name: 'country_code', type: 'string', description: 'Country code based on consumer\'s public IP address' },
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<Navigation :onConfirm="onConfirm"/>
|
|
20
20
|
</div>
|
|
21
21
|
<div v-else-if="!isDataService">
|
|
22
|
-
<LoadingScreen :module-name="'TrustedForm ' + moduleName"/>
|
|
22
|
+
<LoadingScreen :onFinish="() => {/* NOOP */}" :module-name="'TrustedForm ' + moduleName"/>
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
</template>
|
|
@@ -3,7 +3,17 @@
|
|
|
3
3
|
<header>
|
|
4
4
|
Add TrustedForm Add-On
|
|
5
5
|
</header>
|
|
6
|
-
<section>
|
|
6
|
+
<section v-if="loading">
|
|
7
|
+
<span class="loading"></span> Loading products...
|
|
8
|
+
</section>
|
|
9
|
+
<section v-else-if="!productsAvailable">
|
|
10
|
+
<p>
|
|
11
|
+
Your account does not have access to TrustedForm. Please contact
|
|
12
|
+
<a href="mailto:support@activeprospect.com">support@activeprospect.com</a>
|
|
13
|
+
if this is in error or if you would like to add TrustedForm to your account.
|
|
14
|
+
</p>
|
|
15
|
+
</section>
|
|
16
|
+
<section v-else>
|
|
7
17
|
<form>
|
|
8
18
|
<h3>Select the TrustedForm products to add to your flow.</h3>
|
|
9
19
|
<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>
|
|
@@ -42,6 +52,7 @@ import { Navigation } from '@activeprospect/integration-components';
|
|
|
42
52
|
export default {
|
|
43
53
|
data () {
|
|
44
54
|
return {
|
|
55
|
+
loading: true,
|
|
45
56
|
products: this.$store.getters.getProducts,
|
|
46
57
|
errors: this.$store.getters.getErrors
|
|
47
58
|
};
|
|
@@ -49,6 +60,11 @@ export default {
|
|
|
49
60
|
components: {
|
|
50
61
|
Navigation
|
|
51
62
|
},
|
|
63
|
+
computed: {
|
|
64
|
+
productsAvailable() {
|
|
65
|
+
return this.products.retain.enabled || this.products.insights.enabled || this.products.verify.enabled;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
52
68
|
methods: {
|
|
53
69
|
confirm () {
|
|
54
70
|
this.$store.state.products = this.products;
|
|
@@ -59,8 +75,9 @@ export default {
|
|
|
59
75
|
}
|
|
60
76
|
}
|
|
61
77
|
},
|
|
62
|
-
created () {
|
|
63
|
-
this.$store.dispatch('getProducts');
|
|
78
|
+
async created () {
|
|
79
|
+
await this.$store.dispatch('getProducts');
|
|
80
|
+
this.loading = false;
|
|
64
81
|
}
|
|
65
82
|
};
|
|
66
83
|
</script>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<header>
|
|
4
|
+
Configure TrustedForm Insights
|
|
5
|
+
</header>
|
|
6
|
+
<section>
|
|
7
|
+
<h3>Page Scan Forbidden/Required Text</h3>
|
|
8
|
+
<p>
|
|
9
|
+
Please set your required and/or forbidden text for the TrustedForm set in LeadConduit;
|
|
10
|
+
the step will fail if the required term is missing and if the forbidden term is present in the page.
|
|
11
|
+
<a href="https://community.activeprospect.com/posts/4078890">Learn More</a>
|
|
12
|
+
</p>
|
|
13
|
+
<Form :actions="false">
|
|
14
|
+
<SelectField
|
|
15
|
+
name="PageScan Required"
|
|
16
|
+
v-model="requiredTags"
|
|
17
|
+
:options="requiredOptions"
|
|
18
|
+
taggable
|
|
19
|
+
multiple
|
|
20
|
+
@tag="handleRequiredTag"
|
|
21
|
+
openDirection="bottom"
|
|
22
|
+
></SelectField>
|
|
23
|
+
|
|
24
|
+
<SelectField
|
|
25
|
+
name="PageScan Forbidden"
|
|
26
|
+
v-model="forbiddenTags"
|
|
27
|
+
:options="forbiddenOptions"
|
|
28
|
+
taggable
|
|
29
|
+
multiple
|
|
30
|
+
@tag="handleForbiddenTag"
|
|
31
|
+
openDirection="bottom"
|
|
32
|
+
></SelectField>
|
|
33
|
+
</Form>
|
|
34
|
+
</section>
|
|
35
|
+
<Navigation
|
|
36
|
+
:onConfirm="confirm"
|
|
37
|
+
:disableConfirm="false"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import { Navigation } from '@activeprospect/integration-components';
|
|
44
|
+
import { SelectField, Form } from '@activeprospect/ui-components';
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
components: {
|
|
48
|
+
Navigation,
|
|
49
|
+
SelectField,
|
|
50
|
+
Form
|
|
51
|
+
},
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
/** @type {string[]} */
|
|
55
|
+
requiredTags: [],
|
|
56
|
+
/** @type {string[]} */
|
|
57
|
+
requiredOptions: [],
|
|
58
|
+
/** @type {string[]} */
|
|
59
|
+
forbiddenTags: [],
|
|
60
|
+
/** @type {string[]} */
|
|
61
|
+
forbiddenOptions: [],
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
methods: {
|
|
65
|
+
handleRequiredTag(tag) {
|
|
66
|
+
this.requiredTags.push(tag);
|
|
67
|
+
this.requiredOptions.push(tag);
|
|
68
|
+
},
|
|
69
|
+
handleForbiddenTag(tag) {
|
|
70
|
+
this.forbiddenTags.push(tag);
|
|
71
|
+
this.forbiddenOptions.push(tag);
|
|
72
|
+
},
|
|
73
|
+
confirm() {
|
|
74
|
+
this.$store.commit('setPageScan', {
|
|
75
|
+
required: this.requiredTags,
|
|
76
|
+
forbidden: this.forbiddenTags
|
|
77
|
+
});
|
|
78
|
+
this.$store.dispatch('confirm');
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style scoped>
|
|
85
|
+
/* All the selectors here use `:deep()` because otherwise the styles can't be scoped, since the classes are added by a library. */
|
|
86
|
+
|
|
87
|
+
/** override this style https://github.com/activeprospect/leadconduit-client/blob/a005d3ac5627aa39d12c64756561ef400b512bf3/public/css/core/forms.styl#L252-L254 */
|
|
88
|
+
:deep(input[type="text"]) {
|
|
89
|
+
min-width: 0 !important;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:deep(.formkit-outer) {
|
|
93
|
+
width: 100%;
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import ui from 'leadconduit-integration-ui';
|
|
2
|
-
import
|
|
2
|
+
import { createApp } from 'vue';
|
|
3
3
|
import Config from './config/Config.vue';
|
|
4
|
-
import Vuex from 'vuex';
|
|
5
4
|
import initStore from './store';
|
|
6
5
|
import router from './router';
|
|
7
|
-
|
|
8
|
-
Vue.use(Vuex);
|
|
6
|
+
import { plugin } from '@activeprospect/ui-components';
|
|
9
7
|
|
|
10
8
|
function init (config) {
|
|
11
|
-
const
|
|
9
|
+
const app = createApp(Config);
|
|
10
|
+
|
|
11
|
+
app.use(initStore(config, ui));
|
|
12
|
+
app.use(router);
|
|
13
|
+
app.use(plugin);
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
render: h => h(Config),
|
|
15
|
-
store,
|
|
16
|
-
router
|
|
17
|
-
}).$mount('#app');
|
|
15
|
+
app.mount('#app');
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
ui.init(init);
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Router from 'vue-router';
|
|
1
|
+
import { createMemoryHistory, createRouter } from 'vue-router';
|
|
3
2
|
import Config from './config/Config.vue';
|
|
4
3
|
import PageOne from './config/Page1.vue';
|
|
5
4
|
import PageTwo from './config/Page2.vue';
|
|
6
5
|
import PageThree from './config/Page3.vue';
|
|
7
6
|
import PageFour from './config/Page4.vue';
|
|
8
7
|
import PageFive from './config/Page5.vue';
|
|
8
|
+
import PageSix from './config/Page6.vue';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export default new Router({
|
|
10
|
+
export default createRouter({
|
|
11
|
+
history: createMemoryHistory(),
|
|
13
12
|
routes: [
|
|
14
13
|
{
|
|
15
14
|
path: '/',
|
|
@@ -41,6 +40,11 @@ export default new Router({
|
|
|
41
40
|
path: '5',
|
|
42
41
|
name: 'PageFive',
|
|
43
42
|
component: PageFive
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
path: '6',
|
|
46
|
+
name: 'PageSix',
|
|
47
|
+
component: PageSix
|
|
44
48
|
}
|
|
45
49
|
]
|
|
46
50
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createStore } from 'vuex';
|
|
2
2
|
import fieldData from './fieldData';
|
|
3
3
|
import v4Fields from './v4fields';
|
|
4
4
|
import axios from 'axios';
|
|
5
|
-
import { get } from 'lodash';
|
|
5
|
+
import { castArray, get } from 'lodash';
|
|
6
|
+
import { toRaw } from 'vue';
|
|
6
7
|
|
|
7
|
-
const initStore = (config, ui) =>
|
|
8
|
+
const initStore = (config, ui) => createStore({
|
|
8
9
|
state: {
|
|
9
10
|
// field descriptions
|
|
10
11
|
fieldData,
|
|
@@ -19,7 +20,9 @@ const initStore = (config, ui) => new Vuex.Store({
|
|
|
19
20
|
insights: { enabled: false, selected: false },
|
|
20
21
|
verify: { enabled: false, selected: false }
|
|
21
22
|
},
|
|
22
|
-
filters: []
|
|
23
|
+
filters: [],
|
|
24
|
+
pageScanForbidden: [],
|
|
25
|
+
pageScanRequired: [],
|
|
23
26
|
},
|
|
24
27
|
mutations: {
|
|
25
28
|
setErrors (state, errors) {
|
|
@@ -30,6 +33,10 @@ const initStore = (config, ui) => new Vuex.Store({
|
|
|
30
33
|
},
|
|
31
34
|
setFilters(state, filters) {
|
|
32
35
|
state.filters = filters;
|
|
36
|
+
},
|
|
37
|
+
setPageScan(state, { required, forbidden }) {
|
|
38
|
+
state.pageScanRequired = required;
|
|
39
|
+
state.pageScanForbidden = forbidden;
|
|
33
40
|
}
|
|
34
41
|
},
|
|
35
42
|
getters: {
|
|
@@ -45,7 +52,7 @@ const initStore = (config, ui) => new Vuex.Store({
|
|
|
45
52
|
context.state.ui.cancel();
|
|
46
53
|
},
|
|
47
54
|
getProducts (context) {
|
|
48
|
-
axios
|
|
55
|
+
return axios
|
|
49
56
|
.get(`account?apiKey=${config.credential.token}`)
|
|
50
57
|
.then(function (response) {
|
|
51
58
|
const availableProducts = [
|
|
@@ -88,7 +95,7 @@ const initStore = (config, ui) => new Vuex.Store({
|
|
|
88
95
|
context.commit('setFilters', [...context.state.filters, filter]);
|
|
89
96
|
},
|
|
90
97
|
async confirm (context) {
|
|
91
|
-
const { products, v4Fields } = context.state;
|
|
98
|
+
const { products, v4Fields, pageScanForbidden, pageScanRequired } = context.state;
|
|
92
99
|
const flow = {
|
|
93
100
|
steps: [{
|
|
94
101
|
type: 'recipient',
|
|
@@ -120,6 +127,20 @@ const initStore = (config, ui) => new Vuex.Store({
|
|
|
120
127
|
});
|
|
121
128
|
}
|
|
122
129
|
|
|
130
|
+
if (castArray(pageScanRequired).length > 0) {
|
|
131
|
+
flow.steps[0].integration.mappings.push({
|
|
132
|
+
property: 'trustedform.scan_required_text',
|
|
133
|
+
value: toRaw(pageScanRequired)
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (castArray(pageScanForbidden).length > 0) {
|
|
138
|
+
flow.steps[0].integration.mappings.push({
|
|
139
|
+
property: 'trustedform.scan_forbidden_text',
|
|
140
|
+
value: toRaw(pageScanForbidden)
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
123
144
|
if (products.verify.selected) {
|
|
124
145
|
const filterConfig = {
|
|
125
146
|
reason: '{{trustedform.reason}}',
|
|
@@ -132,8 +153,10 @@ const initStore = (config, ui) => new Vuex.Store({
|
|
|
132
153
|
await context.dispatch('createFilter', filterConfig);
|
|
133
154
|
}
|
|
134
155
|
context.state.filters.forEach(filter => {
|
|
135
|
-
flow.
|
|
136
|
-
|
|
156
|
+
// the flow gets passed back to the app via a window.postMessage call, which clones objects passed in the message.
|
|
157
|
+
// As of Vuex 4, state items are Proxy objects, which cannot be cloned, so we have to use `toRaw()`.
|
|
158
|
+
flow.steps.push(toRaw(filter));
|
|
159
|
+
});
|
|
137
160
|
}
|
|
138
161
|
context.state.ui.create({ flow });
|
|
139
162
|
}
|