@vention/machine-logic-ui-sdk 0.19.0 → 0.21.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/index.esm.js
CHANGED
|
@@ -2881,6 +2881,9 @@ const getMqttWsUrlGivenUiIframeUrl = uiIframeUrl => {
|
|
|
2881
2881
|
const wssBaseUrl = baseUrl.replace("https:", "wss:");
|
|
2882
2882
|
return `${wssBaseUrl}/${token}/mqtt`;
|
|
2883
2883
|
};
|
|
2884
|
+
const closeCustomUi = () => {
|
|
2885
|
+
window.parent.postMessage("closeCustomUi", "*");
|
|
2886
|
+
};
|
|
2884
2887
|
|
|
2885
2888
|
const defaultContext = {
|
|
2886
2889
|
client: null,
|
|
@@ -2929,19 +2932,6 @@ const MqttProvider = props => {
|
|
|
2929
2932
|
});
|
|
2930
2933
|
};
|
|
2931
2934
|
|
|
2932
|
-
var MqttSandingTopics;
|
|
2933
|
-
(function (MqttSandingTopics) {
|
|
2934
|
-
MqttSandingTopics["SET_APP_STATE"] = "sandingMachineApp/setAppState";
|
|
2935
|
-
MqttSandingTopics["STATION_CALIBRATION_STATE"] = "sandingMachineApp/state/stationCalibration";
|
|
2936
|
-
MqttSandingTopics["STATE_APP"] = "sandingMachineApp/state/app";
|
|
2937
|
-
MqttSandingTopics["STATE_ROBOT"] = "sandingMachineApp/state/robot";
|
|
2938
|
-
MqttSandingTopics["STATE_STATION"] = "sandingMachineApp/state/station";
|
|
2939
|
-
MqttSandingTopics["CHANGE_SANDING_PAPER"] = "sandingMachineApp/state/changeSandingPaper";
|
|
2940
|
-
MqttSandingTopics["SANDING_PAPER_CHANGED"] = "sandingMachineApp/sandingPaperChanged";
|
|
2941
|
-
MqttSandingTopics["GET_INITIAL_STATE"] = "sandingMachineApp/getInitialState";
|
|
2942
|
-
MqttSandingTopics["NOTIFICATION_MESSAGES"] = "sandingMachineApp/notification/messages";
|
|
2943
|
-
})(MqttSandingTopics || (MqttSandingTopics = {}));
|
|
2944
|
-
|
|
2945
2935
|
const useMqttSubscription = props => {
|
|
2946
2936
|
const mqtt = useContext(mqttContext);
|
|
2947
2937
|
const [message, setMessage] = useState();
|
|
@@ -2962,4 +2952,4 @@ const useMqttSubscription = props => {
|
|
|
2962
2952
|
return message;
|
|
2963
2953
|
};
|
|
2964
2954
|
|
|
2965
|
-
export { MqttClient, MqttProvider,
|
|
2955
|
+
export { MqttClient, MqttProvider, VirtualKeyboard, closeCustomUi, connectToMqttAndGetClient, getExecutionEngineHttpUrl, getMachineCodeProcessHttpUrl, getMqttWsUrl, getMqttWsUrlGivenUiIframeUrl, isOnEdge, isTouchScreenDevice, mqttContext, useMqttSubscription };
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export * from "./lib/components/virtual-keyboard/virtual-keyboard";
|
|
|
2
2
|
export * from "./lib/utils/machine-logic-ui-sdk-utils";
|
|
3
3
|
export * from "./lib/mqtt-browser/mqtt-client";
|
|
4
4
|
export * from "./lib/mqtt/mqtt-context";
|
|
5
|
-
export * from "./lib/mqtt/mqtt-types";
|
|
6
5
|
export * from "./lib/mqtt/use-mqtt-subscription";
|
|
6
|
+
export * from "./lib/mqtt/generic-mqtt-mapping";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MqttPayloadByTopic<TMapping extends Record<string, unknown>, T extends keyof TMapping> = TMapping[T];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
topic: TMqttTopic;
|
|
1
|
+
interface Props {
|
|
2
|
+
topic: string;
|
|
4
3
|
}
|
|
5
|
-
export declare const useMqttSubscription: <
|
|
4
|
+
export declare const useMqttSubscription: <TMessage>(props: Props) => TMessage;
|
|
6
5
|
export {};
|
|
@@ -6,3 +6,4 @@ export declare const getMqttWsUrl: () => Promise<string>;
|
|
|
6
6
|
export declare const connectToMqttAndGetClient: () => Promise<MqttClient>;
|
|
7
7
|
export declare const getMachineCodeProcessHttpUrl: (processName: string) => string;
|
|
8
8
|
export declare const getMqttWsUrlGivenUiIframeUrl: (uiIframeUrl: string) => string;
|
|
9
|
+
export declare const closeCustomUi: () => void;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
export declare enum MqttSandingTopics {
|
|
2
|
-
SET_APP_STATE = "sandingMachineApp/setAppState",
|
|
3
|
-
STATION_CALIBRATION_STATE = "sandingMachineApp/state/stationCalibration",
|
|
4
|
-
STATE_APP = "sandingMachineApp/state/app",
|
|
5
|
-
STATE_ROBOT = "sandingMachineApp/state/robot",
|
|
6
|
-
STATE_STATION = "sandingMachineApp/state/station",
|
|
7
|
-
CHANGE_SANDING_PAPER = "sandingMachineApp/state/changeSandingPaper",
|
|
8
|
-
SANDING_PAPER_CHANGED = "sandingMachineApp/sandingPaperChanged",
|
|
9
|
-
GET_INITIAL_STATE = "sandingMachineApp/getInitialState",
|
|
10
|
-
NOTIFICATION_MESSAGES = "sandingMachineApp/notification/messages"
|
|
11
|
-
}
|
|
12
|
-
export type SandingApplicationState = "STOP" | "START" | "HOME" | "FREEDRIVE" | "STOPPING" | "FAULT" | "CALIBRATING_LASER" | "CALIBRATING_STATION";
|
|
13
|
-
export type SandingRobotState = "FAULT" | "READY";
|
|
14
|
-
type MqttSetAppStatePayload = {
|
|
15
|
-
state: SandingApplicationState;
|
|
16
|
-
};
|
|
17
|
-
export type StationCalibrationState = "completed" | "calibrating" | "incomplete";
|
|
18
|
-
export type MqttStationCalibrationStatePayload = {
|
|
19
|
-
station1: StationCalibrationState;
|
|
20
|
-
station2: StationCalibrationState;
|
|
21
|
-
station3: StationCalibrationState;
|
|
22
|
-
station4: StationCalibrationState;
|
|
23
|
-
};
|
|
24
|
-
type MqttRobotStatePayload = {
|
|
25
|
-
state: SandingRobotState;
|
|
26
|
-
};
|
|
27
|
-
export type StationState = {
|
|
28
|
-
completedSteps: number;
|
|
29
|
-
totalSteps: number;
|
|
30
|
-
isActive: boolean;
|
|
31
|
-
status: "waitingForPanel" | "inProgress" | "ready" | "complete";
|
|
32
|
-
isVacuumActivated: boolean;
|
|
33
|
-
isPanelInPlace: boolean;
|
|
34
|
-
};
|
|
35
|
-
export type MqttStationStatePayload = {
|
|
36
|
-
station1: StationState;
|
|
37
|
-
station2: StationState;
|
|
38
|
-
station3: StationState;
|
|
39
|
-
station4: StationState;
|
|
40
|
-
};
|
|
41
|
-
type MqttChangeSandingPaperPayload = object;
|
|
42
|
-
type MqttSandingPaperChangedPayload = object;
|
|
43
|
-
type MqttGetInitialStatePayload = object;
|
|
44
|
-
export type MqttNotificationPayload = {
|
|
45
|
-
id: string;
|
|
46
|
-
message: string;
|
|
47
|
-
type: "info" | "warn" | "error";
|
|
48
|
-
timestamp: number;
|
|
49
|
-
isRead?: boolean;
|
|
50
|
-
};
|
|
51
|
-
type MqttPayloadMapping = {
|
|
52
|
-
[MqttSandingTopics.SET_APP_STATE]: MqttSetAppStatePayload;
|
|
53
|
-
[MqttSandingTopics.STATION_CALIBRATION_STATE]: MqttStationCalibrationStatePayload;
|
|
54
|
-
[MqttSandingTopics.STATE_APP]: MqttSetAppStatePayload;
|
|
55
|
-
[MqttSandingTopics.STATE_ROBOT]: MqttRobotStatePayload;
|
|
56
|
-
[MqttSandingTopics.STATE_STATION]: MqttStationStatePayload;
|
|
57
|
-
[MqttSandingTopics.CHANGE_SANDING_PAPER]: MqttChangeSandingPaperPayload;
|
|
58
|
-
[MqttSandingTopics.SANDING_PAPER_CHANGED]: MqttSandingPaperChangedPayload;
|
|
59
|
-
[MqttSandingTopics.GET_INITIAL_STATE]: MqttGetInitialStatePayload;
|
|
60
|
-
[MqttSandingTopics.NOTIFICATION_MESSAGES]: MqttNotificationPayload;
|
|
61
|
-
};
|
|
62
|
-
export type MqttPayloadByTopic<T extends MqttSandingTopics> = MqttPayloadMapping[T];
|
|
63
|
-
export {};
|