PageSourceSearch

https://app.clickcease.com/static/js/639.9893592d.chunk.js

js clickcease.com collected 2026-10-01 09:24:57 UTC 47,968 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkcc_dashboard_platform=self.webpackChunkcc_dashboard_platform||[]).push([[639],{15523:(e,t,n)=>{n.d(t,{x:()=>p});var o=n(6383),a=n(9806),i=n(19118),s=n(73580),r=n(74777);const l=(0,r.zo)("div",{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flexStart",minWidth:"48px",height:"40px","> button":{marginLeft:"4px"}}),c=(0,r.zo)("span",{color:"$textColor",fontSize:"$md",fontWeight:"$sb"}),d=(0,r.zo)("button",{all:"unset",fontFamily:"inherit",borderRadius:"100%",height:"15px",width:"15px",fontSize:"$sm",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white","&:hover":{backgroundColor:"$buttonHover"}});n(72791);var u=n(80184);const p=e=>{let{header:t,onClick:n,tooltip:r,sorted:p,css:h,nonSortable:m}=e;return(0,u.jsxs)(l,{css:h,onClick:m?void 0:n,children:[(0,u.jsx)(c,{children:t}),!!r&&(0,u.jsx)(i.u,{tooltipText:r,children:(0,u.jsx)(d,{children:(0,u.jsx)(a.G,{icon:o.sqG,width:"11px"})})}),!m&&(0,u.jsx)(d,{children:(0,u.jsx)(a.G,{icon:p===s.hr?o.gc2:o.onQ})})]})}},99639:(e,t,n)=>{n.r(t),n.d(t,{PlatformsRoutes:()=>Wt});var o=n(72791),a=n(57689),i=n(74777),s=n(76840),r=n(27650),l=n(22020),c=n(35785),d=n(70993),u=n(82263),p=n(77977),h=n(80184);const m=e=>{let{header:t,children:n,css:o,id:a}=e;return(0,h.jsxs)(x,{id:a,css:o,children:[(0,h.jsx)(g,{children:(0,h.jsx)(i.eb,{variant:"h1",children:t})}),n]})},x=(0,i.zo)("div",{borderRadius:"12px",display:"flex",flexDirection:"column",backgroundColor:"$white",padding:"$8 $10"}),g=(0,i.zo)("div",{width:"100%",display:"flex",marginBottom:"$10"});var f=n(6383),v=n(78885),C=n(9806);const y=e=>(0,h.jsx)("svg",{width:"15px",height:"15px",viewBox:"0 0 15 15",fill:"none",...e,children:(0,h.jsx)("path",{d:"M7.5.877a6.623 6.623 0 1 0 0 13.246A6.623 6.623 0 0 0 7.5.877ZM1.827 7.5a5.673 5.673 0 1 1 11.346 0 5.673 5.673 0 0 1-11.346 0ZM7.5 4a.5.5 0 0 1 .5.5V7h2.5a.5.5 0 1 1 0 1H8v2.5a.5.5 0 0 1-1 0V8H4.5a.5.5 0 0 1 0-1H7V4.5a.5.5 0 0 1 .5-.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})});var b=n(71349),E=n(98822),j=n(36505),I=n(48513);const S=(0,i.zo)("div",{position:"relative",padding:"$10",width:"154px",height:"154px",border:"1px solid $veryLightNeutral",backgroundColor:"$white",borderRadius:"12px",display:"flex",justifyContent:"flex-start",gap:"$8",alignItems:"center",boxShadow:"0px 0px 30px rgba(102, 102, 102, 0.05)","&:hover":{borderColor:"$primaryColor",color:"$primaryColor"},"> :nth-child(1)":{marginBottom:"$4"},"> :nth-child(2)":{marginBottom:"$6"},"> :nth-child(3)":{marginBottom:"$8"},variants:{largeBlock:{true:{width:"293px"}}}}),P=(0,i.zo)("div",{width:"154px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100%",gap:"$6",variants:{largeBlock:{true:{width:"95px"}}}}),T=(0,i.zo)("div",{width:"190px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",height:"100%",gap:"$4"}),A=(0,i.zo)("div",{height:"32px",width:"32px",borderRadius:"50%",display:"flex",justifyContent:"center",alignItems:"center",boxShadow:"0px 0px 20px rgba(0, 0, 0, 0.1)"}),k=(0,i.zo)("div",{position:"absolute",padding:"$2",top:"15px",right:"15px",cursor:"pointer"}),M=(0,i.zo)("span",{display:"flex",alignItems:"center",justifyContent:"center",padding:"$8"}),$=(0,i.zo)("div",{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"$4"}),w=()=>{const{t:e}=(0,l.$)("PMPlatforms");return(0,h.jsxs)($,{css:{width:"230px"},children:[(0,h.jsx)(i.qY,{variant:"smallRegular",children:e("sso-connected-tooltip1")}),(0,h.jsx)(i.qY,{variant:"smallRegular",children:e("sso-connected-tooltip2")})]})},G=(0,i.zo)("div",{boxShadow:"0px 5px 20px rgba(102, 102, 102, 0.15)",borderRadius:"4px",background:"$white",padding:"$4 0px $4 0px",width:"170px"}),N=(0,i.zo)("div",{width:"calc(100% - $6)",color:"$black",fontWeight:"$l",fontSize:"$md",display:"flex",alignItems:"center",justifyContent:"flex-start",cursor:"pointer",padding:"$4 $6","&:hover":{background:"$tableHovered"},"> svg":{height:"12px",width:"12px",marginInlineEnd:"$4"}});var O=n(1359);const L=[{icon:f.FVb,text:O.Z.t("connect-audience",{ns:"PMPlatforms"}),action:"audience"},{icon:f.I85,text:O.Z.t("pixel-guard",{ns:"PMPlatforms"}),action:"pixelGuard"},{icon:f.Yai,text:O.Z.t("edit-account",{ns:"PMPlatforms"}),action:"edit"},{icon:f.ul5,text:O.Z.t("disable-account",{ns:"PMPlatforms"}),action:"disable"},{icon:f.gPx,text:O.Z.t("manual-ip-exclusion",{ns:"PMPlatforms"}),action:"manualExclusion"}],D=[{icon:f.FVb,text:O.Z.t("connect-audience",{ns:"PMPlatforms"}),action:"audience"},{icon:f.I85,text:O.Z.t("pixel-guard",{ns:"PMPlatforms"}),action:"pixelGuard"},{icon:f.Yai,text:O.Z.t("edit-accounts",{ns:"PMPlatforms"}),action:"edit"},{icon:f.ul5,text:O.Z.t("disable-account",{ns:"PMPlatforms"}),action:"disable"},{icon:f.gPx,text:O.Z.t("manual-ip-exclusion",{ns:"PMPlatforms"}),action:"manualExclusion"}],B={meta:["edit","disable"],microsoft:["audience"],google:["edit","disable","manualExclusion"]};var z=n(51752);const R=e=>{let{platform:t,isMultiAccount:n,onDisable:a,onEdit:i,onMultiAccountEdit:s,onAudience:r,onPixelGuard:l,onManualExclusion:d}=e;const{data:u}=(0,c.o)(),p=(0,z.e)("CE_MANUAL_IP_EXCLUSION"),m=(0,o.useMemo)((()=>(null===u||void 0===u?void 0:u.some((e=>"Google"===e.platformType&&"Connected"===e.connectionStatus)))||!1),[u]),x=(0,o.useMemo)((()=>{const e=[];return null===u||void 0===u||u.forEach((t=>{"Google"===t.platformType&&e.push(t.displayId)})),e}),[u]),g=x.length>1?D:L,f=B,v={edit:!!i,disable:!!a,pixelGuard:!!l,audience:!!r,manualExclusion:!!d&&m&&p};return(0,h.jsx)(G,{children:g.map(((e,o)=>{if(f[t].includes(e.action)&&v[e.action])return(0,h.jsxs)(N,{onClick:(c=e.action,()=>{"edit"===c&&i&&i(),"disable"===c&&a&&a(),"pixelGuard"===c&&l&&l(),"audience"===c&&r&&r(),"edit"===c&&n&&s&&s("multi-edit"),"disable"===c&&n&&s&&s("multi-disable"),"manualExclusion"===c&&d&&d()}),children:[(0,h.jsx)(C.G,{icon:e.icon}),e.text]},o);var c}))})},{space:{8:{value:Z}}}=i.theme,Y={width:Z,height:Z},V=e=>{let{serviceName:t,isConnected:n,isEnabled:o}=e;const{t:a}=(0,l.$)("PMPlatforms"),{openPlatformConnection:s,openDisableModal:r,openPixelGuardModal:p,openAudienceModal:m,setOpenModal:x,setSelectedPlatform:g,openManualExclusionModal:$}=(0,u.Z)(),G=t===d.VT.GOOGLE,{googleHasAdAccount:N,googleHasAudience:O}=(0,E.O)(),{data:L}=(0,c.o)({}),D=G&&L?L.filter((e=>{let{platformType:t,connectionStatus:n}=e;return t.toLowerCase()===d.VT.GOOGLE&&"Disconnected"!==n})):[],B=G&&(null===L||void 0===L?void 0:L.some((e=>{let{connectionType:t}=e;return"SSO"===t}))),z=G&&1===D.length&&D.some((e=>{let{connectionStatus:t}=e;return"Pending"===t})),Z=e=>{s(t,e)()},V=!(!G||O)||!o,F=!o&&n?a("finish-setup"):I.RH[t];return(0,h.jsxs)(S,{largeBlock:G,children:[(0,h.jsxs)(P,{largeBlock:G,children:[(0,h.jsx)(A,{children:(0,h.jsx)(b.D,{serviceName:t,iconProps:Y})}),(0,h.jsx)(i.eb,{variant:"h2",children:j.w[t]}),(0,h.jsx)(i.Nj,{variant:o?"primarySuccess":"primaryDisabled",iconLeft:(0,h.jsx)(C.G,{icon:o?v.fV7:v.gPx}
1),children:a(o?"enabled-account":"disabled-account")}),!G&&V&&(0,h.jsx)(i.Ai,{variant:"ghost",onClick:()=>G&&N&&m||d.VT.MICROSOFT===t?m(t)():s(t)(),iconLeft:F===a("add-audience")||F===a("add-account")?(0,h.jsx)(y,{...Y}):(0,h.jsx)(C.G,{icon:f.gr5}),text:F})]}),G&&(0,h.jsxs)(T,{children:[(0,h.jsx)(i.Ai,{variant:"ghost",onClick:p(t),iconLeft:(0,h.jsx)(C.G,{icon:f.I85}),text:a("pixel-guard")}),(0,h.jsx)(i.Ai,{variant:"ghost",onClick:m(t),iconLeft:(0,h.jsx)(C.G,{icon:f.FVb}),text:a(G?"conect-google-audience":"connect-audience")}),(0,h.jsx)(i.Ai,{variant:"ghost",onClick:()=>Z(z||D.length>0&&!o),iconLeft:z||D.length>0&&!o?(0,h.jsx)(C.G,{icon:f.gr5}):(0,h.jsx)(y,{...Y}),disabled:B&&!z&&o,tooltiptText:B?(0,h.jsx)(w,{}):"",text:z||1===D.length&&!o?a("finish-setup"):a("add-account")})]}),(0,h.jsx)(k,{children:(0,h.jsx)(i.J2,{trigger:(0,h.jsx)(M,{children:(0,h.jsx)(C.G,{icon:f.Uwo})}),content:(0,h.jsx)(R,{platform:t,isMultiAccount:G&&D.length>1,onDisable:n?()=>{r(t)()}:void 0,onEdit:()=>Z(!0),onMultiAccountEdit:e=>{g(d.VT.GOOGLE),x("multi-disable"===e?d.CL.googleMultiAccDisable:d.CL.googleMultiAccEdit)},onPixelGuard:p(t),onAudience:m(t),onManualExclusion:()=>$(t)})})})]})},F=(0,i.zo)("div",{display:"flex",alignItems:"flex-start",top:"16px","> :not(:first-child)":{marginLeft:"$12"}});var q=n(36766);const U=()=>{const{t:e}
1=(0,l.$)("PMPlatforms"),{openModal:t,selectedPlatform:n}=(0,u.Z)(),{data:a}=(0,c.o)({}),i=(0,o.useMemo)((()=>{const e=[{connectionStatus:d.cR.DISCONNECTED,platformType:d.VT.GOOGLE.toUpperCase(),enabled:!1,displayId:"",displayName:"",connectionId:0},{connectionStatus:d.cR.DISCONNECTED,platformType:d.VT.META.toUpperCase(),enabled:!1,displayId:"",displayName:"",connectionId:0},{connectionStatus:d.cR.DISCONNECTED,platformType:d.VT.MICROSOFT.toUpperCase(),enabled:!1,displayId:"",displayName:"",connectionId:0}];return null===a||void 0===a||a.forEach((t=>{if(Object.values(d.VT).includes(t.platformType.toLowerCase())){if(t.connectionStatus===d.cR.DISCONNECTED)return;const n=e.find((e=>e.platformType===t.platformType.toUpperCase())),o=t.connectionStatus===d.cR.PENDING;n&&(n.connectionId=n.connectionStatus===d.cR.PENDING?n.connectionId:t.connectionId,n.enabled=!!n.enabled||t.enabled,n.connectionType=t.connectionType,n.connectionStatus=o?d.cR.PENDING:t.connectionStatus)}})),e}),[a]);return(0,h.jsxs)(m,{header:e("connectPlatformHeader"),css:{height:"249px"},children:[(0,h.jsx)(F,{id:"connect-platform-block",children:i.map((e=>{const t=(0,p.vl)(e.platformType);return(0,h.jsx)(V,{serviceName:t,isConnected:e.connectionStatus===d.cR.CONNECTED||e.connectionStatus===d.cR.PENDING,isEnabled:e.enabled},`${t}-connection`)}))}),n&&t&&(0,h.jsx)(q.L,{platformStatus:(e=>{const t=i.find((t=>t.platformType.toLowerCase()===e));return t?{connectionStatus:t.connectionStatus,enabled:t.enabled}:{connectionStatus:d.cR.DISCONNECTED,enabled:!1}})(n)})]})};var W=n(68613),_=n(4163),H=n(10722),K=n(26286),Q=n(38962),J=n(68962),X=n(68503),ee=n(76807),te=n(53802),ne=n(72497);const oe=e=>{var t;let{connectionId:n,adAccountId:o,config:a}=e;const{accountId:i}=(0,ne.L)(),s=(0,ee.a)({queryKey:["getGoogleProtectionMode",n,o],queryFn:()=>(async e=>{let{accountId:t,connectionId:n,adAccountId:o}=e;return await(0,te.W)({url:`/accounts/${t}/google/${n}/ad-accounts/${o}/mode`,method:"GET"})})({accountId:i,connectionId:n,adAccountId:o}),staleTime:0,...a}),r=!(s.data instanceof Error)&&(null===(t=s.data)||void 0===t?void 0:t.protectAll);return{...s,data:r}};var ae=n(40743),ie=n(24456),se=n(18378),re=n(14297),le=n(94795);const ce=e=>{let{connectionId:t,adAccountId:n,pagination:o,onSuccessFn:a,config:i}=e;const{accountId:s}=(0,ne.L)();return(0,ee.a)({queryFn:()=>(async e=>{let{accountId:t,connectionId:n,adAccountId:o,pagination:a}=e;return await(0,te.W)({url:`/accounts/${t}/google/${n}/ad-accounts/${o}`,method:"GET",params:a})})({accountId:s,connectionId:t,adAccountId:n,pagination:o}),onSuccess:e=>{!a||e instanceof Error||a(e.campaigns)},staleTime:1e4,queryKey:["getGoogleCampaigns",t,n,null===o||void 0===o?void 0:o.page,null===o||void 0===o?void 0:o.limit,null===o||void 0===o?void 0:o.sort,null===o||void 0===o?void 0:o.search],...i})};var de=n(96403),ue=n(73418);const pe=e=>{let{connectionId:t,adAccountId:n}=e;const o=(0,de.NL)(),{accountId:a}=(0,ne.L)();return(0,ue.D)({mutationFn:e=>{let{campaigns:o}=e;return(async e=>{let{accountId:t,connectionId:n,adAccountId:o,campaigns:a}=e;return await(0,te.W)({url:`/accounts/${t}/google/${n}/ad-accounts/${o}/selected`,method:"PUT",data:{campaigns:a}})})({accountId:a,connectionId:t,adAccountId:n,campaigns:o})},onSettled:async()=>{await o.invalidateQueries({queryKey:["getPlatformsConnections"]})}})},he=(0,i.zo)("div",{width:"920px",height:"510px"}),me=((0,i.zo)("div",{display:"flex",flexDirection:"column",width:"700px",alignItems:"center","> :first-child":{marginBottom:"$4"}}),(0,i.zo)("div",{marginTop:"$4",width:"100%",display:"flex",alignItems:"center",justifyContent:"center","> :first-child":{marginRight:"$4"}}),(0,i.zo)("div",{marginTop:"$4"}),(0,i.zo)("div",{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",marginTop:"$3",border:"1px solid $lightDisabled",borderRadius:"16px",overflow:"hidden"}),(0,i.zo)("div",{width:"calc(100% - 48px)",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"$8 $12",backgroundColor:"$tableHovered"}),(0,i.zo)("div",{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}),(0,i.zo)("p",{all:"unset",color:"$disabled",fontSize:"$md",fontWeight:"$sl",overflow:"hidden",textOverflow:"ellipsis"}),e=>{let{accountId:t,connectionId:n,onSuccess:a,onBack:s}=e;const{t:r}=(0,l.$)("PMPlatforms"),{openPlatformConnection:c}=(0,u.Z)(),[p,m]=(0,o.useState)(le.Y),{data:x,isFetching:g}=(0,ie.z)({}),f=(0,o.useMemo)((()=>{const e=[];return x instanceof Error||null===x||void 0===x||!x.connections||x.connections.forEach((t=>{let{platformType:n,entityType:o,displayId:a,entityId:i}=t;n===j.w.google&&o===d.PLATFORM_ENTITY_TYPES.AD_ACCOUNT&&e.push({label:a,value:`${i}`})})),0===e.length&&(s(),c("google")),e}),[x]),[v,C]=(0,o.useState)((e=>{if(0===f.length)return 0;if(t)return t;const n=f.find((t=>t.value===`${e}`));return Number(n?n.value:f[0].value)})(t)),{data:y,isFetching:b}=ce({connectionId:n,adAccountId:v,pagination:p}),E=(0,o.useMemo)((()=>y instanceof Error||!y?[]:y.campaigns),[y]),I=e=>{var t;if(!(y instanceof Error)&&y)return null===y||void 0===y||null===(t=y.metadata)||void 0===t?void 0:t[e]},{handleCheckboxClicked:S,handleSelectAll:P,selectedOptions:T,page:A,search:k,pageCount:M,onFirstPage:$,onLastPage:w,onNextPage:G,onPrevPage:N,searchPage:O,cleanSelection:L,sort:D,setSort:B,selectedText:z,paginationParams:R}=(0,re.j)({entities:E,totalCount:I("totalCount")});(0,o.useEffect)((()=>m(R)),[R]);const Z=pe({connectionId:n,adAccountId:v}),Y={page:A,onBack:s,onFirstPage:$,onLastPage:w,onNextPage:G,onPrevPage:N,searchPage:O,sort:D,setSort:B,selectedText:z};return(0,h.jsx)(he,{children:(0,h.jsx)(se.p,{...Y,title:r("google-campaigns-wizard.campaign-selection-header"),searchPlaceholder:r("google-campaigns-wizard.campaign-selection-input-placeholder"),buttonText:r("next-button"),entitiesName:r("google-campaigns-wizard.campaign"),buttonLoading:Z.isLoading,pageCount:null!==M&&void 0!==M?M:1,filterBy:k,options:E,selected:T,handleSelect:S,onSearch:O,handleSelectAll:P,handleSubmit:()=>{Z.mutate({campaigns:T},{onSuccess:()=>a()})},onPreviousPage:N,totalItems:I("totalCount"),selectedText:z,modalLoading:g||b,customInput:(0,h.jsx)(i.EZ,{options:f,value:f.find((e=>e.value===`${v}`)),wrapperCSS:{width:"240px"},placeholder:r("google-campaigns-wizard.campaign-selection-account-selection-label"),onChange:e=>{e&&(e=>{const t=Number(e);t!==v&&L(),C(t)})(e.value)}})})})});var xe=n(57583),ge=n(73580),fe=n(25650);const ve=e=>{let{isReadOnly:t,accountsToShow:n,selectedAccounts:o,handleSelect:a,isAllSelected:s}=e;return(0,h.jsx)(h.Fragment,{children:n.map((e=>(0,h.jsxs)(fe.Yf,{children:[(0,h.jsx)(i.Jg,{isChecked:s||o.includes(e.id),onChange:()=>a(e.id),disabled:t}),(0,h.jsx)(i.qY,{variant:"baseLight",children:e.name}),(0,h.jsx)(i.qY,{variant:"baseLight",children:e.adAccountId||e.adAccountID||e.campaignId||e.managerId||""})]},e.id)))})},Ce=e=>{let{options:t,selected:n,title:o,searchPlaceholder:a,filterBy:s,buttonText:r,buttonLoading:c,modalLoading:d,entitiesName:u,sortDirection:p,handleSelect:m,onSearch:x,handleSelectAll:g,handleSubmit:v,onBack:y,handleSortChange:b,customInput:E,messageBox:j,isLoading:I,isBackButtonDisabled:S,isPrimaryButtonDisabled:P,isReadOnly:T}=e;const{t:A}=(0,l.$)("PMPlatforms"),k=t.some((e=>!!e.adAccountId||!!e.adAccountID||!!e.campaignId||!!e.managerId));return(0,h.jsxs)(xe.A,{onGhostButtonClick:y,ghostButtonText:A("back"),primaryButtonText:r,onPrimaryButtonClick:v,isPrimaryButtonDisabled:0===n.length||P,isPrimaryButtonLoading:c,modalLoading:d,isGhostButtonDisabled:S,children:[!!j&&(0,h.jsx)(fe.Ed,{children:(0,h.jsx)(i.FN,{type:j.type,children:(0,h.jsx)(i.qY,{variant:"baseLight",children:j.content})})}),(0,h.jsx)(i.qY,{variant:"baseBold",children:o}),(0,h.jsxs)(fe.fv,{children:[(0,h.jsx)(i.Wu,{value:s,onChange:e=>x(e.target.value),iconRight:(0,h.jsx)(C.G,{icon:f.Y$T}),placeholder:a,css:{width:"300px"}}),!!E&&E]}),(0,h.jsxs)(fe.Yf,{header:!0,css:{marginTop:"$8"},children:[(0,h.jsx)(i.Jg,{isChecked:t.length===n.length||!!T,onChange:g,disabled:T}),(0,h.jsxs)(fe.dT,{onClick:b,children:[(0,h.jsx)(i.qY,{variant:"baseBold",children:A("name-of",{entity:u})}),(0,h.jsx)(fe.fz,{children:(0,h.jsx)(C.G,{icon:p===ge.zE?f.onQ:f.gc2})})]}),(0,h.jsx)(i.qY,{variant:"baseBold",children:k?A("id"):""})]}),(0,h.jsxs)(fe.up,{children:[I&&(0,h.jsx)(i.s_,{css:{width:"100px",height:"100px",position:"relative"}}
1),!I&&(0,h.jsx)(ve,{selectedAccounts:n,accountsToShow:t,handleSelect:m,isReadOnly:T,isAllSelected:T})]})]})};var ye=n(47796);const be=e=>{let{accountId:t,connectionId:n,onSuccess:a,onBack:s}=e;const{t:r}=(0,l.$)("PMPlatforms"),{openPlatformConnection:c}=(0,u.Z)(),{data:p,isFetching:m}=(0,ie.z)({}),x=(0,o.useMemo)((()=>{const e=[];return p instanceof Error||null===p||void 0===p||!p.connections||p.connections.forEach((t=>{let{platformType:n,entityType:o,displayId:a,entityId:i}=t;n===j.w.google&&o===d.PLATFORM_ENTITY_TYPES.AD_ACCOUNT&&e.push({label:a,value:`${i}`})})),0===e.length&&(s(),c("google")),e}),[p]),[g,f]=(0,o.useState)((e=>{if(0===x.length)return 0;if(t)return t;const n=x.find((t=>t.value===`${e}`));return Number(n?n.value:x[0].value)})(t)),{data:v,isFetching:C}=ce({connectionId:n,adAccountId:g}),y=(0,o.useMemo)((()=>v instanceof Error||!v?[]:v.campaigns),[v]),{filteredOptions:b,handleCheckboxClicked:E,handleSelectAll:I,selectedOptions:S,setFilterBy:P,filterBy:T,cleanSelection:A,sortOrder:k,handleSortChange:M}=(0,ye.E)(y),{mutate:$,isLoading:w}=pe({connectionId:n,adAccountId:g});return(0,h.jsx)(he,{children:(0,h.jsx)(Ce,{title:r("google-campaigns-wizard.campaign-selection-header"),searchPlaceholder:r("google-campaigns-wizard.campaign-selection-input-placeholder"),buttonText:r("next-button"),entitiesName:r("google-campaigns-wizard.campaign"),buttonLoading:w,filterBy:T,options:b,selected:S,handleSelect:E,onSearch:P,handleSelectAll:I,handleSubmit:()=>{$({campaigns:S},{onSuccess:()=>a()})},sortDirection:k,handleSortChange:M,onBack:s,isLoading:m||C,customInput:(0,h.jsx)(i.EZ,{options:x,value:x.find((e=>e.value===`${g}`)),wrapperCSS:{width:"240px"},placeholder:r("google-campaigns-wizard.campaign-selection-account-selection-label"),onChange:e=>{e&&(e=>{const t=Number(e);t!==g&&A(),f(t)})(e.value)}})})})};var Ee=n(92329);var je=n(91427);const Ie=e=>{let{setProtectionType:t,onCancel:n,loading:a,isAutoMode:s}=e;const{t:r}=(0,l.$)("PMPlatforms"),{isFeatureEnabled:c}=(()=>{var e,t,n,o,a;const i="CE_ACCOUNT_LEVEL_IP_BLOCKING",s=(0,Ee.N)([i]),r=null===(e=s[i])||void 0===e||null===(t=e.treatment)||void 0===t||null===(n=t.toUpperCase())||void 0===n?void 0:n.startsWith("ON"),l=null===(o=s[i])||void 0===o?void 0:o.config;return{isFeatureEnabled:r,featureStartDate:r&&"string"===typeof l?Number((null===(a=JSON.parse(l))||void 0===a?void 0:a.startDate)||0):0}})(),[u,p]=(0,o.useState)(d.GG.AUTO),m=e=>p(e);(0,o.useEffect)((()=>{p(s?d.GG.AUTO:d.GG.ADVANCED)}),[s]);const x=e=>r(`google-campaigns-wizard.${e}`),g=x(c?"full-account-protection":"automatic-update"),f=x(c?"full-account-protection-explainer":"automatic-update-explainer-cc"),v=x(c?"selected Campaigns":"advanced-selection");return(0,h.jsxs)(xe.A,{id:"google-protection-type",onGhostButtonClick:n,ghostButtonText:r("cancel-button"),primaryButtonText:r("save-button"),onPrimaryButtonClick:()=>t(u),isPrimaryButtonLoading:a,style:{maxWidth:"794px"},children:[(0,h.jsx)(i.qY,{variant:"baseLight",children:x("protection-selection")}),(0,h.jsxs)(je.ZY,{onValueChange:m,value:u,"aria-label":"Protection type selection",children:[(0,h.jsxs)(je.Y7,{onClick:()=>m(d.GG.AUTO),children:[(0,h.jsx)(je.mJ,{value:d.GG.AUTO,id:d.GG.AUTO,children:(0,h.jsx)(je.Q4,{})}),(0,h.jsxs)(je.IG,{isFeatureEnabled:c,children:[(0,h.jsx)(i.qY,{variant:"baseBold",children:g}),(0,h.jsx)(i.qY,{variant:"baseLight",children:f})]})]}),(0,h.jsxs)(je.Y7,{onClick:()=>m(d.GG.ADVANCED),children:[(0,h.jsx)(je.mJ,{value:d.GG.ADVANCED,id:d.GG.ADVANCED,children:(0,h.jsx)(je.Q4,{})}),(0,h.jsxs)(je.IG,{isFeatureEnabled:c,children:[(0,h.jsx)(i.qY,{variant:"baseBold",children:v}),(0,h.jsx)(i.qY,{variant:"baseLight",children:x("advanced-selection-explainer")})]})]})]}),(0,h.jsx)(je.Ix,{children:(0,h.jsx)(i.FN,{type:"warning",children:(0,h.jsx)(i.qY,{variant:"baseLight",children:x("warning-message")})})})]})},Se=(0,i.zo)("div",{width:"450px",height:"150px",marginTop:"$6"}),Pe=e=>{let{closeModal:t,onBack:n}=e;const{t:o}=(0,l.$)("PMPlatforms");return(0,h.jsx)(xe.A,{onGhostButtonClick:n,ghostButtonText:o("back"),primaryButtonText:o("done"),onPrimaryButtonClick:t,children:(0,h.jsx)(Se,{children:(0,h.jsx)(i.qY,{variant:"baseLight",children:o("google-campaigns-wizard.success-explainer")})})})},Te=e=>{let{currentStep:t,accountId:n,connectionId:o,setStep:a,closeModal:i,onBack:s}=e;const r=(0,z.e)("CE_PM_GOOGLE_CAMPAIGNS"),l=I.ud.google.steps,{mutate:c,isLoading:u}=(0,ae.q)({connectionId:o,adAccountId:n,platform:d.VT.GOOGLE}),{data:p}=oe({connectionId:o,adAccountId:n}
1),m=e=>{e===d.GG.AUTO?c({protectAll:!0},{onSuccess:e=>{e instanceof Error||a(3)}}):c({protectAll:!1},{onSuccess:e=>{e instanceof Error||a(2)}})},x=()=>{a(3)};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(X.C,{onChangeStep:a,currentStep:t,steps:l}),(()=>{if(2===t){const e={accountId:n,connectionId:o,onBack:s,onSuccess:x};return r?(0,h.jsx)(me,{...e}):(0,h.jsx)(be,{...e})}return 3===t?(0,h.jsx)(Pe,{closeModal:i,onBack:s}):(0,h.jsx)(Ie,{setProtectionType:m,onCancel:i,loading:u,isAutoMode:p})})()]})};var Ae=n(61727),ke=n(44792),Me=n(12670);const $e=e=>{let{accountId:t,connectionId:n,onSuccess:a,onBack:s}=e;const{t:r}=(0,l.$)("PMPlatforms"),{data:c}=(0,ie.z)({}),d=(0,o.useMemo)((()=>{const e=[];return c instanceof Error||null===c||void 0===c||!c.connections||c.connections.forEach((t=>{t.platformType===j.w.meta&&e.push({label:t.displayId,value:`${t.entityId}`})})),e}),[c]),u=e=>{const t=d.find((t=>t.value===`${e}`));return Number(t?t.value:d[0].value)},[p,m]=(0,o.useState)(u(t)),{data:x}=(0,ke.R)({connectionId:n,adAccountId:p}),g=(0,o.useMemo)((()=>x instanceof Error||!x?[]:x.adSets),[x]),{filteredOptions:f,handleCheckboxClicked:v,handleSelectAll:C,selectedOptions:y,setFilterBy:b,filterBy:E,cleanSelection:I,sortOrder:S,handleSortChange:P}=(0,ye.E)(g),{mutate:T,isLoading:A}=(0,Me.R)({connectionId:n});return(0,h.jsx)(he,{children:(0,h.jsx)(Ce,{title:r("meta-connection-wizard.adsets-title"),searchPlaceholder:r("meta-connection-wizard.adsets-search"),buttonText:r("next-button"),entitiesName:r("meta-connection-wizard.ad-set"),buttonLoading:A,filterBy:E,options:f,selected:y,handleSelect:v,onSearch:b,handleSelectAll:C,handleSubmit:()=>{T({adAccountId:p,adSetIds:y},{onSettled:e=>{e instanceof Error||a()}})},sortDirection:S,handleSortChange:P,onBack:s,customInput:(0,h.jsx)(i.EZ,{value:d.find((e=>e.value===`${p}`)),options:d,wrapperCSS:{width:"240px"},placeholder:r("meta-connection-wizard.account-selection-placeholder"),onChange:e=>{e&&(e=>{var t;const n=null!==(t=u(Number(e)))&&void 0!==t?t:d[0];n!==p&&I(),m(n)})(e.value)}})})})};var we=n(30606),Ge=n(63738),Ne=n(55096);const Oe=e=>{let{setProtectionType:t,onCancel:n,loading:a,isAutoMode:s}=e;const{t:r}=(0,l.$)("PMPlatforms"),[c,u]=(0,o.useState)(d.GG.ADVANCED),p=e=>u(e);return(0,o.useEffect)((()=>{u(s?d.GG.AUTO:d.GG.ADVANCED)}),[s]),(0,h.jsxs)(xe.A,{id:"meta-protection-type",onGhostButtonClick:n,ghostButtonText:r("cancel-button"),primaryButtonText:r("save-button"),onPrimaryButtonClick:()=>t(c),isPrimaryButtonLoading:a,children:[(0,h.jsx)(i.qY,{variant:"baseLight",children:r("meta-campaigns-wizard.protection-selection")}),(0,h.jsxs)(je.ZY,{onValueChange:p,value:c,"aria-label":"Protection type selection",children:[(0,h.jsxs)(je.Y7,{onClick:()=>p(d.GG.ADVANCED),children:[(0,h.jsx)(je.mJ,{value:d.GG.ADVANCED,id:d.GG.ADVANCED,children:(0,h.jsx)(je.Q4,{})}),(0,h.jsxs)(je.IG,{children:[(0,h.jsx)(i.qY,{variant:"baseBold",children:r("meta-campaigns-wizard.advanced-selection")}),(0,h.jsx)(i.qY,{variant:"baseLight",children:r("meta-campaigns-wizard.advanced-selection-explainer")})]})]}),(0,h.jsxs)(je.Y7,{onClick:()=>p(d.GG.AUTO),children:[(0,h.jsx)(je.mJ,{value:d.GG.AUTO,id:d.GG.AUTO,children:(0,h.jsx)(je.Q4,{})}),(0,h.jsxs)(je.IG,{children:[(0,h.jsx)(i.qY,{variant:"baseBold",children:r("meta-campaigns-wizard.automatic-update")}),(0,h.jsx)(i.qY,{variant:"baseLight",children:(0,h.jsxs)(we.c,{ns:"PMPlatforms",i18nKey:"meta-connection-wizard.automatic-update-explainer-cc",children:["By checking this option, CHEQ Essentials will add all existing and new ad sets in your account to Meta protection. Please note, this might send all ads in your account into",(0,h.jsx)(Ge.b,{href:Ne.T.learningPhase,target:"_blank",rel:"noopener noreferrer",children:"Learning phase"}),", for Meta to calibrate your ads optimization."]})})]})]})]})]})},Le=e=>{let{currentStep:t,accountId:n,connectionId:o,setStep:a,onBack:i,closeModal:s}=e;const r=I.ud.meta.steps,{mutate:l,isLoading:c}=(0,ae.q)({connectionId:o,adAccountId:n,platform:d.VT.META}),{data:u}=(0,Ae.W)({connectionId:o,adAccountId:n}),p=e=>{e===d.GG.AUTO?l({protectAll:!0},{onSuccess:e=>{e instanceof Error||a(3)}}):l({protectAll:!1},{onSuccess:e=>{e instanceof Error||a(2)}})},m=()=>{a(3)};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(X.C,{onChangeStep:a,currentStep:t,
1steps:r}),2===t?(0,h.jsx)($e,{accountId:n,connectionId:o,onSuccess:m,onBack:i}):3===t?(0,h.jsx)(Pe,{closeModal:s,onBack:i}):(0,h.jsx)(Oe,{setProtectionType:p,onCancel:s,loading:c,isAutoMode:u})]})},De=e=>{let{isOpen:t,onOpenChange:n,campaignAccount:a}=e;const{setStep:i,onBack:s,currentStep:r}=(0,Q.h)({}),{data:l}=(0,c.o)(),u=(0,o.useMemo)((()=>l?l.reduce(((e,t)=>({...e,[(0,p.vl)(t.platformType)]:t.connectionId})),{}):{}),[l]),m=e=>{i(1),n(e)},x=()=>{m(!1)};return(0,h.jsx)(K.V,{isOpen:t,onOpenChange:m,borderRadius:"4px",children:(0,h.jsxs)(J._G,{children:[a.platform===d.VT.GOOGLE&&!!u.google&&(0,h.jsx)(Te,{closeModal:x,currentStep:r,setStep:i,onBack:s,accountId:a.accountId,connectionId:(g=a.platform,a.connectionId?a.connectionId:u[g])}),a.platform===d.VT.META&&!!u.meta&&(0,h.jsx)(Le,{closeModal:x,currentStep:r,setStep:i,onBack:s,accountId:a.accountId,connectionId:u.meta})]})});var g};var Be=n(89611);function ze(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(0,Be.Z)(e,t)}var Re=n(63366),Ze=n(54164);const Ye=!1,Ve=o.createContext(null);var Fe=function(e){return e.scrollTop},qe="unmounted",Ue="exited",We="entering",_e="entered",He="exiting",Ke=function(e){function t(t,n){var o;o=e.call(this,t,n)||this;var a,i=n&&!n.isMounting?t.enter:t.appear;return o.appearStatus=null,t.in?i?(a=Ue,o.appearStatus=We):a=_e:a=t.unmountOnExit||t.mountOnEnter?qe:Ue,o.state={status:a},o.nextCallback=null,o}ze(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===qe?{status:Ue}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==We&&n!==_e&&(t=We):n!==We&&n!==_e||(t=He)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,o=this.props.timeout;return e=t=n=o,null!=o&&"number"!==typeof o&&(e=o.exit,t=o.enter,n=void 0!==o.appear?o.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===We){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:Ze.findDOMNode(this);n&&Fe(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ue&&this.setState({status:qe})},n.performEnter=function(e){var t=this,n=this.props.enter,o=this.context?this.context.isMounting:e,a=this.props.nodeRef?[o]:[Ze.findDOMNode(this),o],i=a[0],s=a[1],r=this.getTimeouts(),l=o?r.appear:r.enter;!e&&!n||Ye?this.safeSetState({status:_e},(function(){t.props.onEntered(i)})):(this.props.onEnter(i,s),this.safeSetState({status:We},(function(){t.props.onEntering(i,s),t.onTransitionEnd(l,(function(){t.safeSetState({status:_e},(function(){t.props.onEntered(i,s)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),o=this.props.nodeRef?void 0:Ze.findDOMNode(this);t&&!Ye?(this.props.onExit(o),this.safeSetState({status:He},(function(){e.props.onExiting(o),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:Ue},(function(){e.props.onExited(o)}))}))}))):this.safeSetState({status:Ue},(function(){e.props.onExited(o)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(o){n&&(n=!1,t.nextCallback=null,e(o))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:Ze.findDOMNode(this),o=null==e&&!this.props.addEndListener;if(n&&!o){if(this.props.addEndListener){var a=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],i=a[0],s=a[1];this.props.addEndListener(i,s)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if(e===qe)return null;var t=this.props,n=t.children,a=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,(0,Re.Z)(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return o.createElement(Ve.Provider,{value:null},"function"===typeof n?n(e,a):o.cloneElement(o.Children.only(n),a))},t}(o.Component);function Qe(){}
vendor: 2,143 bytes, line 1
1Ke.contextType=Ve,Ke.propTypes={},Ke.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Qe,onEntering:Qe,onEntered:Qe,onExit:Qe,onExiting:Qe,onExited:Qe},Ke.UNMOUNTED=qe,Ke.EXITED=Ue,Ke.ENTERING=We,Ke.ENTERED=_e,Ke.EXITING=He;const Je=Ke;var Xe,et;var tt="out-in",nt="in-out",ot=function(e,t,n){return function(){var o;e.props[t]&&(o=e.props)[t].apply(o,arguments),n()}},at=((Xe={})[tt]=function(e){var t=e.current,n=e.changeState;return o.cloneElement(t,{in:!1,onExited:ot(t,"onExited",(function(){n(We,null)}))})},Xe[nt]=function(e){var t=e.current,n=e.changeState,a=e.children;return[t,o.cloneElement(a,{in:!0,onEntered:ot(a,"onEntered",(function(){n(We)}))})]},Xe),it=((et={})[tt]=function(e){var t=e.children,n=e.changeState;return o.cloneElement(t,{in:!0,onEntered:ot(t,"onEntered",(function(){n(_e,o.cloneElement(t,{in:!0}))}))})},et[nt]=function(e){var t=e.current,n=e.children,a=e.changeState;return[o.cloneElement(t,{in:!1,onExited:ot(t,"onExited",(function(){a(_e,o.cloneElement(n,{in:!0}))}))}),o.cloneElement(n,{in:!0})]},et),st=function(e){function t(){for(var t,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return(t=e.call.apply(e,[this].concat(o))||this).state={status:_e,current:null},t.appeared=!1,t.changeState=function(e,n){void 0===n&&(n=t.state.current),t.setState({status:e,current:n})},t}ze(t,e);var n=t.prototype;return n.componentDidMount=function(){this.appeared=!0},t.getDerivedStateFromProps=function(e,t){return null==e.children?{current:null}:t.status===We&&e.mode===nt?{status:We}:!t.current||(n=t.current,a=e.children,n===a||o.isValidElement(n)&&o.isValidElement(a)&&null!=n.key&&n.key===a.key)?{current:o.cloneElement(e.children,{in:!0})}:{status:He};var n,a},n.render=function(){var e,t=this.props,n=t.children,a=t.mode,i=this.state,s=i.status,r=i.current,l={children:n,current:r,changeState:this.changeState,status:s};switch(s){case We:e=it[a](l);break;case He:e=at[a](l);break;case _e:e=r}return o.createElement(Ve.Provider,{value:{isMounting:!this.appeared}},e)},t}(o.Component);st.propTypes={},st.defaultProps={mode:tt};const rt=st;var lt=n(87462);
1function ct(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var dt=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return o=t,void((n=e).classList?n.classList.remove(o):"string"===typeof n.className?n.className=ct(n.className,o):n.setAttribute("class",ct(n.className&&n.className.baseVal||"",o)));var n,o}))},ut=function(e){function t(){for(var t,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return(t=e.call.apply(e,[this].concat(o))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var o=t.resolveArguments(e,n),a=o[0],i=o[1];t.removeClasses(a,"exit"),t.addClass(a,i?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var o=t.resolveArguments(e,n),a=o[0],i=o[1]?"appear":"enter";t.addClass(a,i,"active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var o=t.resolveArguments(e,n),a=o[0],i=o[1]?"appear":"enter";t.removeClasses(a,i),t.addClass(a,i,"done"),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"appear"),t.removeClasses(n,"enter"),t.addClass(n,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"exit"),t.addClass(n,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,o="string"===typeof n,a=o?""+(o&&n?n+"-":"")+e:n[e];return{baseClassName:a,activeClassName:o?a+"-active":n[e+"Active"],doneClassName:o?a+"-done":n[e+"Done"]}},t}ze(t,e);var n=t.prototype;return n.addClass=function(e,t,n){var o=this.getClassNames(t)[n+"ClassName"],a=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&a&&(o+=" "+a),"active"===n&&e&&Fe(e),o&&(this.appliedClasses[t][n]=o,function(e,t){e&&t&&t.split(" ").forEach((function(t){return o=t,void((n=e).classList?n.classList.add(o):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(n,o)||("string"===typeof n.className?n.className=n.className+" "+o:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+o)));var n,o}))}(e,o))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],o=n.base,a=n.active,i=n.done;this.appliedClasses[t]={},o&&dt(e,o),a&&dt(e,a),i&&dt(e,i)},n.render=function(){var e=this.props,t=(e.classNames,(0,Re.Z)(e,["classNames"]));return o.createElement(Je,(0,lt.Z)({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(o.Component);ut.defaultProps={classNames:""},ut.propTypes={};const pt=ut;var ht=n(93772),mt=n(15523),xt=n(47486),gt=n(2400),ft=n(93929);const vt=()=>{const e=(0,de.NL)(),{accountId:t}=(0,ne.L)();return(0,ue.D)({mutationFn:e=>{let{connectionId:n,adAccountId:o,platform:a}=e;return(async(e,t,n,o)=>await(0,te.W)({url:`/accounts/${e}/${"meta"===o?"facebook":"google"}/${t}/ad-accounts/${n}`,method:"DELETE",onSuccessToast:{message:O.Z.t(`table.successfully-deleted-${o}-connection`,{ns:"PMPlatforms"})}}))(t,n,o,a)},onSettled:()=>{e.invalidateQueries({queryKey:["getPlatforms"]}),e.invalidateQueries({queryKey:["getPlatformsConnections"]}),e.invalidateQueries({queryKey:["getUserDomains"]}),e.invalidateQueries({queryKey:["domains"]})}})};var Ct=n(87991);const yt=(0,i.zo)("div",{display:"flex",alignItems:"center",gap:"$2"}),bt=(0,i.zo)("button",{all:"unset",cursor:"pointer",color:"$black","&:hover":{textDecoration:"underline",color:"$primaryColor"},"> span":{color:"$primaryColor"},variants:{active:{true:{cursor:"default",color:"$black",fontWeight:"$l","&:hover":{textDecoration:"none"},"> span":{color:"$black"}}}}}),Et=e=>{let{firstCrumbsText:t,crumbs:n,currentCrumbId:o,onClick:a,containerStyles:s}=e;return(0,h.jsxs)(yt,{css:s,children:[(0,h.jsx)(bt,{active:!o,onClick:()=>a(void 0),children:(0,h.jsx)(i.qY,{variant:"baseRegular",children:t})},"no-crumbs"),n.map((e=>(0,h.jsxs)(h.Fragment,{children:["/",(0,h.jsx)(bt,{active:o===e.id,onClick:()=>a(e.id),children:(0,h.jsx)(i.qY,{variant:"baseRegular",children:e.label})},e.id)]})))]})},jt=(0,i.zo)("div",{display:"flex",flexDirection:"column",minHeight:"200px",height:"100%"}),It=(0,i.zo)("header",{width:"calc(100% - var(--space-12))",display:"flex",borderBottom:"$separatorColor",borderBottomWidth:"$double",borderBottomStyle:"solid"}),St=(0,i.zo)("div",{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:"$8",paddingRight:"$12"}),Pt=e=>{let{search:t,searchPage:n,crumbs:o,selectedConnection:a,onSetConnection:s}=e;const{t:r}=(0,l.$)("PMPlatforms");return(0,h.jsxs)(St,{children:[(0,h.jsx)(Et,{firstCrumbsText:r("table.all-accounts"),crumbs:o,currentCrumbId:a,onClick:s}),(0,h.jsx)(i.Wu,{value:t,onChange:e=>n(e.target.value),iconRight:(0,h.jsx)(C.G,{icon:f.Y$T}),placeholder:r("table.searchPlaceholder"),css:{width:"300px"}})]})};var Tt=n(25984);(0,i.zo)("button",{all:"unset",borderRadius:"100%",height:"16px",width:"16px",display:"inline-flex",alignItems:"center",justifyContent:"center",borderColor:"$primaryColor",borderWidth:"$single",borderStyle:"solid",cursor:"pointer",backgroundColor:"$pageBlockColor","&:hover":{opacity:.5},"& svg":{color:"$primaryColor"}});const At=(0,i.zo)("span",{overflowWrap:"break-word",fontSize:"$md",fontWeight:"$l",color:"$textColor"}),kt=(0,i.zo)("span",{overflowWrap:"break-word",fontSize:"$md",fontWeight:"$sb"}),Mt=(0,i.zo)("button",{all:"unset",cursor:"pointer",display:"flex",alignItems:"center",color:"$primaryColor","&:hover>*":{color:"$buttonHovered",textDecoration:"underline"},":first-child":{marginRight:"5px"}}),$t=(0,i.zo)("button",{all:"unset",cursor:"pointer",display:"flex",alignItems:"center",":hover":{color:"$primaryColor"}}),wt=(0,i.zo)("div",{display:"flex",alignItems:"center",":first-child":{marginRight:"$4"}}),Gt=e=>{let{value:t,isMCC:n}=e;const{t:o}=(0,l.$)("PMGeneral");return(0,h.jsxs)(wt,{children:[(0,h.jsx)(b.D,{serviceName:t,iconProps:{width:"18px",height:"18px"}}),(0,h.jsx)(At,{children:o(`platforms.${n?"googleMCC":t}`)})]})},Nt=e=>{let{onRemoveClick:t}=e;return(0,h.jsx)($t,{onClick:()=>t(),children:(0,h.jsx)(C.G,{icon:f.Vui})})},Ot=e=>{let{onClick:t,entityType:n}=e;const{t:o}=(0,l.$)("PMPlatforms");return(0,h.jsxs)(Mt,{onClick:t,children:[(0,h.jsx)(C.G,{icon:f.gr5}),(0,h.jsx)(kt,{children:(()=>{switch(n){case"AdAccount":return o("table.campaignSettings");case"Audience":return o("table.audienceSettings");case"PixelGuard":return o("table.pixelGuardSettings")}})()})]})},Lt=e=>{let{cellKey:t,data:n,openCampaignsModal:o,onDeleteConnection:a,onSetConnection:s,isMCC:r,isWithChildren:c}=e;const{t:u}=(0,l.$)("PMPlatforms"),m=f.K96;switch(t){case"platformType":return(0,h.jsx)(Gt,{isMCC:r,value:(0,p.vl)(n.platformType)});case"settings":return c?(0,h.jsx)("div",{}):(0,h.jsx)(Ot,{entityType:n.entityType,onClick:()=>
1o({connectionId:n.connectionId,entityId:n.entityId,platform:n.platformType.toLocaleLowerCase(),entityType:n.entityType})});case"disable":return r?(0,h.jsx)("div",{}):(0,h.jsx)(Nt,{onRemoveClick:()=>a({connectionId:n.connectionId,entityId:n.entityId,platform:n.platformType.toLocaleLowerCase(),entityType:n.entityType})});case"entityType":return c?(0,h.jsx)("div",{}):(0,h.jsx)(At,{children:u(`table.${n.entityType===d.PLATFORM_ENTITY_TYPES.AD_ACCOUNT&&n.platformType.toLowerCase()===d.VT.GOOGLE?"googleAdAccount":n.entityType}`)});case"openRow":return c?(0,h.jsx)(i.hU,{onClick:s,style:{width:"80%",display:"flex",justifyContent:"center",color:i.theme.colors.primaryColor.value},children:(0,h.jsx)(i.u,{tooltiptContent:u("table.linked-accounts-cta-tooltip"),constentStyle:{visibility:"visible"},children:(0,h.jsx)(C.G,{icon:m,width:"14px",height:"14px"})})}):(0,h.jsx)("span",{});default:return(0,h.jsx)(At,{children:n[t]})}},Dt=[{key:"openRow",title:"",flex:.1,nonSortable:!0},{key:"platformType",title:O.Z.t("table.platform",{ns:"PMPlatforms"}),flex:1},{key:"entityType",title:O.Z.t("table.entity",{ns:"PMPlatforms"}),flex:1},{key:"displayId",title:O.Z.t("table.accountId",{ns:"PMPlatforms"}),flex:1.5},{key:"domainAddress",title:O.Z.t("table.tag",{ns:"PMPlatforms"}),flex:1.5},{key:"settings",title:O.Z.t("table.settings",{ns:"PMPlatforms"}),flex:1.5,nonSortable:!0,tooltip:O.Z.t("table.settingsTooltip",{ns:"PMPlatforms"})},{key:"disable",title:"",flex:.2,nonSortable:!0}],Bt=(0,i.zo)("div",{width:"calc(100% - var(--space-12))",display:"flex",alignItems:"center",borderBottom:"1px solid $separatorColor",paddingBlock:"$8","&:hover":{backgroundColor:"$hoveredRow"}}),zt=(0,i.zo)("div",{display:"felx",alignItems:"center",justifyContent:"center",minWidth:"48px"}),Rt=e=>{let{data:t,isWithChildren:n,isMCC:a,openCampaignsModal:i,onDeleteConnection:s,onSetConnection:r}=e;const l=Dt,[c,d]=(0,o.useState)(!0);return(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(Bt,{children:l.map((e=>(0,h.jsx)(zt,{css:{flex:`${e.flex} ${e.flex} `},children:(0,h.jsx)(Lt,{openCampaignsModal:i,onDeleteConnection:s,cellKey:e.key,data:t,isMCC:a,isWithChildren:n,rowOpen:c,onOpenRow:()=>d(!c),onSetConnection:()=>r?r(t.connectionId):d(!c)})},(0,Tt.x0)())))})})},Zt=e=>{let{sortedOptions:t,onOpenCampaignsModal:n,onDeleteConnection:o,onSetConnection:a}=e;return(0,h.jsx)(h.Fragment,{children:t.map((e=>(0,h.jsx)(Rt,{openCampaignsModal:n,onDeleteConnection:o,isWithChildren:e.manager,isMCC:e.connectionType===d.H6.MCC,onSetConnection:a,data:e},"platformRow"+(0,Tt.x0)())))})},Yt=[{key:"openRow",title:"",flex:.1,nonSortable:!0},{key:"platformType",title:O.Z.t("table.platform",{ns:"PMPlatforms"}),flex:1},{key:"entityType",title:O.Z.t("table.entity",{ns:"PMPlatforms"}),flex:1},{key:"displayId",title:O.Z.t("table.accountId",{ns:"PMPlatforms"}),flex:1.5},{key:"domainAddress",title:O.Z.t("table.tag",{ns:"PMPlatforms"}),flex:1.5},{key:"settings",title:O.Z.t("table.settings",{ns:"PMPlatforms"}),flex:1.5,nonSortable:!0,tooltip:O.Z.t("table.settingsTooltip",{ns:"PMPlatforms"})},{key:"disable",title:"",flex:.2,nonSortable:!0}],Vt=(O.Z.t("table.platform",{ns:"PMPlatforms"}),O.Z.t("table.entity",{ns:"PMPlatforms"}),O.Z.t("table.accountId",{ns:"PMPlatforms"}),O.Z.t("table.settings",{ns:"PMPlatforms"}),O.Z.t("table.settingsTooltip",{ns:"PMPlatforms"}),e=>{var t;let{openCampaignsModal:n}=e;const{t:a}=(0,l.$)("PMPlatforms"),{track:s}=(0,i.Un)(),[r,c]=(0,o.useState)(void 0),{mutate:d}=vt(),{mutate:u}=(0,gt.e)(),{mutate:m}=(0,ft.N)(),{mutate:x}=(0,xt.I)(),[g,f]=(0,o.useState)(!1),[v,C]=(0,o.useState)(void 0),y=e=>{const t=L.find((t=>t.connectionId===e));C(t)},b=(0,o.useRef)(null),E=(0,o.useRef)(null),j=v?b:E,{search:I,pageCount:S,searchPage:P,debouncedSearch:T,page:A,onFirstPage:k,onLastPage:M,onNextPage:$,onPrevPage:w,setPageCount:G}=(0,Ct.h)({}),N=(0,o.useMemo)((()=>0===T.length?{limit:50,page:A}:{limit:50,page:A,search:T}),[A,T]),{data:O}=(0,ie.z)({pagination:N,parentAccountId:null===v||void 0===v?void 0:v.connectionId});(0,o.useEffect)((()=>{null!==O&&void 0!==O&&O.metadata&&G(O.metadata.pageCount)}),[null===O||void 0===O||null===(t=O.metadata)||void 0===t?void 0:t.pageCount]);const L=(0,o.useMemo)((()=>null!==O&&void 0!==O&&O.connections?O.connections:[]),[O]),{sortedOptions:D,sortOrder:B,handleSortChange:z}=function(e){const[t,n]=(0,o.useState)(ge.zE),[a,i]=(0,o.useState)(void 0),s=e=>{a&&t===ge.zE?e.sort(((e,t)=>String(e[a]).localeCompare(String(t[a])))):a&&t===ge.hr&&e.sort(((e,t)=>String(t[a]).localeCompare(String(e[a]))))},r=(0,o.useMemo)((()=>{const t=[...e],n=t.some((e=>e.children));return s(t),n&&t.forEach((e=>{e.children&&s(e.children)})),t}),[e,a,t]),l=()=>{n((e=>e===ge.zE?ge.hr:ge.zE))};return{sortedOptions:r,sortOrder:t,sortBy:a,handleSortDirectionChange:l,handleSortChange:e=>{a===e?l():i(e)}}}(L),R=Yt,Z=()=>{c(void 0)},Y=(0,o.useMemo)((()=>v?[{id:v.connectionId,label:v.displayId}]:[]),[v]);return(0,h.jsxs)(jt,{children:[(0,h.jsx)(Pt,{search:I,searchPage:P,crumbs:Y,selectedConnection:null===v||void 0===v?void 0:v.connectionId,onSetConnection:y}),(0,h.jsx)(It,{children:R.map((e=>(0,h.jsx)(mt.x,{header:e.title,onClick:()=>z(e.key),sorted:B,tooltip:e.tooltip,css:{flex:e.flex},nonSortable:e.nonSortable},e.key)))}),(0,h.jsx)(rt,{children:(0,h.jsx)(pt,{nodeRef:j,addEndListener:e=>{j.current&&j.current.addEventListener("transitionend",e,!1)},timeout:100,classNames:"row-transition",children:(0,h.jsx)("div",{ref:j,style:{height:"100%",flex:1,overflow:"auto"},children:(0,h.jsx)(i.RY,{wrapperStyle:{flex:1,height:"100%"},paginationStyle:{"> nav":{paddingBottom:"0px",paddingTop:"16px"}},body:(0,h.jsx)(Zt,{sortedOptions:D,onOpenCampaignsModal:e=>{n((0,p.vl)(e.platform),e.entityId,e.entityType,e.connectionId)},onDeleteConnection:e=>{c(e)},onSetConnection:y}),pageCount:S||1,currentPage:A,onFirstPage:k,onLastPage:M,onNextPage:$,onPreviousPage:w})})},v?"in":"out")}),(0,h.jsx)(ht.c,{isOpen:!!r,title:a("table.deleteAccountTitle"),bodyText:a("table.deleteAccountBody",{id:(null===r||void 0===r?void 0:r.entityId)||""}),confirmText:a("table.delete"),cancelText:a("table.cancel"),loading:g,onCancel:Z,onConfirm:()=>{"AdAccount"===(null===r||void 0===r?void 0:r.entityType)&&null!==r&&void 0!==r&&r.connectionId&&d({connectionId:r.connectionId,adAccountId:r.entityId,platform:r.platform},{onSuccess:Z}
1),"PixelGuard"===(null===r||void 0===r?void 0:r.entityType)&&(f(!0),m({pixelId:`${r.entityId}`},{onSuccess:Z,onSettled:()=>{f(!1),s(["dataLayer","segment"],"Google.RemovePixelGuard",{})}})),"Audience"===(null===r||void 0===r?void 0:r.entityType)&&(f(!0),"google"===(null===r||void 0===r?void 0:r.platform)?x({audienceId:r.entityId},{onSettled:()=>{Z(),f(!1),s(["dataLayer","segment"],"Google.RemoveConnection",{})}}):u({audienceId:r.entityId},{onSettled:()=>{Z(),f(!1),s(["dataLayer","segment"],"Microsoft.RemoveConnection",{})}}))},onOpenChange:Z})]})}),Ft=()=>{const{t:e}=(0,l.$)("PMPlatforms"),[t,n]=(0,o.useState)(void 0),[a,i]=(0,o.useState)({pixelGuard:!1,platforms:!1,microsoftAudience:!1,googleAudience:!1}),s=e=>{i({...a,[e]:!a[e]})};return(0,h.jsxs)(m,{id:"connected-platforms-table",header:e("tableHeader"),css:{flex:1,overflow:"hidden"},children:[(0,h.jsx)(Vt,{openCampaignsModal:(e,t,o,a)=>{"AdAccount"===o?s("platforms"):"PixelGuard"===o?s("pixelGuard"):"Audience"===o&&s("google"===e?"googleAudience":"microsoftAudience"),n({platform:e,accountId:t,connectionId:a})}}),(null===t||void 0===t?void 0:t.platform)&&(0,h.jsx)(De,{campaignAccount:t,isOpen:!!t&&a.platforms,onOpenChange:()=>{i({...a,platforms:!1})}}),(0,h.jsx)(H.G,{onOpenChange:()=>s("pixelGuard"),isOpen:a.pixelGuard,pixelId:null===t||void 0===t?void 0:t.accountId}),(0,h.jsx)(W.j,{audienceId:null===t||void 0===t?void 0:t.accountId,onOpenChange:()=>s("googleAudience"),isOpen:a.googleAudience}),(0,h.jsx)(_.B,{audienceId:null===t||void 0===t?void 0:t.accountId,onOpenChange:()=>s("microsoftAudience"),isOpen:a.microsoftAudience})]})},qt=(0,i.zo)("div",{display:"flex",flexDirection:"column",background:"$offWhite",gap:"$8",overflow:"hidden",minHeight:"100%"}),Ut=()=>{const{selectedPlatform:e}=(0,u.Z)(),{isLoading:t}=(0,r.o)(e),{isLoading:n}=(0,s.E)(),o=t||n;return(0,h.jsxs)(qt,{id:"platforms-page",css:{height:"100%"},children:[o&&(0,h.jsx)(i.s_,{zIndex:1}),(0,h.jsx)(U,{}),(0,h.jsx)(Ft,{})]})},Wt=()=>(0,h.jsx)(a.Z5,{children:(0,h.jsx)(a.AW,{path:"*",element:(0,h.jsx)(Ut,{})})})}}]);
2//# sourceMappingURL=639.9893592d.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.