PageSourceSearch

https://www.perspectives.plus/assets/CommunityMobileAppQrDialog-D2LYKkL5.js

js perspectives.plus collected 2026-10-03 19:47:22 UTC 3,939 bytes, 5 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="67fb41d0-fc49-5feb-8dc3-a9cc9774a1bf")}catch(e){}}();
3import{s as e,t}from"./jsx-runtime-D4ePz0Hl.js";import{t as n}from"./react-BXH-GOAS.js";import{t as r}from"./useTranslation-xRzBcOIb.js";import{n as i}from"./CsrfContext-ByWWfcRz.js";import{t as a}from"./XMarkIcon-DddZZWBS.js";import{t as o}from"./esm-kfzYxcTC.js";import{t as s}from"./PillButton-DKmaS7V0.js";import{t as c}from"./Dialog-CMOTIGCZ.js";var l=e(n(),1);function u(){let[e]=(0,l.useState)(()=>{if(typeof window>`u`)return!1;let e=window.navigator.userAgent,t=/android|iphone|ipad|ipod/i.test(e),n=/macintosh/i.test(e)&&navigator.maxTouchPoints>2;return t||n});return e}function d(){document.dispatchEvent(new CustomEvent(`beehiiv:showInstallPrompt`))}var f=e(t(),1),p=`/community_mobile_app_login_link`,m=3e4,h=5e3;function g({isOpen:e,onClose:t,pageBlock:n}){let{t:u}=r(),d=i(),[g,_]=(0,l.useState)(null),[v,y]=(0,l.useState)(`loading`),b=(0,l.useRef)(null),x=(0,l.useRef)(null),S=(0,l.useCallback)(()=>b.current!=null&&b.current-m>Date.now(),[]),C=(0,l.useCallback)(async e=>{try{let t=await fetch(p,{method:`POST`,signal:e,headers:{Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded;charset=UTF-8`,...d?{"X-CSRF-Token":d}:{}},body:new URLSearchParams({page_block:n})});if(!t.ok)throw Error(`login link request failed: ${t.status}`);let r=await t.json();return b.current=Date.now()+r.expires_in*1e3,_(r.login_url),y(`ready`),!0}catch{return e.aborted||S()||(_(null),y(`error`)),!1}},[d,n,S]);return(0,l.useEffect)(()=>{if(!e)return;let t=new AbortController,n=null,r=async()=>{let e=await C(t.signal);if(!t.signal.aborted)if(e&&b.current!=null){let e=Math.max(0,b.current-Date.now()-m);n=setTimeout(r,e)}else S()&&(n=setTimeout(r,h))};x.current=()=>{n&&clearTimeout(n),y(`loading`),r()},y(`loading`),r();let i=()=>{document.visibilityState===`visible`&&!S()&&r()};return document.addEventListener(`visibilitychange`,i),()=>{t.abort(),n&&clearTimeout(n),document.removeEventListener(`visibilitychange`,i),x.current=null,_(null),y(`loading`),b.current=null}},[e,C,S]),(0,f.jsx)(c,{isOpen:e,onClose:t,className:`w-full overflow-hidden rounded-lg bg-white shadow-lg sm:w-[460px]`,children:(0,f.jsxs)(`div`,{className:`p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-4 flex items-start justify-between gap-4`,children:[(0,f.jsx)(`h2`,{className:`text-xl font-bold`,children:u(`community.mobile_app.qr_title`)}),(0,f.jsx)(`button`,{type:`button`,"aria-label":u(`community.mobile_app.close`),className:`shrink-0`,onClick:t,children:(0,f.jsx)(a,{className:`size-5 text-black/40`})})]}),(0,f.jsx)(`div`,{className:`mb-4 flex items-center justify-center rounded-lg bg-gray-100 p-8`,children:(0,f.jsx)(`div`,{className:`rounded bg-white p-4`,children:v===`ready`&&g?(0,f.jsx)(o,{value:g,size:192,level:`H`}):v===`error`?(0,f.jsxs)(`div`,{className:`flex size-48 flex-col items-center justify-center gap-3`,children:[(0,f.jsx)(`p`,{className:`text-center text-sm text-gray-600`,children:u(`community.mobile_app.qr_error`)}),(0,f.jsx)(s,{type:`button`,variant:`primary`,onClick:()=>x.current?.(),children:u(`community.mobile_app.qr_retry`)})]}):(0,f.jsx)(`div`,{className:`size-48 animate-pulse rounded bg-gray-100`,"aria-hidden":`true`})})}),(0,f.jsx)(`p`,{className:`text-center text-sm text-gray-600`,children:u(`community.mobile_app.qr_description`)}),v===`ready`?(0,f.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,f.jsx)(s,{type:`button`,variant:`secondary`,onClick:()=>x.current?.(),children:u(`community.mobile_app.qr_reload`)})}):null]})})}export{d as n,u as r,g as t};
4//# sourceMappingURL=CommunityMobileAppQrDialog-D2LYKkL5.js.map
5//# debugId=67fb41d0-fc49-5feb-8dc3-a9cc9774a1bf

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.