@spacelr/sdk 0.5.2 → 0.6.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/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1338,6 +1338,15 @@ declare class NotificationsModule {
|
|
|
1338
1338
|
unsubscribe(platform: PushPlatform, identifier: string): Promise<{
|
|
1339
1339
|
deleted: boolean;
|
|
1340
1340
|
}>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Unregister a push subscription by its `id` (as returned by
|
|
1343
|
+
* {@link getSubscriptions}). Robust regardless of platform — use this to
|
|
1344
|
+
* remove a listed device (e.g. web-fcm rows whose raw token is not returned
|
|
1345
|
+
* by the listing and so cannot be passed to {@link unsubscribe}).
|
|
1346
|
+
*/
|
|
1347
|
+
unsubscribeById(subscriptionId: string): Promise<{
|
|
1348
|
+
deleted: boolean;
|
|
1349
|
+
}>;
|
|
1341
1350
|
/** Get all subscriptions for the current user */
|
|
1342
1351
|
getSubscriptions(): Promise<PushSubscriptionInfo[]>;
|
|
1343
1352
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1338,6 +1338,15 @@ declare class NotificationsModule {
|
|
|
1338
1338
|
unsubscribe(platform: PushPlatform, identifier: string): Promise<{
|
|
1339
1339
|
deleted: boolean;
|
|
1340
1340
|
}>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Unregister a push subscription by its `id` (as returned by
|
|
1343
|
+
* {@link getSubscriptions}). Robust regardless of platform — use this to
|
|
1344
|
+
* remove a listed device (e.g. web-fcm rows whose raw token is not returned
|
|
1345
|
+
* by the listing and so cannot be passed to {@link unsubscribe}).
|
|
1346
|
+
*/
|
|
1347
|
+
unsubscribeById(subscriptionId: string): Promise<{
|
|
1348
|
+
deleted: boolean;
|
|
1349
|
+
}>;
|
|
1341
1350
|
/** Get all subscriptions for the current user */
|
|
1342
1351
|
getSubscriptions(): Promise<PushSubscriptionInfo[]>;
|
|
1343
1352
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2775,6 +2775,19 @@ var NotificationsModule = class {
|
|
|
2775
2775
|
authenticated: true
|
|
2776
2776
|
});
|
|
2777
2777
|
}
|
|
2778
|
+
/**
|
|
2779
|
+
* Unregister a push subscription by its `id` (as returned by
|
|
2780
|
+
* {@link getSubscriptions}). Robust regardless of platform — use this to
|
|
2781
|
+
* remove a listed device (e.g. web-fcm rows whose raw token is not returned
|
|
2782
|
+
* by the listing and so cannot be passed to {@link unsubscribe}).
|
|
2783
|
+
*/
|
|
2784
|
+
async unsubscribeById(subscriptionId) {
|
|
2785
|
+
return this.http.request({
|
|
2786
|
+
method: "DELETE",
|
|
2787
|
+
path: `/notifications/subscriptions/${encodeURIComponent(subscriptionId)}`,
|
|
2788
|
+
authenticated: true
|
|
2789
|
+
});
|
|
2790
|
+
}
|
|
2778
2791
|
/** Get all subscriptions for the current user */
|
|
2779
2792
|
async getSubscriptions() {
|
|
2780
2793
|
return this.http.request({
|
|
@@ -2839,6 +2852,11 @@ var NotificationsModule = class {
|
|
|
2839
2852
|
* browser through the project's FCM provider instead of VAPID WebPush.
|
|
2840
2853
|
*/
|
|
2841
2854
|
async registerWebFcm(fcmToken, deviceName) {
|
|
2855
|
+
if (/^https?:\/\//i.test(fcmToken)) {
|
|
2856
|
+
console.warn(
|
|
2857
|
+
"[spacelr] registerWebFcm received what looks like a Web Push endpoint URL, not a Firebase FCM registration token. A web-fcm token must come from getToken(getMessaging(app), { vapidKey, serviceWorkerRegistration }). For plain (non-FCM) Web Push, use registerBrowserPush instead."
|
|
2858
|
+
);
|
|
2859
|
+
}
|
|
2842
2860
|
return this.subscribe(
|
|
2843
2861
|
{
|
|
2844
2862
|
platform: "web-fcm",
|