@attraccess/plugin-shelly 0.1.0-nightly.1166.1 → 0.1.0-nightly.1188.1

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/LICENSE.md ADDED
@@ -0,0 +1,14 @@
1
+ # Lizenz von @attraccess/plugin-shelly
2
+
3
+ Copyright (c) 2025 Jan Jaap (Github: JappyJan, E-Mail: mail@janjaap.de)
4
+ Project: Attraccess
5
+
6
+ Dieses Plugin hat keine eigene Lizenz. Es steht unter der Lizenz des Attraccess-Kerns, der **Prosperity Public License 3.0 – Modified Version**. Der vollständige Text steht in der Datei [LICENSE.md im Repository-Stamm](https://github.com/Attraccess/Attraccess/blob/main/LICENSE.md).
7
+
8
+ Kurz zusammengefasst (maßgeblich ist allein der Text der Kernlizenz):
9
+
10
+ - Kostenlos für Privatpersonen und gemeinnützige Organisationen, für nicht-kommerzielle Zwecke.
11
+ - Kommerzielle Nutzer dürfen 30 Tage kostenlos evaluieren, danach ist eine kommerzielle Lizenz erforderlich.
12
+ - Forks und abgeleitete Werke nur unter exakt denselben Lizenzbedingungen.
13
+
14
+ Für kommerzielle Lizenzen: [contact@attraccess.org](mailto:contact@attraccess.org)
package/dist/index.js CHANGED
@@ -9793,7 +9793,7 @@ var ShellyProbeService = class {
9793
9793
  json = await res.json();
9794
9794
  } catch (err) {
9795
9795
  const reason = err instanceof Error ? err.message : String(err);
9796
- throw new Error(`probe of ${url} failed: ${reason}`);
9796
+ throw new Error(`probe of ${url} failed: ${reason}`, { cause: err });
9797
9797
  }
9798
9798
  return this.interpret(json);
9799
9799
  }
@@ -1,8 +1,7 @@
1
- import { r as importShared } from "./_virtual___federation_fn_import-BXODRNto.js";
2
- //#region \0rolldown/runtime.js
3
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4
- //#endregion
5
- //#region ../../../libs/plugins-frontend-sdk/src/lib/frontend.api-client.ts
1
+ import { r as importShared } from "./_virtual___federation_fn_import-D2E5es2p.js";
2
+ // \0rolldown/runtime.js
3
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
4
+ // ../../../libs/plugins-frontend-sdk/src/lib/frontend.api-client.ts
6
5
  var BASE_URL_GLOBAL = "__ATTRACCESS_API_BASE_URL__";
7
6
  /** The API origin the host is talking to. Falls back to the current origin. */
8
7
  function getApiBaseUrl() {
@@ -61,8 +60,9 @@ function createPluginApiClient(basePath = "") {
61
60
  }
62
61
  };
63
62
  }
64
- //#endregion
65
- //#region ../../../node_modules/.pnpm/react@19.2.8/node_modules/react/cjs/react-jsx-runtime.production.js
63
+ // ../../../libs/plugins-frontend-sdk/src/lib/frontend.license.ts
64
+ var { useCallback: useCallback$7, useEffect: useEffect$5, useState: useState$6 } = await importShared("react");
65
+ // ../../../node_modules/.pnpm/react@19.3.1/node_modules/react/cjs/react-jsx-runtime.production.js
66
66
  /**
67
67
  * @license React
68
68
  * react-jsx-runtime.production.js
@@ -94,8 +94,7 @@ var require_react_jsx_runtime_production = /* @__PURE__ */ __commonJSMin(((expor
94
94
  exports.jsx = jsxProd;
95
95
  exports.jsxs = jsxProd;
96
96
  }));
97
- //#endregion
98
- //#region ../../../libs/plugins-frontend-sdk/src/lib/frontend.live-updates.tsx
97
+ // ../../../libs/plugins-frontend-sdk/src/lib/frontend.live-updates.tsx
99
98
  var import_jsx_runtime = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
100
99
  module.exports = require_react_jsx_runtime_production();
101
100
  })))();
@@ -154,14 +153,11 @@ function usePluginLiveUpdates(props) {
154
153
  ]);
155
154
  return { abort: useCallback$6(() => unsubscribe.current?.(), []) };
156
155
  }
157
- //#endregion
158
- //#region ../../../libs/plugins-frontend-sdk/src/lib/frontend.standard-drawer.tsx
156
+ // ../../../libs/plugins-frontend-sdk/src/lib/frontend.standard-drawer.tsx
159
157
  var { StandardDrawer: SharedStandardDrawer } = await importShared("@attraccess/plugins-frontend-ui");
160
- //#endregion
161
- //#region ../../../libs/plugins-frontend-sdk/src/lib/frontend.standard-modal.tsx
158
+ // ../../../libs/plugins-frontend-sdk/src/lib/frontend.standard-modal.tsx
162
159
  var { StandardModal: SharedStandardModal } = await importShared("@attraccess/plugins-frontend-ui");
163
- //#endregion
164
- //#region frontend/src/api.ts
160
+ // frontend/src/api.ts
165
161
  var api = createPluginApiClient("/api/shelly");
166
162
  function listDevices() {
167
163
  return api.request("/devices");
@@ -218,8 +214,7 @@ function discoverDevices(input = {}) {
218
214
  body: input
219
215
  });
220
216
  }
221
- //#endregion
222
- //#region frontend/src/shared/drawer.tsx
217
+ // frontend/src/shared/TextFieldRow.tsx
223
218
  var { Input, Label, TextField } = await importShared("@heroui/react");
224
219
  function TextFieldRow({ label, value, onChange, placeholder, required, description, dataCy }) {
225
220
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TextField, {
@@ -500,19 +495,17 @@ var de_default = {
500
495
  "refresh": "Aktualisieren"
501
496
  }
502
497
  };
503
- //#endregion
504
- //#region frontend/src/i18n.ts
498
+ // frontend/src/i18n.ts
505
499
  var { useTranslations } = await importShared("@attraccess/plugins-frontend-ui");
506
500
  var useShellyTranslations = () => useTranslations({
507
501
  en: en_default,
508
502
  de: de_default
509
503
  }, { escapeValues: false });
510
- //#endregion
511
- //#region frontend/src/devices/AddDeviceDrawer.tsx
504
+ // frontend/src/devices/AddDeviceDrawer.tsx
512
505
  var { DrawerBody: DrawerBody$4, DrawerHeader: DrawerHeader$4, DrawerHeading: DrawerHeading$4, Form: Form$3 } = await importShared("@heroui/react");
513
- var { PlusIcon: PlusIcon$1, XIcon: XIcon$4 } = await importShared("lucide-react");
506
+ var { PlusIcon: PlusIcon$2, XIcon: XIcon$4 } = await importShared("lucide-react");
514
507
  var { useCallback: useCallback$5, useRef: useRef$2, useState: useState$5 } = await importShared("react");
515
- var { Button: Button$6, StandardDrawer: StandardDrawer$4, StatusAlert: StatusAlert$5 } = await importShared("@attraccess/plugins-frontend-ui");
508
+ var { Button: Button$9, StandardDrawer: StandardDrawer$4, StatusAlert: StatusAlert$5 } = await importShared("@attraccess/plugins-frontend-ui");
516
509
  function AddDeviceDrawer({ isOpen, onOpenChange, onAdded }) {
517
510
  const { t, tMessage } = useShellyTranslations();
518
511
  const [ipAddress, setIpAddress] = useState$5("");
@@ -566,7 +559,7 @@ function AddDeviceDrawer({ isOpen, onOpenChange, onAdded }) {
566
559
  className: "sh:text-sm sh:text-muted",
567
560
  children: t("add.description")
568
561
  })]
