PageSourceSearch

https://www.gatewayames.com/integration-tools/rate-components/public/rates-proxy.js?v1.4.0

js gatewayames.com collected 2026-09-28 06:08:20 UTC 5,027 bytes, 3 lines download raw bytes

1/** version: 1.4.0 */
2var h=(t,a,e)=>{if(!a.has(t))throw TypeError("Cannot "+e)};var g=(t,a,e)=>(h(t,a,"read from private field"),e?e.call(t):a.get(t)),p=(t,a,e)=>{if(a.has(t))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(t):a.set(t,e)},u=(t,a,e,r)=>(h(t,a,"write to private field"),r?r.call(t,e):a.set(t,e),e);function w(t){const a=Object.entries(t).reduce((e,[r,o])=>{if(o!==void 0){const n=Array.isArray(o)?o.join(","):typeof o=="string"?o:String(o);e.push([r,n])}return e},[]);return new URLSearchParams(a)}function x(t,a,e){const r=a.startsWith("/")?a:`/${a}`,o=new URL(r,t);return e&&(o.search=e.toString()),o.toString()}const y=new Map;function L(t){const a=JSON.stringify(t),e=y.get(a);if(e)return e;const r=t.queryParams?w(t.queryParams):void 0,o=x(window.galaxyInfo.proxy_url,t.path,r),n=v({url:o,headers:{"x-galaxy-key":window.galaxyInfo.proxy_key}});return y.set(a,n),n}async function v(t){const a=await fetch(t.url,{method:"GET",headers:{...t.headers}});if(!a.ok){const r=await a.json();throw new Error(`HTTP error! status: ${a.status}. Check devtools "Network" tab to see more details about this failing call.
3${JSON.stringify(r,null,"	")}`)}return await a.json()}const S=3*60*1e3;let c,i;const A=()=>{if(c!==void 0)return c;try{const a=JSON.parse(sessionStorage.getItem("gms_profil_data")??"{}").tierCode;return c=typeof a=="string"?a:void 0,i&&window.clearTimeout(i),i=window.setTimeout(()=>{R()},S),c}catch(t){console.error("getMemberTier error",t);return}},R=()=>{c=void 0,i&&(window.clearTimeout(i),i=void 0)},E=()=>{if(!(!window.glxTcLeadRateConfig||typeof window.glxTcLeadRateConfig!="object")&&"memberRateType"in window.glxTcLeadRateConfig&&!(!window.glxTcLeadRateConfig.memberRateType||typeof window.glxTcLeadRateConfig.memberRateType!="string"))switch(window.glxTcLeadRateConfig.memberRateType){case"private-offer":case"gms":return window.glxTcLeadRateConfig.memberRateType;default:console.warn('glx-tc-lead-rate: Invalid configuration, window.glxTcLeadRateConfig.memberRateType should have value "private-offer" or "gms". Current value is:',window.glxTcLeadRateConfig.memberRateType);return}},M=["config","data-state"];var l;class b extends HTMLElement{constructor(){super();p(this,l,!1);this.updateRateForUser=this.updateRateForUser.bind(this)}static get observedAttributes(){return M}setLoadingUiState(e){this.setAttribute("data-state",e)}removeComponent(){this.setAttribute("data-empty","true")}connectedCallback(){this.initLazyLoading()}cleanIfHasNoFallback(){var r;const e=this.querySelector("glx-tc-lead-rate-value");(!e||!((r=e.textContent)!=null&&r.trim().length))&&this.removeComponent()}setCurrencyCode(e){e&&this.querySelectorAll("glx-tc-lead-rate-currency-code").forEach(r=>{r.textContent=e})}appendChildLeadRateComponent(e,r,o=!1){const n=this.querySelector(e);n&&(n.innerHTML=r,o&&n.setAttribute("data-has-member-rate","true"))}initLazyLoading(){const e={root:null,rootMargin:"700px"};new IntersectionObserver((r,o)=>{r[0].isIntersecting&&(this.fetchAndProcess(),o.unobserve(this))},e).observe(this)}updateRateForUser(){g(this,l)&&this.fetchAndProcess()}fetchAndProcess(){u(this,l,!0);const e=this.getAttribute("config");if(e){this.setLoadingUiState("loading");const r=JSON.parse(e),o=r.hotelCodes,n=A(),C=E(),m={daysAhead:r.daysAhead,roomTypeCodes:r.roomTypeCodes?[r.roomTypeCodes]:void 0,legacyDisplay:!0,adults:r.adults,memberTier:n,memberRate:C};L({path:`/tc/shop/v1/hotel/${o}/leadrate`,queryParams:m}).then(d=>{var f;const s=d[0];s.available?(s.minRateDisplay&&this.appendChildLeadRateComponent("glx-tc-lead-rate-value",s.minRateDisplay,!!((f=s.memberMinRateDisplay)!=null&&f.length)),s.memberMinRateDisplay&&this.appendChildLeadRateComponent("glx-tc-lead-rate-member-value",s.memberMinRateDisplay),s.strikeThroughRateDisplay&&this.appendChildLeadRateComponent("glx-tc-lead-rate-strike-value",s.strikeThroughRateDisplay),this.setCurrencyCode(s.currencyCode)):(console.debug(`[rate-proxy] API Lead rate does not return rate for: ${JSON.stringify({hotel:o,room:m.roomTypeCodes})}. Component will use fallback value if available`),this.cleanIfHasNoFallback())}).catch(d=>{throw this.cleanIfHasNoFallback(),new Error(d)}).finally(()=>this.setLoadingUiState("ready"))}else this.setLoadingUiState("ready"),this.cleanIfHasNoFallback()}disconnectedCallback(){u(this,l,!1)}}l=new WeakMap;class k extends HTMLElement{constructor(){super()}}class U extends HTMLElement{constructor(){super()}}class I extends HTMLElement{constructor(){super()}}customElements.define("glx-tc-lead-rate",b);customElements.define("glx-tc-lead-rate-value",U);customElements.define("glx-tc-lead-rate-member-value",k);customElements.define("glx-tc-lead-rate-strike-value",I);function T(){if(R(),!!!document.querySelector("glx-tc-lead-rate-member-value"))return;
3document.querySelectorAll("glx-tc-lead-rate").forEach(e=>{e instanceof b&&e.updateRateForUser()})}document.addEventListener("EVT_AMA_HOS_GMS_LOGIN",T);document.addEventListener("EVT_AMA_HOS_GMS_LOGOUT",T);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.