"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[1402],{9845:(e,t,s)=>{s.d(t,{ZP:()=>a});var i=s(25209);const o=["a","b","em","i","strong","p","br"],l=["target","href","rel","name","download"],a=e=>({__html:(0,i.sanitize)(e,{ALLOWED_TAGS:o,ALLOWED_ATTR:l})})},89543:(e,t,s)=>{s.r(t),s.d(t,{SettingsPaymentsMethods:()=>x,default:()=>g});var i=s(67221),o=s(69307),l=s(9818),a=s(65736),c=s(55609),n=s(44443),m=s(4622),r=s(22629),d=s(9845),_=s(81514);const h=({method:e,paymentMethodsState:t,setPaymentMethodsState:s,isExpanded:i,...o})=>{var l,a,n;return e.enabled||i?(0,_.jsx)("div",{id:e.id,className:"woocommerce-list__item woocommerce-list__item-enter-done",...o,children:(0,_.jsxs)("div",{className:"woocommerce-list__item-inner",children:["apple_google"!==e.id&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"woocommerce-list__item-before",children:(0,_.jsx)("img",{src:e.icon,alt:e.title+" logo"})}),(0,_.jsxs)("div",{className:"woocommerce-list__item-text",children:[(0,_.jsx)("span",{className:"woocommerce-list__item-title",children:e.title}),(0,_.jsx)("span",{className:"woocommerce-list__item-content",dangerouslySetInnerHTML:(0,d.ZP)((0,r.decodeEntities)(e.description))})]})]}),"apple_google"===e.id&&(0,_.jsxs)("div",{className:"woocommerce-list__item-multi",children:[(0,_.jsxs)("div",{className:"woocommerce-list__item-multi-row multi-row-space",children:[(0,_.jsx)("div",{className:"woocommerce-list__item-before",children:(0,_.jsx)("img",{src:e.icon,alt:e.title+" logo"})}),(0,_.jsxs)("div",{className:"woocommerce-list__item-text",children:[(0,_.jsx)("span",{className:"woocommerce-list__item-title",children:e.title}),(0,_.jsx)("span",{className:"woocommerce-list__item-content",dangerouslySetInnerHTML:(0,d.ZP)((0,r.decodeEntities)(e.description))})]})]}),(0,_.jsxs)("div",{className:"woocommerce-list__item-multi-row",children:[(0,_.jsx)("div",{className:"woocommerce-list__item-before",children:(0,_.jsx)("img",{src:e.extraIcon,alt:e.extraTitle+" logo"})}),(0,_.jsxs)("div",{className:"woocommerce-list__item-text",children:[(0,_.jsx)("span",{className:"woocommerce-list__item-title",children:e.extraTitle}),(0,_.jsx)("span",{className:"woocommerce-list__item-content",dangerouslySetInnerHTML:(0,d.ZP)((0,r.decodeEntities)(null!==(l=e.extraDescription)&&void 0!==l?l:""))})]})]})]}),(0,_.jsx)("div",{className:"woocommerce-list__item-after",children:(0,_.jsx)("div",{className:"woocommerce-list__item-after__actions wc-settings-prevent-change-event",children:(0,_.jsx)(c.ToggleControl,{checked:null!==(a=t[e.id])&&void 0!==a&&a,onChange:i=>{s({...t,[e.id]:i})},disabled:null!==(n=e.required)&&void 0!==n&&n,label:""})})})]})}):null},p=e=>{const t=(0,n.ZA)("apple_pay")(e),s=(0,n.ZA)("google_pay")(e);return t&&s?e.map((e=>"apple_pay"===e.id?{...e,id:"apple_google",extraTitle:s.title,extraDescription:s.description,extraIcon:s.icon}:"google_pay"===e.id?null:e)).filter((e=>null!==e)):e},x=({paymentMethodsState:e,setPaymentMethodsState:t})=>{var s;const[r,d]=(0,o.useState)(!1),{paymentMethods:x,isFetching:g}=(0,l.useSelect)((e=>{const t=e(i.paymentSettingsStore),s=t.getPaymentProviders()||[],o=(0,n.V3)(s);return{isFetching:t.isFetching(),paymentMethods:p(o)}}),[]),w=x.reduce(((e,{id:t,enabled:s})=>(e[t]=s,e)),{});return(0,o.useEffect)((()=>{null===w||g||t(w)}),[g]),(0,_.jsx)("div",{className:"settings-payments-methods__container",children:g?(0,_.jsx)(m.a,{rows:3,hasDragIcon:!1}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"woocommerce-list",children:x.map((s=>(0,_.jsx)(h,{method:s,paymentMethodsState:e,setPaymentMethodsState:t,isExpanded:r},s.id)))}),!r&&(0,_.jsx)(c.Button,{className:"settings-payments-methods__show-more",onClick:()=>{d(!r)},tabIndex:0,"aria-expanded":r,children:(0,a.sprintf)((0,a.__)("Show more (%s)","woocommerce"),null!==(s=x.filter((e=>!1===e.enabled)).length)&&void 0!==s?s:0)})]})})},g=x}}]);