@kirby-tools/licensing 0.1.5 → 0.1.7

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
@@ -3,7 +3,7 @@ interface LicenseOptions {
3
3
  apiNamespace: string;
4
4
  }
5
5
  interface LicenseModalResult {
6
- isRegistered?: boolean;
6
+ isRegistered: boolean;
7
7
  }
8
8
  declare function useLicense({ label, apiNamespace, }: LicenseOptions): {
9
9
  isLocalhost: boolean;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ interface LicenseOptions {
3
3
  apiNamespace: string;
4
4
  }
5
5
  interface LicenseModalResult {
6
- isRegistered?: boolean;
6
+ isRegistered: boolean;
7
7
  }
8
8
  declare function useLicense({ label, apiNamespace, }: LicenseOptions): {
9
9
  isLocalhost: boolean;
package/dist/index.mjs CHANGED
@@ -56,6 +56,7 @@ function useLicense({
56
56
  return true;
57
57
  };
58
58
  const openLicenseModal = () => {
59
+ const isRegistered = false;
59
60
  return new Promise((resolve) => {
60
61
  panel.dialog.open({
61
62
  component: "k-form-dialog",
@@ -82,26 +83,24 @@ function useLicense({
82
83
  }
83
84
  },
84
85
  on: {
86
+ // Close event will always be triggered, even on submit
85
87
  close: () => {
86
- resolve({});
88
+ resolve({ isRegistered });
87
89
  },
88
90
  submit: async (event) => {
89
91
  const { email, orderId } = event;
90
92
  if (!email || !orderId) {
91
93
  panel.notification.error("Email and order ID are required");
92
- resolve({});
93
94
  return;
94
95
  }
95
96
  try {
96
97
  await register(email, Number(orderId));
97
98
  } catch (error) {
98
99
  panel.notification.error(error.message);
99
- resolve({});
100
100
  return;
101
101
  }
102
102
  panel.dialog.close();
103
103
  panel.notification.success(t("activated"), { label });
104
- resolve({ isRegistered: true });
105
104
  }
106
105
  }
107
106
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kirby-tools/licensing",
3
3
  "type": "module",
4
- "version": "0.1.5",
4
+ "version": "0.1.7",
5
5
  "packageManager": "pnpm@9.3.0",
6
6
  "description": "Shared tooling for licensing in the Panel",
7
7
  "author": "Johann Schopplich <hello@johannschopplich.com>",