PageSourceSearch

https://plans.choiceplan.co.uk/_next/static/chunks/pages/payment-a60455c6a5155a62.js

js choiceplan.co.uk collected 2026-10-07 22:49:55 UTC 9,443 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8252],{2642:function(e,r,t){"use strict";t.d(r,{_:function(){return p}});var n,o,i,l,s=t(7294),a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t.g?t.g:"undefined"!=typeof self?self:{},d={},c={};n=a&&a.__rest||function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>r.indexOf(n)&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>r.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]]);return t},Object.defineProperty(c,"__esModule",{value:!0}),c.scripts=void 0,c.scripts={},o=function(e){var r=document.querySelector('script[src="'+e+'"]');if(r)return c.scripts[e]={loading:!1,error:null,scriptEl:r}},c.default=function(e){var r=e.src,t=e.checkForExisting,l=void 0!==t&&t,a=n(e,["src","checkForExisting"]),d=r?c.scripts[r]:void 0;!d&&l&&r&&i&&(d=o(r));var u=(0,s.useState)(d?d.loading:!!r),f=u[0],p=u[1],x=(0,s.useState)(d?d.error:null),m=x[0],g=x[1];return(0,s.useEffect)(function(){if(i&&r&&f&&!m){(d=c.scripts[r])||!l||(d=o(r)),d?e=d.scriptEl:((e=document.createElement("script")).src=r,Object.keys(a).forEach(function(r){void 0===e[r]?e.setAttribute(r,a[r]):e[r]=a[r]}),d=c.scripts[r]={loading:!0,error:null,scriptEl:e});var e,t=function(){d&&(d.loading=!1),p(!1)},n=function(e){d&&(d.error=e),g(e)};return e.addEventListener("load",t),e.addEventListener("error",n),document.body.appendChild(e),function(){e.removeEventListener("load",t),e.removeEventListener("error",n)}}},[r]),[f,m]},i="undefined"!=typeof window&&void 0!==window.document,l=a&&a.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Object.defineProperty(d,"__esModule",{value:!0}),d.scripts=d.default=void 0,Object.defineProperty(d,"default",{enumerable:!0,get:function(){return l(c).default}}),Object.defineProperty(d,"scripts",{enumerable:!0,get:function(){return c.scripts}});var u=d&&d.__esModule&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d,f=function(){},p=function(e){var r=e.initialiseURL||"https://pay.gocardless.com/billing/static/dropin/v2/initialise.js",t=u({src:window.GoCardlessDropin?null:r,checkForExisting:!0}),n=t[0],o=t[1],i=(0,s.useState)(o),l=i[0],a=i[1],d=(0,s.useState)(void 0),c=d[0],p=d[1];return(0,s.useEffect)(function(){if(!n){if(o){a(o);return}if(!window.GoCardlessDropin){a(new ErrorEvent("error loading GoCardless Dropin initialise script from "+r+": failed to find window.GoCardlessDropin after load!"));return}c&&c.exit(),p(window.GoCardlessDropin.create(e))}},[n,o,e.billingRequestFlowID,a]),{error:null===l?void 0:l,ready:!!c,exit:(null==c?void 0:c.exit)||f,open:(null==c?void 0:c.open)||f}}},5054:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/payment",function(){return t(1047)}])},3903:function(e,r,t){"use strict";var n=t(5893),o=t(7294),i=t(1604),l=t(7319),s=t(6905),a=t(2088);r.Z=e=>{let{label:r,disabled:t,className:c,placeholder:u,initialValue:f,onValueUpdate:p,onErrorUpdate:x,required:m,helpMessage:g,id:h,initialError:y,onblur:v,hideTopBorder:b=!1,hideError:w=!1}=e,[j,C]=(0,o.useState)(f||""),[_,E]=(0,o.useState)(Number(f)||0),[S,N]=(0,o.useState)(null),[O,P]=(0,o.useState)(y||""),[k,Z]=(0,o.useState)(null),T=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(void 0!==f){let e=q(f);C(e),E(Number(f))}},[f]),(0,o.useEffect)(()=>{void 0!==p&&p(_)},[_]),(0,o.useEffect)(()=>{void 0!==x&&x(O)},[O]);let D=i.z.string().regex(/^\d*\.?\d{0,2}$/,{message:"Only digits 0-9 are allowed"}).transform(e=>e.replace(/,/g,"")).transform(e=>Number(e)).refine(e=>e<=1e4,{message:"Amount must not be greater than \xa310,000"}).refine(e=>!isNaN(e),{message:"Invalid number"}),q=e=>e.replace(/\B(?=(\d{3})+(?!\d))/g,","),F=e=>{let r=e.replace(/,/g,""),t=D.safeParse(r);if(t.success){P(""),E(t.data);let e=q(r);C(e)}else P(t.error.issues[0].message)},M=e=>{F(e)},B=()=>{!t&&T.current&&T.current.focus()};return(0,n.jsxs)("div",{className:"flex flex-col",children:[r&&(0,n.jsx)(l.Z,{htmlFor:h||r,label:r,required:m,hideTopBorder:b}),(0,n.jsxs)("div",{className:"group relative flex flex-row items-center space-x-[10px] w-full\n                h-[50px] xl:h-[60px] rounded-[3px] border px-[20px] xl:px-[25px]\n								hover:bg-grey-50\n                ".concat(S?"border-tertiary ring-[5px] ring-tertiary/20 fill-tertiary cursor-pointer":t?"border-grey-500 fill-grey-500 hover:bg-white cursor-not-allowed":_>0?"border-tertiary fill-tertiary cursor-pointer":O?"border-red bg-red/5":"border-grey-500 fill-grey-900 hover:fill-tertiary cursor-pointer hover:border-tertiary","\n                "),onClick:()=>B(),children:[(0,n.jsx)("span",{className:"text-field-sm xl:text-field-lg font-semibold font-montserrat ".concat(O&&"fill-tertiary"),role:"presentation",onClick:()=>{void 0!==T.current&&null!==T.current&&T.current.focus()},children:(0,n.jsx)(d,{})}),(0,n.jsx)("input",{id:h,type:"text",ref:T,inputMode:"numeric",onBlur:()=>{N(!1),p&&p(_),v&&v()},onFocus:()=>N(!0),disabled:t,placeholder:u,value:j,onChange:e=>M(e.target.value),className:"".concat(c||"","  focus:outline-none w-full bg-transparent text-tertiary placeholder:text-grey-700 disabled:text-grey-500 appearance-none\n								cursor-pointer disabled:cursor-not-allowed\n            ")})]}),!w&&O&&(0,n.jsx)(a.Z,{error:O}),g&&(0,n.jsx)(s.Z,{helpMessage:g})]})};let d=()=>(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"18",viewBox:"0 0 14 18",children:(0,n.jsx)("path",{d:"M12.8333 15.5H3.4615C4.6445 13.937 5.243 12.486 5.54634 
110.5H10.5C11.1452 10.5 11.6667 10.053 11.6667 9.5C11.6667 8.947 11.1452 8.5 10.5 8.5H5.74467C5.817 7.359 5.83333 6.055 5.83333 4.5C5.83333 3.396 6.87867 2.5 8.16667 2.5C9.45467 2.5 10.5 3.396 10.5 4.5C10.5 5.053 11.0215 5.5 11.6667 5.5C12.3118 5.5 12.8333 5.053 12.8333 4.5C12.8333 2.294 10.7392 0.5 8.16667 0.5C5.59417 0.5 3.5 2.294 3.5 4.5C3.5 6.1 3.4755 7.396 3.40433 8.5H1.16667C0.5215 8.5 0 8.947 0 9.5C0 10.053 0.5215 10.5 1.16667 10.5H3.18383C2.80233 12.762 1.97517 14.037 0.255502 15.875C-0.0186646 16.176 -0.0770018 16.588 0.116665 16.934C0.310332 17.28 0.722167 17.5 1.16667 17.5H12.8333C13.4785 17.5 14 17.053 14 16.5C14 15.947 13.4785 15.5 12.8333 15.5Z"})})},1047:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return m}});var n=t(5893),o=t(6323),i=t(7294),l=t(2642),s=t(5895),a=t(3903),d=t(9865),c=t(1598),u=t(2088),f=t(2481),p=t(6196);let x=e=>{let{open:r}=(0,l._)({...e});return(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,n.jsxs)("p",{children:["Start Dropin for ",(0,n.jsx)("code",{children:e.billingRequestFlowID})," in"," "]}),(0,n.jsx)("code",{children:e.environment}),(0,n.jsx)(s.Z,{type:"primary",label:"Take Payment",onClick:()=>r()})]})};function m(){let[e,r]=(0,i.useState)(void 0),[t,l]=(0,i.useState)(void 0),[m,g]=(0,i.useState)([]),[h,y]=(0,i.useState)(0),[v,b]=(0,i.useState)(""),[w,j]=(0,i.useState)(-1),[C,_]=(0,i.useState)(""),E=m.map(e=>({label:"".concat(e.term),value:e.term})),S=async()=>{var e;let t=null!==(e=m[w-1].firstMonth)&&void 0!==e?e:m[w-1].monthly,n=await fetch("/api/gocardless/billing-request",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:t,installmentQuote:m[w]})}),o=await n.json();r(o);let i=await fetch("/api/gocardless/billing-flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({customer:{address_line1:"1a Beat Street",address_line2:"London",address_line3:"XYZ",city:"London",email:"[email protected]",given_name:"John",family_name:"Smith",postal_code:"SW11 5AH"},billingRequestId:o.id})}),s=await i.json();l(s)};return(0,n.jsx)(o.Z,{children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex flex-col justify-center w-full rounded border-2 border-grey-400 ",children:[(0,n.jsx)("h1",{className:"text-primary text-heading-sm md:text-heading-xl font-bold",children:"Calculate Your Monthly Funeral Cost"}),m.length>0&&w&&(0,n.jsx)("h3",{children:JSON.stringify(m[w])}),(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-0 md:gap-[15px] items-end",children:[(0,n.jsx)(a.Z,{label:"Your Plan Price",onValueUpdate:e=>{g([]),y(e)},onErrorUpdate:_,hideTopBorder:!0,hideError:!0}),(0,n.jsxs)("div",{className:"flex flex-col md:flex-row gap-[40px] md:gap-[10px]",children:[(0,n.jsx)(d.Z,{id:"",label:"Date of Birth",onValueUpdate:e=>{g([]),b(e)},onErrorUpdate:_,hideTopBorder:!0,hideError:!0}),(0,n.jsx)("div",{className:"w-full md:w-1/2 flex items-end",children:(0,n.jsx)(s.Z,{label:"Click",onClick:()=>{if(g([]),""!==v&&10===v.length&&0!==h){j(-1);let e=(0,f.PT)(v);(0,p.V8)({cost:h,age:e,dob:v,term:4}).then(e=>{e.error?(_(e.error),g([])):e.quotes[0].total>0&&(_(""),g(e.quotes))}).catch(e=>console.log(e))}}})})]})]}),m.length>
10&&(0,n.jsx)(c.Z,{id:"name",total:h,quotes:m,label:"Choose over how many years you would like to pay for your plan.",showMonthlyDetails:w>0,options:E,onValueUpdate:j,initialValue:w}),C&&(0,n.jsx)(u.Z,{error:C})]}),m.length>0&&-1!==w&&(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)(s.Z,{label:"Start Payment",onClick:S})}),e&&t&&m.length>0&&-1!==w&&(0,n.jsx)(x,{billingRequestFlowID:t.id,environment:"sandbox",onSuccess:async(e,r)=>{},onExit:()=>{}}),(0,n.jsx)("div",{className:"mb-10"}),(0,n.jsx)("div",{className:"mb-10"})]})})}}},function(e){e.O(0,[6323,9774,2888,179],function(){return e(e.s=5054)}),_N_E=e.O()}]);

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.