"use strict";(globalThis.webpackChunkgoogle_listings_and_ads=globalThis.webpackChunkgoogle_listings_and_ads||[]).push([[844],{521:(e,a,i)=>{i.d(a,{A:()=>c});var s=i(7143),t=i(6520),n=i(7692),r=i(2775);const l="products",o={products:[],intervals:[],totals:{}};function c(e){const a=(0,r.A)();return(0,s.useSelect)(i=>{const{getReport:s}=i(t.Ui),r=s(l,e,a,"primary"),c=s(l,e,a,"secondary"),d=r.loaded&&c.loaded;let g=o;return d&&r.data&&c.data&&(g={products:r.data.products||o.products,intervals:r.data.intervals||o.intervals,totals:(0,n.bM)(r.data.totals,c.data.totals,r.reportQuery.fields)}),{data:g,loaded:d}},[e,a])}},3547:(e,a,i)=>{i.r(a),i.d(a,{default:()=>Ae});var s=i(7723),t=i(6087),n=i(6427),r=i(3905),l=i(4932),o=i(3741),c=i(7143),d=i(1233),g=i(8493),p=i(7892),u=i(6361),_=i(5995),h=i(4848);const m="price-benchmark-banner-dismissed",b=()=>{const{set:e}=(0,c.useDispatch)(d.store);return(0,u.A)(m)?null:(0,h.jsx)(n.Card,{size:"large",className:"gla-price-benchmark-suggestions-banner",children:(0,h.jsxs)(n.CardBody,{className:"gla-price-benchmark-suggestions-banner__body",children:[(0,h.jsx)("div",{className:"gla-price-benchmark-suggestions-banner__graphic",children:(0,h.jsx)("img",{src:_,alt:"",width:164})}),(0,h.jsxs)("div",{className:"gla-price-benchmark-suggestions-banner__text",children:[(0,h.jsx)(g.A,{children:(0,s.__)("New","google-listings-and-ads")}),(0,h.jsx)("h3",{children:(0,s.__)("Price Benchmark & Suggestions","google-listings-and-ads")})]}),(0,h.jsxs)("div",{className:"gla-price-benchmark-suggestions-banner__footer",children:[(0,h.jsx)("p",{children:(0,t.createInterpolateElement)((0,s.__)("This report includes a competitive pricing analysis, price recommendations, and insights like Effectiveness to help you identify opportunities, compare against competitors, and accelerate your sales growth.","google-listings-and-ads"),{strong:(0,h.jsx)("strong",{})})}),(0,h.jsx)(p.A,{variant:"secondary",onClick:()=>{e(r.Z7,m,!0)},children:(0,s.__)("Dismiss","google-listings-and-ads")})]})]})})};var f=i(2635),x=i(9927),v=i(8468),j=i(6873),y=i(6473),k=i(1177),E=i(9982);const N=()=>(0,h.jsxs)("div",{className:"gla-price-benchmark__empty-metrics",children:[(0,h.jsx)("div",{className:"gla-price-benchmark__empty-metrics-graphic",children:(0,h.jsx)("img",{src:E,alt:(0,s.__)("No sale price suggestions graphic","google-listings-and-ads"),width:88,height:88})}),(0,h.jsxs)("div",{className:"gla-price-benchmark__empty-metrics-description",children:[(0,h.jsx)("p",{children:(0,s.__)("You do not have any sale price suggestions at this moment.","google-listings-and-ads")}),(0,h.jsx)("p",{children:(0,t.createInterpolateElement)((0,s.__)("Find out if you meet all eligibility criteria to receive suggestions in the future.","google-listings-and-ads"),{a:(0,h.jsx)(k.A,{className:"gla-empty-metrics-notice__link",href:"https://support.google.com/merchants/answer/13798101",context:"price-benchmark-empty-metrics-notice",linkId:"empty-metric-notice-find-out-link"})})})]})]});var C=i(4327),A=i(2434);const P="price-benchmark-suggestions",w="price-benchmark-change-price-modal",S="LABEL_CHANGE_EFFECTIVENESS",I="LABEL_AVG_PRICE_ON_GOOGLE",L="LABEL_PRICE_GAP_PERCENT",T="LABEL_SUGGESTED_PRICE",R="LABEL_REGULAR_PRICE",G="LABEL_ACTION",K="LABEL_CURRENT_CLICKS",F="LABEL_CURRENT_CONVERSIONS",D="LABEL_SALES_PRICE",M="LABEL_EXPECTED_UPLIFT_IN_CLICKS",V="LABEL_EXPECTED_UPLIFT_IN_CONVERSIONS",H=0,O=1,U=2,B=3,q="METRIC_TYPE_EFFECTIVENESS",Y="METRIC_TYPE_PRICE",$="METRIC_TYPE_PERCENTAGE",z="METRIC_TYPE_DELTA",Q={[S]:{title:(0,s.__)("Change Effectiveness","google-listings-and-ads"),tooltip:(0,s.__)("Effectiveness tells you which products would benefit most from price changes. This rating takes into consideration the performance boost predicted by adjusting the sale price and the difference between your current price and the suggested price. Price suggestions with “High” effectiveness are predicted to drive the largest increase in performance. Keep in mind that predictions do not guarantee improvements in future performance.","google-listings-and-ads")},[I]:{title:(0,s.__)("Avg. Price on Google","google-listings-and-ads"),tooltip:(0,s.__)("The effective price for a product across all retailers selling the same product weighted by customer clicks. Products are matched based on the GTIN you provide in the product details.","google-listings-and-ads")},[L]:{title:(0,s.__)("Price Gap %","google-listings-and-ads"),tooltip:(0,s.__)("The percentage difference between your price and the price on Google for this product.","google-listings-and-ads")},[T]:{title:(0,s.__)("Suggested Price","google-listings-and-ads"),tooltip:(0,s.__)("Suggested sale price predicted by Google for products that benefit most from pricing adjustments. It is based on advanced simulations at different price points over the past 7 days factoring in price elasticity, current performance and the performance impact on price changes for businesses similar to you. Use suggested sale prices as valuable directional guidance to help shape your pricing strategy. Learn more about how to change the sale price of your products. Keep in mind that predictions do not guarantee future performance outcomes.","google-listings-and-ads")},[R]:{title:(0,s.__)("Regular Price","google-listings-and-ads")},[G]:{title:(0,s.__)("Action","google-listings-and-ads")},[K]:{title:(0,s.__)("Current Clicks","google-listings-and-ads"),tooltip:(0,s.__)("The number of clicks your product received in the last 7 days.","google-listings-and-ads")},[F]:{title:(0,s.__)("Current Conversions","google-listings-and-ads"),tooltip:(0,s.__)("The number of conversions your product received in the last 7 days.","google-listings-and-ads")},[M]:{title:(0,s.__)("Exp. Uplift in Clicks","google-listings-and-ads"),tooltip:(0,s.__)("Click uplift shows the predicted percentage increase of clicks from your Shopping ads if the suggested price is applied. Predictions are generated by advanced pricing simulations based on performance data over the past 7 days. It's important to keep in mind that these predictions do not guarantee future performance outcomes, as actual performance can be influenced by factors other than price.","google-listings-and-ads")},[V]:{title:(0,s.__)("Exp. Uplift in Conv.","google-listings-and-ads"),tooltip:(0,s.__)("Conversion uplift shows the predicted percentage increase in online conversions from Shopping ads for your product if the suggested sale price is applied. Predictions are generated by advanced pricing simulations based on performance data over the past 7 days. It's important to keep in mind that predictions do not guarantee future performance outcomes.","google-listings-and-ads")},[D]:{title:(0,s.__)("Sales Price","google-listings-and-ads")}};var W=i(3832),X=i(6942),Z=i.n(X),J=i(1244),ee=i(7419);const ae=({amount:e,highlight:a=!1})=>{const{formatAmount:i}=(0,ee.A)(),s=isNaN(e)?0:e;return(0,h.jsx)("span",{className:Z()("gla-price-benchmark-table__price",{"gla-price-benchmark-table__price--highlight":a}),children:i(s)})};var ie=i(9039);const se=({labelKey:e,alignLeft:a=!1})=>{if(!Q[e])return null;const{title:i,tooltip:s}=Q[e];return(0,h.jsxs)("span",{className:Z()("gla-price-benchmark__label",{"gla-price-benchmark__label--align-left":a}),children:[!s&&i,s&&(0,h.jsx)(ie.A,{text:s,className:"gla-price-benchmark__tooltip",children:i})]})},te={[H]:{intent:"default",label:(0,s.__)("Unspecified","google-listings-and-ads")},[O]:{intent:"error",label:(0,s.__)("Low","google-listings-and-ads")},[U]:{intent:"warning",label:(0,s.__)("Medium","google-listings-and-ads")},[B]:{intent:"success",label:(0,s.__)("High","google-listings-and-ads")}},ne=({effectiveness:e})=>te[e]?(0,h.jsx)(g.A,{intent:te[e].intent,children:te[e].label}):null,re=({labelKey:e,value:a,type:i,className:s})=>{if(null==a||""===a)return null;if(i===Y&&isNaN(a))return null;let t=a;switch(i){case Y:t=(0,h.jsx)(ae,{amount:a});break;case z:t=(0,h.jsx)(J.A,{amount:100*a,suffix:"%"});break;case q:t=(0,h.jsx)(ne,{effectiveness:a});break;case $:t=`${parseInt(a,10)}%`}return(0,h.jsxs)("div",{className:Z()("gla-change-price-modal__metric-value",s),children:[(0,h.jsx)("div",{className:"gla-change-price-modal__metric-value-title",children:(0,h.jsx)(se,{labelKey:e})}),(0,h.jsx)("div",{className:"gla-change-price-modal__metric-value-value",children:t})]})};var le=i(9457),oe=i(2848),ce=i(314),de=i(5588),ge=i(1378);const pe=({productId:e,productPrice:a,suggestedPrice:i,onPriceChange:n,productDetails:r})=>{const{formatAmount:l}=(0,ee.A)(),[o,d]=(0,t.useState)(),[g,u]=(0,t.useState)(!1),[_,m]=(0,t.useState)(0),{googleAdsAccount:b}=(0,ge.A)(),{updateProduct:f}=(0,c.useDispatch)(ce.PRODUCTS_STORE_NAME),{updateProductVariation:x}=(0,c.useDispatch)(ce.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME),{global_unique_id:v,on_sale:j,sale_price:k,type:E,parent_id:N}=r;(0,t.useEffect)(()=>{m(i)},[i]);const C=(0,t.useCallback)(()=>{const e=Number.parseFloat(_),a=Number.parseFloat(k);return!isNaN(a)&&a&&e<=a&&j?(0,s.sprintf)(
// Translators: %s is replaced with the sales price.
// Translators: %s is replaced with the sales price.
(0,s.__)("New price must be greater than the sales price (%s).","google-listings-and-ads"),l(a)):e<0?(0,s.__)("New price must be greater than or equals to zero.","google-listings-and-ads"):null},[_,k,l,j]),A=(0,t.useCallback)(()=>{const e=C();return d(e),null===e},[C]),P=(0,t.useCallback)(async()=>{if(A()){u(!0);try{const s={regular_price:`${_}`};"variation"===E&&N?await x({product_id:N,id:e},s):await f(e,s),(0,y.ce)("gla_price_benchmarks_change_price_edited",{context:w,product_id:e,previous_price:a,recommended_price:i,changed_price:_,currency:b?.currency,gtin:v})}catch(e){return d(e?.message),void u(!1)}u(!1),n(e,_)}},[_,e,n,f,A,b,a,i,v,N,E,x]);(0,t.useEffect)(()=>{A()},[_,A]);const S=C();return(0,h.jsxs)("div",{className:"gla-change-price-modal-price-input-footer",children:[(0,h.jsx)(de.A,{label:(0,s.__)("New price","google-listings-and-ads"),suffix:b?.currency,value:_,onChange:m,className:Z()("gla-change-price-modal-price-input-footer__price",{"gla-change-price-modal-price-input-footer__price--error":o}),help:o}),(0,h.jsx)(p.A,{isPrimary:!0,onClick:P,disabled:null!==S,loading:g,children:(0,s.__)("Change Price","google-listings-and-ads")})]})};var ue=i(77),_e=i(1968);const he=({productId:e,onRequestClose:a,onPriceChange:i})=>{const r=(0,_e.A)(),{product:l,hasFinishedResolution:c}=(0,ue.A)(e),{data:d,hasFinishedResolution:g}=(0,C.A)({product_id:e});(0,t.useEffect)(()=>{(0,y.ce)("gla_modal_open",{context:w,product_id:e})},[e]);const u=(0,t.useCallback)(()=>{(0,y.ce)("gla_modal_closed",{context:w,product_id:e,action:"close"}),a()},[a,e]),_={title:(0,s.__)("Change Price","google-listings-and-ads"),onRequestClose:u,className:"gla-change-price-modal"};if(!c||!g)return(0,h.jsx)(le.A,{..._,children:(0,h.jsx)(o.A,{})});if((!l||!d)&&c)return(0,h.jsx)(le.A,{..._,buttons:[(0,h.jsx)(p.A,{isPrimary:!0,onClick:a,children:(0,s.__)("Close","google-listings-and-ads")},"close")],children:(0,h.jsx)("p",{children:(0,s.__)("Product not found. ","google-listings-and-ads")})});const{effectiveness:m,product_price:b,benchmark_price:f,price_gap:x,suggested_price:v,clicks:j,conversions:k,predicted_clicks_change:E,predicted_conversions_change:N,product:{id:A,title:P,thumbnail:G}}=d,{type:H,parent_id:O,sale_price:U,on_sale:B}=l,Q=Number.parseFloat(U),X=(0,W.addQueryArgs)(`${r}post.php`,{post:"variation"===H&&O?O:e,action:"edit"});return(0,h.jsx)(le.A,{..._,buttons:[(0,h.jsx)(pe,{onPriceChange:i,productId:A,suggestedPrice:v,productPrice:b,productDetails:l},"price-input-footer")],children:(0,h.jsxs)("div",{className:"gla-change-price-modal__content",children:[(0,h.jsxs)("div",{className:"gla-change-price-modal__product",children:[G&&(0,h.jsx)("div",{className:"gla-change-price-modal__product-image",children:(0,h.jsx)("img",{src:G,alt:(0,s.__)("Product thumbnail","google-listings-and-ads"),width:"156"})}),(0,h.jsxs)("div",{className:"gla-change-price-modal__product-details",children:[(0,h.jsx)("p",{children:(0,h.jsx)("span",{children:A})}),(0,h.jsx)("p",{className:"gla-change-price-modal__product-title",children:P})]})]}),(0,h.jsx)("div",{className:"gla-change-price-modal__metrics",children:(0,h.jsxs)("div",{className:"gla-change-price-modal__metrics-grid",children:[(0,h.jsx)(re,{labelKey:S,value:m,type:q}),(0,h.jsx)(re,{labelKey:L,value:x,type:$}),(0,h.jsx)("hr",{className:"gla-change-price-modal__separator"}),(0,h.jsx)(re,{labelKey:R,value:b,type:Y}),(0,h.jsx)(re,{labelKey:I,value:f,type:Y}),B&&(0,h.jsx)(re,{labelKey:D,value:Q,type:Y,className:"gla-change-price-modal__sales-price"}),(0,h.jsx)(re,{labelKey:T,value:v,type:Y}),(0,h.jsx)("hr",{className:"gla-change-price-modal__separator"}),(0,h.jsx)(re,{labelKey:K,value:j}),(0,h.jsx)(re,{labelKey:F,value:k}),(0,h.jsx)(re,{labelKey:M,value:E,type:z}),(0,h.jsx)(re,{labelKey:V,value:N,type:z}),(0,h.jsx)("hr",{className:"gla-change-price-modal__separator"}),B&&(0,h.jsx)(n.Notice,{status:"warning",isDismissible:!1,children:(0,t.createInterpolateElement)((0,s.__)("This product is currently on sale. To change the sale price, go to the Edit Product page in WooCommerce.","google-listings-and-ads"),{link:(0,h.jsx)(oe.A,{type:"wp-admin",href:X,eventName:"gla_price_benchmark_edit_product_link_click",eventProps:{context:w}})})})]})})]})})},me=({productId:e})=>{const{receivePriceBenchmarkSuggestionsProductPrice:a}=(0,A.j)(),[i,n]=(0,t.useState)(!1),r=()=>{n(!1)},l=(0,t.useCallback)((e,i)=>{a(e,i),(0,y.ce)("gla_modal_closed",{context:w,action:"change-price"}),r()},[a]);return e?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(p.A,{onClick:()=>{n(!0)},variant:"tertiary",size:"compact",eventName:"gla_price_benchmarks_change_price_clicked",eventProps:{context:P,product_id:e},children:(0,s.__)("Change price","google-listings-and-ads")}),i&&(0,h.jsx)(he,{productId:e,onPriceChange:l,onRequestClose:r})]}):null},be="https://woocommerce.com/document/google-for-woocommerce/faq/",fe=()=>(0,h.jsx)(n.ExternalLink,{onClick:()=>{(0,y.ce)("gla_documentation_link_click",{context:"price-benchmark-suggestions",link_id:"price-benchmark-suggestions-faq",href:be})},href:be,className:"gla-price-benchmark-suggestions__faq",children:(0,s.__)("FAQ","google-listings-and-ads")}),xe=[{id:"image",enableHiding:!1,enableSorting:!1,enableGlobalSearch:!1,label:(0,s.__)("Image","google-listings-and-ads"),getValue:({item:e})=>e?.product?.thumbnail||null,render:({item:e})=>e?.product?.thumbnail?(0,h.jsx)("img",{src:e.product.thumbnail,alt:e.product.title,className:"gla-price-benchmark-suggestions__image"}):null},{id:"id",enableHiding:!1,enableSorting:!0,enableGlobalSearch:!0,label:(0,s.__)("Product","google-listings-and-ads"),getValue:({item:e})=>e.product.id,render:({item:e})=>e?.product?.title?e.product.title:null},{id:"description",enableHiding:!1,enableSorting:!1,enableGlobalSearch:!0,label:(0,s.__)("Description","google-listings-and-ads"),getValue:({item:e})=>String(e?.product?.id||"")}],ve=[{id:"effectiveness",enableHiding:!1,enableSorting:!0,enableGlobalSearch:!1,header:(0,h.jsx)(se,{labelKey:S,alignLeft:!0}),label:Q[S].title,render:({item:e})=>void 0===e.effectiveness?null:(0,h.jsx)(ne,{effectiveness:e.effectiveness})},{id:"product_price",enableHiding:!1,enableSorting:!0,enableGlobalSearch:!1,label:Q[R].title,render:({item:e})=>(0,h.jsx)(ae,{amount:e.product_price,highlight:!0})},{id:"benchmark_price",enableHiding:!1,enableSorting:!0,enableGlobalSearch:!1,header:(0,h.jsx)(se,{labelKey:I}),label:Q[I].title,render:({item:e})=>(0,h.jsx)(ae,{amount:e.benchmark_price})},{id:"price_gap",enableHiding:!1,enableSorting:!1,enableGlobalSearch:!1,header:(0,h.jsx)(se,{labelKey:L}),label:Q[L].title,render:({item:e})=>`${e.price_gap||0}%`},{id:"suggested_price",enableHiding:!1,enableSorting:!0,enableGlobalSearch:!1,header:(0,h.jsx)(se,{labelKey:T}),label:Q[T].title,render:({item:e})=>(0,h.jsx)(ae,{amount:e.suggested_price})},{id:"action",enableHiding:!1,enableSorting:!1,enableGlobalSearch:!1,header:(0,h.jsx)("span",{className:"gla-price-benchmark-suggestions__action",children:Q[G].title}),label:Q[G].title,render:({item:e})=>(0,h.jsx)("div",{className:"gla-price-benchmark-suggestions__action",children:(0,h.jsx)(me,{productId:e?.product?.id})})}],je=["action"],ye={search:"",page:1,perPage:10,sort:{direction:"desc",field:"effectiveness"}},ke=(0,j.withViewportMatch)({isViewportMobile:"< medium"})(({isViewportMobile:e})=>{const{DataViews:a}=window.wp.dataviews,[i,s]=(0,t.useState)({type:"table",layout:{},fields:[],filters:[],titleField:"id",descriptionField:"description",mediaField:"image",...ye}),n={order:i.sort.direction,orderby:i.sort.field,search:i.search,page:i.page,per_page:i.perPage},{data:{items:r,meta:l},hasFinishedResolution:o}=(0,C.A)(n),c=(0,t.useCallback)(e=>{s(e)},[]),d=(0,t.useMemo)(()=>e?je:ve.map(e=>e.id),[e]);return(0,t.useEffect)(()=>{s(e=>({...e,fields:d}))},[d]),(0,t.useEffect)(()=>{o&&(0,y.ce)("gla_price_benchmarks_shown",{context:P,suggestions:r.length,per_page:i.perPage})},[o,r,i]),o&&!r?.length&&(0,v.isEqual)({search:n.search,page:n.page,perPage:n.per_page,sort:{direction:n.order,field:n.orderby}},ye)?(0,h.jsx)(N,{}):(0,h.jsx)("div",{className:"gla-price-benchmark-suggestions",children:(0,h.jsx)(a,{getItemId:e=>e?.product?.id,fields:[...xe,...ve],data:r,view:i,paginationInfo:{totalItems:l?.totalItems,totalPages:Math.ceil(l?.totalItems/i?.perPage)},onChangeView:c,defaultLayouts:[],header:(0,h.jsx)(fe,{}),isLoading:!o})})});var Ee=i(782),Ne=i(2780);const Ce=()=>{const{summary:e,hasFinishedResolution:a}=(0,Ee.A)();if(!a)return(0,h.jsx)(Ne.A,{className:"gla-price-benchmark__comparison-chart",isLoading:!0});if(e&&(0,v.isEmpty)(e)||0===e.total_products)return null;const i=[{id:"similar",label:(0,s.__)("Similar","google-listings-and-ads"),value:e.price_similar,color:r.m9.SIMILAR},{id:"no-price-benchmark",label:(0,s.__)("No price benchmark","google-listings-and-ads"),color:r.m9.UNKNOWN,value:e.price_unknown},{id:"cheaper",label:(0,s.__)("Cheaper","google-listings-and-ads"),color:r.m9.LOWER,value:e.price_lower},{id:"more-expensive",label:(0,s.__)("More Expensive","google-listings-and-ads"),color:r.m9.HIGHER,value:e.price_higher}];return(0,h.jsx)(Ne.A,{title:(0,s.__)("How Your Products Compare to Competitors","google-listings-and-ads"),segments:i,className:"gla-price-benchmark__comparison-chart"})},Ae=()=>{const[e,a]=(0,t.useState)(window.wp?.dataviews),{dataViewsScriptUrl:i}=r.Th;return(0,t.useEffect)(()=>{if(void 0===e&&i){const e=document.createElement("script");e.src=i,e.async=!0,e.onload=()=>{a("function"==typeof window.wp?.dataviews?.filterSortAndPaginate)},e.onerror=()=>{a(!1)},document.head.appendChild(e)}return()=>{!1===e&&a(void 0)}},[e,i]),(0,h.jsxs)("div",{className:"gla-price-benchmark",children:[(0,h.jsx)(f.A,{}),(0,h.jsx)(x.A,{}),(0,h.jsx)(b,{}),(0,h.jsx)(Ce,{}),!1===e&&(0,h.jsx)(l.A,{status:"warning",isDismissible:!1,className:"gla-price-benchmark__error-message",children:(0,s.__)("There was an error loading the price benchmark suggestions.","google-listings-and-ads")}),(e||void 0===e)&&(0,h.jsxs)(n.Card,{className:"gla-price-benchmark__card",children:[void 0===e&&(0,h.jsx)(o.A,{}),e&&(0,h.jsx)(ke,{})]})]})}}}]);