@edx/frontend-app-subscription-learner-dashboard 1.43.2 → 1.44.0

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.
Files changed (33) hide show
  1. package/dist/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider.d.ts +2 -1
  2. package/dist/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider.js +15 -2
  3. package/dist/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider.js.map +1 -1
  4. package/dist/widgets/ProgressiveProfilingQuiz/data/api/fetchAnswers.d.ts +15 -0
  5. package/dist/widgets/ProgressiveProfilingQuiz/data/api/fetchAnswers.js +34 -0
  6. package/dist/widgets/ProgressiveProfilingQuiz/data/api/fetchAnswers.js.map +1 -0
  7. package/dist/widgets/ProgressiveProfilingQuiz/data/api/saveAnswers.d.ts +12 -0
  8. package/dist/widgets/ProgressiveProfilingQuiz/data/api/saveAnswers.js +33 -0
  9. package/dist/widgets/ProgressiveProfilingQuiz/data/api/saveAnswers.js.map +1 -0
  10. package/dist/widgets/ProgressiveProfilingQuiz/data/index.d.ts +1 -1
  11. package/dist/widgets/ProgressiveProfilingQuiz/data/index.js +1 -1
  12. package/dist/widgets/ProgressiveProfilingQuiz/data/index.js.map +1 -1
  13. package/dist/widgets/ProgressiveProfilingQuiz/data/queryHooks.d.ts +11 -1
  14. package/dist/widgets/ProgressiveProfilingQuiz/data/queryHooks.js +23 -2
  15. package/dist/widgets/ProgressiveProfilingQuiz/data/queryHooks.js.map +1 -1
  16. package/dist/widgets/ProgressiveProfilingQuiz/data/queryKeys.d.ts +4 -0
  17. package/dist/widgets/ProgressiveProfilingQuiz/data/queryKeys.js +4 -0
  18. package/dist/widgets/ProgressiveProfilingQuiz/data/queryKeys.js.map +1 -1
  19. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-interests-declared/InterestsDeclaredAutosuggest.d.ts +1 -6
  20. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-interests-declared/InterestsDeclaredAutosuggest.js.map +1 -1
  21. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-interests-declared/index.js.map +1 -1
  22. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-learning-goal/index.js +1 -1
  23. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-learning-goal/index.js.map +1 -1
  24. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-learning-motivation/index.js +1 -1
  25. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-learning-motivation/index.js.map +1 -1
  26. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-work-status/ViewResultsButton.d.ts +3 -0
  27. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-work-status/ViewResultsButton.js +25 -0
  28. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-work-status/ViewResultsButton.js.map +1 -0
  29. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-work-status/index.js +2 -1
  30. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-work-status/index.js.map +1 -1
  31. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/test.utils.js +8 -1
  32. package/dist/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/test.utils.js.map +1 -1
  33. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
+ import { StoredAnswerRecord } from './data/api/fetchAnswers';
2
3
  import { QuizAnswerRecord } from './data/types';
