import{j as i,ej as v,aP as C,l as f,o as T,aT as x,bY as j,bX as y,c0 as N,f1 as S,g as w,h as I,i as M,aR as R,aw as O}from"./app-BgLa5dit.js";import{J as P}from"./DfIMhO3y.chunk.js";import{w as A,u as m,C as k,a as L}from"./GYlSv6lg.chunk.js";import{g as E,c as U,C as V}from"./BddP3S5c.chunk.js";import{D as z}from"./C4BcftDO.chunk.js";import{T as B}from"./lZO4aq5x.chunk.js";import{C as u}from"./c3I67AiW.chunk.js";import{g as F}from"./CMrPv4Jl.chunk.js";import{S as G}from"./C1m0yEk1.chunk.js";import"./DUpYPoLs.chunk.js";import"./DpUpv6rY.chunk.js";import"./CG7zbly5.chunk.js";import"./m4aqaK_l.chunk.js";import"./MEkA24R1.chunk.js";import"./C53kfXmd.chunk.js";import"./DJ0pq8J_.chunk.js";import"./Bs6fQ2wT.chunk.js";import"./BUT90D7O.chunk.js";import"./DyuQzTEw.chunk.js";import"./DDfKZ_ng.chunk.js";import"./DkDkjje4.chunk.js";import"./C8_78Eqq.chunk.js";import"./BgshPevy.chunk.js";const p=v(),J=[p.accessor("title",{id:"title",header:"",cell:e=>i.jsx("div",{className:"font-label",children:e.getValue()}),size:240}),p.accessor("value",{id:"value",header:"",cell:e=>i.jsx("div",{children:e.getValue()}),size:560})],_={...u,header:"d-none",row:"",cell:`${u.cell} pt-2 pb-2`};function n(e){return e||"—"}function q(e){return e?new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}):"—"}function H(e){const a=U.filter(t=>e.formData[t.field]);return a.length?i.jsx("div",{className:"d-flex align-items-center gap-2",children:a.map(t=>i.jsx("img",{src:t.logo,alt:t.label,width:24,height:24},t.field))}):i.jsx("span",{children:"—"})}function W(e){var s;const a=E(e.originType),t=[{title:"Origin",value:n(F(e.originType))},{title:"Destinations",value:i.jsx(H,{formData:e})}];return a.originNameLabel&&t.push({title:a.originNameLabel,value:n(e.originName)}),a.event&&t.push({title:a.event.nameLabel,value:n(e.eventName)},{title:a.event.dateLabel,value:q(e.eventDate)}),a.subscription&&((s=e.brazeOptions)!=null&&s.subscriptionGroup)&&e.brazeOptions.subscriptionGroup!==G.None&&t.push({title:"Subscription groups",value:e.brazeOptions.subscriptionGroup}),a.utm&&e.utmEnabled&&(e.utmSource&&t.push({title:"UTM source",value:e.utmSource}),e.utmMedium&&t.push({title:"UTM medium",value:e.utmMedium}),e.utmCampaign&&t.push({title:"UTM campaign",value:e.utmCampaign}),e.utmContent&&t.push({title:"UTM content",value:e.utmContent}),e.utmTerm&&t.push({title:"UTM term",value:e.utmTerm})),e.skipEmailValidation&&t.push({title:"Advanced options",value:"Skip ZeroBounce"}),t}function Y(e){return i.jsx("div",{className:A.formContent,children:i.jsx(z,{heading:i.jsx("h6",{className:"mb-0",children:"Overview"}),disableCollapse:!0,children:i.jsx("div",{className:"p-3",children:i.jsx(B,{data:W(e.formData),columns:J,theme:_})})})})}function K(){const e=O().values,{csvData:a}=m(),t=a.length>1?a.length-1:0;return i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"mb-4",children:["You're about to import ",i.jsxs("strong",{children:[t," contacts"]}),". Please check and confirm all details below."]}),i.jsx(Y,{formData:e})]})}function Ce(e){var c;const a=C(),t=f(),s=T(R.currentUser()),r=(c=s.data)==null?void 0:c.id,{csvData:o,clearCsvData:l}=m(),d=x.useCallback(h=>{const g=V.buildPayload(h,o),b={name:N.MarketingProfile,type:y.MarketingProfile,metadata:g,customerId:r,dataType:j.MarketingProfile};return S(a,P.createJob(b)).then(()=>{l(),t.success("You’ll receive an email once the upload has been completed."),w.trigger({application:M.MARKETING_APP,action:I.Marketing.CONTACT_IMPORT,params:{pollAfterSubmit:"1"}})}).catch(()=>{t.error("Failed to import the contacts. Please try again.")})},[t,r,a,o,l]);return!s.hasCompleted||!s.data?i.jsx(i.Fragment,{}):i.jsx(k,{currentStepId:L.REVIEW,queryParams:e.queryParams,onSubmit:d,title:"Review and confirm",children:i.jsx(K,{})})}export{Ce as ContactImportReviewView};
//# sourceMappingURL=DZU-YXDP.chunk.js.map
