fcad-core-dragon 2.0.0-beta.5 → 2.0.0-beta.6

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.
Files changed (71) hide show
  1. package/.editorconfig +33 -33
  2. package/.eslintignore +29 -29
  3. package/.eslintrc.cjs +81 -81
  4. package/CHANGELOG +392 -377
  5. package/README.md +71 -71
  6. package/bk.scss +117 -117
  7. package/package.json +61 -61
  8. package/src/$locales/en.json +23 -25
  9. package/src/$locales/fr.json +22 -23
  10. package/src/assets/data/onboardingMessages.json +47 -47
  11. package/src/components/AppBase.vue +166 -99
  12. package/src/components/AppBaseButton.vue +2 -0
  13. package/src/components/AppBaseErrorDisplay.vue +438 -438
  14. package/src/components/AppBaseFlipCard.vue +84 -84
  15. package/src/components/AppBaseModule.vue +164 -106
  16. package/src/components/AppBasePage.vue +14 -4
  17. package/src/components/AppBasePopover.vue +41 -41
  18. package/src/components/AppCompAudio.vue +20 -48
  19. package/src/components/AppCompBranchButtons.vue +7 -53
  20. package/src/components/{AppCompTranscript.vue → AppCompContainer.vue} +8 -1
  21. package/src/components/AppCompInputRadioNext.vue +152 -152
  22. package/src/components/AppCompInputTextToFillNext.vue +171 -171
  23. package/src/components/AppCompJauge.vue +74 -74
  24. package/src/components/AppCompMenu.vue +429 -428
  25. package/src/components/AppCompMenuItem.vue +228 -228
  26. package/src/components/AppCompNavigation.vue +2 -2
  27. package/src/components/AppCompPlayBarNext.vue +5 -0
  28. package/src/components/AppCompPlayBarProgress.vue +82 -82
  29. package/src/components/AppCompSVGNext.vue +2 -3
  30. package/src/components/AppCompSettingsMenu.vue +172 -172
  31. package/src/components/AppCompVideoPlayer.vue +17 -15
  32. package/src/composables/useQuiz.js +206 -206
  33. package/src/externalComps/ModuleView.vue +22 -22
  34. package/src/externalComps/SummaryView.vue +91 -91
  35. package/src/main.js +34 -29
  36. package/src/mixins/$mediaMixins.js +819 -819
  37. package/src/mixins/timerMixin.js +155 -155
  38. package/src/module/stores/appStore.js +1 -1
  39. package/src/module/xapi/ADL.js +144 -4
  40. package/src/module/xapi/Crypto/Hasher.js +241 -241
  41. package/src/module/xapi/Crypto/WordArray.js +278 -278
  42. package/src/module/xapi/Crypto/algorithms/BufferedBlockAlgorithm.js +103 -103
  43. package/src/module/xapi/Crypto/algorithms/C_algo.js +315 -315
  44. package/src/module/xapi/Crypto/algorithms/HMAC.js +9 -9
  45. package/src/module/xapi/Crypto/algorithms/SHA1.js +9 -9
  46. package/src/module/xapi/Crypto/encoders/Base.js +105 -105
  47. package/src/module/xapi/Crypto/encoders/Base64.js +99 -99
  48. package/src/module/xapi/Crypto/encoders/Hex.js +61 -61
  49. package/src/module/xapi/Crypto/encoders/Latin1.js +61 -61
  50. package/src/module/xapi/Crypto/encoders/Utf8.js +45 -45
  51. package/src/module/xapi/Statement/agent.js +55 -55
  52. package/src/module/xapi/Statement/index.js +259 -259
  53. package/src/module/xapi/Statement/statement.js +253 -253
  54. package/src/module/xapi/utils.js +167 -167
  55. package/src/module/xapi/verbs.js +294 -294
  56. package/src/module/xapi/wrapper copy.js +1963 -0
  57. package/src/module/xapi/wrapper.js +121 -188
  58. package/src/module/xapi/xapiStatement.js +444 -444
  59. package/src/plugins/bus.js +8 -8
  60. package/src/plugins/gsap.js +14 -14
  61. package/src/plugins/helper.js +0 -1
  62. package/src/plugins/i18n.js +44 -44
  63. package/src/plugins/save.js +37 -37
  64. package/src/plugins/scorm.js +287 -287
  65. package/src/plugins/xapi.js +11 -11
  66. package/src/public/index.html +33 -33
  67. package/src/router/index.js +2 -1
  68. package/src/router/routes.js +312 -312
  69. package/src/shared/generalfuncs.js +210 -210
  70. package/src/shared/validators.js +2 -0
  71. package/src/components/AppCompPlayBar.vue +0 -1217
