chayns-api 3.7.0-beta.1 → 3.7.0-beta.3
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/ChaynsProvider.js +2 -1
- package/dist/cjs/components/withCompatMode.js +2 -1
- package/dist/cjs/components/withHydrationBoundary.js +2 -1
- package/dist/cjs/contexts/HistoryLayerContext.js +2 -1
- package/dist/cjs/host/ChaynsHost.js +2 -1
- package/dist/cjs/host/iframe/HostIframe.js +2 -1
- package/dist/cjs/host/module/ModuleHost.js +2 -1
- package/dist/cjs/host/module/utils/loadComponent.js +6 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/types/IChaynsReact.js +7 -1
- package/dist/cjs/umd.index.js +2 -1
- package/dist/cjs/utils/initModuleFederationSharing.js +13 -0
- package/dist/cjs/utils/transferNestedFunctions.js +2 -1
- package/dist/cjs/wrapper/AppWrapper.js +20 -5
- package/dist/cjs/wrapper/FrameWrapper.js +2 -1
- package/dist/esm/components/withCompatMode.js +1 -1
- package/dist/esm/handler/DialogHandler.js +1 -1
- package/dist/esm/handler/history/FrameHistoryLayer.js +1 -1
- package/dist/esm/handler/history/HistoryLayer.js +1 -1
- package/dist/esm/host/module/utils/loadComponent.js +10 -3
- package/dist/esm/plugins/TrustedDomainsPlugins.js +1 -1
- package/dist/esm/types/IChaynsReact.js +6 -0
- package/dist/esm/utils/EventBus.js +1 -1
- package/dist/esm/utils/history/BlockRegistry.js +1 -1
- package/dist/esm/utils/history/NavigationQueue.js +1 -1
- package/dist/esm/utils/initModuleFederationSharing.js +13 -0
- package/dist/esm/wrapper/AppWrapper.js +19 -5
- package/dist/esm/wrapper/FrameWrapper.js +1 -1
- package/dist/esm/wrapper/ModuleFederationWrapper.js +1 -1
- package/dist/esm/wrapper/SsrWrapper.js +1 -1
- package/dist/esm/wrapper/StaticChaynsApi.js +1 -1
- package/dist/types/hooks/useSafeArea.d.ts +3 -0
- package/dist/types/host/module/utils/loadComponent.d.ts +1 -1
- package/dist/types/types/IChaynsReact.d.ts +10 -0
- package/dist/types/wrapper/AppWrapper.d.ts +2 -2
- package/package.json +15 -14
- package/tests/safe-area.test.cjs +176 -0
- package/tests/safe-area.types.ts +12 -0
|
@@ -19,7 +19,8 @@ var _moduleWrapper = require("./moduleWrapper");
|
|
|
19
19
|
var _HistoryLayerContext = require("../contexts/HistoryLayerContext");
|
|
20
20
|
var _rootLayer = require("../utils/history/rootLayer");
|
|
21
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
|
|
22
|
+
var cache;
|
|
23
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
23
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
25
|
const isServer = typeof window === 'undefined';
|
|
25
26
|
const InitialDataProvider = _react.default.memo(t0 => {
|
|
@@ -10,7 +10,8 @@ var _ErrorBoundary = _interopRequireDefault(require("./ErrorBoundary"));
|
|
|
10
10
|
var _client = require("react-dom/client");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
|
|
13
|
+
var cache;
|
|
14
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
14
15
|
const withCompatMode = Component => {
|
|
15
16
|
class CompatComponent extends _react.PureComponent {
|
|
16
17
|
constructor(props) {
|
|
@@ -7,7 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _contexts = require("../contexts");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
|
|
10
|
+
var cache;
|
|
11
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
11
12
|
function withHydrationBoundary(Component, initializer, useHydrationId, useProps) {
|
|
12
13
|
const stores = {};
|
|
13
14
|
return ({
|
|
@@ -12,7 +12,8 @@ var _reactCompilerRuntime = require("react-compiler-runtime");
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _useIsomorphicLayoutEffect = require("../hooks/useIsomorphicLayoutEffect");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
15
|
+
var cache;
|
|
16
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
16
17
|
const _layerStack = [];
|
|
17
18
|
function pushChaynsHistoryLayer(layer) {
|
|
18
19
|
_layerStack.push(layer);
|
|
@@ -12,7 +12,8 @@ var _HistoryLayerContext = require("../contexts/HistoryLayerContext");
|
|
|
12
12
|
var _rootLayer = require("../utils/history/rootLayer");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
|
|
15
|
+
var cache;
|
|
16
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
16
17
|
const subscribeToHydration = () => () => {};
|
|
17
18
|
const ChaynsHost = t0 => {
|
|
18
19
|
const $ = (0, _reactCompilerRuntime.c)(53);
|
|
@@ -12,7 +12,8 @@ var _url = require("../../utils/url");
|
|
|
12
12
|
var _transferNestedFunctions = require("../../utils/transferNestedFunctions");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
|
|
15
|
+
var cache;
|
|
16
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
16
17
|
const HostIframe = ({
|
|
17
18
|
iFrameProps,
|
|
18
19
|
src,
|
|
@@ -11,7 +11,8 @@ var _loadComponent = _interopRequireDefault(require("./utils/loadComponent"));
|
|
|
11
11
|
var _url = require("../../utils/url");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
|
|
14
|
+
var cache;
|
|
15
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
15
16
|
const System = ({
|
|
16
17
|
system,
|
|
17
18
|
fallback,
|
|
@@ -131,7 +131,12 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
131
131
|
OriginalCompatComponent.componentDidUpdate.apply(this, prevProps, prevState, snapshot);
|
|
132
132
|
}
|
|
133
133
|
componentWillUnmount() {
|
|
134
|
-
|
|
134
|
+
clearTimeout(this.timeout);
|
|
135
|
+
if (typeof OriginalCompatComponent.componentWillUnmount === 'function') {
|
|
136
|
+
OriginalCompatComponent.componentWillUnmount.apply(this);
|
|
137
|
+
} else if (this.root) {
|
|
138
|
+
this.root.unmount();
|
|
139
|
+
}
|
|
135
140
|
}
|
|
136
141
|
render() {
|
|
137
142
|
return _react.default.createElement('div', {
|
package/dist/cjs/index.js
CHANGED
|
@@ -367,5 +367,6 @@ Object.keys(_contexts).forEach(function (key) {
|
|
|
367
367
|
});
|
|
368
368
|
});
|
|
369
369
|
var _moduleWrapper = require("./components/moduleWrapper");
|
|
370
|
-
|
|
370
|
+
var cache;
|
|
371
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
371
372
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.selectType = exports.WeekDayType = exports.ToastType = exports.TappEvent = exports.SnapshotType = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnvironment = exports.RuntimeEnviroment = exports.MediaType = exports.LoginState = exports.Language = exports.IconType = exports.IconStyle = exports.IOSFeedbackVibration = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.FloatingButtonAnimation = exports.FileExplorerSortType = exports.FileExplorerFilterType = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogIconType = exports.DialogButtonType = exports.DialogAnimation = exports.DeviceOs = exports.DesignSettingsUpdateTappViewModes = exports.DesignSettingsUpdateSeasonTypes = exports.DesignSettingsUpdateGalleryAnimationTypes = exports.DesignSettingsUpdateCoverTypes = exports.DesignSettingsUpdateBackgroundType = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AppFlavor = exports.AccessMode = void 0;
|
|
6
|
+
exports.selectType = exports.WeekDayType = exports.ToastType = exports.TappEvent = exports.SnapshotType = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnvironment = exports.RuntimeEnviroment = exports.MediaType = exports.LoginState = exports.Language = exports.IconType = exports.IconStyle = exports.IOSFeedbackVibration = exports.HingeStatus = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.FloatingButtonAnimation = exports.FileExplorerSortType = exports.FileExplorerFilterType = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogIconType = exports.DialogButtonType = exports.DialogAnimation = exports.DeviceOs = exports.DesignSettingsUpdateTappViewModes = exports.DesignSettingsUpdateSeasonTypes = exports.DesignSettingsUpdateGalleryAnimationTypes = exports.DesignSettingsUpdateCoverTypes = exports.DesignSettingsUpdateBackgroundType = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AppFlavor = exports.AccessMode = void 0;
|
|
7
7
|
let DateType = exports.DateType = function (DateType) {
|
|
8
8
|
DateType[DateType["DATE"] = 0] = "DATE";
|
|
9
9
|
DateType[DateType["TIME"] = 1] = "TIME";
|
|
@@ -350,4 +350,10 @@ let DialogIconType = exports.DialogIconType = function (DialogIconType) {
|
|
|
350
350
|
DialogIconType["WarningIcon"] = "%%DialogWarningIcon%%";
|
|
351
351
|
DialogIconType["ErrorIcon"] = "%%DialogErrorIcon%%";
|
|
352
352
|
return DialogIconType;
|
|
353
|
+
}({});
|
|
354
|
+
let HingeStatus = exports.HingeStatus = function (HingeStatus) {
|
|
355
|
+
HingeStatus["Closed"] = "closed";
|
|
356
|
+
HingeStatus["PartiallyOpen"] = "partiallyOpen";
|
|
357
|
+
HingeStatus["FullyOpen"] = "fullyOpen";
|
|
358
|
+
return HingeStatus;
|
|
353
359
|
}({});
|
package/dist/cjs/umd.index.js
CHANGED
|
@@ -84,4 +84,5 @@ var _DialogHandler = _interopRequireDefault(require("./handler/DialogHandler"));
|
|
|
84
84
|
var _dialog = _interopRequireWildcard(require("./calls/dialogs/index"));
|
|
85
85
|
exports.dialog = _dialog;
|
|
86
86
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
87
|
-
|
|
87
|
+
var cache;
|
|
88
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
@@ -13,6 +13,12 @@ var _injectExternalRuntimeCorePlugin = _interopRequireDefault(require("@module-f
|
|
|
13
13
|
var _ManifestShareScopePlugin = require("../plugins/ManifestShareScopePlugin");
|
|
14
14
|
var _SequentialLoadPlugin = require("../plugins/SequentialLoadPlugin");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
let ReactCompilerRuntime;
|
|
17
|
+
try {
|
|
18
|
+
ReactCompilerRuntime = require('react/compiler-runtime');
|
|
19
|
+
} catch {
|
|
20
|
+
ReactCompilerRuntime = null;
|
|
21
|
+
}
|
|
16
22
|
const ERROR_CACHE_TIME = 60000;
|
|
17
23
|
const normalizeUrl = url => {
|
|
18
24
|
try {
|
|
@@ -109,6 +115,13 @@ const initModuleFederationSharing = ({
|
|
|
109
115
|
lib: () => _jsxRuntime.default
|
|
110
116
|
}
|
|
111
117
|
};
|
|
118
|
+
if (ReactCompilerRuntime) {
|
|
119
|
+
shared['react/compiler-runtime'] = {
|
|
120
|
+
version: _react.default.version,
|
|
121
|
+
scope: [`chayns-react-${_react.default.version}`, 'chayns-api'],
|
|
122
|
+
lib: () => ReactCompilerRuntime
|
|
123
|
+
};
|
|
124
|
+
}
|
|
112
125
|
const instance = createInstance({
|
|
113
126
|
name: (_ref = scope !== null && scope !== void 0 ? scope : name) !== null && _ref !== void 0 ? _ref : '',
|
|
114
127
|
remotes: [],
|
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.initTransferNestedFunctions = void 0;
|
|
7
7
|
var Comlink = _interopRequireWildcard(require("comlink"));
|
|
8
|
-
|
|
8
|
+
var cache;
|
|
9
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
9
10
|
const TRANSFER_HANDLER_NAME = 'FUNCTION';
|
|
10
11
|
let isInitialized = false;
|
|
11
12
|
const initTransferNestedFunctions = () => {
|
|
@@ -18,7 +18,8 @@ var _appCall = _interopRequireDefault(require("../utils/appCall"));
|
|
|
18
18
|
var _appStorage = require("../utils/appStorage");
|
|
19
19
|
var _deviceHelper = _interopRequireWildcard(require("../utils/deviceHelper"));
|
|
20
20
|
var _is = require("../utils/is");
|
|
21
|
-
|
|
21
|
+
var cache;
|
|
22
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
22
23
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
24
|
class AppWrapper {
|
|
24
25
|
values = null;
|
|
@@ -45,7 +46,7 @@ class AppWrapper {
|
|
|
45
46
|
return undefined;
|
|
46
47
|
}
|
|
47
48
|
mapOldApiToNew(retVal) {
|
|
48
|
-
var _window, _window2, _AppInfo$TappSelected;
|
|
49
|
+
var _window, _window2, _AppUser$UACGroups$ma, _AppUser$UACGroups, _AppInfo$TappSelected;
|
|
49
50
|
const {
|
|
50
51
|
AppInfo,
|
|
51
52
|
AppUser,
|
|
@@ -138,7 +139,9 @@ class AppWrapper {
|
|
|
138
139
|
userId: userId,
|
|
139
140
|
personId: AppUser.PersonID,
|
|
140
141
|
isAnonymous: AppUser.IsAnonymous,
|
|
141
|
-
uacGroups:
|
|
142
|
+
uacGroups: (_AppUser$UACGroups$ma = (_AppUser$UACGroups = AppUser.UACGroups) === null || _AppUser$UACGroups === void 0 ? void 0 : _AppUser$UACGroups.map(group => ({
|
|
143
|
+
id: group.GroupID
|
|
144
|
+
}))) !== null && _AppUser$UACGroups$ma !== void 0 ? _AppUser$UACGroups$ma : []
|
|
142
145
|
},
|
|
143
146
|
customData: null,
|
|
144
147
|
isAdminModeActive: AppUser.AdminMode,
|
|
@@ -306,7 +309,13 @@ class AppWrapper {
|
|
|
306
309
|
top: v.top,
|
|
307
310
|
left: v.left,
|
|
308
311
|
bottom: v.bottom,
|
|
309
|
-
right: v.right
|
|
312
|
+
right: v.right,
|
|
313
|
+
...(v.hingeAngle === undefined ? {} : {
|
|
314
|
+
hingeAngle: v.hingeAngle
|
|
315
|
+
}),
|
|
316
|
+
...(v.hingeStatus === undefined ? {} : {
|
|
317
|
+
hingeStatus: v.hingeStatus
|
|
318
|
+
})
|
|
310
319
|
};
|
|
311
320
|
(0, _apiListener.dispatchApiEvent)('appleSafeAreaListener', this.latestAppleSafeArea);
|
|
312
321
|
}
|
|
@@ -367,7 +376,13 @@ class AppWrapper {
|
|
|
367
376
|
top: (_v$top = v === null || v === void 0 ? void 0 : v.top) !== null && _v$top !== void 0 ? _v$top : 0,
|
|
368
377
|
left: (_v$left = v === null || v === void 0 ? void 0 : v.left) !== null && _v$left !== void 0 ? _v$left : 0,
|
|
369
378
|
bottom: (_v$bottom = v === null || v === void 0 ? void 0 : v.bottom) !== null && _v$bottom !== void 0 ? _v$bottom : 0,
|
|
370
|
-
right: (_v$right = v === null || v === void 0 ? void 0 : v.right) !== null && _v$right !== void 0 ? _v$right : 0
|
|
379
|
+
right: (_v$right = v === null || v === void 0 ? void 0 : v.right) !== null && _v$right !== void 0 ? _v$right : 0,
|
|
380
|
+
...((v === null || v === void 0 ? void 0 : v.hingeAngle) === undefined ? {} : {
|
|
381
|
+
hingeAngle: v.hingeAngle
|
|
382
|
+
}),
|
|
383
|
+
...((v === null || v === void 0 ? void 0 : v.hingeStatus) === undefined ? {} : {
|
|
384
|
+
hingeStatus: v.hingeStatus
|
|
385
|
+
})
|
|
371
386
|
};
|
|
372
387
|
return this.latestAppleSafeArea;
|
|
373
388
|
},
|
|
@@ -13,7 +13,8 @@ var _FrameHistoryLayer = require("../handler/history/FrameHistoryLayer");
|
|
|
13
13
|
var _heightHelper = require("../utils/heightHelper");
|
|
14
14
|
var _transferNestedFunctions = require("../utils/transferNestedFunctions");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
|
|
16
|
+
var cache;
|
|
17
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
17
18
|
class FrameWrapper {
|
|
18
19
|
resolve = null;
|
|
19
20
|
exposedFunctions = null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import React, { PureComponent } from 'react';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
6
6
|
import ErrorBoundary from './ErrorBoundary';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
export default class DialogHandler {
|
|
5
5
|
constructor(config, open, close, dispatchEvent, addDataListener) {
|
|
6
6
|
_defineProperty(this, "dialogId", void 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import { EventBus } from '../../utils/EventBus';
|
|
5
5
|
import { shallowEqualArr } from '../../utils/equality';
|
|
6
6
|
import { normalizeHistoryRouteInput, normalizeHistorySegments } from '../../utils/history/segments';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import { EventBus } from '../../utils/EventBus';
|
|
5
5
|
import { resolveSegmentsFrom } from '../../utils/history/rootLayer';
|
|
6
6
|
import { normalizeHistoryRouteInput, normalizeHistorySegments } from '../../utils/history/segments';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
4
|
-
import React from
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
|
+
import React from "react";
|
|
5
5
|
const normalizeUrl = url => {
|
|
6
6
|
try {
|
|
7
7
|
return new URL(url).toString();
|
|
@@ -118,6 +118,8 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
118
118
|
constructor(props) {
|
|
119
119
|
super(props);
|
|
120
120
|
_defineProperty(this, "ref", void 0);
|
|
121
|
+
_defineProperty(this, "timeout", void 0);
|
|
122
|
+
_defineProperty(this, "root", void 0);
|
|
121
123
|
this.ref = React.createRef();
|
|
122
124
|
}
|
|
123
125
|
componentDidMount() {
|
|
@@ -127,7 +129,12 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
127
129
|
OriginalCompatComponent.componentDidUpdate.apply(this, prevProps, prevState, snapshot);
|
|
128
130
|
}
|
|
129
131
|
componentWillUnmount() {
|
|
130
|
-
|
|
132
|
+
clearTimeout(this.timeout);
|
|
133
|
+
if (typeof OriginalCompatComponent.componentWillUnmount === 'function') {
|
|
134
|
+
OriginalCompatComponent.componentWillUnmount.apply(this);
|
|
135
|
+
} else if (this.root) {
|
|
136
|
+
this.root.unmount();
|
|
137
|
+
}
|
|
131
138
|
}
|
|
132
139
|
render() {
|
|
133
140
|
return React.createElement('div', {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import { loadTrustedDomains } from '../utils/loadTrustedDomains';
|
|
5
5
|
class TrustedDomainsError extends Error {
|
|
6
6
|
constructor(entry) {
|
|
@@ -344,4 +344,10 @@ export let DialogIconType = function (DialogIconType) {
|
|
|
344
344
|
DialogIconType["WarningIcon"] = "%%DialogWarningIcon%%";
|
|
345
345
|
DialogIconType["ErrorIcon"] = "%%DialogErrorIcon%%";
|
|
346
346
|
return DialogIconType;
|
|
347
|
+
}({});
|
|
348
|
+
export let HingeStatus = function (HingeStatus) {
|
|
349
|
+
HingeStatus["Closed"] = "closed";
|
|
350
|
+
HingeStatus["PartiallyOpen"] = "partiallyOpen";
|
|
351
|
+
HingeStatus["FullyOpen"] = "fullyOpen";
|
|
352
|
+
return HingeStatus;
|
|
347
353
|
}({});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
export class EventBus {
|
|
5
5
|
constructor() {
|
|
6
6
|
_defineProperty(this, "listeners", new Map());
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import { invokeCall } from '../../calls';
|
|
5
5
|
const BLOCK_TIMEOUT_MS = 30000;
|
|
6
6
|
let _nextId = 1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import { hasWindowHistory } from './window';
|
|
5
5
|
import { shallowEqualArr, shallowEqualObj } from '../equality';
|
|
6
6
|
export class NavigationQueue {
|
|
@@ -6,6 +6,12 @@ import ReactDOMServer from 'react-dom/server';
|
|
|
6
6
|
import injectExternalRuntimeCodePlugin from '@module-federation/inject-external-runtime-core-plugin';
|
|
7
7
|
import { ManifestShareScopePlugin } from '../plugins/ManifestShareScopePlugin';
|
|
8
8
|
import { SequentialLoadPlugin } from '../plugins/SequentialLoadPlugin';
|
|
9
|
+
let ReactCompilerRuntime;
|
|
10
|
+
try {
|
|
11
|
+
ReactCompilerRuntime = require('react/compiler-runtime');
|
|
12
|
+
} catch {
|
|
13
|
+
ReactCompilerRuntime = null;
|
|
14
|
+
}
|
|
9
15
|
const ERROR_CACHE_TIME = 60000;
|
|
10
16
|
const normalizeUrl = url => {
|
|
11
17
|
try {
|
|
@@ -102,6 +108,13 @@ export const initModuleFederationSharing = ({
|
|
|
102
108
|
lib: () => JSXRuntime
|
|
103
109
|
}
|
|
104
110
|
};
|
|
111
|
+
if (ReactCompilerRuntime) {
|
|
112
|
+
shared['react/compiler-runtime'] = {
|
|
113
|
+
version: React.version,
|
|
114
|
+
scope: [`chayns-react-${React.version}`, 'chayns-api'],
|
|
115
|
+
lib: () => ReactCompilerRuntime
|
|
116
|
+
};
|
|
117
|
+
}
|
|
105
118
|
const instance = createInstance({
|
|
106
119
|
name: (_ref = scope !== null && scope !== void 0 ? scope : name) !== null && _ref !== void 0 ? _ref : '',
|
|
107
120
|
remotes: [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import throttle from 'lodash.throttle';
|
|
5
5
|
import getUserInfo from '../calls/getUserInfo';
|
|
6
6
|
import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
|
|
@@ -32,7 +32,7 @@ export class AppWrapper {
|
|
|
32
32
|
return undefined;
|
|
33
33
|
}
|
|
34
34
|
mapOldApiToNew(retVal) {
|
|
35
|
-
var _window, _window2, _AppInfo$TappSelected;
|
|
35
|
+
var _window, _window2, _AppUser$UACGroups$ma, _AppUser$UACGroups, _AppInfo$TappSelected;
|
|
36
36
|
const {
|
|
37
37
|
AppInfo,
|
|
38
38
|
AppUser,
|
|
@@ -125,7 +125,9 @@ export class AppWrapper {
|
|
|
125
125
|
userId: userId,
|
|
126
126
|
personId: AppUser.PersonID,
|
|
127
127
|
isAnonymous: AppUser.IsAnonymous,
|
|
128
|
-
uacGroups:
|
|
128
|
+
uacGroups: (_AppUser$UACGroups$ma = (_AppUser$UACGroups = AppUser.UACGroups) === null || _AppUser$UACGroups === void 0 ? void 0 : _AppUser$UACGroups.map(group => ({
|
|
129
|
+
id: group.GroupID
|
|
130
|
+
}))) !== null && _AppUser$UACGroups$ma !== void 0 ? _AppUser$UACGroups$ma : []
|
|
129
131
|
},
|
|
130
132
|
customData: null,
|
|
131
133
|
isAdminModeActive: AppUser.AdminMode,
|
|
@@ -269,7 +271,13 @@ export class AppWrapper {
|
|
|
269
271
|
top: v.top,
|
|
270
272
|
left: v.left,
|
|
271
273
|
bottom: v.bottom,
|
|
272
|
-
right: v.right
|
|
274
|
+
right: v.right,
|
|
275
|
+
...(v.hingeAngle === undefined ? {} : {
|
|
276
|
+
hingeAngle: v.hingeAngle
|
|
277
|
+
}),
|
|
278
|
+
...(v.hingeStatus === undefined ? {} : {
|
|
279
|
+
hingeStatus: v.hingeStatus
|
|
280
|
+
})
|
|
273
281
|
};
|
|
274
282
|
dispatchApiEvent('appleSafeAreaListener', this.latestAppleSafeArea);
|
|
275
283
|
}
|
|
@@ -330,7 +338,13 @@ export class AppWrapper {
|
|
|
330
338
|
top: (_v$top = v === null || v === void 0 ? void 0 : v.top) !== null && _v$top !== void 0 ? _v$top : 0,
|
|
331
339
|
left: (_v$left = v === null || v === void 0 ? void 0 : v.left) !== null && _v$left !== void 0 ? _v$left : 0,
|
|
332
340
|
bottom: (_v$bottom = v === null || v === void 0 ? void 0 : v.bottom) !== null && _v$bottom !== void 0 ? _v$bottom : 0,
|
|
333
|
-
right: (_v$right = v === null || v === void 0 ? void 0 : v.right) !== null && _v$right !== void 0 ? _v$right : 0
|
|
341
|
+
right: (_v$right = v === null || v === void 0 ? void 0 : v.right) !== null && _v$right !== void 0 ? _v$right : 0,
|
|
342
|
+
...((v === null || v === void 0 ? void 0 : v.hingeAngle) === undefined ? {} : {
|
|
343
|
+
hingeAngle: v.hingeAngle
|
|
344
|
+
}),
|
|
345
|
+
...((v === null || v === void 0 ? void 0 : v.hingeStatus) === undefined ? {} : {
|
|
346
|
+
hingeStatus: v.hingeStatus
|
|
347
|
+
})
|
|
334
348
|
};
|
|
335
349
|
return this.latestAppleSafeArea;
|
|
336
350
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import * as comlink from 'comlink';
|
|
5
5
|
import getUserInfo from '../calls/getUserInfo';
|
|
6
6
|
import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import DialogHandler from '../handler/DialogHandler';
|
|
5
5
|
import { getOrInitRootChaynsHistoryLayer } from '../utils/history/rootLayer';
|
|
6
6
|
import { addVisibilityChangeListener, removeVisibilityChangeListener } from '../calls/visibilityChangeListener';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import { normalizeFunctions } from './normalizeFunctions';
|
|
5
5
|
export class SsrWrapper {
|
|
6
6
|
constructor(values, functions, customFunctions) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
-
function _toPrimitive(t,
|
|
3
|
+
function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
4
4
|
import { moduleWrapper } from '../components/moduleWrapper';
|
|
5
5
|
import { AppFlavor } from '../types/IChaynsReact';
|
|
6
6
|
import getDeviceInfo from '../utils/deviceHelper';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { AppleSafeArea } from '../types/IChaynsReact';
|
|
2
2
|
/**
|
|
3
|
+
* Listens for safe-area and optional iPhone Duo hinge updates from the native app.
|
|
3
4
|
* @category Hooks
|
|
4
5
|
*/
|
|
5
6
|
export declare const useSafeAreaListener: () => (callback: (result: AppleSafeArea) => void) => () => void;
|
|
6
7
|
/**
|
|
8
|
+
* Returns safe-area insets and optional iPhone Duo hinge metadata.
|
|
9
|
+
* Hinge updates allow layouts to react when the device is opened or closed.
|
|
7
10
|
* @category Hooks
|
|
8
11
|
*/
|
|
9
12
|
export declare const useSafeArea: ({ enabled }?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
type LoadModule = (scope: string, module: string, url: string, preventSingleton?: boolean) => Promise<unknown>;
|
|
3
3
|
export declare const loadModule: LoadModule;
|
|
4
4
|
declare const loadComponent: (scope: string, module: string, url: string, skipCompatMode?: boolean, preventSingleton?: boolean) => React.LazyExoticComponent<React.ComponentType<any>>;
|
|
@@ -1118,11 +1118,21 @@ export declare enum DialogIconType {
|
|
|
1118
1118
|
export type AnonymousAccountResult = {
|
|
1119
1119
|
token: string;
|
|
1120
1120
|
};
|
|
1121
|
+
/** Hinge posture reported by the native app on iPhone Duo. */
|
|
1122
|
+
export declare enum HingeStatus {
|
|
1123
|
+
Closed = "closed",
|
|
1124
|
+
PartiallyOpen = "partiallyOpen",
|
|
1125
|
+
FullyOpen = "fullyOpen"
|
|
1126
|
+
}
|
|
1121
1127
|
export interface AppleSafeArea {
|
|
1122
1128
|
top: number;
|
|
1123
1129
|
left: number;
|
|
1124
1130
|
bottom: number;
|
|
1125
1131
|
right: number;
|
|
1132
|
+
/** Only provided by the native app on iPhone Duo. */
|
|
1133
|
+
hingeAngle?: number;
|
|
1134
|
+
/** Only provided by the native app on iPhone Duo. */
|
|
1135
|
+
hingeStatus?: HingeStatus;
|
|
1126
1136
|
}
|
|
1127
1137
|
export type PageMainGroupType = {
|
|
1128
1138
|
Id: 1;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ChaynsReactFunctions, ChaynsReactValues, ChaynsStyleSettings, CleanupCallback, DataChangeCallback, IChaynsReact } from '../types/IChaynsReact';
|
|
1
|
+
import { AppleSafeArea, ChaynsReactFunctions, ChaynsReactValues, ChaynsStyleSettings, CleanupCallback, DataChangeCallback, IChaynsReact } from '../types/IChaynsReact';
|
|
2
2
|
export declare class AppWrapper implements IChaynsReact {
|
|
3
3
|
values: ChaynsReactValues;
|
|
4
4
|
history: IChaynsReact['history'];
|
|
5
5
|
accessToken: string;
|
|
6
|
-
latestAppleSafeArea: null;
|
|
6
|
+
latestAppleSafeArea: AppleSafeArea | null;
|
|
7
7
|
private trustedDomains;
|
|
8
8
|
listeners: (() => void)[];
|
|
9
9
|
customFunctions: {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chayns-api",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
3
|
+
"version": "3.7.0-beta.3",
|
|
4
4
|
"description": "new chayns api",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"dev": "npm link && npm run watch",
|
|
37
37
|
"format": "prettier . --write",
|
|
38
38
|
"lint": "eslint src",
|
|
39
|
+
"test:safe-area": "npm run build:cjs && npm run build:typescript && node --test tests/safe-area.test.cjs && tsc --noEmit --strict --target ES2020 --module commonjs --esModuleInterop --skipLibCheck tests/safe-area.types.ts",
|
|
39
40
|
"prepublishOnly": "npm run build:cjs && npm run build:esm && npm run build:typescript",
|
|
40
41
|
"preversion": "npm run build:typescript -- --noEmit"
|
|
41
42
|
},
|
|
@@ -56,28 +57,28 @@
|
|
|
56
57
|
"ua-parser-js": "^1.0.41"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@babel/cli": "^7.
|
|
60
|
-
"@babel/core": "^7.
|
|
61
|
-
"@babel/preset-env": "^7.
|
|
62
|
-
"@babel/preset-react": "^7.
|
|
63
|
-
"@babel/preset-typescript": "^7.
|
|
60
|
+
"@babel/cli": "^7.29.7",
|
|
61
|
+
"@babel/core": "^7.29.13",
|
|
62
|
+
"@babel/preset-env": "^7.29.7",
|
|
63
|
+
"@babel/preset-react": "^7.29.7",
|
|
64
|
+
"@babel/preset-typescript": "^7.29.7",
|
|
64
65
|
"@chayns-toolkit/eslint-config": "^3.0.2",
|
|
65
|
-
"@module-federation/enhanced": "^2.
|
|
66
|
-
"@module-federation/inject-external-runtime-core-plugin": "^2.
|
|
67
|
-
"@rsbuild/plugin-umd": "^1.0.
|
|
66
|
+
"@module-federation/enhanced": "^2.9.3",
|
|
67
|
+
"@module-federation/inject-external-runtime-core-plugin": "^2.9.3",
|
|
68
|
+
"@rsbuild/plugin-umd": "^1.0.7",
|
|
68
69
|
"@types/htmlescape": "^1.1.3",
|
|
69
70
|
"@types/lodash.throttle": "^4.1.9",
|
|
70
71
|
"@types/prop-types": "^15.7.15",
|
|
71
|
-
"@types/react": "^18.3.
|
|
72
|
+
"@types/react": "^18.3.31",
|
|
72
73
|
"@types/react-dom": "^18.3.7",
|
|
73
74
|
"@types/ua-parser-js": "^0.7.39",
|
|
74
75
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
75
|
-
"chayns-toolkit": "^4.
|
|
76
|
-
"concurrently": "^
|
|
76
|
+
"chayns-toolkit": "^4.2.3",
|
|
77
|
+
"concurrently": "^10.0.7",
|
|
77
78
|
"cross-env": "^10.1.0",
|
|
78
79
|
"jsdom": "^29.1.1",
|
|
79
|
-
"prettier": "^3.
|
|
80
|
-
"prettier-plugin-packagejson": "^
|
|
80
|
+
"prettier": "^3.9.10",
|
|
81
|
+
"prettier-plugin-packagejson": "^3.1.0",
|
|
81
82
|
"react": "^18.3.1",
|
|
82
83
|
"react-dom": "^18.3.1",
|
|
83
84
|
"typescript": "^5.9.3"
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
const assert = require('node:assert/strict');
|
|
2
|
+
const { afterEach, beforeEach, test } = require('node:test');
|
|
3
|
+
const { JSDOM } = require('jsdom');
|
|
4
|
+
|
|
5
|
+
const dom = new JSDOM('<!doctype html><html><body></body></html>', { url: 'https://example.test' });
|
|
6
|
+
global.window = dom.window;
|
|
7
|
+
global.document = dom.window.document;
|
|
8
|
+
Object.defineProperty(global, 'navigator', { configurable: true, value: dom.window.navigator });
|
|
9
|
+
global.IS_REACT_ACT_ENVIRONMENT = true;
|
|
10
|
+
|
|
11
|
+
const { act, createElement, StrictMode } = require('react');
|
|
12
|
+
const { createRoot } = require('react-dom/client');
|
|
13
|
+
const { ChaynsContext } = require('../dist/cjs/components/ChaynsContext');
|
|
14
|
+
const { useSafeArea } = require('../dist/cjs/hooks/useSafeArea');
|
|
15
|
+
const { AppName, HingeStatus } = require('../dist/cjs/types/IChaynsReact');
|
|
16
|
+
const { AppWrapper } = require('../dist/cjs/wrapper/AppWrapper');
|
|
17
|
+
const { normalizeFunctions } = require('../dist/cjs/wrapper/normalizeFunctions');
|
|
18
|
+
|
|
19
|
+
const insets = { top: 12, left: 17, bottom: 20, right: 43 };
|
|
20
|
+
let wrapper;
|
|
21
|
+
let nativeCalls;
|
|
22
|
+
let listenerIds;
|
|
23
|
+
let root;
|
|
24
|
+
let currentValue;
|
|
25
|
+
|
|
26
|
+
const emit = (value, call = nativeCalls.at(-1)) => {
|
|
27
|
+
const callbackName = call.value.callback.replace(/^window\./, '');
|
|
28
|
+
window[callbackName]({ retVal: value });
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const subscribe = async (callback) => {
|
|
32
|
+
const id = await wrapper.functions.addAppleSafeAreaListener(callback);
|
|
33
|
+
listenerIds.push(id);
|
|
34
|
+
return id;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const Probe = ({ enabled }) => {
|
|
38
|
+
currentValue = useSafeArea({ enabled });
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const renderHook = async (enabled = true) => {
|
|
43
|
+
root ??= createRoot(document.createElement('div'));
|
|
44
|
+
await act(async () => {
|
|
45
|
+
root.render(createElement(StrictMode, null, createElement(ChaynsContext.Provider, { value: wrapper }, createElement(Probe, { enabled }))));
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
beforeEach(() => {
|
|
50
|
+
wrapper = new AppWrapper();
|
|
51
|
+
wrapper.values = { device: { os: 'iOS', app: { name: AppName.Sidekick, appVersion: 2120 } } };
|
|
52
|
+
nativeCalls = [];
|
|
53
|
+
listenerIds = [];
|
|
54
|
+
root = undefined;
|
|
55
|
+
currentValue = undefined;
|
|
56
|
+
window.webkit = { messageHandlers: { jsonCall: { postMessage: (json) => nativeCalls.push(JSON.parse(json)) } } };
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
afterEach(async () => {
|
|
60
|
+
if (root) await act(async () => root.unmount());
|
|
61
|
+
for (const id of listenerIds) await wrapper.functions.removeAppleSafeAreaListener(id);
|
|
62
|
+
for (const key of Object.keys(window)) {
|
|
63
|
+
if (key.startsWith('chaynsApiV5Callback_')) delete window[key];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('exports the three native hinge status values through the public entry point', () => {
|
|
68
|
+
assert.deepEqual(HingeStatus, { Closed: 'closed', PartiallyOpen: 'partiallyOpen', FullyOpen: 'fullyOpen' });
|
|
69
|
+
assert.equal(require('../dist/cjs').HingeStatus, HingeStatus);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
for (const hingeStatus of Object.values(HingeStatus)) {
|
|
73
|
+
test(`preserves ${hingeStatus} and a zero angle in a direct safe-area request`, async () => {
|
|
74
|
+
const expected = { ...insets, hingeAngle: 0, hingeStatus };
|
|
75
|
+
const pending = wrapper.functions.getAppleSafeArea();
|
|
76
|
+
assert.equal(nativeCalls[0].action, 300);
|
|
77
|
+
emit({ ...expected, unrelated: 'ignored' });
|
|
78
|
+
assert.deepEqual(await pending, expected);
|
|
79
|
+
assert.deepEqual(await wrapper.functions.getAppleSafeArea(), expected);
|
|
80
|
+
assert.equal(nativeCalls.length, 1);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
test('keeps ordinary iPhones free of hinge properties in requests and listener updates', async () => {
|
|
85
|
+
const pending = wrapper.functions.getAppleSafeArea();
|
|
86
|
+
emit(insets);
|
|
87
|
+
assert.deepEqual(await pending, insets);
|
|
88
|
+
const values = [];
|
|
89
|
+
await subscribe((value) => values.push(value));
|
|
90
|
+
emit(insets);
|
|
91
|
+
assert.deepEqual(values, [insets, insets]);
|
|
92
|
+
assert.equal(Object.hasOwn(values[1], 'hingeAngle'), false);
|
|
93
|
+
assert.equal(Object.hasOwn(values[1], 'hingeStatus'), false);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('retains the existing zero-inset fallback for an absent native response', async () => {
|
|
97
|
+
const pending = wrapper.functions.getAppleSafeArea();
|
|
98
|
+
emit(undefined);
|
|
99
|
+
assert.deepEqual(await pending, { top: 0, left: 0, bottom: 0, right: 0 });
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('updates the listener cache and new subscribers when only hinge metadata changes', async () => {
|
|
103
|
+
const values = [];
|
|
104
|
+
await subscribe((value) => values.push(value));
|
|
105
|
+
const stream = nativeCalls[0];
|
|
106
|
+
for (const hingeStatus of Object.values(HingeStatus)) {
|
|
107
|
+
const expected = { ...insets, hingeAngle: 90, hingeStatus };
|
|
108
|
+
emit(expected, stream);
|
|
109
|
+
assert.deepEqual(values.at(-1), expected);
|
|
110
|
+
assert.deepEqual(await wrapper.functions.getAppleSafeArea(), expected);
|
|
111
|
+
}
|
|
112
|
+
const replay = [];
|
|
113
|
+
await subscribe((value) => replay.push(value));
|
|
114
|
+
assert.deepEqual(replay, [values.at(-1)]);
|
|
115
|
+
assert.equal(nativeCalls.length, 1);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('stops delivering native updates to removed listeners', async () => {
|
|
119
|
+
const values = [];
|
|
120
|
+
const id = await subscribe((value) => values.push(value));
|
|
121
|
+
await wrapper.functions.removeAppleSafeAreaListener(id);
|
|
122
|
+
listenerIds = [];
|
|
123
|
+
emit({ ...insets, hingeAngle: 90, hingeStatus: HingeStatus.PartiallyOpen });
|
|
124
|
+
assert.deepEqual(values, []);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('passes hinge updates through the existing compatibility fallback unchanged', async () => {
|
|
128
|
+
let dispatch;
|
|
129
|
+
const functions = normalizeFunctions({
|
|
130
|
+
invokeCall: (options, callback) => {
|
|
131
|
+
assert.equal(options.action, 300);
|
|
132
|
+
dispatch = callback;
|
|
133
|
+
return Promise.resolve();
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
const values = [];
|
|
137
|
+
const id = await functions.addAppleSafeAreaListener((value) => values.push(value));
|
|
138
|
+
const expected = { ...insets, hingeAngle: 90, hingeStatus: HingeStatus.PartiallyOpen };
|
|
139
|
+
dispatch(expected);
|
|
140
|
+
assert.deepEqual(values, [expected]);
|
|
141
|
+
assert.deepEqual(await functions.getAppleSafeArea(), expected);
|
|
142
|
+
await functions.removeAppleSafeAreaListener(id);
|
|
143
|
+
dispatch({ ...expected, hingeStatus: HingeStatus.FullyOpen });
|
|
144
|
+
assert.deepEqual(values, [expected]);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('updates the actual hook through native folding events with identical insets', async () => {
|
|
148
|
+
await renderHook();
|
|
149
|
+
const stream = nativeCalls[0];
|
|
150
|
+
for (const hingeStatus of Object.values(HingeStatus)) {
|
|
151
|
+
const expected = { ...insets, hingeAngle: 90, hingeStatus };
|
|
152
|
+
await act(async () => emit(expected, stream));
|
|
153
|
+
assert.deepEqual(currentValue, expected);
|
|
154
|
+
}
|
|
155
|
+
assert.equal(nativeCalls.length, 1);
|
|
156
|
+
const beforeCleanup = currentValue;
|
|
157
|
+
await renderHook(false);
|
|
158
|
+
emit({ ...insets, hingeAngle: 0, hingeStatus: HingeStatus.Closed }, stream);
|
|
159
|
+
assert.equal(currentValue, beforeCleanup);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test('returns only insets on ordinary devices and retains disabled-hook behavior', async () => {
|
|
163
|
+
await renderHook(false);
|
|
164
|
+
assert.deepEqual(currentValue, { top: 0, left: 0, bottom: 0, right: 0 });
|
|
165
|
+
assert.equal(nativeCalls.length, 0);
|
|
166
|
+
await renderHook();
|
|
167
|
+
await act(async () => emit(insets));
|
|
168
|
+
assert.deepEqual(currentValue, insets);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test('does not register native listeners on unsupported runtimes', async () => {
|
|
172
|
+
wrapper.values.device.os = 'Android';
|
|
173
|
+
await renderHook();
|
|
174
|
+
assert.equal(nativeCalls.length, 0);
|
|
175
|
+
assert.deepEqual(currentValue, { top: 0, left: 0, bottom: 0, right: 0 });
|
|
176
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { addAppleSafeAreaListener, AppleSafeArea, getSafeArea, HingeStatus, useSafeArea, useSafeAreaListener } from '../dist/types';
|
|
2
|
+
|
|
3
|
+
const ordinaryPhone: AppleSafeArea = { top: 12, left: 17, bottom: 20, right: 43 };
|
|
4
|
+
const duo: AppleSafeArea = { ...ordinaryPhone, hingeAngle: 0, hingeStatus: HingeStatus.Closed };
|
|
5
|
+
|
|
6
|
+
declare const hookValue: ReturnType<typeof useSafeArea>;
|
|
7
|
+
const hingeAngle: number | undefined = hookValue.hingeAngle;
|
|
8
|
+
const hingeStatus: HingeStatus | undefined = hookValue.hingeStatus;
|
|
9
|
+
|
|
10
|
+
const getInsets: () => Promise<AppleSafeArea> = getSafeArea;
|
|
11
|
+
const addListener: (callback: (value: AppleSafeArea) => void) => Promise<number> = addAppleSafeAreaListener;
|
|
12
|
+
const useListener: () => (callback: (value: AppleSafeArea) => void) => () => void = useSafeAreaListener;
|