3
4
  interface ProgressiveProfilingQuizContextType {
4
5
  isModalOpen: boolean;
@@ -8,7 +9,7 @@ interface ProgressiveProfilingQuizContextType {
8
9
  setCurrentStep: (step: number) => void;
9
10
  goToNextStep: () => void;
10
11
  goToPreviousStep: () => void;
11
- answers: Record<string, QuizAnswerRecord>;
12
+ answers: Record<string, QuizAnswerRecord | StoredAnswerRecord>;
12
13
  recordAnswer: (answer: QuizAnswerRecord) => void;
13
14
  isComplete: boolean;
14
15
  setIsComplete: (isComplete: boolean) => void;
@@ -1,13 +1,26 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useMemo, useState, useCallback, } from 'react';
2
+ import { createContext, useContext, useEffect, useMemo, useState, useCallback, } from 'react';
3
+ import { useAnswers, useSaveAnswers } from './data/queryHooks';
3
4
  const ProgressiveProfilingQuizContext = createContext(null);
4
5
  export const ProgressiveProfilingQuizProvider = ({ children }) => {
5
6
  const [isModalOpen, setIsModalOpen] = useState(false);
6
7
  const [currentStep, setCurrentStep] = useState(0);
7
8
  const [answers, setAnswers] = useState({});
8
9
  const [isComplete, setIsComplete] = useState(false);
10
+ const { data: storedAnswers } = useAnswers();
11
+ const { mutate: saveAnswers } = useSaveAnswers();
12
+ useEffect(() => {
13
+ if (storedAnswers) {
14
+ setAnswers(prev => (Object.assign(Object.assign({}, storedAnswers), prev)));
15
+ }
16
+ }, [storedAnswers]);
9
17
  const openModal = useCallback(() => setIsModalOpen(true), []);
10
- const closeModal = useCallback(() => setIsModalOpen(false), []);
18
+ const closeModal = useCallback(() => {
19
+ setIsModalOpen(false);
20
+ if (Object.keys(answers).length > 0) {
21
+ saveAnswers(answers);
22
+ }
23
+ }, [answers, saveAnswers]);
11
24
  const goToNextStep = useCallback(() => setCurrentStep(prev => prev + 1), []);
12
25
  const goToPreviousStep = useCallback(() => setCurrentStep(prev => Math.max(0, prev - 1)), []);
13
26
  const recordAnswer = useCallback((answer) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressiveProfilingQuizProvider.js","sourceRoot":"","sources":["../../../src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider.tsx"],"names":[],"mappings":";AAAA,OAAc,EACZ,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAa,WAAW,GACrE,MAAM,OAAO,CAAC;AAkBf,MAAM,+BAA+B,GAAG,aAAa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AAC;QAClC,WAAW;QACX,SAAS;QACT,UAAU;QACV,WAAW;QACX,cAAc;QACd,YAAY;QACZ,gBAAgB;QAChB,OAAO;QACP,YAAY;QACZ,UAAU;QACV,aAAa;KACd,CAAC,EAAE;QACF,WAAW,EAAE,SAAS,EAAE,UAAU;QAClC,WAAW,EAAE,YAAY,EAAE,gBAAgB;QAC3C,OAAO,EAAE,YAAY;QACrB,UAAU;KACX,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,+BAA+B,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC1D,QAAQ,GACgC,CAC5C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAwC,EAAE;IACnF,MAAM,OAAO,GAAG,UAAU,CAAC,+BAA+B,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import React, {\n createContext, useContext, useMemo, useState, ReactNode, useCallback,\n} from 'react';\n\nimport { QuizAnswerRecord } from './data/types';\n\ninterface ProgressiveProfilingQuizContextType {\n isModalOpen: boolean,\n openModal: () => void,\n closeModal: () => void,\n currentStep: number,\n setCurrentStep: (step: number) => void,\n goToNextStep: () => void,\n goToPreviousStep: () => void,\n answers: Record<string, QuizAnswerRecord>,\n recordAnswer: (answer: QuizAnswerRecord) => void,\n isComplete: boolean,\n setIsComplete: (isComplete: boolean) => void,\n}\n\nconst ProgressiveProfilingQuizContext = createContext<ProgressiveProfilingQuizContextType | null>(null);\n\ninterface ProgressiveProfilingQuizProviderProps {\n children: ReactNode,\n}\n\nexport const ProgressiveProfilingQuizProvider: React.FC<ProgressiveProfilingQuizProviderProps> = ({ children }) => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [currentStep, setCurrentStep] = useState(0);\n const [answers, setAnswers] = useState<Record<string, QuizAnswerRecord>>({});\n const [isComplete, setIsComplete] = useState(false);\n\n const openModal = useCallback(() => setIsModalOpen(true), []);\n const closeModal = useCallback(() => setIsModalOpen(false), []);\n\n const goToNextStep = useCallback(() => setCurrentStep(prev => prev + 1), []);\n const goToPreviousStep = useCallback(() => setCurrentStep(prev => Math.max(0, prev - 1)), []);\n\n const recordAnswer = useCallback((answer: QuizAnswerRecord) => {\n setAnswers(prev => ({ ...prev, [answer.questionId]: answer }));\n }, []);\n\n const contextValue = useMemo(() => ({\n isModalOpen,\n openModal,\n closeModal,\n currentStep,\n setCurrentStep,\n goToNextStep,\n goToPreviousStep,\n answers,\n recordAnswer,\n isComplete,\n setIsComplete,\n }), [\n isModalOpen, openModal, closeModal,\n currentStep, goToNextStep, goToPreviousStep,\n answers, recordAnswer,\n isComplete,\n ]);\n\n return (\n <ProgressiveProfilingQuizContext.Provider value={contextValue}>\n {children}\n </ProgressiveProfilingQuizContext.Provider>\n );\n};\n\nexport const useProgressiveProfilingQuiz = (): ProgressiveProfilingQuizContextType => {\n const context = useContext(ProgressiveProfilingQuizContext);\n if (!context) {\n throw new Error('useProgressiveProfilingQuiz must be used within a ProgressiveProfilingQuizProvider');\n }\n return context;\n};\n"]}
1
+ {"version":3,"file":"ProgressiveProfilingQuizProvider.js","sourceRoot":"","sources":["../../../src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider.tsx"],"names":[],"mappings":";AAAA,OAAc,EACZ,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAa,WAAW,GAChF,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAiB/D,MAAM,+BAA+B,GAAG,aAAa,CAA6C,IAAI,CAAC,CAAC;AAMxG,MAAM,CAAC,MAAM,gCAAgC,GAAoD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAChH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC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AAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAE9F,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,MAAwB,EAAE,EAAE;QAC5D,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,iCAAM,IAAI,KAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,IAAG,CAAC,CAAC;IACjE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAClC,WAAW;QACX,SAAS;QACT,UAAU;QACV,WAAW;QACX,cAAc;QACd,YAAY;QACZ,gBAAgB;QAChB,OAAO;QACP,YAAY;QACZ,UAAU;QACV,aAAa;KACd,CAAC,EAAE;QACF,WAAW,EAAE,SAAS,EAAE,UAAU;QAClC,WAAW,EAAE,YAAY,EAAE,gBAAgB;QAC3C,OAAO,EAAE,YAAY;QACrB,UAAU;KACX,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,+BAA+B,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC1D,QAAQ,GACgC,CAC5C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAwC,EAAE;IACnF,MAAM,OAAO,GAAG,UAAU,CAAC,+BAA+B,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import React, {\n createContext, useContext, useEffect, useMemo, useState, ReactNode, useCallback,\n} from 'react';\n\nimport { StoredAnswerRecord } from './data/api/fetchAnswers';\nimport { useAnswers, useSaveAnswers } from './data/queryHooks';\nimport { QuizAnswerRecord } from './data/types';\n\ninterface ProgressiveProfilingQuizContextType {\n isModalOpen: boolean,\n openModal: () => void,\n closeModal: () => void,\n currentStep: number,\n setCurrentStep: (step: number) => void,\n goToNextStep: () => void,\n goToPreviousStep: () => void,\n answers: Record<string, QuizAnswerRecord | StoredAnswerRecord>,\n recordAnswer: (answer: QuizAnswerRecord) => void,\n isComplete: boolean,\n setIsComplete: (isComplete: boolean) => void,\n}\n\nconst ProgressiveProfilingQuizContext = createContext<ProgressiveProfilingQuizContextType | null>(null);\n\ninterface ProgressiveProfilingQuizProviderProps {\n children: ReactNode,\n}\n\nexport const ProgressiveProfilingQuizProvider: React.FC<ProgressiveProfilingQuizProviderProps> = ({ children }) => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [currentStep, setCurrentStep] = useState(0);\n const [answers, setAnswers] = useState<Record<string, QuizAnswerRecord | StoredAnswerRecord>>({});\n const [isComplete, setIsComplete] = useState(false);\n\n const { data: storedAnswers } = useAnswers();\n const { mutate: saveAnswers } = useSaveAnswers();\n\n useEffect(() => {\n if (storedAnswers) {\n setAnswers(prev => ({ ...storedAnswers, ...prev }));\n }\n }, [storedAnswers]);\n\n const openModal = useCallback(() => setIsModalOpen(true), []);\n const closeModal = useCallback(() => {\n setIsModalOpen(false);\n if (Object.keys(answers).length > 0) {\n saveAnswers(answers);\n }\n }, [answers, saveAnswers]);\n\n const goToNextStep = useCallback(() => setCurrentStep(prev => prev + 1), []);\n const goToPreviousStep = useCallback(() => setCurrentStep(prev => Math.max(0, prev - 1)), []);\n\n const recordAnswer = useCallback((answer: QuizAnswerRecord) => {\n setAnswers(prev => ({ ...prev, [answer.questionId]: answer }));\n }, []);\n\n const contextValue = useMemo(() => ({\n isModalOpen,\n openModal,\n closeModal,\n currentStep,\n setCurrentStep,\n goToNextStep,\n goToPreviousStep,\n answers,\n recordAnswer,\n isComplete,\n setIsComplete,\n }), [\n isModalOpen, openModal, closeModal,\n currentStep, goToNextStep, goToPreviousStep,\n answers, recordAnswer,\n isComplete,\n ]);\n\n return (\n <ProgressiveProfilingQuizContext.Provider value={contextValue}>\n {children}\n </ProgressiveProfilingQuizContext.Provider>\n );\n};\n\nexport const useProgressiveProfilingQuiz = (): ProgressiveProfilingQuizContextType => {\n const context = useContext(ProgressiveProfilingQuizContext);\n if (!context) {\n throw new Error('useProgressiveProfilingQuiz must be used within a ProgressiveProfilingQuizProvider');\n }\n return context;\n};\n"]}
@@ -0,0 +1,15 @@
1
+ import { QuizAnswerRecord } from '../types';
2
+ /** What's actually stored by saveAnswers: a QuizAnswerRecord minus the options it omits. */
3
+ export type StoredAnswerRecord = Omit<QuizAnswerRecord, 'options'>;
4
+ /**
5
+ * Retrieves whatever quiz answers were previously persisted via saveAnswers. Returns an empty
6
+ * object if the user hasn't answered yet (no 'progressive_profile' extended profile field on
7
+ * their account).
8
+ *
9
+ * Keyed by each record's own questionId field rather than the map's own (outer) key: saveAnswers
10
+ * snake-cases the whole answers map - including its outer keys - before sending it, so a
11
+ * kebab-case questionId like 'learning-goal' comes back from storage as 'learning_goal'. The
12
+ * questionId field nested inside the record is a value, not a key, so it isn't mangled and can be
13
+ * used to key the result the same way session-recorded answers already are.
14
+ */
15
+ export declare const fetchAnswers: () => Promise<Record<string, StoredAnswerRecord>>;
@@ -0,0 +1,34 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { getAuthenticatedHttpClient, getAuthenticatedUser, getSiteConfig, camelCaseObject, } from '@openedx/frontend-base';
11
+ /**
12
+ * Retrieves whatever quiz answers were previously persisted via saveAnswers. Returns an empty
13
+ * object if the user hasn't answered yet (no 'progressive_profile' extended profile field on
14
+ * their account).
15
+ *
16
+ * Keyed by each record's own questionId field rather than the map's own (outer) key: saveAnswers
17
+ * snake-cases the whole answers map - including its outer keys - before sending it, so a
18
+ * kebab-case questionId like 'learning-goal' comes back from storage as 'learning_goal'. The
19
+ * questionId field nested inside the record is a value, not a key, so it isn't mangled and can be
20
+ * used to key the result the same way session-recorded answers already are.
21
+ */
22
+ export const fetchAnswers = () => __awaiter(void 0, void 0, void 0, function* () {
23
+ var _a, _b;
24
+ const { username } = getAuthenticatedUser();
25
+ const { data } = yield getAuthenticatedHttpClient().get(`${getSiteConfig().lmsBaseUrl}/api/user/v1/accounts/${username}`);
26
+ const extendedProfile = (_a = data.extended_profile) !== null && _a !== void 0 ? _a : [];
27
+ const progressiveProfile = extendedProfile.find((field) => field.field_name === 'progressive_profile');
28
+ const storedAnswers = ((_b = progressiveProfile === null || progressiveProfile === void 0 ? void 0 : progressiveProfile.field_value) !== null && _b !== void 0 ? _b : {});
29
+ return Object.fromEntries(Object.values(storedAnswers).map((record) => {
30
+ const camelCasedRecord = camelCaseObject(record);
31
+ return [camelCasedRecord.questionId, camelCasedRecord];
32
+ }));
33
+ });
34
+ //# sourceMappingURL=fetchAnswers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchAnswers.js","sourceRoot":"","sources":["../../../../../src/widgets/ProgressiveProfilingQuiz/data/api/fetchAnswers.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,0BAA0B,EAAE,oBAAoB,EAAE,aAAa,EAAE,eAAe,GACjF,MAAM,wBAAwB,CAAC;AAYhC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAsD,EAAE;;IAClF,MAAM,EAAE,QAAQ,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAE5C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CACrD,GAAG,aAAa,EAAE,CAAC,UAAU,yBAAyB,QAAQ,EAAE,CACjE,CAAC;IAEF,MAAM,eAAe,GAA2B,MAAA,IAAI,CAAC,gBAAgB,mCAAI,EAAE,CAAC;IAC5E,MAAM,kBAAkB,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,qBAAqB,CAAC,CAAC;IACvG,MAAM,aAAa,GAAG,CAAC,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,WAAW,mCAAI,EAAE,CAA4B,CAAC;IAEzF,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAC1C,MAAM,gBAAgB,GAAG,eAAe,CAAC,MAAM,CAAuB,CAAC;QACvE,OAAO,CAAC,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IACzD,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CAAA,CAAC","sourcesContent":["import {\n getAuthenticatedHttpClient, getAuthenticatedUser, getSiteConfig, camelCaseObject,\n} from '@openedx/frontend-base';\n\nimport { QuizAnswerRecord } from '../types';\n\n/** What's actually stored by saveAnswers: a QuizAnswerRecord minus the options it omits. */\nexport type StoredAnswerRecord = Omit<QuizAnswerRecord, 'options'>;\n\ninterface ExtendedProfileField {\n field_name: string,\n field_value: unknown,\n}\n\n/**\n * Retrieves whatever quiz answers were previously persisted via saveAnswers. Returns an empty\n * object if the user hasn't answered yet (no 'progressive_profile' extended profile field on\n * their account).\n *\n * Keyed by each record's own questionId field rather than the map's own (outer) key: saveAnswers\n * snake-cases the whole answers map - including its outer keys - before sending it, so a\n * kebab-case questionId like 'learning-goal' comes back from storage as 'learning_goal'. The\n * questionId field nested inside the record is a value, not a key, so it isn't mangled and can be\n * used to key the result the same way session-recorded answers already are.\n */\nexport const fetchAnswers = async (): Promise<Record<string, StoredAnswerRecord>> => {\n const { username } = getAuthenticatedUser();\n\n const { data } = await getAuthenticatedHttpClient().get(\n `${getSiteConfig().lmsBaseUrl}/api/user/v1/accounts/${username}`,\n );\n\n const extendedProfile: ExtendedProfileField[] = data.extended_profile ?? [];\n const progressiveProfile = extendedProfile.find((field) => field.field_name === 'progressive_profile');\n const storedAnswers = (progressiveProfile?.field_value ?? {}) as Record<string, unknown>;\n\n return Object.fromEntries(\n Object.values(storedAnswers).map((record) => {\n const camelCasedRecord = camelCaseObject(record) as StoredAnswerRecord;\n return [camelCasedRecord.questionId, camelCasedRecord];\n }),\n );\n};\n"]}
@@ -0,0 +1,12 @@
1
+ import { QuizAnswerRecord } from '../types';
2
+ import { StoredAnswerRecord } from './fetchAnswers';
3
+ /**
4
+ * Persists the quiz's answers to the authenticated user's account as a single extended profile
5
+ * field, 'progressive_profile', whose value is the answers map (every trait keyed by questionId,
6
+ * with its version, question, and selectedValues). Options are omitted since the backend doesn't
7
+ * need them.
8
+ *
9
+ * Accepts StoredAnswerRecord (rather than the full QuizAnswerRecord) so answers seeded from
10
+ * fetchAnswers - which never carried options in the first place - can be resaved as-is.
11
+ */
12
+ export declare const saveAnswers: (answers: Record<string, QuizAnswerRecord | StoredAnswerRecord>) => Promise<void>;
@@ -0,0 +1,33 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { getAuthenticatedHttpClient, getAuthenticatedUser, getSiteConfig, snakeCaseObject, } from '@openedx/frontend-base';
11
+ /**
12
+ * Persists the quiz's answers to the authenticated user's account as a single extended profile
13
+ * field, 'progressive_profile', whose value is the answers map (every trait keyed by questionId,
14
+ * with its version, question, and selectedValues). Options are omitted since the backend doesn't
15
+ * need them.
16
+ *
17
+ * Accepts StoredAnswerRecord (rather than the full QuizAnswerRecord) so answers seeded from
18
+ * fetchAnswers - which never carried options in the first place - can be resaved as-is.
19
+ */
20
+ export const saveAnswers = (answers) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const { username } = getAuthenticatedUser();
22
+ const answersWithoutOptions = Object.fromEntries(Object.entries(answers).map(([questionId, { version, question, selectedValues, }]) => [questionId, {
23
+ questionId, version, question, selectedValues,
24
+ }]));
25
+ const extendedProfile = [{
26
+ fieldName: 'progressive_profile',
27
+ fieldValue: answersWithoutOptions,
28
+ }];
29
+ yield getAuthenticatedHttpClient().patch(`${getSiteConfig().lmsBaseUrl}/api/user/v1/accounts/${username}`, snakeCaseObject({ extendedProfile }), {
30
+ headers: { 'Content-Type': 'application/merge-patch+json' },
31
+ });
32
+ });
33
+ //# sourceMappingURL=saveAnswers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saveAnswers.js","sourceRoot":"","sources":["../../../../../src/widgets/ProgressiveProfilingQuiz/data/api/saveAnswers.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,0BAA0B,EAAE,oBAAoB,EAAE,aAAa,EAAE,eAAe,GACjF,MAAM,wBAAwB,CAAC;AAKhC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,OAA8D,EAC/C,EAAE;IACjB,MAAM,EAAE,QAAQ,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAE5C,MAAM,qBAAqB,GAAG,MAAM,CAAC,WAAW,CAC9C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,EACxC,OAAO,EAAE,QAAQ,EAAE,cAAc,GAClC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE;YAClB,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc;SAC9C,CAAC,CAAC,CACJ,CAAC;IAEF,MAAM,eAAe,GAAG,CAAC;YACvB,SAAS,EAAE,qBAAqB;YAChC,UAAU,EAAE,qBAAqB;SAClC,CAAC,CAAC;IAEH,MAAM,0BAA0B,EAAE,CAAC,KAAK,CACtC,GAAG,aAAa,EAAE,CAAC,UAAU,yBAAyB,QAAQ,EAAE,EAChE,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC,EACpC;QACE,OAAO,EAAE,EAAE,cAAc,EAAE,8BAA8B,EAAE;KAC5D,CACF,CAAC;AACJ,CAAC,CAAA,CAAC","sourcesContent":["import {\n getAuthenticatedHttpClient, getAuthenticatedUser, getSiteConfig, snakeCaseObject,\n} from '@openedx/frontend-base';\n\nimport { QuizAnswerRecord } from '../types';\nimport { StoredAnswerRecord } from './fetchAnswers';\n\n/**\n * Persists the quiz's answers to the authenticated user's account as a single extended profile\n * field, 'progressive_profile', whose value is the answers map (every trait keyed by questionId,\n * with its version, question, and selectedValues). Options are omitted since the backend doesn't\n * need them.\n *\n * Accepts StoredAnswerRecord (rather than the full QuizAnswerRecord) so answers seeded from\n * fetchAnswers - which never carried options in the first place - can be resaved as-is.\n */\nexport const saveAnswers = async (\n answers: Record<string, QuizAnswerRecord | StoredAnswerRecord>,\n): Promise<void> => {\n const { username } = getAuthenticatedUser();\n\n const answersWithoutOptions = Object.fromEntries(\n Object.entries(answers).map(([questionId, {\n version, question, selectedValues,\n }]) => [questionId, {\n questionId, version, question, selectedValues,\n }]),\n );\n\n const extendedProfile = [{\n fieldName: 'progressive_profile',\n fieldValue: answersWithoutOptions,\n }];\n\n await getAuthenticatedHttpClient().patch(\n `${getSiteConfig().lmsBaseUrl}/api/user/v1/accounts/${username}`,\n snakeCaseObject({ extendedProfile }),\n {\n headers: { 'Content-Type': 'application/merge-patch+json' },\n },\n );\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  export * from './types';
2
2
  export * from './constants';
