22042-838dfd6fdd3687bc.js 13 KB

12
  1. (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[22042],{99574:function(e,n,t){"use strict";var r=t(57611);t(67597);n.Z=function(){return(0,r.jsx)("span",{children:" \u2714"})}},10440:function(e,n,t){"use strict";var r=t(57611),o=(t(67597),t(84765)),i=t.n(o);n.Z=function(e){var n=e.children;return(0,r.jsx)("div",{className:i().container,children:n})}},31855:function(e,n,t){"use strict";t.d(n,{E:function(){return r},Z:function(){return P}});var r,o=t(57611),i=t(67597),a=t(61395),u=t(69427),c=t.n(u),s=t(67385),l=t(1997),d=t(57044),f=t(16946),_=t(51726),m=t(82471),v=t.n(m),h=t(10191),p=t(79194),g=t(6507),x=t(47995),C=t(85494),Z=t(85609),b=t(4083),M=t(32607),k=t(48559),y=t(12253),j=t(24277),E=t(9740),I=t(12195),w={value:1e4},F=function(e){var n=e.course,t=e.onSuccess,r=(0,a.Z)("learn").t,u=(0,i.useState)(!1),c=u[0],s=u[1],m=(0,Z.useToast)(),F=(0,M.Z)(),S=(0,b.Z)(),N=function(){var e=(0,l.Z)((function(e){return(0,_.__generator)(this,(function(o){return s(!0),(0,E.ku)((0,d.Z)({courseId:n.id},e)).then((function(){m(r("feedback.feedback-success"),{status:Z.ToastStatus.Success}),(0,h.Hf)(F,n.slug),(0,h.eh)(S,n.slug),t()})).catch((function(){m(r("common:error.general"),{status:Z.ToastStatus.Error})})).finally((function(){s(!1)})),[2]}))}));return function(n){return e.apply(this,arguments)}}(),R=function(){var e=(0,l.Z)((function(e){return(0,_.__generator)(this,(function(n){return(0,I.dz)("course_feedback",e),N(e),[2]}))}));return function(n){return e.apply(this,arguments)}}();return(0,o.jsx)(x.Z,{formFields:[{field:"rating",type:j.E.StarRating,defaultValue:null,containerClassName:v().ratingContainer,rules:[{type:y.S.Required,value:!0,errorId:k.Z.RequiredField,errorMessage:(0,g.Z)(k.Z.RequiredField,"rating",r)}]},{field:"body",placeholder:r("feedback.feedback-placeholder"),rules:[(0,f.Z)((0,d.Z)({},w),{type:y.S.MaximumLength,errorId:k.Z.MaximumLength,errorExtraParams:(0,d.Z)({},w),errorMessage:(0,g.Z)(k.Z.MaximumLength,"body",r,(0,d.Z)({},w))})],type:j.E.TextArea,containerClassName:v().bodyInput,fieldSetLegend:r("feedback.your-feedback")}].map((function(e){return(0,p.Z)(e,r)})),onSubmit:R,isSubmitting:c,renderAction:function(e){var n=e.isLoading;return(0,o.jsx)("div",{className:v().submitButton,children:(0,o.jsx)(C.ZP,{htmlType:"submit",isLoading:n,isDisabled:n,children:r("common:submit")})})}})},S=t(48535),N=t.n(S),R=t(59807),L=function(e){var n=e.onClose,t=e.isOpen,r=e.course,u=(0,a.Z)("learn").t,c=(0,i.useRef)(),l=r.title;return(0,o.jsxs)(R.default,{innerRef:c,isOpen:t,header:(0,o.jsx)("div",{className:N().headerContainer,children:u("feedback.add-feedback")}),hasCloseButton:!0,onClose:n,onEscapeKeyDown:n,size:R.ContentModalSize.MEDIUM,children:[(0,o.jsx)("div",{className:N().desc,children:(0,o.jsx)(s.Z,{components:{br:(0,o.jsx)("br",{})},i18nKey:"learn:feedback.desc",values:{courseName:l}})}),(0,o.jsx)(F,{onSuccess:n,course:r})]})};!function(e){e.CoursePage="course_page",e.LessonPage="lesson_page"}(r||(r={}));var P=function(e){var n=e.source,t=e.course,r=e.shouldOpenModal,u=void 0!==r&&r,s=(0,a.Z)("learn").t,l=(0,i.useState)(!1),d=l[0],f=l[1];(0,i.useEffect)((function(){u&&f(!0)}),[u]);return(0,o.jsxs)("div",{className:c().container,children:[(0,o.jsx)(C.ZP,{size:C.qE.Small,type:C.L$.Primary,onClick:function(){(0,I.MY)("add_course_feedback",{source:n}),f(!0)},children:s("feedback.add-feedback")}),(0,o.jsx)(L,{course:t,isOpen:d,onClose:function(){return f(!1)}})]})}},10191:function(e,n,t){"use strict";t.d(n,{Hf:function(){return d},eh:function(){return l},gx:function(){return s},z1:function(){return c}});var r=t(57044),o=t(16946),i=t(8522),a=t(37572),u=function(e,n){var t=(0,i.Z)(e),r=t.findIndex((function(e){return e.id===n}));return-1!==r&&(t[r].isCompleted=!0),t},c=function(e,n,t){e("^".concat((0,a.i5)(n),"/.+"),(function(e){return function(e,n){if(e){var t,o=(0,r.Z)({},e);return o.id===n&&(o.isCompleted=!0),(null===e||void 0===e||null===(t=e.course)||void 0===t?void 0:t.lessons)&&(o.course.lessons=u(o.course.lessons,n)),o}return e}(e,t)}))},s=function(e,n,t){e((0,a.vp)(n),(function(e){return function(e,n){if(e){var t=(0,r.Z)({},e);return(null===t||void 0===t?void 0:t.lessons)&&(t.lessons.filter((function(e){return e.isCompleted})).length+1===t.lessons.length&&(t.isCompleted=!0),t.lessons=u(t.lessons,n),t.continueFromLesson=function(e){if(!e)return null;var n=e.filter((function(e){return e.isCompleted})).map((function(e){return e.id})),t=n.length;if(0===t)return e[0].slug;if(t===e.length)return e[0].slug;for(var r=e.sort((function(e,n){return e.day-n.day})),o=0;o<r.length;o+=1)if(!n.includes(r[o].id))return r[o].slug;return null}(t.lessons)),t}return e}(e,t)}))},l=function(e,n){e("^".concat((0,a.i5)(n),"/.+"),(function(e){return _(e)}))},d=function(e,n){e((0,a.vp)(n),(function(e){return f(e)}))},f=function(e){if(e){var n=(0,r.Z)({},e);return n.userHasFeedback=!0,n}return e},_=function(e){if(e){var n=(0,r.Z)({},e);return(null===e||void 0===e?void 0:e.course)&&(n.course=(0,o.Z)((0,r.Z)({},n.course),{userHasFeedback:!0})),n}return e}},73756:function(e,n,t){"use strict";var r=t(57611),o=t(67597),i=t(62103),a=t(19175),u=t(10117),c=t(87739),s=function(e){var n=e.queryKey,t=e.render,o=e.renderError,s=e.initialData,l=e.loading,d=void 0===l?function(){return(0,r.jsx)(u.Z,{})}:l,f=e.fetcher,_=void 0===f?c._i:f,m=e.showSpinnerOnRevalidate,v=void 0===m||m,h=e.onFetchSuccess,p=(0,i.Z)(n,(function(){return _(n).then((function(e){return null===h||void 0===h||h(e),Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}),{fallbackData:s}),g=p.data,x=p.error,C=p.isValidating,Z=p.mutate;if(v?C:C&&!g)return d();if(x){if(o){var b=o(x);if("undefined"!==typeof b)return b}return(0,r.jsx)(a.Z,{onRetryClicked:function(){Z()},error:x})}return t(g)};n.Z=(0,o.memo)(s)},19175:function(e,n,t){"use strict";t.d(n,{Z:function(){return _}});var r,o=t(57611),i=t(67597),a=t(61395),u=t(36284),c=t.n(u),s=t(85494);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},l.apply(null,arguments)}var d=function(e){return i.createElement("svg",l({width:15,height:15,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),r||(r=i.createElement("path",{d:"M1.85 7.5c0-2.835 2.21-5.65 5.65-5.65 2.778 0 4.152 2.056 4.737 3.15H10.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-1 0v1.813C12.296 3.071 10.666.85 7.5.85 3.437.85.85 4.185.85 7.5c0 3.315 2.587 6.65 6.65 6.65 1.944 0 3.562-.77 4.714-1.942a6.77 6.77 0 0 0 1.428-2.167.5.5 0 1 0-.925-.38 5.77 5.77 0 0 1-1.216 1.846c-.971.99-2.336 1.643-4.001 1.643-3.44 0-5.65-2.815-5.65-5.65Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})))},f=t(87739),_=function(e){var n=e.onRetryClicked,t=e.error,r=(0,a.Z)("common").t;return(0,o.jsxs)("div",{className:c().container,children:[(0,o.jsx)("p",{className:c().text,children:t.message!==f.yH?r("error.general"):r("error.offline")}),(0,o.jsx)(s.ZP,{prefix:(0,o.jsx)(d,{}),size:s.qE.Small,type:s.L$.Secondary,onClick:n,children:r("retry")})]})}},79194:function(e,n,t){"use strict";var r=t(57044),o=t(14574),i=t.n(o),a=t(24277);n.Z=function(e,n){return(0,r.Z)({},e,e.rules&&{rules:e.rules.map((function(t){return{type:t.type,value:t.value,errorMessage:n("common:validation.".concat(t.errorId),(0,r.Z)({field:i()(e.field)},t.errorExtraParams))}}))},e.label&&{label:e.type===a.E.Checkbox?e.label:n("form.".concat(e.label))},e.defaultValue&&{defaultValue:e.defaultValue},e.placeholder&&{placeholder:e.placeholder})}},6507:function(e,n,t){"use strict";var r=t(57044),o=t(14574),i=t.n(o),a=t(48559),u=a.Z.InvalidField;n.Z=function(e,n,t,o){return Object.values(a.Z).includes(e)?t("common:validation.".concat(e),(0,r.Z)({field:i()(n)},o)):t("common:validation.".concat(u),{field:i()(n)})}},3222:function(e,n,t){"use strict";var r=t(57044),o=t(16946),i=t(57611),a=t(67597),u=t(64462),c=t(66333),s=t(1931),l=t(83784),d=t(56339),f=t.n(d);n.Z=function(e){var n=e.isEditable,t=void 0===n||n,d=e.defaultValue,_=(0,s.jE)((function(e){return u.ML.make().config((function(n){n.set(u.KP,e),d&&n.set(u.Dn,d),n.update(u.i8,(function(e){return(0,o.Z)((0,r.Z)({},e),{editable:function(){return t},attributes:{class:f().editor,spellcheck:"false"}})}))})).use(c.iO)}),[]).get;return(0,a.useEffect)((function(){var e;d&&(null===(e=_())||void 0===e||e.action((0,l.ko)(d)))}),[d,_]),(0,i.jsx)("div",{className:f().content,children:(0,i.jsx)(s.Nl,{})})}},21648:function(e,n,t){"use strict";var r=t(57044),o=t(16946),i=t(96151),a=t(57611),u=(t(67597),t(41801)),c=t(48842);n.Z=function(e){var n=e.url,t=e.image,s=e.imageAlt,l=e.imageHeight,d=e.imageWidth,f=e.openGraph,_=e.description,m=(0,i.Z)(e,["url","image","imageAlt","imageHeight","imageWidth","openGraph","description"]),v=(0,r.Z)({},f&&{openGraph:f},n&&{url:n},t&&{images:[{url:t,width:d,height:l,alt:s}]}),h=(0,r.Z)({},m,_&&{description:(0,c.aS)(_,150)});return(0,a.jsx)(u.PB,(0,o.Z)((0,r.Z)({},h),{openGraph:v}))}},55673:function(e,n,t){"use strict";var r=t(57611),o=t(15438),i=t.n(o);n.Z=function(e){var n=e.children;return(0,r.jsx)("div",{className:i().container,children:n})}},59807:function(e,n,t){"use strict";t.r(n),t.d(n,{ContentModalSize:function(){return r}});var r,o=t(45361),i=t(57611),a=t(67597),u=t(61794),c=t(37014),s=t.n(c),l=t(15129),d=t(85494),f=t(97674),_=t.n(f),m=t(43172),v=t(43609);!function(e){e.SMALL="small",e.MEDIUM="medium"}(r||(r={}));n.default=function(e){var n=e.isOpen,t=e.onClose,c=e.onEscapeKeyDown,f=e.hasCloseButton,h=e.children,p=e.header,g=e.innerRef,x=e.contentClassName,C=e.size,Z=void 0===C?r.MEDIUM:C,b=e.isFixedHeight,M=e.hasHeader,k=void 0===M||M,y=(0,a.useRef)(),j=(0,l.useRouter)().locale;(0,a.useImperativeHandle)(g,(function(){return{scrollToTop:function(){y.current&&(y.current.scrollTop=0)}}}));var E;return(0,i.jsx)(u.fC,{open:n,children:(0,i.jsx)(u.h_,{children:(0,i.jsx)(u.aV,{className:_().overlay,ref:y,children:(0,i.jsxs)(u.VY,{className:s()(_().contentWrapper,(E={},(0,o.Z)(E,x,x),(0,o.Z)(E,_().small,Z===r.SMALL),(0,o.Z)(E,_().medium,Z===r.MEDIUM),(0,o.Z)(E,_().autoHeight,!b),E)),onEscapeKeyDown:c,onPointerDownOutside:function(e){var n=e.currentTarget;((0,v.iS)(j)?e.detail.originalEvent.offsetX<15:e.detail.originalEvent.offsetX>n.clientWidth-15)?e.preventDefault():t&&t()},children:[k&&(0,i.jsxs)("div",{className:_().header,children:[f&&(0,i.jsx)(u.x8,{className:_().closeIcon,children:(0,i.jsx)(d.ZP,{variant:d.Wu.Ghost,shape:d.jL.Circle,onClick:t,children:(0,i.jsx)(m.Z,{})})}),p]}),(0,i.jsx)("div",{className:_().content,children:h})]})})})})}},4083:function(e,n,t){"use strict";var r=t(67597),o=t(99968),i=t(32607);n.Z=function(){var e=(0,o.kY)(),n=e.cache,t=e.mutate;return(0,r.useCallback)((function(e,r){var o=Array.from(n.keys()),a=new RegExp(e);o.forEach((function(e){a.test(e)&&t(e,r,i.F)}))}),[n,t])}},32607:function(e,n,t){"use strict";t.d(n,{F:function(){return i}});var r=t(67597),o=t(99968),i={revalidate:!1};n.Z=function(){var e=(0,o.kY)().mutate;return(0,r.useCallback)((function(n,t){e(n,t,i)}),[e])}},48842:function(e,n,t){"use strict";t.d(n,{Nl:function(){return i},aS:function(){return r},ox:function(){return o}});var r=function(e,n){for(var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",r=e.split("",n),o="",i=0;i<r.length;i+=1){var a=r[i];if(o.length===n-1){o="".concat(o).concat(a).concat(t);break}o="".concat(o).concat(a)}return o},o=function(e){return e.replace(/(<([^>]+)>)/gi,"")},i=function(e){if(!e)return"";var n=e.split("-");return 1===n.length?n[0]:n[n.length-1]}},48559:function(e,n){"use strict";var t;!function(e){e.InvalidEmail="invalid-email",e.RequiredField="required-field",e.InvalidField="invalid-field",e.MaximumLength="maximum-length",e.MinimumLength="minimum-length"}(t||(t={})),n.Z=t},84765:function(e){e.exports={container:"ContentContainer_container__s7dX2"}},69427:function(e){e.exports={container:"CourseFeedback_container__iBDGv"}},82471:function(e){e.exports={bodyInput:"CourseFeedbackForm_bodyInput__0TtN_",submitButton:"CourseFeedbackForm_submitButton__vLdJc",ratingContainer:"CourseFeedbackForm_ratingContainer__AF_0R"}},48535:function(e){e.exports={headerContainer:"CourseFeedbackModal_headerContainer__pubww",desc:"CourseFeedbackModal_desc__UebUq"}},36284:function(e){e.exports={container:"Error_container__1m9XV",text:"Error_text__yg4kD"}},56339:function(e){e.exports={editor:"MarkdownEditor_editor__yKRsX",content:"MarkdownEditor_content__4M3H4"}},15438:function(e){e.exports={container:"PageContainer_container__1TUET",fullWidth:"PageContainer_fullWidth__RU5GM"}},97674:function(e){e.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"}},86719:function(e){e.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"}}}]);
  2. //# sourceMappingURL=22042-838dfd6fdd3687bc.js.map