@kirby-tools/licensing 0.3.2 → 0.4.0

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.
@@ -0,0 +1,83 @@
1
+ <script setup lang="ts">
2
+ import type { ComponentPublicInstance, PropType } from 'vue'
3
+ import type { LicenseStatus } from '../types'
4
+ import { onMounted, 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, assertActivationIntegrity } = useLicense({
28
+ label: props.label,
29
+ apiNamespace: props.apiNamespace,
30
+ })
31
+
32
+ const currentLicenseStatus = ref(props.licenseStatus)
33
+ const licenseButtonGroup = ref<ComponentPublicInstance | undefined>()
34
+
35
+ onMounted(() => {
36
+ assertActivationIntegrity({
37
+ component: licenseButtonGroup,
38
+ licenseStatus: props.licenseStatus,
39
+ })
40
+ })
41
+
42
+ async function handleRegistration() {
43
+ const { isRegistered } = await openLicenseModal()
44
+ if (isRegistered) {
45
+ currentLicenseStatus.value = 'active'
46
+ }
47
+ }
48
+ </script>
49
+
50
+ <template>
51
+ <k-button-group
52
+ v-if="currentLicenseStatus !== 'active'"
53
+ ref="licenseButtonGroup"
54
+ layout="collapsed"
55
+ >
56
+ <k-button
57
+ v-if="currentLicenseStatus === 'upgradeable'"
58
+ theme="notice"
59
+ variant="filled"
60
+ size="xs"
61
+ link="https://hub.kirby.tools"
62
+ target="_blank"
63
+ :text="t('upgrade')"
64
+ />
65
+ <k-button
66
+ v-else
67
+ theme="love"
68
+ variant="filled"
69
+ size="xs"
70
+ :link="pricingUrl"
71
+ target="_blank"
72
+ :text="t('buy')"
73
+ />
74
+ <k-button
75
+ theme="love"
76
+ variant="filled"
77
+ size="xs"
78
+ icon="key"
79
+ :text="t('activate')"
80
+ @click="handleRegistration()"
81
+ />
82
+ </k-button-group>
83
+ </template>
@@ -0,0 +1 @@
1
+ export { default as LicensingButtonGroup } from './LicensingButtonGroup.vue';
@@ -0,0 +1 @@
1
+ export { default as LicensingButtonGroup } from "./LicensingButtonGroup.vue";
@@ -0,0 +1,4 @@
1
+ export type Locale = string;
2
+ export type Message = string;
3
+ export type Messages = Record<string, Message>;
4
+ export declare const TRANSLATIONS: Record<Locale, Messages>;
@@ -0,0 +1,58 @@
1
+ export const TRANSLATIONS = {
2
+ en: {
3
+ "modal.info": "Thanks for purchasing {label}! Please enter your email address and order ID to activate your license.",
4
+ "modal.fields.orderId.help": '<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Find your order number</a> on Lemon Squeezy or <a href="mailto:hello@kirby.tools">contact us</a> if you cannot find it.',
5
+ "modal.error.required.fields": "Email address and order ID are required",
6
+ "modal.error.invalid.unauthorized": "Email address or order ID is incorrect",
7
+ "modal.error.invalid.licenseKey": "License key invalid for this plugin",
8
+ "modal.error.incompatible": "License key invalid for this plugin version",
9
+ "modal.error.upgradeable": "License key invalid for this plugin version. Upgrade now on https://hub.kirby.tools.",
10
+ "modal.error.registered": "License key already registered",
11
+ "activate": "Activate",
12
+ "activated": "Plugin activated",
13
+ "buy": "Buy a license",
14
+ "upgrade": "Upgrade"
15
+ },
16
+ de: {
17
+ "modal.info": "Dankesch\xF6n f\xFCr den Kauf von {label}! Bitte gib deine E-Mail-Adresse und Bestellnummer ein, um deine Lizenz zu aktivieren.",
18
+ "modal.fields.orderId.help": '<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Finde deine Bestellnummer</a> bei Lemon Squeezy oder <a href="mailto:hello@kirby.tools">kontaktiere uns</a>, wenn du sie nicht finden kannst.',
19
+ "modal.error.required.fields": "E-Mail-Adresse und Bestellnummer sind notwendig",
20
+ "modal.error.invalid.unauthorized": "E-Mail-Adresse oder Bestellnummer ist falsch",
21
+ "modal.error.invalid.licenseKey": "Lizenzschl\xFCssel ung\xFCltig f\xFCr dieses Plugin",
22
+ "modal.error.incompatible": "Lizenzschl\xFCssel ung\xFCltig f\xFCr diese Plugin-Version",
23
+ "modal.error.upgradeable": "Lizenzschl\xFCssel ung\xFCltig f\xFCr diese Plugin-Version. Aktualisiere jetzt auf https://hub.kirby.tools.",
24
+ "modal.error.registered": "Lizenzschl\xFCssel bereits registriert",
25
+ "activate": "Aktivieren",
26
+ "activated": "Plugin aktiviert",
27
+ "buy": "Lizenz kaufen",
28
+ "upgrade": "Upgrade"
29
+ },
30
+ fr: {
31
+ "modal.info": "Merci d'avoir achet\xE9 {label} ! Veuillez saisir votre adresse e-mail et votre num\xE9ro de commande pour activer votre licence.",
32
+ "modal.fields.orderId.help": '<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Trouvez votre num\xE9ro de commande</a> sur Lemon Squeezy ou <a href="mailto:hello@kirby.tools">contactez-nous</a> si vous ne le trouvez pas.',
33
+ "modal.error.required.fields": "Adresse e-mail et num\xE9ro de commande requis",
34
+ "modal.error.invalid.unauthorized": "Adresse e-mail ou num\xE9ro de commande incorrect",
35
+ "modal.error.invalid.licenseKey": "Cl\xE9 de licence invalide pour ce plugin",
36
+ "modal.error.incompatible": "Cl\xE9 de licence invalide pour cette version du plugin",
37
+ "modal.error.upgradeable": "Cl\xE9 de licence invalide pour cette version du plugin. Mettez \xE0 niveau maintenant sur https://hub.kirby.tools.",
38
+ "modal.error.registered": "Cl\xE9 de licence d\xE9j\xE0 enregistr\xE9e",
39
+ "activate": "Activer",
40
+ "activated": "Plugin activ\xE9",
41
+ "buy": "Acheter une licence",
42
+ "upgrade": "Upgrade"
43
+ },
44
+ nl: {
45
+ "modal.info": "Bedankt voor het kopen van {label}! Voer je e-mailadres en bestelnummer in om je licentie te activeren.",
46
+ "modal.fields.orderId.help": '<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Vind je bestelnummer</a> op Lemon Squeezy of <a href="mailto:hello@kirby.tools">neem contact met ons op</a> als je het niet kunt vinden.',
47
+ "modal.error.required.fields": "E-mailadres en bestelnummer zijn verplicht",
48
+ "modal.error.invalid.unauthorized": "E-mailadres of bestelnummer is onjuist",
49
+ "modal.error.invalid.licenseKey": "Licentiesleutel ongeldig voor dit plug-in",
50
+ "modal.error.incompatible": "Licentiesleutel ongeldig voor deze plug-inversie",
51
+ "modal.error.upgradeable": "Licentiesleutel ongeldig voor deze plug-inversie. Upgrade nu op https://hub.kirby.tools.",
52
+ "modal.error.registered": "Licentiesleutel al geregistreerd",
53
+ "activate": "Activeren",
54
+ "activated": "Plugin geactiveerd",
55
+ "buy": "Koop een licentie",
56
+ "upgrade": "Upgrade"
57
+ }
58
+ };
package/dist/index.d.ts CHANGED
@@ -1,28 +1,2 @@
1
- import { Ref, ComponentPublicInstance } from 'vue';
2
-
3
- type MaybeRef<T = any> = T | Ref<T>;
4
- type LicenseKey = string;
5
- type LicenseStatus = 'active' | 'inactive' | 'invalid' | 'incompatible';
6
- interface License {
7
- key: LicenseKey;
8
- version: number;
9
- compatibility: string;
10
- }
11
-
12
- interface LicenseOptions {
13
- label: string;
14
- apiNamespace: string;
15
- }
16
- interface LicenseModalResult {
17
- isRegistered: boolean;
18
- }
19
- declare function useLicense({ label, apiNamespace, }: LicenseOptions): {
20
- isLocalhost: boolean;
21
- assertActivationIntegrity: ({ component, licenseStatus }: {
22
- component: MaybeRef<ComponentPublicInstance | null | undefined>;
23
- licenseStatus: MaybeRef<LicenseStatus>;
24
- }) => Promise<void>;
25
- openLicenseModal: () => Promise<LicenseModalResult>;
26
- };
27
-
28
- export { type License, type LicenseKey, useLicense };
1
+ export * from './license';
2
+ export type { License, LicenseKey, LicenseStatus } from './types';
package/dist/index.mjs CHANGED
@@ -1,158 +1 @@
1
- import { usePanel, useApi, unref, nextTick } from 'kirbyuse';
2
-
3
- const TRANSLATIONS = {
4
- en: {
5
- "modal.info": "Thanks for purchasing {label}! Please enter your email address and order ID to activate your license.",
6
- "modal.fields.orderId.help": '<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Find your order number</a> on Lemon Squeezy or <a href="mailto:hello@kirby.tools">contact us</a> if you cannot find it.',
7
- "modal.error.required.fields": "Email address and order ID are required",
8
- "modal.error.invalid.unauthorized": "Email address or order ID is incorrect",
9
- "modal.error.invalid.licenseKey": "License key invalid for this plugin",
10
- "modal.error.incompatible.licenseKey": "License key invalid for this plugin version",
11
- "modal.error.registered": "License key already registered",
12
- "activate": "Activate",
13
- "activated": "Plugin activated"
14
- },
15
- de: {
16
- "modal.info": "Dankesch\xF6n f\xFCr den Kauf von {label}! Bitte gib deine E-Mail-Adresse und Bestellnummer ein, um deine Lizenz zu aktivieren.",
17
- "modal.fields.orderId.help": '<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Finde deine Bestellnummer</a> bei Lemon Squeezy oder <a href="mailto:hello@kirby.tools">kontaktiere uns</a>, wenn du sie nicht finden kannst.',
18
- "modal.error.required.fields": "E-Mail-Adresse und Bestellnummer sind notwendig",
19
- "modal.error.invalid.unauthorized": "E-Mail-Adresse oder Bestellnummer ist falsch",
20
- "modal.error.invalid.licenseKey": "Lizenzschl\xFCssel ung\xFCltig f\xFCr dieses Plugin",
21
- "modal.error.incompatible.licenseKey": "Lizenzschl\xFCssel ung\xFCltig f\xFCr diese Plugin-Version",
22
- "modal.error.registered": "Lizenzschl\xFCssel bereits registriert",
23
- "activate": "Aktivieren",
24
- "activated": "Plugin aktiviert"
25
- },
26
- fr: {
27
- "modal.info": "Merci d'avoir achet\xE9 {label} ! Veuillez saisir votre adresse e-mail et votre num\xE9ro de commande pour activer votre licence.",
28
- "modal.fields.orderId.help": '<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Trouvez votre num\xE9ro de commande</a> sur Lemon Squeezy ou <a href="mailto:hello@kirby.tools">contactez-nous</a> si vous ne le trouvez pas.',
29
- "modal.error.required.fields": "Adresse e-mail et num\xE9ro de commande requis",
30
- "modal.error.invalid.unauthorized": "Adresse e-mail ou num\xE9ro de commande incorrect",
31
- "modal.error.invalid.licenseKey": "Cl\xE9 de licence invalide pour ce plugin",
32
- "modal.error.incompatible.licenseKey": "Cl\xE9 de licence invalide pour cette version du plugin",
33
- "modal.error.registered": "Cl\xE9 de licence d\xE9j\xE0 enregistr\xE9e",
34
- "activate": "Activer",
35
- "activated": "Plugin activ\xE9"
36
- }
37
- };
38
-
39
- function t(key, data, fallback) {
40
- const panel = usePanel();
41
- const languageCode = panel.translation.code;
42
- const translation = TRANSLATIONS?.[languageCode]?.[key] ?? fallback;
43
- if (!translation)
44
- return;
45
- return data ? template(translation, data) : translation;
46
- }
47
- function template(input, values, fallback) {
48
- return input.replace(
49
- /\{(\w+)\}/g,
50
- (_, key) => values[key] || (key)
51
- );
52
- }
53
-
54
- const LOCALHOST_HOSTNAMES = ["localhost", "127.0.0.1", "[::1]"];
55
- const LOCAL_DOMAINS = ["local", "test", "ddev.site"];
56
- function useLicense({
57
- label,
58
- apiNamespace
59
- }) {
60
- const panel = usePanel();
61
- const api = useApi();
62
- const isLocalhost = isLocal();
63
- const register = async (email, orderId) => {
64
- if (!email || !orderId) {
65
- throw new Error("Email and order ID are required");
66
- }
67
- const response = await api.post(`${apiNamespace}/register`, { email, orderId });
68
- if (response?.status !== "ok") {
69
- throw new Error("Registration failed");
70
- }
71
- return true;
72
- };
73
- const openLicenseModal = () => {
74
- let isRegistered = false;
75
- return new Promise((resolve) => {
76
- panel.dialog.open({
77
- component: "k-form-dialog",
78
- props: {
79
- submitButton: {
80
- icon: "check",
81
- theme: "love",
82
- text: t("activate", { label })
83
- },
84
- fields: {
85
- info: {
86
- type: "info",
87
- text: t("modal.info", { label })
88
- },
89
- email: {
90
- label: panel.t("email"),
91
- type: "email"
92
- },
93
- orderId: {
94
- label: "Order ID",
95
- type: "text",
96
- help: t("modal.fields.orderId.help", { label })
97
- }
98
- }
99
- },
100
- on: {
101
- // Close event will always be triggered, even on submit
102
- close: () => {
103
- resolve({ isRegistered });
104
- },
105
- submit: async (event) => {
106
- const { email, orderId } = event;
107
- if (!email || !orderId) {
108
- panel.notification.error(t("modal.error.required.fields"));
109
- return;
110
- }
111
- try {
112
- await register(email, Number(orderId));
113
- } catch (error) {
114
- let message = error.message;
115
- if (message === "Unauthorized") {
116
- message = t("modal.error.invalid.unauthorized");
117
- } else if (message === "License key not valid for this plugin") {
118
- message = t("modal.error.invalid.licenseKey");
119
- } else if (message === "License key not valid for this plugin version") {
120
- message = t("modal.error.incompatible.licenseKey");
121
- } else if (message === "License key already registered") {
122
- message = t("modal.error.registered");
123
- }
124
- panel.notification.error(message);
125
- return;
126
- }
127
- isRegistered = true;
128
- panel.dialog.close();
129
- panel.notification.success(t("activated"));
130
- }
131
- }
132
- });
133
- });
134
- };
135
- const assertActivationIntegrity = async ({ component, licenseStatus }) => {
136
- if (unref(licenseStatus) === "active") {
137
- return;
138
- }
139
- await nextTick();
140
- const _component = unref(component);
141
- if (!_component?.$el || window.getComputedStyle(_component.$el).display === "none" || window.getComputedStyle(_component.$el).visibility === "hidden" || window.getComputedStyle(_component.$el).opacity === "0") {
142
- throw new Error("Are you trying to hide the activation buttons? Please buy a license.");
143
- }
144
- };
145
- return {
146
- isLocalhost,
147
- assertActivationIntegrity,
148
- openLicenseModal
149
- };
150
- }
151
- function isLocal() {
152
- const { hostname } = window.location;
153
- const isLocalhost = LOCALHOST_HOSTNAMES.includes(hostname);
154
- const isLocalDomain = LOCAL_DOMAINS.some((domain) => hostname.endsWith(`.${domain}`));
155
- return isLocalhost || isLocalDomain;
156
- }
157
-
158
- export { useLicense };
1
+ export * from "./license.mjs";
@@ -0,0 +1,17 @@
1
+ import type { ComponentPublicInstance } from 'vue';
2
+ import type { LicenseStatus, MaybeRef } from './types';
3
+ export interface LicenseOptions {
4
+ label: string;
5
+ apiNamespace: string;
6
+ }
7
+ export interface LicenseModalResult {
8
+ isRegistered: boolean;
9
+ }
10
+ export declare function useLicense(licenseOptions: LicenseOptions): {
11
+ isLocalhost: any;
12
+ assertActivationIntegrity: ({ component, licenseStatus }: {
13
+ component: MaybeRef<ComponentPublicInstance | null | undefined>;
14
+ licenseStatus: MaybeRef<LicenseStatus>;
15
+ }) => Promise<void>;
16
+ openLicenseModal: () => any;
17
+ };
@@ -0,0 +1,102 @@
1
+ import { unref, usePanel } from "kirbyuse";
2
+ import { t } from "./utils.mjs";
3
+ const LOCALHOST_HOSTNAMES = ["localhost", "127.0.0.1", "[::1]"];
4
+ const LOCAL_DOMAINS = ["local", "test", "ddev.site"];
5
+ const ERROR_MESSAGE_TRANSLATIONS = {
6
+ "Unauthorized": "modal.error.invalid.unauthorized",
7
+ "License key not valid for this plugin": "modal.error.invalid.licenseKey",
8
+ "License key not valid for this plugin version": "modal.error.incompatible",
9
+ "License key not valid for this plugin version, please upgrade your license": "modal.error.upgradeable",
10
+ "License key already registered": "modal.error.registered"
11
+ };
12
+ export function useLicense(licenseOptions) {
13
+ const panel = usePanel();
14
+ const isLocalhost = isLocal();
15
+ const openLicenseModal = () => {
16
+ let isRegistered = false;
17
+ const { label } = licenseOptions;
18
+ const fields = {
19
+ info: {
20
+ type: "info",
21
+ text: t("modal.info", { label })
22
+ },
23
+ email: {
24
+ label: panel.t("email"),
25
+ type: "email"
26
+ },
27
+ orderId: {
28
+ label: "Order ID",
29
+ type: "text",
30
+ help: t("modal.fields.orderId.help", { label })
31
+ }
32
+ };
33
+ return new Promise((resolve) => {
34
+ panel.dialog.open({
35
+ component: "k-form-dialog",
36
+ props: {
37
+ submitButton: {
38
+ icon: "check",
39
+ theme: "love",
40
+ text: t("activate", { label })
41
+ },
42
+ fields
43
+ },
44
+ on: {
45
+ // Close event will always be triggered, even on submit
46
+ close: () => {
47
+ resolve({ isRegistered });
48
+ },
49
+ submit: async (event) => {
50
+ isRegistered = await registerLicense(event, licenseOptions);
51
+ if (isRegistered) {
52
+ panel.dialog.close();
53
+ panel.notification.success(t("activated"));
54
+ }
55
+ }
56
+ }
57
+ });
58
+ });
59
+ };
60
+ const assertActivationIntegrity = async ({ component, licenseStatus }) => {
61
+ if (unref(licenseStatus) === "active") {
62
+ return;
63
+ }
64
+ const _component = unref(component);
65
+ if (!_component?.$el || window.getComputedStyle(_component.$el).display === "none" || window.getComputedStyle(_component.$el).visibility === "hidden" || window.getComputedStyle(_component.$el).opacity === "0") {
66
+ throw new Error("Are you trying to hide the activation buttons? Please buy a license.");
67
+ }
68
+ };
69
+ return {
70
+ isLocalhost,
71
+ assertActivationIntegrity,
72
+ openLicenseModal
73
+ };
74
+ }
75
+ async function registerLicense(event, licenseOptions) {
76
+ const panel = usePanel();
77
+ const { email, orderId } = event;
78
+ if (!email || !orderId) {
79
+ panel.notification.error(t("modal.error.required.fields"));
80
+ return false;
81
+ }
82
+ try {
83
+ const response = await panel.api.post(`${licenseOptions.apiNamespace}/register`, {
84
+ email,
85
+ orderId: Number(orderId)
86
+ });
87
+ if (response?.status !== "ok") {
88
+ throw new Error("Failed to register license");
89
+ }
90
+ return true;
91
+ } catch (error) {
92
+ const message = error.message;
93
+ panel.notification.error(ERROR_MESSAGE_TRANSLATIONS[message] ? t(ERROR_MESSAGE_TRANSLATIONS[message]) : message);
94
+ return false;
95
+ }
96
+ }
97
+ function isLocal() {
98
+ const { hostname } = window.location;
99
+ const isLocalhost = LOCALHOST_HOSTNAMES.includes(hostname);
100
+ const isLocalDomain = LOCAL_DOMAINS.some((domain) => hostname.endsWith(`.${domain}`));
101
+ return isLocalhost || isLocalDomain;
102
+ }
@@ -0,0 +1,9 @@
1
+ import type { Ref } from 'vue';
2
+ export type MaybeRef<T = any> = T | Ref<T>;
3
+ export type LicenseKey = string;
4
+ export type LicenseStatus = 'active' | 'inactive' | 'invalid' | 'incompatible' | 'upgradeable';
5
+ export interface License {
6
+ key: LicenseKey;
7
+ version: number;
8
+ compatibility: string;
9
+ }
package/dist/types.mjs ADDED
File without changes
@@ -0,0 +1,2 @@
1
+ export declare function t(key?: string, data?: Record<string, string>): string;
2
+ export declare function template(input: string, values: Record<string, string>, fallback?: string | ((key: string) => string)): string;
package/dist/utils.mjs ADDED
@@ -0,0 +1,12 @@
1
+ import { TRANSLATIONS } from "./constants.mjs";
2
+ export function t(key = "", data) {
3
+ const languageCode = window.panel.translation.code;
4
+ const translation = TRANSLATIONS?.[languageCode]?.[key] ?? key;
5
+ return data ? template(translation, data) : translation;
6
+ }
7
+ export function template(input, values, fallback) {
8
+ return input.replace(
9
+ /\{(\w+)\}/g,
10
+ (_, key) => values[key] || ((typeof fallback === "function" ? fallback(key) : fallback) ?? key)
11
+ );
12
+ }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@kirby-tools/licensing",
3
3
  "type": "module",
