@robotical/webapp-types 3.21.22 → 3.22.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/dist-types/package.json +3 -3
- package/dist-types/src/application/RAFTs/RAFT.js +6 -0
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.d.ts +5 -0
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.js +37 -0
- package/dist-types/src/services/observability/Observability.js +20 -1
- package/package.json +1 -1
package/dist-types/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marty-web-app",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
10
10
|
"@radix-ui/react-icons": "^1.3.2",
|
|
11
|
-
"@robdobsn/raftjs": "^2.
|
|
11
|
+
"@robdobsn/raftjs": "^2.2.0",
|
|
12
12
|
"@robotical/appv2-analytics-gatherer": "^1.2.17",
|
|
13
13
|
"@robotical/appv2-analytics-types": "^1.2.17",
|
|
14
14
|
"@robotical/appv2-warranty-service-lib": "^1.2.19",
|
|
15
15
|
"@robotical/codewheel": "^0.1.10",
|
|
16
16
|
"@robotical/cog-shooter-game": "^0.1.27",
|
|
17
17
|
"@robotical/jumping-game": "^0.1.29",
|
|
18
|
-
"@robotical/martyblocks": "^4.0.
|
|
18
|
+
"@robotical/martyblocks": "^4.0.68",
|
|
19
19
|
"@robotical/martyblocksjr": "^4.3.3",
|
|
20
20
|
"@robotical/maze": "^0.1.22",
|
|
21
21
|
"@robotical/rc-sequencer": "^1.1.15",
|
|
@@ -367,6 +367,12 @@ var RAFT = /** @class */ (function () {
|
|
|
367
367
|
return __generator(this, function (_b) {
|
|
368
368
|
switch (_b.label) {
|
|
369
369
|
case 0:
|
|
370
|
+
// Keep this compatible with wrapper/raftjs versions which forward the
|
|
371
|
+
// event name before exposing a matching TypeScript enum member.
|
|
372
|
+
if (eventName === "RECOVERY_DEGRADED") {
|
|
373
|
+
window.applicationManager.toaster.warn("Connection restored, but device updates could not be resumed. Please disconnect and reconnect.");
|
|
374
|
+
return [2 /*return*/];
|
|
375
|
+
}
|
|
370
376
|
_a = eventEnum;
|
|
371
377
|
switch (_a) {
|
|
372
378
|
case RaftConnEvent.CONN_VERIFIED_CORRECT: return [3 /*break*/, 1];
|
|
@@ -18,6 +18,11 @@ export declare const createRaftConnectionIssueDetectedHelper: (raft: RAFT, helpe
|
|
|
18
18
|
*/
|
|
19
19
|
export declare const raftConnectionIssueResolvedSubscriptionHelper: (raft: RAFT, helperId?: string) => HelperReturnType;
|
|
20
20
|
export declare const createRaftConnectionIssueResolvedHelper: (raft: RAFT, helperId: string) => HelperReturnType;
|
|
21
|
+
/**
|
|
22
|
+
* RAFT Connection Recovery Degraded Subscription Helper
|
|
23
|
+
*/
|
|
24
|
+
export declare const raftConnectionRecoveryDegradedSubscriptionHelper: (raft: RAFT, helperId?: string) => HelperReturnType;
|
|
25
|
+
export declare const createRaftConnectionRecoveryDegradedHelper: (raft: RAFT, helperId: string) => HelperReturnType;
|
|
21
26
|
/**
|
|
22
27
|
* RAFT Connected Subscription Helper
|
|
23
28
|
*/
|
|
@@ -142,6 +142,43 @@ var raftConnectionIssueResolvedSubscriptionObserver_ = function (callback) {
|
|
|
142
142
|
},
|
|
143
143
|
};
|
|
144
144
|
};
|
|
145
|
+
/**
|
|
146
|
+
* RAFT Connection Recovery Degraded Subscription Helper
|
|
147
|
+
*/
|
|
148
|
+
export var raftConnectionRecoveryDegradedSubscriptionHelper = function (raft, helperId) {
|
|
149
|
+
if (helperId === void 0) { helperId = 'raftConnectionRecoveryDegradedSubscriptionHelper'; }
|
|
150
|
+
if (!subHelpersObject[helperId]) {
|
|
151
|
+
subHelpersObject[helperId] = createRaftConnectionRecoveryDegradedHelper(raft, helperId);
|
|
152
|
+
}
|
|
153
|
+
return subHelpersObject[helperId];
|
|
154
|
+
};
|
|
155
|
+
export var createRaftConnectionRecoveryDegradedHelper = function (raft, helperId) {
|
|
156
|
+
var observer = null;
|
|
157
|
+
return {
|
|
158
|
+
subscribe: function (callback) {
|
|
159
|
+
observer = raftConnectionRecoveryDegradedSubscriptionObserver_(callback);
|
|
160
|
+
raft.subscribe(observer, ["conn"]);
|
|
161
|
+
},
|
|
162
|
+
unsubscribe: function (shouldDestroyInstance) {
|
|
163
|
+
if (shouldDestroyInstance === void 0) { shouldDestroyInstance = true; }
|
|
164
|
+
if (observer) {
|
|
165
|
+
raft.unsubscribe(observer);
|
|
166
|
+
}
|
|
167
|
+
if (shouldDestroyInstance) {
|
|
168
|
+
subHelpersObject[helperId] = null;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
var raftConnectionRecoveryDegradedSubscriptionObserver_ = function (callback) {
|
|
174
|
+
return {
|
|
175
|
+
notify: function (eventType, eventEnum, eventName, eventData) {
|
|
176
|
+
if (eventType === "conn" && eventName === "RECOVERY_DEGRADED") {
|
|
177
|
+
callback(eventData);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
};
|
|
145
182
|
/**
|
|
146
183
|
* RAFT Connected Subscription Helper
|
|
147
184
|
*/
|
|
@@ -13,6 +13,20 @@ import * as Sentry from "@sentry/react";
|
|
|
13
13
|
import packageInfo from "../../../package.json";
|
|
14
14
|
import isPhoneApp from "../../utils/phone-app-communication/is-phone-app";
|
|
15
15
|
var appVersion = packageInfo.version;
|
|
16
|
+
var LOCAL_HOSTNAMES = new Set(["localhost", "127.0.0.1", "::1"]);
|
|
17
|
+
var getEventHostname = function (event) {
|
|
18
|
+
var _a;
|
|
19
|
+
var eventUrl = (_a = event.request) === null || _a === void 0 ? void 0 : _a.url;
|
|
20
|
+
if (eventUrl) {
|
|
21
|
+
try {
|
|
22
|
+
return new URL(eventUrl, window.location.href).hostname;
|
|
23
|
+
}
|
|
24
|
+
catch (_b) {
|
|
25
|
+
// Fall back to the current page below.
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return window.location.hostname;
|
|
29
|
+
};
|
|
16
30
|
var getRuntime = function () {
|
|
17
31
|
try {
|
|
18
32
|
return isPhoneApp() ? "phone-webview" : "web-app";
|
|
@@ -60,9 +74,10 @@ export function initializeObservability() {
|
|
|
60
74
|
if (!dsn || Sentry.isInitialized()) {
|
|
61
75
|
return Sentry.isInitialized();
|
|
62
76
|
}
|
|
77
|
+
var environment = process.env.REACT_APP_SENTRY_ENVIRONMENT || process.env.NODE_ENV;
|
|
63
78
|
Sentry.init({
|
|
64
79
|
dsn: dsn,
|
|
65
|
-
environment:
|
|
80
|
+
environment: environment,
|
|
66
81
|
release: process.env.REACT_APP_SENTRY_RELEASE || "marty-web-app@".concat(appVersion),
|
|
67
82
|
sendDefaultPii: false,
|
|
68
83
|
attachStacktrace: true,
|
|
@@ -78,6 +93,10 @@ export function initializeObservability() {
|
|
|
78
93
|
}),
|
|
79
94
|
],
|
|
80
95
|
beforeSend: function (event) {
|
|
96
|
+
if (environment === "development" ||
|
|
97
|
+
LOCAL_HOSTNAMES.has(getEventHostname(event))) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
81
100
|
event.tags = __assign(__assign({}, event.tags), { app_runtime: getRuntime(), app_version: appVersion });
|
|
82
101
|
event.contexts = __assign(__assign({}, event.contexts), { app_snapshot: getSafeAppSnapshot() });
|
|
83
102
|
return event;
|