@aliyun-obv/api 0.0.73 → 0.0.75

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/api.es.js +33 -23
  2. package/package.json +3 -3
package/dist/api.es.js CHANGED
@@ -185,6 +185,27 @@ class BaseFetch {
185
185
  }
186
186
  }
187
187
 
188
+ function getSlsBaseUrl() {
189
+ var _a, _b, _c, _d;
190
+ const { slsHost } = urijs(window.location.search).escapeQuerySpace(false).query(true);
191
+ if ((_a = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _a.LOCAL) {
192
+ if (slsHost != null && slsHost != "") {
193
+ return slsHost;
194
+ }
195
+ return void 0;
196
+ }
197
+ const host = window.location.host;
198
+ if (((_b = window == null ? void 0 : window.ALIYUN_SLS_CONSOLE_CONFIG) == null ? void 0 : _b.isSlsConsole) || host.includes("sls") && host.includes("console.aliyun.com")) {
199
+ return void 0;
200
+ }
201
+ if (((_c = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _c.ENV) === "pre" || ((_d = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _d.fEnv) === "pre") {
202
+ if (slsHost != null && slsHost != "") {
203
+ return slsHost;
204
+ }
205
+ return `https://pre-sls.console.aliyun.com`;
206
+ }
207
+ return `https://sls.console.aliyun.com`;
208
+ }
188
209
  function getConfig(key) {
189
210
  window.ALIYUN_SLS_CONSOLE_CONFIG = window.ALIYUN_SLS_CONSOLE_CONFIG || {};
190
211
  return window.ALIYUN_SLS_CONSOLE_CONFIG[key] !== void 0 ? window.ALIYUN_SLS_CONSOLE_CONFIG[key] : "";
@@ -241,6 +262,11 @@ function getOauthCallbackUrl(url = window.location.href) {
241
262
  function createNoPermissionContent() {
242
263
  return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "sls-custom-container" }, /* @__PURE__ */ React.createElement("div", { className: "sls-custom-title" }, i18n.UNAUTHORIZEDOPERMSG)));
243
264
  }
265
+ function is4Service(location) {
266
+ return location.hostname.match(
267
+ /(4service|4bjzwy|4finance)(\.console)?(\.aliyun|\.alibabacloud)\.com$/
268
+ );
269
+ }
244
270
 
245
271
  var __defProp$3 = Object.defineProperty;
246
272
  var __defProps$3 = Object.defineProperties;
@@ -351,7 +377,8 @@ function showCSRFDialog(config) {
351
377
  {
352
378
  type: "primary",
353
379
  onClick: () => {
354
- commonEasyFetch.get("/console/ajax/getSecToken.json").then((res) => {
380
+ var _a;
381
+ commonEasyFetch.get(`${(_a = getSlsBaseUrl()) != null ? _a : ""}/console/ajax/getSecToken.json`).then((res) => {
355
382
  if ((res == null ? void 0 : res.code) === "200") {
356
383
  window.ALIYUN_SLS_CONSOLE_CONFIG.SEC_TOKEN = res.data;
357
384
  dialog.hide();
@@ -415,12 +442,13 @@ function showNeedLoginDialog(config) {
415
442
  Button,
416
443
  {
417
444
  onClick: () => {
445
+ var _a;
418
446
  addRUMLog({
419
447
  spm_main: "login_dialog",
420
448
  spm_btn_type: "getSecToken",
421
449
  spm_loginUrl: loginUrl
422
450
  });
423
- commonEasyFetch.get("/console/ajax/getSecToken.json").then((res) => {
451
+ commonEasyFetch.get(`${(_a = getSlsBaseUrl()) != null ? _a : ""}/console/ajax/getSecToken.json`).then((res) => {
424
452
  if (res && res.code === "200") {
425
453
  window.ALIYUN_SLS_CONSOLE_CONFIG.SEC_TOKEN = res.data;
426
454
  dialog.hide();
@@ -699,27 +727,6 @@ var __async$3 = (__this, __arguments, generator) => {
699
727
  step((generator = generator.apply(__this, __arguments)).next());
700
728
  });
701
729
  };
702
- function getSlsBaseUrl() {
703
- var _a, _b, _c;
704
- const { slsHost } = urijs(window.location.search).escapeQuerySpace(false).query(true);
705
- if ((_a = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _a.LOCAL) {
706
- if (slsHost != null && slsHost != "") {
707
- return slsHost;
708
- }
709
- return void 0;
710
- }
711
- const host = window.location.host;
712
- if (host.includes("sls") && host.includes("console.aliyun.com")) {
713
- return void 0;
714
- }
715
- if (((_b = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _b.ENV) === "pre" || ((_c = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _c.fEnv) === "pre") {
716
- if (slsHost != null && slsHost != "") {
717
- return slsHost;
718
- }
719
- return `https://pre-sls.console.aliyun.com`;
720
- }
721
- return `https://sls.console.aliyun.com`;
722
- }
723
730
  const slsEasyFetch = new BaseFetch(finalFetch);
724
731
  slsEasyFetch.defaults.postDefaultInit.headers["Content-Type"] = "application/x-www-form-urlencoded";
725
732
  slsEasyFetch.defaults.postDefaultInit.headers["Accept"] = "application/json";
@@ -792,6 +799,9 @@ function getBaseUrl() {
792
799
  if (((_b = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _b.ENV) === "pre" || ((_c = window.ALIYUN_CONSOLE_CONFIG) == null ? void 0 : _c.fEnv) === "pre") {
793
800
  return `https://pre-observability.console.aliyun.com`;
794
801
  }
802
+ if (is4Service(window.location)) {
803
+ return `https://observability4service.console.aliyun.com`;
804
+ }
795
805
  return `https://observability.console.aliyun.com`;
796
806
  }
797
807
  const obsEasyFetch = new BaseFetch(finalFetch);
package/package.json CHANGED
@@ -10,11 +10,11 @@
10
10
  "urijs": "^1.19.1",
11
11
  "lodash": "^4.17.21",
12
12
  "@alicloud/console-base-error-prompt-proxy": "^1.9.12",
13
- "@aliyun-obv/i18n": "0.0.73",
14
- "@aliyun-obv/utils": "0.0.73",
13
+ "@aliyun-obv/i18n": "0.0.75",
14
+ "@aliyun-obv/utils": "0.0.75",
15
15
  "@alifd/next": "^1.27.11",
16
16
  "styled-components": "^5.2.0"
17
17
  },
18
18
  "devDependencies": {},
19
- "version": "0.0.73"
19
+ "version": "0.0.75"
20
20
  }