4
- "version": "0.3.2",
5
- "packageManager": "pnpm@9.10.0",
6
- "description": "Shared tooling for licensing in the Panel",
4
+ "version": "0.4.0",
5
+ "packageManager": "pnpm@9.15.0",
6
+ "description": "Shared tooling for Kirby Tools licensing in the Kirby Panel",
7
7
  "author": "Johann Schopplich <hello@johannschopplich.com>",
8
8
  "license": "AGPL-3.0-or-later",
9
9
  "homepage": "https://github.com/kirby-tools/licensing-panel#readme",
@@ -17,8 +17,12 @@
17
17
  "sideEffects": false,
18
18
  "exports": {
19
19
  ".": {
20
- "types": "./dist/index.d.mts",
20
+ "types": "./dist/index.d.ts",
21
21
  "default": "./dist/index.mjs"
22
+ },
23
+ "./components": {
24
+ "types": "./dist/components/index.d.ts",
25
+ "import": "./dist/components/index.mjs"
22
26
  }
23
27
  },
24
28
  "types": "./dist/index.d.ts",
@@ -31,15 +35,18 @@
31
35
  "lint:fix": "eslint . --fix",
32
36
  "release": "bumpp"
33
37
  },
38
+ "peerDependencies": {
39
+ "kirbyuse": "*"
40
+ },
34
41
  "dependencies": {
35
- "kirbyuse": "^0.7.1",
36
42
  "vue": "^2.7.16"
37
43
  },
