1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1261],{61261:(e,a,r)=>{r.d(a,{createDayPassLead:()=>s}),r(62886);var t=r(63486);let s=async e=>{try{let r,s,n,o=null;if(e.studioId)o=e.studioId;else{var a;if(!(o="mcfit"===e.brand?"7633104410":(a=e.brand,"mcfit"===a?"7633104410":null)))return{success:!1,message:"No studio ID configured for brand: ".concat(e.brand,". Day passes require studio configuration to create Magicline leads.")}}let c=e.daypassId||e.transactionId||"unknown",i=e.firstName||"DayPass",l=e.lastName||"Customer-".concat(c.slice(-8));if(e.sourceCampaignId)try{let a=await (0,t.ME)(parseInt(o)),s=null==a?void 0:a.find(a=>{let{externalIdentifier:r}=a;return r===e.sourceCampaignId});r=null==s?void 0:s.id}catch(e){throw Error("Failed to lookup campaign: ".concat(e))}let d={studioId:parseInt(o),firstname:i,lastname:l,email:e.email,...r&&{sourceCampaignId:r}};if(JSON.stringify(d),e.baseUrl){let e="https://rsg-group.api.magicline.com/connect/v1";e||console.error("NEXT_PUBLIC_MAGICLINE_API_URL environment variable is not set"),s="".concat(e,"/lead"),n={"Content-Type":"application/json"}}else s="/api/lead",n={"Content-Type":"application/json"};let u=await fetch(s,{method:"POST",headers:n,body:JSON.stringify(d)});if(u.ok){let e=await u.json();return{success:!0,customerNumber:e.customerNumber}}try{let e=await u.text();throw JSON.parse(e),Error("Failed to create day pass lead: ".concat(e))}catch(e){throw Error("Could not parse error response: ".concat(e))}return{success:!1,message:"Failed to create lead: ".concat("Unknown error")}}catch(e){return{success:!1,message:e instanceof Error?e.message:"Unknown error - expected for day passes with minimal data"}}}}}]);
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.