@constructor-io/constructorio-ui-quizzes 1.4.4 → 1.4.5
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/dist/constructorio-ui-quizzes-bundled.js +13 -13
- package/lib/cjs/components/CioQuiz/actions.js +1 -0
- package/lib/cjs/components/CioQuiz/index.js +7 -5
- package/lib/cjs/components/CioQuiz/quizLocalReducer.js +9 -6
- package/lib/cjs/components/ResultCard/ResultCard.js +1 -1
- package/lib/cjs/components/ResultContainer/ResultContainer.js +3 -1
- package/lib/cjs/constants.js +4 -0
- package/lib/cjs/hooks/useQuiz.js +2 -1
- package/lib/cjs/hooks/useQuizEvents/index.js +1 -1
- package/lib/cjs/hooks/useQuizEvents/useQuizResetClick.js +3 -4
- package/lib/cjs/hooks/useQuizState/index.js +3 -2
- package/lib/cjs/hooks/useQuizState/useQuizApiState.js +8 -2
- package/lib/cjs/hooks/useQuizState/useQuizLocalState.js +6 -2
- package/lib/cjs/stories/Quiz/tests/mocks.js +1 -0
- package/lib/mjs/components/CioQuiz/actions.js +1 -0
- package/lib/mjs/components/CioQuiz/index.js +7 -5
- package/lib/mjs/components/CioQuiz/quizLocalReducer.js +12 -0
- package/lib/mjs/components/ResultCard/ResultCard.js +1 -1
- package/lib/mjs/components/ResultContainer/ResultContainer.js +3 -1
- package/lib/mjs/constants.js +4 -0
- package/lib/mjs/hooks/useQuiz.js +2 -1
- package/lib/mjs/hooks/useQuizEvents/index.js +1 -1
- package/lib/mjs/hooks/useQuizEvents/useQuizResetClick.js +3 -4
- package/lib/mjs/hooks/useQuizState/index.js +3 -2
- package/lib/mjs/hooks/useQuizState/useQuizApiState.js +8 -2
- package/lib/mjs/hooks/useQuizState/useQuizLocalState.js +5 -2
- package/lib/mjs/stories/Quiz/tests/mocks.js +1 -0
- package/lib/types/components/CioQuiz/actions.d.ts +3 -2
- package/lib/types/components/CioQuiz/quizLocalReducer.d.ts +1 -0
- package/lib/types/constants.d.ts +1 -1
- package/lib/types/hooks/useQuizEvents/useQuizResetClick.d.ts +1 -1
- package/lib/types/hooks/useQuizState/index.d.ts +1 -0
- package/lib/types/hooks/useQuizState/useQuizApiState.d.ts +1 -1
- package/lib/types/hooks/useQuizState/useQuizLocalState.d.ts +3 -1
- package/lib/types/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { ActionAnswerQuestion, ActionQuizAPI } from '../../components/CioQuiz/ac
|
|
|
4
4
|
import { QuizAPIReducerState } from '../../components/CioQuiz/quizApiReducer';
|
|
5
5
|
import { QuizLocalReducerState } from '../../components/CioQuiz/quizLocalReducer';
|
|
6
6
|
import { IQuizProps } from '../../types';
|
|
7
|
-
type UseQuizApiState = (quizOptions: IQuizProps, cioClient: ConstructorIOClient, quizLocalState: QuizLocalReducerState, dispatchLocalState: React.Dispatch<ActionAnswerQuestion>) => {
|
|
7
|
+
type UseQuizApiState = (quizOptions: IQuizProps, cioClient: ConstructorIOClient, quizLocalState: QuizLocalReducerState, skipToResults: boolean, dispatchLocalState: React.Dispatch<ActionAnswerQuestion>) => {
|
|
8
8
|
quizApiState: QuizAPIReducerState;
|
|
9
9
|
dispatchApiState: React.Dispatch<ActionQuizAPI>;
|
|
10
10
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ActionAnswerQuestion } from '../../components/CioQuiz/actions';
|
|
2
|
-
|
|
2
|
+
import { SessionStateOptions } from '../../types';
|
|
3
|
+
declare const useQuizLocalState: (sessionStateOptions?: SessionStateOptions) => {
|
|
3
4
|
quizLocalState: import("../../components/CioQuiz/quizLocalReducer").QuizLocalReducerState;
|
|
4
5
|
hasQuizStoredState: () => boolean;
|
|
5
6
|
dispatchLocalState: (action: ActionAnswerQuestion) => void;
|
|
7
|
+
skipToResults: boolean;
|
|
6
8
|
quizStateKey: string;
|
|
7
9
|
};
|
|
8
10
|
export default useQuizLocalState;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface ResultsPageOptions extends ResultCardProps {
|
|
|
24
24
|
}
|
|
25
25
|
export interface SessionStateOptions {
|
|
26
26
|
showSessionModal?: boolean;
|
|
27
|
+
showSessionModalOnResults?: boolean;
|
|
27
28
|
sessionStateKey?: string;
|
|
28
29
|
}
|
|
29
30
|
export interface IQuizProps {
|
|
@@ -46,6 +47,7 @@ export interface QuizReturnState {
|
|
|
46
47
|
sessionId?: string;
|
|
47
48
|
currentQuestion?: CurrentQuestion | undefined;
|
|
48
49
|
results?: QuizResultsResponse | undefined;
|
|
50
|
+
skipToResults: boolean;
|
|
49
51
|
selectedOptionsWithAttributes?: string[];
|
|
50
52
|
};
|
|
51
53
|
}
|