569
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$6, {
562
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$9, {
570
563
  isIconOnly: true,
571
564
  variant: "ghost",
572
565
  "aria-label": t("common.close"),
@@ -600,18 +593,18 @@ function AddDeviceDrawer({ isOpen, onOpenChange, onAdded }) {
600
593
  }),
601
594
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
602
595
  className: "sh:flex sh:justify-end sh:gap-2 sh:pt-2",
603
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$6, {
596
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$9, {
604
597
  variant: "secondary",
605
598
  onPress: close,
606
599
  children: t("common.cancel")
607
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$6, {
600
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$9, {
608
601
  variant: "primary",
609
602
  type: "submit",
610
603
  isPending: submitting,
611
604
  onPress: submit,
612
605
  "data-cy": "shelly-add-submit",
613
606
  children: [
614
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlusIcon$1, { className: "sh:h-4 sh:w-4" }),
607
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlusIcon$2, { className: "sh:h-4 sh:w-4" }),
615
608
  " ",
616
609
  t("devices.add")
617
610
  ]
@@ -625,12 +618,11 @@ function AddDeviceDrawer({ isOpen, onOpenChange, onAdded }) {
625
618
  }) })]
626
619
  });
627
620
  }
628
- //#endregion
629
- //#region frontend/src/AdminPasswordDrawer.tsx
621
+ // frontend/src/AdminPasswordDrawer.tsx
630
622
  var { DrawerBody: DrawerBody$3, DrawerFooter: DrawerFooter$2, DrawerHeader: DrawerHeader$3, DrawerHeading: DrawerHeading$3, Form: Form$2 } = await importShared("@heroui/react");
631
623
  var { KeyRoundIcon: KeyRoundIcon$1, XIcon: XIcon$3 } = await importShared("lucide-react");
632
624
  var { useCallback: useCallback$4, useEffect: useEffect$3, useState: useState$4 } = await importShared("react");
633
- var { Button: Button$5, PasswordInput: PasswordInput$2, StandardDrawer: StandardDrawer$3, StatusAlert: StatusAlert$4 } = await importShared("@attraccess/plugins-frontend-ui");
625
+ var { Button: Button$8, PasswordInput: PasswordInput$2, StandardDrawer: StandardDrawer$3, StatusAlert: StatusAlert$4 } = await importShared("@attraccess/plugins-frontend-ui");
634
626
  function AdminPasswordDrawer({ device, onOpenChange, onSaved }) {
635
627
  const { t, tMessage } = useShellyTranslations();
636
628
  const [currentPassword, setCurrentPassword] = useState$4("");
@@ -698,7 +690,7 @@ function AdminPasswordDrawer({ device, onOpenChange, onSaved }) {
698
690
  address: device.ipAddress
699
691
  })
700
692
  })]
701
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$5, {
693
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$8, {
702
694
  isIconOnly: true,
703
695
  variant: "ghost",
704
696
  "aria-label": t("common.close"),
@@ -739,11 +731,11 @@ function AdminPasswordDrawer({ device, onOpenChange, onSaved }) {
739
731
  })
740
732
  ]
741
733
  }) }),
742
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DrawerFooter$2, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$5, {
734
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DrawerFooter$2, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$8, {
743
735
  variant: "secondary",
744
736
  onPress: close,
745
737
  children: t("common.cancel")
746
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$5, {
738
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$8, {
747
739
  variant: "primary",
748
740
  isPending: submitting,
749
741
  onPress: () => void submit(),
@@ -757,12 +749,53 @@ function AdminPasswordDrawer({ device, onOpenChange, onSaved }) {
757
749
  ]
758
750
  });
759
751
  }
760
- //#endregion
761
- //#region frontend/src/devices/info/DeviceInfoDrawer.tsx
762
- var { Button: Button$4, PasswordInput: PasswordInput$1, StandardDrawer: StandardDrawer$2, StatusAlert: StatusAlert$3, useDateTimeFormatter: useDateTimeFormatter$1 } = await importShared("@attraccess/plugins-frontend-ui");
763
- var { Card, DrawerBody: DrawerBody$2, DrawerFooter: DrawerFooter$1, DrawerHeader: DrawerHeader$2, DrawerHeading: DrawerHeading$2, Form: Form$1, Skeleton } = await importShared("@heroui/react");
764
- var { InfoIcon: InfoIcon$1, RefreshCwIcon: RefreshCwIcon$2, XIcon: XIcon$2 } = await importShared("lucide-react");
765
- var { useCallback: useCallback$3, useEffect: useEffect$2, useState: useState$3 } = await importShared("react");
752
+ // frontend/src/devices/info/AuthProtectedForm.tsx
753
+ var { Button: Button$7, PasswordInput: PasswordInput$1 } = await importShared("@attraccess/plugins-frontend-ui");
754
+ var { Form: Form$1 } = await importShared("@heroui/react");
755
+ function AuthProtectedForm({ authState, currentPassword, onChange, loading, onLoad }) {
756
+ const { t } = useShellyTranslations();
757
+ if (authState !== "required") return null;
758
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
759
+ className: "sh:rounded-md sh:border-l-4 sh:border-l-warning sh:bg-warning/5 sh:p-4",
760
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Form$1, {
761
+ onSubmit: (e) => {
762
+ e.preventDefault();
763
+ onLoad();
764
+ },
765
+ className: "sh:flex sh:flex-col sh:gap-3",
766
+ children: [
767
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
768
+ className: "sh:text-sm",
769
+ children: t("info.auth")
770
+ }),
771
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PasswordInput$1, {
772
+ label: t("password.title"),
773
+ value: currentPassword,
774
+ onChange,
775
+ placeholder: t("info.passwordPlaceholder"),
776
+ autoComplete: "current-password",
777
+ "data-cy": "shelly-info-current-password"
778
+ }),
779
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
780
+ className: "sh:flex sh:justify-end",
781
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$7, {
782
+ variant: "primary",
783
+ size: "sm",
784
+ isPending: loading,
785
+ onPress: onLoad,
786
+ "data-cy": "shelly-info-unlock",
787
+ children: t("info.load")
788
+ })
789
+ }),
790
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
791
+ type: "submit",
792
+ hidden: true
793
+ })
794
+ ]
795
+ })
796
+ });
797
+ }
798
+ // frontend/src/devices/info/infoValues.ts
766
799
  function formatInfoValue(value, t, language, suffix = "") {
767
800
  if (value === void 0 || value === null || value === "") return t("info.notReported");
768
801
  if (typeof value === "boolean") return t(value ? "info.on" : "info.off");
@@ -793,6 +826,8 @@ function formatUptime(seconds, t, language) {
793
826
  if (hours > 0) return `${hours}h ${minutes}m`;
794
827
  return `${minutes}m`;
795
828
  }
829
+ // frontend/src/devices/info/DeviceInfoCards.tsx
830
+ var { Card } = await importShared("@heroui/react");
796
831
  function DeviceInfoCards({ info }) {
797
832
  const { t, language } = useShellyTranslations();
798
833
  const formatValue = (value, suffix = "") => formatInfoValue(value, t, language, suffix);
@@ -907,49 +942,11 @@ function DeviceInfoCards({ info }) {
907
942
  }) })] }, card.title))
