@robotical/webapp-types 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/application-manager.ts +20 -0
- package/dist-types/src/application/ApplicationManager/ApplicationManager.d.ts +91 -0
- package/dist-types/src/application/ApplicationManager/ApplicationManager.js +448 -0
- package/dist-types/src/application/RAFTs/Cog/Cog.d.ts +39 -0
- package/dist-types/src/application/RAFTs/Cog/Cog.js +171 -0
- package/dist-types/src/application/RAFTs/Marty/Marty.d.ts +40 -0
- package/dist-types/src/application/RAFTs/Marty/Marty.js +179 -0
- package/dist-types/src/application/RAFTs/RAFT.d.ts +109 -0
- package/dist-types/src/application/RAFTs/RAFT.js +313 -0
- package/dist-types/src/application/RAFTs/RAFTInterface.d.ts +13 -0
- package/dist-types/src/application/RAFTs/RAFTInterface.js +6 -0
- package/dist-types/src/application/RAFTs/RaftObserver.d.ts +10 -0
- package/dist-types/src/application/RAFTs/RaftObserver.js +1 -0
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.d.ts +59 -0
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.js +324 -0
- package/dist-types/src/application/communicators/SelfdestructiveMessagePromise.d.ts +10 -0
- package/dist-types/src/application/communicators/SelfdestructiveMessagePromise.js +31 -0
- package/dist-types/src/application/communicators/WrapperCommunicator.d.ts +24 -0
- package/dist-types/src/application/communicators/WrapperCommunicator.js +137 -0
- package/dist-types/src/components/disposables/LoadingSpinner/index.d.ts +7 -0
- package/dist-types/src/components/disposables/LoadingSpinner/index.js +29 -0
- package/dist-types/src/components/disposables/buttons/SVGImageButton/index.d.ts +14 -0
- package/dist-types/src/components/disposables/buttons/SVGImageButton/index.js +19 -0
- package/dist-types/src/components/disposables/buttons/SimpleButton/index.d.ts +14 -0
- package/dist-types/src/components/disposables/buttons/SimpleButton/index.js +18 -0
- package/dist-types/src/components/modals/DisconnectConfirmation/index.d.ts +6 -0
- package/dist-types/src/components/modals/DisconnectConfirmation/index.js +63 -0
- package/dist-types/src/components/modals/DisconnectConfirmation/styles.d.ts +1 -0
- package/dist-types/src/components/modals/DisconnectConfirmation/styles.js +7 -0
- package/dist-types/src/components/modals/InUnplugged/index.d.ts +1 -0
- package/dist-types/src/components/modals/InUnplugged/index.js +12 -0
- package/dist-types/src/components/modals/InUnplugged/styles.d.ts +5 -0
- package/dist-types/src/components/modals/InUnplugged/styles.js +11 -0
- package/dist-types/src/components/modals/VerificationModal/index.d.ts +6 -0
- package/dist-types/src/components/modals/VerificationModal/index.js +124 -0
- package/dist-types/src/components/modals/VerificationModalPhoneApp/index.d.ts +6 -0
- package/dist-types/src/components/modals/VerificationModalPhoneApp/index.js +190 -0
- package/dist-types/src/components/oneoffs/LEDs/index.d.ts +8 -0
- package/dist-types/src/components/oneoffs/LEDs/index.js +39 -0
- package/dist-types/src/components/oneoffs/RICSignal/index.d.ts +7 -0
- package/dist-types/src/components/oneoffs/RICSignal/index.js +29 -0
- package/dist-types/src/services/logger/Logger.d.ts +7 -0
- package/dist-types/src/services/logger/Logger.js +19 -0
- package/dist-types/src/state-observables/modal/ModalObserver.d.ts +17 -0
- package/dist-types/src/state-observables/modal/ModalObserver.js +1 -0
- package/dist-types/src/state-observables/modal/ModalState.d.ts +24 -0
- package/dist-types/src/state-observables/modal/ModalState.js +69 -0
- package/dist-types/src/store/SelectedRaftContext.d.ts +17 -0
- package/dist-types/src/store/SelectedRaftContext.js +80 -0
- package/dist-types/src/styles/colors.d.ts +35 -0
- package/dist-types/src/styles/colors.js +42 -0
- package/dist-types/src/types/communication-between-apps/wrapper-communication.d.ts +45 -0
- package/dist-types/src/types/communication-between-apps/wrapper-communication.js +25 -0
- package/dist-types/src/types/events/raft-info.d.ts +10 -0
- package/dist-types/src/types/events/raft-info.js +11 -0
- package/dist-types/src/types/phone-app-communicator.d.ts +20 -0
- package/dist-types/src/types/phone-app-communicator.js +5 -0
- package/dist-types/src/types/raft.d.ts +18 -0
- package/dist-types/src/types/raft.js +14 -0
- package/dist-types/src/utils/Toaster.d.ts +13 -0
- package/dist-types/src/utils/Toaster.js +38 -0
- package/dist-types/src/utils/helpers/compare-version.d.ts +2 -0
- package/dist-types/src/utils/helpers/compare-version.js +19 -0
- package/dist-types/src/utils/helpers/randomHashGenerator.d.ts +1 -0
- package/dist-types/src/utils/helpers/randomHashGenerator.js +10 -0
- package/dist-types/src/utils/helpers/rescale-range.d.ts +2 -0
- package/dist-types/src/utils/helpers/rescale-range.js +4 -0
- package/dist-types/src/utils/helpers/wifi-configuration-subtitle-gen.d.ts +3 -0
- package/dist-types/src/utils/helpers/wifi-configuration-subtitle-gen.js +34 -0
- package/dist-types/src/utils/phone-app-communication/is-phone-app.d.ts +5 -0
- package/dist-types/src/utils/phone-app-communication/is-phone-app.js +7 -0
- package/dist-types/src/wrapper-app/WrapperAppManager.d.ts +58 -0
- package/dist-types/src/wrapper-app/WrapperAppManager.js +176 -0
- package/dist-types/src/wrapper-app/communicators/WebAppCommunicator.d.ts +24 -0
- package/dist-types/src/wrapper-app/communicators/WebAppCommunicator.js +243 -0
- package/dist-types/src/wrapper-app/connectors/CogConnector/CogConnector.d.ts +35 -0
- package/dist-types/src/wrapper-app/connectors/CogConnector/CogConnector.js +177 -0
- package/dist-types/src/wrapper-app/connectors/Connector.d.ts +69 -0
- package/dist-types/src/wrapper-app/connectors/Connector.js +315 -0
- package/dist-types/src/wrapper-app/connectors/ConnectorFactory.d.ts +15 -0
- package/dist-types/src/wrapper-app/connectors/ConnectorFactory.js +99 -0
- package/dist-types/src/wrapper-app/connectors/ConnectorInterface.d.ts +10 -0
- package/dist-types/src/wrapper-app/connectors/ConnectorInterface.js +6 -0
- package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.d.ts +35 -0
- package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.js +219 -0
- package/dist-types/types-package/application-manager.d.ts +17 -0
- package/dist-types/types-package/application-manager.js +5 -0
- package/package.json +13 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var ModalState = /** @class */ (function () {
|
|
2
|
+
function ModalState() {
|
|
3
|
+
this._observers = {};
|
|
4
|
+
this._modalPromise = null;
|
|
5
|
+
this._modalResolve = function () { };
|
|
6
|
+
this._modalReject = function () { };
|
|
7
|
+
}
|
|
8
|
+
ModalState.prototype.setModal = function (modalContent, modalTitle) {
|
|
9
|
+
var _this = this;
|
|
10
|
+
this._modalPromise = new Promise(function (resolve, reject) {
|
|
11
|
+
_this._modalResolve = resolve;
|
|
12
|
+
_this._modalReject = reject;
|
|
13
|
+
_this.modalContent = modalContent;
|
|
14
|
+
_this.modalTitle = modalTitle;
|
|
15
|
+
_this.publish("SetModal", { modalContent: modalContent, modalTitle: modalTitle });
|
|
16
|
+
});
|
|
17
|
+
return this._modalPromise;
|
|
18
|
+
};
|
|
19
|
+
ModalState.prototype.closeModal = function (modalReturnValue, onCloseCb) {
|
|
20
|
+
this.modalContent = null;
|
|
21
|
+
this.modalTitle = "";
|
|
22
|
+
this.publish("CloseModal");
|
|
23
|
+
this._modalResolve(modalReturnValue);
|
|
24
|
+
this.clearPromise();
|
|
25
|
+
onCloseCb && onCloseCb();
|
|
26
|
+
};
|
|
27
|
+
ModalState.prototype.updateModalProps = function (updatedProps) {
|
|
28
|
+
this.modalTitle = updatedProps.modalTitle || this.modalTitle;
|
|
29
|
+
this.publish("UpdateModalProps", updatedProps);
|
|
30
|
+
};
|
|
31
|
+
ModalState.prototype.clearPromise = function () {
|
|
32
|
+
this._modalPromise = null;
|
|
33
|
+
this._modalResolve = function () { };
|
|
34
|
+
this._modalReject = function () { };
|
|
35
|
+
};
|
|
36
|
+
ModalState.prototype.subscribe = function (observer, topics) {
|
|
37
|
+
for (var _i = 0, topics_1 = topics; _i < topics_1.length; _i++) {
|
|
38
|
+
var topic = topics_1[_i];
|
|
39
|
+
if (!this._observers[topic]) {
|
|
40
|
+
this._observers[topic] = [];
|
|
41
|
+
}
|
|
42
|
+
if (this._observers[topic].indexOf(observer) === -1) {
|
|
43
|
+
this._observers[topic].push(observer);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
ModalState.prototype.unsubscribe = function (observer) {
|
|
48
|
+
for (var topic in this._observers) {
|
|
49
|
+
if (this._observers.hasOwnProperty(topic)) {
|
|
50
|
+
var index = this._observers[topic].indexOf(observer);
|
|
51
|
+
if (index !== -1) {
|
|
52
|
+
this._observers[topic].splice(index, 1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
ModalState.prototype.publish = function (eventTopic, eventData) {
|
|
58
|
+
if (this._observers.hasOwnProperty(eventTopic)) {
|
|
59
|
+
for (var _i = 0, _a = this._observers[eventTopic]; _i < _a.length; _i++) {
|
|
60
|
+
var observer = _a[_i];
|
|
61
|
+
observer.notify(eventTopic, eventData);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return ModalState;
|
|
66
|
+
}());
|
|
67
|
+
var modalState = new ModalState();
|
|
68
|
+
export default modalState;
|
|
69
|
+
export var secondaryModalState = new ModalState();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum NewRobotIdE {
|
|
2
|
+
NEW = "=+__new__+="
|
|
3
|
+
}
|
|
4
|
+
export type ConnectedRaftItem = {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
isSelected: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const ConnectedRaftContentProvider: ({ children }: {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const useConnectedRafts: () => {
|
|
13
|
+
connectedRafts: ConnectedRaftItem[];
|
|
14
|
+
addConnectedRaft: (connectedRaft: ConnectedRaftItem) => void;
|
|
15
|
+
removeConnectedRaft: (connectedRaftId: string) => void;
|
|
16
|
+
setSelectedRaft: (connectedRaftId: string) => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import { createContext, useContext, useEffect, useState } from 'react';
|
|
23
|
+
export var NewRobotIdE;
|
|
24
|
+
(function (NewRobotIdE) {
|
|
25
|
+
NewRobotIdE["NEW"] = "=+__new__+=";
|
|
26
|
+
})(NewRobotIdE || (NewRobotIdE = {}));
|
|
27
|
+
var ConnectedRaftContext = createContext({
|
|
28
|
+
connectedRafts: [],
|
|
29
|
+
addConnectedRaft: function (connectedRaft) { },
|
|
30
|
+
removeConnectedRaft: function (connectedRaftId) { },
|
|
31
|
+
setSelectedRaft: function (connectedRaftId) { },
|
|
32
|
+
});
|
|
33
|
+
// Provider component
|
|
34
|
+
export var ConnectedRaftContentProvider = function (_a) {
|
|
35
|
+
var children = _a.children;
|
|
36
|
+
var _b = useState([{ id: NewRobotIdE.NEW, isSelected: true, name: "Connect to new robot" }]), connectedRafts = _b[0], setConnectedRafts = _b[1];
|
|
37
|
+
useEffect(function () {
|
|
38
|
+
if (window.applicationManager) {
|
|
39
|
+
window.applicationManager.connectedRaftContextMethods = {
|
|
40
|
+
addConnectedRaft: function (connectedRaft) {
|
|
41
|
+
addConnectedRaft(connectedRaft);
|
|
42
|
+
},
|
|
43
|
+
removeConnectedRaft: function (connectedRaftId) {
|
|
44
|
+
removeConnectedRaft(connectedRaftId);
|
|
45
|
+
},
|
|
46
|
+
setSelectedRaft: function (connectedRaftId) {
|
|
47
|
+
setSelectedRaft(connectedRaftId);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
var addConnectedRaft = function (connectedRaft) {
|
|
53
|
+
// if the new raft is already in the list, do not add it again, just select it
|
|
54
|
+
var existingRaft = connectedRafts.find(function (connectedRaft_) { return connectedRaft_.id === connectedRaft.id; });
|
|
55
|
+
if (existingRaft) {
|
|
56
|
+
setConnectedRafts(function (prev) { return prev.map(function (connectedRaft_) { return (__assign(__assign({}, connectedRaft_), { isSelected: connectedRaft_.id === connectedRaft.id })); }); });
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// if the newly added raft is selected, deselect the previously selected raft
|
|
60
|
+
if (connectedRaft.isSelected) {
|
|
61
|
+
setConnectedRafts(function (prev) { return prev.map(function (connectedRaft) { return (__assign(__assign({}, connectedRaft), { isSelected: false })); }); });
|
|
62
|
+
}
|
|
63
|
+
setConnectedRafts(function (prev) { return __spreadArray(__spreadArray([], prev, true), [connectedRaft], false); });
|
|
64
|
+
};
|
|
65
|
+
var removeConnectedRaft = function (connectedRaftId) {
|
|
66
|
+
// if the removed raft is selected, select the first raft in the list
|
|
67
|
+
var selectedRaft = connectedRafts.find(function (connectedRaft) { return connectedRaft.isSelected; });
|
|
68
|
+
if ((selectedRaft === null || selectedRaft === void 0 ? void 0 : selectedRaft.id) === connectedRaftId) {
|
|
69
|
+
setConnectedRafts(function (prev) { return prev.map(function (connectedRaft, index) { return (__assign(__assign({}, connectedRaft), { isSelected: index === 0 })); }); });
|
|
70
|
+
}
|
|
71
|
+
setConnectedRafts(function (prev) { return prev.filter(function (connectedRaft) { return connectedRaft.id !== connectedRaftId; }); });
|
|
72
|
+
};
|
|
73
|
+
var setSelectedRaft = function (connectedRaftId) {
|
|
74
|
+
// deselect the previously selected raft
|
|
75
|
+
setConnectedRafts(function (prev) { return prev.map(function (connectedRaft) { return (__assign(__assign({}, connectedRaft), { isSelected: false })); }); });
|
|
76
|
+
setConnectedRafts(function (prev) { return prev.map(function (connectedRaft) { return (__assign(__assign({}, connectedRaft), { isSelected: connectedRaft.id === connectedRaftId })); }); });
|
|
77
|
+
};
|
|
78
|
+
return (_jsx(ConnectedRaftContext.Provider, __assign({ value: { connectedRafts: connectedRafts, addConnectedRaft: addConnectedRaft, removeConnectedRaft: removeConnectedRaft, setSelectedRaft: setSelectedRaft } }, { children: children })));
|
|
79
|
+
};
|
|
80
|
+
export var useConnectedRafts = function () { return useContext(ConnectedRaftContext); };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const BLACK = "rgb(38,38,38)";
|
|
2
|
+
export declare const BLACK_075 = "rgba(38, 38, 38, 0.75)";
|
|
3
|
+
export declare const BLACK_05 = "rgba(38, 38, 38, 0.5)";
|
|
4
|
+
export declare const BLACK_025 = "rgba(0,0,0, 0.25)";
|
|
5
|
+
export declare const GREY = "rgba(81, 81, 81, 0.5)";
|
|
6
|
+
export declare const GREY_2 = "#f5f5f5";
|
|
7
|
+
export declare const GREY_3 = "rgb(143, 142, 148)";
|
|
8
|
+
export declare const GREY_4 = "rgb(223, 223, 223)";
|
|
9
|
+
export declare const HINT_GREY = "rgba(125,125,125, 0.5)";
|
|
10
|
+
export declare const MAIN_BLUE = "rgb(55, 171, 200)";
|
|
11
|
+
export declare const AQUA_BLUE_025 = "rgba(55, 171, 200, 0.25)";
|
|
12
|
+
export declare const AQUA_BLUE_05 = "rgba(55, 171, 200, 0.5)";
|
|
13
|
+
export declare const PALE_BLUE = "#94cddc";
|
|
14
|
+
export declare const WHITE = "rgb(245,245,245)";
|
|
15
|
+
export declare const TRUE_WHITE = "rgb(255, 255, 255)";
|
|
16
|
+
export declare const PALE_WHITE = "rgba(245,245,245, 0.5)";
|
|
17
|
+
export declare const GREEN = "rgb(0, 213, 146)";
|
|
18
|
+
export declare const RED = "rgb(237, 82, 82)";
|
|
19
|
+
export declare const SAND_YELLOW = "rgb(244, 218,97)";
|
|
20
|
+
export declare const SAND_YELLOW_25 = "rgba(244, 218,97, 0.25)";
|
|
21
|
+
export declare const SAND_YELLOW_50 = "rgba(244, 218, 97, 0.5)";
|
|
22
|
+
export declare const BLUE_LED = "rgba(0, 0, 128, 0.5)";
|
|
23
|
+
export declare const GREEN_LED = "rgba(0, 128, 0, 0.5)";
|
|
24
|
+
export declare const PINK_LED = "rgba(128, 0, 128, 0.5)";
|
|
25
|
+
export declare const DASHBUTTON_BLUE = "rgb(198,234,239)";
|
|
26
|
+
export declare const DASHBORDER_BLUE = "rgb(175,221,233)";
|
|
27
|
+
export declare const INDICATOR_GREEN = "rgb(11, 158, 46)";
|
|
28
|
+
export declare const INDICATOR_ORANGE = "rgb(253, 180, 1)";
|
|
29
|
+
export declare const INDICATOR_RED = "rgb(237, 82, 82)";
|
|
30
|
+
export declare const INDICATOR_WHITE = "rgba(245,245,245, 0.5)";
|
|
31
|
+
export declare const SCREENFREE_PURPLE = "rgb(118, 53, 151)";
|
|
32
|
+
export declare const SCREENFREE_GREEN = "rgb(3, 125, 60)";
|
|
33
|
+
export declare const SCREENFREE_YELLOW = "rgb(250, 217, 5)";
|
|
34
|
+
export declare const SCREENFREE_RED = "rgb(91, 20, 19)";
|
|
35
|
+
export declare const SCREENFREE_BLUE = "rgb(0, 170, 255)";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export var BLACK = 'rgb(38,38,38)';
|
|
2
|
+
export var BLACK_075 = 'rgba(38, 38, 38, 0.75)';
|
|
3
|
+
export var BLACK_05 = 'rgba(38, 38, 38, 0.5)';
|
|
4
|
+
export var BLACK_025 = 'rgba(0,0,0, 0.25)';
|
|
5
|
+
export var GREY = 'rgba(81, 81, 81, 0.5)';
|
|
6
|
+
export var GREY_2 = '#f5f5f5';
|
|
7
|
+
export var GREY_3 = 'rgb(143, 142, 148)';
|
|
8
|
+
export var GREY_4 = 'rgb(223, 223, 223)';
|
|
9
|
+
export var HINT_GREY = 'rgba(125,125,125, 0.5)';
|
|
10
|
+
export var MAIN_BLUE = 'rgb(55, 171, 200)';
|
|
11
|
+
export var AQUA_BLUE_025 = 'rgba(55, 171, 200, 0.25)';
|
|
12
|
+
export var AQUA_BLUE_05 = 'rgba(55, 171, 200, 0.5)';
|
|
13
|
+
export var PALE_BLUE = '#94cddc';
|
|
14
|
+
export var WHITE = 'rgb(245,245,245)';
|
|
15
|
+
export var TRUE_WHITE = 'rgb(255, 255, 255)';
|
|
16
|
+
export var PALE_WHITE = 'rgba(245,245,245, 0.5)';
|
|
17
|
+
export var GREEN = 'rgb(0, 213, 146)';
|
|
18
|
+
export var RED = 'rgb(237, 82, 82)';
|
|
19
|
+
export var SAND_YELLOW = 'rgb(244, 218,97)';
|
|
20
|
+
export var SAND_YELLOW_25 = 'rgba(244, 218,97, 0.25)';
|
|
21
|
+
export var SAND_YELLOW_50 = 'rgba(244, 218, 97, 0.5)';
|
|
22
|
+
export var BLUE_LED = 'rgba(0, 0, 128, 0.5)';
|
|
23
|
+
export var GREEN_LED = 'rgba(0, 128, 0, 0.5)';
|
|
24
|
+
export var PINK_LED = 'rgba(128, 0, 128, 0.5)';
|
|
25
|
+
export var DASHBUTTON_BLUE = 'rgb(198,234,239)';
|
|
26
|
+
export var DASHBORDER_BLUE = 'rgb(175,221,233)';
|
|
27
|
+
export var INDICATOR_GREEN = 'rgb(11, 158, 46)';
|
|
28
|
+
export var INDICATOR_ORANGE = 'rgb(253, 180, 1)';
|
|
29
|
+
export var INDICATOR_RED = 'rgb(237, 82, 82)';
|
|
30
|
+
export var INDICATOR_WHITE = 'rgba(245,245,245, 0.5)';
|
|
31
|
+
//Changed the lightness value in HSL colour picker to get new lighter RGB values
|
|
32
|
+
export var SCREENFREE_PURPLE = 'rgb(118, 53, 151)';
|
|
33
|
+
export var SCREENFREE_GREEN = 'rgb(3, 125, 60)';
|
|
34
|
+
export var SCREENFREE_YELLOW = 'rgb(250, 217, 5)';
|
|
35
|
+
export var SCREENFREE_RED = 'rgb(91, 20, 19)';
|
|
36
|
+
export var SCREENFREE_BLUE = 'rgb(0, 170, 255)';
|
|
37
|
+
//Original RB values for the screenfree cards
|
|
38
|
+
// export const SCREENFREE_PURPLE = 'rgb(47, 21, 60)';
|
|
39
|
+
// export const SCREENFREE_GREEN = 'rgb( 1, 55, 26)';
|
|
40
|
+
// export const SCREENFREE_YELLOW = 'rgb(97, 85, 2)';
|
|
41
|
+
// export const SCREENFREE_RED = 'rgb(91, 20, 19)';
|
|
42
|
+
// export const SCREENFREE_BLUE = 'rgb( 0, 57, 85)';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface IAppSentMessage {
|
|
2
|
+
message: AppSentMessage;
|
|
3
|
+
data?: any;
|
|
4
|
+
messagePromiseId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IWrapperSentMessage {
|
|
7
|
+
message: WrapperSentMessage;
|
|
8
|
+
data?: any;
|
|
9
|
+
messagePromiseId: string;
|
|
10
|
+
}
|
|
11
|
+
export declare enum AppSentMessage {
|
|
12
|
+
RAFT_IS_CONNECTED = "RAFT_IS_CONNECTED",
|
|
13
|
+
RAFT_CONNECT = "RAFT_CONNECT",
|
|
14
|
+
RAFT_GET_NAME = "RAFT_GET_NAME",
|
|
15
|
+
RAFT_VERIFY = "RAFT_VERIFY",
|
|
16
|
+
RAFT_VERIFY_PHONE = "RAFT_VERIFY_PHONE",
|
|
17
|
+
RAFT_STOP_VERIFY = "RAFT_STOP_VERIFY",
|
|
18
|
+
RAFT_DISCONNECT = "RAFT_DISCONNECT",
|
|
19
|
+
RAFT_START_DISCOVERY = "RAFT_START_DISCOVERY",
|
|
20
|
+
RAFT_SELECT = "RAFT_SELECT",
|
|
21
|
+
RAFT_SEND_REST = "RAFT_SEND_REST",
|
|
22
|
+
GET_MISSED_CONN_EVENT = "GET_MISSED_CONN_EVENT",
|
|
23
|
+
RAFT_STREAM_AUDIO = "RAFT_STREAM_AUDIO",
|
|
24
|
+
SAVE_FILE_ON_DEVICE = "SAVE_FILE_ON_DEVICE",
|
|
25
|
+
SAVE_FILE_ON_DEVICE_LOCAL_STORAGE = "SAVE_FILE_ON_DEVICE_LOCAL_STORAGE",
|
|
26
|
+
LOAD_FILE_FROM_DEVICE_LOCAL_STORAGE = "LOAD_FILE_FROM_DEVICE_LOCAL_STORAGE",
|
|
27
|
+
DELETE_FILE_FROM_DEVICE_LOCAL_STORAGE = "DELETE_FILE_FROM_DEVICE_LOCAL_STORAGE",
|
|
28
|
+
LIST_FILES_FROM_DEVICE_LOCAL_STORAGE = "LIST_FILES_FROM_DEVICE_LOCAL_STORAGE"
|
|
29
|
+
}
|
|
30
|
+
export declare enum WrapperSentMessage {
|
|
31
|
+
RAFT_PUBLISHED_EVENT = "RAFT_PUBLISHED_EVENT",
|
|
32
|
+
RAFT_CONNECTED_RESULTS = "RAFT_CONNECTED_RESULTS"
|
|
33
|
+
}
|
|
34
|
+
export interface WRAPPER_RESPONSE_BASE {
|
|
35
|
+
success: boolean;
|
|
36
|
+
error?: string;
|
|
37
|
+
results?: any;
|
|
38
|
+
messagePromiseId: string;
|
|
39
|
+
}
|
|
40
|
+
export interface WEB_APP_MESSAGE_BASE {
|
|
41
|
+
success: boolean;
|
|
42
|
+
error?: string;
|
|
43
|
+
results?: any;
|
|
44
|
+
messagePromiseId: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export var AppSentMessage;
|
|
2
|
+
(function (AppSentMessage) {
|
|
3
|
+
AppSentMessage["RAFT_IS_CONNECTED"] = "RAFT_IS_CONNECTED";
|
|
4
|
+
AppSentMessage["RAFT_CONNECT"] = "RAFT_CONNECT";
|
|
5
|
+
AppSentMessage["RAFT_GET_NAME"] = "RAFT_GET_NAME";
|
|
6
|
+
AppSentMessage["RAFT_VERIFY"] = "RAFT_VERIFY";
|
|
7
|
+
AppSentMessage["RAFT_VERIFY_PHONE"] = "RAFT_VERIFY_PHONE";
|
|
8
|
+
AppSentMessage["RAFT_STOP_VERIFY"] = "RAFT_STOP_VERIFY";
|
|
9
|
+
AppSentMessage["RAFT_DISCONNECT"] = "RAFT_DISCONNECT";
|
|
10
|
+
AppSentMessage["RAFT_START_DISCOVERY"] = "RAFT_START_DISCOVERY";
|
|
11
|
+
AppSentMessage["RAFT_SELECT"] = "RAFT_SELECT";
|
|
12
|
+
AppSentMessage["RAFT_SEND_REST"] = "RAFT_SEND_REST";
|
|
13
|
+
AppSentMessage["GET_MISSED_CONN_EVENT"] = "GET_MISSED_CONN_EVENT";
|
|
14
|
+
AppSentMessage["RAFT_STREAM_AUDIO"] = "RAFT_STREAM_AUDIO";
|
|
15
|
+
AppSentMessage["SAVE_FILE_ON_DEVICE"] = "SAVE_FILE_ON_DEVICE";
|
|
16
|
+
AppSentMessage["SAVE_FILE_ON_DEVICE_LOCAL_STORAGE"] = "SAVE_FILE_ON_DEVICE_LOCAL_STORAGE";
|
|
17
|
+
AppSentMessage["LOAD_FILE_FROM_DEVICE_LOCAL_STORAGE"] = "LOAD_FILE_FROM_DEVICE_LOCAL_STORAGE";
|
|
18
|
+
AppSentMessage["DELETE_FILE_FROM_DEVICE_LOCAL_STORAGE"] = "DELETE_FILE_FROM_DEVICE_LOCAL_STORAGE";
|
|
19
|
+
AppSentMessage["LIST_FILES_FROM_DEVICE_LOCAL_STORAGE"] = "LIST_FILES_FROM_DEVICE_LOCAL_STORAGE";
|
|
20
|
+
})(AppSentMessage || (AppSentMessage = {}));
|
|
21
|
+
export var WrapperSentMessage;
|
|
22
|
+
(function (WrapperSentMessage) {
|
|
23
|
+
WrapperSentMessage["RAFT_PUBLISHED_EVENT"] = "RAFT_PUBLISHED_EVENT";
|
|
24
|
+
WrapperSentMessage["RAFT_CONNECTED_RESULTS"] = "RAFT_CONNECTED_RESULTS";
|
|
25
|
+
})(WrapperSentMessage || (WrapperSentMessage = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum RaftInfoEvents {
|
|
2
|
+
RAFT_NAME = "RAFT_NAME",
|
|
3
|
+
SYSTEM_INFO = "SYSTEM_INFO",
|
|
4
|
+
STATE_INFO = "STATE_INFO",
|
|
5
|
+
RAFT_VERSION = "RAFT_VERSION",
|
|
6
|
+
RAFT_SERIAL_NO = "RAFT_SERIAL_NO",
|
|
7
|
+
RAFT_MSG = "RAFT_MSG",
|
|
8
|
+
IS_REGISTERED_TO_WARRANTY = "IS_REGISTERED_TO_WARRANTY",
|
|
9
|
+
RAFT_IS_VERIFIED = "RAFT_IS_VERIFIED"
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var RaftInfoEvents;
|
|
2
|
+
(function (RaftInfoEvents) {
|
|
3
|
+
RaftInfoEvents["RAFT_NAME"] = "RAFT_NAME";
|
|
4
|
+
RaftInfoEvents["SYSTEM_INFO"] = "SYSTEM_INFO";
|
|
5
|
+
RaftInfoEvents["STATE_INFO"] = "STATE_INFO";
|
|
6
|
+
RaftInfoEvents["RAFT_VERSION"] = "RAFT_VERSION";
|
|
7
|
+
RaftInfoEvents["RAFT_SERIAL_NO"] = "RAFT_SERIAL_NO";
|
|
8
|
+
RaftInfoEvents["RAFT_MSG"] = "RAFT_MSG";
|
|
9
|
+
RaftInfoEvents["IS_REGISTERED_TO_WARRANTY"] = "IS_REGISTERED_TO_WARRANTY";
|
|
10
|
+
RaftInfoEvents["RAFT_IS_VERIFIED"] = "RAFT_IS_VERIFIED";
|
|
11
|
+
})(RaftInfoEvents || (RaftInfoEvents = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum EventsE {
|
|
2
|
+
FOUND_RAFT_ON_DISCOVERY = "found-raft-on-discovery",
|
|
3
|
+
DISCOVERY_ENDED = "discovery-ended"
|
|
4
|
+
}
|
|
5
|
+
export type PHONE_APP_RESPONSE_BASE = {
|
|
6
|
+
success: boolean;
|
|
7
|
+
error?: string;
|
|
8
|
+
eventName?: EventsE;
|
|
9
|
+
};
|
|
10
|
+
export type START_DISCOVERY_RESPONSE = PHONE_APP_RESPONSE_BASE & {
|
|
11
|
+
didStartDiscovery: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type FOUND_RAFT_ON_DISCOVERY_RESPONSE = PHONE_APP_RESPONSE_BASE & {
|
|
14
|
+
foundRIC: {
|
|
15
|
+
_id: string;
|
|
16
|
+
_localName: string;
|
|
17
|
+
_name: string;
|
|
18
|
+
_rssi: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare enum RaftConnectionMethod {
|
|
2
|
+
WEB_SOCKET = "WebSocket",
|
|
3
|
+
WEB_BLE = "WebBLE",
|
|
4
|
+
PHONE_BLE = "PhoneBLE"
|
|
5
|
+
}
|
|
6
|
+
export type ConnectionAttemptResults = {
|
|
7
|
+
success: boolean;
|
|
8
|
+
reason: 'failed' | 'unplugged' | 'success' | 'no_sys_info' | 'invalid_raft_type';
|
|
9
|
+
data?: {
|
|
10
|
+
raftId: string;
|
|
11
|
+
raftType: RaftTypeE;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare enum RaftTypeE {
|
|
15
|
+
MARTY = "Marty",
|
|
16
|
+
COG = "Cog",
|
|
17
|
+
undefined = "undefined"
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export var RaftConnectionMethod;
|
|
2
|
+
(function (RaftConnectionMethod) {
|
|
3
|
+
RaftConnectionMethod["WEB_SOCKET"] = "WebSocket";
|
|
4
|
+
RaftConnectionMethod["WEB_BLE"] = "WebBLE";
|
|
5
|
+
RaftConnectionMethod["PHONE_BLE"] = "PhoneBLE";
|
|
6
|
+
})(RaftConnectionMethod || (RaftConnectionMethod = {}));
|
|
7
|
+
;
|
|
8
|
+
export var RaftTypeE;
|
|
9
|
+
(function (RaftTypeE) {
|
|
10
|
+
RaftTypeE["MARTY"] = "Marty";
|
|
11
|
+
RaftTypeE["COG"] = "Cog";
|
|
12
|
+
RaftTypeE["undefined"] = "undefined";
|
|
13
|
+
})(RaftTypeE || (RaftTypeE = {}));
|
|
14
|
+
;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToastOptions } from 'react-toastify';
|
|
2
|
+
import 'react-toastify/dist/ReactToastify.css';
|
|
3
|
+
declare class Toaster {
|
|
4
|
+
private static lastToastTime;
|
|
5
|
+
private static debounceTime;
|
|
6
|
+
private static shouldShowToast;
|
|
7
|
+
static warn(message: string, options?: ToastOptions): void;
|
|
8
|
+
static error(message: string, options?: ToastOptions): void;
|
|
9
|
+
static info(message: string, options?: ToastOptions): void;
|
|
10
|
+
static success(message: string, options?: ToastOptions): void;
|
|
11
|
+
static clearAll(): void;
|
|
12
|
+
}
|
|
13
|
+
export default Toaster;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { toast } from 'react-toastify';
|
|
2
|
+
import 'react-toastify/dist/ReactToastify.css';
|
|
3
|
+
var Toaster = /** @class */ (function () {
|
|
4
|
+
function Toaster() {
|
|
5
|
+
}
|
|
6
|
+
Toaster.shouldShowToast = function (message) {
|
|
7
|
+
var currentTime = Date.now();
|
|
8
|
+
var lastTimeShown = this.lastToastTime.get(message) || 0;
|
|
9
|
+
var shouldBeShown = currentTime - lastTimeShown > this.debounceTime;
|
|
10
|
+
if (shouldBeShown) {
|
|
11
|
+
this.lastToastTime.set(message, currentTime);
|
|
12
|
+
}
|
|
13
|
+
return shouldBeShown;
|
|
14
|
+
};
|
|
15
|
+
Toaster.warn = function (message, options) {
|
|
16
|
+
if (this.shouldShowToast(message))
|
|
17
|
+
toast.warn(message, options);
|
|
18
|
+
};
|
|
19
|
+
Toaster.error = function (message, options) {
|
|
20
|
+
if (this.shouldShowToast(message))
|
|
21
|
+
toast.error(message, options);
|
|
22
|
+
};
|
|
23
|
+
Toaster.info = function (message, options) {
|
|
24
|
+
if (this.shouldShowToast(message))
|
|
25
|
+
toast.info(message, options);
|
|
26
|
+
};
|
|
27
|
+
Toaster.success = function (message, options) {
|
|
28
|
+
if (this.shouldShowToast(message))
|
|
29
|
+
toast.success(message, options);
|
|
30
|
+
};
|
|
31
|
+
Toaster.clearAll = function () {
|
|
32
|
+
toast.dismiss();
|
|
33
|
+
};
|
|
34
|
+
Toaster.lastToastTime = new Map();
|
|
35
|
+
Toaster.debounceTime = 5000;
|
|
36
|
+
return Toaster;
|
|
37
|
+
}());
|
|
38
|
+
export default Toaster;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import semverGt from "semver/functions/gt";
|
|
2
|
+
export default function isVersionGreater(v1, v2) {
|
|
3
|
+
try {
|
|
4
|
+
return semverGt(v1, v2);
|
|
5
|
+
}
|
|
6
|
+
catch (e) {
|
|
7
|
+
console.log(e, v1, v2);
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function isVersionGreater_errorCatching(v1, v2) {
|
|
12
|
+
try {
|
|
13
|
+
return semverGt(v1, v2);
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
console.log(e, v1, v2);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (length?: number): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default function (length) {
|
|
2
|
+
if (length === void 0) { length = 10; }
|
|
3
|
+
var result = "";
|
|
4
|
+
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
5
|
+
var charactersLength = characters.length;
|
|
6
|
+
for (var i = 0; i < length; i++) {
|
|
7
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
8
|
+
}
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import isVersionGreater from "./compare-version";
|
|
2
|
+
export var FW_VERSION_RSSI_WIFI = "1.2.0"; // greater versions than this (1.1.17) have the wifi rssi logic
|
|
3
|
+
export default function wifiConfigSub(raft) {
|
|
4
|
+
if (!isVersionGreater(raft.getRaftVersion(), FW_VERSION_RSSI_WIFI)) {
|
|
5
|
+
return "Currently, wifi configuration only works in the phone application.";
|
|
6
|
+
}
|
|
7
|
+
return "";
|
|
8
|
+
// const isPaused = window.marty.getCachedWifiStatus().ssid ? true : false;
|
|
9
|
+
// const conInfo =
|
|
10
|
+
// window.marty.getCachedWifiStatus().connState ===
|
|
11
|
+
// RICWifiConnState.WIFI_CONN_CONNECTED ||
|
|
12
|
+
// window.marty.getCachedWifiStatus().ssid
|
|
13
|
+
// ? window.marty.getCachedWifiStatus().ipAddress +
|
|
14
|
+
// " on " +
|
|
15
|
+
// window.marty.getCachedWifiStatus().ssid
|
|
16
|
+
// : null;
|
|
17
|
+
// const isConnected =
|
|
18
|
+
// window.marty.getCachedWifiStatus().connState ===
|
|
19
|
+
// RICWifiConnState.WIFI_CONN_CONNECTED;
|
|
20
|
+
// let subtitle;
|
|
21
|
+
// if (isConnected) {
|
|
22
|
+
// subtitle = "Connected";
|
|
23
|
+
// }
|
|
24
|
+
// if (isPaused) {
|
|
25
|
+
// subtitle = "Connected (Paused for BLE)";
|
|
26
|
+
// }
|
|
27
|
+
// if (!isConnected && !isPaused) {
|
|
28
|
+
// subtitle = "Not Connected";
|
|
29
|
+
// }
|
|
30
|
+
// if (conInfo) {
|
|
31
|
+
// subtitle += " | " + conInfo;
|
|
32
|
+
// }
|
|
33
|
+
// return subtitle;
|
|
34
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { RaftInfoEvents } from "../types/events/raft-info";
|
|
2
|
+
import { ConnectionAttemptResults, RaftConnectionMethod } from "../types/raft";
|
|
3
|
+
import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@robdobsn/raftjs";
|
|
4
|
+
import { RICLedLcdColours } from "@robotical/roboticaljs";
|
|
5
|
+
export declare class WrapperAppManager {
|
|
6
|
+
private connectors;
|
|
7
|
+
private _observers;
|
|
8
|
+
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Connect to a RAFT
|
|
11
|
+
*
|
|
12
|
+
* @param {string} method - can be "WebBLE" or "WebSocket"
|
|
13
|
+
* @param {string | object} locator - either a string (WebSocket URL) or an object (WebBLE)
|
|
14
|
+
* @returns Promise<ConnectionAttemptResults>
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
connect(method: RaftConnectionMethod): Promise<ConnectionAttemptResults>;
|
|
18
|
+
/**
|
|
19
|
+
* Re-triggers the connect event which was missed due to the connection logic
|
|
20
|
+
*/
|
|
21
|
+
getMissedConnEvent(raftId: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* Get the RAFT Name
|
|
24
|
+
*/
|
|
25
|
+
getRaftName(raftId: string): "" | Promise<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Verify RAFT
|
|
28
|
+
*/
|
|
29
|
+
verifyRaft(ledLcdColours: RICLedLcdColours, raftId: string): false | Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Stop verifying RAFT
|
|
32
|
+
*/
|
|
33
|
+
stopVerifyingRaft(isCorrectRIC: boolean, raftId: string): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Disconnect from a RAFT
|
|
36
|
+
*/
|
|
37
|
+
disconnect(raftId: string): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Audio streaming
|
|
40
|
+
*/
|
|
41
|
+
streamAudio(raftId: string, streamContents: Uint8Array, clearExisting: boolean, duration: number): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Publish an event to all observers
|
|
44
|
+
* Set in RICConnector as an event listener callback
|
|
45
|
+
*/
|
|
46
|
+
publish(eventType: string, eventEnum: RaftConnEvent | RaftUpdateEvent | RaftPublishEvent | RaftInfoEvents, eventName: string, eventData: any): void;
|
|
47
|
+
/**
|
|
48
|
+
* Send a REST message to the RAFT
|
|
49
|
+
*/
|
|
50
|
+
sendRestMessage(msg: string, params: object | undefined, raftId: string): Promise<import("@robdobsn/raftjs").RaftOKFail>;
|
|
51
|
+
/**
|
|
52
|
+
* Removes marty after a certain time
|
|
53
|
+
* Removes from the martys list after x seconds so that we can still get the last event
|
|
54
|
+
*/
|
|
55
|
+
_removeRICConnector(connectorId: string, timeout: number): void;
|
|
56
|
+
}
|
|
57
|
+
declare const wrapperAppManager: WrapperAppManager;
|
|
58
|
+
export default wrapperAppManager;
|