@alicloud/alfa-react 1.4.14 → 1.4.17
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/index.js +1 -1
- package/es/createApplication.js +14 -1
- package/es/hooks/beforeLoadHook.js +4 -4
- package/es/utils/getConsoleConfig.js +9 -5
- package/es/version.js +1 -1
- package/lib/createApplication.js +14 -1
- package/lib/hooks/beforeLoadHook.js +4 -4
- package/lib/utils/getConsoleConfig.js +9 -5
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/types/utils/getConsoleConfig.d.ts +22 -10
- package/types/version.d.ts +1 -1
package/es/createApplication.js
CHANGED
|
@@ -53,13 +53,26 @@ export default function createApplication(loader) {
|
|
|
53
53
|
var appRef = useRef(undefined);
|
|
54
54
|
var tagName = normalizeName(props.name);
|
|
55
55
|
var sandbox = useMemo(function () {
|
|
56
|
+
var _UA_Opt, _RISK_INFO, _um;
|
|
57
|
+
|
|
58
|
+
var aliyunExternalsVars = [];
|
|
59
|
+
|
|
60
|
+
if ((_UA_Opt = window.UA_Opt) !== null && _UA_Opt !== void 0 && _UA_Opt.LogVal) {
|
|
61
|
+
var _UA_Opt2;
|
|
62
|
+
|
|
63
|
+
aliyunExternalsVars.push('UA_Opt');
|
|
64
|
+
aliyunExternalsVars.push((_UA_Opt2 = window.UA_Opt) === null || _UA_Opt2 === void 0 ? void 0 : _UA_Opt2.LogVal);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if ((_RISK_INFO = window.RISK_INFO) !== null && _RISK_INFO !== void 0 && _RISK_INFO.UMID) aliyunExternalsVars.push('RISK_INFO');
|
|
68
|
+
if ((_um = window.um) !== null && _um !== void 0 && _um.getToken) aliyunExternalsVars.push('um');
|
|
56
69
|
return _objectSpread(_objectSpread({}, customSandbox), {}, {
|
|
57
70
|
// allowResources: [
|
|
58
71
|
// ...(customSandbox?.allowResources || []),
|
|
59
72
|
// /^https?:\/\/at\.alicdn\.com\//,
|
|
60
73
|
// ],
|
|
61
74
|
externalsVars: [].concat(_toConsumableArray((customSandbox === null || customSandbox === void 0 ? void 0 : customSandbox.externalsVars) || []), [// global vars used in ConsoleBase.forApp
|
|
62
|
-
'_console_base_ready_'])
|
|
75
|
+
'_console_base_ready_'], aliyunExternalsVars)
|
|
63
76
|
});
|
|
64
77
|
}, [customSandbox]);
|
|
65
78
|
var memoOptions = useMemo(function () {
|
|
@@ -17,13 +17,13 @@ function afterLoadHook(_x) {
|
|
|
17
17
|
|
|
18
18
|
function _afterLoadHook() {
|
|
19
19
|
_afterLoadHook = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(appConfig) {
|
|
20
|
-
var app, logger, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
|
|
20
|
+
var app, logger, sandbox, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
|
|
21
21
|
|
|
22
22
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
23
23
|
while (1) {
|
|
24
24
|
switch (_context.prev = _context.next) {
|
|
25
25
|
case 0:
|
|
26
|
-
app = appConfig.app, logger = appConfig.logger;
|
|
26
|
+
app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox;
|
|
27
27
|
defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
|
|
28
28
|
defaultConsoleGlobal = window.ALIYUN_CONSOLE_GLOBAL || {};
|
|
29
29
|
CONFIG_START_TIME = Date.now();
|
|
@@ -42,9 +42,9 @@ function _afterLoadHook() {
|
|
|
42
42
|
consoleGlobal = _yield$Promise$all2[1];
|
|
43
43
|
messages = _yield$Promise$all2[2];
|
|
44
44
|
CONFIG_END_TIME = Date.now();
|
|
45
|
-
i18nMessages = _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_I18N_MESSAGE), messages); // inject global variables
|
|
45
|
+
i18nMessages = _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_I18N_MESSAGE), messages); // inject global variables when sandbox is valid
|
|
46
46
|
|
|
47
|
-
if (app && app.context) {
|
|
47
|
+
if (app !== null && app !== void 0 && app.context && !(sandbox !== null && sandbox !== void 0 && sandbox.disable)) {
|
|
48
48
|
app.context.window.ALIYUN_CONSOLE_CONFIG = consoleConfig;
|
|
49
49
|
app.context.window.ALIYUN_CONSOLE_GLOBAL = consoleGlobal;
|
|
50
50
|
app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = i18nMessages;
|
|
@@ -34,8 +34,12 @@ var processFeatures = function processFeatures(features) {
|
|
|
34
34
|
newFeatures[key] = true;
|
|
35
35
|
} else if (enableSampling) {
|
|
36
36
|
var gray = uid.substring(uid.length - 2);
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
|
|
38
|
+
if (Number(gray) >= (sampling !== null && sampling !== void 0 ? sampling : 0) * 100 || sampling === 0) {
|
|
39
|
+
newFeatures[key] = false;
|
|
40
|
+
} else {
|
|
41
|
+
newFeatures[key] = true;
|
|
42
|
+
}
|
|
39
43
|
} else {
|
|
40
44
|
newFeatures[key] = false;
|
|
41
45
|
}
|
|
@@ -82,9 +86,9 @@ var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig
|
|
|
82
86
|
var channelFeatures = configData.ALL_CHANNEL_FEATURE_STATUS;
|
|
83
87
|
var features = configData.ALL_FEATURE_STATUS;
|
|
84
88
|
return _objectSpread(_objectSpread({}, consoleConfig), {}, {
|
|
85
|
-
CHANNEL_LINKS:
|
|
86
|
-
CHANNEL_FEATURE_STATUS:
|
|
87
|
-
FEATURE_STATUS:
|
|
89
|
+
CHANNEL_LINKS: _objectSpread(_objectSpread({}, consoleConfig === null || consoleConfig === void 0 ? void 0 : consoleConfig.CHANNEL_LINKS), channelLinks),
|
|
90
|
+
CHANNEL_FEATURE_STATUS: _objectSpread(_objectSpread({}, consoleConfig === null || consoleConfig === void 0 ? void 0 : consoleConfig.CHANNEL_FEATURE_STATUS), processChannelFeatures(channelFeatures, channel)),
|
|
91
|
+
FEATURE_STATUS: _objectSpread(_objectSpread({}, consoleConfig === null || consoleConfig === void 0 ? void 0 : consoleConfig.FEATURE_STATUS), processFeatures(features))
|
|
88
92
|
});
|
|
89
93
|
};
|
|
90
94
|
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '1.4.
|
|
1
|
+
export var version = '1.4.17';
|
package/lib/createApplication.js
CHANGED
|
@@ -75,13 +75,26 @@ function createApplication(loader) {
|
|
|
75
75
|
var appRef = (0, _react.useRef)(undefined);
|
|
76
76
|
var tagName = (0, _utils.normalizeName)(props.name);
|
|
77
77
|
var sandbox = (0, _react.useMemo)(function () {
|
|
78
|
+
var _UA_Opt, _RISK_INFO, _um;
|
|
79
|
+
|
|
80
|
+
var aliyunExternalsVars = [];
|
|
81
|
+
|
|
82
|
+
if ((_UA_Opt = window.UA_Opt) !== null && _UA_Opt !== void 0 && _UA_Opt.LogVal) {
|
|
83
|
+
var _UA_Opt2;
|
|
84
|
+
|
|
85
|
+
aliyunExternalsVars.push('UA_Opt');
|
|
86
|
+
aliyunExternalsVars.push((_UA_Opt2 = window.UA_Opt) === null || _UA_Opt2 === void 0 ? void 0 : _UA_Opt2.LogVal);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if ((_RISK_INFO = window.RISK_INFO) !== null && _RISK_INFO !== void 0 && _RISK_INFO.UMID) aliyunExternalsVars.push('RISK_INFO');
|
|
90
|
+
if ((_um = window.um) !== null && _um !== void 0 && _um.getToken) aliyunExternalsVars.push('um');
|
|
78
91
|
return _objectSpread(_objectSpread({}, customSandbox), {}, {
|
|
79
92
|
// allowResources: [
|
|
80
93
|
// ...(customSandbox?.allowResources || []),
|
|
81
94
|
// /^https?:\/\/at\.alicdn\.com\//,
|
|
82
95
|
// ],
|
|
83
96
|
externalsVars: [].concat((0, _toConsumableArray2.default)((customSandbox === null || customSandbox === void 0 ? void 0 : customSandbox.externalsVars) || []), [// global vars used in ConsoleBase.forApp
|
|
84
|
-
'_console_base_ready_'])
|
|
97
|
+
'_console_base_ready_'], aliyunExternalsVars)
|
|
85
98
|
});
|
|
86
99
|
}, [customSandbox]);
|
|
87
100
|
var memoOptions = (0, _react.useMemo)(function () {
|
|
@@ -32,13 +32,13 @@ function afterLoadHook(_x) {
|
|
|
32
32
|
|
|
33
33
|
function _afterLoadHook() {
|
|
34
34
|
_afterLoadHook = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(appConfig) {
|
|
35
|
-
var app, logger, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
|
|
35
|
+
var app, logger, sandbox, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
|
|
36
36
|
|
|
37
37
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
38
38
|
while (1) {
|
|
39
39
|
switch (_context.prev = _context.next) {
|
|
40
40
|
case 0:
|
|
41
|
-
app = appConfig.app, logger = appConfig.logger;
|
|
41
|
+
app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox;
|
|
42
42
|
defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
|
|
43
43
|
defaultConsoleGlobal = window.ALIYUN_CONSOLE_GLOBAL || {};
|
|
44
44
|
CONFIG_START_TIME = Date.now();
|
|
@@ -57,9 +57,9 @@ function _afterLoadHook() {
|
|
|
57
57
|
consoleGlobal = _yield$Promise$all2[1];
|
|
58
58
|
messages = _yield$Promise$all2[2];
|
|
59
59
|
CONFIG_END_TIME = Date.now();
|
|
60
|
-
i18nMessages = _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_I18N_MESSAGE), messages); // inject global variables
|
|
60
|
+
i18nMessages = _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_I18N_MESSAGE), messages); // inject global variables when sandbox is valid
|
|
61
61
|
|
|
62
|
-
if (app && app.context) {
|
|
62
|
+
if (app !== null && app !== void 0 && app.context && !(sandbox !== null && sandbox !== void 0 && sandbox.disable)) {
|
|
63
63
|
app.context.window.ALIYUN_CONSOLE_CONFIG = consoleConfig;
|
|
64
64
|
app.context.window.ALIYUN_CONSOLE_GLOBAL = consoleGlobal;
|
|
65
65
|
app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = i18nMessages;
|
|
@@ -45,8 +45,12 @@ var processFeatures = function processFeatures(features) {
|
|
|
45
45
|
newFeatures[key] = true;
|
|
46
46
|
} else if (enableSampling) {
|
|
47
47
|
var gray = uid.substring(uid.length - 2);
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
|
|
49
|
+
if (Number(gray) >= (sampling !== null && sampling !== void 0 ? sampling : 0) * 100 || sampling === 0) {
|
|
50
|
+
newFeatures[key] = false;
|
|
51
|
+
} else {
|
|
52
|
+
newFeatures[key] = true;
|
|
53
|
+
}
|
|
50
54
|
} else {
|
|
51
55
|
newFeatures[key] = false;
|
|
52
56
|
}
|
|
@@ -93,9 +97,9 @@ var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig
|
|
|
93
97
|
var channelFeatures = configData.ALL_CHANNEL_FEATURE_STATUS;
|
|
94
98
|
var features = configData.ALL_FEATURE_STATUS;
|
|
95
99
|
return _objectSpread(_objectSpread({}, consoleConfig), {}, {
|
|
96
|
-
CHANNEL_LINKS:
|
|
97
|
-
CHANNEL_FEATURE_STATUS:
|
|
98
|
-
FEATURE_STATUS:
|
|
100
|
+
CHANNEL_LINKS: _objectSpread(_objectSpread({}, consoleConfig === null || consoleConfig === void 0 ? void 0 : consoleConfig.CHANNEL_LINKS), channelLinks),
|
|
101
|
+
CHANNEL_FEATURE_STATUS: _objectSpread(_objectSpread({}, consoleConfig === null || consoleConfig === void 0 ? void 0 : consoleConfig.CHANNEL_FEATURE_STATUS), processChannelFeatures(channelFeatures, channel)),
|
|
102
|
+
FEATURE_STATUS: _objectSpread(_objectSpread({}, consoleConfig === null || consoleConfig === void 0 ? void 0 : consoleConfig.FEATURE_STATUS), processFeatures(features))
|
|
99
103
|
});
|
|
100
104
|
};
|
|
101
105
|
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/alfa-react",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.17",
|
|
4
4
|
"description": "Alfa Framework (React Version)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": "^16 | ^17"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "58ccc6a6b1126f84da4a55cf78de8d30ce7d664a"
|
|
55
55
|
}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
import { AlfaConfig } from '@alicloud/alfa-core';
|
|
2
2
|
export declare const getConsoleConfig: (configData: AlfaConfig, consoleConfig: any) => Promise<{
|
|
3
|
-
CHANNEL_LINKS:
|
|
4
|
-
CHANNEL_FEATURE_STATUS:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
CHANNEL_LINKS: {};
|
|
4
|
+
CHANNEL_FEATURE_STATUS: {
|
|
5
|
+
[x: string]: {
|
|
6
|
+
status: boolean;
|
|
7
|
+
attribute: {
|
|
8
|
+
customAttrs: Record<string, unknown>;
|
|
9
|
+
regions: string[] | {
|
|
10
|
+
region: string[];
|
|
11
|
+
};
|
|
10
12
|
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
} | {
|
|
14
|
+
status: boolean;
|
|
15
|
+
attribute: {
|
|
16
|
+
customAttrs: Record<string, unknown>;
|
|
17
|
+
regions: string[] | {
|
|
18
|
+
region: string[];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
} | undefined;
|
|
22
|
+
};
|
|
23
|
+
FEATURE_STATUS: {
|
|
24
|
+
[x: string]: boolean | undefined;
|
|
25
|
+
};
|
|
14
26
|
fEnv?: "pre" | "local" | "prod" | "daily" | undefined;
|
|
15
27
|
LOCALE?: string | undefined;
|
|
16
28
|
CHANNEL?: string | undefined;
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.4.
|
|
1
|
+
export declare const version = "1.4.17";
|