3
- export { useSkills } from './queryHooks';
3
+ export { useSkills, useSaveAnswers, useAnswers } from './queryHooks';
@@ -1,4 +1,4 @@
1
1
  export * from './types';
2
2
  export * from './constants';
3
- export { useSkills } from './queryHooks';
3
+ export { useSkills, useSaveAnswers, useAnswers } from './queryHooks';
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/widgets/ProgressiveProfilingQuiz/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export * from './types';\nexport * from './constants';\nexport { useSkills } from './queryHooks';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/widgets/ProgressiveProfilingQuiz/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export * from './types';\nexport * from './constants';\nexport { useSkills, useSaveAnswers, useAnswers } from './queryHooks';\n"]}
@@ -1,7 +1,17 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import { SkillWithCount } from './types';
2
+ import { StoredAnswerRecord } from './api/fetchAnswers';
3
+ import { QuizAnswerRecord, SkillWithCount } from './types';
3
4
  /**
4
5
  * Fetches every skill value in the Algolia product index, cached for reuse by any
5
6
  * question whose options are the skills list (e.g. 'preferred-subject').
6
7
  */
7
8
  export declare const useSkills: () => UseQueryResult<SkillWithCount[]>;
9
+ /**
10
+ * Retrieves whatever quiz answers were previously persisted via saveAnswers
11
+ */
12
+ export declare const useAnswers: () => UseQueryResult<Record<string, StoredAnswerRecord>>;
13
+ /**
14
+ * Persists whatever quiz answers have been recorded so far, whether the user finished every
15
+ * step or abandoned partway through.
16
+ */
17
+ export declare const useSaveAnswers: () => import("@tanstack/react-query").UseMutationResult<void, Error, Record<string, QuizAnswerRecord | StoredAnswerRecord>, unknown>;
@@ -1,7 +1,10 @@
1
- import { useQuery } from '@tanstack/react-query';
1
+ import { useMutation, useQuery } from '@tanstack/react-query';
2
+ import { logError } from '@openedx/frontend-base';
2
3
  import { useAlgoliaSearch } from '../../../utils/algoliaUtils';
4
+ import { fetchAnswers } from './api/fetchAnswers';
3
5
  import { fetchSkills } from './api/fetchSkills';
4
- import { progressiveProfilingQuizQueryKeys } from './queryKeys';
6
+ import { saveAnswers } from './api/saveAnswers';
7
+ import { progressiveProfilingQuizMutationKeys, progressiveProfilingQuizQueryKeys } from './queryKeys';
5
8
  /**
6
9
  * Fetches every skill value in the Algolia product index, cached for reuse by any
7
10
  * question whose options are the skills list (e.g. 'preferred-subject').
@@ -15,4 +18,22 @@ export const useSkills = () => {
15
18
  staleTime: 10 * 60 * 1000,
16
19
  });
17
20
  };
21
+ /**
22
+ * Retrieves whatever quiz answers were previously persisted via saveAnswers
23
+ */
24
+ export const useAnswers = () => useQuery({
25
+ queryKey: progressiveProfilingQuizQueryKeys.answers(),
26
+ queryFn: fetchAnswers,
27
+ });
28
+ /**
29
+ * Persists whatever quiz answers have been recorded so far, whether the user finished every
30
+ * step or abandoned partway through.
31
+ */
32
+ export const useSaveAnswers = () => useMutation({
33
+ mutationKey: progressiveProfilingQuizMutationKeys.saveAnswers(),
34
+ mutationFn: (answers) => saveAnswers(answers),
35
+ onError: (error) => {
36
+ logError(error);
37
+ },
38
+ });
18
39
  //# sourceMappingURL=queryHooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryHooks.js","sourceRoot":"","sources":["../../../../src/widgets/ProgressiveProfilingQuiz/data/queryHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAGhE;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAqC,EAAE;IAC9D,MAAM,CAAC,YAAY,CAAC,GAAG,gBAAgB,EAAE,CAAC;IAE1C,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,iCAAiC,CAAC,MAAM,EAAE;QACpD,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,YAAa,CAAC;QACzC,OAAO,EAAE,CAAC,CAAC,YAAY;QACvB,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;KAC1B,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { useQuery, UseQueryResult } from '@tanstack/react-query';\n\nimport { useAlgoliaSearch } from '@src/utils/algoliaUtils';\n\nimport { fetchSkills } from './api/fetchSkills';\nimport { progressiveProfilingQuizQueryKeys } from './queryKeys';\nimport { SkillWithCount } from './types';\n\n/**\n * Fetches every skill value in the Algolia product index, cached for reuse by any\n * question whose options are the skills list (e.g. 'preferred-subject').\n */\nexport const useSkills = (): UseQueryResult<SkillWithCount[]> => {\n const [searchClient] = useAlgoliaSearch();\n\n return useQuery({\n queryKey: progressiveProfilingQuizQueryKeys.skills(),\n queryFn: () => fetchSkills(searchClient!),\n enabled: !!searchClient,\n staleTime: 10 * 60 * 1000,\n });\n};\n"]}
1
+ {"version":3,"file":"queryHooks.js","sourceRoot":"","sources":["../../../../src/widgets/ProgressiveProfilingQuiz/data/queryHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAsB,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,oCAAoC,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAGtG;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAqC,EAAE;IAC9D,MAAM,CAAC,YAAY,CAAC,GAAG,gBAAgB,EAAE,CAAC;IAE1C,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,iCAAiC,CAAC,MAAM,EAAE;QACpD,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,YAAa,CAAC;QACzC,OAAO,EAAE,CAAC,CAAC,YAAY;QACvB,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;KAC1B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAuD,EAAE,CAAC,QAAQ,CAAC;IAC3F,QAAQ,EAAE,iCAAiC,CAAC,OAAO,EAAE;IACrD,OAAO,EAAE,YAAY;CACtB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC;IAC9C,WAAW,EAAE,oCAAoC,CAAC,WAAW,EAAE;IAC/D,UAAU,EAAE,CAAC,OAA8D,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;IACpG,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QACjB,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { useMutation, useQuery, UseQueryResult } from '@tanstack/react-query';\nimport { logError } from '@openedx/frontend-base';\n\nimport { useAlgoliaSearch } from '@src/utils/algoliaUtils';\n\nimport { fetchAnswers, StoredAnswerRecord } from './api/fetchAnswers';\nimport { fetchSkills } from './api/fetchSkills';\nimport { saveAnswers } from './api/saveAnswers';\nimport { progressiveProfilingQuizMutationKeys, progressiveProfilingQuizQueryKeys } from './queryKeys';\nimport { QuizAnswerRecord, SkillWithCount } from './types';\n\n/**\n * Fetches every skill value in the Algolia product index, cached for reuse by any\n * question whose options are the skills list (e.g. 'preferred-subject').\n */\nexport const useSkills = (): UseQueryResult<SkillWithCount[]> => {\n const [searchClient] = useAlgoliaSearch();\n\n return useQuery({\n queryKey: progressiveProfilingQuizQueryKeys.skills(),\n queryFn: () => fetchSkills(searchClient!),\n enabled: !!searchClient,\n staleTime: 10 * 60 * 1000,\n });\n};\n\n/**\n * Retrieves whatever quiz answers were previously persisted via saveAnswers\n */\nexport const useAnswers = (): UseQueryResult<Record<string, StoredAnswerRecord>> => useQuery({\n queryKey: progressiveProfilingQuizQueryKeys.answers(),\n queryFn: fetchAnswers,\n});\n\n/**\n * Persists whatever quiz answers have been recorded so far, whether the user finished every\n * step or abandoned partway through.\n */\nexport const useSaveAnswers = () => useMutation({\n mutationKey: progressiveProfilingQuizMutationKeys.saveAnswers(),\n mutationFn: (answers: Record<string, QuizAnswerRecord | StoredAnswerRecord>) => saveAnswers(answers),\n onError: (error) => {\n logError(error);\n },\n});\n"]}
@@ -1,4 +1,8 @@
1
1
  export declare const progressiveProfilingQuizQueryKeys: {
2
2
  all: readonly ["progressive-profiling-quiz"];
3
3
  skills: () => readonly ["progressive-profiling-quiz", "skills"];
4
+ answers: () => readonly ["progressive-profiling-quiz", "answers"];
5
+ };
6
+ export declare const progressiveProfilingQuizMutationKeys: {
7
+ saveAnswers: () => readonly ["progressive-profiling-quiz", "save-answers"];
4
8
  };
