Files
Obsidian/Edge Wallet/128.18367.18366.1/bnpl_driver.js
T

1 line
11 KiB
JavaScript
Raw Normal View History

2026-11-06 08:29:11 +08:00
!function(){"use strict";class e{constructor(){this.pageRootQuery=void 0,this.cardNumberQuery=void 0,this.cardCVVQuery=void 0,this.cardExpiredTimeQuery=void 0,this.addressFirstNameQuery=void 0,this.addressLastNameQuery=void 0,this.addressAddress1Query=void 0,this.addressAddress2Query=void 0,this.addressCityQuery=void 0,this.addressStateQuery=void 0,this.addressPostalCodeQuery=void 0,this.addressCountryQuery=void 0,this.addressNameQuery=void 0,this.totalAmountQuery=void 0,this.prefillAmount=void 0}static Create(t){const r=new e;return t&&(e.SetValue("pageRootQuery",t,r),e.SetValue("cardNumberQuery",t,r),e.SetValue("cardCVVQuery",t,r),e.SetValue("cardExpiredTimeQuery",t,r),e.SetValue("addressFirstNameQuery",t,r),e.SetValue("addressLastNameQuery",t,r),e.SetValue("addressAddress1Query",t,r),e.SetValue("addressAddress2Query",t,r),e.SetValue("addressCityQuery",t,r),e.SetValue("addressStateQuery",t,r),e.SetValue("addressPostalCodeQuery",t,r),e.SetValue("addressCountryQuery",t,r),e.SetValue("addressNameQuery",t,r),e.SetValue("totalAmountQuery",t,r),e.SetValue("prefillAmount",t,r)),r}static SetValue(e,t,r){t[e]&&(r[e]=t[e])}}var t=e;class r{constructor(){this.loadingTitle=void 0,this.loadingDetail=void 0,this.footerDescription=void 0}static Create(e){const t=new r;return e&&(e.loadingTitle&&(t.loadingTitle=e.loadingTitle),e.loadingDetail&&(t.loadingDetail=e.loadingDetail),e.footerDescription&&(t.footerDescription=e.footerDescription)),t}}var s=r;class i{constructor(){this.isFromWalletECPane=void 0}static Create(e){const t=new i;return e&&e.isFromWalletECPane&&(t.isFromWalletECPane=e.isFromWalletECPane),t}}var a=i;const o="WalletPageParserRuntime",n="edge_loading_element",d="edge_loading_style";function l(e){return!e||0===e.length}function u(e,t){return l(e)===l(t)}function c(e,t=!1){let r=null;return e&&(r=document.querySelector(e)?.textContent||null,t&&!l(r)&&(r=r.replaceAll(" ",""))),{value:r,isValid:u(e,r)}}function p(e){const r=e&&e[0],s=r?JSON.parse(r):{};return t.Create(s)}function m(e){const t=e.replace(/[\s,]/g,""),r=t.startsWith("$")?t.slice(1):t;return parseFloat(r)}window.ExecuteBNPLPageParse=function(e){const t=p(e);window[o].postMessageToHost("LogScriptTelemetry",["PageParserVirtualCardStarted"]);let r=0;const s=setInterval((()=>{const{value:e,isValid:i}=c(t.cardNumberQuery,!0),{value:a,isValid:u}=c(t.cardCVVQuery,!0),{value:p,isValid:w}=c(t.cardExpiredTimeQuery,!0),{value:h,isValid:g}=c(t.addressAddress1Query),{value:C,isValid:y}=c(t.addressAddress2Query),{value:v,isValid:A}=c(t.addressCityQuery),{value:b,isValid:f}=c(t.addressCountryQuery),{value:S,isValid:N}=c(t.addressFirstNameQuery),{value:x,isValid:Q}=c(t.addressLastNameQuery),{value:E,isValid:V}=c(t.addressPostalCodeQuery,!0),{value:P,isValid:_}=c(t.addressStateQuery),{value:T,isValid:D}=c(t.addressNameQuery),{value:F,isValid:L}=function({totalAmountQuery:e}){let{value:t,isValid:r}=c(e);return r||(r=!1,t=[...document.querySelectorAll("p")].map((e=>e.innerHTML)).filter((e=>e.includes("card is for the exclusive use")))?.[0]?.split(">")?.[1]?.split("<")?.[0],l(t)||(r=!0)),{value:t,isValid:r}}({totalAmountQuery:t.totalAmountQuery});let M=!0;if(L){const e=m(t.prefillAmount),r=m(F);if(M=!(!isNaN(e)&&!isNaN(r))||r>=e,!M){clearInterval(s),window[o].postMessageToHost("LogScriptTelemetry",["VirtualCardAmountNotEnough"]);const e=document.querySelector(t.pageRootQuery);e?.removeAttribute("style"),e?.removeAttribute("aria-hidden");const r=document.querySelector(`#${n}`),i=document.querySelector(`#${d}`);return r?.remove(),void i?.remove()}}if(800===r||i&&u&&w&&g&&y&&A&&f&&N&&Q&&V&&_&&D){let t,r;if(clearInterval(s),!l(p)){const[e,s]=p.split("/");t=e?Number(e):null,r=s?Number(s):null}window[o].postMessageToHost("PageParserVirtualCardInfo",[JSON.stringify({card:{number:e,cvc:a,expiredTime:p,expirationMonth:t,expirationYear:r},cardholder:{name:T,firstName:S,lastName:x,address1:h,address2:C,city:v,state:P,postalCode:E,country:b}})])}r++}),200)},window.HideRootPage=function(e){const t=p(e),r=function(e){const t=e&&e[1],r=t?JSON.parse(t):{};return s.Create(r)}(e),i=function(e){c