OwlCyberSecurity - MANAGER
Edit File: payment-recommendations.js
"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[5396],{28682:(e,t,n)=>{n.d(t,{A:()=>r});var i=n(14812),s=n(28302),a=n(86020),o=n(14599),c=n(81514);const r=({textProps:e,message:t,eventName:n="",eventProperties:r={},targetUrl:m,linkType:d="wc-admin",onClickCallback:l})=>(0,c.jsx)(i.Text,{...e,children:(0,s.Z)({mixedString:t,components:{Link:(0,c.jsx)(a.Link,{onClick:()=>(l?l():(0,o.recordEvent)(n,r),window.location.href=m,!1),href:m,type:d})}})})},37062:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var i=n(65736),s=n(9818),a=n(22629),o=n(55609),c=n(69307),r=n(86020),m=n(14812),d=n(67221),l=n(14599),p=n(74617),_=n(4174),g=n(31586),w=n(28682),y=n(81514);const u=document.querySelector('[data-gateway_id="pre_install_woocommerce_payments_promotion"]'),h=()=>{const[e,t]=(0,c.useState)(null),[n,h]=(0,c.useState)(!1),[x,v]=(0,c.useState)(!1),{installAndActivatePlugins:k,dismissRecommendedPlugins:f}=(0,s.useDispatch)(d.pluginsStore),{createNotice:j}=(0,s.useDispatch)("core/notices"),{installedPaymentGateway:S,installedPaymentGateways:A,paymentGatewaySuggestions:E,isResolving:T}=(0,s.useSelect)((t=>{const n=x&&(0,g.V7)(e);return{installedPaymentGateway:n&&t(d.PAYMENT_GATEWAYS_STORE_NAME).getPaymentGateway(n),installedPaymentGateways:t(d.PAYMENT_GATEWAYS_STORE_NAME).getPaymentGateways().reduce(((e,t)=>(n===t.id||(e[t.id]=!0),e)),{}),isResolving:t(d.onboardingStore).isResolving("getPaymentGatewaySuggestions",[]),paymentGatewaySuggestions:t(d.onboardingStore).getPaymentGatewaySuggestions()}}),[x]),b=(0,c.useRef)(!1),P=E&&E.length>0&&!(e=>e&&1===e.filter((e=>0===e.id.indexOf("woocommerce_payments"))).length)(E)&&!n;if((0,c.useEffect)((()=>{if((P||u&&!T)&&!b.current){b.current=!0;const e=(E||[]).reduce(((e,t)=>t.plugins&&t.plugins.length>0?{...e,[t.plugins[0].replace(/\-/g,"_")+"_displayed"]:!0}:e),{woocommerce_payments_displayed:!!u});(0,l.recordEvent)("settings_payments_recommendations_pageview",e)}}),[P,u,T]),(0,c.useEffect)((()=>{S&&(window.location.href=S.settings_url)}),[S]),!P)return null;const G=async()=>{h(!0),(0,l.recordEvent)("settings_payments_recommendations_dismiss",{}),await f("payments")||(h(!1),j("error",(0,i.__)('There was a problem hiding the "Additional ways to get paid" card.',"woocommerce")))},C=(E||[]).filter((e=>!A[e.id]&&e.plugins?.length&&(!window.wcAdminFeatures["wc-pay-promotion"]||!e.id.startsWith("woocommerce_payments")))).map((n=>({key:n.id,title:(0,y.jsxs)(y.Fragment,{children:[n.title,n.recommended&&(0,y.jsx)(r.Pill,{children:(0,i.__)("Recommended","woocommerce")})]}),content:(0,a.decodeEntities)(n.content),after:(0,y.jsx)(o.Button,{isSecondary:!0,onClick:()=>(n=>{e||(t(n.id),(0,l.recordEvent)("settings_payments_recommendations_setup",{extension_selected:n.plugins[0]}),k([n.plugins[0]]).then((()=>{v(!0)})).catch((e=>{(0,_.a)(e),t(null)})))})(n),isBusy:e===n.id,disabled:!!e,children:n.actionText||(0,i.__)("Get started","woocommerce")}),before:(0,y.jsx)("img",{src:n.square_image||n.image_72x72||n.image,alt:""})})));return 0===C.length?null:(0,y.jsxs)(o.Card,{size:"medium",className:"woocommerce-recommended-payments-card",children:[(0,y.jsxs)(o.CardHeader,{children:[(0,y.jsxs)("div",{className:"woocommerce-recommended-payments-card__header",children:[(0,y.jsx)(m.Text,{variant:"title.small",as:"p",size:"20",lineHeight:"28px",children:(0,i.__)("Recommended payment providers","woocommerce")}),(0,y.jsx)(m.Text,{className:"woocommerce-recommended-payments__header-heading",variant:"caption",as:"p",size:"12",lineHeight:"16px",children:(0,i.__)('We recommend adding one of the following payment extensions to your store. The extension will be installed and activated for you when you click "Get started".',"woocommerce")})]}),(0,y.jsx)("div",{className:"woocommerce-card__menu woocommerce-card__header-item",children:(0,y.jsx)(r.EllipsisMenu,{label:(0,i.__)("Task List Options","woocommerce"),renderContent:()=>(0,y.jsx)("div",{className:"woocommerce-review-activity-card__section-controls",children:(0,y.jsx)(o.Button,{onClick:G,children:(0,i.__)("Hide this","woocommerce")})})})})]}),(0,y.jsx)(r.List,{items:C}),(0,y.jsx)(o.CardFooter,{children:(0,y.jsx)(w.A,{message:(0,i.__)("Visit the {{Link}}Official WooCommerce Marketplace{{/Link}} to find additional payment providers.","woocommerce"),eventName:"settings_payment_recommendations_visit_marketplace_click",targetUrl:(0,p.getAdminLink)("admin.php?page=wc-admin&tab=extensions&path=/extensions&category=payment-gateways")})})]})}}}]);