@sudobility/di_web 0.1.112 → 0.1.113
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.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/initialize/initialize.d.ts +3 -0
- package/dist/initialize/initialize.d.ts.map +1 -1
- package/dist/initialize/initialize.js +45 -16
- package/dist/initialize/initialize.js.map +1 -1
- package/dist/sw/firebase-messaging-sw.js +102 -18
- package/dist/sw/index.d.ts +1 -1
- package/dist/sw/index.d.ts.map +1 -1
- package/dist/sw/index.js +1 -1
- package/dist/sw/index.js.map +1 -1
- package/dist/sw/register.d.ts +8 -2
- package/dist/sw/register.d.ts.map +1 -1
- package/dist/sw/register.js +71 -27
- package/dist/sw/register.js.map +1 -1
- package/dist/sw/vite-plugin-service-worker.d.ts.map +1 -1
- package/dist/sw/vite-plugin-service-worker.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { WebInfoService, createWebInfoService, initializeInfoService, getInfoService, resetInfoService, InfoBanner, useInfoBanner, type BannerState, type BannerStateListener, } from './info/index.js';
|
|
2
2
|
export { FirebaseAnalyticsService, initializeFirebaseAnalytics, getAnalyticsService, resetAnalyticsService, type AnalyticsEventParams, initializeWebApp, type WebAppInitOptions, type RevenueCatConfig, } from './initialize/index.js';
|
|
3
3
|
export { getFirebaseService, initializeFirebaseService, resetFirebaseService, WebFirebaseService, createWebFirebaseService, } from '@sudobility/di/web';
|
|
4
|
-
export { registerServiceWorker, unregisterServiceWorker, } from './sw/register.js';
|
|
4
|
+
export { registerServiceWorker, unregisterServiceWorker, type ServiceWorkerState, type RegisterServiceWorkerOptions, } from './sw/register.js';
|
|
5
5
|
export type { AnalyticsEvent as FirebaseAnalyticsEvent, AnalyticsService, RemoteConfigValue, RemoteConfigService, FCMNotificationPayload, FCMDataPayload, FCMMessage, FCMPermissionState, FCMState, FCMService, FirebaseService, FirebaseConfig, FirebaseInitOptions, } from '@sudobility/di/web';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAEL,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,oBAAoB,EAEzB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAEL,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,oBAAoB,EAEzB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,4BAA4B,GAClC,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,cAAc,IAAI,sBAAsB,EACxC,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,eAAe,EACf,cAAc,EACd,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,GAGd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAEL,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EAGrB,gBAAgB,GAGjB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,GAGd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAEL,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EAGrB,gBAAgB,GAGjB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GAGxB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/initialize/initialize.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,oBAAoB,GAC1B,CAAC;AASF,MAAM,WAAW,gBAAgB;IAE/B,MAAM,EAAE,MAAM,CAAC;IAGf,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvB,eAAe,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/initialize/initialize.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,oBAAoB,GAC1B,CAAC;AASF,MAAM,WAAW,gBAAgB;IAE/B,MAAM,EAAE,MAAM,CAAC;IAGf,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvB,eAAe,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAStD,UAAU,CAAC,EAAE,MAAM,CAAC;IASpB,IAAI,CAAC,EAAE,OAAO,CAAC;IAOf,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC;AAKD,MAAM,WAAW,iBAAiB;IAEhC,cAAc,EAAE,cAAc,CAAC;IAG/B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAGpC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAG5B,qBAAqB,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAG/C,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAsBD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,wBAAwB,CAAC,CAuDnC"}
|
|
@@ -9,23 +9,12 @@ export async function initializeWebApp(options) {
|
|
|
9
9
|
initializeNetworkService();
|
|
10
10
|
initializeInfoService();
|
|
11
11
|
if (revenueCatConfig) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const apiKey = isProduction
|
|
16
|
-
? revenueCatConfig.apiKey
|
|
17
|
-
: revenueCatConfig.apiKeySandbox || revenueCatConfig.apiKey;
|
|
18
|
-
subscriptionLib.configureRevenueCatAdapter(apiKey);
|
|
19
|
-
subscriptionLib.initializeSubscription({
|
|
20
|
-
adapter: subscriptionLib.createRevenueCatAdapter(),
|
|
21
|
-
freeTier: revenueCatConfig.freeTierPackage ?? {
|
|
22
|
-
packageId: 'free',
|
|
23
|
-
name: 'Free',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
12
|
+
const initRC = () => initializeRevenueCat(revenueCatConfig);
|
|
13
|
+
if (revenueCatConfig.lazy) {
|
|
14
|
+
void initRC();
|
|
26
15
|
}
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
else {
|
|
17
|
+
await initRC();
|
|
29
18
|
}
|
|
30
19
|
}
|
|
31
20
|
if (initializeI18n) {
|
|
@@ -43,4 +32,44 @@ export async function initializeWebApp(options) {
|
|
|
43
32
|
}
|
|
44
33
|
return analytics;
|
|
45
34
|
}
|
|
35
|
+
const RC_DEFAULT_MAX_RETRIES = 2;
|
|
36
|
+
const RC_RETRY_BASE_DELAY_MS = 1000;
|
|
37
|
+
function delay(ms) {
|
|
38
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
39
|
+
}
|
|
40
|
+
async function initializeRevenueCat(config) {
|
|
41
|
+
const maxRetries = config.maxRetries ?? RC_DEFAULT_MAX_RETRIES;
|
|
42
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
43
|
+
try {
|
|
44
|
+
const subscriptionLib = await import('@sudobility/subscription_lib');
|
|
45
|
+
const isProduction = config.isProduction ?? true;
|
|
46
|
+
const apiKey = isProduction
|
|
47
|
+
? config.apiKey
|
|
48
|
+
: config.apiKeySandbox || config.apiKey;
|
|
49
|
+
subscriptionLib.configureRevenueCatAdapter(apiKey);
|
|
50
|
+
subscriptionLib.initializeSubscription({
|
|
51
|
+
adapter: subscriptionLib.createRevenueCatAdapter(),
|
|
52
|
+
freeTier: config.freeTierPackage ?? {
|
|
53
|
+
packageId: 'free',
|
|
54
|
+
name: 'Free',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
const isLastAttempt = attempt === maxRetries;
|
|
61
|
+
if (isLastAttempt) {
|
|
62
|
+
console.error(`Failed to initialize RevenueCat after ${String(maxRetries + 1)} attempt(s). ` +
|
|
63
|
+
'Make sure @sudobility/subscription_lib is installed.', error);
|
|
64
|
+
config.onError?.(error);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const retryDelay = RC_RETRY_BASE_DELAY_MS * Math.pow(2, attempt);
|
|
68
|
+
console.warn(`RevenueCat initialization failed (attempt ${String(attempt + 1)}/${String(maxRetries + 1)}). ` +
|
|
69
|
+
`Retrying in ${String(retryDelay)}ms...`, error);
|
|
70
|
+
await delay(retryDelay);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
46
75
|
//# sourceMappingURL=initialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize/initialize.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,GAGtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,GAEtB,CAAC;
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize/initialize.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,GAGtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,GAEtB,CAAC;AAwFF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAA0B;IAE1B,MAAM,EACJ,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,aAAa,GACd,GAAG,OAAO,CAAC;IAGZ,wBAAwB,EAAE,CAAC;IAG3B,yBAAyB,CAAC,cAAc,CAAC,CAAC;IAG1C,MAAM,SAAS,GAAG,2BAA2B,EAAE,CAAC;IAKhD,wBAAwB,EAAE,CAAC;IAG3B,qBAAqB,EAAE,CAAC;IAGxB,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,MAAM,GA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gBACzB,CAAC,CAAC,MAAM,CAAC,MAAM;gBACf,CAAC,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,MAAM,CAAC;YAE1C,eAAe,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;YACnD,eAAe,CAAC,sBAAsB,CAAC;gBACrC,OAAO,EAAE,eAAe,CAAC,uBAAuB,EAAE;gBAClD,QAAQ,EAAE,MAAM,CAAC,eAAe,IAAI;oBAClC,SAAS,EAAE,MAAM;oBACjB,IAAI,EAAE,MAAM;iBACb;aACF,CAAC,CAAC;YAGH,OAAO;QACT,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,aAAa,GAAG,OAAO,KAAK,UAAU,CAAC;YAC7C,IAAI,aAAa,EAAE,CAAC;gBAClB,OAAO,CAAC,KAAK,CACX,yCAAyC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,eAAe;oBAC5E,sDAAsD,EACxD,KAAK,CACN,CAAC;gBACF,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACN,MAAM,UAAU,GAAG,sBAAsB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;gBACjE,OAAO,CAAC,IAAI,CACV,6CAA6C,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK;oBAC7F,eAAe,MAAM,CAAC,UAAU,CAAC,OAAO,EAC1C,KAAK,CACN,CAAC;gBACF,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,12 +1,66 @@
|
|
|
1
|
+
// =============================================================================
|
|
1
2
|
// Firebase Cloud Messaging Service Worker
|
|
2
|
-
//
|
|
3
|
+
// =============================================================================
|
|
4
|
+
//
|
|
5
|
+
// PURPOSE
|
|
6
|
+
// -------
|
|
7
|
+
// This worker runs in the background (even when the app tab is closed) and
|
|
8
|
+
// handles push notifications sent via Firebase Cloud Messaging (FCM). It is
|
|
9
|
+
// emitted into the build output by the Vite plugin (`serviceWorkerPlugin`) and
|
|
10
|
+
// **must be served from the root of the domain** (`/firebase-messaging-sw.js`)
|
|
11
|
+
// for FCM to recognise it.
|
|
12
|
+
//
|
|
13
|
+
// HOW TO CONFIGURE
|
|
14
|
+
// ----------------
|
|
15
|
+
// The `firebaseConfig` object below reads its values from `process.env.*`
|
|
16
|
+
// variables. In a Vite project these are typically defined as VITE_* env
|
|
17
|
+
// vars in a `.env` file (or in your CI environment):
|
|
18
|
+
//
|
|
19
|
+
// VITE_FIREBASE_API_KEY=AIza...
|
|
20
|
+
// VITE_FIREBASE_AUTH_DOMAIN=my-app.firebaseapp.com
|
|
21
|
+
// VITE_FIREBASE_PROJECT_ID=my-app
|
|
22
|
+
// VITE_FIREBASE_STORAGE_BUCKET=my-app.appspot.com
|
|
23
|
+
// VITE_FIREBASE_MESSAGING_SENDER_ID=123456789
|
|
24
|
+
// VITE_FIREBASE_APP_ID=1:123456789:web:abc123
|
|
25
|
+
// VITE_FIREBASE_MEASUREMENT_ID=G-XXXXXXX
|
|
26
|
+
//
|
|
27
|
+
// Because service workers cannot access `import.meta.env`, the values are
|
|
28
|
+
// injected at build time via the `serviceWorkerPlugin` Vite plugin (or any
|
|
29
|
+
// other build-time replacement tool such as `@rollup/plugin-replace`).
|
|
30
|
+
//
|
|
31
|
+
// If you are NOT using the Vite plugin you can manually replace the
|
|
32
|
+
// `process.env.VITE_*` references below with hard-coded strings matching
|
|
33
|
+
// your Firebase project. Make sure the values here match the ones used by
|
|
34
|
+
// your main application code.
|
|
35
|
+
//
|
|
36
|
+
// IMPORTANT NOTES
|
|
37
|
+
// ---------------
|
|
38
|
+
// - The Firebase compat SDK (`firebase-app-compat` and
|
|
39
|
+
// `firebase-messaging-compat`) is loaded via `importScripts` because
|
|
40
|
+
// service workers do not support ES module imports in all browsers.
|
|
41
|
+
// - The compat SDK version (10.7.1 below) should be kept in sync with the
|
|
42
|
+
// Firebase SDK version used by the main application.
|
|
43
|
+
// - The worker handles three event types:
|
|
44
|
+
// 1. `onBackgroundMessage` -- FCM-delivered push messages while the app
|
|
45
|
+
// is in the background.
|
|
46
|
+
// 2. `notificationclick` -- user taps/clicks a displayed notification.
|
|
47
|
+
// 3. `push` -- raw push events (usually handled by FCM automatically).
|
|
48
|
+
// - Notification actions ("View Email" / "Dismiss") and default routing
|
|
49
|
+
// (`/mail`) are customisable below.
|
|
50
|
+
// =============================================================================
|
|
3
51
|
|
|
4
|
-
//
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// 1. Import Firebase compat libraries
|
|
54
|
+
// These scripts expose a global `firebase` object in the SW scope.
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
5
56
|
importScripts('https://www.gstatic.com/firebasejs/10.7.1/firebase-app-compat.js');
|
|
6
57
|
importScripts('https://www.gstatic.com/firebasejs/10.7.1/firebase-messaging-compat.js');
|
|
7
58
|
|
|
8
|
-
//
|
|
9
|
-
//
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// 2. Firebase configuration
|
|
61
|
+
// Values are injected at build time from process.env. See the "HOW TO
|
|
62
|
+
// CONFIGURE" section above for instructions.
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
10
64
|
const firebaseConfig = {
|
|
11
65
|
apiKey: process.env.VITE_FIREBASE_API_KEY,
|
|
12
66
|
authDomain: process.env.VITE_FIREBASE_AUTH_DOMAIN,
|
|
@@ -17,27 +71,43 @@ const firebaseConfig = {
|
|
|
17
71
|
measurementId: process.env.VITE_FIREBASE_MEASUREMENT_ID,
|
|
18
72
|
};
|
|
19
73
|
|
|
20
|
-
//
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// 3. Initialise Firebase (only once -- guard against duplicate initialisation)
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
21
77
|
if (!firebase.apps.length) {
|
|
22
78
|
firebase.initializeApp(firebaseConfig);
|
|
23
79
|
}
|
|
24
80
|
|
|
25
|
-
//
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// 4. Get the Firebase Cloud Messaging instance
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
26
84
|
const messaging = firebase.messaging();
|
|
27
85
|
|
|
28
|
-
//
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// 5. Handle background messages
|
|
88
|
+
// This callback fires when the app is in the background or the tab is
|
|
89
|
+
// closed and an FCM message arrives. Foreground messages are handled by
|
|
90
|
+
// the main app via `onMessage()` from `firebase/messaging`.
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
29
92
|
messaging.onBackgroundMessage(payload => {
|
|
93
|
+
// Extract notification title and body from the FCM payload, falling back
|
|
94
|
+
// to sensible defaults if the fields are missing.
|
|
30
95
|
const notificationTitle = payload.notification?.title || 'New Email';
|
|
31
96
|
const notificationOptions = {
|
|
32
97
|
body: payload.notification?.body || 'You have received a new email',
|
|
33
98
|
icon: '/favicon.ico',
|
|
34
99
|
badge: '/favicon.ico',
|
|
100
|
+
// `tag` groups notifications -- only one notification with the same tag
|
|
101
|
+
// is shown at a time (newer ones replace older ones).
|
|
35
102
|
tag: 'email-notification',
|
|
103
|
+
// Arbitrary data attached to the notification for use in click handlers.
|
|
36
104
|
data: {
|
|
37
105
|
url: payload.data?.url || '/mail',
|
|
38
106
|
emailId: payload.data?.emailId,
|
|
39
107
|
timestamp: Date.now(),
|
|
40
108
|
},
|
|
109
|
+
// Action buttons displayed alongside the notification (support varies
|
|
110
|
+
// by platform; ignored on platforms that don't support actions).
|
|
41
111
|
actions: [
|
|
42
112
|
{
|
|
43
113
|
action: 'view',
|
|
@@ -49,20 +119,27 @@ messaging.onBackgroundMessage(payload => {
|
|
|
49
119
|
title: 'Dismiss',
|
|
50
120
|
},
|
|
51
121
|
],
|
|
122
|
+
// Keep the notification visible until the user explicitly interacts
|
|
123
|
+
// with it (not all platforms honour this).
|
|
52
124
|
requireInteraction: true,
|
|
125
|
+
// Play the default notification sound.
|
|
53
126
|
silent: false,
|
|
54
127
|
};
|
|
55
128
|
|
|
56
|
-
//
|
|
129
|
+
// Display the notification via the Service Worker registration.
|
|
57
130
|
self.registration.showNotification(notificationTitle, notificationOptions);
|
|
58
131
|
});
|
|
59
132
|
|
|
60
|
-
//
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
// 6. Handle notification click events
|
|
135
|
+
// Determines which action the user selected and routes accordingly.
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
61
137
|
self.addEventListener('notificationclick', event => {
|
|
138
|
+
// Close the notification regardless of the action taken.
|
|
62
139
|
event.notification.close();
|
|
63
140
|
|
|
64
141
|
if (event.action === 'view') {
|
|
65
|
-
//
|
|
142
|
+
// "View Email" action -- navigate to the URL stored in notification data.
|
|
66
143
|
const urlToOpen = event.notification.data?.url || '/mail';
|
|
67
144
|
|
|
68
145
|
event.waitUntil(
|
|
@@ -72,7 +149,7 @@ self.addEventListener('notificationclick', event => {
|
|
|
72
149
|
includeUncontrolled: true,
|
|
73
150
|
})
|
|
74
151
|
.then(clientList => {
|
|
75
|
-
//
|
|
152
|
+
// If the app is already open in a tab, focus and navigate it.
|
|
76
153
|
for (const client of clientList) {
|
|
77
154
|
if (client.url.includes(self.location.origin)) {
|
|
78
155
|
client.focus();
|
|
@@ -81,28 +158,35 @@ self.addEventListener('notificationclick', event => {
|
|
|
81
158
|
}
|
|
82
159
|
}
|
|
83
160
|
|
|
84
|
-
//
|
|
161
|
+
// Otherwise open a new browser window/tab.
|
|
85
162
|
if (clients.openWindow) {
|
|
86
163
|
return clients.openWindow(urlToOpen);
|
|
87
164
|
}
|
|
88
165
|
})
|
|
89
166
|
);
|
|
90
167
|
} else if (event.action === 'dismiss') {
|
|
91
|
-
//
|
|
168
|
+
// "Dismiss" action -- nothing to do; the notification is already closed.
|
|
92
169
|
}
|
|
93
170
|
});
|
|
94
171
|
|
|
95
|
-
//
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
// 7. Handle notification close events (swipe-away / manual dismiss)
|
|
174
|
+
// Currently a no-op. Add analytics or cleanup logic here if needed.
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
96
176
|
self.addEventListener('notificationclose', event => {
|
|
97
|
-
// Notification closed
|
|
177
|
+
// Notification was closed by the user without tapping an action.
|
|
98
178
|
});
|
|
99
179
|
|
|
100
|
-
//
|
|
180
|
+
// ---------------------------------------------------------------------------
|
|
181
|
+
// 8. Handle raw push events (custom push server, not FCM)
|
|
182
|
+
// FCM messages are handled automatically by `onBackgroundMessage` above.
|
|
183
|
+
// This handler is a catch-all for non-FCM push payloads.
|
|
184
|
+
// ---------------------------------------------------------------------------
|
|
101
185
|
self.addEventListener('push', event => {
|
|
102
186
|
if (event.data) {
|
|
103
187
|
const data = event.data.json();
|
|
104
188
|
|
|
105
|
-
//
|
|
106
|
-
//
|
|
189
|
+
// Process custom (non-FCM) push payloads here if needed.
|
|
190
|
+
// For standard FCM usage this handler is unused.
|
|
107
191
|
}
|
|
108
192
|
});
|
package/dist/sw/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { registerServiceWorker, unregisterServiceWorker } from './register.js';
|
|
1
|
+
export { registerServiceWorker, unregisterServiceWorker, type ServiceWorkerState, type RegisterServiceWorkerOptions, } from './register.js';
|
|
2
2
|
export { serviceWorkerPlugin, type ServiceWorkerPluginOptions, } from './vite-plugin-service-worker.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/sw/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sw/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sw/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,4BAA4B,GAClC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,GAChC,MAAM,iCAAiC,CAAC"}
|
package/dist/sw/index.js
CHANGED
package/dist/sw/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sw/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sw/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GAGxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,GAEpB,MAAM,iCAAiC,CAAC"}
|
package/dist/sw/register.d.ts
CHANGED
|
@@ -3,6 +3,12 @@ declare global {
|
|
|
3
3
|
readonly env: Record<string, string | boolean | undefined>;
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type ServiceWorkerState = 'registering' | 'registered' | 'update-available' | 'error' | 'unsupported' | 'insecure-context';
|
|
7
|
+
export interface RegisterServiceWorkerOptions {
|
|
8
|
+
onStateChange?: (state: ServiceWorkerState) => void;
|
|
9
|
+
maxRetries?: number;
|
|
10
|
+
forceEnable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function registerServiceWorker(options?: RegisterServiceWorkerOptions): void;
|
|
13
|
+
export declare function unregisterServiceWorker(): Promise<boolean>;
|
|
8
14
|
//# sourceMappingURL=register.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/sw/register.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/sw/register.ts"],"names":[],"mappings":"AAgCA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;KAC5D;CACF;AAYD,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,YAAY,GACZ,kBAAkB,GAClB,OAAO,GACP,aAAa,GACb,kBAAkB,CAAC;AAKvB,MAAM,WAAW,4BAA4B;IAM3C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAQpD,UAAU,CAAC,EAAE,MAAM,CAAC;IAQpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAsDD,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,4BAAiC,GACzC,IAAI,CAwCN;AAiFD,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAMhE"}
|
package/dist/sw/register.js
CHANGED
|
@@ -1,36 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
const DEFAULT_MAX_RETRIES = 3;
|
|
2
|
+
const RETRY_BASE_DELAY_MS = 1000;
|
|
3
|
+
const UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
4
|
+
function isProductionEnv() {
|
|
5
|
+
try {
|
|
6
|
+
return !!import.meta.env['PROD'];
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function registerServiceWorker(options = {}) {
|
|
13
|
+
const { onStateChange, maxRetries = DEFAULT_MAX_RETRIES, forceEnable, } = options;
|
|
14
|
+
const isEnabled = forceEnable ?? isProductionEnv();
|
|
15
|
+
if (!isEnabled) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (!('serviceWorker' in navigator)) {
|
|
19
|
+
onStateChange?.('unsupported');
|
|
20
|
+
console.warn('Service worker registration skipped: navigator.serviceWorker is not available.');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (typeof window !== 'undefined' &&
|
|
24
|
+
window.location.protocol !== 'https:' &&
|
|
25
|
+
window.location.hostname !== 'localhost' &&
|
|
26
|
+
window.location.hostname !== '127.0.0.1') {
|
|
27
|
+
onStateChange?.('insecure-context');
|
|
28
|
+
console.warn('Service worker registration skipped: page is not served over HTTPS.');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
window.addEventListener('load', () => {
|
|
32
|
+
onStateChange?.('registering');
|
|
33
|
+
attemptRegistration(0, maxRetries, onStateChange);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function attemptRegistration(attempt, maxRetries, onStateChange) {
|
|
37
|
+
try {
|
|
38
|
+
const registration = await navigator.serviceWorker.register('/sw.js', {
|
|
39
|
+
scope: '/',
|
|
40
|
+
});
|
|
41
|
+
onStateChange?.('registered');
|
|
42
|
+
setInterval(() => {
|
|
43
|
+
registration.update();
|
|
44
|
+
}, UPDATE_CHECK_INTERVAL_MS);
|
|
45
|
+
registration.addEventListener('updatefound', () => {
|
|
46
|
+
const newWorker = registration.installing;
|
|
47
|
+
if (newWorker) {
|
|
48
|
+
newWorker.addEventListener('statechange', () => {
|
|
49
|
+
if (newWorker.state === 'installed' &&
|
|
50
|
+
navigator.serviceWorker.controller) {
|
|
51
|
+
onStateChange?.('update-available');
|
|
52
|
+
console.info('New content available, refresh to update');
|
|
20
53
|
}
|
|
21
54
|
});
|
|
22
55
|
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error('Service worker registration failed:', error);
|
|
25
|
-
}
|
|
26
56
|
});
|
|
27
57
|
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
onStateChange?.('error');
|
|
60
|
+
if (attempt < maxRetries) {
|
|
61
|
+
const delay = RETRY_BASE_DELAY_MS * Math.pow(2, attempt);
|
|
62
|
+
console.warn(`Service worker registration failed (attempt ${String(attempt + 1)}/${String(maxRetries + 1)}). ` +
|
|
63
|
+
`Retrying in ${String(delay)}ms...`, error);
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
attemptRegistration(attempt + 1, maxRetries, onStateChange);
|
|
66
|
+
}, delay);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
console.error(`Service worker registration failed after ${String(maxRetries + 1)} attempts:`, error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
28
72
|
}
|
|
29
|
-
export function unregisterServiceWorker() {
|
|
30
|
-
if ('serviceWorker' in navigator) {
|
|
31
|
-
|
|
32
|
-
registration.unregister();
|
|
33
|
-
});
|
|
73
|
+
export async function unregisterServiceWorker() {
|
|
74
|
+
if (!('serviceWorker' in navigator)) {
|
|
75
|
+
return false;
|
|
34
76
|
}
|
|
77
|
+
const registration = await navigator.serviceWorker.ready;
|
|
78
|
+
return registration.unregister();
|
|
35
79
|
}
|
|
36
80
|
//# sourceMappingURL=register.js.map
|
package/dist/sw/register.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/sw/register.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/sw/register.ts"],"names":[],"mappings":"AAqFA,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAG9B,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAGjC,MAAM,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAOrD,SAAS,eAAe;IACtB,IAAI,CAAC;QACH,OAAO,CAAC,CAAE,MAAM,CAAC,IAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;A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AAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,IAAI,CAAC,CAAC,eAAe,IAAI,SAAS,CAAC,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC;IACzD,OAAO,YAAY,CAAC,UAAU,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-service-worker.d.ts","sourceRoot":"","sources":["../../src/sw/vite-plugin-service-worker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite-plugin-service-worker.d.ts","sourceRoot":"","sources":["../../src/sw/vite-plugin-service-worker.ts"],"names":[],"mappings":"AAiDA,MAAM,WAAW,0BAA0B;IAQzC,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAwBD,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,0BAA+B;;4BAkBhD,GAAG;;EAgE9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-service-worker.js","sourceRoot":"","sources":["../../src/sw/vite-plugin-service-worker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite-plugin-service-worker.js","sourceRoot":"","sources":["../../src/sw/vite-plugin-service-worker.ts"],"names":[],"mappings":"AA0CA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAsCpC,MAAM,UAAU,mBAAmB,CAAC,UAAsC,EAAE;IAC1E,MAAM,EAAE,wBAAwB,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAGrD,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,MAAM,MAAM,GA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