← Back
Editing: wcpay-multi-currency-setup.js
"use strict";(globalThis.webpackChunkwoocommerce_payments=globalThis.webpackChunkwoocommerce_payments||[]).push([[3791],{4979(e,t,s){s.d(t,{A:()=>i}),s(1609);var r=s(6427),c=s(3526),n=s(5573),a=s(790);const i=({children:e,actions:t,className:s,...i})=>(0,a.jsxs)(r.Modal,{className:(0,c.A)("wcpay-confirmation-modal",s),...i,children:[e,(0,a.jsx)(n.HorizontalRule,{className:"wcpay-confirmation-modal__separator"}),(0,a.jsx)("div",{className:"wcpay-confirmation-modal__footer",children:t})]})},2600(e,t,s){s.d(t,{A:()=>a,a:()=>n}),s(1609);var r=s(790);const c=({isLoading:e,display:t,placeholder:s,value:c,children:n,...a})=>e?(0,r.jsx)("span",{className:t?`is-loadable-placeholder is-${t}`:"is-loadable-placeholder","aria-busy":"true",...a,children:void 0===s?n||c:s}):(0,r.jsx)(r.Fragment,{children:n||c}),n=({numLines:e,...t})=>{const s=(0,r.jsx)("p",{style:{lineHeight:e},children:"Block placeholder"});return(0,r.jsx)(c,{...t,placeholder:s,display:"block","aria-hidden":!0})},a=c},9700(e,t,s){s.d(t,{A:()=>i});var r=s(1609),c=s(3526),n=s(2598),a=s(790);const i=({className:e,...t})=>{const{isActive:s}=(0,r.useContext)(n.A);return(0,a.jsx)("div",{className:(0,c.A)("task-collapsible-body",e,{"is-active":s}),...t})}},9048(e,t,s){s.d(t,{A:()=>d});var r=s(1609),c=s(3526),n=s(3643),a=s(9121),i=s(2598),o=s(790);const d=({children:e,title:t,index:s,className:d,visibleDescription:l})=>{const{isCompleted:u,isActive:m}=(0,r.useContext)(i.A);return(0,o.jsxs)("li",{className:(0,c.A)("wcpay-wizard-task",d,{"is-completed":u,"is-active":m}),children:[(0,o.jsx)("div",{className:"wcpay-wizard-task__top-border"}),(0,o.jsxs)("div",{className:"wcpay-wizard-task__headline",tabIndex:-1,children:[(0,o.jsxs)("div",{className:"wcpay-wizard-task__icon-wrapper",children:[(0,o.jsx)("div",{className:"wcpay-wizard-task__icon-text",children:s}),(0,o.jsx)(n.A,{icon:a.A,className:"wcpay-wizard-task__icon-checkmark"})]}),(0,o.jsx)("span",{className:"wcpay-wizard-task__title",children:t})]}),l&&!m&&(0,o.jsx)("span",{className:(0,c.A)("wcpay-wizard-task__visible-description-element","is-muted-color"),children:l}),(0,o.jsx)("div",{className:"wcpay-wizard-task__body",children:e})]})}},6581(e,t,s){s.d(t,{A:()=>a});var r=s(1609),c=s(6306),n=s(790);const a=({children:e})=>{const t=(0,r.useRef)(!0),s=(0,r.useRef)(null),{activeTask:a}=(0,r.useContext)(c.A);return(0,r.useLayoutEffect)(()=>{if(!0===t.current)return void(t.current=!1);if(!s.current)return;const e=s.current.querySelector(".wcpay-wizard-task.is-active .wcpay-wizard-task__headline");e&&e.focus()},[a]),(0,n.jsx)("div",{ref:s,children:(0,n.jsx)("ul",{children:e})})}},1683(e,t,s){s.d(t,{A:()=>i});var r=s(1609),c=s(6306),n=s(2598),a=s(790);const i=({children:e,id:t=""})=>{const{activeTask:s,completedTasks:i,setActiveTask:o,setCompletedTasks:d}=(0,r.useContext)(c.A),l=(0,r.useMemo)(()=>({isActive:t===s,setActive:()=>o(t),setCompleted:(e=!0,s="")=>{d(s=>({...s,[t]:e})),s&&o(s)},taskId:t,isCompleted:Boolean(i[t])}),[o,d,s,i,t]);return(0,a.jsx)(n.A.Provider,{value:l,children:e})}},6306(e,t,s){s.d(t,{A:()=>r});const r=(0,s(1609).createContext)({activeTask:"",setActiveTask:()=>null,completedTasks:{},setCompletedTasks:()=>null})},4245(e,t,s){s.d(t,{A:()=>a});var r=s(1609),c=s(6306),n=s(790);const a=({children:e,defaultActiveTask:t="",defaultCompletedTasks:s={}})=>{const[a,i]=(0,r.useState)(t),[o,d]=(0,r.useState)(s),l=(0,r.useMemo)(()=>({activeTask:a,setActiveTask:i,completedTasks:o,setCompletedTasks:d}),[a,i,o]);return(0,n.jsx)(c.A.Provider,{value:l,children:e})}},3861(e,t,s){s(1609),s(790)},593(e,t,s){s.d(t,{A:()=>c}),s(1609);var r=s(790);const c=({children:e})=>(0,r.jsx)("div",{className:"wcpay-settings-layout",children:e})},6737(e,t,s){s.d(t,{A:()=>a}),s(1609);var r=s(3526),c=s(790);const n=()=>null,a=({description:e=n,children:t,className:s,id:a})=>(0,c.jsxs)("div",{className:(0,r.A)("settings-section",s),id:a,children:[(0,c.jsx)("div",{className:"settings-section__details",children:(0,c.jsx)(e,{})}),(0,c.jsx)("div",{className:"settings-section__controls",children:t})]})},7572(e,t,s){s.d(t,{A:()=>i});var r=s(6427),c=s(7723),n=s(7229),a=s(790);const i=({isPreviewModalOpen:e,setPreviewModalOpen:t,isStorefrontSwitcherEnabledValue:s,isAutomaticSwitchEnabledValue:i})=>{const{storeSettings:o}=(0,n.mQ)();return e&&(0,a.jsx)(r.Modal,{title:(0,c.__)("Preview","woocommerce-payments"),isDismissible:!0,className:"multi-currency-store-settings-preview-modal",shouldCloseOnClickOutside:!1,onRequestClose:()=>{t(!1)},children:(0,a.jsx)("iframe",{title:(0,c.__)("Preview","woocommerce-payments"),className:"multi-currency-store-settings-preview-iframe",src:"/"+o.store_url+"?is_mc_onboarding_simulation=1&enable_storefront_switcher="+s+"&enable_auto_currency="+i})})}},1881(e,t,s){s.d(t,{A:()=>r});const r={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"}},3052(e,t,s){s.r(t),s.d(t,{saveOption:()=>x,saveStoreSettings:()=>C,submitCurrencySettings:()=>w,submitEnabledCurrenciesUpdate:()=>E,updateAvailableCurrencies:()=>m,updateCurrencies:()=>u,updateCurrencySettings:()=>y,updateDefaultCurrency:()=>p,updateEnabledCurrencies:()=>_,updateIsSavingStoreSettings:()=>g,updateStoreSettingValues:()=>S,updateStoreSettings:()=>h});var r=s(6161),c=s(1455),n=s.n(c),a=s(7143),i=s(7723),o=s(5395),d=s(1881),l=s(7794);function u(e){return{type:d.A.SET_CURRENCIES,data:e}}function m(e){return{type:d.A.SET_AVAILABLE_CURRENCIES,data:e}}function _(e){return{type:d.A.SET_ENABLED_CURRENCIES,data:e}}function p(e){return{type:d.A.SET_DEFAULT_CURRENCY,data:e}}function y(e,t){return{type:d.A.SET_CURRENCY_SETTINGS,data:{code:e,data:t}}}function h(e){return{type:d.A.SET_STORE_SETTINGS,data:e}}function S(e){return{type:d.A.SET_STORE_SETTINGS_VALUES,data:e}}function g(e,t){return{type:d.A.SET_IS_SAVING_STORE_SETTINGS,data:{isSaving:e,error:t}}}function*E(e){const t=Object.keys((0,a.select)(l.E).getEnabledCurrencies()),s=e.filter(e=>!t.includes(e)),c=t.filter(t=>!e.includes(t));try{const t=yield(0,r.apiFetch)({path:`${l.C}/multi-currency/update-enabled-currencies`,method:"POST",data:{enabled:e}});yield u(t),yield(0,a.dispatch)("core/notices").createSuccessNotice((0,i.__)("Enabled currencies updated.","woocommerce-payments")),(0,o.yM)("wcpay_multi_currency_enabled_currencies_updated",{added_currencies:s,removed_currencies:c})}catch(e){yield(0,a.dispatch)("core/notices").createErrorNotice((0,i.__)("Error updating enabled currencies.","woocommerce-payments"))}}function*w(e,t){try{const s=yield(0,r.apiFetch)({path:`${l.C}/multi-currency/currencies/${e}`,method:"POST",data:t});yield y(e,s),yield(0,a.dispatch)("core/notices").createSuccessNotice((0,i.__)("Currency settings updated.","woocommerce-payments"))}catch(e){yield(0,a.dispatch)("core/notices").createErrorNotice((0,i.__)("Error updating currency settings.","woocommerce-payments"))}}function*C(e=!1){let t=null;try{const t=(0,a.select)(l.E).getStoreSettings();yield g(!0,null);const s=yield(0,r.apiFetch)({path:`${l.C}/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",wcpay_multi_currency_cache_recommendation_dismissed:t.cache_recommendation_dismissed?"yes":"no"}});yield h(s),e||(yield(0,a.dispatch)("core/notices").createSuccessNotice((0,i.__)("Store settings saved.","woocommerce-payments")))}catch(e){t=e,yield(0,a.dispatch)("core/notices").createErrorNotice((0,i.__)("Error saving store settings.","woocommerce-payments"))}finally{yield g(!1,t)}}function x(e,t){n()({path:`${l.C}/settings/${e}`,method:"post",data:{value:t}}).catch(()=>{(0,a.dispatch)("core/notices").createErrorNotice((0,i.__)("Error saving option","woocommerce-payments"))})}},7794(e,t,s){s.d(t,{C:()=>r,E:()=>c});const r="/wc/v3/payments",c="wc/payments/multi-currency"},6919(e,t,s){s.d(t,{EQ:()=>i,Y5:()=>a,ZN:()=>n,mQ:()=>o,om:()=>d});var r=s(7143),c=s(7794);const n=()=>(0,r.useSelect)(e=>{const{getCurrencies:t,isResolving:s}=e(c.E);return{currencies:t(),isLoading:s("getCurrencies",[])}},[]),a=()=>(0,r.useSelect)(e=>{const{getAvailableCurrencies:t}=e(c.E);return t()}),i=()=>{const e=(0,r.useSelect)(e=>{const{getEnabledCurrencies:t}=e(c.E);return t()}),{submitEnabledCurrenciesUpdate:t}=(0,r.useDispatch)(c.E);return{enabledCurrencies:e,submitEnabledCurrenciesUpdate:t}},o=()=>{const{storeSettings:e,isLoading:t,isDirty:s,isSaving:n}=(0,r.useSelect)(e=>{const{getStoreSettings:t,isStoreSettingsDirty:s,isSavingStoreSettings:r,isResolving:n}=e(c.E);return{storeSettings:t(),isLoading:n("getStoreSettings",[]),isDirty:s(),isSaving:r()}}),{updateStoreSettingValues:a,saveStoreSettings:i}=(0,r.useDispatch)(c.E);return{storeSettings:e,isLoading:t,isDirty:s,isSaving:n,updateStoreSettingValues:a,saveStoreSettings:i}},d=()=>(0,r.useSelect)(e=>{const{getDefaultCurrency:t}=e(c.E);return t()})},7229(e,t,s){s.d(t,{EQ:()=>i.EQ,K6:()=>a,Tp:()=>c,Y5:()=>i.Y5,ZN:()=>i.ZN,mQ:()=>i.mQ,o1:()=>n,om:()=>i.om});var r=s(2502),c=s(2033),n=s(3052),a=s(7052),i=s(6919);(0,r.k)()},2023(e,t,s){s.d(t,{A:()=>n});var r=s(1881);const c={},n=(e=c,{type:t,data:s=[]})=>{switch(t){case r.A.SET_CURRENCIES:return{...e,currencies:s,available:s.available,enabled:s.enabled,default:s.default};case r.A.SET_AVAILABLE_CURRENCIES:return{...e,currencies:{...e,available:s.available},available:s.available};case r.A.SET_ENABLED_CURRENCIES:return{...e,currencies:{...e,enabled:s.enabled},enabled:s.enabled};case r.A.SET_DEFAULT_CURRENCY:return{...e,currencies:{...e,default:s.default},default:s.default};case r.A.SET_CURRENCY_SETTINGS:return{...e,currency_settings:{...e.currency_settings,[s.code]:s.data}};case r.A.SET_STORE_SETTINGS:return{...e,settings:{...e.settings,isDirty:!1,data:{enable_auto_currency:s.wcpay_multi_currency_enable_auto_currency,enable_storefront_switcher:s.wcpay_multi_currency_enable_storefront_switcher,rendering_mode:s.wcpay_multi_currency_rendering_mode,is_cache_optimized_feature_enabled:s.is_cache_optimized_feature_enabled,should_recommend_cache_mode:s.should_recommend_cache_mode,cache_recommendation_dismissed:s.cache_recommendation_dismissed,site_theme:s.site_theme,date_format:s.date_format,time_format:s.time_format,store_url:s.store_url}}};case r.A.SET_STORE_SETTINGS_VALUES:return{...e,settings:{...e.settings,savingError:null,isDirty:!0,data:{...e.settings?.data||{},...s}}};case r.A.SET_IS_SAVING_STORE_SETTINGS:return{...e,settings:{...e.settings,isDirty:!(!s.isSaving&&!s.error)&&(e.settings?.isDirty??!1),isSaving:s.isSaving,savingError:s.error}}}return e}},7052(e,t,s){s.r(t),s.d(t,{getCurrencies:()=>o,getCurrencySettings:()=>d,getStoreSettings:()=>l});var r=s(7143),c=s(6161),n=s(7723),a=s(7794),i=s(3052);function*o(){const e=`${a.C}/multi-currency/currencies`;try{const t=yield(0,c.apiFetch)({path:e});yield(0,i.updateCurrencies)(t)}catch(e){yield(0,r.dispatch)("core/notices").createErrorNotice((0,n.__)("Error retrieving currencies.","woocommerce-payments"))}}function*d(e){const t=`${a.C}/multi-currency/currencies/${e}`;try{const s=yield(0,c.apiFetch)({path:t});yield(0,i.updateCurrencySettings)(e,s)}catch(e){yield(0,r.dispatch)("core/notices").createErrorNotice((0,n.__)("Error retrieving single currency settings.","woocommerce-payments"))}}function*l(){const e=`${a.C}/multi-currency/get-settings`;try{const t=yield(0,c.apiFetch)({path:e});yield(0,i.updateStoreSettings)(t)}catch(e){yield(0,r.dispatch)("core/notices").createErrorNotice((0,n.__)("Error retrieving store settings.","woocommerce-payments"))}}},2033(e,t,s){s.r(t),s.d(t,{getAvailableCurrencies:()=>n,getCurrencies:()=>c,getCurrencySettings:()=>o,getDefaultCurrency:()=>i,getEnabledCurrencies:()=>a,getStoreSettings:()=>d,isSavingStoreSettings:()=>u,isStoreSettingsDirty:()=>l});const r=e=>e&&e||{},c=e=>r(e).currencies||{},n=e=>c(e).available||{},a=e=>c(e).enabled||{},i=e=>c(e).default||{},o=e=>r(e).currency_settings||{},d=e=>r(e).settings?.data||{},l=e=>r(e).settings?.isDirty??!1,u=e=>r(e).settings?.isSaving??!1},2502(e,t,s){s.d(t,{k:()=>o});var r=s(7143),c=s(6161),n=s(7794),a=s(7229),i=s(2023);const o=()=>(0,r.registerStore)(n.E,{reducer:i.A,actions:{...a.o1},controls:c.controls,selectors:{...a.Tp},resolvers:{...a.K6}})},3432(e,t,s){s.d(t,{MultiCurrencySetupPage:()=>l.A,TW:()=>i.A,YW:()=>o.A,ah:()=>d.a,hx:()=>r.A,k5:()=>a.A,rM:()=>n.A,sQ:()=>c.A});var r=s(9700),c=s(4245),n=s(1683),a=s(9048),i=s(6581),o=(s(4979),s(3029)),d=s(2600),l=(s(3861),s(593),s(6737),s(92))},8548(e,t,s){s.d(t,{g0:()=>r.g0,t0:()=>r.t0});var r=s(2819);s(7229)},8573(e,t,s){s.d(t,{A:()=>c}),s(1609);var r=s(790);const c=({children:e})=>(0,r.jsx)("ul",{children:e})},1204(e,t,s){s.d(t,{A:()=>i}),s(1609);var r=s(6087),c=s(6715),n=s(6427),a=s(790);const i=({onChange:e,checked:t=!1,currency:{flag:s,symbol:i,code:o,name:d},testId:l=null})=>{const u=(0,r.useCallback)(t=>{e(o,t)},[o,e]);return(0,a.jsx)("li",{className:"enabled-currency-checkbox","data-testid":l,children:(0,a.jsx)(n.CheckboxControl,{code:o,checked:t,onChange:u,label:(0,c.A)({mixedString:"{{flag /}} {{name /}} {{code /}}",components:{flag:(0,a.jsx)("span",{className:"enabled-currency-checkbox__flag",children:""!==s?s:(0,a.jsx)("div",{className:"enabled-currency-checkbox__flag-text",children:(0,a.jsx)("span",{children:o})})}),name:(0,a.jsx)("span",{children:d}),code:(0,a.jsxs)("span",{className:"enabled-currency-checkbox__code",children:["(",i,i!==o&&" "+o,")"]})}}),__nextHasNoMarginBottom:!0})})}},92(e,t,s){s.d(t,{A:()=>i});var r=s(3866),c=s(3432),n=s(5395),a=s(790);const i=()=>{const{isSetupCompleted:e}=window.wcpaySettings.multiCurrencySetup;return(0,a.jsx)(c.YW,{children:(0,a.jsx)(n.nJ.Provider,{value:window.wcpaySettings,children:(0,a.jsx)(r.A,{isSetupCompleted:e})})})}},3978(e,t,s){s.d(t,{L:()=>c,b:()=>n});var r=s(7723);const c=[(0,r.__)("any","woocommerce-payments"),(0,r.__)("one","woocommerce-payments"),(0,r.__)("two","woocommerce-payments"),(0,r.__)("three","woocommerce-payments"),(0,r.__)("four","woocommerce-payments"),(0,r.__)("five","woocommerce-payments"),(0,r.__)("six","woocommerce-payments"),(0,r.__)("seven","woocommerce-payments"),(0,r.__)("eight","woocommerce-payments"),(0,r.__)("nine","woocommerce-payments")],n=["USD","EUR","JPY","GBP","AUD","CAD","INR"]},7735(e,t,s){s.d(t,{A:()=>g});var r=s(1609),c=s(7723),n=s(6715),a=s(8468),i=s.n(a),o=s(6427),d=s(5395),l=s(3432),u=s(7229),m=s(8573),_=s(1204),p=s(3978),y=s(2226),h=s(790);const S=({enabledCurrencyCodes:e,selectedCurrencyCodes:t,selectedCurrencyCodesLength:s,isSaving:r,submitEnabledCurrenciesUpdate:n,setCompleted:a,setSaving:i})=>{const d=e.length<=1&&s<1;return(0,h.jsx)(o.Button,{isBusy:r,disabled:r||d,onClick:()=>{s>0&&(i(!0),n([...e,...t].sort()),i(!1)),a({initialCurrencies:e},"multi-currency-settings")},variant:"primary",__next40pxDefaultSize:!0,children:0===s?e.length>1?(0,c.__)("Continue","woocommerce-payments"):(0,c.__)("Add currencies","woocommerce-payments"):(0,c.sprintf)((0,c._n)("Add %s currency","Add %s currencies",s,"woocommerce-payments"),s)})},g=()=>{const{isLoading:e}=(0,u.ZN)(),[t,s]=(0,r.useState)(!1),{isActive:a,setCompleted:g}=(0,r.useContext)(d.KX),{enabledCurrencies:E,submitEnabledCurrenciesUpdate:w}=(0,u.EQ)(),C=(0,u.Y5)(),x=(0,u.om)(),v=Object.keys(C),b=Object.keys(E),A=x.code,T=v.filter(e=>!b.includes(e)),N=p.b.filter(e=>T.includes(e)),[f,j]=(0,r.useState)(N);(0,r.useEffect)(()=>{a&&j(N)},[N.length]);const k=f.length,R=(e,t)=>{j(t?[...f,e]:i().without(f,e))},[I,L]=(0,r.useState)(""),U=I?T.filter(e=>{const{symbol:t,name:s}=C[e];return`${t} ${e} ${s}`.toLocaleLowerCase().indexOf(I.toLocaleLowerCase())>-1}):T.filter(e=>!p.b.includes(e)),D=(e,t="")=>v.length&&(0,h.jsx)(_.A,{checked:f.includes(e),onChange:R,currency:C[e],testId:i().isString(t)?t:null},"currency-checkbox-"+C[e].id);return(0,h.jsx)(l.k5,{className:"add-currencies-task",title:(0,c.__)("Add currencies","woocommerce-payments"),visibleDescription:(0,c.sprintf)((0,c._n)("%s currency added","%s currencies added",k,"woocommerce-payments"),k<10?i().capitalize(p.L[k]):k),index:1,children:(0,h.jsxs)(l.hx,{children:[(0,h.jsx)("p",{className:"wcpay-wizard-task__description-element is-muted-color",children:!e&&(0,n.A)({mixedString:(0,c.__)("Add currencies so international customers can shop and pay in their local currency. Your store's default currency is {{storeCurrencyText /}}.","woocommerce-payments"),components:{storeCurrencyText:(0,h.jsx)("strong",{children:(0,y.v)(x)})}})}),b.length>1&&(0,h.jsx)("p",{className:"wcpay-wizard-task__description-element is-muted-color",children:(0,n.A)({mixedString:(0,c.__)("You've already added {{enabledCurrenciesText /}} to your store.","woocommerce-payments"),components:{enabledCurrenciesText:(0,h.jsx)("strong",{children:(0,y.p)(b,A,C)})}})}),(0,h.jsx)(o.Card,{className:"add-currencies-task__currency-selector-wrapper",children:(0,h.jsxs)(o.CardBody,{children:[(0,h.jsx)("div",{className:"add-currencies-task__search",children:(0,h.jsx)(o.SearchControl,{__nextHasNoMarginBottom:!0,value:I,onChange:L,placeholder:(0,c.__)("Search currencies","woocommerce-payments")})}),(0,h.jsx)("div",{className:"add-currencies-task__separator"}),I&&(0,h.jsx)("h4",{children:(0,c.sprintf)((0,c.__)("Search results (%1$d currencies)","woocommerce-payments"),U.length)}),(0,h.jsx)(l.ah,{numLines:30,isLoading:e&&C,children:(0,h.jsx)("div",{className:"add-currencies-task__content",children:(0,h.jsxs)(m.A,{children:[!I&&N.length?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("li",{children:(0,h.jsx)("h4",{children:(0,c.__)("Recommended currencies","woocommerce-payments")})}),N.map(e=>D(e,"recommended-currency")),(0,h.jsx)("li",{className:"add-currencies-task__separator"})]}):"",!I&&(0,h.jsx)("li",{className:"add-currencies-task__available-currencies",children:(0,h.jsx)("h4",{children:(0,c.__)("All currencies","woocommerce-payments")})}),U.map(D)]})})})]})}),(0,h.jsx)(l.ah,{numLines:5,isLoading:e&&C,children:(0,h.jsx)(S,{enabledCurrencyCodes:b,selectedCurrencyCodes:f,selectedCurrencyCodesLength:k,isSaving:t,submitEnabledCurrenciesUpdate:w,setCompleted:g,setSaving:s})})]})})}},2226(e,t,s){s.d(t,{p:()=>n,v:()=>c});var r=s(7723);const c=e=>{if(e&&e.name&&e.symbol&&e.code){const t=e.name,s=e.code===e.symbol?e.code:(0,r.sprintf)("%s %s",e.symbol,e.code);return(0,r.sprintf)("%s (%s)",t,s)}return""},n=(e,t,s)=>{const n=e.filter(e=>e!==t&&s[e]).map(e=>c(s[e]));if(0===n.length)return"";if(1===n.length)return n[0];const a=n.pop(),i=n.join(", ");return(0,r.sprintf)((0,r._n)("%1$s and %2$s","%1$s, and %2$s",n.length,"woocommerce-payments"),i,a)}},3866(e,t,s){s.d(t,{A:()=>d}),s(1609);var r=s(6427),c=s(3432),n=s(1231),a=s(4853),i=s(7735),o=s(790);const d=({isSetupCompleted:e})=>"yes"===e?(window.location.assign("admin.php?page=wc-settings&tab=wcpay_multi_currency"),null):(0,o.jsx)(r.Card,{className:"multi-currency-setup-wizard",children:(0,o.jsx)(r.CardBody,{children:(0,o.jsx)(c.sQ,{defaultActiveTask:"add-currencies",children:(0,o.jsxs)(c.TW,{children:[(0,o.jsx)(c.rM,{id:"add-currencies",children:(0,o.jsx)(i.A,{})}),(0,o.jsx)(c.rM,{id:"multi-currency-settings",children:(0,o.jsx)(n.A,{})}),(0,o.jsx)(c.rM,{id:"setup-complete",children:(0,o.jsx)(a.A,{})})]})})})})},4853(e,t,s){s.d(t,{A:()=>u}),s(1609);var r=s(6087),c=s(7723),n=s(6427),a=s(3432),i=s(5395),o=s(7229),d=s(3052),l=s(790);const u=()=>{const{isActive:e}=(0,r.useContext)(i.KX),t=(0,o.om)();return(0,r.useEffect)(()=>{e&&((0,d.saveOption)("wcpay_multi_currency_setup_completed",!0),window.wcpaySettings.multiCurrencySetup.isSetupCompleted="yes")},[e]),(0,l.jsx)(a.k5,{title:(0,c.__)("Setup complete","woocommerce-payments"),index:3,children:(0,l.jsxs)(a.hx,{children:[(0,l.jsx)("p",{className:"wcpay-wizard-task__description-element is-muted-color",children:(0,c.__)("You're ready to begin accepting payments using foreign currencies!","woocommerce-payments")}),(0,l.jsx)("p",{className:"wcpay-wizard-task__description-element is-muted-color",children:(0,c.sprintf)((0,c.__)("Your product prices are automatically converted from your default currency (%s) based on the currency exchange rate and formatting rules for each currency.","woocommerce-payments"),t&&t.name)}),(0,l.jsx)("p",{className:"wcpay-wizard-task__description-element is-muted-color",children:(0,c.__)("To enter your own exchange rates or update the formatting rules for each currency, visit the Multi-Currency settings.","woocommerce-payments")}),(0,l.jsx)("br",{}),(0,l.jsxs)("div",{className:"setup-complete-task__buttons",children:[(0,l.jsx)(n.Button,{href:"admin.php?page=wc-admin",variant:"primary",__next40pxDefaultSize:!0,children:(0,c.__)("Back to home","woocommerce-payments")}),(0,l.jsx)(n.Button,{href:"admin.php?page=wc-settings&tab=wcpay_multi_currency",variant:"tertiary",__next40pxDefaultSize:!0,children:(0,c.__)("View Multi-Currency settings","woocommerce-payments")})]})]})})}},1231(e,t,s){s.d(t,{A:()=>_});var r=s(1609),c=s(7723),n=s(6715),a=s(6427),i=s(3432),o=s(5395),d=s(8548),l=s(7572),u=s(7229),m=s(790);const _=()=>{const{storeSettings:e,isSaving:t,updateStoreSettingValues:s,saveStoreSettings:_}=(0,u.mQ)(),{saveSettings:p,isSaving:y}=(0,d.t0)(),[h,S]=(0,d.g0)(),[g,E]=(0,r.useState)(!1),{setCompleted:w}=(0,r.useContext)(o.KX);return(0,m.jsx)(i.k5,{title:(0,n.A)({mixedString:(0,c.__)("{{wrapper}}Review store settings{{/wrapper}}","woocommerce-payments"),components:{wrapper:(0,m.jsx)("span",{})}}),visibleDescription:(0,c.__)("These settings can be changed any time by visiting the Multi-Currency settings","woocommerce-payments"),index:2,children:(0,m.jsxs)(i.hx,{className:"multi-currency-settings-task__body",children:[(0,m.jsx)("p",{className:"wcpay-wizard-task__description-element is-muted-color",children:(0,c.__)("These settings can be changed any time by visiting the Multi-Currency settings","woocommerce-payments")}),(0,m.jsx)(a.Card,{className:"multi-currency-settings-task__wrapper",children:(0,m.jsx)(a.CardBody,{children:(0,m.jsxs)(a.Flex,{direction:"column",gap:4,children:[(0,m.jsx)(a.FlexItem,{children:(0,m.jsx)(a.CheckboxControl,{checked:!!e.enable_auto_currency,onChange:e=>s({enable_auto_currency:e}),"data-testid":"enable_auto_currency",label:(0,c.__)("Automatically switch customers to their local currency if it has been enabled","woocommerce-payments"),help:(0,c.__)("Customers will be notified via store alert banner.","woocommerce-payments"),__nextHasNoMarginBottom:!0})}),"Storefront"===e.site_theme?(0,m.jsx)(a.FlexItem,{children:(0,m.jsx)(a.CheckboxControl,{checked:!!e.enable_storefront_switcher,onChange:e=>s({enable_storefront_switcher:e}),"data-testid":"enable_storefront_switcher",label:(0,c.__)("Add a currency switcher to the Storefront theme on breadcrumb section.","woocommerce-payments"),help:(0,c.__)("A currency switcher is also available in your widgets.","woocommerce-payments"),__nextHasNoMarginBottom:!0})}):null]})})}),(0,m.jsx)(a.Button,{isBusy:t||y,disabled:t||y,onClick:()=>{h||(S(!0),p()),_(!h),w(!0,"setup-complete")},variant:"primary",__next40pxDefaultSize:!0,children:(0,c.__)("Continue","woocommerce-payments")}),(0,m.jsx)(a.Button,{isBusy:t||y,disabled:t||y,onClick:()=>E(!0),className:"multi-currency-setup-preview-button",variant:"tertiary",__next40pxDefaultSize:!0,children:(0,c.__)("Preview","woocommerce-payments")}),(0,m.jsx)(l.A,{isPreviewModalOpen:g,setPreviewModalOpen:E,isStorefrontSwitcherEnabledValue:!!e.enable_storefront_switcher,isAutomaticSwitchEnabledValue:!!e.enable_auto_currency})]})})}}}]);
Save File
Cancel