analytica-frontend-lib 1.1.47 → 1.1.49
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/hooks/useTheme/index.d.mts +8 -0
- package/dist/hooks/useTheme/index.d.ts +8 -0
- package/dist/hooks/useTheme/index.js +52 -0
- package/dist/hooks/useTheme/index.js.map +1 -0
- package/dist/hooks/useTheme/index.mjs +27 -0
- package/dist/hooks/useTheme/index.mjs.map +1 -0
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +180 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5986,10 +5986,34 @@ var useMobile = () => {
|
|
|
5986
5986
|
};
|
|
5987
5987
|
};
|
|
5988
5988
|
|
|
5989
|
+
// src/hooks/useTheme.ts
|
|
5990
|
+
import { useEffect as useEffect10 } from "react";
|
|
5991
|
+
var useTheme = () => {
|
|
5992
|
+
useEffect10(() => {
|
|
5993
|
+
const htmlElement = document.documentElement;
|
|
5994
|
+
const currentTheme = htmlElement.getAttribute("data-theme");
|
|
5995
|
+
if (currentTheme && !htmlElement.getAttribute("data-original-theme")) {
|
|
5996
|
+
htmlElement.setAttribute("data-original-theme", currentTheme);
|
|
5997
|
+
}
|
|
5998
|
+
const applyTheme = () => {
|
|
5999
|
+
const isDarkMode = window.matchMedia(
|
|
6000
|
+
"(prefers-color-scheme: dark)"
|
|
6001
|
+
).matches;
|
|
6002
|
+
const originalTheme = htmlElement.getAttribute("data-original-theme");
|
|
6003
|
+
if (isDarkMode) {
|
|
6004
|
+
htmlElement.setAttribute("data-theme", "dark");
|
|
6005
|
+
} else if (originalTheme) {
|
|
6006
|
+
htmlElement.setAttribute("data-theme", originalTheme);
|
|
6007
|
+
}
|
|
6008
|
+
};
|
|
6009
|
+
applyTheme();
|
|
6010
|
+
}, []);
|
|
6011
|
+
};
|
|
6012
|
+
|
|
5989
6013
|
// src/components/Select/Select.tsx
|
|
5990
6014
|
import { create as create5, useStore as useStore4 } from "zustand";
|
|
5991
6015
|
import {
|
|
5992
|
-
useEffect as
|
|
6016
|
+
useEffect as useEffect11,
|
|
5993
6017
|
useRef as useRef7,
|
|
5994
6018
|
forwardRef as forwardRef16,
|
|
5995
6019
|
isValidElement as isValidElement4,
|
|
@@ -6120,13 +6144,13 @@ var Select = ({
|
|
|
6120
6144
|
search(children2);
|
|
6121
6145
|
return found;
|
|
6122
6146
|
};
|
|
6123
|
-
|
|
6147
|
+
useEffect11(() => {
|
|
6124
6148
|
if (!selectedLabel && defaultValue) {
|
|
6125
6149
|
const label2 = findLabelForValue(children, defaultValue);
|
|
6126
6150
|
if (label2) store.setState({ selectedLabel: label2 });
|
|
6127
6151
|
}
|
|
6128
6152
|
}, [children, defaultValue, selectedLabel]);
|
|
6129
|
-
|
|
6153
|
+
useEffect11(() => {
|
|
6130
6154
|
const handleClickOutside = (event) => {
|
|
6131
6155
|
if (selectRef.current && !selectRef.current.contains(event.target)) {
|
|
6132
6156
|
setOpen(false);
|
|
@@ -6161,7 +6185,7 @@ var Select = ({
|
|
|
6161
6185
|
document.removeEventListener("keydown", handleArrowKeys);
|
|
6162
6186
|
};
|
|
6163
6187
|
}, [open]);
|
|
6164
|
-
|
|
6188
|
+
useEffect11(() => {
|
|
6165
6189
|
if (propValue) {
|
|
6166
6190
|
setValue(propValue);
|
|
6167
6191
|
const label2 = findLabelForValue(children, propValue);
|
|
@@ -6342,7 +6366,7 @@ var Select_default = Select;
|
|
|
6342
6366
|
// src/components/Menu/Menu.tsx
|
|
6343
6367
|
import { create as create6, useStore as useStore5 } from "zustand";
|
|
6344
6368
|
import {
|
|
6345
|
-
useEffect as
|
|
6369
|
+
useEffect as useEffect12,
|
|
6346
6370
|
useRef as useRef8,
|
|
6347
6371
|
forwardRef as forwardRef17,
|
|
6348
6372
|
isValidElement as isValidElement5,
|
|
@@ -6384,7 +6408,7 @@ var Menu = forwardRef17(
|
|
|
6384
6408
|
storeRef.current ??= createMenuStore(onValueChange);
|
|
6385
6409
|
const store = storeRef.current;
|
|
6386
6410
|
const { setValue } = useStore5(store, (s) => s);
|
|
6387
|
-
|
|
6411
|
+
useEffect12(() => {
|
|
6388
6412
|
setValue(propValue ?? defaultValue);
|
|
6389
6413
|
}, [defaultValue, propValue, setValue]);
|
|
6390
6414
|
const baseClasses = variant === "menu-overflow" ? "w-fit py-2 flex flex-row items-center justify-center" : "w-full py-2 flex flex-row items-center justify-center";
|
|
@@ -6588,7 +6612,7 @@ var MenuOverflow = ({
|
|
|
6588
6612
|
const containerRef = useRef8(null);
|
|
6589
6613
|
const [showLeftArrow, setShowLeftArrow] = useState13(false);
|
|
6590
6614
|
const [showRightArrow, setShowRightArrow] = useState13(false);
|
|
6591
|
-
|
|
6615
|
+
useEffect12(() => {
|
|
6592
6616
|
const checkScroll = () => internalCheckScroll(
|
|
6593
6617
|
containerRef.current,
|
|
6594
6618
|
setShowLeftArrow,
|
|
@@ -6916,7 +6940,7 @@ var NotFound_default = NotFound;
|
|
|
6916
6940
|
import {
|
|
6917
6941
|
useRef as useRef9,
|
|
6918
6942
|
useState as useState14,
|
|
6919
|
-
useEffect as
|
|
6943
|
+
useEffect as useEffect13,
|
|
6920
6944
|
useCallback
|
|
6921
6945
|
} from "react";
|
|
6922
6946
|
import {
|
|
@@ -7042,7 +7066,7 @@ var VideoPlayer = ({
|
|
|
7042
7066
|
const [showControls, setShowControls] = useState14(true);
|
|
7043
7067
|
const [hasCompleted, setHasCompleted] = useState14(false);
|
|
7044
7068
|
const [showCaptions, setShowCaptions] = useState14(false);
|
|
7045
|
-
|
|
7069
|
+
useEffect13(() => {
|
|
7046
7070
|
setHasCompleted(false);
|
|
7047
7071
|
}, [src]);
|
|
7048
7072
|
const [playbackRate, setPlaybackRate] = useState14(1);
|
|
@@ -7114,13 +7138,13 @@ var VideoPlayer = ({
|
|
|
7114
7138
|
}, LEAVE_HIDE_TIMEOUT);
|
|
7115
7139
|
}
|
|
7116
7140
|
}, [isFullscreen, clearControlsTimeout, isUserInteracting]);
|
|
7117
|
-
|
|
7141
|
+
useEffect13(() => {
|
|
7118
7142
|
if (videoRef.current) {
|
|
7119
7143
|
videoRef.current.volume = volume;
|
|
7120
7144
|
videoRef.current.muted = isMuted;
|
|
7121
7145
|
}
|
|
7122
7146
|
}, [volume, isMuted]);
|
|
7123
|
-
|
|
7147
|
+
useEffect13(() => {
|
|
7124
7148
|
const video = videoRef.current;
|
|
7125
7149
|
if (!video) return;
|
|
7126
7150
|
const onPlay = () => setIsPlaying(true);
|
|
@@ -7135,7 +7159,7 @@ var VideoPlayer = ({
|
|
|
7135
7159
|
video.removeEventListener("ended", onEnded);
|
|
7136
7160
|
};
|
|
7137
7161
|
}, []);
|
|
7138
|
-
|
|
7162
|
+
useEffect13(() => {
|
|
7139
7163
|
if (isPlaying) {
|
|
7140
7164
|
showControlsWithTimer();
|
|
7141
7165
|
} else {
|
|
@@ -7147,7 +7171,7 @@ var VideoPlayer = ({
|
|
|
7147
7171
|
}
|
|
7148
7172
|
}
|
|
7149
7173
|
}, [isPlaying, isFullscreen, showControlsWithTimer, clearControlsTimeout]);
|
|
7150
|
-
|
|
7174
|
+
useEffect13(() => {
|
|
7151
7175
|
const handleFullscreenChange = () => {
|
|
7152
7176
|
const isCurrentlyFullscreen = !!document.fullscreenElement;
|
|
7153
7177
|
setIsFullscreen(isCurrentlyFullscreen);
|
|
@@ -7160,7 +7184,7 @@ var VideoPlayer = ({
|
|
|
7160
7184
|
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
7161
7185
|
};
|
|
7162
7186
|
}, [showControlsWithTimer]);
|
|
7163
|
-
|
|
7187
|
+
useEffect13(() => {
|
|
7164
7188
|
const init = () => {
|
|
7165
7189
|
if (!isFullscreen) {
|
|
7166
7190
|
showControlsWithTimer();
|
|
@@ -7193,7 +7217,7 @@ var VideoPlayer = ({
|
|
|
7193
7217
|
if (hasValidSaved) return saved;
|
|
7194
7218
|
return void 0;
|
|
7195
7219
|
}, [autoSave, storageKey, src, initialTime]);
|
|
7196
|
-
|
|
7220
|
+
useEffect13(() => {
|
|
7197
7221
|
const start = getInitialTime();
|
|
7198
7222
|
if (start !== void 0 && videoRef.current) {
|
|
7199
7223
|
videoRef.current.currentTime = start;
|
|
@@ -7314,12 +7338,12 @@ var VideoPlayer = ({
|
|
|
7314
7338
|
setDuration(videoRef.current.duration);
|
|
7315
7339
|
}
|
|
7316
7340
|
}, []);
|
|
7317
|
-
|
|
7341
|
+
useEffect13(() => {
|
|
7318
7342
|
if (trackRef.current?.track) {
|
|
7319
7343
|
trackRef.current.track.mode = showCaptions && subtitles ? "showing" : "hidden";
|
|
7320
7344
|
}
|
|
7321
7345
|
}, [subtitles, showCaptions]);
|
|
7322
|
-
|
|
7346
|
+
useEffect13(() => {
|
|
7323
7347
|
const handleVisibilityChange = () => {
|
|
7324
7348
|
if (document.hidden && isPlaying && videoRef.current) {
|
|
7325
7349
|
videoRef.current.pause();
|
|
@@ -7693,7 +7717,7 @@ var Whiteboard_default = Whiteboard;
|
|
|
7693
7717
|
import {
|
|
7694
7718
|
createContext,
|
|
7695
7719
|
useContext,
|
|
7696
|
-
useEffect as
|
|
7720
|
+
useEffect as useEffect14,
|
|
7697
7721
|
useState as useState16,
|
|
7698
7722
|
useCallback as useCallback3,
|
|
7699
7723
|
useMemo as useMemo4
|
|
@@ -7758,7 +7782,7 @@ var AuthProvider = ({
|
|
|
7758
7782
|
tokens: void 0
|
|
7759
7783
|
}));
|
|
7760
7784
|
}, [signOutFn]);
|
|
7761
|
-
|
|
7785
|
+
useEffect14(() => {
|
|
7762
7786
|
checkAuth();
|
|
7763
7787
|
}, [checkAuth]);
|
|
7764
7788
|
const contextValue = useMemo4(
|
|
@@ -7912,7 +7936,7 @@ function createZustandAuthAdapter(useAuthStore) {
|
|
|
7912
7936
|
}
|
|
7913
7937
|
|
|
7914
7938
|
// src/components/Auth/useUrlAuthentication.ts
|
|
7915
|
-
import { useEffect as
|
|
7939
|
+
import { useEffect as useEffect15, useRef as useRef10 } from "react";
|
|
7916
7940
|
import { useLocation as useLocation2 } from "react-router-dom";
|
|
7917
7941
|
var getAuthParams = (location, extractParams) => {
|
|
7918
7942
|
const searchParams = new URLSearchParams(location.search);
|
|
@@ -7961,7 +7985,7 @@ var handleUserData = (responseData, setUser) => {
|
|
|
7961
7985
|
function useUrlAuthentication(options) {
|
|
7962
7986
|
const location = useLocation2();
|
|
7963
7987
|
const processedRef = useRef10(false);
|
|
7964
|
-
|
|
7988
|
+
useEffect15(() => {
|
|
7965
7989
|
const handleAuthentication = async () => {
|
|
7966
7990
|
if (processedRef.current) {
|
|
7967
7991
|
return;
|
|
@@ -8054,7 +8078,7 @@ import {
|
|
|
8054
8078
|
} from "phosphor-react";
|
|
8055
8079
|
import {
|
|
8056
8080
|
forwardRef as forwardRef19,
|
|
8057
|
-
useEffect as
|
|
8081
|
+
useEffect as useEffect16,
|
|
8058
8082
|
useMemo as useMemo6,
|
|
8059
8083
|
useId as useId10,
|
|
8060
8084
|
useState as useState17,
|
|
@@ -8717,7 +8741,7 @@ var getStatusStyles = (variantCorrect) => {
|
|
|
8717
8741
|
};
|
|
8718
8742
|
var Quiz = forwardRef19(({ children, className, variant = "default", ...props }, ref) => {
|
|
8719
8743
|
const { setVariant } = useQuizStore();
|
|
8720
|
-
|
|
8744
|
+
useEffect16(() => {
|
|
8721
8745
|
setVariant(variant);
|
|
8722
8746
|
}, [variant, setVariant]);
|
|
8723
8747
|
return /* @__PURE__ */ jsx39("div", { ref, className: cn("flex flex-col", className), ...props, children });
|
|
@@ -8726,7 +8750,7 @@ var QuizHeaderResult = forwardRef19(
|
|
|
8726
8750
|
({ className, ...props }, ref) => {
|
|
8727
8751
|
const { getQuestionResultByQuestionId, getCurrentQuestion } = useQuizStore();
|
|
8728
8752
|
const [status, setStatus] = useState17(void 0);
|
|
8729
|
-
|
|
8753
|
+
useEffect16(() => {
|
|
8730
8754
|
const cq = getCurrentQuestion();
|
|
8731
8755
|
if (!cq) {
|
|
8732
8756
|
setStatus(void 0);
|
|
@@ -9077,7 +9101,7 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
9077
9101
|
textareaRef.current.style.height = `${newHeight}px`;
|
|
9078
9102
|
}
|
|
9079
9103
|
}, []);
|
|
9080
|
-
|
|
9104
|
+
useEffect16(() => {
|
|
9081
9105
|
adjustTextareaHeight();
|
|
9082
9106
|
}, [currentAnswer, adjustTextareaHeight]);
|
|
9083
9107
|
if (!currentQuestion) {
|
|
@@ -10243,7 +10267,7 @@ var loadingModal_default = LoadingModal;
|
|
|
10243
10267
|
|
|
10244
10268
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
10245
10269
|
import { DotsThreeVertical as DotsThreeVertical3, Bell as Bell2 } from "phosphor-react";
|
|
10246
|
-
import { useState as useState18, useEffect as
|
|
10270
|
+
import { useState as useState18, useEffect as useEffect17 } from "react";
|
|
10247
10271
|
|
|
10248
10272
|
// src/store/notificationStore.ts
|
|
10249
10273
|
import { create as create8 } from "zustand";
|
|
@@ -10690,7 +10714,7 @@ var NotificationCenter = ({
|
|
|
10690
10714
|
const handleDesktopClick = () => {
|
|
10691
10715
|
onToggleActive?.();
|
|
10692
10716
|
};
|
|
10693
|
-
|
|
10717
|
+
useEffect17(() => {
|
|
10694
10718
|
if (isActive) {
|
|
10695
10719
|
onFetchNotifications?.();
|
|
10696
10720
|
}
|
|
@@ -10896,7 +10920,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
10896
10920
|
getGroupedNotifications
|
|
10897
10921
|
} = useNotificationStore();
|
|
10898
10922
|
const handleNavigate = useCallback5(
|
|
10899
|
-
(entityType, entityId) => {
|
|
10923
|
+
(entityType, entityId, onAfterNavigate) => {
|
|
10900
10924
|
if (entityType && entityId) {
|
|
10901
10925
|
switch (entityType.toUpperCase()) {
|
|
10902
10926
|
case "ACTIVITY" /* ACTIVITY */:
|
|
@@ -10908,6 +10932,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
10908
10932
|
default:
|
|
10909
10933
|
break;
|
|
10910
10934
|
}
|
|
10935
|
+
onAfterNavigate?.();
|
|
10911
10936
|
}
|
|
10912
10937
|
},
|
|
10913
10938
|
[]
|
|
@@ -10927,10 +10952,10 @@ var createUseNotifications = (apiClient) => {
|
|
|
10927
10952
|
[]
|
|
10928
10953
|
);
|
|
10929
10954
|
const markAsReadAndNavigate = useCallback5(
|
|
10930
|
-
async (id, entityType, entityId) => {
|
|
10955
|
+
async (id, entityType, entityId, onAfterNavigate) => {
|
|
10931
10956
|
await markAsRead(id);
|
|
10932
10957
|
if (entityType && entityId) {
|
|
10933
|
-
handleNavigate(entityType, entityId);
|
|
10958
|
+
handleNavigate(entityType, entityId, onAfterNavigate);
|
|
10934
10959
|
}
|
|
10935
10960
|
},
|
|
10936
10961
|
[markAsRead, handleNavigate]
|
|
@@ -11102,6 +11127,7 @@ export {
|
|
|
11102
11127
|
useMobile,
|
|
11103
11128
|
useQuizStore,
|
|
11104
11129
|
useRouteAuth,
|
|
11130
|
+
useTheme,
|
|
11105
11131
|
ToastStore_default as useToastStore,
|
|
11106
11132
|
useUrlAuthentication,
|
|
11107
11133
|
withAuth
|