@alicloud/alfa-react 1.3.0-canary.1 → 1.3.0-canary.10
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 +6 -6
- package/es/app/createIsomorphicMicroApp.js +45 -0
- package/es/app/getConsoleConfig.js +1 -1
- package/es/app.js +36 -42
- package/es/components/Loading/index.js +17 -1
- package/es/context.js +7 -0
- package/es/createAlfaApp.js +116 -0
- package/es/createAlfaWidget.js +125 -0
- package/es/createApplication.js +113 -0
- package/es/types/base.js +26 -0
- package/es/types/index.js +1 -0
- package/es/utils/getConsoleConfig.js +2 -2
- package/es/utils/index.js +3 -0
- package/es/utils.js +3 -0
- package/es/widget/emitter.js +4 -4
- package/es/widget/getWidgetConfigById.js +6 -5
- package/es/widget/getWidgetDeps.js +1 -1
- package/es/widget.js +0 -6
- package/lib/app/createIsomorphicMicroApp.d.ts +2 -0
- package/lib/app/createIsomorphicMicroApp.js +65 -0
- package/lib/app/getConsoleConfig.js +1 -1
- package/lib/app.js +35 -40
- package/lib/base.d.ts +0 -3
- package/lib/components/Loading/index.d.ts +5 -2
- package/lib/components/Loading/index.js +18 -1
- package/lib/context.d.ts +7 -0
- package/lib/context.js +15 -0
- package/lib/types.d.ts +0 -1
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +8 -2
- package/lib/widget/emitter.d.ts +1 -0
- package/lib/widget/emitter.js +4 -4
- package/lib/widget/getWidgetConfigById.js +6 -5
- package/lib/widget/getWidgetDeps.js +1 -1
- package/lib/widget.js +0 -7
- package/package.json +6 -9
- package/lib/utils/getConsoleConfig.d.ts +0 -2
- package/lib/utils/getConsoleConfig.js +0 -102
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.getConsoleConfig = void 0;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var _alfaCore = require("@alicloud/alfa-core");
|
|
17
|
-
|
|
18
|
-
var _md = _interopRequireDefault(require("crypto-js/md5"));
|
|
19
|
-
|
|
20
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
-
|
|
22
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* transform
|
|
26
|
-
* @param features
|
|
27
|
-
*/
|
|
28
|
-
//@ts-ignore
|
|
29
|
-
var processFeatures = function processFeatures(features) {
|
|
30
|
-
return Object.keys(features).reduce(function (newFeatures, key) {
|
|
31
|
-
var _ALIYUN_CONSOLE_CONFI;
|
|
32
|
-
|
|
33
|
-
var feature = features[key];
|
|
34
|
-
if (!feature) return newFeatures;
|
|
35
|
-
var uid = ((_ALIYUN_CONSOLE_CONFI = window.ALIYUN_CONSOLE_CONFIG) === null || _ALIYUN_CONSOLE_CONFI === void 0 ? void 0 : _ALIYUN_CONSOLE_CONFI.CURRENT_PK) || '';
|
|
36
|
-
var md5Uid = (0, _md.default)(uid).toString();
|
|
37
|
-
var enableBlockList = feature.enableBlockList,
|
|
38
|
-
enableSampling = feature.enableSampling,
|
|
39
|
-
enableWhiteList = feature.enableWhiteList,
|
|
40
|
-
sampling = feature.sampling,
|
|
41
|
-
blockList = feature.blockList,
|
|
42
|
-
whiteList = feature.whiteList;
|
|
43
|
-
|
|
44
|
-
if (enableBlockList && blockList.includes(md5Uid)) {
|
|
45
|
-
newFeatures[key] = false;
|
|
46
|
-
} else if (enableWhiteList && whiteList.includes(md5Uid)) {
|
|
47
|
-
newFeatures[key] = true;
|
|
48
|
-
} else if (enableSampling) {
|
|
49
|
-
var gray = uid.substring(uid.length - 2);
|
|
50
|
-
if (Number(gray) >= sampling * 100 || sampling === 0) newFeatures[key] = false;
|
|
51
|
-
newFeatures[key] = true;
|
|
52
|
-
} else {
|
|
53
|
-
newFeatures[key] = false;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return newFeatures;
|
|
57
|
-
}, {});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig(configData, consoleConfig) {
|
|
61
|
-
var _window, _window$ALIYUN_CONSOL, _configData$ALL_CHANN, _configData$ALL_CHANN2;
|
|
62
|
-
|
|
63
|
-
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';
|
|
64
|
-
var channelLinks = ((_configData$ALL_CHANN = configData.ALL_CHANNEL_LINKS) === null || _configData$ALL_CHANN === void 0 ? void 0 : _configData$ALL_CHANN[channel]) || {};
|
|
65
|
-
var channelFeatures = ((_configData$ALL_CHANN2 = configData.ALL_CHANNEL_FEATURE_STATUS) === null || _configData$ALL_CHANN2 === void 0 ? void 0 : _configData$ALL_CHANN2[channel]) || {}; //@ts-ignore
|
|
66
|
-
|
|
67
|
-
var features = configData.ALL_FEATURE_STATUS || {};
|
|
68
|
-
return _objectSpread(_objectSpread({}, consoleConfig), {}, {
|
|
69
|
-
CHANNEL_LINKS: channelLinks,
|
|
70
|
-
CHANNEL_FEATURE_STATUS: channelFeatures,
|
|
71
|
-
FEATURE_STATUS: processFeatures(features)
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
var getConsoleConfig = /*#__PURE__*/function () {
|
|
76
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(option, consoleConfig) {
|
|
77
|
-
var configData;
|
|
78
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
79
|
-
while (1) {
|
|
80
|
-
switch (_context.prev = _context.next) {
|
|
81
|
-
case 0:
|
|
82
|
-
_context.next = 2;
|
|
83
|
-
return (0, _alfaCore.getConfig)(option);
|
|
84
|
-
|
|
85
|
-
case 2:
|
|
86
|
-
configData = _context.sent;
|
|
87
|
-
return _context.abrupt("return", mergeConfigDataWithConsoleConfig(configData, consoleConfig));
|
|
88
|
-
|
|
89
|
-
case 4:
|
|
90
|
-
case "end":
|
|
91
|
-
return _context.stop();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}, _callee);
|
|
95
|
-
}));
|
|
96
|
-
|
|
97
|
-
return function getConsoleConfig(_x, _x2) {
|
|
98
|
-
return _ref.apply(this, arguments);
|
|
99
|
-
};
|
|
100
|
-
}();
|
|
101
|
-
|
|
102
|
-
exports.getConsoleConfig = getConsoleConfig;
|