project-booster-vue 10.8.2 → 10.9.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "10.8.2",
3
+ "version": "10.9.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -27,7 +27,7 @@
27
27
  <m-flex class="pb-products__container--button" direction="column" align-items="center" justify-content="center">
28
28
  <m-button
29
29
  :theme="action.bordered ? 'bordered' : 'solid'"
30
- class="pb-products__container--button__ok mc-button--full"
30
+ class="pb-products__container--button__ok mc-button--full js-cdl"
31
31
  :type="action.type"
32
32
  :label="action.label"
33
33
  icon-position="right"
@@ -36,6 +36,10 @@
36
36
  v-for="action in payload.callToActions"
37
37
  :key="action.label"
38
38
  @click="callAction(action.action)"
39
+ data-cdl-click-type="cdl_event"
40
+ :data-cdl-click-data="
41
+ formatEvent({ button_name: action.label, button_location: stepLocation }, EventTypeEnum.BUTTON)
42
+ "
39
43
  />
40
44
  </m-flex>
41
45
  </m-flex>
@@ -50,6 +54,7 @@ import MLink from '../mozaic/link/MLink.vue';
50
54
  import MButton from '../mozaic/buttons/MButton.vue';
51
55
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
52
56
  import { WarningMessagePayloadAction } from '@/types/pb/WarningMessage';
57
+ import { EventTypeEnum, formatEvent } from '../rework/services/event';
53
58
 
54
59
  const BACK_ICON =
55
60
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -98,6 +103,18 @@ export default defineComponent({
98
103
  type: Object as PropType<Map<string, ScenarioStepAnswer[]>>,
99
104
  default: () => new Map<string, ScenarioStepAnswer[]>(),
100
105
  },
106
+ /**
107
+ * Get step location
108
+ */
109
+ stepLocation: {
110
+ type: String,
111
+ default: '',
112
+ },
113
+ },
114
+ data() {
115
+ return {
116
+ EventTypeEnum,
117
+ };
101
118
  },
102
119
  computed: {
103
120
  ...mapGetters('products', {
@@ -137,6 +154,7 @@ export default defineComponent({
137
154
  }
138
155
  }
139
156
  },
157
+ formatEvent,
140
158
  },
141
159
  });
142
160
  </script>
@@ -117,6 +117,21 @@
117
117
  @card-click="answer?.viewModel?.href ? '' : selectAnswer(payload.code, answer)"
118
118
  @button-click="handleAnswerButtonClick"
119
119
  @link-click="handleLinkClick(answer)"
120
+ data-cdl-click-type="cdl_event"
121
+ :data-cdl-click-data="
122
+ formatEvent(
123
+ {
124
+ button_name: decorate(
125
+ answers,
126
+ runtimeOptions,
127
+ answer?.viewModel?.title,
128
+ payload.defaultDecoratorValue,
129
+ ),
130
+ button_location: stepLocation || '',
131
+ },
132
+ EventTypeEnum.BUTTON,
133
+ )
134
+ "
120
135
  />
121
136
  <m-button
122
137
  v-else
@@ -206,7 +221,9 @@
206
221
  />
207
222
  <m-button
208
223
  v-if="isValidateMultiselectButtonDisplayed()"
209
- class="pb-question__actions-buttons-button"
224
+ class="pb-question__actions-buttons-button js-cdl"
225
+ data-cdl-click-type="cdl_event"
226
+ :data-cdl-click-data="eventData"
210
227
  size="m"
211
228
  size-from-l="l"
212
229
  :label="payload.multiSelect.actions.VALIDATE.label"
@@ -382,6 +399,7 @@ import {
382
399
  ScenarioCondition,
383
400
  ScenarioStepDialog,
384
401
  } from '@/types/pb/Scenario';
402
+ import { EventTypeEnum, formatEvent } from '../rework/services/event';
385
403
 
386
404
  const BACK_ICON =
387
405
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -461,6 +479,13 @@ export default defineComponent({
461
479
  type: String,
462
480
  default: '0px',
463
481
  },
482
+ /**
483
+ * Define the location of the step in the scenario.
484
+ */
485
+ stepLocation: {
486
+ type: String,
487
+ default: '',
488
+ },
464
489
  },
465
490
 
