PageSourceSearch

https://nitrouscompetitions.com/_next/static/chunks/4274-1c9fbbf6b46edb3a.js

js nitrouscompetitions.com collected 2026-10-05 22:28:25 UTC 18,947 bytes, 53 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4274],{24274:(e,t,r)=>{r.d(t,{l:()=>l,openWpPayModal:()=>y,wpTesterProbe:()=>i});var o=r(41635);let a=null;async function n(){try{let{data:e}=await o.ND.auth.getSession(),t=e?.session?.access_token;return t?{authorization:`Bearer ${t}`}:null}catch{return null}}async function i(e){if(a&&!e)return a;let t={tester:!1};if(!function(){try{let e=String(window.location.hostname||"").toLowerCase();return"nitrousportal.com"===e||"www.nitrousportal.com"===e||"localhost"===e||"127.0.0.1"===e}catch{return!1}}())return a=t;let r=await n();if(!r)return t;try{let e=await fetch("/api/wp-tester/config",{headers:r,cache:"no-store"});if(!e.ok)return a=t;let o=await e.json();if(!o?.ok||!o?.tester)return a=t;return a={tester:!0,...o}}catch{return a=t}}async function l(e,t){let r=await n()||{},o=await fetch(e,{method:"POST",headers:{"content-type":"application/json",...r},body:JSON.stringify(t||{})});return o.json().catch(()=>({ok:!1,error:`HTTP ${o.status}`}))}function d(e){return String(null==e?"":e).replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}let s=null,p=null;async function c(){let e,{startRegistration:t}=await r.e(6383).then(r.bind(r,26383)),o=await l("/api/wp-tester/passkey",{op:"register-options"});if(!o.ok)return{ok:!1,error:o.error};try{e=await t({optionsJSON:o.options})}catch(e){return{ok:!1,error:e?.name==="NotAllowedError"?"Fingerprint setup cancelled.":e?.message||String(e)}}return l("/api/wp-tester/passkey",{op:"register-verify",response:e})}async function u(){let e,{startAuthentication:t}=await r.e(6383).then(r.bind(r,26383)),o=await l("/api/wp-tester/passkey",{op:"auth-options"});if(!o.ok)return{ok:!1,none:!!o.none,error:o.error};try{e=await t({optionsJSON:o.options})}catch(e){return{ok:!1,error:e?.name==="NotAllowedError"?"Fingerprint cancelled.":e?.message||String(e)}}return l("/api/wp-tester/passkey",{op:"auth-verify",response:e})}async function y(e){let t=await i();if(!t.tester)return{ok:!1,error:"not the tester"};let r=t.config||{},o=t.env||"test",a=Math.round(Number(e.amountPence)||0)||500*!!e.topup,n=null,y=!!(e.container&&1===e.container.nodeType),m=!!e.deferred&&"function"==typeof e.prepare,w=null,g=async()=>w&&w.ok?w:(w=await e.prepare())||{ok:!1,error:"Could not prepare the order."},f=async()=>{if(e.topup){if(a<500)return{ok:!1,error:"Minimum top-up is \xa35."};if(n)return{ok:!0,orderIds:[n]};let t=await e.startTopup(a);return t&&t.ok?{ok:!0,orderIds:[n=t.orderIds&&t.orderIds[0]||t.orderId]}:t||{ok:!1,error:"Could not start top-up."}}if(!m)return{ok:!0,orderIds:e.orderIds};let t=await g();return t.ok?{ok:!0,orderIds:t.payOrderIds,prepared:t}:t},b="orders"===e.kind&&t.savedCard&&t.savedCard.last4,h=(()=>{try{return document.getElementById("full_name")?.value?.trim()||""}catch{return""}})(),k=(()=>{try{return document.getElementById("postcode")?.value?.trim()||""}catch{return""}})(),x="display:grid;gap:5px;font-size:12.5px;font-weight:700;color:#9aa5b4;letter-spacing:.02em",v="width:100%;box-sizing:border-box;padding:12px;border-radius:8px;border:1px solid #3c4152;background:#fff;color:#111;font:16px system-ui",C="background:#fff;border-radius:8px;height:46px;padding:2px 8px;box-sizing:border-box",P=`
2  <div style="background:#14161c;color:#eee;border:1px solid #2a2e3a;border-radius:14px;${y?"width:100%;max-width:none;margin:6px 0":"max-width:430px;width:100%"};padding:18px;font:14px system-ui">
3    <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:10px">
4      <b style="font-size:16px">${d(e.title||"Pay by card")}</b>
5      ${m?"":`<button id="wpt-close" type="button" style="background:none;border:0;color:#aaa;font-size:${y?"13px":"20px"};cursor:pointer">${y?"cancel":"✕"}</button>`}
6    </div>
7    <div style="margin-bottom:12px;color:#bbb"><span id="wpt-amt-line">Total: <b style="color:#fff">\xa3${(a/100).toFixed(2)}</b></span></div>
8    ${e.topup?`
9    <div id="wp-topup-amts" style="display:grid;grid-template-columns:repeat(5,1fr);gap:6px;margin-bottom:8px">
10      ${[5,10,20,50,100].map(e=>`<button type="button" class="wp-amt" data-a="${e}" style="padding:10px 2px;border:1px solid #3c4152;border-radius:10px;background:#1b1f29;color:#fff;font-weight:800;font-size:13px;
10cursor:pointer">\xa3${e}</button>`).join("")}
11    </div>
12    <label style="${x};margin-bottom:12px">OR ENTER AN AMOUNT (\xa35 min)
13      <input id="wp-amt-input" type="number" min="5" step="1" inputmode="numeric" placeholder="e.g. 15" style="${v}" />
14    </label>`:""}
15    ${b?`
16    <button id="wp-quickpay" type="button" style="width:100%;padding:12px;border:1px solid #d4af37;border-radius:10px;background:#241f10;color:#ffd97a;font-weight:800;font-size:14px;cursor:pointer;margin-bottom:12px">
17      ⚡ Pay with saved ${d(t.savedCard.scheme||"card")} ••${d(t.savedCard.last4)}${t.hasPasskey?" (fingerprint)":""}
18    </button>`:""}
19    <form id="wp-card-form" autocomplete="off" onsubmit="return false">
20      <div style="display:grid;gap:12px">
21        <label style="${x}">NAME ON CARD
22          <input id="wp-name" name="wp-cardholder-name" type="text" autocomplete="cc-name" placeholder="As printed on the card" value="${d(h)}" style="${v}" />
23        </label>
24        <label style="${x}">CARD NUMBER
25          <div id="wp-pan" style="${C}"></div>
26        </label>
27        <div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px">
28          <label style="${x}">EXPIRY
29            <div id="wp-expiry" style="${C}"></div>
30          </label>
31          <label style="${x}">CVC
32            <div id="wp-cvv" style="${C}"></div>
33          </label>
34          <label style="${x}">POSTCODE
35            <input id="wp-postcode" name="wp-billing-postcode" type="text" autocomplete="postal-code" placeholder="Billing" value="${d(k)}" style="${v};padding:12px 10px;text-transform:uppercase" />
36          </label>
37        </div>
38      </div>
39      <button id="wp-pay" type="button" style="margin-top:14px;width:100%;padding:12px;border:0;border-radius:10px;background:#d4af37;color:#111;font-weight:800;font-size:15px;cursor:pointer;${m?"display:none":""}">Pay \xa3${(a/100).toFixed(2)}</button>
40    </form>
41    <div id="wpt-wallets" style="display:grid;gap:8px;margin-top:10px">
42      <button id="wp-googlepay" type="button" style="width:100%;padding:11px;border:1px solid #3c4152;border-radius:10px;background:#000;color:#fff;font-weight:700;cursor:pointer">G Pay \xb7 Google Pay</button>
43      <button id="wp-applepay" type="button" style="width:100%;padding:11px;border:1px solid #3c4152;border-radius:10px;background:#000;color:#fff;font-weight:700;cursor:pointer"> Pay \xb7 Apple Pay</button>
44      <button id="wp-openbanking" type="button" style="width:100%;padding:11px;border:1px solid #3c4152;border-radius:10px;background:#0a2a4a;color:#fff;font-weight:700;cursor:pointer">🏦 Pay by Bank (Open Banking)</button>
45    </div>
46    ${b&&!t.hasPasskey?`
47    <button id="wp-enable-fp" type="button" style="width:100%;margin-top:8px;padding:8px;border:0;background:none;color:#8fb3ff;font-size:12.5px;cursor:pointer;text-decoration:underline">🔒 Enable fingerprint checkout on this device</button>`:""}
48    <div id="wp-status" style="font-size:13px"></div>
49  </div>`,S=null,$;y?(e.container.innerHTML=P,$=e.container):((S=document.createElement("div")).style.cssText="position:fixed;inset:0;background:rgba(0,0,0,.65);display:flex;align-items:center;justify-content:center;z-index:99998;padding:12px",S.innerHTML=P,document.body.appendChild(S),$=S);let A=(e,t)=>{let r=$.querySelector("#wp-status");r&&(r.innerHTML=e?`<div style="margin:10px 0;color:${"err"===t?"#ff7b7b":"ok"===t?"#7bd88f":"warn"===t?"#ffd27b":"#bbb"}">${e}</div>`:"")},E=()=>{try{S?S.remove():e.container.innerHTML=""}catch(e){}"function"==typeof e.onClose&&e.onClose()},I=$.querySelector("#wpt-close");if(I&&(I.onclick=E),e.topup){let e=$.querySelector("#wpt-amt-line"),t=Array.from($.querySelectorAll(".wp-amt")),r=$.querySelector("#wp-amt-input"),o=e=>t.forEach(t=>{t.style.outline=100*Number(t.dataset.a)===e?"2px solid #d4af37":"none"}),i=t=>{a=Math.max(0,Math.round(t)),n=null,e&&(e.innerHTML=`Total: <b style="color:#fff">\xa3${(a/100).toFixed(2)}</b>`);let r=$.querySelector("#wp-pay");r&&(r.textContent=`Pay \xa3${(a/100).toFixed(2)}`),o(a)};t.forEach(e=>{e.onclick=()=>{r&&(r.value=""),i(100*Number(e.dataset.a))}}),r&&(r.oninput=()=>{let e=parseFloat(r.value);Number.isFinite(e)&&e>=5?i(Math.round(100*e)):o(-1)}),i(a)}let T=t=>"membership"===e.kind?{kind:"membership",invoiceId:e.invoiceId}:{kind:"orders",orderIds:t},M=t=>
49{A("✅ Payment confirmed.","ok"),setTimeout(()=>{E(),e.onSuccess&&e.onSuccess(t,w)},700)},N=e=>{A(`❌ ${d(e?.error||e?.outcome||"Payment failed")}`,"err")};r.ready||(A(`⚠️ No ${o} WorldPay keys configured — open your <b>WorldPay panel</b> and save the ${o} credentials first.`,"warn"),$.querySelector("#wp-pay").disabled=!0);let D=$.querySelector("#wp-quickpay");D&&(D.onclick=async()=>{D.disabled=!0;try{let e=await f();if(!e.ok)return void A(d(e.error||"Could not reserve your tickets."),"err");A("Charging your saved card…","");let t=await l("/api/wp-tester/token/pay",T(e.orderIds));if(t.needAuth){A("Confirm with your fingerprint…","");let r=await u();if(!r.ok)return void A("Fingerprint: "+d(r.error||"not verified"),"err");A("Charging your saved card…",""),t=await l("/api/wp-tester/token/pay",T(e.orderIds))}t.ok?M(t):N(t)}catch(e){A("Quick-pay error: "+d(e?.message||e),"err")}finally{D.disabled=!1}});let R=$.querySelector("#wp-enable-fp");R&&(R.onclick=async()=>{R.disabled=!0;try{A("Setting up fingerprint checkout — follow your device's prompt…","");let e=await c();e.ok?(A("✅ Fingerprint checkout enabled on this device.","ok"),R.remove(),await i(!0)):A("Fingerprint setup: "+d(e.error||"failed"),"err")}finally{R.disabled=!1}});let _=null;if(r.ready)try{var q;let e=await (q=r.sdkUrl,p&&p!==q?Promise.reject({__needsReload:!0}):s||(s=new Promise((e,t)=>{if(window.Worldpay)return p=q,e(window.Worldpay);let r=document.createElement("script");r.src=q,r.async=!0,r.onload=()=>{window.Worldpay?(p=q,e(window.Worldpay)):t(Error("Worldpay SDK loaded but window.Worldpay missing"))},r.onerror=()=>{s=null,t(Error("Failed to load WorldPay SDK"))},document.head.appendChild(r)})));await new Promise(t=>{try{e.checkout.init({id:r.checkoutId,form:"#wp-card-form",fields:{pan:{selector:"#wp-pan",placeholder:"Card number"},expiry:{selector:"#wp-expiry",placeholder:"MM/YY"},cvv:{selector:"#wp-cvv",placeholder:"CVC"}},styles:{input:{color:"#111","font-size":"16px"}}},(e,r)=>{e?A("Card fields failed to load: "+d(e.message||e),"err"):_=r,t()})}catch(e){A("WorldPay init error: "+d(e?.message||e),"err"),t()}})}catch(e){if(e&&e.__needsReload)return A("Switching payment environment — reloading…",""),setTimeout(()=>window.location.reload(),600),{close:E};A("Could not load the WorldPay SDK: "+d(e?.message||e),"err")}async function O(){if(!_)return A("Card fields not ready yet.","err"),{ok:!1};let t=$.querySelector("#wp-pay");t&&(t.disabled=!0,t.textContent="Processing…");try{var r,o;let t=($.querySelector("#wp-name")?.value||"").trim(),a=($.querySelector("#wp-postcode")?.value||"").trim().toUpperCase();if(!t)return A("Enter the name on the card.","err"),{ok:!1};if(!a)return A("Enter the card's billing postcode.","err"),{ok:!1};let n=await f();if(!n.ok)return A(d(n.error||"Could not reserve your tickets."),"err"),{ok:!1};A("Securing card details…","");let{session:i,err:s}=await new Promise(e=>{try{_.generateSessionState((t,r)=>e({session:t||!r?null:r,err:t}))}catch(t){e({session:null,err:t})}});if(!i)return A("Card check failed — make sure number, expiry and CVC are complete."+(s?.message?` (${d(s.message)})`:""),"err"),{ok:!1};A("Starting 3D Secure…","");let p=await l("/api/wp-tester/3ds/initialize",{sessionHref:i,browser:function(){let e="0";try{e=String(new Date().getTimezoneOffset())}catch(e){}let t=!1;try{t="function"==typeof navigator.javaEnabled&&navigator.javaEnabled()}catch(e){}return{userAgent:navigator.userAgent||"",language:navigator.language||"en-GB",screenHeight:window.screen&&screen.height||1080,screenWidth:window.screen&&screen.width||1920,colorDepth:window.screen&&screen.colorDepth||24,timeZone:e,javaEnabled:t}}(),saveCard:!1!==e.saveCard,cardHolderName:t,billingPostcode:a,...T(n.orderIds)});if(p.terminal)return p.ok?M(p):N(p),{ok:!!p.ok};if(!p.ok)return N(p),{ok:!1};let c=p.reference,u=null;p.deviceDataCollection&&p.deviceDataCollection.url&&(A("Verifying your device with your bank…",""),u=await (r=p.deviceDataCollection,new Promise(e=>{let t=`/api/worldpay-test/3ds/ddc?url=${encodeURIComponent(r.url)}&jwt=${encodeURIComponent(r.jwt)}
49&bin=${encodeURIComponent(r.bin||"")}`,o=document.createElement("iframe");o.style.cssText="width:1px;height:1px;border:0;position:absolute;left:-9999px",o.src=t;let a=!1,n=t=>{if(!a){a=!0,window.removeEventListener("message",i);try{o.remove()}catch(e){}e(t)}},i=e=>{let t=e.data;if("string"==typeof t)try{t=JSON.parse(t)}catch(e){return}t&&"profile.completed"===t.MessageType&&n(t.SessionId||null)};window.addEventListener("message",i),document.body.appendChild(o),setTimeout(()=>n(null),11e3)})));let y=p.actions&&p.actions.supply3dsDeviceData;if(!y)return A("3D Secure error: no device-data step returned.","err"),{ok:!1};A("Authenticating…","");let m=await l("/api/wp-tester/3ds/action",{href:y,body:{collectionReference:u},reference:c,...T(n.orderIds)});if("3dsChallenged"===m.outcome&&m.challenge){if(A("Waiting for your bank's verification…",""),!await (o=m.challenge,new Promise(e=>{let t=o.reference||"",r=`/api/worldpay-test/3ds/challenge?url=${encodeURIComponent(o.url)}&jwt=${encodeURIComponent(o.jwt)}&md=${encodeURIComponent(t)}`,a=document.createElement("div");a.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,.6);display:flex;align-items:center;justify-content:center;z-index:100000",a.innerHTML=`<div style="background:#fff;border-radius:12px;padding:10px;max-width:440px;width:92%">
50      <div style="font:600 13px system-ui;color:#111;margin:2px 6px 8px">Your bank needs to verify this payment</div>
51      <iframe title="3D Secure" style="width:100%;height:460px;border:0" src="${r}"></iframe>
52      <div style="text-align:right"><button id="wpt3ds-cancel" style="margin-top:8px;padding:6px 12px;border:1px solid #ccc;border-radius:8px;background:#f4f4f4;cursor:pointer">Cancel</button></div>
53    </div>`;let n=!1,i=t=>{if(!n){n=!0,window.removeEventListener("message",l);try{a.remove()}catch(e){}e(t)}},l=e=>{"nitrous-3ds-complete"===e.data&&i(!0)};window.addEventListener("message",l),document.body.appendChild(a),a.querySelector("#wpt3ds-cancel").onclick=()=>i(!1)})))return A("3D Secure challenge cancelled.","warn"),{ok:!1};let e=m.actions&&m.actions.complete3dsChallenge;if(!e)return A("3D Secure error: no completion link.","err"),{ok:!1};A("Finishing payment…",""),m=await l("/api/wp-tester/3ds/action",{href:e,body:{},reference:c,...T(n.orderIds)})}return m.ok?M(m):N(m),{ok:!!m.ok}}catch(e){return A("Payment error: "+d(e?.message||e),"err"),{ok:!1}}finally{t&&(t.disabled=!1,t.textContent=`Pay \xa3${(a/100).toFixed(2)}`)}}let z=$.querySelector("#wp-pay");z&&!m&&(z.onclick=O);let F=$.querySelector("#wp-googlepay");if(r.googlePayReady){let e="live"===o?"PRODUCTION":"TEST",t={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["MASTERCARD","VISA","AMEX"]}},n={...t,tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:r.googlePayGateway||"worldpay",gatewayMerchantId:r.googlePayGatewayMerchantId||""}}},i=null;F.onclick=async()=>{F.disabled=!0;try{let o=await f();if(!o.ok)return void A(d(o.error||"Could not reserve your tickets."),"err");A("Opening Google Pay…",""),await new Promise((e,t)=>{if(window.google&&window.google.payments)return e();let r=document.createElement("script");r.src="https://pay.google.com/gp/p/js/pay.js",r.async=!0,r.onload=e,r.onerror=()=>t(Error("Could not load Google Pay")),document.head.appendChild(r)}),i||(i=new window.google.payments.api.PaymentsClient({environment:e}));let s=await i.isReadyToPay({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[t]});if(!s||!s.result)return void A("Google Pay isn't available on this device/browser.","warn");let p=await i.loadPaymentData({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[n],transactionInfo:{totalPriceStatus:"FINAL",totalPrice:(a/100).toFixed(2),currencyCode:"GBP",countryCode:"GB"},merchantInfo:{merchantName:"Nitrous Competitions",...r.googlePayMerchantId?{merchantId:r.googlePayMerchantId}:{}}}),c=p?.paymentMethodData?.tokenizationData?.token;if(!c)return void A("Google Pay returned no token.","err");A("Authorising with WorldPay…","");let u=await l("/api/wp-tester/wallet/googlepay",{walletToken:c,...T(o.orderIds)});u.ok?M(u):N(u)}catch(e){e&&("CANCELED"===e.statusCode||/cancel/i.test(e?.message||""))?A("Google Pay cancelled.","warn"):A("Google Pay error: "+d(e?.message||JSON.stringify(e)),"err")}finally{F.disabled=!1}}}else F.style.display="none";let U=$.querySelector("#wp-openbanking");"orders"===e.kind&&r.open_banking?(U.textContent="\uD83C\uDFE6 Pay by Bank — Coming Soon",U.disabled=!0,U.style.opacity="0.55",U.style.cursor="not-allowed",U.title="Open Banking is being enabled — coming soon."):U.style.display="none";let L=$.querySelector("#wp-applepay"),j=window.ApplePaySession&&ApplePaySession.canMakePayments&&ApplePaySession.canMakePayments();return r.applePayReady&&j?L.onclick=async()=>{let e,t=await f();if(!t.ok)return void A(d(t.error||"Could not reserve your tickets."),"err");let r={countryCode:"GB",currencyCode:"GBP",supportedNetworks:["visa","masterCard","amex"],merchantCapabilities:["supports3DS"],total:{label:"Nitrous Competitions",amount:(a/100).toFixed(2)}};try{e=new ApplePaySession(3,r)}catch(e){A("Apple Pay could not start: "+d(e?.message||e),"err");return}e.onvalidatemerchant=async t=>{try{let r=await l("/api/wp-tester/wallet/applepay/validate",{val
53idationURL:t.validationURL});if(!r.ok){A("Apple Pay: "+d(r.error||"merchant validation failed"),r.notConfigured?"warn":"err"),e.abort();return}e.completeMerchantValidation(r.merchantSession)}catch(t){A("Apple Pay validation error: "+d(t?.message||t),"err");try{e.abort()}catch(e){}}},e.onpaymentauthorized=async r=>{try{let o=r.payment&&r.payment.token,a=o&&o.paymentData,n=(o&&o.paymentMethod&&(o.paymentMethod.displayName||"")).replace(/\D+/g,"").slice(-4),i=await l("/api/wp-tester/wallet/applepay",{walletToken:a,fpanLastFour:n,...T(t.orderIds)});e.completePayment(i.ok?ApplePaySession.STATUS_SUCCESS:ApplePaySession.STATUS_FAILURE),i.ok?M(i):N(i)}catch(t){try{e.completePayment(ApplePaySession.STATUS_FAILURE)}catch(e){}A("Apple Pay error: "+d(t?.message||t),"err")}},e.oncancel=()=>A("Apple Pay cancelled.","warn"),e.begin()}:L.style.display="none",{close:E,payCard:O,setStatus:A}}}}]);

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.