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