908
943
  });
909
944
  }
910
- function AuthProtectedForm({ authState, currentPassword, onChange, loading, onLoad }) {
911
- const { t } = useShellyTranslations();
912
- if (authState !== "required") return null;
913
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
914
- className: "sh:rounded-md sh:border-l-4 sh:border-l-warning sh:bg-warning/5 sh:p-4",
915
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Form$1, {
916
- onSubmit: (e) => {
917
- e.preventDefault();
918
- onLoad();
919
- },
920
- className: "sh:flex sh:flex-col sh:gap-3",
921
- children: [
922
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
923
- className: "sh:text-sm",
924
- children: t("info.auth")
925
- }),
926
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PasswordInput$1, {
927
- label: t("password.title"),
928
- value: currentPassword,
929
- onChange,
930
- placeholder: t("info.passwordPlaceholder"),
931
- autoComplete: "current-password",
932
- "data-cy": "shelly-info-current-password"
933
- }),
934
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
935
- className: "sh:flex sh:justify-end",
936
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$4, {
937
- variant: "primary",
938
- size: "sm",
939
- isPending: loading,
940
- onPress: onLoad,
941
- "data-cy": "shelly-info-unlock",
942
- children: t("info.load")
943
- })
944
- }),
945
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
946
- type: "submit",
947
- hidden: true
948
- })
949
- ]
950
- })
951
- });
952
- }
945
+ // frontend/src/devices/info/DeviceInfoDrawer.tsx
946
+ var { Button: Button$6, StandardDrawer: StandardDrawer$2, StatusAlert: StatusAlert$3, useDateTimeFormatter: useDateTimeFormatter$1 } = await importShared("@attraccess/plugins-frontend-ui");
947
+ var { DrawerBody: DrawerBody$2, DrawerFooter: DrawerFooter$1, DrawerHeader: DrawerHeader$2, DrawerHeading: DrawerHeading$2, Skeleton } = await importShared("@heroui/react");
948
+ var { InfoIcon: InfoIcon$1, RefreshCwIcon: RefreshCwIcon$2, XIcon: XIcon$2 } = await importShared("lucide-react");
949
+ var { useCallback: useCallback$3, useEffect: useEffect$2, useState: useState$3 } = await importShared("react");
953
950
  function DeviceInfoDrawer({ device, onOpenChange }) {
954
951
  const { t } = useShellyTranslations();
955
952
  const formatDateTime = useDateTimeFormatter$1({
@@ -1001,7 +998,7 @@ function DeviceInfoDrawer({ device, onOpenChange }) {
1001
998
  className: "sh:text-sm sh:text-muted",
1002
999
  children: device.ipAddress
1003
1000
  })]
1004
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$4, {
1001
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$6, {
1005
1002
  isIconOnly: true,
1006
1003
  variant: "ghost",
1007
1004
  "aria-label": t("common.close"),
@@ -1040,7 +1037,7 @@ function DeviceInfoDrawer({ device, onOpenChange }) {
1040
1037
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1041
1038
  className: "sh:text-xs sh:text-default-500",
1042
1039
  children: info ? t("info.updated", { time: formatDateTime(info.fetchedAt) }) : ""
1043
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$4, {
1040
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$6, {
1044
1041
  variant: "secondary",
1045
1042
  onPress: () => void load(),
1046
1043
  isPending: loading,
@@ -1055,9 +1052,8 @@ function DeviceInfoDrawer({ device, onOpenChange }) {
1055
1052
  ]
1056
1053
  });
1057
1054
  }
1058
- //#endregion
1059
- //#region frontend/src/DiscoverDrawer.tsx
1060
- var { Button: Button$3, StandardDrawer: StandardDrawer$1, StatusAlert: StatusAlert$2 } = await importShared("@attraccess/plugins-frontend-ui");
1055
+ // frontend/src/DiscoverDrawer.tsx
1056
+ var { Button: Button$5, StandardDrawer: StandardDrawer$1, StatusAlert: StatusAlert$2 } = await importShared("@attraccess/plugins-frontend-ui");
1061
1057
  var { Chip: Chip$2, DrawerBody: DrawerBody$1, DrawerHeader: DrawerHeader$1, DrawerHeading: DrawerHeading$1, Form, Spinner: Spinner$1 } = await importShared("@heroui/react");
1062
1058
  var { SearchIcon: SearchIcon$1, XIcon: XIcon$1 } = await importShared("lucide-react");
1063
1059
  var { useCallback: useCallback$2, useRef: useRef$1, useState: useState$2 } = await importShared("react");
@@ -1154,7 +1150,7 @@ function DiscoverDrawer({ isOpen, onOpenChange, onDiscovered }) {
1154
1150
  className: "sh:text-sm sh:text-muted",
1155
1151
  children: t("discovery.description")
1156
1152
  })]
1157
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$3, {
1153
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$5, {
1158
1154
  isIconOnly: true,
1159
1155
  variant: "ghost",
1160
1156
  "aria-label": t("common.close"),
@@ -1189,11 +1185,11 @@ function DiscoverDrawer({ isOpen, onOpenChange, onDiscovered }) {
1189
1185
  result && !running && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResultSummary, { result }),
1190
1186
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1191
1187
  className: "sh:flex sh:justify-end sh:gap-2 sh:pt-2",
1192
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$3, {
1188
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$5, {
1193
1189
  variant: "secondary",
1194
1190
  onPress: close,
1195
1191
  children: t(result ? "common.done" : "common.cancel")
1196
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$3, {
1192
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$5, {
1197
1193
  variant: "primary",
1198
1194
  type: "submit",
1199
1195
  isPending: running,
@@ -1214,11 +1210,65 @@ function DiscoverDrawer({ isOpen, onOpenChange, onDiscovered }) {
1214
1210
  }) })]
1215
1211
  });
1216
1212
  }
