????

Your IP : 3.21.43.104


Current Path : /proc/self/cwd/wp-content/plugins/woocommerce/assets/client/admin/chunks/
Upload File :
Current File : //proc/self/cwd/wp-content/plugins/woocommerce/assets/client/admin/chunks/settings-payments-main.js

"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[5712],{5073:(e,t,n)=>{n.d(t,{l$:()=>u,My:()=>p,D2:()=>d,ls:()=>g}),n(5142);var s=n(65736),o=n(55609),i=n(69307),a=n(9818),c=n(67221),r=n(10431),l=n(14599),m=n(81514);const d=({gatewayId:e,gatewayState:t,settingsHref:n,onboardingHref:d,isOffline:_,acceptIncentive:u=(()=>{}),gatewayHasRecommendedPaymentMethods:p,installingPlugin:g,buttonText:h=(0,s.__)("Enable","woocommerce"),incentive:y=null})=>{const[v,w]=(0,i.useState)(!1),{createErrorNotice:x}=(0,a.dispatch)("core/notices"),{togglePaymentGateway:j,invalidateResolutionForStoreSelector:b}=(0,a.useDispatch)(c.PAYMENT_SETTINGS_STORE_NAME),f=()=>{x((0,s.__)("An error occurred. You will be redirected to the settings page, try enabling the payment gateway there.","woocommerce"),{type:"snackbar",explicitDismiss:!0})};return(0,m.jsx)(o.Button,{variant:"primary",isBusy:v,disabled:v||!!g,onClick:o=>{if(o.preventDefault(),t.enabled)return;(0,l.recordEvent)("settings_payments_provider_enable_click",{provider_id:e});const i=window.woocommerce_admin.nonces?.gateway_toggle||"";if(!i)return f(),void(window.location.href=n);w(!0),y&&u(y.promo_id),j(e,window.woocommerce_admin.ajax_url,i).then((o=>{if("needs_setup"===o.data)if(t.account_connected)x((0,s.__)("The provider could not be enabled. Check the Manage page for details.","woocommerce"),{type:"snackbar",explicitDismiss:!0,actions:[{label:(0,s.__)("Manage","woocommerce"),url:n}]});else{if((0,l.recordEvent)("settings_payments_provider_enable",{provider_id:e}),!p)return void(window.location.href=d);(0,r.getHistory)().push((0,r.getNewPath)({},"/payment-methods"))}b(_?"getOfflinePaymentGateways":"getPaymentProviders"),w(!1)})).catch((()=>{w(!1),f(),window.location.href=n}))},href:n,children:h})};var _=n(44443);const u=({acceptIncentive:e,installingPlugin:t,buttonText:n=(0,s.__)("Activate payments","woocommerce"),incentive:a=null})=>{const[c,r]=(0,i.useState)(!1);return(0,m.jsx)(o.Button,{variant:"primary",isBusy:c,disabled:c||!!t,onClick:()=>{r(!0),a&&e(a.promo_id),window.location.href=(0,_.vA)()},children:n})},p=({gatewayId:e,gatewayState:t,onboardingState:n,settingsHref:a,onboardingHref:c,gatewayHasRecommendedPaymentMethods:d,installingPlugin:_,buttonText:u=(0,s.__)("Complete setup","woocommerce")})=>{const[p,g]=(0,i.useState)(!1),h=t.account_connected,y=n.started,v=n.completed;return(0,m.jsx)(o.Button,{variant:"primary",isBusy:p,disabled:p||!!_,onClick:()=>{if((0,l.recordEvent)("settings_payments_provider_complete_setup_click",{provider_id:e,onboarding_state:n}),g(!0),h&&y)return h&&y&&!v?void(window.location.href=c):void(window.location.href=a);d?((0,r.getHistory)().push((0,r.getNewPath)({},"/payment-methods")),g(!1)):window.location.href=c},children:u},e)},g=({gatewayId:e,settingsHref:t,isInstallingPlugin:n,buttonText:i=(0,s.__)("Manage","woocommerce")})=>(0,m.jsx)(o.Button,{variant:"secondary",href:t,disabled:n,onClick:()=>{(0,l.recordEvent)("settings_payments_provider_manage_click",{provider_id:e})},children:i})},83777:(e,t,n)=>{n.r(t),n.d(t,{SettingsPaymentsMain:()=>ee,default:()=>te});var s=n(99196),o=n(65736),i=n(67221),a=n(9818),c=n(69307),r=n(86989),l=n.n(r),m=n(10431),d=n(14599),_=n(55609),u=n(4174),p=n(72471),g=n(22629),h=n(94333),y=n(81514);const v=()=>(0,y.jsxs)("div",{className:"other-payment-gateways__content__grid-item",children:[(0,y.jsx)("div",{className:"grid-item-placeholder__img"}),(0,y.jsxs)("div",{className:"other-payment-gateways__content__grid-item__content grid-item-placeholder__content",children:[(0,y.jsx)("span",{className:"grid-item-placeholder__title"}),(0,y.jsx)("span",{className:"grid-item-placeholder__description"}),(0,y.jsx)("div",{className:"grid-item-placeholder__actions"})]})]});var w=n(86020),x=n(91978);const j=({variant:e})=>{const[t,n]=(0,c.useState)(!1),s=(0,h.useDebounce)((()=>{n(!1)}),350);return(0,y.jsx)(w.Pill,{className:"woocommerce-official-extension-badge",children:(0,y.jsxs)("span",{className:"woocommerce-official-extension-badge__container",tabIndex:0,role:"button",onClick:()=>n(!t),onMouseEnter:()=>{n(!0),s.cancel()},onMouseLeave:s,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||n(!t)},children:[(0,y.jsx)("img",{src:x.vm+"images/icons/official-extension.svg",alt:(0,o.__)("Official WooCommerce extension badge","woocommerce")}),"expanded"===e&&(0,y.jsx)("span",{children:(0,o.__)("Official","woocommerce")}),t&&(0,y.jsx)(_.Popover,{className:"woocommerce-official-extension-badge-popover",placement:"top-start",offset:4,variant:"unstyled",focusOnMount:!0,noArrow:!0,shift:!0,onClose:s,children:(0,y.jsx)("div",{className:"components-popover__content-container",children:(0,y.jsx)("p",{children:(0,c.createInterpolateElement)((0,o.__)("This is an Official WooCommerce payment extension. <learnMoreLink />","woocommerce"),{learnMoreLink:(0,y.jsx)(w.Link,{href:"https://woocommerce.com/learn-more-about-official-partner-badging/",target:"_blank",rel:"noreferrer",type:"external",children:(0,o.__)("Learn more","woocommerce")})})})})})]})})},b=({suggestions:e,suggestionCategories:t,installingPlugin:n,setupPlugin:s,isFetching:i,morePaymentOptionsLink:a})=>{const r="expanded"===new URLSearchParams(window.location.search).get("other_pes_section"),[l,m]=(0,c.useState)(r),[d,u]=(0,c.useState)(""),w=(0,h.useDebounce)((()=>{u("")}),350),x=(0,c.useMemo)((()=>t.map((t=>({category:t,suggestions:e.filter((e=>e._type===t.id))})))),[e,t]),b=(0,c.useMemo)((()=>i?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"other-payment-gateways__header__title-image-placeholder"}),(0,y.jsx)("div",{className:"other-payment-gateways__header__title-image-placeholder"}),(0,y.jsx)("div",{className:"other-payment-gateways__header__title-image-placeholder"})]}):x.map((({suggestions:e})=>0===e.length?null:e.map((e=>(0,y.jsx)("img",{src:e.icon,alt:e.title+" small logo",width:"24",height:"24",className:"other-payment-gateways__header__title-image"},e.id)))))),[x,i]),f=(0,c.useMemo)((()=>i?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(v,{}),(0,y.jsx)(v,{}),(0,y.jsx)(v,{})]}):x.map((({category:e,suggestions:t})=>0===t.length?null:(0,y.jsxs)("div",{className:"other-payment-gateways__content__category-container",children:[(0,y.jsxs)("div",{className:"other-payment-gateways__content__title",children:[(0,y.jsx)("h3",{className:"other-payment-gateways__content__title__h3",children:(0,g.decodeEntities)(e.title)}),(0,y.jsxs)("span",{className:"other-payment-gateways__content__title__icon-container",onClick:()=>u(e.id===d?"":e.id),onMouseEnter:()=>{return t=e.id,u(t),void w.cancel();var t},onMouseLeave:w,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||u(e.id===d?"":e.id)},tabIndex:0,role:"button",children:[(0,y.jsx)(p.Z,{icon:"info-outline",className:"other-payment-gateways__content__title__icon"}),e.id===d&&(0,y.jsx)(_.Popover,{className:"other-payment-gateways__content__title-popover",placement:"top-start",offset:4,variant:"unstyled",focusOnMount:!0,noArrow:!0,shift:!0,onClose:w,children:(0,y.jsx)("div",{className:"components-popover__content-container",children:(0,y.jsx)("p",{children:(0,g.decodeEntities)(e.description)})})})]})]}),(0,y.jsx)("div",{className:"other-payment-gateways__content__grid",children:t.map((e=>(0,y.jsxs)("div",{className:"other-payment-gateways__content__grid-item",children:[(0,y.jsx)("img",{className:"other-payment-gateways__content__grid-item-image",src:e.icon,alt:(0,g.decodeEntities)(e.title)+" logo"}),(0,y.jsxs)("div",{className:"other-payment-gateways__content__grid-item__content",children:[(0,y.jsxs)("span",{className:"other-payment-gateways__content__grid-item__content__title",children:[e.title,(0,y.jsx)(j,{variant:"expanded"})]}),(0,y.jsx)("span",{className:"other-payment-gateways__content__grid-item__content__description",children:(0,g.decodeEntities)(e.description)}),(0,y.jsx)("div",{className:"other-payment-gateways__content__grid-item__content__actions",children:(0,y.jsx)(_.Button,{variant:"link",onClick:()=>s(e.id,e.plugin.slug,null),isBusy:n===e.id,disabled:!!n,children:n===e.id?(0,o.__)("Installing","woocommerce"):(0,o.__)("Install","woocommerce")})})]})]},e.id)))})]},e.id)))),[x,n,s,i,d]);return(0,y.jsxs)("div",{className:"other-payment-gateways"+(l?" is-expanded":""),children:[(0,y.jsxs)("div",{className:"other-payment-gateways__header",onClick:()=>{m(!l)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||m(!l)},role:"button",tabIndex:0,"aria-expanded":l,children:[(0,y.jsxs)("div",{className:"other-payment-gateways__header__title",children:[(0,y.jsx)("span",{children:(0,o.__)("Other payment options","woocommerce")}),!l&&(0,y.jsx)(y.Fragment,{children:b})]}),(0,y.jsx)(p.Z,{className:"other-payment-gateways__header__arrow",icon:l?"chevron-up":"chevron-down"})]}),l&&(0,y.jsxs)("div",{className:"other-payment-gateways__content",children:[f,(0,y.jsx)("div",{className:"other-payment-gateways__content__external-icon",children:a})]})]})};var f=n(80225),N=n(74617),k=n(55),P=n(28302),S=n(41708),E=n(59550),C=n(58176),T=n(56592);const I=(e,t)=>{const n=t,{changes:s,type:o,props:i}=n,{items:a}=i,{selectedItem:c}=e;switch(o){case S.L7.stateChangeTypes.ItemClick:return{...s,isOpen:!0,highlightedIndex:e.highlightedIndex};case S.L7.stateChangeTypes.ToggleButtonKeyDownArrowDown:return{selectedItem:a[c?Math.min(a.indexOf(c)+1,a.length-1):0],isOpen:!0};case S.L7.stateChangeTypes.ToggleButtonKeyDownArrowUp:return{selectedItem:a[c?Math.max(a.indexOf(c)-1,0):a.length-1],isOpen:!0};default:return s}},M=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),A=({name:e,className:t,label:n,describedBy:i,options:a,onChange:r,value:l,placeholder:m,children:d})=>{var u;const[p,g]=(0,s.useState)(""),v=(0,h.useThrottle)((0,c.useCallback)(((e,t)=>new Set(t.filter((t=>{var n;return`${M(null!==(n=t.name)&&void 0!==n?n:"")}`.toLowerCase().includes(M(e.toLowerCase()))})))),[]),200),w=""!==p?null!==(u=v(p,a))&&void 0!==u?u:new Set:new Set(a),{getToggleButtonProps:j,getMenuProps:b,getItemProps:N,isOpen:k,highlightedIndex:P,selectedItem:A,closeMenu:O}=(0,S.L7)({initialSelectedItem:l,items:[...w],stateReducer:I}),B=((e,t)=>{const n=t.find((t=>t.key===e));return n?.name?n.name:""})(l.key,a),R=A?A.key:"",L=(0,s.useRef)(null),D=(0,s.useRef)(null),F=(0,c.useCallback)((e=>{const t=L.current,n=t?.querySelector(`[data-index="${e}"]`);n&&n.scrollIntoView({block:"nearest"})}),[L]),H=""!==p,G=b({className:"components-country-select-control__menu","aria-hidden":!k,ref:L}),W=(0,c.useCallback)((e=>{e.stopPropagation(),r(R),O()}),[r,R,O]),Z=(0,c.useCallback)((e=>{e.stopPropagation(),"Enter"===e.key&&r(R)}),[r,R]),U=(0,c.useCallback)((e=>{e.preventDefault(),""!==p&&g(""),null!==A&&setTimeout((()=>{F(a.indexOf(A))}),10)}),[p,A]);return(0,c.useEffect)((()=>{if(k&&null!==A){const e=Array.from(w).indexOf(A);F(e)}}),[k]),(0,y.jsxs)("div",{className:(0,f.Z)("woopayments components-country-select-control",t),children:[(0,y.jsxs)(_.Button,{...j({"aria-label":n,"aria-labelledby":void 0,"aria-describedby":i||(B?(0,o.sprintf)((0,o.__)("Currently selected: %s","woocommerce"),B):(0,o.__)("No selection","woocommerce")),className:(0,f.Z)("components-country-select-control__button",{placeholder:!B}),name:e,onKeyDown:Z}),children:[(0,y.jsxs)("span",{className:"components-country-select-control__button-value",children:[(0,y.jsx)("span",{className:"components-country-select-control__label",children:n}),B||m]}),(0,y.jsx)(E.Z,{icon:C.Z,className:"components-custom-select-control__button-icon"})]}),(0,y.jsx)("div",{...G,children:k&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"components-country-select-control__search wc-settings-prevent-change-event",children:[(0,y.jsx)("input",{className:"components-country-select-control__search--input",ref:D,type:"text",value:p,onChange:({target:e})=>g(e.value),tabIndex:-1,placeholder:(0,o.__)("Search","woocommerce")}),(0,y.jsx)("button",{className:"components-country-select-control__search--input-suffix",onClick:U,children:(Y=H,Y?(0,y.jsx)("img",{src:x.vm+"images/icons/clear.svg",alt:(0,o.__)("Clear search","woocommerce")}):(0,y.jsx)("img",{src:x.vm+"images/icons/search.svg",alt:(0,o.__)("Search","woocommerce")}))})]}),(0,y.jsx)("div",{className:"components-country-select-control__list",children:[...w].map(((e,t)=>(0,s.createElement)("div",{...N({item:e,index:t,key:e.key,className:(0,f.Z)(e.className,"components-country-select-control__item",{"is-highlighted":t===P}),"data-index":t,style:e.style}),key:e.key},e.key===R&&(0,y.jsx)(E.Z,{icon:T.Z,className:"components-country-select-control__item-icon"}),d?d(e):e.name)))}),(0,y.jsx)("div",{className:"components-country-select-control__apply",children:(0,y.jsx)("button",{className:"components-button is-primary",onClick:W,children:(0,o.__)("Apply","woocommerce")})})]})})]});var Y};var O=n(4622),B=n(47396),R=n(76025),L=n(9845);const D=({providerId:e,pluginFile:t,isSuggestion:n,suggestionId:s,suggestionHideUrl:r="",onToggle:l,links:m=[],canResetAccount:u=!1,setResetAccountModalVisible:p=(()=>{}),isEnabled:g=!1})=>{const{deactivatePlugin:h}=(0,a.useDispatch)(i.PLUGINS_STORE_NAME),[v,w]=(0,c.useState)(!1),[x,j]=(0,c.useState)(!1),[b,f]=(0,c.useState)(!1),{invalidateResolutionForStoreSelector:N,togglePaymentGateway:k,hidePaymentExtensionSuggestion:P}=(0,a.useDispatch)(i.PAYMENT_SETTINGS_STORE_NAME),{createErrorNotice:S,createSuccessNotice:E}=(0,a.useDispatch)("core/notices"),C={pricing:(0,o.__)("See pricing & fees","woocommerce"),about:(0,o.__)("Learn more","woocommerce"),terms:(0,o.__)("See Terms of Service","woocommerce"),support:(0,o.__)("Get support","woocommerce"),documentation:(0,o.__)("View documentation","woocommerce")},T=m.filter((e=>{switch(e._type){case"pricing":return!0;case"terms":case"about":return!g;case"documentation":case"support":return g;default:return!1}}));return(0,y.jsxs)(y.Fragment,{children:[T.map((e=>{const t=C[e._type];return t?(0,y.jsx)("div",{className:"woocommerce-ellipsis-menu__content__item",children:(0,y.jsx)(_.Button,{target:"_blank",href:e.url,children:t})},e._type):null})),!!T.length&&(0,y.jsx)(_.CardDivider,{}),n&&(0,y.jsx)("div",{className:"woocommerce-ellipsis-menu__content__item",children:(0,y.jsx)(_.Button,{onClick:()=>{f(!0),(0,d.recordEvent)("settings_payments_recommendations_dismiss",{pes_id:s}),P(r).then((()=>{N("getPaymentProviders"),f(!1),l()})).catch((()=>{S((0,o.__)("Failed to hide the payment extension suggestion.","woocommerce")),f(!1),l()}))},isBusy:b,disabled:b,children:(0,o.__)("Hide suggestion","woocommerce")})},"hide-suggestion"),u&&(0,y.jsx)("div",{className:"woocommerce-ellipsis-menu__content__item",children:(0,y.jsx)(_.Button,{onClick:()=>{p(!0),l()},className:"components-button__danger",children:(0,o.__)("Reset account","woocommerce")})},"reset-account"),!n&&!g&&(0,y.jsx)("div",{className:"woocommerce-ellipsis-menu__content__item",children:(0,y.jsx)(_.Button,{className:"components-button__danger",onClick:()=>{w(!0),h(t).then((()=>{E((0,o.__)("Plugin was successfully deactivated.","woocommerce")),N("getPaymentProviders"),w(!1),l()})).catch((()=>{S((0,o.__)("Failed to deactivate the plugin.","woocommerce")),w(!1),l()}))},isBusy:v,disabled:v,children:(0,o.__)("Deactivate","woocommerce")})},"deactivate"),!n&&g&&(0,y.jsx)("div",{className:"woocommerce-ellipsis-menu__content__item",children:(0,y.jsx)(_.Button,{className:"components-button__danger",onClick:()=>{(0,d.recordEvent)("settings_payments_provider_disable_click",{provider_id:e});const t=window.woocommerce_admin.nonces?.gateway_toggle||"";t?(j(!0),k(e,window.woocommerce_admin.ajax_url,t).then((()=>{(0,d.recordEvent)("settings_payments_provider_disable",{provider_id:e}),N("getPaymentProviders"),j(!1),l()})).catch((()=>{S((0,o.__)("Failed to disable the plugin.","woocommerce")),j(!1),l()}))):S((0,o.__)("Failed to disable the plugin.","woocommerce"))},isBusy:x,disabled:x,children:(0,o.__)("Disable","woocommerce")})},"disable")]})};var F=n(44443);const H=({isOpen:e,onClose:t})=>{const[n,s]=(0,c.useState)(!1);return(0,y.jsx)(y.Fragment,{children:e&&(0,y.jsxs)(_.Modal,{title:(0,o.__)("Reset your test account","woocommerce"),className:"woocommerce-woopayments-modal",isDismissible:!0,onRequestClose:t,children:[(0,y.jsxs)("div",{className:"woocommerce-woopayments-modal__content",children:[(0,y.jsx)("div",{className:"woocommerce-woopayments-modal__content__item",children:(0,y.jsx)("div",{children:(0,y.jsx)("span",{children:(0,o.sprintf)((0,o.__)("When you reset your test account, all payment data — including your %s account details, test transactions, and payouts history — will be lost. Your order history will remain. This action cannot be undone, but you can create a new test account at any time.","woocommerce"),"WooPayments")})})}),(0,y.jsx)("div",{className:"woocommerce-woopayments-modal__content__item",children:(0,y.jsx)("h3",{children:(0,o.__)("Are you sure you'd like to continue?","woocommerce")})})]}),(0,y.jsx)("div",{className:"woocommerce-woopayments-modal__actions",children:(0,y.jsx)(_.Button,{className:"danger",variant:"secondary",isBusy:n,disabled:n,onClick:()=>{s(!0),window.location.href=(0,F.Pq)()},children:(0,o.__)("Yes, reset account","woocommerce")})})]})})},G=({isOpen:e,devMode:t,onClose:n})=>{const[s,i]=(0,c.useState)(!1),[a,r]=(0,c.useState)(!1);return(0,y.jsx)(y.Fragment,{children:e&&(0,y.jsxs)(_.Modal,{title:(0,o.__)("You're ready to test payments!","woocommerce"),className:"woocommerce-woopayments-modal",isDismissible:!0,onRequestClose:n,children:[(0,y.jsxs)("div",{className:"woocommerce-woopayments-modal__content",children:[(0,y.jsx)("div",{className:"woocommerce-woopayments-modal__content__item",children:(0,y.jsx)("div",{className:"woocommerce-woopayments-modal__content__item__description",children:(0,y.jsx)("p",{children:(0,P.Z)({mixedString:(0,o.__)("We've created a test account for you so that you can begin testing payments on your store. {{break/}}Not sure what to test? Take a look at {{link}}how to test payments{{/link}}.","woocommerce"),components:{link:(0,y.jsx)(w.Link,{href:"https://woocommerce.com/document/woopayments/testing-and-troubleshooting/sandbox-mode/",target:"_blank",rel:"noreferrer",type:"external"}),break:(0,y.jsx)("br",{})}})})})}),(0,y.jsx)("div",{className:"woocommerce-woopayments-modal__content__item",children:(0,y.jsx)("h2",{children:(0,o.__)("What's next:","woocommerce")})}),(0,y.jsxs)("div",{className:"woocommerce-woopayments-modal__content__item-flex",children:[(0,y.jsx)("img",{src:x.vm+"images/icons/store.svg",alt:"store icon"}),(0,y.jsxs)("div",{className:"woocommerce-woopayments-modal__content__item-flex__description",children:[(0,y.jsx)("h3",{children:(0,o.__)("Continue your store setup","woocommerce")}),(0,y.jsx)("div",{children:(0,o.__)("Finish completing the tasks required to launch your store.","woocommerce")})]})]}),!t&&(0,y.jsxs)("div",{className:"woocommerce-woopayments-modal__content__item-flex",children:[(0,y.jsx)("img",{src:x.vm+"images/icons/dollar.svg",alt:"dollar icon"}),(0,y.jsxs)("div",{className:"woocommerce-woopayments-modal__content__item-flex__description",children:[(0,y.jsx)("h3",{children:(0,o.__)("Activate payments","woocommerce")}),(0,y.jsx)("div",{children:(0,y.jsx)("p",{children:(0,P.Z)({mixedString:(0,o.__)("Provide some additional details about your business so you can being accepting real payments. {{link}}Learn more{{/link}}","woocommerce"),components:{link:(0,y.jsx)(w.Link,{href:"https://woocommerce.com/document/woopayments/startup-guide/#sign-up-process",target:"_blank",rel:"noreferrer",type:"external"})}})})})]})]})]}),(0,y.jsxs)("div",{className:"woocommerce-woopayments-modal__actions",children:[(0,y.jsx)(_.Button,{variant:"primary",isBusy:a,disabled:a,onClick:()=>{(0,d.recordEvent)("settings_payments_continue_store_setup_click",{provider_id:"woocommerce_payments"}),r(!0),window.location.href=(0,N.getAdminLink)("admin.php?page=wc-admin")},children:(0,o.__)("Continue store setup","woocommerce")}),!t&&(0,y.jsx)(_.Button,{variant:"secondary",isBusy:s,disabled:s,onClick:()=>{(0,d.recordEvent)("settings_payments_switch_to_live_account_click",{provider_id:"woocommerce_payments"}),i(!0),window.location.href=(0,F.vA)()},children:(0,o.__)("Activate payments","woocommerce")})]})]})})},W=({provider:e,label:t})=>{const[n,s]=(0,c.useState)(!1),o=(0,F.mz)(e.id)&&"gateway"===e._type&&e.state?.account_connected&&(e.onboarding?.state.test_mode||!e.onboarding?.state.completed);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.EllipsisMenu,{label:t,renderContent:({onToggle:t})=>(0,y.jsx)(D,{providerId:e.id,pluginFile:e.plugin.file,isSuggestion:"suggestion"===e._type,suggestionId:"suggestion"===e._type?e._suggestion_id:void 0,suggestionHideUrl:"suggestion"===e._type?e._links?.hide?.href:"",links:e.links,onToggle:t,isEnabled:e.state?.enabled,canResetAccount:o,setResetAccountModalVisible:s}),focusOnMount:!0}),(0,y.jsx)(H,{isOpen:n,onClose:()=>s(!1)})]})};var Z=n(33002);const U=({status:e,message:t,popoverContent:n})=>{const[s,i]=(0,c.useState)(!1),a=(0,h.useDebounce)((()=>{i(!1)}),350);return(0,y.jsxs)(w.Pill,{className:`woocommerce-status-badge ${(()=>{switch(e){case"active":case"has_incentive":return"woocommerce-status-badge--success";case"needs_setup":case"test_mode":case"test_account":return"woocommerce-status-badge--warning";case"recommended":case"inactive":return"woocommerce-status-badge--info";default:return""}})()}`,children:[t||(()=>{switch(e){case"active":return(0,o.__)("Active","woocommerce");case"inactive":return(0,o.__)("Inactive","woocommerce");case"needs_setup":return(0,o.__)("Action needed","woocommerce");case"test_mode":return(0,o.__)("Test mode","woocommerce");case"test_account":return(0,o.__)("Test account","woocommerce");case"recommended":return(0,o.__)("Recommended","woocommerce");default:return""}})(),n&&(0,y.jsxs)("span",{className:"woocommerce-status-badge__icon-container",onClick:()=>i(!s),onMouseEnter:()=>{i(!0),a.cancel()},onMouseLeave:a,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||i(!s)},tabIndex:0,role:"button",children:[(0,y.jsx)(E.Z,{className:"woocommerce-status-badge-icon",size:16,icon:Z.Z}),s&&(0,y.jsx)(_.Popover,{className:"woocommerce-status-badge-popover",placement:"top-start",offset:6,variant:"unstyled",focusOnMount:!0,noArrow:!0,shift:!0,onClose:a,children:(0,y.jsx)("div",{className:"components-popover__content-container",children:n})})]})]})},Y=({incentive:e})=>(0,y.jsx)(U,{status:"has_incentive",message:e.badge,popoverContent:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("p",{className:"woocommerce-incentive-popover__title",children:e.title}),(0,y.jsx)("p",{className:"woocommerce-incentive-popover__terms",children:(0,c.createInterpolateElement)((0,o.__)("See <termsLink /> for details.","woocommerce"),{termsLink:(0,y.jsx)(w.Link,{href:e.tc_url,target:"_blank",rel:"noreferrer",type:"external",children:(0,o.__)("Terms and Conditions","woocommerce")})})})]})}),K=({extension:e,installingPlugin:t,setupPlugin:n,pluginInstalled:s,acceptIncentive:i,...a})=>{const c=(0,F.Kr)(e)?e._incentive:null,r=(0,F.Kr)(e)&&(!(0,F.Ir)(e._incentive)||(0,F.o0)(e._incentive,"wc_settings_payments__banner"));let l=(0,o.__)("Install","woocommerce");return s?l=(0,o.__)("Enable","woocommerce"):t===e.id&&(l=(0,o.__)("Installing","woocommerce")),(0,y.jsx)("div",{id:e.id,className:"transitions-disabled woocommerce-list__item woocommerce-list__item-enter-done "+(r?"has-incentive":""),...a,children:(0,y.jsxs)("div",{className:"woocommerce-list__item-inner",children:[(0,y.jsxs)("div",{className:"woocommerce-list__item-before",children:[(0,y.jsx)(B.mR,{}),e.icon&&(0,y.jsx)("img",{className:"woocommerce-list__item-image",src:e.icon,alt:e.title+" logo"})]}),(0,y.jsxs)("div",{className:"woocommerce-list__item-text",children:[(0,y.jsxs)("span",{className:"woocommerce-list__item-title",children:[e.title," ",!(0,F.Kr)(e)&&(0,F.mz)(e.id)&&(0,y.jsx)(U,{status:"recommended"}),c&&(0,y.jsx)(Y,{incentive:c}),(0,y.jsx)(j,{variant:"expanded"})]}),(0,y.jsx)("span",{className:"woocommerce-list__item-content",dangerouslySetInnerHTML:(0,L.ZP)((0,g.decodeEntities)(e.description))}),(0,F.mz)(e.id)&&(0,y.jsx)(R.WooPaymentsMethodsLogos,{maxElements:10,tabletWidthBreakpoint:1080,mobileWidthBreakpoint:768,isWooPayEligible:(0,F.Gf)(e)})]}),(0,y.jsx)("div",{className:"woocommerce-list__item-buttons",children:(0,y.jsx)("div",{className:"woocommerce-list__item-buttons__actions",children:(0,y.jsx)(_.Button,{variant:"primary",onClick:()=>{var t;s&&(0,d.recordEvent)("settings_payments_provider_enable_click",{provider_id:e.id}),c&&i(c.promo_id),n(e.id,e.plugin.slug,null!==(t=e.onboarding?._links.onboard.href)&&void 0!==t?t:null)},isBusy:t===e.id,disabled:!!t,children:l})})}),(0,y.jsx)("div",{className:"woocommerce-list__item-after",children:(0,y.jsx)("div",{className:"woocommerce-list__item-after__actions",children:(0,y.jsx)(W,{label:(0,o.__)("Payment Provider Options","woocommerce"),provider:e})})})]})})};var z=n(5073);const $=({buttonText:e=(0,o.__)("Reactivate payments","woocommerce"),settingsHref:t})=>{const[n,s]=(0,c.useState)(!1),{createSuccessNotice:r,createErrorNotice:m}=(0,a.dispatch)("core/notices"),{invalidateResolutionForStoreSelector:d}=(0,a.useDispatch)(i.PAYMENT_SETTINGS_STORE_NAME);return(0,y.jsx)(_.Button,{variant:"primary",isBusy:n,disabled:n,onClick:e=>{e.preventDefault(),s(!0),l()({path:"/wc/v3/payments/settings",method:"POST",data:{is_test_mode_enabled:!1}}).then((()=>{r((0,o.sprintf)((0,o.__)("%s is now processing live payments (real payment methods and charges).","woocommerce"),"WooPayments"),{type:"snackbar",explicitDismiss:!1}),d("getPaymentProviders"),s(!1)})).catch((()=>{s(!1),m((0,o.sprintf)((0,o.__)("An error occurred. You will be redirected to the %s settings page to manage payments processing mode from there.","woocommerce"),"WooPayments"),{type:"snackbar",explicitDismiss:!0}),window.location.href=t}))},href:t,children:e})},q=({gateway:e,installingPlugin:t,acceptIncentive:n,...s})=>{var i;const a=(0,F.mz)(e.id),c=(0,F.Kr)(e)?e._incentive:null,r=c&&!c?.promo_id.includes("-action-"),l=(null!==(i=e.onboarding.recommended_payment_methods)&&void 0!==i?i:[]).length>0,m=!e.state.account_connected||e.state.account_connected&&!e.onboarding.state.started||e.state.account_connected&&e.onboarding.state.started&&!e.onboarding.state.completed;return(0,y.jsx)("div",{id:e.id,className:`transitions-disabled woocommerce-list__item woocommerce-list__item-enter-done woocommerce-item__payment-gateway ${a?"woocommerce-item__woocommerce-payments":""} ${r?"has-incentive":""}`,...s,children:(0,y.jsxs)("div",{className:"woocommerce-list__item-inner",children:[(0,y.jsxs)("div",{className:"woocommerce-list__item-before",children:[(0,y.jsx)(B.mR,{}),e.icon&&(0,y.jsx)("img",{className:"woocommerce-list__item-image",src:e.icon,alt:e.title+" logo"})]}),(0,y.jsxs)("div",{className:"woocommerce-list__item-text",children:[(0,y.jsxs)("span",{className:"woocommerce-list__item-title",children:[e.title,c?(0,y.jsx)(Y,{incentive:c}):(0,y.jsx)(U,{status:!e.state.enabled&&e.state.needs_setup?"needs_setup":e.state.enabled?e.onboarding.state.test_mode?"test_account":e.state.test_mode?"test_mode":"active":"inactive"}),e.supports?.includes("subscriptions")&&(0,y.jsx)(_.Tooltip,{placement:"top",text:(0,o.__)("Supports recurring payments","woocommerce"),children:(0,y.jsx)("img",{className:"woocommerce-list__item-recurring-payments-icon",src:x.vm+"images/icons/recurring-payments.svg",alt:(0,o.__)("Icon to indicate support for recurring payments","woocommerce")})}),e._suggestion_id&&(0,y.jsx)(j,{variant:"expanded"})]}),(0,y.jsx)("span",{className:"woocommerce-list__item-content",dangerouslySetInnerHTML:(0,L.ZP)((0,g.decodeEntities)(e.description))}),a&&(0,y.jsx)(R.WooPaymentsMethodsLogos,{maxElements:10,tabletWidthBreakpoint:1080,mobileWidthBreakpoint:768,isWooPayEligible:(0,F.Gf)(e)})]}),(0,y.jsx)("div",{className:"woocommerce-list__item-buttons",children:(0,y.jsxs)("div",{className:"woocommerce-list__item-buttons__actions",children:[!e.state.enabled&&!m&&(0,y.jsx)(z.D2,{gatewayId:e.id,gatewayState:e.state,settingsHref:e.management._links.settings.href,onboardingHref:e.onboarding._links.onboard.href,isOffline:!1,gatewayHasRecommendedPaymentMethods:l,installingPlugin:t,incentive:c,acceptIncentive:n}),!m&&(0,y.jsx)(z.ls,{gatewayId:e.id,settingsHref:e.management._links.settings.href,isInstallingPlugin:!!t}),m&&(0,y.jsx)(z.My,{gatewayId:e.id,gatewayState:e.state,onboardingState:e.onboarding.state,settingsHref:e.management._links.settings.href,onboardingHref:e.onboarding._links.onboard.href,gatewayHasRecommendedPaymentMethods:l,installingPlugin:t}),(0,F.mz)(e.id)&&!e.state.dev_mode&&e.state.account_connected&&e.onboarding.state.completed&&e.onboarding.state.test_mode&&(0,y.jsx)(z.l$,{acceptIncentive:n,installingPlugin:t,incentive:c}),(0,F.mz)(e.id)&&!e.state.dev_mode&&e.state.account_connected&&e.onboarding.state.completed&&!e.onboarding.state.test_mode&&e.state.test_mode&&(0,y.jsx)($,{settingsHref:e.management._links.settings.href})]})}),(0,y.jsx)("div",{className:"woocommerce-list__item-after",children:(0,y.jsx)("div",{className:"woocommerce-list__item-after__actions",children:(0,y.jsx)(W,{label:(0,o.__)("Payment Provider Options","woocommerce"),provider:e})})})]})})},V=({providers:e,installedPluginSlugs:t,installingPlugin:n,setupPlugin:s,acceptIncentive:o,updateOrdering:a})=>(0,y.jsx)(B.JN,{items:e,className:"settings-payment-gateways__list",setItems:a,children:e.map((e=>{switch(e._type){case i.PaymentProviderType.Suggestion:const a=e,c=t.includes(e.plugin.slug);return(0,y.jsx)(B.TR,{id:a.id,children:K({extension:a,installingPlugin:n,setupPlugin:s,pluginInstalled:c,acceptIncentive:o})},a.id);case i.PaymentProviderType.Gateway:const r=e;return(0,y.jsx)(B.TR,{id:e.id,children:q({gateway:r,installingPlugin:n,acceptIncentive:o})},e.id);case i.PaymentProviderType.OfflinePmsGroup:const l=e;return(0,y.jsx)(B.TR,{id:l.id,children:(0,y.jsx)("div",{id:l.id,className:"transitions-disabled woocommerce-list__item clickable-list-item enter-done",onClick:()=>{window.location.href=l.management._links.settings.href},children:(0,y.jsxs)("div",{className:"woocommerce-list__item-inner",children:[(0,y.jsxs)("div",{className:"woocommerce-list__item-before",children:[(0,y.jsx)(B.mR,{}),(0,y.jsx)("img",{src:l.icon,alt:l.title+" logo"})]}),(0,y.jsxs)("div",{className:"woocommerce-list__item-text",children:[(0,y.jsx)("span",{className:"woocommerce-list__item-title",children:l.title}),(0,y.jsx)("span",{className:"woocommerce-list__item-content",dangerouslySetInnerHTML:{__html:l.description}})]}),(0,y.jsx)("div",{className:"woocommerce-list__item-after centered no-buttons",children:(0,y.jsx)("div",{className:"woocommerce-list__item-after__actions",children:(0,y.jsx)("a",{className:"woocommerce-list__item-after__actions__arrow",href:l.management._links.settings.href,children:(0,y.jsx)(p.Z,{icon:"chevron-right"})})})})]})})},l.id);default:return null}}))}),J=({providers:e,installedPluginSlugs:t,installingPlugin:n,setupPlugin:s,acceptIncentive:r,updateOrdering:m,isFetching:u,businessRegistrationCountry:p,setBusinessRegistrationCountry:v})=>{var x;const{invalidateResolution:j}=(0,a.useDispatch)(i.PAYMENT_SETTINGS_STORE_NAME),[b,S]=(0,c.useState)(!1),E=(window.wcSettings?.admin?.preloadSettings?.general?.woocommerce_default_country||"US").split(":")[0],C=(0,c.useMemo)((()=>Object.entries(window.wcSettings.countries||[]).map((([e,t])=>({key:e,name:(0,g.decodeEntities)(t),types:[]}))).sort(((e,t)=>e.name.localeCompare(t.name)))),[]),T=E!==p,I=(0,f.Z)("settings-payment-gateways__header-select-container",{"has-alert":T}),M=(0,h.useDebounce)((()=>{S(!1)}),350);return(0,y.jsxs)("div",{className:"settings-payment-gateways",children:[(0,y.jsxs)("div",{className:"settings-payment-gateways__header",children:[(0,y.jsx)("div",{className:"settings-payment-gateways__header-title",children:(0,o.__)("Payment providers","woocommerce")}),(0,y.jsxs)("div",{className:I,children:[(0,y.jsx)(A,{className:"woocommerce-select-control__country",label:(0,o.__)("Business location:","woocommerce"),placeholder:"",value:null!==(x=C.find((e=>e.key===p)))&&void 0!==x?x:{key:"US",name:"United States (US)"},options:C,onChange:e=>{l()({path:i.WC_ADMIN_NAMESPACE+"/settings/payments/country",method:"POST",data:{location:e}}).then((()=>{const t=p,n=e;(0,d.recordEvent)("settings_payments_business_location_update",{old_location:t,new_location:n}),v(e),j("getPaymentProviders",[e])}))}}),T&&(0,y.jsxs)("div",{className:"settings-payment-gateways__header-select-container--indicator",tabIndex:0,role:"button",onClick:()=>S(!b),onMouseEnter:()=>{S(!0),M.cancel()},onMouseLeave:M,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||S(!b)},children:[(0,y.jsx)("div",{className:"settings-payment-gateways__header-select-container--indicator-icon",children:(0,y.jsx)(k.Z,{})}),b&&(0,y.jsx)(_.Popover,{className:"settings-payment-gateways__header-select-container--indicator-popover",placement:"top-end",offset:4,variant:"unstyled",focusOnMount:!0,noArrow:!0,shift:!0,onClose:M,children:(0,y.jsx)("div",{className:"components-popover__content-container",children:(0,y.jsx)("p",{children:(0,P.Z)({mixedString:(0,o.__)("Your business location does not match your store location. {{link}}Edit store location.{{/link}}","woocommerce"),components:{link:(0,y.jsx)(w.Link,{href:(0,N.getAdminLink)("admin.php?page=wc-settings&tab=general"),target:"_blank",type:"external"})}})})})})]})]})]}),u?(0,y.jsx)(O.a,{rows:5}):(0,y.jsx)(V,{providers:e,installedPluginSlugs:t,installingPlugin:n,setupPlugin:s,acceptIncentive:r,updateOrdering:m})]})},Q=({incentive:e,provider:t,onboardingUrl:n,onDismiss:i,onAccept:a,setupPlugin:r})=>{const[l,m]=(0,c.useState)(!1),[u,p]=(0,c.useState)(!1),[g,h]=(0,c.useState)(!1),v="wc_settings_payments__banner";return(0,s.useEffect)((()=>{(0,d.recordEvent)("settings_payments_incentive_show",{incentive_id:e.promo_id,provider_id:t.id,display_context:v})}),[e.promo_id,t.id]),l||(0,F.o0)(e,v)||u?null:(0,y.jsx)(_.Card,{className:"woocommerce-incentive-banner",isRounded:!0,children:(0,y.jsxs)("div",{className:"woocommerce-incentive-banner__content",children:[(0,y.jsx)("div",{className:"woocommerce-incentive-banner__image",children:(0,y.jsx)("img",{src:x.vm+"images/settings-payments/incentives-illustration.svg",alt:(0,o.__)("Incentive illustration","woocommerce")})}),(0,y.jsxs)(_.CardBody,{className:"woocommerce-incentive-banner__body",children:[(0,y.jsx)(U,{status:"has_incentive",message:(0,o.__)("Limited time offer","woocommerce")}),(0,y.jsxs)("div",{className:"woocommerce-incentive-banner__copy",children:[(0,y.jsx)("h2",{children:e.title}),(0,y.jsx)("p",{children:e.description})]}),(0,y.jsx)("div",{className:"woocommerce-incentive-banner__terms",children:(0,c.createInterpolateElement)((0,o.__)("See <termsLink /> for details.","woocommerce"),{termsLink:(0,y.jsx)(w.Link,{href:e.tc_url,target:"_blank",rel:"noreferrer",type:"external",children:(0,o.__)("Terms and Conditions","woocommerce")})})}),(0,y.jsxs)("div",{className:"woocommerce-incentive-banner__actions",children:[(0,y.jsx)(_.Button,{variant:"primary",isBusy:l,disabled:l,onClick:()=>{(0,d.recordEvent)("settings_payments_incentive_accept",{incentive_id:e.promo_id,provider_id:t.id,display_context:v}),h(!0),a(e.promo_id),i(e._links.dismiss.href,v),m(!0),r(t.id,t.plugin.slug,n),h(!1)},children:e.cta_label}),(0,y.jsx)(_.Button,{variant:"tertiary",isBusy:g,disabled:g,onClick:()=>{(0,d.recordEvent)("settings_payments_incentive_dismiss",{incentive_id:e.promo_id,provider_id:t.id,display_context:v}),h(!0),i(e._links.dismiss.href,v),h(!1),p(!0)},children:(0,o.__)("Dismiss","woocommerce")})]})]})]})})},X=({incentive:e,provider:t,onboardingUrl:n,onAccept:i,onDismiss:a,setupPlugin:r})=>{const[l,m]=(0,c.useState)(!1),[u,p]=(0,c.useState)(!0),g="wc_settings_payments__modal",h=(0,F.o0)(e,g);(0,s.useEffect)((()=>{(0,d.recordEvent)("settings_payments_incentive_show",{incentive_id:e.promo_id,provider_id:t.id,display_context:g})}),[e.promo_id,t.id]);const v=()=>{p(!1)};return h?null:(0,y.jsx)(y.Fragment,{children:u&&(0,y.jsx)(_.Modal,{title:"",className:"woocommerce-incentive-modal",onRequestClose:()=>{(0,d.recordEvent)("settings_payments_incentive_dismiss",{incentive_id:e.promo_id,provider_id:t.id,display_context:g}),a(e._links.dismiss.href,g),v()},children:(0,y.jsx)(_.Card,{className:"woocommerce-incentive-modal__card",children:(0,y.jsxs)("div",{className:"woocommerce-incentive-modal__content",children:[(0,y.jsx)(_.CardMedia,{className:"woocommerce-incentive-modal__media",children:(0,y.jsx)("img",{src:x.vm+"images/settings-payments/incentives-illustration.svg",alt:(0,o.__)("Incentive illustration","woocommerce")})}),(0,y.jsxs)(_.CardBody,{className:"woocommerce-incentive-modal__body",children:[(0,y.jsx)("div",{children:(0,y.jsx)(U,{status:"has_incentive",message:(0,o.__)("Limited time offer","woocommerce")})}),(0,y.jsx)("h2",{children:e.title}),(0,y.jsx)("p",{children:e.description}),(0,y.jsx)("p",{className:"woocommerce-incentive-modal__terms",children:(0,c.createInterpolateElement)((0,o.__)("See <termsLink /> for details.","woocommerce"),{termsLink:(0,y.jsx)(w.Link,{href:e.tc_url,target:"_blank",rel:"noreferrer",type:"external",children:(0,o.__)("Terms and Conditions","woocommerce")})})}),(0,y.jsx)("div",{className:"woocommerce-incentive-model__actions",children:(0,y.jsx)(_.Button,{variant:"primary",isBusy:l,disabled:l,onClick:()=>{(0,d.recordEvent)("settings_payments_incentive_accept",{incentive_id:e.promo_id,provider_id:t.id,display_context:g}),m(!0),i(e.promo_id),a(e._links.dismiss.href,g),v(),r(t.id,t.plugin.slug,n),m(!1)},children:e.cta_label})})]})]})})})})},ee=()=>{var e,t;const[n,r]=(0,c.useState)(null),[p,g]=(0,c.useState)(null),{installAndActivatePlugins:h}=(0,a.useDispatch)(i.PLUGINS_STORE_NAME),{updateProviderOrdering:v}=(0,a.useDispatch)(i.PAYMENT_SETTINGS_STORE_NAME),[w,j]=(0,c.useState)(null),[f,N]=(0,c.useState)(!1),[k,P]=(0,c.useState)(window.wcSettings?.admin?.woocommerce_payments_nox_profile?.business_country_code||null),S=(0,x.O3)("wcAdminAssetUrl");(0,c.useEffect)((()=>{(0,d.recordEvent)("settings_payments_pageview");const e=new URLSearchParams(window.location.search);"true"===e.get("test_drive_error")&&j((0,o.sprintf)((0,o.__)("%s: An error occurred while setting up your sandbox account — please try again.","woocommerce"),"WooPayments")),"1"===e.get("wcpay-connect-jetpack-error")&&j((0,o.sprintf)((0,o.__)("%s: There was a problem connecting your WordPress.com account — please try again.","woocommerce"),"WooPayments")),"true"===e.get("wcpay-sandbox-success")&&N(!0)}),[]);const E=(0,a.useSelect)((e=>e(i.PLUGINS_STORE_NAME).getInstalledPlugins()),[]),{invalidateResolutionForStoreSelector:C}=(0,a.useDispatch)(i.PAYMENT_SETTINGS_STORE_NAME),{providers:T,offlinePaymentGateways:I,suggestions:M,suggestionCategories:A,isFetching:O}=(0,a.useSelect)((e=>{const t=e(i.PAYMENT_SETTINGS_STORE_NAME);return{providers:t.getPaymentProviders(k),offlinePaymentGateways:t.getOfflinePaymentGateways(),suggestions:t.getSuggestions(),suggestionCategories:t.getSuggestionCategories(),isFetching:t.isFetching()}}),[k]),B=(0,s.useCallback)(((e,t)=>{l()({url:e,method:"POST",data:{context:t}})}),[]),R=(0,s.useCallback)((e=>{l()({path:`/wc-analytics/admin/notes/experimental-activate-promo/${e}`,method:"POST"})}),[]);(0,c.useEffect)((()=>{g(null)}),[T]);const L=T.find((e=>"_incentive"in e)),D=L?L._incentive:null;let H=!1,W=!1;L&&D&&((0,F.NI)(D)?(0,F.o0)(D,"wc_settings_payments__modal")?(0,F.o0)(D,"wc_settings_payments__banner")||(W=!0):H=!0:(0,F.o0)(D,"wc_settings_payments__banner")||(W=!0));const Z=(0,s.useRef)(!1);(0,c.useEffect)((()=>{if(O||!T.length||!M.length||Z.current)return;Z.current=!0;const e={woocommerce_payments_displayed:T.some((e=>(0,F.mz)(e.id)))};M.forEach((t=>{e[t.id.replace(/-/g,"_")+"_displayed"]=!0})),T.filter((e=>"suggestion"===e._type)).forEach((t=>{t._suggestion_id?e[t._suggestion_id.replace(/-/g,"_")+"_displayed"]=!0:t.plugin&&t.plugin.slug&&(e[t.plugin.slug.replace(/-/g,"_")+"_displayed"]=!0)})),(0,d.recordEvent)("settings_payments_recommendations_pageview",e)}),[M,T,O]);const U=(0,s.useCallback)(((e,t,s)=>{n||(!s&&(0,F.mz)(e)&&(s=(0,F.SN)()),r(e),(0,d.recordEvent)("settings_payments_recommendations_setup",{extension_selected:t}),h([t]).then((async n=>{var o;(0,u.a)(n),C("getPaymentProviders"),(0,d.recordEvent)("settings_payments_provider_installed",{provider_id:e});const c=(await(0,a.resolveSelect)(i.PAYMENT_SETTINGS_STORE_NAME).getPaymentProviders(k)).find((n=>n.id===e||n?._suggestion_id===e||n.plugin.slug===t));if((0,d.recordEvent)("settings_payments_provider_enable",{provider_id:e}),(null!==(o=c?.onboarding?.recommended_payment_methods)&&void 0!==o?o:[]).length>0)return(0,m.getHistory)().push((0,m.getNewPath)({},"/payment-methods")),void r(null);r(null),s&&(window.location.href=s)})).catch((e=>{(0,u.a)(e),r(null)})))}),[n,h,C,k]),Y=(0,y.jsxs)(_.Button,{variant:"link",target:"_blank",href:"https://woocommerce.com/product-category/woocommerce-extensions/payment-gateways/",className:"more-payment-options-link",onClick:()=>{const e=T.map((e=>e.plugin&&e.plugin.slug?e.plugin.slug.replace(/-/g,"_"):e._suggestion_id?e._suggestion_id.replace(/-/g,"_"):e.id));I.forEach((t=>{e.push(t.id)})),M.forEach((t=>{t.plugin&&t.plugin.slug?e.push(t.plugin.slug.replace(/-/g,"_")):e.push(t.id.replace(/-/g,"_"))}));const t=[...new Set(e)];(0,d.recordEvent)("settings_payments_recommendations_other_options",{available_payment_methods:t.join(", ")})},children:[(0,y.jsx)("img",{src:S+"/icons/external-link.svg",alt:""}),(0,o.__)("More payment options","woocommerce")]});return(0,y.jsxs)(y.Fragment,{children:[H&&L&&D&&(0,y.jsx)(X,{incentive:D,provider:L,onboardingUrl:null!==(e=L.onboarding?._links.onboard.href)&&void 0!==e?e:null,onDismiss:B,onAccept:R,setupPlugin:U}),w&&(0,y.jsxs)("div",{className:"notice notice-error is-dismissible wcpay-settings-notice",children:[(0,y.jsx)("p",{children:w}),(0,y.jsx)("button",{type:"button",className:"notice-dismiss",onClick:()=>{j(null)}})]}),W&&L&&D&&(0,y.jsx)(Q,{incentive:D,provider:L,onboardingUrl:null!==(t=L.onboarding?._links.onboard.href)&&void 0!==t?t:null,onDismiss:B,onAccept:R,setupPlugin:U}),(0,y.jsxs)("div",{className:"settings-payments-main__container",children:[(0,y.jsx)(J,{providers:p||T,installedPluginSlugs:E,installingPlugin:n,setupPlugin:U,acceptIncentive:R,updateOrdering:function(e){const t=e.map((e=>e._order)).sort(((e,t)=>e-t)),n={};e.forEach(((e,s)=>{n[e.id]=t[s]})),v(n),g(e)},isFetching:O,businessRegistrationCountry:k,setBusinessRegistrationCountry:P}),!O&&0===M.length&&(0,y.jsx)("div",{className:"more-payment-options",children:Y}),(O||M.length>0)&&(0,y.jsx)(b,{suggestions:M,suggestionCategories:A,installingPlugin:n,setupPlugin:U,isFetching:O,morePaymentOptionsLink:Y})]}),(0,y.jsx)(G,{isOpen:f&&(0,F.eP)(T),devMode:(0,F.Av)(T),onClose:()=>N(!1)})]})},te=ee}}]);