@djangocfg/api 2.1.233 → 2.1.234
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/auth-server.cjs +7 -2
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +7 -2
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +9 -6
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +9 -6
- package/dist/auth.mjs.map +1 -1
- package/package.json +2 -2
- package/src/auth/context/AuthContext.tsx +2 -1
- package/src/auth/hooks/useBase64.ts +1 -1
- package/src/auth/utils/analytics.ts +3 -2
- package/src/auth/utils/env.ts +3 -0
- package/src/auth/utils/logger.ts +1 -1
package/dist/auth.mjs
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
4
|
|
|
5
|
+
// src/auth/utils/env.ts
|
|
6
|
+
var isDev = process.env.NODE_ENV === "development";
|
|
7
|
+
var isProd = process.env.NODE_ENV === "production";
|
|
8
|
+
var isBrowser = typeof window !== "undefined";
|
|
9
|
+
|
|
5
10
|
// src/auth/context/AuthContext.tsx
|
|
6
11
|
import { usePathname as usePathname3 } from "next/navigation";
|
|
7
12
|
import {
|
|
@@ -203,9 +208,8 @@ import { useCallback as useCallback5, useEffect as useEffect4, useRef as useRef3
|
|
|
203
208
|
|
|
204
209
|
// src/auth/utils/logger.ts
|
|
205
210
|
import { createConsola } from "consola";
|
|
206
|
-
var isDevelopment = process.env.NODE_ENV === "development";
|
|
207
211
|
var isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
|
|
208
|
-
var showLogs =
|
|
212
|
+
var showLogs = isDev || isStaticBuild;
|
|
209
213
|
var logger = createConsola({
|
|
210
214
|
level: showLogs ? 4 : 1
|
|
211
215
|
// dev: debug, production: errors only
|
|
@@ -3758,7 +3762,7 @@ var Analytics = {
|
|
|
3758
3762
|
* Track an analytics event
|
|
3759
3763
|
*/
|
|
3760
3764
|
event(eventName, params) {
|
|
3761
|
-
if (
|
|
3765
|
+
if (isDev) {
|
|
3762
3766
|
console.log("[Analytics]", eventName, params);
|
|
3763
3767
|
}
|
|
3764
3768
|
},
|
|
@@ -3766,7 +3770,7 @@ var Analytics = {
|
|
|
3766
3770
|
* Set user ID for tracking
|
|
3767
3771
|
*/
|
|
3768
3772
|
setUser(userId) {
|
|
3769
|
-
if (
|
|
3773
|
+
if (isDev) {
|
|
3770
3774
|
console.log("[Analytics] Set user:", userId);
|
|
3771
3775
|
}
|
|
3772
3776
|
}
|
|
@@ -4851,7 +4855,6 @@ function useLocalStorage(key, initialValue) {
|
|
|
4851
4855
|
__name(useLocalStorage, "useLocalStorage");
|
|
4852
4856
|
|
|
4853
4857
|
// src/auth/hooks/useBase64.ts
|
|
4854
|
-
var isDev = process.env.NODE_ENV === "development";
|
|
4855
4858
|
function encodeBase64(data) {
|
|
4856
4859
|
if (isDev) {
|
|
4857
4860
|
return data;
|
|
@@ -5754,7 +5757,7 @@ var defaultAuthState = {
|
|
|
5754
5757
|
var useAuth = /* @__PURE__ */ __name(() => {
|
|
5755
5758
|
const context = useContext2(AuthContext);
|
|
5756
5759
|
if (context === void 0) {
|
|
5757
|
-
if (
|
|
5760
|
+
if (isBrowser && isDev) {
|
|
5758
5761
|
authLogger.debug("useAuth called outside AuthProvider, returning default state");
|
|
5759
5762
|
}
|
|
5760
5763
|
return defaultAuthState;
|