@vention/machine-logic-ui-sdk 0.20.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, MqttSandingTopics, VirtualKeyboard, connectToMqttAndGetClient, getExecutionEngineHttpUrl, getMachineCodeProcessHttpUrl, getMqttWsUrl, getMqttWsUrlGivenUiIframeUrl, isOnEdge, isTouchScreenDevice, mqttContext, useMqttSubscription };
2955
+ export { MqttClient, MqttProvider, VirtualKeyboard, closeCustomUi, connectToMqttAndGetClient, getExecutionEngineHttpUrl, getMachineCodeProcessHttpUrl, getMqttWsUrl, getMqttWsUrlGivenUiIframeUrl, isOnEdge, isTouchScreenDevice, mqttContext, useMqttSubscription };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-logic-ui-sdk",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/VentionCo/machine-cloud.git"
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
- import { MqttSandingTopics, MqttPayloadByTopic } from "./mqtt-types";
2
- interface Props<TMqttTopic> {
3
- topic: TMqttTopic;
1
+ interface Props {
2
+ topic: string;
4
3
  }
5
- export declare const useMqttSubscription: <TMqttTopic extends MqttSandingTopics>(props: Props<TMqttTopic>) => MqttPayloadByTopic<TMqttTopic>;
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,64 +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
- data?: unknown;
17
- };
18
- export type StationCalibrationState = "completed" | "calibrating" | "incomplete";
19
- export type MqttStationCalibrationStatePayload = {
20
- station1: StationCalibrationState;
21
- station2: StationCalibrationState;
22
- station3: StationCalibrationState;
23
- station4: StationCalibrationState;
24
- };
25
- type MqttRobotStatePayload = {
26
- state: SandingRobotState;
27
- };
28
- export type StationState = {
29
- completedSteps: number;
30
- totalSteps: number;
31
- isActive: boolean;
32
- status: "waitingForPanel" | "inProgress" | "ready" | "complete";
33
- isVacuumActivated: boolean;
34
- isPanelInPlace: boolean;
35
- };
36
- export type MqttStationStatePayload = {
37
- station1: StationState;
38
- station2: StationState;
39
- station3: StationState;
40
- station4: StationState;
41
- };
42
- type MqttChangeSandingPaperPayload = object;
43
- type MqttSandingPaperChangedPayload = object;
44
- type MqttGetInitialStatePayload = object;
45
- export type MqttNotificationPayload = {
46
- id: string;
47
- message: string;
48
- type: "info" | "warn" | "error";
49
- timestamp: number;
50
- isRead?: boolean;
51
- };
52
- type MqttPayloadMapping = {
53
- [MqttSandingTopics.SET_APP_STATE]: MqttSetAppStatePayload;
54
- [MqttSandingTopics.STATION_CALIBRATION_STATE]: MqttStationCalibrationStatePayload;
55
- [MqttSandingTopics.STATE_APP]: MqttSetAppStatePayload;
56
- [MqttSandingTopics.STATE_ROBOT]: MqttRobotStatePayload;
57
- [MqttSandingTopics.STATE_STATION]: MqttStationStatePayload;
58
- [MqttSandingTopics.CHANGE_SANDING_PAPER]: MqttChangeSandingPaperPayload;
59
- [MqttSandingTopics.SANDING_PAPER_CHANGED]: MqttSandingPaperChangedPayload;
60
- [MqttSandingTopics.GET_INITIAL_STATE]: MqttGetInitialStatePayload;
61
- [MqttSandingTopics.NOTIFICATION_MESSAGES]: MqttNotificationPayload;
62
- };
63
- export type MqttPayloadByTopic<T extends MqttSandingTopics> = MqttPayloadMapping[T];
64
- export {};