@metamask/notification-services-controller 1.0.0 → 3.0.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.
- package/CHANGELOG.md +21 -1
- package/README.md +35 -1
- package/dist/NotificationServicesController/NotificationServicesController.cjs +5 -2
- package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.mjs +5 -2
- package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
- package/dist/NotificationServicesController/index.cjs +1 -1
- package/dist/NotificationServicesController/index.cjs.map +1 -1
- package/dist/NotificationServicesController/index.d.cts +1 -1
- package/dist/NotificationServicesController/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/index.d.mts +1 -1
- package/dist/NotificationServicesController/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/index.mjs +1 -1
- package/dist/NotificationServicesController/index.mjs.map +1 -1
- package/dist/NotificationServicesController/mocks/index.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/index.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-snap-notification.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-snap-notification.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-snap-notification.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-snap-notification.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mockResponses.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mockResponses.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mockResponses.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mockResponses.mjs.map +1 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +2 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +4 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +4 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +2 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
- package/dist/NotificationServicesPushController/index.cjs +1 -1
- package/dist/NotificationServicesPushController/index.cjs.map +1 -1
- package/dist/NotificationServicesPushController/index.d.cts +1 -1
- package/dist/NotificationServicesPushController/index.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/index.d.mts +1 -1
- package/dist/NotificationServicesPushController/index.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/index.mjs +1 -1
- package/dist/NotificationServicesPushController/index.mjs.map +1 -1
- package/dist/NotificationServicesPushController/mocks/index.cjs.map +1 -0
- package/dist/NotificationServicesPushController/mocks/index.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/mocks/index.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/mocks/index.mjs.map +1 -0
- package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.cjs +2 -2
- package/dist/NotificationServicesPushController/mocks/mockResponse.cjs.map +1 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.mjs +2 -2
- package/dist/NotificationServicesPushController/mocks/mockResponse.mjs.map +1 -0
- package/dist/NotificationServicesPushController/services/services.cjs +6 -4
- package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.cts +3 -0
- package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.mts +3 -0
- package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.mjs +6 -4
- package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
- package/notification-services/mocks/package.json +2 -2
- package/package.json +14 -14
- package/push-services/mocks/package.json +2 -2
- package/dist/NotificationServicesController/__fixtures__/index.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/index.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.cjs +0 -6
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.d.cts +0 -3
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.d.mts +0 -3
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.mjs +0 -3
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockResponses.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockResponses.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockServices.cjs +0 -56
- package/dist/NotificationServicesController/__fixtures__/mockServices.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.cts +0 -12
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.mts +0 -12
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockServices.mjs +0 -52
- package/dist/NotificationServicesController/__fixtures__/mockServices.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.cjs +0 -31
- package/dist/NotificationServicesController/__fixtures__/test-utils.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.cts +0 -14
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.mts +0 -14
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.mjs +0 -27
- package/dist/NotificationServicesController/__fixtures__/test-utils.mjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/index.cjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/index.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/index.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/index.mjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.cjs +0 -14
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.cjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.cts +0 -3
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.mts +0 -3
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.mjs +0 -10
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.mjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs +0 -19
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.cts +0 -8
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts +0 -8
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs +0 -19
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs.map +0 -1
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/index.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/index.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/index.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/index.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-feature-announcements.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-feature-announcements.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-feature-announcements.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-feature-announcements.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-trigger.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-trigger.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-trigger.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-trigger.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-user-storage.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-user-storage.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-user-storage.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-user-storage.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-raw-notifications.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-raw-notifications.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-raw-notifications.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-raw-notifications.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-snap-notification.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-snap-notification.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-snap-notification.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-snap-notification.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mockResponses.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mockResponses.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mockResponses.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mockResponses.mjs +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/index.cjs +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/index.d.cts +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/index.d.mts +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/index.mjs +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.d.cts +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.d.mts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/NotificationServicesPushController/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,iDAA6C;AAE9D,QAAA,MAAM,kCAAkC,mBAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,eAAe,kCAAkC,CAAC;AAClD,yDAAqD;AACrD,YAAY,KAAK,KAAK,0BAAgB;AACtC,uCAA6B;AAC7B,OAAO,KAAK,KAAK,0BAAgB;AACjC,kCAAwB;AACxB,OAAO,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/NotificationServicesPushController/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,iDAA6C;AAE9D,QAAA,MAAM,kCAAkC,mBAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,eAAe,kCAAkC,CAAC;AAClD,yDAAqD;AACrD,YAAY,KAAK,KAAK,0BAAgB;AACtC,uCAA6B;AAC7B,OAAO,KAAK,KAAK,0BAAgB;AACjC,kCAAwB;AACxB,OAAO,KAAK,KAAK,0BAAgB"}
|
|
@@ -7,5 +7,5 @@ export type * as Types from "./types/index.mjs";
|
|
|
7
7
|
export type * from "./types/index.mjs";
|
|
8
8
|
export * as Utils from "./utils/index.mjs";
|
|
9
9
|
export * from "./utils/index.mjs";
|
|
10
|
-
export * as Mocks from "./
|
|
10
|
+
export * as Mocks from "./mocks/index.mjs";
|
|
11
11
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/NotificationServicesPushController/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,iDAA6C;AAE9D,QAAA,MAAM,kCAAkC,mBAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,eAAe,kCAAkC,CAAC;AAClD,yDAAqD;AACrD,YAAY,KAAK,KAAK,0BAAgB;AACtC,uCAA6B;AAC7B,OAAO,KAAK,KAAK,0BAAgB;AACjC,kCAAwB;AACxB,OAAO,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/NotificationServicesPushController/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,iDAA6C;AAE9D,QAAA,MAAM,kCAAkC,mBAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,eAAe,kCAAkC,CAAC;AAClD,yDAAqD;AACrD,YAAY,KAAK,KAAK,0BAAgB;AACtC,uCAA6B;AAC7B,OAAO,KAAK,KAAK,0BAAgB;AACjC,kCAAwB;AACxB,OAAO,KAAK,KAAK,0BAAgB"}
|
|
@@ -5,5 +5,5 @@ export default NotificationServicesPushController;
|
|
|
5
5
|
export * from "./NotificationServicesPushController.mjs";
|
|
6
6
|
export * as Utils from "./utils/index.mjs";
|
|
7
7
|
export * from "./utils/index.mjs";
|
|
8
|
-
export * as Mocks from "./
|
|
8
|
+
export * as Mocks from "./mocks/index.mjs";
|
|
9
9
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/NotificationServicesPushController/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,iDAA6C;AAE9D,MAAM,kCAAkC,GAAG,UAAU,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,eAAe,kCAAkC,CAAC;AAClD,yDAAqD;AAGrD,OAAO,KAAK,KAAK,0BAAgB;AACjC,kCAAwB;AACxB,OAAO,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/NotificationServicesPushController/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,iDAA6C;AAE9D,MAAM,kCAAkC,GAAG,UAAU,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,eAAe,kCAAkC,CAAC;AAClD,yDAAqD;AAGrD,OAAO,KAAK,KAAK,0BAAgB;AACjC,kCAAwB;AACxB,OAAO,KAAK,KAAK,0BAAgB","sourcesContent":["import Controller from './NotificationServicesPushController';\n\nconst NotificationServicesPushController = Controller;\nexport { Controller };\nexport default NotificationServicesPushController;\nexport * from './NotificationServicesPushController';\nexport type * as Types from './types';\nexport type * from './types';\nexport * as Utils from './utils';\nexport * from './utils';\nexport * as Mocks from './mocks';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/mocks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAA+B","sourcesContent":["export * from './mockResponse';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/mocks/index.ts"],"names":[],"mappings":"AAAA,mCAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/mocks/index.ts"],"names":[],"mappings":"AAAA,mCAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/mocks/index.ts"],"names":[],"mappings":"AAAA,mCAA+B","sourcesContent":["export * from './mockResponse';\n"]}
|
|
@@ -6,8 +6,8 @@ exports.MOCK_REG_TOKEN = 'REG_TOKEN';
|
|
|
6
6
|
exports.MOCK_LINKS_RESPONSE = {
|
|
7
7
|
trigger_ids: ['1', '2', '3'],
|
|
8
8
|
registration_tokens: [
|
|
9
|
-
{ token: 'reg_token_1', platform: 'portfolio' },
|
|
10
|
-
{ token: 'reg_token_2', platform: 'extension' },
|
|
9
|
+
{ token: 'reg_token_1', platform: 'portfolio', locale: 'en' },
|
|
10
|
+
{ token: 'reg_token_2', platform: 'extension', locale: 'en' },
|
|
11
11
|
],
|
|
12
12
|
};
|
|
13
13
|
const getMockRetrievePushNotificationLinksResponse = () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockResponse.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/mocks/mockResponse.ts"],"names":[],"mappings":";;;AAAA,yDAAqE;AASxD,QAAA,cAAc,GAAG,WAAW,CAAC;AAC7B,QAAA,mBAAmB,GAAgB;IAC9C,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC5B,mBAAmB,EAAE;QACnB,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE;QAC7D,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE;KAC9D;CACF,CAAC;AAEK,MAAM,4CAA4C,GAAG,GAAG,EAAE;IAC/D,OAAO;QACL,GAAG,EAAE,wCAA4B;QACjC,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,2BAAmB;KACP,CAAC;AAC3B,CAAC,CAAC;AANW,QAAA,4CAA4C,gDAMvD;AAEK,MAAM,0CAA0C,GAAG,GAAG,EAAE;IAC7D,OAAO;QACL,GAAG,EAAE,wCAA4B;QACjC,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC;AANW,QAAA,0CAA0C,8CAMrD;AAEW,QAAA,iBAAiB,GAAG;IAC/B,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,WAAW;IAClB,GAAG,EAAE;QACH,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,EAAE;QACR,iBAAiB,EAAE,EAAE;KACtB;CACF,CAAC;AAEK,MAAM,yCAAyC,GAAG,GAAG,EAAE;IAC5D,OAAO;QACL,GAAG,EAAE,kEAAkE;QACvE,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,yBAAiB;KACL,CAAC;AAC3B,CAAC,CAAC;AANW,QAAA,yCAAyC,6CAMpD;AAEK,MAAM,yCAAyC,GAAG,GAAG,EAAE;IAC5D,OAAO;QACL,GAAG,EAAE,kEAAkE;QACvE,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,EAAE;KACU,CAAC;AAC3B,CAAC,CAAC;AANW,QAAA,yCAAyC,6CAMpD","sourcesContent":["import { REGISTRATION_TOKENS_ENDPOINT } from '../services/endpoints';\nimport type { LinksResult } from '../services/services';\n\ntype MockResponse = {\n url: string | RegExp;\n requestMethod: 'GET' | 'POST' | 'PUT';\n response: unknown;\n};\n\nexport const MOCK_REG_TOKEN = 'REG_TOKEN';\nexport const MOCK_LINKS_RESPONSE: LinksResult = {\n trigger_ids: ['1', '2', '3'],\n registration_tokens: [\n { token: 'reg_token_1', platform: 'portfolio', locale: 'en' },\n { token: 'reg_token_2', platform: 'extension', locale: 'en' },\n ],\n};\n\nexport const getMockRetrievePushNotificationLinksResponse = () => {\n return {\n url: REGISTRATION_TOKENS_ENDPOINT,\n requestMethod: 'GET',\n response: MOCK_LINKS_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const getMockUpdatePushNotificationLinksResponse = () => {\n return {\n url: REGISTRATION_TOKENS_ENDPOINT,\n requestMethod: 'POST',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const MOCK_FCM_RESPONSE = {\n name: '',\n token: 'fcm-token',\n web: {\n endpoint: '',\n p256dh: '',\n auth: '',\n applicationPubKey: '',\n },\n};\n\nexport const getMockCreateFCMRegistrationTokenResponse = () => {\n return {\n url: /^https:\\/\\/fcmregistrations\\.googleapis\\.com\\/v1\\/projects\\/.*$/u,\n requestMethod: 'POST',\n response: MOCK_FCM_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const getMockDeleteFCMRegistrationTokenResponse = () => {\n return {\n url: /^https:\\/\\/fcmregistrations\\.googleapis\\.com\\/v1\\/projects\\/.*$/u,\n requestMethod: 'POST',\n response: {},\n } satisfies MockResponse;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockResponse.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/mocks/mockResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,iCAA6B;AAQxD,eAAO,MAAM,cAAc,cAAc,CAAC;AAC1C,eAAO,MAAM,mBAAmB,EAAE,WAMjC,CAAC;AAEF,eAAO,MAAM,4CAA4C;;;;CAMxD,CAAC;AAEF,eAAO,MAAM,0CAA0C;;;;CAMtD,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;CAS7B,CAAC;AAEF,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;CAMrD,CAAC;AAEF,eAAO,MAAM,yCAAyC;;;;CAMrD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockResponse.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/mocks/mockResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,iCAA6B;AAQxD,eAAO,MAAM,cAAc,cAAc,CAAC;AAC1C,eAAO,MAAM,mBAAmB,EAAE,WAMjC,CAAC;AAEF,eAAO,MAAM,4CAA4C;;;;CAMxD,CAAC;AAEF,eAAO,MAAM,0CAA0C;;;;CAMtD,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;CAS7B,CAAC;AAEF,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;CAMrD,CAAC;AAEF,eAAO,MAAM,yCAAyC;;;;CAMrD,CAAC"}
|
|
@@ -3,8 +3,8 @@ export const MOCK_REG_TOKEN = 'REG_TOKEN';
|
|
|
3
3
|
export const MOCK_LINKS_RESPONSE = {
|
|
4
4
|
trigger_ids: ['1', '2', '3'],
|
|
5
5
|
registration_tokens: [
|
|
6
|
-
{ token: 'reg_token_1', platform: 'portfolio' },
|
|
7
|
-
{ token: 'reg_token_2', platform: 'extension' },
|
|
6
|
+
{ token: 'reg_token_1', platform: 'portfolio', locale: 'en' },
|
|
7
|
+
{ token: 'reg_token_2', platform: 'extension', locale: 'en' },
|
|
8
8
|
],
|
|
9
9
|
};
|
|
10
10
|
export const getMockRetrievePushNotificationLinksResponse = () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockResponse.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/mocks/mockResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,kCAA8B;AASrE,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAC1C,MAAM,CAAC,MAAM,mBAAmB,GAAgB;IAC9C,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC5B,mBAAmB,EAAE;QACnB,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE;QAC7D,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE;KAC9D;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,4CAA4C,GAAG,GAAG,EAAE;IAC/D,OAAO;QACL,GAAG,EAAE,4BAA4B;QACjC,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,mBAAmB;KACP,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0CAA0C,GAAG,GAAG,EAAE;IAC7D,OAAO;QACL,GAAG,EAAE,4BAA4B;QACjC,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,WAAW;IAClB,GAAG,EAAE;QACH,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,EAAE;QACR,iBAAiB,EAAE,EAAE;KACtB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,yCAAyC,GAAG,GAAG,EAAE;IAC5D,OAAO;QACL,GAAG,EAAE,kEAAkE;QACvE,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,iBAAiB;KACL,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yCAAyC,GAAG,GAAG,EAAE;IAC5D,OAAO;QACL,GAAG,EAAE,kEAAkE;QACvE,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,EAAE;KACU,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import { REGISTRATION_TOKENS_ENDPOINT } from '../services/endpoints';\nimport type { LinksResult } from '../services/services';\n\ntype MockResponse = {\n url: string | RegExp;\n requestMethod: 'GET' | 'POST' | 'PUT';\n response: unknown;\n};\n\nexport const MOCK_REG_TOKEN = 'REG_TOKEN';\nexport const MOCK_LINKS_RESPONSE: LinksResult = {\n trigger_ids: ['1', '2', '3'],\n registration_tokens: [\n { token: 'reg_token_1', platform: 'portfolio', locale: 'en' },\n { token: 'reg_token_2', platform: 'extension', locale: 'en' },\n ],\n};\n\nexport const getMockRetrievePushNotificationLinksResponse = () => {\n return {\n url: REGISTRATION_TOKENS_ENDPOINT,\n requestMethod: 'GET',\n response: MOCK_LINKS_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const getMockUpdatePushNotificationLinksResponse = () => {\n return {\n url: REGISTRATION_TOKENS_ENDPOINT,\n requestMethod: 'POST',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const MOCK_FCM_RESPONSE = {\n name: '',\n token: 'fcm-token',\n web: {\n endpoint: '',\n p256dh: '',\n auth: '',\n applicationPubKey: '',\n },\n};\n\nexport const getMockCreateFCMRegistrationTokenResponse = () => {\n return {\n url: /^https:\\/\\/fcmregistrations\\.googleapis\\.com\\/v1\\/projects\\/.*$/u,\n requestMethod: 'POST',\n response: MOCK_FCM_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const getMockDeleteFCMRegistrationTokenResponse = () => {\n return {\n url: /^https:\\/\\/fcmregistrations\\.googleapis\\.com\\/v1\\/projects\\/.*$/u,\n requestMethod: 'POST',\n response: {},\n } satisfies MockResponse;\n};\n"]}
|
|
@@ -61,12 +61,14 @@ exports.updateLinksAPI = updateLinksAPI;
|
|
|
61
61
|
* @returns A promise that resolves with an object containing the success status and the BearerToken token.
|
|
62
62
|
*/
|
|
63
63
|
async function activatePushNotifications(params) {
|
|
64
|
-
const { bearerToken, triggers, env, createRegToken, platform } = params;
|
|
64
|
+
const { bearerToken, triggers, env, createRegToken, platform, locale } = params;
|
|
65
65
|
const regToken = await createRegToken(env).catch(() => null);
|
|
66
66
|
if (!regToken) {
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
|
-
await updateLinksAPI(bearerToken, triggers, [
|
|
69
|
+
await updateLinksAPI(bearerToken, triggers, [
|
|
70
|
+
{ token: regToken, platform, locale },
|
|
71
|
+
]);
|
|
70
72
|
return regToken;
|
|
71
73
|
}
|
|
72
74
|
exports.activatePushNotifications = activatePushNotifications;
|
|
@@ -101,14 +103,14 @@ exports.deactivatePushNotifications = deactivatePushNotifications;
|
|
|
101
103
|
* - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.
|
|
102
104
|
*/
|
|
103
105
|
async function updateTriggerPushNotifications(params) {
|
|
104
|
-
const { bearerToken, triggers, createRegToken, platform, deleteRegToken, env, } = params;
|
|
106
|
+
const { bearerToken, triggers, createRegToken, platform, locale, deleteRegToken, env, } = params;
|
|
105
107
|
await deleteRegToken(env);
|
|
106
108
|
const newRegToken = await createRegToken(env);
|
|
107
109
|
if (!newRegToken) {
|
|
108
110
|
throw new Error('Failed to create a new registration token');
|
|
109
111
|
}
|
|
110
112
|
const linksNotUpdated = await updateLinksAPI(bearerToken, triggers, [
|
|
111
|
-
{ token: newRegToken, platform },
|
|
113
|
+
{ token: newRegToken, platform, locale },
|
|
112
114
|
]);
|
|
113
115
|
if (!linksNotUpdated) {
|
|
114
116
|
throw new Error('Failed to create links to new reg token');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAyC;
|
|
1
|
+
{"version":3,"file":"services.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAyC;AAqBzC;;;;;;;GAOG;AACI,KAAK,UAAU,cAAc,CAClC,WAAmB,EACnB,QAAkB,EAClB,SAAqB;IAErB,IAAI;QACF,MAAM,IAAI,GAAgB;YACxB,WAAW,EAAE,QAAQ;YACrB,mBAAmB,EAAE,SAAS;SAC/B,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,4BAA4B,EAAE;YACnE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,WAAW,EAAE;gBACtC,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;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AAC,GAAG,CAAC,CAAC;IAC1B,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IAC9C,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IAED,MAAM,eAAe,GAAG,MAAM,cAAc,CAAC,WAAW,EAAE,QAAQ,EAAE;QAClE,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE;KACzC,CAAC,CAAC;IACH,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IAED,OAAO;QACL,QAAQ,EAAE,WAAW;KACtB,CAAC;AACJ,CAAC;AA/BD,wEA+BC","sourcesContent":["import * as endpoints from './endpoints';\nimport type { PushNotificationEnv } from '../types';\nimport type {\n CreateRegToken,\n DeleteRegToken,\n} from '../types/push-service-interface';\n\nexport type RegToken = {\n token: string;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n};\n\n/**\n * Links API Response Shape\n */\nexport type LinksResult = {\n trigger_ids: string[];\n registration_tokens: RegToken[];\n};\n\n/**\n * Updates the push notification links on a remote API.\n *\n * @param bearerToken - The JSON Web Token used for authorization.\n * @param triggers - An array of trigger identifiers.\n * @param regTokens - An array of registration tokens.\n * @returns A promise that resolves with true if the update was successful, false otherwise.\n */\nexport async function updateLinksAPI(\n bearerToken: string,\n triggers: string[],\n regTokens: RegToken[],\n): Promise<boolean> {\n try {\n const body: LinksResult = {\n trigger_ids: triggers,\n registration_tokens: regTokens,\n };\n const response = await fetch(endpoints.REGISTRATION_TOKENS_ENDPOINT, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${bearerToken}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n });\n return response.status === 200;\n } catch {\n return false;\n }\n}\n\ntype ActivatePushNotificationsParams = {\n // Push Links\n bearerToken: string;\n triggers: string[];\n\n // Push Registration\n env: PushNotificationEnv;\n createRegToken: CreateRegToken;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n};\n\n/**\n * Enables push notifications by registering the device and linking triggers.\n *\n * @param params - Activate Push Params\n * @returns A promise that resolves with an object containing the success status and the BearerToken token.\n */\nexport async function activatePushNotifications(\n params: ActivatePushNotificationsParams,\n): Promise<string | null> {\n const { bearerToken, triggers, env, createRegToken, platform, locale } =\n params;\n\n const regToken = await createRegToken(env).catch(() => null);\n if (!regToken) {\n return null;\n }\n\n await updateLinksAPI(bearerToken, triggers, [\n { token: regToken, platform, locale },\n ]);\n return regToken;\n}\n\ntype DeactivatePushNotificationsParams = {\n // Push Links\n regToken: string;\n\n // Push Un-registration\n env: PushNotificationEnv;\n deleteRegToken: DeleteRegToken;\n};\n\n/**\n * Disables push notifications by removing the registration token\n * We do not need to unlink triggers, and remove old reg tokens (this is cleaned up in the back-end)\n *\n * @param params - Deactivate Push Params\n * @returns A promise that resolves with true if push notifications were successfully disabled, false otherwise.\n */\nexport async function deactivatePushNotifications(\n params: DeactivatePushNotificationsParams,\n): Promise<boolean> {\n const { regToken, env, deleteRegToken } = params;\n\n // if we don't have a reg token, then we can early return\n if (!regToken) {\n return true;\n }\n\n const isTokenRemovedFromFCM = await deleteRegToken(env);\n if (!isTokenRemovedFromFCM) {\n return false;\n }\n\n return true;\n}\n\ntype UpdateTriggerPushNotificationsParams = {\n // Push Links\n bearerToken: string;\n triggers: string[];\n\n // Push Registration\n env: PushNotificationEnv;\n createRegToken: CreateRegToken;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n\n // Push Un-registration\n deleteRegToken: DeleteRegToken;\n};\n\n/**\n * Updates the triggers linked to push notifications for a given registration token.\n * If the provided registration token does not exist or is not in the current set of registration tokens,\n * a new registration token is created and used for the update.\n *\n * @param params - Update Push Params\n * @returns A promise that resolves with an object containing:\n * - isTriggersLinkedToPushNotifications: boolean indicating if the triggers were successfully updated.\n * - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.\n */\nexport async function updateTriggerPushNotifications(\n params: UpdateTriggerPushNotificationsParams,\n): Promise<{\n fcmToken: string;\n}> {\n const {\n bearerToken,\n triggers,\n createRegToken,\n platform,\n locale,\n deleteRegToken,\n env,\n } = params;\n\n await deleteRegToken(env);\n const newRegToken = await createRegToken(env);\n if (!newRegToken) {\n throw new Error('Failed to create a new registration token');\n }\n\n const linksNotUpdated = await updateLinksAPI(bearerToken, triggers, [\n { token: newRegToken, platform, locale },\n ]);\n if (!linksNotUpdated) {\n throw new Error('Failed to create links to new reg token');\n }\n\n return {\n fcmToken: newRegToken,\n };\n}\n"]}
|
|
@@ -3,6 +3,7 @@ import type { CreateRegToken, DeleteRegToken } from "../types/push-service-inter
|
|
|
3
3
|
export type RegToken = {
|
|
4
4
|
token: string;
|
|
5
5
|
platform: 'extension' | 'mobile' | 'portfolio';
|
|
6
|
+
locale: string;
|
|
6
7
|
};
|
|
7
8
|
/**
|
|
8
9
|
* Links API Response Shape
|
|
@@ -26,6 +27,7 @@ type ActivatePushNotificationsParams = {
|
|
|
26
27
|
env: PushNotificationEnv;
|
|
27
28
|
createRegToken: CreateRegToken;
|
|
28
29
|
platform: 'extension' | 'mobile' | 'portfolio';
|
|
30
|
+
locale: string;
|
|
29
31
|
};
|
|
30
32
|
/**
|
|
31
33
|
* Enables push notifications by registering the device and linking triggers.
|
|
@@ -53,6 +55,7 @@ type UpdateTriggerPushNotificationsParams = {
|
|
|
53
55
|
env: PushNotificationEnv;
|
|
54
56
|
createRegToken: CreateRegToken;
|
|
55
57
|
platform: 'extension' | 'mobile' | 'portfolio';
|
|
58
|
+
locale: string;
|
|
56
59
|
deleteRegToken: DeleteRegToken;
|
|
57
60
|
};
|
|
58
61
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,4CAAwC;AAEzC,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"services.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,4CAAwC;AAEzC,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mBAAmB,EAAE,QAAQ,EAAE,CAAC;CACjC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAkBlB;AAED,KAAK,+BAA+B,GAAG;IAErC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAaxB;AAED,KAAK,iCAAiC,GAAG;IAEvC,QAAQ,EAAE,MAAM,CAAC;IAGjB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,OAAO,CAAC,CAclB;AAED,KAAK,oCAAoC,GAAG;IAE1C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;IAGf,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,oCAAoC,GAC3C,OAAO,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CA2BD"}
|
|
@@ -3,6 +3,7 @@ import type { CreateRegToken, DeleteRegToken } from "../types/push-service-inter
|
|
|
3
3
|
export type RegToken = {
|
|
4
4
|
token: string;
|
|
5
5
|
platform: 'extension' | 'mobile' | 'portfolio';
|
|
6
|
+
locale: string;
|
|
6
7
|
};
|
|
7
8
|
/**
|
|
8
9
|
* Links API Response Shape
|
|
@@ -26,6 +27,7 @@ type ActivatePushNotificationsParams = {
|
|
|
26
27
|
env: PushNotificationEnv;
|
|
27
28
|
createRegToken: CreateRegToken;
|
|
28
29
|
platform: 'extension' | 'mobile' | 'portfolio';
|
|
30
|
+
locale: string;
|
|
29
31
|
};
|
|
30
32
|
/**
|
|
31
33
|
* Enables push notifications by registering the device and linking triggers.
|
|
@@ -53,6 +55,7 @@ type UpdateTriggerPushNotificationsParams = {
|
|
|
53
55
|
env: PushNotificationEnv;
|
|
54
56
|
createRegToken: CreateRegToken;
|
|
55
57
|
platform: 'extension' | 'mobile' | 'portfolio';
|
|
58
|
+
locale: string;
|
|
56
59
|
deleteRegToken: DeleteRegToken;
|
|
57
60
|
};
|
|
58
61
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,4CAAwC;AAEzC,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"services.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,4CAAwC;AAEzC,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mBAAmB,EAAE,QAAQ,EAAE,CAAC;CACjC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAkBlB;AAED,KAAK,+BAA+B,GAAG;IAErC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAaxB;AAED,KAAK,iCAAiC,GAAG;IAEvC,QAAQ,EAAE,MAAM,CAAC;IAGjB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,OAAO,CAAC,CAclB;AAED,KAAK,oCAAoC,GAAG;IAE1C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;IAGf,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,oCAAoC,GAC3C,OAAO,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CA2BD"}
|
|
@@ -34,12 +34,14 @@ export async function updateLinksAPI(bearerToken, triggers, regTokens) {
|
|
|
34
34
|
* @returns A promise that resolves with an object containing the success status and the BearerToken token.
|
|
35
35
|
*/
|
|
36
36
|
export async function activatePushNotifications(params) {
|
|
37
|
-
const { bearerToken, triggers, env, createRegToken, platform } = params;
|
|
37
|
+
const { bearerToken, triggers, env, createRegToken, platform, locale } = params;
|
|
38
38
|
const regToken = await createRegToken(env).catch(() => null);
|
|
39
39
|
if (!regToken) {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
|
-
await updateLinksAPI(bearerToken, triggers, [
|
|
42
|
+
await updateLinksAPI(bearerToken, triggers, [
|
|
43
|
+
{ token: regToken, platform, locale },
|
|
44
|
+
]);
|
|
43
45
|
return regToken;
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
@@ -72,14 +74,14 @@ export async function deactivatePushNotifications(params) {
|
|
|
72
74
|
* - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.
|
|
73
75
|
*/
|
|
74
76
|
export async function updateTriggerPushNotifications(params) {
|
|
75
|
-
const { bearerToken, triggers, createRegToken, platform, deleteRegToken, env, } = params;
|
|
77
|
+
const { bearerToken, triggers, createRegToken, platform, locale, deleteRegToken, env, } = params;
|
|
76
78
|
await deleteRegToken(env);
|
|
77
79
|
const newRegToken = await createRegToken(env);
|
|
78
80
|
if (!newRegToken) {
|
|
79
81
|
throw new Error('Failed to create a new registration token');
|
|
80
82
|
}
|
|
81
83
|
const linksNotUpdated = await updateLinksAPI(bearerToken, triggers, [
|
|
82
|
-
{ token: newRegToken, platform },
|
|
84
|
+
{ token: newRegToken, platform, locale },
|
|
83
85
|
]);
|
|
84
86
|
if (!linksNotUpdated) {
|
|
85
87
|
throw new Error('Failed to create links to new reg token');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,wBAAoB;
|
|
1
|
+
{"version":3,"file":"services.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,wBAAoB;AAqBzC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,WAAmB,EACnB,QAAkB,EAClB,SAAqB;IAErB,IAAI;QACF,MAAM,IAAI,GAAgB;YACxB,WAAW,EAAE,QAAQ;YACrB,mBAAmB,EAAE,SAAS;SAC/B,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,K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;GASG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,MAA4C;IAI5C,MAAM,EACJ,WAAW,EACX,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,MAAM,EACN,cAAc,EACd,GAAG,GACJ,GAAG,MAAM,CAAC;IAEX,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IAC9C,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IAED,MAAM,eAAe,GAAG,MAAM,cAAc,CAAC,WAAW,EAAE,QAAQ,EAAE;QAClE,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE;KACzC,CAAC,CAAC;IACH,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IAED,OAAO;QACL,QAAQ,EAAE,WAAW;KACtB,CAAC;AACJ,CAAC","sourcesContent":["import * as endpoints from './endpoints';\nimport type { PushNotificationEnv } from '../types';\nimport type {\n CreateRegToken,\n DeleteRegToken,\n} from '../types/push-service-interface';\n\nexport type RegToken = {\n token: string;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n};\n\n/**\n * Links API Response Shape\n */\nexport type LinksResult = {\n trigger_ids: string[];\n registration_tokens: RegToken[];\n};\n\n/**\n * Updates the push notification links on a remote API.\n *\n * @param bearerToken - The JSON Web Token used for authorization.\n * @param triggers - An array of trigger identifiers.\n * @param regTokens - An array of registration tokens.\n * @returns A promise that resolves with true if the update was successful, false otherwise.\n */\nexport async function updateLinksAPI(\n bearerToken: string,\n triggers: string[],\n regTokens: RegToken[],\n): Promise<boolean> {\n try {\n const body: LinksResult = {\n trigger_ids: triggers,\n registration_tokens: regTokens,\n };\n const response = await fetch(endpoints.REGISTRATION_TOKENS_ENDPOINT, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${bearerToken}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n });\n return response.status === 200;\n } catch {\n return false;\n }\n}\n\ntype ActivatePushNotificationsParams = {\n // Push Links\n bearerToken: string;\n triggers: string[];\n\n // Push Registration\n env: PushNotificationEnv;\n createRegToken: CreateRegToken;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n};\n\n/**\n * Enables push notifications by registering the device and linking triggers.\n *\n * @param params - Activate Push Params\n * @returns A promise that resolves with an object containing the success status and the BearerToken token.\n */\nexport async function activatePushNotifications(\n params: ActivatePushNotificationsParams,\n): Promise<string | null> {\n const { bearerToken, triggers, env, createRegToken, platform, locale } =\n params;\n\n const regToken = await createRegToken(env).catch(() => null);\n if (!regToken) {\n return null;\n }\n\n await updateLinksAPI(bearerToken, triggers, [\n { token: regToken, platform, locale },\n ]);\n return regToken;\n}\n\ntype DeactivatePushNotificationsParams = {\n // Push Links\n regToken: string;\n\n // Push Un-registration\n env: PushNotificationEnv;\n deleteRegToken: DeleteRegToken;\n};\n\n/**\n * Disables push notifications by removing the registration token\n * We do not need to unlink triggers, and remove old reg tokens (this is cleaned up in the back-end)\n *\n * @param params - Deactivate Push Params\n * @returns A promise that resolves with true if push notifications were successfully disabled, false otherwise.\n */\nexport async function deactivatePushNotifications(\n params: DeactivatePushNotificationsParams,\n): Promise<boolean> {\n const { regToken, env, deleteRegToken } = params;\n\n // if we don't have a reg token, then we can early return\n if (!regToken) {\n return true;\n }\n\n const isTokenRemovedFromFCM = await deleteRegToken(env);\n if (!isTokenRemovedFromFCM) {\n return false;\n }\n\n return true;\n}\n\ntype UpdateTriggerPushNotificationsParams = {\n // Push Links\n bearerToken: string;\n triggers: string[];\n\n // Push Registration\n env: PushNotificationEnv;\n createRegToken: CreateRegToken;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n\n // Push Un-registration\n deleteRegToken: DeleteRegToken;\n};\n\n/**\n * Updates the triggers linked to push notifications for a given registration token.\n * If the provided registration token does not exist or is not in the current set of registration tokens,\n * a new registration token is created and used for the update.\n *\n * @param params - Update Push Params\n * @returns A promise that resolves with an object containing:\n * - isTriggersLinkedToPushNotifications: boolean indicating if the triggers were successfully updated.\n * - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.\n */\nexport async function updateTriggerPushNotifications(\n params: UpdateTriggerPushNotificationsParams,\n): Promise<{\n fcmToken: string;\n}> {\n const {\n bearerToken,\n triggers,\n createRegToken,\n platform,\n locale,\n deleteRegToken,\n env,\n } = params;\n\n await deleteRegToken(env);\n const newRegToken = await createRegToken(env);\n if (!newRegToken) {\n throw new Error('Failed to create a new registration token');\n }\n\n const linksNotUpdated = await updateLinksAPI(bearerToken, triggers, [\n { token: newRegToken, platform, locale },\n ]);\n if (!linksNotUpdated) {\n throw new Error('Failed to create links to new reg token');\n }\n\n return {\n fcmToken: newRegToken,\n };\n}\n"]}
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"main": "../../dist/NotificationServicesController/
|
|
8
|
-
"types": "../../dist/NotificationServicesController/
|
|
7
|
+
"main": "../../dist/NotificationServicesController/mocks/index.cjs",
|
|
8
|
+
"types": "../../dist/NotificationServicesController/mocks/index.d.cts"
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/notification-services-controller",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Manages New MetaMask decentralized Notification system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
},
|
|
50
50
|
"./notification-services/mocks": {
|
|
51
51
|
"import": {
|
|
52
|
-
"types": "./dist/NotificationServicesController/
|
|
53
|
-
"default": "./dist/NotificationServicesController/
|
|
52
|
+
"types": "./dist/NotificationServicesController/mocks/index.d.mts",
|
|
53
|
+
"default": "./dist/NotificationServicesController/mocks/index.mjs"
|
|
54
54
|
},
|
|
55
55
|
"require": {
|
|
56
|
-
"types": "./dist/NotificationServicesController/
|
|
57
|
-
"default": "./dist/NotificationServicesController/
|
|
56
|
+
"types": "./dist/NotificationServicesController/mocks/index.d.cts",
|
|
57
|
+
"default": "./dist/NotificationServicesController/mocks/index.cjs"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"./push-services": {
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
},
|
|
80
80
|
"./push-services/mocks": {
|
|
81
81
|
"import": {
|
|
82
|
-
"types": "./dist/NotificationServicesPushController/
|
|
83
|
-
"default": "./dist/NotificationServicesPushController/
|
|
82
|
+
"types": "./dist/NotificationServicesPushController/mocks/index.d.mts",
|
|
83
|
+
"default": "./dist/NotificationServicesPushController/mocks/index.mjs"
|
|
84
84
|
},
|
|
85
85
|
"require": {
|
|
86
|
-
"types": "./dist/NotificationServicesPushController/
|
|
87
|
-
"default": "./dist/NotificationServicesPushController/
|
|
86
|
+
"types": "./dist/NotificationServicesPushController/mocks/index.d.cts",
|
|
87
|
+
"default": "./dist/NotificationServicesPushController/mocks/index.cjs"
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"./package.json": "./package.json"
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@contentful/rich-text-html-renderer": "^16.5.2",
|
|
113
113
|
"@metamask/base-controller": "^8.0.0",
|
|
114
|
-
"@metamask/controller-utils": "^11.
|
|
114
|
+
"@metamask/controller-utils": "^11.6.0",
|
|
115
115
|
"@metamask/utils": "^11.2.0",
|
|
116
116
|
"bignumber.js": "^9.1.2",
|
|
117
117
|
"firebase": "^11.2.0",
|
|
@@ -122,8 +122,8 @@
|
|
|
122
122
|
"@lavamoat/allow-scripts": "^3.0.4",
|
|
123
123
|
"@lavamoat/preinstall-always-fail": "^2.1.0",
|
|
124
124
|
"@metamask/auto-changelog": "^3.4.4",
|
|
125
|
-
"@metamask/keyring-controller": "^
|
|
126
|
-
"@metamask/profile-sync-controller": "^
|
|
125
|
+
"@metamask/keyring-controller": "^21.0.0",
|
|
126
|
+
"@metamask/profile-sync-controller": "^10.0.0",
|
|
127
127
|
"@types/jest": "^27.4.1",
|
|
128
128
|
"@types/readable-stream": "^2.3.0",
|
|
129
129
|
"contentful": "^10.15.0",
|
|
@@ -137,8 +137,8 @@
|
|
|
137
137
|
"typescript": "~5.2.2"
|
|
138
138
|
},
|
|
139
139
|
"peerDependencies": {
|
|
140
|
-
"@metamask/keyring-controller": "^
|
|
141
|
-
"@metamask/profile-sync-controller": "^
|
|
140
|
+
"@metamask/keyring-controller": "^21.0.0",
|
|
141
|
+
"@metamask/profile-sync-controller": "^10.0.0"
|
|
142
142
|
},
|
|
143
143
|
"engines": {
|
|
144
144
|
"node": "^18.18 || >=20"
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"main": "../../dist/NotificationServicesPushController/
|
|
8
|
-
"types": "../../dist/NotificationServicesPushController/
|
|
7
|
+
"main": "../../dist/NotificationServicesPushController/mocks/index.cjs",
|
|
8
|
+
"types": "../../dist/NotificationServicesPushController/mocks/index.d.cts"
|
|
9
9
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAA6C;AAC7C,kEAA4C;AAC5C,uEAAiD;AACjD,+DAAyC;AACzC,sDAAgC;AAChC,+DAAyC","sourcesContent":["export * from './mock-feature-announcements';\nexport * from './mock-notification-trigger';\nexport * from './mock-notification-user-storage';\nexport * from './mock-raw-notifications';\nexport * from './mockResponses';\nexport * from './mock-snap-notification';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/index.ts"],"names":[],"mappings":"AAAA,iDAA6C;AAC7C,gDAA4C;AAC5C,qDAAiD;AACjD,6CAAyC;AACzC,oCAAgC;AAChC,6CAAyC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/index.ts"],"names":[],"mappings":"AAAA,iDAA6C;AAC7C,gDAA4C;AAC5C,qDAAiD;AACjD,6CAAyC;AACzC,oCAAgC;AAChC,6CAAyC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/index.ts"],"names":[],"mappings":"AAAA,iDAA6C;AAC7C,gDAA4C;AAC5C,qDAAiD;AACjD,6CAAyC;AACzC,oCAAgC;AAChC,6CAAyC","sourcesContent":["export * from './mock-feature-announcements';\nexport * from './mock-notification-trigger';\nexport * from './mock-notification-user-storage';\nexport * from './mock-raw-notifications';\nexport * from './mockResponses';\nexport * from './mock-snap-notification';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-feature-announcements.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-feature-announcements.ts"],"names":[],"mappings":";;;AAAA,8EAAiE;AAIjE;;;;GAIG;AACH,SAAgB,sCAAsC;IACpD,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,OAAO;SACd;QACD,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,KAAK,EAAE;YACL;gBACE,QAAQ,EAAE;oBACR,IAAI,EAAE,EAAE;iBACT;gBACD,GAAG,EAAE;oBACH,KAAK,EAAE;wBACL,GAAG,EAAE;4BACH,IAAI,EAAE,MAAM;4BACZ,QAAQ,EAAE,OAAO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W,EAAE,EAAE;wBACf,IAAI,EAAE;4BACJ,GAAG,EAAE,+IAA+I;4BACpJ,OAAO,EAAE;gCACP,IAAI,EAAE,MAAM;gCACZ,KAAK,EAAE;oCACL,KAAK,EAAE,IAAI;oCACX,MAAM,EAAE,IAAI;iCACb;6BACF;4BACD,QAAQ,EAAE,mDAAmD;4BAC7D,WAAW,EAAE,WAAW;yBACzB;qBACF;iBACF;aACF;SACF;KAC6B,CAAC;AACnC,CAAC;AA5KD,wFA4KC;AAED;;;;GAIG;AACH,SAAgB,gCAAgC;IAC9C,OAAO;QACL,IAAI,EAAE,mCAAa,CAAC,qBAAqB;QACzC,SAAS,EAAE,0BAA0B;QACrC,IAAI,EAAE;YACJ,EAAE,EAAE,6CAA6C;YACjD,QAAQ,EAAE,cAAc;YACxB,KAAK,EAAE,+CAA+C;YACtD,eAAe,EAAE,uSAAuS;YACxT,gBAAgB,EACd,yGAAyG;YAC3G,KAAK,EAAE;gBACL,KAAK,EAAE,+CAA+C;gBACtD,WAAW,EAAE,EAAE;gBACf,GAAG,EAAE,+IAA+I;aACrJ;YACD,aAAa,EAAE;gBACb,iBAAiB,EAAE,SAAS;gBAC5B,kBAAkB,EAAE,WAAW;aAChC;SACF;KACF,CAAC;AACJ,CAAC;AAtBD,4EAsBC","sourcesContent":["import { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { ContentfulResult } from '../services/feature-announcements';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\n\n/**\n * Mocking Utility - create a mock normalized feature announcement\n *\n * @returns Mock Normalized Feature Announcement\n */\nexport function createMockFeatureAnnouncementAPIResult(): ContentfulResult {\n return {\n sys: {\n type: 'Array',\n },\n total: 17,\n skip: 0,\n limit: 1,\n items: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '1ABRmHaNCgmxROKXXLXsMu',\n type: 'Entry',\n createdAt: '2024-04-09T13:24:01.872Z',\n updatedAt: '2024-04-09T13:24:01.872Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n contentType: {\n sys: {\n type: 'Link',\n linkType: 'ContentType',\n id: 'productAnnouncement',\n },\n },\n locale: 'en-US',\n },\n fields: {\n title: 'Don’t miss out on airdrops and new NFT mints!',\n id: 'dont-miss-out-on-airdrops-and-new-nft-mints',\n category: 'ANNOUNCEMENT',\n shortDescription:\n 'Check your airdrop eligibility and see trending NFT drops. Head over to the Explore tab to get started. ',\n image: {\n sys: {\n type: 'Link',\n linkType: 'Asset',\n id: '5jqq8sFeLc6XEoeWlpI3aB',\n },\n },\n longDescription: {\n data: {},\n content: [\n {\n data: {},\n content: [\n {\n data: {},\n marks: [],\n value:\n 'You can now verify if any of your connected addresses are eligible for airdrops and other ERC-20 claims in a secure and convenient way. We’ve also added trending NFT mints based on creators you’ve minted from before or other tokens you hold. Head over to the Explore tab to get started. \\n',\n nodeType: 'text',\n },\n ],\n nodeType: 'paragraph',\n },\n ],\n nodeType: 'document',\n },\n link: {\n sys: {\n type: 'Link',\n linkType: 'Entry',\n id: '62xKYM2ydo4F1mS5q97K5q',\n },\n },\n },\n },\n ],\n includes: {\n Entry: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '62xKYM2ydo4F1mS5q97K5q',\n type: 'Entry',\n createdAt: '2024-04-09T13:23:03.636Z',\n updatedAt: '2024-04-09T13:23:03.636Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n contentType: {\n sys: {\n type: 'Link',\n linkType: 'ContentType',\n id: 'link',\n },\n },\n locale: 'en-US',\n },\n fields: {\n extensionLinkText: 'Try now',\n extensionLinkRoute: 'home.html',\n },\n },\n ],\n Asset: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '5jqq8sFeLc6XEoeWlpI3aB',\n type: 'Asset',\n createdAt: '2024-04-09T13:23:13.327Z',\n updatedAt: '2024-04-09T13:23:13.327Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n locale: 'en-US',\n },\n fields: {\n title: 'PDAPP notification image Airdrops & NFT mints',\n description: '',\n file: {\n url: '//images.ctfassets.net/jdkgyfmyd9sw/5jqq8sFeLc6XEoeWlpI3aB/73ee0f1afa9916c3a7538b0bbee09c26/PDAPP_notification_image_Airdrops___NFT_mints.png',\n details: {\n size: 797731,\n image: {\n width: 2880,\n height: 1921,\n },\n },\n fileName: 'PDAPP notification image_Airdrops & NFT mints.png',\n contentType: 'image/png',\n },\n },\n },\n ],\n },\n } as unknown as ContentfulResult;\n}\n\n/**\n * Mocking Utility - create a mock raw feature announcement\n *\n * @returns Mock Raw Feature Announcement\n */\nexport function createMockFeatureAnnouncementRaw(): FeatureAnnouncementRawNotification {\n return {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,\n createdAt: '2999-04-09T13:24:01.872Z',\n data: {\n id: 'dont-miss-out-on-airdrops-and-new-nft-mints',\n category: 'ANNOUNCEMENT',\n title: 'Don’t miss out on airdrops and new NFT mints!',\n longDescription: `<p>You can now verify if any of your connected addresses are eligible for airdrops and other ERC-20 claims in a secure and convenient way. We’ve also added trending NFT mints based on creators you’ve minted from before or other tokens you hold. Head over to the Explore tab to get started.</p>`,\n shortDescription:\n 'Check your airdrop eligibility and see trending NFT drops. Head over to the Explore tab to get started.',\n image: {\n title: 'PDAPP notification image Airdrops & NFT mints',\n description: '',\n url: '//images.ctfassets.net/jdkgyfmyd9sw/5jqq8sFeLc6XEoeWlpI3aB/73ee0f1afa9916c3a7538b0bbee09c26/PDAPP_notification_image_Airdrops___NFT_mints.png',\n },\n extensionLink: {\n extensionLinkText: 'Try now',\n extensionLinkRoute: 'home.html',\n },\n },\n };\n}\n"]}
|
package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-feature-announcements.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-feature-announcements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,8CAA0C;AAC1E,OAAO,KAAK,EAAE,kCAAkC,EAAE,+DAA2D;AAE7G;;;;GAIG;AACH,wBAAgB,sCAAsC,IAAI,gBAAgB,CA4KzE;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,IAAI,kCAAkC,CAsBrF"}
|
package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-feature-announcements.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-feature-announcements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,8CAA0C;AAC1E,OAAO,KAAK,EAAE,kCAAkC,EAAE,+DAA2D;AAE7G;;;;GAIG;AACH,wBAAgB,sCAAsC,IAAI,gBAAgB,CA4KzE;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,IAAI,kCAAkC,CAsBrF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-feature-announcements.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-feature-announcements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,6CAAyC;AAIjE;;;;GAIG;AACH,MAAM,UAAU,sCAAsC;IACpD,OAAO;QACL,GAAG,EAAE;YACH,IAAI,EAAE,OAAO;SACd;QACD,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,KAAK,EAA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E,MAAM;gCACZ,QAAQ,EAAE,aAAa;6BACxB;yBACF;wBACD,QAAQ,EAAE,CAAC;wBACX,MAAM,EAAE,OAAO;qBAChB;oBACD,MAAM,EAAE;wBACN,KAAK,EAAE,+CAA+C;wBACtD,WAAW,EAAE,EAAE;wBACf,IAAI,EAAE;4BACJ,GAAG,EAAE,+IAA+I;4BACpJ,OAAO,EAAE;gCACP,IAAI,EAAE,MAAM;gCACZ,KAAK,EAAE;oCACL,KAAK,EAAE,IAAI;oCACX,MAAM,EAAE,IAAI;iCACb;6BACF;4BACD,QAAQ,EAAE,mDAAmD;4BAC7D,WAAW,EAAE,WAAW;yBACzB;qBACF;iBACF;aACF;SACF;KAC6B,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gCAAgC;IAC9C,OAAO;QACL,IAAI,EAAE,aAAa,CAAC,qBAAqB;QACzC,SAAS,EAAE,0BAA0B;QACrC,IAAI,EAAE;YACJ,EAAE,EAAE,6CAA6C;YACjD,QAAQ,EAAE,cAAc;YACxB,KAAK,EAAE,+CAA+C;YACtD,eAAe,EAAE,uSAAuS;YACxT,gBAAgB,EACd,yGAAyG;YAC3G,KAAK,EAAE;gBACL,KAAK,EAAE,+CAA+C;gBACtD,WAAW,EAAE,EAAE;gBACf,GAAG,EAAE,+IAA+I;aACrJ;YACD,aAAa,EAAE;gBACb,iBAAiB,EAAE,SAAS;gBAC5B,kBAAkB,EAAE,WAAW;aAChC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { ContentfulResult } from '../services/feature-announcements';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\n\n/**\n * Mocking Utility - create a mock normalized feature announcement\n *\n * @returns Mock Normalized Feature Announcement\n */\nexport function createMockFeatureAnnouncementAPIResult(): ContentfulResult {\n return {\n sys: {\n type: 'Array',\n },\n total: 17,\n skip: 0,\n limit: 1,\n items: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '1ABRmHaNCgmxROKXXLXsMu',\n type: 'Entry',\n createdAt: '2024-04-09T13:24:01.872Z',\n updatedAt: '2024-04-09T13:24:01.872Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n contentType: {\n sys: {\n type: 'Link',\n linkType: 'ContentType',\n id: 'productAnnouncement',\n },\n },\n locale: 'en-US',\n },\n fields: {\n title: 'Don’t miss out on airdrops and new NFT mints!',\n id: 'dont-miss-out-on-airdrops-and-new-nft-mints',\n category: 'ANNOUNCEMENT',\n shortDescription:\n 'Check your airdrop eligibility and see trending NFT drops. Head over to the Explore tab to get started. ',\n image: {\n sys: {\n type: 'Link',\n linkType: 'Asset',\n id: '5jqq8sFeLc6XEoeWlpI3aB',\n },\n },\n longDescription: {\n data: {},\n content: [\n {\n data: {},\n content: [\n {\n data: {},\n marks: [],\n value:\n 'You can now verify if any of your connected addresses are eligible for airdrops and other ERC-20 claims in a secure and convenient way. We’ve also added trending NFT mints based on creators you’ve minted from before or other tokens you hold. Head over to the Explore tab to get started. \\n',\n nodeType: 'text',\n },\n ],\n nodeType: 'paragraph',\n },\n ],\n nodeType: 'document',\n },\n link: {\n sys: {\n type: 'Link',\n linkType: 'Entry',\n id: '62xKYM2ydo4F1mS5q97K5q',\n },\n },\n },\n },\n ],\n includes: {\n Entry: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '62xKYM2ydo4F1mS5q97K5q',\n type: 'Entry',\n createdAt: '2024-04-09T13:23:03.636Z',\n updatedAt: '2024-04-09T13:23:03.636Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n contentType: {\n sys: {\n type: 'Link',\n linkType: 'ContentType',\n id: 'link',\n },\n },\n locale: 'en-US',\n },\n fields: {\n extensionLinkText: 'Try now',\n extensionLinkRoute: 'home.html',\n },\n },\n ],\n Asset: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '5jqq8sFeLc6XEoeWlpI3aB',\n type: 'Asset',\n createdAt: '2024-04-09T13:23:13.327Z',\n updatedAt: '2024-04-09T13:23:13.327Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n locale: 'en-US',\n },\n fields: {\n title: 'PDAPP notification image Airdrops & NFT mints',\n description: '',\n file: {\n url: '//images.ctfassets.net/jdkgyfmyd9sw/5jqq8sFeLc6XEoeWlpI3aB/73ee0f1afa9916c3a7538b0bbee09c26/PDAPP_notification_image_Airdrops___NFT_mints.png',\n details: {\n size: 797731,\n image: {\n width: 2880,\n height: 1921,\n },\n },\n fileName: 'PDAPP notification image_Airdrops & NFT mints.png',\n contentType: 'image/png',\n },\n },\n },\n ],\n },\n } as unknown as ContentfulResult;\n}\n\n/**\n * Mocking Utility - create a mock raw feature announcement\n *\n * @returns Mock Raw Feature Announcement\n */\nexport function createMockFeatureAnnouncementRaw(): FeatureAnnouncementRawNotification {\n return {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,\n createdAt: '2999-04-09T13:24:01.872Z',\n data: {\n id: 'dont-miss-out-on-airdrops-and-new-nft-mints',\n category: 'ANNOUNCEMENT',\n title: 'Don’t miss out on airdrops and new NFT mints!',\n longDescription: `<p>You can now verify if any of your connected addresses are eligible for airdrops and other ERC-20 claims in a secure and convenient way. We’ve also added trending NFT mints based on creators you’ve minted from before or other tokens you hold. Head over to the Explore tab to get started.</p>`,\n shortDescription:\n 'Check your airdrop eligibility and see trending NFT drops. Head over to the Explore tab to get started.',\n image: {\n title: 'PDAPP notification image Airdrops & NFT mints',\n description: '',\n url: '//images.ctfassets.net/jdkgyfmyd9sw/5jqq8sFeLc6XEoeWlpI3aB/73ee0f1afa9916c3a7538b0bbee09c26/PDAPP_notification_image_Airdrops___NFT_mints.png',\n },\n extensionLink: {\n extensionLinkText: 'Try now',\n extensionLinkRoute: 'home.html',\n },\n },\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-notification-trigger.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-notification-trigger.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAIpC;;;;;GAKG;AACH,SAAgB,6BAA6B,CAC3C,QAAuC;IAEvC,OAAO;QACL,EAAE,EAAE,IAAA,SAAM,GAAE;QACZ,OAAO,EAAE,gBAAgB;QACzB,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,IAAI;QACb,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC;AAXD,sEAWC","sourcesContent":["import { v4 as uuidv4 } from 'uuid';\n\nimport type { NotificationTrigger } from '../utils/utils';\n\n/**\n * Mocking Utility - create a mock Notification Trigger\n *\n * @param override - provide any override configuration for the mock\n * @returns a mock Notification Trigger\n */\nexport function createMockNotificationTrigger(\n override?: Partial<NotificationTrigger>,\n): NotificationTrigger {\n return {\n id: uuidv4(),\n address: '0xFAKE_ADDRESS',\n chainId: '1',\n kind: 'eth_sent',\n enabled: true,\n ...override,\n };\n}\n"]}
|
package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-notification-trigger.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-notification-trigger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAuB;AAE1D;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACtC,mBAAmB,CASrB"}
|
package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-notification-trigger.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-notification-trigger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAuB;AAE1D;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACtC,mBAAmB,CASrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-notification-trigger.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-notification-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,aAAa;AAIpC;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAC3C,QAAuC;IAEvC,OAAO;QACL,EAAE,EAAE,MAAM,EAAE;QACZ,OAAO,EAAE,gBAAgB;QACzB,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,IAAI;QACb,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import { v4 as uuidv4 } from 'uuid';\n\nimport type { NotificationTrigger } from '../utils/utils';\n\n/**\n * Mocking Utility - create a mock Notification Trigger\n *\n * @param override - provide any override configuration for the mock\n * @returns a mock Notification Trigger\n */\nexport function createMockNotificationTrigger(\n override?: Partial<NotificationTrigger>,\n): NotificationTrigger {\n return {\n id: uuidv4(),\n address: '0xFAKE_ADDRESS',\n chainId: '1',\n kind: 'eth_sent',\n enabled: true,\n ...override,\n };\n}\n"]}
|
package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-notification-user-storage.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-notification-user-storage.ts"],"names":[],"mappings":";;;AAAA,0DAAkE;AAClE,8EAAiE;AAEjE,8CAAuD;AAE1C,QAAA,yBAAyB,GACpC,4CAA4C,CAAC;AAClC,QAAA,uBAAuB,GAAG,GAAG,CAAC;AAE3C;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,QAA+B;IAE/B,OAAO;QACL,CAAC,oCAAwB,CAAC,EAAE,GAAG;QAC/B,CAAC,iCAAyB,CAAC,EAAE;YAC3B,CAAC,+BAAuB,CAAC,EAAE;gBACzB,iBAAiB,EAAE;oBACjB,CAAC,EAAE,mCAAa,CAAC,cAAc;oBAC/B,CAAC,EAAE,IAAI;iBACR;gBACD,iBAAiB,EAAE;oBACjB,CAAC,EAAE,mCAAa,CAAC,UAAU;oBAC3B,CAAC,EAAE,IAAI;iBACR;aACF;SACF;QACD,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC;AAnBD,sDAmBC;AAED;;;;;GAKG;AACH,SAAgB,iCAAiC,CAC/C,QAAoE;IAEpE,MAAM,WAAW,GAAgB;QAC/B,CAAC,oCAAwB,CAAC,EAAE,GAAG;QAC/B,CAAC,iCAAyB,CAAC,EAAE;YAC3B,CAAC,+BAAuB,CAAC,EAAE,EAAE;SAC9B;KACF,CAAC;IAEF,oBAAoB;IACpB,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACrB,IAAI,GAAW,CAAC;QAChB,IAAI,CAAU,CAAC;QACf,IAAI,CAAgB,CAAC;QACrB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YACzB,GAAG,GAAG,CAAC,CAAC;YACR,CAAC,GAAG,IAAI,CAAC;YACT,CAAC,GAAG,mCAAa,CAAC,cAAc,CAAC;SAClC;aAAM;YACL,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;YACX,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACR,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,mCAAa,CAAC,cAAc,CAAC;SACzC;QAED,WAAW,CAAC,iCAAyB,CAAC,CAAC,+BAAuB,CAAC,CAAC,GAAG,CAAC,GAAG;YACrE,CAAC;YACD,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC;AAhCD,8EAgCC;AAED;;;;;;;GAOG;AACH,SAAgB,yBAAyB,CACvC,QAAyD,EAAE;IAE3D,OAAO,IAAA,6BAAqB,EAC1B,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,iCAAyB,EAAE,CAAC,EACzD,KAAK,CAAC,eAAe,IAAI,IAAI,EAC7B,KAAK,CACN,CAAC;AACJ,CAAC;AARD,8DAQC","sourcesContent":["import { USER_STORAGE_VERSION_KEY } from '../constants/constants';\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { UserStorage } from '../types/user-storage/user-storage';\nimport { initializeUserStorage } from '../utils/utils';\n\nexport const MOCK_USER_STORAGE_ACCOUNT =\n '0x0000000000000000000000000000000000000000';\nexport const MOCK_USER_STORAGE_CHAIN = '1';\n\n/**\n * Mocking Utility - create a mock notification user storage object\n *\n * @param override - provide any override configuration for the mock\n * @returns a mock notification user storage object\n */\nexport function createMockUserStorage(\n override?: Partial<UserStorage>,\n): UserStorage {\n return {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {\n '111-111-111-111': {\n k: TRIGGER_TYPES.ERC20_RECEIVED,\n e: true,\n },\n '222-222-222-222': {\n k: TRIGGER_TYPES.ERC20_SENT,\n e: true,\n },\n },\n },\n ...override,\n };\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object with triggers\n *\n * @param triggers - provide any override configuration for the mock\n * @returns a mock notification user storage object with triggers\n */\nexport function createMockUserStorageWithTriggers(\n triggers: string[] | { id: string; e: boolean; k?: TRIGGER_TYPES }[],\n): UserStorage {\n const userStorage: UserStorage = {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {},\n },\n };\n\n // insert triggerIds\n triggers.forEach((t) => {\n let tId: string;\n let e: boolean;\n let k: TRIGGER_TYPES;\n if (typeof t === 'string') {\n tId = t;\n e = true;\n k = TRIGGER_TYPES.ERC20_RECEIVED;\n } else {\n tId = t.id;\n e = t.e;\n k = t.k ?? TRIGGER_TYPES.ERC20_RECEIVED;\n }\n\n userStorage[MOCK_USER_STORAGE_ACCOUNT][MOCK_USER_STORAGE_CHAIN][tId] = {\n k,\n e,\n };\n });\n\n return userStorage;\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object (full/realistic object)\n *\n * @param props - provide any override configuration for the mock\n * @param props.triggersEnabled - choose if all triggers created are enabled/disabled\n * @param props.address - choose a specific address for triggers to be assigned to\n * @returns a mock full notification user storage object\n */\nexport function createMockFullUserStorage(\n props: { triggersEnabled?: boolean; address?: string } = {},\n): UserStorage {\n return initializeUserStorage(\n [{ address: props.address ?? MOCK_USER_STORAGE_ACCOUNT }],\n props.triggersEnabled ?? true,\n false,\n );\n}\n"]}
|
package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-notification-user-storage.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-notification-user-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,6CAAyC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,+CAA2C;AAGtE,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAC/C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC9B,WAAW,CAiBb;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,EAAE,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,OAAO,CAAC;IAAC,CAAC,CAAC,EAAE,aAAa,CAAA;CAAE,EAAE,GACnE,WAAW,CA8Bb;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,GAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1D,WAAW,CAMb"}
|
package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-notification-user-storage.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-notification-user-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,6CAAyC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,+CAA2C;AAGtE,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAC/C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC9B,WAAW,CAiBb;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,EAAE,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,OAAO,CAAC;IAAC,CAAC,CAAC,EAAE,aAAa,CAAA;CAAE,EAAE,GACnE,WAAW,CA8Bb;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,GAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1D,WAAW,CAMb"}
|
package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-notification-user-storage.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/__fixtures__/mock-notification-user-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,mCAA+B;AAClE,OAAO,EAAE,aAAa,EAAE,6CAAyC;AAEjE,OAAO,EAAE,qBAAqB,EAAE,2BAAuB;AAEvD,MAAM,CAAC,MAAM,yBAAyB,GACpC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAA+B;IAE/B,OAAO;QACL,CAAC,wBAAwB,CAAC,EAAE,GAAG;QAC/B,CAAC,yBAAyB,CAAC,EAAE;YAC3B,CAAC,uBAAuB,CAAC,EAAE;gBACzB,iBAAiB,EAAE;oBACjB,CAAC,EAAE,aAAa,CAAC,cAAc;oBAC/B,CAAC,EAAE,IAAI;iBACR;gBACD,iBAAiB,EAAE;oBACjB,CAAC,EAAE,aAAa,CAAC,UAAU;oBAC3B,CAAC,EAAE,IAAI;iBACR;aACF;SACF;QACD,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAC/C,QAAoE;IAEpE,MAAM,WAAW,GAAgB;QAC/B,CAAC,wBAAwB,CAAC,EAAE,GAAG;QAC/B,CAAC,yBAAyB,CAAC,EAAE;YAC3B,CAAC,uBAAuB,CAAC,EAAE,EAAE;SAC9B;KACF,CAAC;IAEF,oBAAoB;IACpB,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACrB,IAAI,GAAW,CAAC;QAChB,IAAI,CAAU,CAAC;QACf,IAAI,CAAgB,CAAC;QACrB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YACzB,GAAG,GAAG,CAAC,CAAC;YACR,CAAC,GAAG,IAAI,CAAC;YACT,CAAC,GAAG,aAAa,CAAC,cAAc,CAAC;SAClC;aAAM;YACL,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;YACX,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACR,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,cAAc,CAAC;SACzC;QAED,WAAW,CAAC,yBAAyB,CAAC,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,GAAG;YACrE,CAAC;YACD,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAyD,EAAE;IAE3D,OAAO,qBAAqB,CAC1B,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,yBAAyB,EAAE,CAAC,EACzD,KAAK,CAAC,eAAe,IAAI,IAAI,EAC7B,KAAK,CACN,CAAC;AACJ,CAAC","sourcesContent":["import { USER_STORAGE_VERSION_KEY } from '../constants/constants';\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { UserStorage } from '../types/user-storage/user-storage';\nimport { initializeUserStorage } from '../utils/utils';\n\nexport const MOCK_USER_STORAGE_ACCOUNT =\n '0x0000000000000000000000000000000000000000';\nexport const MOCK_USER_STORAGE_CHAIN = '1';\n\n/**\n * Mocking Utility - create a mock notification user storage object\n *\n * @param override - provide any override configuration for the mock\n * @returns a mock notification user storage object\n */\nexport function createMockUserStorage(\n override?: Partial<UserStorage>,\n): UserStorage {\n return {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {\n '111-111-111-111': {\n k: TRIGGER_TYPES.ERC20_RECEIVED,\n e: true,\n },\n '222-222-222-222': {\n k: TRIGGER_TYPES.ERC20_SENT,\n e: true,\n },\n },\n },\n ...override,\n };\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object with triggers\n *\n * @param triggers - provide any override configuration for the mock\n * @returns a mock notification user storage object with triggers\n */\nexport function createMockUserStorageWithTriggers(\n triggers: string[] | { id: string; e: boolean; k?: TRIGGER_TYPES }[],\n): UserStorage {\n const userStorage: UserStorage = {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {},\n },\n };\n\n // insert triggerIds\n triggers.forEach((t) => {\n let tId: string;\n let e: boolean;\n let k: TRIGGER_TYPES;\n if (typeof t === 'string') {\n tId = t;\n e = true;\n k = TRIGGER_TYPES.ERC20_RECEIVED;\n } else {\n tId = t.id;\n e = t.e;\n k = t.k ?? TRIGGER_TYPES.ERC20_RECEIVED;\n }\n\n userStorage[MOCK_USER_STORAGE_ACCOUNT][MOCK_USER_STORAGE_CHAIN][tId] = {\n k,\n e,\n };\n });\n\n return userStorage;\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object (full/realistic object)\n *\n * @param props - provide any override configuration for the mock\n * @param props.triggersEnabled - choose if all triggers created are enabled/disabled\n * @param props.address - choose a specific address for triggers to be assigned to\n * @returns a mock full notification user storage object\n */\nexport function createMockFullUserStorage(\n props: { triggersEnabled?: boolean; address?: string } = {},\n): UserStorage {\n return initializeUserStorage(\n [{ address: props.address ?? MOCK_USER_STORAGE_ACCOUNT }],\n props.triggersEnabled ?? true,\n false,\n );\n}\n"]}
|