@metamask-previews/notification-services-controller 10.0.0-preview-7dcef379 → 10.0.0-preview-f9611039
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 +0 -16
- package/dist/NotificationServicesController/NotificationServicesController.cjs +188 -76
- package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.cts +16 -10
- package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.mts +16 -10
- package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.mjs +189 -77
- package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
- package/dist/NotificationServicesController/constants/constants.cjs +7 -0
- package/dist/NotificationServicesController/constants/constants.cjs.map +1 -0
- package/dist/NotificationServicesController/constants/constants.d.cts +3 -0
- package/dist/NotificationServicesController/constants/constants.d.cts.map +1 -0
- package/dist/NotificationServicesController/constants/constants.d.mts +3 -0
- package/dist/NotificationServicesController/constants/constants.d.mts.map +1 -0
- package/dist/NotificationServicesController/constants/constants.mjs +4 -0
- package/dist/NotificationServicesController/constants/constants.mjs.map +1 -0
- package/dist/NotificationServicesController/constants/index.cjs +1 -0
- package/dist/NotificationServicesController/constants/index.cjs.map +1 -1
- package/dist/NotificationServicesController/constants/index.d.cts +1 -0
- package/dist/NotificationServicesController/constants/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/constants/index.d.mts +1 -0
- package/dist/NotificationServicesController/constants/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/constants/index.mjs +1 -0
- package/dist/NotificationServicesController/constants/index.mjs.map +1 -1
- package/dist/NotificationServicesController/mocks/index.cjs +2 -0
- package/dist/NotificationServicesController/mocks/index.cjs.map +1 -1
- package/dist/NotificationServicesController/mocks/index.d.cts +2 -0
- package/dist/NotificationServicesController/mocks/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/mocks/index.d.mts +2 -0
- package/dist/NotificationServicesController/mocks/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/mocks/index.mjs +2 -0
- package/dist/NotificationServicesController/mocks/index.mjs.map +1 -1
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.cjs +22 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.cts +9 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.mts +9 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.mjs +18 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.cjs +82 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.cts +35 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.mts +35 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.mjs +76 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mockResponses.cjs +9 -9
- package/dist/NotificationServicesController/mocks/mockResponses.cjs.map +1 -1
- package/dist/NotificationServicesController/mocks/mockResponses.d.cts +4 -7
- package/dist/NotificationServicesController/mocks/mockResponses.d.cts.map +1 -1
- package/dist/NotificationServicesController/mocks/mockResponses.d.mts +4 -7
- package/dist/NotificationServicesController/mocks/mockResponses.d.mts.map +1 -1
- package/dist/NotificationServicesController/mocks/mockResponses.mjs +7 -7
- package/dist/NotificationServicesController/mocks/mockResponses.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.cjs +1 -4
- package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.cts +0 -623
- package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.mts +0 -623
- package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.mjs +0 -2
- package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.cjs +140 -67
- package/dist/NotificationServicesController/services/onchain-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.d.cts +31 -25
- package/dist/NotificationServicesController/services/onchain-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.d.mts +31 -25
- package/dist/NotificationServicesController/services/onchain-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.mjs +137 -65
- package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/types/index.cjs.map +1 -1
- package/dist/NotificationServicesController/types/index.d.cts +1 -0
- package/dist/NotificationServicesController/types/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/index.d.mts +1 -0
- package/dist/NotificationServicesController/types/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/user-storage/index.cjs +3 -0
- package/dist/NotificationServicesController/types/user-storage/index.cjs.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.cts +2 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.mts +2 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/index.mjs +2 -0
- package/dist/NotificationServicesController/types/user-storage/index.mjs.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.cjs +3 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.cjs.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.cts +26 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts +26 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.mjs +2 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.mjs.map +1 -0
- package/dist/NotificationServicesController/utils/utils.cjs +350 -1
- package/dist/NotificationServicesController/utils/utils.cjs.map +1 -1
- package/dist/NotificationServicesController/utils/utils.d.cts +141 -0
- package/dist/NotificationServicesController/utils/utils.d.cts.map +1 -1
- package/dist/NotificationServicesController/utils/utils.d.mts +141 -0
- package/dist/NotificationServicesController/utils/utils.d.mts.map +1 -1
- package/dist/NotificationServicesController/utils/utils.mjs +337 -0
- package/dist/NotificationServicesController/utils/utils.mjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +15 -22
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +5 -6
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +5 -6
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +16 -23
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.cjs +16 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.cjs.map +1 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts +7 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts +7 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.mjs +14 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.cjs +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.cts +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.mts +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.mjs +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.cjs +41 -18
- package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.cts +33 -19
- package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.mts +33 -19
- package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.mjs +39 -17
- package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/NotificationServicesController/services/notification-config-cache.cjs +0 -72
- package/dist/NotificationServicesController/services/notification-config-cache.cjs.map +0 -1
- package/dist/NotificationServicesController/services/notification-config-cache.d.cts +0 -19
- package/dist/NotificationServicesController/services/notification-config-cache.d.cts.map +0 -1
- package/dist/NotificationServicesController/services/notification-config-cache.d.mts +0 -19
- package/dist/NotificationServicesController/services/notification-config-cache.d.mts.map +0 -1
- package/dist/NotificationServicesController/services/notification-config-cache.mjs +0 -68
- package/dist/NotificationServicesController/services/notification-config-cache.mjs.map +0 -1
|
@@ -23,29 +23,31 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.deactivatePushNotifications = exports.activatePushNotifications = exports.updateLinksAPI = void 0;
|
|
26
|
+
exports.updateTriggerPushNotifications = exports.deactivatePushNotifications = exports.activatePushNotifications = exports.updateLinksAPI = void 0;
|
|
27
27
|
const endpoints = __importStar(require("./endpoints.cjs"));
|
|
28
28
|
/**
|
|
29
29
|
* Updates the push notification links on a remote API.
|
|
30
30
|
*
|
|
31
|
-
* @param
|
|
31
|
+
* @param bearerToken - The JSON Web Token used for authorization.
|
|
32
|
+
* @param triggers - An array of trigger identifiers.
|
|
33
|
+
* @param regTokens - An array of registration tokens.
|
|
32
34
|
* @returns A promise that resolves with true if the update was successful, false otherwise.
|
|
33
35
|
*/
|
|
34
|
-
async function updateLinksAPI(
|
|
36
|
+
async function updateLinksAPI(bearerToken, triggers, regTokens) {
|
|
35
37
|
try {
|
|
36
38
|
const body = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
trigger_ids: triggers,
|
|
40
|
+
registration_tokens: regTokens,
|
|
39
41
|
};
|
|
40
42
|
const response = await fetch(endpoints.REGISTRATION_TOKENS_ENDPOINT, {
|
|
41
43
|
method: 'POST',
|
|
42
44
|
headers: {
|
|
43
|
-
Authorization: `Bearer ${
|
|
45
|
+
Authorization: `Bearer ${bearerToken}`,
|
|
44
46
|
'Content-Type': 'application/json',
|
|
45
47
|
},
|
|
46
48
|
body: JSON.stringify(body),
|
|
47
49
|
});
|
|
48
|
-
return response.
|
|
50
|
+
return response.status === 200;
|
|
49
51
|
}
|
|
50
52
|
catch {
|
|
51
53
|
return false;
|
|
@@ -59,21 +61,14 @@ exports.updateLinksAPI = updateLinksAPI;
|
|
|
59
61
|
* @returns A promise that resolves with an object containing the success status and the BearerToken token.
|
|
60
62
|
*/
|
|
61
63
|
async function activatePushNotifications(params) {
|
|
62
|
-
const { env, createRegToken } = params;
|
|
64
|
+
const { bearerToken, triggers, env, createRegToken, platform, locale } = params;
|
|
63
65
|
const regToken = await createRegToken(env).catch(() => null);
|
|
64
66
|
if (!regToken) {
|
|
65
67
|
return null;
|
|
66
68
|
}
|
|
67
|
-
await updateLinksAPI(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
regToken: {
|
|
71
|
-
token: regToken,
|
|
72
|
-
platform: params.regToken.platform,
|
|
73
|
-
locale: params.regToken.locale,
|
|
74
|
-
oldToken: params.regToken.oldToken,
|
|
75
|
-
},
|
|
76
|
-
});
|
|
69
|
+
await updateLinksAPI(bearerToken, triggers, [
|
|
70
|
+
{ token: regToken, platform, locale },
|
|
71
|
+
]);
|
|
77
72
|
return regToken;
|
|
78
73
|
}
|
|
79
74
|
exports.activatePushNotifications = activatePushNotifications;
|
|
@@ -97,4 +92,32 @@ async function deactivatePushNotifications(params) {
|
|
|
97
92
|
return true;
|
|
98
93
|
}
|
|
99
94
|
exports.deactivatePushNotifications = deactivatePushNotifications;
|
|
95
|
+
/**
|
|
96
|
+
* Updates the triggers linked to push notifications for a given registration token.
|
|
97
|
+
* If the provided registration token does not exist or is not in the current set of registration tokens,
|
|
98
|
+
* a new registration token is created and used for the update.
|
|
99
|
+
*
|
|
100
|
+
* @param params - Update Push Params
|
|
101
|
+
* @returns A promise that resolves with an object containing:
|
|
102
|
+
* - isTriggersLinkedToPushNotifications: boolean indicating if the triggers were successfully updated.
|
|
103
|
+
* - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.
|
|
104
|
+
*/
|
|
105
|
+
async function updateTriggerPushNotifications(params) {
|
|
106
|
+
const { bearerToken, triggers, createRegToken, platform, locale, deleteRegToken, env, } = params;
|
|
107
|
+
await deleteRegToken(env);
|
|
108
|
+
const newRegToken = await createRegToken(env);
|
|
109
|
+
if (!newRegToken) {
|
|
110
|
+
throw new Error('Failed to create a new registration token');
|
|
111
|
+
}
|
|
112
|
+
const linksNotUpdated = await updateLinksAPI(bearerToken, triggers, [
|
|
113
|
+
{ token: newRegToken, platform, locale },
|
|
114
|
+
]);
|
|
115
|
+
if (!linksNotUpdated) {
|
|
116
|
+
throw new Error('Failed to create links to new reg token');
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
fcmToken: newRegToken,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
exports.updateTriggerPushNotifications = updateTriggerPushNotifications;
|
|
100
123
|
//# sourceMappingURL=services.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAyC;
|
|
1
|
+
{"version":3,"file":"services.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAyC;AAqBzC;;;;;;;GAOG;AACI,KAAK,UAAU,cAAc,CAClC,WAAmB,EACnB,QAAkB,EAClB,SAAqB;IAErB,IAAI;QACF,MAAM,IAAI,GAAgB;YACxB,WAAW,EAAE,QAAQ;YACrB,mBAAmB,EAAE,SAAS;SAC/B,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,4BAA4B,EAAE;YACnE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,WAAW,EAAE;gBACtC,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC;KAChC;IAAC,MAAM;QACN,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAtBD,wCAsBC;AAcD;;;;;GAKG;AACI,KAAK,UAAU,yBAAyB,CAC7C,MAAuC;IAEvC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,GACpE,MAAM,CAAC;IAET,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC7D,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,IAAI,CAAC;KACb;IAED,MAAM,cAAc,CAAC,WAAW,EAAE,QAAQ,EAAE;QAC1C,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE;KACtC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAfD,8DAeC;AAWD;;;;;;GAMG;AACI,KAAK,UAAU,2BAA2B,CAC/C,MAAyC;IAEzC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAEjD,yDAAyD;IACzD,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,IAAI,CAAC;KACb;IAED,MAAM,qBAAqB,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,CAAC,qBAAqB,EAAE;QAC1B,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAhBD,kEAgBC;AAiBD;;;;;;;;;GASG;AACI,KAAK,UAAU,8BAA8B,CAClD,MAA4C;IAI5C,MAAM,EACJ,WAAW,EACX,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,MAAM,EACN,cAAc,EACd,GAAG,GACJ,GAAG,MAAM,CAAC;IAEX,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IAC9C,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IAED,MAAM,eAAe,GAAG,MAAM,cAAc,CAAC,WAAW,EAAE,QAAQ,EAAE;QAClE,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE;KACzC,CAAC,CAAC;IACH,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IAED,OAAO;QACL,QAAQ,EAAE,WAAW;KACtB,CAAC;AACJ,CAAC;AA/BD,wEA+BC","sourcesContent":["import * as endpoints from './endpoints';\nimport type { PushNotificationEnv } from '../types';\nimport type {\n CreateRegToken,\n DeleteRegToken,\n} from '../types/push-service-interface';\n\nexport type RegToken = {\n token: string;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n};\n\n/**\n * Links API Response Shape\n */\nexport type LinksResult = {\n trigger_ids: string[];\n registration_tokens: RegToken[];\n};\n\n/**\n * Updates the push notification links on a remote API.\n *\n * @param bearerToken - The JSON Web Token used for authorization.\n * @param triggers - An array of trigger identifiers.\n * @param regTokens - An array of registration tokens.\n * @returns A promise that resolves with true if the update was successful, false otherwise.\n */\nexport async function updateLinksAPI(\n bearerToken: string,\n triggers: string[],\n regTokens: RegToken[],\n): Promise<boolean> {\n try {\n const body: LinksResult = {\n trigger_ids: triggers,\n registration_tokens: regTokens,\n };\n const response = await fetch(endpoints.REGISTRATION_TOKENS_ENDPOINT, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${bearerToken}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n });\n return response.status === 200;\n } catch {\n return false;\n }\n}\n\ntype ActivatePushNotificationsParams = {\n // Push Links\n bearerToken: string;\n triggers: string[];\n\n // Push Registration\n env: PushNotificationEnv;\n createRegToken: CreateRegToken;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n};\n\n/**\n * Enables push notifications by registering the device and linking triggers.\n *\n * @param params - Activate Push Params\n * @returns A promise that resolves with an object containing the success status and the BearerToken token.\n */\nexport async function activatePushNotifications(\n params: ActivatePushNotificationsParams,\n): Promise<string | null> {\n const { bearerToken, triggers, env, createRegToken, platform, locale } =\n params;\n\n const regToken = await createRegToken(env).catch(() => null);\n if (!regToken) {\n return null;\n }\n\n await updateLinksAPI(bearerToken, triggers, [\n { token: regToken, platform, locale },\n ]);\n return regToken;\n}\n\ntype DeactivatePushNotificationsParams = {\n // Push Links\n regToken: string;\n\n // Push Un-registration\n env: PushNotificationEnv;\n deleteRegToken: DeleteRegToken;\n};\n\n/**\n * Disables push notifications by removing the registration token\n * We do not need to unlink triggers, and remove old reg tokens (this is cleaned up in the back-end)\n *\n * @param params - Deactivate Push Params\n * @returns A promise that resolves with true if push notifications were successfully disabled, false otherwise.\n */\nexport async function deactivatePushNotifications(\n params: DeactivatePushNotificationsParams,\n): Promise<boolean> {\n const { regToken, env, deleteRegToken } = params;\n\n // if we don't have a reg token, then we can early return\n if (!regToken) {\n return true;\n }\n\n const isTokenRemovedFromFCM = await deleteRegToken(env);\n if (!isTokenRemovedFromFCM) {\n return false;\n }\n\n return true;\n}\n\ntype UpdateTriggerPushNotificationsParams = {\n // Push Links\n bearerToken: string;\n triggers: string[];\n\n // Push Registration\n env: PushNotificationEnv;\n createRegToken: CreateRegToken;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n\n // Push Un-registration\n deleteRegToken: DeleteRegToken;\n};\n\n/**\n * Updates the triggers linked to push notifications for a given registration token.\n * If the provided registration token does not exist or is not in the current set of registration tokens,\n * a new registration token is created and used for the update.\n *\n * @param params - Update Push Params\n * @returns A promise that resolves with an object containing:\n * - isTriggersLinkedToPushNotifications: boolean indicating if the triggers were successfully updated.\n * - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.\n */\nexport async function updateTriggerPushNotifications(\n params: UpdateTriggerPushNotificationsParams,\n): Promise<{\n fcmToken: string;\n}> {\n const {\n bearerToken,\n triggers,\n createRegToken,\n platform,\n locale,\n deleteRegToken,\n env,\n } = params;\n\n await deleteRegToken(env);\n const newRegToken = await createRegToken(env);\n if (!newRegToken) {\n throw new Error('Failed to create a new registration token');\n }\n\n const linksNotUpdated = await updateLinksAPI(bearerToken, triggers, [\n { token: newRegToken, platform, locale },\n ]);\n if (!linksNotUpdated) {\n throw new Error('Failed to create links to new reg token');\n }\n\n return {\n fcmToken: newRegToken,\n };\n}\n"]}
|
|
@@ -4,38 +4,30 @@ export type RegToken = {
|
|
|
4
4
|
token: string;
|
|
5
5
|
platform: 'extension' | 'mobile' | 'portfolio';
|
|
6
6
|
locale: string;
|
|
7
|
-
oldToken?: string;
|
|
8
7
|
};
|
|
9
8
|
/**
|
|
10
9
|
* Links API Response Shape
|
|
11
10
|
*/
|
|
12
|
-
export type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
token: string;
|
|
16
|
-
platform: 'extension' | 'mobile' | 'portfolio';
|
|
17
|
-
locale: string;
|
|
18
|
-
oldToken?: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
type UpdatePushTokenParams = {
|
|
22
|
-
bearerToken: string;
|
|
23
|
-
addresses: string[];
|
|
24
|
-
regToken: RegToken;
|
|
11
|
+
export type LinksResult = {
|
|
12
|
+
trigger_ids: string[];
|
|
13
|
+
registration_tokens: RegToken[];
|
|
25
14
|
};
|
|
26
15
|
/**
|
|
27
16
|
* Updates the push notification links on a remote API.
|
|
28
17
|
*
|
|
29
|
-
* @param
|
|
18
|
+
* @param bearerToken - The JSON Web Token used for authorization.
|
|
19
|
+
* @param triggers - An array of trigger identifiers.
|
|
20
|
+
* @param regTokens - An array of registration tokens.
|
|
30
21
|
* @returns A promise that resolves with true if the update was successful, false otherwise.
|
|
31
22
|
*/
|
|
32
|
-
export declare function updateLinksAPI(
|
|
23
|
+
export declare function updateLinksAPI(bearerToken: string, triggers: string[], regTokens: RegToken[]): Promise<boolean>;
|
|
33
24
|
type ActivatePushNotificationsParams = {
|
|
25
|
+
bearerToken: string;
|
|
26
|
+
triggers: string[];
|
|
34
27
|
env: PushNotificationEnv;
|
|
35
28
|
createRegToken: CreateRegToken;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
regToken: Pick<RegToken, 'locale' | 'platform' | 'oldToken'>;
|
|
29
|
+
platform: 'extension' | 'mobile' | 'portfolio';
|
|
30
|
+
locale: string;
|
|
39
31
|
};
|
|
40
32
|
/**
|
|
41
33
|
* Enables push notifications by registering the device and linking triggers.
|
|
@@ -57,5 +49,27 @@ type DeactivatePushNotificationsParams = {
|
|
|
57
49
|
* @returns A promise that resolves with true if push notifications were successfully disabled, false otherwise.
|
|
58
50
|
*/
|
|
59
51
|
export declare function deactivatePushNotifications(params: DeactivatePushNotificationsParams): Promise<boolean>;
|
|
52
|
+
type UpdateTriggerPushNotificationsParams = {
|
|
53
|
+
bearerToken: string;
|
|
54
|
+
triggers: string[];
|
|
55
|
+
env: PushNotificationEnv;
|
|
56
|
+
createRegToken: CreateRegToken;
|
|
57
|
+
platform: 'extension' | 'mobile' | 'portfolio';
|
|
58
|
+
locale: string;
|
|
59
|
+
deleteRegToken: DeleteRegToken;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Updates the triggers linked to push notifications for a given registration token.
|
|
63
|
+
* If the provided registration token does not exist or is not in the current set of registration tokens,
|
|
64
|
+
* a new registration token is created and used for the update.
|
|
65
|
+
*
|
|
66
|
+
* @param params - Update Push Params
|
|
67
|
+
* @returns A promise that resolves with an object containing:
|
|
68
|
+
* - isTriggersLinkedToPushNotifications: boolean indicating if the triggers were successfully updated.
|
|
69
|
+
* - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.
|
|
70
|
+
*/
|
|
71
|
+
export declare function updateTriggerPushNotifications(params: UpdateTriggerPushNotificationsParams): Promise<{
|
|
72
|
+
fcmToken: string;
|
|
73
|
+
}>;
|
|
60
74
|
export {};
|
|
61
75
|
//# sourceMappingURL=services.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,4CAAwC;AAEzC,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"services.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,4CAAwC;AAEzC,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mBAAmB,EAAE,QAAQ,EAAE,CAAC;CACjC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAkBlB;AAED,KAAK,+BAA+B,GAAG;IAErC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAaxB;AAED,KAAK,iCAAiC,GAAG;IAEvC,QAAQ,EAAE,MAAM,CAAC;IAGjB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,OAAO,CAAC,CAclB;AAED,KAAK,oCAAoC,GAAG;IAE1C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;IAGf,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,oCAAoC,GAC3C,OAAO,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CA2BD"}
|
|
@@ -4,38 +4,30 @@ export type RegToken = {
|
|
|
4
4
|
token: string;
|
|
5
5
|
platform: 'extension' | 'mobile' | 'portfolio';
|
|
6
6
|
locale: string;
|
|
7
|
-
oldToken?: string;
|
|
8
7
|
};
|
|
9
8
|
/**
|
|
10
9
|
* Links API Response Shape
|
|
11
10
|
*/
|
|
12
|
-
export type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
token: string;
|
|
16
|
-
platform: 'extension' | 'mobile' | 'portfolio';
|
|
17
|
-
locale: string;
|
|
18
|
-
oldToken?: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
type UpdatePushTokenParams = {
|
|
22
|
-
bearerToken: string;
|
|
23
|
-
addresses: string[];
|
|
24
|
-
regToken: RegToken;
|
|
11
|
+
export type LinksResult = {
|
|
12
|
+
trigger_ids: string[];
|
|
13
|
+
registration_tokens: RegToken[];
|
|
25
14
|
};
|
|
26
15
|
/**
|
|
27
16
|
* Updates the push notification links on a remote API.
|
|
28
17
|
*
|
|
29
|
-
* @param
|
|
18
|
+
* @param bearerToken - The JSON Web Token used for authorization.
|
|
19
|
+
* @param triggers - An array of trigger identifiers.
|
|
20
|
+
* @param regTokens - An array of registration tokens.
|
|
30
21
|
* @returns A promise that resolves with true if the update was successful, false otherwise.
|
|
31
22
|
*/
|
|
32
|
-
export declare function updateLinksAPI(
|
|
23
|
+
export declare function updateLinksAPI(bearerToken: string, triggers: string[], regTokens: RegToken[]): Promise<boolean>;
|
|
33
24
|
type ActivatePushNotificationsParams = {
|
|
25
|
+
bearerToken: string;
|
|
26
|
+
triggers: string[];
|
|
34
27
|
env: PushNotificationEnv;
|
|
35
28
|
createRegToken: CreateRegToken;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
regToken: Pick<RegToken, 'locale' | 'platform' | 'oldToken'>;
|
|
29
|
+
platform: 'extension' | 'mobile' | 'portfolio';
|
|
30
|
+
locale: string;
|
|
39
31
|
};
|
|
40
32
|
/**
|
|
41
33
|
* Enables push notifications by registering the device and linking triggers.
|
|
@@ -57,5 +49,27 @@ type DeactivatePushNotificationsParams = {
|
|
|
57
49
|
* @returns A promise that resolves with true if push notifications were successfully disabled, false otherwise.
|
|
58
50
|
*/
|
|
59
51
|
export declare function deactivatePushNotifications(params: DeactivatePushNotificationsParams): Promise<boolean>;
|
|
52
|
+
type UpdateTriggerPushNotificationsParams = {
|
|
53
|
+
bearerToken: string;
|
|
54
|
+
triggers: string[];
|
|
55
|
+
env: PushNotificationEnv;
|
|
56
|
+
createRegToken: CreateRegToken;
|
|
57
|
+
platform: 'extension' | 'mobile' | 'portfolio';
|
|
58
|
+
locale: string;
|
|
59
|
+
deleteRegToken: DeleteRegToken;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Updates the triggers linked to push notifications for a given registration token.
|
|
63
|
+
* If the provided registration token does not exist or is not in the current set of registration tokens,
|
|
64
|
+
* a new registration token is created and used for the update.
|
|
65
|
+
*
|
|
66
|
+
* @param params - Update Push Params
|
|
67
|
+
* @returns A promise that resolves with an object containing:
|
|
68
|
+
* - isTriggersLinkedToPushNotifications: boolean indicating if the triggers were successfully updated.
|
|
69
|
+
* - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.
|
|
70
|
+
*/
|
|
71
|
+
export declare function updateTriggerPushNotifications(params: UpdateTriggerPushNotificationsParams): Promise<{
|
|
72
|
+
fcmToken: string;
|
|
73
|
+
}>;
|
|
60
74
|
export {};
|
|
61
75
|
//# sourceMappingURL=services.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,4CAAwC;AAEzC,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"services.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,4CAAwC;AAEzC,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mBAAmB,EAAE,QAAQ,EAAE,CAAC;CACjC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAkBlB;AAED,KAAK,+BAA+B,GAAG;IAErC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAaxB;AAED,KAAK,iCAAiC,GAAG;IAEvC,QAAQ,EAAE,MAAM,CAAC;IAGjB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,OAAO,CAAC,CAclB;AAED,KAAK,oCAAoC,GAAG;IAE1C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;IAGf,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,oCAAoC,GAC3C,OAAO,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CA2BD"}
|
|
@@ -2,24 +2,26 @@ import * as endpoints from "./endpoints.mjs";
|
|
|
2
2
|
/**
|
|
3
3
|
* Updates the push notification links on a remote API.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
5
|
+
* @param bearerToken - The JSON Web Token used for authorization.
|
|
6
|
+
* @param triggers - An array of trigger identifiers.
|
|
7
|
+
* @param regTokens - An array of registration tokens.
|
|
6
8
|
* @returns A promise that resolves with true if the update was successful, false otherwise.
|
|
7
9
|
*/
|
|
8
|
-
export async function updateLinksAPI(
|
|
10
|
+
export async function updateLinksAPI(bearerToken, triggers, regTokens) {
|
|
9
11
|
try {
|
|
10
12
|
const body = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
trigger_ids: triggers,
|
|
14
|
+
registration_tokens: regTokens,
|
|
13
15
|
};
|
|
14
16
|
const response = await fetch(endpoints.REGISTRATION_TOKENS_ENDPOINT, {
|
|
15
17
|
method: 'POST',
|
|
16
18
|
headers: {
|
|
17
|
-
Authorization: `Bearer ${
|
|
19
|
+
Authorization: `Bearer ${bearerToken}`,
|
|
18
20
|
'Content-Type': 'application/json',
|
|
19
21
|
},
|
|
20
22
|
body: JSON.stringify(body),
|
|
21
23
|
});
|
|
22
|
-
return response.
|
|
24
|
+
return response.status === 200;
|
|
23
25
|
}
|
|
24
26
|
catch {
|
|
25
27
|
return false;
|
|
@@ -32,21 +34,14 @@ export async function updateLinksAPI(params) {
|
|
|
32
34
|
* @returns A promise that resolves with an object containing the success status and the BearerToken token.
|
|
33
35
|
*/
|
|
34
36
|
export async function activatePushNotifications(params) {
|
|
35
|
-
const { env, createRegToken } = params;
|
|
37
|
+
const { bearerToken, triggers, env, createRegToken, platform, locale } = params;
|
|
36
38
|
const regToken = await createRegToken(env).catch(() => null);
|
|
37
39
|
if (!regToken) {
|
|
38
40
|
return null;
|
|
39
41
|
}
|
|
40
|
-
await updateLinksAPI(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
regToken: {
|
|
44
|
-
token: regToken,
|
|
45
|
-
platform: params.regToken.platform,
|
|
46
|
-
locale: params.regToken.locale,
|
|
47
|
-
oldToken: params.regToken.oldToken,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
42
|
+
await updateLinksAPI(bearerToken, triggers, [
|
|
43
|
+
{ token: regToken, platform, locale },
|
|
44
|
+
]);
|
|
50
45
|
return regToken;
|
|
51
46
|
}
|
|
52
47
|
/**
|
|
@@ -68,4 +63,31 @@ export async function deactivatePushNotifications(params) {
|
|
|
68
63
|
}
|
|
69
64
|
return true;
|
|
70
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Updates the triggers linked to push notifications for a given registration token.
|
|
68
|
+
* If the provided registration token does not exist or is not in the current set of registration tokens,
|
|
69
|
+
* a new registration token is created and used for the update.
|
|
70
|
+
*
|
|
71
|
+
* @param params - Update Push Params
|
|
72
|
+
* @returns A promise that resolves with an object containing:
|
|
73
|
+
* - isTriggersLinkedToPushNotifications: boolean indicating if the triggers were successfully updated.
|
|
74
|
+
* - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.
|
|
75
|
+
*/
|
|
76
|
+
export async function updateTriggerPushNotifications(params) {
|
|
77
|
+
const { bearerToken, triggers, createRegToken, platform, locale, deleteRegToken, env, } = params;
|
|
78
|
+
await deleteRegToken(env);
|
|
79
|
+
const newRegToken = await createRegToken(env);
|
|
80
|
+
if (!newRegToken) {
|
|
81
|
+
throw new Error('Failed to create a new registration token');
|
|
82
|
+
}
|
|
83
|
+
const linksNotUpdated = await updateLinksAPI(bearerToken, triggers, [
|
|
84
|
+
{ token: newRegToken, platform, locale },
|
|
85
|
+
]);
|
|
86
|
+
if (!linksNotUpdated) {
|
|
87
|
+
throw new Error('Failed to create links to new reg token');
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
fcmToken: newRegToken,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
71
93
|
//# sourceMappingURL=services.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,wBAAoB;
|
|
1
|
+
{"version":3,"file":"services.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,wBAAoB;AAqBzC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,WAAmB,EACnB,QAAkB,EAClB,SAAqB;IAErB,IAAI;QACF,MAAM,IAAI,GAAgB;YACxB,WAAW,EAAE,QAAQ;YACrB,mBAAmB,EAAE,SAAS;SAC/B,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,4BAA4B,EAAE;YACnE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,WAAW,EAAE;gBACtC,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC;KAChC;IAAC,MAAM;QACN,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAcD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,MAAuC;IAEvC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,GACpE,MAAM,CAAC;IAET,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC7D,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,IAAI,CAAC;KACb;IAED,MAAM,cAAc,CAAC,WAAW,EAAE,QAAQ,EAAE;QAC1C,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE;KACtC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAWD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,MAAyC;IAEzC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAEjD,yDAAyD;IACzD,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,IAAI,CAAC;KACb;IAED,MAAM,qBAAqB,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,CAAC,qBAAqB,EAAE;QAC1B,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAiBD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,MAA4C;IAI5C,MAAM,EACJ,WAAW,EACX,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,MAAM,EACN,cAAc,EACd,GAAG,GACJ,GAAG,MAAM,CAAC;IAEX,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;IAC9C,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IAED,MAAM,eAAe,GAAG,MAAM,cAAc,CAAC,WAAW,EAAE,QAAQ,EAAE;QAClE,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE;KACzC,CAAC,CAAC;IACH,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IAED,OAAO;QACL,QAAQ,EAAE,WAAW;KACtB,CAAC;AACJ,CAAC","sourcesContent":["import * as endpoints from './endpoints';\nimport type { PushNotificationEnv } from '../types';\nimport type {\n CreateRegToken,\n DeleteRegToken,\n} from '../types/push-service-interface';\n\nexport type RegToken = {\n token: string;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n};\n\n/**\n * Links API Response Shape\n */\nexport type LinksResult = {\n trigger_ids: string[];\n registration_tokens: RegToken[];\n};\n\n/**\n * Updates the push notification links on a remote API.\n *\n * @param bearerToken - The JSON Web Token used for authorization.\n * @param triggers - An array of trigger identifiers.\n * @param regTokens - An array of registration tokens.\n * @returns A promise that resolves with true if the update was successful, false otherwise.\n */\nexport async function updateLinksAPI(\n bearerToken: string,\n triggers: string[],\n regTokens: RegToken[],\n): Promise<boolean> {\n try {\n const body: LinksResult = {\n trigger_ids: triggers,\n registration_tokens: regTokens,\n };\n const response = await fetch(endpoints.REGISTRATION_TOKENS_ENDPOINT, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${bearerToken}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n });\n return response.status === 200;\n } catch {\n return false;\n }\n}\n\ntype ActivatePushNotificationsParams = {\n // Push Links\n bearerToken: string;\n triggers: string[];\n\n // Push Registration\n env: PushNotificationEnv;\n createRegToken: CreateRegToken;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n};\n\n/**\n * Enables push notifications by registering the device and linking triggers.\n *\n * @param params - Activate Push Params\n * @returns A promise that resolves with an object containing the success status and the BearerToken token.\n */\nexport async function activatePushNotifications(\n params: ActivatePushNotificationsParams,\n): Promise<string | null> {\n const { bearerToken, triggers, env, createRegToken, platform, locale } =\n params;\n\n const regToken = await createRegToken(env).catch(() => null);\n if (!regToken) {\n return null;\n }\n\n await updateLinksAPI(bearerToken, triggers, [\n { token: regToken, platform, locale },\n ]);\n return regToken;\n}\n\ntype DeactivatePushNotificationsParams = {\n // Push Links\n regToken: string;\n\n // Push Un-registration\n env: PushNotificationEnv;\n deleteRegToken: DeleteRegToken;\n};\n\n/**\n * Disables push notifications by removing the registration token\n * We do not need to unlink triggers, and remove old reg tokens (this is cleaned up in the back-end)\n *\n * @param params - Deactivate Push Params\n * @returns A promise that resolves with true if push notifications were successfully disabled, false otherwise.\n */\nexport async function deactivatePushNotifications(\n params: DeactivatePushNotificationsParams,\n): Promise<boolean> {\n const { regToken, env, deleteRegToken } = params;\n\n // if we don't have a reg token, then we can early return\n if (!regToken) {\n return true;\n }\n\n const isTokenRemovedFromFCM = await deleteRegToken(env);\n if (!isTokenRemovedFromFCM) {\n return false;\n }\n\n return true;\n}\n\ntype UpdateTriggerPushNotificationsParams = {\n // Push Links\n bearerToken: string;\n triggers: string[];\n\n // Push Registration\n env: PushNotificationEnv;\n createRegToken: CreateRegToken;\n platform: 'extension' | 'mobile' | 'portfolio';\n locale: string;\n\n // Push Un-registration\n deleteRegToken: DeleteRegToken;\n};\n\n/**\n * Updates the triggers linked to push notifications for a given registration token.\n * If the provided registration token does not exist or is not in the current set of registration tokens,\n * a new registration token is created and used for the update.\n *\n * @param params - Update Push Params\n * @returns A promise that resolves with an object containing:\n * - isTriggersLinkedToPushNotifications: boolean indicating if the triggers were successfully updated.\n * - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.\n */\nexport async function updateTriggerPushNotifications(\n params: UpdateTriggerPushNotificationsParams,\n): Promise<{\n fcmToken: string;\n}> {\n const {\n bearerToken,\n triggers,\n createRegToken,\n platform,\n locale,\n deleteRegToken,\n env,\n } = params;\n\n await deleteRegToken(env);\n const newRegToken = await createRegToken(env);\n if (!newRegToken) {\n throw new Error('Failed to create a new registration token');\n }\n\n const linksNotUpdated = await updateLinksAPI(bearerToken, triggers, [\n { token: newRegToken, platform, locale },\n ]);\n if (!linksNotUpdated) {\n throw new Error('Failed to create links to new reg token');\n }\n\n return {\n fcmToken: newRegToken,\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
|
-
};
|
|
13
|
-
var _OnChainNotificationsCache_instances, _OnChainNotificationsCache_cache, _OnChainNotificationsCache_TTL, _OnChainNotificationsCache_isExpired, _OnChainNotificationsCache_hasAllAddresses;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.notificationsConfigCache = exports.OnChainNotificationsCache = exports.NotificationConfigCacheTTL = void 0;
|
|
16
|
-
exports.NotificationConfigCacheTTL = 1000 * 60; // 60 seconds
|
|
17
|
-
class OnChainNotificationsCache {
|
|
18
|
-
constructor() {
|
|
19
|
-
_OnChainNotificationsCache_instances.add(this);
|
|
20
|
-
_OnChainNotificationsCache_cache.set(this, null);
|
|
21
|
-
_OnChainNotificationsCache_TTL.set(this, exports.NotificationConfigCacheTTL);
|
|
22
|
-
}
|
|
23
|
-
get(addresses) {
|
|
24
|
-
if (__classPrivateFieldGet(this, _OnChainNotificationsCache_instances, "m", _OnChainNotificationsCache_isExpired).call(this) || !__classPrivateFieldGet(this, _OnChainNotificationsCache_instances, "m", _OnChainNotificationsCache_hasAllAddresses).call(this, addresses)) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return addresses.map((address) => ({
|
|
28
|
-
address,
|
|
29
|
-
enabled: __classPrivateFieldGet(this, _OnChainNotificationsCache_cache, "f")?.data.get(address) ?? false,
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
set(data) {
|
|
33
|
-
let map = new Map();
|
|
34
|
-
// If we have existing cache, preserve it and update with new data
|
|
35
|
-
if (__classPrivateFieldGet(this, _OnChainNotificationsCache_cache, "f") && !__classPrivateFieldGet(this, _OnChainNotificationsCache_instances, "m", _OnChainNotificationsCache_isExpired).call(this)) {
|
|
36
|
-
map = new Map(__classPrivateFieldGet(this, _OnChainNotificationsCache_cache, "f").data);
|
|
37
|
-
}
|
|
38
|
-
// Update with new data
|
|
39
|
-
data.forEach(({ address, enabled }) => {
|
|
40
|
-
map.set(address, enabled);
|
|
41
|
-
});
|
|
42
|
-
__classPrivateFieldSet(this, _OnChainNotificationsCache_cache, {
|
|
43
|
-
data: map,
|
|
44
|
-
timestamp: Date.now(),
|
|
45
|
-
}, "f");
|
|
46
|
-
}
|
|
47
|
-
// Full replace when updateOnChainNotifications is called
|
|
48
|
-
replace(data) {
|
|
49
|
-
const map = new Map();
|
|
50
|
-
data.forEach(({ address, enabled }) => {
|
|
51
|
-
map.set(address, enabled);
|
|
52
|
-
});
|
|
53
|
-
__classPrivateFieldSet(this, _OnChainNotificationsCache_cache, {
|
|
54
|
-
data: map,
|
|
55
|
-
timestamp: Date.now(),
|
|
56
|
-
}, "f");
|
|
57
|
-
}
|
|
58
|
-
clear() {
|
|
59
|
-
__classPrivateFieldSet(this, _OnChainNotificationsCache_cache, null, "f");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.OnChainNotificationsCache = OnChainNotificationsCache;
|
|
63
|
-
_OnChainNotificationsCache_cache = new WeakMap(), _OnChainNotificationsCache_TTL = new WeakMap(), _OnChainNotificationsCache_instances = new WeakSet(), _OnChainNotificationsCache_isExpired = function _OnChainNotificationsCache_isExpired() {
|
|
64
|
-
return !__classPrivateFieldGet(this, _OnChainNotificationsCache_cache, "f") || Date.now() - __classPrivateFieldGet(this, _OnChainNotificationsCache_cache, "f").timestamp > __classPrivateFieldGet(this, _OnChainNotificationsCache_TTL, "f");
|
|
65
|
-
}, _OnChainNotificationsCache_hasAllAddresses = function _OnChainNotificationsCache_hasAllAddresses(addresses) {
|
|
66
|
-
if (!__classPrivateFieldGet(this, _OnChainNotificationsCache_cache, "f")) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
return addresses.every((address) => __classPrivateFieldGet(this, _OnChainNotificationsCache_cache, "f")?.data.has(address));
|
|
70
|
-
};
|
|
71
|
-
exports.notificationsConfigCache = new OnChainNotificationsCache();
|
|
72
|
-
//# sourceMappingURL=notification-config-cache.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notification-config-cache.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/notification-config-cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKa,QAAA,0BAA0B,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,aAAa;AAElE,MAAa,yBAAyB;IAAtC;;QACE,2CAAyC,IAAI,EAAC;QAErC,yCAAO,kCAA0B,EAAC;IA2D7C,CAAC;IA9CC,GAAG,CAAC,SAAmB;QACrB,IAAI,uBAAA,IAAI,kFAAW,MAAf,IAAI,CAAa,IAAI,CAAC,uBAAA,IAAI,wFAAiB,MAArB,IAAI,EAAkB,SAAS,CAAC,EAAE;YAC1D,OAAO,IAAI,CAAC;SACb;QAED,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACjC,OAAO;YACP,OAAO,EAAE,uBAAA,IAAI,wCAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK;SACjD,CAAC,CAAC,CAAC;IACN,CAAC;IAED,GAAG,CAAC,IAA6C;QAC/C,IAAI,GAAG,GAAyB,IAAI,GAAG,EAAmB,CAAC;QAE3D,kEAAkE;QAClE,IAAI,uBAAA,IAAI,wCAAO,IAAI,CAAC,uBAAA,IAAI,kFAAW,MAAf,IAAI,CAAa,EAAE;YACrC,GAAG,GAAG,IAAI,GAAG,CAAC,uBAAA,IAAI,wCAAO,CAAC,IAAI,CAAC,CAAC;SACjC;QAED,uBAAuB;QACvB,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YACpC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,uBAAA,IAAI,oCAAU;YACZ,IAAI,EAAE,GAAG;YACT,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,MAAA,CAAC;IACJ,CAAC;IAED,yDAAyD;IACzD,OAAO,CAAC,IAA6C;QACnD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAmB,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YACpC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,uBAAA,IAAI,oCAAU;YACZ,IAAI,EAAE,GAAG;YACT,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,MAAA,CAAC;IACJ,CAAC;IAED,KAAK;QACH,uBAAA,IAAI,oCAAU,IAAI,MAAA,CAAC;IACrB,CAAC;CACF;AA9DD,8DA8DC;;IAxDG,OAAO,CAAC,uBAAA,IAAI,wCAAO,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,uBAAA,IAAI,wCAAO,CAAC,SAAS,GAAG,uBAAA,IAAI,sCAAK,CAAC;AACxE,CAAC,mGAEgB,SAAmB;IAClC,IAAI,CAAC,uBAAA,IAAI,wCAAO,EAAE;QAChB,OAAO,KAAK,CAAC;KACd;IACD,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,uBAAA,IAAI,wCAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AACtE,CAAC;AAkDU,QAAA,wBAAwB,GAAG,IAAI,yBAAyB,EAAE,CAAC","sourcesContent":["type NotificationConfigCache = {\n data: Map<string, boolean>;\n timestamp: number;\n};\n\nexport const NotificationConfigCacheTTL = 1000 * 60; // 60 seconds\n\nexport class OnChainNotificationsCache {\n #cache: NotificationConfigCache | null = null;\n\n readonly #TTL = NotificationConfigCacheTTL;\n\n #isExpired(): boolean {\n return !this.#cache || Date.now() - this.#cache.timestamp > this.#TTL;\n }\n\n #hasAllAddresses(addresses: string[]): boolean {\n if (!this.#cache) {\n return false;\n }\n return addresses.every((address) => this.#cache?.data.has(address));\n }\n\n get(addresses: string[]): { address: string; enabled: boolean }[] | null {\n if (this.#isExpired() || !this.#hasAllAddresses(addresses)) {\n return null;\n }\n\n return addresses.map((address) => ({\n address,\n enabled: this.#cache?.data.get(address) ?? false,\n }));\n }\n\n set(data: { address: string; enabled: boolean }[]): void {\n let map: Map<string, boolean> = new Map<string, boolean>();\n\n // If we have existing cache, preserve it and update with new data\n if (this.#cache && !this.#isExpired()) {\n map = new Map(this.#cache.data);\n }\n\n // Update with new data\n data.forEach(({ address, enabled }) => {\n map.set(address, enabled);\n });\n\n this.#cache = {\n data: map,\n timestamp: Date.now(),\n };\n }\n\n // Full replace when updateOnChainNotifications is called\n replace(data: { address: string; enabled: boolean }[]): void {\n const map = new Map<string, boolean>();\n data.forEach(({ address, enabled }) => {\n map.set(address, enabled);\n });\n\n this.#cache = {\n data: map,\n timestamp: Date.now(),\n };\n }\n\n clear(): void {\n this.#cache = null;\n }\n}\n\nexport const notificationsConfigCache = new OnChainNotificationsCache();\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const NotificationConfigCacheTTL: number;
|
|
2
|
-
export declare class OnChainNotificationsCache {
|
|
3
|
-
#private;
|
|
4
|
-
get(addresses: string[]): {
|
|
5
|
-
address: string;
|
|
6
|
-
enabled: boolean;
|
|
7
|
-
}[] | null;
|
|
8
|
-
set(data: {
|
|
9
|
-
address: string;
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
}[]): void;
|
|
12
|
-
replace(data: {
|
|
13
|
-
address: string;
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
}[]): void;
|
|
16
|
-
clear(): void;
|
|
17
|
-
}
|
|
18
|
-
export declare const notificationsConfigCache: OnChainNotificationsCache;
|
|
19
|
-
//# sourceMappingURL=notification-config-cache.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notification-config-cache.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/notification-config-cache.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,0BAA0B,QAAY,CAAC;AAEpD,qBAAa,yBAAyB;;IAgBpC,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,IAAI;IAWxE,GAAG,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,IAAI;IAoBxD,OAAO,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,IAAI;IAY5D,KAAK,IAAI,IAAI;CAGd;AAED,eAAO,MAAM,wBAAwB,2BAAkC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const NotificationConfigCacheTTL: number;
|
|
2
|
-
export declare class OnChainNotificationsCache {
|
|
3
|
-
#private;
|
|
4
|
-
get(addresses: string[]): {
|
|
5
|
-
address: string;
|
|
6
|
-
enabled: boolean;
|
|
7
|
-
}[] | null;
|
|
8
|
-
set(data: {
|
|
9
|
-
address: string;
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
}[]): void;
|
|
12
|
-
replace(data: {
|
|
13
|
-
address: string;
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
}[]): void;
|
|
16
|
-
clear(): void;
|
|
17
|
-
}
|
|
18
|
-
export declare const notificationsConfigCache: OnChainNotificationsCache;
|
|
19
|
-
//# sourceMappingURL=notification-config-cache.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notification-config-cache.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/notification-config-cache.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,0BAA0B,QAAY,CAAC;AAEpD,qBAAa,yBAAyB;;IAgBpC,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,IAAI;IAWxE,GAAG,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,IAAI;IAoBxD,OAAO,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,IAAI;IAY5D,KAAK,IAAI,IAAI;CAGd;AAED,eAAO,MAAM,wBAAwB,2BAAkC,CAAC"}
|