chayns-api 1.2.0-0 → 1.2.0-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/cjs/components/withCompatMode.js +10 -6
- package/dist/cjs/host/module/utils/loadComponent.js +24 -28
- package/dist/cjs/host/module/utils/useDynamicScript.js +4 -6
- package/dist/cjs/index.js +26 -6
- package/dist/cjs/types/IChaynsReact.js +13 -1
- package/dist/cjs/util/deviceHelper.js +23 -11
- package/dist/cjs/util/initModuleFederationSharing.js +44 -0
- package/dist/cjs/util/is.js +30 -0
- package/dist/cjs/wrapper/AppWrapper.js +33 -5
- package/dist/cjs/wrapper/StaticChaynsApi.js +12 -1
- package/dist/esm/components/withCompatMode.js +10 -6
- package/dist/esm/host/module/utils/loadComponent.js +22 -25
- package/dist/esm/index.js +2 -4
- package/dist/esm/types/IChaynsReact.js +12 -0
- package/dist/esm/util/deviceHelper.js +24 -11
- package/dist/esm/util/initModuleFederationSharing.js +36 -0
- package/dist/esm/util/is.js +23 -0
- package/dist/esm/wrapper/AppWrapper.js +36 -7
- package/dist/esm/wrapper/StaticChaynsApi.js +11 -1
- package/dist/types/components/withCompatMode.d.ts +1 -0
- package/dist/types/host/module/utils/loadComponent.d.ts +1 -1
- package/dist/types/index.d.ts +2 -5
- package/dist/types/types/IChaynsReact.d.ts +45 -5
- package/dist/types/util/deviceHelper.d.ts +3 -1
- package/dist/types/util/initModuleFederationSharing.d.ts +1 -0
- package/dist/types/util/is.d.ts +5 -0
- package/package.json +7 -5
|
@@ -45,11 +45,14 @@ const withCompatMode = Component => {
|
|
|
45
45
|
const component = /*#__PURE__*/_react.default.createElement(_ErrorBoundary.default, null, /*#__PURE__*/_react.default.createElement(Component, _extends({}, this.props, {
|
|
46
46
|
ref: innerRef
|
|
47
47
|
})));
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
clearTimeout(this.timeout);
|
|
49
|
+
this.timeout = setTimeout(() => {
|
|
50
|
+
if (this.root) {
|
|
51
|
+
this.root.render(component);
|
|
52
|
+
} else {
|
|
53
|
+
_reactDom.default.render(component, this.ref.current);
|
|
54
|
+
}
|
|
55
|
+
}, 0);
|
|
53
56
|
}
|
|
54
57
|
componentWillUnmount() {
|
|
55
58
|
if (this.root) {
|
|
@@ -75,7 +78,8 @@ const withCompatMode = Component => {
|
|
|
75
78
|
requiredVersion: __REQUIRED_REACT_VERSION__,
|
|
76
79
|
environment: process.env.NODE_ENV,
|
|
77
80
|
buildEnv: process.env.BUILD_ENV || process.env.NODE_ENV,
|
|
78
|
-
appVersion: process.env.VERSION
|
|
81
|
+
appVersion: process.env.VERSION,
|
|
82
|
+
version: 2
|
|
79
83
|
};
|
|
80
84
|
};
|
|
81
85
|
exports.withCompatMode = withCompatMode;
|
|
@@ -4,38 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.loadModule = exports.default = void 0;
|
|
7
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
8
7
|
var _semver = _interopRequireDefault(require("semver"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _runtime = require("@module-federation/runtime");
|
|
11
|
-
var _process$env$__PACKAG;
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
scope: 'default',
|
|
24
|
-
lib: () => _react.default
|
|
25
|
-
},
|
|
26
|
-
'react-dom': {
|
|
27
|
-
version: _reactDom.default.version,
|
|
28
|
-
scope: 'default',
|
|
29
|
-
lib: () => _reactDom.default
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
const loadModule = (scope, module, url, preventSingleton = false) => {
|
|
10
|
+
const loadModule = (scope, module, url, preventSingleton = false, shareScope = 'chayns-api2') => {
|
|
11
|
+
const {
|
|
12
|
+
loadRemote,
|
|
13
|
+
registerRemotes
|
|
14
|
+
} = globalThis.moduleFederationRuntime;
|
|
15
|
+
const {
|
|
16
|
+
registeredScopes,
|
|
17
|
+
moduleMap,
|
|
18
|
+
componentMap
|
|
19
|
+
} = globalThis.moduleFederationScopes;
|
|
34
20
|
if (registeredScopes[scope] !== url || preventSingleton) {
|
|
35
21
|
if (scope in registeredScopes) {
|
|
36
22
|
console.error(`[chayns-api] call registerRemote with force for scope ${scope}. url: ${url}`);
|
|
37
23
|
}
|
|
38
|
-
|
|
24
|
+
registerRemotes([{
|
|
25
|
+
shareScope,
|
|
39
26
|
name: scope,
|
|
40
27
|
entry: url,
|
|
41
28
|
alias: scope
|
|
@@ -48,7 +35,7 @@ const loadModule = (scope, module, url, preventSingleton = false) => {
|
|
|
48
35
|
}
|
|
49
36
|
if (!(module in moduleMap[scope])) {
|
|
50
37
|
const path = `${scope}/${module.replace(/^\.\//, '')}`;
|
|
51
|
-
const promise =
|
|
38
|
+
const promise = loadRemote(path);
|
|
52
39
|
promise.catch(e => {
|
|
53
40
|
console.error("[chayns-api] Failed to load module", scope, url, e);
|
|
54
41
|
// causes registerRemote with force = true on next attempt to load the component which tries to load the component again
|
|
@@ -63,6 +50,12 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
63
50
|
if (skipCompatMode) {
|
|
64
51
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
65
52
|
}
|
|
53
|
+
const {
|
|
54
|
+
loadShareSync
|
|
55
|
+
} = globalThis.moduleFederationRuntime;
|
|
56
|
+
const {
|
|
57
|
+
componentMap
|
|
58
|
+
} = globalThis.moduleFederationScopes;
|
|
66
59
|
if (!componentMap[scope]) {
|
|
67
60
|
componentMap[scope] = {};
|
|
68
61
|
}
|
|
@@ -77,9 +70,10 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
77
70
|
environment
|
|
78
71
|
} = Module.default;
|
|
79
72
|
const shareScopes = await new Promise(resolve => {
|
|
80
|
-
|
|
73
|
+
loadShareSync('react', {
|
|
81
74
|
resolver: shareOptions => {
|
|
82
75
|
resolve(shareOptions);
|
|
76
|
+
console.log("shareOptions", shareOptions);
|
|
83
77
|
return shareOptions[0];
|
|
84
78
|
}
|
|
85
79
|
});
|
|
@@ -90,11 +84,13 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
90
84
|
}) => {
|
|
91
85
|
return _semver.default.gt(version, hostVersion) && _semver.default.satisfies(version, requiredVersion) || scope === from.split('-').join('_');
|
|
92
86
|
});
|
|
93
|
-
if (!matchReactVersion || environment !== 'production' || process.env.NODE_ENV === 'development') {
|
|
87
|
+
if (!matchReactVersion || environment !== 'production' || process.env.NODE_ENV === 'development' || Module.default.version !== 2) {
|
|
88
|
+
console.log("use compat mode for", scope, module);
|
|
94
89
|
return {
|
|
95
90
|
default: Module.default.CompatComponent
|
|
96
91
|
};
|
|
97
92
|
}
|
|
93
|
+
console.log("use direct component for", scope, module);
|
|
98
94
|
return {
|
|
99
95
|
default: Module.default.Component
|
|
100
96
|
};
|
|
@@ -7,10 +7,9 @@ exports.semaphore = exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _semaphoreAsyncAwait = _interopRequireDefault(require("semaphore-async-await"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
function _getRequireWildcardCache(
|
|
11
|
-
function _interopRequireWildcard(
|
|
12
|
-
const semaphore = {};
|
|
13
|
-
exports.semaphore = semaphore;
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
const semaphore = exports.semaphore = {};
|
|
14
13
|
const useDynamicScript = args => {
|
|
15
14
|
const [ready, setReady] = _react.default.useState(false);
|
|
16
15
|
const [failed, setFailed] = _react.default.useState(false);
|
|
@@ -57,5 +56,4 @@ const useDynamicScript = args => {
|
|
|
57
56
|
failed
|
|
58
57
|
};
|
|
59
58
|
};
|
|
60
|
-
var _default = useDynamicScript;
|
|
61
|
-
exports.default = _default;
|
|
59
|
+
var _default = exports.default = useDynamicScript;
|
package/dist/cjs/index.js
CHANGED
|
@@ -41,7 +41,7 @@ Object.defineProperty(exports, "StaticChaynsApi", {
|
|
|
41
41
|
return _StaticChaynsApi.default;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
exports.dialog =
|
|
44
|
+
exports.dialog = void 0;
|
|
45
45
|
Object.defineProperty(exports, "getClientDeviceInfo", {
|
|
46
46
|
enumerable: true,
|
|
47
47
|
get: function () {
|
|
@@ -148,6 +148,18 @@ Object.keys(_IChaynsReact).forEach(function (key) {
|
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
});
|
|
151
|
+
var _is = require("./util/is");
|
|
152
|
+
Object.keys(_is).forEach(function (key) {
|
|
153
|
+
if (key === "default" || key === "__esModule") return;
|
|
154
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
155
|
+
if (key in exports && exports[key] === _is[key]) return;
|
|
156
|
+
Object.defineProperty(exports, key, {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _is[key];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
151
163
|
var _constants = require("./constants");
|
|
152
164
|
Object.keys(_constants).forEach(function (key) {
|
|
153
165
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -166,10 +178,18 @@ var _loadComponent = _interopRequireWildcard(require("./host/module/utils/loadCo
|
|
|
166
178
|
var _DialogHandler = _interopRequireDefault(require("./handler/DialogHandler"));
|
|
167
179
|
var _dialog = _interopRequireWildcard(require("./calls/dialogs/index"));
|
|
168
180
|
exports.dialog = _dialog;
|
|
181
|
+
var _initModuleFederationSharing = require("./util/initModuleFederationSharing");
|
|
182
|
+
Object.keys(_initModuleFederationSharing).forEach(function (key) {
|
|
183
|
+
if (key === "default" || key === "__esModule") return;
|
|
184
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
185
|
+
if (key in exports && exports[key] === _initModuleFederationSharing[key]) return;
|
|
186
|
+
Object.defineProperty(exports, key, {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () {
|
|
189
|
+
return _initModuleFederationSharing[key];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
169
193
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
170
194
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
171
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
172
|
-
var _default = exports.default = {
|
|
173
|
-
buildEnv: process.env.BUILD_ENV,
|
|
174
|
-
appVersion: process.env.VERSION
|
|
175
|
-
};
|
|
195
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -3,13 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ToastType = exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.MediaType = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogIconType = exports.DialogButtonType = exports.DialogAnimation = exports.DeviceOs = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
|
|
6
|
+
exports.WeekDayType = exports.ToastType = exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.MediaType = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogIconType = exports.DialogButtonType = exports.DialogAnimation = exports.DeviceOs = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
|
|
7
7
|
let DateType = exports.DateType = /*#__PURE__*/function (DateType) {
|
|
8
8
|
DateType[DateType["DATE"] = 0] = "DATE";
|
|
9
9
|
DateType[DateType["TIME"] = 1] = "TIME";
|
|
10
10
|
DateType[DateType["DATE_TIME"] = 2] = "DATE_TIME";
|
|
11
11
|
return DateType;
|
|
12
12
|
}({});
|
|
13
|
+
let WeekDayType = exports.WeekDayType = /*#__PURE__*/function (WeekDayType) {
|
|
14
|
+
WeekDayType[WeekDayType["SUNDAY"] = 0] = "SUNDAY";
|
|
15
|
+
WeekDayType[WeekDayType["MONDAY"] = 1] = "MONDAY";
|
|
16
|
+
WeekDayType[WeekDayType["TUESDAY"] = 2] = "TUESDAY";
|
|
17
|
+
WeekDayType[WeekDayType["WEDNESDAY"] = 3] = "WEDNESDAY";
|
|
18
|
+
WeekDayType[WeekDayType["THURSDAY"] = 4] = "THURSDAY";
|
|
19
|
+
WeekDayType[WeekDayType["FRIDAY"] = 5] = "FRIDAY";
|
|
20
|
+
WeekDayType[WeekDayType["SATURDAY"] = 6] = "SATURDAY";
|
|
21
|
+
return WeekDayType;
|
|
22
|
+
}({});
|
|
13
23
|
let ToastType = exports.ToastType = /*#__PURE__*/function (ToastType) {
|
|
14
24
|
ToastType[ToastType["NEUTRAL"] = 1] = "NEUTRAL";
|
|
15
25
|
ToastType[ToastType["SUCCESS"] = 2] = "SUCCESS";
|
|
@@ -29,6 +39,7 @@ let DialogSelectType = exports.DialogSelectType = /*#__PURE__*/function (DialogS
|
|
|
29
39
|
DialogSelectType[DialogSelectType["DEFAULT"] = 0] = "DEFAULT";
|
|
30
40
|
DialogSelectType[DialogSelectType["ICON"] = 1] = "ICON";
|
|
31
41
|
DialogSelectType[DialogSelectType["IMAGE"] = 2] = "IMAGE";
|
|
42
|
+
DialogSelectType[DialogSelectType["SIMPLE"] = 3] = "SIMPLE";
|
|
32
43
|
return DialogSelectType;
|
|
33
44
|
}({});
|
|
34
45
|
let DialogButtonType = exports.DialogButtonType = /*#__PURE__*/function (DialogButtonType) {
|
|
@@ -210,6 +221,7 @@ let RuntimeEnviroment = exports.RuntimeEnviroment = /*#__PURE__*/function (Runti
|
|
|
210
221
|
RuntimeEnviroment[RuntimeEnviroment["ChaynsRuntime"] = 3] = "ChaynsRuntime";
|
|
211
222
|
RuntimeEnviroment[RuntimeEnviroment["IntercomPlugin"] = 4] = "IntercomPlugin";
|
|
212
223
|
RuntimeEnviroment[RuntimeEnviroment["PagemakerPlugin"] = 5] = "PagemakerPlugin";
|
|
224
|
+
RuntimeEnviroment[RuntimeEnviroment["Dialog"] = 6] = "Dialog";
|
|
213
225
|
return RuntimeEnviroment;
|
|
214
226
|
}({});
|
|
215
227
|
let DeviceOs = exports.DeviceOs = /*#__PURE__*/function (DeviceOs) {
|
|
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getScreenSize = exports.getClientDeviceInfo = exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uaParserJs = require("ua-parser-js");
|
|
8
8
|
var _IChaynsReact = require("../types/IChaynsReact");
|
|
9
|
-
const getDeviceInfo = (userAgent, acceptHeader
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const getDeviceInfo = (userAgent, acceptHeader, {
|
|
10
|
+
imei
|
|
11
|
+
} = {}) => {
|
|
12
|
+
var _match$groups, _match$groups2, _customMatch$groups, _browser$version$spli, _browser$version, _uaParser$getOS, _uaParser$getOS2, _uaParser$getOS3;
|
|
13
|
+
const uaParser = new _uaParserJs.UAParser(userAgent);
|
|
12
14
|
let appName = _IChaynsReact.AppName.Unknown;
|
|
13
15
|
const match = /(?:my)?chayns\/(?<version>\d+).*(?<siteId>\d{5}-\d{5})/i.exec(userAgent);
|
|
16
|
+
const customMatch = /\s(?<name>intercom|sidekick|team)\/(?<version>\d+)/i.exec(userAgent);
|
|
14
17
|
if (/\sintercom\/\d+/i.test(userAgent)) {
|
|
15
18
|
appName = _IChaynsReact.AppName.TobitChat;
|
|
16
19
|
} else if (/\ssidekick\/\d+/i.test(userAgent)) {
|
|
@@ -26,20 +29,29 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
26
29
|
} else if (/dface|h96pp|h96max|jabiru|chaynsterminal|wayter|odroidn2p/i.test(userAgent)) {
|
|
27
30
|
appName = _IChaynsReact.AppName.ChaynsLauncher;
|
|
28
31
|
}
|
|
32
|
+
let appVersion = match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN;
|
|
33
|
+
if (customMatch !== null && customMatch !== void 0 && (_customMatch$groups = customMatch.groups) !== null && _customMatch$groups !== void 0 && _customMatch$groups.version) {
|
|
34
|
+
appVersion = Number.parseInt(customMatch.groups.version, 10);
|
|
35
|
+
}
|
|
29
36
|
const result = {};
|
|
37
|
+
const browser = uaParser.getBrowser();
|
|
30
38
|
result.browser = {
|
|
31
|
-
name:
|
|
32
|
-
version:
|
|
33
|
-
majorVersion: Number.parseInt((
|
|
39
|
+
name: browser === null || browser === void 0 ? void 0 : browser.name,
|
|
40
|
+
version: browser === null || browser === void 0 ? void 0 : browser.version,
|
|
41
|
+
majorVersion: Number.parseInt((_browser$version$spli = browser === null || browser === void 0 || (_browser$version = browser.version) === null || _browser$version === void 0 ? void 0 : _browser$version.split('.')[0]) !== null && _browser$version$spli !== void 0 ? _browser$version$spli : '0', 10) || 0,
|
|
34
42
|
isWebPSupported: acceptHeader.includes('image/webp')
|
|
35
43
|
};
|
|
36
44
|
result.app = {
|
|
37
45
|
name: appName,
|
|
38
|
-
version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
46
|
+
version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN,
|
|
47
|
+
appVersion,
|
|
48
|
+
callVersion: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
39
49
|
};
|
|
40
|
-
result.imei =
|
|
41
|
-
result.
|
|
42
|
-
|
|
50
|
+
result.imei = imei;
|
|
51
|
+
result.engine = uaParser.getEngine();
|
|
52
|
+
// TODO: breaking change on next minor and use object with name and version
|
|
53
|
+
result.os = ((_uaParser$getOS = uaParser.getOS()) === null || _uaParser$getOS === void 0 ? void 0 : _uaParser$getOS.name) === 'Android' ? 'Android OS' : (_uaParser$getOS2 = uaParser.getOS()) === null || _uaParser$getOS2 === void 0 ? void 0 : _uaParser$getOS2.name;
|
|
54
|
+
result.osVersion = (_uaParser$getOS3 = uaParser.getOS()) === null || _uaParser$getOS3 === void 0 ? void 0 : _uaParser$getOS3.version;
|
|
43
55
|
if (typeof window !== 'undefined') {
|
|
44
56
|
result.screenSize = getScreenSize(window.innerWidth);
|
|
45
57
|
result.isTouch = getClientDeviceInfo().isTouch;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.initModuleFederationSharing = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const initModuleFederationSharing = () => {
|
|
11
|
+
// forces single instance of module federation runtime
|
|
12
|
+
if (!globalThis.moduleFederationRuntime) {
|
|
13
|
+
var _process$env$__PACKAG;
|
|
14
|
+
globalThis.moduleFederationRuntime = require('@module-federation/enhanced/runtime');
|
|
15
|
+
globalThis.moduleFederationScopes = {
|
|
16
|
+
registeredScopes: {},
|
|
17
|
+
moduleMap: {},
|
|
18
|
+
componentMap: {}
|
|
19
|
+
};
|
|
20
|
+
const {
|
|
21
|
+
init
|
|
22
|
+
} = globalThis.moduleFederationRuntime;
|
|
23
|
+
|
|
24
|
+
// init also should only be called once
|
|
25
|
+
init({
|
|
26
|
+
// will be set by chayns-toolkit via DefinePlugin
|
|
27
|
+
name: (_process$env$__PACKAG = process.env.__PACKAGE_NAME__) !== null && _process$env$__PACKAG !== void 0 ? _process$env$__PACKAG : '',
|
|
28
|
+
remotes: [],
|
|
29
|
+
shared: {
|
|
30
|
+
react: {
|
|
31
|
+
version: _react.default.version,
|
|
32
|
+
scope: 'chayns-api2',
|
|
33
|
+
lib: () => _react.default
|
|
34
|
+
},
|
|
35
|
+
'react-dom': {
|
|
36
|
+
version: _reactDom.default.version,
|
|
37
|
+
scope: 'chayns-api2',
|
|
38
|
+
lib: () => _reactDom.default
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.initModuleFederationSharing = initModuleFederationSharing;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isAppCallSupported = exports.isApp = void 0;
|
|
7
|
+
var _calls = require("../calls");
|
|
8
|
+
var _IChaynsReact = require("../types/IChaynsReact");
|
|
9
|
+
const isApp = () => {
|
|
10
|
+
var _getDevice$app$name, _getDevice$app;
|
|
11
|
+
return ((_getDevice$app$name = (_getDevice$app = (0, _calls.getDevice)().app) === null || _getDevice$app === void 0 ? void 0 : _getDevice$app.name) !== null && _getDevice$app$name !== void 0 ? _getDevice$app$name : _IChaynsReact.AppName.Unknown) !== _IChaynsReact.AppName.Unknown;
|
|
12
|
+
};
|
|
13
|
+
exports.isApp = isApp;
|
|
14
|
+
const isAppCallSupported = ({
|
|
15
|
+
minAndroidVersion = 1,
|
|
16
|
+
minIOSVersion = 1
|
|
17
|
+
}) => {
|
|
18
|
+
var _device$app;
|
|
19
|
+
if (!isApp()) return false;
|
|
20
|
+
const device = (0, _calls.getDevice)();
|
|
21
|
+
if (!((_device$app = device.app) !== null && _device$app !== void 0 && _device$app.callVersion) || isNaN(device.app.callVersion)) return false;
|
|
22
|
+
if (device.os && ['iOS', 'Mac OS'].includes(device.os)) {
|
|
23
|
+
return device.app.callVersion >= minIOSVersion;
|
|
24
|
+
}
|
|
25
|
+
if (device.os === 'Android OS') {
|
|
26
|
+
return device.app.callVersion >= minAndroidVersion;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
};
|
|
30
|
+
exports.isAppCallSupported = isAppCallSupported;
|
|
@@ -13,6 +13,7 @@ var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
|
13
13
|
var _sendMessage = require("../calls/sendMessage");
|
|
14
14
|
var _apiListenerHelper = require("../helper/apiListenerHelper");
|
|
15
15
|
var _languages = require("../constants/languages");
|
|
16
|
+
var _is = require("../util/is");
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -67,7 +68,9 @@ class AppWrapper {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
return {
|
|
70
|
-
device: (0, _deviceHelper.default)(navigator.userAgent, 'image/webp'
|
|
71
|
+
device: (0, _deviceHelper.default)(navigator.userAgent, 'image/webp', {
|
|
72
|
+
imei: Device.IMEI
|
|
73
|
+
}),
|
|
71
74
|
environment: {
|
|
72
75
|
buildEnvironment: _IChaynsReact.Environment.Production,
|
|
73
76
|
runtimeEnvironment: _IChaynsReact.RuntimeEnviroment.Unknown
|
|
@@ -417,6 +420,25 @@ class AppWrapper {
|
|
|
417
420
|
}
|
|
418
421
|
},
|
|
419
422
|
selectPage: async options => {
|
|
423
|
+
var _this$values, _this$values2;
|
|
424
|
+
if ((_this$values = this.values) !== null && _this$values !== void 0 && (_this$values = _this$values.site) !== null && _this$values !== void 0 && _this$values.id && options.siteId && options.siteId !== ((_this$values2 = this.values) === null || _this$values2 === void 0 || (_this$values2 = _this$values2.site) === null || _this$values2 === void 0 ? void 0 : _this$values2.id)) {
|
|
425
|
+
const url = new URL(`https://chayns.site/${options.siteId}`);
|
|
426
|
+
if (options.id) {
|
|
427
|
+
url.pathname += `/tapp/${options.id}`;
|
|
428
|
+
} else if (options.path) {
|
|
429
|
+
url.pathname += `/${options.path}`;
|
|
430
|
+
}
|
|
431
|
+
if (options.params) {
|
|
432
|
+
Object.entries(options.params).forEach(([k, v]) => {
|
|
433
|
+
url.searchParams.set(k, v);
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
void this.appCall(9, {
|
|
437
|
+
url: url.toString(),
|
|
438
|
+
checkForChaynsSite: true
|
|
439
|
+
});
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
420
442
|
void this.appCall(2, {
|
|
421
443
|
id: options.id,
|
|
422
444
|
showName: options.showName,
|
|
@@ -426,14 +448,16 @@ class AppWrapper {
|
|
|
426
448
|
awaitResult: false
|
|
427
449
|
});
|
|
428
450
|
},
|
|
429
|
-
scrollToY: async position => {
|
|
451
|
+
scrollToY: async (position, duration) => {
|
|
430
452
|
window.scrollTo({
|
|
431
|
-
top: position
|
|
453
|
+
top: position,
|
|
454
|
+
behavior: duration ? 'smooth' : 'auto'
|
|
432
455
|
});
|
|
433
456
|
},
|
|
434
457
|
scrollByY: (value, duration) => {
|
|
435
458
|
window.scrollBy({
|
|
436
|
-
top: value
|
|
459
|
+
top: value,
|
|
460
|
+
behavior: duration ? 'smooth' : 'auto'
|
|
437
461
|
});
|
|
438
462
|
},
|
|
439
463
|
sendMessageToGroup: async (groupId, message) => {
|
|
@@ -539,12 +563,16 @@ class AppWrapper {
|
|
|
539
563
|
},
|
|
540
564
|
openDialog: async (config, callback) => {
|
|
541
565
|
const currentDialogId = appWrapperDialogId++;
|
|
566
|
+
const isSupported = (0, _is.isAppCallSupported)({
|
|
567
|
+
minAndroidVersion: 7137,
|
|
568
|
+
minIOSVersion: 6934
|
|
569
|
+
});
|
|
542
570
|
this.appCall(184, {
|
|
543
571
|
dialogContent: {
|
|
544
572
|
apiVersion: 5,
|
|
545
573
|
config
|
|
546
574
|
},
|
|
547
|
-
externalDialogUrl: 'https://tapp.chayns-static.space/api/dialog-v2/v1/index.html'
|
|
575
|
+
externalDialogUrl: isSupported ? undefined : 'https://tapp.chayns-static.space/api/dialog-v2/v1/index.html'
|
|
548
576
|
}, {
|
|
549
577
|
awaitResult: true
|
|
550
578
|
}).then(result => {
|
|
@@ -5,10 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _moduleWrapper = require("../components/moduleWrapper");
|
|
8
|
+
var _IChaynsReact = require("../types/IChaynsReact");
|
|
9
|
+
var _deviceHelper = _interopRequireDefault(require("../util/deviceHelper"));
|
|
10
|
+
var _AppWrapper = require("./AppWrapper");
|
|
8
11
|
var _FrameWrapper = require("./FrameWrapper");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
13
|
class StaticChaynsApi {
|
|
10
14
|
constructor() {
|
|
11
|
-
|
|
15
|
+
var _deviceInfo$app$name, _deviceInfo$app;
|
|
16
|
+
let wrapper;
|
|
17
|
+
const deviceInfo = (0, _deviceHelper.default)(navigator.userAgent, '');
|
|
18
|
+
if ([_IChaynsReact.AppName.Chayns, _IChaynsReact.AppName.ChaynsLauncher, _IChaynsReact.AppName.Sidekick, _IChaynsReact.AppName.TobitChat].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : _IChaynsReact.AppName.Unknown) && window.self === window.top) {
|
|
19
|
+
wrapper = new _AppWrapper.AppWrapper();
|
|
20
|
+
} else {
|
|
21
|
+
wrapper = new _FrameWrapper.FrameWrapper();
|
|
22
|
+
}
|
|
12
23
|
_moduleWrapper.moduleWrapper.current = wrapper;
|
|
13
24
|
this._wrapper = wrapper;
|
|
14
25
|
this.ready = wrapper.init();
|
|
@@ -38,11 +38,14 @@ export const withCompatMode = Component => {
|
|
|
38
38
|
const component = /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(Component, _extends({}, this.props, {
|
|
39
39
|
ref: innerRef
|
|
40
40
|
})));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
clearTimeout(this.timeout);
|
|
42
|
+
this.timeout = setTimeout(() => {
|
|
43
|
+
if (this.root) {
|
|
44
|
+
this.root.render(component);
|
|
45
|
+
} else {
|
|
46
|
+
ReactDOM.render(component, this.ref.current);
|
|
47
|
+
}
|
|
48
|
+
}, 0);
|
|
46
49
|
}
|
|
47
50
|
componentWillUnmount() {
|
|
48
51
|
if (this.root) {
|
|
@@ -68,6 +71,7 @@ export const withCompatMode = Component => {
|
|
|
68
71
|
requiredVersion: __REQUIRED_REACT_VERSION__,
|
|
69
72
|
environment: process.env.NODE_ENV,
|
|
70
73
|
buildEnv: process.env.BUILD_ENV || process.env.NODE_ENV,
|
|
71
|
-
appVersion: process.env.VERSION
|
|
74
|
+
appVersion: process.env.VERSION,
|
|
75
|
+
version: 2
|
|
72
76
|
};
|
|
73
77
|
};
|
|
@@ -1,35 +1,23 @@
|
|
|
1
|
-
var _process$env$__PACKAG;
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
1
|
import semver from 'semver';
|
|
4
|
-
import React from
|
|
5
|
-
import { loadRemote, registerRemotes, loadShareSync, init } from '@module-federation/runtime';
|
|
6
|
-
const registeredScopes = {};
|
|
7
|
-
const moduleMap = {};
|
|
8
|
-
const componentMap = {};
|
|
9
|
-
init({
|
|
10
|
-
// will be set by chayns-toolkit via DefinePlugin
|
|
11
|
-
name: (_process$env$__PACKAG = process.env.__PACKAGE_NAME__) !== null && _process$env$__PACKAG !== void 0 ? _process$env$__PACKAG : '',
|
|
12
|
-
remotes: [],
|
|
13
|
-
shared: {
|
|
14
|
-
react: {
|
|
15
|
-
version: React.version,
|
|
16
|
-
scope: 'default',
|
|
17
|
-
lib: () => React
|
|
18
|
-
},
|
|
19
|
-
'react-dom': {
|
|
20
|
-
version: ReactDOM.version,
|
|
21
|
-
scope: 'default',
|
|
22
|
-
lib: () => ReactDOM
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
2
|
+
import React from "react";
|
|
26
3
|
export const loadModule = function (scope, module, url) {
|
|
27
4
|
let preventSingleton = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
5
|
+
let shareScope = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'chayns-api2';
|
|
6
|
+
const {
|
|
7
|
+
loadRemote,
|
|
8
|
+
registerRemotes
|
|
9
|
+
} = globalThis.moduleFederationRuntime;
|
|
10
|
+
const {
|
|
11
|
+
registeredScopes,
|
|
12
|
+
moduleMap,
|
|
13
|
+
componentMap
|
|
14
|
+
} = globalThis.moduleFederationScopes;
|
|
28
15
|
if (registeredScopes[scope] !== url || preventSingleton) {
|
|
29
16
|
if (scope in registeredScopes) {
|
|
30
17
|
console.error(`[chayns-api] call registerRemote with force for scope ${scope}. url: ${url}`);
|
|
31
18
|
}
|
|
32
19
|
registerRemotes([{
|
|
20
|
+
shareScope,
|
|
33
21
|
name: scope,
|
|
34
22
|
entry: url,
|
|
35
23
|
alias: scope
|
|
@@ -58,6 +46,12 @@ const loadComponent = function (scope, module, url) {
|
|
|
58
46
|
if (skipCompatMode) {
|
|
59
47
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
60
48
|
}
|
|
49
|
+
const {
|
|
50
|
+
loadShareSync
|
|
51
|
+
} = globalThis.moduleFederationRuntime;
|
|
52
|
+
const {
|
|
53
|
+
componentMap
|
|
54
|
+
} = globalThis.moduleFederationScopes;
|
|
61
55
|
if (!componentMap[scope]) {
|
|
62
56
|
componentMap[scope] = {};
|
|
63
57
|
}
|
|
@@ -75,6 +69,7 @@ const loadComponent = function (scope, module, url) {
|
|
|
75
69
|
loadShareSync('react', {
|
|
76
70
|
resolver: shareOptions => {
|
|
77
71
|
resolve(shareOptions);
|
|
72
|
+
console.log("shareOptions", shareOptions);
|
|
78
73
|
return shareOptions[0];
|
|
79
74
|
}
|
|
80
75
|
});
|
|
@@ -86,11 +81,13 @@ const loadComponent = function (scope, module, url) {
|
|
|
86
81
|
} = _ref;
|
|
87
82
|
return semver.gt(version, hostVersion) && semver.satisfies(version, requiredVersion) || scope === from.split('-').join('_');
|
|
88
83
|
});
|
|
89
|
-
if (!matchReactVersion || environment !== 'production' || process.env.NODE_ENV === 'development') {
|
|
84
|
+
if (!matchReactVersion || environment !== 'production' || process.env.NODE_ENV === 'development' || Module.default.version !== 2) {
|
|
85
|
+
console.log("use compat mode for", scope, module);
|
|
90
86
|
return {
|
|
91
87
|
default: Module.default.CompatComponent
|
|
92
88
|
};
|
|
93
89
|
}
|
|
90
|
+
console.log("use direct component for", scope, module);
|
|
94
91
|
return {
|
|
95
92
|
default: Module.default.Component
|
|
96
93
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './calls';
|
|
|
7
7
|
export * from './hooks';
|
|
8
8
|
export * from './components/WaitUntil';
|
|
9
9
|
export * from './types/IChaynsReact';
|
|
10
|
+
export * from './util/is';
|
|
10
11
|
export * from './components/withCompatMode';
|
|
11
12
|
export * from './constants';
|
|
12
13
|
export { default as withHydrationBoundary } from './components/withHydrationBoundary';
|
|
@@ -16,7 +17,4 @@ export { default as DialogHandler } from './handler/DialogHandler';
|
|
|
16
17
|
import * as _dialog from './calls/dialogs/index';
|
|
17
18
|
export { _dialog as dialog };
|
|
18
19
|
export * from './types/IChaynsReact';
|
|
19
|
-
export
|
|
20
|
-
buildEnv: process.env.BUILD_ENV,
|
|
21
|
-
appVersion: process.env.VERSION
|
|
22
|
-
};
|
|
20
|
+
export * from './util/initModuleFederationSharing';
|
|
@@ -4,6 +4,16 @@ export let DateType = /*#__PURE__*/function (DateType) {
|
|
|
4
4
|
DateType[DateType["DATE_TIME"] = 2] = "DATE_TIME";
|
|
5
5
|
return DateType;
|
|
6
6
|
}({});
|
|
7
|
+
export let WeekDayType = /*#__PURE__*/function (WeekDayType) {
|
|
8
|
+
WeekDayType[WeekDayType["SUNDAY"] = 0] = "SUNDAY";
|
|
9
|
+
WeekDayType[WeekDayType["MONDAY"] = 1] = "MONDAY";
|
|
10
|
+
WeekDayType[WeekDayType["TUESDAY"] = 2] = "TUESDAY";
|
|
11
|
+
WeekDayType[WeekDayType["WEDNESDAY"] = 3] = "WEDNESDAY";
|
|
12
|
+
WeekDayType[WeekDayType["THURSDAY"] = 4] = "THURSDAY";
|
|
13
|
+
WeekDayType[WeekDayType["FRIDAY"] = 5] = "FRIDAY";
|
|
14
|
+
WeekDayType[WeekDayType["SATURDAY"] = 6] = "SATURDAY";
|
|
15
|
+
return WeekDayType;
|
|
16
|
+
}({});
|
|
7
17
|
export let ToastType = /*#__PURE__*/function (ToastType) {
|
|
8
18
|
ToastType[ToastType["NEUTRAL"] = 1] = "NEUTRAL";
|
|
9
19
|
ToastType[ToastType["SUCCESS"] = 2] = "SUCCESS";
|
|
@@ -23,6 +33,7 @@ export let DialogSelectType = /*#__PURE__*/function (DialogSelectType) {
|
|
|
23
33
|
DialogSelectType[DialogSelectType["DEFAULT"] = 0] = "DEFAULT";
|
|
24
34
|
DialogSelectType[DialogSelectType["ICON"] = 1] = "ICON";
|
|
25
35
|
DialogSelectType[DialogSelectType["IMAGE"] = 2] = "IMAGE";
|
|
36
|
+
DialogSelectType[DialogSelectType["SIMPLE"] = 3] = "SIMPLE";
|
|
26
37
|
return DialogSelectType;
|
|
27
38
|
}({});
|
|
28
39
|
export let DialogButtonType = /*#__PURE__*/function (DialogButtonType) {
|
|
@@ -207,6 +218,7 @@ export let RuntimeEnviroment = /*#__PURE__*/function (RuntimeEnviroment) {
|
|
|
207
218
|
RuntimeEnviroment[RuntimeEnviroment["ChaynsRuntime"] = 3] = "ChaynsRuntime";
|
|
208
219
|
RuntimeEnviroment[RuntimeEnviroment["IntercomPlugin"] = 4] = "IntercomPlugin";
|
|
209
220
|
RuntimeEnviroment[RuntimeEnviroment["PagemakerPlugin"] = 5] = "PagemakerPlugin";
|
|
221
|
+
RuntimeEnviroment[RuntimeEnviroment["Dialog"] = 6] = "Dialog";
|
|
210
222
|
return RuntimeEnviroment;
|
|
211
223
|
}({});
|
|
212
224
|
export let DeviceOs = /*#__PURE__*/function (DeviceOs) {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UAParser } from 'ua-parser-js';
|
|
2
2
|
import { AppName, ScreenSize } from '../types/IChaynsReact';
|
|
3
|
-
const getDeviceInfo = (userAgent, acceptHeader)
|
|
4
|
-
var _match$groups, _match$groups2,
|
|
5
|
-
|
|
3
|
+
const getDeviceInfo = function (userAgent, acceptHeader) {
|
|
4
|
+
var _match$groups, _match$groups2, _customMatch$groups, _browser$version$spli, _browser$version, _uaParser$getOS, _uaParser$getOS2, _uaParser$getOS3;
|
|
5
|
+
let {
|
|
6
|
+
imei
|
|
7
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8
|
+
const uaParser = new UAParser(userAgent);
|
|
6
9
|
let appName = AppName.Unknown;
|
|
7
10
|
const match = /(?:my)?chayns\/(?<version>\d+).*(?<siteId>\d{5}-\d{5})/i.exec(userAgent);
|
|
11
|
+
const customMatch = /\s(?<name>intercom|sidekick|team)\/(?<version>\d+)/i.exec(userAgent);
|
|
8
12
|
if (/\sintercom\/\d+/i.test(userAgent)) {
|
|
9
13
|
appName = AppName.TobitChat;
|
|
10
14
|
} else if (/\ssidekick\/\d+/i.test(userAgent)) {
|
|
@@ -20,20 +24,29 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
20
24
|
} else if (/dface|h96pp|h96max|jabiru|chaynsterminal|wayter|odroidn2p/i.test(userAgent)) {
|
|
21
25
|
appName = AppName.ChaynsLauncher;
|
|
22
26
|
}
|
|
27
|
+
let appVersion = match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN;
|
|
28
|
+
if (customMatch !== null && customMatch !== void 0 && (_customMatch$groups = customMatch.groups) !== null && _customMatch$groups !== void 0 && _customMatch$groups.version) {
|
|
29
|
+
appVersion = Number.parseInt(customMatch.groups.version, 10);
|
|
30
|
+
}
|
|
23
31
|
const result = {};
|
|
32
|
+
const browser = uaParser.getBrowser();
|
|
24
33
|
result.browser = {
|
|
25
|
-
name:
|
|
26
|
-
version:
|
|
27
|
-
majorVersion: Number.parseInt((
|
|
34
|
+
name: browser === null || browser === void 0 ? void 0 : browser.name,
|
|
35
|
+
version: browser === null || browser === void 0 ? void 0 : browser.version,
|
|
36
|
+
majorVersion: Number.parseInt((_browser$version$spli = browser === null || browser === void 0 || (_browser$version = browser.version) === null || _browser$version === void 0 ? void 0 : _browser$version.split('.')[0]) !== null && _browser$version$spli !== void 0 ? _browser$version$spli : '0', 10) || 0,
|
|
28
37
|
isWebPSupported: acceptHeader.includes('image/webp')
|
|
29
38
|
};
|
|
30
39
|
result.app = {
|
|
31
40
|
name: appName,
|
|
32
|
-
version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
41
|
+
version: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN,
|
|
42
|
+
appVersion,
|
|
43
|
+
callVersion: match !== null && match !== void 0 && match.groups ? Number.parseInt(match.groups.version, 10) : NaN
|
|
33
44
|
};
|
|
34
|
-
result.imei =
|
|
35
|
-
result.
|
|
36
|
-
|
|
45
|
+
result.imei = imei;
|
|
46
|
+
result.engine = uaParser.getEngine();
|
|
47
|
+
// TODO: breaking change on next minor and use object with name and version
|
|
48
|
+
result.os = ((_uaParser$getOS = uaParser.getOS()) === null || _uaParser$getOS === void 0 ? void 0 : _uaParser$getOS.name) === 'Android' ? 'Android OS' : (_uaParser$getOS2 = uaParser.getOS()) === null || _uaParser$getOS2 === void 0 ? void 0 : _uaParser$getOS2.name;
|
|
49
|
+
result.osVersion = (_uaParser$getOS3 = uaParser.getOS()) === null || _uaParser$getOS3 === void 0 ? void 0 : _uaParser$getOS3.version;
|
|
37
50
|
if (typeof window !== 'undefined') {
|
|
38
51
|
result.screenSize = getScreenSize(window.innerWidth);
|
|
39
52
|
result.isTouch = getClientDeviceInfo().isTouch;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
export const initModuleFederationSharing = () => {
|
|
4
|
+
// forces single instance of module federation runtime
|
|
5
|
+
if (!globalThis.moduleFederationRuntime) {
|
|
6
|
+
var _process$env$__PACKAG;
|
|
7
|
+
globalThis.moduleFederationRuntime = require('@module-federation/enhanced/runtime');
|
|
8
|
+
globalThis.moduleFederationScopes = {
|
|
9
|
+
registeredScopes: {},
|
|
10
|
+
moduleMap: {},
|
|
11
|
+
componentMap: {}
|
|
12
|
+
};
|
|
13
|
+
const {
|
|
14
|
+
init
|
|
15
|
+
} = globalThis.moduleFederationRuntime;
|
|
16
|
+
|
|
17
|
+
// init also should only be called once
|
|
18
|
+
init({
|
|
19
|
+
// will be set by chayns-toolkit via DefinePlugin
|
|
20
|
+
name: (_process$env$__PACKAG = process.env.__PACKAGE_NAME__) !== null && _process$env$__PACKAG !== void 0 ? _process$env$__PACKAG : '',
|
|
21
|
+
remotes: [],
|
|
22
|
+
shared: {
|
|
23
|
+
react: {
|
|
24
|
+
version: React.version,
|
|
25
|
+
scope: 'chayns-api2',
|
|
26
|
+
lib: () => React
|
|
27
|
+
},
|
|
28
|
+
'react-dom': {
|
|
29
|
+
version: ReactDOM.version,
|
|
30
|
+
scope: 'chayns-api2',
|
|
31
|
+
lib: () => ReactDOM
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getDevice } from '../calls';
|
|
2
|
+
import { AppName } from '../types/IChaynsReact';
|
|
3
|
+
export const isApp = () => {
|
|
4
|
+
var _getDevice$app$name, _getDevice$app;
|
|
5
|
+
return ((_getDevice$app$name = (_getDevice$app = getDevice().app) === null || _getDevice$app === void 0 ? void 0 : _getDevice$app.name) !== null && _getDevice$app$name !== void 0 ? _getDevice$app$name : AppName.Unknown) !== AppName.Unknown;
|
|
6
|
+
};
|
|
7
|
+
export const isAppCallSupported = _ref => {
|
|
8
|
+
var _device$app;
|
|
9
|
+
let {
|
|
10
|
+
minAndroidVersion = 1,
|
|
11
|
+
minIOSVersion = 1
|
|
12
|
+
} = _ref;
|
|
13
|
+
if (!isApp()) return false;
|
|
14
|
+
const device = getDevice();
|
|
15
|
+
if (!((_device$app = device.app) !== null && _device$app !== void 0 && _device$app.callVersion) || isNaN(device.app.callVersion)) return false;
|
|
16
|
+
if (device.os && ['iOS', 'Mac OS'].includes(device.os)) {
|
|
17
|
+
return device.app.callVersion >= minIOSVersion;
|
|
18
|
+
}
|
|
19
|
+
if (device.os === 'Android OS') {
|
|
20
|
+
return device.app.callVersion >= minAndroidVersion;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
};
|
|
@@ -13,6 +13,7 @@ import getUserInfo from '../calls/getUserInfo';
|
|
|
13
13
|
import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
|
|
14
14
|
import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
|
|
15
15
|
import { DeviceLanguage } from '../constants/languages';
|
|
16
|
+
import { isAppCallSupported } from '../util/is';
|
|
16
17
|
let appWrapperDialogId = 0;
|
|
17
18
|
export class AppWrapper {
|
|
18
19
|
mapOldApiToNew(retVal) {
|
|
@@ -59,7 +60,9 @@ export class AppWrapper {
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
return {
|
|
62
|
-
device: getDeviceInfo(navigator.userAgent, 'image/webp'
|
|
63
|
+
device: getDeviceInfo(navigator.userAgent, 'image/webp', {
|
|
64
|
+
imei: Device.IMEI
|
|
65
|
+
}),
|
|
63
66
|
environment: {
|
|
64
67
|
buildEnvironment: Environment.Production,
|
|
65
68
|
runtimeEnvironment: RuntimeEnviroment.Unknown
|
|
@@ -380,6 +383,26 @@ export class AppWrapper {
|
|
|
380
383
|
}
|
|
381
384
|
},
|
|
382
385
|
selectPage: async options => {
|
|
386
|
+
var _this$values, _this$values2;
|
|
387
|
+
if ((_this$values = this.values) !== null && _this$values !== void 0 && (_this$values = _this$values.site) !== null && _this$values !== void 0 && _this$values.id && options.siteId && options.siteId !== ((_this$values2 = this.values) === null || _this$values2 === void 0 || (_this$values2 = _this$values2.site) === null || _this$values2 === void 0 ? void 0 : _this$values2.id)) {
|
|
388
|
+
const url = new URL(`https://chayns.site/${options.siteId}`);
|
|
389
|
+
if (options.id) {
|
|
390
|
+
url.pathname += `/tapp/${options.id}`;
|
|
391
|
+
} else if (options.path) {
|
|
392
|
+
url.pathname += `/${options.path}`;
|
|
393
|
+
}
|
|
394
|
+
if (options.params) {
|
|
395
|
+
Object.entries(options.params).forEach(_ref2 => {
|
|
396
|
+
let [k, v] = _ref2;
|
|
397
|
+
url.searchParams.set(k, v);
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
void this.appCall(9, {
|
|
401
|
+
url: url.toString(),
|
|
402
|
+
checkForChaynsSite: true
|
|
403
|
+
});
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
383
406
|
void this.appCall(2, {
|
|
384
407
|
id: options.id,
|
|
385
408
|
showName: options.showName,
|
|
@@ -389,14 +412,16 @@ export class AppWrapper {
|
|
|
389
412
|
awaitResult: false
|
|
390
413
|
});
|
|
391
414
|
},
|
|
392
|
-
scrollToY: async position => {
|
|
415
|
+
scrollToY: async (position, duration) => {
|
|
393
416
|
window.scrollTo({
|
|
394
|
-
top: position
|
|
417
|
+
top: position,
|
|
418
|
+
behavior: duration ? 'smooth' : 'auto'
|
|
395
419
|
});
|
|
396
420
|
},
|
|
397
421
|
scrollByY: (value, duration) => {
|
|
398
422
|
window.scrollBy({
|
|
399
|
-
top: value
|
|
423
|
+
top: value,
|
|
424
|
+
behavior: duration ? 'smooth' : 'auto'
|
|
400
425
|
});
|
|
401
426
|
},
|
|
402
427
|
sendMessageToGroup: async (groupId, message) => {
|
|
@@ -502,12 +527,16 @@ export class AppWrapper {
|
|
|
502
527
|
},
|
|
503
528
|
openDialog: async (config, callback) => {
|
|
504
529
|
const currentDialogId = appWrapperDialogId++;
|
|
530
|
+
const isSupported = isAppCallSupported({
|
|
531
|
+
minAndroidVersion: 7137,
|
|
532
|
+
minIOSVersion: 6934
|
|
533
|
+
});
|
|
505
534
|
this.appCall(184, {
|
|
506
535
|
dialogContent: {
|
|
507
536
|
apiVersion: 5,
|
|
508
537
|
config
|
|
509
538
|
},
|
|
510
|
-
externalDialogUrl: 'https://tapp.chayns-static.space/api/dialog-v2/v1/index.html'
|
|
539
|
+
externalDialogUrl: isSupported ? undefined : 'https://tapp.chayns-static.space/api/dialog-v2/v1/index.html'
|
|
511
540
|
}, {
|
|
512
541
|
awaitResult: true
|
|
513
542
|
}).then(result => {
|
|
@@ -588,10 +617,10 @@ export class AppWrapper {
|
|
|
588
617
|
this.appCall(254, {
|
|
589
618
|
enabled: true
|
|
590
619
|
}, {
|
|
591
|
-
callback:
|
|
620
|
+
callback: _ref3 => {
|
|
592
621
|
let {
|
|
593
622
|
colorMode
|
|
594
|
-
} =
|
|
623
|
+
} = _ref3;
|
|
595
624
|
this.values.site = {
|
|
596
625
|
...this.values.site,
|
|
597
626
|
colorMode
|
|
@@ -2,9 +2,13 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
import { moduleWrapper } from '../components/moduleWrapper';
|
|
5
|
+
import { AppName } from '../types/IChaynsReact';
|
|
6
|
+
import getDeviceInfo from '../util/deviceHelper';
|
|
7
|
+
import { AppWrapper } from './AppWrapper';
|
|
5
8
|
import { FrameWrapper } from './FrameWrapper';
|
|
6
9
|
class StaticChaynsApi {
|
|
7
10
|
constructor() {
|
|
11
|
+
var _deviceInfo$app$name, _deviceInfo$app;
|
|
8
12
|
_defineProperty(this, "getUser", () => this._wrapper.values.user);
|
|
9
13
|
_defineProperty(this, "getSite", () => this._wrapper.values.site);
|
|
10
14
|
_defineProperty(this, "getCurrentPage", () => this._wrapper.values.currentPage);
|
|
@@ -13,7 +17,13 @@ class StaticChaynsApi {
|
|
|
13
17
|
_defineProperty(this, "getParameters", () => this._wrapper.values.parameters);
|
|
14
18
|
_defineProperty(this, "getPages", () => this._wrapper.values.pages);
|
|
15
19
|
_defineProperty(this, "getEnvironment", () => this._wrapper.values.environment);
|
|
16
|
-
|
|
20
|
+
let wrapper;
|
|
21
|
+
const deviceInfo = getDeviceInfo(navigator.userAgent, '');
|
|
22
|
+
if ([AppName.Chayns, AppName.ChaynsLauncher, AppName.Sidekick, AppName.TobitChat].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : AppName.Unknown) && window.self === window.top) {
|
|
23
|
+
wrapper = new AppWrapper();
|
|
24
|
+
} else {
|
|
25
|
+
wrapper = new FrameWrapper();
|
|
26
|
+
}
|
|
17
27
|
moduleWrapper.current = wrapper;
|
|
18
28
|
this._wrapper = wrapper;
|
|
19
29
|
this.ready = wrapper.init();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const loadModule: (scope: any, module: any, url: any, preventSingleton?: boolean) => any;
|
|
1
|
+
export declare const loadModule: (scope: any, module: any, url: any, preventSingleton?: boolean, shareScope?: string) => any;
|
|
2
2
|
declare const loadComponent: (scope: any, module: any, url: any, skipCompatMode?: boolean, preventSingleton?: boolean) => any;
|
|
3
3
|
export default loadComponent;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './calls';
|
|
|
7
7
|
export * from './hooks';
|
|
8
8
|
export * from './components/WaitUntil';
|
|
9
9
|
export * from './types/IChaynsReact';
|
|
10
|
+
export * from './util/is';
|
|
10
11
|
export * from './components/withCompatMode';
|
|
11
12
|
export * from './constants';
|
|
12
13
|
export { default as withHydrationBoundary } from './components/withHydrationBoundary';
|
|
@@ -15,8 +16,4 @@ export { default as loadComponent, loadModule } from './host/module/utils/loadCo
|
|
|
15
16
|
export { default as DialogHandler } from './handler/DialogHandler';
|
|
16
17
|
export * as dialog from './calls/dialogs/index';
|
|
17
18
|
export * from './types/IChaynsReact';
|
|
18
|
-
|
|
19
|
-
buildEnv: string | undefined;
|
|
20
|
-
appVersion: string | undefined;
|
|
21
|
-
};
|
|
22
|
-
export default _default;
|
|
19
|
+
export * from './util/initModuleFederationSharing';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IBrowser, IEngine } from 'ua-parser-js';
|
|
2
2
|
import DialogHandler from '../handler/DialogHandler';
|
|
3
3
|
import { DialogButtonOld, SelectDialogItem } from './dialog';
|
|
4
4
|
export type DialogButton = {
|
|
@@ -21,6 +21,28 @@ export interface DialogDate {
|
|
|
21
21
|
multiselect?: boolean;
|
|
22
22
|
monthSelect?: boolean;
|
|
23
23
|
yearSelect?: boolean;
|
|
24
|
+
interval?: boolean;
|
|
25
|
+
disabledDates?: Date[];
|
|
26
|
+
disabledIntervals?: {
|
|
27
|
+
start: Date;
|
|
28
|
+
end: Date;
|
|
29
|
+
}[];
|
|
30
|
+
disabledWeekDayIntervals?: {
|
|
31
|
+
weekDay: WeekDayType;
|
|
32
|
+
interval?: {
|
|
33
|
+
start: Date;
|
|
34
|
+
end: Date;
|
|
35
|
+
};
|
|
36
|
+
}[];
|
|
37
|
+
}
|
|
38
|
+
export declare enum WeekDayType {
|
|
39
|
+
SUNDAY = 0,
|
|
40
|
+
MONDAY = 1,
|
|
41
|
+
TUESDAY = 2,
|
|
42
|
+
WEDNESDAY = 3,
|
|
43
|
+
THURSDAY = 4,
|
|
44
|
+
FRIDAY = 5,
|
|
45
|
+
SATURDAY = 6
|
|
24
46
|
}
|
|
25
47
|
export declare enum ToastType {
|
|
26
48
|
NEUTRAL = 1,
|
|
@@ -98,7 +120,8 @@ export interface DialogInput {
|
|
|
98
120
|
export declare enum DialogSelectType {
|
|
99
121
|
DEFAULT = 0,
|
|
100
122
|
ICON = 1,
|
|
101
|
-
IMAGE = 2
|
|
123
|
+
IMAGE = 2,
|
|
124
|
+
SIMPLE = 3
|
|
102
125
|
}
|
|
103
126
|
export type DialogSelectListItemType = {
|
|
104
127
|
id: number;
|
|
@@ -115,6 +138,9 @@ export type DialogSelectListItemType = {
|
|
|
115
138
|
export interface DialogSelect {
|
|
116
139
|
type: DialogType.SELECT;
|
|
117
140
|
list: DialogSelectListItemType[];
|
|
141
|
+
fixedItem?: DialogSelectListItemType & {
|
|
142
|
+
position?: 'top' | 'bottom';
|
|
143
|
+
};
|
|
118
144
|
multiselect?: boolean;
|
|
119
145
|
quickfind?: boolean;
|
|
120
146
|
selectType?: DialogSelectType;
|
|
@@ -129,6 +155,7 @@ export declare enum DialogButtonType {
|
|
|
129
155
|
export type ChaynsApiUser = {
|
|
130
156
|
firstName?: string;
|
|
131
157
|
lastName?: string;
|
|
158
|
+
nickName?: string;
|
|
132
159
|
gender?: Gender;
|
|
133
160
|
uacGroups?: UacGroup[];
|
|
134
161
|
userId?: number;
|
|
@@ -154,27 +181,39 @@ export type ChaynsApiSite = {
|
|
|
154
181
|
originSiteId?: string;
|
|
155
182
|
};
|
|
156
183
|
export declare enum ScreenSize {
|
|
184
|
+
/** screen width smaller than or equal 556px */
|
|
157
185
|
XS = 0,
|
|
186
|
+
/** screen width between 557px and 769px */
|
|
158
187
|
SM = 1,
|
|
188
|
+
/** screen width between 770px and 993px */
|
|
159
189
|
MD = 2,
|
|
190
|
+
/** screen width between 994px and 1200px */
|
|
160
191
|
LG = 3,
|
|
192
|
+
/** screen width larger than 1200px */
|
|
161
193
|
XL = 4
|
|
162
194
|
}
|
|
163
195
|
export type ChaynsApiDevice = {
|
|
164
196
|
app?: {
|
|
165
197
|
name: AppName;
|
|
198
|
+
/** @deprecated same value as callVersion */
|
|
166
199
|
version: number;
|
|
200
|
+
/** the actual app version according to the app name */
|
|
201
|
+
appVersion: number;
|
|
202
|
+
/** the version of the chayns call interface */
|
|
203
|
+
callVersion: number;
|
|
167
204
|
storePackageName?: string;
|
|
168
205
|
};
|
|
169
206
|
browser?: {
|
|
170
|
-
name?:
|
|
207
|
+
name?: IBrowser["name"] | 'bot' | null;
|
|
171
208
|
version?: string | null;
|
|
172
209
|
majorVersion: number;
|
|
173
210
|
isWebPSupported: boolean;
|
|
174
211
|
};
|
|
212
|
+
engine?: IEngine;
|
|
175
213
|
imei?: string;
|
|
176
214
|
accessToken?: string;
|
|
177
|
-
os?:
|
|
215
|
+
os?: 'AIX' | 'Amiga OS' | 'Android OS' | 'Arch' | 'Bada' | 'BeOS' | 'BlackBerry' | 'CentOS' | 'Chromium OS' | 'Contiki' | 'Fedora' | 'Firefox OS' | 'FreeBSD' | 'Debian' | 'DragonFly' | 'Gentoo' | 'GNU' | 'Haiku' | 'Hurd' | 'iOS' | 'Joli' | 'Linpus' | 'Linux' | 'Mac OS' | 'Mageia' | 'Mandriva' | 'MeeGo' | 'Minix' | 'Mint' | 'Morph OS' | 'NetBSD' | 'Nintendo' | 'OpenBSD' | 'OpenVMS' | 'OS/2' | 'Palm' | 'PCLinuxOS' | 'Plan9' | 'Playstation' | 'QNX' | 'RedHat' | 'RIM Tablet OS' | 'RISC OS' | 'Sailfish' | 'Series40' | 'Slackware' | 'Solaris' | 'SUSE' | 'Symbian' | 'Tizen' | 'Ubuntu' | 'UNIX' | 'VectorLinux' | 'WebOS' | 'Windows' | 'Windows Phone' | 'Windows Mobile' | 'Zenwalk' | null;
|
|
216
|
+
osVersion?: string;
|
|
178
217
|
isTouch: boolean;
|
|
179
218
|
screenSize: ScreenSize;
|
|
180
219
|
};
|
|
@@ -729,7 +768,8 @@ export declare enum RuntimeEnviroment {
|
|
|
729
768
|
ChaynsWeb = 2,
|
|
730
769
|
ChaynsRuntime = 3,
|
|
731
770
|
IntercomPlugin = 4,
|
|
732
|
-
PagemakerPlugin = 5
|
|
771
|
+
PagemakerPlugin = 5,
|
|
772
|
+
Dialog = 6
|
|
733
773
|
}
|
|
734
774
|
export declare enum DeviceOs {
|
|
735
775
|
Unknown = "unknown",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ChaynsApiDevice, ScreenSize } from '../types/IChaynsReact';
|
|
2
|
-
declare const getDeviceInfo: (userAgent: string, acceptHeader: string
|
|
2
|
+
declare const getDeviceInfo: (userAgent: string, acceptHeader: string, { imei }?: {
|
|
3
|
+
imei?: string | undefined;
|
|
4
|
+
}) => ChaynsApiDevice;
|
|
3
5
|
export declare const getClientDeviceInfo: () => {
|
|
4
6
|
isTouch: boolean;
|
|
5
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const initModuleFederationSharing: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chayns-api",
|
|
3
|
-
"version": "1.2.0-
|
|
3
|
+
"version": "1.2.0-10",
|
|
4
4
|
"description": "new chayns api",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -42,16 +42,17 @@
|
|
|
42
42
|
"extends": "@chayns-toolkit"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@module-federation/
|
|
45
|
+
"@module-federation/enhanced": "^0.6.10",
|
|
46
|
+
"@module-federation/runtime": "^0.6.9",
|
|
46
47
|
"@types/semver": "^7.5.8",
|
|
47
48
|
"comlink": "4.3.1",
|
|
48
|
-
"detect-browser": "^5.2.1",
|
|
49
49
|
"htmlescape": "^1.1.1",
|
|
50
50
|
"lodash.throttle": "^4.1.1",
|
|
51
51
|
"prop-types": "^15.7.2",
|
|
52
52
|
"scheduler": "^0.23.0",
|
|
53
53
|
"semaphore-async-await": "^1.5.1",
|
|
54
54
|
"semver": "^7.6.0",
|
|
55
|
+
"ua-parser-js": "^1.0.38",
|
|
55
56
|
"use-context-selector": "^1.4.4",
|
|
56
57
|
"util": "^0.12.5"
|
|
57
58
|
},
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"@types/prop-types": "^15.7.12",
|
|
69
70
|
"@types/react": "^18.2.78",
|
|
70
71
|
"@types/react-dom": "^18.2.25",
|
|
72
|
+
"@types/ua-parser-js": "^0.7.39",
|
|
71
73
|
"@typescript-eslint/parser": "^7.6.0",
|
|
72
74
|
"chayns-toolkit": "^2.0.9",
|
|
73
75
|
"concurrently": "^8.2.2",
|
|
@@ -75,8 +77,8 @@
|
|
|
75
77
|
"postcss-prefix-selector": "^1.13.0",
|
|
76
78
|
"prettier": "^3.2.5",
|
|
77
79
|
"prettier-plugin-packagejson": "^2.5.0",
|
|
78
|
-
"react": "^
|
|
79
|
-
"react-dom": "^
|
|
80
|
+
"react": "^18.3.1",
|
|
81
|
+
"react-dom": "^18.3.1",
|
|
80
82
|
"typescript": "^4.9.5"
|
|
81
83
|
},
|
|
82
84
|
"peerDependencies": {
|