@glideidentity/web-client-sdk 6.0.0-beta.1 → 6.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/web-client-sdk.min.js +1 -1
- package/dist/cjs/client/phone-auth-client.js +9 -20
- package/dist/esm/client/phone-auth-client.js +9 -20
- package/dist/types/adapters/react.d.ts +3 -3
- package/dist/types/adapters/react.d.ts.map +1 -1
- package/dist/types/adapters/vue.d.ts +4 -4
- package/dist/types/adapters/vue.d.ts.map +1 -1
- package/dist/types/client/phone-auth-client.d.ts +3 -3
- package/dist/types/client/phone-auth-client.d.ts.map +1 -1
- package/dist/types/core/types.d.ts +4 -3
- package/dist/types/core/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.GlideWebClientSDK=e():n.GlideWebClientSDK=e()}(this,()=>(()=>{"use strict";var n={d:(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o:(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r:n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},e={};n.r(e),n.d(e,{AUTHENTICATION_STRATEGY:()=>i,AuthModal:()=>x,ERROR_CODES:()=>s,PhoneAuthClient:()=>E,USE_CASE:()=>t,createAuthError:()=>h,createQRCodeDataFromDesktop:()=>w,getUserMessage:()=>p,isAuthCredential:()=>S,isAuthError:()=>d,isCancellable:()=>_,isClientError:()=>c,isDesktopData:()=>T,isDesktopStrategy:()=>I,isErrorResponse:()=>D,isGetPhoneNumberResponse:()=>P,isInvokeResult:()=>C,isLinkData:()=>O,isLinkStrategy:()=>R,isRetryableError:()=>g,isTS43Data:()=>N,isTS43Strategy:()=>A,isVerifyPhoneNumberResponse:()=>L,validatePhoneNumber:()=>r,validatePlmn:()=>a});const t={GET_PHONE_NUMBER:"GetPhoneNumber",VERIFY_PHONE_NUMBER:"VerifyPhoneNumber"},i={TS43:"ts43",LINK:"link",DESKTOP:"desktop"},o=/^\+[1-9]\d{1,14}$/;function r(n){return n?n.startsWith("+")?n.length<8?{valid:!1,error:"Phone number too short for E.164 format (minimum 8 characters including +)"}:n.length>16?{valid:!1,error:"Phone number too long for E.164 format (maximum 15 digits after +)"}:/^\+\d+$/.test(n)?o.test(n)?{valid:!0}:{valid:!1,error:"Invalid E.164 phone number format"}:{valid:!1,error:"Phone number contains invalid characters. E.164 format only allows + followed by digits"}:{valid:!1,error:"Phone number must be in E.164 format (start with +)"}:{valid:!0}}function a(n){if(!n)return{valid:!0};const{mcc:e,mnc:t}=n;return e&&/^\d{3}$/.test(e)?t&&/^\d{2,3}$/.test(t)?{valid:!0}:{valid:!1,error:"MNC must be 2 or 3 digits"}:{valid:!1,error:"MCC must be exactly 3 digits"}}const s={INVALID_PHONE_NUMBER:"INVALID_PHONE_NUMBER",INVALID_PLMN:"INVALID_PLMN",MISSING_PARAMETERS:"MISSING_PARAMETERS",BROWSER_NOT_SUPPORTED:"BROWSER_NOT_SUPPORTED",UNSUPPORTED_STRATEGY:"UNSUPPORTED_STRATEGY",USER_CANCELLED:"USER_CANCELLED",CANCELLED:"CANCELLED",VERIFICATION_FAILED:"VERIFICATION_FAILED",NETWORK_ERROR:"NETWORK_ERROR",TIMEOUT:"TIMEOUT",INVALID_RESPONSE:"INVALID_RESPONSE"},l={[s.INVALID_PHONE_NUMBER]:"Please enter a valid phone number in E.164 format (e.g., +14155551234).",[s.INVALID_PLMN]:"Invalid carrier information provided.",[s.MISSING_PARAMETERS]:"Required information is missing.",[s.BROWSER_NOT_SUPPORTED]:"Your browser does not support this authentication method. Please use Chrome or Edge with the Digital Credentials flag enabled.",[s.UNSUPPORTED_STRATEGY]:"This authentication strategy is not supported.",[s.USER_CANCELLED]:"Authentication was cancelled.",[s.CANCELLED]:"Authentication was cancelled.",[s.VERIFICATION_FAILED]:"Verification failed. Please try again.",[s.NETWORK_ERROR]:"Network connection failed. Please check your connection and try again.",[s.TIMEOUT]:"Request timed out. Please try again.",[s.INVALID_RESPONSE]:"Invalid response received."};function d(n){return null!==n&&"object"==typeof n&&"code"in n&&"message"in n&&"string"==typeof n.code&&"string"==typeof n.message}function c(n){return Object.values(s).includes(n.code)}function g(n){return n.code===s.NETWORK_ERROR||n.code===s.TIMEOUT}function p(n){return c(n)&&l[n.code]||n.message}function h(n,e,t){const i=new Error(e||l[n]||n);return i.code=n,i.details=t,i.timestamp=(new Date).toISOString(),i}const u=/(\+?[1-9]\d{6,14})/g,b=/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g,m=/(eyJ[a-zA-Z0-9_-]*\.eyJ[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*)/g,f=/session[_-]?key["']?\s*[:=]\s*["']?([a-zA-Z0-9_-]{20,})["']?/gi;function y(n){if(null==n)return n;if("string"==typeof n){let e=n;return e=e.replace(u,n=>n.length<8?n:n.slice(0,2)+"***"+n.slice(-4)),e=e.replace(b,n=>{const[e,t]=n.split("@");return e.slice(0,1)+"***@"+t}),e=e.replace(m,"[JWT]"),e=e.replace(f,(n,e)=>n.replace(e,e.slice(0,4)+"***"+e.slice(-4))),e}if(Array.isArray(n))return n.map(y);if("object"==typeof n){const e={};for(const[t,i]of Object.entries(n))["phone_number","phoneNumber","credential","token","password","secret"].some(n=>t.toLowerCase().includes(n.toLowerCase()))?e[t]="string"==typeof i?"[REDACTED]":i:e[t]=y(i);return e}return n}function v(n){const{sessionKey:e,interval:t=2e3,maxAttempts:i=30,pollingEndpoint:o,statusUrl:r,logger:a}=n;let l,d,c=0,g=!1,p=!1;function u(){p=!1,l&&(clearInterval(l),l=void 0)}return{start:function(){return new Promise((n,s)=>{d=s,p=!0,c=0;const h=async()=>{if(p&&!g){if(c>=i)return u(),a?.warn("Polling timeout reached",{attempts:c,maxAttempts:i}),void n({status:"expired",message:"Authentication timeout"});try{const t=o?(a?.debug("Using developer config endpoint for polling",{pollingEndpoint:o}),`${o}/${e}`):r?(a?.debug("Using backend status_url for polling",{statusUrl:r}),r):(a?.debug("Using prod fallback for status polling"),`https://api.glideidentity.app/public/status/${e}`);a?.debug("Polling status",{url:t,attempt:c+1,maxAttempts:i});const s=await fetch(t,{method:"GET",headers:{Accept:"application/json"}});if(200===s.status){const t=await s.json();if("completed"===t.status)return u(),a?.info("Authentication completed"),void n({status:"completed",credential:t.credential||e,session:t.session||{session_key:e}});c++}else if(410===s.status){u();const e=await s.json().catch(()=>({}));n({status:"expired",message:e.message||"Session expired"})}else if(422===s.status){u();const e=await s.json().catch(()=>({}));n({status:"error",message:e.message||"Authentication failed"})}else 404===s.status?(u(),n({status:"error",message:"Session not found"})):c++}catch(n){a?.debug("Polling error, retrying",{error:n,attempt:c+1}),c++}}};h(),l=setInterval(h,t)})},stop:u,cancel:function(){a?.debug("Polling cancelled"),g=!0,u(),d&&(d(h(s.CANCELLED,"Authentication cancelled")),d=void 0)},isPolling:function(){return void 0!==l},cleanup:function(){u(),g=!1,d=void 0}}}class x{constructor(n){this.container=null,this.backdrop=null,this.isOpen=!1,this.currentStep="os-choice",this.qrCodeData=null,this.statusMessage="",this.originalBodyOverflow="",this.isClosing=!1,this.iconApple='<svg class="glide-icon glide-icon-os" viewBox="0 0 384 512" fill="currentColor"><path d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 52.3-11.4 69.5-34.3z"/></svg>',this.iconAndroid='<svg class="glide-icon glide-icon-os" viewBox="0 0 576 512" fill="currentColor"><path d="M420.55,301.93a24,24,0,1,1,24-24,24,24,0,0,1-24,24m-265.1,0a24,24,0,1,1,24-24,24,24,0,0,1-24,24m273.7-144.48,47.94-83a10,10,0,1,0-17.27-10h0l-48.54,84.07a301.25,301.25,0,0,0-246.56,0L116.18,64.45a10,10,0,1,0-17.27,10h0l47.94,83C64.53,202.22,8.24,285.55,0,384H576c-8.24-98.45-64.54-181.78-146.85-226.55"/></svg>',this.iconBack='<svg class="glide-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',this.options=n||{},this.theme=this.options.theme||"auto",this.handleEscapeKey=this.handleEscapeKey.bind(this)}shouldUseDarkMode(){return"dark"===this.theme||"light"!==this.theme&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}handleEscapeKey(n){"Escape"===n.key&&this.isOpen&&!1!==this.options?.closeOnEscape&&(this.closeCallback?.(),this.close())}escapeHtml(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}showQRCode(n,e="Scan with your phone camera"){this.qrCodeData=n,this.statusMessage=e;const t=this.options.viewMode||"toggle";if("string"==typeof n)this.renderToggleMode(n,e);else switch(t){case"dual":this.renderDualMode(n,e);break;case"pre-step":this.renderPreStepMode(n,e);break;default:this.renderToggleMode(n,e)}this.show()}updateStatus(n,e=!1){if(this.statusMessage=n,this.container){const t=this.container.querySelector("#glide-status");t&&(t.textContent=n,t.style.color=e?"#ff3b30":"")}}setCloseCallback(n){this.closeCallback=n}renderToggleMode(n,e){let t="",i="";"string"==typeof n?(t=n,i=n):(t=n.iosQRCode,i=n.androidQRCode||n.iosQRCode);const o=`\n <div class="glide-content">\n <div class="glide-toggle" id="glide-toggle" data-active="ios">\n <div class="glide-toggle-slider"></div>\n <button class="glide-btn glide-toggle-btn active" data-platform="ios">${this.iconApple}<span>iOS</span></button>\n <button class="glide-btn glide-toggle-btn" data-platform="android">${this.iconAndroid}<span>Android</span></button>\n </div>\n\n <div class="glide-qr-area">\n <img \n class="glide-qr-img"\n id="glide-qr-img" \n src="${this.escapeHtml(t)}" \n alt="QR Code" \n class="glide-qr-img" \n data-ios="${this.escapeHtml(t)}"\n data-android="${this.escapeHtml(i)}"\n />\n \n \x3c!-- Animation Overlay (Inside QR Area for centering) --\x3e\n <div id="glide-phone-overlay" class="glide-phone-animation-overlay">\n <div class="glide-outlined-phone">\n <div class="glide-scan-line"></div>\n </div>\n </div>\n </div>\n </div>\n `;this.createModal(o,"",!0),this.setupPlatformToggles(),this.setupHelpInteraction()}renderDualMode(n,e){const t='\n <div class="glide-phone-animation-overlay">\n <div class="glide-outlined-phone">\n <div class="glide-scan-line"></div>\n </div>\n </div>\n ';this.createModal(`\n <div class="glide-content glide-dual-mode">\n <div class="glide-dual-container">\n <div class="glide-dual-item">\n <div class="glide-os-logo">\n ${this.iconApple}\n <span>iOS</span>\n </div>\n <div class="glide-qr-area">\n <img src="${this.escapeHtml(n.iosQRCode)}" alt="iOS QR" class="glide-qr-img" />\n ${t}\n </div>\n </div>\n <div class="glide-dual-separator">\n <div class="glide-separator-line"></div>\n <span class="glide-separator-text">or</span>\n <div class="glide-separator-line"></div>\n </div>\n <div class="glide-dual-item">\n <div class="glide-os-logo">\n ${this.iconAndroid}\n <span>Android</span>\n </div>\n <div class="glide-qr-area">\n <img src="${this.escapeHtml(n.androidQRCode||n.iosQRCode)}" alt="Android QR" class="glide-qr-img" />\n ${t}\n </div>\n </div>\n </div>\n </div>\n `,"glide-modal-wide",!0),this.setupHelpInteraction()}renderPreStepMode(n,e){this.currentStep="os-choice";const t=`\n <div class="glide-pre-step-container">\n <button class="glide-os-choice-btn" id="glide-btn-ios">\n ${this.iconApple}\n <span>iOS</span>\n </button>\n <button class="glide-os-choice-btn" id="glide-btn-android">\n ${this.iconAndroid}\n <span>Android</span>\n </button>\n </div>\n `;this.createModal(t,"",!1),this.setupPreStepListeners(),this.show()}setupPreStepListeners(){this.container&&(this.container.querySelector("#glide-btn-ios")?.addEventListener("click",()=>{this.currentStep="ios-qr",this.updatePreStepUI()}),this.container.querySelector("#glide-btn-android")?.addEventListener("click",()=>{this.currentStep="android-qr",this.updatePreStepUI()}))}updatePreStepUI(){if(!this.container)return;let n="";if("os-choice"===this.currentStep)n=`\n <div class="glide-pre-step-container">\n <button class="glide-os-choice-btn" id="glide-btn-ios">\n ${this.iconApple}\n <span>iOS</span>\n </button>\n <button class="glide-os-choice-btn" id="glide-btn-android">\n ${this.iconAndroid}\n <span>Android</span>\n </button>\n </div>\n `,this.createModal(n,"",!1),this.setupPreStepListeners();else if("ios-qr"===this.currentStep){const e="object"==typeof this.qrCodeData&&this.qrCodeData?.iosQRCode?this.qrCodeData.iosQRCode:this.qrCodeData;n=`\n <div class="glide-content">\n <div class="glide-qr-area">\n <img src="${this.escapeHtml(e)}" alt="QR Code" class="glide-qr-img" />\n \n \x3c!-- Animation Overlay --\x3e\n <div id="glide-phone-overlay" class="glide-phone-animation-overlay">\n <div class="glide-outlined-phone">\n <div class="glide-scan-line"></div>\n </div>\n </div>\n </div>\n </div>\n `,this.createModal(n,"",!0,!0),this.setupBackButton(),this.setupHelpInteraction()}else if("android-qr"===this.currentStep){const e="object"==typeof this.qrCodeData&&this.qrCodeData?.androidQRCode?this.qrCodeData.androidQRCode:"object"==typeof this.qrCodeData&&this.qrCodeData?.iosQRCode?this.qrCodeData.iosQRCode:this.qrCodeData;n=`\n <div class="glide-content">\n <div class="glide-qr-area">\n <img src="${this.escapeHtml(e)}" alt="QR Code" class="glide-qr-img" />\n \n \x3c!-- Animation Overlay --\x3e\n <div id="glide-phone-overlay" class="glide-phone-animation-overlay">\n <div class="glide-outlined-phone">\n <div class="glide-scan-line"></div>\n </div>\n </div>\n </div>\n </div>\n `,this.createModal(n,"",!0,!0),this.setupBackButton(),this.setupHelpInteraction()}}setupBackButton(){this.container&&this.container.querySelector("#glide-back-btn")?.addEventListener("click",()=>{this.currentStep="os-choice",this.updatePreStepUI()})}createModal(n,e="",t=!1,i=!1){this.isClosing&&(this.isClosing=!1,this.cleanup()),this.container?(this.container.className=`glide-modal ${e}`,this.shouldUseDarkMode()&&this.container.classList.add("dark")):(this.backdrop=document.createElement("div"),this.backdrop.className="glide-backdrop",this.backdrop.id="glide-backdrop",this.container=document.createElement("div"),this.container.className=`glide-modal ${e}`,this.container.id="glide-modal",this.shouldUseDarkMode()&&this.container.classList.add("dark"),this.isOpen&&(document.body.appendChild(this.backdrop),document.body.appendChild(this.container))),this.container.innerHTML=`\n ${i?`\n <button class="glide-btn glide-btn-back" id="glide-back-btn" aria-label="Back">\n ${this.iconBack}\n </button>\n `:""}\n ${!1!==this.options?.showCloseButton?'\n <button class="glide-btn glide-btn-close" id="glide-close-btn" aria-label="Close">\n <svg class="glide-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>\n </button>\n ':""}\n <h2 class="glide-title">${this.options?.title||"Scan to Verify"}</h2>\n <div id="glide-modal-content">${n}</div>\n <p class="glide-status" id="glide-status">${this.options?.description||""}</p>\n ${t?'\n <button class="glide-btn glide-btn-help" id="glide-help-btn">?</button>\n ':""}\n `,this.injectStyles();const o=this.container.querySelector("#glide-close-btn");o&&o.addEventListener("click",()=>{this.closeCallback?.(),this.close()}),this.backdrop&&(this.backdrop.onclick=n=>{n.target===this.backdrop&&!1!==this.options?.closeOnBackdropClick&&(this.closeCallback?.(),this.close())})}setupHelpInteraction(){const n=this.container?.querySelector("#glide-help-btn");n&&n.addEventListener("click",()=>{const n=this.container?.querySelectorAll(".glide-phone-animation-overlay");n&&n.forEach(n=>{n.classList.remove("playing"),n.offsetWidth,n.classList.add("playing"),setTimeout(()=>{n.classList.remove("playing")},3e3)})})}injectStyles(){if(document.getElementById("glide-modal-styles"))return;const n=document.createElement("style");n.id="glide-modal-styles",n.textContent='\n :root {\n --glide-primary: #007AFF;\n --glide-text: #1d1d1f;\n --glide-bg-light: rgba(255, 255, 255, 0.6);\n --glide-bg-dark: rgba(30, 30, 30, 0.6);\n --glide-phone-border: #000000; /* High Contrast Black */\n \n /* Button sizes */\n --glide-btn-size: 28px;\n --glide-help-btn-size: 24px;\n --glide-toggle-icon-size: 14px;\n --glide-dual-icon-size: 18px;\n }\n\n #glide-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n z-index: 9998;\n opacity: 0;\n transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);\n }\n\n #glide-modal {\n position: fixed;\n top: 20px;\n left: 50%;\n transform: translateX(-50%) scale(0.94);\n background: var(--glide-bg-light);\n backdrop-filter: blur(24px) saturate(180%);\n -webkit-backdrop-filter: blur(24px) saturate(180%);\n border-radius: 24px;\n padding: 32px;\n width: 360px;\n max-width: 90%;\n box-shadow: \n 0 20px 40px rgba(0,0,0,0.2),\n 0 0 0 1px rgba(255,255,255,0.6) inset,\n 0 0 0 1px rgba(0,0,0,0.05);\n z-index: 9999;\n opacity: 0;\n transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);\n font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif;\n text-align: center;\n color: var(--glide-text);\n }\n \n #glide-modal.glide-modal-wide {\n width: 600px;\n max-width: 95vw;\n }\n\n #glide-modal.dark {\n background: var(--glide-bg-dark);\n color: white;\n box-shadow: \n 0 20px 40px rgba(0,0,0,0.4),\n 0 0 0 1px rgba(255,255,255,0.15) inset,\n 0 0 0 1px rgba(0,0,0,0.5);\n --glide-phone-border: #ffffff; /* High Contrast White */\n }\n\n #glide-modal .glide-btn-close {\n position: absolute;\n top: 16px;\n right: 16px;\n width: var(--glide-btn-size);\n height: var(--glide-btn-size);\n min-width: var(--glide-btn-size);\n min-height: var(--glide-btn-size);\n max-width: var(--glide-btn-size);\n max-height: var(--glide-btn-size);\n background: rgba(118, 118, 128, 0.12);\n border: none;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: rgba(0,0,0,0.5);\n transition: background 0.2s;\n padding: 0;\n z-index: 20;\n box-sizing: border-box;\n flex-shrink: 0;\n }\n\n #glide-modal.dark .glide-btn-close {\n background: rgba(255, 255, 255, 0.1);\n color: rgba(255,255,255,0.5);\n }\n\n #glide-modal .glide-btn-close:hover {\n background: rgba(118, 118, 128, 0.2);\n }\n \n #glide-modal.dark .glide-btn-close:hover {\n background: rgba(255, 255, 255, 0.2);\n }\n\n .glide-title {\n margin: 0 0 8px 0;\n font-size: 22px;\n font-weight: 600;\n letter-spacing: -0.01em;\n }\n \n .glide-status {\n margin: 12px 0 0 0;\n font-size: 13px;\n color: rgba(0,0,0,0.5);\n text-align: center;\n min-height: 18px;\n }\n \n .glide-status:empty {\n display: none;\n }\n \n #glide-modal.dark .glide-status {\n color: rgba(255,255,255,0.5);\n }\n \n .glide-content {\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n }\n \n /* --- Sliding Toggle Switch --- */\n #glide-toggle {\n background: rgba(118, 118, 128, 0.12);\n padding: 2px;\n border-radius: 8px;\n display: inline-flex;\n margin-bottom: 24px;\n margin-top: 16px;\n position: relative;\n height: 32px;\n width: 200px;\n box-sizing: border-box;\n }\n\n #glide-modal.dark #glide-toggle {\n background: rgba(118, 118, 128, 0.24);\n }\n \n /* The sliding background */\n .glide-toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: calc(50% - 2px);\n height: calc(100% - 4px);\n background: white;\n border-radius: 6px;\n box-shadow: 0 3px 8px rgba(0,0,0,0.12), 0 3px 1px rgba(0,0,0,0.04);\n transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n z-index: 0;\n }\n \n #glide-modal.dark .glide-toggle-slider {\n background: #636366;\n }\n \n /* Move slider for Android */\n #glide-toggle[data-active="android"] .glide-toggle-slider {\n transform: translateX(100%);\n }\n\n .glide-toggle-btn {\n flex: 1;\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n font-size: 13px;\n font-weight: 500;\n color: inherit;\n cursor: pointer;\n position: relative;\n z-index: 1;\n transition: color 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n min-height: auto;\n height: auto;\n min-width: auto;\n border-radius: 0;\n }\n \n #glide-modal .glide-toggle-btn .glide-icon-os,\n #glide-modal .glide-toggle-btn svg {\n width: var(--glide-toggle-icon-size);\n height: var(--glide-toggle-icon-size);\n flex-shrink: 0;\n margin: 0;\n padding: 0;\n }\n \n .glide-toggle-btn span {\n margin: 0;\n padding: 0;\n line-height: 1;\n }\n \n #glide-modal.dark .glide-toggle-btn {\n color: rgba(255,255,255,0.6);\n }\n \n #glide-toggle[data-active="ios"] .glide-toggle-btn[data-platform="ios"],\n #glide-toggle[data-active="android"] .glide-toggle-btn[data-platform="android"] {\n color: #1d1d1f;\n }\n \n #glide-modal.dark #glide-toggle[data-active="ios"] .glide-toggle-btn[data-platform="ios"],\n #glide-modal.dark #glide-toggle[data-active="android"] .glide-toggle-btn[data-platform="android"] {\n color: white;\n }\n\n /* QR Area */\n .glide-qr-area {\n position: relative;\n margin: 0 auto;\n }\n\n .glide-qr-img {\n width: 200px;\n height: 200px;\n object-fit: contain;\n display: block;\n border-radius: 16px;\n }\n \n /* Dual Mode QR Area - no extra padding, same as single mode */\n .glide-dual-mode .glide-qr-area {\n background: transparent;\n padding: 0;\n }\n \n .glide-dual-mode .glide-qr-img {\n width: 180px;\n height: 180px;\n border-radius: 16px;\n }\n \n /* --- Help Icon & Interaction --- */\n .glide-btn-help {\n position: absolute;\n bottom: 20px;\n right: 20px;\n width: var(--glide-help-btn-size);\n height: var(--glide-help-btn-size);\n min-width: var(--glide-help-btn-size);\n min-height: var(--glide-help-btn-size);\n max-width: var(--glide-help-btn-size);\n max-height: var(--glide-help-btn-size);\n border-radius: 50%;\n border: 1.5px solid rgba(0,0,0,0.2);\n color: rgba(0,0,0,0.4);\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif;\n font-size: 14px;\n font-weight: 600;\n line-height: 1;\n cursor: pointer;\n transition: all 0.2s;\n background: transparent;\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n z-index: 10;\n }\n \n #glide-modal.dark .glide-btn-help {\n border-color: rgba(255,255,255,0.3);\n color: rgba(255,255,255,0.5);\n }\n\n .glide-btn-help:hover {\n border-color: var(--glide-primary);\n color: var(--glide-primary);\n background: rgba(0, 122, 255, 0.1);\n }\n \n /* Tooltip */\n .glide-btn-help::after {\n content: "Need help?";\n position: absolute;\n bottom: 100%;\n left: 50%;\n transform: translateX(-50%) translateY(-8px);\n background: rgba(0,0,0,0.8);\n color: white;\n padding: 4px 8px;\n border-radius: 4px;\n font-size: 11px;\n white-space: nowrap;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.2s;\n }\n \n .glide-btn-help:hover::after {\n opacity: 1;\n }\n\n /* --- Outlined Phone Animation --- */\n .glide-phone-animation-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.3s;\n border-radius: 16px;\n background: rgba(255,255,255,0.8);\n }\n \n #glide-modal.dark .glide-phone-animation-overlay {\n background: rgba(0,0,0,0.6);\n }\n \n .glide-phone-animation-overlay.playing {\n opacity: 1;\n }\n\n .glide-outlined-phone {\n width: 100px;\n height: 180px;\n border: 4px solid var(--glide-phone-border);\n border-radius: 16px;\n position: relative;\n background: transparent;\n box-shadow: 0 10px 30px rgba(0,0,0,0.2);\n transform: translateY(20px);\n }\n \n /* Notch */\n .glide-outlined-phone::before {\n content: \'\';\n position: absolute;\n top: -1px;\n left: 50%;\n transform: translateX(-50%);\n width: 40%;\n height: 12px;\n background: var(--glide-phone-border);\n border-bottom-left-radius: 8px;\n border-bottom-right-radius: 8px;\n }\n \n /* Scanning Line */\n .glide-scan-line {\n position: absolute;\n top: 10%;\n left: 5%;\n width: 90%;\n height: 2px;\n background: var(--glide-primary);\n box-shadow: 0 0 8px var(--glide-primary);\n opacity: 0;\n }\n \n /* Animation Keyframes */\n @keyframes glide-scan-motion {\n 0% { top: 10%; opacity: 0; }\n 10% { opacity: 1; }\n 90% { opacity: 1; }\n 100% { top: 90%; opacity: 0; }\n }\n \n .glide-phone-animation-overlay.playing .glide-outlined-phone {\n animation: glide-phone-appear 3s ease-in-out forwards;\n }\n \n .glide-phone-animation-overlay.playing .glide-scan-line {\n animation: glide-scan-motion 2s ease-in-out 0.5s infinite;\n }\n \n @keyframes glide-phone-appear {\n 0% { transform: translateY(20px); opacity: 0; }\n 10% { transform: translateY(0); opacity: 1; }\n 90% { transform: translateY(0); opacity: 1; }\n 100% { transform: translateY(20px); opacity: 0; }\n }\n \n /* Dual Mode */\n .glide-dual-container {\n display: flex;\n justify-content: center;\n align-items: stretch;\n gap: 32px;\n margin-top: 20px;\n }\n \n .glide-dual-item {\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n \n .glide-os-logo {\n display: flex;\n align-items: center;\n gap: 8px;\n font-weight: 600;\n margin-bottom: 12px;\n font-size: 15px;\n color: inherit;\n }\n \n /* Dual mode OS logo - aligned icons with text, spacing to QR */\n .glide-dual-mode .glide-os-logo {\n margin-bottom: 12px; /* Space between label and QR code */\n }\n \n #glide-modal .glide-dual-mode .glide-os-logo .glide-icon-os,\n #glide-modal .glide-dual-mode .glide-os-logo svg {\n width: var(--glide-dual-icon-size);\n height: var(--glide-dual-icon-size);\n margin: 0;\n padding: 0;\n flex-shrink: 0;\n }\n \n .glide-dual-mode .glide-os-logo span {\n margin: 0;\n padding: 0;\n line-height: 1;\n }\n \n .glide-os-logo svg {\n width: 20px;\n height: 20px;\n opacity: 0.8;\n }\n \n /* Dual Mode Separator - aligned to QR codes only */\n .glide-dual-separator {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n align-self: stretch;\n /* Offset for OS label (18px icon + 12px margin = ~30px) */\n margin-top: 30px;\n padding: 20px 0;\n }\n \n .glide-separator-line {\n width: 1px;\n flex: 1;\n background: linear-gradient(to bottom, transparent, rgba(128,128,128,0.3), transparent);\n }\n \n .glide-separator-text {\n padding: 8px 0;\n font-size: 11px;\n font-weight: 500;\n color: rgba(128,128,128,0.5);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n }\n \n #glide-modal.dark .glide-separator-line {\n background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.2), transparent);\n }\n \n #glide-modal.dark .glide-separator-text {\n color: rgba(255,255,255,0.4);\n }\n \n /* Pre-Step */\n .glide-pre-step-container {\n display: flex;\n gap: 20px;\n justify-content: center;\n margin: 24px 0;\n }\n \n .glide-os-choice-btn {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 140px;\n height: 140px;\n border: 1px solid rgba(0,0,0,0.08);\n border-radius: 20px;\n background: rgba(255,255,255,0.4);\n cursor: pointer;\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n position: relative;\n overflow: hidden;\n font-size: 14px;\n color: inherit;\n }\n \n #glide-modal.dark .glide-os-choice-btn {\n background: rgba(255,255,255,0.05);\n border-color: rgba(255,255,255,0.1);\n color: white;\n }\n \n .glide-os-choice-btn:hover {\n background: rgba(255,255,255,0.9);\n transform: translateY(-4px);\n box-shadow: 0 12px 24px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.04);\n border-color: var(--glide-primary);\n }\n \n #glide-modal.dark .glide-os-choice-btn:hover {\n background: rgba(255,255,255,0.15);\n box-shadow: 0 12px 24px rgba(0,0,0,0.3);\n border-color: var(--glide-primary);\n }\n \n .glide-icon-os {\n width: 40px;\n height: 40px;\n margin-bottom: 12px;\n transition: transform 0.3s;\n fill: currentColor;\n }\n \n .glide-os-choice-btn:hover .glide-icon-os {\n transform: scale(1.1);\n }\n \n #glide-modal .glide-btn-back {\n position: absolute;\n top: 16px;\n left: 16px;\n width: var(--glide-btn-size);\n height: var(--glide-btn-size);\n min-width: var(--glide-btn-size);\n min-height: var(--glide-btn-size);\n max-width: var(--glide-btn-size);\n max-height: var(--glide-btn-size);\n background: rgba(118, 118, 128, 0.12);\n border: none;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: rgba(0,0,0,0.5);\n transition: background 0.2s;\n z-index: 20;\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n flex-shrink: 0;\n }\n \n #glide-modal.dark .glide-btn-back {\n background: rgba(255, 255, 255, 0.1);\n color: rgba(255,255,255,0.5);\n }\n\n .glide-btn-back:hover {\n background: rgba(118, 118, 128, 0.2);\n }\n \n #glide-modal.dark .glide-btn-back:hover {\n background: rgba(255, 255, 255, 0.2);\n }\n \n .glide-spinner {\n width: 40px;\n height: 40px;\n border: 3px solid rgba(0,0,0,0.1);\n border-top-color: var(--glide-primary);\n border-radius: 50%;\n animation: glide-spin 1s linear infinite;\n margin: 40px auto;\n }\n \n #glide-modal.dark .glide-spinner {\n border-color: rgba(255,255,255,0.1);\n border-top-color: var(--glide-primary);\n }\n \n @keyframes glide-spin {\n to { transform: rotate(360deg); }\n }\n ',document.head.appendChild(n)}show(){this.container&&this.backdrop&&!this.isOpen?(document.body.appendChild(this.backdrop),document.body.appendChild(this.container),this.lockBodyScroll(),document.addEventListener("keydown",this.handleEscapeKey),requestAnimationFrame(()=>{this.backdrop&&this.container&&(this.backdrop.style.opacity="1",this.container.style.opacity="1",this.container.style.transform="translateX(-50%) scale(1)")}),this.isOpen=!0):this.isOpen&&this.container&&this.backdrop&&(document.removeEventListener("keydown",this.handleEscapeKey),document.addEventListener("keydown",this.handleEscapeKey))}setupPlatformToggles(){const n=this.container?.querySelector("#glide-toggle"),e=this.container?.querySelectorAll(".glide-toggle-btn"),t=this.container?.querySelector("#glide-qr-img"),i=this.container?.querySelector("#glide-platform-message");e&&t&&e.forEach(o=>{o.addEventListener("click",o=>{const r=o.currentTarget,a=r.getAttribute("data-platform");n&&a&&n.setAttribute("data-active",a),e.forEach(n=>n.classList.remove("active")),r.classList.add("active"),"ios"===a?(t.src=t.getAttribute("data-ios")||"",i&&(i.textContent="Scan with your iPhone camera")):"android"===a&&(t.src=t.getAttribute("data-android")||"",i&&(i.textContent="Scan with your Android camera"))})})}lockBodyScroll(){this.originalBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden"}unlockBodyScroll(){document.body.style.overflow=this.originalBodyOverflow}close(){this.container&&this.backdrop&&this.isOpen&&(this.isClosing=!0,document.removeEventListener("keydown",this.handleEscapeKey),this.backdrop.style.opacity="0",this.container.style.opacity="0",this.container.style.transform="translateX(-50%) scale(0.94)",this.closeCallback=void 0,setTimeout(()=>{this.isClosing&&(this.cleanup(),this.isOpen=!1,this.isClosing=!1)},400))}cleanup(){this.container?.remove(),this.backdrop?.remove(),this.container=null,this.backdrop=null,this.unlockBodyScroll()}isModalOpen(){return this.isOpen}}function w(n){const{data:e}=n;if(e.ios_qr_image)return{iosQRCode:e.ios_qr_image,androidQRCode:e.android_qr_image||e.ios_qr_image};if(e.qr_code_image)return e.qr_code_image;throw new Error("No QR code data available")}class k{constructor(){this.logs=[],this.container=null,this.logsContainer=null,this.floatingToggle=null,this.isAtBottom=!0,this.isVisible=!0,this.originalConsole={log:console.log,error:console.error,warn:console.warn,debug:console.debug,info:console.info},this.interceptConsole(),this.createUI()}static init(){return k.instance||(k.instance=new k),k.instance}static destroy(){k.instance&&(k.instance.cleanup(),k.instance=null)}interceptConsole(){["log","error","warn","debug","info"].forEach(n=>{const e=this.originalConsole[n];console[n]=(...t)=>{e.apply(console,t),this.addLog(n,t)}})}addLog(n,e){const t=(new Date).toTimeString().split(" ")[0],i=e.map(n=>{if("object"==typeof n)try{return JSON.stringify(n,null,2)}catch{return"[Object]"}return String(n)}).join(" "),o={log:"#abb2bf",error:"#e06c75",warn:"#e5c07b",info:"#61afef",debug:"#5c6370"},r=`\n <div style="margin: 3px 0; font-family: 'SF Mono', Menlo, Monaco, monospace; font-size: 11px; color: ${o[n]||"#abb2bf"}; line-height: 1.5;">\n <span style="color: #5c6370; font-size: 10px;">${t}</span>\n <span style="background: ${{log:"#3c3c3c",error:"rgba(224, 108, 117, 0.2)",warn:"rgba(229, 192, 123, 0.2)",info:"rgba(97, 175, 239, 0.2)",debug:"#2d2d2d"}[n]}; color: ${o[n]}; padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 500; text-transform: uppercase; margin: 0 6px;">${n}</span>\n <span style="white-space: pre-wrap; word-break: break-all;">${this.escapeHtml(i)}</span>\n </div>\n `;this.logs.push(r),this.logs.length>500&&this.logs.shift(),this.updateDisplay()}updateDisplay(){this.logsContainer&&this.isVisible&&(this.isAtBottom=this.logsContainer.scrollHeight-this.logsContainer.scrollTop<=this.logsContainer.clientHeight+50,this.logsContainer.innerHTML=this.logs.join(""),this.isAtBottom&&(this.logsContainer.scrollTop=this.logsContainer.scrollHeight))}createUI(){const n=document.createElement("style");n.textContent="\n #mobile-debug-console {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n height: 45vh;\n background: #1e1e1e;\n z-index: 999999;\n display: flex;\n flex-direction: column;\n font-family: 'SF Mono', Menlo, Monaco, 'Courier New', monospace;\n transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);\n border-top: 1px solid #3c3c3c;\n box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);\n }\n \n #mobile-debug-console.hidden {\n transform: translateY(100%);\n }\n \n #debug-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 12px;\n background: #2d2d2d;\n border-bottom: 1px solid #3c3c3c;\n min-height: 36px;\n }\n \n #debug-title {\n display: flex;\n align-items: center;\n gap: 8px;\n color: #9da5b4;\n font-size: 12px;\n font-weight: 500;\n letter-spacing: 0.3px;\n }\n \n #debug-title svg {\n width: 14px;\n height: 14px;\n opacity: 0.8;\n }\n \n /* Traffic light buttons - using ID for specificity */\n #mobile-debug-console .debug-traffic-lights {\n display: flex;\n gap: 8px;\n align-items: center;\n }\n \n #mobile-debug-console button.debug-traffic-btn {\n width: 16px;\n height: 16px;\n min-width: 16px;\n min-height: 16px;\n border-radius: 50%;\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n font-size: 0;\n line-height: 1;\n }\n \n #mobile-debug-console .debug-traffic-btn svg {\n width: 8px;\n height: 8px;\n }\n \n #mobile-debug-console .debug-traffic-btn.close {\n background: #ff5f57;\n }\n \n #mobile-debug-console .debug-traffic-btn.close svg {\n stroke: #820005;\n stroke-width: 2;\n }\n \n #mobile-debug-console .debug-traffic-btn.clear {\n background: #febc2e;\n }\n \n #mobile-debug-console .debug-traffic-btn.minimize {\n background: #28c840;\n }\n \n #mobile-debug-console .debug-traffic-btn.minimize svg {\n stroke: #006500;\n stroke-width: 2;\n }\n \n #mobile-debug-console .debug-traffic-btn:active {\n filter: brightness(0.85);\n }\n \n #debug-logs {\n flex: 1;\n overflow-y: auto;\n padding: 12px;\n background: #1e1e1e;\n -webkit-overflow-scrolling: touch;\n }\n \n button#debug-floating-toggle {\n position: fixed !important;\n bottom: 20px !important;\n right: 20px !important;\n width: 42px !important;\n height: 42px !important;\n min-width: 42px !important;\n min-height: 42px !important;\n border-radius: 8px !important;\n background: #2d2d2d !important;\n border: 1px solid #3c3c3c !important;\n color: #9da5b4 !important;\n cursor: pointer !important;\n z-index: 999998 !important;\n display: none;\n align-items: center !important;\n justify-content: center !important;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;\n transition: all 0.2s ease !important;\n padding: 0 !important;\n margin: 0 !important;\n }\n \n button#debug-floating-toggle:hover {\n background: #3c3c3c !important;\n color: #fff !important;\n transform: translateY(-2px) !important;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;\n }\n \n button#debug-floating-toggle:active {\n transform: translateY(0) !important;\n }\n \n button#debug-floating-toggle.visible {\n display: flex !important;\n }\n \n button#debug-floating-toggle svg {\n width: 20px !important;\n height: 20px !important;\n }\n ",document.head.appendChild(n);const e='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>';this.container=document.createElement("div"),this.container.id="mobile-debug-console",this.isVisible||(this.container.className="hidden");const t=document.createElement("div");t.id="debug-header";const i=document.createElement("div");i.id="debug-title",i.innerHTML=`${e}<span>Mobile Console</span>`;const o=document.createElement("div");o.className="debug-traffic-lights";const r=document.createElement("button");r.className="debug-traffic-btn close",r.title="Close",r.innerHTML='<svg viewBox="0 0 10 10" fill="none"><line x1="2.5" y1="2.5" x2="7.5" y2="7.5" stroke="currentColor"/><line x1="7.5" y1="2.5" x2="2.5" y2="7.5" stroke="currentColor"/></svg>',r.onclick=()=>this.cleanup();const a=document.createElement("button");a.className="debug-traffic-btn clear",a.title="Clear",a.innerHTML='<svg viewBox="0 0 16 16" fill="currentColor"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/><path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/></svg>',a.onclick=()=>this.clear();const s=document.createElement("button");s.className="debug-traffic-btn minimize",s.title="Minimize",s.innerHTML='<svg viewBox="0 0 10 10" fill="none"><path d="M2 3L5 6L8 3" stroke="currentColor" fill="none"/></svg>',s.onclick=()=>this.toggle(),o.appendChild(r),o.appendChild(a),o.appendChild(s),t.appendChild(o),t.appendChild(i),this.logsContainer=document.createElement("div"),this.logsContainer.id="debug-logs",this.logsContainer.addEventListener("scroll",()=>{this.isAtBottom=this.logsContainer.scrollHeight-this.logsContainer.scrollTop<=this.logsContainer.clientHeight+50}),this.container.appendChild(t),this.container.appendChild(this.logsContainer),document.body.appendChild(this.container),this.floatingToggle=document.createElement("button"),this.floatingToggle.id="debug-floating-toggle",this.floatingToggle.innerHTML=e,this.floatingToggle.title="Show Console",this.floatingToggle.onclick=()=>this.toggle(),document.body.appendChild(this.floatingToggle)}escapeHtml(n){const e=document.createElement("div");return e.textContent=n,e.innerHTML}toggle(){this.isVisible=!this.isVisible,this.container&&this.floatingToggle&&(this.isVisible?(this.container.classList.remove("hidden"),this.floatingToggle.classList.remove("visible"),this.updateDisplay()):(this.container.classList.add("hidden"),this.floatingToggle.classList.add("visible")))}clear(){this.logs=[],this.logsContainer&&(this.logsContainer.innerHTML="")}cleanup(){Object.keys(this.originalConsole).forEach(n=>{console[n]=this.originalConsole[n]}),this.container&&this.container.remove(),this.floatingToggle&&this.floatingToggle.remove()}}k.instance=null;class E{constructor(n={}){this.config={...n,endpoints:{prepare:n.endpoints?.prepare||"/api/magic-auth/prepare",process:n.endpoints?.process||"/api/magic-auth/process",polling:n.endpoints?.polling},timeout:n.timeout||3e4,pollingInterval:n.pollingInterval||2e3,maxPollingAttempts:n.maxPollingAttempts||30,debug:n.debug||!1},this.http=n.httpClient||function(n={}){const{timeout:e=3e4,headers:t={},dynamicHeaders:i}=n;async function o(n,e){const o={"Content-Type":"application/json"};t.common&&Object.assign(o,t.common);const r=t[n.endpoint];if(r&&"object"==typeof r&&Object.assign(o,r),i){const e=await i(n);Object.assign(o,e)}return e&&Object.assign(o,e),o}async function r(n,e,t,i){const o=new AbortController,r=setTimeout(()=>o.abort(),t),a=i?()=>o.abort():null;i&&a&&i.addEventListener("abort",a);try{return await fetch(n,{...e,signal:o.signal})}catch(n){if(n instanceof Error&&"AbortError"===n.name){if(i?.aborted)throw h(s.CANCELLED,"Request was cancelled");throw h(s.TIMEOUT,"Request timed out")}throw h(s.NETWORK_ERROR,n instanceof Error?n.message:"Network request failed")}finally{clearTimeout(r),i&&a&&i.removeEventListener("abort",a)}}async function a(n){let e;try{e=await n.json()}catch{if(!n.ok)throw h(s.INVALID_RESPONSE,`Request failed with status ${n.status}`);throw h(s.INVALID_RESPONSE,"Failed to parse response")}if(!n.ok)throw function(n){if(n&&("code"in n||"error"in n)){const e=n,t=e.code||e.error,i=e.message,o=new Error(i||"An error occurred");return o.code=t,o.status=e.status,o.requestId=e.requestId||e.request_id,o.timestamp=e.timestamp,o.details=e.details,o.traceId=e.trace_id||e.traceId,o.spanId=e.span_id||e.spanId,o.service=e.service,e.details&&"object"==typeof e.details&&"retryAfter"in e.details&&(o.retryAfter=e.details.retryAfter),o}if(n&&"status"in n){const e=n,t=e.status,i=new Error(e.message||`Request failed with status ${t}`);return i.code=`HTTP_${t}`,i.status=t,i}const e=new Error("An unexpected error occurred");return e.code="UNKNOWN_ERROR",e}({...e,status:n.status});return e}function l(n){return n.includes("/prepare")?"prepare":n.includes("/process")||n.includes("/get-phone")||n.includes("/verify-phone")?"process":n.includes("/status")?"polling":"prepare"}return{async post(n,t,i){const s=l(n),d=await o({endpoint:s,method:"POST"},i?.headers);return a(await r(n,{method:"POST",headers:d,body:JSON.stringify(t)},i?.timeout||e,i?.signal))},async get(n,t){const i=l(n),s=await o({endpoint:i,method:"GET"},t?.headers);return delete s["Content-Type"],a(await r(n,{method:"GET",headers:s},t?.timeout||e,t?.signal))}}}({timeout:this.config.timeout,headers:n.headers,dynamicHeaders:n.dynamicHeaders}),this.logger=n.logger||(this.config.debug?function(n={}){const{debug:e=!1,prefix:t="[PhoneAuth]"}=n;function i(n,e){const i=`${t} ${n}`;return void 0!==e?[i,y(e)]:[i]}return{debug(n,t){if(e){const e=i(n,t);console.debug(...e)}},info(n,e){const t=i(n,e);console.info(...t)},warn(n,e){const t=i(n,e);console.warn(...t)},error(n,e){const t=i(n,e);console.error(...t)}}}({debug:!0}):{debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}}),this.logger.debug("PhoneAuthClient initialized",{endpoints:this.config.endpoints,timeout:this.config.timeout}),n.devtools?.showMobileConsole&&"undefined"!=typeof window&&(k.init(),this.logger.info("Mobile debug console enabled"))}async authenticate(n,e){const i=await this.prepare(n),o=await this.invokeSecurePrompt(i,e),r=await o.credential,a=i.session.use_case||i.session.metadata?.use_case||n.use_case;if(!a)throw h(s.INVALID_RESPONSE,"Could not determine use_case from session or request");return a===t.VERIFY_PHONE_NUMBER?this.verifyPhoneNumber(r,i.session):this.getPhoneNumber(r,i.session)}async prepare(n){if(this.logger.debug("Preparing authentication",{use_case:n.use_case}),n.phone_number){const e=r(n.phone_number);if(!e.valid)throw h(s.INVALID_PHONE_NUMBER,e.error)}if(n.plmn){const e=a(n.plmn);if(!e.valid)throw h(s.INVALID_PLMN,e.error)}if(!n.use_case&&!n.options?.parent_session_id)throw h(s.MISSING_PARAMETERS,"use_case is required");const e={...n,id:n.id||this.generateRequestId(),client_info:n.client_info||{user_agent:navigator.userAgent,platform:navigator.platform}};try{const n=await this.http.post(this.config.endpoints.prepare,e);return this.logger.debug("Prepare successful",{strategy:n.authentication_strategy,sessionKey:n.session.session_key}),n}catch(n){throw this.logger.error("Prepare failed",n),n}}async invokeSecurePrompt(n,e){const{authentication_strategy:t,session:o,data:r}=n;switch(this.logger.debug("Invoking secure prompt",{strategy:t}),t){case i.TS43:return this.handleTS43(r,o);case i.LINK:return this.handleLink(r,o,e);case i.DESKTOP:return this.handleDesktop(r,o,e);default:throw h(s.UNSUPPORTED_STRATEGY,`Unknown strategy: ${t}`)}}async getPhoneNumber(n,e){this.logger.debug("Getting phone number");const i={session:e,credential:n.credential,use_case:t.GET_PHONE_NUMBER};try{const n=await this.http.post(this.config.endpoints.process,i);return this.logger.info("Phone number retrieved"),n}catch(n){throw this.logger.error("Get phone number failed",n),n}}async verifyPhoneNumber(n,e){this.logger.debug("Verifying phone number");const i={session:e,credential:n.credential,use_case:t.VERIFY_PHONE_NUMBER};try{const n=await this.http.post(this.config.endpoints.process,i);return this.logger.info("Phone number verified",{verified:n.verified}),n}catch(n){throw this.logger.error("Verify phone number failed",n),n}}isSupported(){return"undefined"!=typeof window&&"DigitalCredential"in window}getBrowserSupportInfo(){if("undefined"==typeof window)return{supported:!1,browser:"unknown",message:"Not in browser"};const n=navigator.userAgent,e=/Chrome/.test(n)&&/Google Inc/.test(navigator.vendor),t=/Edg\//.test(n);return this.isSupported()?{supported:!0,browser:e?"Chrome":t?"Edge":"Other"}:{supported:!1,browser:e?"Chrome":t?"Edge":"Other",message:"Enable chrome://flags/#web-identity-digital-credentials"}}async handleTS43(n,e){if(!this.isSupported())throw h(s.BROWSER_NOT_SUPPORTED,"Digital Credentials API not available");const t={digital:{requests:[{protocol:n.protocol,data:n.data}]}};return this.logger.debug("Invoking Digital Credentials API"),{credential:(async()=>{try{const n=await navigator.credentials.get(t);if(!n?.data?.vp_token)throw h(s.INVALID_RESPONSE,"No credential returned from Digital Credentials API");const i=n.data.vp_token,o="string"==typeof i?i:Object.values(i)[0],r=Array.isArray(o)?o[0]:o;if(!r||"string"==typeof r&&""===r.trim())throw h(s.INVALID_RESPONSE,"Empty credential returned from Digital Credentials API");return{credential:r,session:e,authenticated:!0}}catch(n){if(d(n))throw n;const e=n;if("NotAllowedError"===e.name||"NetworkError"===e.name&&19===e.code)throw h(s.USER_CANCELLED,"User cancelled authentication");if("NotSupportedError"===e.name)throw h(s.BROWSER_NOT_SUPPORTED,"Browser not supported");throw h(s.NETWORK_ERROR,e.message||"Credential request failed")}})(),cancel:void 0,strategy:i.TS43,session:e}}handleLink(n,e,t){if(!n.url)throw h(s.INVALID_RESPONSE,"Missing link URL");this.logger.debug("Opening App Clip",{url:n.url}),window.location.href=n.url;const o=v({sessionKey:e.session_key,interval:t?.pollingInterval||this.config.pollingInterval,maxAttempts:t?.maxPollingAttempts||this.config.maxPollingAttempts,pollingEndpoint:t?.pollingEndpoint||this.config.endpoints.polling,statusUrl:n.status_url,logger:this.logger});return{credential:o.start().then(n=>{if("completed"===n.status&&n.credential)return{credential:n.credential,session:n.session||e,authenticated:!0};throw h(s.VERIFICATION_FAILED,n.message||"Link authentication failed")}),cancel:()=>o.cancel(),strategy:i.LINK,session:e}}handleDesktop(n,e,t){const o=n.data?.session_id||e.session_key;this.logger.debug("Starting desktop authentication",{sessionId:o});const r=v({sessionKey:o,interval:t?.pollingInterval||this.config.pollingInterval,maxAttempts:t?.maxPollingAttempts||this.config.maxPollingAttempts,pollingEndpoint:t?.pollingEndpoint||this.config.endpoints.polling,statusUrl:n.data?.status_url,logger:this.logger});let a=null;if(!t?.preventDefaultUI)try{const e=w(n);a=new x(t?.modalOptions),a.showQRCode(e,t?.modalOptions?.description||"Scan with your phone camera"),a.setCloseCallback(()=>{this.logger.debug("Modal closed by user, cancelling authentication"),r.cancel()}),this.logger.debug("Desktop modal displayed")}catch(n){this.logger.warn("Failed to show modal, continuing with polling only",n)}return{credential:r.start().then(n=>{if(a&&a.close(),"completed"===n.status&&n.credential)return{credential:n.credential,session:n.session||e,authenticated:!0};throw h(s.VERIFICATION_FAILED,n.message||"Desktop authentication failed")}).catch(n=>{throw a&&a.close(),n}),cancel:()=>{r.cancel(),a&&a.close()},strategy:i.DESKTOP,session:e}}generateRequestId(){return`web-${Date.now()}-${Math.random().toString(36).substring(2,11)}`}}function C(n){return null!==n&&"object"==typeof n&&"credential"in n&&"strategy"in n&&"session"in n}function S(n){return null!==n&&"object"==typeof n&&"credential"in n&&"authenticated"in n&&"session"in n}function A(n){return n.strategy===i.TS43}function R(n){return n.strategy===i.LINK}function I(n){return n.strategy===i.DESKTOP}function _(n){return void 0!==n.cancel}function N(n){return null!==n&&"object"==typeof n&&"protocol"in n&&"data"in n&&"object"==typeof n.data&&"dcql_query"in n.data}function O(n){return null!==n&&"object"==typeof n&&"url"in n&&"string"==typeof n.url}function T(n){return null!==n&&"object"==typeof n&&"data"in n&&"object"==typeof n.data}function P(n){return!("verified"in n)}function L(n){return"verified"in n}function D(n){return null!==n&&"object"==typeof n&&"code"in n&&"message"in n}return e})());
|
|
1
|
+
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.GlideWebClientSDK=e():n.GlideWebClientSDK=e()}(this,()=>(()=>{"use strict";var n={d:(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o:(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r:n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},e={};n.r(e),n.d(e,{AUTHENTICATION_STRATEGY:()=>i,AuthModal:()=>x,ERROR_CODES:()=>s,PhoneAuthClient:()=>E,USE_CASE:()=>t,createAuthError:()=>h,createQRCodeDataFromDesktop:()=>w,getUserMessage:()=>p,isAuthCredential:()=>S,isAuthError:()=>d,isCancellable:()=>_,isClientError:()=>c,isDesktopData:()=>T,isDesktopStrategy:()=>I,isErrorResponse:()=>D,isGetPhoneNumberResponse:()=>P,isInvokeResult:()=>C,isLinkData:()=>O,isLinkStrategy:()=>R,isRetryableError:()=>g,isTS43Data:()=>N,isTS43Strategy:()=>A,isVerifyPhoneNumberResponse:()=>L,validatePhoneNumber:()=>r,validatePlmn:()=>a});const t={GET_PHONE_NUMBER:"GetPhoneNumber",VERIFY_PHONE_NUMBER:"VerifyPhoneNumber"},i={TS43:"ts43",LINK:"link",DESKTOP:"desktop"},o=/^\+[1-9]\d{1,14}$/;function r(n){return n?n.startsWith("+")?n.length<8?{valid:!1,error:"Phone number too short for E.164 format (minimum 8 characters including +)"}:n.length>16?{valid:!1,error:"Phone number too long for E.164 format (maximum 15 digits after +)"}:/^\+\d+$/.test(n)?o.test(n)?{valid:!0}:{valid:!1,error:"Invalid E.164 phone number format"}:{valid:!1,error:"Phone number contains invalid characters. E.164 format only allows + followed by digits"}:{valid:!1,error:"Phone number must be in E.164 format (start with +)"}:{valid:!0}}function a(n){if(!n)return{valid:!0};const{mcc:e,mnc:t}=n;return e&&/^\d{3}$/.test(e)?t&&/^\d{2,3}$/.test(t)?{valid:!0}:{valid:!1,error:"MNC must be 2 or 3 digits"}:{valid:!1,error:"MCC must be exactly 3 digits"}}const s={INVALID_PHONE_NUMBER:"INVALID_PHONE_NUMBER",INVALID_PLMN:"INVALID_PLMN",MISSING_PARAMETERS:"MISSING_PARAMETERS",BROWSER_NOT_SUPPORTED:"BROWSER_NOT_SUPPORTED",UNSUPPORTED_STRATEGY:"UNSUPPORTED_STRATEGY",USER_CANCELLED:"USER_CANCELLED",CANCELLED:"CANCELLED",VERIFICATION_FAILED:"VERIFICATION_FAILED",NETWORK_ERROR:"NETWORK_ERROR",TIMEOUT:"TIMEOUT",INVALID_RESPONSE:"INVALID_RESPONSE"},l={[s.INVALID_PHONE_NUMBER]:"Please enter a valid phone number in E.164 format (e.g., +14155551234).",[s.INVALID_PLMN]:"Invalid carrier information provided.",[s.MISSING_PARAMETERS]:"Required information is missing.",[s.BROWSER_NOT_SUPPORTED]:"Your browser does not support this authentication method. Please use Chrome or Edge with the Digital Credentials flag enabled.",[s.UNSUPPORTED_STRATEGY]:"This authentication strategy is not supported.",[s.USER_CANCELLED]:"Authentication was cancelled.",[s.CANCELLED]:"Authentication was cancelled.",[s.VERIFICATION_FAILED]:"Verification failed. Please try again.",[s.NETWORK_ERROR]:"Network connection failed. Please check your connection and try again.",[s.TIMEOUT]:"Request timed out. Please try again.",[s.INVALID_RESPONSE]:"Invalid response received."};function d(n){return null!==n&&"object"==typeof n&&"code"in n&&"message"in n&&"string"==typeof n.code&&"string"==typeof n.message}function c(n){return Object.values(s).includes(n.code)}function g(n){return n.code===s.NETWORK_ERROR||n.code===s.TIMEOUT}function p(n){return c(n)&&l[n.code]||n.message}function h(n,e,t){const i=new Error(e||l[n]||n);return i.code=n,i.details=t,i.timestamp=(new Date).toISOString(),i}const u=/(\+?[1-9]\d{6,14})/g,b=/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g,m=/(eyJ[a-zA-Z0-9_-]*\.eyJ[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*)/g,f=/session[_-]?key["']?\s*[:=]\s*["']?([a-zA-Z0-9_-]{20,})["']?/gi;function y(n){if(null==n)return n;if("string"==typeof n){let e=n;return e=e.replace(u,n=>n.length<8?n:n.slice(0,2)+"***"+n.slice(-4)),e=e.replace(b,n=>{const[e,t]=n.split("@");return e.slice(0,1)+"***@"+t}),e=e.replace(m,"[JWT]"),e=e.replace(f,(n,e)=>n.replace(e,e.slice(0,4)+"***"+e.slice(-4))),e}if(Array.isArray(n))return n.map(y);if("object"==typeof n){const e={};for(const[t,i]of Object.entries(n))["phone_number","phoneNumber","credential","token","password","secret"].some(n=>t.toLowerCase().includes(n.toLowerCase()))?e[t]="string"==typeof i?"[REDACTED]":i:e[t]=y(i);return e}return n}function v(n){const{sessionKey:e,interval:t=2e3,maxAttempts:i=30,pollingEndpoint:o,statusUrl:r,logger:a}=n;let l,d,c=0,g=!1,p=!1;function u(){p=!1,l&&(clearInterval(l),l=void 0)}return{start:function(){return new Promise((n,s)=>{d=s,p=!0,c=0;const h=async()=>{if(p&&!g){if(c>=i)return u(),a?.warn("Polling timeout reached",{attempts:c,maxAttempts:i}),void n({status:"expired",message:"Authentication timeout"});try{const t=o?(a?.debug("Using developer config endpoint for polling",{pollingEndpoint:o}),`${o}/${e}`):r?(a?.debug("Using backend status_url for polling",{statusUrl:r}),r):(a?.debug("Using prod fallback for status polling"),`https://api.glideidentity.app/public/status/${e}`);a?.debug("Polling status",{url:t,attempt:c+1,maxAttempts:i});const s=await fetch(t,{method:"GET",headers:{Accept:"application/json"}});if(200===s.status){const t=await s.json();if("completed"===t.status)return u(),a?.info("Authentication completed"),void n({status:"completed",credential:t.credential||e,session:t.session||{session_key:e}});c++}else if(410===s.status){u();const e=await s.json().catch(()=>({}));n({status:"expired",message:e.message||"Session expired"})}else if(422===s.status){u();const e=await s.json().catch(()=>({}));n({status:"error",message:e.message||"Authentication failed"})}else 404===s.status?(u(),n({status:"error",message:"Session not found"})):c++}catch(n){a?.debug("Polling error, retrying",{error:n,attempt:c+1}),c++}}};h(),l=setInterval(h,t)})},stop:u,cancel:function(){a?.debug("Polling cancelled"),g=!0,u(),d&&(d(h(s.CANCELLED,"Authentication cancelled")),d=void 0)},isPolling:function(){return void 0!==l},cleanup:function(){u(),g=!1,d=void 0}}}class x{constructor(n){this.container=null,this.backdrop=null,this.isOpen=!1,this.currentStep="os-choice",this.qrCodeData=null,this.statusMessage="",this.originalBodyOverflow="",this.isClosing=!1,this.iconApple='<svg class="glide-icon glide-icon-os" viewBox="0 0 384 512" fill="currentColor"><path d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 52.3-11.4 69.5-34.3z"/></svg>',this.iconAndroid='<svg class="glide-icon glide-icon-os" viewBox="0 0 576 512" fill="currentColor"><path d="M420.55,301.93a24,24,0,1,1,24-24,24,24,0,0,1-24,24m-265.1,0a24,24,0,1,1,24-24,24,24,0,0,1-24,24m273.7-144.48,47.94-83a10,10,0,1,0-17.27-10h0l-48.54,84.07a301.25,301.25,0,0,0-246.56,0L116.18,64.45a10,10,0,1,0-17.27,10h0l47.94,83C64.53,202.22,8.24,285.55,0,384H576c-8.24-98.45-64.54-181.78-146.85-226.55"/></svg>',this.iconBack='<svg class="glide-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',this.options=n||{},this.theme=this.options.theme||"auto",this.handleEscapeKey=this.handleEscapeKey.bind(this)}shouldUseDarkMode(){return"dark"===this.theme||"light"!==this.theme&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}handleEscapeKey(n){"Escape"===n.key&&this.isOpen&&!1!==this.options?.closeOnEscape&&(this.closeCallback?.(),this.close())}escapeHtml(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}showQRCode(n,e="Scan with your phone camera"){this.qrCodeData=n,this.statusMessage=e;const t=this.options.viewMode||"toggle";if("string"==typeof n)this.renderToggleMode(n,e);else switch(t){case"dual":this.renderDualMode(n,e);break;case"pre-step":this.renderPreStepMode(n,e);break;default:this.renderToggleMode(n,e)}this.show()}updateStatus(n,e=!1){if(this.statusMessage=n,this.container){const t=this.container.querySelector("#glide-status");t&&(t.textContent=n,t.style.color=e?"#ff3b30":"")}}setCloseCallback(n){this.closeCallback=n}renderToggleMode(n,e){let t="",i="";"string"==typeof n?(t=n,i=n):(t=n.iosQRCode,i=n.androidQRCode||n.iosQRCode);const o=`\n <div class="glide-content">\n <div class="glide-toggle" id="glide-toggle" data-active="ios">\n <div class="glide-toggle-slider"></div>\n <button class="glide-btn glide-toggle-btn active" data-platform="ios">${this.iconApple}<span>iOS</span></button>\n <button class="glide-btn glide-toggle-btn" data-platform="android">${this.iconAndroid}<span>Android</span></button>\n </div>\n\n <div class="glide-qr-area">\n <img \n class="glide-qr-img"\n id="glide-qr-img" \n src="${this.escapeHtml(t)}" \n alt="QR Code" \n class="glide-qr-img" \n data-ios="${this.escapeHtml(t)}"\n data-android="${this.escapeHtml(i)}"\n />\n \n \x3c!-- Animation Overlay (Inside QR Area for centering) --\x3e\n <div id="glide-phone-overlay" class="glide-phone-animation-overlay">\n <div class="glide-outlined-phone">\n <div class="glide-scan-line"></div>\n </div>\n </div>\n </div>\n </div>\n `;this.createModal(o,"",!0),this.setupPlatformToggles(),this.setupHelpInteraction()}renderDualMode(n,e){const t='\n <div class="glide-phone-animation-overlay">\n <div class="glide-outlined-phone">\n <div class="glide-scan-line"></div>\n </div>\n </div>\n ';this.createModal(`\n <div class="glide-content glide-dual-mode">\n <div class="glide-dual-container">\n <div class="glide-dual-item">\n <div class="glide-os-logo">\n ${this.iconApple}\n <span>iOS</span>\n </div>\n <div class="glide-qr-area">\n <img src="${this.escapeHtml(n.iosQRCode)}" alt="iOS QR" class="glide-qr-img" />\n ${t}\n </div>\n </div>\n <div class="glide-dual-separator">\n <div class="glide-separator-line"></div>\n <span class="glide-separator-text">or</span>\n <div class="glide-separator-line"></div>\n </div>\n <div class="glide-dual-item">\n <div class="glide-os-logo">\n ${this.iconAndroid}\n <span>Android</span>\n </div>\n <div class="glide-qr-area">\n <img src="${this.escapeHtml(n.androidQRCode||n.iosQRCode)}" alt="Android QR" class="glide-qr-img" />\n ${t}\n </div>\n </div>\n </div>\n </div>\n `,"glide-modal-wide",!0),this.setupHelpInteraction()}renderPreStepMode(n,e){this.currentStep="os-choice";const t=`\n <div class="glide-pre-step-container">\n <button class="glide-os-choice-btn" id="glide-btn-ios">\n ${this.iconApple}\n <span>iOS</span>\n </button>\n <button class="glide-os-choice-btn" id="glide-btn-android">\n ${this.iconAndroid}\n <span>Android</span>\n </button>\n </div>\n `;this.createModal(t,"",!1),this.setupPreStepListeners(),this.show()}setupPreStepListeners(){this.container&&(this.container.querySelector("#glide-btn-ios")?.addEventListener("click",()=>{this.currentStep="ios-qr",this.updatePreStepUI()}),this.container.querySelector("#glide-btn-android")?.addEventListener("click",()=>{this.currentStep="android-qr",this.updatePreStepUI()}))}updatePreStepUI(){if(!this.container)return;let n="";if("os-choice"===this.currentStep)n=`\n <div class="glide-pre-step-container">\n <button class="glide-os-choice-btn" id="glide-btn-ios">\n ${this.iconApple}\n <span>iOS</span>\n </button>\n <button class="glide-os-choice-btn" id="glide-btn-android">\n ${this.iconAndroid}\n <span>Android</span>\n </button>\n </div>\n `,this.createModal(n,"",!1),this.setupPreStepListeners();else if("ios-qr"===this.currentStep){const e="object"==typeof this.qrCodeData&&this.qrCodeData?.iosQRCode?this.qrCodeData.iosQRCode:this.qrCodeData;n=`\n <div class="glide-content">\n <div class="glide-qr-area">\n <img src="${this.escapeHtml(e)}" alt="QR Code" class="glide-qr-img" />\n \n \x3c!-- Animation Overlay --\x3e\n <div id="glide-phone-overlay" class="glide-phone-animation-overlay">\n <div class="glide-outlined-phone">\n <div class="glide-scan-line"></div>\n </div>\n </div>\n </div>\n </div>\n `,this.createModal(n,"",!0,!0),this.setupBackButton(),this.setupHelpInteraction()}else if("android-qr"===this.currentStep){const e="object"==typeof this.qrCodeData&&this.qrCodeData?.androidQRCode?this.qrCodeData.androidQRCode:"object"==typeof this.qrCodeData&&this.qrCodeData?.iosQRCode?this.qrCodeData.iosQRCode:this.qrCodeData;n=`\n <div class="glide-content">\n <div class="glide-qr-area">\n <img src="${this.escapeHtml(e)}" alt="QR Code" class="glide-qr-img" />\n \n \x3c!-- Animation Overlay --\x3e\n <div id="glide-phone-overlay" class="glide-phone-animation-overlay">\n <div class="glide-outlined-phone">\n <div class="glide-scan-line"></div>\n </div>\n </div>\n </div>\n </div>\n `,this.createModal(n,"",!0,!0),this.setupBackButton(),this.setupHelpInteraction()}}setupBackButton(){this.container&&this.container.querySelector("#glide-back-btn")?.addEventListener("click",()=>{this.currentStep="os-choice",this.updatePreStepUI()})}createModal(n,e="",t=!1,i=!1){this.isClosing&&(this.isClosing=!1,this.cleanup()),this.container?(this.container.className=`glide-modal ${e}`,this.shouldUseDarkMode()&&this.container.classList.add("dark")):(this.backdrop=document.createElement("div"),this.backdrop.className="glide-backdrop",this.backdrop.id="glide-backdrop",this.container=document.createElement("div"),this.container.className=`glide-modal ${e}`,this.container.id="glide-modal",this.shouldUseDarkMode()&&this.container.classList.add("dark"),this.isOpen&&(document.body.appendChild(this.backdrop),document.body.appendChild(this.container))),this.container.innerHTML=`\n ${i?`\n <button class="glide-btn glide-btn-back" id="glide-back-btn" aria-label="Back">\n ${this.iconBack}\n </button>\n `:""}\n ${!1!==this.options?.showCloseButton?'\n <button class="glide-btn glide-btn-close" id="glide-close-btn" aria-label="Close">\n <svg class="glide-icon" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>\n </button>\n ':""}\n <h2 class="glide-title">${this.options?.title||"Scan to Verify"}</h2>\n <div id="glide-modal-content">${n}</div>\n <p class="glide-status" id="glide-status">${this.options?.description||""}</p>\n ${t?'\n <button class="glide-btn glide-btn-help" id="glide-help-btn">?</button>\n ':""}\n `,this.injectStyles();const o=this.container.querySelector("#glide-close-btn");o&&o.addEventListener("click",()=>{this.closeCallback?.(),this.close()}),this.backdrop&&(this.backdrop.onclick=n=>{n.target===this.backdrop&&!1!==this.options?.closeOnBackdropClick&&(this.closeCallback?.(),this.close())})}setupHelpInteraction(){const n=this.container?.querySelector("#glide-help-btn");n&&n.addEventListener("click",()=>{const n=this.container?.querySelectorAll(".glide-phone-animation-overlay");n&&n.forEach(n=>{n.classList.remove("playing"),n.offsetWidth,n.classList.add("playing"),setTimeout(()=>{n.classList.remove("playing")},3e3)})})}injectStyles(){if(document.getElementById("glide-modal-styles"))return;const n=document.createElement("style");n.id="glide-modal-styles",n.textContent='\n :root {\n --glide-primary: #007AFF;\n --glide-text: #1d1d1f;\n --glide-bg-light: rgba(255, 255, 255, 0.6);\n --glide-bg-dark: rgba(30, 30, 30, 0.6);\n --glide-phone-border: #000000; /* High Contrast Black */\n \n /* Button sizes */\n --glide-btn-size: 28px;\n --glide-help-btn-size: 24px;\n --glide-toggle-icon-size: 14px;\n --glide-dual-icon-size: 18px;\n }\n\n #glide-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n z-index: 9998;\n opacity: 0;\n transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);\n }\n\n #glide-modal {\n position: fixed;\n top: 20px;\n left: 50%;\n transform: translateX(-50%) scale(0.94);\n background: var(--glide-bg-light);\n backdrop-filter: blur(24px) saturate(180%);\n -webkit-backdrop-filter: blur(24px) saturate(180%);\n border-radius: 24px;\n padding: 32px;\n width: 360px;\n max-width: 90%;\n box-shadow: \n 0 20px 40px rgba(0,0,0,0.2),\n 0 0 0 1px rgba(255,255,255,0.6) inset,\n 0 0 0 1px rgba(0,0,0,0.05);\n z-index: 9999;\n opacity: 0;\n transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);\n font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif;\n text-align: center;\n color: var(--glide-text);\n }\n \n #glide-modal.glide-modal-wide {\n width: 600px;\n max-width: 95vw;\n }\n\n #glide-modal.dark {\n background: var(--glide-bg-dark);\n color: white;\n box-shadow: \n 0 20px 40px rgba(0,0,0,0.4),\n 0 0 0 1px rgba(255,255,255,0.15) inset,\n 0 0 0 1px rgba(0,0,0,0.5);\n --glide-phone-border: #ffffff; /* High Contrast White */\n }\n\n #glide-modal .glide-btn-close {\n position: absolute;\n top: 16px;\n right: 16px;\n width: var(--glide-btn-size);\n height: var(--glide-btn-size);\n min-width: var(--glide-btn-size);\n min-height: var(--glide-btn-size);\n max-width: var(--glide-btn-size);\n max-height: var(--glide-btn-size);\n background: rgba(118, 118, 128, 0.12);\n border: none;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: rgba(0,0,0,0.5);\n transition: background 0.2s;\n padding: 0;\n z-index: 20;\n box-sizing: border-box;\n flex-shrink: 0;\n }\n\n #glide-modal.dark .glide-btn-close {\n background: rgba(255, 255, 255, 0.1);\n color: rgba(255,255,255,0.5);\n }\n\n #glide-modal .glide-btn-close:hover {\n background: rgba(118, 118, 128, 0.2);\n }\n \n #glide-modal.dark .glide-btn-close:hover {\n background: rgba(255, 255, 255, 0.2);\n }\n\n .glide-title {\n margin: 0 0 8px 0;\n font-size: 22px;\n font-weight: 600;\n letter-spacing: -0.01em;\n }\n \n .glide-status {\n margin: 12px 0 0 0;\n font-size: 13px;\n color: rgba(0,0,0,0.5);\n text-align: center;\n min-height: 18px;\n }\n \n .glide-status:empty {\n display: none;\n }\n \n #glide-modal.dark .glide-status {\n color: rgba(255,255,255,0.5);\n }\n \n .glide-content {\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n }\n \n /* --- Sliding Toggle Switch --- */\n #glide-toggle {\n background: rgba(118, 118, 128, 0.12);\n padding: 2px;\n border-radius: 8px;\n display: inline-flex;\n margin-bottom: 24px;\n margin-top: 16px;\n position: relative;\n height: 32px;\n width: 200px;\n box-sizing: border-box;\n }\n\n #glide-modal.dark #glide-toggle {\n background: rgba(118, 118, 128, 0.24);\n }\n \n /* The sliding background */\n .glide-toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: calc(50% - 2px);\n height: calc(100% - 4px);\n background: white;\n border-radius: 6px;\n box-shadow: 0 3px 8px rgba(0,0,0,0.12), 0 3px 1px rgba(0,0,0,0.04);\n transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n z-index: 0;\n }\n \n #glide-modal.dark .glide-toggle-slider {\n background: #636366;\n }\n \n /* Move slider for Android */\n #glide-toggle[data-active="android"] .glide-toggle-slider {\n transform: translateX(100%);\n }\n\n .glide-toggle-btn {\n flex: 1;\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n font-size: 13px;\n font-weight: 500;\n color: inherit;\n cursor: pointer;\n position: relative;\n z-index: 1;\n transition: color 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n min-height: auto;\n height: auto;\n min-width: auto;\n border-radius: 0;\n }\n \n #glide-modal .glide-toggle-btn .glide-icon-os,\n #glide-modal .glide-toggle-btn svg {\n width: var(--glide-toggle-icon-size);\n height: var(--glide-toggle-icon-size);\n flex-shrink: 0;\n margin: 0;\n padding: 0;\n }\n \n .glide-toggle-btn span {\n margin: 0;\n padding: 0;\n line-height: 1;\n }\n \n #glide-modal.dark .glide-toggle-btn {\n color: rgba(255,255,255,0.6);\n }\n \n #glide-toggle[data-active="ios"] .glide-toggle-btn[data-platform="ios"],\n #glide-toggle[data-active="android"] .glide-toggle-btn[data-platform="android"] {\n color: #1d1d1f;\n }\n \n #glide-modal.dark #glide-toggle[data-active="ios"] .glide-toggle-btn[data-platform="ios"],\n #glide-modal.dark #glide-toggle[data-active="android"] .glide-toggle-btn[data-platform="android"] {\n color: white;\n }\n\n /* QR Area */\n .glide-qr-area {\n position: relative;\n margin: 0 auto;\n }\n\n .glide-qr-img {\n width: 200px;\n height: 200px;\n object-fit: contain;\n display: block;\n border-radius: 16px;\n }\n \n /* Dual Mode QR Area - no extra padding, same as single mode */\n .glide-dual-mode .glide-qr-area {\n background: transparent;\n padding: 0;\n }\n \n .glide-dual-mode .glide-qr-img {\n width: 180px;\n height: 180px;\n border-radius: 16px;\n }\n \n /* --- Help Icon & Interaction --- */\n .glide-btn-help {\n position: absolute;\n bottom: 20px;\n right: 20px;\n width: var(--glide-help-btn-size);\n height: var(--glide-help-btn-size);\n min-width: var(--glide-help-btn-size);\n min-height: var(--glide-help-btn-size);\n max-width: var(--glide-help-btn-size);\n max-height: var(--glide-help-btn-size);\n border-radius: 50%;\n border: 1.5px solid rgba(0,0,0,0.2);\n color: rgba(0,0,0,0.4);\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif;\n font-size: 14px;\n font-weight: 600;\n line-height: 1;\n cursor: pointer;\n transition: all 0.2s;\n background: transparent;\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n z-index: 10;\n }\n \n #glide-modal.dark .glide-btn-help {\n border-color: rgba(255,255,255,0.3);\n color: rgba(255,255,255,0.5);\n }\n\n .glide-btn-help:hover {\n border-color: var(--glide-primary);\n color: var(--glide-primary);\n background: rgba(0, 122, 255, 0.1);\n }\n \n /* Tooltip */\n .glide-btn-help::after {\n content: "Need help?";\n position: absolute;\n bottom: 100%;\n left: 50%;\n transform: translateX(-50%) translateY(-8px);\n background: rgba(0,0,0,0.8);\n color: white;\n padding: 4px 8px;\n border-radius: 4px;\n font-size: 11px;\n white-space: nowrap;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.2s;\n }\n \n .glide-btn-help:hover::after {\n opacity: 1;\n }\n\n /* --- Outlined Phone Animation --- */\n .glide-phone-animation-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.3s;\n border-radius: 16px;\n background: rgba(255,255,255,0.8);\n }\n \n #glide-modal.dark .glide-phone-animation-overlay {\n background: rgba(0,0,0,0.6);\n }\n \n .glide-phone-animation-overlay.playing {\n opacity: 1;\n }\n\n .glide-outlined-phone {\n width: 100px;\n height: 180px;\n border: 4px solid var(--glide-phone-border);\n border-radius: 16px;\n position: relative;\n background: transparent;\n box-shadow: 0 10px 30px rgba(0,0,0,0.2);\n transform: translateY(20px);\n }\n \n /* Notch */\n .glide-outlined-phone::before {\n content: \'\';\n position: absolute;\n top: -1px;\n left: 50%;\n transform: translateX(-50%);\n width: 40%;\n height: 12px;\n background: var(--glide-phone-border);\n border-bottom-left-radius: 8px;\n border-bottom-right-radius: 8px;\n }\n \n /* Scanning Line */\n .glide-scan-line {\n position: absolute;\n top: 10%;\n left: 5%;\n width: 90%;\n height: 2px;\n background: var(--glide-primary);\n box-shadow: 0 0 8px var(--glide-primary);\n opacity: 0;\n }\n \n /* Animation Keyframes */\n @keyframes glide-scan-motion {\n 0% { top: 10%; opacity: 0; }\n 10% { opacity: 1; }\n 90% { opacity: 1; }\n 100% { top: 90%; opacity: 0; }\n }\n \n .glide-phone-animation-overlay.playing .glide-outlined-phone {\n animation: glide-phone-appear 3s ease-in-out forwards;\n }\n \n .glide-phone-animation-overlay.playing .glide-scan-line {\n animation: glide-scan-motion 2s ease-in-out 0.5s infinite;\n }\n \n @keyframes glide-phone-appear {\n 0% { transform: translateY(20px); opacity: 0; }\n 10% { transform: translateY(0); opacity: 1; }\n 90% { transform: translateY(0); opacity: 1; }\n 100% { transform: translateY(20px); opacity: 0; }\n }\n \n /* Dual Mode */\n .glide-dual-container {\n display: flex;\n justify-content: center;\n align-items: stretch;\n gap: 32px;\n margin-top: 20px;\n }\n \n .glide-dual-item {\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n \n .glide-os-logo {\n display: flex;\n align-items: center;\n gap: 8px;\n font-weight: 600;\n margin-bottom: 12px;\n font-size: 15px;\n color: inherit;\n }\n \n /* Dual mode OS logo - aligned icons with text, spacing to QR */\n .glide-dual-mode .glide-os-logo {\n margin-bottom: 12px; /* Space between label and QR code */\n }\n \n #glide-modal .glide-dual-mode .glide-os-logo .glide-icon-os,\n #glide-modal .glide-dual-mode .glide-os-logo svg {\n width: var(--glide-dual-icon-size);\n height: var(--glide-dual-icon-size);\n margin: 0;\n padding: 0;\n flex-shrink: 0;\n }\n \n .glide-dual-mode .glide-os-logo span {\n margin: 0;\n padding: 0;\n line-height: 1;\n }\n \n .glide-os-logo svg {\n width: 20px;\n height: 20px;\n opacity: 0.8;\n }\n \n /* Dual Mode Separator - aligned to QR codes only */\n .glide-dual-separator {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n align-self: stretch;\n /* Offset for OS label (18px icon + 12px margin = ~30px) */\n margin-top: 30px;\n padding: 20px 0;\n }\n \n .glide-separator-line {\n width: 1px;\n flex: 1;\n background: linear-gradient(to bottom, transparent, rgba(128,128,128,0.3), transparent);\n }\n \n .glide-separator-text {\n padding: 8px 0;\n font-size: 11px;\n font-weight: 500;\n color: rgba(128,128,128,0.5);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n }\n \n #glide-modal.dark .glide-separator-line {\n background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.2), transparent);\n }\n \n #glide-modal.dark .glide-separator-text {\n color: rgba(255,255,255,0.4);\n }\n \n /* Pre-Step */\n .glide-pre-step-container {\n display: flex;\n gap: 20px;\n justify-content: center;\n margin: 24px 0;\n }\n \n .glide-os-choice-btn {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 140px;\n height: 140px;\n border: 1px solid rgba(0,0,0,0.08);\n border-radius: 20px;\n background: rgba(255,255,255,0.4);\n cursor: pointer;\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n position: relative;\n overflow: hidden;\n font-size: 14px;\n color: inherit;\n }\n \n #glide-modal.dark .glide-os-choice-btn {\n background: rgba(255,255,255,0.05);\n border-color: rgba(255,255,255,0.1);\n color: white;\n }\n \n .glide-os-choice-btn:hover {\n background: rgba(255,255,255,0.9);\n transform: translateY(-4px);\n box-shadow: 0 12px 24px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.04);\n border-color: var(--glide-primary);\n }\n \n #glide-modal.dark .glide-os-choice-btn:hover {\n background: rgba(255,255,255,0.15);\n box-shadow: 0 12px 24px rgba(0,0,0,0.3);\n border-color: var(--glide-primary);\n }\n \n .glide-icon-os {\n width: 40px;\n height: 40px;\n margin-bottom: 12px;\n transition: transform 0.3s;\n fill: currentColor;\n }\n \n .glide-os-choice-btn:hover .glide-icon-os {\n transform: scale(1.1);\n }\n \n #glide-modal .glide-btn-back {\n position: absolute;\n top: 16px;\n left: 16px;\n width: var(--glide-btn-size);\n height: var(--glide-btn-size);\n min-width: var(--glide-btn-size);\n min-height: var(--glide-btn-size);\n max-width: var(--glide-btn-size);\n max-height: var(--glide-btn-size);\n background: rgba(118, 118, 128, 0.12);\n border: none;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: rgba(0,0,0,0.5);\n transition: background 0.2s;\n z-index: 20;\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n flex-shrink: 0;\n }\n \n #glide-modal.dark .glide-btn-back {\n background: rgba(255, 255, 255, 0.1);\n color: rgba(255,255,255,0.5);\n }\n\n .glide-btn-back:hover {\n background: rgba(118, 118, 128, 0.2);\n }\n \n #glide-modal.dark .glide-btn-back:hover {\n background: rgba(255, 255, 255, 0.2);\n }\n \n .glide-spinner {\n width: 40px;\n height: 40px;\n border: 3px solid rgba(0,0,0,0.1);\n border-top-color: var(--glide-primary);\n border-radius: 50%;\n animation: glide-spin 1s linear infinite;\n margin: 40px auto;\n }\n \n #glide-modal.dark .glide-spinner {\n border-color: rgba(255,255,255,0.1);\n border-top-color: var(--glide-primary);\n }\n \n @keyframes glide-spin {\n to { transform: rotate(360deg); }\n }\n ',document.head.appendChild(n)}show(){this.container&&this.backdrop&&!this.isOpen?(document.body.appendChild(this.backdrop),document.body.appendChild(this.container),this.lockBodyScroll(),document.addEventListener("keydown",this.handleEscapeKey),requestAnimationFrame(()=>{this.backdrop&&this.container&&(this.backdrop.style.opacity="1",this.container.style.opacity="1",this.container.style.transform="translateX(-50%) scale(1)")}),this.isOpen=!0):this.isOpen&&this.container&&this.backdrop&&(document.removeEventListener("keydown",this.handleEscapeKey),document.addEventListener("keydown",this.handleEscapeKey))}setupPlatformToggles(){const n=this.container?.querySelector("#glide-toggle"),e=this.container?.querySelectorAll(".glide-toggle-btn"),t=this.container?.querySelector("#glide-qr-img"),i=this.container?.querySelector("#glide-platform-message");e&&t&&e.forEach(o=>{o.addEventListener("click",o=>{const r=o.currentTarget,a=r.getAttribute("data-platform");n&&a&&n.setAttribute("data-active",a),e.forEach(n=>n.classList.remove("active")),r.classList.add("active"),"ios"===a?(t.src=t.getAttribute("data-ios")||"",i&&(i.textContent="Scan with your iPhone camera")):"android"===a&&(t.src=t.getAttribute("data-android")||"",i&&(i.textContent="Scan with your Android camera"))})})}lockBodyScroll(){this.originalBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden"}unlockBodyScroll(){document.body.style.overflow=this.originalBodyOverflow}close(){this.container&&this.backdrop&&this.isOpen&&(this.isClosing=!0,document.removeEventListener("keydown",this.handleEscapeKey),this.backdrop.style.opacity="0",this.container.style.opacity="0",this.container.style.transform="translateX(-50%) scale(0.94)",this.closeCallback=void 0,setTimeout(()=>{this.isClosing&&(this.cleanup(),this.isOpen=!1,this.isClosing=!1)},400))}cleanup(){this.container?.remove(),this.backdrop?.remove(),this.container=null,this.backdrop=null,this.unlockBodyScroll()}isModalOpen(){return this.isOpen}}function w(n){const{data:e}=n;if(e.ios_qr_image)return{iosQRCode:e.ios_qr_image,androidQRCode:e.android_qr_image||e.ios_qr_image};if(e.qr_code_image)return e.qr_code_image;throw new Error("No QR code data available")}class k{constructor(){this.logs=[],this.container=null,this.logsContainer=null,this.floatingToggle=null,this.isAtBottom=!0,this.isVisible=!0,this.originalConsole={log:console.log,error:console.error,warn:console.warn,debug:console.debug,info:console.info},this.interceptConsole(),this.createUI()}static init(){return k.instance||(k.instance=new k),k.instance}static destroy(){k.instance&&(k.instance.cleanup(),k.instance=null)}interceptConsole(){["log","error","warn","debug","info"].forEach(n=>{const e=this.originalConsole[n];console[n]=(...t)=>{e.apply(console,t),this.addLog(n,t)}})}addLog(n,e){const t=(new Date).toTimeString().split(" ")[0],i=e.map(n=>{if("object"==typeof n)try{return JSON.stringify(n,null,2)}catch{return"[Object]"}return String(n)}).join(" "),o={log:"#abb2bf",error:"#e06c75",warn:"#e5c07b",info:"#61afef",debug:"#5c6370"},r=`\n <div style="margin: 3px 0; font-family: 'SF Mono', Menlo, Monaco, monospace; font-size: 11px; color: ${o[n]||"#abb2bf"}; line-height: 1.5;">\n <span style="color: #5c6370; font-size: 10px;">${t}</span>\n <span style="background: ${{log:"#3c3c3c",error:"rgba(224, 108, 117, 0.2)",warn:"rgba(229, 192, 123, 0.2)",info:"rgba(97, 175, 239, 0.2)",debug:"#2d2d2d"}[n]}; color: ${o[n]}; padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 500; text-transform: uppercase; margin: 0 6px;">${n}</span>\n <span style="white-space: pre-wrap; word-break: break-all;">${this.escapeHtml(i)}</span>\n </div>\n `;this.logs.push(r),this.logs.length>500&&this.logs.shift(),this.updateDisplay()}updateDisplay(){this.logsContainer&&this.isVisible&&(this.isAtBottom=this.logsContainer.scrollHeight-this.logsContainer.scrollTop<=this.logsContainer.clientHeight+50,this.logsContainer.innerHTML=this.logs.join(""),this.isAtBottom&&(this.logsContainer.scrollTop=this.logsContainer.scrollHeight))}createUI(){const n=document.createElement("style");n.textContent="\n #mobile-debug-console {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n height: 45vh;\n background: #1e1e1e;\n z-index: 999999;\n display: flex;\n flex-direction: column;\n font-family: 'SF Mono', Menlo, Monaco, 'Courier New', monospace;\n transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);\n border-top: 1px solid #3c3c3c;\n box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);\n }\n \n #mobile-debug-console.hidden {\n transform: translateY(100%);\n }\n \n #debug-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 12px;\n background: #2d2d2d;\n border-bottom: 1px solid #3c3c3c;\n min-height: 36px;\n }\n \n #debug-title {\n display: flex;\n align-items: center;\n gap: 8px;\n color: #9da5b4;\n font-size: 12px;\n font-weight: 500;\n letter-spacing: 0.3px;\n }\n \n #debug-title svg {\n width: 14px;\n height: 14px;\n opacity: 0.8;\n }\n \n /* Traffic light buttons - using ID for specificity */\n #mobile-debug-console .debug-traffic-lights {\n display: flex;\n gap: 8px;\n align-items: center;\n }\n \n #mobile-debug-console button.debug-traffic-btn {\n width: 16px;\n height: 16px;\n min-width: 16px;\n min-height: 16px;\n border-radius: 50%;\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n font-size: 0;\n line-height: 1;\n }\n \n #mobile-debug-console .debug-traffic-btn svg {\n width: 8px;\n height: 8px;\n }\n \n #mobile-debug-console .debug-traffic-btn.close {\n background: #ff5f57;\n }\n \n #mobile-debug-console .debug-traffic-btn.close svg {\n stroke: #820005;\n stroke-width: 2;\n }\n \n #mobile-debug-console .debug-traffic-btn.clear {\n background: #febc2e;\n }\n \n #mobile-debug-console .debug-traffic-btn.minimize {\n background: #28c840;\n }\n \n #mobile-debug-console .debug-traffic-btn.minimize svg {\n stroke: #006500;\n stroke-width: 2;\n }\n \n #mobile-debug-console .debug-traffic-btn:active {\n filter: brightness(0.85);\n }\n \n #debug-logs {\n flex: 1;\n overflow-y: auto;\n padding: 12px;\n background: #1e1e1e;\n -webkit-overflow-scrolling: touch;\n }\n \n button#debug-floating-toggle {\n position: fixed !important;\n bottom: 20px !important;\n right: 20px !important;\n width: 42px !important;\n height: 42px !important;\n min-width: 42px !important;\n min-height: 42px !important;\n border-radius: 8px !important;\n background: #2d2d2d !important;\n border: 1px solid #3c3c3c !important;\n color: #9da5b4 !important;\n cursor: pointer !important;\n z-index: 999998 !important;\n display: none;\n align-items: center !important;\n justify-content: center !important;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;\n transition: all 0.2s ease !important;\n padding: 0 !important;\n margin: 0 !important;\n }\n \n button#debug-floating-toggle:hover {\n background: #3c3c3c !important;\n color: #fff !important;\n transform: translateY(-2px) !important;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;\n }\n \n button#debug-floating-toggle:active {\n transform: translateY(0) !important;\n }\n \n button#debug-floating-toggle.visible {\n display: flex !important;\n }\n \n button#debug-floating-toggle svg {\n width: 20px !important;\n height: 20px !important;\n }\n ",document.head.appendChild(n);const e='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>';this.container=document.createElement("div"),this.container.id="mobile-debug-console",this.isVisible||(this.container.className="hidden");const t=document.createElement("div");t.id="debug-header";const i=document.createElement("div");i.id="debug-title",i.innerHTML=`${e}<span>Mobile Console</span>`;const o=document.createElement("div");o.className="debug-traffic-lights";const r=document.createElement("button");r.className="debug-traffic-btn close",r.title="Close",r.innerHTML='<svg viewBox="0 0 10 10" fill="none"><line x1="2.5" y1="2.5" x2="7.5" y2="7.5" stroke="currentColor"/><line x1="7.5" y1="2.5" x2="2.5" y2="7.5" stroke="currentColor"/></svg>',r.onclick=()=>this.cleanup();const a=document.createElement("button");a.className="debug-traffic-btn clear",a.title="Clear",a.innerHTML='<svg viewBox="0 0 16 16" fill="currentColor"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/><path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/></svg>',a.onclick=()=>this.clear();const s=document.createElement("button");s.className="debug-traffic-btn minimize",s.title="Minimize",s.innerHTML='<svg viewBox="0 0 10 10" fill="none"><path d="M2 3L5 6L8 3" stroke="currentColor" fill="none"/></svg>',s.onclick=()=>this.toggle(),o.appendChild(r),o.appendChild(a),o.appendChild(s),t.appendChild(o),t.appendChild(i),this.logsContainer=document.createElement("div"),this.logsContainer.id="debug-logs",this.logsContainer.addEventListener("scroll",()=>{this.isAtBottom=this.logsContainer.scrollHeight-this.logsContainer.scrollTop<=this.logsContainer.clientHeight+50}),this.container.appendChild(t),this.container.appendChild(this.logsContainer),document.body.appendChild(this.container),this.floatingToggle=document.createElement("button"),this.floatingToggle.id="debug-floating-toggle",this.floatingToggle.innerHTML=e,this.floatingToggle.title="Show Console",this.floatingToggle.onclick=()=>this.toggle(),document.body.appendChild(this.floatingToggle)}escapeHtml(n){const e=document.createElement("div");return e.textContent=n,e.innerHTML}toggle(){this.isVisible=!this.isVisible,this.container&&this.floatingToggle&&(this.isVisible?(this.container.classList.remove("hidden"),this.floatingToggle.classList.remove("visible"),this.updateDisplay()):(this.container.classList.add("hidden"),this.floatingToggle.classList.add("visible")))}clear(){this.logs=[],this.logsContainer&&(this.logsContainer.innerHTML="")}cleanup(){Object.keys(this.originalConsole).forEach(n=>{console[n]=this.originalConsole[n]}),this.container&&this.container.remove(),this.floatingToggle&&this.floatingToggle.remove()}}k.instance=null;class E{constructor(n={}){this.config={...n,endpoints:{prepare:n.endpoints?.prepare||"/api/magic-auth/prepare",process:n.endpoints?.process||"/api/magic-auth/process",polling:n.endpoints?.polling},timeout:n.timeout||3e4,pollingInterval:n.pollingInterval||2e3,maxPollingAttempts:n.maxPollingAttempts||30,debug:n.debug||!1},this.http=n.httpClient||function(n={}){const{timeout:e=3e4,headers:t={},dynamicHeaders:i}=n;async function o(n,e){const o={"Content-Type":"application/json"};t.common&&Object.assign(o,t.common);const r=t[n.endpoint];if(r&&"object"==typeof r&&Object.assign(o,r),i){const e=await i(n);Object.assign(o,e)}return e&&Object.assign(o,e),o}async function r(n,e,t,i){const o=new AbortController,r=setTimeout(()=>o.abort(),t),a=i?()=>o.abort():null;i&&a&&i.addEventListener("abort",a);try{return await fetch(n,{...e,signal:o.signal})}catch(n){if(n instanceof Error&&"AbortError"===n.name){if(i?.aborted)throw h(s.CANCELLED,"Request was cancelled");throw h(s.TIMEOUT,"Request timed out")}throw h(s.NETWORK_ERROR,n instanceof Error?n.message:"Network request failed")}finally{clearTimeout(r),i&&a&&i.removeEventListener("abort",a)}}async function a(n){let e;try{e=await n.json()}catch{if(!n.ok)throw h(s.INVALID_RESPONSE,`Request failed with status ${n.status}`);throw h(s.INVALID_RESPONSE,"Failed to parse response")}if(!n.ok)throw function(n){if(n&&("code"in n||"error"in n)){const e=n,t=e.code||e.error,i=e.message,o=new Error(i||"An error occurred");return o.code=t,o.status=e.status,o.requestId=e.requestId||e.request_id,o.timestamp=e.timestamp,o.details=e.details,o.traceId=e.trace_id||e.traceId,o.spanId=e.span_id||e.spanId,o.service=e.service,e.details&&"object"==typeof e.details&&"retryAfter"in e.details&&(o.retryAfter=e.details.retryAfter),o}if(n&&"status"in n){const e=n,t=e.status,i=new Error(e.message||`Request failed with status ${t}`);return i.code=`HTTP_${t}`,i.status=t,i}const e=new Error("An unexpected error occurred");return e.code="UNKNOWN_ERROR",e}({...e,status:n.status});return e}function l(n){return n.includes("/prepare")?"prepare":n.includes("/process")||n.includes("/get-phone")||n.includes("/verify-phone")?"process":n.includes("/status")?"polling":"prepare"}return{async post(n,t,i){const s=l(n),d=await o({endpoint:s,method:"POST"},i?.headers);return a(await r(n,{method:"POST",headers:d,body:JSON.stringify(t)},i?.timeout||e,i?.signal))},async get(n,t){const i=l(n),s=await o({endpoint:i,method:"GET"},t?.headers);return delete s["Content-Type"],a(await r(n,{method:"GET",headers:s},t?.timeout||e,t?.signal))}}}({timeout:this.config.timeout,headers:n.headers,dynamicHeaders:n.dynamicHeaders}),this.logger=n.logger||(this.config.debug?function(n={}){const{debug:e=!1,prefix:t="[PhoneAuth]"}=n;function i(n,e){const i=`${t} ${n}`;return void 0!==e?[i,y(e)]:[i]}return{debug(n,t){if(e){const e=i(n,t);console.debug(...e)}},info(n,e){const t=i(n,e);console.info(...t)},warn(n,e){const t=i(n,e);console.warn(...t)},error(n,e){const t=i(n,e);console.error(...t)}}}({debug:!0}):{debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}}),this.logger.debug("PhoneAuthClient initialized",{endpoints:this.config.endpoints,timeout:this.config.timeout}),n.devtools?.showMobileConsole&&"undefined"!=typeof window&&(k.init(),this.logger.info("Mobile debug console enabled"))}async authenticate(n,e){const i=await this.prepare(n),o=await this.invokeSecurePrompt(i,e),r=await o.credential,a=i.session.use_case||i.session.metadata?.use_case||n.use_case;if(!a)throw h(s.INVALID_RESPONSE,"Could not determine use_case from session or request");return a===t.VERIFY_PHONE_NUMBER?this.verifyPhoneNumber(r,i.session):this.getPhoneNumber(r,i.session)}async prepare(n){if(this.logger.debug("Preparing authentication",{use_case:n.use_case}),n.phone_number){const e=r(n.phone_number);if(!e.valid)throw h(s.INVALID_PHONE_NUMBER,e.error)}if(n.plmn){const e=a(n.plmn);if(!e.valid)throw h(s.INVALID_PLMN,e.error)}if(!n.use_case&&!n.options?.parent_session_id)throw h(s.MISSING_PARAMETERS,"use_case is required");const e={...n,id:n.id||this.generateRequestId(),client_info:n.client_info||{user_agent:navigator.userAgent,platform:navigator.platform}};try{const n=await this.http.post(this.config.endpoints.prepare,e);return this.logger.debug("Prepare successful",{strategy:n.authentication_strategy,sessionKey:n.session.session_key}),n}catch(n){throw this.logger.error("Prepare failed",n),n}}async invokeSecurePrompt(n,e){const{authentication_strategy:t,session:o,data:r}=n;switch(this.logger.debug("Invoking secure prompt",{strategy:t}),t){case i.TS43:return this.handleTS43(r,o);case i.LINK:return this.handleLink(r,o,e);case i.DESKTOP:return this.handleDesktop(r,o,e);default:throw h(s.UNSUPPORTED_STRATEGY,`Unknown strategy: ${t}`)}}async getPhoneNumber(n,e){this.logger.debug("Getting phone number");const i={session:e,credential:n,use_case:t.GET_PHONE_NUMBER};try{const n=await this.http.post(this.config.endpoints.process,i);return this.logger.info("Phone number retrieved"),n}catch(n){throw this.logger.error("Get phone number failed",n),n}}async verifyPhoneNumber(n,e){this.logger.debug("Verifying phone number");const i={session:e,credential:n,use_case:t.VERIFY_PHONE_NUMBER};try{const n=await this.http.post(this.config.endpoints.process,i);return this.logger.info("Phone number verified",{verified:n.verified}),n}catch(n){throw this.logger.error("Verify phone number failed",n),n}}isSupported(){return"undefined"!=typeof window&&"DigitalCredential"in window}getBrowserSupportInfo(){if("undefined"==typeof window)return{supported:!1,browser:"unknown",message:"Not in browser"};const n=navigator.userAgent,e=/Chrome/.test(n)&&/Google Inc/.test(navigator.vendor),t=/Edg\//.test(n);return this.isSupported()?{supported:!0,browser:e?"Chrome":t?"Edge":"Other"}:{supported:!1,browser:e?"Chrome":t?"Edge":"Other",message:"Enable chrome://flags/#web-identity-digital-credentials"}}async handleTS43(n,e){if(!this.isSupported())throw h(s.BROWSER_NOT_SUPPORTED,"Digital Credentials API not available");const t={digital:{requests:[{protocol:n.protocol,data:n.data}]}};return this.logger.debug("Invoking Digital Credentials API"),{credential:(async()=>{try{const n=await navigator.credentials.get(t);if(!n?.data?.vp_token)throw h(s.INVALID_RESPONSE,"No credential returned from Digital Credentials API");const e=n.data.vp_token,i="string"==typeof e?e:Object.values(e)[0],o=Array.isArray(i)?i[0]:i;if(!o||"string"==typeof o&&""===o.trim())throw h(s.INVALID_RESPONSE,"Empty credential returned from Digital Credentials API");return o}catch(n){if(d(n))throw n;const e=n;if("NotAllowedError"===e.name||"NetworkError"===e.name&&19===e.code)throw h(s.USER_CANCELLED,"User cancelled authentication");if("NotSupportedError"===e.name)throw h(s.BROWSER_NOT_SUPPORTED,"Browser not supported");throw h(s.NETWORK_ERROR,e.message||"Credential request failed")}})(),cancel:void 0,strategy:i.TS43,session:e}}handleLink(n,e,t){if(!n.url)throw h(s.INVALID_RESPONSE,"Missing link URL");this.logger.debug("Opening App Clip",{url:n.url}),window.location.href=n.url;const o=v({sessionKey:e.session_key,interval:t?.pollingInterval||this.config.pollingInterval,maxAttempts:t?.maxPollingAttempts||this.config.maxPollingAttempts,pollingEndpoint:t?.pollingEndpoint||this.config.endpoints.polling,statusUrl:n.status_url,logger:this.logger});return{credential:o.start().then(n=>{if("completed"===n.status&&n.credential)return n.credential;throw h(s.VERIFICATION_FAILED,n.message||"Link authentication failed")}),cancel:()=>o.cancel(),strategy:i.LINK,session:e}}handleDesktop(n,e,t){const o=n.data?.session_id||e.session_key;this.logger.debug("Starting desktop authentication",{sessionId:o});const r=v({sessionKey:o,interval:t?.pollingInterval||this.config.pollingInterval,maxAttempts:t?.maxPollingAttempts||this.config.maxPollingAttempts,pollingEndpoint:t?.pollingEndpoint||this.config.endpoints.polling,statusUrl:n.data?.status_url,logger:this.logger});let a=null;if(!t?.preventDefaultUI)try{const e=w(n);a=new x(t?.modalOptions),a.showQRCode(e,t?.modalOptions?.description||"Scan with your phone camera"),a.setCloseCallback(()=>{this.logger.debug("Modal closed by user, cancelling authentication"),r.cancel()}),this.logger.debug("Desktop modal displayed")}catch(n){this.logger.warn("Failed to show modal, continuing with polling only",n)}return{credential:r.start().then(n=>{if(a&&a.close(),"completed"===n.status&&n.credential)return n.credential;throw h(s.VERIFICATION_FAILED,n.message||"Desktop authentication failed")}).catch(n=>{throw a&&a.close(),n}),cancel:()=>{r.cancel(),a&&a.close()},strategy:i.DESKTOP,session:e}}generateRequestId(){return`web-${Date.now()}-${Math.random().toString(36).substring(2,11)}`}}function C(n){return null!==n&&"object"==typeof n&&"credential"in n&&"strategy"in n&&"session"in n}function S(n){return null!==n&&"object"==typeof n&&"credential"in n&&"authenticated"in n&&"session"in n}function A(n){return n.strategy===i.TS43}function R(n){return n.strategy===i.LINK}function I(n){return n.strategy===i.DESKTOP}function _(n){return void 0!==n.cancel}function N(n){return null!==n&&"object"==typeof n&&"protocol"in n&&"data"in n&&"object"==typeof n.data&&"dcql_query"in n.data}function O(n){return null!==n&&"object"==typeof n&&"url"in n&&"string"==typeof n.url}function T(n){return null!==n&&"object"==typeof n&&"data"in n&&"object"==typeof n.data}function P(n){return!("verified"in n)}function L(n){return"verified"in n}function D(n){return null!==n&&"object"==typeof n&&"code"in n&&"message"in n}return e})());
|
|
@@ -179,7 +179,7 @@ class PhoneAuthClient {
|
|
|
179
179
|
this.logger.debug('Getting phone number');
|
|
180
180
|
const requestBody = {
|
|
181
181
|
session,
|
|
182
|
-
credential
|
|
182
|
+
credential,
|
|
183
183
|
use_case: core_1.USE_CASE.GET_PHONE_NUMBER,
|
|
184
184
|
};
|
|
185
185
|
try {
|
|
@@ -199,7 +199,7 @@ class PhoneAuthClient {
|
|
|
199
199
|
this.logger.debug('Verifying phone number');
|
|
200
200
|
const requestBody = {
|
|
201
201
|
session,
|
|
202
|
-
credential
|
|
202
|
+
credential,
|
|
203
203
|
use_case: core_1.USE_CASE.VERIFY_PHONE_NUMBER,
|
|
204
204
|
};
|
|
205
205
|
try {
|
|
@@ -267,7 +267,7 @@ class PhoneAuthClient {
|
|
|
267
267
|
},
|
|
268
268
|
};
|
|
269
269
|
this.logger.debug('Invoking Digital Credentials API');
|
|
270
|
-
// Create credential promise
|
|
270
|
+
// Create credential promise - resolves to just the credential string
|
|
271
271
|
const credentialPromise = (async () => {
|
|
272
272
|
try {
|
|
273
273
|
const response = await navigator.credentials.get(credentialRequest);
|
|
@@ -287,11 +287,8 @@ class PhoneAuthClient {
|
|
|
287
287
|
if (!credential || (typeof credential === 'string' && credential.trim() === '')) {
|
|
288
288
|
throw (0, errors_1.createAuthError)(errors_1.ERROR_CODES.INVALID_RESPONSE, 'Empty credential returned from Digital Credentials API');
|
|
289
289
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
session,
|
|
293
|
-
authenticated: true,
|
|
294
|
-
};
|
|
290
|
+
// Return just the credential string
|
|
291
|
+
return credential;
|
|
295
292
|
}
|
|
296
293
|
catch (error) {
|
|
297
294
|
// If it's already an AuthError, rethrow it directly
|
|
@@ -339,14 +336,10 @@ class PhoneAuthClient {
|
|
|
339
336
|
statusUrl: data.status_url,
|
|
340
337
|
logger: this.logger,
|
|
341
338
|
});
|
|
342
|
-
// Create credential promise from polling
|
|
339
|
+
// Create credential promise from polling - resolves to just the credential string
|
|
343
340
|
const credentialPromise = polling.start().then(result => {
|
|
344
341
|
if (result.status === 'completed' && result.credential) {
|
|
345
|
-
return
|
|
346
|
-
credential: result.credential,
|
|
347
|
-
session: result.session || session,
|
|
348
|
-
authenticated: true,
|
|
349
|
-
};
|
|
342
|
+
return result.credential;
|
|
350
343
|
}
|
|
351
344
|
throw (0, errors_1.createAuthError)(errors_1.ERROR_CODES.VERIFICATION_FAILED, result.message || 'Link authentication failed');
|
|
352
345
|
});
|
|
@@ -393,18 +386,14 @@ class PhoneAuthClient {
|
|
|
393
386
|
this.logger.warn('Failed to show modal, continuing with polling only', e);
|
|
394
387
|
}
|
|
395
388
|
}
|
|
396
|
-
// Create credential promise from polling
|
|
389
|
+
// Create credential promise from polling - resolves to just the credential string
|
|
397
390
|
const credentialPromise = polling.start().then(result => {
|
|
398
391
|
// Close modal on success
|
|
399
392
|
if (modal) {
|
|
400
393
|
modal.close();
|
|
401
394
|
}
|
|
402
395
|
if (result.status === 'completed' && result.credential) {
|
|
403
|
-
return
|
|
404
|
-
credential: result.credential,
|
|
405
|
-
session: result.session || session,
|
|
406
|
-
authenticated: true,
|
|
407
|
-
};
|
|
396
|
+
return result.credential;
|
|
408
397
|
}
|
|
409
398
|
throw (0, errors_1.createAuthError)(errors_1.ERROR_CODES.VERIFICATION_FAILED, result.message || 'Desktop authentication failed');
|
|
410
399
|
}).catch(error => {
|
|
@@ -176,7 +176,7 @@ export class PhoneAuthClient {
|
|
|
176
176
|
this.logger.debug('Getting phone number');
|
|
177
177
|
const requestBody = {
|
|
178
178
|
session,
|
|
179
|
-
credential
|
|
179
|
+
credential,
|
|
180
180
|
use_case: USE_CASE.GET_PHONE_NUMBER,
|
|
181
181
|
};
|
|
182
182
|
try {
|
|
@@ -196,7 +196,7 @@ export class PhoneAuthClient {
|
|
|
196
196
|
this.logger.debug('Verifying phone number');
|
|
197
197
|
const requestBody = {
|
|
198
198
|
session,
|
|
199
|
-
credential
|
|
199
|
+
credential,
|
|
200
200
|
use_case: USE_CASE.VERIFY_PHONE_NUMBER,
|
|
201
201
|
};
|
|
202
202
|
try {
|
|
@@ -264,7 +264,7 @@ export class PhoneAuthClient {
|
|
|
264
264
|
},
|
|
265
265
|
};
|
|
266
266
|
this.logger.debug('Invoking Digital Credentials API');
|
|
267
|
-
// Create credential promise
|
|
267
|
+
// Create credential promise - resolves to just the credential string
|
|
268
268
|
const credentialPromise = (async () => {
|
|
269
269
|
try {
|
|
270
270
|
const response = await navigator.credentials.get(credentialRequest);
|
|
@@ -284,11 +284,8 @@ export class PhoneAuthClient {
|
|
|
284
284
|
if (!credential || (typeof credential === 'string' && credential.trim() === '')) {
|
|
285
285
|
throw createAuthError(ERROR_CODES.INVALID_RESPONSE, 'Empty credential returned from Digital Credentials API');
|
|
286
286
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
session,
|
|
290
|
-
authenticated: true,
|
|
291
|
-
};
|
|
287
|
+
// Return just the credential string
|
|
288
|
+
return credential;
|
|
292
289
|
}
|
|
293
290
|
catch (error) {
|
|
294
291
|
// If it's already an AuthError, rethrow it directly
|
|
@@ -336,14 +333,10 @@ export class PhoneAuthClient {
|
|
|
336
333
|
statusUrl: data.status_url,
|
|
337
334
|
logger: this.logger,
|
|
338
335
|
});
|
|
339
|
-
// Create credential promise from polling
|
|
336
|
+
// Create credential promise from polling - resolves to just the credential string
|
|
340
337
|
const credentialPromise = polling.start().then(result => {
|
|
341
338
|
if (result.status === 'completed' && result.credential) {
|
|
342
|
-
return
|
|
343
|
-
credential: result.credential,
|
|
344
|
-
session: result.session || session,
|
|
345
|
-
authenticated: true,
|
|
346
|
-
};
|
|
339
|
+
return result.credential;
|
|
347
340
|
}
|
|
348
341
|
throw createAuthError(ERROR_CODES.VERIFICATION_FAILED, result.message || 'Link authentication failed');
|
|
349
342
|
});
|
|
@@ -390,18 +383,14 @@ export class PhoneAuthClient {
|
|
|
390
383
|
this.logger.warn('Failed to show modal, continuing with polling only', e);
|
|
391
384
|
}
|
|
392
385
|
}
|
|
393
|
-
// Create credential promise from polling
|
|
386
|
+
// Create credential promise from polling - resolves to just the credential string
|
|
394
387
|
const credentialPromise = polling.start().then(result => {
|
|
395
388
|
// Close modal on success
|
|
396
389
|
if (modal) {
|
|
397
390
|
modal.close();
|
|
398
391
|
}
|
|
399
392
|
if (result.status === 'completed' && result.credential) {
|
|
400
|
-
return
|
|
401
|
-
credential: result.credential,
|
|
402
|
-
session: result.session || session,
|
|
403
|
-
authenticated: true,
|
|
404
|
-
};
|
|
393
|
+
return result.credential;
|
|
405
394
|
}
|
|
406
395
|
throw createAuthError(ERROR_CODES.VERIFICATION_FAILED, result.message || 'Desktop authentication failed');
|
|
407
396
|
}).catch(error => {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
import { PhoneAuthClient } from '../client/phone-auth-client';
|
|
34
|
-
import type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, PhoneAuthResult, AuthError,
|
|
34
|
+
import type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, PhoneAuthResult, AuthError, SessionInfo } from '../core/types';
|
|
35
35
|
export { PhoneAuthClient } from '../client/phone-auth-client';
|
|
36
36
|
export { USE_CASE, AUTHENTICATION_STRATEGY } from '../core/types';
|
|
37
37
|
export { ERROR_CODES, isAuthError, createAuthError } from '../core/errors';
|
|
@@ -55,9 +55,9 @@ export interface UsePhoneAuthReturn {
|
|
|
55
55
|
/** Granular: Invoke secure prompt */
|
|
56
56
|
invokeSecurePrompt: (prepared: PrepareResponse, options?: InvokeOptions) => Promise<InvokeResult>;
|
|
57
57
|
/** Granular: Get phone number from credential */
|
|
58
|
-
getPhoneNumber: (credential:
|
|
58
|
+
getPhoneNumber: (credential: string, session: SessionInfo) => Promise<PhoneAuthResult>;
|
|
59
59
|
/** Granular: Verify phone number with credential */
|
|
60
|
-
verifyPhoneNumber: (credential:
|
|
60
|
+
verifyPhoneNumber: (credential: string, session: SessionInfo) => Promise<PhoneAuthResult>;
|
|
61
61
|
/** Reset state */
|
|
62
62
|
reset: () => void;
|
|
63
63
|
/** Direct access to client for advanced use */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/adapters/react.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/adapters/react.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EAET,WAAW,EACZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAA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AC,eAAe,CAAC,CAAC;IAE1F,kBAAkB;IAClB,KAAK,EAAE,MAAM,IAAI,CAAC;IAElB,+CAA+C;IAC/C,MAAM,EAAE,eAAe,CAAC;CACzB;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,kBAAkB,CA0JpE"}
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
import { PhoneAuthClient } from '../client/phone-auth-client';
|
|
34
|
-
import type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, PhoneAuthResult, AuthError,
|
|
34
|
+
import type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, PhoneAuthResult, AuthError, SessionInfo } from '../core/types';
|
|
35
35
|
export { PhoneAuthClient } from '../client/phone-auth-client';
|
|
36
36
|
export { USE_CASE, AUTHENTICATION_STRATEGY } from '../core/types';
|
|
37
37
|
export { ERROR_CODES, isAuthError, createAuthError } from '../core/errors';
|
|
38
|
-
export type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, PhoneAuthResult, AuthError, AuthCredential, SessionInfo, UseCase, AuthenticationStrategy, } from '../core/types';
|
|
38
|
+
export type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, PhoneAuthResult, GetPhoneNumberResponse, VerifyPhoneNumberResponse, AuthError, AuthCredential, SessionInfo, UseCase, AuthenticationStrategy, } from '../core/types';
|
|
39
39
|
export type AuthStep = 'idle' | 'preparing' | 'invoking' | 'processing' | 'complete' | 'error';
|
|
40
40
|
/**
|
|
41
41
|
* Vue composable for phone authentication.
|
|
@@ -63,8 +63,8 @@ export declare function usePhoneAuth(config?: AuthConfig): {
|
|
|
63
63
|
authenticate: (request: PrepareRequest, options?: InvokeOptions) => Promise<PhoneAuthResult>;
|
|
64
64
|
prepare: (request: PrepareRequest) => Promise<PrepareResponse>;
|
|
65
65
|
invokeSecurePrompt: (prepared: PrepareResponse, options?: InvokeOptions) => Promise<InvokeResult>;
|
|
66
|
-
getPhoneNumber: (credential:
|
|
67
|
-
verifyPhoneNumber: (credential:
|
|
66
|
+
getPhoneNumber: (credential: string, session: SessionInfo) => Promise<PhoneAuthResult>;
|
|
67
|
+
verifyPhoneNumber: (credential: string, session: SessionInfo) => Promise<PhoneAuthResult>;
|
|
68
68
|
reset: () => void;
|
|
69
69
|
client: PhoneAuthClient;
|
|
70
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../../src/adapters/vue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,
|
|
1
|
+
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../../src/adapters/vue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EAET,WAAW,EACZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3E,YAAY,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,SAAS,EACT,cAAc,EACd,WAAW,EACX,OAAO,EACP,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAMvB,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;AAM/F;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;4BAiBnC,cAAc,YACb,aAAa,KACtB,OAAO,CAAC,eAAe,CAAC;uBAsBK,cAAc,KAAG,OAAO,CAAC,eAAe,CAAC;mCAsB7D,eAAe,YACf,aAAa,KACtB,OAAO,CAAC,YAAY,CAAC;iCAgBV,MAAM,WACT,WAAW,KACnB,OAAO,CAAC,eAAe,CAAC;oCAsBb,MAAM,WACT,WAAW,KACnB,OAAO,CAAC,eAAe,CAAC;;;EA0C5B"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* because both iOS App Clips and Android Digital Credentials API require
|
|
9
9
|
* transient activation (user interaction) to open system UI.
|
|
10
10
|
*/
|
|
11
|
-
import type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult,
|
|
11
|
+
import type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, SessionInfo, GetPhoneNumberResponse, VerifyPhoneNumberResponse, PhoneAuthResult } from '../core/types';
|
|
12
12
|
export declare class PhoneAuthClient {
|
|
13
13
|
private config;
|
|
14
14
|
private http;
|
|
@@ -53,11 +53,11 @@ export declare class PhoneAuthClient {
|
|
|
53
53
|
/**
|
|
54
54
|
* Step 3A: Get phone number from credential.
|
|
55
55
|
*/
|
|
56
|
-
getPhoneNumber(credential:
|
|
56
|
+
getPhoneNumber(credential: string, session: SessionInfo): Promise<GetPhoneNumberResponse>;
|
|
57
57
|
/**
|
|
58
58
|
* Step 3B: Verify phone number with credential.
|
|
59
59
|
*/
|
|
60
|
-
verifyPhoneNumber(credential:
|
|
60
|
+
verifyPhoneNumber(credential: string, session: SessionInfo): Promise<VerifyPhoneNumberResponse>;
|
|
61
61
|
/**
|
|
62
62
|
* Check if Digital Credentials API is supported.
|
|
63
63
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone-auth-client.d.ts","sourceRoot":"","sources":["../../../src/client/phone-auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,
|
|
1
|
+
{"version":3,"file":"phone-auth-client.d.ts","sourceRoot":"","sources":["../../../src/client/phone-auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EAEZ,WAAW,EAEX,sBAAsB,EAEtB,yBAAyB,EACzB,eAAe,EAShB,MAAM,eAAe,CAAC;AAuDvB,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,GAAE,UAAe;IA4CnC;;;;;;;;;;;;;;;;OAgBG;IACG,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC;IAoC9F;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAoDhE;;;;;;;;;;OAUG;IACG,kBAAkB,CACtB,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IAuBxB;;OAEG;IACG,cAAc,CAClB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC;IAuBlC;;OAEG;IACG,iBAAiB,CACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,yBAAyB,CAAC;IA2BrC;;OAEG;IACH,WAAW,IAAI,OAAO;IAKtB;;OAEG;IACH,qBAAqB,IAAI;QACvB,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;IA4BD;;OAEG;YACW,UAAU;IA0FxB;;;OAGG;IACH,OAAO,CAAC,UAAU;IA6ClB;;OAEG;IACH,OAAO,CAAC,aAAa;IAmFrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAG1B"}
|
|
@@ -266,7 +266,8 @@ export interface ModalOptions {
|
|
|
266
266
|
closeOnBackdropClick?: boolean;
|
|
267
267
|
}
|
|
268
268
|
/**
|
|
269
|
-
* Authentication credential result.
|
|
269
|
+
* Authentication credential result (legacy, kept for compatibility).
|
|
270
|
+
* @deprecated Use credential string directly from InvokeResult
|
|
270
271
|
*/
|
|
271
272
|
export interface AuthCredential {
|
|
272
273
|
/** Authentication credential token */
|
|
@@ -287,11 +288,11 @@ export interface AuthCredential {
|
|
|
287
288
|
*/
|
|
288
289
|
export interface InvokeResult {
|
|
289
290
|
/**
|
|
290
|
-
* Promise that resolves to the credential.
|
|
291
|
+
* Promise that resolves to the credential string.
|
|
291
292
|
* For TS43: resolves immediately after user completes system prompt.
|
|
292
293
|
* For Link/Desktop: resolves when polling detects completion.
|
|
293
294
|
*/
|
|
294
|
-
credential: Promise<
|
|
295
|
+
credential: Promise<string>;
|
|
295
296
|
/**
|
|
296
297
|
* Cancel the authentication flow.
|
|
297
298
|
* Causes credential promise to reject with error code 'CANCELLED'.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,+CAA+C;AAC/C,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;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