@djangocfg/api 2.1.232 → 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/README.md +6 -0
- 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.cjs
CHANGED
|
@@ -71,6 +71,11 @@ __export(auth_exports, {
|
|
|
71
71
|
});
|
|
72
72
|
module.exports = __toCommonJS(auth_exports);
|
|
73
73
|
|
|
74
|
+
// src/auth/utils/env.ts
|
|
75
|
+
var isDev = process.env.NODE_ENV === "development";
|
|
76
|
+
var isProd = process.env.NODE_ENV === "production";
|
|
77
|
+
var isBrowser = typeof window !== "undefined";
|
|
78
|
+
|
|
74
79
|
// src/auth/context/AuthContext.tsx
|
|
75
80
|
var import_navigation4 = require("next/navigation");
|
|
76
81
|
var import_react17 = require("react");
|
|
@@ -264,9 +269,8 @@ var import_react7 = require("react");
|
|
|
264
269
|
|
|
265
270
|
// src/auth/utils/logger.ts
|
|
266
271
|
var import_consola = require("consola");
|
|
267
|
-
var isDevelopment = process.env.NODE_ENV === "development";
|
|
268
272
|
var isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
|
|
269
|
-
var showLogs =
|
|
273
|
+
var showLogs = isDev || isStaticBuild;
|
|
270
274
|
var logger = (0, import_consola.createConsola)({
|
|
271
275
|
level: showLogs ? 4 : 1
|
|
272
276
|
// dev: debug, production: errors only
|
|
@@ -3819,7 +3823,7 @@ var Analytics = {
|
|
|
3819
3823
|
* Track an analytics event
|
|
3820
3824
|
*/
|
|
3821
3825
|
event(eventName, params) {
|
|
3822
|
-
if (
|
|
3826
|
+
if (isDev) {
|
|
3823
3827
|
console.log("[Analytics]", eventName, params);
|
|
3824
3828
|
}
|
|
3825
3829
|
},
|
|
@@ -3827,7 +3831,7 @@ var Analytics = {
|
|
|
3827
3831
|
* Set user ID for tracking
|
|
3828
3832
|
*/
|
|
3829
3833
|
setUser(userId) {
|
|
3830
|
-
if (
|
|
3834
|
+
if (isDev) {
|
|
3831
3835
|
console.log("[Analytics] Set user:", userId);
|
|
3832
3836
|
}
|
|
3833
3837
|
}
|
|
@@ -4912,7 +4916,6 @@ function useLocalStorage(key, initialValue) {
|
|
|
4912
4916
|
__name(useLocalStorage, "useLocalStorage");
|
|
4913
4917
|
|
|
4914
4918
|
// src/auth/hooks/useBase64.ts
|
|
4915
|
-
var isDev = process.env.NODE_ENV === "development";
|
|
4916
4919
|
function encodeBase64(data) {
|
|
4917
4920
|
if (isDev) {
|
|
4918
4921
|
return data;
|
|
@@ -5808,7 +5811,7 @@ var defaultAuthState = {
|
|
|
5808
5811
|
var useAuth = /* @__PURE__ */ __name(() => {
|
|
5809
5812
|
const context = (0, import_react17.useContext)(AuthContext);
|
|
5810
5813
|
if (context === void 0) {
|
|
5811
|
-
if (
|
|
5814
|
+
if (isBrowser && isDev) {
|
|
5812
5815
|
authLogger.debug("useAuth called outside AuthProvider, returning default state");
|
|
5813
5816
|
}
|
|
5814
5817
|
return defaultAuthState;
|