@@ -232,7 +232,6 @@ const defaultIconsList = [
232
232
  paths: [
233
233
  {
234
234
  d: 'M428.3,170.42c-9.35-21.99-22.82-41.99-39.68-58.91c-16.94-16.85-36.94-30.32-58.94-39.66 c-22.86-9.8-47.51-14.77-72.38-14.62c-24.88-0.17-49.53,4.79-72.4,14.59c-21.99,9.35-41.99,22.82-58.91,39.68 c-16.85,16.94-30.32,36.94-39.66,58.94c-9.8,22.86-14.78,47.51-14.62,72.38c-0.18,24.88,4.79,49.53,14.59,72.4 c9.35,21.99,22.82,41.99,39.68,58.91c16.94,16.85,36.94,30.32,58.94,39.66c22.86,9.8,47.51,14.77,72.38,14.62 c24.88,0.18,49.53-4.79,72.4-14.59c21.99-9.35,41.99-22.82,58.91-39.68c16.85-16.94,30.32-36.94,39.66-58.94 c9.8-22.86,14.78-47.51,14.62-72.38C443.07,217.94,438.1,193.29,428.3,170.42z M271.95,326.3c0.1,3.91-1.43,7.69-4.21,10.44 c-2.75,2.79-6.53,4.31-10.44,4.21c-3.91,0.1-7.69-1.43-10.44-4.21c-2.78-2.75-4.31-6.53-4.21-10.44v-83.03 c-0.1-3.91,1.43-7.69,4.21-10.44c2.75-2.78,6.53-4.31,10.44-4.21c3.91-0.1,7.69,1.43,10.44,4.21c2.78,2.75,4.31,6.53,4.21,10.44 V326.3z M268.54,190.64c-2.96,3-7.03,4.64-11.24,4.54v0.01c-4.21,0.1-8.28-1.54-11.24-4.55c-3-2.96-4.64-7.03-4.54-11.24 c-0.1-4.21,1.54-8.28,4.54-11.24c2.96-3,7.03-4.64,11.24-4.54c4.21-0.1,8.28,1.54,11.24,4.54c3,2.96,4.64,7.03,4.54,11.24 C273.18,183.61,271.54,187.68,268.54,190.64z'
235
- //d: 'M428.3,170.42c-9.35-21.99-22.82-41.99-39.68-58.91c-16.94-16.85-36.94-30.32-58.94-39.66 c-22.86-9.8-47.51-14.77-72.38-14.62c-24.88-0.17-49.53,4.79-72.4,14.59c-21.99,9.35-41.99,22.82-58.91,39.68 c-16.85,16.94-30.32,36.94-39.66,58.94c-9.8,22.86-14.78,47.51-14.62,72.38c-0.18,24.88,4.79,49.53,14.59,72.4 c9.35,21.99,22.82,41.99,39.68,58.91c16.94,16.85,36.94,30.32,58.94,39.66c22.86,9.8,47.51,14.77,72.38,14.62 c24.88,0.18,49.53-4.79,72.4-14.59c21.99-9.35,41.99-22.82,58.91-39.68c16.85-16.94,30.32-36.94,39.66-58.94 c9.8-22.86,14.78-47.51,14.62-72.38C443.07,217.94,438.1,193.29,428.3,170.42z M271.95,326.3c0.1,3.91-1.43,7.69-4.21,10.44 c-2.75,2.79-6.53,4.31-10.44,4.21c-3.91,0.1-7.69-1.43-10.44-4.21c-2.78-2.75-4.31-6.53-4.21-10.44v-83.03 c-0.1-3.91,1.43-7.69,4.21-10.44c2.75-2.78,6.53-4.31,10.44-4.21c3.91-0.1,7.69,1.43,10.44,4.21c2.78,2.75,4.31,6.53,4.21,10.44 V326.3z M268.54,190.64c-2.96,3-7.03,4.64-11.24,4.54v0.01c-4.21,0.1-8.28-1.54-11.24-4.55c-3-2.96-4.64-7.03-4.54-11.24 c-0.1-4.21,1.54-8.28,4.54-11.24c2.96-3,7.03-4.64,11.24-4.54c4.21-0.1,8.28,1.54,11.24,4.54c3,2.96,4.64,7.03,4.54,11.24 C273.18,183.61,271.54,187.68,268.54,190.64z'
236
235
  }
237
236
  ]
238
237
  },
