@kirby-tools/licensing 0.6.4 → 0.6.6
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/license.d.ts +1 -3
- package/dist/license.js +19 -8
- package/package.json +1 -1
package/dist/license.d.ts
CHANGED
|
@@ -18,9 +18,7 @@ declare function useLicense(licenseOptions: LicenseOptions): {
|
|
|
18
18
|
component: MaybeRef<ComponentPublicInstance | null | undefined>;
|
|
19
19
|
licenseStatus: MaybeRef<LicenseStatus>;
|
|
20
20
|
}) => void;
|
|
21
|
-
openLicenseModal: () => Promise<
|
|
22
|
-
isLicenseActive: boolean;
|
|
23
|
-
}>;
|
|
21
|
+
openLicenseModal: () => Promise<void>;
|
|
24
22
|
};
|
|
25
23
|
//#endregion
|
|
26
24
|
export { LicenseModalResult, LicenseOptions, useLicense };
|
package/dist/license.js
CHANGED
|
@@ -9,7 +9,8 @@ function useLicense(licenseOptions) {
|
|
|
9
9
|
const isLocalhost = isLocalHost();
|
|
10
10
|
const openLicenseModal = async () => {
|
|
11
11
|
const { label } = licenseOptions;
|
|
12
|
-
|
|
12
|
+
let isSubmitting = false;
|
|
13
|
+
await openFieldsDialog({
|
|
13
14
|
submitButton: {
|
|
14
15
|
icon: "check",
|
|
15
16
|
theme: "love",
|
|
@@ -31,23 +32,33 @@ function useLicense(licenseOptions) {
|
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
34
|
onSubmit: async (value) => {
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
if (isSubmitting) return false;
|
|
36
|
+
isSubmitting = true;
|
|
37
|
+
if (!await activateLicense(value, licenseOptions)) {
|
|
38
|
+
isSubmitting = false;
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
36
41
|
panel.notification.success(t("notification.success"));
|
|
37
42
|
await new Promise((resolve) => setTimeout(resolve, 750));
|
|
38
43
|
window.location.reload();
|
|
39
|
-
return
|
|
44
|
+
return new Promise(() => {});
|
|
40
45
|
}
|
|
41
|
-
})
|
|
46
|
+
});
|
|
42
47
|
};
|
|
43
48
|
const assertActivationIntegrity = ({ component, licenseStatus }) => {
|
|
44
49
|
if (unref(licenseStatus) === "active") return;
|
|
45
50
|
const element = unref(component)?.$el;
|
|
46
|
-
if (!element)
|
|
51
|
+
if (!element) {
|
|
52
|
+
panel.notification.error(INTEGRITY_ERROR);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
47
55
|
const style = window.getComputedStyle(element);
|
|
48
|
-
if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0" || style.clipPath === "inset(100%)" || style.transform.includes("scale(0"))
|
|
56
|
+
if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0" || style.clipPath === "inset(100%)" || style.transform.includes("scale(0")) {
|
|
57
|
+
panel.notification.error(INTEGRITY_ERROR);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
49
60
|
const rect = element.getBoundingClientRect();
|
|
50
|
-
if (rect.width === 0 || rect.height === 0 || rect.right < 0 || rect.bottom < 0 || rect.left > window.innerWidth || rect.top > window.innerHeight)
|
|
61
|
+
if (rect.width === 0 || rect.height === 0 || rect.right < 0 || rect.bottom < 0 || rect.left > window.innerWidth || rect.top > window.innerHeight) panel.notification.error(INTEGRITY_ERROR);
|
|
51
62
|
};
|
|
52
63
|
return {
|
|
53
64
|
isLocalhost,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirby-tools/licensing",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.6",
|
|
5
5
|
"packageManager": "pnpm@10.28.0",
|
|
6
6
|
"description": "License system for Kirby Tools plugins within the Kirby Panel",
|
|
7
7
|
"author": "Johann Schopplich <hello@johannschopplich.com>",
|