@ledgerhq/live-common 34.48.0 → 34.48.1
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/lib/notifications/ServiceStatusProvider/index.d.ts +1 -16
- package/lib/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.js +7 -31
- package/lib/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts +1 -16
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.js +7 -31
- package/lib-es/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/package.json +5 -5
- package/src/notifications/ServiceStatusProvider/index.tsx +12 -37
- package/lib/notifications/ServiceStatusProvider/index.test.d.ts +0 -2
- package/lib/notifications/ServiceStatusProvider/index.test.d.ts.map +0 -1
- package/lib/notifications/ServiceStatusProvider/index.test.js +0 -88
- package/lib/notifications/ServiceStatusProvider/index.test.js.map +0 -1
- package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts +0 -2
- package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts.map +0 -1
- package/lib/notifications/ServiceStatusProvider/ledger-components.js +0 -16
- package/lib/notifications/ServiceStatusProvider/ledger-components.js.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts +0 -2
- package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/index.test.js +0 -86
- package/lib-es/notifications/ServiceStatusProvider/index.test.js.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts +0 -2
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts.map +0 -1
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.js +0 -13
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.js.map +0 -1
- package/src/notifications/ServiceStatusProvider/index.test.ts +0 -102
- package/src/notifications/ServiceStatusProvider/ledger-components.ts +0 -12
@@ -11,22 +11,7 @@ type API = {
|
|
11
11
|
};
|
12
12
|
export type StatusContextType = State & API;
|
13
13
|
export declare function useServiceStatus(): StatusContextType;
|
14
|
-
|
15
|
-
* Filters service status incidents based on related tickers or Ledger components.
|
16
|
-
*
|
17
|
-
* ## Behavior:
|
18
|
-
* - If there are no `tickers` or no `incidents`, returns an empty list.
|
19
|
-
* - For each incident:
|
20
|
-
* 1. ✅ If the incident has no components → keep it (always relevant).
|
21
|
-
* 2. ✅ If at least one component name matches a known **Ledger component** → keep it.
|
22
|
-
* 3. ✅ If at least one component name contains a **currency ticker** → keep it.
|
23
|
-
* 4. ❌ Otherwise, the incident is discarded.
|
24
|
-
*
|
25
|
-
* @param {Incident[]} [incidents=[]] - List of incidents to filter.
|
26
|
-
* @param {string[]} [tickers=[]] - List of currency tickers to match against incident components.
|
27
|
-
* @returns {Incident[]} The list of incidents relevant to the provided tickers or Ledger components.
|
28
|
-
*/
|
29
|
-
export declare function filterServiceStatusIncidents(incidents?: Incident[], tickers?: string[]): Incident[];
|
14
|
+
export declare function filterServiceStatusIncidents(incidents: Incident[], tickers?: string[]): Incident[];
|
30
15
|
export declare function useFilteredServiceStatus(filters?: ServiceStatusUserSettings): StatusContextType;
|
31
16
|
export declare const ServiceStatusProvider: ({ children, autoUpdateDelay, networkApi, context, }: Props) => ReactElement;
|
32
17
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAmD,YAAY,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,KAAK,EAAE,KAAK,EAAE,yBAAyB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAmD,YAAY,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,KAAK,EAAE,KAAK,EAAE,yBAAyB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAK5F,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC,CAAC;AAEF,KAAK,GAAG,GAAG;IACT,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,GAAG,CAAC;AAU5C,wBAAgB,gBAAgB,IAAI,iBAAiB,CAEpD;AAMD,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,QAAQ,EAAE,EACrB,OAAO,GAAE,MAAM,EAAO,GACrB,QAAQ,EAAE,CAYZ;AAGD,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,iBAAiB,CAQ/F;AAED,eAAO,MAAM,qBAAqB,wDAK/B,KAAK,KAAG,YA+BV,CAAC"}
|
@@ -32,7 +32,6 @@ const api_1 = __importDefault(require("./api"));
|
|
32
32
|
const xstate_1 = require("xstate");
|
33
33
|
const react_2 = require("@xstate/react");
|
34
34
|
const machine_1 = require("./machine");
|
35
|
-
const ledger_components_1 = require("./ledger-components");
|
36
35
|
const ServiceStatusContext = (0, react_1.createContext)({
|
37
36
|
incidents: [],
|
38
37
|
isLoading: false,
|
@@ -48,37 +47,14 @@ exports.useServiceStatus = useServiceStatus;
|
|
48
47
|
function escapeRegExp(string) {
|
49
48
|
return string.replace(/[.*+?^${}()[\]\\]/g, "\\$&"); // $& means the whole matched string
|
50
49
|
}
|
51
|
-
function
|
52
|
-
|
53
|
-
}
|
54
|
-
/**
|
55
|
-
* Filters service status incidents based on related tickers or Ledger components.
|
56
|
-
*
|
57
|
-
* ## Behavior:
|
58
|
-
* - If there are no `tickers` or no `incidents`, returns an empty list.
|
59
|
-
* - For each incident:
|
60
|
-
* 1. ✅ If the incident has no components → keep it (always relevant).
|
61
|
-
* 2. ✅ If at least one component name matches a known **Ledger component** → keep it.
|
62
|
-
* 3. ✅ If at least one component name contains a **currency ticker** → keep it.
|
63
|
-
* 4. ❌ Otherwise, the incident is discarded.
|
64
|
-
*
|
65
|
-
* @param {Incident[]} [incidents=[]] - List of incidents to filter.
|
66
|
-
* @param {string[]} [tickers=[]] - List of currency tickers to match against incident components.
|
67
|
-
* @returns {Incident[]} The list of incidents relevant to the provided tickers or Ledger components.
|
68
|
-
*/
|
69
|
-
function filterServiceStatusIncidents(incidents = [], tickers = []) {
|
70
|
-
if (!tickers.length || !incidents.length)
|
50
|
+
function filterServiceStatusIncidents(incidents, tickers = []) {
|
51
|
+
if (!tickers || tickers.length === 0 || !incidents || incidents.length === 0) {
|
71
52
|
return [];
|
72
|
-
|
73
|
-
const
|
74
|
-
return incidents.filter(({ components }) =>
|
75
|
-
|
76
|
-
|
77
|
-
return components.some(({ name }) => {
|
78
|
-
const sanitizedName = sanitizeName(name);
|
79
|
-
return ledgerComponentsSet.has(sanitizedName) || tickerRegex.test(sanitizedName);
|
80
|
-
});
|
81
|
-
});
|
53
|
+
}
|
54
|
+
const tickersRegex = new RegExp(escapeRegExp(tickers.join("|")), "i");
|
55
|
+
return incidents.filter(({ components }) => !components || // dont filter out if no components
|
56
|
+
components.length === 0 ||
|
57
|
+
components.some(({ name }) => tickersRegex.test(name)));
|
82
58
|
}
|
83
59
|
exports.filterServiceStatusIncidents = filterServiceStatusIncidents;
|
84
60
|
// filter out service status incidents by given currencies or fallback on context currencies
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/index.tsx"],"names":[],"mappings":";;;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S,CAAC;SAClC;QACD,MAAM,EAAE;YACN,iBAAiB,EAAE,eAAe;SACnC;KACF,CAAC,CACH,CAAC;IACF,MAAM,GAAG,GAAG,IAAA,eAAO,EACjB,GAAG,EAAE,CAAC,CAAC;QACL,UAAU,EAAE,KAAK,IAAI,EAAE;YACrB,IAAI,CAAC;gBACH,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;QACL,CAAC;KACF,CAAC,EACF,CAAC,IAAI,CAAC,CACP,CAAC;IACF,MAAM,KAAK,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,CAAC;IAC5D,OAAO,8BAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAAiC,CAAC;AACjG,CAAC,CAAC;AApCW,QAAA,qBAAqB,yBAoChC"}
|
@@ -11,22 +11,7 @@ type API = {
|
|
11
11
|
};
|
12
12
|
export type StatusContextType = State & API;
|
13
13
|
export declare function useServiceStatus(): StatusContextType;
|
14
|
-
|
15
|
-
* Filters service status incidents based on related tickers or Ledger components.
|
16
|
-
*
|
17
|
-
* ## Behavior:
|
18
|
-
* - If there are no `tickers` or no `incidents`, returns an empty list.
|
19
|
-
* - For each incident:
|
20
|
-
* 1. ✅ If the incident has no components → keep it (always relevant).
|
21
|
-
* 2. ✅ If at least one component name matches a known **Ledger component** → keep it.
|
22
|
-
* 3. ✅ If at least one component name contains a **currency ticker** → keep it.
|
23
|
-
* 4. ❌ Otherwise, the incident is discarded.
|
24
|
-
*
|
25
|
-
* @param {Incident[]} [incidents=[]] - List of incidents to filter.
|
26
|
-
* @param {string[]} [tickers=[]] - List of currency tickers to match against incident components.
|
27
|
-
* @returns {Incident[]} The list of incidents relevant to the provided tickers or Ledger components.
|
28
|
-
*/
|
29
|
-
export declare function filterServiceStatusIncidents(incidents?: Incident[], tickers?: string[]): Incident[];
|
14
|
+
export declare function filterServiceStatusIncidents(incidents: Incident[], tickers?: string[]): Incident[];
|
30
15
|
export declare function useFilteredServiceStatus(filters?: ServiceStatusUserSettings): StatusContextType;
|
31
16
|
export declare const ServiceStatusProvider: ({ children, autoUpdateDelay, networkApi, context, }: Props) => ReactElement;
|
32
17
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAmD,YAAY,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,KAAK,EAAE,KAAK,EAAE,yBAAyB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAmD,YAAY,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,KAAK,EAAE,KAAK,EAAE,yBAAyB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAK5F,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC,CAAC;AAEF,KAAK,GAAG,GAAG;IACT,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,GAAG,CAAC;AAU5C,wBAAgB,gBAAgB,IAAI,iBAAiB,CAEpD;AAMD,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,QAAQ,EAAE,EACrB,OAAO,GAAE,MAAM,EAAO,GACrB,QAAQ,EAAE,CAYZ;AAGD,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,iBAAiB,CAQ/F;AAED,eAAO,MAAM,qBAAqB,wDAK/B,KAAK,KAAG,YA+BV,CAAC"}
|
@@ -3,7 +3,6 @@ import defaultNetworkApi from "./api";
|
|
3
3
|
import { fromPromise } from "xstate";
|
4
4
|
import { useMachine } from "@xstate/react";
|
5
5
|
import { serviceStatusMachine } from "./machine";
|
6
|
-
import { LEDGER_COMPONENTS } from "./ledger-components";
|
7
6
|
const ServiceStatusContext = createContext({
|
8
7
|
incidents: [],
|
9
8
|
isLoading: false,
|
@@ -18,37 +17,14 @@ export function useServiceStatus() {
|
|
18
17
|
function escapeRegExp(string) {
|
19
18
|
return string.replace(/[.*+?^${}()[\]\\]/g, "\\$&"); // $& means the whole matched string
|
20
19
|
}
|
21
|
-
function
|
22
|
-
|
23
|
-
}
|
24
|
-
/**
|
25
|
-
* Filters service status incidents based on related tickers or Ledger components.
|
26
|
-
*
|
27
|
-
* ## Behavior:
|
28
|
-
* - If there are no `tickers` or no `incidents`, returns an empty list.
|
29
|
-
* - For each incident:
|
30
|
-
* 1. ✅ If the incident has no components → keep it (always relevant).
|
31
|
-
* 2. ✅ If at least one component name matches a known **Ledger component** → keep it.
|
32
|
-
* 3. ✅ If at least one component name contains a **currency ticker** → keep it.
|
33
|
-
* 4. ❌ Otherwise, the incident is discarded.
|
34
|
-
*
|
35
|
-
* @param {Incident[]} [incidents=[]] - List of incidents to filter.
|
36
|
-
* @param {string[]} [tickers=[]] - List of currency tickers to match against incident components.
|
37
|
-
* @returns {Incident[]} The list of incidents relevant to the provided tickers or Ledger components.
|
38
|
-
*/
|
39
|
-
export function filterServiceStatusIncidents(incidents = [], tickers = []) {
|
40
|
-
if (!tickers.length || !incidents.length)
|
20
|
+
export function filterServiceStatusIncidents(incidents, tickers = []) {
|
21
|
+
if (!tickers || tickers.length === 0 || !incidents || incidents.length === 0) {
|
41
22
|
return [];
|
42
|
-
|
43
|
-
const
|
44
|
-
return incidents.filter(({ components }) =>
|
45
|
-
|
46
|
-
|
47
|
-
return components.some(({ name }) => {
|
48
|
-
const sanitizedName = sanitizeName(name);
|
49
|
-
return ledgerComponentsSet.has(sanitizedName) || tickerRegex.test(sanitizedName);
|
50
|
-
});
|
51
|
-
});
|
23
|
+
}
|
24
|
+
const tickersRegex = new RegExp(escapeRegExp(tickers.join("|")), "i");
|
25
|
+
return incidents.filter(({ components }) => !components || // dont filter out if no components
|
26
|
+
components.length === 0 ||
|
27
|
+
components.some(({ name }) => tickersRegex.test(name)));
|
52
28
|
}
|
53
29
|
// filter out service status incidents by given currencies or fallback on context currencies
|
54
30
|
export function useFilteredServiceStatus(filters) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAgB,MAAM,OAAO,CAAC;AAE7F,OAAO,iBAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAgB,MAAM,OAAO,CAAC;AAE7F,OAAO,iBAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAajD,MAAM,oBAAoB,GAAG,aAAa,CAAoB;IAC5D,SAAS,EAAE,EAAE;IAC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,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAAiC,CAAC;AACjG,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ledgerhq/live-common",
|
3
3
|
"description": "Common ground for the Ledger Live apps",
|
4
|
-
"version": "34.48.
|
4
|
+
"version": "34.48.1",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
7
7
|
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
@@ -209,10 +209,10 @@
|
|
209
209
|
"@ledgerhq/hw-app-multiversx": "^6.25.1",
|
210
210
|
"@ledgerhq/hw-app-near": "^6.31.6",
|
211
211
|
"@ledgerhq/hw-app-polkadot": "^6.34.6",
|
212
|
-
"@ledgerhq/hw-app-str": "^7.2.6",
|
213
212
|
"@ledgerhq/hw-app-sui": "^1.4.0",
|
214
213
|
"@ledgerhq/hw-app-tezos": "^6.31.6",
|
215
214
|
"@ledgerhq/hw-app-trx": "^6.31.6",
|
215
|
+
"@ledgerhq/hw-app-str": "^7.2.6",
|
216
216
|
"@ledgerhq/hw-app-vet": "^0.5.16",
|
217
217
|
"@ledgerhq/hw-app-xrp": "^6.32.4",
|
218
218
|
"@ledgerhq/hw-transport": "^6.31.10",
|
@@ -225,16 +225,16 @@
|
|
225
225
|
"@ledgerhq/live-env": "^2.16.0",
|
226
226
|
"@ledgerhq/live-hooks": "0.1.0",
|
227
227
|
"@ledgerhq/live-network": "^2.0.17",
|
228
|
-
"@ledgerhq/live-nft": "^0.8.20",
|
229
228
|
"@ledgerhq/live-promise": "^0.1.1",
|
230
229
|
"@ledgerhq/live-signer-canton": "^0.3.0",
|
231
230
|
"@ledgerhq/live-signer-evm": "^0.7.5",
|
232
231
|
"@ledgerhq/live-signer-solana": "^0.5.5",
|
233
232
|
"@ledgerhq/live-wallet": "^0.14.0",
|
234
|
-
"@ledgerhq/speculos-transport": "^0.2.10",
|
235
233
|
"@ledgerhq/logs": "^6.13.0",
|
234
|
+
"@ledgerhq/speculos-transport": "^0.2.10",
|
236
235
|
"@ledgerhq/wallet-api-acre-module": "^0.6.0",
|
237
|
-
"@ledgerhq/wallet-api-exchange-module": "^0.16.0"
|
236
|
+
"@ledgerhq/wallet-api-exchange-module": "^0.16.0",
|
237
|
+
"@ledgerhq/live-nft": "^0.8.20"
|
238
238
|
},
|
239
239
|
"devDependencies": {
|
240
240
|
"@solana/web3.js": "1.95.4",
|
@@ -4,7 +4,6 @@ import defaultNetworkApi from "./api";
|
|
4
4
|
import { fromPromise } from "xstate";
|
5
5
|
import { useMachine } from "@xstate/react";
|
6
6
|
import { serviceStatusMachine } from "./machine";
|
7
|
-
import { LEDGER_COMPONENTS } from "./ledger-components";
|
8
7
|
type Props = {
|
9
8
|
children: React.ReactNode;
|
10
9
|
autoUpdateDelay: number;
|
@@ -34,51 +33,27 @@ function escapeRegExp(string) {
|
|
34
33
|
return string.replace(/[.*+?^${}()[\]\\]/g, "\\$&"); // $& means the whole matched string
|
35
34
|
}
|
36
35
|
|
37
|
-
function sanitizeName(name: string): string {
|
38
|
-
return name.toLowerCase().trim().replace(/\s+/g, " "); // collapse multiple spaces
|
39
|
-
}
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Filters service status incidents based on related tickers or Ledger components.
|
43
|
-
*
|
44
|
-
* ## Behavior:
|
45
|
-
* - If there are no `tickers` or no `incidents`, returns an empty list.
|
46
|
-
* - For each incident:
|
47
|
-
* 1. ✅ If the incident has no components → keep it (always relevant).
|
48
|
-
* 2. ✅ If at least one component name matches a known **Ledger component** → keep it.
|
49
|
-
* 3. ✅ If at least one component name contains a **currency ticker** → keep it.
|
50
|
-
* 4. ❌ Otherwise, the incident is discarded.
|
51
|
-
*
|
52
|
-
* @param {Incident[]} [incidents=[]] - List of incidents to filter.
|
53
|
-
* @param {string[]} [tickers=[]] - List of currency tickers to match against incident components.
|
54
|
-
* @returns {Incident[]} The list of incidents relevant to the provided tickers or Ledger components.
|
55
|
-
*/
|
56
|
-
|
57
36
|
export function filterServiceStatusIncidents(
|
58
|
-
incidents: Incident[]
|
37
|
+
incidents: Incident[],
|
59
38
|
tickers: string[] = [],
|
60
39
|
): Incident[] {
|
61
|
-
if (!tickers.length || !incidents.length)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
const
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
return ledgerComponentsSet.has(sanitizedName) || tickerRegex.test(sanitizedName);
|
73
|
-
});
|
74
|
-
});
|
40
|
+
if (!tickers || tickers.length === 0 || !incidents || incidents.length === 0) {
|
41
|
+
return [];
|
42
|
+
}
|
43
|
+
|
44
|
+
const tickersRegex = new RegExp(escapeRegExp(tickers.join("|")), "i");
|
45
|
+
return incidents.filter(
|
46
|
+
({ components }) =>
|
47
|
+
!components || // dont filter out if no components
|
48
|
+
components.length === 0 ||
|
49
|
+
components.some(({ name }) => tickersRegex.test(name)), // component name should hold currency ticker
|
50
|
+
);
|
75
51
|
}
|
76
52
|
|
77
53
|
// filter out service status incidents by given currencies or fallback on context currencies
|
78
54
|
export function useFilteredServiceStatus(filters?: ServiceStatusUserSettings): StatusContextType {
|
79
55
|
const stateData = useContext(ServiceStatusContext);
|
80
56
|
const { incidents, context } = stateData;
|
81
|
-
|
82
57
|
const filteredIncidents = useMemo(() => {
|
83
58
|
return filterServiceStatusIncidents(incidents, filters?.tickers || context?.tickers);
|
84
59
|
}, [incidents, context, filters?.tickers]);
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/index.test.ts"],"names":[],"mappings":""}
|
@@ -1,88 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const index_1 = require("./index");
|
4
|
-
const ledger_components_1 = require("./ledger-components");
|
5
|
-
const makeIncident = (overrides = {}) => ({
|
6
|
-
created_at: "2025-01-01T00:00:00Z",
|
7
|
-
id: Math.random().toString(16).slice(2),
|
8
|
-
impact: "minor",
|
9
|
-
incident_updates: [],
|
10
|
-
monitoring_at: null,
|
11
|
-
name: "Test incident",
|
12
|
-
page_id: null,
|
13
|
-
resolved_at: null,
|
14
|
-
shortlink: null,
|
15
|
-
status: "investigating",
|
16
|
-
updated_at: null,
|
17
|
-
...overrides,
|
18
|
-
});
|
19
|
-
describe("filterServiceStatusIncidents", () => {
|
20
|
-
it("returns empty when no tickers or no incidents", () => {
|
21
|
-
expect((0, index_1.filterServiceStatusIncidents)([], ["BTC"]).length).toBe(0);
|
22
|
-
expect((0, index_1.filterServiceStatusIncidents)([makeIncident()], []).length).toBe(0);
|
23
|
-
});
|
24
|
-
it("matches incidents with known Ledger components (case-insensitive)", () => {
|
25
|
-
const incidents = [
|
26
|
-
makeIncident({ components: [{ id: "1", name: "Ledger Application Store" }] }),
|
27
|
-
makeIncident({ components: [{ id: "2", name: "ledger appliCAtion store" }] }),
|
28
|
-
makeIncident({ components: [{ id: "3", name: "Unknown Component" }] }),
|
29
|
-
];
|
30
|
-
const result = (0, index_1.filterServiceStatusIncidents)(incidents, ["BTC"]);
|
31
|
-
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "2"]);
|
32
|
-
});
|
33
|
-
it("matches incidents if a component contains a tracked ticker as a whole word (case-insensitive)", () => {
|
34
|
-
const incidents = [
|
35
|
-
makeIncident({ components: [{ id: "1", name: "BTC Node" }] }),
|
36
|
-
makeIncident({ components: [{ id: "2", name: "eth Node" }] }),
|
37
|
-
makeIncident({ components: [{ id: "3", name: "TETHER Service" }] }),
|
38
|
-
makeIncident({ components: [{ id: "4", name: "NOTBTCService" }] }),
|
39
|
-
];
|
40
|
-
const result = (0, index_1.filterServiceStatusIncidents)(incidents, ["BTC", "ETH"]);
|
41
|
-
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "2"]);
|
42
|
-
});
|
43
|
-
it("includes incidents with no components array or empty array", () => {
|
44
|
-
const incidents = [
|
45
|
-
makeIncident({ components: undefined }),
|
46
|
-
makeIncident({ components: [] }),
|
47
|
-
];
|
48
|
-
const result = (0, index_1.filterServiceStatusIncidents)(incidents, ["BTC"]);
|
49
|
-
expect(result.length).toBe(2);
|
50
|
-
});
|
51
|
-
it("escapes tickers so special regex characters do not break matching", () => {
|
52
|
-
const incidents = [
|
53
|
-
makeIncident({ components: [{ id: "1", name: "USDT Node" }] }),
|
54
|
-
makeIncident({ components: [{ id: "2", name: "US.DT Node" }] }),
|
55
|
-
makeIncident({ components: [{ id: "3", name: "(USDT) Node" }] }),
|
56
|
-
makeIncident({ components: [{ id: "4", name: "Ethereum Node" }] }),
|
57
|
-
makeIncident({ components: [{ id: "5", name: "Ethereum (ETH) swap issue" }] }),
|
58
|
-
];
|
59
|
-
const result = (0, index_1.filterServiceStatusIncidents)(incidents, ["USDT", "ETH"]);
|
60
|
-
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "3", "5"]);
|
61
|
-
expect(result.length).toBe(3);
|
62
|
-
});
|
63
|
-
it("matches incidents for all known Ledger components", () => {
|
64
|
-
const incidents = ledger_components_1.LEDGER_COMPONENTS.map((name, index) => makeIncident({ components: [{ id: `${index + 1}`, name }] }));
|
65
|
-
const result = (0, index_1.filterServiceStatusIncidents)(incidents, ["BTC"]);
|
66
|
-
expect(result.length).toBe(ledger_components_1.LEDGER_COMPONENTS.length);
|
67
|
-
});
|
68
|
-
it("filters correctly with common tickers", () => {
|
69
|
-
const tickers = ["XRP", "SOL", "ETH", "BTC", "ADA", "USDC", "USDT"];
|
70
|
-
const incidents = [
|
71
|
-
makeIncident({ components: [{ id: "1", name: "BTC Node" }] }),
|
72
|
-
makeIncident({ components: [{ id: "2", name: "eth Node" }] }),
|
73
|
-
makeIncident({ components: [{ id: "3", name: "ADA-Service" }] }),
|
74
|
-
makeIncident({ components: [{ id: "4", name: "usdc gateway" }] }),
|
75
|
-
makeIncident({ components: [{ id: "5", name: "NOTUSDTService" }] }),
|
76
|
-
makeIncident({ components: [{ id: "6", name: "USDT" }] }),
|
77
|
-
makeIncident({ components: [{ id: "7", name: "xrp relayer" }] }),
|
78
|
-
makeIncident({ components: [{ id: "8", name: "SOL Node" }] }),
|
79
|
-
makeIncident({ components: [{ id: "9", name: "SOLANA Node" }] }),
|
80
|
-
makeIncident({ components: [{ id: "10", name: "Random Service" }] }),
|
81
|
-
makeIncident({ components: [] }),
|
82
|
-
];
|
83
|
-
const result = (0, index_1.filterServiceStatusIncidents)(incidents, tickers);
|
84
|
-
expect(result.map(i => i.components?.[0]?.id)).toEqual(["1", "2", "3", "4", "6", "7", "8"]);
|
85
|
-
expect(result.length).toBe(8);
|
86
|
-
});
|
87
|
-
});
|
88
|
-
//# sourceMappingURL=index.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/index.test.ts"],"names":[],"mappings":";;AAAA,mCAAuD;AACvD,2DAAwD;AAGxD,MAAM,YAAY,GAAG,CAAC,YAA+B,EAAE,EAAY,EAAE,CAAC,CAAC;IACrE,UAAU,EAAE,sBAAsB;IAClC,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,MAAM,EAAE,OAAO;IACf,gBAAgB,EAAE,EAAE;IACpB,aAAa,EAAE,IAAI;IACnB,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,MAAM,EAAE,eAAe;IACvB,UAAU,EAAE,IAAI;IAChB,GAAG,SAAS;CACb,CAAC,CAAC;AAEH,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,CAAC,IAAA,oCAA4B,EAAC,EAAE,EAAE,CAAC,KAAK,CAAC,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I,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;YAChE,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC;YACpE,YAAY,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;SACjC,CAAC;QAEF,MAAM,MAAM,GAAG,IAAA,oCAA4B,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAChE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QAC5F,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export declare const LEDGER_COMPONENTS: readonly ["Ledger Application Store", "Ledger Live Security Services", "Swap API", "Buy", "Earn Dashboard", "Crypto Assets Service", "Cloud Sync", "Trustchain", "Loyalty Program", "Card Program"];
|
2
|
-
//# sourceMappingURL=ledger-components.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ledger-components.d.ts","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/ledger-components.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,qMAWpB,CAAC"}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.LEDGER_COMPONENTS = void 0;
|
4
|
-
exports.LEDGER_COMPONENTS = [
|
5
|
-
"Ledger Application Store",
|
6
|
-
"Ledger Live Security Services",
|
7
|
-
"Swap API",
|
8
|
-
"Buy",
|
9
|
-
"Earn Dashboard",
|
10
|
-
"Crypto Assets Service",
|
11
|
-
"Cloud Sync",
|
12
|
-
"Trustchain",
|
13
|
-
"Loyalty Program",
|
14
|
-
"Card Program",
|
15
|
-
];
|
16
|
-
//# sourceMappingURL=ledger-components.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ledger-components.js","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/ledger-components.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;IAC/B,0BAA0B;IAC1B,+BAA+B;IAC/B,UAAU;IACV,KAAK;IACL,gBAAgB;IAChB,uBAAuB;IACvB,YAAY;IACZ,YAAY;IACZ,iBAAiB;IACjB,cAAc;CACN,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/index.test.ts"],"names":[],"mappings":""}
|
@@ -1,86 +0,0 @@
|
|
1
|
-
import { filterServiceStatusIncidents } from "./index";
|
2
|
-
import { LEDGER_COMPONENTS } from "./ledger-components";
|
3
|
-
const makeIncident = (overrides = {}) => ({
|
4
|
-
created_at: "2025-01-01T00:00:00Z",
|
5
|
-
id: Math.random().toString(16).slice(2),
|
6
|
-
impact: "minor",
|
7
|
-
incident_updates: [],
|
8
|
-
monitoring_at: null,
|
9
|
-
name: "Test incident",
|
10
|
-
page_id: null,
|
11
|
-
resolved_at: null,
|
12
|
-
shortlink: null,
|
13
|
-
status: "investigating",
|
14
|
-
updated_at: null,
|
15
|
-
...overrides,
|
16
|
-
});
|
17
|
-
describe("filterServiceStatusIncidents", () => {
|
18
|
-
it("returns empty when no tickers or no incidents", () => {
|
19
|
-
expect(filterServiceStatusIncidents([], ["BTC"]).length).toBe(0);
|
20
|
-
expect(filterServiceStatusIncidents([makeIncident()], []).length).toBe(0);
|
21
|
-
});
|
22
|
-
it("matches incidents with known Ledger components (case-insensitive)", () => {
|
23
|
-
const incidents = [
|
24
|
-
makeIncident({ components: [{ id: "1", name: "Ledger Application Store" }] }),
|
25
|
-
makeIncident({ components: [{ id: "2", name: "ledger appliCAtion store" }] }),
|
26
|
-
makeIncident({ components: [{ id: "3", name: "Unknown Component" }] }),
|
27
|
-
];
|
28
|
-
const result = filterServiceStatusIncidents(incidents, ["BTC"]);
|
29
|
-
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "2"]);
|
30
|
-
});
|
31
|
-
it("matches incidents if a component contains a tracked ticker as a whole word (case-insensitive)", () => {
|
32
|
-
const incidents = [
|
33
|
-
makeIncident({ components: [{ id: "1", name: "BTC Node" }] }),
|
34
|
-
makeIncident({ components: [{ id: "2", name: "eth Node" }] }),
|
35
|
-
makeIncident({ components: [{ id: "3", name: "TETHER Service" }] }),
|
36
|
-
makeIncident({ components: [{ id: "4", name: "NOTBTCService" }] }),
|
37
|
-
];
|
38
|
-
const result = filterServiceStatusIncidents(incidents, ["BTC", "ETH"]);
|
39
|
-
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "2"]);
|
40
|
-
});
|
41
|
-
it("includes incidents with no components array or empty array", () => {
|
42
|
-
const incidents = [
|
43
|
-
makeIncident({ components: undefined }),
|
44
|
-
makeIncident({ components: [] }),
|
45
|
-
];
|
46
|
-
const result = filterServiceStatusIncidents(incidents, ["BTC"]);
|
47
|
-
expect(result.length).toBe(2);
|
48
|
-
});
|
49
|
-
it("escapes tickers so special regex characters do not break matching", () => {
|
50
|
-
const incidents = [
|
51
|
-
makeIncident({ components: [{ id: "1", name: "USDT Node" }] }),
|
52
|
-
makeIncident({ components: [{ id: "2", name: "US.DT Node" }] }),
|
53
|
-
makeIncident({ components: [{ id: "3", name: "(USDT) Node" }] }),
|
54
|
-
makeIncident({ components: [{ id: "4", name: "Ethereum Node" }] }),
|
55
|
-
makeIncident({ components: [{ id: "5", name: "Ethereum (ETH) swap issue" }] }),
|
56
|
-
];
|
57
|
-
const result = filterServiceStatusIncidents(incidents, ["USDT", "ETH"]);
|
58
|
-
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "3", "5"]);
|
59
|
-
expect(result.length).toBe(3);
|
60
|
-
});
|
61
|
-
it("matches incidents for all known Ledger components", () => {
|
62
|
-
const incidents = LEDGER_COMPONENTS.map((name, index) => makeIncident({ components: [{ id: `${index + 1}`, name }] }));
|
63
|
-
const result = filterServiceStatusIncidents(incidents, ["BTC"]);
|
64
|
-
expect(result.length).toBe(LEDGER_COMPONENTS.length);
|
65
|
-
});
|
66
|
-
it("filters correctly with common tickers", () => {
|
67
|
-
const tickers = ["XRP", "SOL", "ETH", "BTC", "ADA", "USDC", "USDT"];
|
68
|
-
const incidents = [
|
69
|
-
makeIncident({ components: [{ id: "1", name: "BTC Node" }] }),
|
70
|
-
makeIncident({ components: [{ id: "2", name: "eth Node" }] }),
|
71
|
-
makeIncident({ components: [{ id: "3", name: "ADA-Service" }] }),
|
72
|
-
makeIncident({ components: [{ id: "4", name: "usdc gateway" }] }),
|
73
|
-
makeIncident({ components: [{ id: "5", name: "NOTUSDTService" }] }),
|
74
|
-
makeIncident({ components: [{ id: "6", name: "USDT" }] }),
|
75
|
-
makeIncident({ components: [{ id: "7", name: "xrp relayer" }] }),
|
76
|
-
makeIncident({ components: [{ id: "8", name: "SOL Node" }] }),
|
77
|
-
makeIncident({ components: [{ id: "9", name: "SOLANA Node" }] }),
|
78
|
-
makeIncident({ components: [{ id: "10", name: "Random Service" }] }),
|
79
|
-
makeIncident({ components: [] }),
|
80
|
-
];
|
81
|
-
const result = filterServiceStatusIncidents(incidents, tickers);
|
82
|
-
expect(result.map(i => i.components?.[0]?.id)).toEqual(["1", "2", "3", "4", "6", "7", "8"]);
|
83
|
-
expect(result.length).toBe(8);
|
84
|
-
});
|
85
|
-
});
|
86
|
-
//# sourceMappingURL=index.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../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GAAG,CAAC,CAAC,CAAC;QAC5F,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export declare const LEDGER_COMPONENTS: readonly ["Ledger Application Store", "Ledger Live Security Services", "Swap API", "Buy", "Earn Dashboard", "Crypto Assets Service", "Cloud Sync", "Trustchain", "Loyalty Program", "Card Program"];
|
2
|
-
//# sourceMappingURL=ledger-components.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ledger-components.d.ts","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/ledger-components.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,qMAWpB,CAAC"}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
export const LEDGER_COMPONENTS = [
|
2
|
-
"Ledger Application Store",
|
3
|
-
"Ledger Live Security Services",
|
4
|
-
"Swap API",
|
5
|
-
"Buy",
|
6
|
-
"Earn Dashboard",
|
7
|
-
"Crypto Assets Service",
|
8
|
-
"Cloud Sync",
|
9
|
-
"Trustchain",
|
10
|
-
"Loyalty Program",
|
11
|
-
"Card Program",
|
12
|
-
];
|
13
|
-
//# sourceMappingURL=ledger-components.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ledger-components.js","sourceRoot":"","sources":["../../../src/notifications/ServiceStatusProvider/ledger-components.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,0BAA0B;IAC1B,+BAA+B;IAC/B,UAAU;IACV,KAAK;IACL,gBAAgB;IAChB,uBAAuB;IACvB,YAAY;IACZ,YAAY;IACZ,iBAAiB;IACjB,cAAc;CACN,CAAC"}
|
@@ -1,102 +0,0 @@
|
|
1
|
-
import { filterServiceStatusIncidents } from "./index";
|
2
|
-
import { LEDGER_COMPONENTS } from "./ledger-components";
|
3
|
-
import type { Incident } from "./types";
|
4
|
-
|
5
|
-
const makeIncident = (overrides: Partial<Incident> = {}): Incident => ({
|
6
|
-
created_at: "2025-01-01T00:00:00Z",
|
7
|
-
id: Math.random().toString(16).slice(2),
|
8
|
-
impact: "minor",
|
9
|
-
incident_updates: [],
|
10
|
-
monitoring_at: null,
|
11
|
-
name: "Test incident",
|
12
|
-
page_id: null,
|
13
|
-
resolved_at: null,
|
14
|
-
shortlink: null,
|
15
|
-
status: "investigating",
|
16
|
-
updated_at: null,
|
17
|
-
...overrides,
|
18
|
-
});
|
19
|
-
|
20
|
-
describe("filterServiceStatusIncidents", () => {
|
21
|
-
it("returns empty when no tickers or no incidents", () => {
|
22
|
-
expect(filterServiceStatusIncidents([], ["BTC"]).length).toBe(0);
|
23
|
-
expect(filterServiceStatusIncidents([makeIncident()], []).length).toBe(0);
|
24
|
-
});
|
25
|
-
|
26
|
-
it("matches incidents with known Ledger components (case-insensitive)", () => {
|
27
|
-
const incidents: Incident[] = [
|
28
|
-
makeIncident({ components: [{ id: "1", name: "Ledger Application Store" }] }),
|
29
|
-
makeIncident({ components: [{ id: "2", name: "ledger appliCAtion store" }] }),
|
30
|
-
makeIncident({ components: [{ id: "3", name: "Unknown Component" }] }),
|
31
|
-
];
|
32
|
-
|
33
|
-
const result = filterServiceStatusIncidents(incidents, ["BTC"]);
|
34
|
-
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "2"]);
|
35
|
-
});
|
36
|
-
|
37
|
-
it("matches incidents if a component contains a tracked ticker as a whole word (case-insensitive)", () => {
|
38
|
-
const incidents: Incident[] = [
|
39
|
-
makeIncident({ components: [{ id: "1", name: "BTC Node" }] }),
|
40
|
-
makeIncident({ components: [{ id: "2", name: "eth Node" }] }),
|
41
|
-
makeIncident({ components: [{ id: "3", name: "TETHER Service" }] }),
|
42
|
-
makeIncident({ components: [{ id: "4", name: "NOTBTCService" }] }),
|
43
|
-
];
|
44
|
-
|
45
|
-
const result = filterServiceStatusIncidents(incidents, ["BTC", "ETH"]);
|
46
|
-
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "2"]);
|
47
|
-
});
|
48
|
-
|
49
|
-
it("includes incidents with no components array or empty array", () => {
|
50
|
-
const incidents: Incident[] = [
|
51
|
-
makeIncident({ components: undefined }),
|
52
|
-
makeIncident({ components: [] }),
|
53
|
-
];
|
54
|
-
|
55
|
-
const result = filterServiceStatusIncidents(incidents, ["BTC"]);
|
56
|
-
expect(result.length).toBe(2);
|
57
|
-
});
|
58
|
-
|
59
|
-
it("escapes tickers so special regex characters do not break matching", () => {
|
60
|
-
const incidents: Incident[] = [
|
61
|
-
makeIncident({ components: [{ id: "1", name: "USDT Node" }] }),
|
62
|
-
makeIncident({ components: [{ id: "2", name: "US.DT Node" }] }),
|
63
|
-
makeIncident({ components: [{ id: "3", name: "(USDT) Node" }] }),
|
64
|
-
makeIncident({ components: [{ id: "4", name: "Ethereum Node" }] }),
|
65
|
-
makeIncident({ components: [{ id: "5", name: "Ethereum (ETH) swap issue" }] }),
|
66
|
-
];
|
67
|
-
|
68
|
-
const result = filterServiceStatusIncidents(incidents, ["USDT", "ETH"]);
|
69
|
-
expect(result.map(i => i.components?.[0].id)).toEqual(["1", "3", "5"]);
|
70
|
-
expect(result.length).toBe(3);
|
71
|
-
});
|
72
|
-
|
73
|
-
it("matches incidents for all known Ledger components", () => {
|
74
|
-
const incidents: Incident[] = LEDGER_COMPONENTS.map((name, index) =>
|
75
|
-
makeIncident({ components: [{ id: `${index + 1}`, name }] }),
|
76
|
-
);
|
77
|
-
|
78
|
-
const result = filterServiceStatusIncidents(incidents, ["BTC"]);
|
79
|
-
expect(result.length).toBe(LEDGER_COMPONENTS.length);
|
80
|
-
});
|
81
|
-
|
82
|
-
it("filters correctly with common tickers", () => {
|
83
|
-
const tickers = ["XRP", "SOL", "ETH", "BTC", "ADA", "USDC", "USDT"];
|
84
|
-
const incidents: Incident[] = [
|
85
|
-
makeIncident({ components: [{ id: "1", name: "BTC Node" }] }),
|
86
|
-
makeIncident({ components: [{ id: "2", name: "eth Node" }] }),
|
87
|
-
makeIncident({ components: [{ id: "3", name: "ADA-Service" }] }),
|
88
|
-
makeIncident({ components: [{ id: "4", name: "usdc gateway" }] }),
|
89
|
-
makeIncident({ components: [{ id: "5", name: "NOTUSDTService" }] }),
|
90
|
-
makeIncident({ components: [{ id: "6", name: "USDT" }] }),
|
91
|
-
makeIncident({ components: [{ id: "7", name: "xrp relayer" }] }),
|
92
|
-
makeIncident({ components: [{ id: "8", name: "SOL Node" }] }),
|
93
|
-
makeIncident({ components: [{ id: "9", name: "SOLANA Node" }] }),
|
94
|
-
makeIncident({ components: [{ id: "10", name: "Random Service" }] }),
|
95
|
-
makeIncident({ components: [] }),
|
96
|
-
];
|
97
|
-
|
98
|
-
const result = filterServiceStatusIncidents(incidents, tickers);
|
99
|
-
expect(result.map(i => i.components?.[0]?.id)).toEqual(["1", "2", "3", "4", "6", "7", "8"]);
|
100
|
-
expect(result.length).toBe(8);
|
101
|
-
});
|
102
|
-
});
|
@@ -1,12 +0,0 @@
|
|
1
|
-
export const LEDGER_COMPONENTS = [
|
2
|
-
"Ledger Application Store",
|
3
|
-
"Ledger Live Security Services",
|
4
|
-
"Swap API",
|
5
|
-
"Buy",
|
6
|
-
"Earn Dashboard",
|
7
|
-
"Crypto Assets Service",
|
8
|
-
"Cloud Sync",
|
9
|
-
"Trustchain",
|
10
|
-
"Loyalty Program",
|
11
|
-
"Card Program",
|
12
|
-
] as const;
|