PageSourceSearch

https://jomportal.com/assets/auth-DDBBnmcR.js

js jomportal.com collected 2026-10-02 01:33:50 UTC 15,624 bytes, 1 lines download raw bytes

1import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{W as t}from"./useStore-CzV104MW.js";import{t as n}from"./link-CemwZfB6.js";import{t as r}from"./jsx-runtime-DiK4U9sA.js";import{t as i}from"./arrow-right-C5xRGCdF.js";import{t as a}from"./check-BWAJtC6T.js";import{n as o,t as s}from"./eye-D9M6Vvrj.js";import{t as c}from"./loader-circle-8Dms4YG3.js";import{t as l}from"./mail-5YVhMkxK.js";import{L as u,U as d,a as f,b as p}from"./index-DvEvuUoW.js";import{t as m}from"./react-6QTV2Hyb.js";import{t as h}from"./AuroraBackground-Ct4S278l.js";import{t as g}from"./label-BHc9bjV7.js";import{t as _}from"./input-hIOST_Bg.js";import{t as v}from"./jomportal-logo.png.asset-B1DlNN2u.js";var y=e(t()),b={name:`@lovable.dev/cloud-auth-js`,version:`1.1.2`,description:`Lovable Cloud Auth JS`,main:`./dist/index.cjs`,module:`./dist/index.js`,types:`./dist/index.d.ts`,type:`module`,files:[`dist`],scripts:{build:`tsup src/index.ts --format cjs,esm --dts --outDir dist`,dev:`tsup src/index.ts --format cjs,esm --dts --watch`,test:`vitest run`,typecheck:`tsgo --noEmit`,prepublishOnly:`npm run clean && npm run build`,clean:`rimraf dist`},keywords:[`lovable`,`oauth`,`authentication`],license:`MIT`,devDependencies:{"@types/node":`^22`,jsdom:`^26`,rimraf:`^5.0.0`,tsup:`^7.2.0`,typescript:`^5`,vitest:`^4.1.0`}},x=`authorization_response`,S=`/~oauth/initiate`,C=[`https://oauth.lovable.app`,`https://lovable.dev`],w=`lovable://oauth-callback`,T=`http://127.0.0.1/iframe-oauth/callback`,E=500,D=12e4;function O(e){let t,n=new Promise(e=>{t=e}),r=n=>{if(!e.some(e=>n.origin===e))return;let r=n.data;!r||typeof r!=`object`||r.type===x&&t(r.response)};return window.addEventListener(`message`,r),{cleanup:()=>{window.removeEventListener(`message`,r)},messagePromise:n}}function k(e){let t=window.screenX!==0||window.screenY!==0||!e,n=t?window.outerWidth*.5:window.screen.width*.5,r=t?window.outerHeight*.5:window.screen.height*.5;return{width:n,height:r,left:t?window.screenX+(window.outerWidth-n)/2:(window.screen.width-n)/2,top:t?window.screenY+(window.outerHeight-r)/2:(window.screen.height-r)/2}}function A(e,t){return e.state===t?e.error?e.error===`legacy_flow`?{error:Error(`This flow is not supported in Preview mode. Please open the app in a new tab to sign in.`)}:{error:Error(e.error_description??`Sign in failed`)}:!e.access_token||!e.refresh_token?{error:Error(`No tokens received`)}:{tokens:{access_token:e.access_token,refresh_token:e.refresh_token},error:null}:{error:Error(`State is invalid`)}}function j(){let e=navigator.userAgent;return!!(/iPhone|iPad|iPod|Android/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}function M(){return typeof crypto<`u`&&crypto.getRandomValues?[...crypto.getRandomValues(new Uint8Array(16))].map(e=>e.toString(16).padStart(2,`0`)).join(``):Math.random().toString(36).substring(2)+Date.now().toString(36)}function N(e={}){let t=e.oauthBrokerUrl??S,n=e.supportedOAuthOrigins??C;async function r(e,r={}){let i=!1;try{i=window.self!==window.top}catch{i=!0}let a=navigator.userAgent,o=/LovableApp\//.test(a),s=!o&&/lovable/i.test(a),c=M(),l=r.redirect_uri??window.location.origin;o&&i?l=w:s&&i&&(l=T);let u=new URLSearchParams({...r.extraParams,provider:e,redirect_uri:l,state:c});if(!i)return window.location.href=`${t}?${u.toString()}`,{error:null,redirected:!0};!o&&!s&&u.set(`response_mode`,`web_message`);let d=`${t}?${u.toString()}`,{messagePromise:f,cleanup:p}=O(s?[...n,window.location.origin]:n),m;if(j())m=window.open(d,`_blank`);else{let{width:e,height:t,left:n,top:r}=k(i);m=window.open(d,`oauth`,`width=${e},height=${t},left=${n},top=${r}`)}if(!m&&(o||s)){let e,t=new Promise((t,n)=>{e=setTimeout(()=>{n(Error(`OAuth timed out waiting for response`))},D)});try{return A(await Promise.race([f,t]),c)}catch(e){return{error:e instanceof Error?e:Error(String(e))}}finally{e&&clearTimeout(e),p()}}if(!m)return p(),{error:Error(`Popup was blocked`)};let h,g=new Promise((e,t)=>{h=setInterval(()=>{m.closed&&(clearInterval(h),t(Error(`Sign in was cancelled`)))},E)});try{return A(await Promise.race([f,g]),c)}catch(e){return{error:e instanceof Error?e:Error(String(e))}}finally{clearInterval(h),p(),m?.close()}}return{signInWithOAuth:r}}typeof window<`u`&&(window.__lovable_cloud_auth_js_version=b.version);function P(e={}){return N(e)}
1var F=P(),I={auth:{signInWithOAuth:async(e,t)=>{let n=await F.signInWithOAuth(e,{redirect_uri:t?.redirect_uri??window.location.origin,extraParams:{...t?.extraParams}});if(n.redirected||n.error)return n;try{await u.auth.setSession(n.tokens)}catch(e){return{error:e instanceof Error?e:Error(String(e))}}return n}}},L=r(),R=[`Wizard 7 langkah — portal siap tanpa coding`,`Data murid kekal dalam Google Sheet sekolah anda`,`Kad ID digital, tema sekolah & QR signage`,`Analitik login dan aplikasi paling popular`],z=[`Percuma untuk mula`,`Tiada hosting diperlukan`,`Data milik sekolah`];function B(){let e=d(),t=f.useSearch(),[r,b]=(0,y.useState)(t.mode===`signup`?`signup`:`signin`),[x,S]=(0,y.useState)(``),[C,w]=(0,y.useState)(``),[T,E]=(0,y.useState)(``),[D,O]=(0,y.useState)(!1),[k,A]=(0,y.useState)(!1),[j,M]=(0,y.useState)(!0),[N,P]=(0,y.useState)(``),[F,B]=(0,y.useState)(!1),[H,U]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{let n=t.next??`/dashboard`;u.auth.getSession().then(({data:t})=>{t.session&&e({to:n,replace:!0})});let{data:r}=u.auth.onAuthStateChange((t,r)=>{r&&e({to:n,replace:!0})});return()=>r.subscription.unsubscribe()},[e,t.next]),(0,L.jsxs)(`div`,{className:`relative min-h-screen`,children:[(0,L.jsx)(h,{}),(0,L.jsxs)(`div`,{className:`mx-auto grid min-h-screen w-full max-w-6xl grid-cols-1 items-center gap-10 px-5 py-8 sm:px-6 sm:py-12 lg:grid-cols-[1.05fr_minmax(0,440px)] lg:gap-16 lg:py-16`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(n,{to:`/`,className:`group inline-flex items-center gap-2.5`,children:[(0,L.jsx)(`img`,{src:v.url,alt:`Logo JomPortal`,className:`size-9 shrink-0 object-contain transition-transform duration-300 group-hover:scale-105`}),(0,L.jsx)(`span`,{className:`text-base font-semibold tracking-tight`,children:`JomPortal`})]}),(0,L.jsxs)(`div`,{className:`mt-8 hidden lg:block`,children:[(0,L.jsx)(`p`,{className:`text-[11px] font-semibold tracking-[0.2em] text-primary uppercase`,children:`Panel Admin Sekolah`}),(0,L.jsxs)(`h2`,{className:`mt-4 text-[2.75rem] leading-[1.05] font-bold tracking-[-0.04em]`,children:[`Portal digital sekolah anda,`,(0,L.jsx)(`br`,{}
1),`siap dalam beberapa minit.`]}),(0,L.jsx)(`p`,{className:`mt-4 max-w-md text-sm leading-relaxed text-muted-foreground`,children:`Satu tempat untuk urus ID digital murid, aplikasi sekolah, tema portal dan penerbitan — tanpa perlu hosting atau coding.`}),(0,L.jsx)(`ul`,{className:`mt-8 space-y-3`,children:R.map(e=>(0,L.jsxs)(`li`,{className:`flex items-start gap-3 text-sm text-foreground/80`,children:[(0,L.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary`,children:(0,L.jsx)(a,{className:`size-3`})}),(0,L.jsx)(`span`,{className:`min-w-0`,children:e})]},e))}),(0,L.jsx)(`div`,{className:`mt-10 flex flex-wrap items-center gap-2`,children:z.map(e=>(0,L.jsx)(`span`,{className:`rounded-full border border-border bg-background/60 px-3 py-1.5 text-[11px] font-medium text-muted-foreground`,children:e},e))})]})]}),(0,L.jsx)(m.div,{initial:{opacity:0,y:18},animate:{opacity:1,y:0},transition:{duration:.5,ease:[.32,.72,0,1]},className:`glass panel-shadow w-full rounded-[1.75rem] p-6 sm:rounded-[2rem] sm:p-8 lg:p-9`,children:H?(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(`span`,{className:`mx-auto flex size-14 items-center justify-center rounded-2xl bg-primary/10 text-primary`,children:(0,L.jsx)(l,{className:`size-6`})}),(0,L.jsx)(`h1`,{className:`mt-6 text-2xl font-semibold tracking-tight`,children:`Semak emel anda`}),(0,L.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`Kami hantar pautan pengesahan ke `,(0,L.jsx)(`span`,{className:`font-medium break-all`,children:x}),`. Klik pautan itu untuk aktifkan akaun admin anda.`]}),(0,L.jsx)(`button`,{onClick:()=>{U(!1),b(`signin`)},className:`mt-8 h-11 w-full rounded-full border border-border text-sm font-semibold transition-colors hover:bg-secondary`,children:`Kembali ke log masuk`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`grid grid-cols-2 gap-1 rounded-full border border-border bg-background/60 p-1`,children:[`signin`,`signup`].map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>b(e),className:`relative h-9 rounded-full text-xs font-semibold transition-colors ${r===e?`text-primary-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[r===e?(0,L.jsx)(m.span,{layoutId:`auth-mode-pill`,className:`brand-gradient absolute inset-0 rounded-full`,transition:{type:`spring`,stiffness:400,damping:32}}):null,(0,L.jsx)(`span`,{className:`relative`,children:e===`signin`?`Log masuk`:`Daftar baharu`})]},e))}),(0,L.jsx)(`h1`,{className:`mt-6 text-[1.6rem] leading-tight font-bold tracking-[-0.03em] sm:text-3xl`,children:r===`signin`?`Log masuk admin`:`Daftar akaun admin`}),(0,L.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground`,children:r===`signin`?`Uruskan portal sekolah, tetapan dan penerbitan dari satu tempat.`:`Buat akaun admin untuk mula bina portal digital sekolah anda.`}),(0,L.jsxs)(`button`,{onClick:async()=>{B(!0);let e=await I.auth.signInWithOAuth(`google`,{redirect_uri:window.location.origin});if(e.error){B(!1),p.error(`Google sign in gagal. Cuba lagi.`);return}e.redirected||B(!1)},disabled:F,className:`mt-6 flex h-12 w-full items-center justify-center gap-3 rounded-full border border-border bg-background/70 text-sm font-semibold transition-colors hover:bg-secondary disabled:opacity-60`,children:[(0,L.jsx)(V,{}),` Teruskan dengan Google`]}),(0,L.jsxs)(`div`,{className:`my-5 flex items-center gap-3`,children:[(0,L.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,L.jsx)(`span`,{className:`text-[10px] tracking-[0.18em] text-muted-foreground uppercase`,children:`atau emel`}),(0,L.jsx)(`span`,{className:`h-px flex-1 bg-border`})]}),(0,L.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),r===`signup`){if(C!==T){p.error(`Kata laluan dan pengesahan kata laluan tidak sama`);return}if(!k){p.error(`Sila tanda setuju dengan Terma & Polisi Privasi`);return}}B(!0);try{try{window.localStorage.setItem(`jp_stay_signed_in`,j?`1`:`0`),window.sessionStorage.setItem(`jp_session_active`,`1`)}catch{}if(r===`signup`){let{data:e,error:t}=await u.auth.signUp({email:x,password:C,options:{emailRedirectTo:window.location.origin,data:{full_name:N}}});if(t)throw t;if(!e.session){U(!0);return}p.success(`Akaun dibuka — selamat datang!`)}else{let{error:e}=await u.auth.signInWithPassword({email:x,password:C});if(e)throw e;p.success(`Berjaya masuk`)}}catch(e){p.error(e instanceof Error?e.message:`Sign in gagal`)}finally{B(!1)}}
1,className:`space-y-4`,children:[r===`signup`?(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(g,{htmlFor:`fullName`,className:`text-xs text-muted-foreground`,children:`Nama Penuh`}),(0,L.jsx)(_,{id:`fullName`,value:N,onChange:e=>P(e.target.value),placeholder:`Cikgu Ahmad bin Ali`,className:`h-11 rounded-xl border-border bg-background/60`})]}):null,(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(g,{htmlFor:`email`,className:`text-xs text-muted-foreground`,children:`Emel`}),(0,L.jsx)(_,{id:`email`,type:`email`,required:!0,autoComplete:`email`,value:x,onChange:e=>S(e.target.value),placeholder:`[email protected]`,className:`h-11 rounded-xl border-border bg-background/60`})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(g,{htmlFor:`password`,className:`text-xs text-muted-foreground`,children:`Kata Laluan`}),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(_,{id:`password`,type:D?`text`:`password`,required:!0,minLength:6,autoComplete:r===`signup`?`new-password`:`current-password`,value:C,onChange:e=>w(e.target.value),placeholder:`••••••••`,className:`h-11 rounded-xl border-border bg-background/60 pr-11`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>O(e=>!e),"aria-label":D?`Sembunyi kata laluan`:`Papar kata laluan`,className:`absolute inset-y-0 right-0 flex w-11 items-center justify-center text-muted-foreground transition-colors hover:text-foreground`,children:D?(0,L.jsx)(o,{className:`size-4`}):(0,L.jsx)(s,{className:`size-4`})})]})]}),r===`signup`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(g,{htmlFor:`confirmPassword`,className:`text-xs text-muted-foreground`,children:`Sahkan Kata Laluan`}),(0,L.jsx)(`div`,{className:`relative`,children:(0,L.jsx)(_,{id:`confirmPassword`,type:D?`text`:`password`,required:!0,minLength:6,autoComplete:`new-password`,value:T,onChange:e=>E(e.target.value),placeholder:`••••••••`,className:`h-11 rounded-xl border-border bg-background/60`})}),T&&T!==C?(0,L.jsx)(`p`,{className:`text-xs text-destructive`,children:`Kata laluan tidak sama.`}):null]}),(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-2xl border border-border bg-background/50 p-3 text-xs leading-relaxed text-muted-foreground`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:k,onChange:e=>A(e.target.checked),className:`mt-0.5 size-4 shrink-0 rounded border-border accent-primary`}),(0,L.jsxs)(`span`,{className:`min-w-0`,children:[`Saya bersetuju dengan`,` `,(0,L.jsx)(n,{to:`/terma`,className:`font-semibold text-primary hover:underline`,children:`Terma Penggunaan`}),` `,`dan`,` `,(0,L.jsx)(n,{to:`/privasi`,className:`font-semibold text-primary hover:underline`,children:`Polisi Privasi`}),` `,`JomPortal.`]})]})]}):(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 text-xs text-muted-foreground`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:j,onChange:e=>M(e.target.checked),className:`size-4 shrink-0 rounded border-border accent-primary`}),`Kekal log masuk pada peranti ini`]}),(0,L.jsxs)(`button`,{type:`submit`,disabled:F,className:`brand-gradient btn-glow inline-flex h-12 w-full items-center justify-center gap-2 rounded-full text-sm font-semibold text-primary-foreground disabled:opacity-60`,children:[F?(0,L.jsx)(c,{className:`size-4 animate-spin`}):null,r===`signin`?`Log masuk`:`Daftar sekarang`,F?null:(0,L.jsx)(i,{className:`size-4`})]})]}),(0,L.jsxs)(`p`,{className:`mt-5 text-center text-xs text-muted-foreground`,children:[r===`signin`?`Belum ada akaun?`:`Sudah ada akaun?`,` `,(0,L.jsx)(`button`,{onClick:()=>b(r===`signin`?`signup`:`signin`),className:`font-semibold text-primary hover:underline`,children:r===`signin`?`Daftar admin baharu`:`Log masuk`})]}),(0,L.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center justify-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground lg:hidden`,children:z.map(e=>(0,L.jsx)(`span`,{children:e},e))})]})})]})]})}function V(){return(0,L.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:`size-4`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{fill:`#4285F4`,d:`M23.5 12.3c0-.9-.1-1.5-.2-2.2H12v4.1h6.5c-.1 1.1-.8 2.7-2.3 3.8l-.1.1 3.4 2.6.2.1c2.2-2 3.8-5 3.8-8.5z`}),(0,L.jsx)(`path`,{fill:`#34A853`,d:`M12 24c3.1 0 5.7-1 7.6-2.8l-3.6-2.8
1c-1 .7-2.3 1.2-4 1.2-3 0-5.6-2-6.6-4.8l-.1.1-3.5 2.7v.1C3.7 21.3 7.6 24 12 24z`}),(0,L.jsx)(`path`,{fill:`#FBBC05`,d:`M5.4 14.8A7.4 7.4 0 0 1 5 12c0-1 .2-1.9.4-2.8L1.4 6.1A11.9 11.9 0 0 0 0 12c0 1.9.5 3.8 1.4 5.4l4-2.6z`}),(0,L.jsx)(`path`,{fill:`#EA4335`,d:`M12 4.7c2.1 0 3.6.9 4.4 1.7l3.2-3.1C17.6 1.4 15.1 0 12 0 7.6 0 3.7 2.7 1.4 6.1l4 3.1C6.4 6.4 9 4.7 12 4.7z`})]})}export{B as component};

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.