@bindu-dashing/dam-solution-v2 5.8.7 → 5.8.8
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.
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DamConfigProvider } from "../hocs/DamConfigContext";
|
|
3
3
|
import { ThemeProvider } from "../hocs/ThemeContext";
|
|
4
4
|
import { ThemeModes } from "../utilities/constants/interface";
|
|
5
5
|
import AppProvider from "../hocs/AppProvider";
|
|
6
6
|
import ToastProvider from "../hocs/ToastProvider";
|
|
7
|
-
import { MemoryRouter } from "react-router-dom";
|
|
7
|
+
import { MemoryRouter, useInRouterContext } from "react-router-dom";
|
|
8
8
|
import AppRoutes from "./routes";
|
|
9
9
|
import process from "process";
|
|
10
|
+
// Wrapper component to conditionally use MemoryRouter
|
|
11
|
+
function RouterWrapper({ children, appType }) {
|
|
12
|
+
// Always call hooks at the top level
|
|
13
|
+
const isInsideRouter = useInRouterContext();
|
|
14
|
+
// If appType is provided, it means we're embedding in an existing app with its own router
|
|
15
|
+
// Always skip MemoryRouter in this case to avoid nested Router errors
|
|
16
|
+
if (appType) {
|
|
17
|
+
// Already inside a router (indicated by appType), don't create another one
|
|
18
|
+
return _jsx(_Fragment, { children: children });
|
|
19
|
+
}
|
|
20
|
+
// If we're already in a router context, don't create another one
|
|
21
|
+
if (isInsideRouter) {
|
|
22
|
+
return _jsx(_Fragment, { children: children });
|
|
23
|
+
}
|
|
24
|
+
// Not inside a router, create MemoryRouter
|
|
25
|
+
return _jsx(MemoryRouter, { initialEntries: ["/"], children: children });
|
|
26
|
+
}
|
|
10
27
|
function App(props) {
|
|
11
28
|
const config = {
|
|
12
29
|
damAccessKey: props === null || props === void 0 ? void 0 : props.accessKey,
|
|
@@ -19,6 +36,6 @@ function App(props) {
|
|
|
19
36
|
if (typeof window !== "undefined" && !window.process) {
|
|
20
37
|
window.process = process;
|
|
21
38
|
}
|
|
22
|
-
return (_jsx(DamConfigProvider, { config: config, children: _jsx(ThemeProvider, { styles: props === null || props === void 0 ? void 0 : props.styles, sessionTheme: ThemeModes.LIGHT, children: _jsxs(AppProvider, { children: [_jsx(
|
|
39
|
+
return (_jsx(DamConfigProvider, { config: config, children: _jsx(ThemeProvider, { styles: props === null || props === void 0 ? void 0 : props.styles, sessionTheme: ThemeModes.LIGHT, children: _jsxs(AppProvider, { children: [_jsx(RouterWrapper, { appType: props === null || props === void 0 ? void 0 : props.appType, children: _jsx(AppRoutes, { id: props.id, onSelect: props === null || props === void 0 ? void 0 : props.onSelect, url: props === null || props === void 0 ? void 0 : props.url, routerVersion: (props === null || props === void 0 ? void 0 : props.routerVersion) || 6 }) }), _jsx(ToastProvider, {})] }) }) }));
|
|
23
40
|
}
|
|
24
41
|
export default App;
|
|
@@ -14,6 +14,7 @@ function App(props) {
|
|
|
14
14
|
styles: props === null || props === void 0 ? void 0 : props.styles,
|
|
15
15
|
appType: props === null || props === void 0 ? void 0 : props.appType,
|
|
16
16
|
};
|
|
17
|
+
console.log("id", props.id);
|
|
17
18
|
return (_jsx(DamConfigProvider, { config: config, children: _jsx(ThemeProvider, { styles: props === null || props === void 0 ? void 0 : props.styles, sessionTheme: ThemeModes.LIGHT, children: _jsxs(AppProvider, { children: [_jsx(ImagePickerFiltersComponent, { id: props.id, onSelect: props === null || props === void 0 ? void 0 : props.onSelect, url: props === null || props === void 0 ? void 0 : props.url }), _jsx(ToastProvider, {})] }) }) }));
|
|
18
19
|
}
|
|
19
20
|
export default App;
|
|
@@ -31,7 +31,6 @@ export const DamConfigProvider = ({ children, config }) => {
|
|
|
31
31
|
const getToken = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
32
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
33
33
|
setLoading(true);
|
|
34
|
-
console.log("getToken", getBaseUrl(appType), appType);
|
|
35
34
|
try {
|
|
36
35
|
const response = yield axios.post(getBaseUrl(appType) + USER_LOGIN, {
|
|
37
36
|
accessKey: damAccessKey,
|
|
@@ -16,7 +16,6 @@ import { useInfiniteQuery } from "react-query";
|
|
|
16
16
|
function fetchPickers(api, params) {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
try {
|
|
19
|
-
console.log("fetchPickers", `${FETCH_IMAGEPICKERS_URL}?${addQueryParams(params)}`);
|
|
20
19
|
const response = yield api.get(`${FETCH_IMAGEPICKERS_URL}?${addQueryParams(params)}`);
|
|
21
20
|
return get(response, "data");
|
|
22
21
|
}
|