@coorpacademy/components 11.10.0 → 11.10.1

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.
@@ -42,11 +42,6 @@
42
42
  margin: 0 8px;
43
43
  }
44
44
 
45
- .video {
46
- width: 100%;
47
- min-width: 100vw;
48
- height: 56.25vw;
49
- }
50
45
  }
51
46
 
52
47
  @media tablet {
@@ -55,4 +50,10 @@
55
50
  height: 300px;
56
51
  width: 100%;
57
52
  }
53
+
54
+ .video {
55
+ max-width: 80vw;
56
+ height: auto;
57
+ }
58
+
58
59
  }
@@ -1,3 +1,4 @@
1
+ import { Config } from 'react-native-jw-media-player';
1
2
  import { ChoiceItem } from '../../atom/select-modal/index.native';
2
3
  declare type Url = string;
3
4
  declare type VideoMimeType = 'application/kontiki' | 'application/jwplayer' | 'application/youtube' | 'application/omniPlayer' | 'application/vimeo';
@@ -14,7 +15,31 @@ export declare type Media = {
14
15
  description?: string;
15
16
  loading?: boolean;
16
17
  mimeType?: ResourceMimeType;
18
+ mediaRef?: string;
17
19
  _id?: string;
20
+ jwpOptions?: {
21
+ config?: Config;
22
+ playlist?: Array<{
23
+ file: string;
24
+ tracks: [{
25
+ file: string;
26
+ kind: 'thumbnails';
27
+ }];
28
+ }>;
29
+ playerId?: string;
30
+ playerScript?: string;
31
+ licenseKey?: string;
32
+ customProps?: {
33
+ playbackRateControls: boolean;
34
+ playbackRates: number[];
35
+ preload: 'auto';
36
+ autostart: 'true' | 'false';
37
+ width: string;
38
+ height: string;
39
+ visualplaylist: boolean;
40
+ nextUpDisplay: boolean;
41
+ };
42
+ };
18
43
  mediaUrl?: Url;
19
44
  url?: Url;
20
45
  subtitles?: Array<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/questions/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,sCAAsC,CAAC;AAEhE,aAAK,GAAG,GAAG,MAAM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ACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC1B,CAAC;AAEF,oBAAY,MAAM,GAAG,UAAU,GAAG,gBAAgB,GAAG,qBAAqB,GAAG,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/molecule/questions/types.ts"],"sourcesContent":["import {ChoiceItem} from '../../atom/select-modal/index.native';\n\ntype Url = string;\n\ntype VideoMimeType =\n | 'application/kontiki'\n | 'application/jwplayer'\n | 'application/youtube'\n | 'application/omniPlayer'\n | 'application/vimeo';\n\ntype ResourceMimeType =\n | 'video/mp4'\n | 'audio/acc'\n | 'image/jpeg'\n | 'image/png'\n | 'application/pdf'\n | VideoMimeType;\n\nexport type Source = {\n _id?: string;\n mimeType?: ResourceMimeType;\n url: Url;\n videoId?: string;\n};\n\nexport type MediaType = 'img' | 'audio' | 'video' | 'pdf';\n\nexport type Media = {\n type?: MediaType;\n description?: string;\n loading?: boolean;\n mimeType?: ResourceMimeType;\n _id?: string;\n mediaUrl?: Url;\n url?: Url;\n subtitles?: Array<string>;\n posters?: Array<Url>;\n src?: Array<Source>;\n poster?: string;\n videoId?: string;\n onClick?: () => void;\n onPlay?: () => void;\n onPause?: () => void;\n onResume?: () => void;\n onEnded?: () => void;\n};\n\nexport type QuestionType = 'qcm' | 'qcmGraphic' | 'slider' | 'qcmDrag' | 'basic' | 'template';\n\ntype ChoiceBase = {\n _id: string;\n value?: string;\n name?: string;\n label?: string;\n};\n\nexport type SelectableChoice = {\n _id: string;\n label: string;\n selected: boolean;\n onPress: (value?: string) => void;\n media?: Media;\n};\n\nexport type TemplateTextChoice = {\n type: 'text';\n _id: string;\n name: string;\n value: string;\n label: string;\n selected: boolean;\n};\n\nexport type TemplateListOfChoices = {\n type: 'select';\n _id: string;\n name: string;\n value: string;\n label: string;\n items: Array<ChoiceItem>;\n};\n\nexport type Choice = ChoiceBase | SelectableChoice | TemplateListOfChoices | TemplateTextChoice;\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/molecule/questions/types.ts"],"sourcesContent":["import {Config} from 'react-native-jw-media-player';\nimport {ChoiceItem} from '../../atom/select-modal/index.native';\n\ntype Url = string;\n\ntype VideoMimeType =\n | 'application/kontiki'\n | 'application/jwplayer'\n | 'application/youtube'\n | 'application/omniPlayer'\n | 'application/vimeo';\n\ntype ResourceMimeType =\n | 'video/mp4'\n | 'audio/acc'\n | 'image/jpeg'\n | 'image/png'\n | 'application/pdf'\n | VideoMimeType;\n\nexport type Source = {\n _id?: string;\n mimeType?: ResourceMimeType;\n url: Url;\n videoId?: string;\n};\n\nexport type MediaType = 'img' | 'audio' | 'video' | 'pdf';\n\nexport type Media = {\n type?: MediaType;\n description?: string;\n loading?: boolean;\n mimeType?: ResourceMimeType;\n mediaRef?: string;\n _id?: string;\n jwpOptions?: {\n // --- native JWPlayer\n config?: Config;\n // --- web JWPlayer\n playlist?: Array<{\n file: string;\n tracks: [{file: string; kind: 'thumbnails'}];\n }>;\n playerId?: string;\n playerScript?: string;\n licenseKey?: string;\n customProps?: {\n playbackRateControls: boolean;\n playbackRates: number[];\n preload: 'auto';\n autostart: 'true' | 'false';\n width: string;\n height: string;\n visualplaylist: boolean;\n nextUpDisplay: boolean;\n };\n };\n mediaUrl?: Url;\n url?: Url;\n subtitles?: Array<string>;\n posters?: Array<Url>;\n src?: Array<Source>;\n poster?: string;\n videoId?: string;\n onClick?: () => void;\n onPlay?: () => void;\n onPause?: () => void;\n onResume?: () => void;\n onEnded?: () => void;\n};\n\nexport type QuestionType = 'qcm' | 'qcmGraphic' | 'slider' | 'qcmDrag' | 'basic' | 'template';\n\ntype ChoiceBase = {\n _id: string;\n value?: string;\n name?: string;\n label?: string;\n};\n\nexport type SelectableChoice = {\n _id: string;\n label: string;\n selected: boolean;\n onPress: (value?: string) => void;\n media?: Media;\n};\n\nexport type TemplateTextChoice = {\n type: 'text';\n _id: string;\n name: string;\n value: string;\n label: string;\n selected: boolean;\n};\n\nexport type TemplateListOfChoices = {\n type: 'select';\n _id: string;\n name: string;\n value: string;\n label: string;\n items: Array<ChoiceItem>;\n};\n\nexport type Choice = ChoiceBase | SelectableChoice | TemplateListOfChoices | TemplateTextChoice;\n"],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Media } from '../questions/types';
3
+ export declare type Props = {
4
+ media: Media;
5
+ };
6
+ declare const Video: ({ media }: Props) => JSX.Element;
7
+ export default Video;
8
+ //# sourceMappingURL=index.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/molecule/video-player-mobile/index.native.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,oBAAY,KAAK,GAAG;IAAC,KAAK,EAAE,KAAK,CAAA;CAAC,CAAC;AA0BnC,QAAA,MAAM,KAAK,cAAa,KAAK,gBAE5B,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { StyleSheet, Text, View } from 'react-native';
3
+ import JWPlayer from 'react-native-jw-media-player';
4
+ const styleSheet = StyleSheet.create({
5
+ container: {
6
+ flex: 1,
7
+ width: '100%'
8
+ },
9
+ video: {
10
+ flex: 1,
11
+ width: '100%'
12
+ }
13
+ });
14
+
15
+ const VideoSwitch = ({
16
+ media
17
+ }) => {
18
+ switch (media.mimeType) {
19
+ case 'application/jwplayer':
20
+ if (!media.jwpOptions?.config) {
21
+ return null;
22
+ }
23
+
24
+ return /*#__PURE__*/React.createElement(JWPlayer, {
25
+ style: styleSheet.video,
26
+ config: media.jwpOptions.config
27
+ });
28
+
29
+ default:
30
+ return /*#__PURE__*/React.createElement(Text, null, `video mimeType ${media.mimeType} is not handled`);
31
+ }
32
+ };
33
+
34
+ const Video = ({
35
+ media
36
+ }) => {
37
+ return /*#__PURE__*/React.createElement(View, {
38
+ style: styleSheet.container
39
+ }, media ? /*#__PURE__*/React.createElement(VideoSwitch, {
40
+ media: media
41
+ }) : null);
42
+ };
43
+
44
+ export default Video;
45
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.js","names":["React","StyleSheet","Text","View","JWPlayer","styleSheet","create","container","flex","width","video","VideoSwitch","media","mimeType","jwpOptions","config","Video"],"sources":["../../../src/molecule/video-player-mobile/index.native.tsx"],"sourcesContent":["import React from 'react';\nimport {StyleSheet, Text, View} from 'react-native';\nimport JWPlayer from 'react-native-jw-media-player';\n\nimport {Media} from '../questions/types';\n\nexport type Props = {media: Media};\n\nconst styleSheet = StyleSheet.create({\n container: {\n flex: 1,\n width: '100%'\n },\n video: {\n flex: 1,\n width: '100%'\n }\n});\n\nconst VideoSwitch = ({media}: Props) => {\n switch (media.mimeType) {\n case 'application/jwplayer':\n if (!media.jwpOptions?.config) {\n return null;\n }\n\n return <JWPlayer style={styleSheet.video} config={media.jwpOptions.config} />;\n default:\n return <Text>{`video mimeType ${media.mimeType} is not handled`}</Text>;\n }\n};\n\nconst Video = ({media}: Props) => {\n return <View style={styleSheet.container}>{media ? <VideoSwitch media={media} /> : null}</View>;\n};\n\nexport default Video;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAQC,UAAR,EAAoBC,IAApB,EAA0BC,IAA1B,QAAqC,cAArC;AACA,OAAOC,QAAP,MAAqB,8BAArB;AAMA,MAAMC,UAAU,GAAGJ,UAAU,CAACK,MAAX,CAAkB;EACnCC,SAAS,EAAE;IACTC,IAAI,EAAE,CADG;IAETC,KAAK,EAAE;EAFE,CADwB;EAKnCC,KAAK,EAAE;IACLF,IAAI,EAAE,CADD;IAELC,KAAK,EAAE;EAFF;AAL4B,CAAlB,CAAnB;;AAWA,MAAME,WAAW,GAAG,CAAC;EAACC;AAAD,CAAD,KAAoB;EACtC,QAAQA,KAAK,CAACC,QAAd;IACE,KAAK,sBAAL;MACE,IAAI,CAACD,KAAK,CAACE,UAAN,EAAkBC,MAAvB,EAA+B;QAC7B,OAAO,IAAP;MACD;;MAED,oBAAO,oBAAC,QAAD;QAAU,KAAK,EAAEV,UAAU,CAACK,KAA5B;QAAmC,MAAM,EAAEE,KAAK,CAACE,UAAN,CAAiBC;MAA5D,EAAP;;IACF;MACE,oBAAO,oBAAC,IAAD,QAAQ,kBAAiBH,KAAK,CAACC,QAAS,iBAAxC,CAAP;EARJ;AAUD,CAXD;;AAaA,MAAMG,KAAK,GAAG,CAAC;EAACJ;AAAD,CAAD,KAAoB;EAChC,oBAAO,oBAAC,IAAD;IAAM,KAAK,EAAEP,UAAU,CAACE;EAAxB,GAAoCK,KAAK,gBAAG,oBAAC,WAAD;IAAa,KAAK,EAAEA;EAApB,EAAH,GAAmC,IAA5E,CAAP;AACD,CAFD;;AAIA,eAAeI,KAAf"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.native.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAa,gBAAgB,EAAa,MAAM,cAAc,CAAC;AA0KtE,QAAA,MAAM,KAAK,UAAW,gBAAgB,gBA8CrC,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.native.tsx"],"names":[],"mappings":";AAyBA,OAAO,EAAa,gBAAgB,EAAa,MAAM,cAAc,CAAC;AA2MtE,QAAA,MAAM,KAAK,UAAW,gBAAgB,gBA8CrC,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Animated, Easing, ScrollView, StyleSheet, useWindowDimensions, View } from 'react-native';
2
+ import { Animated, Easing, Image, ScrollView, StyleSheet, useWindowDimensions, View } from 'react-native';
3
3
  import get from 'lodash/fp/get';
4
4
  import getOr from 'lodash/fp/getOr';
5
5
  import { useTranslateY } from '@coorpacademy/react-native-animation';
@@ -8,7 +8,23 @@ import Answer from '../../molecule/answer/index.native';
8
8
  import ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';
9
9
  import { useTemplateContext } from '../../template/app-review/template-context';
10
10
  import Button from '../../atom/button/index.native';
11
+ import { TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO } from '../../molecule/answer/prop-types';
12
+ import Video from '../../molecule/video-player-mobile/index.native';
11
13
  const styles = StyleSheet.create({
14
+ mediaContainer: {
15
+ flex: 1,
16
+ alignItems: 'center',
17
+ justifyContent: 'center',
18
+ marginTop: 20,
19
+ width: '100%',
20
+ minHeight: 150,
21
+ borderRadius: 10,
22
+ overflow: 'hidden'
23
+ },
24
+ image: {
25
+ flex: 1,
26
+ width: '100%'
27
+ },
12
28
  correctionPopinWrapper: {
13
29
  position: 'absolute',
14
30
  bottom: 16,
@@ -16,6 +32,32 @@ const styles = StyleSheet.create({
16
32
  }
17
33
  });
18
34
 
35
+ const MediaView = ({
36
+ media
37
+ }) => {
38
+ switch (media.type) {
39
+ case TYPE_VIDEO:
40
+ return /*#__PURE__*/React.createElement(Video, {
41
+ media: media
42
+ });
43
+
44
+ case TYPE_IMAGE:
45
+ {
46
+ const uri = `https://${media.url?.split('//')[1]}`;
47
+ return /*#__PURE__*/React.createElement(Image, {
48
+ style: styles.image,
49
+ source: {
50
+ uri
51
+ }
52
+ });
53
+ }
54
+
55
+ case TYPE_AUDIO:
56
+ default:
57
+ return /*#__PURE__*/React.createElement(Text, null, `media type ${media.type} is not handled`);
58
+ }
59
+ };
60
+
19
61
  const CorrectionPopin = ({
20
62
  correctionPopinProps,
21
63
  slideIndex,
@@ -116,7 +158,11 @@ const Question = props => {
116
158
  style: style.questionText
117
159
  }, questionText), /*#__PURE__*/React.createElement(Text, {
118
160
  style: style.questionHelp
119
- }, get('help', answerUI))), /*#__PURE__*/React.createElement(ScrollView, {
161
+ }, get('help', answerUI))), answerUI.media ? /*#__PURE__*/React.createElement(View, {
162
+ style: styles.mediaContainer
163
+ }, /*#__PURE__*/React.createElement(MediaView, {
164
+ media: answerUI.media
165
+ })) : null, /*#__PURE__*/React.createElement(ScrollView, {
120
166
  style: style.choicesScrollView,
121
167
  contentContainerStyle: style.choicesScrollContent,
122
168
  centerContent: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["React","useEffect","useState","Animated","Easing","ScrollView","StyleSheet","useWindowDimensions","View","get","getOr","useTranslateY","Text","Answer","ReviewCorrectionPopin","useTemplateContext","Button","styles","create","correctionPopinWrapper","position","bottom","width","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","fromValue","toValue","duration","easing","bezier","start","klf","undefined","information","label","message","next","onClick","_correctionPopinProps","type","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","justifyContent","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","marginTop","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","marginVertical","choicesScrollContent","padding","Question","props","answerUI","setStyle","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","alignItems","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","borderRadius","Slide","validateButton","slideStyle","loading","parentContentTitle","handleValidatePress","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {\n Animated,\n Easing,\n ScrollView,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 500,\n toValue: 0,\n duration: 500,\n easing: Easing.bezier(0.34, 1.36, 0.64, 1)\n });\n\n // the translation is required only once on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesScrollView: ViewStyle;\n choicesScrollContent: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesScrollView: {\n marginVertical: 20,\n width: '100%'\n },\n choicesScrollContent: {\n padding: 10\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={style.choicesScrollContent}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n <Answer {...answerUI} />\n </ScrollView>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {animatedStyle, slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <View style={slideStyle.slide} />;\n }\n\n const {onClick: handleValidatePress} = validateButton;\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <Button\n disabled={validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,QAA1B,QAAyC,OAAzC;AACA,SACEC,QADF,EAEEC,MAFF,EAGEC,UAHF,EAIEC,UAJF,EAMEC,mBANF,EAOEC,IAPF,QASO,cATP;AAUA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,SAAQC,aAAR,QAA4B,sCAA5B;AACA,OAAOC,IAAP,MAAiB,8BAAjB;AACA,OAAOC,MAAP,MAAmB,oCAAnB;AACA,OAAOC,qBAAP,MAAkC,qDAAlC;AACA,SAAQC,kBAAR,QAAiC,4C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AACb;IAAxB,EAAP;EACD;;EAED,MAAM;IAACzC,OAAO,EAAEyD;EAAV,IAAiCJ,cAAvC;EAEA,oBACE,oBAAC,QAAD,CAAU,IAAV;IAAe,KAAK,EAAE,CAACC,UAAU,CAACb,KAAZ,EAAmBpC,aAAnB;EAAtB,gBACE,oBAAC,QAAD;IACE,cAAc,EAAEmD,kBADlB;IAEE,YAAY,EAAEjC,YAFhB;IAGE,QAAQ,EAAEW,QAHZ;IAIE,GAAG,EAAC;EAJN,EADF,eAOE,oBAAC,MAAD;IACE,QAAQ,EAAEmB,cAAc,CAACK,QAD3B;IAEE,WAAW,EAAEL,cAAc,CAACxD,KAF9B;IAGE,OAAO,EAAE4D,mBAHX;IAIE,MAAM,EAAG,yBAAwBzE,UAAW;EAJ9C,EAPF,EAaGD,oBAAoB,gBACnB,oBAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IArBN,CADF;AAyBD,CA9CD;;AAgDA,eAAekE,KAAf"}
1
+ {"version":3,"file":"index.native.js","names":["React","useEffect","useState","Animated","Easing","Image","ScrollView","StyleSheet","useWindowDimensions","View","get","getOr","useTranslateY","Text","Answer","ReviewCorrectionPopin","useTemplateContext","Button","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","Video","styles","create","mediaContainer","flex","alignItems","justifyContent","marginTop","width","minHeight","borderRadius","overflow","image","correctionPopinWrapper","position","bottom","MediaView","media","type","uri","url","split","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","fromValue","toValue","duration","easing","bezier","start","klf","undefined","information","label","message","next","onClick","_correctionPopinProps","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","marginVertical","choicesScrollContent","padding","Question","props","answerUI","setStyle","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","validateButton","slideStyle","loading","parentContentTitle","handleValidatePress","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\n\nimport {\n Animated,\n Easing,\n Image,\n ScrollView,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from '../../molecule/answer/prop-types';\nimport Video from '../../molecule/video-player-mobile/index.native';\nimport {Media} from '../../molecule/questions/types';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n mediaContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n marginTop: 20,\n width: '100%',\n minHeight: 150,\n borderRadius: 10,\n overflow: 'hidden'\n },\n image: {\n flex: 1,\n width: '100%'\n },\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst MediaView = ({media}: {media: Media}) => {\n switch (media.type) {\n case TYPE_VIDEO:\n return <Video media={media} />;\n case TYPE_IMAGE: {\n const uri = `https://${media.url?.split('//')[1]}`;\n return <Image style={styles.image} source={{uri}} />;\n }\n case TYPE_AUDIO:\n default:\n return <Text>{`media type ${media.type} is not handled`}</Text>;\n }\n};\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 500,\n toValue: 0,\n duration: 500,\n easing: Easing.bezier(0.34, 1.36, 0.64, 1)\n });\n\n // the translation is required only once on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesScrollView: ViewStyle;\n choicesScrollContent: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesScrollView: {\n marginVertical: 20,\n width: '100%'\n },\n choicesScrollContent: {\n padding: 10\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n {answerUI.media ? (\n <View style={styles.mediaContainer}>\n <MediaView media={answerUI.media} />\n </View>\n ) : null}\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={style.choicesScrollContent}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n <Answer {...answerUI} />\n </ScrollView>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {animatedStyle, slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <View style={slideStyle.slide} />;\n }\n\n const {onClick: handleValidatePress} = validateButton;\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <Button\n disabled={validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,QAA1B,QAAyC,OAAzC;AAEA,SACEC,QADF,EAEEC,MAFF,EAGEC,KAHF,EAIEC,UAJF,EAKEC,UALF,EAOEC,mBAPF,EAQEC,IARF,QAUO,cAVP;AAWA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,SAAQC,aAAR,QAA4B,sCAA5B;AACA,OAAOC,IAAP,MAAiB,8BAAjB;AACA,OAAOC,MAAP,MAAmB,oCAAnB;AACA,OAAOC,qBAAP,MAAkC,qDAAlC;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;AAEA,OAAOC,MAAP,MAAmB,gCAAnB;AACA,SAAQC,UAAR,EAAoBC,UAApB,EAAgCC,UAAhC,QAAiD,kCAAjD;AACA,OAAOC,KAAP,MAAkB,iDAAlB;AAIA,MAAMC,MAAM,GAAGf,UAAU,CAACgB,MAAX,CAAkB;EAC/BC,cAAc,EAAE;IACdC,IAAI,EAAE,CADQ;IAEdC,UAAU,EAAE,QAFE;IAGdC,cAAc,EAAE,QAHF;IAIdC,SAAS,EAAE,EAJG;IAKdC,K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X;IAIE,MAAM,EAAG,yBAAwBpE,UAAW;EAJ9C,EAPF,EAaGD,oBAAoB,gBACnB,oBAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IArBN,CADF;AAyBD,CA9CD;;AAgDA,eAAe6D,KAAf"}
@@ -42,11 +42,6 @@
42
42
  margin: 0 8px;
43
43
  }
44
44
 
45
- .video {
46
- width: 100%;
47
- min-width: 100vw;
48
- height: 56.25vw;
49
- }
50
45
  }
51
46
 
52
47
  @media tablet {
@@ -55,4 +50,10 @@
55
50
  height: 300px;
56
51
  width: 100%;
57
52
  }
53
+
54
+ .video {
55
+ max-width: 80vw;
56
+ height: auto;
57
+ }
58
+
58
59
  }
@@ -1,3 +1,4 @@
1
+ import { Config } from 'react-native-jw-media-player';
1
2
  import { ChoiceItem } from '../../atom/select-modal/index.native';
2
3
  declare type Url = string;
3
4
  declare type VideoMimeType = 'application/kontiki' | 'application/jwplayer' | 'application/youtube' | 'application/omniPlayer' | 'application/vimeo';
@@ -14,7 +15,31 @@ export declare type Media = {
14
15
  description?: string;
15
16
  loading?: boolean;
16
17
  mimeType?: ResourceMimeType;
18
+ mediaRef?: string;
17
19
  _id?: string;
20
+ jwpOptions?: {
21
+ config?: Config;
22
+ playlist?: Array<{
23
+ file: string;
24
+ tracks: [{
25
+ file: string;
26
+ kind: 'thumbnails';
27
+ }];
28
+ }>;
29
+ playerId?: string;
30
+ playerScript?: string;
31
+ licenseKey?: string;
32
+ customProps?: {
33
+ playbackRateControls: boolean;
34
+ playbackRates: number[];
35
+ preload: 'auto';
36
+ autostart: 'true' | 'false';
37
+ width: string;
38
+ height: string;
39
+ visualplaylist: boolean;
40
+ nextUpDisplay: boolean;
41
+ };
42
+ };
18
43
  mediaUrl?: Url;
19
44
  url?: Url;
20
45
  subtitles?: Array<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/questions/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,sCAAsC,CAAC;AAEhE,aAAK,GAAG,GAAG,MAAM,CAAC;AAElB,aAAK,aAAa,GACd,qBAAqB,GACrB,sBAAsB,GACtB,qBAAqB,GACrB,wBAAwB,GACxB,mBAAmB,CAAC;AAExB,aAAK,gBAAgB,GACjB,WAAW,GACX,WAAW,GACX,YAAY,GACZ,WAAW,GACX,iBAAiB,GACjB,aAAa,CAAC;AAElB,oBAAY,MAAM,GAAG;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oBAAY,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1D,oBAAY,KAAK,GAAG;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACrB,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAC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AAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC1B,CAAC;AAEF,oBAAY,MAAM,GAAG,UAAU,GAAG,gBAAgB,GAAG,qBAAqB,GAAG,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/molecule/questions/types.ts"],"sourcesContent":["import {ChoiceItem} from '../../atom/select-modal/index.native';\n\ntype Url = string;\n\ntype VideoMimeType =\n | 'application/kontiki'\n | 'application/jwplayer'\n | 'application/youtube'\n | 'application/omniPlayer'\n | 'application/vimeo';\n\ntype ResourceMimeType =\n | 'video/mp4'\n | 'audio/acc'\n | 'image/jpeg'\n | 'image/png'\n | 'application/pdf'\n | VideoMimeType;\n\nexport type Source = {\n _id?: string;\n mimeType?: ResourceMimeType;\n url: Url;\n videoId?: string;\n};\n\nexport type MediaType = 'img' | 'audio' | 'video' | 'pdf';\n\nexport type Media = {\n type?: MediaType;\n description?: string;\n loading?: boolean;\n mimeType?: ResourceMimeType;\n _id?: string;\n mediaUrl?: Url;\n url?: Url;\n subtitles?: Array<string>;\n posters?: Array<Url>;\n src?: Array<Source>;\n poster?: string;\n videoId?: string;\n onClick?: () => void;\n onPlay?: () => void;\n onPause?: () => void;\n onResume?: () => void;\n onEnded?: () => void;\n};\n\nexport type QuestionType = 'qcm' | 'qcmGraphic' | 'slider' | 'qcmDrag' | 'basic' | 'template';\n\ntype ChoiceBase = {\n _id: string;\n value?: string;\n name?: string;\n label?: string;\n};\n\nexport type SelectableChoice = {\n _id: string;\n label: string;\n selected: boolean;\n onPress: (value?: string) => void;\n media?: Media;\n};\n\nexport type TemplateTextChoice = {\n type: 'text';\n _id: string;\n name: string;\n value: string;\n label: string;\n selected: boolean;\n};\n\nexport type TemplateListOfChoices = {\n type: 'select';\n _id: string;\n name: string;\n value: string;\n label: string;\n items: Array<ChoiceItem>;\n};\n\nexport type Choice = ChoiceBase | SelectableChoice | TemplateListOfChoices | TemplateTextChoice;\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/molecule/questions/types.ts"],"sourcesContent":["import {Config} from 'react-native-jw-media-player';\nimport {ChoiceItem} from '../../atom/select-modal/index.native';\n\ntype Url = string;\n\ntype VideoMimeType =\n | 'application/kontiki'\n | 'application/jwplayer'\n | 'application/youtube'\n | 'application/omniPlayer'\n | 'application/vimeo';\n\ntype ResourceMimeType =\n | 'video/mp4'\n | 'audio/acc'\n | 'image/jpeg'\n | 'image/png'\n | 'application/pdf'\n | VideoMimeType;\n\nexport type Source = {\n _id?: string;\n mimeType?: ResourceMimeType;\n url: Url;\n videoId?: string;\n};\n\nexport type MediaType = 'img' | 'audio' | 'video' | 'pdf';\n\nexport type Media = {\n type?: MediaType;\n description?: string;\n loading?: boolean;\n mimeType?: ResourceMimeType;\n mediaRef?: string;\n _id?: string;\n jwpOptions?: {\n // --- native JWPlayer\n config?: Config;\n // --- web JWPlayer\n playlist?: Array<{\n file: string;\n tracks: [{file: string; kind: 'thumbnails'}];\n }>;\n playerId?: string;\n playerScript?: string;\n licenseKey?: string;\n customProps?: {\n playbackRateControls: boolean;\n playbackRates: number[];\n preload: 'auto';\n autostart: 'true' | 'false';\n width: string;\n height: string;\n visualplaylist: boolean;\n nextUpDisplay: boolean;\n };\n };\n mediaUrl?: Url;\n url?: Url;\n subtitles?: Array<string>;\n posters?: Array<Url>;\n src?: Array<Source>;\n poster?: string;\n videoId?: string;\n onClick?: () => void;\n onPlay?: () => void;\n onPause?: () => void;\n onResume?: () => void;\n onEnded?: () => void;\n};\n\nexport type QuestionType = 'qcm' | 'qcmGraphic' | 'slider' | 'qcmDrag' | 'basic' | 'template';\n\ntype ChoiceBase = {\n _id: string;\n value?: string;\n name?: string;\n label?: string;\n};\n\nexport type SelectableChoice = {\n _id: string;\n label: string;\n selected: boolean;\n onPress: (value?: string) => void;\n media?: Media;\n};\n\nexport type TemplateTextChoice = {\n type: 'text';\n _id: string;\n name: string;\n value: string;\n label: string;\n selected: boolean;\n};\n\nexport type TemplateListOfChoices = {\n type: 'select';\n _id: string;\n name: string;\n value: string;\n label: string;\n items: Array<ChoiceItem>;\n};\n\nexport type Choice = ChoiceBase | SelectableChoice | TemplateListOfChoices | TemplateTextChoice;\n"],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Media } from '../questions/types';
3
+ export declare type Props = {
4
+ media: Media;
5
+ };
6
+ declare const Video: ({ media }: Props) => JSX.Element;
7
+ export default Video;
8
+ //# sourceMappingURL=index.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/molecule/video-player-mobile/index.native.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,oBAAY,KAAK,GAAG;IAAC,KAAK,EAAE,KAAK,CAAA;CAAC,CAAC;AA0BnC,QAAA,MAAM,KAAK,cAAa,KAAK,gBAE5B,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _react = _interopRequireDefault(require("react"));
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ var _reactNativeJwMediaPlayer = _interopRequireDefault(require("react-native-jw-media-player"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const styleSheet = _reactNative.StyleSheet.create({
15
+ container: {
16
+ flex: 1,
17
+ width: '100%'
18
+ },
19
+ video: {
20
+ flex: 1,
21
+ width: '100%'
22
+ }
23
+ });
24
+
25
+ const VideoSwitch = ({
26
+ media
27
+ }) => {
28
+ switch (media.mimeType) {
29
+ case 'application/jwplayer':
30
+ if (!media.jwpOptions?.config) {
31
+ return null;
32
+ }
33
+
34
+ return /*#__PURE__*/_react.default.createElement(_reactNativeJwMediaPlayer.default, {
35
+ style: styleSheet.video,
36
+ config: media.jwpOptions.config
37
+ });
38
+
39
+ default:
40
+ return /*#__PURE__*/_react.default.createElement(_reactNative.Text, null, `video mimeType ${media.mimeType} is not handled`);
41
+ }
42
+ };
43
+
44
+ const Video = ({
45
+ media
46
+ }) => {
47
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
48
+ style: styleSheet.container
49
+ }, media ? /*#__PURE__*/_react.default.createElement(VideoSwitch, {
50
+ media: media
51
+ }) : null);
52
+ };
53
+
54
+ var _default = Video;
55
+ exports.default = _default;
56
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.js","names":["styleSheet","StyleSheet","create","container","flex","width","video","VideoSwitch","media","mimeType","jwpOptions","config","Video"],"sources":["../../../src/molecule/video-player-mobile/index.native.tsx"],"sourcesContent":["import React from 'react';\nimport {StyleSheet, Text, View} from 'react-native';\nimport JWPlayer from 'react-native-jw-media-player';\n\nimport {Media} from '../questions/types';\n\nexport type Props = {media: Media};\n\nconst styleSheet = StyleSheet.create({\n container: {\n flex: 1,\n width: '100%'\n },\n video: {\n flex: 1,\n width: '100%'\n }\n});\n\nconst VideoSwitch = ({media}: Props) => {\n switch (media.mimeType) {\n case 'application/jwplayer':\n if (!media.jwpOptions?.config) {\n return null;\n }\n\n return <JWPlayer style={styleSheet.video} config={media.jwpOptions.config} />;\n default:\n return <Text>{`video mimeType ${media.mimeType} is not handled`}</Text>;\n }\n};\n\nconst Video = ({media}: Props) => {\n return <View style={styleSheet.container}>{media ? <VideoSwitch media={media} /> : null}</View>;\n};\n\nexport default Video;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;;;AAMA,MAAMA,UAAU,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EACnCC,SAAS,EAAE;IACTC,IAAI,EAAE,CADG;IAETC,KAAK,EAAE;EAFE,CADwB;EAKnCC,KAAK,EAAE;IACLF,IAAI,EAAE,CADD;IAELC,KAAK,EAAE;EAFF;AAL4B,CAAlB,CAAnB;;AAWA,MAAME,WAAW,GAAG,CAAC;EAACC;AAAD,CAAD,KAAoB;EACtC,QAAQA,KAAK,CAACC,QAAd;IACE,KAAK,sBAAL;MACE,IAAI,CAACD,KAAK,CAACE,UAAN,EAAkBC,MAAvB,EAA+B;QAC7B,OAAO,IAAP;MACD;;MAED,oBAAO,6BAAC,iCAAD;QAAU,KAAK,EAAEX,UAAU,CAACM,KAA5B;QAAmC,MAAM,EAAEE,KAAK,CAACE,UAAN,CAAiBC;MAA5D,EAAP;;IACF;MACE,oBAAO,6BAAC,iBAAD,QAAQ,kBAAiBH,KAAK,CAACC,QAAS,iBAAxC,CAAP;EARJ;AAUD,CAXD;;AAaA,MAAMG,KAAK,GAAG,CAAC;EAACJ;AAAD,CAAD,KAAoB;EAChC,oBAAO,6BAAC,iBAAD;IAAM,KAAK,EAAER,UAAU,CAACG;EAAxB,GAAoCK,KAAK,gBAAG,6BAAC,WAAD;IAAa,KAAK,EAAEA;EAApB,EAAH,GAAmC,IAA5E,CAAP;AACD,CAFD;;eAIeI,K"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.native.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAa,gBAAgB,EAAa,MAAM,cAAc,CAAC;AA0KtE,QAAA,MAAM,KAAK,UAAW,gBAAgB,gBA8CrC,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.native.tsx"],"names":[],"mappings":";AAyBA,OAAO,EAAa,gBAAgB,EAAa,MAAM,cAAc,CAAC;AA2MtE,QAAA,MAAM,KAAK,UAAW,gBAAgB,gBA8CrC,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -23,6 +23,10 @@ var _templateContext = require("../../template/app-review/template-context");
23
23
 
24
24
  var _index4 = _interopRequireDefault(require("../../atom/button/index.native"));
25
25
 
26
+ var _propTypes = require("../../molecule/answer/prop-types");
27
+
28
+ var _index5 = _interopRequireDefault(require("../../molecule/video-player-mobile/index.native"));
29
+
26
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
31
 
28
32
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -30,6 +34,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
30
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
35
 
32
36
  const styles = _reactNative.StyleSheet.create({
37
+ mediaContainer: {
38
+ flex: 1,
39
+ alignItems: 'center',
40
+ justifyContent: 'center',
41
+ marginTop: 20,
42
+ width: '100%',
43
+ minHeight: 150,
44
+ borderRadius: 10,
45
+ overflow: 'hidden'
46
+ },
47
+ image: {
48
+ flex: 1,
49
+ width: '100%'
50
+ },
33
51
  correctionPopinWrapper: {
34
52
  position: 'absolute',
35
53
  bottom: 16,
@@ -37,6 +55,32 @@ const styles = _reactNative.StyleSheet.create({
37
55
  }
38
56
  });
39
57
 
58
+ const MediaView = ({
59
+ media
60
+ }) => {
61
+ switch (media.type) {
62
+ case _propTypes.TYPE_VIDEO:
63
+ return /*#__PURE__*/_react.default.createElement(_index5.default, {
64
+ media: media
65
+ });
66
+
67
+ case _propTypes.TYPE_IMAGE:
68
+ {
69
+ const uri = `https://${media.url?.split('//')[1]}`;
70
+ return /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
71
+ style: styles.image,
72
+ source: {
73
+ uri
74
+ }
75
+ });
76
+ }
77
+
78
+ case _propTypes.TYPE_AUDIO:
79
+ default:
80
+ return /*#__PURE__*/_react.default.createElement(_index.default, null, `media type ${media.type} is not handled`);
81
+ }
82
+ };
83
+
40
84
  const CorrectionPopin = ({
41
85
  correctionPopinProps,
42
86
  slideIndex,
@@ -137,7 +181,11 @@ const Question = props => {
137
181
  style: style.questionText
138
182
  }, questionText), /*#__PURE__*/_react.default.createElement(_index.default, {
139
183
  style: style.questionHelp
140
- }, (0, _get.default)('help', answerUI))), /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, {
184
+ }, (0, _get.default)('help', answerUI))), answerUI.media ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
185
+ style: styles.mediaContainer
186
+ }, /*#__PURE__*/_react.default.createElement(MediaView, {
187
+ media: answerUI.media
188
+ })) : null, /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, {
141
189
  style: style.choicesScrollView,
142
190
  contentContainerStyle: style.choicesScrollContent,
143
191
  centerContent: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["styles","StyleSheet","create","correctionPopinWrapper","position","bottom","width","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","useTranslateY","fromValue","toValue","duration","easing","Easing","bezier","useEffect","start","klf","getOr","undefined","information","label","message","next","get","onClick","_correctionPopinProps","type","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","justifyContent","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","marginTop","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","marginVertical","choicesScrollContent","padding","Question","props","answerUI","useTemplateContext","setStyle","useState","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","alignItems","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","borderRadius","Slide","validateButton","useWindowDimensions","slideStyle","loading","parentContentTitle","handleValidatePress","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {\n Animated,\n Easing,\n ScrollView,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 500,\n toValue: 0,\n duration: 500,\n easing: Easing.bezier(0.34, 1.36, 0.64, 1)\n });\n\n // the translation is required only once on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesScrollView: ViewStyle;\n choicesScrollContent: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesScrollView: {\n marginVertical: 20,\n width: '100%'\n },\n choicesScrollContent: {\n padding: 10\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={style.choicesScrollContent}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n <Answer {...answerUI} />\n </ScrollView>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {animatedStyle, slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <View style={slideStyle.slide} />;\n }\n\n const {onClick: handleValidatePress} = validateButton;\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <Button\n disabled={validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":";;;;;AAAA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAGA,MAAMA,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC/BC,sBAAsB,EAAE;IACtBC,QAAQ,EAAE,UADY;IAEtBC,MAAM,EAAE,EAFc;IAGtBC,KAAK,EAAE;EAHe;AADO,CAAlB,CAAf;;AAQA,MAAMC,eAAe,GAAG,CAAC;EACvBC,oBADuB;EAEvBC,UAFuB;EAGvBC,mBAHuB;EAIvBC;AAJuB,CAAD,KAKN;EAChB,MAAMC,WAAW,GAAG,IAAAC,mCAAA,EAAc;IAChCC,SAAS,EAAE,GADqB;IAEhCC,OAAO,EAAE,CAFuB;IAGhCC,QAAQ,EAAE,GAHsB;IAIhCC,MAAM,EAAEC,mBAAA,CAAOC,MAAP,CAAc,IAAd,EAAoB,IAApB,EAA0B,IAA1B,EAAgC,CAAhC;EAJwB,CAAd,CAApB,CADgB,CAQhB;EACA;;EACA,IAAAC,gBAAA,EAAU,MAAMR,WAAW,CAACS,KAAZ,EAAhB,EAAqC,EAArC;EAEA,IAAI,CAACX,mBAAL,EAA0B,OAAO,IAAP;EAE1B,MAAMY,GAAG,GAAG,IAAAC,cAAA,EAAMC,SAAN,EAAiB,KAAjB,EAAwBhB,oBAAxB,CAAZ;E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3,"file":"index.native.js","names":["styles","StyleSheet","create","mediaContainer","flex","alignItems","justifyContent","marginTop","width","minHeight","borderRadius","overflow","image","correctionPopinWrapper","position","bottom","MediaView","media","type","TYPE_VIDEO","TYPE_IMAGE","uri","url","split","TYPE_AUDIO","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","useTranslateY","fromValue","toValue","duration","easing","Easing","bezier","useEffect","start","klf","getOr","undefined","information","label","message","next","get","onClick","_correctionPopinProps","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","marginVertical","choicesScrollContent","padding","Question","props","answerUI","useTemplateContext","setStyle","useState","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","validateButton","useWindowDimensions","slideStyle","loading","parentContentTitle","handleValidatePress","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\n\nimport {\n Animated,\n Easing,\n Image,\n ScrollView,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from '../../molecule/answer/prop-types';\nimport Video from '../../molecule/video-player-mobile/index.native';\nimport {Media} from '../../molecule/questions/types';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n mediaContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n marginTop: 20,\n width: '100%',\n minHeight: 150,\n borderRadius: 10,\n overflow: 'hidden'\n },\n image: {\n flex: 1,\n width: '100%'\n },\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst MediaView = ({media}: {media: Media}) => {\n switch (media.type) {\n case TYPE_VIDEO:\n return <Video media={media} />;\n case TYPE_IMAGE: {\n const uri = `https://${media.url?.split('//')[1]}`;\n return <Image style={styles.image} source={{uri}} />;\n }\n case TYPE_AUDIO:\n default:\n return <Text>{`media type ${media.type} is not handled`}</Text>;\n }\n};\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 500,\n toValue: 0,\n duration: 500,\n easing: Easing.bezier(0.34, 1.36, 0.64, 1)\n });\n\n // the translation is required only once on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesScrollView: ViewStyle;\n choicesScrollContent: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesScrollView: {\n marginVertical: 20,\n width: '100%'\n },\n choicesScrollContent: {\n padding: 10\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n {answerUI.media ? (\n <View style={styles.mediaContainer}>\n <MediaView media={answerUI.media} />\n </View>\n ) : null}\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={style.choicesScrollContent}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n <Answer {...answerUI} />\n </ScrollView>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {animatedStyle, slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <View style={slideStyle.slide} />;\n }\n\n const {onClick: handleValidatePress} = validateButton;\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <Button\n disabled={validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":";;;;;AAAA;;AAEA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;AAIA,MAAMA,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC/BC,cAAc,EAAE;IACdC,IAAI,EAAE,CADQ;IAEdC,UAAU,EAAE,QAFE;IAGdC,cAAc,EAAE,QAHF;IAIdC,SAAS,EAAE,EAJG;IAKdC,KAAK,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,WAAW,EAAEN,cAAc,CAACtD,KAF9B;IAGE,OAAO,EAAE2D,mBAHX;IAIE,MAAM,EAAG,yBAAwB5E,UAAW;EAJ9C,EAPF,EAaGD,oBAAoB,gBACnB,6BAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IArBN,CADF;AAyBD,CA9CD;;eAgDeoE,K"}
@@ -38,6 +38,7 @@
38
38
  "payment_form_submit": "Coorpacademy aboneliğini başlat",
39
39
  "Post": "Postala",
40
40
  "premium_unsubscribe_confirmation": "Önümüzdeki aydan itibaren geçerli olacak abonelik iptalinizi onaylıyoruz.\\n\\nBu arada, Coorpacademy platformundaki içeriğimizden faydalanmaya devam edebilirsiniz.",
41
+ "Press the escape key to close the information text": "Bilgi metnini kapatmak için escape tuşuna basın",
41
42
  "product_cancel": "İstediğiniz zaman iptal edin.",
42
43
  "product_desc_battle": "Mücadele modu",
43
44
  "product_desc_certificates": "Coorpacademy sertifikaları",
@@ -38,6 +38,7 @@
38
38
  "payment_form_submit": "Активувати підписку Coorpacademy",
39
39
  "Post": "Опублікувати",
40
40
  "premium_unsubscribe_confirmation": "Ми підтверджуємо скасування вашої підписки з наступного місяця.\\n\\nТим часом ви можете продовжувати користуватися нашим контентом на платформі Coorpacademy.",
41
+ "Press the escape key to close the information text": "Натисніть клавішу escape, щоб закрити інформаційний текст",
41
42
  "product_cancel": "Можна скасувати у будь-який час.",
42
43
  "product_desc_battle": "Режим бою",
43
44
  "product_desc_certificates": "Сертифікати Coorpacademy",
@@ -38,6 +38,7 @@
38
38
  "payment_form_submit": "Bắt đầu đăng ký Coorpacademy",
39
39
  "Post": "Bài đăng",
40
40
  "premium_unsubscribe_confirmation": "Chúng tôi xác nhận việc hủy đăng ký. Việc hủy đăng ký sẽ có hiệu lực kể từ tháng sau.\\n\\nIn Trong thời gian chờ đợi, bạn có thể tiếp tục tận hưởng nội dung của chúng tôi trên nền tảng Coorpacademy.",
41
+ "Press the escape key to close the information text": "Nhấn phím thoát để đóng văn bản thông tin",
41
42
  "product_cancel": "Hủy bất cứ lúc nào.",
42
43
  "product_desc_battle": "Chế độ chiến đấu",
43
44
  "product_desc_certificates": "Chứng chỉ Coorpacademy",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/components",
3
- "version": "11.10.0",
3
+ "version": "11.10.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -146,6 +146,7 @@
146
146
  "react": "^17.0.2",
147
147
  "react-dom": "^17.0.2",
148
148
  "react-native": "^0.68.2",
149
+ "react-native-jw-media-player": "^0.2.34",
149
150
  "react-native-linear-gradient": "^2.6.2",
150
151
  "react-native-modal": "11.5.6",
151
152
  "react-native-render-html": "^6.3.4",
@@ -161,5 +162,5 @@
161
162
  "last 2 versions",
162
163
  "IE 11"
163
164
  ],
164
- "gitHead": "6ece27388a30f36620cd858a34cc5857b8414f93"
165
+ "gitHead": "bc1f5ec13303d3386ede87aeab585f48b4ca6593"
165
166
  }