@burdenoff/fe-libs 2026.1012.2 → 2026.1012.4
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.
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* appName: 'VibeControls',
|
|
16
16
|
* plugins: {
|
|
17
17
|
* updater: () => import('@capgo/capacitor-updater'),
|
|
18
|
-
* pushNotifications: () => import('@capacitor/
|
|
18
|
+
* pushNotifications: () => import('@capacitor-firebase/messaging'),
|
|
19
19
|
* },
|
|
20
20
|
* push: { enabled: true },
|
|
21
21
|
* });
|
|
@@ -15,7 +15,7 @@ async function s() {
|
|
|
15
15
|
if (a) return a;
|
|
16
16
|
if (!o || !t()) return null;
|
|
17
17
|
try {
|
|
18
|
-
a = (await o()).
|
|
18
|
+
a = (await o()).FirebaseMessaging ?? null;
|
|
19
19
|
} catch {
|
|
20
20
|
a = null;
|
|
21
21
|
}
|
|
@@ -41,24 +41,29 @@ async function l(t, r = {}) {
|
|
|
41
41
|
if (!l) return;
|
|
42
42
|
let u = e();
|
|
43
43
|
if (u !== "web") try {
|
|
44
|
-
await l.addListener("
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
r.onNotificationReceived?.(
|
|
50
|
-
}), await l.addListener("
|
|
51
|
-
let t = c(
|
|
52
|
-
|
|
53
|
-
}), (await l.checkPermissions()).receive === "granted"
|
|
44
|
+
if (await l.addListener("tokenReceived", (e) => {
|
|
45
|
+
let t = e;
|
|
46
|
+
i(t.token, u), r.onToken?.(t.token, u);
|
|
47
|
+
}), await l.addListener("notificationReceived", (e) => {
|
|
48
|
+
let t = e;
|
|
49
|
+
r.onNotificationReceived?.(t.notification);
|
|
50
|
+
}), await l.addListener("notificationActionPerformed", (e) => {
|
|
51
|
+
let t = e, i = c(t);
|
|
52
|
+
i && n(i), r.onNotificationAction?.(t);
|
|
53
|
+
}), (await l.checkPermissions()).receive === "granted") {
|
|
54
|
+
let { token: e } = await l.getToken();
|
|
55
|
+
i(e, u), r.onToken?.(e, u);
|
|
56
|
+
}
|
|
54
57
|
} catch {}
|
|
55
58
|
}
|
|
56
59
|
async function u() {
|
|
57
|
-
let
|
|
58
|
-
if (!
|
|
60
|
+
let t = await s();
|
|
61
|
+
if (!t) return !1;
|
|
59
62
|
try {
|
|
60
|
-
let
|
|
61
|
-
|
|
63
|
+
let n = await t.checkPermissions();
|
|
64
|
+
if ((n.receive === "prompt" || n.receive === "prompt-with-rationale") && (n = await t.requestPermissions()), n.receive !== "granted") return !1;
|
|
65
|
+
let { token: r } = await t.getToken();
|
|
66
|
+
return i(r, e()), !0;
|
|
62
67
|
} catch {
|
|
63
68
|
return !1;
|
|
64
69
|
}
|
|
@@ -161,7 +161,7 @@ export interface CapacitorUpdaterLike {
|
|
|
161
161
|
notifyAppReady(): Promise<unknown>;
|
|
162
162
|
}
|
|
163
163
|
export interface PushTokenLike {
|
|
164
|
-
|
|
164
|
+
token: string;
|
|
165
165
|
}
|
|
166
166
|
export interface PushNotificationSchemaLike {
|
|
167
167
|
id?: string;
|
|
@@ -171,10 +171,19 @@ export interface PushNotificationSchemaLike {
|
|
|
171
171
|
}
|
|
172
172
|
export interface PushActionPerformedLike {
|
|
173
173
|
actionId?: string;
|
|
174
|
+
inputValue?: string;
|
|
174
175
|
notification: PushNotificationSchemaLike;
|
|
175
176
|
}
|
|
176
177
|
export type PushPermissionStateLike = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';
|
|
177
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Structural subset of `@capacitor-firebase/messaging`'s `FirebaseMessaging`.
|
|
180
|
+
*
|
|
181
|
+
* Not `@capacitor/push-notifications`: on iOS that plugin's `register()` /
|
|
182
|
+
* `'registration'` event yields the raw APNs device token, not an FCM
|
|
183
|
+
* registration token — our backend (Firebase Admin SDK, FCM HTTP v1) needs the
|
|
184
|
+
* latter. `FirebaseMessaging` does the APNs→FCM exchange natively and hands
|
|
185
|
+
* back one consistent token shape on both platforms via `getToken()`.
|
|
186
|
+
*/
|
|
178
187
|
export interface PushNotificationsLike {
|
|
179
188
|
checkPermissions(): Promise<{
|
|
180
189
|
receive: PushPermissionStateLike;
|
|
@@ -182,24 +191,21 @@ export interface PushNotificationsLike {
|
|
|
182
191
|
requestPermissions(): Promise<{
|
|
183
192
|
receive: PushPermissionStateLike;
|
|
184
193
|
}>;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}) => void): Promise<CapacitorListenerHandleLike>;
|
|
190
|
-
addListener(eventName: 'pushNotificationReceived', listener: (notification: PushNotificationSchemaLike) => void): Promise<CapacitorListenerHandleLike>;
|
|
191
|
-
addListener(eventName: 'pushNotificationActionPerformed', listener: (action: PushActionPerformedLike) => void): Promise<CapacitorListenerHandleLike>;
|
|
194
|
+
getToken(): Promise<{
|
|
195
|
+
token: string;
|
|
196
|
+
}>;
|
|
197
|
+
addListener(eventName: 'tokenReceived' | 'notificationReceived' | 'notificationActionPerformed', listener: (payload: unknown) => void): Promise<CapacitorListenerHandleLike>;
|
|
192
198
|
}
|
|
193
199
|
export type UpdaterLoader = () => Promise<{
|
|
194
200
|
CapacitorUpdater: CapacitorUpdaterLike;
|
|
195
201
|
}>;
|
|
196
202
|
export type PushNotificationsLoader = () => Promise<{
|
|
197
|
-
|
|
203
|
+
FirebaseMessaging: PushNotificationsLike;
|
|
198
204
|
}>;
|
|
199
205
|
export interface OptionalPluginLoaders {
|
|
200
206
|
/** `() => import('@capgo/capacitor-updater')` */
|
|
201
207
|
updater?: UpdaterLoader;
|
|
202
|
-
/** `() => import('@capacitor/
|
|
208
|
+
/** `() => import('@capacitor-firebase/messaging')` */
|
|
203
209
|
pushNotifications?: PushNotificationsLoader;
|
|
204
210
|
}
|
|
205
211
|
export interface PushOptions {
|