@@ -248,11 +247,11 @@ const defaultIconsList = [
248
247
  },
249
248
  {
250
249
  id: 'link-icon',
251
- viewBox: '0 0 39 36',
250
+ viewBox: '0 0 13.7 6.5',
252
251
  paths: [
253
252
  {
254
253
  id: 'ico_link',
255
- d: 'M11.2,25.5c-2,0-4-0.8-5.4-2.2c-1.5-1.4-2.3-3.4-2.2-5.4c0-2,0.8-4,2.2-5.4 c1.4-1.5,3.4-2.3,5.4-2.2h5.1c0.3,0,0.7,0.1,0.9,0.4c0.2,0.2,0.4,0.6,0.4,0.9c0,0.3-0.1,0.7-0.4,0.9c-0.2,0.2-0.6,0.4-0.9,0.4h-5.1 c-1.4,0-2.7,0.5-3.6,1.5c-1,0.9-1.5,2.3-1.5,3.6c0,1.4,0.5,2.7,1.5,3.6c0.9,1,2.3,1.5,3.6,1.5h5.1c0.3,0,0.7,0.1,0.9,0.4 c0.2,0.2,0.4,0.6,0.4,0.9c0,0.3-0.1,0.7-0.4,0.9c-0.2,0.2-0.6,0.4-0.9,0.4L11.2,25.5z M14.5,19.1c-0.3,0-0.7-0.1-0.9-0.4 c-0.2-0.2-0.4-0.6-0.4-0.9c0-0.3,0.1-0.7,0.4-0.9c0.2-0.2,0.6-0.4,0.9-0.4h10.1c0.3,0,0.7,0.1,0.9,0.4c0.2,0.2,0.4,0.6,0.4,0.9 c0,0.3-0.1,0.7-0.4,0.9c-0.2,0.2-0.6,0.4-0.9,0.4H14.5z M22.8,25.5c-0.3,0-0.7-0.1-0.9-0.4c-0.2-0.2-0.4-0.6-0.4-0.9 c0-0.3,0.1-0.7,0.4-0.9c0.2-0.2,0.6-0.4,0.9-0.4h5.1c1.4,0,2.7-0.5,3.6-1.5c1-0.9,1.5-2.3,1.5-3.6c0-1.4-0.5-2.7-1.5-3.6 c-0.9-1-2.3-1.5-3.6-1.5h-5.1c-0.3,0-0.7-0.1-0.9-0.4c-0.2-0.2-0.4-0.6-0.4-0.9c0-0.3,0.1-0.7,0.4-0.9c0.2-0.2,0.6-0.4,0.9-0.4h5.1 c2,0,4,0.8,5.4,2.2c1.5,1.4,2.3,3.4,2.2,5.4c0,2-0.8,4-2.2,5.4c-1.4,1.5-3.4,2.3-5.4,2.2L22.8,25.5z'
254
+ d: 'M3.3 6.5c-.9 0-1.7-.3-2.3-1-.6-.6-1-1.4-1-2.3S.3 1.6 1 1c.6-.6 1.4-1 2.3-1h2.2c.2 0 .3 0 .4.2.1.1.2.2.2.4s0 .3-.2.4c-.1.1-.2.2-.4.2H3.3q-.9 0-1.5.6t-.6 1.5c0 .9.2 1.1.6 1.5q.6.6 1.5.6h2.2c.2 0 .3 0 .4.2.1.1.2.2.2.4s0 .3-.2.4c-.1.1-.2.2-.4.2H3.3Zm1.4-2.7c-.2 0-.3 0-.4-.2-.1-.1-.2-.2-.2-.4s0-.3.2-.4c.1-.1.2-.2.4-.2H9c.2 0 .3 0 .4.2.1.1.2.2.2.4s0 .3-.2.4c-.1.1-.2.2-.4.2zm3.5 2.7c-.2 0-.3 0-.4-.2-.1-.1-.2-.2-.2-.4s0-.3.2-.4c.1-.1.2-.2.4-.2h2.2q.9 0 1.5-.6t.6-1.5c0-.9-.2-1.1-.6-1.5q-.6-.6-1.5-.6H8.2c-.2 0-.3 0-.4-.2-.1-.1-.2-.2-.2-.4s0-.3.2-.4c.1-.1.2-.2.4-.2h2.2c.9 0 1.7.3 2.3 1 .6.6 1 1.4 1 2.3s-.3 1.7-1 2.3c-.6.6-1.4 1-2.3 1z'
256
255
  }
257
256
  ]
258
257
  },
