@react-native-firebase/messaging 23.7.0 → 23.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/commonjs/index.js +61 -0
  2. package/dist/commonjs/index.js.map +1 -0
  3. package/dist/commonjs/modular.js +439 -0
  4. package/dist/commonjs/modular.js.map +1 -0
  5. package/dist/commonjs/namespaced.js +407 -0
  6. package/dist/commonjs/namespaced.js.map +1 -0
  7. package/dist/commonjs/package.json +1 -0
  8. package/dist/commonjs/remoteMessageOptions.js +87 -0
  9. package/dist/commonjs/remoteMessageOptions.js.map +1 -0
  10. package/dist/commonjs/statics.js +29 -0
  11. package/dist/commonjs/statics.js.map +1 -0
  12. package/dist/commonjs/types/messaging.js +105 -0
  13. package/dist/commonjs/types/messaging.js.map +1 -0
  14. package/dist/commonjs/version.js +9 -0
  15. package/dist/commonjs/version.js.map +1 -0
  16. package/{ios/RNFBMessaging/RNFBMessaging+FIRMessagingDelegate.h → dist/module/index.js} +11 -12
  17. package/dist/module/index.js.map +1 -0
  18. package/{lib/modular/index.js → dist/module/modular.js} +135 -119
  19. package/dist/module/modular.js.map +1 -0
  20. package/{lib/index.js → dist/module/namespaced.js} +70 -193
  21. package/dist/module/namespaced.js.map +1 -0
  22. package/dist/module/package.json +1 -0
  23. package/{lib → dist/module}/remoteMessageOptions.js +10 -27
  24. package/dist/module/remoteMessageOptions.js.map +1 -0
  25. package/dist/module/statics.js +25 -0
  26. package/dist/module/statics.js.map +1 -0
  27. package/dist/module/types/messaging.js +124 -0
  28. package/dist/module/types/messaging.js.map +1 -0
  29. package/dist/module/version.js +5 -0
  30. package/dist/module/version.js.map +1 -0
  31. package/dist/typescript/commonjs/lib/index.d.ts +6 -0
  32. package/dist/typescript/commonjs/lib/index.d.ts.map +1 -0
  33. package/{lib/modular/index.d.ts → dist/typescript/commonjs/lib/modular.d.ts} +86 -164
  34. package/dist/typescript/commonjs/lib/modular.d.ts.map +1 -0
  35. package/dist/typescript/commonjs/lib/namespaced.d.ts +12 -0
  36. package/dist/typescript/commonjs/lib/namespaced.d.ts.map +1 -0
  37. package/dist/typescript/commonjs/lib/remoteMessageOptions.d.ts +14 -0
  38. package/dist/typescript/commonjs/lib/remoteMessageOptions.d.ts.map +1 -0
  39. package/dist/typescript/commonjs/lib/statics.d.ts +20 -0
  40. package/dist/typescript/commonjs/lib/statics.d.ts.map +1 -0
  41. package/dist/typescript/commonjs/lib/types/messaging.d.ts +673 -0
  42. package/dist/typescript/commonjs/lib/types/messaging.d.ts.map +1 -0
  43. package/dist/typescript/commonjs/lib/version.d.ts +2 -0
  44. package/dist/typescript/commonjs/lib/version.d.ts.map +1 -0
  45. package/dist/typescript/commonjs/package.json +1 -0
  46. package/dist/typescript/module/lib/index.d.ts +6 -0
  47. package/dist/typescript/module/lib/index.d.ts.map +1 -0
  48. package/dist/typescript/module/lib/modular.d.ts +247 -0
  49. package/dist/typescript/module/lib/modular.d.ts.map +1 -0
  50. package/dist/typescript/module/lib/namespaced.d.ts +12 -0
  51. package/dist/typescript/module/lib/namespaced.d.ts.map +1 -0
  52. package/dist/typescript/module/lib/remoteMessageOptions.d.ts +14 -0
  53. package/dist/typescript/module/lib/remoteMessageOptions.d.ts.map +1 -0
  54. package/dist/typescript/module/lib/statics.d.ts +20 -0
  55. package/dist/typescript/module/lib/statics.d.ts.map +1 -0
  56. package/dist/typescript/module/lib/types/messaging.d.ts +673 -0
  57. package/dist/typescript/module/lib/types/messaging.d.ts.map +1 -0
  58. package/dist/typescript/module/lib/version.d.ts +2 -0
  59. package/dist/typescript/module/lib/version.d.ts.map +1 -0
  60. package/dist/typescript/module/package.json +1 -0
  61. package/{ios/RNFBMessaging/RNFBMessaging+UNUserNotificationCenter.h → lib/index.ts} +28 -21
  62. package/lib/modular.ts +447 -0
  63. package/lib/namespaced.ts +583 -0
  64. package/lib/remoteMessageOptions.ts +110 -0
  65. package/lib/{statics.js → statics.ts} +6 -3
  66. package/lib/types/messaging.ts +815 -0
  67. package/lib/version.ts +2 -0
  68. package/package.json +64 -8
  69. package/tsconfig.json +21 -0
  70. package/CHANGELOG.md +0 -1181
  71. package/RNFBMessaging.podspec +0 -50
  72. package/android/.editorconfig +0 -10
  73. package/android/build.gradle +0 -149
  74. package/android/lint.xml +0 -5
  75. package/android/settings.gradle +0 -1
  76. package/android/src/main/AndroidManifest.xml +0 -43
  77. package/android/src/main/java/io/invertase/firebase/messaging/JsonConvert.java +0 -127
  78. package/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingHeadlessService.java +0 -30
  79. package/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingModule.java +0 -332
  80. package/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingPackage.java +0 -41
  81. package/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingReceiver.java +0 -66
  82. package/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingSerializer.java +0 -225
  83. package/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingService.java +0 -37
  84. package/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingStore.java +0 -15
  85. package/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingStoreHelper.java +0 -23
  86. package/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingStoreImpl.java +0 -97
  87. package/android/src/main/res/values/colors.xml +0 -143
  88. package/app.plugin.js +0 -1
  89. package/ios/RNFBMessaging/RNFBMessaging+AppDelegate.h +0 -54
  90. package/ios/RNFBMessaging/RNFBMessaging+AppDelegate.m +0 -251
  91. package/ios/RNFBMessaging/RNFBMessaging+FIRMessagingDelegate.m +0 -70
  92. package/ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.h +0 -29
  93. package/ios/RNFBMessaging/RNFBMessaging+NSNotificationCenter.m +0 -173
  94. package/ios/RNFBMessaging/RNFBMessaging+UNUserNotificationCenter.m +0 -185
  95. package/ios/RNFBMessaging/RNFBMessagingModule.h +0 -26
  96. package/ios/RNFBMessaging/RNFBMessagingModule.m +0 -431
  97. package/ios/RNFBMessaging/RNFBMessagingSerializer.h +0 -32
  98. package/ios/RNFBMessaging/RNFBMessagingSerializer.m +0 -235
  99. package/ios/RNFBMessaging.xcodeproj/project.pbxproj +0 -384
  100. package/ios/RNFBMessaging.xcodeproj/xcshareddata/IDETemplateMacros.plist +0 -24
  101. package/lib/index.d.ts +0 -1233
  102. package/lib/version.js +0 -2
  103. package/plugin/build/android/index.d.ts +0 -2
  104. package/plugin/build/android/index.js +0 -5
  105. package/plugin/build/android/setupFirebaseNotifationIcon.d.ts +0 -8
  106. package/plugin/build/android/setupFirebaseNotifationIcon.js +0 -62
  107. package/plugin/build/index.d.ts +0 -3
  108. package/plugin/build/index.js +0 -16
  109. package/plugin/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MessagePriority = exports.FirebaseMessagingTypes = void 0;
