@coorpacademy/player-web 4.29.18 → 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/index.js +3 -0
- package/es/index.js.map +1 -1
- package/es/map-state-to-props/header.js +23 -3
- package/es/map-state-to-props/header.js.map +1 -1
- package/es/map-state-to-props/slide.js +149 -7
- package/es/map-state-to-props/slide.js.map +1 -1
- package/es/map-state-to-props/test/header.js +160 -1
- package/es/map-state-to-props/test/header.js.map +1 -1
- package/es/map-state-to-props/test/popin-error.js +12 -8
- package/es/map-state-to-props/test/popin-error.js.map +1 -1
- package/es/map-state-to-props/test/slide.js +224 -0
- package/es/map-state-to-props/test/slide.js.map +1 -0
- package/es/map-state-to-props/test/tourguide-sync.js +243 -0
- package/es/map-state-to-props/test/tourguide-sync.js.map +1 -0
- package/es/store.js +3 -2
- package/es/store.js.map +1 -1
- package/es/test/init-reducers.js +10 -1
- package/es/test/init-reducers.js.map +1 -1
- package/es/test/store.js +3 -5
- package/es/test/store.js.map +1 -1
- package/es/tourguide-sync.js +24 -0
- package/es/tourguide-sync.js.map +1 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/map-state-to-props/header.js +22 -2
- package/lib/map-state-to-props/header.js.map +1 -1
- package/lib/map-state-to-props/slide.js +149 -7
- package/lib/map-state-to-props/slide.js.map +1 -1
- package/lib/map-state-to-props/test/header.js +160 -1
- package/lib/map-state-to-props/test/header.js.map +1 -1
- package/lib/map-state-to-props/test/popin-error.js +12 -8
- package/lib/map-state-to-props/test/popin-error.js.map +1 -1
- package/lib/map-state-to-props/test/slide.js +227 -0
- package/lib/map-state-to-props/test/slide.js.map +1 -0
- package/lib/map-state-to-props/test/tourguide-sync.js +246 -0
- package/lib/map-state-to-props/test/tourguide-sync.js.map +1 -0
- package/lib/store.js +3 -2
- package/lib/store.js.map +1 -1
- package/lib/test/init-reducers.js +10 -1
- package/lib/test/init-reducers.js.map +1 -1
- package/lib/test/store.js +3 -5
- package/lib/test/store.js.map +1 -1
- package/lib/tourguide-sync.js +29 -0
- package/lib/tourguide-sync.js.map +1 -0
- package/locales/bs/player.json +19 -1
- package/locales/cs/player.json +19 -1
- package/locales/de/player.json +19 -1
- package/locales/en/player.json +19 -1
- package/locales/es/player.json +19 -1
- package/locales/et/player.json +19 -1
- package/locales/fi/player.json +19 -1
- package/locales/fr/player.json +19 -1
- package/locales/hr/player.json +19 -1
- package/locales/hu/player.json +19 -1
- package/locales/hy/player.json +19 -1
- package/locales/it/player.json +19 -1
- package/locales/ja/player.json +19 -1
- package/locales/ko/player.json +19 -1
- package/locales/lt/player.json +19 -1
- package/locales/nl/player.json +19 -1
- package/locales/pl/player.json +19 -1
- package/locales/pt/player.json +19 -1
- package/locales/ro/player.json +19 -1
- package/locales/ru/player.json +19 -1
- package/locales/sk/player.json +19 -1
- package/locales/sl/player.json +19 -1
- package/locales/sv/player.json +19 -1
- package/locales/tl/player.json +19 -1
- package/locales/tr/player.json +19 -1
- package/locales/uk/player.json +19 -1
- package/locales/vi/player.json +19 -1
- package/locales/zh/player.json +19 -1
- package/locales/zh_TW/player.json +19 -1
- package/package.json +4 -4
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import { mockTranslate } from '@coorpacademy/translate';
|
|
3
|
+
import { HIDE_TOURGUIDE, SET_TOURGUIDE_STEP } from '@coorpacademy/player-store';
|
|
4
|
+
import createSlideStateToProps from '../slide';
|
|
5
|
+
import basicSlide from './fixtures/slides/basic';
|
|
6
|
+
test('tourguide callbacks dispatch step change and hide', t => {
|
|
7
|
+
const actions = [];
|
|
8
|
+
const dispatch = action => {
|
|
9
|
+
actions.push(action);
|
|
10
|
+
return action;
|
|
11
|
+
};
|
|
12
|
+
const options = {
|
|
13
|
+
translate: mockTranslate
|
|
14
|
+
};
|
|
15
|
+
const state = {
|
|
16
|
+
data: {
|
|
17
|
+
contents: {
|
|
18
|
+
chapter: {
|
|
19
|
+
entities: {
|
|
20
|
+
'1.B2': {
|
|
21
|
+
_id: '1.B2',
|
|
22
|
+
isConditional: false
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
slide: {
|
|
27
|
+
entities: {
|
|
28
|
+
[basicSlide._id]: {
|
|
29
|
+
...basicSlide,
|
|
30
|
+
chapter_id: '1.B2'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
progressions: {
|
|
36
|
+
entities: {
|
|
37
|
+
basic: {
|
|
38
|
+
engine: {
|
|
39
|
+
ref: 'microlearning',
|
|
40
|
+
version: '1'
|
|
41
|
+
},
|
|
42
|
+
content: {
|
|
43
|
+
ref: '1.B2',
|
|
44
|
+
type: 'chapter'
|
|
45
|
+
},
|
|
46
|
+
state: {
|
|
47
|
+
nextContent: {
|
|
48
|
+
ref: basicSlide._id,
|
|
49
|
+
type: 'slide'
|
|
50
|
+
},
|
|
51
|
+
step: {
|
|
52
|
+
current: 1
|
|
53
|
+
},
|
|
54
|
+
lives: 1,
|
|
55
|
+
livesDisabled: false,
|
|
56
|
+
viewedResources: []
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
ui: {
|
|
63
|
+
current: {
|
|
64
|
+
progressionId: 'basic'
|
|
65
|
+
},
|
|
66
|
+
route: {
|
|
67
|
+
basic: 'answer'
|
|
68
|
+
},
|
|
69
|
+
tourguide: {
|
|
70
|
+
visible: true,
|
|
71
|
+
step: 1
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const props = createSlideStateToProps(options, {
|
|
76
|
+
dispatch
|
|
77
|
+
})(state);
|
|
78
|
+
t.truthy(props.tourguide);
|
|
79
|
+
props.tourguide.onStart();
|
|
80
|
+
props.tourguide.onStepChange(2);
|
|
81
|
+
props.tourguide.onFinish();
|
|
82
|
+
props.tourguide.onExit();
|
|
83
|
+
t.is(actions.length, 6);
|
|
84
|
+
t.is(actions[0].type, 'ui/tourguide/track-started');
|
|
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, {
|
|
100
|
+
step: 2
|
|
101
|
+
});
|
|
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
|
+
});
|
|
223
|
+
});
|
|
224
|
+
//# sourceMappingURL=slide.js.map
|
|
@@ -0,0 +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","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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
|
+
import { SHOW_TOURGUIDE } from '@coorpacademy/player-store';
|
|
3
|
+
import createTourguideSync from '../../tourguide-sync';
|
|
4
|
+
const noop = () => {};
|
|
5
|
+
test('tourguide sync dispatches show only when auto-show conditions are met', t => {
|
|
6
|
+
const state = {
|
|
7
|
+
data: {
|
|
8
|
+
contents: {
|
|
9
|
+
chapter: {
|
|
10
|
+
entities: {
|
|
11
|
+
'1.B2': {
|
|
12
|
+
_id: '1.B2',
|
|
13
|
+
isConditional: false,
|
|
14
|
+
nbSlides: 5
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
slide: {
|
|
19
|
+
entities: {
|
|
20
|
+
sli_1: {
|
|
21
|
+
chapter_id: '1.B2'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
progressions: {
|
|
27
|
+
entities: {
|
|
28
|
+
basic: {
|
|
29
|
+
engine: {
|
|
30
|
+
ref: 'microlearning',
|
|
31
|
+
version: '1'
|
|
32
|
+
},
|
|
33
|
+
content: {
|
|
34
|
+
ref: '1.B2',
|
|
35
|
+
type: 'chapter'
|
|
36
|
+
},
|
|
37
|
+
state: {
|
|
38
|
+
nextContent: {
|
|
39
|
+
ref: 'sli_1',
|
|
40
|
+
type: 'slide'
|
|
41
|
+
},
|
|
42
|
+
step: {
|
|
43
|
+
current: 1
|
|
44
|
+
},
|
|
45
|
+
lives: 3,
|
|
46
|
+
livesDisabled: false,
|
|
47
|
+
viewedResources: []
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
ui: {
|
|
54
|
+
current: {
|
|
55
|
+
progressionId: 'basic'
|
|
56
|
+
},
|
|
57
|
+
route: {
|
|
58
|
+
basic: 'answer'
|
|
59
|
+
},
|
|
60
|
+
tourguide: {
|
|
61
|
+
visible: false,
|
|
62
|
+
step: 0,
|
|
63
|
+
hasTourGuideBeenShown: false
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const actions = [];
|
|
68
|
+
const getState = () => state;
|
|
69
|
+
const dispatch = action => {
|
|
70
|
+
actions.push(action);
|
|
71
|
+
return action;
|
|
72
|
+
};
|
|
73
|
+
const subscribe = () => noop;
|
|
74
|
+
const store = {
|
|
75
|
+
getState,
|
|
76
|
+
dispatch,
|
|
77
|
+
subscribe
|
|
78
|
+
};
|
|
79
|
+
createTourguideSync({
|
|
80
|
+
mode: 'scorm'
|
|
81
|
+
}, store);
|
|
82
|
+
t.is(actions.length, 1);
|
|
83
|
+
t.is(actions[0].type, SHOW_TOURGUIDE);
|
|
84
|
+
});
|
|
85
|
+
test('tourguide sync does not dispatch again when auto-show state is unchanged', t => {
|
|
86
|
+
const state = {
|
|
87
|
+
data: {
|
|
88
|
+
contents: {
|
|
89
|
+
chapter: {
|
|
90
|
+
entities: {
|
|
91
|
+
'1.B2': {
|
|
92
|
+
_id: '1.B2',
|
|
93
|
+
isConditional: false,
|
|
94
|
+
nbSlides: 5
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
slide: {
|
|
99
|
+
entities: {
|
|
100
|
+
sli_1: {
|
|
101
|
+
chapter_id: '1.B2'
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
progressions: {
|
|
107
|
+
entities: {
|
|
108
|
+
basic: {
|
|
109
|
+
engine: {
|
|
110
|
+
ref: 'microlearning',
|
|
111
|
+
version: '1'
|
|
112
|
+
},
|
|
113
|
+
content: {
|
|
114
|
+
ref: '1.B2',
|
|
115
|
+
type: 'chapter'
|
|
116
|
+
},
|
|
117
|
+
state: {
|
|
118
|
+
nextContent: {
|
|
119
|
+
ref: 'sli_1',
|
|
120
|
+
type: 'slide'
|
|
121
|
+
},
|
|
122
|
+
step: {
|
|
123
|
+
current: 1
|
|
124
|
+
},
|
|
125
|
+
lives: 3,
|
|
126
|
+
livesDisabled: false,
|
|
127
|
+
viewedResources: []
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
ui: {
|
|
134
|
+
current: {
|
|
135
|
+
progressionId: 'basic'
|
|
136
|
+
},
|
|
137
|
+
route: {
|
|
138
|
+
basic: 'answer'
|
|
139
|
+
},
|
|
140
|
+
tourguide: {
|
|
141
|
+
visible: false,
|
|
142
|
+
step: 0,
|
|
143
|
+
hasTourGuideBeenShown: false
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const actions = [];
|
|
148
|
+
const getState = () => state;
|
|
149
|
+
const dispatch = action => {
|
|
150
|
+
actions.push(action);
|
|
151
|
+
return action;
|
|
152
|
+
};
|
|
153
|
+
const subscribe = listener => {
|
|
154
|
+
listener();
|
|
155
|
+
return noop;
|
|
156
|
+
};
|
|
157
|
+
const store = {
|
|
158
|
+
getState,
|
|
159
|
+
dispatch,
|
|
160
|
+
subscribe
|
|
161
|
+
};
|
|
162
|
+
createTourguideSync({
|
|
163
|
+
mode: 'scorm'
|
|
164
|
+
}, store);
|
|
165
|
+
t.is(actions.length, 1);
|
|
166
|
+
t.is(actions[0].type, SHOW_TOURGUIDE);
|
|
167
|
+
});
|
|
168
|
+
test('tourguide sync uses empty tourguide state when missing', t => {
|
|
169
|
+
const state = {
|
|
170
|
+
data: {
|
|
171
|
+
contents: {
|
|
172
|
+
chapter: {
|
|
173
|
+
entities: {
|
|
174
|
+
'1.B2': {
|
|
175
|
+
_id: '1.B2',
|
|
176
|
+
isConditional: false,
|
|
177
|
+
nbSlides: 5
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
slide: {
|
|
182
|
+
entities: {
|
|
183
|
+
sli_1: {
|
|
184
|
+
chapter_id: '1.B2'
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
progressions: {
|
|
190
|
+
entities: {
|
|
191
|
+
basic: {
|
|
192
|
+
engine: {
|
|
193
|
+
ref: 'microlearning',
|
|
194
|
+
version: '1'
|
|
195
|
+
},
|
|
196
|
+
content: {
|
|
197
|
+
ref: '1.B2',
|
|
198
|
+
type: 'chapter'
|
|
199
|
+
},
|
|
200
|
+
state: {
|
|
201
|
+
nextContent: {
|
|
202
|
+
ref: 'sli_1',
|
|
203
|
+
type: 'slide'
|
|
204
|
+
},
|
|
205
|
+
step: {
|
|
206
|
+
current: 1
|
|
207
|
+
},
|
|
208
|
+
lives: 3,
|
|
209
|
+
livesDisabled: false,
|
|
210
|
+
viewedResources: []
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
ui: {
|
|
217
|
+
current: {
|
|
218
|
+
progressionId: 'basic'
|
|
219
|
+
},
|
|
220
|
+
route: {
|
|
221
|
+
basic: 'answer'
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
const actions = [];
|
|
226
|
+
const getState = () => state;
|
|
227
|
+
const dispatch = action => {
|
|
228
|
+
actions.push(action);
|
|
229
|
+
return action;
|
|
230
|
+
};
|
|
231
|
+
const subscribe = () => noop;
|
|
232
|
+
const store = {
|
|
233
|
+
getState,
|
|
234
|
+
dispatch,
|
|
235
|
+
subscribe
|
|
236
|
+
};
|
|
237
|
+
createTourguideSync({
|
|
238
|
+
mode: 'scorm'
|
|
239
|
+
}, store);
|
|
240
|
+
t.is(actions.length, 1);
|
|
241
|
+
t.is(actions[0].type, SHOW_TOURGUIDE);
|
|
242
|
+
});
|
|
243
|
+
//# sourceMappingURL=tourguide-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tourguide-sync.js","names":["test","SHOW_TOURGUIDE","createTourguideSync","noop","t","state","data","contents","chapter","entities","_id","isConditional","nbSlides","slide","sli_1","chapter_id","progressions","basic","engine","ref","version","content","type","nextContent","step","current","lives","livesDisabled","viewedResources","ui","progressionId","route","tourguide","visible","hasTourGuideBeenShown","actions","getState","dispatch","action","push","subscribe","store","mode","is","length","listener"],"sources":["../../../src/map-state-to-props/test/tourguide-sync.js"],"sourcesContent":["import test from 'ava';\nimport {SHOW_TOURGUIDE} from '@coorpacademy/player-store';\nimport createTourguideSync from '../../tourguide-sync';\n\nconst noop = () => {};\n\ntest('tourguide sync dispatches show only when auto-show conditions are met', t => {\n const state = {\n data: {\n contents: {\n chapter: {\n entities: {\n '1.B2': {_id: '1.B2', isConditional: false, nbSlides: 5}\n }\n },\n slide: {\n entities: {\n sli_1: {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: 'sli_1', type: 'slide'},\n step: {current: 1},\n lives: 3,\n livesDisabled: false,\n viewedResources: []\n }\n }\n }\n }\n },\n ui: {\n current: {progressionId: 'basic'},\n route: {basic: 'answer'},\n tourguide: {visible: false, step: 0, hasTourGuideBeenShown: false}\n }\n };\n\n const actions = [];\n const getState = () => state;\n const dispatch = action => {\n actions.push(action);\n return action;\n };\n const subscribe = () => noop;\n const store = {getState, dispatch, subscribe};\n\n createTourguideSync({mode: 'scorm'}, store);\n\n t.is(actions.length, 1);\n t.is(actions[0].type, SHOW_TOURGUIDE);\n});\n\ntest('tourguide sync does not dispatch again when auto-show state is unchanged', t => {\n const state = {\n data: {\n contents: {\n chapter: {\n entities: {\n '1.B2': {_id: '1.B2', isConditional: false, nbSlides: 5}\n }\n },\n slide: {\n entities: {\n sli_1: {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: 'sli_1', type: 'slide'},\n step: {current: 1},\n lives: 3,\n livesDisabled: false,\n viewedResources: []\n }\n }\n }\n }\n },\n ui: {\n current: {progressionId: 'basic'},\n route: {basic: 'answer'},\n tourguide: {visible: false, step: 0, hasTourGuideBeenShown: false}\n }\n };\n\n const actions = [];\n const getState = () => state;\n const dispatch = action => {\n actions.push(action);\n return action;\n };\n const subscribe = listener => {\n listener();\n return noop;\n };\n const store = {getState, dispatch, subscribe};\n\n createTourguideSync({mode: 'scorm'}, store);\n\n t.is(actions.length, 1);\n t.is(actions[0].type, SHOW_TOURGUIDE);\n});\n\ntest('tourguide sync uses empty tourguide state when missing', t => {\n const state = {\n data: {\n contents: {\n chapter: {\n entities: {\n '1.B2': {_id: '1.B2', isConditional: false, nbSlides: 5}\n }\n },\n slide: {\n entities: {\n sli_1: {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: 'sli_1', type: 'slide'},\n step: {current: 1},\n lives: 3,\n livesDisabled: false,\n viewedResources: []\n }\n }\n }\n }\n },\n ui: {\n current: {progressionId: 'basic'},\n route: {basic: 'answer'}\n }\n };\n\n const actions = [];\n const getState = () => state;\n const dispatch = action => {\n actions.push(action);\n return action;\n };\n const subscribe = () => noop;\n const store = {getState, dispatch, subscribe};\n\n createTourguideSync({mode: 'scorm'}, store);\n\n t.is(actions.length, 1);\n t.is(actions[0].type, SHOW_TOURGUIDE);\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,KAAK;AACtB,SAAQC,cAAc,QAAO,4BAA4B;AACzD,OAAOC,mBAAmB,MAAM,sBAAsB;AAEtD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErBH,IAAI,CAAC,uEAAuE,EAAEI,CAAC,IAAI;EACjF,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,KAAK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IAAI,EAAE;cAAO,CAAC;cAC1CE,IAAI,EAAE;gBAACC,OAAO,EAAE;cAAC,CAAC;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;IACzB;EACF,CAAC;EAED,MAAMkB,OAAO,GAAG,EAAE;EAClB,MAAMC,QAAQ,GAAGA,CAAA,KAAM/B,KAAK;EAC5B,MAAMgC,QAAQ,GAAGC,MAAM,IAAI;IACzBH,OAAO,CAACI,IAAI,CAACD,MAAM,CAAC;IACpB,OAAOA,MAAM;EACf,CAAC;EACD,MAAME,SAAS,GAAGA,CAAA,KAAMrC,IAAI;EAC5B,MAAMsC,KAAK,GAAG;IAACL,QAAQ;IAAEC,QAAQ;IAAEG;EAAS,CAAC;EAE7CtC,mBAAmB,CAAC;IAACwC,IAAI,EAAE;EAAO,CAAC,EAAED,KAAK,CAAC;EAE3CrC,CAAC,CAACuC,EAAE,CAACR,OAAO,CAACS,MAAM,EAAE,CAAC,CAAC;EACvBxC,CAAC,CAACuC,EAAE,CAACR,OAAO,CAAC,CAAC,CAAC,CAACb,IAAI,EAAErB,cAAc,CAAC;AACvC,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
|
@@ -44,7 +44,16 @@ test('should have initial value', macro, createReducers(), undefined, {}, {
|
|
|
44
44
|
progressionId: null
|
|
45
45
|
},
|
|
46
46
|
location: {},
|
|
47
|
-
route: {}
|
|
47
|
+
route: {},
|
|
48
|
+
tourguide: {
|
|
49
|
+
visible: false,
|
|
50
|
+
step: 0,
|
|
51
|
+
hasTourGuideBeenShown: false,
|
|
52
|
+
forceStart: false
|
|
53
|
+
},
|
|
54
|
+
tourguideTracking: {
|
|
55
|
+
lastEvent: null
|
|
56
|
+
}
|
|
48
57
|
}
|
|
49
58
|
});
|
|
50
59
|
//# sourceMappingURL=init-reducers.js.map
|
|
@@ -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"],"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 }\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;
|
|
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":"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,CAAC;IACDC,iBAAiB,EAAE;MACjBC,SAAS,EAAE;IACb;EACF;AACF,CACF,CAAC","ignoreList":[]}
|
package/es/test/store.js
CHANGED
|
@@ -27,11 +27,9 @@ test('should apply redux-thunk', async t => {
|
|
|
27
27
|
});
|
|
28
28
|
test('should enable devtools', t => {
|
|
29
29
|
t.plan(1);
|
|
30
|
-
global.window = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return f => f;
|
|
34
|
-
}
|
|
30
|
+
global.window.__REDUX_DEVTOOLS_EXTENSION__ = () => {
|
|
31
|
+
t.pass();
|
|
32
|
+
return f => f;
|
|
35
33
|
};
|
|
36
34
|
createStore(state => state, 'state', createMiddlewares(appOptions));
|
|
37
35
|
});
|
package/es/test/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":["test","createStore","createMiddlewares","appOptions","services","error","Error","t","plan","store","state","pass","dispatch","type","getState","options","is","global","window","__REDUX_DEVTOOLS_EXTENSION__","f"],"sources":["../../src/test/store.js"],"sourcesContent":["import test from 'ava';\nimport {createStore} from 'redux';\nimport {createMiddlewares} from '../store';\n\nconst appOptions = {\n services: {\n error: () => {\n throw new Error('error logger should not have been called');\n }\n }\n};\n\ntest('should apply redux-thunk', async t => {\n t.plan(5);\n\n const store = createStore(\n state => {\n t.pass();\n return state;\n },\n 'state',\n createMiddlewares(appOptions)\n );\n\n await store.dispatch({type: 1});\n return store.dispatch((dispatch, getState, options) => {\n t.is(options, appOptions);\n t.is(getState(), 'state');\n return dispatch({\n type: 2\n });\n });\n});\n\ntest('should enable devtools', t => {\n t.plan(1);\n global.window =
|
|
1
|
+
{"version":3,"file":"store.js","names":["test","createStore","createMiddlewares","appOptions","services","error","Error","t","plan","store","state","pass","dispatch","type","getState","options","is","global","window","__REDUX_DEVTOOLS_EXTENSION__","f"],"sources":["../../src/test/store.js"],"sourcesContent":["import test from 'ava';\nimport {createStore} from 'redux';\nimport {createMiddlewares} from '../store';\n\nconst appOptions = {\n services: {\n error: () => {\n throw new Error('error logger should not have been called');\n }\n }\n};\n\ntest('should apply redux-thunk', async t => {\n t.plan(5);\n\n const store = createStore(\n state => {\n t.pass();\n return state;\n },\n 'state',\n createMiddlewares(appOptions)\n );\n\n await store.dispatch({type: 1});\n return store.dispatch((dispatch, getState, options) => {\n t.is(options, appOptions);\n t.is(getState(), 'state');\n return dispatch({\n type: 2\n });\n });\n});\n\ntest('should enable devtools', t => {\n t.plan(1);\n global.window.__REDUX_DEVTOOLS_EXTENSION__ = () => {\n t.pass();\n return f => f;\n };\n\n createStore(state => state, 'state', createMiddlewares(appOptions));\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,KAAK;AACtB,SAAQC,WAAW,QAAO,OAAO;AACjC,SAAQC,iBAAiB,QAAO,UAAU;AAE1C,MAAMC,UAAU,GAAG;EACjBC,QAAQ,EAAE;IACRC,KAAK,EAAEA,CAAA,KAAM;MACX,MAAM,IAAIC,KAAK,CAAC,0CAA0C,CAAC;IAC7D;EACF;AACF,CAAC;AAEDN,IAAI,CAAC,0BAA0B,EAAE,MAAMO,CAAC,IAAI;EAC1CA,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;EAET,MAAMC,KAAK,GAAGR,WAAW,CACvBS,KAAK,IAAI;IACPH,CAAC,CAACI,IAAI,CAAC,CAAC;IACR,OAAOD,KAAK;EACd,CAAC,EACD,OAAO,EACPR,iBAAiB,CAACC,UAAU,CAC9B,CAAC;EAED,MAAMM,KAAK,CAACG,QAAQ,CAAC;IAACC,IAAI,EAAE;EAAC,CAAC,CAAC;EAC/B,OAAOJ,KAAK,CAACG,QAAQ,CAAC,CAACA,QAAQ,EAAEE,QAAQ,EAAEC,OAAO,KAAK;IACrDR,CAAC,CAACS,EAAE,CAACD,OAAO,EAAEZ,UAAU,CAAC;IACzBI,CAAC,CAACS,EAAE,CAACF,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IACzB,OAAOF,QAAQ,CAAC;MACdC,IAAI,EAAE;IACR,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAEFb,IAAI,CAAC,wBAAwB,EAAEO,CAAC,IAAI;EAClCA,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;EACTS,MAAM,CAACC,MAAM,CAACC,4BAA4B,GAAG,MAAM;IACjDZ,CAAC,CAACI,IAAI,CAAC,CAAC;IACR,OAAOS,CAAC,IAAIA,CAAC;EACf,CAAC;EAEDnB,WAAW,CAACS,KAAK,IAAIA,KAAK,EAAE,OAAO,EAAER,iBAAiB,CAACC,UAAU,CAAC,CAAC;AACrE,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _get from "lodash/fp/get";
|
|
2
|
+
import { showTourguide, shouldAutoShowTourguide } from '@coorpacademy/player-store';
|
|
3
|
+
const getTourguideState = state => _get('ui.tourguide', state) || {};
|
|
4
|
+
const createTourguideSync = (options, store) => {
|
|
5
|
+
let lastShouldEnable = null;
|
|
6
|
+
const sync = () => {
|
|
7
|
+
const state = store.getState();
|
|
8
|
+
const {
|
|
9
|
+
visible
|
|
10
|
+
} = getTourguideState(state);
|
|
11
|
+
const shouldAutoShow = shouldAutoShowTourguide(state, options, getTourguideState(state));
|
|
12
|
+
if (shouldAutoShow === lastShouldEnable) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
lastShouldEnable = shouldAutoShow;
|
|
16
|
+
if (shouldAutoShow && !visible) {
|
|
17
|
+
store.dispatch(showTourguide());
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
sync();
|
|
21
|
+
return store.subscribe(sync);
|
|
22
|
+
};
|
|
23
|
+
export default createTourguideSync;
|
|
24
|
+
//# sourceMappingURL=tourguide-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tourguide-sync.js","names":["showTourguide","shouldAutoShowTourguide","getTourguideState","state","_get","createTourguideSync","options","store","lastShouldEnable","sync","getState","visible","shouldAutoShow","dispatch","subscribe"],"sources":["../src/tourguide-sync.js"],"sourcesContent":["import {get} from 'lodash/fp';\nimport {showTourguide, shouldAutoShowTourguide} from '@coorpacademy/player-store';\n\nconst getTourguideState = state => get('ui.tourguide', state) || {};\n\nconst createTourguideSync = (options, store) => {\n let lastShouldEnable = null;\n\n const sync = () => {\n const state = store.getState();\n const {visible} = getTourguideState(state);\n const shouldAutoShow = shouldAutoShowTourguide(state, options, getTourguideState(state));\n\n if (shouldAutoShow === lastShouldEnable) {\n return;\n }\n\n lastShouldEnable = shouldAutoShow;\n\n if (shouldAutoShow && !visible) {\n store.dispatch(showTourguide());\n }\n };\n\n sync();\n return store.subscribe(sync);\n};\n\nexport default createTourguideSync;\n"],"mappings":";AACA,SAAQA,aAAa,EAAEC,uBAAuB,QAAO,4BAA4B;AAEjF,MAAMC,iBAAiB,GAAGC,KAAK,IAAIC,IAAA,CAAI,cAAc,EAAED,KAAK,CAAC,IAAI,CAAC,CAAC;AAEnE,MAAME,mBAAmB,GAAGA,CAACC,OAAO,EAAEC,KAAK,KAAK;EAC9C,IAAIC,gBAAgB,GAAG,IAAI;EAE3B,MAAMC,IAAI,GAAGA,CAAA,KAAM;IACjB,MAAMN,KAAK,GAAGI,KAAK,CAACG,QAAQ,CAAC,CAAC;IAC9B,MAAM;MAACC;IAAO,CAAC,GAAGT,iBAAiB,CAACC,KAAK,CAAC;IAC1C,MAAMS,cAAc,GAAGX,uBAAuB,CAACE,KAAK,EAAEG,OAAO,EAAEJ,iBAAiB,CAACC,KAAK,CAAC,CAAC;IAExF,IAAIS,cAAc,KAAKJ,gBAAgB,EAAE;MACvC;IACF;IAEAA,gBAAgB,GAAGI,cAAc;IAEjC,IAAIA,cAAc,IAAI,CAACD,OAAO,EAAE;MAC9BJ,KAAK,CAACM,QAAQ,CAACb,aAAa,CAAC,CAAC,CAAC;IACjC;EACF,CAAC;EAEDS,IAAI,CAAC,CAAC;EACN,OAAOF,KAAK,CAACO,SAAS,CAACL,IAAI,CAAC;AAC9B,CAAC;AAED,eAAeJ,mBAAmB","ignoreList":[]}
|
package/lib/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var _runApp = _interopRequireDefault(require("./run-app"));
|
|
|
11
11
|
var _store = _interopRequireDefault(require("./store"));
|
|
12
12
|
var _mapStateToProps = require("./map-state-to-props");
|
|
13
13
|
var _views = require("./views");
|
|
14
|
+
var _tourguideSync = _interopRequireDefault(require("./tourguide-sync"));
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
const createUpdate = (container, store, options) => _selectMapStateToVNode => {
|
|
16
17
|
const {
|
|
@@ -29,6 +30,7 @@ const create = options => {
|
|
|
29
30
|
container
|
|
30
31
|
} = options;
|
|
31
32
|
const store = (0, _store.default)(options);
|
|
33
|
+
const unsubscribeTourguideSync = (0, _tourguideSync.default)(options, store);
|
|
32
34
|
let update = createUpdate(container, store, options)(_mapStateToProps.selectMapStateToVNode);
|
|
33
35
|
let unsubscribe = store.subscribe(update);
|
|
34
36
|
|
|
@@ -51,6 +53,7 @@ const create = options => {
|
|
|
51
53
|
selectProgression: id => dispatch((0, _playerStore.selectProgression)(id)),
|
|
52
54
|
unsubscribe: () => {
|
|
53
55
|
(0, _reactDom.unmountComponentAtNode)(container);
|
|
56
|
+
unsubscribeTourguideSync();
|
|
54
57
|
return unsubscribe();
|
|
55
58
|
}
|
|
56
59
|
};
|