OwlCyberSecurity - MANAGER
Edit File: LicenseKey.DdUQ59RT.js
import{p as T,f as W,a as P,u as K,h as A,o as E}from"./links.Ce9S4kjc.js";import{p as O}from"./popup.6pJEdp0g.js";import"./default-i18n.DXRQgkn2.js";import{_ as B}from"./_plugin-vue_export-helper.BN1snXvA.js";import{S as H}from"./Checkmark.DOG99yeO.js";import{u as M,W as N}from"./Wizard.CFQPLwgY.js";import{C as U}from"./Caret.BthVBOwE.js";import{G as V,a as G}from"./Row.DRnp1mVs.js";import{W as I,a as D,b as F}from"./Header.COc3bf2s.js";import{W as R}from"./CloseAndExit.BgITO2y9.js";import{_ as Y}from"./Steps.o4ZsDC27.js";import{v as s,c as u,B as o,l as r,o as a,a as i,C as l,t as d,b as h,F as j,J as q,k as f}from"./runtime-dom.esm-bundler.tPRhSV4q.js";import"./helpers.CXsRrhc8.js";import"./params.B3T1WKlC.js";import"./addons.DW40jBC1.js";import"./upperFirst.yVnsg4QL.js";import"./_stringToArray.DnK4tKcY.js";import"./toString.zLSwYOtv.js";import"./Logo.bX-u9KVJ.js";import"./Index.hENYR9Tl.js";const J={setup(){const{strings:e}=M();return{connectStore:T(),licenseStore:W(),optionsStore:P(),rootStore:K(),setupWizardStore:A(),composableStrings:e}},components:{CoreAlert:U,GridColumn:V,GridRow:G,SvgCheckmark:H,WizardBody:I,WizardCloseAndExit:R,WizardContainer:D,WizardHeader:F,WizardSteps:Y},mixins:[N],data(){return{error:null,loading:!1,stage:"license-key",localLicenseKey:null,strings:E(this.composableStrings,{enterYourLicenseKey:this.$t.sprintf(this.$t.__("Enter your %1$s License Key",this.$td),"AIOSEO"),boldText:this.$t.sprintf("<strong>%1$s %2$s</strong>","AIOSEO","Lite"),purchasedBoldText:this.$t.sprintf("<strong>%1$s %2$s</strong>","AIOSEO","Pro"),linkText:this.$t.sprintf(this.$t.__("upgrade to %1$s",this.$td),"Pro"),placeholder:this.$t.__("Paste your license key here",this.$td),connect:this.$t.__("Connect",this.$td)})}},watch:{localLicenseKey(e){this.setupWizardStore.licenseKey=e}},computed:{noLicenseNeeded(){return this.$t.sprintf(this.$t.__("You're using %1$s - no license needed. Enjoy!",this.$td)+" 🙂",this.strings.boldText)},link(){return this.$t.sprintf('<strong><a href="%1$s" target="_blank">%2$s</a></strong>',this.$links.utmUrl("general-settings","license-box"),this.strings.linkText)},tooltipText(){return this.$isPro?this.$t.__("To unlock the selected features, please enter your license key below.",this.$td):this.$t.sprintf(this.$t.__("To unlock the selected features, please %1$s and enter your license key below.",this.$td),this.link)},alreadyPurchased(){return this.$t.sprintf(this.$t.__("Already purchased? Simply enter your license key below to connect with %1$s!",this.$td),this.strings.purchasedBoldText)}},methods:{processConnectOrActivate(){if(this.$isPro)return this.processActivateLicense();this.processGetConnectUrl()},processActivateLicense(){this.error=null,this.loading=!0,this.rootStore.loading=!0,this.licenseStore.activate(this.localLicenseKey).then(()=>{this.optionsStore.internalOptions.internal.license.expired=!1,this.setupWizardStore.saveWizard("license-key").then(()=>{this.$router.push(this.setupWizardStore.getNextLink)})}).catch(e=>{if(this.loading=!1,this.localLicenseKey=null,this.rootStore.loading=!1,!e||!e.response||!e.response.body||!e.response.body.error||!e.response.body.licenseData){this.error=this.$t.__("An unknown error occurred, please try again later.",this.$td);return}const n=e.response.body.licenseData;n.invalid?this.error=this.$t.__("The license key provided is invalid. Please use a different key to continue receiving automatic updates.",this.$td):n.disabled?this.error=this.$t.__("The license key provided is disabled. Please use a different key to continue receiving automatic updates.",this.$td):n.expired?this.error=this.licenseKeyExpired:n.activationsError?this.error=this.$t.__("This license key has reached the maximum number of activations. Please deactivate it from another site or purchase a new license to continue receiving automatic updates.",this.$td):(n.connectionError||n.requestError)&&(this.error=this.$t.__("There was an error connecting to the licensing API. Please try again later.",this.$td))})},processGetConnectUrl(){this.loading=!0,this.rootStore.loading=!0,this.connectStore.getConnectUrl({key:this.localLicenseKey,wizard:!0}).then(e=>{if(e.body.url){if(!e.body.popup)return this.loading=!1,this.rootStore.loading=!1,window.open(e.body.url);this.openPopup(e.body.url)}})},openPopup(e){O(e,"_self",600,630,!0,["file","token"],this.completedCallback,this.closedCallback)},completedCallback(e){return e.wizard=!0,this.connectStore.processConnect(e)},closedCallback(e){if(e)return window.location.reload();this.loading=!1,this.rootStore.loading=!1},skipStep(){this.setupWizardStore.saveWizard(),this.$router.push(this.setupWizardStore.getNextLink)}},mounted(){this.localLicenseKey=this.setupWizardStore.licenseKey}},Q={class:"aioseo-wizard-license-key"},X={class:"header"},Z=["innerHTML"],ee={class:"license-cta-box"},te=["innerHTML"],se=["innerHTML"],oe={class:"license-key"},ne=i("input",{type:"text",name:"username",autocomplete:"username",style:{display:"none"}},null,-1),re={class:"go-back"},ie=i("div",{class:"spacer"},null,-1);function ae(e,n,le,_,t,c){const g=s("wizard-header"),k=s("wizard-steps"),S=s("svg-checkmark"),b=s("grid-column"),$=s("grid-row"),L=s("base-input"),m=s("base-button"),v=s("core-alert"),y=s("router-link"),w=s("wizard-body"),z=s("wizard-close-and-exit"),x=s("wizard-container");return a(),u("div",Q,[o(g),o(x,null,{default:r(()=>[o(w,null,{footer:r(()=>[i("div",re,[o(y,{to:_.setupWizardStore.getPrevLink,class:"no-underline"},{default:r(()=>[l("←")]),_:1},8,["to"]),l(" "),o(y,{to:_.setupWizardStore.getPrevLink},{default:r(()=>[l(d(t.strings.goBack),1)]),_:1},8,["to"])]),ie,o(m,{type:"gray",onClick:c.skipStep},{default:r(()=>[l(d(t.strings.skipThisStep),1)]),_:1},8,["onClick"])]),default:r(()=>[o(k),i("div",X,d(t.strings.enterYourLicenseKey),1),e.$isPro?h("",!0):(a(),u("div",{key:0,class:"description",innerHTML:c.noLicenseNeeded},null,8,Z)),i("div",ee,[i("div",{innerHTML:c.tooltipText},null,8,te),o($,null,{default:r(()=>[(a(!0),u(j,null,q(e.getSelectedUpsellFeatures,(p,C)=>(a(),f(b,{sm:"6",key:C},{default:r(()=>[o(S),l(" "+d(p.name),1)]),_:2},1024))),128))]),_:1})]),e.$isPro?h("",!0):(a(),u("div",{key:1,innerHTML:c.alreadyPurchased},null,8,se)),i("form",oe,[ne,o(L,{type:"password",placeholder:t.strings.placeholder,"append-icon":t.localLicenseKey?"circle-check":null,autocomplete:"new-password",modelValue:t.localLicenseKey,"onUpdate:modelValue":n[0]||(n[0]=p=>t.localLicenseKey=p)},null,8,["placeholder","append-icon","modelValue"]),o(m,{type:"green",disabled:!t.localLicenseKey,loading:t.loading,onClick:c.processConnectOrActivate},{default:r(()=>[l(d(t.strings.connect),1)]),_:1},8,["disabled","loading","onClick"])]),t.error?(a(),f(v,{key:2,class:"license-key-error",type:"red",innerHTML:t.error},null,8,["innerHTML"])):h("",!0)]),_:1}),o(z)]),_:1})])}const Te=B(J,[["render",ae]]);export{Te as default};