1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[2106],{44385:function(e,t,s){s.d(t,{a7:function(){return r},n0:function(){return d},pL:function(){return l},pO:function(){return n}});s(18111),s(7588);const i=524288e3,a=104857600;function l(e){const t=e&&e.name?e.name.toLowerCase():"";return t.endsWith(".xlsx")||t.endsWith(".ods")?a:i}function r(e){return`${Math.round(l(e)/1048576)} MB`}const n=".csv,.txt,.xlsx,.ods";function o(e){const t=e&&e.name?e.name.toLowerCase():"";return t.endsWith(".xlsx")?"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":t.endsWith(".ods")?"application/vnd.oasis.opendocument.spreadsheet":t.endsWith(".txt")?"text/plain":"text/csv"}function d(e,t,s,i){const a=i||window.fetch.bind(window),l=o(t);return e.post("/imports/upload-url",{type:s,fileName:t.name,size:t.size,contentType:l}).then(e=>{const s=new FormData;return Object.keys(e.data.fields||{}).forEach(t=>{s.append(t,e.data.fields[t])}),s.append("file",t),a(e.data.url,{method:"POST",body:s}).then(t=>{if(!t.ok)throw new Error("upload_failed");return{mediaId:e.data.mediaId}})})}},63079:function(e,t,s){s.d(t,{A:function(){return Ls}});var i=s(20641),a=s(90033),l=s(53751);const r={class:"modal-card import-mapping-modal"},n={class:"modal-card-head"},o={class:"import-mapping-modal__heading"},d={class:"modal-card-title"},u={class:"import-mapping-modal__subtitle"},p=["aria-label"],c={class:"modal-card-body"},m={key:0,class:"import-sheet-wrap import-sheet-skeleton","aria-hidden":"true"},h={class:"import-sheet-skeleton__toolbar"},g={class:"import-sheet-skeleton__progress"},v={class:"import-sheet is-skeleton"},y={class:"import-sheet__table"},f={class:"import-sheet__head-btn import-sheet-skeleton__head"},b={class:"import-sheet__gutter"},_={key:1,class:"list-empty-state"},k={class:"list-empty-state-message"},L={key:2,class:"import-sheet-wrap"},w={class:"import-sheet__toolbar"},C={class:"import-sheet__progress"},$={class:"import-sheet__eyebrow"},E={class:"import-sheet__bar-bg"},x={class:"import-sheet__facts"},F={key:0},S={key:1,class:"import-sheet__sep"},I={key:0,class:"import-sheet__ragged","data-testid":"import-ragged-warning"},M={class:"import-mapping-modal__previous-body"},T={class:"buttons"},X={class:"import-sheet__eyebrow"},P={class:"import-matches__counts"},R={class:"import-matches__count is-found"},A={class:"import-sheet-body"},D={class:"import-sheet-area"},O={class:"import-sheet nice-scrollbar"},W={class:"import-sheet__table"},N=["title","aria-pressed","data-column","onClick"],U={class:"import-sheet__head-name"},V={class:"import-sheet__head-summary"},K={class:"import-sheet__head-chips"},Q={key:0,class:"tag is-rounded is-small is-info is-passive"},z={class:"import-sheet__gutter"},j={key:0,class:"tag is-rounded is-small is-info is-passive import-sheet__match-tag"},q=["title"],B={key:0,class:"import-sheet__tags"},G=["title"],H={key:1,class:"import-sheet__resolved"},J=["title"],Y={key:0,class:"import-sheet__raw"},Z={key:3,class:"import-sheet__empty"},ee=["title"],te={key:0,class:"import-sheet__more"},se=["aria-label"],ie=["aria-label","aria-valuenow","aria-valuemin"],ae={class:"import-panel__header"},le={class:"import-panel__title"},re=["aria-label","title"],ne={class:"import-panel__content nice-scrollbar"},oe={key:3,class:"import-mapping-modal__ledger","data-testid":"import-preflight-ledger"},de={class:"import-mapping-modal__ledger-head"},ue={class:"import-sheet__eyebrow"},pe={class:"modal-card-foot import-mapping-modal__foot"},ce={class:"import-mapping-modal__readiness"},me={key:0,class:"tag is-rounded is-small is-danger"},he={class:"buttons import-mapping-modal__actions"};function ge(e,t,s,ge,ve,ye){const fe=(0,i.g2)("b-skeleton"),be=(0,i.g2)("font-awesome-icon"),_e=(0,i.g2)("b-button"),ke=(0,i.g2)("b-message"),Le=(0,i.g2)("ImportPreflightStrip"),we=(0,i.g2)("ImportColumnPanel"),Ce=(0,i.g2)("ImportLedgerTable"),$e=(0,i.g2)("b-radio-button"),Ee=(0,i.g2)("b-field"),xe=(0,i.g2)("b-modal");return(0,i.uX)(),(0,i.Wv)(xe,{"model-value":s.active,"has-modal-card":"","trap-focus":"","append-to-body":"","full-screen":"","can-cancel":["escape","x"],"custom-class":"import-mapping-modal-wrapper","onUpdate:modelValue":ye.onModalToggle},{default:(0,i.k6)(()=>[(0,i.Lk)("div",r,[(0,i.Lk)("header",n,[(0,i.Lk)("div",o,[(0,i.Lk)("p",d,(0,a.v_)(e.$t("Map columns")),1),(0,i.Lk)("p",u,(0,a.v_)(e.$t(ye.typeLabel)),1)]),ve.preview?((0,i.uX)(),(0,i.CE)("span",{key:0,class:(0,a.C4)(["import-mapping-modal__save-state",{"has-text-danger":!!ve.
1saveError}])},[ve.isSaving?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.eW)((0,a.v_)(e.$t("Savingâ¦")),1)],64)):ve.saveError?((0,i.uX)(),(0,i.CE)(i.FK,{key:1},[(0,i.eW)((0,a.v_)(ve.saveError),1)],64)):ve.hasSavedOnce?((0,i.uX)(),(0,i.CE)(i.FK,{key:2},[(0,i.eW)((0,a.v_)(e.$t("Draft saved")),1)],64)):(0,i.Q3)("",!0)],2)):(0,i.Q3)("",!0),(0,i.Lk)("button",{type:"button",class:"delete","aria-label":e.$t("Close"),onClick:t[0]||(t[0]=(...e)=>ye.close&&ye.close(...e))},null,8,p)]),(0,i.Lk)("section",c,[ve.isLoading?((0,i.uX)(),(0,i.CE)("div",m,[(0,i.Lk)("div",h,[(0,i.Lk)("div",g,[(0,i.bF)(fe,{width:"180px",height:"11px",animated:""}),(0,i.bF)(fe,{width:"100%",height:"6px",animated:""})]),(0,i.bF)(fe,{width:"140px",height:"11px",animated:""})]),(0,i.Lk)("div",v,[(0,i.Lk)("table",y,[(0,i.Lk)("thead",null,[(0,i.Lk)("tr",null,[t[10]||(t[10]=(0,i.Lk)("th",{class:"import-sheet__gutter import-sheet__gutter--head"},null,-1)),((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(6,e=>(0,i.Lk)("th",{key:`import-sheet-skeleton-head-${e}`,class:"import-sheet__head"},[(0,i.Lk)("div",f,[(0,i.bF)(fe,{width:e%2?"58%":"44%",height:"14px",animated:""},null,8,["width"]),(0,i.bF)(fe,{width:e%3?"40%":"52%",height:"12px",animated:""},null,8,["width"]),(0,i.bF)(fe,{width:"88px",height:"22px",rounded:"",animated:""})])])),64))])]),(0,i.Lk)("tbody",null,[((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(10,e=>(0,i.Lk)("tr",{key:`import-sheet-skeleton-row-${e}`},[(0,i.Lk)("th",b,[(0,i.bF)(fe,{width:"14px",height:"12px",animated:""})]),((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(6,t=>(0,i.Lk)("td",{key:`import-sheet-skeleton-${e}-${t}`,class:"import-sheet__cell"},[(0,i.bF)(fe,{width:(7*e+13*t)%40+35+"%",height:"13px",animated:""},null,8,["width"])])),64))])),64))])])])])):ve.loadError?((0,i.uX)(),(0,i.CE)("div",_,[(0,i.bF)(be,{icon:"fa-light fa-triangle-exclamation",class:"list-empty-state-icon"}),(0,i.Lk)("p",k,(0,a.v_)(ve.loadError),1),(0,i.bF)(_e,{class:"is-rounded",type:"is-light",onClick:ye.loadPreview},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Try again")),1)]),_:1},8,["onClick"])])):ve.preview?((0,i.uX)(),(0,i.CE)("div",L,[(0,i.Lk)("div",w,[(0,i.Lk)("div",C,[(0,i.Lk)("p",$,(0,a.v_)(e.$t("{mapped} of {total} columns mapped",{mapped:ye.mappedCount,total:ve.preview.headers.length})),1),(0,i.Lk)("div",E,[(0,i.Lk)("div",{class:"import-sheet__bar-fill",style:(0,a.Tr)({width:ye.mappedWidth})},null,4)])]),(0,i.Lk)("p",x,[s.fileName?((0,i.uX)(),(0,i.CE)("span",F,(0,a.v_)(s.fileName),1)):(0,i.Q3)("",!0),s.fileName?((0,i.uX)(),(0,i.CE)("span",S," · ")):(0,i.Q3)("",!0),(0,i.Lk)("span",null,(0,a.v_)(e.$t("{rows} rows sampled",{rows:ve.preview.sampledRowCount})),1)])]),ve.preview.raggedRowCount?((0,i.uX)(),(0,i.CE)("p",I,(0,a.v_)(e.$t("{count} sampled rows have more columns than the header row. A value containing the column separator is not quoted, so everything after it shifts one column across. Re-save the file as CSV UTF-8, or separate values inside a cell with a semicolon.",{count:ve.preview.raggedRowCount})),1)):(0,i.Q3)("",!0),ve.previousMapping?((0,i.uX)(),(0,i.Wv)(ke,{key:1,class:"import-mapping-modal__previous",type:"is-info",closable:!1,"data-testid":"import-previous-mapping"},{default:(0,i.k6)(()=>[(0,i.Lk)("div",M,[(0,i.Lk)("span",null,(0,a.v_)(e.$t("Apply your previous mapping from {date}?",{date:ye.previousMappingDate})),1),(0,i.Lk)("div",T,[(0,i.bF)(_e,{class:"is-rounded",type:"is-info",size:"is-small","data-testid":"import-apply-previous-mapping",onClick:ye.applyPreviousMapping},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Apply")),1)]),_:1},8,["onClick"]),(0,i.bF)(_e,{class:"is-rounded is-nobg",size:"is-small","data-testid":"import-dismiss-previous-mapping",onClick:t[1]||(t[1]=e=>ve.previousMapping=null)},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Dismiss")),1)]),_:1})])])]),_:1})):(0,i.Q3)("",!0),(0,i.bF)(Le,{preflight:ve.preflight,"is-queued":ye.isQueued,"mapping-revision":ve.mappingRevision,"validation-errors":ve.validationErrors,total:ve.totalRows,progress:ve.processedRows,"active-filter":ve.ledgerFilter,"import-type":s.importType,onFilter:ye.setLedgerFilter},null,8,["preflight","is-queued","mapping-revision","validation-errors","total","progress","active-filter","import-type","onFilter"]),ve.preview.matchable&&ye.matchTiles.length?((0,i.uX)(),(0,i.CE)("div",{key:2,class:(0,a.C4)(["import-matches",{"is-stale":ve.isMatching}]),"data-testid":"import-matches"},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ye.matchTiles,s=>((0,i.uX)(),(0,i.CE)("div",{key:s.key,class:"import-matches__tile"}
1,[(0,i.Lk)("p",X,(0,a.v_)(e.$t(s.label)),1),(0,i.Lk)("p",P,[(0,i.Lk)("span",R,(0,a.v_)(e.$t("{count} found",{count:s.found})),1),t[11]||(t[11]=(0,i.Lk)("span",{class:"import-sheet__sep"},"·",-1)),(0,i.Lk)("span",{class:(0,a.C4)(["import-matches__count",{"is-new":s.create>0}])},(0,a.v_)(e.$t(s.createsLabel,{count:s.create})),3),t[12]||(t[12]=(0,i.Lk)("span",{class:"import-sheet__sep"},"·",-1)),(0,i.Lk)("span",{class:(0,a.C4)(["import-matches__count",{"is-unmatched":s.unmatched>0}])},(0,a.v_)(e.$t("{count} unmatched",{count:s.unmatched})),3)])]))),128))],2)):(0,i.Q3)("",!0),(0,i.Lk)("div",A,[(0,i.Lk)("div",D,[(0,i.Lk)("div",O,[(0,i.Lk)("table",W,[(0,i.Lk)("thead",null,[(0,i.Lk)("tr",null,[t[13]||(t[13]=(0,i.Lk)("th",{class:"import-sheet__gutter import-sheet__gutter--head"},null,-1)),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ve.preview.headers,t=>((0,i.uX)(),(0,i.CE)("th",{key:t.key,class:(0,a.C4)(["import-sheet__head",{"is-selected":t.key===ve.selectedKey}])},[(0,i.Lk)("button",{type:"button",class:"import-sheet__head-btn",title:t.raw,"aria-pressed":t.key===ve.selectedKey,"data-column":t.key,onClick:e=>ye.selectColumn(t.key)},[(0,i.Lk)("span",U,(0,a.v_)(t.raw),1),(0,i.Lk)("span",V,(0,a.v_)(ye.destinationSummary(t.key)),1),(0,i.Lk)("span",K,[(0,i.Lk)("span",{class:(0,a.C4)(["tag is-rounded is-small",ye.statusTag(t.key).type])},(0,a.v_)(e.$t(ye.statusTag(t.key).label)),3),ve.suggested[t.key]?((0,i.uX)(),(0,i.CE)("span",Q,(0,a.v_)(e.$t("Suggested")),1)):(0,i.Q3)("",!0)])],8,N)],2))),128))])]),(0,i.Lk)("tbody",null,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ye.visibleRows,(t,s)=>((0,i.uX)(),(0,i.CE)("tr",{key:s},[(0,i.Lk)("th",z,(0,a.v_)(s+1),1),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ve.preview.headers,l=>((0,i.uX)(),(0,i.CE)("td",{key:l.key,class:(0,a.C4)(["import-sheet__cell",{"is-selected":l.key===ve.selectedKey,"is-skipped":ye.isSkipped(l.key),"is-unmatched":"unmatched"===ye.matchClass(l.key,s),"is-new-match":"new"===ye.matchClass(l.key,s)}])},["new"===ye.matchClass(l.key,s)?((0,i.uX)(),(0,i.CE)("span",j,(0,a.v_)(e.$t("New")),1)):"unmatched"===ye.matchClass(l.key,s)?((0,i.uX)(),(0,i.CE)("span",{key:1,class:"tag is-rounded is-small is-warning is-passive import-sheet__match-tag",title:e.$t("No match in the sample: this row will fail unless the reference is completed")},(0,a.v_)(e.$t("Unmatched")),9,q)):(0,i.Q3)("",!0),ye.cellParts(l.key,t[l.key])?((0,i.uX)(),(0,i.CE)(i.FK,{key:2},["checkboxes"===ve.columns[l.key].fieldType?((0,i.uX)(),(0,i.CE)("span",B,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ye.cellParts(l.key,t[l.key]),(e,t)=>((0,i.uX)(),(0,i.CE)("span",{key:t,class:"tag is-default is-rounded is-small",title:e.raw},(0,a.v_)(e.label),9,G))),128))])):((0,i.uX)(),(0,i.CE)("span",H,[(0,i.Lk)("span",{class:"import-sheet__value",title:ye.cellParts(l.key,t[l.key])[0].label},(0,a.v_)(ye.cellParts(l.key,t[l.key])[0].label),9,J),ye.cellParts(l.key,t[l.key])[0].label!==ye.cellParts(l.key,t[l.key])[0].raw?((0,i.uX)(),(0,i.CE)("span",Y,(0,a.v_)(ye.cellParts(l.key,t[l.key])[0].raw),1)):(0,i.Q3)("",!0)]))],64)):ye.isEmptyCell(t[l.key])?((0,i.uX)(),(0,i.CE)("span",Z," â ")):((0,i.uX)(),(0,i.CE)("span",{key:4,class:"import-sheet__value",title:String(t[l.key])},(0,a.v_)(t[l.key]),9,ee))],2))),128))]))),128))])])])]),ye.hiddenRowCount>0?((0,i.uX)(),(0,i.CE)("div",te,[(0,i.bF)(_e,{size:"is-small",class:"is-rounded is-nobg",onClick:t[2]||(t[2]=e=>ve.showAllRows=!0)},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Show {count} more",{count:ye.hiddenRowCount})),1)]),_:1})])):(0,i.Q3)("",!0),(0,i.bF)(l.eB,{name:"import-panel-slide"},{default:(0,i.k6)(()=>[ye.selectedHeader&&ve.columns[ve.selectedKey]?((0,i.uX)(),(0,i.CE)("div",{key:0,class:"import-panel",role:"dialog","aria-modal":"false","aria-label":ye.selectedHeader.raw,style:(0,a.Tr)({"--import-panel-width":ve.panelWidth+"px"})},[(0,i.Lk)("div",{class:"import-panel__resizer",role:"separator","aria-orientation":"vertical","aria-label":e.$t("Resize panel"),"aria-valuenow":ve.panelWidth,"aria-valuemin":ve.PANEL_MIN_WIDTH,tabindex:"0",onPointerdown:t[3]||(t[3]=(...e)=>ye.startPanelResize&&ye.startPanelResize(...e)),onKeydown:[t[4]||(t[4]=(0,l.jR)((0,l.D$)(e=>ye.nudgePanel(-24),["prevent"]),["left"])),t[5]||(t[5]=(0,l.jR)((0,l.D$)(e=>ye.nudgePanel(24),["prevent"]),["right"]))]},null,40,ie),(0,i.Lk)("div",ae,[(0,i.Lk)("p",le,(0,a.v_)(ye.selectedHeader.raw),1),(0,i.Lk)("button",{type:"button",class:"import-panel__close","aria-label":e.$t("Close"),title:e.$t("Close"),onClick:t[6]||(t[6]=e=>ve.selectedKey=null)},[(0,i.bF)(be,{icon:"fa-light fa-xmark"})],8,re)]),(0,i.Lk)("div",ne,[((0,i.uX)(),(0,i.Wv)(we,{key:ve.selectedKey,header:ye.selectedHeader,entry:ve.columns[ve.selectedKey],stats:ve.preview.columns[ve.selectedKey]||{},"sample-values":ye.sampleValues(ve.selectedKey),"sampled-row-count":ve.preview.sampledRowCount,"system-fields":ve.preview.systemFields,"import-type":s.importType,"field-groups":ve.preview.fieldGroups||[],"used-system-fields":ye.usedSystemFieldsExcept(ve.selectedKey),"custom-fields":ve.preview.customFields,suggested:!!ve.suggested[ve.selectedKey],"field-descriptions":ve.preview.fieldDescriptions||{},"date-format":ve.options.dateFormats[ve.selectedKey]||null,onUpdate:t[7]||(t[7]=e=>ye.updateColumn(ve.selectedKey,e)),onDateFormat:t[8]||(t[8]=e=>ye.setDateFormat(ve.selectedKey,e))},null,8,["header","entry","stats","sample-values","sampled-row-count","system-fields","import-type","field-groups","used-system-fields","custom-fields","suggested","field-descriptions","date-format"]))])],12,se)):(0,i.Q3)("",!0)]),_:1})]),ve.ledgerFilter?((0,i.uX)(),(0,i.CE)("div",oe,[(0,i.Lk)("div",de,[(0,i.Lk)("p",ue,(0,a.v_)(e.$t(ye.ledgerTitle)),1),(0,i.bF)(_e,{class:"is-rounded",type:"is-text",size:"is-small",onClick:t[9]||(t[9]=e=>ye.setLedgerFilter(null))},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Close")),1)]),_:1})]),(0,i.bF)(Ce,{"import-id":s.importId,phase:"preflight",filter:ve.ledgerFilter,headers:ve.preview.headers},null,8,["import-id","filter","headers"])])):(0,i.Q3)("",!0)])):(0,i.Q3)("",!0)]),(0,i.Lk)("footer",pe,[(0,i.Lk)("div",ce,[ve.preview?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ye.requirementChips,t=>((0,i.uX)(),(0,i.CE)("span",{key:t.key,class:(0,a.C4)(["tag is-rounded is-small",t.satisfied?"is-success":"is-default"])},[(0,i.bF)(be,{icon:t.satisfied?"fa-light fa-check":"fa-light fa-circle-exclamation",class:"import-mapping-modal__chip-icon"},null,8,["icon"]),(0,i.eW)(" "+(0,a.v_)(t.satisfied?t.label:e.$t("{field} needed",{field:t.label})),1)],2))),128)),ye.duplicateList.length?((0,i.uX)(),(0,i.CE)("span",me,[(0,i.bF)(be,{icon:"fa-light fa-triangle-exclamation",class:"import-mapping-modal__chip-icon"}),(0,i.eW)(" "+(0,a.v_)(e.$t("Each system field can be filled by one column only"))+": "+(0,a.v_)(ye.duplicateList.join(", ")),1)])):(0,i.Q3)("",!0)],64)):(0,i.Q3)("",!0)]),ye.isPersonType?((0,i.uX)(),(0,i.Wv)(Ee,{key:0,class:"import-mapping-modal__existing",label:e.$t("Members that already exist"),"data-testid":"import-existing-option"},{default:(0,i.k6)(()=>[(0,i.bF)($e,{"model-value":ve.options.existing,"native-value":"skip",size:"is-small","onUpdate:modelValue":ye.setExistingOption},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Skip them")),1)]),_:1},8,["model-value","onUpdate:modelValue"]),(0,i.bF)($e,{"model-value":ve.options.existing,"native-value":"update",size:"is-small","onUpdate:modelValue":ye.setExistingOption},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Update the mapped fields")),1)]),_:1},8,["model-value","onUpdate:modelValue"])]),_:1},8,["label"])):(0,i.Q3)("",!0),(0,i.Lk)("div",he,[(0,i.bF)(_e,{class:"is-rounded",type:"is-danger",outlined:"",disabled:ve.isStarting||!ve.preview,onClick:ye.confirmDiscard},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Discard")),1)]),_:1},8,["disabled","onClick"]),(0,i.bF)(_e,{class:"is-rounded",type:"is-primary",disabled:!ye.canStart,loading:ve.isStarting,onClick:ye.start},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Start import")),1)]),_:1},8,["disabled","loading","onClick"])])])])]),_:1},8,["model-value","onUpdate:modelValue"])}s(44114),s(18111),s(81148),s(22489),s(20116),s(7588),s(61701);var ve=s(38221),ye=s.n(ve);
1const fe={class:"import-column-panel"},be={class:"import-column-panel__head"},_e={class:"import-column-panel__help"},ke={key:0,class:"tag is-rounded is-small is-info is-passive"},Le={key:0,class:"tags import-column-panel__samples"},we={key:0,class:"tag is-rounded is-small is-default"},Ce=["aria-label"],$e=["aria-pressed","onClick"],Ee={value:null,disabled:""},xe=["label"],Fe=["value","disabled"],Se=["value","disabled"],Ie={key:2,class:"is-size-7 has-text-grey import-column-panel__field-help","data-testid":"import-field-help"},Me={key:0,class:"import-column-panel__example"},Te=["value"],Xe={class:"import-column-panel__field-name"},Pe={class:"import-column-panel__field-type"},Re=["value"],Ae={key:6,class:"import-column-panel__help"},De=["aria-label"],Oe=["aria-pressed","onClick"],We={class:"import-column-panel__delimiter"},Ne={key:1,class:"import-column-panel__split"},Ue={class:"import-column-panel__eyebrow"},Ve={key:2,class:"import-column-panel__help"};function Ke(e,t,s,l,r,n){const o=(0,i.g2)("font-awesome-icon"),d=(0,i.g2)("b-field"),u=(0,i.g2)("b-select"),p=(0,i.g2)("b-tooltip"),c=(0,i.g2)("b-autocomplete"),m=(0,i.g2)("b-input"),h=(0,i.g2)("ImportValueMapTable");return(0,i.uX)(),(0,i.CE)("div",fe,[(0,i.Lk)("div",be,[(0,i.Lk)("p",_e,(0,a.v_)(e.$t("{count} of {total} sample rows have a value",{count:s.stats.nonEmpty||0,total:s.sampledRowCount})),1),s.suggested?((0,i.uX)(),(0,i.CE)("span",ke,[(0,i.bF)(o,{icon:"fa-light fa-lightbulb",class:"import-column-panel__chip-icon"}),(0,i.eW)(" "+(0,a.v_)(e.$t("Suggested")),1)])):(0,i.Q3)("",!0)]),s.sampleValues.length?((0,i.uX)(),(0,i.CE)("div",Le,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(s.sampleValues.slice(0,5),e=>((0,i.uX)(),(0,i.CE)("span",{key:e,class:"tag is-rounded is-small is-default"},(0,a.v_)(e),1))),128)),n.extraSampleCount>0?((0,i.uX)(),(0,i.CE)("span",we," +"+(0,a.v_)(n.extraSampleCount),1)):(0,i.Q3)("",!0)])):(0,i.Q3)("",!0),(0,i.bF)(d,{label:e.$t("Destination")},{default:(0,i.k6)(()=>[(0,i.Lk)("div",{class:"orgo-segmented-toggle has-label import-column-panel__destinations",role:"group","aria-label":e.$t("Destination")},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(n.destinations,t=>((0,i.uX)(),(0,i.CE)("button",{key:t.value,type:"button",class:(0,a.C4)(["orgo-segmented-option",{"is-active":n.destination===t.value}]),"aria-pressed":n.destination===t.value,onClick:e=>n.setDestination(t.value)},[(0,i.bF)(o,{icon:t.icon},null,8,["icon"]),(0,i.Lk)("span",null,(0,a.v_)(e.$t(t.label)),1)],10,$e))),128))],8,Ce)]),_:1},8,["label"]),"system"===n.destination?((0,i.uX)(),(0,i.Wv)(d,{key:1,label:e.$t("System field"),type:n.isDuplicateSystem?"is-danger":"",message:n.isDuplicateSystem?e.$t("Another column already fills this field"):""},{default:(0,i.k6)(()=>[(0,i.bF)(u,{"model-value":s.entry.field,expanded:"","onUpdate:modelValue":n.setSystemField},{default:(0,i.k6)(()=>[(0,i.Lk)("option",Ee,(0,a.v_)(e.$t("Choose a field")),1),s.fieldGroups.length?((0,i.uX)(!0),(0,i.CE)(i.FK,{key:0},(0,i.pI)(s.fieldGroups,t=>((0,i.uX)(),(0,i.CE)("optgroup",{key:t.key,label:e.$t(t.label)},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(t.fields,t=>((0,i.uX)(),(0,i.CE)("option",{key:t,value:t,disabled:s.usedSystemFields.includes(t)&&t!==s.entry.field},[(0,i.eW)((0,a.v_)(e.$t(n.systemFieldLabel(t,s.importType)))+" ",1),s.usedSystemFields.includes(t)&&t!==s.entry.field?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.eW)("("+(0,a.v_)(e.$t("already used"))+")",1)],64)):(0,i.Q3)("",!0)],8,Fe))),128))],8,xe))),128)):((0,i.uX)(!0),(0,i.CE)(i.FK,{key:1},(0,i.pI)(s.systemFields,t=>((0,i.uX)(),(0,i.CE)("option",{key:t,value:t,disabled:s.usedSystemFields.includes(t)&&t!==s.entry.field},[(0,i.eW)((0,a.v_)(e.$t(n.systemFieldLabel(t,s.importType)))+" ",1),s.usedSystemFields.includes(t)&&t!==s.entry.field?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.eW)("("+(0,a.v_)(e.$t("already used"))+")",1)],64)):(0,i.Q3)("",!0)],8,Se))),128))]),_:1},8,["model-value","onUpdate:modelValue"])]),_:1},8,["label","type","message"])):(0,i.Q3)("",!0),"system"===n.destination&&n.fieldHelp?((0,i.uX)(),(0,i.CE)("p",Ie,[(0,i.eW)((0,a.v_)(n.fieldHelp.description)+" ",1),n.fieldHelp.example?((0,i.uX)(),(0,i.CE)("span",Me,(0,a.v_)(e.$t("Example: {example}",{example:n.fieldHelp.example})),1)):(0,i.Q3)("",!0)])):(0,i.Q3)("",!0),n.isDateField?((0,i.uX)(),(0,i.Wv)(d,{key:3,label:e.$t("Date format"),type:n.isAmbiguousDate?"is-warning":"",message:n.isAmbiguousDate?e.$t("Ambiguous, please choose"):"","data-testid":"import-date-format"},{default:(0,i.k6)(()=>[(0,i.bF)(u,{"model-value":n.selectedDateFormat,expanded:"","onUpdate:modelValue":n.setDateFormat},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(r.dateFormats,t=>((0,i.uX)(),(0,i.CE)("option",{key:t.value,value:t.value},(0,a.v_)(t.sample)+" ("+(0,a.v_)(e.$t(t.order))+") ",9,Te))),128))]),_:1},8,["model-value","onUpdate:modelValue"])]),_:1},8,["label","type","message"])):(0,i.Q3)("",!0),"existing"===n.destination?((0,i.uX)(),(0,i.Wv)(d,{key:4,label:e.$t("Existing custom field"),message:n.selectedCustomField?e.$t("Type")+": "+e.$t(r.fieldTypeLabels[n.selectedCustomField.fieldType]||n.selectedCustomField.fieldType):""},{default:(0,i.k6)(()=>[(0,i.bF)(c,{modelValue:r.existingSearch,"onUpdate:modelValue":t[0]||(t[0]=e=>r.existingSearch=e),data:n.filteredCustomFields,field:"name","open-on-focus":"","keep-first":"",clearable:"",placeholder:e.$t("Search your profile fields"),onSelect:n.setExistingField},{default:(0,i.k6)(t=>
1[(0,i.Lk)("div",{class:(0,a.C4)(["import-column-panel__field-option",{"is-disabled":t.option.isEncrypted}])},[(0,i.Lk)("span",Xe,(0,a.v_)(t.option.name),1),(0,i.Lk)("span",Pe,(0,a.v_)(e.$t(r.fieldTypeLabels[t.option.fieldType]||t.option.fieldType)),1),t.option.isEncrypted?((0,i.uX)(),(0,i.Wv)(p,{key:0,label:e.$t("Encrypted fields cannot be filled by an import"),position:"is-left"},{default:(0,i.k6)(()=>[(0,i.bF)(o,{icon:"fa-light fa-lock"})]),_:1},8,["label"])):(0,i.Q3)("",!0)],2)]),empty:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("No matching field")),1)]),_:1},8,["modelValue","data","placeholder","onSelect"])]),_:1},8,["label","message"])):(0,i.Q3)("",!0),"new"===n.destination?((0,i.uX)(),(0,i.CE)(i.FK,{key:5},[(0,i.bF)(d,{label:e.$t("Field name")},{default:(0,i.k6)(()=>[(0,i.bF)(m,{"model-value":s.entry.name,"onUpdate:modelValue":n.setName},null,8,["model-value","onUpdate:modelValue"])]),_:1},8,["label"]),(0,i.bF)(d,{label:e.$t("Field type")},{default:(0,i.k6)(()=>[(0,i.bF)(u,{"model-value":s.entry.fieldType,expanded:"","onUpdate:modelValue":n.setFieldType},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(r.fieldTypes,t=>((0,i.uX)(),(0,i.CE)("option",{key:t,value:t},(0,a.v_)(e.$t(r.fieldTypeLabels[t])),9,Re))),128))]),_:1},8,["model-value","onUpdate:modelValue"])]),_:1},8,["label"])],64)):(0,i.Q3)("",!0),"skip"===n.destination?((0,i.uX)(),(0,i.CE)("p",Ae,(0,a.v_)(e.$t("This column is left out of the import.")),1)):(0,i.Q3)("",!0),n.isChoice?((0,i.uX)(),(0,i.CE)(i.FK,{key:7},["checkboxes"===s.entry.fieldType?((0,i.uX)(),(0,i.Wv)(d,{key:0,label:e.$t("Values in a cell are separated by")},{default:(0,i.k6)(()=>[(0,i.Lk)("div",{class:"orgo-segmented-toggle has-label",role:"group","aria-label":e.$t("Values in a cell are separated by")},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(r.delimiters,t=>((0,i.uX)(),(0,i.CE)("button",{key:t.value,type:"button",class:(0,a.C4)(["orgo-segmented-option",{"is-active":(s.entry.delimiter||",")===t.value}]),"aria-pressed":(s.entry.delimiter||",")===t.value,onClick:e=>n.setDelimiter(t.value)},[(0,i.Lk)("span",We,(0,a.v_)(t.value),1),(0,i.Lk)("span",null,(0,a.v_)(e.$t(t.label)),1)],10,Oe))),128))],8,De)]),_:1},8,["label"])):(0,i.Q3)("",!0),"checkboxes"===s.entry.fieldType&&n.splitPreview.length?((0,i.uX)(),(0,i.CE)("div",Ne,[(0,i.Lk)("p",Ue,(0,a.v_)(e.$t("Split preview")),1),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(n.splitPreview,(e,t)=>((0,i.uX)(),(0,i.CE)("div",{key:t,class:"tags import-column-panel__split-row"},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(e,e=>((0,i.uX)(),(0,i.CE)("span",{key:e,class:"tag is-rounded is-small is-default"},(0,a.v_)(e),1))),128))]))),128))])):(0,i.Q3)("",!0),(0,i.bF)(d,{label:e.$t("Match values to options")},{default:(0,i.k6)(()=>[((0,i.uX)(),(0,i.Wv)(h,{key:n.tableKey,mode:s.entry.fieldId?"existing":"new",values:n.choiceValues,options:n.choiceOptions,"value-map":s.entry.valueMap||{},onUpdate:n.setValueMap},null,8,["mode","values","options","value-map","onUpdate"]))]),_:1},8,["label"]),s.stats.distinctTruncated?((0,i.uX)(),(0,i.CE)("p",Ve,(0,a.v_)(e.$t("Only the first 100 distinct values are shown. Values the sample missed are added as new options during the import.")),1)):(0,i.Q3)("",!0)],64)):(0,i.Q3)("",!0)])}const Qe={class:"import-value-map"},ze={key:0,class:"list-empty-state import-value-map__empty"},je={class:"list-empty-state-message"},qe={key:1,class:"orgo-table-wrap"},Be={class:"import-value-map__cell"},Ge=["title"],He={class:"tag is-rounded is-small is-default"},Je=["value"],Ye=["value"],Ze={key:1,class:"import-value-map__cell"},et=["value"],tt=["value"];function st(e,t,s,l,r,n){const o=(0,i.g2)("font-awesome-icon"),d=(0,i.g2)("b-table-column"),u=(0,i.g2)("b-select"),p=(0,i.g2)("b-input"),c=(0,i.g2)("b-table");return(0,i.uX)(),(0,i.CE)("div",Qe,[n.rows.length?((0,i.uX)(),(0,i.CE)("div",qe,[(0,i.bF)(c,{data:n.rows,"mobile-cards":!1,narrowed:"",hoverable:""},{default:(0,i.k6)(()=>[(0,i.bF)(d,{label:e.$t("Value in file"),field:"value"},{default:(0,i.k6)(e=>[(0,i.Lk)("span",Be,[(0,i.Lk)("span",{class:"import-value-map__value",title:e.row.value},(0,a.v_)(e.row.value),9,Ge),(0,i.Lk)("span",He,(0,a.v_)(e.row.count),1)])]),_:1},8,["label"]),(0,i.bF)(d,{label:"new"===s.mode?e.$t("Option label"):e.$t("Option"),field:"target"},{default:(0,i.k6)(t=>["new"===s.mode?((0,i.uX)(),(0,i.CE)("div",{key:0,class:(0,a.C4)(["import-value-map__cell is-stacked",{"is-merged":!n.ownsOption(t.row)}])},[(0,i.bF)(u,{"model-value":n.targetFor(t.row),size:"is-small",expanded:"","onUpdate:modelValue":e=>n.setTarget(t.row,e)},{default:(0,i.k6)(()=>[(0,i.Lk)("option",{value:n.ownKey(t.row)||r.OWN},(0,a.v_)(e.$t("Own option")),9,Je),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(n.mergeCandidates(t.row),t=>((0,i.uX)(),(0,i.CE)("option",{key:t.key,value:t.key},(0,a.v_)(e.$t("Merge into"))+": "+(0,a.v_)(t.label),9,Ye))),128))]),_:2},1032,["model-value","onUpdate:modelValue"]),n.ownsOption(t.row)?((0,i.uX)(),(0,i.Wv)(p,{key:0,"model-value":r.localOptions[n.ownKey(t.row)],size:"is-small",expanded:"","onUpdate:modelValue":e=>n.setLabel(t.row,e)},null,8,["model-value","onUpdate:modelValue"])):(0,i.Q3)("",!0)],2)):((0,i.uX)(),(0,i.CE)("div",Ze,[(0,i.bF)(u,{"model-value":n.targetFor(t.row),size:"is-small",expanded:"","onUpdate:modelValue":e=>n.setTarget(t.row,e)},{default:(0,i.k6)(()=>[(0,i.Lk)("option",{value:r.CREATE_NEW},(0,a.v_)(e.$t("Create new option")),9,et),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(n.existingOptionList,e=>((0,i.uX)(),(0,i.CE)("option",{key:e.key,value:e.key},(0,a.v_)(e.label),9,tt))),128))]),_:1},8,["model-value","onUpdate:modelValue"])]))]),_:1},8,["label"])]),_:1},8,["data"])])):((0,i.uX)(),(0,i.CE)("div",ze,[(0,i.bF)(o,{icon:"fa-light fa-list-check",class:"list-empty-state-icon"}),(0,i.Lk)("p",je,(0,a.v_)(e.$t("No values found in the sample rows")),1
1)]))])}s(18237),s(13579),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);const it=["radio","dropdown","checkboxes"],at=["input","textarea","number","date","boolean","dropdown","radio","checkboxes"],lt=[",",";","|"],rt=[{value:"Y-m-d",sample:"2026-03-09",order:"year, month, day"},{value:"d/m/Y",sample:"09/03/2026",order:"day, month, year"},{value:"m/d/Y",sample:"03/09/2026",order:"month, day, year"},{value:"d.m.Y",sample:"09.03.2026",order:"day, month, year"},{value:"d-m-Y",sample:"09-03-2026",order:"day, month, year"}],nt=["date","datetime"];function ot(e){return String(e??"").trim().replace(/\s+/g," ").toLowerCase()}function dt(e){return it.includes(e)}function ut(e,t,s){const i=[];let a="",l=!1,r=-1;for(let n=0;n<e.length;n++){const o=e[n];l?'"'===o?'"'===e[n+1]?(a+='"',n++):l=!1:a+=o:'"'!==o||""!==a.trim()||n===s?o!==t?a+=o:(i.push(a),a=""):(l=!0,r=n,a="")}return l?ut(e,t,r):(i.push(a),i)}function pt(e,t){if(null===e||void 0===e)return[];const s=String(e);if(!t){const e=s.trim();return""===e?[]:[e]}return ut(s,t,-1).map(e=>e.trim()).filter(e=>""!==e)}function ct(e,t,s){const i=e||[];if("checkboxes"!==t)return i.map(e=>({value:String(e.value),count:e.count}));const a=new Map;return i.forEach(e=>{pt(e.value,s).forEach(t=>{const s=ot(t),i=a.get(s);i?i.count+=e.count:a.set(s,{value:t,count:e.count})})}),Array.from(a.values()).sort((e,t)=>t.count-e.count)}function mt(e){const t={},s={};return e.forEach((e,i)=>{const a=String(i+1);t[a]=e.value,s[ot(e.value)]=a}),{options:t,valueMap:s}}function ht(e,t){const s={};Object.entries(t||{}).forEach(([e,t])=>{s[ot(t)]=String(e)});const i={};return e.forEach(e=>{const t=ot(e.value);void 0!==s[t]&&(i[t]=s[t])}),i}function gt(e){let t=",",s=0;return lt.forEach(i=>{const a=(e||[]).reduce((e,t)=>e+(String(t.value).includes(i)?t.count:0),0);a>s&&(t=i,s=a)}),t}function vt(e,t,s){const i=t?.suggestion||{target:"custom_field",fieldId:null,fieldType:"input",delimiter:null};if("system"===i.target)return{target:"system",field:i.field};if("skip"===i.target)return{target:"skip"};const a=i.fieldType||"input";if(i.fieldId){const e=s[i.fieldId],l=e?e.fieldType:a,r={target:"custom_field",fieldId:i.fieldId,fieldType:l,valueMap:{},delimiter:"checkboxes"===l?i.delimiter||gt(t?.distinct):null};if(dt(r.fieldType)){const s=ct(t?.distinct,r.fieldType,r.delimiter);r.valueMap=ht(s,e?.fieldOptions?.options)}return r}const l="checkboxes"===a?i.delimiter||gt(t?.distinct):null,r={target:"custom_field",fieldId:null,name:e.raw,fieldType:a,options:{},valueMap:{},delimiter:l};if(dt(a)){const e=ct(t?.distinct,a,l);Object.assign(r,mt(e))}return r}function yt(e){if(e.mapping&&"object"===typeof e.mapping&&Object.keys(e.mapping).length>0)return{columns:JSON.parse(JSON.stringify(e.mapping)),suggested:{}};const t={};(e.customFields||[]).forEach(e=>{t[e.id]=e});const s={},i={};return(e.headers||[]).forEach(a=>{s[a.key]=vt(a,e.columns?.[a.key],t),i[a.key]=!0}),{columns:s,suggested:i}}function ft(e){const t={};return Object.entries(e||{}).forEach(([e,s])=>{"system"===s?.target&&s.field&&(t[s.field]=t[s.field]||[],t[s.field].push(e))}),Object.fromEntries(Object.entries(t).filter(([,e])=>e.length>1))}function bt(e){const t=new Set;return Object.values(e||{}).forEach(e=>{"system"===e?.target&&e.field&&t.add(e.field)}),t}function _t(e,t){const s=[];let i=!1;return(t||[]).forEach(t=>{const a=t.filter(t=>!e.has(t));0===a.length?i=!0:s.push(a)}),{ready:i,missingGroups:i?[]:s}}function kt(e,t,s){const i=bt(e),a=s&&"object"===typeof s&&!Array.isArray(s)?s:{},l=Object.keys(a);if(l.length>0){const e={};let t=!0;return l.forEach(s=>{const l=_t(i,a[s]);l.ready||(t=!1,e[s]=l.missingGroups)}),{ready:t,missingGroups:Object.values(e).flat(),missingByGroup:e}}const r=t||[];if(0===r.length)return{ready:!0,missingGroups:[],missingByGroup:{}};const n=_t(i,r);return{ready:n.ready,missingGroups:n.missingGroups,missingByGroup:n.ready?{}:{default:n.missingGroups}}}function Lt(e,t){return t&&Array.isArray(e)&&e.find(e=>Array.isArray(e.fields)&&e.fields.includes(t))||null}function wt(e,t,s,i,a){const l=s?.[i];if(!e||!l||"system"!==l.target||!l.field)return null;const r=Lt(t,l.field),n=r?e[r.key]:null;if(!n||!Array.isArray(n.rows))return null;const o=n.rows.find(e=>e.index===a);return o?o.status:null}const Ct={email:"Email",first_name:"First name",last_name:"Last name",name:"Name",phone:"Phone",phone_number:"Phone number",address:"Address",postal_code:"Postal code",town:"Town",town_residence:"Town of residence",country:"Country",website:"Website",gender:"Gender",birth_date:"Birth date",status:"Status",tags:"Tags",member_id:"Member ID",company_name:"Company name",company_identifier:"C
1ompany identifier",company_address:"Company address",company_reg_no:"Company registration number",company_position:"Company position",organisation:"Organisation",role:"Role",badge_type:"Badge type",badge_type_legacy_id:"Badge type legacy ID",badge_type_id:"Badge type legacy ID",badge_name:"Badge",badge_legacy_id:"Badge legacy ID",concluded_at:"Awarded on",points_at_award:"Points",comment_user:"Member comment",comment_master:"Reviewer comment",badge_user_legacy_id:"Award legacy ID",profession_headline:"Profession headline",profession_organisation:"Current organisation",profession_organisation_role:"Role at organisation",profession_organisation_website:"Organisation website",linkedin:"LinkedIn",twitter:"Twitter",instagram:"Instagram",is_full_member:"Full member",is_newsletter_subscribed:"Newsletter subscribed",date_created:"Date created",date_joined:"Date joined",date_joined_full_member:"Date joined as full member",local_center:"Chapter",local_center_legacy_id:"Chapter legacy ID",user_legacy_id:"Legacy ID",event_name:"Event name",event_datetime:"Event date",chapter:"Chapter",event_legacy_id:"Event legacy ID",attendee_email:"Attendee email",attendee_name:"Attendee name",attendee_organisation:"Attendee organisation",role_name:"Role name",role_legacy_id:"Role legacy ID",unit_name:"Unit name",unit_legacy_id:"Unit legacy ID",start_date:"Start date",end_date:"End date",is_admin:"Unit admin",short_name:"Short name",is_parent:"Is parent",parent:"Parent chapter",google_place_name:"Place name",google_latitude:"Latitude",google_longitude:"Longitude",contact_full_name:"Contact name",contact_email:"Contact email",contact_phone:"Contact phone",facebook_url:"Facebook URL",iban_eur:"IBAN",datetime_begin:"Begins",datetime_end:"Ends",event_type:"Event type",location_name:"Location",google_place_latitude:"Latitude",google_place_longitude:"Longitude",is_training:"Training",is_public:"Public",owner_user_legacy_id:"Owner legacy ID",description:"Description",timezone:"Timezone",type:"Type",month_period:"Months per period",has_subscription:"Subscription",has_one_time_payment:"One-time payment",is_archived:"Archived",product_legacy_id:"Product legacy ID",product_price_legacy_id:"Price tier legacy ID",previous_version_old_id:"Previous version legacy ID",price:"Price",is_default:"Default tier",is_subscription:"Subscription tier",is_lifetime:"Lifetime",is_restricted:"Restricted",valid_from:"Valid from",valid_to:"Valid to",is_user_type:"Member type",is_organizational:"Organisational role",is_local_center:"Chapter role",is_local_center_parent:"Parent chapter role",parent_unit:"Parent unit",parent_unit_legacy_id:"Parent unit legacy ID",legal_name:"Legal name",registration_number:"Registration number",vat_number:"VAT number",valid_fee_date:"Membership valid until",fee_tenant_product_price_id:"Fee price tier",company_legacy_id:"Company legacy ID",company_user_legacy_id:"Membership legacy ID",user_type_legacy_id:"Member type (name or legacy ID)",fee_tenant_product_price_legacy_id:"Fee price legacy ID",payer_email:"Payer email",payer_name:"Payer name",payer_organisation:"Payer organisation",payer_personal_number:"Payer personal number",product_name:"Product name",product_type:"Product type",price_name:"Price tier name",amount:"Amount",currency:"Currency",period_start:"Period start",period_end:"Period end",comment_by_user:"Comment",payment_legacy_id:"Payment legacy ID"},$t={user:{role:"Roles to assign"},"user-modify":{role:"Roles to assign"}};function Et(e,t){if(!e)return"";const s=t&&$t[t];if(s&&s[e])return s[e];if(Ct[e])return Ct[e];const i=String(e).replace(/_/g," ").trim();return i.charAt(0).toUpperCase()+i.slice(1)}function xt(e,t){return e&&"skip"!==e.target?"system"===e.target?!e.field||t[e.field]?"attention":"system":e.pendingExisting?"attention":e.fieldId?"existing":"new":"skipped"}function Ft(e){const t={};return Object.entries(e||{}).forEach(([e,s])=>{if(s)if("system"===s.target)t[e]={target:"system",field:s.field};else if("skip"===s.target||s.pendingExisting)t[e]={target:"skip"};else{const i={target:"custom_field",fieldId:s.fieldId||null,fieldType:s.fieldType,valueMap:s.valueMap||{},delimiter:"checkboxes"===s.fieldType?s.delimiter||",":null};s.fieldId||(i.name=s.name,i.options=dt(s.fieldType)&&s.options||{}),t[e]=i}}),t}function St(e,t,s){if(!e||"custom_field"!==e.target||!dt(e.fieldType))return null;const i="checkboxes"===e.fieldType?e.delimiter||",":null,a=pt(s,i||null);if(0===a.length)return null;const l={};Object.entries(t||{}
1).forEach(([e,t])=>{l[ot(t)]=String(e)});const r=e.valueMap||{};return a.map(e=>{const s=ot(e);let i=void 0!==r[s]&&null!==r[s]?String(r[s]):null;null!==i&&void 0!==t?.[i]||(i=void 0!==l[s]?l[s]:null);const a=null!==i&&void 0!==t?.[i]?String(t[i]):e;return{raw:e,label:a,resolved:null!==i}})}const It="__create__",Mt="__own__";var Tt={name:"ImportValueMapTable",props:{mode:{type:String,required:!0,validator:e=>["new","existing"].includes(e)},values:{type:Array,default:()=>[]},options:{type:Object,default:()=>({})},valueMap:{type:Object,default:()=>({})}},emits:["update"],data(){return{CREATE_NEW:It,OWN:Mt,localOptions:{...this.options||{}},localValueMap:{...this.valueMap||{}},owners:{}}},computed:{rows(){return(this.values||[]).map(e=>({...e,norm:ot(e.value)}))},existingOptionList(){return Object.entries(this.options||{}).map(([e,t])=>({key:String(e),label:t}))}},created(){this.reload()},methods:{reload(){this.localOptions={...this.options||{}},this.localValueMap={...this.valueMap||{}},this.owners="new"===this.mode?this.computeOwners():{}},computeOwners(){const e={},t={};return this.rows.forEach(s=>{e[s.norm]=null;const i=this.localValueMap[s.norm];void 0!==i&&null!==i&&void 0!==this.localOptions[i]&&(t[i]=t[i]||[],t[i].push(s))}),Object.entries(t).forEach(([t,s])=>{const i=ot(this.localOptions[t]),a=s.find(e=>e.norm===i)||s[0];e[a.norm]=String(t)}),e},ownKey(e){const t=this.owners[e.norm];return void 0===t?null:t},ownsOption(e){return"new"===this.mode&&this.targetFor(e)===this.ownKey(e)&&null!==this.ownKey(e)},targetFor(e){const t=this.localValueMap[e.norm];return void 0!==t&&null!==t?String(t):"new"===this.mode?this.ownKey(e):It},mergeCandidates(e){const t=this.ownKey(e);return Object.entries(this.localOptions).filter(([s])=>s!==t&&this.isOptionInUse(s,e)).map(([e,t])=>({key:e,label:t}))},isOptionInUse(e,t){return this.rows.some(s=>s.norm!==t.norm&&this.targetFor(s)===e)},setTarget(e,t){if("existing"===this.mode&&t===It)return delete this.localValueMap[e.norm],this.localValueMap={...this.localValueMap},void this.emitUpdate();if("new"===this.mode&&(t===this.ownKey(e)||t===Mt)){let t=this.ownKey(e);return null!==t&&void 0!==this.localOptions[t]||(t=this.nextKey(),this.localOptions={...this.localOptions,[t]:e.value},this.owners={...this.owners,[e.norm]:t}),this.localValueMap={...this.localValueMap,[e.norm]:t},void this.emitUpdate()}this.localValueMap={...this.localValueMap,[e.norm]:String(t)},this.emitUpdate()},setLabel(e,t){const s=this.ownKey(e);null!==s&&(this.localOptions={...this.localOptions,[s]:t},this.emitUpdate())},nextKey(){const e=Object.keys(this.localOptions).map(e=>Number(e)).filter(Number.isFinite).reduce((e,t)=>Math.max(e,t),0);return String(e+1)},emitUpdate(){if("existing"===this.mode)return void this.$emit("update",{options:null,valueMap:{...this.localValueMap}});const e=new Set(Object.values(this.localValueMap)),t={};Object.entries(this.localOptions).forEach(([s,i])=>{e.has(s)&&(t[s]=i)}),this.$emit("update",{options:t,valueMap:{...this.localValueMap}})}}},Xt=s(66262);const Pt=(0,Xt.A)(Tt,[["render",st],["__scopeId","data-v-554e08c3"]]);var Rt=Pt,At={name:"ImportColumnPanel",components:{ImportValueMapTable:Rt},props:{header:{type:Object,required:!0},entry:{type:Object,required:!0},stats:{type:Object,default:()=>({})},sampleValues:{type:Array,default:()=>[]},sampledRowCount:{type:Number,default:0},systemFields:{type:Array,default:()=>[]},importType:{type:String,default:""},fieldGroups:{type:Array,default:()=>[]},usedSystemFields:{type:Array,default:()=>[]},customFields:{type:Array,default:null},suggested:{type:Boolean,default:!1},fieldDescriptions:{type:Object,default:()=>({})},dateFormat:{type:String,default:null}},emits:["update","date-format"],data(){return{existingSearch:this.entry.fieldId?this.customFieldName(this.entry.fieldId):"",fieldTypes:at,fieldTypeLabels:{input:"Text",textarea:"Long text",number:"Number",date:"Date",boolean:"Yes / No",dropdown:"Dropdown",radio:"Single choice",checkboxes:"Multiple choice"},dateFormats:rt,delimiters:[{value:",",label:"Comma"},{value:";",label:"Semicolon"},{value:"|",label:"Pipe"}]}},computed:{destinations(){const e=[{value:"system",label:"System field",icon:"fa-light fa-table-columns"},{value:"existing",label:"Existing field",icon:"fa-light fa-list-check"},{value:"new",label:"New field",icon:"fa-light fa-plus"},{value:"skip",label:"Skip",icon:"fa-light fa-ban"}];return this.hasCustomFields?e:e.filter(e=>
1"system"===e.value||"skip"===e.value)},hasCustomFields(){return Array.isArray(this.customFields)},destination(){return"system"===this.entry.target?"system":"skip"===this.entry.target?"skip":this.entry.fieldId||this.entry.pendingExisting?"existing":"new"},fieldHelp(){return"system"===this.entry.target&&this.entry.field&&this.fieldDescriptions[this.entry.field]||null},isDateField(){return!!this.fieldHelp&&nt.includes(this.fieldHelp.kind)},isAmbiguousDate(){return!!this.stats.dateFormat?.ambiguous},selectedDateFormat(){return this.dateFormat||this.stats.dateFormat?.detected||rt[0].value},extraSampleCount(){const e=Number(this.stats.distinct?.length)||0;return Math.max(0,e-Math.min(5,this.sampleValues.length))},isDuplicateSystem(){return"system"===this.entry.target&&this.usedSystemFields.includes(this.entry.field)},isChoice(){return"custom_field"===this.entry.target&&dt(this.entry.fieldType)},selectedCustomField(){return(this.customFields||[]).find(e=>e.id===this.entry.fieldId)||null},filteredCustomFields(){const e=(this.existingSearch||"").toLowerCase();return(this.customFields||[]).filter(t=>!e||t.name.toLowerCase().includes(e))},choiceValues(){return ct(this.stats.distinct,this.entry.fieldType,this.entry.delimiter)},choiceOptions(){return this.entry.fieldId?this.selectedCustomField?.fieldOptions?.options||{}:this.entry.options||{}},tableKey(){return[this.header.key,this.entry.fieldId||"new",this.entry.fieldType,this.entry.delimiter||""].join(":")},splitPreview(){return this.sampleValues.slice(0,3).map(e=>pt(e,this.entry.delimiter||",")).filter(e=>e.length>0)}},methods:{systemFieldLabel:Et,customFieldName(e){const t=(this.customFields||[]).find(t=>t.id===e);return t?t.name:""},emitEntry(e){this.$emit("update",e)},setDestination(e){e!==this.destination&&("existing"!==e&&"new"!==e||this.hasCustomFields)&&("system"===e?this.emitEntry({target:"system",field:null}):"skip"===e?this.emitEntry({target:"skip"}):"existing"===e?(this.existingSearch="",this.emitEntry({target:"custom_field",fieldId:null,fieldType:"input",valueMap:{},delimiter:null,pendingExisting:!0})):this.emitEntry(this.freshNewEntry("input")))},setSystemField(e){this.emitEntry({target:"system",field:e})},setExistingField(e){if(!e||e.isEncrypted)return;const t={target:"custom_field",fieldId:e.id,fieldType:e.fieldType,valueMap:{},delimiter:"checkboxes"===e.fieldType?this.entry.delimiter||",":null};if(dt(e.fieldType)){const s=ct(this.stats.distinct,e.fieldType,t.delimiter);t.valueMap=ht(s,e.fieldOptions?.options||{})}this.emitEntry(t)},setName(e){this.emitEntry({...this.entry,name:e})},setFieldType(e){this.emitEntry(this.freshNewEntry(e))},freshNewEntry(e){const t="checkboxes"===e?this.entry.delimiter||",":null,s={target:"custom_field",fieldId:null,name:this.entry.name||this.header.raw,fieldType:e,options:{},valueMap:{},delimiter:t};return dt(e)&&Object.assign(s,mt(ct(this.stats.distinct,e,t))),s},setDelimiter(e){if(!lt.includes(e))return;const t=ct(this.stats.distinct,"checkboxes",e);if(this.entry.fieldId){const s=this.selectedCustomField?.fieldOptions?.options||{};return void this.emitEntry({...this.entry,delimiter:e,valueMap:ht(t,s)})}this.emitEntry({...this.entry,delimiter:e,...mt(t)})},setDateFormat(e){this.$emit("date-format",e)},setValueMap({options:e,valueMap:t}){const s={...this.entry,valueMap:t};null===e||this.entry.fieldId||(s.options=e),this.emitEntry(s)}}};const Dt=(0,Xt.A)(At,[["render",Ke],["__scopeId","data-v-1161fa38"]]);var Ot=Dt,Wt=s(95875);const Nt={key:0,class:"import-preflight","data-testid":"import-preflight"},Ut={key:0,class:"import-preflight__progress"},Vt={class:"import-preflight__eyebrow"},Kt={class:"import-preflight__bar-bg"},Qt={key:1,class:"import-preflight__eyebrow"},zt={key:2,class:"import-preflight__eyebrow"},jt={key:3,class:"notification is-danger is-light import-preflight__errors"},qt={class:"import-preflight__errors-title"},Bt={key:0},Gt={class:"import-preflight__tiles"},Ht=["aria-pressed","data-outcome","onClick"],Jt={class:"import-preflight__count"},Yt={class:"import-preflight__label"},Zt={key:0,class:"import-preflight__note"};function es(e,t,s,l,r,n){return"none"!==n.state?((0,i.uX)(),(0,i.CE)("div",Nt,["running"===n.state?((0,i.uX)(),(0,i.CE)("div",Ut,[(0,i.Lk)("p",Vt,(0,a.v_)(e.$t("Checking {count} rows...",{count:s.total})),1),(0,i.Lk)("div",Kt,[(0,i.Lk)("div",{class:"import-preflight__bar-fill",style:(0,a.Tr)({width:n.progressWidth})},null,4)])])):"queued"===n.state?((0,i.uX)(),(0,i.CE)("p",Qt,(0,a.v_)(e.$t("Waiting behind another import")),1)):"stale"===n.state?((0,i.uX)(),(0,i.CE)("p",zt,(0,a.v_)(e.$t("Mapping changed, checking again...")),1)):"failed"===n.state?((0,i.uX)(),(0,i.CE)("div",jt,[(0,i.Lk)("p",qt,(0,a.v_)(e.$t("The check could not finish")),1),s.val
1idationErrors.length?((0,i.uX)(),(0,i.CE)("ul",Bt,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(s.validationErrors,(e,t)=>((0,i.uX)(),(0,i.CE)("li",{key:t},(0,a.v_)(e),1))),128))])):(0,i.Q3)("",!0)])):((0,i.uX)(),(0,i.CE)(i.FK,{key:4},[(0,i.Lk)("div",Gt,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(n.tiles,t=>((0,i.uX)(),(0,i.CE)("button",{key:t.key,type:"button",class:(0,a.C4)(["import-preflight__tile",[t.tone,{"is-active":n.isActive(t)}]]),"aria-pressed":n.isActive(t),"data-outcome":t.key,onClick:e=>n.toggle(t)},[(0,i.Lk)("span",Jt,(0,a.v_)(t.count),1),(0,i.Lk)("span",Yt,(0,a.v_)(e.$t(t.label)),1)],10,Ht))),128))]),n.isRowByRowType?((0,i.uX)(),(0,i.CE)("p",Zt,(0,a.v_)(e.$t("Create counts are an upper bound for this type")),1)):(0,i.Q3)("",!0)],64))])):(0,i.Q3)("",!0)}const ts=[{key:"create",label:"Will be created",count:"create",filter:{outcome:"create"},tone:"is-create"},{key:"update",label:"Will be updated",count:"update",filter:{outcome:"update"},tone:"is-update"},{key:"skip",label:"Will be skipped",count:"skip",filter:{status:"skipped"},tone:"is-skip"},{key:"fail",label:"Will fail",count:"fail",filter:{status:"error"},tone:"is-fail"},{key:"warning",label:"With warnings",count:"warning",filter:{status:"warning"},tone:"is-warning"}],ss=["local-center","unit","role","badge-type","badge"];var is={name:"ImportPreflightStrip",props:{preflight:{type:Object,default:null},mappingRevision:{type:Number,default:null},validationErrors:{type:Array,default:()=>[]},total:{type:Number,default:0},progress:{type:Number,default:0},activeFilter:{type:Object,default:null},isQueued:{type:Boolean,default:!1},importType:{type:String,default:""}},emits:["filter"],computed:{state(){const e=this.preflight?.status||"none";return this.isQueued&&"failed"!==e?"queued":"running"===e||"failed"===e?e:"ready"===e?null!==this.mappingRevision&&this.preflight.revision!==this.mappingRevision?"stale":"ready":"stale"===e?"stale":"none"},tiles(){const e=this.preflight?.counts||{};return ts.map(t=>({...t,count:e[t.count]||0}))},progressWidth(){return this.total?Math.min(100,Math.round(this.progress/this.total*100))+"%":"0%"},isRowByRowType(){return ss.includes(this.importType)}},methods:{isActive(e){const t=this.activeFilter;return!!t&&Object.keys(e.filter).every(s=>t[s]===e.filter[s])},toggle(e){this.$emit("filter",this.isActive(e)?null:{...e.filter})}}};const as=(0,Xt.A)(is,[["render",es],["__scopeId","data-v-3231f710"]]);var ls=as;const rs={user:"Users",contact:"Contacts","user-modify":"Modify Users","contact-modify":"Modify Contacts","product-payment":"Product Payments","event-attend":"Event Attendance","user-role":"User Roles","local-center":"Local Centers",event:"Events",product:"Products","product-price":"Product Prices",role:"Roles",unit:"Units",company:"Companies","company-user":"Company Members","user-list-members":"List members","badge-type":"Badge Types",badge:"Badges","badge-user":"Badge Assignments"},ns={fields:"Required fields",default:"Required"},os={contact:"{count} new contacts",product:"{count} new products",product_price:"{count} new price tiers",event:"{count} new events",company:"{count} new companies"},ds={system:{label:"System field",type:"is-success is-passive"},existing:{label:"Existing field",type:"is-primary is-passive"},new:{label:"New field",type:"is-info is-passive"},skipped:{label:"Skipped",type:"is-default"},attention:{label:"Needs attention",type:"is-warning is-passive"}},us={input:"Text",textarea:"Long text",number:"Number",date:"Date",boolean:"Yes / No",dropdown:"Dropdown",radio:"Single choice",checkboxes:"Multiple choice"},ps=20,cs=["user","contact","user-modify","contact-modify"],ms=2e3,hs=2e3,gs=["preflight","queued"],vs={create:"Rows that will be created",update:"Rows that will be updated",skipped:"Rows that will be skipped",error:"Rows that will fail",warning:"Rows with warnings"},ys=460,fs=360,bs=960;var _s={name:"ImportMappingModal",components:{ImportColumnPanel:Ot,ImportLedgerTable:Wt.A,ImportPreflightStrip:ls},props:{active:{type:Boolean,default:!1},importId:{type:Number,default:null},importType:{type:String,default:""},fileName:{type:String,default:""}},emits:["started","discarded","close"],data(){return{PANEL_MIN_WIDTH:fs,panelWidth:ys,panelDrag:null,preview:null,columns:{},suggested:{}
1,selectedKey:null,showAllRows:!1,isLoading:!1,loadError:null,isSaving:!1,pendingEdit:!1,saveError:null,hasSavedOnce:!1,isStarting:!1,pendingSave:null,saveDebounced:null,matches:null,isMatching:!1,matchRequestId:0,preflight:null,preflightTimer:null,pollTimer:null,preflightEnabled:!0,mappingRevision:null,validationErrors:[],totalRows:0,processedRows:0,ledgerFilter:null,options:{existing:"skip",dateFormats:{}},importStatus:null,stateRequestId:0,lastMappingRequestId:0,lastSavedPayload:null,previousMapping:null}},computed:{typeLabel(){return rs[this.importType]||this.importType},selectedHeader(){return this.preview?.headers.find(e=>e.key===this.selectedKey)||null},duplicates(){return ft(this.columns)},duplicateList(){return Object.keys(this.duplicates)},state(){return kt(this.columns,this.preview?.requiredColumnGroups||[],this.preview?.requiredGroups||{})},requiredGroupNames(){const e=this.preview?.requiredGroups;return e&&"object"===typeof e&&!Array.isArray(e)?Object.keys(e):[]},requirementChips(){const e=bt(this.columns);return this.requiredGroupNames.length?this.requiredGroupNames.map(e=>{const t=this.preview.requiredGroups[e]||[],s=(this.preview.fieldGroups||[]).find(t=>t.key===e),i=s?this.$t(s.label):this.$t(ns[e]||e),a=t.map(e=>e.map(e=>this.$t(Et(e,this.importType))).join(" + ")).join(" "+this.$t("or")+" ");return{key:e,label:a?i+": "+a:i,satisfied:!this.state.missingByGroup?.[e]}}):(this.preview?.requiredColumnGroups||[]).map(t=>({key:t.join("+"),label:t.map(e=>this.$t(Et(e,this.importType))).join(" + "),satisfied:t.every(t=>e.has(t))}))},matchTiles(){return this.matches?Object.entries(this.matches).map(([e,t])=>{const s=(this.preview?.fieldGroups||[]).find(t=>t.key===e);return{key:e,label:s?s.label:e,found:t.found||0,create:t.create||0,unmatched:(t.unresolved||0)+(t.ambiguous||0),createsLabel:os[t.createsAs]||"{count} new"}}):[]},mappedCount(){return Object.keys(this.columns).filter(e=>{const t=xt(this.columns[e],this.duplicates);return"system"===t||"existing"===t||"new"===t}).length},mappedWidth(){const e=this.preview?.headers.length||0;return 0===e?"0%":Math.round(this.mappedCount/e*100)+"%"},sampleRows(){return this.preview?.sampleRows||[]},visibleRows(){return this.showAllRows?this.sampleRows:this.sampleRows.slice(0,ps)},hiddenRowCount(){return Math.max(0,this.sampleRows.length-this.visibleRows.length)},isQueued(){return"queued"===this.importStatus},isPersonType(){return cs.includes(this.importType)},isPreflightReady(){return"ready"===this.preflight?.status&&this.preflight.revision===this.mappingRevision},hasPendingSave(){return this.isSaving||this.pendingEdit},canStart(){return!!this.preview&&this.state.ready&&0===this.duplicateList.length&&!this.isStarting&&!this.saveError&&!this.hasPendingSave&&this.isPreflightReady},ledgerTitle(){const e=this.ledgerFilter?.status||this.ledgerFilter?.outcome;return vs[e]||"Rows"},previousMappingDate(){return this.previousMapping?.dateCompleted?this.$filters.formatDateCool(this.previousMapping.dateCompleted):""}},watch:{importId(){this.reset(),this.active&&this.importId&&this.loadPreview()},active(e){e&&this.importId&&(this.preflightEnabled=!0,this.preview?this.fetchImportState():this.loadPreview())}},created(){this.saveDebounced=ye()(this.save,400),this.active&&this.importId&&this.loadPreview()},beforeUnmount(){this.stopPanelResize(),this.stopPreflight(),this.saveDebounced&&this.saveDebounced.cancel()},methods:{startPanelResize(e){void 0!==e.button&&0!==e.button||(e.preventDefault(),this.panelDrag={startX:e.clientX,startWidth:this.panelWidth},document.addEventListener("pointermove",this.onPanelResize),document.addEventListener("pointerup",this.stopPanelResize),document.addEventListener("pointercancel",this.stopPanelResize),document.body.classList.add("import-panel-resizing"))},onPanelResize(e){this.panelDrag&&this.setPanelWidth(this.panelDrag.startWidth+(this.panelDrag.startX-e.clientX))},stopPanelResize(){this.panelDrag&&(this.panelDrag=null,document.removeEventListener("pointermove",this.onPanelResize),document.removeEventListener("pointerup",this.stopPanelResize),document.removeEventListener("pointercancel",this.stopPanelResize),document.body.classList.remove("import-panel-resizing"))},nudgePanel(e){this.setPanelWidth(this.panelWidth+e)},setPanelWidth(e){const t=this.$el?.querySelector?.(".import-sheet-body")?.clientWidth||0,s=t>0?Math.min(bs,Math.floor(.66*t)):bs;this.panelWidth=Math.round(Math.min(s,Math.max(fs,e)))},reset(){this.saveDebounced?.cancel?.(),this.pendingEdit=!1,this.stopPreflight(),this.preflightEnabled=!0,this.preflight=null,this.mappingRevision=null,this.validationErrors=[],this.totalRows=0,this.processedRows=0,this.ledgerFilter=null,this.options={existing:"skip",dateFormats:{}},this.importStatus=null,this.stateRequestId+=1,this.lastMappingRequestId+=1,this.lastSavedPayload=null,this.previousMapping=null,this.preview=null,this.matches=null,this.isMatching=!1,this.matchRequestId+=1,this.columns={},this.suggested={},this.selectedKey=null,this.showAllRows=!1,this.loadError=null,this.saveError=null,this.hasSavedOnce=!1},loadPreview(){this.isLoading=!0,this.loadError=null,this.$http.plain.get(`/imports/${this.importId}/preview`).then(e=>{this.preview=e.data;const t=yt(this.preview);this.columns=t.columns,this.suggested=t.suggested,this.selectedKey=null,this.hasSavedOnce=!!this.preview.mapping;const s=this.preview.options||{};
1this.options={existing:s.existing||"skip",dateFormats:{...s.dateFormats||{}}},this.preview.mapping?(this.fetchMatches(),this.fetchImportState()):(this.scheduleSave(),this.fetchLastMapping())}).catch(e=>{console.log(e),this.loadError=e.response?.data?.error||this.$t("Could not read the file")}).finally(()=>{this.isLoading=!1})},selectColumn(e){this.selectedKey=this.selectedKey===e?null:e},isSkipped(e){const t=this.columns[e];return!t||"skip"===t.target},isEmptyCell(e){return null===e||void 0===e||""===String(e).trim()},optionsFor(e){const t=this.columns[e];if(!t||"custom_field"!==t.target)return{};if(t.fieldId){const e=(this.preview?.customFields||[]).find(e=>e.id===t.fieldId);return e?.fieldOptions?.options||{}}return t.options||{}},cellParts(e,t){return this.isEmptyCell(t)?null:St(this.columns[e],this.optionsFor(e),t)},sampleValues(e){const t=[];return this.sampleRows.forEach(s=>{const i=s[e];null===i||void 0===i||""===String(i).trim()||t.includes(i)||t.push(String(i))}),t.slice(0,5)},matchClass(e,t){const s=wt(this.matches,this.preview?.fieldGroups,this.columns,e,t);return"unresolved"===s||"ambiguous"===s?"unmatched":"create"===s?"new":null},fetchMatches(){if(!this.importId||!this.preview?.matchable)return;const e=++this.matchRequestId;this.isMatching=!0,this.$http.plain.get(`/imports/${this.importId}/matches`).then(t=>{e===this.matchRequestId&&(this.matches=t.data?.matches||{})}).catch(e=>{console.log(e)}).finally(()=>{e===this.matchRequestId&&(this.isMatching=!1)})},destinationSummary(e){const t=this.columns[e];if(!t)return"";if("attention"===xt(t,this.duplicates))return this.$t("Needs attention");if("system"===t.target){const e=Lt(this.preview?.fieldGroups,t.field);return"â "+(e?this.$t(e.label)+" · ":"")+this.$t(Et(t.field,this.importType))}if("skip"===t.target)return this.$t("Skipped");const s=this.$t(us[t.fieldType]||t.fieldType);if(t.fieldId){const e=(this.preview?.customFields||[]).find(e=>e.id===t.fieldId);return this.$t("Existing field")+" · "+s+(e?" · "+e.name:"")}const i=Object.keys(t.options||{}).length,a=this.$t("New field")+" · "+s;return i>0?a+" · "+this.$t("{count} options",{count:i}):a},statusTag(e){return ds[xt(this.columns[e],this.duplicates)]},usedSystemFieldsExcept(e){const t={...this.columns};return delete t[e],Array.from(bt(t))},updateColumn(e,t){this.columns={...this.columns,[e]:t},this.suggested[e]&&(this.suggested={...this.suggested,[e]:!1}),this.scheduleSave()},scheduleSave(){this.pendingEdit=!0,this.saveDebounced()},buildSavePayload(){return{columns:Ft(this.columns),options:{existing:this.options.existing,dateFormats:{...this.options.dateFormats}}}},save(){if(!this.importId)return this.pendingEdit=!1,Promise.resolve();const e=this.buildSavePayload(),t=JSON.stringify(e);if(this.pendingEdit=!1,t===this.lastSavedPayload)return Promise.resolve();this.isSaving=!0,this.saveError=null;const s=this.$http.plain.patch(`/imports/${this.importId}/mapping`,e).then(e=>{this.lastSavedPayload=t,this.hasSavedOnce=!0,this.onMappingSaved(e.data),this.fetchMatches()}).catch(e=>{throw console.log(e),this.saveError=e.response?.data?.error||this.$t("Could not save the mapping"),e}).finally(()=>{this.isSaving=!1});return this.pendingSave=s.catch(()=>{}),s},flushSave(){return this.saveDebounced.cancel(),this.save()},start(){if(!this.canStart)return;const e=this.preflight?.counts?.fail||0;e>0?this.$buefy.dialog.confirm({title:this.$t("Some rows will fail"),message:this.$t("{count} rows will fail and be left out. Import the rest?",{count:e}),confirmText:this.$t("Import the rest"),cancelText:this.$t("Cancel"),type:"is-warning",hasIcon:!0,onConfirm:()=>this.runStart()}):this.runStart()},runStart(){this.isStarting=!0,this.stopPreflight(),this.flushSave().then(()=>this.$http.plain.post(`/imports/${this.importId}/start`)).then(e=>{const t="queued"===e.data?.status;this.$buefy.toast.open({message:t?this.$t("Waiting for another import to finish"):this.$t("Import started successfully"),type:t?"is-info":"is-success"}),this.$emit("started",e.data)}).catch(e=>{console.log(e);const t=e.response?.data||{},s=Array.isArray(t.errors)&&t.errors.length?t.errors.join(" "):t.error;
1this.$buefy.toast.open({message:s||this.$t("Import could not be started"),type:"is-danger",duration:6e3})}).finally(()=>{this.isStarting=!1})},onMappingSaved(e){this.stateRequestId+=1,e&&void 0!==e.mappingRevision&&(this.mappingRevision=e.mappingRevision),e&&e.preflight&&(this.preflight=e.preflight),this.validationErrors=[],this.ledgerFilter=null,this.schedulePreflight()},schedulePreflight(){clearTimeout(this.preflightTimer),this.preflightTimer=null,this.preflightEnabled&&this.importId&&(!this.state.ready||this.duplicateList.length>0||(this.preflightTimer=setTimeout(this.runPreflight,ms)))},runPreflight(){this.preflightEnabled&&this.importId&&(this.validationErrors=[],this.$http.plain.post(`/imports/${this.importId}/preflight`).then(e=>{this.importStatus=e.data?.status||null,this.preflight=e.data?.preflight||{status:"running",revision:this.mappingRevision,counts:null},this.pollPreflight()}).catch(e=>{console.log(e);const t=e.response?.data||{};409!==e.response?.status?(this.validationErrors=Array.isArray(t.errors)&&t.errors.length?t.errors:[t.error||this.$t("The check could not finish")],this.importStatus=null,this.preflight={status:"failed",revision:this.mappingRevision,counts:null}):String(t.error||"").includes("already running")?this.pollPreflight():this.schedulePreflight()}))},pollPreflight(){if(clearTimeout(this.pollTimer),this.pollTimer=null,!this.preflightEnabled||!this.importId)return;const e=++this.stateRequestId;this.pollTimer=setTimeout(()=>{this.$http.plain.get(`/imports/${this.importId}`).then(t=>{e===this.stateRequestId&&this.onImportState(t.data||{})}).catch(e=>{console.log(e)})},hs)},fetchImportState(){const e=++this.stateRequestId;this.$http.plain.get(`/imports/${this.importId}`).then(t=>{e===this.stateRequestId&&this.onImportState(t.data||{})}).catch(e=>{console.log(e)})},onImportState(e){this.applyImportState(e);const t=e.preflight||{};gs.includes(e.status)||"running"===t.status?this.pollPreflight():"failed"===t.status&&t.revision===e.mappingRevision||"ready"===t.status&&t.revision===e.mappingRevision||this.schedulePreflight()},applyImportState(e){if(this.importStatus=e.status||null,void 0!==e.mappingRevision&&null!==e.mappingRevision&&(this.mappingRevision=e.mappingRevision),this.preflight=e.preflight||null,this.totalRows=e.totalRows||0,this.processedRows=e.processedRows||0,"failed"===e.preflight?.status){const t=e.errorSummary||{},s=Array.isArray(t.validationErrors)?t.validationErrors:[];this.validationErrors=s.length?s:[t.message||this.$t("The check could not finish")]}},stopPreflight(){clearTimeout(this.preflightTimer),clearTimeout(this.pollTimer),this.preflightTimer=null,this.pollTimer=null},setLedgerFilter(e){this.ledgerFilter=e},setExistingOption(e){e!==this.options.existing&&(this.options={...this.options,existing:e},this.scheduleSave())},setDateFormat(e,t){e&&this.options.dateFormats[e]!==t&&(this.options={...this.options,dateFormats:{...this.options.dateFormats,[e]:t}},this.scheduleSave())},fetchLastMapping(){const e=++this.lastMappingRequestId;this.$http.plain.get("/imports/last-mapping",{params:{type:this.importType}}).then(t=>{if(e!==this.lastMappingRequestId)return;const s=t.data||{},i=s.columns;if(!i||0===Object.keys(i).length)return;const a=(this.preview?.headers||[]).map(e=>e.key);Object.keys(i).every(e=>a.includes(e))&&(this.previousMapping=s)}).catch(e=>{console.log(e)})},applyPreviousMapping(){const e=this.previousMapping;e&&(this.columns={...this.columns,...JSON.parse(JSON.stringify(e.columns))},this.suggested={},e.options&&(this.options={existing:e.options.existing||"skip",dateFormats:{...e.options.dateFormats||{}}}),this.previousMapping=null,this.scheduleSave())},confirmDiscard(){this.$buefy.dialog.confirm({title:this.$t("Discard import"),message:this.$t("The uploaded file and this mapping will be deleted. Nothing has been imported yet."),confirmText:this.$t("Discard"),cancelText:this.$t("Cancel"),type:"is-danger",hasIcon:!0,onConfirm:()=>this.discard()})},discard(){this.saveDebounced.cancel(),this.isStarting=!0,this.$http.plain.delete(`/imports/${this.importId}`).then(()=>{this.$emit("discarded")}).catch(e=>
1{console.log(e),this.$buefy.toast.open({message:e.response?.data?.error||this.$t("Could not discard the import"),type:"is-danger"})}).finally(()=>{this.isStarting=!1})},onModalToggle(e){e||this.close()},close(){this.stopPreflight(),this.preflightEnabled=!1,this.saveDebounced.flush(),this.$emit("close")}}};const ks=(0,Xt.A)(_s,[["render",ge],["__scopeId","data-v-0b0b071a"]]);var Ls=ks},92106:function(e,t,s){s.r(t),s.d(t,{default:function(){return Zt}});s(44114),s(18111),s(22489),s(61701);var i=s(20641),a=s(90033),l=s(53751);const r={class:"o-minwidth"},n={key:0},o={class:"ulv-detail-header"},d={class:"ulv-detail-header-left"},u={class:"is-flex is-align-items-center mt-2",style:{gap:"8px"}},p={class:"ulv-detail-actions"},c={class:"ulv-stats-row"},m={class:"ulv-def-card"},h={class:"ulv-recipients-header"},g={style:{width:"100%","border-collapse":"collapse"}},v={style:{padding:"10px 16px"}},y={style:{padding:"10px 16px"}},f={style:{padding:"10px 16px"}},b={style:{padding:"12px 16px"}},_={style:{padding:"12px 16px"}},k={style:{padding:"12px 16px"}},L={key:1,class:"notification is-danger"},w={class:"ulv-detail-header"},C={class:"ulv-detail-header-left"},$={class:"ulv-detail-title"},E={class:"ulv-detail-meta"},x={class:"ulv-detail-actions"},F={class:"icon is-small"},S={class:"ulv-stats-row"},I={class:"ulv-stat-card"},M={class:"ulv-stat-label"},T={class:"ulv-stat-value"},X={key:0,class:"ulv-stat-note"},P={key:0},R={key:1},A={key:2},D={key:0,class:"ulv-stat-card"},O={class:"ulv-stat-label"},W={class:"ulv-stat-value is-success"},N={class:"ulv-stat-note"},U={key:1,class:"ulv-stat-card"},V={class:"ulv-stat-label"},K={class:"ulv-stat-value is-warning"},Q={class:"ulv-stat-note"},z={key:2,class:"ulv-stat-card"},j={class:"ulv-stat-label"},q={class:"ulv-stat-value is-small"},B={class:"ulv-stat-note"},G={key:0,class:"ulv-def-card"},H={class:"ulv-def-header"},J={class:"ulv-def-body"},Y={key:0,class:"ulv-def-row"},Z={class:"ulv-def-label"},ee={class:"ulv-def-value"},te={key:0},se={key:1},ie={key:2},ae={key:1,class:"ulv-def-row"},le={class:"ulv-def-label"},re={class:"ulv-def-value"},ne={class:"ulv-def-label"},oe={class:"ulv-criteria-pill"},de={class:"ulv-pill-prop"},ue={class:"ulv-pill-op"},pe={key:0,class:"ulv-pill-val"},ce={key:1,class:"ulv-pill-val"},me={key:2,class:"ulv-pill-val"},he={key:3,class:"ulv-pill-val"},ge={key:4,class:"ulv-pill-val"},ve={key:5,class:"ulv-pill-val"},ye={key:6,class:"ulv-pill-val"},fe={class:"ulv-def-card"},be={class:"ulv-recipients-header"},_e={class:"ulv-recipients-header-left"},ke={class:"ulv-recipients-count"},Le={class:"ulv-recipients-header-right"},we={class:"icon is-small"},Ce={class:"icon is-small"},$e={key:0,class:"ulv-empty-text"},Ee={key:0,class:"ulv-empty-hint"},xe={key:1,class:"has-text-centered py-6"},Fe=["disabled"],Se={class:"icon is-small"},Ie={key:2,class:"ulv-filter-bar"},Me={class:"ulv-filter-chips"},Te={class:"ulv-chip-count"},Xe={class:"ulv-chip-count"},Pe={class:"ulv-chip-count"},Re={class:"ulv-filter-hint"},Ae={key:3},De={key:0,class:"notification is-danger m-4"},Oe={class:"orgo-table-wrap"},We={key:2},Ne={key:0},Ue={key:1},Ve={key:2},Ke={key:0,class:"tag is-info is-rounded"},Qe={key:1,class:"tag is-warning is-rounded"},ze=["onClick"],je={class:"icon is-small"},qe={class:"modal-card"},Be={class:"modal-card-head"},Ge={class:"modal-card-title"},He={class:"modal-card-body"},Je={class:"field"},Ye={class:"control"},Ze={class:"field is-grouped"},et={class:"control"},tt={class:"radio"},st={class:"control"},it={class:"radio"},at={class:"field"},lt={class:"control"},rt=["placeholder"],nt={key:0,class:"has-text-centered my-3"},ot={key:1,class:"has-text-centered"},dt={key:2,class:"orgo-table-wrap"},ut={class:"modal-card-foot"},pt=["disabled"],ct={class:"modal-card"},mt={class:"modal-card-head"},ht={class:"modal-card-title"},gt={class:"modal-card-body"},vt={class:"modal-card-foot"};function yt(e,t,s,yt,ft,bt){const _t=(0,i.g2)("b-skeleton"),kt=(0,i.g2)("font-awesome-icon"),Lt=(0,i.g2)("router-link"),wt=(0,i.g2)("b-table-column"),Ct=(0,i.g2)("b-table"),$t=(0,i.g2)("b-pagination"),Et=(0,i.g2)("UserListCsvImportModal");return(0,i.uX)(),(0,i.CE)("section",r,[ft.userList||!ft.isLoading||ft.error?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",n,[(0,i.Lk)("div",o,[(0,i.Lk)("div",d,[(0,i.bF)(_t,{width:"32px",height:"32px",animated:"",rounded:!0}),(0,i.Lk)("div",null,[(0,i.bF)(_t,{width:"180px",height:"22px",animated:""}),(0,i.Lk)("div",u,[(0,i.bF)(_t,{width:"80px",height:"22px",animated:"",rounded:!0}),(0,i.bF)(_t,{width:"200px",height:"14px",animated:""})])])]),(0,i.Lk)("div",p,[(0,i.bF)(_t,{width:"80px",height:"32px",animated:"",rounded:!0})])]),(0,i.Lk)("div",c,[((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(3,e=>(0,i.Lk)("div",{key:"skel-stat-"+e,class:"ulv-stat-card"},[(0,i.bF)(_t,{width:"90px",height:"12px",animated:""}),(0,i.bF)(_t,{width:30+e%3*15+"px",height:"28px",class:"mt-2",animated:""},null,8,["width"]),(0,i.bF)(_t,{width:"70px",height:"10px",class:"mt-1",animated:""})])),64))]),(0,i.Lk)("div",m,[(0,i.Lk)("div",h,[(0,i.bF)(_t,{width:"120px",height:"18px",animated:""})]),(0,i.Lk)("table",g,[(0,i.Lk)("thead",null,[(0,i.Lk)("tr",null,[(0,i.Lk)("th",v,[(0,i.bF)(_t,{width:"50px",height:"12px",animated:""})]),(0,i.Lk)("th",y,[(0,i.bF)(_t,{width:"50px",height:"12px",animated:""})]),(0,i.Lk)("th",f,[(0,i.bF)(_t,{width:"40px",height:"12px",animated:""})])])]),(0,i.Lk)("tbody",null,[((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(6,e=>(0,i.Lk)("tr",{key:"skel-member-"+e},[(0,i.Lk)("td",b,[(0,i.bF)(_t,{width:50+e%4*10+"%",height:"14px",animated:""},null,8,["width"])]),(0,i.Lk)("td",_,[(0,i.bF)(_t,{width:40+e%3*15+"%",height:"14px",animated:""},null,8,["width"])]),(0,i.Lk)("td",k,[(0,i.bF)(_t,{width:"60px",height:"22px",animated:"",rounded:!0})])])),64))])])])])),ft.error?((0,i.uX)(),(0,i.CE)("div",L,(0,a.v_)(e.$t("Error fetching data")),1)):(0,i.Q3)("",!0),ft.userList&&!ft.error?((0,i.uX)(),(0,i.CE)(i.FK,{key:2},[(0,i.Lk)("div",w,[(0,i.Lk)("div",C,[(0,i.Lk)("button",{class:"ulv-back-btn",onClick:t[0]||(t[0]=t=>e.$router.push({name:"UserListIndex"}))},[(0,i.bF)(kt,{icon:["fal","chevron-left"]})]),(0,i.Lk)("div",null,[(0,i.Lk)("div",$,(0,a.v_)(ft.userList.name),1),(0,i.Lk)("div",E,[(0,i.Lk)("span",{class:(0,a.C4)(["ulv-type-badge","dynamic"===ft.userList.type?"is-auto":"is-manual"])},[(0,i.bF)(kt,{icon:"dynamic"===ft.userList.type?["fal","bolt"]:["fal","list"],class:"ulv-type-badge-icon"},null,8,["icon"]),(0,i.eW)(" "+(0,a.v_)("dynamic"===ft.userList.type?e.$t("Automated"):e.$t("Static")),1)],2),(0,i.Lk)("span",null,[(0,i.eW)((0,a.v_)(e.$t("Created by"))+" ",1),(0,i.bF)(Lt,{to:{name:"UserShow",params:{item:ft.userList.owner.id}}},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(ft.userList.owner.fullName),1)]),_:1},8,["to"]),(0,i.eW)(" · "+(0,a.v_)(bt.formatDate(ft.userList.createdAt)),1)])])])]),(0,i.Lk)("div",x,[(0,i.Lk)("button",{class:"button is-small is-rounded",onClick:t[1]||(t[1]=t=>e.$router.push({name:"UserListEdit",params:{item:bt.id}}))},[(0,i.Lk)("span",F,[(0,i.bF)(kt,{icon:["fal","pen"]})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Edit")),1)])])]),(0,i.Lk)("div",S,[(0,i.Lk)("div",I,[(0,i.Lk)("div",M,(0,a.v_)(bt.totalLabel),1),(0,i.Lk)("div",T,(0,a.v_)(ft.userList.itemsCount),1),"dynamic"===ft.userList.type&&ft.userList.scope?((0,i.uX)(),(0,i.CE)("div",X,["members_and_contacts"===ft.userList.scope?((0,i.uX)(),(0,i.CE)("span",P,(0,a.v_)(e.$t("Members & Contacts")),1)):"members_only"===ft.userList.scope?((0,i.uX)(),(0,i.CE)("span",R,(0,a.v_)(e.$t("Members Only")),1)):"contacts_only"===ft.userList.scope?((0,i.uX)(),(0,i.CE)("span",A,(0,a.v_)(e.$t("Contacts Only")),1)):(0,i.Q3)("",!0)])):(0,i.Q3)("",!0)]),bt.hasEventAttendsCriteria?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",D,[(0,i.Lk)("div",O,(0,a.v_)(e.$t("Subscribed")),1),(0,i.Lk)("div",W,(0,a.v_)(ft.userList.subscribedCount),1),(0,i.Lk)("div",N,(0,a.v_)(ft.userList.itemsCount>0?Math.round(ft.userList.subscribedCount/ft.userList.itemsCount*100):0)+"% "+(0,a.v_)(e.$t("of total")),1)])),bt.hasEventAttendsCriteria?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",U,[(0,i.Lk)("div",V,(0,a.v_)(e.$t("Unsubscribed")),1),(0,i.Lk)("div",K,(0,a.v_)(ft.userList.notSubscribedCount),1),(0,i.Lk)("div",Q,(0,a.v_)(e.$t("Not receiving campaigns")),1)])),"dynamic"!==ft.userList.type||"members_and_contacts"!==ft.userList.scope&&"members_only"!==ft.userList.scope?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",z,[(0,i.Lk)("div",j,(0,a.v_)(e.$t("Member status")),1),(0,i.Lk)("div",q,(0,a.v_)("ACTIVE"===ft.userList.memberStatus?e.$t("Active"):"INACTIVE"===ft.userList.memberStatus?e.$t("Inactive"):e.$t("All")),1),(0,i.Lk)("div",B,(0,a.v_)(e.$t("Filter applied")),1)]))]),bt.hasCriteria?((0,i.uX)(),(0,i.CE)("div",G,[(0,i.Lk)("div",H,[(0,i.bF)(kt,{icon:["fal","filter"]}),(0,i.eW)(" "+(0,a.v_)(e.$t("Active criteria")),1)]),(0,i.Lk)("div",J,[ft.userList.scope?((0,i.uX)(),(0,i.CE)("div",Y,[(0,i.Lk)("span",Z,(0,a.v_)(e.$t("Scope")),1),(0,i.Lk)("span",ee,["members_and_contacts"===ft.userList.scope?((0,i.uX)(),(0,i.CE)("span",te,(0,a.v_)(e.$t("Members & Contacts")),1)):"members_only"===ft.userList.scope?((0,i.uX)(),(0,i.CE)("span",se,(0,a.v_)(e.$t("Members Only")),1)):"contacts_only"===ft.userList.scope?((0,i.uX)(),(0,i.CE)("span",ie,(0,a.v_)(e.$t("Contacts Only")),1)):(0,i.Q3)("",!0)])])):(0,i.Q3)("",!0),!ft.userList.memberStatus||"members_and_contacts"!==ft.userList.scope&&"members_only"!==ft.userList.scope?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",ae,[(0,i.Lk)("span",le,(0,a.v_)(e.$t("Status")),1),(0,i.Lk)("span",re,(0,a.v_)("ACTIVE"===ft.userList.memberStatus?e.$t("Active"):"INACTIVE"===ft.userList.memberStatus?e.$t("Inactive"):e.$t("Active & Inactive")),1)])),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(ft.userList.criteria,(t,s)=>((0,i.uX)(),(0,i.CE)("div",{key:`def-criterion-${s}`,class:"ulv-def-row"},[(0,i.Lk)("span",ne,(0,a.v_)(e.$t("Filter")),1),(0,i.Lk)("div",null,[(0,i.Lk)("span",oe,[(0,i.Lk)("span",de,(0,a.v_)(bt.getPropertyText(t.property)),1),(0,i.Lk)("span",ue,(0,a.v_)(bt.getOperatorText(t.operator,t.property)),1),bt.isNullOperator(t.operator)?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[bt.isDateProperty(t.property)?((0,i.uX)(),(0,i.CE)("span",pe,(0,a.v_)(bt.formatDate(t.value)),1)):bt.isBooleanProperty(t.property)?((0,i.uX)(),(0,i.CE)("span",ce,(0,a.v_)(t.value?e.$t("Yes"):e.$t("No")),1)):bt.isTagProperty(t.property)&&Array.isArray(t.value)?((0,i.uX)(),(0,i.CE)("span",me,(0,a.v_)(t.value.map(e=>bt.getTagName(e)).join(", ")),1)):bt.isSelectValueProperty(t.property)?((0,i.uX)(),(0,i.CE)("span",he,[(0,i.eW)((0,a.v_)(bt.getSelectValueText(t.property,t.value))+" ",1),t.productUuid?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.eW)("· "+(0,a.v_)(bt.getProductName(t.productUuid)),1)],64)):(0,i.Q3)("",!0),t.eventName?((0,i.uX)(),(0,i.CE)(i.FK,{key:1},[(0,i.eW)("· "+(0,a.v_)(t.eventName),1)],64)):(0,i.Q3)("",!0)])):bt.isLocalCenterProperty(t.property)?((0,i.uX)(),(0,i.CE)("span",ge,(0,a.v_)(bt.getLocalCenterNames(t.value)),1)):bt.isUserTypeProperty(t.property)?((0,i.uX)(),(0,i.CE)("span",ve,(0,a.v_)(bt.getUserTypeNames(t.value)),1)):((0,i.uX)(),(0,i.CE)("span",ye,(0,a.v_)(t.value),1))],64))])])]))),128))])])):(0,i.Q3)("",!0),(0,i.Lk)("div",fe,[(0,i.Lk)("div",be,[(0,i.Lk)("div",_e,[(0,i.bF)(kt,{icon:["fal","users"]}),(0,i.eW)(" "+(0,a.v_)(e.$t("Recipients"))+" ",1),(0,i.Lk)("span",ke,"· "+(0,a.v_)(ft.userList.itemsCount),1)]),(0,i.Lk)("div",Le,[bt.isManual?((0,i.uX)(),(0,i.CE)("button",{key:0,class:"button is-small is-rounded mr-2",onClick:t[2]||(t[2]=e=>ft.isCsvImportModalOpen=!0)},[(0,i.Lk)("span",we,[(0,i.bF)(kt,{icon:["fal","file-csv"]})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Add CSV")),1)])):(0,i.Q3)("",!0),bt.isManual?((0,i.uX)(),(0,i.CE)("button",{key:1,class:"button is-primary is-small is-rounded",onClick:t[3]||(t[3]=(...e)=>bt.showModal&&bt.showModal(...e))},[(0,i.Lk)("span",Ce,[(0,i.bF)(kt,{icon:["fal","plus"]})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Add")),1)])):(0,i.Q3)("",!0)])]),0===ft.userList.itemsCount?((0,i.uX)(),(0,i.CE)("div",$e,[(0,i.Lk)("p",null,(0,a.v_)(e.$t("no_members_found")),1),bt.isManual?((0,i.uX)(),(0,i.CE)("p",Ee,(0,a.v_)(e.$t("Add your first recipient to this list")),1)):(0,i.Q3)("",!0)])):!ft.memberListLoaded&&ft.userList.itemsCount>100?((0,i.uX)(),(0,i.CE)("div",xe,[(0,i.Lk)("button",{class:(0,a.C4)(["button is-primary is-rounded is-small",{"is-loading":ft.isLoadingMembers}]),disabled:ft.isLoadingMembers,onClick:t[4]||(t[4]=(...e)=>
1bt.fetchMembers&&bt.fetchMembers(...e))},[(0,i.Lk)("span",Se,[(0,i.bF)(kt,{icon:["fal","eye"]})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Show recipients")),1)],10,Fe)])):(0,i.Q3)("",!0),ft.userList.itemsCount>0&&ft.memberListLoaded&&!bt.hasEventAttendsCriteria?((0,i.uX)(),(0,i.CE)("div",Ie,[(0,i.Lk)("div",Me,[(0,i.Lk)("button",{class:(0,a.C4)(["ulv-filter-chip",{"is-active":"subscribed"===ft.filter}]),onClick:t[5]||(t[5]=e=>bt.changeFilter("subscribed"))},[(0,i.eW)((0,a.v_)(e.$t("Subscribed"))+" ",1),(0,i.Lk)("span",Te,(0,a.v_)(ft.userList.subscribedCount),1)],2),(0,i.Lk)("button",{class:(0,a.C4)(["ulv-filter-chip",{"is-active":"all"===ft.filter}]),onClick:t[6]||(t[6]=e=>bt.changeFilter("all"))},[(0,i.eW)((0,a.v_)(e.$t("All"))+" ",1),(0,i.Lk)("span",Xe,(0,a.v_)(ft.userList.itemsCount),1)],2),(0,i.Lk)("button",{class:(0,a.C4)(["ulv-filter-chip",{"is-active":"not-subscribed"===ft.filter}]),onClick:t[7]||(t[7]=e=>bt.changeFilter("not-subscribed"))},[(0,i.eW)((0,a.v_)(e.$t("Not subscribed"))+" ",1),(0,i.Lk)("span",Pe,(0,a.v_)(ft.userList.notSubscribedCount),1)],2)]),(0,i.Lk)("p",Re,[(0,i.bF)(kt,{icon:["fal","info-circle"]}),(0,i.eW)(" "+(0,a.v_)(e.$t("We can only send campaigns to subscribed email addresses")),1)])])):(0,i.Q3)("",!0),ft.userList.itemsCount>0&&ft.memberListLoaded?((0,i.uX)(),(0,i.CE)("div",Ae,[ft.memberError?((0,i.uX)(),(0,i.CE)("div",De,(0,a.v_)(e.$t("error_fetching_data")),1)):(0,i.Q3)("",!0),(0,i.Lk)("div",Oe,[(0,i.bF)(Ct,{data:ft.members,loading:ft.isLoadingMembers,"mobile-cards":!1,empty:e.$t("no_members_found")},{default:(0,i.k6)(()=>[(0,i.bF)(wt,{field:"fullName",label:e.$t("name"),sortable:""},{default:(0,i.k6)(e=>[e.row.user?((0,i.uX)(),(0,i.Wv)(Lt,{key:0,to:{name:"UserShow",params:{item:e.row.user.id}}},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.row.user.fullName),1)]),_:2},1032,["to"])):e.row.contact?((0,i.uX)(),(0,i.Wv)(Lt,{key:1,to:{name:"ContactShow",params:{item:e.row.contact.id}}},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.row.contact.fullName),1)]),_:2},1032,["to"])):e.row.isDynamic?((0,i.uX)(),(0,i.CE)("span",We,(0,a.v_)(e.row.user.fullName),1)):(0,i.Q3)("",!0)]),_:1},8,["label"]),(0,i.bF)(wt,{field:"email",label:e.$t("Email"),sortable:""},{default:(0,i.k6)(e=>[e.row.user?((0,i.uX)(),(0,i.CE)("span",Ne,(0,a.v_)(e.row.user.email),1)):e.row.contact?((0,i.uX)(),(0,i.CE)("span",Ue,(0,a.v_)(e.row.contact.email),1)):e.row.isDynamic?((0,i.uX)(),(0,i.CE)("span",Ve,(0,a.v_)(e.row.user.email),1)):(0,i.Q3)("",!0)]),_:1},8,["label"]),!bt.hasCriteria||bt.hasCriteria&&"members_and_contacts"===ft.userList.scope?((0,i.uX)(),(0,i.Wv)(wt,{key:0,label:e.$t("type")},{default:(0,i.k6)(t=>[t.row.user?((0,i.uX)(),(0,i.CE)("span",Ke,(0,a.v_)(e.$t("member")),1)):t.row.contact?((0,i.uX)(),(0,i.CE)("span",Qe,(0,a.v_)(e.$t("contact")),1)):(0,i.Q3)("",!0)]),_:1},8,["label"])):(0,i.Q3)("",!0),bt.isManual?((0,i.uX)(),(0,i.Wv)(wt,{key:1,label:e.$t("actions")},{default:(0,i.k6)(e=>[(0,i.Lk)("button",{class:"button is-small is-danger is-outlined is-rounded",onClick:t=>bt.confirmRemoveMember(e.row)},[(0,i.Lk)("span",je,[(0,i.bF)(kt,{icon:["fal","trash"]})])],8,ze)]),_:1},8,["label"])):(0,i.Q3)("",!0)]),_:1},8,["data","loading","empty"])]),ft.membersTotal>ft.membersPerPage?((0,i.uX)(),(0,i.Wv)($t,{key:1,modelValue:ft.membersPage,"onUpdate:modelValue":t[8]||(t[8]=e=>ft.membersPage=e),total:ft.membersTotal,"per-page":ft.membersPerPage,rounded:"",class:"mt-4 px-4 pb-4",onChange:bt.changeMembersPage},null,8,["modelValue","total","per-page","onChange"])):(0,i.Q3)("",!0)])):(0,i.Q3)("",!0)])],64)):(0,i.Q3)("",!0),(0,i.Lk)("div",{class:(0,a.C4)(["modal",{"is-active":ft.showAddMembersModal}])},[(0,i.Lk)("div",{class:"modal-background",onClick:t[9]||(t[9]=e=>ft.showAddMembersModal=!1)}),(0,i.Lk)("div",qe,[(0,i.Lk)("header",Be,[(0,i.Lk)("p",Ge,(0,a.v_)(e.$t("add_members")),1),(0,i.Lk)("button",{class:"delete is-rounded","aria-label":"close",onClick:t[10]||(t[10]=e=>ft.showAddMembersModal=!1)})]),(0,i.Lk)("section",He,[(0,i.Lk)("div",Je,[(0,i.Lk)("div",Ye,[(0,i.Lk)("div",Ze,[(0,i.Lk)("div",et,[(0,i.Lk)("label",tt,[(0,i.bo)((0,i.Lk)("input",{"onUpdate:modelValue":t[11]||(t[11]=e=>ft.searchType=e),type:"radio",value:"users",onChange:t[12]||(t[12]=(...e)=>bt.clearSearch&&bt.clearSearch(...e))},null,544),[[l.XL,ft.searchType]]),(0,i.eW)(" "+(0,a.v_)(e.$t("members")),1)])]),(0,i.Lk)("div",st,[(0,i.Lk)("label",it,[(0,i.bo)((0,i.Lk)("input",{"onUpdate:modelValue":t[13]||(t[13]=e=>ft.searchType=e),type:"radio",value:"contacts",onChange:t[14]||(t[14]=(...e)=>bt.clearSearch&&bt.clearSearch(...e))},null,544),[[l.XL,ft.searchType]]),(0,i.eW)(" "+(0,a.v_)(e.$t("contacts")),1)])])])])]),(0,i.Lk)("div",at,[(0,i.Lk)("div",lt,[(0,i.bo)((0,i.Lk)("input",{"onUpdate:modelValue":t[15]||(t[15]=e=>ft.userSearch=e),class:"input",type:"text",placeholder:e.$t("search"),onInput:t[16]||(t[16]=(...e)=>bt.performEntitySearch&&bt.performEntitySearch(...e))},null,40,rt),[[l.Jo,ft.userSearch]])])]),ft.isSearchingUsers?((0,i.uX)(),(0,i.CE)("div",nt,[t[24]||(t[24]=(0,i.Lk)("div",{class:"is-loading-spinner"},null,-1)),(0,i.Lk)("strong",null,(0,a.v_)(e.$t("loading"))+"...",1)])):(0,i.Q3)("",!0),0===ft.searchResults.length&&!ft.isSearchingUsers&&ft.userSearch.length>2?((0,i.uX)(),(0,i.CE)("div",ot,(0,a.v_)("users"===ft.searchType?e.$t("no_users_found"):e.$t("no_contacts_found")),1)):(0,i.Q3)("",!0),ft.searchResults.length>0?((0,i.uX)(),(0,i.CE)("div",dt,[(0,i.bF)(Ct,{data:ft.searchResults,checkable:"",onCheck:bt.onRowSelected},{default:(0,i.k6)(()=>[(0,i.bF)(wt,{field:"fullName",label:e.$t("full_name"),sortable:""},{default:(0,i.k6)(e=>[(0,i.eW)((0,a.v_)(e.row.fullName||e.row.name),1)]),_:1},8,["label"]),(0,i.bF)(wt,{field:"email",label:e.$t("email"),sortable:""},{default:(0,i.k6)(e=>[(0,i.eW)((0,a.v_)(e.row.email),1)]),_:1},8,["label"])]),_:1},8,["data","onCheck"])])):(0,i.Q3)("",!0)]),(0,i.Lk)("footer",ut,[(0,i.Lk)("button",{class:"button is-primary is-rounded",disabled:0===ft.selectedUsers.length,onClick:t[17]||(t[17]=(...e)=>bt.addSelectedMembers&&bt.addSelectedMembers(...e))},(0,a.v_)(e.$t("add")),9,pt),(0,i.Lk)("button",{class:"button is-rounded",onClick:t[18]||(t[18]=e=>ft.showAddMembersModal=!1)},(0,a.v_)(e.$t("cancel")),1)])])],2),(0,i.Lk)("div",{class:(0,a.C4)(["modal",{"is-active":ft.showRemoveMemberModal}])},[(0,i.Lk)("div",{class:"modal-background",onClick:t[19]||(t[19]=e=>ft.showRemoveMemberModal=!1)}),(0,i.Lk)("div",ct,[(0,i.Lk)("header",mt,[(0,i.Lk)("p",ht,(0,a.v_)(e.$t("remove_member")),1),(0,i.Lk)("button",{class:"delete is-rounded","aria-label":"close",onClick:t[20]||(t[20]=e=>ft.showRemoveMemberModal=!1)})]),(0,i.Lk)("section",gt,[(0,i.Lk)("p",null,(0,a.v_)(e.$t("remove_member_confirmation",{name:ft.memberToRemove?ft.memberToRemove.user?ft.memberToRemove.user.fullName:ft.memberToRemove.contact.fullName:""})),1)]),(0,i.Lk)("footer",vt,[(0,i.Lk)("button",{class:"button is-danger is-rounded",onClick:t[21]||(t[21]=(...e)=>bt.removeMember&&bt.removeMember(...e))},(0,a.v_)(e.$t("remove")),1),(0,i.Lk)("button",{class:"button is-rounded",onClick:t[22]||(t[22]=e=>ft.showRemoveMemberModal=!1)},(0,a.v_)(e.$t("cancel")),1)])])],2),ft.isCsvImportModalOpen&&ft.userList&&bt.isManual?((0,i.uX)(),(0,i.Wv)(Et,{key:3,"user-list":ft.userList,onClose:t[23]||(t[23]=e=>ft.isCsvImportModalOpen=!1),onImported:bt.onCsvImported},null,8,["user-list","onImported"])):(0,i.Q3)("",!0)])}s(20116),s(7588);var ft=s(40834),bt=s(95093),_t=s.n(bt),kt=s(38221),Lt=s.n(kt);const wt={class:"modal-card"},Ct={class:"modal-card-head"},$t={class:"modal-card-title"},Et={class:"modal-card-body"},xt={class:"mb-4"},Ft={class:"is-size-7 has-text-grey mb-4"},St={key:0,class:"has-text-centered py-4"},It={class:"section"},Mt={class:"content has-text-centered"},Tt={class:"mt-3"},Xt={href:"/examples/import_user_list_members.csv",target:"_blank",class:"is-size-7"},Pt={key:1,class:"notification is-light"},Rt={class:"columns is-mobile is-vcentered"},At={class:"column"},Dt={class:"ml-2"},Ot={class:"column is-narrow has-text-grey is-size-7"},Wt={class:"column is-narrow"},Nt={key:2,class:"has-text-centered py-5"},Ut={class:"mt-3 has-text-grey"},Vt={key:3,class:"notification is-danger is-light mt-3"},Kt={class:"modal-card-foot"};function Qt(e,t,s,l,r,n){const o=(0,i.g2)("font-awesome-icon"),d=(0,i.g2)("b-upload"),u=(0,i.g2)("b-loading"),p=(0,i.g2)("b-button"),c=(0,i.g2)("ImportMappingModal"),m=(0,i.g2)("b-modal");return(0,i.uX)(),(0,i.Wv)(m,{"model-value":!0,"has-modal-card":"","can-cancel":!r.isUploading&&!r.wizardImportId,onClose:t[3]||(t[3]=t=>e.$emit("close"))},{default:(0,i.k6)(()=>[(0,i.Lk)("div",wt,[(0,i.Lk)("header",Ct,[(0,i.Lk)("p",$t,(0,a.v_)(e.$t("Import members from CSV")),1)]),(0,i.Lk)("section",Et,[(0,i.Lk)("p",xt,[(0,i.eW)((0,a.v_)(e.$t("Add members to"))+" ",1),(0,i.Lk)("strong",null,(0,a.v_)(s.userList.name),1)]),(0,i.Lk)("p",Ft,(0,a.v_)(e.$t("Bulk-add users and contacts to this list by uploading a CSV. Match by email, user_legacy_id, or phone. Rows that don't match an existing person create a new Contact when email or name is present. Re-uploading the same CSV is safe â already-listed people are skipped.")),1),r.file||r.isUploading?r.file&&!r.isU
1ploading?((0,i.uX)(),(0,i.CE)("div",Pt,[(0,i.Lk)("div",Rt,[(0,i.Lk)("div",At,[(0,i.bF)(o,{icon:["fal","file-csv"]}),(0,i.Lk)("span",Dt,(0,a.v_)(r.file.name),1)]),(0,i.Lk)("div",Ot,(0,a.v_)(n.formatFileSize(r.file.size)),1),(0,i.Lk)("div",Wt,[(0,i.Lk)("button",{class:"button is-small is-rounded is-light",onClick:t[1]||(t[1]=e=>r.file=null)},(0,a.v_)(e.$t("Remove")),1)])])])):(0,i.Q3)("",!0):((0,i.uX)(),(0,i.CE)("div",St,[(0,i.bF)(d,{modelValue:r.file,"onUpdate:modelValue":t[0]||(t[0]=e=>r.file=e),accept:r.IMPORT_ACCEPT,"drag-drop":""},{default:(0,i.k6)(()=>[(0,i.Lk)("section",It,[(0,i.Lk)("div",Mt,[(0,i.Lk)("p",null,[(0,i.bF)(o,{icon:["fal","cloud-arrow-up"],size:"2x"})]),(0,i.Lk)("p",null,(0,a.v_)(e.$t("Drop a CSV file here, or click to select")),1)])])]),_:1},8,["modelValue","accept"]),(0,i.Lk)("p",Tt,[(0,i.Lk)("a",Xt,[(0,i.bF)(o,{icon:["fal","download"]}),(0,i.eW)(" "+(0,a.v_)(e.$t("Download example CSV")),1)])])])),r.isUploading?((0,i.uX)(),(0,i.CE)("div",Nt,[(0,i.bF)(u,{"is-full-page":!1,active:!0}),(0,i.Lk)("p",Ut,(0,a.v_)(r.progressLabel),1)])):(0,i.Q3)("",!0),r.errorMessage?((0,i.uX)(),(0,i.CE)("div",Vt,(0,a.v_)(r.errorMessage),1)):(0,i.Q3)("",!0)]),(0,i.Lk)("footer",Kt,[(0,i.bF)(p,{class:"is-rounded",disabled:r.isUploading,onClick:t[2]||(t[2]=t=>e.$emit("close"))},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Cancel")),1)]),_:1},8,["disabled"]),(0,i.bF)(p,{type:"is-primary",class:"is-rounded",loading:r.isUploading,disabled:!r.file||r.isUploading,onClick:n.startImport},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Start import")),1)]),_:1},8,["loading","disabled","onClick"])])]),(0,i.bF)(c,{active:!!r.wizardImportId,"import-id":r.wizardImportId,"import-type":"user-list-members",onStarted:n.onWizardStarted,onDiscarded:n.onWizardDiscarded,onClose:n.onWizardClosed},null,8,["active","import-id","onStarted","onDiscarded","onClose"])]),_:1},8,["can-cancel"])}var zt=s(63079),jt=s(44385),qt={name:"UserListCsvImportModal",components:{ImportMappingModal:zt.A},props:{userList:{type:Object,required:!0}},emits:["close","imported"],data(){return{IMPORT_ACCEPT:jt.pO,file:null,isUploading:!1,errorMessage:null,progressLabel:this.$t("Uploadingâ¦"),importId:null,wizardImportId:null,pollTimer:null}},beforeUnmount(){this.pollTimer&&(clearTimeout(this.pollTimer),this.pollTimer=null)},methods:{startImport(){this.errorMessage=null,this.file&&this.file.size>(0,jt.pL)(this.file)?this.errorMessage=this.$t("File is larger than the {size} import limit",{size:(0,jt.a7)(this.file)}):(this.isUploading=!0,this.progressLabel=this.$t("Uploadingâ¦"),(0,jt.n0)(this.$http.plain,this.file,"user-list-members").then(({mediaId:e})=>(this.progressLabel=this.$t("Reading the fileâ¦"),this.$http.plain.post("/imports",{type:"user-list-members",media_id:e,wizard:!0,mapping_configuration:{userListId:this.userList.id}}))).then(e=>{if(this.importId=e.data.id,"converting"===e.data.status)return this.progressLabel=this.$t("Reading your spreadsheet..."),this.pollImport(e.data,{intervalMs:3e3,maxAttempts:60,isDone:e=>"mapping"===e.status}).then(e=>{this.wizardImportId=e.id});this.wizardImportId=e.data.id}).catch(e=>{console.log(e),"upload_failed"===e?.message?this.errorMessage=this.$t("Upload failed"):e?.isPollMessage&&e.message?this.errorMessage=e.message:this.errorMessage=e?.response?.data?.error||e?.response?.data?.["hydra:description"]||this.$t("Import failed")}).finally(()=>{this.isUploading=!1}))},onWizardStarted(e){this.wizardImportId=null,this.isUploading=!0,this.progressLabel=this.$t("Processingâ¦"),this.pollImport(e,{intervalMs:5e3,maxAttempts:60,isDone:e=>["completed","rolled_back"].includes(e.status)}).then(e=>{this.$emit("imported",e)}).catch(e=>{console.log(e),this.errorMessage=e?.isPollMessage&&e.message||e?.response?.data?.error||this.$t("Import failed")}).finally(()=>{this.isUploading=!1})},onWizardDiscarded(){this.wizardImportId=null,this.importId=null,this.file=null},onWizardClosed(){this.wizardImportId=null},pollImport(e,{intervalMs:t,maxAttempts:s,isDone:i}){return new Promise((a,l)=>{const r=e=>{const t=new Error(e);t.isPollMessage=!0,l(t)},n=e=>
1i(e)?(a(e),!0):"failed"===e.status&&(r(e.errorSummary?.message||this.$t("Import failed")),!0);if(n(e))return;let o=0;const d=()=>{o+=1,this.$http.plain.get(`/imports/${e.id}`).then(e=>{n(e.data)||(o>=s?r(this.$t("Import timed out")):this.pollTimer=setTimeout(d,t))}).catch(l)};this.pollTimer=setTimeout(d,1500)})},formatFileSize(e){if(!e)return"0 B";const t=1024,s=["B","KB","MB","GB"],i=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,i)*100)/100+" "+s[i]}}},Bt=s(66262);const Gt=(0,Bt.A)(qt,[["render",Qt]]);var Ht=Gt,Jt={name:"UserListView",components:{UserListCsvImportModal:Ht},data(){return{userList:null,isLoading:!1,error:!1,members:[],isLoadingMembers:!1,memberError:!1,memberListLoaded:!1,membersPage:1,membersPerPage:50,membersTotal:0,filter:this.$route.query.filter||"subscribed",userSearch:"",searchResults:[],isSearchingUsers:!1,selectedUsers:[],showAddMembersModal:!1,searchType:"users",isCsvImportModalOpen:!1,memberToRemove:null,showRemoveMemberModal:!1,criteriaExpanded:!1,donationProducts:[],tagMap:{},statusMap:{},localCenterMap:{},propertyOptions:[{value:"status",text:this.$t("Status")},{value:"validFeeDate",text:this.$t("Valid Fee Date")},{value:"isFullMember",text:this.$t("Is Full Member")},{value:"dateJoined",text:this.$t("Date Joined")},{value:"dateJoinedFullMember",text:this.$t("Date Joined Full Member")},{value:"dateBirth",text:this.$t("Date of Birth")},{value:"age",text:this.$t("Age")},{value:"name",text:this.$t("Name")},{value:"email",text:this.$t("Email")},{value:"tags",text:this.$t("Tags")},{value:"hasPayment",text:this.$t("Has Payment")},{value:"hasRecurringPayment",text:this.$t("Has Recurring Payment")},{value:"eventAttends",text:this.$t("Event Attendance")},{value:"feeStatus",text:this.$t("Membership Fee Status")},{value:"localCenter",text:this.$t("Local center")},{value:"userType",text:this.$t("User type")},{value:"donationDropout",text:this.$t("Donation dropout")}],operatorOptions:[{value:"eq",text:this.$t("Equals")},{value:"neq",text:this.$t("Not equals")},{value:"gt",text:this.$t("Greater than")},{value:"gte",text:this.$t("Greater than or equals")},{value:"lt",text:this.$t("Less than")},{value:"lte",text:this.$t("Less than or equals")},{value:"like",text:this.$t("Contains")},{value:"inChildren",text:this.$t("Sub-centers only")},{value:"inSubtree",text:this.$t("Including sub-centers")},{value:"isNull",text:this.$t("Is null")},{value:"isNotNull",text:this.$t("Is not null")},{value:"hasTag",text:this.$t("Has tag")},{value:"hasAllTags",text:this.$t("Has all tags")},{value:"hasNotTag",text:this.$t("Doesn't have tag")}],hasPaymentValues:[{value:"donation",text:this.$t("Has donation")},{value:"not_donation",text:this.$t("No donation")},{value:"any",text:this.$t("Any payment")},{value:"none",text:this.$t("No payments")}],hasRecurringPaymentValues:[{value:"donation_active",text:this.$t("Active donation recurring payment")},{value:"donation_past",text:this.$t("Past donation recurring payment")},{value:"donation_any",text:this.$t("Any donation recurring payment")},{value:"not_donation_active",text:this.$t("No active donation recurring payment")},{value:"not_donation_past",text:this.$t("No past donation recurring payment")},{value:"not_donation_any",text:this.$t("No donation recurring payment")},{value:"any_active",text:this.$t("Any active recurring payment")},{value:"any_past",text:this.$t("Any past recurring payment")},{value:"any",text:this.$t("Any recurring payment")},{value:"none",text:this.$t("No recurring payments")}],eventAttendsValues:[{value:"yes",text:this.$t("Yes")},{value:"no",text:this.$t("No")},{value:"any",text:this.$t("Attended any event")},{value:"none",text:this.$t("Never attended any event")},{value:"specific",text:this.$t("Attended specific event")},{value:"not_specific",text:this.$t("Not attended specific event")}],feeStatusValues:[{value:"paid",text:this.$t("Paid")},{value:"not_paid",text:this.$t("Not Paid")}],donationDropoutValues:[{value:"yes",text:this.$t("Started but never donated")}]}},computed:{...(0,ft.L8)(["tenant"]),id(){return parseInt(this.$route.params.item)},hasCriteria(){return this.userList&&"dynamic"===this.userList.type&&this.userList.criteria&&this.userList.criteria.length>0},hasEventAttendsCriteria(){return this.userList&&this.userList.hasEventAttendsCriteria},isManual(){return this.userList&&"static"===this.userList.type},totalLabel(){return this.userList&&"contacts_only"===this.userList.scope?this.$t("Total Contacts"):this.userList&&"members_only"===this.userList.scope?this.$t("Total Members"):this.$t("Total People")},memberCount(){return this.userList?this.hasCriteria?"subscribed"===this.filter?this.userList.subscribedCount||0:"not-subscribed"===this.filter?this.userList.notSubscribedCount||0:this.userList.itemsCount||0:this.userList.itemsCount||0:0},shouldShowLoadButton(){return this.userList&&this.userList.itemsCount>100},displayedCriteria(){return this.userList&&this.userList.criteria?this.userList.criteria.length<=2||this.criteriaExpanded?this.userList.criteria:this.userList.criteria.slice(0,2):[]}},created(){this.searchEntities=Lt()(this.performEntitySearch,500)},mounted(){this.fetchUserList(),this.fetchDonationProducts(),this.fetchTags(),this.fetchStatuses(),this.tenant?.settingFeatures?.localCenter?.isActive&&this.fetchLocalCenters()},methods:{fetchDonationProducts(){this.$http.plain.get("/my-products?type=donation").then(e=>{this.donationProducts=(e.data["hydra:member"]||[]).map(e=>({uuid:e.uuid,name:e.name}))}).catch(e=>{console.log(e)})},getProductName(e){if(!e)return"";const t=this.donationProducts.find(t=>t.uuid===e);return t?t.name:e},fetchUserList(){this.isLoading=!0,this.error=!1,this.$http.plain.get(`/user_lists/${this.id}`).then(e=>{this.userList=e.data,this.userList.itemsCount>0&&!this.shouldShowLoadButton&&!this.memberListLoaded&&this.fetchMembers()}).catch(e=>{console.error("Error fetching user list:",e),this.error=!0,this.$emit("error",this.$t("error_fetching_data"))}).finally(()=>{this.isLoading=!1})},fetchMembers(){this.isLoadingMembers=!0,this.memberError=!1,this.memberListLoaded=!0;const e=this.hasCriteria?this.filter:"all",t=`/user_lists/${this.id}/members/${e}`,s={page:this.membersPage,itemsPerPage:this.membersPerPage};return this.$http.plain.get(t,{params:s}).then(e=>{this.members=e.data.items,this.membersTotal=e.data.totalItems}).catch(e=>{console.error("Error fetching members:",e),this.memberError=!0}).finally(()=>{this.isLoadingMembers=!1})},formatDate(e){return e?_t()(e).format("LL"):"-"},showModal(){this.userSearch="",this.searchResults=[],this.selectedUsers=[],this.searchType="users",this.showAddMembersModal=!0},onCsvImported(e){this.isCsvImportModalOpen=!1;
1const t=(e?.successfulRows||0)+(e?.skippedRows||0),s=e?.successfulRows||0;s>0?this.$buefy.toast.open({message:this.$t("Added {added} new members ({total} total in CSV)",{added:s,total:t}),type:"is-success"}):e?.skippedRows>0&&this.$buefy.toast.open({message:this.$t("All {total} members were already in the list",{total:t}),type:"is-info"}),this.fetchUserList(),this.memberListLoaded&&this.fetchMembers()},performEntitySearch(){if(this.userSearch.length<3)return void(this.searchResults=[]);this.isSearchingUsers=!0;const e="users"===this.searchType?"fullName":"name";this.$http.plain.get("/"+("users"===this.searchType?"users":"contacts"),{params:{"tenant.id":this.tenant.id,[e]:this.userSearch}}).then(e=>{const t=this.members.filter(e=>!e.isDynamic).map(e=>"users"===this.searchType?e.user?e.user.id:null:e.contact?e.contact.id:null).filter(e=>null!==e);this.searchResults=e.data["hydra:member"].filter(e=>!t.includes(e.id))}).catch(e=>{console.error("Error searching entities:",e),this.$emit("error",this.$t("error_fetching_data"))}).finally(()=>{this.isSearchingUsers=!1})},clearSearch(){this.userSearch="",this.searchResults=[]},onRowSelected(e){this.selectedUsers=e},addSelectedMembers(){if(0===this.selectedUsers.length)return;const e=this.selectedUsers.map(e=>{const t={userList:`/api/v1/user_lists/${this.id}`};return"users"===this.searchType?t.user=`/api/v1/users/${e.id}`:t.contact=`/api/v1/contacts/${e.id}`,this.$http.plain.post("/user_list_links",t)});Promise.all(e).then(()=>{if(this.$emit("success",this.$t("members_added_successfully")),this.showAddMembersModal=!1,this.membersPage=1,this.fetchUserList(),this.memberListLoaded)return this.fetchMembers()}).catch(e=>{console.error("Error adding members:",e),this.$emit("error",this.$t("error_saving"))})},confirmRemoveMember(e){this.memberToRemove=e,this.showRemoveMemberModal=!0},removeMember(){this.memberToRemove&&this.$http.plain.delete(`/user_list_links/${this.memberToRemove.id}`).then(()=>(this.$emit("success",this.$t("member_removed_successfully")),this.showRemoveMemberModal=!1,this.membersPage=1,this.fetchUserList(),this.fetchMembers())).catch(e=>{console.error("Error removing member:",e),this.$emit("error",this.$t("error_deleting"))})},getPropertyText(e){const t=this.propertyOptions.find(t=>t.value===e);return t?t.text:e},getOperatorText(e,t=null){if((this.isLocalCenterProperty(t)||this.isUserTypeProperty(t))&&"eq"===e)return this.$t("Is one of");const s=this.operatorOptions.find(t=>t.value===e);return s?s.text:e},isDateProperty(e){return["validFeeDate","dateBirth","dateJoined","dateJoinedFullMember"].includes(e)},isBooleanProperty(e){return["isFullMember"].includes(e)},isTagProperty(e){return["tags"].includes(e)},isSelectValueProperty(e){return["status","hasPayment","hasRecurringPayment","eventAttends","feeStatus","donationDropout"].includes(e)},isNullOperator(e){return["isNull","isNotNull"].includes(e)},fetchStatuses(){this.$http.plain.get("/profile_statuses?order[position]=asc").then(e=>{const t=e.data["hydra:member"]||[],s={none:this.$t("No status")};t.forEach(e=>{s[String(e.id)]=e.name}),this.statusMap=s}
1).catch(e=>{console.error(e)})},fetchTags(){this.$http.plain.get("/tags?itemsPerPage=200").then(e=>{const t=e.data["hydra:member"]||[],s={};t.forEach(e=>{s[String(e.id)]=e.name}),this.tagMap=s}).catch(e=>{console.error(e)})},getTagName(e){return this.tagMap[String(e)]||`Tag #${e}`},fetchLocalCenters(){this.$http.plain.get("/local_centers_all?isActive=1&tenantSlug="+this.tenant.slug).then(e=>{const t={};(e.data["hydra:member"]||[]).forEach(e=>{t[String(e.id)]=e.name}),this.localCenterMap=t}).catch(e=>{console.log(e)})},getLocalCenterName(e){return this.localCenterMap[String(e)]||`#${e}`},getLocalCenterNames(e){const t=Array.isArray(e)?e:[e];return t.map(e=>this.getLocalCenterName(e)).join(` ${this.$t("or")} `)},isLocalCenterProperty(e){return"localCenter"===e},isUserTypeProperty(e){return"userType"===e},getUserTypeNames(e){const t=this.tenant?.roles||[],s=Array.isArray(e)?e:[e];return s.map(e=>t.find(t=>t.isUserType&&t.id===Number(e))?.name||`#${e}`).join(` ${this.$t("or")} `)},getSelectValueText(e,t){if("status"===e)return this.statusMap[String(t)]||t;let s=[];"hasPayment"===e?s=this.hasPaymentValues:"hasRecurringPayment"===e?s=this.hasRecurringPaymentValues:"eventAttends"===e?s=this.eventAttendsValues:"feeStatus"===e?s=this.feeStatusValues:"donationDropout"===e&&(s=this.donationDropoutValues);const i=s.find(e=>e.value===t);return i?i.text:t},handleFilterChange(){this.memberListLoaded&&this.fetchMembers()},changeFilter(e){this.filter=e,this.membersPage=1,this.handleFilterChange()},changeMembersPage(e){this.membersPage=e,this.fetchMembers()}}};const Yt=(0,Bt.A)(Jt,[["render",yt],["__scopeId","data-v-1afe17e4"]]);var Zt=Yt},95875:function(e,t,s){s.d(t,{A:function(){return C}});var i=s(20641),a=s(90033);const l={class:"import-ledger-table"},r={key:0,class:"import-ledger-table__loading","aria-hidden":"true"},n={key:1,class:"notification is-danger is-light import-ledger-table__error"},o={class:"import-ledger-table__error-message"},d={key:2,class:"list-empty-state import-ledger-table__empty"},u={class:"list-empty-state-message"},p={class:"import-ledger-list"},c={class:"import-ledger-list__head"},m={class:"import-ledger-list__row"},h={class:"import-ledger-list__reason"},g={key:0,class:"import-ledger-list__source orgo-table-wrap"},v={class:"table is-narrow import-ledger-list__table"},y=["title"];function f(e,t,s,f,b,_){const k=(0,i.g2)("b-skeleton"),L=(0,i.g2)("font-awesome-icon"),w=(0,i.g2)("b-button"),C=(0,i.g2)("b-tag"),$=(0,i.g2)("b-pagination");return(0,i.uX)(),(0,i.CE)("div",l,[b.isLoading?((0,i.uX)(),(0,i.CE)("div",r,[((0,i.uX)(),(0,i.CE)(i.FK,null,(0,i.pI)(3,e=>(0,i.bF)(k,{key:`import-ledger-skeleton-${e}`,height:"36px",animated:""})),64))])):b.loadError?((0,i.uX)(),(0,i.CE)("div",n,[(0,i.bF)(L,{icon:"fa-light fa-triangle-exclamation"}),(0,i.Lk)("span",o,(0,a.v_)(b.loadError),1),(0,i.bF)(w,{class:"is-rounded import-ledger-table__retry",size:"is-small",onClick:_.load},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("Retry")),1)]),_:1},8,["onClick"])])):b.rows.length?((0,i.uX)(),(0,i.CE)(i.FK,{key:3},[(0,i.Lk)("ul",p,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(b.rows,t=>((0,i.uX)(),(0,i.CE)("li",{key:t.id,class:"import-ledger-list__item"},[(0,i.Lk)("div",c,[(0,i.Lk)("span",m,(0,a.v_)(_.rowLabel(t)),1),(0,i.bF)(C,{class:(0,a.C4)(["is-rounded is-small",_.outcomeTagClass(t.outcome)])},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t(_.outcomeLabel(t.outcome))),1)]),_:2},1032,["class"]),(0,i.Lk)("span",h,(0,a.v_)(t.errorMessage||"-"),1)]),_.sourceCells(t).length?((0,i.uX)(),(0,i.CE)("div",g,[(0,i.Lk)("table",v,[(0,i.Lk)("thead",null,[(0,i.Lk)("tr",null,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(_.sourceCells(t),e=>((0,i.uX)(),(0,i.CE)("th",{key:e.key},(0,a.v_)(e.label),1))),128))])]),(0,i.Lk)("tbody",null,[(0,i.Lk)("tr",null,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(_.sourceCells(t),e=>((0,i.uX)(),(0,i.CE)("td",{key:e.key,title:e.value},(0,a.v_)(e.value),9,y))),128))])])])])):(0,i.Q3)("",!0)]))),128))]),b.total>b.perPage?((0,i.uX)(),(0,i.Wv)($,{key:0,class:"import-ledger-table__pagination",total:b.total,"per-page":b.perPage,current:b.page,"backend-pagination":"","pagination-rounded":"",size:"is-small",onChange:_.changePage},null,8,["total","per-page","current","onChange"])):(0,i.Q3)("",!0)],64)):((0,i.uX)(),(0,i.CE)("div",d,[(0,i.bF)(L,{icon:"fa-light fa-list-check",class:"list-empty-state-icon"}),(0,i.Lk)("p",u,(0,a.v_)(e.$t("No rows in this group")),1)]))])}s(44114),s(18111),s(22489),s(7588),s(61701);const b=20,_=["create","update"];var k={name:"ImportLedgerTable",props:{importId:{type:Number,required:!0},phase:{type:String,default:"run",validator:e=>["preflight","run"].includes(e)},filter:{type:Object,default:null},headers:{type:Array,default:null}},data(){return{perPage:b,rows:[],total:0,page:1,isLoading:!1,loadError:null,loadRequestId:0}},computed:{rawHeaders(){if(!this.showRawColumns)return[];if(this.headers&&this.headers.length)return this.headers;const e=[];return this.rows.forEach(t=>{Object.keys(t.rowData||{}
1).forEach(t=>{e.includes(t)||e.push(t)})}),e.map(e=>({key:e,raw:e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g," ")}))},showRawColumns(){return!_.includes(this.filter?.outcome)}},watch:{importId(){this.reload()},phase(){this.reload()},filter:{deep:!0,handler(){this.reload()}}},created(){this.load()},methods:{reload(){this.page=1,this.load()},changePage(e){this.page=e,this.load()},load(){const e=++this.loadRequestId;this.isLoading=!0,this.loadError=null,this.$http.plain.get("/imports/"+this.importId+"/logs",{params:{page:this.page,phase:this.phase,...this.filter||{}}}).then(t=>{e===this.loadRequestId&&(this.rows=t.data["hydra:member"]||[],this.total=t.data["hydra:totalItems"]||0)}).catch(t=>{console.error(t),e===this.loadRequestId&&(this.rows=[],this.total=0,this.loadError=t.response?.data?.error||this.$t("Could not load these rows"))}).finally(()=>{e===this.loadRequestId&&(this.isLoading=!1)})},rowLabel(e){return e.rowNumber?this.$t("Row")+" "+e.rowNumber:this.$t("File")},sourceCells(e){return this.showRawColumns&&e.rowData?this.rawHeaders.map(t=>({key:t.key,label:t.raw,value:this.cellValue(e,t.key)})).filter(e=>"-"!==e.value):[]},cellValue(e,t){const s=e.rowData?e.rowData[t]:null;return null===s||void 0===s||""===s?"-":String(s)},outcomeLabel(e){const t={create:"Created",update:"Updated",skip:"Skipped",fail:"Failed",warning:"Warning"};return t[e]||e||"-"},outcomeTagClass(e){const t={create:"is-success",update:"is-success",skip:"is-warning",fail:"is-danger",warning:"is-warning is-passive"};return t[e]||"is-default"}}},L=s(66262);const w=(0,L.A)(k,[["render",f],["__scopeId","data-v-6f87ce32"]]);var C=w}}]);
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.