@haex-space/vault-sdk 3.2.8 → 3.3.0

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/node.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-D_HXjsEV.mjs';
2
- import { E as ExtensionManifest } from './types-Cji-mUN0.mjs';
2
+ import { E as ExtensionManifest } from './types-fHuxbqa4.mjs';
3
3
 
4
4
  interface ReadManifestOptions {
5
5
  /** Root directory of the project */
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-D_HXjsEV.js';
2
- import { E as ExtensionManifest } from './types-Cji-mUN0.js';
2
+ import { E as ExtensionManifest } from './types-fHuxbqa4.js';
3
3
 
4
4
  interface ReadManifestOptions {
5
5
  /** Root directory of the project */
package/dist/react.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-DaS2fAf-.mjs';
1
+ import { H as HaexVaultSdk, S as StorageAPI } from './client-BW3ayV19.mjs';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
- import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-Cji-mUN0.mjs';
3
+ import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-fHuxbqa4.mjs';
4
4
 
5
5
  /**
6
6
  * React hook for HaexVault SDK
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-BBD-YsPv.js';
1
+ import { H as HaexVaultSdk, S as StorageAPI } from './client-Cm23j1wm.js';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
- import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-Cji-mUN0.js';
3
+ import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-fHuxbqa4.js';
4
4
 
5
5
  /**
6
6
  * React hook for HaexVault SDK
package/dist/react.js CHANGED
@@ -404,6 +404,10 @@ var HAEXTENSION_EVENTS = {
404
404
  * subscribe via `client.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, ...)`. */
405
405
  PERMISSION_RESOLVED: "extension:permission-resolved"
406
406
  };
407
+ var NOTIFICATION_EVENTS = {
408
+ /** A click on one of this extension's notifications (body or action button). */
409
+ CLICK: "haextension:notification:click"
410
+ };
407
411
  var EXTERNAL_EVENTS = {
408
412
  /** External request from authorized client */
409
413
  REQUEST: "haextension:external:request",
@@ -688,6 +692,14 @@ var MAIL_COMMANDS = {
688
692
  buildRfc822: "extension_mail_build_rfc822"
689
693
  };
690
694
 
695
+ // src/commands/notifications.ts
696
+ var NOTIFICATION_COMMANDS = {
697
+ /** Show an OS notification. Returns the assigned notification id. */
698
+ show: "extension_notifications_show",
699
+ /** Dismiss a previously shown notification (only own notifications). */
700
+ dismiss: "extension_notifications_dismiss"
701
+ };
702
+
691
703
  // src/api/storage.ts
692
704
  var StorageAPI = class {
693
705
  constructor(client) {
@@ -1762,6 +1774,38 @@ var MailAPI = class {
1762
1774
  }
1763
1775
  };
1764
1776
 
1777
+ // src/api/notifications.ts
1778
+ var NotificationsAPI = class {
1779
+ constructor(client) {
1780
+ this.client = client;
1781
+ }
1782
+ /** Show a notification. Returns its id so it can be dismissed later. */
1783
+ async show(opts) {
1784
+ return this.client.request(NOTIFICATION_COMMANDS.show, {
1785
+ options: opts
1786
+ });
1787
+ }
1788
+ /** Dismiss a previously shown notification (only own notifications). */
1789
+ async dismiss(id) {
1790
+ return this.client.request(NOTIFICATION_COMMANDS.dismiss, { id });
1791
+ }
1792
+ /**
1793
+ * Listen for clicks on this extension's notifications. Useful when the
1794
+ * extension is already open and wants to react in-app (e.g. router.push the
1795
+ * `path`) instead of relying on the host to focus the webview.
1796
+ *
1797
+ * Returns an unsubscribe function.
1798
+ */
1799
+ onClick(handler) {
1800
+ const wrapped = (event) => {
1801
+ const data = event.data;
1802
+ if (data) handler(data);
1803
+ };
1804
+ this.client.on(NOTIFICATION_EVENTS.CLICK, wrapped);
1805
+ return () => this.client.off(NOTIFICATION_EVENTS.CLICK, wrapped);
1806
+ }
1807
+ };
1808
+
1765
1809
  // src/client/tableName.ts
1766
1810
  function validatePublicKey(publicKey) {
1767
1811
  if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
@@ -1929,6 +1973,7 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1929
1973
  HAEXTENSION_EVENTS.PERMISSION_RESOLVED,
1930
1974
  EXTERNAL_EVENTS.REQUEST,
1931
1975
  EXTERNAL_EVENTS.ACTION_REQUEST,
1976
+ NOTIFICATION_EVENTS.CLICK,
1932
1977
  ...Object.values(LOCALSEND_EVENTS)
1933
1978
  ]) {
1934
1979
  await forwardEvent(listen, log, onEvent, listenOptions, eventName);
@@ -2404,6 +2449,7 @@ var HaexVaultSdk = class {
2404
2449
  this.shell = new ShellAPI(this);
2405
2450
  this.passwords = new PasswordsAPI(this);
2406
2451
  this.mail = new MailAPI(this);
2452
+ this.notifications = new NotificationsAPI(this);
2407
2453
  installConsoleForwarding(this.config.debug);
2408
2454
  this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
2409
2455
  const data = event.data;