1"use strict";(globalThis.webpackChunkomc_ui_2_0||=[]).push([[8857],{1238(e,t,s){var d=s(9950),r=s(46724),o=s(42087),n=s(74742),a=s(31030),i=s(92526),l=s(11961),c=s(82804),u=s(96621),p=s(90225),P=s(26073),f=s(73178),g=s(56943),m=s(71316),h=s(45888),v=s(54786),S=s(4963),w=s(87946),C=s.n(w),b=s(22914),O=s(77231),T=s(45084),y=s(5418),I=s(56897),H=s(75829),R=s(8516),V=s(31232),B=s(69305),N=s(79939),A=s(35091);const F=Promise.resolve({message:"",data:"",success:!1}),E=(0,d.createContext)({isQuickViewOpen:!1,isDetailedViewOpen:!1,currentProduct:null,isCurrentProductIncludedAsNestedOffering:!1,setIsDetailedViewOpen:e=>{},setIsQuickViewOpen:e=>{},setCurrentProduct:e=>{},isViewProductsBundleOpen:!1,setIsViewProductsBundleOpen:e=>{},selectedBundleType:"",setSelectedBundleType:e=>{},selectedBundleProducts:[],setSelectedBundleProducts:e=>{},getSelectedRecommendedPlan:()=>"",addProductToCart:e=>F,isUpatingCartProducts:!1,removeProductFromCart:e=>F,updateCartProduct:()=>F,addProductsBundleToCart:(e,t)=>F,removeMultipleProductsFromCart:e=>F,addAndDeleteProductsBundleToCart:(e,t,s)=>F,savePressReleaseHighlight:()=>F,isCurrentProductAddedToDraft:!1,isPRHSelected:!1,setIsPRHSelected:e=>{},hasOptedForOnlinePhotoHosting:!1,setHasOptedForOnlinePhotoHosting:e=>{},pressReleaseHighlights:[],setPRHText:(e,t)=>{},prhValidityMap:{},showPRHValidationErrors:!1,selectedTradeInfos:[],setSelectedTradeInfos:e=>{},checkIsProductAddedToCart:e=>!1,checkIsProductIncludedInCart:e=>!1,bundleSelectionState:{},setBundleSelectionState:e=>{},selectionDisabledDueToSingleDefault:!1,productServes:[],showProductBundleSelectionValidationErrors:!1,selectedSites:[],setSelectedSites:e=>{},prdSection:{},setPrdSection:null,isPSIEnabled:!1});s.d(t,["A",0,()=>{const e=(0,n.wA)(),t=(0,o.GV)(i.tE),s=(0,o.GV)(N.Kr),w=(0,o.GV)(N.Gd),F=(0,o.GV)(i.Mv),{addNotification:E}=(0,y.y)(f.V),D=(0,o.GV)(N.Ub),k=(0,o.GV)(N.q8),M=(0,o.GV)(A.KZ),x=(0,o.GV)(A.iJ),G=(0,o.GV)(A.Uo),j=(0,o.GV)(B.of),[U,_]=(0,d.useState)(null),[Q,L]=(0,d.useState)(!1),[Z,q]=(0,d.useState)(!1),[z,J]=(0,d.useState)(!1),[K,Y]=(0,d.useState)({}),[$,W]=(0,d.useState)(""),[X,ee]=(0,d.useState)([]),{isUpdatingOnlinePhotoHosting:te,hasOptedForOnlinePhotoHosting:se,setHasOptedForOnlinePhotoHosting:de,resetOnlinePhotoHostingForm:re,saveOnlinePhotoHosting:oe}=(0,h.N)(U),{bundleSelectionState:ne,setBundleSelectionState:ae,selectedBundlePrdCodes:ie,areBundleSelectionsPristine:le,selectionDisabledDueToSingleDefault:ce,setshowProductBundleSelectionValidationErrorsErrors:ue,showProductBundleSelectionValidationErrors:pe}=(0,v.z)(U),{selectedTradeInfos:Pe,setSelectedTradeInfos:fe,saveIndustryTradeInfos:ge,isTradeInfoPristine:me,isUpdatingTradeInfos:he}=(0,p.W)(U,ie),{selectedSites:ve,setSelectedSites:Se,saveSites:we,isUpdatingSites:Ce,isSelectedSitesPristine:be}=(0,I.v)(U),{runBillCodeFiltering:Oe}=(0,S.i)(U,ie,Pe),{runBillCodeFilteringForMultipleProducts:Te}=(0,R.n)(X),{runBillCodeFilteringForQuickViewModal:ye}=(0,V.Q)(X),{productServes:Ie}=(0,O.z)(U,ne),{isPRHSelected:He,pressReleaseHighlights:Re,setIsPRHSelected:Ve,savePressReleaseHighlight:Be,setPRHText:Ne,prhValidityMap:Ae,showPRHValidationErrors:Fe,isUpdatingPRH:Ee,isAllPRHTextValid:De,setShowPRHValidationErrors:ke,isPRHPristine:Me,resetPRHForm:xe}=(0,u.o)(U,Ie),Ge=(0,H.Y)(U),je=(0,d.useMemo)(()=>{const e={};return x&&"object"===typeof x&&Object.keys(x).length>0&&Object.entries(x).forEach(t=>{let[s,d]=t;d&&"object"===typeof d&&Object.keys(d).length>0&&(e[s]={},Object.entries(d).forEach(t=>{let[d,r]=t;r&&Array.isArray(r)&&r.length>0&&(e[s][d]=r.map(e=>e.productCode))}))}),JSON.stringify(e)},[x]),Ue=(0,d.useCallback)(()=>{if(!x||0===Object.keys(x).length)return"";const e=[];for(const[t,s]of Object.entries(x)){if("__typename"===t||!s||"object"!==typeof s)continue;const d=[],r={};Object.values(s).forEach(e=>{Array.isArray(e)&&e.forEach(e=>{const t=e.productCode;if(!t)return;const s=null===G||void 0===G?void 0:G.find(e=>e.prdCd===t);s&&(d.push(s.prdCd),(_e(s)||Qe(s))&&(r[s.prdCd]=!0))})});const o=d.filter(Boolean);o.length>0&&o.every(e=>r[e])&&e.push({name:t,productCount:o.length})}return 0===e.length?"":e.sort((e,t)=>
1t.productCount-e.productCount)[0].name},[D,x]),_e=(0,d.useCallback)(e=>{var t,s;return!!e&&((null!==(t=e.bundleType)&&void 0!==t?t:"")!==r.I.unset?e.bundle.some(e=>{var t;return null!==(t=D[e.prdCd])&&void 0!==t&&t}):null!==(s=D[e.prdCd])&&void 0!==s&&s)},[D]),Qe=(0,d.useCallback)(e=>{var t,s;return!!e&&((null!==(t=e.bundleType)&&void 0!==t?t:"")===r.I.unset?null!==(s=k[e.prdCd])&&void 0!==s&&s:e.bundle.every(e=>{var t;return null!==(t=k[e.prdCd])&&void 0!==t&&t}))},[k]),Le=(0,d.useMemo)(()=>_e(U),[_e,U]),Ze=(0,d.useMemo)(()=>Qe(U),[Qe,U]),[qe,{loading:ze}]=(0,c.X)(l.Vt),Je=function(d){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new Promise(o=>{const n={accountNumber:t,draftOrderId:s,distributions:d.map(e=>({productCode:e.prdCd,...null!==e&&void 0!==e&&e.isRecommended||null!==e&&void 0!==e&&e.prdCd&&e.prdCd in K&&K[e.prdCd]===m.v9.RECOMMENDED?{isRecommended:1}:{},...null!==e&&void 0!==e&&e.prdCd&&e.prdCd in K&&K[e.prdCd]===m.v9.PREVIOUSLY_PURCHASED?{isPreviouslyPurchased:1}:{},...e.selectedTradeInfos&&Array.isArray(e.selectedTradeInfos)?{tradeInfos:e.selectedTradeInfos.map(e=>({prdCd:e.prdCd,prdNm:e.prdNm}))}:{}})),geocode:F,languageCode:w,...r?{recommendedDistData:`${r} - ${je}`}:{},wordCount:j};qe({variables:n}).then(t=>{const s=(0,P.c)(t);if(s)console.warn("an error occurred while adding prds to article order"),E({type:"error",title:b.A.t("general:errorTitle"),subtitle:(0,g.oL)(b.A.t("general:errorFallbackHeading"),s),dismissTime:m.wN}),o({message:"An error occurred while adding prds to article order",success:!1,data:null});else{const s=C()(t,"data.addDistributionsToDraftOrder.distributionProducts",[]);e((0,a.FT)({path:"distributionProducts",value:s})),o({message:"",success:!0,data:s})}}).catch(e=>{const t=(0,P.c)(e);console.warn("an error occurred while adding prds to article order"),E({type:"error",title:b.A.t("general:errorTitle"),subtitle:(0,g.oL)(b.A.t("general:errorFallbackHeading"),t),dismissTime:m.wN}),o({message:"An error occurred while adding prds to article order",success:!1,data:null})})})},Ke=async()=>{if(U){var e;if((null!==(e=U.bundleType)&&void 0!==e?e:"")===r.I.unset&&D[U.prdCd])return console.warn("This product is already selected"),{data:null,success:!1,message:"This product is already selected"};{var t,s;if((null!==(t=U.bundleType)&&void 0!==t?t:"")===r.I.langVariant&&0===ie.length)return ue(!0),{success:!1,data:null,message:"Select a variant product"};const e=(null===U||void 0===U||null===(s=U.features)||void 0===s?void 0:s.includesPRH)&&!Me,n=!e||De;if(!n)return ke(!0),{success:!1,data:null,message:"Invalid PRH found"};const{result:a,excludedNestedPrdCount:i}=Oe(),{success:l}=await Je(a);if(l){var d,o;if(i>0&&E({type:"info",subtitle:b.A.t("createRelease:exclusionNotificationMessage",{count:i}),dismissTime:m.wN}),e&&n){const{success:e}=await Be();if(!e)return{success:!1,data:null,message:"Product Operations: Product was added but PRH was not saved"}}if(null!==U&&void 0!==U&&null!==(d=U.features)&&void 0!==d&&d.includesONP){const{success:e}=await oe();if(!e)return{success:!1,data:null,message:"Product Operations: Product was added but ONP was not saved"}}if(null!==U&&void 0!==U&&null!==(o=U.features)&&void 0!==o&&o.offersSiteSelection){const{success:e}=await we({isCalledFromRecommendation:!1,prd:U});if(!e)return{success:!1,data:null,message:"Product Operations: Product was added but Sites were not saved"}}return{success:!0,data:null,message:""}}return console.warn("Failed to add product to article, aborting following operations..."),{success:!1,data:null,message:"Product Operations: Product could not be added"}}}return console.warn("No product selected"),{data:null,success:!1,message:"Please select a product first..."}},Ye=(0,d.useMemo)(()=>ze||Ee||he||te||Ce,[ze,Ee,he,te,Ce]);return(0,d.useEffect)(()=>{xe(),re()},[Z]),(0,o.w5)(()=>{Z||_(null)},[Z]),(0,o.w5)(()=>{z||(W(""),ee([]))},[z]),(0,o.w5)(()=>{e(Ye?(0,a.BT)(T.Z3.custom_productOperations):(0,a.Qf)(T.Z3.custom_productOperations))},[Ye]),{isQuickViewOpen:Z,setIsQuickViewOpen:q,currentProduct:U,setCurrentProduct:_,isDetailedViewOpen:Q,setIsDetailedViewOpen:L,isViewProductsBundleOpen:z,setIsViewProductsBundleOpen:J,selectedBundleType:$,setSelectedBundleType:W,selectedBundleProducts:X,setSelectedBundleProducts:ee,getSelectedRecommendedPlan:Ue,addProductToCart:Ke,isUpatingCartProducts:Ye,removeProductFromCart:async e=>{if(e.bundle.length>0){const t=e.bundle.map(e=>e.prdCd),s=M.filter(e=>!t.includes(e.prdCd));return await Je(s)}if(D[e.prdCd]){const t=M.filter(t=>t.prdCd!==e.prdCd);return await Je(t)}return console.warn("This product is already unselected"),{data:null,success:!1,message:"This product is already unselected"}},updateCartProduct:async()=>
1{if(!U)return console.warn("No active product, have you even opened the quick view?"),{success:!0,data:null,message:"No active product"};var e,t,s,d,o;if((null!==(e=U.bundleType)&&void 0!==e?e:"")!==r.I.unset&&!le){const{success:e,message:t,data:s}=await Ke();return e?{success:!0,data:null,message:""}:(console.warn("Variant Changes: Failed to execute add products to cart flow...",{message:t,data:s}),{success:!1,data:null,message:"Product Operations: Products could not be added"})}if(null!==(t=U.features)&&void 0!==t&&t.includesPRH&&!Me){if(!De)return ke(!0),{success:!1,data:null,message:"Invalid PRH found"};await Be(),console.info("PRH updated::")}else console.info("PRH pristine::won't save PRH");return null!==U&&void 0!==U&&null!==(s=U.features)&&void 0!==s&&s.includesIndustryTargeting&&!me?(await ge(),console.info("ITI updated::")):console.info("ITI pristine::won't save ITI"),null!==U&&void 0!==U&&null!==(d=U.features)&&void 0!==d&&d.includesONP&&(await oe(),console.info("Product Operations: ONP saved successfully")),null!==U&&void 0!==U&&null!==(o=U.features)&&void 0!==o&&o.offersSiteSelection&&!be?(await we({isCalledFromRecommendation:!1,prd:U}),console.info("Site selection updated::")):console.info("Site selection pristine::won't save Site selection"),{success:!0,data:null,message:"Nothing to save"}},addProductsBundleToCart:async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(e&&e.length>0){const{result:s,excludedNestedPrdCount:d}=Te(e),{success:r}=await Je(s,t);return r?(d>0&&E({type:"info",subtitle:b.A.t("createRelease:exclusionNotificationMessage",{count:d}),dismissTime:m.wN}),e.forEach(async e=>{var t;if(null!==e&&void 0!==e&&null!==(t=e.features)&&void 0!==t&&t.offersSiteSelection){const{success:t}=await we({isCalledFromRecommendation:!0,prd:e});if(!t)return{success:!1,data:null,message:"Product Operations: Product was added but Sites were not saved"}}}),{success:!0,data:null,message:""}):{success:!1,data:null,message:"Product Operations: Product could not be added"}}return{data:null,success:!1,message:"Please select a product first..."}},removeMultipleProductsFromCart:async e=>{const t=new Set;e.forEach(e=>{e.bundle.length>0?e.bundle.forEach(e=>t.add(e.prdCd)):t.add(e.prdCd)});const s=M.filter(e=>!t.has(e.prdCd));return s.length<M.length?await Je(s):(console.warn("None of the specified products were found in the cart"),{data:null,success:!1,message:"None of the specified products were found in the cart"})},addAndDeleteProductsBundleToCart:async(e,t,s)=>{if(e&&e.length>0){const{result:d,excludedNestedPrdCount:r}=ye(e,t,s),{success:o}=await Je(d);return o?(r>0&&E({type:"info",subtitle:b.A.t("createRelease:exclusionNotificationMessage",{count:r}),dismissTime:m.wN}),e.forEach(async e=>{var t;if(null!==e&&void 0!==e&&null!==(t=e.features)&&void 0!==t&&t.offersSiteSelection){const{success:t}=await we({isCalledFromRecommendation:!0,prd:e});if(!t)return{success:!1,data:null,message:"Product Operations: Product was added but Sites were not saved"}}}),{success:!0,data:null,message:""}):{success:!1,data:null,message:"Product Operations: Product could not be added"}}return{data:null,success:!1,message:"Please select a product first..."}},isPRHSelected:He,setIsPRHSelected:Ve,pressReleaseHighlights:Re,setPRHText:Ne,savePressReleaseHighlight:Be,hasOptedForOnlinePhotoHosting:se,setHasOptedForOnlinePhotoHosting:de,isCurrentProductAddedToDraft:Le,prhValidityMap:Ae,showPRHValidationErrors:Fe,selectedTradeInfos:Pe,setSelectedTradeInfos:fe,isCurrentProductIncludedAsNestedOffering:Ze,checkIsProductAddedToCart:_e,checkIsProductIncludedInCart:Qe,bundleSelectionState:ne,setBundleSelectionState:ae,selectionDisabledDueToSingleDefault:ce,productServes:Ie,showProductBundleSelectionValidationErrors:pe,selectedSites:ve,setSelectedSites:Se,prdSection:K,setPrdSection:Y,...Ge}},"B",0,E])}}]);
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.