@@ -2,5 +2,9 @@ const BASE_KEY = ['progressive-profiling-quiz'];
2
2
  export const progressiveProfilingQuizQueryKeys = {
3
3
  all: BASE_KEY,
4
4
  skills: () => [...BASE_KEY, 'skills'],
5
+ answers: () => [...BASE_KEY, 'answers'],
6
+ };
7
+ export const progressiveProfilingQuizMutationKeys = {
8
+ saveAnswers: () => [...BASE_KEY, 'save-answers'],
5
9
  };
6
10
  //# sourceMappingURL=queryKeys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryKeys.js","sourceRoot":"","sources":["../../../../src/widgets/ProgressiveProfilingQuiz/data/queryKeys.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,CAAC,4BAA4B,CAAU,CAAC;AAEzD,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,QAAQ,CAAU;CAC/C,CAAC","sourcesContent":["const BASE_KEY = ['progressive-profiling-quiz'] as const;\n\nexport const progressiveProfilingQuizQueryKeys = {\n all: BASE_KEY,\n skills: () => [...BASE_KEY, 'skills'] as const,\n};\n"]}
1
+ {"version":3,"file":"queryKeys.js","sourceRoot":"","sources":["../../../../src/widgets/ProgressiveProfilingQuiz/data/queryKeys.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,CAAC,4BAA4B,CAAU,CAAC;AAEzD,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,QAAQ,CAAU;IAC9C,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,SAAS,CAAU;CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG;IAClD,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,cAAc,CAAU;CAC1D,CAAC","sourcesContent":["const BASE_KEY = ['progressive-profiling-quiz'] as const;\n\nexport const progressiveProfilingQuizQueryKeys = {\n all: BASE_KEY,\n skills: () => [...BASE_KEY, 'skills'] as const,\n answers: () => [...BASE_KEY, 'answers'] as const,\n};\n\nexport const progressiveProfilingQuizMutationKeys = {\n saveAnswers: () => [...BASE_KEY, 'save-answers'] as const,\n};\n"]}
@@ -1,10 +1,5 @@
1
1
  import React from 'react';
2
- import { SkillWithCount } from '../../../../../../widgets/ProgressiveProfilingQuiz/data';
3
- export interface AutosuggestValue {
4
- userProvidedText: string;
5
- selectionValue: string;
6
- selectionId: string;
7
- }
2
+ import { SkillWithCount, AutosuggestValue } from '../../../../../../widgets/ProgressiveProfilingQuiz/data';
8
3
  interface InterestsDeclaredAutosuggestProps {
9
4
  inputValue: AutosuggestValue;
10
5
  skills?: SkillWithCount[];
@@ -1 +1 @@
1
- {"version":3,"file":"InterestsDeclaredAutosuggest.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-interests-declared/InterestsDeclaredAutosuggest.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAgBhD,MAAM,4BAA4B,GAAgD,CAAC,EACjF,UAAU,EACV,MAAM,EACN,QAAQ,GACT,EAAE,EAAE;IACH,OAAO,CACL,KAAC,IAAI,CAAC,WAAW,IACf,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,gCAAgC,EACrC,eAAe,EAAE,CACf,KAAC,IAAI,IACH,GAAG,EAAE,MAAM,GACX,CACH,EACD,SAAS,EAAC,iBAAiB,YAE1B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CACpB,KAAC,IAAI,CAAC,iBAAiB,IAAmB,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,YACzF,KAAK,CAAC,KAAK,IADe,KAAK,CAAC,KAAK,CAEf,CAC1B,CAAC,GACe,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,4BAA4B,CAAC","sourcesContent":["import React from 'react';\nimport { Form, Icon } from '@openedx/paragon';\nimport { Search } from '@openedx/paragon/icons';\n\nimport { SkillWithCount } from '@src/widgets/ProgressiveProfilingQuiz/data';\n\nexport interface AutosuggestValue {\n userProvidedText: string,\n selectionValue: string,\n selectionId: string,\n}\n\ninterface InterestsDeclaredAutosuggestProps {\n inputValue: AutosuggestValue,\n skills?: SkillWithCount[],\n onChange: (value: AutosuggestValue) => void,\n}\n\nconst InterestsDeclaredAutosuggest: React.FC<InterestsDeclaredAutosuggestProps> = ({\n inputValue,\n skills,\n onChange,\n}) => {\n return (\n <Form.Autosuggest\n value={inputValue}\n onChange={onChange}\n name=\"interests-declared-autosuggest\"\n trailingElement={(\n <Icon\n src={Search}\n />\n )}\n className=\"container-mw-xs\"\n >\n {skills?.map(skill => (\n <Form.AutosuggestOption key={skill.value} id={skill.value.replaceAll(' ', '-').toLowerCase()}>\n {skill.value}\n </Form.AutosuggestOption>\n ))}\n </Form.Autosuggest>\n );\n};\n\nexport default InterestsDeclaredAutosuggest;\n"]}
1
+ {"version":3,"file":"InterestsDeclaredAutosuggest.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-interests-declared/InterestsDeclaredAutosuggest.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAUhD,MAAM,4BAA4B,GAAgD,CAAC,EACjF,UAAU,EACV,MAAM,EACN,QAAQ,GACT,EAAE,EAAE;IACH,OAAO,CACL,KAAC,IAAI,CAAC,WAAW,IACf,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,gCAAgC,EACrC,eAAe,EAAE,CACf,KAAC,IAAI,IACH,GAAG,EAAE,MAAM,GACX,CACH,EACD,SAAS,EAAC,iBAAiB,YAE1B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CACpB,KAAC,IAAI,CAAC,iBAAiB,IAAmB,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,YACzF,KAAK,CAAC,KAAK,IADe,KAAK,CAAC,KAAK,CAEf,CAC1B,CAAC,GACe,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,4BAA4B,CAAC","sourcesContent":["import React from 'react';\nimport { Form, Icon } from '@openedx/paragon';\nimport { Search } from '@openedx/paragon/icons';\n\nimport { SkillWithCount, AutosuggestValue } from '@src/widgets/ProgressiveProfilingQuiz/data';\n\ninterface InterestsDeclaredAutosuggestProps {\n inputValue: AutosuggestValue,\n skills?: SkillWithCount[],\n onChange: (value: AutosuggestValue) => void,\n}\n\nconst InterestsDeclaredAutosuggest: React.FC<InterestsDeclaredAutosuggestProps> = ({\n inputValue,\n skills,\n onChange,\n}) => {\n return (\n <Form.Autosuggest\n value={inputValue}\n onChange={onChange}\n name=\"interests-declared-autosuggest\"\n trailingElement={(\n <Icon\n src={Search}\n />\n )}\n className=\"container-mw-xs\"\n >\n {skills?.map(skill => (\n <Form.AutosuggestOption key={skill.value} id={skill.value.replaceAll(' ', '-').toLowerCase()}>\n {skill.value}\n </Form.AutosuggestOption>\n ))}\n </Form.Autosuggest>\n );\n};\n\nexport default InterestsDeclaredAutosuggest;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-interests-declared/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAA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,CAAC,GAChC,IACS,IACnB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { Stepper, Button, Form, Chip } from '@openedx/paragon';\nimport { Close } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport { useProgressiveProfilingQuiz } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\nimport { PROGRESSIVE_PROFILING_QUIZ_STEPS } from '@src/widgets/ProgressiveProfilingQuiz/data/constants';\nimport BaseStep from '../BaseStep';\nimport InterestsDeclaredAutosuggest, { AutosuggestValue } from './InterestsDeclaredAutosuggest';\nimport { useSkills } from '@src/widgets/ProgressiveProfilingQuiz/data';\nimport { buildAnswerRecord } from '@src/widgets/ProgressiveProfilingQuiz/data/schemaUtils';\nimport buildInterestsDeclaredSchema from './schema';\n\nconst EMPTY_AUTOSUGGEST_VALUE: AutosuggestValue = {\n userProvidedText: '',\n selectionValue: '',\n selectionId: '',\n};\n\nimport stepMessages from '../messages';\nimport messages from './messages';\n\nimport './index.scss';\n\nconst InterestsDeclaredStep: React.FC = () => {\n const {\n goToPreviousStep, goToNextStep, answers, recordAnswer,\n } = useProgressiveProfilingQuiz();\n const { formatMessage } = useIntl();\n\n const [inputValue, setInputValue] = useState<AutosuggestValue>(EMPTY_AUTOSUGGEST_VALUE);\n\n const { data: skills } = useSkills();\n const schema = buildInterestsDeclaredSchema(skills ?? []);\n const interestInput = answers[schema.questionId]?.selectedValues ?? [];\n\n const addInterest = (value: string) => {\n if (interestInput.includes(value)) {\n return;\n }\n recordAnswer(buildAnswerRecord(schema, [...interestInput, value], formatMessage));\n };\n\n const removeInterest = (value: string) => {\n const newInterestInput = interestInput.filter(item => value !== item);\n recordAnswer(buildAnswerRecord(schema, newInterestInput, formatMessage));\n };\n\n const handleAutosuggestChange = (value: AutosuggestValue) => {\n setInputValue(value);\n\n if (value.selectionValue) {\n addInterest(value.selectionValue);\n }\n };\n\n const handleCheckboxTopicToggle = (event: React.ChangeEvent<HTMLInputElement>) => {\n const { value, checked } = event.target;\n\n const nextValues = checked\n ? [...interestInput, value]\n : interestInput.filter((interest) => interest !== value);\n recordAnswer(buildAnswerRecord(schema, nextValues, formatMessage));\n };\n\n return (\n <>\n <BaseStep\n eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.INTERESTS_DECLARED}\n title={formatMessage(messages.title)}\n index={2}\n >\n <h4>{formatMessage(messages.question)}</h4>\n <p>{formatMessage(messages.subtitle)}</p>\n <div className=\"d-flex flex-column gap-2\">\n <InterestsDeclaredAutosuggest\n inputValue={inputValue}\n onChange={handleAutosuggestChange}\n skills={skills}\n />\n <div>\n {interestInput.map(interest => (\n <Chip\n key={interest}\n iconAfter={Close}\n iconAfterAlt={formatMessage(messages.removeInterestIconAlt)}\n variant=\"dark\"\n onIconAfterClick={() => removeInterest(interest)}\n >\n {interest}\n </Chip>\n ))}\n </div>\n <p className=\"font-weight-bold\">{formatMessage(messages.popularTopicsLabel)}</p>\n <Form.CheckboxSet\n name=\"interests-declared-topics\"\n isInline\n value={interestInput}\n onChange={handleCheckboxTopicToggle}\n className=\"interests-declared-checkbox-set\"\n >\n {skills?.slice(0, 10).map(skill => (\n <Form.Checkbox key={skill.value} value={skill.value} className=\"ml-0 mr-3\">\n {skill.value}\n </Form.Checkbox>\n ))}\n </Form.CheckboxSet>\n </div>\n </BaseStep>\n <Stepper.ActionRow eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.INTERESTS_DECLARED}>\n <Button variant=\"outline-primary\" onClick={goToPreviousStep}>\n {formatMessage(stepMessages.backButton)}\n </Button>\n <Button onClick={goToNextStep}>\n {formatMessage(stepMessages.nextButton)}\n </Button>\n </Stepper.ActionRow>\n </>\n );\n};\n\nexport default InterestsDeclaredStep;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-interests-declared/index.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ACf,IACG,EACX,MAAC,OAAO,CAAC,SAAS,IAAC,QAAQ,EAAE,gCAAgC,CAAC,kBAAkB,aAC9E,KAAC,MAAM,IAAC,OAAO,EAAC,iBAAiB,EAAC,OAAO,EAAE,gBAAgB,YACxD,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,GAChC,EACT,KAAC,MAAM,IAAC,OAAO,EAAE,YAAY,YAC1B,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,GAChC,IACS,IACnB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { Stepper, Button, Form, Chip } from '@openedx/paragon';\nimport { Close } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport { useProgressiveProfilingQuiz } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\nimport { PROGRESSIVE_PROFILING_QUIZ_STEPS } from '@src/widgets/ProgressiveProfilingQuiz/data/constants';\nimport BaseStep from '../BaseStep';\nimport InterestsDeclaredAutosuggest from './InterestsDeclaredAutosuggest';\nimport { useSkills, AutosuggestValue } from '@src/widgets/ProgressiveProfilingQuiz/data';\nimport { buildAnswerRecord } from '@src/widgets/ProgressiveProfilingQuiz/data/schemaUtils';\nimport buildInterestsDeclaredSchema from './schema';\n\nconst EMPTY_AUTOSUGGEST_VALUE: AutosuggestValue = {\n userProvidedText: '',\n selectionValue: '',\n selectionId: '',\n};\n\nimport stepMessages from '../messages';\nimport messages from './messages';\n\nimport './index.scss';\n\nconst InterestsDeclaredStep: React.FC = () => {\n const {\n goToPreviousStep, goToNextStep, answers, recordAnswer,\n } = useProgressiveProfilingQuiz();\n const { formatMessage } = useIntl();\n\n const [inputValue, setInputValue] = useState<AutosuggestValue>(EMPTY_AUTOSUGGEST_VALUE);\n\n const { data: skills } = useSkills();\n const schema = buildInterestsDeclaredSchema(skills ?? []);\n const interestInput = answers[schema.questionId]?.selectedValues ?? [];\n\n const addInterest = (value: string) => {\n if (interestInput.includes(value)) {\n return;\n }\n recordAnswer(buildAnswerRecord(schema, [...interestInput, value], formatMessage));\n };\n\n const removeInterest = (value: string) => {\n const newInterestInput = interestInput.filter(item => value !== item);\n recordAnswer(buildAnswerRecord(schema, newInterestInput, formatMessage));\n };\n\n const handleAutosuggestChange = (value: AutosuggestValue) => {\n setInputValue(value);\n\n if (value.selectionValue) {\n addInterest(value.selectionValue);\n }\n };\n\n const handleCheckboxTopicToggle = (event: React.ChangeEvent<HTMLInputElement>) => {\n const { value, checked } = event.target;\n\n const nextValues = checked\n ? [...interestInput, value]\n : interestInput.filter((interest) => interest !== value);\n recordAnswer(buildAnswerRecord(schema, nextValues, formatMessage));\n };\n\n return (\n <>\n <BaseStep\n eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.INTERESTS_DECLARED}\n title={formatMessage(messages.title)}\n index={2}\n >\n <h4>{formatMessage(messages.question)}</h4>\n <p>{formatMessage(messages.subtitle)}</p>\n <div className=\"d-flex flex-column gap-2\">\n <InterestsDeclaredAutosuggest\n inputValue={inputValue}\n onChange={handleAutosuggestChange}\n skills={skills}\n />\n <div>\n {interestInput.map(interest => (\n <Chip\n key={interest}\n iconAfter={Close}\n iconAfterAlt={formatMessage(messages.removeInterestIconAlt)}\n variant=\"dark\"\n onIconAfterClick={() => removeInterest(interest)}\n >\n {interest}\n </Chip>\n ))}\n </div>\n <p className=\"font-weight-bold\">{formatMessage(messages.popularTopicsLabel)}</p>\n <Form.CheckboxSet\n name=\"interests-declared-topics\"\n isInline\n value={interestInput}\n onChange={handleCheckboxTopicToggle}\n className=\"interests-declared-checkbox-set\"\n >\n {skills?.slice(0, 10).map(skill => (\n <Form.Checkbox key={skill.value} value={skill.value} className=\"ml-0 mr-3\">\n {skill.value}\n </Form.Checkbox>\n ))}\n </Form.CheckboxSet>\n </div>\n </BaseStep>\n <Stepper.ActionRow eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.INTERESTS_DECLARED}>\n <Button variant=\"outline-primary\" onClick={goToPreviousStep}>\n {formatMessage(stepMessages.backButton)}\n </Button>\n <Button onClick={goToNextStep}>\n {formatMessage(stepMessages.nextButton)}\n </Button>\n </Stepper.ActionRow>\n </>\n );\n};\n\nexport default InterestsDeclaredStep;\n"]}
@@ -23,7 +23,7 @@ const LearningGoalStep = () => {
23
23
  }
24
24
  (_a = event.currentTarget.querySelector('input[type="radio"]')) === null || _a === void 0 ? void 0 : _a.click();
25
25
  };
26
- return (_jsxs(_Fragment, { children: [_jsx(BaseStep, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_GOAL, title: formatMessage(messages.title), index: 0, optionalHeaderText: formatMessage(messages.headerText), children: _jsxs(Form.Group, { className: "mb-0", children: [_jsx(Form.Label, { className: "h4", children: formatMessage(messages.question) }), _jsx("p", { children: "Select one" }), _jsx(Form.RadioSet, { name: schema.questionId, value: selectedValue, onChange: handleChange, className: "gap-4", children: schema.options.map(option => (_jsx("div", { className: "learning-goal-radio d-flex bg-light-100 px-3 py-3.5 mt-0", onClick: handleOptionClick, children: _jsx(Form.Radio, { value: option.value, children: formatMessage(option.message) }) }, option.value))) })] }) }), _jsxs(Stepper.ActionRow, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_GOAL, children: [_jsx(Stepper.ActionRow.Spacer, {}), _jsx(Button, { variant: "outline-primary", onClick: goToNextStep, disabled: !selectedValue, children: formatMessage(messages.continueButton) })] })] }));
26
+ return (_jsxs(_Fragment, { children: [_jsx(BaseStep, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_GOAL, title: formatMessage(messages.title), index: 0, optionalHeaderText: formatMessage(messages.headerText), children: _jsxs(Form.Group, { className: "mb-0", children: [_jsx(Form.Label, { className: "h4", children: formatMessage(messages.question) }), _jsx("p", { children: formatMessage(messages.hint) }), _jsx(Form.RadioSet, { name: schema.questionId, value: selectedValue, onChange: handleChange, className: "gap-4", children: schema.options.map(option => (_jsx("div", { className: "learning-goal-radio d-flex bg-light-100 px-3 py-3.5 mt-0", onClick: handleOptionClick, children: _jsx(Form.Radio, { value: option.value, children: formatMessage(option.message) }) }, option.value))) })] }) }), _jsxs(Stepper.ActionRow, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_GOAL, children: [_jsx(Stepper.ActionRow.Spacer, {}), _jsx(Button, { variant: "outline-primary", onClick: goToNextStep, disabled: !selectedValue, children: formatMessage(messages.continueButton) })] })] }));
27
27
  };
