@nocios/crudify-ui 3.0.0 → 3.0.2

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
@@ -1546,35 +1546,28 @@ var import_crudify_browser2 = __toESM(require("@nocios/crudify-browser"));
1546
1546
  var useCrudifyLogin = (config, _options = {}) => {
1547
1547
  console.log("\u{1F50D} useCrudifyLogin - Input config:", config);
1548
1548
  const finalConfig = (0, import_react9.useMemo)(() => {
1549
- let crudifyConfig = null;
1550
- try {
1551
- if (import_crudify_browser2.default && import_crudify_browser2.default.config) {
1552
- crudifyConfig = import_crudify_browser2.default.config;
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";
1551
+ const env = ["dev", "stg", "prod"].includes(rawEnv) ? rawEnv : "prod";
1552
+ const appName = config.appName || getCookie("appName") || "Crudia";
1553
+ const loginActions = config.loginActions || (() => {
1554
+ try {
1555
+ const cookieValue = getCookie("loginActions");
1556
+ return cookieValue ? cookieValue.split(",").map((action) => action.trim()).filter(Boolean) : [];
1557
+ } catch {
1558
+ return [];
1553
1559
  }
1554
- } catch (error) {
1555
- console.log("\u{1F50D} useCrudifyLogin - No crudify instance config available:", error);
1556
- }
1557
- const publicApiKey = config.publicApiKey || crudifyConfig?.publicApiKey || getCookie("publicApiKey") || null;
1560
+ })();
1558
1561
  console.log("\u{1F50D} useCrudifyLogin - Resolved publicApiKey:", publicApiKey);
1559
1562
  console.log(
1560
1563
  "\u{1F50D} useCrudifyLogin - Sources - props:",
1561
1564
  config.publicApiKey,
1562
1565
  "crudify:",
1563
- crudifyConfig?.publicApiKey,
1566
+ import_crudify_browser2.default?.publicApiKey,
1564
1567
  "cookie:",
1565
1568
  getCookie("publicApiKey")
1566
1569
  );
1567
- const rawEnv = config.env || crudifyConfig?.env || getCookie("environment") || "prod";
1568
- const env = ["dev", "stg", "prod"].includes(rawEnv) ? rawEnv : "prod";
1569
- const appName = config.appName || crudifyConfig?.appName || getCookie("appName") || "Crudia";
1570
- const loginActions = config.loginActions || crudifyConfig?.loginActions || (() => {
1571
- try {
1572
- const cookieValue = getCookie("loginActions");
1573
- return cookieValue ? cookieValue.split(",").map((action) => action.trim()).filter(Boolean) : [];
1574
- } catch {
1575
- return [];
1576
- }
1577
- })();
1570
+ console.log("\u{1F50D} useCrudifyLogin - Final env:", env, "from rawEnv:", rawEnv);
1578
1571
  const finalResult = {
1579
1572
  publicApiKey,
1580
1573
  env,
package/dist/index.mjs CHANGED
@@ -1480,35 +1480,28 @@ import crudify2 from "@nocios/crudify-browser";
1480
1480
  var useCrudifyLogin = (config, _options = {}) => {
1481
1481
  console.log("\u{1F50D} useCrudifyLogin - Input config:", config);
1482
1482
  const finalConfig = useMemo2(() => {
1483
- let crudifyConfig = null;
1484
- try {
1485
- if (crudify2 && crudify2.config) {
1486
- crudifyConfig = crudify2.config;
1483
+ const publicApiKey = config.publicApiKey || crudify2?.publicApiKey || crudify2?.apiKey || getCookie("publicApiKey") || null;
1484
+ const rawEnv = config.env || getCookie("environment") || "prod";
1485
+ const env = ["dev", "stg", "prod"].includes(rawEnv) ? rawEnv : "prod";
1486
+ const appName = config.appName || getCookie("appName") || "Crudia";
1487
+ const loginActions = config.loginActions || (() => {
1488
+ try {
1489
+ const cookieValue = getCookie("loginActions");
1490
+ return cookieValue ? cookieValue.split(",").map((action) => action.trim()).filter(Boolean) : [];
1491
+ } catch {
1492
+ return [];
1487
1493
  }
1488
- } catch (error) {
1489
- console.log("\u{1F50D} useCrudifyLogin - No crudify instance config available:", error);
1490
- }
1491
- const publicApiKey = config.publicApiKey || crudifyConfig?.publicApiKey || getCookie("publicApiKey") || null;
1494
+ })();
1492
1495
  console.log("\u{1F50D} useCrudifyLogin - Resolved publicApiKey:", publicApiKey);
1493
1496
  console.log(
1494
1497
  "\u{1F50D} useCrudifyLogin - Sources - props:",
1495
1498
  config.publicApiKey,
1496
1499
  "crudify:",
1497
- crudifyConfig?.publicApiKey,
1500
+ crudify2?.publicApiKey,
1498
1501
  "cookie:",
1499
1502
  getCookie("publicApiKey")
1500
1503
  );
1501
- const rawEnv = config.env || crudifyConfig?.env || getCookie("environment") || "prod";
1502
- const env = ["dev", "stg", "prod"].includes(rawEnv) ? rawEnv : "prod";
1503
- const appName = config.appName || crudifyConfig?.appName || getCookie("appName") || "Crudia";
1504
- const loginActions = config.loginActions || crudifyConfig?.loginActions || (() => {
1505
- try {
1506
- const cookieValue = getCookie("loginActions");
1507
- return cookieValue ? cookieValue.split(",").map((action) => action.trim()).filter(Boolean) : [];
1508
- } catch {
1509
- return [];
1510
- }
1511
- })();
1504
+ console.log("\u{1F50D} useCrudifyLogin - Final env:", env, "from rawEnv:", rawEnv);
1512
1505
  const finalResult = {
1513
1506
  publicApiKey,
1514
1507
  env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-ui",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",