1"use strict";(self.webpackChunksmarpshare_frontend=self.webpackChunksmarpshare_frontend||[]).push([[3576],{34:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{l:()=>DragNDropArea});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(96540);const handleDragOver=event=>{event.preventDefault(),event.stopPropagation()},DragNDropArea=({children,onDrop})=>react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{onDragOver:handleDragOver,onDrop:event=>((event,handleSelectFiles)=>{if(handleDragOver(event),!event.dataTransfer.files||0===event.dataTransfer.files.length)return;const fileInput=document.createElement("input");fileInput.type="file",fileInput.style.display="none",document.body.appendChild(fileInput);const dataTransfer=new DataTransfer;Array.from(event.dataTransfer.files).forEach((file=>dataTransfer.items.add(file))),fileInput.files=dataTransfer.files;const changeEvent=new Event("change",{bubbles:!0});fileInput.dispatchEvent(changeEvent),handleSelectFiles({target:fileInput}),document.body.removeChild(fileInput)})(event,onDrop)},children)},4834:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{TI:()=>getLinkedInPostResetFields,Wh:()=>fetchPostMediaMetaData,X6:()=>newPostFromLinkedInPost});var lodash_es__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(74400),_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(71287),src_app_react_modules_post_utils__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(733),src_app_modules_app_post_components_image_image_utils__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(3554),src_app_modules_app_util_file_utils__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(47339),src_app_modules_app_post_components_post_share_utils__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(7281);const videoMetadataFromLinkedIn=li=>{if((null==li?void 0:li.aspectRatioWidth)&&li.aspectRatioHeight)return{width:80*li.aspectRatioWidth,height:80*li.aspectRatioHeight,duration:li.duration?Math.floor(li.duration/1e3):0,format:"mp4",size:0}},fetchPostMediaMetaData=async post=>{var _a;return{imageMetadataList:(await Promise.allSettled((null!==(_a=post.imageMetadataList)&&void 0!==_a?_a:[]).map((async(meta,index)=>{if((0,src_app_modules_app_util_file_utils__WEBPACK_IMPORTED_MODULE_4__.Ix)(meta.url))return meta;const{url,width,height}=await(0,src_app_modules_app_post_components_image_image_utils__WEBPACK_IMPORTED_MODULE_2__.ux)(meta.url);return{url,width,height}})))).filter((r=>"fulfilled"===r.status)).map((r=>r.value))}},newPostFromLinkedInPost=(linkedinPost,session,company=null)=>{const{type,document,title,url,mediaUrl,mediaId,videoDownloadUrl,videoMetadata,body="",imageUrls=[]}=linkedinPost,basePost=(0,src_app_react_modules_post_utils__WEBPACK_IMPORTED_MODULE_1__.Sg)(session,_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.EA9.Link),linkedinSocnet=(0,src_app_modules_app_post_components_post_share_utils__WEBPACK_IMPORTED_MODULE_3__.Q1)(!0,basePost,session).linkedin,withBody=[_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.EA9.Article,_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.EA9.Link].includes(type),linkedInPost={mediaId,mediaUrl,organizationName:null==company?void 0:company.name,organizationUrn:null==company?void 0:company.urn,isPageAdmin:null==company?void 0:company.isLinkedInPageAdmin};return{...basePost,type,title:type===_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.EA9.Document&&(null==document?void 0:document.title)||title,linkedInMediaId:mediaId,linkedInPost,socnetSet:linkedinSocnet?{linkedin:linkedinSocnet}:{},body:withBody?body:"",htmlBody:type===_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.EA9.Article?`<p>${(0,lodash_es__WEBPACK_IMPORTED_MODULE_5__.A)(body)}</p>`:"",url:type===_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.EA9.Link&&(url||mediaUrl)||"",imageUrlList:imageUrls,imageMetadataList:imageUrls.map((url=>({url,width:0,height:0}))),videoUrl:videoDownloadUrl,videoMetadata:videoMetadataFromLinkedIn(videoMetadata),document,commentEnabled:!0,proposeComment:withBody?"":body}},getLinkedInPostResetFields=session=>({...(0,src_app_react_modules_post_utils__WEBPACK_IMPORTED_MODULE_1__.Sg)(session,void 0),linkedInMediaId:void 0,linkedInPost:void 0,imageUrlList:[],imageMetadataList:[],videoUrl:void 0,document:void 0})},5741:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{M:()=>ImageInput});var _emotion_styled__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(59295),_haiilo_catalyst_react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(11432),react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(96540),src_app_react_common_hooks_use_get_text__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(87914);const TextWrapper=_emotion_styled__WEBPACK_IMPORTED_MODULE_0__.A.div` 2 display: flex; 3 align-items: center; 4 justify-content: center; 5`,BrowseButton=(0,_emotion_styled__WEBPACK_IMPORTED_MODULE_0__.A)(_haiilo_catalyst_react__WEBPACK_IMPORTED_MODULE_3__.B$)` 6 ::part(button) { 7 text-decoration: underline; 8 color: ${props=>props.theme.color.PrimaryDefault}; 9 padding-left: 5px; 10 padding-right: 5px; 11 12 &:hover { 13 background-color: transparent; 14 } 15 } 16`,ImageInput=({text,onChange,inputRef,multiple=!1,hasCustomText=!1,...props})=>{const{gettext}=(0,src_app_react_common_hooks_use_get_text__WEBPACK_IMPORTED_MODULE_2__.z)(),promptText=gettext(multiple?"Drag and drop your images here, or":"Drag and drop your image here, or");return react__WEBPACK_IMPORTED_MODULE_1__.createElement("div",{className:"image-placeholder-caption","data-testid":"image-placeholder-caption"},text?react__WEBPACK_IMPORTED_MODULE_1__.createElement("span",null,text):!hasCustomText&&react__WEBPACK_IMPORTED_MODULE_1__.createElement(TextWrapper,null,react__WEBPACK_IMPORTED_MODULE_1__.createElement("span",null,promptText)," ",react__WEBPACK_IMPORTED_MODULE_1__.createElement(BrowseButton,{variant:"text",color:"primary"},gettext("browse"))," ",react__WEBPACK_IMPORTED_MODULE_1__.createElement("span",null,gettext("your computer."))),react__WEBPACK_IMPORTED_MODULE_1__.createElement("input",{type:"file",style:{display:"none"},onChange,ref:inputRef,...props,multiple}))}},9613:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{_V:()=>getUtmTagsError,uy:()=>fetchCompanyDefaultUTMTags,v0:()=>defaultUtmTags});var _SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(71287),src_api__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(56433),src_utils_alert_utils_alert_utils__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(20987),src_app_modules_core_helpers_util__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(58151);const defaultUtmTags={source:{type:_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.cTJ.SocialNetwork},medium:{type:_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.cTJ.StaticText},campaign:{type:_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.cTJ.UserId},content:{type:_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.cTJ.PostId},id:{type:_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.cTJ.Empty},term:{type:_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.cTJ.Empty}},fetchCompanyDefaultUTMTags=async companyId=>{var _a,_b;const[response,error]=await(0,src_app_modules_core_helpers_util__WEBPACK_IMPORTED_MODULE_3__.Oi)((()=>src_api__WEBPACK_IMPORTED_MODULE_1__._K.retrieveCompanyDefaultUTMTags(companyId)));if(!Boolean(error))return response.data;{const errorMessage=null===(_b=null===(_a=null==error?void 0:error.response)||void 0===_a?void 0:_a.data)||void 0===_b?void 0:_b.message;"Company UTM tags not found"!==errorMessage&&src_utils_alert_utils_alert_utils__WEBPACK_IMPORTED_MODULE_2__.A.error(errorMessage)}},getUtmTagsError=utmTags=>{return{emptyStaticValue:(tags=utmTags,tags?Object.entries(tags).filter((([,tag])=>(tag=>tag.type===_SmarpJSClient_dist__WEBPACK_IMPORTED_MODULE_0__.cTJ.StaticText&&!tag.value)(tag))).map((([tagName])=>tagName)):[])};var tags}},18889:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{t:()=>ToneOfVoiceConnectionMessage});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(96540),_haiilo_catalyst_react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(11432),_Util_url_utils_url_utils__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(60059),src_app_react_common_enums_socnet_enums__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(28431),src_app_react_common_hooks_use_get_text__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(87914);const ToneOfVoiceConnectionMessage=({description,returnPath,className="
16cat-mt-xl"})=>{const{gettext}=(0,src_app_react_common_hooks_use_get_text__WEBPACK_IMPORTED_MODULE_2__.z)();return react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,`${gettext("You haven't yet connected to your")} ${(0,src_app_react_common_enums_socnet_enums__WEBPACK_IMPORTED_MODULE_1__.Os)(src_app_react_common_enums_socnet_enums__WEBPACK_IMPORTED_MODULE_1__.tZ.Linkedin)}. `,description),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"cat-mt-m"},react__WEBPACK_IMPORTED_MODULE_0__.createElement(_haiilo_catalyst_react__WEBPACK_IMPORTED_MODULE_3__.B$,{variant:"outlined",color:"secondary",icon:"linkedin",iconRight:!0,onClick:()=>{(0,_Util_url_utils_url_utils__WEBPACK_IMPORTED_MODULE_4__.WA)(src_app_react_common_enums_socnet_enums__WEBPACK_IMPORTED_MODULE_1__.tZ.Linkedin,returnPath)}},gettext("Connect to")," ",(0,src_app_react_common_enums_socnet_enums__WEBPACK_IMPORTED_MODULE_1__.Os)(src_app_react_common_enums_socnet_enums__WEBPACK_IMPORTED_MODULE_1__.tZ.Linkedin))))}},24563:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{e:()=>VideoPostPreview});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(96540),hls_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(39473),hls_js__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(hls_js__WEBPACK_IMPORTED_MODULE_1__),video_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(56350),_emotion_styled__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(59295),src_utils_tracking_utils_tracking_utils__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(48458),src_app_modules_app_post_post_preview_video_container__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(7249),src_api__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(56433),src_reused_components_toast__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(62614),src_app_react_common_hooks_use_get_text__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(87914);const config={xhrSetup:xhr=>{xhr.withCredentials=!0},startLevel:-1},HLSSource=({src,type,video})=>{const isInit=react__WEBPACK_IMPORTED_MODULE_0__.useRef(!0);return react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect((()=>{if(!isInit.current)return;const hls=new(hls_js__WEBPACK_IMPORTED_MODULE_1___default())(config);return isInit.current=!1,hls_js__WEBPACK_IMPORTED_MODULE_1___default().isSupported()?(hls.loadSource(src),hls.attachMedia(video),hls.on(hls_js__WEBPACK_IMPORTED_MODULE_1___default().Events.MANIFEST_PARSED,(()=>{null==video||video.play()}))):video&&(null==video?void 0:video.canPlayType("application/vnd.apple.mpeg"))&&(video.src=src||"",video.addEventListener("loadedmetadata",(function(){video.play()}))),()=>{hls&&hls.destroy()}}),[video,src]),react__WEBPACK_IMPORTED_MODULE_0__.createElement("source",{src,type:type||"application/x-mpegURL"})},StreamingVideoPlayer=({cookieFetched,videoUrl,posterUrl})=>cookieFetched?react__WEBPACK_IMPORTED_MODULE_0__.createElement(video_react__WEBPACK_IMPORTED_MODULE_2__.ai,{autoPlay:!0,src:videoUrl,poster:posterUrl,fluid:!1,width:"100%",height:"100%"},react__WEBPACK_IMPORTED_MODULE_0__.createElement(video_react__WEBPACK_IMPORTED_MODULE_2__.Fn,{position:"center",className:"play-btn"}),react__WEBPACK_IMPORTED_MODULE_0__.createElement(video_react__WEBPACK_IMPORTED_MODULE_2__.hf,{autoHide:!0}),react__WEBPACK_IMPORTED_MODULE_0__.createElement(HLSSource,{isVideoChild:!0})):react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,"Loading..."),SizingPlayerContainer=_emotion_styled__WEBPACK_IMPORTED_MODULE_3__.A.div` 17 width: ${p=>p.width?`calc(${p.width})`:"auto"}; 18 min-width: 250px; 19 height: ${p=>p.height?`calc(${p.height})`:"auto"}; 20 21 :before { 22 content: ""; 23 background-image: url("/images/spinner-static.png"); 24 position: absolute; 25 top: calc(50% - 38px / 2); 26 left: calc(50% - 38px / 2); 27 width: 38px; 28 height: 38px; 29 animation: fa-spin 0.75s cubic-bezier(0.4, 0.15, 0.6, 0.85) infinite; 30 } 31`,VideoPostPreview=({videoUrl,isStreamingType,posterUrl,aspectRatio:AR,onPlaying,postId,maxWidth,maxHeight})=>{const{gettext}=(0,src_app_react_common_hooks_use_get_text__WEBPACK_IMPORTED_MODULE_8__.z)(),[cookieFetched,setCookieFetched]=react__WEBPACK_IMPORTED_MODULE_0__.useState(!1),prevProps=(value=>{const ref=react__WEBPACK_IMPORTED_MODULE_0__.useRef();return react__WEBPACK_IMPORTED_MODULE_0__.useEffect((()=>{ref.current=value})),ref.current})({posterUrl,cookieFetched});react__WEBPACK_IMPORTED_MODULE_0__.useEffect((()=>{!cookieFetched&&postId&&src_api__WEBPACK_IMPORTED_MODULE_6__.yw.getSignedCookie(postId).then((()=>setCookieFetched(!0))).catch((()=>{(0,src_reused_components_toast__WEBPACK_IMPORTED_MODULE_7__.Kf)({message:gettext("Video playback failed")}),src_utils_tracking_utils_tracking_utils__WEBPACK_IMPORTED_MODULE_4__.A.error("Video playback failed","VideoPostPreview.videoApi.getSignedCookie")}))}),[cookieFetched,postId]);const[widthString,heightString]=AR>=1?[maxWidth,`${maxWidth} * ${1/AR}`]:[`${maxHeight} * ${AR}`,maxHeight];return isStreamingType?react__WEBPACK_IMPORTED_MODULE_0__.createElement(src_app_modules_app_post_post_preview_video_container__WEBPACK_IMPORTED_MODULE_5__.b,{posterUrl},react__WEBPACK_IMPORTED_MODULE_0__.createElement(SizingPlayerContainer,{width:widthString,height:heightString},react__WEBPACK_IMPORTED_MODULE_0__.createElement(StreamingVideoPlayer,{videoUrl,cookieFetched,posterUrl}))):react__WEBPACK_IMPORTED_MODULE_0__.createElement(src_app_modules_app_post_post_preview_video_container__WEBPACK_IMPORTED_MODULE_5__.b,{posterUrl},react__WEBPACK_IMPORTED_MODULE_0__.createElement(SizingPlayerContainer,{width:widthString,height:heightString},react__WEBPACK_IMPORTED_MODULE_0__.createElement(video_react__WEBPACK_IMPORTED_MODULE_2__.ai,{src:videoUrl,poster:posterUrl,ref:ref=>{if(!ref)return;ref.subscribeToStateChange((state=>{state.videoElement=null==ref?void 0:ref.video,onPlaying&&onPlaying(state)}));const prevPosterUrl=null==prevProps?void 0:prevProps.posterUrl;prevPosterUrl&&prevPosterUrl!==posterUrl&&ref.load()},fluid:!1,width:"100%",height:"100%"},react__WEBPACK_IMPORTED_MODULE_0__.createElement(video_react__WEBPACK_IMPORTED_MODULE_2__.Fn,{position:"center",className:"play-btn"}),react__WEBPACK_IMPORTED_MODULE_0__.createElement(video_react__WEBPACK_IMPORTED_MODULE_2__.hf,{autoHide:!0}))))}},24571:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{e:()=>UtmTagsForm});var react=__webpack_require__(96540),modules=__webpack_require__(56848),utils=__webpack_require__(41182),use_get_text=__webpack_require__(87914),components=__webpack_require__(66931),emotion_styled_browser_esm=__webpack_require__(59295),stencil_generated=__webpack_require__(11432),dist=__webpack_require__(71287),cat_select_facade=__webpack_require__(33544),catalyst_provider=__webpack_require__(2784);const Label=emotion_styled_browser_esm.A.p` 32 flex: 1 1 0; 33 margin: 0; 34`,Row=emotion_styled_browser_esm.A.div` 35 display: flex; 36 flex-wrap: wrap; 37 gap: ${p=>p.theme.cat.spacing.s}; 38`,FlexElement=emotion_styled_browser_esm.A.div` 39 flex: 2 1 0; 40 min-width: 250px; 41`,UtmTagInput=({tagName,initialTag,onChange,hasStaticTextError})=>{var _a;const{gettext}=(0,use_get_text.z)(),[selectedOption,setSelectedOption]=(0,react.useState)(initialTag.type),isRequired=(tagName=>"source"===tagName||"medium"===tagName||"campaign"===tagName)(tagName),typeSelectOptions=(0,utils.Dn)(gettext,!isRequired);(0,catalyst_provider.g)({"error.UtmTagInput.staticTextError":gettext("Static text input cannot be empty.")});const shouldShowStaticInput=selectedOption===dist.cTJ.StaticText,labelText=`utm_${tagName}`;return react.createElement(Row,null,react.createElement(Label,null,labelText),react.createElement(FlexElement,null,react.createElement(cat_select_facade.j,{label:labelText,labelHidden:!0,required:!0,options:typeSelectOptions,nativeAttributes:{autocomplete:"off","data-testid":`utm_${tagName}_type_field`},noItems:gettext("No matching type found"),value:selectedOption,onCatChange:event=>{var selected;(selected=event.target.value)!==initialTag.type&&selected&&(setSelectedOption(selected),onChange(tagName,{type:selected}))}})),shouldShowStaticInput&&react.createElement(FlexElement,null,react.createElement(stencil_generated.BU,{labelHidden:!0,placeholder:gettext("Static text"),value:null!==(_a=initialTag.value)&&void 0!==_a?_a:"",maxLength:1e3,nativeAttributes:{"data-testid":`utm_${tagName}_static_field`},onCatChange:event=>{onChange(tagName,{type:initialTag.type,value:event.target.value})},errors:hasStaticTextError?["UtmTagInput.staticTextError"]:[]})))},UtmTagsForm=({utmTags,updateUtmTags,utmTagsError})=>{const handleUpdate=(tagName,tag)=>{updateUtmTags({[tagName]:tag})},{gettext}=(0,use_get_text.z)();return utmTags?react.createElement("div",null,react.createElement(components.YC,null,gettext("Haiilo Share automatically generates UTM tags to external links to allow easier tracking through analytics tools. You can also replace the automatic UTM tags with custom ones if you wish.")),react.createElement(modules.Hg,{name:"utm-tags-error"}),react.createElement(components.hK,{size:"m",dir:"y"}),utils.pJ.map((tagName=>{const hasErrors=!!utmTagsError&&utmTagsError.emptyStaticValue.includes(tagName);return react.createElement(react.Fragment,{key:tagName},react.createElement(components.hK,{size:"m",dir:"y"}),react.createElement(UtmTagInput,{tagName,initialTag:utmTags[tagName],onChange:handleUpdate,hasStaticTextError:hasErrors}))}))):null}},31242:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{x:()=>ImagePlaceholder});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(96540),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(32485),_emotion_styled__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(59295),_haiilo_catalyst_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(11432),src_design_system_components__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(66931);const Content=_emotion_styled__WEBPACK_IMPORTED_MODULE_2__.A.div` 42 border-radius: 8px; 43 height: 184px; 44 width: 100%; 45 border: 1px dashed #d7dbe0; 46 display: flex; 47 justify-content: center; 48 align-items: center; 49 color: #000000; 50 51 .flex-break { 52 flex-basis: 100%; 53 } 54 55 .image-placeholder-caption { 56 text-align: center; 57 font-size: 15px; 58 font-weight: 400; 59 line-height: 24px; 60 color: #000000; 61 } 62`,Placeholder=_emotion_styled__WEBPACK_IMPORTED_MODULE_2__.A.div` 63 display: flex; 64 justify-content: center; 65 align-items: center; 66 flex-wrap: wrap; 67 flex-direction: column; 68`,ImagePlaceholder=({className,children,showPlaceholder,onClick,title})=>react__WEBPACK_IMPORTED_MODULE_0__.createElement(Content,{onClick,className:classnames__WEBPACK_IMPORTED_MODULE_1__(className,{hoverable:!!onClick})},showPlaceholder?react__WEBPACK_IMPORTED_MODULE_0__.createElement(Placeholder,null,react__WEBPACK_IMPORTED_MODULE_0__.createElement(_haiilo_catalyst_react__WEBPACK_IMPORTED_MODULE_4__.k0,{icon:"upload-outlined",size:"xl"}),title&&react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"flex-break"},react__WEBPACK_IMPORTED_MODULE_0__.createElement(src_design_system_components__WEBPACK_IMPORTED_MODULE_3__.hK,{dir:"y",size:"m"})),title)):children),ButtonGroupContent=_emotion_styled__WEBPACK_IMPORTED_MODULE_2__.A.div` 69 width: 100%; 70 height: 100%; 71 display: flex; 72 padding: ${props=>props.theme.spacing.S}; 73`,ImageUploaderControl=_emotion_styled__WEBPACK_IMPORTED_MODULE_2__.A.label` 74 flex: 1; 75 flex-wrap: wrap; 76 display: flex; 77 align-items: center; 78 justify-content: center; 79 align-content: center; 80 background-color: white; 81 border: 1px solid transparent; 82 83 &:hover { 84 border-color: ${props=>props.theme.color.PrimaryDefault}; 85 cursor: pointer; 86 } 87 88 &:first-of-type { 89 border-top-left-radius: 5px; 90 border-bottom-left-radius: 5px; 91 } 92 93 &:last-of-type { 94 border-top-right-radius: 5px; 95 border-bottom-right-radius: 5px; 96 } 97`,Loader=_emotion_styled__WEBPACK_IMPORTED_MODULE_2__.A.div` 98 border: 4px solid color(primary-default);
99 border-top: 4px solid color(space-darkest); 100 border-radius: 50%; 101 width: 64px; 102 height: 64px; 103 animation: spin 2s linear infinite; 104 105 border-color: ${props=>props.theme.color.PrimaryDefault}; 106`;ImagePlaceholder.Loader=Loader,ImagePlaceholder.Button=({icon,children,onClick})=>react__WEBPACK_IMPORTED_MODULE_0__.createElement(ImageUploaderControl,{onClick},icon,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"flex-break"},react__WEBPACK_IMPORTED_MODULE_0__.createElement(src_design_system_components__WEBPACK_IMPORTED_MODULE_3__.hK,{dir:"y",size:"m"})),children),ImagePlaceholder.ButtonGroup=({children})=>react__WEBPACK_IMPORTED_MODULE_0__.createElement(ButtonGroupContent,null,react__WEBPACK_IMPORTED_MODULE_0__.Children.toArray(children).reduce(((prev,curr,index)=>[prev,react__WEBPACK_IMPORTED_MODULE_0__.createElement(src_design_system_components__WEBPACK_IMPORTED_MODULE_3__.hK,{dir:"x",size:"s",key:`sep-${index}`}),curr])))},39717:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{o:()=>useDebouncedValue});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(96540),lodash_es__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(23549);const useDebouncedValue=(value="",debounceTime=700)=>{const[debouncedValue,_setDebouncedValue]=react__WEBPACK_IMPORTED_MODULE_0__.useState(value),setDebouncedValue=react__WEBPACK_IMPORTED_MODULE_0__.useMemo((()=>(0,lodash_es__WEBPACK_IMPORTED_MODULE_1__.A)(_setDebouncedValue,debounceTime)),[debounceTime]);return react__WEBPACK_IMPORTED_MODULE_0__.useEffect((()=>{setDebouncedValue(value)}),[setDebouncedValue,value]),{debouncedValue}}},53255:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{G:()=>ImageUploader});var _emotion_styled__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(59295),react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(96540),_haiilo_catalyst_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(11432),_image_input__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(5741),_image_placeholder__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(31242),_image_utils__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(3554);const ImageUploader=({onSelectImages,imageInputText,width,imageCountLimit,isLoading})=>{const imageInputEl=react__WEBPACK_IMPORTED_MODULE_1__.useRef(null),Content=_emotion_styled__WEBPACK_IMPORTED_MODULE_0__.A.section` 107 display: flex; 108 flex-direction: column; 109 align-items: center; 110 padding: ${props=>props.theme.spacing.S}; 111 border: 1px dashed #d7dbe0; 112 border-radius: 5px; 113 width: ${width||"800px"}; 114 `,ImagePlaceholderStyled=(0,_emotion_styled__WEBPACK_IMPORTED_MODULE_0__.A)(_image_placeholder__WEBPACK_IMPORTED_MODULE_3__.x)` 115 border: 0; 116 background: white; 117 `,LoadingWrapper=_emotion_styled__WEBPACK_IMPORTED_MODULE_0__.A.div` 118 width: 100%; 119 height: 184px; 120 `;return react__WEBPACK_IMPORTED_MODULE_1__.createElement(Content,null,isLoading?react__WEBPACK_IMPORTED_MODULE_1__.createElement(LoadingWrapper,{className:"cat-flex cat-justify-center cat-items-center"},react__WEBPACK_IMPORTED_MODULE_1__.createElement(_haiilo_catalyst_react__WEBPACK_IMPORTED_MODULE_5__.K0,{size:"l","data-testid":"image-uploading-spinner"})):react__WEBPACK_IMPORTED_MODULE_1__.createElement(ImagePlaceholderStyled,{showPlaceholder:!0,onClick:()=>{var _a;return null===(_a=null==imageInputEl?void 0:imageInputEl.current)||void 0===_a?void 0:_a.click()},title:react__WEBPACK_IMPORTED_MODULE_1__.createElement(_image_input__WEBPACK_IMPORTED_MODULE_2__.M,{text:imageInputText,onChange:onSelectImages,inputRef:imageInputEl,accept:_image_utils__WEBPACK_IMPORTED_MODULE_4__.Zw,multiple:imageCountLimit>1,"data-testid":"image-upload-input"})}))}},59008:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{CM:()=>filterGroupedChannelsByGroupId,DI:()=>convertGroupedChannelsToObjectForSelect,sT:()=>convertToSectionedListForSelect});var _filter_channel_manager_filter_channel_manager__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(18901);const filterGroupedChannelsByGroupId=(groupedChannels,groupId)=>groupedChannels.filter((group=>group.groupId===groupId)),convertGroupedChannelsToObjectForSelect=(groupedChannels,userGroupId)=>groupedChannels.map((group=>({groupId:group.groupId,groupName:userGroupId===group.groupId?`My group: ${group.groupName}`:group.groupName,options:group.channelList}))),convertToSectionedListForSelect=(groupedChannels,userGroupId,sectionNames)=>{const groupedChannelsForSelect=convertGroupedChannelsToObjectForSelect(groupedChannels,userGroupId),sectionedManagedChannels=groupedChannelsForSelect.map((groupedList=>({...groupedList,isPrimarySection:!0,options:groupedList.options.filter(_filter_channel_manager_filter_channel_manager__WEBPACK_IMPORTED_MODULE_0__._W)}))).filter((groupedList=>groupedList.options.length>0));sectionedManagedChannels.length>0&&(sectionedManagedChannels[0].sectionName=sectionNames.publishableChannel);const sectionedOtherChannels=groupedChannelsForSelect.map((groupedList=>({...groupedList,isPrimarySection:!1,options:groupedList.options.filter(_filter_channel_manager_filter_channel_manager__WEBPACK_IMPORTED_MODULE_0__.TA)}))).filter((groupedList=>groupedList.options.length>0));return sectionedOtherChannels.length>0&&(sectionedOtherChannels[0].sectionName=sectionNames.proposableChannel),[...sectionedManagedChannels,...sectionedOtherChannels]}},63576:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{h:()=>PostEditDialog});var debounce=__webpack_require__(23549),react=__webpack_require__(96540),es=__webpack_require__(49924),dist=__webpack_require__(71287),utm_util=__webpack_require__(9613),api=__webpack_require__(56433),alert_utils=__webpack_require__(20987),image_utils=__webpack_require__(3554),emotion_styled_browser_esm=__webpack_require__(59295),selectors=__webpack_require__(85166),stencil_generated=__webpack_require__(11432),use_get_text=__webpack_require__(87914),use_session=__webpack_require__(84280),components=__webpack_require__(66931);const Badge=({testIdPrefix,channel:{_id,isPrivate,groupName,name}})=>{const{session:{company}}=(0,use_session.w)();return react.createElement(stencil_generated.ql,{"data-testid":`${_id}-${testIdPrefix}`,icon:isPrivate?"lock-outlined":void 0},name,company.isGroupEnabled?` - ${groupName}`:"")},Badges=emotion_styled_browser_esm.A.div` 121 display: flex; 122 flex-wrap: wrap; 123 gap: ${p=>p.theme.cat.spacing.s}; 124`,Title=emotion_styled_browser_esm.A.p` 125 ${({theme:{cat:{color,fontSize}}})=>`\n\t\tfont-size: ${fontSize.s};\n\t\tmargin: 0;\n\t\tcolor: ${color.uiFontMuted};\n\t`} 126`,PostConfirmChannels=({isEdit,publishChannels,proposedChannels})=>{const{gettext}=(0,use_get_text.z)(),showPublishChannels=publishChannels.length>
1260,showProposedChannels=proposedChannels.length>0&&!isEdit;return react.createElement(react.Fragment,null,showPublishChannels&&react.createElement(react.Fragment,null,react.createElement(Title,null,gettext("Post will be published to:")),react.createElement(components.hK,{dir:"y",size:"s"}),react.createElement(Badges,null,publishChannels.map((channel=>react.createElement(Badge,{key:channel._id,channel,testIdPrefix:"publish-channel"}))))),showPublishChannels&&showProposedChannels&&react.createElement(components.hK,{dir:"y",size:"s"}),showProposedChannels&&react.createElement(react.Fragment,null,react.createElement(Title,null,gettext("Post will be proposed to:")),react.createElement(components.hK,{dir:"y",size:"s"}),react.createElement(Badges,null,proposedChannels.map((channel=>react.createElement(Badge,{key:channel._id,channel,testIdPrefix:"proposed-channel"}))))),(showPublishChannels||showProposedChannels)&&react.createElement(components.hK,{dir:"y",size:"m"}))},TextArea=(0,emotion_styled_browser_esm.A)(stencil_generated.Fc)` 127 color: black; 128`,PostProposeComment=({post,updatePostSettings})=>{const{gettext}=(0,use_get_text.z)();return react.createElement(TextArea,{label:gettext("Write something about the post"),nativeAttributes:{"data-testid":"comment-textarea"},onCatChange:e=>{updatePostSettings({proposeComment:e.target.value})},placeholder:gettext("Give a reason to read and share..."),value:post.proposeComment||"",rows:4})};var dayjs_min=__webpack_require__(74353);const Header=emotion_styled_browser_esm.A.div` 129 display: flex; 130 justify-content: space-between; 131 align-items: center; 132`,content_toggle_card_Title=emotion_styled_browser_esm.A.span` 133 ${({theme:{cat:{fontSize,lineHeight}}})=>`\n font-size: ${fontSize.h5};\n line-height: ${lineHeight.l};\n `} 134`,Card=(0,emotion_styled_browser_esm.A)(stencil_generated.Re)` 135 ${({theme:{cat:{color,radius}}})=>`\n\t\tflex: 1 1 0;\n\t\tcolor: black;\n\t\tborder: 1px solid ${color.uiBorderDark};\n\t\tborder-radius: ${radius.m};\n\t`} 136`,ContentToggleCard=({children,title,onToggle,isToggled,toggleTestId})=>react.createElement(Card,null,react.createElement(Header,null,react.createElement(content_toggle_card_Title,null,title),react.createElement(stencil_generated.xN,{label:title,labelHidden:!0,onCatChange:onToggle,checked:isToggled,nativeAttributes:{"data-testid":toggleTestId}})),children);var cat_date_time=__webpack_require__(96829),post_detail_service=__webpack_require__(99725),date_util=__webpack_require__(74297);const PostSchedulingOptions=({post,updatePostSettings})=>{const{gettext}=(0,use_get_text.z)(),{session}=(0,use_session.w)(),[initialPublishAtDate]=react.useState(post.publishedAt),[initialArchivedAtDate]=react.useState(post.archivedAt),[showScheduleControls,setShowScheduleControls]=react.useState(new Date(post.publishedAt)>new Date),defaultPostExpiration=session.company.defaultPostExpiration,revertScheduleChanges=()=>{(post=>Boolean(post.publishedAt)&&new Date(post.publishedAt)<new Date)(post)?updatePostSettings({publishedAt:initialPublishAtDate,archivedAt:initialArchivedAtDate}):updatePostSettings(initialPublishAtDate&&initialArchivedAtDate?{...(0,post_detail_service.zG)(defaultPostExpiration)}:{publishedAt:void 0,archivedAt:void 0})},minPublishedDate=react.useMemo(date_util._t,[]);return react.createElement(ContentToggleCard,{title:gettext("Schedule post"),onToggle:()=>{const newValue=!showScheduleControls;setShowScheduleControls(newValue),newValue||revertScheduleChanges()},isToggled:showScheduleControls,toggleTestId:"scheduled-date-switch"},showScheduleControls&&react.createElement(react.Fragment,null,react.createElement("hr",{className:"cat-card-pull-h cat-mt-m cat-mb-m"}),react.createElement(cat_date_time.a,{title:gettext("Publish at"),dateLabel:gettext("Publish date"),timeLabel:gettext("Publish at time"),date:dayjs_min(post.publishedAt),onChange:date=>{updatePostSettings({publishedAt:date.toDate()})},min:minPublishedDate}),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(cat_date_time.a,{title:gettext("Archive at"),dateLabel:gettext("Archive date"),timeLabel:gettext("Archive at time"),date:post.archivedAt?dayjs_min(post.archivedAt):dayjs_min((0,post_detail_service.zG)(defaultPostExpiration).archivedAt),onChange:date=>{updatePostSettings({archivedAt:date.toDate()})},min:dayjs_min(post.publishedAt)})))};var utm_tags_form=__webpack_require__(24571);const hasTags=utmTags=>Object.values(null!=utmTags?utmTags:{}).some((tag=>tag.type)),PostUtmTagsOptions=({post,updatePostSettings,utmTagsError})=>{const{gettext}=(0,use_get_text.z)(),{session}=(0,use_session.w)(),[UTMTags,setUTMTags]=react.useState(hasTags(post.utmTags)?post.utmTags:void 0),[isToggleActive,setIsToggleActive]=react.useState(hasTags(post.utmTags));return react.createElement(ContentToggleCard,{title:gettext("Custom UTM tags"),onToggle:async()=>{var _a;if(setIsToggleActive(!isToggleActive),isToggleActive)return void updatePostSettings({utmTags:void 0});if(UTMTags)return void updatePostSettings({utmTags:UTMTags});const fetchedUtmTags=null!==(_a=await(0,utm_util.uy)(session.company._id))&&void 0!==_a?_a:utm_util.v0;setUTMTags(fetchedUtmTags),updatePostSettings({utmTags:fetchedUtmTags})},isToggled:isToggleActive,toggleTestId:"UTM-tags-switch"},isToggleActive&&react.createElement(react.Fragment,null,react.createElement("hr",{className:"cat-card-pull-h"}),react.createElement(utm_tags_form.e,{utmTags:UTMTags,updateUtmTags:updatedTag=>{if(0===Object.entries(updatedTag).length)return;const newUTMTags={...UTMTags,...updatedTag};setUTMTags(newUTMTags),updatePostSettings({utmTags:newUTMTags})},utmTagsError})))};var utils=__webpack_require__(41182),post_share_utils=__webpack_require__(7281
136),view_by_post_type=__webpack_require__(78640),reused_styled_components=__webpack_require__(79595);const Row=emotion_styled_browser_esm.A.div` 137 display: flex; 138 gap: ${p=>p.theme.cat.spacing.s}; 139 align-items: flex-start; 140`,PostConfirmPage=(0,es.Ng)((state=>({loggedInUserChannels:(0,selectors.$P)(state.Channel)})))((({post,updatePostSettings,utmTagsError,loggedInUserChannels,isCreateMode,contentOwnerId})=>{const{gettext}=(0,use_get_text.z)(),{session}=(0,use_session.w)(),skipApprovalExternal=session.company.postCreation.skipApprovalExternal,postChannels=session.user._id!==contentOwnerId&&isCreateMode?(0,utils.FJ)(post.fullChannelList,loggedInUserChannels):post.fullChannelList,publishChannelsList=skipApprovalExternal?postChannels:postChannels.filter(post._id?channel=>Boolean(channel.isManager)&&(channel.status===dist.d8c.IStatusEnum.Published||channel.status===dist.d8c.IStatusEnum.Approved||channel.status===dist.d8c.IStatusEnum.Scheduled||!session.company.isChannelManagerEnabled):utils.qm),proposedChannelsList=skipApprovalExternal?[]:postChannels.filter(utils.bz),shouldShowUtmTagsOptions=post.type===dist.
140EA9.Link&&session.company.utmEnabled&&(postChannels.some(utils.qm)||skipApprovalExternal)&&(0,post_share_utils.y)(post)&&!post.linkedInMediaId;return react.createElement(react.Fragment,null,react.createElement(PostProposeComment,{post,updatePostSettings}),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(Row,null,0!==publishChannelsList.length&&react.createElement(PostSchedulingOptions,{post,updatePostSettings}),shouldShowUtmTagsOptions&&react.createElement(PostUtmTagsOptions,{post,updatePostSettings,utmTagsError})),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(PostConfirmChannels,{isEdit:Boolean(post._id),publishChannels:publishChannelsList,proposedChannels:proposedChannelsList}),react.createElement(components.dh,{labelText:gettext("Preview")}),react.createElement(components.cG,{type:"default"}),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(reused_styled_components.S1,null,react.createElement(view_by_post_type.F,{post,postBody:post.htmlBody||post.body,postTitle:post.title,isEditOrPostPreview:Boolean(post._id)})))}));var noop=__webpack_require__(42302);const POST_CONTEXT_DEFAULT_VALUE={setVideoErrors:noop.A,setImageError:noop.A,setDocumentError:noop.A,videoErrors:void 0,imageError:void 0,documentError:void 0,videoThumbnails:{defaultThumbnail:void 0,customThumbnail:void 0,setDefaultThumbnail:noop.A,setCustomThumbnail:noop.A}},PostContext=react.createContext(POST_CONTEXT_DEFAULT_VALUE),PostProvider=PostContext.Provider,usePostContext=()=>react.useContext(PostContext);var show_by_condition=__webpack_require__(5775),design_system_candidates_link=__webpack_require__(67395),message=__webpack_require__(28962);const Radio=(0,emotion_styled_browser_esm.A)(stencil_generated.ut)` 141 ::part(label) { 142 color: ${p=>p.theme.color.SocialTwitter}; 143 font-size: 15px; 144 line-height: 20px; 145 } 146`,AudienceInput=({onChange,checked,label,children,name,disabled})=>react.createElement(Radio,{label,name,value:name,checked,onCatChange:e=>{onChange(e.currentTarget.name)},disabled,nativeAttributes:{"data-testid":`audience-${name}-input`}});var PostEditAudienceType;!function(PostEditAudienceType){PostEditAudienceType.Internal="internal",PostEditAudienceType.External="external",PostEditAudienceType.Unset="unset"}(PostEditAudienceType||(PostEditAudienceType={}));var socnet_enums=__webpack_require__(28431);const Content=emotion_styled_browser_esm.A.div` 147 display: flex; 148 align-items: flex-start; 149 justify-content: space-between; 150 flex: 1 1 auto; 151 width: 144px; 152 gap: 8px; 153`,Button=(0,emotion_styled_browser_esm.A)(stencil_generated.B$)` 154 ::part(button) { 155 width: 100%; 156 height: 100%; 157 } 158`,SocnetWrapper=emotion_styled_browser_esm.A.div` 159 display: flex; 160 align-items: center; 161 gap: 8px; 162`,socnet_select_Content=emotion_styled_browser_esm.A.div` 163 display: grid; 164 grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); 165 gap: 12px; 166 margin-top: ${p=>p.theme.cat.spacing.l}; 167`,ShareableToggleStyled=(0,emotion_styled_browser_esm.A)((({onToggle,checked,socnetName,className,disabled,displayName})=>react.createElement(Content,{className},react.createElement(SocnetWrapper,null,react.createElement(stencil_generated.ih,{label:(0,socnet_enums.Os)(socnetName),labelHidden:!displayName,checked,onCatChange:onToggle,nativeAttributes:{"data-testid":"toggle-shareable-checkbox"},disabled})),disabled?react.createElement(stencil_generated.k0,{"data-testid":"toggle-shareable-icon",icon:socnetName}):react.createElement(Button,{"data-testid":"toggle-shareable-button",variant:"text",icon:socnetName,"icon-only":!0,size:"s",onClick:onToggle}))))` 168 button { 169 opacity: 1; 170 } 171`,socnet_select_Row=emotion_styled_browser_esm.A.div` 172 display: flex; 173 align-items: center; 174 color: ${props=>props.theme.color.InkDefault}; 175 font-size: ${p=>p.theme.cat.spacing.m}; 176 justify-content: space-between; 177 padding: ${p=>p.theme.cat.spacing.s}; 178 gap: ${p=>p.theme.cat.spacing.m}; 179 border: 1px solid ${p=>p.theme.cat.color.uiBackgroundSkeleton}; 180 border-radius: ${p=>p.theme.cat.spacing.xs}; 181`,SocnetSelect=({socnetList,socnetCheckedList,onChange,isReadOnly})=>react.createElement(socnet_select_Content,null,socnetList.map((socnet=>{const isChecked=(0,post_share_utils.uW)(socnetCheckedList[socnet.Name]);return react.createElement(socnet_select_Row,{key:socnet.Name},react.createElement(ShareableToggleStyled,{onToggle:()=>
181onChange(socnet.Name),socnetName:socnet.Name,checked:isChecked,disabled:isReadOnly,displayName:!0}))}))),InputRow=emotion_styled_browser_esm.A.div` 182 display: flex; 183 align-items: center; 184 justify-content: center; 185 min-height: 227px; 186`,RadioButtonsWrapper=emotion_styled_browser_esm.A.div` 187 display: grid; 188 grid-template-columns: 1fr 1fr; 189 gap: ${p=>p.theme.cat.spacing.s}; 190`,SocnetSelectWrapper=emotion_styled_browser_esm.A.div` 191 margin-top: ${p=>p.theme.cat.spacing.l}; 192`,PostEditAudience=({post,audience,onAudienceChange,toggleSocnetShareable,isReadOnly})=>{const{gettext}=(0,use_get_text.z)(),{session:{company},sessionUtil:{isLabEnabled}}=(0,use_session.w)();if(!(0,image_utils.CS)(post.type))return null;const availableSocnetList=(0,post_share_utils.pC)(company.SocnetOrderedSet,post.type,isLabEnabled),hasSocnetsAvailable=availableSocnetList.length>0,isExternalSharing=audience===PostEditAudienceType.External,isInternalReading=audience===PostEditAudienceType.Internal,showOptionExternal=!isReadOnly||isExternalSharing,showOptionInternal=!isReadOnly||isInternalReading;return react.createElement(react.Fragment,null,react.createElement(RadioButtonsWrapper,null,showOptionInternal&&react.createElement(AudienceInput,{"data-testid":"internal-audience",label:gettext("Post is for internal reading"),name:PostEditAudienceType.Internal,checked:isInternalReading,onChange:onAudienceChange}),showOptionExternal&&react.createElement(AudienceInput,{"data-testid":"external-audience",label:gettext("Post is for external sharing"),name:PostEditAudienceType.External,checked:isExternalSharing&&hasSocnetsAvailable,onChange:onAudienceChange,disabled:!hasSocnetsAvailable})),isExternalSharing&&react.createElement((()=>react.createElement("div",null,hasSocnetsAvailable&&react.createElement(SocnetSelectWrapper,null,react.createElement(reused_styled_components.pM,null,gettext("Which networks are you targeting?")),react.createElement(SocnetSelect,{postType:post.type,socnetCheckedList:post.socnetSet,socnetList:availableSocnetList,onChange:toggleSocnetShareable,isReadOnly})),react.createElement(show_by_condition.q,{isShow:!isReadOnly&&post.type===dist.
192EA9.Image},react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(reused_styled_components.ZZ,null,gettext("If you select multiple social networks to share on, maximum number of images to upload will be the same as for the social network with the lowest number of images.")),react.createElement(components.hK,{dir:"y",size:"m"})))),null),isInternalReading&&react.createElement(InputRow,null,gettext("No one is going to be able to share the post on social media.")),!hasSocnetsAvailable&&!isInternalReading&&react.createElement(InputRow,null,react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(DisabledSocnetMessageWithLink,{to:getSettingsLink(company._id)})),isReadOnly&&react.createElement(react.Fragment,null,react.createElement(components.hK,{size:"xxl",dir:"y"}),react.createElement((()=>react.createElement(message.Q,null,gettext("If you want to create a post for")," ",gettext(isInternalReading?"external sharing":"internal reading")," ",gettext("then please create a new post."))),null)))},DisabledSocnetMessageWithLink=({to})=>{const{gettext}=(0,use_get_text.z)();return react.createElement("span",null,gettext("To use external sharing, please"),react.createElement(design_system_candidates_link.N,{to},gettext("enable at least one social network in the settings.")))},getSettingsLink=companyId=>`company/${companyId}/employee-advocacy`;var modules=__webpack_require__(56848),catalyst_provider=__webpack_require__(2784),drag_n_drop_area=__webpack_require__(34),slider=__webpack_require__(33649),math=__webpack_require__(98804);const TitleInput=(0,emotion_styled_browser_esm.A)(stencil_generated.BU)` 193 ::part(label) { 194 color: black; 195 } 196`,DocumentUploadWrapper=emotion_styled_browser_esm.A.div` 197 ${({theme:{cat,color}})=>`\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tfont-size: ${cat.fontSize.m};\n\t\tborder: 1px dashed ${cat.color.uiBorderDefault};\n\t\tborder-radius: ${cat.radius.m};\n\t\tpadding: 20px ${cat.spacing.l};\n\t\tcolor: black;\n\t\tmargin-top: ${cat.spacing.l};\n\n\t\tcat-icon {\n\t\t\tcolor: ${color.PrimaryDefault};\n\t\t}\n\t`} 198`,BrowseButton=(0,emotion_styled_browser_esm.A)(stencil_generated.B$)` 199 ::part(button) { 200 text-decoration: underline; 201 color: ${props=>props.theme.color.PrimaryDefault}; 202 padding-left: 5px; 203 padding-right: 5px; 204 205 &:hover { 206 background-color: transparent; 207 } 208 } 209`,DocumentUploadArea=emotion_styled_browser_esm.A.div` 210 align-items: baseline; 211`,DocumentCard=({title,onRemove,gettext})=>react.createElement(stencil_generated.Re,{className:"cat-border cat-flex cat-justify-between cat-items-center cat-mt-l"},react.createElement("div",{className:"cat-flex cat-items-center"},react.createElement(stencil_generated.k0,{icon:"file-pdf",size:"l",className:"cat-pr-m"}),react.createElement("span",{className:"cat-text-bold cat-text-secondary cat-text-m"},title)),react.createElement(stencil_generated.B$,{iconOnly:!0,icon:"cross-outlined",size:"xs",variant:"outlined",color:"secondary",onClick:onRemove,nativeAttributes:{"data-testid":"document-remove-button"},a11yLabel:gettext("Remove document")})),DocumentUpload=({onSelect,inputRef,documentError,contentError,gettext})=>react.createElement(drag_n_drop_area.l,{onDrop:onSelect},react.createElement("div",{onClick:()=>{var _a;return null===(_a=inputRef.current)||void 0===_a?void 0:_a.click()}},react.createElement(DocumentUploadWrapper,null,react.createElement(stencil_generated.k0,{icon:"file-pdf",size:"xl",className:"cat-mb-m"}),react.createElement(DocumentUploadArea,{className:"cat-flex cat-justify-center cat-mb-m","data-testid":"document-upload-container"},react.createElement("span",null,gettext("Drag and drop your document here, or")),react.createElement(BrowseButton,{variant:"link",color:"primary",nativeAttributes:{"data-testid":"document-upload-browse-button"}},gettext("browse")),react.createElement("span",null,gettext("your computer."))),react.createElement("div",{className:"cat-mb-m"},gettext("PDF Document")),react.createElement("div",{className:"cat-mb-m"},gettext("Max 100MB and 300 pages.")),react.createElement("input",{type:"file",accept:"application/pdf",style:{display:"none"},onChange:onSelect,ref:inputRef,"data-testid":"document-upload-input"})),Boolean(documentError||(null==contentError?void 0:contentError.documentError))&&react.createElement(react.Fragment,null,react.createElement(modules.Hg,{name:"content-validation-error"}),react.createElement(stencil_generated.Jv,{color:"danger",className:"cat-mt-s","data-testid":"document-upload-error"},documentError||(null==contentError?void 0:contentError.documentError))))),PostDocumentEditContent=({postContent,contentError,updateDocumentPostContent,isNewPost})=>{const{gettext}=(0,use_get_text.z)(),{documentError,setDocumentError}=usePostContext(),inputEl=react.useRef(null);react.useEffect((()=>{setDocumentError("")}),[setDocumentError]),(0,catalyst_provider.g)({"error.PostDocumentErrorContent.errorTitle":gettext("Please enter title for the post")});return react.createElement(react.Fragment,null,react.createElement(TitleInput,{type:"text",name:"title",className:"cat-mb-4",label:gettext("Post title"),placeholder:gettext("Add post title here"),value:postContent.title,required:!0,maxLength:400,onCatChange:event=>{var _a;updateDocumentPostContent({...postContent,title:null!==(_a=event.target.value)&&void 0!==_a?_a:""})},errors:(null==contentError?void 0:contentError.titleError)?["PostDocumentErrorContent.errorTitle"]:[],nativeAttributes:{"data-testid":"post-document-title-input"}}),react.createElement("div",null,isNewPost&&(postContent.document?react.createElement(DocumentCard,{title:postContent.document.title,onRemove:()=>{var _a,_b;updateDocumentPostContent({...postContent,document:void 0}),URL.revokeObjectURL(null!==(_b=null===(_a=postContent.document)||void 0===_a?void 0:_a.url)&&void 0!==_b?_b:""),inputEl.current&&(inputEl.current.value="")},gettext}):react.createElement(DocumentUpload,{onSelect:event=>{const files=event.target.files;if(!files||0===files.length)return;if(!(file=>{const maxFileSize=100*math.K9;return file.size>maxFileSize?(setDocumentError(gettext("Document size can't be more than 100mb.")),!1):"application/pdf"===file.type||(setDocumentError(gettext("Only PDF files are supported.")),!1)})(files[0]))return;const url=URL.createObjectURL(files[0]);((title,document)=>{updateDocumentPostContent({...postContent,title:null!=title?title:"",document})})(postContent.title,{title:files[0].name,url,extension:files[0].name.split(".").pop()||""})},inputRef:inputEl,documentError,contentError,gettext})),!isNewPost&&(null==postContent?void 0:postContent.imageMetadataList.length)>0&&react.createElement("div",{className:"cat-mt-l",style:{position:"relative"}}
211,react.createElement(slider.A,{imageMetadataList:postContent.imageMetadataList,documentTitle:postContent.title}))))};var file_utils=__webpack_require__(47339),image_uploader=__webpack_require__(53255),image_input=__webpack_require__(5741),shared_react_components=__webpack_require__(67940);const ImageCellWrapper=emotion_styled_browser_esm.A.div` 212 width: 104px; 213 height: 104px; 214 position: relative; 215 overflow: hidden; 216 border-radius: ${p=>p.theme.cat.radius.l}; 217 border: ${p=>p.hasError?`2px solid ${p.theme.cat.color.baseRed500}`:`1px solid ${p.theme.cat.color.uiBorderDefault}`}; 218`,ImageListWrapper=emotion_styled_browser_esm.A.div` 219 display: flex; 220 flex-wrap: wrap; 221 gap: calc( 222 ${p=>p.theme.cat.spacing.m} + (${p=>p.theme.cat.spacing.xs} / 2) 223 ); 224 align-items: center; 225`,DeleteButton=(0,emotion_styled_browser_esm.A)(stencil_generated.B$)` 226 position: absolute; 227 right: ${p=>p.theme.cat.spacing.s}; 228 top: ${p=>p.theme.cat.spacing.s}; 229 230 ::part(button) { 231 background-color: white; 232 } 233`,AddImageButton=emotion_styled_browser_esm.A.button` 234 ${({theme:{cat:{color,spacing,radius}}})=>`\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\twidth: 104px;\n\t\theight: 104px;\n\t\tborder: 1px solid ${color.uiBorderDefault};\n\t\tborder-radius: ${radius.l};\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tgap: ${spacing.xs};\n\n\t\t&:hover {\n\t\t\tbackground-color: ${color.uiBackgroundCanvas};\n\t\t\tborder: 1px solid ${color.uiBorderDefault};\n\t\t}\n\t`} 235`,Image=(0,emotion_styled_browser_esm.A)(shared_react_components.Cr)` 236 width: 100%; 237 height: 100%; 238 object-fit: cover; 239`,ImageEditList=({imageMetadataList,removeImage,imageCountLimit,handleSelectFiles})=>{const{gettext}=(0,use_get_text.z)(),imageInputEl=react.useRef(null);return react.createElement(ImageListWrapper,null,imageMetadataList.map(((item,index)=>react.createElement(ImageCellWrapper,{key:`${item.url} + index`,hasError:Boolean(item.hasError)},react.createElement(DeleteButton,{icon:"trash-outlined",iconOnly:!0,variant:"text",size:"xs",onClick:()=>removeImage(item.url),nativeAttributes:{"data-testid":`delete-image-button-${index}`}}),react.createElement(Image,{alt:gettext("An image selected for the post"),initialImage:react.createElement(reused_styled_components.YG,null),imageUrl:item.url,token:dist.JRo.Notification,"data-testid":`image-cell-${index}`})))),imageMetadataList.length<imageCountLimit&&react.createElement(AddImageButton,{onClick:()=>{var _a;return null===(_a=null==imageInputEl?void 0:imageInputEl.current)||void 0===_a?void 0:_a.click()},"data-testid":"add-image-button"},react.createElement(stencil_generated.k0,{icon:"plus-square-outlined",size:"l"}),react.createElement(image_input.M,{text:gettext("Add more"),onChange:handleSelectFiles,inputRef:imageInputEl,accept:image_utils.Zw,multiple:imageCountLimit>1,"data-testid":"image-upload-input"})))};var post_card_content=__webpack_require__(16509),tracking_utils=__webpack_require__(48458);const ImageUploadLabelText=({imageCountLimit})=>{const{gettext}=(0,use_get_text.z)();return react.createElement(react.Fragment,null,react.createElement(reused_styled_components.up,null,`${gettext("Upload up to")} ${imageCountLimit} images`),react.createElement(reused_styled_components.I5,null,react.createElement("div",null,gettext("Images must be JPG, PNG or GIF with a maximum file size of 5 MB.")),react.createElement("div",null,gettext("Images should not be wider or taller than 2048px."))))},StyledInput=(0,emotion_styled_browser_esm.A)(stencil_generated.BU)` 240 color: black; 241`,PostImageEditContent=({postContent,updateImagePostContent,contentError,isNewPost})=>{const{gettext,ngettext}=(0,use_get_text.z)(),{imageError,setImageError}=usePostContext(),[imageWarning,setImageWarning]=react.useState(null),updatePostImage=react.useCallback(((imageMetadataList,hasAnimatedImage)=>{updateImagePostContent({...postContent,imageMetadataList,hasAnimatedImage})}),[postContent,updateImagePostContent]);react.useEffect((()=>{setImageError("")}),[setImageError]),(0,catalyst_provider.g)({"error.PostImageErrorContent.errorTitle":gettext("Please enter title for the post")});const getImageMetadata=async fileUrl=>{try{return await(0,image_utils.K4)(fileUrl)}catch(_a){return null}},handleSelectFiles=async event=>{const filesArray=(0,file_utils.fz)(event);if(!filesArray)return;setImageError(""),setImageWarning(null);const staticImageFiles=filesArray.filter((file=>image_utils.k3.includes(file.type))),gifFiles=filesArray.filter((file=>file.type===image_utils.DL));if(0===staticImageFiles.length&&0===gifFiles.length&&0===postContent.imageMetadataList.length)return void setImageError(gettext("Please select an image or a gif to upload."));
241const{validImageMetadataList,invalidImageNames}=await getValidAndInvalidImageFiles(filesArray);if(invalidImageNames.length>0&&setImageWarning(`${gettext("The following images do not meet the required specifications and cannot be uploaded:")} ${invalidImageNames.join(", ")}.`),0===validImageMetadataList.length)return;const updatedImageMetadataList=[...postContent.imageMetadataList,...validImageMetadataList];if(updatedImageMetadataList.length>10)return void(()=>{const fileErrorMessage=ngettext(gettext("Please upload %s image."),gettext("Please upload up to %s images."),10);setImageError(gettext(fileErrorMessage))})();const hasAnimatedImage=gifFiles.length>0;updatePostImage(updatedImageMetadataList,hasAnimatedImage),hasAnimatedImage&&tracking_utils.A.event("Post Create Gif Selected")},getValidAndInvalidImageFiles=async files=>{const validImageMetadataList=[],invalidImageNames=[];for(const file of files){const fileUrl=URL.createObjectURL(file);if(!(image_utils.k3.includes(file.type)||(0,image_utils.kQ)(file))){invalidImageNames.push(file.name);continue}const isImageValid=(0,image_utils.kQ)(file)?await(0,image_utils.d5)(file):(0,image_utils.JV)(file),imageMetadata=await getImageMetadata(fileUrl);isImageValid&&imageMetadata?validImageMetadataList.push(imageMetadata):invalidImageNames.push(file.name)}return{validImageMetadataList,invalidImageNames}};return react.createElement(react.Fragment,null,react.createElement(ImageUploadLabelText,{imageCountLimit:10}),Boolean(imageError)&&react.createElement(react.Fragment,null,react.createElement(modules.Hg,{name:"content-validation-error"}),react.createElement(stencil_generated.Jv,{color:"danger"},imageError)),Boolean(imageError)&&Boolean(imageWarning)&&react.createElement(components.hK,{dir:"y",size:"m"}),Boolean(imageWarning)&&react.createElement(react.Fragment,null,react.createElement(modules.Hg,{name:"content-validation-warning"}),react.createElement(stencil_generated.Jv,{color:"warning"},imageWarning)),react.createElement(components.hK,{dir:"y",size:"m"}),postContent.imageMetadataList.length?isNewPost?react.createElement(ImageEditList,{imageMetadataList:postContent.imageMetadataList,removeImage:url=>{const newEditedFiles=postContent.imageMetadataList.filter((imageMetaData=>imageMetaData.url!==url));updatePostImage(newEditedFiles,!1),tracking_utils.A.event("Post Create Remove Selected Image")},imageCountLimit:10,handleSelectFiles}):react.createElement(post_card_content.r3,{imageMetadataList:postContent.imageMetadataList}):react.createElement(drag_n_drop_area.l,{onDrop:handleSelectFiles},react.createElement(image_uploader.G,{onSelectImages:handleSelectFiles,imageCountLimit:10,width:"100%"})),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(StyledInput,{label:gettext("Post title"),placeholder:gettext("Add post title here"),value:postContent.title,onCatChange:event=>{updateImagePostContent({...postContent,title:event.target.value})},required:!0,nativeAttributes:{"data-testid":"postTitle-id"},maxLength:400,errors:(null==contentError?void 0:contentError.titleError)?["PostImageErrorContent.errorTitle"]:[]}))};var prop_types=__webpack_require__(5556),image_proxy=__webpack_require__(79561);const image_url_input_Row=emotion_styled_browser_esm.A.div` 242 ${({theme:{cat:{spacing}}})=>`\n\t\tdisplay: flex;\n\t\tgap: ${spacing.xs};\n\t\twidth: 70%;\n\t\tmargin-top: ${spacing.m};\n \t`} 243`,image_url_input_Button=(0,emotion_styled_browser_esm.A)(stencil_generated.B$)` 244 flex: 1 1 0; 245`,Input=(0,emotion_styled_browser_esm.A)(stencil_generated.BU)` 246 flex: 8 1 0; 247`,ImageUrlInput=({disabled,onUrlLoading,onUrlLoaded,onError})=>{const{gettext}=(0,use_get_text.z)(),inputRef=react.useRef(null),[isEmpty,setIsEmpty]=react.useState(!0),errorMessage=error=>`${gettext("This image canât be used.")} ${error} ${gettext("Please upload another image.")}`;return react.createElement(react.Fragment,null,react.createElement("p",null,gettext("You can also use URL to upload your image and add it here")),react.createElement(image_url_input_Row,null,react.createElement(Input,{disabled,ref:inputRef,"data-testref":inputRef,onClick:e=>e.stopPropagation(),label:gettext("Enter image URL"),labelHidden:!0,placeholder:gettext("Add image URL here"),onCatChange:event=>{onError(""),setIsEmpty(!event.target.value)},autoComplete:"off",nativeAttributes:{"data-testid":"image-link-url-input"}}),react.createElement(image_url_input_Button,{disabled:disabled||isEmpty,onClick:e=>{e.stopPropagation(),(async()=>{var _a;const newImageUrl=null===(_a=inputRef.current)||void 0===_a?void 0:_a.value;if(newImageUrl){onUrlLoading();try{const imageFile=await(0,image_utils.M9)(newImageUrl),imageMetadata=await(0,image_utils.H_)(imageFile);if(imageMetadata.url=newImageUrl,(0,image_utils.R3)(newImageUrl)){const gifError=await(0,image_utils.vK)(imageFile,gettext);if(gifError)return void onError(errorMessage(gifError))}onUrlLoaded(imageMetadata)}catch(error){onError(gettext("Invalid image URL"))}}})()},color:"primary",nativeAttributes:{"data-testid":"upload-button"}},gettext("Upload"))))};var image_preview=__webpack_require__(71909),react_cropper_es=__webpack_require__(68366),image_utils_image_utils=__webpack_require__(99438);const image_cropper_controls_Row=emotion_styled_browser_esm.A.div` 248 display: flex; 249 gap: ${p=>p.theme.cat.spacing.m}; 250 justify-content: center; 251`,aspectRatioOptions=[{value:image_utils_image_utils.l8._16by9,label:"16:9"},{value:image_utils_image_utils.l8._4by3,label:"4:3"},{value:image_utils_image_utils.l8._1by1,label:"1:1"},{value:image_utils_image_utils.l8._9by16,label:"9:16"}],ImageCropperControls=({minZoomLevel,maxZoomLevel,initialAspectRatio,zoomTo,reset,setAspectRatio})=>{const[zoomLevel,setZoomLevel]=react.useState(minZoomLevel),[selectedAspectRatio,setSelectedAspectRatio]=react.useState(initialAspectRatio),{gettext}=(0,use_get_text.z)(),handleRevert=()=>{setZoomLevel(minZoomLevel),reset()};return react.createElement("div",{className:"image-cropping-control
251s"},zoomLevel&&minZoomLevel&&maxZoomLevel&&react.createElement("input",{name:"zoom","aria-label":gettext("Zoom level"),type:"range",onChange:e=>{const newZoomLevel=parseFloat(e.target.value);setZoomLevel(newZoomLevel),zoomTo(newZoomLevel)},value:zoomLevel,min:minZoomLevel,max:maxZoomLevel,step:(maxZoomLevel-minZoomLevel)/50,className:"image-scale-range-input"}),react.createElement(components.hK,{size:"l",dir:"y"}),react.createElement(image_cropper_controls_Row,null,aspectRatioOptions.map((option=>react.createElement(stencil_generated.B$,{color:"primary",size:"s",key:option.label,active:option.value===selectedAspectRatio,variant:"outlined",onClick:()=>{return value=option.value,handleRevert(),setSelectedAspectRatio(value),void setAspectRatio(value);var value},nativeAttributes:{"data-testid":`${option.label}-aspect-ratio-button`}},option.label))),react.createElement(stencil_generated.B$,{color:"primary",size:"s",variant:"outlined",onClick:handleRevert,nativeAttributes:{"data-testid":"revert-button"}},gettext("Revert"))))},image_cropper_Title=emotion_styled_browser_esm.A.div` 252 ${({theme:{cat}})=>`\n\t\tfont-size: ${cat.fontSize.h6};\n\t\tfont-weight: ${cat.fontWeight.head};\n\t\tline-height: ${cat.lineHeight.h5};\n\t\tcolor: ${cat.color.uiFontBase};\n\t`} 253`,Description=emotion_styled_browser_esm.A.div` 254 ${({theme:{cat}})=>`\n\t\tcolor: ${cat.color.uiFontMuted};\n\t\tfont-size: ${cat.fontSize.h6};\n\t\tfont-weight: ${cat.fontWeight.body};\n\t\tline-height: ${cat.lineHeight.h5};\n\t`} 255`,reactCropperSettings={viewMode:0,dragMode:"move",cropBoxMovable:!1,cropBoxResizable:!1,toggleDragModeOnDblclick:!1,zoomOnWheel:!1,zoomOnTouch:!1,responsive:!1,guides:!1,center:!1,highlight:!1,background:!1,rotatable:!1,autoCropArea:1,scalable:!1},ImageCropper=({inputFile,onError,onFinish,onReset})=>{const{gettext}=(0,use_get_text.z)(),[image,setImage]=react.useState(),[filename,setFilename]=react.useState("image.jpeg"),[fileType,setFileType]=react.useState("image/jpeg"),[initialAspectRatio,setInitialAspectRatio]=react.useState(),[minZoomLevel,setMinZoomLevel]=react.useState(),[maxZoomLevel,setMaxZoomLevel]=react.useState(),imageCropperRef=react.useRef(null);react.useEffect((()=>{inputFile&&initCropper(inputFile)}),[inputFile]);const initCropper=async file=>{const url=URL.createObjectURL(file);let imageMetadata;setImage(url),setFilename(file.name),setFileType(file.type);try{imageMetadata=await(0,image_utils.K4)(url)}catch(_a){return URL.revokeObjectURL(url),void onError(gettext("The image file is invalid or unavailable. Please select another image."))}setCropperInitialAspectRatio(imageMetadata),setCropperZoomLevels(imageMetadata)},setCropperZoomLevels=imageMetaData=>{const minZoomLevel=imageMetaData.width/imageMetaData.height>=1.7592592592592593?475/imageMetaData.width:270/imageMetaData.height;setMinZoomLevel(minZoomLevel),setMaxZoomLevel(3*minZoomLevel)},setCropperInitialAspectRatio=imageMetadata=>{var _a;const initialAspectRatio=(0,image_utils_image_utils.I0)(imageMetadata)||image_utils_image_utils.l8._16by9;null===(_a=getCropper())||void 0===_a||_a.setAspectRatio(initialAspectRatio),setInitialAspectRatio(initialAspectRatio)},closeDialog=()=>{resetImageState()},getCropper=()=>{const imageElement=null==imageCropperRef?void 0:imageCropperRef.current;return null==imageElement?void 0:imageElement.cropper},resetImageState=()=>{onReset(),image&&URL.revokeObjectURL(image),setImage(void 0),setInitialAspectRatio(void 0),setMinZoomLevel(void 0),setMaxZoomLevel(void 0)};return react.createElement(react.Fragment,null,react.createElement(components.Au,{show:!!image,onClose:closeDialog,width:524,fixedHeader:!0},react.createElement(components.Au.Header,{title:gettext("Adjust image")}),react.createElement(components.Au.Content,null,react.createElement("div",{className:"image-cropping-container"},react.createElement("div",{className:"image-cropper"},initialAspectRatio&&react.createElement(react_cropper_es.A,{...reactCropperSettings,ref:imageCropperRef,src:image,aspectRatio:initialAspectRatio,style:{height:270,width:475,borderRadius:8,overflow:"hidden"},minCropBoxHeight:270,minCropBoxWidth:475})),minZoomLevel&&maxZoomLevel&&initialAspectRatio&&react.createElement(react.Fragment,null,react.createElement(components.hK,{size:"l",dir:"y"}),react.createElement(ImageCropperControls,{minZoomLevel,maxZoomLevel,initialAspectRatio,zoomTo:value=>{var _a;return null===(_a=getCropper())||void 0===_a?void 0:_a.zoomTo(value)},reset:()=>{var _a;return null===(_a=getCropper())||void 0===_a?void 0:_a.reset()},setAspectRatio:value=>{var _a;return null===(_a=getCropper())||void 0===_a?void 0:_a.setAspectRatio(value)}})),react.createElement(components.hK,{size:"xl",dir:"y"}),react.createElement(image_cropper_Title,null,gettext("Drag image to reposition")),react.createElement(components.hK,{size:"s",dir:"y"}),react.createElement(Description,null,gettext("Be aware that on some social network your image maybe wonât be shown in the correct aspect ratio. Please check it before posting.")))),react.createElement(components.Au.FooterActions,null,react.createElement(stencil_generated.B$,{onClick:closeDialog,variant:"outlined",nativeAttributes:{"data-testid":"cancel-button"}},gettext("Cancel")),react.createElement(components.hK,{size:"s",dir:"x"}),react.createElement(stencil_generated.B$,{onClick:async()=>{const cropper=getCropper();cropper.getCroppedCanvas({fillColor:"#fff"}).toBlob((blob=>{blob&&(onFinish((blob=>new File([blob],filename,{type:fileType}))(blob)),resetImageState(),null==cropper||cropper.destroy())}),fileType,.9)},variant:"filled",color:"primary",nativeAttributes:{"data-testid":"save-button"}}
255,gettext("Save")))))};__webpack_require__(5375),__webpack_require__(86055);var media=__webpack_require__(75088),toast=__webpack_require__(62614),string_utils=__webpack_require__(73225);const InlineRow=emotion_styled_browser_esm.A.div` 256 display: flex; 257 align-items: center; 258`,ImageUploaderSection=emotion_styled_browser_esm.A.section` 259 ${({theme:{cat:{spacing,color,radius,fontSize}},withDisabledStyle})=>`\n\t\tcursor: pointer;\n\t\tpadding: ${spacing.xl} 0;\n\t\tborder: 1px dashed ${color.uiBorderDark};\n\t\tborder-radius: ${radius.m};\n\t\tcolor: ${color.uiFontBase};\n\t\tfont-size: ${fontSize.h6};\n\t\tbackground: ${withDisabledStyle?color.uiBorderDefault:"transparent"};\n\t\tdisplay: flex;\n\t\tgap: ${spacing.xs};\n\t\tflex-direction: column;\n\t\talign-items: center;\n\n\t\tp {\n\t\t\tmargin: 0;\n\t\t}\n\t`} 260`,article_link_image_uploader_Header=emotion_styled_browser_esm.A.div` 261 ${({theme:{color,cat}})=>`\n\t\tcolor: ${color.PrimaryDefault};\n\t\tmargin-bottom: ${cat.spacing.m};\n\t`} 262`,ArticleLinkImageUploader=({imageMetadata,updateImage})=>{const[isLoading,setIsLoading]=react.useState(!1),[imageError,setImageError]=react.useState(""),[localImageFile,setLocalImageFile]=react.useState(),uploaderInputRef=react.useRef(null),{session}=(0,use_session.w)(),{gettext}=(0,use_get_text.z)(),submitImageUpdate=imageMetadata=>{try{updateImage(imageMetadata)}catch(e){setImageError(gettext("Invalid image URL"))}},uploadImage=async file=>{var _a;setIsLoading(!0);try{const{link,metadata}=await(0,media.vj)(file,session.user._id,dist.LWb.Image),uploadedImageMetadata={url:link.accessUrl,width:metadata.width,height:metadata.height,hasError:!1};submitImageUpdate(uploadedImageMetadata)}catch(error){const errorMessage=(null===(_a=error.response)||void 0===_a?void 0:_a.status)?"Failed to upload image to cloud storage":"Failed to upload image";(0,toast.Kf)({message:errorMessage}),tracking_utils.A.error(errorMessage,"ArticleLinkImageUploader.uploadImage",(0,string_utils.hT)(error))}finally{setIsLoading(!1)}},handleResetCropper=()=>{setLocalImageFile(void 0),uploaderInputRef.current&&(uploaderInputRef.current.value="")},handleSelectLocalImage=async event=>{var _a;updateImage(null),setImageError("");const files=(0,file_utils.fz)(event);if(!files||0===files.length)return;const file=files[0];if((0,image_utils.K)(file)){if((0,image_utils.kQ)(file)){const storage={gifInfo:void 0},gifError=await(0,image_utils.vK)(file,gettext,storage);if(gifError)return void setImageError(gifError);if((null===(_a=storage.gifInfo)||void 0===_a?void 0:_a.frameCount)>1)return void await uploadImage(file)}(file=>{setLocalImageFile(file)})(file)}else setImageError(gettext("Please select either an image or a gif to upload."))};return react.createElement(react.Fragment,null,imageMetadata&&!isLoading&&react.createElement(drag_n_drop_area.l,{onDrop:handleSelectLocalImage},react.createElement(image_preview.k,{remove:()=>{uploaderInputRef.current&&(uploaderInputRef.current.value=""),updateImage(null)}},react.createElement(image_proxy.C,{imageUrl:imageMetadata.url,fallbackImage:"/images/no-image-16x9.jpg",alt:"Post Image",token:dist.JRo.FitIn,id:"post-link-image-preview"}))),imageError&&react.createElement(react.Fragment,null,react.createElement(stencil_generated.Jv,{color:"danger","data-testid":"article-post-image-error"},imageError),react.createElement(components.hK,{dir:"y",size:"s"})),!imageMetadata&&react.createElement(drag_n_drop_area.l,{onDrop:handleSelectLocalImage},react.createElement(ImageUploaderSection,{onClick:()=>{var _a;return null===(_a=null==uploaderInputRef?void 0:uploaderInputRef.current)||void 0===_a?void 0:_a.click()},withDisabledStyle:isLoading},react.createElement(article_link_image_uploader_Header,null,isLoading?react.createElement(stencil_generated.K0,{size:"xl"}):react.createElement(stencil_generated.k0,{icon:"16-editor-image",size:"xl"})),react.createElement(InlineRow,null,react.createElement(image_input.M,{text:void 0,onChange:handleSelectLocalImage,inputRef:uploaderInputRef,accept:image_utils.Zw})),react.createElement(ImageUrlInput,{disabled:isLoading,onUrlLoading:()=>{setImageError(""),setIsLoading(!0)}
262,onUrlLoaded:imageMetadata=>{submitImageUpdate(imageMetadata),setIsLoading(!1)},onError:error=>{setIsLoading(!1),setImageError(error)}}))),localImageFile&&react.createElement(ImageCropper,{inputFile:localImageFile,onError:message=>{setImageError(message),handleResetCropper()},onFinish:uploadImage,onReset:handleResetCropper}))};prop_types.func,prop_types.string;var lib=__webpack_require__(45708),lib_default=__webpack_require__.n(lib);const Wrapper=emotion_styled_browser_esm.A.div` 263 ${({isValid,theme:{cat,color}})=>`\n\t\tposition: relative;\n\n\t \t* {\n font-family: inherit;\n }\n\t\t\n\t\t.ql-container.ql-snow {\n\t\t\tborder: none;\n\t\t}\n\n\t\t.ql-editor {\n\t\t\tpadding: ${cat.spacing.s} calc(${cat.spacing.s} + ${cat.spacing.xs});\n\t\t\tborder-radius: ${cat.radius.m};\n\t\t\tfont-size: ${cat.fontSize.m};\n\t\t\tline-height: ${cat.lineHeight.h5};\n\t\t\tfont-weight: normal;\n\t\t\tmin-height: 80px;\n\t\t\tcolor: black;\n\t\t\tborder: 1px solid ${isValid?cat.color.uiBorderDark:cat.color.baseRed100};\n\n\t\t\t&:hover {\n\t\t\t\toutline: 1px solid ${isValid?cat.color.uiBorderDark:cat.color.baseRed100};\n\t\t\t}\n\n\t\t\t&:focus {\n\t\t\t\tborder-color: ${color.PrimaryDefault};\n\t\t\t\toutline: 1px solid ${color.PrimaryDefault};\n\t\t\t}\n\t\t} \n\t`} 264`,Icon=(0,emotion_styled_browser_esm.A)(stencil_generated.k0)` 265 ${({theme:{cat,color}})=>`\n\t\tcolor: ${color.MessageDanger};\n\t\tposition: absolute;\n\t\ttop:${cat.spacing.s};\n\t\tright: calc(${cat.spacing.s} + ${cat.spacing.xs});\n\t`} 266`,PostArticleHtmlEditor=({placeholder,html,handleChange,isValid=!0})=>react.createElement(Wrapper,{isValid},react.createElement(lib_default(),{modules:{toolbar:{container:"#toolbar"}},value:html||"",onChange:handleChange,placeholder}),!isValid&&react.createElement(Icon,{icon:"alert-circle-outlined",size:"l"})),post_article_edit_content_Input=(0,emotion_styled_browser_esm.A)(stencil_generated.BU)` 267 color: black; 268`,LabelCentered=emotion_styled_browser_esm.A.label` 269 ${({theme:{cat}})=>`\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tgap: ${cat.spacing.xs};\n\t\tfont-size: ${cat.fontSize.m};\n\t\tline-height: ${cat.lineHeight.h5};\n\t\tcolor: black;\n\t`} 270`,post_article_edit_content_Error=emotion_styled_browser_esm.A.div` 271 ${({theme:{cat,color}})=>`\n\t\tfont-size: ${cat.fontSize.s};\n\t\tline-height: ${cat.lineHeight.h5};\n\t\tcolor: ${color.MessageDanger};\n\t`} 272`,PostArticleEditContent=({postContent,contentError,updateArticlePostContent})=>{var _a;const{gettext}=(0,use_get_text.z)();(0,catalyst_provider.g)({"error.PostArticleEditContent.titleError":null!==(_a=null==contentError?void 0:contentError.titleError)&&void 0!==_a?_a:""});const postTitleErrors=(null==contentError?void 0:contentError.titleError)?["PostArticleEditContent.titleError"]:[];return react.createElement(react.Fragment,null,react.createElement(modules.Hg,{name:"content-validation-error"}),react.createElement(post_article_edit_content_Input,{label:gettext("Title"),placeholder:gettext("Title..."),value:postContent.title,required:!0,maxLength:400,nativeAttributes:{"data-testid":"postTitle-id"},onCatChange:event=>{var _a;updateArticlePostContent({...postContent,title:null!==(_a=event.target.value)&&void 0!==_a?_a:""})},errors:postTitleErrors}),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(LabelCentered,null,react.createElement("span",null,gettext("Body")),react.createElement(stencil_generated.QS,{content:gettext("In the article body you can format your text using the rich-text toolbar.")},react.createElement(stencil_generated.k0,{icon:"question-mark-circle-outlined"}))),react.createElement(components.hK,{dir:"y",size:"s"}),react.createElement(PostArticleHtmlEditor,{html:postContent.htmlBody,handleChange:html=>{updateArticlePostContent({...postContent,htmlBody:html,body:(0,string_utils.G9)(html)})},placeholder:gettext("Start typing article body hereâ¦"),isValid:!(null==contentError?void 0:contentError.bodyError)}),react.createElement(components.hK,{dir:"y",size:"s"}),contentError&&contentError.bodyError&&react.createElement(post_article_edit_content_Error,null,contentError.bodyError),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(ArticleLinkImageUploader,{updateImage:imageMetadata=>{updateArticlePostContent({...postContent,imageMetadataList:imageMetadata?[imageMetadata]:[]})},imageMetadata:postContent.imageMetadataList[0]}))};var throttle=__webpack_require__(74022),moment=__webpack_require__(95093),react_router_dom=__webpack_require__(54625),session_util=__webpack_require__(7031);const getMostConfidentLanguage=data=>{var _a;return null===(_a=data.language)||void 0===_a?void 0:_a[0]};var FetchLinkWarning,facebook_embed_config=__webpack_require__(18387),linkedin_embed_config=__webpack_require__(94669);!function(FetchLinkWarning){FetchLinkWarning[FetchLinkWarning.Duplicate=0]="Duplicate",FetchLinkWarning[FetchLinkWarning.Other=1]="Other"}(FetchLinkWarning||(FetchLinkWarning={}));const EditArticleWarningLink=(0,emotion_styled_browser_esm.A)(react_router_dom.N_)` 273 color: ${p=>p.theme.color.MessageDanger}; 274 margin-left: ${p=>p.theme.cat.spacing.xs}; 275 276 &:hover, 277 &:focus, 278 &:active { 279 color: ${p=>p.theme.color.MessageDanger}; 280 } 281`,FullWidthContainer=emotion_styled_browser_esm.A.div` 282 width: 800px; 283`,TextareaContainer=(0,emotion_styled_browser_esm.A)(FullWidthContainer)` 284 color: ${p=>p.theme.cat.color.uiFontBase}; 285`,BaseColorText=emotion_styled_browser_esm.A.div` 286 color: ${p=>p.theme.cat.color.uiFontBase}; 287`,PostLinkEditContent=({postContent,contentError,updateLinkPostContent,onClose})=>{var _a,_b,_c;const{gettext}=(0,use_get_text.z)(),[newLink,setNewLink]=react.useState(postContent.url),[isFetchingLink,setIsFetchingLink]=react.useState(!1),[fetchLinkWarning,setFetchLinkWarning]=react.useState(null),{imageError,setImageError}=usePostContext(),session=(0,es.d4)((state=>state.Session)),debouncedFetchLink=react.useRef((0,throttle.A)((async url=>{var _a;try{const{post,language}=await fetchLinkPost(url);if((0,image_utils.R3)(null===(_a=post.imageMetadataList[0])||void 0===_a?void 0:_a.url)&&await removeGifFromPostIfInvalid(post),post.duplicatedItem){const{_id,date,isManager}=post.duplicatedItem;setFetchLinkWarning({type:FetchLinkWarning.Duplicate,payload:{post:{_id,date,isManager}}})}else setFetchLinkWarning(null);updateLinkPostContent({...post,lang:language?[language.value]:[]})}catch(err){setFetchLinkWarning({type:FetchLinkWarning.Other,payload:gettext("Cannot fetch this link")})}finally{setIsFetchingLink(!1)}}),1e3,{trailing:!0,leading:!1})),removeGifFromPostIfInvalid=async post=>
287{const gifError=await(0,image_utils.l_)(post.imageMetadataList[0],gettext);gifError&&(post.imageMetadataList=[],setImageError(`${gettext("The image from the linked page can't be used.")} ${gifError} ${gettext("Please upload another image.")}`))},updatePostImage=imageMetadata=>{setImageError(""),updateLinkPostContent({...postContent,imageMetadataList:imageMetadata?[imageMetadata]:[]})},fetchLinkPost=async url=>((0,linkedin_embed_config.RB)(url)?url=(0,linkedin_embed_config.og)(url):(0,facebook_embed_config.nD)(url)&&(url=(0,facebook_embed_config.U7)(url)),async function(postUrl,session){const{isLabEnabled}=(0,session_util.d)(session),data=(await api.CR.parseWebpage({url:postUrl})).data,imageMetadataList=[],imageLink=data.imageUrlList[0];if(imageLink)try{const imageMetaData=await(0,image_utils.K4)(imageLink);imageMetadataList.push(imageMetaData)}catch(error){console.error(error)}const language=getMostConfidentLanguage(data),post=new post_detail_service.L4;return post.init(postUrl,{...data,type:dist.EA9.Link},session.company,isLabEnabled,session.company.isLanguageEnabled?null==language?void 0:language.value:void 0,imageMetadataList),{post,language}}(url,session)),fetchLinkWarningRenderMap={[FetchLinkWarning.Duplicate]:()=>{if((null==fetchLinkWarning?void 0:fetchLinkWarning.type)!==FetchLinkWarning.Duplicate)return null;const showGoToOriginalLink=fetchLinkWarning.payload.post.isManager;return react.createElement(react.Fragment,null,react.createElement("span",{"data-testid":"post-link-url-warning-text"},gettext("This link has already been used on ")),react.createElement("span",{"data-testid":"post-link-url-warning-date"},moment(fetchLinkWarning.payload.post.date).format("DD MMMM, YYYY"),"."),showGoToOriginalLink&&react.createElement(EditArticleWarningLink,{to:location=>({...location,pathname:`/preview/${fetchLinkWarning.payload.post._id}`}),onClick:onClose,"data-testid":"post-link-url-warning-link"},gettext("Show original post")))},[FetchLinkWarning.Other]:()=>null==fetchLinkWarning?void 0:fetchLinkWarning.payload},imageMetadata=postContent.imageMetadataList?postContent.imageMetadataList[0]:null;return(0,catalyst_provider.g)({"error.PostLinkEditContent.linkError":null!==(_a=null==contentError?void 0:contentError.linkError)&&void 0!==_a?_a:"","error.PostLinkEditContent.titleError":null!==(_b=null==contentError?void 0:contentError.titleError)&&void 0!==_b?_b:""}),react.createElement(react.Fragment,null,react.createElement(modules.Hg,{name:"content-validation-error"}),react.createElement(reused_styled_components.pM,{"data-testid":"post-link-heading-text"},gettext("Add the link you want to share")),react.createElement(reused_styled_components.ZZ,null,gettext("Links should ideally be publicly accessible and start with https.")),react.createElement(BaseColorText,null,react.createElement(stencil_generated.BU,{required:!0,label:gettext("Enter or paste link"),placeholder:"https://example.com",value:newLink,onCatChange:async event=>{const value=event.target.value;if(updatePostImage(null),!value)return setNewLink(""),void updateLinkPostContent({url:""});setNewLink(value),setIsFetchingLink(!0),await debouncedFetchLink.current(value)},autoComplete:"off",nativeAttributes:{"data-testid":"post-link-url-input"},disabled:Boolean(postContent._id),loading:isFetchingLink,errors:(null==contentError?void 0:contentError.linkError)?["PostLinkEditContent.linkError"]:[]})),react.createElement(components.hK,{dir:"y",size:"xs"}),fetchLinkWarning&&react.createElement(stencil_generated.Jv,{color:"warning","data-testid":"post-link-url-warning"},fetchLinkWarningRenderMap[fetchLinkWarning.type]()),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(BaseColorText,null,react.createElement(stencil_generated.BU,{required:!0,label:gettext("Post title"),placeholder:gettext("Add post title here"),value:postContent.title,onCatChange:event=>{updateLinkPostContent({...postContent,title:event.target.value})},autoComplete:"off",nativeAttributes:{"data-testid":"post-link-title-input"},maxLength:400,errors:(null==contentError?void 0:contentError.titleError)?["PostLinkEditContent.titleError"]:[]})),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(reused_styled_components.Us,null,react.createElement(TextareaContainer,null,react.createElement(stencil_generated.Fc,{label:gettext("Post body"),placeholder:gettext("Enter your post body here"),value:null!==(_c=postContent.body)&&void 0!==_c?_c:"",onCatChange:event=>{updateLinkPostContent({...postContent,body:event.target.value})},nativeAttributes:{"data-testid":"post-link-body-textarea"},rows:8}))),react.createElement(components.hK,{dir:"y",size:"m"}),imageError&&react.createElement(react.Fragment,null,react.createElement(stencil_generated.Jv,{color:"danger","data-testid":"post-link-image-error"},imageError),react.createElement(components.hK,{dir:"y",size:"s"})),react.createElement(show_by_condition.q,{isShow:Boolean(newLink)&&!isFetchingLink},react.createElement(ArticleLinkImageUploader,{updateImage:updatePostImage,imageMetadata})))};var image_placeholder=__webpack_require__(31242),formatting=__webpack_require__(51752);const socNetVideoRequirements=[{socNetName:socnet_enums.tZ.Linkedin,wideSide:{min:360,max:4320},narrowSide:{min:360,max:4320},aspectRatio:{min:[1,3],max:[3,1]},duration:{min:3,max:30*formatting.Rc},fileSize:{max:500},fileExtensions:["mp4"]},{socNetName:socnet_enums.tZ.Twitter,wideSide:{min:32,max:1024},narrowSide:{min:32,max:1024},duration:{min:1,max:140},aspectRatio:{min:[1,3],max:[3,1]},fileSize:{max:512},fileExtensions:["mp4","mov"]},{socNetName:socnet_enums.tZ.Facebook,aspectRatio:{min:[1,3],max:[3,1]},fileSize:{max:50}},{socNetName:socnet_enums.tZ.Instagram,wideSide:{min:640},narrowSide:{min:640},aspectRatio:{min:[1,3],max:[3,1]},duration:{min:3,max:10*formatting.Rc},fileExtensions:["mp4"]},{socNetName:socnet_enums.tZ.Bluesky,duration:{max:3*formatting.Rc},wideSide:{min:1,max:1920},narrowSide:{min:1,max:1920},aspectRatio:{min:[1,3],max:[3,1]},fileSize:{max:100},fileExtensions:["mp4","mov"]}];var RangeRequirementsEnum;!function(RangeRequirementsEnum){RangeRequirementsEnum.wideSide="wideSide",RangeRequirementsEnum.narrowSide="narrowSide",RangeRequirementsEnum.duration="duration",RangeRequirementsEnum.fileSize="fileSize"}(RangeRequirementsEnum||(RangeRequirementsEnum={}));const internalVideoRequirements={socNetName:"",fileSize:{max:500},fileExtensions:["mp4"]},getCombinedRangeRequirements=selectedSocNetsRequirements=>selectedSocNetsRequirements.reduce(((combinedReqs,curSocNetReqs)=>{for(const item in RangeRequirementsEnum){const curVideoPropertyName=item,curVideoPropertyReqs=curSocNetReqs[curVideoPropertyName];if(!curVideoPropertyReqs)continue;const curVideoPropertyReqsCombined=combinedReqs[curVideoPropertyName];curVideoPropertyReqs.min&&(!(null==curVideoPropertyReqsCombined?void 0:curVideoPropertyReqsCombined.min)||curVideoPropertyReqs.min>curVideoPropertyReqsCombined.min)&&(combinedReqs[curVideoPropertyName]={...combinedReqs[curVideoPropertyName],min:curVideoPropertyReqs.min}),curVideoPropertyReqs.max&&(!(null==curVideoPropertyReqsCombined?void 0:curVideoPropertyReqsCombined.max)||curVideoPropertyReqs.max<curVideoPropertyReqsCombined.max)&&(combinedReqs[curVideoPropertyName]={...combinedReqs[curVideoPropertyName],max:curVideoPropertyReqs.max})}return combinedReqs}),{}),getCombinedAspectRatioRequirements=selectedSocNetsRequirements=>({aspectRatio:selectedSocNetsRequirements.map((req=>req.aspectRatio)).reduce(((combinedRange,curSocNetRange)=>curSocNetRange?(curSocNetRange.min&&(!(null==combinedRange?void 0:combinedRange.min)||compareAspectRatio(curSocNetRange.min,combinedRange.min)>0)&&(combinedRange.min=curSocNetRange.min),curSocNetRange.max&&(!(null==combinedRange?void 0:combinedRange.max)||compareAspectRatio(curSocNetRange.max,combinedRange.max)<0)&&(combinedRange.max=curSocNetRange.max),combinedRange):combinedRange),{})}),getCombinedFileExtensionRequirements=selectedSocNetsRequirements=>({fileExtensions:selectedSocNetsRequirements.map((req=>req.fileExtensions)).reduce(((combinedFileExtensions,currentSocNetFileExtensions)=>currentSocNetFileExtensions?combinedFileExtensions?currentSocNetFileExtensions.filter((fileExt=>null==combinedFileExtensions?void 0:combinedFileExtensions.includes(fileExt))):currentSocNetFileExtensions:combinedFileExtensions),void 0)}),compareAspectRatio=(aspectRatioA,aspectRatioB)=>
287Math.sign(aspectRatioA[0]/aspectRatioA[1]-aspectRatioB[0]/aspectRatioB[1]);var post_preview_video=__webpack_require__(24563);const CaptureVideoThumbnail=({videoUrl,snapTime,onSnapshotCaptured,onSnapshotStarted})=>{const videoRef=react.useRef(null),canvasRef=react.useRef(null),[videoReady,setVideoReady]=react.useState(!1);return react.createElement(react.Fragment,null,!videoReady&&react.createElement("div",null,"Loading..."),react.createElement("div",{style:{display:"none"},"data-testid":"default-thumbnail"},react.createElement("canvas",{ref:canvasRef}),react.createElement("video",{muted:!0,src:videoUrl,ref:videoRef,onLoadedData:()=>{setVideoReady(!0),videoRef.current.currentTime=snapTime,setVideoReady(!1),onSnapshotStarted&&onSnapshotStarted()},onSeeked:()=>{const video=videoRef.current,canvas=canvasRef.current;let url;if(canvas.height=video.videoHeight,canvas.width=video.videoWidth,canvas.getContext("2d").drawImage(video,0,0),canvas.msToBlob){const blob=canvas.msToBlob();url=window.URL.createObjectURL(blob)}else url=canvas.toDataURL();onSnapshotCaptured(url),setVideoReady(!0)}})))},ImageContainer=emotion_styled_browser_esm.A.div` 288 ${({selected,aspectRatio,theme:{cat,color}})=>`\n\t\tdisplay: inline-block;\n\t\tborder-radius: ${cat.radius.m};\n\t\tposition: relative;\n\t\tcursor: pointer;\n\t\t\n\t\timg {\n\t\t\theight: 166px; // then 2 thumbnails 16:9 fit by width into the row\n\t\t\taspect-ratio: ${aspectRatio};\n\t\t\twidth: auto;\n\t\t}\n\t\t\n\t\t${!0===selected&&`box-shadow: 0 0 0 4px ${color.PrimaryDefault};`}\n\t`} 289`,VideoThumbnailImage=({imageMetadata,children,onClick,selected,testId})=>{const{gettext}=(0,use_get_text.z)();if(!imageMetadata)return null;const{width,height,url}=imageMetadata,aspectRatio=width/height,imageSrc=(0,image_utils_image_utils.x8)(url,dist.JRo.FitIn);return react.createElement(ImageContainer,{selected,onClick,"data-testid":testId,aspectRatio},react.createElement("img",{src:imageSrc,alt:gettext("Video thumbnail")}),children)},UploadCustomThumbnailContainer=emotion_styled_browser_esm.A.div` 290 display: flex; 291 align-items: start; 292 justify-content: center; 293 position: relative; 294 top: -4px; 295`,UploadThumbnailImage=({onImageSelected})=>{const{gettext}=(0,use_get_text.z)(),inputEl=react.useRef(null);return react.createElement(react.Fragment,null,react.createElement("input",{type:"file",accept:"image/png, image/jpeg",style:{display:"none"},onChange:event=>{event.target.files&&onImageSelected(event.target.files)},ref:inputEl,multiple:!1,"data-testid":"upload-thumbnail-input"}),react.createElement(UploadCustomThumbnailContainer,null,react.createElement(stencil_generated.B$,{color:"primary",size:"m",icon:"w-image-outlined",nativeAttributes:{"data-testid":"upload-thumbnail-button"},onClick:()=>{var _a;null===(_a=inputEl.current)||void 0===_a||_a.click()}},gettext("Select a custom thumbnail"))))},Container=emotion_styled_browser_esm.A.div` 296 display: flex; 297 gap: 20px; 298`,RemoveThumbnailButton=(0,emotion_styled_browser_esm.A)(stencil_generated.B$)` 299 display: flex; 300 z-index: 1000; 301 position: absolute; 302 right: 10px; 303 top: 10px; 304 background-color: white; 305 border-radius: ${p=>p.theme.cat.radius.m}; 306`,VideoThumbnailSelector=({videoUrl,currentTime,value,onSelect})=>{const{videoThumbnails:{defaultThumbnail,customThumbnail,setDefaultThumbnail,setCustomThumbnail}}=usePostContext(),[isCustomSelected,setIsCustomSelected]=react.useState(!1);react.useEffect((()=>{value&&setDefaultThumbnail(value)}),[]);const selectThumbnailOption=(thumbnail,isCustom)=>{thumbnail&&(setIsCustomSelected(isCustom),onSelect(thumbnail))},handleUseDefaultThumbnail=()=>{selectThumbnailOption(defaultThumbnail,!1)},isCustomThumbnailSelected=()=>isCustomSelected&&!!customThumbnail;return react.createElement(Container,null,!value&&react.createElement(CaptureVideoThumbnail,{videoUrl,snapTime:currentTime,onSnapshotCaptured:async objectUrl=>{const imageMetadata=await(0,image_utils.K4)(objectUrl);setDefaultThumbnail(imageMetadata),onSelect(imageMetadata)},"data-testid":"capture-thumbnail"}),react.createElement(VideoThumbnailImage,{imageMetadata:defaultThumbnail,selected:!isCustomThumbnailSelected(),onClick:handleUseDefaultThumbnail,testId:"default-video-thumbnail"}),customThumbnail?react.createElement(VideoThumbnailImage,{imageMetadata:customThumbnail,selected:isCustomThumbnailSelected(),onClick:async()=>
306{selectThumbnailOption(customThumbnail,!0)},testId:"custom-video-thumbnail"},react.createElement(RemoveThumbnailButton,{variant:"text",iconOnly:!0,size:"s",icon:"trash-outlined",nativeAttributes:{"data-testid":"icon-remove"},onClick:event=>{event.stopPropagation(),event.preventDefault(),handleUseDefaultThumbnail(),URL.revokeObjectURL(null==customThumbnail?void 0:customThumbnail.url),setCustomThumbnail(void 0)}})):react.createElement(UploadThumbnailImage,{onImageSelected:async files=>{const imageFile=files[0],imageMetadata=await(0,image_utils.H_)(imageFile,!0);setCustomThumbnail(imageMetadata),setIsCustomSelected(!0),onSelect(imageMetadata)}}))};var video_utils=__webpack_require__(952);const ImagePlaceHolderCaption=emotion_styled_browser_esm.A.div` 307 display: flex; 308 flex-direction: column; 309 align-items: center; 310 text-decoration: unset !important; 311 font-size: ${p=>p.theme.cat.fontSize.m}; 312 313 .search-computer { 314 ::part(button) { 315 text-decoration: underline; 316 color: ${p=>p.theme.color.PrimaryDefault}; 317 padding-left: 5px; 318 padding-right: 5px; 319 320 &:hover { 321 background-color: transparent; 322 } 323 } 324 } 325`,VideoRequirements=emotion_styled_browser_esm.A.div` 326 text-align: left; 327 white-space: pre-line; 328 font-size: ${p=>p.theme.cat.fontSize.m}; 329 font-weight: 400; 330 line-height: ${p=>p.theme.cat.lineHeight.h5}; 331 color: ${p=>p.theme.cat.color.baseNeutral500}; 332 margin-bottom: ${p=>p.theme.cat.spacing.m}; 333`,TextWrapper=emotion_styled_browser_esm.A.div` 334 display: flex; 335 align-items: center; 336 justify-content: center; 337`,post_video_edit_content_StyledInput=(0,emotion_styled_browser_esm.A)(stencil_generated.BU)` 338 font-size: ${p=>p.theme.cat.fontSize.m}; 339 font-weight: 400; 340 line-height: ${p=>p.theme.cat.lineHeight.h5}; 341 color: black; 342`,VideoPreviewContainer=emotion_styled_browser_esm.A.div` 343 position: relative; 344`,RemoveVideoButton=(0,emotion_styled_browser_esm.A)(stencil_generated.B$)` 345 background-color: white; 346 position: absolute; 347 top: 20px; 348 right: 20px; 349 border-radius: ${p=>p.theme.cat.radius.m}; 350`,ThumbnailHeader=emotion_styled_browser_esm.A.div` 351 font-size: ${p=>p.theme.cat.fontSize.m}; 352 color: black; 353`,PostVideoEditContent=({postContent,updatePostContent,contentError})=>{var _a,_b,_c,_d;const{gettext}=(0,use_get_text.z)(),[videoState,setVideoState]=react.useState(null),updatePost=postUpdate=>{updatePostContent(postUpdate)},{setVideoErrors,videoErrors,videoThumbnails:{setDefaultThumbnail,setCustomThumbnail}}=usePostContext();(0,catalyst_provider.g)({"error.PostVideoErrorContent.errorTitle":gettext("Please enter title for the post")});const videoRequirements=(socNetList=>{if(0===socNetList.length)return internalVideoRequirements;const selectedSocNetsRequirements=socNetVideoRequirements.filter((rule=>socNetList.includes(rule.socNetName)));return{...getCombinedRangeRequirements(selectedSocNetsRequirements),...getCombinedAspectRatioRequirements(selectedSocNetsRequirements),...getCombinedFileExtensionRequirements(selectedSocNetsRequirements),socNetName:""}})((0,video_utils.re)(postContent.socnetSet)),isInit=react.useRef(!0),validateVideo=react.useCallback(((metadata,videoRequirements)=>[...(0,video_utils.GW)(metadata,videoRequirements,gettext),...(0,video_utils.LE)(metadata,videoRequirements,gettext)]),[gettext]);react.useEffect((()=>{if(!isInit.current)return;if(isInit.current=!1,!postContent.videoMetadata)return;const{width=0,height=0,duration=0,size=0,format=""}=postContent.videoMetadata,newErrors=validateVideo({size,format,width,height,duration},videoRequirements);setVideoErrors(newErrors)}),[postContent._id,postContent.videoMetadata,setVideoErrors,validateVideo,videoRequirements]);const handleSelectFiles=async({target:{files}})=>{if(!files||!files.length)return;const videoFile=files[0],sizeMB=(0,math.kG)(videoFile.size),format=(0,video_utils.QC)(videoFile.name),localVideoUrlProxy=URL.createObjectURL(videoFile);let videoMetadata;try{videoMetadata=await(0,video_utils.HY)(localVideoUrlProxy,gettext)}catch(err){return void setVideoErrors([err])}const newErrors=validateVideo({size:sizeMB,format,width:videoMetadata.width,height:videoMetadata.height,duration:videoMetadata.duration},videoRequirements);setVideoErrors(newErrors),newErrors.length>0||(setDefaultThumbnail(void 0),setCustomThumbnail(void 0),updatePost({videoUrl:localVideoUrlProxy,videoMetadata:{...videoMetadata,size:sizeMB,format},imageMetadataList:[]}))},inputEl=react.useRef(null),[videoPreviewMaxWidth,videoPreviewMaxHeight]=["595px","45vh"];return react.createElement(react.Fragment,null,!postContent.videoUrl&&react.createElement(react.Fragment,null,react.createElement(reused_styled_components.up,{"data-testid":"upload-video"},gettext("Upload your video")),react.createElement(VideoRequirements,{"data-testid":"upload-video-requirements"},gettext((0,video_utils.F3)(videoRequirements,gettext))),react.createElement(drag_n_drop_area.l,{onDrop:handleSelectFiles},react.createElement(image_placeholder.x,{showPlaceholder:!0,onClick:()=>{var _a;return null===(_a=inputEl.current)||void 0===_a?void 0:_a.click()},title:react.createElement(ImagePlaceHolderCaption,null,react.createElement(TextWrapper,{"data-testid":"video-upload-container"},react.createElement("span",null,gettext("Drag and drop your video here, or")),react.createElement(stencil_generated.B$,{variant:"link",color:"primary",size:"s",nativeAttributes:{"data-testid":"video-upload-browse-button"}},gettext("browse")),react.createElement("span",null,gettext("your computer."))),react.createElement("input",{type:"file",accept:(reqs=>
353{if(reqs.fileExtensions)return reqs.fileExtensions.map((extension=>`.${extension}`)).join(",")})(videoRequirements),style:{display:"none"},onChange:handleSelectFiles,ref:inputEl,"data-testid":"video-upload-input"}))}))),Boolean(postContent.videoUrl)&&react.createElement(VideoPreviewContainer,null,postContent._id?react.createElement(post_preview_video.e,{videoUrl:postContent.videoUrl,aspectRatio:(0,video_utils.v4)(postContent.videoMetadata),isStreamingType:!0,posterUrl:(0,image_utils_image_utils.x8)(null===(_b=null===(_a=postContent.imageMetadataList)||void 0===_a?void 0:_a[0])||void 0===_b?void 0:_b.url,dist.JRo.FitInX15),postId:postContent._id,maxWidth:videoPreviewMaxWidth,maxHeight:videoPreviewMaxHeight}):react.createElement(react.Fragment,null,react.createElement(post_preview_video.e,{videoUrl:postContent.videoUrl,aspectRatio:(0,video_utils.v4)(postContent.videoMetadata),isStreamingType:!1,posterUrl:(0,image_utils_image_utils.x8)(null===(_d=null===(_c=postContent.imageMetadataList)||void 0===_c?void 0:_c[0])||void 0===_d?void 0:_d.url,dist.JRo.FitInX15),onPlaying:setVideoState,maxWidth:videoPreviewMaxWidth,maxHeight:videoPreviewMaxHeight}),react.createElement(RemoveVideoButton,{icon:"trash-outlined",iconOnly:!0,variant:"outlined",size:"s",onClick:()=>{setVideoErrors([]),setDefaultThumbnail(void 0),setCustomThumbnail(void 0),updatePost({videoUrl:void 0,videoMetadata:void 0,imageMetadataList:[]})},nativeAttributes:{"data-testid":"remove-video-button"}})),react.createElement(components.hK,{dir:"y",size:"l"}),react.createElement(ThumbnailHeader,null,gettext("Thumbnail")),react.createElement(components.hK,{dir:"y",size:"s"}),react.createElement(VideoThumbnailSelector,{videoUrl:postContent.videoUrl,currentTime:null==videoState?void 0:videoState.currentTime,value:postContent.imageMetadataList[0],onSelect:image=>{updatePost({imageMetadataList:image?[image]:[]})}})),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(ErrorsList,{errors:videoErrors}),react.createElement(ErrorMessage,{error:null==contentError?void 0:contentError.videoError}),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(post_video_edit_content_StyledInput,{label:gettext("Post title"),value:postContent.title,placeholder:gettext("Add post title here"),onCatChange:e=>updatePost({title:e.target.value}),required:!0,style:{width:"100%"},nativeAttributes:{"data-testid":"postTitle-id"},maxLength:400,errors:(null==contentError?void 0:contentError.titleError)?["PostVideoErrorContent.errorTitle"]:[]}),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(modules.Hg,{name:"content-validation-error"}))},ErrorMessage=({error})=>error?react.createElement(stencil_generated.Jv,{color:"danger","data-testid":"video-error"},error):null,ErrorsList=({errors})=>(null==errors?void 0:errors.length)?react.createElement(react.Fragment,null,errors.map(((error,index)=>react.createElement(react.Fragment,null,react.createElement(stencil_generated.Jv,{color:"danger",key:index,"data-testid":`video-error-${index}`},error),react.createElement(components.hK,{dir:"y",size:"m"}))))):null,PostEditContent=props=>{const{post,contentError,postType,updateArticlePostContent,updateLinkPostContent,updateImagePostContent,updateDocumentPostContent,onClose}=props;return react.createElement(react.Fragment,null,postType===dist.EA9.Video&&react.createElement(PostVideoEditContent,{contentError,postContent:{_id:post._id,imageMetadataList:post.imageMetadataList,title:post.title,videoUrl:post.videoUrl,socnetSet:post.socnetSet,videoMetadata:post.videoMetadata},updatePostContent:updateImagePostContent}),postType===dist.EA9.Article&&react.createElement(PostArticleEditContent,{contentError,postContent:{imageMetadataList:post.imageMetadataList,title:post.title,body:post.body,htmlBody:post.htmlBody?post.htmlBody:post.body},updateArticlePostContent}),postType===dist.EA9.Link&&react.createElement(PostLinkEditContent,{contentError:null!=contentError?contentError:void 0,postContent:{_id:post._id,imageMetadataList:post.imageMetadataList,title:post.title,body:post.body,url:post.url,lang:post.lang},updateLinkPostContent,onClose}
353),postType===dist.EA9.Image&&react.createElement(PostImageEditContent,{contentError,postContent:{imageMetadataList:post.imageMetadataList,title:post.title,socnetSet:post.socnetSet},updateImagePostContent,isNewPost:!post._id}),postType===dist.EA9.Document&&react.createElement(PostDocumentEditContent,{contentError,postContent:{title:post.title,document:post.document,imageMetadataList:post.imageMetadataList||[]},updateDocumentPostContent,isNewPost:!post._id}))},DoneButton=({onSuccessSubmit,onSubmit,disabled})=>{const[isLoading,setIsLoading]=react.useState(!1),{gettext}=(0,use_get_text.z)();return react.createElement(stencil_generated.B$,{loading:isLoading,onClick:async()=>{try{if(isLoading)return;setIsLoading(!0),await onSubmit(),setIsLoading(!1),onSuccessSubmit()}catch(_a){setIsLoading(!1)}},color:"primary",variant:"filled",disabled},gettext("Publish"))},DoneButtonWithUploadTooltip=({onSubmit,onSuccessSubmit,isUploading,text})=>react.createElement(stencil_generated.QS,{content:text,disabled:!isUploading},react.createElement(DoneButton,{onSubmit,onSuccessSubmit,disabled:isUploading}));var labs=__webpack_require__(25231);const getCustomToolbar=()=>react.createElement("div",{id:"toolbar",className:"post-reach-text-editor-toolbar"},react.createElement("select",{className:"ql-header",defaultValue:"",onChange:e=>e.persist()},react.createElement("option",{value:"1"},"Header"),react.createElement("option",{value:"2"},"Subheader"),react.createElement("option",{value:""},"Normal")),react.createElement(components.hK,{size:"m",dir:"x"}),react.createElement("button",{className:"ql-bold"}),react.createElement("button",{className:"ql-italic"}),react.createElement("button",{className:"ql-strike"}),react.createElement("button",{className:"ql-underline"}),react.createElement(components.hK,{size:"m",dir:"x"}),react.createElement("button",{className:"ql-list",value:"ordered"}),react.createElement("button",{className:"ql-list",value:"bullet"}),react.createElement(components.hK,{size:"m",dir:"x"}),react.createElement("button",{className:"ql-link"}));var use_select_user=__webpack_require__(56377),util=__webpack_require__(58151);var filter_channel_manager=__webpack_require__(18901);var react_gettext_lib=__webpack_require__(85821),authorize=__webpack_require__(33941),adapters=__webpack_require__(59008);class CreatePostChannelSelector extends react.Component{constructor(){super(...arguments),this.sectionNames={publishableChannel:this.context.gettext("My managed channels"),proposableChannel:this.context.gettext("Other subscribed channels")},this.tooltips={myChannel:this.context.gettext("My managed channel"),otherChannel:this.context.gettext("Other subscribed channel")}}render(){const{renderDefault=!1}=this.props;if(renderDefault)return this.renderDefaultSelect();const userRoles=[dist.u8N.GroupAdmin,dist.u8N.ChannelManager];return react.createElement(react.Fragment,null,react.createElement(authorize._,{roles:userRoles},this.renderSectionedSelect()),react.createElement(authorize._,{excludedRoles:userRoles},this.renderDefaultSelect()))}renderDefaultSelect(){const{renderDefault,options,groupId,...selectProps}=this.props,isLoading=0===options.length;return react.createElement(components.xI,{...selectProps,channelList:(0,adapters.DI)(options,groupId),placeholder:this.context.gettext("Select"),isLoading})}renderSectionedSelect(){const{renderDefault,options,groupId,...selectProps}=this.props,isLoading=0===options.length,sectionedOptions=(0,adapters.sT)(options,groupId,this.sectionNames),customComponents={MultiValue:props=>{const isOwnChannel=props.data.isManager,tooltipText=isOwnChannel?this.tooltips.myChannel:this.tooltips.otherChannel;return react.createElement(components.Hw,{...props,style:isOwnChannel?"primary":"outline",tooltipText})}};return react.createElement(components.xI,{...selectProps,placeholder:this.context.gettext("Choose channels"),channelList:sectionedOptions,components:customComponents,isLoading})}}CreatePostChannelSelector.contextType=react_gettext_lib.dg;class EditPostChannelSelector extends react.Component{constructor(){super(...arguments),this.tooltips={myChannel:this.context.gettext("My managed channel"),otherChannel:this.context.gettext("Other channel"),published:this.context.gettext("Published"),scheduled:this.context.gettext("Scheduled at"),archived:this.context.gettext("Archived at")},this.channelStatusDescs={pending:this.context.gettext("Pending for review"),approved:this.context.gettext("Will be approved"),rejected:this.context.gettext("Will be rejected")},this.getCustomComponents=()=>({Option:props=>{const{data,getValue}=props,channel=getValue().find((({_id})=>_id===data._id)),ariaLabel={approveLabel:"approve-icon",rejectLabel:"reject-icon"};switch(channel?channel.status:data.status){case dist.d8c.IStatusEnum.Proposed:return react.createElement(components.BE,{...props,status:"pending",onApproveClicked:e=>this.onChannelStatusSetToApproved(e,data),onRejectClicked:e=>this.onChannelStatusSetToRejected(e,data),secondaryText:this.channelStatusDescs.pending,ariaLabel});case dist.d8c.IStatusEnum.Approved:return react.createElement(components.BE,{...props,status:"approved",onApproveClicked:e=>this.onChannelStatusSetToProposed(e,data),onRejectClicked:e=>this.onChannelStatusSetToRejected(e,data),secondaryText:this.channelStatusDescs.approved,ariaLabel});case dist.d8c.IStatusEnum.Rejected:return react.createElement(components.BE,{...props,status:"rejected",onApproveClicked:e=>this.onChannelStatusSetToApproved(e,data),onRejectClicked:e=>this.onChannelStatusSetToProposed(e,data),secondaryText:this.channelStatusDescs.rejected,ariaLabel});default:return react.createElement(components.O5,{...props})}},MultiValue:props=>{const{status}=props.data;if(status===dist.d8c.IStatusEnum.Proposed||status===dist.d8c.IStatusEnum.Rejected)return null;const{isManager,publishedAt,archivedAt}=props.data,channelPossessionText=`${isManager?this.tooltips.myC
353hannel:this.tooltips.otherChannel}`;let labelProps={};switch((0,post_detail_service.pL)(props.data)){case dist.d8c.IStatusEnum.Scheduled:labelProps={tooltipText:`${channelPossessionText} - ${this.tooltips.scheduled} ${moment(publishedAt).format("DD/MM/YYYY HH:mm")}`,icon:"16-clock-outlined"};break;case dist.d8c.IStatusEnum.Archived:labelProps={tooltipText:`${channelPossessionText} - ${this.tooltips.archived} ${moment(archivedAt).format("DD/MM/YYYY HH:mm")}`};break;case dist.d8c.IStatusEnum.Published:labelProps={tooltipText:`${channelPossessionText} - ${this.tooltips.published}`};break;default:labelProps={tooltipText:channelPossessionText}}return react.createElement(components.Hw,{...props,...labelProps,style:isManager?"primary":"disabled"})}}),this.handleChange=(options,type)=>{"remove-value"!==type.action&&"pop-value"!==type.action||!type.removedValue||type.removedValue.status!==dist.d8c.IStatusEnum.Approved?this.props.onChange(options):this.setChannelStatus(dist.d8c.IStatusEnum.Proposed,type.removedValue)},this.setChannelStatus=(status,channel)=>{const values=this.props.value.concat(),index=values.findIndex((value=>value._id===channel._id));-1!==index&&(values[index]={...values[index],status},this.props.onChange(values))},this.onChannelStatusSetToApproved=(e,data)=>{e.stopPropagation(),this.setChannelStatus(dist.d8c.IStatusEnum.Approved,data)},this.onChannelStatusSetToProposed=(e,data)=>{e.stopPropagation(),this.setChannelStatus(dist.d8c.IStatusEnum.Proposed,data)},this.onChannelStatusSetToRejected=(e,data)=>{e.stopPropagation(),this.setChannelStatus(dist.d8c.IStatusEnum.Rejected,data)}}render(){const{options,groupId,onChange,...selectProps}=this.props,isLoading=0===options.length,channelList=(0,adapters.DI)(options,groupId);return react.createElement(components.xI,{...selectProps,onChange:this.handleChange,channelList,components:this.getCustomComponents(),isClearable:!1,"aria-label":"edit-post-channel-select",placeholder:this.context.gettext("Choose channels"),isLoading})}}EditPostChannelSelector.contextType=react_gettext_lib.dg;const PostChannelSelectWrapper=({value,options,hasWarning=!1,onChange,session,shouldUseEditModeSelector,labelText,hintText,required})=>{if(!session)return null;const channelSelectorProps={value,options,onChange,showGroups:session.company.isGroupEnabled,groupId:session.user.groupId,showWarningHighlight:hasWarning,labelText,hintText,required};return session.company.isChannelManagerEnabled?shouldUseEditModeSelector?react.createElement(EditPostChannelSelector,{...channelSelectorProps}):react.createElement(CreatePostChannelSelector,{...channelSelectorProps}):react.createElement(CreatePostChannelSelector,{renderDefault:!0,...channelSelectorProps})},AudienceSettings=({hasSocnetsAvailable,isPostExternal,onToggleShareable})=>{const{gettext}=(0,use_get_text.z)(),internalChecked=!hasSocnetsAvailable||!isPostExternal;return react.createElement(react.Fragment,null,react.createElement(stencil_generated.ut,{label:gettext("Post is for Internal reading"),name:"internal",checked:internalChecked,onCatChange:onToggleShareable,nativeAttributes:{"data-testid":"internal-post-radio"}}),hasSocnetsAvailable&&react.createElement(react.Fragment,null,react.createElement(components.hK,{dir:"y",size:"s"}),react.createElement(stencil_generated.ut,{label:gettext("Post is for External sharing"),name:"external",checked:isPostExternal,onCatChange:onToggleShareable,nativeAttributes:{"data-testid":"external-post-radio"}})))},PostFeaturedCheckboxAndRefreshButton=({label,initialValue,currentValue,onToggle,onRefresh,refreshed})=>{const{gettext}=(0,use_get_text.z)(),featuredBefore=Boolean(initialValue),featuredNow=Boolean(currentValue),canBeRefreshed=featuredBefore&&featuredNow&&!refreshed;return react.createElement(stencil_generated.ih,{label,checked:featuredNow,onCatChange:onToggle,nativeAttributes:{"data-testid":`${label}-checkbox`}},react.createElement("span",{slot:"hint"},react.createElement(components.VY,null,(()=>{if(featuredNow){if(canBeRefreshed){const formattedDate=moment(currentValue).format("DD MMM YYYY HH:mm");return`${gettext("Last featured on")} ${formattedDate}`}return refreshed?gettext("The date will be updated when the post will be saved"):void 0}})()),canBeRefreshed&&react.createElement(stencil_generated.B$,{variant:"link",color:"primary",size:"xs",onClick:onRefresh,nativeAttributes:{"data-testid":`${label}-refresh-button`}},gettext("Refresh"))))};var post_utils=__webpack_require__(733),redux_selectors=__webpack_require__(23181);const Hint=emotion_styled_browser_esm.A.div` 354 margin-left: 30px; 355`,PostFeaturedSettings=({isEdit,post,updatePostSettings})=>{const{gettext}=(0,use_get_text.z)(),defaultPostData=(0,es.d4)(redux_selectors.Tp.getAllPosts)[post._id],initialValueFeed=null==defaultPostData?void 0:defaultPostData.featuredAt,initialValueEmail=null==defaultPostData?void 0:defaultPostData.featuredForEmailAt,w
355asFeaturedAnywhere=Boolean(initialValueFeed)||Boolean(initialValueEmail),featuredForFeedNow=(0,post_utils.Y0)(post),featuredForEmailNow=(0,post_utils.yf)(post),featuredAnywhereNow=featuredForFeedNow||featuredForEmailNow,[mainCheckboxValue,setMainCheckboxValue]=react.useState(featuredAnywhereNow),[showTargetCheckboxes,setShowTargetCheckboxes]=react.useState(featuredAnywhereNow),[refreshedFeed,setRefreshedFeed]=react.useState(!1),[refreshedEmail,setRefreshedEmail]=react.useState(!1);return react.createElement(react.Fragment,null,react.createElement(stencil_generated.ih,{label:gettext("Show in âFeatured postsâ"),checked:mainCheckboxValue,onCatChange:()=>{setMainCheckboxValue(!featuredAnywhereNow),setShowTargetCheckboxes(!featuredAnywhereNow);const now=new Date;updatePostSettings({featuredAt:featuredAnywhereNow?void 0:null!=initialValueFeed?initialValueFeed:now,featuredForEmailAt:featuredAnywhereNow?void 0:null!=initialValueEmail?initialValueEmail:now})},nativeAttributes:{"data-testid":"featured-posts-checkbox"}},react.createElement("label",{slot:"label"},react.createElement("span",null,gettext("Show in âFeatured postsâ")),react.createElement(stencil_generated.QS,{content:gettext("A featured post will appear on the top of the feed or on the email digest newsletter, depending on your selection. Posts will be displayed in chronological order from newest to oldest. Refreshing the date will make the post reappear as the first in the feed or in the email.")},react.createElement(stencil_generated.k0,{icon:"question-mark-circle-outlined"}))),react.createElement("span",{slot:"hint"},(()=>{if(wasFeaturedAnywhere&&!featuredAnywhereNow)return gettext("Once the post settings are saved, the post will no longer appear as featured");return gettext(!isEdit?"Post will be marked as featured when itâs published":"Post will be marked as featured when itâs saved")})())),showTargetCheckboxes&&react.createElement(Hint,null,react.createElement(components.hK,{size:"s",dir:"y"}),react.createElement(PostFeaturedCheckboxAndRefreshButton,{label:gettext("on the feed"),initialValue:initialValueFeed,currentValue:post.featuredAt,onToggle:()=>{const newValue=featuredForFeedNow?void 0:null!=initialValueFeed?initialValueFeed:new Date;updatePostSettings({featuredAt:newValue}),!Boolean(newValue)&&featuredForEmailNow||setMainCheckboxValue(Boolean(newValue))},onRefresh:()=>{updatePostSettings({featuredAt:new Date}),setRefreshedFeed(!0)},refreshed:refreshedFeed}),react.createElement(components.hK,{size:"s",dir:"y"}),react.createElement(PostFeaturedCheckboxAndRefreshButton,{label:gettext("on the email"),initialValue:initialValueEmail,currentValue:post.featuredForEmailAt,onToggle:()=>{const newValue=featuredForEmailNow?void 0:null!=initialValueEmail?initialValueEmail:new Date;updatePostSettings({featuredForEmailAt:newValue}),!Boolean(newValue)&&featuredForFeedNow||setMainCheckboxValue(Boolean(newValue))},onRefresh:()=>{updatePostSettings({featuredForEmailAt:new Date}),setRefreshedEmail(!0)},refreshed:refreshedEmail})))},post_featured_settings_old_Hint=emotion_styled_browser_esm.A.div` 356 margin-left: 30px; 357`,PostFeaturedSettingsOld=({isEdit,post,updatePostSettings})=>{const{gettext}=(0,use_get_text.z)(),defaultPostData=(0,es.d4)(redux_selectors.Tp.getAllPosts)[post._id],postFeaturedAtInitialValue=null==defaultPostData?void 0:defaultPostData.featuredAt,[featuredTimestampRefreshed,setFeaturedTimestampRefreshed]=react.useState(!1),showFeaturedPostWillBeUnmarked=isEdit&&!post.featuredAt&&Boolean(postFeaturedAtInitialValue),showFeaturedPostWillBeUpdated=isEdit&&Boolean(post.featuredAt)&&featuredTimestampRefreshed,showFeaturedPostWillBeMarked=isEdit&&!postFeaturedAtInitialValue,showFeaturedPostWasMarkedAt=isEdit&&Boolean(postFeaturedAtInitialValue)&&Boolean(post.featuredAt)&&!featuredTimestampRefreshed;return react.createElement(react.Fragment,null,react.createElement(stencil_generated.ih,{label:gettext("Show in âFeatured postsâ"),checked:!!post.featuredAt,onCatChange:()=>{post.featuredAt?updatePostSettings({featuredAt:void 0}):updatePostSettings({featuredAt:postFeaturedAtInitialValue||new Date})},nativeAttributes:{"data-testid":"featured-posts-checkbox"}}),react.createElement(post_featured_settings_old_Hint,null,!isEdit&&react.createElement(components.VY,null,gettext("Post will be marked as featured when itâs published")),showFeaturedPostWillBeMarked&&react.createElement(components.VY,null,gettext("Post will be marked as featured when itâs saved")),showFeaturedPostWasMarkedAt&&react.createElement(react.Fragment,null,react.createElement(components.VY,null,gettext(`The post was featured on ${moment(post.featuredAt).format("DD MMM YYYY HH:mm")}`)),react.createElement(stencil_generated.B$,{variant:"link",color:"primary",size:"xs",onClick:()=>{updatePostSettings({featuredAt:new Date}),setFeaturedTimestampRefreshed(!0)},nativeAttributes:{"data-testid":"refresh-featured-post-date"}},gettext("Refresh"))),showFeaturedPostWillBeUnmarked&&react.createElement(components.VY,null,gettext("Once the post settings are saved, the post will no longer appear as featured")),showFeaturedPostWillBeUpdated&&react.createElement(components.VY,null,gettext("The date will be updated when the post will be saved"))))},PostSharingSettingsIntro=({postType})=>{const{gettext}=(0,use_get_text.z)();return(0,image_utils.CS)(postType)?react.createElement("label",null,gettext("Set a share message which appears with your post when it's shared")):postType===dist.
357EA9.Text?react.createElement("div",{className:"cat-flex-col cat-gap-s"},react.createElement("span",{className:"cat-text-secondary cat-text-m"},gettext("Social media and sharing messages")),react.createElement("span",{className:"cat-text-muted cat-text-s"},gettext("In a text post, only the sharing message is shared to social media. Please add one or more messages you wish to use for the post."))):react.createElement("div",{className:"cat-items-center cat-gap-xs"},react.createElement("span",null,gettext("Select sharing networks and messages")," "),react.createElement(stencil_generated.QS,{content:gettext("Add social networks, plus set a share message which appears with your post when it is shared")},react.createElement(stencil_generated.k0,{icon:"question-mark-circle-outlined"})))};var components_util=__webpack_require__(79304);const LINKEDIN_VIDEO_URN_REGEXP=/<iframe src="https:\/\/www.linkedin.com\/embed\/feed\/update\/([^"]+)" [^>]*><\/iframe>/i,ShareLinkedInVideoEmbedded=props=>{const{onChange,value}=props,[localValue,setLocalValue]=react.useState((()=>value?`<iframe src="https://www.linkedin.com/embed/feed/update/${value}" height="668" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>`:"")),[isValid,setIsValid]=react.useState(!0),{gettext}=(0,use_get_text.z)(),hintText=react.createElement(react.Fragment,null,react.createElement("p",null,gettext("To share a video post on LinkedIn follow the steps below.")),react.createElement("ol",null,react.createElement("li",null,gettext("1. Create a video post on your companyâs LinkedIn Page.")),react.createElement("li",null,gettext("2. Copy the embed code of the video post from LinkedIn.")),react.createElement("li",null,gettext("3. Paste the embed code for LinkedIn sharing.")))),labelText=react.createElement("div",null,react.createElement(components.YC,null,gettext("To make this post shareable, paste the embed code of the video post from LinkedIn."))),showWarning=props.isError||!isValid;return react.createElement(react.Fragment,null,react.createElement("div",{className:"socnet-embed-input"},react.createElement(components.TZ,{type:"text",labelText,hintElement:hintText,value:localValue,onChange:event=>{const value=event.target.value;setLocalValue(value);const match=value.match(LINKEDIN_VIDEO_URN_REGEXP);match?(setIsValid(!0),onChange(match[1])):setIsValid(!1)},style:{width:"100%"},placeholder:'<iframe src="https://www.linkedin.com/" allowfullscreen="" title="Embedded post"></iframe>',dataTestId:"linkedin-embedded-code-input"})),react.createElement(components.hK,{dir:"y",size:"m"}),showWarning&&react.createElement(react.Fragment,null,react.createElement(message.Q,{messageType:"warning"},react.createElement("p",null,"Invalid embed code, users wonât be able to share this post on LinkedIn. Please enter a valid embed code or uncheck sharing on LinkedIn")),react.createElement(components.hK,{dir:"y",size:"m"})))};var share_message_ai=__webpack_require__(99306),text_input_with_linkedIn_companies_mentions=__webpack_require__(20445),share_utils=__webpack_require__(60820),cat_share_message_input=__webpack_require__(14273);const ShareMessageInput=({socnet,isSupported,shareMessage,onChange,label,sidebarContent,footerContent})=>{const{gettext}=(0,use_get_text.z)(),{session}
357=(0,use_session.w)(),socnetDisplay=(0,share_utils.kI)(socnet);if(!isSupported)return react.createElement("span",{className:"share-comment-not-support"},react.createElement(components.P,null,socnetDisplay," - ",gettext("default message not supported")));const placeholder=gettext("Write something..."),aiUsageNotice=gettext("This message is generated by AI. Please review content"),input=socnet===socnet_enums.tZ.Linkedin?react.createElement(text_input_with_linkedIn_companies_mentions.w,{shareMessage,onChange:e=>onChange(e.target.value),placeholder,dataTestId:"linkedin-comment-textarea",hint:shareMessage.aiCallId?aiUsageNotice:void 0}):react.createElement(cat_share_message_input.h,{shareMessage,placeholder,onChange:message=>onChange(message),remainingCharactersCount:(0,share_utils.aC)(shareMessage.text,session,socnet),dataTestid:`share-comment-textarea-${socnetDisplay}`,hint:shareMessage.aiCallId?aiUsageNotice:void 0,label});return react.createElement("div",{className:"cat-flex-col cat-flex-1"},label&&socnet===socnet_enums.tZ.Linkedin&&react.createElement("span",{className:"cat-muted cat-text-s cat-mb-s"},label),react.createElement("div",{className:"cat-flex-row cat-gap-xs"},react.createElement("div",{className:"cat-flex-col cat-flex-1 cat-gap-xs"},input,footerContent&&react.createElement("div",{className:"cat-flex-row"},footerContent)),sidebarContent&&react.createElement("div",{className:"cat-mt-l"},sidebarContent)))},socnetsWithoutDefaultShareMessage=[],ShareMessages=({shareMessages,socnetName,setShareMessage,removeShareMessage,addShareMessage,keywordBlockingList,enableAIGeneration,post})=>{const{gettext}=(0,use_get_text.z)();return react.createElement("div",{className:"cat-flex-col"},shareMessages.map(((message,index)=>{const isDefaultShareMessageSupported=!socnetsWithoutDefaultShareMessage.includes(socnetName),isLastInput=index===shareMessages.length-1,shouldShowAddMessageButton=isDefaultShareMessageSupported&&isLastInput;let messageNumberLabel;return shareMessages.length>1&&(messageNumberLabel=`${gettext("Message")} ${index+1}`),react.createElement("div",{key:`${socnetName}-${index}`,className:"cat-mt-m cat-mb-m cat-flex-col cat-gap-s"},react.createElement(ShareMessageInput,{socnet:socnetName,shareMessage:message,onChange:text=>{setShareMessage(index,{...message,text})},isSupported:isDefaultShareMessageSupported,label:messageNumberLabel,sidebarContent:react.createElement(stencil_generated.B$,{variant:"text",icon:"trash-outlined",iconOnly:!0,onClick:()=>{removeShareMessage(index)},nativeAttributes:{"data-testid":`remove-share-message-btn-${index}`}}),footerContent:react.createElement(react.Fragment,null,enableAIGeneration&&isDefaultShareMessageSupported&&react.createElement(share_message_ai.L,{post,socnet:socnetName,onGenerated:shareMessage=>{setShareMessage(index,shareMessage)},location:"creation"}),shouldShowAddMessageButton&&react.createElement(stencil_generated.B$,{variant:"text",size:"s",icon:"plus-outlined",className:"cat-ml-auto",onClick:addShareMessage,nativeAttributes:{"data-testid":`add-share-message-btn-${index}`}},gettext("Add message")))}),((socnet,index)=>{var _a;const blockedWords=null===(_a=null==keywordBlockingList?void 0:keywordBlockingList[socnet])||void 0===_a?void 0:_a[index];if(blockedWords)return react.createElement(stencil_generated.Jv,{color:"warning"},react.createElement("p",null,gettext(blockedWords)))})(socnetName,index))})))},ShareWithPointNotSupportList=["generic","instagram"],post_socnet_message_Card=(0,emotion_styled_browser_esm.A)(stencil_generated.Re)` 358 color: black; 359 border: ${p=>p.theme.spacing.XXXS} solid 360 ${p=>p.theme.cat.color.uiBorderDefault}; 361`,post_socnet_message_LabelCentered=emotion_styled_browser_esm.A.label` 362 display: flex; 363 align-items: center; 364 gap: ${p=>p.theme.cat.spacing.s}; 365`,post_socnet_message_Header=emotion_styled_browser_esm.A.div` 366 display: flex; 367 align-items: center; 368`,post_socnet_message_Input=(0,emotion_styled_browser_esm.A)(stencil_generated.BU)` 369 margin-top: ${p=>`-${p.theme.cat.spacing.s}`}; 370`,CheckboxWrapper=emotion_styled_browser_esm.A.div` 371 flex: 4 1 0; 372`,PointsWrapper=emotion_styled_browser_esm.A.div` 373 flex: 1 1 0; 374 display: flex; 375 align-items: center; 376 gap: ${p=>p.theme.cat.spacing.xs}; 377`,Line=emotion_styled_browser_esm.A.hr` 378 margin-left: -${p=>p.theme.cat.spacing.m}; 379 margin-right: -${p=>p.theme.cat.spacing.s}; 380`,PostSocnetMessage=({socnetName,shareable,shareMessages,socnetPoint,allowEditSharePoint,post,allowChangeSocnet,hasNoLinkedinURN,keywordBlockingList,setSocnetShareMessages,clearBlockedWords,checkBlockedWords,setSocnetSharePoint,setLinkedinURN,toggleSocnetShareable})=>{const{gettext}=(0,use_get_text.z)(),shareWithPointNotSupport=ShareWithPointNotSupportList.indexOf(socnetName)>-1,{session,sessionUtil:{isLabEnabled}}=(0,use_session.w)(),isEmbeddedRequired=socnetName===socnet_enums.tZ.Linkedin&&post.type===dist.
380EA9.Video&&(!isLabEnabled(labs.Go)||(post=>!!post._id&&!!post.linkedinVideoUrn)(post)),enableAIGeneration=session.user.isAIEnabled,socnetDisplayname=(0,socnet_enums.Os)(socnetName),{icon:socnetIcon}=(0,components_util.hj)(socnetName,gettext);return react.createElement(post_socnet_message_Card,{className:"cat-pt-s cat-pb-s cat-pr-s cat-pl-m cat-mt-s cat-mb-l"},react.createElement(post_socnet_message_Header,{className:"cat-mb-s"},react.createElement(CheckboxWrapper,null,react.createElement(stencil_generated.ih,{checked:shareable,onCatChange:()=>toggleSocnetShareable(socnetName),disabled:!allowChangeSocnet,nativeAttributes:{"data-testid":`${socnetName}-toggle-shareable-checkbox`},alignment:"center"},react.createElement(post_socnet_message_LabelCentered,{slot:"label"},react.createElement(stencil_generated.k0,{"data-testid":`${socnetName}-toggle-shareable-icon`,icon:socnetIcon,size:"l"}),socnetDisplayname))),allowEditSharePoint&&react.createElement(PointsWrapper,null,react.createElement(post_socnet_message_Input,{min:"0",type:"number",disabled:shareWithPointNotSupport||!shareable,value:null==socnetPoint?void 0:socnetPoint.toString(),onCatChange:e=>{const point=e.target.value;point&&setSocnetSharePoint(socnetName,parseInt(point))},nativeAttributes:{"data-testid":`${socnetName}-share-point-input`}}),react.createElement(stencil_generated.QS,{content:gettext("These points are awarded to your colleagues when theyâll share this post.")},react.createElement(stencil_generated.k0,{icon:"question-mark-circle-outlined",size:"l"})))),shareable&&react.createElement(react.Fragment,null,react.createElement(Line,null),isEmbeddedRequired&&react.createElement(ShareLinkedInVideoEmbedded,{value:post.linkedinVideoUrn,onChange:value=>{setLinkedinURN(value)},isError:hasNoLinkedinURN}),react.createElement(ShareMessages,{shareMessages,socnetName,setShareMessage:(index,shareMessage)=>{const updatedShareMessages=[...shareMessages];updatedShareMessages[index]=shareMessage,setSocnetShareMessages(socnetName,updatedShareMessages),checkBlockedWords(socnetName,index,shareMessage.text,keywordBlockingList)},removeShareMessage:i=>{clearBlockedWords(socnetName,i,keywordBlockingList);const updatedShareMessages=shareMessages.filter(((_,index)=>index!==i));setSocnetShareMessages(socnetName,updatedShareMessages)},addShareMessage:()=>{const updatedShareMessages=shareMessages.concat([{text:"",aiCallId:""}]);setSocnetShareMessages(socnetName,updatedShareMessages)},keywordBlockingList,enableAIGeneration,post})))},PostSharingSettings=({post,availableSocnetSet,socnetSet,allowEditSharePoint,allowChangeSocnet,keywordBlockingList,checkBlockedWords,clearBlockedWords,setSocnetShareMessages,setSocnetSharePoint,toggleSocnetShareable,setLinkedinURN,hasNoLinkedinURN})=>react.createElement(react.Fragment,null,react.createElement(PostSharingSettingsIntro,{postType:post.type}),react.createElement("div",{className:"cat-mt-m"},availableSocnetSet.map((socnet=>{const shareable=(socnetName=socnet.Name,post.linkedInMediaId?socnetName===socnet_enums.tZ.Linkedin:(0,post_share_utils.uW)(post.socnetSet[socnetName]));var socnetName;if(!allowChangeSocnet&&!shareable)return null;let shareMessages=[{text:"",aiCallId:""}],socnetPoint=socnet.SharingPoint;const postSocnet=socnetSet[socnet.Name];return postSocnet&&(socnetPoint=postSocnet.sharePoint,shareMessages=postSocnet.commentList&&postSocnet.commentList.length>0?postSocnet.commentList:shareMessages),react.createElement(react.Fragment,{key:socnet.Name},react.createElement(PostSocnetMessage,{post,shareable,shareMessages,allowEditSharePoint,setSocnetShareMessages,socnetName:socnet.Name,setSocnetSharePoint,socnetPoint,toggleSocnetShareable,checkBlockedWords,clearBlockedWords,keywordBlockingList,setLinkedinURN,allowChangeSocnet,hasNoLinkedinURN}))})))),usePostSocnetSettings=(post,updatePost,onToggleSocnet)=>{const{session}=(0,use_session.w)();return{setSocnetShareMessages:(socnet,shareMessages)=>{const socnetSet={...post.socnetSet,[socnet]:{...post.socnetSet[socnet],commentList:shareMessages}};updatePost({socnetSet})},setSocnetSharePoint:(socnet,sharePoint)=>{const socnetSet={...post.socnetSet,[socnet]:{...post.socnetSet[socnet],sharePoint:isNaN(sharePoint)||!sharePoint?null:Number(sharePoint)}};updatePost({socnetSet})},toggleSocnetShareable:socnet=>{const socnetSet={...post.socnetSet},socnetConfig={...null==socnetSet?void 0:socnetSet[socnet]};if((0,post_share_utils.uW)(socnetConfig))socnetConfig.sharePoint=null;else{const companySocnet=session.company.SocnetOrderedSet.find((cSocnet=>cSocnet.Name===socnet));socnetConfig.sharePoint=null==companySocnet?void 0:companySocnet.SharingPoint}updatePost({socnetSet:{...socnetSet,[socnet]:socnetConfig}}),null==onToggleSocnet||onToggleSocnet(socnet)}}};var cat_select_facade=__webpack_require__(33544),redux_utils=__webpack_require__(30518);const FlexElement=emotion_styled_browser_esm.A.div` 381 width: calc(50% - ${({theme})=>`calc(${theme.cat.spacing.l} / 2)`}); 382`,post_edit_settings_Row=emotion_styled_browser_esm.A.div` 383 display: flex; 384 justify-content: space-between; 385`,post_edit_settings_LabelCentered=emotion_styled_browser_esm.A.label` 386 display: flex; 387 align-items: center; 388 gap: ${p=>p.theme.cat.spacing.xs}; 389`,post_edit_settings_Error=emotion_styled_browser_esm.A.div` 390 ${({theme:{cat,color}})=>`\n\t\tfont-size: ${cat.fontSize.s};\n\t\tline-height: ${cat.lineHeight.h5};\n\t\tcolor: ${color.MessageDanger};\n\t`} 391`,PostEditSettings=(0,es.Ng)(((state,{post,isEditedByCreator})=>({myChannels:post._id?(0,selectors.Iw)(post,isEditedByCreator)(state):(0,selectors.d_)(state),session:state.Session})))((({post,myChannels,session,supportedLang,settingsError,isEditedByCreator,blockedWords,contentOwnerId,clearBlockedWords,checkBlockedWords,updatePostSettings,clearAllBlockedWords,toggleSocnetKeywords})=>{var _a;const{gettext,ngettext}=(0,use_get_text.z)(),{channelOptions}=(({isContentWriter,myChannels,contentOwnerId})=>{const{gettext}=(0,use_get_text.z)(),[channelOptions,setChannelOptions]=react.useState(myChannels),setChannelOfContentOwner=react.useCallback((async contentOwnerId=>{let contentOwnerChannels=[];const[response,error]=await(0,util.Oi)((()=>api.yp.getContentOwnerChannels(contentOwnerId)));error?alert_utils.A.errorFromApi(error,gettext):contentOwnerChannels=response.data.channels,setChannelOptions(contentOwnerChannels)}),[]);return react.useEffect((()=>{isContentWriter&&setChannelOfContentOwner(contentOwnerId)}),[isContentWriter,contentOwnerId,setChannelOfContentOwner]),{channelOptions}})({contentOwnerId,isContentWriter:(0,post_utils.y8)(post,session),myChannels});react.useEffect((()=>(detectPostLang(),()=>{cancelScheduleUpdatingKeywordsAfterPostUpdate()})),[]);const hasLanguage=post=>{var _a;return(null===(_a=null==post?void 0:post.lang)||void 0===_a?void 0:_a.length)>0};let requestAnimationFrameId;const{isManager,isGroupAdmin,isUserChannelManager,isLabEnabled}=(0,session_util.d)(session),isEdit=!!post._id&&!isEditedByCreator,userIsAnAdmin=!!session&&(isManager()||isGroupAdmin()),isPublishing=0===post.fullChannelList.length||post.fullChannelList.some((channel=>channel.isManager)),isSharer=!isManager()&&!isUserChannelManager()&&!isGroupAdmin(),approveMode=!isSharer&&!post.archivedAt&&!post.publishedAt,showNotifyUsersCheckbox=(!isEdit||!!approveMode)&&userIsAnAdmin&&isPublishing,isPostShareable=()=>
391(0,post_share_utils.y)(post),isPostExternal=isPostShareable(),proposedChannelList=post.fullChannelList.filter((channel=>channel.status===dist.d8c.IStatusEnum.Proposed&&(0,filter_channel_manager._W)(channel))),showFeaturedPostCheckbox=isManager()||isGroupAdmin(),hasSocnetsAvailable=(0,redux_utils.aj)(session.company.SocnetOrderedSet,isLabEnabled)(post.type).length>0,hideAudienceSettings=post.linkedInMediaId||post.type===dist.EA9.Video&&isLabEnabled(labs.JR)||post.type===dist.EA9.Image||post.type===dist.EA9.Text,setPostLang=lang=>{updatePostSettings({lang:[lang]})},setLinkedinURN=urn=>{updatePostSettings({linkedinVideoUrn:urn})},cancelScheduleUpdatingKeywordsAfterPostUpdate=()=>{requestAnimationFrameId&&cancelAnimationFrame(requestAnimationFrameId)},{setSocnetShareMessages,setSocnetSharePoint,toggleSocnetShareable}=usePostSocnetSettings(post,updatePostSettings,(socnet=>{cancelScheduleUpdatingKeywordsAfterPostUpdate(),requestAnimationFrameId=requestAnimationFrame((()=>{toggleSocnetKeywords(socnet)}))})),detectPostLang=async()=>{var _a;if(!hasLanguage(post)&&post.title)try{const{data}=await api.X_.detectLanguage({text:post.title});(null===(_a=null==data?void 0:data.language)||void 0===_a?void 0:_a.length)>0&&!hasLanguage(post)&&setPostLang(data.language[0].value)}catch(e){console.error(e)}},_setShareable=shareable=>{const socnetSet=(0,post_share_utils.Q1)(shareable,post,session);updatePostSettings({socnetSet}),setLinkedinURN(void 0)},languageOptions=react.useMemo((()=>(supportedLang=>supportedLang.reduce(((acc,{name,value})=>(acc.set(value,gettext(name)),acc)),new Map))(supportedLang)),[supportedLang]),campaignOptions=react.useMemo((()=>(CampaignList=>{const newMap=new Map;return CampaignList?CampaignList.reduce(((acc,{Id,Name})=>(acc.set(Id,Name),acc)),newMap):newMap})(session.company.CampaignList)),[session.company.CampaignList]);(0,catalyst_provider.g)({"error.PostConfigureStep.selectContentLanguage":null!==(_a=null==settingsError?void 0:settingsError.languageError)&&void 0!==_a?_a:""});const contentLanguageErrors=(null==settingsError?void 0:settingsError.languageError)?["PostConfigureStep.selectContentLanguage"]:[];return react.createElement("div",{className:"post-edit-settings"},react.createElement(modules.Hg,{name:"settings-validation-error"}),react.createElement("div",{className:"post-edit-settings-container","data-testid":"post-settings-container"},react.createElement(components.hK,{dir:"y",size:"s"}),react.createElement(PostChannelSelectWrapper,{session,onChange:fullChannelList=>{updatePostSettings({fullChannelList})},value:post.fullChannelList,options:channelOptions,hasWarning:settingsError&&!!settingsError.channelsError,shouldUseEditModeSelector:isEdit&&!(0,post_utils.y8)(post,session),labelText:gettext("Select channels"),required:!0,hintText:gettext("Select a channel or multiple channels where you want to share your post.")}),!isSharer&&!!proposedChannelList.length&&react.createElement(react.Fragment,null,react.createElement(components.hK,{dir:"y",size:"xs"}),react.createElement("div",{className:"post-edit-field"},react.createElement(components.VY,null,`${gettext("This post is also proposed to your")} ${(proposedChannelList=>{const{company:{isGroupEnabled}}=session;if(!proposedChannelList.length)return;let proposedChannelInfo=proposedChannelList[0].name;isGroupEnabled&&(proposedChannelInfo+=` - ${proposedChannelList[0].groupName}`);const otherChannelsCount=proposedChannelList.length-1;if(otherChannelsCount>0){proposedChannelInfo+=` & ${otherChannelsCount} ${ngettext(gettext("other channel"),gettext("other channels"),otherChannelsCount)}`}return proposedChannelInfo})(proposedChannelList)}`))),settingsError&&!!settingsError.channelsError&&react.createElement(react.Fragment,null,react.createElement(components.hK,{dir:"y",size:"s"}),react.createElement(post_edit_settings_Error,null,settingsError.channelsError)),react.createElement(components.hK,{dir:"y",size:"l"}),(session.company.isLanguageEnabled||!isSharer)&&react.createElement(react.Fragment,null,react.createElement(post_edit_settings_Row,null,session.company.isLanguageEnabled&&react.createElement(FlexElement,null,react.createElement(cat_select_facade.j,{required:!0,options:languageOptions,nativeAttributes:{autocomplete:"off","data-testid":"select-content-language"},placeholder:gettext("Content language"),noItems:gettext("No matching content language found"),value:post.lang[0],onCatChange:event=>{setPostLang(event.target.value)},errors:contentLanguageErrors},react.createElement(post_edit_settings_LabelCentered,{slot:"label"},react.createElement("span",null,gettext("Select content language")),react.createElement(stencil_generated.QS,{content:gettext("Select a language for your post so it reaches to the right audience.")},react.createElement(stencil_generated.k0,{icon:"question-mark-circle-outlined"}))))),!isSharer&&react.createElement(FlexElement,null,react.createElement(cat_select_facade.j,{placeholder:gettext("Select Campaign"),options:campaignOptions,nativeAttributes:{autocomplete:"off","data-testid":"select-campaign"},noItems:gettext("No matching campaign found"),value:post.campaignId,onCatChange:event=>{(value=>{if(value===post.campaignId)return;if(!value)return void updatePostSettings({campaignId:"",campaignColor:"",campaignName:""});const campaign=session.company.CampaignList.find((companyCampaign=>companyCampaign.Id===value));campaign&&updatePostSettings({campaignId:campaign.Id,campaignColor:campaign.Color,campaignName:campaign.Name})})(event.target.value)}},react.createElement(post_edit_settings_LabelCentered,{slot:"label"},react.createElement("span",null,gettext("Add campaign")),react.createElement(stencil_generated.QS,{content:gettext("A label you can add to the posts for segmentation, analytics and highlighting.")},react.createElement(stencil_generated.k0,{icon:"question-mark-circle-outlined"})))))),react.createElement(components.hK,{dir:"y",size:"l"})),!isSharer&&react.createElement(post_edit_settings_Row,null,session.company.commentEnabled&&react.createElement(FlexElement,null,react.createElement(stencil_generated.ih,{label:gettext("Allow commenting on post"),checked:post.commentEnabled,disabled:!!post.linkedInMediaId,onCatChange:event=>{updatePostSettings({commentEnabled:event.target.checked})},nativeAttributes:{"data-testid":"allow-comment-checkbox"}})),react.createElement(FlexElement,null,react.createElement(stencil_generated.ih,{checked:!!post.
391isReadConfirmationRequired,onCatChange:event=>{updatePostSettings({isReadConfirmationRequired:event.target.checked})},nativeAttributes:{"data-testid":"read-confirmation-checkbox"}},react.createElement(post_edit_settings_LabelCentered,{slot:"label"},react.createElement("span",null,post.type===dist.EA9.Link||post.type===dist.EA9.Article?gettext("Request read confirmation"):gettext("Request view confirmation")),react.createElement(stencil_generated.QS,{content:post.type===dist.EA9.Link||post.type===dist.EA9.Article?gettext("Request read confirmation from subscribers of all the channels where the post is published"):gettext("Request view confirmation from subscribers of all the channels where the post is published")},react.createElement(stencil_generated.k0,{icon:"question-mark-circle-outlined"})))))),react.createElement(components.hK,{dir:"y",size:"m"}),react.createElement(post_edit_settings_Row,null,showFeaturedPostCheckbox&&react.createElement(FlexElement,null,isLabEnabled(labs.d)?react.createElement(PostFeaturedSettings,{isEdit,post,updatePostSettings}):react.createElement(PostFeaturedSettingsOld,{isEdit,post,updatePostSettings})),showNotifyUsersCheckbox&&react.createElement(FlexElement,null,react.createElement(stencil_generated.ih,{label:gettext("Notify users immediately"),checked:!!post.isPostInstantPushEnabled,onCatChange:event=>{updatePostSettings({isPostInstantPushEnabled:event.target.checked})},nativeAttributes:{"data-testid":"notify-users-checkbox"}}))),react.createElement(show_by_condition.q,{isShow:!hideAudienceSettings},react.createElement(components.hK,{dir:"y",size:"l"}),react.createElement(AudienceSettings,{isPostExternal,onToggleShareable:()=>{_setShareable(!isPostShareable()),clearAllBlockedWords()},hasSocnetsAvailable})),react.createElement(components.hK,{dir:"y",size:"l"}),isPostExternal&&post.type!==dist.EA9.Text&&react.createElement(PostSharingSettings,{post,availableSocnetSet:(()=>{const list=(0,redux_utils.aj)(session.company.SocnetOrderedSet,isLabEnabled)(post.type);return"image"===post.type&&post.hasAnimatedImage?list.filter((({Name})=>(0,redux_utils.p2)(Name))):list})(),setSocnetShareMessages,socnetSet:post.socnetSet,toggleSocnetShareable,allowEditSharePoint:!isSharer&&!session.company.isGamificationDisabled,keywordBlockingList:blockedWords,checkBlockedWords,clearBlockedWords,setSocnetSharePoint,setLinkedinURN,allowChangeSocnet:!hideAudienceSettings,hasNoLinkedinURN:Boolean(null==settingsError?void 0:settingsError.hasNoLinkedinURN)})))}));var select_user_for_post_share_or_creation=__webpack_require__(62656),useValidateKeywords=__webpack_require__(27883),StepperDialog=__webpack_require__(61155),tone_of_voice_connection_message=__webpack_require__(18889);const PostItem=emotion_styled_browser_esm.A.li` 392 display: flex; 393 align-items: flex-start; 394 margin: ${({theme})=>theme.cat.spacing.m} 0; 395 padding: ${({theme})=>theme.cat.spacing.s}; 396 cursor: pointer; 397 border-radius: ${({theme})=>theme.cat.radius.m}; 398 border: 1px solid ${({theme})=>theme.cat.color.uiBorderDefault}; 399 400 &:hover { 401 border-color: ${({theme})=>theme.color.PrimaryDefault}; 402 } 403`,PostThumbnail=(0,emotion_styled_browser_esm.A)(shared_react_components.Cr)` 404 width: 4.5rem; 405 height: 4.5rem; 406 margin-right: ${({theme})=>theme.cat.spacing.s}; 407 border-radius: ${({theme})=>theme.cat.radius.m}; 408 object-fit: cover; 409 flex-shrink: 0; 410`,PostBody=emotion_styled_browser_esm.A.p` 411 margin: 0; 412 color: ${({theme})=>theme.cat.color.uiFontBase}; 413 font-size: ${({theme})=>theme.cat.fontSize.m}; 414 display: -webkit-box; 415 -webkit-line-clamp: 2; 416 -webkit-box-orient: vertical; 417 overflow: hidden; 418`,PostsListItem=({post,onSelect})=>{var _a,_b,_c;const{gettext}=(0,use_get_text.z)(),postImageUrl=null===(_a=post.imageUrls)||void 0===_a?void 0:_a[0],postTypeTextTitle=post.type===dist.
418EA9.Image&&(null!==(_c=null===(_b=post.imageUrls)||void 0===_b?void 0:_b.length)&&void 0!==_c?_c:0)>1?gettext("images"):gettext(post.type);return react.createElement(PostItem,{onClick:()=>{onSelect(post)},role:"button",tabIndex:0,"data-testid":`post-item-${post.mediaId}`},postImageUrl&&react.createElement(PostThumbnail,{imageUrl:postImageUrl,alt:"","data-testid":"post-thumbnail"}),react.createElement("div",{className:"cat-flex-column"},react.createElement(PostBody,null,react.createElement("span",{"data-testid":"post-body"},post.body)),post.document&&react.createElement("a",{href:post.document.url,target:"_blank",rel:"noreferrer",onClick:event=>{event.stopPropagation()},className:"cat-text-s cat-text-primary cat-flex cat-items-center cat-gap-xs","data-testid":"post-document"},react.createElement(stencil_generated.k0,{icon:"file-pdf",size:"s"}),post.document.title),react.createElement("span",{className:"cat-text-xs cat-text-muted"},postTypeTextTitle)))},CompanyPostsList=({company,onSelect,isVisible=!0})=>{const{gettext}=(0,use_get_text.z)(),[state,setState]=react.useState({status:"idle"}),urn=null==company?void 0:company.urn;if(react.useEffect((()=>{if(!urn)return void setState({status:"idle"});let cancelled=!1;return(async()=>{var _a;setState({status:"loading"});const[response,error]=await(0,util.Oi)((()=>api.Rc.getLinkedInCompanyPosts(urn)));cancelled||setState(error?{status:"error"}:{status:"success",posts:null!==(_a=null==response?void 0:response.data)&&void 0!==_a?_a:[]})})(),()=>{cancelled=!0}}),[urn]),!isVisible||"idle"===state.status)return null;if("loading"===state.status)return react.createElement(reused_styled_components.YG,{className:"cat-mt-l","data-testid":"company-posts-loading"});if("error"===state.status)return react.createElement(stencil_generated.Jv,{color:"danger","data-testid":"company-posts-error"},gettext("Failed to load posts. Please try again."));const posts=state.posts;return 0===posts.length?react.createElement("p",{className:"cat-text-s cat-text-secondary cat-mt-l","data-testid":"no-posts-message"},gettext("No posts found for this company")):react.createElement(react.Fragment,null,react.createElement("p",{className:"cat-text-m cat-text-secondary cat-mv-l"},gettext("Select post that you would like to embed")),react.createElement("ul",{className:"cat-plain cat-flex-column cat-gap-s","data-testid":"company-posts-list"},posts.map((post=>react.createElement(PostsListItem,{key:post.mediaId,post,onSelect})))))};var use_debounced_value=__webpack_require__(39717);const ResultsList=emotion_styled_browser_esm.A.ul` 419 list-style: none; 420 margin: 0; 421 padding: 0; 422 border: 1px solid ${({theme})=>theme.cat.color.uiBorderDefault}; 423 border-radius: ${({theme})=>theme.cat.radius.m}; 424 overflow: hidden; 425`,CompanyItem=emotion_styled_browser_esm.A.li` 426 padding: ${({theme})=>`${theme.cat.spacing.s} ${theme.cat.spacing.m}`}; 427 cursor: pointer; 428 &:hover { 429 background-color: ${({theme})=>theme.cat.color.uiBackgroundCanvas}; 430 } 431`,CompanySearchSelector=({query,onQueryChange,onCompanySelect,isCompanySelected,error})=>{const{gettext}=(0,use_get_text.z)(),{debouncedValue}=(0,use_debounced_value.o)(query,300),[state,setState]=react.useState({status:"idle"}),isPending=!isCompanySelected&&query.trim()!==debouncedValue.trim();react.useEffect((()=>{if(isCompanySelected||!(null==debouncedValue?void 0:debouncedValue.trim()))return void setState({status:"idle"});let cancelled=!1;return(async()=>{var _a;setState({status:"loading"});const[response,error]=await(0,util.Oi)((()=>api.Rc.linkedinCompanySearchGet(debouncedValue)));cancelled||setState(error?{status:"error"}:{status:"success",results:null!==(_a=response.data)&&void 0!==_a?_a:[]})})(),()=>{cancelled=!0}}),[debouncedValue,isCompanySelected]);return react.useEffect((()=>{(0,catalyst_provider.g)({"error.CompanySearchSelector.error":null!=error?error:""})}),[error]),react.createElement(react.Fragment,null,react.createElement(modules.Hg,{name:"content-validation-error"}),react.createElement("p",{className:"cat-text-m cat-text-secondary"},gettext("Search for your company on LinkedIn")),react.createElement("p",{className:"cat-text-s cat-mt-0"},gettext("Start typing your company name to see results")),react.createElement(stencil_generated.BU,{type:"text",placeholder:gettext("Company name"),value:query,onCatChange:e=>{var _a;onQueryChange(null!==(_a=e.target.value)&&void 0!==_a?_a:"")},"data-testid":"company-search-input",errors:error?["CompanySearchSelector.error"]:[]}),("loading"===state.status||isPending&&query.trim())&&react.createElement(reused_styled_components.YG,{className:"cat-mt-l","data-testid":"company-search-loading"}),"error"===state.status&&react.createElement(stencil_generated.Jv,{color:"danger",className:"cat-mt-s","data-testid":"company-search-error"},gettext("Failed to search for companies. Please try searching again.")),"success"===state.status&&!isPending&&0===state.results.length&&react.createElement("p",{className:"cat-text-s cat-text-secondary cat-mt-l","data-testid":"no-companies-message"},gettext("No companies found")),"success"===state.status&&!isPending&&state.results.length>0&&react.createElement(ResultsList,{"data-testid":"company-search-results",role:"listbox",id:"company-search-listbox","aria-label":gettext("Companies")},state.results.map((company=>react.createElement(CompanyItem,{key:company.urn,onClick:()=>onCompanySelect(company),"data-testid":`company-item-${company.urn}`,role:"option",tabIndex:0,"aria-selected":!1},react.createElement(stencil_generated.iR,{src:company.logoUrl,label:company.name||"",size:"m"}
431),react.createElement("span",{className:"cat-text-m cat-mh-m cat-whitespace-nowrap"},company.name))))))};var linkedin_company_post_utils=__webpack_require__(4834),actions=__webpack_require__(50929);const LinkedInCompanyPostContext=react.createContext(null),LinkedInCompanySearchProvider=({children})=>{const dispatch=(0,es.wA)(),lastLinkedInCompany=(0,es.d4)((state=>state.sessionEnhancer.lastLinkedInCompany)),[selectedCompany,setSelectedCompanyState]=react.useState(lastLinkedInCompany),[selectedLinkedInPost,setSelectedLinkedInPost]=react.useState(null),value=react.useMemo((()=>({selectedCompany,setSelectedCompany:company=>{setSelectedCompanyState(company),company&&dispatch((0,actions.Y)({lastLinkedInCompany:company}))},selectedLinkedInPost,setSelectedLinkedInPost})),[dispatch,selectedCompany,selectedLinkedInPost]);return react.createElement(LinkedInCompanyPostContext.Provider,{value},children)};var VideoContent=__webpack_require__(49890),document_post_content=__webpack_require__(542);const PreviewCard=emotion_styled_browser_esm.A.div` 432 ${({theme:{cat}})=>`\n\t\tposition: relative;\n\t\tborder: 1px solid ${cat.color.uiBorderDefault};\n\t\tborder-radius: ${cat.radius.l};\n\t\tpadding: ${cat.spacing.s};\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: ${cat.spacing.s};\n\t\toverflow: hidden;\n\t\tcolor: ${cat.color.uiFontBase};\n\t`} 433`,UnselectButton=(0,emotion_styled_browser_esm.A)(stencil_generated.B$)` 434 ${({theme:{cat}})=>`\n\t\tposition: absolute;\n\t\ttop: ${cat.spacing.xs};\n\t\tright: ${cat.spacing.xs};\n\t\tz-index: 9999;\n\t\tbackground-color: ${cat.color.uiBackgroundCanvas};\n\t\tborder-radius: ${cat.radius.m};\n\t`} 435`,SingleImage=(0,emotion_styled_browser_esm.A)(image_proxy.C)` 436 ${({theme:{cat}})=>`\n\t\twidth: 100%;\n\t\tmax-height: 400px;\n\t\tobject-fit: contain;\n\t\tborder-radius: ${cat.radius.l};\n\t`} 437`,ArticleBody=emotion_styled_browser_esm.A.div` 438 ${({theme:{cat}})=>`\n\t\tfont-size: ${cat.fontSize.h6};\n\t\tline-height: ${cat.lineHeight.h2};\n\t\twhite-space: pre-wrap;\n\t\tword-break: break-word;\n\t\toverflow-y: auto;\n\t`} 439`,renderImageBlock=imageMetadataList=>0===imageMetadataList.length?null:1===imageMetadataList.length?react.createElement(SingleImage,{imageUrl:imageMetadataList[0].url,token:dist.JRo.FitInX15}):react.createElement(post_card_content.r3,{imageMetadataList}),SelectedPostPreview=({post,onUnselect})=>{var _a;const{gettext}=(0,use_get_text.z)(),title=null!==(_a=post.title)&&void 0!==_a?_a:"",imageMetadataList=(null!=(urls=post.imageUrls)?urls:[]).map((url=>({url,width:0,height:0})));var urls;const hasImage=imageMetadataList.length>0;return react.createElement(PreviewCard,null,react.createElement(UnselectButton,{onClick:onUnselect,iconOnly:!0,icon:"cross-outlined",variant:"text",size:"s",a11yLabel:gettext("Unselect post"),nativeAttributes:{"data-testid":"unselect-post-button"}}),(()=>{var _a,_b,_c,_d;switch(post.type){case dist.EA9.Image:return react.createElement(react.Fragment,null,renderImageBlock(imageMetadataList),title&&react.createElement(post_card_content.eT,null,title));case dist.EA9.Video:return react.createElement(VideoContent.b,{videoMetadata:void 0,imgUrl:null!==(_b=null===(_a=post.imageUrls)||void 0===_a?void 0:_a[0])&&void 0!==_b?_b:"",title,campaignColor:"",maxHeight:void 0});case dist.EA9.Document:return react.createElement(document_post_content.j,{title:null!==(_d=null===(_c=post.document)||void 0===_c?void 0:_c.title)&&void 0!==_d?_d:title,campaignColor:"",imageMetadataList,withSlideshow:!1,withFileTypeIcon:!0});default:return react.createElement(react.Fragment,null,hasImage&&renderImageBlock(imageMetadataList),title&&react.createElement(post_card_content.eT,null,title),react.createElement(ArticleBody,null,post.body))}})())},InlineLinkButton=(0,emotion_styled_browser_esm.A)(stencil_generated.B$)` 440 vertical-align: top; 441 ::part(button) { 442 display: inline; 443 min-height: 0; 444 padding: 0; 445 margin: 0; 446 font-size: inherit; 447 line-height: inherit; 448 } 449`,LinkedInCompanyPost=({changePost,showError,onErrorClear})=>{var _a;const{session}
449=(0,use_session.w)(),isLinkedinConnected=Boolean(session.user.linkedin),{gettext}=(0,use_get_text.z)(),{selectedCompany,setSelectedCompany,selectedLinkedInPost,setSelectedLinkedInPost}=(()=>{const context=react.useContext(LinkedInCompanyPostContext);if(!context)throw new Error("useLinkedInCompanyPostContext must be used within LinkedInCompanySearchProvider");return context})(),[searchQuery,setSearchQuery]=react.useState(null!==(_a=null==selectedCompany?void 0:selectedCompany.name)&&void 0!==_a?_a:""),handleLinkedInPostSelect=linkedinPost=>{if(setSelectedLinkedInPost(linkedinPost),null==onErrorClear||onErrorClear(),!linkedinPost)return void changePost((0,linkedin_company_post_utils.TI)(session));const post=(0,linkedin_company_post_utils.X6)(linkedinPost,session,selectedCompany);changePost(post)},linkedinPostError=showError?gettext(selectedCompany?"Please select a post from LinkedIn":"Please select a company on LinkedIn"):void 0;return isLinkedinConnected?react.createElement("div",{className:"cat-flex-column cat-gap-s"},!(null==selectedCompany?void 0:selectedCompany.isLinkedInPageAdmin)&&react.createElement("p",{className:"cat-flex cat-items-center cat-gap-xs"},react.createElement(stencil_generated.k0,{icon:"16-warning-circle-outlined"}),react.createElement("span",{"data-testid":"linkedin-admin-warning-message"},gettext("You must be an admin of the selected LinkedIn company page to fetch LinkedIn likes and comments. Otherwise, only internal engagement is shown. Connect"),react.createElement(InlineLinkButton,{className:"cat-ml-xs",variant:"link",color:"primary",urlTarget:"_self",url:`/oauth/linkedin/connect?company=1&redirect=company/${session.company._id}/content?tab=linkedin`,nativeAttributes:{"data-testid":"linkedin-authenticate-button"}},gettext("here")))),react.createElement(CompanySearchSelector,{query:searchQuery,onQueryChange:value=>{setSearchQuery(value),null==onErrorClear||onErrorClear(),selectedCompany&&setSelectedCompany(null),selectedLinkedInPost&&handleLinkedInPostSelect(null)},onCompanySelect:company=>{var _a;setSearchQuery(null!==(_a=company.name)&&void 0!==_a?_a:""),setSelectedCompany(company),handleLinkedInPostSelect(null),null==onErrorClear||onErrorClear()},isCompanySelected:!!selectedCompany,error:linkedinPostError}),react.createElement(CompanyPostsList,{company:selectedCompany,onSelect:handleLinkedInPostSelect,isVisible:!!selectedCompany&&!selectedLinkedInPost}),react.createElement(components.hK,{dir:"y",size:"m"}),selectedLinkedInPost&&react.createElement(SelectedPostPreview,{post:selectedLinkedInPost,onUnselect:()=>{handleLinkedInPostSelect(null)}})):react.createElement(tone_of_voice_connection_message.t,{description:gettext("Connect to use posts from it."),returnPath:""})},PostTextEdit=({post,contentError,settingsError,updateTextPost,isNewPost,blockedWords,checkBlockedWords,clearBlockedWords})=>{const{gettext}=(0,use_get_text.z)(),{session,sessionUtil:{isLabEnabled,isManager,isUserChannelManager,isGroupAdmin}}=(0,use_session.w)();(0,catalyst_provider.g)({"error.PostTextEdit.title":gettext("Please enter title for the post")});const socnets=(0,redux_utils.aj)(session.company.SocnetOrderedSet,isLabEnabled)(dist.EA9.Text),{setSocnetShareMessages,setSocnetSharePoint,toggleSocnetShareable}=usePostSocnetSettings(post,updateTextPost),allowEditSharePoint=!(!isManager()&&!isUserChannelManager()&&!isGroupAdmin())&&!session.company.isGamificationDisabled;return react.createElement("div",null,react.createElement(modules.Hg,{name:"content-validation-error"}),react.createElement(stencil_generated.BU,{required:!0,label:gettext("Post title"),placeholder:gettext("Add post title here"),hint:gettext("Post title will be used for showing on news feed and won't be shared on social networks."),value:post.title,onCatChange:event=>{var _a;updateTextPost({title:null!==(_a=event.target.value)&&void 0!==_a?_a:""})},autoComplete:"off",nativeAttributes:{"data-testid":"post-text-title-input"},maxLength:400,errors:(null==contentError?void 0:contentError.titleError)?["PostTextEdit.title"]:[],className:"cat-mb-xl cat-text-secondary"}),react.createElement(PostSharingSettings,{post,availableSocnetSet:socnets,setSocnetShareMessages,socnetSet:post.socnetSet,toggleSocnetShareable,allowEditSharePoint,keywordBlockingList:blockedWords,checkBlockedWords,clearBlockedWords,setSocnetSharePoint,allowChangeSocnet:isNewPost,hasNoLinkedinURN:!0,setLinkedinURN:noop.A}
449),(null==settingsError?void 0:settingsError.textPostSocnetError)&&react.createElement("span",{role:"alert",className:"cat-text-danger cat-text-s","data-testid":"post-text-socnet-error"},gettext("Please select at least one social media")))},PostEditDialog=({post,showDialog,onClose,onCancel,changePost,submit,isEditedByCreator=!1,isCreateMode,isCompanyPostFlow=!1,isUploading})=>{const postType=post.type,[showSettingsError,setShowSettingsError]=react.useState(!1),[showContentError,setShowContentError]=react.useState(!1),[showUtmTagsError,setShowUtmTagsError]=react.useState(!1),{gettext}=(0,use_get_text.z)(),{session,sessionUtil:{isLabEnabled}}=(0,use_session.w)(),scrollTo=(targetName,containerId)=>{modules.XG.scrollTo(targetName,{offset:-200,duration:800,delay:0,smooth:"easeInOutQuart",containerId})},[videoErrors,setVideoErrors]=react.useState([]),[imageErrors,setImageError]=react.useState(void 0),[documentError,setDocumentError]=react.useState(void 0),[defaultThumbnail,setDefaultThumbnail]=react.useState(void 0),[customThumbnail,setCustomThumbnail]=react.useState(void 0),postContextValue={videoErrors,imageError:imageErrors,documentError,setDocumentError,setVideoErrors,setImageError,videoThumbnails:{defaultThumbnail,customThumbnail,setDefaultThumbnail,setCustomThumbnail}},updateArticleContent=content=>{changePost(content)},updateLinkContent=content=>{changePost(content)},updateSettings=(0,react.useCallback)((settings=>{changePost(settings)}),[changePost]),onUpdateSocnetSet=(0,react.useCallback)((socnetSet=>{updateSettings({socnetSet})}),[updateSettings]),{postAudience,changePostAudience,toggleSocnetShareable,postAudienceError}=(props=>{const{post,onPostSettingsUpdate}=props,[postAudienceError,setPostAudienceError]=react.useState(),{session}=(0,use_session.w)(),{gettext}=(0,use_get_text.z)(),audienceHint=gettext("To continue, select whether your post is internal or external."),socnetHint=gettext("To continue, select one or all social networks."),[postAudience,setPostAudience]=react.useState(PostEditAudienceType.Unset),isInit=react.useRef(!0);react.useEffect((()=>{if(!isInit.current)return;isInit.current=!1;const isShareable=post._id?(0,post_share_utils.y)(post):session.company.isDefaultPostTypeShareable;setPostAudience(isShareable?PostEditAudienceType.External:PostEditAudienceType.Internal)}),[post,session]);const changePostAudience=react.useCallback((value=>{value!==PostEditAudienceType.Unset&&(setPostAudienceError(void 0),onPostSettingsUpdate({}),setPostAudience(value))}),[onPostSettingsUpdate]);return react.useEffect((()=>{(0,image_utils.CS)(post.type)&&(postAudience!==PostEditAudienceType.Unset?postAudience!==PostEditAudienceType.Internal?Object.keys(post.socnetSet).some((name=>(0,post_share_utils.uW)(post.socnetSet[name])))?setPostAudienceError(void 0):setPostAudienceError(socnetHint):setPostAudienceError(void 0):setPostAudienceError(audienceHint))}),[post,postAudience]),{postAudience,changePostAudience,toggleSocnetShareable:socnetName=>{const socnetSet={...post.socnetSet},socnetConfig={...null==socnetSet?void 0:socnetSet[socnetName]};if(setPostAudienceError(void 0),(0,post_share_utils.uW)(socnetConfig))socnetConfig.sharePoint=null;else{const companySocnet=session.company.SocnetOrderedSet.find((cSocnet=>cSocnet.Name===socnetName));socnetConfig.sharePoint=null==companySocnet?void 0:companySocnet.SharingPoint}onPostSettingsUpdate({...socnetSet,[socnetName]:socnetConfig})},postAudienceError}})({post,onPostSettingsUpdate:onUpdateSocnetSet}),{contentOwnersList,selectedContentOwnerId,setSelectedContentOwnerId,getSelectUserError}=(0,use_select_user.p)({isPostCreateMode:isCreateMode,postOnBehalfAction:use_select_user.q.Create,postContentOwnerId:post.createdBy}),{supportedLanguagesOptions}=(({contentOwnerId})=>{const{sessionUtil:{isManager,isUserChannelManager,isGroupAdmin}}=(0,use_session.w)(),{gettext}=(0,use_get_text.z)(),[supportedLanguagesOptions,setSupportedLanguagesOptions]=react.useState([]),getUserSupportedLanguages=react.useCallback((async()=>{const[response,error]=await(0,util.Oi)((()=>api.X_.getLanguage("supportedRead")));if(null!==error)return void alert_utils.A.errorFromApi(error,gettext);const supportedLanguages=[...response.data];if(isManager()||isUserChannelManager()||isGroupAdmin()){const visibleToAllOption={name:gettext("Visible to all"),value:"mul"};supportedLanguages.push(visibleToAllOption)}setSupportedLanguagesOptions(supportedLanguages)}),[isManager,isUserChannelManager,isGroupAdmin,gettext]);return react.useEffect((()=>{contentOwnerId&&getUserSupportedLanguages()}),[contentOwnerId,getUserSupportedLanguages]),{supportedLanguagesOptions}})({contentOwnerId:selectedContentOwnerId}),[blockedWords,setBlockedWords]=react.useState({}),validateBlockedWords=(0,useValidateKeywords.q)(),sendShareMessageForBlockwordsCheck=react.useMemo((()=>(0,debounce.A)((async(socnet,index,comment,shareMessageBlockedWords)=>{var _a;const validatedBlockedWords=await validateBlockedWords(comment),updatedSocnetBlockedWords=(null===(_a=shareMessageBlockedWords[socnet])||void 0===_a?void 0:_a.slice())||[];
449updatedSocnetBlockedWords[index]=validatedBlockedWords,setBlockedWords({...shareMessageBlockedWords,[socnet]:updatedSocnetBlockedWords})}),400)),[setBlockedWords,validateBlockedWords]),checkBlockedWords=react.useCallback(((socnet,commentIndex,comment,shareMessageBlockedWords)=>{sendShareMessageForBlockwordsCheck(socnet,commentIndex,comment,shareMessageBlockedWords)}),[sendShareMessageForBlockwordsCheck]),clearBlockedWords=react.useCallback(((socnet,commentIndex,shareMessageBlockedWords)=>{var _a;const updatedSocnetBlockedWords=(null===(_a=shareMessageBlockedWords[socnet])||void 0===_a?void 0:_a.slice())||[];updatedSocnetBlockedWords[commentIndex]="",setBlockedWords({...shareMessageBlockedWords,[socnet]:updatedSocnetBlockedWords})}),[]),clearAllBlockedWords=()=>{setBlockedWords({})},toggleSocnetKeywords=async socnet=>{if(null!==post.socnetSet[socnet].sharePoint){const requests=post.socnetSet[socnet].commentSet.map((item=>validateBlockedWords(item))),validatedMessages=await Promise.all(requests);setBlockedWords({...blockedWords,[socnet]:validatedMessages})}else setBlockedWords({...blockedWords,[socnet]:[]})},hasBlockedKeywords=Object.values(blockedWords).some((item=>item&&item.some((innerItem=>!!innerItem)))),getVideoError=()=>{if(!post.videoUrl)return gettext("Please upload at least one video")},getDocumentError=()=>{if(!post.document)return gettext("Please upload a document")},goToConfigureStep=contentError=>{var _a;if(isCompanyPostFlow)return contentError.linkedinPostError?(showAndScrollToContentError(),Promise.reject()):Promise.resolve();if(postType===dist.EA9.Article&&contentError&&(contentError.bodyError||contentError.titleError))return showAndScrollToContentError(),Promise.reject();if(postType===dist.EA9.Link&&contentError&&(contentError.linkError||contentError.titleError))return showAndScrollToContentError(),Promise.reject();if(postType===dist.EA9.Text&&(setShowSettingsError(Boolean(null==settingsError?void 0:settingsError.textPostSocnet
449Error)),(null==contentError?void 0:contentError.titleError)||(null==settingsError?void 0:settingsError.textPostSocnetError)))return showAndScrollToContentError(),Promise.reject();if(postType===dist.EA9.Image){if(!(null===(_a=post.imageMetadataList)||void 0===_a?void 0:_a.length))return setImageError(gettext("Please upload at least one image")),showAndScrollToContentError(),Promise.reject();if((null==contentError?void 0:contentError.titleError)||(null==contentError?void 0:contentError.imageError))return showAndScrollToContentError(),Promise.reject()}return postType===dist.EA9.Video&&contentError&&(contentError.titleError||contentError.videoError||(null==videoErrors?void 0:videoErrors.length))||postType===dist.EA9.Document&&((null==contentError?void 0:contentError.titleError)||(null==contentError?void 0:contentError.documentError))?(showAndScrollToContentError(),Promise.reject()):Promise.resolve()},showAndScrollToContentError=()=>{setShowContentError(!0),scrollTo("content-validation-error","editDialogScrollableContainer")},onNext=(step,settingsError,contentError)=>"select-user"===step?(contentError=>(null==contentError?void 0:contentError.selectUserError)?(showAndScrollToContentError(),Promise.reject()):(setShowContentError(!1),Promise.resolve()))(contentError):"audience"===step?(0,image_utils.CS)(postType)&&postAudienceError?Promise.reject():Promise.resolve():"create"===step?goToConfigureStep(contentError):"configure"===step?(settingsError=>settingsError&&(settingsError.channelsError||settingsError.languageError||settingsError.hasNoLinkedinURN)?(setShowSettingsError(!0),scrollTo("settings-validation-error","editDialogScrollableContainer"),Promise.reject()):settingsError&&settingsError.socnetCommentLengthErrors?(setShowSettingsError(!0),scrollTo("socnet-comment-validation-error","editDialogScrollableContainer"),Promise.reject()):postType===dist.EA9.Article?fetchPlainTextBody(post.htmlBody).then((plainText=>{changePost({body:plainText})})):Promise.resolve())(settingsError):Promise.resolve(),fetchPlainTextBody=async html=>{try{return(await api.d_.getPlainText({html})).data.text}catch(err){alert_utils.A.errorFromApi(err,gettext)}}
449,settingsError={channelsError:0===post.fullChannelList.length?gettext("Please select at least one channel"):"",languageError:session.company.isLanguageEnabled?post.lang&&post.lang.length?-1===supportedLanguagesOptions.findIndex((lang=>post.lang[0]===lang.value))?gettext("This language is not supported by your company"):"":gettext("Please select language"):"",hasNoLinkedinURN:!isLabEnabled(labs.Go)&&postType===dist.EA9.Video&&(0,post_share_utils.uW)(post.socnetSet.linkedin)&&!post.linkedinVideoUrn,socnetCommentLengthErrors:Object.entries(post.socnetSet).some((([socnetName,postSocnet])=>{var _a;return null===(_a=null==postSocnet?void 0:postSocnet.commentList)||void 0===_a?void 0:_a.some((shareMessage=>(0,share_utils.aC)(shareMessage.text,session,socnetName)<0))})),textPostSocnetError:post.type===dist.EA9.Text&&0===Object.entries(post.socnetSet).filter((([,socnet])=>(0,post_share_utils.uW)(socnet))).length},contentError={titleError:post.title?"":gettext("Please enter title for the post"),bodyError:post.htmlBody&&"<p><br></p>"!==post.htmlBody?"":gettext("Please enter article body"),linkError:post.url?"":gettext("Please enter a valid link"),imageError:postContextValue.imageError,videoError:getVideoError(),selectUserError:getSelectUserError(),documentError:getDocumentError(),linkedinPostError:isCompanyPostFlow&&!post.linkedInMediaId},tags=post.utmTags,utmTagsError=(0,utm_util._V)(tags),userCanPostOnBehalf=(0,es.d4)((state=>state.sessionEnhancer.userSettings.postOnBehalf.canPost)),steps=(({post,hasBlockedKeywords,enableSelectUserStep,isCreateMode})=>{const{gettext}=(0,use_get_text.z)(),{sessionUtil:{isLabEnabled}}=(0,use_session.w)(),postType=post.type,isLinkedInCompanyPost=Boolean(post.linkedInMediaId),showCreateStep=isCreateMode||!isLinkedInCompanyPost;return react.useMemo((()=>{const steps=[];return enableSelectUserStep&&steps.push({key:"select-user",value:gettext("Select user"),conditionToNext:!0}),!isLinkedInCompanyPost&&(postType===dist.EA9.Video&&isLabEnabled(labs.JR)||postType===dist.EA9.Image)&&steps.push({key:"audience",value:gettext("Audience"),conditionToNext:!0}),showCreateStep&&steps.push({key:"create",value:gettext("Create"),conditionToNext:!0,dialogToolbar:isLinkedInCompanyPost||postType!==dist.EA9.Article?void 0:getCustomToolbar()}),steps.push({key:"configure",value:gettext("Configure"),conditionToNext:!hasBlockedKeywords}),steps.push({key:"confirm",value:gettext("Confirm"),conditionToNext:!0}),steps}),[postType,gettext,hasBlockedKeywords,isLabEnabled,enableSelectUserStep,showCreateStep,isLinkedInCompanyPost])})({post,hasBlockedKeywords,enableSelectUserStep:userCanPostOnBehalf&&isCreateMode,isCreateMode}),handleSelectContentOwner=contentOwnerId=>{setShowContentError(!1),setSelectedContentOwnerId(contentOwnerId),updateSettings({fullChannelList:[],contentWriterId:session.user._id})};return react.createElement(PostProvider,{value:postContextValue},react.createElement(LinkedInCompanySearchProvider,null,react.createElement(StepperDialog.s,{scrollableContainerId:"editDialogScrollableContainer",steps,isRevertable:!0,dialogProps:{ignoreBackdropClick:!0,show:showDialog,onClose:onCancel,width:660,height:"max",scrollableContainerId:"editDialogScrollableContainer"},onNext:step=>onNext(step,settingsError,contentError),submitControl:react.createElement(DoneButtonWithUploadTooltip,{onSubmit:()=>utmTagsError.emptyStaticValue.length>0?(setShowUtmTagsError(!0),scrollTo("utm-tags-error","editDialogScrollableContainer"),Promise.reject()):submit(post,selectedContentOwnerId),onSuccessSubmit:onClose,isUploading,text:gettext("Please wait until video upload is complete.")}),prevStepButtonText:gettext("Back"),nextStepButtonText:gettext("Continue")},(({currentStep})=>react.createElement(react.Fragment,null,"select-user"===currentStep&&react.createElement(select_user_for_post_share_or_creation.c,{selectUserError:showContentError?contentError.selectUserError:null,contentOwnersList,selectedContentOwnerId,setSelectedContentOwnerId:handleSelectContentOwner,actionType:use_select_user.q.Create}),"audience"===currentStep&&react.createElement(PostEditAudience,{post,toggleSocnetShareable,audie
449nce:postAudience,onAudienceChange:changePostAudience,isReadOnly:!!post._id}),"create"===currentStep&&(isCompanyPostFlow?react.createElement(LinkedInCompanyPost,{changePost,showError:showContentError&&!!contentError.linkedinPostError,onErrorClear:()=>setShowContentError(!1)}):postType===dist.EA9.Text?react.createElement(PostTextEdit,{contentError:showContentError?contentError:null,settingsError:showSettingsError?settingsError:null,post,updateTextPost:updateSettings,isNewPost:!post._id,blockedWords,checkBlockedWords,clearAllBlockedWords,clearBlockedWords,toggleSocnetKeywords}):react.createElement(PostEditContent,{contentError:showContentError?contentError:null,postType,post,updateArticlePostContent:updateArticleContent,updateLinkPostContent:updateLinkContent,updateImagePostContent:updateSettings,updateDocumentPostContent:updateSettings,onClose})),"configure"===currentStep&&react.createElement(PostEditSettings,{settingsError:showSettingsError?settingsError:null,supportedLang:supportedLanguagesOptions,post,updatePostSettings:updateSettings,blockedWords,checkBlockedWords,clearAllBlockedWords,clearBlockedWords,toggleSocnetKeywords,isEditedByCreator,contentOwnerId:selectedContentOwnerId}),"confirm"===currentStep&&react.createElement(PostConfirmPage,{post,updatePostSettings:updateSettings,utmTagsError:showUtmTagsError?utmTagsError:void 0,isCreateMode,contentOwnerId:selectedContentOwnerId}))))))}},67395:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{M:()=>Anchor,N:()=>Link});var _emotion_styled__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(59295),react_router_dom__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(54625);const StyledLink=_emotion_styled__WEBPACK_IMPORTED_MODULE_0__.A.a` 450 &, 451 &:link, 452 &:visited, 453 &:hover { 454 color: ${props=>props.theme.color.PrimaryDefault}; 455 text-decoration: underline; 456 } 457`,Anchor=StyledLink,Link=StyledLink.withComponent(react_router_dom__WEBPACK_IMPORTED_MODULE_1__.N_)},71909:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{k:()=>ImagePreview});var _emotion_styled__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(59295),_haiilo_catalyst_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(11432),react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(96540);const DeleteButton=(0,_emotion_styled__WEBPACK_IMPORTED_MODULE_0__.A)(_haiilo_catalyst_react__WEBPACK_IMPORTED_MODULE_2__.B$)` 458 ${({theme:{cat:{spacing:{s}}}})=>`\n\t\tposition: absolute;\n\t\tright: ${s};\n\t\ttop: ${s};\n\t`} 459`,Container=_emotion_styled__WEBPACK_IMPORTED_MODULE_0__.A.div` 460 ${({theme:{cat:{color,radius}}})=>`\n\t\tposition: relative;\n\t\tborder: 1px solid ${color.uiBorderDefault};\n\t\tborder-radius: ${radius.m};\n\t\toverflow: hidden;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t`} 461`,ImagePreview=({children,remove})=>react__WEBPACK_IMPORTED_MODULE_1__.createElement(Container,null,react__WEBPACK_IMPORTED_MODULE_1__.createElement(DeleteButton,{className:"image-preview-action",onCatClick:remove,icon:"trash-outlined",iconOnly:!0,nativeAttributes:{"data-testid":"delete-button"}}),children)}}]);
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.