28
28
  export default LearningGoalStep;
29
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-learning-goal/index.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,OAAO,EAAE,MAAM,EAAE,IAAI,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,wEAAwE,CAAC;AACrH,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAC3F,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,cAAc,CAAC;AAEtB,MAAM,gBAAgB,GAAa,GAAG,EAAE;;IACtC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,2BAA2B,EAAE,CAAC;IAC9E,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,MAAM,aAAa,GAAG,MAAA,MAAA,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,0CAAE,cAAc,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC;IAE1E,MAAM,YAAY,GAAG,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,EACX,MAAC,OAAO,CAAC,SAAS,IAAC,QAAQ,EAAE,gCAAgC,CAAC,aAAa,aACzE,KAAC,OAAO,CAAC,SAAS,CAAC,MAAM,KAAG,EAC5B,KAAC,MAAM,IAAC,OAAO,EAAC,iBAAiB,EAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,aAAa,YAC9E,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,GAChC,IACS,IACnB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import React from 'react';\nimport {\n Stepper, Button, Form,\n} from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport BaseStep from '../BaseStep';\nimport { useProgressiveProfilingQuiz } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\nimport { PROGRESSIVE_PROFILING_QUIZ_STEPS } from '@src/widgets/ProgressiveProfilingQuiz/data/constants';\nimport { buildAnswerRecord } from '@src/widgets/ProgressiveProfilingQuiz/data/schemaUtils';\nimport messages from './messages';\nimport schema from './schema';\n\nimport './index.scss';\n\nconst LearningGoalStep: React.FC = () => {\n const { goToNextStep, answers, recordAnswer } = useProgressiveProfilingQuiz();\n const { formatMessage } = useIntl();\n\n const selectedValue = answers[schema.questionId]?.selectedValues[0] ?? '';\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n recordAnswer(buildAnswerRecord(schema, [event.target.value], formatMessage));\n };\n\n const handleOptionClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) {\n return;\n }\n event.currentTarget.querySelector<HTMLInputElement>('input[type=\"radio\"]')?.click();\n };\n\n return (\n <>\n <BaseStep\n eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_GOAL}\n title={formatMessage(messages.title)}\n index={0}\n optionalHeaderText={formatMessage(messages.headerText)}\n >\n <Form.Group className=\"mb-0\">\n <Form.Label className=\"h4\">\n {formatMessage(messages.question)}\n </Form.Label>\n <p>Select one</p>\n <Form.RadioSet\n name={schema.questionId}\n value={selectedValue}\n onChange={handleChange}\n className=\"gap-4\"\n >\n {schema.options.map(option => (\n <div\n key={option.value}\n className=\"learning-goal-radio d-flex bg-light-100 px-3 py-3.5 mt-0\"\n onClick={handleOptionClick}\n >\n <Form.Radio value={option.value}>\n {formatMessage(option.message)}\n </Form.Radio>\n </div>\n ))}\n </Form.RadioSet>\n </Form.Group>\n </BaseStep>\n <Stepper.ActionRow eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_GOAL}>\n <Stepper.ActionRow.Spacer />\n <Button variant=\"outline-primary\" onClick={goToNextStep} disabled={!selectedValue}>\n {formatMessage(messages.continueButton)}\n </Button>\n </Stepper.ActionRow>\n </>\n );\n};\n\nexport default LearningGoalStep;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-learning-goal/index.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,OAAO,EAAE,MAAM,EAAE,IAAI,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,wEAAwE,CAAC;AACrH,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAC3F,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,cAAc,CAAC;AAEtB,MAAM,gBAAgB,GAAa,GAAG,EAAE;;IACtC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,2BAA2B,EAAE,CAAC;IAC9E,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEp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O,EAAE,iBAAiB,YAE1B,KAAC,IAAI,CAAC,KAAK,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAC5B,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,GACnB,IANR,MAAM,CAAC,KAAK,CAOb,CACP,CAAC,GACY,IACL,GACJ,EACX,MAAC,OAAO,CAAC,SAAS,IAAC,QAAQ,EAAE,gCAAgC,CAAC,aAAa,aACzE,KAAC,OAAO,CAAC,SAAS,CAAC,MAAM,KAAG,EAC5B,KAAC,MAAM,IAAC,OAAO,EAAC,iBAAiB,EAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,aAAa,YAC9E,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,GAChC,IACS,IACnB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import React from 'react';\nimport {\n Stepper, Button, Form,\n} from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport BaseStep from '../BaseStep';\nimport { useProgressiveProfilingQuiz } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\nimport { PROGRESSIVE_PROFILING_QUIZ_STEPS } from '@src/widgets/ProgressiveProfilingQuiz/data/constants';\nimport { buildAnswerRecord } from '@src/widgets/ProgressiveProfilingQuiz/data/schemaUtils';\nimport messages from './messages';\nimport schema from './schema';\n\nimport './index.scss';\n\nconst LearningGoalStep: React.FC = () => {\n const { goToNextStep, answers, recordAnswer } = useProgressiveProfilingQuiz();\n const { formatMessage } = useIntl();\n\n const selectedValue = answers[schema.questionId]?.selectedValues[0] ?? '';\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n recordAnswer(buildAnswerRecord(schema, [event.target.value], formatMessage));\n };\n\n const handleOptionClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) {\n return;\n }\n event.currentTarget.querySelector<HTMLInputElement>('input[type=\"radio\"]')?.click();\n };\n\n return (\n <>\n <BaseStep\n eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_GOAL}\n title={formatMessage(messages.title)}\n index={0}\n optionalHeaderText={formatMessage(messages.headerText)}\n >\n <Form.Group className=\"mb-0\">\n <Form.Label className=\"h4\">\n {formatMessage(messages.question)}\n </Form.Label>\n <p>{formatMessage(messages.hint)}</p>\n <Form.RadioSet\n name={schema.questionId}\n value={selectedValue}\n onChange={handleChange}\n className=\"gap-4\"\n >\n {schema.options.map(option => (\n <div\n key={option.value}\n className=\"learning-goal-radio d-flex bg-light-100 px-3 py-3.5 mt-0\"\n onClick={handleOptionClick}\n >\n <Form.Radio value={option.value}>\n {formatMessage(option.message)}\n </Form.Radio>\n </div>\n ))}\n </Form.RadioSet>\n </Form.Group>\n </BaseStep>\n <Stepper.ActionRow eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_GOAL}>\n <Stepper.ActionRow.Spacer />\n <Button variant=\"outline-primary\" onClick={goToNextStep} disabled={!selectedValue}>\n {formatMessage(messages.continueButton)}\n </Button>\n </Stepper.ActionRow>\n </>\n );\n};\n\nexport default LearningGoalStep;\n"]}
@@ -28,7 +28,7 @@ const LearningMotivationStep = () => {
28
28
  }
