AdsUEditorAdgroupSBLIProductChannelToggle.react",["fbt","AdsUEditorAdgroupLocalInventoryToggleAction","AdsUEditorAdgroupSBLIProductChannelToggleQuery.graphql","AdsUEditorContainer.react","CommerceManagerHooks","GeoSelector.react","GeoSelectorItem.react","ProductsSiteIdentifier.brands","adsUEditorAdgroupOmniSBLIToggleSelector","immutable","react"],(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.useEffect,n=e.useMemo,o=e.useState,p={MIN_INSTORE_ITEM_COUNT:0,MIN_INSTORE_ITEM_COVERAGE_RATE:.5},q=c("immutable").Map({ALL:{"data-testid":"omni",label:"Online and in-store",subText:"Show products available online and in nearby stores.",value:"omni"},ONLINE:{"data-testid":"online",label:"Online",subText:"Only show online products and pricing.",value:"online"},INSTORE:{"data-testid":"in_store",label:"In-store",subText:"Only show in-store products and pricing.",value:"in_store"}}).toArray(),r=i!==void 0?i:i=b("AdsUEditorAdgroupSBLIProductChannelToggleQuery.graphql");function a(a){var b,e;b=d("CommerceManagerHooks").useCommerceManagerLazyQuery(r,{productSetId:(b=a.productSetID)!=null?b:""});b=b.fetch__XFBLocalInventoryProductSetQuality;var g=(e=b==null?void 0:b.instore_item_count)!=null?e:0,i=(e=b==null?void 0:b.instore_item_coverage_rate)!=null?e:0;b=o(a.productSalesChannel);e=b[0];var j=b[1],s=l(function(a){switch(a){case"online":return!1;case"omni":return g<=p.MIN_INSTORE_ITEM_COUNT;case"in_store":return g<=p.MIN_INSTORE_ITEM_COUNT||i<=p.MIN_INSTORE_ITEM_COVERAGE_RATE;default:return!1}},[g,i]),t=l(function(b){j(b),c("AdsUEditorAdgroupLocalInventoryToggleAction").dispatch({hostID:a.hostID,adgroupIDs:a.adgroupIDs,productSalesChannel:b},{line:"114",module:"AdsUEditorAdgroupSBLIProductChannelToggle.react.js",moduleID:f.id})},[a.adgroupIDs,a.hostID]);m(function(){a.isOmniLocalInventory&&(g<=p.MIN_INSTORE_ITEM_COUNT?t("online"):i<=p.MIN_INSTORE_ITEM_COVERAGE_RATE&&a.productSalesChannel==="in_store"?t("online"):a.productSalesChannel==null&&t("online"))},[a.productSalesChannel,a.isOmniLocalInventory,g,i,t]);var u=n(function(){var b;return d("ProductsSiteIdentifier.brands").getProductFeedsUri((b=a.productCatalogID)!=null?b:"")},[a.productCatalogID]),v=n(function(){return h._(/*BTDS*/"Not enough in-store products to show. Add more products from your catalog to your local inventory feed. {helpLink}",[h._param("helpLink",k.jsx("a",{href:u.toString(),rel:"noopener noreferrer",target:"_blank",children:"View catalog"}))])},[u]);return a.isOmniLocalInventory?k.jsx(c("GeoSelector.react"),{description:h._(/*BTDS*/"Show products based on their availability in your catalog and local inventory feed."),isLabelHidden:!1,label:h._(/*BTDS*/"Available products"),value:e,onChange:t,children:q.map(function(a){return k.jsx(c("GeoSelectorItem.react"),{"data-testid":void 0,description:a.subText,disabledMessage:v,isDisabled:s(a.value),label:a.label,value:a.value},a.value)})}):null}a.displayName=a.name+" [from "+f.id+"]";e=d("AdsUEditorContainer.react").createAdgroupContainer(a,d("adsUEditorAdgroupOmniSBLIToggleSelector").OmniSBLIProductChannelToggleSelector,f.id);g.COVERAGE_THRESHOLDS=p;g.DEFAULT_TABS=q;g.OmniSBLIProductChannelToggleContainer=e}),226);
-----
AdsUEditorAdgroupSBLIProductChannelToggleQuery.graphql",[],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"productSetId"}],b=[{kind:"Variable",name:"id",variableName:"productSetId"}],c={alias:null,args:null,kind:"ScalarField",name:"instore_item_count",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"instore_item_coverage_rate",storageKey:null};return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"AdsUEditorAdgroupSBLIProductChannelToggleQuery",selections:[{alias:null,args:b,concreteType:"XFBLocalInventoryProductSetQuality",kind:"LinkedField",name:"fetch__XFBLocalInventoryProductSetQuality",plural:!1,selections:[c,d],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"AdsUEditorAdgroupSBLIProductChannelToggleQuery",selections:[{alias:null,args:b,concreteType:"XFBLocalInventoryProductSetQuality",kind:"LinkedField",name:"fetch__XFBLocalInventoryProductSetQuality",plural:!1,selections:[c,d,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}]},params:{id:"24841181042215966",metadata:{},name:"AdsUEditorAdgroupSBLIProductChannelToggleQuery",operationKind:"query",text:null}}}();e.exports=a}),null);
-----