@deriv-com/custom-scripts 1.26.38 → 1.26.39
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{initializeApp as e}from"https://www.gstatic.com/firebasejs/10.8.1/firebase-app.js";import{getDatabase as t,ref as o,onValue as n}from"https://www.gstatic.com/firebasejs/10.8.1/firebase-database.js";function i(e,t,o,n){let i="";if(o){let e=new Date;e.setTime(e.getTime()+24*o*60*60*1e3),i="; expires="+e.toUTCString()}document.cookie=n?e+"="+(t||"")+i+`;domain=${n};path=/`:e+"="+(t||"")+i+";path=/"}function r(e,t){const o={};return e.split(";").forEach((e=>{const[t,n]=e.split("=").map((e=>e.trim()));o[t]=decodeURIComponent(n)})),o[t]}function c(e){i("webflow-user-language",e,30),i("webflow-user-language",e,30,`.${window.location.hostname}`)}function a(e){document.cookie=e+"=; Max-Age=-99999999;"}const s="green.derivws.com";window.emailRegex=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,window.toggleErrorField=(e,t)=>{t?e.classList.remove("error-field"):e.classList.add("error-field")},window.disableButton=function(e){e.disabled=!0,e.style.opacity="0.5"},window.isEuRegion=function(e){const t=e.replace(/\/$/,"");return/^\/(?:[^\/]+\/)?eu(?:\/|$)/.test(t)},window.enableButton=function(e){e.disabled=!1,e.style.opacity="1"},window.getOauthUrl=function(){var e=window.location.href,t=new URL(e).hostname,o=["deriv.com","deriv.be","deriv.me"].find((e=>t.endsWith(e)));return o?`https://oauth.${o}`:"https://oauth.deriv.com"},window.getClientCountry=function(){var e;const t=r(document.cookie,"test_im_country"),o=r(document.cookie,"clients_country"),n=r(document.cookie,"client_information");return n?(null==(e=JSON.parse(n))?void 0:e.residence)||o:t||o},window.deriv_com_url="deriv.com",window.deriv_me_url="deriv.me",window.deriv_be_url="deriv.be",window.webflow_domain="webflow.deriv.com",window.staging_url="staging.deriv.com",window.staging_deriv_be_url="staging.deriv.be",window.domain_list_app_id={[window.deriv_com_url]:"61554",[window.deriv_me_url]:"1411",[window.deriv_be_url]:"30767",[window.webflow_domain]:"53503",[window.staging_url]:"53503"},window.getDomain=()=>{var e=window.location.href;return new URL(e).hostname},window.getAppId=()=>{const e=window.getDomain(),t=new URLSearchParams(window.location.search||"").get("app_id");if(t)return t;const o=localStorage.getItem("config.app_id");if(o)return o;const n={[window.webflow_domain]:window.domain_list_app_id[window.webflow_domain],[window.deriv_be_url]:window.domain_list_app_id[window.deriv_be_url],[window.deriv_me_url]:window.domain_list_app_id[window.deriv_me_url],[window.staging_url]:window.domain_list_app_id[window.staging_url]};return n[e]?n[e]:window.domain_list_app_id[window.deriv_com_url]};const d=()=>{try{return localStorage.getItem("config.server_url")||s}catch(e){return s}},l=()=>{const e=d(),t=r(document.cookie,"webflow-user-language");let o=window.getAppId(),n=(()=>{const e=window.getDomain();return e===window.deriv_me_url?window.domain_list_app_id[window.deriv_me_url]:e===window.deriv_be_url?window.domain_list_app_id[window.deriv_be_url]:e===window.webflow_domain?window.domain_list_app_id[window.webflow_domain]:window.domain_list_app_id[window.deriv_com_url]})();if("function"==typeof window.useGrowthbookFeatureFlag&&(window.isTHLogin=window.useGrowthbookFeatureFlag({featureFlag:"trigger_login_for_hub"}),"boolean"==typeof window.isTHLogin&&window.isTHLogin)){"staging.deriv.com"===new URL(window.location.href).host?(o=53503,n=53503):(o=61554,n=61554)}let i=t?t.toLowerCase():"en";"zh-cn"!==i&&"zh-tw"!==i||(i=i.replace("-","_"));const c=(e=>{let t="";return e&&Object.keys(e).forEach((o=>{t+=`&${o}=${e[o]}`})),t})((()=>{const e=r(document.cookie,"utm_data");if(e){const t=JSON.parse(e),o={};return["utm_source","utm_ad_id","utm_adgroup_id","utm_adrollclk_id","utm_campaign","utm_campaign_id","utm_content","utm_fbcl_id","utm_gl_client_id","utm_medium","utm_msclk_id","utm_term"].forEach((e=>{t.hasOwnProperty(e)&&(o[e]=t[e])})),o}return null})()),a=r(document.cookie,"affiliate_tracking"),s=a?`&affiliate_token=${a}`:"",l=void["mt5","bot","derivx"].filter((e=>window.location.pathname.includes(e)&&e))||"";return e&&/qa/.test(e)?`https://${e}/oauth2/authorize?app_id=${o}&l=${i}&brand=deriv${s}${c}&platform=${l}`:`${window.getOauthUrl()}/oauth2/authorize?app_id=${n}&l=${i}&brand=deriv${s}${c}&platform=${l}`};window.establishWebSocketConnection=()=>new Promise(((e,t)=>{const o=r(document.cookie,"webflow-user-language"),n=o?o.toLowerCase():"en",i=d();window.websocket=new WebSocket(`wss://${i}/websockets/v3?app_id=${window.getAppId()}&l=${n||"en"}&brand=deriv`),window.websocket.addEventListener("open",(t=>{window.websocket.addEventListener("close",(()=>{window.websocket.close()})),window.websocket.addEventListener("message",(e=>{JSON.parse(e.data)})),e(window.websocket)})),window.websocket.addEventListener("error",(e=>{var o;null==(o=null==window?void 0:window.websocket)||o.close(),t(e)}))})),window.socketMessageSend=async(e,t)=>{var o;try{return(null==window?void 0:window.websocket)&&(null==(o=null==window?void 0:window.websocket)?void 0:o.readyState)===(null==WebSocket?void 0:WebSocket.OPEN)?(window.websocket.send(e),new Promise(((e,o)=>{window.websocket.addEventListener("message",(n=>{const i=JSON.parse(n.data);t===i.msg_type&&(i.error?o(i.error):e(i))}))}))):establishWebSocketConnection().then((()=>(websocket.send(e),new Promise(((e,o)=>{websocket.addEventListener("message",(n=>{const i=JSON.parse(n.data);t===i.msg_type&&(i.error?o(i.error):e(i))}))}))))).catch((e=>Promise.reject(e)))}catch(n){return Promise.reject(n)}};const u=[{id:"googlePlay",selectors:[".footer_banner-badge.google.w-inline-block",".app-download_link-wrapper.google.w-inline-block"],countries:["af","ax","as","ad","ai","aq","au","bb","bt","bv","io","bn","bi","ca","bq","cf","cx","cc","cg","cd","ck","cw","gq","et","fk","fo","gf","pf","tf","gl","gp","gu","gg","gy","hm","va","hk","ir","im","jp","je","ki","kp","ls","ly","mg","mw","mh","mq","mr","yt","fm","mn","me","ms","nr","nc","nz","ng","nu","nf","mp","pw","ps","pn","pr","re","sh","kn","lc","pm","vc","bl","mf","st","sg","sx","gs","ss","sj","sz","sy","tl","tk","tc","tv","um","us","vg","vi","wf","eh"]},{id:"appstore",selectors:[".footer_banner-badge.store.w-inline-block",".app-download_link-wrapper.appstore.w-inline-block"],countries:["ax","al","as","ad","aq","aw","au","at","bd","be","bv","io","bg","bi","ca","bq","cf","cx","cc","km","ck","hr","cu","cw","cy","cz","dk","dj","gq","er","ee","et","fk","fo","fi","fr","gf","pf","tf","de","gi","gr","gl","gp","gu","gg","gn","ht","hm","va","hk","hu","is","ir","iq","ie","im","il","it","je","ki","kp","lv","ls","ly","li","lt","lu","mt","mh","mq","yt","fm","me","nl","nc","nz","ng","nu","nf","mp","no","ps","pn","pl","pt","pr","re","ro","sh","pm","bl","mf","ws","sm","sg","sx","sk","si","so","gs","ss","es","sd","sj","se","ch","sy","tw","tl","tg","tk","tr","tv","gb","um","us","vu","vi","wf","eh"]},{id:"p2p",selectors:["#p2payment.accordion_toggle-block","#p2component.section_dp2p","#card_block_p2p.help_category"],countries:["as","au","at","be","bg","ca","hr","cy","cz","dk","ee","fi","fr","gr","gu","gg","hk","hu","ir","ie","im","il","it","je","ng","mm","sy","kp","lv","lt","lu","mt","nl","nz","mp","py","pl","pt","pr","ro","rw","sk","si","es","se","gb","us","um","vu","vi","ky","cu","de"]},{id:"w-dyn-item-p2p",selectors:["div.w-dyn-item"],countries:["as","au","at","be","bg","ca","hr","cy","cz","dk","ee","fi","fr","gr","gu","gg","hk","hu","ir","ie","im","il","it","je","ng","mm","sy","kp","lv","lt","lu","my","mt","nl","nz","mp","py","pl","pt","pr","ro","rw","sk","si","es","se","ae","gb","us","um","vu","vi","ky","cu","de"]},{id:"hideRow",selectors:["#footer_social-icons_row","#footer_text_row",".footer_risk-warning.w-richtext"],countries:["br","uy","lk","ch","za","ec"]},{id:"hideDiel",selectors:["#footer_text_diel","#footer_social-icons_diel"],countries:["br","uy","lk","ch","za","ec"]}],w=[{id:"showElems",selectors:[".banner_disclaimer"],countries:["br","uy","lk","ch","za","ec"]}],m=()=>{const e=window.getClientCountry();u.forEach((t=>{const o="hideDiel"===t.id?!t.countries.includes(e):t.countries.includes(e);if(e&&o)return t.selectors.forEach((e=>{document.querySelectorAll(e).forEach((e=>{if(e)if("w-dyn-item-p2p"===t.id){e.querySelector("#card_block_p2p.help_category")&&(e.style.display="none")}else e.style.display="none"}))}));if(!o){const e=document.querySelector(".footer_social-icons.diel");e&&(e.style.display="flex")}})),w.forEach((t=>{e&&t.countries.includes(e)?t.selectors.forEach((e=>{document.querySelectorAll(e).forEach((t=>{if(t){const o=document.querySelector(".page-wrapper");".banner_disclaimer"===e?(o.classList.add("disclaimer-show"),t.classList.remove("hide-element")):t.style.display="block"}}))})):t.selectors.forEach((e=>{document.querySelectorAll(e).forEach((t=>{t&&(".banner_disclaimer"===e?t.classList.add("hide-element"):t.style.display="none")}))}))}))};document.addEventListener("DOMContentLoaded",(function(){const e=JSON.stringify({website_status:1});!async function(){try{const e=await fetch("https://deriv.com/cdn-cgi/trace"),t=await e.text(),o=Object.fromEntries(t.split("\n").map((e=>e.split("=",2)))).loc.toLowerCase();o!==r(document.cookie,"clients_country")&&(a("clients_country"),i("clients_country",o,30)),m()}catch(e){m()}}();r(document.cookie,"clients_country")||window.socketMessageSend(e,"website_status").then((e=>{r(document.cookie,"clients_country")!==e.website_status.clients_country&&(a("clients_country"),i("clients_country",e.website_status.clients_country,30)),m()})).catch((e=>{}))}));const h=["ar","bn","de","en","es","fr","it","ko","pl","pt","ru","si","sw","tr","vi","zh_cn","zh_tw","zh-cn","zh-tw"];function p(){let e,t=!1,o=!1;const n=()=>{o=!0,t=!!r(document.cookie,"client_information"),t&&clearInterval(e),document.dispatchEvent(new Event("authStatusChange"))};return n(),e=setInterval(n,800),{getLoggedInStatus:()=>t,getAuthCheckedStatus:()=>o,onAuthStatusChange:e=>document.addEventListener("authStatusChange",e)}}document.addEventListener("DOMContentLoaded",(function(){(()=>{var e;const t=window.location.pathname,o=window.location.hash,n=window.location.search,i=t.split("/"),a=i[1],s=h.includes(a||""),d=i.includes("careers")||i.includes("locations")||i.includes("derivtech")||i.includes("derivlife")||i.includes("trading-terms-glossary")||i.includes("product-explorer")||i.includes("eu-careers")||i.includes("our-locations")||i.includes("academy")||i.includes("trading-specifications");s&&c(a);const l=(null==(e=r(document.cookie,"webflow-user-language"))?void 0:e.toLowerCase())||"en",u=s?a:l;if((s||"en"!==l)&&a!==l)if(s&&a!==l)c(u);else if(!d){const e=(s?i.map((e=>e===a?u:e)).join("/"):u+i.join("/"))+n+o;window.location.href="/"+e}})()})),document.addEventListener("DOMContentLoaded",(()=>{const e=p();e.onAuthStatusChange((()=>{if(e.getAuthCheckedStatus()&&e.getLoggedInStatus()){document.querySelectorAll(".logged-in-btn").forEach((e=>{e.classList.remove("hide-element")}));document.querySelectorAll(".logged-out-btn").forEach((e=>{e.classList.add("hide-element")}))}else if(e.getAuthCheckedStatus()&&!e.getLoggedInStatus()){document.querySelectorAll(".logged-out-btn").forEach((e=>{e.classList.remove("hide-element")}));document.querySelectorAll(".logged-in-btn").forEach((e=>{e.classList.add("hide-element")}))}}))}));const g=document.querySelector(".banner_disclaimer"),f=document.querySelector(".main-wrapper");if(g){new ResizeObserver((e=>{for(let t of e)if(t.target===g){let e=t.target.getBoundingClientRect();f&&(f.style.paddingTop=e.height+"px")}})).observe(g)}window.addEventListener("pageshow",(function(e){if(e.persisted){const e=document.querySelector(".w-nav-overlay");e&&(e.style.display="none",document.querySelector("body").click())}}));const v=t(e({databaseURL:window.location.hostname.includes("staging")?"https://app-config-staging.firebaseio.com":"https://app-config-prod.firebaseio.com"}));let b=!1,_=!1;!function(){var e;const t=document.getElementById("live_chat-wrapper");try{const e=o(v,"remote_config/deriv-com/chat");n(e,(e=>{const o=e.val();b=o.live_chat,_=o.whatsapp_chat;const n=document.querySelector(".whatsapp_chat"),i=document.querySelector(".livechatbtn");n&&(n.style.visibility=_?"visible":"hidden"),i&&(i.style.visibility=b?"visible":"hidden");const r=window.location.pathname.includes("/help-centre");if(window.location.pathname.includes("/deriv-prime")){t.style.flexDirection="column-reverse";document.querySelectorAll(".whatsapp_chat").forEach((e=>{e.style.visibility="hidden"}))}if(r){const e=document.querySelectorAll(".livechatbtn");b?e.forEach((e=>{e.style.visibility="visible"})):e.forEach((e=>{e.style.visibility="hidden"}));const t=document.querySelectorAll(".whatsapp_chat");_?t.forEach((e=>{e.style.visibility="visible"})):t.forEach((e=>{e.style.visibility="hidden"}))}window.addEventListener("scroll",(function(){var e,o;(b||_)&&(null==(e=null==t?void 0:t.classList)||e.remove("hide-element")),b||_||null==(o=null==t?void 0:t.classList)||o.add("hide-element")}))}),(e=>{var o;null==(o=null==t?void 0:t.classList)||o.remove("hide-element")}))}catch(i){null==(e=null==t?void 0:t.classList)||e.remove("hide-element")}}();new MutationObserver((function(e){for(const t of e)if(t.addedNodes.length)for(const e of t.addedNodes)e.nodeType===Node.ELEMENT_NODE&&"chat-widget-minimized"===e.id&&(e.style.opacity="0")})).observe(document.body,{childList:!0,subtree:!0});const y=document.querySelector(".redirection_background-wrapper"),k=document.getElementById("cancel-redirect"),L=document.getElementById("proceed-redirect"),E=window.dataLayer,S=r(document.cookie,"client_information"),q=!!S;if(document.addEventListener("DOMContentLoaded",(()=>{E&&window.dataLayer.push({loggedIn:q,language:r(document.cookie,"webflow-user-language")||"en",...q&&{visitorId:null==S?void 0:S.loginid,currency:null==S?void 0:S.currency,email:null==S?void 0:S.email}})})),window.isEuRegion(window.location.pathname)&&y&&k&&L){const e=["deriv.me","deriv.be","deriv.com","app.deriv.me","app.deriv.be","app.deriv.com","docs.deriv.com","community.deriv.com","deriv.statuspage.io","signup.deriv.com","login.deriv.com","api.deriv.com","hub.deriv.com"];let t="",o="_self";document.querySelectorAll("a").forEach((function(n){const i=new URL(n.href,window.location.href),r=new URL(window.location.href);e.includes(i.host)||i.host===r.host||n.addEventListener("click",(function(e){e.preventDefault(),t=i.href,o=n.target||"_self",y.classList.remove("hide-element"),document.body.style.overflow="hidden"}))})),k.addEventListener("click",(function(){y.classList.add("hide-element"),document.body.style.overflow="auto",t=""})),L.addEventListener("click",(function(){t&&(window.open(t,o),t="",y.classList.add("hide-element"),document.body.style.overflow="auto")}))}document.addEventListener("DOMContentLoaded",(function(){document.querySelector(".banner_disclaimer")?document.body.classList.add("disclaimer-visible"):document.body.classList.remove("disclaimer-visible")}));const $=document.querySelectorAll(".navbar_accordion-item");function A(){const e=document.querySelector(".navbar_accordion-trigger.open");e&&e.scrollIntoView({behavior:"smooth",block:"start"})}$.forEach((e=>{e.querySelector(".navbar_accordion-trigger").classList.remove("open");const t=e.querySelector(".navbar_accordion-content");t.classList.remove("open"),t.style.maxHeight="0px",t.style.overflow="hidden",t.style.transition="max-height 0.3s ease-in, opacity 0.3s ease-in",t.style.opacity="0"})),$.forEach((e=>{const t=e.querySelector(".navbar_accordion-trigger");t.addEventListener("click",(function(){const e=t.classList.contains("open");if($.forEach((e=>{e.querySelector(".navbar_accordion-trigger").classList.remove("open");const t=e.querySelector(".navbar_accordion-content");t.classList.remove("open"),t.style.maxHeight="0px",t.style.opacity="0"})),!e){t.classList.add("open");const e=t.nextElementSibling;e.classList.add("open"),e.style.maxHeight=e.scrollHeight+"px",e.style.opacity="1"}}))}));document.querySelectorAll(".navbar_accordion-trigger").forEach((e=>{e.addEventListener("click",(function(){setTimeout(A,300)}))}));const x=new MutationObserver((e=>{e.forEach((e=>{if("class"===e.attributeName){const t=e.target;t.classList.contains("open")&&t.scrollIntoView({behavior:"smooth",block:"start"})}}))}));document.querySelectorAll(".navbar_accordion-item").forEach((e=>{x.observe(e,{attributes:!0})}));const C=new URL(window.location.href),O=new URLSearchParams(C.search),D=O.get("t");if(O.has("referrer")&&null!=D){r(document.cookie,"referrer_token")!==D&&(a("referrer_token"),i("referrer_token",D,365,".deriv.com"))}const z=document.getElementById("navbar-home_login");z&&z.addEventListener("click",(function(e){e.preventDefault(),window.location.href=l()}));const I=document.getElementById("res-navbar-home_login");I&&I.addEventListener("click",(function(e){e.preventDefault(),window.location.href=l()}));const j=document.getElementById("white-navbar_login");j&&j.addEventListener("click",(function(e){e.preventDefault(),window.location.href=l()}));const M=document.getElementById("res-white-navbar_login");M&&M.addEventListener("click",(function(e){e.preventDefault(),window.location.href=l()})),document.addEventListener("DOMContentLoaded",(function(){let e=document.querySelectorAll(".navbar_accordion-trigger"),t=document.querySelector(".navbar_menu-button");if(document.querySelector(".new-navbar_component")){const e=document.querySelector(".new-navbar_component");e.addEventListener("mouseenter",(()=>{window.innerWidth>991&&document.body.classList.add("disable-scroll")})),e.addEventListener("mouseleave",(()=>{window.innerWidth>991&&document.body.classList.remove("disable-scroll")}))}t&&t.addEventListener("click",(function(){let e=window.innerHeight,t=document.querySelector(".new-navbar_main-wrapper");if(t){let o=e-t.offsetHeight,n=document.querySelector(".new-navbar_menu");n&&(n.style.height=`${o}px`)}})),e.forEach((t=>{t.addEventListener("click",(function(){e.forEach((e=>e.classList.remove("current"))),this.classList.add("current")}))}));let o=document.querySelector(".navbar_accordion-link.w--current");if(o){let e=o.closest(".navbar_accordion-item");if(e){let t=e.querySelector(".navbar_accordion-trigger");t&&t.classList.add("current")}}})),document.addEventListener("DOMContentLoaded",(()=>{var e=window.location.pathname;["/careers","/locations","/derivtech","/derivlife","/eu-careers","/our-locations","/product-explorer","/academy","/trading-terms-glossary"].some((t=>e.includes(t)))&&document.head.querySelectorAll("link").forEach((function(e){e.hasAttribute("hreflang")&&"x-default"!==e.getAttribute("hreflang")&&e.remove()}))})),document.addEventListener("DOMContentLoaded",(function(){let e=document.querySelector(".locale > .new-navbar_dropdown-link.w--current");if(e){let t=e.getAttribute("hreflang"),o=document.querySelectorAll(".current-locale-iso-code");if(t&&o.length)for(let e of o)e.innerText=t}}));let R=document.querySelectorAll(".w-locales-items");if(R.length>0){R.forEach((function(e){e.querySelectorAll("a").forEach((function(e){e.addEventListener("click",(function(t){t.preventDefault(),c(e.getAttribute("hreflang")),window.location.href=e.href}))}))})),function(e){let t=document.cookie.split(";");for(let o=0;o<t.length;o++){let n=t[o].trim();if(n.startsWith(e+"="))return n.substring(e.length+1)}}("webflow-user-language");let e=["/careers","/locations","/derivtech","/derivlife","/eu-careers","/our-locations","/product-explorer","/academy","/trading-terms-glossary"],t=window.location.pathname;e.some((e=>t.includes(e)))}document.addEventListener("DOMContentLoaded",(function(){let e=document.querySelector(".lang-mob");e&&e.addEventListener("click",(function(){let e=document.querySelector(".new-navbar_menu-wrapper");e&&e.scrollBy({top:-3e3})}))})),document.addEventListener("DOMContentLoaded",(function(){const e=window.location.pathname.split("/")[1],t=["en","fr","ar","pt","es","ru","vi","bn","si","tr","sw","zh-cn","zh-tw","ko","it","de","pl","uz"].includes(e)?e:"en",o=(e,o)=>{Array.from(document.querySelectorAll("a")).filter((o=>o.href===`${e}/signup`||o.href===`${e}/${t}/signup`||o.href===`${e}/landing/signup`||o.href===`${e}/${t}/landing/signup`)).forEach((e=>{e.href=`${o}/tradershub/signup?lang=${t}`}))},n=window.location.hostname;"deriv.com"===n?o("https://deriv.com","https://hub.deriv.com"):"staging.deriv.com"===n&&o("https://staging.deriv.com","https://staging-hub.deriv.com")})),document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll('a[href="https://app.deriv.com/cashier/account-transfer"]').forEach((e=>{e.href="https://app.deriv.com/redirect?action=ctrader_account_transfer"}))}));let N=null,U=null,B=null;const T=()=>{const e="staging.deriv.com"===window.location.hostname?"https://staging-hub.deriv.com/tradershub/wallets":"https://hub.deriv.com/tradershub/wallets",t="staging.deriv.com"===window.location.hostname?"staging.deriv.com":"deriv.com";if(N&&U===e&&B===t)return N;const o={"https://deriv.com/cashier":e,"/cashier/withdrawal":`${e}/withdrawal`,"https://deriv.com/cashier/withdrawal":`${e}/withdrawal`,"https://deriv.com/cashier/account-transfer":`${e}/transfer`,"https://staging.deriv.com/cashier":e,"https://staging.deriv.com/cashier/withdrawal":`${e}/withdrawal`,"https://staging.deriv.com/cashier/account-transfer":`${e}/transfer`,"https://app.deriv.com/cashier":e,"https://app.deriv.com/cashier/withdrawal":`${e}/withdrawal`,"https://app.deriv.com/cashier/account-transfer":`${e}/transfer`,"https://app.deriv.com/wallet/withdrawal":`${e}/withdrawal`};return N=o,U=e,B=t,o},P=e=>{try{const t=e.getAttribute("href");if(!t)return;const o=T(),n=Object.entries(o).sort((([e],[t])=>t.length-e.length)).find((([e])=>t.startsWith(e)));if(n){const[o,i]=n,r=t.includes("?")?t.substring(t.indexOf("?")):"";e.setAttribute("href",i+r)}}catch(t){}};document.addEventListener("DOMContentLoaded",(()=>{(()=>{try{const e=r(document.cookie,"client_information"),t=r(document.cookie,"wallet_account"),o=window.location.hostname.split(".").slice(-2).join(".");return e&&"true"===t&&"deriv.com"===o}catch(e){return!1}})()&&(()=>{try{document.querySelectorAll("a[href]").forEach(P)}catch(e){}})()}));
|
|
1
|
+
import{initializeApp as e}from"https://www.gstatic.com/firebasejs/10.8.1/firebase-app.js";import{getDatabase as t,ref as o,onValue as n}from"https://www.gstatic.com/firebasejs/10.8.1/firebase-database.js";function i(e,t,o,n){let i="";if(o){let e=new Date;e.setTime(e.getTime()+24*o*60*60*1e3),i="; expires="+e.toUTCString()}document.cookie=n?e+"="+(t||"")+i+`;domain=${n};path=/`:e+"="+(t||"")+i+";path=/"}function r(e,t){const o={};return e.split(";").forEach(e=>{const[t,n]=e.split("=").map(e=>e.trim());o[t]=decodeURIComponent(n)}),o[t]}function c(e){i("webflow-user-language",e,30),i("webflow-user-language",e,30,`.${window.location.hostname}`)}function a(e){document.cookie=e+"=; Max-Age=-99999999;"}const s="green.derivws.com";window.emailRegex=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,window.toggleErrorField=(e,t)=>{t?e.classList.remove("error-field"):e.classList.add("error-field")},window.disableButton=function(e){e.disabled=!0,e.style.opacity="0.5"},window.isEuRegion=function(e){const t=e.replace(/\/$/,"");return/^\/(?:[^\/]+\/)?eu(?:\/|$)/.test(t)},window.enableButton=function(e){e.disabled=!1,e.style.opacity="1"},window.getOauthUrl=function(){var e=window.location.href,t=new URL(e).hostname,o=["deriv.com","deriv.be","deriv.me"].find(e=>t.endsWith(e));return o?`https://oauth.${o}`:"https://oauth.deriv.com"},window.getClientCountry=function(){var e;const t=r(document.cookie,"test_im_country"),o=r(document.cookie,"clients_country"),n=r(document.cookie,"client_information");return n?(null==(e=JSON.parse(n))?void 0:e.residence)||o:t||o},window.deriv_com_url="deriv.com",window.deriv_me_url="deriv.me",window.deriv_be_url="deriv.be",window.webflow_domain="webflow.deriv.com",window.staging_url="staging.deriv.com",window.staging_deriv_be_url="staging.deriv.be",window.domain_list_app_id={[window.deriv_com_url]:"61554",[window.deriv_me_url]:"1411",[window.deriv_be_url]:"30767",[window.webflow_domain]:"53503",[window.staging_url]:"53503"},window.getDomain=()=>{var e=window.location.href;return new URL(e).hostname},window.getAppId=()=>{const e=window.getDomain(),t=new URLSearchParams(window.location.search||"").get("app_id");if(t)return t;const o=localStorage.getItem("config.app_id");if(o)return o;const n={[window.webflow_domain]:window.domain_list_app_id[window.webflow_domain],[window.deriv_be_url]:window.domain_list_app_id[window.deriv_be_url],[window.deriv_me_url]:window.domain_list_app_id[window.deriv_me_url],[window.staging_url]:window.domain_list_app_id[window.staging_url]};return n[e]?n[e]:window.domain_list_app_id[window.deriv_com_url]};const d=()=>{try{return localStorage.getItem("config.server_url")||s}catch(e){return s}},l=()=>{const e=d(),t=r(document.cookie,"webflow-user-language");let o=window.getAppId(),n=(()=>{const e=window.getDomain();return e===window.deriv_me_url?window.domain_list_app_id[window.deriv_me_url]:e===window.deriv_be_url?window.domain_list_app_id[window.deriv_be_url]:e===window.webflow_domain?window.domain_list_app_id[window.webflow_domain]:window.domain_list_app_id[window.deriv_com_url]})();if("function"==typeof window.useGrowthbookFeatureFlag&&(window.isTHLogin=window.useGrowthbookFeatureFlag({featureFlag:"trigger_login_for_hub"}),"boolean"==typeof window.isTHLogin&&window.isTHLogin)){"staging.deriv.com"===new URL(window.location.href).host?(o=53503,n=53503):(o=61554,n=61554)}let i=t?t.toLowerCase():"en";"zh-cn"!==i&&"zh-tw"!==i||(i=i.replace("-","_"));const c=(e=>{let t="";return e&&Object.keys(e).forEach(o=>{t+=`&${o}=${e[o]}`}),t})((()=>{const e=r(document.cookie,"utm_data");if(e){const t=JSON.parse(e),o={};return["utm_source","utm_ad_id","utm_adgroup_id","utm_adrollclk_id","utm_campaign","utm_campaign_id","utm_content","utm_fbcl_id","utm_gl_client_id","utm_medium","utm_msclk_id","utm_term"].forEach(e=>{t.hasOwnProperty(e)&&(o[e]=t[e])}),o}return null})()),a=r(document.cookie,"affiliate_tracking"),s=a?`&affiliate_token=${a}`:"",l=void["mt5","bot","derivx"].filter(e=>window.location.pathname.includes(e)&&e)||"";return e&&/qa/.test(e)?`https://${e}/oauth2/authorize?app_id=${o}&l=${i}&brand=deriv${s}${c}&platform=${l}`:`${window.getOauthUrl()}/oauth2/authorize?app_id=${n}&l=${i}&brand=deriv${s}${c}&platform=${l}`};window.establishWebSocketConnection=()=>new Promise((e,t)=>{const o=r(document.cookie,"webflow-user-language"),n=o?o.toLowerCase():"en",i=d();window.websocket=new WebSocket(`wss://${i}/websockets/v3?app_id=${window.getAppId()}&l=${n||"en"}&brand=deriv`),window.websocket.addEventListener("open",t=>{window.websocket.addEventListener("close",()=>{window.websocket.close()}),window.websocket.addEventListener("message",e=>{JSON.parse(e.data)}),e(window.websocket)}),window.websocket.addEventListener("error",e=>{var o;null==(o=null==window?void 0:window.websocket)||o.close(),t(e)})}),window.socketMessageSend=async(e,t)=>{var o;try{return(null==window?void 0:window.websocket)&&(null==(o=null==window?void 0:window.websocket)?void 0:o.readyState)===(null==WebSocket?void 0:WebSocket.OPEN)?(window.websocket.send(e),new Promise((e,o)=>{window.websocket.addEventListener("message",n=>{const i=JSON.parse(n.data);t===i.msg_type&&(i.error?o(i.error):e(i))})})):establishWebSocketConnection().then(()=>(websocket.send(e),new Promise((e,o)=>{websocket.addEventListener("message",n=>{const i=JSON.parse(n.data);t===i.msg_type&&(i.error?o(i.error):e(i))})}))).catch(e=>Promise.reject(e))}catch(n){return Promise.reject(n)}};const u=[{id:"googlePlay",selectors:[".footer_banner-badge.google.w-inline-block",".app-download_link-wrapper.google.w-inline-block"],countries:["af","ax","as","ad","ai","aq","au","bb","bt","bv","io","bn","bi","ca","bq","cf","cx","cc","cg","cd","ck","cw","gq","et","fk","fo","gf","pf","tf","gl","gp","gu","gg","gy","hm","va","hk","ir","im","jp","je","ki","kp","ls","ly","mg","mw","mh","mq","mr","yt","fm","mn","me","ms","nr","nc","nz","ng","nu","nf","mp","pw","ps","pn","pr","re","sh","kn","lc","pm","vc","bl","mf","st","sg","sx","gs","ss","sj","sz","sy","tl","tk","tc","tv","um","us","vg","vi","wf","eh"]},{id:"appstore",selectors:[".footer_banner-badge.store.w-inline-block",".app-download_link-wrapper.appstore.w-inline-block"],countries:["ax","al","as","ad","aq","aw","au","at","bd","be","bv","io","bg","bi","ca","bq","cf","cx","cc","km","ck","hr","cu","cw","cy","cz","dk","dj","gq","er","ee","et","fk","fo","fi","fr","gf","pf","tf","de","gi","gr","gl","gp","gu","gg","gn","ht","hm","va","hk","hu","is","ir","iq","ie","im","il","it","je","ki","kp","lv","ls","ly","li","lt","lu","mt","mh","mq","yt","fm","me","nl","nc","nz","ng","nu","nf","mp","no","ps","pn","pl","pt","pr","re","ro","sh","pm","bl","mf","ws","sm","sg","sx","sk","si","so","gs","ss","es","sd","sj","se","ch","sy","tw","tl","tg","tk","tr","tv","gb","um","us","vu","vi","wf","eh"]},{id:"p2p",selectors:["#p2payment.accordion_toggle-block","#p2component.section_dp2p","#card_block_p2p.help_category"],countries:["as","au","at","be","bg","ca","hr","cy","cz","dk","ee","fi","fr","gr","gu","gg","hk","hu","ir","ie","im","il","it","je","ng","mm","sy","kp","lv","lt","lu","mt","nl","nz","mp","py","pl","pt","pr","ro","rw","sk","si","es","se","gb","us","um","vu","vi","ky","cu","de"]},{id:"w-dyn-item-p2p",selectors:["div.w-dyn-item"],countries:["as","au","at","be","bg","ca","hr","cy","cz","dk","ee","fi","fr","gr","gu","gg","hk","hu","ir","ie","im","il","it","je","ng","mm","sy","kp","lv","lt","lu","my","mt","nl","nz","mp","py","pl","pt","pr","ro","rw","sk","si","es","se","ae","gb","us","um","vu","vi","ky","cu","de"]},{id:"hideRow",selectors:["#footer_social-icons_row","#footer_text_row",".footer_risk-warning.w-richtext"],countries:["br","uy","lk","ch","za","ec"]},{id:"hideDiel",selectors:["#footer_text_diel","#footer_social-icons_diel"],countries:["br","uy","lk","ch","za","ec"]}],w=[{id:"showElems",selectors:[".banner_disclaimer"],countries:["br","uy","lk","ch","za","ec"]}],m=()=>{const e=window.getClientCountry();u.forEach(t=>{const o="hideDiel"===t.id?!t.countries.includes(e):t.countries.includes(e);if(e&&o)return t.selectors.forEach(e=>{document.querySelectorAll(e).forEach(e=>{if(e)if("w-dyn-item-p2p"===t.id){e.querySelector("#card_block_p2p.help_category")&&(e.style.display="none")}else e.style.display="none"})});if(!o){const e=document.querySelector(".footer_social-icons.diel");e&&(e.style.display="flex")}}),w.forEach(t=>{e&&t.countries.includes(e)?t.selectors.forEach(e=>{document.querySelectorAll(e).forEach(t=>{if(t){const o=document.querySelector(".page-wrapper");".banner_disclaimer"===e?(o.classList.add("disclaimer-show"),t.classList.remove("hide-element")):t.style.display="block"}})}):t.selectors.forEach(e=>{document.querySelectorAll(e).forEach(t=>{t&&(".banner_disclaimer"===e?t.classList.add("hide-element"):t.style.display="none")})})})};document.addEventListener("DOMContentLoaded",function(){const e=JSON.stringify({website_status:1});!async function(){try{const e=await fetch("https://deriv.com/cdn-cgi/trace"),t=await e.text(),o=Object.fromEntries(t.split("\n").map(e=>e.split("=",2))).loc.toLowerCase();o!==r(document.cookie,"clients_country")&&(a("clients_country"),i("clients_country",o,30)),m()}catch(e){m()}}();r(document.cookie,"clients_country")||window.socketMessageSend(e,"website_status").then(e=>{r(document.cookie,"clients_country")!==e.website_status.clients_country&&(a("clients_country"),i("clients_country",e.website_status.clients_country,30)),m()}).catch(e=>{})});const h=["ar","bn","de","en","es","fr","it","ko","pl","pt","ru","si","sw","tr","vi","zh_cn","zh_tw","zh-cn","zh-tw"];function p(){let e,t=!1,o=!1;const n=()=>{o=!0,t=!!r(document.cookie,"client_information"),t&&clearInterval(e),document.dispatchEvent(new Event("authStatusChange"))};return n(),e=setInterval(n,800),{getLoggedInStatus:()=>t,getAuthCheckedStatus:()=>o,onAuthStatusChange:e=>document.addEventListener("authStatusChange",e)}}document.addEventListener("DOMContentLoaded",function(){(()=>{var e;const t=window.location.pathname,o=window.location.hash,n=window.location.search,i=t.split("/"),a=i[1],s=h.includes(a||""),d=i.includes("careers")||i.includes("locations")||i.includes("derivtech")||i.includes("derivlife")||i.includes("trading-terms-glossary")||i.includes("product-explorer")||i.includes("eu-careers")||i.includes("our-locations")||i.includes("academy")||i.includes("trading-specifications");s&&c(a);const l=(null==(e=r(document.cookie,"webflow-user-language"))?void 0:e.toLowerCase())||"en",u=s?a:l;if((s||"en"!==l)&&a!==l)if(s&&a!==l)c(u);else if(!d){const e=(s?i.map(e=>e===a?u:e).join("/"):u+i.join("/"))+n+o;window.location.href="/"+e}})()}),document.addEventListener("DOMContentLoaded",()=>{const e=p();e.onAuthStatusChange(()=>{if(e.getAuthCheckedStatus()&&e.getLoggedInStatus()){document.querySelectorAll(".logged-in-btn").forEach(e=>{e.classList.remove("hide-element")});document.querySelectorAll(".logged-out-btn").forEach(e=>{e.classList.add("hide-element")})}else if(e.getAuthCheckedStatus()&&!e.getLoggedInStatus()){document.querySelectorAll(".logged-out-btn").forEach(e=>{e.classList.remove("hide-element")});document.querySelectorAll(".logged-in-btn").forEach(e=>{e.classList.add("hide-element")})}})});const g=document.querySelector(".banner_disclaimer"),f=document.querySelector(".main-wrapper");if(g){new ResizeObserver(e=>{for(let t of e)if(t.target===g){let e=t.target.getBoundingClientRect();f&&(f.style.paddingTop=e.height+"px")}}).observe(g)}window.addEventListener("pageshow",function(e){if(e.persisted){const e=document.querySelector(".w-nav-overlay");e&&(e.style.display="none",document.querySelector("body").click())}});const v=t(e({databaseURL:window.location.hostname.includes("staging")?"https://app-config-staging.firebaseio.com":"https://app-config-prod.firebaseio.com"}));let b=!1,_=!1;!function(){var e;const t=document.getElementById("live_chat-wrapper");try{const e=o(v,"remote_config/deriv-com/chat");n(e,e=>{const o=e.val();b=o.live_chat,_=o.whatsapp_chat;const n=document.querySelector(".whatsapp_chat"),i=document.querySelector(".livechatbtn");n&&(n.style.visibility=_?"visible":"hidden"),i&&(i.style.visibility=b?"visible":"hidden");const r=window.location.pathname.includes("/help-centre");if(window.location.pathname.includes("/deriv-prime")){t.style.flexDirection="column-reverse";document.querySelectorAll(".whatsapp_chat").forEach(e=>{e.style.visibility="hidden"})}if(r){const e=document.querySelectorAll(".livechatbtn");b?e.forEach(e=>{e.style.visibility="visible"}):e.forEach(e=>{e.style.visibility="hidden"});const t=document.querySelectorAll(".whatsapp_chat");_?t.forEach(e=>{e.style.visibility="visible"}):t.forEach(e=>{e.style.visibility="hidden"})}window.addEventListener("scroll",function(){var e,o;(b||_)&&(null==(e=null==t?void 0:t.classList)||e.remove("hide-element")),b||_||null==(o=null==t?void 0:t.classList)||o.add("hide-element")})},e=>{var o;null==(o=null==t?void 0:t.classList)||o.remove("hide-element")})}catch(i){null==(e=null==t?void 0:t.classList)||e.remove("hide-element")}}();new MutationObserver(function(e){for(const t of e)if(t.addedNodes.length)for(const e of t.addedNodes)e.nodeType===Node.ELEMENT_NODE&&"chat-widget-minimized"===e.id&&(e.style.opacity="0")}).observe(document.body,{childList:!0,subtree:!0});const y=document.querySelector(".redirection_background-wrapper"),k=document.getElementById("cancel-redirect"),L=document.getElementById("proceed-redirect"),E=window.dataLayer,S=r(document.cookie,"client_information"),q=!!S;if(document.addEventListener("DOMContentLoaded",()=>{E&&window.dataLayer.push({loggedIn:q,language:r(document.cookie,"webflow-user-language")||"en",...q&&{visitorId:null==S?void 0:S.loginid,currency:null==S?void 0:S.currency,email:null==S?void 0:S.email}})}),window.isEuRegion(window.location.pathname)&&y&&k&&L){const e=["deriv.me","deriv.be","deriv.com","app.deriv.me","app.deriv.be","app.deriv.com","docs.deriv.com","community.deriv.com","deriv.statuspage.io","signup.deriv.com","login.deriv.com","api.deriv.com","hub.deriv.com"];let t="",o="_self";document.querySelectorAll("a").forEach(function(n){const i=new URL(n.href,window.location.href),r=new URL(window.location.href);e.includes(i.host)||i.host===r.host||n.addEventListener("click",function(e){e.preventDefault(),t=i.href,o=n.target||"_self",y.classList.remove("hide-element"),document.body.style.overflow="hidden"})}),k.addEventListener("click",function(){y.classList.add("hide-element"),document.body.style.overflow="auto",t=""}),L.addEventListener("click",function(){t&&(window.open(t,o),t="",y.classList.add("hide-element"),document.body.style.overflow="auto")})}document.addEventListener("DOMContentLoaded",function(){document.querySelector(".banner_disclaimer")?document.body.classList.add("disclaimer-visible"):document.body.classList.remove("disclaimer-visible")});const $=document.querySelectorAll(".navbar_accordion-item");function A(){const e=document.querySelector(".navbar_accordion-trigger.open");e&&e.scrollIntoView({behavior:"smooth",block:"start"})}$.forEach(e=>{e.querySelector(".navbar_accordion-trigger").classList.remove("open");const t=e.querySelector(".navbar_accordion-content");t.classList.remove("open"),t.style.maxHeight="0px",t.style.overflow="hidden",t.style.transition="max-height 0.3s ease-in, opacity 0.3s ease-in",t.style.opacity="0"}),$.forEach(e=>{const t=e.querySelector(".navbar_accordion-trigger");t.addEventListener("click",function(){const e=t.classList.contains("open");if($.forEach(e=>{e.querySelector(".navbar_accordion-trigger").classList.remove("open");const t=e.querySelector(".navbar_accordion-content");t.classList.remove("open"),t.style.maxHeight="0px",t.style.opacity="0"}),!e){t.classList.add("open");const e=t.nextElementSibling;e.classList.add("open"),e.style.maxHeight=e.scrollHeight+"px",e.style.opacity="1"}})});document.querySelectorAll(".navbar_accordion-trigger").forEach(e=>{e.addEventListener("click",function(){setTimeout(A,300)})});const x=new MutationObserver(e=>{e.forEach(e=>{if("class"===e.attributeName){const t=e.target;t.classList.contains("open")&&t.scrollIntoView({behavior:"smooth",block:"start"})}})});document.querySelectorAll(".navbar_accordion-item").forEach(e=>{x.observe(e,{attributes:!0})});const C=new URL(window.location.href),O=new URLSearchParams(C.search),D=O.get("t");if(O.has("referrer")&&null!=D){r(document.cookie,"referrer_token")!==D&&(a("referrer_token"),i("referrer_token",D,365,".deriv.com"))}const z=document.getElementById("navbar-home_login");z&&z.addEventListener("click",function(e){e.preventDefault(),window.location.href=l()});const I=document.getElementById("res-navbar-home_login");I&&I.addEventListener("click",function(e){e.preventDefault(),window.location.href=l()});const j=document.getElementById("white-navbar_login");j&&j.addEventListener("click",function(e){e.preventDefault(),window.location.href=l()});const M=document.getElementById("res-white-navbar_login");M&&M.addEventListener("click",function(e){e.preventDefault(),window.location.href=l()}),document.addEventListener("DOMContentLoaded",function(){let e=document.querySelectorAll(".navbar_accordion-trigger"),t=document.querySelector(".navbar_menu-button");if(document.querySelector(".new-navbar_component")){const e=document.querySelector(".new-navbar_component");e.addEventListener("mouseenter",()=>{window.innerWidth>991&&document.body.classList.add("disable-scroll")}),e.addEventListener("mouseleave",()=>{window.innerWidth>991&&document.body.classList.remove("disable-scroll")})}t&&t.addEventListener("click",function(){let e=window.innerHeight,t=document.querySelector(".new-navbar_main-wrapper");if(t){let o=e-t.offsetHeight,n=document.querySelector(".new-navbar_menu");n&&(n.style.height=`${o}px`)}}),e.forEach(t=>{t.addEventListener("click",function(){e.forEach(e=>e.classList.remove("current")),this.classList.add("current")})});let o=document.querySelector(".navbar_accordion-link.w--current");if(o){let e=o.closest(".navbar_accordion-item");if(e){let t=e.querySelector(".navbar_accordion-trigger");t&&t.classList.add("current")}}}),document.addEventListener("DOMContentLoaded",()=>{var e=window.location.pathname;["/careers","/locations","/derivtech","/derivlife","/eu-careers","/our-locations","/product-explorer","/academy","/trading-terms-glossary"].some(t=>e.includes(t))&&document.head.querySelectorAll("link").forEach(function(e){e.hasAttribute("hreflang")&&"x-default"!==e.getAttribute("hreflang")&&e.remove()})}),document.addEventListener("DOMContentLoaded",function(){let e=document.querySelector(".locale > .new-navbar_dropdown-link.w--current");if(e){let t=e.getAttribute("hreflang"),o=document.querySelectorAll(".current-locale-iso-code");if(t&&o.length)for(let e of o)e.innerText=t}});let R=document.querySelectorAll(".w-locales-items");if(R.length>0){R.forEach(function(e){e.querySelectorAll("a").forEach(function(e){e.addEventListener("click",function(t){t.preventDefault(),c(e.getAttribute("hreflang")),window.location.href=e.href})})}),function(e){let t=document.cookie.split(";");for(let o=0;o<t.length;o++){let n=t[o].trim();if(n.startsWith(e+"="))return n.substring(e.length+1)}}("webflow-user-language");let e=["/careers","/locations","/derivtech","/derivlife","/eu-careers","/our-locations","/product-explorer","/academy","/trading-terms-glossary"],t=window.location.pathname;e.some(e=>t.includes(e))}document.addEventListener("DOMContentLoaded",function(){let e=document.querySelector(".lang-mob");e&&e.addEventListener("click",function(){let e=document.querySelector(".new-navbar_menu-wrapper");e&&e.scrollBy({top:-3e3})})}),document.addEventListener("DOMContentLoaded",function(){const e=window.location.pathname.split("/")[1],t=["en","fr","ar","pt","es","ru","vi","bn","si","tr","sw","zh-cn","zh-tw","ko","it","de","pl","uz"].includes(e)?e:"en",o=(e,o)=>{Array.from(document.querySelectorAll("a")).filter(o=>o.href===`${e}/signup`||o.href===`${e}/${t}/signup`||o.href===`${e}/landing/signup`||o.href===`${e}/${t}/landing/signup`).forEach(e=>{e.href=`${o}/tradershub/signup?lang=${t}`})},n=window.location.hostname;"deriv.com"===n?o("https://deriv.com","https://hub.deriv.com"):"staging.deriv.com"===n&&o("https://staging.deriv.com","https://staging-hub.deriv.com")}),document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('a[href="https://app.deriv.com/cashier/account-transfer"]').forEach(e=>{e.href="https://app.deriv.com/redirect?action=ctrader_account_transfer"})});let N=null,U=null,B=null;const T=()=>{const e="staging.deriv.com"===window.location.hostname?"https://staging-hub.deriv.com/tradershub/wallets":"https://hub.deriv.com/tradershub/wallets",t="staging.deriv.com"===window.location.hostname?"staging.deriv.com":"deriv.com";if(N&&U===e&&B===t)return N;const o={"https://deriv.com/cashier":e,"/cashier/withdrawal":`${e}/withdrawal`,"https://deriv.com/cashier/withdrawal":`${e}/withdrawal`,"https://deriv.com/cashier/account-transfer":`${e}/transfer`,"https://staging.deriv.com/cashier":e,"https://staging.deriv.com/cashier/withdrawal":`${e}/withdrawal`,"https://staging.deriv.com/cashier/account-transfer":`${e}/transfer`,"https://app.deriv.com/cashier":e,"https://app.deriv.com/cashier/withdrawal":`${e}/withdrawal`,"https://app.deriv.com/cashier/account-transfer":`${e}/transfer`,"https://app.deriv.com/wallet/withdrawal":`${e}/withdrawal`};return N=o,U=e,B=t,o},P=e=>{try{const t=e.getAttribute("href");if(!t)return;const o=T(),n=Object.entries(o).sort(([e],[t])=>t.length-e.length).find(([e])=>t.startsWith(e));if(n){const[o,i]=n,r=t.includes("?")?t.substring(t.indexOf("?")):"";e.setAttribute("href",i+r)}}catch(t){}};document.addEventListener("DOMContentLoaded",()=>{(()=>{try{const e=r(document.cookie,"client_information"),t=r(document.cookie,"wallet_account"),o=window.location.hostname.split(".").slice(-2).join(".");return e&&"true"===t&&"deriv.com"===o}catch(e){return!1}})()&&(()=>{try{document.querySelectorAll("a[href]").forEach(P)}catch(e){}})()});
|
|
@@ -5,4 +5,4 @@ var e,n,i=Object.getOwnPropertyNames,t=(e={"js/trading_central_scripts.min.js"(e
|
|
|
5
5
|
* Copyright: (c) 2020 David J. Bradshaw - dave@bradshaw.net
|
|
6
6
|
* License: MIT
|
|
7
7
|
*/
|
|
8
|
-
!function(e){if("undefined"!=typeof window){var i,t=0,o=!1,r=!1,a=7,s="[iFrameSizer]",d=s.length,c=null,u=window.requestAnimationFrame,f={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},l={},m=null,g={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){M("onMessage function not defined")},onResized:function(){},onScroll:function(){return!0}},h={};window.jQuery&&((i=window.jQuery).fn?i.fn.iFrameResize||(i.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,i){H(i,e)})).end()}):x("","Unable to bind to jQuery, it is not fully loaded.")),"function"==typeof define&&define.amd?define([],L):"object"==typeof n&&"object"==typeof n.exports&&(n.exports=L()),window.iFrameResize=window.iFrameResize||L()}function p(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function w(e,n,i){e.addEventListener(n,i,!1)}function b(e,n,i){e.removeEventListener(n,i,!1)}function y(e){return l[e]?l[e].log:o}function v(e,n){k(0,0,0,y(e))}function x(e,n){k(0,0,0,y(e))}function M(e,n){k(0,0,0,!0)}function k(e,n,i,t){!0===t&&window.console}function z(e){function n(){i("Height"),i("Width"),N((function(){C(L),T(q),m("onResized",L)}),L,"init")}function i(e){var n=Number(l[q]["max"+e]),i=Number(l[q]["min"+e]),t=e.toLowerCase(),o=Number(L[t]);v(q,"Checking "+t+" is in range "+i+"-"+n),o<i&&(o=i,v(q,"Set "+t+" to min value")),n<o&&(o=n,v(q,"Set "+t+" to max value")),L[t]=""+o}function t(e){return B.substr(B.indexOf(":")+a+e)}function o(e,n){var i;h[i=n]||(h[i]=setTimeout((function(){h[i]=null,S("Send Page Info","pageInfo:"+function(){var e=document.body.getBoundingClientRect(),n=L.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(n.top-e.top,10),offsetLeft:parseInt(n.left-e.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}(),e,n)}),32))}function r(e){var n=e.getBoundingClientRect();return R(q),{x:Math.floor(Number(n.left)+Number(c.x)),y:Math.floor(Number(n.top)+Number(c.y))}}function u(e){var n=e?r(L.iframe):{x:0,y:0},i={x:Number(L.width)+n.x,y:Number(L.height)+n.y};v(q,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top!==window.self?window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](i.x,i.y):M(q,"Unable to scroll to requested position, window.parentIFrame not found"):(c=i,f(),v(q,"--"))}function f(){!1!==m("onScroll",c)?T(q):E()}function m(e,n){return I(q,e,n)}var g,p,y,k,z,F,H,P,A,B=e.data,L={},q=null;"[iFrameResizerChild]Ready"===B?function(){for(var e in l)S("iFrame requested init",j(e),l[e].iframe,e)}():s===(""+B).substr(0,d)&&B.substr(d).split(":")[0]in l?(F=(z=B.substr(d).split(":"))[1]?parseInt(z[1],10):0,H=l[z[0]]&&l[z[0]].iframe,P=getComputedStyle(H),L={iframe:H,id:z[0],height:F+(A=P,"border-box"!==A.boxSizing?0:(A.paddingTop?parseInt(A.paddingTop,10):0)+(A.paddingBottom?parseInt(A.paddingBottom,10):0))+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(P),width:z[2],type:z[3]},q=L.id,l[q]&&(l[q].loaded=!0),(k=L.type in{true:1,false:1,undefined:1})&&v(q,"Ignoring init message from meta parent page"),!k&&(y=!0,l[p=q]||(y=!1,M(L.type+" No settings for "+p+". Message was: "+B)),y)&&(v(q,"Received: "+B),g=!0,null===L.iframe&&(M(q,"IFrame ("+L.id+") not found"),g=!1),g&&function(){var n,i=e.origin,t=l[q]&&l[q].checkOrigin;if(t&&""+i!="null"&&!(t.constructor===Array?function(){var e=0,n=!1;for(v(q,"Checking connection is from allowed list of origins: "+t);e<t.length;e++)if(t[e]===i){n=!0;break}return n}():(n=l[q]&&l[q].remoteHost,v(q,"Checking connection is from: "+n),i===n)))throw new Error("Unexpected message received from: "+i+" for "+L.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(l[q]&&l[q].firstRun&&l[q]&&(l[q].firstRun=!1),L.type){case"close":O(L.iframe);break;case"message":!function(e){v(q,"onMessage passed: {iframe: "+L.iframe.id+", message: "+e+"}"),m("onMessage",{iframe:L.iframe,message:JSON.parse(e)}),v(q,"--")}(t(6));break;case"autoResize":l[q].autoResize=JSON.parse(t(9));break;case"scrollTo":u(!1);break;case"scrollToOffset":u(!0);break;case"pageInfo":o(l[q]&&l[q].iframe,q),function(){function e(e,t){function r(){l[i]?o(l[i].iframe,i):n()}["scroll","resize"].forEach((function(n){v(i,e+n+" listener for sendPageInfo"),t(window,n,r)}))}function n(){e("Remove ",b)}var i=q;e("Add ",w),l[i]&&(l[i].stopPageInfo=n)}();break;case"pageInfoStop":l[q]&&l[q].stopPageInfo&&(l[q].stopPageInfo(),delete l[q].stopPageInfo);break;case"inPageLink":!function(e){var n,i=e.split("#")[1]||"",t=decodeURIComponent(i),o=document.getElementById(t)||document.getElementsByName(t)[0];o?(n=r(o),v(q,"Moving to in page link (#"+i+") at x: "+n.x+" y: "+n.y),c={x:n.x,y:n.y},f(),v(q,"--")):window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(i):v(q,"In page link #"+i+" not found and window.parentIFrame not found"):v(q,"In page link #"+i+" not found")}(t(9));break;case"reset":W(L);break;case"init":n(),m("onInit",L.iframe);break;default:n()}}())):x(q,"Ignored: "+B)}function I(e,n,i){var t=null,o=null;if(l[e]){if("function"!=typeof(t=l[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=t(i)}return o}function F(e){var n=e.id;delete l[n]}function O(e){var n=e.id;if(!1!==I(n,"onClose",n)){v(n,"Removing iFrame: "+n);try{e.parentNode&&e.parentNode.removeChild(e)}catch(i){M(i)}I(n,"onClosed",n),v(n,"--"),F(e)}else v(n,"Close iframe cancelled by onClose event")}function R(n){null===c&&v(n,"Get page position: "+(c={x:window.pageXOffset!==e?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==e?window.pageYOffset:document.documentElement.scrollTop}).x+","+c.y)}function T(e){null!==c&&(window.scrollTo(c.x,c.y),v(e,"Set page position: "+c.x+","+c.y),E())}function E(){c=null}function W(e){v(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),R(e.id),N((function(){C(e),S("reset","reset",e.iframe,e.id)}),e,"reset")}function C(e){function n(n){var t;t=n,e.id?(e.iframe.style[t]=e[t]+"px",v(e.id,"IFrame ("+i+") "+t+" set to "+e[t]+"px")):v("undefined","messageData id not set"),function(n){r||"0"!==e[n]||(r=!0,v(i,"Hidden iFrame detected, creating visibility listener"),function(){function e(){Object.keys(l).forEach((function(e){!function(e){function n(n){return"0px"===(l[e]&&l[e].iframe.style[n])}l[e]&&null!==l[e].iframe.offsetParent&&(n("height")||n("width"))&&S("Visibility change","resize",l[e].iframe,e)}(e)}))}function n(n){v("window","Mutation observed: "+n[0].target+" "+n[0].type),P(e,16)}var i,t=p();t&&(i=document.querySelector("body"),new t(n).observe(i,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}())}(n)}var i=e.iframe.id;l[i]&&(l[i].sizeHeight&&n("height"),l[i].sizeWidth&&n("width"))}function N(e,n,i){i!==n.type&&u&&!window.jasmine?(v(n.id,"Requesting animation frame"),u(e)):e()}function S(e,n,i,t,o){var r,a=!1;t=t||i.id,l[t]&&(i&&"contentWindow"in i&&null!==i.contentWindow?(r=l[t]&&l[t].targetOrigin,v(t,"["+e+"] Sending msg to iframe["+t+"] ("+n+") targetOrigin: "+r),i.contentWindow.postMessage(s+n,r)):M(t,"["+e+"] IFrame("+t+") not found"),o&&l[t]&&l[t].warningTimeout&&(l[t].msgTimeout=setTimeout((function(){!l[t]||l[t].loaded||a||(a=!0,M(t,"IFrame has not responded within "+l[t].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),l[t].warningTimeout)))}function j(e){return e+":"+l[e].bodyMarginV1+":"+l[e].sizeWidth+":"+l[e].log+":"+l[e].interval+":"+l[e].enablePublicMethods+":"+l[e].autoResize+":"+l[e].bodyMargin+":"+l[e].heightCalculationMethod+":"+l[e].bodyBackground+":"+l[e].bodyPadding+":"+l[e].tolerance+":"+l[e].inPageLinks+":"+l[e].resizeFrom+":"+l[e].widthCalculationMethod}function H(n,i){var r,a,s,d,c,u,m,h=(""===(a=n.id)&&(n.id=(r=i&&i.id||g.id+t++,null!==document.getElementById(r)&&(r+=t++),a=r),o=(i||{}).log,v(a,"Added missing iframe ID: "+a+" ("+n.src+")")),a);function b(e){1/0!==l[h][e]&&0!==l[h][e]&&(n.style[e]=l[h][e]+"px",v(h,"Set "+e+" = "+l[h][e]+"px"))}function y(e){if(l[h]["min"+e]>l[h]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}h in l&&"iFrameResizer"in n?M(h,"Ignored iFrame, already setup."):(u=(u=i)||{},l[h]={firstRun:!0,iframe:n,remoteHost:n.src&&n.src.split("/").slice(0,3).join("/")},function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(u),Object.keys(u).forEach((function(e){var n=e.split("Callback");if(2===n.length){var i="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[i]=this[e],delete this[e],M(h,"Deprecated: '"+e+"' has been renamed '"+i+"'. The old method will be removed in the next major version.")}}),u),function(e){for(var n in g)Object.prototype.hasOwnProperty.call(g,n)&&(l[h][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:g[n])}(u),l[h]&&(l[h].targetOrigin=!0===l[h].checkOrigin?""===(m=l[h].remoteHost)||null!==m.match(/^(about:blank|javascript:|file:\/\/)/)?"*":m:"*"),function(){switch(v(h,"IFrame scrolling "+(l[h]&&l[h].scrolling?"enabled":"disabled")+" for "+h),n.style.overflow=!1===(l[h]&&l[h].scrolling)?"hidden":"auto",l[h]&&l[h].scrolling){case"omit":break;case!0:n.scrolling="yes";break;case!1:n.scrolling="no";break;default:n.scrolling=l[h]?l[h].scrolling:"no"}}(),y("Height"),y("Width"),b("maxHeight"),b("minHeight"),b("maxWidth"),b("minWidth"),"number"!=typeof(l[h]&&l[h].bodyMargin)&&"0"!==(l[h]&&l[h].bodyMargin)||(l[h].bodyMarginV1=l[h].bodyMargin,l[h].bodyMargin=l[h].bodyMargin+"px"),s=j(h),(c=p())&&(d=c,n.parentNode&&new d((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===n&&O(n)}))}))})).observe(n.parentNode,{childList:!0})),w(n,"load",(function(){S("iFrame.onload",s,n,e,!0),function(){var e=l[h]&&l[h].firstRun,i=l[h]&&l[h].heightCalculationMethod in f;!e&&i&&W({iframe:n,height:0,width:0,type:"init"})}()})),S("init",s,n,e,!0),l[h]&&(l[h].iframe.iFrameResizer={close:O.bind(null,l[h].iframe),removeListeners:F.bind(null,l[h].iframe),resize:S.bind(null,"Window resize","resize",l[h].iframe),moveToAnchor:function(e){S("Move to anchor","moveToAnchor:"+e,l[h].iframe,h)},sendMessage:function(e){S("Send Message","message:"+(e=JSON.stringify(e)),l[h].iframe,h)}}))}function P(e,n){null===m&&(m=setTimeout((function(){m=null,e()}),n))}function A(){"hidden"!==document.visibilityState&&(v("document","Trigger event: Visiblity change"),P((function(){B("Tab Visable","resize")}),16))}function B(e,n){Object.keys(l).forEach((function(i){var t;!l[t=i]||"parent"!==l[t].resizeFrom||!l[t].autoResize||l[t].firstRun||S(e,n,l[i].iframe,i)}))}function L(){function n(e,n){n&&(function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">")}(),H(n,e),i.push(n))}var i;return function(){var e,n=["moz","webkit","o","ms"];for(e=0;e<n.length&&!u;e+=1)u=window[n[e]+"RequestAnimationFrame"];u?u=u.bind(window):v("setup","RequestAnimationFrame not supported")}(),w(window,"message",z),w(window,"resize",(function(){var e;v("window","Trigger event: "+(e="resize")),P((function(){B("Window "+e,"resize")}),16)})),w(document,"visibilitychange",A),w(document,"-webkit-visibilitychange",A),function(t,o){switch(i=[],(r=t)&&r.enablePublicMethods&&M("enablePublicMethods option has been removed, public methods are now always available in the iFrame"),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,t));break;case"object":n(t,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}var r;return i}}}()}},function(){return n||(0,e[i(e)[0]])((n={exports:{}}).exports,n),n.exports});export default t();
|
|
8
|
+
!function(e){if("undefined"!=typeof window){var i,t=0,o=!1,r=!1,a=7,s="[iFrameSizer]",d=s.length,c=null,u=window.requestAnimationFrame,f={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},l={},m=null,g={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){M("onMessage function not defined")},onResized:function(){},onScroll:function(){return!0}},h={};window.jQuery&&((i=window.jQuery).fn?i.fn.iFrameResize||(i.fn.iFrameResize=function(e){return this.filter("iframe").each(function(n,i){H(i,e)}).end()}):x("","Unable to bind to jQuery, it is not fully loaded.")),"function"==typeof define&&define.amd?define([],L):"object"==typeof n&&"object"==typeof n.exports&&(n.exports=L()),window.iFrameResize=window.iFrameResize||L()}function p(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function w(e,n,i){e.addEventListener(n,i,!1)}function b(e,n,i){e.removeEventListener(n,i,!1)}function y(e){return l[e]?l[e].log:o}function v(e,n){k(0,0,0,y(e))}function x(e,n){k(0,0,0,y(e))}function M(e,n){k(0,0,0,!0)}function k(e,n,i,t){!0===t&&window.console}function z(e){function n(){i("Height"),i("Width"),N(function(){C(L),T(q),m("onResized",L)},L,"init")}function i(e){var n=Number(l[q]["max"+e]),i=Number(l[q]["min"+e]),t=e.toLowerCase(),o=Number(L[t]);v(q,"Checking "+t+" is in range "+i+"-"+n),o<i&&(o=i,v(q,"Set "+t+" to min value")),n<o&&(o=n,v(q,"Set "+t+" to max value")),L[t]=""+o}function t(e){return B.substr(B.indexOf(":")+a+e)}function o(e,n){var i;h[i=n]||(h[i]=setTimeout(function(){h[i]=null,S("Send Page Info","pageInfo:"+function(){var e=document.body.getBoundingClientRect(),n=L.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(n.top-e.top,10),offsetLeft:parseInt(n.left-e.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}(),e,n)},32))}function r(e){var n=e.getBoundingClientRect();return R(q),{x:Math.floor(Number(n.left)+Number(c.x)),y:Math.floor(Number(n.top)+Number(c.y))}}function u(e){var n=e?r(L.iframe):{x:0,y:0},i={x:Number(L.width)+n.x,y:Number(L.height)+n.y};v(q,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top!==window.self?window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](i.x,i.y):M(q,"Unable to scroll to requested position, window.parentIFrame not found"):(c=i,f(),v(q,"--"))}function f(){!1!==m("onScroll",c)?T(q):E()}function m(e,n){return I(q,e,n)}var g,p,y,k,z,F,H,P,A,B=e.data,L={},q=null;"[iFrameResizerChild]Ready"===B?function(){for(var e in l)S("iFrame requested init",j(e),l[e].iframe,e)}():s===(""+B).substr(0,d)&&B.substr(d).split(":")[0]in l?(F=(z=B.substr(d).split(":"))[1]?parseInt(z[1],10):0,H=l[z[0]]&&l[z[0]].iframe,P=getComputedStyle(H),L={iframe:H,id:z[0],height:F+(A=P,"border-box"!==A.boxSizing?0:(A.paddingTop?parseInt(A.paddingTop,10):0)+(A.paddingBottom?parseInt(A.paddingBottom,10):0))+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(P),width:z[2],type:z[3]},q=L.id,l[q]&&(l[q].loaded=!0),(k=L.type in{true:1,false:1,undefined:1})&&v(q,"Ignoring init message from meta parent page"),!k&&(y=!0,l[p=q]||(y=!1,M(L.type+" No settings for "+p+". Message was: "+B)),y)&&(v(q,"Received: "+B),g=!0,null===L.iframe&&(M(q,"IFrame ("+L.id+") not found"),g=!1),g&&function(){var n,i=e.origin,t=l[q]&&l[q].checkOrigin;if(t&&""+i!="null"&&!(t.constructor===Array?function(){var e=0,n=!1;for(v(q,"Checking connection is from allowed list of origins: "+t);e<t.length;e++)if(t[e]===i){n=!0;break}return n}():(n=l[q]&&l[q].remoteHost,v(q,"Checking connection is from: "+n),i===n)))throw new Error("Unexpected message received from: "+i+" for "+L.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(l[q]&&l[q].firstRun&&l[q]&&(l[q].firstRun=!1),L.type){case"close":O(L.iframe);break;case"message":!function(e){v(q,"onMessage passed: {iframe: "+L.iframe.id+", message: "+e+"}"),m("onMessage",{iframe:L.iframe,message:JSON.parse(e)}),v(q,"--")}(t(6));break;case"autoResize":l[q].autoResize=JSON.parse(t(9));break;case"scrollTo":u(!1);break;case"scrollToOffset":u(!0);break;case"pageInfo":o(l[q]&&l[q].iframe,q),function(){function e(e,t){function r(){l[i]?o(l[i].iframe,i):n()}["scroll","resize"].forEach(function(n){v(i,e+n+" listener for sendPageInfo"),t(window,n,r)})}function n(){e("Remove ",b)}var i=q;e("Add ",w),l[i]&&(l[i].stopPageInfo=n)}();break;case"pageInfoStop":l[q]&&l[q].stopPageInfo&&(l[q].stopPageInfo(),delete l[q].stopPageInfo);break;case"inPageLink":!function(e){var n,i=e.split("#")[1]||"",t=decodeURIComponent(i),o=document.getElementById(t)||document.getElementsByName(t)[0];o?(n=r(o),v(q,"Moving to in page link (#"+i+") at x: "+n.x+" y: "+n.y),c={x:n.x,y:n.y},f(),v(q,"--")):window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(i):v(q,"In page link #"+i+" not found and window.parentIFrame not found"):v(q,"In page link #"+i+" not found")}(t(9));break;case"reset":W(L);break;case"init":n(),m("onInit",L.iframe);break;default:n()}}())):x(q,"Ignored: "+B)}function I(e,n,i){var t=null,o=null;if(l[e]){if("function"!=typeof(t=l[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=t(i)}return o}function F(e){var n=e.id;delete l[n]}function O(e){var n=e.id;if(!1!==I(n,"onClose",n)){v(n,"Removing iFrame: "+n);try{e.parentNode&&e.parentNode.removeChild(e)}catch(i){M(i)}I(n,"onClosed",n),v(n,"--"),F(e)}else v(n,"Close iframe cancelled by onClose event")}function R(n){null===c&&v(n,"Get page position: "+(c={x:window.pageXOffset!==e?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==e?window.pageYOffset:document.documentElement.scrollTop}).x+","+c.y)}function T(e){null!==c&&(window.scrollTo(c.x,c.y),v(e,"Set page position: "+c.x+","+c.y),E())}function E(){c=null}function W(e){v(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),R(e.id),N(function(){C(e),S("reset","reset",e.iframe,e.id)},e,"reset")}function C(e){function n(n){var t;t=n,e.id?(e.iframe.style[t]=e[t]+"px",v(e.id,"IFrame ("+i+") "+t+" set to "+e[t]+"px")):v("undefined","messageData id not set"),function(n){r||"0"!==e[n]||(r=!0,v(i,"Hidden iFrame detected, creating visibility listener"),function(){function e(){Object.keys(l).forEach(function(e){!function(e){function n(n){return"0px"===(l[e]&&l[e].iframe.style[n])}l[e]&&null!==l[e].iframe.offsetParent&&(n("height")||n("width"))&&S("Visibility change","resize",l[e].iframe,e)}(e)})}function n(n){v("window","Mutation observed: "+n[0].target+" "+n[0].type),P(e,16)}var i,t=p();t&&(i=document.querySelector("body"),new t(n).observe(i,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}())}(n)}var i=e.iframe.id;l[i]&&(l[i].sizeHeight&&n("height"),l[i].sizeWidth&&n("width"))}function N(e,n,i){i!==n.type&&u&&!window.jasmine?(v(n.id,"Requesting animation frame"),u(e)):e()}function S(e,n,i,t,o){var r,a=!1;t=t||i.id,l[t]&&(i&&"contentWindow"in i&&null!==i.contentWindow?(r=l[t]&&l[t].targetOrigin,v(t,"["+e+"] Sending msg to iframe["+t+"] ("+n+") targetOrigin: "+r),i.contentWindow.postMessage(s+n,r)):M(t,"["+e+"] IFrame("+t+") not found"),o&&l[t]&&l[t].warningTimeout&&(l[t].msgTimeout=setTimeout(function(){!l[t]||l[t].loaded||a||(a=!0,M(t,"IFrame has not responded within "+l[t].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))},l[t].warningTimeout)))}function j(e){return e+":"+l[e].bodyMarginV1+":"+l[e].sizeWidth+":"+l[e].log+":"+l[e].interval+":"+l[e].enablePublicMethods+":"+l[e].autoResize+":"+l[e].bodyMargin+":"+l[e].heightCalculationMethod+":"+l[e].bodyBackground+":"+l[e].bodyPadding+":"+l[e].tolerance+":"+l[e].inPageLinks+":"+l[e].resizeFrom+":"+l[e].widthCalculationMethod}function H(n,i){var r,a,s,d,c,u,m,h=(""===(a=n.id)&&(n.id=(r=i&&i.id||g.id+t++,null!==document.getElementById(r)&&(r+=t++),a=r),o=(i||{}).log,v(a,"Added missing iframe ID: "+a+" ("+n.src+")")),a);function b(e){1/0!==l[h][e]&&0!==l[h][e]&&(n.style[e]=l[h][e]+"px",v(h,"Set "+e+" = "+l[h][e]+"px"))}function y(e){if(l[h]["min"+e]>l[h]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}h in l&&"iFrameResizer"in n?M(h,"Ignored iFrame, already setup."):(u=(u=i)||{},l[h]={firstRun:!0,iframe:n,remoteHost:n.src&&n.src.split("/").slice(0,3).join("/")},function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(u),Object.keys(u).forEach(function(e){var n=e.split("Callback");if(2===n.length){var i="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[i]=this[e],delete this[e],M(h,"Deprecated: '"+e+"' has been renamed '"+i+"'. The old method will be removed in the next major version.")}},u),function(e){for(var n in g)Object.prototype.hasOwnProperty.call(g,n)&&(l[h][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:g[n])}(u),l[h]&&(l[h].targetOrigin=!0===l[h].checkOrigin?""===(m=l[h].remoteHost)||null!==m.match(/^(about:blank|javascript:|file:\/\/)/)?"*":m:"*"),function(){switch(v(h,"IFrame scrolling "+(l[h]&&l[h].scrolling?"enabled":"disabled")+" for "+h),n.style.overflow=!1===(l[h]&&l[h].scrolling)?"hidden":"auto",l[h]&&l[h].scrolling){case"omit":break;case!0:n.scrolling="yes";break;case!1:n.scrolling="no";break;default:n.scrolling=l[h]?l[h].scrolling:"no"}}(),y("Height"),y("Width"),b("maxHeight"),b("minHeight"),b("maxWidth"),b("minWidth"),"number"!=typeof(l[h]&&l[h].bodyMargin)&&"0"!==(l[h]&&l[h].bodyMargin)||(l[h].bodyMarginV1=l[h].bodyMargin,l[h].bodyMargin=l[h].bodyMargin+"px"),s=j(h),(c=p())&&(d=c,n.parentNode&&new d(function(e){e.forEach(function(e){Array.prototype.slice.call(e.removedNodes).forEach(function(e){e===n&&O(n)})})}).observe(n.parentNode,{childList:!0})),w(n,"load",function(){S("iFrame.onload",s,n,e,!0),function(){var e=l[h]&&l[h].firstRun,i=l[h]&&l[h].heightCalculationMethod in f;!e&&i&&W({iframe:n,height:0,width:0,type:"init"})}()}),S("init",s,n,e,!0),l[h]&&(l[h].iframe.iFrameResizer={close:O.bind(null,l[h].iframe),removeListeners:F.bind(null,l[h].iframe),resize:S.bind(null,"Window resize","resize",l[h].iframe),moveToAnchor:function(e){S("Move to anchor","moveToAnchor:"+e,l[h].iframe,h)},sendMessage:function(e){S("Send Message","message:"+(e=JSON.stringify(e)),l[h].iframe,h)}}))}function P(e,n){null===m&&(m=setTimeout(function(){m=null,e()},n))}function A(){"hidden"!==document.visibilityState&&(v("document","Trigger event: Visiblity change"),P(function(){B("Tab Visable","resize")},16))}function B(e,n){Object.keys(l).forEach(function(i){var t;!l[t=i]||"parent"!==l[t].resizeFrom||!l[t].autoResize||l[t].firstRun||S(e,n,l[i].iframe,i)})}function L(){function n(e,n){n&&(function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">")}(),H(n,e),i.push(n))}var i;return function(){var e,n=["moz","webkit","o","ms"];for(e=0;e<n.length&&!u;e+=1)u=window[n[e]+"RequestAnimationFrame"];u?u=u.bind(window):v("setup","RequestAnimationFrame not supported")}(),w(window,"message",z),w(window,"resize",function(){var e;v("window","Trigger event: "+(e="resize")),P(function(){B("Window "+e,"resize")},16)}),w(document,"visibilitychange",A),w(document,"-webkit-visibilitychange",A),function(t,o){switch(i=[],(r=t)&&r.enablePublicMethods&&M("enablePublicMethods option has been removed, public methods are now always available in the iFrame"),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,t));break;case"object":n(t,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}var r;return i}}}()}},function(){return n||(0,e[i(e)[0]])((n={exports:{}}).exports,n),n.exports});export default t();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deriv-com/custom-scripts",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.39",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -26,5 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"lodash": "^4.17.21"
|
|
29
|
+
},
|
|
30
|
+
"overrides": {
|
|
31
|
+
"brace-expansion": "^2.0.2",
|
|
32
|
+
"cross-spawn": "^7.0.5"
|
|
29
33
|
}
|
|
30
34
|
}
|