project-booster-vue 9.49.1 → 9.50.0
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/package.json
CHANGED
|
@@ -21,20 +21,22 @@
|
|
|
21
21
|
>
|
|
22
22
|
{{ payload.viewModel.instructionsButton.text }}
|
|
23
23
|
</m-flex>
|
|
24
|
-
<m-button
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
<m-flex class="pb-pedagogy__content--button" direction="column">
|
|
25
|
+
<m-button
|
|
26
|
+
v-if="payload.viewModel.downloadButton"
|
|
27
|
+
:theme="payload.viewModel.downloadButton.theme"
|
|
28
|
+
:label="payload.viewModel.downloadButton.label"
|
|
29
|
+
class="pb-pedagogy__content-upload-button mc-button--full"
|
|
30
|
+
@click="handleButtonLinkClicked"
|
|
31
|
+
/>
|
|
32
|
+
<m-button
|
|
33
|
+
v-for="action in payload.callToActions"
|
|
34
|
+
:theme="action.bordered ? 'bordered' : 'solid'"
|
|
35
|
+
:label="action.label"
|
|
36
|
+
class="pb-pedagogy__content-action-button mc-button--full"
|
|
37
|
+
@click="handleValidateClicked(action)"
|
|
38
|
+
/>
|
|
39
|
+
</m-flex>
|
|
38
40
|
<m-flex
|
|
39
41
|
justify-content="center"
|
|
40
42
|
align-items="center"
|
|
@@ -141,12 +143,10 @@ export default defineComponent({
|
|
|
141
143
|
window.open(targetUrl, '_blank');
|
|
142
144
|
},
|
|
143
145
|
|
|
144
|
-
async handleValidateClicked() {
|
|
146
|
+
async handleValidateClicked(action: any) {
|
|
145
147
|
this.$emit('step-completed', {
|
|
146
|
-
answers:
|
|
147
|
-
|
|
148
|
-
: null,
|
|
149
|
-
nextStep: this.payload.multiSelect.actions.VALIDATE.nextStep,
|
|
148
|
+
answers: action.isAnswer ? [action] : null,
|
|
149
|
+
nextStep: action.nextStep,
|
|
150
150
|
});
|
|
151
151
|
},
|
|
152
152
|
},
|
|
@@ -264,7 +264,7 @@ export default defineComponent({
|
|
|
264
264
|
await validationSchema
|
|
265
265
|
.validate(formData.value.values, { abortEarly: false })
|
|
266
266
|
.then(async () => {
|
|
267
|
-
const
|
|
267
|
+
const leadSaveStatus = await store.dispatch('trezor/sendFormData', {
|
|
268
268
|
payload: {
|
|
269
269
|
customer: {
|
|
270
270
|
lastname: formData.value.values.lastname,
|
|
@@ -280,9 +280,13 @@ export default defineComponent({
|
|
|
280
280
|
typeLead: props.payload.viewModel.typeLead,
|
|
281
281
|
});
|
|
282
282
|
|
|
283
|
-
if (
|
|
283
|
+
if (leadSaveStatus) {
|
|
284
284
|
emit('step-completed', {
|
|
285
|
-
answers: [
|
|
285
|
+
answers: [
|
|
286
|
+
{
|
|
287
|
+
status: leadSaveStatus,
|
|
288
|
+
},
|
|
289
|
+
],
|
|
286
290
|
nextStep: action.action,
|
|
287
291
|
});
|
|
288
292
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import { escape } from '../../services/htmlEscape';
|
|
3
2
|
|
|
4
3
|
export const clientApi = axios.create({
|
|
5
4
|
baseURL: '/project-booster/api',
|
|
@@ -20,11 +19,9 @@ export const updateTrezorApiClient = (config: { apiKey: string; baseUrl: string;
|
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
export const sendTrezorForm = async (typeLead: string, payload: object) => {
|
|
23
|
-
const response = await clientApi.post(`leads/${typeLead}`, payload)
|
|
22
|
+
const response = await clientApi.post(`leads/${typeLead}`, payload).catch(function (error) {
|
|
23
|
+
return error.response;
|
|
24
|
+
});
|
|
24
25
|
|
|
25
|
-
return
|
|
26
|
-
JSON.stringify(response.data).replace(/:"([^"]+)"/g, (match, $1) => {
|
|
27
|
-
return `: "${escape($1)}"`;
|
|
28
|
-
}),
|
|
29
|
-
);
|
|
26
|
+
return response;
|
|
30
27
|
};
|
|
@@ -31,7 +31,18 @@ export default {
|
|
|
31
31
|
{ payload, typeLead }: { payload: object; typeLead: string },
|
|
32
32
|
) => {
|
|
33
33
|
if (typeLead) {
|
|
34
|
-
|
|
34
|
+
const response = await sendTrezorForm(typeLead, payload);
|
|
35
|
+
|
|
36
|
+
switch (response.status) {
|
|
37
|
+
case 200:
|
|
38
|
+
case 201:
|
|
39
|
+
return 'LEAD_CREATED_SUCCESSFULLY';
|
|
40
|
+
case 400:
|
|
41
|
+
return 'LEAD_CREATION_FAILED_DUE_TO_QUOTA';
|
|
42
|
+
|
|
43
|
+
default:
|
|
44
|
+
return 'LEAD_CREATION_FAILED';
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
47
|
},
|
|
37
48
|
},
|