exports.id = 87574; exports.ids = [87574]; exports.modules = { /***/ 51053: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); var _path; function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } var SvgClose = function SvgClose(props) { return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({ width: 24, height: 24, viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props), _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { d: "M11.782 4.032a.575.575 0 1 0-.813-.814L7.5 6.687 4.032 3.218a.575.575 0 0 0-.814.814L6.687 7.5l-3.469 3.468a.575.575 0 0 0 .814.814L7.5 8.313l3.469 3.469a.575.575 0 0 0 .813-.814L8.313 7.5l3.469-3.468Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }))); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SvgClose); /***/ }), /***/ 58421: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); var _path; function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } var SvgWest = function SvgWest(props) { return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({ width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props), _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { d: "m9 19 1.41-1.41L5.83 13H22v-2H5.83l4.59-4.59L9 5l-7 7 7 7Z", fill: "currentColor" }))); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SvgWest); /***/ }), /***/ 23537: /***/ ((module) => { // Exports module.exports = { "container": "ContentContainer_container__s7dX2" }; /***/ }), /***/ 76651: /***/ ((module) => { // Exports module.exports = { "container": "CourseFeedback_container__iBDGv" }; /***/ }), /***/ 88462: /***/ ((module) => { // Exports module.exports = { "bodyInput": "CourseFeedbackForm_bodyInput__0TtN_", "submitButton": "CourseFeedbackForm_submitButton__vLdJc", "ratingContainer": "CourseFeedbackForm_ratingContainer__AF_0R" }; /***/ }), /***/ 68609: /***/ ((module) => { // Exports module.exports = { "headerContainer": "CourseFeedbackModal_headerContainer__pubww", "desc": "CourseFeedbackModal_desc__UebUq" }; /***/ }), /***/ 49126: /***/ ((module) => { // Exports module.exports = { "editor": "MarkdownEditor_editor__yKRsX", "content": "MarkdownEditor_content__4M3H4" }; /***/ }), /***/ 93020: /***/ ((module) => { // Exports module.exports = { "container": "PageContainer_container__1TUET", "fullWidth": "PageContainer_fullWidth__RU5GM" }; /***/ }), /***/ 19426: /***/ ((module) => { // Exports module.exports = { "modalContainer": "ContentModal_modalContainer__i7bo0", "contentContainer": "ContentModal_contentContainer___ciX5", "overlay": "ContentModal_overlay__qZfQY", "contentWrapper": "ContentModal_contentWrapper__VaiRB", "autoHeight": "ContentModal_autoHeight__A3IW7", "medium": "ContentModal_medium__EKB5h", "small": "ContentModal_small__YBKtM", "fadeIn": "ContentModal_fadeIn__JGh_A", "fadeOut": "ContentModal_fadeOut__36m_B", "contentIn": "ContentModal_contentIn__EAwQw", "contentOut": "ContentModal_contentOut__2x8WN", "closeIcon": "ContentModal_closeIcon__xppin", "header": "ContentModal_header__384F2", "content": "ContentModal_content__9M2Iy" }; /***/ }), /***/ 23848: /***/ ((module) => { // Exports module.exports = { "pageContainer": "index_pageContainer__Pxtn3", "loadingContainer": "index_loadingContainer__WEZFc", "flow": "index_flow__rCTR5", "flowItem": "index_flowItem__GnXWz", "additionalVerticalGap": "index_additionalVerticalGap__nzYz6", "fullWidth": "index_fullWidth__1n4ux" }; /***/ }), /***/ 86120: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); const CompletedTick = ()=>{ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", { children: ` ✔` }); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CompletedTick); /***/ }), /***/ 79215: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _ContentContainer_module_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(23537); /* harmony import */ var _ContentContainer_module_scss__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_ContentContainer_module_scss__WEBPACK_IMPORTED_MODULE_2__); const ContentContainer = ({ children })=>{ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", { className: (_ContentContainer_module_scss__WEBPACK_IMPORTED_MODULE_2___default().container), children: children }); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentContainer); /***/ }), /***/ 27914: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(60866); /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(88462); /* harmony import */ var _CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16__); /* harmony import */ var _components_Course_utils_mutations__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(82969); /* harmony import */ var _components_FormBuilder_buildFormBuilderFormField__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57361); /* harmony import */ var _components_FormBuilder_buildTranslatedErrorMessageByErrorId__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(21485); /* harmony import */ var _components_FormBuilder_FormBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(37013); /* harmony import */ var _dls_Button_Button__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(50497); /* harmony import */ var _dls_Toast_Toast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(79717); /* harmony import */ var _hooks_useMutateMultipleKeys__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(46181); /* harmony import */ var _hooks_useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(61368); /* harmony import */ var _types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(99133); /* harmony import */ var _types_FieldRule__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(98213); /* harmony import */ var _types_FormField__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(3840); /* harmony import */ var _utils_auth_api__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(37883); /* harmony import */ var _utils_eventLogger__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(55943); var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_components_FormBuilder_FormBuilder__WEBPACK_IMPORTED_MODULE_6__, _dls_Button_Button__WEBPACK_IMPORTED_MODULE_7__, _dls_Toast_Toast__WEBPACK_IMPORTED_MODULE_8__, _hooks_useMutateMultipleKeys__WEBPACK_IMPORTED_MODULE_9__, _hooks_useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_10__, _utils_eventLogger__WEBPACK_IMPORTED_MODULE_15__]); ([_components_FormBuilder_FormBuilder__WEBPACK_IMPORTED_MODULE_6__, _dls_Button_Button__WEBPACK_IMPORTED_MODULE_7__, _dls_Toast_Toast__WEBPACK_IMPORTED_MODULE_8__, _hooks_useMutateMultipleKeys__WEBPACK_IMPORTED_MODULE_9__, _hooks_useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_10__, _utils_eventLogger__WEBPACK_IMPORTED_MODULE_15__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__); const BODY_MAX_VALIDATION_PARAMS = { value: 10000 }; const CourseFeedbackForm = ({ course , onSuccess })=>{ const { t } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2___default()("learn"); const { 0: isLoading , 1: setIsLoading } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); const toast = (0,_dls_Toast_Toast__WEBPACK_IMPORTED_MODULE_8__/* .useToast */ .pm)(); const mutateWithoutRevalidation = (0,_hooks_useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z)(); const mutateMultipleKeys = (0,_hooks_useMutateMultipleKeys__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z)(); const submitFeedback = async (formData)=>{ setIsLoading(true); (0,_utils_auth_api__WEBPACK_IMPORTED_MODULE_14__/* .postCourseFeedback */ .ku)({ courseId: course.id, ...formData }).then(()=>{ toast(t("feedback.feedback-success"), { status: _dls_Toast_Toast__WEBPACK_IMPORTED_MODULE_8__/* .ToastStatus.Success */ .YZ.Success }); // update local cache to set userHasFeedback to true (0,_components_Course_utils_mutations__WEBPACK_IMPORTED_MODULE_3__/* .mutateCachedCourseAfterFeedback */ .Hf)(mutateWithoutRevalidation, course.slug); (0,_components_Course_utils_mutations__WEBPACK_IMPORTED_MODULE_3__/* .mutateCachedLessonsAfterFeedback */ .eh)(mutateMultipleKeys, course.slug); onSuccess(); }).catch(()=>{ toast(t("common:error.general"), { status: _dls_Toast_Toast__WEBPACK_IMPORTED_MODULE_8__/* .ToastStatus.Error */ .YZ.Error }); }).finally(()=>{ setIsLoading(false); }); }; const onSubmit = async (formData)=>{ (0,_utils_eventLogger__WEBPACK_IMPORTED_MODULE_15__/* .logFormSubmission */ .dz)("course_feedback", formData); submitFeedback(formData); }; return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_FormBuilder_FormBuilder__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { formFields: [ { field: "rating", type: _types_FormField__WEBPACK_IMPORTED_MODULE_13__/* .FormFieldType.StarRating */ .E.StarRating, // user must pick a rating defaultValue: null, containerClassName: (_CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16___default().ratingContainer), rules: [ { type: _types_FieldRule__WEBPACK_IMPORTED_MODULE_12__/* .RuleType.Required */ .S.Required, value: true, errorId: _types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_11__/* ["default"].RequiredField */ .Z.RequiredField, errorMessage: (0,_components_FormBuilder_buildTranslatedErrorMessageByErrorId__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(_types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_11__/* ["default"].RequiredField */ .Z.RequiredField, "rating", t) }, ] }, { field: "body", placeholder: t("feedback.feedback-placeholder"), rules: [ { ...BODY_MAX_VALIDATION_PARAMS, type: _types_FieldRule__WEBPACK_IMPORTED_MODULE_12__/* .RuleType.MaximumLength */ .S.MaximumLength, errorId: _types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_11__/* ["default"].MaximumLength */ .Z.MaximumLength, errorExtraParams: { ...BODY_MAX_VALIDATION_PARAMS }, errorMessage: (0,_components_FormBuilder_buildTranslatedErrorMessageByErrorId__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(_types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_11__/* ["default"].MaximumLength */ .Z.MaximumLength, "body", t, { ...BODY_MAX_VALIDATION_PARAMS }) }, ], type: _types_FormField__WEBPACK_IMPORTED_MODULE_13__/* .FormFieldType.TextArea */ .E.TextArea, containerClassName: (_CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16___default().bodyInput), fieldSetLegend: t("feedback.your-feedback") }, ].map((field)=>(0,_components_FormBuilder_buildFormBuilderFormField__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)(field, t)), onSubmit: onSubmit, isSubmitting: isLoading, renderAction: ({ isLoading: isSubmitting })=>{ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", { className: (_CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16___default().submitButton), children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Button_Button__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP, { htmlType: "submit", isLoading: isSubmitting, isDisabled: isSubmitting, children: t("common:submit") }) }); } }); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CourseFeedbackForm); __webpack_async_result__(); } catch(e) { __webpack_async_result__(e); } }); /***/ }), /***/ 55691: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var next_translate_Trans__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(74137); /* harmony import */ var next_translate_Trans__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_translate_Trans__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(60866); /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _CourseFeedbackForm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27914); /* harmony import */ var _CourseFeedbackModal_module_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(68609); /* harmony import */ var _CourseFeedbackModal_module_scss__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_CourseFeedbackModal_module_scss__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var _dls_ContentModal_ContentModal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(66606); var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_CourseFeedbackForm__WEBPACK_IMPORTED_MODULE_4__, _dls_ContentModal_ContentModal__WEBPACK_IMPORTED_MODULE_5__]); ([_CourseFeedbackForm__WEBPACK_IMPORTED_MODULE_4__, _dls_ContentModal_ContentModal__WEBPACK_IMPORTED_MODULE_5__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__); const CourseFeedbackModal = ({ onClose , isOpen , course })=>{ const { t } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3___default()("learn"); const contentModalRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(); const { title } = course; return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_dls_ContentModal_ContentModal__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { innerRef: contentModalRef, isOpen: isOpen, header: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", { className: (_CourseFeedbackModal_module_scss__WEBPACK_IMPORTED_MODULE_6___default().headerContainer), children: t("feedback.add-feedback") }), hasCloseButton: true, onClose: onClose, onEscapeKeyDown: onClose, size: _dls_ContentModal_ContentModal__WEBPACK_IMPORTED_MODULE_5__/* .ContentModalSize.MEDIUM */ .S.MEDIUM, children: [ /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", { className: (_CourseFeedbackModal_module_scss__WEBPACK_IMPORTED_MODULE_6___default().desc), children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((next_translate_Trans__WEBPACK_IMPORTED_MODULE_2___default()), { components: { br: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("br", {}) }, i18nKey: "learn:feedback.desc", values: { courseName: title } }) }), /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_CourseFeedbackForm__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { onSuccess: onClose, course: course }) ] }); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CourseFeedbackModal); __webpack_async_result__(); } catch(e) { __webpack_async_result__(e); } }); /***/ }), /***/ 18370: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "E": () => (/* binding */ FeedbackSource), /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(60866); /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _CourseFeedback_module_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(76651); /* harmony import */ var _CourseFeedback_module_scss__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_CourseFeedback_module_scss__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var _CourseFeedbackModal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(55691); /* harmony import */ var _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(50497); /* harmony import */ var _utils_eventLogger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55943); var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_CourseFeedbackModal__WEBPACK_IMPORTED_MODULE_3__, _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__, _utils_eventLogger__WEBPACK_IMPORTED_MODULE_5__]); ([_CourseFeedbackModal__WEBPACK_IMPORTED_MODULE_3__, _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__, _utils_eventLogger__WEBPACK_IMPORTED_MODULE_5__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__); var FeedbackSource; (function(FeedbackSource) { FeedbackSource["CoursePage"] = "course_page"; FeedbackSource["LessonPage"] = "lesson_page"; })(FeedbackSource || (FeedbackSource = {})); const CourseFeedback = ({ source , course , shouldOpenModal =false })=>{ const { t } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2___default()("learn"); const { 0: isModalOpen , 1: setIsModalOpen } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); /** * listen to changes from the parent component. This will happen when the user * completes last lesson of the course. */ (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{ if (shouldOpenModal) { setIsModalOpen(true); } }, [ shouldOpenModal ]); const onAddFeedbackClicked = ()=>{ (0,_utils_eventLogger__WEBPACK_IMPORTED_MODULE_5__/* .logButtonClick */ .MY)("add_course_feedback", { source }); setIsModalOpen(true); }; return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { className: (_CourseFeedback_module_scss__WEBPACK_IMPORTED_MODULE_6___default().container), children: [ /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .ZP, { size: _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__/* .ButtonSize.Small */ .qE.Small, type: _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__/* .ButtonType.Primary */ .L$.Primary, onClick: onAddFeedbackClicked, children: t("feedback.add-feedback") }), /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_CourseFeedbackModal__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { course: course, isOpen: isModalOpen, onClose: ()=>setIsModalOpen(false) }) ] }); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CourseFeedback); __webpack_async_result__(); } catch(e) { __webpack_async_result__(e); } }); /***/ }), /***/ 82969: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Hf": () => (/* binding */ mutateCachedCourseAfterFeedback), /* harmony export */ "eh": () => (/* binding */ mutateCachedLessonsAfterFeedback), /* harmony export */ "gx": () => (/* binding */ mutateCachedCourseAfterCompletion), /* harmony export */ "z1": () => (/* binding */ mutateCachedLessonsAfterCompletion) /* harmony export */ }); /* unused harmony exports getContinueFromLesson, mutateLessonAsCompleted, getUpdatedLessonDataAfterCompletion, getUpdatedCourseDataAfterCompletion, getUpdatedCourseDataAfterFeedback, getUpdatedLessonDataAfterFeedback */ /* harmony import */ var _utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13830); /** * Given an ordered list of lessons and a list of completed lessons: * * – If all of them are completed, return the first * - If none of them are completed, return the first * - If only some of them are completed, return the 1st uncompleted lesson. * * @param {Lesson[]} lessons * * @returns {string} */ const getContinueFromLesson = (lessons)=>{ if (!lessons) { return null; } const completedLessonIds = lessons.filter((lesson)=>lesson.isCompleted).map((lesson)=>lesson.id); const numberOfCompletedLessons = completedLessonIds.length; // if no lessons were completed, return the first lesson if (numberOfCompletedLessons === 0) { return lessons[0].slug; } // if all lessons were completed, return the first lesson if (numberOfCompletedLessons === lessons.length) { return lessons[0].slug; } // 1. make sure the lessons are sorted by day const sortedLessons = lessons.sort((a, b)=>a.day - b.day); // 2. pick first uncompleted lesson for(let index = 0; index < sortedLessons.length; index += 1){ // if the lessons has not been completed, return in if (!completedLessonIds.includes(sortedLessons[index].id)) { return sortedLessons[index].slug; } } return null; }; /** * Given a lessons array and a lesson id, it returns a new lessons array * after setting the lesson with the given id set as completed. * * @param {Lesson[]} lessons * @param {string} lessonId * @returns {Lesson[]} */ const mutateLessonAsCompleted = (lessons, lessonId)=>{ const newLessons = [ ...lessons ]; const lessonIndex = newLessons.findIndex((loopLesson)=>loopLesson.id === lessonId); // safety check: if the lesson was found in the lessons array, set it as completed if (lessonIndex !== -1) { newLessons[lessonIndex].isCompleted = true; } return newLessons; }; /** * This function receives the cached lesson data and the id of the lesson that was just completed * and expects to return the updated lesson data with the lesson marked as completed * which will be used to update the local cache without having to call the API again. * * @param {Lesson} cachedLessonData * @param {string} completedLessonId * @returns {Lesson} */ const getUpdatedLessonDataAfterCompletion = (cachedLessonData, completedLessonId)=>{ if (cachedLessonData) { const updatedLessonData = { ...cachedLessonData }; // only set the completed lesson data to completed if (updatedLessonData.id === completedLessonId) { updatedLessonData.isCompleted = true; } // if the lesson has a course, we should update the lessons array of the course if (cachedLessonData?.course?.lessons) { updatedLessonData.course.lessons = mutateLessonAsCompleted(updatedLessonData.course.lessons, completedLessonId); } return updatedLessonData; } return cachedLessonData; }; /** * This function receives the cached course data and the id of the lesson that was just completed * and expects to return the updated course data with the lesson marked as completed * which will be used to update the local cache without having to call the API again. * * @param {Course} cachedCourseData * @param {string} completedLessonId * @returns {Course} */ const getUpdatedCourseDataAfterCompletion = (cachedCourseData, completedLessonId)=>{ if (cachedCourseData) { const updatedCourseData = { ...cachedCourseData }; // if the course has lessons, we should update the lessons array if (updatedCourseData?.lessons) { const completedLessons = updatedCourseData.lessons.filter((loopLesson)=>loopLesson.isCompleted); // if we are marking the last un-completed lesson in the course, we should mark the course itself as completed if (completedLessons.length + 1 === updatedCourseData.lessons.length) { updatedCourseData.isCompleted = true; } updatedCourseData.lessons = mutateLessonAsCompleted(updatedCourseData.lessons, completedLessonId); updatedCourseData.continueFromLesson = getContinueFromLesson(updatedCourseData.lessons); } return updatedCourseData; } return cachedCourseData; }; /** * we need to update all the cached lessons of the course to set the current lesson as completed * * @param {any} mutatorFunction * @param {string} courseSlug * @param {string} completedLessonId * * @returns {void} */ const mutateCachedLessonsAfterCompletion = (mutatorFunction, courseSlug, completedLessonId)=>{ const courseLessonsUrlRegex = `^${(0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeGetLessonUrlPrefix */ .i5)(courseSlug)}/.+`; mutatorFunction(courseLessonsUrlRegex, (cachedLessonData)=>getUpdatedLessonDataAfterCompletion(cachedLessonData, completedLessonId)); }; /** * update local cache of the course to set the current lesson as completed in the lessons array * * @param {any} mutatorFunction * @param {string} courseSlug * @param {string} completedLessonId * * @returns {void} */ const mutateCachedCourseAfterCompletion = (mutatorFunction, courseSlug, completedLessonId)=>{ mutatorFunction((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeGetCourseUrl */ .vp)(courseSlug), (cachedCourseData)=>getUpdatedCourseDataAfterCompletion(cachedCourseData, completedLessonId)); }; /** * we need to update all the cached lessons of the course to set the current lesson as completed * * @param {any} mutatorFunction * @param {string} courseSlug * * @returns {void} */ const mutateCachedLessonsAfterFeedback = (mutatorFunction, courseSlug)=>{ const courseLessonsUrlRegex = `^${(0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeGetLessonUrlPrefix */ .i5)(courseSlug)}/.+`; mutatorFunction(courseLessonsUrlRegex, (cachedLessonData)=>getUpdatedLessonDataAfterFeedback(cachedLessonData)); }; /** * update local cache of the course to set the current lesson as completed in the lessons array * * @param {any} mutatorFunction * @param {string} courseSlug * * @returns {void} */ const mutateCachedCourseAfterFeedback = (mutatorFunction, courseSlug)=>{ mutatorFunction((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeGetCourseUrl */ .vp)(courseSlug), (cachedCourseData)=>getUpdatedCourseDataAfterFeedback(cachedCourseData)); }; /** * This function receives the cached course data and the id of the lesson that was just completed * and expects to return the updated course data with the lesson marked as completed * which will be used to update the local cache without having to call the API again. * * @param {Course} cachedCourseData * @returns {Course} */ const getUpdatedCourseDataAfterFeedback = (cachedCourseData)=>{ if (cachedCourseData) { const updatedCourseData = { ...cachedCourseData }; updatedCourseData.userHasFeedback = true; return updatedCourseData; } return cachedCourseData; }; /** * This function receives the cached lesson data and the id of the lesson that was just completed * and expects to return the updated lesson data with the lesson marked as completed * which will be used to update the local cache without having to call the API again. * * @param {Lesson} cachedLessonData * @returns {Lesson} */ const getUpdatedLessonDataAfterFeedback = (cachedLessonData)=>{ if (cachedLessonData) { const updatedLessonData = { ...cachedLessonData }; // if the lesson has a course, we should update it to userHasFeedback = true if (cachedLessonData?.course) { updatedLessonData.course = { ...updatedLessonData.course, userHasFeedback: true }; } return updatedLessonData; } return cachedLessonData; }; /***/ }), /***/ 57361: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var lodash_capitalize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59969); /* harmony import */ var lodash_capitalize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_capitalize__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var types_FormField__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3840); /** * Transform FormField to be FormBuilderFormField * * FormField and FormBuilderFormField are the same except, FormBuilderFormField is not tied to errorId and translationId * - Previously FormBuilder was tied to common.json, next-translate. * - and it's also tied to ErrorMessageId * - and the `label` is also less flexible because it's tied to `field` value * * This function help to transform FormField to FormBuilderFormField for common use case. * But when we need a more flexible use case, we can use FormBuilderFormField directly. Without using this helper function * * check ./FormBuilderTypes.ts for more info * * Note that this function expect the `t` translate function to be used with `common.json`. And expect `form.$field` and `validation.$errorId` to exist. * * @param {FormField} formField * @returns {FormBuilderFormField} formBuilderFormField */ const buildFormBuilderFormField = (formField, t)=>{ return { ...formField, ...formField.rules && { rules: formField.rules.map((rule)=>({ type: rule.type, value: rule.value, errorMessage: t(`common:validation.${rule.errorId}`, { field: lodash_capitalize__WEBPACK_IMPORTED_MODULE_0___default()(formField.field), ...rule.errorExtraParams }) })) }, ...formField.label && { label: formField.type === types_FormField__WEBPACK_IMPORTED_MODULE_1__/* .FormFieldType.Checkbox */ .E.Checkbox ? formField.label : t(`form.${formField.label}`) }, ...formField.defaultValue && { defaultValue: formField.defaultValue }, ...formField.placeholder && { placeholder: formField.placeholder } }; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (buildFormBuilderFormField); /***/ }), /***/ 21485: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var lodash_capitalize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59969); /* harmony import */ var lodash_capitalize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_capitalize__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99133); const DEFAULT_ERROR_ID = types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_1__/* ["default"].InvalidField */ .Z.InvalidField; const buildTranslatedErrorMessageByErrorId = (errorId, fieldName, t, extraParams)=>{ if (Object.values(types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z).includes(errorId)) { return t(`common:validation.${errorId}`, { field: lodash_capitalize__WEBPACK_IMPORTED_MODULE_0___default()(fieldName), ...extraParams }); } return t(`common:validation.${DEFAULT_ERROR_ID}`, { field: lodash_capitalize__WEBPACK_IMPORTED_MODULE_0___default()(fieldName) }); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (buildTranslatedErrorMessageByErrorId); /***/ }), /***/ 3177: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _milkdown_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57964); /* harmony import */ var _milkdown_preset_commonmark__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42154); /* harmony import */ var _milkdown_react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(76915); /* harmony import */ var _milkdown_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(64744); /* harmony import */ var _components_MarkdownEditor_MarkdownEditor_module_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(49126); /* harmony import */ var _components_MarkdownEditor_MarkdownEditor_module_scss__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_components_MarkdownEditor_MarkdownEditor_module_scss__WEBPACK_IMPORTED_MODULE_6__); var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_milkdown_core__WEBPACK_IMPORTED_MODULE_2__, _milkdown_preset_commonmark__WEBPACK_IMPORTED_MODULE_3__, _milkdown_react__WEBPACK_IMPORTED_MODULE_4__, _milkdown_utils__WEBPACK_IMPORTED_MODULE_5__]); ([_milkdown_core__WEBPACK_IMPORTED_MODULE_2__, _milkdown_preset_commonmark__WEBPACK_IMPORTED_MODULE_3__, _milkdown_react__WEBPACK_IMPORTED_MODULE_4__, _milkdown_utils__WEBPACK_IMPORTED_MODULE_5__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__); const MarkdownEditor = ({ isEditable =true , defaultValue })=>{ const { get } = (0,_milkdown_react__WEBPACK_IMPORTED_MODULE_4__.useEditor)((root)=>{ return _milkdown_core__WEBPACK_IMPORTED_MODULE_2__.Editor.make().config((ctx)=>{ ctx.set(_milkdown_core__WEBPACK_IMPORTED_MODULE_2__.rootCtx, root); if (defaultValue) { ctx.set(_milkdown_core__WEBPACK_IMPORTED_MODULE_2__.defaultValueCtx, defaultValue); } // Add attributes to the editor container ctx.update(_milkdown_core__WEBPACK_IMPORTED_MODULE_2__.editorViewOptionsCtx, (prev)=>({ ...prev, editable: ()=>isEditable, attributes: { class: (_components_MarkdownEditor_MarkdownEditor_module_scss__WEBPACK_IMPORTED_MODULE_6___default().editor), spellcheck: "false" } })); }).use(_milkdown_preset_commonmark__WEBPACK_IMPORTED_MODULE_3__.commonmark); }, []); (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{ if (defaultValue) { get()?.action((0,_milkdown_utils__WEBPACK_IMPORTED_MODULE_5__.replaceAll)(defaultValue)); } }, [ defaultValue, get ]); return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", { className: (_components_MarkdownEditor_MarkdownEditor_module_scss__WEBPACK_IMPORTED_MODULE_6___default().content), children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_milkdown_react__WEBPACK_IMPORTED_MODULE_4__.Milkdown, {}) }); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MarkdownEditor); __webpack_async_result__(); } catch(e) { __webpack_async_result__(e); } }); /***/ }), /***/ 9234: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _PageContainer_module_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(93020); /* harmony import */ var _PageContainer_module_scss__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_PageContainer_module_scss__WEBPACK_IMPORTED_MODULE_1__); const PageContainer = ({ children })=>{ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", { className: (_PageContainer_module_scss__WEBPACK_IMPORTED_MODULE_1___default().container), children: children }); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PageContainer); /***/ }), /***/ 66606: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "S": () => (/* binding */ ContentModalSize), /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(77715); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(59003); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71853); /* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(next_router__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _Button_Button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(50497); /* harmony import */ var _ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(19426); /* harmony import */ var _ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8__); /* harmony import */ var _icons_close_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(51053); /* harmony import */ var _utils_locale__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(24709); var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__, _Button_Button__WEBPACK_IMPORTED_MODULE_5__]); ([_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__, _Button_Button__WEBPACK_IMPORTED_MODULE_5__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__); var ContentModalSize; (function(ContentModalSize) { ContentModalSize["SMALL"] = "small"; ContentModalSize["MEDIUM"] = "medium"; })(ContentModalSize || (ContentModalSize = {})); const SCROLLBAR_WIDTH = 15; const ContentModal = ({ isOpen , onClose , onEscapeKeyDown , hasCloseButton , children , header , innerRef , contentClassName , size =ContentModalSize.MEDIUM , isFixedHeight , hasHeader =true })=>{ const overlayRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(); const { locale } = (0,next_router__WEBPACK_IMPORTED_MODULE_4__.useRouter)(); (0,react__WEBPACK_IMPORTED_MODULE_1__.useImperativeHandle)(innerRef, ()=>({ scrollToTop: ()=>{ if (overlayRef.current) overlayRef.current.scrollTop = 0; } })); /** * We need to manually check what the user is targeting. If it lies at the * area where the scroll bar is (assuming the scrollbar width is equivalent * to SCROLLBAR_WIDTH), then we don't close the Modal, otherwise we do. * We also need to check if the current locale is RTL or LTR because the side * where the scrollbar is will be different and therefor the value of * {e.detail.originalEvent.offsetX} will be different. * * inspired by {@see https://github.com/radix-ui/primitives/issues/1280#issuecomment-1198248523} * * @param {any} e */ const onPointerDownOutside = (e)=>{ const currentTarget = e.currentTarget; const shouldPreventOnClose = (0,_utils_locale__WEBPACK_IMPORTED_MODULE_7__/* .isRTLLocale */ .iS)(locale) ? e.detail.originalEvent.offsetX < SCROLLBAR_WIDTH // left side of the screen clicked : e.detail.originalEvent.offsetX > currentTarget.clientWidth - SCROLLBAR_WIDTH; // right side of the screen clicked if (shouldPreventOnClose) { e.preventDefault(); return; } if (onClose) { onClose(); } }; return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__.Root, { open: isOpen, children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__.Portal, { children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__.Overlay, { className: (_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().overlay), ref: overlayRef, children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__.Content, { className: classnames__WEBPACK_IMPORTED_MODULE_3___default()((_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().contentWrapper), { [contentClassName]: contentClassName, [(_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().small)]: size === ContentModalSize.SMALL, [(_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().medium)]: size === ContentModalSize.MEDIUM, [(_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().autoHeight)]: !isFixedHeight }), onEscapeKeyDown: onEscapeKeyDown, onPointerDownOutside: onPointerDownOutside, children: [ hasHeader && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { className: (_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().header), children: [ hasCloseButton && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__.Close, { className: (_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().closeIcon), children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_Button_Button__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .ZP, { variant: _Button_Button__WEBPACK_IMPORTED_MODULE_5__/* .ButtonVariant.Ghost */ .Wu.Ghost, shape: _Button_Button__WEBPACK_IMPORTED_MODULE_5__/* .ButtonShape.Circle */ .jL.Circle, onClick: onClose, children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_icons_close_svg__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {}) }) }), header ] }), /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", { className: (_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().content), children: children }) ] }) }) }) }); }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentModal); __webpack_async_result__(); } catch(e) { __webpack_async_result__(e); } }); /***/ }), /***/ 46181: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var swr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15941); /* harmony import */ var _useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61368); var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([swr__WEBPACK_IMPORTED_MODULE_1__, _useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_2__]); ([swr__WEBPACK_IMPORTED_MODULE_1__, _useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_2__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__); /** * a hook on top of useSWRConfig.mutate to mutate multiple keys in the cache by matching a regex expression against * each of the keys in the cache. * * Inspired by {@see https://github.com/vercel/swr/discussions/488#discussioncomment-743074} * * @returns {(url: string, callback: MutatorCallback, options: MutatorOptions) => void} mutateMultipleKeys */ const useMutateMultipleKeys = ()=>{ const { cache , mutate } = (0,swr__WEBPACK_IMPORTED_MODULE_1__.useSWRConfig)(); const mutateMultipleKeys = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((regexExpression, callback)=>{ // @ts-ignore const cacheKeys = Array.from(cache.keys()); const pattern = new RegExp(regexExpression); cacheKeys.forEach((key)=>{ const keyMatches = pattern.test(key); if (keyMatches) { mutate(key, callback, _useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_2__/* .NO_REVALIDATION_MUTATOR_OPTIONS */ .F); } }); }, [ cache, mutate ]); return mutateMultipleKeys; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useMutateMultipleKeys); __webpack_async_result__(); } catch(e) { __webpack_async_result__(e); } }); /***/ }), /***/ 61368: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "F": () => (/* binding */ NO_REVALIDATION_MUTATOR_OPTIONS), /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var swr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15941); var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([swr__WEBPACK_IMPORTED_MODULE_1__]); swr__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0]; const NO_REVALIDATION_MUTATOR_OPTIONS = { revalidate: false }; /** * a hook on top of useSWRConfig.mutate to mutate without revalidation * * @returns {(url: string, callback: MutatorCallback) => void} mutateWithoutRevalidation */ const useMutateWithoutRevalidation = ()=>{ const { mutate } = (0,swr__WEBPACK_IMPORTED_MODULE_1__.useSWRConfig)(); const mutateWithoutRevalidation = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((url, callback)=>{ mutate(url, callback, NO_REVALIDATION_MUTATOR_OPTIONS); }, [ mutate ]); return mutateWithoutRevalidation; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useMutateWithoutRevalidation); __webpack_async_result__(); } catch(e) { __webpack_async_result__(e); } }); /***/ }), /***/ 99133: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); var ErrorMessageId; (function(ErrorMessageId) { ErrorMessageId["InvalidEmail"] = "invalid-email"; ErrorMessageId["RequiredField"] = "required-field"; ErrorMessageId["InvalidField"] = "invalid-field"; ErrorMessageId["MaximumLength"] = "maximum-length"; ErrorMessageId["MinimumLength"] = "minimum-length"; })(ErrorMessageId || (ErrorMessageId = {})); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ErrorMessageId); /***/ }) }; ; //# sourceMappingURL=87574.js.map