29
29
  (_a = event.currentTarget.querySelector('input[type="checkbox"]')) === null || _a === void 0 ? void 0 : _a.click();
30
30
  };
31
- return (_jsxs(_Fragment, { children: [_jsx(BaseStep, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_MOTIVATION, title: formatMessage(messages.title), index: 1, children: _jsxs(Form.Group, { className: "mb-0", children: [_jsx(Form.Label, { className: "h4", children: formatMessage(messages.question) }), _jsx("p", { children: "Select one or more" }), _jsx(Form.CheckboxSet, { name: schema.questionId, value: selectedValues, onChange: handleChange, className: "gap-4", children: schema.options.map(option => (_jsx("div", { className: "learning-motivation-checkbox d-flex bg-light-100 px-3 py-3.5 mt-0", onClick: handleOptionClick, children: _jsx(Form.Checkbox, { value: option.value, children: formatMessage(option.message) }) }, option.value))) })] }) }), _jsxs(Stepper.ActionRow, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_MOTIVATION, children: [_jsx(Button, { variant: "outline-primary", onClick: goToPreviousStep, children: formatMessage(stepMessages.backButton) }), _jsx(Button, { onClick: goToNextStep, disabled: selectedValues.length === 0, className: "ml-3", children: formatMessage(stepMessages.nextButton) })] })] }));
31
+ return (_jsxs(_Fragment, { children: [_jsx(BaseStep, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_MOTIVATION, title: formatMessage(messages.title), index: 1, children: _jsxs(Form.Group, { className: "mb-0", children: [_jsx(Form.Label, { className: "h4", children: formatMessage(messages.question) }), _jsx("p", { children: formatMessage(messages.hint) }), _jsx(Form.CheckboxSet, { name: schema.questionId, value: selectedValues, onChange: handleChange, className: "gap-4", children: schema.options.map(option => (_jsx("div", { className: "learning-motivation-checkbox d-flex bg-light-100 px-3 py-3.5 mt-0", onClick: handleOptionClick, children: _jsx(Form.Checkbox, { value: option.value, children: formatMessage(option.message) }) }, option.value))) })] }) }), _jsxs(Stepper.ActionRow, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_MOTIVATION, children: [_jsx(Button, { variant: "outline-primary", onClick: goToPreviousStep, children: formatMessage(stepMessages.backButton) }), _jsx(Button, { onClick: goToNextStep, disabled: selectedValues.length === 0, className: "ml-3", children: formatMessage(stepMessages.nextButton) })] })] }));
32
32
  };
33
33
  export default LearningMotivationStep;
