fcad-core-dragon 2.2.0 → 2.3.0-test.2

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.
@@ -29,8 +29,6 @@
29
29
  />
30
30
  </nav>
31
31
  <base-module :m-data="$data">
32
-
33
-
34
32
  <v-container
35
33
  id="wrapper-content"
36
34
  fluid
@@ -376,6 +374,7 @@ export default {
376
374
  'normal',
377
375
  'branching'
378
376
  ]
377
+
379
378
  if (trackedRouteType.includes(this.$route.meta.type)) {
380
379
  //Navigation should only trigger timer and xapi statement when app is ready and activity has changed
381
380
  if (!this.activityHasChanged || !this.appReady) return
@@ -440,7 +439,6 @@ export default {
440
439
  this.getConnectionInfo.remote
441
440
  ) {
442
441
  const lessonPosition = this.getLessonPosition
443
-
444
442
  const lastReached = lessonPosition.length ? lessonPosition[0] : ''
445
443
 
446
444
  //only Send savepoint statement when 3 navigation happen and the route is different from last saved
@@ -471,11 +469,26 @@ export default {
471
469
  extensions: [
472
470
  {
473
471
  id: 'ending-point',
474
- content: (() =>
475
- this.$route.name == 'menu'
476
- ? this.$helper.getRoutesFromVueRouter().meta.children[0]
477
- ._namedRoute
478
- : this.$route.name)()
472
+ content: (() => {
473
+ const {
474
+ name,
475
+ meta: { activity_ref, id, type }
476
+ } = this.$route
477
+ let bookmark = {
478
+ name,
479
+ activity_ref,
480
+ id,
481
+ type
482
+ }
483
+ if (this.$route.name == 'menu') {
484
+ bookmark =
485
+ this.getLessonPosition.length > 0
486
+ ? this.getLessonPosition[0]
487
+ : this.$helper.getRoutesFromVueRouter().meta
488
+ .children[0]
489
+ }
490
+ return bookmark
491
+ })()
479
492
  }
480
493
  ],
481
494
  duration: this.appTimer.ISOTimeParser(this.lessonDuration)
@@ -548,21 +561,13 @@ export default {
548
561
  this.updateIntroStatus(this.theIntroIsActivated)
549
562
  //Communication events
550
563
  this.$bus.$on('open-popup', this.openPopup)
551
-
552
564
  this.$bus.$on('close-popup', this.closePopup)
553
-
554
565
  this.$bus.$on('start-onboarding', this.startOnboarding)
555
-
556
566
  this.$bus.$on('open-sidebar', this.openSidebar)
557
-
558
567
  this.$bus.$on('close-sidebar', this.closeSidebar)
559
-
560
568
  this.$bus.$on('videoFullScreen', this.onVideoFullScreen)
561
-
562
569
  this.$bus.$on('save-to-scorm', this.saveToScorm)
563
-
564
570
  this.$bus.$on('launch-xapi-resource', this.launchResource)
565
-
566
571
  this.$bus.$on('update-route-history', this.updateRouteHistory)
567
572
  this.$bus.$on('update-content', this.updateContent)
568
573
  this.$bus.$on('show-transcript', this.openTranscript)
@@ -664,7 +669,6 @@ export default {
664
669
  //delay animation
665
670
  this.rightSidebarVisible = true
666
671
  this.updatesideBIsOpen(this.rightSidebarVisible)
667
- // setTimeout(() => {
668
672
  const rightSidebarContent = this.getRightSidebar() // Emelent displayed in the sidebar-body
669
673
  if (!rightSidebarContent) return
670
674
  rightSidebarContent.scrollTop = 0
@@ -672,7 +676,6 @@ export default {
672
676
  rSidebar.dispatchEvent(this.rightSidebarEvent)
673
677
  rSidebar.setAttribute('tabindex', -1)
674
678
  this.resetFocus(rSidebar) //set focus on the sidebar
675
- // }, 100)
676
679
  },
677
680
  /**
678
681
  * @description close the right sidebar component
@@ -852,7 +855,6 @@ export default {
852
855
  this.$bus.$emit('set-comp-status', 'appBaseModule', 'loading')
853
856
  this.updateCurrentTimeline(null)
854
857
  this.updateCurrentMediaElements([])
855
- // this.updateCurrentPage({})
856
858
  this.$bus.$emit('set-comp-status', 'appBaseModule', 'ready')
857
859
  res(this.getCompStatusTracker)
858
860
  })
@@ -1016,7 +1018,6 @@ export default {
1016
1018
 
1017
1019
  // Add route route in history
1018
1020
  this.routeData.push(from.meta)
1019
-
1020
1021
  if (this.routeData.length >= 4) this.routeData.shift()
1021
1022
  },
1022
1023
 
@@ -1067,17 +1068,15 @@ export default {
1067
1068
  this.nextOnboarding('message_1')
1068
1069
  } catch (e) {
1069
1070
  //fetch default values for popups
1070
- this.onboardingMessages = import(
1071
- '../assets/data/onboardingMessages.json'
1072
- )
1071
+ this.onboardingMessages =
1072
+ import('../assets/data/onboardingMessages.json')
1073
1073
  this.nextOnboarding('message_1')
1074
1074
  }
1075
1075
  }
1076
1076
  } else {
1077
1077
  if (this.getOnboardingEnabled) {
1078
- this.onboardingMessages = import(
1079
- '../assets/data/onboardingMessages.json'
1080
- )
1078
+ this.onboardingMessages =
1079
+ import('../assets/data/onboardingMessages.json')
1081
1080
  this.nextOnboarding('message_1')
1082
1081
  }
1083
1082
  }
@@ -1421,7 +1420,18 @@ export default {
1421
1420
  {
1422
1421
  id: 'user-data',
1423
1422
  content: {
1424
- routeHistory: this.getRouteHistory,
1423
+ routeHistory: (() => {
1424
+ const history = this.getRouteHistory.toReversed() //get the route history from the last
1425
+
1426
+ if (this.$route.name !== 'menu')
1427
+ history[0] = this.$route.meta // change the last recored route to the current route
1428
+
1429
+ return history.toReversed()
1430
+ })(),
1431
+
1432
+ playbarValues: {
1433
+ ...this.getMediaPlaybarValues()
1434
+ },
1425
1435
  ...lessonsData
1426
1436
  }
1427
1437
  }
@@ -1469,7 +1479,17 @@ export default {
1469
1479
  {
1470
1480
  id: 'user-data',
1471
1481
  content: {
1472
- routeHistory: this.getRouteHistory,
1482
+ routeHistory: (() => {
1483
+ const history = this.getRouteHistory.toReversed() //get the route history from the last
1484
+
1485
+ if (this.$route.name !== 'menu')
1486
+ history[0] = this.$route.meta // change the last recored route to the current route
1487
+
1488
+ return history.toReversed()
1489
+ })(),
1490
+ playbarValues: {
1491
+ ...this.getMediaPlaybarValues()
1492
+ },
1473
1493
  ...lessonsData
1474
1494
  }
1475
1495
  }
@@ -95,7 +95,6 @@ export default {
95
95
  }
96
96
  },
97
97
  setup(props) {
98
- //console.log('dans setup')
99
98
  const store = useAppStore()
100
99
  const { activityRef, id: pageID, type: pageType } = props.pageData
101
100
  const { t } = useI18n()
@@ -374,8 +373,6 @@ export default {
374
373
  /**
375
374
  * Observe changes in the number of poperties to dispatch updates in the userdata in the Store
376
375
  */
377
- // console.log('ici')
378
- //console.log(this.userInteraction)
379
376
  if (newValue && Object.entries(this.userInteraction).length) {
380
377
  await this.store.updateUserMetaData({
381
378
  activityRef: this.pageData.activityRef,
@@ -20,7 +20,8 @@
20
20
  <label :for="`${id}_${textInput.id}-champ`" style="display: none">
21
21
  {{ $t('text.quiz') }}
22
22
  </label>
23
-
23
+ {{ textInput }}
24
+ {{ textInput.index }}
24
25
  <v-text-field
25
26
  v-if="textInput.type == 'input'"
26
27
  :id="`${id}_${textInput.id}-champ`"
@@ -112,7 +112,8 @@ export default {
112
112
  'getMenuSettings',
113
113
  'getAppDebugMode',
114
114
  'getAppConfigs',
115
- 'getAllCompleted'
115
+ 'getAllCompleted',
116
+ 'getLessonPosition'
116
117
  ]),
117
118
  appDebugMode() {
118
119
  return this.getAppDebugMode
@@ -177,10 +178,12 @@ export default {
177
178
  }
178
179
  }, 2000)
179
180
  },
181
+
180
182
  //Go to the last route you were before the menu
181
183
  GoToLastRoute() {
182
184
  let lastRoute
183
185
  let path
186
+
184
187
  //Get all activity state (menu not included)
185
188
  const { allActivitiesState } = this.progressWithMenu()
186
189
  let state = Object.values(allActivitiesState)
@@ -200,7 +203,10 @@ export default {
200
203
  }
201
204
 
202
205
  // create path from the last you saw
203
- if (lastRoute) path = this.createdRoute(lastRoute)
206
+ if (lastRoute)
207
+ path = this.createdRoute(
208
+ this.getRouteHistory[this.getRouteHistory.length - 1]
209
+ )
204
210
 
205
211
  return path
206
212
  },
@@ -236,6 +242,10 @@ export default {
236
242
 
237
243
  //Define path
238
244
  path = page !== ' ' ? `${activity}.page_${page}` : activity
245
+
246
+ if (path == 'activite_0') path = 'introduction'
247
+ if (path == 'activite_99') path = 'conclusion'
248
+
239
249
  return path
240
250
  },
241
251
  progressWithMenu() {
@@ -351,10 +351,6 @@ export default {
351
351
  const elTarget = widgetContent.namedItem(ref) // Target current button
352
352
  const pageRef = elTarget.getAttribute('pageref')
353
353
 
354
- console.log('widgetContent :', widgetContent)
355
- console.log('elTarget :', elTarget)
356
- console.log('pageRef :', pageRef)
357
-
358
354
  if (!this.sideBarIsOpen) this.prevNote = null //reset previous when sidebar is opened
359
355
 
360
356
  let prevPageref = this.prevNote
@@ -922,7 +922,6 @@ export default {
922
922
  //window handlers for playbar progress
923
923
  window.addEventListener('mousemove', this.progressWindowMove)
924
924
  window.addEventListener('mouseup', this.progressWindowUp)
925
- // console.log('⚠️--- TEST AppCompPlayBarNext---', this.mediaElement)
926
925
  //Update data when media as a timeupdate/ended
927
926
  this.mediaElement.addEventListener(
928
927
  'timeupdate',
@@ -1635,7 +1634,6 @@ export default {
1635
1634
  */
1636
1635
  toggleFullScreen() {
1637
1636
  const fullscreenElement = this.mediaContainer
1638
- //console.log(fullscreenElement)
1639
1637
 
1640
1638
  if (document.fullscreenElement) {
1641
1639
  // exitFullscreen is only available on the Document object.
@@ -512,4 +512,17 @@ export default {
512
512
  .custom-control {
513
513
  z-index: 0;
514
514
  }
515
+
516
+ .math-ex-infinity{
517
+
518
+ div.box-btn{
519
+ display: flex;
520
+ flex-wrap: wrap;
521
+ flex-direction: row;
522
+
523
+ :last-child{
524
+ margin-left: 10px;
525
+ }
526
+ }
527
+ }
515
528
  </style>
package/src/main.js CHANGED
@@ -6,7 +6,6 @@ import AppBaseFlipCard from './components/AppBaseFlipCard.vue'
6
6
  import AppBasePopover from './components/AppBasePopover.vue'
7
7
  import AppCompJauge from './components/AppCompJauge.vue'
8
8
  import AppBaseErrorDisplay from './components/AppBaseErrorDisplay.vue'
9
- //import AppCompBif from './components/AppCompBif.vue'
10
9
  import AppCompAudio from './components/AppCompAudio.vue'
11
10
  import AppCompBranchButtons from './components/AppCompBranchButtons.vue'
12
11
  import AppCompCarousel from './components/AppCompCarousel.vue'
@@ -45,6 +44,7 @@ import fcadRouter from './router/index.js'
45
44
  import '@mdi/font/css/materialdesignicons.css'
46
45
  import 'vuetify/styles'
47
46
  import { createVuetify } from 'vuetify'
47
+
48
48
  import { fr, en } from 'vuetify/locale'
49
49
 
50
50
  const pinia = createPinia()
@@ -60,6 +60,7 @@ export default {
60
60
  app.component('FocusTrap', FocusTrap)
61
61
  app.use(eventBus)
62
62
  app.use($idb)
63
+
63
64
  const vuetify = createVuetify({
64
65
  locale: {
65
66
  locale: 'fr',
@@ -76,7 +77,6 @@ export default {
76
77
  app.component('AppBaseFlipCard', AppBaseFlipCard)
77
78
  app.component('AppBaseErrorDisplay', AppBaseErrorDisplay)
78
79
  app.component('AppCompMenu', AppCompMenu)
79
- //app.component('app-comp-bif', AppCompBif)
80
80
  app.component('AppCompAudioPlayer', AppCompAudio)
81
81
  app.component('AppCompBranchButtons', AppCompBranchButtons)
82
82
  app.component('AppCompCarousel', AppCompCarousel)
@@ -125,7 +125,6 @@ export default {
125
125
  ({
126
126
  name, // name of the action
127
127
  store, // store instance, same as `someStore`
128
- args, // array of parameters passed to the action
129
128
  after // hook after the action returns or resolves
130
129
  }) => {
131
130
  after(async (result) => {
@@ -189,8 +188,7 @@ export default {
189
188
 
190
189
  if (playbarValues)
191
190
  appStore.$state.mediaPlaybarValues = playbarValues
192
-
193
- if (lessonPosition) appStore.setLessonPosition(lessonPosition)
191
+ if (lessonPosition) appStore.setLessonPosition([lessonPosition])
194
192
  if (completedState) appStore.setCompletionState(completedState)
195
193
  }
196
194
  //Open Connection to IDB and Save the store state to localDB
@@ -278,9 +276,19 @@ export default {
278
276
  }
279
277
  }
280
278
  // Get LRS autorisation info from serveur
281
- const request = await axios.get('../../configs-xapi/xapi.json')
282
-
283
- const { basicauth } = request.data
279
+ const request = await axios.get(
280
+ '../../configs-xapi/xapi-org.json'
281
+ )
282
+ let { organization = null } = data
283
+ const { basicauth } =
284
+ organization && request.data[organization.toLowerCase()]
285
+ ? (() => request.data[organization.toLowerCase()])()
286
+ : (() => {
287
+ console.warn(
288
+ `🚩 No organization found with the name '${organization}'. will default to organization 'root'.`
289
+ )
290
+ return request.data.root
291
+ })()
284
292
 
285
293
  c.auth = basicauth
286
294
  connectionInfo = c
@@ -332,7 +340,7 @@ export default {
332
340
  }
333
341
  /* Local Method for data fetching */
334
342
  const fetchDatasFromServer = async (config) => {
335
- const {
343
+ let {
336
344
  $scorm,
337
345
  $xapi,
338
346
  $idb,
@@ -344,13 +352,19 @@ export default {
344
352
  remote
345
353
  } = config
346
354
 
355
+ if (window.location.hostname.includes('cegepadistance.ca')) remote = true
356
+
347
357
  let server = remote ? specification : 'local'
358
+
359
+ const unknownHost =
360
+ !window.location.hostname.includes('cegepadistance.ca') &&
361
+ window.location.hostname !== 'localhost'
348
362
  //falback to idb when scorm and origin is localhost
349
363
  if (
350
364
  (specification == 'scorm' && window.location.hostname == 'localhost') ||
351
- !window.location.hostname.includes('cegepadistance.ca')
365
+ unknownHost
352
366
  )
353
- server = 'local'
367
+ server = 'unknown'
354
368
 
355
369
  let data = null
356
370
 
@@ -396,59 +410,29 @@ export default {
396
410
  try {
397
411
  const actorMbox = actor.mbox.replace('mailto:', '')
398
412
  const activityId = activity_id
399
- const _url = new URL(activityId)
400
- const parentID = `${_url.origin}/${crs_id}` // redefining activity id for statement
401
-
402
413
  const lessonProgressParam = { email: actorMbox, activityId }
403
414
  const lessonStateParam = {
404
415
  email: actorMbox,
405
416
  activityId,
406
417
  verb: 'completed'
407
418
  }
408
- const lessonPosionParam = {
409
- email: actorMbox,
410
- activityId
411
- }
412
- const playbarParam = {
413
- email: actorMbox,
414
- activityId,
415
- verb: 'played'
416
- }
417
- const preferencesParam = {
418
- email: actorMbox,
419
- activityId: parentID,
420
- verb: 'preferred'
421
- }
422
419
 
423
- const fetchParams = [
424
- lessonProgressParam,
425
- lessonStateParam,
426
- lessonPosionParam,
427
- playbarParam,
428
- preferencesParam
429
- ]
420
+ const fetchParams = [lessonProgressParam, lessonStateParam]
430
421
 
431
- const {
432
- userData,
433
- savedPoint,
434
- preferredSettings,
435
- playbarValues,
436
- lessonStatus
437
- } = await $xapi._getBulkData(fetchParams)
422
+ const { userData, preferredSettings, lessonStatus, savedPoint } =
423
+ await $xapi._getBulkData(fetchParams)
438
424
 
439
- const { routeHistory = [], ...progress } = userData
425
+ const { routeHistory = [], playbarValues, ...progress } = userData
440
426
 
441
427
  const completedState = lessonStatus || {}
442
- const lessonPosition = savedPoint || ''
443
- const userSettings = preferredSettings || {}
428
+ const lessonPosition = savedPoint.name ? savedPoint : null
444
429
 
445
430
  data = {
446
431
  progress,
447
432
  routeHistory,
448
433
  lessonPosition,
449
434
  completedState,
450
- playbarValues,
451
- userSettings
435
+ playbarValues
452
436
  }
453
437
  } catch (err) {
454
438
  throw new Error(err)
@@ -489,8 +473,9 @@ export default {
489
473
 
490
474
  appStore.applicationSettings = settingsOptions
491
475
  //=================================END SETTING PREFERENCES ====================================//
492
- // const appi18b = options.i18n
493
- // console.log('i18n options received in appBase plugin...', appi18b)
476
+ app.provide('FCAD_STORE', appStore)
477
+ app.provide('FCAD_ROUTER', fcadRouter)
478
+
494
479
  const i18n = initLocalisation(options.i18n)
495
480
  app.use(i18n)
496
481
  app.use(helper)
@@ -125,9 +125,9 @@ export const useAppStore = defineStore('$appStore', {
125
125
  * @description: Check if auto-show subtitles is enabled in application settings
126
126
  */
127
127
  getBookmarkEnabled: (state) => {
128
- return state.applicationSettings.bookmark
129
- ? state.applicationSettings.bookmark
130
- : null
128
+ return state.appConfigs.bookmark_active
129
+ ? state.appConfigs.bookmark_active
130
+ : false
131
131
  },
132
132
 
133
133
  /**