@robotical/webapp-types 3.15.16 → 3.15.18
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/src/application/ApplicationManager/ApplicationManager.js +44 -39
- package/dist-types/src/components/modals/ConnectingLoadingSpinnerModal/index.js +1 -1
- package/dist-types/src/components/modals/LEDLightsOrQRVerificationModal/index.d.ts +7 -1
- package/dist-types/src/components/modals/LEDLightsOrQRVerificationModal/index.js +20 -24
- package/dist-types/src/i18n.js +16 -5
- package/dist-types/src/types/connection-flow.d.ts +12 -0
- package/dist-types/src/types/connection-flow.js +1 -0
- package/package.json +1 -1
|
@@ -408,26 +408,31 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
408
408
|
ApplicationManager.prototype.connectGeneric = function (afterRaftConnectedCb, uuids, shouldShowQrModal) {
|
|
409
409
|
if (shouldShowQrModal === void 0) { shouldShowQrModal = true; }
|
|
410
410
|
return __awaiter(this, void 0, void 0, function () {
|
|
411
|
-
var
|
|
411
|
+
var verificationMethod, isQRVerification, e_1, newRaft, e_2;
|
|
412
412
|
var _this = this;
|
|
413
413
|
return __generator(this, function (_a) {
|
|
414
414
|
switch (_a.label) {
|
|
415
415
|
case 0:
|
|
416
|
+
verificationMethod = { action: "led" };
|
|
416
417
|
if (!shouldShowQrModal) return [3 /*break*/, 2];
|
|
417
|
-
return [4 /*yield*/, modalState.setModal(createElement(LEDLightsOrQRVerificationModal
|
|
418
|
+
return [4 /*yield*/, modalState.setModal(createElement(LEDLightsOrQRVerificationModal, {
|
|
419
|
+
targetRaftType: RaftTypeE.COG,
|
|
420
|
+
allowSwitchToMarty: true,
|
|
421
|
+
}), i18n.t("connection.verification_method"))];
|
|
418
422
|
case 1:
|
|
419
|
-
|
|
420
|
-
|
|
423
|
+
verificationMethod =
|
|
424
|
+
(_a.sent()) || { action: "cancel" };
|
|
425
|
+
_a.label = 2;
|
|
421
426
|
case 2:
|
|
422
|
-
|
|
423
|
-
_a.label = 3;
|
|
424
|
-
case 3:
|
|
425
|
-
isQRVerification = false;
|
|
426
|
-
if (specificUUIDs === false) {
|
|
427
|
+
if (!verificationMethod || verificationMethod.action === "cancel") {
|
|
427
428
|
return [2 /*return*/];
|
|
428
429
|
}
|
|
429
|
-
if (
|
|
430
|
-
|
|
430
|
+
if (verificationMethod.action === "switch-to-marty") {
|
|
431
|
+
return [2 /*return*/, this.connectGenericMarty(afterRaftConnectedCb)];
|
|
432
|
+
}
|
|
433
|
+
isQRVerification = false;
|
|
434
|
+
if (verificationMethod.action === "qr") {
|
|
435
|
+
uuids = verificationMethod.uuids;
|
|
431
436
|
isQRVerification = true;
|
|
432
437
|
}
|
|
433
438
|
else {
|
|
@@ -435,52 +440,52 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
435
440
|
uuids = [ConnManager.COGUUID, ConnManager.RICUUID];
|
|
436
441
|
}
|
|
437
442
|
}
|
|
438
|
-
if (!isPhoneApp()) return [3 /*break*/,
|
|
443
|
+
if (!isPhoneApp()) return [3 /*break*/, 10];
|
|
439
444
|
this.lastUUIDsUsed = uuids; // Store the last used UUIDs so when the user presses "Scan Again" in the phone app connection modal, we can use them to start discovery again
|
|
440
|
-
_a.label =
|
|
441
|
-
case
|
|
442
|
-
_a.trys.push([
|
|
443
|
-
if (!isQRVerification) return [3 /*break*/,
|
|
445
|
+
_a.label = 3;
|
|
446
|
+
case 3:
|
|
447
|
+
_a.trys.push([3, 8, , 9]);
|
|
448
|
+
if (!isQRVerification) return [3 /*break*/, 5];
|
|
444
449
|
secondaryModalState.setModal(createElement(ConnectingLoadingSpinnerModal, {}), i18n.t("connection.connecting_msg"), false);
|
|
445
450
|
this.ricSelectedCb = null;
|
|
446
451
|
return [4 /*yield*/, window.applicationManager.startDiscoveryWithoutVerification(uuids, afterRaftConnectedCb)];
|
|
447
|
-
case
|
|
452
|
+
case 4:
|
|
448
453
|
_a.sent();
|
|
449
|
-
return [3 /*break*/,
|
|
450
|
-
case
|
|
454
|
+
return [3 /*break*/, 7];
|
|
455
|
+
case 5: return [4 /*yield*/, window.applicationManager.startDiscovery(function (newRaft) {
|
|
451
456
|
_this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
|
|
452
457
|
afterRaftConnectedCb(newRaft);
|
|
453
458
|
}, uuids)];
|
|
454
|
-
case
|
|
459
|
+
case 6:
|
|
455
460
|
_a.sent();
|
|
456
|
-
_a.label =
|
|
457
|
-
case
|
|
458
|
-
case
|
|
461
|
+
_a.label = 7;
|
|
462
|
+
case 7: return [3 /*break*/, 9];
|
|
463
|
+
case 8:
|
|
459
464
|
e_1 = _a.sent();
|
|
460
465
|
Logger.error(SHOW_LOGS, TAG, "Failed to start discovery: ".concat(e_1));
|
|
461
|
-
return [3 /*break*/,
|
|
462
|
-
case
|
|
463
|
-
case
|
|
466
|
+
return [3 /*break*/, 9];
|
|
467
|
+
case 9: return [3 /*break*/, 15];
|
|
468
|
+
case 10:
|
|
464
469
|
secondaryModalState.setModal(createElement(ConnectingLoadingSpinnerModal, {}), i18n.t("connection.connecting_msg"), false);
|
|
465
|
-
_a.label =
|
|
466
|
-
case
|
|
467
|
-
_a.trys.push([
|
|
470
|
+
_a.label = 11;
|
|
471
|
+
case 11:
|
|
472
|
+
_a.trys.push([11, 13, , 14]);
|
|
468
473
|
return [4 /*yield*/, window.applicationManager.connectToRIC(RaftConnectionMethod.WEB_BLE, uuids, isQRVerification)];
|
|
469
|
-
case
|
|
474
|
+
case 12:
|
|
470
475
|
newRaft = _a.sent();
|
|
471
476
|
if (newRaft) {
|
|
472
477
|
this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
|
|
473
478
|
afterRaftConnectedCb(newRaft);
|
|
474
479
|
}
|
|
475
|
-
return [3 /*break*/,
|
|
476
|
-
case
|
|
480
|
+
return [3 /*break*/, 14];
|
|
481
|
+
case 13:
|
|
477
482
|
e_2 = _a.sent();
|
|
478
483
|
Logger.error(SHOW_LOGS, TAG, "Failed to connect to new robot: ".concat(e_2));
|
|
479
|
-
return [3 /*break*/,
|
|
480
|
-
case
|
|
481
|
-
secondaryModalState.
|
|
482
|
-
_a.label =
|
|
483
|
-
case
|
|
484
|
+
return [3 /*break*/, 14];
|
|
485
|
+
case 14:
|
|
486
|
+
secondaryModalState.closeModalWithoutAnimation();
|
|
487
|
+
_a.label = 15;
|
|
488
|
+
case 15: return [2 /*return*/];
|
|
484
489
|
}
|
|
485
490
|
});
|
|
486
491
|
});
|
|
@@ -749,7 +754,7 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
749
754
|
_this.toaster.error("Make sure the robot is powered on and in range!");
|
|
750
755
|
}
|
|
751
756
|
window.applicationManager.stopDiscovery();
|
|
752
|
-
secondaryModalState.
|
|
757
|
+
secondaryModalState.closeModalWithoutAnimation();
|
|
753
758
|
raftFoundSubscriptionHelper().unsubscribe();
|
|
754
759
|
clearTimeout(notFoundTimeout);
|
|
755
760
|
}, 7000);
|
|
@@ -770,7 +775,7 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
770
775
|
case 1:
|
|
771
776
|
newRaft = _b.sent();
|
|
772
777
|
if (!newRaft) return [3 /*break*/, 6];
|
|
773
|
-
secondaryModalState.
|
|
778
|
+
secondaryModalState.closeModalWithoutAnimation();
|
|
774
779
|
this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
|
|
775
780
|
afterRaftConnectedCb(newRaft);
|
|
776
781
|
oldColours = newRaft._ledLcdColours;
|
|
@@ -19,7 +19,7 @@ export default function ConnectingLoadingSpinnerModal(_a) {
|
|
|
19
19
|
useEffect(function () {
|
|
20
20
|
// close modal after 3 minutes assuming no connection will take that long
|
|
21
21
|
setTimeout(function () {
|
|
22
|
-
secondaryModalState.
|
|
22
|
+
secondaryModalState.closeModalWithoutAnimation();
|
|
23
23
|
}, 180000);
|
|
24
24
|
}, []);
|
|
25
25
|
return (_jsx("div", __assign({ className: styles.container }, { children: t("connection.connecting_loading") })));
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { RaftTypeE } from "../../../types/raft";
|
|
2
|
+
type Props = {
|
|
3
|
+
targetRaftType: RaftTypeE.COG;
|
|
4
|
+
allowSwitchToMarty?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export default function LEDLightsOrQRVerificationModal({ targetRaftType, allowSwitchToMarty, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -57,20 +57,15 @@ import { MAIN_BLUE } from "../../../styles/colors";
|
|
|
57
57
|
import { Scanner, centerText } from '@yudiel/react-qr-scanner';
|
|
58
58
|
import { ConnManager } from "@robotical/roboticaljs";
|
|
59
59
|
import { useTranslation } from "react-i18next";
|
|
60
|
-
export default function LEDLightsOrQRVerificationModal() {
|
|
60
|
+
export default function LEDLightsOrQRVerificationModal(_a) {
|
|
61
61
|
var _this = this;
|
|
62
|
+
var targetRaftType = _a.targetRaftType, _b = _a.allowSwitchToMarty, allowSwitchToMarty = _b === void 0 ? false : _b;
|
|
62
63
|
var t = useTranslation().t;
|
|
63
|
-
var
|
|
64
|
-
var
|
|
65
|
-
var
|
|
64
|
+
var _c = useState(true), qrSelected = _c[0], setQRSelected = _c[1];
|
|
65
|
+
var _d = useState(undefined), serialNoFromQR = _d[0], setSerialNoFromQR = _d[1];
|
|
66
|
+
var _e = useState(false), isButtonToConnectVisible = _e[0], setIsButtonToConnectVisible = _e[1];
|
|
66
67
|
useEffect(function () {
|
|
67
68
|
if (serialNoFromQR) {
|
|
68
|
-
// 00000000202502200000000000000239
|
|
69
|
-
console.log("serialNoFromQR", serialNoFromQR);
|
|
70
|
-
console.log("ConnManager.generateServiceFilterUUID(serialNoFromQR)", ConnManager.generateServiceFilterUUID(serialNoFromQR));
|
|
71
|
-
var dd = ConnManager;
|
|
72
|
-
// modalState.closeModalWithoutAnimation([ConnManager.generateServiceFilterUUID(serialNoFromQR)]);
|
|
73
|
-
// modalState.closeModalWithoutAnimation([ConnManager.generateServiceFilterUUID('00000000202302111d28b4dc5f0d46d5')]);
|
|
74
69
|
setIsButtonToConnectVisible(true);
|
|
75
70
|
setQRSelected(false);
|
|
76
71
|
}
|
|
@@ -92,31 +87,32 @@ export default function LEDLightsOrQRVerificationModal() {
|
|
|
92
87
|
var handleSelect = function (id) {
|
|
93
88
|
if (id === 'qr') {
|
|
94
89
|
setSerialNoFromQR(undefined);
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
setIsButtonToConnectVisible(false);
|
|
91
|
+
setQRSelected(true);
|
|
97
92
|
}
|
|
98
93
|
else {
|
|
99
|
-
|
|
100
|
-
modalState.closeModalWithoutAnimation(
|
|
94
|
+
var result = { action: "led" };
|
|
95
|
+
modalState.closeModalWithoutAnimation(result);
|
|
101
96
|
}
|
|
102
97
|
};
|
|
103
98
|
var handleConnect = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
99
|
+
var result;
|
|
104
100
|
return __generator(this, function (_a) {
|
|
105
101
|
if (serialNoFromQR) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
result = {
|
|
103
|
+
action: "qr",
|
|
104
|
+
uuids: [ConnManager.generateServiceFilterUUID(serialNoFromQR)],
|
|
105
|
+
};
|
|
106
|
+
modalState.closeModalWithoutAnimation(result);
|
|
111
107
|
}
|
|
112
108
|
return [2 /*return*/];
|
|
113
109
|
});
|
|
114
110
|
}); };
|
|
115
|
-
return (_jsxs("div", __assign({ className: styles.container }, { children: [_jsxs("div", __assign({ className: styles.bluetoothNotice }, { children: [_jsx(BluetoothSVG, { className: styles.bluetoothIcon, fill: MAIN_BLUE, "aria-hidden": "true", focusable: "false" }), _jsx("span", __assign({ className: styles.bluetoothText }, { children: t("configuration_screen.bluetooth") }))] })), !isButtonToConnectVisible ? _jsx("div", __assign({ className: styles.cards }, { children: options.map(function (_a) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
return (_jsxs("div", __assign({ className: styles.container }, { children: [_jsxs("div", __assign({ className: styles.robotContext }, { children: [_jsx("p", __assign({ className: styles.robotContextEyebrow }, { children: t("connection.connecting_to", "Connecting to") })), _jsx("h3", __assign({ className: styles.robotContextTitle }, { children: targetRaftType })), allowSwitchToMarty && (_jsx("button", __assign({ type: "button", className: styles.switchRobotButton, onClick: function () { return modalState.closeModal({ action: "switch-to-marty" }); } }, { children: t("connection.connect_marty_instead", "Connect Marty instead") })))] })), _jsxs("div", __assign({ className: styles.bluetoothNotice }, { children: [_jsx(BluetoothSVG, { className: styles.bluetoothIcon, fill: MAIN_BLUE, "aria-hidden": "true", focusable: "false" }), _jsx("span", __assign({ className: styles.bluetoothText }, { children: t("configuration_screen.bluetooth") }))] })), _jsxs("div", { children: [_jsx("p", __assign({ className: styles.robotContextSubtitle }, { children: t("connection.cog_verification_prompt", "Choose how you want to verify your Cog connection.") })), !isButtonToConnectVisible ? _jsx("div", __assign({ className: styles.cards }, { children: options.map(function (_a) {
|
|
112
|
+
var id = _a.id, title = _a.title, subtitle = _a.subtitle, icon = _a.icon;
|
|
113
|
+
return (_jsxs("div", __assign({ className: qrSelected && id === 'qr' ? [styles.card, styles.qrselected].join(" ") : styles.card, onClick: function () { return handleSelect(id); } }, { children: [_jsx("div", __assign({ className: styles.icon }, { children: icon })), _jsx("h3", __assign({ className: styles.title }, { children: title })), _jsx("p", __assign({ className: styles.subtitle }, { children: subtitle }))] }), id));
|
|
114
|
+
}) })) :
|
|
115
|
+
_jsx("div", __assign({ className: styles.cogNote }, { children: _jsxs("strong", { children: ["Don't forget to ", _jsx("span", __assign({ className: styles.cogNoteHighlight }, { children: "turn on" })), " your Cog!"] }) }))] }), qrSelected && _jsx(QRContent, { setSerialNo: setSerialNoFromQR }), _jsxs("div", __assign({ className: styles.buttonsContainer }, { children: [isButtonToConnectVisible && _jsx("button", __assign({ className: styles.connectButton, onClick: handleConnect }, { children: t('connection.qr_connect_button') })), _jsx("button", __assign({ className: styles.cancelButton, onClick: function () { return modalState.closeModal({ action: "cancel" }); } }, { children: t('connection.cancel') }))] }))] })));
|
|
120
116
|
}
|
|
121
117
|
function QRContent(_a) {
|
|
122
118
|
var _this = this;
|
package/dist-types/src/i18n.js
CHANGED
|
@@ -225,6 +225,17 @@ var resources = {
|
|
|
225
225
|
"unplugged_modal_body": "Your Marty is currently in unplugged mode. If you want to dissconect Marty from unplugged mode, please press the \"MODE\"/\"A\" button on the back of Marty and try again!",
|
|
226
226
|
"unplugged_modal_button": "Got it!",
|
|
227
227
|
"cancel": "Cancel",
|
|
228
|
+
"choose_robot_cta": "Choose robot to connect",
|
|
229
|
+
"choose_robot_prompt": "Choose the robot you want to connect.",
|
|
230
|
+
"choose_robot_title": "Choose a Robot",
|
|
231
|
+
"cog_verification_prompt": "Choose how you want to verify your Cog connection.",
|
|
232
|
+
"connect_another_robot": "Connect another robot",
|
|
233
|
+
"connect_cog": "Connect Cog",
|
|
234
|
+
"connect_cog_subtitle": "Choose Bluetooth verification with LED lights or QR.",
|
|
235
|
+
"connect_marty": "Connect Marty",
|
|
236
|
+
"connect_marty_instead": "Connect Marty instead",
|
|
237
|
+
"connect_marty_subtitle": "Connect using Bluetooth.",
|
|
238
|
+
"connecting_to": "Connecting to",
|
|
228
239
|
"connecting_loading": "This shouldn't take long!",
|
|
229
240
|
"connecting_msg": "Connecting...",
|
|
230
241
|
"led_subtitle": "Check LED signals for verification.",
|
|
@@ -308,12 +319,12 @@ var resources = {
|
|
|
308
319
|
"blocks": "Blocks",
|
|
309
320
|
"blocksJr": "Blocks Jr",
|
|
310
321
|
"controller": "Marty Controller",
|
|
311
|
-
"games": "Games",
|
|
322
|
+
"games": "Cog Games",
|
|
312
323
|
"sensors": "Sensor Dashboard"
|
|
313
324
|
},
|
|
314
325
|
"nav": {
|
|
315
326
|
"activities": "Activities",
|
|
316
|
-
"games": "Games",
|
|
327
|
+
"games": "Cog Games",
|
|
317
328
|
"home": "Home",
|
|
318
329
|
"not_connected_robot_msg_for_configuration_page": "Oops! It looks like you’re not connected to a robot. Connect to a robot via bluetooth to access the configuration page"
|
|
319
330
|
},
|
|
@@ -1097,7 +1108,7 @@ var resources = {
|
|
|
1097
1108
|
},
|
|
1098
1109
|
"nav": {
|
|
1099
1110
|
"activities": "Activiteiten",
|
|
1100
|
-
"games": "Games",
|
|
1111
|
+
"games": "Cog Games",
|
|
1101
1112
|
"home": "Thuis",
|
|
1102
1113
|
"not_connected_robot_msg_for_configuration_page": "Oeps! Het lijkt erop dat je niet verbonden bent met een robot. Maak verbinding met een robot om toegang te krijgen tot de configuratiepagina"
|
|
1103
1114
|
},
|
|
@@ -1484,12 +1495,12 @@ var resources = {
|
|
|
1484
1495
|
"blocks": "Blocchi",
|
|
1485
1496
|
"blocksJr": "Blocchi Jr.",
|
|
1486
1497
|
"controller": "Marty Controller",
|
|
1487
|
-
"games": "Giochi",
|
|
1498
|
+
"games": "Cog Giochi",
|
|
1488
1499
|
"sensors": "Pannello di controllo del sensore"
|
|
1489
1500
|
},
|
|
1490
1501
|
"nav": {
|
|
1491
1502
|
"activities": "Attività",
|
|
1492
|
-
"games": "Giochi",
|
|
1503
|
+
"games": "Cog Giochi",
|
|
1493
1504
|
"home": "Casa",
|
|
1494
1505
|
"not_connected_robot_msg_for_configuration_page": "Oops! Sembra che tu non sia connesso a un robot. Connettiti a un robot per accedere alla pagina di configurazione."
|
|
1495
1506
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RaftTypeE } from "./raft";
|
|
2
|
+
export type RobotSelectionModalResult = RaftTypeE.MARTY | RaftTypeE.COG | false;
|
|
3
|
+
export type CogVerificationModalResult = {
|
|
4
|
+
action: "cancel";
|
|
5
|
+
} | {
|
|
6
|
+
action: "led";
|
|
7
|
+
} | {
|
|
8
|
+
action: "qr";
|
|
9
|
+
uuids: string[];
|
|
10
|
+
} | {
|
|
11
|
+
action: "switch-to-marty";
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|