1"use strict";(self["chunk_web "]=self["chunk_web "]||[]).push([["7042"],{94085(){},78054(e,t,a){a.d(t,{$:()=>n,b:()=>r});var i=a(31085),s=a(99075);let o=(0,s.createContext)({actions:null,setActions:()=>{}}),r=e=>{let{children:t}=e,[a,r]=(0,s.useState)(null);return(0,i.jsx)(o.Provider,{value:{actions:a,setActions:r},children:t})},n=()=>(0,s.useContext)(o)},55750(e,t,a){a.d(t,{A:()=>R});var i=a(31085),s=a(12142),o=a(46640),r=a(19648),n=a(15566),l=a(46621),d=a(99075),c=a.n(d),u=a(89638),p=a(13995),h=a(23190),T=a(38052),g=a(63901),m=a(57643),S=a(74878),f=a(36811),x=a(25588),A=a(11540),O=a(28674),C=a(73072),y=a(22600),E=a(16173),_=a(90766);let I=e=>{let{saleState:t}=e;return(0,i.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,i.jsx)(A.Q,{type:C.AT.WARNING,width:14}),(0,i.jsxs)(O.GW,{children:["Some calls already have the state ",t," and will be ignored"]})]})};function R(e){var t,a,A,O,C;let[v,N]=c().useState({data:[],notRecurringSelectedSales:[],loading:null==e.data,allSelected:!1,selectedRows:[],selectedGroupRows:[],selectedLeads:[],actionType:null,tableSelection:new o.D2({allSelected:!1}),updateSaleModalOpener:()=>void 0,displayedData:[],currentPage:1,sentCalls:!1,selectedRowsAuxiliary:new Map,showDetails:!1,saleId:0,loadingAttributedSources:!0,idsWereFilteredOut:!1});(0,d.useEffect)(()=>{e.inner&&e.groupId&&B(e.groupId)},[]),(0,d.useEffect)(()=>{let e=F(),t=G();N(a=>({...a,notRecurringSelectedSales:e,tableSelection:t}))},[e.data,v.allSelected,v.selectedRows,v.actionType]);let L=()=>e.groupSalesBy===r.W.ORDERS,b=e=>new Set(v.selectedRows.filter(e).map(e=>e.id??e.groupId)),j=()=>{N(e=>({...e,actionType:null}))},G=()=>{let e=w(),t=(0,n.W)(v.actionType),a=v.selectedRows.map(e=>t&&e.leadId?e.leadId:e.id).filter(e=>null!=e),i=e.filter(e=>"string"==typeof e),s=v.allSelected;return new o.D2({allSelected:s,[s?"notSelected":"selected"]:a,[s?"groupNotSelected":"groupSelected"]:i})},w=()=>{switch(v.actionType){case"MARK_AS_UNQUALIFIED":case"MARK_AS_QUALIFIED":case"MARK_AS_CANCELLED":case"MARK_AS_NO_SHOW":return M();case"UPDATE_AD_OPTIMIZATION_CONSENT":case"DELETE":case"ADD_TAGS":case"REMOVE_TAGS":case"REPROCESS_LEADS":return k(v.selectedRows);case"DELETE_CALLS":return[...b(e=>e.callProduct&&W(e))];case"DELETE_SALES":return[...b(e=>!e.callProduct&&D(e))];case"MARK_AS_REFUNDED":return[...b(e=>!e.callProduct&&!e.refunded&&D(e))];case"MARK_AS_RECURRING":return[...b(e=>!e.callProduct&&!e.recurring&&D(e))];case"MARK_AS_NON_RECURRING":return[...b(e=>!e.callProduct&&e.recurring&&D(e))];default:return[]}},D=e=>L()?P(e):W(e),P=e=>{var t;return v.selectedGroupRows.includes(e.groupId||(null==(t=e.id)?void 0:t.toString()))},F=()=>v.allSelected?[]:(e.data||v.data).filter(e=>v.selectedRows.some(t=>t.id===e.id)&&!e.recurring).map(e=>e.id),M=()=>{if(!(0,E.V)(e.type,"dmtable-calls")||!(0,n.U)(v.actionType))return[];let t=(0,n.yd)(v.actionType),a=H(),i=U(a,t),s=a.length!==i.length,o=i.find(e=>e.conversionStateInformation.includes(y.M.SENT));return N(e=>({...e,sentCalls:!!o,idsWereFilteredOut:s})),i.map(e=>e.id)},U=(e,t)=>e.filter(e=>e.state!==t),k=t=>(0,E.V)(e.type,"dmtable-leads")?t.map(e=>e.id):Array.from(new Set(e.data.filter(e=>(null==e?void 0:e.leadId)!=null&&(null!=e.id&&t.some(t=>t.id===e.id)||null!=e.groupId&&t.some(t=>t.id===Number.parseInt(e.groupId)))).map(e=>e.leadId))),W=e=>v.selectedRows.some(t=>t.id===e.id),B=t=>{e.getSalesForGroupId(t).then(e=>{N(t=>({...t,data:e,loading:!1}))})},H=()=>{let{allSelected:t,selectedRows:a}=v;return[...new Map(e.data.map(e=>[e.id,e])).values()].filter(e=>t?!(null==a?void 0:a.some(t=>t.id===e.id)):null==a?void 0:a.some(t=>t.id===e.id))},J=(0,h.w)({type:e.type,groupSalesBy:e.groupSalesBy,tableRef:e.tableRef,salesRequest:e.salesRequest,inner:e.inner,onSubscriptionSelect:(t,a)=>e.onSubscriptionSelect(t,a),onEmailSelect:t=>e.onEmailSelect(t),onCallSelected:t=>e.onCallSelected(t),setState:e=>N(t=>({...t,...e}))});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{height:"100%",display:"flex",flexDirection:"column",width:e.containerWidth},children:(0,i.jsx)(s.li,{innerRef:e.tableRef,columns:e.columns||J,data:e.inner?v.data:e.data,designType:e.designType||"CLASSIC",id:e.type,showIDColumn:e.showIDColumn,getId:e=>{var t,a;return(null==(t=e.id)?void 0:t.toString())??(null==(a=e.groupId)?void 0:a.toString())},expandable:(()=>
1{if(e.groupSalesBy===r.W.ORDERS)return e=>!!e.groupId})(),renderRowSubComponent:e.inner?void 0:t=>{var a,s;return(0,i.jsx)(R,{type:e.type,id:"sub-dmtable-"+(L()&&t.groupId?t.groupId.toString():null==(a=t.id)?void 0:a.toString()),columns:(null==(s=e.tableRef)?void 0:s.current)?J.filter(t=>{var a;return!(null==(a=e.tableRef.current)?void 0:a.hiddenColumns.includes(t.Header))&&["Name","Income",(0,_.v6)("COST_OF_GOODS"),(0,_.v6)("SHIPPING_VALUE"),(0,_.v6)("TAXES"),"Refund"].includes(t.Header)}).map(e=>({...e,disableSortBy:!0})):J.filter(e=>["Name","Income",(0,_.v6)("COST_OF_GOODS"),(0,_.v6)("SHIPPING_VALUE"),(0,_.v6)("TAXES"),"Refund"].includes(e.Header)).map(e=>({...e,disableSortBy:!0})),groupId:L()&&t.groupId,onEmailSelect:e.onEmailSelect,showIDColumn:L(),getSalesForGroupId:e.getSalesForGroupId,inner:!0,minColumnWidth:50,groupSalesBy:r.W.NONE,origin:"WEBAPP"})},manualPagination:!e.inner,avoidScalePageToViewportHeight:e.avoidScalePageToViewportHeight,totalCount:e.totalCount,fetchPage:e.fetchPage,rowSelect:!e.groupId&&!e.inner&&!l.x0.getState().isExternalApp&&"EXTENSION"!==e.origin,onSelect:!l.x0.getState().isExternalApp&&((t,a,i)=>{var s,o,r,n,l;let d,c=[],u=[];L()?u=t:c=t.map(Number);let p=new Map(v.selectedRowsAuxiliary),h=(s=i,o=a,r=p,n=e.controlledPageIndex,l=v.allSelected,d=[],s.length>0&&"string"==typeof s[0]&&"pageSizeChange"!==s[0]?(r.set(n,s),d=Array.from(r.values()).flat()):l!==o?r.clear():(r.set(n,s),d=Array.from(r.values()).flat()),d);N(e=>({...e,selectedRowsAuxiliary:p,allSelected:a,selectedRows:h,selectedGroupRows:u,selectedLeads:h.filter(e=>(null==e?void 0:e.leadId)!=null).map(e=>e.leadId)})),e.onRowSelect&&e.onRowSelect(c)}),isLoading:v.loading||e.isLoading,gridStyles:{height:"0",flex:1},paginatorStyles:e.inner?{display:"none"}:{display:""},initialPageSize:e.inner?30:20,numberOfSkeletons:e.inner?3:10,controlledPageIndex:e.controlledPageIndex,nonExpandableCells:["lead","selection"],maxResultSize:e.maxResultSize,minColumnWidth:e.minColumnWidth,actionsFooter:"EXTENSION"!==e.origin&&!e.inner&&(v.selectedRows.length>0||v.allSelected)&&(0,i.jsx)(p.A,{totalRecurringCount:e.totalRecurringCount,totalCount:e.totalCount,totalRefundsCount:e.totalRefundsCount,leadsCount:e.countLeads,allSelected:v.allSelected,selectedStates:(0,E.V)(e.type,"dmtable-calls")?[...new Set(H().map(e=>e.state))]:[],selectedRowsCount:L()?null==(t=v.selectedGroupRows)?void 0:t.length:(null==(a=v.selectedRows)?void 0:a.length)+(null==(A=v.selectedGroupRows)?void 0:A.length),selectedRecurringSelectedSalesCount:(null==(O=v.selectedRows)?void 0:O.length)-v.notRecurringSelectedSales.length,selectedNotRecurringSelectedSalesCount:v.notRecurringSelectedSales.length,updateSaleModalOpener:()=>{v.updateSaleModalOpener(v.selectedRows[0].id)},onSelected:e=>{N(t=>({...t,actionType:e}))},groupSalesBy:e.groupSalesBy,type:e.type}),customTableBorder:e.customTableBorder,autoHidePaginator:e.autoHidePaginator,hideBottomHeader:e.hideBottomHeader,paginatorColumn:e.paginatorColumn,noResultsData:e.noResultsData})}),!e.inner&&((0,E.V)(e.type,"dmtable-leads")?g.A.hasFeatureFlag(T.a.SALES_DATA_LEADS_ACTIONS):(0,E.V)(e.type,"dmtable-calls")?g.A.hasFeatureFlag(T.a.SALES_DATA_CALLS_ACTIONS):g.A.hasFeatureFlag(T.a.SALES_DATA_SALES_ACTIONS))&&(0,i.jsx)(u.A,{show:null!==v.actionType&&!["MANAGE_PROPERTIES"].includes(v.actionType),action:v.actionType,onClose:j,onDelete:()=>{var t;null==(t=e.tableRef.current)||t.clearSelection(),N(e=>({...e,selectedRowsAuxiliary:new Map,allSelected:!1,selectedRows:[],selectedGroupRows:[],selectedLeads:[]}))},type:e.type,tableSelection:v.tableSelection,filters:e.filters,pagination:e.pagination,count:(()=>{switch(v.actionType){case"UPDATE_AD_OPTIMIZATION_CONSENT":case"DELETE":case"REPROCESS_LEADS":case"ADD_TAGS":case"REMOVE_TAGS":case"DELETE_CALLS":case"MARK_AS_UNQUALIFIED":return e.totalCount;case"DELETE_SALES":return e.totalCount-(e.totalCallCount||0);case"MARK_AS_REFUNDED":return e.totalCount-(e.totalRefundsCount||0)-(e.totalCallCount||0);case"MARK_AS_RECURRING":return e.totalCount-(e.totalCallCount||0)-(e.totalRecurringCount||0);case"MARK_AS_NON_RECURRING":if(!v.allSelected)return e.totalCount-(e.totalCallCount||0)-(v.notRecurringSelectedSales.length||0);return e.totalRecurringCount||0;default:return 0}})(),onDMActionSelected:e.onDMActionSelected,extraContent:v.idsWereFilteredOut?(0,i.jsx)(I,{saleState:(0,n.yd)(v.actionType)}
1):null,sentCalls:v.sentCalls}),((0,S.hj)(v.selectedLeads)||(0,S.hj)(v.selectedRows))&&(0,i.jsx)(x.A,{id:"add-update-sale-dm-table",leadId:v.selectedLeads[0]??(null==(C=k(v.selectedRows))?void 0:C[0]),editSaleModalOpenerSetter:e=>{N(t=>({...t,updateSaleModalOpener:e}))}}),(0,S.hj)(v.selectedRows)&&1==v.selectedRows.length&&(0,i.jsxs)(m.aF,{id:"manage-sale-properties",visible:null!==v.actionType&&"MANAGE_PROPERTIES"==v.actionType,width:950,onBackdropClick:j,children:[(0,i.jsx)(m.rQ,{title:"Sale properties",closeModal:j}),(0,i.jsx)(m.cw,{children:(0,i.jsx)(f.i,{entityId:v.selectedRows[0].id,entityType:"SALE"})})]})]})}},79035(e,t,a){a.d(t,{A:()=>h});var i=a(31085),s=a(28674),o=a(99075),r=a.n(o),n=a(8113);a(94085);var l=a(51135),d=a(12142),c=a(90990),u=a(15324),p=a(5282);function h(e){let[t,a]=r().useState(""),[o,h]=r().useState(0),T=[" "],g=["external id","externalintegrationuniqueid"],m=r().useMemo(()=>e.fromAir?e.columns():e.columns().map(t=>{let a=t.accessor;return T.includes(String(t.Header))?t:{...t,Cell:t=>{let{row:s,column:o}=t,[n,l]=r().useState(!1),d=s.original[o.id],[c,u]=r().useState(null!=d?String(d):""),h=()=>{l(!1),c!==d&&e.onCellEdit&&e.onCellEdit(s.index,o.id,c)};return n?(0,i.jsx)(p.v,{value:c,autoFocus:!0,onChange:e=>u(e),onBlur:h,onKeyDown:e=>{("Enter"===e.key||"Tab"===e.key||"Escape"===e.key)&&(e.preventDefault(),h())},inputStyle:{width:"100%",fontSize:14}}):(0,i.jsx)("div",{style:{cursor:"pointer",width:"100%"},onClick:()=>l(!0),children:"function"==typeof a?a(s.original,s.index,{subRows:[],depth:0,data:e.data||[]}):c||"-"})}}}),[e.columns,e.onCellEdit,e.data]);return e.data?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.Sz,{style:{display:"block",marginBottom:10},children:t}),(0,i.jsx)(d.li,{columns:m,data:e.data,showScrollTip:!1,id:"file-upload-table"})]}):(0,i.jsx)(n.A,{height:e.height||"414px",onChange:t=>{if(0===o){var i,s,r;if(e.importCSVOption&&"HYROS"!==e.importCSVOption&&"HYROS"!==e.fileTemplate){let o,r;return void(i=t,r=(s=e.fileTemplate,o=",","MAGENTO"===s&&(o=";"),{delimiter:o}),c.A.parseFileCSVTo(i,r.delimiter).then(t=>
1{u.A.processFile(t,e.fileTemplate).then(t=>{t={...t,errors:[]},e.handleResultsChange(t,i),a(i[0].name)}).catch(e=>{l.A.error("There was an error when trying to process CSV file.")})}))}r=t,c.A.parseFileUploadImportCSV(r,e.csvHeader).then(t=>{let i=(e=>{var t;if(!e||!(null==(t=e.meta)?void 0:t.fields))return e;let a=e.meta.fields.map(e=>String(e).toLowerCase().trim()).findIndex(e=>g.includes(e));if(-1===a)return e;let i=e.meta.fields[a];return e.data.forEach(e=>{let t=e[i];null!=t&&""!==t?e.externalintegrationuniqueid=String(t):void 0===e.externalintegrationuniqueid&&(e.externalintegrationuniqueid=""),"externalintegrationuniqueid"!==i&&delete e[i],"externalid"in e&&"externalid"!==i.toLowerCase()&&delete e.externalid}),e})(t);e.handleResultsChange(i,r),a(r[0].name)})}},onError:e=>{h(e.code),l.A.error(c.A.getFileUploadErrorDescription(e.code))},accepts:[".csv","text/csv"],description:e.description,text:e.text,style:e.style,hideIcon:e.hideIcon})}},58675(e,t,a){a.d(t,{A:()=>K,U:()=>W});var i,s=a(31085),o=a(99075),r=a.n(o),n=a(16447),l=a(11540),d=a(8181),c=a(28674),u=a(44961),p=a(12973),h=a(73072),T=a(51135),g=a(86756),m=a(6017),S=a(44430),f=a(67688),x=a(77989),A=a(1140);a(94085);var O=a(90990),C=a(59725),y=a(67840),E=a(27490),_=a(99420),I=a.n(_),R=a(12142),v=a(5282);function N(e){let t="YYYY-MM-DD HH:mm",[a,i]=(0,o.useState)(0),n=()=>I()(new Date).format(t),l=(0,o.useMemo)(()=>{let e=n();return"Examples: \[email protected]\[email protected],$product2,200.20,"+e+",USD\[email protected],$product3,100.00,"+e+",USD,SALE,1445768908,43B65816DD4035544,25.3,20.20\[email protected],$product4,"+e+",USD,SALE,142687412,43B65816DD4748091,32.5,15\[email protected],!import3,60.2,"+e+"\[email protected],$product5,79.90,"+e+"\[email protected]"},[]),d=(0,o.useMemo)(()=>"Examples: \[email protected]\[email protected],1888123345,name,lastName,0.0.0.0,GRANTED\n,1888123345,,,0.0.0.0\[email protected],,,,,GRANTED\[email protected],1888123345,name,lastName,0.0.0.0,GRANTED,!action1+!action2,stage,"+n()+",https://example.com/page?sl=source,YES\n",[]),u=(0,o.useMemo)(()=>{let e=n(),a=I()(new Date).add(15,"days").format(t);return"Examples: \nAgency Retainer,@source1,DAILY,"+e+","+a+",500\nInfluencer Cost,@source2,ONE_TIME,"+e+",200\n,@source3,MONTHLY,"+e+","+a+",99.50\nFixed Marketing,@source4,DAILY,"+e+",349.99\n"},[]),h=(0,o.useMemo)(()=>{let e=n(),a=I()(new Date).add(1,"months").format(t);return`Examples: 2[email protected],1445768908,$product1,500.23,USD,${e},${a},subscription name,123,Ext123234,[email protected],+1234567890,$sale1,29.99,USD, `+e+",,MONTH,John Doe,Ext2223,[email protected],1234567890,$sale,29.99,USD,"+e+",,Havanna Alfajores,MONTH,EXT12345,[email protected],,$sale2,54,,"+e+",,,WEEK,EXT67890,COMPLETED"},[]),T=[" "],g=(0,o.useMemo)(()=>e.columns.map(t=>{let a=t.accessor;return T.includes(String(t.Header))?t:{...t,Cell:t=>{let{row:i,column:o}=t,[n,l]=r().useState(!1),d=i.original[o.id],[c,u]=r().useState(null!=d?String(d):""),p=()=>{l(!1),c!==d&&e.onCellEdit&&e.onCellEdit(i.index,o.id,c)};return n?(0,s.jsx)(v.v,{value:c,autoFocus:!0,onChange:e=>u(e),onBlur:p,onKeyDown:e=>{("Enter"===e.key||"Tab"===e.key||"Escape"===e.key)&&(e.preventDefault(),p())},inputStyle:{width:"100%",fontSize:14}}):(0,s.jsx)("div",{style:{cursor:"pointer",width:"100%"},onClick:()=>l(!0),children:"function"==typeof a?a(i.original,i.index,{subRows:[],depth:0,data:e.data||[]}):c||"-"})}}}),[e.columns,e.onCellEdit]);return(0,s.jsxs)("div",{id:"add-manually-sales",children:[!e.preview&&(0,s.jsxs)("div",{className:"gx-5",style:{minHeight:"360px"},children:[!e.hideLabel&&(0,s.jsx)("div",{children:(0,s.jsx)(c.GW,{color:p.J.WHITE_ACCENT,children:"Paste your list or enter data manually:"})}),(0,s.jsx)("div",{style:{background:p.J.ROWS},children:(0,s.jsx)(E.v,{placeholder:O.A.entityTypeAction(e.importEntity,()=>l,()=>d,()=>h,()=>u),height:"360px",width:"100%",value:e.textAreaValue,style:{fontSize:14},rows:e.maxRows,onChange:t=>{let a=t.split(/\r\n|\r|\n/);if(a.length>e.maxRows)e.handleListChange(a.slice(0,e.maxRows).join("\n")),i(e.maxR
2ows);else{var s;e.handleListChange(t),i(a.length-(null==(s=a[a.length-1])||!s.length))}}})}),(0,s.jsx)("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"},children:(0,s.jsxs)(c.GW,{color:p.J.TABLE_TITLES,fontSize:"12px",children:["(",a,"/",e.maxRows," rows)"]})})]}),e.preview&&(0,s.jsx)("div",{className:"import-modal-manually-upload-section-container",children:(0,s.jsx)(R.li,{columns:g,data:e.data,id:"manual-upload-table"})})]})}var L=a(57643),b=a(38923),j=a(79035);function G(e){return(0,s.jsxs)(s.Fragment,{children:[!e.hideTitle&&(0,s.jsxs)("div",{className:"import-modal-file-upload-section-title-container",children:[(0,s.jsxs)(c.Sz,{children:["Import from ",e.getFancyIntegrationName(e.selectedIntegration)]}),(0,s.jsxs)(c.GW,{style:{display:"none"},color:p.J.ACCENTS,fontSize:"14px",onClick:()=>window.open(e.linkToRedirect,"_blank"),children:["How to import CSV from ",e.getFancyIntegrationName(e.selectedIntegration)]})]}),(0,s.jsx)("div",{className:"import-modal-file-upload-section-uploader-container",style:{height:e.isPreviewActive?"374px":"174px",padding:e.isPreviewActive&&"10px",width:e.isPreviewActive?"95%":"100%",...e.containerStyle},children:(0,s.jsx)(j.A,{fromAir:e.fromAir,handleResultsChange:e.onPreview,data:e.isPreviewActive&&e.data,columns:()=>e.columns,csvHeader:e.getHeader(),fileTemplate:e.selectedIntegration,importCSVOption:e.importCSVOptionSelected,style:{height:"100%",margin:0,paddingTop:"34px"},hideIcon:e.hideIcon,description:e.description,onCellEdit:e.onCellEdit,importEntity:e.importEntity})}),!e.isPreviewActive&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"import-modal-file-upload-section-files-sections-container",children:e.filesToImport.map((t,a)=>(0,s.jsxs)("div",{className:"import-modal-file-upload-section-file-information",children:[(0,s.jsxs)("div",{className:"import-modal-file-upload-section-file-information-icon-and-name",children:[(0,s.jsx)(l.Q,{type:h.AT.DROP,stroke:p.J.MEDIUM_LIGTH_GRAY,fill:p.J.MEDIUM_LIGTH_GRAY,width:20}),(0,s.jsxs)(c.GW,{children:[t.name," ⢠",O.A.formatFileSize(t.size)]})]}),(0,s.jsx)(n.A,{type:"icon",iconType:h.AT.CLOSE,iconWidth:15,onClick:()=>e.onRemoveFileToImport(t.name)})]},`${a}-${t.name}`))}),(0,s.jsx)("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"},children:(0,s.jsx)(c.GW,{color:p.J.TABLE_TITLES,fontSize:"12px",children:"Maximum file size: 1mb"})})]})]})}var w=a(46621),D=a(57221),P=a(66518),F=a(93975);function M(e){let{userCreationDate:t}=(0,w.D2)(e=>{var t;return{userCreationDate:null==(t=e.session.top)?void 0:t.user.creationDate}});return 4===e.importEntity?(0,s.jsx)(s.Fragment,{}):(0,s.jsxs)("div",{className:"import-modal-manual-import-configs-container",style:e.containerStyle,children:[(0,s.jsx)("div",{style:{width:"100%"},children:(0,s.jsx)(D.A,{labelStyle:{color:p.J.WHITE_ACCENT},label:"Select Date",selectedDate:I()(e.defaultDate),enableTime:!0,maxDate:I()(),minDate:I()(t),inputHandler:e.onDefaultDateChange})}),(0,s.jsxs)("div",{className:"import-modal-manual-import-configs-add-tags-container mt-3",style:{maxWidth:300},children:[(0,s.jsx)(c.GW,{color:p.J.WHITE_ACCENT,children:"Add tags to all leads"}),(0,s.jsx)("div",{children:(0,s.jsx)(P.A,{addTagLabel:"Add tag",relative:!0,label:e.tags.length?"Selected tags":"",type:0,selected:e.tags,onRemove:e.onRemoveTag,onSelect:e.onAddTag})})]}),2!==e.importEntity&&(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)(F.A,{text:(0,s.jsxs)(c.GW,{color:p.J.WHITE_ACCENT,style:{display:"inline-flex",alignItems:"center",gap:5},children:["Add price to sale tags ",(0,s.jsx)(d.A,{placement:"top",textTooltip:"If selected, the sale prices will be appended at the end of the tag. Select this option if you wish to create a separate product for each price variation.",children:(0,s.jsx)("div",{style:{display:"inline-flex"},children:(0,s.jsx)(l.Q,{type:h.AT.QUESTION_MARK,stroke:p.J.HELP_BUBBLE_QUESTION_MARK})})})]}),active:e.addPriceToTag,onClick:e.toggleAddPriceToTag}),0===e.importType&&(0,s.jsx)(F.A,{text:(0,s.jsxs)(c.GW,{color:p.J.TABLE_TITLES,style:{display:"inline-flex",alignItems:"center",gap:5},children:["Use comma as decimal separator ",(0,s.jsx)(d.A,{placement:"top",textTooltip:"If selected, the decimal part of the sale prices and costs will be separated using the comma ','. Select this option if you wish to use commas as decimal separator for the import.",children:(0,s.jsx)("div",{style:{display:"inline-flex"},children:(0,s.jsx)(l.Q,{type:h.AT.QUESTION_MARK,stroke:p.J.HELP_BUBBLE_QUESTION_MARK})})})]}),style:{marginTop:"5px"},active:e.decimalSeparator,onClick:e.decimalSeparatorToggle})]})]})}let U=e=>{let t,a=(0,o.useMemo)(()=>{let e={};return e[0]=[{name:"email",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The email of the lead. ",(0,s.jsx)("b",{children:"This field is required in case a phone number is not provided"}),"."]})},{name:"tag",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The tag that will be added to the lead, can be either a ",(0,s.jsx)(c.GW,{color:p.J.GREEN_PROFIT,children:"$sale"}),", ",(0,s.jsx)(c.GW,{color:p.J.BLUE_INFO,children:"@source"})," or ",(0,s.jsx)(c.GW,{color:p.J.TAG_ACTION,children:"!action"})," tag."]})},{name:"price",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["If the row contains a ",(0,s.jsx)(c.GW,{color:p.J.GREEN_PROFIT,children:"$sale"})," tag, you can indicate the individual price for that sale."]})},{name:"date",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The date that will be assigned to the action indicated in the row. If not present, the selected default date will be used. Example: ",(0,s.jsx)("b",{children:"2022-04-12 12:30"})]})}
2,{name:"currency",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["If the row contains a ",(0,s.jsx)(c.GW,{color:p.J.GREEN_PROFIT,children:"$sale"})," tag, you can indicate the ",(0,s.jsx)("b",{children:"currency code"}),". If not present your default inbound currency will be used"]})},{name:"phone",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The phone of the lead. ",(0,s.jsx)("b",{children:"If you don't specify an email, this field is required."})]})},{name:"salegroupid",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The group id belonging to the sale, this helps us to group a specific set of sales under the same group. This is completely optional."})},{name:"cost of goods",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"Cost of good of the sale. This is optional."})},{name:"shipping",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"Shipping of the sale. This is optional."})},{name:"taxes",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"Taxes of the sale. This is optional."})},{name:"external id",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"Also externalIntegrationUniqueId, helps to check if the sale was already imported"})}],e[1]=[{name:"email",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The email of the lead. ",(0,s.jsx)("b",{children:"This field is required in case a phone number is not provided"}),"."]})},{name:"tag",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The tag that will be added to the lead, can be either a ",(0,s.jsx)(c.GW,{color:p.J.GREEN_PROFIT,children:"$sale"}),", ",(0,s.jsx)(c.GW,{color:p.J.BLUE_INFO,children:"@source"})," or ",(0,s.jsx)(c.GW,{color:p.J.TAG_ACTION,children:"!action"})," tag."]})},{name:"date",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The date that will be assigned to the action indicated in the row. If not present, the selected default date will be used. Example: ",(0,s.jsx)("b",{children:"2022-04-12 12:30"})]})},{name:"phone",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The phone of the lead. ",(0,s.jsx)("b",{children:"If you don't specify an email, this field is required."})]})},{name:"external id",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"Also externalIntegrationUniqueId, helps to check if the sale was already imported"})},{name:"state",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The state of the call. Possible values: ",(0,s.jsx)("b",{children:"QUALIFIED, UNQUALIFIED, CANCELLED, NO SHOW"})]})}],e[3]=[{name:"email",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The email of the lead. ",(0,s.jsx)("b",{children:"This field is required in case a phone number is not provided"}),"."]})},{name:"phoneNumber",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The phone of the lead. ",(0,s.jsx)("b",{children:"If you don't specify an email, this field is required."})]})},{name:"tag",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The tag that will be added to the lead, must be a ",(0,s.jsx)(c.GW,{color:p.J.GREEN_PROFIT,children:"$sale"})," tag."]}),required:!0},{name:"planPrice",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The individual price for the subscription"}),required:!0},{name:"currency",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The ",(0,s.jsx)("b",{children:"currency code"}),". If not present your default inbound currency will be used"]})},{name:"startDate",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The start date that will be assigned to the action indicated in the row. If not present, the selected default date will be used. Example: ",(0,s.jsx)("b",{children:"2022-04-12 12:30"})]})},{name:"endDate",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The end date that will be assigned to the action indicated in the row. If not present, no date will be set. Example: ",(0,s.jsx)("b",{children:"2022-04-12 12:30"})]})},{name:"name",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The unique identifier of the subscription. "}),required:!0},{name:"periodicity",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The periodicity on which the subscription will be based. Example: ",(0,s.jsx)("b",{children:"MONTH"})]}),required:!0},{name:"externalSubscriptionId",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The external id of the subscription. Also used to create and vinculate the sales of the sub"}),required:!0},{name:"subscriptionStatus",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The status of the subscription. Example: ACTIVE, CANCELLED or COMPLETED"})}],e[2]=[{name:"email",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The email of the lead. ",(0,s.jsx)("b",{children:"This field is required in case a phone number is not provided"}),"."]})},{name:"phone",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The phone of the lead. ",(0,s.jsx)("b",{children:"If you don't specify an email, this field is required."})]})},{name:"firstName",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The First Name of the lead."})},{name:"lastName",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The Last Name of the lead."})},{name:"ip",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"Ip of the lead."})},{name:"adOptimizationConsent",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Lead permission to allow optimization of advertisements displayed to them. ",(0,s.jsx)("b",{children:"Possible values: GRANTED, DENIED, UNSPECIFIED (default)"})]})},{name:"tags",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The tags that will be added to the lead, can be ",(0,s.jsx)(c.GW,{color:p.J.TAG_ACTION,children:"!action"})," tags. For multiple tags, separate them with a ",(0,s.jsx)("b",{style:{fontSize:18},children:"+"})," sign. ",(0,s.jsx)("b",{children:"Example:"})," ",(0,s.jsx)(c.GW,{color:p.J.TAG_ACTION,children:"!action1"}),(0,s.jsx)("b",{style:{fontSize:18},children:"+"}),(0,s.jsx)(c.GW,{color:p.J.TAG_ACTION,children:"!action2"})]})},{name:"stage",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The stage of the lead."})},{name:"joinDate",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The join date of the lead. Example: ",(0,s.jsx)("b",{children:"2022-04-21 12:30"})]})},{name:"optInUrl",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The URL of the lead opt-in. The URL must contain a ",(0,s.jsx)("b",{children:"?sl="})," parameter. Example: ",(0,s.jsx)("b",{children:"https://yoursite.com/page?sl=your-source-link-tag"})]})},{name:"existingCustomer",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Whether the lead is an existing customer. ",(0,s.jsx)("b",{children:"Possible values: YES, NO"}),". Leads marked as existing customers will be excluded from new customer metrics in reports."]})}],e[4]=[{name:"name",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:['A descriptive label for the cost (e.g., "Agency Retainer", "Influencer Cost", "Fixed Marketing Expenses"). ',(0,s.jsx)("b",{children:"This field is optional."})]})},{name:"tag",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The ",(0,s.jsx)(c.GW,{color:p.J.BLUE_INFO,children:"@source"})," tag to which the cost will be applied."]})}
2,{name:"frequency",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The frequency of the cost. ",(0,s.jsx)("b",{children:"Possible values: MONTHLY, DAILY, ONE_TIME"})]})},{name:"startDate",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The start date that will be assigned to the cost."})},{name:"endDate",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The end date that will be assigned to the cost. This is optional."})},{name:"cost",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The custom cost."})}],e.SHOPIFY=[{name:"Email",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The email of the lead. ",(0,s.jsx)("b",{children:"This field is required in case a phone number is not provided"}),"."]})},{name:"Total",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"price"})," for that sale. This field will also be used for the sale tag generation."]})},{name:"Created at",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The date that will be assigned to the action indicated in the row. If not present, the selected default date will be used. Example: ",(0,s.jsx)("b",{children:"2022-04-12 12:30"})]})},{name:"Lineitem name",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The name of the item. This field will be used for the sale tag generation. ",(0,s.jsx)("b",{children:"If not present, the Total will be used for that."})]})},{name:"Taxes",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"cost"})," for that sale, which will be already included in the ",(0,s.jsx)("b",{children:"Total"})]})},{name:"Currency",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"currency"})," for that sale. If not present your default inbound currency will be used"]})},{name:"Shipping",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The shipping price of the sale."})},{name:"Shipping Phone",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The phone of the lead. ",(0,s.jsx)("b",{children:"If you don't specify an email, this field is required."})]})},{name:"Financial Status",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"status"})," for that sale. ",(0,s.jsx)("b",{children:'Only the sales with "paid" status will be processed'})]})},{name:"Id",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Row that has the ID of the sale. ",(0,s.jsx)("b",{children:"Used to populate the sale group id"})]})},{name:"Name",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The unique identifier of the sale. ",(0,s.jsx)("b",{children:"Used to group rows and assign them the same sale group id"})]})},{name:"Lineitem price",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The price of the item. ",(0,s.jsx)("b",{children:"Used for specific cases where we need to complete price information"})]})},{name:"Lineitem quantity",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["How much of a same item is bought. ",(0,s.jsx)("b",{children:"Used for specific cases where we need to complete price information"})]})}],e.STRIPE=[{name:"Customer Email",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The email of the lead. ",(0,s.jsx)("b",{children:"This field is required in case a phone number is not provided"}),"."]})},{name:"Amount",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"price"})," for that sale. This field will also be used for the sale tag generation."]})},{name:"Created date (UTC)",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The date that will be assigned to the action indicated in the row. If not present, the selected default date will be used. Example: ",(0,s.jsx)("b",{children:"2022-04-12 12:30"})]})},{name:"Tax",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"cost"})," for that sale, which will be already included in the ",(0,s.jsx)("b",{children:"Total"})]})}
2,{name:"Currency",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"currency"})," for that sale. If not present your default inbound currency will be used"]})},{name:"Status",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"status"})," for that sale. ",(0,s.jsx)("b",{children:'Only the sales with "paid" status will be processed'})]})},{name:"id",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Row that has the ID of the sale. ",(0,s.jsx)("b",{children:"Used to populate the sale group id"})]})}],e.PAYPAL=[{name:"To email",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The email of the lead. ",(0,s.jsx)("b",{children:"This field is required in case a phone number is not provided"}),"."]})},{name:"Item total",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"price"})," for that sale. This field will also be used for the sale tag generation."]})},{name:"Date created",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The date that will be assigned to the action indicated in the row. If not present, the selected default date will be used. Example: ",(0,s.jsx)("b",{children:"2022-04-12 12:30"})]})},{name:"Item name",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The name of the item. This field will be used for the sale tag generation. ",(0,s.jsx)("b",{children:"If not present, the Net will be used for that."})]})},{name:"Tax total",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"cost"})," for that sale, which will be already included in the ",(0,s.jsx)("b",{children:"Total"})]})},{name:"Currency",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"currency"})," for that sale. If not present your default inbound currency will be used"]})},{name:"Status",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"status"})," for that sale. ",(0,s.jsx)("b",{children:'Only the sales with "paid" status will be processed'})]})},{name:"Transaction Id",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The unique identifier of the sale. ",(0,s.jsx)("b",{children:"Used to populate the sale group id"})]})},{name:"Shipping Amount",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The shipping amount of the sale."})}],e.CLICK_FUNNELS=[{name:"Email",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The email of the lead. ",(0,s.jsx)("b",{children:"This field is required in case a phone number is not provided"}),"."]})},{name:"Original Amount Cents",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"price"})," for that sale. This field will also be used for the sale tag generation."]})},{name:"Product Names",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The name of the item. This field will be used for the sale tag generation. ",(0,s.jsx)("b",{children:"If not present, the Original Amount Cents will be used for that."})]})},{name:"Created At",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The date that will be assigned to the action indicated in the row. If not present, the selected default date will be used. Example: ",(0,s.jsx)("b",{children:"2022-04-12 12:30"})]})},{name:"Original Amount Currency",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"currency"})," for that sale. If not present your default inbound currency will be used"]})},{name:"Phone",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The phone of the lead. ",(0,s.jsx)("b",{children:"If you don't specify an email, this field is required."})]})},{name:"Status",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"status"}
2)," for that sale. ",(0,s.jsx)("b",{children:'Only the sales with "paid" status will be processed'})]})}],e.MAGENTO=[{name:"Customer Email",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The email of the lead. ",(0,s.jsx)("b",{children:"This field is required in case a phone number is not provided"}),"."]})},{name:"Grand Total",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"price"})," for that sale. This field will also be used for the sale tag generation."]})},{name:"Tax Amount",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"cost"})," for that sale, which will be already included in the ",(0,s.jsx)("b",{children:"Total"})]})},{name:"Shipping Amount",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The shipping amount of the sale."})},{name:"Items",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The name of the items, price and quantity. This field will be used for the sale tag generation."})},{name:"Purchase Date",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The date that will be assigned to the action indicated in the row. If not present, the selected default date will be used. Example: ",(0,s.jsx)("b",{children:"2022-04-12 12:30"})]})},{name:"Order Currency Code",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"currency"})," for that sale. If not present your default inbound currency will be used"]})},{name:"Shipping Telephone",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The phone of the lead. ",(0,s.jsx)("b",{children:"If you don't specify an email, this field is required."})]})},{name:"Status",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"status"})," for that sale. ",(0,s.jsx)("b",{children:'Only the sales with "paid" status will be processed'})]})},{name:"Order Id",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Row that has the ID of the sale. ",(0,s.jsx)("b",{children:"Used to populate the sale group id"})]})}],e.WOOCOMMERCE=[{name:"Item ID",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The ID of the item. This field will be used to prevent duplications. "})},{name:"Email (Billing)",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The email of the lead. ",(0,s.jsx)("b",{children:"This field is required in case a phone number is not provided"}),"."]})},{name:"Item Cost",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"price"})," for that sale. This field will also be used for the sale tag generation."]})},{name:"Order Total Fee",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"Taxes of the order. This is optional."})},{name:"Order Date",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The date that will be assigned to the action indicated in the row. If not present, the selected default date will be used. Example: ",(0,s.jsx)("b",{children:"2022-04-12 12:30"})]})},{name:"Currency",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"currency"})," for that sale. If not present your default inbound currency will be used"]})},{name:"Order Status",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Is the row that contains the ",(0,s.jsx)("b",{children:"status"})," for that sale. ",(0,s.jsx)("b",{children:'Only the sales with "Completed" status will be processed'})]})},{name:"Order ID",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Row that has the ID of the order. ",(0,s.jsx)("b",{children:"Used to populate the sale group id"})]})},{name:"Order Shipping Amount",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The shipping amount of the sale."})},{name:"Item name",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The name of the item. This field will be used for the sale tag generation. "})},{name:"Cost of Good",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["Cost of good of the sale. ",(0,s.jsx)("b",{children:"Using the tool you generate the export file with, you must manually create the column associated with the field that represents COGS (this field may vary depending on the tool you use to calculate COGS)."})," "]})},{name:"Phone (Billing)",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["The phone of the lead. ",(0,s.jsx)("b",{children:"If you don't specify an email, this field is required."})]})},{name:"Quantity",description:(0,s.jsxs)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:["How much of a same item is bought. ",(0,s.jsx)("b",{children:"Used for specific cases where we need to complete price information"})]})},{name:"Order Number",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The number of the order. "})},{name:"Total products",description:(0,s.jsx)(c.GW,{color:p.J.TOOLTIP_FONT_COLOR,children:"The number of products in the order. "})}],e},[]);return(0,s.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start"},children:[(0,s.jsx)("div",{style:{whiteSpace:"nowrap"},children:(0,s.jsx)(c.GW,{style:{fontSize:"12px",fontWeight:700},children:e.integrationOption?"Required Headers:":"Required Format:"})}),(0,s.jsx)("div",{className:"d-flex",style:{alignItems:"center",gap:3,flexWrap:"wrap"},children:(t=e.integrationOption?a[e.integrationOption]:a[e.importEntity]).map((e,a)=>(0,s.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:3,color:p.J.SECONDARY_TEXT},children:[(0,s.jsx)(c.GW,{style:{fontSize:"12px",fontWeight:400},children:`${e.name}${e.required?" *":""}`}),(0,s.jsx)(d.A,{textTooltip:e.description,placement:"bottom",children:(0,s.jsx)("div",{style:{display:"inline-flex"},children:(0,s.jsx)(l.Q,{type:h.AT.QUESTION_MARK,stroke:p.J.HELP_BUBBLE_QUESTION_MARK})})}),a<t.length-1?",":""]},e.name))})]})};function k(e){return 1===e.importType?(0,s.jsxs)("div",{children:[(0,s.jsxs)(c.GW,{fontSize:"12px",children:[(0,s.jsx)("b",{children:"Instructions:"})," Please provide the data in the required format, ensuring that each row includes all required fields. Other fields are optional and may be left blank if not available. Separate all values with commas."]}),(0,s.jsx)(U,{importEntity:e.importEntity})]}):(0,s.jsx)(s.Fragment,{children:0===e.importType&&"HYROS"===e.selectedIntegration?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(c.GW,{fontSize:"12px",children:[(0,s.jsx)("b",{children:"Instructions:"})," The provided CSV may or not contain a header indicating the content of each of the columns. If no header is present then it ",(0,s.jsx)("b",{children:"must follow the order specified below. "}),"Not every field is mandatory, you can leave blank the ones you don`t need. However each row requires to specify",4===e.importEntity&&(0,s.jsxs)(s.Fragment,{children:[" a ",(0,s.jsx)("b",{children:"tag."})]}),[3,0].includes(e.importEntity)&&(0,s.jsxs)(s.Fragment,{children:[" an ",(0,s.jsx)("b",{children:"email or phone number and a tag."})]}),2===e.importEntity&&(0,s.jsxs)(s.Fragment,{children:[" an ",(0,s.jsx)("b",{children:"email or phone number."})]})]}),(0,s.jsx)(U,{importEntity:e.importEntity}),(0,s.jsx)(c.GW,{color:p.J.TABLE_TITLES,children:2===e.importEntity&&(0,s.jsxs)(s.Fragment,{children:["The maximum amount of rows you can import at once is ",e.maxRows," "]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(c.GW,{fontSize:"12px",children:[(0,s.jsx)("b",{children:"Instructions:"}),`Drop the CSV that you have downloaded from ${e.getFancyIntegrationName(e.selectedIntegration)}. `,"The provided CSV must contain a header indicating the content of each of the columns. Not every field is mandatory, you can leave blank the ones you don`t need. However each row requires to specify an ",(0,s.jsx)("b",{children:"email. "}),"Consider that the only rows that will be accepted are the one that have a status of completed/paid."]}),(0,s.jsx)(U,{importEntity:e.importEntity,integrationOption:e.selectedIntegration})]})})}a(73067);var W=((i={})[i.FILE=0]="FILE",i[i.MANUAL=1]="MANUAL",i);let B=[{label:"Import CSV",type:0},{label:"Add manually",type:1}],H={label:"Hyros",value:"HYROS",iconType:h.AT.HYROS_LOGO,linkToRedirect:"https://docs.hyros.com/manually-importing-lead-data/"},J=[H,{label:"Shopify",value:"SHOPIFY",iconType:h.AT.INTEGRATION_SHOPIFY,linkToRedirect:""}
2,{label:"Stripe",value:"STRIPE",iconType:h.AT.INTEGRATION_STRIPE,linkToRedirect:""},{label:"Click funnels",value:"CLICK_FUNNELS",iconType:h.AT.INTEGRATION_CLICKFUNNELS_2,linkToRedirect:""},{label:"Paypal",value:"PAYPAL",iconType:h.AT.INTEGRATION_PAYPAL,linkToRedirect:""},{label:"Magento",value:"MAGENTO",iconType:h.AT.INTEGRATION_MAGENTO,linkToRedirect:""},{label:"WooCommerce",value:"WOOCOMMERCE",iconType:h.AT.INTEGRATION_WOO_COMMERCE,linkToRedirect:""}];function Y(e){let t=J.find(t=>t.value===e);return null==t?void 0:t.label}function K(e){let t,[a,i]=(0,o.useState)(0),[E,_]=(0,o.useState)(""),[I,R]=(0,o.useState)([]),[v,j]=(0,o.useState)(new Date),[w,D]=(0,o.useState)(new Map),[P,F]=(0,o.useState)(!1),[U,W]=(0,o.useState)(null),[K,$]=(0,o.useState)(!1),[V,z]=r().useState(new Map),[X,q]=r().useState([]),[Q,Z]=r().useState(),[ee,et]=r().useState(),[ea,ei]=(0,o.useState)(new Map),[es,eo]=(0,o.useState)(0),[er,en]=(0,o.useState)("HYROS"),[el,ed]=(0,o.useState)("HYROS"),[ec,eu]=(0,o.useState)([]),[ep,eh]=(0,o.useState)(!1),eT=(0,o.useRef)(new Map),eg=(0,o.useMemo)(()=>Array.from((0,y.c7)(2)).join(","),[(0,y.c7)(2)]),em=(0,o.useMemo)(()=>Array.from((0,y.c7)(0)).join(","),[(0,y.c7)(0)]),eS=(0,o.useMemo)(()=>Array.from((0,y.c7)(3)).join(","),[(0,y.c7)(3)]),ef=(0,o.useMemo)(()=>Array.from((0,y.c7)(4)).join(","),[(0,y.c7)(4)]),ex=0===e.importEntity?25e3:2===e.importEntity&&e.lightweight?5e4:5e3,eA=0===e.importEntity?J:[H],eO=(0,A.JS)(),eC=(0,A.Gj)(e=>e.importsSlice),ey=()=>eE()&&[2,3,4].includes(e.importEntity),eE=()=>0===a;(0,o.useEffect)(()=>{O.A.getCurrencyMap("SALES").then(e=>z(e)).catch(()=>T.A.error("There was an error fetching the available currencies"))},[]),(0,o.useEffect)(()=>{var t;(null==(t=e.columns)?void 0:t.map(e=>e.Header)).includes(" ")||e_()},[e.columns]),(0,o.useEffect)(()=>{0===es&&ey()&&eo(1)},[e.showModal]),(0,o.useEffect)(()=>{X.forEach(e=>{eJ(w.get(e.name))})},[e.decimalSeparator]);let e_=()=>{eu([eR(),...e.columns])},eI=async t=>t.length?await O.A.entityTypeAction(e.importEntity,async()=>{let e=t.map(e=>{var t,a;return{email:null==(t=e.email)?void 0:t.toLowerCase(),phone:e.phone,externalIntegrationUniqueId:null==(a=e.externalintegrationuniqueid||e.externalid)?void 0:a.trim()}});return(await S.A.getExistsByExternalId(e)).getContentOrElse(()=>new Map)},()=>[],()=>[],()=>[]):new Map,eR=()=>({Header:" ",accessor:e=>{let t=ev(e);return t.hasAny()?(0,s.jsx)(d.A,{textTooltip:(0,s.jsx)("div",{children:t.getIndividualErrorMessages().map((e,t)=>(0,s.jsx)("div",{children:e},t))}),placement:"top",children:(0,s.jsxs)("div",{style:{display:"inline-flex"},children:[(0,s.jsx)(l.Q,{type:h.AT.CLOSE,stroke:p.J.RED_NOTIFICATIONS}),(0,s.jsx)(l.Q,{type:h.AT.QUESTION_MARK,stroke:p.J.HELP_BUBBLE_QUESTION_MARK})]})}):(0,s.jsx)(l.Q,{type:h.AT.CHECK,stroke:p.J.GREEN_PROFIT})},minWidth:48,width:48,disableSortBy:!0,disableResizing:!0}),ev=t=>O.A.entityTypeAction(e.importEntity,()=>t.individualErrors?t.individualErrors:(t.type=1===e.importEntity?"CALL":"SALE",O.A.validateImportSaleRow(t,null,V,null,e.decimalSeparator,O.A.wasAlreadyImported(t,ea))),()=>t.individualErrors?t.individualErrors:O.A.validateImportLeadRow(t,null,null),()=>t.individualErrors?t.individualErrors:O.A.validateImportSubscriptionRow(t,null,V,null),()=>t.individualErrors?t.individualErrors:O.A.validateImportCustomCostRow(t,null,null));(0,o.useEffect)(()=>{eC.imports.forEach(e=>{let t=e.id,a=e.state;"IN_PROGRESS"===eT.current.get(t)&&"IN_PROGRESS"!==a&&(eT.current.set(t,a),"DONE"===a&&T.A.success("Import finished. The data might take up to a minute to appear"))})},[eC]);let eN=async()=>{let t=()=>{e.closeModal(),ew(),g.A.getAllInProgress().then(e=>{e.items.forEach(e=>{eT.current.set(e.id,e.state)}),eO((0,x.zN)(e.items))}).catch(e=>{console.log(e)}).finally(()=>{eO((0,x.MJ)(!0))})},i=()=>{$(!0)},s=()=>{$(!1)},o=0===a;w.forEach(async(a,r)=>{let n=X.find(e=>e.name===r);await O.A.entityTypeAsyncAction(e.importEntity,async()=>{let r=new Map(Object.entries(await eI(a.data)));ei(r),O.A.importSalesCSV(a,v,I,t,i,V,r,o,e.addPriceToTag,e.decimalSeparator,n,1===e.importEntity,s)},()=>O.A.importLeadsCSV(a,v,I,t,i,n,e.lightweight,s),()=>O.A.importSubscriptionsCSV(a,v,I,t,i,V,o,e.addPriceToTag,e.decimalSeparator,n,s),()=>O.A.importCustomCostsCSV(a,v,t,i,n,s))})},eL=()=>O.A.entityTypeAction(e.importEntity,()=>em,()=>eg,()=>eS,()=>ef),eb=(e,t)=>{eJ(e),Z(e),F(!0),t&&et(t)},ej=async(t,a)=>{if(!eG(t))return;let i=null==a?null:Array.isArray(a)?a[0]:a;if(i&&X.some(e=>
2e.name===i.name))return void T.A.error("You can't submit two files with the same name.");let s=i??null;O.A.entityTypeAction(e.importEntity,async()=>{O.A.sanitizeImportSalesResult(t,1===e.importEntity),await ek(t),eb(t,s)},()=>{O.A.sanitizeImportLeadsResult(t),eb(t,s)},async()=>{O.A.sanitizeImportSubscriptionsResult(t),eb(t,s)},async()=>{O.A.sanitizeImportCustomCostsResult(t),await eW(t),eb(t,s)})},eG=e=>{var t;return!((null==(t=e.data)?void 0:t.length)>ex)||(T.A.error(`Too many rows, the maximum amount of rows you can import at once is ${ex}`),!1)},ew=()=>{i(0),e.defaultDateExport&&e.defaultDateExport(new Date),eo(0),en("HYROS"),ed("HYROS"),eD()},eD=()=>{q([]),Z(null),et(null),D(new Map),F(!1),_(""),R([]),j(new Date),$(!1)},eP=()=>{ew(),e.closeModal()},eF=e=>"externalIntegrationUniqueId"in e&&e.externalIntegrationUniqueId>0&&Object.entries(e).filter(e=>{let[t]=e;return"externalIntegrationUniqueId"!==t&&"totalInvalid"!==t}).every(e=>{let[t,a]=e;return 0===a}),eM=(0,o.useMemo)(()=>!U||eF(U)&&ep&&1===e.importEntity?0===X.length||K:0===X.length||(null==U?void 0:U.totalInvalid)>0||K,[a,w,U,K,X,ep]),eU=(0,o.useMemo)(()=>!(!U||eF(U)&&ep&&1===e.importEntity)&&((null==U?void 0:U.totalInvalid)>0||K),[U,K,ep]),ek=async e=>{let t=[...new Set(e.data.map(e=>O.A.saleMustHavePrice(e)&&e.tag).filter(e=>!!e))];t.length>0&&eH(e,(await m.A.getProductPricesByTags(t)).items)},eW=async e=>{let t=[...new Set(e.data.map(e=>e.tag).filter(e=>!!e))];t.length>0&&eB(e,new Map(Object.entries(await f.A.getSourceLinksByTags(t))))},eB=(e,t)=>{e.data.forEach(e=>{t.has(e.tag)||(e.tag="Not found: "+e.tag)})},eH=(e,t)=>{0!=t.length&&e.data.forEach(e=>{t.forEach(t=>{e.tag==t.tag&&O.A.saleMustHavePrice(e)&&(e.price=t.price.toString())})})},eJ=async(t,i)=>{if(W(null),!t)return;let s=new Map(Object.entries(await eI(t.data)));ei(s);let o=0===a&&!i,r=await m.A.getBlacklistedProductTagNames(),n=await m.A.getBlacklistedPrefixes(),{validationErrors:l,rowsWithErrors:d}=O.A.validateImportCSV(t,V,e.importEntity,s,o,e.decimalSeparator,r,n);d&&(t.data=[...d,...t.data.filter(e=>!d.includes(e))]),Object.values(l).every(e=>0===e)||W(l)},eY=(0,o.useMemo)(()=>0===X.length?"You don't have any files selected to import. Please select at least one":K?"There's imports in progress, please wait until the current import has finished.":eM&&U&&!eF(U)?`There's validation errors, please check the messages and update the ${1===a?"information":"csv"}`:void 0,[eM,K,X,U]),eK={0:"Import sales",1:"Import calls",2:e.lightweight?"Import leads (lightweight)":"Import leads",3:"Import subscriptions",4:"Import custom costs"},e$={0:"IMPORT_SALES",1:"IMPORTING_CALLS",2:"IMPORTING_LEADS",3:"IMPORT_SUBSCRIPTIONS",4:"IMPORT_CUSTOM_COSTS"},eV=(e,t,i)=>{Z(s=>{if(!s)return s;let o=[...s.data],r=o[e];r[t.toLowerCase().replace(/\s/g,"")]=i,"external id"===t.toLowerCase()&&(r.externalintegrationuniqueid=i,r.externalid=i);let n={...s,data:o};if(eJ(n,!0),1===a){let e=eL();e&&_(o.map(t=>e.split(",").map(e=>t[e]||"").join(",")).join("\n"))}return n})};return(0,s.jsxs)(L.aF,{id:"import-sales-modal",visible:e.showModal,onBackdropClick:eP,width:"970px",children:[(0,s.jsx)(L.rQ,{title:(0,s.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:[eK[e.importEntity],e$[e.importEntity]&&(0,s.jsx)(b.A,{className:"tutorial-help-bubble",externalDocumentationType:e$[e.importEntity],iconType:h.AT.TUTORIAL,textTooltip:"Documentation",alwaysVisible:!0})]}),closeModal:eP}),(0,s.jsxs)(L.cw,{style:{padding:"20px, 0px"},children:[(0,s.jsx)(C.A,{hasBottomBorder:!0,onSelect:e=>{i(e),eo(+!!ey()),eD()},selected:a,tabs:B,selectedColor:p.J.WHITE_ACCENT}),(0,s.jsx)("div",{className:"import-modal-main-body-container",children:(0,s.jsxs)("div",{className:"import-sales-step-1 flex space-x-4",children:[(0,s.jsxs)("div",{className:"import-modal-import-sections-container",children:[(0,s.jsxs)("div",{className:"import-modal-import-integrations-options-section",children:[1!==e.importEntity&&eE()&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{style:{marginBottom:"14px"},children:(0,s.jsx)(c.Sz,{children:"Import CSV Options"})}),(0,s.jsx)("div",{className:"import-modal-integrations-options-list-container",children:eA.map((e,t)=>(0,s.jsxs)("div",{className:"import-modal-integration-option",style:{height:`${100/eA.length}%`,borderTop:0===t&&0,backgroundColor:er===e.value&&p.J.HOVER},onClick:()=>{en(e.value),ed("HYROS"===e.value?"HYROS":"INTEGRATIONS"),eD()},children:[(0,s.jsx)("div",{className:"import-modal-integration-option-icon-container",children:(0,s.jsx)(l.Q,{type:e.iconType,width:32})}),(0,s.jsx)(c.GW,{fontSize:"14px",fontWeight:400,children:e.label})]},t))})]}),(1===a||eE())&&(0,s.jsx)(M,{tags:I,defaultDate:v,importEntity:e.importEntity,importType:a,onAddTag:e=>R(t=>t.concat([e])),onRemoveTag:e=>R(t=>t.filter(t=>t.name!=e)),onDefaultDateChange:(t,a)=>
2{j(a),e.defaultDateExport&&e.defaultDateExport(a)},addPriceToTag:e.addPriceToTag,decimalSeparator:e.decimalSeparator,decimalSeparatorToggle:e.decimalSeparatorToggle,toggleAddPriceToTag:e.toggleAddPriceToTag})]}),(0,s.jsxs)("div",{className:"import-modal-upload-import-section",children:[eE()&&(0,s.jsx)(G,{columns:ec,filesToImport:X,onRemoveFileToImport:e=>{q(t=>t.filter(t=>t.name!==e)),D(t=>{let a=new Map(t);return a.delete(e),a})},getFancyIntegrationName:Y,getHeader:eL,onPreview:ej,importCSVOptionSelected:el,selectedIntegration:er,linkToRedirect:null==(t=J.find(e=>e.value===er))?void 0:t.linkToRedirect,data:null==Q?void 0:Q.data,isPreviewActive:P,hideTitle:1===e.importEntity,onCellEdit:eV,importEntity:e.importEntity}),1===a&&(0,s.jsx)(N,{textAreaValue:E,data:null==Q?void 0:Q.data,columns:ec,preview:P,maxRows:e.maxRows||ex,handleListChange:_,onCellEdit:eV,importEntity:e.importEntity})]})]}),ea.size>0&&1===e.importEntity&&(0,s.jsx)(u.A,{name:"checkbox",checked:ep,label:"Overwrite existing call states",labelLeftMargin:"4px",onClick:()=>{eh(!ep)}}),(0,s.jsx)("div",{style:{width:"100%",marginTop:"20px"},children:(0,s.jsx)(k,{getFancyIntegrationName:Y,importEntity:e.importEntity,importType:a,selectedIntegration:er,maxRows:e.maxRows||ex})})]})})]}),(0,s.jsxs)(L.jl,{children:[(0,s.jsx)(n.A,{type:"secondary",onClick:eP,text:"Close"}),(0,s.jsx)("div",{style:{display:"flex",gap:10},children:P?(0,s.jsxs)("div",{style:{display:"flex",gap:10},children:[(0,s.jsx)(n.A,{type:"secondary",onClick:()=>{F(!1),Z(null),et(null),1!==a&&_(""),R([]),j(new Date),q([])},text:"Reject File"}),(0,s.jsx)(n.A,{type:"primary",onClick:1==a?()=>{w.set("manual-import.csv",Q),eN()}:()=>{w.set(ee.name,Q),q(e=>[...e,ee]),F(!1)},locked:eU,text:"Accept File",tooltipText:(()=>{var e;if(eU&&U)return null==(e=U.getGeneralValidationErrorMessages())?void 0:e.map((e,t)=>(0,s.jsx)("p",{children:e},t))})()})]}):(0,s.jsxs)(s.Fragment,{children:[1===a&&(0,s.jsx)(n.A,{type:"primary",onClick:()=>{let e,t=eL();q([(e="manual-import.csv",new File([new Blob([t+"\n"+E],{type:"text/csv"})],e,{type:"text/csv"}))]),O.A.parseManualImportCSV(E,t).then(e=>ej(e))},text:"Preview"}),eE()&&(0,s.jsx)(n.A,{type:"primary",onClick:eN,locked:eM,tooltipText:eY,iconType:h.AT.IMPORT,text:"Import file"})]})})]})]})}},932(e,t,a){a.d(t,{A:()=>r});var i=a(31085);a(99075);var s=a(58675);a(67840);var o=a(31940);function r(e){let t=[{id:"email",Header:"email",accessor:e=>(0,i.jsx)("div",{children:e.email||"-"}),width:40,disableSortBy:!0},{id:"phone",Header:"phone",accessor:e=>e.phone?(0,i.jsx)("div",{children:e.phone}):"-",width:10,disableSortBy:!0},{id:"firstname",Header:"first name",accessor:e=>e.firstname?(0,i.jsx)("div",{children:e.firstname}):"-",width:20,disableSortBy:!0},{id:"lastname",Header:"last name",accessor:e=>e.lastname?(0,i.jsx)("div",{children:e.lastname}):"-",width:20,disableSortBy:!0},{id:"ip",Header:"ip",accessor:e=>e.ip?(0,i.jsx)("div",{children:e.ip}):"-",width:10,disableSortBy:!0},{id:"adoptimizationconsent",Header:"ad optimization consent",accessor:e=>e.adoptimizationconsent?(0,i.jsx)("div",{children:e.adoptimizationconsent}):"UNSPECIFIED",width:30,disableSortBy:!0},{id:"tags",Header:"tags",accessor:e=>(e=>{if(!e)return"-";let t=Array.isArray(e)?e:String(e).split("+");return 0===t.length?"-":(0,i.jsx)("div",{style:{display:"flex",flexWrap:"wrap"},children:t.map((e,t)=>(0,i.jsx)(o.D,{name:e},t))})})(e.tags),width:200,disableSortBy:!0},{id:"stage",Header:"stage",accessor:e=>e.stage?(0,i.jsx)("div",{children:e.stage}):"-",width:100,disableSortBy:!0},{id:"joindate",Header:"join date",accessor:e=>e.joindate?(0,i.jsx)("div",{children:e.joindate}):"-",width:120,disableSortBy:!0},{id:"optinurl",Header:"opt-in url",accessor:e=>e.optinurl?(0,i.jsx)("div",{children:e.optinurl}):"-",width:150,disableSortBy:!0},{id:"existingcustomer",Header:"existing customer",accessor:e=>e.existingcustomer?(0,i.jsx)("div",{children:e.existingcustomer}):"NO",width:100,disableSortBy:!0}];return(0,i.jsx)(s.A,{showModal:e.showModal,closeModal:e.closeModal,importEntity:2,lightweight:e.lightweight,columns:t})}},18324(e,t,a){a.d(t,{A:()=>O});var i=a(31085),s=a(99075),o=a(5328),r=a(16447),n=a(11540),l=a(29881),d=a(28674),c=a(12973),u=a(73072),p=a(46621),h=a(51135),T=a(35438),g=a(29050),m=a(49986),S=a(66310),f=a(63901),x=a(41884),A=a(57643);let O=function(e){let t=(0,p.D2)(e=>{var t;return null==(t=e.session.top)?void 0:t.product.id}),a=(0,p.D2)(e=>{var t;return null==(t=e.session.base)?void 0:t.product.id}
2),[O,C]=(0,s.useState)(!1),[y,E]=(0,s.useState)(null),[_,I]=(0,s.useState)(null),[R,v]=(0,s.useState)(!0),[N,L]=(0,s.useState)(null),[b,j]=(0,s.useState)(!1),[G,w]=(0,s.useState)(1),[D,P]=(0,s.useState)(!1),[F,M]=(0,s.useState)(!1);(0,s.useEffect)(()=>{e.modalOpenerSetter(H)},[]);let U=async()=>{try{let t=e.connectedAccount?()=>g.A.getNextEligiblePlan(e.connectedAccount.id):()=>m.A.getEligiblePlan(),a=f.A.isParentUser()||f.A.getUserRoles().includes("BILLING")?await t():void 0;a?(E(a),W(a.id.toString())):(M(!0),k())}catch(e){console.error("Error fetching eligible plan:",e)}},k=()=>{let i=()=>S.A.getTTSubscription();e.connectedAccount&&(i=()=>g.A.getTTSubscriptionForAccessibleUser(e.connectedAccount.id)),i().then(e=>{I(e),v(!1),j(t!==e.productId&&a===e.productId)}).catch(e=>{console.error("Error fetching TT subscription:",e),v(!1)})},W=t=>{let a=()=>m.A.getProrateAmount(t);e.connectedAccount&&(a=()=>g.A.getProrateAmount(e.connectedAccount.id,t)),a().then(e=>{L(e.ttProration),k()})},B=()=>{var t;C(!1),null==e||null==(t=e.onClose)||t.call(e)},H=()=>{C(!0),w(1),U()},J=e=>e>=1e6?`${Number(e/1e6).toFixed(2)}m`:`${Math.round(e/1e3)}k`,Y=e=>(0,i.jsx)("div",{style:{height:"100px"},children:(0,i.jsxs)("div",{className:"overquota-modal-title",children:[(0,i.jsx)(d.Zb,{children:e?"You've exceeded your quota":"Your ads are getting too beefy!"}),(0,i.jsxs)("div",{className:"mt-5",children:[(0,i.jsx)(d.GW,{color:c.J.SECONDARY_TEXT,children:e?"You've reached your monthly tracked revenue cap.":"You are outgrowing your Hyros plan size."}),(0,i.jsx)("br",{}),F?(0,i.jsxs)(d.GW,{color:c.J.SECONDARY_TEXT,children:["To upgrade your plan to a higher one, please",f.A.isParentUser()?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.GW,{color:c.J.SECONDARY_TEXT,children:" go to your"}),(0,i.jsx)(o.Link,{to:T.ev.getPath(39),children:(0,i.jsx)(d.GW,{color:c.J.BLUE_INFO,children:" billing settings"})})]}):(0,i.jsx)(d.GW,{color:c.J.SECONDARY_TEXT,children:" contact your parent user"})]}):(0,i.jsx)(d.GW,{color:c.J.SECONDARY_TEXT,children:"Donât worry, we are still tracking all data. To see it you have to upgrade your plan."})]})]})});return(0,i.jsx)("div",{className:"modal-box",id:`modal-box-${e.modalId}`,children:(0,i.jsx)(A.aF,{id:e.modalId?e.modalId:"update-billing-plan-modal",visible:O,onBackdropClick:B,width:"720px",children:R?(0,i.jsx)("div",{className:"text-center ld-spinner-modal",children:(0,i.jsx)(l.A,{type:1,width:50})}):F?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(A.rQ,{title:"",closeModal:B}),(0,i.jsx)(A.cw,{children:Y(null!==_.hardLimitReachedDate)}),(0,i.jsx)(A.jl,{children:(0,i.jsx)(r.A,{type:"secondary",onClick:B,text:"Close"})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(A.rQ,{title:"",closeModal:B}),(0,i.jsx)(A.cw,{children:[Y((null==_?void 0:_.hardLimitReachedDate)!==null),(0,i.jsxs)("div",{className:"overquota-modal-step2",children:[(0,i.jsxs)("div",{className:"d-flex",style:{alignItems:"center"},children:[(0,i.jsx)(x.A,{backGroundColor:c.J.BACKGROUND,borderColor:c.J.DIVIDERS,marginRight:"-7px",children:(0,i.jsxs)("div",{className:"overquota-badge",children:[(0,i.jsx)(d.GW,{color:c.J.LOCKED,children:"Current plan"}),(0,i.jsx)("br",{}),(0,i.jsxs)(d.Sz,{color:c.J.LOCKED,children:["Up to $",J(_.trackedRevenueLimit)," tracking revenue limit"]})]})}),(0,i.jsx)("div",{className:"overquota-modal-mid-arrow",children:(0,i.jsx)(n.Q,{type:u.AT.ARROW_RIGHT,style:{width:"24px",height:"24px"},stroke:c.J.PRIMARY_TEXT})}),(0,i.jsx)(x.A,{backGroundColor:c.J.BACKGROUND,marginLeft:"-7px",minWidth:"300px",children:(0,i.jsxs)("div",{className:"overquota-badge",children:[(0,i.jsx)(d.GW,{color:c.J.GREEN_PROFIT,children:"New plan"}),(0,i.jsx)("br",{}),(0,i.jsx)(d.Sz,{color:c.J.GREEN_PROFIT,children:y.trackedRevenue?`Up to ${J(y.trackedRevenue)} tracking revenue limit`:"Unlimited"})]})})]}),(0,i.jsxs)("div",{className:"overquota-modal-title",children:[(0,i.jsx)(d.Zb,{children:"Confirm plan upgrade"}),(0,i.jsxs)("div",{className:"mt-5",children:[(0,i.jsxs)(d.GW,{color:c.J.SECONDARY_TEXT,children:["You will be charged immediately a ",(0,i.jsxs)("span",{style:{color:c.J.PRIMARY_TEXT,fontWeight:"bold"}
2,children:["$",N.prorateAmount]})," proration fee and the amount"]}),(0,i.jsx)("br",{}),(0,i.jsxs)(d.GW,{color:c.J.SECONDARY_TEXT,children:["to be charged on the next invoice will be ",(0,i.jsxs)("span",{style:{color:c.J.PRIMARY_TEXT,fontWeight:"bold"},children:["$",y.price]}),"."]}),(0,i.jsxs)("p",{className:"mt-2",children:[(0,i.jsx)(d.GW,{color:c.J.SECONDARY_TEXT,children:"Keep in mind that you will not be able to downgrade for the next 30 days"})," "]})]})]})]})][G-1]}),(0,i.jsxs)(A.jl,{children:[(0,i.jsx)(r.A,{type:"secondary",onClick:B,text:"Close"}),(0,i.jsx)(r.A,{type:"primary",isLoading:D,onClick:()=>{if(1===G)w(G+1);else{let t;P(e=>!e),t=()=>m.A.updatePlan(y,b),e.connectedAccount&&(t=()=>g.A.updatePlan(e.connectedAccount.id,y)),t().then(()=>{(B(),e.onSuccess)?e.onSuccess():h.A.successWithCallback("Your payment is being verified, please note that this may take a few minutes to update.",()=>setTimeout(()=>{window.location.reload()},5e3))}).catch(()=>{h.A.error("Error when updating plan, try again later"),B()})}},text:1===G?"Upgrade plan":"Confirm upgrade"})]})]})})})}},36493(e,t,a){a.d(t,{A:()=>eI});var i=a(31085),s=a(99075),o=a(86989),r=a(38923),n=a(21323);a(78945);var l=a(12973),d=a(73072),c=a(85470),u=a(63901),p=a(57643),h=a(35546),T=a(45216),g=a(21834),m=a(16447),S=a(28674),f=a(25638),x=a(81622),A=a(50047),O=a(40454),C=a(27660);let y=e=>{let t={...C.A,...e.labels},a=(0,O.$)(e.draft,t.addRule.toLowerCase());return(0,i.jsxs)(p.jl,{style:{padding:"17px 16px"},children:[(0,i.jsx)(m.A,{type:"secondary",onClick:e.onCancel,children:t.cancel}),(0,i.jsx)("div",{className:"apply-container",children:(0,i.jsx)(m.A,{type:"primary",locked:a.length>0,tooltipText:a.length>0?t.acceptBlockedTooltip:void 0,onClick:e.onAccept,children:t.accept})})]})};var E=a(11540),_=a(56532);let I=e=>{let{visible:t,onChoose:a,onDismiss:s}=e;return(0,i.jsx)(p.aF,{id:"advanced-filters-intro-modal",visible:t,zIndex:2100,notCloseOnBackdropClick:!0,dontCloseOnEscape:!0,renderAtLayoutLevel:!0,style:{width:"50vw",minWidth:"470px",maxHeight:"630px",height:"630px"},children:(0,i.jsxs)("div",{className:"advanced-filters-intro",children:[(0,i.jsx)("button",{type:"button",className:"advanced-filters-intro-close",title:"Close",onClick:s,children:(0,i.jsx)(E.Q,{type:d.AT.CLOSE,width:16})}),(0,i.jsx)("h2",{className:"advanced-filters-intro-title",children:"We would like to introduce our new attribute filter"}),(0,i.jsxs)("div",{className:"advanced-filters-intro-options",children:[(0,i.jsxs)("button",{type:"button",className:"advanced-filters-intro-card",onClick:()=>a("V2"),children:[(0,i.jsx)("span",{className:"advanced-filters-intro-tag",children:"New"}),(0,i.jsx)("span",{className:"advanced-filters-intro-card-label",children:"Try our new filter"}),(0,i.jsx)(_.A,{variant:"new"})]}),(0,i.jsxs)("button",{type:"button",className:"advanced-filters-intro-card",onClick:()=>a("V1"),children:[(0,i.jsx)("span",{className:"advanced-filters-intro-card-label",children:"Keep using old one"}),(0,i.jsx)(_.A,{variant:"old"})]})]}),(0,i.jsx)("p",{className:"advanced-filters-intro-note",children:"You can switch to the old design at any time"})]})})};var R=a(98270),v=a(93975),N=a(38052),L=a(15182);let b=e=>{let{supported:t,version:a,onChange:s}=e,o=t&&"V2"===a;return(0,i.jsx)(L.A,{name:N.a.REPORTING_ADVANCED_FILTERS,children:(0,i.jsxs)("div",{className:"new-filter-badge",children:[(0,i.jsx)(r.A,{iconType:d.AT.INFO_V2,textTooltip:t?"Advanced filters let you combine conditions in groups. This first version takes up to 5 groups, one condition per filter inside each group, and joins the groups with and / or.":"Advanced filters are not available here yet. This report keeps using the current filters.",alwaysVisible:!0}),(0,i.jsx)("span",{className:"new-filter-badge-label",children:"New filter"}),(0,i.jsx)(v.A,{textStyle:{display:"none"},active:o,disabled:!t,onClick:()=>s(o?"V1":"V2")})]})})};var j=a(98822),G=a(15687),w=a(94023),D=a(12784),P=a.n(D),F=a(8181),M=a(5282),U=a(18833),k=a(72300),W=a(46621),B=a(51135),H=a(59360),J=a(10473),Y=a(1463),K=a(65572),$=a(28237),V=a(76662),z=a(80258),X=a(91477),q=a(6017),Q=a(67688),Z=a(69559),ee=a(4617),et=a(11439),ea=a(48007),ei=a(5584),es=a(20103),eo=a(27006),er=a(48819),en=a(63223),el=a(87254),ed=a(63281),ec=a(44479),eu=a(38960),ep=a(63627),eh=a(93524),eT=a(81072);let eg=e=>{var t,a;
2let[o,r]=(0,s.useState)({condition:"<=",value:0,name:""}),n=eu.W.map(e=>new ed.A(e.label,e.value));return(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"left",gap:"8px"},children:[(0,i.jsx)(S.GW,{type:"h-text-caption",color:l.J.TABLE_TITLES,children:"Sales with price:"}),(0,i.jsx)(ep.a,{style:{marginBottom:"0px"},width:"100%",label:"Sales Price Search type",tooltip:e.groupSelected===c.G.SALES_PRICE_FILTER?"You can filter for sales that satisfy all the selected price conditions at once (AND) or at least one of the selected price conditions (OR)":"You can exclude sales that satisfy all the selected price conditions at once (AND) or that satisfy at least one of the selected price conditions (OR)",children:e.groupSelected===c.G.SALES_PRICE_FILTER?(0,i.jsxs)(eh.t,{style:e.style,onChange:t=>e.updateConfiguration("salesPriceSearchType","AND"===t?"ALL_OF_THEM":"ANY_OF_THEM"),updatedValue:(null==(t=e.configuration)?void 0:t.salesPriceSearchType)==="ALL_OF_THEM"?"AND":"OR",children:[(0,i.jsx)(eT.G,{value:"OR"}),(0,i.jsx)(eT.G,{value:"AND"})]}):(0,i.jsxs)(eh.t,{style:e.style,onChange:t=>e.updateConfiguration("notSalesPriceSearchType","AND"===t?"NO_ALL_OF_THEM":"NO_ANY_OF_THEM"),updatedValue:(null==(a=e.configuration)?void 0:a.notSalesPriceSearchType)==="NO_ALL_OF_THEM"?"AND":"OR",children:[(0,i.jsx)(eT.G,{value:"OR"}),(0,i.jsx)(eT.G,{value:"AND"})]})}),(0,i.jsx)(ec.P,{width:"auto",elements:n,onSelected:e=>r({...o,condition:e}),selectedElement:o.condition}),(0,i.jsx)(M.v,{type:"number",placeholder:"Enter price",width:"100%",value:o.value,onChange:e=>{r({...o,value:""===e?NaN:parseFloat(e)})}}),(0,i.jsx)(m.A,{text:"Add",type:"secondary",style:{marginTop:"10px",width:"100%"},contentStyle:{gap:"1rem",width:"100%",justifyContent:"center"},onClick:()=>{!isNaN(o.value)&&o.value>=0&&(e.onAdd({...o,name:(0,eu.K)(o.condition,o.value)}),r({name:"",condition:"<=",value:0}))}})]})},em=e=>{var t,a,s,o,r,n,l,d;return({[c.G.LEAD_TAGS_SEARCH_TYPE]:(0,i.jsx)(ep.a,{style:{marginBottom:"0px"},width:"100%",label:"Lead Tags Search type",tooltip:"You can filter for sales from leads that have all the selected tags at once (AND) or at least one of the selected tags (OR)",children:(0,i.jsxs)(eh.t,{style:e.style,onChange:t=>e.updateConfiguration("tagSearchType","AND"===t?"ALL_OF_THEM":"ANY_OF_THEM"),updatedValue:(null==(t=e.filters)?void 0:t.tagSearchType)==="ALL_OF_THEM"?"AND":"OR",children:[(0,i.jsx)(eT.G,{value:"OR"}),(0,i.jsx)(eT.G,{value:"AND"})]})}),[c.G.NO_LEAD_TAGS_SEARCH_TYPE]:(0,i.jsx)(ep.a,{style:{marginBottom:"0px"},width:"100%",label:"Exclude Lead Tags Search type",tooltip:"You can filter for sales from leads that do not have all the selected tags at once (AND) or at least one of the selected tags (OR)",children:(0,i.jsxs)(eh.t,{style:e.style,onChange:t=>e.updateConfiguration("notTagSearchType","AND"===t?"NO_ALL_OF_THEM":"NO_ANY_OF_THEM"),updatedValue:(null==(a=e.filters)?void 0:a.notTagSearchType)==="NO_ALL_OF_THEM"?"AND":"OR",children:[(0,i.jsx)(eT.G,{value:"OR"}),(0,i.jsx)(eT.G,{value:"AND"})]})}),[c.G.PRODUCT_TAGS_SEARCH_TYPE]:(0,i.jsx)(ep.a,{style:{marginBottom:"0px"},width:"100%",label:"Product Tags Search type",tooltip:"You can filter for products that satisfy all the selected tags at once (AND) or at least one of the selected conditions (OR) ",children:(0,i.jsxs)(eh.t,{style:e.style,onChange:t=>e.updateConfiguration("productSearchType","AND"===t?"ALL_OF_THEM":"ANY_OF_THEM"),updatedValue:(null==(s=e.filters)?void 0:s.productSearchType)==="ALL_OF_THEM"?"AND":"OR",children:[(0,i.jsx)(eT.G,{value:"OR"}),(0,i.jsx)(eT.G,{value:"AND"})]})}),[c.G.SUBSCRIPTION_TAGS_SEARCH_TYPE]:(0,i.jsx)(ep.a,{style:{marginBottom:"0px"},width:"100%",label:"Subscription Tags Search type",tooltip:"You can filter for subscriptions that satisfy all the selected tags at once (AND) or at least one of the selected conditions (OR) ",children:(0,i.jsxs)(eh.t,{style:e.style,onChange:t=>e.updateConfiguration("subscriptionSearchType","AND"===t?"ALL_OF_THEM":"ANY_OF_THEM"),updatedValue:(null==(o=e.filters)?void 0:o.subscriptionSearchType)==="ALL_OF_THEM"?"AND":"OR",children:[(0,i.jsx)(eT.G,{value:"OR"}),(0,i.jsx)(eT.G,{value:"AND"})]})}),[c.G.PRODUCT_CATEGORIES_SEARCH_TYPE]:(0,i.jsx)(ep.a,{style:{marginBottom:"0px"},width:"100%",label:"Product Categories Search type",tooltip:"You can filter for categories that satisfy all the selected tags at once (AND) or at least one of the selected conditions (OR) ",children:(0,i.jsxs)(eh.t,{style:e.style,onChange:t=>e.updateConfiguration("productCategorySearchType","AND"===t?"ALL_OF_THEM":"ANY_OF_THEM"),updatedValue:(null==(r=e.filters)?void 0:r.productCategorySearchType)==="ALL_OF_THEM"?"AND":"OR",children:[(0,i.jsx)(eT.G,{value:"OR"}),(0,i.jsx)(eT.G,{value:"AND"})]})}),[c.G.SOURCE_LINKS_SEARCH_TYPE]:(0,i.jsx)(ep.a,{style:{marginBottom:"0px"},width:"100%",label:"Source Links Search type",tooltip:"You can filter for source links that satisfy all the selected conditions at once (AND) or at least one of the selected conditions (OR) ",children:(0,i.jsxs)(eh.t,{style:e.style,onChange:t=>e.updateConfiguration("sourceLinkSearchType","AND"===t?"ALL_OF_THEM":"ANY_OF_THEM"),updatedValue:(null==(n=e.filters)?void 0:n.sourceLinkSearchType)==="ALL_OF_THEM"?"AND":"OR",children:[(0,i.jsx)(eT.G,{value:"OR"}),(0,i.jsx)(eT.G,{value:"AND"})]})}),[c.G.NO_SALE_ITEM_TAGS_SEARCH_TYPE]:(0,i.jsx)(ep.a,{style:{marginBottom:"0px"},width:"100%",label:"Exclude Product Tags Search type",tooltip:"You can filter for sales from leads that do not have all the selected tags at once (AND) or at least one of the selected tags (OR)",children:(0,i.jsxs)(eh.t,{style:e.style,onChange:t=>e.updateConfiguration("notProductSearchType","AND"===t?"NO_ALL_OF_THEM":"NO_ANY_OF_THEM"),updatedValue:(null==(l=e.filters)?void 0:l.notProductSearchType)==="NO_ALL_OF_THEM"?"AND":"OR",children:[(0,i.jsx)(eT.G,{value:"OR"}),(0,i.jsx)(eT.G,{value:"AND"})]})}),[c.G.INTER_GROUP_SEARCH_TYPE]:(0,i.jsx)(ep.a,{style:{marginBottom:"0px"},width:"100%",label:"Relation between different attribute groups",tooltip:"You can choose to apply an AND or OR logic between different attribute groups. For example, if you select AND, the report will only include sales that satisfy the conditions of all attribute groups. If you select OR, the report will include sales that satisfy the conditions of at least one attribute group.",children:(0,i.jsxs)(eh.t,{style:e.style,onChange:t=>e.updateConfiguration("interGroupSearchType","AND"===t?"ALL_OF_THEM":"ANY_OF_THEM"),updatedValue:(null==(d=e.filters)?void 0:d.interGroupSearchType)==="ALL_OF_THEM"?"AND":"OR",children:[(0,i.jsx)(eT.G,{value:"OR"}),(0,i.jsx)(eT.G,{value:"AND"})]})})})[e.type]||(0,i.jsx)("div",{})};var eS=a(6329),ef=a(63944),ex=a(31940),eA=a(41097);function eO(e){return(0,i.jsx)("div",{children:(0,i.jsx)("ul",{className:"segmented-group-option",children:e.options.map(t=>(0,i.jsxs)("li",{className:"segmented-group-option-element",children:[(0,i.jsx)("a",{onClick:()=>e.onSelect(t.value),className:"font-style-segmented-group-option","data-test":"segmented-group-"+t.name,children:(0,i.jsx)(S.ZH,{className:"segmented-group-option-button",color:e.selected===t.value?l.J.PRIMARY_TEXT:l.J.SEGMENTED_GROUP_OPTION_LINE,style:{cursor:"pointer"},children:(t=>{let{include:a,exclude:i}=e.counts;return 0===a&&0===i?t.name:t.name===et.T.Include?a>0?`${t.name} (${a})`:t.name:t.name===et.T.Exclude&&i>0?`${t.name} (${i})`:t.name})(t)})}),(0,i.jsx)("span",{className:"segmented-group-option-active-bar",style:{backgroundColor:e.selected===t.value?l.J.PRIMARY_TEXT:l.J.SEGMENTED_GROUP_OPTION_LINE}})]},"segmented-group-"+t.name))})})}var eC=a(40784),ey=a(80483);let eE={PRODUCT_SKUS:20},e_=e=>{var t,a;
2let o,r,n,[u,p]=(0,s.useState)(""),[T,g]=(0,s.useState)(""),[f,x]=(0,s.useState)(new Map),[A,O]=(0,s.useState)(null),[C,y]=(0,s.useState)([]),[_,I]=(0,s.useState)(new Map),[R,N]=(0,s.useState)(1),[L,b]=(0,s.useState)(!0),[j,w]=(0,s.useState)(""),[D,ed]=(0,s.useState)("TAG"),[ec,eu]=(0,s.useState)({searchTerm:"",type:void 0,allowNewTag:!1}),[ep,eh]=(0,s.useState)(!0),[eT,e_]=(0,s.useState)(new Map),[eI,eR]=(0,s.useState)(!1);(0,s.useEffect)(()=>{G.A.getProperty("GOOGLE_INTEGRATION_VERSION").then(e=>eR("GOOGLE_V2"===e)).catch(()=>{})},[]);let ev=(0,W.D2)(e=>{var t;return null==(t=e.session.top)?void 0:t.userLogin.restrictions}),eN=[...eT].some(e=>{let[t,a]=e;return a.length>0}),eL=[...eT].filter(e=>{let[t,a]=e;return a.length>0}).length,eb=(0,s.useMemo)(()=>P()(e=>g(e),500),[]);(0,s.useEffect)(()=>()=>eb.cancel(),[eb]),(0,s.useEffect)(()=>{eb(u)},[u,eb]),(0,s.useEffect)(()=>{ej(),eG(),O(null),eh(!0)},[e.visible]),(0,s.useEffect)(()=>{eU()},[ec]),(0,s.useEffect)(()=>{if(N(1),b(!0),e6())return eu(e=>({...e,searchTerm:T}));eU()},[A,T]),(0,s.useEffect)(()=>{(p(""),g(""),eb.cancel(),y([]),I(new Map),ed(A===c.G.SOURCE_LINK_AD?"SELECT":"TAG"),f.get(A)&&0===eB(A)&&e9(),eT.get(A))?e.onGroupsUpdated(eB(A)>0):e.onGroupsUpdated(!1)},[A]),(0,s.useEffect)(()=>{if(!e.visible)return;A&&e.onGroupsUpdated(eB(A)>0);let t=new Map;eT.forEach((e,a)=>{t.set(a,e.map(e=>({group:a,data:e,checked:!0})))}),e.onUpdateOptionsCheckedByGroup(t)},[eT,A,e.visible]);let ej=()=>{[...e.attributeGroups,...er.db].forEach(e=>eT.set(e,[])),e_(new Map(eT))},eG=()=>{e.attributeGroups.forEach(t=>{(eP()?eD(t):e.configuration[h.Y.get(t)]).forEach(e=>{e_(new Map(eT.set(t,[...eT.get(t),e])))})}),(eP()?er.KG:[...er.KG,c.G.FIRST_CLICKED_SOURCE_CATEGORIES,c.G.FIRST_CLICKED_TRAFFIC_SOURCES,c.G.LAST_CLICKED_NAME_PREFIXES,c.G.LAST_CLICKED_NAME_SUBSTRINGS,c.G.LAST_CLICKED_SOURCE_CATEGORIES,c.G.LAST_CLICKED_TRAFFIC_SOURCES]).forEach(e=>ew(e))},ew=t=>{let a=eP()?eD(t):e.configuration[h.Y.get(t)];a&&e_(new Map(eT.set(t,[...eT.get(t),...a])))},eD=t=>e.filters[(0,el.M)(e.filters).get(t)],eP=()=>!!e.filters,eF=e=>({...e,items:e.items.map(e=>({...e,name:(0,k.vo)(e.name,e.adspendType??e.adSpendType,eI)}))}),eM=async(e,t,a)=>{var i;let s,o=(null==(i=W.x0.getState().session.top)?void 0:i.demoModeEnabled)?V.A:X.A,r=[];switch(e){case c.G.SOURCE_CATEGORIES:case c.G.TRAFFIC_SOURCES:case c.G.GOALS:case c.G.NOT_SOURCE_CATEGORIES:case c.G.NOT_TRAFFIC_SOURCES:case c.G.NOT_GOALS:if((r=await eK("CATEGORY","categoryDTO")).length>0)return r.filter(t=>t.categoryType==er.R[e]);return await $.A.getCategoriesByPage({categoryType:er.R[e],name:T},t,a);case c.G.AD_ACCOUNTS:case c.G.NOT_AD_ACCOUNTS:if((r=await eK("AD_ACCOUNT","adspendAccountDTO")).length>0)return r;return await K.A.getAccountsByPage({name:T},t,a);case c.G.SOURCE_LINKS:case c.G.NOT_SOURCE_LINKS:case c.G.LAST_CLICKED_SOURCES:case c.G.FIRST_CLICKED_SOURCES:if((r=await eK("SOURCE_LINK","sourceLinkDTO")).length>0)return r;return eF(await Q.A.getSourceLinksByPage({searchNameInput:T},t,a));case c.G.SOURCE_LINK_AD:case c.G.NOT_SOURCE_LINK_ADS:if((r=await eK("SOURCE_LINK_AD","sourceLinkAdDTO")).length>0)return r;return eF(await Q.A.getSourceLinkAdsByPage({name:T},t,a));case c.G.PRODUCT_CATEGORIES:case c.G.NOT_PRODUCT_CATEGORIES:return await $.A.getCategoriesByPage({categoryType:"PRODUCT",name:T},t,a);case c.G.NO_SALE_ITEM_TAGS:case c.G.PRODUCT_TAGS:return await o.searchAll({type:Y.R.SALE,searchTerm:T,allowNewTag:!1},t);case c.G.PRODUCT_PACKAGES:case c.G.NOT_PRODUCT_PACKAGES:return await eC.A.getSaleItemGroupsByPage({name:T},t,a);case c.G.PRODUCT_SKUS:case c.G.NOT_PRODUCT_SKUS:return await q.A.searchSkusByPage({text:T},t,a);case c.G.LEAD_TAGS:case c.G.NOT_LEAD_TAGS:{let e=ec.searchTerm?ec:{...ec,searchTerm:T};return await o.searchAll(e,t)}case c.G.EXTERNAL_INTEGRATIONS:case c.G.NOT_EXTERNAL_INTEGRATIONS:return(s=await z.A.getActiveIntegrationsByPage({name:T},t,a)).items=s.items.map(e=>({...e,icon:(0,ea.n)(e.provider)})),s;case c.G.LEAD_STAGE:case c.G.NOT_LEAD_STAGE:return await Z.A.getLeadStagesByPage({name:T},t,a);case c.G.SUBSCRIPTION_TAGS:case c.G.NOT_SUBSCRIPTION_TAGS:return await o.searchAll({type:Y.R.SUBSCRIPTION,searchTerm:T,allowNewTag:!1},t);default:return[]}},eU=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=eE[A]??20;if(!A&&T.trim())return void await ek();let a=await eM(A,e,t);if(!a||!a.items)return void b(!1);let i=ez(a);N(e+1);let s=(e-1)*t+i.length;b(a.count>s);let o=[c.G.PRODUCT_SKUS,c.G.NOT_PRODUCT_SKUS].includes(A);return y(t=>o&&e>1?[...t,...i]:i),i},ek=async()=>{let t=new Map,a=eE[A]??20;for(let i of e.attributeGroups)try{let e=await eM(i,1,a);e.items&&e.items.length>0&&t.set(i,e.items.slice(0,10))}catch(e){console.error(`Error fetching options for group ${i}:`,e)}I(t),b(!1)},eW=e=>er.Ig.get(e)+":",eB=e=>{var t;if(eP())return eH(e);let a=[...er.Io[e]??[],...er.bi[e]??[]];return a.length>0?eY([...a,e]):(null==(t=eT.get(e))?void 0:t.length)||0},eH=e=>{var t;let a=er.Io[e]??[];return a.length>0?eY([...a,e]):(null==(t=eT.get(e))?void 0:t.length)||0},eJ=e=>{var t;let a=er.oD[e]??[];return a.length>0?eY([...a,e]):(null==(t=eT.get(e))?void 0:t.length)||0},eY=e=>e.reduce((e,t)=>
2{var a;return e+((null==(a=eT.get(t))?void 0:a.length)||0)},0),eK=(e,t)=>{let a=ev.filter(t=>t.restrictionType===e).map(e=>e[t]);return a||ee.A.getRestrictions().then(a=>a.filter(t=>t.restrictionType===e).map(e=>e[t]))},e$=[...er.hS,...er.pv],eV=(null==(a=W.x0.getState().session)||null==(t=a.top)?void 0:t.cloakMode)&&"true"===localStorage.getItem("CloakMode"),ez=e=>eV&&e.items.length>0?A===c.G.PRODUCT_SKUS||A===c.G.NOT_PRODUCT_SKUS?e.items.map(e=>e?(0,ey.cE)(e):"***"):e.items.map(e=>({...e,name:e.name?(0,ey.cE)(e.name):"***",publicName:e.publicName?(0,ey.cE)(e.publicName):"***",adSpendAdId:e.adSpendAdId?(0,ey.cE)(e.adSpendAdId):"***",customerId:e.customerId?(0,ey.cE)(e.customerId.toString()):"***",adspendIntegrationId:e.adspendIntegrationId?(0,ey.cE)(e.adspendIntegrationId):"***"})):e.items,eX=async()=>{let e=f.get(A);if(x(new Map(f.set(A,!e))),e)e_(new Map(eT.set(A,[])));else{let e=await eM(A,1,100),t=(null==e?void 0:e.items)??[],a=t.slice(0,100);t.length>100&&B.A.warning("Max 100 options"),e_(new Map(eT.set(A,a)))}},eq=(t,a)=>{var i;let s=a||A,o=er.kg[`${s}_${D}`]||s;if(!e0(eQ(o)))return;let r=er.L6[o];if(r&&(null==(i=eT.get(r))?void 0:i.find(e=>e1(e,t,o))))return void B.A.warning("This item is already selected in the opposite include/exclude filter");if(eT.get(o).find(e=>e1(e,t,o)))B.A.warning("There is already a filter with that name and condition created");else{let a="";if(eT.get(o).forEach(t=>!eP()&&(0,U.C)(eQ(o),e.configuration.optimizeReport)?a+=t.id:a+=t.name),a.length>1800)return void B.A.warning("Max tags size reached");e_(new Map(eT.set(o,[...eT.get(o),t])))}},eQ=e=>eP()?eZ(e):h.Y.get(e),eZ=t=>(0,el.M)(e.filters).get(t),e0=t=>{if(!eP()||!Array.isArray(e.filters[t])||!e.filterMaxItems)return!0;let a=e.filterMaxItems.get(t);return!(e.filters[t].length+1>a)||(B.A.error(`You can only add a maximum of ${a} item${a?"":"s"} for this filter`),!1)},e1=(e,t,a)=>{let i=(0,er.BW)(a,t,!1),s=(0,er.BW)(a,e,!1);return null!=t.id?e.id===t.id:null!=t.customerId?e.customerId===t.customerId:s===i},e2=()=>{eq({name:e3(j)}),w("")},e3=e=>{if(e5())return e;let t="$";return e4()&&(t="#"),e8()&&(t="@"),`${t}${e}`},e5=()=>[c.G.LEAD_TAGS,c.G.SOURCE_LINKS,c.G.SOURCE_LINK_AD].includes(A)&&["SUBSTRING","PREFIX"].includes(D),e4=()=>[c.G.SUBSCRIPTION_TAGS,c.G.NOT_SUBSCRIPTION_TAGS].includes(A),e8=()=>[c.G.SOURCE_LINKS,c.G.FIRST_CLICKED_SOURCES,c.G.LAST_CLICKED_SOURCES].includes(A),e6=()=>[c.G.LEAD_TAGS,c.G.NOT_LEAD_TAGS].includes(A),e9=()=>{if(f.get(A))return x(new Map(f.set(A,!1)))},e7=()=>A===c.G.NO_SALE_ITEM_TAGS?"Exclude":"Add",te=[c.G.EXTERNAL_INTEGRATIONS,c.G.AD_ACCOUNTS,c.G.NOT_EXTERNAL_INTEGRATIONS,c.G.NOT_AD_ACCOUNTS,c.G.SOURCE_LINK_AD,c.G.NOT_SOURCE_LINK_ADS],tt=(0,s.useCallback)((e,t)=>{var a;return null==(a=eT.get(t))?void 0:a.some(a=>e1(a,e,t))},[eT]),ta=(0,s.useCallback)((e,t,a)=>{let s=a||A;return(0,i.jsxs)("div",{className:"option",onClick:()=>eq(e,s),children:[(0,i.jsxs)(S.ZH,{style:{color:e.name&&(0,eo.Ae)(e.name[0],l.J.SECONDARY_TEXT)},children:[te.includes(s)&&ts(e,s),(0,er.BW)(s,e,!eP())]}),(0,i.jsx)(E.Q,{type:d.AT.CHECK,style:{display:tt(e,s)?"initial":"none"}})]},t)},[A,eq,tt]),ti=(0,s.useCallback)(()=>Array.from(_.entries()).map(e=>{let[t,a]=e;return 0===a.length?null:(0,i.jsxs)("div",{children:[(0,i.jsx)(S.GW,{type:"h-text-caption",className:"all-groups-header",style:{color:l.J.SECONDARY_TEXT},children:eW(t)}),(0,i.jsx)("div",{className:"all-groups-options",children:a.map((e,a)=>ta(e,a,t))})]},t)}),[_,ta]),ts=(e,t)=>{var a;let s=null==(a=J.Qq.get(e.accountType||e.adSpendType))?void 0:a.icon,o=e.icon,r=[c.G.AD_ACCOUNTS,c.G.NOT_AD_ACCOUNTS,c.G.SOURCE_LINK_AD,c.G.NOT_SOURCE_LINK_ADS].includes(t)?s:o;return(0,i.jsx)(E.Q,{type:r,style:{marginRight:"5px",flexGrow:1}})},to=()=>!tr(A)&&"PREFIX"!==D&&"SUBSTRING"!==D,tr=e=>[c.G.SALES_PRICE_FILTER,c.G.NOT_SALES_PRICE_FILTER].includes(e);return(0,i.jsx)("div",{style:{height:"100%"},children:(0,i.jsxs)("section",{className:"selector-container",children:[(0,i.jsxs)("div",{className:"groups-container",children:[(0,i.jsx)(S.GW,{type:"h-text-l-semibold",className:"groups-header",children:"Attribute groups"}),(0,i.jsx)("div",{className:"groups",children:(()=>{let t=A,a=e.attributeGroups;!eP()&&(a=e.attributeGroups.filter(e=>!er.pv.includes(e)),er.pv.includes(A)&&(t=er.L6[A]));return a.map((e,a)=>{let s;return(0,i.jsxs)("div",{onClick:()=>{e!==A&&(y([]),O(e),eh(!0))},className:`list-name-group-container${t===e?" selected":""}`,children:[(0,i.jsx)("div",{className:"list-name-group-text",children:(0,i.jsx)(S.GW,{children:(s=er.Ig.get(e),eB(e)>0&&(s+=` (${eB(e)})`),s)})}),(0,i.jsx)(E.Q,{type:d.AT.ARROW_RIGHT,stroke:A==e?l.J.PRIMARY_TEXT:l.J.SECONDARY_TEXT,width:20})]},a)})})()})]}),(0,i.jsxs)("div",{className:"options-container",children:[(0,i.jsx)(S.GW,{type:"h-text-l-semibold",className:"options-header",children:"Attributes"}),!eP()&&e$.includes(A)&&e.attributeGroups.includes(A)&&e.attributeGroups.includes(er.L6[A])&&(o=ep?eH(A):eH(er.L6[A]),r=eJ(ep?er.L6[A]:A),(0,i.jsx)(eO,{selected:ep?et.T.Include:et.T.Exclude,onSelect:()=>{O(er.L6[A]),eh(!ep)},options:er.Vr,counts:{include:o,exclude:r}})),to()&&(0,i.jsx)("div",{children:(0,i.jsx)(M.v,{placeholder:"Search",value:u,onChange:e=>p(e),icon:d.AT.SEARCH,style:{margin:"5px 15px"}})}),(n=[c.G.SOURCE_LINK_AD,c.G.SOURCE_LINKS,c.G.PRODUCT_TAGS,c.G.LAST_CLICKED_SOURCES,c.G.FIRST_CLICKED_SOURCES,c.G.NO_SALE_ITEM_TAGS,c.G.LEAD_TAGS],(0,en.BS)(e.filters)||n.push(c.G.SUBSCRIPTION_TAGS),n.includes(A)&&(0,i.jsx)("div",{className:"as-tag-filter-by-wrapper",children:(0,i.jsx)(ef.K,{buttonClassName:"as-tag-filter-by-option",options:[A===c.G.SOURCE_LINK_AD?{name:H.zP.get("SELECT"),value:"SELECT"}:{name:H.zP.get("TAG"),value:"TAG"},{name:H.zP.get("PREFIX"),value:"PREFIX"},{name:H.zP.get("SUBSTRING"),value:"SUBSTRING"}],selected:D,onSelect:e=>{ed(e)}})})),"PREFIX"===D&&(0,i.jsxs)("div",{className:"options-header",children:[(0,i.jsx)(M.v,{value:j,onChange:w,onEnter:e2,label:`${e7()} all ${er.gt.get(A)} with ${H.h2.get(D)}:`,labelType:"h-text-caption",placeholder:`Enter ${H.h2.get(D)}`}),(0,i.jsx)(m.A,{text:"Add",type:"secondary",style:{marginTop:"10px",width:"100%"},contentStyle:{gap:"1rem",width:"100%",justifyContent:"center"},locked:!(j.length>2),onClick:e2})]}),"SUBSTRING"===D&&(0,i.jsxs)("div",{className:"options-header",children:[(0,i.jsx)(M.v,{value:j,onChange:w,onEnter:e2,label:`${e7()} all ${er.gt.get(A)} with ${H.h2.get(D)}:`,labelType:"h-text-caption",placeholder:`Enter ${H.h2.get(D)}`}),(0,i.jsx)(m.A,{text:"Add",type:"secondary",style:{marginTop:"10px",width:"100%"},contentStyle:{gap:"1rem",width:"100%",justifyContent:"center"},locked:!(j.length>2),onClick:e2})]}),to()&&[c.G.SOURCE_LINKS,c.G.SOURCE_LINK_AD,c.G.LAST_CLICKED_SOURCES,c.G.FIRST_CLICKED_SOURCES].includes(A)&&(0,i.jsx)("div",{className:"options-header",children:(0,i.jsx)(v.A,{textStyle:{marginTop:"5px",color:l.J.INPUT_PLACEHOLDER},active:f.get(A),onClick:eX,text:"Select all"})}),to()&&e6()&&(0,i.jsx)("div",{className:"as-tag-search-type-wrapper",children:(0,i.jsx)(ef.K,{onSelect:e=>{eu(t=>({...t,type:e}))},options:(0,er.l8)(),selected:ec.type})}),to()&&(()=>{if(!A||!er.Zb[A])return null;let t={style:{display:"flex"},key:er.Zb[A],type:er.Zb[A],updateConfiguration:e.updateConfiguration},a=eP()?em:eA.G;return(0,i.jsx)("div",{style:{marginLeft:15},children:(0,i.jsx)(a,{...t,visible:!!eP()||(0,ei.UN)(e.configuration,er.Zb[A]),filters:e.filters,configuration:e.configuration})})})(),tr(A)&&(0,i.jsx)("div",{className:"options-header",children:(0,i.jsx)(eg,{onAdd:e=>eq(e,A),updateConfiguration:e.updateConfiguration,groupSelected:A,style:{display:"flex"},configuration:e.configuration})}),A?to()?(0,i.jsx)("div",{className:"options",children:(0,i.jsx)(eS.A,{customOption:ta,height:(0,er.By)(A),elements:C??[],handleSelect:eq,noMoreElementsMessage:"No more options foun
2d",fetchMoreData:()=>eU(R),hasMore:L})}):null:!A&&u.trim()&&_.size>0?(0,i.jsx)("div",{className:"options",style:{maxHeight:"40vh",overflowY:"auto"},children:ti()}):(0,i.jsx)("div",{className:"options-description",children:(0,i.jsx)(S.GW,{type:"h-text-text",color:l.J.TERTIARY_TEXT,children:!A&&u.trim()?"No results found":"Select attribute group on the left to see available options"})})]}),(0,i.jsxs)("div",{className:"options-container",style:{overflowY:"auto"},children:[(0,i.jsx)(S.GW,{type:"h-text-l-semibold",className:"options-header",children:"Selected attributes"}),((0,en.BS)(e.filters)||(0,en.AS)(e.filters))&&eL>1&&(0,i.jsx)("div",{style:{marginLeft:15,marginBottom:15},children:(0,i.jsx)(em,{type:c.G.INTER_GROUP_SEARCH_TYPE,filters:e.filters,updateConfiguration:e.updateConfiguration})}),eN?(eP()?[...eT].filter(e=>{let[t,a]=e;return a.length>0}):(0,er.gV)(eT,e.configuration.financialStatsType)).map(t=>{var a;let[s,o]=t,r=er.hd[s],n=r?null==(a=e.filters)?void 0:a[r]:void 0;return(0,i.jsxs)("div",{className:"options-selected-container",children:[(0,i.jsxs)(S.GW,{type:"h-text-text",className:"options-selected-header",children:[eW(s),n&&(0,i.jsx)("span",{className:"sales-attributes-search-type-chip",children:(0,er.n0)(n)})]}),(0,i.jsx)("div",{className:"options-selected h-tag-inactive-action",children:o.map((e,t)=>{let a=(0,er.BW)(s,e,!1),o=(0,es.Sm)(a,15),r=o.length!==a.length;return(0,i.jsx)(F.A,{textTooltip:a,enabled:r,placement:"top",children:(0,i.jsx)("div",{className:"options-tag-container",children:(0,i.jsx)(ex.D,{name:o,onRemove:()=>{e9(),e_(new Map(eT.set(s,eT.get(s).filter(t=>!e1(t,e,s)))))}})})},t)})})]},s)}):(0,i.jsx)("div",{className:"options-description",children:(0,i.jsx)(S.GW,{type:"h-text-text",color:l.J.TERTIARY_TEXT,children:"No attributes selected"})})]})]})})},eI=e=>{var t,a,O;
2let C,[E,_]=(0,s.useState)(!1),[v,D]=(0,s.useState)(!1),[P,F]=(0,s.useState)(new Map),[M,U]=(0,s.useState)(e.attributeGroups||[]),k=[c.G.SOURCE_LINK_AD,c.G.SOURCE_LINKS,c.G.AD_ACCOUNTS,c.G.TRAFFIC_SOURCES,c.G.SOURCE_CATEGORIES,c.G.GOALS],W=[c.G.SOURCE_LINK_AD,c.G.NOT_SOURCE_LINK_ADS,c.G.AD_ACCOUNTS,c.G.NOT_AD_ACCOUNTS];(0,s.useEffect)(()=>{e.openerSetter(()=>B)},[]);let B=()=>{_(!0)},H=()=>{_(!1)};(0,s.useEffect)(()=>{J()},[null==(t=e.configuration)?void 0:t.financialStatsType,e.hideSourceAttributionGroups,e.attributeGroups]);let J=()=>{let t;e.attributeGroups?t=e.attributeGroups:(t=o.pB[e.configuration.financialStatsType].attributionGroups,e.hideSourceAttributionGroups&&(t=t.filter(e=>!k.includes(e)))),u.A.hasAdspendIntegrationsEnabled()||(t=t.filter(e=>!W.includes(e))),U(t)},Y=e=>e.name?e.name:e,K=t=>e.filters?$(t):h.Y.get(t),$=t=>(0,el.M)(e.filters).get(t),V=()=>{var t;null==(t=e.onUpdateOriginalState)||t.call(e,e.configuration||e.filters),P.forEach((t,a)=>{var i,s;let o=K(a);if(!o)return;((t,a)=>{var i,s;let o=K(t);if(!o||!Array.isArray(null==(i=e.filters)?void 0:i[o])&&!Array.isArray(null==(s=e.configuration)?void 0:s[o]))return;let r=e.filters?[...e.filters[o]]:[...e.configuration[o]],n=t!==c.G.PRODUCT_SKUS,l=new Set(a.map(e=>n?e.data.name:e.data));r.forEach(t=>{l.has(Y(t))||e.onRemoveToContainer(Y(t),o)})})(a,t);let r=a!==c.G.PRODUCT_SKUS,n=new Set(((null==(i=e.filters)?void 0:i[o])||(null==(s=e.configuration)?void 0:s[o])||[]).map(e=>`${e.id}-${Y(e)}`));t.forEach(t=>{let a=`${t.data.id}-${r?t.data.name:t.data}`;n.has(a)||e.onAddToContainer(t.data,o)})}),H()},z=(0,x.QY)(!0===e.supportsAdvancedFilters,null==(a=e.configuration)?void 0:a.reportFiltersVersion),{data:X}=(0,j.useQuery)(["report_filters_choice_made"],async()=>{let e=await G.A.getProperty("REPORTING_FILTERS_CHOICE_MADE");return!0===e||"true"===e},{staleTime:3e5,refetchOnWindowFocus:!1}),{mutate:q}=(0,j.useMutation)(e=>G.A.setProperty("REPORTING_FILTERS_VERSION_DEFAULT",e),{onSettled:()=>w.A.loadUserMetadatas()}),{mutate:Q}=(C=(0,j.useQueryClient)(),(0,j.useMutation)(()=>G.A.setProperty("REPORTING_FILTERS_CHOICE_MADE",!0),{onMutate:()=>C.setQueryData(["report_filters_choice_made"],!0),onSettled:()=>C.invalidateQueries(["report_filters_choice_made"])})),Z=E&&!0===e.supportsAdvancedFilters&&!1===X,ee=e.configuration?(0,x.iP)(e.configuration.financialStatsType):[],[et,ea]=(0,s.useState)((0,f.xW)());(0,s.useEffect)(()=>{var t;E&&ea((null==(t=e.configuration)?void 0:t.advancedFilter)??(0,f.xW)())},[E]);let[ei,es]=(0,s.useState)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(L.A,{name:N.a.REPORTING_ADVANCED_FILTERS,children:(0,i.jsx)(I,{visible:Z,onChoose:t=>{var a,i;let s;Q(),t!==(null==(a=e.configuration)?void 0:a.reportFiltersVersion)&&(s=e.configuration)&&((0,f.Z9)(s.advancedFilter??(0,f.xW)())>0||[...h.Y.values()].some(e=>{var t;return((null==(t=s[e])?void 0:t.length)??0)>0}))?es(t):(null==(i=e.updateConfiguration)||i.call(e,"reportFiltersVersion",t),q(t))},onDismiss:Q})}),(0,i.jsx)(T.m,{show:void 0!==ei,zIndex:2100,title:"V2"===ei?"Switch to the new filter?":"Go back to the current filter?",message:"The attributes selected here will be cleared, and the filter starts empty. The report keeps its dates and columns.",confirmText:"Switch and clear",cancelText:"Keep as is",onConfirm:()=>{var t;ea((0,f.xW)()),null==(t=e.switchFiltersVersion)||t.call(e,e=>{let t=n.A.cloneConfig(e);return t.clearSourceFilters(),h.Y.forEach(e=>{t[e]=[]}),t.advancedFilter=(0,f.xW)(),t.reportFiltersVersion=ei,(0,g.cZ)(t,t.deepAnalyticsLinked)}),q(ei),es(void 0)},onCancel:()=>es(void 0)}),(0,i.jsxs)(p.aF,{id:e.modalId||"attribute-selector-modal",visible:E,style:z?{width:"60vw",minWidth:"560px",maxHeight:"90vh",height:"min(720px, 90vh)"}:{width:"50vw",minWidth:"470px",maxHeight:"630px",height:"630px"},onBackdropClick:H,renderAtLayoutLevel:!0,children:[(0,i.jsx)(p.rQ,{title:(0,i.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:["Specify Attributes",(0,i.jsx)(r.A,{className:"tutorial-help-bubble",externalDocumentationType:"ATTRIBUTE_FILTERS",iconType:d.AT.TUTORIAL,textTooltip:"Attribute Filters Documentation",alwaysVisible:!0}),(0,i.jsx)(b,{supported:!0===e.supportsAdvancedFilters,version:null==(O=e.configuration)?void 0:O.reportFiltersVersion,onChange:es})]}),closeModal:H,style:z?void 0:{borderBottom:`1px solid ${l.J.DIVIDERS}`}}),(0,i.jsx)(p.cw,{maxWidth:"100%",height:"77%",overflowY:"unset",style:{padding:0},children:z?(0,i.jsx)(A.A,{draft:et,availableFields:ee,optionsProvider:R.Q,onChange:ea}):(0,i.jsx)(e_,{visible:E,configuration:e.configuration,updateConfiguration:e.updateConfiguration,attributeGroups:M,onUpdateOptionsCheckedByGroup:e=>{F(e)},onGroupsUpdated:D,filters:e.filters,filterMaxItems:e.filterMaxItems,tagType:e.tagType,tabId:e.tabId})}),z?(0,i.jsx)(y,{draft:et,onCancel:H,onAccept:()=>{var t;V(),null==(t=e.acceptAdvancedFilter)||t.call(e,et)}}):(0,i.jsxs)(p.jl,{style:{padding:"17px 16px"},children:[(0,i.jsx)(m.A,{type:"secondary",onClick:H,children:"Cancel"}),(0,i.jsxs)("div",{className:"apply-container",children:[!v&&(0,i.jsx)(S.GW,{children:"All attributes selected by default unless specified"}),(0,i.jsx)(m.A,{type:"primary",onClick:V,children:"Apply"})]})]})]})]})}},63223(e,t,a){a.d(t,{BS:()=>O,Ay:()=>E,AS:()=>C});var i=a(31085),s=a(99075),o=a(15294),r=a(70165),n=a(12973),l=a(73072),d=a(3234),c=a(60068),u=a(76806),p=a(36493),h=a(28674),T=a(48819),g=a(34792),m=a(87254);let S=e=>
2{let[t,a]=(0,s.useState)([]),o=(0,m.M)(e.filters);(0,s.useEffect)(()=>{a(Array.from(o.entries()).map(t=>{let[a,i]=t;return{groupType:a,group:T.Ig.get(a),values:e.filters[i]||[]}}))},[e.filters]);let r=t.filter(e=>e.values.length>0),n=e.filters.interGroupSearchType,l=r.length>1&&void 0!==n;return(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)("div",{className:"sales-attributes-summary-container",children:(0,i.jsxs)(h.GW,{className:"sales-attributes-summary-group",children:[(0,i.jsx)("span",{className:"sales-attributes-summary-attribute",children:"Attribution Group"}),(0,i.jsx)("span",{className:"sales-attributes-search-type-chip",children:(0,T.n0)(n)})]})}),t.map((t,a)=>{if(0===t.values.length)return null;let s=T.hd[t.groupType],o=s?e.filters[s]:void 0;return(0,i.jsxs)("div",{className:"sales-attributes-summary-container",children:[(0,i.jsxs)(h.GW,{className:"sales-attributes-summary-group",children:[(0,i.jsx)("span",{className:"sales-attributes-summary-attribute",children:t.group}),o&&(0,i.jsx)("span",{className:"sales-attributes-search-type-chip",children:(0,T.n0)(o)})," ="]}),t.values.map((e,a)=>(0,i.jsxs)("span",{style:{color:(0,g.l)(e),marginLeft:5},children:[e.name||e,a<t.values.length-1&&","]},a))]},a)})]})};var f=a(26298),x=a(51135),A=a(33883);let O=e=>e instanceof c.A,C=e=>e instanceof u.j_,y=new Map([["listTagsPrefix",5],["listTagsSubstring",5]]),E=e=>
2{let[t,a]=(0,s.useState)(),[c,u]=(0,s.useState)(e.filters),h=(0,A.DP)(),T=()=>{e.setChangesMade(!0),e.setFilterCleared(!1)};return(0,s.useEffect)(()=>{u(e.filters)},[e.filters]),(0,i.jsxs)("div",{className:"report-attribute-filters-wrapper",style:e.containerStyle,children:[(0,i.jsx)(d.k,{title:"Attribute filters",titleColor:n.J.WIDGET_PRIMARY,width:"100%",initialOpened:!0,type:"FULL",subtitle:"Filter results by certain sources, products, tags, etc",subtitleStyles:{textAlign:"start",fontSize:"12px",width:"100%",paddingBottom:"1.2rem",paddingInline:"1.6rem",display:"block"},children:(0,i.jsxs)("div",{className:"attribute-filters-container",children:[(0,i.jsx)("div",{className:"attribute-filters-body-container",children:(0,i.jsx)("div",{className:"date-picker-container",children:(0,i.jsx)(o.A,{openDirection:"up",width:"100%",usePopper:!0,id:"sales-component-date-picker",start:e.filters.startDate,end:e.filters.endDate,inputHandler:(t,a)=>{e.setFilters(e=>{let i=new f.e().create(e);return i[`${t}Date`]=a,i}),T()},filterCleared:e.filterCleared})})}),(0,i.jsx)("div",{className:"sales-specify-attributes-container",onClick:t,children:e.showAttributesSummary&&Object.keys(e.filters).some(t=>{if(!e.filters)return!1;let a=e.filters[t];return!!Array.isArray(a)&&a.length>0})?(0,i.jsx)(S,{filters:e.filters}):(0,i.jsx)(r.C,{style:{fontWeight:"500",fontSize:"14px"},spaceBetweenIconAndText:-4,iconType:l.AT.PLUS,marginLeft:"0px",color:"dark"===h?n.J.GREEN_PROFIT:n.J.BLACK,colorIcon:"dark"===h?n.J.GREEN_PROFIT:n.J.BLACK,hideIconBackground:!0,children:"Specify Attributes"})})]})}),(0,i.jsx)(p.A,{openerSetter:a,filters:c,onAddToContainer:(t,a)=>{if(Array.isArray(e.filters[a])){let i;if(((i=a.toLowerCase()).includes("tagsprefix")||i.includes("tagssusbtring"))&&e.filters[a].length>5)return void x.A.error("You can only add a maximum of 5 for this filter");u(i=>{let s=new f.e().create(i);return Array.isArray(s[a])&&(s[a]=[...s[a],t]),e.setFilters(s),s}),T()}},onUpdateOriginalState:t=>{e.setFilters(t)},updateConfiguration:(t,a)=>{e.setFilters(e=>{let i=new f.e().create(e);return Array.isArray(i[t])?i[t]=[...i[t],a]:i[t]=a,i}),T()},onRemoveToContainer:(t,a)=>{u(i=>{let s=new f.e().create(i);return Array.isArray(s[a])&&(s[a]=s[a].filter(e=>e.name?e.name!==t:e!==t)),e.setFilters(s),s}),T()},attributeGroups:e.attributeGroups,filterMaxItems:y,tagType:e.tagType})]})}},26298(e,t,a){a.d(t,{e:()=>n});var i=a(18990),s=a(76806),o=a(60068),r=a(17469);class n{constructor(){(0,i._)(this,"create",e=>e instanceof o.A?new o.A(e):e instanceof s.j_?new s.j_(e):e instanceof r.Q?new r.Q(e):null)}}},76806(e,t,a){a.d(t,{Pi:()=>ev,j_:()=>e_,wh:()=>eE});var i,s,o=a(18990),r=a(31085),n=a(99420),l=a.n(n),d=a(99075),c=a.n(d),u=a(78054),p=a(16447),h=a(11540),T=a(8181),g=a(5282),m=a(43818),S=a(38052),f=a(46640),x=a(12973),A=a(73072),O=a(46621),C=a(51135),y=a(34286),E=a(36309),_=a(22600),I=a(10264),R=a(50281),v=a(19648);a(60380);var N=a(86989),L=a(21323),b=a(34835),j=a(51532),G=a(80782),w=a(9110),D=a(15687),P=a(80483),F=a(88852),M=a(85470),U=a(21834),k=a(96415),W=a(20103),B=a(90741),H=a(33883),J=a(45216),Y=a(89638),K=a(15182),$=a(57643),V=a(29881);a(41585);var z=a(51715),X=a(66518),q=a(92977),Q=a(69339),Z=a(1463);let ee=e=>
2{let[t,a]=c().useState({showModal:!1,loading:!!e.leadEmail,selectedTags:[],firstName:"",lastName:"",email:"",phoneNumbers:[],leadId:null,formSubmitted:!1,isUpdate:!1,emailAlreadyExists:!1,hasPendingInvalidPhone:!1}),{mutate:i}=(0,y.E9)(),{mutate:s}=(0,y.b6)();c().useEffect(()=>e.modalOpenerSetter(o),[]);let o=e=>{a(e=>({...e,showModal:!0})),W.oT(e)||l(e)},n=()=>{a(d())},l=async e=>{a(e=>({...e,loading:!0})),q.A.getLeadByEmail(e).then(e=>{e.onSuccess(e=>{a(t=>({...t,firstName:e.firstName,lastName:e.lastName,email:e.email,phoneNumbers:e.phoneNumbers,selectedTags:e.tags,leadId:e.id,loading:!1,isUpdate:!0}))}).onError(()=>{C.A.error("There was an error retrieving the lead")})})},d=()=>({showModal:!1,loading:!1,selectedTags:[],firstName:"",lastName:"",email:"",phoneNumbers:[],leadId:null,formSubmitted:!1,isUpdate:!1,emailAlreadyExists:!1,hasPendingInvalidPhone:!1}),u=async()=>{if(!await h())if(W.B9(t.email)&&!t.hasPendingInvalidPhone){if(t.isUpdate)i({pagination:e.filters.pagination,filters:e.filters.filters,tableSelection:{selected:[t.leadId]},payload:new Q.A({id:t.leadId,firstName:t.firstName,lastName:t.lastName,email:t.email,phoneNumbers:t.phoneNumbers,tags:t.selectedTags})},{onSuccess:()=>a(d())});else{var o;s({pagination:e.filters.pagination,filters:e.filters.filters,payload:new Q.A({id:t.leadId,firstName:t.firstName,lastName:t.lastName,email:null==(o=t.email)?void 0:o.toLowerCase(),phoneNumbers:t.phoneNumbers,tags:t.selectedTags})},{onSuccess:()=>a(d())})}n()}else a(e=>({...e,formSubmitted:!0}))},h=async()=>{try{let e=!(await q.A.getLeadByEmail(t.email)).getContentOrThrowError().hasOwnProperty("errors");return a(t=>({...t,emailAlreadyExists:e})),e}catch(e){return a(e=>({...e,emailAlreadyExists:!0})),console.error("Error when checking for duplicate email:",e),C.A.error("The email you entered is invalid or already in use. Please try again with a different email."),!0}};return(0,r.jsx)($.aF,{id:"add-update-lead-modal",visible:t.showModal,onBackdropClick:n,width:"480px",children:t.loading?(0,r.jsx)("div",{className:"text-center ld-spinner-modal",children:(0,r.jsx)(V.A,{type:1,width:50})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($.rQ,{title:t.isUpdate?"Update lead":"Add new lead",closeModal:n}),(0,r.jsx)($.cw,{children:(0,r.jsxs)("div",{className:"lead-modal-container",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsx)(g.v,{type:"text",name:"First name",width:"100%",placeholder:"Enter first name",value:t.firstName,onChange:e=>a(t=>({...t,firstName:e})),label:"First name",autocomplete:!1,dataTest:"modalFirstName"})}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsx)(g.v,{type:"text",name:"Last name",width:"100%",placeholder:"Enter last name",value:t.lastName,onChange:e=>a(t=>({...t,lastName:e})),label:"Last name",autocomplete:!1,dataTest:"modalLastName"})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-md-12",children:(0,r.jsx)(g.v,{type:"email",name:"Email address",width:"100%",placeholder:"Enter email address",value:t.email,onChange:e=>a(t=>({...t,email:e,emailAlreadyExists:!1})),onBlur:h,invalid:!(!t.formSubmitted||W.B9(t.email))||t.emailAlreadyExists,errorMessage:t.emailAlreadyExists?"Email already exists":"Enter a valid email",label:"Email address",autocomplete:!1,dataTest:"modalEmail"})})}),(0,r.jsx)(z.A,{numbers:t.phoneNumbers,onAdd:e=>a(t=>({...t,phoneNumbers:t.phoneNumbers.concat([e])})),handleDelete:e=>a(t=>({...t,phoneNumbers:t.phoneNumbers.filter(t=>t!==e)})),validate:t.formSubmitted,onHasPendingInvalidNumber:e=>a(t=>({...t,hasPendingInvalidPhone:e})),dataTest:"modalPhoneNumber"}),(0,r.jsx)(X.A,{addTagLabel:"Add tag",className:"h-tag-inactive-action",label:"Selected tags",type:0,selected:t.selectedTags,onRemove:e=>a(t=>({...t,selectedTags:t.selectedTags.filter(t=>t.name!=e)})),onSelect:e=>a(t=>({...t,selectedTags:t.selectedTags.concat([e])})),allowNewTag:!0,relative:!0,dataTest:"modalAddTag",doNotShowTags:[Z.R.SUBSCRIPTION]})]})}),(0,r.jsxs)($.jl,{children:[(0,r.jsx)(p.A,{type:"secondary",onClick:n,text:"Close",dataTest:"modalClose"}),(0,r.jsx)(p.A,{type:"primary",onClick:u,text:t.isUpdate?"Update lead":"Save new lead",dataTest:"modalSave",locked:!W.B9(t.email)||t.emailAlreadyExists||t.hasPendingInvalidPhone})]})]})})};var et=a(932),ea=a(75519),ei=a(63627),es=a(74961),eo=a(26263),er=a(67106),en=a(21055),el=a(38923),ed=a(70165),ec=a(24190),eu=a(80323),ep=a(44479),eh=a(31940),eT=a(93975),eg=a(93355),em=a(63223),eS=a(97488),ef=a(84764),ex=a(28674);a(36247);var eA=a(63901);let eO=e=>{var t;return(0,r.jsx)(K.A,{name:S.a.SALES_DATA_LEADS_EXPORT,children:(0,r.jsx)(eo.A,{show:e.showCompleteInfo,onClick:()=>e.setModal(0),locked:(null==(t=e.leadPage.items)?void 0:t.length)<1||e.isDeepMode&&e.countSelectedLeads()>1e5,type:"secondary",accessAction:"READ",iconColor:x.J.WIDGET_PRIMARY,style:{color:x.J.WIDGET_PRIMARY},iconType:A.AT.EXPORT,tooltipText:e.isDeepMode&&e.countSelectedLeads()>1e5?`There are ${e.countSelectedLeads()} leads selected, the limit is 100000`:"",children:"Export leads as CSV"})})};var eC=a(55750),ey=a(99303),eE=((i={})[i.EXPORT_ALL=0]="EXPORT_ALL",i[i.IMPORT_SALES=1]="IMPORT_SALES",i[i.ADD_LEAD=2]="ADD_LEAD",i[i.EDIT_LEAD=3]="EDIT_LEAD",i[i.DELETE_LEAD=4]="DELETE_LEAD",i[i.REPROCESS_LEADS=5]="REPROCESS_LEADS",i);class e_ extends f.Mk{getAsQueryParams(){let e=["listTags","notListTags","listProducts","notListProducts","subscriptionTags"],t=["trafficSourceCategoryIds","sourceCategoryIds","goals","firstClickedSourcesIds"],a=Object.entries(this).map(a=>"startDate"===a[0]||"endDate"===a[0]?`${a[0]}=${this.getFormattedDate(a[0])}`:e.includes(a[0])?`${a[0]}=${this.sanitizeTags(a[1].map(e=>e.name))}`:t.includes(a[0])?`${a[0]}=${this.sanitizeTags(a[1].map(e=>e.id.toString()))}`:"subscriptionTagsPrefix"===a[0]?`${a[0]}=${this.sanitizeTags(a[1].map(e=>e.name),!0)}`:"listTagsPrefix"===a[0]?`${a[0]}=${this.sanitizeTags(a[1].map(e=>e.name.substring(1)))}`:a[0].toLowerCase().includes("prefix")?`${a[0]}=${this.sanitizeTags(a[1].map(e=>e.name))}`:a[0].toLowerCase().includes("substring")?`${a[0]}=${this.sanitizeTags(a[1].map(e=>e.name.substring(1)))}`:"stageIds"===a[0]||"notSearchTagType"===a[0]?`${a[0]}=${this.sanitizeTags(this.getStageIdsList())}`:"sourceTags"===a[0]?`${a[0]}=${a[1].map(e=>e.tag).join(",")}`:"stages"===a[0]?`stageIds=${a[1].map(e=>e.id)}`:`${a[0]}=${a[1]}`).join("&");return 0===a.length?"":`${a}`}getStageIdsList(){return this.stages.map(e=>e.id.toString())}getFormattedDate(e){return"startDate"===e?this.startDate.format("DD-MM-yyyy"):"endDate"===e?this.endDate.format("DD-MM-yyyy"):""}constructor({startDate:e=(null==(s=O.x0.getState().session.top)?void 0:s.demoModeEnabled)?F.A.getDemoModeDate():F.A.getUserCreationDateAsMoment(),endDate:t=l()(F.A.getUserTimeZoneDay()),newLead:a=!1,originLead:i=!1,onlyNoSourceLeads:r=!1,textInput:n="",listTags:d=[],listTagsPrefix:c=[],listTagsSubstring:u=[],notListTags:p=[],tagSearchType:h="ANY_OF_THEM",notTagSearchType:T="NO_ANY_OF_THEM",productSearchType:g="ANY_OF_THEM",notProductSearchType:m="NO_ANY_OF_THEM",productCategorySearchType:S="ANY_OF_THEM",sourceLinkSearchType:f="ANY_OF_THEM",subscriptionSearchType:x="ANY_OF_THEM",stages:A=[],leadStageId:C=null,listProducts:y=[],productTagsPrefix:E=[],productTagsSubstring:_=[],notListProducts:I=[],sourceTags:R=[],sourceTagsPrefix:v=[],sourceTagsSub
2string:N=[],subscriptionTags:L=[],subscriptionTagsPrefix:b=[],subscriptionTagsSubstring:j=[],trafficSourceCategoryIds:G=[],sourceCategoryIds:w=[],goals:D=[],interGroupSearchType:P="ANY_OF_THEM",firstClickedSourcesIds:M=[],firstClickedSourcesPrefix:U=[],firstClickedSourcesSubstring:k=[]}){super(),(0,o._)(this,"startDate",void 0),(0,o._)(this,"endDate",void 0),(0,o._)(this,"newLead",void 0),(0,o._)(this,"originLead",void 0),(0,o._)(this,"onlyNoSourceLeads",void 0),(0,o._)(this,"textInput",void 0),(0,o._)(this,"listTags",void 0),(0,o._)(this,"notListTags",void 0),(0,o._)(this,"tagSearchType",void 0),(0,o._)(this,"notTagSearchType",void 0),(0,o._)(this,"productSearchType",void 0),(0,o._)(this,"notProductSearchType",void 0),(0,o._)(this,"productCategorySearchType",void 0),(0,o._)(this,"sourceLinkSearchType",void 0),(0,o._)(this,"subscriptionSearchType",void 0),(0,o._)(this,"listTagsPrefix",void 0),(0,o._)(this,"listTagsSubstring",void 0),(0,o._)(this,"stages",void 0),(0,o._)(this,"leadStageId",void 0),(0,o._)(this,"listProducts",void 0),(0,o._)(this,"productTagsPrefix",void 0),(0,o._)(this,"productTagsSubstring",void 0),(0,o._)(this,"notListProducts",void 0),(0,o._)(this,"sourceTags",void 0),(0,o._)(this,"sourceTagsPrefix",void 0),(0,o._)(this,"sourceTagsSubstring",void 0),(0,o._)(this,"subscriptionTags",void 0),(0,o._)(this,"subscriptionTagsPrefix",void 0),(0,o._)(this,"subscriptionTagsSubstring",void 0),(0,o._)(this,"trafficSourceCategoryIds",void 0),(0,o._)(this,"sourceCategoryIds",void 0),(0,o._)(this,"goals",void 0),(0,o._)(this,"interGroupSearchType",void 0),(0,o._)(this,"firstClickedSourcesIds",void 0),(0,o._)(this,"firstClickedSourcesPrefix",void 0),(0,o._)(this,"firstClickedSourcesSubstring",void 0),this.startDate=e,this.endDate=t,this.newLead=a,this.originLead=i,this.onlyNoSourceLeads=r,this.textInput=n,this.listTags=d,this.notListTags=p,this.tagSearchType=h,this.notTagSearchType=T,this.productSearchType=g,this.notProductSearchType=m,this.productCategorySearchType=S,this.sourceLinkSearchType=f,this.subscriptionSearchType=x,this.listTagsPrefix=c,this.listTagsSubstring=u,this.stages=A,this.leadStageId=C,this.listProducts=y,this.productTagsPrefix=E,this.productTagsSubstring=_,this.notListProducts=I,this.sourceTags=R,this.sourceTagsPrefix=v,this.sourceTagsSubstring=N,this.subscriptionTags=L,this.subscriptionTagsPrefix=b,this.subscriptionTagsSubstring=j,this.trafficSourceCategoryIds=G,this.sourceCategoryIds=w,this.goals=D,this.firstClickedSourcesIds=M,this.firstClickedSourcesPrefix=U,this.firstClickedSourcesSubstring=k,this.interGroupSearchType=P}}let eI=[M.G.SOURCE_LINKS,M.G.LEAD_TAGS,M.G.NOT_LEAD_TAGS,M.G.LEAD_STAGE,M.G.PRODUCT_TAGS,M.G.NO_SALE_ITEM_TAGS,M.G.SUBSCRIPTION_TAGS,M.G.TRAFFIC_SOURCES,M.G.SOURCE_CATEGORIES,M.G.GOALS,M.G.FIRST_CLICKED_SOURCES],eR=new Map([["WEBAPP",{bodyStyles:{},dmTableContainerStyles:{flex:1},showCompleteInfo:U.ZK.get("WEBAPP").showCompleteInfo}],["EXTENSION",{bodyStyles:{flex:1},dmTableContainerStyles:{height:"100%"},showCompleteInfo:U.ZK.get("EXTENSION").showCompleteInfo}]]),ev=e=>{var t;let[a,i]=(0,d.useState)(!0),[s,o]=(0,d.useState)(e.newLead),[n,M]=(0,d.useState)(!1),[U,$]=(0,d.useState)(!1),[V,z]=(0,d.useState)(!1),[X,q]=(0,d.useState)(!1),[Q,Z]=(0,d.useState)(!1),[eE,ev]=(0,d.useState)(null),[eN,eL]=(0,d.useState)(),[eb,ej]=(0,d.useState)(),[eG,ew]=(0,d.useState)(null),[eD,eP]=(0,d.useState)([]),[eF,eM]=(0,d.useState)([]),[eU,ek]=(0,d.useState)(null),[eW]=(0,d.useState)(F.A.getUserTimezone()),eB=c().useRef({}),[eH,eJ]=(0,d.useState)(null==(t=e.leadStages)?void 0:t.map(e=>parseInt(e.values))[0]),{pageSize:eY,storePageSize:eK}=(0,E.Ay)(2),[e$,eV]=(0,d.useState)(new f.dK({pageSize:eY,columnOrder:e.isDeepMode?"creationDate":"joined"})),[ez,eX]=(0,d.useState)(new e_({})),[eq,eQ]=(0,d.useState)(!1),[eZ,e0]=(0,d.useState)(new e_({leadStageId:eH,newLead:s})),[e1,e2]=(0,d.useState)(!1),[e3,e5]=(0,d.useState)(!1),{data:e4,isLoading:e8,refetch:e6,isPlaceholderData:e9,error:e7}=(0,y.bc)({pagination:e$,filters:eZ},e,e.onClose),te=(0,O.D2)(e=>{var t;return null==(t=e.session.top)?void 0:t.user.currency}),[tt,ta]=(0,d.useState)(!1),[ti,ts]=(0,d.useState)(null===e.leadStageId?eH:e.leadStageId),[to,tr]=(0,d.useState)([]),tn="dmtable-leads",tl=(0,H.DP)(),td=(0,d.useMemo)(()=>e4||{count:0,items:[]},[e4]),tc=15>l()().diff(F.A.getUserCreationDateAsMoment(),"days"),{setActions:tu}=(0,u.$)();(0,d.useEffect)(()=>{var t,a,i,s;return tu((0,r.jsxs)(r.Fragment,{children:[!e.isDeepMode&&(0,r.jsx)(eg.s,{onReload:e6,cooldownTime:5e3}),(0,r.jsx)(eO,{showCompleteInfo:th().showCompleteInfo,setModal:ev,leadPage:td,isDeepMode:e.isDeepMode,countSelectedLeads:tC}),!e.sourceLinkId&&!e.allReportLeads&&!ty()&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eo.A,{iconType:A.AT.IMPORT,type:"secondary",accessAction:"WRITE",iconColor:x.J.WIDGET_PRIMARY,style:{color:x.J.WIDGET_PRIMARY},locked:null==(t=O.x0.getState().session.top)?void 0:t.demoModeEnabled,tooltipText:(null==(a=O.x0.getState().session.top)?void 0:a.demoModeEnabled)?"You cannot import leads during Live Demo":"",onClick:()=>e2(!0),children:"Import leads"}),tc&&(0,r.jsx)(eo.A,{iconType:A.AT.IMPORT,type:"primary",accessAction:"WRITE",locked:null==(i=O.x0.getState().session.top)?void 0:i.demoModeEnabled,tooltipText:(null==(s=O.x0.getState().session.top)?void 0:s.demoModeEnabled)?"You cannot import leads during Live Demo":"",onClick:()=>e5(!0),children:"Lightweight import"})]})]})),()=>tu(null)},[e6,td,e.isDeepMode,e.sourceLinkId,e.allReportLeads,eD]),(0,d.useEffect)(()=>{eX(e=>new e_({...e,originLead:n}))},[n]),(0,d.useEffect)(()=>{eX(e=>new e_({...e,onlyNoSourceLeads:U}))},[U]),(0,d.useEffect)(()=>{eX(e=>new e_({...e,newLead:s}))},[s]),(0,d.useEffect)(()=>{(async()=>{let e=await D.A.getProperty("PROCESS_FIRST_VISIT_CLICK"),t=["Joined on","Last Source Date","Lead","Name","First Source","Last Source","Income","Status","Ad O.C.","Stage","Delete"];e&&t.push("Tracked URL","Previous URL"),tr(t)})()},[]),(0,d.useEffect)(()=>{!e4||e8||0!==e4.count||e.externalSession||C.A.info("You have no leads to display")},[null==e4?void 0:e4.count,e8,e.externalSession]),(0,d.useEffect)(()=>
2{if(e7)if(e7.message===G.gI)throw new G.Mt;else console.log("Error retrieving leads info "+e7)},[e7]),(0,d.useEffect)(()=>{var e,t,a,i;let s=B.A.getUserPreferenceByName(tn);if(!s)return;let o=s.value;(null==(e=o.hiddenColumns)?void 0:e.includes("Tracked URL"))&&(null==(t=o.hiddenColumns)?void 0:t.includes("Previous URL"))||(null==(a=o.columnOrder)?void 0:a.includes("Tracked URL"))&&(null==(i=o.columnOrder)?void 0:i.includes("Previous URL"))||(o.hiddenColumns.push("Tracked URL"),o.hiddenColumns.push("Previous URL"),B.A.setOrUpdateUserPreference(s))},[]);let tp=e=>{let t=I.A[e.pendingConversionInfo];return e.pendingConversionInfo&&void 0===t?{...I.A[_.M.DEFAULT_ERROR],message:e.pendingConversionInfo}:t||I.A[_.M.NO_INFO]},th=()=>eR.get(e.origin??"WEBAPP"),tT=["Creation Date","Referrer Url","Joined on","Last Source Date","Lead","Name","First Source","Last Source","Status"],tg=[{Header:"Creation Date",accessor:e=>{var t;return(0,r.jsx)(en.P,{dateToFormat:l()(null==(t=e.creationDate)?void 0:t.valueOf())})},stickyColumn:!0},{Header:"Referrer Url",accessor:e=>(0,r.jsxs)("div",{className:"lead-detail-collapsed-view-item w-100",children:[(0,r.jsx)(h.Q,{type:A.AT.TRACKING,stroke:x.J.TABLE_TITLES}),(0,r.jsx)(eh.D,{name:`-${e.referrerUrl||"No data available"}`,nameFormatter:()=>e.referrerUrl||"No data available",style:{maxWidth:"100%",margin:"0px",overflowY:"hidden"},copyable:!0,preventPropagation:!0})]}),stickyColumn:!1},{Header:"Joined on",accessor:e=>(0,r.jsx)(en.P,{dateToFormat:l()(e.joinDate.valueOf())}),stickyColumn:!0},{Header:"Last Source Date",accessor:e=>(0,r.jsx)(en.P,{dateToFormat:e.lastSourceDate}),stickyColumn:!0},{Header:"Lead",accessor:e=>(0,r.jsx)(T.A,{placement:"bottom",textTooltip:"Open customer details",children:(0,r.jsxs)("div",{className:"text-ellipsis",onClick:()=>eN(e.email),style:{display:"flex",cursor:"pointer"},"data-test":"openLeadDetails",children:[(0,r.jsx)(h.Q,{type:A.AT.CUSTOMER,style:{marginRight:8,minWidth:16}}),(0,r.jsx)("div",{className:"text-ellipsis",children:(0,P.ks)(e.email)})]})}),stickyColumn:!0},{Header:"Name",accessor:e=>(0,r.jsx)("div",{className:"text-ellipsis",children:(0,P.ks)(e.name)})},{Header:"First Source",accessor:e=>e.firstSourceName?(0,r.jsx)("div",{className:"text-ellipsis",children:(0,P.ks)(e.firstSourceName)}):"-"},{Header:"Last Source",accessor:e=>e.lastSourceName?(0,r.jsx)("div",{className:"text-ellipsis",children:(0,P.ks)(e.lastSourceName)}):"-"},{Header:"Income",accessor:e=>(0,r.jsx)("div",{className:`${e.incomeGenerated?"normal":"call"}-sale`,children:W.qC(e.incomeGenerated,te||"$","",`${te||"$"}0.00`)})},{Header:"Status",disableSortBy:!0,accessor:e=>(0,r.jsxs)("div",{style:{display:"flex"},children:[(0,r.jsx)(T.A,{placement:"bottom",textTooltip:tp(e).message,children:(0,r.jsx)("div",{children:(0,r.jsx)(h.Q,{type:tp(e).iconType,stroke:x.J.TABLE_TITLES,style:{marginRight:8,minWidth:16,marginTop:"1px"}})})}),tp(e).state]})},{Header:"Ad O.C.",disableSortBy:!0,accessor:e=>(0,r.jsx)("div",{style:{display:"flex"},children:e.adOptimizationConsent})},{Header:"Stage",disableSortBy:!0,accessor:e=>(0,r.jsx)("div",{style:{display:"flex"},children:e.lastStage||"-"})},{Header:"Tracked URL",disableSortBy:!0,accessor:e=>(0,r.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,r.jsx)(el.A,{textTooltip:"Not available for this lead. These fields may only be present on leads created after July-2025",alwaysVisible:!0}),e.trackedUrl||"-"]})},{Header:"Previous URL",disableSortBy:!0,accessor:e=>(0,r.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,r.jsx)(el.A,{textTooltip:"Not available for this lead. These fields may only be present on leads created after July-2025",alwaysVisible:!0}),e.previousUrl||"-"]})},{Header:"Delete",accessor:e=>(0,r.jsx)(p.A,{type:"icon",iconWidth:16,iconType:A.AT.DELETE,dataTest:"deleteLead",onClick:()=>{e.id?(ew(e.id),ev(4)):C.A.warning("You can't do actions on this recently added Lead yet, try again in some minutes")}}),disableSortBy:!0}].filter(e=>{var t;return th().showCompleteInfo&&!(null==(t=O.x0.getState().session.top)?void 0:t.demoModeEnabled)||!["Edit","Delete"].includes(e.Header)}).filter(t=>e.isDeepMode?tT.includes(t.Header):to.includes(t.Header)).map(t=>e.isDeepMode?{...t,disableSortBy:!["Creation Date"].includes(t.Header),stickyColumn:["Creation Date"].includes(t.Header)}:t),tm=function(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0],a=e.isLeadOptInDeepMode?"opt-in":e.newLead?"new lead":"lead";return t?a+"s":a},tS=()=>{tt||(eV(e=>new f.dK({...e,page:0})),e0(ez),ts(eH))},tf=()=>{if(td.count>0&&!td.showLeadStages){let e=JSON.parse(localStorage.getItem(tn)),t=e&&e.hiddenColumns?e.hiddenColumns:["Stage"];localStorage.setItem(tn,JSON.stringify(Object.assign(e??{},{hiddenColumns:t})))}return tg},tx=(t,a,i)=>{eK(a);let s="DESC",o=e.isDeepMode?"creationDate":"joined";if(i&&i.length>0){var r,n;o=(null==(r=({"Creation Date":"creationDate","Joined on":"joined","Last Source Date":"lastSourceDate",Lead:"email",Name:"name",Income:"incomed","First Source":"firstSourceLinkName","Last Source":"lastSourceLinkName"})[null==(n=i[0])?void 0:n.id])?void 0:r.toString())||(e.isDeepMode?"creationDate":"joined"),s=i[0].desc?"DESC":"ASC"}eV(e=>
2new f.dK({...e,page:t,pageSize:a,columnOrder:o,sortOrder:s}))},tA=()=>{e.reportConfiguration.financialStatsType===N.je.LINEAR_FRACTIONAL&&(e.reportConfiguration.financialStatsType=N.je.MULTI_TOUCH)};function tO(e){let t=new URLSearchParams(e),a={},i=new Set(["tagSearchType","notTagSearchType","productSearchType","productCategorySearchType"]),s=new Set(["leadStageId"]),o=new Set(["stageIds","trafficSourceCategoryIds","sourceCategoryIds","goals","firstClickedSourcesIds"]);for(let[e,i]of t.entries())a[e]||(a[e]=[]),a[e].push(i);let r={};for(let e of Object.keys(a)){let t=a[e].filter(e=>""!==e);if(0!==t.length)if(i.has(e))r[e]=t[0];else if(s.has(e)){let a=Number(t[0]);isNaN(a)||0===a||(r[e]=a)}else if(o.has(e)){let a=t[0].split(",").map(e=>Number(e)).filter(e=>!isNaN(e)&&0!==e);a.length>0&&(r[e]=a)}else t.length>0&&(r[e]=t)}return r}let tC=()=>0===eD.length?td.count||0:eB.current.allSelected?(td.count||0)-eD.length:eD.length,ty=()=>{var t;return(null==(t=e.reportConfiguration)?void 0:t.financialStatsType)===N.je.GEO_LOCATION},tE=()=>{var t;return!(null==(t=e.reportConfiguration)?void 0:t.geoLocationRowName)&&!e.sourceLinkId&&!e.allReportLeads&&!e.isLeadStages},t_=()=>{var t,a;return(null==(t=e.reportConfiguration)?void 0:t.geoLocationRowName)?" - "+(null==(a=e.reportConfiguration)?void 0:a.geoLocationRowName):""},tI=()=>{var t,a,i;return(null==(t=e.sourceboardData)?void 0:t.name)==="facebook"?"meta":(null==(a=e.sourceboardData)?void 0:a.name)==="twitter"?"X":null==(i=e.sourceboardData)?void 0:i.name};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{children:(e.onClose||"EXTENSION"===e.origin)&&(0,r.jsx)(eu.p,{style:{minHeight:"EXTENSION"===e.origin?"80px":null},title:(()=>{if(void 0!==e.leadStageId){let t=e.allReportLeads&&null===e.leadStageId,a=e.leadStages.find(e=>parseInt(e.values)===ti),i=t?"":"- "+tI();return`${null==a?void 0:a.name} ${i}`}if(void 0!==e.rowType&&["NO_SOURCE","DIRECT_TRAFFIC"].includes(e.rowType)){let t=`Leads Details - ${(0,W.aL)((0,W.P_)(e.rowType).toLowerCase())}`;return e.allReportLeads?t:t+t_()}{let t={[b._1.NEW_LEADS]:"New Leads Details",[b._1.LEADS_OPTINS]:"Leads Optins Details",[b._1.LEADS]:"Leads Details"}[e.columnOriginType]??"Leads Details";if(e.allReportLeads)return t;let a=t_();if(a)return t+a;let i=tI();return i?`${t} - ${(0,W.Sm)(i,50)}`:t}})(),backTo:{title:"Back to report",onClick:e.onClose,hide:!e.onClose},children:!tE()&&eA.A.getUserRoles().includes("LEADS_EXPORT")&&(0,r.jsx)(eO,{showCompleteInfo:th().showCompleteInfo,setModal:ev,leadPage:td,isDeepMode:e.isDeepMode,countSelectedLeads:tC})})}),(0,r.jsxs)("div",{style:{display:"flex",height:`${tE()?"100%":"calc(100% - 80px)"}`},children:[!e.isDeepMode&&(0,r.jsxs)(ef.A,{collapsed:a,setCollapsed:i,changesMade:Q,applyFilters:tS,clearFilters:()=>{eX(new e_({})),Z(!1),eQ(!0)},children:[!e.isLeadStages&&(0,r.jsx)(em.Ay,{containerStyle:{marginBottom:"16px",width:"100%"},filters:ez,setFilters:eX,showAttributesSummary:!0,attributeGroups:eI,setChangesMade:Z,filterCleared:eq,setFilterCleared:eQ}),(0,r.jsxs)(eS.A,{title:"Secondary Filters",children:[(0,r.jsx)(ei.a,{label:"Parent Leads",layout:"horizontal",style:{margin:0},children:(0,r.jsx)(eT.A,{active:n,textTooltip:"Filter by leads that have child leads",onClick:()=>M(e=>!e)})}),(0,r.jsx)(ei.a,{label:"Leads without sources",layout:"horizontal",style:{margin:0},children:(0,r.jsx)(eT.A,{active:U,textTooltip:"Filter by leads that does not have sources",onClick:()=>$(e=>!e)})}),e.allReportLeads&&!e.sourceLinkId&&void 0===e.leadStageId&&(0,r.jsx)(ei.a,{style:{marginTop:"0.5em"},label:"Filter new leads",layout:"horizontal",show:!0,children:(0,r.jsx)(eT.A,{active:s,onClick:()=>o(e=>!e)})}),null===e.leadStageId&&(0,r.jsx)(ei.a,{style:{marginTop:"0.5em"},label:"",layout:"horizontal",show:!0,children:(0,r.jsx)(ep.P,{elements:e.leadStages.map(e=>({value:parseInt(e.values),label:e.name.replace("Stage: ","")})),onSelected:e=>{eX(t=>new e_({...t,leadStageId:e})),eJ(e)},selectedElement:eH,width:"100%",height:"32px",label:"Stage"})})]})]}),(0,r.jsxs)("div",{className:"sales-page-content",style:{width:`calc(100% - ${a?"0px":"360px"})`}
2,children:[(0,r.jsx)(es.A,{dataExportId:eU,onUpdate:()=>z(!V)}),(0,r.jsxs)("div",{className:"sales-table-card",children:[(0,r.jsxs)("div",{className:"sales-table-tab-bar",children:[(0,r.jsx)("div",{style:{marginLeft:4,display:"flex",alignItems:"center"},children:(()=>{let t=`${W.ZH(tm())} total`;if(void 0!==e.leadStageId){let a=e.leadStages.find(e=>parseInt(e.values)===ti);t=null==a?void 0:a.name.replace("Stage: ","")}return[{iconType:A.AT.CUSTOMERS,label:t,value:td.count||0}]})().map((e,t)=>(0,r.jsx)(ed.C,{colorIcon:"white"===tl?x.J.BLACK:void 0,iconType:e.iconType,tooltipText:e.label,dataTest:"leadsCount",showsTableCount:!0,marginLeft:0===t?4:24,children:e.value},e.label))}),(0,r.jsxs)("div",{className:"sales-table-tab-actions",children:[(tE()||e.isLeadStages)&&"EXTENSION"!==e.origin&&(0,r.jsx)(p.A,{type:"icon-fill",iconType:A.AT.FILTERS,iconColor:x.J.SIDEBAR_ITEM,iconWidth:16,onClick:()=>i(e=>!e),tooltipText:"Filters"}),tE()&&(X?(0,r.jsx)(g.v,{placeholder:"Name, email, IP address, source",icon:A.AT.SEARCH,width:240,value:ez.textInput,dataTest:"searchLead",onChange:e=>{var t;""===e&&(eX(t=>new e_({...t,textInput:e})),e6()),eX(t=>new e_({...t,textInput:(0,W.pK)(e)})),ta((t=(0,W.pK)(e))?t.split(" ").length>5:ez.textInput.split(" ").length>5)},onEnter:()=>{tS()},onBlur:()=>{ez.textInput||q(!1)},autoFocus:!0,modernLook:!0,inputStyle:{backgroundColor:x.J.COLORED_INPUT},invalid:tt,errorMessage:"Only 5 terms are allowed"}):(0,r.jsx)(p.A,{type:"icon-fill",iconType:A.AT.SEARCH,iconColor:x.J.SIDEBAR_ITEM,iconWidth:16,onClick:()=>q(!0),tooltipText:"Search"})),!e.isDeepMode&&!["NO_SOURCE","DIRECT_TRAFFIC"].includes(e.rowType)&&(0,r.jsx)(K.A,{name:S.a.SALES_DATA_LEADS_ADD,children:(0,r.jsx)(eo.A,{onClick:()=>eb(),type:"primary",iconType:A.AT.PLUS,accessAction:"WRITE",dataTest:"addLead",children:"Add lead"})}),(0,r.jsx)(er._,{tableRef:eB,buttonType:"icon",iconType:A.AT.CONFIGURE_2,iconWidth:16,tooltipPlacement:"bottom"})]})]}),(0,r.jsx)(ec.N,{flex:"EXTENSION"!==e.origin,style:{flex:1,minHeight:0,height:"unset"},children:(0,r.jsx)("div",{style:{overflow:"hidden",...th().dmTableContainerStyles},children:e.isDeepMode?(0,r.jsx)(ey.A,{id:tn,tableRef:eB,data:td.items,columns:tf(),showIDColumn:!e.isDeepMode,designType:"HIGHLIGHT",groupSalesBy:v.W.NONE,onEmailSelect:e=>eN(e),countLeads:td.count||0,pagination:e$,filters:eZ,getSalesForGroupId:e=>new Promise(e=>e([])),totalCount:td.count,autoHidePaginator:!1,fetchPage:tx,onRowSelect:eP,onRowOptInSelect:eM,isLoading:e8||e9,controlledPageIndex:e$.page,maxResultSize:1e4,onDMActionSelected:e.onDMActionSelected,origin:e.origin,isLeadOptInDeepMode:e.isLeadOptInDeepMode,type:"dmtable-leads",noResultsData:{subText:(0,r.jsxs)(ex.GW,{children:["You don't have any Leads Data."," ",(0,r.jsx)("span",{style:{color:"var(--col-accents)",textDecoration:"underline",cursor:"pointer"},onClick:()=>eb(),children:"Click here"})," "," to create your first lead"]})}}):(0,r.jsx)(eC.A,{id:tn,tableRef:eB,data:td.items,columns:tf(),showIDColumn:!0,designType:"CLASSIC",groupSalesBy:v.W.NONE,onEmailSelect:e=>eN(e),countLeads:td.count||0,pagination:e$,filters:eZ,getSalesForGroupId:e=>new Promise(e=>e([])),totalCount:td.count,autoHidePaginator:!1,fetchPage:tx,onRowSelect:eP,onRowOptInSelect:eM,isLoading:e8||e9,controlledPageIndex:e$.page,maxResultSize:1e4,onDMActionSelected:e.onDMActionSelected,origin:e.origin,type:"dmtable-leads",noResultsData:{subText:(0,r.jsxs)(ex.GW,{children:["You don't have any Leads Data."," ",(0,r.jsx)("span",{style:{color:"var(--col-accents)",textDecoration:"underline",cursor:"pointer"},onClick:()=>eb(),children:"Click here"})," "," to create your first lead"]})}})})})]})]})]}),th().showCompleteInfo&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Y.A,{action:"DELETE",show:4===eE,onClose:()=>ev(null),pagination:e$,tableSelection:new f.D2({selected:eG?[eG]:[]}),filters:eZ,type:"dmtable-leads",allowPermanentDeletion:!0}),(0,r.jsx)(Y.A,{action:"REPROCESS_LEADS",show:5===eE,onClose:()=>ev(null),pagination:e$,tableSelection:new f.D2({selected:eG?[eG]:[]}),type:"dmtable-leads"}),(0,r.jsx)(J.m,{show:0===eE,onCancel:()=>ev(null),onConfirm:e.allReportLeads?()=>{let t=k.e(ez,e$,eW),a=e.allReportLeads&&null===e.leadStageId?eZ.leadStageId:e.leadStageId,i={broadcastSearchData:{"@type":"broadcast-lead-search",searchType:ez.tagSearchType},definition:t,exportType:e.isDeepMode&&!e.isLeadStages?"DEEP_MODE_OPTINS":"REGULAR",reportConfiguration:e.reportConfiguration.parseResponse(!0),deepModeLeadRequest:{customSourceType:e.rowType},newLead:s,filters:tO(ez.getAsQueryParams()),leadIds:eD};tA(),[N.je.GEO_LOCATION].includes(e.reportConfiguration.financialStatsType)&&(i.reportConfiguration.geoLocationRowName=null),void 0!==a&&(i.deepModeLeadRequest.leadStageId=a),w.A.exportLeads(i).then(e=>{ek(e.id),ev(null)})}:()=>{var t,a,i;let s=eB.current.allSelected&&eD.length>0,o=k.e(ez,e$,eW),r=e.allReportLeads&&null===e.leadStageId?eZ.leadStageId:e.leadStageId,n={broadcastSearchData:{"@type":"broadcast-lead-search",searchType:ez.tagSearchType},definition:o,exportType:e.isDeepMode&&!e.isLeadStages?"DEEP_MODE_OPTINS":"REGULAR",leadIds:s?[]:eD,optInIds:eF||[],excludeLeadIds:s?eD:[],sourceLinkId:e.sourceLinkId,trafficSourceId:e.trafficSourceId,sourceCategoryId:e.sourceCategoryId,goalCategoryId:e.goalCategoryId,customerId:e.accountId,reportConfiguration:e.reportConfiguration?L.A.cloneConfig(e.reportConfiguration):e.reportConfiguration,deepModeLeadRequest:{customSourceType:e.rowType},newLead:e.newLead,filters:tO(ez.getAsQueryParams())};if((null==(t=e.reportConfiguration)?void 0:t.isSourceLinkAdRequest)&&(n.deepModeLeadRequest.attributionLevel=m.c.SOURCE_LINK_AD),void 0!==r&&(n.deepModeLeadRequest.leadStageId=r),(null==n||null==(a=n.reportConfiguration)?void 0:a.start)&&(null==n||null==(i=n.reportConfiguration)?void 0:i.end)&&(n.reportConfiguration.start=l()(F.A.addLocalTimeOffset(n.reportConfiguration.start.toDate())),n.reportConfiguration.end=l()(F.A.addLocalTimeOffset(n.reportConfiguration.end.toDate()))),null==e.reportConfiguration)w.A.exportLeads(n).then(e=>{ek(e.id),ev(null)});else if([N.je.TRENDS,N.je.COHORT].includes(e.reportConfiguration.financialStatsType)){let t=new R.A(e.reportConfiguration,e.sourceboardData);t.setNewLead(e.newLead),n.deepSourceBoardRequest=t.parseResponse(),n.deepSourceBoardRequest.customSourceType=e.rowType,j.A.leadSegmentExport(n).then(e=>{ek(e.id),ev(null)})}else n.reportConfiguration=e.reportConfiguration.parseResponse(!0),n.keywordId=e.keywordId,tA(),w.A.exportLeads(n).then(e=>{ek(e.id),ev(null)})},title:`${W.ZH(tm())} export`,message:`You will export ${tC()} ${tm(tC()>1)}`,confirmText:`Export ${tm()}`}),(0,r.jsx)(ee,{modalOpenerSetter:e=>ej(()=>e),filters:{pagination:e$,filters:eZ}})]}),(0,r.jsx)(ea.A,{filters:{pagination:e$,filters:eZ},externalSession:e.externalSession,modalOpenerSetter:e=>eL(()=>e),modalId:"sales-data-lead-info",width:"EXTENSION"===e.origin?"80%":"65%"}),!e.sourceLinkId&&(0,r.jsx)(et.A,{showModal:e1,closeModal:()=>e2(!1)}),!e.sourceLinkId&&tc&&(0,r.jsx)(et.A,{lightweight:!0,showModal:e3,closeModal:()=>e5(!1)})]})}},60068(e,t,a){a.d(t,{A:()=>u});var i,s=a(18990),o=a(99420),r=a.n(o),n=a(46640),l=a(46621),d=a(88852),c=a(67953);class u extends n.Mk{getAsQueryParams(){let e=["namePrefixes","nameSubstrings","adNamePrefixes","adNameSubstrings","sourceTagsExact","listTags","listTagsPrefix","listTagsSubstring","notListTags","listProducts","productTagsPrefix","productTagsSubstring","notListProducts","subscriptionTags","firstClickedSourcesSubstring","firstClickedSourcesPrefix"],t=["sourceLinkIds","productCategoryIds","externalIntegrationIds","stages","firstClickedSourcesIds"],a=["salesPriceFilter","notSalesPriceFilter"],i=Object.entries(this).map(i=>"startDate"===i[0]||"endDate"===i[0]?`${i[0]}=${this.getFormattedDate(i[0])}`:e.includes(i[0])?`${i[0]}=${this.sanitizeTags(this.returnObjectName(i[1]))}`:t.includes(i[0])?`${i[0]}=${this.sanitizeTags(i[1].map(e=>e.id.toString()))}`:a.includes(i[0])?`${i[0]}=${btoa(JSON.stringify(i[1]))}`:"textInput"===i[0]?`${i[0]}=${encodeURIComponent(i[1])}`:`${i[0]}=${i[1]}
2`).filter(Boolean).join("&");return 0===i.length?"":`${i}`}getParams(){return{...this,startDate:this.startDate.format("DD-MM-yyyy"),endDate:this.endDate.format("DD-MM-yyyy")}}getFormattedDate(e){return"startDate"===e?this.startDate.format("DD-MM-yyyy"):"endDate"===e?this.endDate.format("DD-MM-yyyy"):""}constructor({startDate:e=(null==(i=l.x0.getState().session.top)?void 0:i.demoModeEnabled)?d.A.getDemoModeDate():d.A.getUserCreationDateAsMoment(),endDate:t=r()(d.A.getUserTimeZoneDay()),textInput:a="",sourceLinkIds:o=[],namePrefixes:n=[],nameSubstrings:u=[],adNamePrefixes:p=[],adNameSubstrings:h=[],sourceTagsExact:T=[],productCategoryIds:g=[],externalIntegrationIds:m=[],listTags:S=[],listTagsPrefix:f=[],listTagsSubstring:x=[],notListTags:A=[],listProducts:O=[],productTagsPrefix:C=[],productTagsSubstring:y=[],notListProducts:E=[],tagSearchType:_="ANY_OF_THEM",notTagSearchType:I="NO_ANY_OF_THEM",productSearchType:R="ANY_OF_THEM",notProductSearchType:v="NO_ANY_OF_THEM",subscriptionSearchType:N="ANY_OF_THEM",productCategorySearchType:L="ANY_OF_THEM",sourceLinkSearchType:b="ANY_OF_THEM",interGroupSearchType:j="ALL_OF_THEM",callProduct:G=!1,isRecurringSale:w="ALL",groupSales:D=c.A.groupedIntoOrders(0),salesGroupId:P=null,saleRefundState:F="ALL",subscriptionTags:M=[],stages:U=[],firstClickedSourcesIds:k=[],firstClickedSourcesPrefix:W=[],firstClickedSourcesSubstring:B=[],productSkus:H=[],saleStates:J=[],salesPriceFilter:Y=[],notSalesPriceFilter:K=[]}){super(),(0,s._)(this,"startDate",void 0),(0,s._)(this,"endDate",void 0),(0,s._)(this,"textInput",void 0),(0,s._)(this,"sourceLinkIds",void 0),(0,s._)(this,"namePrefixes",void 0),(0,s._)(this,"nameSubstrings",void 0),(0,s._)(this,"adNamePrefixes",void 0),(0,s._)(this,"adNameSubstrings",void 0),(0,s._)(this,"sourceTagsExact",void 0),(0,s._)(this,"productCategoryIds",void 0),(0,s._)(this,"externalIntegrationIds",void 0),(0,s._)(this,"listTags",void 0),(0,s._)(this,"listTagsPrefix",void 0),(0,s._)(this,"listTagsSubstring",void 0),(0,s._)(this,"notListTags",void 0),(0,s._)(this,"listProducts",void 0),(0,s._)(this,"productTagsPrefix",void 0),(0,s._)(this,"productTagsSubstring",void 0),(0,s._)(this,"notListProducts",void 0),(0,s._)(this,"tagSearchType",void 0),(0,s._)(this,"notTagSearchType",void 0),(0,s._)(this,"productSearchType",void 0),(0,s._)(this,"notProductSearchType",void 0),(0,s._)(this,"subscriptionSearchType",void 0),(0,s._)(this,"productCategorySearchType",void 0),(0,s._)(this,"sourceLinkSearchType",void 0),(0,s._)(this,"interGroupSearchType",void 0),(0,s._)(this,"callProduct",void 0),(0,s._)(this,"isRecurringSale",void 0),(0,s._)(this,"groupSales",void 0),(0,s._)(this,"salesGroupId",void 0),(0,s._)(this,"saleRefundState",void 0),(0,s._)(this,"subscriptionTags",void 0),(0,s._)(this,"stages",void 0),(0,s._)(this,"firstClickedSourcesIds",void 0),(0,s._)(this,"firstClickedSourcesPrefix",void 0),(0,s._)(this,"firstClickedSourcesSubstring",void 0),(0,s._)(this,"productSkus",void 0),(0,s._)(this,"saleStates",void 0),(0,s._)(this,"salesPriceFilter",void 0),(0,s._)(this,"notSalesPriceFilter",void 0),(0,s._)(this,"returnObjectName",e=>e.map(e=>e.name)),this.startDate=e,this.endDate=t,this.textInput=a,this.sourceLinkIds=o,this.namePrefixes=n,this.nameSubstrings=u,this.adNamePrefixes=p,this.adNameSubstrings=h,this.sourceTagsExact=T,this.productCategoryIds=g,this.externalIntegrationIds=m,this.listTags=S,this.listTagsPrefix=f,this.listTagsSubstring=x,this.notListTags=A,this.listProducts=O,this.productTagsPrefix=C,this.productTagsSubstring=y,this.notListProducts=E,this.tagSearchType=_,this.notTagSearchType=I,this.productSearchType=R,this.notProductSearchType=v,this.subscriptionSearchType=N,this.productCategorySearchType=L,this.sourceLinkSearchType=b,this.interGroupSearchType=j,this.callProduct=G,this.isRecurringSale=w,this.groupSales=!G&&D,this.salesGroupId=P,this.saleRefundState=F,this.subscriptionTags=M,this.stages=U,this.firstClickedSourcesIds=k,this.firstClickedSourcesPrefix=W,this.firstClickedSourcesSubstring=B,this.productSkus=H,this.saleStates=J,this.salesPriceFilter=Y,this.notSalesPriceFilter=K}}},97488(e,t,a){a.d(t,{A:()=>
2o});var i=a(31085);a(99075);var s=a(28674);let o=e=>{let{children:t,title:a}=e;return(0,i.jsxs)("div",{className:"sales-component-main-filters-wrapper",children:[a&&(0,i.jsx)(s.GW,{type:"h-text-l-semibold",className:"sales-component-main-filters-header",children:a||"Main filters"}),(0,i.jsx)("div",{className:"sales-component-main-filters-options",children:t})]})}},87254(e,t,a){a.d(t,{M:()=>p,bq:()=>d,dj:()=>l,rQ:()=>n});var i=a(85470),s=a(76806),o=a(60068),r=a(17469);let n=[{value:"ALL",name:"All"},{value:"NON_RECURRING_SALE",name:"Non-Recurring"},{value:"IS_RECURRING_SALE",name:"Recurring"}],l=[{value:"ALL",name:"All"},{value:"REFUNDED",name:"Refunded"},{value:"NOT_REFUNDED",name:"Not refunded"}],d=new Map([[i.G.SOURCE_LINKS,"sourceLinkIds"],[i.G.NAME_PREFIXES,"namePrefixes"],[i.G.NAME_SUBSTRINGS,"nameSubstrings"],[i.G.AD_NAME_PREFIXES,"adNamePrefixes"],[i.G.AD_NAME_SUBSTRINGS,"adNameSubstrings"],[i.G.LEAD_TAGS,"listTags"],[i.G.LEAD_TAGS_SUBSTRING,"listTagsSubstring"],[i.G.LEAD_TAGS_PREFIX,"listTagsPrefix"],[i.G.NOT_LEAD_TAGS,"notListTags"],[i.G.PRODUCT_TAGS,"listProducts"],[i.G.PRODUCT_TAGS_PREFIX,"productTagsPrefix"],[i.G.PRODUCT_TAGS_SUBSTRING,"productTagsSubstring"],[i.G.NO_SALE_ITEM_TAGS,"notListProducts"],[i.G.SUBSCRIPTION_TAGS,"subscriptionTags"],[i.G.LEAD_STAGE,"stages"],[i.G.PRODUCT_CATEGORIES,"productCategoryIds"],[i.G.EXTERNAL_INTEGRATIONS,"externalIntegrationIds"],[i.G.FIRST_CLICKED_SOURCES,"firstClickedSourcesIds"],[i.G.FIRST_CLICKED_NAME_PREFIXES,"firstClickedSourcesPrefix"],[i.G.FIRST_CLICKED_NAME_SUBSTRINGS,"firstClickedSourcesSubstring"],[i.G.PRODUCT_SKUS,"productSkus"],[i.G.SALES_PRICE_FILTER,"salesPriceFilter"],[i.G.NOT_SALES_PRICE_FILTER,"notSalesPriceFilter"]]),c=new Map([[i.G.SOURCE_LINKS,"sourceTags"],[i.G.NAME_PREFIXES,"sourceTagsPrefix"],[i.G.NAME_SUBSTRINGS,"sourceTagsSubstring"],[i.G.FIRST_CLICKED_SOURCES,"firstClickedSourcesIds"],[i.G.FIRST_CLICKED_NAME_PREFIXES,"firstClickedSourcesPrefix"],[i.G.FIRST_CLICKED_NAME_SUBSTRINGS,"firstClickedSourcesSubstring"],[i.G.LEAD_TAGS,"listTags"],[i.G.LEAD_TAGS_SUBSTRING,"listTagsSubstring"],[i.G.LEAD_TAGS_PREFIX,"listTagsPrefix"],[i.G.NOT_LEAD_TAGS,"notListTags"],[i.G.SUBSCRIPTION_TAGS,"subscriptionTags"],[i.G.SUBSCRIPTION_TAGS_PREFIX,"subscriptionTagsPrefix"],[i.G.SUBSCRIPTION_TAGS_SUBSTRING,"subscriptionTagsSubstring"],[i.G.PRODUCT_TAGS,"listProducts"],[i.G.PRODUCT_TAGS_PREFIX,"productTagsPrefix"],[i.G.PRODUCT_TAGS_SUBSTRING,"productTagsSubstring"],[i.G.NO_SALE_ITEM_TAGS,"notListProducts"],[i.G.LEAD_STAGE,"stages"],[i.G.TRAFFIC_SOURCES,"trafficSourceCategoryIds"],[i.G.SOURCE_CATEGORIES,"sourceCategoryIds"],[i.G.GOALS,"goals"]]),u=new Map([[i.G.SOURCE_LINKS,"sourceLinkIds"],[i.G.NAME_PREFIXES,"sourceLinkPrefix"],[i.G.NAME_SUBSTRINGS,"sourceLinkSubstring"],[i.G.FIRST_CLICKED_SOURCES,"firstClickedSourcesIds"],[i.G.FIRST_CLICKED_NAME_PREFIXES,"firstClickedSourcesPrefix"],[i.G.FIRST_CLICKED_NAME_SUBSTRINGS,"firstClickedSourcesSubstring"],[i.G.LEAD_TAGS,"listTags"],[i.G.LEAD_TAGS_SUBSTRING,"listTagsSubstring"],[i.G.LEAD_TAGS_PREFIX,"listTagsPrefix"],[i.G.NOT_LEAD_TAGS,"notListTags"],[i.G.SUBSCRIPTION_TAGS,"subscriptionTags"],[i.G.SUBSCRIPTION_TAGS_PREFIX,"subscriptionTagsPrefix"],[i.G.SUBSCRIPTION_TAGS_SUBSTRING,"subscriptionTagsSubstring"],[i.G.NOT_SUBSCRIPTION_TAGS,"notSubscriptionTags"],[i.G.PRODUCT_TAGS,"listProducts"],[i.G.PRODUCT_TAGS_PREFIX,"productTagsPrefix"],[i.G.PRODUCT_TAGS_SUBSTRING,"productTagsSubstring"],[i.G.NO_SALE_ITEM_TAGS,"notListProducts"],[i.G.PRODUCT_CATEGORIES,"productCategoryIds"]]);function p(e){return e instanceof o.A?d:e instanceof s.j_?c:e instanceof r.Q?u:d}},84764(e,t,a){a.d(t,{A:()=>T});var i=a(31085),s=a(99075),o=a(12253),r=a(16447),n=a(73072),l=a(12973),d=a(93975),c=a(90741),u=a(62141),p=a(28674);let h="sb-crm-settings-panel-hidden",T=e=>
2{let[t,a]=(0,s.useState)(e.collapsed);(0,s.useEffect)(()=>{let t=c.A.getUserPreferenceByName(h),a=(null==t?void 0:t.value)??!1;T(a),e.setCollapsed(a)},[]);let T=e=>{a(e);let t=new u.A("REPORT_SETTINGS_PANEL_HIDDEN",e,h);c.A.setOrUpdateUserPreference(t)};return(0,i.jsxs)(o.qn,{collapsed:e.collapsed,style:{minWidth:e.minWidth||360,gap:"8px"},children:[(0,i.jsxs)(o.NB,{style:{margin:0,justifyContent:"flex-end",flexDirection:"row"},title:e.title,children:[(0,i.jsx)(r.A,{type:"icon",tooltipText:"Collapse this panel",iconType:n.AT.COLLAPSE_V2,iconWidth:16,iconColor:l.J.PRIMARY_TEXT,onClick:()=>e.setCollapsed(!0)}),(0,i.jsx)(d.A,{active:!t,text:"Open filter by default",textPlacement:"right",textType:"h-text-caption-light",style:{alignItems:"center"},spanClass:"htoggle--panel-header",onClick:()=>T(!t)})]}),(0,i.jsx)(o.c0,{style:{padding:16},children:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",marginBottom:"-27px"},children:[(0,i.jsx)(p.Sz,{style:{color:l.J.WIDGET_PRIMARY},children:"Filters"}),(0,i.jsx)(r.A,{type:"secondary-small",style:{height:"32px"},onClick:e.clearFilters,show:e.changesMade,children:"Clear"})]}),e.children,(0,i.jsx)(r.A,{type:"primary",style:{marginTop:"auto",width:"100%"},onClick:e.applyFilters,dataTest:"applyFilters",children:"Apply"})]})})]})}},17469(e,t,a){a.d(t,{Q:()=>c});var i,s=a(18990),o=a(99420),r=a.n(o),n=a(46640),l=a(46621),d=a(88852);class c extends n.Mk{getAsQueryParams(){let e=["subscriptionTags","subscriptionTagsPrefix","listTags","listTagsPrefix","notListTags","listProducts","productTagsPrefix","notListProducts","sourceLinkPrefix","sourceLinkSubstring","notSubscriptionTags"],t=["productCategoryIds","sourceLinkIds","firstClickedSourcesIds"],a=Object.entries(this).map(a=>{if(null!==a[1])return e.includes(a[0])?`${a[0]}=${this.sanitizeTags(this.returnObjectName(a[1]))}`:t.includes(a[0])?`${a[0]}=${this.sanitizeTags(a[1].map(e=>e.id.toString()))}`:"startDate"===a[0]?`${a[0]}=${this.startDate.format("DD-MM-yyyy")}`:"endDate"===a[0]?`${a[0]}=${this.endDate.format("DD-MM-yyyy")}`:a[0].toLowerCase().includes("substring")?`${a[0]}=${this.sanitizeTags(a[1].map(e=>e.name.substring(1)))}`:`${a[0]}=${a[1]}`}).filter(e=>void 0!==e).join("&");return 0===a.length?"":`${a}`}constructor({startDate:e=(null==(i=l.x0.getState().session.top)?void 0:i.demoModeEnabled)?d.A.getDemoModeDate():d.A.getUserCreationDateAsMoment(),endDate:t=r()(d.A.getUserTimeZoneDay()),status:a=null,subscriptionId:o=null,textInput:n=null,tagSearchType:c="ANY_OF_THEM",notTagSearchType:u="NO_ANY_OF_THEM",listTags:p=[],listTagsPrefix:h=[],listTagsSubstring:T=[],notListTags:g=[],subscriptionTags:m=[],subscriptionTagsPrefix:S=[],subscriptionTagsSubstring:f=[],notSubscriptionTags:x=[],listProducts:A=[],productTagsPrefix:O=[],productTagsSubstring:C=[],notListProducts:y=[],productCategoryIds:E=[],sourceLinkIds:_=[],sourceLinkPrefix:I=[],sourceLinkSubstring:R=[],firstClickedSourcesIds:v=[],firstClickedSourcesPrefix:N=[],firstClickedSourcesSubstring:L=[]}){super(),(0,s._)(this,"startDate",void 0),(0,s._)(this,"endDate",void 0),(0,s._)(this,"status",void 0),(0,s._)(this,"subscriptionId",void 0),(0,s._)(this,"textInput",void 0),(0,s._)(this,"tagSearchType",void 0),(0,s._)(this,"notTagSearchType",void 0),(0,s._)(this,"listTags",void 0),(0,s._)(this,"listTagsPrefix",void 0),(0,s._)(this,"listTagsSubstring",void 0),(0,s._)(this,"notListTags",void 0),(0,s._)(this,"subscriptionTags",void 0),(0,s._)(this,"subscriptionTagsPrefix",void 0),(0,s._)(this,"subscriptionTagsSubstring",void 0),(0,s._)(this,"notSubscriptionTags",void 0),(0,s._)(this,"listProducts",void 0),(0,s._)(this,"productTagsPrefix",void 0),(0,s._)(this,"productTagsSubstring",void 0),(0,s._)(this,"notListProducts",void 0),(0,s._)(this,"productCategoryIds",void 0),(0,s._)(this,"sourceLinkIds",void 0),(0,s._)(this,"sourceLinkPrefix",void 0),(0,s._)(this,"sourceLinkSubstring",void 0),(0,s._)(this,"firstClickedSourcesIds",void 0),(0,s._)(this,"firstClickedSourcesPrefix",void 0),(0,s._)(this,"firstClickedSourcesSubstring",void 0),(0,s._)(this,"returnObjectName",e=>e.map(e=>e.name)),this.startDate=e,this.endDate=t,this.status=a,this.subscriptionId=o,this.textInput=n,this.tagSearchType=c,this.notTagSearchType=u,this.listTags=p,this.listTagsPrefix=h,this.listTagsSubstring=T,this.notListTags=g,this.subscriptionTags=m,this.subscriptionTagsPrefix=S,this.subscriptionTagsSubstring=f,this.notSubscriptionTags=x,this.listProducts=A,this.productTagsPrefix=O,this.productTagsSubstring=C,this.notListProducts=y,this.productCategoryIds=E,this.sourceLinkIds=_,this.sourceLinkPrefix=I,this.sourceLinkSubstring=R,this.firstClickedSourcesIds=v,this.firstClickedSourcesPrefix=N,this.firstClickedSourcesSubstring=L}}},255(e,t,a){a.d(t,{e:()=>r,q:()=>n});var i=a(31085),s=a(99075);let o=(0,s.createContext)(void 0),r=()=>{let e=(0,s.useContext)(o);if(!e)throw Error("useReport must be used inside ReportProvider");return e},n=e=>{let{children:t,generateReport:a}=e;return(0,i.jsx)(o.Provider,{value:{generateReport:a},children:t})}},97441(e,t,a){a.d(t,{A:()=>n});var i=a(31085),s=a(99075),o=a(15294),r=a(18324);function n(e){let t=(0,s.useRef)(()=>void 0);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.A,{...e,onRequestUpgrade:()=>{var e;return null==(e=t.current)?void 0:e.call(t)}}),e.ttSubscription&&(0,i.jsx)(r.A,{modalOpenerSetter:e=>{t.current=e},modalId:"upgrade-billing-plan-modal"})]})}},83892(e,t,a){a.d(t,{K:()=>d});var i=a(31085),s=a(99075),o=a(86989),r=a(48819),n=a(34792),l=a(35546);let d=e=>
2{let t,[a,d]=(0,s.useState)(e.configuration);(0,s.useEffect)(()=>{d(()=>{if(e.updatedConfig){let t=e.updatedConfig;if(t&&t!==a)return e.hideTooltip&&e.hideTooltip(t.hasAtLeastOneAttribute()),t}return e.configuration})},[e.updatedConfig,e.configuration]);let c=new Map([["WEBAPP",{onClick:()=>e.onClick(),cursorStyle:"pointer"}],["EXTENSION",{onClick:()=>{},cursorStyle:"default"}]]),u=()=>c.get(e.origin??"WEBAPP");return(0,i.jsx)("div",{style:{display:"flex"},children:(0,i.jsx)("div",{onClick:()=>u().onClick(),className:`attributes-summary-container ${e.interactiveHover?"hover":""} ${"VERTICAL"===e.orientation?"vertical":""}`,style:{...e.styles,cursor:u().cursorStyle,width:"100%"},children:(t=[],(0,r.gV)(l.Y,e.selectedMode,e.selectedMode===o.je.LEAD_JOURNEY).forEach(s=>{let[o,r]=s;a[r].length>0&&t.push((0,i.jsx)(n.L,{configuration:a,group:o,hoverDisabled:e.hoverDisabled,origin:e.origin},r))}),(0,i.jsx)(i.Fragment,{children:t}))})})}},34792(e,t,a){a.d(t,{l:()=>g,L:()=>m});var i=a(31085),s=a(99075),o=a(28674),r=a(12973),n=a(48819),l=a(11540),d=a(73072),c=a(35546),u=a(27006),p=a(1463),h=a(97441),T=a(255);let g=e=>{if(e){var t;if(Object.values(p.R).includes(null==(t=e.name)?void 0:t.charAt(0)))return(0,u.Ae)(e.name)}return r.J.PRIMARY_TEXT},m=e=>{let{generateReport:t}=(0,T.e)(),[a,u]=(0,s.useState)(!1),[p,m]=(0,s.useState)(!1),[S,f]=(0,s.useState)(),x="Date range:",A=new Map([["WEBAPP",{onClick:e=>E(e),cursorStyle:()=>a?"pointer":"inherit"}],["EXTENSION",{onClick:()=>{},cursorStyle:()=>"default"}]]),O=()=>A.get(e.origin??"WEBAPP"),C={backgroundColor:a?r.J.HOVER:"",cursor:O().cursorStyle(),padding:"4px",borderRadius:8},y=()=>e.data?e.data.title:n.pv.includes(e.group)?n.Ig.get(n.L6[e.group]):n.Ig.get(e.group),E=e=>{y()===x&&(m(!p),f(e.currentTarget))};return(0,i.jsxs)("div",{className:"attributes-summary-item-container",onClick:e=>O().onClick(e),onMouseEnter:()=>{e.hoverDisabled||u(!0)},onMouseLeave:()=>{u(!1)},style:C,children:[(0,i.jsx)(o.GW,{className:"attributes-summary-item-title",color:a?g():r.J.TERTIARY_TEXT,children:y()}),y()===x?"":n.pv.includes(e.group)?(0,i.jsx)(l.Q,{type:d.AT.NOT_EQUALS,width:14,stroke:r.J.TERTIARY_TEXT}):(0,i.jsx)(l.Q,{type:d.AT.EQUALS,width:8,className:"attributes-summary-item-icon",stroke:r.J.TERTIARY_TEXT}),(()=>{if(e.data)return(0,i.jsx)(o.GW,{className:"attributes-summary-item",color:g(),children:e.data.content});if(!e.configuration)return null;let t=[],a=c.Y.get(e.group);return e.configuration[a].map((s,r)=>{let l=(0,n.BW)(e.group,s,!1);t.push((0,i.jsx)(o.GW,{className:"attributes-summary-item",color:g(s),children:`${l}${r==e.configuration[a].length-1?"":", "}`},r))}),(0,i.jsx)(i.Fragment,{children:t})})(),p&&(0,i.jsx)(h.A,{start:e.configuration.start,end:e.configuration.end,ttSubscription:e.ttSubscription,openDirection:"down",openCalendar:p,setOpenCalendar:m,setSelectedDateRange:e.setSelectedDateRange,anchorEl:S,focused:"startDate",generateReport:(a,i)=>t({...e.configuration,start:a,end:i}),byAttributes:!0,hideInput:!0,usePopper:!0})]})}},35546(e,t,a){a.d(t,{A:()=>I,Y:()=>_});var i=a(31085),s=a(81622),o=a(99075),r=a.n(o),n=a(3234),l=a(18833),d=a(85470),c=a(73072),u=a(12973),p=a(36493),h=a(86989),T=a(83892),g=a(28674),m=a(25638),S=a(26444),f=a(56318),x=a(98270);let A=(e,t)=>`${e}|${t}`,O=e=>(0,f.Ql)(e.field,e.operator)&&1===(0,S.fE)(e.value),C=e=>{let{filter:t,onClick:a}=e,s=(e=>{let[t,a]=(0,o.useState)({}),i=e.boxes.flatMap(e=>e.rows.filter(m.Si)).filter(O).map(e=>({field:e.field,value:(0,S.sm)(e.value)[0]})),s=i.map(e=>{let{field:t,value:a}=e;return A(t,a)}).join();return(0,o.useEffect)(()=>{let e=!0,t=new Map;return i.forEach(e=>{let{field:a,value:i}=e;return t.set(a,(t.get(a)??[]).concat(i))}),Promise.all(Array.from(t.entries()).map(async e=>{let[t,a]=e,{options:i}=await (0,x.Q)(t,"",a);return i.map(e=>[A(t,e.value),e.label])})).then(t=>{e&&a(Object.fromEntries(t.flat()))}),()=>{e=!1}},[s]),(e,a)=>t[A(e,a)]})(t),{boxes:n,joins:l}=((e,t)=>{let{boxes:a,joins:i}=(0,m.id)(e);return{boxes:a.map(e=>e.map((e,a)=>{var i;let s;return i=0===a,s=(0,S.sm)(e.value).length>1,`${(0,f.T3)(e.field,i)} ${(0,f.Y4)(e.operator,e.negated,s)} ${((e,t)=>{if(e.value&&"number"in e.value)return String(e.value.number);let a=(0,S.sm)(e.value);return(0,f.Bm)(e.operator)?a.map(e=>`"${e}"`).join(" or "):1===a.length?t(e.field,a[0])??("string"==typeof a[0]?a[0]:`1 ${f.r0[e.field].pluralLabel()}`):`${a.length} ${f.r0[e.field].pluralLabel()}`})(e,t)}`}).join(", ")),joins:i}})(t,s);return 0===n.length?null:(0,i.jsx)("div",{className:"advanced-filters-summary",onClick:a,children:n.map((e,t)=>(0,i.jsxs)(r().Fragment,{children:[t>0&&(0,i.jsx)(g.GW,{className:"advanced-filters-summary-join",children:l[t-1].toLowerCase()}),(0,i.jsx)(g.GW,{className:"advanced-filters-summary-group",children:e})]},e))})};var y=a(48819),E=a(11540);let _=new Map([[d.G.LEAD_TAGS_PREFIX,"leadTagsPrefix"],[d.G.LEAD_TAGS_SUBSTRING,"leadTagsSubstring"],[d.G.SOURCE_LINKS,"sourceLinks"],[d.G.FIRST_CLICKED_SOURCES,"firstClickedSources"],[d.G.FIRST_CLICKED_NAME_PREFIXES,"firstClickedNamePrefixes"],[d.G.FIRST_CLICKED_NAME_SUBSTRINGS,"firstClickedNameSubstrings"],[d.G.FIRST_CLICKED_SOURCE_CATEGORIES,"firstClickedSourceCategories"],[d.G.FIRST_CLICKED_TRAFFIC_SOURCES,"firstClickedTrafficSources"],[d.G.LAST_CLICKED_SOURCES,"lastClickedSources"],[d.G.LAST_CLICKED_NAME_PREFIXES,"lastClickedNamePrefixes"],[d.G.LAST_CLICKED_NAME_SUBSTRINGS,"last
2ClickedNameSubstrings"],[d.G.LAST_CLICKED_SOURCE_CATEGORIES,"lastClickedSourceCategories"],[d.G.LAST_CLICKED_TRAFFIC_SOURCES,"lastClickedTrafficSources"],[d.G.AD_ACCOUNTS,"accounts"],[d.G.TRAFFIC_SOURCES,"trafficSources"],[d.G.SOURCE_CATEGORIES,"sourceCategories"],[d.G.GOALS,"goals"],[d.G.SOURCE_LINK_AD,"sourceLinkAds"],[d.G.PRODUCT_SKUS,"saleItemSkus"],[d.G.PRODUCT_CATEGORIES,"productCategories"],[d.G.PRODUCT_TAGS,"productTags"],[d.G.PRODUCT_TAGS_PREFIX,"productTagsPrefix"],[d.G.PRODUCT_TAGS_SUBSTRING,"productTagsSubstring"],[d.G.SUBSCRIPTION_TAGS,"subscriptionTags"],[d.G.SUBSCRIPTION_TAGS_PREFIX,"subscriptionTagsPrefix"],[d.G.NAME_PREFIXES,"namePrefixes"],[d.G.NAME_SUBSTRINGS,"nameSubstrings"],[d.G.AD_NAME_PREFIXES,"adNamePrefixes"],[d.G.AD_NAME_SUBSTRINGS,"adNameSubstrings"],[d.G.LEAD_TAGS,"leadTags"],[d.G.NOT_LEAD_TAGS,"notLeadTags"],[d.G.NO_SALE_ITEM_TAGS,"noSaleItemTags"],[d.G.NO_SALE_ITEM_TAGS_PREFIX,"noSaleItemTagsPrefix"],[d.G.NO_SALE_ITEM_TAGS_SUBSTRING,"noSaleItemTagsSubstring"],[d.G.EXTERNAL_INTEGRATIONS,"externalIntegrations"],[d.G.LEAD_STAGE,"stages"],[d.G.NOT_SOURCE_LINK_ADS,"notSourceLinkAds"],[d.G.NOT_SOURCE_LINKS,"notSourceLinks"],[d.G.NOT_AD_ACCOUNTS,"notCustomers"],[d.G.NOT_SOURCE_CATEGORIES,"notSourceCategories"],[d.G.NOT_TRAFFIC_SOURCES,"notTrafficSourceCategories"],[d.G.NOT_GOALS,"notGoalCategories"],[d.G.NOT_PRODUCT_CATEGORIES,"notSaleItemCategories"],[d.G.NOT_LEAD_STAGE,"notStages"],[d.G.NOT_PRODUCT_SKUS,"notSaleItemSkus"],[d.G.NOT_SUBSCRIPTION_TAGS,"notSubscriptionTags"],[d.G.NOT_EXTERNAL_INTEGRATIONS,"notExternalIntegrations"],[d.G.SALES_PRICE_FILTER,"salesPriceFilterRules"],[d.G.NOT_SALES_PRICE_FILTER,"notSalesPriceFilterRules"],[d.G.PRODUCT_PACKAGES,"productPackages"],[d.G.NOT_PRODUCT_PACKAGES,"notProductPackages"]]),I=e=>{var t,a,r;let[d,S]=(0,o.useState)(),[f,x]=(0,o.useState)(!1);(0,o.useEffect)(()=>{x(O())},[[..._].map(t=>{let[a,i]=t;return e.configuration[i].length}).join(","),null==(t=e.configuration)?void 0:t.reportFiltersVersion,e.selectedMode]);let A=(0,s.QY)((0,s.Wh)(e.selectedMode),null==(a=e.configuration)?void 0:a.reportFiltersVersion)&&(0,m.Z9)((null==(r=e.configuration)?void 0:r.advancedFilter)??(0,m.xW)())>0,O=()=>{var t;return!(0,s.QY)((0,s.Wh)(e.selectedMode),null==(t=e.configuration)?void 0:t.reportFiltersVersion)&&(0,y.gV)(_,e.selectedMode,e.selectedMode===h.je.LEAD_JOURNEY).some(t=>{let[a,i]=t;return 0!=e.configuration[i].length})},I=`attribute-selector-modal-${e.tabId||"default"}`;return(0,i.jsx)("div",{className:"report-attribute-filters-wrapper",children:(0,i.jsxs)(n.k,{title:"Attribute filters",titleColor:u.J.WIDGET_PRIMARY,width:"100%",initialOpened:!0,type:"FULL",subtitle:"Filter results by certain sources, products, tags, etc",subtitleStyles:{textAlign:"start",fontSize:"12px",width:"100%",paddingBottom:"1.2rem",paddingInline:"1.6rem",display:"block"},children:[(0,i.jsx)("section",{className:"attribute-filters-container",children:A?(0,i.jsx)(C,{filter:e.configuration.advancedFilter,onClick:d}):f?(0,i.jsx)(T.K,{selectedMode:e.selectedMode,configuration:e.configuration,interactiveHover:!0,orientation:"VERTICAL",onClick:d,origin:e.origin}):(0,i.jsxs)("div",{className:"specify-attributes-container",onClick:d,style:{height:40},children:[(0,i.jsx)(E.Q,{className:"specify-attributes-icon",width:18,type:c.AT.ATTRIBUTES_PEN}),(0,i.jsx)(g.GW,{type:"h-text-m-medium",children:"Specify Attributes"})]})}),(0,i.jsx)(l.k,{onUpdate:e.onUpdate,configuration:e.configuration,setConfiguration:e.setConfiguration,children:(0,i.jsx)(p.A,{openerSetter:S,configuration:e.configuration,onUpdateOriginalState:e.setOriginalConfiguration,modalId:I,tabId:e.tabId,supportsAdvancedFilters:(0,s.Wh)(e.selectedMode)})})]})})}},18833(e,t,a){a.d(t,{C:()=>c,k:()=>u});var i=a(31085),s=a(99075),o=a.n(s),r=a(53435),n=a.n(r);let l=["reportFiltersVersion","saleItemSkus","notSaleItemSkus","productTagsPrefix","productTags","productTagsSubstring","leadTagsSubstring","leadTagsPrefix","leadTags","notLeadTags","sourceLinkName","sourceLinks","sourceLinkAds","sourceCategories","trafficSources","notTrafficSourceCategories","sourceLinkIds","sourceCategoryIds","trafficSourceCategoryIds","accounts","goals","notGoalCategories","sourcesCreationDateFilter","optimizeReport","onlyIncludeSourcelinksOfProducts","creativeGroupType","emailSourceOptions","attributionMode","adNamePrefixes","adNameSubstrings","namePrefixes","nameSubstrings"],d=["start","end"],c=(e,t)=>l.includes(e)||d.includes(e)&&t,u=e=>
2{let[t,a]=o().useState({productTags:"",productCategories:"",leadTags:"",notLeadTags:"",leadTagsWithRanges:"",noSaleItemTags:""}),s=(t,a)=>{e.setConfiguration(e=>n()(e,{[t]:{$set:a}}),c(t,e.configuration.optimizeReport)),e.onUpdate&&e.onUpdate()},r=t=>{e.setConfiguration(e=>n()(e,{advancedFilter:{$set:t}}),!0),e.onUpdate&&e.onUpdate()},l=t=>{e.setConfiguration(t,!0),e.onUpdate&&e.onUpdate()},d=(t,a)=>{let i=!1;a&&(i=c(a,e.configuration.optimizeReport)),e.setConfiguration(t,i),e.onUpdate&&e.onUpdate()},u=(t,i)=>{e.setConfiguration(e=>n()(e,{[i]:{$set:[...e[i].filter(e=>e.name?e.name!==t:e!==t)]}}),c(i,e.configuration.optimizeReport)),a(e=>({...e,[i]:""})),e.onUpdate&&e.onUpdate()},p=(i,s)=>{let o="";e.configuration[s].some(e=>e.name===i.name)?e.configuration[s].forEach(e=>o+=e.name):[...e.configuration[s],i].forEach(t=>c(s,e.configuration.optimizeReport)?o+=t.id:o+=t.name),o.length<=1800?(e.setConfiguration(e=>n()(e,{[s]:{$set:[...e[s],i]}}),c(s,e.configuration.optimizeReport)),t&&a(e=>({...e,[s]:""}))):a(e=>({...e,[s]:"Max tags size reached"})),e.onUpdate&&e.onUpdate()};return(0,i.jsx)(i.Fragment,{children:null!=e.children?o().Children.map(e.children,a=>null!=a?o().cloneElement(a,{configuration:e.configuration,updateConfiguration:s,onRemoveToContainer:u,onAddToContainer:p,updateConfigurationSync:d,acceptAdvancedFilter:r,switchFiltersVersion:l,errorMessage:t}):null):null})}},8113(e,t,a){a.d(t,{A:()=>p});var i=a(31085);a(99075);var s=a(11540),o=a(73072),r=a(12973),n=a(28674),l=a(16447),d=a(61156),c=a.n(d),u=a(33883);function p(e){let t=(0,u.DP)();return(0,i.jsx)(c(),{onChange:e.onChange,onError:e.onError,accepts:e.accepts||["*"],maxFileSize:e.maxFileSize||1e7,minFileSize:1,style:{height:e.height||"100%",width:e.width||"100%",margin:"24px 0",...e.style},clickable:!0,multiple:e.multiple||!1,children:(0,i.jsxs)("div",{className:"drop-file-content",children:[!e.hideIcon&&(0,i.jsx)(s.Q,{type:o.AT.DROP,width:40,stroke:r.J.LOCKED,className:"drag-and-drop-centered",style:{display:"flex"}}),(0,i.jsx)("div",{className:"drag-and-drop-centered",children:(0,i.jsx)(n.GW,{color:"white"===t?r.J.PRIMARY_TEXT:r.J.SECONDARY_TEXT,children:e.mainText||"Drag and drop CSV-file here"})}),(0,i.jsxs)("div",{className:"drag-and-drop-centered",children:[(0,i.jsx)("hr",{})," OR ",(0,i.jsx)("hr",{})]}),(0,i.jsx)("div",{className:"drag-and-drop-centered",children:(0,i.jsx)(l.A,{type:"secondary",text:e.searchFileButtonText||"Browse files"})}),(0,i.jsxs)("div",{className:"drag-and-drop-text",children:[(0,i.jsx)(n.GW,{color:r.J.LOCKED,children:e.text}),e.description]})]})})}},59725(e,t,a){a.d(t,{A:()=>l});var i=a(31085),s=a(99075),o=a(12973),r=a(11540),n=a(28674);let l=e=>{let{selected:t,tabs:a,onSelect:l,hasBottomBorder:d,containerStyle:c,rightSlot:u,selectedColor:p}=e,[h,T]=(0,s.useState)(void 0),g=p||o.J.TAB_SELECTED,m=e=>t===e.type||h===e.label,S=e=>m(e)?g:o.J.TABLE_TITLES;return(0,i.jsxs)("ul",{className:`tabs nav ${d?"nav-tabs-modal":"nav-tabs-modal-borderless"}`,style:{...c,position:"relative"},children:[a.map((e,t)=>(0,i.jsxs)("li",{role:"presentation",className:"tab-element",onMouseEnter:()=>T(e.label),onMouseLeave:()=>T(void 0),children:[(0,i.jsxs)("a",{className:"font-style-modal-tabs",onClick:()=>l(e.type),children:[e.icon&&(0,i.jsx)(r.Q,{stroke:S(e),type:e.icon,style:{marginRight:"6px"}}),(0,i.jsx)(n.ZH,{color:S(e),children:e.label})]}),m(e)&&(0,i.jsx)("span",{className:"active-bar",style:{backgroundColor:g}})]},t)),u&&(0,i.jsx)("li",{style:{position:"absolute",right:"5%"},children:u})]})}},93355(e,t,a){a.d(t,{s:()=>l});var i=a(31085),s=a(99075),o=a(16447),r=a(73072),n=a(12973);let l=e=>{let{onReload:t,cooldownTime:a,blockedTooltipText:l,style:d}=e,[c,u]=(0,s.useState)(!1);return(0,i.jsx)("div",{className:"h-reload-button-container",children:(0,i.jsx)(o.A,{type:"icon",iconType:r.AT.RELOAD,iconColor:n.J.SIDEBAR_ITEM,iconWidth:18,tooltipText:c?l||`Please wait ${a/1e3} seconds before reloading again`:"Reload",onClick:()=>{c||t().then(()=>{u(!0),setTimeout(()=>{u(!1)},a)})},locked:c,style:d})})}},41097(e,t,a){a.d(t,{G:()=>ei});var i=a(31085),s=a(53435),o=a.n(s),r=a(99420),n=a.n(r),l=a(99075),d=a.n(l),c=a(5282),u=a(38052),p=a(12973),h=a(46621),T=a(63281),g=a(88814),m=a(5398),S=a(86989),f=a(26786),x=a(85470),A=a(21834),O=a(63901),C=a(5584),y=a(82591),E=a(63627),_=a(15294),I=a(63944),R=a(93975),v=a(80688),N=a(73072),L=a(66518),b=a(93524),j=a(81072);let G=e=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(L.A,{addTagLabel:"Add product category",label:"Product categories",type:10,selected:e.selectFrom.productCategories,onRemove:t=>e.onRemove("productCategories",t),onSelect:t=>e.onAdd("productCategories",t)}),(0,i.jsx)(L.A,{addTagLabel:"Add product tag",addTagIconType:N.AT.TAG_V2,className:"add-tags-filter-container",label:"Filter products",type:2,selected:e.selectFrom.productTags,onRemove:t=>e.onRemove("productTags",t),onSelect:t=>e.onAdd("productTags",t)}),(0,i.jsx)(L.A,{addTagLabel:"Add tag",className:"add-tags-filter-container",label:"Filter leads with tags",type:0,selected:e.selectFrom.leadTags,onRemove:t=>e.onRemove("leadTags",t),onSelect:t=>e.onAdd("leadTags",t)}),e.selectFrom.leadTags.length>0&&(0,i.jsx)(E.a,{width:"100%",label:"Search type",tooltip:"You can filter for sales from leads that have all the selected tags at once (AND) or at least one of the selected tags (OR)",show:e.selectFrom.leadTags.length>0,className:"add-tags-filter-container ",children:(0,i.jsxs)(b.t,{onChange:t=>e.onUpdateConfiguration("leadTagSearchType","AND"===t?"ALL_OF_THEM":"ANY_OF_THEM"),defaultValue:"ALL_OF_THEM"===e.selectFrom.leadTagSearchType?"AND":"OR",children:[(0,i.jsx)(j.G,{value:"OR"}),(0,i.jsx)(j.G,{value:"AND"})]})}),(0,i.jsx)(L.A,{addTagLabel:"Add tag to exclude",className:"add-tags-filter-container",label:"Exclude leads with tags",type:0,selected:e.selectFrom.notLeadTags,labelStyle:{color:"var(--redacc)"},onRemove:t=>e.onRemove("notLeadTags",t),onSelect:t=>e.onAdd("notLeadTags",t)}),e.selectFrom.notLeadTags.length>0&&(0,i.jsx)(E.a,{width:"100%",label:"Search type",tooltip:"You can filter for sales from leads that have all the selected tags at once (AND) or at least one of the selected tags (OR)",show:e.selectFrom.notLeadTags.length>0,className:"add-tags-filter-container ",children:(0,i.jsxs)(b.t,{onChange:t=>{console.log("OnChange: ",t),e.onUpdateConfiguration("notLeadTagSearchType","AND"===t?"NO_ALL_OF_THEM":"NO_ANY_OF_THEM")},defaultValue:"NO_ALL_OF_THEM"===e.selectFrom.notLeadTagSearchType?"AND":"OR",children:[(0,i.jsx)(j.G,{value:"OR"}),(0,i.jsx)(j.G,{value:"AND"})]})})]});var w=a(28674);let D=[{value:"DATES",name:"By date"},{value:"TAGS",name:"By tags"}],P=[{value:"source",name:"Source"},{value:"sale",name:"Sale"}],F=e=>(0,i.jsxs)("div",{className:e.classes,style:{width:"100%"},children:[e.configuration.financialStatsType==S.je.TOTAL_SALES?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(E.a,{label:"Compare total sales",layout:"horizontal",className:e.configuration.compareTotalSales?void 0:"compare-total-sales-collapsed",children:(0,i.jsx)(R.A,{active:e.configuration.compareTotalSales,onClick:()=>e.inputHandler("compareTotalSales",!e.configuration.compareTotalSales)})}),e.configuration.compareTotalSales&&(0,i.jsx)(I.K,{options:D,style:{width:"50%",marginTop:"-24px"},selected:e.configuration.compareTotalSalesBy,onSelect:t=>e.inputHandler("compareTotalSalesBy",t)}),e.configuration.compareTotalSales&&"DATES"==e.configuration.compareTotalSalesBy&&(0,i.jsx)("div",{className:"mt-5 mb-5",children:(0,i.jsx)(E.a,{label:"To the selected date will be added the same time interval as selected on the report",children:(0,i.jsx)(_.A,{id:"report-configuration-sales-datepicker",width:"100%",start:e.configuration.groupBConfiguration.startDate,end:e.configuration.groupBConfiguration.endDate,onDateRangeSelected:(t,a)=>{e.onGroupBDateChange(t,a)},openDirection:e.openDirection,typeReport:e.configuration.financialStatsType,usePopper:!0})})})]}):(0,i.jsx)(E.a,{label:"Select origin",children:(0,i.jsx)(I.K,{options:P,selected:e.configuration.origin,onSelect:t=>e.inputHandler("origin",t)})}),e.configuration.compareTotalSales&&"TAGS"==e.configuration.compareTotalSalesBy?(0,i.jsx)(i.Fragment,{children:["A","B"].map(t=>{let a="groupAConfiguration",s=e.configuration.groupAConfiguration;
2return"B"===t&&(a="groupBConfiguration",s=e.configuration.groupBConfiguration),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("br",{}),(0,i.jsxs)(w.Sz,{children:["Group ",t]}),(0,i.jsx)(G,{selectFrom:s,onAdd:(t,i)=>{var s;let o;return s=a,void((o=Object.assign(new v.g,e.configuration[s]))[t]=[...o[t],i],e.inputHandler(s,o))},onRemove:(t,i)=>{var s;let o;return s=a,void((o=Object.assign(new v.g,e.configuration[s]))[t]=o[t].filter(e=>e.name!=i),e.inputHandler(s,o))},onUpdateConfiguration:(t,i)=>{var s;let o;return s=a,void((o=Object.assign(new v.g,e.configuration[s]))[t]=i,e.inputHandler(s,o))}})]})})}):(0,i.jsx)(G,{selectFrom:e.configuration,onAdd:(t,a)=>e.onAddToContainer(a,t),onRemove:(t,a)=>e.onRemoveToContainer(a,t),onUpdateConfiguration:(t,a)=>e.inputHandler(t,a)})]}),M=e=>{let t=(t,a,i)=>{let s=Object.assign(new v.g,e.configuration[t]);s[a]=i,e.inputHandler(t,s)};return e.configuration.compareTotalSales&&"TAGS"===e.configuration.compareTotalSalesBy?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(w.Sz,{children:"Group A"}),(0,i.jsx)(E.a,{label:"Ignore recurring sales",layout:"horizontal",className:"pill-format",children:(0,i.jsx)(R.A,{active:e.configuration.groupAConfiguration.ignoreRecurringSales,onClick:()=>t("groupAConfiguration","ignoreRecurringSales",!e.configuration.groupAConfiguration.ignoreRecurringSales)})}),(0,i.jsx)(E.a,{label:"Exclude hard costs",layout:"horizontal",className:"pill-format",children:(0,i.jsx)(R.A,{active:e.configuration.groupAConfiguration.excludeHardCosts,onClick:()=>t("groupAConfiguration","excludeHardCosts",!e.configuration.groupAConfiguration.excludeHardCosts)})}),(0,i.jsx)(E.a,{label:"Exclude refunds",layout:"horizontal",className:"pill-format",children:(0,i.jsx)(R.A,{active:e.configuration.groupAConfiguration.excludeRefunds,onClick:()=>t("groupAConfiguration","excludeRefunds",!e.configuration.groupAConfiguration.excludeRefunds)})}),(0,i.jsx)(w.Sz,{children:"Group B"}),(0,i.jsx)(E.a,{label:"Ignore recurring sales",layout:"horizontal",className:"pill-format",children:(0,i.jsx)(R.A,{active:e.configuration.groupBConfiguration.ignoreRecurringSales,onClick:()=>t("groupBConfiguration","ignoreRecurringSales",!e.configuration.groupBConfiguration.ignoreRecurringSales)})}),(0,i.jsx)(E.a,{label:"Exclude hard costs",layout:"horizontal",className:"pill-format",children:(0,i.jsx)(R.A,{active:e.configuration.groupBConfiguration.excludeHardCosts,onClick:()=>t("groupBConfiguration","excludeHardCosts",!e.configuration.groupBConfiguration.excludeHardCosts)})}),(0,i.jsx)(E.a,{label:"Exclude refunds",layout:"horizontal",className:"pill-format",children:(0,i.jsx)(R.A,{active:e.configuration.groupBConfiguration.excludeRefunds,onClick:()=>t("groupBConfiguration","excludeRefunds",!e.configuration.groupBConfiguration.excludeRefunds)})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(E.a,{label:"Ignore recurring sales",layout:"horizontal",className:"pill-format",children:(0,i.jsx)(R.A,{active:e.configuration.ignoreRecurringSales,onClick:()=>e.inputHandler("ignoreRecurringSales",!e.configuration.ignoreRecurringSales)})}),(0,i.jsx)(E.a,{label:"Exclude hard costs",layout:"horizontal",className:"pill-format",children:(0,i.jsx)(R.A,{active:e.configuration.excludeHardCosts,onClick:()=>e.inputHandler("excludeHardCosts",!e.configuration.excludeHardCosts)})})]})};var U=a(44479);let k=e=>{let t=[new T.A("50%",50),new T.A("75%",75),new T.A("90%",90)];return(0,i.jsx)(E.a,{style:{marginBottom:"4px"},label:"Rate of depreciation",tooltip:"The rate of depreciation used to allocate the revenue of sales among all their sources, using the Double Declining Balance depreciation method.",children:(0,i.jsx)(U.P,{elements:t,onSelected:e.onSelected,selectedElement:e.value})})},W=e=>{let t=[new T.A("Only sales","ONLY_SALES"),new T.A("Sales and calls","SALES_AND_CALLS")];return(0,i.jsx)(E.a,{label:"Included in report",tooltip:"Defines whether the report will show stats for sales, calls, or both",children:(0,i.jsx)(U.P,{elements:t,onSelected:e.onSelected,selectedElement:e.value})})},B=e=>{let t=[new T.A("7 Days",7),new T.A("14 Days",14),new T.A("1 Month",30),new T.A("3 Months",91),new T.A("6 Months",182),new T.A("9 Months",270),new T.A("1 Year",365),new T.A("6 Years",2190),new T.A("10 Years",3650)];return(0,i.jsx)(E.a,{label:"LTV Date range",show:e.show,tooltip:"This field will only affect the LTV column of the report, no other columns will be affected by this
2setting.",style:{margin:e.hideMargin&&0},children:(0,i.jsx)(U.P,{elements:t,onSelected:e.onSelected,selectedElement:e.value})})},H=e=>{let t=[new T.A("1 Day",1),new T.A("5 Days",5),new T.A("10 Days",10),new T.A("15 Days",15),new T.A("30 Days",30)];return(0,i.jsx)(E.a,{label:"Days range for first source attribution",tooltip:"Click to learn more",externalDocumentationType:"DAY_RANGE_FOR_FIRST_AD_ATTRIBUTION",iconType:N.AT.TUTORIAL,show:e.show,style:{...e.style},tooltipAlwaysVisible:!0,children:(0,i.jsx)(U.P,{elements:t,onSelected:e.onSelected,selectedElement:e.value})})},J=e=>{let t=[new T.A("None",0),new T.A("7 Days",7),new T.A("30 Days",30),new T.A("3 Months",90),new T.A("6 Months",180),new T.A("1 Year",365)];return(0,i.jsx)(E.a,{label:"Attribution Window",show:e.show,labelType:"h-text-l-medium",style:{...e.style},children:(0,i.jsx)(U.P,{elements:t,onSelected:e.onSelected,selectedElement:e.value,type:"h-text-m-medium"})})};var Y=a(67074),K=a(32241),$=a(52613);let V=[{value:"TOTAL_REVENUE",label:"Total revenue"},{value:"SALES",label:"Sales"},{value:"CALLS",label:"Calls"},{value:"CUSTOMERS",label:"Customers"}],z=[{name:"Source",value:"SOURCE"},{name:"Sale",value:"SALE"}],X=[{label:"Creative",value:"CREATIVE"},{label:"Video",value:"VIDEO"},{label:"Image",value:"IMAGE"},{label:"Headline",value:"HEADLINE"},{label:"Content",value:"CONTENT"},{label:"Ad Name",value:"AD_NAME"}],q=[{label:"Gallery",value:"GALLERY"},{label:"Table",value:"TABLE"}],Q=[{label:"All sources",value:m.S.INCLUDE},{label:"Prioritize paid sources",value:m.S.IGNORE},{label:"Prioritize organic sources",value:m.S.IGNORE_PAID},{label:"Only organic",value:m.S.ONLY},{label:"Only paid",value:m.S.ONLY_PAID}],Z=[{label:"All sources",value:m.S.INCLUDE},{label:"Only paid",value:m.S.ONLY_PAID}],ee=[{label:"Goal",value:$._Q.GOAL},{label:y.t.getSourceName("SOURCE_CATEGORY"),value:$._Q.SOURCE_CATEGORY},{label:"Traffic source",value:$._Q.TRAFFIC},{label:y.t.getSourceName("AD_ACCOUNT"),value:$._Q.ACCOUNT},{label:"None",value:$._Q.NONE}],et={width:"288px",height:"40px",borderRadius:"8px",gap:"2px",overflow:"hidden"},ea={borderRadius:0},ei=e=>{var t,a,s;let r=e.configuration,v=null==(t=h.x0.getState().session.top)?void 0:t.userLogin,G=r.financialStatsType===S.je.COHORT,w=v.restrictions.some(e=>"NO_TRAFFIC_SOURCE"===e.restrictionType),[D,P]=d().useState(e.configuration.productCategories.length>0),ei=S.pB[r.financialStatsType].availableModes.find(e=>e.value===r.attributionMode)??K.Dc["0"];(0,l.useEffect)(()=>{var t;e.type===x.G.REDUCED_ORGANIC_SOURCE_OPTIONS&&(null==(t=e.configuration)?void 0:t.emailSourceOptions)===m.S.ONLY&&e.updateConfiguration("emailSourceOptions",m.S.INCLUDE)},[e.type]),(0,l.useEffect)(()=>{r.productCategories.length>0&&!D?P(!0):r.productTags.length>0&&D&&P(!1)},[r.productCategories.length,r.productTags.length]);let es=e=>{if(!G)return!1;let t=r.end.diff(r.start,"days");return t>320||!(t<=240)&&e!==g.y.WEEK&&t>240},eo=[{value:g.y.DAY,name:"Day",disabled:es(g.y.DAY)},{value:g.y.WEEK,name:"Week",disabled:es(g.y.WEEK)},{value:g.y.MONTH,name:"Month"}],er=[{value:g.y.SOURCE_LINK,name:"Source"},...eo],en=[{value:"PRODUCT",name:"Product",disabled:r.productCategories.length>0,tooltip:r.productCategories.length>0?"Remove the Product category filter selected to filter by Product.":void 0},{value:"CATEGORIES",name:"Product categories",disabled:r.productTags.length>0,tooltip:r.productTags.length>0?"Remove the Product filter selected to filter by Product category.":void 0}],el=()=>({margin:e.hideMargin&&0});if(null!=e.visible&&!e.visible)return null;switch(e.type){case x.G.DAY_OF_ATTRIBUTION:return(0,i.jsx)(E.a,{tooltip:"Click to learn more",externalDocumentationType:"DATE_OF_CLICK_ATTRIBUTION",iconType:N.AT.TUTORIAL,label:"Use date of click attribution",layout:"horizontal",className:"pill-format",style:{...el()},show:!0,labelType:"h-text-m-medium",tooltipAlwaysVisible:!0,children:(0,i.jsx)(R.A,{textStyle:{display:"none"},active:r.dayOfAttribution,onClick:()=>{e.updateConfiguration("dayOfAttribution",!r.dayOfAttribution),r.dayOfAttribution||(e.updateConfiguration("considerRefundedDate",!1),e.updateConfiguration("includeNoSources",!1))}})});case x.G.TIME_GROUPING:return(0,i.jsx)(E.a,{label:"Base grouping",show:!0,labelType:"h-text-l-medium",children:(0,i.jsx)("div",{id:"baseGroupingSelect",children:(0,i.jsx)(I.K,{options:er,selected:r.timeGroupingOption,selectedTextColor:p.J.PRIMARY_TEXT,type:"h-text-m-medium",onSelect:t=>{var a;null==(a=e.updateConfigurationSync)||a.call(e,e=>{let a=o()(e,{timeGroupingOption:{$set:t},...t===g.y.SOURCE_LINK?{groups:{$set:[]}}:{sourceLinkAds:{$set:[]}}});return o()(a,{financialStatsType:{$set:(0,A.Yz)(a)}})})}})})});case x.G.SOURCE_NAME:return(0,i.jsx)(E.a,{label:"Source Name",tooltip:"This allows filtering SourceLinks that include the entered text on their names. This is especially useful if your information is structured in such a way that allows filtering various SourceLinks depending on a specific keyword or prefix",children:(0,i.jsx)(c.v,{value:r.sourceLinkName,placeholder:"Enter your Source Name",onChange:t=>e.updateConfiguration("sourceLinkName",t),width:"100%",dataTest:"sourceName"})});case x.G.SOURCE_LINKS:return(0,i.jsx)(L.A,{addTagLabel:"Add "+y.t.getSourceName("SOURCE_LINK"),label:y.t.getPluralSourceName("SOURCE_LINK"),type:6,selected:r.sourceLinks,onRemove:t=>e.onRemoveToContainer(t,"sourceLinks"),onSelect:t=>e.onAddToContainer(t,"sourceLinks"),dataTest:"sourceLink"});case x.G.AD_ACCOUNTS:return(0,i.jsx)(L.A,{addTagLabel:"Add account",label:y.t.getPluralSourceName("AD_ACCOUNT"),type:5,selected:r.accounts,onRemove:t=>e.onRemoveToContainer(t,"accounts"),onSelect:t=>e.onAddToContainer(t,"accounts"),dataTest:"addAccount"});case x.G.TRAFFIC_SOURCES:return(0,i.jsx)(L.A,{addTagLabel:"Add source",label:"Traffic sources",type:7,selected:r.trafficSources,onRemove:t=>e.onRemoveToContainer(t,"trafficSources"),onSelect:t=>e.onAddToContainer(t,"trafficSources"),dataTest:"addSource"});case x.G.SOURCE_CATEGORIES:return(0,i.jsx)(L.A,{addTagLabel:"Add "+y.t.getSourceName("SOURCE_CATEGORY"),label:y.t.getPluralSourceName("SOURCE_CATEGORY"),type:8,selected:r.sourceCategories,onRemove:t=>e.onRemoveToContainer(t,"sourceCategories"),onSelect:t=>e.onAddToContainer(t,"sourceCategories"),dataTest:"addCategory"});case x.G.GOALS:return(0,i.jsx)(L.A,{addTagLabel:"Add goal",label:"Goals",type:9,selected:r.goals,onRemove:t=>e.onRemoveToContainer(t,"goals"),onSelect:t=>e.onAddToContainer(t,"goals"),dataTest:"addGoal"});case x.G.ORGANIC_SOURCE:return(0,i.jsx)(E.a,{label:"Source configuration",labelType:"h-text-l-medium",show:!0,style:el(),tooltip:"Learn more about report source configuration",externalDocumentationType:"SOURCE_CONFIGURATION",iconType:N.AT.TUTORIAL,tooltipAlwaysVisible:!0,children:(0,i.jsx)(U.P,{elements:Q,onSelected:t=>e.updateConfiguration("emailSourceOptions",t),selectedElement:r.emailSourceOptions,type:"h-text-m-medium",modernLook:!0})});case x.G.REDUCED_ORGANIC_SOURCE_OPTIONS:return(0,i.jsx)(E.a,{label:"Source configuration",show:!0,tooltip:"Learn more about report source configuration",externalDocumentationType:"SOURCE_CONFIGURATION",iconType:N.AT.TUTORIAL,tooltipAlwaysVisible:!0,children:(0,i.jsx)(U.P,{elements:Z,onSelected:t=>e.updateConfiguration("emailSourceOptions",t),selectedElement:r.emailSourceOptions,modernLook:!0})});case x.G.UNIQUE_CUSTOMER:return(0,i.jsx)(E.a,{label:"New customer configuration",show:!0,style:{...el(
2)},labelType:"h-text-l-medium",children:(0,i.jsx)(U.P,{elements:[{label:"All Customers",value:f.o.ALL},{label:"Only Returning Customers",value:f.o.RETURNING},{label:"Only New Customers",value:f.o.UNIQUE}],onSelected:t=>e.updateConfiguration("uniqueCustomerOptions",t),selectedElement:r.uniqueCustomerOptions,type:"h-text-m-medium",modernLook:!0})});case x.G.IGNORE_RECURRING_SALES:return(0,i.jsx)(E.a,{label:"Ignore recurring sales",layout:"horizontal",className:"pill-format",style:{...el()},labelType:"h-text-m-medium",children:(0,i.jsx)(R.A,{active:r.ignoreRecurringSales,onClick:()=>e.updateConfiguration("ignoreRecurringSales",!r.ignoreRecurringSales)})});case x.G.EXCLUDE_HARD_COSTS:return(0,i.jsx)(E.a,{label:"Exclude hard costs",layout:"horizontal",className:"pill-format",style:{...el()},labelType:"h-text-m-medium",children:(0,i.jsx)(R.A,{active:r.excludeHardCosts,onClick:()=>{e.updateConfiguration("excludeHardCosts",!r.excludeHardCosts)}})});case x.G.EXCLUDE_REFUNDS:return(0,i.jsx)(E.a,{label:"Exclude refunds",layout:"horizontal",className:"pill-format",style:{...el()},labelType:"h-text-m-medium",children:(0,i.jsx)(R.A,{active:r.excludeRefunds,onClick:()=>e.updateConfiguration("excludeRefunds",!r.excludeRefunds)})});case x.G.EXCLUDE_INACTIVE_SOURCES:return(0,i.jsx)(E.a,{label:"Optimize report",layout:"horizontal",style:{...el(),...e.style},tooltipPlacement:"top",className:"exclude-inactive-sources pill-format",labelType:"h-text-m-medium",tooltip:"Excludes sources that were inactive during the time frame of the report, that is, sources that have no sales, calls, cost or clicks. This reduces the size of the report and the time it takes to generate it, without losing any information.",children:(0,i.jsx)(R.A,{active:r.optimizeReport,onClick:()=>e.updateConfiguration("optimizeReport",!r.optimizeReport)})});case x.G.CONSIDER_REFUNDED_DATE:return(0,i.jsx)(E.a,{label:"Consider refunded date",layout:"horizontal",style:{...e.style,...el()},tooltipPlacement:"top",className:"pill-format",labelType:"h-text-m-medium",tooltip:"Consider the refunded date instead of the sale date when processing refunds",children:(0,i.jsx)(R.A,{active:r.considerRefundedDate,disabled:r.dayOfAttribution,onClick:()=>e.updateConfiguration("considerRefundedDate",!r.considerRefundedDate)})});case x.G.EXCLUDE_LEADS_WITHOUT_SALES:return(0,i.jsx)(E.a,{label:"Exclude leads without sales",layout:"horizontal",style:el(),className:"pill-format",children:(0,i.jsx)(R.A,{active:r.excludeLeadsWithoutSales,onClick:()=>e.updateConfiguration("excludeLeadsWithoutSales",!r.excludeLeadsWithoutSales)})});case x.G.PRODUCT_CATEGORIES:return(0,i.jsx)(L.A,{addTagLabel:"Add product category",className:"add-tags-filter-container",label:"Product categories",type:10,selected:r.productCategories,onRemove:t=>{e.onRemoveToContainer(t,"productCategories"),1==r.productCategories.length&&e.updateConfiguration("onlyIncludeSourcelinksOfProducts",!1)},onSelect:t=>e.onAddToContainer(t,"productCategories"),errorMessage:e.errorMessage&&e.errorMessage.productCategories,invalid:e.errorMessage&&!!e.errorMessage.productCategories});case x.G.SUBSCRIPTION_TAGS:return(0,i.jsx)(L.A,{addTagLabel:"Add subscription tag",label:"Subscriptions",type:17,selected:r.subscriptionTags,onRemove:t=>{e.onRemoveToContainer(t,"trialsCategories"),1==r.productCategories.length&&e.updateConfiguration("onlyIncludeSourcelinksOfProducts",!1)},onSelect:t=>e.onAddToContainer(t,"subscriptionCategories"),errorMessage:e.errorMessage&&e.errorMessage.subscriptionCategories,invalid:e.errorMessage&&!!e.errorMessage.subscriptionCategories});case x.G.PRODUCT_TAGS:return(0,i.jsx)(L.A,{addTagLabel:"Add product tag",addTagIconType:N.AT.TAG_V2,className:"add-tags-filter-container",label:"Filter products",type:2,selected:r.productTags,onRemove:t=>{e.onRemoveToContainer(t,"productTags"),1==r.productTags.length&&e.updateConfiguration("onlyIncludeSourcelinksOfProducts",!1)},onSelect:t=>e.onAddToContainer(t,"productTags"),errorMessage:e.errorMessage&&e.errorMessage.productTags,invalid:e.errorMessage&&!!e.errorMessage.productTags});case x.G.LEAD_TAGS:return(0,i.jsx)(L.A,{addTagLabel:"Add tag",label:"Filter leads with tags",type:0,selected:r.leadTags,onRemove:t=>e.onRemoveToContainer(t,"leadTags"),onSelect:t=>e.onAddToContainer(t,"leadTags"),errorMessage:e.errorMessage&&e.errorMessage.leadTags,invalid:e.errorMessage&&!!e.errorMessage.leadTags});case x.G.LEAD_TAGS_SEARCH_TYPE:return(0,i.jsx)(E.a,{style:{marginBottom:"0px"},width:"100%",label:"Lead Tags Search type",tooltip:"You can filter for sales from leads that have all the selected tags at once (AND) or at least one of the selected tags (OR)",children:(0,i.jsxs)(b.t,{style:e.style,onChange:t=>e.updateConfiguration("leadTagSearchType","AND"===t?"ALL_OF_THEM":"ANY_OF_THEM"),updatedValue:"ALL_OF_THEM"===r.leadTagSearchType?"AND":"OR",children:[(0,i.jsx)(j.G,{value:"OR"}),(0,i.jsx)(j.G,{value:"AND"})]})});case x.G.ONLY_INCLUDE_SOURCELINKS_OF_PRODUCTS:return(0,i.jsx)(E.a,{label:"Only include sources of products selected",className:"add-tags-filter-container",layout:"horizontal",show:r.productTags.length>0||r.productCategories.length>0,children:(0,i.jsx)(R.A,{onClick:()=>e.updateConfiguration("onlyIncludeSourcelinksOfProducts",!r.onlyIncludeSourcelinksOfProducts),active:r.onlyIncludeSourcelinksOfProducts,disabled:!1})});case x.G.NOT_LEAD_TAGS:return(0,i.jsx)(L.A,{addTagLabel:"Add tag to exclude",className:"add-tags-filter-container",label:"Exclude leads with tags",type:0,selected:r.notLeadTags,labelStyle:{color:p.J.RED_ACCENTS},onRemove:t=>e.onRemoveToContainer(t,"notLeadTags"),onSelect:t=>e.onAddToContainer(t,"notLeadTags"),errorMessage:e.errorMessage&&e.errorMessage.notLeadTags,invalid:e.errorMessage&&!!e.errorMessage.notLeadTags});case x.G.NO_LEAD_TAGS_SEARCH_TYPE:return(0,i.jsx)(E.a,{style:{marginBottom:"0px"},width:"100%",label:"Exclude Lead Tags Search type",tooltip:"You can filter for sales from leads that do not have all the selected tags at once (AND) or at least one of the selected tags (OR)",children:(0,i.jsxs)(b.t,{style:e.style,onChange:t=>e.updateConfiguration("notLeadTagSearchType","AND"===t?"NO_ALL_OF_THEM":"NO_ANY_OF_THEM"),updatedValue:"NO_ALL_OF_THEM"===r.notLeadTagSearchType?"AND":"OR",children:[(0,i.jsx)(j.G,{value:"OR"}),(0,i.jsx)(j.G,{value:"AND"})]})});case x.G.NO_SALE_ITEM_TAGS:return(0,i.jsx)(L.A,{addTagLabel:"Add tag to exclude",className:"add-tags-filter-container",label:"Exclude sales with product",type:2,selected:r.noSaleItemTags,labelStyle:{color:p.J.RED_ACCENTS},onRemove:t=>e.onRemoveToContainer(t,"noSaleItemTags"),onSelect:t=>e.onAddToContainer(t,"noSaleItemTags"),errorMessage:e.errorMessage&&e.errorMessage.noSaleItemTags,invalid:e.errorMessage&&!!e.errorMessage.noSaleItemTags});case x.G.LTV_DATE_RANGE:return(0,i.jsx)(B,{value:r.ltvDays.value,show:!0,onSelected:t=>e.updateConfiguration("ltvDays",new T.A("",t)),hideMargin:e.hideMargin});case x.G.SCIENTIFIC_DATE_RANGE:return(0,i.jsx)(H,{show:!0,value:r.scientificDaysRange,onSelected:t=>
2e.updateConfiguration("scientificDaysRange",t),style:{...el()}});case x.G.WINDOW_ATTRIBUTION_DAYS_RANGE:{let t=S.je.DURING==r.financialStatsType||O.A.hasFeatureFlag(u.a.REPORTING_WINDOW_OF_ATTRIBUTION);return(0,i.jsx)(J,{show:t,value:r.windowAttributionDaysRange,onSelected:t=>e.updateConfiguration("windowAttributionDaysRange",t),style:{...el()}})}case x.G.DEPRECIATION_PERCENTAGE:return(0,i.jsx)(k,{onSelected:t=>e.updateConfiguration("depreciationRate",t),value:r.depreciationRate});case x.G.GROUP_REPORT_A:return(0,i.jsx)(E.a,{label:"Group results by",show:r.financialStatsType==S.je.LTV||r.timeGroupingOption!==g.y.SOURCE_LINK,children:(0,i.jsx)(U.P,{elements:ee,onSelected:t=>e.updateConfiguration("groups",(0,A.uG)(r.groups,t,0,r.financialStatsType)),selectedElement:void 0===r.groups[0]||r.groups[0].option===$._Q.SOURCE_LINK?$._Q.NONE:r.groups[0].option,modernLook:!0})});case x.G.TIME_INTERVAL:return(0,i.jsx)(E.a,{label:"Select time interval",show:!0,children:(0,i.jsx)(I.K,{options:eo,selected:r.timeGroupingOption,onSelect:t=>e.updateConfiguration("timeGroupingOption",t)})});case x.G.COMPARE_TOTAL_SALES:return(0,i.jsx)(F,{classes:"mb-5",inputHandler:(t,a)=>e.updateConfiguration(t,a),configuration:r,openDirection:e.openDirectionComparator,onRemoveToContainer:(t,a)=>e.onRemoveToContainer(t,a),onAddToContainer:(t,a)=>e.onAddToContainer(t,a),onGroupBDateChange:e.onGroupBDateChange});case x.G.COMPARE_TOTAL_SALES_ADVANCED:return(0,i.jsx)(M,{inputHandler:(t,a)=>e.updateConfiguration(t,a),configuration:r});case x.G.SELECT_ORIGIN:return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(E.a,{label:"Select origin",show:!0,children:(0,i.jsx)(I.K,{style:{width:"50%"},options:z,selected:r.origin,onSelect:t=>{e.updateConfiguration("origin",t),e.updateConfiguration("initialSources",[])}})}),"SOURCE"===e.configuration.origin&&(0,i.jsx)(L.A,{addTagLabel:"Add initial source",type:4,selected:r.initialSources,onRemove:t=>e.onRemoveToContainer(t,"initialSources"),onSelect:t=>e.onAddToContainer(t,"initialSources")}),"SALE"===e.configuration.origin&&(0,i.jsx)(L.A,{addTagLabel:"Add initial sale",type:2,selected:r.initialSources,onRemove:t=>e.onRemoveToContainer(t,"initialSources"),onSelect:t=>e.onAddToContainer(t,"initialSources")})]});case x.G.SALES_RELATES_TO_SOURCE_TAGS:return(0,i.jsx)(L.A,{label:"Sales related to source tags",className:"sales-related-to-source-tags-container",addTagLabel:"Add source tag",type:4,selected:e.configuration.salesRelatedToSourceTags,onSelect:t=>e.onAddToContainer(t,"salesRelatedToSourceTags"),onRemove:t=>e.onRemoveToContainer(t,"salesRelatedToSourceTags")});case x.G.SOURCE_LINK_CREATION_DATE:return(0,i.jsxs)("div",{className:"pill-format",children:[(0,i.jsx)(E.a,{label:"Filter sources by creation date",layout:"horizontal",tooltip:"Learn more about filtering sources by creation date",externalDocumentationType:"FILTER_SOURCES_BY_CREATION_DATE",iconType:N.AT.TUTORIAL,labelType:"h-text-m-medium",tooltipAlwaysVisible:!0,children:(0,i.jsx)(R.A,{active:r.sourcesCreationDateFilter.enabled,onClick:()=>{e.updateConfiguration("sourcesCreationDateFilter",{...r.sourcesCreationDateFilter,enabled:!r.sourcesCreationDateFilter.enabled})}})}),(0,i.jsx)(_.A,{id:"filter-sources-by-creation-date",start:(null==(a=r.sourcesCreationDateFilter.start)?void 0:a.isValid())?r.sourcesCreationDateFilter.start:n()(),end:(null==(s=r.sourcesCreationDateFilter.end)?void 0:s.isValid())?r.sourcesCreationDateFilter.end:n()(),onDateRangeSelected:(t,a)=>e.updateConfiguration("sourcesCreationDateFilter",{...r.sourcesCreationDateFilter,start:t,end:a}),disable:!r.sourcesCreationDateFilter.enabled,openDirection:"up",usePopper:!0})]});case x.G.INCLUDE_NO_SOURCES:if(w)break;return r.includeNoSources&&0!==r.sourceLinks.length&&e.updateConfiguration("includeNoSources",!r.includeNoSources),(0,i.jsx)(E.a,{label:"Include no source sales",layout:"horizontal",tooltipPlacement:"top",className:"include-no-source-sales pill-format",style:{...el()},labelType:"h-text-m-medium",tooltip:"Disabled when source links are selected. This option will include sales that have no source links associated with them.",children:(0,i.jsx)(R.A,{onClick:()=>e.updateConfiguration("includeNoSources",!r.includeNoSources),active:r.includeNoSources&&0===r.sourceLinks.length,disabled:r.dayOfAttribution||0!==r.
2sourceLinks.length})});case x.G.CALLS_OPTION:return(0,i.jsx)(W,{onSelected:t=>e.updateConfiguration("totalSalesCallOption",t),value:r.totalSalesCallOption});case x.G.ATTRIBUTION_MODE:return(0,i.jsx)(E.a,{label:"Attribution model",show:!0,children:(0,i.jsx)(U.P,{elements:S.pB[r.financialStatsType].availableModes,onSelected:t=>e.updateConfiguration("attributionMode",t),prefixIcon:ei.icon,selectedElement:ei.value,modernLook:!0})});case x.G.CREATIVE_GROUP_TYPE:return(0,i.jsx)(E.a,{label:"Creative group type",show:!0,children:(0,i.jsx)(U.P,{elements:X,onSelected:t=>e.updateConfiguration("creativeGroupType",t),selectedElement:r.creativeGroupType,modernLook:!0})});case x.G.CREATIVE_VIEW_TYPE:return(0,i.jsx)(E.a,{label:"Creative view type",show:!0,children:(0,i.jsx)(U.P,{elements:q,onSelected:t=>e.updateConfiguration("creativeViewType",t),selectedElement:r.creativeViewType,modernLook:!0})});case x.G.TREND_RANGES:return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(E.a,{label:"Ranges",show:!0,children:(0,i.jsx)(U.P,{elements:C.tA,onSelected:t=>{e.updateConfiguration("trendRanges",C.ZB[t]),e.updateConfiguration("trendRangePreset",t)},selectedElement:r.trendRangePreset,modernLook:!0})}),r.trendRangePreset===C.Kj.CUSTOM&&(0,i.jsx)(Y.A,{maximumValues:5,maximumTimeframe:365,persistedTimeframes:r.trendRanges,setPersistedTimeframes:t=>{e.updateConfiguration("trendRanges",C.Kb(t(r.trendRanges)))}})]});case x.G.SALE_ITEM_GROUP_OPTION:return(0,i.jsx)(E.a,{label:"Group report by",show:!0,style:el(),children:(0,i.jsx)(U.P,{elements:[{label:"Product",value:"ITEM"},{label:"Product Category",value:"CATEGORY"}],onSelected:t=>e.updateConfiguration("saleItemGroupOption",t),selectedElement:r.saleItemGroupOption,modernLook:!0})});case x.G.GEO_GROUPING:return(0,i.jsx)(E.a,{label:"Base grouping",show:!0,labelType:"h-text-l-medium",children:(0,i.jsx)(I.K,{options:[{value:"COUNTRY",name:"Country"},{value:"REGION",name:"Region"},{value:"CITY",name:"City"}],selected:r.geoLocationLevel,onSelect:t=>e.updateConfiguration("geoLocationLevel",t)})});case x.G.SELECT_PRODUCT_OR_CATEGORY_DROPDOWN:return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(E.a,{label:"Select filter",show:!0,style:e.style,hideText:e.hideText,children:(0,i.jsx)(I.K,{options:en,selected:D?"CATEGORIES":"PRODUCT",style:et,buttonStyle:ea,onSelect:e=>{P("CATEGORIES"===e)}})}),!0===D?(0,i.jsx)(L.A,{addTagLabel:"Add product category",label:e.hideText?null:"Product categories",closeOnSelect:!0,type:10,selected:r.productCategories,locked:r.productTags.length>0||r.productCategories.length>0,hideAddTagLabel:r.productCategories.length>0,onRemove:t=>{e.onRemoveToContainer(t,"productCategories"),1==r.productCategories.length&&e.updateConfiguration("onlyIncludeSourcelinksOfProducts",!1)},onSelect:t=>{0===r.productCategories.length&&0===r.productTags.length&&e.onAddToContainer(t,"productCategories")},errorMessage:e.errorMessage&&e.errorMessage.productCategories,invalid:e.errorMessage&&!!e.errorMessage.productCategories},"product-category-container"):(0,i.jsx)(L.A,{addTagLabel:"Add product tag",addTagIconType:N.AT.TAG_V2,label:e.hideText?null:"Filter products",type:2,selected:r.productTags,closeOnSelect:!0,onRemove:t=>{e.onRemoveToContainer(t,"productTags"),1==r.productTags.length&&e.updateConfiguration("onlyIncludeSourcelinksOfProducts",!1)},onSelect:t=>{0===r.productCategories.length&&0===r.productTags.length&&e.onAddToContainer(t,"productTags")},locked:r.productTags.length>0||r.productCategories.length>0,hideAddTagLabel:r.productTags.length>0,errorMessage:e.errorMessage&&e.errorMessage.productTags,invalid:e.errorMessage&&!!e.errorMessage.productTags},"product-container")]});case x.G.SOURCE_JOURNEY_KEY_METRIC:return(0,i.jsx)(E.a,{label:"Key metric",show:!0,children:(0,i.jsx)(U.P,{elements:V,onSelected:t=>e.updateConfiguration("sourcesJourneyKeyMetric",t),selectedElement:r.sourcesJourneyKeyMetric,modernLook:!0})});case x.G.SOURCE_LINK_AD:return(0,i.jsx)(L.A,{addTagLabel:"Add ad",label:y.t.getSourceName("SOURCE_LINK_AD"),type:14,selected:r.sourceLinkAds,onRemove:t=>e.onRemoveToContainer(t,"sourceLinkAds"),onSelect:t=>e.onAddToContainer(t,"sourceLinkAds")});case x.G.EXTERNAL_INTEGRATIONS:return(0,i.jsx)(L.A,{addTagLabel:"Add external account",label:"Integrations Accounts",type:15,selected:r.externalIntegrations,onRemove:t=>e.onRemoveToContainer(t,"externalIntegrations"),onSelect:t=>e.onAddToContainer(t,"externalIntegrations"),dataTest:"integrationAccount"});case x.G.FORECASTING_OPTIONS:{let t=O.A.hasFeatureFlag(u.a.REPORTING_FORECASTING_METRICS);return(0,i.jsx)(E.a,{label:"Forecasting option (Beta)",show:t,style:{display:"flex",maxWidth:e.useFullSpace?"100%":"30%",marginTop:"10px"},tooltip:"Learn more about forecasting options",externalDocumentationType:"FORECASTING_OPTION",iconType:N.AT.TUTORIAL,labelType:"h-text-m-medium",tooltipAlwaysVisible:!0,children:(0,i.jsx)(I.K,{options:[{value:"FIRST_SALE",name:"First Sale"},{value:"TOTAL_SALES",name:"Total sales"}],selected:r.forecastingOption,onSelect:t=>e.updateConfiguration("forecastingOption",t)})})}}return null}},67074(e,t,a){a.d(t,{A:()=>l});var i=a(31085),s=a(99075),o=a(5282),r=a(73072),n=a(26263);let l=e=>{let{maximumValues:t,persistedTimeframes:a,setPersistedTimeframes:l,maximumTimeframe:d}
2=e,[c,u]=(0,s.useState)([]),p=(0,s.useRef)(null);(0,s.useEffect)(()=>{u(a)},[a]);let h=(0,s.useCallback)((e,t)=>c.some((a,i)=>a===t&&i!==e)?"This timeframe is already being taken into account":isNaN(t)||!t||t<=0?"Invalid timeframe":t>d?`The timeframe cannot be larger than ${d}`:null,[c,d]),T=e=>{u(t=>{let i=t[e];return h(e,i)?a[e]?t:[...a,i]:(l(t=>{if(t[e]==i)return t;let a=[...t];return a[e]=i,a}),t)})},g=e=>{["+","-",".","e","E"].includes(e.key)&&e.preventDefault()};return(0,i.jsxs)("div",{className:"tt-settings-item",style:{width:"250px",flexFlow:"column",gap:"10px",justifyContent:"start"},children:[c.map((e,t)=>(0,i.jsxs)("div",{className:"d-flex",style:{gap:"5px",width:"100%"},children:[(0,i.jsx)(o.v,{style:{flex:1},suffix:"days",type:"text",onKeyDown:g,value:e||"",invalid:!!e&&!!h(t,e),onChange:e=>{let a;return a=String(e).replace(/\D/g,""),void u(e=>{let i=[...e];return i[t]=a?parseInt(a,10):null,i})},onBlur:()=>T(t),onEnter:()=>T(t),errorMessage:h(t,e),ref:t+1==c.length?p:null}),(0,i.jsx)(n.A,{type:"secondary",iconType:r.AT.DELETE,style:{height:"32px"},onMouseDown:e=>e.preventDefault(),onClick:()=>{!(c.length<=1)&&l(e=>{let a=[...e];return(a.splice(t,1),u(a),e[t])?a:e})},accessAction:"WRITE",locked:0===t&&a.length<=1})]},t)),(0,i.jsx)(n.A,{type:"secondary",iconType:r.AT.PLUS,tooltipText:c.length>=t&&`You can only add up to ${t} timeframes`,tooltipPlacement:"right",locked:c.length>=t,accessAction:"WRITE",onClick:()=>{u(e=>e.length==a.length?[...e,null]:(p.current.focus(),e))},children:"Add Timeframe"})]})}},73067(e,t,a){a.d(t,{kx:()=>s}),a(67840);var i,s=((i={}).IMPORT_SALES="IMPORT_SALES",i.IMPORT_LEADS="IMPORT_LEADS",i.IMPORT_SUBSCRIPTIONS="IMPORT_SUBSCRIPTIONS",i)},86756(e,t,a){a.d(t,{A:()=>l});var i=a(18990),s=a(88293),o=a(35621),r=a(63257);class n extends s.A{getResultById(e){return this.httpClient.get(`${e}`)}deleteById(e){return this.httpClient.delete(`${e}`)}getAllByPage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this.httpClient.get(`?${o.r.objectsToParams([e])}${t?"&searchText="+t:""}`)}getAllInProgress(){return this.httpClient.get("in-progress")}getProgressInfoByIds(e){return this.httpClient.get(`progress-info?dataImportIds=${e.join(",")}`)}submitUserFile(e,t){let a=new FormData;return a.append("file",t),this.hyrosHttpClient.post(`${e}/submit-file`,a,{"Content-Type":"multipart/form-data"})}getFilePreview(e){return this.httpClient.get(`${e}/file`,{Accept:"application/octet-stream"})}getPresignedURL(e){return this.httpClient.get(`${e}/download-file`)}getRemoveImportPreview(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return this.httpClient.get(`${e}/remove-import-preview?page=${t}&pageSize=${a}`)}constructor(){super(),(0,i._)(this,"hyrosHttpClient",void 0),this.httpClient.baseUrl+="/data-import/",this.hyrosHttpClient=r.q.createDefaultHyrosResponseHttpClient(),this.hyrosHttpClient.baseURL="//api-internal.hyros.com/v1/data-import/"}}let l=new n},66310(e,t,a){a.d(t,{A:()=>o});var i=a(88293);class s extends i.A{getTTSubscription(){return this.httpClient.get("/tt-subscription")}getApiKey(){return this.httpClient.get("/api-key")}async createPromoter(e){return this.httpClient.post("/create-promoter",{refId:e})}async updatePromoter(e){return this.httpClient.put("/first-promoter-code",{code:e})}async getPromoter(){return this.httpClient.get("/first-promoter-code")}async userHasAnalyticsSuiteRecentlyEnabled(){return this.httpClient.get("/analytics-suite/enabled")}async disableDemoMode(){return this.httpClient.post("/disable-demo-mode")}async clearDemoMode(){return this.httpClient.post("/clear-demo-mode")}async getIpLocation(){return this.httpClient.get("/ip-location")}constructor(){super(),this.httpClient.baseUrl+="/users",this.spoofHttpClient.baseUrl+="/users"}}let o=new s}}]);
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.