usePartnershipAdsContentHubLinkProductMutation",["GeoToast.react","PartnershipAdsContentHubLinkProductHelpers","PartnershipAdsContentHubLinkProductModalConstants","PartnershipAdsContentHubProductLinkingUtils","ads-lib-urllib","isStringNullOrEmpty","react","react-compiler-runtime","usePartnershipAdsHubCatalogIngestionRequestMutation","usePartnershipAdsHubLogger"],(function(t,n,r,o,a,i,l){"use strict";var e,s=e||(e=o("react")),u=e,c=u.useCallback,d=u.useRef;function m(e){var t=o("react-compiler-runtime").c(17),n=e.addToast,a=e.businessID,i=e.contentID,l=e.customURL,u=e.expirationDate,c=e.onClose,m=e.removeToast,_=e.selectedCatalog,f=e.selectedProductItem,g=d(null),h=r("usePartnershipAdsHubLogger")(),y=r("usePartnershipAdsHubCatalogIngestionRequestMutation")(),C=y[0],b;t[0]!==n||t[1]!==m||t[2]!==(f==null?void 0:f.name)?(b=function(t,a){g.current!=null&&(m(g.current),g.current=null),n(s.jsx(r("GeoToast.react"),{description:t!=null?t:void 0,heading:o("PartnershipAdsContentHubProductLinkingUtils").getToastFailureHeading(a,f==null?void 0:f.name),status:"error"}),{duration:"sticky"})},t[0]=n,t[1]=m,t[2]=f==null?void 0:f.name,t[3]=b):b=t[3],f==null||f.name;var v=b,S;return t[4]!==n||t[5]!==a||t[6]!==C||t[7]!==i||t[8]!==l||t[9]!==u||t[10]!==h||t[11]!==c||t[12]!==v||t[13]!==m||t[14]!==_||t[15]!==f?(S=function(t){var e=t.action,d=t.contentId,y=t.customUrl,b=t.existingCatalogId,S=t.existingCatalogItemId,R=t.existingProductStatus,L=t.expirationDate,E=t.selectedCatalogId,k=t.selectedCatalogItemId;h.logEvent("content_tab_link_product_confirm_button_clicked",{extra_data:{action:e,existing_catalog_id:b!=null?b:"",existing_catalog_item_id:S!=null?S:"",existing_product_status:R!=null?R:"none",selected_catalog_id:E!=null?E:"",selected_catalog_item_id:k!=null?k:"",selected_custom_url:y!=null?y:"",selected_expiration_date:L!=null?L:""},ig_media_fbidv2:d!=null?d:""}),c(),g.current=n(s.jsx(r("GeoToast.react"),{hasIcon:!0,heading:o("PartnershipAdsContentHubLinkProductHelpers").getLoadingToastHeading(e),status:"indeterminate"})),!(_==null||f==null||i==null||a==null||e==null)&&C({onCompleted:function(a){var t,i,l=(t=a.xfb_handle_partnership_ads_catalog_ingestion_request)==null?void 0:t.ingestion_metadata;if((l==null?void 0:l.id)==null){v(null,e);return}if((l==null?void 0:l.num_errors)===0){g.current!=null&&(m(g.current),g.current=null),n(s.jsx(r("GeoToast.react"),{heading:o("PartnershipAdsContentHubLinkProductHelpers").getSuccessToastHeading(e),status:"success"}));return}v(l==null||(i=l.ingestion_errors)==null||(i=i.at(0))==null||(i=i.pa_hub_message)==null||(i=i.coded_exception)==null?void 0:i.description,e)},onError:function(n){return v(n.description,e)},variables:{input:{business_id:a,ingestion_groups:[{catalog_id:_==null?void 0:_.id,expiration_date:u==null?void 0:u.toInstant(o("PartnershipAdsContentHubLinkProductModalConstants").TIMEZONE_ID),ig_media_id:i,mutation_action:e,product_item_id:f==null?void 0:f.id,url:r("isStringNullOrEmpty")(l)?null:r("ads-lib-urllib").normalize(l)}]}}}).catch(p)},t[4]=n,t[5]=a,t[6]=C,t[7]=i,t[8]=l,t[9]=u,t[10]=h,t[11]=c,t[12]=v,t[13]=m,t[14]=_,t[15]=f,t[16]=S):S=t[16],S}function p(){}l.default=m}),98);
-----
PartnershipAdsContentHubBulkEditProductItemsModal.react",["fbt","GeoButton.react","GeoModal.react","GeoModalFooter.react","GeoModalHeader.react","GeoSection.react","GeoToast.react","PartnershipAdsContentHubBulkEditProductItemsModalQuery.graphql","PartnershipAdsContentHubBulkEditProductItemsTable.react","PartnershipAdsContentHubConstants","PartnershipAdsContentHubProductLinkingUtils","RelayHooks","isFalsey","isTruthy","react","useGeoToaster","usePartnershipAdsHubBusinessIDEnforce","usePartnershipAdsHubCatalogIngestionRequestMutation","usePartnershipAdsHubLogger"],(function(t,n,r,o,a,i,l,s){"use strict";var e,u,c=u||(u=o("react")),d=u,m=d.useCallback,p=d.useEffect,_=d.useMemo,f=d.useState,g=730,h=1400,y=e!==void 0?e:e=n("PartnershipAdsContentHubBulkEditProductItemsModalQuery.graphql"),C=function(t){return s._(/*BTDS*/"_j{"*":"Linking {number} products","_1":"Linking 1 product"}",[s._plural(t,"number")])},b=s._(/*BTDS*/"Product linked to content"),v=s._(/*BTDS*/"This content will now appear in Commerce Manager."),S=s._(/*BTDS*/"Something went wrong");function R(e){var t,n=e.props,a=n.clearSelectedContent,i=n.onHide,l=e.queries.PartnershipAdsContentHubBulkEditProductItemsModalQueryReference,u=o("RelayHooks").usePreloadedQuery(y,l),d=(t=u.business)==null?void 0:t.partnership_ads_hub_selected_content_items_details,R=d==null?void 0:d.length,L=m(function(){i("layerCancelButton")},[i]),E=f(function(){return{height:Math.min(window.innerHeight-40,g),width:Math.min(window.innerWidth,h)}}),k=E[0],I=E[1];p(function(){var e=function(){I({height:Math.min(window.innerHeight-40,g),width:Math.min(window.innerWidth,h)})};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[]);var T=r("usePartnershipAdsHubBusinessIDEnforce")(),D=r("usePartnershipAdsHubCatalogIngestionRequestMutation")(),x=D[0],$=r("useGeoToaster")(),P=$.add,N=_(function(){return d!=null?d:[]},[d]),M=_(function(){var e={};return N.forEach(function(t){var n=t==null?void 0:t.content_id;if(r("isTruthy")(n)){var o,a,i,l;e[n]={catalog_id:(o=t==null||(a=t.product_info)==null||(a=a.product_catalog)==null?void 0:a.id)!=null?o:"",expiration_date:null,ig_media_id:n,mutation_action:"LINK",product_item_id:(i=t==null||(l=t.product_info)==null||(l=l.dynamic_item)==null?void 0:l.id)!=null?i:"",url:null}}}),e},[N]),w=f(M),A=w[0],F=w[1],O=f(function(){var e={},t=d!=null?d:[];return t.forEach(function(t){var n=t==null?void 0:t.content_id;if(r("isTruthy")(n)){var o,a,i=t==null||(o=t.product_info)==null?void 0:o.product_catalog;e[n]={catalog:!(i!=null&&i.catalog_user_actions.includes("EDIT_PRODUCT_CATALOG")),product:r("isFalsey")(t==null||(a=t.product_info)==null||(a=a.dynamic_item)==null?void 0:a.id),url:!1}}}),e}),B=O[0],W=O[1],q=Object.values(B).some(function(e){return e.catalog||e.url||e.product}),U=f(!1),V=U[0],H=U[1],G=m(function(e){P(c.jsx(r("GeoToast.react"),{description:e!=null?e:void 0,heading:S,status:"error"})),H(!1)},[P]),z=r("usePartnershipAdsHubLogger")(),j=m(function(){var e;H(!0),z.logEvent("content_tab_bulk_link_product_confirm_button_clicked",{extra_data:{content_items_count:(e=R==null?void 0:R.toString())!=null?e:""}}),Object.values(A).forEach(function(e,t){var n,r,o,a,i,l,s,u,c,d;z.logEvent("content_tab_bulk_link_product_individual_ingestion_group_details",{extra_data:{action:e.mutation_action,catalog_id:(n=e.catalog_id)!=null?n:"",catalog_item_id:(r=e.product_item_id)!=null?r:"",expiration_date:(o=(a=e.expiration_date)==null?void 0:a.toString())!=null?o:"",initial_catalog_id:N.length>t&&(i=(l=N[t].product_info)==null||(l=l.product_catalog)==null?void 0:l.id)!=null?i:"",initial_catalog_item_id:N.length>t&&(s=(u=N[t].product_info)==null||(u=u.dynamic_item)==null?void 0:u.id)!=null?s:"",url:(c=e.url)!=null?c:""},ig_media_fbidv2:(d=e.ig_media_id)!=null?d:""})}),x({onCompleted:function(t){var e;L(),H(!1),a();var n=(e=t.xfb_handle_partnership_ads_catalog_ingestion_request)==null?void 0:e.ingestion_metadata;if((n==null?void 0:n.request_status)==="COMPLETED"){if((n==null?void 0:n.num_errors)===0)P(c.jsx(r("GeoToast.react"),{description:v,heading:b,status:"success"}));else{var o;G(n==null||(o=n.ingestion_errors)==null||(o=o.at(0))==null||(o=o.pa_hub_message)==null||(o=o.coded_exception)==null?void 0:o.description)}return}(n==null?void 0:n.id)!=null?P(c.jsx(r("GeoToast.react"),{heading:C(R!=null?R:0),status:"indeterminate"})):G()},onError:function(t){return G(t.description)},variables:{input:{business_id:T,ingestion_groups:Object.values(A)}}}).catch(function(){})},[P,T,a,x,R,A,N,z,L,G]);return c.jsx(r("GeoModal.react"),{footer:c.jsx(r("GeoModalFooter.react"),{primaryButton:c.jsx(r("GeoButton.react"),{isDisabled:q||V,isLoading:V,label:o("PartnershipAdsContentHubConstants").BULK_PRODUCT_LINKING_MODAL_SAVE_BUTTON_TEXT,onClick:j,tooltip:q?s._(/*BTDS*/"Resolve issues to save and accept product suggestions."):null,variant:"primary"}),secondaryButton:c.jsx(r("GeoButton.react"),{label:s._(/*BTDS*/"Cancel"),onClick:L})}),header:c.jsx(r("GeoModalHeader.react"),{heading:o("PartnershipAdsContentHubProductLinkingUtils").getBulkProductLinkingModalHeaderText(R)}),height:k.height,onHide:i,width:k.width,children:c.jsx(r("GeoSection.react"),{children:c.jsx(r("PartnershipAdsContentHubBulkEditProductItemsTable.react"),{contentList:d!=null?d:[],ingestionGroups:A,setHasErrors:W,setIngestionGroups:F})})})}R.displayName=R.name+" [from "+i.id+"]",l.default=R}),226);
-----
PartnershipAdsContentHubLinkProductModal.react",["fbt","CometImage.react","GeoButton.react","GeoFlexbox.react","GeoMediaItem.react","GeoModal.react","GeoModalFooter.react","GeoModalHeader.react","GeoSection.react","GeoToast.react","GeoVStack.react","LocalDate","PACatalogIngestionMutationActionUtils.facebook","PartnershipAdsContentHubImagePreview.react","PartnershipAdsContentHubLinkProductModalCatalogSearchSelector.react","PartnershipAdsContentHubLinkProductModalCustomURLSelector.react","PartnershipAdsContentHubLinkProductModalExpirationDateSelector.react","PartnershipAdsContentHubLinkProductModalIssuesBanner.react","PartnershipAdsContentHubLinkProductModalQuery.graphql","PartnershipAdsHubLinkProductModalProductSearchSelectorWithNullState.react","PartnershipAdsHubProductItemStatusUtils.facebook","RelayHooks","Timezone","ads-lib-urllib","isStringNullOrEmpty","react","useGeoTheme","useGeoToaster","usePartnershipAdsHubBusinessIDEnforce","usePartnershipAdsHubCatalogIngestionRequestMutation"],(function(a,b,c,d,e,f,g,h){"use strict";var i,j,k=j||(j=d("react"));e=j;var l=e.useCallback,m=e.useMemo,n=e.useRef,o=e.useState,p={line:{height:"xqtp20y",width:"x1fu8urw",$$css:!0},modal:{minHeight:"x712feu",$$css:!0},modalContent:{minHeight:"xtoy680",$$css:!0},modalImageArea:{height:"x1nbnut7",$$css:!0}},q=h._(/*BTDS*/""),r=h._(/*BTDS*/""),s=h._(/*BTDS*/""),t=h._(/*BTDS*/""),u=h._(/*BTDS*/""),v=h._(/*BTDS*/""),w=h._(/*BTDS*/""),x=h._(/*BTDS*/""),y=h._(/*BTDS*/""),z=h._(/*BTDS*/""),A=h._(/*BTDS*/""),B=h._(/*BTDS*/""),C=h._(/*BTDS*/""),D=d("Timezone").getEnvironmentTimezoneID(),aa=i!==void 0?i:i=b("PartnershipAdsContentHubLinkProductModalQuery.graphql");function a(a){var b,e,f,g,i=a.props.onHide;a=a.queries.PartnershipAdsContentHubLinkProductModalQueryReference;a=d("RelayHooks").usePreloadedQuery(aa,a);b=(b=a.business)==null||(b=b.partnership_ads_hub_content_details)==null?void 0:b.thumbnail;var j=(e=a.business)==null||(e=e.partnership_ads_hub_content_details)==null?void 0:e.content_id;e=(e=a.business)==null||(e=e.partnership_ads_hub_content_details)==null||(e=e.issues_info)==null?void 0:e.issues_status;a=(a=a==null||(f=a.business)==null||(f=f.partnership_ads_hub_content_details)==null?void 0:f.product_info)!=null?a:{};var E=a.dynamic_item,F=a.product_catalog,G=a.product_override_expiration_date,H=a.product_override_link;a=a.product_status;var I=G!=null?c("LocalDate").fromTimestampInMilliseconds(new Date(G).getTime(),d("Timezone").UTC):null,J=(G=d("PartnershipAdsHubProductItemStatusUtils.facebook").toJSEnum(a))!=null?G:"none",K=c("usePartnershipAdsHubBusinessIDEnforce")(),L=n(null);a=c("useGeoToaster")();var M=a.add,N=a.remove;a=o(F==null?null:{doesViewerHaveEditAccess:F==null?void 0:F.catalog_user_actions.includes("EDIT_PRODUCT_CATALOG"),id:(G=F==null?void 0:F.id)!=null?G:"",name:F==null?void 0:F.name});var O=a[0];G=a[1];a=o(E==null?null:{id:(a=E==null?void 0:E.id)!=null?a:"",imageSrc:E==null||(g=E.dynamic_item_main_image)==null||(g=g.image)==null?void 0:g.uri,name:E==null?void 0:E.dynamic_item_name,retailerID:E==null?void 0:E.dynamic_item_retailer_id});var P=a[0];a=a[1];var Q=o(I),R=Q[0];Q=Q[1];var S=o(H),T=S[0];S=S[1];var U=c("useGeoTheme")(),ba=U.selectBorderColor,ca=U.selectBorderRadius,da=U.selectBorderWidth;U=U.selectStaticBackgroundColor;var V=c("usePartnershipAdsHubCatalogIngestionRequestMutation")(),W=V[0],X=l(function(){i("layerCancelButton")},[i]),Y=l(function(a){L.current!=null&&(N(L.current),L.current=null),M(k.jsx(c("GeoToast.react"),{description:a!=null?a:void 0,heading:C,status:"error"}))},[M,N,L]),Z=l(function(a){X();L.current=M(k.jsx(c("GeoToast.react"),{hasIcon:!0,heading:a==="unlink"?A:a==="edit"?B:z,status:"indeterminate"}),{duration:"sticky"});var b=d("PACatalogIngestionMutationActionUtils.facebook").fromJSEnum(a);if(O==null||P==null||j==null||b==null)return;W({onCompleted:function(b){var d;b=(b=b.xfb_handle_partnership_ads_catalog_ingestion_request)==null?void 0:b.ingestion_metadata;if((b==null?void 0:b.id)==null){Y(null);return}if((b==null?void 0:b.num_errors)===0){L.current!=null&&(N(L.current),L.current=null);M(k.jsx(c("GeoToast.react"),{heading:a==="unlink"?x:a==="edit"?y:w,status:"success"}));return}Y(b==null||(d=b.ingestion_errors)==null||(d=d.at(0))==null||(d=d.pa_hub_message)==null||(d=d.coded_exception)==null?void 0:d.description)},onError:function(a){return Y(a.description)},variables:{input:{business_id:K,ingestion_groups:[{catalog_id:O==null?void 0:O.id,expiration_date:R==null?void 0:R.toInstant(D),ig_media_id:j,mutation_action:b,product_item_id:P==null?void 0:P.id,url:c("isStringNullOrEmpty")(T)?null:c("ads-lib-urllib").normalize(T)}]}}})["catch"](function(){})},[M,K,W,j,T,N,R,X,Y,O,P,L]);V=m(function(){switch(J){case"linked":return r;case"suggested":return q;default:return s}},[J]);var ea=m(function(){switch(J){case"suggested":return k.jsx(c("GeoButton.react"),{label:h._(/*BTDS*/""),onClick:function(){return Z("reject")}});default:return k.jsx(c("GeoButton.react"),{label:h._(/*BTDS*/""),onClick:X})}},[J,Z,X]),fa=m(function(){switch(J){case"suggested":return t;case"linked":return v;default:return u}},[J]),$=m(function(){return O==null||P==null||(O==null?void 0:O.id)===(F==null?void 0:F.id)&&(P==null?void 0:P.id)===(E==null?void 0:E.id)&&(R==null?void 0:R.toString())===(I==null?void 0:I.toString())&&T===H&&J==="linked"},[T,I,H,F==null?void 0:F.id,E==null?void 0:E.id,J,R,O,P]);return k.jsx(c("GeoModal.react"),{footer:k.jsx(c("GeoModalFooter.react"),{primaryButton:k.jsx(c("GeoButton.react"),{isDisabled:$,label:fa,onClick:function(){return Z(J==="linked"?"edit":"link")},variant:"primary"}),secondaryButton:ea,startContent:J==="linked"&&k.jsx(c("GeoButton.react"),{label:h._(/*BTDS*/""),onClick:function(){return Z("unlink")}})}),header:k.jsx(c("GeoModalHeader.react"),{heading:V}),onHide:i,width:600,xstyle:p.modal,children:k.jsx(c("GeoSection.react"),{xstyle:p.modalContent,children:k.jsxs(c("GeoVStack.react"),{context:"content",relation:"section",children:[["ACCOUNT_ERROR","CONTENT_ERROR","MULTIPLE_ERRORS"].includes(e)&&k.jsx(c("PartnershipAdsContentHubLinkProductModalIssuesBanner.react"),{contentID:j,onModalClose:X}),k.jsxs(c("GeoFlexbox.react"),{alignItems:"center",justifyContent:"center",xstyle:[p.modalImageArea,U({surface:"wash"}),ca({context:"content"})],children:[k.jsx(c("PartnershipAdsContentHubImagePreview.react"),{imageSize:96,imageURI:b,isRecommended:!1}),P!=null&&k.jsxs(c("GeoFlexbox.react"),{alignItems:"center",justifyContent:"center",children:[k.jsx(c("GeoFlexbox.react"),{xstyle:[p.line,ba({color:"divider"}),da({context:"divider"})]}),k.jsx(c("GeoFlexbox.react"),{children:k.jsx(c("GeoMediaItem.react"),{fit:"cover",media:k.jsx(c("CometImage.react"),{src:($=P==null?void 0:P.imageSrc)!=null?$:""}),size:64})})]})]}),k.jsx(c("PartnershipAdsContentHubLinkProductModalCatalogSearchSelector.react"),{selectedCatalog:O,setSelectedCatalog:G,setSelectedProductItem:a}),k.jsx(c("PartnershipAdsHubLinkProductModalProductSearchSelectorWithNullState.react"),{selectedCatalogID:O==null?void 0:O.id,selectedProductItem:P,setSelectedProductItem:a}),k.jsxs(c("GeoFlexbox.react"),{direction:"column",rowGap:4,children:[k.jsx(c("PartnershipAdsContentHubLinkProductModalExpirationDateSelector.react"),{expirationDate:R,setExpirationDate:Q}),k.jsx(c("PartnershipAdsContentHubLinkProductModalCustomURLSelector.react"),{customURL:T,setCustomURL:S})]})]})})})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),226);
-----
usePartnershipAdsHubCatalogIngestionRequestMutation",["RelayHooks","asyncToGeneratorRuntime","react","react-compiler-runtime","usePartnershipAdsHubCatalogIngestionRequestMutation.graphql"],(function(a,b,c,d,e,f,g){"use strict";var h,i;(i||d("react")).useCallback;var j=h!==void 0?h:h=b("usePartnershipAdsHubCatalogIngestionRequestMutation.graphql");function a(){var a=d("react-compiler-runtime").c(5),c=d("RelayHooks").useMutation(j),e=c[0];c=c[1];var f;a[0]!==e?(f=function(){var a=b("asyncToGeneratorRuntime").asyncToGenerator(function*(a){yield e(babelHelpers["extends"]({},a))});return function(b){return a.apply(this,arguments)}}(),a[0]=e,a[1]=f):f=a[1];f=f;var g;a[2]!==f||a[3]!==c?(g=[f,c],a[2]=f,a[3]=c,a[4]=g):g=a[4];return g}g["default"]=a}),98);
-----
usePartnershipAdsHubCatalogIngestionRequestMutation.graphql",["usePartnershipAdsHubCatalogIngestionRequestMutation_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"input"}],c=[{alias:null,args:[{kind:"Variable",name:"data",variableName:"input"}],concreteType:"XFBHandlePartnershipAdsCatalogIngestionRequestResponsePayload",kind:"LinkedField",name:"xfb_handle_partnership_ads_catalog_ingestion_request",plural:!1,selections:[{alias:null,args:null,concreteType:"XFBPartnershipAdsCatalogIngestionMetadata",kind:"LinkedField",name:"ingestion_metadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"num_errors",storageKey:null},{alias:null,args:null,concreteType:"XFBPartnershipAdsCatalogIngestionError",kind:"LinkedField",name:"ingestion_errors",plural:!0,selections:[{alias:null,args:null,concreteType:"XFBPartnershipAdsHubContentManagementMessage",kind:"LinkedField",name:"pa_hub_message",plural:!1,selections:[{alias:null,args:null,concreteType:"Error",kind:"LinkedField",name:"coded_exception",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"summary",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"usePartnershipAdsHubCatalogIngestionRequestMutation",selections:c,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"usePartnershipAdsHubCatalogIngestionRequestMutation",selections:c},params:{id:b("usePartnershipAdsHubCatalogIngestionRequestMutation_facebookRelayOperation"),metadata:{},name:"usePartnershipAdsHubCatalogIngestionRequestMutation",operationKind:"mutation",text:null}}}();e.exports=a}),null);
-----
usePartnershipAdsHubCatalogIngestionRequestMutation_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="24066616129707874"}),null);
-----