1217
- //#endregion
1218
- //#region frontend/src/devices/firmware/useFirmwareDrawerState.tsx
1213
+ // frontend/src/devices/firmware/FirmwareDetails.tsx
1214
+ var { EmptyState: EmptyState$1, useDateTimeFormatter } = await importShared("@attraccess/plugins-frontend-ui");
1215
+ function VersionRow({ label, value }) {
1216
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1217
+ className: "sh:flex sh:items-baseline sh:justify-between sh:gap-3 sh:border-b sh:border-default-200 sh:py-2 sh:last:border-b-0",
1218
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1219
+ className: "sh:text-xs sh:font-medium sh:uppercase sh:tracking-wide sh:text-default-500",
1220
+ children: label
1221
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1222
+ className: "sh:min-w-0 sh:truncate sh:text-sm sh:text-default-800",
1223
+ title: value,
1224
+ children: value
1225
+ })]
1226
+ });
1227
+ }
1228
+ function FirmwareDetails({ status }) {
1229
+ const { t } = useShellyTranslations();
1230
+ const formatDateTime = useDateTimeFormatter({ showSeconds: true });
1231
+ if (!status) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState$1, { message: t("firmware.empty") });
1232
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
1233
+ className: "sh:rounded-xl sh:border sh:border-default-200 sh:bg-surface sh:p-4",
1234
+ "data-cy": "shelly-firmware-details",
1235
+ children: [
1236
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
1237
+ label: t("firmware.installed"),
1238
+ value: status.currentVersion ?? t("devices.unknown")
1239
+ }),
1240
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
1241
+ label: t("firmware.stable"),
1242
+ value: status.available.stable ?? t("firmware.upToDate")
1243
+ }),
1244
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
1245
+ label: t("firmware.beta"),
1246
+ value: status.available.beta ?? t("firmware.nothingNewer")
1247
+ }),
1248
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
1249
+ label: t("firmware.checked"),
1250
+ value: String(formatDateTime(status.fetchedAt))
1251
+ })
1252
+ ]
1253
+ });
1254
+ }
1255
+ // frontend/src/devices/firmware/shortVersion.ts
1256
+ /**
1257
+ * Gen1 reports versions as `20230913-114150/v1.14.0` — only the tail is useful
1258
+ * at a glance, the full string stays in the tooltip.
1259
+ */
1260
+ function shortVersion(version) {
1261
+ const tail = version.split("/").pop();
1262
+ return tail && tail.length > 0 ? tail : version;
1263
+ }
1264
+ // frontend/src/devices/firmware/FirmwareDrawer.tsx
1265
+ var { Button: Button$4, PasswordInput, StandardDrawer, StatusAlert: StatusAlert$1, TableDataLoadingIndicator: TableDataLoadingIndicator$1 } = await importShared("@attraccess/plugins-frontend-ui");
1266
+ var { DrawerBody, DrawerFooter, DrawerHeader, DrawerHeading, Spinner } = await importShared("@heroui/react");
1267
+ var { CpuIcon: CpuIcon$1, DownloadIcon, RefreshCwIcon: RefreshCwIcon$1, XIcon } = await importShared("lucide-react");
1219
1268
  var { useCallback: useCallback$1, useEffect: useEffect$1, useRef, useState: useState$1 } = await importShared("react");
1220
1269
  var UPDATE_TIMEOUT_MS = 3e5;
1221
- function useFirmwareDrawerState({ device, onOpenChange, onUpdated }) {
1270
+ var STAGES = ["stable", "beta"];
1271
+ function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
1222
1272
  const { t, tMessage } = useShellyTranslations();
1223
1273
  const [status, setStatus] = useState$1(null);
1224
1274
  const [currentPassword, setCurrentPassword] = useState$1("");
@@ -1297,126 +1347,6 @@ function useFirmwareDrawerState({ device, onOpenChange, onUpdated }) {
1297
1347
  }, Math.max(0, deadline.current - Date.now()));
1298
1348
  return () => clearTimeout(timeout);
1299
1349
  }, [installing, device]);
1300
- return {
1301
- t,
1302
- tMessage,
1303
- status,
1304
- currentPassword,
1305
- setCurrentPassword,
1306
- loading,
1307
- error,
1308
- installing,
1309
- installedVersion,
1310
- targetVersion,
1311
- close,
1312
- load,
1313
- install,
1314
- stages: ["stable", "beta"],
1315
- device,
1316
- onOpenChange
1317
- };
1318
- }
1319
- //#endregion
1320
- //#region frontend/src/devices/firmware/FirmwareDrawer.tsx
1321
- var { Button: Button$2, EmptyState: EmptyState$1, PasswordInput, StandardDrawer, StatusAlert: StatusAlert$1, TableDataLoadingIndicator: TableDataLoadingIndicator$1, useDateTimeFormatter } = await importShared("@attraccess/plugins-frontend-ui");
1322
- var { DrawerBody, DrawerFooter, DrawerHeader, DrawerHeading, Spinner, Tooltip: Tooltip$1 } = await importShared("@heroui/react");
1323
- var { ArrowUpCircleIcon, CpuIcon: CpuIcon$1, DownloadIcon, RefreshCwIcon: RefreshCwIcon$1, XIcon } = await importShared("lucide-react");
1324
- function shortVersion(version) {
1325
- const tail = version.split("/").pop();
1326
- return tail && tail.length > 0 ? tail : version;
1327
- }
1328
- /** Table cell summarising a device's firmware state from the bulk overview. */
1329
- function FirmwareCell({ entry }) {
1330
- const { t } = useShellyTranslations();
1331
- if (!entry) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1332
- className: "sh:text-sm sh:text-default-400",
1333
- children: t("firmware.checking")
1334
- });
1335
- if (entry.error || !entry.status) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1336
- className: "sh:block sh:max-w-40 sh:truncate sh:text-sm sh:text-default-400",
1337
- title: entry.error ?? void 0,
1338
- children: t("firmware.unavailable")
1339
- });
1340
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1341
- className: "sh:flex sh:flex-col sh:gap-1",
1342
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1343
- className: "sh:block sh:max-w-40 sh:truncate sh:text-sm sh:text-default-700",
1344
- title: entry.status.currentVersion ?? void 0,
1345
- children: entry.status.currentVersion ? shortVersion(entry.status.currentVersion) : t("devices.unknown")
1346
- }), entry.status.hasUpdate && entry.status.available.stable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1347
- className: "sh:max-w-40 sh:truncate sh:text-xs sh:text-warning-600",
1348
- title: entry.status.available.stable,
1349
- children: t("firmware.available", { version: shortVersion(entry.status.available.stable) })
1350
- })]
1351
- });
1352
- }
1353
- /**
1354
- * "Update available" marker next to the device name, so the signal survives the
1355
- * breakpoints where the Firmware column is hidden. Icon-only on purpose: a text
1356
- * chip here widens the Device column enough to push the row actions out of the
1357
- * table's visible width on tablets.
1358
- */
1359
- function UpdateAvailableIndicator({ entry }) {
1360
- const { t } = useShellyTranslations();
1361
- const version = entry?.status?.hasUpdate ? entry.status.available.stable : null;
1362
- if (!version) return null;
1363
- const label = t("firmware.updateAvailable", { version: shortVersion(version) });
1364
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip$1, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$1.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$2, {
1365
- variant: "ghost",
1366
- size: "sm",
1367
- isIconOnly: true,
1368
- "aria-label": label,
1369
- className: "sh:h-6 sh:w-6 sh:min-w-6 sh:text-warning",
1370
- "data-cy": "shelly-update-available",
1371
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUpCircleIcon, { className: "sh:h-4 sh:w-4" })
1372
- }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$1.Content, { children: label })] });
1373
- }
1374
- function VersionRow({ label, value }) {
1375
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1376
- className: "sh:flex sh:items-baseline sh:justify-between sh:gap-3 sh:border-b sh:border-default-200 sh:py-2 sh:last:border-b-0",
1377
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1378
- className: "sh:text-xs sh:font-medium sh:uppercase sh:tracking-wide sh:text-default-500",
1379
- children: label
1380
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1381
- className: "sh:min-w-0 sh:truncate sh:text-sm sh:text-default-800",
1382
- title: value,
1383
- children: value
1384
- })]
1385
- });
1386
- }
1387
- function FirmwareDetails({ status }) {
1388
- const { t } = useShellyTranslations();
1389
- const formatDateTime = useDateTimeFormatter({ showSeconds: true });
1390
- if (!status) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState$1, { message: t("firmware.empty") });
1391
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
1392
- className: "sh:rounded-xl sh:border sh:border-default-200 sh:bg-surface sh:p-4",
1393
- "data-cy": "shelly-firmware-details",
1394
- children: [
1395
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
1396
- label: t("firmware.installed"),
1397
- value: status.currentVersion ?? t("devices.unknown")
1398
- }),
1399
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
1400
- label: t("firmware.stable"),
1401
- value: status.available.stable ?? t("firmware.upToDate")
1402
- }),
1403
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
1404
- label: t("firmware.beta"),
1405
- value: status.available.beta ?? t("firmware.nothingNewer")
1406
- }),
1407
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
1408
- label: t("firmware.checked"),
1409
- value: String(formatDateTime(status.fetchedAt))
1410
- })
1411
- ]
1412
- });
1413
- }
1414
- function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
1415
- const { t, tMessage, status, currentPassword, setCurrentPassword, loading, error, installing, installedVersion, targetVersion, close, load, install, stages } = useFirmwareDrawerState({
1416
- device,
1417
- onOpenChange,
1418
- onUpdated
1419
- });
1420
1350
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StandardDrawer, {
1421
1351
  isOpen: !!device,
1422
1352
  onOpenChange,
@@ -1438,7 +1368,7 @@ function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
1438
1368
  address: device.ipAddress
1439
1369
  })
