@aliyun-obv/api 0.3.33 → 0.3.35

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
 
@@ -292,6 +292,9 @@ function getObvDomain() {
292
292
  }
293
293
  return `https://pre-cmsnext.console.aliyun.com`;
294
294
  }
295
+ if (is4Finance(window.location)) {
296
+ return `https://cmsnext.console.aliyun.com`;
297
+ }
295
298
  if (is4Service(window.location)) {
296
299
  return `https://cmsnext4service.console.aliyun.com`;
297
300
  }
@@ -356,6 +359,32 @@ function getOauthCallbackUrl(url = window.location.href) {
356
359
  function createNoPermissionContent() {
357
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)));
358
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
+ }
359
388
 
360
389
  var __defProp$3 = Object.defineProperty;
361
390
  var __defProps$3 = Object.defineProperties;
@@ -489,18 +518,18 @@ function showCSRFDialog(config) {
489
518
  }
490
519
  function showNeedLoginDialog(config) {
491
520
  const parseQuery = urijs(location.search).escapeQuerySpace(false).query(true);
492
- if (commonUtil.judgeIframe() && parseQuery.reloadParent === "true") {
521
+ if (judgeIframe() && parseQuery.reloadParent === "true") {
493
522
  try {
494
523
  const mockWindow = parent.parent.window;
495
524
  const mockLocation = mockWindow.location;
496
- mockLocation.href = decodeURIComponent(urlUtil.getParentUrl());
525
+ mockLocation.href = decodeURIComponent(getParentUrl());
497
526
  return;
498
527
  } catch (e) {
499
528
  console.error(e);
500
529
  }
501
530
  }
502
531
  let loginUrl = getOauthCallbackUrl(
503
- `${window.location.origin}/lognext/exit${addStubForSearch("", true)}`
532
+ `${window.location.origin}/lognext/exit`
504
533
  );
505
534
  if (parseQuery.customLoginUrl && parseQuery.customLoginUrl !== "") {
506
535
  loginUrl = decodeURIComponent(parseQuery.customLoginUrl);
@@ -1319,26 +1348,6 @@ var __async$2 = (__this, __arguments, generator) => {
1319
1348
  };
1320
1349
  var projectService;
1321
1350
  ((projectService2) => {
1322
- const noop = (params) => {
1323
- return Promise.resolve(params);
1324
- };
1325
- const privateRequest = {
1326
- getFavor(_params = {}) {
1327
- return noop();
1328
- },
1329
- putFavor(params = {}) {
1330
- return noop(params);
1331
- },
1332
- getLdb(_params = {}) {
1333
- return noop();
1334
- },
1335
- putLdb(params = {}) {
1336
- return noop(params);
1337
- },
1338
- getOpConfig(config = {}) {
1339
- return noop(config);
1340
- }
1341
- };
1342
1351
  function getCombineSearch(params, options) {
1343
1352
  return __async$2(this, null, function* () {
1344
1353
  return slsEasyFetch.get("/console/combineSearch.json", params, options);
@@ -1386,27 +1395,18 @@ var projectService;
1386
1395
  projectService2.getNewProjectInfo = getNewProjectInfo;
1387
1396
  function getLdb(params) {
1388
1397
  return __async$2(this, null, function* () {
1389
- if (slsConsoleUtil.isPrivateEnv()) {
1390
- return privateRequest.getLdb;
1391
- }
1392
1398
  return slsEasyFetch.get("/console/tairAjax/getLdb.json", params);
1393
1399
  });
1394
1400
  }
1395
1401
  projectService2.getLdb = getLdb;
1396
1402
  function putLdb(params) {
1397
1403
  return __async$2(this, null, function* () {
1398
- if (slsConsoleUtil.isPrivateEnv()) {
1399
- return privateRequest.putLdb;
1400
- }
1401
1404
  return slsEasyFetch.post("/console/tairAjax/putLdb.json", params);
1402
1405
  });
1403
1406
  }
1404
1407
  projectService2.putLdb = putLdb;
1405
1408
  function getOpConfig() {
1406
1409
  return __async$2(this, null, function* () {
1407
- if (slsConsoleUtil.isPrivateEnv()) {
1408
- return privateRequest.getOpConfig;
1409
- }
1410
1410
  return slsEasyFetch.get("/console/diamondAjax/getOpConfig.json");
1411
1411
  });
1412
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.33"
18
+ "version": "0.3.35"
19
19
  }