fcad-core-dragon 2.0.0-beta.1 → 2.0.0-beta.10
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/.editorconfig +6 -31
- package/.prettierrc +11 -0
- package/.vscode/extensions.json +8 -0
- package/.vscode/settings.json +16 -0
- package/CHANGELOG +153 -0
- package/README.md +28 -43
- package/documentation/.vitepress/config.js +114 -0
- package/documentation/api-examples.md +49 -0
- package/documentation/composants/app-base-button.md +58 -0
- package/documentation/composants/app-base-error-display.md +59 -0
- package/documentation/composants/app-base-popover.md +68 -0
- package/documentation/composants/app-comp-audio.md +75 -0
- package/documentation/composants/app-comp-branch-buttons.md +111 -0
- package/documentation/composants/app-comp-button-progress.md +53 -0
- package/documentation/composants/app-comp-carousel.md +53 -0
- package/documentation/composants/app-comp-container.md +53 -0
- package/documentation/composants/app-comp-input-checkbox-next.md +42 -0
- package/documentation/composants/app-comp-input-dropdown-next.md +34 -0
- package/documentation/composants/app-comp-input-radio-next.md +39 -0
- package/documentation/composants/app-comp-input-text-next.md +35 -0
- package/documentation/composants/app-comp-input-text-table-next.md +34 -0
- package/documentation/composants/app-comp-input-text-to-fill-dropdown-next.md +53 -0
- package/documentation/composants/app-comp-input-text-to-fill-next.md +31 -0
- package/documentation/composants/app-comp-jauge.md +31 -0
- package/documentation/composants/app-comp-menu-item.md +55 -0
- package/documentation/composants/app-comp-menu.md +29 -0
- package/documentation/composants/app-comp-navigation.md +41 -0
- package/documentation/composants/app-comp-note-call.md +53 -0
- package/documentation/composants/app-comp-note-credit.md +53 -0
- package/documentation/composants/app-comp-play-bar-next.md +53 -0
- package/documentation/composants/app-comp-pop-up-next.md +93 -0
- package/documentation/composants/app-comp-quiz-next.md +235 -0
- package/documentation/composants/app-comp-quiz-recall.md +53 -0
- package/documentation/composants/app-comp-svg-next.md +53 -0
- package/documentation/composants/app-comp-table-of-content.md +50 -0
- package/documentation/composants/app-comp-video-player.md +82 -0
- package/documentation/composants.md +46 -0
- package/documentation/composants_critiques/ModelPageComposant.md +53 -0
- package/documentation/composants_critiques/app-base-module.md +43 -0
- package/documentation/composants_critiques/app-base-page.md +48 -0
- package/documentation/composants_critiques/app-base.md +311 -0
- package/documentation/composants_critiques/main.md +15 -0
- package/documentation/demarrage.md +50 -0
- package/documentation/deploiement.md +58 -0
- package/documentation/index.md +33 -0
- package/documentation/markdown-examples.md +85 -0
- package/documentation/public/npm_version.png +0 -0
- package/documentation/public/vite.svg +15 -0
- package/documentation/public/vuejs.svg +2 -0
- package/documentation/public/vuetify.svg +6 -0
- package/eslint.config.js +60 -0
- package/package.json +43 -47
- package/src/$locales/en.json +86 -108
- package/src/$locales/fr.json +66 -127
- package/src/assets/data/onboardingMessages.json +1 -1
- package/src/components/AppBase.vue +960 -405
- package/src/components/AppBaseButton.test.js +21 -0
- package/src/components/AppBaseButton.vue +42 -10
- package/src/components/AppBaseErrorDisplay.vue +207 -189
- package/src/components/AppBaseFlipCard.vue +1 -0
- package/src/components/AppBaseModule.vue +769 -977
- package/src/components/AppBasePage.vue +635 -81
- package/src/components/AppBasePopover.vue +41 -0
- package/src/components/AppBaseSkeleton.vue +66 -0
- package/src/components/AppCompAudio.vue +256 -0
- package/src/components/AppCompBranchButtons.vue +79 -153
- package/src/components/AppCompButtonProgress.vue +21 -36
- package/src/components/AppCompCarousel.vue +231 -87
- package/src/components/{AppCompTranscript.vue → AppCompContainer.vue} +12 -2
- package/src/components/AppCompInputCheckBoxNx.vue +323 -0
- package/src/components/AppCompInputDropdownNx.vue +299 -0
- package/src/components/AppCompInputRadioNx.vue +284 -0
- package/src/components/AppCompInputTextNx.vue +153 -0
- package/src/components/AppCompInputTextTableNx.vue +202 -0
- package/src/components/AppCompInputTextToFillDropdownNx.vue +340 -0
- package/src/components/AppCompInputTextToFillNx.vue +313 -0
- package/src/components/AppCompJauge.vue +36 -10
- package/src/components/AppCompMenu.vue +246 -32
- package/src/components/AppCompMenuItem.vue +87 -21
- package/src/components/AppCompNavigation.vue +470 -447
- package/src/components/AppCompNoteCall.vue +93 -58
- package/src/components/AppCompNoteCredit.vue +423 -96
- package/src/components/AppCompPlayBarNext.vue +2288 -0
- package/src/components/AppCompPopUpNext.vue +504 -0
- package/src/components/AppCompQuizNext.vue +510 -0
- package/src/components/AppCompQuizRecall.vue +199 -99
- package/src/components/AppCompSVGNext.vue +346 -0
- package/src/components/AppCompSettingsMenu.vue +17 -16
- package/src/components/AppCompTableOfContent.vue +262 -99
- package/src/components/AppCompVideoPlayer.vue +183 -142
- package/src/components/BaseModule.vue +8 -20
- package/src/components/tests__/AppBaseButton.spec.js +53 -0
- package/src/components/tests__/useTimer.spec.js +91 -0
- package/src/composables/useIdleDetector.js +56 -0
- package/src/composables/useQuiz.js +89 -0
- package/src/composables/useTimer.js +172 -0
- package/src/directives/nvdaFix.js +53 -0
- package/src/externalComps/ModuleView.vue +22 -0
- package/src/externalComps/SummaryView.vue +91 -0
- package/src/main.js +397 -148
- package/src/module/stores/appStore.js +947 -0
- package/src/module/xapi/ADL.js +241 -60
- package/src/module/xapi/Crypto/Hasher.js +8 -8
- package/src/module/xapi/Crypto/WordArray.js +6 -6
- package/src/module/xapi/Crypto/algorithms/BufferedBlockAlgorithm.js +4 -4
- package/src/module/xapi/Crypto/algorithms/C_algo.js +14 -18
- package/src/module/xapi/Crypto/algorithms/HMAC.js +1 -1
- package/src/module/xapi/Crypto/algorithms/SHA1.js +1 -1
- package/src/module/xapi/Crypto/encoders/Base.js +7 -7
- package/src/module/xapi/Crypto/encoders/Base64.js +3 -3
- package/src/module/xapi/Crypto/encoders/Hex.js +2 -2
- package/src/module/xapi/Crypto/encoders/Latin1.js +3 -3
- package/src/module/xapi/Crypto/encoders/Utf8.js +3 -3
- package/src/module/xapi/Statement/index.js +3 -3
- package/src/module/xapi/launch.js +10 -10
- package/src/module/xapi/utils.js +17 -17
- package/src/module/xapi/wrapper.js +219 -214
- package/src/module/xapi/xapiStatement.js +29 -29
- package/src/plugins/analytics.js +34 -0
- package/src/plugins/bus.js +7 -2
- package/src/plugins/gsap.js +5 -7
- package/src/plugins/helper.js +97 -34
- package/src/plugins/i18n.js +13 -18
- package/src/plugins/idb.js +45 -30
- package/src/plugins/save.js +1 -1
- package/src/plugins/scorm.js +15 -15
- package/src/plugins/xapi.js +2 -2
- package/src/public/index.html +22 -10
- package/src/router/index.js +29 -13
- package/src/router/routes.js +29 -54
- package/src/shared/generalfuncs.js +186 -30
- package/src/shared/validators.js +809 -40
- package/vitest.config.js +19 -0
- package/.eslintignore +0 -29
- package/.eslintrc.js +0 -86
- package/.prettierrc.js +0 -5
- package/babel.config.js +0 -3
- package/src/components/AppBaseDragChoice.vue +0 -91
- package/src/components/AppBaseDropZone.vue +0 -112
- package/src/components/AppCompBif.vue +0 -120
- package/src/components/AppCompDragAndDrop.vue +0 -339
- package/src/components/AppCompInputAssociation.vue +0 -332
- package/src/components/AppCompInputCheckBox.vue +0 -227
- package/src/components/AppCompInputDropdown.vue +0 -184
- package/src/components/AppCompInputRadio.vue +0 -169
- package/src/components/AppCompInputTextBox.vue +0 -91
- package/src/components/AppCompInputTextTable.vue +0 -155
- package/src/components/AppCompInputTextToFillDropdown.vue +0 -255
- package/src/components/AppCompInputTextToFillText.vue +0 -164
- package/src/components/AppCompMediaPlayer.vue +0 -397
- package/src/components/AppCompPlayBar.vue +0 -1319
- package/src/components/AppCompPopUp.vue +0 -522
- package/src/components/AppCompPopover.vue +0 -27
- package/src/components/AppCompQuiz.vue +0 -2989
- package/src/components/AppCompSVG.vue +0 -309
- package/src/mixins/$pageMixins.js +0 -459
- package/src/mixins/$quizMixins.js +0 -456
- package/src/mixins/timerMixin.js +0 -156
- package/src/module/store.js +0 -895
- package/src/plugins/timeManager.js +0 -77
- package/src/routes_bckp.js +0 -313
- package/src/routes_static.js +0 -344
- package/vue.config.js +0 -83
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
import { mapGetters } from 'vuex'
|
|
2
|
-
/*
|
|
3
|
-
@ Description: Mixins to extends general fonctionnalities in a page of an activity.
|
|
4
|
-
@ Note: Must be used along component AppBasePage When creating page of an activity.
|
|
5
|
-
* some data and information will not be correctly tracked if this mixins not used
|
|
6
|
-
* when creating a page.
|
|
7
|
-
*/
|
|
8
|
-
const $extendsPage = {
|
|
9
|
-
// lazy laoding of components
|
|
10
|
-
components: {
|
|
11
|
-
AppCompMediaPlayer: () =>
|
|
12
|
-
import(
|
|
13
|
-
/* webpackChunkName: "MediaPlayerCompnent" */
|
|
14
|
-
'../components/AppCompMediaPlayer.vue'
|
|
15
|
-
),
|
|
16
|
-
AppCompMenuItem: () =>
|
|
17
|
-
import(
|
|
18
|
-
/* webpackChunkName: "MenuItemCompenent" */
|
|
19
|
-
'../components/AppCompMenuItem.vue'
|
|
20
|
-
),
|
|
21
|
-
AppCompQuiz: () =>
|
|
22
|
-
import(
|
|
23
|
-
/* webpackChunkName: "QuizComponent" */
|
|
24
|
-
'../components/AppCompQuiz.vue'
|
|
25
|
-
)
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
data: () => {
|
|
29
|
-
return {
|
|
30
|
-
userInteraction: {},
|
|
31
|
-
state: null,
|
|
32
|
-
anchorEnable: true,
|
|
33
|
-
anchorInfo: null,
|
|
34
|
-
drModeActive: null,
|
|
35
|
-
error: null,
|
|
36
|
-
credits: null,
|
|
37
|
-
notes: null
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
watch: {
|
|
41
|
-
userInteraction: {
|
|
42
|
-
handler(newValue) {
|
|
43
|
-
/**
|
|
44
|
-
* Objserve changes in the number of poperties to dispatch updates in the userdata in the Store
|
|
45
|
-
*/
|
|
46
|
-
if (newValue && Object.entries(this.userInteraction).length) {
|
|
47
|
-
const { activityRef, id, userInteraction } = this.$data
|
|
48
|
-
this.$store.dispatch('updateUserMetaData', {
|
|
49
|
-
activityRef,
|
|
50
|
-
id,
|
|
51
|
-
userInteraction
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
immediate: true,
|
|
56
|
-
deep: true
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
mounted() {
|
|
60
|
-
this.userInteraction = this.getProgress() // Get the progress for the page
|
|
61
|
-
|
|
62
|
-
if (this.userInteraction && this.userInteraction.state)
|
|
63
|
-
// set the state of the page to existing record if any
|
|
64
|
-
this.state = this.userInteraction.state
|
|
65
|
-
else if (
|
|
66
|
-
this.type === 'pg_menu' &&
|
|
67
|
-
this.userInteraction.state !== 'completed'
|
|
68
|
-
) {
|
|
69
|
-
this.state = 'completed' // set menu page state to completed
|
|
70
|
-
} else this.state = 'started' // set the default state to started
|
|
71
|
-
|
|
72
|
-
this.$set(this.userInteraction, 'state', this.state) // add the state to the userInteraction
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
document.documentElement.scrollHeight <=
|
|
76
|
-
document.documentElement.clientHeight + 20 &&
|
|
77
|
-
this.type !== 'pg_branch'
|
|
78
|
-
) {
|
|
79
|
-
this.completePage()
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (this.type === 'pg_branch') {
|
|
83
|
-
this.$store.commit('UPDATE_CURRENT_BRANCH_PAGE', this.$data)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// get the data for note and credit
|
|
87
|
-
let data = {
|
|
88
|
-
note: this.notes,
|
|
89
|
-
credit: this.credits
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// give notes and credit information must be in tick because of life cycle
|
|
93
|
-
this.$nextTick(function() {
|
|
94
|
-
this.$bus.$emit('credit-note', data)
|
|
95
|
-
})
|
|
96
|
-
if (this.type == 'pg_branch') return //do not proceed to add listner when branch page
|
|
97
|
-
|
|
98
|
-
window.addEventListener('scroll', this.onFirstScroll, { once: true }) //listener is removed when event fired
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
created() {
|
|
102
|
-
if (this.type == 'pg_branch')
|
|
103
|
-
this.$bus.$on('branch-page-viewed', this.completePageBranching)
|
|
104
|
-
if (this.isBranchingPage)
|
|
105
|
-
this.$store.commit('UPDATE_CURRENT_BRANCHING', this.$data)
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
beforeDestroy() {
|
|
109
|
-
this.$bus.$off('branch-page-viewed', this.completePageBranching)
|
|
110
|
-
window.removeEventListener('scroll', this.onFirstScroll, { once: true }) //in case user did not scroll
|
|
111
|
-
window.removeEventListener('scroll', this.handleScroll)
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
methods: {
|
|
115
|
-
onFirstScroll() {
|
|
116
|
-
window.addEventListener('scroll', this.handleScroll)
|
|
117
|
-
},
|
|
118
|
-
/**
|
|
119
|
-
* @description to handle the complete state for the gauge
|
|
120
|
-
*/
|
|
121
|
-
|
|
122
|
-
handleScroll(event) {
|
|
123
|
-
event
|
|
124
|
-
/*
|
|
125
|
-
* DocumentElement properties does not alway work properly on all Browser. To Ensure reliable value of its properties on all * Broswer we will calculate the Document Height by taking the maximum of body and documentElement height poperties.
|
|
126
|
-
* ref:https://javascript.info/size-and-scroll-window
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
let scrollHeight = null
|
|
130
|
-
let clientHeight = null
|
|
131
|
-
let scrollTop = null
|
|
132
|
-
scrollHeight = Math.max(
|
|
133
|
-
document.body.scrollHeight,
|
|
134
|
-
document.documentElement.scrollHeight,
|
|
135
|
-
document.body.offsetHeight,
|
|
136
|
-
document.documentElement.offsetHeight,
|
|
137
|
-
document.body.clientHeight,
|
|
138
|
-
document.documentElement.clientHeight
|
|
139
|
-
)
|
|
140
|
-
clientHeight = document.documentElement.clientHeight
|
|
141
|
-
scrollTop = window.scrollY
|
|
142
|
-
|
|
143
|
-
// //Set scroll limit reached at 150px above the document height.
|
|
144
|
-
let scrollLimit = scrollHeight - 150
|
|
145
|
-
let fullyScrolled = Math.round(clientHeight + scrollTop)
|
|
146
|
-
|
|
147
|
-
//consider page completed when scolled value has reached or passed set limit
|
|
148
|
-
if (fullyScrolled >= scrollLimit && this.state !== 'completed') {
|
|
149
|
-
this.completePage()
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
/**
|
|
153
|
-
* @description set the state of the page to complete
|
|
154
|
-
* @fires send-xapi-statement to AppBaseModule.vue
|
|
155
|
-
*/
|
|
156
|
-
completePage() {
|
|
157
|
-
if (
|
|
158
|
-
this.type == 'pg_menu' ||
|
|
159
|
-
this.state == 'completed' ||
|
|
160
|
-
this.isBranchingPage ||
|
|
161
|
-
this.type == 'pg_branch'
|
|
162
|
-
)
|
|
163
|
-
return
|
|
164
|
-
this.state = 'completed'
|
|
165
|
-
|
|
166
|
-
this.$set(this.userInteraction, 'state', this.state)
|
|
167
|
-
this.sendCompletionToServer()
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @description set the state of the branching page to complete
|
|
172
|
-
* @fires send-xapi-statement to AppBaseModule.vue
|
|
173
|
-
*/
|
|
174
|
-
completePageBranching() {
|
|
175
|
-
//Get the current branching from the store
|
|
176
|
-
const currentBranching = this.$store.getters.getCurrentBranching
|
|
177
|
-
if (currentBranching.id !== this.$route.meta.id) return
|
|
178
|
-
if (currentBranching.state === 'completed') return
|
|
179
|
-
|
|
180
|
-
const children = this.$route.meta.children
|
|
181
|
-
let count = 0
|
|
182
|
-
children.forEach((c) => {
|
|
183
|
-
let progress = this.getProgress(c._ref)
|
|
184
|
-
|
|
185
|
-
if (progress.state == 'completed') count += 1
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
if (count !== children.length) return
|
|
189
|
-
currentBranching.state = 'completed' //set the state of the page to completed
|
|
190
|
-
//update the userinteraction state
|
|
191
|
-
this.$set(
|
|
192
|
-
currentBranching.userInteraction,
|
|
193
|
-
'state',
|
|
194
|
-
currentBranching.state
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
this.sendCompletionToServer()
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* @description - Send xapi statement to indicate the completion of an activity
|
|
202
|
-
*/
|
|
203
|
-
sendCompletionToServer() {
|
|
204
|
-
/*
|
|
205
|
-
* Send xapi statement to indicate the completion of an activity
|
|
206
|
-
* Send completion of activity when all pages in Activity are completed and the page is last page of activity
|
|
207
|
-
* Send completion statement for lesson if this is the last page of the last activity in lesson
|
|
208
|
-
*/
|
|
209
|
-
|
|
210
|
-
if (this.getModuleInfo.packageType !== 'xapi') return
|
|
211
|
-
if (!this.getConnectionInfo) return
|
|
212
|
-
if (!this.getConnectionInfo.remote || !this.getConnectionInfo.actor)
|
|
213
|
-
return
|
|
214
|
-
|
|
215
|
-
//Get the current acitivty reference from store
|
|
216
|
-
const currentActivity = this.getAllActivities.list.get(
|
|
217
|
-
this.getCurrentPage.activityRef
|
|
218
|
-
)
|
|
219
|
-
|
|
220
|
-
const activity_id = `${this.getConnectionInfo.activity_id}/${this.getCurrentPage.activityRef}`
|
|
221
|
-
|
|
222
|
-
const record = this.$xapi._getProgress(
|
|
223
|
-
this.getConnectionInfo.actor.mbox.replace('mailto:', ''),
|
|
224
|
-
activity_id,
|
|
225
|
-
'completed'
|
|
226
|
-
)
|
|
227
|
-
|
|
228
|
-
//Send a completion statement for the current activity
|
|
229
|
-
//When all pages of the activity are completed and the activity recorded is as completed
|
|
230
|
-
if (
|
|
231
|
-
this.getAllCompleted[this.getCurrentPage.activityRef] &&
|
|
232
|
-
this.getAllCompleted[this.getCurrentPage.activityRef].length ===
|
|
233
|
-
currentActivity.size &&
|
|
234
|
-
!record[this.getCurrentPage.activityRef]
|
|
235
|
-
) {
|
|
236
|
-
let aTitle
|
|
237
|
-
|
|
238
|
-
//Custom name of the activity
|
|
239
|
-
if (this.getCurrentPage.activityRef === 'A00')
|
|
240
|
-
aTitle = this.$t('text.introduction')
|
|
241
|
-
else if (this.getCurrentPage.activityRef === 'A99')
|
|
242
|
-
aTitle = this.$t('text.conclusion')
|
|
243
|
-
aTitle = `${this.$t('text.activity')} ${
|
|
244
|
-
this.getCurrentPage.activityRef
|
|
245
|
-
}`
|
|
246
|
-
|
|
247
|
-
//Custom text for description and definition
|
|
248
|
-
let text
|
|
249
|
-
this.$i18n.locale == 'fr'
|
|
250
|
-
? (text = `L'${aTitle} de ${this.getModuleInfo.id}`)
|
|
251
|
-
: (text = `The ${aTitle} of ${this.getModuleInfo.id}`)
|
|
252
|
-
|
|
253
|
-
// Retrive only user data in lessons front its interaction that we want to send to the LRS
|
|
254
|
-
const { isFistTime, userSettings, ...data } = this.getUserInteraction
|
|
255
|
-
|
|
256
|
-
//Dispatch a send statement event
|
|
257
|
-
this.$bus.$emit('send-xapi-statement', {
|
|
258
|
-
verb: (() => {
|
|
259
|
-
//set the verbe to complete if all the state of the pages of the activity are
|
|
260
|
-
if (
|
|
261
|
-
this.getAllCompleted[this.getCurrentPage.activityRef] &&
|
|
262
|
-
this.getAllCompleted[this.getCurrentPage.activityRef].length ===
|
|
263
|
-
currentActivity.size
|
|
264
|
-
)
|
|
265
|
-
return 'completed'
|
|
266
|
-
else return 'suspended'
|
|
267
|
-
})(),
|
|
268
|
-
id: this.getCurrentPage.activityRef,
|
|
269
|
-
definition: text,
|
|
270
|
-
description: text,
|
|
271
|
-
extension: [
|
|
272
|
-
{
|
|
273
|
-
id: 'user-data',
|
|
274
|
-
content: data
|
|
275
|
-
}
|
|
276
|
-
]
|
|
277
|
-
})
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
/**
|
|
281
|
-
* @description Get the user progress for the current page
|
|
282
|
-
* @param {string} id (Otpional) - the id of the targeted page
|
|
283
|
-
* @return {Oject} - the existing user data for the current page
|
|
284
|
-
*/
|
|
285
|
-
getProgress(id) {
|
|
286
|
-
id = id || this.id
|
|
287
|
-
|
|
288
|
-
const record = this.$store.getters.getUserInteraction
|
|
289
|
-
if (
|
|
290
|
-
Object.entries(record).length &&
|
|
291
|
-
record[this.activityRef] &&
|
|
292
|
-
record[this.activityRef][id]
|
|
293
|
-
) {
|
|
294
|
-
const { userInteraction } = record[this.activityRef][id]
|
|
295
|
-
return userInteraction
|
|
296
|
-
}
|
|
297
|
-
return {}
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
//**** SEE TO DELETE */
|
|
301
|
-
anchorProgress() {
|
|
302
|
-
const anchors = document.querySelectorAll('.anchor') // look for anchor
|
|
303
|
-
const options = {
|
|
304
|
-
root: null,
|
|
305
|
-
threshold: 0
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
let anchorsComplete
|
|
309
|
-
let indexStrt
|
|
310
|
-
let anchorString
|
|
311
|
-
let indexEnd
|
|
312
|
-
let anchorComplete
|
|
313
|
-
|
|
314
|
-
let target = document.querySelector('#App-base')
|
|
315
|
-
// get anchor already seen
|
|
316
|
-
anchorsComplete = this.getAnchorComplete()
|
|
317
|
-
|
|
318
|
-
const observer = new IntersectionObserver((entries) => {
|
|
319
|
-
// everytime the page passes a anchor
|
|
320
|
-
observer.observe(target)
|
|
321
|
-
|
|
322
|
-
entries.forEach((entry) => {
|
|
323
|
-
// when it's visable in the page
|
|
324
|
-
|
|
325
|
-
if (entry.isIntersecting) {
|
|
326
|
-
// get the target
|
|
327
|
-
|
|
328
|
-
this.anchorInfo = entry.target.classList
|
|
329
|
-
indexStrt = this.anchorInfo.value.indexOf('anchor-')
|
|
330
|
-
// work the string to get juste the anchor tag
|
|
331
|
-
// must be the same as the class
|
|
332
|
-
if (indexStrt == -1) {
|
|
333
|
-
return
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
anchorString = this.anchorInfo.value.substring(indexStrt)
|
|
337
|
-
|
|
338
|
-
indexEnd = anchorString.indexOf(' ')
|
|
339
|
-
if (indexEnd != -1) {
|
|
340
|
-
anchorComplete = anchorString.slice(0, indexEnd)
|
|
341
|
-
} else {
|
|
342
|
-
anchorComplete = anchorString
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
//get all the anchors of the current activity
|
|
346
|
-
const anchors_list = this.getAnchorsForActivity(this.activityRef)
|
|
347
|
-
|
|
348
|
-
//search for the current ancor
|
|
349
|
-
const anc = anchors_list.find((a) => a.anchorTag === anchorComplete)
|
|
350
|
-
//dispatch the current anchor to the store
|
|
351
|
-
if (anc) {
|
|
352
|
-
// update the store value for current section
|
|
353
|
-
this.$store.dispatch('updateCurrentSection', anc)
|
|
354
|
-
// Ask bread scrumb to update its information
|
|
355
|
-
|
|
356
|
-
this.$bus.$emit('anchor-seen', anchorComplete)
|
|
357
|
-
} else {
|
|
358
|
-
if (process.env.NODE_ENV === 'development')
|
|
359
|
-
console.warn(
|
|
360
|
-
`%c WARNING!>>> Anchor handeling: 👉${anchorComplete}👈 doesn't exist. Please provide a valid anchor.`,
|
|
361
|
-
'background: orange; color: white; display: block; border-radius:5px; margin:5px;'
|
|
362
|
-
)
|
|
363
|
-
|
|
364
|
-
return
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// if you didn't aldreay seen anchors
|
|
368
|
-
if (anchorsComplete != undefined) {
|
|
369
|
-
// look if you already saw this anchor
|
|
370
|
-
if (anc && !anchorsComplete.includes(anchorComplete)) {
|
|
371
|
-
// push it in the array them in the store
|
|
372
|
-
anchorsComplete.push(anchorComplete)
|
|
373
|
-
this.$set(this.userInteraction, 'anchors', anchorsComplete)
|
|
374
|
-
}
|
|
375
|
-
} else {
|
|
376
|
-
// if you never saw any anchor
|
|
377
|
-
// push it in the array them in the store
|
|
378
|
-
anchorsComplete = []
|
|
379
|
-
if (anc) anchorsComplete.push(anchorComplete)
|
|
380
|
-
this.$set(this.userInteraction, 'anchors', anchorsComplete)
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
})
|
|
384
|
-
}, options)
|
|
385
|
-
|
|
386
|
-
// observer call llok for each anchor in page
|
|
387
|
-
anchors.forEach((anchor) => {
|
|
388
|
-
observer.observe(anchor)
|
|
389
|
-
})
|
|
390
|
-
},
|
|
391
|
-
getAnchorComplete() {
|
|
392
|
-
const userInteraction = this.getUserInteraction
|
|
393
|
-
let completeAnchor
|
|
394
|
-
|
|
395
|
-
// Verify if the element existe
|
|
396
|
-
if (
|
|
397
|
-
userInteraction[this.activityRef] &&
|
|
398
|
-
userInteraction[this.activityRef][this.id] &&
|
|
399
|
-
userInteraction[this.activityRef][this.id].userInteraction.anchors
|
|
400
|
-
) {
|
|
401
|
-
// if you already saw anchors return them
|
|
402
|
-
completeAnchor =
|
|
403
|
-
userInteraction[this.activityRef][this.id].userInteraction.anchors
|
|
404
|
-
return completeAnchor
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
showChoiceBif(data) {
|
|
408
|
-
// check if you made a choice
|
|
409
|
-
if (
|
|
410
|
-
typeof this.getBifChoice === 'undefined' ||
|
|
411
|
-
Object.keys(this.getBifChoice).length === 0
|
|
412
|
-
) {
|
|
413
|
-
return data['A']
|
|
414
|
-
} else {
|
|
415
|
-
if (this.getBifChoice.choix) {
|
|
416
|
-
// get the choise from store
|
|
417
|
-
if (data.hasOwnProperty(this.getBifChoice.choix)) {
|
|
418
|
-
let choice = data[this.getBifChoice.choix]
|
|
419
|
-
//return choice
|
|
420
|
-
return choice
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
|
-
openPopup(data) {
|
|
426
|
-
this.$bus.$emit('open-popup', data)
|
|
427
|
-
}
|
|
428
|
-
},
|
|
429
|
-
computed: {
|
|
430
|
-
...mapGetters([
|
|
431
|
-
'getUserInteraction',
|
|
432
|
-
'getCurrentPage',
|
|
433
|
-
'getModuleInfo',
|
|
434
|
-
'getAllActivities',
|
|
435
|
-
'getAllCompleted',
|
|
436
|
-
'getConnectionInfo',
|
|
437
|
-
'getAnchorsForActivity',
|
|
438
|
-
'getBifChoice'
|
|
439
|
-
]),
|
|
440
|
-
|
|
441
|
-
pageMedia() {
|
|
442
|
-
return this.$store.getters.getCurrentPage
|
|
443
|
-
},
|
|
444
|
-
console() {
|
|
445
|
-
return console
|
|
446
|
-
},
|
|
447
|
-
window() {
|
|
448
|
-
return window
|
|
449
|
-
},
|
|
450
|
-
alert() {
|
|
451
|
-
return alert
|
|
452
|
-
},
|
|
453
|
-
|
|
454
|
-
isBranchingPage() {
|
|
455
|
-
return this.buttonData || this.cardData ? true : false
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
export default $extendsPage
|