@coorpacademy/app-review 0.6.0 → 0.6.1-alpha.0
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/lib/actions/api/fetch-correction.js +25 -0
- package/lib/actions/api/fetch-rank.js +43 -0
- package/lib/actions/api/fetch-skills.js +23 -0
- package/lib/actions/api/fetch-slide.js +38 -0
- package/lib/actions/api/post-answer.js +43 -0
- package/lib/actions/api/post-progression.js +27 -0
- package/lib/actions/data/token.js +9 -0
- package/lib/actions/ui/answers.js +61 -0
- package/lib/actions/ui/navigation.js +31 -0
- package/lib/actions/ui/next-slide.js +28 -0
- package/lib/actions/ui/quit-popin.js +11 -0
- package/lib/actions/ui/slides.js +9 -0
- package/lib/common/index.js +17 -0
- package/lib/configure-store.js +27 -0
- package/lib/helpers/css-register.js +7 -0
- package/lib/index.js +101 -0
- package/lib/reducers/data/corrections.js +26 -0
- package/lib/reducers/data/index.js +13 -0
- package/lib/reducers/data/progression.js +18 -0
- package/lib/reducers/data/rank.js +32 -0
- package/lib/reducers/data/skills.js +13 -0
- package/lib/reducers/data/slides.js +25 -0
- package/lib/reducers/data/token.js +13 -0
- package/lib/reducers/index.js +12 -0
- package/lib/reducers/ui/answers.js +27 -0
- package/lib/reducers/ui/current-slide-ref.js +18 -0
- package/lib/reducers/ui/index.js +22 -0
- package/lib/reducers/ui/navigation.js +20 -0
- package/lib/reducers/ui/positions.js +32 -0
- package/lib/reducers/ui/quit-popin.js +18 -0
- package/lib/reducers/ui/show-congrats.js +22 -0
- package/lib/reducers/ui/slide.js +53 -0
- package/lib/services/fetch-correction.js +21 -0
- package/lib/services/fetch-rank.js +17 -0
- package/lib/services/fetch-skills.js +17 -0
- package/lib/services/fetch-slide.js +17 -0
- package/lib/services/fetch-slides-to-review-by-skill-ref.js +15 -0
- package/lib/services/index.js +20 -0
- package/lib/services/post-answer.js +27 -0
- package/lib/services/post-progression.js +28 -0
- package/lib/services/tools/fetch-responses.js +40 -0
- package/lib/services/tools/sleep.js +7 -0
- package/lib/types/common.js +2 -0
- package/lib/types/slides.js +2 -0
- package/lib/{src/views → views}/skills/index.js +8 -4
- package/lib/views/slides/index.js +325 -0
- package/lib/views/slides/map-api-slide-to-ui.js +177 -0
- package/package.json +5 -13
- package/es/sandbox/index.d.ts +0 -9
- package/es/sandbox/index.js +0 -41
- package/es/src/actions/test/create-test-store.d.ts +0 -5
- package/es/src/actions/test/create-test-store.js +0 -16
- package/es/src/test/index.test.d.ts +0 -1
- package/es/src/test/index.test.js +0 -66
- package/es/src/test/util/services.mock.d.ts +0 -7
- package/es/src/test/util/services.mock.js +0 -444
- package/es/src/views/slides/test/fixtures/free-text.d.ts +0 -4
- package/es/src/views/slides/test/fixtures/free-text.js +0 -38
- package/es/src/views/slides/test/fixtures/qcm-drag.d.ts +0 -4
- package/es/src/views/slides/test/fixtures/qcm-drag.js +0 -108
- package/es/src/views/slides/test/fixtures/qcm-graphic.d.ts +0 -4
- package/es/src/views/slides/test/fixtures/qcm-graphic.js +0 -252
- package/es/src/views/slides/test/fixtures/qcm.d.ts +0 -4
- package/es/src/views/slides/test/fixtures/qcm.js +0 -109
- package/es/src/views/slides/test/fixtures/slider.d.ts +0 -4
- package/es/src/views/slides/test/fixtures/slider.js +0 -37
- package/es/src/views/slides/test/fixtures/template.d.ts +0 -4
- package/es/src/views/slides/test/fixtures/template.js +0 -170
- package/lib/sandbox/index.d.ts +0 -9
- package/lib/sandbox/index.js +0 -43
- package/lib/src/actions/api/fetch-correction.js +0 -19
- package/lib/src/actions/api/fetch-rank.js +0 -38
- package/lib/src/actions/api/fetch-skills.js +0 -17
- package/lib/src/actions/api/fetch-slide.js +0 -81
- package/lib/src/actions/api/post-answer.js +0 -92
- package/lib/src/actions/api/post-progression.js +0 -72
- package/lib/src/actions/data/token.js +0 -5
- package/lib/src/actions/test/create-test-store.d.ts +0 -5
- package/lib/src/actions/test/create-test-store.js +0 -18
- package/lib/src/actions/ui/answers.js +0 -65
- package/lib/src/actions/ui/navigation.js +0 -86
- package/lib/src/actions/ui/next-slide.js +0 -21
- package/lib/src/actions/ui/quit-popin.js +0 -8
- package/lib/src/actions/ui/slides.js +0 -5
- package/lib/src/common/index.js +0 -10
- package/lib/src/configure-store.js +0 -21
- package/lib/src/helpers/css-register.js +0 -2
- package/lib/src/index.js +0 -86
- package/lib/src/reducers/data/corrections.js +0 -22
- package/lib/src/reducers/data/index.js +0 -8
- package/lib/src/reducers/data/progression.js +0 -17
- package/lib/src/reducers/data/rank.js +0 -28
- package/lib/src/reducers/data/skills.js +0 -12
- package/lib/src/reducers/data/slides.js +0 -20
- package/lib/src/reducers/data/token.js +0 -12
- package/lib/src/reducers/index.js +0 -7
- package/lib/src/reducers/ui/answers.js +0 -25
- package/lib/src/reducers/ui/current-slide-ref.js +0 -17
- package/lib/src/reducers/ui/index.js +0 -17
- package/lib/src/reducers/ui/navigation.js +0 -28
- package/lib/src/reducers/ui/positions.js +0 -28
- package/lib/src/reducers/ui/quit-popin.js +0 -17
- package/lib/src/reducers/ui/show-congrats.js +0 -21
- package/lib/src/reducers/ui/slide.js +0 -48
- package/lib/src/services/fetch-correction.js +0 -58
- package/lib/src/services/fetch-rank.js +0 -54
- package/lib/src/services/fetch-skills.js +0 -54
- package/lib/src/services/fetch-slide.js +0 -54
- package/lib/src/services/fetch-slides-to-review-by-skill-ref.js +0 -52
- package/lib/src/services/index.js +0 -16
- package/lib/src/services/post-answer.js +0 -64
- package/lib/src/services/post-progression.js +0 -65
- package/lib/src/services/tools/fetch-responses.js +0 -112
- package/lib/src/services/tools/sleep.js +0 -5
- package/lib/src/test/index.test.d.ts +0 -1
- package/lib/src/test/index.test.js +0 -170
- package/lib/src/test/util/services.mock.d.ts +0 -7
- package/lib/src/test/util/services.mock.js +0 -448
- package/lib/src/types/common.js +0 -1
- package/lib/src/types/slides.js +0 -1
- package/lib/src/views/slides/index.js +0 -315
- package/lib/src/views/slides/map-api-slide-to-ui.js +0 -188
- package/lib/src/views/slides/test/fixtures/free-text.d.ts +0 -4
- package/lib/src/views/slides/test/fixtures/free-text.js +0 -38
- package/lib/src/views/slides/test/fixtures/qcm-drag.d.ts +0 -4
- package/lib/src/views/slides/test/fixtures/qcm-drag.js +0 -108
- package/lib/src/views/slides/test/fixtures/qcm-graphic.d.ts +0 -4
- package/lib/src/views/slides/test/fixtures/qcm-graphic.js +0 -252
- package/lib/src/views/slides/test/fixtures/qcm.d.ts +0 -4
- package/lib/src/views/slides/test/fixtures/qcm.js +0 -109
- package/lib/src/views/slides/test/fixtures/slider.d.ts +0 -4
- package/lib/src/views/slides/test/fixtures/slider.js +0 -37
- package/lib/src/views/slides/test/fixtures/template.d.ts +0 -4
- package/lib/src/views/slides/test/fixtures/template.js +0 -170
- package/src/actions/api/fetch-correction.ts +0 -39
- package/src/actions/api/fetch-rank.ts +0 -91
- package/src/actions/api/fetch-skills.ts +0 -31
- package/src/actions/api/fetch-slide.ts +0 -54
- package/src/actions/api/post-answer.ts +0 -55
- package/src/actions/api/post-progression.ts +0 -37
- package/src/actions/api/test/fetch-correction.test.ts +0 -119
- package/src/actions/api/test/fetch-rank.test.ts +0 -138
- package/src/actions/api/test/fetch-skills.test.ts +0 -78
- package/src/actions/api/test/fetch-slide.test.ts +0 -85
- package/src/actions/api/test/post-answer.test.ts +0 -266
- package/src/actions/api/test/post-progression.test.ts +0 -127
- package/src/actions/data/test/token.test.ts +0 -32
- package/src/actions/data/token.ts +0 -11
- package/src/actions/test/create-test-store.ts +0 -25
- package/src/actions/ui/answers.ts +0 -77
- package/src/actions/ui/navigation.ts +0 -62
- package/src/actions/ui/next-slide.ts +0 -44
- package/src/actions/ui/quit-popin.ts +0 -10
- package/src/actions/ui/slides.ts +0 -26
- package/src/actions/ui/test/answers.test.ts +0 -174
- package/src/actions/ui/test/navigation.test.ts +0 -95
- package/src/actions/ui/test/next-slide.test.ts +0 -87
- package/src/actions/ui/test/quit-popin.test.ts +0 -39
- package/src/actions/ui/test/slides.test.ts +0 -33
- package/src/common/index.ts +0 -15
- package/src/common/test/get-progression-slide-ref.test.ts +0 -35
- package/src/configure-store.ts +0 -28
- package/src/helpers/css-modules-require-hook.d.ts +0 -4
- package/src/helpers/css-register.ts +0 -3
- package/src/index.tsx +0 -107
- package/src/reducers/data/corrections.ts +0 -36
- package/src/reducers/data/index.ts +0 -19
- package/src/reducers/data/progression.ts +0 -23
- package/src/reducers/data/rank.ts +0 -44
- package/src/reducers/data/skills.ts +0 -16
- package/src/reducers/data/slides.ts +0 -31
- package/src/reducers/data/test/corrections.test.ts +0 -36
- package/src/reducers/data/test/progression.test.ts +0 -28
- package/src/reducers/data/test/rank.test.ts +0 -59
- package/src/reducers/data/test/skills.test.ts +0 -14
- package/src/reducers/data/test/slides.test.ts +0 -27
- package/src/reducers/data/test/token.test.ts +0 -13
- package/src/reducers/data/token.ts +0 -15
- package/src/reducers/index.ts +0 -14
- package/src/reducers/ui/answers.ts +0 -41
- package/src/reducers/ui/current-slide-ref.ts +0 -22
- package/src/reducers/ui/index.ts +0 -29
- package/src/reducers/ui/navigation.ts +0 -29
- package/src/reducers/ui/positions.ts +0 -34
- package/src/reducers/ui/quit-popin.ts +0 -22
- package/src/reducers/ui/show-congrats.ts +0 -26
- package/src/reducers/ui/slide.ts +0 -87
- package/src/reducers/ui/test/answers.test.ts +0 -105
- package/src/reducers/ui/test/current-slide-ref.test.ts +0 -14
- package/src/reducers/ui/test/navigation.test.ts +0 -19
- package/src/reducers/ui/test/positions.test.ts +0 -82
- package/src/reducers/ui/test/quit-popin.test.ts +0 -24
- package/src/reducers/ui/test/show-congrats.test.ts +0 -40
- package/src/reducers/ui/test/slide.test.ts +0 -110
- package/src/services/fetch-correction.ts +0 -26
- package/src/services/fetch-rank.ts +0 -14
- package/src/services/fetch-skills.ts +0 -14
- package/src/services/fetch-slide.ts +0 -14
- package/src/services/fetch-slides-to-review-by-skill-ref.ts +0 -18
- package/src/services/index.ts +0 -18
- package/src/services/post-answer.ts +0 -28
- package/src/services/post-progression.ts +0 -28
- package/src/services/test/fetch-correction.test.ts +0 -55
- package/src/services/test/fetch-rank.test.ts +0 -34
- package/src/services/test/fetch-skills.test.ts +0 -39
- package/src/services/test/fetch-slide.test.ts +0 -30
- package/src/services/test/fetch-slides-to-review-by-skill-ref.test.ts +0 -51
- package/src/services/test/post-answer.test.ts +0 -100
- package/src/services/test/post-progression.test.ts +0 -66
- package/src/services/tools/fetch-responses.ts +0 -40
- package/src/services/tools/sleep.ts +0 -4
- package/src/test/index.test.tsx +0 -99
- package/src/test/util/services.mock.ts +0 -465
- package/src/types/common.ts +0 -207
- package/src/types/globals.d.ts +0 -4
- package/src/types/slides.ts +0 -98
- package/src/views/skills/index.ts +0 -48
- package/src/views/skills/test/skills.test.ts +0 -104
- package/src/views/slides/index.ts +0 -398
- package/src/views/slides/map-api-slide-to-ui.ts +0 -287
- package/src/views/slides/test/fixtures/free-text.ts +0 -44
- package/src/views/slides/test/fixtures/qcm-drag.ts +0 -112
- package/src/views/slides/test/fixtures/qcm-graphic.ts +0 -264
- package/src/views/slides/test/fixtures/qcm.ts +0 -120
- package/src/views/slides/test/fixtures/slider.ts +0 -43
- package/src/views/slides/test/fixtures/template.ts +0 -177
- package/src/views/slides/test/header.on-click.test.ts +0 -46
- package/src/views/slides/test/index.test.ts +0 -1515
- package/src/views/slides/test/map-api-slide-to-ui.test.ts +0 -52
- package/src/views/slides/test/on-quit-popin.on-click.test.ts +0 -66
- package/src/views/slides/test/slide.free-text.on-change.test.ts +0 -116
- package/src/views/slides/test/slide.next-slide.on-click.test.ts +0 -178
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +0 -90
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +0 -90
- package/src/views/slides/test/slide.qcm.on-click.test.ts +0 -92
- package/src/views/slides/test/slide.slider.on-change.test.ts +0 -92
- package/src/views/slides/test/slide.slider.on-slider-change.test.ts +0 -91
- package/src/views/slides/test/slide.template.on-change.test.ts +0 -126
- /package/es/{src/actions → actions}/api/fetch-correction.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-correction.js +0 -0
- /package/es/{src/actions → actions}/api/fetch-rank.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-rank.js +0 -0
- /package/es/{src/actions → actions}/api/fetch-skills.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-skills.js +0 -0
- /package/es/{src/actions → actions}/api/fetch-slide.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-slide.js +0 -0
- /package/es/{src/actions → actions}/api/post-answer.d.ts +0 -0
- /package/es/{src/actions → actions}/api/post-answer.js +0 -0
- /package/es/{src/actions → actions}/api/post-progression.d.ts +0 -0
- /package/es/{src/actions → actions}/api/post-progression.js +0 -0
- /package/es/{src/actions → actions}/data/token.d.ts +0 -0
- /package/es/{src/actions → actions}/data/token.js +0 -0
- /package/es/{src/actions → actions}/ui/answers.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/answers.js +0 -0
- /package/es/{src/actions → actions}/ui/navigation.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/navigation.js +0 -0
- /package/es/{src/actions → actions}/ui/next-slide.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/next-slide.js +0 -0
- /package/es/{src/actions → actions}/ui/quit-popin.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/quit-popin.js +0 -0
- /package/es/{src/actions → actions}/ui/slides.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/slides.js +0 -0
- /package/es/{src/common → common}/index.d.ts +0 -0
- /package/es/{src/common → common}/index.js +0 -0
- /package/es/{src/configure-store.d.ts → configure-store.d.ts} +0 -0
- /package/es/{src/configure-store.js → configure-store.js} +0 -0
- /package/es/{src/helpers → helpers}/css-register.d.ts +0 -0
- /package/es/{src/helpers → helpers}/css-register.js +0 -0
- /package/es/{src/index.d.ts → index.d.ts} +0 -0
- /package/es/{src/index.js → index.js} +0 -0
- /package/es/{src/reducers → reducers}/data/corrections.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/corrections.js +0 -0
- /package/es/{src/reducers → reducers}/data/index.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/index.js +0 -0
- /package/es/{src/reducers → reducers}/data/progression.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/progression.js +0 -0
- /package/es/{src/reducers → reducers}/data/rank.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/rank.js +0 -0
- /package/es/{src/reducers → reducers}/data/skills.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/skills.js +0 -0
- /package/es/{src/reducers → reducers}/data/slides.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/slides.js +0 -0
- /package/es/{src/reducers → reducers}/data/token.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/token.js +0 -0
- /package/es/{src/reducers → reducers}/index.d.ts +0 -0
- /package/es/{src/reducers → reducers}/index.js +0 -0
- /package/es/{src/reducers → reducers}/ui/answers.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/answers.js +0 -0
- /package/es/{src/reducers → reducers}/ui/current-slide-ref.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/current-slide-ref.js +0 -0
- /package/es/{src/reducers → reducers}/ui/index.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/index.js +0 -0
- /package/es/{src/reducers → reducers}/ui/navigation.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/navigation.js +0 -0
- /package/es/{src/reducers → reducers}/ui/positions.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/positions.js +0 -0
- /package/es/{src/reducers → reducers}/ui/quit-popin.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/quit-popin.js +0 -0
- /package/es/{src/reducers → reducers}/ui/show-congrats.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/show-congrats.js +0 -0
- /package/es/{src/reducers → reducers}/ui/slide.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/slide.js +0 -0
- /package/es/{src/services → services}/fetch-correction.d.ts +0 -0
- /package/es/{src/services → services}/fetch-correction.js +0 -0
- /package/es/{src/services → services}/fetch-rank.d.ts +0 -0
- /package/es/{src/services → services}/fetch-rank.js +0 -0
- /package/es/{src/services → services}/fetch-skills.d.ts +0 -0
- /package/es/{src/services → services}/fetch-skills.js +0 -0
- /package/es/{src/services → services}/fetch-slide.d.ts +0 -0
- /package/es/{src/services → services}/fetch-slide.js +0 -0
- /package/es/{src/services → services}/fetch-slides-to-review-by-skill-ref.d.ts +0 -0
- /package/es/{src/services → services}/fetch-slides-to-review-by-skill-ref.js +0 -0
- /package/es/{src/services → services}/index.d.ts +0 -0
- /package/es/{src/services → services}/index.js +0 -0
- /package/es/{src/services → services}/post-answer.d.ts +0 -0
- /package/es/{src/services → services}/post-answer.js +0 -0
- /package/es/{src/services → services}/post-progression.d.ts +0 -0
- /package/es/{src/services → services}/post-progression.js +0 -0
- /package/es/{src/services → services}/tools/fetch-responses.d.ts +0 -0
- /package/es/{src/services → services}/tools/fetch-responses.js +0 -0
- /package/es/{src/services → services}/tools/sleep.d.ts +0 -0
- /package/es/{src/services → services}/tools/sleep.js +0 -0
- /package/es/{src/types → types}/common.d.ts +0 -0
- /package/es/{src/types → types}/common.js +0 -0
- /package/es/{src/types → types}/slides.d.ts +0 -0
- /package/es/{src/types → types}/slides.js +0 -0
- /package/es/{src/views → views}/skills/index.d.ts +0 -0
- /package/es/{src/views → views}/skills/index.js +0 -0
- /package/es/{src/views → views}/slides/index.d.ts +0 -0
- /package/es/{src/views → views}/slides/index.js +0 -0
- /package/es/{src/views → views}/slides/map-api-slide-to-ui.d.ts +0 -0
- /package/es/{src/views → views}/slides/map-api-slide-to-ui.js +0 -0
- /package/lib/{src/actions → actions}/api/fetch-correction.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-rank.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-skills.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-slide.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/post-answer.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/post-progression.d.ts +0 -0
- /package/lib/{src/actions → actions}/data/token.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/answers.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/navigation.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/next-slide.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/quit-popin.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/slides.d.ts +0 -0
- /package/lib/{src/common → common}/index.d.ts +0 -0
- /package/lib/{src/configure-store.d.ts → configure-store.d.ts} +0 -0
- /package/lib/{src/helpers → helpers}/css-register.d.ts +0 -0
- /package/lib/{src/index.d.ts → index.d.ts} +0 -0
- /package/lib/{src/reducers → reducers}/data/corrections.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/index.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/progression.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/rank.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/skills.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/slides.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/token.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/index.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/answers.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/current-slide-ref.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/index.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/navigation.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/positions.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/quit-popin.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/show-congrats.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/slide.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-correction.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-rank.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-skills.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-slide.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-slides-to-review-by-skill-ref.d.ts +0 -0
- /package/lib/{src/services → services}/index.d.ts +0 -0
- /package/lib/{src/services → services}/post-answer.d.ts +0 -0
- /package/lib/{src/services → services}/post-progression.d.ts +0 -0
- /package/lib/{src/services → services}/tools/fetch-responses.d.ts +0 -0
- /package/lib/{src/services → services}/tools/sleep.d.ts +0 -0
- /package/lib/{src/types → types}/common.d.ts +0 -0
- /package/lib/{src/types → types}/slides.d.ts +0 -0
- /package/lib/{src/views → views}/skills/index.d.ts +0 -0
- /package/lib/{src/views → views}/slides/index.d.ts +0 -0
- /package/lib/{src/views → views}/slides/map-api-slide-to-ui.d.ts +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchCorrection = exports.CORRECTION_FETCH_FAILURE = exports.CORRECTION_FETCH_SUCCESS = exports.CORRECTION_FETCH_REQUEST = void 0;
|
|
7
|
+
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
8
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
|
+
exports.CORRECTION_FETCH_REQUEST = '@@correction/FETCH_REQUEST';
|
|
10
|
+
exports.CORRECTION_FETCH_SUCCESS = '@@correction/FETCH_SUCCESS';
|
|
11
|
+
exports.CORRECTION_FETCH_FAILURE = '@@correction/FETCH_FAILURE';
|
|
12
|
+
const fetchCorrection = (dispatch, getState, { services }) => {
|
|
13
|
+
const state = getState();
|
|
14
|
+
const slideRef = (0, get_1.default)(['ui', 'currentSlideRef'], state);
|
|
15
|
+
const token = (0, get_1.default)(['data', 'token'], state);
|
|
16
|
+
const progressionId = (0, get_1.default)(['data', 'progression', '_id'], state);
|
|
17
|
+
const answer = (0, get_1.default)(['ui', 'answers', slideRef], state);
|
|
18
|
+
const action = (0, redux_task_1.default)({
|
|
19
|
+
types: [exports.CORRECTION_FETCH_REQUEST, exports.CORRECTION_FETCH_SUCCESS, exports.CORRECTION_FETCH_FAILURE],
|
|
20
|
+
meta: { slideRef },
|
|
21
|
+
task: () => services.fetchCorrection(slideRef, token, progressionId, answer)
|
|
22
|
+
});
|
|
23
|
+
return dispatch(action);
|
|
24
|
+
};
|
|
25
|
+
exports.fetchCorrection = fetchCorrection;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchEndRank = exports.fetchStartRank = exports.fetchRank = exports.RANK_FETCH_END_FAILURE = exports.RANK_FETCH_END_SUCCESS = exports.RANK_FETCH_END_REQUEST = exports.RANK_FETCH_START_FAILURE = exports.RANK_FETCH_START_SUCCESS = exports.RANK_FETCH_START_REQUEST = void 0;
|
|
7
|
+
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
8
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
|
+
exports.RANK_FETCH_START_REQUEST = '@@rank/FETCH_START_REQUEST';
|
|
10
|
+
exports.RANK_FETCH_START_SUCCESS = '@@rank/FETCH_START_SUCCESS';
|
|
11
|
+
exports.RANK_FETCH_START_FAILURE = '@@rank/FETCH_START_FAILURE';
|
|
12
|
+
exports.RANK_FETCH_END_REQUEST = '@@rank/FETCH_END_REQUEST';
|
|
13
|
+
exports.RANK_FETCH_END_SUCCESS = '@@rank/FETCH_END_SUCCESS';
|
|
14
|
+
exports.RANK_FETCH_END_FAILURE = '@@rank/FETCH_END_FAILURE';
|
|
15
|
+
const bailout = (path) => (state) => {
|
|
16
|
+
const value = (0, get_1.default)(path, state);
|
|
17
|
+
return !Number.isNaN(value);
|
|
18
|
+
};
|
|
19
|
+
const fetchRank = (dispatch, getState, services, types, path) => {
|
|
20
|
+
const action = (0, redux_task_1.default)({
|
|
21
|
+
types,
|
|
22
|
+
task: () => {
|
|
23
|
+
const state = getState();
|
|
24
|
+
const token = (0, get_1.default)(['data', 'token'], state);
|
|
25
|
+
return services.fetchRank(token);
|
|
26
|
+
},
|
|
27
|
+
bailout: path ? bailout(path) : undefined
|
|
28
|
+
});
|
|
29
|
+
return dispatch(action);
|
|
30
|
+
};
|
|
31
|
+
exports.fetchRank = fetchRank;
|
|
32
|
+
const fetchStartRank = (dispatch, getState, { services }) => {
|
|
33
|
+
return (0, exports.fetchRank)(dispatch, getState, services, [exports.RANK_FETCH_START_REQUEST, exports.RANK_FETCH_START_SUCCESS, exports.RANK_FETCH_START_FAILURE], 'data.rank.start');
|
|
34
|
+
};
|
|
35
|
+
exports.fetchStartRank = fetchStartRank;
|
|
36
|
+
const fetchEndRank = (dispatch, getState, { services }) => {
|
|
37
|
+
return (0, exports.fetchRank)(dispatch, getState, services, [
|
|
38
|
+
exports.RANK_FETCH_END_REQUEST,
|
|
39
|
+
exports.RANK_FETCH_END_SUCCESS,
|
|
40
|
+
exports.RANK_FETCH_END_FAILURE
|
|
41
|
+
]);
|
|
42
|
+
};
|
|
43
|
+
exports.fetchEndRank = fetchEndRank;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchSkills = exports.SKILLS_FETCH_FAILURE = exports.SKILLS_FETCH_SUCCESS = exports.SKILLS_FETCH_REQUEST = void 0;
|
|
7
|
+
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
8
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
|
+
exports.SKILLS_FETCH_REQUEST = '@@skills/FETCH_REQUEST';
|
|
10
|
+
exports.SKILLS_FETCH_SUCCESS = '@@skills/FETCH_SUCCESS';
|
|
11
|
+
exports.SKILLS_FETCH_FAILURE = '@@skills/FETCH_FAILURE';
|
|
12
|
+
const fetchSkills = (dispatch, getState, { services }) => {
|
|
13
|
+
const action = (0, redux_task_1.default)({
|
|
14
|
+
types: [exports.SKILLS_FETCH_REQUEST, exports.SKILLS_FETCH_SUCCESS, exports.SKILLS_FETCH_FAILURE],
|
|
15
|
+
task: () => {
|
|
16
|
+
const state = getState();
|
|
17
|
+
const token = (0, get_1.default)(['data', 'token'], state);
|
|
18
|
+
return services.fetchSkills(token);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return dispatch(action);
|
|
22
|
+
};
|
|
23
|
+
exports.fetchSkills = fetchSkills;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchSlide = exports.SLIDE_FETCH_FAILURE = exports.SLIDE_FETCH_SUCCESS = exports.SLIDE_FETCH_REQUEST = void 0;
|
|
7
|
+
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
8
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
|
+
const has_1 = __importDefault(require("lodash/fp/has"));
|
|
10
|
+
const isEmpty_1 = __importDefault(require("lodash/fp/isEmpty"));
|
|
11
|
+
const slides_1 = require("../ui/slides");
|
|
12
|
+
exports.SLIDE_FETCH_REQUEST = '@@slides/FETCH_REQUEST';
|
|
13
|
+
exports.SLIDE_FETCH_SUCCESS = '@@slides/FETCH_SUCCESS';
|
|
14
|
+
exports.SLIDE_FETCH_FAILURE = '@@slides/FETCH_FAILURE';
|
|
15
|
+
const fetchSlide = (slideRef) => async (dispatch, getState, { services }) => {
|
|
16
|
+
const action = (0, redux_task_1.default)({
|
|
17
|
+
types: [exports.SLIDE_FETCH_REQUEST, exports.SLIDE_FETCH_SUCCESS, exports.SLIDE_FETCH_FAILURE],
|
|
18
|
+
bailout: (state) => {
|
|
19
|
+
return (0, has_1.default)(`data.slide.${slideRef}`, state);
|
|
20
|
+
},
|
|
21
|
+
task: () => {
|
|
22
|
+
const state = getState();
|
|
23
|
+
const token = (0, get_1.default)(['data', 'token'], state);
|
|
24
|
+
return services.fetchSlide(slideRef, token);
|
|
25
|
+
},
|
|
26
|
+
meta: { slideRef }
|
|
27
|
+
});
|
|
28
|
+
const response = await dispatch(action);
|
|
29
|
+
if (response.type === exports.SLIDE_FETCH_SUCCESS) {
|
|
30
|
+
const slideFromAPI = response.payload;
|
|
31
|
+
const state = getState();
|
|
32
|
+
const slides = (0, get_1.default)('data.progression.state.slides', state);
|
|
33
|
+
if ((0, isEmpty_1.default)(slides)) {
|
|
34
|
+
dispatch((0, slides_1.setCurrentSlide)(slideFromAPI));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.fetchSlide = fetchSlide;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.postAnswer = exports.POST_ANSWER_FAILURE = exports.POST_ANSWER_SUCCESS = exports.POST_ANSWER_REQUEST = void 0;
|
|
7
|
+
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
8
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
|
+
const fetch_correction_1 = require("./fetch-correction");
|
|
10
|
+
const fetch_slide_1 = require("./fetch-slide");
|
|
11
|
+
const fetch_rank_1 = require("./fetch-rank");
|
|
12
|
+
exports.POST_ANSWER_REQUEST = '@@answer/POST_REQUEST';
|
|
13
|
+
exports.POST_ANSWER_SUCCESS = '@@answer/POST_SUCCESS';
|
|
14
|
+
exports.POST_ANSWER_FAILURE = '@@answer/POST_FAILURE';
|
|
15
|
+
const postAnswer = async (dispatch, getState, { services }) => {
|
|
16
|
+
const state = getState();
|
|
17
|
+
const currentSlideRef = (0, get_1.default)(['ui', 'currentSlideRef'], state);
|
|
18
|
+
const token = (0, get_1.default)(['data', 'token'], state);
|
|
19
|
+
const answer = (0, get_1.default)(['ui', 'answers', currentSlideRef], state);
|
|
20
|
+
const progression = (0, get_1.default)(['data', 'progression'], state);
|
|
21
|
+
if (!progression)
|
|
22
|
+
throw new Error('Cannot answer a question of an inexistent progression');
|
|
23
|
+
const action = (0, redux_task_1.default)({
|
|
24
|
+
types: [exports.POST_ANSWER_REQUEST, exports.POST_ANSWER_SUCCESS, exports.POST_ANSWER_FAILURE],
|
|
25
|
+
meta: { slideRef: currentSlideRef },
|
|
26
|
+
task: () => services.postAnswer(progression, token, answer)
|
|
27
|
+
});
|
|
28
|
+
const response = await dispatch(action);
|
|
29
|
+
if (response.type === exports.POST_ANSWER_SUCCESS) {
|
|
30
|
+
const updatedProgression = response.payload;
|
|
31
|
+
const slideRef = updatedProgression.state.nextContent.ref;
|
|
32
|
+
if (slideRef !== 'successExitNode') {
|
|
33
|
+
await dispatch((0, fetch_slide_1.fetchSlide)(slideRef));
|
|
34
|
+
await dispatch(fetch_correction_1.fetchCorrection);
|
|
35
|
+
await dispatch(fetch_rank_1.fetchStartRank);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
await dispatch(fetch_correction_1.fetchCorrection);
|
|
39
|
+
await dispatch(fetch_rank_1.fetchEndRank);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.postAnswer = postAnswer;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.postProgression = exports.POST_PROGRESSION_FAILURE = exports.POST_PROGRESSION_SUCCESS = exports.POST_PROGRESSION_REQUEST = void 0;
|
|
7
|
+
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
8
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
|
+
const fetch_slide_1 = require("./fetch-slide");
|
|
10
|
+
exports.POST_PROGRESSION_REQUEST = '@@progression/POST_REQUEST';
|
|
11
|
+
exports.POST_PROGRESSION_SUCCESS = '@@progression/POST_SUCCESS';
|
|
12
|
+
exports.POST_PROGRESSION_FAILURE = '@@progression/POST_FAILURE';
|
|
13
|
+
const postProgression = (skillRef) => async (dispatch, getState, { services }) => {
|
|
14
|
+
const state = getState();
|
|
15
|
+
const token = (0, get_1.default)(['data', 'token'], state);
|
|
16
|
+
const action = (0, redux_task_1.default)({
|
|
17
|
+
types: [exports.POST_PROGRESSION_REQUEST, exports.POST_PROGRESSION_SUCCESS, exports.POST_PROGRESSION_FAILURE],
|
|
18
|
+
task: () => services.postProgression(skillRef, token)
|
|
19
|
+
});
|
|
20
|
+
const response = await dispatch(action);
|
|
21
|
+
if (response.type === exports.POST_PROGRESSION_SUCCESS) {
|
|
22
|
+
const progression = response.payload;
|
|
23
|
+
const slideRef = progression.state.nextContent.ref;
|
|
24
|
+
await dispatch((0, fetch_slide_1.fetchSlide)(slideRef));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.postProgression = postProgression;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storeToken = exports.STORE_TOKEN = void 0;
|
|
4
|
+
exports.STORE_TOKEN = '@@data/token/STORE_TOKEN';
|
|
5
|
+
const storeToken = (token) => ({
|
|
6
|
+
type: exports.STORE_TOKEN,
|
|
7
|
+
payload: token
|
|
8
|
+
});
|
|
9
|
+
exports.storeToken = storeToken;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.editAnswer = exports.ANSWER_EDIT = exports.EDIT_SLIDER = exports.EDIT_BASIC = exports.EDIT_TEMPLATE = exports.EDIT_QCM_DRAG = exports.EDIT_QCM_GRAPHIC = exports.EDIT_QCM = void 0;
|
|
7
|
+
const flatten_1 = __importDefault(require("lodash/fp/flatten"));
|
|
8
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
|
+
const getOr_1 = __importDefault(require("lodash/fp/getOr"));
|
|
10
|
+
const includes_1 = __importDefault(require("lodash/fp/includes"));
|
|
11
|
+
const pull_1 = __importDefault(require("lodash/fp/pull"));
|
|
12
|
+
exports.EDIT_QCM = '@@answer/EDIT_QCM';
|
|
13
|
+
exports.EDIT_QCM_GRAPHIC = '@@answer/EDIT_QCM_GRAPHIC';
|
|
14
|
+
exports.EDIT_QCM_DRAG = '@@answer/EDIT_QCM_DRAG';
|
|
15
|
+
exports.EDIT_TEMPLATE = '@@answer/EDIT_TEMPLATE';
|
|
16
|
+
exports.EDIT_BASIC = '@@answer/EDIT_BASIC';
|
|
17
|
+
exports.EDIT_SLIDER = '@@answer/EDIT_SLIDER';
|
|
18
|
+
exports.ANSWER_EDIT = {
|
|
19
|
+
qcm: exports.EDIT_QCM,
|
|
20
|
+
qcmGraphic: exports.EDIT_QCM_GRAPHIC,
|
|
21
|
+
qcmDrag: exports.EDIT_QCM_DRAG,
|
|
22
|
+
template: exports.EDIT_TEMPLATE,
|
|
23
|
+
basic: exports.EDIT_BASIC,
|
|
24
|
+
slider: exports.EDIT_SLIDER
|
|
25
|
+
};
|
|
26
|
+
const buildAnswer = (userAnswers, questionType, newValue) => {
|
|
27
|
+
switch (questionType) {
|
|
28
|
+
case 'qcm':
|
|
29
|
+
case 'qcmGraphic':
|
|
30
|
+
case 'qcmDrag': {
|
|
31
|
+
const firstValue = newValue[0];
|
|
32
|
+
return (0, includes_1.default)(firstValue, userAnswers)
|
|
33
|
+
? (0, pull_1.default)(firstValue, userAnswers)
|
|
34
|
+
: (0, flatten_1.default)([...userAnswers, firstValue]);
|
|
35
|
+
}
|
|
36
|
+
case 'basic':
|
|
37
|
+
case 'slider':
|
|
38
|
+
case 'template':
|
|
39
|
+
return newValue;
|
|
40
|
+
/* istanbul ignore next */ default:
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const editAnswer = (answer) => (dispatch, getState) => {
|
|
45
|
+
const state = getState();
|
|
46
|
+
const currentSlideRef = (0, get_1.default)(['ui', 'currentSlideRef'], state);
|
|
47
|
+
const userAnswers = (0, getOr_1.default)([], ['ui', 'answers', currentSlideRef], state);
|
|
48
|
+
const slide = (0, get_1.default)(['data', 'slides', currentSlideRef], state);
|
|
49
|
+
if (!slide)
|
|
50
|
+
throw new Error('No slide was found');
|
|
51
|
+
const questionType = (0, get_1.default)(['question', 'type'], slide);
|
|
52
|
+
const type = (0, get_1.default)(questionType, exports.ANSWER_EDIT);
|
|
53
|
+
if (!type)
|
|
54
|
+
throw new Error(`Question type ${questionType} is not supported`);
|
|
55
|
+
return dispatch({
|
|
56
|
+
type,
|
|
57
|
+
meta: { slideRef: currentSlideRef },
|
|
58
|
+
payload: buildAnswer(userAnswers, questionType, answer)
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
exports.editAnswer = editAnswer;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.navigateBack = exports.navigateTo = exports.START_APP = exports.NAVIGATE_BACK = exports.NAVIGATE_TO = void 0;
|
|
4
|
+
exports.NAVIGATE_TO = '@@navigation/NAVIGATE_TO';
|
|
5
|
+
exports.NAVIGATE_BACK = '@@navigation/NAVIGATE_BACK';
|
|
6
|
+
exports.START_APP = '@@navigation/START_APP';
|
|
7
|
+
const navigateTo = (newViewName) => async (dispatch, getState, { callbackOnViewChanged }) => {
|
|
8
|
+
const action = {
|
|
9
|
+
type: exports.NAVIGATE_TO,
|
|
10
|
+
payload: newViewName
|
|
11
|
+
};
|
|
12
|
+
const res = await dispatch(action);
|
|
13
|
+
if (callbackOnViewChanged) {
|
|
14
|
+
callbackOnViewChanged(newViewName);
|
|
15
|
+
}
|
|
16
|
+
return res;
|
|
17
|
+
};
|
|
18
|
+
exports.navigateTo = navigateTo;
|
|
19
|
+
const navigateBack = async (dispatch, getState, { callbackOnViewChanged }) => {
|
|
20
|
+
const action = {
|
|
21
|
+
type: exports.NAVIGATE_BACK
|
|
22
|
+
};
|
|
23
|
+
const res = await dispatch(action);
|
|
24
|
+
if (callbackOnViewChanged) {
|
|
25
|
+
const storeState = getState();
|
|
26
|
+
const viewName = storeState.ui.navigation[storeState.ui.navigation.length - 1];
|
|
27
|
+
callbackOnViewChanged(viewName);
|
|
28
|
+
}
|
|
29
|
+
return res;
|
|
30
|
+
};
|
|
31
|
+
exports.navigateBack = navigateBack;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.nextSlide = exports.NEXT_SLIDE = void 0;
|
|
7
|
+
const filter_1 = __importDefault(require("lodash/fp/filter"));
|
|
8
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
|
+
exports.NEXT_SLIDE = '@@slide/NEXT_SLIDE';
|
|
10
|
+
const nextSlide = (dispatch, getState) => {
|
|
11
|
+
const state = getState();
|
|
12
|
+
const progression = state.data.progression;
|
|
13
|
+
const { isCorrect, allAnswers, slides } = progression.state;
|
|
14
|
+
const correctAnswers = (0, filter_1.default)((answer) => answer.isCorrect, allAnswers);
|
|
15
|
+
const payload = {
|
|
16
|
+
currentSlideRef: (0, get_1.default)(['ui', 'currentSlideRef'], state),
|
|
17
|
+
nextSlideRef: (0, get_1.default)(['state', 'nextContent', 'ref'], state.data.progression),
|
|
18
|
+
animationType: isCorrect ? 'unstack' : 'restack',
|
|
19
|
+
totalCorrectAnswers: correctAnswers.length,
|
|
20
|
+
answeredSlides: slides
|
|
21
|
+
};
|
|
22
|
+
const action = {
|
|
23
|
+
type: exports.NEXT_SLIDE,
|
|
24
|
+
payload
|
|
25
|
+
};
|
|
26
|
+
return dispatch(action);
|
|
27
|
+
};
|
|
28
|
+
exports.nextSlide = nextSlide;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.closeQuitPopin = exports.openQuitPopin = exports.CLOSE_POPIN = exports.OPEN_POPIN = void 0;
|
|
4
|
+
exports.OPEN_POPIN = '@@ui/OPEN_POPIN';
|
|
5
|
+
exports.CLOSE_POPIN = '@@ui/CLOSE_POPIN';
|
|
6
|
+
exports.openQuitPopin = {
|
|
7
|
+
type: exports.OPEN_POPIN
|
|
8
|
+
};
|
|
9
|
+
exports.closeQuitPopin = {
|
|
10
|
+
type: exports.CLOSE_POPIN
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setCurrentSlide = exports.SET_CURRENT_SLIDE = void 0;
|
|
4
|
+
exports.SET_CURRENT_SLIDE = '@@slide/SET_CURRENT_SLIDE';
|
|
5
|
+
const setCurrentSlide = (payload) => ({
|
|
6
|
+
type: exports.SET_CURRENT_SLIDE,
|
|
7
|
+
payload
|
|
8
|
+
});
|
|
9
|
+
exports.setCurrentSlide = setCurrentSlide;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getProgressionSlidesRefs = exports.slideIndexes = void 0;
|
|
7
|
+
const concat_1 = __importDefault(require("lodash/fp/concat"));
|
|
8
|
+
const slice_1 = __importDefault(require("lodash/fp/slice"));
|
|
9
|
+
exports.slideIndexes = ['0', '1', '2', '3', '4'];
|
|
10
|
+
const getProgressionSlidesRefs = (progression) => {
|
|
11
|
+
if (progression.state.step.current <= 5) {
|
|
12
|
+
const slideRef = progression.state.nextContent.ref;
|
|
13
|
+
return (0, concat_1.default)(progression.state.slides, [slideRef]);
|
|
14
|
+
}
|
|
15
|
+
return (0, slice_1.default)(0, 5, progression.state.slides);
|
|
16
|
+
};
|
|
17
|
+
exports.getProgressionSlidesRefs = getProgressionSlidesRefs;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const redux_1 = require("redux");
|
|
7
|
+
const redux_thunk_1 = __importDefault(require("redux-thunk"));
|
|
8
|
+
const reducers_1 = __importDefault(require("./reducers"));
|
|
9
|
+
const services_1 = require("./services");
|
|
10
|
+
function configureStore(options) {
|
|
11
|
+
const _compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
12
|
+
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
|
|
13
|
+
name: 'app-review',
|
|
14
|
+
trace: true,
|
|
15
|
+
traceLimit: 25
|
|
16
|
+
})
|
|
17
|
+
: redux_1.compose;
|
|
18
|
+
const thunkOptions = {
|
|
19
|
+
services: options.services || (0, services_1.getServices)(),
|
|
20
|
+
callbackOnViewChanged: options.callbackOnViewChanged
|
|
21
|
+
};
|
|
22
|
+
const thunkMiddleware = redux_thunk_1.default.withExtraArgument(thunkOptions);
|
|
23
|
+
const enhancer = _compose((0, redux_1.applyMiddleware)(thunkMiddleware));
|
|
24
|
+
const store = (0, redux_1.createStore)(reducers_1.default, undefined, enhancer);
|
|
25
|
+
return store;
|
|
26
|
+
}
|
|
27
|
+
exports.default = configureStore;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const css_modules_require_hook_1 = __importDefault(require("@coorpacademy/css-modules-require-hook"));
|
|
7
|
+
(0, css_modules_require_hook_1.default)();
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const react_redux_1 = require("react-redux");
|
|
31
|
+
const app_review_1 = __importDefault(require("@coorpacademy/components/es/template/app-review"));
|
|
32
|
+
const isEmpty_1 = __importDefault(require("lodash/fp/isEmpty"));
|
|
33
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
34
|
+
const configure_store_1 = __importDefault(require("./configure-store"));
|
|
35
|
+
const navigation_1 = require("./actions/ui/navigation");
|
|
36
|
+
const token_1 = require("./actions/data/token");
|
|
37
|
+
const fetch_skills_1 = require("./actions/api/fetch-skills");
|
|
38
|
+
const post_progression_1 = require("./actions/api/post-progression");
|
|
39
|
+
const slides_1 = require("./views/slides");
|
|
40
|
+
const skills_1 = require("./views/skills");
|
|
41
|
+
const ConnectedApp = ({ onQuitClick }) => {
|
|
42
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
43
|
+
const props = {
|
|
44
|
+
navigateBack: () => dispatch(navigation_1.navigateBack),
|
|
45
|
+
viewName: (0, react_redux_1.useSelector)((state) => state.ui.navigation[state.ui.navigation.length - 1]),
|
|
46
|
+
slides: (0, react_redux_1.useSelector)((state) => (0, slides_1.mapStateToSlidesProps)(state, dispatch, onQuitClick)),
|
|
47
|
+
skills: (0, react_redux_1.useSelector)((state) => (0, skills_1.mapStateToSkillsProps)(state)),
|
|
48
|
+
onboarding: {}
|
|
49
|
+
};
|
|
50
|
+
return react_1.default.createElement(app_review_1.default, { ...props });
|
|
51
|
+
};
|
|
52
|
+
const AppReview = ({ options }) => {
|
|
53
|
+
const [store, setStore] = (0, react_1.useState)(null);
|
|
54
|
+
const [isProgressionCreated, setIsProgressionCreated] = (0, react_1.useState)(false);
|
|
55
|
+
const onQuitClick = options.onQuitClick;
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
if (store)
|
|
58
|
+
return;
|
|
59
|
+
const newStore = (0, configure_store_1.default)(options);
|
|
60
|
+
setStore(newStore);
|
|
61
|
+
}, [options, store]);
|
|
62
|
+
(0, react_1.useEffect)(() => {
|
|
63
|
+
if (!store || isProgressionCreated)
|
|
64
|
+
return;
|
|
65
|
+
return store.subscribe(() => {
|
|
66
|
+
const isProgressionPresent = !(0, isEmpty_1.default)(store.getState().data.progression);
|
|
67
|
+
return isProgressionPresent && setIsProgressionCreated(isProgressionPresent);
|
|
68
|
+
});
|
|
69
|
+
}, [isProgressionCreated, options, store]);
|
|
70
|
+
(0, react_1.useEffect)(() => {
|
|
71
|
+
const token = (0, get_1.default)('token', options);
|
|
72
|
+
if (store === null || (0, isEmpty_1.default)(token))
|
|
73
|
+
return;
|
|
74
|
+
store.dispatch((0, token_1.storeToken)(token));
|
|
75
|
+
}, [options, store]);
|
|
76
|
+
(0, react_1.useEffect)(() => {
|
|
77
|
+
const token = (0, get_1.default)('token', options);
|
|
78
|
+
if (store === null || (0, isEmpty_1.default)(token))
|
|
79
|
+
return;
|
|
80
|
+
const skillRef = (0, get_1.default)('skillRef', options);
|
|
81
|
+
/* ThunkAction is not assignable to parameter of type 'AnyAction'
|
|
82
|
+
ts problem is described here = https://github.com/reduxjs/redux-thunk/issues/333 */
|
|
83
|
+
skillRef ? store.dispatch((0, post_progression_1.postProgression)(skillRef)) : store.dispatch(fetch_skills_1.fetchSkills);
|
|
84
|
+
}, [options, store]);
|
|
85
|
+
(0, react_1.useEffect)(() => {
|
|
86
|
+
if (store === null)
|
|
87
|
+
return;
|
|
88
|
+
const { skillRef } = options;
|
|
89
|
+
if (skillRef && !isProgressionCreated) {
|
|
90
|
+
store.dispatch((0, navigation_1.navigateTo)('loader')); // use loader while posting progression
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const initialView = skillRef ? 'slides' : 'skills';
|
|
94
|
+
store.dispatch((0, navigation_1.navigateTo)(initialView));
|
|
95
|
+
}, [isProgressionCreated, options, store]);
|
|
96
|
+
if (!store)
|
|
97
|
+
return null;
|
|
98
|
+
return (react_1.default.createElement(react_redux_1.Provider, { store: store },
|
|
99
|
+
react_1.default.createElement(ConnectedApp, { onQuitClick: onQuitClick })));
|
|
100
|
+
};
|
|
101
|
+
exports.default = AppReview;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const set_1 = __importDefault(require("lodash/fp/set"));
|
|
7
|
+
const fetch_correction_1 = require("../../actions/api/fetch-correction");
|
|
8
|
+
const initialState = {};
|
|
9
|
+
const reducer = (
|
|
10
|
+
// eslint-disable-next-line default-param-last
|
|
11
|
+
state = initialState, action) => {
|
|
12
|
+
switch (action.type) {
|
|
13
|
+
case fetch_correction_1.CORRECTION_FETCH_REQUEST: {
|
|
14
|
+
const { meta } = action;
|
|
15
|
+
return (0, set_1.default)([meta.slideRef], null, state);
|
|
16
|
+
}
|
|
17
|
+
case fetch_correction_1.CORRECTION_FETCH_SUCCESS: {
|
|
18
|
+
const { meta } = action;
|
|
19
|
+
const correction = action.payload;
|
|
20
|
+
return (0, set_1.default)([meta.slideRef], correction, state);
|
|
21
|
+
}
|
|
22
|
+
default:
|
|
23
|
+
return state;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.default = reducer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const redux_1 = require("redux");
|
|
7
|
+
const corrections_1 = __importDefault(require("./corrections"));
|
|
8
|
+
const progression_1 = __importDefault(require("./progression"));
|
|
9
|
+
const skills_1 = __importDefault(require("./skills"));
|
|
10
|
+
const slides_1 = __importDefault(require("./slides"));
|
|
11
|
+
const token_1 = __importDefault(require("./token"));
|
|
12
|
+
const rank_1 = __importDefault(require("./rank"));
|
|
13
|
+
exports.default = (0, redux_1.combineReducers)({ corrections: corrections_1.default, progression: progression_1.default, skills: skills_1.default, slides: slides_1.default, token: token_1.default, rank: rank_1.default });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const post_answer_1 = require("../../actions/api/post-answer");
|
|
4
|
+
const post_progression_1 = require("../../actions/api/post-progression");
|
|
5
|
+
const reducer = (
|
|
6
|
+
// eslint-disable-next-line default-param-last
|
|
7
|
+
state = null, action) => {
|
|
8
|
+
switch (action.type) {
|
|
9
|
+
case post_answer_1.POST_ANSWER_SUCCESS:
|
|
10
|
+
case post_progression_1.POST_PROGRESSION_SUCCESS: {
|
|
11
|
+
const progression = action.payload;
|
|
12
|
+
return progression;
|
|
13
|
+
}
|
|
14
|
+
default:
|
|
15
|
+
return state;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.default = reducer;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const set_1 = __importDefault(require("lodash/fp/set"));
|
|
7
|
+
const post_progression_1 = require("../../actions/api/post-progression");
|
|
8
|
+
const fetch_rank_1 = require("../../actions/api/fetch-rank");
|
|
9
|
+
const initialState = {
|
|
10
|
+
start: Number.NaN,
|
|
11
|
+
end: Number.NaN
|
|
12
|
+
};
|
|
13
|
+
const reducer = (
|
|
14
|
+
// eslint-disable-next-line default-param-last
|
|
15
|
+
state = initialState, action) => {
|
|
16
|
+
switch (action.type) {
|
|
17
|
+
case post_progression_1.POST_PROGRESSION_SUCCESS: {
|
|
18
|
+
return initialState;
|
|
19
|
+
}
|
|
20
|
+
case fetch_rank_1.RANK_FETCH_START_SUCCESS: {
|
|
21
|
+
const { payload } = action;
|
|
22
|
+
return (0, set_1.default)('start', payload.rank, state);
|
|
23
|
+
}
|
|
24
|
+
case fetch_rank_1.RANK_FETCH_END_SUCCESS: {
|
|
25
|
+
const { payload } = action;
|
|
26
|
+
return (0, set_1.default)('end', payload.rank, state);
|
|
27
|
+
}
|
|
28
|
+
default:
|
|
29
|
+
return state;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.default = reducer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fetch_skills_1 = require("../../actions/api/fetch-skills");
|
|
4
|
+
// eslint-disable-next-line default-param-last
|
|
5
|
+
const reducer = (state = [], action) => {
|
|
6
|
+
switch (action.type) {
|
|
7
|
+
case fetch_skills_1.SKILLS_FETCH_SUCCESS:
|
|
8
|
+
return action.payload;
|
|
9
|
+
default:
|
|
10
|
+
return state;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.default = reducer;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.initialState = void 0;
|
|
7
|
+
const set_1 = __importDefault(require("lodash/fp/set"));
|
|
8
|
+
const fetch_slide_1 = require("../../actions/api/fetch-slide");
|
|
9
|
+
exports.initialState = {};
|
|
10
|
+
// eslint-disable-next-line default-param-last
|
|
11
|
+
const reducer = (state = exports.initialState, action) => {
|
|
12
|
+
switch (action.type) {
|
|
13
|
+
case fetch_slide_1.SLIDE_FETCH_REQUEST: {
|
|
14
|
+
const { meta } = action;
|
|
15
|
+
return (0, set_1.default)([meta.slideRef], null, state);
|
|
16
|
+
}
|
|
17
|
+
case fetch_slide_1.SLIDE_FETCH_SUCCESS: {
|
|
18
|
+
const slide = action.payload;
|
|
19
|
+
return (0, set_1.default)([slide._id], slide, state);
|
|
20
|
+
}
|
|
21
|
+
default:
|
|
22
|
+
return state;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.default = reducer;
|