1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7943],{7943:function(r,t,e){e.d(t,{OrganisationSessionProvider:function(){return O},o:function(){return F}});var n=e(7437),o=e(2628),i=e(3070),l=e(9663);class a{async byId(r){return await this.organisationRepository.getOrganisation(r)}async current(){let r=window.location.hostname.split("."),t=window.location.pathname.replace("/","");return await this.organisationRepository.getCurrentOrganisation(r[0],t)}constructor(){this.organisationRepository=new l.b}}var s=e(3464),u=e(5515),d=e.n(u);class c{static single(r){if((null==r?void 0:r.id)===void 0)throw Error("Enterprise has no id.");return{id:null==r?void 0:r.id,name:null==r?void 0:r.enterprise_name,logoUrl:null==r?void 0:r.logo_url,primaryColor:null==r?void 0:r.primary_color,fontFamily:null==r?void 0:r.font_family,secondaryColor:null==r?void 0:r.secondary_color,nameForOrganisation:null==r?void 0:r.name_for_organisation,nameForOrganisations:null==r?void 0:r.name_for_organisations,enterpriseId:null==r?void 0:r.enterprise_id,isMainPortal:null==r?void 0:r.is_main_portal}}}class p{async getEnterprise(r){let t="".concat(this.url,"/").concat(r);try{var e,n,o;let r=await (0,s.Z)(t);if(null===r||(null===(e=r.data)||void 0===e?void 0:e.enterprise)===void 0||(null===(n=r.data)||void 0===n?void 0:n.enterprise)===null)return null;return c.single(null===(o=r.data)||void 0===o?void 0:o.enterprise)}catch(r){throw Error("Error fetching enterprise")}}async getCurrentEnterprise(r){let t="".concat(this.url,"/current");try{var e,n;let o=await (0,s.Z)(t,{params:{domain:r}});if(null===o||(null===(e=o.data)||void 0===e?void 0:e.enterprise)===void 0)return d().fire("error","Could not load enterprise","error"),null;return c.single(null===(n=o.data)||void 0===n?void 0:n.enterprise)}catch(r){return null}}constructor(){this.url="".concat("https://webapi2-v1.tkos.co.uk/public_portal_api","/enterprises")}}class v{async byId(r){return await this.enterpriseRepository.getEnterprise(r)}async current(){let r=window.location.hostname;return await this.enterpriseRepository.getCurrentEnterprise(r)}constructor(){this.enterpriseRepository=new p}}class m{static single(r){if((null==r?void 0:r.id)===void 0)throw Error("Brand has no id.");return{id:null==r?void 0:r.id,name:null==r?void 0:r.name,logoUrl:null==r?void 0:r.brand_logo_url,primaryColor:null==r?void 0:r.fo_primary_colour,secondaryColor:null==r?void 0:r.fo_secondary_colour,tertiaryColor:null==r?void 0:r.fo_tertiary_colour}}}class g{async getCurrentBrand(r){let t="".concat(this.url,"/current");try{var e,n;let o=await (0,s.Z)(t,{params:{domain:r}});if(null===o||(null===(e=o.data)||void 0===e?void 0:e.brand)===void 0)return d().fire("error","Could not load brand","error"),null;return m.single(null===(n=o.data)||void 0===n?void 0:n.brand)}catch(r){return null}}constructor(){this.url="".concat("https://webapi2-v1.tkos.co.uk/public_portal_api","/brands")}}class y{async current(){let r=window.location.hostname;return await this.brandRepository.getCurrentBrand(r)}constructor(){this.brandRepository=new g}}var h=r=>{document.documentElement.style.setProperty("--bs-body-font-family",r)},f=e(9653),_=e(2832),w=e.n(_);let b=r=>{let t="#FFFFFF"===r?"#7fc45e":r;(0,f._j)(.15,t),(0,f.DZ)(.92,t)},E=r=>{let t="#FFFFFF"===r?"#3A2555":r,e=(0,f._j)(.15,t),n=(0,f.$n)(.2,t),o=(0,f.DZ)(.5,t),i=(0,f.DZ)(.8,t),l=(0,f.DZ)(.92,t);if(document.documentElement.style.setProperty("--primary-color",t),document.documentElement.style.setProperty("--primary-color-dark",e),document.documentElement.style.setProperty("--primary-color-muted",n),document.documentElement.style.setProperty("--primary-color-opacity-50",o),document.documentElement.style.setProperty("--primary-color-opacity-20",i),document.documentElement.style.setProperty("--primary-color-opacity-08",l),r.startsWith("rgb")){let t=r.replace("rgb(","").replace(")","");document.documentElement.style.setProperty("--bs-primary-rgb",t)}else r.startsWith("#")&&document.documentElement.style.setProperty("--bs-primary-rgb",w().hex.rgb(t).toString());let a=".form-switch .form-check-input:focus:not(:checked) { --bs-form-switch-bg: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='".concat(encodeURIComponent(t),"'/%3e%3c/svg%3e\"); }"),s=document.createElement("style");document.head.appendChild(s);let u=s.sheet;null==u||u.insertRule(a,null==u?void 0:u.cssRules.length)};var C=e(8926),S=e(2265),A=e(9376);let I=(0,S.createContext)({organisation:null,enterprise:null,brand:null,setOrganisation:()=>{},setCurrentOrganisation:()=>{},changeOrganisation:()=>{},setEnterprise:()=>{}});function F(){return(0,S.useContext)(I)}let k=["/","/giving","/login","donors/find-your-parish"];function O(r){let{children:t}=r,[e,l]=(0,S.useState)(null),[s,u]=(0,S.useState)(null),[c,p]=(0,S.useState)(null),m=(0,A.usePathname)(),g=async()=>{(null==e?void 0:e.publicUrl)&&(null==e||!e.publicUrl||m.includes(null==e?void 0:e.publicUrl))||(l(null),o.X.clear());let r=new a;await r.current().then(r=>{l(r),r&&r.primaryColor&&E(r.primaryColor)}).catch(()=>{d().fire("Error","Error loading organisation","error")})},f=async r=>{let t=new a;await t.byId(r).then(r=>{l(r),r&&r.primaryColor&&E(r.primaryColor)}).catch(()=>{d().fire("Error","Error changing organisation","error")})},_=async()=>{let r=new a,t=o.X.get();t?t&&await r.byId(parseInt(t["current-organisation-id"],10)).then(r=>l(r)).catch(()=>{d().fire("Error","Error loading organisation","error")}):await r.current().then(r=>l(r)).catch(()=>{d().fire("Error","Error loading organisation","error")})},w=async r=>{let t=new v,e=i.A.get();r||!e?await t.current().then(r=>u(r)).catch(()=>{d().fire("Error","Error loading enterprise","error")}):await t.byId(parseInt(e["current-enterprise-portal-id"],10)).then(r=>u(r)).catch(()=>{d().fire("Error","Error loading enterprise","error")})},F=async()=>{let r=new y;await r.current().then(r=>{p(r)}).catch(()=>{d().fire("Error","Error loading brand","error")})};(0,S.useEffect)(()=>{globalThis.window&&(k.includes(m)&&(l(null),o.X.clear()),w(!0),_(),F())},[]),(0,S.useEffect)(()=>{e&&(o.X.set(e.id),(0,C.vD)(e),!e.primaryColor||(null==c?void 0:c.primaryColor)||E(e.primaryColor))},[e]),(0,S.useEffect)(()=>{s&&(i.A.set(s.id),!s.primaryColor||(null==c?void 0:c.primaryColor)||E(s.primaryColor),s.fontFamily&&h(s.fontFamily))},[s]),(0,S.useEffect)(()=>{k.includes(m)&&i.A.isStored()?(l(null),o.X.clear()):_()},[m]),(0,S.useEffect)(()=>{(null==c?void 0:c.primaryColor)&&E(c.primaryColor),(null==c?void 0:c.tertiaryColor)&&b(c.tertiaryColor)},[c]);let O=(0,S.useMemo)(()=>({organisation:e,enterprise:s,brand:c,setOrganisation:l,setCurrentOrganisation:g,changeOrganisation:f,setEnterprise:u}),[e,s,c]);return(0,n.jsx)(I.Provider,{value:O,children:t})}},3070:function(r,t,e){e.d(t,{A:function(){return n}});
1class n{static set(r){localStorage.setItem("current-enterprise-portal-id",r.toString())}static clear(){n.hasCurrentEnterprise()&&localStorage.removeItem("current-enterprise-portal-id")}static isStored(){return null!==localStorage.getItem("current-enterprise-portal-id")}static get(){if("undefined"==typeof localStorage)return!1;let r=localStorage.getItem("current-enterprise-portal-id");return null!==r&&{"current-enterprise-portal-id":r}}static hasCurrentEnterprise(){let r=n.get();return!!r&&void 0!==r["current-enterprise-portal-id"]}}},6525:function(r,t,e){e.d(t,{v:function(){return n}});class n{static single(r){if((null==r?void 0:r.id)===void 0)throw Error("Organisation has no id.");let t={id:null==r?void 0:r.id,name:null==r?void 0:r.organisation_name,nameAlt:null==r?void 0:r.organisation_name_alt,publicUrl:null==r?void 0:r.public_url,contactEmail:null==r?void 0:r.contact_email,contactNumber:null==r?void 0:r.contact_number,contactNumberAlt:null==r?void 0:r.contact_number_alt,enterpriseId:null==r?void 0:r.enterprise_id,publicStripeId:null==r?void 0:r.public_portal_stripe_id,primaryColor:null==r?void 0:r.primary_color,lat:null==r?void 0:r.lat,lng:null==r?void 0:r.lng,description:null==r?void 0:r.description,descriptionExtra:null==r?void 0:r.description_extra,isChild:null==r?void 0:r.is_child,isParent:null==r?void 0:r.is_parent,parent:(null==r?void 0:r.parent)!==0?n.single(null==r?void 0:r.parent):null,secondaryColor:null==r?void 0:r.secondary_color,customFields:null==r?void 0:r.custom_fields,fontFamily:null==r?void 0:r.font_family,registered:null==r?void 0:r.pgs_registered,parishCode:null==r?void 0:r.parish_code,addressLine:null==r?void 0:r.address_line1,addressLineAlt:null==r?void 0:r.address_line1_alt,addressLine2:null==r?void 0:r.address_line2,county:null==r?void 0:r.county,town:null==r?void 0:r.town,country:null==r?void 0:r.country,countryAlt:null==r?void 0:r.country_alt,postCode:null==r?void 0:r.postcode,postCodeAlt:null==r?void 0:r.postcode_alt,diocese:null==r?void 0:r.diocese,website:null==r?void 0:r.website,websiteAlt:null==r?void 0:r.website_alt,acnyUrl:null==r?void 0:r.acny,phone:null==r?void 0:r.phone,photoUrl:null==r?void 0:r.photo,displayAmount:["Fixed","Open","Both"].includes(null==r?void 0:r.display_amount)?r.display_amount:"Both"},e=r=>r.reduce((r,t)=>{if(!t)return r;let e=t.trim();return e?r?r.toLowerCase().includes(e.toLowerCase())?r:"".concat(r).concat(r?"\n":"").concat(e):e:r},""),o=[t.addressLine2,t.town,t.county];return t.addressString=e([t.addressLine,...o,t.postCode,t.country]),t.addressStringAlt=e([t.addressLineAlt,...o,t.postCodeAlt,t.countryAlt]),t}static multiple(r){return Array.isArray(r)?r.map(r=>this.single(r)):[]}}},2628:function(r,t,e){e.d(t,{X:function(){return n}});class n{static set(r){localStorage.setItem("current-organisation-id",r.toString())}static clear(){n.hasCurrentOrganisation()&&localStorage.removeItem("current-organisation-id")}static isStored(){return null!==localStorage.getItem("current-organisation-id")}static get(){if("undefined"==typeof localStorage)return!1;let r=localStorage.getItem("current-organisation-id");return null!==r&&{"current-organisation-id":r}}static hasCurrentOrganisation(){let r=n.get();return!!r&&void 0!==r["current-organisation-id"]}}},9663:function(r,t,e){e.d(t,{b:function(){return a}});var n=e(3464),o=e(5515),i=e.n(o),l=e(6525);class a{async getOrganisation(r){let t="".concat(this.url,"/").concat(r);try{var e,o,i;let r=await (0,n.Z)(t);if(null===r||(null===(e=r.data)||void 0===e?void 0:e.organisation)===void 0||(null===(o=r.data)||void 0===o?void 0:o.organisation)===null)return null;return l.v.single(null===(i=r.data)||void 0===i?void 0:i.organisation)}catch(r){throw Error("Error fetching organisation")}}async getCurrentOrganisation(r,t){let e="".concat(this.url,"/current");try{var o,a;let r=await (0,n.Z)(e,{params:{pathname:t}});if(null===r||(null===(o=r.data)||void 0===o?void 0:o.organisation)===void 0)return i().fire("error","Could not load organisation","error"),null;return l.v.single(null===(a=r.data)||void 0===a?void 0:a.organisation)}catch(r){return null}}async createRegisteredInterest(r,t){let e="".concat(this.url,"/create_registered_interest");try{return(await n.Z.post(e,{organisation_id:r,registered_email:t})).status||null}catch(r){if(n.Z.isAxiosError(r)){var o,l,a,s;(null==r?void 0:null===(l=r.response)||void 0===l?void 0:null===(o=l.data)||void 0===o?void 0:o.message)&&i().fire("Error","".concat(null==r?void 0:null===(s=r.response)||void 0===s?void 0:null===(a=s.data)||void 0===a?void 0:a.message),"error")}else i().fire("Error","Error registering interest for this Organisation","error");return null}}constructor(){this.url="".concat("https://webapi2-v1.tkos.co.uk/public_portal_api","/organisations")}}},8926:function(r,t,e){let n;e.d(t,{BA:function(){return c},FW:function(){return p},km:function(){return m},vD:function(){return v}});var o=e(3464),i=e(2360);let l="".concat("https://webapi2-v1.tkos.co.uk/public_portal_api","/stripe"),a="".concat(l,"/donor"),s="".concat(l,"/payment_intent"),u="".concat(l,"/subscription"),d="".concat(l,"/public_key"),c=async r=>{let t={email:null==r?void 0:r.emailAddress,name:"".concat(null==r?void 0:r.firstName," ").concat(null==r?void 0:r.lastName)};return o.Z.post(a,t).then(r=>{var t;return null==r?void 0:null===(t=r.data)||void 0===t?void 0:t.id})},p=async(r,t,e,n,i,l)=>{var a;let d={preferences:l,amount:r,donation_type:i,donor_data:{id:t,email_address:null==e?void 0:e.emailAddress,title:null==e?void 0:e.title,first_name:null==e?void 0:e.firstName,last_name:null==e?void 0:e.lastName,address:n,phone_number:(null==e?void 0:null===(a=e.contactTelephone)||void 0===a?void 0:a.trim())||void 0}};return await o.Z.post(1===i?s:u,d).then(r=>{var t,e;return{clientSecret:null==r?void 0:null===(t=r.data)||void 0===t?void 0:t.client_secret,contactPaymentId:null==r?void 0:null===(e=r.data)||void 0===e?void 0:e.contact_payment_id}})};async function v(r){let t=r.publicStripeId,e=await o.Z.get(d).then(r=>{var t;return null==r?void 0:null===(t=r.data)||void 0===t?void 0:t.public_key});n=t?(0,i.J)(e,{stripeAccount:t}):(0,i.J)(e)}let m=()=>n}}]);
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.