87574.js 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  1. exports.id = 87574;
  2. exports.ids = [87574];
  3. exports.modules = {
  4. /***/ 51053:
  5. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  6. "use strict";
  7. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  8. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  9. /* harmony export */ });
  10. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
  11. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  12. var _path;
  13. 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); }
  14. var SvgClose = function SvgClose(props) {
  15. return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({
  16. width: 24,
  17. height: 24,
  18. viewBox: "0 0 15 15",
  19. fill: "none",
  20. xmlns: "http://www.w3.org/2000/svg"
  21. }, props), _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", {
  22. 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",
  23. fill: "currentColor",
  24. fillRule: "evenodd",
  25. clipRule: "evenodd"
  26. })));
  27. };
  28. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SvgClose);
  29. /***/ }),
  30. /***/ 58421:
  31. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  32. "use strict";
  33. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  34. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  35. /* harmony export */ });
  36. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
  37. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  38. var _path;
  39. 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); }
  40. var SvgWest = function SvgWest(props) {
  41. return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({
  42. width: 24,
  43. height: 24,
  44. viewBox: "0 0 24 24",
  45. fill: "none",
  46. xmlns: "http://www.w3.org/2000/svg"
  47. }, props), _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", {
  48. d: "m9 19 1.41-1.41L5.83 13H22v-2H5.83l4.59-4.59L9 5l-7 7 7 7Z",
  49. fill: "currentColor"
  50. })));
  51. };
  52. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SvgWest);
  53. /***/ }),
  54. /***/ 23537:
  55. /***/ ((module) => {
  56. // Exports
  57. module.exports = {
  58. "container": "ContentContainer_container__s7dX2"
  59. };
  60. /***/ }),
  61. /***/ 76651:
  62. /***/ ((module) => {
  63. // Exports
  64. module.exports = {
  65. "container": "CourseFeedback_container__iBDGv"
  66. };
  67. /***/ }),
  68. /***/ 88462:
  69. /***/ ((module) => {
  70. // Exports
  71. module.exports = {
  72. "bodyInput": "CourseFeedbackForm_bodyInput__0TtN_",
  73. "submitButton": "CourseFeedbackForm_submitButton__vLdJc",
  74. "ratingContainer": "CourseFeedbackForm_ratingContainer__AF_0R"
  75. };
  76. /***/ }),
  77. /***/ 68609:
  78. /***/ ((module) => {
  79. // Exports
  80. module.exports = {
  81. "headerContainer": "CourseFeedbackModal_headerContainer__pubww",
  82. "desc": "CourseFeedbackModal_desc__UebUq"
  83. };
  84. /***/ }),
  85. /***/ 49126:
  86. /***/ ((module) => {
  87. // Exports
  88. module.exports = {
  89. "editor": "MarkdownEditor_editor__yKRsX",
  90. "content": "MarkdownEditor_content__4M3H4"
  91. };
  92. /***/ }),
  93. /***/ 93020:
  94. /***/ ((module) => {
  95. // Exports
  96. module.exports = {
  97. "container": "PageContainer_container__1TUET",
  98. "fullWidth": "PageContainer_fullWidth__RU5GM"
  99. };
  100. /***/ }),
  101. /***/ 19426:
  102. /***/ ((module) => {
  103. // Exports
  104. module.exports = {
  105. "modalContainer": "ContentModal_modalContainer__i7bo0",
  106. "contentContainer": "ContentModal_contentContainer___ciX5",
  107. "overlay": "ContentModal_overlay__qZfQY",
  108. "contentWrapper": "ContentModal_contentWrapper__VaiRB",
  109. "autoHeight": "ContentModal_autoHeight__A3IW7",
  110. "medium": "ContentModal_medium__EKB5h",
  111. "small": "ContentModal_small__YBKtM",
  112. "fadeIn": "ContentModal_fadeIn__JGh_A",
  113. "fadeOut": "ContentModal_fadeOut__36m_B",
  114. "contentIn": "ContentModal_contentIn__EAwQw",
  115. "contentOut": "ContentModal_contentOut__2x8WN",
  116. "closeIcon": "ContentModal_closeIcon__xppin",
  117. "header": "ContentModal_header__384F2",
  118. "content": "ContentModal_content__9M2Iy"
  119. };
  120. /***/ }),
  121. /***/ 23848:
  122. /***/ ((module) => {
  123. // Exports
  124. module.exports = {
  125. "pageContainer": "index_pageContainer__Pxtn3",
  126. "loadingContainer": "index_loadingContainer__WEZFc",
  127. "flow": "index_flow__rCTR5",
  128. "flowItem": "index_flowItem__GnXWz",
  129. "additionalVerticalGap": "index_additionalVerticalGap__nzYz6",
  130. "fullWidth": "index_fullWidth__1n4ux"
  131. };
  132. /***/ }),
  133. /***/ 86120:
  134. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  135. "use strict";
  136. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  137. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  138. /* harmony export */ });
  139. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  140. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  141. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
  142. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  143. const CompletedTick = ()=>{
  144. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
  145. children: ` ✔`
  146. });
  147. };
  148. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CompletedTick);
  149. /***/ }),
  150. /***/ 79215:
  151. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  152. "use strict";
  153. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  154. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  155. /* harmony export */ });
  156. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  157. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  158. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
  159. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  160. /* harmony import */ var _ContentContainer_module_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(23537);
  161. /* harmony import */ var _ContentContainer_module_scss__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_ContentContainer_module_scss__WEBPACK_IMPORTED_MODULE_2__);
  162. const ContentContainer = ({ children })=>{
  163. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
  164. className: (_ContentContainer_module_scss__WEBPACK_IMPORTED_MODULE_2___default().container),
  165. children: children
  166. });
  167. };
  168. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentContainer);
  169. /***/ }),
  170. /***/ 27914:
  171. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  172. "use strict";
  173. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  174. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  175. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  176. /* harmony export */ });
  177. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  178. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  179. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
  180. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  181. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(60866);
  182. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2__);
  183. /* harmony import */ var _CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(88462);
  184. /* harmony import */ var _CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16__);
  185. /* harmony import */ var _components_Course_utils_mutations__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(82969);
  186. /* harmony import */ var _components_FormBuilder_buildFormBuilderFormField__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57361);
  187. /* harmony import */ var _components_FormBuilder_buildTranslatedErrorMessageByErrorId__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(21485);
  188. /* harmony import */ var _components_FormBuilder_FormBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(37013);
  189. /* harmony import */ var _dls_Button_Button__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(50497);
  190. /* harmony import */ var _dls_Toast_Toast__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(79717);
  191. /* harmony import */ var _hooks_useMutateMultipleKeys__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(46181);
  192. /* harmony import */ var _hooks_useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(61368);
  193. /* harmony import */ var _types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(99133);
  194. /* harmony import */ var _types_FieldRule__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(98213);
  195. /* harmony import */ var _types_FormField__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(3840);
  196. /* harmony import */ var _utils_auth_api__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(37883);
  197. /* harmony import */ var _utils_eventLogger__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(55943);
  198. 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__]);
  199. ([_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__);
  200. const BODY_MAX_VALIDATION_PARAMS = {
  201. value: 10000
  202. };
  203. const CourseFeedbackForm = ({ course , onSuccess })=>{
  204. const { t } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2___default()("learn");
  205. const { 0: isLoading , 1: setIsLoading } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
  206. const toast = (0,_dls_Toast_Toast__WEBPACK_IMPORTED_MODULE_8__/* .useToast */ .pm)();
  207. const mutateWithoutRevalidation = (0,_hooks_useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z)();
  208. const mutateMultipleKeys = (0,_hooks_useMutateMultipleKeys__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z)();
  209. const submitFeedback = async (formData)=>{
  210. setIsLoading(true);
  211. (0,_utils_auth_api__WEBPACK_IMPORTED_MODULE_14__/* .postCourseFeedback */ .ku)({
  212. courseId: course.id,
  213. ...formData
  214. }).then(()=>{
  215. toast(t("feedback.feedback-success"), {
  216. status: _dls_Toast_Toast__WEBPACK_IMPORTED_MODULE_8__/* .ToastStatus.Success */ .YZ.Success
  217. });
  218. // update local cache to set userHasFeedback to true
  219. (0,_components_Course_utils_mutations__WEBPACK_IMPORTED_MODULE_3__/* .mutateCachedCourseAfterFeedback */ .Hf)(mutateWithoutRevalidation, course.slug);
  220. (0,_components_Course_utils_mutations__WEBPACK_IMPORTED_MODULE_3__/* .mutateCachedLessonsAfterFeedback */ .eh)(mutateMultipleKeys, course.slug);
  221. onSuccess();
  222. }).catch(()=>{
  223. toast(t("common:error.general"), {
  224. status: _dls_Toast_Toast__WEBPACK_IMPORTED_MODULE_8__/* .ToastStatus.Error */ .YZ.Error
  225. });
  226. }).finally(()=>{
  227. setIsLoading(false);
  228. });
  229. };
  230. const onSubmit = async (formData)=>{
  231. (0,_utils_eventLogger__WEBPACK_IMPORTED_MODULE_15__/* .logFormSubmission */ .dz)("course_feedback", formData);
  232. submitFeedback(formData);
  233. };
  234. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_FormBuilder_FormBuilder__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
  235. formFields: [
  236. {
  237. field: "rating",
  238. type: _types_FormField__WEBPACK_IMPORTED_MODULE_13__/* .FormFieldType.StarRating */ .E.StarRating,
  239. // user must pick a rating
  240. defaultValue: null,
  241. containerClassName: (_CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16___default().ratingContainer),
  242. rules: [
  243. {
  244. type: _types_FieldRule__WEBPACK_IMPORTED_MODULE_12__/* .RuleType.Required */ .S.Required,
  245. value: true,
  246. errorId: _types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_11__/* ["default"].RequiredField */ .Z.RequiredField,
  247. errorMessage: (0,_components_FormBuilder_buildTranslatedErrorMessageByErrorId__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(_types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_11__/* ["default"].RequiredField */ .Z.RequiredField, "rating", t)
  248. },
  249. ]
  250. },
  251. {
  252. field: "body",
  253. placeholder: t("feedback.feedback-placeholder"),
  254. rules: [
  255. {
  256. ...BODY_MAX_VALIDATION_PARAMS,
  257. type: _types_FieldRule__WEBPACK_IMPORTED_MODULE_12__/* .RuleType.MaximumLength */ .S.MaximumLength,
  258. errorId: _types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_11__/* ["default"].MaximumLength */ .Z.MaximumLength,
  259. errorExtraParams: {
  260. ...BODY_MAX_VALIDATION_PARAMS
  261. },
  262. errorMessage: (0,_components_FormBuilder_buildTranslatedErrorMessageByErrorId__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(_types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_11__/* ["default"].MaximumLength */ .Z.MaximumLength, "body", t, {
  263. ...BODY_MAX_VALIDATION_PARAMS
  264. })
  265. },
  266. ],
  267. type: _types_FormField__WEBPACK_IMPORTED_MODULE_13__/* .FormFieldType.TextArea */ .E.TextArea,
  268. containerClassName: (_CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16___default().bodyInput),
  269. fieldSetLegend: t("feedback.your-feedback")
  270. },
  271. ].map((field)=>(0,_components_FormBuilder_buildFormBuilderFormField__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)(field, t)),
  272. onSubmit: onSubmit,
  273. isSubmitting: isLoading,
  274. renderAction: ({ isLoading: isSubmitting })=>{
  275. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
  276. className: (_CourseFeedbackForm_module_scss__WEBPACK_IMPORTED_MODULE_16___default().submitButton),
  277. children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Button_Button__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP, {
  278. htmlType: "submit",
  279. isLoading: isSubmitting,
  280. isDisabled: isSubmitting,
  281. children: t("common:submit")
  282. })
  283. });
  284. }
  285. });
  286. };
  287. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CourseFeedbackForm);
  288. __webpack_async_result__();
  289. } catch(e) { __webpack_async_result__(e); } });
  290. /***/ }),
  291. /***/ 55691:
  292. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  293. "use strict";
  294. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  295. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  296. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  297. /* harmony export */ });
  298. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  299. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  300. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
  301. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  302. /* harmony import */ var next_translate_Trans__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(74137);
  303. /* harmony import */ var next_translate_Trans__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_translate_Trans__WEBPACK_IMPORTED_MODULE_2__);
  304. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(60866);
  305. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3__);
  306. /* harmony import */ var _CourseFeedbackForm__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27914);
  307. /* harmony import */ var _CourseFeedbackModal_module_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(68609);
  308. /* harmony import */ var _CourseFeedbackModal_module_scss__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_CourseFeedbackModal_module_scss__WEBPACK_IMPORTED_MODULE_6__);
  309. /* harmony import */ var _dls_ContentModal_ContentModal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(66606);
  310. var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_CourseFeedbackForm__WEBPACK_IMPORTED_MODULE_4__, _dls_ContentModal_ContentModal__WEBPACK_IMPORTED_MODULE_5__]);
  311. ([_CourseFeedbackForm__WEBPACK_IMPORTED_MODULE_4__, _dls_ContentModal_ContentModal__WEBPACK_IMPORTED_MODULE_5__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
  312. const CourseFeedbackModal = ({ onClose , isOpen , course })=>{
  313. const { t } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3___default()("learn");
  314. const contentModalRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)();
  315. const { title } = course;
  316. return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_dls_ContentModal_ContentModal__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
  317. innerRef: contentModalRef,
  318. isOpen: isOpen,
  319. header: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
  320. className: (_CourseFeedbackModal_module_scss__WEBPACK_IMPORTED_MODULE_6___default().headerContainer),
  321. children: t("feedback.add-feedback")
  322. }),
  323. hasCloseButton: true,
  324. onClose: onClose,
  325. onEscapeKeyDown: onClose,
  326. size: _dls_ContentModal_ContentModal__WEBPACK_IMPORTED_MODULE_5__/* .ContentModalSize.MEDIUM */ .S.MEDIUM,
  327. children: [
  328. /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
  329. className: (_CourseFeedbackModal_module_scss__WEBPACK_IMPORTED_MODULE_6___default().desc),
  330. children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((next_translate_Trans__WEBPACK_IMPORTED_MODULE_2___default()), {
  331. components: {
  332. br: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("br", {})
  333. },
  334. i18nKey: "learn:feedback.desc",
  335. values: {
  336. courseName: title
  337. }
  338. })
  339. }),
  340. /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_CourseFeedbackForm__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
  341. onSuccess: onClose,
  342. course: course
  343. })
  344. ]
  345. });
  346. };
  347. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CourseFeedbackModal);
  348. __webpack_async_result__();
  349. } catch(e) { __webpack_async_result__(e); } });
  350. /***/ }),
  351. /***/ 18370:
  352. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  353. "use strict";
  354. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  355. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  356. /* harmony export */ "E": () => (/* binding */ FeedbackSource),
  357. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  358. /* harmony export */ });
  359. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  360. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  361. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
  362. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  363. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(60866);
  364. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2__);
  365. /* harmony import */ var _CourseFeedback_module_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(76651);
  366. /* harmony import */ var _CourseFeedback_module_scss__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_CourseFeedback_module_scss__WEBPACK_IMPORTED_MODULE_6__);
  367. /* harmony import */ var _CourseFeedbackModal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(55691);
  368. /* harmony import */ var _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(50497);
  369. /* harmony import */ var _utils_eventLogger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55943);
  370. 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__]);
  371. ([_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__);
  372. var FeedbackSource;
  373. (function(FeedbackSource) {
  374. FeedbackSource["CoursePage"] = "course_page";
  375. FeedbackSource["LessonPage"] = "lesson_page";
  376. })(FeedbackSource || (FeedbackSource = {}));
  377. const CourseFeedback = ({ source , course , shouldOpenModal =false })=>{
  378. const { t } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2___default()("learn");
  379. const { 0: isModalOpen , 1: setIsModalOpen } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
  380. /**
  381. * listen to changes from the parent component. This will happen when the user
  382. * completes last lesson of the course.
  383. */ (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{
  384. if (shouldOpenModal) {
  385. setIsModalOpen(true);
  386. }
  387. }, [
  388. shouldOpenModal
  389. ]);
  390. const onAddFeedbackClicked = ()=>{
  391. (0,_utils_eventLogger__WEBPACK_IMPORTED_MODULE_5__/* .logButtonClick */ .MY)("add_course_feedback", {
  392. source
  393. });
  394. setIsModalOpen(true);
  395. };
  396. return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
  397. className: (_CourseFeedback_module_scss__WEBPACK_IMPORTED_MODULE_6___default().container),
  398. children: [
  399. /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .ZP, {
  400. size: _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__/* .ButtonSize.Small */ .qE.Small,
  401. type: _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__/* .ButtonType.Primary */ .L$.Primary,
  402. onClick: onAddFeedbackClicked,
  403. children: t("feedback.add-feedback")
  404. }),
  405. /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_CourseFeedbackModal__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
  406. course: course,
  407. isOpen: isModalOpen,
  408. onClose: ()=>setIsModalOpen(false)
  409. })
  410. ]
  411. });
  412. };
  413. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CourseFeedback);
  414. __webpack_async_result__();
  415. } catch(e) { __webpack_async_result__(e); } });
  416. /***/ }),
  417. /***/ 82969:
  418. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  419. "use strict";
  420. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  421. /* harmony export */ "Hf": () => (/* binding */ mutateCachedCourseAfterFeedback),
  422. /* harmony export */ "eh": () => (/* binding */ mutateCachedLessonsAfterFeedback),
  423. /* harmony export */ "gx": () => (/* binding */ mutateCachedCourseAfterCompletion),
  424. /* harmony export */ "z1": () => (/* binding */ mutateCachedLessonsAfterCompletion)
  425. /* harmony export */ });
  426. /* unused harmony exports getContinueFromLesson, mutateLessonAsCompleted, getUpdatedLessonDataAfterCompletion, getUpdatedCourseDataAfterCompletion, getUpdatedCourseDataAfterFeedback, getUpdatedLessonDataAfterFeedback */
  427. /* harmony import */ var _utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13830);
  428. /**
  429. * Given an ordered list of lessons and a list of completed lessons:
  430. *
  431. * – If all of them are completed, return the first
  432. * - If none of them are completed, return the first
  433. * - If only some of them are completed, return the 1st uncompleted lesson.
  434. *
  435. * @param {Lesson[]} lessons
  436. *
  437. * @returns {string}
  438. */ const getContinueFromLesson = (lessons)=>{
  439. if (!lessons) {
  440. return null;
  441. }
  442. const completedLessonIds = lessons.filter((lesson)=>lesson.isCompleted).map((lesson)=>lesson.id);
  443. const numberOfCompletedLessons = completedLessonIds.length;
  444. // if no lessons were completed, return the first lesson
  445. if (numberOfCompletedLessons === 0) {
  446. return lessons[0].slug;
  447. }
  448. // if all lessons were completed, return the first lesson
  449. if (numberOfCompletedLessons === lessons.length) {
  450. return lessons[0].slug;
  451. }
  452. // 1. make sure the lessons are sorted by day
  453. const sortedLessons = lessons.sort((a, b)=>a.day - b.day);
  454. // 2. pick first uncompleted lesson
  455. for(let index = 0; index < sortedLessons.length; index += 1){
  456. // if the lessons has not been completed, return in
  457. if (!completedLessonIds.includes(sortedLessons[index].id)) {
  458. return sortedLessons[index].slug;
  459. }
  460. }
  461. return null;
  462. };
  463. /**
  464. * Given a lessons array and a lesson id, it returns a new lessons array
  465. * after setting the lesson with the given id set as completed.
  466. *
  467. * @param {Lesson[]} lessons
  468. * @param {string} lessonId
  469. * @returns {Lesson[]}
  470. */ const mutateLessonAsCompleted = (lessons, lessonId)=>{
  471. const newLessons = [
  472. ...lessons
  473. ];
  474. const lessonIndex = newLessons.findIndex((loopLesson)=>loopLesson.id === lessonId);
  475. // safety check: if the lesson was found in the lessons array, set it as completed
  476. if (lessonIndex !== -1) {
  477. newLessons[lessonIndex].isCompleted = true;
  478. }
  479. return newLessons;
  480. };
  481. /**
  482. * This function receives the cached lesson data and the id of the lesson that was just completed
  483. * and expects to return the updated lesson data with the lesson marked as completed
  484. * which will be used to update the local cache without having to call the API again.
  485. *
  486. * @param {Lesson} cachedLessonData
  487. * @param {string} completedLessonId
  488. * @returns {Lesson}
  489. */ const getUpdatedLessonDataAfterCompletion = (cachedLessonData, completedLessonId)=>{
  490. if (cachedLessonData) {
  491. const updatedLessonData = {
  492. ...cachedLessonData
  493. };
  494. // only set the completed lesson data to completed
  495. if (updatedLessonData.id === completedLessonId) {
  496. updatedLessonData.isCompleted = true;
  497. }
  498. // if the lesson has a course, we should update the lessons array of the course
  499. if (cachedLessonData?.course?.lessons) {
  500. updatedLessonData.course.lessons = mutateLessonAsCompleted(updatedLessonData.course.lessons, completedLessonId);
  501. }
  502. return updatedLessonData;
  503. }
  504. return cachedLessonData;
  505. };
  506. /**
  507. * This function receives the cached course data and the id of the lesson that was just completed
  508. * and expects to return the updated course data with the lesson marked as completed
  509. * which will be used to update the local cache without having to call the API again.
  510. *
  511. * @param {Course} cachedCourseData
  512. * @param {string} completedLessonId
  513. * @returns {Course}
  514. */ const getUpdatedCourseDataAfterCompletion = (cachedCourseData, completedLessonId)=>{
  515. if (cachedCourseData) {
  516. const updatedCourseData = {
  517. ...cachedCourseData
  518. };
  519. // if the course has lessons, we should update the lessons array
  520. if (updatedCourseData?.lessons) {
  521. const completedLessons = updatedCourseData.lessons.filter((loopLesson)=>loopLesson.isCompleted);
  522. // if we are marking the last un-completed lesson in the course, we should mark the course itself as completed
  523. if (completedLessons.length + 1 === updatedCourseData.lessons.length) {
  524. updatedCourseData.isCompleted = true;
  525. }
  526. updatedCourseData.lessons = mutateLessonAsCompleted(updatedCourseData.lessons, completedLessonId);
  527. updatedCourseData.continueFromLesson = getContinueFromLesson(updatedCourseData.lessons);
  528. }
  529. return updatedCourseData;
  530. }
  531. return cachedCourseData;
  532. };
  533. /**
  534. * we need to update all the cached lessons of the course to set the current lesson as completed
  535. *
  536. * @param {any} mutatorFunction
  537. * @param {string} courseSlug
  538. * @param {string} completedLessonId
  539. *
  540. * @returns {void}
  541. */ const mutateCachedLessonsAfterCompletion = (mutatorFunction, courseSlug, completedLessonId)=>{
  542. const courseLessonsUrlRegex = `^${(0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeGetLessonUrlPrefix */ .i5)(courseSlug)}/.+`;
  543. mutatorFunction(courseLessonsUrlRegex, (cachedLessonData)=>getUpdatedLessonDataAfterCompletion(cachedLessonData, completedLessonId));
  544. };
  545. /**
  546. * update local cache of the course to set the current lesson as completed in the lessons array
  547. *
  548. * @param {any} mutatorFunction
  549. * @param {string} courseSlug
  550. * @param {string} completedLessonId
  551. *
  552. * @returns {void}
  553. */ const mutateCachedCourseAfterCompletion = (mutatorFunction, courseSlug, completedLessonId)=>{
  554. mutatorFunction((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeGetCourseUrl */ .vp)(courseSlug), (cachedCourseData)=>getUpdatedCourseDataAfterCompletion(cachedCourseData, completedLessonId));
  555. };
  556. /**
  557. * we need to update all the cached lessons of the course to set the current lesson as completed
  558. *
  559. * @param {any} mutatorFunction
  560. * @param {string} courseSlug
  561. *
  562. * @returns {void}
  563. */ const mutateCachedLessonsAfterFeedback = (mutatorFunction, courseSlug)=>{
  564. const courseLessonsUrlRegex = `^${(0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeGetLessonUrlPrefix */ .i5)(courseSlug)}/.+`;
  565. mutatorFunction(courseLessonsUrlRegex, (cachedLessonData)=>getUpdatedLessonDataAfterFeedback(cachedLessonData));
  566. };
  567. /**
  568. * update local cache of the course to set the current lesson as completed in the lessons array
  569. *
  570. * @param {any} mutatorFunction
  571. * @param {string} courseSlug
  572. *
  573. * @returns {void}
  574. */ const mutateCachedCourseAfterFeedback = (mutatorFunction, courseSlug)=>{
  575. mutatorFunction((0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeGetCourseUrl */ .vp)(courseSlug), (cachedCourseData)=>getUpdatedCourseDataAfterFeedback(cachedCourseData));
  576. };
  577. /**
  578. * This function receives the cached course data and the id of the lesson that was just completed
  579. * and expects to return the updated course data with the lesson marked as completed
  580. * which will be used to update the local cache without having to call the API again.
  581. *
  582. * @param {Course} cachedCourseData
  583. * @returns {Course}
  584. */ const getUpdatedCourseDataAfterFeedback = (cachedCourseData)=>{
  585. if (cachedCourseData) {
  586. const updatedCourseData = {
  587. ...cachedCourseData
  588. };
  589. updatedCourseData.userHasFeedback = true;
  590. return updatedCourseData;
  591. }
  592. return cachedCourseData;
  593. };
  594. /**
  595. * This function receives the cached lesson data and the id of the lesson that was just completed
  596. * and expects to return the updated lesson data with the lesson marked as completed
  597. * which will be used to update the local cache without having to call the API again.
  598. *
  599. * @param {Lesson} cachedLessonData
  600. * @returns {Lesson}
  601. */ const getUpdatedLessonDataAfterFeedback = (cachedLessonData)=>{
  602. if (cachedLessonData) {
  603. const updatedLessonData = {
  604. ...cachedLessonData
  605. };
  606. // if the lesson has a course, we should update it to userHasFeedback = true
  607. if (cachedLessonData?.course) {
  608. updatedLessonData.course = {
  609. ...updatedLessonData.course,
  610. userHasFeedback: true
  611. };
  612. }
  613. return updatedLessonData;
  614. }
  615. return cachedLessonData;
  616. };
  617. /***/ }),
  618. /***/ 57361:
  619. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  620. "use strict";
  621. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  622. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  623. /* harmony export */ });
  624. /* harmony import */ var lodash_capitalize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59969);
  625. /* harmony import */ var lodash_capitalize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_capitalize__WEBPACK_IMPORTED_MODULE_0__);
  626. /* harmony import */ var types_FormField__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3840);
  627. /**
  628. * Transform FormField to be FormBuilderFormField
  629. *
  630. * FormField and FormBuilderFormField are the same except, FormBuilderFormField is not tied to errorId and translationId
  631. * - Previously FormBuilder was tied to common.json, next-translate.
  632. * - and it's also tied to ErrorMessageId
  633. * - and the `label` is also less flexible because it's tied to `field` value
  634. *
  635. * This function help to transform FormField to FormBuilderFormField for common use case.
  636. * But when we need a more flexible use case, we can use FormBuilderFormField directly. Without using this helper function
  637. *
  638. * check ./FormBuilderTypes.ts for more info
  639. *
  640. * Note that this function expect the `t` translate function to be used with `common.json`. And expect `form.$field` and `validation.$errorId` to exist.
  641. *
  642. * @param {FormField} formField
  643. * @returns {FormBuilderFormField} formBuilderFormField
  644. */ const buildFormBuilderFormField = (formField, t)=>{
  645. return {
  646. ...formField,
  647. ...formField.rules && {
  648. rules: formField.rules.map((rule)=>({
  649. type: rule.type,
  650. value: rule.value,
  651. errorMessage: t(`common:validation.${rule.errorId}`, {
  652. field: lodash_capitalize__WEBPACK_IMPORTED_MODULE_0___default()(formField.field),
  653. ...rule.errorExtraParams
  654. })
  655. }))
  656. },
  657. ...formField.label && {
  658. label: formField.type === types_FormField__WEBPACK_IMPORTED_MODULE_1__/* .FormFieldType.Checkbox */ .E.Checkbox ? formField.label : t(`form.${formField.label}`)
  659. },
  660. ...formField.defaultValue && {
  661. defaultValue: formField.defaultValue
  662. },
  663. ...formField.placeholder && {
  664. placeholder: formField.placeholder
  665. }
  666. };
  667. };
  668. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (buildFormBuilderFormField);
  669. /***/ }),
  670. /***/ 21485:
  671. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  672. "use strict";
  673. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  674. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  675. /* harmony export */ });
  676. /* harmony import */ var lodash_capitalize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59969);
  677. /* harmony import */ var lodash_capitalize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_capitalize__WEBPACK_IMPORTED_MODULE_0__);
  678. /* harmony import */ var types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99133);
  679. const DEFAULT_ERROR_ID = types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_1__/* ["default"].InvalidField */ .Z.InvalidField;
  680. const buildTranslatedErrorMessageByErrorId = (errorId, fieldName, t, extraParams)=>{
  681. if (Object.values(types_ErrorMessageId__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z).includes(errorId)) {
  682. return t(`common:validation.${errorId}`, {
  683. field: lodash_capitalize__WEBPACK_IMPORTED_MODULE_0___default()(fieldName),
  684. ...extraParams
  685. });
  686. }
  687. return t(`common:validation.${DEFAULT_ERROR_ID}`, {
  688. field: lodash_capitalize__WEBPACK_IMPORTED_MODULE_0___default()(fieldName)
  689. });
  690. };
  691. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (buildTranslatedErrorMessageByErrorId);
  692. /***/ }),
  693. /***/ 3177:
  694. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  695. "use strict";
  696. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  697. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  698. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  699. /* harmony export */ });
  700. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  701. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  702. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
  703. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  704. /* harmony import */ var _milkdown_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57964);
  705. /* harmony import */ var _milkdown_preset_commonmark__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42154);
  706. /* harmony import */ var _milkdown_react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(76915);
  707. /* harmony import */ var _milkdown_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(64744);
  708. /* harmony import */ var _components_MarkdownEditor_MarkdownEditor_module_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(49126);
  709. /* 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__);
  710. 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__]);
  711. ([_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__);
  712. const MarkdownEditor = ({ isEditable =true , defaultValue })=>{
  713. const { get } = (0,_milkdown_react__WEBPACK_IMPORTED_MODULE_4__.useEditor)((root)=>{
  714. return _milkdown_core__WEBPACK_IMPORTED_MODULE_2__.Editor.make().config((ctx)=>{
  715. ctx.set(_milkdown_core__WEBPACK_IMPORTED_MODULE_2__.rootCtx, root);
  716. if (defaultValue) {
  717. ctx.set(_milkdown_core__WEBPACK_IMPORTED_MODULE_2__.defaultValueCtx, defaultValue);
  718. }
  719. // Add attributes to the editor container
  720. ctx.update(_milkdown_core__WEBPACK_IMPORTED_MODULE_2__.editorViewOptionsCtx, (prev)=>({
  721. ...prev,
  722. editable: ()=>isEditable,
  723. attributes: {
  724. class: (_components_MarkdownEditor_MarkdownEditor_module_scss__WEBPACK_IMPORTED_MODULE_6___default().editor),
  725. spellcheck: "false"
  726. }
  727. }));
  728. }).use(_milkdown_preset_commonmark__WEBPACK_IMPORTED_MODULE_3__.commonmark);
  729. }, []);
  730. (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{
  731. if (defaultValue) {
  732. get()?.action((0,_milkdown_utils__WEBPACK_IMPORTED_MODULE_5__.replaceAll)(defaultValue));
  733. }
  734. }, [
  735. defaultValue,
  736. get
  737. ]);
  738. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
  739. className: (_components_MarkdownEditor_MarkdownEditor_module_scss__WEBPACK_IMPORTED_MODULE_6___default().content),
  740. children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_milkdown_react__WEBPACK_IMPORTED_MODULE_4__.Milkdown, {})
  741. });
  742. };
  743. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MarkdownEditor);
  744. __webpack_async_result__();
  745. } catch(e) { __webpack_async_result__(e); } });
  746. /***/ }),
  747. /***/ 9234:
  748. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  749. "use strict";
  750. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  751. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  752. /* harmony export */ });
  753. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  754. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  755. /* harmony import */ var _PageContainer_module_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(93020);
  756. /* harmony import */ var _PageContainer_module_scss__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_PageContainer_module_scss__WEBPACK_IMPORTED_MODULE_1__);
  757. const PageContainer = ({ children })=>{
  758. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
  759. className: (_PageContainer_module_scss__WEBPACK_IMPORTED_MODULE_1___default().container),
  760. children: children
  761. });
  762. };
  763. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PageContainer);
  764. /***/ }),
  765. /***/ 66606:
  766. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  767. "use strict";
  768. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  769. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  770. /* harmony export */ "S": () => (/* binding */ ContentModalSize),
  771. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  772. /* harmony export */ });
  773. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  774. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  775. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
  776. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  777. /* harmony import */ var _radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(77715);
  778. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(59003);
  779. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);
  780. /* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71853);
  781. /* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(next_router__WEBPACK_IMPORTED_MODULE_4__);
  782. /* harmony import */ var _Button_Button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(50497);
  783. /* harmony import */ var _ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(19426);
  784. /* harmony import */ var _ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8__);
  785. /* harmony import */ var _icons_close_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(51053);
  786. /* harmony import */ var _utils_locale__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(24709);
  787. var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__, _Button_Button__WEBPACK_IMPORTED_MODULE_5__]);
  788. ([_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__);
  789. var ContentModalSize;
  790. (function(ContentModalSize) {
  791. ContentModalSize["SMALL"] = "small";
  792. ContentModalSize["MEDIUM"] = "medium";
  793. })(ContentModalSize || (ContentModalSize = {}));
  794. const SCROLLBAR_WIDTH = 15;
  795. const ContentModal = ({ isOpen , onClose , onEscapeKeyDown , hasCloseButton , children , header , innerRef , contentClassName , size =ContentModalSize.MEDIUM , isFixedHeight , hasHeader =true })=>{
  796. const overlayRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)();
  797. const { locale } = (0,next_router__WEBPACK_IMPORTED_MODULE_4__.useRouter)();
  798. (0,react__WEBPACK_IMPORTED_MODULE_1__.useImperativeHandle)(innerRef, ()=>({
  799. scrollToTop: ()=>{
  800. if (overlayRef.current) overlayRef.current.scrollTop = 0;
  801. }
  802. }));
  803. /**
  804. * We need to manually check what the user is targeting. If it lies at the
  805. * area where the scroll bar is (assuming the scrollbar width is equivalent
  806. * to SCROLLBAR_WIDTH), then we don't close the Modal, otherwise we do.
  807. * We also need to check if the current locale is RTL or LTR because the side
  808. * where the scrollbar is will be different and therefor the value of
  809. * {e.detail.originalEvent.offsetX} will be different.
  810. *
  811. * inspired by {@see https://github.com/radix-ui/primitives/issues/1280#issuecomment-1198248523}
  812. *
  813. * @param {any} e
  814. */ const onPointerDownOutside = (e)=>{
  815. const currentTarget = e.currentTarget;
  816. const shouldPreventOnClose = (0,_utils_locale__WEBPACK_IMPORTED_MODULE_7__/* .isRTLLocale */ .iS)(locale) ? e.detail.originalEvent.offsetX < SCROLLBAR_WIDTH // left side of the screen clicked
  817. : e.detail.originalEvent.offsetX > currentTarget.clientWidth - SCROLLBAR_WIDTH; // right side of the screen clicked
  818. if (shouldPreventOnClose) {
  819. e.preventDefault();
  820. return;
  821. }
  822. if (onClose) {
  823. onClose();
  824. }
  825. };
  826. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__.Root, {
  827. open: isOpen,
  828. children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__.Portal, {
  829. children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__.Overlay, {
  830. className: (_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().overlay),
  831. ref: overlayRef,
  832. children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__.Content, {
  833. className: classnames__WEBPACK_IMPORTED_MODULE_3___default()((_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().contentWrapper), {
  834. [contentClassName]: contentClassName,
  835. [(_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().small)]: size === ContentModalSize.SMALL,
  836. [(_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().medium)]: size === ContentModalSize.MEDIUM,
  837. [(_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().autoHeight)]: !isFixedHeight
  838. }),
  839. onEscapeKeyDown: onEscapeKeyDown,
  840. onPointerDownOutside: onPointerDownOutside,
  841. children: [
  842. hasHeader && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
  843. className: (_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().header),
  844. children: [
  845. hasCloseButton && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_radix_ui_react_dialog__WEBPACK_IMPORTED_MODULE_2__.Close, {
  846. className: (_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().closeIcon),
  847. children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_Button_Button__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .ZP, {
  848. variant: _Button_Button__WEBPACK_IMPORTED_MODULE_5__/* .ButtonVariant.Ghost */ .Wu.Ghost,
  849. shape: _Button_Button__WEBPACK_IMPORTED_MODULE_5__/* .ButtonShape.Circle */ .jL.Circle,
  850. onClick: onClose,
  851. children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_icons_close_svg__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {})
  852. })
  853. }),
  854. header
  855. ]
  856. }),
  857. /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
  858. className: (_ContentModal_module_scss__WEBPACK_IMPORTED_MODULE_8___default().content),
  859. children: children
  860. })
  861. ]
  862. })
  863. })
  864. })
  865. });
  866. };
  867. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentModal);
  868. __webpack_async_result__();
  869. } catch(e) { __webpack_async_result__(e); } });
  870. /***/ }),
  871. /***/ 46181:
  872. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  873. "use strict";
  874. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  875. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  876. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  877. /* harmony export */ });
  878. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
  879. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  880. /* harmony import */ var swr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15941);
  881. /* harmony import */ var _useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61368);
  882. var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([swr__WEBPACK_IMPORTED_MODULE_1__, _useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_2__]);
  883. ([swr__WEBPACK_IMPORTED_MODULE_1__, _useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_2__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
  884. /**
  885. * a hook on top of useSWRConfig.mutate to mutate multiple keys in the cache by matching a regex expression against
  886. * each of the keys in the cache.
  887. *
  888. * Inspired by {@see https://github.com/vercel/swr/discussions/488#discussioncomment-743074}
  889. *
  890. * @returns {(url: string, callback: MutatorCallback, options: MutatorOptions) => void} mutateMultipleKeys
  891. */ const useMutateMultipleKeys = ()=>{
  892. const { cache , mutate } = (0,swr__WEBPACK_IMPORTED_MODULE_1__.useSWRConfig)();
  893. const mutateMultipleKeys = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((regexExpression, callback)=>{
  894. // @ts-ignore
  895. const cacheKeys = Array.from(cache.keys());
  896. const pattern = new RegExp(regexExpression);
  897. cacheKeys.forEach((key)=>{
  898. const keyMatches = pattern.test(key);
  899. if (keyMatches) {
  900. mutate(key, callback, _useMutateWithoutRevalidation__WEBPACK_IMPORTED_MODULE_2__/* .NO_REVALIDATION_MUTATOR_OPTIONS */ .F);
  901. }
  902. });
  903. }, [
  904. cache,
  905. mutate
  906. ]);
  907. return mutateMultipleKeys;
  908. };
  909. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useMutateMultipleKeys);
  910. __webpack_async_result__();
  911. } catch(e) { __webpack_async_result__(e); } });
  912. /***/ }),
  913. /***/ 61368:
  914. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  915. "use strict";
  916. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  917. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  918. /* harmony export */ "F": () => (/* binding */ NO_REVALIDATION_MUTATOR_OPTIONS),
  919. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  920. /* harmony export */ });
  921. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
  922. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  923. /* harmony import */ var swr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15941);
  924. var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([swr__WEBPACK_IMPORTED_MODULE_1__]);
  925. swr__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
  926. const NO_REVALIDATION_MUTATOR_OPTIONS = {
  927. revalidate: false
  928. };
  929. /**
  930. * a hook on top of useSWRConfig.mutate to mutate without revalidation
  931. *
  932. * @returns {(url: string, callback: MutatorCallback) => void} mutateWithoutRevalidation
  933. */ const useMutateWithoutRevalidation = ()=>{
  934. const { mutate } = (0,swr__WEBPACK_IMPORTED_MODULE_1__.useSWRConfig)();
  935. const mutateWithoutRevalidation = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((url, callback)=>{
  936. mutate(url, callback, NO_REVALIDATION_MUTATOR_OPTIONS);
  937. }, [
  938. mutate
  939. ]);
  940. return mutateWithoutRevalidation;
  941. };
  942. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useMutateWithoutRevalidation);
  943. __webpack_async_result__();
  944. } catch(e) { __webpack_async_result__(e); } });
  945. /***/ }),
  946. /***/ 99133:
  947. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  948. "use strict";
  949. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  950. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  951. /* harmony export */ });
  952. var ErrorMessageId;
  953. (function(ErrorMessageId) {
  954. ErrorMessageId["InvalidEmail"] = "invalid-email";
  955. ErrorMessageId["RequiredField"] = "required-field";
  956. ErrorMessageId["InvalidField"] = "invalid-field";
  957. ErrorMessageId["MaximumLength"] = "maximum-length";
  958. ErrorMessageId["MinimumLength"] = "minimum-length";
  959. })(ErrorMessageId || (ErrorMessageId = {}));
  960. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ErrorMessageId);
  961. /***/ })
  962. };
  963. ;
  964. //# sourceMappingURL=87574.js.map