@sigx/lynx-notifications 0.1.2 → 0.4.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/README.md CHANGED
@@ -8,14 +8,7 @@ Local push notifications for sigx-lynx. `UNUserNotificationCenter` on iOS, `Noti
8
8
  pnpm add @sigx/lynx-notifications
9
9
  ```
10
10
 
11
- ```ts
12
- // sigx.lynx.config.ts
13
- export default defineLynxConfig({
14
- modules: ['@sigx/lynx-notifications'],
15
- });
16
- ```
17
-
18
- `sigx prebuild` auto-links the native module and adds `android.permission.POST_NOTIFICATIONS` (Android 13+). iOS notification permission is requested at runtime via `requestPermission()`.
11
+ `sigx prebuild` auto-discovers the package, links the native module, and adds `android.permission.POST_NOTIFICATIONS` (Android 13+). iOS notification permission is requested at runtime via `requestPermission()`.
19
12
 
20
13
  > **Android pairs with `@sigx/lynx-permissions`** — needed for the runtime permission prompt on Android 13+.
21
14
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Notifications } from './notifications.js';
2
- export type { NotificationContent, ScheduleOptions } from './notifications.js';
1
+ export { Notifications } from './notifications';
2
+ export type { NotificationContent, ScheduleOptions } from './notifications';
3
3
  export type { PermissionResponse } from '@sigx/lynx-core';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC/E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC5E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,26 @@
