@metamask/notification-services-controller 0.9.0 → 0.11.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 +33 -1
- package/dist/NotificationServicesController/NotificationServicesController.cjs +90 -12
- package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.cts +38 -2
- package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.mts +38 -2
- package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.mjs +90 -12
- package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/index.cjs +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.cjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/index.d.cts +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/index.d.mts +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/index.mjs +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.mjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs +12 -30
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs +12 -30
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.cjs +29 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.cjs.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.cts +8 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.cts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.mts +8 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.mts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.mjs +25 -0
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.mjs.map +1 -0
- package/dist/NotificationServicesController/constants/notification-schema.cjs +1 -0
- package/dist/NotificationServicesController/constants/notification-schema.cjs.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.cts +2 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.mts +2 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.mjs +1 -0
- package/dist/NotificationServicesController/constants/notification-schema.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.cjs +5 -0
- package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.cts +3 -3
- package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.mts +3 -3
- package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.mjs +5 -0
- package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-snap-notifications.cjs +23 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.cjs.map +1 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.cts +10 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.cts.map +1 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.mts +10 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.mts.map +1 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.mjs +19 -0
- package/dist/NotificationServicesController/processors/process-snap-notifications.mjs.map +1 -0
- package/dist/NotificationServicesController/services/feature-announcements.cjs +17 -9
- package/dist/NotificationServicesController/services/feature-announcements.cjs.map +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.d.cts +3 -1
- package/dist/NotificationServicesController/services/feature-announcements.d.cts.map +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.d.mts +3 -1
- package/dist/NotificationServicesController/services/feature-announcements.d.mts.map +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.mjs +15 -8
- package/dist/NotificationServicesController/services/feature-announcements.mjs.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.cjs.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.d.cts +10 -6
- package/dist/NotificationServicesController/types/notification/notification.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.d.mts +10 -6
- package/dist/NotificationServicesController/types/notification/notification.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.mjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts +5 -5
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts +5 -5
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts +21 -6
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts +21 -6
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs.map +1 -1
- package/dist/NotificationServicesController/types/snaps/index.cjs +18 -0
- package/dist/NotificationServicesController/types/snaps/index.cjs.map +1 -0
- package/dist/NotificationServicesController/types/snaps/index.d.cts +2 -0
- package/dist/NotificationServicesController/types/snaps/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/snaps/index.d.mts +2 -0
- package/dist/NotificationServicesController/types/snaps/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/snaps/index.mjs +2 -0
- package/dist/NotificationServicesController/types/snaps/index.mjs.map +1 -0
- package/dist/NotificationServicesController/types/snaps/snaps.cjs +3 -0
- package/dist/NotificationServicesController/types/snaps/snaps.cjs.map +1 -0
- package/dist/NotificationServicesController/types/snaps/snaps.d.cts +23 -0
- package/dist/NotificationServicesController/types/snaps/snaps.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/snaps/snaps.d.mts +23 -0
- package/dist/NotificationServicesController/types/snaps/snaps.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/snaps/snaps.mjs +2 -0
- package/dist/NotificationServicesController/types/snaps/snaps.mjs.map +1 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +3 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +2 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +2 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +3 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.cjs +2 -2
- package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.cts +1 -0
- package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.mts +1 -0
- package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.mjs +2 -2
- package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
- package/package.json +3 -2
|
@@ -18,11 +18,13 @@ export type ContentfulResult = {
|
|
|
18
18
|
};
|
|
19
19
|
items?: TypeFeatureAnnouncement[];
|
|
20
20
|
};
|
|
21
|
+
export declare const getFeatureAnnouncementUrl: (env: Env, previewToken?: string) => string;
|
|
21
22
|
/**
|
|
22
23
|
* Gets Feature Announcement from our services
|
|
23
24
|
* @param env - environment for feature announcements
|
|
25
|
+
* @param previewToken - the preview token to use if needed
|
|
24
26
|
* @returns Raw Feature Announcements
|
|
25
27
|
*/
|
|
26
|
-
export declare function getFeatureAnnouncementNotifications(env: Env): Promise<INotification[]>;
|
|
28
|
+
export declare function getFeatureAnnouncementNotifications(env: Env, previewToken?: string): Promise<INotification[]>;
|
|
27
29
|
export {};
|
|
28
30
|
//# sourceMappingURL=feature-announcements.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-announcements.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/feature-announcements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAmB,mBAAmB;AAKhE,OAAO,KAAK,EAEV,uBAAuB,EACxB,oEAAgE;AAOjE,OAAO,KAAK,EAAE,aAAa,EAAE,+CAA2C;
|
|
1
|
+
{"version":3,"file":"feature-announcements.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/feature-announcements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAmB,mBAAmB;AAKhE,OAAO,KAAK,EAEV,uBAAuB,EACxB,oEAAgE;AAOjE,OAAO,KAAK,EAAE,aAAa,EAAE,+CAA2C;AAOxE,eAAO,MAAM,wBAAwB,4EAAqF,CAAC;AAC3H,eAAO,MAAM,wBAAwB,6KAAqJ,CAAC;AAE3L,KAAK,GAAG,GAAG;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE;QAET,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;QAEhB,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;KACjB,CAAC;IACF,KAAK,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAS,GAAG,iBAAiB,MAAM,WAMxE,CAAC;AAkGF;;;;;GAKG;AACH,wBAAsB,mCAAmC,CACvD,GAAG,EAAE,GAAG,EACR,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,EAAE,CAAC,CAc1B"}
|
|
@@ -18,11 +18,13 @@ export type ContentfulResult = {
|
|
|
18
18
|
};
|
|
19
19
|
items?: TypeFeatureAnnouncement[];
|
|
20
20
|
};
|
|
21
|
+
export declare const getFeatureAnnouncementUrl: (env: Env, previewToken?: string) => string;
|
|
21
22
|
/**
|
|
22
23
|
* Gets Feature Announcement from our services
|
|
23
24
|
* @param env - environment for feature announcements
|
|
25
|
+
* @param previewToken - the preview token to use if needed
|
|
24
26
|
* @returns Raw Feature Announcements
|
|
25
27
|
*/
|
|
26
|
-
export declare function getFeatureAnnouncementNotifications(env: Env): Promise<INotification[]>;
|
|
28
|
+
export declare function getFeatureAnnouncementNotifications(env: Env, previewToken?: string): Promise<INotification[]>;
|
|
27
29
|
export {};
|
|
28
30
|
//# sourceMappingURL=feature-announcements.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-announcements.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/feature-announcements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAmB,mBAAmB;AAKhE,OAAO,KAAK,EAEV,uBAAuB,EACxB,oEAAgE;AAOjE,OAAO,KAAK,EAAE,aAAa,EAAE,+CAA2C;
|
|
1
|
+
{"version":3,"file":"feature-announcements.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/feature-announcements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAmB,mBAAmB;AAKhE,OAAO,KAAK,EAEV,uBAAuB,EACxB,oEAAgE;AAOjE,OAAO,KAAK,EAAE,aAAa,EAAE,+CAA2C;AAOxE,eAAO,MAAM,wBAAwB,4EAAqF,CAAC;AAC3H,eAAO,MAAM,wBAAwB,6KAAqJ,CAAC;AAE3L,KAAK,GAAG,GAAG;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE;QAET,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;QAEhB,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;KACjB,CAAC;IACF,KAAK,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAS,GAAG,iBAAiB,MAAM,WAMxE,CAAC;AAkGF;;;;;GAKG;AACH,wBAAsB,mCAAmC,CACvD,GAAG,EAAE,GAAG,EACR,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,EAAE,CAAC,CAc1B"}
|
|
@@ -4,13 +4,19 @@ import { processFeatureAnnouncement } from "../processors/process-feature-announ
|
|
|
4
4
|
const DEFAULT_SPACE_ID = ':space_id';
|
|
5
5
|
const DEFAULT_ACCESS_TOKEN = ':access_token';
|
|
6
6
|
const DEFAULT_CLIENT_ID = ':client_id';
|
|
7
|
-
|
|
7
|
+
const DEFAULT_DOMAIN = 'cdn.contentful.com';
|
|
8
|
+
const PREVIEW_DOMAIN = 'preview.contentful.com';
|
|
9
|
+
export const FEATURE_ANNOUNCEMENT_API = `https://${DEFAULT_DOMAIN}/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;
|
|
8
10
|
export const FEATURE_ANNOUNCEMENT_URL = `${FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;
|
|
9
|
-
const getFeatureAnnouncementUrl = (env) =>
|
|
10
|
-
|
|
11
|
-
.replace(
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export const getFeatureAnnouncementUrl = (env, previewToken) => {
|
|
12
|
+
const domain = previewToken ? PREVIEW_DOMAIN : DEFAULT_DOMAIN;
|
|
13
|
+
return FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId)
|
|
14
|
+
.replace(DEFAULT_ACCESS_TOKEN, previewToken || env.accessToken)
|
|
15
|
+
.replace(DEFAULT_CLIENT_ID, env.platform)
|
|
16
|
+
.replace(DEFAULT_DOMAIN, domain);
|
|
17
|
+
};
|
|
18
|
+
const fetchFeatureAnnouncementNotifications = async (env, previewToken) => {
|
|
19
|
+
const url = getFeatureAnnouncementUrl(env, previewToken);
|
|
14
20
|
const data = await fetch(url)
|
|
15
21
|
.then((r) => r.json())
|
|
16
22
|
.catch(() => null);
|
|
@@ -80,11 +86,12 @@ const fetchFeatureAnnouncementNotifications = async (env) => {
|
|
|
80
86
|
/**
|
|
81
87
|
* Gets Feature Announcement from our services
|
|
82
88
|
* @param env - environment for feature announcements
|
|
89
|
+
* @param previewToken - the preview token to use if needed
|
|
83
90
|
* @returns Raw Feature Announcements
|
|
84
91
|
*/
|
|
85
|
-
export async function getFeatureAnnouncementNotifications(env) {
|
|
92
|
+
export async function getFeatureAnnouncementNotifications(env, previewToken) {
|
|
86
93
|
if (env?.accessToken && env?.spaceId && env?.platform) {
|
|
87
|
-
const rawNotifications = await fetchFeatureAnnouncementNotifications(env);
|
|
94
|
+
const rawNotifications = await fetchFeatureAnnouncementNotifications(env, previewToken);
|
|
88
95
|
const notifications = rawNotifications.map((notification) => processFeatureAnnouncement(notification));
|
|
89
96
|
return notifications;
|
|
90
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-announcements.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/feature-announcements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,4CAA4C;AAG3E,OAAO,EAAE,aAAa,EAAE,6CAAyC;AACjE,OAAO,EAAE,0BAA0B,EAAE,uDAAmD;AAcxF,MAAM,gBAAgB,GAAG,WAAW,CAAC;AACrC,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAC7C,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,qCAAqC,gBAAgB,8BAA8B,CAAC;AAC5H,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,wBAAwB,iBAAiB,oBAAoB,+DAA+D,iBAAiB,EAAE,CAAC;AAqB3L,MAAM,yBAAyB,GAAG,CAAC,GAAQ,EAAE,EAAE,CAC7C,wBAAwB,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,OAAO,CAAC;KAC5D,OAAO,CAAC,oBAAoB,EAAE,GAAG,CAAC,WAAW,CAAC;KAC9C,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;AAE9C,MAAM,qCAAqC,GAAG,KAAK,EACjD,GAAQ,EACuC,EAAE;IACjD,MAAM,GAAG,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAE3C,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC;SAC1B,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACrB,KAAK,CAAC,GAAG,EAAE,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E,gBAAgB,IAAI;oBAC9B,cAAc,EAAE,gBAAgB,EAAE,cAAc;oBAChD,aAAa,EAAE,gBAAgB,EAAE,aAAa;iBAC/C;aACF;SACF,CAAC;QAEF,OAAO,YAAY,CAAC;IACtB,CAAC,CAAC,CAAC;IAEL,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mCAAmC,CACvD,GAAQ;IAER,IAAI,GAAG,EAAE,WAAW,IAAI,GAAG,EAAE,OAAO,IAAI,GAAG,EAAE,QAAQ,EAAE;QACrD,MAAM,gBAAgB,GAAG,MAAM,qCAAqC,CAAC,GAAG,CAAC,CAAC;QAC1E,MAAM,aAAa,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAC1D,0BAA0B,CAAC,YAAY,CAAC,CACzC,CAAC;QAEF,OAAO,aAAa,CAAC;KACtB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import { documentToHtmlString } from '@contentful/rich-text-html-renderer';\nimport type { Entry, Asset, EntryCollection } from 'contentful';\n\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport { processFeatureAnnouncement } from '../processors/process-feature-announcement';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\nimport type {\n ImageFields,\n TypeFeatureAnnouncement,\n} from '../types/feature-announcement/type-feature-announcement';\nimport type {\n TypeExternalLinkFields,\n TypePortfolioLinkFields,\n TypeExtensionLinkFields,\n TypeMobileLinkFields,\n} from '../types/feature-announcement/type-links';\nimport type { INotification } from '../types/notification/notification';\n\nconst DEFAULT_SPACE_ID = ':space_id';\nconst DEFAULT_ACCESS_TOKEN = ':access_token';\nconst DEFAULT_CLIENT_ID = ':client_id';\nexport const FEATURE_ANNOUNCEMENT_API = `https://cdn.contentful.com/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;\nexport const FEATURE_ANNOUNCEMENT_URL = `${FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;\n\ntype Env = {\n spaceId: string;\n accessToken: string;\n platform: string;\n};\n\n/**\n * Contentful API Response Shape\n */\nexport type ContentfulResult = {\n includes?: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Entry?: Entry[];\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Asset?: Asset[];\n };\n items?: TypeFeatureAnnouncement[];\n};\n\nconst getFeatureAnnouncementUrl = (env: Env) =>\n FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId)\n .replace(DEFAULT_ACCESS_TOKEN, env.accessToken)\n .replace(DEFAULT_CLIENT_ID, env.platform);\n\nconst fetchFeatureAnnouncementNotifications = async (\n env: Env,\n): Promise<FeatureAnnouncementRawNotification[]> => {\n const url = getFeatureAnnouncementUrl(env);\n\n const data = await fetch(url)\n .then((r) => r.json())\n .catch(() => null);\n\n if (!data) {\n return [];\n }\n\n const findIncludedItem = (sysId: string) => {\n const typedData: EntryCollection<\n | ImageFields\n | TypeExtensionLinkFields\n | TypePortfolioLinkFields\n | TypeMobileLinkFields\n | TypeExternalLinkFields\n > = data;\n const item =\n typedData?.includes?.Entry?.find((i: Entry) => i?.sys?.id === sysId) ||\n typedData?.includes?.Asset?.find((i: Asset) => i?.sys?.id === sysId);\n return item ? item?.fields : null;\n };\n\n const contentfulNotifications = data?.items ?? [];\n const rawNotifications: FeatureAnnouncementRawNotification[] =\n contentfulNotifications.map((n: TypeFeatureAnnouncement) => {\n const { fields } = n;\n const imageFields = fields.image\n ? (findIncludedItem(fields.image.sys.id) as ImageFields['fields'])\n : undefined;\n\n const externalLinkFields = fields.externalLink\n ? (findIncludedItem(\n fields.externalLink.sys.id,\n ) as TypeExternalLinkFields['fields'])\n : undefined;\n const portfolioLinkFields = fields.portfolioLink\n ? (findIncludedItem(\n fields.portfolioLink.sys.id,\n ) as TypePortfolioLinkFields['fields'])\n : undefined;\n const extensionLinkFields = fields.extensionLink\n ? (findIncludedItem(\n fields.extensionLink.sys.id,\n ) as TypeExtensionLinkFields['fields'])\n : undefined;\n const mobileLinkFields = fields.mobileLink\n ? (findIncludedItem(\n fields.mobileLink.sys.id,\n ) as TypeMobileLinkFields['fields'])\n : undefined;\n\n const notification: FeatureAnnouncementRawNotification = {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,\n createdAt: new Date(n.sys.createdAt).toString(),\n data: {\n id: fields.id,\n category: fields.category,\n title: fields.title,\n longDescription: documentToHtmlString(fields.longDescription),\n shortDescription: fields.shortDescription,\n image: {\n title: imageFields?.title,\n description: imageFields?.description,\n url: imageFields?.file?.url ?? '',\n },\n externalLink: externalLinkFields && {\n externalLinkText: externalLinkFields?.externalLinkText,\n externalLinkUrl: externalLinkFields?.externalLinkUrl,\n },\n portfolioLink: portfolioLinkFields && {\n portfolioLinkText: portfolioLinkFields?.portfolioLinkText,\n portfolioLinkUrl: portfolioLinkFields?.portfolioLinkUrl,\n },\n extensionLink: extensionLinkFields && {\n extensionLinkText: extensionLinkFields?.extensionLinkText,\n extensionLinkRoute: extensionLinkFields?.extensionLinkRoute,\n },\n mobileLink: mobileLinkFields && {\n mobileLinkText: mobileLinkFields?.mobileLinkText,\n mobileLinkUrl: mobileLinkFields?.mobileLinkUrl,\n },\n },\n };\n\n return notification;\n });\n\n return rawNotifications;\n};\n\n/**\n * Gets Feature Announcement from our services\n * @param env - environment for feature announcements\n * @returns Raw Feature Announcements\n */\nexport async function getFeatureAnnouncementNotifications(\n env: Env,\n): Promise<INotification[]> {\n if (env?.accessToken && env?.spaceId && env?.platform) {\n const rawNotifications = await fetchFeatureAnnouncementNotifications(env);\n const notifications = rawNotifications.map((notification) =>\n processFeatureAnnouncement(notification),\n );\n\n return notifications;\n }\n\n return [];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"feature-announcements.mjs","sourceRoot":"","sources":["../../../src/NotificationServic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EAAE,kBAAkB;iBAC5D;gBACD,UAAU,EAAE,gBAAgB,IAAI;oBAC9B,cAAc,EAAE,gBAAgB,EAAE,cAAc;oBAChD,aAAa,EAAE,gBAAgB,EAAE,aAAa;iBAC/C;aACF;SACF,CAAC;QAEF,OAAO,YAAY,CAAC;IACtB,CAAC,CAAC,CAAC;IAEL,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mCAAmC,CACvD,GAAQ,EACR,YAAqB;IAErB,IAAI,GAAG,EAAE,WAAW,IAAI,GAAG,EAAE,OAAO,IAAI,GAAG,EAAE,QAAQ,EAAE;QACrD,MAAM,gBAAgB,GAAG,MAAM,qCAAqC,CAClE,GAAG,EACH,YAAY,CACb,CAAC;QACF,MAAM,aAAa,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAC1D,0BAA0B,CAAC,YAAY,CAAC,CACzC,CAAC;QAEF,OAAO,aAAa,CAAC;KACtB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import { documentToHtmlString } from '@contentful/rich-text-html-renderer';\nimport type { Entry, Asset, EntryCollection } from 'contentful';\n\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport { processFeatureAnnouncement } from '../processors/process-feature-announcement';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\nimport type {\n ImageFields,\n TypeFeatureAnnouncement,\n} from '../types/feature-announcement/type-feature-announcement';\nimport type {\n TypeExternalLinkFields,\n TypePortfolioLinkFields,\n TypeExtensionLinkFields,\n TypeMobileLinkFields,\n} from '../types/feature-announcement/type-links';\nimport type { INotification } from '../types/notification/notification';\n\nconst DEFAULT_SPACE_ID = ':space_id';\nconst DEFAULT_ACCESS_TOKEN = ':access_token';\nconst DEFAULT_CLIENT_ID = ':client_id';\nconst DEFAULT_DOMAIN = 'cdn.contentful.com';\nconst PREVIEW_DOMAIN = 'preview.contentful.com';\nexport const FEATURE_ANNOUNCEMENT_API = `https://${DEFAULT_DOMAIN}/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;\nexport const FEATURE_ANNOUNCEMENT_URL = `${FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;\n\ntype Env = {\n spaceId: string;\n accessToken: string;\n platform: string;\n};\n\n/**\n * Contentful API Response Shape\n */\nexport type ContentfulResult = {\n includes?: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Entry?: Entry[];\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Asset?: Asset[];\n };\n items?: TypeFeatureAnnouncement[];\n};\n\nexport const getFeatureAnnouncementUrl = (env: Env, previewToken?: string) => {\n const domain = previewToken ? PREVIEW_DOMAIN : DEFAULT_DOMAIN;\n return FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId)\n .replace(DEFAULT_ACCESS_TOKEN, previewToken || env.accessToken)\n .replace(DEFAULT_CLIENT_ID, env.platform)\n .replace(DEFAULT_DOMAIN, domain);\n};\n\nconst fetchFeatureAnnouncementNotifications = async (\n env: Env,\n previewToken?: string,\n): Promise<FeatureAnnouncementRawNotification[]> => {\n const url = getFeatureAnnouncementUrl(env, previewToken);\n\n const data = await fetch(url)\n .then((r) => r.json())\n .catch(() => null);\n\n if (!data) {\n return [];\n }\n\n const findIncludedItem = (sysId: string) => {\n const typedData: EntryCollection<\n | ImageFields\n | TypeExtensionLinkFields\n | TypePortfolioLinkFields\n | TypeMobileLinkFields\n | TypeExternalLinkFields\n > = data;\n const item =\n typedData?.includes?.Entry?.find((i: Entry) => i?.sys?.id === sysId) ||\n typedData?.includes?.Asset?.find((i: Asset) => i?.sys?.id === sysId);\n return item ? item?.fields : null;\n };\n\n const contentfulNotifications = data?.items ?? [];\n const rawNotifications: FeatureAnnouncementRawNotification[] =\n contentfulNotifications.map((n: TypeFeatureAnnouncement) => {\n const { fields } = n;\n const imageFields = fields.image\n ? (findIncludedItem(fields.image.sys.id) as ImageFields['fields'])\n : undefined;\n\n const externalLinkFields = fields.externalLink\n ? (findIncludedItem(\n fields.externalLink.sys.id,\n ) as TypeExternalLinkFields['fields'])\n : undefined;\n const portfolioLinkFields = fields.portfolioLink\n ? (findIncludedItem(\n fields.portfolioLink.sys.id,\n ) as TypePortfolioLinkFields['fields'])\n : undefined;\n const extensionLinkFields = fields.extensionLink\n ? (findIncludedItem(\n fields.extensionLink.sys.id,\n ) as TypeExtensionLinkFields['fields'])\n : undefined;\n const mobileLinkFields = fields.mobileLink\n ? (findIncludedItem(\n fields.mobileLink.sys.id,\n ) as TypeMobileLinkFields['fields'])\n : undefined;\n\n const notification: FeatureAnnouncementRawNotification = {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,\n createdAt: new Date(n.sys.createdAt).toString(),\n data: {\n id: fields.id,\n category: fields.category,\n title: fields.title,\n longDescription: documentToHtmlString(fields.longDescription),\n shortDescription: fields.shortDescription,\n image: {\n title: imageFields?.title,\n description: imageFields?.description,\n url: imageFields?.file?.url ?? '',\n },\n externalLink: externalLinkFields && {\n externalLinkText: externalLinkFields?.externalLinkText,\n externalLinkUrl: externalLinkFields?.externalLinkUrl,\n },\n portfolioLink: portfolioLinkFields && {\n portfolioLinkText: portfolioLinkFields?.portfolioLinkText,\n portfolioLinkUrl: portfolioLinkFields?.portfolioLinkUrl,\n },\n extensionLink: extensionLinkFields && {\n extensionLinkText: extensionLinkFields?.extensionLinkText,\n extensionLinkRoute: extensionLinkFields?.extensionLinkRoute,\n },\n mobileLink: mobileLinkFields && {\n mobileLinkText: mobileLinkFields?.mobileLinkText,\n mobileLinkUrl: mobileLinkFields?.mobileLinkUrl,\n },\n },\n };\n\n return notification;\n });\n\n return rawNotifications;\n};\n\n/**\n * Gets Feature Announcement from our services\n * @param env - environment for feature announcements\n * @param previewToken - the preview token to use if needed\n * @returns Raw Feature Announcements\n */\nexport async function getFeatureAnnouncementNotifications(\n env: Env,\n previewToken?: string,\n): Promise<INotification[]> {\n if (env?.accessToken && env?.spaceId && env?.platform) {\n const rawNotifications = await fetchFeatureAnnouncementNotifications(\n env,\n previewToken,\n );\n const notifications = rawNotifications.map((notification) =>\n processFeatureAnnouncement(notification),\n );\n\n return notifications;\n }\n\n return [];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { Compute } from '../type-utils';\n\nexport type
|
|
1
|
+
{"version":3,"file":"notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { RawSnapNotification } from '../snaps';\nimport type { Compute } from '../type-utils';\n\nexport type BaseNotification = {\n id: string;\n createdAt: string;\n isRead: boolean;\n};\n\nexport type RawNotificationUnion =\n | OnChainRawNotification\n | FeatureAnnouncementRawNotification\n | RawSnapNotification;\n\n/**\n * The shape of a \"generic\" notification.\n * Other than the fields listed below, tt will also contain:\n * - `type` field (declared in the Raw shapes)\n * - `data` field (declared in the Raw shapes)\n */\nexport type INotification = Compute<\n | (FeatureAnnouncementRawNotification & BaseNotification)\n | (OnChainRawNotification & BaseNotification)\n | (RawSnapNotification & BaseNotification & { readDate?: string | null })\n>;\n\n// NFT\nexport type NFT = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n token_id: string;\n image: string;\n collection?: {\n name: string;\n image: string;\n };\n};\n\nexport type MarkAsReadNotificationsParam = Pick<\n INotification,\n 'id' | 'type' | 'isRead'\n>[];\n"]}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { FeatureAnnouncementRawNotification } from "../feature-announcement/feature-announcement.cjs";
|
|
2
2
|
import type { OnChainRawNotification } from "../on-chain-notification/on-chain-notification.cjs";
|
|
3
|
+
import type { RawSnapNotification } from "../snaps/index.cjs";
|
|
3
4
|
import type { Compute } from "../type-utils.cjs";
|
|
4
|
-
export type
|
|
5
|
+
export type BaseNotification = {
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
isRead: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type RawNotificationUnion = OnChainRawNotification | FeatureAnnouncementRawNotification | RawSnapNotification;
|
|
5
11
|
/**
|
|
6
12
|
* The shape of a "generic" notification.
|
|
7
13
|
* Other than the fields listed below, tt will also contain:
|
|
8
14
|
* - `type` field (declared in the Raw shapes)
|
|
9
15
|
* - `data` field (declared in the Raw shapes)
|
|
10
16
|
*/
|
|
11
|
-
export type INotification = Compute<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
isRead: boolean;
|
|
15
|
-
}>;
|
|
17
|
+
export type INotification = Compute<(FeatureAnnouncementRawNotification & BaseNotification) | (OnChainRawNotification & BaseNotification) | (RawSnapNotification & BaseNotification & {
|
|
18
|
+
readDate?: string | null;
|
|
19
|
+
})>;
|
|
16
20
|
export type NFT = {
|
|
17
21
|
token_id: string;
|
|
18
22
|
image: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,sBAAsB,GACtB,kCAAkC,GAClC,mBAAmB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAC/B,CAAC,kCAAkC,GAAG,gBAAgB,CAAC,GACvD,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,GAC3C,CAAC,mBAAmB,GAAG,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAC1E,CAAC;AAGF,MAAM,MAAM,GAAG,GAAG;IAEhB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAC7C,aAAa,EACb,IAAI,GAAG,MAAM,GAAG,QAAQ,CACzB,EAAE,CAAC"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { FeatureAnnouncementRawNotification } from "../feature-announcement/feature-announcement.mjs";
|
|
2
2
|
import type { OnChainRawNotification } from "../on-chain-notification/on-chain-notification.mjs";
|
|
3
|
+
import type { RawSnapNotification } from "../snaps/index.mjs";
|
|
3
4
|
import type { Compute } from "../type-utils.mjs";
|
|
4
|
-
export type
|
|
5
|
+
export type BaseNotification = {
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
isRead: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type RawNotificationUnion = OnChainRawNotification | FeatureAnnouncementRawNotification | RawSnapNotification;
|
|
5
11
|
/**
|
|
6
12
|
* The shape of a "generic" notification.
|
|
7
13
|
* Other than the fields listed below, tt will also contain:
|
|
8
14
|
* - `type` field (declared in the Raw shapes)
|
|
9
15
|
* - `data` field (declared in the Raw shapes)
|
|
10
16
|
*/
|
|
11
|
-
export type INotification = Compute<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
isRead: boolean;
|
|
15
|
-
}>;
|
|
17
|
+
export type INotification = Compute<(FeatureAnnouncementRawNotification & BaseNotification) | (OnChainRawNotification & BaseNotification) | (RawSnapNotification & BaseNotification & {
|
|
18
|
+
readDate?: string | null;
|
|
19
|
+
})>;
|
|
16
20
|
export type NFT = {
|
|
17
21
|
token_id: string;
|
|
18
22
|
image: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,sBAAsB,GACtB,kCAAkC,GAClC,mBAAmB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAC/B,CAAC,kCAAkC,GAAG,gBAAgB,CAAC,GACvD,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,GAC3C,CAAC,mBAAmB,GAAG,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAC1E,CAAC;AAGF,MAAM,MAAM,GAAG,GAAG;IAEhB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAC7C,aAAa,EACb,IAAI,GAAG,MAAM,GAAG,QAAQ,CACzB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { Compute } from '../type-utils';\n\nexport type
|
|
1
|
+
{"version":3,"file":"notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { RawSnapNotification } from '../snaps';\nimport type { Compute } from '../type-utils';\n\nexport type BaseNotification = {\n id: string;\n createdAt: string;\n isRead: boolean;\n};\n\nexport type RawNotificationUnion =\n | OnChainRawNotification\n | FeatureAnnouncementRawNotification\n | RawSnapNotification;\n\n/**\n * The shape of a \"generic\" notification.\n * Other than the fields listed below, tt will also contain:\n * - `type` field (declared in the Raw shapes)\n * - `data` field (declared in the Raw shapes)\n */\nexport type INotification = Compute<\n | (FeatureAnnouncementRawNotification & BaseNotification)\n | (OnChainRawNotification & BaseNotification)\n | (RawSnapNotification & BaseNotification & { readDate?: string | null })\n>;\n\n// NFT\nexport type NFT = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n token_id: string;\n image: string;\n collection?: {\n name: string;\n image: string;\n };\n};\n\nexport type MarkAsReadNotificationsParam = Pick<\n INotification,\n 'id' | 'type' | 'isRead'\n>[];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\nimport type { components } from './schema';\n\nexport type Data_MetamaskSwapCompleted =\n components['schemas']['Data_MetamaskSwapCompleted'];\nexport type Data_LidoStakeReadyToBeWithdrawn =\n components['schemas']['Data_LidoStakeReadyToBeWithdrawn'];\nexport type Data_LidoStakeCompleted =\n components['schemas']['Data_LidoStakeCompleted'];\nexport type Data_LidoWithdrawalRequested =\n components['schemas']['Data_LidoWithdrawalRequested'];\nexport type Data_LidoWithdrawalCompleted =\n components['schemas']['Data_LidoWithdrawalCompleted'];\nexport type Data_RocketPoolStakeCompleted =\n components['schemas']['Data_RocketPoolStakeCompleted'];\nexport type Data_RocketPoolUnstakeCompleted =\n components['schemas']['Data_RocketPoolUnstakeCompleted'];\nexport type Data_ETHSent = components['schemas']['Data_ETHSent'];\nexport type Data_ETHReceived = components['schemas']['Data_ETHReceived'];\nexport type Data_ERC20Sent = components['schemas']['Data_ERC20Sent'];\nexport type Data_ERC20Received = components['schemas']['Data_ERC20Received'];\nexport type Data_ERC721Sent = components['schemas']['Data_ERC721Sent'];\nexport type Data_ERC721Received = components['schemas']['Data_ERC721Received'];\n\n// Web3Notifications\nexport type Data_AaveV3HealthFactor =\n components['schemas']['Data_AaveV3HealthFactor'];\nexport type Data_EnsExpiration = components['schemas']['Data_EnsExpiration'];\nexport type Data_LidoStakingRewards =\n components['schemas']['Data_LidoStakingRewards'];\nexport type Data_RocketpoolStakingRewards =\n components['schemas']['Data_RocketpoolStakingRewards'];\nexport type Data_NotionalLoanExpiration =\n components['schemas']['Data_NotionalLoanExpiration'];\nexport type Data_SparkFiHealthFactor =\n components['schemas']['Data_SparkFiHealthFactor'];\n\ntype Notification
|
|
1
|
+
{"version":3,"file":"on-chain-notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\nimport type { components } from './schema';\n\nexport type Data_MetamaskSwapCompleted =\n components['schemas']['Data_MetamaskSwapCompleted'];\nexport type Data_LidoStakeReadyToBeWithdrawn =\n components['schemas']['Data_LidoStakeReadyToBeWithdrawn'];\nexport type Data_LidoStakeCompleted =\n components['schemas']['Data_LidoStakeCompleted'];\nexport type Data_LidoWithdrawalRequested =\n components['schemas']['Data_LidoWithdrawalRequested'];\nexport type Data_LidoWithdrawalCompleted =\n components['schemas']['Data_LidoWithdrawalCompleted'];\nexport type Data_RocketPoolStakeCompleted =\n components['schemas']['Data_RocketPoolStakeCompleted'];\nexport type Data_RocketPoolUnstakeCompleted =\n components['schemas']['Data_RocketPoolUnstakeCompleted'];\nexport type Data_ETHSent = components['schemas']['Data_ETHSent'];\nexport type Data_ETHReceived = components['schemas']['Data_ETHReceived'];\nexport type Data_ERC20Sent = components['schemas']['Data_ERC20Sent'];\nexport type Data_ERC20Received = components['schemas']['Data_ERC20Received'];\nexport type Data_ERC721Sent = components['schemas']['Data_ERC721Sent'];\nexport type Data_ERC721Received = components['schemas']['Data_ERC721Received'];\n\n// Web3Notifications\nexport type Data_AaveV3HealthFactor =\n components['schemas']['Data_AaveV3HealthFactor'];\nexport type Data_EnsExpiration = components['schemas']['Data_EnsExpiration'];\nexport type Data_LidoStakingRewards =\n components['schemas']['Data_LidoStakingRewards'];\nexport type Data_RocketpoolStakingRewards =\n components['schemas']['Data_RocketpoolStakingRewards'];\nexport type Data_NotionalLoanExpiration =\n components['schemas']['Data_NotionalLoanExpiration'];\nexport type Data_SparkFiHealthFactor =\n components['schemas']['Data_SparkFiHealthFactor'];\n\ntype Notification =\n | components['schemas']['WalletNotification']\n | components['schemas']['Web3Notification'];\ntype ConvertToEnum<Kind> = {\n [K in TRIGGER_TYPES]: Kind extends `${K}` ? K : never;\n}[TRIGGER_TYPES];\n\n/**\n * Type-Computation.\n * 1. Adds a `type` field to the notification, it converts the schema type into the ENUM we use.\n * 2. It ensures that the `data` field is the correct Notification data for this `type`\n * - The `Compute` utility merges the intersections (`&`) for a prettier type.\n */\ntype NormalizeNotification<\n N extends Notification,\n NotificationDataKinds extends string = NonNullable<N['data']>['kind'],\n> = {\n [K in NotificationDataKinds]: Compute<\n Omit<N, 'data'> & {\n type: ConvertToEnum<K>;\n data: Extract<N['data'], { kind: K }>;\n }\n >;\n}[NotificationDataKinds];\n\nexport type OnChainRawNotification = Compute<\n | NormalizeNotification<components['schemas']['WalletNotification']>\n | NormalizeNotification<components['schemas']['Web3Notification']>\n>;\n\nexport type UnprocessedOnChainRawNotification = Notification;\n\nexport type OnChainRawNotificationsWithNetworkFields = Extract<\n OnChainRawNotification,\n { data: { network_fee: unknown } }\n>;\n"]}
|
package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts
CHANGED
|
@@ -20,8 +20,7 @@ export type Data_LidoStakingRewards = components['schemas']['Data_LidoStakingRew
|
|
|
20
20
|
export type Data_RocketpoolStakingRewards = components['schemas']['Data_RocketpoolStakingRewards'];
|
|
21
21
|
export type Data_NotionalLoanExpiration = components['schemas']['Data_NotionalLoanExpiration'];
|
|
22
22
|
export type Data_SparkFiHealthFactor = components['schemas']['Data_SparkFiHealthFactor'];
|
|
23
|
-
type Notification = components['schemas']['
|
|
24
|
-
type NotificationDataKinds = NonNullable<Notification['data']>['kind'];
|
|
23
|
+
type Notification = components['schemas']['WalletNotification'] | components['schemas']['Web3Notification'];
|
|
25
24
|
type ConvertToEnum<Kind> = {
|
|
26
25
|
[K in TRIGGER_TYPES]: Kind extends `${K}` ? K : never;
|
|
27
26
|
}[TRIGGER_TYPES];
|
|
@@ -31,14 +30,15 @@ type ConvertToEnum<Kind> = {
|
|
|
31
30
|
* 2. It ensures that the `data` field is the correct Notification data for this `type`
|
|
32
31
|
* - The `Compute` utility merges the intersections (`&`) for a prettier type.
|
|
33
32
|
*/
|
|
34
|
-
|
|
35
|
-
[K in NotificationDataKinds]: Compute<Omit<
|
|
33
|
+
type NormalizeNotification<N extends Notification, NotificationDataKinds extends string = NonNullable<N['data']>['kind']> = {
|
|
34
|
+
[K in NotificationDataKinds]: Compute<Omit<N, 'data'> & {
|
|
36
35
|
type: ConvertToEnum<K>;
|
|
37
|
-
data: Extract<
|
|
36
|
+
data: Extract<N['data'], {
|
|
38
37
|
kind: K;
|
|
39
38
|
}>;
|
|
40
39
|
}>;
|
|
41
40
|
}[NotificationDataKinds];
|
|
41
|
+
export type OnChainRawNotification = Compute<NormalizeNotification<components['schemas']['WalletNotification']> | NormalizeNotification<components['schemas']['Web3Notification']>>;
|
|
42
42
|
export type UnprocessedOnChainRawNotification = Notification;
|
|
43
43
|
export type OnChainRawNotificationsWithNetworkFields = Extract<OnChainRawNotification, {
|
|
44
44
|
data: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/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AAC;AAG/E,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAC7E,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,6BAA6B,GACvC,UAAU,CAAC,SAAS,CAAC,CAAC,+BAA+B,CAAC,CAAC;AACzD,MAAM,MAAM,2BAA2B,GACrC,UAAU,CAAC,SAAS,CAAC,CAAC,6BAA6B,CAAC,CAAC;AACvD,MAAM,MAAM,wBAAwB,GAClC,UAAU,CAAC,SAAS,CAAC,CAAC,0BAA0B,CAAC,CAAC;AAEpD,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"on-chain-notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gDAA4C;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAiB;AAE3C,MAAM,MAAM,0BAA0B,GACpC,UAAU,CAAC,SAAS,CAAC,CAAC,4BAA4B,CAAC,CAAC;AACtD,MAAM,MAAM,gCAAgC,GAC1C,UAAU,CAAC,SAAS,CAAC,CAAC,kCAAkC,CAAC,CAAC;AAC5D,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,4BAA4B,GACtC,UAAU,CAAC,SAAS,CAAC,CAAC,8BAA8B,CAAC,CAAC;AACxD,MAAM,MAAM,4BAA4B,GACtC,UAAU,CAAC,SAAS,CAAC,CAAC,8BAA8B,CAAC,CAAC;AACxD,MAAM,MAAM,6BAA6B,GACvC,UAAU,CA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AAC,CAAC;AAC9C,KAAK,aAAa,CAAC,IAAI,IAAI;KACxB,CAAC,IAAI,aAAa,GAAG,IAAI,SAAS,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK;CACtD,CAAC,aAAa,CAAC,CAAC;AAEjB;;;;;GAKG;AACH,KAAK,qBAAqB,CACxB,CAAC,SAAS,YAAY,EACtB,qBAAqB,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IACnE;KACD,CAAC,IAAI,qBAAqB,GAAG,OAAO,CACnC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG;QAChB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;YAAE,IAAI,EAAE,CAAC,CAAA;SAAE,CAAC,CAAC;KACvC,CACF;CACF,CAAC,qBAAqB,CAAC,CAAC;AAEzB,MAAM,MAAM,sBAAsB,GAAG,OAAO,CACxC,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC,GAClE,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,CACnE,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,YAAY,CAAC;AAE7D,MAAM,MAAM,wCAAwC,GAAG,OAAO,CAC5D,sBAAsB,EACtB;IAAE,IAAI,EAAE;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,CACnC,CAAC"}
|
package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts
CHANGED
|
@@ -20,8 +20,7 @@ export type Data_LidoStakingRewards = components['schemas']['Data_LidoStakingRew
|
|
|
20
20
|
export type Data_RocketpoolStakingRewards = components['schemas']['Data_RocketpoolStakingRewards'];
|
|
21
21
|
export type Data_NotionalLoanExpiration = components['schemas']['Data_NotionalLoanExpiration'];
|
|
22
22
|
export type Data_SparkFiHealthFactor = components['schemas']['Data_SparkFiHealthFactor'];
|
|
23
|
-
type Notification = components['schemas']['
|
|
24
|
-
type NotificationDataKinds = NonNullable<Notification['data']>['kind'];
|
|
23
|
+
type Notification = components['schemas']['WalletNotification'] | components['schemas']['Web3Notification'];
|
|
25
24
|
type ConvertToEnum<Kind> = {
|
|
26
25
|
[K in TRIGGER_TYPES]: Kind extends `${K}` ? K : never;
|
|
27
26
|
}[TRIGGER_TYPES];
|
|
@@ -31,14 +30,15 @@ type ConvertToEnum<Kind> = {
|
|
|
31
30
|
* 2. It ensures that the `data` field is the correct Notification data for this `type`
|
|
32
31
|
* - The `Compute` utility merges the intersections (`&`) for a prettier type.
|
|
33
32
|
*/
|
|
34
|
-
|
|
35
|
-
[K in NotificationDataKinds]: Compute<Omit<
|
|
33
|
+
type NormalizeNotification<N extends Notification, NotificationDataKinds extends string = NonNullable<N['data']>['kind']> = {
|
|
34
|
+
[K in NotificationDataKinds]: Compute<Omit<N, 'data'> & {
|
|
36
35
|
type: ConvertToEnum<K>;
|
|
37
|
-
data: Extract<
|
|
36
|
+
data: Extract<N['data'], {
|
|
38
37
|
kind: K;
|
|
39
38
|
}>;
|
|
40
39
|
}>;
|
|
41
40
|
}[NotificationDataKinds];
|
|
41
|
+
export type OnChainRawNotification = Compute<NormalizeNotification<components['schemas']['WalletNotification']> | NormalizeNotification<components['schemas']['Web3Notification']>>;
|
|
42
42
|
export type UnprocessedOnChainRawNotification = Notification;
|
|
43
43
|
export type OnChainRawNotificationsWithNetworkFields = Extract<OnChainRawNotification, {
|
|
44
44
|
data: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gDAA4C;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAC7C,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AAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAC7E,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,6BAA6B,GACvC,UAAU,CAAC,SAAS,CAAC,CAAC,+BAA+B,CAAC,CAAC;AACzD,MAAM,MAAM,2BAA2B,GACrC,UAAU,CAAC,SAAS,CAAC,CAAC,6BAA6B,CAAC,CAAC;AACvD,MAAM,MAAM,wBAAwB,GAClC,UAAU,CAAC,SAAS,CAAC,CAAC,0BAA0B,CAAC,CAAC;AAEpD,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"on-chain-notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gDAA4C;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAiB;AAE3C,MAAM,MAAM,0BAA0B,GACpC,UAAU,CAAC,SAAS,CAAC,CAAC,4BAA4B,CAAC,CAAC;AACtD,MAAM,MAAM,gCAAgC,GAC1C,UAAU,CAAC,SAAS,CAAC,CAAC,kCAAkC,CAAC,CAAC;AAC5D,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,4BAA4B,GACtC,UAAU,CAAC,SAAS,CAAC,CAAC,8BAA8B,CAAC,CAAC;AACxD,MAAM,MAAM,4BAA4B,GACtC,UAAU,CAAC,SAAS,CAAC,CAAC,8BAA8B,CAAC,CAAC;AACxD,MAAM,MAAM,6BAA6B,GACvC,UAAU,CAAC,SAAS,CAAC,CAAC,+BAA+B,CAAC,CAAC;AACzD,MAAM,MAAM,+BAA+B,GACzC,UAAU,CAAC,SAAS,CAAC,CAAC,iCAAiC,CAAC,CAA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AG,KAAK;CACtD,CAAC,aAAa,CAAC,CAAC;AAEjB;;;;;GAKG;AACH,KAAK,qBAAqB,CACxB,CAAC,SAAS,YAAY,EACtB,qBAAqB,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IACnE;KACD,CAAC,IAAI,qBAAqB,GAAG,OAAO,CACnC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG;QAChB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;YAAE,IAAI,EAAE,CAAC,CAAA;SAAE,CAAC,CAAC;KACvC,CACF;CACF,CAAC,qBAAqB,CAAC,CAAC;AAEzB,MAAM,MAAM,sBAAsB,GAAG,OAAO,CACxC,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC,GAClE,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,CACnE,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,YAAY,CAAC;AAE7D,MAAM,MAAM,wCAAwC,GAAG,OAAO,CAC5D,sBAAsB,EACtB;IAAE,IAAI,EAAE;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,CACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\nimport type { components } from './schema';\n\nexport type Data_MetamaskSwapCompleted =\n components['schemas']['Data_MetamaskSwapCompleted'];\nexport type Data_LidoStakeReadyToBeWithdrawn =\n components['schemas']['Data_LidoStakeReadyToBeWithdrawn'];\nexport type Data_LidoStakeCompleted =\n components['schemas']['Data_LidoStakeCompleted'];\nexport type Data_LidoWithdrawalRequested =\n components['schemas']['Data_LidoWithdrawalRequested'];\nexport type Data_LidoWithdrawalCompleted =\n components['schemas']['Data_LidoWithdrawalCompleted'];\nexport type Data_RocketPoolStakeCompleted =\n components['schemas']['Data_RocketPoolStakeCompleted'];\nexport type Data_RocketPoolUnstakeCompleted =\n components['schemas']['Data_RocketPoolUnstakeCompleted'];\nexport type Data_ETHSent = components['schemas']['Data_ETHSent'];\nexport type Data_ETHReceived = components['schemas']['Data_ETHReceived'];\nexport type Data_ERC20Sent = components['schemas']['Data_ERC20Sent'];\nexport type Data_ERC20Received = components['schemas']['Data_ERC20Received'];\nexport type Data_ERC721Sent = components['schemas']['Data_ERC721Sent'];\nexport type Data_ERC721Received = components['schemas']['Data_ERC721Received'];\n\n// Web3Notifications\nexport type Data_AaveV3HealthFactor =\n components['schemas']['Data_AaveV3HealthFactor'];\nexport type Data_EnsExpiration = components['schemas']['Data_EnsExpiration'];\nexport type Data_LidoStakingRewards =\n components['schemas']['Data_LidoStakingRewards'];\nexport type Data_RocketpoolStakingRewards =\n components['schemas']['Data_RocketpoolStakingRewards'];\nexport type Data_NotionalLoanExpiration =\n components['schemas']['Data_NotionalLoanExpiration'];\nexport type Data_SparkFiHealthFactor =\n components['schemas']['Data_SparkFiHealthFactor'];\n\ntype Notification
|
|
1
|
+
{"version":3,"file":"on-chain-notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\nimport type { components } from './schema';\n\nexport type Data_MetamaskSwapCompleted =\n components['schemas']['Data_MetamaskSwapCompleted'];\nexport type Data_LidoStakeReadyToBeWithdrawn =\n components['schemas']['Data_LidoStakeReadyToBeWithdrawn'];\nexport type Data_LidoStakeCompleted =\n components['schemas']['Data_LidoStakeCompleted'];\nexport type Data_LidoWithdrawalRequested =\n components['schemas']['Data_LidoWithdrawalRequested'];\nexport type Data_LidoWithdrawalCompleted =\n components['schemas']['Data_LidoWithdrawalCompleted'];\nexport type Data_RocketPoolStakeCompleted =\n components['schemas']['Data_RocketPoolStakeCompleted'];\nexport type Data_RocketPoolUnstakeCompleted =\n components['schemas']['Data_RocketPoolUnstakeCompleted'];\nexport type Data_ETHSent = components['schemas']['Data_ETHSent'];\nexport type Data_ETHReceived = components['schemas']['Data_ETHReceived'];\nexport type Data_ERC20Sent = components['schemas']['Data_ERC20Sent'];\nexport type Data_ERC20Received = components['schemas']['Data_ERC20Received'];\nexport type Data_ERC721Sent = components['schemas']['Data_ERC721Sent'];\nexport type Data_ERC721Received = components['schemas']['Data_ERC721Received'];\n\n// Web3Notifications\nexport type Data_AaveV3HealthFactor =\n components['schemas']['Data_AaveV3HealthFactor'];\nexport type Data_EnsExpiration = components['schemas']['Data_EnsExpiration'];\nexport type Data_LidoStakingRewards =\n components['schemas']['Data_LidoStakingRewards'];\nexport type Data_RocketpoolStakingRewards =\n components['schemas']['Data_RocketpoolStakingRewards'];\nexport type Data_NotionalLoanExpiration =\n components['schemas']['Data_NotionalLoanExpiration'];\nexport type Data_SparkFiHealthFactor =\n components['schemas']['Data_SparkFiHealthFactor'];\n\ntype Notification =\n | components['schemas']['WalletNotification']\n | components['schemas']['Web3Notification'];\ntype ConvertToEnum<Kind> = {\n [K in TRIGGER_TYPES]: Kind extends `${K}` ? K : never;\n}[TRIGGER_TYPES];\n\n/**\n * Type-Computation.\n * 1. Adds a `type` field to the notification, it converts the schema type into the ENUM we use.\n * 2. It ensures that the `data` field is the correct Notification data for this `type`\n * - The `Compute` utility merges the intersections (`&`) for a prettier type.\n */\ntype NormalizeNotification<\n N extends Notification,\n NotificationDataKinds extends string = NonNullable<N['data']>['kind'],\n> = {\n [K in NotificationDataKinds]: Compute<\n Omit<N, 'data'> & {\n type: ConvertToEnum<K>;\n data: Extract<N['data'], { kind: K }>;\n }\n >;\n}[NotificationDataKinds];\n\nexport type OnChainRawNotification = Compute<\n | NormalizeNotification<components['schemas']['WalletNotification']>\n | NormalizeNotification<components['schemas']['Web3Notification']>\n>;\n\nexport type UnprocessedOnChainRawNotification = Notification;\n\nexport type OnChainRawNotificationsWithNetworkFields = Extract<\n OnChainRawNotification,\n { data: { network_fee: unknown } }\n>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/schema.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD;;;;GAIG","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n/**\n * This file was auto-generated by openapi-typescript.\n * Do not make direct changes to the file.\n * Script: `npx openapi-typescript <PATH TO NOTIFICATION API SPEC> -o ./schema.d.ts`\n */\n\n/**\n * This file was auto-generated by openapi-typescript.\n * Do not make direct changes to the file.\n */\n\nexport type paths = {\n '/api/v1/notifications': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /** List all notifications ordered by most recent */\n post: {\n parameters: {\n query?: {\n /** @description Page number for pagination */\n page?: number;\n /** @description Number of notifications per page for pagination */\n per_page?: number;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: {\n content: {\n 'application/json': {\n trigger_ids: string[];\n chain_ids?: number[];\n kinds?: string[];\n unread?: boolean;\n };\n };\n };\n responses: {\n /** @description Successfully fetched a list of notifications */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['Notification'][];\n };\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/v1/notifications/mark-as-read': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /** Mark notifications as read */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': {\n ids?: string[];\n };\n };\n };\n responses: {\n /** @description Successfully marked notifications as read */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/internal/v1/topics': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all topics created (internal) */\n get: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched all topics */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['Topic'][];\n };\n };\n };\n };\n put?: never;\n /** Create a new topic (internal) */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': {\n name: string;\n desc?: string;\n };\n };\n };\n responses: {\n /** @description Successfully created a new topic */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/internal/v1/subtopics': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all sub-topics created (internal) */\n get: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched all subtopics */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['SubTopic'][];\n };\n };\n };\n };\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/internal/v1/global-notifications': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /** Insert a new Global Notification (internal) */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': components['schemas']['GlobalNotificationWrite'];\n };\n };\n responses: {\n /** @description Successfully created a new global notification */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/v1/global-notifications': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all Global Notifications for a UserID */\n get: {\n parameters: {\n query: {\n /** @description Platform(s) to filter notifications by */\n platform: ('portfolio' | 'extension' | 'mobile')[];\n /** @description Delivery channel(s) to filter notifications by */\n deliveryChannel: ('inbox' | 'push')[];\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched global notifications */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['GlobalNotification'][];\n };\n };\n };\n };\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/v1/user-preferences': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all preferences for a UserID */\n get: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched preferences */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['Topic'][];\n };\n };\n /** @description User not found */\n 404: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n put?: never;\n /** Update Preferences for a UserID */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': {\n topics: string[];\n };\n };\n };\n responses: {\n /** @description Successfully updated topics preferences */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n};\nexport type webhooks = Record<string, never>;\nexport type components = {\n schemas: {\n GlobalNotification: {\n title: string;\n body: string;\n /** Format: date-time */\n created_at: string;\n };\n GlobalNotificationWrite: {\n title: string;\n body: string;\n 'sub-topic': string;\n platforms: ('portfolio' | 'extension' | 'mobile')[];\n delivery_channels: ('inbox' | 'push')[];\n };\n Topic: {\n name: string;\n description?: string;\n /** Format: date-time */\n created_at?: string;\n };\n SubTopic: {\n name: string;\n /** Format: date-time */\n created_at?: string;\n };\n Notification: {\n /** Format: uuid */\n id: string;\n /** Format: uuid */\n trigger_id: string;\n /** @example 1 */\n chain_id: number;\n /** @example 17485840 */\n block_number?: number;\n block_timestamp?: string;\n /**\n * Format: address\n * @example 0x881D40237659C251811CEC9c364ef91dC08D300C\n */\n tx_hash?: string;\n /** @example false */\n unread: boolean;\n /** Format: date-time */\n created_at: string;\n /** Format: address */\n address: string;\n data?:\n | components['schemas']['Data_MetamaskSwapCompleted']\n | components['schemas']['Data_LidoStakeReadyToBeWithdrawn']\n | components['schemas']['Data_LidoStakeCompleted']\n | components['schemas']['Data_LidoWithdrawalRequested']\n | components['schemas']['Data_LidoWithdrawalCompleted']\n | components['schemas']['Data_RocketPoolStakeCompleted']\n | components['schemas']['Data_RocketPoolUnstakeCompleted']\n | components['schemas']['Data_ETHSent']\n | components['schemas']['Data_ETHReceived']\n | components['schemas']['Data_ERC20Sent']\n | components['schemas']['Data_ERC20Received']\n | components['schemas']['Data_ERC721Sent']\n | components['schemas']['Data_ERC721Received']\n | components['schemas']['Data_ERC1155Sent']\n | components['schemas']['Data_ERC1155Received']\n | components['schemas']['Data_AaveV3HealthFactor']\n | components['schemas']['Data_EnsExpiration']\n | components['schemas']['Data_LidoStakingRewards']\n | components['schemas']['Data_RocketpoolStakingRewards']\n | components['schemas']['Data_NotionalLoanExpiration']\n | components['schemas']['Data_SparkFiHealthFactor'];\n };\n Data_MetamaskSwapCompleted: {\n /** @enum {string} */\n kind: 'metamask_swap_completed';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: decimal */\n rate: string;\n token_in: components['schemas']['Token'];\n token_out: components['schemas']['Token'];\n };\n Data_LidoStakeCompleted: {\n /** @enum {string} */\n kind: 'lido_stake_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_LidoWithdrawalRequested: {\n /** @enum {string} */\n kind: 'lido_withdrawal_requested';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_LidoStakeReadyToBeWithdrawn: {\n /** @enum {string} */\n kind: 'lido_stake_ready_to_be_withdrawn';\n /** Format: decimal */\n request_id: string;\n staked_eth: components['schemas']['Stake'];\n };\n Data_LidoWithdrawalCompleted: {\n /** @enum {string} */\n kind: 'lido_withdrawal_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_RocketPoolStakeCompleted: {\n /** @enum {string} */\n kind: 'rocketpool_stake_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_RocketPoolUnstakeCompleted: {\n /** @enum {string} */\n kind: 'rocketpool_unstake_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_ETHSent: {\n /** @enum {string} */\n kind: 'eth_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n amount: {\n /** Format: decimal */\n usd: string;\n /** Format: decimal */\n eth: string;\n };\n };\n Data_ETHReceived: {\n /** @enum {string} */\n kind: 'eth_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n amount: {\n /** Format: decimal */\n usd: string;\n /** Format: decimal */\n eth: string;\n };\n };\n Data_ERC20Sent: {\n /** @enum {string} */\n kind: 'erc20_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n token: components['schemas']['Token'];\n };\n Data_ERC20Received: {\n /** @enum {string} */\n kind: 'erc20_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n token: components['schemas']['Token'];\n };\n Data_ERC721Sent: {\n /** @enum {string} */\n kind: 'erc721_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft: components['schemas']['NFT'];\n };\n Data_ERC721Received: {\n /** @enum {string} */\n kind: 'erc721_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft: components['schemas']['NFT'];\n };\n Data_ERC1155Sent: {\n /** @enum {string} */\n kind: 'erc1155_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft?: components['schemas']['NFT'];\n };\n Data_ERC1155Received: {\n /** @enum {string} */\n kind: 'erc1155_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft?: components['schemas']['NFT'];\n };\n Data_AaveV3HealthFactor: {\n /** @enum {string} */\n kind: 'aave_v3_health_factor';\n /** @example 1 */\n chainId: number;\n /** Format: decimal */\n healthFactor: string;\n /** Format: decimal */\n threshold: string;\n };\n Data_EnsExpiration: {\n /** @enum {string} */\n kind: 'ens_expiration';\n chainId: number;\n reverseEnsName: string;\n /** Format: date-time */\n expirationDateIso: string;\n /** @example 86400 */\n reminderDelayInSeconds: number;\n };\n Data_LidoStakingRewards: {\n /** @enum {string} */\n kind: 'lido_staking_rewards';\n chainId: number;\n /** Format: decimal */\n currentStethBalance: string;\n /** Format: decimal */\n currentEthValue: string;\n /** Format: decimal */\n estimatedTotalRewardInPeriod: string;\n /** @example 1 */\n daysSinceLastNotification: number;\n /** @example 1 */\n notificationIntervalDays: number;\n };\n Data_NotionalLoanExpiration: {\n /** @enum {string} */\n kind: 'notional_loan_expiration';\n chainId: number;\n loans: {\n /** Format: decimal */\n amount: string;\n symbol: string;\n /** Format: date-time */\n maturityDateIso: string;\n }[];\n /** @example 86400 */\n reminderDelayInSeconds: number;\n };\n Data_RocketpoolStakingRewards: {\n /** @enum {string} */\n kind: 'rocketpool_staking_rewards';\n chainId: number;\n /** Format: decimal */\n currentRethBalance: string;\n /** Format: decimal */\n currentEthValue: string;\n /** Format: decimal */\n estimatedTotalRewardInPeriod: string;\n /** @example 1 */\n daysSinceLastNotification: number;\n /** @example 1 */\n notificationIntervalDays: number;\n };\n Data_SparkFiHealthFactor: {\n /** @enum {string} */\n kind: 'spark_fi_health_factor';\n chainId: number;\n /** Format: decimal */\n healthFactor: string;\n /** Format: decimal */\n threshold: string;\n };\n NetworkFee: {\n /** Format: decimal */\n gas_price: string;\n /** Format: decimal */\n native_token_price_in_usd: string;\n };\n Token: {\n /** Format: address */\n address: string;\n symbol: string;\n name: string;\n /** Format: decimal */\n amount: string;\n /** Format: int32 */\n decimals: string;\n /** Format: uri */\n image: string;\n /** Format: decimal */\n usd: string;\n };\n NFT: {\n name: string;\n token_id: string;\n /** Format: uri */\n image: string;\n collection: {\n /** Format: address */\n address: string;\n name: string;\n symbol: string;\n /** Format: uri */\n image: string;\n };\n };\n Stake: {\n /** Format: address */\n address: string;\n symbol: string;\n name: string;\n /** Format: decimal */\n amount: string;\n /** Format: int32 */\n decimals: string;\n /** Format: uri */\n image: string;\n /** Format: decimal */\n usd: string;\n };\n };\n responses: never;\n parameters: never;\n requestBodies: never;\n headers: never;\n pathItems: never;\n};\n\nexport type $defs = Record<string, never>;\n\nexport type operations = Record<string, never>;\n"]}
|
|
1
|
+
{"version":3,"file":"schema.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/schema.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD;;;;GAIG","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n/**\n * This file was auto-generated by openapi-typescript.\n * Do not make direct changes to the file.\n * Script: `npx openapi-typescript <PATH TO NOTIFICATION API SPEC> -o ./schema.d.ts`\n */\n\n/**\n * This file was auto-generated by openapi-typescript.\n * Do not make direct changes to the file.\n */\n\nexport type paths = {\n '/api/v1/notifications': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /** List all notifications ordered by most recent */\n post: {\n parameters: {\n query?: {\n /** @description Page number for pagination */\n page?: number;\n /** @description Number of notifications per page for pagination */\n per_page?: number;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: {\n content: {\n 'application/json': {\n trigger_ids: string[];\n chain_ids?: number[];\n kinds?: string[];\n unread?: boolean;\n };\n };\n };\n responses: {\n /** @description Successfully fetched a list of notifications */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': (\n | components['schemas']['WalletNotification']\n | components['schemas']['Web3Notification']\n )[];\n };\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/v1/notifications/mark-as-read': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /** Mark notifications as read */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': {\n ids?: string[];\n };\n };\n };\n responses: {\n /** @description Successfully marked notifications as read */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/internal/v1/topics': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all topics created (internal) */\n get: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched all topics */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['Topic'][];\n };\n };\n };\n };\n put?: never;\n /** Create a new topic (internal) */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': {\n name: string;\n desc?: string;\n };\n };\n };\n responses: {\n /** @description Successfully created a new topic */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/internal/v1/subtopics': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all sub-topics created (internal) */\n get: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched all subtopics */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['SubTopic'][];\n };\n };\n };\n };\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/internal/v1/global-notifications': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /** Insert a new Global Notification (internal) */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': components['schemas']['GlobalNotificationWrite'];\n };\n };\n responses: {\n /** @description Successfully created a new global notification */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/v1/global-notifications': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all Global Notifications for a UserID */\n get: {\n parameters: {\n query: {\n /** @description Platform(s) to filter notifications by */\n platform: ('portfolio' | 'extension' | 'mobile')[];\n /** @description Delivery channel(s) to filter notifications by */\n deliveryChannel: ('inbox' | 'push')[];\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched global notifications */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['GlobalNotification'][];\n };\n };\n };\n };\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n '/api/v1/user-preferences': {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get all preferences for a UserID */\n get: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Successfully fetched preferences */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content: {\n 'application/json': components['schemas']['Topic'][];\n };\n };\n /** @description User not found */\n 404: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n put?: never;\n /** Update Preferences for a UserID */\n post: {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n 'application/json': {\n topics: string[];\n };\n };\n };\n responses: {\n /** @description Successfully updated topics preferences */\n 200: {\n headers: {\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n};\nexport type webhooks = Record<string, never>;\nexport type components = {\n schemas: {\n GlobalNotification: {\n title: string;\n body: string;\n /** Format: date-time */\n created_at: string;\n };\n GlobalNotificationWrite: {\n title: string;\n body: string;\n 'sub-topic': string;\n platforms: ('portfolio' | 'extension' | 'mobile')[];\n delivery_channels: ('inbox' | 'push')[];\n };\n Topic: {\n name: string;\n description?: string;\n /** Format: date-time */\n created_at?: string;\n };\n SubTopic: {\n name: string;\n /** Format: date-time */\n created_at?: string;\n };\n WalletNotification: {\n /** Format: uuid */\n id: string;\n /** Format: uuid */\n trigger_id: string;\n /** @example 1 */\n chain_id: number;\n /** @example 17485840 */\n block_number: number;\n block_timestamp: string;\n /**\n * Format: address\n * @example 0x881D40237659C251811CEC9c364ef91dC08D300C\n */\n tx_hash: string;\n /** @example false */\n unread: boolean;\n /** Format: date-time */\n created_at: string;\n /** Format: address */\n address: string;\n data?:\n | components['schemas']['Data_MetamaskSwapCompleted']\n | components['schemas']['Data_LidoStakeReadyToBeWithdrawn']\n | components['schemas']['Data_LidoStakeCompleted']\n | components['schemas']['Data_LidoWithdrawalRequested']\n | components['schemas']['Data_LidoWithdrawalCompleted']\n | components['schemas']['Data_RocketPoolStakeCompleted']\n | components['schemas']['Data_RocketPoolUnstakeCompleted']\n | components['schemas']['Data_ETHSent']\n | components['schemas']['Data_ETHReceived']\n | components['schemas']['Data_ERC20Sent']\n | components['schemas']['Data_ERC20Received']\n | components['schemas']['Data_ERC721Sent']\n | components['schemas']['Data_ERC721Received']\n | components['schemas']['Data_ERC1155Sent']\n | components['schemas']['Data_ERC1155Received'];\n };\n Web3Notification: {\n /** Format: uuid */\n id: string;\n /** Format: uuid */\n trigger_id: string;\n /** @example 1 */\n chain_id: number;\n /** @example false */\n unread: boolean;\n /** Format: date-time */\n created_at: string;\n /** Format: address */\n address: string;\n data?:\n | components['schemas']['Data_AaveV3HealthFactor']\n | components['schemas']['Data_EnsExpiration']\n | components['schemas']['Data_LidoStakingRewards']\n | components['schemas']['Data_RocketpoolStakingRewards']\n | components['schemas']['Data_NotionalLoanExpiration']\n | components['schemas']['Data_SparkFiHealthFactor'];\n };\n Data_MetamaskSwapCompleted: {\n /** @enum {string} */\n kind: 'metamask_swap_completed';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: decimal */\n rate: string;\n token_in: components['schemas']['Token'];\n token_out: components['schemas']['Token'];\n };\n Data_LidoStakeCompleted: {\n /** @enum {string} */\n kind: 'lido_stake_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_LidoWithdrawalRequested: {\n /** @enum {string} */\n kind: 'lido_withdrawal_requested';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_LidoStakeReadyToBeWithdrawn: {\n /** @enum {string} */\n kind: 'lido_stake_ready_to_be_withdrawn';\n /** Format: decimal */\n request_id: string;\n staked_eth: components['schemas']['Stake'];\n };\n Data_LidoWithdrawalCompleted: {\n /** @enum {string} */\n kind: 'lido_withdrawal_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_RocketPoolStakeCompleted: {\n /** @enum {string} */\n kind: 'rocketpool_stake_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_RocketPoolUnstakeCompleted: {\n /** @enum {string} */\n kind: 'rocketpool_unstake_completed';\n network_fee: components['schemas']['NetworkFee'];\n stake_in: components['schemas']['Stake'];\n stake_out: components['schemas']['Stake'];\n };\n Data_ETHSent: {\n /** @enum {string} */\n kind: 'eth_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n amount: {\n /** Format: decimal */\n usd: string;\n /** Format: decimal */\n eth: string;\n };\n };\n Data_ETHReceived: {\n /** @enum {string} */\n kind: 'eth_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n amount: {\n /** Format: decimal */\n usd: string;\n /** Format: decimal */\n eth: string;\n };\n };\n Data_ERC20Sent: {\n /** @enum {string} */\n kind: 'erc20_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n token: components['schemas']['Token'];\n };\n Data_ERC20Received: {\n /** @enum {string} */\n kind: 'erc20_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n token: components['schemas']['Token'];\n };\n Data_ERC721Sent: {\n /** @enum {string} */\n kind: 'erc721_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft: components['schemas']['NFT'];\n };\n Data_ERC721Received: {\n /** @enum {string} */\n kind: 'erc721_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft: components['schemas']['NFT'];\n };\n Data_ERC1155Sent: {\n /** @enum {string} */\n kind: 'erc1155_sent';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft?: components['schemas']['NFT'];\n };\n Data_ERC1155Received: {\n /** @enum {string} */\n kind: 'erc1155_received';\n network_fee: components['schemas']['NetworkFee'];\n /** Format: address */\n from: string;\n /** Format: address */\n to: string;\n nft?: components['schemas']['NFT'];\n };\n Data_AaveV3HealthFactor: {\n /** @enum {string} */\n kind: 'aave_v3_health_factor';\n /** @example 1 */\n chainId: number;\n /** Format: decimal */\n healthFactor: string;\n /** Format: decimal */\n threshold: string;\n };\n Data_EnsExpiration: {\n /** @enum {string} */\n kind: 'ens_expiration';\n chainId: number;\n reverseEnsName: string;\n /** Format: date-time */\n expirationDateIso: string;\n /** @example 86400 */\n reminderDelayInSeconds: number;\n };\n Data_LidoStakingRewards: {\n /** @enum {string} */\n kind: 'lido_staking_rewards';\n chainId: number;\n /** Format: decimal */\n currentStethBalance: string;\n /** Format: decimal */\n currentEthValue: string;\n /** Format: decimal */\n estimatedTotalRewardInPeriod: string;\n /** @example 1 */\n daysSinceLastNotification: number;\n /** @example 1 */\n notificationIntervalDays: number;\n };\n Data_NotionalLoanExpiration: {\n /** @enum {string} */\n kind: 'notional_loan_expiration';\n chainId: number;\n loans: {\n /** Format: decimal */\n amount: string;\n symbol: string;\n /** Format: date-time */\n maturityDateIso: string;\n }[];\n /** @example 86400 */\n reminderDelayInSeconds: number;\n };\n Data_RocketpoolStakingRewards: {\n /** @enum {string} */\n kind: 'rocketpool_staking_rewards';\n chainId: number;\n /** Format: decimal */\n currentRethBalance: string;\n /** Format: decimal */\n currentEthValue: string;\n /** Format: decimal */\n estimatedTotalRewardInPeriod: string;\n /** @example 1 */\n daysSinceLastNotification: number;\n /** @example 1 */\n notificationIntervalDays: number;\n };\n Data_SparkFiHealthFactor: {\n /** @enum {string} */\n kind: 'spark_fi_health_factor';\n chainId: number;\n /** Format: decimal */\n healthFactor: string;\n /** Format: decimal */\n threshold: string;\n };\n NetworkFee: {\n /** Format: decimal */\n gas_price: string;\n /** Format: decimal */\n native_token_price_in_usd: string;\n };\n Token: {\n /** Format: address */\n address: string;\n symbol: string;\n name: string;\n /** Format: decimal */\n amount: string;\n /** Format: int32 */\n decimals: string;\n /** Format: uri */\n image: string;\n /** Format: decimal */\n usd: string;\n };\n NFT: {\n name: string;\n token_id: string;\n /** Format: uri */\n image: string;\n collection: {\n /** Format: address */\n address: string;\n name: string;\n symbol: string;\n /** Format: uri */\n image: string;\n };\n };\n Stake: {\n /** Format: address */\n address: string;\n symbol: string;\n name: string;\n /** Format: decimal */\n amount: string;\n /** Format: int32 */\n decimals: string;\n /** Format: uri */\n image: string;\n /** Format: decimal */\n usd: string;\n };\n };\n responses: never;\n parameters: never;\n requestBodies: never;\n headers: never;\n pathItems: never;\n};\nexport type $defs = Record<string, never>;\nexport type operations = Record<string, never>;\n"]}
|
|
@@ -47,7 +47,7 @@ export type paths = {
|
|
|
47
47
|
[name: string]: unknown;
|
|
48
48
|
};
|
|
49
49
|
content: {
|
|
50
|
-
'application/json': components['schemas']['
|
|
50
|
+
'application/json': (components['schemas']['WalletNotification'] | components['schemas']['Web3Notification'])[];
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
};
|
|
@@ -369,7 +369,7 @@ export type components = {
|
|
|
369
369
|
/** Format: date-time */
|
|
370
370
|
created_at?: string;
|
|
371
371
|
};
|
|
372
|
-
|
|
372
|
+
WalletNotification: {
|
|
373
373
|
/** Format: uuid */
|
|
374
374
|
id: string;
|
|
375
375
|
/** Format: uuid */
|
|
@@ -377,20 +377,35 @@ export type components = {
|
|
|
377
377
|
/** @example 1 */
|
|
378
378
|
chain_id: number;
|
|
379
379
|
/** @example 17485840 */
|
|
380
|
-
block_number
|
|
381
|
-
block_timestamp
|
|
380
|
+
block_number: number;
|
|
381
|
+
block_timestamp: string;
|
|
382
382
|
/**
|
|
383
383
|
* Format: address
|
|
384
384
|
* @example 0x881D40237659C251811CEC9c364ef91dC08D300C
|
|
385
385
|
*/
|
|
386
|
-
tx_hash
|
|
386
|
+
tx_hash: string;
|
|
387
387
|
/** @example false */
|
|
388
388
|
unread: boolean;
|
|
389
389
|
/** Format: date-time */
|
|
390
390
|
created_at: string;
|
|
391
391
|
/** Format: address */
|
|
392
392
|
address: string;
|
|
393
|
-
data?: components['schemas']['Data_MetamaskSwapCompleted'] | components['schemas']['Data_LidoStakeReadyToBeWithdrawn'] | components['schemas']['Data_LidoStakeCompleted'] | components['schemas']['Data_LidoWithdrawalRequested'] | components['schemas']['Data_LidoWithdrawalCompleted'] | components['schemas']['Data_RocketPoolStakeCompleted'] | components['schemas']['Data_RocketPoolUnstakeCompleted'] | components['schemas']['Data_ETHSent'] | components['schemas']['Data_ETHReceived'] | components['schemas']['Data_ERC20Sent'] | components['schemas']['Data_ERC20Received'] | components['schemas']['Data_ERC721Sent'] | components['schemas']['Data_ERC721Received'] | components['schemas']['Data_ERC1155Sent'] | components['schemas']['Data_ERC1155Received']
|
|
393
|
+
data?: components['schemas']['Data_MetamaskSwapCompleted'] | components['schemas']['Data_LidoStakeReadyToBeWithdrawn'] | components['schemas']['Data_LidoStakeCompleted'] | components['schemas']['Data_LidoWithdrawalRequested'] | components['schemas']['Data_LidoWithdrawalCompleted'] | components['schemas']['Data_RocketPoolStakeCompleted'] | components['schemas']['Data_RocketPoolUnstakeCompleted'] | components['schemas']['Data_ETHSent'] | components['schemas']['Data_ETHReceived'] | components['schemas']['Data_ERC20Sent'] | components['schemas']['Data_ERC20Received'] | components['schemas']['Data_ERC721Sent'] | components['schemas']['Data_ERC721Received'] | components['schemas']['Data_ERC1155Sent'] | components['schemas']['Data_ERC1155Received'];
|
|
394
|
+
};
|
|
395
|
+
Web3Notification: {
|
|
396
|
+
/** Format: uuid */
|
|
397
|
+
id: string;
|
|
398
|
+
/** Format: uuid */
|
|
399
|
+
trigger_id: string;
|
|
400
|
+
/** @example 1 */
|
|
401
|
+
chain_id: number;
|
|
402
|
+
/** @example false */
|
|
403
|
+
unread: boolean;
|
|
404
|
+
/** Format: date-time */
|
|
405
|
+
created_at: string;
|
|
406
|
+
/** Format: address */
|
|
407
|
+
address: string;
|
|
408
|
+
data?: components['schemas']['Data_AaveV3HealthFactor'] | components['schemas']['Data_EnsExpiration'] | components['schemas']['Data_LidoStakingRewards'] | components['schemas']['Data_RocketpoolStakingRewards'] | components['schemas']['Data_NotionalLoanExpiration'] | components['schemas']['Data_SparkFiHealthFactor'];
|
|
394
409
|
};
|
|
395
410
|
Data_MetamaskSwapCompleted: {
|
|
396
411
|
/** @enum {string} */
|