1import{h as S,a1 as $,$ as T,r as d,a as D,a3 as k,ad as E,J as F,H as M,c2 as u,g as P,b8 as V,a6 as U,a5 as O,Z as R,D as q,aa as z,o as G,aJ as J,I as j,d9 as H,ds as K,dt as L,n as X}from"./DelivetyTheme/index.ts-dad3a01a.js";import{U as Z}from"./UpdateNotice-66ad3edb.js";import{d as Q}from"./app-13c97166.js";import{g as W}from"./getPaymentProviderNameFromType-822fb27f.js";const Y=S({__name:"paypal-provider",setup(A){const a=$(),t=T(),e=Q(),s=d(!1),n=d(!1),y=d(!0);let c=D({});const m=d(),i=k(()=>Number(t.getters["websiteManagement/domain"])),_=k(()=>r.username&&r.username.length>0&&r.password&&r.password.length>0),r=D({id:0,sandbox:!1,enabled:!1,username:"",password:""}),v=d(!1),N=E();F(()=>i.value,()=>{f()}),M(async()=>{await f()});async function f(){var w,g,h,C,x;if(!i.value||i.value===0)return;y.value=!0;const p={domain_id:i.value,providers:[u.Paypal]},[o,l]=await Promise.all([P(H,{input:p}),P(K)]);o&&(r.id=((w=o.paypalCredentials)==null?void 0:w.id)??0,r.enabled=((g=o.paypalCredentials)==null?void 0:g.enabled)??!1,r.sandbox=((h=o.paypalCredentials)==null?void 0:h.sandbox)??!1,r.username=((C=o.paypalCredentials)==null?void 0:C.username)??"",r.password=((x=o.paypalCredentials)==null?void 0:x.password)??""),l&&(c=l,b()),v.value=_.value&&!r.enabled&&m.value.indexOf(u.Paypal)===-1,y.value=!1}function b(){var o;if(!Array.isArray(c))return;const p=((o=e.currencySettings)==null?void 0:o.currency)??"USD";m.value=c.filter(l=>!l.currencies.includes(p)).map(l=>l.provider)}async function B(){if(n.value)return;n.value=!0;const p={payment_provider_type:u.Paypal,domain_id:i.value,paypalCredentials:r};await P(L,{input:p})&&(r.enabled=!0,v.value=!1),s.value=!0,setTimeout(()=>{n.value=!1},1500)}function I(){a.go(-1)}return{__sfc:!0,router:a,store:t,companyStore:e,updated:s,saving:n,loading:y,allowedCurrenciesPerProvider:c,currencyNotAllowedInProvider:m,domain:i,paypalFilled:_,paypal:r,showVerifyAndEnableButton:v,modal:N,init:f,checkIfCurrencyExistsInProviders:b,verifyAndEnablePaymentProvider:B,goBack:I,DtCard:V,DtCircle:U,UpdateNotice:Z,DtCheckbox:O,DtInput:R,DtButton:q,DtCardModal:z,PaymentProviderType:u,i18n:G,DtNotice:J,Icon:j,getPaymentProviderNameFromType:W}}});var ee=function(){var a=this,t=a._self._c,e=a._self._setupProxy;return t("div",{staticClass:"app-content-item admin-website-properties"},[t("div",{staticClass:"app-title-container app-title"},[t(e.DtCircle,{attrs:{type:"white",icon:"straight-left",size:"sm","icon-hover-color":"#3558B5"},on:{click:e.goBack}}),t("span",[a._v(a._s(e.getPaymentProviderNameFromType(e.PaymentProviderType.Paypal)))])],1),t(e.DtCard,{attrs:{width:"880px","with-cancel-button":"",loading:e.loading},on:{"button-cancel":e.goBack},scopedSlots:a._u([{key:"body",fn:function(){var s;return[e.currencyNotAllowedInProvider?t("section",{staticClass:"mt-4"},[t("div",{staticClass:"d-flex justify-content-between align-items-center"},[t("div",{staticClass:"property-title"},[a._v(" "+a._s(e.getPaymentProviderNameFromType(e.PaymentProviderType.Paypal))+" ")]),t("div",{staticClass:"color-primary font-weight-bold align-items-center d-flex cursor-pointer",on:{click:function(n){return e.modal.show("playPaypalVideo")}}},[t("span",{staticClass:"mr-1"},[t(e.Icon,{attrs:{height:"20",width:"20",name:"youtube"}})],1),a._v(" "+a._s(a.$t("admin.domains.watch_video"))+" ")])]),e.currencyNotAllowedInProvider.indexOf(e.PaymentProviderType.Paypal)!==-1?t(e.DtNotice,{staticClass:"mb-3",attrs:{type:"error"}},[a._v(" "+a._s(e.i18n.t("admin.domainProperties.invalid_provider_currency",{currency:(s=e.companyStore.currencySettings)==null?void 0:s.currency}))+" ")]):a._e(),t(e.DtInput,{staticClass:"mb-3",attrs:{id:"paymentProcessorPaypalUsername",name:"paymentProcessorPaypalUsername","aria-label":"","with-masking-toggle":"",label:e.i18n.t("admin.domainProperties.paypal_username").toString()},on:{change:function(n){e.showVerifyAndEnableButton=!0},input:function(n){e.paypal.username=n}},model:{value:e.paypal.username,callback:function(n){a.$set(e.paypal,"username",n)},expression:"paypal.username"}}),t(e.DtInput,{staticClass:"mb-3",attrs:{id:"paymentProcessorPaypalPassword",name:"paymentProcessorPaypalPassword","aria-label":"","with-masking-toggle":"",label:e.i18n.t("admin.domainProperties.paypal_password").toString()}
1,on:{change:function(n){e.showVerifyAndEnableButton=!0},input:function(n){e.paypal.password=n}},model:{value:e.paypal.password,callback:function(n){a.$set(e.paypal,"password",n)},expression:"paypal.password"}}),t(e.DtCheckbox,{staticClass:"mb-3",attrs:{id:"paymentProcessorPaypalMode",name:"paymentProcessorPaypalMode",type:"checkbox",label:e.i18n.t("admin.domainProperties.payment_provider_test_mode").toString()},on:{change:function(n){e.showVerifyAndEnableButton=!0}},model:{value:e.paypal.sandbox,callback:function(n){a.$set(e.paypal,"sandbox",n)},expression:"paypal.sandbox"}}),e.showVerifyAndEnableButton?t("div",[e.paypalFilled?t(e.DtButton,{attrs:{type:"primary-light",loading:e.saving},nativeOn:{click:function(n){return e.verifyAndEnablePaymentProvider.apply(null,arguments)}}},[a._v(" "+a._s(e.i18n.t("admin.domainProperties.verify_and_enable"))+" ")]):a._e(),e.paypalFilled?a._e():t(e.DtButton,{attrs:{type:"secondary",disabled:""}},[a._v(" "+a._s(e.i18n.t("admin.domainProperties.verify_and_enable"))+" ")])],1):a._e()],1):a._e()]},proxy:!0}])}),t(e.UpdateNotice,{attrs:{updated:e.updated},on:{updateNotice:function(s){e.updated=!1}}}),t(e.DtCardModal,{attrs:{name:"playPaypalVideo",adaptive:"",width:"640px",height:"auto","card-body-classes":"p-0","with-close-button":""},scopedSlots:a._u([{key:"header",fn:function(){return[t("div",{staticClass:"font-weight-bold"},[a._v(" "+a._s(e.getPaymentProviderNameFromType(e.PaymentProviderType.Paypal))+" ")])]},proxy:!0},{key:"body",fn:function(){return[t("iframe",{attrs:{width:"640",height:"395",src:"https://www.youtube.com/embed/ROcbMX7cIKs",title:"Admin panel tutorial",frameborder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowfullscreen:""}})]},proxy:!0}])})],1)},ae=[],te=X(Y,ee,ae,!1,null,null,null,null);const ie=te.exports;export{ie as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.