34
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-learning-motivation/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,QAAQ,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 'react';\nimport { Stepper, Button, Form } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport BaseStep from '../BaseStep';\nimport { useProgressiveProfilingQuiz } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\nimport { PROGRESSIVE_PROFILING_QUIZ_STEPS } from '@src/widgets/ProgressiveProfilingQuiz/data/constants';\nimport { buildAnswerRecord } from '@src/widgets/ProgressiveProfilingQuiz/data/schemaUtils';\nimport stepMessages from '../messages';\nimport messages from './messages';\nimport schema from './schema';\n\nimport './index.scss';\n\nconst LearningMotivationStep: React.FC = () => {\n const {\n goToPreviousStep, goToNextStep, answers, recordAnswer,\n } = useProgressiveProfilingQuiz();\n const { formatMessage } = useIntl();\n\n const selectedValues = answers[schema.questionId]?.selectedValues ?? [];\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const { checked, value } = event.target;\n const nextValues = checked\n ? [...selectedValues, value]\n : selectedValues.filter(selectedValue => selectedValue !== value);\n recordAnswer(buildAnswerRecord(schema, nextValues, formatMessage));\n };\n\n const handleOptionClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) {\n return;\n }\n event.currentTarget.querySelector<HTMLInputElement>('input[type=\"checkbox\"]')?.click();\n };\n\n return (\n <>\n <BaseStep\n eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_MOTIVATION}\n title={formatMessage(messages.title)}\n index={1}\n >\n <Form.Group className=\"mb-0\">\n <Form.Label className=\"h4\">\n {formatMessage(messages.question)}\n </Form.Label>\n <p>Select one or more</p>\n <Form.CheckboxSet\n name={schema.questionId}\n value={selectedValues}\n onChange={handleChange}\n className=\"gap-4\"\n >\n {schema.options.map(option => (\n <div\n key={option.value}\n className=\"learning-motivation-checkbox d-flex bg-light-100 px-3 py-3.5 mt-0\"\n onClick={handleOptionClick}\n >\n <Form.Checkbox value={option.value}>\n {formatMessage(option.message)}\n </Form.Checkbox>\n </div>\n ))}\n </Form.CheckboxSet>\n </Form.Group>\n </BaseStep>\n <Stepper.ActionRow eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_MOTIVATION}>\n <Button variant=\"outline-primary\" onClick={goToPreviousStep}>\n {formatMessage(stepMessages.backButton)}\n </Button>\n <Button onClick={goToNextStep} disabled={selectedValues.length === 0} className=\"ml-3\">\n {formatMessage(stepMessages.nextButton)}\n </Button>\n </Stepper.ActionRow>\n </>\n );\n};\n\nexport default LearningMotivationStep;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-learning-motivation/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,wEAAwE,CAAC;AACrH,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAC3F,OAAO,YAAY,MAAM,aAAa,CAAC;AACvC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,cAAc,CAAC;AAEtB,MAAM,sBAAsB,GAAa,GAAG,EAAE;;IAC5C,MAAM,EACJ,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,GACtD,GAAG,2BAA2B,EAAE,CAAC;IAClC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,MAAM,cAAc,GAAG,MAAA,MAAA,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,0CAAE,cAAc,mCAAI,EAAE,CAAC;IAExE,MAAM,YAAY,GAAG,CAAC,KAA0C,EAAE,EAAE;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BAAiB,YAE1B,KAAC,IAAI,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAC/B,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,GAChB,IANX,MAAM,CAAC,KAAK,CAOb,CACP,CAAC,GACe,IACR,GACJ,EACX,MAAC,OAAO,CAAC,SAAS,IAAC,QAAQ,EAAE,gCAAgC,CAAC,mBAAmB,aAC/E,KAAC,MAAM,IAAC,OAAO,EAAC,iBAAiB,EAAC,OAAO,EAAE,gBAAgB,YACxD,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,GAChC,EACT,KAAC,MAAM,IAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,SAAS,EAAC,MAAM,YACnF,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,GAChC,IACS,IACnB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import React from 'react';\nimport { Stepper, Button, Form } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport BaseStep from '../BaseStep';\nimport { useProgressiveProfilingQuiz } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\nimport { PROGRESSIVE_PROFILING_QUIZ_STEPS } from '@src/widgets/ProgressiveProfilingQuiz/data/constants';\nimport { buildAnswerRecord } from '@src/widgets/ProgressiveProfilingQuiz/data/schemaUtils';\nimport stepMessages from '../messages';\nimport messages from './messages';\nimport schema from './schema';\n\nimport './index.scss';\n\nconst LearningMotivationStep: React.FC = () => {\n const {\n goToPreviousStep, goToNextStep, answers, recordAnswer,\n } = useProgressiveProfilingQuiz();\n const { formatMessage } = useIntl();\n\n const selectedValues = answers[schema.questionId]?.selectedValues ?? [];\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const { checked, value } = event.target;\n const nextValues = checked\n ? [...selectedValues, value]\n : selectedValues.filter(selectedValue => selectedValue !== value);\n recordAnswer(buildAnswerRecord(schema, nextValues, formatMessage));\n };\n\n const handleOptionClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) {\n return;\n }\n event.currentTarget.querySelector<HTMLInputElement>('input[type=\"checkbox\"]')?.click();\n };\n\n return (\n <>\n <BaseStep\n eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_MOTIVATION}\n title={formatMessage(messages.title)}\n index={1}\n >\n <Form.Group className=\"mb-0\">\n <Form.Label className=\"h4\">\n {formatMessage(messages.question)}\n </Form.Label>\n <p>{formatMessage(messages.hint)}</p>\n <Form.CheckboxSet\n name={schema.questionId}\n value={selectedValues}\n onChange={handleChange}\n className=\"gap-4\"\n >\n {schema.options.map(option => (\n <div\n key={option.value}\n className=\"learning-motivation-checkbox d-flex bg-light-100 px-3 py-3.5 mt-0\"\n onClick={handleOptionClick}\n >\n <Form.Checkbox value={option.value}>\n {formatMessage(option.message)}\n </Form.Checkbox>\n </div>\n ))}\n </Form.CheckboxSet>\n </Form.Group>\n </BaseStep>\n <Stepper.ActionRow eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.LEARNING_MOTIVATION}>\n <Button variant=\"outline-primary\" onClick={goToPreviousStep}>\n {formatMessage(stepMessages.backButton)}\n </Button>\n <Button onClick={goToNextStep} disabled={selectedValues.length === 0} className=\"ml-3\">\n {formatMessage(stepMessages.nextButton)}\n </Button>\n </Stepper.ActionRow>\n </>\n );\n};\n\nexport default LearningMotivationStep;\n"]}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const ViewResultsButton: React.FC;
3
+ export default ViewResultsButton;
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button } from '@openedx/paragon';
3
+ import { useNavigate } from 'react-router';
4
+ import { useIntl } from '@openedx/frontend-base';
5
+ import { useProgressiveProfilingQuiz } from '../../../../../../widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';
6
+ import { useSaveAnswers } from '../../../../../../widgets/ProgressiveProfilingQuiz/data';
7
+ import { PROGRESSIVE_PROFILING_QUIZ_STEPS } from '../../../../../../widgets/ProgressiveProfilingQuiz/data/constants';
8
+ import messages from './messages';
9
+ const ViewResultsButton = () => {
10
+ const { formatMessage } = useIntl();
11
+ const { answers, setIsComplete, closeModal } = useProgressiveProfilingQuiz();
12
+ const { mutate: saveAnswers, isPending } = useSaveAnswers();
13
+ const navigate = useNavigate();
14
+ const handleClick = () => {
15
+ var _a, _b;
16
+ saveAnswers(answers, { onSuccess: () => setIsComplete(true) });
17
+ closeModal();
18
+ const interest = (_b = (_a = answers[PROGRESSIVE_PROFILING_QUIZ_STEPS.INTERESTS_DECLARED]) === null || _a === void 0 ? void 0 : _a.selectedValues[0]) !== null && _b !== void 0 ? _b : '';
19
+ const searchParams = new URLSearchParams({ q: interest });
20
+ navigate(`/subscription-search?${searchParams.toString()}`);
21
+ };
22
+ return (_jsx(Button, { onClick: handleClick, disabled: isPending, children: formatMessage(messages.viewResultsButton) }));
23
+ };
24
+ export default ViewResultsButton;
25
+ //# sourceMappingURL=ViewResultsButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewResultsButton.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-work-status/ViewResultsButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wEAAwE,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;AACxG,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,iBAAiB,GAAa,GAAG,EAAE;IACvC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,2BAA2B,EAAE,CAAC;IAC7E,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IAE5D,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE/B,MAAM,WAAW,GAAG,GAAG,EAAE;;QACvB,WAAW,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/D,UAAU,EAAE,CAAC;QAEb,MAAM,QAAQ,GAAG,MAAA,MAAA,OAAO,CAAC,gCAAgC,CAAC,kBAAkB,CAAC,0CAAE,cAAc,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC;QACvG,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC1D,QAAQ,CAAC,wBAAwB,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,YAC9C,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GACnC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import React from 'react';\nimport { Button } from '@openedx/paragon';\nimport { useNavigate } from 'react-router';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { useProgressiveProfilingQuiz } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\nimport { useSaveAnswers } from '@src/widgets/ProgressiveProfilingQuiz/data';\nimport { PROGRESSIVE_PROFILING_QUIZ_STEPS } from '@src/widgets/ProgressiveProfilingQuiz/data/constants';\nimport messages from './messages';\n\nconst ViewResultsButton: React.FC = () => {\n const { formatMessage } = useIntl();\n const { answers, setIsComplete, closeModal } = useProgressiveProfilingQuiz();\n const { mutate: saveAnswers, isPending } = useSaveAnswers();\n\n const navigate = useNavigate();\n\n const handleClick = () => {\n saveAnswers(answers, { onSuccess: () => setIsComplete(true) });\n closeModal();\n\n const interest = answers[PROGRESSIVE_PROFILING_QUIZ_STEPS.INTERESTS_DECLARED]?.selectedValues[0] ?? '';\n const searchParams = new URLSearchParams({ q: interest });\n navigate(`/subscription-search?${searchParams.toString()}`);\n };\n\n return (\n <Button onClick={handleClick} disabled={isPending}>\n {formatMessage(messages.viewResultsButton)}\n </Button>\n );\n};\n\nexport default ViewResultsButton;\n"]}
@@ -10,6 +10,7 @@ import BaseStep from '../BaseStep';
10
10
  import stepMessages from '../messages';
11
11
  import messages from './messages';
12
12
  import schema, { NOT_EMPLOYED_VALUE } from './schema';
13
+ import ViewResultsButton from './ViewResultsButton';
13
14
  const EMPTY_AUTOSUGGEST_VALUE = {
14
15
  userProvidedText: '',
15
16
  selectionValue: '',
@@ -35,7 +36,7 @@ const WorkStatusStep = () => {
35
36
  }
36
37
  recordAnswer(buildAnswerRecord(schema, checked ? [NOT_EMPLOYED_VALUE] : [], formatMessage));
37
38
  };
38
- return (_jsxs(_Fragment, { children: [_jsxs(BaseStep, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS, title: formatMessage(messages.title), index: 3, children: [_jsx("h4", { children: formatMessage(messages.question) }), _jsx("p", { children: formatMessage(messages.subtitle) }), _jsx(Form.Autosuggest, { name: "work-status-autosuggest", value: inputValue, onChange: handleJobSelect, className: "h-50", children: jobsList === null || jobsList === void 0 ? void 0 : jobsList.map(job => (_jsx(Form.AutosuggestOption, { id: job.jobTitle.replaceAll(' ', '-').toLowerCase(), children: job.jobTitle }, job.jobTitle))) }), _jsx(Form.Checkbox, { className: "mt-6", checked: isNotEmployed, onChange: handleNotEmployedToggle, children: formatMessage(messages.notEmployedOption) })] }), _jsxs(Stepper.ActionRow, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS, children: [_jsx(Button, { variant: "outline-primary", onClick: goToPreviousStep, children: formatMessage(stepMessages.backButton) }), _jsx(Button, { children: formatMessage(messages.viewResultsButton) })] })] }));
39
+ return (_jsxs(_Fragment, { children: [_jsxs(BaseStep, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS, title: formatMessage(messages.title), index: 3, children: [_jsx("h4", { children: formatMessage(messages.question) }), _jsx("p", { children: formatMessage(messages.subtitle) }), _jsx(Form.Autosuggest, { name: "work-status-autosuggest", value: inputValue, onChange: handleJobSelect, className: "h-50", children: jobsList === null || jobsList === void 0 ? void 0 : jobsList.map(job => (_jsx(Form.AutosuggestOption, { id: job.jobTitle.replaceAll(' ', '-').toLowerCase(), children: job.jobTitle }, job.jobTitle))) }), _jsx(Form.Checkbox, { className: "mt-6", checked: isNotEmployed, onChange: handleNotEmployedToggle, children: formatMessage(messages.notEmployedOption) })] }), _jsxs(Stepper.ActionRow, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS, children: [_jsx(Button, { variant: "outline-primary", onClick: goToPreviousStep, children: formatMessage(stepMessages.backButton) }), _jsx(ViewResultsButton, {})] })] }));
39
40
  };
40
41
  export default WorkStatusStep;
