@kirby-tools/licensing 0.1.4 → 0.1.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/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +43 -38
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,9 +2,12 @@ interface LicenseOptions {
|
|
|
2
2
|
label: string;
|
|
3
3
|
apiNamespace: string;
|
|
4
4
|
}
|
|
5
|
+
interface LicenseModalResult {
|
|
6
|
+
isRegistered?: boolean;
|
|
7
|
+
}
|
|
5
8
|
declare function useLicense({ label, apiNamespace, }: LicenseOptions): {
|
|
6
9
|
isLocalhost: boolean;
|
|
7
|
-
openLicenseModal: () =>
|
|
10
|
+
openLicenseModal: () => Promise<LicenseModalResult>;
|
|
8
11
|
};
|
|
9
12
|
|
|
10
13
|
export { useLicense };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,12 @@ interface LicenseOptions {
|
|
|
2
2
|
label: string;
|
|
3
3
|
apiNamespace: string;
|
|
4
4
|
}
|
|
5
|
+
interface LicenseModalResult {
|
|
6
|
+
isRegistered?: boolean;
|
|
7
|
+
}
|
|
5
8
|
declare function useLicense({ label, apiNamespace, }: LicenseOptions): {
|
|
6
9
|
isLocalhost: boolean;
|
|
7
|
-
openLicenseModal: () =>
|
|
10
|
+
openLicenseModal: () => Promise<LicenseModalResult>;
|
|
8
11
|
};
|
|
9
12
|
|
|
10
13
|
export { useLicense };
|
package/dist/index.mjs
CHANGED
|
@@ -56,48 +56,53 @@ function useLicense({
|
|
|
56
56
|
return true;
|
|
57
57
|
};
|
|
58
58
|
const openLicenseModal = () => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
fields: {
|
|
68
|
-
info: {
|
|
69
|
-
type: "info",
|
|
70
|
-
text: t("modal.info", { label })
|
|
71
|
-
},
|
|
72
|
-
email: {
|
|
73
|
-
label: panel.t("email"),
|
|
74
|
-
type: "email"
|
|
59
|
+
return new Promise((resolve) => {
|
|
60
|
+
panel.dialog.open({
|
|
61
|
+
component: "k-form-dialog",
|
|
62
|
+
props: {
|
|
63
|
+
submitButton: {
|
|
64
|
+
icon: "check",
|
|
65
|
+
theme: "love",
|
|
66
|
+
text: t("activate", { label })
|
|
75
67
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
68
|
+
fields: {
|
|
69
|
+
info: {
|
|
70
|
+
type: "info",
|
|
71
|
+
text: t("modal.info", { label })
|
|
72
|
+
},
|
|
73
|
+
email: {
|
|
74
|
+
label: panel.t("email"),
|
|
75
|
+
type: "email"
|
|
76
|
+
},
|
|
77
|
+
orderId: {
|
|
78
|
+
label: "Order ID",
|
|
79
|
+
type: "text",
|
|
80
|
+
help: t("modal.help.orderId", { label })
|
|
81
|
+
}
|
|
89
82
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
},
|
|
84
|
+
on: {
|
|
85
|
+
close: () => {
|
|
86
|
+
resolve({});
|
|
87
|
+
},
|
|
88
|
+
submit: async (event) => {
|
|
89
|
+
const { email, orderId } = event;
|
|
90
|
+
if (!email || !orderId) {
|
|
91
|
+
panel.notification.error("Email and order ID are required");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
await register(email, Number(orderId));
|
|
96
|
+
} catch (error) {
|
|
97
|
+
panel.notification.error(error.message);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
panel.dialog.close();
|
|
101
|
+
panel.notification.success(t("activated"), { label });
|
|
102
|
+
resolve({ isRegistered: true });
|
|
95
103
|
}
|
|
96
|
-
panel.dialog.close();
|
|
97
|
-
await panel.view.reload();
|
|
98
|
-
panel.notification.success(t("activated"), { label });
|
|
99
104
|
}
|
|
100
|
-
}
|
|
105
|
+
});
|
|
101
106
|
});
|
|
102
107
|
};
|
|
103
108
|
return {
|
package/package.json
CHANGED