PageSourceSearch

https://www.eop.com.sg/static/js/53.c59ed9f2.chunk.js

js eop.com.sg collected 2026-10-01 23:55:11 UTC 6,513 bytes, 2 lines download raw bytes

1(window.webpackJsonp=window.webpackJsonp||[]).push([[53],{1596:function(e,t,n){},1786:function(e,t,n){"use strict";n.r(t),n.d(t,"default",function(){return h});var r=n(48),a=n(20),o=n(0),s=n.n(o),i=n(1524),c=n(1530),u=(n(1596),n(15)),l=n(197),p=n(105),f=n(93),g=n(38);function d(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,u=Object.create(c.prototype);return b(u,"_invoke",function(n,r,a){var o,i,c,u=0,l=a||[],p=!1,f={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,f.n=n,s}};function g(n,r){for(i=n,c=r,t=0;!p&&u&&!a&&t<l.length;t++){var a,o=l[t],g=f.p,d=o[2];n>3?(a=d===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,f.v=r,f.n=o[1]):g<d&&(a=n<3||o[0]>r||r>d)&&(o[4]=n,o[5]=r,f.n=d,i=0))}if(a||n>1)return s;throw p=!0,r}return function(a,l,d){if(u>1)throw TypeError("Generator is already running");for(p&&1===l&&g(l,d),i=l,c=d;(t=i<2?e:c)||!p;){o||(i?i<3?(i>1&&(f.n=-1),g(i,c)):f.n=c:f.v=c);try{if(u=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(p=f.n<0)?c:n.call(r,f))!==s)break}catch(t){o=e,i=1,c=t}finally{u=1}}return{value:t,done:p}}}(n,a,o),!0),u}var s={};function i(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(b(t={},r,function(){return this}),t),p=u.prototype=i.prototype=Object.create(l);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,b(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=u,b(p,"constructor",u),b(u,"constructor",c),c.displayName="GeneratorFunction",b(u,a,"GeneratorFunction"),b(p),b(p,a,"Generator"),b(p,r,function(){return this}),b(p,"toString",function(){return"[object Generator]"}),(d=function(){return{w:o,m:f}})()}function b(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(b=function(e,t,n,r){function o(t,n){b(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))})(e,t,n,r)}function h(e){var t=Object(o.useState)(10),n=Object(a.a)(t,2),b=n[0],h=n[1],y=Object(c.a)(["eop"]),m=Object(a.a)(y,2),v=m[0],O=m[1],k=Object(o.useState)(null),S=Object(a.a)(k,2),j=S[0],w=S[1],P=Object(o.useState)(null),_=Object(a.a)(P,2),E=_[0],N=_[1],T=Object(o.useState)(""),x=Object(a.a)(T,2),A=x[0],I=x[1],F=Object(o.useRef)(null);function R(){return(R=Object(r.a)(d().m(function t(n,r){var a,o,s,i,c,y,m,k,S,j,P,_;return d().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,fetch("https://api.eop.com.sg/fapi/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:n,state:r})});case 1:if((a=t.v).ok){t.n=6;break}return o={},t.p=2,t.n=3,a.json();case 3:o=t.v,t.n=5;break;case 4:t.p=4,t.v;case 5:return console.error("FAPI token exchange failed:",o),I("Singpass login failed. Please go back and try again."),w(!1),t.a(2);case 6:return t.n=7,a.json();case 7:if((s=t.v).identity_number){t.n=8;break}return console.error("No identity_number in response"),I("Could not retrieve identity from SingPass"),w(!1),t.a(2);case 8:if(i=s.user_id||v.user_token){t.n=9;break}return I(s.lookup_failed?"We could not verify your account just now. Please try again in a moment.":"No EOP account is registered for this Singpass user. Please sign up first, or log in with your email or mobile number."),w(!1),t.a(2);case 9:return t.n=10,u.API.graphql(Object(u.graphqlOperation)(l.t,{id:i}));case 10:if((c=t.v).data.getUserRecord){t.n=11;break}return e.history.push("/error"),t.a(2);case 11:if(y=c.data.getUserRecord.identificationNumber,m=s.identity_number,s.user_id||y.toUpperCase()===m.toUpperCase()){t.n=12;break}return N(!0),w(!1),t.a(2);case 12:if(!((k=c.data.getUserRecord.validityDate)&&new Date(k)<new Date)){t.n=13;break}return I("Your course access has expired. Please contact support."),w(!1),t.a(2);case 13:return Object(f.e)(i),w(!0),172800,O("singpass_token",m,{maxAge:172800,path:"/"}),t.p=14,t.n=15,u.API.graphql(Object(u.graphqlOperation)(p.k,{userID:i,userType:"user"}));case 15:(S=t.v).data.createSession&&S.data.createSession.sessionToken&&Object(g.setSessionToken)(S.data.createSession.sessionToken,i,!1),t.n=17;break;case 16:t.p=16,P=t.v,console.error("Session creation failed after SingPass login:",P);case 17:j=b,F.current=setInterval(function(){0===(j-=1)?e.history.push("/course/summary"):h(j)},1e3),t.n=19;break;case 18:t.p=18,_=t.v,console.error("SingPass FAPI callback error:",_),I("An unexpected error occurred during authentication"),w(!1);case 19:return t.a(2)}},t,null,[[14,16],[2,4],[0,18]])}))).apply(this,arguments)}return Object(o.useEffect)(function(){var t=window.location.search,n=new URLSearchParams(t),r=n.get("code"),a=n.get("state"),o=n.get("error"),s=n.get("error_description");return o?(console.error("SingPass auth error:",o,s),I("temporarily_unavailable"===o?"Singpass is temporarily unavailable. Please try again later.":"Authentication was cancelled or failed. Please try again."),void w(!1)):r&&a?(sessionStorage.removeItem("singpass_auth_pending"),function(e,t){R.apply(this,arguments)}(r,a),function(){clearInterval(F.current)}):void e.history.push("/error")},[]),s.a.createElement(i.a,{maxWidth:"lg",className:"page-wrap singpass-callback-wrap"},s.a.createElement("div",{className:"singpass-callback-content"},null!=j?!0===j?s.a.createElement(s.a.Fragment,null,s.a.createElement("h2",null,"Singpass Login Success!"),s.a.createElement("div",{className:"singpass-redirect"},"Redirecting you to Course Page in ",b," second(s)")):s.a.createElement(s.a.Fragment,null,s.a.createElement("h2",null,"Singpass Login Failed"),!0===E?s.a.createElement("div",{className:"singpass-text"},"Your registered NRIC does not match with the Singpass. Please click the below Back button to login with your Singpass account.",s.a.createElement("a",{href:"/singpass",className:"blue-btn"},"Back to Singpass Login Page")):s.a.createElement("div",{className:"singpass-text"},A||"Authentication failed. Please try again.",s.a.createElement("a",{href:"/singpass",className:"blue-btn"},"Try Again"))):s.a.createElement("div",{className:"singpass-text"},"Verifying your identity...")))}}}]);
2//# sourceMappingURL=53.c59ed9f2.chunk.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.