1import{z as W,A as R,j as e,d as i,B as G,C as q,D as N,E as U,G as J,g as Q,H as Y,I as Z,r as y,o as X,J as K,a as ee}from"./index-D6EGPuBX.js";import{C as te}from"./common_admin_layout-Br0pPwuB.js";import{A as ie}from"./layout-BCNhc604.js";import{u as I,g as k}from"./gql-pDldDZKs.js";import{_ as se,a as ne}from"./_arrayIncludesWith-DhbiKCwm.js";import{a as oe}from"./admin_layout_base-OFjLav4n.js";import{u as le}from"./useMutation-C1Ch55G_.js";import"./ApolloContext-C4RA8h06.js";function H({name:o,label:n}){var c;const{isSubmitting:l}=W(),[f,,t]=R({name:o,type:"checkbox"}),{data:g}=I(k(` 2 query ContentFeed_SettingsForm_ThingTypeSelect { 3 thingTypes { 4 thingTypes { 5 thingTypeKey 6 itemType 7 label 8 } 9 } 10 } 11 `)),u=(c=g==null?void 0:g.thingTypes)==null?void 0:c.thingTypes;return e.jsxs(i.FieldWrapper,{children:[e.jsx(i.FieldLabelAndDescription,{label:n}),e.jsx(i.Grid,{space:"extraSmall",children:u==null?void 0:u.map(({thingTypeKey:s,label:h})=>e.jsx(i.GridItem,{columns:{"@initial":6},children:e.jsx(i.Checkbox,{disabled:l,label:h,value:s,checked:f.value.includes(s),onChange:a=>{a?t.setValue([...f.value,s]):t.setValue(f.value.filter(r=>r!==s))},onBlur:f.onBlur})},s))})]})}function T({children:o,css:n,...l}){return e.jsx(i.Card,{...l,css:{padding:"$6",...n},children:o})}function w({children:o,css:n,...l}){return e.jsx(i.Heading,{as:"h2",...l,css:{marginBottom:"$6",...n},children:o})}var re=G,ae=se,ce=ne,de=q,fe=N,he=U,ge=200;function ue(o,n,l,f){var t=-1,g=ae,u=!0,c=o.length,s=[],h=n.length;if(!c)return s;l&&(n=de(n,fe(l))),f?(g=ce,u=!1):n.length>=ge&&(g=he,u=!1,n=new re(n));e:for(;++t<c;){var a=o[t],r=l==null?a:l(a);if(a=f||a!==0?a:0,u&&r===r){for(var m=h;m--;)if(n[m]===r)continue e;s.push(a)}else g(n,r,f)||s.push(a)}return s}var pe=ue,xe=pe,me=Y,Ce=J,M=Z,be=Ce(function(o,n){return M(o)?xe(o,me(n,1,M,!0)):[]}),je=be;const P=Q(je),_e=i.styled("div",{display:"flex"});function ye(o){const{inputPlaceholder:n,size:l="large",isOpen:f=!1,buttonTitle:t,buttonCaption:g,options:u=[],selectedOptions:c=[],onChange:s,searchEnabled:h=!1,...a}=o,[r,m]=y.useState(f),[b,j]=y.useState(""),x=()=>{m(!r)};y.useEffect(()=>{h||j("")},[h]);const _=b.trim()===""?u:u.filter(d=>{var S;const C=(S=d.text)==null?void 0:S.toLowerCase(),p=d.value.toLowerCase();return C?C.includes(b.toLowerCase()):p.includes(b.toLowerCase())}),v=(d,C)=>{if(d){const p=[...c,{value:C}];s(p)}else{const p=c.filter(S=>S.value!==C);s(p)}};return e.jsx(_e,{...a,children:e.jsx(i.Popover,{placement:"bottom",isShown:r||f,width:"trigger",content:e.jsxs(i.VStack,{css:{padding:10,gap:0},children:[h&&e.jsx(i.Box,{css:{marginBottom:10},children:e.jsx(i.TextInput,{iconBefore:i.SearchIcon,placeholder:n,onChange:d=>{j(d)}})}),_.map(d=>{const C=c.some(p=>p.value===d.value);return e.jsx(i.Switch,{value:d.value,label:(d==null?void 0:d.text)||d.value,selected:C,labelPlacement:"start",labelProps:{css:{color:i.colors.gray1}},css:{width:"100%",justifyContent:"space-between",padding:10,svg:{flex:"none"}},onChange:p=>{v(p,d.value)}},d.value)})]}),children:e.jsx(i.PickerButton,{size:l,isPressed:r,onClick:x,css:{["strong"+i.Strong]:{fontSize:"$3",lineHeight:"100%"},["span"+i.Text]:{fontSize:"$1",lineHeight:"100%"}},children:e.jsxs(i.VStack,{space:"small",css:{gap:"8px"},children:[!g&&e.jsx(i.Text,{css:{color:i.colors.gray1},children:t}),g&&e.jsxs(e.Fragment,{children:[e.jsx(i.Strong,{css:{color:i.colors.gray1},children:t}),e.jsx(i.Text,{css:{fontSize:"$1",textTransform:"uppercase"},children:g})]})]})})})})}function Se({options:o,textAccessor:n,valueAccessor:l,selectLabel:f,name:t,label:g}){const{isSubmitting:u}=W(),[c,,s]=R({name:t,type:"checkbox"}),h=y.useMemo(()=>o.map(r=>({value:l(r).toString(),text:n(r)})),[o]),a=y.useMemo(()=>h.filter(r=>c.value.includes(parseInt(r.value,10))),[c.value,h]);return e.jsxs(i.FieldWrapper,{children:[e.jsx(i.FieldLabelAndDescription,{label:g}),e.jsx(ye,{disabled:u,buttonTitle:f,buttonCaption:a.length>0?`${a.length} selected`:void 0,searchEnabled:!0,options:h,selectedOptions:a,onChange:r=>{const m=r.map(_=>parseInt(_.value,10)),b=P(c.value,m),j=P(m,c.value);let x=c.value;b.length>0&&(x=x.filter(_=>!b.includes(_))),j.length>0&&(x=[...x,...j]),x!==c.value&&s.setValue(x)}}),a.length>0&&e.jsx(i.Box,{children:a.map(r=>e.jsx(i.Text,{size:"extraSmall",children:r.text},r.value))})]})}function F({name:o,label:n}){const{data:l}=I(k(` 12 query ContentFeed_SettingsForm_CategorySelect { 13 categories { 14 categories { 15 id 16 title 17 titleIncludingAncestors 18 } 19 } 20 } 21 `)),f=y.useMemo(()=>{var t;return((t=l==null?void 0:l.categories)==null?void 0:t.categories)??[]},[l]);return e.jsx(Se,{name:o,label:n,selectLabel:"Find categories",options:f,textAccessor:t=>t.titleIncludingAncestors??t.title??t.id,valueAccessor:t=>parseInt(t.id,10)})}function E(o){return o.split(",").map(n=>
21parseInt(n.trim(),10)).filter(Boolean)}function Te({id:o}){const n=i.useToaster(),{data:l}=I(k(` 22 query ContentFeed_SettingsForm($id: ID!) { 23 contentFeed(id: $id) { 24 id 25 title 26 identifier 27 description 28 optIn 29 incomingFeedsConfig 30 hidden 31 shareWithOtherOrgs 32 filterConfig { 33 scopeThingTypes 34 scopeThingTypesExclude 35 scopeContentFeeds 36 scopeContentFeedsExclude 37 scopeCategories 38 scopeCategoriesCombineLogic 39 scopeCategoriesExclude 40 scopeCategoriesExcludeCombineLogic 41 filterCategories 42 filterCategoriesCombineLogic 43 filterCategoriesExclude 44 filterCategoriesExcludeCombineLogic 45 filterContentFeeds 46 filterContentFeedsExclude 47 filterAuthors 48 filterAuthorsExclude 49 } 50 } 51 } 52 `),{fetchPolicy:"network-only",variables:{id:o}}),[f]=le(k(` 53 mutation ContentFeed_Save($id: ID!, $input: ContentFeedAttributes!) { 54 updateContentFeed(id: $id, contentFeed: $input) { 55 id 56 title 57 identifier 58 description 59 optIn 60 incomingFeedsConfig 61 hidden 62 shareWithOtherOrgs 63 filterConfig { 64 scopeThingTypes 65 scopeThingTypesExclude 66 scopeContentFeeds 67 scopeContentFeedsExclude 68 scopeCategories 69 scopeCategoriesCombineLogic 70 scopeCategoriesExclude 71 scopeCategoriesExcludeCombineLogic 72 filterCategories 73 filterCategoriesCombineLogic 74 filterCategoriesExclude 75 filterCategoriesExcludeCombineLogic 76 filterContentFeeds 77 filterContentFeedsExclude 78 filterAuthors 79 filterAuthorsExclude 80 } 81 } 82 } 83 `)),t=l==null?void 0:l.contentFeed,g=y.useRef(null),u=y.useMemo(()=>{var s,h,a,r,m,b,j,x,_,v,d,C,p,S,A,L,O,z,V,$,B,D;return{title:t==null?void 0:t.title,identifier:t==null?void 0:t.identifier,description:t==null?void 0:t.description,incomingFeedsConfig:t==null?void 0:t.incomingFeedsConfig,optIn:t==null?void 0:t.optIn,hidden:t==null?void 0:t.hidden,shareWithOtherOrgs:t==null?void 0:t.shareWithOtherOrgs,filterConfig:{scopeThingTypes:((s=t==null?void 0:t.filterConfig)==null?void 0:s.scopeThingTypes)??[],scopeThingTypesExclude:((h=t==null?void 0:t.filterConfig)==null?void 0:h.scopeThingTypesExclude)??[],scopeContentFeeds:((r=(a=t==null?void 0:t.filterConfig)==null?void 0:a.scopeContentFeeds)==null?void 0:r.join(", "))??"",scopeContentFeedsExclude:((b=(m=t==null?void 0:t.filterConfig)==null?void 0:m.scopeContentFeedsExclude)==null?void 0:b.join(", "))??"",scopeCategories:((j=t==null?void 0:t.filterConfig)==null?void 0:j.scopeCategories)??[],scopeCategoriesCombineLogic:((x=t==null?void 0:t.filterConfig)==null?void 0:x.scopeCategoriesCombineLogic)??"all",scopeCategoriesExclude:((_=t==null?void 0:t.filterConfig)==null?void 0:_.scopeCategoriesExclude)??[],scopeCategoriesExcludeCombineLogic:((v=t==null?void 0:t.filterConfig)==null?void 0:v.scopeCategoriesExcludeCombineLogic)??"all",filterCategories:((d=t==null?void 0:t.filterConfig)==null?void 0:d.filterCategories)??[],filterCategoriesCombineLogic:((C=t==null?void 0:t.filterConfig)==null?void 0:C.filterCategoriesCombineLogic)??"all",filterCategoriesExclude:((p=t==null?void 0:t.filterConfig)==null?void 0:p.filterCategoriesExclude)??[],filterCategoriesExcludeCombineLogic:((S=t==null?void 0:t.filterConfig)==null?void 0:S.filterCategoriesExcludeCombineLogic)??"all",filterContentFeeds:((L=(A=t==null?void 0:t.filterConfig)==null?void 0:A.filterContentFeeds)==null?void 0:L.join(", "))??"",filterContentFeedsExclude:((z=(O=t==null?void 0:t.filterConfig)==null?void 0:O.filterContentFeedsExclude)==null?void 0:z.join(", "))??"",filterAuthors:(($=(V=t==null?void 0:t.filterConfig)==null?void 0:V.filterAuthors)==null?void 0:$.join(", "))??"",filterAuthorsExclude:((D=(B=t==null?void 0:t.filterConfig)==null?void 0:B.filterAuthorsExclude)==null?void 0:D.join(","))??""}}},[t]);async function c(s){try{await f({variables:{id:t==null?void 0:t.id,input:{...s,filterConfig:{...s.filterConfig,scopeContentFeeds:E(s.filterConfig.scopeContentFeeds),scopeContentFeedsExclude:E(s.filterConfig.scopeContentFeedsExclude),filterContentFeeds:E(s.filterConfig.filterContentFeeds),filterContentFeedsExclude:E(s.filterConfig.filterContentFeedsExclude),filterAuthors:E(s.filterConfig.filterAuthors),filterAuthorsExclude:E(s.filterConfig.filterAuthorsExclude)}}}}),n.add({intent:"success",title:"Saved"})}catch(h){h instanceof Error&&n.add({intent:"danger",title:"Save failed",description:h.message})}}return oe("save",async()=>{var s;
83await((s=g.current)==null?void 0:s.submitForm())}),t?e.jsx(ie,{children:e.jsx(X,{innerRef:g,initialValues:u,onSubmit:c,children:e.jsx(K,{children:e.jsxs(i.VStack,{children:[e.jsxs(T,{children:[e.jsxs(w,{as:"h2",children:["Settings for: ",t.title," (ID: ",t.id,")"]}),e.jsxs(i.VStack,{space:"large",children:[e.jsx(i.FormikTextField,{name:"title",label:"Title"}),e.jsx(i.FormikTextField,{name:"identifier",label:"Identifier"}),e.jsx(i.Text,{size:"caption2",children:'A way for developers to reference this feed in code. There are a few minor things these set, e.g. "sacraments_feed" scopes to sacraments. It needs to be one of: pastors_feed, parish_feed, neighbor_events, diocese_events, cardinals_blog, charles_pope_blog, everyday_faith_blog, from_adw_archives, pushed_events, diocese_events_in_from_above, diocese_events_in_from_below, candidate_diocese_events, parish_feed_in_from_above, parish_feed_in_from_below, candidate_shared_resources, announcements, parent_announcements, all_events, ctn_resources, own_events, behold_events, proclaim_events, sacraments_feed, ad_hoc_feed, own_resources, main_in_from_below, main_in_from_above, main_in_from_neighbors, main_out_to_below, main_out_to_above, main_out_to_neighbors, main_out_all, main_site_content, own_content'}),e.jsx(i.FormikTextField,{name:"description",label:"Description"}),e.jsx(i.Text,{size:"caption2",children:"I think this is a legacy field only used on news sites (for displaying special series of news)"}),e.jsx(i.FormikTextField,{name:"incomingFeedsConfig",label:"Incoming feeds config"}),e.jsx(i.Text,{size:"caption2",children:'If defined, these incoming feeds make up the source of all content for this feed. It is a comma separated list that can contain identifiers, ids, and org slugs. The most common 2 values here are "own_content" (content created on this org only) or "main_site_content" (all content that will display on this site, own or flowing in) Other example options: "main_in_from_above,parent.own_content,3768163,child.own_content,behold.main_site_content" Avoid putting other orgs feeds in here though, use "main_site_content" here and use "Scope content feeds" instead.'}),e.jsx(i.FormikCheckboxField,{name:"optIn",label:"Put this feed in 'opt in' mode"}),e.jsx(i.Text,{size:"caption2",children:e.jsxs("ul",{children:[e.jsx("li",{children:"Opt in: start with a blank feed (and then include content)"}),e.jsx("li",{children:"Opt out: start with all content (and then exclude)"})]})}),e.jsx(i.FormikCheckboxField,{name:"hidden",label:"Hidden"}),e.jsx(i.Text,{size:"caption2",children:'Just list it in the "Hidden" filter in the content feeds index. No other effect than that.'}),e.jsx(i.FormikCheckboxField,{name:"shareWithOtherOrgs",label:"Share with other Orgs"}),e.jsx(i.Text,{size:"caption2",children:"If checked, this feed becomes an option in pagebuilder for other orgs to select and filter by it."}),e.jsx(i.Label,{children:'Note on "Scope" and "Filter"'}),e.jsx(i.Text,{size:"caption2",children:'Content matching the "Scope" blocks below are queried first. Then the "Filter" blocks are applied to that, so no content outside of the "Scope" will be included.'}),e.jsx(i.Label,{children:"Note on filtering by other feeds"}),e.jsxs(i.Text,{size:"caption2",children:["There are 3 places to configure other feeds on this form:",e.jsx("br",{}),"Incoming feeds config above - content feeding in",e.jsx("br",{}),"Scope content feeds - limit content to upstream feed(s)",e.jsx("br",{}),"Filter content feeds - filter by an upstream feed (rarely used, you probably want the scope feeds)",e.jsx("br",{})]})]})]}),e.jsxs(T,{children:[e.jsx(w,{as:"h3",children:"Scope thing types"}),e.jsx(i.Box,{css:{paddingBottom:"20px"},children:e.jsx(i.Text,{size:"caption2",children:'This is the legacy "content type". It used to include collections, but no longer does.'})}),e.jsxs(i.VStack,{space:"large",children:[e.jsx(H,{label:"Include thing types",name:"filterConfig.scopeThingTypes"}),e.jsx(H,{label:"Exclude thing types",name:"filterConfig.scopeThingTypesExclude"})]})]}),e.jsxs(T,{children:[e.jsx(w,{as:"h3",children:"Scope content feeds"}),e.jsxs(i.VStack,{space:"large",children:[e.jsx(i.Text,{size:"caption2",children:`Only numerical ids for these, no string identifiers like "own_content". E.g. "478276,476874,962963" Typical use case for this would be to set "Incoming feeds config" to "main_site_content", then use this to scope down to specific feed(s), like behold's own_content or the school district main_site_content, this way you get that source feed while maintaining the filtering (exclusions) of the current org.`}),e.jsx(i.FormikTextField,{name:"filterConfig.scopeContentFeeds",label:"Include content feeds (comma separated ids)"}),e.jsx(i.FormikTextField,{name:"filterConfig.scopeContentFeedsExclude",label:"Exclude content feeds (comma separated ids)"})]})]}),e.jsxs(T,{children:[e.jsx(w,{as:"h3",children:"Scope categories"}),e.jsxs(i.VStack,{space:"large",children:[e.jsx(i.Text,{size:"caption2",children:'Again, note the "scope" in the title. This builds the scope for all c
83ontent for this feed. These fields are typically used for content types. E.g. scope this down to events or homilies only.'}),e.jsxs(i.FormikSelectField,{name:"filterConfig.scopeCategoriesCombineLogic",label:"Include categories",children:[e.jsx("option",{value:"all",children:"Content that matches all of the following"}),e.jsx("option",{value:"any",children:"Content with any of the following"})]}),e.jsx(F,{name:"filterConfig.scopeCategories"}),e.jsxs(i.FormikSelectField,{name:"filterConfig.scopeCategoriesExcludeCombineLogic",label:"Exclude categories",children:[e.jsx("option",{value:"all",children:"Content that matches all of the following"}),e.jsx("option",{value:"any",children:"Content with any of the following"})]}),e.jsx(F,{name:"filterConfig.scopeCategoriesExclude"})]})]}),e.jsxs(T,{children:[e.jsx(w,{as:"h3",children:"Filter categories"}),e.jsxs(i.VStack,{space:"large",children:[e.jsx(i.Text,{size:"caption2",children:"Here's probably the most common use case. Include / exclude these categories of content."}),e.jsxs(i.FormikSelectField,{name:"filterConfig.filterCategoriesCombineLogic",label:"Include categories",children:[e.jsx("option",{value:"all",children:"Content that matches all of the following"}),e.jsx("option",{value:"any",children:"Content with any of the following"})]}),e.jsx(F,{name:"filterConfig.filterCategories"}),e.jsxs(i.FormikSelectField,{name:"filterConfig.filterCategoriesExcludeCombineLogic",label:"Exclude categories",children:[e.jsx("option",{value:"all",children:"Content that matches all of the following"}),e.jsx("option",{value:"any",children:"Content with any of the following"})]}),e.jsx(F,{name:"filterConfig.filterCategoriesExclude"})]})]}),e.jsxs(T,{children:[e.jsx(w,{as:"h3",children:"Filter content feeds"}),e.jsxs(i.VStack,{space:"large",children:[e.jsx(i.Text,{size:"caption2",children:`As noted above, you probably don't want to use these options. Use the "Scope content feeds" instead.`}),e.jsx(i.FormikTextField,{name:"filterConfig.filterContentFeeds",label:"Include content feeds (comma separated ids)"}),e.jsx(i.FormikTextField,{name:"filterConfig.filterContentFeedsExclude",label:"Exclude content feeds (comma separated ids)"})]})]}),e.jsxs(T,{children:[e.jsx(w,{as:"h3",children:"Filter authors"}),e.jsxs(i.VStack,{space:"large",children:[e.jsx(i.Text,{size:"caption2",children:"Include or exclude the content from chosen authors."}),e.jsx(i.FormikTextField,{name:"filterConfig.filterAuthors",label:"Include authors (comma separated ids)"}),e.jsx(i.FormikTextField,{name:"filterConfig.filterAuthorsExclude",label:"Exclude authors (comma separated ids)"})]})]})]})})})}):null}const Oe={actions:[{id:"save",eventName:"save",label:"Save"}]};function ze(){const o=ee().id;return e.jsx(te,{title:"Content Feeds",backPath:`/admin/article/content_feeds/${o}/edit`,children:e.jsx(Te,{id:o})})}export{ze as default,Oe as handle};
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.