@metamask-previews/notification-services-controller 25.0.0-preview-68fc14e1c → 25.0.0-preview-a511f243f

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 CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Changed
11
+
12
+ - Bump `@metamask/authenticated-user-storage` from `^3.0.0` to `^3.0.1` ([#9458](https://github.com/MetaMask/core/pull/9458))
13
+ - Bump `@metamask/profile-sync-controller` from `^28.2.0` to `^28.3.0` ([#9463](https://github.com/MetaMask/core/pull/9463))
14
+
15
+ ### Fixed
16
+
17
+ - Update `isOnChainRawNotification` to detect on-chain notifications using the v4 `notification_type` discriminator instead of legacy payload field checks, fixing web push notification handling after the v4 API migration ([#9407](https://github.com/MetaMask/core/pull/9407))
18
+
10
19
  ## [25.0.0]
11
20
 
12
21
  ### Added
package/LICENSE CHANGED
@@ -18,3 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,21 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isOnChainRawNotification = void 0;
4
+ const notification_api_type_guards_1 = require("./notification-api-type-guards.cjs");
4
5
  /**
5
- * Checks if the given value is an OnChainRawNotification object.
6
+ * Checks if the given value is an on-chain notification using the v4 `notification_type` discriminator.
6
7
  *
7
8
  * @param notification - The value to check.
8
- * @returns True if the value is an OnChainRawNotification object, false otherwise.
9
+ * @returns True if the value is an on-chain notification, false otherwise.
9
10
  */
10
11
  function isOnChainRawNotification(notification) {
11
- const assumed = notification;
12
- // We don't have a validation/parsing library to check all possible types of an on chain notification
13
- // It is safe enough just to check "some" fields, and catch any errors down the line if the shape is bad.
14
- const isValidEnoughToBeOnChainNotification = [
15
- assumed?.id,
16
- assumed?.payload?.data,
17
- ].every((field) => field !== undefined);
18
- return isValidEnoughToBeOnChainNotification;
12
+ return (0, notification_api_type_guards_1.isOnChainNotification)(notification);
19
13
  }
20
14
  exports.isOnChainRawNotification = isOnChainRawNotification;
21
15
  //# sourceMappingURL=is-onchain-notification.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-onchain-notification.cjs","sourceRoot":"","sources":["../../src/shared/is-onchain-notification.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,YAAqB;IAErB,MAAM,OAAO,GAAG,YAAsC,CAAC;IAEvD,qGAAqG;IACrG,yGAAyG;IACzG,MAAM,oCAAoC,GAAG;QAC3C,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,OAAO,EAAE,IAAI;KACvB,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;IACxC,OAAO,oCAAoC,CAAC;AAC9C,CAAC;AAZD,4DAYC","sourcesContent":["import type { OnChainRawNotification } from '../NotificationServicesController';\n\n/**\n * Checks if the given value is an OnChainRawNotification object.\n *\n * @param notification - The value to check.\n * @returns True if the value is an OnChainRawNotification object, false otherwise.\n */\nexport function isOnChainRawNotification(\n notification: unknown,\n): notification is OnChainRawNotification {\n const assumed = notification as OnChainRawNotification;\n\n // We don't have a validation/parsing library to check all possible types of an on chain notification\n // It is safe enough just to check \"some\" fields, and catch any errors down the line if the shape is bad.\n const isValidEnoughToBeOnChainNotification = [\n assumed?.id,\n assumed?.payload?.data,\n ].every((field) => field !== undefined);\n return isValidEnoughToBeOnChainNotification;\n}\n"]}
1
+ {"version":3,"file":"is-onchain-notification.cjs","sourceRoot":"","sources":["../../src/shared/is-onchain-notification.ts"],"names":[],"mappings":";;;AAIA,qFAAuE;AAEvE;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,YAAqB;IAErB,OAAO,IAAA,oDAAqB,EAAC,YAA0C,CAAC,CAAC;AAC3E,CAAC;AAJD,4DAIC","sourcesContent":["import type {\n UnprocessedRawNotification,\n OnChainNotification,\n} from '../NotificationServicesController/types/notification-api';\nimport { isOnChainNotification } from './notification-api-type-guards';\n\n/**\n * Checks if the given value is an on-chain notification using the v4 `notification_type` discriminator.\n *\n * @param notification - The value to check.\n * @returns True if the value is an on-chain notification, false otherwise.\n */\nexport function isOnChainRawNotification(\n notification: unknown,\n): notification is OnChainNotification {\n return isOnChainNotification(notification as UnprocessedRawNotification);\n}\n"]}
@@ -1,9 +1,9 @@
1
- import type { OnChainRawNotification } from "../NotificationServicesController/index.cjs";
1
+ import type { OnChainNotification } from "../NotificationServicesController/types/notification-api/index.cjs";
2
2
  /**
3
- * Checks if the given value is an OnChainRawNotification object.
3
+ * Checks if the given value is an on-chain notification using the v4 `notification_type` discriminator.
4
4
  *
5
5
  * @param notification - The value to check.
6
- * @returns True if the value is an OnChainRawNotification object, false otherwise.
6
+ * @returns True if the value is an on-chain notification, false otherwise.
7
7
  */
8
- export declare function isOnChainRawNotification(notification: unknown): notification is OnChainRawNotification;
8
+ export declare function isOnChainRawNotification(notification: unknown): notification is OnChainNotification;
9
9
  //# sourceMappingURL=is-onchain-notification.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-onchain-notification.d.cts","sourceRoot":"","sources":["../../src/shared/is-onchain-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,oDAA0C;AAEhF;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,OAAO,GACpB,YAAY,IAAI,sBAAsB,CAUxC"}
1
+ {"version":3,"file":"is-onchain-notification.d.cts","sourceRoot":"","sources":["../../src/shared/is-onchain-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mBAAmB,EACpB,2EAAiE;AAGlE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,OAAO,GACpB,YAAY,IAAI,mBAAmB,CAErC"}
@@ -1,9 +1,9 @@
1
- import type { OnChainRawNotification } from "../NotificationServicesController/index.mjs";
1
+ import type { OnChainNotification } from "../NotificationServicesController/types/notification-api/index.mjs";
2
2
  /**
3
- * Checks if the given value is an OnChainRawNotification object.
3
+ * Checks if the given value is an on-chain notification using the v4 `notification_type` discriminator.
4
4
  *
5
5
  * @param notification - The value to check.
6
- * @returns True if the value is an OnChainRawNotification object, false otherwise.
6
+ * @returns True if the value is an on-chain notification, false otherwise.
7
7
  */
8
- export declare function isOnChainRawNotification(notification: unknown): notification is OnChainRawNotification;
8
+ export declare function isOnChainRawNotification(notification: unknown): notification is OnChainNotification;
9
9
  //# sourceMappingURL=is-onchain-notification.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-onchain-notification.d.mts","sourceRoot":"","sources":["../../src/shared/is-onchain-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,oDAA0C;AAEhF;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,OAAO,GACpB,YAAY,IAAI,sBAAsB,CAUxC"}
1
+ {"version":3,"file":"is-onchain-notification.d.mts","sourceRoot":"","sources":["../../src/shared/is-onchain-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mBAAmB,EACpB,2EAAiE;AAGlE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,OAAO,GACpB,YAAY,IAAI,mBAAmB,CAErC"}
@@ -1,17 +1,11 @@
1
+ import { isOnChainNotification } from "./notification-api-type-guards.mjs";
1
2
  /**
2
- * Checks if the given value is an OnChainRawNotification object.
3
+ * Checks if the given value is an on-chain notification using the v4 `notification_type` discriminator.
3
4
  *
4
5
  * @param notification - The value to check.
5
- * @returns True if the value is an OnChainRawNotification object, false otherwise.
6
+ * @returns True if the value is an on-chain notification, false otherwise.
6
7
  */
7
8
  export function isOnChainRawNotification(notification) {
8
- const assumed = notification;
9
- // We don't have a validation/parsing library to check all possible types of an on chain notification
10
- // It is safe enough just to check "some" fields, and catch any errors down the line if the shape is bad.
11
- const isValidEnoughToBeOnChainNotification = [
12
- assumed?.id,
13
- assumed?.payload?.data,
14
- ].every((field) => field !== undefined);
15
- return isValidEnoughToBeOnChainNotification;
9
+ return isOnChainNotification(notification);
16
10
  }
17
11
  //# sourceMappingURL=is-onchain-notification.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-onchain-notification.mjs","sourceRoot":"","sources":["../../src/shared/is-onchain-notification.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,YAAqB;IAErB,MAAM,OAAO,GAAG,YAAsC,CAAC;IAEvD,qGAAqG;IACrG,yGAAyG;IACzG,MAAM,oCAAoC,GAAG;QAC3C,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,OAAO,EAAE,IAAI;KACvB,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;IACxC,OAAO,oCAAoC,CAAC;AAC9C,CAAC","sourcesContent":["import type { OnChainRawNotification } from '../NotificationServicesController';\n\n/**\n * Checks if the given value is an OnChainRawNotification object.\n *\n * @param notification - The value to check.\n * @returns True if the value is an OnChainRawNotification object, false otherwise.\n */\nexport function isOnChainRawNotification(\n notification: unknown,\n): notification is OnChainRawNotification {\n const assumed = notification as OnChainRawNotification;\n\n // We don't have a validation/parsing library to check all possible types of an on chain notification\n // It is safe enough just to check \"some\" fields, and catch any errors down the line if the shape is bad.\n const isValidEnoughToBeOnChainNotification = [\n assumed?.id,\n assumed?.payload?.data,\n ].every((field) => field !== undefined);\n return isValidEnoughToBeOnChainNotification;\n}\n"]}
1
+ {"version":3,"file":"is-onchain-notification.mjs","sourceRoot":"","sources":["../../src/shared/is-onchain-notification.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,2CAAuC;AAEvE;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,YAAqB;IAErB,OAAO,qBAAqB,CAAC,YAA0C,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["import type {\n UnprocessedRawNotification,\n OnChainNotification,\n} from '../NotificationServicesController/types/notification-api';\nimport { isOnChainNotification } from './notification-api-type-guards';\n\n/**\n * Checks if the given value is an on-chain notification using the v4 `notification_type` discriminator.\n *\n * @param notification - The value to check.\n * @returns True if the value is an on-chain notification, false otherwise.\n */\nexport function isOnChainRawNotification(\n notification: unknown,\n): notification is OnChainNotification {\n return isOnChainNotification(notification as UnprocessedRawNotification);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/notification-services-controller",
3
- "version": "25.0.0-preview-68fc14e1c",
3
+ "version": "25.0.0-preview-a511f243f",
4
4
  "description": "Manages New MetaMask decentralized Notification system",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -106,12 +106,12 @@
106
106
  },
107
107
  "dependencies": {
108
108
  "@contentful/rich-text-html-renderer": "^16.5.2",
109
- "@metamask/authenticated-user-storage": "^3.0.0",
109
+ "@metamask/authenticated-user-storage": "^3.0.1",
110
110
  "@metamask/base-controller": "^9.1.0",
111
111
  "@metamask/controller-utils": "^12.3.0",
112
112
  "@metamask/keyring-controller": "^27.1.0",
113
113
  "@metamask/messenger": "^2.0.0",
114
- "@metamask/profile-sync-controller": "^28.2.0",
114
+ "@metamask/profile-sync-controller": "^28.3.0",
115
115
  "@metamask/utils": "^11.11.0",
116
116
  "bignumber.js": "^9.1.2",
117
117
  "firebase": "^11.2.0",