@edx/frontend-app-subscription-learner-dashboard 1.53.1 → 1.53.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,13 +7,21 @@ import ActionButton from '../../../containers/CourseCard/components/CourseCardAc
7
7
  import { useProgressiveProfilingQuiz } from '../ProgressiveProfilingQuizProvider';
8
8
  import { trackProgressiveProfilingDashboardBannerClick } from '../../../tracking/trackers/progressiveProfiling';
9
9
  const ProgressiveProfilingElements = ({ progressiveProfileStatus, orientation }) => {
10
- const { openModal } = useProgressiveProfilingQuiz();
10
+ var _a, _b, _c, _d, _e;
11
+ const { openModal, answers } = useProgressiveProfilingQuiz();
11
12
  const { formatMessage } = useIntl();
12
13
  const { status, remainingQuestions, } = progressiveProfileStatus || {};
14
+ const learningGoal = (_c = (_b = (_a = answers === null || answers === void 0 ? void 0 : answers['learning-goal']) === null || _a === void 0 ? void 0 : _a.selectedValues) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.replaceAll('-', ' ');
15
+ const interests = (_e = (_d = answers === null || answers === void 0 ? void 0 : answers['interests-declared']) === null || _d === void 0 ? void 0 : _d.selectedValues) !== null && _e !== void 0 ? _e : [];
16
+ const formattedInterests = interests.length > 1
17
+ ? `${interests.slice(0, -1).join(', ')} and ${interests.at(-1)}`
18
+ : interests[0];
13
19
  if (!progressiveProfileStatus)
14
20
  return null;
15
21
  const descriptionValues = Object.assign(Object.assign({}, (status === 'incomplete' && { remaining_questions: remainingQuestions })), (status === 'complete' && {
16
- strong: (chunks) => _jsx("strong", { children: chunks }),
22
+ learningGoal,
23
+ interests: formattedInterests,
24
+ bold: (chunks) => _jsx("strong", { children: chunks }),
17
25
  }));
18
26
  // Handle button click for the banner and track the click event
19
27
  const handleButtonClick = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressiveProfilingElements.js","sourceRoot":"","sources":["../../../../src/widgets/ProgressiveProfilingQuiz/ProgressiveProf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UAAU,IAAI,CACxB,uBAAK,aAAa,CAAC,QAAQ,CAAC,GAAG,MAAM,QAAQ,CAAC,CAAC,GAAM,CACtD,EACD,YAAG,SAAS,EAAC,qBAAqB,YAC/B,aAAa,CACZ,QAAQ,CAAC,GAAG,MAAM,cAAc,CAAC,EACjC,iBAAiB,CAClB,GACC,EACJ,KAAC,YAAY,IACX,OAAO,EAAC,eAAe,EACvB,IAAI,EAAC,IAAI,EACT,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,EAC9B,OAAO,EAAE,iBAAiB,YAEzB,aAAa,CAAC,QAAQ,CAAC,GAAG,MAAM,SAAS,CAAC,CAAC,GAC/B,IACX,GACD,GACH,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,4BAA4B,CAAC,SAAS,GAAG;IACvC,wBAAwB,EAAE,SAAS,CAAC,KAAK,CAAC;QACxC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QAClE,iBAAiB,EAAE,SAAS,CAAC,MAAM;QACnC,cAAc,EAAE,SAAS,CAAC,MAAM;QAChC,kBAAkB,EAAE,SAAS,CAAC,MAAM;KACrC,CAAC;IACF,WAAW,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC;AAEF,eAAe,4BAA4B,CAAC","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport messages from './messages';\nimport { Card } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport ActionButton from '@src/containers/CourseCard/components/CourseCardActions/ActionButton';\nimport { useProgressiveProfilingQuiz } from '../ProgressiveProfilingQuizProvider';\nimport { trackProgressiveProfilingDashboardBannerClick } from '@src/tracking/trackers/progressiveProfiling';\n\nconst ProgressiveProfilingElements = ({ progressiveProfileStatus, orientation }) => {\n const { openModal } = useProgressiveProfilingQuiz();\n const { formatMessage } = useIntl();\n\n const {\n status,\n remainingQuestions,\n } = progressiveProfileStatus || {};\n\n if (!progressiveProfileStatus) return null;\n\n const descriptionValues = {\n ...(status === 'incomplete' && { remaining_questions: remainingQuestions }),\n ...(status === 'complete' && {\n strong: (chunks) => <strong>{chunks}</strong>,\n }),\n };\n\n // Handle button click for the banner and track the click event\n const handleButtonClick = () => {\n openModal();\n trackProgressiveProfilingDashboardBannerClick({ host: window.location.origin, status });\n };\n\n return (\n <div data-testid=\"ProgressiveProfileStatus\">\n <Card orientation={orientation}>\n <div className=\"d-flex flex-column w-100 p-4\">\n {status !== 'complete' && (\n <h6>{formatMessage(messages[`${status}_title`])}</h6>\n )}\n <p className=\"small text-gray-700\">\n {formatMessage(\n messages[`${status}_description`],\n descriptionValues,\n )}\n </p>\n <ActionButton\n variant=\"outline-brand\"\n size=\"sm\"\n style={{ maxWidth: '12.5rem' }}\n onClick={handleButtonClick}\n >\n {formatMessage(messages[`${status}_button`])}\n </ActionButton>\n </div>\n </Card>\n </div>\n );\n};\n\nProgressiveProfilingElements.propTypes = {\n progressiveProfileStatus: PropTypes.shape({\n status: PropTypes.oneOf(['not_started', 'incomplete', 'complete']),\n answeredQuestions: PropTypes.number,\n totalQuestions: PropTypes.number,\n remainingQuestions: PropTypes.number,\n }),\n orientation: PropTypes.string,\n};\n\nexport default ProgressiveProfilingElements;\n"]}
1
+ {"version":3,"file":"ProgressiveProfilingElements.js","sourceRoot":"","sources":["../../../../src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingElements/ProgressiveProfilingElements.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,YAAY,MAAM,sEAAsE,CAAC;AAChG,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,6CAA6C,EAAE,MAAM,6CAA6C,CA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AAS,EAAE,CAAC;QACZ,6CAA6C,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1F,CAAC,CAAC;IAEF,OAAO,CACL,6BAAiB,0BAA0B,YACzC,KAAC,IAAI,IAAC,WAAW,EAAE,WAAW,YAC5B,eAAK,SAAS,EAAC,8BAA8B,aAC1C,MAAM,KAAK,UAAU,IAAI,CACxB,uBAAK,aAAa,CAAC,QAAQ,CAAC,GAAG,MAAM,QAAQ,CAAC,CAAC,GAAM,CACtD,EACD,YAAG,SAAS,EAAC,qBAAqB,YAC/B,aAAa,CACZ,QAAQ,CAAC,GAAG,MAAM,cAAc,CAAC,EACjC,iBAAiB,CAClB,GACC,EACJ,KAAC,YAAY,IACX,OAAO,EAAC,eAAe,EACvB,IAAI,EAAC,IAAI,EACT,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,EAC9B,OAAO,EAAE,iBAAiB,YAEzB,aAAa,CAAC,QAAQ,CAAC,GAAG,MAAM,SAAS,CAAC,CAAC,GAC/B,IACX,GACD,GACH,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,4BAA4B,CAAC,SAAS,GAAG;IACvC,wBAAwB,EAAE,SAAS,CAAC,KAAK,CAAC;QACxC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QAClE,iBAAiB,EAAE,SAAS,CAAC,MAAM;QACnC,cAAc,EAAE,SAAS,CAAC,MAAM;QAChC,kBAAkB,EAAE,SAAS,CAAC,MAAM;KACrC,CAAC;IACF,WAAW,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC;AAEF,eAAe,4BAA4B,CAAC","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport messages from './messages';\nimport { Card } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport ActionButton from '@src/containers/CourseCard/components/CourseCardActions/ActionButton';\nimport { useProgressiveProfilingQuiz } from '../ProgressiveProfilingQuizProvider';\nimport { trackProgressiveProfilingDashboardBannerClick } from '@src/tracking/trackers/progressiveProfiling';\n\nconst ProgressiveProfilingElements = ({ progressiveProfileStatus, orientation }) => {\n const { openModal, answers } = useProgressiveProfilingQuiz();\n const { formatMessage } = useIntl();\n\n const {\n status,\n remainingQuestions,\n } = progressiveProfileStatus || {};\n\n const learningGoal = answers?.['learning-goal']?.selectedValues?.[0]?.replaceAll('-', ' ');\n const interests = answers?.['interests-declared']?.selectedValues ?? [];\n const formattedInterests = interests.length > 1\n ? `${interests.slice(0, -1).join(', ')} and ${interests.at(-1)}`\n : interests[0];\n\n if (!progressiveProfileStatus) return null;\n\n const descriptionValues = {\n ...(status === 'incomplete' && { remaining_questions: remainingQuestions }),\n ...(status === 'complete' && {\n learningGoal,\n interests: formattedInterests,\n bold: (chunks) => <strong>{chunks}</strong>,\n }),\n };\n\n // Handle button click for the banner and track the click event\n const handleButtonClick = () => {\n openModal();\n trackProgressiveProfilingDashboardBannerClick({ host: window.location.origin, status });\n };\n\n return (\n <div data-testid=\"ProgressiveProfileStatus\">\n <Card orientation={orientation}>\n <div className=\"d-flex flex-column w-100 p-4\">\n {status !== 'complete' && (\n <h6>{formatMessage(messages[`${status}_title`])}</h6>\n )}\n <p className=\"small text-gray-700\">\n {formatMessage(\n messages[`${status}_description`],\n descriptionValues,\n )}\n </p>\n <ActionButton\n variant=\"outline-brand\"\n size=\"sm\"\n style={{ maxWidth: '12.5rem' }}\n onClick={handleButtonClick}\n >\n {formatMessage(messages[`${status}_button`])}\n </ActionButton>\n </div>\n </Card>\n </div>\n );\n};\n\nProgressiveProfilingElements.propTypes = {\n progressiveProfileStatus: PropTypes.shape({\n status: PropTypes.oneOf(['not_started', 'incomplete', 'complete']),\n answeredQuestions: PropTypes.number,\n totalQuestions: PropTypes.number,\n remainingQuestions: PropTypes.number,\n }),\n orientation: PropTypes.string,\n};\n\nexport default ProgressiveProfilingElements;\n"]}
@@ -22,7 +22,7 @@ const messages = defineMessages({
22
22
  },
23
23
  complete_description: {
24
24
  id: 'progressiveProfilingQuiz.complete.description',
25
- defaultMessage: 'Your learning on edX to <strong>advance your career</strong> and you’re interested in Business & Management and Leadership.',
25
+ defaultMessage: 'Your learning on edX to <bold>{learningGoal}</bold> and you\'re interested in {interests}.',
26
26
  description: 'Description for the progressive profiling quiz when complete',
27
27
  },
28
28
  not_started_button: {
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingElements/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,iBAAiB,EAAE;QACjB,EAAE,EAAE,4CAA4C;QAChD,cAAc,EAAE,mDAAmD;QACnE,WAAW,EAAE,2DAA2D;KACzE;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,2CAA2C;QAC/C,cAAc,EAAE,4BAA4B;QAC5C,WAAW,EAAE,0DAA0D;KACxE;IACD,uBAAuB,EAAE;QACvB,EAAE,EAAE,kDAAkD;QACtD,cAAc,EAAE,oEAAoE;QACpF,WAAW,EAAE,iEAAiE;KAC/E;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,iDAAiD;QACrD,cAAc,EACN,6HAA6H;QACrI,WAAW,EAAE,gEAAgE;KAC9E;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,+CAA+C;QACnD,cAAc,EAAE,6HAA6H;QAC7I,WAAW,EAAE,8DAA8D;KAC5E;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,6CAA6C;QACjD,cAAc,EAAE,gBAAgB;QAChC,WAAW,EAAE,iEAAiE;KAC/E;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,4CAA4C;QAChD,cAAc,EAAE,yBAAyB;QACzC,WAAW,EAAE,gEAAgE;KAC9E;IACD,eAAe,EAAE;QACf,EAAE,EAAE,0CAA0C;QAC9C,cAAc,EAAE,iBAAiB;QACjC,WAAW,EAAE,8DAA8D;KAC5E;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n not_started_title: {\n id: 'progressiveProfilingQuiz.not_started.title',\n defaultMessage: 'What is motivating you to study and learn on edx?',\n description: 'Title for the progressive profiling quiz when not started',\n },\n incomplete_title: {\n id: 'progressiveProfilingQuiz.incomplete.title',\n defaultMessage: 'What do you want to learn?',\n description: 'Title for the progressive profiling quiz when incomplete',\n },\n not_started_description: {\n id: 'progressiveProfilingQuiz.not_started.description',\n defaultMessage: 'Tell us what more about you and get better course recommendations.',\n description: 'Description for the progressive profiling quiz when not started',\n },\n incomplete_description: {\n id: 'progressiveProfilingQuiz.incomplete.description',\n defaultMessage:\n 'Answer {remaining_questions, plural, one {# more question} other {# more questions}} and get better course recommendations.',\n description: 'Description for the progressive profiling quiz when incomplete',\n },\n complete_description: {\n id: 'progressiveProfilingQuiz.complete.description',\n defaultMessage: 'Your learning on edX to <strong>advance your career</strong> and you’re interested in Business & Management and Leadership.',\n description: 'Description for the progressive profiling quiz when complete',\n },\n not_started_button: {\n id: 'progressiveProfilingQuiz.not_started.button',\n defaultMessage: 'Share my goals',\n description: 'Button text for the progressive profiling quiz when not started',\n },\n incomplete_button: {\n id: 'progressiveProfilingQuiz.incomplete.button',\n defaultMessage: 'Finish sharing my goals',\n description: 'Button text for the progressive profiling quiz when incomplete',\n },\n complete_button: {\n id: 'progressiveProfilingQuiz.complete.button',\n defaultMessage: 'Update my goals',\n description: 'Button text for the progressive profiling quiz when complete',\n },\n});\n\nexport default messages;\n"]}
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../src/widgets/ProgressiveProfilingQuiz/ProgressiveProfilingElements/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,iBAAiB,EAAE;QACjB,EAAE,EAAE,4CAA4C;QAChD,cAAc,EAAE,mDAAmD;QACnE,WAAW,EAAE,2DAA2D;KACzE;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,2CAA2C;QAC/C,cAAc,EAAE,4BAA4B;QAC5C,WAAW,EAAE,0DAA0D;KACxE;IACD,uBAAuB,EAAE;QACvB,EAAE,EAAE,kDAAkD;QACtD,cAAc,EAAE,oEAAoE;QACpF,WAAW,EAAE,iEAAiE;KAC/E;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,iDAAiD;QACrD,cAAc,EACN,6HAA6H;QACrI,WAAW,EAAE,gEAAgE;KAC9E;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,+CAA+C;QACnD,cAAc,EAAE,4FAA4F;QAC5G,WAAW,EAAE,8DAA8D;KAC5E;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,6CAA6C;QACjD,cAAc,EAAE,gBAAgB;QAChC,WAAW,EAAE,iEAAiE;KAC/E;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,4CAA4C;QAChD,cAAc,EAAE,yBAAyB;QACzC,WAAW,EAAE,gEAAgE;KAC9E;IACD,eAAe,EAAE;QACf,EAAE,EAAE,0CAA0C;QAC9C,cAAc,EAAE,iBAAiB;QACjC,WAAW,EAAE,8DAA8D;KAC5E;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n not_started_title: {\n id: 'progressiveProfilingQuiz.not_started.title',\n defaultMessage: 'What is motivating you to study and learn on edx?',\n description: 'Title for the progressive profiling quiz when not started',\n },\n incomplete_title: {\n id: 'progressiveProfilingQuiz.incomplete.title',\n defaultMessage: 'What do you want to learn?',\n description: 'Title for the progressive profiling quiz when incomplete',\n },\n not_started_description: {\n id: 'progressiveProfilingQuiz.not_started.description',\n defaultMessage: 'Tell us what more about you and get better course recommendations.',\n description: 'Description for the progressive profiling quiz when not started',\n },\n incomplete_description: {\n id: 'progressiveProfilingQuiz.incomplete.description',\n defaultMessage:\n 'Answer {remaining_questions, plural, one {# more question} other {# more questions}} and get better course recommendations.',\n description: 'Description for the progressive profiling quiz when incomplete',\n },\n complete_description: {\n id: 'progressiveProfilingQuiz.complete.description',\n defaultMessage: 'Your learning on edX to <bold>{learningGoal}</bold> and you\\'re interested in {interests}.',\n description: 'Description for the progressive profiling quiz when complete',\n },\n not_started_button: {\n id: 'progressiveProfilingQuiz.not_started.button',\n defaultMessage: 'Share my goals',\n description: 'Button text for the progressive profiling quiz when not started',\n },\n incomplete_button: {\n id: 'progressiveProfilingQuiz.incomplete.button',\n defaultMessage: 'Finish sharing my goals',\n description: 'Button text for the progressive profiling quiz when incomplete',\n },\n complete_button: {\n id: 'progressiveProfilingQuiz.complete.button',\n defaultMessage: 'Update my goals',\n description: 'Button text for the progressive profiling quiz when complete',\n },\n});\n\nexport default messages;\n"]}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { useState, useEffect } from 'react';
3
3
  import { Stepper, Button, Form, Icon } from '@openedx/paragon';
4
4
  import { useIntl } from '@openedx/frontend-base';
5
5
  import { useProgressiveProfilingQuiz } from '../../../../../../widgets/ProgressiveProfilingQuiz/ProgressiveProfilingQuizProvider';
@@ -18,6 +18,7 @@ const EMPTY_AUTOSUGGEST_VALUE = {
18
18
  selectionValue: '',
19
19
  selectionId: '',
20
20
  };
21
+ const getJobId = (jobTitle) => jobTitle.replaceAll(' ', '-').toLowerCase();
21
22
  const WorkStatusStep = () => {
22
23
  var _a, _b;
23
24
  const { goToPreviousStep, answers, recordAnswer, currentStep, } = useProgressiveProfilingQuiz();
@@ -25,6 +26,20 @@ const WorkStatusStep = () => {
25
26
  const [inputValue, setInputValue] = useState(EMPTY_AUTOSUGGEST_VALUE);
26
27
  const selectedValue = (_b = (_a = answers[schema.questionId]) === null || _a === void 0 ? void 0 : _a.selectedValues[0]) !== null && _b !== void 0 ? _b : '';
27
28
  const isNotEmployed = selectedValue === NOT_EMPLOYED_VALUE;
29
+ // Populate the controlled autosuggest when a previously saved answer is loaded.
30
+ useEffect(() => {
31
+ var _a;
32
+ if (!selectedValue || isNotEmployed) {
33
+ setInputValue(EMPTY_AUTOSUGGEST_VALUE);
34
+ return;
35
+ }
36
+ const matchingJob = jobsList.find(job => job.jobTitle === selectedValue);
37
+ setInputValue({
38
+ userProvidedText: (_a = matchingJob === null || matchingJob === void 0 ? void 0 : matchingJob.jobTitle) !== null && _a !== void 0 ? _a : selectedValue,
39
+ selectionValue: selectedValue,
40
+ selectionId: matchingJob ? getJobId(matchingJob.jobTitle) : '',
41
+ });
42
+ }, [selectedValue, isNotEmployed]);
28
43
  const handleJobSelect = (value) => {
29
44
  setInputValue(value);
30
45
  if (value.selectionValue) {
@@ -45,7 +60,7 @@ const WorkStatusStep = () => {
45
60
  goToPreviousStep();
46
61
  trackProgressiveProfilingBackButtonClick({ host: window.location.origin, step: currentStep + 1, question: schema.questionId });
47
62
  };
48
- 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", placeholder: "Search for a job title", trailingElement: (_jsx(Icon, { src: Search })), 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: _jsxs("span", { className: !isNotEmployed ? 'text-muted' : '', children: [" ", formatMessage(messages.notEmployedOption), " "] }) })] }), _jsxs(Stepper.ActionRow, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS, children: [_jsx(Button, { variant: "outline-primary", onClick: handleBackButtonClick, children: formatMessage(stepMessages.backButton) }), _jsx(ViewResultsButton, {})] })] }));
63
+ 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", placeholder: "Search for a job title", trailingElement: (_jsx(Icon, { src: Search })), children: jobsList === null || jobsList === void 0 ? void 0 : jobsList.map(job => (_jsx(Form.AutosuggestOption, { id: getJobId(job.jobTitle), children: job.jobTitle }, job.jobTitle))) }), _jsx(Form.Checkbox, { className: "mt-6", checked: isNotEmployed, onChange: handleNotEmployedToggle, children: _jsxs("span", { className: !isNotEmployed ? 'text-muted' : '', children: [" ", formatMessage(messages.notEmployedOption), " "] }) })] }), _jsxs(Stepper.ActionRow, { eventKey: PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS, children: [_jsx(Button, { variant: "outline-primary", onClick: handleBackButtonClick, children: formatMessage(stepMessages.backButton) }), _jsx(ViewResultsButton, {})] })] }));
49
64
  };
50
65
  export default WorkStatusStep;
51
66
  //# 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,IAAI,EAAE,MA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,YAAY,CAAC,UAAU,CAAC,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, Icon } 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';\nimport { trackProgressiveProfilingAnswerSelected, trackProgressiveProfilingBackButtonClick } from '@src/tracking/trackers/progressiveProfiling';\nimport { Search } from '@openedx/paragon/icons';\n\nconst EMPTY_AUTOSUGGEST_VALUE: AutosuggestValue = {\n userProvidedText: '',\n selectionValue: '',\n selectionId: '',\n};\n\nconst WorkStatusStep: React.FC = () => {\n const {\n goToPreviousStep, answers, recordAnswer, currentStep,\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 trackProgressiveProfilingAnswerSelected({ host: window.location.origin, question: schema.questionId, answer: [value.selectionValue], step: currentStep + 1 });\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 trackProgressiveProfilingAnswerSelected({ host: window.location.origin, question: schema.questionId, answer: checked ? [NOT_EMPLOYED_VALUE] : [], step: currentStep + 1 });\n };\n\n // Handles the click event for the \"Back\" button, going to the previous step and tracking the event.\n const handleBackButtonClick = () => {\n goToPreviousStep();\n trackProgressiveProfilingBackButtonClick({ host: window.location.origin, step: currentStep + 1, question: schema.questionId });\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 placeholder=\"Search for a job title\"\n trailingElement={(\n <Icon\n src={Search}\n />\n )}\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 <span className={!isNotEmployed ? 'text-muted' : ''}> {formatMessage(messages.notEmployedOption)} </span>\n </Form.Checkbox>\n </BaseStep>\n <Stepper.ActionRow eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS}>\n <Button variant=\"outline-primary\" onClick={handleBackButtonClick}>\n {formatMessage(stepMessages.backButton)}\n </Button>\n <ViewResultsButton />\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,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC/D,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,wDAAwD,CAAC;AAC3F,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,YAAY,MAAM,aAAa,CAAC;AACvC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,EAAE,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uCAAuC,EAAE,wCAAwC,EAAE,MAAM,6CAA6C,CAAC;AAChJ,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,uBAAuB,GAAqB;IAChD,gBAAgB,EAAE,EAAE;IACpB,cAAc,EAAE,EAAE;IAClB,WAAW,EAAE,EAAE;CAChB,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAEnF,MAAM,cAAc,GAAa,GAAG,EAAE;;IACpC,MAAM,EACJ,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,GACrD,GAAG,2BAA2B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G,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAC/B,EACJ,KAAC,IAAI,CAAC,WAAW,IACf,IAAI,EAAC,yBAAyB,EAC9B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAC,MAAM,EAChB,WAAW,EAAC,wBAAwB,EACpC,eAAe,EAAE,CACf,KAAC,IAAI,IACH,GAAG,EAAE,MAAM,GACX,CACH,YAEA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CACpB,KAAC,IAAI,CAAC,iBAAiB,IAErB,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,YAEzB,GAAG,CAAC,QAAQ,IAHR,GAAG,CAAC,QAAQ,CAIM,CAC1B,CAAC,GACe,EACnB,KAAC,IAAI,CAAC,QAAQ,IACZ,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,uBAAuB,YAEjC,gBAAM,SAAS,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,kBAAI,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,SAAS,GAC3F,IACP,EACX,MAAC,OAAO,CAAC,SAAS,IAAC,QAAQ,EAAE,gCAAgC,CAAC,WAAW,aACvE,KAAC,MAAM,IAAC,OAAO,EAAC,iBAAiB,EAAC,OAAO,EAAE,qBAAqB,YAC7D,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,GAChC,EACT,KAAC,iBAAiB,KAAG,IACH,IACnB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { Stepper, Button, Form, Icon } 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';\nimport { trackProgressiveProfilingAnswerSelected, trackProgressiveProfilingBackButtonClick } from '@src/tracking/trackers/progressiveProfiling';\nimport { Search } from '@openedx/paragon/icons';\n\nconst EMPTY_AUTOSUGGEST_VALUE: AutosuggestValue = {\n userProvidedText: '',\n selectionValue: '',\n selectionId: '',\n};\n\nconst getJobId = (jobTitle: string) => jobTitle.replaceAll(' ', '-').toLowerCase();\n\nconst WorkStatusStep: React.FC = () => {\n const {\n goToPreviousStep, answers, recordAnswer, currentStep,\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 // Populate the controlled autosuggest when a previously saved answer is loaded.\n useEffect(() => {\n if (!selectedValue || isNotEmployed) {\n setInputValue(EMPTY_AUTOSUGGEST_VALUE);\n return;\n }\n\n const matchingJob = jobsList.find(job => job.jobTitle === selectedValue);\n\n setInputValue({\n userProvidedText: matchingJob?.jobTitle ?? selectedValue,\n selectionValue: selectedValue,\n selectionId: matchingJob ? getJobId(matchingJob.jobTitle) : '',\n });\n }, [selectedValue, isNotEmployed]);\n\n const handleJobSelect = (value: AutosuggestValue) => {\n setInputValue(value);\n\n if (value.selectionValue) {\n recordAnswer(buildAnswerRecord(schema, [value.selectionValue], formatMessage));\n trackProgressiveProfilingAnswerSelected({ host: window.location.origin, question: schema.questionId, answer: [value.selectionValue], step: currentStep + 1 });\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 trackProgressiveProfilingAnswerSelected({ host: window.location.origin, question: schema.questionId, answer: checked ? [NOT_EMPLOYED_VALUE] : [], step: currentStep + 1 });\n };\n\n // Handles the click event for the \"Back\" button, going to the previous step and tracking the event.\n const handleBackButtonClick = () => {\n goToPreviousStep();\n trackProgressiveProfilingBackButtonClick({ host: window.location.origin, step: currentStep + 1, question: schema.questionId });\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 placeholder=\"Search for a job title\"\n trailingElement={(\n <Icon\n src={Search}\n />\n )}\n >\n {jobsList?.map(job => (\n <Form.AutosuggestOption\n key={job.jobTitle}\n id={getJobId(job.jobTitle)}\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 <span className={!isNotEmployed ? 'text-muted' : ''}> {formatMessage(messages.notEmployedOption)} </span>\n </Form.Checkbox>\n </BaseStep>\n <Stepper.ActionRow eventKey={PROGRESSIVE_PROFILING_QUIZ_STEPS.WORK_STATUS}>\n <Button variant=\"outline-primary\" onClick={handleBackButtonClick}>\n {formatMessage(stepMessages.backButton)}\n </Button>\n <ViewResultsButton />\n </Stepper.ActionRow>\n </>\n );\n};\n\nexport default WorkStatusStep;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-subscription-learner-dashboard",
3
- "version": "1.53.1",
3
+ "version": "1.53.2",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",