123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125 |
- 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
|