466
491
  data: () => ({
@@ -485,6 +510,8 @@ export default defineComponent({
485
510
  slotComponent: false,
486
511
  showNotification: false,
487
512
  showModal: false,
513
+ EventTypeEnum,
514
+ eventData: {},
488
515
  }),
489
516
 
490
517
  computed: {
@@ -529,6 +556,7 @@ export default defineComponent({
529
556
  },
530
557
 
531
558
  methods: {
559
+ formatEvent,
532
560
  updateSelectedAnswers() {
533
561
  this.displayedAnswers = [];
534
562
  this.lastItemIndex = 0;
@@ -625,6 +653,8 @@ export default defineComponent({
625
653
  });
626
654
  }
627
655
 
656
+ this.updateCdlValues();
657
+
628
658
  this.$nextTick(() => {
629
659
  this.updatePbQuestionActionsButtonsSizeHeight();
630
660
  });
@@ -650,6 +680,7 @@ export default defineComponent({
650
680
  }
651
681
  }
652
682
 
683
+ this.updateCdlValues();
653
684
  this.$emit(this.completedEventName, {
654
685
  answers: answers,
655
686
  nextStep: multiSelectOptions?.nextStep,
@@ -799,6 +830,26 @@ export default defineComponent({
799
830
  handleShowModal() {
800
831
  this.showModal = !this.showModal;
801
832
  },
833
+ updateCdlValues() {
834
+ let answers: any = [];
835
+
836
+ for (const answerCode in Object.fromEntries(this.selectedAnswers)) {
837
+ if (!answers.includes(answerCode)) {
838
+ answers.push(answerCode);
839
+ } else {
840
+ answers = answers.filter((item: any) => item !== answerCode);
841
+ }
842
+ }
843
+
844
+ this.eventData = formatEvent(
845
+ {
846
+ field_name: this.payload.viewModel?.label || '',
847
+ funnel_name: this.payload.viewModel.analytics?.funnel_name || '',
848
+ field_value: answers || '',
849
+ },
850
+ EventTypeEnum.FIELD,
851
+ );
852
+ },
802
853
  },
803
854
  });
804
855
  </script>
@@ -39,6 +39,14 @@
39
39
  @click="goToNavigation(payload.viewModel.backButton.nextStep)"
40
40
  :data-cerberus="sanitizeCerberusAttribut('MPB-EXIT-OPTIONS', payload.viewModel.backButton.label)"
41
41
  icon="ArrowBack48"
42
+ class="js-cdl"
43
+ data-cdl-click-type="cdl_event"
44
+ :data-cdl-click-data="
45
+ formatEvent(
46
+ { button_name: payload.viewModel.backButton.label, button_location: stepLocation },
47
+ EventTypeEnum.BUTTON,
48
+ )
49
+ "
42
50
  />
43
51
  </div>
44
52
 
@@ -52,6 +60,14 @@
52
60
  :data-cerberus="sanitizeCerberusAttribut('MPB-EXIT-OPTIONS', condition.viewModel.nextStep.label)"
53
61
  icon="ArrowNext48"
54
62
  iconPosition="right"
63
+ class="js-cdl"
64
+ data-cdl-click-type="cdl_event"
65
+ :data-cdl-click-data="
66
+ formatEvent(
67
+ { button_name: payload.viewModel.nextStep.label, button_location: stepLocation },
68
+ EventTypeEnum.BUTTON,
69
+ )
70
+ "
55
71
  />
56
72
  </div>
57
73
  </div>
@@ -65,6 +81,14 @@
65
81
  @click="goToNavigation(payload.viewModel.backButton.nextStep)"
66
82
  :data-cerberus="sanitizeCerberusAttribut('MPB-EXIT-OPTIONS', payload.viewModel.backButton.label)"
67
83
  icon="ArrowBack48"
84
+ class="js-cdl"
85
+ data-cdl-click-type="cdl_event"
86
+ :data-cdl-click-data="
87
+ formatEvent(
88
+ { button_name: payload.viewModel.backButton.label, button_location: stepLocation },
89
+ EventTypeEnum.BUTTON,
90
+ )
91
+ "
68
92
  />
69
93
  </div>
70
94
 
@@ -75,6 +99,14 @@
75
99
  @click="goToNavigation(payload.viewModel.nextStep, payload.viewModel.nextStep.label)"
76
100
  icon="ArrowNext48"
77
101
  iconPosition="right"
102
+ class="js-cdl"
103
+ data-cdl-click-type="cdl_event"
104
+ :data-cdl-click-data="
105
+ formatEvent(
106
+ { button_name: payload.viewModel.nextStep.label, button_location: stepLocation },
107
+ EventTypeEnum.BUTTON,
108
+ )
109
+ "
78
110
  />
79
111
  </div>
80
112
  </div>
@@ -94,6 +126,7 @@ import cloneDeep from 'lodash.clonedeep';
94
126
  import DEFAULT_PAYLOAD from './default-payload.json';
95
127
  import merge from 'lodash.merge';
96
128
  import { decorate } from '@/services/decorate';
129
+ import { formatEvent, EventTypeEnum } from '../services/event';
97
130
 
98
131
  const props = defineProps({
99
132
  /**
@@ -119,6 +152,13 @@ const props = defineProps({
119
152
  type: Object as PropType<Map<string, ScenarioStepAnswer[]>>,
120
153
  default: () => new Map<string, ScenarioStepAnswer[]>(),
121
154
  },
155
+ /**
156
+ * Current step location
157
+ */
158
+ stepLocation: {
159
+ type: String,
160
+ default: '',
161
+ },
122
162
  });
123
163
 
124
164
  const store = useStore();
@@ -27,7 +27,11 @@
27
27
  <div class="pb-products__container--button">
28
28
  <m-button
29
29
  :theme="action.bordered ? 'bordered' : 'solid'"
30
- class="pb-products__container--button__ok"
30
+ class="pb-products__container--button__ok js-cdl"
31
+ data-cdl-click-type="cdl_event"
32
+ :data-cdl-click-data="
33
+ formatEvent({ button_name: action.label, button_location: stepLocation }, EventTypeEnum.BUTTON)
34
+ "
31
35
  :type="action.type"
32
36
  :label="action.label"
33
37
  icon-position="right"
@@ -48,6 +52,7 @@ import { MButton, MLink } from '@mozaic-ds/vue-3';
48
52
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
49
53
  import { defineProps, PropType, onMounted, ref } from 'vue';
50
54
  import { PayloadAction } from '../types/genericPayload';
55
+ import { formatEvent, EventTypeEnum } from '../services/event';
51
56
 
52
57
  const emit = defineEmits(['go-back', 'step-completed']);
53
58
 
@@ -94,6 +99,13 @@ const props = defineProps({
94
99
  type: Object as PropType<Map<string, ScenarioStepAnswer[]>>,
95
100
  default: () => new Map<string, ScenarioStepAnswer[]>(),
96
101
  },
102
+ /**
103
+ * Current step location
104
+ */
105
+ stepLocation: {
106
+ type: String,
107
+ default: '',
108
+ },
97
109
  });
98
110
 
99
111
  /**
@@ -41,7 +41,7 @@
41
41
  :is="loadingComponents[payload.viewModel.answersComponent]"
42
42
  v-if="payload.viewModel.answersComponent !== 'MButton'"
43
43
  :answer-code="answer.code"
44
- class="pb-question__answer__component"
44
+ class="pb-question__answer__component js-cdl"
45
45
  :border-top="answer?.viewModel?.borderColor || null"
46
46
  :image="decorate(answers, runtimeOptions, answer?.viewModel?.image, payload.defaultDecoratorValue)"
47
47
  :image-title="
@@ -92,6 +92,21 @@
92
92
  @card-click="handleCardClick(answer, payload)"
93
93
  @button-click="handleAnswerButtonClick"
94
94
  @link-click="handleLinkClick(answer)"
95
+ data-cdl-click-type="cdl_event"
96
+ :data-cdl-click-data="
97
+ formatEvent(
98
+ {
99
+ button_name: decorate(
100
+ answers,
101
+ runtimeOptions,
102
+ answer?.viewModel?.title,
103
+ payload.defaultDecoratorValue,
104
+ ),
105
+ button_location: stepLocation,
106
+ },
107
+ EventTypeEnum.BUTTON,
108
+ )
109
+ "
95
110
  />
96
111
  <m-button
97
112
  v-else
@@ -135,12 +150,12 @@
135
150
  <div v-if="helpItem.type === 'link'">
136
151
  <m-link
137
152
  class="pb-question__help__link"
138
- :label="helpItem.label"
139
153
  width="full"
140
154
  size="l"
141
155
  theme="primary"
142
156
  @click="handleHelpClick(helpItem.action)"
143
- />
157
+ >{{ helpItem.label }}</m-link
158
+ >
144
159
  </div>
145
160
  </div>
146
161
  </div>
@@ -459,6 +474,13 @@ const props = defineProps({
459
474
  type: String,
460
475
  default: '0px',
461
476
  },
477
+ /**
478
+ * Define the location of the step in the scenario.
479
+ */
480
+ stepLocation: {
481
+ type: String,
482
+ default: '',
483
+ },
462
484
  });
463
485
 
464
486
  const selectedAnswers = ref(new Map<string, boolean>());
@@ -39,6 +39,7 @@
39
39
  :text="notification.text"
40
40
  :link-label="notification.linkLabel"
41
41
  @link-click="handleLinkClicked(notification.linkHref)"
42
+ class="pb-restitution-list__notifications__container__block"
42
43
  />
43
44
  </m-flex>
44
45
  </m-flex>
@@ -101,7 +102,17 @@
101
102
  </template>
102
103
  <template #footer>
103
104
  <m-flex class="pb-restitution-list__modal__footer" align-items="center" justify-content="center">
104
- <m-button label="Fermer" theme="bordered-neutral" @click.prevent="handleShowDialog"></m-button>
105
+ <m-button
106
+ label="Fermer"
107
+ theme="bordered-neutral"
108
+ @click.prevent="handleShowDialog"
109
+ class="js-cdl"
110
+ data-cdl-click-type="cdl_event"
111
+ :data-cdl-click-data="
112
+ formatEvent({ button_name: 'Fermer', button_location: stepLocation }, EventTypeEnum.BUTTON)
113
+ "
114
+ >
115
+ </m-button>
105
116
  </m-flex>
106
117
  </template>
107
118
  </m-modal>
@@ -123,6 +134,7 @@ import { MModal, MButton, MLink, MNotification } from '@mozaic-ds/vue-3';
123
134
  const BACK_ICON =
124
135
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
125
136
  import { sanitizeCerberusAttribut } from '@/services/sanitize';
137
+ import { formatEvent, EventTypeEnum } from '../services/event';
126
138
 
127
139
  export default defineComponent({
128
140
  components: {
@@ -142,6 +154,7 @@ export default defineComponent({
142
154
  notifications: [] as NotificationOptions[],
143
155
  displayedCta: [] as RestitutionPayloadCallToAction[],
144
156
  BACK_ICON,
157
+ EventTypeEnum,
145
158
  };
146
159
  },
147
160
  // eslint-disable-next-line vue/order-in-components
@@ -191,6 +204,13 @@ export default defineComponent({
191
204
  type: Boolean,
192
205
  default: true,
193
206
  },
207
+ /**
208
+ * Current step location
209
+ */
210
+ stepLocation: {
211
+ type: String,
212
+ default: '',
213
+ },
194
214
  },
195
215
  computed: {
196
216
  ...mapGetters('estimates', { summary: 'getSummary' }),
@@ -271,6 +291,7 @@ export default defineComponent({
271
291
  return areConditionsValid(conditions, this.answers, this.runtimeOptions);
272
292
  },
273
293
  sanitizeCerberusAttribut,
294
+ formatEvent,
274
295
  },
275
296
  });
276
297
  </script>
@@ -522,6 +543,10 @@ $responsive-breakpoint: 'm';
522
543
  @include set-from-screen($responsive-breakpoint) {
523
544
  min-width: 100%;
524
545
  }
546
+
547
+ &__block {
548
+ margin-bottom: $mu050;
549
+ }
525
550
  }
526
551
  }
527
552
  }
@@ -1,10 +1,8 @@
1
1
  export enum EventName {
2
2
  CLICK = 'button.click',
3
3
  FIELD = 'step.field',
4
- }
5
-
6
- export enum ButtonType {
7
- ACTION = 'action',
4
+ SUBMIT = 'step.submit',
5
+ DISPLAY = 'step.display',
8
6
  }
9
7
 
10
8
  export enum CdlEventEnum {
@@ -14,14 +12,19 @@ export enum CdlEventEnum {
14
12
  export enum EventTypeEnum {
15
13
  FIELD = 'field',
16
14
  BUTTON = 'button',
15
+ SUBMIT = 'submit',
16
+ DISPLAY = 'display',
17
17
  }
18
18
 
19
19
  export interface FormatEventInterface {
20
20
  button_name?: string;
21
21
  button_location?: string;
22
+ button_type?: string;
22
23
  funnel_name?: string;
23
24
  field_name?: string;
24
25
  field_value?: any;
26
+ step_name?: any;
27
+ step_number?: any;
25
28
  }
26
29
 
27
30
  /**
@@ -31,7 +34,16 @@ export interface FormatEventInterface {
31
34
  * @returns
32
35
  */
33
36
  export const formatEvent = (
34
- { button_name, button_location, funnel_name, field_name, field_value }: FormatEventInterface,
37
+ {
38
+ button_name,
39
+ button_location,
40
+ funnel_name,
41
+ field_name,
42
+ field_value,
43
+ step_name,
44
+ step_number,
45
+ button_type,
46
+ }: FormatEventInterface,
35
47
  type: EventTypeEnum,
36
48
  ): string => {
37
49
  let event_data = {};
@@ -41,7 +53,7 @@ export const formatEvent = (
41
53
  event_data = {
42
54
  button_name,
43
55
  button_location,
44
- button_type: ButtonType.ACTION,
56
+ button_type,
45
57
  };
46
58
  break;
47
59
  case EventTypeEnum.FIELD:
@@ -51,10 +63,35 @@ export const formatEvent = (
51
63
  funnel_name,
52
64
  };
53
65
  break;
66
+ case EventTypeEnum.DISPLAY || EventTypeEnum.SUBMIT:
67
+ event_data = {
68
+ funnel_name,
69
+ step_name,
70
+ step_number,
71
+ };
72
+ break;
54
73
  }
55
74
 
56
75
  return JSON.stringify({
57
- event_name: type === EventTypeEnum.BUTTON ? EventName.CLICK : EventName.FIELD,
76
+ event_name: getEventType(type),
58
77
  event_data,
59
78
  });
60
79
  };
80
+
81
+ /**
82
+ * Get event type
83
+ * @param type
84
+ * @returns
85
+ */
86
+ const getEventType = (type: string) => {
87
+ switch (type) {
88
+ case EventTypeEnum.BUTTON:
89
+ return EventName.CLICK;
90
+ case EventTypeEnum.SUBMIT:
91
+ return EventName.SUBMIT;
92
+ case EventTypeEnum.DISPLAY:
93
+ return EventName.DISPLAY;
94
+ case EventTypeEnum.FIELD:
95
+ return EventName.FIELD;
96
+ }
97
+ };
@@ -230,6 +230,10 @@
230
230
  @click.prevent="callAction(action)"
231
231
  :data-cerberus="sanitizeCerberusAttribut('PB-TREZOR', 'SENDFORM')"
232
232
  :disabled="isSubmitDisabled"
233
+ data-cdl-click-type="cdl_event"
234
+ :data-cdl-click-data="
235
+ formatEvent({ button_name: action.label, button_location: stepLocation }, EventTypeEnum.BUTTON)
236
+ "
233
237
  />
234
238
  </m-flex>
235
239
  </div>
@@ -266,6 +270,7 @@ import objectPath from 'object-path';
266
270
  import { sanitizeCerberusAttribut } from '@/services/sanitize';
267
271
  import { MModal } from '@mozaic-ds/vue-3';
268
272
  import DEFAULT_PAYLOAD from './default-payload.json';
273
+ import { EventTypeEnum, formatEvent } from '../rework/services/event';
269
274
 
270
275
  const BACK_ICON =
271
276
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
@@ -328,6 +333,13 @@ export default defineComponent({
328
333
  default: false,
329
334
  required: false,
330
335
  },
336
+ /**
337
+ * Get step location
338
+ */
339
+ stepLocation: {
340
+ type: String,
341
+ default: '',
342
+ },
331
343
  },
332
344
  setup(props, { emit }) {
333
345
  const store = useStore();
@@ -507,6 +519,8 @@ export default defineComponent({
507
519
  partners,
508
520
  isSubmitDisabled,
509
521
  handleSelectPartner,
522
+ EventTypeEnum,
523
+ formatEvent,
510
524
  };
511
525
  },
512
526
  });