nx-lecom-helper 1.0.0 → 1.0.1

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.
@@ -1,42 +1,16 @@
1
1
  (function (global) {
2
2
  "use strict";
3
3
 
4
- if (global.LecomHelper) return;
4
+ // Evita sobrescrever se já existir
5
+ if (global.LecomAlert) return;
5
6
 
6
- const _state = { debug: false, version: "1.0.0" };
7
-
8
- function init(options) {
9
- options = options || {};
10
- if (typeof options.debug === "boolean") _state.debug = options.debug;
11
- log("init ok", { version: _state.version });
12
- }
13
-
14
- function log(...args) {
15
- if (_state.debug && global.console) console.log("[LecomHelper]", ...args);
16
- }
17
-
18
- function get(obj, path, defaultValue) {
19
- if (!obj || !path) return defaultValue;
20
- const parts = String(path).split(".");
21
- let cur = obj;
22
- for (const p of parts) {
23
- if (cur && Object.prototype.hasOwnProperty.call(cur, p)) cur = cur[p];
24
- else return defaultValue;
25
- }
26
- return cur ?? defaultValue;
7
+ function show(message) {
8
+ alert(message || "LecomAlert funcionando!");
27
9
  }
28
10
 
29
- function gridContains(gridRow, fieldName, needle) {
30
- const val = String(get(gridRow, fieldName, "") || "");
31
- return val.includes(needle);
32
- }
33
-
34
- const api = Object.freeze({ init, get, gridContains, version: _state.version });
35
-
36
- Object.defineProperty(global, "LecomHelper", {
37
- value: api,
38
- writable: false,
39
- configurable: false
11
+ // API global mínima
12
+ global.LecomAlert = Object.freeze({
13
+ show
40
14
  });
41
- })(typeof window !== "undefined" ? window : this);
42
15
 
16
+ })(typeof window !== "undefined" ? window : this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx-lecom-helper",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Utilitários JS para BPM Lecom (API global)",
5
5
  "main": "dist/nxLecom-helper.umd.js",
6
6
  "files": [