@constructor-io/constructorio-ui-quizzes 1.17.12 → 1.17.14

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.
@@ -51,6 +51,18 @@ function CioQuiz(props) {
51
51
  customAddToFavoritesCallback: !!(callbacks === null || callbacks === void 0 ? void 0 : callbacks.onAddToFavoritesClick),
52
52
  primaryColorStyles,
53
53
  };
54
+ const onModalClose = () => {
55
+ setShowShareModal(false);
56
+ if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onShareResultsModalClose) {
57
+ callbacks === null || callbacks === void 0 ? void 0 : callbacks.onShareResultsModalClose();
58
+ }
59
+ };
60
+ const onModalOpen = () => {
61
+ setShowShareModal(true);
62
+ if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onShareResultsModalOpen) {
63
+ callbacks === null || callbacks === void 0 ? void 0 : callbacks.onShareResultsModalOpen();
64
+ }
65
+ };
54
66
  if (state.quiz.requestState === constants_1.RequestStates.Loading) {
55
67
  return (react_1.default.createElement("div", { className: 'cio-quiz cio-quiz-loading' },
56
68
  react_1.default.createElement(Spinner_1.default, null)));
@@ -66,8 +78,8 @@ function CioQuiz(props) {
66
78
  ".cio-quiz ",
67
79
  (0, utils_1.convertPrimaryColorsToString)(primaryColorStyles)),
68
80
  react_1.default.createElement(SessionPromptModal_1.default, { resetStoredState: resetSessionStorageState, continueSession: hydrateQuiz, showSessionPrompt: showSessionPrompt, setShowSessionPrompt: setShowSessionPrompt }),
69
- state.quiz && showShareModal && (react_1.default.createElement(ShareResultsModal_1.default, { onClose: () => setShowShareModal(false), quizState: state.quiz, onEmailResults: callbacks === null || callbacks === void 0 ? void 0 : callbacks.onEmailResults })),
70
- react_1.default.createElement(context_1.default.Provider, { value: contextValue }, state.quiz.results || skipToResults ? (react_1.default.createElement(ResultContainer_1.default, { resultCardOptions: resultCardOptions, onShare: () => setShowShareModal(true), resultsPageOptions: resultsPageOptions })) : (state.quiz.currentQuestion && (react_1.default.createElement(react_1.default.Fragment, null,
81
+ state.quiz && showShareModal && (react_1.default.createElement(ShareResultsModal_1.default, { onClose: onModalClose, quizState: state.quiz, onEmailResults: callbacks === null || callbacks === void 0 ? void 0 : callbacks.onEmailResults })),
82
+ react_1.default.createElement(context_1.default.Provider, { value: contextValue }, state.quiz.results || skipToResults ? (react_1.default.createElement(ResultContainer_1.default, { resultCardOptions: resultCardOptions, onShare: onModalOpen, resultsPageOptions: resultsPageOptions })) : (state.quiz.currentQuestion && (react_1.default.createElement(react_1.default.Fragment, null,
71
83
  react_1.default.createElement(ProgressBar_1.default, null),
72
84
  react_1.default.createElement(QuizQuestions_1.default, null),
73
85
  react_1.default.createElement(ControlBar_1.default, { skipQuestionButtonText: questionsPageOptions === null || questionsPageOptions === void 0 ? void 0 : questionsPageOptions.skipQuestionButtonText, ctaButtonText: (questionData === null || questionData === void 0 ? void 0 : questionData.cta_text) || undefined })))))));
@@ -99,6 +99,34 @@ exports.argTypes = {
99
99
  },
100
100
  },
101
101
  },
102
+ 'callbacks.onShareResultsModalOpen': {
103
+ description: 'Callback function to be called when the share results modal is opened.',
104
+ control: false,
105
+ table: {
106
+ subcategory: 'callbacks',
107
+ defaultValue: {
108
+ summary: 'null',
109
+ },
110
+ type: {
111
+ summary: '() => void',
112
+ detail: '() => void',
113
+ },
114
+ },
115
+ },
116
+ 'callbacks.onShareResultsModalClose': {
117
+ description: 'Callback function to be called when the share results modal is closed.',
118
+ control: false,
119
+ table: {
120
+ subcategory: 'callbacks',
121
+ defaultValue: {
122
+ summary: 'null',
123
+ },
124
+ type: {
125
+ summary: '() => void',
126
+ detail: '() => void',
127
+ },
128
+ },
129
+ },
102
130
  cioJsClient: {
103
131
  description: 'Optional custom constructor instance. Either `apiKey` or `cioJsClient` are required',
104
132
  },
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.17.12';
3
+ exports.default = '1.17.14';
@@ -47,6 +47,18 @@ export default function CioQuiz(props) {
47
47
  customAddToFavoritesCallback: !!callbacks?.onAddToFavoritesClick,
48
48
  primaryColorStyles,
49
49
  };
50
+ const onModalClose = () => {
51
+ setShowShareModal(false);
52
+ if (callbacks?.onShareResultsModalClose) {
53
+ callbacks?.onShareResultsModalClose();
54
+ }
55
+ };
56
+ const onModalOpen = () => {
57
+ setShowShareModal(true);
58
+ if (callbacks?.onShareResultsModalOpen) {
59
+ callbacks?.onShareResultsModalOpen();
60
+ }
61
+ };
50
62
  if (state.quiz.requestState === RequestStates.Loading) {
51
63
  return (React.createElement("div", { className: 'cio-quiz cio-quiz-loading' },
52
64
  React.createElement(Spinner, null)));
@@ -62,8 +74,8 @@ export default function CioQuiz(props) {
62
74
  ".cio-quiz ",
63
75
  convertPrimaryColorsToString(primaryColorStyles)),
64
76
  React.createElement(SessionPromptModal, { resetStoredState: resetSessionStorageState, continueSession: hydrateQuiz, showSessionPrompt: showSessionPrompt, setShowSessionPrompt: setShowSessionPrompt }),
65
- state.quiz && showShareModal && (React.createElement(ShareResultsModal, { onClose: () => setShowShareModal(false), quizState: state.quiz, onEmailResults: callbacks?.onEmailResults })),
66
- React.createElement(QuizContext.Provider, { value: contextValue }, state.quiz.results || skipToResults ? (React.createElement(ResultContainer, { resultCardOptions: resultCardOptions, onShare: () => setShowShareModal(true), resultsPageOptions: resultsPageOptions })) : (state.quiz.currentQuestion && (React.createElement(React.Fragment, null,
77
+ state.quiz && showShareModal && (React.createElement(ShareResultsModal, { onClose: onModalClose, quizState: state.quiz, onEmailResults: callbacks?.onEmailResults })),
78
+ React.createElement(QuizContext.Provider, { value: contextValue }, state.quiz.results || skipToResults ? (React.createElement(ResultContainer, { resultCardOptions: resultCardOptions, onShare: onModalOpen, resultsPageOptions: resultsPageOptions })) : (state.quiz.currentQuestion && (React.createElement(React.Fragment, null,
67
79
  React.createElement(ProgressBar, null),
68
80
  React.createElement(QuizQuestions, null),
69
81
  React.createElement(ControlBar, { skipQuestionButtonText: questionsPageOptions?.skipQuestionButtonText, ctaButtonText: questionData?.cta_text || undefined })))))));
@@ -96,6 +96,34 @@ export const argTypes = {
96
96
  },
97
97
  },
98
98
  },
99
+ 'callbacks.onShareResultsModalOpen': {
100
+ description: 'Callback function to be called when the share results modal is opened.',
101
+ control: false,
102
+ table: {
103
+ subcategory: 'callbacks',
104
+ defaultValue: {
105
+ summary: 'null',
106
+ },
107
+ type: {
108
+ summary: '() => void',
109
+ detail: '() => void',
110
+ },
111
+ },
112
+ },
113
+ 'callbacks.onShareResultsModalClose': {
114
+ description: 'Callback function to be called when the share results modal is closed.',
115
+ control: false,
116
+ table: {
117
+ subcategory: 'callbacks',
118
+ defaultValue: {
119
+ summary: 'null',
120
+ },
121
+ type: {
122
+ summary: '() => void',
123
+ detail: '() => void',
124
+ },
125
+ },
126
+ },
99
127
  cioJsClient: {
100
128
  description: 'Optional custom constructor instance. Either `apiKey` or `cioJsClient` are required',
101
129
  },
@@ -1 +1 @@
1
- export default '1.17.12';
1
+ export default '1.17.14';
@@ -95,6 +95,34 @@ export declare const argTypes: {
95
95
  };
96
96
  };
97
97
  };