7
+ /*
8
+ * Copyright (c) 2016-present Invertase Limited & Contributors
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this library except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ *
22
+ */
23
+ // ============ Types ============
24
+ /**
25
+ * The `RemoteMessage` interface describes an outgoing & incoming message from the remote FCM server.
26
+ */
27
+ /**
28
+ * Represents the priority of a RemoteMessage
29
+ *
30
+ * Note: this is an android-specific property of RemoteMessages
31
+ */
32
+ let MessagePriority = exports.MessagePriority = /*#__PURE__*/function (MessagePriority) {
33
+ /**
34
+ * Unknown priority, this will be returned as the default on non-android platforms
35
+ */
36
+ MessagePriority[MessagePriority["PRIORITY_UNKNOWN"] = 0] = "PRIORITY_UNKNOWN";
37
+ /**
38
+ * High priority - Activities may start foreground services if they receive high priority messages
39
+ */
40
+ MessagePriority[MessagePriority["PRIORITY_HIGH"] = 1] = "PRIORITY_HIGH";
41
+ /**
42
+ * Normal priority - Activities have restrictions and may only perform unobtrusive actions on receipt
43
+ */
44
+ MessagePriority[MessagePriority["PRIORITY_NORMAL"] = 2] = "PRIORITY_NORMAL";
45
+ return MessagePriority;
46
+ }({});
47
+ /**
48
+ * Options for features provided by the FCM SDK for Web.
49
+ */
50
+ /**
51
+ * Options for `getToken()` and `deleteToken()`
52
+ */
53
+ /**
54
+ * Options for `getToken()`
55
+ */
56
+ /**
57
+ * NotificationPayload is an alias for Notification. This is to keep it the same as
58
+ * Firebase Web JS SDK v9 and to make it backwards compatible.
59
+ */
60
+ /**
61
+ * Represents a critical sound configuration that can be included in the
62
+ * `aps` dictionary of an APNs payload.
63
+ */
64
+ /**
65
+ * The type representing a notification priority.
66
+ *
67
+ * Note; on devices which have channel support (Android 8.0 (API level 26) +),
68
+ * this value will be ignored. Instead, the channel "importance" level is used.
69
+ */
70
+ // PRIORITY_MAX - The priority highest level a notification can be set at.
71
+ /**
72
+ * The type representing the visibility of a notification.
73
+ */
74
+ // VISIBILITY_PUBLIC - Show this notification in its entirety on all lock-screens.
75
+ /**
76
+ * An interface representing all the available permissions that can be requested by your app via
77
+ * the `requestPermission` API.
78
+ */
79
+ /**
80
+ * A type representing the notification authorization status for this app on the device.
81
+ *
82
+ * Value is truthy if authorized, compare against an exact status (e.g. iOS PROVISIONAL) for a more
83
+ * granular status.
84
+ */
85
+ // EPHEMERAL - The app is authorized to create notifications for a limited amount of time. Used in App Clips. @platform ios iOS >= 14
86
+ /**
87
+ * An event that is received when a message fails to send.
88
+ */
89
+ // ============ Module Interface ============
90
+ /**
91
+ * The Firebase Messaging service interface.
92
+ *
93
+ * > This module is available for the default app only.
94
+ */
95
+ // ============ Statics Interface ============
96
+ /**
97
+ * Static properties available on firebase.messaging
98
+ */
99
+ // ============ Module Augmentation ============
100
+ /* eslint-disable @typescript-eslint/no-namespace */
101
+ // ============ Backwards Compatibility Namespace ============
102
+ /* eslint-disable @typescript-eslint/no-namespace */
103
+ let FirebaseMessagingTypes = exports.FirebaseMessagingTypes = void 0;
104
+ /* eslint-enable @typescript-eslint/no-namespace */
105
+ //# sourceMappingURL=messaging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MessagePriority","exports","FirebaseMessagingTypes"],"sourceRoot":"../../../lib","sources":["types/messaging.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AAEA;AACA;AACA;AA6FA;AACA;AACA;AACA;AACA;AAJA,IAKYA,eAAe,GAAAC,OAAA,CAAAD,eAAA,0BAAfA,eAAe;EACzB;AACF;AACA;EAHYA,eAAe,CAAfA,eAAe;EAMzB;AACF;AACA;EARYA,eAAe,CAAfA,eAAe;EAWzB;AACF;AACA;EAbYA,eAAe,CAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAiB3B;AACA;AACA;AAaA;AACA;AACA;AAiBA;AACA;AACA;AAqBA;AACA;AACA;AACA;AAiJA;AACA;AACA;AACA;AAqBA;AACA;AACA;AACA;AACA;AACA;AAMO;AAEP;AACA;AACA;AAIO;AAEP;AACA;AACA;AACA;AAiEA;AACA;AACA;AACA;AACA;AACA;AAMO;AAEP;AACA;AACA;AAaA;AAEA;AACA;AACA;AACA;AACA;AAiQA;AAEA;AACA;AACA;AASA;AACA;AAYA;AAEA;AAAA,IAiBiBE,sBAAsB,GAAAD,OAAA,CAAAC,sBAAA;AAiBvC","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.version = void 0;
7
+ // Generated by genversion.
8
+ const version = exports.version = '23.8.0';
9
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["version","exports"],"sourceRoot":"../../lib","sources":["version.ts"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,QAAQ","ignoreList":[]}
@@ -1,4 +1,6 @@
1
- /**
1
+ "use strict";
2
+
3
+ /*
2
4
  * Copyright (c) 2016-present Invertase Limited & Contributors
3
5
  *
4
6
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,17 +17,14 @@
15
17
  *
16
18
  */
17
19
 
18
- #import <Firebase/Firebase.h>
19
- #import <Foundation/Foundation.h>
20
-
21
- NS_ASSUME_NONNULL_BEGIN
22
-
23
- @interface RNFBMessagingFIRMessagingDelegate : NSObject <FIRMessagingDelegate>
24
-
25
- + (_Nonnull instancetype)sharedInstance;
20
+ // Export types from types/messaging
26
21
 
27
- - (void)observe;
22
+ export { AuthorizationStatus, NotificationAndroidPriority, NotificationAndroidVisibility } from "./statics.js";
28
23
 
29
- @end
24
+ // Export modular API functions
25
+ export * from "./modular.js";
30
26
 
31
- NS_ASSUME_NONNULL_END
27
+ // Export namespaced API
28
+ export * from "./namespaced.js";
29
+ export { default } from "./namespaced.js";
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AuthorizationStatus","NotificationAndroidPriority","NotificationAndroidVisibility","default"],"sourceRoot":"../../lib","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAeA,SACEA,mBAAmB,EACnBC,2BAA2B,EAC3BC,6BAA6B,QACxB,cAAW;;AAElB;AACA,cAAc,cAAW;;AAEzB;AACA,cAAc,iBAAc;AAC5B,SAASC,OAAO,QAAQ,iBAAc","ignoreList":[]}
@@ -1,72 +1,81 @@
1
- import { getApp } from '@react-native-firebase/app';
2
- import { withModularFlag } from '@react-native-firebase/app/lib/common';
3
- import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common';
1
+ "use strict";
4
2
 
5
- /**
6
- * @typedef {import('..').FirebaseMessagingTypes} FirebaseMessagingTypes
7
- * @typedef {import('..').FirebaseMessagingTypes.Module} Messaging
8
- * @typedef {import('..').FirebaseMessagingTypes.RemoteMessage} RemoteMessage
9
- * @typedef {import('..').FirebaseMessagingTypes.NativeTokenOptions} NativeTokenOptions
10
- * @typedef {import('..').FirebaseMessagingTypes.GetTokenOptions} GetTokenOptions
11
- * @typedef {import('..').FirebaseMessagingTypes.IOSPermissions} IOSPermissions
12
- * @typedef {import('..').FirebaseMessagingTypes.AuthorizationStatus} AuthorizationStatus
13
- * @typedef {import('..').FirebaseMessagingTypes.SendErrorEvent} SendErrorEvent
14
- * @typedef {import('@firebase/app').FirebaseApp} FirebaseApp
3
+ /*
4
+ * Copyright (c) 2016-present Invertase Limited & Contributors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this library except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
15
18
  */
16
19
 
20
+ import { getApp } from '@react-native-firebase/app';
21
+ import { withModularFlag } from '@react-native-firebase/app/lib/common';
22
+ import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common';
17
23
  /**
18
24
  * Returns a Messaging instance for the given app.
19
- * @param {FirebaseApp} [app] - FirebaseApp. Optional.
20
- * @returns {Messaging}
25
+ * @param app - FirebaseApp. Optional.
26
+ * @returns Messaging instance
21
27
  */
22
28
  export function getMessaging(app) {
23
29
  if (app) {
24
30
  return getApp(app.name).messaging();
25
31
  }
26
-
27
32
  return getApp().messaging();
28
33
  }
29
34
 
30
35
  /**
31
36
  * Removes access to an FCM token previously authorized by its scope.
32
37
  * Messages sent by the server to this token will fail.
33
- * @param {Messaging} messaging - Messaging instance.
34
- * @param {NativeTokenOptions} [tokenOptions] - Options to override senderId (iOS) and projectId (Android).
35
- * @returns {Promise<void>}
38
+ * @param messaging - Messaging instance.
39
+ * @param tokenOptions - Options to override senderId (iOS) and projectId (Android).
40
+ * @returns Promise that resolves when the token is deleted.
36
41
  */
37
42
  export function deleteToken(messaging, tokenOptions) {
43
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
38
44
  return messaging.deleteToken.call(messaging, tokenOptions, MODULAR_DEPRECATION_ARG);
39
45
  }
40
46
 
41
47
  /**
42
48
  * Returns an FCM token for this device. Optionally, you can specify custom options for your own use case.
43
- * @param {Messaging} messaging - Messaging instance.
44
- * @param {GetTokenOptions & NativeTokenOptions} [options] - Options to override senderId (iOS) and appName.
45
- * @returns {Promise<string>}
49
+ * @param messaging - Messaging instance.
50
+ * @param options - Options to override senderId (iOS) and appName.
51
+ * @returns Promise that resolves with the FCM token.
46
52
  */
47
53
  export function getToken(messaging, options) {
54
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
48
55
  return messaging.getToken.call(messaging, options, MODULAR_DEPRECATION_ARG);
49
56
  }
50
57
 
51
58
  /**
52
59
  * When any FCM payload is received, the listener callback is called with a `RemoteMessage`.
53
60
  * > This subscriber method is only called when the app is active (in the foreground).
54
- * @param {Messaging} messaging - Messaging instance.
55
- * @param {(message: RemoteMessage) => any} listener - Called with a `RemoteMessage` when a new FCM payload is received from the server.
56
- * @returns {() => void}
61
+ * @param messaging - Messaging instance.
62
+ * @param listener - Called with a `RemoteMessage` when a new FCM payload is received from the server.
63
+ * @returns Function to unsubscribe from the message listener.
57
64
  */
58
65
  export function onMessage(messaging, listener) {
66
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
59
67
  return messaging.onMessage.call(messaging, listener, MODULAR_DEPRECATION_ARG);
60
68
  }
61
69
 
62
70
  /**
63
71
  * When the user presses a notification displayed via FCM, this listener will be called if the app
64
72
  * has opened from a background state.
65
- * @param {Messaging} messaging - Messaging instance.
66
- * @param {(message: RemoteMessage) => any} listener - Called with a `RemoteMessage` when a notification press opens the application.
67
- * @returns {() => void}
73
+ * @param messaging - Messaging instance.
74
+ * @param listener - Called with a `RemoteMessage` when a notification press opens the application.
75
+ * @returns Function to unsubscribe from the notification opened listener.
68
76
  */
69
77
  export function onNotificationOpenedApp(messaging, listener) {
78
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
70
79
  return messaging.onNotificationOpenedApp.call(messaging, listener, MODULAR_DEPRECATION_ARG);
71
80
  }
72
81
 
@@ -74,29 +83,31 @@ export function onNotificationOpenedApp(messaging, listener) {
74
83
  * Called when a new registration token is generated for the device. For example, this event can happen when a
75
84
  * token expires or when the server invalidates the token.
76
85
  * > This subscriber method is only called when the app is active (in the foreground).
77
- * @param {Messaging} messaging - Messaging instance.
78
- * @param {(token: string) => any} listener - Called with a FCM token when the token is refreshed.
79
- * @returns {() => void}
86
+ * @param messaging - Messaging instance.
87
+ * @param listener - Called with a FCM token when the token is refreshed.
88
+ * @returns Function to unsubscribe from the token refresh listener.
80
89
  */
81
90
  export function onTokenRefresh(messaging, listener) {
91
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
82
92
  return messaging.onTokenRefresh.call(messaging, listener, MODULAR_DEPRECATION_ARG);
83
93
  }
84
94
 
85
95
  /**
86
96
  * On iOS, messaging permission must be requested by the current application before messages can
87
97
  * be received or sent.
88
- * @param {Messaging} messaging - Messaging instance.
89
- * @param {IOSPermissions} [iosPermissions] - All the available permissions for iOS that can be requested.
90
- * @returns {Promise<AuthorizationStatus>}
98
+ * @param messaging - Messaging instance.
99
+ * @param iosPermissions - All the available permissions for iOS that can be requested.
100
+ * @returns Promise that resolves with the authorization status.
91
101
  */
92
102
  export function requestPermission(messaging, iosPermissions) {
103
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
93
104
  return messaging.requestPermission.call(messaging, iosPermissions, MODULAR_DEPRECATION_ARG);
94
105
  }
95
106
 
96
107
  /**
97
108
  * Returns whether messaging auto initialization is enabled or disabled for the device.
98
- * @param {Messaging} messaging - Messaging instance.
99
- * @returns {boolean}
109
+ * @param messaging - Messaging instance.
110
+ * @returns Boolean indicating whether auto initialization is enabled.
100
111
  */
101
112
  export function isAutoInitEnabled(messaging) {
102
113
  return withModularFlag(() => messaging.isAutoInitEnabled);
@@ -104,11 +115,12 @@ export function isAutoInitEnabled(messaging) {
104
115
 
105
116
  /**
106
117
  * Sets whether messaging auto initialization is enabled or disabled for the device.
107
- * @param {Messaging} messaging - Messaging instance.
108
- * @param {boolean} enabled - A boolean value to enable or disable auto initialization.
109
- * @returns {Promise<void>}
118
+ * @param messaging - Messaging instance.
119
+ * @param enabled - A boolean value to enable or disable auto initialization.
120
+ * @returns Promise that resolves when the setting is updated.
110
121
  */
111
122
  export function setAutoInitEnabled(messaging, enabled) {
123
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
112
124
  return messaging.setAutoInitEnabled.call(messaging, enabled, MODULAR_DEPRECATION_ARG);
113
125
  }
114
126
 
@@ -116,48 +128,52 @@ export function setAutoInitEnabled(messaging, enabled) {
116
128
  * When a notification from FCM has triggered the application to open from a quit state,
117
129
  * this method will return a `RemoteMessage` containing the notification data, or `null` if
118
130
  * the app was opened via another method.
119
- * @param {Messaging} messaging - Messaging instance.
120
- * @returns {Promise<RemoteMessage | null>}
131
+ * @param messaging - Messaging instance.
132
+ * @returns Promise that resolves with the initial notification or null.
121
133
  */
122
134
  export function getInitialNotification(messaging) {
135
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
123
136
  return messaging.getInitialNotification.call(messaging, MODULAR_DEPRECATION_ARG);
124
137
  }
125
138
 
126
139
  /**
127
140
  * When the app is opened from iOS notifications settings from a quit state,
128
141
  * this method will return `true` or `false` if the app was opened via another method.
129
- * @param {Messaging} messaging - Messaging instance.
130
- * @returns {Promise<boolean>}
142
+ * @param messaging - Messaging instance.
143
+ * @returns Promise that resolves with a boolean indicating if the app was opened from settings.
131
144
  */
132
145
  export function getDidOpenSettingsForNotification(messaging) {
146
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
133
147
  return messaging.getDidOpenSettingsForNotification.call(messaging, MODULAR_DEPRECATION_ARG);
134
148
  }
135
149
 
136
150
  /**
137
151
  * Returns whether the root view is headless or not
138
152
  * i.e true if the app was launched in the background (for example, by data-only cloud message)
139
- * @param {Messaging} messaging - Messaging instance.
140
- * @returns {Promise<boolean>}
153
+ * @param messaging - Messaging instance.
154
+ * @returns Promise that resolves with a boolean indicating if the app is headless.
141
155
  */
142
156
  export function getIsHeadless(messaging) {
157
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
143
158
  return messaging.getIsHeadless.call(messaging, MODULAR_DEPRECATION_ARG);
144
159
  }
145
160
 
146
161
  /**
147
162
  * On iOS, if your app wants to receive remote messages from FCM (via APNs), you must explicitly register
148
163
  * with APNs if auto-registration has been disabled.
149
- * @param {Messaging} messaging - Messaging instance.
150
- * @returns {Promise<void>}
164
+ * @param messaging - Messaging instance.
165
+ * @returns Promise that resolves when the device is registered.
151
166
  */
152
167
  export function registerDeviceForRemoteMessages(messaging) {
168
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
153
169
  return messaging.registerDeviceForRemoteMessages.call(messaging, MODULAR_DEPRECATION_ARG);
154
170
  }
155
171
 
156
172
  /**
157
173
  * Returns a boolean value whether the user has registered for remote notifications via
158
174
  * `registerDeviceForRemoteMessages()`. For iOS. Android always returns `true`.
159
- * @param {Messaging} messaging - Messaging instance.
160
- * @returns {boolean}
175
+ * @param messaging - Messaging instance.
176
+ * @returns Boolean indicating if the device is registered for remote messages.
161
177
  */
162
178
  export function isDeviceRegisteredForRemoteMessages(messaging) {
163
179
  return withModularFlag(() => messaging.isDeviceRegisteredForRemoteMessages);
@@ -165,20 +181,22 @@ export function isDeviceRegisteredForRemoteMessages(messaging) {
165
181
 
166
182
  /**
167
183
  * Unregisters the app from receiving remote notifications.
168
- * @param {Messaging} messaging - Messaging instance.
169
- * @returns {Promise<void>}
184
+ * @param messaging - Messaging instance.
185
+ * @returns Promise that resolves when the device is unregistered.
170
186
  */
171
187
  export function unregisterDeviceForRemoteMessages(messaging) {
188
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
172
189
  return messaging.unregisterDeviceForRemoteMessages.call(messaging, MODULAR_DEPRECATION_ARG);
173
190
  }
174
191
 
175
192
  /**
176
193
  * On iOS, it is possible to get the users APNs token. This may be required if you want to send messages to your
177
194
  * iOS devices without using the FCM service.
178
- * @param {Messaging} messaging - Messaging instance.
179
- * @returns {Promise<string | null>}
195
+ * @param messaging - Messaging instance.
196
+ * @returns Promise that resolves with the APNs token or null.
180
197
  */
181
198
  export function getAPNSToken(messaging) {
199
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
182
200
  return messaging.getAPNSToken.call(messaging, MODULAR_DEPRECATION_ARG);
183
201
  }
184
202
 
@@ -191,8 +209,8 @@ export function getAPNSToken(messaging) {
191
209
  *
192
210
  * Messaging uses method swizzling to ensure that the APNs token is set automatically.
193
211
  * However, if you have disabled swizzling by setting FirebaseAppDelegateProxyEnabled to NO
194
- * in your apps Info.plist, you should manually set the APNs token in your application
195
- * delegates application(_:didRegisterForRemoteNotificationsWithDeviceToken:) method.
212
+ * in your app's Info.plist, you should manually set the APNs token in your application
213
+ * delegate's application(_:didRegisterForRemoteNotificationsWithDeviceToken:) method.
196
214
  *
197
215
  * If you would like to set the type of the APNs token, rather than relying on automatic
198
216
  * detection, provide a type of either 'prod', 'sandbox'. Omitting the type parameter
@@ -200,51 +218,57 @@ export function getAPNSToken(messaging) {
200
218
  *
201
219
  * At a native level you may also call objective-c `[FIRMessaging setAPNSToken];` as needed.
202
220
  *
203
- * @param {Messaging} messaging - Messaging instance.
204
- * @param {string} token - A hexadecimal string representing your APNs token.
205
- * @param {string} [type] - Optional. A string specifying 'prod', 'sandbox' or 'unknown' token type.
206
- * @returns {Promise<void>}
221
+ * @param messaging - Messaging instance.
222
+ * @param token - A hexadecimal string representing your APNs token.
223
+ * @param type - Optional. A string specifying 'prod', 'sandbox' or 'unknown' token type.
224
+ * @returns Promise that resolves when the APNs token is set.
207
225
  */
208
226
  export function setAPNSToken(messaging, token, type) {
227
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
209
228
  return messaging.setAPNSToken.call(messaging, token, type, MODULAR_DEPRECATION_ARG);
210
229
  }
211
230
 
212
231
  /**
213
232
  * Returns a `AuthorizationStatus` as to whether the user has messaging permission for this app.
214
- * @param {Messaging} messaging - Messaging instance.
215
- * @returns {Promise<AuthorizationStatus>}
233
+ * @param messaging - Messaging instance.
234
+ * @returns Promise that resolves with the authorization status.
216
235
  */
217
236
  export function hasPermission(messaging) {
237
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
218
238
  return messaging.hasPermission.call(messaging, MODULAR_DEPRECATION_ARG);
219
239
  }
220
240
 
221
241
  /**
222
242
  * Called when the FCM server deletes pending messages.
223
- * @param {Messaging} messaging - Messaging instance.
224
- * @param {() => void} listener - Called when the FCM deletes pending messages.
225
- * @returns {() => void}
243
+ * @param messaging - Messaging instance.
244
+ * @param listener - Called when the FCM deletes pending messages.
245
+ * @returns Function to unsubscribe from the deleted messages listener.
226
246
  */
227
247
  export function onDeletedMessages(messaging, listener) {
248
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
228
249
  return messaging.onDeletedMessages.call(messaging, listener, MODULAR_DEPRECATION_ARG);
229
250
  }
230
251
 
231
252
  /**
232
253
  * When sending a `RemoteMessage`, this listener is called when the message has been sent to FCM.
233
- * @param {Messaging} messaging - Messaging instance.
234
- * @param {(messageId: string) => any} listener - Called when the FCM sends the remote message to FCM.
235
- * @returns {() => void}
254
+ * @param messaging - Messaging instance.
255
+ * @param listener - Called when the FCM sends the remote message to FCM.
256
+ * @returns Function to unsubscribe from the message sent listener.
236
257
  */
237
258
  export function onMessageSent(messaging, listener) {
259
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
238
260
  return messaging.onMessageSent.call(messaging, listener, MODULAR_DEPRECATION_ARG);
239
261
  }
240
262
 
241
263
  /**
242
- * When sending a `RemoteMessage`, this listener is called when the message has been sent to FCM.
243
- * @param {Messaging} messaging - Messaging instance.
244
- * @param {(evt: SendErrorEvent) => any} listener - Called when the FCM sends the remote message to FCM.
245
- * @returns {() => void}
264
+ * When sending a `RemoteMessage`, this listener is called when an error is thrown and the
265
+ * message could not be sent.
266
+ * @param messaging - Messaging instance.
267
+ * @param listener - Called when the FCM sends the remote message to FCM.
268
+ * @returns Function to unsubscribe from the send error listener.
246
269
  */
247
270
  export function onSendError(messaging, listener) {
271
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
248
272
  return messaging.onSendError.call(messaging, listener, MODULAR_DEPRECATION_ARG);
249
273
  }
250
274
 
@@ -252,64 +276,65 @@ export function onSendError(messaging, listener) {
252
276
  * Set a message handler function which is called when the app is in the background
253
277
  * or terminated. In Android, a headless task is created, allowing you to access the React Native environment
254
278
  * to perform tasks such as updating local storage, or sending a network request.
255
- * @param {Messaging} messaging - Messaging instance.
256
- * @param {(message: RemoteMessage) => Promise<any>} handler - Called when a message is sent and the application is in a background or terminated state.
257
- * @returns {void}
279
+ * @param messaging - Messaging instance.
280
+ * @param handler - Called when a message is sent and the application is in a background or terminated state.
281
+ * @returns void
258
282
  */
259
283
  export function setBackgroundMessageHandler(messaging, handler) {
284
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
260
285
  return messaging.setBackgroundMessageHandler.call(messaging, handler, MODULAR_DEPRECATION_ARG);
261
286
  }
262
287
 
263
288
  /**
264
289
  * Set a handler function which is called when the `${App Name} notifications settings`
265
290
  * link in iOS settings is clicked.
266
- * @param {Messaging} messaging - Messaging instance.
267
- * @param {(message: RemoteMessage) => any} handler - Called when link in iOS settings is clicked.
268
- * @returns {void}
291
+ * @param messaging - Messaging instance.
292
+ * @param handler - Called when link in iOS settings is clicked.
293
+ * @returns void
269
294
  */
270
295
  export function setOpenSettingsForNotificationsHandler(messaging, handler) {
271
- return messaging.setOpenSettingsForNotificationsHandler.call(
272
- messaging,
273
- handler,
274
- MODULAR_DEPRECATION_ARG,
275
- );
296
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
297
+ return messaging.setOpenSettingsForNotificationsHandler.call(messaging, handler, MODULAR_DEPRECATION_ARG);
276
298
  }
277
299
 
278
300
  /**
279
301
  * Send a new `RemoteMessage` to the FCM server.
280
- * @param {Messaging} messaging - Messaging instance.
281
- * @param {RemoteMessage} message - A `RemoteMessage` interface.
282
- * @returns {Promise<void>}
302
+ * @param messaging - Messaging instance.
303
+ * @param message - A `RemoteMessage` interface.
304
+ * @returns Promise that resolves when the message is sent.
283
305
  */
284
306
  export function sendMessage(messaging, message) {
307
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
285
308
  return messaging.sendMessage.call(messaging, message, MODULAR_DEPRECATION_ARG);
286
309
  }
287
310
 
288
311
  /**
289
312
  * Apps can subscribe to a topic, which allows the FCM server to send targeted messages to only those
290
313
  * devices subscribed to that topic.
291
- * @param {Messaging} messaging - Messaging instance.
292
- * @param {string} topic - The topic name.
293
- * @returns {Promise<void>}
314
+ * @param messaging - Messaging instance.
315
+ * @param topic - The topic name.
316
+ * @returns Promise that resolves when the subscription is complete.
294
317
  */
295
318
  export function subscribeToTopic(messaging, topic) {
319
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
296
320
  return messaging.subscribeToTopic.call(messaging, topic, MODULAR_DEPRECATION_ARG);
297
321
  }
298
322
 
299
323
  /**
300
324
  * Unsubscribe the device from a topic.
301
- * @param {Messaging} messaging - Messaging instance.
302
- * @param {string} topic - The topic name.
303
- * @returns {Promise<void>}
325
+ * @param messaging - Messaging instance.
326
+ * @param topic - The topic name.
327
+ * @returns Promise that resolves when the unsubscription is complete.
304
328
  */
305
329
  export function unsubscribeFromTopic(messaging, topic) {
330
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
306
331
  return messaging.unsubscribeFromTopic.call(messaging, topic, MODULAR_DEPRECATION_ARG);
307
332
  }
308
333
 
309
334
  /**
310
335
  * Returns a boolean whether message delivery metrics are exported to BigQuery.
311
- * @param {Messaging} messaging - Messaging instance.
312
- * @returns {boolean}
336
+ * @param messaging - Messaging instance.
337
+ * @returns Boolean indicating if message delivery metrics are exported to BigQuery.
313
338
  */
314
339
  export function isDeliveryMetricsExportToBigQueryEnabled(messaging) {
315
340
  return withModularFlag(() => messaging.isDeliveryMetricsExportToBigQueryEnabled);
@@ -318,8 +343,8 @@ export function isDeliveryMetricsExportToBigQueryEnabled(messaging) {
318
343
  /**
319
344
  * Returns a boolean whether message delegation is enabled. Android only,
320
345
  * always returns false on iOS
321
- * @param {Messaging} messaging - Messaging instance.
322
- * @returns {boolean}
346
+ * @param messaging - Messaging instance.
347
+ * @returns Boolean indicating if notification delegation is enabled.
323
348
  */
324
349
  export function isNotificationDelegationEnabled(messaging) {
325
350
  return withModularFlag(() => messaging.isNotificationDelegationEnabled);
@@ -329,44 +354,35 @@ export function isNotificationDelegationEnabled(messaging) {
329
354
  * Sets whether message notification delegation is enabled or disabled.
330
355
  * The value is false by default. Set this to true to allow delegation of notification to Google Play Services.
331
356
  * Note if true message handlers will not function on Android, and it has no effect on iOS
332
- * @param {Messaging} messaging - Messaging instance.
333
- * @param {boolean} enabled - A boolean value to enable or disable delegation of messages to Google Play Services.
334
- * @returns {Promise<void>}
357
+ * @param messaging - Messaging instance.
358
+ * @param enabled - A boolean value to enable or disable delegation of messages to Google Play Services.
359
+ * @returns Promise that resolves when the setting is updated.
335
360
  */
336
361
  export function setNotificationDelegationEnabled(messaging, enabled) {
337
- return messaging.setNotificationDelegationEnabled.call(
338
- messaging,
339
- enabled,
340
- MODULAR_DEPRECATION_ARG,
341
- );
362
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
363
+ return messaging.setNotificationDelegationEnabled.call(messaging, enabled, MODULAR_DEPRECATION_ARG);
342
364
  }
343
365
 
344
366
  /**
345
367
  * Checks if all required APIs exist in the browser.
346
- * @param {Messaging} messaging - Messaging instance.
347
- * @returns {boolean}
368
+ * @param messaging - Messaging instance.
369
+ * @returns Promise that resolves with a boolean indicating if the APIs are supported.
348
370
  */
349
371
  export function isSupported(messaging) {
372
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
350
373
  return messaging.isSupported.call(messaging, MODULAR_DEPRECATION_ARG);
351
374
  }
352
375
 
353
376
  /**
354
377
  * Sets whether message delivery metrics are exported to BigQuery is enabled or disabled.
355
378
  * The value is false by default. Set this to true to allow exporting of message delivery metrics to BigQuery.
356
- * @param {Messaging} messaging - Messaging instance.
357
- * @param {boolean} enabled - A boolean value to enable or disable exporting of message delivery metrics to BigQuery.
358
- * @returns {Promise<void>}
379
+ * @param messaging - Messaging instance.
380
+ * @param enabled - A boolean value to enable or disable exporting of message delivery metrics to BigQuery.
381
+ * @returns Promise that resolves when the setting is updated.
359
382
  */
360
383
  export function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging, enabled) {
361
- return messaging.setDeliveryMetricsExportToBigQuery.call(
362
- messaging,
363
- enabled,
364
- MODULAR_DEPRECATION_ARG,
365
- );
384
+ // @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
385
+ return messaging.setDeliveryMetricsExportToBigQuery.call(messaging, enabled, MODULAR_DEPRECATION_ARG);
366
386
  }
367
-
368
- export {
369
- AuthorizationStatus,
370
- NotificationAndroidPriority,
371
- NotificationAndroidVisibility,
372
- } from '../statics';
387
+ export { AuthorizationStatus, NotificationAndroidPriority, NotificationAndroidVisibility } from "./statics.js";
388
+ //# sourceMappingURL=modular.js.map