@@ -1,172 +1,172 @@
1
- <template>
2
- <b-sidebar
3
- id="sidebar-settings"
4
- title="Settings"
5
- right
6
- shadow
7
- backdrop
8
- no-header
9
- @hidden="onClose"
10
- >
11
- <div class="pl-3 pr-3">
12
- <b-form-group :label="$t('user_settings.title')">
13
- <b-form-checkbox
14
- v-for="(setting, index) in Object.entries(settingsSelected)"
15
- :key="index"
16
- v-model="settingsSelected[setting[0]]"
17
- :aria-describedby="ariaDescribedby"
18
- :name="`parameter-${setting[0]}`"
19
- :text-field="$t(`user_settings.${setting[0]}`)"
20
- switch
21
- stacked
22
- size="lg"
23
- @change="onSettingsChange"
24
- >
25
- <span>{{ $t(`user_settings.${setting[0]}`) }}</span>
26
- </b-form-checkbox>
27
- </b-form-group>
28
- <app-base-button
29
- v-b-toggle.sidebar-settings
30
- class="float-right btn-primary"
31
- :title="$t('user_settings.close')"
32
- >
33
- {{ $t('user_settings.close') }}
34
- </app-base-button>
35
- </div>
36
- </b-sidebar>
37
- </template>
38
-
39
- <script>
40
- import { mapState, mapActions } from 'pinia'
41
- import { useAppStore } from '../module/stores/appStore'
42
- import AppBaseButton from './AppBaseButton.vue'
43
-
44
- export default {
45
- components: { AppBaseButton },
46
- props: {},
47
- data() {
48
- return {
49
- settingsSelected: {},
50
- settingsNeedUpdate: false
51
- }
52
- },
53
- computed: {
54
- ...mapState(useAppStore, [
55
- 'getApplicationSettings',
56
- 'getModuleInfo',
57
- 'getUserInteraction',
58
- 'getConnectionInfo',
59
- 'onboardingEnabled'
60
- ]),
61
- settingsOptions() {
62
- return this.settingsOptionsELPlus
63
- }
64
- },
65
- watch: {
66
- getApplicationSettings: {
67
- immediate: true,
68
- deep: true,
69
- handler() {
70
- this.getAppSettingsInStore()
71
- }
72
- }
73
- },
74
- created() {
75
- setTimeout(() => this.getAppSettingsInStore(), 1700)
76
-
77
- this.$bus.$on('save-settings', (settings) => {
78
- this.saveSettings(settings)
79
- })
80
- },
81
- methods: {
82
- ...mapActions(useAppStore, [
83
- 'setApplicationSettings',
84
- 'updateUserMetaData'
85
- ]),
86
- getAppSettingsInStore() {
87
- this.settingsSelected = { ...this.getApplicationSettings }
88
- },
89
-
90
- //Save user settings to the store
91
- onSettingsChange() {
92
- this.settingsNeedUpdate = true
93
- this.saveSettingsToStore(this.settingsSelected)
94
- },
95
- saveSettingsToStore(settings) {
96
- this.setApplicationSettings(settings)
97
- },
98
- /**
99
- * @description Save the user preferred settings to vue store and LRS or local store:
100
- * LRS: Send a XAPI Statement to the LRS
101
- * IndexedDB: Set a new Key for preferred settings in the userInteraction in store
102
- * Update current value of settings
103
- * @param {Object} appSettings - group of application settings {autoplay, subtitles, onboarding}
104
- *
105
- */
106
- saveSettings(appSettings) {
107
- this.saveSettingsToStore(appSettings) //save to store
108
-
109
- if (
110
- this.getModuleInfo.packageType === 'xapi' &&
111
- this.getConnectionInfo &&
112
- this.getConnectionInfo.remote
113
- ) {
114
- let text
115
- //Defining the text to display for stmt description and definition
116
- switch (this.$i18n.locale) {
117
- case 'fr':
118
- if (this.getModuleInfo.courseID)
119
- text = `Le ${this.getModuleInfo.id} de ${this.getModuleInfo.courseID}`
120
- else text = `Le ${this.getModuleInfo.id}`
121
- break
122
- case 'en':
123
- if (this.getModuleInfo.courseID)
124
- text = `The ${this.getModuleInfo.id} of ${this.getModuleInfo.courseID}`
125
- else text = `The ${this.getModuleInfo.id}`
126
- break
127
- }
128
- //Creating custom statement
129
- const stmt = {
130
- id: (() => {
131
- return this.getModuleInfo.courseID
132
- ? this.getModuleInfo.courseID
133
- : null
134
- })(),
135
- verb: 'preferred',
136
- definition: text,
137
- description: text,
138
- extensions: [
139
- {
140
- id: 'application-settings',
141
- content: {
142
- userSettings: { ...appSettings }
143
- }
144
- }
145
- ]
146
- }
147
-
148
- setTimeout(() => {
149
- this.$bus.$emit('send-xapi-statement', stmt) //send xapi statement
150
- }, 1000)
151
- } else {
152
- this.$set(this.getUserInteraction, 'userSettings', appSettings) // adding the usersettings to user Interaction to save to save to the local DB
153
- this.updateUserMetaData(this.getUserInteraction) //force update of the userInteraction to ensure saving of settings in local DB
154
- }
155
-
156
- //update sidebar data
157
- this.getAppSettingsInStore()
158
- },
159
-
160
- /**
161
- * @description -Action to perform when the sidebar closed- will require saving when changing occurred
162
- */
163
- onClose() {
164
- if (this.settingsNeedUpdate) {
165
- this.saveSettingsToStore(this.settingsSelected)
166
- this.saveSettings(this.getApplicationSettings)
167
- this.settingsNeedUpdate = false
168
- }
169
- }
170
- }
171
- }
172
- </script>
1
+ <template>
2
+ <b-sidebar
3
+ id="sidebar-settings"
4
+ title="Settings"
5
+ right
6
+ shadow
7
+ backdrop
8
+ no-header
9
+ @hidden="onClose"
10
+ >
11
+ <div class="pl-3 pr-3">
12
+ <b-form-group :label="$t('user_settings.title')">
13
+ <b-form-checkbox
14
+ v-for="(setting, index) in Object.entries(settingsSelected)"
15
+ :key="index"
16
+ v-model="settingsSelected[setting[0]]"
17
+ :aria-describedby="ariaDescribedby"
18
+ :name="`parameter-${setting[0]}`"
19
+ :text-field="$t(`user_settings.${setting[0]}`)"
20
+ switch
21
+ stacked
22
+ size="lg"
23
+ @change="onSettingsChange"
24
+ >
25
+ <span>{{ $t(`user_settings.${setting[0]}`) }}</span>
26
+ </b-form-checkbox>
27
+ </b-form-group>
28
+ <app-base-button
29
+ v-b-toggle.sidebar-settings
30
+ class="float-right btn-primary"
31
+ :title="$t('user_settings.close')"
32
+ >
33
+ {{ $t('user_settings.close') }}
34
+ </app-base-button>
35
+ </div>
36
+ </b-sidebar>
37
+ </template>
38
+
39
+ <script>
40
+ import { mapState, mapActions } from 'pinia'
41
+ import { useAppStore } from '../module/stores/appStore'
42
+ import AppBaseButton from './AppBaseButton.vue'
43
+
44
+ export default {
45
+ components: { AppBaseButton },
46
+ props: {},
47
+ data() {
48
+ return {
49
+ settingsSelected: {},
50
+ settingsNeedUpdate: false
51
+ }
52
+ },
53
+ computed: {
54
+ ...mapState(useAppStore, [
55
+ 'getApplicationSettings',
56
+ 'getModuleInfo',
57
+ 'getUserInteraction',
58
+ 'getConnectionInfo',
59
+ 'onboardingEnabled'
60
+ ]),
61
+ settingsOptions() {
62
+ return this.settingsOptionsELPlus
63
+ }
64
+ },
65
+ watch: {
66
+ getApplicationSettings: {
67
+ immediate: true,
68
+ deep: true,
69
+ handler() {
70
+ this.getAppSettingsInStore()
71
+ }
72
+ }
73
+ },
74
+ created() {
75
+ setTimeout(() => this.getAppSettingsInStore(), 1700)
76
+
77
+ this.$bus.$on('save-settings', (settings) => {
78
+ this.saveSettings(settings)
79
+ })
80
+ },
81
+ methods: {
82
+ ...mapActions(useAppStore, [
83
+ 'setApplicationSettings',
84
+ 'updateUserMetaData'
85
+ ]),
86
+ getAppSettingsInStore() {
87
+ this.settingsSelected = { ...this.getApplicationSettings }
88
+ },
89
+
90
+ //Save user settings to the store
91
+ onSettingsChange() {
92
+ this.settingsNeedUpdate = true
93
+ this.saveSettingsToStore(this.settingsSelected)
94
+ },
95
+ saveSettingsToStore(settings) {
96
+ this.setApplicationSettings(settings)
97
+ },
98
+ /**
99
+ * @description Save the user preferred settings to vue store and LRS or local store:
100
+ * LRS: Send a XAPI Statement to the LRS
101
+ * IndexedDB: Set a new Key for preferred settings in the userInteraction in store
102
+ * Update current value of settings
103
+ * @param {Object} appSettings - group of application settings {autoplay, subtitles, onboarding}
104
+ *
105
+ */
106
+ saveSettings(appSettings) {
107
+ this.saveSettingsToStore(appSettings) //save to store
108
+
109
+ if (
110
+ this.getModuleInfo.packageType === 'xapi' &&
111
+ this.getConnectionInfo &&
112
+ this.getConnectionInfo.remote
113
+ ) {
114
+ let text
115
+ //Defining the text to display for stmt description and definition
116
+ switch (this.$i18n.locale) {
117
+ case 'fr':
118
+ if (this.getModuleInfo.courseID)
119
+ text = `Le ${this.getModuleInfo.id} de ${this.getModuleInfo.courseID}`
120
+ else text = `Le ${this.getModuleInfo.id}`
121
+ break
122
+ case 'en':
123
+ if (this.getModuleInfo.courseID)
124
+ text = `The ${this.getModuleInfo.id} of ${this.getModuleInfo.courseID}`
125
+ else text = `The ${this.getModuleInfo.id}`
126
+ break
127
+ }
128
+ //Creating custom statement
129
+ const stmt = {
130
+ id: (() => {
131
+ return this.getModuleInfo.courseID
132
+ ? this.getModuleInfo.courseID
133
+ : null
134
+ })(),
135
+ verb: 'preferred',
136
+ definition: text,
137
+ description: text,
138
+ extensions: [
139
+ {
140
+ id: 'application-settings',
141
+ content: {
142
+ userSettings: { ...appSettings }
143
+ }
144
+ }
145
+ ]
146
+ }
147
+
148
+ setTimeout(() => {
149
+ this.$bus.$emit('send-xapi-statement', stmt) //send xapi statement
150
+ }, 1000)
151
+ } else {
152
+ this.$set(this.getUserInteraction, 'userSettings', appSettings) // adding the usersettings to user Interaction to save to save to the local DB
153
+ this.updateUserMetaData(this.getUserInteraction) //force update of the userInteraction to ensure saving of settings in local DB
154
+ }
155
+
156
+ //update sidebar data
157
+ this.getAppSettingsInStore()
158
+ },
159
+
160
+ /**
161
+ * @description -Action to perform when the sidebar closed- will require saving when changing occurred
162
+ */
163
+ onClose() {
164
+ if (this.settingsNeedUpdate) {
165
+ this.saveSettingsToStore(this.settingsSelected)
166
+ this.saveSettings(this.getApplicationSettings)
167
+ this.settingsNeedUpdate = false
168
+ }
169
+ }
170
+ }
171
+ }
172
+ </script>
@@ -40,7 +40,7 @@
40
40
  :id="id"
