@firebase/messaging-compat 0.2.13 → 0.2.14
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/esm/index.esm2017.js +120 -120
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/esm/src/index.d.ts +31 -31
- package/dist/esm/src/messaging-compat.d.ts +41 -41
- package/dist/esm/src/registerMessagingCompat.d.ts +23 -23
- package/dist/esm/test/fakes.d.ts +20 -20
- package/dist/esm/test/messaging-compat.test.d.ts +17 -17
- package/dist/index.cjs.js +120 -120
- package/dist/index.cjs.js.map +1 -1
- package/dist/src/index.d.ts +31 -31
- package/dist/src/messaging-compat.d.ts +41 -41
- package/dist/src/registerMessagingCompat.d.ts +23 -23
- package/dist/test/fakes.d.ts +20 -20
- package/dist/test/messaging-compat.test.d.ts +17 -17
- package/package.json +6 -6
|
@@ -5,130 +5,130 @@ import { isIndexedDBAvailable, areCookiesEnabled } from '@firebase/util';
|
|
|
5
5
|
import { onBackgroundMessage } from '@firebase/messaging/sw';
|
|
6
6
|
|
|
7
7
|
const name = "@firebase/messaging-compat";
|
|
8
|
-
const version = "0.2.
|
|
8
|
+
const version = "0.2.14";
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* @license
|
|
12
|
-
* Copyright 2020 Google LLC
|
|
13
|
-
*
|
|
14
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
-
* you may not use this file except in compliance with the License.
|
|
16
|
-
* You may obtain a copy of the License at
|
|
17
|
-
*
|
|
18
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
*
|
|
20
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
-
* See the License for the specific language governing permissions and
|
|
24
|
-
* limitations under the License.
|
|
25
|
-
*/
|
|
26
|
-
function isSupported() {
|
|
27
|
-
if (self && 'ServiceWorkerGlobalScope' in self) {
|
|
28
|
-
// Running in ServiceWorker context
|
|
29
|
-
return isSwSupported();
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// Assume we are in the window context.
|
|
33
|
-
return isWindowSupported();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Checks to see if the required APIs exist.
|
|
38
|
-
* Unlike the modular version, it does not check if IndexedDB.open() is allowed
|
|
39
|
-
* in order to keep isSupported() synchronous and maintain v8 compatibility.
|
|
40
|
-
*/
|
|
41
|
-
function isWindowSupported() {
|
|
42
|
-
return (typeof window !== 'undefined' &&
|
|
43
|
-
isIndexedDBAvailable() &&
|
|
44
|
-
areCookiesEnabled() &&
|
|
45
|
-
'serviceWorker' in navigator &&
|
|
46
|
-
'PushManager' in window &&
|
|
47
|
-
'Notification' in window &&
|
|
48
|
-
'fetch' in window &&
|
|
49
|
-
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
|
|
50
|
-
PushSubscription.prototype.hasOwnProperty('getKey'));
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Checks to see if the required APIs exist within SW Context.
|
|
54
|
-
*/
|
|
55
|
-
function isSwSupported() {
|
|
56
|
-
return (isIndexedDBAvailable() &&
|
|
57
|
-
'PushManager' in self &&
|
|
58
|
-
'Notification' in self &&
|
|
59
|
-
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
|
|
60
|
-
PushSubscription.prototype.hasOwnProperty('getKey'));
|
|
61
|
-
}
|
|
62
|
-
class MessagingCompatImpl {
|
|
63
|
-
constructor(app, _delegate) {
|
|
64
|
-
this.app = app;
|
|
65
|
-
this._delegate = _delegate;
|
|
66
|
-
this.app = app;
|
|
67
|
-
this._delegate = _delegate;
|
|
68
|
-
}
|
|
69
|
-
async getToken(options) {
|
|
70
|
-
return getToken(this._delegate, options);
|
|
71
|
-
}
|
|
72
|
-
async deleteToken() {
|
|
73
|
-
return deleteToken(this._delegate);
|
|
74
|
-
}
|
|
75
|
-
onMessage(nextOrObserver) {
|
|
76
|
-
return onMessage(this._delegate, nextOrObserver);
|
|
77
|
-
}
|
|
78
|
-
onBackgroundMessage(nextOrObserver) {
|
|
79
|
-
return onBackgroundMessage(this._delegate, nextOrObserver);
|
|
80
|
-
}
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright 2020 Google LLC
|
|
13
|
+
*
|
|
14
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
+
* you may not use this file except in compliance with the License.
|
|
16
|
+
* You may obtain a copy of the License at
|
|
17
|
+
*
|
|
18
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
+
* See the License for the specific language governing permissions and
|
|
24
|
+
* limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
function isSupported() {
|
|
27
|
+
if (self && 'ServiceWorkerGlobalScope' in self) {
|
|
28
|
+
// Running in ServiceWorker context
|
|
29
|
+
return isSwSupported();
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// Assume we are in the window context.
|
|
33
|
+
return isWindowSupported();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Checks to see if the required APIs exist.
|
|
38
|
+
* Unlike the modular version, it does not check if IndexedDB.open() is allowed
|
|
39
|
+
* in order to keep isSupported() synchronous and maintain v8 compatibility.
|
|
40
|
+
*/
|
|
41
|
+
function isWindowSupported() {
|
|
42
|
+
return (typeof window !== 'undefined' &&
|
|
43
|
+
isIndexedDBAvailable() &&
|
|
44
|
+
areCookiesEnabled() &&
|
|
45
|
+
'serviceWorker' in navigator &&
|
|
46
|
+
'PushManager' in window &&
|
|
47
|
+
'Notification' in window &&
|
|
48
|
+
'fetch' in window &&
|
|
49
|
+
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
|
|
50
|
+
PushSubscription.prototype.hasOwnProperty('getKey'));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Checks to see if the required APIs exist within SW Context.
|
|
54
|
+
*/
|
|
55
|
+
function isSwSupported() {
|
|
56
|
+
return (isIndexedDBAvailable() &&
|
|
57
|
+
'PushManager' in self &&
|
|
58
|
+
'Notification' in self &&
|
|
59
|
+
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
|
|
60
|
+
PushSubscription.prototype.hasOwnProperty('getKey'));
|
|
61
|
+
}
|
|
62
|
+
class MessagingCompatImpl {
|
|
63
|
+
constructor(app, _delegate) {
|
|
64
|
+
this.app = app;
|
|
65
|
+
this._delegate = _delegate;
|
|
66
|
+
this.app = app;
|
|
67
|
+
this._delegate = _delegate;
|
|
68
|
+
}
|
|
69
|
+
async getToken(options) {
|
|
70
|
+
return getToken(this._delegate, options);
|
|
71
|
+
}
|
|
72
|
+
async deleteToken() {
|
|
73
|
+
return deleteToken(this._delegate);
|
|
74
|
+
}
|
|
75
|
+
onMessage(nextOrObserver) {
|
|
76
|
+
return onMessage(this._delegate, nextOrObserver);
|
|
77
|
+
}
|
|
78
|
+
onBackgroundMessage(nextOrObserver) {
|
|
79
|
+
return onBackgroundMessage(this._delegate, nextOrObserver);
|
|
80
|
+
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* @license
|
|
85
|
-
* Copyright 2020 Google LLC
|
|
86
|
-
*
|
|
87
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
88
|
-
* you may not use this file except in compliance with the License.
|
|
89
|
-
* You may obtain a copy of the License at
|
|
90
|
-
*
|
|
91
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
92
|
-
*
|
|
93
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
94
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
95
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
96
|
-
* See the License for the specific language governing permissions and
|
|
97
|
-
* limitations under the License.
|
|
98
|
-
*/
|
|
99
|
-
const messagingCompatFactory = (container) => {
|
|
100
|
-
if (self && 'ServiceWorkerGlobalScope' in self) {
|
|
101
|
-
// in sw
|
|
102
|
-
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-sw').getImmediate());
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
// in window
|
|
106
|
-
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging').getImmediate());
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const NAMESPACE_EXPORTS = {
|
|
110
|
-
isSupported
|
|
111
|
-
};
|
|
112
|
-
function registerMessagingCompat() {
|
|
113
|
-
firebase.INTERNAL.registerComponent(new Component('messaging-compat', messagingCompatFactory, "PUBLIC" /* ComponentType.PUBLIC */).setServiceProps(NAMESPACE_EXPORTS));
|
|
83
|
+
/**
|
|
84
|
+
* @license
|
|
85
|
+
* Copyright 2020 Google LLC
|
|
86
|
+
*
|
|
87
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
88
|
+
* you may not use this file except in compliance with the License.
|
|
89
|
+
* You may obtain a copy of the License at
|
|
90
|
+
*
|
|
91
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
92
|
+
*
|
|
93
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
94
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
95
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
96
|
+
* See the License for the specific language governing permissions and
|
|
97
|
+
* limitations under the License.
|
|
98
|
+
*/
|
|
99
|
+
const messagingCompatFactory = (container) => {
|
|
100
|
+
if (self && 'ServiceWorkerGlobalScope' in self) {
|
|
101
|
+
// in sw
|
|
102
|
+
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-sw').getImmediate());
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// in window
|
|
106
|
+
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging').getImmediate());
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const NAMESPACE_EXPORTS = {
|
|
110
|
+
isSupported
|
|
111
|
+
};
|
|
112
|
+
function registerMessagingCompat() {
|
|
113
|
+
firebase.INTERNAL.registerComponent(new Component('messaging-compat', messagingCompatFactory, "PUBLIC" /* ComponentType.PUBLIC */).setServiceProps(NAMESPACE_EXPORTS));
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
/**
|
|
117
|
-
* @license
|
|
118
|
-
* Copyright 2020 Google LLC
|
|
119
|
-
*
|
|
120
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
121
|
-
* you may not use this file except in compliance with the License.
|
|
122
|
-
* You may obtain a copy of the License at
|
|
123
|
-
*
|
|
124
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
125
|
-
*
|
|
126
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
127
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
128
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
129
|
-
* See the License for the specific language governing permissions and
|
|
130
|
-
* limitations under the License.
|
|
131
|
-
*/
|
|
132
|
-
registerMessagingCompat();
|
|
116
|
+
/**
|
|
117
|
+
* @license
|
|
118
|
+
* Copyright 2020 Google LLC
|
|
119
|
+
*
|
|
120
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
121
|
+
* you may not use this file except in compliance with the License.
|
|
122
|
+
* You may obtain a copy of the License at
|
|
123
|
+
*
|
|
124
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
125
|
+
*
|
|
126
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
127
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
128
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
129
|
+
* See the License for the specific language governing permissions and
|
|
130
|
+
* limitations under the License.
|
|
131
|
+
*/
|
|
132
|
+
registerMessagingCompat();
|
|
133
133
|
firebase.registerVersion(name, version);
|
|
134
134
|
//# sourceMappingURL=index.esm2017.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm2017.js","sources":["../../src/messaging-compat.ts","../../src/registerMessagingCompat.ts","../../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FirebaseApp as AppCompat,\n _FirebaseService\n} from '@firebase/app-compat';\nimport {\n Messaging,\n MessagePayload,\n deleteToken,\n getToken,\n onMessage\n} from '@firebase/messaging';\nimport {\n areCookiesEnabled,\n isIndexedDBAvailable,\n NextFn,\n Observer,\n Unsubscribe\n} from '@firebase/util';\n\nimport { onBackgroundMessage } from '@firebase/messaging/sw';\n\nexport interface MessagingCompat {\n getToken(options?: {\n vapidKey?: string;\n serviceWorkerRegistration?: ServiceWorkerRegistration;\n }): Promise<string>;\n\n deleteToken(): Promise<boolean>;\n\n onMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe;\n\n onBackgroundMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe;\n}\n\nexport function isSupported(): boolean {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n // Running in ServiceWorker context\n return isSwSupported();\n } else {\n // Assume we are in the window context.\n return isWindowSupported();\n }\n}\n\n/**\n * Checks to see if the required APIs exist.\n * Unlike the modular version, it does not check if IndexedDB.open() is allowed\n * in order to keep isSupported() synchronous and maintain v8 compatibility.\n */\nfunction isWindowSupported(): boolean {\n return (\n typeof window !== 'undefined' &&\n isIndexedDBAvailable() &&\n areCookiesEnabled() &&\n 'serviceWorker' in navigator &&\n 'PushManager' in window &&\n 'Notification' in window &&\n 'fetch' in window &&\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n PushSubscription.prototype.hasOwnProperty('getKey')\n );\n}\n\n/**\n * Checks to see if the required APIs exist within SW Context.\n */\nfunction isSwSupported(): boolean {\n return (\n isIndexedDBAvailable() &&\n 'PushManager' in self &&\n 'Notification' in self &&\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n PushSubscription.prototype.hasOwnProperty('getKey')\n );\n}\n\nexport class MessagingCompatImpl implements MessagingCompat, _FirebaseService {\n constructor(readonly app: AppCompat, readonly _delegate: Messaging) {\n this.app = app;\n this._delegate = _delegate;\n }\n\n async getToken(options?: {\n vapidKey?: string;\n serviceWorkerRegistration?: ServiceWorkerRegistration;\n }): Promise<string> {\n return getToken(this._delegate, options);\n }\n\n async deleteToken(): Promise<boolean> {\n return deleteToken(this._delegate);\n }\n\n onMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe {\n return onMessage(this._delegate, nextOrObserver);\n }\n\n onBackgroundMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe {\n return onBackgroundMessage(this._delegate, nextOrObserver);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Component,\n ComponentContainer,\n ComponentType,\n InstanceFactory\n} from '@firebase/component';\nimport { MessagingCompatImpl, isSupported } from './messaging-compat';\nimport firebase, { _FirebaseNamespace } from '@firebase/app-compat';\n\ndeclare module '@firebase/component' {\n interface NameServiceMapping {\n 'messaging-compat': MessagingCompatImpl;\n }\n}\n\nconst messagingCompatFactory: InstanceFactory<'messaging-compat'> = (\n container: ComponentContainer\n) => {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n // in sw\n return new MessagingCompatImpl(\n container.getProvider('app-compat').getImmediate(),\n container.getProvider('messaging-sw').getImmediate()\n );\n } else {\n // in window\n return new MessagingCompatImpl(\n container.getProvider('app-compat').getImmediate(),\n container.getProvider('messaging').getImmediate()\n );\n }\n};\n\nconst NAMESPACE_EXPORTS = {\n isSupported\n};\n\nexport function registerMessagingCompat(): void {\n (firebase as _FirebaseNamespace).INTERNAL.registerComponent(\n new Component(\n 'messaging-compat',\n messagingCompatFactory,\n ComponentType.PUBLIC\n ).setServiceProps(NAMESPACE_EXPORTS)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { name, version } from '../package.json';\n\nimport firebase from '@firebase/app-compat';\nimport { registerMessagingCompat } from './registerMessagingCompat';\nimport { MessagingCompat } from './messaging-compat';\n\nregisterMessagingCompat();\nfirebase.registerVersion(name, version);\n\n/**\n * Define extension behavior of `registerMessaging`\n */\ndeclare module '@firebase/app-compat' {\n interface FirebaseNamespace {\n messaging: {\n (app?: FirebaseApp): MessagingCompat;\n isSupported(): boolean;\n };\n }\n interface FirebaseApp {\n messaging(): MessagingCompat;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;SAwCa,WAAW,GAAA;AACzB,IAAA,IAAI,IAAI,IAAI,0BAA0B,IAAI,IAAI,EAAE;;QAE9C,OAAO,aAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.esm2017.js","sources":["../../src/messaging-compat.ts","../../src/registerMessagingCompat.ts","../../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FirebaseApp as AppCompat,\n _FirebaseService\n} from '@firebase/app-compat';\nimport {\n Messaging,\n MessagePayload,\n deleteToken,\n getToken,\n onMessage\n} from '@firebase/messaging';\nimport {\n areCookiesEnabled,\n isIndexedDBAvailable,\n NextFn,\n Observer,\n Unsubscribe\n} from '@firebase/util';\n\nimport { onBackgroundMessage } from '@firebase/messaging/sw';\n\nexport interface MessagingCompat {\n getToken(options?: {\n vapidKey?: string;\n serviceWorkerRegistration?: ServiceWorkerRegistration;\n }): Promise<string>;\n\n deleteToken(): Promise<boolean>;\n\n onMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe;\n\n onBackgroundMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe;\n}\n\nexport function isSupported(): boolean {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n // Running in ServiceWorker context\n return isSwSupported();\n } else {\n // Assume we are in the window context.\n return isWindowSupported();\n }\n}\n\n/**\n * Checks to see if the required APIs exist.\n * Unlike the modular version, it does not check if IndexedDB.open() is allowed\n * in order to keep isSupported() synchronous and maintain v8 compatibility.\n */\nfunction isWindowSupported(): boolean {\n return (\n typeof window !== 'undefined' &&\n isIndexedDBAvailable() &&\n areCookiesEnabled() &&\n 'serviceWorker' in navigator &&\n 'PushManager' in window &&\n 'Notification' in window &&\n 'fetch' in window &&\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n PushSubscription.prototype.hasOwnProperty('getKey')\n );\n}\n\n/**\n * Checks to see if the required APIs exist within SW Context.\n */\nfunction isSwSupported(): boolean {\n return (\n isIndexedDBAvailable() &&\n 'PushManager' in self &&\n 'Notification' in self &&\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n PushSubscription.prototype.hasOwnProperty('getKey')\n );\n}\n\nexport class MessagingCompatImpl implements MessagingCompat, _FirebaseService {\n constructor(readonly app: AppCompat, readonly _delegate: Messaging) {\n this.app = app;\n this._delegate = _delegate;\n }\n\n async getToken(options?: {\n vapidKey?: string;\n serviceWorkerRegistration?: ServiceWorkerRegistration;\n }): Promise<string> {\n return getToken(this._delegate, options);\n }\n\n async deleteToken(): Promise<boolean> {\n return deleteToken(this._delegate);\n }\n\n onMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe {\n return onMessage(this._delegate, nextOrObserver);\n }\n\n onBackgroundMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe {\n return onBackgroundMessage(this._delegate, nextOrObserver);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Component,\n ComponentContainer,\n ComponentType,\n InstanceFactory\n} from '@firebase/component';\nimport { MessagingCompatImpl, isSupported } from './messaging-compat';\nimport firebase, { _FirebaseNamespace } from '@firebase/app-compat';\n\ndeclare module '@firebase/component' {\n interface NameServiceMapping {\n 'messaging-compat': MessagingCompatImpl;\n }\n}\n\nconst messagingCompatFactory: InstanceFactory<'messaging-compat'> = (\n container: ComponentContainer\n) => {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n // in sw\n return new MessagingCompatImpl(\n container.getProvider('app-compat').getImmediate(),\n container.getProvider('messaging-sw').getImmediate()\n );\n } else {\n // in window\n return new MessagingCompatImpl(\n container.getProvider('app-compat').getImmediate(),\n container.getProvider('messaging').getImmediate()\n );\n }\n};\n\nconst NAMESPACE_EXPORTS = {\n isSupported\n};\n\nexport function registerMessagingCompat(): void {\n (firebase as _FirebaseNamespace).INTERNAL.registerComponent(\n new Component(\n 'messaging-compat',\n messagingCompatFactory,\n ComponentType.PUBLIC\n ).setServiceProps(NAMESPACE_EXPORTS)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { name, version } from '../package.json';\n\nimport firebase from '@firebase/app-compat';\nimport { registerMessagingCompat } from './registerMessagingCompat';\nimport { MessagingCompat } from './messaging-compat';\n\nregisterMessagingCompat();\nfirebase.registerVersion(name, version);\n\n/**\n * Define extension behavior of `registerMessaging`\n */\ndeclare module '@firebase/app-compat' {\n interface FirebaseNamespace {\n messaging: {\n (app?: FirebaseApp): MessagingCompat;\n isSupported(): boolean;\n };\n }\n interface FirebaseApp {\n messaging(): MessagingCompat;\n }\n}\n"],"names":[],"mappings":"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"}
|
package/dist/esm/src/index.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { MessagingCompat } from './messaging-compat';
|
|
18
|
-
/**
|
|
19
|
-
* Define extension behavior of `registerMessaging`
|
|
20
|
-
*/
|
|
21
|
-
declare module '@firebase/app-compat' {
|
|
22
|
-
interface FirebaseNamespace {
|
|
23
|
-
messaging: {
|
|
24
|
-
(app?: FirebaseApp): MessagingCompat;
|
|
25
|
-
isSupported(): boolean;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
interface FirebaseApp {
|
|
29
|
-
messaging(): MessagingCompat;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { MessagingCompat } from './messaging-compat';
|
|
18
|
+
/**
|
|
19
|
+
* Define extension behavior of `registerMessaging`
|
|
20
|
+
*/
|
|
21
|
+
declare module '@firebase/app-compat' {
|
|
22
|
+
interface FirebaseNamespace {
|
|
23
|
+
messaging: {
|
|
24
|
+
(app?: FirebaseApp): MessagingCompat;
|
|
25
|
+
isSupported(): boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface FirebaseApp {
|
|
29
|
+
messaging(): MessagingCompat;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { FirebaseApp as AppCompat, _FirebaseService } from '@firebase/app-compat';
|
|
18
|
-
import { Messaging, MessagePayload } from '@firebase/messaging';
|
|
19
|
-
import { NextFn, Observer, Unsubscribe } from '@firebase/util';
|
|
20
|
-
export interface MessagingCompat {
|
|
21
|
-
getToken(options?: {
|
|
22
|
-
vapidKey?: string;
|
|
23
|
-
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
24
|
-
}): Promise<string>;
|
|
25
|
-
deleteToken(): Promise<boolean>;
|
|
26
|
-
onMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
27
|
-
onBackgroundMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
28
|
-
}
|
|
29
|
-
export declare function isSupported(): boolean;
|
|
30
|
-
export declare class MessagingCompatImpl implements MessagingCompat, _FirebaseService {
|
|
31
|
-
readonly app: AppCompat;
|
|
32
|
-
readonly _delegate: Messaging;
|
|
33
|
-
constructor(app: AppCompat, _delegate: Messaging);
|
|
34
|
-
getToken(options?: {
|
|
35
|
-
vapidKey?: string;
|
|
36
|
-
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
37
|
-
}): Promise<string>;
|
|
38
|
-
deleteToken(): Promise<boolean>;
|
|
39
|
-
onMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
40
|
-
onBackgroundMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
41
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp as AppCompat, _FirebaseService } from '@firebase/app-compat';
|
|
18
|
+
import { Messaging, MessagePayload } from '@firebase/messaging';
|
|
19
|
+
import { NextFn, Observer, Unsubscribe } from '@firebase/util';
|
|
20
|
+
export interface MessagingCompat {
|
|
21
|
+
getToken(options?: {
|
|
22
|
+
vapidKey?: string;
|
|
23
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
24
|
+
}): Promise<string>;
|
|
25
|
+
deleteToken(): Promise<boolean>;
|
|
26
|
+
onMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
27
|
+
onBackgroundMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
28
|
+
}
|
|
29
|
+
export declare function isSupported(): boolean;
|
|
30
|
+
export declare class MessagingCompatImpl implements MessagingCompat, _FirebaseService {
|
|
31
|
+
readonly app: AppCompat;
|
|
32
|
+
readonly _delegate: Messaging;
|
|
33
|
+
constructor(app: AppCompat, _delegate: Messaging);
|
|
34
|
+
getToken(options?: {
|
|
35
|
+
vapidKey?: string;
|
|
36
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
37
|
+
}): Promise<string>;
|
|
38
|
+
deleteToken(): Promise<boolean>;
|
|
39
|
+
onMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
40
|
+
onBackgroundMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
41
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { MessagingCompatImpl } from './messaging-compat';
|
|
18
|
-
declare module '@firebase/component' {
|
|
19
|
-
interface NameServiceMapping {
|
|
20
|
-
'messaging-compat': MessagingCompatImpl;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export declare function registerMessagingCompat(): void;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { MessagingCompatImpl } from './messaging-compat';
|
|
18
|
+
declare module '@firebase/component' {
|
|
19
|
+
interface NameServiceMapping {
|
|
20
|
+
'messaging-compat': MessagingCompatImpl;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export declare function registerMessagingCompat(): void;
|
package/dist/esm/test/fakes.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { FirebaseApp } from '@firebase/app-compat';
|
|
18
|
-
import { Messaging } from '@firebase/messaging';
|
|
19
|
-
export declare function getFakeApp(): FirebaseApp;
|
|
20
|
-
export declare function getFakeModularMessaging(): Messaging;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app-compat';
|
|
18
|
+
import { Messaging } from '@firebase/messaging';
|
|
19
|
+
export declare function getFakeApp(): FirebaseApp;
|
|
20
|
+
export declare function getFakeModularMessaging(): Messaging;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
package/dist/index.cjs.js
CHANGED
|
@@ -11,130 +11,130 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
|
|
12
12
|
|
|
13
13
|
const name = "@firebase/messaging-compat";
|
|
14
|
-
const version = "0.2.
|
|
14
|
+
const version = "0.2.14";
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* @license
|
|
18
|
-
* Copyright 2020 Google LLC
|
|
19
|
-
*
|
|
20
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
-
* you may not use this file except in compliance with the License.
|
|
22
|
-
* You may obtain a copy of the License at
|
|
23
|
-
*
|
|
24
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
-
*
|
|
26
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
-
* See the License for the specific language governing permissions and
|
|
30
|
-
* limitations under the License.
|
|
31
|
-
*/
|
|
32
|
-
function isSupported() {
|
|
33
|
-
if (self && 'ServiceWorkerGlobalScope' in self) {
|
|
34
|
-
// Running in ServiceWorker context
|
|
35
|
-
return isSwSupported();
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
// Assume we are in the window context.
|
|
39
|
-
return isWindowSupported();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Checks to see if the required APIs exist.
|
|
44
|
-
* Unlike the modular version, it does not check if IndexedDB.open() is allowed
|
|
45
|
-
* in order to keep isSupported() synchronous and maintain v8 compatibility.
|
|
46
|
-
*/
|
|
47
|
-
function isWindowSupported() {
|
|
48
|
-
return (typeof window !== 'undefined' &&
|
|
49
|
-
util.isIndexedDBAvailable() &&
|
|
50
|
-
util.areCookiesEnabled() &&
|
|
51
|
-
'serviceWorker' in navigator &&
|
|
52
|
-
'PushManager' in window &&
|
|
53
|
-
'Notification' in window &&
|
|
54
|
-
'fetch' in window &&
|
|
55
|
-
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
|
|
56
|
-
PushSubscription.prototype.hasOwnProperty('getKey'));
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Checks to see if the required APIs exist within SW Context.
|
|
60
|
-
*/
|
|
61
|
-
function isSwSupported() {
|
|
62
|
-
return (util.isIndexedDBAvailable() &&
|
|
63
|
-
'PushManager' in self &&
|
|
64
|
-
'Notification' in self &&
|
|
65
|
-
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
|
|
66
|
-
PushSubscription.prototype.hasOwnProperty('getKey'));
|
|
67
|
-
}
|
|
68
|
-
class MessagingCompatImpl {
|
|
69
|
-
constructor(app, _delegate) {
|
|
70
|
-
this.app = app;
|
|
71
|
-
this._delegate = _delegate;
|
|
72
|
-
this.app = app;
|
|
73
|
-
this._delegate = _delegate;
|
|
74
|
-
}
|
|
75
|
-
async getToken(options) {
|
|
76
|
-
return messaging.getToken(this._delegate, options);
|
|
77
|
-
}
|
|
78
|
-
async deleteToken() {
|
|
79
|
-
return messaging.deleteToken(this._delegate);
|
|
80
|
-
}
|
|
81
|
-
onMessage(nextOrObserver) {
|
|
82
|
-
return messaging.onMessage(this._delegate, nextOrObserver);
|
|
83
|
-
}
|
|
84
|
-
onBackgroundMessage(nextOrObserver) {
|
|
85
|
-
return sw.onBackgroundMessage(this._delegate, nextOrObserver);
|
|
86
|
-
}
|
|
16
|
+
/**
|
|
17
|
+
* @license
|
|
18
|
+
* Copyright 2020 Google LLC
|
|
19
|
+
*
|
|
20
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
+
* you may not use this file except in compliance with the License.
|
|
22
|
+
* You may obtain a copy of the License at
|
|
23
|
+
*
|
|
24
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
+
* See the License for the specific language governing permissions and
|
|
30
|
+
* limitations under the License.
|
|
31
|
+
*/
|
|
32
|
+
function isSupported() {
|
|
33
|
+
if (self && 'ServiceWorkerGlobalScope' in self) {
|
|
34
|
+
// Running in ServiceWorker context
|
|
35
|
+
return isSwSupported();
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// Assume we are in the window context.
|
|
39
|
+
return isWindowSupported();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Checks to see if the required APIs exist.
|
|
44
|
+
* Unlike the modular version, it does not check if IndexedDB.open() is allowed
|
|
45
|
+
* in order to keep isSupported() synchronous and maintain v8 compatibility.
|
|
46
|
+
*/
|
|
47
|
+
function isWindowSupported() {
|
|
48
|
+
return (typeof window !== 'undefined' &&
|
|
49
|
+
util.isIndexedDBAvailable() &&
|
|
50
|
+
util.areCookiesEnabled() &&
|
|
51
|
+
'serviceWorker' in navigator &&
|
|
52
|
+
'PushManager' in window &&
|
|
53
|
+
'Notification' in window &&
|
|
54
|
+
'fetch' in window &&
|
|
55
|
+
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
|
|
56
|
+
PushSubscription.prototype.hasOwnProperty('getKey'));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Checks to see if the required APIs exist within SW Context.
|
|
60
|
+
*/
|
|
61
|
+
function isSwSupported() {
|
|
62
|
+
return (util.isIndexedDBAvailable() &&
|
|
63
|
+
'PushManager' in self &&
|
|
64
|
+
'Notification' in self &&
|
|
65
|
+
ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
|
|
66
|
+
PushSubscription.prototype.hasOwnProperty('getKey'));
|
|
67
|
+
}
|
|
68
|
+
class MessagingCompatImpl {
|
|
69
|
+
constructor(app, _delegate) {
|
|
70
|
+
this.app = app;
|
|
71
|
+
this._delegate = _delegate;
|
|
72
|
+
this.app = app;
|
|
73
|
+
this._delegate = _delegate;
|
|
74
|
+
}
|
|
75
|
+
async getToken(options) {
|
|
76
|
+
return messaging.getToken(this._delegate, options);
|
|
77
|
+
}
|
|
78
|
+
async deleteToken() {
|
|
79
|
+
return messaging.deleteToken(this._delegate);
|
|
80
|
+
}
|
|
81
|
+
onMessage(nextOrObserver) {
|
|
82
|
+
return messaging.onMessage(this._delegate, nextOrObserver);
|
|
83
|
+
}
|
|
84
|
+
onBackgroundMessage(nextOrObserver) {
|
|
85
|
+
return sw.onBackgroundMessage(this._delegate, nextOrObserver);
|
|
86
|
+
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/**
|
|
90
|
-
* @license
|
|
91
|
-
* Copyright 2020 Google LLC
|
|
92
|
-
*
|
|
93
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
94
|
-
* you may not use this file except in compliance with the License.
|
|
95
|
-
* You may obtain a copy of the License at
|
|
96
|
-
*
|
|
97
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
98
|
-
*
|
|
99
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
100
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
101
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
102
|
-
* See the License for the specific language governing permissions and
|
|
103
|
-
* limitations under the License.
|
|
104
|
-
*/
|
|
105
|
-
const messagingCompatFactory = (container) => {
|
|
106
|
-
if (self && 'ServiceWorkerGlobalScope' in self) {
|
|
107
|
-
// in sw
|
|
108
|
-
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-sw').getImmediate());
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
// in window
|
|
112
|
-
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging').getImmediate());
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
const NAMESPACE_EXPORTS = {
|
|
116
|
-
isSupported
|
|
117
|
-
};
|
|
118
|
-
function registerMessagingCompat() {
|
|
119
|
-
firebase__default["default"].INTERNAL.registerComponent(new component.Component('messaging-compat', messagingCompatFactory, "PUBLIC" /* ComponentType.PUBLIC */).setServiceProps(NAMESPACE_EXPORTS));
|
|
89
|
+
/**
|
|
90
|
+
* @license
|
|
91
|
+
* Copyright 2020 Google LLC
|
|
92
|
+
*
|
|
93
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
94
|
+
* you may not use this file except in compliance with the License.
|
|
95
|
+
* You may obtain a copy of the License at
|
|
96
|
+
*
|
|
97
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
98
|
+
*
|
|
99
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
100
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
101
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
102
|
+
* See the License for the specific language governing permissions and
|
|
103
|
+
* limitations under the License.
|
|
104
|
+
*/
|
|
105
|
+
const messagingCompatFactory = (container) => {
|
|
106
|
+
if (self && 'ServiceWorkerGlobalScope' in self) {
|
|
107
|
+
// in sw
|
|
108
|
+
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging-sw').getImmediate());
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
// in window
|
|
112
|
+
return new MessagingCompatImpl(container.getProvider('app-compat').getImmediate(), container.getProvider('messaging').getImmediate());
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const NAMESPACE_EXPORTS = {
|
|
116
|
+
isSupported
|
|
117
|
+
};
|
|
118
|
+
function registerMessagingCompat() {
|
|
119
|
+
firebase__default["default"].INTERNAL.registerComponent(new component.Component('messaging-compat', messagingCompatFactory, "PUBLIC" /* ComponentType.PUBLIC */).setServiceProps(NAMESPACE_EXPORTS));
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
/**
|
|
123
|
-
* @license
|
|
124
|
-
* Copyright 2020 Google LLC
|
|
125
|
-
*
|
|
126
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
127
|
-
* you may not use this file except in compliance with the License.
|
|
128
|
-
* You may obtain a copy of the License at
|
|
129
|
-
*
|
|
130
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
131
|
-
*
|
|
132
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
133
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
134
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
135
|
-
* See the License for the specific language governing permissions and
|
|
136
|
-
* limitations under the License.
|
|
137
|
-
*/
|
|
138
|
-
registerMessagingCompat();
|
|
122
|
+
/**
|
|
123
|
+
* @license
|
|
124
|
+
* Copyright 2020 Google LLC
|
|
125
|
+
*
|
|
126
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
127
|
+
* you may not use this file except in compliance with the License.
|
|
128
|
+
* You may obtain a copy of the License at
|
|
129
|
+
*
|
|
130
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
131
|
+
*
|
|
132
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
133
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
134
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
135
|
+
* See the License for the specific language governing permissions and
|
|
136
|
+
* limitations under the License.
|
|
137
|
+
*/
|
|
138
|
+
registerMessagingCompat();
|
|
139
139
|
firebase__default["default"].registerVersion(name, version);
|
|
140
140
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/messaging-compat.ts","../src/registerMessagingCompat.ts","../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FirebaseApp as AppCompat,\n _FirebaseService\n} from '@firebase/app-compat';\nimport {\n Messaging,\n MessagePayload,\n deleteToken,\n getToken,\n onMessage\n} from '@firebase/messaging';\nimport {\n areCookiesEnabled,\n isIndexedDBAvailable,\n NextFn,\n Observer,\n Unsubscribe\n} from '@firebase/util';\n\nimport { onBackgroundMessage } from '@firebase/messaging/sw';\n\nexport interface MessagingCompat {\n getToken(options?: {\n vapidKey?: string;\n serviceWorkerRegistration?: ServiceWorkerRegistration;\n }): Promise<string>;\n\n deleteToken(): Promise<boolean>;\n\n onMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe;\n\n onBackgroundMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe;\n}\n\nexport function isSupported(): boolean {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n // Running in ServiceWorker context\n return isSwSupported();\n } else {\n // Assume we are in the window context.\n return isWindowSupported();\n }\n}\n\n/**\n * Checks to see if the required APIs exist.\n * Unlike the modular version, it does not check if IndexedDB.open() is allowed\n * in order to keep isSupported() synchronous and maintain v8 compatibility.\n */\nfunction isWindowSupported(): boolean {\n return (\n typeof window !== 'undefined' &&\n isIndexedDBAvailable() &&\n areCookiesEnabled() &&\n 'serviceWorker' in navigator &&\n 'PushManager' in window &&\n 'Notification' in window &&\n 'fetch' in window &&\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n PushSubscription.prototype.hasOwnProperty('getKey')\n );\n}\n\n/**\n * Checks to see if the required APIs exist within SW Context.\n */\nfunction isSwSupported(): boolean {\n return (\n isIndexedDBAvailable() &&\n 'PushManager' in self &&\n 'Notification' in self &&\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n PushSubscription.prototype.hasOwnProperty('getKey')\n );\n}\n\nexport class MessagingCompatImpl implements MessagingCompat, _FirebaseService {\n constructor(readonly app: AppCompat, readonly _delegate: Messaging) {\n this.app = app;\n this._delegate = _delegate;\n }\n\n async getToken(options?: {\n vapidKey?: string;\n serviceWorkerRegistration?: ServiceWorkerRegistration;\n }): Promise<string> {\n return getToken(this._delegate, options);\n }\n\n async deleteToken(): Promise<boolean> {\n return deleteToken(this._delegate);\n }\n\n onMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe {\n return onMessage(this._delegate, nextOrObserver);\n }\n\n onBackgroundMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe {\n return onBackgroundMessage(this._delegate, nextOrObserver);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Component,\n ComponentContainer,\n ComponentType,\n InstanceFactory\n} from '@firebase/component';\nimport { MessagingCompatImpl, isSupported } from './messaging-compat';\nimport firebase, { _FirebaseNamespace } from '@firebase/app-compat';\n\ndeclare module '@firebase/component' {\n interface NameServiceMapping {\n 'messaging-compat': MessagingCompatImpl;\n }\n}\n\nconst messagingCompatFactory: InstanceFactory<'messaging-compat'> = (\n container: ComponentContainer\n) => {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n // in sw\n return new MessagingCompatImpl(\n container.getProvider('app-compat').getImmediate(),\n container.getProvider('messaging-sw').getImmediate()\n );\n } else {\n // in window\n return new MessagingCompatImpl(\n container.getProvider('app-compat').getImmediate(),\n container.getProvider('messaging').getImmediate()\n );\n }\n};\n\nconst NAMESPACE_EXPORTS = {\n isSupported\n};\n\nexport function registerMessagingCompat(): void {\n (firebase as _FirebaseNamespace).INTERNAL.registerComponent(\n new Component(\n 'messaging-compat',\n messagingCompatFactory,\n ComponentType.PUBLIC\n ).setServiceProps(NAMESPACE_EXPORTS)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { name, version } from '../package.json';\n\nimport firebase from '@firebase/app-compat';\nimport { registerMessagingCompat } from './registerMessagingCompat';\nimport { MessagingCompat } from './messaging-compat';\n\nregisterMessagingCompat();\nfirebase.registerVersion(name, version);\n\n/**\n * Define extension behavior of `registerMessaging`\n */\ndeclare module '@firebase/app-compat' {\n interface FirebaseNamespace {\n messaging: {\n (app?: FirebaseApp): MessagingCompat;\n isSupported(): boolean;\n };\n }\n interface FirebaseApp {\n messaging(): MessagingCompat;\n }\n}\n"],"names":["isIndexedDBAvailable","areCookiesEnabled","getToken","deleteToken","onMessage","onBackgroundMessage","firebase","Component"],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;SAwCa,WAAW,GAAA;AACzB,IAAA,IAAI,IAAI,IAAI,0BAA0B,IAAI,IAAI,EAAE;;QAE9C,OAAO,aAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/messaging-compat.ts","../src/registerMessagingCompat.ts","../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FirebaseApp as AppCompat,\n _FirebaseService\n} from '@firebase/app-compat';\nimport {\n Messaging,\n MessagePayload,\n deleteToken,\n getToken,\n onMessage\n} from '@firebase/messaging';\nimport {\n areCookiesEnabled,\n isIndexedDBAvailable,\n NextFn,\n Observer,\n Unsubscribe\n} from '@firebase/util';\n\nimport { onBackgroundMessage } from '@firebase/messaging/sw';\n\nexport interface MessagingCompat {\n getToken(options?: {\n vapidKey?: string;\n serviceWorkerRegistration?: ServiceWorkerRegistration;\n }): Promise<string>;\n\n deleteToken(): Promise<boolean>;\n\n onMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe;\n\n onBackgroundMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe;\n}\n\nexport function isSupported(): boolean {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n // Running in ServiceWorker context\n return isSwSupported();\n } else {\n // Assume we are in the window context.\n return isWindowSupported();\n }\n}\n\n/**\n * Checks to see if the required APIs exist.\n * Unlike the modular version, it does not check if IndexedDB.open() is allowed\n * in order to keep isSupported() synchronous and maintain v8 compatibility.\n */\nfunction isWindowSupported(): boolean {\n return (\n typeof window !== 'undefined' &&\n isIndexedDBAvailable() &&\n areCookiesEnabled() &&\n 'serviceWorker' in navigator &&\n 'PushManager' in window &&\n 'Notification' in window &&\n 'fetch' in window &&\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n PushSubscription.prototype.hasOwnProperty('getKey')\n );\n}\n\n/**\n * Checks to see if the required APIs exist within SW Context.\n */\nfunction isSwSupported(): boolean {\n return (\n isIndexedDBAvailable() &&\n 'PushManager' in self &&\n 'Notification' in self &&\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n PushSubscription.prototype.hasOwnProperty('getKey')\n );\n}\n\nexport class MessagingCompatImpl implements MessagingCompat, _FirebaseService {\n constructor(readonly app: AppCompat, readonly _delegate: Messaging) {\n this.app = app;\n this._delegate = _delegate;\n }\n\n async getToken(options?: {\n vapidKey?: string;\n serviceWorkerRegistration?: ServiceWorkerRegistration;\n }): Promise<string> {\n return getToken(this._delegate, options);\n }\n\n async deleteToken(): Promise<boolean> {\n return deleteToken(this._delegate);\n }\n\n onMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe {\n return onMessage(this._delegate, nextOrObserver);\n }\n\n onBackgroundMessage(\n nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>\n ): Unsubscribe {\n return onBackgroundMessage(this._delegate, nextOrObserver);\n }\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Component,\n ComponentContainer,\n ComponentType,\n InstanceFactory\n} from '@firebase/component';\nimport { MessagingCompatImpl, isSupported } from './messaging-compat';\nimport firebase, { _FirebaseNamespace } from '@firebase/app-compat';\n\ndeclare module '@firebase/component' {\n interface NameServiceMapping {\n 'messaging-compat': MessagingCompatImpl;\n }\n}\n\nconst messagingCompatFactory: InstanceFactory<'messaging-compat'> = (\n container: ComponentContainer\n) => {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n // in sw\n return new MessagingCompatImpl(\n container.getProvider('app-compat').getImmediate(),\n container.getProvider('messaging-sw').getImmediate()\n );\n } else {\n // in window\n return new MessagingCompatImpl(\n container.getProvider('app-compat').getImmediate(),\n container.getProvider('messaging').getImmediate()\n );\n }\n};\n\nconst NAMESPACE_EXPORTS = {\n isSupported\n};\n\nexport function registerMessagingCompat(): void {\n (firebase as _FirebaseNamespace).INTERNAL.registerComponent(\n new Component(\n 'messaging-compat',\n messagingCompatFactory,\n ComponentType.PUBLIC\n ).setServiceProps(NAMESPACE_EXPORTS)\n );\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { name, version } from '../package.json';\n\nimport firebase from '@firebase/app-compat';\nimport { registerMessagingCompat } from './registerMessagingCompat';\nimport { MessagingCompat } from './messaging-compat';\n\nregisterMessagingCompat();\nfirebase.registerVersion(name, version);\n\n/**\n * Define extension behavior of `registerMessaging`\n */\ndeclare module '@firebase/app-compat' {\n interface FirebaseNamespace {\n messaging: {\n (app?: FirebaseApp): MessagingCompat;\n isSupported(): boolean;\n };\n }\n interface FirebaseApp {\n messaging(): MessagingCompat;\n }\n}\n"],"names":["isIndexedDBAvailable","areCookiesEnabled","getToken","deleteToken","onMessage","onBackgroundMessage","firebase","Component"],"mappings":"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"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { MessagingCompat } from './messaging-compat';
|
|
18
|
-
/**
|
|
19
|
-
* Define extension behavior of `registerMessaging`
|
|
20
|
-
*/
|
|
21
|
-
declare module '@firebase/app-compat' {
|
|
22
|
-
interface FirebaseNamespace {
|
|
23
|
-
messaging: {
|
|
24
|
-
(app?: FirebaseApp): MessagingCompat;
|
|
25
|
-
isSupported(): boolean;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
interface FirebaseApp {
|
|
29
|
-
messaging(): MessagingCompat;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { MessagingCompat } from './messaging-compat';
|
|
18
|
+
/**
|
|
19
|
+
* Define extension behavior of `registerMessaging`
|
|
20
|
+
*/
|
|
21
|
+
declare module '@firebase/app-compat' {
|
|
22
|
+
interface FirebaseNamespace {
|
|
23
|
+
messaging: {
|
|
24
|
+
(app?: FirebaseApp): MessagingCompat;
|
|
25
|
+
isSupported(): boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface FirebaseApp {
|
|
29
|
+
messaging(): MessagingCompat;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
32
|
|
|
33
33
|
import { FirebaseApp as FirebaseAppCompat } from "@firebase/app-compat";
|
|
34
34
|
import { type Messaging, type GetTokenOptions, type NextFn, type MessagePayload, type Observer, type Unsubscribe } from "@firebase/messaging";
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { FirebaseApp as AppCompat, _FirebaseService } from '@firebase/app-compat';
|
|
18
|
-
import { Messaging, MessagePayload } from '@firebase/messaging';
|
|
19
|
-
import { NextFn, Observer, Unsubscribe } from '@firebase/util';
|
|
20
|
-
export interface MessagingCompat {
|
|
21
|
-
getToken(options?: {
|
|
22
|
-
vapidKey?: string;
|
|
23
|
-
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
24
|
-
}): Promise<string>;
|
|
25
|
-
deleteToken(): Promise<boolean>;
|
|
26
|
-
onMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
27
|
-
onBackgroundMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
28
|
-
}
|
|
29
|
-
export declare function isSupported(): boolean;
|
|
30
|
-
export declare class MessagingCompatImpl implements MessagingCompat, _FirebaseService {
|
|
31
|
-
readonly app: AppCompat;
|
|
32
|
-
readonly _delegate: Messaging;
|
|
33
|
-
constructor(app: AppCompat, _delegate: Messaging);
|
|
34
|
-
getToken(options?: {
|
|
35
|
-
vapidKey?: string;
|
|
36
|
-
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
37
|
-
}): Promise<string>;
|
|
38
|
-
deleteToken(): Promise<boolean>;
|
|
39
|
-
onMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
40
|
-
onBackgroundMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
41
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp as AppCompat, _FirebaseService } from '@firebase/app-compat';
|
|
18
|
+
import { Messaging, MessagePayload } from '@firebase/messaging';
|
|
19
|
+
import { NextFn, Observer, Unsubscribe } from '@firebase/util';
|
|
20
|
+
export interface MessagingCompat {
|
|
21
|
+
getToken(options?: {
|
|
22
|
+
vapidKey?: string;
|
|
23
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
24
|
+
}): Promise<string>;
|
|
25
|
+
deleteToken(): Promise<boolean>;
|
|
26
|
+
onMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
27
|
+
onBackgroundMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
28
|
+
}
|
|
29
|
+
export declare function isSupported(): boolean;
|
|
30
|
+
export declare class MessagingCompatImpl implements MessagingCompat, _FirebaseService {
|
|
31
|
+
readonly app: AppCompat;
|
|
32
|
+
readonly _delegate: Messaging;
|
|
33
|
+
constructor(app: AppCompat, _delegate: Messaging);
|
|
34
|
+
getToken(options?: {
|
|
35
|
+
vapidKey?: string;
|
|
36
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
37
|
+
}): Promise<string>;
|
|
38
|
+
deleteToken(): Promise<boolean>;
|
|
39
|
+
onMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
40
|
+
onBackgroundMessage(nextOrObserver: NextFn<MessagePayload> | Observer<MessagePayload>): Unsubscribe;
|
|
41
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { MessagingCompatImpl } from './messaging-compat';
|
|
18
|
-
declare module '@firebase/component' {
|
|
19
|
-
interface NameServiceMapping {
|
|
20
|
-
'messaging-compat': MessagingCompatImpl;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export declare function registerMessagingCompat(): void;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { MessagingCompatImpl } from './messaging-compat';
|
|
18
|
+
declare module '@firebase/component' {
|
|
19
|
+
interface NameServiceMapping {
|
|
20
|
+
'messaging-compat': MessagingCompatImpl;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export declare function registerMessagingCompat(): void;
|
package/dist/test/fakes.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { FirebaseApp } from '@firebase/app-compat';
|
|
18
|
-
import { Messaging } from '@firebase/messaging';
|
|
19
|
-
export declare function getFakeApp(): FirebaseApp;
|
|
20
|
-
export declare function getFakeModularMessaging(): Messaging;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app-compat';
|
|
18
|
+
import { Messaging } from '@firebase/messaging';
|
|
19
|
+
export declare function getFakeApp(): FirebaseApp;
|
|
20
|
+
export declare function getFakeModularMessaging(): Messaging;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/messaging-compat",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
"@firebase/app-compat": "0.x"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@firebase/messaging": "0.12.
|
|
42
|
-
"@firebase/component": "0.6.
|
|
43
|
-
"@firebase/util": "1.10.
|
|
41
|
+
"@firebase/messaging": "0.12.14",
|
|
42
|
+
"@firebase/component": "0.6.11",
|
|
43
|
+
"@firebase/util": "1.10.2",
|
|
44
44
|
"tslib": "^2.1.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@firebase/app-compat": "0.2.
|
|
47
|
+
"@firebase/app-compat": "0.2.46",
|
|
48
48
|
"@rollup/plugin-json": "4.1.0",
|
|
49
49
|
"rollup-plugin-typescript2": "0.31.2",
|
|
50
50
|
"ts-essentials": "9.3.0",
|
|
51
|
-
"typescript": "
|
|
51
|
+
"typescript": "5.5.4"
|
|
52
52
|
},
|
|
53
53
|
"repository": {
|
|
54
54
|
"directory": "packages/messaging",
|