@aliyun-obv/api 0.3.34 → 0.3.36

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/api.d.ts CHANGED
@@ -286,9 +286,9 @@ declare namespace projectService {
286
286
  export function updateProject(params: updateProject): Promise<IResponseData>;
287
287
  export function deleteProject(params: deleteProject): Promise<IResponseData>;
288
288
  export function getNewProjectInfo(params: getNewProjectInfo, option?: any): Promise<IResponseData>;
289
- export function getLdb(params: getLb): Promise<IResponseData | ((_params?: {}) => Promise<any>)>;
290
- export function putLdb(params: putLb): Promise<IResponseData | ((params?: {}) => Promise<any>)>;
291
- export function getOpConfig(): Promise<IResponseData | ((config?: {}) => Promise<any>)>;
289
+ export function getLdb(params: getLb): Promise<IResponseData>;
290
+ export function putLdb(params: putLb): Promise<IResponseData>;
291
+ export function getOpConfig(): Promise<IResponseData>;
292
292
  export function listMetricStore(params: MetricStoreParameters): Promise<IResponseData>;
293
293
  export {};
294
294
  }
package/dist/api.es.js CHANGED
@@ -3,7 +3,7 @@ import errorPrompt from '@alicloud/console-base-error-prompt-proxy';
3
3
  import i18n, { getMsg } from '@aliyun-obv/i18n';
4
4
  import urijs from 'urijs';
5
5
  import { Dialog, Button, Message } from '@alifd/next';
6
- import { slsConsoleRuntime, commonUtil, urlUtil, addStubForSearch, addRUMLog, slsConsoleUtil } from '@aliyun-obv/utils';
6
+ import { slsConsoleRuntime } from '@aliyun-obv/utils';
7
7
  import React from 'react';
8
8
  import merge from 'lodash/merge';
9
9
 
@@ -359,6 +359,32 @@ function getOauthCallbackUrl(url = window.location.href) {
359
359
  function createNoPermissionContent() {
360
360
  return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "sls-custom-container" }, /* @__PURE__ */ React.createElement("div", { className: "sls-custom-title" }, i18n.UNAUTHORIZEDOPERMSG)));
361
361
  }
362
+ function judgeIframe() {
363
+ return window.top !== window.self;
364
+ }
365
+ function getParentUrl() {
366
+ let url = null;
367
+ if (parent !== window) {
368
+ try {
369
+ url = parent.location.href;
370
+ } catch (e) {
371
+ url = document.referrer;
372
+ }
373
+ } else {
374
+ url = window.location.href;
375
+ }
376
+ return url;
377
+ }
378
+ const TOP_WINDOW = new Function("return window;")();
379
+ function addRUMLog(log) {
380
+ var _a2;
381
+ if (TOP_WINDOW.SLS_CLIENT && TOP_WINDOW.SLS_CLIENT.addLog) {
382
+ TOP_WINDOW.SLS_CLIENT.addLog(log);
383
+ }
384
+ if ((_a2 = window == null ? void 0 : window.RUM_API) == null ? void 0 : _a2.addRUMLog) {
385
+ window.RUM_API.addRUMLog(log);
386
+ }
387
+ }
362
388
 
363
389
  var __defProp$3 = Object.defineProperty;
364
390
  var __defProps$3 = Object.defineProperties;
@@ -492,18 +518,18 @@ function showCSRFDialog(config) {
492
518
  }
493
519
  function showNeedLoginDialog(config) {
494
520
  const parseQuery = urijs(location.search).escapeQuerySpace(false).query(true);
495
- if (commonUtil.judgeIframe() && parseQuery.reloadParent === "true") {
521
+ if (judgeIframe() && parseQuery.reloadParent === "true") {
496
522
  try {
497
523
  const mockWindow = parent.parent.window;
498
524
  const mockLocation = mockWindow.location;
499
- mockLocation.href = decodeURIComponent(urlUtil.getParentUrl());
525
+ mockLocation.href = decodeURIComponent(getParentUrl());
500
526
  return;
501
527
  } catch (e) {
502
528
  console.error(e);
503
529
  }
504
530
  }
505
531
  let loginUrl = getOauthCallbackUrl(
506
- `${window.location.origin}/lognext/exit${addStubForSearch("", true)}`
532
+ `${window.location.origin}/lognext/exit`
507
533
  );
508
534
  if (parseQuery.customLoginUrl && parseQuery.customLoginUrl !== "") {
509
535
  loginUrl = decodeURIComponent(parseQuery.customLoginUrl);
@@ -1322,26 +1348,6 @@ var __async$2 = (__this, __arguments, generator) => {
1322
1348
  };
1323
1349
  var projectService;
1324
1350
  ((projectService2) => {
1325
- const noop = (params) => {
1326
- return Promise.resolve(params);
1327
- };
1328
- const privateRequest = {
1329
- getFavor(_params = {}) {
1330
- return noop();
1331
- },
1332
- putFavor(params = {}) {
1333
- return noop(params);
1334
- },
1335
- getLdb(_params = {}) {
1336
- return noop();
1337
- },
1338
- putLdb(params = {}) {
1339
- return noop(params);
1340
- },
1341
- getOpConfig(config = {}) {
1342
- return noop(config);
1343
- }
1344
- };
1345
1351
  function getCombineSearch(params, options) {
1346
1352
  return __async$2(this, null, function* () {
1347
1353
  return slsEasyFetch.get("/console/combineSearch.json", params, options);
@@ -1389,27 +1395,18 @@ var projectService;
1389
1395
  projectService2.getNewProjectInfo = getNewProjectInfo;
1390
1396
  function getLdb(params) {
1391
1397
  return __async$2(this, null, function* () {
1392
- if (slsConsoleUtil.isPrivateEnv()) {
1393
- return privateRequest.getLdb;
1394
- }
1395
1398
  return slsEasyFetch.get("/console/tairAjax/getLdb.json", params);
1396
1399
  });
1397
1400
  }
1398
1401
  projectService2.getLdb = getLdb;
1399
1402
  function putLdb(params) {
1400
1403
  return __async$2(this, null, function* () {
1401
- if (slsConsoleUtil.isPrivateEnv()) {
1402
- return privateRequest.putLdb;
1403
- }
1404
1404
  return slsEasyFetch.post("/console/tairAjax/putLdb.json", params);
1405
1405
  });
1406
1406
  }
1407
1407
  projectService2.putLdb = putLdb;
1408
1408
  function getOpConfig() {
1409
1409
  return __async$2(this, null, function* () {
1410
- if (slsConsoleUtil.isPrivateEnv()) {
1411
- return privateRequest.getOpConfig;
1412
- }
1413
1410
  return slsEasyFetch.get("/console/diamondAjax/getOpConfig.json");
1414
1411
  });
1415
1412
  }
package/package.json CHANGED
@@ -15,5 +15,5 @@
15
15
  "styled-components": "^5.2.0"
16
16
  },
17
17
  "devDependencies": {},
18
- "version": "0.3.34"
18
+ "version": "0.3.36"
19
19
  }