@kirby-tools/licensing 0.1.13 → 0.2.1
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 +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Ref, ComponentPublicInstance } from 'vue';
|
|
2
2
|
|
|
3
|
+
type MaybeRef<T = any> = T | Ref<T>;
|
|
3
4
|
type LicenseKey = string;
|
|
4
5
|
interface License {
|
|
5
6
|
licenseKey: LicenseKey;
|
|
@@ -15,9 +16,9 @@ interface LicenseModalResult {
|
|
|
15
16
|
}
|
|
16
17
|
declare function useLicense({ label, apiNamespace, }: LicenseOptions): {
|
|
17
18
|
isLocalhost: boolean;
|
|
18
|
-
assertActivationIntegrity: ({
|
|
19
|
-
|
|
20
|
-
license: boolean | string | License
|
|
19
|
+
assertActivationIntegrity: ({ component, license }: {
|
|
20
|
+
component: MaybeRef<ComponentPublicInstance | null | undefined>;
|
|
21
|
+
license: MaybeRef<boolean | string | License>;
|
|
21
22
|
}) => Promise<void>;
|
|
22
23
|
openLicenseModal: () => Promise<LicenseModalResult>;
|
|
23
24
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Ref, ComponentPublicInstance } from 'vue';
|
|
2
2
|
|
|
3
|
+
type MaybeRef<T = any> = T | Ref<T>;
|
|
3
4
|
type LicenseKey = string;
|
|
4
5
|
interface License {
|
|
5
6
|
licenseKey: LicenseKey;
|
|
@@ -15,9 +16,9 @@ interface LicenseModalResult {
|
|
|
15
16
|
}
|
|
16
17
|
declare function useLicense({ label, apiNamespace, }: LicenseOptions): {
|
|
17
18
|
isLocalhost: boolean;
|
|
18
|
-
assertActivationIntegrity: ({
|
|
19
|
-
|
|
20
|
-
license: boolean | string | License
|
|
19
|
+
assertActivationIntegrity: ({ component, license }: {
|
|
20
|
+
component: MaybeRef<ComponentPublicInstance | null | undefined>;
|
|
21
|
+
license: MaybeRef<boolean | string | License>;
|
|
21
22
|
}) => Promise<void>;
|
|
22
23
|
openLicenseModal: () => Promise<LicenseModalResult>;
|
|
23
24
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { usePanel, useApi, nextTick } from 'kirbyuse';
|
|
1
|
+
import { usePanel, useApi, unref, nextTick } from 'kirbyuse';
|
|
2
2
|
|
|
3
3
|
const TRANSLATIONS = {
|
|
4
4
|
en: {
|
|
@@ -122,15 +122,15 @@ function useLicense({
|
|
|
122
122
|
});
|
|
123
123
|
});
|
|
124
124
|
};
|
|
125
|
-
const assertActivationIntegrity = async ({
|
|
126
|
-
|
|
125
|
+
const assertActivationIntegrity = async ({ component, license }) => {
|
|
126
|
+
const _component = unref(component);
|
|
127
|
+
const _license = unref(license);
|
|
128
|
+
if (_license !== false) {
|
|
127
129
|
return;
|
|
128
130
|
}
|
|
129
131
|
await nextTick();
|
|
130
|
-
if (!
|
|
131
|
-
|
|
132
|
-
panel.notification.error(message);
|
|
133
|
-
throw new Error(message);
|
|
132
|
+
if (!_component?.$el || window.getComputedStyle(_component.$el).display === "none" || window.getComputedStyle(_component.$el).visibility === "hidden") {
|
|
133
|
+
throw new Error("Are you trying to hide the activation buttons? Please buy a license.");
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
return {
|
package/package.json
CHANGED