asyar-sdk 1.15.6 → 1.15.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/services/INotificationService.d.ts +14 -8
- package/dist/services/INotificationService.d.ts.map +1 -1
- package/dist/services/NotificationServiceProxy.d.ts +3 -7
- package/dist/services/NotificationServiceProxy.d.ts.map +1 -1
- package/dist/services/NotificationServiceProxy.js +35 -18
- package/dist/services/NotificationServiceProxy.js.map +1 -1
- package/dist/services/NotificationServiceProxy.test.js +73 -37
- package/dist/services/NotificationServiceProxy.test.js.map +1 -1
- package/dist/types/NotificationType.d.ts +31 -59
- package/dist/types/NotificationType.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NotificationOptions } from "../types/NotificationType";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Desktop notification service.
|
|
4
|
+
*
|
|
5
|
+
* Per-notification `actions` carry a `commandId`/`args` pair — when the
|
|
6
|
+
* user clicks an action button the host dispatches the extension's
|
|
7
|
+
* declared command directly, with no additional listener wiring needed
|
|
8
|
+
* on the extension side.
|
|
4
9
|
*/
|
|
5
10
|
export interface INotificationService {
|
|
6
11
|
checkPermission(): Promise<boolean>;
|
|
7
12
|
requestPermission(): Promise<boolean>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Shows a desktop notification. Resolves with the notification id, which
|
|
15
|
+
* callers can pass to `dismiss()` if the notification is no longer relevant.
|
|
16
|
+
*/
|
|
17
|
+
send(options: NotificationOptions): Promise<string>;
|
|
18
|
+
/** Dismiss a previously-shown notification and drop any pending actions. */
|
|
19
|
+
dismiss(notificationId: string): Promise<void>;
|
|
14
20
|
}
|
|
15
21
|
//# sourceMappingURL=INotificationService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INotificationService.d.ts","sourceRoot":"","sources":["../../src/services/INotificationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"INotificationService.d.ts","sourceRoot":"","sources":["../../src/services/INotificationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,4EAA4E;IAC5E,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import type { INotificationService } from "./INotificationService";
|
|
2
|
-
import type {
|
|
2
|
+
import type { NotificationOptions } from "../types/NotificationType";
|
|
3
3
|
import { BaseServiceProxy } from "./BaseServiceProxy";
|
|
4
4
|
export declare class NotificationServiceProxy extends BaseServiceProxy implements INotificationService {
|
|
5
5
|
checkPermission(): Promise<boolean>;
|
|
6
6
|
requestPermission(): Promise<boolean>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
listenForActions(callback: (event: NotificationActionEvent) => void): Promise<void>;
|
|
10
|
-
createChannel(channel: NotificationChannel): Promise<void>;
|
|
11
|
-
getChannels(): Promise<NotificationChannel[]>;
|
|
12
|
-
removeChannel(channelId: string): Promise<void>;
|
|
7
|
+
send(options: NotificationOptions): Promise<string>;
|
|
8
|
+
dismiss(notificationId: string): Promise<void>;
|
|
13
9
|
}
|
|
14
10
|
//# sourceMappingURL=NotificationServiceProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationServiceProxy.d.ts","sourceRoot":"","sources":["../../src/services/NotificationServiceProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"NotificationServiceProxy.d.ts","sourceRoot":"","sources":["../../src/services/NotificationServiceProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAsB,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBAAa,wBAAyB,SAAQ,gBAAiB,YAAW,oBAAoB;IAC5F,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/B,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAOzD,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.NotificationServiceProxy = void 0;
|
|
4
13
|
const BaseServiceProxy_1 = require("./BaseServiceProxy");
|
|
@@ -9,27 +18,35 @@ class NotificationServiceProxy extends BaseServiceProxy_1.BaseServiceProxy {
|
|
|
9
18
|
requestPermission() {
|
|
10
19
|
return this.broker.invoke('notifications:requestPermission');
|
|
11
20
|
}
|
|
12
|
-
|
|
13
|
-
return this
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.broker.on('asyar:event:notification:action', (raw) => {
|
|
20
|
-
callback(raw);
|
|
21
|
+
send(options) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
if (options.actions) {
|
|
24
|
+
for (const a of options.actions)
|
|
25
|
+
validateAction(a);
|
|
26
|
+
}
|
|
27
|
+
return this.broker.invoke('notifications:send', { options });
|
|
21
28
|
});
|
|
22
|
-
return Promise.resolve();
|
|
23
|
-
}
|
|
24
|
-
createChannel(channel) {
|
|
25
|
-
return this.broker.invoke('notifications:createChannel', { channel });
|
|
26
29
|
}
|
|
27
|
-
|
|
28
|
-
return this.broker.invoke('notifications:
|
|
29
|
-
}
|
|
30
|
-
removeChannel(channelId) {
|
|
31
|
-
return this.broker.invoke('notifications:removeChannel', { channelId });
|
|
30
|
+
dismiss(notificationId) {
|
|
31
|
+
return this.broker.invoke('notifications:dismiss', { notificationId });
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
exports.NotificationServiceProxy = NotificationServiceProxy;
|
|
35
|
+
function validateAction(a) {
|
|
36
|
+
if (!a.id)
|
|
37
|
+
throw new Error(`NotificationAction requires a non-empty id`);
|
|
38
|
+
if (!a.title)
|
|
39
|
+
throw new Error(`NotificationAction "${a.id}" requires a non-empty title`);
|
|
40
|
+
if (!a.commandId) {
|
|
41
|
+
throw new Error(`NotificationAction "${a.id}" requires a non-empty commandId`);
|
|
42
|
+
}
|
|
43
|
+
if (a.args !== undefined) {
|
|
44
|
+
try {
|
|
45
|
+
JSON.stringify(a.args);
|
|
46
|
+
}
|
|
47
|
+
catch (_a) {
|
|
48
|
+
throw new Error(`NotificationAction "${a.id}" args are not JSON-serialisable`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
35
52
|
//# sourceMappingURL=NotificationServiceProxy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationServiceProxy.js","sourceRoot":"","sources":["../../src/services/NotificationServiceProxy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NotificationServiceProxy.js","sourceRoot":"","sources":["../../src/services/NotificationServiceProxy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yDAAsD;AAEtD,MAAa,wBAAyB,SAAQ,mCAAgB;IAC5D,eAAe;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAU,+BAA+B,CAAC,CAAC;IACtE,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAU,iCAAiC,CAAC,CAAC;IACxE,CAAC;IAEK,IAAI,CAAC,OAA4B;;YACrC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACpB,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO;oBAAE,cAAc,CAAC,CAAC,CAAC,CAAC;YACrD,CAAC;YACD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAS,oBAAoB,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACvE,CAAC;KAAA;IAED,OAAO,CAAC,cAAsB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAO,uBAAuB,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;IAC/E,CAAC;CACF;AAnBD,4DAmBC;AAED,SAAS,cAAc,CAAC,CAAqB;IAC3C,IAAI,CAAC,CAAC,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IACzE,IAAI,CAAC,CAAC,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC,EAAE,8BAA8B,CAAC,CAAC;IACzF,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC,EAAE,kCAAkC,CAAC,CAAC;IACjF,CAAC;IACD,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACzB,IAAI,CAAC;YACH,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QAAC,WAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACb,uBAAuB,CAAC,CAAC,EAAE,kCAAkC,CAC9D,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -17,8 +17,8 @@ vitest_1.vi.mock('../ipc/MessageBroker', () => ({
|
|
|
17
17
|
getInstance: vitest_1.vi.fn(() => ({ invoke: vitest_1.vi.fn(), on: vitest_1.vi.fn(), off: vitest_1.vi.fn() })),
|
|
18
18
|
},
|
|
19
19
|
}));
|
|
20
|
-
function makeProxy() {
|
|
21
|
-
const mockInvoke = vitest_1.vi.fn().mockResolvedValue(
|
|
20
|
+
function makeProxy(resolved = undefined) {
|
|
21
|
+
const mockInvoke = vitest_1.vi.fn().mockResolvedValue(resolved);
|
|
22
22
|
vitest_1.vi.mocked(MessageBroker_1.MessageBroker.getInstance).mockReturnValue({
|
|
23
23
|
invoke: mockInvoke, on: vitest_1.vi.fn(), off: vitest_1.vi.fn(),
|
|
24
24
|
});
|
|
@@ -28,40 +28,76 @@ function makeProxy() {
|
|
|
28
28
|
}
|
|
29
29
|
(0, vitest_1.describe)('NotificationServiceProxy', () => {
|
|
30
30
|
(0, vitest_1.beforeEach)(() => vitest_1.vi.clearAllMocks());
|
|
31
|
-
(0, vitest_1.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(0, vitest_1.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
31
|
+
(0, vitest_1.describe)('send', () => {
|
|
32
|
+
(0, vitest_1.it)('sends notifications:send with the full options payload and returns the id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
const { proxy, mockInvoke } = makeProxy('notif-123');
|
|
34
|
+
const id = yield proxy.send({ title: 'T', body: 'B' });
|
|
35
|
+
(0, vitest_1.expect)(mockInvoke.mock.calls[0][0]).toBe('notifications:send');
|
|
36
|
+
(0, vitest_1.expect)(mockInvoke.mock.calls[0][1]).toEqual({ options: { title: 'T', body: 'B' } });
|
|
37
|
+
(0, vitest_1.expect)(id).toBe('notif-123');
|
|
38
|
+
}));
|
|
39
|
+
(0, vitest_1.it)('forwards actions array on the options payload', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
const { proxy, mockInvoke } = makeProxy('notif-xyz');
|
|
41
|
+
yield proxy.send({
|
|
42
|
+
title: 'Coffee ending',
|
|
43
|
+
actions: [
|
|
44
|
+
{ id: 'extend', title: 'Extend 30m', commandId: 'coffee.extend', args: { minutes: 30 } },
|
|
45
|
+
{ id: 'stop', title: 'Stop now', commandId: 'coffee.stop' },
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
const payload = mockInvoke.mock.calls[0][1];
|
|
49
|
+
(0, vitest_1.expect)(payload.options.actions).toHaveLength(2);
|
|
50
|
+
(0, vitest_1.expect)(payload.options.actions[0]).toEqual({
|
|
51
|
+
id: 'extend', title: 'Extend 30m', commandId: 'coffee.extend', args: { minutes: 30 },
|
|
52
|
+
});
|
|
53
|
+
(0, vitest_1.expect)(payload.options.actions[1]).toEqual({
|
|
54
|
+
id: 'stop', title: 'Stop now', commandId: 'coffee.stop',
|
|
55
|
+
});
|
|
56
|
+
}));
|
|
57
|
+
(0, vitest_1.it)('rejects actions without a commandId before reaching IPC', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
+
const { proxy, mockInvoke } = makeProxy();
|
|
59
|
+
yield (0, vitest_1.expect)(proxy.send({
|
|
60
|
+
title: 'x',
|
|
61
|
+
actions: [{ id: 'a', title: 'A', commandId: '' }],
|
|
62
|
+
})).rejects.toThrow(/commandId/i);
|
|
63
|
+
(0, vitest_1.expect)(mockInvoke).not.toHaveBeenCalled();
|
|
64
|
+
}));
|
|
65
|
+
(0, vitest_1.it)('rejects actions with missing id or title', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
const { proxy, mockInvoke } = makeProxy();
|
|
67
|
+
yield (0, vitest_1.expect)(proxy.send({ title: 'x', actions: [{ id: '', title: 'A', commandId: 'cmd.a' }] })).rejects.toThrow(/id/i);
|
|
68
|
+
yield (0, vitest_1.expect)(proxy.send({ title: 'x', actions: [{ id: 'a', title: '', commandId: 'cmd.a' }] })).rejects.toThrow(/title/i);
|
|
69
|
+
(0, vitest_1.expect)(mockInvoke).not.toHaveBeenCalled();
|
|
70
|
+
}));
|
|
71
|
+
(0, vitest_1.it)('rejects actions whose args are not JSON-serialisable', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
+
const { proxy, mockInvoke } = makeProxy();
|
|
73
|
+
const cyclic = {};
|
|
74
|
+
cyclic.self = cyclic;
|
|
75
|
+
yield (0, vitest_1.expect)(proxy.send({
|
|
76
|
+
title: 'x',
|
|
77
|
+
actions: [{ id: 'a', title: 'A', commandId: 'cmd.a', args: cyclic }],
|
|
78
|
+
})).rejects.toThrow(/serial/i);
|
|
79
|
+
(0, vitest_1.expect)(mockInvoke).not.toHaveBeenCalled();
|
|
80
|
+
}));
|
|
81
|
+
});
|
|
82
|
+
(0, vitest_1.describe)('dismiss', () => {
|
|
83
|
+
(0, vitest_1.it)('sends notifications:dismiss with the notification id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
+
const { proxy, mockInvoke } = makeProxy();
|
|
85
|
+
yield proxy.dismiss('notif-abc');
|
|
86
|
+
(0, vitest_1.expect)(mockInvoke.mock.calls[0][0]).toBe('notifications:dismiss');
|
|
87
|
+
(0, vitest_1.expect)(mockInvoke.mock.calls[0][1]).toEqual({ notificationId: 'notif-abc' });
|
|
88
|
+
}));
|
|
89
|
+
});
|
|
90
|
+
(0, vitest_1.describe)('permissions', () => {
|
|
91
|
+
(0, vitest_1.it)('checkPermission maps to notifications:checkPermission', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
const { proxy, mockInvoke } = makeProxy(true);
|
|
93
|
+
yield proxy.checkPermission();
|
|
94
|
+
(0, vitest_1.expect)(mockInvoke.mock.calls[0][0]).toBe('notifications:checkPermission');
|
|
95
|
+
}));
|
|
96
|
+
(0, vitest_1.it)('requestPermission maps to notifications:requestPermission', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
+
const { proxy, mockInvoke } = makeProxy(true);
|
|
98
|
+
yield proxy.requestPermission();
|
|
99
|
+
(0, vitest_1.expect)(mockInvoke.mock.calls[0][0]).toBe('notifications:requestPermission');
|
|
100
|
+
}));
|
|
101
|
+
});
|
|
66
102
|
});
|
|
67
103
|
//# sourceMappingURL=NotificationServiceProxy.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationServiceProxy.test.js","sourceRoot":"","sources":["../../src/services/NotificationServiceProxy.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAA8D;AAC9D,yEAAsE;AACtE,wDAAqD;AAErD,WAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE,GAAG,EAAE,CAAC,CAAC;IACrC,aAAa,EAAE;QACb,WAAW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,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC9E,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,65 +1,37 @@
|
|
|
1
|
-
declare enum Importance {
|
|
2
|
-
None = 0,
|
|
3
|
-
Min = 1,
|
|
4
|
-
Low = 2,
|
|
5
|
-
Default = 3,
|
|
6
|
-
High = 4
|
|
7
|
-
}
|
|
8
|
-
declare enum Visibility {
|
|
9
|
-
Secret = -1,
|
|
10
|
-
Private = 0,
|
|
11
|
-
Public = 1
|
|
12
|
-
}
|
|
13
|
-
export type NotificationOptions = {
|
|
14
|
-
title: string;
|
|
15
|
-
body: string;
|
|
16
|
-
icon?: string;
|
|
17
|
-
channelId?: string;
|
|
18
|
-
attachments?: Array<{
|
|
19
|
-
id: string;
|
|
20
|
-
url: string;
|
|
21
|
-
}>;
|
|
22
|
-
};
|
|
23
|
-
export type NotificationChannel = {
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
description: string;
|
|
27
|
-
importance?: Importance;
|
|
28
|
-
visibility?: Visibility;
|
|
29
|
-
lights?: boolean;
|
|
30
|
-
lightColor?: string;
|
|
31
|
-
vibration?: boolean;
|
|
32
|
-
sound?: string;
|
|
33
|
-
};
|
|
34
|
-
export type NotificationActionType = {
|
|
35
|
-
id: string;
|
|
36
|
-
actions: Array<{
|
|
37
|
-
id: string;
|
|
38
|
-
title: string;
|
|
39
|
-
requiresAuthentication?: boolean;
|
|
40
|
-
foreground?: boolean;
|
|
41
|
-
destructive?: boolean;
|
|
42
|
-
input?: boolean;
|
|
43
|
-
inputButtonTitle?: string;
|
|
44
|
-
inputPlaceholder?: string;
|
|
45
|
-
}>;
|
|
46
|
-
};
|
|
47
1
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* through the public SDK surface.
|
|
2
|
+
* A button on an OS notification that, when clicked, fires the specified
|
|
3
|
+
* extension command with the provided args. The host looks the command up
|
|
4
|
+
* in the extension's manifest and invokes it through the same dispatch
|
|
5
|
+
* path a search-result click would use — no user code on the extension
|
|
6
|
+
* side is needed to receive the event, the command handler just fires.
|
|
54
7
|
*/
|
|
55
|
-
export interface
|
|
56
|
-
|
|
8
|
+
export interface NotificationAction {
|
|
9
|
+
/** Action-local identifier (unique within the notification). */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Button label shown in the OS notification. */
|
|
12
|
+
title: string;
|
|
13
|
+
/**
|
|
14
|
+
* The extension's own command to fire when this action is clicked.
|
|
15
|
+
* Must match a command id declared in the extension's manifest.json —
|
|
16
|
+
* the host rejects actions whose commandId is unknown.
|
|
17
|
+
*/
|
|
18
|
+
commandId: string;
|
|
19
|
+
/** Extra arguments passed to the command handler. Must be JSON-serialisable. */
|
|
20
|
+
args?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
export interface NotificationOptions {
|
|
57
23
|
title: string;
|
|
58
24
|
body?: string;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
25
|
+
icon?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional action buttons. Platform action-count limits apply:
|
|
28
|
+
* - **macOS**: 1 main button + optional close button (multi-action uses dropdown UI).
|
|
29
|
+
* - **Linux**: depends on the notification daemon (GNOME/KDE typically 2–4).
|
|
30
|
+
* - **Windows**: toast actions not yet wired through the Tauri plugin; notification sends without buttons.
|
|
31
|
+
*
|
|
32
|
+
* When a platform can't render actions, the notification is still sent —
|
|
33
|
+
* the action buttons are silently dropped and a warning is logged.
|
|
34
|
+
*/
|
|
35
|
+
actions?: NotificationAction[];
|
|
63
36
|
}
|
|
64
|
-
export {};
|
|
65
37
|
//# sourceMappingURL=NotificationType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationType.d.ts","sourceRoot":"","sources":["../../src/types/NotificationType.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"NotificationType.d.ts","sourceRoot":"","sources":["../../src/types/NotificationType.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAChC"}
|