zywlagent 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/gis-agent.js +14 -13
  2. package/package.json +3 -2
package/dist/gis-agent.js CHANGED
@@ -4,13 +4,13 @@ function v({
4
4
  buttonId: s = `${g}-MapEngineAIAgent`,
5
5
  style: m,
6
6
  onEvent: y,
7
- platform: f,
7
+ platform: u,
8
8
  GIS_AGENT_PLATFORM_URL: a,
9
- onError: u
9
+ onError: p
10
10
  } = {}) {
11
11
  if (typeof s != "string" || !s.trim())
12
12
  throw new TypeError("buttonId 必须是非空的元素 ID,不需要带 #。");
13
- let h = f;
13
+ let l = u;
14
14
  if (a !== void 0) {
15
15
  let e;
16
16
  try {
@@ -20,10 +20,11 @@ function v({
20
20
  }
21
21
  if (typeof a != "string" || !["http:", "https:"].includes(e.protocol) || e.username || e.password || e.search || e.hash || e.pathname.replace(/\/+$/, "") !== "")
22
22
  throw new TypeError("GIS_AGENT_PLATFORM_URL 只填写 HTTP(S) 服务地址和端口,不要包含 /platform、查询参数或账号密码。");
23
- h = { ...f, baseUrl: `${e.origin}/platform` };
23
+ l = { ...u, baseUrl: `${e.origin}/platform` };
24
24
  }
25
- let r = !1, l, t, d;
26
- const c = (e = t) => {
25
+ console.log("platformOptions>>>>>", l);
26
+ let r = !1, c, t, d;
27
+ const f = (e = t) => {
27
28
  if (!e) return;
28
29
  const n = o.get(e);
29
30
  n && (n.destroyed = !0, e.removeEventListener("click", n.onClick), n.handle && n.handle.destroy(), o.delete(e)), e === t && (t = void 0, d = void 0);
@@ -48,22 +49,22 @@ function v({
48
49
  initialOpen: !0,
49
50
  title: "智能助手",
50
51
  onEvent: y,
51
- platform: h,
52
+ platform: l,
52
53
  style: m,
53
- onError: u
54
+ onError: p
54
55
  }), n.handle;
55
56
  }).catch((i) => {
56
- n.loading = void 0, console.error("智能体对话框加载失败。", i), u?.({ code: "AGENT_LOAD_FAILED", message: i instanceof Error ? i.message : String(i) });
57
+ n.loading = void 0, console.error("智能体对话框加载失败。", i), p?.({ code: "AGENT_LOAD_FAILED", message: i instanceof Error ? i.message : String(i) });
57
58
  }));
58
59
  }
59
60
  }, e.addEventListener("click", n.onClick), o.set(e, n), t = e, d = n;
60
- }, p = () => {
61
+ }, h = () => {
61
62
  if (r) return;
62
63
  const e = document.getElementById(s);
63
- e !== t && (t && !t.isConnected && c(t), e && w(e)), t && !t.isConnected && c(t);
64
+ e !== t && (t && !t.isConnected && f(t), e && w(e)), t && !t.isConnected && f(t);
64
65
  };
65
- return p(), l = new MutationObserver(p), l.observe(document.body, { childList: !0, subtree: !0 }), () => {
66
- r || (r = !0, l?.disconnect(), d && (d.destroyed = !0), c(t));
66
+ return h(), c = new MutationObserver(h), c.observe(document.body, { childList: !0, subtree: !0 }), () => {
67
+ r || (r = !0, c?.disconnect(), d && (d.destroyed = !0), f(t));
67
68
  };
68
69
  }
69
70
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zywlagent",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "可独立接入 GIS 或业务页面的 Platform Agent 聊天组件",
5
5
  "private": false,
6
6
  "type": "module",
@@ -20,7 +20,8 @@
20
20
  "dev": "vite --host 127.0.0.1 --port 5188 --strictPort",
21
21
  "build": "vite build",
22
22
  "test": "node scripts/test-platform-client.mjs",
23
- "pack": "npm run build && npm pack"
23
+ "pack": "npm run build && npm pack",
24
+ "internet": "npm publish --registry https://registry.npmjs.org/"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@vitejs/plugin-react": "5.2.0",