@kirby-tools/licensing 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -42,13 +42,10 @@ onMounted(() => {
|
|
|
42
42
|
async function handleRegistration() {
|
|
43
43
|
const { isLicenseActive } = await openLicenseModal()
|
|
44
44
|
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// Force a reload to refresh the plugin's cached context
|
|
51
|
-
window.location.reload()
|
|
45
|
+
if (isLicenseActive) {
|
|
46
|
+
// Force a reload to refresh the plugin's cached context
|
|
47
|
+
window.location.reload()
|
|
48
|
+
}
|
|
52
49
|
}
|
|
53
50
|
</script>
|
|
54
51
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PropType } from 'vue'
|
|
3
|
+
import type { LicenseStatus } from '../types'
|
|
4
|
+
import { ref } from 'kirbyuse'
|
|
5
|
+
import { useLicense } from '../license'
|
|
6
|
+
import { t } from '../utils'
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
label: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
apiNamespace: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
licenseStatus: {
|
|
18
|
+
type: String as PropType<LicenseStatus>,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
pricingUrl: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const { openLicenseModal } = useLicense({
|
|
28
|
+
label: props.label,
|
|
29
|
+
apiNamespace: props.apiNamespace,
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const currentLicenseStatus = ref(props.licenseStatus)
|
|
33
|
+
|
|
34
|
+
async function handleRegistration() {
|
|
35
|
+
const { isLicenseActive } = await openLicenseModal()
|
|
36
|
+
|
|
37
|
+
if (isLicenseActive) {
|
|
38
|
+
// Force a reload to refresh the plugin's cached context
|
|
39
|
+
window.location.reload()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<div v-if="currentLicenseStatus !== 'active'">
|
|
46
|
+
<k-dropdown-item
|
|
47
|
+
icon="cart"
|
|
48
|
+
:link="currentLicenseStatus === 'upgradeable' ? 'https://hub.kirby.tools' : pricingUrl"
|
|
49
|
+
target="_blank"
|
|
50
|
+
>
|
|
51
|
+
{{ currentLicenseStatus === 'upgradeable' ? t('upgrade') : t('buy') }}
|
|
52
|
+
</k-dropdown-item>
|
|
53
|
+
<k-dropdown-item
|
|
54
|
+
icon="key"
|
|
55
|
+
@click="handleRegistration()"
|
|
56
|
+
>
|
|
57
|
+
{{ t('activate') }}
|
|
58
|
+
</k-dropdown-item>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirby-tools/licensing",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"packageManager": "pnpm@9.15.1",
|
|
6
6
|
"description": "Shared tooling for Kirby Tools licensing in the Kirby Panel",
|
|
7
7
|
"author": "Johann Schopplich <hello@johannschopplich.com>",
|