chayns-api 3.0.1 → 3.1.0-beta.1
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/calls/index.js +4 -1
- package/dist/cjs/calls/visibilityChangeListener.js +4 -4
- package/dist/cjs/components/ChaynsProvider.js +34 -6
- package/dist/cjs/components/withHydrationBoundary.js +2 -2
- package/dist/cjs/constants/index.js +0 -22
- package/dist/cjs/contexts/HistoryLayerContext.js +89 -0
- package/dist/cjs/contexts/index.js +38 -0
- package/dist/cjs/handler/history/FrameHistoryLayer.js +100 -0
- package/dist/cjs/handler/history/HistoryLayer.js +321 -0
- package/dist/cjs/handler/history/index.js +19 -0
- package/dist/cjs/hooks/history.js +454 -0
- package/dist/cjs/hooks/index.js +62 -1
- package/dist/cjs/host/ChaynsHost.js +113 -54
- package/dist/cjs/host/iframe/HostIframe.js +70 -5
- package/dist/cjs/host/module/ModuleHost.js +50 -44
- package/dist/cjs/index.js +139 -6
- package/dist/cjs/types/history.js +1 -0
- package/dist/cjs/umd.index.js +2 -2
- package/dist/cjs/utils/EventBus.js +33 -0
- package/dist/cjs/{util → utils}/appStorage.js +2 -2
- package/dist/cjs/utils/equality.js +19 -0
- package/dist/cjs/utils/history/BlockRegistry.js +153 -0
- package/dist/cjs/utils/history/NavigationQueue.js +389 -0
- package/dist/cjs/utils/history/layerTree.js +32 -0
- package/dist/cjs/utils/history/nativeBackHandling.js +61 -0
- package/dist/cjs/utils/history/navigationIndex.js +74 -0
- package/dist/cjs/utils/history/rootLayer.js +213 -0
- package/dist/cjs/utils/history/segments.js +15 -0
- package/dist/cjs/utils/history/stateProjector.js +156 -0
- package/dist/cjs/utils/history/url.js +47 -0
- package/dist/cjs/utils/history/window.js +9 -0
- package/dist/cjs/wrapper/AppWrapper.js +24 -24
- package/dist/cjs/wrapper/FrameWrapper.js +35 -2
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +2 -0
- package/dist/cjs/wrapper/StaticChaynsApi.js +1 -1
- package/dist/esm/calls/index.js +2 -0
- package/dist/esm/calls/visibilityChangeListener.js +1 -1
- package/dist/esm/components/ChaynsProvider.js +34 -6
- package/dist/esm/components/withHydrationBoundary.js +1 -1
- package/dist/esm/constants/index.js +1 -3
- package/dist/esm/contexts/HistoryLayerContext.js +76 -0
- package/dist/esm/contexts/index.js +3 -0
- package/dist/esm/handler/history/FrameHistoryLayer.js +105 -0
- package/dist/esm/handler/history/HistoryLayer.js +321 -0
- package/dist/esm/handler/history/index.js +2 -0
- package/dist/esm/hooks/history.js +428 -0
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/host/ChaynsHost.js +113 -54
- package/dist/esm/host/iframe/HostIframe.js +70 -5
- package/dist/esm/host/module/ModuleHost.js +50 -44
- package/dist/esm/index.js +15 -6
- package/dist/esm/types/history.js +1 -0
- package/dist/esm/umd.index.js +2 -2
- package/dist/esm/utils/EventBus.js +31 -0
- package/dist/esm/{util → utils}/appStorage.js +1 -1
- package/dist/esm/utils/equality.js +12 -0
- package/dist/esm/utils/history/BlockRegistry.js +151 -0
- package/dist/esm/utils/history/NavigationQueue.js +386 -0
- package/dist/esm/utils/history/layerTree.js +24 -0
- package/dist/esm/utils/history/nativeBackHandling.js +59 -0
- package/dist/esm/utils/history/navigationIndex.js +62 -0
- package/dist/esm/utils/history/rootLayer.js +205 -0
- package/dist/esm/utils/history/segments.js +7 -0
- package/dist/esm/utils/history/stateProjector.js +147 -0
- package/dist/esm/utils/history/url.js +40 -0
- package/dist/esm/utils/history/window.js +3 -0
- package/dist/esm/wrapper/AppWrapper.js +6 -6
- package/dist/esm/wrapper/FrameWrapper.js +35 -2
- package/dist/esm/wrapper/ModuleFederationWrapper.js +2 -0
- package/dist/esm/wrapper/StaticChaynsApi.js +2 -1
- package/dist/types/calls/index.d.ts +5 -0
- package/dist/types/components/ChaynsProvider.d.ts +21 -0
- package/dist/types/constants/index.d.ts +0 -2
- package/dist/types/contexts/HistoryLayerContext.d.ts +33 -0
- package/dist/types/contexts/index.d.ts +3 -0
- package/dist/types/handler/history/FrameHistoryLayer.d.ts +99 -0
- package/dist/types/handler/history/HistoryLayer.d.ts +117 -0
- package/dist/types/handler/history/index.d.ts +2 -0
- package/dist/types/hooks/history.d.ts +89 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/host/ChaynsHost.d.ts +12 -0
- package/dist/types/host/iframe/HostIframe.d.ts +4 -0
- package/dist/types/host/module/ModuleHost.d.ts +4 -0
- package/dist/types/index.d.ts +15 -6
- package/dist/types/types/IChaynsReact.d.ts +3 -0
- package/dist/types/types/history.d.ts +74 -0
- package/dist/types/umd.index.d.ts +2 -2
- package/dist/types/utils/EventBus.d.ts +10 -0
- package/dist/types/{util → utils}/collectCssChunks.d.ts +1 -1
- package/dist/types/utils/equality.d.ts +2 -0
- package/dist/types/utils/history/BlockRegistry.d.ts +45 -0
- package/dist/types/utils/history/NavigationQueue.d.ts +118 -0
- package/dist/types/utils/history/layerTree.d.ts +10 -0
- package/dist/types/utils/history/nativeBackHandling.d.ts +47 -0
- package/dist/types/utils/history/navigationIndex.d.ts +17 -0
- package/dist/types/utils/history/rootLayer.d.ts +42 -0
- package/dist/types/utils/history/segments.d.ts +2 -0
- package/dist/types/utils/history/stateProjector.d.ts +24 -0
- package/dist/types/utils/history/url.d.ts +17 -0
- package/dist/types/utils/history/window.d.ts +1 -0
- package/dist/types/wrapper/FrameWrapper.d.ts +1 -0
- package/dist/types/wrapper/StaticChaynsApi.d.ts +1 -0
- package/package.json +2 -1
- /package/dist/cjs/{constants → contexts}/hydrationContext.js +0 -0
- /package/dist/cjs/{constants → contexts}/moduleContext.js +0 -0
- /package/dist/cjs/{helper/apiListenerHelper.js → utils/apiListener.js} +0 -0
- /package/dist/cjs/{util → utils}/appCall.js +0 -0
- /package/dist/cjs/{util → utils}/bindChaynsApi.js +0 -0
- /package/dist/cjs/{util → utils}/collectCssChunks.js +0 -0
- /package/dist/cjs/{util → utils}/deviceHelper.js +0 -0
- /package/dist/cjs/{util → utils}/heightHelper.js +0 -0
- /package/dist/cjs/{util → utils}/initModuleFederationSharing.js +0 -0
- /package/dist/cjs/{util → utils}/is.js +0 -0
- /package/dist/cjs/{util → utils}/postIframeForm.js +0 -0
- /package/dist/cjs/{util → utils}/transferNestedFunctions.js +0 -0
- /package/dist/cjs/{util → utils}/url.js +0 -0
- /package/dist/esm/{constants → contexts}/hydrationContext.js +0 -0
- /package/dist/esm/{constants → contexts}/moduleContext.js +0 -0
- /package/dist/esm/{helper/apiListenerHelper.js → utils/apiListener.js} +0 -0
- /package/dist/esm/{util → utils}/appCall.js +0 -0
- /package/dist/esm/{util → utils}/bindChaynsApi.js +0 -0
- /package/dist/esm/{util → utils}/collectCssChunks.js +0 -0
- /package/dist/esm/{util → utils}/deviceHelper.js +0 -0
- /package/dist/esm/{util → utils}/heightHelper.js +0 -0
- /package/dist/esm/{util → utils}/initModuleFederationSharing.js +0 -0
- /package/dist/esm/{util → utils}/is.js +0 -0
- /package/dist/esm/{util → utils}/postIframeForm.js +0 -0
- /package/dist/esm/{util → utils}/transferNestedFunctions.js +0 -0
- /package/dist/esm/{util → utils}/url.js +0 -0
- /package/dist/types/{constants → contexts}/hydrationContext.d.ts +0 -0
- /package/dist/types/{constants → contexts}/moduleContext.d.ts +0 -0
- /package/dist/types/{helper/apiListenerHelper.d.ts → utils/apiListener.d.ts} +0 -0
- /package/dist/types/{util → utils}/appCall.d.ts +0 -0
- /package/dist/types/{util → utils}/appStorage.d.ts +0 -0
- /package/dist/types/{util → utils}/bindChaynsApi.d.ts +0 -0
- /package/dist/types/{util → utils}/deviceHelper.d.ts +0 -0
- /package/dist/types/{util → utils}/heightHelper.d.ts +0 -0
- /package/dist/types/{util → utils}/initModuleFederationSharing.d.ts +0 -0
- /package/dist/types/{util → utils}/is.d.ts +0 -0
- /package/dist/types/{util → utils}/postIframeForm.d.ts +0 -0
- /package/dist/types/{util → utils}/transferNestedFunctions.d.ts +0 -0
- /package/dist/types/{util → utils}/url.d.ts +0 -0
package/dist/cjs/calls/index.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.vibrate = exports.user = exports.storageSetItem = exports.storageRemoveItem = exports.storageGetItem = exports.site = exports.setWaitCursor = exports.setTempDesignSettings = exports.setScanQrCode = exports.setRefreshScrollEnabled = exports.setOverlay = exports.setHeight = exports.setFloatingButton = exports.setDisplayTimeout = exports.setCustomCookie = exports.setAdminMode = exports.sendMessageToUser = exports.sendMessageToPage = exports.sendMessageToGroup = exports.selectPage = exports.scrollToY = exports.scrollByY = exports.removeWindowMetricsListener = exports.removeVisibilityChangeListener = exports.removeToolbarChangeListener = exports.removeScrollListener = exports.removeGeoLocationListener = exports.removeAccessTokenChangeListener = exports.refreshData = exports.refreshAccessToken = exports.redirect = exports.parameters = exports.pages = exports.openVideo = exports.openUrl = exports.openMedia = exports.openImage = exports.navigateBack = exports.logout = exports.login = exports.language = exports.invokePaymentCall = exports.invokeDialogCall = exports.invokeCall = exports.getWindowMetrics = exports.getUserInfo = exports.getUser = exports.getStyleSettings = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDialogData = exports.getDevice = exports.getCustomFunction = exports.getCustomCookie = exports.getCurrentPage = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.createDialog = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addToolbarChangeListener = exports.addScrollListener = exports.addGeoLocationListener = exports.addAnonymousAccount = exports.addAccessTokenChangeListener = void 0;
|
|
6
|
+
exports.vibrate = exports.user = exports.storageSetItem = exports.storageRemoveItem = exports.storageGetItem = exports.site = exports.setWaitCursor = exports.setTempDesignSettings = exports.setScanQrCode = exports.setRefreshScrollEnabled = exports.setOverlay = exports.setHeight = exports.setFloatingButton = exports.setDisplayTimeout = exports.setCustomCookie = exports.setAdminMode = exports.sendMessageToUser = exports.sendMessageToPage = exports.sendMessageToGroup = exports.selectPage = exports.scrollToY = exports.scrollByY = exports.removeWindowMetricsListener = exports.removeVisibilityChangeListener = exports.removeToolbarChangeListener = exports.removeScrollListener = exports.removeGeoLocationListener = exports.removeAccessTokenChangeListener = exports.refreshData = exports.refreshAccessToken = exports.redirect = exports.parameters = exports.pages = exports.openVideo = exports.openUrl = exports.openMedia = exports.openImage = exports.navigateBack = exports.logout = exports.login = exports.language = exports.invokePaymentCall = exports.invokeDialogCall = exports.invokeCall = exports.getWindowMetrics = exports.getUserInfo = exports.getUser = exports.getStyleSettings = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDialogData = exports.getDevice = exports.getCustomFunction = exports.getCustomCookie = exports.getCurrentPage = exports.getChaynsHistoryLayer = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.createDialog = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addToolbarChangeListener = exports.addScrollListener = exports.addGeoLocationListener = exports.addAnonymousAccount = exports.addAccessTokenChangeListener = void 0;
|
|
7
7
|
var _moduleWrapper = require("../components/moduleWrapper");
|
|
8
|
+
var _HistoryLayerContext = require("../contexts/HistoryLayerContext");
|
|
8
9
|
const addGeoLocationListener = (...args) => _moduleWrapper.moduleWrapper.current.functions.addGeoLocationListener(...args);
|
|
9
10
|
exports.addGeoLocationListener = addGeoLocationListener;
|
|
10
11
|
const addScrollListener = (...args) => _moduleWrapper.moduleWrapper.current.functions.addScrollListener(...args);
|
|
@@ -115,6 +116,8 @@ const addAnonymousAccount = () => _moduleWrapper.moduleWrapper.current.functions
|
|
|
115
116
|
exports.addAnonymousAccount = addAnonymousAccount;
|
|
116
117
|
const getUser = () => _moduleWrapper.moduleWrapper.current.values.user;
|
|
117
118
|
exports.getUser = getUser;
|
|
119
|
+
const getChaynsHistoryLayer = () => (0, _HistoryLayerContext.getCurrentChaynsHistoryLayer)();
|
|
120
|
+
exports.getChaynsHistoryLayer = getChaynsHistoryLayer;
|
|
118
121
|
const getSite = () => _moduleWrapper.moduleWrapper.current.values.site;
|
|
119
122
|
exports.getSite = getSite;
|
|
120
123
|
const getCurrentPage = () => _moduleWrapper.moduleWrapper.current.values.currentPage;
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.removeVisibilityChangeListener = exports.addVisibilityChangeListener = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _apiListener = require("../utils/apiListener");
|
|
8
8
|
const key = 'visibilityChangeListener';
|
|
9
9
|
const handleVisibilityChange = () => {
|
|
10
|
-
(0,
|
|
10
|
+
(0, _apiListener.dispatchApiEvent)(key, {
|
|
11
11
|
isVisible: !document.hidden
|
|
12
12
|
});
|
|
13
13
|
};
|
|
@@ -15,7 +15,7 @@ const addVisibilityChangeListener = callback => {
|
|
|
15
15
|
const {
|
|
16
16
|
id,
|
|
17
17
|
shouldInitialize
|
|
18
|
-
} = (0,
|
|
18
|
+
} = (0, _apiListener.addApiListener)(key, callback);
|
|
19
19
|
if (shouldInitialize) {
|
|
20
20
|
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
21
21
|
}
|
|
@@ -23,7 +23,7 @@ const addVisibilityChangeListener = callback => {
|
|
|
23
23
|
};
|
|
24
24
|
exports.addVisibilityChangeListener = addVisibilityChangeListener;
|
|
25
25
|
const removeVisibilityChangeListener = id => {
|
|
26
|
-
const shouldRemove = (0,
|
|
26
|
+
const shouldRemove = (0, _apiListener.removeApiListener)(key, id);
|
|
27
27
|
if (shouldRemove) {
|
|
28
28
|
document.removeEventListener('addVisibilityChangeListener', handleVisibilityChange);
|
|
29
29
|
}
|
|
@@ -9,13 +9,15 @@ var _htmlescape = _interopRequireDefault(require("htmlescape"));
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _useIsomorphicLayoutEffect = require("../hooks/useIsomorphicLayoutEffect");
|
|
11
11
|
var _IChaynsReact = require("../types/IChaynsReact");
|
|
12
|
-
var _deviceHelper = _interopRequireDefault(require("../
|
|
12
|
+
var _deviceHelper = _interopRequireDefault(require("../utils/deviceHelper"));
|
|
13
13
|
var _AppWrapper = require("../wrapper/AppWrapper");
|
|
14
14
|
var _FrameWrapper = require("../wrapper/FrameWrapper");
|
|
15
15
|
var _ModuleFederationWrapper = require("../wrapper/ModuleFederationWrapper");
|
|
16
16
|
var _SsrWrapper = require("../wrapper/SsrWrapper");
|
|
17
17
|
var _ChaynsContext = require("./ChaynsContext");
|
|
18
18
|
var _moduleWrapper = require("./moduleWrapper");
|
|
19
|
+
var _HistoryLayerContext = require("../contexts/HistoryLayerContext");
|
|
20
|
+
var _rootLayer = require("../utils/history/rootLayer");
|
|
19
21
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
23
|
const isServer = typeof window === 'undefined';
|
|
@@ -67,11 +69,18 @@ const ChaynsProvider = ({
|
|
|
67
69
|
customFunctions,
|
|
68
70
|
renderedByServer,
|
|
69
71
|
isModule,
|
|
70
|
-
chaynsApiId
|
|
72
|
+
chaynsApiId,
|
|
73
|
+
historyLayer,
|
|
74
|
+
history,
|
|
75
|
+
isHistoryDisabled,
|
|
76
|
+
segmentCount
|
|
71
77
|
}) => {
|
|
72
|
-
var _ref, _crypto, _customWrapper$curren, _customWrapper$
|
|
78
|
+
var _ref, _crypto, _customWrapper$curren, _customWrapper$curren3, _customWrapper$curren4;
|
|
73
79
|
const customWrapper = (0, _react.useRef)(null);
|
|
74
80
|
const idRef = (0, _react.useRef)((_ref = chaynsApiId !== null && chaynsApiId !== void 0 ? chaynsApiId : (_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.randomUUID()) !== null && _ref !== void 0 ? _ref : Math.random().toString());
|
|
81
|
+
const contextLayer = (0, _HistoryLayerContext.useChaynsHistoryLayerContext)();
|
|
82
|
+
const parentLayerRef = (0, _react.useRef)(contextLayer);
|
|
83
|
+
const rootLayerRef = (0, _react.useRef)(null);
|
|
75
84
|
if (!customWrapper.current) {
|
|
76
85
|
if (isModule) {
|
|
77
86
|
if (data && functions) {
|
|
@@ -99,9 +108,10 @@ const ChaynsProvider = ({
|
|
|
99
108
|
customWrapper.current.chaynsApiId = idRef.current;
|
|
100
109
|
}
|
|
101
110
|
}
|
|
111
|
+
const [effectiveLayer, setEffectiveLayer] = (0, _react.useState)(historyLayer !== null && historyLayer !== void 0 ? historyLayer : null);
|
|
102
112
|
const [isInitialized, setIsInitialized] = (0, _react.useState)(!!((_customWrapper$curren = customWrapper.current) !== null && _customWrapper$curren !== void 0 && _customWrapper$curren.values));
|
|
103
113
|
(0, _react.useEffect)(() => {
|
|
104
|
-
void (async () => {
|
|
114
|
+
void (async (_customWrapper$curren2, _ref2) => {
|
|
105
115
|
await customWrapper.current.init();
|
|
106
116
|
customWrapper.current.addDataListener(({
|
|
107
117
|
type,
|
|
@@ -109,6 +119,15 @@ const ChaynsProvider = ({
|
|
|
109
119
|
}) => {
|
|
110
120
|
customWrapper.current.emitChange();
|
|
111
121
|
});
|
|
122
|
+
parentLayerRef.current = (_customWrapper$curren2 = customWrapper.current.functions.getHistoryLayer()) !== null && _customWrapper$curren2 !== void 0 ? _customWrapper$curren2 : contextLayer;
|
|
123
|
+
if (!rootLayerRef.current && !historyLayer && !parentLayerRef.current) {
|
|
124
|
+
rootLayerRef.current = (0, _rootLayer.getOrInitRootChaynsHistoryLayer)(history === null || history === void 0 ? void 0 : history.url, history === null || history === void 0 ? void 0 : history.segmentCount).rootLayer;
|
|
125
|
+
}
|
|
126
|
+
const layer = (_ref2 = historyLayer !== null && historyLayer !== void 0 ? historyLayer : parentLayerRef.current) !== null && _ref2 !== void 0 ? _ref2 : rootLayerRef.current;
|
|
127
|
+
if (typeof segmentCount === 'number' && layer.getSegmentCount() !== segmentCount) {
|
|
128
|
+
layer.setSegmentCount(segmentCount);
|
|
129
|
+
}
|
|
130
|
+
setEffectiveLayer(layer);
|
|
112
131
|
if (!isInitialized) {
|
|
113
132
|
setIsInitialized(true);
|
|
114
133
|
}
|
|
@@ -133,10 +152,19 @@ const ChaynsProvider = ({
|
|
|
133
152
|
(0, _moduleWrapper.removeModuleWrapper)(id, customWrapper.current);
|
|
134
153
|
};
|
|
135
154
|
}, []);
|
|
155
|
+
let isDisabled = Boolean((_customWrapper$curren3 = customWrapper.current.values) === null || _customWrapper$curren3 === void 0 ? void 0 : _customWrapper$curren3.isHistoryDisabled);
|
|
156
|
+
if (typeof isHistoryDisabled === 'boolean' && !isDisabled) {
|
|
157
|
+
isDisabled = isHistoryDisabled;
|
|
158
|
+
}
|
|
159
|
+
if ((historyLayer === null || historyLayer === void 0 ? void 0 : historyLayer.id) === 'root') {
|
|
160
|
+
isDisabled = false;
|
|
161
|
+
}
|
|
136
162
|
return _react.default.createElement(_react.default.Fragment, null, isInitialized && _react.default.createElement(_ChaynsContext.ChaynsContext.Provider, {
|
|
137
163
|
value: customWrapper.current
|
|
138
|
-
},
|
|
139
|
-
|
|
164
|
+
}, effectiveLayer && !isDisabled ? _react.default.createElement(_HistoryLayerContext.ChaynsHistoryLayerProvider, {
|
|
165
|
+
layer: effectiveLayer
|
|
166
|
+
}, children) : children), _react.default.createElement(InitialDataProvider, {
|
|
167
|
+
data: (_customWrapper$curren4 = customWrapper.current) === null || _customWrapper$curren4 === void 0 ? void 0 : _customWrapper$curren4.values,
|
|
140
168
|
renderedByServer: renderedByServer
|
|
141
169
|
}));
|
|
142
170
|
};
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var
|
|
8
|
+
var _contexts = require("../contexts");
|
|
9
9
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
10
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
11
|
function withHydrationBoundary(Component, initializer, useHydrationId, useProps) {
|
|
@@ -17,7 +17,7 @@ function withHydrationBoundary(Component, initializer, useHydrationId, useProps)
|
|
|
17
17
|
}) => {
|
|
18
18
|
let value;
|
|
19
19
|
if (!globalThis.window) {
|
|
20
|
-
value = (0, _react.useContext)(
|
|
20
|
+
value = (0, _react.useContext)(_contexts.HydrationContext);
|
|
21
21
|
}
|
|
22
22
|
const id = useHydrationId ? useHydrationId() : idProp;
|
|
23
23
|
const props = useProps ? useProps(rest) : undefined;
|
|
@@ -3,17 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _hydrationContext = require("./hydrationContext");
|
|
7
|
-
Object.keys(_hydrationContext).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _hydrationContext[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _hydrationContext[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
6
|
var _DefaultLoginDialogOptions = require("./DefaultLoginDialogOptions");
|
|
18
7
|
Object.keys(_DefaultLoginDialogOptions).forEach(function (key) {
|
|
19
8
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -24,15 +13,4 @@ Object.keys(_DefaultLoginDialogOptions).forEach(function (key) {
|
|
|
24
13
|
return _DefaultLoginDialogOptions[key];
|
|
25
14
|
}
|
|
26
15
|
});
|
|
27
|
-
});
|
|
28
|
-
var _moduleContext = require("./moduleContext");
|
|
29
|
-
Object.keys(_moduleContext).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _moduleContext[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _moduleContext[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
16
|
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.ChaynsHistoryLayerProvider = exports.ChaynsHistoryLayerOverrideProvider = void 0;
|
|
7
|
+
exports.getCurrentChaynsHistoryLayer = getCurrentChaynsHistoryLayer;
|
|
8
|
+
exports.popChaynsHistoryLayer = popChaynsHistoryLayer;
|
|
9
|
+
exports.pushChaynsHistoryLayer = pushChaynsHistoryLayer;
|
|
10
|
+
exports.useChaynsHistoryLayerContext = useChaynsHistoryLayerContext;
|
|
11
|
+
var _reactCompilerRuntime = require("react-compiler-runtime");
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _useIsomorphicLayoutEffect = require("../hooks/useIsomorphicLayoutEffect");
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
const _layerStack = [];
|
|
16
|
+
function pushChaynsHistoryLayer(layer) {
|
|
17
|
+
_layerStack.push(layer);
|
|
18
|
+
}
|
|
19
|
+
function popChaynsHistoryLayer(layer) {
|
|
20
|
+
const index = _layerStack.lastIndexOf(layer);
|
|
21
|
+
if (index > -1) {
|
|
22
|
+
_layerStack.splice(index, 1);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function getCurrentChaynsHistoryLayer() {
|
|
26
|
+
return _layerStack.length > 0 ? _layerStack[_layerStack.length - 1] : null;
|
|
27
|
+
}
|
|
28
|
+
const ChaynsHistoryLayerContext = (0, _react.createContext)(null);
|
|
29
|
+
ChaynsHistoryLayerContext.displayName = 'ChaynsHistoryLayerContext';
|
|
30
|
+
const ChaynsHistoryLayerProvider = t0 => {
|
|
31
|
+
const $ = (0, _reactCompilerRuntime.c)(6);
|
|
32
|
+
const {
|
|
33
|
+
layer,
|
|
34
|
+
children
|
|
35
|
+
} = t0;
|
|
36
|
+
let t1;
|
|
37
|
+
let t2;
|
|
38
|
+
if ($[0] !== layer) {
|
|
39
|
+
t1 = () => {
|
|
40
|
+
pushChaynsHistoryLayer(layer);
|
|
41
|
+
return () => popChaynsHistoryLayer(layer);
|
|
42
|
+
};
|
|
43
|
+
t2 = [layer];
|
|
44
|
+
$[0] = layer;
|
|
45
|
+
$[1] = t1;
|
|
46
|
+
$[2] = t2;
|
|
47
|
+
} else {
|
|
48
|
+
t1 = $[1];
|
|
49
|
+
t2 = $[2];
|
|
50
|
+
}
|
|
51
|
+
(0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)(t1, t2);
|
|
52
|
+
let t3;
|
|
53
|
+
if ($[3] !== children || $[4] !== layer) {
|
|
54
|
+
t3 = _react.default.createElement(ChaynsHistoryLayerContext.Provider, {
|
|
55
|
+
value: layer
|
|
56
|
+
}, children);
|
|
57
|
+
$[3] = children;
|
|
58
|
+
$[4] = layer;
|
|
59
|
+
$[5] = t3;
|
|
60
|
+
} else {
|
|
61
|
+
t3 = $[5];
|
|
62
|
+
}
|
|
63
|
+
return t3;
|
|
64
|
+
};
|
|
65
|
+
exports.ChaynsHistoryLayerProvider = ChaynsHistoryLayerProvider;
|
|
66
|
+
const ChaynsHistoryLayerOverrideProvider = t0 => {
|
|
67
|
+
const $ = (0, _reactCompilerRuntime.c)(3);
|
|
68
|
+
const {
|
|
69
|
+
layer,
|
|
70
|
+
children
|
|
71
|
+
} = t0;
|
|
72
|
+
let t1;
|
|
73
|
+
if ($[0] !== children || $[1] !== layer) {
|
|
74
|
+
t1 = _react.default.createElement(ChaynsHistoryLayerContext.Provider, {
|
|
75
|
+
value: layer
|
|
76
|
+
}, children);
|
|
77
|
+
$[0] = children;
|
|
78
|
+
$[1] = layer;
|
|
79
|
+
$[2] = t1;
|
|
80
|
+
} else {
|
|
81
|
+
t1 = $[2];
|
|
82
|
+
}
|
|
83
|
+
return t1;
|
|
84
|
+
};
|
|
85
|
+
exports.ChaynsHistoryLayerOverrideProvider = ChaynsHistoryLayerOverrideProvider;
|
|
86
|
+
function useChaynsHistoryLayerContext() {
|
|
87
|
+
return (0, _react.useContext)(ChaynsHistoryLayerContext);
|
|
88
|
+
}
|
|
89
|
+
var _default = exports.default = ChaynsHistoryLayerContext;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _hydrationContext = require("./hydrationContext");
|
|
7
|
+
Object.keys(_hydrationContext).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _hydrationContext[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _hydrationContext[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _moduleContext = require("./moduleContext");
|
|
18
|
+
Object.keys(_moduleContext).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _moduleContext[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _moduleContext[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _HistoryLayerContext = require("./HistoryLayerContext");
|
|
29
|
+
Object.keys(_HistoryLayerContext).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _HistoryLayerContext[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _HistoryLayerContext[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FrameHistoryLayer = void 0;
|
|
7
|
+
var _EventBus = require("../../utils/EventBus");
|
|
8
|
+
var _equality = require("../../utils/equality");
|
|
9
|
+
var _segments = require("../../utils/history/segments");
|
|
10
|
+
class FrameHistoryLayer {
|
|
11
|
+
bus = new _EventBus.EventBus();
|
|
12
|
+
constructor(bridge, initial) {
|
|
13
|
+
this.id = initial.id;
|
|
14
|
+
this.depth = initial.depth;
|
|
15
|
+
this._segments = (0, _segments.normalizeHistorySegments)(initial.segments);
|
|
16
|
+
this._params = initial.params;
|
|
17
|
+
this._hash = initial.hash;
|
|
18
|
+
this._state = initial.state;
|
|
19
|
+
this._activeChildId = initial.activeChildId;
|
|
20
|
+
this._segmentCount = initial.segmentCount;
|
|
21
|
+
this.bridge = bridge;
|
|
22
|
+
}
|
|
23
|
+
getSegmentCount() {
|
|
24
|
+
return this._segmentCount;
|
|
25
|
+
}
|
|
26
|
+
setSegmentCount(n) {
|
|
27
|
+
if (n === this._segmentCount) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this._segmentCount = n;
|
|
31
|
+
void this.bridge.setSegmentCount(n);
|
|
32
|
+
}
|
|
33
|
+
createChildLayer(_id) {
|
|
34
|
+
throw new Error('[chaynsHistory] FrameHistoryLayer does not support createChildLayer. ' + 'Manage sub-routing within the iframe with a local initRootChaynsHistoryLayer.');
|
|
35
|
+
}
|
|
36
|
+
destroyChildLayer(_id) {}
|
|
37
|
+
setActiveChild(id, init) {
|
|
38
|
+
return this.bridge.setActiveChild(id, init);
|
|
39
|
+
}
|
|
40
|
+
getActiveChildId() {
|
|
41
|
+
return this._activeChildId;
|
|
42
|
+
}
|
|
43
|
+
getChildLayer(_id) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
getRoute() {
|
|
47
|
+
return [...this._segments];
|
|
48
|
+
}
|
|
49
|
+
setRoute(route, opts) {
|
|
50
|
+
const normalizedRoute = (0, _segments.normalizeHistoryRouteInput)(route);
|
|
51
|
+
if ((0, _equality.shallowEqualArr)(this._segments, normalizedRoute)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
void this.bridge.setRoute(normalizedRoute, opts);
|
|
55
|
+
}
|
|
56
|
+
getParams() {
|
|
57
|
+
return {
|
|
58
|
+
...this._params
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
setParams(params, opts) {
|
|
62
|
+
void this.bridge.setParams(params, opts);
|
|
63
|
+
}
|
|
64
|
+
getHash() {
|
|
65
|
+
return this._hash;
|
|
66
|
+
}
|
|
67
|
+
setHash(hash, opts) {
|
|
68
|
+
void this.bridge.setHash(hash, opts);
|
|
69
|
+
}
|
|
70
|
+
getState() {
|
|
71
|
+
return this._state;
|
|
72
|
+
}
|
|
73
|
+
setState(state, opts) {
|
|
74
|
+
void this.bridge.setState(state, opts);
|
|
75
|
+
}
|
|
76
|
+
navigate(opts) {
|
|
77
|
+
return this.bridge.navigate(opts);
|
|
78
|
+
}
|
|
79
|
+
addBlock(callback, opts) {
|
|
80
|
+
let removeFn = null;
|
|
81
|
+
void this.bridge.addBlock(callback, opts).then(fn => {
|
|
82
|
+
removeFn = fn;
|
|
83
|
+
});
|
|
84
|
+
return () => {
|
|
85
|
+
var _removeFn;
|
|
86
|
+
return (_removeFn = removeFn) === null || _removeFn === void 0 ? void 0 : _removeFn();
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
addEventListener(type, handler) {
|
|
90
|
+
return this.bus.on(type, handler);
|
|
91
|
+
}
|
|
92
|
+
_applyAndEmit(e) {
|
|
93
|
+
this._segments = (0, _segments.normalizeHistorySegments)(e.segments);
|
|
94
|
+
this._params = e.params;
|
|
95
|
+
this._hash = e.hash;
|
|
96
|
+
this._state = e.state;
|
|
97
|
+
this.bus.emit(e.type, e);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.FrameHistoryLayer = FrameHistoryLayer;
|