hzerojs-plugin-yqcloud-jssdk 1.0.6 → 1.0.8

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/lib/index.js +21 -12
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -73,19 +73,30 @@ var src_default = (props) => {
73
73
  }, [isVisible]);
74
74
  (0, import_react.useEffect)(() => {
75
75
  const url = `${apiHost}/iam/yqc/open_apps/quick/${token}`;
76
- (0, import_axios.default)(url).then(function(jsonData) {
77
- try {
78
- if (jsonData && jsonData.failed) {
79
- console.log("【YQCloud】:", jsonData.message);
80
- } else {
81
- const appConfig2 = JSON.parse(jsonData.jsonConfig);
82
- setAppConfig(appConfig2);
83
- console.log("【YQCloud】解析配置成功:", appConfig2);
76
+ const xhr = new XMLHttpRequest();
77
+ xhr.withCredentials = false;
78
+ xhr.addEventListener("readystatechange", function() {
79
+ if (xhr.readyState === 4) {
80
+ const jsonData = JSON.parse(xhr.responseText);
81
+ try {
82
+ if (jsonData && jsonData.failed) {
83
+ console.log("【YQCloud】:", jsonData.message);
84
+ } else {
85
+ const appConfig2 = JSON.parse(jsonData.jsonConfig);
86
+ setAppConfig(appConfig2);
87
+ console.log("【YQCloud】解析配置成功:", appConfig2);
88
+ }
89
+ } catch (e) {
90
+ console.log("【YQCloud】解析配置失败:", e);
84
91
  }
85
- } catch (e) {
86
- console.log("【YQCloud】解析配置失败:", e);
87
92
  }
88
93
  });
94
+ xhr.open(
95
+ "GET",
96
+ url
97
+ );
98
+ xhr.setRequestHeader("Accept", "application/json, text/plain, */*");
99
+ xhr.send();
89
100
  }, [isVisible]);
90
101
  const openModal = async (openFunction) => {
91
102
  const secret = await import_axios.default.get(tokenPath || "/iam/v1/zknow/encrypt/quick");
@@ -129,5 +140,3 @@ var src_default = (props) => {
129
140
  const onlyOneButton = /* @__PURE__ */ import_react.default.createElement("div", { className: "yq-hzero-jssdk-btn", style: { padding: 0 }, onClick: () => openModal(appConfig == null ? void 0 : appConfig.openFunctions[0]) }, appConfig.icon ? /* @__PURE__ */ import_react.default.createElement("img", { style: { width: 18, height: 18, marginRight: 10 }, src: `${apiHost}/hfle/yqc/v1/0/files/download-by-key?fileKey=${appConfig.icon}`, alt: "" }) : /* @__PURE__ */ import_react.default.createElement(import_hzero_ui.Icon, { type: "picture", style: { width: 18, height: 18, marginRight: 10 } }), (entryDetail == null ? void 0 : entryDetail.entryName) || (appConfig == null ? void 0 : appConfig.displayName) || (appConfig == null ? void 0 : appConfig.name));
130
141
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "yqcloud-hzero-jssdk", ref: eleRef }, ((_b = appConfig == null ? void 0 : appConfig.openFunctions) == null ? void 0 : _b.length) === 1 ? onlyOneButton : /* @__PURE__ */ import_react.default.createElement(import_popover.default, { overlayClassName: "yqcloud-hzero-jssdk-popover", overlayStyle: { padding: 0 }, openClassName: "yqcloud-hzero-jssdk-popover", content: menu, placement: "left" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "yq-hzero-jssdk-btn", style: { padding: 0 } }, appConfig.icon ? /* @__PURE__ */ import_react.default.createElement("img", { style: { width: 18, height: 18, marginRight: 10 }, src: `${apiHost}/hfle/yqc/v1/0/files/download-by-key?fileKey=${appConfig.icon}`, alt: "" }) : /* @__PURE__ */ import_react.default.createElement(import_hzero_ui.Icon, { type: "picture", style: { width: 18, height: 18, marginRight: 10 } }), (entryDetail == null ? void 0 : entryDetail.entryName) || (appConfig == null ? void 0 : appConfig.displayName) || (appConfig == null ? void 0 : appConfig.name))));
131
142
  };
132
- // Annotate the CommonJS export names for ESM import in node:
133
- 0 && (module.exports = {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hzerojs-plugin-yqcloud-jssdk",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "main": "lib/index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {