@nocios/crudify-ui 3.0.2 → 3.0.6

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.js CHANGED
@@ -1547,7 +1547,15 @@ var useCrudifyLogin = (config, _options = {}) => {
1547
1547
  console.log("\u{1F50D} useCrudifyLogin - Input config:", config);
1548
1548
  const finalConfig = (0, import_react9.useMemo)(() => {
1549
1549
  const publicApiKey = config.publicApiKey || import_crudify_browser2.default?.publicApiKey || import_crudify_browser2.default?.apiKey || getCookie("publicApiKey") || null;
1550
- const rawEnv = config.env || getCookie("environment") || "prod";
1550
+ let detectedEnv = "prod";
1551
+ if (config.env) {
1552
+ detectedEnv = config.env;
1553
+ } else if (getCookie("environment")) {
1554
+ detectedEnv = getCookie("environment") || "prod";
1555
+ } else if (typeof process !== "undefined" && process.env && process.env.NODE_ENV === "development") {
1556
+ detectedEnv = "dev";
1557
+ }
1558
+ const rawEnv = detectedEnv;
1551
1559
  const env = ["dev", "stg", "prod"].includes(rawEnv) ? rawEnv : "prod";
1552
1560
  const appName = config.appName || getCookie("appName") || "Crudia";
1553
1561
  const loginActions = config.loginActions || (() => {
@@ -1567,7 +1575,12 @@ var useCrudifyLogin = (config, _options = {}) => {
1567
1575
  "cookie:",
1568
1576
  getCookie("publicApiKey")
1569
1577
  );
1570
- console.log("\u{1F50D} useCrudifyLogin - Final env:", env, "from rawEnv:", rawEnv);
1578
+ console.log("\u{1F50D} useCrudifyLogin - Environment detection:");
1579
+ console.log(" - config.env:", config.env);
1580
+ console.log(" - cookie environment:", getCookie("environment"));
1581
+ console.log(" - NODE_ENV:", typeof process !== "undefined" ? process.env?.NODE_ENV : "undefined");
1582
+ console.log(" - detectedEnv:", detectedEnv);
1583
+ console.log(" - final env:", env);
1571
1584
  const finalResult = {
1572
1585
  publicApiKey,
1573
1586
  env,
package/dist/index.mjs CHANGED
@@ -1481,7 +1481,15 @@ var useCrudifyLogin = (config, _options = {}) => {
1481
1481
  console.log("\u{1F50D} useCrudifyLogin - Input config:", config);
1482
1482
  const finalConfig = useMemo2(() => {
1483
1483
  const publicApiKey = config.publicApiKey || crudify2?.publicApiKey || crudify2?.apiKey || getCookie("publicApiKey") || null;
1484
- const rawEnv = config.env || getCookie("environment") || "prod";
1484
+ let detectedEnv = "prod";
1485
+ if (config.env) {
1486
+ detectedEnv = config.env;
1487
+ } else if (getCookie("environment")) {
1488
+ detectedEnv = getCookie("environment") || "prod";
1489
+ } else if (typeof process !== "undefined" && process.env && process.env.NODE_ENV === "development") {
1490
+ detectedEnv = "dev";
1491
+ }
1492
+ const rawEnv = detectedEnv;
1485
1493
  const env = ["dev", "stg", "prod"].includes(rawEnv) ? rawEnv : "prod";
1486
1494
  const appName = config.appName || getCookie("appName") || "Crudia";
1487
1495
  const loginActions = config.loginActions || (() => {
@@ -1501,7 +1509,12 @@ var useCrudifyLogin = (config, _options = {}) => {
1501
1509
  "cookie:",
1502
1510
  getCookie("publicApiKey")
1503
1511
  );
1504
- console.log("\u{1F50D} useCrudifyLogin - Final env:", env, "from rawEnv:", rawEnv);
1512
+ console.log("\u{1F50D} useCrudifyLogin - Environment detection:");
1513
+ console.log(" - config.env:", config.env);
1514
+ console.log(" - cookie environment:", getCookie("environment"));
1515
+ console.log(" - NODE_ENV:", typeof process !== "undefined" ? process.env?.NODE_ENV : "undefined");
1516
+ console.log(" - detectedEnv:", detectedEnv);
1517
+ console.log(" - final env:", env);
1505
1518
  const finalResult = {
1506
1519
  publicApiKey,
1507
1520
  env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-ui",
3
- "version": "3.0.2",
3
+ "version": "3.0.6",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",