1440
1370
  })]
1441
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$2, {
1371
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$4, {
1442
1372
  isIconOnly: true,
1443
1373
  variant: "ghost",
1444
1374
  "aria-label": t("common.close"),
@@ -1489,7 +1419,7 @@ function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
1489
1419
  }) }),
1490
1420
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DrawerFooter, {
1491
1421
  className: "sh:flex-wrap",
1492
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$2, {
1422
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$4, {
1493
1423
  variant: "secondary",
1494
1424
  onPress: load,
1495
1425
  isPending: loading,
@@ -1500,10 +1430,10 @@ function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
1500
1430
  " ",
1501
1431
  t("firmware.recheck")
1502
1432
  ]
1503
- }), stages.map((stage) => {
1433
+ }), STAGES.map((stage) => {
1504
1434
  const version = status?.available[stage];
1505
1435
  if (!version) return null;
1506
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$2, {
1436
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$4, {
1507
1437
  variant: stage === "stable" ? "primary" : "secondary",
1508
1438
  onPress: () => install(stage),
1509
1439
  isPending: installing === stage,
@@ -1527,11 +1457,8 @@ function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
1527
1457
  ]
1528
1458
  });
1529
1459
  }
1530
- //#endregion
1531
- //#region frontend/src/devices/DeviceRowParts.tsx
1532
- var { Button: Button$1 } = await importShared("@attraccess/plugins-frontend-ui");
1533
- var { Chip: Chip$1, Dropdown, DropdownItem, DropdownMenu, DropdownPopover, DropdownTrigger, Tooltip } = await importShared("@heroui/react");
1534
- var { CpuIcon, InfoIcon, KeyRoundIcon, MoreVerticalIcon, RefreshCwIcon, Trash2Icon, TriangleAlertIcon } = await importShared("lucide-react");
1460
+ // frontend/src/devices/AuthChip.tsx
1461
+ var { Chip: Chip$1 } = await importShared("@heroui/react");
1535
1462
  function AuthChip({ state }) {
1536
1463
  const { t } = useShellyTranslations();
1537
1464
  const { color } = {
@@ -1547,9 +1474,84 @@ function AuthChip({ state }) {
1547
1474
  children: t(`auth.${state}`)
1548
1475
  });
1549
1476
  }
1477
+ // frontend/src/devices/EmptyDevices.tsx
1478
+ var { Button: Button$3, EmptyState } = await importShared("@attraccess/plugins-frontend-ui");
1479
+ var { PlusIcon: PlusIcon$1 } = await importShared("lucide-react");
1480
+ function EmptyDevices({ onAdd }) {
1481
+ const { t } = useShellyTranslations();
1482
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1483
+ className: "sh:flex sh:flex-col sh:items-center sh:justify-center sh:gap-3 sh:pb-6",
1484
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, { message: t("devices.empty") }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$3, {
1485
+ variant: "secondary",
1486
+ size: "sm",
1487
+ onPress: onAdd,
1488
+ "data-cy": "shelly-add-open-empty",
1489
+ children: [
1490
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlusIcon$1, { className: "sh:h-4 sh:w-4" }),
1491
+ " ",
1492
+ t("devices.add")
1493
+ ]
1494
+ })]
1495
+ });
1496
+ }
1497
+ // frontend/src/devices/firmware/FirmwareCell.tsx
1498
+ /** Table cell summarising a device's firmware state from the bulk overview. */
1499
+ function FirmwareCell({ entry }) {
1500
+ const { t } = useShellyTranslations();
1501
+ if (!entry) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1502
+ className: "sh:text-sm sh:text-default-400",
1503
+ children: t("firmware.checking")
1504
+ });
1505
+ if (entry.error || !entry.status) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1506
+ className: "sh:block sh:max-w-40 sh:truncate sh:text-sm sh:text-default-400",
1507
+ title: entry.error ?? void 0,
1508
+ children: t("firmware.unavailable")
1509
+ });
1510
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1511
+ className: "sh:flex sh:flex-col sh:gap-1",
1512
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1513
+ className: "sh:block sh:max-w-40 sh:truncate sh:text-sm sh:text-default-700",
1514
+ title: entry.status.currentVersion ?? void 0,
1515
+ children: entry.status.currentVersion ? shortVersion(entry.status.currentVersion) : t("devices.unknown")
1516
+ }), entry.status.hasUpdate && entry.status.available.stable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1517
+ className: "sh:max-w-40 sh:truncate sh:text-xs sh:text-warning-600",
1518
+ title: entry.status.available.stable,
1519
+ children: t("firmware.available", { version: shortVersion(entry.status.available.stable) })
1520
+ })]
1521
+ });
1522
+ }
1523
+ // frontend/src/devices/firmware/UpdateAvailableIndicator.tsx
1524
+ var { Button: Button$2 } = await importShared("@attraccess/plugins-frontend-ui");
1525
+ var { Tooltip: Tooltip$2 } = await importShared("@heroui/react");
1526
+ var { ArrowUpCircleIcon } = await importShared("lucide-react");
1527
+ /**
1528
+ * "Update available" marker next to the device name, so the signal survives the
1529
+ * breakpoints where the Firmware column is hidden. Icon-only on purpose: a text
1530
+ * chip here widens the Device column enough to push the row actions out of the
1531
+ * table's visible width on tablets.
1532
+ */
1533
+ function UpdateAvailableIndicator({ entry }) {
1534
+ const { t } = useShellyTranslations();
1535
+ const version = entry?.status?.hasUpdate ? entry.status.available.stable : null;
1536
+ if (!version) return null;
1537
+ const label = t("firmware.updateAvailable", { version: shortVersion(version) });
1538
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip$2, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$2.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$2, {
1539
+ variant: "ghost",
1540
+ size: "sm",
1541
+ isIconOnly: true,
1542
+ "aria-label": label,
1543
+ className: "sh:h-6 sh:w-6 sh:min-w-6 sh:text-warning",
1544
+ "data-cy": "shelly-update-available",
1545
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUpCircleIcon, { className: "sh:h-4 sh:w-4" })
1546
+ }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$2.Content, { children: label })] });
1547
+ }
1548
+ // frontend/src/devices/ProbeErrorIndicator.tsx
1549
+ var { Button: Button$1 } = await importShared("@attraccess/plugins-frontend-ui");
1550
+ var { Tooltip: Tooltip$1 } = await importShared("@heroui/react");
1551
+ var { TriangleAlertIcon } = await importShared("lucide-react");
1550
1552
  function ProbeErrorIndicator({ message }) {
1551
1553
  const { t } = useShellyTranslations();
1552
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
1554
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip$1, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$1.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
1553
1555
  variant: "ghost",
1554
1556
  size: "sm",
1555
1557
  isIconOnly: true,
@@ -1557,13 +1559,17 @@ function ProbeErrorIndicator({ message }) {
1557
1559
  className: "sh:h-6 sh:w-6 sh:min-w-6 sh:text-warning",
1558
1560
  "data-cy": "shelly-device-probe-error",
1559
1561
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlertIcon, { className: "sh:h-4 sh:w-4" })
1560
- }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip.Content, { children: t("devices.probeError", { message }) })] });
1562
+ }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$1.Content, { children: t("devices.probeError", { message }) })] });
1561
1563
  }