41
41
  ref="m-video"
42
42
  :poster="vidPoster"
43
- @loadedmetadata="updateMediaData($event)"
43
+ @loadedmetadata="updateMediaDataVideo($event.target)"
44
44
  >
45
45
  <source
46
46
  v-for="(aSource, index) in vidSources"
@@ -155,6 +155,17 @@ export default {
155
155
 
156
156
  methods: {
157
157
  ...mapActions(useAppStore, ['updateCurrentMediaElements']),
158
+ /**
159
+ * @description search the DOM for medias with duplicated ID declaration in the page
160
+ * @return return Array of all DOM MediaElement with same id
161
+ */
162
+ checkDuplicatedID() {
163
+ const mediaList = document.querySelectorAll('.__media-container')
164
+ const duplicate = Array.from(mediaList).filter((media) =>
165
+ media.id.includes(this.id)
166
+ )
167
+ return duplicate
168
+ },
158
169
  errorHandling(e) {
159
170
  this.hasSourceLoadingError = true
160
171
  },
@@ -175,24 +186,15 @@ export default {
175
186
  * @param {htmlElement} e
176
187
  * @fires update-page to AppBaseModule.vue
177
188
  */
178
- updateMediaData(e) {
179
- //dispatch loading status of for this component
180
-
189
+ updateMediaDataVideo(e) {
181
190
  this.$bus.$emit('set-comp-status', 'AppCompMediaPlayer', 'loading')
182
191
  this.$bus.$emit('update-media-duration')
183
- //Should Check that the the media Element is unique im Media Liste
184
- const { mElements } = this.getCurrentPage
185
-
186
- const hasEntry = mElements.findLastIndex(
187
- (media) => media.id === e.target.id
188
- )
189
192
 
190
- if (hasEntry !== -1) {
191
- // Should report Error to Console and Component template about this media
192
- const errmsg = `Cet élément a le même ID q'un autre media. Vous ne devez pas avoir de médias avec le même ID dans une page.`
193
+ if (this.checkDuplicatedID().length > 1) {
194
+ const errmsg = `Cet élément a le même ID (<b>${this.id}</b>) q'un autre media. Vous ne devez pas avoir de médias avec le même ID dans une page.`
193
195
 
194
196
  console.warn(
195
- `%c WARNING!>>> You cannot use the same ID in your media elements`,
197
+ `%c WARNING!>>> You cannot use the same ID (${this.id}) in your media elements for your page.`,
196
198
  'background: orange; color: white; display: block; border-radius:5px; margin:5px;'
197
199
  )
198
200
 
@@ -200,7 +202,7 @@ export default {
200
202
  return this.hasErr.push(errmsg)
201
203
  }
202
204
 
203
- this.updateCurrentMediaElements(e.target).then(() => {
205
+ this.updateCurrentMediaElements(e).then(() => {
204
206
  this.isSet = true
205
207
  this.$bus.$emit('set-comp-status', 'AppCompMediaPlayer', 'ready')
206
208
  })