1
- export { Notifications } from './notifications.js';
1
+ import { callAsync as e, isModuleAvailable as t } from "@sigx/lynx-core";
2
+ //#region src/notifications.ts
3
+ var n = "Notifications", r = {
4
+ schedule(t, r = {}) {
5
+ return e(n, "schedule", t, r);
6
+ },
7
+ cancel(t) {
8
+ return e(n, "cancel", t);
9
+ },
10
+ cancelAll() {
11
+ return e(n, "cancelAll");
12
+ },
13
+ requestPermission() {
14
+ return e(n, "requestPermission");
15
+ },
16
+ getPermissionStatus() {
17
+ return e(n, "getPermissionStatus");
18
+ },
19
+ isAvailable() {
20
+ return t(n);
21
+ }
22
+ };
23
+ //#endregion
24
+ export { r as Notifications };
25
+
2
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/notifications.ts"],"sourcesContent":["import { callAsync, isModuleAvailable } from '@sigx/lynx-core';\nimport type { PermissionResponse } from '@sigx/lynx-core';\n\nconst MODULE = 'Notifications';\n\nexport interface NotificationContent {\n title: string;\n body: string;\n /** Optional data payload */\n data?: Record<string, string>;\n}\n\nexport interface ScheduleOptions {\n /** Delay in seconds from now */\n delay?: number;\n /** Repeat interval: 'minute', 'hour', 'day', 'week' */\n repeat?: 'minute' | 'hour' | 'day' | 'week';\n}\n\n/**\n * Local notification APIs.\n *\n * @example\n * ```ts\n * import { Notifications } from '@sigx/lynx-notifications';\n *\n * const { status } = await Notifications.requestPermission();\n * if (status === 'granted') {\n * await Notifications.schedule({ title: 'Reminder', body: 'Check your tasks' }, { delay: 60 });\n * }\n * ```\n */\nexport const Notifications = {\n schedule(content: NotificationContent, options: ScheduleOptions = {}): Promise<string> {\n return callAsync<string>(MODULE, 'schedule', content, options);\n },\n\n cancel(notificationId: string): Promise<void> {\n return callAsync<void>(MODULE, 'cancel', notificationId);\n },\n\n cancelAll(): Promise<void> {\n return callAsync<void>(MODULE, 'cancelAll');\n },\n\n /** Request notification permission, showing the OS dialog if needed. */\n requestPermission(): Promise<PermissionResponse> {\n return callAsync<PermissionResponse>(MODULE, 'requestPermission');\n },\n\n /** Check current notification permission status without prompting. */\n getPermissionStatus(): Promise<PermissionResponse> {\n return callAsync<PermissionResponse>(MODULE, 'getPermissionStatus');\n },\n\n isAvailable(): boolean {\n return isModuleAvailable(MODULE);\n },\n} as const;\n"],"mappings":";;AAGA,IAAM,IAAS,iBA6BF,IAAgB;CACzB,SAAS,GAA8B,IAA2B,EAAE,EAAmB;EACnF,OAAO,EAAkB,GAAQ,YAAY,GAAS,EAAQ;;CAGlE,OAAO,GAAuC;EAC1C,OAAO,EAAgB,GAAQ,UAAU,EAAe;;CAG5D,YAA2B;EACvB,OAAO,EAAgB,GAAQ,YAAY;;CAI/C,oBAAiD;EAC7C,OAAO,EAA8B,GAAQ,oBAAoB;;CAIrE,sBAAmD;EAC/C,OAAO,EAA8B,GAAQ,sBAAsB;;CAGvE,cAAuB;EACnB,OAAO,EAAkB,EAAO;;CAEvC"}
@@ -25,13 +25,13 @@ export interface ScheduleOptions {
25
25
  * ```
26
26
  */
27
27
  export declare const Notifications: {
28
- readonly schedule: (content: NotificationContent, options?: ScheduleOptions) => Promise<string>;
29
- readonly cancel: (notificationId: string) => Promise<void>;
30
- readonly cancelAll: () => Promise<void>;
28
+ schedule(content: NotificationContent, options?: ScheduleOptions): Promise<string>;
29
+ cancel(notificationId: string): Promise<void>;
30
+ cancelAll(): Promise<void>;
31
31
  /** Request notification permission, showing the OS dialog if needed. */
32
- readonly requestPermission: () => Promise<PermissionResponse>;
32
+ requestPermission(): Promise<PermissionResponse>;
33
33
  /** Check current notification permission status without prompting. */
34
- readonly getPermissionStatus: () => Promise<PermissionResponse>;
35
- readonly isAvailable: () => boolean;
34
+ getPermissionStatus(): Promise<PermissionResponse>;
35
+ isAvailable(): boolean;
36
36
  };
37
37
  //# sourceMappingURL=notifications.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC5B,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;CAC/C;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;iCACJ,mBAAmB,YAAW,eAAe,KAAQ,OAAO,CAAC,MAAM,CAAC;sCAI/D,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;8BAIhC,OAAO,CAAC,IAAI,CAAC;IAI1B,wEAAwE;sCACnD,OAAO,CAAC,kBAAkB,CAAC;IAIhD,sEAAsE;wCAC/C,OAAO,CAAC,kBAAkB,CAAC;gCAInC,OAAO;CAGhB,CAAC"}
1
+ {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAI1D,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC5B,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;CAC/C;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa;IACtB,QAAQ,UAAU,mBAAmB,YAAW,eAAe,GAAQ,OAAO,CAAC,MAAM,CAAC;IAItF,MAAM,iBAAiB,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1B,wEAAwE;IACxE,iBAAiB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIhD,sEAAsE;IACtE,mBAAmB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIlD,WAAW,IAAI,OAAO;CAGhB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigx/lynx-notifications",
3
- "version": "0.1.2",
3
+ "version": "0.4.0",
4
4
  "description": "Local push notifications for sigx-lynx",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,19 +10,20 @@
10
10
  "import": "./dist/index.js",
11
11
  "types": "./dist/index.d.ts"
12
12
  },
13
- "./sigx-module.json": "./sigx-module.json"
13
+ "./signalx-module.json": "./signalx-module.json"
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
17
  "ios",
18
18
  "android",
19
- "sigx-module.json"
19
+ "signalx-module.json"
20
20
  ],
21
21
  "dependencies": {
22
- "@sigx/lynx-core": "^0.1.4"
22
+ "@sigx/lynx-core": "^0.4.0"
23
23
  },
24
24
  "devDependencies": {
25
- "typescript": "^6.0.3"
25
+ "typescript": "^6.0.3",
26
+ "@sigx/vite": "^0.4.3"
26
27
  },
27
28
  "author": "Andreas Ekdahl",
28
29
  "license": "MIT",
@@ -48,7 +49,7 @@
48
49
  "notifications"
49
50
  ],
50
51
  "scripts": {
51
- "build": "tsc",
52
- "dev": "tsc --watch"
52
+ "build": "vite build && tsgo --emitDeclarationOnly",
53
+ "dev": "vite build --watch"
53
54
  }
54
55
  }
@@ -1,38 +0,0 @@
1
- import { callAsync, isModuleAvailable } from '@sigx/lynx-core';
2
- const MODULE = 'Notifications';
3
- /**
4
- * Local notification APIs.
5
- *
6
- * @example
7
- * ```ts
8
- * import { Notifications } from '@sigx/lynx-notifications';
9
- *
10
- * const { status } = await Notifications.requestPermission();
11
- * if (status === 'granted') {
12
- * await Notifications.schedule({ title: 'Reminder', body: 'Check your tasks' }, { delay: 60 });
13
- * }
14
- * ```
15
- */
16
- export const Notifications = {
17
- schedule(content, options = {}) {
18
- return callAsync(MODULE, 'schedule', content, options);
19
- },
20
- cancel(notificationId) {
21
- return callAsync(MODULE, 'cancel', notificationId);
22
- },
23
- cancelAll() {
24
- return callAsync(MODULE, 'cancelAll');
25
- },
26
- /** Request notification permission, showing the OS dialog if needed. */
27
- requestPermission() {
28
- return callAsync(MODULE, 'requestPermission');
29
- },
30
- /** Check current notification permission status without prompting. */
31
- getPermissionStatus() {
32
- return callAsync(MODULE, 'getPermissionStatus');
33
- },
34
- isAvailable() {
35
- return isModuleAvailable(MODULE);
36
- },
37
- };
38
- //# sourceMappingURL=notifications.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notifications.js","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAG/D,MAAM,MAAM,GAAG,eAAe,CAAC;AAgB/B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,QAAQ,CAAC,OAA4B,EAAE,UAA2B,EAAE;QAChE,OAAO,SAAS,CAAS,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,CAAC,cAAsB;QACzB,OAAO,SAAS,CAAO,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAC7D,CAAC;IAED,SAAS;QACL,OAAO,SAAS,CAAO,MAAM,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;IAED,wEAAwE;IACxE,iBAAiB;QACb,OAAO,SAAS,CAAqB,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACtE,CAAC;IAED,sEAAsE;IACtE,mBAAmB;QACf,OAAO,SAAS,CAAqB,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACxE,CAAC;IAED,WAAW;QACP,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACK,CAAC"}
File without changes