1564
+ // frontend/src/devices/RowActions.tsx
1565
+ var { Button } = await importShared("@attraccess/plugins-frontend-ui");
1566
+ var { Dropdown, DropdownItem, DropdownMenu, DropdownPopover, DropdownTrigger, Tooltip } = await importShared("@heroui/react");
1567
+ var { CpuIcon, InfoIcon, KeyRoundIcon, MoreVerticalIcon, RefreshCwIcon, Trash2Icon } = await importShared("lucide-react");
1562
1568
  function RowActions({ deviceId, isBusy, onInfo, onFirmware, onAuth, onReprobe, onDelete }) {
1563
1569
  const { t } = useShellyTranslations();
1564
1570
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1565
1571
  className: "sh:flex sh:flex-row sh:items-center sh:justify-end sh:gap-1 sh:whitespace-nowrap",
1566
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
1572
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1567
1573
  variant: "ghost",
1568
1574
  size: "sm",
1569
1575
  isIconOnly: true,
@@ -1572,7 +1578,7 @@ function RowActions({ deviceId, isBusy, onInfo, onFirmware, onAuth, onReprobe, o
1572
1578
  onPress: onInfo,
1573
1579
  "data-cy": `shelly-device-info-${deviceId}`,
1574
1580
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InfoIcon, { className: "sh:h-4 sh:w-4" })
1575
- }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip.Content, { children: t("devices.info") })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Dropdown, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
1581
+ }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip.Content, { children: t("devices.info") })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Dropdown, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
1576
1582
  variant: "ghost",
1577
1583
  size: "sm",
1578
1584
  isIconOnly: true,
@@ -1628,10 +1634,9 @@ function RowActions({ deviceId, isBusy, onInfo, onFirmware, onAuth, onReprobe, o
1628
1634
  }) })] })]
1629
1635
  });
1630
1636
  }
1631
- //#endregion
1632
- //#region frontend/src/renderDevicesPageDevicesRows.tsx
1633
- var { Chip, TableCell, TableRow } = await importShared("@heroui/react");
1634
- function renderDevicesPageDevicesRows(device, { firmware, t, rowBusyId, setInfoDevice, setFirmwareDevice, setAuthDevice, withRowBusy, setDeleteTarget }) {
1637
+ // frontend/src/devices/DevicesTable.tsx
1638
+ var { Chip, Table, TableBody, TableCell, TableColumn, TableContent, TableHeader, TableRow, TableScrollContainer } = await importShared("@heroui/react");
1639
+ function renderDeviceRow(device, { firmware, rowBusyId, setInfoDevice, setFirmwareDevice, setAuthDevice, withRowBusy, setDeleteTarget }, t) {
1635
1640
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, {
1636
1641
  id: device.id,
1637
1642
  "data-cy": `shelly-device-row-${device.id}`,
@@ -1697,12 +1702,58 @@ function renderDevicesPageDevicesRows(device, { firmware, t, rowBusyId, setInfoD
1697
1702
  ]
1698
1703
  }, device.id);
1699
1704
  }
1700
- //#endregion
1701
- //#region frontend/src/useDevicesPageState.tsx
1705
+ function DevicesTable({ devices, onAdd, ...rowProps }) {
1706
+ const { t, language } = useShellyTranslations();
1707
+ const { firmware, rowBusyId } = rowProps;
1708
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, {
1709
+ "data-cy": "shelly-device-table",
1710
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableScrollContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableContent, {
1711
+ "aria-label": t("devices.table"),
1712
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableHeader, { children: [
1713
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1714
+ isRowHeader: true,
1715
+ children: t("devices.device")
1716
+ }),
1717
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1718
+ className: "sh:hidden sh:sm:table-cell sh:md:hidden sh:lg:table-cell",
1719
+ children: t("devices.address")
1720
+ }),
1721
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1722
+ className: "sh:hidden sh:lg:table-cell",
1723
+ children: t("devices.model")
1724
+ }),
1725
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1726
+ className: "sh:hidden sh:sm:table-cell",
1727
+ children: t("devices.auth")
1728
+ }),
1729
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1730
+ className: "sh:hidden sh:xl:table-cell",
1731
+ children: t("devices.firmware")
1732
+ }),
1733
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1734
+ className: "sh:text-end",
1735
+ children: t("devices.actions")
1736
+ })
1737
+ ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, {
1738
+ items: devices,
1739
+ dependencies: [
1740
+ firmware,
1741
+ rowBusyId,
1742
+ language
1743
+ ],
1744
+ renderEmptyState: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDevices, { onAdd }),
1745
+ children: (device) => renderDeviceRow(device, rowProps, t)
1746
+ })]
1747
+ }) })
1748
+ });
1749
+ }
1750
+ // frontend/src/devices/DevicesPage.tsx
1751
+ var { PageHeader, StatusAlert, StatusDialog, TableDataLoadingIndicator } = await importShared("@attraccess/plugins-frontend-ui");
1702
1752
  var { useOverlayState } = await importShared("@heroui/react");
1753
+ var { PlusIcon, SearchIcon, WifiIcon: WifiIcon$1 } = await importShared("lucide-react");
1703
1754
  var { useCallback, useEffect, useState } = await importShared("react");
