@metamask-previews/notification-services-controller 0.1.0-preview-caf274f8 → 0.1.0-preview-ed5d0223
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/NotificationServicesController/NotificationServicesController.js +3 -3
- package/dist/NotificationServicesController/NotificationServicesController.mjs +2 -2
- package/dist/NotificationServicesController/constants/constants.js +1 -1
- package/dist/NotificationServicesController/constants/constants.mjs +1 -1
- package/dist/NotificationServicesController/constants/index.js +2 -2
- package/dist/NotificationServicesController/constants/index.mjs +2 -2
- package/dist/NotificationServicesController/constants/notification-schema.js +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.mjs +1 -1
- package/dist/NotificationServicesController/index.js +6 -6
- package/dist/NotificationServicesController/index.mjs +5 -5
- package/dist/NotificationServicesController/processors/index.js +2 -2
- package/dist/NotificationServicesController/processors/index.mjs +2 -2
- package/dist/NotificationServicesController/processors/process-feature-announcement.js +1 -1
- package/dist/NotificationServicesController/processors/process-feature-announcement.mjs +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.js +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.mjs +1 -1
- package/dist/NotificationServicesController/processors/process-onchain-notifications.js +1 -1
- package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.js +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.mjs +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.js +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.mjs +1 -1
- package/dist/NotificationServicesController/utils/utils.js +1 -1
- package/dist/NotificationServicesController/utils/utils.mjs +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.js +9 -9
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +8 -8
- package/dist/NotificationServicesPushController/constants.js +1 -1
- package/dist/NotificationServicesPushController/constants.mjs +1 -1
- package/dist/NotificationServicesPushController/index.js +12 -12
- package/dist/NotificationServicesPushController/index.mjs +11 -11
- package/dist/NotificationServicesPushController/services/endpoints.js +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.mjs +1 -1
- package/dist/NotificationServicesPushController/services/push/push-web.js +7 -7
- package/dist/NotificationServicesPushController/services/push/push-web.mjs +6 -6
- package/dist/NotificationServicesPushController/services/services.js +8 -8
- package/dist/NotificationServicesPushController/services/services.mjs +7 -7
- package/dist/NotificationServicesPushController/utils/get-notification-data.js +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-data.mjs +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.js +7 -7
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +6 -6
- package/dist/NotificationServicesPushController/utils/index.js +8 -8
- package/dist/NotificationServicesPushController/utils/index.mjs +7 -7
- package/dist/chunk-26CCETCM.mjs +70 -0
- package/dist/chunk-4KZO4UUC.js +4300 -0
- package/dist/chunk-4KZO4UUC.js.map +1 -0
- package/dist/{chunk-TI4UC3G3.mjs → chunk-52NKJDI2.mjs} +6 -5
- package/dist/chunk-52NKJDI2.mjs.map +1 -0
- package/dist/{chunk-IK7KP7N3.js → chunk-CQ6CGSKZ.js} +3 -3
- package/dist/{chunk-6GPIA5G3.js → chunk-DKQBDI4C.js} +35 -35
- package/dist/{chunk-KCIC5BWH.js → chunk-FFQNSBPU.js} +7 -7
- package/dist/chunk-HCOBC2R5.mjs +4300 -0
- package/dist/chunk-HCOBC2R5.mjs.map +1 -0
- package/dist/{chunk-DBTJ34DS.mjs → chunk-JLHFZ2UG.mjs} +3 -3
- package/dist/{chunk-TS2NQOUA.mjs → chunk-LFD7J7KR.mjs} +33 -6
- package/dist/chunk-LFD7J7KR.mjs.map +1 -0
- package/dist/{chunk-H4RSHSWR.js → chunk-NJBJIZLR.js} +7 -6
- package/dist/chunk-NJBJIZLR.js.map +1 -0
- package/dist/{chunk-QJTZL7TJ.js → chunk-NMLYB3XT.js} +4 -4
- package/dist/{chunk-O6RMA2N6.js → chunk-NXXY4CAP.js} +36 -9
- package/dist/chunk-NXXY4CAP.js.map +1 -0
- package/dist/{chunk-ZFNFSLS6.mjs → chunk-ODZ6V4PH.mjs} +4 -4
- package/dist/{chunk-ABFHAGGB.js → chunk-PGMXFZ6Y.js} +3 -3
- package/dist/{chunk-57S5B7X2.mjs → chunk-QTK2RMF7.mjs} +2 -2
- package/dist/{chunk-YSNDM6BH.mjs → chunk-RYAHBEX2.mjs} +6 -26
- package/dist/chunk-RYAHBEX2.mjs.map +1 -0
- package/dist/{chunk-AHEMTJDE.mjs → chunk-SSWX2N73.mjs} +2 -2
- package/dist/{chunk-CQI6FYPZ.mjs → chunk-TT56I53C.mjs} +2 -2
- package/dist/{chunk-6265FKB5.js → chunk-UPVIT75F.js} +3 -3
- package/dist/chunk-V46WVGWN.js +70 -0
- package/dist/{chunk-QSFGJCPI.mjs → chunk-VE4DTN4R.mjs} +2 -2
- package/dist/{chunk-DOYL2MCR.js → chunk-YRWUXGL3.js} +82 -102
- package/dist/chunk-YRWUXGL3.js.map +1 -0
- package/dist/index.js +12 -12
- package/dist/index.mjs +11 -11
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/NotificationServicesController/NotificationServicesController.d.ts +0 -2
- package/dist/types/NotificationServicesController/NotificationServicesController.d.ts.map +1 -1
- package/dist/types/NotificationServicesController/__fixtures__/index.d.ts +1 -0
- package/dist/types/NotificationServicesController/__fixtures__/index.d.ts.map +1 -1
- package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts +1 -0
- package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-DOYL2MCR.js.map +0 -1
- package/dist/chunk-H4RSHSWR.js.map +0 -1
- package/dist/chunk-IGY2S5BC.js +0 -36
- package/dist/chunk-NBRY7XVG.mjs +0 -925
- package/dist/chunk-NBRY7XVG.mjs.map +0 -1
- package/dist/chunk-O6RMA2N6.js.map +0 -1
- package/dist/chunk-TI4UC3G3.mjs.map +0 -1
- package/dist/chunk-TS2NQOUA.mjs.map +0 -1
- package/dist/chunk-U5UIDVOO.mjs +0 -36
- package/dist/chunk-XYIGTTEP.js +0 -925
- package/dist/chunk-XYIGTTEP.js.map +0 -1
- package/dist/chunk-YSNDM6BH.mjs.map +0 -1
- /package/dist/{chunk-U5UIDVOO.mjs.map → chunk-26CCETCM.mjs.map} +0 -0
- /package/dist/{chunk-IK7KP7N3.js.map → chunk-CQ6CGSKZ.js.map} +0 -0
- /package/dist/{chunk-6GPIA5G3.js.map → chunk-DKQBDI4C.js.map} +0 -0
- /package/dist/{chunk-KCIC5BWH.js.map → chunk-FFQNSBPU.js.map} +0 -0
- /package/dist/{chunk-DBTJ34DS.mjs.map → chunk-JLHFZ2UG.mjs.map} +0 -0
- /package/dist/{chunk-QJTZL7TJ.js.map → chunk-NMLYB3XT.js.map} +0 -0
- /package/dist/{chunk-ZFNFSLS6.mjs.map → chunk-ODZ6V4PH.mjs.map} +0 -0
- /package/dist/{chunk-ABFHAGGB.js.map → chunk-PGMXFZ6Y.js.map} +0 -0
- /package/dist/{chunk-57S5B7X2.mjs.map → chunk-QTK2RMF7.mjs.map} +0 -0
- /package/dist/{chunk-AHEMTJDE.mjs.map → chunk-SSWX2N73.mjs.map} +0 -0
- /package/dist/{chunk-CQI6FYPZ.mjs.map → chunk-TT56I53C.mjs.map} +0 -0
- /package/dist/{chunk-6265FKB5.js.map → chunk-UPVIT75F.js.map} +0 -0
- /package/dist/{chunk-IGY2S5BC.js.map → chunk-V46WVGWN.js.map} +0 -0
- /package/dist/{chunk-QSFGJCPI.mjs.map → chunk-VE4DTN4R.mjs.map} +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
processors_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QTK2RMF7.mjs";
|
|
4
4
|
|
|
5
5
|
// src/NotificationServicesPushController/services/push/push-web.ts
|
|
6
6
|
import { getApp, initializeApp } from "firebase/app";
|
|
7
7
|
import { getToken, deleteToken } from "firebase/messaging";
|
|
8
8
|
import { getMessaging, onBackgroundMessage } from "firebase/messaging/sw";
|
|
9
9
|
import log from "loglevel";
|
|
10
|
+
var sw = self;
|
|
10
11
|
var createFirebaseApp = async (env) => {
|
|
11
12
|
try {
|
|
12
13
|
return getApp();
|
|
@@ -31,7 +32,7 @@ async function createRegToken(env) {
|
|
|
31
32
|
try {
|
|
32
33
|
const messaging = await getFirebaseMessaging(env);
|
|
33
34
|
const token = await getToken(messaging, {
|
|
34
|
-
serviceWorkerRegistration:
|
|
35
|
+
serviceWorkerRegistration: sw.registration,
|
|
35
36
|
vapidKey: env.vapidKey
|
|
36
37
|
});
|
|
37
38
|
return token;
|
|
@@ -78,8 +79,8 @@ function listenToPushNotificationsClicked(handler) {
|
|
|
78
79
|
const data = event?.notification?.data;
|
|
79
80
|
handler(event, data);
|
|
80
81
|
};
|
|
81
|
-
|
|
82
|
-
const unsubscribe = () =>
|
|
82
|
+
sw.addEventListener("notificationclick", clickHandler);
|
|
83
|
+
const unsubscribe = () => sw.removeEventListener("notificationclick", clickHandler);
|
|
83
84
|
return unsubscribe;
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -89,4 +90,4 @@ export {
|
|
|
89
90
|
listenToPushNotificationsReceived,
|
|
90
91
|
listenToPushNotificationsClicked
|
|
91
92
|
};
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
93
|
+
//# sourceMappingURL=chunk-52NKJDI2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/NotificationServicesPushController/services/push/push-web.ts"],"sourcesContent":["// We are defining that this file uses a webworker global scope.\n// eslint-disable-next-line spaced-comment\n/// <reference lib=\"webworker\" />\nimport type { FirebaseApp } from 'firebase/app';\nimport { getApp, initializeApp } from 'firebase/app';\nimport { getToken, deleteToken } from 'firebase/messaging';\nimport { getMessaging, onBackgroundMessage } from 'firebase/messaging/sw';\nimport type { Messaging, MessagePayload } from 'firebase/messaging/sw';\nimport log from 'loglevel';\n\nimport type { Types } from '../../../NotificationServicesController';\nimport { Processors } from '../../../NotificationServicesController';\nimport type { PushNotificationEnv } from '../../types/firebase';\n\nconst sw = self as unknown as ServiceWorkerGlobalScope;\n\nconst createFirebaseApp = async (\n env: PushNotificationEnv,\n): Promise<FirebaseApp> => {\n try {\n return getApp();\n } catch {\n const firebaseConfig = {\n apiKey: env.apiKey,\n authDomain: env.authDomain,\n storageBucket: env.storageBucket,\n projectId: env.projectId,\n messagingSenderId: env.messagingSenderId,\n appId: env.appId,\n measurementId: env.measurementId,\n };\n return initializeApp(firebaseConfig);\n }\n};\n\nconst getFirebaseMessaging = async (\n env: PushNotificationEnv,\n): Promise<Messaging> => {\n const app = await createFirebaseApp(env);\n return getMessaging(app);\n};\n\n/**\n * Creates a registration token for Firebase Cloud Messaging.\n *\n * @param env - env to configure push notifications\n * @returns A promise that resolves with the registration token or null if an error occurs.\n */\nexport async function createRegToken(\n env: PushNotificationEnv,\n): Promise<string | null> {\n try {\n const messaging = await getFirebaseMessaging(env);\n const token = await getToken(messaging, {\n serviceWorkerRegistration: sw.registration,\n vapidKey: env.vapidKey,\n });\n return token;\n } catch {\n return null;\n }\n}\n\n/**\n * Deletes the Firebase Cloud Messaging registration token.\n *\n * @param env - env to configure push notifications\n * @returns A promise that resolves with true if the token was successfully deleted, false otherwise.\n */\nexport async function deleteRegToken(\n env: PushNotificationEnv,\n): Promise<boolean> {\n try {\n const messaging = await getFirebaseMessaging(env);\n await deleteToken(messaging);\n return true;\n } catch (error) {\n return false;\n }\n}\n\n/**\n * Service Worker Listener for when push notifications are received.\n * @param env - push notification environment\n * @param handler - handler to actually showing notification, MUST BE PROVEDED\n * @returns unsubscribe handler\n */\nexport async function listenToPushNotificationsReceived(\n env: PushNotificationEnv,\n handler: (notification: Types.INotification) => void | Promise<void>,\n) {\n const messaging = await getFirebaseMessaging(env);\n const unsubscribePushNotifications = onBackgroundMessage(\n messaging,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async (payload: MessagePayload) => {\n try {\n const notificationData: Types.NotificationUnion = payload?.data?.data\n ? JSON.parse(payload?.data?.data)\n : undefined;\n\n if (!notificationData) {\n return;\n }\n\n const notification = Processors.processNotification(notificationData);\n await handler(notification);\n } catch (error) {\n // Do Nothing, cannot parse a bad notification\n log.error('Unable to send push notification:', {\n notification: payload?.data?.data,\n error,\n });\n throw new Error('Unable to send push notification');\n }\n },\n );\n\n const unsubscribe = () => unsubscribePushNotifications();\n return unsubscribe;\n}\n\n/**\n * Service Worker Listener for when a notification is clicked\n *\n * @param handler - listen to NotificationEvent from the service worker\n * @returns unsubscribe handler\n */\nexport function listenToPushNotificationsClicked(\n handler: (e: NotificationEvent, notification?: Types.INotification) => void,\n) {\n const clickHandler = (event: NotificationEvent) => {\n // Get Data\n const data: Types.INotification = event?.notification?.data;\n handler(event, data);\n };\n\n sw.addEventListener('notificationclick', clickHandler);\n const unsubscribe = () =>\n sw.removeEventListener('notificationclick', clickHandler);\n return unsubscribe;\n}\n"],"mappings":";;;;;AAIA,SAAS,QAAQ,qBAAqB;AACtC,SAAS,UAAU,mBAAmB;AACtC,SAAS,cAAc,2BAA2B;AAElD,OAAO,SAAS;AAMhB,IAAM,KAAK;AAEX,IAAM,oBAAoB,OACxB,QACyB;AACzB,MAAI;AACF,WAAO,OAAO;AAAA,EAChB,QAAQ;AACN,UAAM,iBAAiB;AAAA,MACrB,QAAQ,IAAI;AAAA,MACZ,YAAY,IAAI;AAAA,MAChB,eAAe,IAAI;AAAA,MACnB,WAAW,IAAI;AAAA,MACf,mBAAmB,IAAI;AAAA,MACvB,OAAO,IAAI;AAAA,MACX,eAAe,IAAI;AAAA,IACrB;AACA,WAAO,cAAc,cAAc;AAAA,EACrC;AACF;AAEA,IAAM,uBAAuB,OAC3B,QACuB;AACvB,QAAM,MAAM,MAAM,kBAAkB,GAAG;AACvC,SAAO,aAAa,GAAG;AACzB;AAQA,eAAsB,eACpB,KACwB;AACxB,MAAI;AACF,UAAM,YAAY,MAAM,qBAAqB,GAAG;AAChD,UAAM,QAAQ,MAAM,SAAS,WAAW;AAAA,MACtC,2BAA2B,GAAG;AAAA,MAC9B,UAAU,IAAI;AAAA,IAChB,CAAC;AACD,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAQA,eAAsB,eACpB,KACkB;AAClB,MAAI;AACF,UAAM,YAAY,MAAM,qBAAqB,GAAG;AAChD,UAAM,YAAY,SAAS;AAC3B,WAAO;AAAA,EACT,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAQA,eAAsB,kCACpB,KACA,SACA;AACA,QAAM,YAAY,MAAM,qBAAqB,GAAG;AAChD,QAAM,+BAA+B;AAAA,IACnC;AAAA;AAAA,IAEA,OAAO,YAA4B;AACjC,UAAI;AACF,cAAM,mBAA4C,SAAS,MAAM,OAC7D,KAAK,MAAM,SAAS,MAAM,IAAI,IAC9B;AAEJ,YAAI,CAAC,kBAAkB;AACrB;AAAA,QACF;AAEA,cAAM,eAAe,mBAAW,oBAAoB,gBAAgB;AACpE,cAAM,QAAQ,YAAY;AAAA,MAC5B,SAAS,OAAO;AAEd,YAAI,MAAM,qCAAqC;AAAA,UAC7C,cAAc,SAAS,MAAM;AAAA,UAC7B;AAAA,QACF,CAAC;AACD,cAAM,IAAI,MAAM,kCAAkC;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,MAAM,6BAA6B;AACvD,SAAO;AACT;AAQO,SAAS,iCACd,SACA;AACA,QAAM,eAAe,CAAC,UAA6B;AAEjD,UAAM,OAA4B,OAAO,cAAc;AACvD,YAAQ,OAAO,IAAI;AAAA,EACrB;AAEA,KAAG,iBAAiB,qBAAqB,YAAY;AACrD,QAAM,cAAc,MAClB,GAAG,oBAAoB,qBAAqB,YAAY;AAC1D,SAAO;AACT;","names":[]}
|
|
@@ -13,11 +13,11 @@ var _chunkDY4ELDRQjs = require('./chunk-DY4ELDRQ.js');
|
|
|
13
13
|
var _chunkTLX5QQK5js = require('./chunk-TLX5QQK5.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkV46WVGWNjs = require('./chunk-V46WVGWN.js');
|
|
17
17
|
|
|
18
18
|
// src/NotificationServicesController/constants/index.ts
|
|
19
19
|
var constants_exports = {};
|
|
20
|
-
|
|
20
|
+
_chunkV46WVGWNjs.__export.call(void 0, constants_exports, {
|
|
21
21
|
CHAIN_SYMBOLS: () => _chunkDY4ELDRQjs.CHAIN_SYMBOLS,
|
|
22
22
|
NOTIFICATION_CHAINS: () => _chunkDY4ELDRQjs.NOTIFICATION_CHAINS,
|
|
23
23
|
SUPPORTED_CHAINS: () => _chunkDY4ELDRQjs.SUPPORTED_CHAINS,
|
|
@@ -32,4 +32,4 @@ _chunkIGY2S5BCjs.__export.call(void 0, constants_exports, {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
exports.constants_exports = constants_exports;
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-CQ6CGSKZ.js.map
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkNMLYB3XTjs = require('./chunk-NMLYB3XT.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkNJBJIZLRjs = require('./chunk-NJBJIZLR.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkV46WVGWNjs = require('./chunk-V46WVGWN.js');
|
|
17
17
|
|
|
18
18
|
// src/NotificationServicesPushController/NotificationServicesPushController.ts
|
|
19
19
|
var _basecontroller = require('@metamask/base-controller');
|
|
@@ -41,14 +41,14 @@ var NotificationServicesPushController = class extends _basecontroller.BaseContr
|
|
|
41
41
|
fcmToken: state?.fcmToken || ""
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
_chunkV46WVGWNjs.__privateAdd.call(void 0, this, _registerMessageHandlers);
|
|
45
|
+
_chunkV46WVGWNjs.__privateAdd.call(void 0, this, _getAndAssertBearerToken);
|
|
46
|
+
_chunkV46WVGWNjs.__privateAdd.call(void 0, this, _pushListenerUnsubscribe, void 0);
|
|
47
|
+
_chunkV46WVGWNjs.__privateAdd.call(void 0, this, _env, void 0);
|
|
48
|
+
_chunkV46WVGWNjs.__privateAdd.call(void 0, this, _config, void 0);
|
|
49
|
+
_chunkV46WVGWNjs.__privateSet.call(void 0, this, _env, env);
|
|
50
|
+
_chunkV46WVGWNjs.__privateSet.call(void 0, this, _config, config);
|
|
51
|
+
_chunkV46WVGWNjs.__privateMethod.call(void 0, this, _registerMessageHandlers, registerMessageHandlers_fn).call(this);
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Enables push notifications for the application.
|
|
@@ -61,29 +61,29 @@ var NotificationServicesPushController = class extends _basecontroller.BaseContr
|
|
|
61
61
|
* @param UUIDs - An array of UUIDs to enable push notifications for.
|
|
62
62
|
*/
|
|
63
63
|
async enablePushNotifications(UUIDs) {
|
|
64
|
-
if (!
|
|
64
|
+
if (!_chunkV46WVGWNjs.__privateGet.call(void 0, this, _config).isPushEnabled) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
const bearerToken = await
|
|
67
|
+
const bearerToken = await _chunkV46WVGWNjs.__privateMethod.call(void 0, this, _getAndAssertBearerToken, getAndAssertBearerToken_fn).call(this);
|
|
68
68
|
try {
|
|
69
|
-
const regToken = await
|
|
69
|
+
const regToken = await _chunkNMLYB3XTjs.activatePushNotifications.call(void 0, {
|
|
70
70
|
bearerToken,
|
|
71
71
|
triggers: UUIDs,
|
|
72
|
-
env:
|
|
73
|
-
createRegToken:
|
|
74
|
-
platform:
|
|
72
|
+
env: _chunkV46WVGWNjs.__privateGet.call(void 0, this, _env),
|
|
73
|
+
createRegToken: _chunkNJBJIZLRjs.createRegToken,
|
|
74
|
+
platform: _chunkV46WVGWNjs.__privateGet.call(void 0, this, _config).platform
|
|
75
75
|
});
|
|
76
76
|
if (!regToken) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
env:
|
|
79
|
+
_chunkV46WVGWNjs.__privateSet.call(void 0, this, _pushListenerUnsubscribe, await _chunkNMLYB3XTjs.listenToPushNotifications.call(void 0, {
|
|
80
|
+
env: _chunkV46WVGWNjs.__privateGet.call(void 0, this, _env),
|
|
81
81
|
listenToPushReceived: async (n) => {
|
|
82
82
|
this.messagingSystem.publish(
|
|
83
83
|
"NotificationServicesPushController:onNewNotifications",
|
|
84
84
|
n
|
|
85
85
|
);
|
|
86
|
-
await
|
|
86
|
+
await _chunkV46WVGWNjs.__privateGet.call(void 0, this, _config).onPushNotificationReceived(n);
|
|
87
87
|
},
|
|
88
88
|
listenToPushClicked: (e, n) => {
|
|
89
89
|
if (n) {
|
|
@@ -92,7 +92,7 @@ var NotificationServicesPushController = class extends _basecontroller.BaseContr
|
|
|
92
92
|
n
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
_chunkV46WVGWNjs.__privateGet.call(void 0, this, _config).onPushNotificationClicked(e);
|
|
96
96
|
}
|
|
97
97
|
}));
|
|
98
98
|
this.update((state) => {
|
|
@@ -114,17 +114,17 @@ var NotificationServicesPushController = class extends _basecontroller.BaseContr
|
|
|
114
114
|
*/
|
|
115
115
|
async disablePushNotifications(UUIDs) {
|
|
116
116
|
var _a;
|
|
117
|
-
if (!
|
|
117
|
+
if (!_chunkV46WVGWNjs.__privateGet.call(void 0, this, _config).isPushEnabled) {
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
const bearerToken = await
|
|
120
|
+
const bearerToken = await _chunkV46WVGWNjs.__privateMethod.call(void 0, this, _getAndAssertBearerToken, getAndAssertBearerToken_fn).call(this);
|
|
121
121
|
let isPushNotificationsDisabled;
|
|
122
122
|
try {
|
|
123
|
-
isPushNotificationsDisabled = await
|
|
123
|
+
isPushNotificationsDisabled = await _chunkNMLYB3XTjs.deactivatePushNotifications.call(void 0, {
|
|
124
124
|
bearerToken,
|
|
125
125
|
triggers: UUIDs,
|
|
126
|
-
env:
|
|
127
|
-
deleteRegToken:
|
|
126
|
+
env: _chunkV46WVGWNjs.__privateGet.call(void 0, this, _env),
|
|
127
|
+
deleteRegToken: _chunkNJBJIZLRjs.deleteRegToken,
|
|
128
128
|
regToken: this.state.fcmToken
|
|
129
129
|
});
|
|
130
130
|
} catch (error) {
|
|
@@ -135,7 +135,7 @@ var NotificationServicesPushController = class extends _basecontroller.BaseContr
|
|
|
135
135
|
if (!isPushNotificationsDisabled) {
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
|
-
(_a =
|
|
138
|
+
(_a = _chunkV46WVGWNjs.__privateGet.call(void 0, this, _pushListenerUnsubscribe)) == null ? void 0 : _a.call(this);
|
|
139
139
|
if (isPushNotificationsDisabled) {
|
|
140
140
|
this.update((state) => {
|
|
141
141
|
state.fcmToken = "";
|
|
@@ -150,18 +150,18 @@ var NotificationServicesPushController = class extends _basecontroller.BaseContr
|
|
|
150
150
|
* @param UUIDs - An array of UUIDs that should trigger push notifications.
|
|
151
151
|
*/
|
|
152
152
|
async updateTriggerPushNotifications(UUIDs) {
|
|
153
|
-
if (!
|
|
153
|
+
if (!_chunkV46WVGWNjs.__privateGet.call(void 0, this, _config).isPushEnabled) {
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
const bearerToken = await
|
|
156
|
+
const bearerToken = await _chunkV46WVGWNjs.__privateMethod.call(void 0, this, _getAndAssertBearerToken, getAndAssertBearerToken_fn).call(this);
|
|
157
157
|
try {
|
|
158
|
-
const { fcmToken } = await
|
|
158
|
+
const { fcmToken } = await _chunkNMLYB3XTjs.updateTriggerPushNotifications.call(void 0, {
|
|
159
159
|
bearerToken,
|
|
160
160
|
triggers: UUIDs,
|
|
161
|
-
env:
|
|
162
|
-
createRegToken:
|
|
163
|
-
deleteRegToken:
|
|
164
|
-
platform:
|
|
161
|
+
env: _chunkV46WVGWNjs.__privateGet.call(void 0, this, _env),
|
|
162
|
+
createRegToken: _chunkNJBJIZLRjs.createRegToken,
|
|
163
|
+
deleteRegToken: _chunkNJBJIZLRjs.deleteRegToken,
|
|
164
|
+
platform: _chunkV46WVGWNjs.__privateGet.call(void 0, this, _config).platform,
|
|
165
165
|
regToken: this.state.fcmToken
|
|
166
166
|
});
|
|
167
167
|
if (fcmToken) {
|
|
@@ -211,4 +211,4 @@ getAndAssertBearerToken_fn = async function() {
|
|
|
211
211
|
|
|
212
212
|
|
|
213
213
|
exports.NotificationServicesPushController = NotificationServicesPushController;
|
|
214
|
-
//# sourceMappingURL=chunk-
|
|
214
|
+
//# sourceMappingURL=chunk-DKQBDI4C.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkPGMXFZ6Yjs = require('./chunk-PGMXFZ6Y.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -11,21 +11,21 @@ var _chunkABFHAGGBjs = require('./chunk-ABFHAGGB.js');
|
|
|
11
11
|
var _chunkEJ52BDLBjs = require('./chunk-EJ52BDLB.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkV46WVGWNjs = require('./chunk-V46WVGWN.js');
|
|
15
15
|
|
|
16
16
|
// src/NotificationServicesPushController/utils/index.ts
|
|
17
17
|
var utils_exports = {};
|
|
18
|
-
|
|
18
|
+
_chunkV46WVGWNjs.__export.call(void 0, utils_exports, {
|
|
19
19
|
calcTokenAmount: () => _chunkEJ52BDLBjs.calcTokenAmount,
|
|
20
|
-
createOnChainPushNotificationMessage: () =>
|
|
21
|
-
createOnChainPushNotificationMessages: () =>
|
|
20
|
+
createOnChainPushNotificationMessage: () => _chunkPGMXFZ6Yjs.createOnChainPushNotificationMessage,
|
|
21
|
+
createOnChainPushNotificationMessages: () => _chunkPGMXFZ6Yjs.createOnChainPushNotificationMessages,
|
|
22
22
|
formatAmount: () => _chunkEJ52BDLBjs.formatAmount,
|
|
23
23
|
getAmount: () => _chunkEJ52BDLBjs.getAmount,
|
|
24
24
|
getLeadingZeroCount: () => _chunkEJ52BDLBjs.getLeadingZeroCount,
|
|
25
|
-
isOnChainNotification: () =>
|
|
25
|
+
isOnChainNotification: () => _chunkPGMXFZ6Yjs.isOnChainNotification
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
exports.utils_exports = utils_exports;
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
31
|
+
//# sourceMappingURL=chunk-FFQNSBPU.js.map
|