@vention/machine-logic-ui-sdk 0.36.0 → 0.37.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
|
@@ -3528,6 +3528,9 @@ const getMachineCodeProcessHttpUrl = processName => {
|
|
|
3528
3528
|
const executionEngineHttpUrl = getExecutionEngineHttpUrl();
|
|
3529
3529
|
return `${executionEngineHttpUrl}/v1/machineCode/services/${processName}`;
|
|
3530
3530
|
};
|
|
3531
|
+
const getMachineCodeApiBaseUrl = processName => {
|
|
3532
|
+
return `${getMachineCodeProcessHttpUrl(processName)}/api`;
|
|
3533
|
+
};
|
|
3531
3534
|
const getExecutionEngineUrlGivenUiIframeUrl = uiIframeUrl => {
|
|
3532
3535
|
const machineCodeUiIndex = uiIframeUrl.indexOf("/machineCodeUi");
|
|
3533
3536
|
if (machineCodeUiIndex === -1) return uiIframeUrl;
|
|
@@ -4054,9 +4057,10 @@ const MqttProvider = props => {
|
|
|
4054
4057
|
useEffect(function mqttConnection() {
|
|
4055
4058
|
function connectToMqtt() {
|
|
4056
4059
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4057
|
-
var _a;
|
|
4060
|
+
var _a, _b;
|
|
4058
4061
|
console.log("Connecting to MQTT");
|
|
4059
|
-
const
|
|
4062
|
+
const websocketUrl = (_a = props.url) !== null && _a !== void 0 ? _a : yield getMqttWsUrl((_b = props.version) !== null && _b !== void 0 ? _b : defaultProps.version);
|
|
4063
|
+
const client = mqtt.connect(websocketUrl);
|
|
4060
4064
|
client.on("connect", () => {
|
|
4061
4065
|
setConnectionStatus("connected");
|
|
4062
4066
|
console.log("Connected to MQTT");
|
|
@@ -4083,7 +4087,7 @@ const MqttProvider = props => {
|
|
|
4083
4087
|
});
|
|
4084
4088
|
}
|
|
4085
4089
|
connectToMqtt();
|
|
4086
|
-
}, [props.version, subscribedTopics]);
|
|
4090
|
+
}, [props.version, props.url, subscribedTopics]);
|
|
4087
4091
|
return jsx(mqttContext.Provider, {
|
|
4088
4092
|
value: contextValue,
|
|
4089
4093
|
children: props.children
|
|
@@ -4435,4 +4439,4 @@ const useMqttSubscription = props => {
|
|
|
4435
4439
|
return message;
|
|
4436
4440
|
};
|
|
4437
4441
|
|
|
4438
|
-
export { MqttClient, MqttProvider, VirtualKeyboard, closeCustomUi, connectToMqttAndGetClient, getExecutionEngineHttpUrl, getMachineCodeProcessHttpUrl, getMqttWsUrl, getMqttWsUrlGivenUiIframeUrl, isOnEdge, isTouchScreenDevice, mqttContext, navigateControlCenter, useMqttSubscription, useStyles };
|
|
4442
|
+
export { MqttClient, MqttProvider, VirtualKeyboard, closeCustomUi, connectToMqttAndGetClient, getExecutionEngineHttpUrl, getMachineCodeApiBaseUrl, getMachineCodeProcessHttpUrl, getMqttWsUrl, getMqttWsUrlGivenUiIframeUrl, isOnEdge, isTouchScreenDevice, mqttContext, navigateControlCenter, useMqttSubscription, useStyles };
|
package/package.json
CHANGED
|
@@ -11,6 +11,12 @@ export declare const mqttContext: import("react").Context<MqttContext>;
|
|
|
11
11
|
interface Props {
|
|
12
12
|
children: ReactNode;
|
|
13
13
|
version?: "v2" | "v3";
|
|
14
|
+
/**
|
|
15
|
+
* Explicit broker websocket URL. When set, it bypasses the iframe/edge URL
|
|
16
|
+
* detection entirely — use it for standalone dev (e.g. `ws://localhost:9001`)
|
|
17
|
+
* or any context that isn't the MachineCode iframe.
|
|
18
|
+
*/
|
|
19
|
+
url?: string;
|
|
14
20
|
}
|
|
15
21
|
export declare const MqttProvider: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
22
|
export {};
|
|
@@ -5,6 +5,7 @@ export declare const getExecutionEngineHttpUrl: () => string;
|
|
|
5
5
|
export declare const getMqttWsUrl: (version?: "v2" | "v3") => Promise<string>;
|
|
6
6
|
export declare const connectToMqttAndGetClient: () => Promise<MqttClient>;
|
|
7
7
|
export declare const getMachineCodeProcessHttpUrl: (processName: string) => string;
|
|
8
|
+
export declare const getMachineCodeApiBaseUrl: (processName: string) => string;
|
|
8
9
|
export declare const getMqttWsUrlGivenUiIframeUrl: (uiIframeUrl: string) => string;
|
|
9
10
|
export declare const closeCustomUi: () => void;
|
|
10
11
|
export declare const navigateControlCenter: (route: "remoteSupport" | "controlCenterHomepage") => void;
|