1704
- function useDevicesPageState() {
1705
- const { t, language } = useShellyTranslations();
1755
+ function DevicesPage() {
1756
+ const { t } = useShellyTranslations();
1706
1757
  const [devices, setDevices] = useState([]);
1707
1758
  const [loading, setLoading] = useState(true);
1708
1759
  const [pageError, setPageError] = useState(null);
@@ -1743,78 +1794,31 @@ function useDevicesPageState() {
1743
1794
  useEffect(() => {
1744
1795
  refresh();
1745
1796
  }, [refresh]);
1746
- return {
1747
- t,
1748
- language,
1749
- devices,
1750
- loading,
1751
- pageError,
1752
- rowBusyId,
1753
- infoDevice,
1754
- setInfoDevice,
1755
- authDevice,
1756
- setAuthDevice,
1757
- firmwareDevice,
1758
- setFirmwareDevice,
1759
- firmware,
1760
- deleteTarget,
1761
- setDeleteTarget,
1762
- deleting,
1763
- addDrawer,
1764
- discoverDrawer,
1765
- refreshFirmware,
1766
- refresh,
1767
- withRowBusy: useCallback(async (id, action) => {
1768
- setRowBusyId(id);
1769
- try {
1770
- await action();
1771
- await refresh();
1772
- } catch (err) {
1773
- setPageError(err instanceof Error ? err.message : String(err));
1774
- } finally {
1775
- setRowBusyId(null);
1776
- }
1777
- }, [refresh]),
1778
- confirmDelete: useCallback(async () => {
1779
- if (!deleteTarget) return;
1780
- setDeleting(true);
1781
- try {
1782
- await deleteDevice(deleteTarget.id);
1783
- await refresh();
1784
- setDeleteTarget(null);
1785
- } catch (err) {
1786
- setPageError(err instanceof Error ? err.message : String(err));
1787
- setDeleteTarget(null);
1788
- } finally {
1789
- setDeleting(false);
1790
- }
1791
- }, [deleteTarget, refresh])
1792
- };
1793
- }
1794
- //#endregion
1795
- //#region frontend/src/devices/DevicesPage.tsx
1796
- var { Button, EmptyState, PageHeader, StatusAlert, StatusDialog, TableDataLoadingIndicator } = await importShared("@attraccess/plugins-frontend-ui");
1797
- var { Table, TableBody, TableColumn, TableContent, TableHeader, TableScrollContainer } = await importShared("@heroui/react");
1798
- var { PlusIcon, SearchIcon, WifiIcon: WifiIcon$1 } = await importShared("lucide-react");
1799
- function EmptyDevices({ onAdd }) {
1800
- const { t } = useShellyTranslations();
1801
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1802
- className: "sh:flex sh:flex-col sh:items-center sh:justify-center sh:gap-3 sh:pb-6",
1803
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, { message: t("devices.empty") }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
1804
- variant: "secondary",
1805
- size: "sm",
1806
- onPress: onAdd,
1807
- "data-cy": "shelly-add-open-empty",
1808
- children: [
1809
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlusIcon, { className: "sh:h-4 sh:w-4" }),
1810
- " ",
1811
- t("devices.add")
1812
- ]
1813
- })]
1814
- });
1815
- }
1816
- function DevicesPage() {
1817
- const { t, language, devices, loading, pageError, rowBusyId, infoDevice, setInfoDevice, authDevice, setAuthDevice, firmwareDevice, setFirmwareDevice, firmware, deleteTarget, setDeleteTarget, deleting, addDrawer, discoverDrawer, refreshFirmware, refresh, withRowBusy, confirmDelete } = useDevicesPageState();
1797
+ const withRowBusy = useCallback(async (id, action) => {
1798
+ setRowBusyId(id);
1799
+ try {
1800
+ await action();
1801
+ await refresh();
1802
+ } catch (err) {
1803
+ setPageError(err instanceof Error ? err.message : String(err));
1804
+ } finally {
1805
+ setRowBusyId(null);
1806
+ }
1807
+ }, [refresh]);
1808
+ const confirmDelete = useCallback(async () => {
1809
+ if (!deleteTarget) return;
1810
+ setDeleting(true);
1811
+ try {
1812
+ await deleteDevice(deleteTarget.id);
1813
+ await refresh();
1814
+ setDeleteTarget(null);
1815
+ } catch (err) {
1816
+ setPageError(err instanceof Error ? err.message : String(err));
1817
+ setDeleteTarget(null);
1818
+ } finally {
1819
+ setDeleting(false);
1820
+ }
1821
+ }, [deleteTarget, refresh]);
1818
1822
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1819
1823
  className: "sh:mx-auto sh:flex sh:w-full sh:max-w-5xl sh:flex-col sh:gap-6 sh:p-4 sh:md:p-6",
1820
1824
  children: [
@@ -1844,55 +1848,16 @@ function DevicesPage() {
1844
1848
  title: t("devices.loadError"),
1845
1849
  children: pageError
1846
1850
  }),
1847
- loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableDataLoadingIndicator, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, {
1848
- "data-cy": "shelly-device-table",
1849
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableScrollContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableContent, {
1850
- "aria-label": t("devices.table"),
1851
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableHeader, { children: [
1852
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1853
- isRowHeader: true,
1854
- children: t("devices.device")
1855
- }),
1856
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1857
- className: "sh:hidden sh:sm:table-cell sh:md:hidden sh:lg:table-cell",
1858
- children: t("devices.address")
1859
- }),
1860
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1861
- className: "sh:hidden sh:lg:table-cell",
1862
- children: t("devices.model")
1863
- }),
1864
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1865
- className: "sh:hidden sh:sm:table-cell",
1866
- children: t("devices.auth")
1867
- }),
1868
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1869
- className: "sh:hidden sh:xl:table-cell",
1870
- children: t("devices.firmware")
1871
- }),
1872
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
1873
- className: "sh:text-end",
1874
- children: t("devices.actions")
1875
- })
1876
- ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, {
1877
- items: devices,
1878
- dependencies: [
1879
- firmware,
1880
- rowBusyId,
1881
- language
1882
- ],
1883
- renderEmptyState: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDevices, { onAdd: addDrawer.open }),
1884
- children: (device) => renderDevicesPageDevicesRows(device, {
1885
- firmware,
1886
- t,
1887
- rowBusyId,
1888
- setInfoDevice,
1889
- setFirmwareDevice,
1890
- setAuthDevice,
1891
- withRowBusy,
1892
- setDeleteTarget
1893
- })
1894
- })]
1895
- }) })
1851
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableDataLoadingIndicator, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DevicesTable, {
1852
+ devices,
1853
+ firmware,
1854
+ rowBusyId,
1855
+ onAdd: addDrawer.open,
1856
+ setInfoDevice,
1857
+ setFirmwareDevice,
1858
+ setAuthDevice,
1859
+ setDeleteTarget,
1860
+ withRowBusy
1896
1861
  }),
1897
1862
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddDeviceDrawer, {
1898
1863
  isOpen: addDrawer.isOpen,
@@ -1940,8 +1905,7 @@ function DevicesPage() {
1940
1905
  ]
1941
1906
  });
1942
1907
  }
1943
- //#endregion
1944
- //#region frontend/src/plugin.tsx
1908
+ // frontend/src/plugin.tsx
1945
1909
  var { WifiIcon } = await importShared("lucide-react");
1946
1910
  var ShellyPlugin = class {
1947
1911
  getPluginName() {
@@ -1970,5 +1934,4 @@ var ShellyPlugin = class {
1970
1934
  }];
1971
1935
  }
1972
1936
  };
1973
- //#endregion
1974
1937
  export { ShellyPlugin as default };
