PageSourceSearch

https://locreach.ai/static/js/1396.f63cd008.chunk.js

js locreach.ai collected 2026-10-05 12:14:35 UTC 57,906 bytes, 2 lines download raw bytes

1"use strict";(globalThis.webpackChunkinfluencer_finder_frontend=globalThis.webpackChunkinfluencer_finder_frontend||[]).push([[1396,4409],{1396:(e,t,i)=>{i.r(t),i.d(t,{default:()=>he});var o=i(5043),n=i(3216),a=i(5475),s=i(3003),r=i(8334),l=i(5456),c=i(5423),d=i(4409),u=(i(3138),i(5582)),m=i(7709),p=i(1034),g=i(3895),h=i(4531),v=i(8877),b=i(8550),f=i(579);const A=e=>null==e?"":String(e).trim(),y=e=>A(e).startsWith(":"),N=e=>{const t=A(e);if(!t||y(t))return"";const i=A((0,u._M)(t));return i&&!y(i)?i:""},_=e=>String(e||"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9-]/g,"").slice(0,64),E=e=>String(e||"").trim(),j=e=>{const t=E(e);if(!t)return!1;try{const e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol}catch{return!1}},x=e=>{const t=A(e).toLowerCase();return!t||/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t)},C=e=>{const t=String(null!==e&&void 0!==e?e:"").trim();if(!t)return Number.NaN;const i=Number(t);return Number.isFinite(i)?i:Number.NaN},S=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=A(e);if(!i)return i;const o=i.indexOf("#"),n=o>=0?i.slice(0,o):i,a=o>=0?i.slice(o):"",s=n.indexOf("?"),r=s>=0?n.slice(0,s):n,l=s>=0?n.slice(s+1):"",c=new URLSearchParams(l);Object.entries(t).forEach(e=>{let[t,i]=e;const o=A(i);o?c.set(t,o):c.delete(t)});const d=c.toString();return`${r}${d?`?${d}`:""}${a}`},P=e=>N((null===e||void 0===e?void 0:e.offerId)||(null===e||void 0===e?void 0:e.offer_id)||(null===e||void 0===e?void 0:e.id)||(null===e||void 0===e?void 0:e._id)||""),T=Object.freeze([0,250,650,1200]),I=e=>new Promise(t=>{e?window.setTimeout(t,e):t()}),O=(e,t)=>{const i=N(t);return i&&Array.isArray(e)&&e.find(e=>{return N((null===(t=e)||void 0===t?void 0:t.offerId)||(null===t||void 0===t?void 0:t.offer_id)||(null===t||void 0===t?void 0:t.id)||(null===t||void 0===t?void 0:t._id)||"")===i;var t})||null},k=e=>{var t,i,o,n,a,s,r,l,c;return[null===e||void 0===e?void 0:e.message,null===e||void 0===e?void 0:e.error,null===e||void 0===e?void 0:e.details,null===e||void 0===e||null===(t=e.payload)||void 0===t?void 0:t.message,null===e||void 0===e||null===(i=e.payload)||void 0===i?void 0:i.error,null===e||void 0===e||null===(o=e.response)||void 0===o||null===(n=o.data)||void 0===n?void 0:n.message,null===e||void 0===e||null===(a=e.response)||void 0===a||null===(s=a.data)||void 0===s?void 0:s.error,null===e||void 0===e||null===(r=e.response)||void 0===r?void 0:r.message,null===e||void 0===e||null===(l=e.data)||void 0===l?void 0:l.message,null===e||void 0===e||null===(c=e.data)||void 0===c?void 0:c.error].filter(
1Boolean).some(e=>String(e).toLowerCase().includes("offer code already exists"))},R=(e,t)=>{const i=_(e||"PROMO").replace(/-\d+$/,""),o=`-${t+1}`,n=Math.max(1,64-o.length),a=i.slice(0,n)||"PROMO";return _(`${a}${o}`)},w=async e=>{let{dispatch:t,payload:i}=e;const o=_((null===i||void 0===i?void 0:i.code)||"PROMO");let n=null;for(let s=0;s<6;s+=1){const e=0===s?o:R(o,s);try{return{created:await t((0,b.d3)({...i,code:e})).unwrap(),finalCode:e,codeChanged:e!==o}}catch(a){if(n=a,!k(a)||5===s)throw a}}throw n||new Error("Failed to create promotion.")},L=async e=>{let{dispatch:t,campaignId:i,createdOfferId:o}=e;const n=N(i),a=N(o);if(!n||!a)return null;for(const s of T){await I(s);try{const e=await t((0,b.eN)({params:{campaignId:n,limit:100},append:!1})).unwrap(),i=O(null===e||void 0===e?void 0:e.items,a);if(i)return i}catch{}}return null},M=e=>Object.fromEntries(Object.entries(e||{}).filter(e=>{let[,t]=e;return null!=t&&("string"===typeof t?A(t).length>0:!Array.isArray(t)||t.length>0)})),U=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];for(const o of t){const e=A(o);if(e)return e}return""},B=e=>A(e).toLowerCase().replace(/\b[a-z]/g,e=>e.toUpperCase()),G=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;return A(e).replace(/[_-]+/g," ").replace(/[^a-zA-Z0-9\s]/g," ").split(/\s+/).filter(Boolean).slice(0,t).join(" ")},V=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e&&"object"===typeof e&&!Array.isArray(e)?e:{},i=M({source:U(t.source,t.campaignSource,t.campaign_source),suggestionId:U(t.suggestionId,t.suggestion_id,t.selectedDemandSuggestionId,t.selected_demand_suggestion_id),businessName:U(t.businessName,t.business_name),businessType:U(t.businessType,t.business_type),city:U(t.city),postcode:U(t.postcode),radiusMiles:Number(t.radiusMiles||t.radius_miles||0)||void 0,productOrService:U(t.productOrService,t.product_or_service),targetCustomer:U(t.targetCustomer,t.target_customer),campaignDescription:U(t.campaignDescription,t.campaign_description),offerIdea:U(t.offerIdea,t.offer_idea),creatorType:U(t.creatorType,t.creator_type),creatorCategory:U(t.creatorCategory,t.creator_category),localAngle:U(t.localAngle,t.local_angle),suggestionConfidence:U(t.suggestionConfidence,t.suggestion_confidence)});return!i.source&&i.suggestionId&&(i.source="ai_demand_suggestion"),i},D=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Boolean((null===e||void 0===e?void 0:e.offerIdea)||(null===e||void 0===e?void 0:e.productOrService)||(null===e||void 0===e?void 0:e.targetCustomer)||(null===e||void 0===e?void 0:e.creatorType)||(null===e||void 0===e?void 0:e.localAngle)||(null===e||void 0===e?void 0:e.campaignDescription))},F=e=>{var t,i;const o=e&&"object"===typeof e&&e.data?e.data:e;return o&&"object"===typeof o?o.campaign||o.item||(null===(t=o.data)||void 0===t?void 0:t.campaign)||(null===(i=o.data)||void 0===i?void 0:i.item)||o.data||o:{}},$=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=null!==e&&void 0!==e&&e.campaignStrategy&&"object"===typeof e.campaignStrategy?e.campaignStrategy:null!==e&&void 0!==e&&e.campaign_strategy&&"object"===typeof e.campaign_strategy?e.campaign_strategy:{};return V({...t,campaignSource:e.campaignSource||e.campaign_source||t.source,selectedDemandSuggestionId:e.selectedDemandSuggestionId||e.selected_demand_suggestion_id||t.suggestionId||t.suggestion_id,businessName:e.businessName||e.business_name,businessType:e.businessType||e.business_type,city:e.city,postcode:e.postcode,radiusMiles:e.radiusMiles||e.radius_miles,productOrService:e.productOrService||e.product_or_service,targetCustomer:e.targetCustomer||e.target_customer,campaignDescription:e.campaignDescription||e.campaign_description,offerIdea:e.offerIdea||e.offer_idea,creatorType:e.creatorType||e.creator_type,creatorCategory:e.creatorCategory||e.creator_category,localAngle:e.localAngle||e.local_angle,suggestionConfidence:e.suggestionConfidence||e.suggestion_confidence})},W=Object.freeze({LOCREACH_PAGE:"LOCREACH_PAGE",EXTERNAL_URL:"EXTERNAL_URL",SOCIAL_OR_LOCAL_PROFILE:"SOCIAL_OR_LOCAL_PROFILE"}),H=Object.freeze({CLAIM_OFFER:"CLAIM_OFFER",VISIT_PAGE:"VISIT_PAGE",BOOKING_LINK:"BOOKING_LINK",CALL_BUSINESS:"CALL_BUSINESS",SEND_WHATSAPP:"SEND_WHATSAPP",OPEN_INSTAGRAM:"OPEN_INSTAGRAM",OPEN_GOOGLE_MAPS:"OPEN_GOOGLE_MAPS"}),K=Object.freeze({AVERAGE_BOOKING_VALUE:"AVERAGE_BOOKING_VALUE"}),q=new Set(["image/jpeg","image/png","image/webp"]),z=e=>e?q.has(e.type)?e.size>3145728?"Image must be 3MB or smaller.":"":"Use a JPG, PNG or WebP image.":"",Y=[{value:W.LOCREACH_PAGE,label:"Create a LocReach offer page",badge:"Recommended",description:"Recommended when the business does not have a website."},{value:W.EXTERNAL_URL,label:"Use my website or booking page",badge:"",description:"Use a product, menu, booking, Shopify, or offer page."},{value:W.SOCIAL_OR_LOCAL_PROFILE,label:"Use Instagram, WhatsApp or Google",badge:"",description:"Use a social profile, Google Business Profile, WhatsApp, or contact link."}],X=[{value:H.CLAIM_OFFER,label:"Claim or request details"},{value:H.BOOKING_LINK,label:"Reserve or book"},{value:H.VISIT_PAGE,label:"Visit page"},{value:H.CALL_BUSINESS,label:"Call business"},{value:H.SEND_WHATSAPP,label:"Send WhatsApp"},{value:H.OPEN_INSTAGRAM,label:"Open Instagram"},{value:H.OPEN_GOOGLE_MAPS,label:"Open Google Maps"}],Z=e=>e===W.EXTERNAL_URL||e===W.SOCIAL_OR_LOCAL_PROFILE,J=e=>e!==H.CLAIM_OFFER,Q=e=>{const t=A(e);if(!t)return!1;const i=t.replace(/\D/g,"");return i.length>=7&&i.length<=15},ee=e=>{const t=A(e);return!!t&&(!!j(t)||/^@?[A-Za-z0-9._]{2,30}$/.test(t))},te=(e,t)=>
1{const i=A(t);if(!J(e))return!i||j(i)||Q(i)||ee(i);if(!i)return!1;switch(e){case H.CALL_BUSINESS:return Q(i);case H.SEND_WHATSAPP:return Q(i)||j(i);case H.OPEN_INSTAGRAM:return ee(i);case H.OPEN_GOOGLE_MAPS:case H.VISIT_PAGE:default:return j(i)}},ie=(e,t)=>{const i=A(t);if(!i)return"";if(j(i))return E(i);switch(e){case H.CALL_BUSINESS:return`tel:${i.replace(/[^\d+]/g,"")}`;case H.SEND_WHATSAPP:return`https://wa.me/${i.replace(/\D/g,"")}`;case H.OPEN_INSTAGRAM:return`https://instagram.com/${i.replace(/^@/,"")}`;default:return i}},oe=e=>{switch(e){case H.CALL_BUSINESS:return"Business phone number";case H.SEND_WHATSAPP:return"WhatsApp number or link";case H.OPEN_INSTAGRAM:return"Instagram username or link";case H.OPEN_GOOGLE_MAPS:return"Google Maps link";case H.BOOKING_LINK:return"Booking page";case H.VISIT_PAGE:return"Website or booking page";default:return"Optional contact or website link"}},ne=e=>{switch(e){case H.CALL_BUSINESS:return"e.g. +44 20 1234 5678";case H.SEND_WHATSAPP:return"e.g. +44 7700 900123";case H.OPEN_INSTAGRAM:return"e.g. @yourbusiness";case H.OPEN_GOOGLE_MAPS:return"https://maps.google.com/...";case H.BOOKING_LINK:return"https://your-booking-page.com/reserve";case H.VISIT_PAGE:return"https://your-site.com/book";default:return"Instagram, WhatsApp, Google profile, or website"}},ae=e=>e===H.CALL_BUSINESS||e===H.SEND_WHATSAPP?"tel":e===H.OPEN_INSTAGRAM?"text":"url",se=e=>{const t=X.find(t=>t.value===e);return(null===t||void 0===t?void 0:t.label)||"Claim or request details"},re=e=>{const t=(e=>{const t=A(e);return t?`locreach:campaignStrategy:${t}`:""})(e);if(!t)return{};try{const e=sessionStorage.getItem(t);if(!e)return{};const i=JSON.parse(e);if(!i||"object"!==typeof i)return{};const o=Number(i.savedAt||0);return o&&Date.now()-o>36e5?(sessionStorage.removeItem(t),{}):V({...i.campaignStrategy&&"object"===typeof i.campaignStrategy?i.campaignStrategy:{},campaignSource:i.campaignSource,selectedDemandSuggestionId:i.selectedDemandSuggestionId})}catch{return{}}},le=e=>{const t=e.get("strategy")||e.get("campaignStrategy")||"";if(t)try{const e=(0,u._M)(t),i=JSON.parse(e),o=V(i);if(D(o))return o}catch{}const i=V({source:e.get("campaignSource"),suggestionId:e.get("selectedDemandSuggestionId"),businessName:e.get("businessName"),businessType:e.get("businessType"),city:e.get("
1city"),postcode:e.get("postcode"),productOrService:e.get("productOrService"),targetCustomer:e.get("targetCustomer"),campaignDescription:e.get("campaignDescription"),offerIdea:e.get("offerIdea"),creatorType:e.get("creatorType"),creatorCategory:e.get("creatorCategory"),localAngle:e.get("localAngle"),suggestionConfidence:e.get("suggestionConfidence")});return D(i)?i:{}},ce=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=G(e.offerIdea,9),i=G(e.productOrService,6),o=G(e.city,2),n=G(e.targetCustomer,3);return t&&(a=e.offerIdea,!/creator|influencer|share with|audience|shoutout|partner with|promote/i.test(A(a)))&&t.length<=72?B(t):o&&i?`${B(o)} ${B(i)} Offer`:i&&n?`${B(i)} for ${B(n)}`:i?`${B(i)} Local Offer`:t?B(t):"";var a},de=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=G(e.city,1).toUpperCase(),i=G(e.productOrService,2).toUpperCase(),o=G(e.businessType,1).toUpperCase();return(_(`${t}${i||o}`)||"LOCREACH").slice(0,18)},ue=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=`${e.offerIdea||""} ${e.campaignDescription||""} ${e.productOrService||""}`.toLowerCase(),i=t.match(/(\d+(?:\.\d+)?)\s*%/);if(i){const e=Number(i[1]);if(Number.isFinite(e)&&e>0&&e<=100)return{discountType:"PERCENT",discountValue:String(e),reason:"Detected from the selected campaign idea.",confidence:"high"}}const o=t.match(/(?:\xa3|gbp\s*)(\d+(?:\.\d+)?)/i);if(o){const e=Number(o[1]);if(Number.isFinite(e)&&e>0)return{discountType:"AMOUNT",discountValue:String(e),reason:"Detected from the selected campaign idea.",confidence:"high"}}return/free\s+(setup|demo|consultation|call|audit)|local promotion tracking setup|promotion tracking setup/.test(t)?{discountType:"PERCENT",discountValue:"100",reason:"Suggested because this is positioned as a free setup, demo, or consultation offer.",confidence:"high"}:/free\s+(sample|trial)|sample|tasting|trial|add[-\s]?on|bundle/.test(t)?{discountType:"PERCENT",discountValue:"10",reason:"Suggested default because the idea mentions a sample, tasting, bundle, trial, or customer incentive. Edit before creating if needed.",confidence:"medium"}:/event|party|celebration|birthday|family|weekend/.test(t)?{discountType:"PERCENT",discountValue:"15",reason:"Suggested default for a local event or celebration campaign. Edit before creating if needed.",confidence:"medium"}:{discountType:"PERCENT",discountValue:"10",reason:"Suggested safe default to reduce setup friction. Edit before creating if needed.",confidence:"low"}}(e);return{title:ce(e),code:de(e),discountType:t.discountType,discountValue:t.discountValue,discountReason:t.reason,discountConfidence:t.confidence,landingUrl:"",destinationMode:W.LOCREACH_PAGE,customerActionType:H.CLAIM_OFFER,customerActionUrl:"",businessOpeningHours:"",averageBookingValue:"",revenueEstimateMode:"",landingPageEnabled:!0,active:!0,currency:"GBP"}},me=e=>{let{campaignStrategy:t,form:i,campaignId:o}=e;return D(t)?M({...t,campaignId:o,offerTitle:A(i.title),offerCode:_(i.code),landingUrl:Z(i.destinationMode)?E(i.landingUrl):void 0,destinationMode:i.destinationMode,customerActionType:i.customerActionType,customerActionUrl:ie(i.customerActionType,i.customerActionUrl)||void 0,businessOpeningHours:A(i.businessOpeningHours)||void 0,averageBookingValue:Number.isFinite(Number(i.averageBookingValue))?Number(i.averageBookingValue):void 0,revenueEstimateMode:A(i.averageBookingValue)?K.AVERAGE_BOOKING_VALUE:void 0,landingPageEnabled:i.destinationMode===W.LOCREACH_PAGE,discountType:i.discountType,discountValue:A(i.discountValue)}):null};function pe(){return(0,f.jsxs)("section",{className:"oc-helpNotice","aria-label":"How promotion sharing works",children:[(0,f.jsxs)("div",{className:"oc-helpNoticeHead",children:[(0,f.jsx)("span",{className:"badge badge-warn",children:"You stay in control"}),(0,f.jsx)("strong",{children:"What happens after this"})]}),(0,f.jsxs)("div",{className:"oc-helpSteps","aria-label":"Promotion sharing steps",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{children:"1"}),(0,f.jsx)("strong",{children:"Create promotion"}),(0,f.jsx)("small",{children:"Set the offer and customer page."})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{children:"2"}),(0,f.jsx)("strong",{children:"Share links"}),(0,f.jsx)("small",{children:"Use creators, Instagram, WhatsApp, email or LinkedIn."})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{children:"3"}),(0,f.jsx)("strong",{children:"Track results"}),(0,f.jsx)("small",{children:"Review leads, bookings, clicks and redemptions later."})]})]}),(0,f.jsx)("p",{className:"oc-helpNoticeFoot",children:"LocReach creates shareable links, but your team controls where they are shared."})]})}function ge(e){let{strategy:t,form:i,trackingPreview:o,discountReason:n,onFocusLandingUrl:a}=e;if(!D(t))return null;const s=[t.businessType?`Business: ${t.businessType}`:"",t.city||t.postcode?`Area: ${t.city||t.postcode}`:"",t.suggestionConfidence?`Confidence: ${t.suggestionConfidence}
1`:""].filter(Boolean),r=[["Customer promotion",i.title],["Promotion code",_(i.code)],["Promotion",i.discountValue?`${i.discountValue}${"PERCENT"===i.discountType?"%":` ${i.currency||"GBP"}`}`:"Confirm discount"],["Creator fit",t.creatorType],["Local hook",t.localAngle],["Audience",t.targetCustomer]].filter(e=>{let[,t]=e;return A(t)});return(0,f.jsxs)("section",{className:"oc-smartPanel","aria-label":"Smart offer draft",children:[(0,f.jsxs)("div",{className:"oc-smartPanelHead",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("div",{className:"oc-smartEyebrow",children:"AI-assisted promotion setup"}),(0,f.jsx)("h3",{children:"Smart promotion draft from your campaign idea"}),(0,f.jsx)("p",{children:"LocReach converted the selected campaign idea into a customer-facing promotion. Review the details, choose where customers should go, then create tracked links."})]}),(0,f.jsx)("button",{type:"button",className:"btn btn-primary btn-sm",onClick:a,children:"Add landing page"})]}),s.length?(0,f.jsx)("div",{className:"oc-smartChips",children:s.map(e=>(0,f.jsx)("span",{children:e},e))}):null,(0,f.jsx)("div",{className:"oc-smartGrid",children:r.map(e=>{let[t,i]=e;return(0,f.jsxs)("div",{className:"oc-smartItem",children:[(0,f.jsx)("span",{children:t}),(0,f.jsx)("strong",{children:i})]},t)})}),(0,f.jsxs)("div",{className:"oc-smartTracking",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("span",{children:"Creator link preview"}),(0,f.jsx)("strong",{children:o})]}),(0,f.jsx)("p",{children:n||"The discount was suggested from campaign context. Edit it before creating if needed."})]})]})}function he(){var e,t,i,y,T,I,O,k,R,U,B;const G=(0,s.wA)(),q=(0,n.Zp)(),Q=(0,n.zy)(),[ee,ce]=(0,a.ok)(),{toast:de,show:he}=function(){const[e,t]=(0,o.useState)(""),i=(0,o.useRef)(null),n=(0,o.useCallback)(function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1400;t(String(e||""));const n="undefined"!==typeof window?window:null;n&&(i.current&&n.clearTimeout(i.current),i.current=n.setTimeout(()=>t(""),o))},[]);return(0,o.useEffect)(()=>{const e="undefined"!==typeof window?window:null;return()=>{e&&i.current&&e.clearTimeout(i.current),i.current=null}},[]),{toast:e,show:n}}(),ve=(0,h.G)("attributionEnabled"),be=(0,o.useMemo)(()=>le(ee),[ee]),fe=(0,o.useMemo)(()=>{var e,t,i;return V({...be&&"object"===typeof be?be:{},...null!==Q&&void 0!==Q&&null!==(e=Q.state)&&void 0!==e&&e.campaignStrategy&&"object"===typeof Q.state.campaignStrategy?Q.state.campaignStrategy:{},source:(null===Q||void 0===Q||null===(t=Q.state)||void 0===t?void 0:t.campaignSource)||(null===be||void 0===be?void 0:be.source)||(null===be||void 0===be?void 0:be.campaignSource),suggestionId:(null===Q||void 0===Q||null===(i=Q.state)||void 0===i?void 0:i.selectedDemandSuggestionId)||(null===be||void 0===be?void 0:be.suggestionId)||(null===be||void 0===be?void 0:be.suggestion_id)})},[be,null===Q||void 0===Q||null===(e=Q.state)||void 0===e?void 0:e.campaignStrategy,null===Q||void 0===Q||null===(t=Q.state)||void 0===t?void 0:t.campaignSource,null===Q||void 0===Q||null===(i=Q.state)||void 0===i?void 0:i.selectedDemandSuggestionId]),Ae=(0,o.useMemo)(()=>{var e;const t=ee.get("campaignId")||(null===Q||void 0===Q||null===(e=Q.state)||void 0===e?void 0:e.campaignId)||"";return N(t)},[ee,null===Q||void 0===Q||null===(y=Q.state)||void 0===y?void 0:y.campaignId]),[ye,Ne]=(0,o.useState)({}),[_e,Ee]=(0,o.useState)({});(0,o.useEffect)(()=>{Ee(re(Ae))},[Ae]),(0,o.useEffect)(()=>{if(!Ae)return void Ne({});if(D(fe)||D(_e))return void Ne({});let e=!1;return(0,g.tm)(Ae).then(t=>{if(e)return;const i=F(t),o=$(i);Ne(D(o)?o:{})}).catch(()=>{e||Ne({})}),()=>{e=!0}},[Ae,fe,_e]);const je=(0,o.useMemo)(()=>{var e,t;return V({...ye&&"object"===typeof ye?ye:{},..._e&&"object"===typeof _e?_e:{},...fe&&"object"===typeof fe?fe:{},source:(null===Q||void 0===Q||null===(e=Q.state)||void 0===e?void 0:e.campaignSource)||(null===fe||void 0===fe?void 0:fe.source)||(null===fe||void 0===fe?void 0:fe.campaignSource)||(null===_e||void 0===_e?void 0:_e.source)||(null===_e||void 0===_e?void 0:_e.campaignSource)||(null===ye||void 0===ye?void 0:ye.source)||(null===ye||void 0===ye?void 0:ye.campaignSource),suggestionId:(null===Q||void 0===Q||null===(t=Q.state)||void 0===t?void 0:t.selectedDemandSuggestionId)||(null===fe||void 0===fe?void 0:fe.suggestionId)||(null===fe||void 0===fe?void 0:fe.suggestion_id)||(null===_e||void 0===_e?void 0:_e.
1suggestionId)||(null===_e||void 0===_e?void 0:_e.suggestion_id)||(null===ye||void 0===ye?void 0:ye.suggestionId)||(null===ye||void 0===ye?void 0:ye.suggestion_id)})},[ye,_e,fe,null===Q||void 0===Q||null===(T=Q.state)||void 0===T?void 0:T.campaignSource,null===Q||void 0===Q||null===(I=Q.state)||void 0===I?void 0:I.selectedDemandSuggestionId]),xe=(0,o.useMemo)(()=>{var e;return"true"===ee.get("prefillFromCampaignStrategy")||Boolean(null===Q||void 0===Q||null===(e=Q.state)||void 0===e?void 0:e.prefillFromCampaignStrategy)},[ee,null===Q||void 0===Q||null===(O=Q.state)||void 0===O?void 0:O.prefillFromCampaignStrategy]);(0,o.useEffect)(()=>{if(!xe&&Ae)try{sessionStorage.removeItem(`locreach:campaignStrategy:${Ae}`)}catch{}},[Ae,xe]);const Ce=ee.get("returnTo")||"",Se=ee.get("from")||"",Pe=(0,o.useMemo)(()=>(0,u.Fr)(Ce),[Ce]),Te=(0,o.useMemo)(()=>(0,u.Fr)(Se),[Se]),Ie=(0,o.useMemo)(()=>{var e;return(0,u.Fr)(A(null===Q||void 0===Q||null===(e=Q.state)||void 0===e?void 0:e.returnTo))},[null===Q||void 0===Q||null===(k=Q.state)||void 0===k?void 0:k.returnTo]),Oe=(0,o.useMemo)(()=>{var e;return(0,u.Fr)(A(null===Q||void 0===Q||null===(e=Q.state)||void 0===e?void 0:e.from))},[null===Q||void 0===Q||null===(R=Q.state)||void 0===R?void 0:R.from]),ke=(0,o.useMemo)(()=>Pe||Te||Ie||Oe||"",[Pe,Te,Ie,Oe]),Re=(0,o.useMemo)(()=>Ae?(0,u.VL)(u.bw.campaignDetails(Ae),{tab:"offers"}):u.bw.attributionOffers,[Ae]),we=(0,o.useMemo)(()=>ke||Re,[ke,Re]);(0,o.useEffect)(()=>{const e=new URLSearchParams(ee);let t=!1;Pe&&Pe!==Ce&&(e.set("returnTo",Pe),t=!0),!Pe&&ke&&(e.set("returnTo",ke),t=!0),Se&&(e.delete("from"),t=!0),t&&(0,o.startTransition)(()=>{ce(e,{replace:!0})})},[ee,ce,Ce,Se,Pe,ke]);const Le=(0,s.d4)(b.QS),Me=(0,s.d4)(b.xM),Ue=(0,o.useMemo)(()=>{const e=xe?ue(je):{};return{title:e.title||"",code:e.code||"",discountType:e.discountType||"PERCENT",discountValue:e.discountValue||"",landingUrl:"",destinationMode:e.destinationMode||W.LOCREACH_PAGE,customerActionType:e.customerActionType||H.CLAIM_OFFER,customerActionUrl:"",bookingNotificationEmail:"",businessOpeningHours:"",averageBookingValue:"",revenueEstimateMode:"",landingPageEnabled:!0,active:!0,currency:e.currency||"GBP"}},[je,xe]),[Be,Ge]=(0,o.useState)(()=>Ue),[Ve,De]=(0,o.useState)(null),[Fe,$e]=(0,o.useState)(""),[We,He]=(0,o.useState)(""),[Ke,qe]=(0,o.useState)(""),[ze,Ye]=(0,o.useState)(!1),Xe=(0,o.useRef)(null),Ze=(0,o.useRef)(""),Je=(0,o.useMemo)(()=>xe?ue(je):{},[je,xe]),Qe=(0,o.useCallback)(()=>{var e,t,i,o;null===(e=Xe.current)||void 0===e||null===(t=e.focus)||void 0===t||t.call(e),null===(i=Xe.current)||void 0===i||null===(o=i.scrollIntoView)||void 0===o||o.call(i,{block:"center",behavior:"smooth"})},[]),et=(0,o.useMemo)(()=>xe?[Ae,je.suggestionId,je.offerIdea,je.productOrService].filter(Boolean).join("|"):"",[Ae,je,xe]);(0,o.useEffect)(()=>{et&&Ze.current!==et&&(Ze.current=et,Ge(e=>({...e,...Object.fromEntries(Object.entries(Ue).filter(e=>{let[,t]=e;return A(t)})),active:Ue.active,destinationMode:Ue.destinationMode||e.destinationMode,customerActionType:Ue.customerActionType||e.customerActionType,landingPageEnabled:Ue.landingPageEnabled,currency:Ue.currency||e.currency||"GBP"})))},[et,Ue]),(0,o.useEffect)(()=>()=>{Fe&&URL.revokeObjectURL(Fe)},[Fe]);const tt=(0,o.useDeferredValue)(Be.code),it=(0,o.useMemo)(()=>Z(Be.destinationMode),[Be.destinationMode]),ot=(0,o.useMemo)(()=>j(Be.landingUrl),[Be.landingUrl]),nt=(0,o.useMemo)(()=>Be.destinationMode===W.LOCREACH_PAGE&&J(Be.customerActionType),[Be.destinationMode,Be.customerActionType]),at=(0,o.useMemo)(()=>te(Be.customerActionType,Be.customerActionUrl),[Be.customerActionType,Be.customerActionUrl]),st=(0,o.useMemo)(()=>it?Boolean(A(Be.landingUrl))&&ot:at,[it,Be.landingUrl,ot,at]),rt=(0,o.useMemo)(()=>ie(Be.customerActionType,Be.customerActionUrl),[Be.customerActionType,Be.customerActionUrl]),lt=(0,o.useMemo)(()=>it?E(Be.landingUrl):"",[it,Be.landingUrl]),ct=(0,o.useMemo)(()=>C(Be.discountValue),[Be.discountValue]),dt=(0,o.useMemo)(()=>!!Number.isFinite(ct)&&(!(ct<=0)&&!("PERCENT"===Be.discountType&&ct>100)),[ct,Be.discountType]),ut=(0,o.useMemo)(()=>x(Be.bookingNotificationEmail),[Be.bookingNotificationEmail]),mt=(0,o.useMemo)(()=>{const e=A(Be.averageBookingValue);if(!e)return!0;const t=Number(e);return Number.isFinite(t)&&t>=0},[Be.averageBookingValue]),pt=(0,o.useMemo)(()=>!!A(Be.title)&&(!!A(Be.code)&&(!!st&&(!!dt&&(!!ut&&(!!mt&&(!Le&&!ze)))))),[Be,st,dt,ut,mt,Le,ze]),gt=(0,o.useMemo)(()=>{let e=0;return A(Be.title)||(e+=1),A(Be.code)||(e+=1),dt||(e+=1),st||(e+=1),ut||(e+=1),e},[Be.title,Be.code,dt,st,ut]),ht=(0,o.useMemo)(()=>{const e=_(tt)||"CODE";return(0,m.q)(e)},[tt]),vt=(0,o.useCallback)(e=>{const{name:t,value:i,type:n,checked:a}=e.target;(0,o.startTransition)(()=>{Ge(e=>({...e,[t]:"checkbox"===n?a:"code"===t?_(i):"discountValue"===t?i.replace(/[^\d.]/g,""):i}))}),Me&&G((0,b.Sb)())},[Me,G]),bt=(0,o.useCallback)(e=>{var t;const i=(null===(t=e.target.files)||void 0===t?void 0:t[0])||null;if(Fe&&URL.revokeObjectURL(Fe),!i)return De(null),$e(""),void qe("");const o=z(i);if(o)return e.target.value="",De(null),$e(""),qe(o),void he(o,1800);De(i),$e(URL.createObjectURL(i)),qe(""),A(We)||He(A(Be.title)||"Promotion image")},[We,Fe,Be.title,he]),ft=(0,o.useCallback)(()=>{Fe&&URL.revokeObjectURL(Fe),De(null),$e(""),qe("")},[Fe]);(0,o.useEffect)(()=>()=>{G((0,b.Sb)())},[G]);const At=(0,o.useCallback)(()=>{q(we,{replace:!0})},[q,we]),yt=(0,o.useCallback)(()=>{var e;const t=document.getElementById("offer-create-form");null===t||void 0===t||null===(e=t.requestSubmit)||void 0===e||e.call(t)},[]),Nt=(0,o.useCallback)(e=>{const t=document.getElementById(e);t&&(t.scrollIntoView({behavior:"smooth",block:"center"}),window.setTimeout(()=>{var e;null===(e=t.focus)||void 0===e||e.call(t,{preventScroll:!0})},120))},[]),_t=(0,o.useCallback)(async e=>{if(e.preventDefault(),pt)try{var t,i;const e=M({...Ae?{campaignId:Ae}:{},title:A(Be.title),code:_(Be.code),discountValue:ct,discountType:Be.discountType,active:Boolean(Be.active),currency:A(Be.currency)||"GBP",destinationMode:Be.destinationMode,customerActionType:Be.customerActionType,customerActionUrl:rt||void 0,bookingNotificationEmail
1:A(Be.bookingNotificationEmail).toLowerCase()||void 0,businessOpeningHours:A(Be.businessOpeningHours)||void 0,averageBookingValue:A(Be.averageBookingValue)?Number(Be.averageBookingValue):void 0,revenueEstimateMode:A(Be.averageBookingValue)?K.AVERAGE_BOOKING_VALUE:void 0,landingPageEnabled:Be.destinationMode===W.LOCREACH_PAGE,landingUrl:lt||void 0}),{created:o,finalCode:n,codeChanged:a}=await w({dispatch:G,payload:e}),s=P(o);a&&Ge(e=>({...e,code:n}));let r=null;if(Ve&&s){Ye(!0);const e=await(0,v.fB)(s,Ve),t=await(0,v.fb)(e,Ve),i="VIDEO"===t.mediaType,o=i?t.coverVideoKey:t.coverImageKey,n=i?t.coverVideoUrl:t.coverImageUrl;if(!o||!n)throw new Error("Media uploaded but the signed upload response was incomplete.");r=await(0,v.lW)(s,i?{coverVideoKey:o,coverVideoUrl:n,coverVideoContentType:t.coverVideoContentType,coverImageKey:null,coverImageUrl:null}:{coverImageKey:o,coverImageUrl:n,coverImageAlt:A(We)||A(Be.title)||"Promotion image",coverVideoKey:null,coverVideoUrl:null,coverVideoContentType:null})}const l=await L({dispatch:G,campaignId:Ae,createdOfferId:s}),c={...o&&"object"===typeof o?o:{},...r&&"object"===typeof r?r:{},...l&&"object"===typeof l?l:{},code:n},d=Date.now().toString(),u=(null===c||void 0===c?void 0:c.destinationMode)||(null===c||void 0===c?void 0:c.destination_mode)||Be.destinationMode,m=(null===c||void 0===c?void 0:c.publicPageUrl)||(null===c||void 0===c?void 0:c.public_page_url)||"",g=(null===c||void 0===c?void 0:c.pageSlug)||(null===c||void 0===c?void 0:c.page_slug)||"",h=(null===c||void 0===c?void 0:c.landingUrl)||(null===c||void 0===c?void 0:c.landing_url)||lt||"",b=me({campaignStrategy:je,form:Be,campaignId:Ae});(0,p.sx)("offer_published",{offer_id:s||"",campaign_id:Ae||"",destination_mode:u,has_public_page:Boolean(m||g),customer_action_type:(null===c||void 0===c?void 0:c.customerActionType)||(null===c||void 0===c?void 0:c.customer_action_type)||Be.customerActionType||"",discount_type:Be.discountType,discount_value:Number.isFinite(ct)?ct:null,has_booking_notification_email:Boolean(A(Be.bookingNotificationEmail)),has_average_booking_value:Boolean(A(Be.averageBookingValue))}),he(a?`Promotion code already existed. Created with ${n}.`:Be.destinationMode===W.LOCREACH_PAGE?"LocReach offer page created successfully":xe?"Promotion created from campaign idea":"Promotion created successfully",a?2200:1400),q(S(we,{refresh:d}),{replace:!0,state:{refreshAt:d,offersUpdatedAt:d,createdOfferId:s,createdOffer:c,campaignId:Ae||void 0,campaignStrategy:xe?je:void 0,offerStrategy:b||void 0,promotionDestination:{destinationMode:u,customerActionType:(null===c||void 0===c?void 0:c.customerActionType)||(null===c||void 0===c?void 0:c.customer_action_type)||Be.customerActionType,customerActionUrl:(null===c||void 0===c?void 0:c.customerActionUrl)||(null===c||void 0===c?void 0:c.customer_action_url)||rt||void 0,landingPageEnabled:null!==(t=null!==(i=null===c||void 0===c?void 0:c.landingPageEnabled)&&void 0!==i?i:null===c||void 0===c?void 0:c.landing_page_enabled)&&void 0!==t?t:u===W.LOCREACH_PAGE,landingUrl:h||void 0,publicPageUrl:m||void 0,pageSlug:g||void 0},prefilledOfferCreated:xe||void 0}})}catch(o){he((null===o||void 0===o?void 0:o.message)||"Failed to create promotion",2600)}finally{Ye(!1)}else st?dt?ut?mt?he("Please complete all required fields.",1600):he("Average booking value must be a valid amount or left blank.",1800):he("Please add a valid booking notification email or leave it blank.",1800):he("PERCENT"===Be.discountType?"Discount must be greater than 0 and no more than 100.":"Discount must be greater than 0.",1800):he(it?"Please add a valid customer destination link.":nt?`Please add ${oe(Be.customerActionType).toLowerCase()}.`:"Please check the optional customer link.",1700)},[G,pt,st,ut,it,nt,dt,he,q,we,Ae,Be,ct,lt,rt,je,xe,Ve,We]),Et=Boolean(Le||ze),jt=(0,o.useMemo)(()=>A(Be.title)?A(Be.code)?dt?st?{title:xe?"Ready to create this promotion":"Ready to create promotion",description:xe?"The suggested promotion has the details needed to create tracked promotion links.":"The promotion has the details needed to create tracked promotion links.",note:"You can still edit it later.",actionLabel:Le?"Creating\u2026":xe?"Create promotion from idea":"Create promotion",fieldId:""}
1:it?{title:"Choose where customers should go",description:Be.destinationMode===W.SOCIAL_OR_LOCAL_PROFILE?"Add the Instagram, WhatsApp, Google, or public profile customers should open.":"Add the website, menu, booking page, or checkout customers should open.",note:Be.destinationMode===W.SOCIAL_OR_LOCAL_PROFILE?"A public social, Google, WhatsApp, or contact link is okay.":"Use a full link starting with https://",actionLabel:"Add customer link",fieldId:"landingUrl"}:{title:`Add ${oe(Be.customerActionType).toLowerCase()}`,description:`The \u201c${se(Be.customerActionType)}\u201d button needs a destination.`,note:Be.customerActionType===H.CALL_BUSINESS||Be.customerActionType===H.SEND_WHATSAPP?"Enter a phone number including the country code.":"Add the public page or profile customers should open.",actionLabel:"Add button destination",fieldId:"customerActionUrl"}:{title:"Add the customer incentive",description:"Enter the discount or free setup value customers will see.",note:"PERCENT"===Be.discountType?"Use a value from 1 to 100.":"Use a value greater than 0.",actionLabel:"Add discount",fieldId:"discountValue"}:{title:"Add a promotion code",description:"This code appears on the public promotion page and tracked share links.",note:"Use something short, clear, and easy to type.",actionLabel:"Add code",fieldId:"code"}:{title:"Add a promotion title",description:"Use a short, clear name customers and creators will understand.",note:"Try: 20% off birthday cakes",actionLabel:"Add title",fieldId:"title"},[Be,dt,st,it,nt,xe,Le]),xt=(0,o.useMemo)(()=>ve?(0,f.jsx)(l.A,{eyebrow:"What to do now",title:jt.title,description:jt.description,note:jt.note,primaryAction:{label:jt.actionLabel,onClick:jt.fieldId?()=>Nt(jt.fieldId):yt,disabled:Le||!jt.fieldId&&!pt}}):(0,f.jsx)(l.A,{title:"Attribution is disabled",description:"Enable attribution features to create promotions and track results."}),[ve,Le,pt,yt,Nt,jt]),Ct=ve?(0,f.jsxs)("div",{style:{display:"flex",gap:10,width:"100%",justifyContent:"flex-end"},children:[(0,f.jsx)("button",{type:"button",className:"btn btn-ghost",onClick:At,disabled:Le,children:"Cancel"}),(0,f.jsx)("button",{type:"submit",form:"offer-create-form",className:"btn btn-primary",disabled:!pt||Le,"aria-busy":Le,children:ze?"Uploading image\u2026":Le?"Creating\u2026":xe?"Create promotion from idea":"Create promotion"})]}):null;return ve?(0,f.jsx)("div",{className:"page marketing","aria-busy":Et?"true":"false",children:(0,f.jsxs)(r.A,{showBack:!0,backTo:we,backLabel:"Back",eyebrow:"Promotion",title:xe?"Create promotion from idea":"Create promotion",subtitle:xe?"Review the suggested promotion, add the customer page, and create tracked links for the channels you share.":"Create a promotion that creators can share with customers.",meta:[{label:"Campaign",value:Ae?(0,f.jsx)("span",{className:"oc-code",title:Ae,children:Ae}):"None"},{label:"State",value:Le?"Saving\u2026":"Draft"}],primaryAction:pt?{label:ze?"Uploading image\u2026":Le?"Creating\u2026":xe?"Create promotion from idea":"Create promotion",onClick:yt,disabled:Le}:null,secondaryActions:[{label:"Cancel",onClick:At,className:"btn btn-ghost",disabled:Le}],nextStep:xt,stickyAction:Ct,children:[(0,f.jsx)(pe,{}),xe?(0,f.jsx)(ge,{strategy:je,form:Be,trackingPreview:ht,discountReason:Je.discountReason,onFocusLandingUrl:Qe}):null,(0,f.jsxs)(c.A,{title:xe?"Confirm promotion details":"Promotion details",subtitle:Le?"Saving\u2026":xe?"Most fields are prefilled. Choose the customer destination and confirm the customer incentive.":"Complete these details. You can edit everything later.",children:[Me?(0,f.jsx)("div",{className:"oc-alert",children:(0,f.jsx)("span",{className:"badge badge-warn",children:"string"===typeof Me?Me:(null===Me||void 0===Me?void 0:Me.message)||"Failed to create promotion"})}):null,(0,f.jsxs)("form",{id:"offer-create-form",className:"oc-form",onSubmit:_t,noValidate:!0,children:[(0,f.jsxs)("div",{className:"oc-grid",children:[(0,f.jsxs)("div",{className:"oc-field",children:[(0,f.jsxs)("label",{htmlFor:"title",className:"oc-label",children:["Promotion title ",(0,f.jsx)("span",{className:"oc-required",children:"*"})]}),(0,f.jsx)("input",{id:"title",className:"input",name:"title",value:Be.title,onChange:vt,disabled:Le,placeholder:xe?"e.g. Bristol bakery celebration offer":"e.g. 20% off first order",required:!0})]}),(0,f.jsxs)("div",{className:"oc-field",children:[(0,f.jsxs)("label",{htmlFor:"code",className:"oc-label",children:["Promotion code ",(0,f.jsx)("span",{className:"oc-required",children:"*"})]}),(0,f.jsx)("input",{id:"code",className:"input oc-mono",name:"code",value:Be.code,onChange:vt,disabled:Le,spellCheck:!1,autoCapitalize:"characters",placeholder:xe?"e.g. BRISTOLCAKE":"e.g. SPRING20",required:!0})]}),(0,f.jsxs)("div",{className:"oc-field oc-field--full oc-sharePreviewField",children:[(0,f.jsxs)("div",{className:"oc-
1preview",children:[(0,f.jsx)("div",{className:"oc-previewLabel",children:"Share links"}),(0,f.jsx)("div",{className:"oc-previewValue",children:(0,f.jsx)("span",{className:"oc-generatedState",children:"Email, Instagram DM, creator, WhatsApp and LinkedIn links are generated after save"})})]}),(0,f.jsx)("div",{className:"oc-help",children:"After creating this promotion, open Share links to copy the right link for each channel. LocReach tracks leads and booking requests by source automatically."})]}),(0,f.jsxs)("div",{className:"oc-field",children:[(0,f.jsxs)("label",{className:"oc-label",children:["Customer incentive ",(0,f.jsx)("span",{className:"oc-required",children:"*"})]}),(0,f.jsxs)("div",{className:"oc-discountRow",children:[(0,f.jsxs)("select",{className:"select",name:"discountType",value:Be.discountType,onChange:vt,disabled:Le,"aria-label":"Discount type",children:[(0,f.jsx)("option",{value:"PERCENT",children:"Percent (%)"}),(0,f.jsx)("option",{value:"AMOUNT",children:"Fixed amount"})]}),(0,f.jsx)("input",{id:"discountValue",className:"input "+(!A(Be.discountValue)||dt?"":"oc-inputError"),name:"discountValue",value:Be.discountValue,onChange:vt,disabled:Le,inputMode:"decimal",placeholder:"PERCENT"===Be.discountType?"e.g. 25":"e.g. 10",required:!0,"aria-invalid":A(Be.discountValue)&&!dt?"true":"false"})]}),(0,f.jsx)("div",{className:"oc-help "+(!A(Be.discountValue)||dt?"":"oc-helpError"),children:A(Be.discountValue)?dt?xe&&Je.discountReason?Je.discountReason:"PERCENT"===Be.discountType?"Enter a percentage discount greater than 0 and no more than 100.":"Enter a fixed discount amount greater than 0.":"Discount value must be valid.":"Enter the discount or free setup value customers will see."})]}),(0,f.jsxs)("div",{className:"oc-field oc-field--full oc-destinationField",children:[(0,f.jsxs)("div",{className:"oc-labelRow",children:[(0,f.jsxs)("label",{id:"customerDestinationLabel",className:"oc-label",children:["Where should customers go? ",(0,f.jsx)("span",{className:"oc-required",children:"*"})]}),(0,f.jsx)("span",{className:"oc-softBadge",children:"No website needed"})]}),(0,f.jsx)("p",{className:"oc-fieldIntro",children:"Choose what customers should see after clicking a tracked link."}),(0,f.jsx)("div",{className:"oc-destinationModes",role:"radiogroup","aria-labelledby":"customerDestinationLabel",children:Y.map(e=>{const t=Be.destinationMode===e.value;return(0,f.jsxs)("label",{className:("oc-destinationCard "+(t?"is-selected":"")).trim(),children:[(0,f.jsx)("input",{type:"radio",name:"destinationMode",value:e.value,checked:t,onChange:vt,disabled:Le}),(0,f.jsxs)("span",{className:"oc-destinationCopy",children:[(0,f.jsxs)("span",{className:"oc-destinationTitleRow",children:[(0,f.jsx)("strong",{children:e.label}),e.badge?(0,f.jsx)("em",{children:e.badge}):null]}),(0,f.jsx)("small",{children:e.description})]})]},e.value)})}),Be.destinationMode===W.LOCREACH_PAGE?(0,f.jsxs)("div",{className:"oc-hostedDestination",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("strong",{children:"LocReach will create a customer-ready offer page."}),(0,f.jsx)("span",{children:"It works with a phone number, Instagram, WhatsApp, Google Business Profile, LinkedIn, or no existing website."})]}),(0,f.jsxs)("div",{className:"oc-hostedBenefits",children:[(0,f.jsx)("span",{children:"Promotion title and customer incentive"}),(0,f.jsx)("span",{children:"Business name and local details"}),(0,f.jsx)("span",{children:"Customer action button"}),(0,f.jsx)("span",{children:"Source attribution and click tracking"})]}),(0,f.jsxs)("div",{className:"oc-destinationSubGrid",children:[(0,f.jsxs)("label",{className:"oc-miniField",children:[(0,f.jsx)("span",{children:"Main button"}),(0,f.jsx)("select",{className:"select",name:"customerActionType",value:Be.customerActionType,onChange:vt,disabled:Le,children:X.map(e=>(0,f.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,f.jsxs)("label",{className:"oc-miniField",children:[(0,f.jsxs)("span",{children:[oe(Be.customerActionType),nt?(0,f.jsx)("b",{className:"oc-required",children:" *"}):(0,f.jsx)("small",{children:" \u2014 Optional"})]}),(0,f.jsx)("input",{id:"customerActionUrl",className:"input "+(at?"":"oc-inputError"),name:"customerActionUrl",value:Be.customerActionUrl,onChange:vt,disabled:Le,type:"text",inputMode:ae(Be.customerActionType),placeholder:ne(Be.customerActionType),required:nt,"aria-invalid":at?"false":"true"})]})]}),(0,f.jsx)("div",{className:"oc-help "+(at?"":"oc-helpError"),children:at?nt?`Customers will use this when they choose \u201c${se(Be.customerActionType)}\u201d.`:A(Be.customerActionUrl)?"LocReach can show this optional destination on the offer page.":"No website or external link is required for this option.":`Please add a valid ${oe(Be.customerActionType).toLowerCase()}.`}),(0,f.jsxs)("div",{className:"oc-notificationBox",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("strong",{children:"Booking notifications"}),(0,f.jsx)("span",{children:"LocReach can email the business owner whenever a customer sends a booking request."})]}),(0,f.jsxs)("label",{className:"oc-miniField",htmlFor:"bookingNotificationEmail",children:[(0,f.jsxs)("span",{children:["Notification email ",(0,f.jsx)("small",{children:"\u2014 Optional"})]}),(0,f.jsx)("input",{id:"bookingNotificationEmail",className:"input "+(ut?"":"oc-inputError"),name:"bookingNotificationEmail",value:Be.bookingNotificationEmail,onChange:vt,disabled:Le,type:"email",inputMode:"email",placeholder:"[email protected]","aria-invalid":ut?"false":"true"})]}),(0,f.jsx)("small",{className:ut?"":"oc-helpError",children:ut?"If left blank, booking requests still appear in the Bookings tab.":"Enter a valid email address or leave this blank."})]}
1),(0,f.jsxs)("div",{className:"oc-phaseOneBox",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("strong",{children:"Phase-1 result tracking"}),(0,f.jsx)("span",{children:"Keep ROI meaningful without connecting a till, calendar or payment system."})]}),(0,f.jsxs)("div",{className:"oc-destinationSubGrid",children:[(0,f.jsxs)("label",{className:"oc-miniField",htmlFor:"averageBookingValue",children:[(0,f.jsxs)("span",{children:["Average completed booking value ",(0,f.jsx)("small",{children:"\u2014 Optional"})]}),(0,f.jsx)("input",{id:"averageBookingValue",className:"input "+(mt?"":"oc-inputError"),name:"averageBookingValue",value:Be.averageBookingValue,onChange:vt,disabled:Le,inputMode:"decimal",placeholder:"e.g. 60","aria-invalid":mt?"false":"true"})]}),(0,f.jsxs)("label",{className:"oc-miniField",htmlFor:"businessOpeningHours",children:[(0,f.jsxs)("span",{children:["Booking/opening times ",(0,f.jsx)("small",{children:"\u2014 Optional"})]}),(0,f.jsx)("input",{id:"businessOpeningHours",className:"input",name:"businessOpeningHours",value:Be.businessOpeningHours,onChange:vt,disabled:Le,placeholder:"e.g. Sun\u2013Thu, 17:00\u201322:00"})]})]}),(0,f.jsx)("small",{className:mt?"":"oc-helpError",children:mt?"Estimated revenue is completed bookings \xd7 this value. Leave blank to show operational results only.":"Enter a positive amount or leave this field blank."})]}),(0,f.jsxs)("div",{className:"oc-coverImageBox",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("strong",{children:"Public promotion media"}),(0,f.jsx)("span",{children:"Upload one customer-facing image or short video for the public LocReach promotion page."})]}),(0,f.jsxs)("div",{className:"oc-coverImageGrid",children:[(0,f.jsx)("label",{className:"oc-coverImagePicker",htmlFor:"coverImageFile",children:Fe?null!==Ve&&void 0!==Ve&&null!==(U=Ve.type)&&void 0!==U&&U.startsWith("video/")?(0,f.jsx)("video",{src:Fe,muted:!0,playsInline:!0,preload:"metadata"}):(0,f.jsx)("img",{src:Fe,alt:"Selected promotion preview"}):(0,f.jsx)("span",{children:"Choose image under 3MB or MP4/WebM video under 25MB"})}),(0,f.jsxs)("div",{className:"oc-coverImageControls",children:[(0,f.jsx)("input",{id:"coverImageFile",className:"input",type:"file",accept:"image/jpeg,image/png,image/webp,video/mp4,video/webm",onChange:bt,disabled:Le||ze}),(0,f.jsxs)("label",{className:"oc-miniField",htmlFor:"coverImageAlt",children:[(0,f.jsxs)("span",{children:["Image description ",(0,f.jsx)("small",{children:"\u2014 Optional"})]}),(0,f.jsx)("input",{id:"coverImageAlt",className:"input",value:We,onChange:e=>He(e.target.value),disabled:Le||ze,placeholder:"e.g. Weekend brunch table with drinks",maxLength:180})]}),Ve?(0,f.jsx)("button",{type:"button",className:"btn btn-ghost",onClick:ft,disabled:Le||ze,children:"Remove image"}):null,(0,f.jsx)("small",{className:Ke?"oc-helpError":"",children:Ke||"Media is uploaded directly to S3 after creation, then linked to the public page."})]})]})]}),(0,f.jsxs)("details",{className:"oc-hostedPreview",children:[(0,f.jsx)("summary",{children:"Preview LocReach offer page"}),(0,f.jsxs)("div",{className:"oc-hostedPreviewCard",children:[(0,f.jsx)("div",{className:"oc-hostedPreviewEyebrow",children:"LocReach offer"}),Fe?null!==Ve&&void 0!==Ve&&null!==(B=Ve.type)&&void 0!==B&&B.startsWith("video/")?(0,f.jsx)("video",{className:"oc-hostedPreviewImage",src:Fe,muted:!0,controls:!0,playsInline:!0,preload:"metadata"}):(0,f.jsx)("img",{className:"oc-hostedPreviewImage",src:Fe,alt:"Selected promotion preview"}):null,(0,f.jsx)("strong",{children:A(Be.title)||"Your promotion title"}),(0,f.jsx)("p",{children:dt?`${Be.discountValue}${"PERCENT"===Be.discountType?"%":` ${Be.currency||"GBP"}`} customer offer`:"Your customer incentive will appear here."}),(0,f.jsx)("button",{type:"button",tabIndex:-1,children:se(Be.customerActionType)}),(0,f.jsx)("small",{children:"Preview only. The public page is created after the promotion is saved."})]})]})]}):(0,f.jsxs)("div",{className:"oc-externalDestination",children:[(0,f.jsxs)("label",{htmlFor:"landingUrl",className:"oc-label",children:[Be.destinationMode===W.SOCIAL_OR_LOCAL_PROFILE?"Instagram, WhatsApp, Google, or public profile link":"Website, menu, booking, or checkout page"," ",(0,f.jsx)("span",{className:"oc-required",children:"*"})]}),(0,f.jsx)("input",{ref:Xe,id:"landingUrl",className:"input "+(!A(Be.landingUrl)||ot?"":"oc-inputError"),name:"landingUrl",value:Be.landingUrl,onChange:vt,disabled:Le,type:"url",placeholder:Be.destinationMode===W.SOCIAL_OR_LOCAL_PROFILE?"https://instagram.com/yourbusiness":"https://your-site.com/product",required:it,"aria-invalid":A(Be.landingUrl)&&!ot?"true":"false"}),(0,f.jsx)("div",{className:"oc-help "+(!A(Be.landingUrl)||ot?"":"oc-helpError"),children:A(Be.landingUrl)?ot?"Customers will land here after clicking a creator link.":"Please enter a valid URL starting with https:// or http://.":Be.destinationMode===W.SOCIAL_OR_LOCAL_PROFILE?"Instagram, Facebook, Google profile, WhatsApp, or another customer link is okay.":"Add the page customers should visit."})]})]}),"AMOUNT"===Be.discountType?(0,f.jsxs)("div",{className:"oc-field",children:[(0,f.jsx)("label",{htmlFor:"currency",className:"oc-label",children:"Currency"}),(0,f.jsxs)("select",{id:"currency",className:"select",name:"currency",value:
1Be.currency,onChange:vt,disabled:Le,children:[(0,f.jsx)("option",{value:"GBP",children:"GBP (\xa3)"}),(0,f.jsx)("option",{value:"USD",children:"USD ($)"}),(0,f.jsx)("option",{value:"EUR",children:"EUR (\u20ac)"})]})]}):null]}),(0,f.jsxs)("details",{className:"oc-advancedSettings",children:[(0,f.jsxs)("summary",{children:[(0,f.jsx)("span",{children:"Advanced settings"}),(0,f.jsx)("small",{children:"Visibility and publishing preferences"})]}),(0,f.jsxs)("div",{className:"oc-advancedBody",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("strong",{children:"Promotion visibility"}),(0,f.jsx)("span",{children:"Keep this ready to use after creation, or save it as inactive."})]}),(0,f.jsxs)("label",{className:"oc-toggleRow",children:[(0,f.jsx)("input",{type:"checkbox",name:"active",checked:Boolean(Be.active),onChange:vt,disabled:Le}),(0,f.jsx)("span",{children:Be.active?"Ready to use after creation":"Save as inactive"})]})]})]}),(0,f.jsx)("div",{className:("oc-readiness "+(0===gt?"is-ready":"")).trim(),role:"status","aria-live":"polite",children:0===gt?"Ready to create this promotion":`${gt} required ${1===gt?"detail":"details"} remaining`}),(0,f.jsxs)("div",{className:"oc-stickyBar",role:"region","aria-label":"Promotion actions",children:[(0,f.jsx)("button",{type:"button",className:"btn btn-ghost",onClick:At,disabled:Le,children:"Cancel"}),(0,f.jsx)("button",{type:"submit",className:"btn btn-primary",disabled:!pt||Le,"aria-busy":Le,children:Le?"Creating\u2026":xe?"Create promotion from idea":"Create promotion"})]})]})]}),de?(0,f.jsx)("div",{className:"oc-toast",role:"status","aria-live":"polite",children:de}):null]})}):(0,f.jsx)("div",{className:"page marketing",children:(0,f.jsx)(r.A,{showBack:!0,backTo:we,backLabel:"Back",eyebrow:"Attribution",title:"Create promotion",subtitle:"Promotion creation is currently unavailable.",nextStep:xt,children:(0,f.jsx)(d.A,{message:"Attribution features are currently disabled."})})})}},4409:(e,t,i)=>{i.d(t,{A:()=>a});var o=i(5043),n=i(579);const a=e=>{let{message:t,variant:i="error",onClose:a,autoHideMs:s}=e;const r=(0,o.useMemo)(()=>String(t||"").trim(),[t]);if((0,o.useEffect)(()=>{if(!r)return;if(!s)return;if("function"!==typeof a)return;const e=setTimeout(()=>a(),s);return()=>clearTimeout(e)},[r,s,a]),!r)return null;const l="error"===i?"alert":"status";return(0,n.jsxs)("div",{className:`notice notice--${i}`,role:l,"aria-live":"error"===i?"assertive":"polite",children:[(0,n.jsxs)("div",{className:"notice__content",children:[(0,n.jsxs)("span",{className:"notice__icon","aria-hidden":"true",children:["error"===i&&"\u26d4","warn"===i&&"\u26a0\ufe0f","info"===i&&"\u2139\ufe0f","success"===i&&"\u2705"]}),(0,n.jsx)("p",{className:"notice__text",children:r})]}),"function"===typeof a&&(0,n.jsx)("button",{type:"button",className:"notice__close","aria-label":"Dismiss notification",onClick:a,children:"\u2715"})]})}},5423:(e,t,i)=>{i.d(t,{A:()=>s});var o=i(5043),n=i(579);function a(e){let{id:t,title:i="",subtitle:o="",actions:a=null,children:s,className:r="",contentClassName:l=""}=e;return(0,n.jsxs)("section",{id:t,className:`ps-section card ${r}`.trim(),children:[i||o||a?(0,n.jsxs)("div",{className:"ps-header card-header",children:[(0,n.jsxs)("div",{className:"ps-headerText",children:[i?(0,n.jsx)("h2",{className:"ps-title",children:i}):null,o?(0,n.jsx)("p",{className:"ps-subtitle",children:o}):null]}),a?(0,n.jsx)("div",{className:"ps-actions",children:a}):null]}):null,(0,n.jsx)("div",{className:`ps-body card-body ${l}`.trim(),children:s})]})}a.displayName="PageSection";const s=(0,o.memo)(a)},5456:(e,t,i)=>{i.d(t,{A:()=>l});var o=i(5043),n=i(5475),a=i(579);function s(e,t,i){if(!e||!e.label)return null;const{label:o,to:s,onClick:r,disabled:l=!1,className:c=i,type:d="button"}=e,u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"btn btn--ghost";const i=(String(e||t).trim()||t).split(/\s+/).filter(Boolean).map(e=>{switch(e){case"btn-primary":return"btn--primary";case"btn-ghost":return"btn--ghost";case"btn-sm":return"btn--sm";case"btn-outline":return"btn--outline";case"btn-danger":return"btn--danger";case"btn-success":return"btn--success";case"btn-soft":return"btn--soft";default:return e}});return i.includes("btn")||i.unshift("btn"),[...new Set(i)].join(" ")}(c,i),m=function(e){let{disabled:t,onClick:i,isLink:o}=e;return e=>{if(t)return e.preventDefault(),void e.stopPropagation();"function"===typeof i&&i(e),o||e.defaultPrevented}}({disabled:l,onClick:r,isLink:Boolean(s)});return s?(0,a.jsx)(n.N_,{to:l?"#":s,className:u,"aria-disabled":l?"true":void 0,tabIndex:l?-1:void 0,onClick:m,children:o},t):(0,a.jsx)("button",{type:d,className:u,onClick:m,disabled:l,children:o},t)}function r(e){let{eyebrow:t="Next step",icon:i=null,title:o,description:n="",note:r="",primaryAction:l=null,secondaryAction:c=null}=e;return o?(0,a.jsxs)("section",{className:"nba-card","aria-label":t||"Next step",children:[(0,a.jsx)("div",{className:"nba-top",children:(0,a.jsxs)("div",{className:"nba-copy",children:[t?(0,a.jsx)("div",{className:"nba-eyebrow",children:t}):null,(0,a.jsxs)("div",{className:"nba-titleRow",children:[i?(0,a.jsx)("div",{className:"nba-icon","aria-hidden":"true",children:i}):null,(0,a.jsx)("h3",{className:"nba-title",children:o})]}),n?(0,a.jsx)("p",{className:"nba-description",children:n}):null,r?(0,a.jsx)("div",{className:"nba-note",children:r}):null]})}),l||c?(0,a.jsxs)("div",{className:"nba-actions",children:[l?s(l,"nba-primary","btn btn--primary"):null,c?s(c,"nba-secondary","btn btn--ghost"):null]}):null]}):null}r.displayName="NextBestActionCard";const l=(0,o.memo)(r)},7709:(e,t,i)=>{i.d(t,{q:()=>r});var o=i(6188);const n=e=>encodeURIComponent(String(e)),a=()=>{var e;const t=({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_AWS_COGNITO_REDIRECT_SIGN_IN:"https://api.locreach.ai/v1/auth/callback",REACT_APP_SUPPORT_EMAIL:"[email protected]",REACT_APP_GA_MEASUREMENT_ID:"",REACT_APP_PRIVACY_EMAIL:"[email protected]",REACT_APP_SITE_URL:"https://locreach.ai",REACT_APP_CANONICAL_SITE_URL:"https://locreach.ai",REACT_APP_SITEMAP_ENABLED:"true",REACT_APP_REGISTERED_OFFICE:"",REACT_APP_LEGAL_ENTITY_NAME:"Thamestech AI",REACT_APP_RESPONSE_TYPE:"code",REACT_APP_SEO_INDEXING_ENABLED:"true",REACT_APP_STRIPE_PUBLISHABLE_KEY:"",REACT_APP_AWS_COGNITO_DOMAIN:"auth.locreach.ai",REACT_APP_AWS_COGNITO_REDIRECT_SIGN_OUT:"https://api.locreach.ai/v1/auth/logout/complete",REACT_APP_AWS_IDENTITY_POOL_ID:"DISABLED",REACT_APP_COMPANY_NUMBER:"15466271",REACT_APP_STRUCTURED_DATA_ENABLED:"true",REACT_APP_ENV:"prod",REACT_APP_PUBLIC_CONTACT_URL:"mailto:[email protected]",REACT_APP_AWS_REGION:"eu-west-2",REACT_APP_BRAND_NAME:"LocReach",REACT_APP_ROBOTS_MODE:"allow",REACT_APP_SALES_CONTACT_URL:"mailto:[email protected]",REACT_APP_AWS_USER_POOL_ID:"eu-west-2_QmPcBHRnk",REACT_APP_AWS_APP_CLIENT_ID:"3dko8jiged9cfj7ehqihkooaqd",REACT_APP_AWS_COGNITO_SCOPE:"email openid profile",REACT_APP_API_URL:"https://api.locreach.ai/v1",REACT_APP_AWS_API_ENDPOINT:"https://your-api-id.execute-api.your-region.amazonaws.com/prod",REACT_APP_AWS_S3_BUCKET:"your-s3-bucket"}.REACT_APP_PUBLIC_BASE_URL||"").trim();return t?t.replace(/\/+$/,""):"undefined"!==typeof window&&null!==(e=window.location)&&void 0!==e&&e.origin?window.location.origin:""},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e||"object"!==typeof e||Array.isArray(e))return{};const t={};for(const[i,o]of Object.entries(e)){if(void 0===o||null===o||""===o)continue;const e=String(i).trim();
1e&&(t[e]="string"===typeof o||"number"===typeof o||"boolean"===typeof o?o:String(o))}return t},r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)throw new Error("code is required.");const i=(0,o.G)(s(t)),r=a();return r?`${r}/r/${n(e)}${i}`:`/r/${n(e)}${i}`}},8334:(e,t,i)=>{i.d(t,{A:()=>l});var o=i(5043),n=i(5475),a=i(579);function s(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"btn btn--ghost";if(!e||!e.label)return null;const{label:o,onClick:s,to:r,disabled:l=!1,className:c=i,type:d="button"}=e,u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"btn btn--ghost";const i=(String(e||t).trim()||t).split(/\s+/).filter(Boolean).map(e=>{switch(e){case"btn-primary":return"btn--primary";case"btn-ghost":return"btn--ghost";case"btn-sm":return"btn--sm";case"btn-outline":return"btn--outline";case"btn-danger":return"btn--danger";case"btn-success":return"btn--success";case"btn-soft":return"btn--soft";default:return e}});return i.includes("btn")||i.unshift("btn"),[...new Set(i)].join(" ")}(c,i);return r?(0,a.jsx)(n.N_,{to:l?"#":r,className:u,"aria-disabled":l?"true":void 0,tabIndex:l?-1:void 0,onClick:e=>{if(l)return e.preventDefault(),void e.stopPropagation();null===s||void 0===s||s(e)},children:o},t):(0,a.jsx)("button",{type:d,className:u,onClick:s,disabled:l,children:o},t)}function r(e){let{showBack:t=!1,backTo:i="",backLabel:o="Back",eyebrow:r="",title:l,subtitle:c="",status:d=null,meta:u=[],primaryAction:m=null,secondaryActions:p=[],progress:g=null,nextStep:h=null,aiInsight:v=null,tabs:b=null,children:f,stickyAction:A=null,className:y=""}=e;const N=Array.isArray(u)&&u.length>0,_=Boolean(b),E=Array.isArray(p)&&p.length>0,j=Boolean(g||h||v),x=Boolean(t&&i);return(0,a.jsxs)("div",{className:`wl-page page-shell ${y}`.trim(),children:[(0,a.jsxs)("div",{className:"wl-shell page-content",children:[(0,a.jsxs)("header",{className:"wl-header",children:[(0,a.jsxs)("div",{className:"wl-headerTop",children:[(0,a.jsxs)("div",{className:"wl-headerLeft",children:[x?(0,a.jsxs)(n.N_,{className:"wl-backLink",to:i,"aria-label":o,children:[(0,a.jsx)("span",{"aria-hidden":"true",children:"\u2190"}),(0,a.jsx)("span",{children:o})]}):null,(0,a.jsxs)("div",{className:"wl-titleWrap",children:[r?(0,a.jsx)("div",{className:"wl-eyebrow",children:r}):null,(0,a.jsxs)("div",{className:"wl-titleRow",children:[(0,a.jsx)("h1",{className:"wl-title",children:l}),d?(0,a.jsx)("div",{className:"wl-statusWrap",children:d}):null]}),c?(0,a.jsx)("p",{className:"wl-subtitle",children:c}):null]})]}),(0,a.jsxs)("div",{className:"wl-headerRight",children:[E?p.map((e,t)=>s(e,`${(null===e||void 0===e?void 0:e.label)||"secondary"}-${t}`,"btn btn--ghost")):null,m?s(m,"primary-action","btn btn--primary"):null]})]}),N?(0,a.jsx)("div",{className:"wl-metaRow","aria-label":"Workspace metadata",children:u.map((e,t)=>(0,a.jsxs)("div",{className:"wl-metaItem",children:[(0,a.jsx)("span",{className:"wl-metaLabel",children:e.label}),(0,a.jsx)("span",{className:"wl-metaValue",children:e.value})]},`${(null===e||void 0===e?void 0:e.label)||"meta"}-${t}`))}):null]}),j?(0,a.jsxs)("section",{className:"wl-guidance",children:[g?(0,a.jsx)("div",{className:"wl-guidanceCard",children:g}):null,h?(0,a.jsx)("div",{className:"wl-guidanceCard",children:h}):null,v?(0,a.jsx)("div",{className:"wl-guidanceCard",children:v}):null]}):null,_?(0,a.jsx)("nav",{className:"wl-tabsBar","aria-label":"Workspace navigation",children:(0,a.jsx)("div",{className:"wl-tabs",children:b})}):null,(0,a.jsx)("main",{className:"wl-content",id:"app-main",children:f})]}),A?(0,a.jsx)("div",{className:"wl-stickyBar","aria-label":"Primary action",children:(0,a.jsx)("div",{className:"wl-shell page-content",children:(0,a.jsx)("div",{className:"wl-stickyInner",children:A})})}):null]})}r.displayName="WorkspaceLayout";const l=(0,o.memo)(r)}}]);
2//# sourceMappingURL=1396.f63cd008.chunk.js.map

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.