Files
2026-04-28 15:13:50 +02:00

2 lines
7.8 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as e,s as h,m as x,d as L,u as w,b as P}from"./index.ZNJz487u.js";import{p as W,u as B}from"./LicenseUpgrade.DwCB6v67.js";import{u as E,a as z}from"./SetupWizard.tLXe7-Uu.js";import{C as T,D as y}from"./luxon.D0U2KiOE.js";import{_ as K}from"./Button.Bac-oBXH.js";import{B as N}from"./Input.Cq2G8d2G.js";import{_ as C}from"./_plugin-vue_export-helper.BN1snXvA.js";import{o as a,c as p,f as s,r as k,a as u,w as f,j as d,t as r,h as O,d as g,l as M,n as U}from"./runtime-dom.esm-bundler.DYN7TRGp.js";import{u as D}from"./LicenseStore.DAzcp1Mc.js";const F={},q={viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"aioseo-circle-check-solid"};function V(i,o){return a(),p("svg",q,[...o[0]||(o[0]=[s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M1.75 10.5C1.75 5.67 5.67 1.75 10.5 1.75C15.33 1.75 19.25 5.67 19.25 10.5C19.25 15.33 15.33 19.25 10.5 19.25C5.67 19.25 1.75 15.33 1.75 10.5ZM8.75 12.3988L14.5163 6.63251L15.75 7.87501L8.75 14.875L5.25 11.375L6.48375 10.1413L8.75 12.3988Z",fill:"currentColor"},null,-1)])])}const R=C(F,[["render",V]]),t="broken-link-checker-seo",Y={setup(){return{licenseStore:D(),licenseUpgradeComposable:B(),links:L,optionsStore:P(),rootStore:w(),setupWizardComposable:z(),setupWizardStore:E()}},components:{BaseButton:K,BaseInput:N,CoreAlert:T,SvgCircleCheckSolid:R},props:{isSetupWizard:Boolean},data(){return{DateTime:y,licenseKey:"",devLicenseKey:"",error:null,creatingNewAccount:!1,connectingWithExistingAccount:!1,activating:!1,deactivating:!1,strings:x({createAccount:e("Create a Free Account",t),connectExistingAccount:e("Connect to an Existing Account",t),or:e("OR",t),boldText:h("<strong>%1$s %2$s</strong>","Broken Link Checker","Free"),disconnect:e("Disconnect",t),connected:e("Your account is connected!",t),activate:e("Activate",t),licenseKeyPlaceholder:e("Enter your license key",t)},this.licenseUpgradeComposable.strings,this.setupWizardComposable.strings)}},computed:{showDevActivate(){return window.location.search.includes("aioseo-dev")},link(){return h('<strong><a href="%1$s" target="_blank">%2$s</a></strong>',this.links.utmUrl("general-settings","license-box"),this.strings.linkText)},tooltipText(){return h(e("To unlock a higher quota, consider %1$s.",t),this.link)},licenseInfo(){const i=y.fromMillis(this.optionsStore.internalOptions.internal.license.expires*1e3);if(3e3<=i.year)return h(e("You have a total quota of %1$s links (%2$s remaining). Your free subscription resets each month.",t),`<strong>${this.optionsStore.internalOptions.internal.license.quota.toLocaleString()}</strong>`,`${this.optionsStore.internalOptions.internal.license.quotaRemaining.toLocaleString()}`,`<strong>${e("Free Forever",t)}</strong>`);const v=i.toFormat("MM/dd/yyyy");return h(e("You have a total quota of %1$s links (%2$s remaining), which renews on %3$s.",t),`<strong>${this.optionsStore.internalOptions.internal.license.quota.toLocaleString()}</strong>`,`${this.optionsStore.internalOptions.internal.license.quotaRemaining.toLocaleString()}`,`<strong>${v}</strong>`)}},methods:{devActivate(){this.licenseKey=this.devLicenseKey,this.activate()},createNewAccountPopup(){this.creatingNewAccount=!0;const i=this.rootStore.aioseoBrokenLinkChecker.urls.marketingSite+"blc-trial-checkout?url="+btoa(this.rootStore.aioseoBrokenLinkChecker.urls.connect);this.openPopup(i)},connectWithExistingAccountPopup(){this.connectingWithExistingAccount=!0;const i=this.rootStore.aioseoBrokenLinkChecker.urls.marketingSite+"account/?blc-connect=1&url="+btoa(this.rootStore.aioseoBrokenLinkChecker.urls.connect);this.openPopup(i)},openPopup(i){W(i,e("Connect Your Site with Broken Link Checker",t),650,800,!0,["token"],this.completedCallback,this.closedCallback)},completedCallback(i){if(!i.token){this.creatingNewAccount=!1,this.connectingWithExistingAccount=!1,this.error=e("Could not connect site to Broken Link Checker. Please try again later.",t);return}return this.licenseKey=i.token,this.activate(),Promise.resolve()},closedCallback(){this.activating||(this.creatingNewAccount=!1,this.connectingWithExistingAccount=!1)},activate(){return this.error=null,this.activating=!0,this.licenseStore.activate(this.licenseKey).then(()=>{this.isSetupWizard&&this.$router.push(this.setupWizardStore.getNextLink)}).catch(i=>{if(this.licenseKey="",!i?.response?.body?.error||!i.response.body.licenseData){this.error=e("An unknown error occurred, please try again later.",t);return}const o=i.response.body.licenseData;o.invalid?this.error=e("The license key provided is invalid. Please use a different key.",t):o.disabled?this.error=e("The license key provided is disabled. Please use a different key.",t):o.expired?this.error=e("The license key provided is expired. Please renew your license or use a different key.",t):o.activationsError?this.error=e("This license has reached the maximum number of activations. Please deactivate it from another site or purchase a new license.",t):o.connectionError||o.requestError?this.error=e("There was an error connecting to the licensing API. Please try again later.",t):this.error=e("An unknown error occurred, please try again later.",t)}).finally(()=>{this.activating=!1,this.creatingNewAccount=!1,this.connectingWithExistingAccount=!1})},disconnect(){this.deactivating=!0,this.licenseStore.deactivate().catch(()=>{this.error=e("An unknown error occurred, please try again later.",t)}).finally(()=>{this.deactivating=!1})}}},H={key:0,class:"connect-buttons"},I={class:"button-divider description"},Z={key:1,class:"dev-activate"},j={key:2},G={class:"license"},J={class:"license-buttons"},Q={class:"account-connected"},X={class:"license-info"},$=["innerHTML"],ee={key:0};function te(i,o,v,c,n,l){const m=k("base-button"),b=k("core-alert"),S=k("base-input"),A=k("svg-circle-check-solid");return a(),p("div",{class:U(["license-container",[{"setup-wizard":v.isSetupWizard}]])},[c.optionsStore.internalOptions.internal.license.licenseKey?g("",!0):(a(),p("div",H,[u(m,{type:"green",size:"medium",inline:"",tag:"button",loading:n.creatingNewAccount,disabled:n.connectingWithExistingAccount,onClick:l.createNewAccountPopup},{default:f(()=>[d(r(n.strings.createAccount),1)]),_:1},8,["loading","disabled","onClick"]),s("div",I,r(n.strings.or),1),u(m,{type:"gray",size:"medium",inline:"",tag:"button",loading:n.connectingWithExistingAccount,disabled:n.creatingNewAccount,onClick:l.connectWithExistingAccountPopup},{default:f(()=>[d(r(n.strings.connectExistingAccount),1)]),_:1},8,["loading","disabled","onClick"]),n.error?(a(),O(b,{key:0,class:"license-key-error",type:"red",innerHTML:n.error},null,8,["innerHTML"])):g("",!0)])),l.showDevActivate&&!c.optionsStore.internalOptions.internal.license.licenseKey?(a(),p("div",Z,[u(S,{modelValue:n.devLicenseKey,"onUpdate:modelValue":o[0]||(o[0]=_=>n.devLicenseKey=_),size:"medium",placeholder:n.strings.licenseKeyPlaceholder},null,8,["modelValue","placeholder"]),u(m,{type:"blue",size:"medium",inline:"",tag:"button",loading:n.activating,onClick:l.devActivate},{default:f(()=>[d(r(n.strings.activate),1)]),_:1},8,["loading","onClick"])])):g("",!0),c.optionsStore.internalOptions.internal.license.licenseKey?(a(),p("div",j,[s("div",G,[s("div",J,[s("div",Q,[u(A),d(" "+r(n.strings.connected),1)]),u(m,{type:"gray",size:"medium",inline:"",tag:"button",loading:n.deactivating,onClick:l.disconnect},{default:f(()=>[d(r(n.strings.disconnect),1)]),_:1},8,["loading","onClick"])]),s("div",X,[s("p",{innerHTML:l.licenseInfo},null,8,$),c.optionsStore.internalOptions.internal.license.level&&c.optionsStore.internalOptions.internal.license.level.toLowerCase()!=="elite"?(a(),p("p",ee,[s("span",null,r(n.strings.toUnlock)+" ",1),s("strong",null,[s("a",{href:"#",onClick:o[1]||(o[1]=M(_=>c.licenseUpgradeComposable.openLicenseUpgradePopup("settings","license-key"),["prevent","stop"]))},r(c.licenseUpgradeComposable.upgradeAnchor.value),1)]),o[2]||(o[2]=d(". ",-1))])):g("",!0)])])])):g("",!0)],2)}const de=C(Y,[["render",te]]);export{de as C};