project-booster-vue 10.5.2 → 10.6.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 +1 -1
- package/src/components/rework/alert/MPbAlert.vue +18 -0
- package/src/components/rework/question/MPbQuestion.vue +25 -2
- package/src/components/rework/services/event.ts +43 -18
- package/src/components/rework/styles/global.scss +3 -1
- package/src/components/scenario/PbScenario.vue +1 -0
- package/src/components/scenario/scenarios-test-conditions-and-secrets.json +3 -0
package/package.json
CHANGED
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
@click="handleShowModal(options)"
|
|
31
31
|
size="s"
|
|
32
32
|
theme="bordered-primary-02"
|
|
33
|
+
class="js-cdl"
|
|
34
|
+
data-cdl-click-type="cdl_event"
|
|
35
|
+
:data-cdl-click-data="
|
|
36
|
+
formatEvent(
|
|
37
|
+
{ button_name: options.viewModel.button.label, button_location: stepLocation },
|
|
38
|
+
EventTypeEnum.BUTTON,
|
|
39
|
+
)
|
|
40
|
+
"
|
|
33
41
|
/>
|
|
34
42
|
</template>
|
|
35
43
|
</m-card>
|
|
@@ -46,6 +54,11 @@
|
|
|
46
54
|
:iconPosition="button.iconPosition"
|
|
47
55
|
style="margin-left: 1rem"
|
|
48
56
|
:data-cerberus="sanitizeCerberusAttribut('MPB-ALERT', button.label)"
|
|
57
|
+
class="js-cdl"
|
|
58
|
+
data-cdl-click-type="cdl_event"
|
|
59
|
+
:data-cdl-click-data="
|
|
60
|
+
formatEvent({ button_name: button.label, button_location: stepLocation }, EventTypeEnum.BUTTON)
|
|
61
|
+
"
|
|
49
62
|
/>
|
|
50
63
|
</div>
|
|
51
64
|
</div>
|
|
@@ -77,6 +90,7 @@ import { PayloadAction } from '../types/genericPayload';
|
|
|
77
90
|
import { sanitizeCerberusAttribut } from '@/services/sanitize';
|
|
78
91
|
import { ref } from 'vue';
|
|
79
92
|
import { useStore } from 'vuex';
|
|
93
|
+
import { EventTypeEnum, formatEvent } from '../services/event';
|
|
80
94
|
|
|
81
95
|
const emit = defineEmits(['go-back', 'step-completed']);
|
|
82
96
|
const showModal = ref(false);
|
|
@@ -94,6 +108,10 @@ const props = defineProps({
|
|
|
94
108
|
type: Object,
|
|
95
109
|
default: () => ({}),
|
|
96
110
|
},
|
|
111
|
+
stepLocation: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: '',
|
|
114
|
+
},
|
|
97
115
|
});
|
|
98
116
|
|
|
99
117
|
const handleCloseModal = () => {
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
</div>
|
|
229
229
|
<div class="pb-question__actions-container__column" v-if="!skippables || hasAnswersSelected">
|
|
230
230
|
<m-button
|
|
231
|
-
class="pb-question__actions-buttons-button"
|
|
231
|
+
class="pb-question__actions-buttons-button js-cdl"
|
|
232
232
|
size="m"
|
|
233
233
|
size-from-l="l"
|
|
234
234
|
icon="ArrowNext48"
|
|
@@ -237,6 +237,8 @@
|
|
|
237
237
|
@click="nextStepHandler"
|
|
238
238
|
:disabled="!hasAnswersSelected"
|
|
239
239
|
:data-cerberus="sanitizeCerberusAttribut('MPB-QUESTION', 'Etape suivante')"
|
|
240
|
+
data-cdl-click-type="cdl_event"
|
|
241
|
+
:data-cdl-click-data="eventData"
|
|
240
242
|
/>
|
|
241
243
|
</div>
|
|
242
244
|
<div v-else-if="skippables && !hasAnswersSelected" class="pb-question__actions-container__column">
|
|
@@ -388,6 +390,7 @@ import {
|
|
|
388
390
|
ScenarioStepAnswerNotification,
|
|
389
391
|
} from '@/types/pb/Scenario';
|
|
390
392
|
import { useStore } from 'vuex';
|
|
393
|
+
import { EventTypeEnum, formatEvent } from '../services/event';
|
|
391
394
|
|
|
392
395
|
const BACK_ICON =
|
|
393
396
|
'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
|
|
@@ -603,6 +606,7 @@ const selectAnswer = (stepCode: string, answer: ScenarioStepAnswer) => {
|
|
|
603
606
|
});
|
|
604
607
|
selectedAnswers.value.set(answer.code, !selectedAnswers.value.get(answer.code) ?? true);
|
|
605
608
|
}
|
|
609
|
+
updateCdlValues();
|
|
606
610
|
};
|
|
607
611
|
|
|
608
612
|
const validMultiSelect = (multiSelectOptions: ScenarioStepMultiSelectAction | undefined) => {
|
|
@@ -618,6 +622,7 @@ const validMultiSelect = (multiSelectOptions: ScenarioStepMultiSelectAction | un
|
|
|
618
622
|
answers: answers,
|
|
619
623
|
nextStep: multiSelectOptions?.nextStep,
|
|
620
624
|
});
|
|
625
|
+
updateCdlValues();
|
|
621
626
|
};
|
|
622
627
|
|
|
623
628
|
const skipQuestion = (button: ScenarioStepSkippableOptions | undefined) => {
|
|
@@ -730,9 +735,10 @@ const handleShowModal = () => {
|
|
|
730
735
|
showModal.value = !showModal.value;
|
|
731
736
|
};
|
|
732
737
|
|
|
738
|
+
const eventData: any = ref();
|
|
739
|
+
|
|
733
740
|
const handleCardClick = (answer: ScenarioStepAnswer, payload: any) => {
|
|
734
741
|
notification.value = undefined;
|
|
735
|
-
|
|
736
742
|
if (answer.notification) {
|
|
737
743
|
notification.value = answer.notification;
|
|
738
744
|
|
|
@@ -761,6 +767,23 @@ const nextStepHandler = () => {
|
|
|
761
767
|
});
|
|
762
768
|
}
|
|
763
769
|
};
|
|
770
|
+
|
|
771
|
+
const updateCdlValues = () => {
|
|
772
|
+
const answers: any = [];
|
|
773
|
+
|
|
774
|
+
for (const answerCode in Object.fromEntries(selectedAnswers.value)) {
|
|
775
|
+
answers.push(answerCode);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
eventData.value = formatEvent(
|
|
779
|
+
{
|
|
780
|
+
field_name: props.payload.viewModel.label,
|
|
781
|
+
funnel_name: props.payload.viewModel.analytics.funnel_name,
|
|
782
|
+
field_value: answers,
|
|
783
|
+
},
|
|
784
|
+
EventTypeEnum.FIELD,
|
|
785
|
+
);
|
|
786
|
+
};
|
|
764
787
|
</script>
|
|
765
788
|
|
|
766
789
|
<style lang="scss" scoped>
|
|
@@ -7,29 +7,54 @@ export enum ButtonType {
|
|
|
7
7
|
ACTION = 'action',
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
button_location: string;
|
|
13
|
-
button_type: ButtonType;
|
|
10
|
+
export enum CdlEventEnum {
|
|
11
|
+
CDL = 'cdl_event',
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
export enum EventTypeEnum {
|
|
15
|
+
FIELD = 'field',
|
|
16
|
+
BUTTON = 'button',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface FormatEventInterface {
|
|
20
|
+
button_name?: string;
|
|
21
|
+
button_location?: string;
|
|
22
|
+
funnel_name?: string;
|
|
23
|
+
field_name?: string;
|
|
24
|
+
field_value?: any;
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
28
|
+
* Format event click, field
|
|
29
|
+
* @param param0
|
|
30
|
+
* @param type
|
|
31
|
+
* @returns
|
|
26
32
|
*/
|
|
27
|
-
export const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
export const formatEvent = (
|
|
34
|
+
{ button_name, button_location, funnel_name, field_name, field_value }: FormatEventInterface,
|
|
35
|
+
type: EventTypeEnum,
|
|
36
|
+
) => {
|
|
37
|
+
let event_data = {};
|
|
38
|
+
|
|
39
|
+
switch (type) {
|
|
40
|
+
case EventTypeEnum.BUTTON:
|
|
41
|
+
event_data = {
|
|
42
|
+
button_name,
|
|
43
|
+
button_location,
|
|
44
|
+
button_type: ButtonType.ACTION,
|
|
45
|
+
};
|
|
46
|
+
break;
|
|
47
|
+
case EventTypeEnum.FIELD:
|
|
48
|
+
event_data = {
|
|
49
|
+
field_name,
|
|
50
|
+
field_value,
|
|
51
|
+
funnel_name,
|
|
52
|
+
};
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return JSON.stringify({
|
|
57
|
+
event_name: type === EventTypeEnum.BUTTON ? EventName.CLICK : EventName.FIELD,
|
|
58
|
+
event_data,
|
|
34
59
|
});
|
|
35
60
|
};
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
:sticky-bottom-offset="stickyBottomOffset()"
|
|
65
65
|
:min-height="minHeight"
|
|
66
66
|
:is-collaborator="isCollaborator"
|
|
67
|
+
:step-location="state.currentStep?.slots?.beforeContent.label"
|
|
67
68
|
@step-completed="handleStepCompleted"
|
|
68
69
|
@update-selected="handleSemiUpdateSelected"
|
|
69
70
|
@redirection="handleRedirection"
|