@kirby-tools/licensing 0.6.8 → 0.6.10
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/constants.js +0 -6
- package/dist/index.d.ts +2 -2
- package/dist/license.d.ts +1 -4
- package/dist/license.js +10 -12
- package/package.json +1 -1
package/dist/constants.js
CHANGED
|
@@ -9,42 +9,36 @@ const ERROR_KEY_MAP = {
|
|
|
9
9
|
const INTEGRITY_ERROR = "The activation buttons appear to be hidden. Please purchase a license.";
|
|
10
10
|
const I18N_MESSAGES = {
|
|
11
11
|
en: {
|
|
12
|
-
"errors.validation.missingFields": "Email address and order ID are required",
|
|
13
12
|
"activate": "Activate",
|
|
14
13
|
"buy": "Buy a license",
|
|
15
14
|
"upgrade": "Upgrade",
|
|
16
15
|
"notification.success": "Plugin activated!"
|
|
17
16
|
},
|
|
18
17
|
de: {
|
|
19
|
-
"errors.validation.missingFields": "E-Mail-Adresse und Bestellnummer sind notwendig",
|
|
20
18
|
"activate": "Aktivieren",
|
|
21
19
|
"buy": "Lizenz kaufen",
|
|
22
20
|
"upgrade": "Upgrade",
|
|
23
21
|
"notification.success": "Plugin aktiviert!"
|
|
24
22
|
},
|
|
25
23
|
fr: {
|
|
26
|
-
"errors.validation.missingFields": "Adresse e-mail et numéro de commande requis",
|
|
27
24
|
"activate": "Activer",
|
|
28
25
|
"buy": "Acheter une licence",
|
|
29
26
|
"upgrade": "Upgrade",
|
|
30
27
|
"notification.success": "Plugin activé !"
|
|
31
28
|
},
|
|
32
29
|
nl: {
|
|
33
|
-
"errors.validation.missingFields": "E-mailadres en bestelnummer zijn verplicht",
|
|
34
30
|
"activate": "Activeren",
|
|
35
31
|
"buy": "Koop een licentie",
|
|
36
32
|
"upgrade": "Upgrade",
|
|
37
33
|
"notification.success": "Plugin geactiveerd!"
|
|
38
34
|
},
|
|
39
35
|
es: {
|
|
40
|
-
"errors.validation.missingFields": "La dirección de correo electrónico y el número de pedido son obligatorios",
|
|
41
36
|
"activate": "Activar",
|
|
42
37
|
"buy": "Comprar licencia",
|
|
43
38
|
"upgrade": "Actualizar",
|
|
44
39
|
"notification.success": "¡Plugin activado!"
|
|
45
40
|
},
|
|
46
41
|
it: {
|
|
47
|
-
"errors.validation.missingFields": "Indirizzo email e numero d'ordine sono obbligatori",
|
|
48
42
|
"activate": "Attiva",
|
|
49
43
|
"buy": "Acquista licenza",
|
|
50
44
|
"upgrade": "Aggiorna",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { License, LicenseKey, LicenseStatus } from "./types.js";
|
|
2
|
-
import {
|
|
2
|
+
import { LicenseOptions, useLicense } from "./license.js";
|
|
3
3
|
import { isLocalHost } from "./utils.js";
|
|
4
|
-
export { type License, type LicenseKey,
|
|
4
|
+
export { type License, type LicenseKey, LicenseOptions, type LicenseStatus, isLocalHost, useLicense };
|
package/dist/license.d.ts
CHANGED
|
@@ -6,9 +6,6 @@ interface LicenseOptions {
|
|
|
6
6
|
label: string;
|
|
7
7
|
apiNamespace: string;
|
|
8
8
|
}
|
|
9
|
-
interface LicenseModalResult {
|
|
10
|
-
isLicenseActive: boolean;
|
|
11
|
-
}
|
|
12
9
|
declare function useLicense(licenseOptions: LicenseOptions): {
|
|
13
10
|
isLocalhost: boolean;
|
|
14
11
|
assertActivationIntegrity: ({
|
|
@@ -21,4 +18,4 @@ declare function useLicense(licenseOptions: LicenseOptions): {
|
|
|
21
18
|
openLicenseModal: () => Promise<void>;
|
|
22
19
|
};
|
|
23
20
|
//#endregion
|
|
24
|
-
export {
|
|
21
|
+
export { LicenseOptions, useLicense };
|
package/dist/license.js
CHANGED
|
@@ -8,29 +8,30 @@ function useLicense(licenseOptions) {
|
|
|
8
8
|
const { openFieldsDialog } = useDialog();
|
|
9
9
|
const isLocalhost = isLocalHost();
|
|
10
10
|
const openLicenseModal = async () => {
|
|
11
|
-
const { label } = licenseOptions;
|
|
12
11
|
let isSubmitting = false;
|
|
13
12
|
await openFieldsDialog({
|
|
14
|
-
submitButton: {
|
|
15
|
-
icon: "check",
|
|
16
|
-
theme: "love",
|
|
17
|
-
text: t("activate", { label })
|
|
18
|
-
},
|
|
19
13
|
fields: {
|
|
20
14
|
info: {
|
|
21
15
|
type: "info",
|
|
22
16
|
text: panel.t("kirby-tools.license.activate.info")
|
|
23
17
|
},
|
|
24
18
|
email: {
|
|
25
|
-
label: panel.t("email"),
|
|
26
|
-
type: "email"
|
|
19
|
+
label: panel.t("kirby-tools.license.activate.email"),
|
|
20
|
+
type: "email",
|
|
21
|
+
required: true
|
|
27
22
|
},
|
|
28
23
|
orderId: {
|
|
29
24
|
label: panel.t("kirby-tools.license.activate.orderId"),
|
|
30
25
|
type: "text",
|
|
26
|
+
required: true,
|
|
31
27
|
help: panel.t("kirby-tools.license.activate.orderId.help")
|
|
32
28
|
}
|
|
33
29
|
},
|
|
30
|
+
submitButton: {
|
|
31
|
+
icon: "check",
|
|
32
|
+
theme: "love",
|
|
33
|
+
text: panel.t("kirby-tools.license.activate.submit")
|
|
34
|
+
},
|
|
34
35
|
onSubmit: async (value) => {
|
|
35
36
|
if (isSubmitting) return false;
|
|
36
37
|
isSubmitting = true;
|
|
@@ -69,10 +70,7 @@ function useLicense(licenseOptions) {
|
|
|
69
70
|
async function activateLicense(event, licenseOptions) {
|
|
70
71
|
const panel = usePanel();
|
|
71
72
|
const { email, orderId } = event;
|
|
72
|
-
if (!email || !orderId)
|
|
73
|
-
panel.notification.error(t("errors.validation.missingFields"));
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
73
|
+
if (!email || !orderId) return false;
|
|
76
74
|
try {
|
|
77
75
|
if ((await panel.api.post(`${licenseOptions.apiNamespace}/activate`, {
|
|
78
76
|
email,
|
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.10",
|
|
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>",
|