@alicloud/alfa-react 1.5.13 → 1.5.15

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.
@@ -98,6 +98,7 @@ export default function createApplication(loader) {
98
98
  syncRegion = props.syncRegion,
99
99
  syncResourceGroup = props.syncResourceGroup,
100
100
  basename = props.basename,
101
+ channel = props.channel,
101
102
  onSyncHistory = props.onSyncHistory;
102
103
  var handleExternalLink = customProps.handleExternalLink;
103
104
  var _useState = useState(null),
@@ -221,7 +222,8 @@ export default function createApplication(loader) {
221
222
  locale: locale,
222
223
  noCache: noCache,
223
224
  // 用户自定义 manifest 且未传入 dynamicConfig 时,默认值为 false,否则为 true
224
- dynamicConfig: typeof dynamicConfig === 'boolean' ? dynamicConfig : !manifest
225
+ dynamicConfig: typeof dynamicConfig === 'boolean' ? dynamicConfig : !manifest,
226
+ channel: channel
225
227
  };
226
228
  }, []);
227
229
  useEffect(function () {
@@ -349,6 +351,10 @@ export default function createApplication(loader) {
349
351
  customProps: customProps
350
352
  });
351
353
  case 22:
354
+ (logger === null || logger === void 0 ? void 0 : logger.record) && (logger === null || logger === void 0 ? void 0 : logger.record({
355
+ END_TIME: Date.now()
356
+ }));
357
+ (logger === null || logger === void 0 ? void 0 : logger.send) && (logger === null || logger === void 0 ? void 0 : logger.send());
352
358
  if (frameWindow) {
353
359
  // 每次挂载后主动触发子应用内的 popstate 事件,借此触发 react-router history 的检查逻辑
354
360
  dispatchFramePopstate();
@@ -356,7 +362,7 @@ export default function createApplication(loader) {
356
362
 
357
363
  // just run once
358
364
  setAppInstance(app);
359
- case 24:
365
+ case 26:
360
366
  case "end":
361
367
  return _context.stop();
362
368
  }
@@ -13,11 +13,11 @@ function afterLoadHook(_x) {
13
13
  }
14
14
  function _afterLoadHook() {
15
15
  _afterLoadHook = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(appConfig) {
16
- var app, logger, sandbox, dynamicConfig, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, CONFIG_END_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, i18nMessages, overrides, END_TIME;
16
+ var app, logger, sandbox, dynamicConfig, channel, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, CONFIG_END_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, i18nMessages, overrides;
17
17
  return _regeneratorRuntime.wrap(function _callee$(_context) {
18
18
  while (1) switch (_context.prev = _context.next) {
19
19
  case 0:
20
- app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox, dynamicConfig = appConfig.dynamicConfig;
20
+ app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox, dynamicConfig = appConfig.dynamicConfig, channel = appConfig.channel;
21
21
  defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
22
22
  defaultConsoleGlobal = window.ALIYUN_CONSOLE_GLOBAL || {};
23
23
  CONFIG_START_TIME = Date.now();
@@ -31,7 +31,7 @@ function _afterLoadHook() {
31
31
  case 8:
32
32
  configData = _context.sent;
33
33
  _context.next = 11;
34
- return Promise.all([getConsoleConfig(configData, defaultConsoleConfig), getConsoleGlobal(configData, defaultConsoleGlobal), getI18nMessages(appConfig)]);
34
+ return Promise.all([getConsoleConfig(configData, defaultConsoleConfig, channel), getConsoleGlobal(configData, defaultConsoleGlobal), getI18nMessages(appConfig)]);
35
35
  case 11:
36
36
  _yield$Promise$all = _context.sent;
37
37
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
@@ -65,16 +65,13 @@ function _afterLoadHook() {
65
65
  app.context.window[key] = value;
66
66
  });
67
67
  }
68
- END_TIME = Date.now();
69
68
  (logger === null || logger === void 0 ? void 0 : logger.record) && logger.record({
70
69
  CONFIG_START_TIME: CONFIG_START_TIME,
71
70
  CONFIG_END_TIME: CONFIG_END_TIME,
72
- END_TIME: END_TIME,
73
71
  COST: CONFIG_END_TIME - CONFIG_START_TIME
74
72
  });
75
- (logger === null || logger === void 0 ? void 0 : logger.send) && logger.send();
76
73
  return _context.abrupt("return", appConfig);
77
- case 28:
74
+ case 26:
78
75
  case "end":
79
76
  return _context.stop();
80
77
  }
@@ -65,9 +65,9 @@ var processChannelFeatures = function processChannelFeatures(allChannelFeatures,
65
65
  return newChannelFeatures;
66
66
  }, {});
67
67
  };
68
- var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig(configData, consoleConfig) {
68
+ var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig(configData, consoleConfig, passInChannel) {
69
69
  var _window, _window$ALIYUN_CONSOL, _configData$ALL_CHANN;
70
- var channel = ((_window = window) === null || _window === void 0 ? void 0 : (_window$ALIYUN_CONSOL = _window.ALIYUN_CONSOLE_CONFIG) === null || _window$ALIYUN_CONSOL === void 0 ? void 0 : _window$ALIYUN_CONSOL.CHANNEL) || 'OFFICIAL';
70
+ var channel = passInChannel || ((_window = window) === null || _window === void 0 ? void 0 : (_window$ALIYUN_CONSOL = _window.ALIYUN_CONSOLE_CONFIG) === null || _window$ALIYUN_CONSOL === void 0 ? void 0 : _window$ALIYUN_CONSOL.CHANNEL) || 'OFFICIAL';
71
71
  var channelLinks = (_configData$ALL_CHANN = configData.ALL_CHANNEL_LINKS) === null || _configData$ALL_CHANN === void 0 ? void 0 : _configData$ALL_CHANN[channel];
72
72
  var channelFeatures = configData.ALL_CHANNEL_FEATURE_STATUS;
73
73
  var features = configData.ALL_FEATURE_STATUS;
@@ -78,18 +78,18 @@ var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig
78
78
  });
79
79
  };
80
80
  export var getConsoleConfig = /*#__PURE__*/function () {
81
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(configData, consoleConfig) {
81
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(configData, consoleConfig, channel) {
82
82
  return _regeneratorRuntime.wrap(function _callee$(_context) {
83
83
  while (1) switch (_context.prev = _context.next) {
84
84
  case 0:
85
- return _context.abrupt("return", mergeConfigDataWithConsoleConfig(configData, consoleConfig));
85
+ return _context.abrupt("return", mergeConfigDataWithConsoleConfig(configData, consoleConfig, channel));
86
86
  case 1:
87
87
  case "end":
88
88
  return _context.stop();
89
89
  }
90
90
  }, _callee);
91
91
  }));
92
- return function getConsoleConfig(_x, _x2) {
92
+ return function getConsoleConfig(_x, _x2, _x3) {
93
93
  return _ref.apply(this, arguments);
94
94
  };
95
95
  }();
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export var version = '1.5.13';
1
+ export var version = '1.5.15';
@@ -108,6 +108,7 @@ function createApplication(loader) {
108
108
  syncRegion = props.syncRegion,
109
109
  syncResourceGroup = props.syncResourceGroup,
110
110
  basename = props.basename,
111
+ channel = props.channel,
111
112
  onSyncHistory = props.onSyncHistory;
112
113
  var handleExternalLink = customProps.handleExternalLink;
113
114
  var _useState = (0, _react.useState)(null),
@@ -231,7 +232,8 @@ function createApplication(loader) {
231
232
  locale: locale,
232
233
  noCache: noCache,
233
234
  // 用户自定义 manifest 且未传入 dynamicConfig 时,默认值为 false,否则为 true
234
- dynamicConfig: typeof dynamicConfig === 'boolean' ? dynamicConfig : !manifest
235
+ dynamicConfig: typeof dynamicConfig === 'boolean' ? dynamicConfig : !manifest,
236
+ channel: channel
235
237
  };
236
238
  }, []);
237
239
  (0, _react.useEffect)(function () {
@@ -359,6 +361,10 @@ function createApplication(loader) {
359
361
  customProps: customProps
360
362
  });
361
363
  case 22:
364
+ (logger === null || logger === void 0 ? void 0 : logger.record) && (logger === null || logger === void 0 ? void 0 : logger.record({
365
+ END_TIME: Date.now()
366
+ }));
367
+ (logger === null || logger === void 0 ? void 0 : logger.send) && (logger === null || logger === void 0 ? void 0 : logger.send());
362
368
  if (frameWindow) {
363
369
  // 每次挂载后主动触发子应用内的 popstate 事件,借此触发 react-router history 的检查逻辑
364
370
  dispatchFramePopstate();
@@ -366,7 +372,7 @@ function createApplication(loader) {
366
372
 
367
373
  // just run once
368
374
  setAppInstance(app);
369
- case 24:
375
+ case 26:
370
376
  case "end":
371
377
  return _context.stop();
372
378
  }
@@ -20,11 +20,11 @@ function afterLoadHook(_x) {
20
20
  }
21
21
  function _afterLoadHook() {
22
22
  _afterLoadHook = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(appConfig) {
23
- var app, logger, sandbox, dynamicConfig, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, CONFIG_END_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, i18nMessages, overrides, END_TIME;
23
+ var app, logger, sandbox, dynamicConfig, channel, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, CONFIG_END_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, i18nMessages, overrides;
24
24
  return _regenerator.default.wrap(function _callee$(_context) {
25
25
  while (1) switch (_context.prev = _context.next) {
26
26
  case 0:
27
- app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox, dynamicConfig = appConfig.dynamicConfig;
27
+ app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox, dynamicConfig = appConfig.dynamicConfig, channel = appConfig.channel;
28
28
  defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
29
29
  defaultConsoleGlobal = window.ALIYUN_CONSOLE_GLOBAL || {};
30
30
  CONFIG_START_TIME = Date.now();
@@ -38,7 +38,7 @@ function _afterLoadHook() {
38
38
  case 8:
39
39
  configData = _context.sent;
40
40
  _context.next = 11;
41
- return Promise.all([(0, _getConsoleConfig.getConsoleConfig)(configData, defaultConsoleConfig), (0, _getConsoleGlobal.getConsoleGlobal)(configData, defaultConsoleGlobal), (0, _alfaCore.getI18nMessages)(appConfig)]);
41
+ return Promise.all([(0, _getConsoleConfig.getConsoleConfig)(configData, defaultConsoleConfig, channel), (0, _getConsoleGlobal.getConsoleGlobal)(configData, defaultConsoleGlobal), (0, _alfaCore.getI18nMessages)(appConfig)]);
42
42
  case 11:
43
43
  _yield$Promise$all = _context.sent;
44
44
  _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 3);
@@ -72,16 +72,13 @@ function _afterLoadHook() {
72
72
  app.context.window[key] = value;
73
73
  });
74
74
  }
75
- END_TIME = Date.now();
76
75
  (logger === null || logger === void 0 ? void 0 : logger.record) && logger.record({
77
76
  CONFIG_START_TIME: CONFIG_START_TIME,
78
77
  CONFIG_END_TIME: CONFIG_END_TIME,
79
- END_TIME: END_TIME,
80
78
  COST: CONFIG_END_TIME - CONFIG_START_TIME
81
79
  });
82
- (logger === null || logger === void 0 ? void 0 : logger.send) && logger.send();
83
80
  return _context.abrupt("return", appConfig);
84
- case 28:
81
+ case 26:
85
82
  case "end":
86
83
  return _context.stop();
87
84
  }
@@ -71,9 +71,9 @@ var processChannelFeatures = function processChannelFeatures(allChannelFeatures,
71
71
  return newChannelFeatures;
72
72
  }, {});
73
73
  };
74
- var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig(configData, consoleConfig) {
74
+ var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig(configData, consoleConfig, passInChannel) {
75
75
  var _window, _window$ALIYUN_CONSOL, _configData$ALL_CHANN;
76
- var channel = ((_window = window) === null || _window === void 0 ? void 0 : (_window$ALIYUN_CONSOL = _window.ALIYUN_CONSOLE_CONFIG) === null || _window$ALIYUN_CONSOL === void 0 ? void 0 : _window$ALIYUN_CONSOL.CHANNEL) || 'OFFICIAL';
76
+ var channel = passInChannel || ((_window = window) === null || _window === void 0 ? void 0 : (_window$ALIYUN_CONSOL = _window.ALIYUN_CONSOLE_CONFIG) === null || _window$ALIYUN_CONSOL === void 0 ? void 0 : _window$ALIYUN_CONSOL.CHANNEL) || 'OFFICIAL';
77
77
  var channelLinks = (_configData$ALL_CHANN = configData.ALL_CHANNEL_LINKS) === null || _configData$ALL_CHANN === void 0 ? void 0 : _configData$ALL_CHANN[channel];
78
78
  var channelFeatures = configData.ALL_CHANNEL_FEATURE_STATUS;
79
79
  var features = configData.ALL_FEATURE_STATUS;
@@ -84,18 +84,18 @@ var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig
84
84
  });
85
85
  };
86
86
  var getConsoleConfig = /*#__PURE__*/function () {
87
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(configData, consoleConfig) {
87
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(configData, consoleConfig, channel) {
88
88
  return _regenerator.default.wrap(function _callee$(_context) {
89
89
  while (1) switch (_context.prev = _context.next) {
90
90
  case 0:
91
- return _context.abrupt("return", mergeConfigDataWithConsoleConfig(configData, consoleConfig));
91
+ return _context.abrupt("return", mergeConfigDataWithConsoleConfig(configData, consoleConfig, channel));
92
92
  case 1:
93
93
  case "end":
94
94
  return _context.stop();
95
95
  }
96
96
  }, _callee);
97
97
  }));
98
- return function getConsoleConfig(_x, _x2) {
98
+ return function getConsoleConfig(_x, _x2, _x3) {
99
99
  return _ref.apply(this, arguments);
100
100
  };
101
101
  }();
package/lib/version.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- var version = '1.5.13';
7
+ var version = '1.5.15';
8
8
  exports.version = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/alfa-react",
3
- "version": "1.5.13",
3
+ "version": "1.5.15",
4
4
  "description": "Alfa Framework (React Version)",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -38,8 +38,8 @@
38
38
  "classnames": "^2.2.6",
39
39
  "crypto-js": "^4.1.1",
40
40
  "prop-types": "^15.8.1",
41
- "@alicloud/alfa-core": "^1.4.33",
42
- "@alicloud/console-os-loader": "^1.4.34"
41
+ "@alicloud/console-os-loader": "^1.4.34",
42
+ "@alicloud/alfa-core": "^1.4.33"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.0.0"
@@ -1,3 +1,7 @@
1
1
  import { IAppConfig } from '@alicloud/alfa-core';
2
- declare function afterLoadHook(appConfig: IAppConfig): Promise<IAppConfig<any>>;
2
+ declare function afterLoadHook(appConfig: IAppConfig & {
3
+ channel?: string;
4
+ }): Promise<IAppConfig<any> & {
5
+ channel?: string | undefined;
6
+ }>;
3
7
  export default afterLoadHook;
@@ -11,6 +11,10 @@ export interface AlfaReleaseConfig {
11
11
  }
12
12
  export type EnvEnum = 'prod' | 'local' | 'pre' | 'daily';
13
13
  export interface AlfaFactoryOption extends IAppConfig {
14
+ /**
15
+ * oneConsole 渠道
16
+ */
17
+ channel?: string;
14
18
  loading?: boolean | React.ReactChild;
15
19
  dependencies?: Record<string, any>;
16
20
  className?: string;
@@ -1,5 +1,5 @@
1
1
  import { AlfaConfig } from '@alicloud/alfa-core';
2
- export declare const getConsoleConfig: (configData: AlfaConfig, consoleConfig: any) => Promise<{
2
+ export declare const getConsoleConfig: (configData: AlfaConfig, consoleConfig: any, channel?: string) => Promise<{
3
3
  CHANNEL_LINKS: {
4
4
  [x: string]: string | undefined;
5
5
  };
@@ -1 +1 @@
1
- export declare const version = "1.5.13";
1
+ export declare const version = "1.5.15";