41
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-work-status/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wEAAwE,CAAC;AACrH,OAAO,EA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YACxD,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,GAChC,EACT,KAAC,MAAM,cACJ,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GACnC,IACS,IACnB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { Stepper, Button, Form } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport { useProgressiveProfilingQuiz } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\nimport { PROGRESSIVE_PROFILING_QUIZ_STEPS } from '@src/widgets/ProgressiveProfilingQuiz/data/constants';\nimport { AutosuggestValue } from '@src/widgets/ProgressiveProfilingQuiz/data';\nimport { buildAnswerRecord } from '@src/widgets/ProgressiveProfilingQuiz/data/schemaUtils';\nimport jobsList from '@src/widgets/ProgressiveProfilingQuiz/data/jobsList';\nimport BaseStep from '../BaseStep';\nimport stepMessages from '../messages';\nimport messages from './messages';\nimport schema, { NOT_EMPLOYED_VALUE } from './schema';\n\nconst EMPTY_AUTOSUGGEST_VALUE: AutosuggestValue = {\n userProvidedText: '',\n selectionValue: '',\n selectionId: '',\n};\n\nconst WorkStatusStep: React.FC = () => {\n const {\n goToPreviousStep, answers, recordAnswer,\n } = useProgressiveProfilingQuiz();\n const { formatMessage } = useIntl();\n\n const [inputValue, setInputValue] = useState<AutosuggestValue>(EMPTY_AUTOSUGGEST_VALUE);\n\n const selectedValue = answers[schema.questionId]?.selectedValues[0] ?? '';\n const isNotEmployed = selectedValue === NOT_EMPLOYED_VALUE;\n\n const handleJobSelect = (value: AutosuggestValue) => {\n setInputValue(value);\n\n if (value.selectionValue) {\n recordAnswer(buildAnswerRecord(schema, [value.selectionValue], formatMessage));\n }\n };\n\n const handleNotEmployedToggle = (event: React.ChangeEvent<HTMLInputElement>) => {\n const { checked } = event.target;\n\n if (checked) {\n setInputValue(EMPTY_AUTOSUGGEST_VALUE);\n }\n recordAnswer(buildAnswerRecord(schema, checked ? [NOT_EMPLOYED_VALUE] : [], formatMessage));\n };\n\n return (\n <>\n <BaseStep\n eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS}\n title={formatMessage(messages.title)}\n index={3}\n >\n <h4>\n {formatMessage(messages.question)}\n </h4>\n <p>\n {formatMessage(messages.subtitle)}\n </p>\n <Form.Autosuggest\n name=\"work-status-autosuggest\"\n value={inputValue}\n onChange={handleJobSelect}\n className=\"h-50\"\n >\n {jobsList?.map(job => (\n <Form.AutosuggestOption\n key={job.jobTitle}\n id={job.jobTitle.replaceAll(' ', '-').toLowerCase()}\n >\n {job.jobTitle}\n </Form.AutosuggestOption>\n ))}\n </Form.Autosuggest>\n <Form.Checkbox\n className=\"mt-6\"\n checked={isNotEmployed}\n onChange={handleNotEmployedToggle}\n >\n {formatMessage(messages.notEmployedOption)}\n </Form.Checkbox>\n </BaseStep>\n <Stepper.ActionRow eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS}>\n <Button variant=\"outline-primary\" onClick={goToPreviousStep}>\n {formatMessage(stepMessages.backButton)}\n </Button>\n <Button>\n {formatMessage(messages.viewResultsButton)}\n </Button>\n </Stepper.ActionRow>\n </>\n );\n};\n\nexport default WorkStatusStep;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/step-work-status/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wEAAwE,CAAC;AACrH,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;AAExG,OAAO,EAAE,iBAAiB,EAAE,MAAM,wDAAw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GAChC,EACT,KAAC,iBAAiB,KAAG,IACH,IACnB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { Stepper, Button, Form } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport { useProgressiveProfilingQuiz } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\nimport { PROGRESSIVE_PROFILING_QUIZ_STEPS } from '@src/widgets/ProgressiveProfilingQuiz/data/constants';\nimport { AutosuggestValue } from '@src/widgets/ProgressiveProfilingQuiz/data';\nimport { buildAnswerRecord } from '@src/widgets/ProgressiveProfilingQuiz/data/schemaUtils';\nimport jobsList from '@src/widgets/ProgressiveProfilingQuiz/data/jobsList';\nimport BaseStep from '../BaseStep';\nimport stepMessages from '../messages';\nimport messages from './messages';\nimport schema, { NOT_EMPLOYED_VALUE } from './schema';\nimport ViewResultsButton from './ViewResultsButton';\n\nconst EMPTY_AUTOSUGGEST_VALUE: AutosuggestValue = {\n userProvidedText: '',\n selectionValue: '',\n selectionId: '',\n};\n\nconst WorkStatusStep: React.FC = () => {\n const {\n goToPreviousStep, answers, recordAnswer,\n } = useProgressiveProfilingQuiz();\n const { formatMessage } = useIntl();\n\n const [inputValue, setInputValue] = useState<AutosuggestValue>(EMPTY_AUTOSUGGEST_VALUE);\n\n const selectedValue = answers[schema.questionId]?.selectedValues[0] ?? '';\n const isNotEmployed = selectedValue === NOT_EMPLOYED_VALUE;\n\n const handleJobSelect = (value: AutosuggestValue) => {\n setInputValue(value);\n\n if (value.selectionValue) {\n recordAnswer(buildAnswerRecord(schema, [value.selectionValue], formatMessage));\n }\n };\n\n const handleNotEmployedToggle = (event: React.ChangeEvent<HTMLInputElement>) => {\n const { checked } = event.target;\n\n if (checked) {\n setInputValue(EMPTY_AUTOSUGGEST_VALUE);\n }\n recordAnswer(buildAnswerRecord(schema, checked ? [NOT_EMPLOYED_VALUE] : [], formatMessage));\n };\n\n return (\n <>\n <BaseStep\n eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS}\n title={formatMessage(messages.title)}\n index={3}\n >\n <h4>\n {formatMessage(messages.question)}\n </h4>\n <p>\n {formatMessage(messages.subtitle)}\n </p>\n <Form.Autosuggest\n name=\"work-status-autosuggest\"\n value={inputValue}\n onChange={handleJobSelect}\n className=\"h-50\"\n >\n {jobsList?.map(job => (\n <Form.AutosuggestOption\n key={job.jobTitle}\n id={job.jobTitle.replaceAll(' ', '-').toLowerCase()}\n >\n {job.jobTitle}\n </Form.AutosuggestOption>\n ))}\n </Form.Autosuggest>\n <Form.Checkbox\n className=\"mt-6\"\n checked={isNotEmployed}\n onChange={handleNotEmployedToggle}\n >\n {formatMessage(messages.notEmployedOption)}\n </Form.Checkbox>\n </BaseStep>\n <Stepper.ActionRow eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS}>\n <Button variant=\"outline-primary\" onClick={goToPreviousStep}>\n {formatMessage(stepMessages.backButton)}\n </Button>\n <ViewResultsButton />\n </Stepper.ActionRow>\n </>\n );\n};\n\nexport default WorkStatusStep;\n"]}
@@ -1,7 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { render } from '@testing-library/react';
3
+ import { MemoryRouter } from 'react-router-dom';
3
4
  import { IntlProvider } from '@openedx/frontend-base';
4
5
  import { Stepper } from '@openedx/paragon';
6
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
7
  import { ProgressiveProfilingQuizProvider } from '../../../../../widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';
6
- export const renderStep = (step, activeKey, intlMessages = {}) => render(_jsx(IntlProvider, { locale: "en", messages: intlMessages, children: _jsx(ProgressiveProfilingQuizProvider, { children: _jsx(Stepper, { activeKey: activeKey, children: step }) }) }));
8
+ export const renderStep = (step, activeKey, intlMessages = {}) => {
9
+ const queryClient = new QueryClient({
10
+ defaultOptions: { queries: { retry: false } },
11
+ });
12
+ return render(_jsx(QueryClientProvider, { client: queryClient, children: _jsx(IntlProvider, { locale: "en", messages: intlMessages, children: _jsx(MemoryRouter, { children: _jsx(ProgressiveProfilingQuizProvider, { children: _jsx(Stepper, { activeKey: activeKey, children: step }) }) }) }) }));
13
+ };
7
14
  //# sourceMappingURL=test.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test.utils.js","sourceRoot":"","sources":["../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/test.utils.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,gCAAgC,EAAE,MAAM,wEAAwE,CAAC;AAE1H,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAkB,EAClB,SAAiB,EACjB,eAAuC,EAAE,EACzC,EAAE,CAAC,MAAM,CACT,KAAC,YAAY,IAAC,MAAM,EAAC,IAAI,EAAC,QAAQ,EAAE,YAAY,YAC9C,KAAC,gCAAgC,cAC/B,KAAC,OAAO,IAAC,SAAS,EAAE,SAAS,YAC1B,IAAI,GACG,GACuB,GACtB,CAChB,CAAC","sourcesContent":["import { ReactElement } from 'react';\nimport { render } from '@testing-library/react';\nimport { IntlProvider } from '@openedx/frontend-base';\nimport { Stepper } from '@openedx/paragon';\n\nimport { ProgressiveProfilingQuizProvider } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\n\nexport const renderStep = (\n step: ReactElement,\n activeKey: string,\n intlMessages: Record<string, string> = {},\n) => render(\n <IntlProvider locale=\"en\" messages={intlMessages}>\n <ProgressiveProfilingQuizProvider>\n <Stepper activeKey={activeKey}>\n {step}\n </Stepper>\n </ProgressiveProfilingQuizProvider>\n </IntlProvider>,\n);\n"]}
1
+ {"version":3,"file":"test.utils.js","sourceRoot":"","sources":["../../../../../../src/widgets/ProgressiveProfilingQuiz/modal/stepper/steps/test.utils.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,wEAAwE,CAAC;AAE1H,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAkB,EAClB,SAAiB,EACjB,eAAuC,EAAE,EACzC,EAAE;IACF,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC;QAClC,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;KAC9C,CAAC,CAAC;IAEH,OAAO,MAAM,CACX,KAAC,mBAAmB,IAAC,MAAM,EAAE,WAAW,YACtC,KAAC,YAAY,IAAC,MAAM,EAAC,IAAI,EAAC,QAAQ,EAAE,YAAY,YAC9C,KAAC,YAAY,cACX,KAAC,gCAAgC,cAC/B,KAAC,OAAO,IAAC,SAAS,EAAE,SAAS,YAC1B,IAAI,GACG,GACuB,GACtB,GACF,GACK,CACvB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { ReactElement } from 'react';\nimport { render } from '@testing-library/react';\nimport { MemoryRouter } from 'react-router-dom';\nimport { IntlProvider } from '@openedx/frontend-base';\nimport { Stepper } from '@openedx/paragon';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\n\nimport { ProgressiveProfilingQuizProvider } from '@src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';\n\nexport const renderStep = (\n step: ReactElement,\n activeKey: string,\n intlMessages: Record<string, string> = {},\n) => {\n const queryClient = new QueryClient({\n defaultOptions: { queries: { retry: false } },\n });\n\n return render(\n <QueryClientProvider client={queryClient}>\n <IntlProvider locale=\"en\" messages={intlMessages}>\n <MemoryRouter>\n <ProgressiveProfilingQuizProvider>\n <Stepper activeKey={activeKey}>\n {step}\n </Stepper>\n </ProgressiveProfilingQuizProvider>\n </MemoryRouter>\n </IntlProvider>\n </QueryClientProvider>,\n );\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-subscription-learner-dashboard",
3
- "version": "1.43.2",
3
+ "version": "1.44.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",