@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.mjs
CHANGED
|
@@ -2732,6 +2732,19 @@ var NotificationsModule = class {
|
|
|
2732
2732
|
authenticated: true
|
|
2733
2733
|
});
|
|
2734
2734
|
}
|
|
2735
|
+
/**
|
|
2736
|
+
* Unregister a push subscription by its `id` (as returned by
|
|
2737
|
+
* {@link getSubscriptions}). Robust regardless of platform — use this to
|
|
2738
|
+
* remove a listed device (e.g. web-fcm rows whose raw token is not returned
|
|
2739
|
+
* by the listing and so cannot be passed to {@link unsubscribe}).
|
|
2740
|
+
*/
|
|
2741
|
+
async unsubscribeById(subscriptionId) {
|
|
2742
|
+
return this.http.request({
|
|
2743
|
+
method: "DELETE",
|
|
2744
|
+
path: `/notifications/subscriptions/${encodeURIComponent(subscriptionId)}`,
|
|
2745
|
+
authenticated: true
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2735
2748
|
/** Get all subscriptions for the current user */
|
|
2736
2749
|
async getSubscriptions() {
|
|
2737
2750
|
return this.http.request({
|
|
@@ -2796,6 +2809,11 @@ var NotificationsModule = class {
|
|
|
2796
2809
|
* browser through the project's FCM provider instead of VAPID WebPush.
|
|
2797
2810
|
*/
|
|
2798
2811
|
async registerWebFcm(fcmToken, deviceName) {
|
|
2812
|
+
if (/^https?:\/\//i.test(fcmToken)) {
|
|
2813
|
+
console.warn(
|
|
2814
|
+
"[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."
|
|
2815
|
+
);
|
|
2816
|
+
}
|
|
2799
2817
|
return this.subscribe(
|
|
2800
2818
|
{
|
|
2801
2819
|
platform: "web-fcm",
|