1import{fc as O,j as e,aZ as C,jl as E,fT as x,b as D,i as f,N as W,bX as h,R as y,T as k,x as T,c as _,d as G,a9 as B,I as u,af as H,a7 as K,m as N,jm as Y,D as $}from"./index-o5hMGMsX.js";import{a as g}from"./vendor-react-DFM4tGg0.js";import{C as j}from"./CheckboxCell-CVrZM6KZ.js";import{C as b}from"./Checkbox-RfKV1Hfk.js";import{C as z}from"./ConfirmationButton-Cd9A61KR.js";import{C as q,a as V,E as X}from"./CrudBaseModelPage-qunGMpI3.js";import{I as c}from"./InfoHover-BZS1Veka.js";import{L as Z}from"./LabeledOptionsSelect-BPWs3tiT.js";import{L as J}from"./LegendWithSimilarItemsWarning-BdSZZsJn.js";import{T as Q}from"./TextArea-EnRnNMNL.js";import{D as ee}from"./DatePicker-ukPSZoFm.js";import"./vendor-redux-byXXH3Fl.js";import"./vendor-firebase-BtY9UEN7.js";import"./vendor-react-grid-nj3QJOH1.js";import"./utils-BxJw8CCi.js";import"./vendor-ag-grid-BjjCojRR.js";import"./colors-D3t2KOS4.js";import"./PeriodInterval-C0-cxJaU.js";import"./markdown-DCCdrTqW.js";import"./vendor-chartjs-DRPi5OMT.js";import"./FileDownloadLink-Cm6rAnBt.js";import"./MultiLabel-BH9UQah-.js";import"./TreeExpandCollapseArrow-Qaohde3g.js";import"./ConfirmDialog-CX3wb_tZ.js";import"./NoDataPlaceholder-CJarnloL.js";import"./TableSettingsPage-D6Nj_XNA.js";import"./BaseSettingsPage-gqf4ZzVg.js";import"./ActionBar-BSUmFWiu.js";import"./ActionBarSpacer-D2eOHL9q.js";import"./SidebarView-C6ewn6yP.js";import"./SidebarList-BkkgW3ej.js";import"./SimilarItemsExistWarning-D02M1nTT.js";import"./Banner-BtsayEAT.js";import"./react-dates-B7DinMeo.js";function te(t,i){const n=t.split(":"),s=n.length>1,r=s?x(n[0].replaceAll("_"," ")):"",d=s?n[1]:t;if(["Location","Product"].some(m=>r.startsWith(m)))return[r,d].join(":");const l=i.get(d),o=l?l.displayName:x(d.replaceAll("_"," "));return s?[r,o].join(":"):o}const v=({fieldMappings:t})=>{const i=O(),n=t.filter(l=>l.field.startsWith("product:")),s=t.filter(l=>l.field.startsWith("location:")),r=t.filter(l=>!n.includes(l)&&!s.includes(l)),d=[...n,...s,...r];return e.jsx("div",{className:"FieldMapTable",children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Raw File Reference"}),e.jsx("th",{children:"Alloy Field"})]})}),e.jsx("tbody",{children:d.map(l=>l.fieldDefinitions.length?e.jsxs("tr",{children:[e.jsx("td",{className:"field-map-raw-file-ref-col",children:l.fieldDefinitions.map(o=>e.jsxs("div",{children:[" ",e.jsx("span",{className:C("field-definition-value",o.sourceType===E.UNKNOWN?"unknown":""),children:o.value}),e.jsxs("span",{className:"field-definition-source-type",children:[" ","(",o.sourceType.replace("_"," ").toLowerCase(),")"]})]},o.value))}),e.jsx("td",{children:te(l.field,i)})]},l.field.replaceAll(".:","_")):null)})]})})};v.displayName="FieldMapTable";function P(t){return t.name}function p(t,i){return f(i.user.role,y.ROOT)}function A(t){return t.deprecatedAt&&Date.now()>=Date.parse(t.deprecatedAt)}function F(t){return t.fieldMap.length>=1}function ae(){return[{cellClass:t=>C({deprecated:A(t.data)}),colId:"name",headerName:"Name",valueGetter:t=>`${t.data.name}${A(t.data)?" (Deprecated)":""}`},{cellRendererFramework:j,colId:"public",headerName:"Public",valueGetter:t=>t.data.isPublic},{colId:"displayName",headerName:"Display Name",valueGetter:t=>t.data.displayName},{colId:"contentDisplayName",headerName:"Content Name",valueGetter:t=>t.data.contentDisplayName},{colId:"dataIntegrationName",headerName:"Data Integration",valueGetter:t=>t.data.dataSourceName},{colId:"fieldMapSpecified",headerName:"Field Map Specified?",valueGetter:t=>F(t.data)?"Yes":"No"},{cellRendererFramework:j,colId:"canUpdatePublicLocationAttributes",headerName:"Can Update Public Locations",valueGetter:t=>t.data.canUpdatePublicLocationAttributes}]}const ie=({isNew:t,model:i,originalModel:n,onChange:s,existingItems:r})=>{const d=_(G(B.getDataSources.getResource())),l=D(),o=a=>a.isArchived?e.jsxs("fieldset",{className:"isArchived",children:[e.jsx("legend",{children:"Archived"}),e.jsxs("p",{children:["The filetype no longer has the supporting infrastructure in the system and therefore, is"," ",e.jsx("b",{children:"archived"}),". No data is expected on this filetype starting"," ",a.deprecatedAt??N().format(Y),"."]})]}):e.jsxs("fieldset",{className:"deprecatedAt",children:[e.jsxs("legend",{children:["Deactivated At (Optional)",e.
1jsx(c,{children:"This should be used if we transitioned to a new filetype or otherwise retire a filetype. Data on this day and later from this filetype will no longer be expected Alloy-wide."})]}),e.jsx(ee,{date:a.deprecatedAt?N(a.deprecatedAt):null,isClearable:!0,onChange:U})]}),m=a=>s({...i,name:a.target.value}),w=a=>s({...i,isPublic:a}),I=a=>s({...i,canUpdatePublicLocationAttributes:a}),M=a=>s({...i,displayName:a.target.value}),S=a=>s({...i,contentDisplayName:a.target.value}),L=a=>s({...i,dataSourceName:a}),U=a=>{s({...i,deprecatedAt:a?a.format($):null})},R=a=>{s({...i,notes:a||null})};return e.jsxs(T,{children:[e.jsxs("fieldset",{className:"name",children:[e.jsx(J,{getComparisonString:P,isHidden:!t,itemsToCheck:r.filter(a=>a!==n),probe:i,children:"Name"}),e.jsx(u,{disabled:!t,placeholder:"Name",type:"text",value:i.name,onChange:m})]}),e.jsxs("fieldset",{children:[e.jsxs("legend",{children:["Visibility",e.jsx(c,{children:"Public filetypes will contribute data to what's shown in a data integration entry page for users who do not own that integration. Private filetypes will still show their data for those who receive it."})]}),e.jsx(b,{checked:i.isPublic,label:"Public",onChange:w})]}),e.jsxs("fieldset",{children:[e.jsxs("legend",{children:["Public Location Attributes",e.jsx(c,{children:"When enabled, this filetype can update public location attributes during import. This setting is disabled for Alloy filetypes."})]}),e.jsx(b,{checked:i.canUpdatePublicLocationAttributes,disabled:i.name.startsWith("alloy"),label:"Can update public location attributes",onChange:I})]}),e.jsxs("fieldset",{className:"displayName",children:[e.jsx("legend",{children:"Display Name"}),e.jsx(u,{disabled:!p(n,l),placeholder:"Display Name",type:"text",value:i.displayName,onChange:M})]}),e.jsxs("fieldset",{children:[e.jsxs("legend",{children:["Content Display Name"," ",e.jsx(c,{children:'The display name of the content, typically excluding the retailer name. For example, if displayName is "Walmart (POS)", content display name is "POS".'})]}),e.jsx(u,{disabled:!p(n,l),placeholder:"Content Display Name",type:"text",value:i.contentDisplayName,onChange:S})]}),!t&&F(i)&&e.jsxs("fieldset",{className:"fieldMap",children:[e.jsxs("legend",{children:["Field Map",e.jsx(c,{children:"This mapping specifies how Alloy fields are generated from a raw file of this type. It is not editable via this tool."})]}),e.jsx(v,{fieldMappings:i.fieldMap})]}),e.jsxs("fieldset",{className:"data-source-name",children:[e.jsx("legend",{children:"Data Integration"}),e.jsx(Z,{disabled:!p(n,l),options:H(d.map(a=>a.name)).sort().map(a=>({label:a,value:a})).toArray(),selectedOption:i.dataSourceName??"",onChange:L}),i.dataSourceName!==n.dataSourceName&&e.jsxs("p",{children:[e.jsx(K,{icon:"triangle-exclamation"})," Note: changing this filetype's Data Integration Name will change how files are categorized. You likely need to update old files with this filetype to match, which can be done via their vendors' files pages."]})]}),o(i),f(l.user.role,y.SUPER_ADMIN)&&e.jsxs("fieldset",{className:"notes",children:[e.jsxs("legend",{children:["Notes (Optional)",e.jsx(c,{children:"These notes should be used primarily by CS-T and data engineers to document extractor logic."})]}),e.jsx(Q,{cols:80,rows:4,value:i.notes||"",onChange:a=>R(a.target.value)})]})]})},se=()=>{const t=D(),i=g.useMemo(()=>({displayType:q.TABLE,FormComponent:ie,modalSize:"lg",modalClassName:"filetypes-edit-modal",endpoints:{get:h.getUsedFileTypes,create:h.saveFileType,update:s=>h.saveFileType(s),delete:h.deleteFileType},modelComparator:W(s=>k(s.deprecatedAt)).thenAscendingBy(s=>s.name),getModelUniqueKey:P,canCreate:s=>f(s.user.role,y.ROOT),getConfirmActions:(s,r)=>p(s,r)?[z.DELETE]:[],getModelTitle:s=>s.displayName,canModify:p,getDefaultModel:()=>({name:"",contentDisplayName:"",displayName:"",dataSourceName:"",deprecatedAt:null,isArchived:!1,isPublic:!0,canUpdatePublicLocationAttributes:!1,fieldMap:[],notes:null}),modelName:"Filetype",colDefs:ae()}),[]),n=g.useCallback(s=>e.jsxs(T,{children:[e.jsxs("p",{children:["Are you sure you want to delete the filetype ",e.jsx("i",{children:s.item.name}),"? ",e.jsx("br",{})]}),e.jsx("p",{children:"A filetype can only be deleted when there is:"}
1),e.jsxs("ul",{children:[e.jsx("li",{children:"No infrastructure associated with it, and"}),e.jsx("li",{children:"Has no reference to the filetype anywhere in our system"})]})]}),[]);return e.jsx(V,{baseUrl:`/${t.vendor.name}/settings/filetypes`,className:"FileTypesPage",columnWidth:X.FULL,config:i,customConfirmContent:n})};se.displayName="FileTypesPage";export{se as default}; 2//# sourceMappingURL=FileTypesPage-C1iP8sAZ.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.