2 lines
108 KiB
JavaScript
2 lines
108 KiB
JavaScript
/*! For license information please see multi-currency.js.LICENSE.txt */
|
||
(()=>{var e={5955:(e,t,r)=>{"use strict";t.A=function(e){var t=e.size,r=void 0===t?24:t,o=e.onClick,i=(e.icon,e.className),c=function(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(e,a),d=["gridicon","gridicons-checkmark",i,!1,!1,!1].filter(Boolean).join(" ");return n.default.createElement("svg",s({className:d,height:r,width:r,onClick:o},c,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),n.default.createElement("g",null,n.default.createElement("path",{d:"M9 19.414l-6.707-6.707 1.414-1.414L9 16.586 20.293 5.293l1.414 1.414z"})))};var o,n=(o=r(1609))&&o.__esModule?o:{default:o},a=["size","onClick","icon","className"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)}},9387:(e,t,r)=>{"use strict";t.A=function(e){var t=e.size,r=void 0===t?24:t,o=e.onClick,i=(e.icon,e.className),c=function(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(e,a),d=["gridicon","gridicons-cross-circle",i,!1,!1,!1].filter(Boolean).join(" ");return n.default.createElement("svg",s({className:d,height:r,width:r,onClick:o},c,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),n.default.createElement("g",null,n.default.createElement("path",{d:"M19.1 4.9C15.2 1 8.8 1 4.9 4.9S1 15.2 4.9 19.1s10.2 3.9 14.1 0 4-10.3.1-14.2zm-4.3 11.3L12 13.4l-2.8 2.8-1.4-1.4 2.8-2.8-2.8-2.8 1.4-1.4 2.8 2.8 2.8-2.8 1.4 1.4-2.8 2.8 2.8 2.8-1.4 1.4z"})))};var o,n=(o=r(1609))&&o.__esModule?o:{default:o},a=["size","onClick","icon","className"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)}},4275:(e,t,r)=>{"use strict";t.A=function(e){var t=e.size,r=void 0===t?24:t,o=e.onClick,i=(e.icon,e.className),c=function(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(e,a),d=["gridicon","gridicons-info-outline",i,!!function(e){return 0==e%18}(r)&&"needs-offset",!1,!1].filter(Boolean).join(" ");return n.default.createElement("svg",s({className:d,height:r,width:r,onClick:o},c,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),n.default.createElement("g",null,n.default.createElement("path",{d:"M13 9h-2V7h2v2zm0 2h-2v6h2v-6zm-1-7c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8m0-2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2z"})))};var o,n=(o=r(1609))&&o.__esModule?o:{default:o},a=["size","onClick","icon","className"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)}},9031:(e,t,r)=>{"use strict";t.A=function(e){var t=e.size,r=void 0===t?24:t,o=e.onClick,i=(e.icon,e.className),c=function(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(e,a),d=["gridicon","gridicons-notice-outline",i,!!function(e){return 0==e%18}(r)&&"needs-offset",!1,!1].filter(Boolean).join(" ");return n.default.createElement("svg",s({className:d,height:r,width:r,onClick:o},c,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),n.default.createElement("g",null,n.default.createElement("path",{d:"M12 4c4.411 0 8 3.589 8 8s-3.589 8-8 8-8-3.589-8-8 3.589-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 13h-2v2h2v-2zm-2-2h2l.5-6h-3l.5 6z"})))};var o,n=(o=r(1609))&&o.__esModule?o:{default:o},a=["size","onClick","icon","className"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)}},5338:(e,t,r)=>{"use strict";var o=r(5795);t.H=o.createRoot,o.hydrateRoot},1020:(e,t,r)=>{"use strict";var o=r(1609),n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,r){var o,a={},d=null,u=null;for(o in void 0!==r&&(d=""+r),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,o)&&!c.hasOwnProperty(o)&&(a[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===a[o]&&(a[o]=t[o]);return{$$typeof:n,type:e,key:d,ref:u,props:a,_owner:i.current}}t.Fragment=a,t.jsx=d,t.jsxs=d},4848:(e,t,r)=>{"use strict";e.exports=r(1020)},1609:e=>{"use strict";e.exports=window.React},5795:e=>{"use strict";e.exports=window.ReactDOM}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var o=t.getElementsByTagName("script");if(o.length)for(var n=o.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=o[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),r.p=window.wcpayAssets.url,(()=>{"use strict";var e={};r.r(e),r.d(e,{getAllDepositsOverviews:()=>Te,getAllDepositsOverviewsError:()=>Re,getDeposit:()=>we,getDepositQueryError:()=>Ie,getDeposits:()=>be,getDepositsCount:()=>Oe,getDepositsSummary:()=>Ne,getDepositsSummaryError:()=>Ce,getInstantDeposit:()=>xe});var t={};r.r(t),r.d(t,{submitInstantDeposit:()=>Ge,updateAllDepositsOverviews:()=>Le,updateDeposit:()=>ke,updateDeposits:()=>$e,updateDepositsCount:()=>Be,updateDepositsSummary:()=>qe,updateErrorForAllDepositsOverviews:()=>ze,updateErrorForDepositQuery:()=>Ye,updateErrorForDepositsSummary:()=>Ve,updateInstantDeposit:()=>He});var o={};r.r(o),r.d(o,{getAllDepositsOverviews:()=>Qe,getDeposit:()=>We,getDeposits:()=>Xe,getDepositsSummary:()=>et,getPayoutsCSVRequestURL:()=>Ke,payoutsDownloadEndpoint:()=>Je});var n={};r.r(n),r.d(n,{getFraudOutcomeTransactions:()=>lt,getFraudOutcomeTransactionsError:()=>mt,getFraudOutcomeTransactionsSummary:()=>pt,getFraudOutcomeTransactionsSummaryError:()=>yt,getTransactions:()=>at,getTransactionsError:()=>st,getTransactionsSummary:()=>ct,getTransactionsSummaryError:()=>dt});var a={};r.r(a),r.d(a,{updateErrorForFraudOutcomeTransactions:()=>wt,updateErrorForFraudOutcomeTransactionsSummary:()=>Rt,updateErrorForTransactions:()=>St,updateErrorForTransactionsSummary:()=>Et,updateFraudOutcomeTransactions:()=>ft,updateFraudOutcomeTransactionsSummary:()=>Tt,updateTransactions:()=>ht,updateTransactionsSummary:()=>gt});var s={};r.r(s),r.d(s,{formatQueryFilters:()=>vt,getFraudOutcomeTransactions:()=>Nt,getFraudOutcomeTransactionsExport:()=>xt,getFraudOutcomeTransactionsSummary:()=>Ct,getTransactions:()=>bt,getTransactionsCSVRequestURL:()=>It,getTransactionsSummary:()=>At,transactionsDownloadEndpoint:()=>Ot});var i={};r.r(i),r.d(i,{getCharge:()=>Dt,getChargeError:()=>Mt,getChargeFromOrder:()=>Ft,getChargeFromOrderError:()=>jt});var c={};r.r(c),r.d(c,{updateCharge:()=>Ut,updateErrorForCharge:()=>kt});var d={};r.r(d),r.d(d,{getCharge:()=>Lt,getChargeFromOrder:()=>zt});var u={};r.r(u),r.d(u,{getTimeline:()=>Bt,getTimelineError:()=>Yt});var l={};r.r(l),r.d(l,{updateErrorForTimeline:()=>Vt,updateTimeline:()=>qt});var m={};r.r(m),r.d(m,{getTimeline:()=>Ht});var _={};r.r(_),r.d(_,{getCachedDispute:()=>Kt,getDispute:()=>Zt,getDisputeError:()=>Jt,getDisputes:()=>Xt,getDisputesSummary:()=>er});var p={};r.r(p),r.d(p,{refundCharge:()=>ar,updateErrorForPaymentIntent:()=>nr,updatePaymentIntent:()=>or});var y={};r.r(y),r.d(y,{getPaymentIntent:()=>sr});var h={};r.r(h),r.d(h,{acceptDispute:()=>lr,updateDispute:()=>ir,updateDisputes:()=>dr,updateDisputesSummary:()=>ur,updateErrorForDispute:()=>cr});var S={};r.r(S),r.d(S,{disputesDownloadEndpoint:()=>gr,getDispute:()=>fr,getDisputes:()=>wr,getDisputesCSVRequestURL:()=>Er,getDisputesSummary:()=>Tr});var g={};r.r(g),r.d(g,{getAccountBusinessSupportEmail:()=>Lr,getAccountBusinessSupportPhone:()=>zr,getAccountCommunicationsEmail:()=>bo,getAccountDomesticCurrency:()=>$r,getAccountStatementDescriptor:()=>jr,getAccountStatementDescriptorKana:()=>kr,getAccountStatementDescriptorKanji:()=>Ur,getAdvancedFraudProtectionSettings:()=>Eo,getAvailablePaymentMethodIds:()=>Pr,getCompletedWaitingPeriod:()=>Hr,getCurrentProtectionLevel:()=>go,getDepositDelayDays:()=>Vr,getDepositRestrictions:()=>Wr,getDepositScheduleInterval:()=>Br,getDepositScheduleMonthlyAnchor:()=>qr,getDepositScheduleWeeklyAnchor:()=>Yr,getDepositStatus:()=>Gr,getDuplicatedPaymentMethodIds:()=>Nr,getEnabledPaymentMethodIds:()=>xr,getExpressCheckoutCartMethods:()=>Io,getExpressCheckoutCheckoutMethods:()=>Ao,getExpressCheckoutProductMethods:()=>Oo,getIsCardPresentEligible:()=>uo,getIsDebugLogEnabled:()=>to,getIsDevModeEnabled:()=>Kr,getIsExpressCheckoutInPaymentMethodsEnabled:()=>eo,getIsManualCaptureEnabled:()=>Qr,getIsMultiCurrencyEnabled:()=>ro,getIsPaymentRequestEnabled:()=>Xr,getIsSavedCardsEnabled:()=>io,getIsStripeBillingEnabled:()=>wo,getIsStripeBillingMigrationInProgress:()=>To,getIsSubscriptionsPluginActive:()=>_o,getIsTestModeEnabled:()=>Zr,getIsTestModeOnboarding:()=>Jr,getIsWCPayEnabled:()=>Cr,getIsWCPaySubscriptionsEligible:()=>mo,getIsWCPaySubscriptionsEnabled:()=>lo,getIsWooPayEnabled:()=>po,getIsWooPayGlobalThemeSupportEnabled:()=>yo,getPaymentMethodStatuses:()=>Dr,getPaymentRequestButtonBorderRadius:()=>so,getPaymentRequestButtonSize:()=>no,getPaymentRequestButtonTheme:()=>ao,getPaymentRequestButtonType:()=>oo,getSavingError:()=>co,getSettings:()=>Ar,getShowWooPayIncompatibilityNotice:()=>fo,getStripeBillingMigratedCount:()=>vo,getStripeBillingSubscriptionCount:()=>Ro,getWooPayCustomMessage:()=>ho,getWooPayStoreLogo:()=>So,isDirty:()=>Fr,isSavingSettings:()=>Mr});var E={};r.r(E),r.d(E,{saveOption:()=>En,saveSettings:()=>an,submitStripeBillingSubscriptionMigration:()=>gn,updateAccountBusinessSupportEmail:()=>en,updateAccountBusinessSupportPhone:()=>tn,updateAccountCommunicationsEmail:()=>pn,updateAccountStatementDescriptor:()=>Jo,updateAccountStatementDescriptorKana:()=>Xo,updateAccountStatementDescriptorKanji:()=>Ko,updateAdvancedFraudProtectionSettings:()=>mn,updateDepositScheduleInterval:()=>rn,updateDepositScheduleMonthlyAnchor:()=>nn,updateDepositScheduleWeeklyAnchor:()=>on,updateEnabledPaymentMethodIds:()=>Bo,updateExpressCheckoutCartMethods:()=>hn,updateExpressCheckoutCheckoutMethods:()=>Sn,updateExpressCheckoutProductMethods:()=>yn,updateIsCardPresentEligible:()=>Do,updateIsDebugLogEnabled:()=>Wo,updateIsExpressCheckoutInPaymentMethodsEnabled:()=>$o,updateIsManualCaptureEnabled:()=>Ho,updateIsMultiCurrencyEnabled:()=>Qo,updateIsPaymentRequestEnabled:()=>zo,updateIsSavedCardsEnabled:()=>Po,updateIsSavingSettings:()=>Yo,updateIsStripeBillingEnabled:()=>_n,updateIsTestModeEnabled:()=>Go,updateIsWCPayEnabled:()=>Lo,updateIsWCPaySubscriptionsEnabled:()=>Zo,updateIsWooPayEnabled:()=>sn,updateIsWooPayGlobalThemeSupportEnabled:()=>cn,updatePaymentRequestButtonBorderRadius:()=>Uo,updatePaymentRequestButtonSize:()=>Fo,updatePaymentRequestButtonTheme:()=>jo,updatePaymentRequestButtonType:()=>Mo,updateProtectionLevel:()=>ln,updateSelectedPaymentMethod:()=>qo,updateSettings:()=>ko,updateUnselectedPaymentMethod:()=>Vo,updateWooPayCustomMessage:()=>dn,updateWooPayStoreLogo:()=>un});var f={};r.r(f),r.d(f,{getSettings:()=>fn});var w={};r.r(w),r.d(w,{getCardReaderStats:()=>Rn,getCardReaderStatsError:()=>vn,getCardReaders:()=>bn});var T={};r.r(T),r.d(T,{updateCardReaderStats:()=>On,updateCardReaders:()=>In,updateErrorForCardReaderStats:()=>An,updateErrorForCardReaders:()=>Nn});var R={};r.r(R),r.d(R,{getCardReaderStats:()=>Cn,getCardReaders:()=>xn});var v={};r.r(v),r.d(v,{getActiveLoanSummary:()=>jn,getActiveLoanSummaryError:()=>Un,getLoans:()=>kn,getLoansError:()=>Ln});var b={};r.r(b),r.d(b,{updateActiveLoanSummary:()=>zn,updateErrorForActiveLoanSummary:()=>$n,updateErrorForLoans:()=>Yn,updateLoans:()=>Bn});var O={};r.r(O),r.d(O,{getActiveLoanSummary:()=>qn,getLoans:()=>Vn});var I={};r.r(I),r.d(I,{getDocuments:()=>Zn,getDocumentsError:()=>Jn,getDocumentsSummary:()=>Xn,getDocumentsSummaryError:()=>ea});var A={};r.r(A),r.d(A,{updateDocuments:()=>ta,updateDocumentsSummary:()=>oa,updateErrorForDocuments:()=>ra,updateErrorForDocumentsSummary:()=>na});var N={};r.r(N),r.d(N,{formatQueryFilters:()=>aa,getDocuments:()=>sa,getDocumentsSummary:()=>ia});var C={};r.r(C),r.d(C,{getPaymentIntent:()=>da,getPaymentIntentError:()=>ua});var x={};r.r(x),r.d(x,{getAuthorization:()=>ha,getAuthorizations:()=>ya,getAuthorizationsError:()=>Sa,getAuthorizationsSummary:()=>Ea,getAuthorizationsSummaryError:()=>fa,getIsRequesting:()=>wa});var P={};r.r(P),r.d(P,{setIsRequestingAuthorization:()=>Ia,submitCancelAuthorization:()=>Na,submitCaptureAuthorization:()=>Aa,updateAuthorization:()=>ba,updateAuthorizations:()=>Ra,updateAuthorizationsSummary:()=>Oa,updateErrorForAuthorizations:()=>va,updateErrorForAuthorizationsSummary:()=>Ca});var D={};r.r(D),r.d(D,{getAuthorization:()=>Pa,getAuthorizations:()=>xa,getAuthorizationsSummary:()=>Da});var M={};r.r(M),r.d(M,{getFile:()=>Ua,getFileError:()=>ka});var F={};r.r(F),r.d(F,{updateErrorForFiles:()=>za,updateFiles:()=>La});var j={};r.r(j),r.d(j,{getFile:()=>$a});var U={};r.r(U),r.d(U,{getPmPromotions:()=>qa,getPmPromotionsError:()=>Va});var k={};r.r(k),r.d(k,{activatePmPromotion:()=>Qa,dismissPmPromotion:()=>Za,updateErrorForPmPromotions:()=>Wa,updatePmPromotions:()=>Ga});var L={};r.r(L),r.d(L,{getPmPromotions:()=>Ka});var z={};r.r(z),r.d(z,{getAvailableCurrencies:()=>as,getCurrencies:()=>ns,getCurrencySettings:()=>cs,getDefaultCurrency:()=>is,getEnabledCurrencies:()=>ss,getStoreSettings:()=>ds,isSavingStoreSettings:()=>ls,isStoreSettingsDirty:()=>us});var $={};r.r($),r.d($,{saveOption:()=>Rs,saveStoreSettings:()=>Ts,submitCurrencySettings:()=>ws,submitEnabledCurrenciesUpdate:()=>fs,updateAvailableCurrencies:()=>_s,updateCurrencies:()=>ms,updateCurrencySettings:()=>hs,updateDefaultCurrency:()=>ys,updateEnabledCurrencies:()=>ps,updateIsSavingStoreSettings:()=>Es,updateStoreSettingValues:()=>gs,updateStoreSettings:()=>Ss});var B={};r.r(B),r.d(B,{getCurrencies:()=>vs,getCurrencySettings:()=>bs,getStoreSettings:()=>Os});var Y=r(1609),q=r(5338);(0,Y.createContext)({isActive:!1,setActive:()=>null,isCompleted:!1,setCompleted:()=>null,taskId:""});var V=r(4848);(0,Y.createContext)({activeTask:"",setActiveTask:()=>null,completedTasks:{},setCompletedTasks:()=>null});const H=window.wp.components;function G(e){var t,r,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=G(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}const W=function(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=G(e))&&(o&&(o+=" "),o+=t);return o},Q=window.wp.primitives,Z=({children:e,actions:t,className:r,...o})=>(0,V.jsxs)(H.Modal,{className:W("wcpay-confirmation-modal",r),...o,children:[e,(0,V.jsx)(Q.HorizontalRule,{className:"wcpay-confirmation-modal__separator"}),(0,V.jsx)("div",{className:"wcpay-confirmation-modal__footer",children:t})]}),J=window.wp.i18n;r(5955),r(9031),r(4275),Y.Component;const K=({isLoading:e,display:t,placeholder:r,value:o,children:n})=>e?(0,V.jsx)("span",{className:t?`is-loadable-placeholder is-${t}`:"is-loadable-placeholder","aria-busy":"true",children:void 0===r?n||o:r}):(0,V.jsx)(V.Fragment,{children:n||o}),X=e=>{const t=(0,V.jsx)("p",{style:{lineHeight:e.numLines},children:"Block placeholder"});return(0,V.jsx)(K,{...e,placeholder:t,display:"block"})},ee=({Icon:e,label:t})=>e?(0,V.jsxs)("span",{className:W("woocommerce-payments__payment-method-icon"),children:[(0,V.jsx)(e,{}),t&&(0,V.jsx)("span",{className:"woocommerce-payments__payment-method-icon__label",children:t})]}):null,te=({children:e})=>(0,V.jsx)("div",{className:"wcpay-settings-layout",children:e}),re=({description:e=()=>null,children:t,className:r,id:o})=>(0,V.jsxs)("div",{className:W("settings-section",r),id:o,children:[(0,V.jsx)("div",{className:"settings-section__details",children:(0,V.jsx)(e,{})}),(0,V.jsx)("div",{className:"settings-section__controls",children:t})]}),oe=window.wp.domReady;var ne=r.n(oe);const ae=(e,t={})=>{if(window.wcpaySettings){Object.assign(t,{is_test_mode:wcpaySettings.testMode,jetpack_connected:wcpaySettings.isJetpackConnected,wcpay_version:wcpaySettings.version,woo_country_code:wcpaySettings.connect.country,hosting_provider:wcpaySettings.trackingInfo?.hosting_provider});for(const e in t)void 0===t[e]&&delete t[e]}ne()((()=>{var r;(null!==(r=wc?.tracks?.recordEvent)&&void 0!==r?r:wcTracks.recordEvent)(e,t)}))},se=((0,Y.createContext)(window.wcpaySettings),window.wc.currency);var ie=r.n(se);const ce=window.lodash,de=((0,J.__)("Australian dollar","woocommerce-payments"),(0,J.__)("Canadian dollar","woocommerce-payments"),(0,J.__)("Swiss franc","woocommerce-payments"),(0,J.__)("Danish krone","woocommerce-payments"),(0,J.__)("Euro","woocommerce-payments"),(0,J.__)("Pound sterling","woocommerce-payments"),(0,J.__)("Norwegian krone","woocommerce-payments"),(0,J.__)("New Zealand dollar","woocommerce-payments"),(0,J.__)("Swedish krona","woocommerce-payments"),(0,J.__)("United States (US) dollar","woocommerce-payments"),e=>wcpaySettings.zeroDecimalCurrencies.includes(e.toLowerCase())),ue=(e,t="USD",r=null,o=!1)=>{const n=de(t);n||(e/=100);const a=e<0,s=a?-1*e:e,i=a?"-":"",c=o?(e=>{const t=e.toUpperCase(),{currencyData:r,connect:{country:o="US"}}=wcpaySettings;if(r[o]?.code===t)return ie()(r[o]);const n=(0,ce.find)(r,{code:t});if(n){const{defaultLocale:e={}}=n;return e.hasOwnProperty("decimalSeparator")&&e.hasOwnProperty("thousandSeparator")&&e.hasOwnProperty("symbolPosition")&&(n.decimalSeparator=e.decimalSeparator,n.thousandSeparator=e.thousandSeparator,n.symbolPosition=e.symbolPosition),ie()(n)}return null})(t):((e,t=null)=>{const{currencyData:r,connect:{country:o="US"}}=wcpaySettings,n=(0,ce.find)(r,{code:e.toUpperCase()});if(n){if(null!==t&&t.toUpperCase()!==e.toUpperCase()||r[o]){const e=t?(0,ce.find)(r,{code:t.toUpperCase()}):r[o];e&&(n.decimalSeparator=e.decimalSeparator,n.thousandSeparator=e.thousandSeparator,n.symbolPosition=e.symbolPosition)}return ie()(n)}return null})(t,r);if(null===c)return i+le(s,t,n);try{return i+("function"==typeof c.formatAmount?me(c.formatAmount(s)):me(c.formatCurrency(s)))}catch(e){return i+me(le(s,t,n))}};function le(e,t,r){try{return e.toLocaleString(void 0,{style:"currency",currency:t,currencyDisplay:"narrowSymbol",dummy:r})}catch(o){return(0,J.sprintf)(r?"%s %i":"%s %.2f",t.toUpperCase(),e)}}function me(e){return(new DOMParser).parseFromString(e,"text/html").documentElement.textContent}const _e=window.wp.data,pe=window.wp.dataControls,ye="/wc/v3/payments",he="wc/payments",Se={SET_DEPOSIT:"SET_DEPOSIT",SET_DEPOSITS:"SET_DEPOSITS",SET_DEPOSITS_COUNT:"SET_DEPOSITS_COUNT",SET_ERROR_FOR_DEPOSIT_QUERY:"SET_ERROR_FOR_DEPOSIT_QUERY",SET_DEPOSITS_SUMMARY:"SET_DEPOSITS_SUMMARY",SET_ERROR_FOR_DEPOSITS_SUMMARY:"SET_ERROR_FOR_DEPOSITS_SUMMARY",SET_INSTANT_DEPOSIT:"SET_INSTANT_DEPOSIT",SET_ALL_DEPOSITS_OVERVIEWS:"SET_ALL_DEPOSITS_OVERVIEWS",SET_ERROR_FOR_ALL_DEPOSITS_OVERVIEWS:"SET_ERROR_FOR_ALL_DEPOSITS_OVERVIEWS"},ge=e=>JSON.stringify(e,Object.keys(e).sort()),Ee={byId:{},queries:{},count:0,instant:{}},fe=e=>e&&e.deposits||{},we=(e,t)=>(fe(e).byId||{})[t],Te=e=>{const t=fe(e).overviews||{};if(!t.data)return{account:null,currencies:[]};const{deposit:r,balance:o,account:n}=t.data,a={lastPaid:r.last_paid,pending:o.pending,available:o.available,instant:o.instant},s={};for(const[e,t]of Object.entries(a))t?.forEach((t=>{const{currency:r}=t;s[r]||(s[r]={currency:r,lastPaid:void 0,pending:void 0,available:void 0,instant:void 0}),s[r][e]=t}));const i=Object.values(s);return{account:n,currencies:[...i.filter((e=>n.default_currency===e.currency)),...i.filter((e=>n.default_currency!==e.currency))]}},Re=e=>(fe(e).overviews||{}).error,ve=(e,t)=>{const r=ge(t);return(fe(e).queries||{})[r]||{}},be=(e,t)=>(ve(e,t).data||[]).map(we.bind(void 0,e)),Oe=e=>fe(e).count,Ie=(e,t)=>ve(e,t).error||{},Ae=(e,t)=>{const r=ge(t);return(fe(e).summary||{})[r]||{}},Ne=(e,t)=>Ae(e,t).data||{},Ce=(e,t)=>Ae(e,t).error||{},xe=e=>(fe(e).instant||{}).data,Pe=window.wp.url,De=window.moment;var Me=r.n(De);const Fe=window.wp.date,je=(window.wc.number,e=>(0,Pe.addQueryArgs)("admin.php",e)),Ue=(e,t=!1)=>{const r=t?Me()(e).endOf("day").utc().toISOString():Me()(e).startOf("day").utc().toISOString();return e&&(0,Fe.dateI18n)("Y-m-d H:i:s",r,!0)};function ke(e){return{type:Se.SET_DEPOSIT,data:e}}function Le(e){return{type:Se.SET_ALL_DEPOSITS_OVERVIEWS,data:e}}function ze(e,t){return{type:Se.SET_ERROR_FOR_ALL_DEPOSITS_OVERVIEWS,error:t}}function $e(e,t){return{type:Se.SET_DEPOSITS,query:e,data:t}}function Be(e){return{type:Se.SET_DEPOSITS_COUNT,data:e}}function Ye(e,t,r){return{type:Se.SET_ERROR_FOR_DEPOSIT_QUERY,query:e,data:t,error:r}}function qe(e,t){return{type:Se.SET_DEPOSITS_SUMMARY,query:e,data:t}}function Ve(e,t,r){return{type:Se.SET_ERROR_FOR_DEPOSITS_SUMMARY,query:e,data:t,error:r}}function He(e){return{type:Se.SET_INSTANT_DEPOSIT,data:e}}function*Ge(e){try{yield(0,_e.dispatch)(he).startResolution("getInstantDeposit",[e]);const t=yield(0,pe.apiFetch)({path:"/wc/v3/payments/deposits",method:"POST",data:{type:"instant",currency:e}});yield He(t),yield(0,_e.dispatch)(he).invalidateResolutionForStoreSelector("getDeposits"),yield(0,_e.dispatch)(he).invalidateResolutionForStoreSelector("getAllDepositsOverviews"),yield(0,_e.dispatch)("core/notices").createSuccessNotice((0,J.sprintf)((0,J.__)("Instant payout for %s in transit.","woocommerce-payments"),ue(t.amount)),{actions:[{label:(0,J.__)("View details","woocommerce-payments"),url:je({page:"wc-admin",path:"/payments/payouts/details",id:t.id})}]})}catch{yield(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error creating instant payout.","woocommerce-payments"))}finally{yield(0,_e.dispatch)(he).finishResolution("getInstantDeposit",[e])}}function*We(e){if(/\W/.test(e))return;const t=(0,Pe.addQueryArgs)(`${ye}/deposits/${e}`);try{const e=yield(0,pe.apiFetch)({path:t});yield ke(e)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving payout.","woocommerce-payments"))}}function*Qe(){const e=(0,Pe.addQueryArgs)(`${ye}/deposits/overview-all`);try{const t=yield(0,pe.apiFetch)({path:e});yield Le(t)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving all payouts' overviews.","woocommerce-payments")),yield ze()}}const Ze=e=>({user_email:e.userEmail,match:e.match,store_currency_is:e.storeCurrencyIs,date_before:Ue(e.dateBefore,!0),date_after:Ue(e.dateAfter),date_between:e.dateBetween&&[Ue(e.dateBetween[0]),Ue(e.dateBetween[1],!0)],status_is:e.statusIs,status_is_not:e.statusIsNot,locale:e.locale}),Je=`${ye}/deposits/download`;function Ke(e){return(0,Pe.addQueryArgs)(Je,Ze(e))}function*Xe(e){const t=(0,Pe.addQueryArgs)(`${ye}/deposits`,{page:e.paged,pagesize:e.perPage,sort:e.orderby,direction:e.order,...Ze(e)});try{const r=yield(0,pe.apiFetch)({path:t})||{};yield $e(e,r.data),yield Be(r.total_count);for(const e in r.data)yield _e.controls.dispatch(he,"finishResolution","getDeposit",[r.data[e].id])}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving payouts.","woocommerce-payments")),yield Ye(e,null,t)}}function*et(e){const t=(0,Pe.addQueryArgs)(`${ye}/deposits/summary`,Ze(e));try{const r=yield(0,pe.apiFetch)({path:t});yield qe(e,r)}catch(t){yield Ve(e,null,t)}}const tt={SET_TRANSACTIONS:"SET_TRANSACTIONS",SET_ERROR_FOR_TRANSACTIONS:"SET_ERROR_FOR_TRANSACTIONS",SET_TRANSACTIONS_SUMMARY:"SET_TRANSACTIONS_SUMMARY",SET_ERROR_FOR_TRANSACTIONS_SUMMARY:"SET_ERROR_FOR_TRANSACTIONS_SUMMARY",SET_FRAUD_OUTCOME_TRANSACTIONS:"SET_FRAUD_OUTCOME_TRANSACTIONS",SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS:"SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS",SET_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY:"SET_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY",SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY:"SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY"},rt={summary:{},fraudProtection:{review:{summary:{}},block:{summary:{}}}},ot=e=>e&&e.transactions||{},nt=(e,t)=>{const r=ge(t);return ot(e)[r]||{}},at=(e,t)=>nt(e,t).data||[],st=(e,t)=>nt(e,t).error||{},it=(e,t)=>{const r=ge(t);return ot(e).summary[r]||{}},ct=(e,t)=>it(e,t).data||{},dt=(e,t)=>it(e,t).error||{},ut=(e,t,r)=>{const o=ge(r);return ot(e).fraudProtection?.[t]?.[o]||{}},lt=(e,t,r)=>ut(e,t,r).data||[],mt=(e,t,r)=>ut(e,t,r).error||{},_t=(e,t,r)=>{const o=ge(r);return ot(e).fraudProtection?.[t]?.summary[o]||{}},pt=(e,t,r)=>_t(e,t,r).data||{},yt=(e,t,r)=>_t(e,t,r).error||{};function ht(e,t){return{type:tt.SET_TRANSACTIONS,query:e,data:t}}function St(e,t,r){return{type:tt.SET_ERROR_FOR_TRANSACTIONS,query:e,data:t,error:r}}function gt(e,t){return{type:tt.SET_TRANSACTIONS_SUMMARY,query:e,data:t}}function Et(e,t,r){return{type:tt.SET_ERROR_FOR_TRANSACTIONS_SUMMARY,query:e,data:t,error:r}}function ft(e,t,r){return{type:tt.SET_FRAUD_OUTCOME_TRANSACTIONS,status:e,query:t,data:r}}function wt(e,t,r){return{type:tt.SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS,status:e,query:t,data:null,error:r}}function Tt(e,t,r){return{type:tt.SET_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY,status:e,query:t,data:r}}function Rt(e,t,r){return{type:tt.SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY,status:e,query:t,data:null,error:r}}const vt=e=>({user_email:e.userEmail,match:e.match,date_before:Ue(e.dateBefore,!0),date_after:Ue(e.dateAfter),date_between:e.dateBetween&&[Ue(e.dateBetween[0]),Ue(e.dateBetween[1],!0)],type_is:e.typeIs,type_is_not:e.typeIsNot,type_is_in:e.typeIsIn,source_device_is:e.sourceDeviceIs,source_device_is_not:e.sourceDeviceIsNot,channel_is:e.channelIs,channel_is_not:e.channelIsNot,customer_country_is:e.customerCountryIs,customer_country_is_not:e.customerCountryIsNot,risk_level_is:e.riskLevelIs,risk_level_is_not:e.riskLevelIsNot,store_currency_is:e.storeCurrencyIs,loan_id_is:e.loanIdIs,deposit_id:e.depositId,customer_currency_is:e.customerCurrencyIs,customer_currency_is_not:e.customerCurrencyIsNot,source_is:e.sourceIs,source_is_not:e.sourceIsNot,search:e.search,user_timezone:Me()(new Date).format("Z"),locale:e.locale});function*bt(e){const t=(0,Pe.addQueryArgs)(`${ye}/transactions`,{page:e.paged,pagesize:e.perPage,sort:e.orderby,direction:e.order,...vt(e)});try{const r=yield(0,pe.apiFetch)({path:t});yield ht(e,r.data||[])}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving transactions.","woocommerce-payments")),yield St(e,null,t)}}const Ot=`${ye}/transactions/download`;function It(e){return(0,Pe.addQueryArgs)(Ot,vt(e))}function*At(e){const t=(0,Pe.addQueryArgs)(`${ye}/transactions/summary`,vt(e));try{const r=yield(0,pe.apiFetch)({path:t});yield gt(e,r)}catch(t){yield Et(e,null,t)}}function*Nt(e,t){const r=(0,Pe.addQueryArgs)(`${ye}/transactions/fraud-outcomes`,{status:e,page:t.paged,sort:t.orderby,pagesize:t.perPage,direction:t.order,additional_status:t.additionalStatus,...vt(t)});try{const o=yield(0,pe.apiFetch)({path:r});yield ft(e,t,o.data||[])}catch(r){if("wcpay_fraud_outcome_not_found"===r.code)return void(yield ft(e,t,[]));yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving transactions.","woocommerce-payments")),yield wt(e,t,r)}}function*Ct(e,t){const r=(0,Pe.addQueryArgs)(`${ye}/transactions/fraud-outcomes/summary`,{status:e,additional_status:t.additionalStatus}),o={count:0,total:0};try{const n=yield(0,pe.apiFetch)({path:r});yield Tt(e,t,n||o)}catch(r){if("wcpay_fraud_outcome_not_found"===r.code)return void(yield Tt(e,t,o));yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving on review transactions.","woocommerce-payments")),yield Rt(e,t,r)}}function xt(e,t){return(0,Pe.addQueryArgs)(`${ye}/transactions/fraud-outcomes/download`,{status:e,sort:t.orderby,direction:t.order,additional_status:t.additionalStatus,...vt(t)})}const Pt={SET_CHARGE:"SET_CHARGE",SET_ERROR_FOR_CHARGE:"SET_ERROR_FOR_CHARGE"},Dt=(e,t)=>e.charges[t]&&e.charges[t].data?e.charges[t].data:{},Mt=(e,t)=>e.charges[t]&&e.charges[t].error?e.charges[t].error:{},Ft=(e,t)=>Dt(e,t),jt=(e,t)=>Mt(e,t);function Ut(e,t){return{type:Pt.SET_CHARGE,id:e,data:t}}function kt(e,t,r){return{type:Pt.SET_ERROR_FOR_CHARGE,id:e,data:t,error:r}}function*Lt(e){try{const t=yield(0,pe.apiFetch)({path:`${ye}/charges/${e}`});yield Ut(e,t)}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving transaction.","woocommerce-payments")),yield kt(e,null,t)}}function*zt(e){try{const t=yield(0,pe.apiFetch)({path:`${ye}/charges/order/${e}`});yield Ut(e,t)}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving transaction.","woocommerce-payments")),yield kt(e,null,t)}}const $t={SET_TIMELINE:"SET_TIMELINE",SET_ERROR_FOR_TIMELINE:"SET_ERROR_FOR_TIMELINE"},Bt=(e,t)=>e.timeline&&e.timeline[t]&&e.timeline[t].data?e.timeline[t].data:{},Yt=(e,t)=>e.timeline&&e.timeline[t]&&e.timeline[t].error?e.timeline[t].error:{};function qt(e,t){return{id:e,type:$t.SET_TIMELINE,data:t}}function Vt(e,t){return{id:e,type:$t.SET_ERROR_FOR_TIMELINE,error:t}}function*Ht(e){try{const t=yield(0,pe.apiFetch)({path:`${ye}/timeline/${e}`});yield qt(e,t.data)}catch(t){yield Vt(e,t)}}const Gt={SET_DISPUTE:"SET_DISPUTE",SET_ERROR_FOR_DISPUTE:"SET_ERROR_FOR_DISPUTE",SET_DISPUTES:"SET_DISPUTES",SET_DISPUTES_SUMMARY:"SET_DISPUTES_SUMMARY"},Wt={byId:{},queries:{},summary:{},cached:{}},Qt=e=>e&&e.disputes||{},Zt=(e,t)=>(Qt(e).byId||{})[t],Jt=(e,t)=>{const r=Qt(e).byId||{};return r[t]?.error},Kt=(e,t)=>(Qt(e).cached||{})[t],Xt=(e,t)=>{const r=((e,t)=>{const r=ge(t);return(Qt(e).queries||{})[r]||{}})(e,t).data||[];return r.map(Kt.bind(void 0,e))},er=(e,t)=>((e,t)=>{const r=ge(t);return(Qt(e).summary||{})[r]||{}})(e,t).data||{};var tr=function(e){return e.SET_PAYMENT_INTENT="SET_PAYMENT_INTENT",e.SET_ERROR_FOR_PAYMENT_INTENT="SET_ERROR_FOR_PAYMENT_INTENT",e}(tr||{});const rr=tr;function or(e,t){return{type:rr.SET_PAYMENT_INTENT,id:e,data:t}}function nr(e,t){return{type:rr.SET_ERROR_FOR_PAYMENT_INTENT,id:e,error:t}}function*ar(e,t){const r=e.payment_intent;try{yield(0,pe.apiFetch)({path:"/wc/v3/payments/refund/",method:"post",data:{charge_id:e.id,amount:e.amount,reason:t,order_id:e?.order?.id}}),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getTimeline"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getPaymentIntent"),yield _e.controls.dispatch("core/notices","createSuccessNotice",(0,J.sprintf)((0,J.__)("Refunded payment #%s.","woocommerce-payments"),r))}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.sprintf)((0,J.__)("There has been an error refunding the payment #%s. Please try again later.","woocommerce-payments"),r))}}function*sr(e){try{const t=yield(0,pe.apiFetch)({path:`${ye}/payment_intents/${e}`});yield or(e,t)}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving transaction.","woocommerce-payments")),yield nr(e,t)}}function ir(e){return{type:Gt.SET_DISPUTE,data:e}}function cr(e,t,r){return{type:Gt.SET_ERROR_FOR_DISPUTE,id:e,data:t,error:r}}function dr(e,t){return{type:Gt.SET_DISPUTES,query:e,data:t}}function ur(e,t){return{type:Gt.SET_DISPUTES_SUMMARY,query:e,data:t}}function*lr(e){const{id:t,payment_intent:r}=e;try{yield _e.controls.dispatch(he,"startResolution","getDispute",[t]);const e=yield(0,pe.apiFetch)({path:`${ye}/disputes/${t}/close`,method:"post"});yield ir(e),yield sr(r),yield _e.controls.dispatch(he,"finishResolution","getDispute",[t]);const o=e.order?(0,J.sprintf)((0,J.__)("You have accepted the dispute for order #%s.","woocommerce-payments"),e.order.number):(0,J.__)("You have accepted the dispute.","woocommerce-payments");yield _e.controls.dispatch("core/notices","createSuccessNotice",o)}catch(e){const r=(0,J.__)("There has been an error accepting the dispute. Please try again later.","woocommerce-payments");yield _e.controls.dispatch("core/notices","createErrorNotice",r),yield _e.controls.dispatch(he,"finishResolution","getDispute",[t])}}const mr=window.wc.wcSettings,_r=((0,J.__)("Bank cannot process","woocommerce-payments"),(0,J.__)("Check returned","woocommerce-payments"),(0,J.__)("Credit not processed","woocommerce-payments"),(0,J.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,J.__)("If your customer was not refunded appropriately, you will need to accept the dispute, or resolve the issue with your customer. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,J.__)("The customer claims that the purchased product was returned or the transaction was otherwise canceled, but you have not yet provided a refund or credit.","woocommerce-payments"),(0,J.__)("Demonstrate that you have refunded your customer through other means or that your customer is not entitled to a refund. You cannot issue a refund while a payment is being disputed. If you believe that your customer was entitled a refund that you did not provide, you can accept the dispute.","woocommerce-payments"),(0,J.__)("You should first get in touch with your customer. If you understand what their complaint is, there is a chance for you to explain the misunderstanding or to make it right. If you’re able to resolve the issue with your customer, you can ask that they withdraw the dispute.","woocommerce-payments"),(0,J.__)("If the cardholder agrees to withdraw the dispute, you should still submit evidence for the dispute using the forms on the next screen. In addition to the following evidence, your submission should include correspondence with the cardholder saying they would withdraw the dispute and a written statement from their card issuer confirming that the dispute has been withdrawn.","woocommerce-payments"),(0,J.__)("The cardholder claims a credit was not processed.","woocommerce-payments"),(0,J.__)("Customer initiated","woocommerce-payments"),(0,J.__)("Debit not authorized","woocommerce-payments"),(0,J.__)("Duplicate","woocommerce-payments"),(0,J.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,J.__)("If there were duplicate payments, you should accept the dispute. You cannot issue a refund while a payment is being disputed. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,J.__)("The customer claims they were charged multiple times for the same product or service.","woocommerce-payments"),(0,J.__)("Demonstrate that each payment was for a separate product or service.","woocommerce-payments"),(0,J.__)("Determine if your customer was incorrectly charged multiple times.","woocommerce-payments"),(0,J.__)("If they were not, collect any and all information documenting that each payment was made separately, such as copies of receipts. If the receipts don’t include the items purchased, be sure to include an itemized list. Each receipt should clearly indicate that the payments are for separate purchases of items or services. If you’ve been able to get in touch with the customer you should be sure to address any concerns they had in your evidence.","woocommerce-payments"),(0,J.__)("If there have been two or more separate payments, you should get in touch with your customer. If you understand what their complaint is, there is a chance for you to explain the misunderstanding or to make it right. If you’re able to resolve the issue with your customer, you can ask that they withdraw the dispute.","woocommerce-payments"),(0,J.__)("Even if your customer agrees to withdraw the dispute, you must still submit appropriate evidence using the forms on the next screen. Simply saying that your customer is going to withdraw the dispute is not sufficient evidence.","woocommerce-payments"),(0,J.__)("The cardholder claims this is a duplicate transaction.","woocommerce-payments"),(0,J.__)("Transaction unauthorized","woocommerce-payments"),(0,J.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,J.__)("If you believe the payment was actually made using a stolen credit card, you will need to accept the dispute. The credit card networks place liability for accepting unauthorized transactions with you, the business.","woocommerce-payments"),(0,J.__)("This is the most common reason for a dispute, and happens when a cardholder claims that they didn’t authorize the payment. This can happen if the card was lost or stolen and used to make an unauthorized transaction. It can also happen if the cardholder doesn’t recognize the payment as it appears on the billing statement from their card issuer.","woocommerce-payments"),(0,J.__)("Provide adequate payment and order details so that a legitimate customer recognizes it, or proves to the card issuer that their cardholder authorized the transaction.","woocommerce-payments"),(0,J.__)("Try to get in touch with your customer. Sometimes people forget about payments they make or don’t recognize the way they appear on their card statement. If this is the case, ask them to contact their card issuer and let them know they no longer dispute the transaction.","woocommerce-payments"),(0,J.__)("Even if your customer agrees to withdraw the dispute, you must still submit appropriate evidence using the forms on the next screen. Simply saying that your customer is going to withdraw the dispute is not sufficient evidence.","woocommerce-payments"),(0,J.__)("It may be more efficient—and provide a better customer experience—to accept an accidental dispute and charge the customer again, if appropriate. Even when a dispute is withdrawn, it usually takes approximately 75 days to be finalized. Remember, it doesn’t matter to the card networks whether you win or lose a dispute; what matters is how many disputes a business receives, regardless of how many disputes are won.","woocommerce-payments"),(0,J.__)("The cardholder claims this is an unauthorized transaction.","woocommerce-payments"),(0,J.__)("General","woocommerce-payments"),(0,J.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,J.__)("This is an uncategorized dispute, so you should contact the customer for additional details to find out why the payment was disputed.","woocommerce-payments"),(0,J.__)("Incorrect account details","woocommerce-payments"),(0,J.__)("Insufficient funds","woocommerce-payments"),(0,J.__)("Product not received","woocommerce-payments"),(0,J.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,J.__)("If you can not prove the customer received their product or service, you should accept the dispute. You cannot issue a refund while a payment is being disputed. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,J.__)("The customer claims they did not receive the products or services purchased.","woocommerce-payments"),(0,J.__)("Prove that the customer received a physical product or offline service, or made use of a digital product or online service. This must have occurred prior to the date the dispute was initiated.","woocommerce-payments"),(0,J.__)("First, get in touch with your customer. Understanding why they filed the dispute will be important for helping make sure your customer gets the product and will give you critical information to prevent this from happening to others.","woocommerce-payments"),(0,J.__)("Even if your customer agrees to withdraw the dispute, you must still submit appropriate evidence using the forms on the next screen. Simply saying that your customer is going to withdraw the dispute is not sufficient evidence.","woocommerce-payments"),(0,J.__)("The cardholder claims they did not receive the product.","woocommerce-payments"),(0,J.__)("Product unacceptable","woocommerce-payments"),(0,J.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,J.__)("If you can not prove the customer received their product or service as described, you should accept the dispute. You cannot issue a refund while a payment is being disputed. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,J.__)("The product or service was received but was defective, damaged, or not as described.","woocommerce-payments"),(0,J.__)("Demonstrate that the product or service was delivered as described at the time of purchase.","woocommerce-payments"),(0,J.__)("If the product or service is as described, provide specific information (invoice, contract, etc.) to refute the cardholder’s claims. Quality disputes are where the customer does not agree with the condition of merchandise or service received (e.g., a car repair situation or quality of a hotel room). There may be instances where you will need to obtain a neutral third-party opinion to help corroborate your claim against the cardholder. Provide as much specific information and documentation as possible to refute the cardholder’s claims. It is recommended that you address each point that the cardholder has made.","woocommerce-payments"),(0,J.__)("If the customer has not yet returned the product or canceled the service, provide specific information to that effect. You should double-check your incoming shipping records to verify that you have not received a return before you respond. If you have processed a credit or reversal for this transaction, provide evidence of this which includes the amount and date processed.","woocommerce-payments"),(0,J.__)("For products that have been repaired or replaced, provide evidence that the cardholder agreed to a repair or replacement, it has been received by the customer, and the repair or replacement has not since been disputed.","woocommerce-payments"),(0,J.__)("If your customer made no attempt to return the product or cancel the service, or if you provided a replacement product or service, make sure to note that as well.","woocommerce-payments"),(0,J.__)("If the customer withdraws their dispute you should still submit evidence using the forms on the next screen. Be sure to provide a letter or email from the cardholder stating that they are no longer in dispute.","woocommerce-payments"),(0,J.__)("The cardholder claims the product was unacceptable.","woocommerce-payments"),(0,J.__)("Subscription canceled","woocommerce-payments"),(0,J.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,J.__)("If you can not prove the customer’s subscription was canceled, and or they did not follow your cancellation policy, you should accept the dispute. You cannot issue a refund while a payment is being disputed. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,J.__)("The customer claims that you continued to charge them after a subscription was canceled.","woocommerce-payments"),(0,J.__)("Prove that the subscription was still active and that the customer was aware of, and did not follow, your cancellation procedure.","woocommerce-payments"),(0,J.__)("First, get in touch with your customer. If you understand what they believe happened, there is a chance for you to explain the misunderstanding or to make it right. ","woocommerce-payments"),(0,J.__)("Even if your customer agrees to withdraw the dispute, you must still submit appropriate evidence using the forms on the next screen. Simply saying that your customer is going to withdraw the dispute is not sufficient evidence.","woocommerce-payments"),(0,J.__)("Otherwise, use the forms on the next screen to submit evidence that the subscription was still active and that the customer was aware of, and did not follow, your cancellation procedure.","woocommerce-payments"),(0,J.__)("The cardholder claims a subscription was canceled.","woocommerce-payments"),(0,J.__)("Unrecognized","woocommerce-payments"),(0,J.__)("If you believe the dispute is invalid, you can challenge it by submitting the appropriate evidence using the response forms on the next screen.","woocommerce-payments"),(0,J.__)("If you can not prove the customer’s subscription was canceled, and or they did not follow your cancellation policy, you should accept the dispute. You cannot issue a refund while a payment is being disputed. The credit card networks place liability for accepting disputed payments with you, the business.","woocommerce-payments"),(0,J.__)("The customer doesn’t recognize the payment appearing on their card statement.","woocommerce-payments"),(0,J.__)("Get your customer to withdraw the dispute by helping them identify the payment. Otherwise, challenge the dispute with appropriate evidence that proves the purchase was legitimate. ","woocommerce-payments"),(0,J.__)("First, try to get in touch with your customer. Sometimes people forget about payments they make or don’t recognize the way they appear on their card statement. If this is the case, ask them to contact their card issuer and let them know they no longer dispute the transaction. Even if your customer agrees to withdraw the dispute, you must still submit appropriate evidence. Simply saying that your customer is going to withdraw the dispute is not sufficient evidence.","woocommerce-payments"),(0,J.__)("It may be more efficient—and provide a better customer experience—to accept an accidental dispute and charge the customer again, if appropriate. Even when a dispute is withdrawn, it usually takes approximately 75 days to be finalized. Remember, it doesn’t matter to the card networks whether you win or lose a dispute; what matters is how many disputes a business receives, regardless of how many disputes are won.","woocommerce-payments"),(0,J.__)("Non-compliant","woocommerce-payments"),(0,J.__)("Your customer’s bank claims this payment violates Visa’s rules.","woocommerce-payments"),(0,J.__)("This transaction is being reviewed under Visa’s network compliance rules.","woocommerce-payments"),{warning_needs_response:(0,J.__)("Inquiry: Response needed","woocommerce-payments"),warning_under_review:(0,J.__)("Inquiry: Under review","woocommerce-payments"),warning_closed:(0,J.__)("Inquiry: Closed","woocommerce-payments"),needs_response:(0,J.__)("Response needed","woocommerce-payments"),under_review:(0,J.__)("Under review","woocommerce-payments"),charge_refunded:(0,J.__)("Charge refunded","woocommerce-payments"),won:(0,J.__)("Won","woocommerce-payments"),lost:(0,J.__)("Lost","woocommerce-payments")}),pr=(Object.entries(_r).map((([e,t])=>({label:t,value:e}))).filter((function(e){return null!=e})),["needs_response","warning_needs_response"]),yr=((0,J.__)("Dispute currency","woocommerce-payments"),(0,J.__)("All currencies","woocommerce-payments"),(0,J.__)("Show","woocommerce-payments"),(0,J.__)("Needs response","woocommerce-payments"),(0,J.__)("All disputes","woocommerce-payments"),(0,J.__)("Advanced filters","woocommerce-payments"),(0,mr.getSetting)("wcVersion")),hr=parseFloat(yr),Sr=(hr<7.8?(0,J.__)("Disputes match {{select /}} filters","woocommerce-payments"):(0,J.__)("Disputes match <select /> filters","woocommerce-payments"),(0,J.__)("Disputed on date","woocommerce-payments"),(0,J.__)("Remove dispute date filter","woocommerce-payments"),(0,J.__)("Select a dispute date filter match","woocommerce-payments"),hr<7.8?(0,J.__)("{{title}}Date{{/title}} {{rule /}} {{filter /}}","woocommerce-payments"):(0,J.__)("<title>Date</title> <rule /> <filter />","woocommerce-payments"),(0,J.__)("Select a dispute date","woocommerce-payments"),(0,J.__)("Before","woocommerce-payments"),(0,J.__)("After","woocommerce-payments"),(0,J.__)("Between","woocommerce-payments"),(0,J.__)("Status","woocommerce-payments"),(0,J.__)("Remove dispute status filter","woocommerce-payments"),(0,J.__)("Select a dispute status filter match","woocommerce-payments"),hr<7.8?(0,J.__)("{{title}}Status{{/title}} {{rule /}} {{filter /}}","woocommerce-payments"):(0,J.__)("<title>Status</title> <rule /> <filter />","woocommerce-payments"),(0,J.__)("Select a dispute status","woocommerce-payments"),(0,J._x)("Is","dispute status","woocommerce-payments"),(0,J._x)("Is not","dispute status","woocommerce-payments"),e=>({user_email:e.userEmail,match:e.match,store_currency_is:e.storeCurrencyIs,date_before:Ue(e.dateBefore,!0),date_after:Ue(e.dateAfter),date_between:e.dateBetween&&[Ue(e.dateBetween[0]),Ue(e.dateBetween[1],!0)],search:"awaiting_response"===e.filter?pr:e.search,status_is:e.statusIs,status_is_not:e.statusIsNot,locale:e.locale})),gr=`${ye}/disputes/download`;function Er(e){return(0,Pe.addQueryArgs)(gr,Sr(e))}function*fr(e){const t=(0,Pe.addQueryArgs)(`${ye}/disputes/${e}`);try{const e=yield(0,pe.apiFetch)({path:t});yield ir(e)}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving dispute.","woocommerce-payments")),yield cr(e,void 0,t)}}function*wr(e){const t=(0,Pe.addQueryArgs)(`${ye}/disputes`,{page:e.paged,pagesize:e.perPage,sort:(0,ce.snakeCase)(e.orderBy),direction:e.order,...Sr(e)});try{const r=yield(0,pe.apiFetch)({path:t})||{};yield dr(e,r.data)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving disputes.","woocommerce-payments"))}}function*Tr(e){const t=(0,Pe.addQueryArgs)(`${ye}/disputes/summary`,{page:e.paged,pagesize:e.perPage,...Sr(e)});try{const r=yield(0,pe.apiFetch)({path:t});yield ur(e,r)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving the summary of disputes.","woocommerce-payments"))}}const Rr={SET_SETTINGS:"SET_SETTINGS",SET_SETTINGS_VALUES:"SET_SETTINGS_VALUES",SET_IS_SAVING_SETTINGS:"SET_IS_SAVING_SETTINGS",SET_SELECTED_PAYMENT_METHOD:"SET_SELECTED_PAYMENT_METHOD",SET_UNSELECTED_PAYMENT_METHOD:"SET_UNSELECTED_PAYMENT_METHOD"},vr={isDirty:!1,isSaving:!1,savingError:null,data:{}},br={},Or=[],Ir=e=>e&&e.settings||br,Ar=e=>Ir(e).data||br,Nr=e=>Ar(e).duplicated_payment_method_ids||br,Cr=e=>Ar(e).is_wcpay_enabled||!1,xr=e=>Ar(e).enabled_payment_method_ids||Or,Pr=e=>Ar(e).available_payment_method_ids||Or,Dr=e=>Ar(e).payment_method_statuses||br,Mr=e=>Ir(e).isSaving||!1,Fr=e=>Ir(e).isDirty||!1,jr=e=>Ar(e).account_statement_descriptor||"",Ur=e=>Ar(e).account_statement_descriptor_kanji||"",kr=e=>Ar(e).account_statement_descriptor_kana||"",Lr=e=>Ar(e).account_business_support_email||"",zr=e=>Ar(e).account_business_support_phone||"",$r=e=>Ar(e).account_domestic_currency||"",Br=e=>Ar(e).deposit_schedule_interval||"",Yr=e=>Ar(e).deposit_schedule_weekly_anchor||"",qr=e=>Ar(e).deposit_schedule_monthly_anchor||"",Vr=e=>Ar(e).deposit_delay_days||"7",Hr=e=>Ar(e).deposit_completed_waiting_period||!1,Gr=e=>Ar(e).deposit_status||"",Wr=e=>Ar(e).deposit_restrictions||"",Qr=e=>Ar(e).is_manual_capture_enabled||!1,Zr=e=>Ar(e).is_test_mode_enabled||!1,Jr=e=>Ar(e).is_test_mode_onboarding||!1,Kr=e=>Ar(e).is_dev_mode_enabled||!1,Xr=e=>Ar(e).is_payment_request_enabled||!1,eo=e=>Ar(e).is_express_checkout_in_payment_methods_enabled||!1,to=e=>Ar(e).is_debug_log_enabled||!1,ro=e=>Ar(e).is_multi_currency_enabled||!1,oo=e=>Ar(e).payment_request_button_type||"",no=e=>Ar(e).payment_request_button_size||"",ao=e=>Ar(e).payment_request_button_theme||"",so=e=>{const t=Ar(e)?.payment_request_button_border_radius;return 0===t||"0"===t||t?t:"undefined"==typeof wcpaySettings?4:parseInt(window?.wcpaySettings?.defaultExpressCheckoutBorderRadius||4,10)},io=e=>Ar(e).is_saved_cards_enabled||!1,co=e=>Ir(e).savingError,uo=e=>Ar(e).is_card_present_eligible||!1,lo=e=>Ar(e).is_wcpay_subscriptions_enabled||!1,mo=e=>Ar(e).is_wcpay_subscriptions_eligible||!1,_o=e=>Ar(e).is_subscriptions_plugin_active||!1,po=e=>Ar(e).is_woopay_enabled||!1,yo=e=>Ar(e).is_woopay_global_theme_support_enabled||!1,ho=e=>Ar(e).woopay_custom_message||"",So=e=>Ar(e).woopay_store_logo||"",go=e=>Ar(e).current_protection_level||"basic",Eo=e=>Ar(e).advanced_fraud_protection_settings||Or,fo=e=>Ar(e).show_woopay_incompatibility_notice||!1,wo=e=>Ar(e).is_stripe_billing_enabled||!1,To=e=>Ar(e).is_migrating_stripe_billing||!1,Ro=e=>Ar(e).stripe_billing_subscription_count||0,vo=e=>Ar(e).stripe_billing_migrated_count||0,bo=e=>Ar(e).account_communications_email||"",Oo=e=>Ar(e).express_checkout_product_methods||Or,Io=e=>Ar(e).express_checkout_cart_methods||Or,Ao=e=>Ar(e).express_checkout_checkout_methods||Or,No=window.wp.apiFetch;var Co=r.n(No);function xo(e){return{type:Rr.SET_SETTINGS_VALUES,payload:e}}function Po(e){return xo({is_saved_cards_enabled:e})}function Do(e){return xo({is_card_present_eligible:e})}function Mo(e){return xo({payment_request_button_type:e})}function Fo(e){return xo({payment_request_button_size:e})}function jo(e){return xo({payment_request_button_theme:e})}function Uo(e){return xo({payment_request_button_border_radius:e})}function ko(e){return{type:Rr.SET_SETTINGS,data:e}}function Lo(e){return xo({is_wcpay_enabled:e})}function zo(e){return xo({is_payment_request_enabled:e})}function $o(e){return xo({is_express_checkout_in_payment_methods_enabled:e})}function Bo(e){return xo({enabled_payment_method_ids:[...e]})}function Yo(e,t){return{type:Rr.SET_IS_SAVING_SETTINGS,isSaving:e,error:t}}function qo(e){return{type:Rr.SET_SELECTED_PAYMENT_METHOD,id:e}}function Vo(e){return{type:Rr.SET_UNSELECTED_PAYMENT_METHOD,id:e}}function Ho(e){return xo({is_manual_capture_enabled:e})}function Go(e){return xo({is_test_mode_enabled:e})}function Wo(e){return xo({is_debug_log_enabled:e})}function Qo(e){return xo({is_multi_currency_enabled:e})}function Zo(e){return xo({is_wcpay_subscriptions_enabled:e})}function Jo(e){return xo({account_statement_descriptor:e})}function Ko(e){return xo({account_statement_descriptor_kanji:e})}function Xo(e){return xo({account_statement_descriptor_kana:e})}function en(e){return xo({account_business_support_email:e})}function tn(e){return xo({account_business_support_phone:e})}function rn(e){return xo({deposit_schedule_interval:e})}function on(e){return xo({deposit_schedule_weekly_anchor:e})}function nn(e){return xo({deposit_schedule_monthly_anchor:""===e?null:parseInt(e,10)})}function*an(){let e=null;try{const e=(0,_e.select)(he).getSettings();yield Yo(!0,null);const t=yield(0,pe.apiFetch)({path:`${ye}/settings`,method:"post",data:e});yield xo({payment_method_statuses:t.data.payment_method_statuses}),yield(0,_e.dispatch)("core/notices").createSuccessNotice((0,J.__)("Settings saved.","woocommerce-payments"))}catch(t){e=t,yield(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error saving settings.","woocommerce-payments")),e.server_error&&(yield(0,_e.dispatch)("core/notices").createErrorNotice(e.server_error))}finally{yield Yo(!1,e)}return null===e}function sn(e){return xo({is_woopay_enabled:e})}function cn(e){return xo({is_woopay_global_theme_support_enabled:e})}function dn(e){return xo({woopay_custom_message:e})}function un(e){return xo({woopay_store_logo:e})}function ln(e){return xo({current_protection_level:e})}function mn(e){return xo({advanced_fraud_protection_settings:e})}function _n(e){return xo({is_stripe_billing_enabled:e})}function pn(e){return xo({account_communications_email:e})}function yn(e){return xo({express_checkout_product_methods:[...e]})}function hn(e){return xo({express_checkout_cart_methods:[...e]})}function Sn(e){return xo({express_checkout_checkout_methods:[...e]})}function*gn(){try{yield(0,_e.dispatch)(he).startResolution("scheduleStripeBillingMigration"),yield(0,pe.apiFetch)({path:`${ye}/settings/schedule-stripe-billing-migration`,method:"post"})}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error starting the Stripe Billing migration.","woocommerce-payments"))}yield(0,_e.dispatch)(he).finishResolution("scheduleStripeBillingMigration")}function En(e,t){return Co()({path:`${ye}/settings/${e}`,method:"post",data:{value:t}}).catch((()=>{(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error saving option","woocommerce-payments"))}))}function*fn(){const e=`${ye}/settings`;try{const t=yield(0,pe.apiFetch)({path:e});yield ko(t)}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error retrieving settings.","woocommerce-payments"))}}const wn=e=>()=>{const{updateExpressCheckoutProductMethods:t,updateExpressCheckoutCartMethods:r,updateExpressCheckoutCheckoutMethods:o}=(0,_e.useDispatch)(he),n=(0,_e.useSelect)((e=>e(he).getExpressCheckoutProductMethods())),a=(0,_e.useSelect)((e=>e(he).getExpressCheckoutCartMethods())),s=(0,_e.useSelect)((e=>e(he).getExpressCheckoutCheckoutMethods())),i={product:n,cart:a,checkout:s},c={product:t,cart:r,checkout:o};return[[n.includes(e)&&"product",a.includes(e)&&"cart",s.includes(e)&&"checkout"].filter(Boolean),(t,r)=>{c[t](r?[...i[t],e]:i[t].filter((t=>t!==e)))}]},Tn=(wn("payment_request"),wn("woopay"),wn("amazon_pay"),{SET_CARD_READER_STATS:"SET_CARD_READER_STATS",SET_ERROR_FOR_CARD_READER_STATS:"SET_ERROR_FOR_CARD_READER_STATS",SET_READERS:"SET_READERS",SET_ERROR_FOR_CARD_READERS:"SET_ERROR_FOR_CARD_READERS"}),Rn=(e,t)=>e.readers[t]&&e.readers[t].data?e.readers[t].data:{},vn=(e,t)=>e.readers[t]&&e.readers[t].error?e.readers[t].error:{},bn=e=>e.readers&&e.readers.list?e.readers.list:{};function On(e,t){return{type:Tn.SET_CARD_READER_STATS,id:e,data:t}}function In(e,t){return{type:Tn.SET_READERS,query:e,data:t}}function An(e,t,r){return{type:Tn.SET_CARD_ERROR_FOR_READER_STATS,id:e,data:t,error:r}}function Nn(e,t){return{type:Tn.SET_CARD_ERROR_FOR_READERS,data:e,error:t}}function*Cn(e,t){try{const r=yield(0,pe.apiFetch)({path:`${ye}/readers/charges/${t}`});yield On(e,r)}catch(t){yield An(e,null,t)}}function*xn(e){const t=(0,Pe.addQueryArgs)(`${ye}/readers`,{limit:e.limit});try{const r=yield(0,pe.apiFetch)({path:t})||{};yield In(e,r)}catch(e){yield Nn(null,e)}}var Pn=function(e){return e.SET_ACTIVE_LOAN_SUMMARY="SET_ACTIVE_LOAN_SUMMARY",e.SET_ERROR_FOR_ACTIVE_LOAN_SUMMARY="SET_ERROR_FOR_ACTIVE_LOAN_SUMMARY",e.SET_LOANS="SET_LOANS",e.SET_ERROR_FOR_LOANS="SET_ERROR_FOR_LOANS",e}(Pn||{});const Dn=Pn,Mn={},Fn=e=>e&&e.capital||{},jn=e=>Fn(e).summary,Un=e=>Fn(e).summaryError,kn=e=>Fn(e).loans||[],Ln=e=>Fn(e).loansError;function zn(e){return{type:Dn.SET_ACTIVE_LOAN_SUMMARY,data:e}}function $n(e){return{type:Dn.SET_ERROR_FOR_ACTIVE_LOAN_SUMMARY,error:e}}function Bn(e){return{type:Dn.SET_LOANS,data:e.data}}function Yn(e){return{type:Dn.SET_ERROR_FOR_LOANS,error:e}}function*qn(){const e=`${ye}/capital/active_loan_summary`;try{const t=yield(0,pe.apiFetch)({path:e});yield zn(t)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving the active loan summary.","woocommerce-payments")),yield $n(e)}}function*Vn(){const e=`${ye}/capital/loans`;try{const t=yield(0,pe.apiFetch)({path:e});yield Bn(t)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving the active loan summary.","woocommerce-payments")),yield Yn(e)}}const Hn={SET_DOCUMENTS:"SET_DOCUMENTS",SET_ERROR_FOR_DOCUMENTS:"SET_ERROR_FOR_DOCUMENTS",SET_DOCUMENTS_SUMMARY:"SET_DOCUMENTS_SUMMARY",SET_ERROR_FOR_DOCUMENTS_SUMMARY:"SET_ERROR_FOR_DOCUMENTS_SUMMARY"},Gn={summary:{}},Wn=e=>e&&e.documents||{},Qn=(e,t)=>{const r=ge(t);return Wn(e)[r]||{}},Zn=(e,t)=>Qn(e,t).data||[],Jn=(e,t)=>Qn(e,t).error||{},Kn=(e,t)=>{const r=ge(t);return Wn(e).summary[r]||{}},Xn=(e,t)=>Kn(e,t).data||{},ea=(e,t)=>Kn(e,t).error||{};function ta(e,t){return{type:Hn.SET_DOCUMENTS,query:e,data:t}}function ra(e,t,r){return{type:Hn.SET_ERROR_FOR_DOCUMENTS,query:e,data:t,error:r}}function oa(e,t){return{type:Hn.SET_DOCUMENTS_SUMMARY,query:e,data:t}}function na(e,t,r){return{type:Hn.SET_ERROR_FOR_DOCUMENTS_SUMMARY,query:e,data:t,error:r}}const aa=e=>({user_email:e.userEmail,match:e.match,date_before:Ue(e.dateBefore,!0),date_after:Ue(e.dateAfter),date_between:e.dateBetween&&[Ue(e.dateBetween[0]),Ue(e.dateBetween[1],!0)],type_is:e.typeIs,type_is_not:e.typeIsNot});function*sa(e){const t=(0,Pe.addQueryArgs)(`${ye}/documents`,{page:e.paged,pagesize:e.perPage,sort:e.orderby,direction:e.order,...aa(e)});try{const r=yield(0,pe.apiFetch)({path:t});yield ta(e,r.data||[])}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving documents.","woocommerce-payments")),yield ra(e,null,t)}}function*ia(e){const t=(0,Pe.addQueryArgs)(`${ye}/documents/summary`,aa(e));try{const r=yield(0,pe.apiFetch)({path:t});yield oa(e,r)}catch(t){yield na(e,null,t)}}const ca={},da=({paymentIntents:e},t)=>{const r=e?.[t];return r?.data||{}},ua=({paymentIntents:e},t)=>{const r=e?.[t];return r?.error||{}},la={SET_AUTHORIZATIONS:"SET_AUTHORIZATIONS",SET_AUTHORIZATION:"SET_AUTHORIZATION",SET_ERROR_FOR_AUTHORIZATIONS:"SET_ERROR_FOR_AUTHORIZATIONS",SET_AUTHORIZATIONS_SUMMARY:"SET_AUTHORIZATIONS_SUMMARY",SET_ERROR_FOR_AUTHORIZATIONS_SUMMARY:"SET_ERROR_FOR_AUTHORIZATIONS_SUMMARY",SET_IS_REQUESTING_AUTHORIZATION:"SET_IS_REQUESTING_AUTHORIZATION"},ma={summary:{},byId:{},isRequesting:!1},_a=e=>e&&e.authorizations||{},pa=(e,t)=>{const r=ge(t);return _a(e)[r]||{}},ya=(e,t)=>pa(e,t).data||[],ha=(e,t)=>(_a(e).byId||{})[t],Sa=(e,t)=>pa(e,t).error||{},ga=(e,t)=>{const r=ge(t);return _a(e).summary[r]||{}},Ea=(e,t)=>ga(e,t).data||{},fa=(e,t)=>ga(e,t).error||{},wa=e=>_a(e).isRequesting,Ta=e=>{var t;const r={wcpay_missing_order:(0,J.__)("The order could not be found.","woocommerce-payments"),wcpay_refunded_order_uncapturable:(0,J.__)("Payment cannot be processed for partially or fully refunded orders.","woocommerce-payments"),wcpay_intent_order_mismatch:(0,J.__)("The payment cannot be processed due to a mismatch with order details.","woocommerce-payments"),wcpay_payment_uncapturable:(0,J.__)("This payment cannot be processed in its current state.","woocommerce-payments"),wcpay_capture_error:e=>"amount_too_small"===e.data?.error_type?(e=>{if(!e.data?.extra_details?.minimum_amount||!e.data?.extra_details?.minimum_amount_currency)return(0,J.__)("The payment amount is too small to be processed.","woocommerce-payments");const t=e.data.extra_details.minimum_amount_currency,r=ue(e.data.extra_details.minimum_amount,t);return(0,J.sprintf)((0,J.__)("The minimum amount that can be processed is %1$s %2$s.","woocommerce-payments"),r,t.toUpperCase())})(e):(0,J.__)("The payment capture failed to complete.","woocommerce-payments"),wcpay_cancel_error:(0,J.__)("The payment cancellation failed to complete.","woocommerce-payments"),wcpay_server_error:(0,J.__)("An unexpected error occurred. Please try again later.","woocommerce-payments")}[null!==(t=e.code)&&void 0!==t?t:""];return"function"==typeof r?r(e):null!=r?r:(0,J.__)("Unable to process the payment. Please try again later.","woocommerce-payments")};function Ra(e,t){return{type:la.SET_AUTHORIZATIONS,data:t,query:e}}function va(e,t){return{type:la.SET_ERROR_FOR_AUTHORIZATIONS,query:e,error:t}}function ba(e){return{type:la.SET_AUTHORIZATION,data:e}}function Oa(e,t){return{type:la.SET_AUTHORIZATIONS_SUMMARY,data:t,query:e}}function Ia(e){return{type:la.SET_IS_REQUESTING_AUTHORIZATION,data:e}}function*Aa(e,t){try{yield _e.controls.dispatch(he,"startResolution","getAuthorization",[e]),yield _e.controls.dispatch(he,"setIsRequestingAuthorization",!0);const r=yield(0,pe.apiFetch)({path:`/wc/v3/payments/orders/${t}/capture_authorization`,method:"post",data:{payment_intent_id:e}}),o={payment_intent_id:r.id,captured:"succeeded"===r.status};yield ba(o),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getAuthorizations"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getAuthorizationsSummary"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getFraudOutcomeTransactions"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getFraudOutcomeTransactionsSummary"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getTimeline"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getPaymentIntent"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getTransactions"),yield _e.controls.dispatch("core/notices","createSuccessNotice",(0,J.sprintf)((0,J.__)("Payment for order #%s captured successfully.","woocommerce-payments"),t))}catch(e){const r=(0,J.sprintf)((0,J.__)("There has been an error capturing the payment for order #%s.","woocommerce-payments"),t),o=Ta(e);yield _e.controls.dispatch("core/notices","createErrorNotice",`${r} ${o}`)}finally{yield _e.controls.dispatch(he,"finishResolution","getAuthorization",[e]),yield _e.controls.dispatch(he,"setIsRequestingAuthorization",!1)}}function*Na(e,t){try{yield _e.controls.dispatch(he,"startResolution","getAuthorization",[e]),yield _e.controls.dispatch(he,"setIsRequestingAuthorization",!0);const r=yield(0,pe.apiFetch)({path:`/wc/v3/payments/orders/${t}/cancel_authorization`,method:"post",data:{payment_intent_id:e}}),o={payment_intent_id:r.id,captured:"succeeded"===r.status};yield ba(o),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getAuthorizations"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getAuthorizationsSummary"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getFraudOutcomeTransactions"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getFraudOutcomeTransactionsSummary"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getTimeline"),yield _e.controls.dispatch(he,"invalidateResolutionForStoreSelector","getPaymentIntent"),yield _e.controls.dispatch("core/notices","createSuccessNotice",(0,J.sprintf)((0,J.__)("Payment for order #%s canceled successfully.","woocommerce-payments"),t))}catch(e){const r=(0,J.sprintf)((0,J.__)("There has been an error canceling the payment for order #%s.","woocommerce-payments"),t),o=Ta(e);yield _e.controls.dispatch("core/notices","createErrorNotice",`${r} ${o}`)}finally{yield _e.controls.dispatch(he,"finishResolution","getAuthorization",[e]),yield _e.controls.dispatch(he,"setIsRequestingAuthorization",!1)}}function Ca(e,t){return{type:la.SET_ERROR_FOR_AUTHORIZATIONS_SUMMARY,query:e,error:t}}function*xa(e){let{paged:t=1,per_page:r=25,orderby:o="created",order:n="asc"}=e;"capture_by"===o&&(o="created");const a=(0,Pe.addQueryArgs)(`${ye}/authorizations`,{page:t,pagesize:r,sort:o,direction:n});try{var s;const t=yield(0,pe.apiFetch)({path:a});yield Ra(e,null!==(s=t.data)&&void 0!==s?s:[])}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving uncaptured transactions.","woocommerce-payments")),yield va(e,t)}}function*Pa(e){try{if(e){const t=yield(0,pe.apiFetch)({path:`${ye}/authorizations/${e}`}),{is_captured:r,payment_intent_id:o,created:n}=t;yield ba({payment_intent_id:o,captured:r,created:n})}}catch(e){"authorization_missing"!==e.code&&(yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving authorization.","woocommerce-payments")))}}function*Da(e){const t=(0,Pe.addQueryArgs)(`${ye}/authorizations/summary`,{pagesize:e.per_page,sort:e.orderby,direction:e.order,page:e.paged});try{const r=yield(0,pe.apiFetch)({path:t});yield Oa(e,null!=r?r:[])}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving uncaptured transactions.","woocommerce-payments")),yield Ca(e,t)}}var Ma=function(e){return e.SET_FILE="SET_FILE",e.SET_ERROR_FOR_FILES="SET_ERROR_FOR_FILES",e}(Ma||{});const Fa=Ma,ja={},Ua=({files:e},t)=>{const r=e?.[t];return r?.data||{}},ka=({files:e},t)=>{const r=e?.[t];return r?.error||{}};function La(e,t){return{type:Fa.SET_FILE,id:e,data:t}}function za(e,t){return{type:Fa.SET_ERROR_FOR_FILES,id:e,error:t}}function*$a(e){try{const t=yield(0,pe.apiFetch)({path:`${ye}/file/${e}/details`});yield La(e,t)}catch(t){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving file.","woocommerce-payments")),yield za(e,t)}}let Ba=function(e){return e.SET_PM_PROMOTIONS="SET_PM_PROMOTIONS",e.SET_ERROR_FOR_PM_PROMOTIONS="SET_ERROR_FOR_PM_PROMOTIONS",e}({});const Ya={pmPromotions:void 0,pmPromotionsError:void 0},qa=e=>{var t;return null!==(t=e.pmPromotions?.pmPromotions)&&void 0!==t?t:[]},Va=e=>e.pmPromotions?.pmPromotionsError;function Ha(e){return function(e){return"object"==typeof e&&null!==e&&"code"in e&&"string"==typeof e.code}(e)?e:{code:"unknown_error"}}function Ga(e){return{type:Ba.SET_PM_PROMOTIONS,data:e}}function Wa(e){return{type:Ba.SET_ERROR_FOR_PM_PROMOTIONS,error:e}}function*Qa(e){const t=`${ye}/pm-promotions/${e}/activate`;try{yield(0,pe.apiFetch)({path:t,method:"POST"}),yield _e.controls.dispatch("core/notices","createSuccessNotice",(0,J.__)("Promotion activated successfully!","woocommerce-payments")),yield _e.controls.dispatch("wc/payments","invalidateResolution","getPmPromotions",[])}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error activating promotion. Please try again.","woocommerce-payments")),yield _e.controls.dispatch("wc/payments","updateErrorForPmPromotions",Ha(e))}}function*Za(e){const t=`${ye}/pm-promotions/${e}/dismiss`;try{yield(0,pe.apiFetch)({path:t,method:"POST"}),yield _e.controls.dispatch("core/notices","createSuccessNotice",(0,J.__)("Promotion dismissed.","woocommerce-payments")),yield _e.controls.dispatch("wc/payments","invalidateResolution","getPmPromotions",[])}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error dismissing promotion. Please try again.","woocommerce-payments")),yield _e.controls.dispatch("wc/payments","updateErrorForPmPromotions",Ha(e))}}function Ja(e){if("object"!=typeof e||null===e)return!1;const t=e;return"string"==typeof t.id&&"string"==typeof t.promo_id&&"string"==typeof t.payment_method&&"string"==typeof t.payment_method_title&&"string"==typeof t.type&&("spotlight"===t.type||"badge"===t.type)&&"string"==typeof t.title&&"string"==typeof t.description&&"string"==typeof t.cta_label&&"string"==typeof t.tc_url&&"string"==typeof t.tc_label}function*Ka(){const e=`${ye}/pm-promotions`;try{const t=yield(0,pe.apiFetch)({path:e});if(r=t,!Array.isArray(r)||!r.every(Ja))throw new Error("Invalid promotions data received from API");yield _e.controls.dispatch("wc/payments","updatePmPromotions",t)}catch(e){yield _e.controls.dispatch("core/notices","createErrorNotice",(0,J.__)("Error retrieving promotions. Please try again later.","woocommerce-payments")),yield _e.controls.dispatch("wc/payments","updateErrorForPmPromotions",(t=e,function(e){return"object"==typeof e&&null!==e&&"code"in e}(t)?t:{code:"unknown_error"}))}var t,r}(0,_e.registerStore)(he,{reducer:(0,_e.combineReducers)({deposits:(e=Ee,{type:t,query:r={},data:o=[],error:n})=>{const a=ge(r);switch(t){case Se.SET_DEPOSIT:return{...e,byId:{...e.byId,[o.id]:o}};case Se.SET_ALL_DEPOSITS_OVERVIEWS:return{...e,overviews:{...e.overviews,data:o}};case Se.SET_ERROR_FOR_ALL_DEPOSITS_OVERVIEWS:return{...e,overviews:{...e.overviews,error:n}};case Se.SET_DEPOSITS:return{...e,byId:{...e.byId,...(0,ce.keyBy)(o,"id")},queries:{...e.queries,[a]:{data:(0,ce.map)(o,"id")}}};case Se.SET_DEPOSITS_COUNT:return{...e,count:o};case Se.SET_ERROR_FOR_DEPOSIT_QUERY:return{...e,queries:{...e.queries,[a]:{error:n}}};case Se.SET_DEPOSITS_SUMMARY:return{...e,summary:{...e.summary,[a]:{data:o}}};case Se.SET_ERROR_FOR_DEPOSITS_SUMMARY:return{...e,summary:{...e.summary,[a]:{error:n}}};case Se.SET_INSTANT_DEPOSIT:return{...e,instant:{...e.instant,data:o}}}return e},transactions:(e=rt,{type:t,query:r={},data:o=[],error:n,status:a})=>{const s=ge(r);switch(t){case tt.SET_TRANSACTIONS:return{...e,[s]:{data:o}};case tt.SET_ERROR_FOR_TRANSACTIONS:return{...e,[s]:{error:n}};case tt.SET_TRANSACTIONS_SUMMARY:return{...e,summary:{...e.summary,[s]:{data:o}}};case tt.SET_ERROR_FOR_TRANSACTIONS_SUMMARY:return{...e,summary:{...e.summary,[s]:{error:n}}};case tt.SET_FRAUD_OUTCOME_TRANSACTIONS:return{...e,fraudProtection:{...e.fraudProtection,[a]:{...e.fraudProtection?.[a]||{},[s]:{data:o}}}};case tt.SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS:return{...e,fraudProtection:{...e.fraudProtection,[a]:{...e.fraudProtection?.[a]||{},[s]:{error:n}}}};case tt.SET_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY:return{...e,fraudProtection:{...e.fraudProtection,[a]:{...e.fraudProtection?.[a]||{},summary:{...e.fraudProtection?.[a]?.summary||{},[s]:{data:o}}}}};case tt.SET_ERROR_FOR_FRAUD_OUTCOME_TRANSACTIONS_SUMMARY:return{...e,fraudProtection:{...e.fraudProtection,[a]:{...e.fraudProtection?.[a]||{},summary:{...e.fraudProtection?.[a]?.summary||{},[s]:{error:n}}}}}}return e},charges:(e={},{type:t,id:r,data:o,error:n})=>{switch(t){case Pt.SET_CHARGE:e={...e,[r]:{...e[r],data:o}};break;case Pt.SET_ERROR_FOR_CHARGE:e={...e,[r]:{...e[r],error:n}}}return e},timeline:(e={},{type:t,id:r,data:o,error:n})=>{switch(t){case $t.SET_TIMELINE:e={...e,[r]:{data:o}};break;case $t.SET_ERROR_FOR_TIMELINE:e={...e,[r]:{...e[r],error:n}}}return e},disputes:(e=Wt,{type:t,query:r={},data:o=[],id:n,error:a})=>{const s=ge(r);switch(t){case Gt.SET_DISPUTE:return{...e,byId:{...e.byId,[o.id]:o}};case Gt.SET_ERROR_FOR_DISPUTE:e={...e,byId:{...e.byId,[n]:{error:a}}};break;case Gt.SET_DISPUTES:return{...e,cached:{...e.cached,...(0,ce.keyBy)(o,"dispute_id")},queries:{...e.queries,[s]:{data:(0,ce.map)(o,"dispute_id")}}};case Gt.SET_DISPUTES_SUMMARY:return{...e,summary:{...e.summary,[s]:{data:o}}}}return e},settings:(e=vr,{type:t,...r})=>{switch(t){case Rr.SET_SETTINGS:return{...e,data:r.data,isDirty:!1};case Rr.SET_SETTINGS_VALUES:return{...e,savingError:null,isDirty:!0,data:{...e.data,...r.payload}};case Rr.SET_IS_SAVING_SETTINGS:return{...e,isDirty:!(!r.isSaving&&!r.error)&&e.isDirty,isSaving:r.isSaving,savingError:r.error};case Rr.SET_SELECTED_PAYMENT_METHOD:return{...e,isDirty:!0,data:{...e.data,enabled_payment_method_ids:e.data.enabled_payment_method_ids.concat(r.id)}};case Rr.SET_UNSELECTED_PAYMENT_METHOD:return{...e,isDirty:!0,data:{...e.data,enabled_payment_method_ids:e.data.enabled_payment_method_ids.filter((e=>e!==r.id))}}}return e},readers:(e={},{type:t,id:r,data:o,error:n})=>{switch(t){case Tn.SET_CARD_READER_STATS:e={...e,[r]:{...e[r],data:o}};break;case Tn.SET_ERROR_FOR_CARD_READER_STATS:e={...e,[r]:{...e[r],error:n}};break;case Tn.SET_READERS:e={...e,list:o}}return e},capital:(e=Mn,t)=>{switch(t.type){case Dn.SET_ACTIVE_LOAN_SUMMARY:return{...e,summary:t.data,summaryError:void 0};case Dn.SET_ERROR_FOR_ACTIVE_LOAN_SUMMARY:return{...e,summary:void 0,summaryError:t.error};case Dn.SET_LOANS:return{...e,loans:t.data,loansError:void 0};case Dn.SET_ERROR_FOR_LOANS:return{...e,loans:void 0,loansError:t.error}}return e},documents:(e=Gn,{type:t,query:r={},data:o=[],error:n})=>{const a=ge(r);switch(t){case Hn.SET_DOCUMENTS:return{...e,[a]:{data:o}};case Hn.SET_ERROR_FOR_DOCUMENTS:return{...e,[a]:{error:n}};case Hn.SET_DOCUMENTS_SUMMARY:return{...e,summary:{...e.summary,[a]:{data:o}}};case Hn.SET_ERROR_FOR_DOCUMENTS_SUMMARY:return{...e,summary:{...e.summary,[a]:{error:n}}}}return e},paymentIntents:(e=ca,t)=>{const{type:r,id:o}=t;switch(r){case rr.SET_PAYMENT_INTENT:return{...e,[o]:{...e[o],data:t.data}};case rr.SET_ERROR_FOR_PAYMENT_INTENT:return{...e,[o]:{...e[o],error:t.error}};default:return e}},authorizations:(e=ma,t)=>{switch(t.type){case la.SET_AUTHORIZATION:{const{data:r}=t;return{...e,byId:{...e.byId,[r.payment_intent_id]:{...e.byId[r.payment_intent_id],...r}}}}case la.SET_AUTHORIZATIONS:{const{data:r,query:o}=t;return{...e,[ge(o)]:{data:r}}}case la.SET_ERROR_FOR_AUTHORIZATIONS:{const{error:r,query:o}=t;return{...e,[ge(o)]:{error:r}}}case la.SET_AUTHORIZATIONS_SUMMARY:{const{data:r,query:o}=t;return{...e,summary:{...e.summary,[ge(o)]:{data:r||{}}}}}case la.SET_ERROR_FOR_AUTHORIZATIONS_SUMMARY:{const{query:r,error:o}=t;return{...e,summary:{...e.summary,[ge(r)]:{error:o||""}}}}case la.SET_IS_REQUESTING_AUTHORIZATION:{const{data:r}=t;return{...e,isRequesting:r}}}return e},files:(e=ja,t)=>{const{type:r,id:o}=t;switch(r){case Fa.SET_FILE:return{...e,[o]:{...e[o],data:t.data}};case Fa.SET_ERROR_FOR_FILES:return{...e,[o]:{...e[o],error:t.error}};default:return e}},pmPromotions:(e=Ya,t)=>{switch(t.type){case Ba.SET_PM_PROMOTIONS:return{...e,pmPromotions:t.data,pmPromotionsError:void 0};case Ba.SET_ERROR_FOR_PM_PROMOTIONS:return{...e,pmPromotions:void 0,pmPromotionsError:t.error}}return e}}),actions:{...t,...a,...c,...l,...h,...E,...T,...b,...A,...p,...P,...F,...k},controls:pe.controls,selectors:{...e,...n,...i,...u,..._,...g,...w,...v,...I,...C,...x,...M,...U},resolvers:{...o,...s,...d,...m,...S,...f,...R,...O,...N,...y,...D,...j,...L}});const Xa="/wc/v3/payments",es="wc/payments/multi-currency",ts={SET_CURRENCIES:"SET_CURRENCIES",SET_AVAILABLE_CURRENCIES:"SET_AVAILABLE_CURRENCIES",SET_ENABLED_CURRENCIES:"SET_ENABLED_CURRENCIES",SET_DEFAULT_CURRENCY:"SET_DEFAULT_CURRENCY",SET_CURRENCY_SETTINGS:"SET_CURRENCY_SETTINGS",SET_STORE_SETTINGS:"SET_STORE_SETTINGS",SET_STORE_SETTINGS_VALUES:"SET_STORE_SETTINGS_VALUES",SET_IS_SAVING_STORE_SETTINGS:"SET_IS_SAVING_STORE_SETTINGS"},rs={},os=e=>e&&e||{},ns=e=>os(e).currencies||{},as=e=>ns(e).available||{},ss=e=>ns(e).enabled||{},is=e=>ns(e).default||{},cs=e=>os(e).currency_settings||{},ds=e=>os(e).settings?.data||{},us=e=>{var t;return null!==(t=os(e).settings?.isDirty)&&void 0!==t&&t},ls=e=>{var t;return null!==(t=os(e).settings?.isSaving)&&void 0!==t&&t};function ms(e){return{type:ts.SET_CURRENCIES,data:e}}function _s(e){return{type:ts.SET_AVAILABLE_CURRENCIES,data:e}}function ps(e){return{type:ts.SET_ENABLED_CURRENCIES,data:e}}function ys(e){return{type:ts.SET_DEFAULT_CURRENCY,data:e}}function hs(e,t){return{type:ts.SET_CURRENCY_SETTINGS,data:{code:e,data:t}}}function Ss(e){return{type:ts.SET_STORE_SETTINGS,data:e}}function gs(e){return{type:ts.SET_STORE_SETTINGS_VALUES,data:e}}function Es(e,t){return{type:ts.SET_IS_SAVING_STORE_SETTINGS,data:{isSaving:e,error:t}}}function*fs(e){const t=Object.keys((0,_e.select)(es).getEnabledCurrencies()),r=e.filter((e=>!t.includes(e))),o=t.filter((t=>!e.includes(t)));try{const t=yield(0,pe.apiFetch)({path:`${Xa}/multi-currency/update-enabled-currencies`,method:"POST",data:{enabled:e}});yield ms(t),yield(0,_e.dispatch)("core/notices").createSuccessNotice((0,J.__)("Enabled currencies updated.","woocommerce-payments")),ae("wcpay_multi_currency_enabled_currencies_updated",{added_currencies:r,removed_currencies:o})}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error updating enabled currencies.","woocommerce-payments"))}}function*ws(e,t){try{const r=yield(0,pe.apiFetch)({path:`${Xa}/multi-currency/currencies/${e}`,method:"POST",data:t});yield hs(e,r),yield(0,_e.dispatch)("core/notices").createSuccessNotice((0,J.__)("Currency settings updated.","woocommerce-payments"))}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error updating currency settings.","woocommerce-payments"))}}function*Ts(e=!1){let t=null;try{const t=(0,_e.select)(es).getStoreSettings();yield Es(!0,null);const r=yield(0,pe.apiFetch)({path:`${Xa}/multi-currency/update-settings`,method:"POST",data:{wcpay_multi_currency_enable_auto_currency:t.enable_auto_currency?"yes":"no",wcpay_multi_currency_enable_storefront_switcher:t.enable_storefront_switcher?"yes":"no",wcpay_multi_currency_rendering_mode:t.rendering_mode||"speed"}});yield Ss(r),e||(yield(0,_e.dispatch)("core/notices").createSuccessNotice((0,J.__)("Store settings saved.","woocommerce-payments")))}catch(e){t=e,yield(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error saving store settings.","woocommerce-payments"))}finally{yield Es(!1,t)}}function Rs(e,t){Co()({path:`${Xa}/settings/${e}`,method:"post",data:{value:t}}).catch((()=>{(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error saving option","woocommerce-payments"))}))}function*vs(){const e=`${Xa}/multi-currency/currencies`;try{const t=yield(0,pe.apiFetch)({path:e});yield ms(t)}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error retrieving currencies.","woocommerce-payments"))}}function*bs(e){const t=`${Xa}/multi-currency/currencies/${e}`;try{const r=yield(0,pe.apiFetch)({path:t});yield hs(e,r)}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error retrieving single currency settings.","woocommerce-payments"))}}function*Os(){const e=`${Xa}/multi-currency/get-settings`;try{const t=yield(0,pe.apiFetch)({path:e});yield Ss(t)}catch(e){yield(0,_e.dispatch)("core/notices").createErrorNotice((0,J.__)("Error retrieving store settings.","woocommerce-payments"))}}const Is=()=>(0,_e.useSelect)((e=>{const{getCurrencies:t,isResolving:r}=e(es);return{currencies:t(),isLoading:r("getCurrencies",[])}}),[]),As=()=>{const e=(0,_e.useSelect)((e=>{const{getEnabledCurrencies:t}=e(es);return t()})),{submitEnabledCurrenciesUpdate:t}=(0,_e.useDispatch)(es);return{enabledCurrencies:e,submitEnabledCurrenciesUpdate:t}},Ns=()=>{const{storeSettings:e,isLoading:t,isDirty:r,isSaving:o}=(0,_e.useSelect)((e=>{const{getStoreSettings:t,isStoreSettingsDirty:r,isSavingStoreSettings:o,isResolving:n}=e(es);return{storeSettings:t(),isLoading:n("getStoreSettings",[]),isDirty:r(),isSaving:o()}})),{updateStoreSettingValues:n,saveStoreSettings:a}=(0,_e.useDispatch)(es);return{storeSettings:e,isLoading:t,isDirty:r,isSaving:o,updateStoreSettingValues:n,saveStoreSettings:a}},Cs=()=>(0,_e.useSelect)((e=>{const{getDefaultCurrency:t}=e(es);return t()}));(0,_e.registerStore)(es,{reducer:(e=rs,{type:t,data:r=[]})=>{var o;switch(t){case ts.SET_CURRENCIES:return{...e,currencies:r,available:r.available,enabled:r.enabled,default:r.default};case ts.SET_AVAILABLE_CURRENCIES:return{...e,currencies:{...e,available:r.available},available:r.available};case ts.SET_ENABLED_CURRENCIES:return{...e,currencies:{...e,enabled:r.enabled},enabled:r.enabled};case ts.SET_DEFAULT_CURRENCY:return{...e,currencies:{...e,default:r.default},default:r.default};case ts.SET_CURRENCY_SETTINGS:return{...e,currency_settings:{...e.currency_settings,[r.code]:r.data}};case ts.SET_STORE_SETTINGS:return{...e,settings:{...e.settings,isDirty:!1,data:{enable_auto_currency:r.wcpay_multi_currency_enable_auto_currency,enable_storefront_switcher:r.wcpay_multi_currency_enable_storefront_switcher,rendering_mode:r.wcpay_multi_currency_rendering_mode,is_cache_optimized_feature_enabled:r.is_cache_optimized_feature_enabled,site_theme:r.site_theme,date_format:r.date_format,time_format:r.time_format,store_url:r.store_url}}};case ts.SET_STORE_SETTINGS_VALUES:return{...e,settings:{...e.settings,savingError:null,isDirty:!0,data:{...e.settings?.data||{},...r}}};case ts.SET_IS_SAVING_STORE_SETTINGS:return{...e,settings:{...e.settings,isDirty:!(!r.isSaving&&!r.error)&&null!==(o=e.settings?.isDirty)&&void 0!==o&&o,isSaving:r.isSaving,savingError:r.error}}}return e},actions:{...$},controls:pe.controls,selectors:{...z},resolvers:{...B}});const xs=({isPreviewModalOpen:e,setPreviewModalOpen:t,isStorefrontSwitcherEnabledValue:r,isAutomaticSwitchEnabledValue:o})=>{const{storeSettings:n}=Ns();return e&&(0,V.jsx)(H.Modal,{title:(0,J.__)("Preview","woocommerce-payments"),isDismissible:!0,className:"multi-currency-store-settings-preview-modal",shouldCloseOnClickOutside:!1,onRequestClose:()=>{t(!1)},children:(0,V.jsx)("iframe",{title:(0,J.__)("Preview","woocommerce-payments"),className:"multi-currency-store-settings-preview-iframe",src:"/"+n.store_url+"?is_mc_onboarding_simulation=1&enable_storefront_switcher="+r+"&enable_auto_currency="+o})})},Ps=window.wp.element,Ds=({children:e})=>(0,V.jsx)("ul",{children:e});function Ms(e){return e.startsWith("{{/")?{type:"componentClose",value:e.replace(/\W/g,"")}:e.endsWith("/}}")?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.startsWith("{{")?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}function Fs(e,t){let r,o,n=[];for(let a=0;a<e.length;a++){const s=e[a];if("string"!==s.type){if(void 0===t[s.value])throw new Error(`Invalid interpolation, missing component node: \`${s.value}\``);if("object"!=typeof t[s.value])throw new Error(`Invalid interpolation, component node must be a ReactElement or null: \`${s.value}\``);if("componentClose"===s.type)throw new Error(`Missing opening component token: \`${s.value}\``);if("componentOpen"===s.type){r=t[s.value],o=a;break}n.push(t[s.value])}else n.push(s.value)}if(r){const a=function(e,t){const r=t[e];let o=0;for(let n=e+1;n<t.length;n++){const e=t[n];if(e.value===r.value){if("componentOpen"===e.type){o++;continue}if("componentClose"===e.type){if(0===o)return n;o--}}}throw new Error("Missing closing component token `"+r.value+"`")}(o,e),s=Fs(e.slice(o+1,a),t),i=(0,Y.cloneElement)(r,{},s);if(n.push(i),a<e.length-1){const r=Fs(e.slice(a+1),t);n=n.concat(r)}}return n=n.filter(Boolean),0===n.length?null:1===n.length?n[0]:(0,Y.createElement)(Y.Fragment,null,...n)}function js(e){const{mixedString:t,components:r,throwErrors:o}=e;if(!r)return t;if("object"!=typeof r){if(o)throw new Error(`Interpolation Error: unable to process \`${t}\` because components is not an object`);return t}const n=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(Ms)}(t);try{return Fs(n,r)}catch(e){if(o)throw new Error(`Interpolation Error: unable to process \`${t}\` because of error \`${e.message}\``);return t}}const Us=({onChange:e,checked:t=!1,currency:{flag:r,symbol:o,code:n,name:a},testId:s=null})=>{const i=(0,Ps.useCallback)((t=>{e(n,t)}),[n,e]);return(0,V.jsx)("li",{className:"enabled-currency-checkbox","data-testid":s,children:(0,V.jsx)(H.CheckboxControl,{code:n,checked:t,onChange:i,label:js({mixedString:"{{flag /}} {{name /}} {{code /}}",components:{flag:(0,V.jsx)("span",{className:"enabled-currency-checkbox__flag",children:""!==r?r:(0,V.jsx)("div",{className:"enabled-currency-checkbox__flag-text",children:(0,V.jsx)("span",{children:n})})}),name:(0,V.jsx)("span",{children:a}),code:(0,V.jsxs)("span",{className:"enabled-currency-checkbox__code",children:["(",o,o!==n&&" "+n,")"]})}}),__nextHasNoMarginBottom:!0})})},ks=((0,J.__)("any","woocommerce-payments"),(0,J.__)("one","woocommerce-payments"),(0,J.__)("two","woocommerce-payments"),(0,J.__)("three","woocommerce-payments"),(0,J.__)("four","woocommerce-payments"),(0,J.__)("five","woocommerce-payments"),(0,J.__)("six","woocommerce-payments"),(0,J.__)("seven","woocommerce-payments"),(0,J.__)("eight","woocommerce-payments"),(0,J.__)("nine","woocommerce-payments"),({className:e,children:t})=>(0,V.jsx)("ul",{className:e,children:t}));var Ls=r(9387);const zs=({symbol:e})=>(0,V.jsx)("div",{className:"currency-delete-illustration__wrapper",children:(0,V.jsxs)("div",{className:"currency-delete-illustration__illustrations",children:[e,(0,V.jsx)(Ls.A,{className:"currency-delete-illustration__currency-cross-icon"})]})}),$s=r.p+"../assets/images/payment-methods/jcb.svg?ver=3351f2584f4a62ad094d",Bs=r.p+"../assets/images/cards/visa.svg?ver=f10d76e13a47cb867cca",Ys=r.p+"../assets/images/cards/mastercard.svg?ver=d21057587f14a719da45",qs=r.p+"../assets/images/cards/amex.svg?ver=9035aad80e3ae7ac653c",Vs=r.p+"../assets/images/payment-methods/woo.svg?ver=86a2411c2b2a56f57bc5",Hs=r.p+"../assets/images/payment-methods/woo-short.svg?ver=e7eb126add68e8fde2b6",Gs=r.p+"../assets/images/cards/diners.svg?ver=62451ea54fcf12af5e0d",Ws=r.p+"../assets/images/cards/discover.svg?ver=a19341de516c258e11fe",Qs=r.p+"../assets/images/cards/cb.svg?ver=375fa3d816484fa4b53c",Zs=r.p+"../assets/images/cards/unionpay.svg?ver=e60ed9d9db08315ff5c9",Js=(e,t,r=!0)=>({className:o,...n})=>(0,V.jsx)("img",{className:W("payment-method__icon",r?"":"no-border",o),src:e,alt:t,...n}),Ks=(Js(qs,(0,J.__)("American Express","woocommerce-payments")),Js(Qs,(0,J.__)("Cartes Bancaires","woocommerce-payments")),Js(Gs,(0,J.__)("Diners Club","woocommerce-payments")),Js(Ws,(0,J.__)("Discover","woocommerce-payments")),Js($s,(0,J.__)("JCB","woocommerce-payments")));if(Js(Ys,(0,J.__)("Mastercard","woocommerce-payments")),Js(Zs,(0,J.__)("UnionPay","woocommerce-payments")),Js(Bs,(0,J.__)("Visa","woocommerce-payments")),Js(Vs,(0,J.__)("WooPay","woocommerce-payments"),!1),Js(Hs,(0,J.__)("WooPay","woocommerce-payments"),!1),"undefined"==typeof wooPaymentsPaymentMethodDefinitions)throw new Error("wooPaymentsPaymentMethodDefinitions is undefined");const Xs=Object.keys(wooPaymentsPaymentMethodDefinitions).reduce(((e,t)=>(e[t]={...wooPaymentsPaymentMethodDefinitions[t],icon:({className:e})=>(0,V.jsx)("img",{src:wooPaymentsPaymentMethodDefinitions[t].settings_icon_url,alt:wooPaymentsPaymentMethodDefinitions[t].label,className:W("payment-method__icon",e)})},e)),{jcb:{id:"jcb",label:(0,J.__)("JCB","woocommerce-payments"),description:(0,J.__)("Let your customers pay with JCB, the only international payment brand based in Japan.","woocommerce-payments"),icon:Ks,currencies:["JPY"],stripe_key:"jcb_payments",allows_manual_capture:!1,allows_pay_later:!1,accepts_only_domestic_payment:!1,settings_icon_url:""}}),ei=({code:e,label:t,symbol:r,onClick:o,className:n})=>{const[a,s]=(0,Ps.useState)(!1),i=window.multiCurrencyPaymentMethodsMap,c=i&&i[e]&&Object.keys(i[e]).length>0,d=c?Object.keys(i[e]):[],u=(0,Ps.useCallback)((()=>{c?s(!0):o(e)}),[s,c,o,e]),l=(0,Ps.useCallback)((()=>{s(!1),o(e)}),[o,s,e]),m=(0,Ps.useCallback)((()=>{s(!1)}),[s]);return(0,V.jsxs)(V.Fragment,{children:[a&&(0,V.jsxs)(Z,{title:(0,J.sprintf)((0,J.__)("Remove %1$s","woocommerce-payments"),t),onRequestClose:m,className:"enabled-currency-delete-modal",actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(H.Button,{onClick:l,isPrimary:!0,isDestructive:!0,children:(0,J.__)("Remove","woocommerce-payments")}),(0,V.jsx)(H.Button,{onClick:m,isSecondary:!0,children:(0,J.__)("Cancel","woocommerce-payments")})]}),children:[(0,V.jsx)(zs,{symbol:r}),(0,V.jsx)("p",{children:js({mixedString:(0,J.sprintf)((0,J.__)("Are you sure you want to remove {{strong}}%s (%s){{/strong}}? Your customers will no longer be able to pay in this currency and use payment methods listed below.","woocommerce-payments"),t,e===r?e:[e,r].join(" ")),components:{strong:(0,V.jsx)("strong",{})}})}),(0,V.jsx)("ul",{children:d.map((e=>(0,V.jsx)("li",{children:(0,V.jsx)(ee,{Icon:Xs[e].icon,label:Xs[e].label})},e)))}),(0,V.jsx)("p",{children:(0,J.sprintf)((0,J.__)("You can add %s (%s) again at any time in Multi-Currency settings.","woocommerce-payments"),t,e===r?e:[e,r].join(" "))})]}),(0,V.jsx)(H.Button,{isLink:!0,"aria-label":(0,J.sprintf)((0,J.__)("Remove %1$s as an enabled currency","woocommerce-payments"),t),className:n,onClick:u,__next40pxDefaultSize:!0,children:(0,V.jsx)(H.Icon,{icon:"trash"})})]})},ti=(0,Y.createContext)(),ri=({currency:{code:e,flag:t,id:r,is_default:o,name:n,symbol:a,rate:s},onDeleteClick:i})=>{const{code:c,is_zero_decimal:d}=Cs(),{setCurrencyCodeToShowSettingsFor:u}=(0,Y.useContext)(ti);return(0,V.jsxs)("li",{className:W("enabled-currency",r),children:[(0,V.jsxs)("div",{className:"enabled-currency__container",children:[(0,V.jsx)("div",{className:"enabled-currency__flag",children:""!==t?t:(0,V.jsx)("div",{className:"enabled-currency__flag-text",children:(0,V.jsx)("span",{children:e})})}),(0,V.jsx)("div",{className:"enabled-currency__label",children:n}),(0,V.jsxs)("div",{className:"enabled-currency__code",children:["(",a+(a===e?"":` ${e}`),")"]})]}),(0,V.jsx)("div",{className:"enabled-currency__rate",children:(()=>{const t=d?Number.parseFloat(1e3*s).toFixed(2):Number.parseFloat(s).toFixed(2);return o?(0,J.__)("Default currency","woocommerce-payments"):d?`1,000 ${c} → ${t} ${e}`:`1 ${c} → ${t} ${e}`})()}),(0,V.jsxs)("div",{className:"enabled-currency__actions",children:[!o&&(0,V.jsx)(H.Button,{isLink:!0,onClick:()=>{u(e)},"aria-label":(0,J.sprintf)((0,J.__)("Edit %1$s","woocommerce-payments"),n),className:"enabled-currency__action edit",__next40pxDefaultSize:!0,children:(0,J.__)("manage","woocommerce-payments")}),i&&(0,V.jsx)(ei,{className:"enabled-currency__action delete",onClick:i,label:n,code:e,symbol:a})]})]})},oi=({isLoading:e})=>(0,V.jsxs)("li",{className:W("enabled-currency-placeholder","enabled-currency"),children:[(0,V.jsxs)("div",{className:"enabled-currency__container",children:[(0,V.jsx)("div",{className:"enabled-currency__flag",children:(0,V.jsx)(X,{isLoading:e,numLines:1,children:(0,V.jsx)("div",{className:"enabled-currency__flag-text"})})}),(0,V.jsx)("div",{className:"enabled-currency__label",children:(0,V.jsx)(X,{isLoading:e,numLines:1})}),(0,V.jsx)("div",{className:"enabled-currency__code",children:(0,V.jsx)(X,{isLoading:e,numLines:1})})]}),(0,V.jsx)("div",{className:"enabled-currency__rate",children:(0,V.jsx)(X,{isLoading:e,numLines:1})}),(0,V.jsx)("div",{className:"enabled-currency__actions",children:(0,V.jsx)(X,{isLoading:e,numLines:1})})]}),ni=({className:e})=>{const t=(0,_e.useSelect)((e=>{const{getAvailableCurrencies:t}=e(es);return t()})),r=Object.keys(t),o=(0,Ps.useRef)(null),{enabledCurrencies:n,submitEnabledCurrenciesUpdate:a}=As(),s=Object.keys(n),i=Cs().code;r.splice(r.indexOf(i),1);const[c,d]=(0,Ps.useState)(""),[u,l]=(0,Ps.useState)({}),m=c?r.filter((e=>{const{symbol:r,name:o}=t[e];return`${r} ${e} ${o}`.toLocaleLowerCase().indexOf(c.toLocaleLowerCase())>-1})):r,_=(0,Ps.useCallback)((()=>{l(r.reduce(((e,t)=>(e[t]=s.includes(t),e)),{}))}),[s,r]);(0,Ps.useEffect)((()=>{_()}),[JSON.stringify(r),JSON.stringify(s)]);const p=(e,t)=>{l((r=>({...r,[e]:t})))},[y,h]=(0,Ps.useState)(!1),[S,g]=(0,Ps.useState)(!1),E=(0,Ps.useCallback)((()=>{h(!0)}),[h]),f=(0,Ps.useCallback)((()=>{h(!1),g(!1),d(""),_()}),[h,_]);return(0,Ps.useEffect)((()=>{y&&o&&!1===S&&g(o.current.offsetWidth)}),[JSON.stringify(m),y]),(0,V.jsxs)(V.Fragment,{children:[y&&(0,V.jsxs)(Z,{focusOnMount:"firstContentElement",title:(0,J.__)("Add enabled currencies","woocommerce-payments"),onRequestClose:f,className:"add-enabled-currencies-modal",actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(H.Button,{isSecondary:!0,onClick:f,__next40pxDefaultSize:!0,children:(0,J.__)("Cancel","woocommerce-payments")}),(0,V.jsx)(H.Button,{isPrimary:!0,onClick:()=>{h(!1),g(!1),d("");const e=Object.entries(u).filter((([,e])=>e)).map((([e])=>e));e.push(i),e.sort(),a(e)},__next40pxDefaultSize:!0,children:(0,J.__)("Update selected","woocommerce-payments")})]}),children:[(0,V.jsx)("div",{className:"add-enabled-currencies-modal__search",children:(0,V.jsx)(H.SearchControl,{__nextHasNoMarginBottom:!0,value:c,onChange:d,placeholder:(0,J.__)("Search currencies","woocommerce-payments")})}),(0,V.jsx)("h3",{children:c?(0,J.sprintf)((0,J.__)("Search results (%1$d currencies)","woocommerce-payments"),m.length):(0,J.__)("All currencies","woocommerce-payments")}),(0,V.jsx)("div",{className:"add-enabled-currencies-modal__content",ref:o,style:{width:S||"auto"},children:(0,V.jsx)(Ds,{children:m.map((e=>(0,V.jsx)(Us,{checked:u[e],onChange:p,currency:t[e]},t[e].id)))})})]}),(0,V.jsx)(H.Button,{variant:"secondary",className:e,onClick:E,"data-testid":"enabled-currencies-add-button",__next40pxDefaultSize:!0,children:(0,J.__)("Add/remove currencies","woocommerce-payments")})]})},ai=()=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("h2",{children:(0,J.__)("Enabled currencies","woocommerce-payments")}),(0,V.jsx)("p",{children:(0,Ps.createInterpolateElement)((0,J.__)("Accept payments in multiple currencies. Prices are converted based on exchange rates and rounding rules. <learnMoreLink>Learn more</learnMoreLink>","woocommerce-payments"),{learnMoreLink:(0,V.jsx)(H.ExternalLink,{href:"https://woocommerce.com/document/woopayments/currencies/multi-currency-setup/#enabled-currencies"})})})]}),si=()=>{const{isLoading:e}=Is(),{enabledCurrencies:t,submitEnabledCurrenciesUpdate:r}=As(),o="wcpay-multi-currency",n=e=>{const o=Object.keys(t);o.splice(o.indexOf(e),1),r(o)},a=t?Object.keys(t):[];return(0,V.jsx)(re,{description:ai,className:"multi-currency-settings-enabled-currencies-section",children:(0,V.jsxs)(H.Card,{className:`${o}__enabled-currencies`,children:[(0,V.jsxs)(H.CardBody,{className:`${o}__enabled-currencies-header`,children:[(0,V.jsx)("div",{children:(0,J.__)("Name","woocommerce-payments")}),(0,V.jsx)("div",{children:(0,J.__)("Exchange rate","woocommerce-payments")}),(0,V.jsx)("div",{})]}),(0,V.jsx)(H.CardDivider,{}),(0,V.jsx)(H.CardBody,{size:null,children:(0,V.jsxs)(ks,{className:"enabled-currencies-list",children:[!e&&t&&a.map((e=>(0,V.jsx)(ri,{currency:t[e],onDeleteClick:t[e].is_default?void 0:n},t[e].id))),e&&[1,2,3,4,5].map((e=>(0,V.jsx)(oi,{isLoading:1},"loadable-placeholder-"+e)))]})}),(0,V.jsx)(H.CardDivider,{}),(0,V.jsx)(H.CardBody,{className:`${o}__available-currencies-container`,children:t&&(0,V.jsx)(ni,{className:`${o}__available-currencies-modal`})})]})})},ii=()=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("h2",{children:(0,J.__)("Store settings","woocommerce-payments")}),(0,V.jsx)("p",{children:(0,Ps.createInterpolateElement)((0,J.__)("Store settings allow your customers to choose which currency they would like to use when shopping at your store. <learnMoreLink>Learn more</learnMoreLink>","woocommerce-payments"),{learnMoreLink:(0,V.jsx)(H.ExternalLink,{href:"https://woocommerce.com/document/woopayments/currencies/multi-currency-setup/#store-settings"})})})]}),ci=()=>{const{storeSettings:e,isLoading:t,isDirty:r,isSaving:o,updateStoreSettingValues:n,saveStoreSettings:a}=Ns();(0,Y.useEffect)((()=>{r||(window.onbeforeunload=null)}),[r]);const[s,i]=(0,Y.useState)(!1);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(re,{description:ii,className:"multi-currency-settings-store-settings-section",children:(0,V.jsx)(X,{isLoading:t,numLines:10,children:(0,V.jsxs)(H.Card,{className:"multi-currency-settings__wrapper",children:[(0,V.jsxs)(H.CardBody,{className:"wcpay-card-body",children:[(0,V.jsx)(H.CheckboxControl,{checked:!!e.enable_auto_currency,onChange:e=>n({enable_auto_currency:e}),"data-testid":"enable_auto_currency",label:(0,J.__)("Automatically switch customers to their local currency if it has been enabled","woocommerce-payments"),help:(0,Ps.createInterpolateElement)((0,J.__)("Customers will be notified via store alert banner. <previewLink>Preview</previewLink>","woocommerce-payments"),{previewLink:(0,V.jsx)(H.Button,{isLink:!0,onClick:()=>{i(!0)},__next40pxDefaultSize:!0})}),__nextHasNoMarginBottom:!0}),e.is_cache_optimized_feature_enabled?(0,V.jsx)(H.RadioControl,{label:(0,J.__)("Price rendering mode","woocommerce-payments"),help:(0,J.__)('Choose how multi-currency prices are rendered. "Optimized for caching" outputs identical HTML for all visitors and converts prices client-side, allowing hosting providers to cache pages effectively.',"woocommerce-payments"),selected:e.rendering_mode||"speed",options:[{label:(0,J.__)("Optimized for speed (default)","woocommerce-payments"),value:"speed"},{label:(0,J.__)("Optimized for caching","woocommerce-payments"),value:"cache"}],onChange:e=>n({rendering_mode:e})}):null,"Storefront"===e.site_theme?(0,V.jsx)(H.CheckboxControl,{checked:!!e.enable_storefront_switcher,onChange:e=>n({enable_storefront_switcher:e}),"data-testid":"enable_storefront_switcher",label:(0,J.__)("Add a currency switcher to the Storefront theme on breadcrumb section.","woocommerce-payments"),help:(0,Ps.createInterpolateElement)((0,J.sprintf)((0,J.__)("A currency switcher is also available in your widgets. <linkToWidgets>Configure now</linkToWidgets>","woocommerce-payments"),"widgets.php"),{linkToWidgets:(0,V.jsx)("a",{href:"widgets.php"})}),__nextHasNoMarginBottom:!0}):null]}),(0,V.jsx)(xs,{isPreviewModalOpen:s,setPreviewModalOpen:i,isStorefrontSwitcherEnabledValue:!1,isAutomaticSwitchEnabledValue:!0})]})})}),(0,V.jsx)(re,{className:"multi-currency-settings-save-settings-section",children:(0,V.jsx)(H.Button,{isPrimary:!0,isBusy:o,disabled:o||!r,onClick:a,__next40pxDefaultSize:!0,children:(0,J.__)("Save changes","woocommerce-payments")})})]})},di=()=>(0,V.jsx)("div",{className:"multi-currency-settings",children:(0,V.jsxs)(te,{children:[(0,V.jsx)(si,{}),(0,V.jsx)(ci,{})]})}),ui=window.wc.components,li=({storeCurrency:e,targetCurrency:t,currencyRate:r=null,roundingValue:o,charmValue:n})=>{const[a,s]=(0,Y.useState)(20),i=(0,Y.useMemo)((()=>{const e=parseFloat(a.toString().replace(/,/g,"."))*parseFloat(r||t.rate),s=(parseFloat(o)?Math.ceil(e/parseFloat(o))*parseFloat(o):e)+parseFloat(n);return isNaN(s)?(0,J.__)("Please enter a valid number","woocommerce-payments"):ue(de(t.code)?s:100*s,t.code,null,!0)}),[a,n,r,o,t]);return(0,V.jsx)(H.Card,{className:"single-currency-settings-preview-wrapper",children:(0,V.jsxs)(H.CardBody,{className:"wcpay-card-body",children:[(0,V.jsx)("div",{children:"left"===e.symbol_position?(0,V.jsx)(ui.TextControlWithAffixes,{label:e.name,prefix:e.symbol,"data-testid":"store_currency_value",value:a.toString(),onChange:s}):(0,V.jsx)(ui.TextControlWithAffixes,{label:e.name,suffix:e.symbol,"data-testid":"store_currency_value",value:a.toString(),onChange:s})}),(0,V.jsx)("div",{children:(0,V.jsx)(ui.TextControlWithAffixes,{"data-testid":"calculated_value",label:t&&t.name,value:i,onChange:()=>null,disabled:!0})})]})})},mi={0:(0,J.__)("None","woocommerce-payments"),.25:"0.25","0.50":"0.50","1.00":"1.00 (recommended)","5.00":"5.00","10.00":"10.00"},_i={1:"1",10:"10",25:"25",50:"50",100:"100 (recommended)",500:"500",1e3:"1000"},pi={"0.00":(0,J.__)("None","woocommerce-payments"),"-0.01":"-0.01","-0.05":"-0.05"},yi={"0.00":(0,J.__)("None","woocommerce-payments"),"-1":"-1","-5":"-5","-10":"-10","-20":"-20","-25":"-25","-50":"-50","-100":"-100"},hi=()=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("h2",{children:(0,J.__)("Currency settings","woocommerce-payments")}),(0,V.jsx)("p",{children:(0,J.__)("Choose between automatic or manual exchange rates and modify formatting rules to refine the display of your prices.","woocommerce-payments")})]}),Si=()=>{var e,t;const{currencyCodeToShowSettingsFor:r,setCurrencyCodeToShowSettingsFor:o}=(0,Y.useContext)(ti),[n,a]=(0,Y.useState)(!1),{currencies:s}=Is(),{enabledCurrencies:i}=As(),{storeSettings:c}=Ns(),{currencySettings:d,isLoading:u,submitCurrencySettings:l}=(e=>{const{currencySettings:t,isLoading:r}=(0,_e.useSelect)((t=>{const{getCurrencySettings:r,isResolving:o}=t(es);return{currencySettings:r(e),isLoading:o("getCurrencySettings",[e])}})),{submitCurrencySettings:o}=(0,_e.dispatch)(es);return{currencySettings:t,isLoading:r,submitCurrencySettings:o}})(r),m=s.default?s.default:{},_=s.available?s.available[r]:{},p=_.is_zero_decimal?_i:mi,y=_.is_zero_decimal?yi:pi,h="automatic",S=_?.is_zero_decimal?"100":"1.00",g="0.00",[E,f]=(0,Y.useState)(h),[w,T]=(0,Y.useState)(0),[R,v]=(0,Y.useState)(S),[b,O]=(0,Y.useState)(g),[I,A]=(0,Y.useState)(!1);(0,Y.useEffect)((()=>{var e;d[r]&&(f(d[r].exchange_rate_type||h),T(d[r].manual_rate||0),v(null!==(e=d[r].price_rounding)&&void 0!==e?e:S),O(d[r].price_charm||g))}),[d,r,S]);const N=null!==(e=c.date_format)&&void 0!==e?e:"M j, Y",C=null!==(t=c.time_format)&&void 0!==t?t:"g:iA",x=_?(0,Fe.dateI18n)(`${N} ${C}`,Me().unix(_.last_updated).toISOString()):"";return(0,V.jsx)("div",{className:"single-currency-settings",children:(0,V.jsxs)(te,{children:[(0,V.jsxs)("h2",{className:"single-currency-settings-breadcrumb",children:[(0,V.jsx)(H.Button,{isLink:!0,onClick:()=>o(null),__next40pxDefaultSize:!0,children:(0,J.__)("Enabled currencies","woocommerce-payments")})," ","> ",_.name," (",_.code,")"," ",_.flag]}),(0,V.jsx)(re,{description:hi,children:(0,V.jsx)(X,{isLoading:u,numLines:33,children:(0,V.jsx)(H.Card,{className:"single-currency-settings-currency-settings",children:(0,V.jsxs)(H.CardBody,{className:"wcpay-card-body",children:[(0,V.jsx)("h4",{children:(0,J.__)("Exchange rate","woocommerce-payments")}),(0,V.jsx)("fieldset",{children:(0,V.jsxs)("ul",{children:[(0,V.jsx)("li",{children:(0,V.jsx)(H.RadioControl,{onChange:e=>{f(e),a(!0),"manual"===e&&T(w||_.rate)},options:[{description:_.last_updated?(0,J.sprintf)((0,J.__)("Current rate: 1 %s = %s %s (Last updated: %s)","woocommerce-payments"),m.code,_.rate,_.code,x):(0,J.__)("Error - Unable to fetch automatic rate for this currency","woocommerce-payments"),label:(0,J.__)("Fetch rates automatically","woocommerce-payments"),value:"automatic"},{description:(0,J.__)("Enter your fixed rate of exchange","woocommerce-payments"),label:(0,J.__)("Manual","woocommerce-payments"),value:"manual"}],selected:E})}),"manual"===E&&(0,V.jsx)("li",{children:(0,V.jsx)(H.TextControl,{"data-testid":"manual_rate_input",label:(0,J.__)("Manual Rate","woocommerce-payments"),help:(0,J.__)("Enter the manual rate you would like to use. Must be a positive number.","woocommerce-payments"),value:w||_.rate,onChange:e=>{T(e.replace(/,/g,".")),a(!0)},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})})]})}),(0,V.jsx)("h4",{children:(0,J.__)("Formatting rules","woocommerce-payments")}),(0,V.jsx)("fieldset",{children:(0,V.jsxs)("ul",{children:[(0,V.jsx)("li",{children:(0,V.jsx)(H.SelectControl,{"data-testid":"price_rounding",label:(0,J.__)("Price rounding","woocommerce-payments"),help:js({mixedString:(0,J.sprintf)((0,J.__)("Make your %s prices consistent by rounding them up after they're converted. {{learnMoreLink}}Learn more{{/learnMoreLink}}","woocommerce-payments"),_.code),components:{learnMoreLink:(0,V.jsx)(H.ExternalLink,{href:"https://woocommerce.com/document/woopayments/currencies/multi-currency-setup/#price-rounding"})}}),value:parseFloat(R),onChange:e=>{v(e),a(!0)},options:Object.keys(p).map((e=>({value:parseFloat(e),label:p[e]}))),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})}),(0,V.jsx)("li",{children:(0,V.jsx)(H.SelectControl,{"data-testid":"price_charm",label:(0,J.__)("Charm pricing","woocommerce-payments"),help:js({mixedString:(0,J.sprintf)((0,J.__)("Reduce the converted price for a specific amount. {{learnMoreLink}}Learn more{{/learnMoreLink}}","woocommerce-payments"),_.code),components:{learnMoreLink:(0,V.jsx)(H.ExternalLink,{href:"https://woocommerce.com/document/woopayments/currencies/multi-currency-setup/#charm-pricing"})}}),value:parseFloat(b),onChange:e=>{O(e),a(!0)},options:Object.keys(y).map((e=>({value:parseFloat(e),label:y[e]}))),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})})]})})]})})})}),(0,V.jsx)(re,{description:()=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("h2",{children:(0,J.__)("Preview","woocommerce-payments")}),(0,V.jsx)("p",{children:u?"":(0,J.sprintf)((0,J.__)("Enter a price in your default currency (%s) to see it converted to %s using the exchange rate and formatting rules above.","woocommerce-payments"),m.name,_.name)})]}),children:(0,V.jsx)(X,{isLoading:u,numLines:8,children:(0,V.jsx)(li,{className:"single-currency-settings-currency-preview",storeCurrency:m,targetCurrency:_,currencyRate:"manual"===E?w:null,roundingValue:R,charmValue:b})})}),(0,V.jsx)(re,{className:"single-currency-settings-save-settings-section",children:(0,V.jsx)(H.Button,{isPrimary:!0,isBusy:I,disabled:I||!n,onClick:()=>{A(!0),l(_.code,{exchange_rate_type:E,manual_rate:w,price_rounding:R,price_charm:b}),isNaN(w)||(i[_.code].rate=Number(w)),A(!1),a(!1)},__next40pxDefaultSize:!0,children:(0,J.__)("Save changes","woocommerce-payments")})})]})})},gi=()=>{const[e,t]=(0,Y.useState)(null);return(0,V.jsx)(ti.Provider,{value:{currencyCodeToShowSettingsFor:e,setCurrencyCodeToShowSettingsFor:t},children:e?(0,V.jsx)(Si,{}):(0,V.jsx)(di,{})})},Ei=document.querySelector("#wcpay_multi_currency_settings_container");(0,q.H)(Ei).render((0,V.jsx)(gi,{}))})()})(); |