38
44
  "devDependencies": {
39
- "@antfu/eslint-config": "^3.5.1",
40
- "bumpp": "^9.5.2",
41
- "eslint": "^9.10.0",
42
- "typescript": "^5.5.4",
43
- "unbuild": "^3.0.0-rc.7"
45
+ "@antfu/eslint-config": "^3.11.2",
46
+ "bumpp": "^9.9.0",
47
+ "eslint": "^9.16.0",
48
+ "kirbyuse": "^0.9.1",
49
+ "typescript": "^5.7.2",
50
+ "unbuild": "^3.0.0-rc.11"
44
51
  }
45
52
  }
package/dist/index.d.mts DELETED
@@ -1,28 +0,0 @@
1
- import { Ref, ComponentPublicInstance } from 'vue';
2
-
3
- type MaybeRef<T = any> = T | Ref<T>;
4
- type LicenseKey = string;
5
- type LicenseStatus = 'active' | 'inactive' | 'invalid' | 'incompatible';
6
- interface License {
7
- key: LicenseKey;
8
- version: number;
9
- compatibility: string;
10
- }
11
-
12
- interface LicenseOptions {
13
- label: string;
14
- apiNamespace: string;
15
- }
16
- interface LicenseModalResult {
17
- isRegistered: boolean;
18
- }
19
- declare function useLicense({ label, apiNamespace, }: LicenseOptions): {
20
- isLocalhost: boolean;
21
- assertActivationIntegrity: ({ component, licenseStatus }: {
22
- component: MaybeRef<ComponentPublicInstance | null | undefined>;
23
- licenseStatus: MaybeRef<LicenseStatus>;
24
- }) => Promise<void>;
25
- openLicenseModal: () => Promise<LicenseModalResult>;
26
- };
27
-
28
- export { type License, type LicenseKey, useLicense };