@100mslive/react-native-room-kit 1.1.1 → 1.1.2
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/README.md +1 -1
- package/lib/commonjs/HMSRoomSetup.js +3 -5
- package/lib/commonjs/HMSRoomSetup.js.map +1 -1
- package/lib/commonjs/Icons/Check/assets/check-in-circle.png +0 -0
- package/lib/commonjs/Icons/Check/assets/check-in-circle@2x.png +0 -0
- package/lib/commonjs/Icons/Check/assets/check-in-circle@3x.png +0 -0
- package/lib/commonjs/Icons/Check/index.js +2 -1
- package/lib/commonjs/Icons/Check/index.js.map +1 -1
- package/lib/commonjs/Icons/CheckBox/index.js +8 -1
- package/lib/commonjs/Icons/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CreatePoll.js +98 -52
- package/lib/commonjs/components/CreatePoll.js.map +1 -1
- package/lib/commonjs/components/GridView.js +4 -8
- package/lib/commonjs/components/GridView.js.map +1 -1
- package/lib/commonjs/components/HMSPollsQuizzesNotification.js +1 -1
- package/lib/commonjs/components/HMSPollsQuizzesNotification.js.map +1 -1
- package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js +80 -32
- package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js.map +1 -1
- package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js +53 -0
- package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizVoting.js +14 -15
- package/lib/commonjs/components/PollAndQuizVoting.js.map +1 -1
- package/lib/commonjs/components/PollQuestion.js +70 -14
- package/lib/commonjs/components/PollQuestion.js.map +1 -1
- package/lib/commonjs/components/PollQuestions.js +22 -8
- package/lib/commonjs/components/PollQuestions.js.map +1 -1
- package/lib/commonjs/components/PollsAndQuizzesModalContent.js +1 -1
- package/lib/commonjs/components/PollsAndQuizzesModalContent.js.map +1 -1
- package/lib/commonjs/components/PreviousPollsAndQuizzesList.js +2 -2
- package/lib/commonjs/components/PreviousPollsAndQuizzesList.js.map +1 -1
- package/lib/commonjs/components/QuizEndOptionsView.js +63 -0
- package/lib/commonjs/components/QuizEndOptionsView.js.map +1 -0
- package/lib/commonjs/components/RadioInput.js +9 -2
- package/lib/commonjs/components/RadioInput.js.map +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/commonjs/components/TilesContainer.js +3 -4
- package/lib/commonjs/components/TilesContainer.js.map +1 -1
- package/lib/commonjs/hooks-util.js +1 -1
- package/lib/commonjs/hooks-util.js.map +1 -1
- package/lib/commonjs/redux/actionTypes.js +2 -0
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +14 -1
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/polls.js +30 -3
- package/lib/commonjs/redux/reducers/polls.js.map +1 -1
- package/lib/commonjs/utils/functions.js +48 -3
- package/lib/commonjs/utils/functions.js.map +1 -1
- package/lib/module/HMSRoomSetup.js +4 -6
- package/lib/module/HMSRoomSetup.js.map +1 -1
- package/lib/module/Icons/Check/assets/check-in-circle.png +0 -0
- package/lib/module/Icons/Check/assets/check-in-circle@2x.png +0 -0
- package/lib/module/Icons/Check/assets/check-in-circle@3x.png +0 -0
- package/lib/module/Icons/Check/index.js +2 -1
- package/lib/module/Icons/Check/index.js.map +1 -1
- package/lib/module/Icons/CheckBox/index.js +9 -2
- package/lib/module/Icons/CheckBox/index.js.map +1 -1
- package/lib/module/components/CreatePoll.js +99 -54
- package/lib/module/components/CreatePoll.js.map +1 -1
- package/lib/module/components/GridView.js +5 -9
- package/lib/module/components/GridView.js.map +1 -1
- package/lib/module/components/HMSPollsQuizzesNotification.js +1 -1
- package/lib/module/components/HMSPollsQuizzesNotification.js.map +1 -1
- package/lib/module/components/PollAndQuizQuestionResponseCard.js +81 -33
- package/lib/module/components/PollAndQuizQuestionResponseCard.js.map +1 -1
- package/lib/module/components/PollAndQuizQuestionResponseCards.js +44 -0
- package/lib/module/components/PollAndQuizQuestionResponseCards.js.map +1 -0
- package/lib/module/components/PollAndQuizVoting.js +16 -17
- package/lib/module/components/PollAndQuizVoting.js.map +1 -1
- package/lib/module/components/PollQuestion.js +73 -17
- package/lib/module/components/PollQuestion.js.map +1 -1
- package/lib/module/components/PollQuestions.js +23 -9
- package/lib/module/components/PollQuestions.js.map +1 -1
- package/lib/module/components/PollsAndQuizzesModalContent.js +1 -1
- package/lib/module/components/PollsAndQuizzesModalContent.js.map +1 -1
- package/lib/module/components/PreviousPollsAndQuizzesList.js +2 -2
- package/lib/module/components/PreviousPollsAndQuizzesList.js.map +1 -1
- package/lib/module/components/QuizEndOptionsView.js +54 -0
- package/lib/module/components/QuizEndOptionsView.js.map +1 -0
- package/lib/module/components/RadioInput.js +10 -3
- package/lib/module/components/RadioInput.js.map +1 -1
- package/lib/module/components/RoomSettingsModalContent.js +1 -1
- package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/module/components/TilesContainer.js +5 -6
- package/lib/module/components/TilesContainer.js.map +1 -1
- package/lib/module/hooks-util.js +2 -4
- package/lib/module/hooks-util.js.map +1 -1
- package/lib/module/redux/actionTypes.js +2 -0
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +11 -0
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/polls.js +31 -4
- package/lib/module/redux/reducers/polls.js.map +1 -1
- package/lib/module/utils/functions.js +43 -3
- package/lib/module/utils/functions.js.map +1 -1
- package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
- package/lib/typescript/Icons/Check/index.d.ts +1 -0
- package/lib/typescript/Icons/Check/index.d.ts.map +1 -1
- package/lib/typescript/Icons/CheckBox/index.d.ts +1 -0
- package/lib/typescript/Icons/CheckBox/index.d.ts.map +1 -1
- package/lib/typescript/components/CreatePoll.d.ts.map +1 -1
- package/lib/typescript/components/GridView.d.ts.map +1 -1
- package/lib/typescript/components/PollAndQuizQuestionResponseCard.d.ts.map +1 -1
- package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts +9 -0
- package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizVoting.d.ts.map +1 -1
- package/lib/typescript/components/PollQuestion.d.ts +1 -0
- package/lib/typescript/components/PollQuestion.d.ts.map +1 -1
- package/lib/typescript/components/PollQuestions.d.ts.map +1 -1
- package/lib/typescript/components/QuizEndOptionsView.d.ts +10 -0
- package/lib/typescript/components/QuizEndOptionsView.d.ts.map +1 -0
- package/lib/typescript/components/RadioInput.d.ts +1 -0
- package/lib/typescript/components/RadioInput.d.ts.map +1 -1
- package/lib/typescript/hooks-util.d.ts.map +1 -1
- package/lib/typescript/redux/actionTypes.d.ts +18 -3
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +3 -1
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/polls.d.ts.map +1 -1
- package/lib/typescript/utils/functions.d.ts +6 -2
- package/lib/typescript/utils/functions.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/HMSRoomSetup.tsx +7 -6
- package/src/Icons/Check/assets/check-in-circle.png +0 -0
- package/src/Icons/Check/assets/check-in-circle@2x.png +0 -0
- package/src/Icons/Check/assets/check-in-circle@3x.png +0 -0
- package/src/Icons/Check/index.tsx +9 -2
- package/src/Icons/CheckBox/index.tsx +16 -2
- package/src/components/CreatePoll.tsx +143 -70
- package/src/components/GridView.tsx +4 -14
- package/src/components/HMSPollsQuizzesNotification.tsx +1 -1
- package/src/components/PollAndQuizQuestionResponseCard.tsx +151 -48
- package/src/components/PollAndQuizQuestionResponseCards.tsx +62 -0
- package/src/components/PollAndQuizVoting.tsx +29 -25
- package/src/components/PollQuestion.tsx +140 -25
- package/src/components/PollQuestions.tsx +47 -29
- package/src/components/PollsAndQuizzesModalContent.tsx +1 -1
- package/src/components/PreviousPollsAndQuizzesList.tsx +2 -2
- package/src/components/QuizEndOptionsView.tsx +71 -0
- package/src/components/RadioInput.tsx +14 -2
- package/src/components/RoomSettingsModalContent.tsx +1 -1
- package/src/components/TilesContainer.tsx +4 -4
- package/src/hooks-util.ts +1 -3
- package/src/redux/actionTypes.ts +21 -1
- package/src/redux/actions/index.ts +22 -0
- package/src/redux/reducers/polls.ts +55 -5
- package/src/utils/functions.ts +90 -6
|
@@ -52,6 +52,8 @@ import type {
|
|
|
52
52
|
AddPollQuestionResponseAction,
|
|
53
53
|
SetPollQuestionResponseAction,
|
|
54
54
|
RemovePollQuestionResponseAction,
|
|
55
|
+
SetQuestionPointWeightageAction,
|
|
56
|
+
SetQuestionCorrectOptionAction,
|
|
55
57
|
} from '../actionTypes';
|
|
56
58
|
import { MeetingState } from '../../types';
|
|
57
59
|
import type { ChatState, Notification, PinnedMessage } from '../../types';
|
|
@@ -529,6 +531,15 @@ export const setPollQuestionTitle = (
|
|
|
529
531
|
title,
|
|
530
532
|
});
|
|
531
533
|
|
|
534
|
+
export const setPollQuestionPointWeightage = (
|
|
535
|
+
questionIndex: SetQuestionPointWeightageAction['questionIndex'],
|
|
536
|
+
pointWeightage: SetQuestionPointWeightageAction['pointWeightage']
|
|
537
|
+
): SetQuestionPointWeightageAction => ({
|
|
538
|
+
type: PollsStateActionTypes.SET_POINT_WEIGHTAGE,
|
|
539
|
+
questionIndex,
|
|
540
|
+
pointWeightage,
|
|
541
|
+
});
|
|
542
|
+
|
|
532
543
|
export const addPollQuestionOption = (
|
|
533
544
|
questionIndex: AddQuestionOptionAction['questionIndex']
|
|
534
545
|
): AddQuestionOptionAction => ({
|
|
@@ -556,6 +567,17 @@ export const editPollQuestionOption = (
|
|
|
556
567
|
option,
|
|
557
568
|
});
|
|
558
569
|
|
|
570
|
+
export const setPollQuestionCorrectOption = (
|
|
571
|
+
questionIndex: SetQuestionCorrectOptionAction['questionIndex'],
|
|
572
|
+
optionIndex: SetQuestionCorrectOptionAction['optionIndex'],
|
|
573
|
+
correctOption: SetQuestionCorrectOptionAction['correctOption']
|
|
574
|
+
): SetQuestionCorrectOptionAction => ({
|
|
575
|
+
type: PollsStateActionTypes.SET_QUESTION_CORRECT_OPTION,
|
|
576
|
+
questionIndex,
|
|
577
|
+
optionIndex,
|
|
578
|
+
correctOption,
|
|
579
|
+
});
|
|
580
|
+
|
|
559
581
|
export const setPollQuestionSkippable = (
|
|
560
582
|
questionIndex: SetQuestionSkippable['questionIndex'],
|
|
561
583
|
skippable: boolean
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HMSPollQuestionType } from '@100mslive/react-native-hms';
|
|
1
|
+
import { HMSPollQuestionType, HMSPollType } from '@100mslive/react-native-hms';
|
|
2
2
|
import type { HMSPoll } from '@100mslive/react-native-hms';
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -12,14 +12,18 @@ import type {
|
|
|
12
12
|
PollsActionType,
|
|
13
13
|
} from '../actionTypes';
|
|
14
14
|
|
|
15
|
-
function getDefaultQuestionObj() {
|
|
15
|
+
function getDefaultQuestionObj(): PollQuestionUI {
|
|
16
16
|
return {
|
|
17
17
|
title: '',
|
|
18
18
|
responseEditable: false,
|
|
19
19
|
saved: false,
|
|
20
20
|
skippable: false,
|
|
21
|
+
pointWeightage: '10',
|
|
21
22
|
type: HMSPollQuestionType.singleChoice,
|
|
22
|
-
options: [
|
|
23
|
+
options: [
|
|
24
|
+
[false, ''],
|
|
25
|
+
[false, ''],
|
|
26
|
+
],
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
29
|
|
|
@@ -40,6 +44,7 @@ type IntialStateType = {
|
|
|
40
44
|
const INITIAL_STATE: IntialStateType = {
|
|
41
45
|
pollName: '',
|
|
42
46
|
pollConfig: {
|
|
47
|
+
type: HMSPollType.poll,
|
|
43
48
|
voteCountHidden: false,
|
|
44
49
|
resultsAnonymous: false,
|
|
45
50
|
},
|
|
@@ -76,6 +81,10 @@ const hmsStatesReducer = (
|
|
|
76
81
|
...state.pollConfig,
|
|
77
82
|
...action.pollConfig,
|
|
78
83
|
},
|
|
84
|
+
questions:
|
|
85
|
+
'type' in action.pollConfig
|
|
86
|
+
? state.questions.map((ques) => ({ ...ques, saved: false }))
|
|
87
|
+
: state.questions,
|
|
79
88
|
selectedPollQuestionIndex: null,
|
|
80
89
|
};
|
|
81
90
|
case PollsStateActionTypes.SET_POLL_STAGE:
|
|
@@ -144,6 +153,18 @@ const hmsStatesReducer = (
|
|
|
144
153
|
: question
|
|
145
154
|
),
|
|
146
155
|
};
|
|
156
|
+
case PollsStateActionTypes.SET_POINT_WEIGHTAGE:
|
|
157
|
+
return {
|
|
158
|
+
...state,
|
|
159
|
+
questions: state.questions.map((question, idx) =>
|
|
160
|
+
idx === action.questionIndex
|
|
161
|
+
? {
|
|
162
|
+
...question,
|
|
163
|
+
pointWeightage: action.pointWeightage,
|
|
164
|
+
}
|
|
165
|
+
: question
|
|
166
|
+
),
|
|
167
|
+
};
|
|
147
168
|
case PollsStateActionTypes.ADD_QUESTION_OPTION:
|
|
148
169
|
return {
|
|
149
170
|
...state,
|
|
@@ -151,7 +172,7 @@ const hmsStatesReducer = (
|
|
|
151
172
|
idx === action.questionIndex
|
|
152
173
|
? {
|
|
153
174
|
...question,
|
|
154
|
-
options: [...(question.options || []), ''],
|
|
175
|
+
options: [...(question.options || []), [false, '']],
|
|
155
176
|
}
|
|
156
177
|
: question
|
|
157
178
|
),
|
|
@@ -180,12 +201,41 @@ const hmsStatesReducer = (
|
|
|
180
201
|
options:
|
|
181
202
|
question.options &&
|
|
182
203
|
question.options.map((option, idx) =>
|
|
183
|
-
idx === action.optionIndex
|
|
204
|
+
idx === action.optionIndex
|
|
205
|
+
? [option[0], action.option]
|
|
206
|
+
: option
|
|
184
207
|
),
|
|
185
208
|
}
|
|
186
209
|
: question
|
|
187
210
|
),
|
|
188
211
|
};
|
|
212
|
+
case PollsStateActionTypes.SET_QUESTION_CORRECT_OPTION:
|
|
213
|
+
return {
|
|
214
|
+
...state,
|
|
215
|
+
questions: state.questions.map((question, idx) =>
|
|
216
|
+
idx === action.questionIndex
|
|
217
|
+
? {
|
|
218
|
+
...question,
|
|
219
|
+
options:
|
|
220
|
+
question.options &&
|
|
221
|
+
question.options.map((option, idx) => {
|
|
222
|
+
if (
|
|
223
|
+
action.correctOption === false ||
|
|
224
|
+
question.type === HMSPollQuestionType.multipleChoice
|
|
225
|
+
) {
|
|
226
|
+
return idx === action.optionIndex
|
|
227
|
+
? [action.correctOption, option[1]]
|
|
228
|
+
: option;
|
|
229
|
+
}
|
|
230
|
+
return [
|
|
231
|
+
idx === action.optionIndex ? true : false,
|
|
232
|
+
option[1],
|
|
233
|
+
];
|
|
234
|
+
}),
|
|
235
|
+
}
|
|
236
|
+
: question
|
|
237
|
+
),
|
|
238
|
+
};
|
|
189
239
|
case PollsStateActionTypes.SET_QUESTION_SKIPPABLE:
|
|
190
240
|
return {
|
|
191
241
|
...state,
|
package/src/utils/functions.ts
CHANGED
|
@@ -12,9 +12,15 @@ import {
|
|
|
12
12
|
HMSTrackSource,
|
|
13
13
|
HMSVideoTrack,
|
|
14
14
|
HMSRole,
|
|
15
|
-
|
|
15
|
+
HMSPollQuestionType,
|
|
16
|
+
} from '@100mslive/react-native-hms';
|
|
17
|
+
import type {
|
|
18
|
+
HMSPoll,
|
|
19
|
+
HMSPollQuestionAnswer,
|
|
20
|
+
HMSPollQuestionResponse,
|
|
21
|
+
HMSPollQuestion,
|
|
22
|
+
HMSPollQuestionOption,
|
|
16
23
|
} from '@100mslive/react-native-hms';
|
|
17
|
-
import type { HMSPoll } from '@100mslive/react-native-hms';
|
|
18
24
|
|
|
19
25
|
import type { PeerTrackNode } from './types';
|
|
20
26
|
|
|
@@ -479,9 +485,87 @@ export const visiblePollsSelector = (
|
|
|
479
485
|
isHLSViewer: boolean,
|
|
480
486
|
hlsCuedPollIds: HMSPoll['pollId'][]
|
|
481
487
|
) => {
|
|
482
|
-
return polls.filter(
|
|
483
|
-
(poll)
|
|
484
|
-
poll.type !== HMSPollType.quiz &&
|
|
485
|
-
(isHLSViewer ? hlsCuedPollIds.includes(poll.pollId) : true) // Hiding quizzes from UI
|
|
488
|
+
return polls.filter((poll) =>
|
|
489
|
+
isHLSViewer ? hlsCuedPollIds.includes(poll.pollId) : true
|
|
486
490
|
);
|
|
487
491
|
};
|
|
492
|
+
|
|
493
|
+
export function checkIsSelected(
|
|
494
|
+
pollQuestion: HMSPollQuestion,
|
|
495
|
+
option: HMSPollQuestionOption,
|
|
496
|
+
selectedOptions: number | number[] | null
|
|
497
|
+
) {
|
|
498
|
+
return pollQuestion.myResponses.length > 0
|
|
499
|
+
? pollQuestion.type === HMSPollQuestionType.singleChoice
|
|
500
|
+
? !!pollQuestion.myResponses.find((r) => r.option === option.index)
|
|
501
|
+
: !!pollQuestion.myResponses.find((r) =>
|
|
502
|
+
r.options ? r.options.includes(option.index) : false
|
|
503
|
+
)
|
|
504
|
+
: Array.isArray(selectedOptions)
|
|
505
|
+
? selectedOptions.includes(option.index)
|
|
506
|
+
: selectedOptions === option.index;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export function checkIsCorrectAnswer(
|
|
510
|
+
questionType: HMSPollQuestionType,
|
|
511
|
+
myResponses: HMSPollQuestionResponse[] | undefined,
|
|
512
|
+
answer: HMSPollQuestionAnswer | undefined
|
|
513
|
+
) {
|
|
514
|
+
if (!myResponses || myResponses.length < 0 || !answer) {
|
|
515
|
+
return false;
|
|
516
|
+
}
|
|
517
|
+
const correctAnswer =
|
|
518
|
+
questionType === HMSPollQuestionType.multipleChoice
|
|
519
|
+
? answer.options
|
|
520
|
+
: answer.option;
|
|
521
|
+
|
|
522
|
+
if (correctAnswer === undefined) {
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
if (Array.isArray(correctAnswer)) {
|
|
526
|
+
return myResponses.every(
|
|
527
|
+
(r) =>
|
|
528
|
+
r.options &&
|
|
529
|
+
r.options.length === correctAnswer.length &&
|
|
530
|
+
r.options.every((o) => correctAnswer.includes(o))
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
return myResponses.every((r) => r.option === correctAnswer);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export function checkIsCorrectOption(
|
|
537
|
+
questionType: HMSPollQuestionType,
|
|
538
|
+
option: HMSPollQuestionOption,
|
|
539
|
+
answer: HMSPollQuestionAnswer | undefined
|
|
540
|
+
) {
|
|
541
|
+
if (!answer) {
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
const correctAnswer =
|
|
545
|
+
questionType === HMSPollQuestionType.multipleChoice
|
|
546
|
+
? answer.options
|
|
547
|
+
: answer.option;
|
|
548
|
+
|
|
549
|
+
if (correctAnswer === undefined) {
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
if (Array.isArray(correctAnswer)) {
|
|
553
|
+
return correctAnswer.includes(option.index);
|
|
554
|
+
}
|
|
555
|
+
return option.index === correctAnswer;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export function getLabelFromPollQuestionType(
|
|
559
|
+
type: HMSPollQuestionType
|
|
560
|
+
): string {
|
|
561
|
+
switch (type) {
|
|
562
|
+
case HMSPollQuestionType.singleChoice:
|
|
563
|
+
return 'Single Choice';
|
|
564
|
+
case HMSPollQuestionType.multipleChoice:
|
|
565
|
+
return 'Multiple Choice';
|
|
566
|
+
case HMSPollQuestionType.longAnswer:
|
|
567
|
+
return 'Long Answer';
|
|
568
|
+
case HMSPollQuestionType.shortAnswer:
|
|
569
|
+
return 'Short Answer';
|
|
570
|
+
}
|
|
571
|
+
}
|