98
+ 'callbacks.onShareResultsModalOpen': {
99
+ description: string;
100
+ control: boolean;
101
+ table: {
102
+ subcategory: string;
103
+ defaultValue: {
104
+ summary: string;
105
+ };
106
+ type: {
107
+ summary: string;
108
+ detail: string;
109
+ };
110
+ };
111
+ };
112
+ 'callbacks.onShareResultsModalClose': {
113
+ description: string;
114
+ control: boolean;
115
+ table: {
116
+ subcategory: string;
117
+ defaultValue: {
118
+ summary: string;
119
+ };
120
+ type: {
121
+ summary: string;
122
+ detail: string;
123
+ };
124
+ };
125
+ };
98
126
  cioJsClient: {
99
127
  description: string;
100
128
  };
@@ -25,6 +25,8 @@ export declare namespace QuizResultsEventsProps {
25
25
  type OnQuizNextQuestion = (question: QuestionWithAnswer) => void;
26
26
  type OnQuizSkipQuestion = (question: QuestionWithAnswer) => void;
27
27
  type OnEmailResults = (data: QuizEmailResults) => Promise<void>;
28
+ type OnShareResultsModalOpen = () => void;
29
+ type OnShareResultsModalClose = () => void;
28
30
  }
29
31
  export type QuizResultsRequestConfigs = Omit<QuizzesResultsParameters, keyof QuizzesParameters | 'page' | 'resultsPerPage'>;
30
32
  export interface ResultsPageOptions {
@@ -52,6 +54,8 @@ export interface Callbacks {
52
54
  onAddToFavoritesClick?: QuizResultsEventsProps.OnAddToFavoritesClick;
53
55
  onQuizSkipQuestion?: QuizResultsEventsProps.OnQuizSkipQuestion;
54
56
  onEmailResults?: QuizResultsEventsProps.OnEmailResults;
57
+ onShareResultsModalOpen?: QuizResultsEventsProps.OnShareResultsModalOpen;
58
+ onShareResultsModalClose?: QuizResultsEventsProps.OnShareResultsModalClose;
55
59
  }
56
60
  export interface IQuizProps {
57
61
  apiKey?: string;
@@ -1,2 +1,2 @@
1
- declare const _default: "1.17.12";
1
+ declare const _default: "1.17.14";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-ui-quizzes",
3
- "version": "1.17.12",
3
+ "version": "1.17.14",
4
4
  "description": "Constructor.io Quizzes UI library for web applications",
5
5
  "author": "Constructor.io Corporation",
6
6
  "license": "MIT",