project-booster-vue 9.45.2 → 9.46.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": "9.45.2",
3
+ "version": "9.46.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -9,6 +9,7 @@
9
9
  :role="!buttonLabel ? 'button' : 'article'"
10
10
  :style="`min-height: ${cardMinHeight}; border-color:${borderTop ? borderTop : null}`"
11
11
  @click="handleCardClick"
12
+ :data-cerberus="sanitizeCerberusAttribut('PB-CARD', answerCode)"
12
13
  >
13
14
  <m-flex
14
15
  class="pb-card__container"
@@ -119,6 +120,7 @@ import PbCardSelectionIndicator from './decorators/PbCardSelectionIndicator.vue'
119
120
  import PbCardTypeIndicator from './decorators/PbCardTypeIndicator.vue';
120
121
  import { M_FLEX_VALIDATOR } from '../mozaic/flex/MFlex.vue';
121
122
  import MLink from '../mozaic/link/MLink.vue';
123
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
122
124
 
123
125
  export const PB_CARD_VALIDATOR = {
124
126
  cardMinRatio: ['auto', '16x9', '3x2', '4x3', '1x1', '3x4', '2x3'],
@@ -316,6 +318,13 @@ export default defineComponent({
316
318
  type: String,
317
319
  default: null,
318
320
  },
321
+ /**
322
+ * Get the answer code
323
+ */
324
+ answerCode: {
325
+ type: String,
326
+ default: null,
327
+ },
319
328
  },
320
329
 
321
330
  computed: {
@@ -350,6 +359,7 @@ export default defineComponent({
350
359
  */
351
360
  this.$emit('button-click', { label: this.buttonLabel });
352
361
  },
362
+ sanitizeCerberusAttribut,
353
363
  },
354
364
  });
355
365
  </script>
@@ -71,6 +71,7 @@
71
71
  <component
72
72
  :is="payload.viewModel.answersComponent"
73
73
  v-if="payload.viewModel.answersComponent !== 'MButton'"
74
+ :answer-code="answer.code"
74
75
  class="pb-question__answer__component"
75
76
  :border-top="answer?.viewModel?.borderColor || null"
76
77
  :image="decorate(answers, runtimeOptions, answer?.viewModel?.image, payload.defaultDecoratorValue)"
@@ -67,6 +67,7 @@
67
67
  v-for="action in payload.callToActions"
68
68
  :key="action.label"
69
69
  @click="callAction(action.action)"
70
+ :data-cerberus="sanitizeCerberusAttribut('PB-WARNING-BUTTON', action.action.code)"
70
71
  />
71
72
  </m-flex>
72
73
  </div>
@@ -109,6 +110,7 @@ import SVGInjector from 'svg-injector';
109
110
  import { WarningMessagePayloadAction } from '@/types/pb/WarningMessage';
110
111
  import { DialogContent } from './dialogContent';
111
112
  import { string } from 'yup';
113
+ import { sanitizeCerberusAttribut } from '@/services/sanitize';
112
114
  const BACK_ICON =
113
115
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
114
116
  const WARNING_ICON =
@@ -233,6 +235,7 @@ export default defineComponent({
233
235
  displayDialogHelp,
234
236
  handleHelpDialog,
235
237
  dialogHelpContent,
238
+ sanitizeCerberusAttribut,
236
239
  };
237
240
  },
238
241
  });
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Sanitize cerberus data attribut
3
+ * @param field
4
+ * @param type
5
+ * @returns
6
+ */
7
+ export const sanitizeCerberusAttribut = (field: string, type: string) => {
8
+ if (type) {
9
+ type = slugifyTypeAttribut(type);
10
+ return field.toUpperCase() + '--' + type.toUpperCase();
11
+ } else {
12
+ return field;
13
+ }
14
+ };
15
+
16
+ /**
17
+ * Slugify type of attribut
18
+ * @param type
19
+ * @returns
20
+ */
21
+ export const slugifyTypeAttribut = (type: string) => {
22
+ return type
23
+ .toLowerCase()
24
+ .trim()
25
+ .replace(/[^\w\s-]/g, '')
26
+ .replace(/[\s_-]+/g, '-')
27
+ .replace(/^-+|-+$/g, '');
28
+ };