@@ -0,0 +1 @@
1
+ export { r as importShared, t as importSharedLocal, n as importSharedRuntime } from "./_virtual___federation_fn_import-D2E5es2p.js";
@@ -1,4 +1,4 @@
1
- //#region ../../../node_modules/.pnpm/@originjs+vite-plugin-federation@1.4.1/node_modules/@originjs/vite-plugin-federation/dist/satisfy.mjs
1
+ // ../../../node_modules/.pnpm/@originjs+vite-plugin-federation@1.4.1/node_modules/@originjs/vite-plugin-federation/dist/satisfy.mjs
2
2
  var buildIdentifier = "[0-9A-Za-z-]+";
3
3
  var build = `(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`;
4
4
  var numericIdentifier = "0|[1-9]\\d*";
@@ -221,8 +221,7 @@ function satisfy(version, range) {
221
221
  }
222
222
  return true;
223
223
  }
224
- //#endregion
225
- //#region \0virtual:__federation_fn_import
224
+ // \0virtual:__federation_fn_import
226
225
  var moduleMap = {};
227
226
  var moduleCache = Object.create(null);
228
227
  async function importShared(name, shareScope = "default") {
@@ -257,5 +256,4 @@ function flattenModule(module, name) {
257
256
  moduleCache[name] = module;
258
257
  return module;
259
258
  }
260
- //#endregion
261
259
  export { getSharedFromRuntime as n, importShared as r, getSharedFromLocal as t };
@@ -1,71 +1,4 @@
1
- //#region \0vite/preload-helper.js
2
- var scriptRel = "modulepreload";
3
- var assetsURL = function(dep) {
4
- return "/" + dep;
5
- };
6
- var seen$1 = {};
7
- var __vitePreload = function preload(baseModule, deps, importerUrl) {
8
- let promise = Promise.resolve();
9
- if (deps && deps.length > 0) {
10
- const links = document.getElementsByTagName("link");
11
- const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
12
- const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
13
- function allSettled(promises) {
14
- return Promise.all(promises.map((p) => Promise.resolve(p).then((value) => ({
15
- status: "fulfilled",
16
- value
17
- }), (reason) => ({
18
- status: "rejected",
19
- reason
20
- }))));
21
- }
22
- function importMetaResolve(specifier) {
23
- if (import.meta.resolve) return import.meta.resolve(specifier);
24
- return new URL(
25
- specifier,
26
- /** #__KEEP__ */
27
- import.meta.url
28
- ).href;
29
- }
30
- promise = allSettled(deps.map((dep) => {
31
- dep = assetsURL(dep, importerUrl);
32
- dep = importMetaResolve(dep);
33
- if (dep in seen$1) return;
34
- seen$1[dep] = true;
35
- const isCss = dep.endsWith(".css");
36
- for (let i = links.length - 1; i >= 0; i--) {
37
- const link = links[i];
38
- if (link.href === dep && (!isCss || link.rel === "stylesheet")) return;
39
- }
40
- const link = document.createElement("link");
41
- link.rel = isCss ? "stylesheet" : scriptRel;
42
- if (!isCss) link.as = "script";
43
- link.crossOrigin = "";
44
- link.href = dep;
45
- if (cspNonce) link.setAttribute("nonce", cspNonce);
46
- document.head.appendChild(link);
47
- if (isCss) return new Promise((res, rej) => {
48
- link.addEventListener("load", res);
49
- link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`)));
50
- });
51
- }));
52
- }
53
- function handlePreloadError(err) {
54
- const e = new Event("vite:preloadError", { cancelable: true });
55
- e.payload = err;
56
- window.dispatchEvent(e);
57
- if (!e.defaultPrevented) throw err;
58
- }
59
- return promise.then((res) => {
60
- for (const item of res || []) {
61
- if (item.status !== "rejected") continue;
62
- handlePreloadError(item.reason);
63
- }
64
- return baseModule().catch(handlePreloadError);
65
- });
66
- };
67
- //#endregion
68
- //#region \0virtual:__remoteEntryHelper__remoteEntry.js
1
+ // \0virtual:__remoteEntryHelper__remoteEntry.js
69
2
  var currentImports = {};
70
3
  var exportSet = /* @__PURE__ */ new Set([
71
4
  "Module",
@@ -75,7 +8,7 @@ var exportSet = /* @__PURE__ */ new Set([
75
8
  ]);
76
9
  var moduleMap = { "./plugin": () => {
77
10
  dynamicLoadingCss(["style.css"], false, "./plugin");
78
- return __federation_import("./__federation_expose_Plugin-CLiHEWPT.js").then((module) => Object.keys(module).every((item) => exportSet.has(item)) ? () => module.default : () => module);
11
+ return __federation_import("./__federation_expose_Plugin-B2fhm6K2.js").then((module) => Object.keys(module).every((item) => exportSet.has(item)) ? () => module.default : () => module);
79
12
  } };
80
13
  var seen = {};
81
14
  var dynamicLoadingCss = (cssFilePaths, dontAppendStylesToHead, exposeItemName) => {
@@ -118,7 +51,7 @@ var dynamicLoadingCss = (cssFilePaths, dontAppendStylesToHead, exposeItemName) =
118
51
  });
119
52
  };
120
53
  async function __federation_import(name) {
121
- currentImports[name] ??= __vitePreload(() => import(name), []);
54
+ currentImports[name] ??= import(name);
122
55
  return currentImports[name];
123
56
  }
124
57
  var get = (module) => {
@@ -136,5 +69,4 @@ var init = (shareScope) => {
136
69
  }
137
70
  });
138
71
  };
139
- //#endregion
140
72
  export { dynamicLoadingCss, get, init };
@@ -1,6 +1,6 @@
1
- /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
2
2
  @layer properties {
3
- @supports (((-webkit-hyphens: none)) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {
3
+ @supports (((-webkit-hyphens: none)) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {
4
4
  *, :before, :after, ::backdrop {
5
5
  --tw-border-style: solid;
6
6
  --tw-font-weight: initial;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@attraccess/plugin-shelly",
3
- "version": "0.1.0-nightly.1166.1",
3
+ "version": "0.1.0-nightly.1188.1",
4
4
  "description": "Official Attraccess integration for Shelly devices.",
5
- "license": "AGPL-3.0-only",
5
+ "license": "SEE LICENSE IN LICENSE.md",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/Attraccess/Attraccess.git",
@@ -34,6 +34,9 @@
34
34
  "frontend": "frontend/remoteEntry.js",
35
35
  "migrations": "dist/migrations.js",
36
36
  "styles": "frontend/style.css",
37
+ "dashboardPaths": [
38
+ "/shelly"
39
+ ],
37
40
  "permissions": [
38
41
  "DATABASE_ACCESS"
39
42
  ],
@@ -41,7 +44,7 @@
41
44
  "backend": "^1.9.0",
42
45
  "frontend": "^1.9.0"
43
46
  },
44
- "publishedCommit": "ad0616ec36e5b48848bc7ba7f7ec794550424dd8"
47
+ "publishedCommit": "cd28283778a934e08258c3305ff4c07114226385"
45
48
  },
46
- "gitHead": "ad0616ec36e5b48848bc7ba7f7ec794550424dd8"
49
+ "gitHead": "cd28283778a934e08258c3305ff4c07114226385"
47
50
  }
@@ -1,2 +0,0 @@
1
- import { n as getSharedFromRuntime, r as importShared, t as getSharedFromLocal } from "./_virtual___federation_fn_import-BXODRNto.js";
2
- export { importShared, getSharedFromLocal as importSharedLocal, getSharedFromRuntime as importSharedRuntime };