@coorpacademy/player-web 4.29.19 → 4.29.20
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/es/map-state-to-props/slide.js +29 -4
- package/es/map-state-to-props/slide.js.map +1 -1
- package/es/map-state-to-props/test/slide.js +139 -3
- package/es/map-state-to-props/test/slide.js.map +1 -1
- package/es/store.js +3 -2
- package/es/store.js.map +1 -1
- package/es/test/init-reducers.js +3 -0
- package/es/test/init-reducers.js.map +1 -1
- package/lib/map-state-to-props/slide.js +28 -3
- package/lib/map-state-to-props/slide.js.map +1 -1
- package/lib/map-state-to-props/test/slide.js +139 -3
- package/lib/map-state-to-props/test/slide.js.map +1 -1
- package/lib/store.js +3 -2
- package/lib/store.js.map +1 -1
- package/lib/test/init-reducers.js +3 -0
- package/lib/test/init-reducers.js.map +1 -1
- package/package.json +4 -4
|
@@ -4,47 +4,54 @@ import _map from "lodash/fp/map";
|
|
|
4
4
|
import _get from "lodash/fp/get";
|
|
5
5
|
import _filter from "lodash/fp/filter";
|
|
6
6
|
import _cloneDeep from "lodash/fp/cloneDeep";
|
|
7
|
-
import { getCurrentSlide, getLives, hideTourguide, isTourguideEligible, setTourguideStep } from '@coorpacademy/player-store';
|
|
7
|
+
import { getCurrentSlide, getLives, hideTourguide, isTourguideEligible, setTourguideStep, trackTourguideCompleted, trackTourguideDismissed, trackTourguideStarted, trackTourguideStepViewed } from '@coorpacademy/player-store';
|
|
8
8
|
import createPlayerStateToProps from './player';
|
|
9
9
|
import mapStateToErrorPopinProps from './error-popin';
|
|
10
|
-
const TOUR_GROUP = 'app-player-
|
|
10
|
+
const TOUR_GROUP = 'app-player-question-tour-guide';
|
|
11
11
|
const createTutorialSteps = translate => [{
|
|
12
|
+
ref: 'page',
|
|
12
13
|
target: 'body',
|
|
13
14
|
title: translate('Tourguide step 1 title'),
|
|
14
15
|
content: translate('Tourguide step 1 content'),
|
|
15
16
|
order: 1,
|
|
16
17
|
group: TOUR_GROUP
|
|
17
18
|
}, {
|
|
19
|
+
ref: 'slide',
|
|
18
20
|
target: '[data-name="slide"]',
|
|
19
21
|
title: translate('Tourguide step 2 title'),
|
|
20
22
|
content: translate('Tourguide step 2 content'),
|
|
21
23
|
order: 2,
|
|
22
24
|
group: TOUR_GROUP
|
|
23
25
|
}, {
|
|
26
|
+
ref: 'media',
|
|
24
27
|
target: '[data-type="media"]',
|
|
25
28
|
title: translate('Tourguide step 3 title'),
|
|
26
29
|
content: translate('Tourguide step 3 content'),
|
|
27
30
|
order: 3,
|
|
28
31
|
group: TOUR_GROUP
|
|
29
32
|
}, {
|
|
33
|
+
ref: 'clue',
|
|
30
34
|
target: '[data-type="clue"]',
|
|
31
35
|
title: translate('Tourguide step 4 title'),
|
|
32
36
|
content: translate('Tourguide step 4 content'),
|
|
33
37
|
order: 4,
|
|
34
38
|
group: TOUR_GROUP
|
|
35
39
|
}, {
|
|
40
|
+
ref: 'language',
|
|
36
41
|
target: '[data-name="button-multi-lang"]',
|
|
37
42
|
title: translate('Tourguide step 5 title'),
|
|
38
43
|
content: translate('Tourguide step 5 content'),
|
|
39
44
|
order: 5,
|
|
40
45
|
group: TOUR_GROUP
|
|
41
46
|
}, {
|
|
47
|
+
ref: 'help',
|
|
42
48
|
target: '[data-name="help-button"]',
|
|
43
49
|
title: translate('Tourguide step 6 title'),
|
|
44
50
|
content: translate('Tourguide step 6 content'),
|
|
45
51
|
order: 6,
|
|
46
52
|
group: TOUR_GROUP
|
|
47
53
|
}, {
|
|
54
|
+
ref: 'life',
|
|
48
55
|
target: '[data-name="life"]',
|
|
49
56
|
title: translate('Tourguide step 7 title'),
|
|
50
57
|
content: translate('Tourguide step 7 content'),
|
|
@@ -86,6 +93,16 @@ const tourguideStateToProps = (state, options, store) => {
|
|
|
86
93
|
}
|
|
87
94
|
return true;
|
|
88
95
|
}), _map(_cloneDeep))(createTutorialSteps(translate));
|
|
96
|
+
const getStepTracking = stepIndex => {
|
|
97
|
+
const totalSteps = stepsForTour.length;
|
|
98
|
+
const isValidIndex = typeof stepIndex === 'number' && stepIndex >= 0 && stepIndex < totalSteps;
|
|
99
|
+
const stepRef = isValidIndex ? stepsForTour[stepIndex].ref : null;
|
|
100
|
+
return {
|
|
101
|
+
stepRef,
|
|
102
|
+
stepNumber: isValidIndex ? stepIndex + 1 : null,
|
|
103
|
+
totalSteps
|
|
104
|
+
};
|
|
105
|
+
};
|
|
89
106
|
if (!tourguideVisible) {
|
|
90
107
|
return null;
|
|
91
108
|
}
|
|
@@ -95,8 +112,16 @@ const tourguideStateToProps = (state, options, store) => {
|
|
|
95
112
|
autoStart: tourguideVisible,
|
|
96
113
|
forceStart: tourguideForceStart,
|
|
97
114
|
startStep: tourguideStep,
|
|
98
|
-
|
|
99
|
-
|
|
115
|
+
onStart: () => store.dispatch(trackTourguideStarted(TOUR_GROUP, getStepTracking(tourguideStep))),
|
|
116
|
+
onStepChange: step => {
|
|
117
|
+
store.dispatch(trackTourguideStepViewed(TOUR_GROUP, getStepTracking(step)));
|
|
118
|
+
store.dispatch(setTourguideStep(step));
|
|
119
|
+
},
|
|
120
|
+
onExit: () => {
|
|
121
|
+
store.dispatch(trackTourguideDismissed(TOUR_GROUP, getStepTracking(tourguideStep)));
|
|
122
|
+
store.dispatch(hideTourguide());
|
|
123
|
+
},
|
|
124
|
+
onFinish: () => store.dispatch(trackTourguideCompleted(TOUR_GROUP, getStepTracking(tourguideStep))),
|
|
100
125
|
options: {
|
|
101
126
|
closeButton: false,
|
|
102
127
|
nextLabel: translate('Tourguide next'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide.js","names":["getCurrentSlide","getLives","hideTourguide","isTourguideEligible","setTourguideStep","createPlayerStateToProps","mapStateToErrorPopinProps","TOUR_GROUP","createTutorialSteps","translate","target","title","content","order","group","tourguideStateToProps","state","options","store","slide","hasMedia","_pipe","_get","_size","hasClue","Boolean","hide","livesHidden","tourguideState","tourguideVisible","visible","tourguideStep","step","tourguideForceStart","forceStart","canShowHelp","multiLangOptions","multiLang","canShowLang","stepsForTour","_filter","_map","_cloneDeep","steps","autoStart","startStep","onStepChange","dispatch","onExit","closeButton","nextLabel","prevLabel","finishLabel","targetPadding","showStepDots","keyboardControls","exitOnEscape","exitOnClickOutside","debug","completeOnFinish","rememberStep","playerProps","errorPopinStateToProps","playerStateToProps","player","tourguide","popin"],"sources":["../../src/map-state-to-props/slide.js"],"sourcesContent":["import {\n getCurrentSlide,\n getLives,\n hideTourguide,\n isTourguideEligible,\n setTourguideStep\n} from '@coorpacademy/player-store';\nimport {cloneDeep, filter, get, map, pipe, size} from 'lodash/fp';\nimport createPlayerStateToProps from './player';\nimport mapStateToErrorPopinProps from './error-popin';\n\nconst TOUR_GROUP = 'app-player-intro-fixture';\n\nconst createTutorialSteps = translate => [\n {\n target: 'body',\n title: translate('Tourguide step 1 title'),\n content: translate('Tourguide step 1 content'),\n order: 1,\n group: TOUR_GROUP\n },\n {\n target: '[data-name=\"slide\"]',\n title: translate('Tourguide step 2 title'),\n content: translate('Tourguide step 2 content'),\n order: 2,\n group: TOUR_GROUP\n },\n {\n target: '[data-type=\"media\"]',\n title: translate('Tourguide step 3 title'),\n content: translate('Tourguide step 3 content'),\n order: 3,\n group: TOUR_GROUP\n },\n {\n target: '[data-type=\"clue\"]',\n title: translate('Tourguide step 4 title'),\n content: translate('Tourguide step 4 content'),\n order: 4,\n group: TOUR_GROUP\n },\n {\n target: '[data-name=\"button-multi-lang\"]',\n title: translate('Tourguide step 5 title'),\n content: translate('Tourguide step 5 content'),\n order: 5,\n group: TOUR_GROUP\n },\n {\n target: '[data-name=\"help-button\"]',\n title: translate('Tourguide step 6 title'),\n content: translate('Tourguide step 6 content'),\n order: 6,\n group: TOUR_GROUP\n },\n {\n target: '[data-name=\"life\"]',\n title: translate('Tourguide step 7 title'),\n content: translate('Tourguide step 7 content'),\n order: 7,\n group: TOUR_GROUP\n }\n];\n\nconst tourguideStateToProps = (state, options, store) => {\n const {translate} = options;\n const slide = getCurrentSlide(state);\n const hasMedia = pipe(get('lessons'), size)(slide) > 0;\n const hasClue = pipe(get('hasClue'), Boolean)(slide);\n const {hide: livesHidden} = getLives(state);\n const tourguideState = get('ui.tourguide', state) || {};\n const tourguideVisible = Boolean(tourguideState.visible);\n const tourguideStep = typeof tourguideState.step === 'number' ? tourguideState.step : 0;\n const tourguideForceStart = Boolean(tourguideState.forceStart);\n const canShowHelp = isTourguideEligible(state, options);\n const multiLangOptions = options.multiLang || {};\n const canShowLang = pipe(get('supportedLangs'), size)(multiLangOptions) > 1;\n\n const stepsForTour = pipe(\n filter(step => {\n if (step.order === 3) {\n return hasMedia;\n }\n if (step.order === 4) {\n return hasClue;\n }\n if (step.order === 5) {\n return canShowLang;\n }\n if (step.order === 6) {\n return canShowHelp;\n }\n if (step.order === 7) {\n return !livesHidden;\n }\n return true;\n }),\n map(cloneDeep)\n )(createTutorialSteps(translate));\n\n if (!tourguideVisible) {\n return null;\n }\n\n return {\n steps: stepsForTour,\n group: TOUR_GROUP,\n autoStart: tourguideVisible,\n forceStart: tourguideForceStart,\n startStep: tourguideStep,\n onStepChange: step => store.dispatch(setTourguideStep(step)),\n onExit: () => store.dispatch(hideTourguide()),\n options: {\n closeButton: false,\n nextLabel: translate('Tourguide next'),\n prevLabel: translate('Tourguide prev'),\n finishLabel: translate('Tourguide finish'),\n targetPadding: 2,\n showStepDots: false,\n keyboardControls: true,\n exitOnEscape: true,\n exitOnClickOutside: true,\n debug: false,\n completeOnFinish: true,\n rememberStep: true\n }\n };\n};\n\nconst playerProps = (options, store) => {\n const errorPopinStateToProps = mapStateToErrorPopinProps({dispatch: store.dispatch});\n const playerStateToProps = createPlayerStateToProps(options, store);\n\n return state => {\n return {\n player: playerStateToProps(state),\n tourguide: tourguideStateToProps(state, options, store),\n popin: errorPopinStateToProps(state)\n };\n };\n};\n\nexport default playerProps;\n"],"mappings":";;;;;;AAAA,SACEA,eAAe,EACfC,QAAQ,EACRC,aAAa,EACbC,mBAAmB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AAE,KAAK;MACnBC,gBAAgB,EAAE,IAAI;MACtBC,YAAY,EAAE,IAAI;MAClBC,kBAAkB,EAAE,IAAI;MACxBC,KAAK,EAAE,KAAK;MACZC,gBAAgB,EAAE,IAAI;MACtBC,YAAY,EAAE;IAChB;EACF,CAAC;AACH,CAAC;AAED,MAAMC,WAAW,GAAGA,CAAC5C,OAAO,EAAEC,KAAK,KAAK;EACtC,MAAM4C,sBAAsB,GAAGxD,yBAAyB,CAAC;IAACyC,QAAQ,EAAE7B,KAAK,CAAC6B;EAAQ,CAAC,CAAC;EACpF,MAAMgB,kBAAkB,GAAG1D,wBAAwB,CAACY,OAAO,EAAEC,KAAK,CAAC;EAEnE,OAAOF,KAAK,IAAI;IACd,OAAO;MACLgD,MAAM,EAAED,kBAAkB,CAAC/C,KAAK,CAAC;MACjCiD,SAAS,EAAElD,qBAAqB,CAACC,KAAK,EAAEC,OAAO,EAAEC,KAAK,CAAC;MACvDgD,KAAK,EAAEJ,sBAAsB,CAAC9C,KAAK;IACrC,CAAC;EACH,CAAC;AACH,CAAC;AAED,eAAe6C,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"slide.js","names":["getCurrentSlide","getLives","hideTourguide","isTourguideEligible","setTourguideStep","trackTourguideCompleted","trackTourguideDismissed","trackTourguideStarted","trackTourguideStepViewed","createPlayerStateToProps","mapStateToErrorPopinProps","TOUR_GROUP","createTutorialSteps","translate","ref","target","title","content","order","group","tourguideStateToProps","state","options","store","slide","hasMedia","_pipe","_get","_size","hasClue","Boolean","hide","livesHidden","tourguideState","tourguideVisible","visible","tourguideStep","step","tourguideForceStart","forceStart","canShowHelp","multiLangOptions","multiLang","canShowLang","stepsForTour","_filter","_map","_cloneDeep","getStepTracking","stepIndex","totalSteps","length","isValidIndex","stepRef","stepNumber","steps","autoStart","startStep","onStart","dispatch","onStepChange","onExit","onFinish","closeButton","nextLabel","prevLabel","finishLabel","targetPadding","showStepDots","keyboardControls","exitOnEscape","exitOnClickOutside","debug","completeOnFinish","rememberStep","playerProps","errorPopinStateToProps","playerStateToProps","player","tourguide","popin"],"sources":["../../src/map-state-to-props/slide.js"],"sourcesContent":["import {\n getCurrentSlide,\n getLives,\n hideTourguide,\n isTourguideEligible,\n setTourguideStep,\n trackTourguideCompleted,\n trackTourguideDismissed,\n trackTourguideStarted,\n trackTourguideStepViewed\n} from '@coorpacademy/player-store';\nimport {cloneDeep, filter, get, map, pipe, size} from 'lodash/fp';\nimport createPlayerStateToProps from './player';\nimport mapStateToErrorPopinProps from './error-popin';\n\nconst TOUR_GROUP = 'app-player-question-tour-guide';\n\nconst createTutorialSteps = translate => [\n {\n ref: 'page',\n target: 'body',\n title: translate('Tourguide step 1 title'),\n content: translate('Tourguide step 1 content'),\n order: 1,\n group: TOUR_GROUP\n },\n {\n ref: 'slide',\n target: '[data-name=\"slide\"]',\n title: translate('Tourguide step 2 title'),\n content: translate('Tourguide step 2 content'),\n order: 2,\n group: TOUR_GROUP\n },\n {\n ref: 'media',\n target: '[data-type=\"media\"]',\n title: translate('Tourguide step 3 title'),\n content: translate('Tourguide step 3 content'),\n order: 3,\n group: TOUR_GROUP\n },\n {\n ref: 'clue',\n target: '[data-type=\"clue\"]',\n title: translate('Tourguide step 4 title'),\n content: translate('Tourguide step 4 content'),\n order: 4,\n group: TOUR_GROUP\n },\n {\n ref: 'language',\n target: '[data-name=\"button-multi-lang\"]',\n title: translate('Tourguide step 5 title'),\n content: translate('Tourguide step 5 content'),\n order: 5,\n group: TOUR_GROUP\n },\n {\n ref: 'help',\n target: '[data-name=\"help-button\"]',\n title: translate('Tourguide step 6 title'),\n content: translate('Tourguide step 6 content'),\n order: 6,\n group: TOUR_GROUP\n },\n {\n ref: 'life',\n target: '[data-name=\"life\"]',\n title: translate('Tourguide step 7 title'),\n content: translate('Tourguide step 7 content'),\n order: 7,\n group: TOUR_GROUP\n }\n];\n\nconst tourguideStateToProps = (state, options, store) => {\n const {translate} = options;\n const slide = getCurrentSlide(state);\n const hasMedia = pipe(get('lessons'), size)(slide) > 0;\n const hasClue = pipe(get('hasClue'), Boolean)(slide);\n const {hide: livesHidden} = getLives(state);\n const tourguideState = get('ui.tourguide', state) || {};\n const tourguideVisible = Boolean(tourguideState.visible);\n const tourguideStep = typeof tourguideState.step === 'number' ? tourguideState.step : 0;\n const tourguideForceStart = Boolean(tourguideState.forceStart);\n const canShowHelp = isTourguideEligible(state, options);\n const multiLangOptions = options.multiLang || {};\n const canShowLang = pipe(get('supportedLangs'), size)(multiLangOptions) > 1;\n\n const stepsForTour = pipe(\n filter(step => {\n if (step.order === 3) {\n return hasMedia;\n }\n if (step.order === 4) {\n return hasClue;\n }\n if (step.order === 5) {\n return canShowLang;\n }\n if (step.order === 6) {\n return canShowHelp;\n }\n if (step.order === 7) {\n return !livesHidden;\n }\n return true;\n }),\n map(cloneDeep)\n )(createTutorialSteps(translate));\n const getStepTracking = stepIndex => {\n const totalSteps = stepsForTour.length;\n const isValidIndex = typeof stepIndex === 'number' && stepIndex >= 0 && stepIndex < totalSteps;\n const stepRef = isValidIndex ? stepsForTour[stepIndex].ref : null;\n return {\n stepRef,\n stepNumber: isValidIndex ? stepIndex + 1 : null,\n totalSteps\n };\n };\n\n if (!tourguideVisible) {\n return null;\n }\n\n return {\n steps: stepsForTour,\n group: TOUR_GROUP,\n autoStart: tourguideVisible,\n forceStart: tourguideForceStart,\n startStep: tourguideStep,\n onStart: () =>\n store.dispatch(trackTourguideStarted(TOUR_GROUP, getStepTracking(tourguideStep))),\n onStepChange: step => {\n store.dispatch(trackTourguideStepViewed(TOUR_GROUP, getStepTracking(step)));\n store.dispatch(setTourguideStep(step));\n },\n onExit: () => {\n store.dispatch(trackTourguideDismissed(TOUR_GROUP, getStepTracking(tourguideStep)));\n store.dispatch(hideTourguide());\n },\n onFinish: () =>\n store.dispatch(trackTourguideCompleted(TOUR_GROUP, getStepTracking(tourguideStep))),\n options: {\n closeButton: false,\n nextLabel: translate('Tourguide next'),\n prevLabel: translate('Tourguide prev'),\n finishLabel: translate('Tourguide finish'),\n targetPadding: 2,\n showStepDots: false,\n keyboardControls: true,\n exitOnEscape: true,\n exitOnClickOutside: true,\n debug: false,\n completeOnFinish: true,\n rememberStep: true\n }\n };\n};\n\nconst playerProps = (options, store) => {\n const errorPopinStateToProps = mapStateToErrorPopinProps({dispatch: store.dispatch});\n const playerStateToProps = createPlayerStateToProps(options, store);\n\n return state => {\n return {\n player: playerStateToProps(state),\n tourguide: tourguideStateToProps(state, options, store),\n popin: errorPopinStateToProps(state)\n };\n };\n};\n\nexport default playerProps;\n"],"mappings":";;;;;;AAAA,SACEA,eAAe,EACfC,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,gBAAgB,EAChBC,uBAAuB,EACvBC,uBAAuB,EACvBC,qBAAqB,EACrBC,wBAAwB,QACnB,4BAA4B;AAEnC,OAAOC,wBAAwB,MAAM,UAAU;AAC/C,OAAOC,yBAAyB,MAAM,eAAe;AAErD,MAAMC,UAAU,GAAG,gCAAgC;AAEnD,MAAMC,mBAAmB,GAAGC,SAAS,IAAI,CACvC;EACEC,GAAG,EAAE,MAAM;EACXC,MAAM,EAAE,MAAM;EACdC,KAAK,EAAEH,SAAS,CAAC,wBAAwB,CAAC;EAC1CI,OAAO,EAAEJ,SAAS,CAAC,0BAA0B,CAAC;EAC9CK,KAAK,EAAE,CAAC;EACRC,KAAK,EAAER;AACT,CAAC,EACD;EACEG,GAAG,EAAE,OAAO;EACZC,MAAM,EAAE,qBAAqB;EAC7BC,KAAK,EAAEH,SAAS,CAAC,wBAAwB,CAAC;EAC1CI,OAAO,EAAEJ,SAAS,CAAC,0BAA0B,CAAC;EAC9CK,KAAK,EAAE,CAAC;EACRC,KAAK,EAAER;AACT,CAAC,EACD;EACEG,GAAG,EAAE,OAAO;EACZC,MAAM,EAAE,qBAAqB;EAC7BC,KAAK,EAAEH,SAAS,CAAC,wBAAwB,CAAC;EAC1CI,OAAO,EAAEJ,SAAS,CAAC,0BAA0B,CAAC;EAC9CK,K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,uBAAuB,CAACM,UAAU,EAAEqC,eAAe,CAACZ,aAAa,CAAC,CAAC,CAAC;IACrFd,OAAO,EAAE;MACPyC,WAAW,EAAE,KAAK;MAClBC,SAAS,EAAEnD,SAAS,CAAC,gBAAgB,CAAC;MACtCoD,SAAS,EAAEpD,SAAS,CAAC,gBAAgB,CAAC;MACtCqD,WAAW,EAAErD,SAAS,CAAC,kBAAkB,CAAC;MAC1CsD,aAAa,EAAE,CAAC;MAChBC,YAAY,EAAE,KAAK;MACnBC,gBAAgB,EAAE,IAAI;MACtBC,YAAY,EAAE,IAAI;MAClBC,kBAAkB,EAAE,IAAI;MACxBC,KAAK,EAAE,KAAK;MACZC,gBAAgB,EAAE,IAAI;MACtBC,YAAY,EAAE;IAChB;EACF,CAAC;AACH,CAAC;AAED,MAAMC,WAAW,GAAGA,CAACrD,OAAO,EAAEC,KAAK,KAAK;EACtC,MAAMqD,sBAAsB,GAAGlE,yBAAyB,CAAC;IAACiD,QAAQ,EAAEpC,KAAK,CAACoC;EAAQ,CAAC,CAAC;EACpF,MAAMkB,kBAAkB,GAAGpE,wBAAwB,CAACa,OAAO,EAAEC,KAAK,CAAC;EAEnE,OAAOF,KAAK,IAAI;IACd,OAAO;MACLyD,MAAM,EAAED,kBAAkB,CAACxD,KAAK,CAAC;MACjC0D,SAAS,EAAE3D,qBAAqB,CAACC,KAAK,EAAEC,OAAO,EAAEC,KAAK,CAAC;MACvDyD,KAAK,EAAEJ,sBAAsB,CAACvD,KAAK;IACrC,CAAC;EACH,CAAC;AACH,CAAC;AAED,eAAesD,WAAW","ignoreList":[]}
|
|
@@ -76,13 +76,149 @@ test('tourguide callbacks dispatch step change and hide', t => {
|
|
|
76
76
|
dispatch
|
|
77
77
|
})(state);
|
|
78
78
|
t.truthy(props.tourguide);
|
|
79
|
+
props.tourguide.onStart();
|
|
79
80
|
props.tourguide.onStepChange(2);
|
|
81
|
+
props.tourguide.onFinish();
|
|
80
82
|
props.tourguide.onExit();
|
|
81
|
-
t.is(actions.length,
|
|
82
|
-
t.is(actions[0].type,
|
|
83
|
+
t.is(actions.length, 6);
|
|
84
|
+
t.is(actions[0].type, 'ui/tourguide/track-started');
|
|
83
85
|
t.deepEqual(actions[0].payload, {
|
|
86
|
+
group: 'app-player-question-tour-guide',
|
|
87
|
+
stepRef: 'slide',
|
|
88
|
+
stepNumber: 2,
|
|
89
|
+
totalSteps: 4
|
|
90
|
+
});
|
|
91
|
+
t.is(actions[1].type, 'ui/tourguide/track-step-viewed');
|
|
92
|
+
t.deepEqual(actions[1].payload, {
|
|
93
|
+
group: 'app-player-question-tour-guide',
|
|
94
|
+
stepRef: 'media',
|
|
95
|
+
stepNumber: 3,
|
|
96
|
+
totalSteps: 4
|
|
97
|
+
});
|
|
98
|
+
t.is(actions[2].type, SET_TOURGUIDE_STEP);
|
|
99
|
+
t.deepEqual(actions[2].payload, {
|
|
84
100
|
step: 2
|
|
85
101
|
});
|
|
86
|
-
t.is(actions[
|
|
102
|
+
t.is(actions[3].type, 'ui/tourguide/track-completed');
|
|
103
|
+
t.deepEqual(actions[3].payload, {
|
|
104
|
+
group: 'app-player-question-tour-guide',
|
|
105
|
+
stepRef: 'slide',
|
|
106
|
+
stepNumber: 2,
|
|
107
|
+
totalSteps: 4
|
|
108
|
+
});
|
|
109
|
+
t.is(actions[4].type, 'ui/tourguide/track-dismissed');
|
|
110
|
+
t.deepEqual(actions[4].payload, {
|
|
111
|
+
group: 'app-player-question-tour-guide',
|
|
112
|
+
stepRef: 'slide',
|
|
113
|
+
stepNumber: 2,
|
|
114
|
+
totalSteps: 4
|
|
115
|
+
});
|
|
116
|
+
t.is(actions[5].type, HIDE_TOURGUIDE);
|
|
117
|
+
});
|
|
118
|
+
test('tourguide tracking uses null stepRef when index is out of bounds', t => {
|
|
119
|
+
const actions = [];
|
|
120
|
+
const dispatch = action => {
|
|
121
|
+
actions.push(action);
|
|
122
|
+
return action;
|
|
123
|
+
};
|
|
124
|
+
const options = {
|
|
125
|
+
translate: mockTranslate
|
|
126
|
+
};
|
|
127
|
+
const state = {
|
|
128
|
+
data: {
|
|
129
|
+
contents: {
|
|
130
|
+
chapter: {
|
|
131
|
+
entities: {
|
|
132
|
+
'1.B2': {
|
|
133
|
+
_id: '1.B2',
|
|
134
|
+
isConditional: false
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
slide: {
|
|
139
|
+
entities: {
|
|
140
|
+
[basicSlide._id]: {
|
|
141
|
+
...basicSlide,
|
|
142
|
+
chapter_id: '1.B2'
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
progressions: {
|
|
148
|
+
entities: {
|
|
149
|
+
basic: {
|
|
150
|
+
engine: {
|
|
151
|
+
ref: 'microlearning',
|
|
152
|
+
version: '1'
|
|
153
|
+
},
|
|
154
|
+
content: {
|
|
155
|
+
ref: '1.B2',
|
|
156
|
+
type: 'chapter'
|
|
157
|
+
},
|
|
158
|
+
state: {
|
|
159
|
+
nextContent: {
|
|
160
|
+
ref: basicSlide._id,
|
|
161
|
+
type: 'slide'
|
|
162
|
+
},
|
|
163
|
+
step: {
|
|
164
|
+
current: 1
|
|
165
|
+
},
|
|
166
|
+
lives: 1,
|
|
167
|
+
livesDisabled: false,
|
|
168
|
+
viewedResources: []
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
ui: {
|
|
175
|
+
current: {
|
|
176
|
+
progressionId: 'basic'
|
|
177
|
+
},
|
|
178
|
+
route: {
|
|
179
|
+
basic: 'answer'
|
|
180
|
+
},
|
|
181
|
+
tourguide: {
|
|
182
|
+
visible: true,
|
|
183
|
+
step: 99
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
const props = createSlideStateToProps(options, {
|
|
188
|
+
dispatch
|
|
189
|
+
})(state);
|
|
190
|
+
t.truthy(props.tourguide);
|
|
191
|
+
props.tourguide.onStart();
|
|
192
|
+
props.tourguide.onStepChange(99);
|
|
193
|
+
props.tourguide.onFinish();
|
|
194
|
+
props.tourguide.onExit();
|
|
195
|
+
t.is(actions[0].type, 'ui/tourguide/track-started');
|
|
196
|
+
t.deepEqual(actions[0].payload, {
|
|
197
|
+
group: 'app-player-question-tour-guide',
|
|
198
|
+
stepRef: null,
|
|
199
|
+
stepNumber: null,
|
|
200
|
+
totalSteps: 4
|
|
201
|
+
});
|
|
202
|
+
t.is(actions[1].type, 'ui/tourguide/track-step-viewed');
|
|
203
|
+
t.deepEqual(actions[1].payload, {
|
|
204
|
+
group: 'app-player-question-tour-guide',
|
|
205
|
+
stepRef: null,
|
|
206
|
+
stepNumber: null,
|
|
207
|
+
totalSteps: 4
|
|
208
|
+
});
|
|
209
|
+
t.is(actions[3].type, 'ui/tourguide/track-completed');
|
|
210
|
+
t.deepEqual(actions[3].payload, {
|
|
211
|
+
group: 'app-player-question-tour-guide',
|
|
212
|
+
stepRef: null,
|
|
213
|
+
stepNumber: null,
|
|
214
|
+
totalSteps: 4
|
|
215
|
+
});
|
|
216
|
+
t.is(actions[4].type, 'ui/tourguide/track-dismissed');
|
|
217
|
+
t.deepEqual(actions[4].payload, {
|
|
218
|
+
group: 'app-player-question-tour-guide',
|
|
219
|
+
stepRef: null,
|
|
220
|
+
stepNumber: null,
|
|
221
|
+
totalSteps: 4
|
|
222
|
+
});
|
|
87
223
|
});
|
|
88
224
|
//# sourceMappingURL=slide.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide.js","names":["test","mockTranslate","HIDE_TOURGUIDE","SET_TOURGUIDE_STEP","createSlideStateToProps","basicSlide","t","actions","dispatch","action","push","options","translate","state","data","contents","chapter","entities","_id","isConditional","slide","chapter_id","progressions","basic","engine","ref","version","content","type","nextContent","step","current","lives","livesDisabled","viewedResources","ui","progressionId","route","tourguide","visible","props","truthy","onStepChange","onExit","is","length","deepEqual","payload"],"sources":["../../../src/map-state-to-props/test/slide.js"],"sourcesContent":["import test from 'ava';\nimport {mockTranslate} from '@coorpacademy/translate';\nimport {HIDE_TOURGUIDE, SET_TOURGUIDE_STEP} from '@coorpacademy/player-store';\nimport createSlideStateToProps from '../slide';\nimport basicSlide from './fixtures/slides/basic';\n\ntest('tourguide callbacks dispatch step change and hide', t => {\n const actions = [];\n const dispatch = action => {\n actions.push(action);\n return action;\n };\n const options = {translate: mockTranslate};\n const state = {\n data: {\n contents: {\n chapter: {\n entities: {\n '1.B2': {_id: '1.B2', isConditional: false}\n }\n },\n slide: {\n entities: {\n [basicSlide._id]: {...basicSlide, chapter_id: '1.B2'}\n }\n }\n },\n progressions: {\n entities: {\n basic: {\n engine: {ref: 'microlearning', version: '1'},\n content: {ref: '1.B2', type: 'chapter'},\n state: {\n nextContent: {ref: basicSlide._id, type: 'slide'},\n step: {current: 1},\n lives: 1,\n livesDisabled: false,\n viewedResources: []\n }\n }\n }\n }\n },\n ui: {\n current: {progressionId: 'basic'},\n route: {basic: 'answer'},\n tourguide: {visible: true, step: 1}\n }\n };\n\n const props = createSlideStateToProps(options, {dispatch})(state);\n\n t.truthy(props.tourguide);\n props.tourguide.onStepChange(2);\n props.tourguide.onExit();\n\n t.is(actions.length, 2);\n t.is(actions[0].type, SET_TOURGUIDE_STEP);\n t.deepEqual(actions[0].payload, {step: 2});\n t.is(actions[1].type, HIDE_TOURGUIDE);\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,KAAK;AACtB,SAAQC,aAAa,QAAO,yBAAyB;AACrD,SAAQC,cAAc,EAAEC,kBAAkB,QAAO,4BAA4B;AAC7E,OAAOC,uBAAuB,MAAM,UAAU;AAC9C,OAAOC,UAAU,MAAM,yBAAyB;AAEhDL,IAAI,CAAC,mDAAmD,EAAEM,CAAC,IAAI;EAC7D,MAAMC,OAAO,GAAG,EAAE;EAClB,MAAMC,QAAQ,GAAGC,MAAM,IAAI;IACzBF,OAAO,CAACG,IAAI,CAACD,MAAM,CAAC;IACpB,OAA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AAK,CAACF,SAAS,CAACI,YAAY,CAAC,CAAC,CAAC;EAC/BF,KAAK,CAACF,SAAS,CAACK,MAAM,CAAC,CAAC;EAExBrC,CAAC,CAACsC,EAAE,CAACrC,OAAO,CAACsC,MAAM,EAAE,CAAC,CAAC;EACvBvC,CAAC,CAACsC,EAAE,CAACrC,OAAO,CAAC,CAAC,CAAC,CAACqB,IAAI,EAAEzB,kBAAkB,CAAC;EACzCG,CAAC,CAACwC,SAAS,CAACvC,OAAO,CAAC,CAAC,CAAC,CAACwC,OAAO,EAAE;IAACjB,IAAI,EAAE;EAAC,CAAC,CAAC;EAC1CxB,CAAC,CAACsC,EAAE,CAACrC,OAAO,CAAC,CAAC,CAAC,CAACqB,IAAI,EAAE1B,cAAc,CAAC;AACvC,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"slide.js","names":["test","mockTranslate","HIDE_TOURGUIDE","SET_TOURGUIDE_STEP","createSlideStateToProps","basicSlide","t","actions","dispatch","action","push","options","translate","state","data","contents","chapter","entities","_id","isConditional","slide","chapter_id","progressions","basic","engine","ref","version","content","type","nextContent","step","current","lives","livesDisabled","viewedResources","ui","progressionId","route","tourguide","visible","props","truthy","onStart","onStepChange","onFinish","onExit","is","length","deepEqual","payload","group","stepRef","stepNumber","totalSteps"],"sources":["../../../src/map-state-to-props/test/slide.js"],"sourcesContent":["import test from 'ava';\nimport {mockTranslate} from '@coorpacademy/translate';\nimport {HIDE_TOURGUIDE, SET_TOURGUIDE_STEP} from '@coorpacademy/player-store';\nimport createSlideStateToProps from '../slide';\nimport basicSlide from './fixtures/slides/basic';\n\ntest('tourguide callbacks dispatch step change and hide', t => {\n const actions = [];\n const dispatch = action => {\n actions.push(action);\n return action;\n };\n const options = {translate: mockTranslate};\n const state = {\n data: {\n contents: {\n chapter: {\n entities: {\n '1.B2': {_id: '1.B2', isConditional: false}\n }\n },\n slide: {\n entities: {\n [basicSlide._id]: {...basicSlide, chapter_id: '1.B2'}\n }\n }\n },\n progressions: {\n entities: {\n basic: {\n engine: {ref: 'microlearning', version: '1'},\n content: {ref: '1.B2', type: 'chapter'},\n state: {\n nextContent: {ref: basicSlide._id, type: 'slide'},\n step: {current: 1},\n lives: 1,\n livesDisabled: false,\n viewedResources: []\n }\n }\n }\n }\n },\n ui: {\n current: {progressionId: 'basic'},\n route: {basic: 'answer'},\n tourguide: {visible: true, step: 1}\n }\n };\n\n const props = createSlideStateToProps(options, {dispatch})(state);\n\n t.truthy(props.tourguide);\n props.tourguide.onStart();\n props.tourguide.onStepChange(2);\n props.tourguide.onFinish();\n props.tourguide.onExit();\n\n t.is(actions.length, 6);\n t.is(actions[0].type, 'ui/tourguide/track-started');\n t.deepEqual(actions[0].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: 'slide',\n stepNumber: 2,\n totalSteps: 4\n });\n t.is(actions[1].type, 'ui/tourguide/track-step-viewed');\n t.deepEqual(actions[1].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: 'media',\n stepNumber: 3,\n totalSteps: 4\n });\n t.is(actions[2].type, SET_TOURGUIDE_STEP);\n t.deepEqual(actions[2].payload, {step: 2});\n t.is(actions[3].type, 'ui/tourguide/track-completed');\n t.deepEqual(actions[3].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: 'slide',\n stepNumber: 2,\n totalSteps: 4\n });\n t.is(actions[4].type, 'ui/tourguide/track-dismissed');\n t.deepEqual(actions[4].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: 'slide',\n stepNumber: 2,\n totalSteps: 4\n });\n t.is(actions[5].type, HIDE_TOURGUIDE);\n});\n\ntest('tourguide tracking uses null stepRef when index is out of bounds', t => {\n const actions = [];\n const dispatch = action => {\n actions.push(action);\n return action;\n };\n const options = {translate: mockTranslate};\n const state = {\n data: {\n contents: {\n chapter: {\n entities: {\n '1.B2': {_id: '1.B2', isConditional: false}\n }\n },\n slide: {\n entities: {\n [basicSlide._id]: {...basicSlide, chapter_id: '1.B2'}\n }\n }\n },\n progressions: {\n entities: {\n basic: {\n engine: {ref: 'microlearning', version: '1'},\n content: {ref: '1.B2', type: 'chapter'},\n state: {\n nextContent: {ref: basicSlide._id, type: 'slide'},\n step: {current: 1},\n lives: 1,\n livesDisabled: false,\n viewedResources: []\n }\n }\n }\n }\n },\n ui: {\n current: {progressionId: 'basic'},\n route: {basic: 'answer'},\n tourguide: {visible: true, step: 99}\n }\n };\n\n const props = createSlideStateToProps(options, {dispatch})(state);\n\n t.truthy(props.tourguide);\n props.tourguide.onStart();\n props.tourguide.onStepChange(99);\n props.tourguide.onFinish();\n props.tourguide.onExit();\n\n t.is(actions[0].type, 'ui/tourguide/track-started');\n t.deepEqual(actions[0].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: null,\n stepNumber: null,\n totalSteps: 4\n });\n t.is(actions[1].type, 'ui/tourguide/track-step-viewed');\n t.deepEqual(actions[1].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: null,\n stepNumber: null,\n totalSteps: 4\n });\n t.is(actions[3].type, 'ui/tourguide/track-completed');\n t.deepEqual(actions[3].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: null,\n stepNumber: null,\n totalSteps: 4\n });\n t.is(actions[4].type, 'ui/tourguide/track-dismissed');\n t.deepEqual(actions[4].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: null,\n stepNumber: null,\n totalSteps: 4\n });\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,KAAK;AACtB,SAAQC,aAAa,QAAO,yBAAyB;AACrD,SAAQC,cAAc,EAAEC,kBAAkB,QAAO,4BAA4B;AAC7E,OAAOC,uBAAuB,MAAM,UAAU;AAC9C,OAAOC,UAAU,MAAM,yBAAyB;AAEhDL,IAAI,CAAC,mDAAmD,EAAEM,CAAC,IAAI;EAC7D,MAAMC,OAAO,GAAG,EAAE;EAClB,MAAMC,QAAQ,GAAGC,MAAM,IAAI;IACzBF,OAAO,CAACG,IAAI,CAACD,MAAM,CAAC;IACpB,OAAOA,MAAM;EACf,CAAC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,CAAC;EACvDtB,CAAC,CAAC0C,SAAS,CAACzC,OAAO,CAAC,CAAC,CAAC,CAAC0C,OAAO,EAAE;IAC9BC,KAAK,EAAE,gCAAgC;IACvCC,OAAO,EAAE,IAAI;IACbC,UAAU,EAAE,IAAI;IAChBC,UAAU,EAAE;EACd,CAAC,CAAC;EACF/C,CAAC,CAACwC,EAAE,CAACvC,OAAO,CAAC,CAAC,CAAC,CAACqB,IAAI,EAAE,8BAA8B,CAAC;EACrDtB,CAAC,CAAC0C,SAAS,CAACzC,OAAO,CAAC,CAAC,CAAC,CAAC0C,OAAO,EAAE;IAC9BC,KAAK,EAAE,gCAAgC;IACvCC,OAAO,EAAE,IAAI;IACbC,UAAU,EAAE,IAAI;IAChBC,UAAU,EAAE;EACd,CAAC,CAAC;EACF/C,CAAC,CAACwC,EAAE,CAACvC,OAAO,CAAC,CAAC,CAAC,CAACqB,IAAI,EAAE,8BAA8B,CAAC;EACrDtB,CAAC,CAAC0C,SAAS,CAACzC,OAAO,CAAC,CAAC,CAAC,CAAC0C,OAAO,EAAE;IAC9BC,KAAK,EAAE,gCAAgC;IACvCC,OAAO,EAAE,IAAI;IACbC,UAAU,EAAE,IAAI;IAChBC,UAAU,EAAE;EACd,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/es/store.js
CHANGED
|
@@ -2,7 +2,8 @@ import { applyMiddleware, combineReducers, compose, createStore } from 'redux';
|
|
|
2
2
|
import { middlewares, reducers } from '@coorpacademy/player-store';
|
|
3
3
|
const {
|
|
4
4
|
ErrorLogger,
|
|
5
|
-
ReduxThunkMemoized
|
|
5
|
+
ReduxThunkMemoized,
|
|
6
|
+
TourguideTrackingLogger
|
|
6
7
|
} = middlewares;
|
|
7
8
|
const {
|
|
8
9
|
data,
|
|
@@ -13,7 +14,7 @@ const createReducers = () => combineReducers({
|
|
|
13
14
|
ui
|
|
14
15
|
});
|
|
15
16
|
const createMiddlewares = options => {
|
|
16
|
-
return compose(applyMiddleware(ReduxThunkMemoized(options), ErrorLogger(options)), typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f);
|
|
17
|
+
return compose(applyMiddleware(ReduxThunkMemoized(options), ErrorLogger(options), TourguideTrackingLogger(options)), typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f);
|
|
17
18
|
};
|
|
18
19
|
const create = options => createStore(createReducers(), {}, createMiddlewares(options));
|
|
19
20
|
export { createMiddlewares, createReducers };
|
package/es/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":["applyMiddleware","combineReducers","compose","createStore","middlewares","reducers","ErrorLogger","ReduxThunkMemoized","data","ui","createReducers","createMiddlewares","options","window","__REDUX_DEVTOOLS_EXTENSION__","f","create"],"sources":["../src/store.js"],"sourcesContent":["import {applyMiddleware, combineReducers, compose, createStore} from 'redux';\nimport {middlewares, reducers} from '@coorpacademy/player-store';\n\nconst {ErrorLogger, ReduxThunkMemoized} = middlewares;\nconst {data, ui} = reducers;\n\nconst createReducers = () =>\n combineReducers({\n data,\n ui\n });\n\nconst createMiddlewares = options => {\n return compose(\n applyMiddleware(ReduxThunkMemoized(options)
|
|
1
|
+
{"version":3,"file":"store.js","names":["applyMiddleware","combineReducers","compose","createStore","middlewares","reducers","ErrorLogger","ReduxThunkMemoized","TourguideTrackingLogger","data","ui","createReducers","createMiddlewares","options","window","__REDUX_DEVTOOLS_EXTENSION__","f","create"],"sources":["../src/store.js"],"sourcesContent":["import {applyMiddleware, combineReducers, compose, createStore} from 'redux';\nimport {middlewares, reducers} from '@coorpacademy/player-store';\n\nconst {ErrorLogger, ReduxThunkMemoized, TourguideTrackingLogger} = middlewares;\nconst {data, ui} = reducers;\n\nconst createReducers = () =>\n combineReducers({\n data,\n ui\n });\n\nconst createMiddlewares = options => {\n return compose(\n applyMiddleware(\n ReduxThunkMemoized(options),\n ErrorLogger(options),\n TourguideTrackingLogger(options)\n ),\n typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__\n ? window.__REDUX_DEVTOOLS_EXTENSION__()\n : f => f\n );\n};\n\nconst create = options => createStore(createReducers(), {}, createMiddlewares(options));\nexport {createMiddlewares, createReducers};\nexport default create;\n"],"mappings":"AAAA,SAAQA,eAAe,EAAEC,eAAe,EAAEC,OAAO,EAAEC,WAAW,QAAO,OAAO;AAC5E,SAAQC,WAAW,EAAEC,QAAQ,QAAO,4BAA4B;AAEhE,MAAM;EAACC,WAAW;EAAEC,kBAAkB;EAAEC;AAAuB,CAAC,GAAGJ,WAAW;AAC9E,MAAM;EAACK,IAAI;EAAEC;AAAE,CAAC,GAAGL,QAAQ;AAE3B,MAAMM,cAAc,GAAGA,CAAA,KACrBV,eAAe,CAAC;EACdQ,IAAI;EACJC;AACF,CAAC,CAAC;AAEJ,MAAME,iBAAiB,GAAGC,OAAO,IAAI;EACnC,OAAOX,OAAO,CACZF,eAAe,CACbO,kBAAkB,CAACM,OAAO,CAAC,EAC3BP,WAAW,CAACO,OAAO,CAAC,EACpBL,uBAAuB,CAACK,OAAO,CACjC,CAAC,EACD,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,4BAA4B,GAChED,MAAM,CAACC,4BAA4B,CAAC,CAAC,GACrCC,CAAC,IAAIA,CACX,CAAC;AACH,CAAC;AAED,MAAMC,MAAM,GAAGJ,OAAO,IAAIV,WAAW,CAACQ,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,EAAEC,iBAAiB,CAACC,OAAO,CAAC,CAAC;AACvF,SAAQD,iBAAiB,EAAED,cAAc;AACzC,eAAeM,MAAM","ignoreList":[]}
|
package/es/test/init-reducers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-reducers.js","names":["test","createReducers","macro","undefined","data","answers","entities","comments","configs","contents","clues","exitNodes","progressions","rank","nextContent","recommendations","videos","ui","coaches","availableCoaches","text","corrections","current","progressionId","location","route","tourguide","visible","step","hasTourGuideBeenShown","forceStart"],"sources":["../../src/test/init-reducers.js"],"sourcesContent":["import test from 'ava';\nimport {createReducers} from '../store';\nimport macro from './helpers/macro';\n\ntest(\n 'should have initial value',\n macro,\n createReducers(),\n undefined,\n {},\n {\n data: {\n answers: {entities: {}},\n comments: {entities: {}},\n configs: {},\n contents: {},\n clues: {entities: {}},\n exitNodes: {entities: {}},\n progressions: {entities: {}},\n rank: {},\n nextContent: {entities: {}},\n recommendations: {entities: {}},\n videos: {entities: {}}\n },\n ui: {\n answers: {},\n coaches: {\n availableCoaches: 0\n },\n comments: {\n text: null\n },\n corrections: {},\n current: {\n progressionId: null\n },\n location: {},\n route: {},\n tourguide: {\n visible: false,\n step: 0,\n hasTourGuideBeenShown: false,\n forceStart: false\n }\n }\n }\n);\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,KAAK;AACtB,SAAQC,cAAc,QAAO,UAAU;AACvC,OAAOC,KAAK,MAAM,iBAAiB;AAEnCF,IAAI,CACF,2BAA2B,EAC3BE,KAAK,EACLD,cAAc,CAAC,CAAC,EAChBE,SAAS,EACT,CAAC,CAAC,EACF;EACEC,IAAI,EAAE;IACJC,OAAO,EAAE;MAACC,QAAQ,EAAE,CAAC;IAAC,CAAC;IACvBC,QAAQ,EAAE;MAACD,QAAQ,EAAE,CAAC;IAAC,CAAC;IACxBE,OAAO,EAAE,CAAC,CAAC;IACXC,QAAQ,EAAE,CAAC,CAAC;IACZC,KAAK,EAAE;MAACJ,QAAQ,EAAE,CAAC;IAAC,CAAC;IACrBK,SAAS,EAAE;MAACL,QAAQ,EAAE,CAAC;IAAC,CAAC;IACzBM,YAAY,EAAE;MAACN,QAAQ,EAAE,CAAC;IAAC,CAAC;IAC5BO,IAAI,EAAE,CAAC,CAAC;IACRC,WAAW,EAAE;MAACR,QAAQ,EAAE,CAAC;IAAC,CAAC;IAC3BS,eAAe,EAAE;MAACT,QAAQ,EAAE,CAAC;IAAC,CAAC;IAC/BU,MAAM,EAAE;MAACV,QAAQ,EAAE,CAAC;IAAC;EACvB,CAAC;EACDW,EAAE,EAAE;IACFZ,OAAO,EAAE,CAAC,CAAC;IACXa,OAAO,EAAE;MACPC,gBAAgB,EAAE;IACpB,CAAC;IACDZ,QAAQ,EAAE;MACRa,IAAI,EAAE;IACR,CAAC;IACDC,WAAW,EAAE,CAAC,CAAC;IACfC,OAAO,EAAE;MACPC,aAAa,EAAE;IACjB,CAAC;IACDC,QAAQ,EAAE,CAAC,CAAC;IACZC,KAAK,EAAE,CAAC,CAAC;IACTC,SAAS,EAAE;MACTC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE,CAAC;MACPC,qBAAqB,EAAE,KAAK;MAC5BC,UAAU,EAAE;IACd;EACF;AACF,CACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"init-reducers.js","names":["test","createReducers","macro","undefined","data","answers","entities","comments","configs","contents","clues","exitNodes","progressions","rank","nextContent","recommendations","videos","ui","coaches","availableCoaches","text","corrections","current","progressionId","location","route","tourguide","visible","step","hasTourGuideBeenShown","forceStart","tourguideTracking","lastEvent"],"sources":["../../src/test/init-reducers.js"],"sourcesContent":["import test from 'ava';\nimport {createReducers} from '../store';\nimport macro from './helpers/macro';\n\ntest(\n 'should have initial value',\n macro,\n createReducers(),\n undefined,\n {},\n {\n data: {\n answers: {entities: {}},\n comments: {entities: {}},\n configs: {},\n contents: {},\n clues: {entities: {}},\n exitNodes: {entities: {}},\n progressions: {entities: {}},\n rank: {},\n nextContent: {entities: {}},\n recommendations: {entities: {}},\n videos: {entities: {}}\n },\n ui: {\n answers: {},\n coaches: {\n availableCoaches: 0\n },\n comments: {\n text: null\n },\n corrections: {},\n current: {\n progressionId: null\n },\n location: {},\n route: {},\n tourguide: {\n visible: false,\n step: 0,\n hasTourGuideBeenShown: false,\n forceStart: false\n },\n tourguideTracking: {\n lastEvent: null\n }\n }\n }\n);\n"],"mappings":"AA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F,CACF,CAAC","ignoreList":[]}
|
|
@@ -12,44 +12,51 @@ var _playerStore = require("@coorpacademy/player-store");
|
|
|
12
12
|
var _player = _interopRequireDefault(require("./player"));
|
|
13
13
|
var _errorPopin = _interopRequireDefault(require("./error-popin"));
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
const TOUR_GROUP = 'app-player-
|
|
15
|
+
const TOUR_GROUP = 'app-player-question-tour-guide';
|
|
16
16
|
const createTutorialSteps = translate => [{
|
|
17
|
+
ref: 'page',
|
|
17
18
|
target: 'body',
|
|
18
19
|
title: translate('Tourguide step 1 title'),
|
|
19
20
|
content: translate('Tourguide step 1 content'),
|
|
20
21
|
order: 1,
|
|
21
22
|
group: TOUR_GROUP
|
|
22
23
|
}, {
|
|
24
|
+
ref: 'slide',
|
|
23
25
|
target: '[data-name="slide"]',
|
|
24
26
|
title: translate('Tourguide step 2 title'),
|
|
25
27
|
content: translate('Tourguide step 2 content'),
|
|
26
28
|
order: 2,
|
|
27
29
|
group: TOUR_GROUP
|
|
28
30
|
}, {
|
|
31
|
+
ref: 'media',
|
|
29
32
|
target: '[data-type="media"]',
|
|
30
33
|
title: translate('Tourguide step 3 title'),
|
|
31
34
|
content: translate('Tourguide step 3 content'),
|
|
32
35
|
order: 3,
|
|
33
36
|
group: TOUR_GROUP
|
|
34
37
|
}, {
|
|
38
|
+
ref: 'clue',
|
|
35
39
|
target: '[data-type="clue"]',
|
|
36
40
|
title: translate('Tourguide step 4 title'),
|
|
37
41
|
content: translate('Tourguide step 4 content'),
|
|
38
42
|
order: 4,
|
|
39
43
|
group: TOUR_GROUP
|
|
40
44
|
}, {
|
|
45
|
+
ref: 'language',
|
|
41
46
|
target: '[data-name="button-multi-lang"]',
|
|
42
47
|
title: translate('Tourguide step 5 title'),
|
|
43
48
|
content: translate('Tourguide step 5 content'),
|
|
44
49
|
order: 5,
|
|
45
50
|
group: TOUR_GROUP
|
|
46
51
|
}, {
|
|
52
|
+
ref: 'help',
|
|
47
53
|
target: '[data-name="help-button"]',
|
|
48
54
|
title: translate('Tourguide step 6 title'),
|
|
49
55
|
content: translate('Tourguide step 6 content'),
|
|
50
56
|
order: 6,
|
|
51
57
|
group: TOUR_GROUP
|
|
52
58
|
}, {
|
|
59
|
+
ref: 'life',
|
|
53
60
|
target: '[data-name="life"]',
|
|
54
61
|
title: translate('Tourguide step 7 title'),
|
|
55
62
|
content: translate('Tourguide step 7 content'),
|
|
@@ -91,6 +98,16 @@ const tourguideStateToProps = (state, options, store) => {
|
|
|
91
98
|
}
|
|
92
99
|
return true;
|
|
93
100
|
}), (0, _map2.default)(_cloneDeep2.default))(createTutorialSteps(translate));
|
|
101
|
+
const getStepTracking = stepIndex => {
|
|
102
|
+
const totalSteps = stepsForTour.length;
|
|
103
|
+
const isValidIndex = typeof stepIndex === 'number' && stepIndex >= 0 && stepIndex < totalSteps;
|
|
104
|
+
const stepRef = isValidIndex ? stepsForTour[stepIndex].ref : null;
|
|
105
|
+
return {
|
|
106
|
+
stepRef,
|
|
107
|
+
stepNumber: isValidIndex ? stepIndex + 1 : null,
|
|
108
|
+
totalSteps
|
|
109
|
+
};
|
|
110
|
+
};
|
|
94
111
|
if (!tourguideVisible) {
|
|
95
112
|
return null;
|
|
96
113
|
}
|
|
@@ -100,8 +117,16 @@ const tourguideStateToProps = (state, options, store) => {
|
|
|
100
117
|
autoStart: tourguideVisible,
|
|
101
118
|
forceStart: tourguideForceStart,
|
|
102
119
|
startStep: tourguideStep,
|
|
103
|
-
|
|
104
|
-
|
|
120
|
+
onStart: () => store.dispatch((0, _playerStore.trackTourguideStarted)(TOUR_GROUP, getStepTracking(tourguideStep))),
|
|
121
|
+
onStepChange: step => {
|
|
122
|
+
store.dispatch((0, _playerStore.trackTourguideStepViewed)(TOUR_GROUP, getStepTracking(step)));
|
|
123
|
+
store.dispatch((0, _playerStore.setTourguideStep)(step));
|
|
124
|
+
},
|
|
125
|
+
onExit: () => {
|
|
126
|
+
store.dispatch((0, _playerStore.trackTourguideDismissed)(TOUR_GROUP, getStepTracking(tourguideStep)));
|
|
127
|
+
store.dispatch((0, _playerStore.hideTourguide)());
|
|
128
|
+
},
|
|
129
|
+
onFinish: () => store.dispatch((0, _playerStore.trackTourguideCompleted)(TOUR_GROUP, getStepTracking(tourguideStep))),
|
|
105
130
|
options: {
|
|
106
131
|
closeButton: false,
|
|
107
132
|
nextLabel: translate('Tourguide next'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide.js","names":["_playerStore","require","_player","_interopRequireDefault","_errorPopin","e","__esModule","default","TOUR_GROUP","createTutorialSteps","translate","target","title","content","order","group","tourguideStateToProps","state","options","store","slide","getCurrentSlide","hasMedia","_pipe2","_get2","_size2","hasClue","Boolean","hide","livesHidden","getLives","tourguideState","tourguideVisible","visible","tourguideStep","step","tourguideForceStart","forceStart","canShowHelp","isTourguideEligible","multiLangOptions","multiLang","canShowLang","stepsForTour","_filter2","_map2","_cloneDeep2","steps","autoStart","startStep","onStepChange","dispatch","setTourguideStep","onExit","hideTourguide","closeButton","nextLabel","prevLabel","finishLabel","targetPadding","showStepDots","keyboardControls","exitOnEscape","exitOnClickOutside","debug","completeOnFinish","rememberStep","playerProps","errorPopinStateToProps","mapStateToErrorPopinProps","playerStateToProps","createPlayerStateToProps","player","tourguide","popin","_default","exports"],"sources":["../../src/map-state-to-props/slide.js"],"sourcesContent":["import {\n getCurrentSlide,\n getLives,\n hideTourguide,\n isTourguideEligible,\n setTourguideStep\n} from '@coorpacademy/player-store';\nimport {cloneDeep, filter, get, map, pipe, size} from 'lodash/fp';\nimport createPlayerStateToProps from './player';\nimport mapStateToErrorPopinProps from './error-popin';\n\nconst TOUR_GROUP = 'app-player-intro-fixture';\n\nconst createTutorialSteps = translate => [\n {\n target: 'body',\n title: translate('Tourguide step 1 title'),\n content: translate('Tourguide step 1 content'),\n order: 1,\n group: TOUR_GROUP\n },\n {\n target: '[data-name=\"slide\"]',\n title: translate('Tourguide step 2 title'),\n content: translate('Tourguide step 2 content'),\n order: 2,\n group: TOUR_GROUP\n },\n {\n target: '[data-type=\"media\"]',\n title: translate('Tourguide step 3 title'),\n content: translate('Tourguide step 3 content'),\n order: 3,\n group: TOUR_GROUP\n },\n {\n target: '[data-type=\"clue\"]',\n title: translate('Tourguide step 4 title'),\n content: translate('Tourguide step 4 content'),\n order: 4,\n group: TOUR_GROUP\n },\n {\n target: '[data-name=\"button-multi-lang\"]',\n title: translate('Tourguide step 5 title'),\n content: translate('Tourguide step 5 content'),\n order: 5,\n group: TOUR_GROUP\n },\n {\n target: '[data-name=\"help-button\"]',\n title: translate('Tourguide step 6 title'),\n content: translate('Tourguide step 6 content'),\n order: 6,\n group: TOUR_GROUP\n },\n {\n target: '[data-name=\"life\"]',\n title: translate('Tourguide step 7 title'),\n content: translate('Tourguide step 7 content'),\n order: 7,\n group: TOUR_GROUP\n }\n];\n\nconst tourguideStateToProps = (state, options, store) => {\n const {translate} = options;\n const slide = getCurrentSlide(state);\n const hasMedia = pipe(get('lessons'), size)(slide) > 0;\n const hasClue = pipe(get('hasClue'), Boolean)(slide);\n const {hide: livesHidden} = getLives(state);\n const tourguideState = get('ui.tourguide', state) || {};\n const tourguideVisible = Boolean(tourguideState.visible);\n const tourguideStep = typeof tourguideState.step === 'number' ? tourguideState.step : 0;\n const tourguideForceStart = Boolean(tourguideState.forceStart);\n const canShowHelp = isTourguideEligible(state, options);\n const multiLangOptions = options.multiLang || {};\n const canShowLang = pipe(get('supportedLangs'), size)(multiLangOptions) > 1;\n\n const stepsForTour = pipe(\n filter(step => {\n if (step.order === 3) {\n return hasMedia;\n }\n if (step.order === 4) {\n return hasClue;\n }\n if (step.order === 5) {\n return canShowLang;\n }\n if (step.order === 6) {\n return canShowHelp;\n }\n if (step.order === 7) {\n return !livesHidden;\n }\n return true;\n }),\n map(cloneDeep)\n )(createTutorialSteps(translate));\n\n if (!tourguideVisible) {\n return null;\n }\n\n return {\n steps: stepsForTour,\n group: TOUR_GROUP,\n autoStart: tourguideVisible,\n forceStart: tourguideForceStart,\n startStep: tourguideStep,\n onStepChange: step => store.dispatch(setTourguideStep(step)),\n onExit: () => store.dispatch(hideTourguide()),\n options: {\n closeButton: false,\n nextLabel: translate('Tourguide next'),\n prevLabel: translate('Tourguide prev'),\n finishLabel: translate('Tourguide finish'),\n targetPadding: 2,\n showStepDots: false,\n keyboardControls: true,\n exitOnEscape: true,\n exitOnClickOutside: true,\n debug: false,\n completeOnFinish: true,\n rememberStep: true\n }\n };\n};\n\nconst playerProps = (options, store) => {\n const errorPopinStateToProps = mapStateToErrorPopinProps({dispatch: store.dispatch});\n const playerStateToProps = createPlayerStateToProps(options, store);\n\n return state => {\n return {\n player: playerStateToProps(state),\n tourguide: tourguideStateToProps(state, options, store),\n popin: errorPopinStateToProps(state)\n };\n };\n};\n\nexport default playerProps;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAsD,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtD,MAAMG,UAAU,GAAG,0BAA0B;AAE7C,MAAMC,mBAAmB,GAAGC,SAAS,IAAI,CACvC;EACEC,MAAM,EAAE,MAAM;EACdC,KAAK,EAAEF,SAAS,CAAC,wBAAwB,CAAC;EAC1CG,OAAO,EAAEH,SAAS,CAAC,0BAA0B,CAAC;EAC9CI,KAAK,EAAE,CAAC;EACRC,KAAK,EAAEP;AACT,CAAC,EACD;EACEG,MAAM,EAAE,qBAAqB;EAC7BC,KAAK,EAAEF,SAAS,CAAC,wBAAwB,CAAC;EAC1CG,OAAO,EAAEH,SAAS,CAAC,0BAA0B,CAAC;EAC9CI,KAAK,EAAE,CAAC;EACRC,KAAK,EAAEP;AACT,CAAC,E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AAMiD,sBAAsB,GAAG,IAAAC,mBAAyB,EAAC;IAAClB,QAAQ,EAAEhC,KAAK,CAACgC;EAAQ,CAAC,CAAC;EACpF,MAAMmB,kBAAkB,GAAG,IAAAC,eAAwB,EAACrD,OAAO,EAAEC,KAAK,CAAC;EAEnE,OAAOF,KAAK,IAAI;IACd,OAAO;MACLuD,MAAM,EAAEF,kBAAkB,CAACrD,KAAK,CAAC;MACjCwD,SAAS,EAAEzD,qBAAqB,CAACC,KAAK,EAAEC,OAAO,EAAEC,KAAK,CAAC;MACvDuD,KAAK,EAAEN,sBAAsB,CAACnD,KAAK;IACrC,CAAC;EACH,CAAC;AACH,CAAC;AAAC,IAAA0D,QAAA,GAAAC,OAAA,CAAArE,OAAA,GAEa4D,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"slide.js","names":["_playerStore","require","_player","_interopRequireDefault","_errorPopin","e","__esModule","default","TOUR_GROUP","createTutorialSteps","translate","ref","target","title","content","order","group","tourguideStateToProps","state","options","store","slide","getCurrentSlide","hasMedia","_pipe2","_get2","_size2","hasClue","Boolean","hide","livesHidden","getLives","tourguideState","tourguideVisible","visible","tourguideStep","step","tourguideForceStart","forceStart","canShowHelp","isTourguideEligible","multiLangOptions","multiLang","canShowLang","stepsForTour","_filter2","_map2","_cloneDeep2","getStepTracking","stepIndex","totalSteps","length","isValidIndex","stepRef","stepNumber","steps","autoStart","startStep","onStart","dispatch","trackTourguideStarted","onStepChange","trackTourguideStepViewed","setTourguideStep","onExit","trackTourguideDismissed","hideTourguide","onFinish","trackTourguideCompleted","closeButton","nextLabel","prevLabel","finishLabel","targetPadding","showStepDots","keyboardControls","exitOnEscape","exitOnClickOutside","debug","completeOnFinish","rememberStep","playerProps","errorPopinStateToProps","mapStateToErrorPopinProps","playerStateToProps","createPlayerStateToProps","player","tourguide","popin","_default","exports"],"sources":["../../src/map-state-to-props/slide.js"],"sourcesContent":["import {\n getCurrentSlide,\n getLives,\n hideTourguide,\n isTourguideEligible,\n setTourguideStep,\n trackTourguideCompleted,\n trackTourguideDismissed,\n trackTourguideStarted,\n trackTourguideStepViewed\n} from '@coorpacademy/player-store';\nimport {cloneDeep, filter, get, map, pipe, size} from 'lodash/fp';\nimport createPlayerStateToProps from './player';\nimport mapStateToErrorPopinProps from './error-popin';\n\nconst TOUR_GROUP = 'app-player-question-tour-guide';\n\nconst createTutorialSteps = translate => [\n {\n ref: 'page',\n target: 'body',\n title: translate('Tourguide step 1 title'),\n content: translate('Tourguide step 1 content'),\n order: 1,\n group: TOUR_GROUP\n },\n {\n ref: 'slide',\n target: '[data-name=\"slide\"]',\n title: translate('Tourguide step 2 title'),\n content: translate('Tourguide step 2 content'),\n order: 2,\n group: TOUR_GROUP\n },\n {\n ref: 'media',\n target: '[data-type=\"media\"]',\n title: translate('Tourguide step 3 title'),\n content: translate('Tourguide step 3 content'),\n order: 3,\n group: TOUR_GROUP\n },\n {\n ref: 'clue',\n target: '[data-type=\"clue\"]',\n title: translate('Tourguide step 4 title'),\n content: translate('Tourguide step 4 content'),\n order: 4,\n group: TOUR_GROUP\n },\n {\n ref: 'language',\n target: '[data-name=\"button-multi-lang\"]',\n title: translate('Tourguide step 5 title'),\n content: translate('Tourguide step 5 content'),\n order: 5,\n group: TOUR_GROUP\n },\n {\n ref: 'help',\n target: '[data-name=\"help-button\"]',\n title: translate('Tourguide step 6 title'),\n content: translate('Tourguide step 6 content'),\n order: 6,\n group: TOUR_GROUP\n },\n {\n ref: 'life',\n target: '[data-name=\"life\"]',\n title: translate('Tourguide step 7 title'),\n content: translate('Tourguide step 7 content'),\n order: 7,\n group: TOUR_GROUP\n }\n];\n\nconst tourguideStateToProps = (state, options, store) => {\n const {translate} = options;\n const slide = getCurrentSlide(state);\n const hasMedia = pipe(get('lessons'), size)(slide) > 0;\n const hasClue = pipe(get('hasClue'), Boolean)(slide);\n const {hide: livesHidden} = getLives(state);\n const tourguideState = get('ui.tourguide', state) || {};\n const tourguideVisible = Boolean(tourguideState.visible);\n const tourguideStep = typeof tourguideState.step === 'number' ? tourguideState.step : 0;\n const tourguideForceStart = Boolean(tourguideState.forceStart);\n const canShowHelp = isTourguideEligible(state, options);\n const multiLangOptions = options.multiLang || {};\n const canShowLang = pipe(get('supportedLangs'), size)(multiLangOptions) > 1;\n\n const stepsForTour = pipe(\n filter(step => {\n if (step.order === 3) {\n return hasMedia;\n }\n if (step.order === 4) {\n return hasClue;\n }\n if (step.order === 5) {\n return canShowLang;\n }\n if (step.order === 6) {\n return canShowHelp;\n }\n if (step.order === 7) {\n return !livesHidden;\n }\n return true;\n }),\n map(cloneDeep)\n )(createTutorialSteps(translate));\n const getStepTracking = stepIndex => {\n const totalSteps = stepsForTour.length;\n const isValidIndex = typeof stepIndex === 'number' && stepIndex >= 0 && stepIndex < totalSteps;\n const stepRef = isValidIndex ? stepsForTour[stepIndex].ref : null;\n return {\n stepRef,\n stepNumber: isValidIndex ? stepIndex + 1 : null,\n totalSteps\n };\n };\n\n if (!tourguideVisible) {\n return null;\n }\n\n return {\n steps: stepsForTour,\n group: TOUR_GROUP,\n autoStart: tourguideVisible,\n forceStart: tourguideForceStart,\n startStep: tourguideStep,\n onStart: () =>\n store.dispatch(trackTourguideStarted(TOUR_GROUP, getStepTracking(tourguideStep))),\n onStepChange: step => {\n store.dispatch(trackTourguideStepViewed(TOUR_GROUP, getStepTracking(step)));\n store.dispatch(setTourguideStep(step));\n },\n onExit: () => {\n store.dispatch(trackTourguideDismissed(TOUR_GROUP, getStepTracking(tourguideStep)));\n store.dispatch(hideTourguide());\n },\n onFinish: () =>\n store.dispatch(trackTourguideCompleted(TOUR_GROUP, getStepTracking(tourguideStep))),\n options: {\n closeButton: false,\n nextLabel: translate('Tourguide next'),\n prevLabel: translate('Tourguide prev'),\n finishLabel: translate('Tourguide finish'),\n targetPadding: 2,\n showStepDots: false,\n keyboardControls: true,\n exitOnEscape: true,\n exitOnClickOutside: true,\n debug: false,\n completeOnFinish: true,\n rememberStep: true\n }\n };\n};\n\nconst playerProps = (options, store) => {\n const errorPopinStateToProps = mapStateToErrorPopinProps({dispatch: store.dispatch});\n const playerStateToProps = createPlayerStateToProps(options, store);\n\n return state => {\n return {\n player: playerStateToProps(state),\n tourguide: tourguideStateToProps(state, options, store),\n popin: errorPopinStateToProps(state)\n };\n };\n};\n\nexport default playerProps;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAYA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAsD,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtD,MAAMG,UAAU,GAAG,gCAAgC;AAEnD,MAAMC,mBAAmB,GAAGC,SAAS,IAAI,CACvC;EACEC,GAAG,EAAE,MAAM;EACXC,MAAM,EAAE,MAAM;EACdC,KAAK,EAAEH,SAAS,CAAC,wBAAwB,CAAC;EAC1CI,OAAO,EAAEJ,SAAS,CAAC,0BAA0B,CAAC;EAC9CK,KAAK,EAAE,CAAC;EACRC,KAAK,EAAER;AACT,CAAC,EACD;EACEG,GAAG,EAAE,OAAO;EACZC,MAAM,EAAE,qBAAqB;EAC7BC,KAAK,EAAEH,SAAS,CAAC,wBAAwB,CAAC;EAC1CI,OAAO,EAAEJ,SAAS,CAAC,0BAA0B,CAAC;EAC9CK,KAAK,EAAE,CAAC;EACRC,KAAK,EAAER;AACT,CAAC,EACD;EACEG,GAAG,EAAE,OAAO;EACZC,MAAM,EAAE,qBAAqB;EAC7BC,KAAK,EAAEH,SAAS,CAAC,wBAAwB,CAAC;EAC1CI,OAAO,EAAEJ,SAAS,CAAC,0BAA0B,CAAC;EAC9CK,KAAK,EAAE,CAAC;EACRC,KAAK,EAAER;AACT,CAAC,EACD;EACEG,GAAG,EAAE,MAAM;EACXC,MAAM,EAAE,oBAAoB;EAC5BC,KAAK,EAAEH,SAAS,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
|
|
@@ -79,13 +79,149 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
79
79
|
dispatch
|
|
80
80
|
})(state);
|
|
81
81
|
t.truthy(props.tourguide);
|
|
82
|
+
props.tourguide.onStart();
|
|
82
83
|
props.tourguide.onStepChange(2);
|
|
84
|
+
props.tourguide.onFinish();
|
|
83
85
|
props.tourguide.onExit();
|
|
84
|
-
t.is(actions.length,
|
|
85
|
-
t.is(actions[0].type,
|
|
86
|
+
t.is(actions.length, 6);
|
|
87
|
+
t.is(actions[0].type, 'ui/tourguide/track-started');
|
|
86
88
|
t.deepEqual(actions[0].payload, {
|
|
89
|
+
group: 'app-player-question-tour-guide',
|
|
90
|
+
stepRef: 'slide',
|
|
91
|
+
stepNumber: 2,
|
|
92
|
+
totalSteps: 4
|
|
93
|
+
});
|
|
94
|
+
t.is(actions[1].type, 'ui/tourguide/track-step-viewed');
|
|
95
|
+
t.deepEqual(actions[1].payload, {
|
|
96
|
+
group: 'app-player-question-tour-guide',
|
|
97
|
+
stepRef: 'media',
|
|
98
|
+
stepNumber: 3,
|
|
99
|
+
totalSteps: 4
|
|
100
|
+
});
|
|
101
|
+
t.is(actions[2].type, _playerStore.SET_TOURGUIDE_STEP);
|
|
102
|
+
t.deepEqual(actions[2].payload, {
|
|
87
103
|
step: 2
|
|
88
104
|
});
|
|
89
|
-
t.is(actions[
|
|
105
|
+
t.is(actions[3].type, 'ui/tourguide/track-completed');
|
|
106
|
+
t.deepEqual(actions[3].payload, {
|
|
107
|
+
group: 'app-player-question-tour-guide',
|
|
108
|
+
stepRef: 'slide',
|
|
109
|
+
stepNumber: 2,
|
|
110
|
+
totalSteps: 4
|
|
111
|
+
});
|
|
112
|
+
t.is(actions[4].type, 'ui/tourguide/track-dismissed');
|
|
113
|
+
t.deepEqual(actions[4].payload, {
|
|
114
|
+
group: 'app-player-question-tour-guide',
|
|
115
|
+
stepRef: 'slide',
|
|
116
|
+
stepNumber: 2,
|
|
117
|
+
totalSteps: 4
|
|
118
|
+
});
|
|
119
|
+
t.is(actions[5].type, _playerStore.HIDE_TOURGUIDE);
|
|
120
|
+
});
|
|
121
|
+
(0, _ava.default)('tourguide tracking uses null stepRef when index is out of bounds', t => {
|
|
122
|
+
const actions = [];
|
|
123
|
+
const dispatch = action => {
|
|
124
|
+
actions.push(action);
|
|
125
|
+
return action;
|
|
126
|
+
};
|
|
127
|
+
const options = {
|
|
128
|
+
translate: _translate.mockTranslate
|
|
129
|
+
};
|
|
130
|
+
const state = {
|
|
131
|
+
data: {
|
|
132
|
+
contents: {
|
|
133
|
+
chapter: {
|
|
134
|
+
entities: {
|
|
135
|
+
'1.B2': {
|
|
136
|
+
_id: '1.B2',
|
|
137
|
+
isConditional: false
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
slide: {
|
|
142
|
+
entities: {
|
|
143
|
+
[_basic.default._id]: {
|
|
144
|
+
..._basic.default,
|
|
145
|
+
chapter_id: '1.B2'
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
progressions: {
|
|
151
|
+
entities: {
|
|
152
|
+
basic: {
|
|
153
|
+
engine: {
|
|
154
|
+
ref: 'microlearning',
|
|
155
|
+
version: '1'
|
|
156
|
+
},
|
|
157
|
+
content: {
|
|
158
|
+
ref: '1.B2',
|
|
159
|
+
type: 'chapter'
|
|
160
|
+
},
|
|
161
|
+
state: {
|
|
162
|
+
nextContent: {
|
|
163
|
+
ref: _basic.default._id,
|
|
164
|
+
type: 'slide'
|
|
165
|
+
},
|
|
166
|
+
step: {
|
|
167
|
+
current: 1
|
|
168
|
+
},
|
|
169
|
+
lives: 1,
|
|
170
|
+
livesDisabled: false,
|
|
171
|
+
viewedResources: []
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
ui: {
|
|
178
|
+
current: {
|
|
179
|
+
progressionId: 'basic'
|
|
180
|
+
},
|
|
181
|
+
route: {
|
|
182
|
+
basic: 'answer'
|
|
183
|
+
},
|
|
184
|
+
tourguide: {
|
|
185
|
+
visible: true,
|
|
186
|
+
step: 99
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const props = (0, _slide.default)(options, {
|
|
191
|
+
dispatch
|
|
192
|
+
})(state);
|
|
193
|
+
t.truthy(props.tourguide);
|
|
194
|
+
props.tourguide.onStart();
|
|
195
|
+
props.tourguide.onStepChange(99);
|
|
196
|
+
props.tourguide.onFinish();
|
|
197
|
+
props.tourguide.onExit();
|
|
198
|
+
t.is(actions[0].type, 'ui/tourguide/track-started');
|
|
199
|
+
t.deepEqual(actions[0].payload, {
|
|
200
|
+
group: 'app-player-question-tour-guide',
|
|
201
|
+
stepRef: null,
|
|
202
|
+
stepNumber: null,
|
|
203
|
+
totalSteps: 4
|
|
204
|
+
});
|
|
205
|
+
t.is(actions[1].type, 'ui/tourguide/track-step-viewed');
|
|
206
|
+
t.deepEqual(actions[1].payload, {
|
|
207
|
+
group: 'app-player-question-tour-guide',
|
|
208
|
+
stepRef: null,
|
|
209
|
+
stepNumber: null,
|
|
210
|
+
totalSteps: 4
|
|
211
|
+
});
|
|
212
|
+
t.is(actions[3].type, 'ui/tourguide/track-completed');
|
|
213
|
+
t.deepEqual(actions[3].payload, {
|
|
214
|
+
group: 'app-player-question-tour-guide',
|
|
215
|
+
stepRef: null,
|
|
216
|
+
stepNumber: null,
|
|
217
|
+
totalSteps: 4
|
|
218
|
+
});
|
|
219
|
+
t.is(actions[4].type, 'ui/tourguide/track-dismissed');
|
|
220
|
+
t.deepEqual(actions[4].payload, {
|
|
221
|
+
group: 'app-player-question-tour-guide',
|
|
222
|
+
stepRef: null,
|
|
223
|
+
stepNumber: null,
|
|
224
|
+
totalSteps: 4
|
|
225
|
+
});
|
|
90
226
|
});
|
|
91
227
|
//# sourceMappingURL=slide.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide.js","names":["_ava","_interopRequireDefault","require","_translate","_playerStore","_slide","_basic","e","__esModule","default","test","t","actions","dispatch","action","push","options","translate","mockTranslate","state","data","contents","chapter","entities","_id","isConditional","slide","basicSlide","chapter_id","progressions","basic","engine","ref","version","content","type","nextContent","step","current","lives","livesDisabled","viewedResources","ui","progressionId","route","tourguide","visible","props","createSlideStateToProps","truthy","onStepChange","onExit","is","length","SET_TOURGUIDE_STEP","deepEqual","payload","HIDE_TOURGUIDE"],"sources":["../../../src/map-state-to-props/test/slide.js"],"sourcesContent":["import test from 'ava';\nimport {mockTranslate} from '@coorpacademy/translate';\nimport {HIDE_TOURGUIDE, SET_TOURGUIDE_STEP} from '@coorpacademy/player-store';\nimport createSlideStateToProps from '../slide';\nimport basicSlide from './fixtures/slides/basic';\n\ntest('tourguide callbacks dispatch step change and hide', t => {\n const actions = [];\n const dispatch = action => {\n actions.push(action);\n return action;\n };\n const options = {translate: mockTranslate};\n const state = {\n data: {\n contents: {\n chapter: {\n entities: {\n '1.B2': {_id: '1.B2', isConditional: false}\n }\n },\n slide: {\n entities: {\n [basicSlide._id]: {...basicSlide, chapter_id: '1.B2'}\n }\n }\n },\n progressions: {\n entities: {\n basic: {\n engine: {ref: 'microlearning', version: '1'},\n content: {ref: '1.B2', type: 'chapter'},\n state: {\n nextContent: {ref: basicSlide._id, type: 'slide'},\n step: {current: 1},\n lives: 1,\n livesDisabled: false,\n viewedResources: []\n }\n }\n }\n }\n },\n ui: {\n current: {progressionId: 'basic'},\n route: {basic: 'answer'},\n tourguide: {visible: true, step: 1}\n }\n };\n\n const props = createSlideStateToProps(options, {dispatch})(state);\n\n t.truthy(props.tourguide);\n props.tourguide.onStepChange(2);\n props.tourguide.onExit();\n\n t.is(actions.length, 2);\n t.is(actions[0].type, SET_TOURGUIDE_STEP);\n t.deepEqual(actions[0].payload, {step: 2});\n t.is(actions[1].type, HIDE_TOURGUIDE);\n});\n"],"mappings":";;AAAA,IAAAA,IAAA,G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;cAClBC,KAAK,EAAE,CAAC;cACRC,aAAa,EAAE,KAAK;cACpBC,eAAe,EAAE;YACnB;UACF;QACF;MACF;IACF,CAAC;IACDC,EAAE,EAAE;MACFJ,OAAO,EAAE;QAACK,aAAa,EAAE;MAAO,CAAC;MACjCC,KAAK,EAAE;QAACd,KAAK,EAAE;MAAQ,CAAC;MACxBe,SAAS,EAAE;QAACC,OAAO,EAAE,IAAI;QAAET,IAAI,EAAE;MAAC;IACpC;EACF,CAAC;EAED,MAAMU,KAAK,GAAG,IAAAC,cAAuB,EAAChC,OAAO,EAAE;IAACH;EAAQ,CAAC,CAAC,CAACM,KAAK,CAAC;EAEjER,CAAC,CAACsC,MAAM,CAACF,KAAK,CAACF,SAAS,CAAC;EACzBE,KAAK,CAACF,SAAS,CAACK,YAAY,CAAC,CAAC,CAAC;EAC/BH,KAAK,CAACF,SAAS,CAACM,MAAM,CAAC,CAAC;EAExBxC,CAAC,CAACyC,EAAE,CAACxC,OAAO,CAACyC,MAAM,EAAE,CAAC,CAAC;EACvB1C,CAAC,CAACyC,EAAE,CAACxC,OAAO,CAAC,CAAC,CAAC,CAACuB,IAAI,EAAEmB,+BAAkB,CAAC;EACzC3C,CAAC,CAAC4C,SAAS,CAAC3C,OAAO,CAAC,CAAC,CAAC,CAAC4C,OAAO,EAAE;IAACnB,IAAI,EAAE;EAAC,CAAC,CAAC;EAC1C1B,CAAC,CAACyC,EAAE,CAACxC,OAAO,CAAC,CAAC,CAAC,CAACuB,IAAI,EAAEsB,2BAAc,CAAC;AACvC,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"slide.js","names":["_ava","_interopRequireDefault","require","_translate","_playerStore","_slide","_basic","e","__esModule","default","test","t","actions","dispatch","action","push","options","translate","mockTranslate","state","data","contents","chapter","entities","_id","isConditional","slide","basicSlide","chapter_id","progressions","basic","engine","ref","version","content","type","nextContent","step","current","lives","livesDisabled","viewedResources","ui","progressionId","route","tourguide","visible","props","createSlideStateToProps","truthy","onStart","onStepChange","onFinish","onExit","is","length","deepEqual","payload","group","stepRef","stepNumber","totalSteps","SET_TOURGUIDE_STEP","HIDE_TOURGUIDE"],"sources":["../../../src/map-state-to-props/test/slide.js"],"sourcesContent":["import test from 'ava';\nimport {mockTranslate} from '@coorpacademy/translate';\nimport {HIDE_TOURGUIDE, SET_TOURGUIDE_STEP} from '@coorpacademy/player-store';\nimport createSlideStateToProps from '../slide';\nimport basicSlide from './fixtures/slides/basic';\n\ntest('tourguide callbacks dispatch step change and hide', t => {\n const actions = [];\n const dispatch = action => {\n actions.push(action);\n return action;\n };\n const options = {translate: mockTranslate};\n const state = {\n data: {\n contents: {\n chapter: {\n entities: {\n '1.B2': {_id: '1.B2', isConditional: false}\n }\n },\n slide: {\n entities: {\n [basicSlide._id]: {...basicSlide, chapter_id: '1.B2'}\n }\n }\n },\n progressions: {\n entities: {\n basic: {\n engine: {ref: 'microlearning', version: '1'},\n content: {ref: '1.B2', type: 'chapter'},\n state: {\n nextContent: {ref: basicSlide._id, type: 'slide'},\n step: {current: 1},\n lives: 1,\n livesDisabled: false,\n viewedResources: []\n }\n }\n }\n }\n },\n ui: {\n current: {progressionId: 'basic'},\n route: {basic: 'answer'},\n tourguide: {visible: true, step: 1}\n }\n };\n\n const props = createSlideStateToProps(options, {dispatch})(state);\n\n t.truthy(props.tourguide);\n props.tourguide.onStart();\n props.tourguide.onStepChange(2);\n props.tourguide.onFinish();\n props.tourguide.onExit();\n\n t.is(actions.length, 6);\n t.is(actions[0].type, 'ui/tourguide/track-started');\n t.deepEqual(actions[0].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: 'slide',\n stepNumber: 2,\n totalSteps: 4\n });\n t.is(actions[1].type, 'ui/tourguide/track-step-viewed');\n t.deepEqual(actions[1].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: 'media',\n stepNumber: 3,\n totalSteps: 4\n });\n t.is(actions[2].type, SET_TOURGUIDE_STEP);\n t.deepEqual(actions[2].payload, {step: 2});\n t.is(actions[3].type, 'ui/tourguide/track-completed');\n t.deepEqual(actions[3].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: 'slide',\n stepNumber: 2,\n totalSteps: 4\n });\n t.is(actions[4].type, 'ui/tourguide/track-dismissed');\n t.deepEqual(actions[4].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: 'slide',\n stepNumber: 2,\n totalSteps: 4\n });\n t.is(actions[5].type, HIDE_TOURGUIDE);\n});\n\ntest('tourguide tracking uses null stepRef when index is out of bounds', t => {\n const actions = [];\n const dispatch = action => {\n actions.push(action);\n return action;\n };\n const options = {translate: mockTranslate};\n const state = {\n data: {\n contents: {\n chapter: {\n entities: {\n '1.B2': {_id: '1.B2', isConditional: false}\n }\n },\n slide: {\n entities: {\n [basicSlide._id]: {...basicSlide, chapter_id: '1.B2'}\n }\n }\n },\n progressions: {\n entities: {\n basic: {\n engine: {ref: 'microlearning', version: '1'},\n content: {ref: '1.B2', type: 'chapter'},\n state: {\n nextContent: {ref: basicSlide._id, type: 'slide'},\n step: {current: 1},\n lives: 1,\n livesDisabled: false,\n viewedResources: []\n }\n }\n }\n }\n },\n ui: {\n current: {progressionId: 'basic'},\n route: {basic: 'answer'},\n tourguide: {visible: true, step: 99}\n }\n };\n\n const props = createSlideStateToProps(options, {dispatch})(state);\n\n t.truthy(props.tourguide);\n props.tourguide.onStart();\n props.tourguide.onStepChange(99);\n props.tourguide.onFinish();\n props.tourguide.onExit();\n\n t.is(actions[0].type, 'ui/tourguide/track-started');\n t.deepEqual(actions[0].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: null,\n stepNumber: null,\n totalSteps: 4\n });\n t.is(actions[1].type, 'ui/tourguide/track-step-viewed');\n t.deepEqual(actions[1].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: null,\n stepNumber: null,\n totalSteps: 4\n });\n t.is(actions[3].type, 'ui/tourguide/track-completed');\n t.deepEqual(actions[3].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: null,\n stepNumber: null,\n totalSteps: 4\n });\n t.is(actions[4].type, 'ui/tourguide/track-dismissed');\n t.deepEqual(actions[4].payload, {\n group: 'app-player-question-tour-guide',\n stepRef: null,\n stepNumber: null,\n totalSteps: 4\n });\n});\n"],"mappings":";;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAiD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEjD,IAAAG,YAAI,EAAC,mDAAmD,EAAEC,CAAC,IAAI;EAC7D,MAAMC,OAAO,GAAG,EAAE;EAClB,MAAMC,QAAQ,GAAGC,MAAM,IAAI;IACzBF,OAAO,CAACG,IAAI,CAACD,MAAM,CAAC;IACpB,OAAOA,MAAM;EACf,CAAC;EACD,MAAME,OAAO,GAAG;IAACC,SAAS,EAAEC;EAAa,CAAC;EAC1C,MAAMC,KAAK,GAAG;IACZC,IAAI,EAAE;MACJC,QAAQ,EAAE;QACRC,OAAO,EAAE;UACPC,QAAQ,EAAE;YACR,MAAM,EAAE;cAACC,GAAG,EAAE,MAAM;cAAEC,aAAa,EAAE;YAAK;UAC5C;QACF,CAAC;QACDC,KAAK,EAAE;UACLH,QAAQ,EAAE;YACR,CAACI,cAAU,CAACH,GAAG,GAAG;cAAC,GAAGG,cAAU;cAAEC,UAAU,EAAE;YAAM;UACtD;QACF;MACF,CAAC;MACDC,YAAY,EAAE;QACZN,QAAQ,EAAE;UACRO,KAAK,EAAE;YACLC,MAAM,EAAE;cAACC,GAAG,EAAE,eAAe;cAAEC,OAAO,EAAE;YAAG,CAAC;YAC5CC,OAAO,EAAE;cAACF,GAAG,EAAE,MAAM;cAAEG,IAAI,EAAE;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AAO,CAAC,CAAC,CAAC,CAACuB,IAAI,EAAE,8BAA8B,CAAC;EACrDxB,CAAC,CAAC6C,SAAS,CAAC5C,OAAO,CAAC,CAAC,CAAC,CAAC6C,OAAO,EAAE;IAC9BC,KAAK,EAAE,gCAAgC;IACvCC,OAAO,EAAE,IAAI;IACbC,UAAU,EAAE,IAAI;IAChBC,UAAU,EAAE;EACd,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/lib/store.js
CHANGED
|
@@ -6,7 +6,8 @@ var _redux = require("redux");
|
|
|
6
6
|
var _playerStore = require("@coorpacademy/player-store");
|
|
7
7
|
const {
|
|
8
8
|
ErrorLogger,
|
|
9
|
-
ReduxThunkMemoized
|
|
9
|
+
ReduxThunkMemoized,
|
|
10
|
+
TourguideTrackingLogger
|
|
10
11
|
} = _playerStore.middlewares;
|
|
11
12
|
const {
|
|
12
13
|
data,
|
|
@@ -18,7 +19,7 @@ const createReducers = () => (0, _redux.combineReducers)({
|
|
|
18
19
|
});
|
|
19
20
|
exports.createReducers = createReducers;
|
|
20
21
|
const createMiddlewares = options => {
|
|
21
|
-
return (0, _redux.compose)((0, _redux.applyMiddleware)(ReduxThunkMemoized(options), ErrorLogger(options)), typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f);
|
|
22
|
+
return (0, _redux.compose)((0, _redux.applyMiddleware)(ReduxThunkMemoized(options), ErrorLogger(options), TourguideTrackingLogger(options)), typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f);
|
|
22
23
|
};
|
|
23
24
|
exports.createMiddlewares = createMiddlewares;
|
|
24
25
|
const create = options => (0, _redux.createStore)(createReducers(), {}, createMiddlewares(options));
|
package/lib/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":["_redux","require","_playerStore","ErrorLogger","ReduxThunkMemoized","middlewares","data","ui","reducers","createReducers","combineReducers","exports","createMiddlewares","options","compose","applyMiddleware","window","__REDUX_DEVTOOLS_EXTENSION__","f","create","createStore","_default","default"],"sources":["../src/store.js"],"sourcesContent":["import {applyMiddleware, combineReducers, compose, createStore} from 'redux';\nimport {middlewares, reducers} from '@coorpacademy/player-store';\n\nconst {ErrorLogger, ReduxThunkMemoized} = middlewares;\nconst {data, ui} = reducers;\n\nconst createReducers = () =>\n combineReducers({\n data,\n ui\n });\n\nconst createMiddlewares = options => {\n return compose(\n applyMiddleware(ReduxThunkMemoized(options)
|
|
1
|
+
{"version":3,"file":"store.js","names":["_redux","require","_playerStore","ErrorLogger","ReduxThunkMemoized","TourguideTrackingLogger","middlewares","data","ui","reducers","createReducers","combineReducers","exports","createMiddlewares","options","compose","applyMiddleware","window","__REDUX_DEVTOOLS_EXTENSION__","f","create","createStore","_default","default"],"sources":["../src/store.js"],"sourcesContent":["import {applyMiddleware, combineReducers, compose, createStore} from 'redux';\nimport {middlewares, reducers} from '@coorpacademy/player-store';\n\nconst {ErrorLogger, ReduxThunkMemoized, TourguideTrackingLogger} = middlewares;\nconst {data, ui} = reducers;\n\nconst createReducers = () =>\n combineReducers({\n data,\n ui\n });\n\nconst createMiddlewares = options => {\n return compose(\n applyMiddleware(\n ReduxThunkMemoized(options),\n ErrorLogger(options),\n TourguideTrackingLogger(options)\n ),\n typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__\n ? window.__REDUX_DEVTOOLS_EXTENSION__()\n : f => f\n );\n};\n\nconst create = options => createStore(createReducers(), {}, createMiddlewares(options));\nexport {createMiddlewares, createReducers};\nexport default create;\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,MAAM;EAACE,WAAW;EAAEC,kBAAkB;EAAEC;AAAuB,CAAC,GAAGC,wBAAW;AAC9E,MAAM;EAACC,IAAI;EAAEC;AAAE,CAAC,GAAGC,qBAAQ;AAE3B,MAAMC,cAAc,GAAGA,CAAA,KACrB,IAAAC,sBAAe,EAAC;EACdJ,IAAI;EACJC;AACF,CAAC,CAAC;AAACI,OAAA,CAAAF,cAAA,GAAAA,cAAA;AAEL,MAAMG,iBAAiB,GAAGC,OAAO,IAAI;EACnC,OAAO,IAAAC,cAAO,EACZ,IAAAC,sBAAe,EACbZ,kBAAkB,CAACU,OAAO,CAAC,EAC3BX,WAAW,CAACW,OAAO,CAAC,EACpBT,uBAAuB,CAACS,OAAO,CACjC,CAAC,EACD,OAAOG,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,4BAA4B,GAChED,MAAM,CAACC,4BAA4B,CAAC,CAAC,GACrCC,CAAC,IAAIA,CACX,CAAC;AACH,CAAC;AAACP,OAAA,CAAAC,iBAAA,GAAAA,iBAAA;AAEF,MAAMO,MAAM,GAAGN,OAAO,IAAI,IAAAO,kBAAW,EAACX,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,EAAEG,iBAAiB,CAACC,OAAO,CAAC,CAAC;AAAC,IAAAQ,QAAA,GAAAV,OAAA,CAAAW,OAAA,GAEzEH,MAAM","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-reducers.js","names":["_ava","_interopRequireDefault","require","_store","_macro","e","__esModule","default","test","macro","createReducers","undefined","data","answers","entities","comments","configs","contents","clues","exitNodes","progressions","rank","nextContent","recommendations","videos","ui","coaches","availableCoaches","text","corrections","current","progressionId","location","route","tourguide","visible","step","hasTourGuideBeenShown","forceStart"],"sources":["../../src/test/init-reducers.js"],"sourcesContent":["import test from 'ava';\nimport {createReducers} from '../store';\nimport macro from './helpers/macro';\n\ntest(\n 'should have initial value',\n macro,\n createReducers(),\n undefined,\n {},\n {\n data: {\n answers: {entities: {}},\n comments: {entities: {}},\n configs: {},\n contents: {},\n clues: {entities: {}},\n exitNodes: {entities: {}},\n progressions: {entities: {}},\n rank: {},\n nextContent: {entities: {}},\n recommendations: {entities: {}},\n videos: {entities: {}}\n },\n ui: {\n answers: {},\n coaches: {\n availableCoaches: 0\n },\n comments: {\n text: null\n },\n corrections: {},\n current: {\n progressionId: null\n },\n location: {},\n route: {},\n tourguide: {\n visible: false,\n step: 0,\n hasTourGuideBeenShown: false,\n forceStart: false\n }\n }\n }\n);\n"],"mappings":";;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,IAAAG,YAAI,EACF,2BAA2B,EAC3BC,cAAK,EACL,IAAAC,qBAAc,EAAC,CAAC,EAChBC,SAAS,EACT,CAAC,CAAC,EACF;EACEC,IAAI,EAAE;IACJC,OAAO,EAAE;MAACC,QAAQ,EAAE,CAAC;IAAC,CAAC;IACvBC,QAAQ,EAAE;MAACD,QAAQ,EAAE,CAAC;IAAC,CAAC;IACxBE,OAAO,EAAE,CAAC,CAAC;IACXC,QAAQ,EAAE,CAAC,CAAC;IACZC,KAAK,EAAE;MAACJ,QAAQ,EAAE,CAAC;IAAC,CAAC;IACrBK,SAAS,EAAE;MAACL,QAAQ,EAAE,CAAC;IAAC,CAAC;IACzBM,YAAY,EAAE;MAACN,QAAQ,EAAE,CAAC;IAAC,CAAC;IAC5BO,IAAI,EAAE,CAAC,CAAC;IACRC,WAAW,EAAE;MAACR,QAAQ,EAAE,CAAC;IAAC,CAAC;IAC3BS,eAAe,EAAE;MAACT,QAAQ,EAAE,CAAC;IAAC,CAAC;IAC/BU,MAAM,EAAE;MAACV,QAAQ,EAAE,CAAC;IAAC;EACvB,CAAC;EACDW,EAAE,EAAE;IACFZ,OAAO,EAAE,CAAC,CAAC;IACXa,OAAO,EAAE;MACPC,gBAAgB,EAAE;IACpB,CAAC;IACDZ,QAAQ,EAAE;MACRa,IAAI,EAAE;IACR,CAAC;IACDC,WAAW,EAAE,CAAC,CAAC;IACfC,OAAO,EAAE;MACPC,aAAa,EAAE;IACjB,CAAC;IACDC,QAAQ,EAAE,CAAC,CAAC;IACZC,KAAK,EAAE,CAAC,CAAC;IACTC,SAAS,EAAE;MACTC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE,CAAC;MACPC,qBAAqB,EAAE,KAAK;MAC5BC,UAAU,EAAE;IACd;EACF;AACF,CACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"init-reducers.js","names":["_ava","_interopRequireDefault","require","_store","_macro","e","__esModule","default","test","macro","createReducers","undefined","data","answers","entities","comments","configs","contents","clues","exitNodes","progressions","rank","nextContent","recommendations","videos","ui","coaches","availableCoaches","text","corrections","current","progressionId","location","route","tourguide","visible","step","hasTourGuideBeenShown","forceStart","tourguideTracking","lastEvent"],"sources":["../../src/test/init-reducers.js"],"sourcesContent":["import test from 'ava';\nimport {createReducers} from '../store';\nimport macro from './helpers/macro';\n\ntest(\n 'should have initial value',\n macro,\n createReducers(),\n undefined,\n {},\n {\n data: {\n answers: {entities: {}},\n comments: {entities: {}},\n configs: {},\n contents: {},\n clues: {entities: {}},\n exitNodes: {entities: {}},\n progressions: {entities: {}},\n rank: {},\n nextContent: {entities: {}},\n recommendations: {entities: {}},\n videos: {entities: {}}\n },\n ui: {\n answers: {},\n coaches: {\n availableCoaches: 0\n },\n comments: {\n text: null\n },\n corrections: {},\n current: {\n progressionId: null\n },\n location: {},\n route: {},\n tourguide: {\n visible: false,\n step: 0,\n hasTourGuideBeenShown: false,\n forceStart: false\n },\n tourguideTracking: {\n lastEvent: null\n }\n }\n }\n);\n"],"mappings":";;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAI,CAAA,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,CACF,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/player-web",
|
|
3
|
-
"version": "4.29.
|
|
3
|
+
"version": "4.29.20",
|
|
4
4
|
"description": "CoorpAcademy web slide-player",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
"react-dom": "^17.0.2"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@coorpacademy/components": "11.40.
|
|
63
|
+
"@coorpacademy/components": "11.40.20",
|
|
64
64
|
"@coorpacademy/player-services": "5.3.1",
|
|
65
|
-
"@coorpacademy/player-store": "4.3.
|
|
65
|
+
"@coorpacademy/player-store": "4.3.3",
|
|
66
66
|
"@coorpacademy/progression-engine": "11.8.1",
|
|
67
67
|
"@coorpacademy/redux-task": "1.2.0",
|
|
68
68
|
"@coorpacademy/translate": "6.3.0",
|
|
69
69
|
"eslint": "^8.24.0",
|
|
70
70
|
"lodash": "^4.17.21"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "729eea9093b042bdac3ffe5f920070e01657aed5"
|
|
73
73
|
}
|