1"use strict";(globalThis.rspackChunknotion_next=globalThis.rspackChunknotion_next||[]).push([[19328],{502260(e,t,a){let o={[a(565546).uO.Jira]:a(896221).A.images.externalIntegrations.jiraPng,[a(565546).uO.Salesforce]:a(896221).A.images.externalIntegrations.salesforcePng};a.d(t,{},{l:o})},293416(e,t,a){let o=(0,a(327219).YK)({refreshHealthFailed:{id:"syncCollectionActions.refreshHealthFailed",defaultMessage:"Failed to refresh health. Try again."},pauseSyncFailed:{id:"syncCollectionActions.pauseSyncFailed",defaultMessage:"Failed to pause sync. Try again."},resumeSyncFailed:{id:"syncCollectionActions.resumeSyncFailed",defaultMessage:"Failed to resume sync. Try again."},deleteSyncFailed:{id:"syncCollectionActions.deleteSyncFailed",defaultMessage:"Failed to delete sync. Try again."}});async function n(e){let{environment:t,spaceId:a,credentialId:o}=e,n=await t.api.callApi({eventName:"syncValidateCredential",environment:t,data:{spaceId:a,credentialId:o}});return"success"!==n.type?{valid:!1,error:"Failed to validate credential"}:{valid:n.data.valid,error:n.data.error}}async function i(e){let{environment:t,spaceId:a,credentialId:o,sourceKey:n,resources:i}=e,r=await t.api.callApi({eventName:"syncCreateSync",environment:t,data:{spaceId:a,credentialId:o,sourceKey:n,resources:i}});if("success"===r.type)return{syncId:r.data.syncId,collections:r.data.collections}}async function r(e){let{environment:t,spaceId:o,collectionId:n,store:i}=e;i.update(e=>({...e,loading:!0,error:void 0}));let r=await t.api.callApi({eventName:"syncGetForCollection",environment:t,data:{spaceId:o,collectionId:n}});if("success"!==r.type)return void i.update(e=>({...e,loaded:!0,loading:!1,error:"Failed to load sync info"}));let{sync:l,credential:s,health:d}=r.data;l?i.update(e=>({...e,loaded:!0,syncId:l.id,sourceKey:l.sourceKey,config:l.config??void 0,credential:s??void 0,selectedProjectKeys:(0,a(92086).hr)({sourceKey:l.sourceKey,config:l.config}),selectedOptionalPropertyIds:(0,a(92086).dJ)({sourceKey:l.sourceKey,config:l.config}),configured:l.configured,disabled:l.disabled,health:d??void 0,loading:!1})):i.update(e=>({...e,loaded:!0,syncId:void 0,sourceKey:void 0,config:void 0,credential:void 0,selectedProjectKeys:[],selectedOptionalPropertyIds:[],configured:!1,disabled:!1,health:void 0,loading:!1}))}async function l(e){let{environment:t,spaceId:a,credentialId:o,store:n}=e;n.update(e=>({...e,loadingResources:!0,error:void 0}));let i=await t.api.callApi({eventName:"syncJiraListProjects",environment:t,data:{spaceId:a,credentialId:o}});"success"!==i.type?n.update(e=>({...e,loadingResources:!1,error:"Failed to load upstream resources"})):n.update(e=>({...e,upstreamResources:i.data.resources,loadingResources:!1}))}async function s(e){let{environment:t,spaceId:a,credentialId:o,sourceKey:n,store:i}=e;i.update(e=>({...e,loadingProperties:!0,error:void 0}));let r=await t.api.callApi({eventName:"syncListConfigurableProperties",environment:t,data:{spaceId:a,credentialId:o,sourceKey:n}});"success"!==r.type?i.update(e=>({...e,loadingProperties:!1,error:"Failed to load configurable properties"})):i.update(e=>({...e,availableProperties:r.data.properties,loadingProperties:!1}))}async function d(e){let{environment:t,spaceId:o,syncId:n,sourceKey:i,config:r,selectedProjectKeys:l,store:s}=e,d=(0,a(92086).$g)({sourceKey:i,config:r,selectedProjectKeys:l});return d?(s.update(e=>({...e,saving:!0,error:void 0})),"success"!==(await t.api.callApi({eventName:"syncUpdateConfig",environment:t,data:{spaceId:o,syncId:n,config:d}})).type)?(s.update(e=>({...e,saving:!1,error:"Failed to update sync config"})),!1):(s.update(e=>({...e,configured:!0,config:d,selectedProjectKeys:l,saving:!1})),u({environment:t,spaceId:o,syncId:n,store:s}),!0):(s.update(e=>({...e,error:"Failed to build sync config from selected projects"})),!1)}async function c(e){let{environment:t,spaceId:o,syncId:n,sourceKey:i,config:r,selectedProjectKeys:l,optionalSelectedPropertyIds:s,store:d}=e,c=(0,a(92086).YI)({sourceKey:i,config:r,selectedProjectKeys:l,optionalSelectedPropertyIds:s});return c?(d.update(e=>({...e,saving:!0,error:void 0})),"success"!==(await t.api.callApi({eventName:"syncUpdateConfig",environment:t,data:{spaceId:o,syncId:n,config:c}})).type)?(d.update(e=>({...e,saving:!1,error:"Failed to update sync config"})),!1):(d.update(e=>({...e,configured:!0,config:c,selectedProjectKeys:l,selectedOptionalPropertyIds:s,saving:!1})),u({environment:t,spaceId:o,syncId:n,store:d}),!0):(d.update(e=>({...e,error:"Failed to build sync config"})),!1)}async function u(e){let{environment:t,spaceId:n,syncId:i,store:r}=e;r.update(e=>({...e,loading:!0}));let l=await t.api.callApi({eventName:"syncRefreshHealth",environment:t,data:{spaceId:n,syncId:i}});if("success"!==l.type){r.update(e=>({...e,loading:!1})),a(436555).D6({label:a(962299).A.formatMessage(o.refreshHealthFailed)});return}let{health:s}=l.data;r.update(e=>({...e,health:s??void 0,loading:!1}))}async function p(e){let{environment:t,spaceId:n,syncId:i,store:r}=e;r.update(e=>({...e,loading:!0}));let l=await t.api.callApi({eventName:"syncSetDisabled",environment:t,data:{spaceId:n,syncId:i,disabled:!0}});if("success"!==l.type){r.update(e=>({...e,loading:!1})),a(436555).D6({label:a(962299).A.formatMessage(o.pauseSyncFailed)});return}let{health:s}=l.data;r.update(e=>({...e,disabled:!0,health:s??void 0,loading:!1}))}async function y(e){let{environment:t,spaceId:n,syncId:i,store:r}=e;r.update(e=>({...e,loading:!0}));let l=await t.api.callApi({eventName:"syncSetDisabled",environment:t,data:{spaceId:n,syncId:i,disabled:!1}});if("success"!==l.type){r.update(e=>({...e,loading:!1})),a(436555).D6({label:a(962299).A.formatMessage(o.resumeSyncFailed)});return}let{health:s}=l.data;r.update(e=>({...e,disabled:!1,health:s??void 0,loading:!1}))}async function g(e){let{environment:t,spaceId:n,syncId:i,store:r}=e;if(r.update(e=>({...e,loading:!0})),"success"!==(await t.api.callApi({eventName:"syncDeleteSync",environment:t,data:{spaceId:n,syncId:i}})).type){r.update(e=>({...e,loading:!1})),a(436555).D6({label:a(962299).A.formatMessage(o.deleteSyncFailed)});return}r.update(()=>({...r.getInitialState(),loaded:!0}))}a.d(t,{DP:()=>l,Gr:()=>u,Ks:()=>c,NK:()=>d,O1:()=>p,Tr:()=>y,Yo:()=>i,bf:()=>s,dq:()=>g,m3:()=>n,pI:()=>r})},970289(e,t,a){a.r(t),a.d(t,{SyncButton:()=>l});var o=a(635790),n=a(440302);let i=(0,a(327219).YK)({tooltipLabel:{defaultMessage:"Open sync settings",id:"syncButton.tooltipLabel"},syncLabel:{defaultMessage:"Sync",id:"syncButton.syncLabel"},syncedLabel:{defaultMessage:"Synced",id:"syncButton.syncedLabel"}}),r={container:{position:"relative",display:"flex",alignItems:"center",borderRadius:8,backgroundColor:a(632079).Tj.palette.translucentGray["100"]},containerDisabled:{opacity:.5,pointerEvents:"none"},button:{padding:0,background:"none"},badge:{background:"none",whiteSpace:"nowrap",width:"fit-content",height:28,display:"flex",borderRadius:20,padding:6,marginInlineStart:0},integrationIcon:{width:16,height:16,color:a(632079).Tj.blue.icon.accentPrimary,marginInlineEnd:2},fallbackIcon:{color:a(632079).Tj.blue.icon.accentPrimary},dot:{position:"absolute",insetInlineEnd:-9,top:-9,borderRadius:"50%",overflow:"hidden",color:a(632079).Tj.yellow.text.primary,pointerEvents:"none",zIndex:1},buttonHovered:{background:a(632079).Tj.palette.translucentGray["200"]}};function l(e){var t,l;let{collectionId:s,spaceId:d,collectionSettingsStore:c,disabled:u}=e,p=(0,a(533992).v3)(),y=(0,a(327219).tz)(),g=(0,o.useMemo)(()=>s?(0,a(314465).y)(s):void 0,[s]),f=(0,a(579993).O$)(g);(0,o.useEffect)(()=>{g&&d&&s&&!g.state.loaded&&!g.state.loading&&(0,a(293416).pI)({environment:p,spaceId:d,collectionId:s,store:g})},[p,d,s,g]);let v=(0,o.useCallback)(()=>{d&&s&&function(e){let{environment:t,spaceId:o,collectionId:n,collectionSettingsStore:i}=e,r=(0,a(314465).y)(n),l=e.screen??"overview";(0,a(963405).R8)({collectionSettingsStore:i,item:{type:"syncSettings",screen:l}}),(async e=>{await (0,a(293416).pI)({environment:t,spaceId:o,collectionId:n,store:r}),null!=(e=r.state.credential)&&e.id&&await (0,a(293416).DP)({environment:t,spaceId:o,credentialId:r.state.credential.id,store:r})})()}({environment:p,spaceId:d,collectionId:s,collectionSettingsStore:c})},[s,c,p,d]);if(!(null!=f&&f.loaded)||!f.syncId)return null;let h=y.formatMessage(i.tooltipLabel),b="jira"===f.sourceKey?a(502260).l[a(565546).uO.Jira]:void 0,m=f.configured?y.formatMessage(i.syncedLabel):y.formatMessage(i.syncLabel),S="error"===(l={configured:f.configured,healthStatus:null==(t=f.health)?void 0:t.status}).healthStatus?"red":"warning"!==l.healthStatus&&"needs_configuration"!==l.healthStatus&&l.configured?void 0:"yellow";return(0,n.jsx)(a(51831).m_,{content:()=>h,children:e=>(0,n.jsxs)("div",{style:{...r.container,...u&&r.containerDisabled},children:[(0,n.jsx)(a(988022).p,{ariaLabel:h,onClick:u?void 0:v,style:r.button,hoveredStyle:u?void 0:r.buttonHovered,...e,children:(0,n.jsx)(a(746434).E,{style:r.badge,content:(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:6,children:[b?(0,n.jsx)("img",{style:r.integrationIcon,src:b,alt:""}):(0,n.jsx)(a(16275).I,{icon:a(194123).a,size:"sm",style:r.fallbackIcon}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:m})]})})}),S?(0,n.jsx)(a(16275).I,{icon:a(996370).v,colorPalette:S,colorVariant:"secondary",style:r.dot}):void 0]})})}},92086(e,t,a){function o(e){return"string"==typeof e}function n(e){return"string"==typeof e&&!!(e.length>0)}function i(e){let t,i;if((0,a(48697).Gv)(e)&&"jira"===e._tag&&(0,a(48697).Gv)(e.projects)){if("all"===e.projects.mode)t={mode:"all"};else{if(!("selected"===e.projects.mode&&Array.isArray(e.projects.keys)))return;t={mode:"selected",keys:e.projects.keys.filter(o)}}return(0,a(48697).Gv)(e.properties)&&Array.isArray(e.properties.optionalSelected)&&(i={optionalSelected:e.properties.optionalSelected.filter(n)}),{_tag:"jira",projects:t,properties:i}}}function r(e){let t=Array.from(new Set(e.selectedProjectKeys.filter(n)));if(0===t.length)return;let a={_tag:"jira",projects:{mode:"selected",keys:t}};return e.optionalSelectedPropertyIds&&e.optionalSelectedPropertyIds.length>0&&(a.properties={optionalSelected:Array.from(new Set(e.optionalSelectedPropertyIds.filter(n)))}),a}a.d(t,{$g:()=>u,YI:()=>p,dJ:()=>c,hr:()=>d}),a(533958),a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(976614);let l={jira:{getSelectedProjectKeys:({config:e})=>{let t=i(e);return t&&"selected"===t.projects.mode?t.projects.keys:[]},getSelectedOptionalPropertyIds:({config:e})=>{var t;let a=i(e);return(null==a||null==(t=a.properties)?void 0:t.optionalSelected)??[]},buildConfigFromSelectedProjects:({config:e,selectedProjectKeys:t})=>{var a,o;let n;return n=i((a={selectedProjectKeys:t,existingConfig:e}).existingConfig),r({selectedProjectKeys:a.selectedProjectKeys,optionalSelectedPropertyIds:null==n||null==(o=n.properties)?void 0:o.optionalSelected})},buildConfigFromProjectsAndProperties:({selectedProjectKeys:e,optionalSelectedPropertyIds:t})=>r({selectedProjectKeys:e,optionalSelectedPropertyIds:t})}};function s(e){let t=l[e];if(!t)throw Error(`No config helper registered for source key: ${e}`);return t}function d(e){return s(e.sourceKey).getSelectedProjectKeys({config:e.config})}function c(e){return s(e.sourceKey).getSelectedOptionalPropertyIds({config:e.config})}function u(e){return s(e.sourceKey).buildConfigFromSelectedProjects({config:e.config,selectedProjectKeys:e.selectedProjectKeys})}function p(e){return s(e.sourceKey).buildConfigFromProjectsAndProperties({config:e.config,selectedProjectKeys:e.selectedProjectKeys,optionalSelectedPropertyIds:e.optionalSelectedPropertyIds})}},314465(e,t,a){var o=()=>a(546605);
1class n extends o().Store{getInitialState(){return{loaded:!1,syncId:void 0,sourceKey:void 0,config:void 0,credential:void 0,upstreamResources:[],selectedProjectKeys:[],selectedOptionalPropertyIds:[],availableProperties:[],configured:!1,disabled:!1,health:void 0,loading:!1,loadingResources:!1,loadingProperties:!1,saving:!1,error:void 0}}}let i=new Map;function r(e){let t=i.get(e);if(t)return t;let a=new n;return i.set(e,a),a}a.d(t,{y:()=>r})},996370(e,t,a){a(635790);let o={viewBox:"0 0 20 20",fittedViewBox:"8 8 4 4",svg:(0,a(440302).jsx)("path",{d:"M10 12a2 2 0 1 0 0-4 2 2 0 0 0 0 4"})},n=(0,a(104509).wt)("dot",o,"default");a.d(t,{},{v:n})}}]);
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.