PageSourceSearch

https://www.qlrc.qld.gov.au/__data/assets/git_bridge/0011/772562/j…otificationSettings-839e235630a1dfcdef04.js

js qlrc.qld.gov.au collected 2026-10-02 11:28:14 UTC 6,802 bytes, 3 lines download raw bytes

1/*! For license information please see NotificationSettings-839e235630a1dfcdef04.js.LICENSE.txt */
2"use strict";(self.webpackChunkPlug_and_Play_Template=self.webpackChunkPlug_and_Play_Template||[]).push([[672],{31142:function(e,t,s){s.r(t),s.d(t,{default:function(){return h}});s(33948),s(26699);var i=s(67294),n=s(98069),a=s(45697),c=s.n(a),o=s(331);s(17727);class l{constructor(){this.requests=new Map}debounce(e,t){const s=JSON.stringify(e);if(!this.requests.has(s)){const e=t();e.finally((()=>{this.requests.delete(s)})),this.requests.set(s,e)}return this.requests.get(s)}get(e){return this.requests.get(JSON.stringify(e))}}class r{constructor(e){if(!e)throw new Error("dto is required when instantiating a new UserService");["userAdapter"].forEach((t=>{if(!e[t])throw new Error("".concat(t," property is required when instantiating a new UserService"))})),this.promiseDebouncer=new l,this.userAdapter=e.userAdapter}get(e){return this.promiseDebouncer.debounce({method:"get",userId:e},(()=>this.userAdapter.get(e)))}setAll(e,t){return this.promiseDebouncer.debounce({method:"get",documentId:t},(()=>this.userAdapter.setAll(e,t)))}updateNotifications(e,t){return this.promiseDebouncer.debounce({method:"get",notificationKey:e},(()=>this.userAdapter.updateNotifications(e,t)))}toggleNotifications(e,t){return this.promiseDebouncer.debounce({method:"get",documentId:t},(()=>this.userAdapter.toggleNotifications(e)))}}const u=e=>{let{children:t,userService:s,userId:n}=e;const[a,c]=(0,i.useState)(!1),[o,l]=(0,i.useState)(!1),[r,u]=(0,i.useState)([]);(0,i.useEffect)((()=>{c(!0),s.get(n).then((e=>{u(e),c(!1),l(!0)}))}),[r]);const m=(0,i.useCallback)(((e,t)=>(c(!0),s.setAll(t,e).then((e=>{u(e),c(!1),l(!0)})))),[r]),f=(0,i.useCallback)((e=>(c(!0),s.toggleNotifications(e).then((e=>{u(e),c(!1),l(!0)})))),[r]),h=(0,i.useCallback)((e=>(c(!0),s.updateNotifications(e,r).then((e=>{u(e),c(!1),l(!0)})))),[r]);return i.createElement(d.Provider,{value:{user:r,userService:s,isLoading:a,isReady:o,updateUser:m,updateNotifications:h,toggleNotifications:f}},t)},d=(0,i.createContext)({user:{},userId:null,userService:null,isLoading:!1,isReady:!1,updateUser:()=>{},updateNotifications:()=>{},toggleNotifications:()=>{}});var m=s(11321);function f(e){const{title:t,pushNotificationsLabel:s,fieldsSpec:n}=e,{user:a,isReady:c,isLoading:l,updateUser:r,updateNotifications:u,toggleNotifications:f}=(0,i.useContext)(d),[h,p]=(0,i.useState)(!1),[g,b]=(0,i.useState)(null),[N,_]=(0,i.useState)(!1),[y,E]=(0,i.useState)(!1),w=(0,i.useCallback)((()=>{E(!y)}),[y]),v=(0,o.Z)();(0,i.useEffect)((()=>{b(a)}),[c]),(0,i.useEffect)((()=>{const e=window.navigator.userAgent,t=!!e.match(/iphone/i),s=!!e.match(/crios/i);p(!(t||s))}),[c]);const k=(0,i.useCallback)((async e=>{await u(e),b(a)}),[a]),C=(0,i.useCallback)((async e=>{_(await f(e))}),[a]),S=(0,i.useCallback)((async()=>{await r(g),E(!1)}),[g,N,h]),A=(0,o.Z)();return i.createElement(i.Fragment,null,i.createElement("button",{type:"button",className:"notifications-settings__action",onClick:w},"Notification settings"),y&&i.createElement(m.Z,{onClose:w,titleId:A,className:"notifications-settings-modal"},i.createElement("header",{className:"notifications-settings-modal__header"},i.createElement("h1",{id:A,className:"notifications-settings-modal__title"},t),i.createElement("button",{type:"button",onClick:w,className:"notifications-settings-modal__header-close"},i.createElement("svg",{className:"svg-icon"},i.createElement("title",null,"Close modal"),i.createElement("use",{href:"#close"})))),i.createElement("div",{className:"custom-form notifications-settings notifications-settings__container"},i.createElement("div",{className:"sq-form-question-answer"},i.createElement("ul",null,h&&i.createElement("li",{className:"notifications-settings__switch-item"},i.createElement("div",{className:"notifications-settings__notifications-switch"},i.createElement("svg",{className:"svg-icon notifications-settings__notifications-icon"},i.createElement("use",{href:"#edify-notification"})),i.createElement("h2",{className:"notifications-settings__label"},"Push notifications"),i.createElement("div",{className:"switch"},i.createElement("input",{className:"switch__input",type:"checkbox",id:"switch-input-".concat(v),onChange:C,value:N,disabled:!c,"aria-describedby":"switch-status-".concat(v),"aria-labelledby":"switch-description-".concat(v)}),i.createElement("label",{id:"switch-description-".concat(v),className:"switch__label",htmlFor:"switch-input-".concat(v)},"Toggle push notifications"),i.createElement("div",{className:"switch__marker","aria-hidden":"true"}))),i.createElement("small",{id:"switch-status-".concat(v),className:"notifications-settings__description"}," ",s)),c&&n.map((e=>{let{id:t,label:s,description:n,key:a}=e;const l=(0,o.Z)();return i.createElement("li",{key:t,className:"notifications-settings__switch-item"},i.createElement("input",{type:"checkbox",name:t,id:"".concat(t,"-").concat(l),value:g.excludeNotificationTypes&&g.excludeNotificationTypes.includes(a),disabled:!c,onChange:()=>k(a),className:"sq-form-field","aria-describedby":"".concat(t,"-").concat(l,"-description"),"aria-labelledby":"".concat(t,"-").concat(l,"-label")}),i.createElement("label",{id:"".concat(t,"-").concat(l,"-label"),htmlFor:"".concat(t,"-").concat(l),className:"notifications-settings__label"},s),i.createElement("small",{id:"".concat(t,"-").concat(l,"-description"),className:"notifications-settings__description"},n))})))),i.createElement("footer",{className:"notifications-settings-modal__footer"},i.createElement("button",{className:"notifications-settings-modal__footer-button",type:"button",onClick:S,disabled:l},"Update notifications",i.createElement("span",{className:"sr-only"}," "," Modal will be closed after pressing update"," "))))))}
2function h(e){const{userAdapter:t,documentId:s}=e,a=new r({userAdapter:t});return i.createElement(n.N3,null,i.createElement(u,{userService:a,userId:s,key:s},i.createElement(f,e)))}const{string:p,number:g,func:b,oneOfType:N,arrayOf:_,shape:y}=c();h.propTypes={title:p,documentId:N([p,g]),onDialogClose:b,pushNotificationsLabel:p,fieldsSpec:_(y({id:p,label:p,description:p,key:p}))},h.defaultProps={title:"Notifications settings",documentId:"666",onDialogClose:()=>{},pushNotificationsLabel:"Most students enable push notifications to stay on top of their studies. This will allow\n    you to receive notifications directly to this device.",fieldsSpec:[{id:"assignment_reminder",label:"Assignment reminder",description:"Remind me about assignments 1 day before their due date.",key:"assignment_reminder"},{id:"canvas_announcement",label:"Course announcements",description:"Announcements related to one of my courses.",key:"canvas_announcement"}]}}}]);
3//# sourceMappingURL=NotificationSettings-839e235630a1dfcdef04.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.