@serhii.olishevskyi/docs 1.2.15 → 1.2.17
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/index.d.mts +37 -1
- package/dist/index.d.ts +37 -1
- package/dist/index.js +191 -16
- package/dist/index.mjs +184 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -171,6 +171,21 @@ interface CopyClipboardButtonComponentProps extends Omit<IconButtonProps, 'onCli
|
|
|
171
171
|
onCopySuccess?: (text: string) => void;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
interface RefreshButtonComponentProps {
|
|
175
|
+
overrideNamespace?: string;
|
|
176
|
+
size?: 'small' | 'medium' | 'large';
|
|
177
|
+
color?: "success" | "error" | "info" | "warning";
|
|
178
|
+
onClick?: (event: React__default.MouseEvent<HTMLButtonElement>) => void | Promise<void>;
|
|
179
|
+
disabled?: boolean;
|
|
180
|
+
fullWidth?: boolean;
|
|
181
|
+
loading?: boolean;
|
|
182
|
+
tooltip?: ReactNode;
|
|
183
|
+
mobileViewOnly?: boolean;
|
|
184
|
+
disableMobileView?: boolean;
|
|
185
|
+
hideTooltipOnMobile?: boolean;
|
|
186
|
+
hideTooltipOnDesktop?: boolean;
|
|
187
|
+
}
|
|
188
|
+
|
|
174
189
|
interface TranslatableTooltipComponentProps extends Omit<TooltipProps, 'children'> {
|
|
175
190
|
overrideNamespace?: string;
|
|
176
191
|
disableSpan?: boolean;
|
|
@@ -373,6 +388,17 @@ interface PageLinkWidgetProps {
|
|
|
373
388
|
onActionButtonClick?: () => void;
|
|
374
389
|
}
|
|
375
390
|
|
|
391
|
+
type CollapsedWidgetContainerProps = {
|
|
392
|
+
overrideNamespace?: string;
|
|
393
|
+
title: ReactNode;
|
|
394
|
+
subtitle?: ReactNode;
|
|
395
|
+
icon?: ReactNode;
|
|
396
|
+
expanded?: boolean;
|
|
397
|
+
uncollapsedContent?: ReactNode;
|
|
398
|
+
disableShadow?: boolean;
|
|
399
|
+
onExpanded?: (expanded: boolean) => void;
|
|
400
|
+
};
|
|
401
|
+
|
|
376
402
|
declare const UI: {
|
|
377
403
|
Inputs: {
|
|
378
404
|
TextField: React$1.FC<TextFieldComponentProps>;
|
|
@@ -386,6 +412,7 @@ declare const UI: {
|
|
|
386
412
|
};
|
|
387
413
|
Buttons: {
|
|
388
414
|
CopyClipboardButton: React$1.FC<CopyClipboardButtonComponentProps>;
|
|
415
|
+
RefreshButton: React$1.FC<RefreshButtonComponentProps>;
|
|
389
416
|
};
|
|
390
417
|
DataDisplay: {
|
|
391
418
|
TranslatableTooltip: React$1.FC<TranslatableTooltipComponentProps>;
|
|
@@ -403,6 +430,7 @@ declare const UI: {
|
|
|
403
430
|
};
|
|
404
431
|
Pages: {
|
|
405
432
|
PageLinkWidget: React$1.FC<PageLinkWidgetProps>;
|
|
433
|
+
CollapsedWidgetContainer: (props: React$1.PropsWithChildren<CollapsedWidgetContainerProps>) => React$1.JSX.Element;
|
|
406
434
|
};
|
|
407
435
|
};
|
|
408
436
|
};
|
|
@@ -749,4 +777,12 @@ declare const Hooks: {
|
|
|
749
777
|
};
|
|
750
778
|
};
|
|
751
779
|
|
|
752
|
-
|
|
780
|
+
declare const Utils: {
|
|
781
|
+
readonly getDeviceId: () => string;
|
|
782
|
+
readonly Sessions: {
|
|
783
|
+
readonly notifySessionChange: () => void;
|
|
784
|
+
readonly subscribeToSessionChanges: (callback: () => void) => () => void;
|
|
785
|
+
};
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
export { type AIConfig, type AIGenerateOptions, AIProvider, type AIProviderProps, type AIProviderType, AppSettingsProvider, AuthProvider, BreadcrumbProvider, type CheckboxComponentProps, type CollapsedWidgetContainerProps, type CompanyMember, type ConfirmOptions, type ConfirmResult, ConfirmationProvider, type ConfirmationProviderProps, type CopyClipboardButtonComponentProps, type DialogSeverity, type DisplayState, type EmailInputComponentProps, type ExpandableNoteComponentProps, type FullCompanyMemberItem, Hooks, type Language, LocalizationProvider, type Membership, type MembershipRole, type MyAvatarComponentProps, type NumberInputComponentProps, type PageLink, type PageLinkWidgetProps, Providers, type RefreshButtonComponentProps, type SaveCompanyUserPayload, type SearchComponentProps, type SelectComponentProps, type SelectOption, Services, type SupabaseConfig, SupabaseProvider, type SupabaseProviderProps, type SwitchComponentProps, type TextFieldComponentProps, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, ToastProvider, type ToastType, type TranslatableTooltipComponentProps, TranslateProvider, TranslateText, TranslationEditProvider, type TypographyConfig, UI, type UrlComponentProps as UrlProps, type UserAvatarComponentProps, type UserGroupedSessions, type UserPopoverComponentProps, type UserProfile, type UserRoleChipComponentProps, type UserSessionItem, type UserSettings, UserSettingsProvider, type UserStatusChipComponentProps, type UserStatusType, Utils, defaultUserSettings, initI18n, useAI, useAppSettings, useAppTheme, useAuth, useBreadcrumb, useConfirmation, useLocalization, useSupabase, useToast, useTranslationEdit, useTranslationNamespace, useUserSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -171,6 +171,21 @@ interface CopyClipboardButtonComponentProps extends Omit<IconButtonProps, 'onCli
|
|
|
171
171
|
onCopySuccess?: (text: string) => void;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
interface RefreshButtonComponentProps {
|
|
175
|
+
overrideNamespace?: string;
|
|
176
|
+
size?: 'small' | 'medium' | 'large';
|
|
177
|
+
color?: "success" | "error" | "info" | "warning";
|
|
178
|
+
onClick?: (event: React__default.MouseEvent<HTMLButtonElement>) => void | Promise<void>;
|
|
179
|
+
disabled?: boolean;
|
|
180
|
+
fullWidth?: boolean;
|
|
181
|
+
loading?: boolean;
|
|
182
|
+
tooltip?: ReactNode;
|
|
183
|
+
mobileViewOnly?: boolean;
|
|
184
|
+
disableMobileView?: boolean;
|
|
185
|
+
hideTooltipOnMobile?: boolean;
|
|
186
|
+
hideTooltipOnDesktop?: boolean;
|
|
187
|
+
}
|
|
188
|
+
|
|
174
189
|
interface TranslatableTooltipComponentProps extends Omit<TooltipProps, 'children'> {
|
|
175
190
|
overrideNamespace?: string;
|
|
176
191
|
disableSpan?: boolean;
|
|
@@ -373,6 +388,17 @@ interface PageLinkWidgetProps {
|
|
|
373
388
|
onActionButtonClick?: () => void;
|
|
374
389
|
}
|
|
375
390
|
|
|
391
|
+
type CollapsedWidgetContainerProps = {
|
|
392
|
+
overrideNamespace?: string;
|
|
393
|
+
title: ReactNode;
|
|
394
|
+
subtitle?: ReactNode;
|
|
395
|
+
icon?: ReactNode;
|
|
396
|
+
expanded?: boolean;
|
|
397
|
+
uncollapsedContent?: ReactNode;
|
|
398
|
+
disableShadow?: boolean;
|
|
399
|
+
onExpanded?: (expanded: boolean) => void;
|
|
400
|
+
};
|
|
401
|
+
|
|
376
402
|
declare const UI: {
|
|
377
403
|
Inputs: {
|
|
378
404
|
TextField: React$1.FC<TextFieldComponentProps>;
|
|
@@ -386,6 +412,7 @@ declare const UI: {
|
|
|
386
412
|
};
|
|
387
413
|
Buttons: {
|
|
388
414
|
CopyClipboardButton: React$1.FC<CopyClipboardButtonComponentProps>;
|
|
415
|
+
RefreshButton: React$1.FC<RefreshButtonComponentProps>;
|
|
389
416
|
};
|
|
390
417
|
DataDisplay: {
|
|
391
418
|
TranslatableTooltip: React$1.FC<TranslatableTooltipComponentProps>;
|
|
@@ -403,6 +430,7 @@ declare const UI: {
|
|
|
403
430
|
};
|
|
404
431
|
Pages: {
|
|
405
432
|
PageLinkWidget: React$1.FC<PageLinkWidgetProps>;
|
|
433
|
+
CollapsedWidgetContainer: (props: React$1.PropsWithChildren<CollapsedWidgetContainerProps>) => React$1.JSX.Element;
|
|
406
434
|
};
|
|
407
435
|
};
|
|
408
436
|
};
|
|
@@ -749,4 +777,12 @@ declare const Hooks: {
|
|
|
749
777
|
};
|
|
750
778
|
};
|
|
751
779
|
|
|
752
|
-
|
|
780
|
+
declare const Utils: {
|
|
781
|
+
readonly getDeviceId: () => string;
|
|
782
|
+
readonly Sessions: {
|
|
783
|
+
readonly notifySessionChange: () => void;
|
|
784
|
+
readonly subscribeToSessionChanges: (callback: () => void) => () => void;
|
|
785
|
+
};
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
export { type AIConfig, type AIGenerateOptions, AIProvider, type AIProviderProps, type AIProviderType, AppSettingsProvider, AuthProvider, BreadcrumbProvider, type CheckboxComponentProps, type CollapsedWidgetContainerProps, type CompanyMember, type ConfirmOptions, type ConfirmResult, ConfirmationProvider, type ConfirmationProviderProps, type CopyClipboardButtonComponentProps, type DialogSeverity, type DisplayState, type EmailInputComponentProps, type ExpandableNoteComponentProps, type FullCompanyMemberItem, Hooks, type Language, LocalizationProvider, type Membership, type MembershipRole, type MyAvatarComponentProps, type NumberInputComponentProps, type PageLink, type PageLinkWidgetProps, Providers, type RefreshButtonComponentProps, type SaveCompanyUserPayload, type SearchComponentProps, type SelectComponentProps, type SelectOption, Services, type SupabaseConfig, SupabaseProvider, type SupabaseProviderProps, type SwitchComponentProps, type TextFieldComponentProps, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, ToastProvider, type ToastType, type TranslatableTooltipComponentProps, TranslateProvider, TranslateText, TranslationEditProvider, type TypographyConfig, UI, type UrlComponentProps as UrlProps, type UserAvatarComponentProps, type UserGroupedSessions, type UserPopoverComponentProps, type UserProfile, type UserRoleChipComponentProps, type UserSessionItem, type UserSettings, UserSettingsProvider, type UserStatusChipComponentProps, type UserStatusType, Utils, defaultUserSettings, initI18n, useAI, useAppSettings, useAppTheme, useAuth, useBreadcrumb, useConfirmation, useLocalization, useSupabase, useToast, useTranslationEdit, useTranslationNamespace, useUserSettings };
|
package/dist/index.js
CHANGED
|
@@ -2619,7 +2619,7 @@ var init_UserPopoverComponent = __esm({
|
|
|
2619
2619
|
}
|
|
2620
2620
|
};
|
|
2621
2621
|
loadStatus();
|
|
2622
|
-
const
|
|
2622
|
+
const channel2 = supabase.channel(`user_status_popover_${userId}`).on(
|
|
2623
2623
|
"postgres_changes",
|
|
2624
2624
|
{
|
|
2625
2625
|
event: "*",
|
|
@@ -2633,7 +2633,7 @@ var init_UserPopoverComponent = __esm({
|
|
|
2633
2633
|
).subscribe();
|
|
2634
2634
|
return () => {
|
|
2635
2635
|
isMounted = false;
|
|
2636
|
-
supabase.removeChannel(
|
|
2636
|
+
supabase.removeChannel(channel2);
|
|
2637
2637
|
};
|
|
2638
2638
|
}, [userId, open]);
|
|
2639
2639
|
const isOnline = Boolean(
|
|
@@ -2966,6 +2966,7 @@ __export(index_exports, {
|
|
|
2966
2966
|
TranslationEditProvider: () => TranslationEditProvider,
|
|
2967
2967
|
UI: () => UI,
|
|
2968
2968
|
UserSettingsProvider: () => UserSettingsProvider,
|
|
2969
|
+
Utils: () => Utils,
|
|
2969
2970
|
defaultUserSettings: () => defaultUserSettings,
|
|
2970
2971
|
initI18n: () => initI18n,
|
|
2971
2972
|
useAI: () => useAI,
|
|
@@ -3095,7 +3096,7 @@ var TextFieldComponent = ({
|
|
|
3095
3096
|
...slotProps?.input || {},
|
|
3096
3097
|
readOnly: isReadOnly,
|
|
3097
3098
|
endAdornment: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_material4.InputAdornment, { position: "end", sx: { gap: 0.5 }, children: [
|
|
3098
|
-
hasValue && !isLocked && !disableClearButton && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslateText, { overrideNamespace, children: clearTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3099
|
+
hasValue && !isLocked && !disableClearButton && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: clearTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3099
3100
|
import_material4.IconButton,
|
|
3100
3101
|
{
|
|
3101
3102
|
size: "small",
|
|
@@ -3105,7 +3106,7 @@ var TextFieldComponent = ({
|
|
|
3105
3106
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_Clear.default, { fontSize: "small" })
|
|
3106
3107
|
}
|
|
3107
3108
|
) }),
|
|
3108
|
-
hasValue && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslateText, { overrideNamespace, children: copied ? copiedTooltip : copyTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3109
|
+
hasValue && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: copied ? copiedTooltip : copyTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3109
3110
|
import_material4.IconButton,
|
|
3110
3111
|
{
|
|
3111
3112
|
size: "small",
|
|
@@ -3155,7 +3156,7 @@ var TextFieldComponent = ({
|
|
|
3155
3156
|
)
|
|
3156
3157
|
}
|
|
3157
3158
|
) }),
|
|
3158
|
-
isLocked && showLock && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslateText, { overrideNamespace, children: lockTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3159
|
+
isLocked && showLock && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: lockTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3159
3160
|
import_material4.IconButton,
|
|
3160
3161
|
{
|
|
3161
3162
|
size: "small",
|
|
@@ -4787,6 +4788,148 @@ var CheckboxComponent = ({
|
|
|
4787
4788
|
) });
|
|
4788
4789
|
};
|
|
4789
4790
|
|
|
4791
|
+
// src/UI/widgets/page/CollapsedWidgetContainer.tsx
|
|
4792
|
+
var import_icons_material4 = require("@mui/icons-material");
|
|
4793
|
+
var import_material24 = require("@mui/material");
|
|
4794
|
+
var import_react29 = require("react");
|
|
4795
|
+
init_context();
|
|
4796
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4797
|
+
var ExpandMore = (0, import_material24.styled)((props) => {
|
|
4798
|
+
const { expand, ...other } = props;
|
|
4799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.IconButton, { size: "small", ...other, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons_material4.ExpandMore, {}) });
|
|
4800
|
+
})(({ theme, expand }) => ({
|
|
4801
|
+
transform: !expand ? "rotate(0deg)" : "rotate(180deg)",
|
|
4802
|
+
transition: theme.transitions.create("transform", {
|
|
4803
|
+
duration: theme.transitions.duration.shortest
|
|
4804
|
+
}),
|
|
4805
|
+
backgroundColor: expand ? theme.palette.primary.main : "transparent",
|
|
4806
|
+
color: expand ? theme.palette.common.white : theme.palette.text.secondary,
|
|
4807
|
+
border: `1px solid ${expand ? theme.palette.primary.main : theme.palette.divider}`,
|
|
4808
|
+
"&:hover": {
|
|
4809
|
+
backgroundColor: expand ? theme.palette.primary.dark : theme.palette.action.hover
|
|
4810
|
+
}
|
|
4811
|
+
}));
|
|
4812
|
+
var CollapsedWidgetContainer = (props) => {
|
|
4813
|
+
const { displayState } = useAppTheme();
|
|
4814
|
+
const [expanded, setExpanded] = (0, import_react29.useState)(props.expanded === void 0 ? false : props.expanded);
|
|
4815
|
+
const handleExpandClick = () => {
|
|
4816
|
+
setExpanded(!expanded);
|
|
4817
|
+
props.onExpanded && props.onExpanded(!expanded);
|
|
4818
|
+
};
|
|
4819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material24.Card, { sx: { width: "100%", overflow: "hidden", mb: 2, boxShadow: displayState.isMobile ? "none" : props.disableShadow ? "none" : "0 20px 25px -5px rgb(0 0 0 / 0.1)", borderRadius: displayState.isMobile ? 0 : 1 }, children: [
|
|
4820
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4821
|
+
import_material24.Box,
|
|
4822
|
+
{
|
|
4823
|
+
onClick: () => handleExpandClick(),
|
|
4824
|
+
sx: {
|
|
4825
|
+
cursor: "pointer",
|
|
4826
|
+
"&:hover": { bgcolor: "rgba(0,0,0,0.02)" },
|
|
4827
|
+
display: "flex",
|
|
4828
|
+
alignItems: "center",
|
|
4829
|
+
pr: 2
|
|
4830
|
+
},
|
|
4831
|
+
children: [
|
|
4832
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4833
|
+
import_material24.CardHeader,
|
|
4834
|
+
{
|
|
4835
|
+
sx: { flexGrow: 1 },
|
|
4836
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Avatar, { sx: { bgcolor: "primary.main" }, children: props.icon }),
|
|
4837
|
+
label: typeof props.title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.title }) : props.title,
|
|
4838
|
+
subheader: typeof props.subtitle === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.subtitle }) : props.subtitle
|
|
4839
|
+
}
|
|
4840
|
+
),
|
|
4841
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Tooltip, { title: expanded ? "Show Less" : "Show More", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Box, { sx: { ml: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4842
|
+
ExpandMore,
|
|
4843
|
+
{
|
|
4844
|
+
expand: expanded,
|
|
4845
|
+
onClick: handleExpandClick,
|
|
4846
|
+
"aria-expanded": expanded
|
|
4847
|
+
}
|
|
4848
|
+
) }) })
|
|
4849
|
+
]
|
|
4850
|
+
}
|
|
4851
|
+
),
|
|
4852
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material24.Collapse, { in: expanded, timeout: "auto", children: [
|
|
4853
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Divider, { variant: "middle" }),
|
|
4854
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.CardContent, { children: props.children })
|
|
4855
|
+
] })
|
|
4856
|
+
] });
|
|
4857
|
+
};
|
|
4858
|
+
|
|
4859
|
+
// src/UI/components/buttons/RefreshButtonComponent.tsx
|
|
4860
|
+
var import_react30 = require("react");
|
|
4861
|
+
var import_material25 = require("@mui/material");
|
|
4862
|
+
var import_Refresh = __toESM(require("@mui/icons-material/Refresh"));
|
|
4863
|
+
init_context();
|
|
4864
|
+
init_TranslatableTooltipComponent();
|
|
4865
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4866
|
+
var AnimatedRefreshIcon = (0, import_material25.styled)(import_Refresh.default, {
|
|
4867
|
+
shouldForwardProp: (prop) => prop !== "isSpinning"
|
|
4868
|
+
})(({ isSpinning }) => ({
|
|
4869
|
+
animation: isSpinning ? "spin 1s linear infinite" : "none",
|
|
4870
|
+
"@keyframes spin": {
|
|
4871
|
+
"0%": {
|
|
4872
|
+
transform: "rotate(0deg)"
|
|
4873
|
+
},
|
|
4874
|
+
"100%": {
|
|
4875
|
+
transform: "rotate(360deg)"
|
|
4876
|
+
}
|
|
4877
|
+
}
|
|
4878
|
+
}));
|
|
4879
|
+
var RefreshButtonComponent = ({
|
|
4880
|
+
overrideNamespace,
|
|
4881
|
+
size = "small",
|
|
4882
|
+
onClick,
|
|
4883
|
+
disabled = false,
|
|
4884
|
+
fullWidth = false,
|
|
4885
|
+
loading: externalLoading,
|
|
4886
|
+
tooltip,
|
|
4887
|
+
mobileViewOnly,
|
|
4888
|
+
disableMobileView,
|
|
4889
|
+
hideTooltipOnMobile,
|
|
4890
|
+
hideTooltipOnDesktop
|
|
4891
|
+
}) => {
|
|
4892
|
+
const { displayState } = useAppTheme();
|
|
4893
|
+
const [internalLoading, setInternalLoading] = (0, import_react30.useState)(false);
|
|
4894
|
+
const isLoading = externalLoading !== void 0 ? externalLoading : internalLoading;
|
|
4895
|
+
const handleClick = async (event) => {
|
|
4896
|
+
if (!onClick || isLoading || disabled) return;
|
|
4897
|
+
try {
|
|
4898
|
+
setInternalLoading(true);
|
|
4899
|
+
await onClick(event);
|
|
4900
|
+
} finally {
|
|
4901
|
+
setInternalLoading(false);
|
|
4902
|
+
}
|
|
4903
|
+
};
|
|
4904
|
+
const renderIcon = () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AnimatedRefreshIcon, { fontSize: size, isSpinning: isLoading });
|
|
4905
|
+
if (displayState.isMobile && !disableMobileView || mobileViewOnly) {
|
|
4906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslatableTooltipComponent, { title: hideTooltipOnMobile ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, {}) : tooltip || /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4907
|
+
import_material25.Fab,
|
|
4908
|
+
{
|
|
4909
|
+
size,
|
|
4910
|
+
color: "inherit",
|
|
4911
|
+
onClick: handleClick,
|
|
4912
|
+
disabled: disabled || isLoading,
|
|
4913
|
+
"aria-label": "refresh",
|
|
4914
|
+
children: renderIcon()
|
|
4915
|
+
}
|
|
4916
|
+
) }) });
|
|
4917
|
+
}
|
|
4918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslatableTooltipComponent, { title: hideTooltipOnDesktop ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, {}) : tooltip || /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4919
|
+
import_material25.Button,
|
|
4920
|
+
{
|
|
4921
|
+
variant: "contained",
|
|
4922
|
+
color: "inherit",
|
|
4923
|
+
size,
|
|
4924
|
+
onClick: handleClick,
|
|
4925
|
+
disabled: disabled || isLoading,
|
|
4926
|
+
fullWidth,
|
|
4927
|
+
startIcon: renderIcon(),
|
|
4928
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" })
|
|
4929
|
+
}
|
|
4930
|
+
) });
|
|
4931
|
+
};
|
|
4932
|
+
|
|
4790
4933
|
// src/UI/index.ts
|
|
4791
4934
|
var UI = {
|
|
4792
4935
|
Inputs: {
|
|
@@ -4800,7 +4943,8 @@ var UI = {
|
|
|
4800
4943
|
Url: UrlComponent
|
|
4801
4944
|
},
|
|
4802
4945
|
Buttons: {
|
|
4803
|
-
CopyClipboardButton: CopyClipboardButtonComponent
|
|
4946
|
+
CopyClipboardButton: CopyClipboardButtonComponent,
|
|
4947
|
+
RefreshButton: RefreshButtonComponent
|
|
4804
4948
|
},
|
|
4805
4949
|
DataDisplay: {
|
|
4806
4950
|
TranslatableTooltip: TranslatableTooltipComponent,
|
|
@@ -4820,7 +4964,8 @@ var UI = {
|
|
|
4820
4964
|
PublicLanguageSelector
|
|
4821
4965
|
},
|
|
4822
4966
|
Pages: {
|
|
4823
|
-
PageLinkWidget
|
|
4967
|
+
PageLinkWidget,
|
|
4968
|
+
CollapsedWidgetContainer
|
|
4824
4969
|
}
|
|
4825
4970
|
}
|
|
4826
4971
|
};
|
|
@@ -4848,16 +4993,16 @@ var Services = {
|
|
|
4848
4993
|
};
|
|
4849
4994
|
|
|
4850
4995
|
// src/hooks/useUserStatus.ts
|
|
4851
|
-
var
|
|
4996
|
+
var import_react31 = require("react");
|
|
4852
4997
|
init_deviceId();
|
|
4853
4998
|
init_context();
|
|
4854
4999
|
var ONLINE_THRESHOLD_MINUTES = 2;
|
|
4855
5000
|
var AWAY_THRESHOLD_MINUTES = 15;
|
|
4856
5001
|
var useUserStatus2 = (userId, initialLastSeenAt, currentAuthUserId) => {
|
|
4857
5002
|
const supabase = useSupabase();
|
|
4858
|
-
const [status, setStatus] = (0,
|
|
4859
|
-
const [lastSeen, setLastSeen] = (0,
|
|
4860
|
-
const lastSeenRef = (0,
|
|
5003
|
+
const [status, setStatus] = (0, import_react31.useState)("offline");
|
|
5004
|
+
const [lastSeen, setLastSeen] = (0, import_react31.useState)(initialLastSeenAt ?? null);
|
|
5005
|
+
const lastSeenRef = (0, import_react31.useRef)(initialLastSeenAt ?? null);
|
|
4861
5006
|
lastSeenRef.current = lastSeen;
|
|
4862
5007
|
const calculateStatus = (isOnline, lastSeenIso) => {
|
|
4863
5008
|
if (isOnline) return "online";
|
|
@@ -4873,7 +5018,7 @@ var useUserStatus2 = (userId, initialLastSeenAt, currentAuthUserId) => {
|
|
|
4873
5018
|
}
|
|
4874
5019
|
return "offline";
|
|
4875
5020
|
};
|
|
4876
|
-
(0,
|
|
5021
|
+
(0, import_react31.useEffect)(() => {
|
|
4877
5022
|
if (!userId) return;
|
|
4878
5023
|
let isMounted = true;
|
|
4879
5024
|
const isSelf = currentAuthUserId && userId === currentAuthUserId;
|
|
@@ -4896,9 +5041,9 @@ var useUserStatus2 = (userId, initialLastSeenAt, currentAuthUserId) => {
|
|
|
4896
5041
|
}
|
|
4897
5042
|
};
|
|
4898
5043
|
fetchLastSeen();
|
|
4899
|
-
const
|
|
4900
|
-
|
|
4901
|
-
const state =
|
|
5044
|
+
const channel2 = supabase.channel(`presence_user_${userId}`);
|
|
5045
|
+
channel2.on("presence", { event: "sync" }, () => {
|
|
5046
|
+
const state = channel2.presenceState();
|
|
4902
5047
|
const isOnline = Object.keys(state).length > 0;
|
|
4903
5048
|
if (isMounted) {
|
|
4904
5049
|
setStatus(isOnline ? "online" : calculateStatus(false, lastSeenRef.current));
|
|
@@ -4928,7 +5073,7 @@ var useUserStatus2 = (userId, initialLastSeenAt, currentAuthUserId) => {
|
|
|
4928
5073
|
).subscribe();
|
|
4929
5074
|
return () => {
|
|
4930
5075
|
isMounted = false;
|
|
4931
|
-
supabase.removeChannel(
|
|
5076
|
+
supabase.removeChannel(channel2);
|
|
4932
5077
|
};
|
|
4933
5078
|
}, [userId, initialLastSeenAt, currentAuthUserId]);
|
|
4934
5079
|
return {
|
|
@@ -4943,6 +5088,35 @@ var Hooks = {
|
|
|
4943
5088
|
useDebounce,
|
|
4944
5089
|
useUserStatus: useUserStatus2
|
|
4945
5090
|
};
|
|
5091
|
+
|
|
5092
|
+
// src/utils/index.ts
|
|
5093
|
+
init_deviceId();
|
|
5094
|
+
|
|
5095
|
+
// src/utils/session.events.ts
|
|
5096
|
+
var channel = typeof window !== "undefined" ? new BroadcastChannel("session_activity") : null;
|
|
5097
|
+
var notifySessionChange = () => {
|
|
5098
|
+
channel?.postMessage("SESSION_UPDATED");
|
|
5099
|
+
};
|
|
5100
|
+
var subscribeToSessionChanges = (callback) => {
|
|
5101
|
+
if (!channel) return () => {
|
|
5102
|
+
};
|
|
5103
|
+
const handleMessage = (event) => {
|
|
5104
|
+
if (event.data === "SESSION_UPDATED") {
|
|
5105
|
+
callback();
|
|
5106
|
+
}
|
|
5107
|
+
};
|
|
5108
|
+
channel.addEventListener("message", handleMessage);
|
|
5109
|
+
return () => channel.removeEventListener("message", handleMessage);
|
|
5110
|
+
};
|
|
5111
|
+
|
|
5112
|
+
// src/utils/index.ts
|
|
5113
|
+
var Utils = {
|
|
5114
|
+
getDeviceId,
|
|
5115
|
+
Sessions: {
|
|
5116
|
+
notifySessionChange,
|
|
5117
|
+
subscribeToSessionChanges
|
|
5118
|
+
}
|
|
5119
|
+
};
|
|
4946
5120
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4947
5121
|
0 && (module.exports = {
|
|
4948
5122
|
AIProvider,
|
|
@@ -4962,6 +5136,7 @@ var Hooks = {
|
|
|
4962
5136
|
TranslationEditProvider,
|
|
4963
5137
|
UI,
|
|
4964
5138
|
UserSettingsProvider,
|
|
5139
|
+
Utils,
|
|
4965
5140
|
defaultUserSettings,
|
|
4966
5141
|
initI18n,
|
|
4967
5142
|
useAI,
|
package/dist/index.mjs
CHANGED
|
@@ -156,7 +156,7 @@ var TextFieldComponent = ({
|
|
|
156
156
|
...slotProps?.input || {},
|
|
157
157
|
readOnly: isReadOnly,
|
|
158
158
|
endAdornment: /* @__PURE__ */ jsxs(InputAdornment, { position: "end", sx: { gap: 0.5 }, children: [
|
|
159
|
-
hasValue && !isLocked && !disableClearButton && /* @__PURE__ */ jsx(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx(TranslateText, { overrideNamespace, children: clearTooltip }), children: /* @__PURE__ */ jsx(
|
|
159
|
+
hasValue && !isLocked && !disableClearButton && /* @__PURE__ */ jsx(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: clearTooltip }), children: /* @__PURE__ */ jsx(
|
|
160
160
|
IconButton,
|
|
161
161
|
{
|
|
162
162
|
size: "small",
|
|
@@ -166,7 +166,7 @@ var TextFieldComponent = ({
|
|
|
166
166
|
children: /* @__PURE__ */ jsx(ClearIcon, { fontSize: "small" })
|
|
167
167
|
}
|
|
168
168
|
) }),
|
|
169
|
-
hasValue && /* @__PURE__ */ jsx(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx(TranslateText, { overrideNamespace, children: copied ? copiedTooltip : copyTooltip }), children: /* @__PURE__ */ jsx(
|
|
169
|
+
hasValue && /* @__PURE__ */ jsx(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: copied ? copiedTooltip : copyTooltip }), children: /* @__PURE__ */ jsx(
|
|
170
170
|
IconButton,
|
|
171
171
|
{
|
|
172
172
|
size: "small",
|
|
@@ -216,7 +216,7 @@ var TextFieldComponent = ({
|
|
|
216
216
|
)
|
|
217
217
|
}
|
|
218
218
|
) }),
|
|
219
|
-
isLocked && showLock && /* @__PURE__ */ jsx(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx(TranslateText, { overrideNamespace, children: lockTooltip }), children: /* @__PURE__ */ jsx(
|
|
219
|
+
isLocked && showLock && /* @__PURE__ */ jsx(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: lockTooltip }), children: /* @__PURE__ */ jsx(
|
|
220
220
|
IconButton,
|
|
221
221
|
{
|
|
222
222
|
size: "small",
|
|
@@ -1873,6 +1873,149 @@ var CheckboxComponent = ({
|
|
|
1873
1873
|
) });
|
|
1874
1874
|
};
|
|
1875
1875
|
|
|
1876
|
+
// src/UI/widgets/page/CollapsedWidgetContainer.tsx
|
|
1877
|
+
import { ExpandMore as ExpandMoreIcon } from "@mui/icons-material";
|
|
1878
|
+
import { Avatar as Avatar3, Box as Box8, Card as Card2, CardContent as CardContent2, CardHeader as CardHeader2, Collapse, Divider as Divider2, IconButton as IconButton7, styled, Tooltip as Tooltip7 } from "@mui/material";
|
|
1879
|
+
import { useState as useState11 } from "react";
|
|
1880
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1881
|
+
var ExpandMore = styled((props) => {
|
|
1882
|
+
const { expand, ...other } = props;
|
|
1883
|
+
return /* @__PURE__ */ jsx14(IconButton7, { size: "small", ...other, children: /* @__PURE__ */ jsx14(ExpandMoreIcon, {}) });
|
|
1884
|
+
})(({ theme, expand }) => ({
|
|
1885
|
+
transform: !expand ? "rotate(0deg)" : "rotate(180deg)",
|
|
1886
|
+
transition: theme.transitions.create("transform", {
|
|
1887
|
+
duration: theme.transitions.duration.shortest
|
|
1888
|
+
}),
|
|
1889
|
+
backgroundColor: expand ? theme.palette.primary.main : "transparent",
|
|
1890
|
+
color: expand ? theme.palette.common.white : theme.palette.text.secondary,
|
|
1891
|
+
border: `1px solid ${expand ? theme.palette.primary.main : theme.palette.divider}`,
|
|
1892
|
+
"&:hover": {
|
|
1893
|
+
backgroundColor: expand ? theme.palette.primary.dark : theme.palette.action.hover
|
|
1894
|
+
}
|
|
1895
|
+
}));
|
|
1896
|
+
var CollapsedWidgetContainer = (props) => {
|
|
1897
|
+
const { displayState } = useAppTheme();
|
|
1898
|
+
const [expanded, setExpanded] = useState11(props.expanded === void 0 ? false : props.expanded);
|
|
1899
|
+
const handleExpandClick = () => {
|
|
1900
|
+
setExpanded(!expanded);
|
|
1901
|
+
props.onExpanded && props.onExpanded(!expanded);
|
|
1902
|
+
};
|
|
1903
|
+
return /* @__PURE__ */ jsxs11(Card2, { sx: { width: "100%", overflow: "hidden", mb: 2, boxShadow: displayState.isMobile ? "none" : props.disableShadow ? "none" : "0 20px 25px -5px rgb(0 0 0 / 0.1)", borderRadius: displayState.isMobile ? 0 : 1 }, children: [
|
|
1904
|
+
/* @__PURE__ */ jsxs11(
|
|
1905
|
+
Box8,
|
|
1906
|
+
{
|
|
1907
|
+
onClick: () => handleExpandClick(),
|
|
1908
|
+
sx: {
|
|
1909
|
+
cursor: "pointer",
|
|
1910
|
+
"&:hover": { bgcolor: "rgba(0,0,0,0.02)" },
|
|
1911
|
+
display: "flex",
|
|
1912
|
+
alignItems: "center",
|
|
1913
|
+
pr: 2
|
|
1914
|
+
},
|
|
1915
|
+
children: [
|
|
1916
|
+
/* @__PURE__ */ jsx14(
|
|
1917
|
+
CardHeader2,
|
|
1918
|
+
{
|
|
1919
|
+
sx: { flexGrow: 1 },
|
|
1920
|
+
avatar: /* @__PURE__ */ jsx14(Avatar3, { sx: { bgcolor: "primary.main" }, children: props.icon }),
|
|
1921
|
+
label: typeof props.title === "string" ? /* @__PURE__ */ jsx14(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.title }) : props.title,
|
|
1922
|
+
subheader: typeof props.subtitle === "string" ? /* @__PURE__ */ jsx14(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.subtitle }) : props.subtitle
|
|
1923
|
+
}
|
|
1924
|
+
),
|
|
1925
|
+
/* @__PURE__ */ jsx14(Tooltip7, { title: expanded ? "Show Less" : "Show More", children: /* @__PURE__ */ jsx14(Box8, { sx: { ml: 1 }, children: /* @__PURE__ */ jsx14(
|
|
1926
|
+
ExpandMore,
|
|
1927
|
+
{
|
|
1928
|
+
expand: expanded,
|
|
1929
|
+
onClick: handleExpandClick,
|
|
1930
|
+
"aria-expanded": expanded
|
|
1931
|
+
}
|
|
1932
|
+
) }) })
|
|
1933
|
+
]
|
|
1934
|
+
}
|
|
1935
|
+
),
|
|
1936
|
+
/* @__PURE__ */ jsxs11(Collapse, { in: expanded, timeout: "auto", children: [
|
|
1937
|
+
/* @__PURE__ */ jsx14(Divider2, { variant: "middle" }),
|
|
1938
|
+
/* @__PURE__ */ jsx14(CardContent2, { children: props.children })
|
|
1939
|
+
] })
|
|
1940
|
+
] });
|
|
1941
|
+
};
|
|
1942
|
+
|
|
1943
|
+
// src/UI/components/buttons/RefreshButtonComponent.tsx
|
|
1944
|
+
import { useState as useState12 } from "react";
|
|
1945
|
+
import {
|
|
1946
|
+
Button as Button3,
|
|
1947
|
+
Fab,
|
|
1948
|
+
styled as styled2
|
|
1949
|
+
} from "@mui/material";
|
|
1950
|
+
import RefreshIconMui from "@mui/icons-material/Refresh";
|
|
1951
|
+
import { Fragment as Fragment9, jsx as jsx15 } from "react/jsx-runtime";
|
|
1952
|
+
var AnimatedRefreshIcon = styled2(RefreshIconMui, {
|
|
1953
|
+
shouldForwardProp: (prop) => prop !== "isSpinning"
|
|
1954
|
+
})(({ isSpinning }) => ({
|
|
1955
|
+
animation: isSpinning ? "spin 1s linear infinite" : "none",
|
|
1956
|
+
"@keyframes spin": {
|
|
1957
|
+
"0%": {
|
|
1958
|
+
transform: "rotate(0deg)"
|
|
1959
|
+
},
|
|
1960
|
+
"100%": {
|
|
1961
|
+
transform: "rotate(360deg)"
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
}));
|
|
1965
|
+
var RefreshButtonComponent = ({
|
|
1966
|
+
overrideNamespace,
|
|
1967
|
+
size = "small",
|
|
1968
|
+
onClick,
|
|
1969
|
+
disabled = false,
|
|
1970
|
+
fullWidth = false,
|
|
1971
|
+
loading: externalLoading,
|
|
1972
|
+
tooltip,
|
|
1973
|
+
mobileViewOnly,
|
|
1974
|
+
disableMobileView,
|
|
1975
|
+
hideTooltipOnMobile,
|
|
1976
|
+
hideTooltipOnDesktop
|
|
1977
|
+
}) => {
|
|
1978
|
+
const { displayState } = useAppTheme();
|
|
1979
|
+
const [internalLoading, setInternalLoading] = useState12(false);
|
|
1980
|
+
const isLoading = externalLoading !== void 0 ? externalLoading : internalLoading;
|
|
1981
|
+
const handleClick = async (event) => {
|
|
1982
|
+
if (!onClick || isLoading || disabled) return;
|
|
1983
|
+
try {
|
|
1984
|
+
setInternalLoading(true);
|
|
1985
|
+
await onClick(event);
|
|
1986
|
+
} finally {
|
|
1987
|
+
setInternalLoading(false);
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
const renderIcon = () => /* @__PURE__ */ jsx15(AnimatedRefreshIcon, { fontSize: size, isSpinning: isLoading });
|
|
1991
|
+
if (displayState.isMobile && !disableMobileView || mobileViewOnly) {
|
|
1992
|
+
return /* @__PURE__ */ jsx15(TranslatableTooltipComponent, { title: hideTooltipOnMobile ? /* @__PURE__ */ jsx15(Fragment9, {}) : tooltip || /* @__PURE__ */ jsx15(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ jsx15("span", { children: /* @__PURE__ */ jsx15(
|
|
1993
|
+
Fab,
|
|
1994
|
+
{
|
|
1995
|
+
size,
|
|
1996
|
+
color: "inherit",
|
|
1997
|
+
onClick: handleClick,
|
|
1998
|
+
disabled: disabled || isLoading,
|
|
1999
|
+
"aria-label": "refresh",
|
|
2000
|
+
children: renderIcon()
|
|
2001
|
+
}
|
|
2002
|
+
) }) });
|
|
2003
|
+
}
|
|
2004
|
+
return /* @__PURE__ */ jsx15(TranslatableTooltipComponent, { title: hideTooltipOnDesktop ? /* @__PURE__ */ jsx15(Fragment9, {}) : tooltip || /* @__PURE__ */ jsx15(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ jsx15(
|
|
2005
|
+
Button3,
|
|
2006
|
+
{
|
|
2007
|
+
variant: "contained",
|
|
2008
|
+
color: "inherit",
|
|
2009
|
+
size,
|
|
2010
|
+
onClick: handleClick,
|
|
2011
|
+
disabled: disabled || isLoading,
|
|
2012
|
+
fullWidth,
|
|
2013
|
+
startIcon: renderIcon(),
|
|
2014
|
+
children: /* @__PURE__ */ jsx15(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" })
|
|
2015
|
+
}
|
|
2016
|
+
) });
|
|
2017
|
+
};
|
|
2018
|
+
|
|
1876
2019
|
// src/UI/index.ts
|
|
1877
2020
|
var UI = {
|
|
1878
2021
|
Inputs: {
|
|
@@ -1886,7 +2029,8 @@ var UI = {
|
|
|
1886
2029
|
Url: UrlComponent
|
|
1887
2030
|
},
|
|
1888
2031
|
Buttons: {
|
|
1889
|
-
CopyClipboardButton: CopyClipboardButtonComponent
|
|
2032
|
+
CopyClipboardButton: CopyClipboardButtonComponent,
|
|
2033
|
+
RefreshButton: RefreshButtonComponent
|
|
1890
2034
|
},
|
|
1891
2035
|
DataDisplay: {
|
|
1892
2036
|
TranslatableTooltip: TranslatableTooltipComponent,
|
|
@@ -1906,7 +2050,8 @@ var UI = {
|
|
|
1906
2050
|
PublicLanguageSelector
|
|
1907
2051
|
},
|
|
1908
2052
|
Pages: {
|
|
1909
|
-
PageLinkWidget
|
|
2053
|
+
PageLinkWidget,
|
|
2054
|
+
CollapsedWidgetContainer
|
|
1910
2055
|
}
|
|
1911
2056
|
}
|
|
1912
2057
|
};
|
|
@@ -1926,13 +2071,13 @@ var Services = {
|
|
|
1926
2071
|
};
|
|
1927
2072
|
|
|
1928
2073
|
// src/hooks/useUserStatus.ts
|
|
1929
|
-
import { useEffect as useEffect6, useRef, useState as
|
|
2074
|
+
import { useEffect as useEffect6, useRef, useState as useState13 } from "react";
|
|
1930
2075
|
var ONLINE_THRESHOLD_MINUTES = 2;
|
|
1931
2076
|
var AWAY_THRESHOLD_MINUTES = 15;
|
|
1932
2077
|
var useUserStatus = (userId, initialLastSeenAt, currentAuthUserId) => {
|
|
1933
2078
|
const supabase = useSupabase();
|
|
1934
|
-
const [status, setStatus] =
|
|
1935
|
-
const [lastSeen, setLastSeen] =
|
|
2079
|
+
const [status, setStatus] = useState13("offline");
|
|
2080
|
+
const [lastSeen, setLastSeen] = useState13(initialLastSeenAt ?? null);
|
|
1936
2081
|
const lastSeenRef = useRef(initialLastSeenAt ?? null);
|
|
1937
2082
|
lastSeenRef.current = lastSeen;
|
|
1938
2083
|
const calculateStatus = (isOnline, lastSeenIso) => {
|
|
@@ -1972,9 +2117,9 @@ var useUserStatus = (userId, initialLastSeenAt, currentAuthUserId) => {
|
|
|
1972
2117
|
}
|
|
1973
2118
|
};
|
|
1974
2119
|
fetchLastSeen();
|
|
1975
|
-
const
|
|
1976
|
-
|
|
1977
|
-
const state =
|
|
2120
|
+
const channel2 = supabase.channel(`presence_user_${userId}`);
|
|
2121
|
+
channel2.on("presence", { event: "sync" }, () => {
|
|
2122
|
+
const state = channel2.presenceState();
|
|
1978
2123
|
const isOnline = Object.keys(state).length > 0;
|
|
1979
2124
|
if (isMounted) {
|
|
1980
2125
|
setStatus(isOnline ? "online" : calculateStatus(false, lastSeenRef.current));
|
|
@@ -2004,7 +2149,7 @@ var useUserStatus = (userId, initialLastSeenAt, currentAuthUserId) => {
|
|
|
2004
2149
|
).subscribe();
|
|
2005
2150
|
return () => {
|
|
2006
2151
|
isMounted = false;
|
|
2007
|
-
supabase.removeChannel(
|
|
2152
|
+
supabase.removeChannel(channel2);
|
|
2008
2153
|
};
|
|
2009
2154
|
}, [userId, initialLastSeenAt, currentAuthUserId]);
|
|
2010
2155
|
return {
|
|
@@ -2019,6 +2164,32 @@ var Hooks = {
|
|
|
2019
2164
|
useDebounce,
|
|
2020
2165
|
useUserStatus
|
|
2021
2166
|
};
|
|
2167
|
+
|
|
2168
|
+
// src/utils/session.events.ts
|
|
2169
|
+
var channel = typeof window !== "undefined" ? new BroadcastChannel("session_activity") : null;
|
|
2170
|
+
var notifySessionChange = () => {
|
|
2171
|
+
channel?.postMessage("SESSION_UPDATED");
|
|
2172
|
+
};
|
|
2173
|
+
var subscribeToSessionChanges = (callback) => {
|
|
2174
|
+
if (!channel) return () => {
|
|
2175
|
+
};
|
|
2176
|
+
const handleMessage = (event) => {
|
|
2177
|
+
if (event.data === "SESSION_UPDATED") {
|
|
2178
|
+
callback();
|
|
2179
|
+
}
|
|
2180
|
+
};
|
|
2181
|
+
channel.addEventListener("message", handleMessage);
|
|
2182
|
+
return () => channel.removeEventListener("message", handleMessage);
|
|
2183
|
+
};
|
|
2184
|
+
|
|
2185
|
+
// src/utils/index.ts
|
|
2186
|
+
var Utils = {
|
|
2187
|
+
getDeviceId,
|
|
2188
|
+
Sessions: {
|
|
2189
|
+
notifySessionChange,
|
|
2190
|
+
subscribeToSessionChanges
|
|
2191
|
+
}
|
|
2192
|
+
};
|
|
2022
2193
|
export {
|
|
2023
2194
|
AIProvider,
|
|
2024
2195
|
AppSettingsProvider,
|
|
@@ -2037,6 +2208,7 @@ export {
|
|
|
2037
2208
|
TranslationEditProvider,
|
|
2038
2209
|
UI,
|
|
2039
2210
|
UserSettingsProvider,
|
|
2211
|
+
Utils,
|
|
2040
2212
|
defaultUserSettings,
|
|
2041
2213
|
initI18n,
|
|
2042
2214
|
useAI,
|