@kirby-tools/licensing 0.1.10 → 0.1.12

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.
package/dist/index.d.mts CHANGED
@@ -1,3 +1,8 @@
1
+ import { Ref, ComponentPublicInstance } from 'vue';
2
+
3
+ interface License {
4
+ [key: string]: string;
5
+ }
1
6
  interface LicenseOptions {
2
7
  label: string;
3
8
  apiNamespace: string;
@@ -7,6 +12,10 @@ interface LicenseModalResult {
7
12
  }
8
13
  declare function useLicense({ label, apiNamespace, }: LicenseOptions): {
9
14
  isLocalhost: boolean;
15
+ assertActivationIntegrity: ({ templateRef, license }: {
16
+ templateRef: Ref<ComponentPublicInstance | null | undefined>;
17
+ license: boolean | string | License;
18
+ }) => Promise<boolean>;
10
19
  openLicenseModal: () => Promise<LicenseModalResult>;
11
20
  };
12
21
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ import { Ref, ComponentPublicInstance } from 'vue';
2
+
3
+ interface License {
4
+ [key: string]: string;
5
+ }
1
6
  interface LicenseOptions {
2
7
  label: string;
3
8
  apiNamespace: string;
@@ -7,6 +12,10 @@ interface LicenseModalResult {
7
12
  }
8
13
  declare function useLicense({ label, apiNamespace, }: LicenseOptions): {
9
14
  isLocalhost: boolean;
15
+ assertActivationIntegrity: ({ templateRef, license }: {
16
+ templateRef: Ref<ComponentPublicInstance | null | undefined>;
17
+ license: boolean | string | License;
18
+ }) => Promise<boolean>;
10
19
  openLicenseModal: () => Promise<LicenseModalResult>;
11
20
  };
12
21
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { usePanel, useApi } from 'kirbyuse';
1
+ import { usePanel, useApi, nextTick } from 'kirbyuse';
2
2
 
3
3
  const TRANSLATIONS = {
4
4
  en: {
@@ -122,8 +122,20 @@ function useLicense({
122
122
  });
123
123
  });
124
124
  };
125
+ const assertActivationIntegrity = async ({ templateRef, license }) => {
126
+ if (license !== false) {
127
+ return true;
128
+ }
129
+ await nextTick();
130
+ if (!templateRef.value) {
131
+ panel.notification.error("Are you trying to hide the activation buttons? Please buy a license.");
132
+ return false;
133
+ }
134
+ return true;
135
+ };
125
136
  return {
126
137
  isLocalhost,
138
+ assertActivationIntegrity,
127
139
  openLicenseModal
128
140
  };
129
141
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@kirby-tools/licensing",
3
3
  "type": "module",
4
- "version": "0.1.10",
5
- "packageManager": "pnpm@9.3.0",
4
+ "version": "0.1.12",
5
+ "packageManager": "pnpm@9.4.0",
6
6
  "description": "Shared tooling for licensing in the Panel",
7
7
  "author": "Johann Schopplich <hello@johannschopplich.com>",
8
- "license": "MIT",
8
+ "license": "AGPL-3.0-or-later",
9
9
  "homepage": "https://github.com/kirby-tools/licensing-panel#readme",
10
10
  "repository": {
11
11
  "type": "git",
@@ -32,7 +32,8 @@
32
32
  "release": "bumpp"
33
33
  },
34
34
  "dependencies": {
35
- "kirbyuse": "^0.4.1"
35
+ "kirbyuse": "^0.4.1",
36
+ "vue": "^2.7.16"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@antfu/eslint-config": "^2.21.1",