@griddo/ax 12.14.3 → 12.15.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/README.md +1 -0
- package/package.json +7 -4
- package/src/GlobalStore.tsx +32 -25
- package/src/__tests__/GlobalStore.session.test.tsx +98 -0
- package/src/__tests__/api/global.test.ts +64 -0
- package/src/__tests__/api/session.test.ts +311 -0
- package/src/__tests__/api/sessionRenewal.test.ts +705 -0
- package/src/__tests__/api/utils.test.ts +373 -0
- package/src/__tests__/components/Fields/FileField/FileField.test.tsx +33 -6
- package/src/__tests__/components/FieldsBehavior/FieldsBehavior.test.tsx +5 -3
- package/src/__tests__/components/Login/LoginGriddoId.test.tsx +195 -0
- package/src/__tests__/components/SsoDenied/SsoDenied.test.tsx +86 -0
- package/src/__tests__/containers/App/reducer.griddoId.test.ts +18 -0
- package/src/__tests__/containers/App/session.test.ts +397 -0
- package/src/__tests__/helpers/griddoId.test.ts +56 -0
- package/src/__tests__/locales/loginLocale.test.ts +52 -0
- package/src/__tests__/modules/App/Routing/NavMenu.test.tsx +54 -0
- package/src/__tests__/modules/Login/Login.test.tsx +151 -0
- package/src/__tests__/modules/Redirects/Redirects/Redirects.create.test.tsx +19 -0
- package/src/__tests__/modules/Redirects/Redirects/Redirects.edit.test.tsx +19 -0
- package/src/__tests__/modules/Redirects/Redirects/Redirects.filter.test.tsx +19 -0
- package/src/__tests__/modules/SsoDenied/SsoDenied.test.tsx +30 -0
- package/src/__tests__/routes/publicRoutes.test.ts +36 -0
- package/src/api/global.tsx +24 -1
- package/src/api/session.tsx +197 -0
- package/src/api/sessionRenewal.tsx +114 -0
- package/src/api/utils.tsx +22 -12
- package/src/{helpers/categoryColumns.tsx → components/CategoryCell/buildCategoryColumns.tsx} +3 -2
- package/src/{helpers/fields.tsx → components/FieldsBehavior/getFieldByPath.tsx} +1 -1
- package/src/components/FieldsBehavior/index.tsx +3 -1
- package/src/components/Login/LoginForm/index.tsx +7 -2
- package/src/components/Login/LoginGriddoId/index.tsx +46 -0
- package/src/components/Login/LoginGriddoId/style.tsx +35 -0
- package/src/components/Login/index.tsx +13 -1
- package/src/components/SsoDenied/index.tsx +46 -0
- package/src/components/SsoDenied/style.tsx +37 -0
- package/src/components/index.tsx +11 -7
- package/src/containers/App/actions.tsx +110 -5
- package/src/containers/App/interfaces.tsx +2 -2
- package/src/containers/App/reducer.tsx +9 -0
- package/src/containers/Users/actions.tsx +28 -24
- package/src/helpers/griddoId.ts +28 -0
- package/src/helpers/index.tsx +4 -5
- package/src/locales/en-US.ts +7 -0
- package/src/locales/es-ES.ts +7 -0
- package/src/locales/index.ts +10 -0
- package/src/modules/App/Routing/NavMenu/index.tsx +4 -4
- package/src/modules/Content/PageItem/index.tsx +6 -8
- package/src/modules/Login/index.tsx +12 -2
- package/src/modules/SsoDenied/index.tsx +9 -0
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +6 -8
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +9 -11
- package/src/routes/publicRoutes.tsx +3 -0
|
@@ -26,6 +26,10 @@ export interface IAppState {
|
|
|
26
26
|
error: IError;
|
|
27
27
|
user: IUser;
|
|
28
28
|
token: string;
|
|
29
|
+
/** Refresh token de la sesión ("" = sin refresh: API antigua o sesión previa al despliegue). */
|
|
30
|
+
refreshToken: string;
|
|
31
|
+
/** Versión del par token/refresh (ms); decide qué pestaña tiene el par más nuevo. */
|
|
32
|
+
sessionUpdatedAt: number;
|
|
29
33
|
isLoggingIn: boolean;
|
|
30
34
|
lang: { locale: string; id: number };
|
|
31
35
|
globalLangs: ILanguage[];
|
|
@@ -60,6 +64,8 @@ export interface IGlobalSettings {
|
|
|
60
64
|
autoSummary: boolean;
|
|
61
65
|
autoTranslation: boolean;
|
|
62
66
|
SSOActivated: boolean;
|
|
67
|
+
/** `GRIDDO_ID_ENABLED` de la API: muestra «Entrar con Griddo». Apagado por defecto (también si `GET /settings` falla). */
|
|
68
|
+
GriddoIdEnabled: boolean;
|
|
63
69
|
SSOWelcomeText: string;
|
|
64
70
|
useForms: boolean;
|
|
65
71
|
}
|
|
@@ -77,6 +83,8 @@ export const initialState = {
|
|
|
77
83
|
email: "",
|
|
78
84
|
},
|
|
79
85
|
token: "",
|
|
86
|
+
refreshToken: "",
|
|
87
|
+
sessionUpdatedAt: 0,
|
|
80
88
|
isLoggingIn: false,
|
|
81
89
|
lang: {
|
|
82
90
|
locale: "en-GB",
|
|
@@ -94,6 +102,7 @@ export const initialState = {
|
|
|
94
102
|
autoSummary: false,
|
|
95
103
|
autoTranslation: false,
|
|
96
104
|
SSOActivated: false,
|
|
105
|
+
GriddoIdEnabled: false,
|
|
97
106
|
SSOWelcomeText: "",
|
|
98
107
|
useForms: false,
|
|
99
108
|
},
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
+
import { global, roles, users } from "@ax/api";
|
|
2
|
+
import { appActions } from "@ax/containers/App";
|
|
3
|
+
import { handleRequest } from "@ax/helpers";
|
|
4
|
+
import type { IActivateRole, ICreatePasswordParams, IGetRoles, IRole, IRootState, IUser } from "@ax/types";
|
|
5
|
+
|
|
1
6
|
import type { Dispatch } from "redux";
|
|
7
|
+
|
|
2
8
|
import {
|
|
3
|
-
SET_USERS,
|
|
4
|
-
SET_USER_FORM,
|
|
5
|
-
SET_CURRENT_USER,
|
|
6
|
-
SET_ROLES,
|
|
7
9
|
SET_CURRENT_PERMISSIONS,
|
|
10
|
+
SET_CURRENT_USER,
|
|
8
11
|
SET_GLOBAL_PERMISSIONS,
|
|
12
|
+
SET_ROLES,
|
|
13
|
+
SET_USER_FORM,
|
|
14
|
+
SET_USERS,
|
|
9
15
|
} from "./constants";
|
|
10
|
-
|
|
11
16
|
import type {
|
|
12
|
-
ISetUsers,
|
|
13
|
-
ISetCurrentUser,
|
|
14
|
-
ISetUserForm,
|
|
15
|
-
ISetRoles,
|
|
16
17
|
ISetCurrentPermissions,
|
|
18
|
+
ISetCurrentUser,
|
|
17
19
|
ISetGlobalPermissions,
|
|
20
|
+
ISetRoles,
|
|
21
|
+
ISetUserForm,
|
|
22
|
+
ISetUsers,
|
|
18
23
|
} from "./interfaces";
|
|
19
|
-
import type { ICreatePasswordParams, IActivateRole, IGetRoles, IRole, IUser, IRootState } from "@ax/types";
|
|
20
|
-
import { global, users, roles } from "@ax/api";
|
|
21
|
-
import { appActions } from "@ax/containers/App";
|
|
22
|
-
import { handleRequest, isReqOk } from "@ax/helpers";
|
|
23
24
|
|
|
24
25
|
function setUsers(users: IUser[]): ISetUsers {
|
|
25
26
|
return { type: SET_USERS, payload: { users } };
|
|
@@ -138,7 +139,10 @@ function updatePassword(id: number | null, data: any): (dispatch: Dispatch) => P
|
|
|
138
139
|
const callback = async () => users.updatePassword(id, data);
|
|
139
140
|
|
|
140
141
|
const responseActions = {
|
|
141
|
-
handleSuccess: (response: any) =>
|
|
142
|
+
handleSuccess: (response: any) => {
|
|
143
|
+
// Cambiar la propia contraseña revoca todas las sesiones: la API devuelve el par nuevo.
|
|
144
|
+
if (response?.token) appActions.applySession(response.token, response.refreshToken)(dispatch);
|
|
145
|
+
},
|
|
142
146
|
handleError: (response: any) => appActions.handleError(response)(dispatch),
|
|
143
147
|
};
|
|
144
148
|
|
|
@@ -178,7 +182,7 @@ function createPassword(
|
|
|
178
182
|
|
|
179
183
|
const responseActions = {
|
|
180
184
|
handleSuccess: async (response: any) => {
|
|
181
|
-
|
|
185
|
+
appActions.applySession(response.token, response.refreshToken)(dispatch);
|
|
182
186
|
await getRoles({ siteId: "global" }, response.token, false)(dispatch);
|
|
183
187
|
await getUser(id, response.token, false)(dispatch, getState);
|
|
184
188
|
},
|
|
@@ -357,18 +361,18 @@ function getUserCurrentPermissions(
|
|
|
357
361
|
}
|
|
358
362
|
|
|
359
363
|
export {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
updatePassword,
|
|
363
|
-
getUser,
|
|
364
|
-
setUserForm,
|
|
364
|
+
activateRoles,
|
|
365
|
+
createPassword,
|
|
365
366
|
createUser,
|
|
366
|
-
setCurrentUser,
|
|
367
367
|
deleteUser,
|
|
368
|
-
resendInvitation,
|
|
369
368
|
getRoles,
|
|
370
|
-
|
|
371
|
-
createPassword,
|
|
369
|
+
getUser,
|
|
372
370
|
getUserCurrentPermissions,
|
|
371
|
+
getUsers,
|
|
373
372
|
removeUserFromSite,
|
|
373
|
+
resendInvitation,
|
|
374
|
+
setCurrentUser,
|
|
375
|
+
setUserForm,
|
|
376
|
+
updatePassword,
|
|
377
|
+
updateUser,
|
|
374
378
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Tope del email que viaja como `login_hint`, en caracteres. Es de forma, como el de la API (254 bytes). */
|
|
2
|
+
export const MAX_LOGIN_HINT_LENGTH = 254;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* URL de arranque del login con `auth.griddo.io` (`GET /sso/start` de la API). Si el email escrito en el formulario,
|
|
6
|
+
* recortado, contiene `@` y mide como máximo {@link MAX_LOGIN_HINT_LENGTH} caracteres, lo añade como `login_hint`
|
|
7
|
+
* codificado para que la app de login lo prerrellene; en otro caso devuelve la URL sin query, como siempre.
|
|
8
|
+
*
|
|
9
|
+
* No valida la gramática del email (esa regla es de la app de login) ni cambia mayúsculas o espacios interiores. El
|
|
10
|
+
* tope evita que un pegado enorme produzca una URL que el servidor rechace (414/431) y deje sin SSO a la persona.
|
|
11
|
+
*
|
|
12
|
+
* @param apiUrl - URL base de la API (sin barra final).
|
|
13
|
+
* @param email - Texto del campo de email, tal cual lo escribió la persona.
|
|
14
|
+
* @returns `${apiUrl}/sso/start`, con `?login_hint=…` si el email es aceptable.
|
|
15
|
+
*/
|
|
16
|
+
export const buildGriddoIdStartUrl = (apiUrl: string, email: string): string => {
|
|
17
|
+
const startUrl = `${apiUrl}/sso/start`;
|
|
18
|
+
const hint = email.trim();
|
|
19
|
+
|
|
20
|
+
if (!hint.includes("@") || hint.length > MAX_LOGIN_HINT_LENGTH) return startUrl;
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
return `${startUrl}?login_hint=${encodeURIComponent(hint)}`;
|
|
24
|
+
} catch {
|
|
25
|
+
// Un sustituto suelto hace lanzar `URIError`: sin hint, pero el clic nunca se rompe.
|
|
26
|
+
return startUrl;
|
|
27
|
+
}
|
|
28
|
+
};
|
package/src/helpers/index.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { arrayInsert, isEmptyArray, moveArrayElement } from "./arrays";
|
|
2
|
-
import { buildCategoryColumns } from "./categoryColumns";
|
|
3
2
|
import {
|
|
4
3
|
areAllComponentsEmpty,
|
|
5
4
|
areEqual,
|
|
@@ -25,9 +24,9 @@ import {
|
|
|
25
24
|
stringToDate,
|
|
26
25
|
} from "./dates";
|
|
27
26
|
import { isDevelopment } from "./environment";
|
|
28
|
-
import { getFieldByPath } from "./fields";
|
|
29
27
|
import { getFileIcon, getNewBreadcrumb, updatePropertyById } from "./files";
|
|
30
28
|
import { protectFormKeys } from "./forms";
|
|
29
|
+
import { buildGriddoIdStartUrl, MAX_LOGIN_HINT_LENGTH } from "./griddoId";
|
|
31
30
|
import { compressImage, imageResizeCropAndCompress } from "./imageResize";
|
|
32
31
|
import { formatBytes, getCroppedImg, getImageFromHtml, getImageFromIFrame, imageToBase64 } from "./images";
|
|
33
32
|
import {
|
|
@@ -118,11 +117,12 @@ export {
|
|
|
118
117
|
areEqualDates,
|
|
119
118
|
areEquals,
|
|
120
119
|
arrayInsert,
|
|
121
|
-
|
|
120
|
+
buildGriddoIdStartUrl,
|
|
122
121
|
camelize,
|
|
123
122
|
capitalize,
|
|
124
123
|
compressImage,
|
|
125
124
|
copyTextToClipboard,
|
|
125
|
+
DEV_NOW,
|
|
126
126
|
dateToString,
|
|
127
127
|
decodeEntities,
|
|
128
128
|
deepClone,
|
|
@@ -150,7 +150,6 @@ export {
|
|
|
150
150
|
getDefaultTemplate,
|
|
151
151
|
getDefaultTheme,
|
|
152
152
|
getDisplayName,
|
|
153
|
-
getFieldByPath,
|
|
154
153
|
getFileExtension,
|
|
155
154
|
getFileIcon,
|
|
156
155
|
getFormattedDateWithTimezone,
|
|
@@ -177,7 +176,6 @@ export {
|
|
|
177
176
|
getSchemaFormCategories,
|
|
178
177
|
getSchemaThumbnails,
|
|
179
178
|
getSchemaType,
|
|
180
|
-
DEV_NOW,
|
|
181
179
|
getShareTokenInfo,
|
|
182
180
|
getSlugFromUrl,
|
|
183
181
|
getStringifyDateRange,
|
|
@@ -208,6 +206,7 @@ export {
|
|
|
208
206
|
isTemplateExcludedFromTheme,
|
|
209
207
|
isValidDate,
|
|
210
208
|
isValidDateRange,
|
|
209
|
+
MAX_LOGIN_HINT_LENGTH,
|
|
211
210
|
moveArrayElement,
|
|
212
211
|
parseTheme,
|
|
213
212
|
protectFormKeys,
|
package/src/locales/en-US.ts
CHANGED
|
@@ -28,6 +28,13 @@ export const enUS = {
|
|
|
28
28
|
activating: "activating",
|
|
29
29
|
typeSomething: "Type something",
|
|
30
30
|
},
|
|
31
|
+
login: {
|
|
32
|
+
griddoIdButton: "Sign in with Griddo",
|
|
33
|
+
griddoIdText: "To start using Griddo, sign in with your Griddo account.",
|
|
34
|
+
or: "or",
|
|
35
|
+
deniedTitle: "You don't have access to this instance",
|
|
36
|
+
switchAccount: "Sign in with another account",
|
|
37
|
+
},
|
|
31
38
|
fields: {
|
|
32
39
|
tags: {
|
|
33
40
|
helptext: "Type a tag and press enter to create it",
|
package/src/locales/es-ES.ts
CHANGED
|
@@ -28,6 +28,13 @@ export const esES = {
|
|
|
28
28
|
activating: "activando",
|
|
29
29
|
typeSomething: "Escribe algo",
|
|
30
30
|
},
|
|
31
|
+
login: {
|
|
32
|
+
griddoIdButton: "Entrar con Griddo",
|
|
33
|
+
griddoIdText: "Para empezar a usar Griddo, entra con tu cuenta de Griddo.",
|
|
34
|
+
or: "o",
|
|
35
|
+
deniedTitle: "No tienes acceso a esta instancia",
|
|
36
|
+
switchAccount: "Entrar con otra cuenta",
|
|
37
|
+
},
|
|
31
38
|
fields: {
|
|
32
39
|
tags: {
|
|
33
40
|
helptext: "Escribe una etiqueta y pulsa enter para crearla",
|
package/src/locales/index.ts
CHANGED
|
@@ -34,4 +34,14 @@ export function toTitleCase(text: string) {
|
|
|
34
34
|
.join(" ");
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Textos del login según el idioma del navegador (`es*` → español, `en*` → inglés; cualquier otro, o ninguno,
|
|
39
|
+
* español). El resto de AX sigue con `LOCALE` fijo: el login no tiene sesión ni idioma de usuario aún.
|
|
40
|
+
*/
|
|
41
|
+
export function getLoginLocale(language: string | undefined = navigator.language) {
|
|
42
|
+
const prefix = language?.slice(0, 2).toLowerCase();
|
|
43
|
+
|
|
44
|
+
return (prefix === "en" ? allLocales["en-US"] : allLocales["es-ES"]).login;
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
export const LOCALE = allLocales[currentLocale as keyof typeof allLocales];
|
|
@@ -19,7 +19,7 @@ const NavMenu = (props: IProps) => {
|
|
|
19
19
|
const {
|
|
20
20
|
location,
|
|
21
21
|
setHistoryPush,
|
|
22
|
-
|
|
22
|
+
logoutAndEndCentralSession,
|
|
23
23
|
currentSiteInfo,
|
|
24
24
|
siteLanguages,
|
|
25
25
|
lang,
|
|
@@ -113,7 +113,7 @@ const NavMenu = (props: IProps) => {
|
|
|
113
113
|
name: "Logout",
|
|
114
114
|
icon: "Power",
|
|
115
115
|
path: "",
|
|
116
|
-
onClick:
|
|
116
|
+
onClick: logoutAndEndCentralSession,
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
const profileRoute = {
|
|
@@ -219,7 +219,7 @@ const NavMenu = (props: IProps) => {
|
|
|
219
219
|
};
|
|
220
220
|
|
|
221
221
|
interface IDispatchProps {
|
|
222
|
-
|
|
222
|
+
logoutAndEndCentralSession(): void;
|
|
223
223
|
setHistoryPush(path: string): void;
|
|
224
224
|
}
|
|
225
225
|
|
|
@@ -258,7 +258,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
258
258
|
type IProps = INavMenuProps & IDispatchProps & RouteComponentProps;
|
|
259
259
|
|
|
260
260
|
const mapDispatchToProps = {
|
|
261
|
-
|
|
261
|
+
logoutAndEndCentralSession: appActions.logoutAndEndCentralSession,
|
|
262
262
|
setHistoryPush: appActions.setHistoryPush,
|
|
263
263
|
};
|
|
264
264
|
|
|
@@ -2,6 +2,7 @@ import { type MouseEvent as ReactMouseEvent, useState } from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
buildCategoryColumns,
|
|
5
6
|
CheckField,
|
|
6
7
|
ContextMenu,
|
|
7
8
|
Flag,
|
|
@@ -15,13 +16,7 @@ import {
|
|
|
15
16
|
import { appActions } from "@ax/containers/App";
|
|
16
17
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
17
18
|
import { pageStatus } from "@ax/containers/PageEditor/interfaces";
|
|
18
|
-
import {
|
|
19
|
-
buildCategoryColumns,
|
|
20
|
-
getHumanLastModifiedDate,
|
|
21
|
-
getScheduleFormatDate,
|
|
22
|
-
getTemplateDisplayName,
|
|
23
|
-
slugify,
|
|
24
|
-
} from "@ax/helpers";
|
|
19
|
+
import { getHumanLastModifiedDate, getScheduleFormatDate, getTemplateDisplayName, slugify } from "@ax/helpers";
|
|
25
20
|
import { useContextMenu, useModals, usePermissionsForPage } from "@ax/hooks";
|
|
26
21
|
import type {
|
|
27
22
|
ICheck,
|
|
@@ -460,7 +455,10 @@ const PageItem = (props: IPageItemProps): JSX.Element => {
|
|
|
460
455
|
|
|
461
456
|
menuOptions = page.haveDraftPage ? [...editOptions, ...menuOptions] : menuOptions;
|
|
462
457
|
|
|
463
|
-
menuOptions =
|
|
458
|
+
menuOptions =
|
|
459
|
+
page.liveStatus?.status === pageStatus.PUBLISHED
|
|
460
|
+
? [viewOption, newTabOption, ...menuOptions]
|
|
461
|
+
: [newTabOption, ...menuOptions];
|
|
464
462
|
|
|
465
463
|
const GlobalMark = () => (
|
|
466
464
|
<Tooltip content="Global Page">
|
|
@@ -2,10 +2,12 @@ import { useEffect, useState } from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
import { useParams } from "react-router-dom";
|
|
4
4
|
|
|
5
|
-
import type { IRootState } from "@ax/types";
|
|
6
|
-
import { appActions } from "@ax/containers/App";
|
|
7
5
|
import { Login } from "@ax/components";
|
|
6
|
+
import { appActions } from "@ax/containers/App";
|
|
8
7
|
import type { IGlobalSettings } from "@ax/containers/App/reducer";
|
|
8
|
+
import { buildGriddoIdStartUrl } from "@ax/helpers";
|
|
9
|
+
import type { IRootState } from "@ax/types";
|
|
10
|
+
|
|
9
11
|
import { errorText } from "./constants";
|
|
10
12
|
|
|
11
13
|
const LoginModule = (props: IProps) => {
|
|
@@ -72,6 +74,13 @@ const LoginModule = (props: IProps) => {
|
|
|
72
74
|
}
|
|
73
75
|
};
|
|
74
76
|
|
|
77
|
+
// Navegación completa a la API: arranca el flujo OIDC (state, nonce y PKCE los genera la API). Lleva el email
|
|
78
|
+
// escrito como `login_hint`; la contraseña nunca se lee.
|
|
79
|
+
const handleClickGriddoId = () =>
|
|
80
|
+
window.location.assign(
|
|
81
|
+
buildGriddoIdStartUrl(`${process.env.GRIDDO_API_URL || process.env.REACT_APP_API_ENDPOINT}`, state.email),
|
|
82
|
+
);
|
|
83
|
+
|
|
75
84
|
const _handleEmail = (email: string) => {
|
|
76
85
|
resetError();
|
|
77
86
|
setState((prev) => ({ ...prev, email }));
|
|
@@ -103,6 +112,7 @@ const LoginModule = (props: IProps) => {
|
|
|
103
112
|
isLoginSuccess={isSuccess}
|
|
104
113
|
handleLoginSuccess={handleLoginSuccess}
|
|
105
114
|
handleSSO={handleClickSSO}
|
|
115
|
+
handleGriddoId={handleClickGriddoId}
|
|
106
116
|
errorSSO={errorSSO}
|
|
107
117
|
/>
|
|
108
118
|
);
|
|
@@ -2,6 +2,7 @@ import { type MouseEvent as ReactMouseEvent, useState } from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
buildCategoryColumns,
|
|
5
6
|
CheckField,
|
|
6
7
|
ContextMenu,
|
|
7
8
|
ElementsTooltip,
|
|
@@ -15,13 +16,7 @@ import {
|
|
|
15
16
|
import { appActions } from "@ax/containers/App";
|
|
16
17
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
17
18
|
import { type ISetCurrentPageIDAction, pageStatus } from "@ax/containers/PageEditor/interfaces";
|
|
18
|
-
import {
|
|
19
|
-
buildCategoryColumns,
|
|
20
|
-
getHumanLastModifiedDate,
|
|
21
|
-
getScheduleFormatDate,
|
|
22
|
-
getStructuredDataTitle,
|
|
23
|
-
trimText,
|
|
24
|
-
} from "@ax/helpers";
|
|
19
|
+
import { getHumanLastModifiedDate, getScheduleFormatDate, getStructuredDataTitle, trimText } from "@ax/helpers";
|
|
25
20
|
import { useContextMenu, useModals, usePermissionsForPage } from "@ax/hooks";
|
|
26
21
|
import type {
|
|
27
22
|
IAvailableSites,
|
|
@@ -320,7 +315,10 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
320
315
|
|
|
321
316
|
menuOptions = globalPage.haveDraftPage ? [...editOptions, ...menuOptions] : menuOptions;
|
|
322
317
|
|
|
323
|
-
menuOptions =
|
|
318
|
+
menuOptions =
|
|
319
|
+
globalPage.liveStatus?.status === pageStatus.PUBLISHED
|
|
320
|
+
? [viewOption, newTabOption, ...menuOptions]
|
|
321
|
+
: [newTabOption, ...menuOptions];
|
|
324
322
|
|
|
325
323
|
const isTranslated = globalPage.pageLanguages.length > 1;
|
|
326
324
|
|
|
@@ -2,6 +2,7 @@ import { type MouseEvent as ReactMouseEvent, useState } from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
buildCategoryColumns,
|
|
5
6
|
CheckField,
|
|
6
7
|
ContextMenu,
|
|
7
8
|
Flag,
|
|
@@ -13,12 +14,7 @@ import {
|
|
|
13
14
|
} from "@ax/components";
|
|
14
15
|
import { appActions } from "@ax/containers/App";
|
|
15
16
|
import { structuredDataActions } from "@ax/containers/StructuredData";
|
|
16
|
-
import {
|
|
17
|
-
buildCategoryColumns,
|
|
18
|
-
getActivatedDataPacksIds,
|
|
19
|
-
getHumanLastModifiedDate,
|
|
20
|
-
getScheduleFormatDate,
|
|
21
|
-
} from "@ax/helpers";
|
|
17
|
+
import { getActivatedDataPacksIds, getHumanLastModifiedDate, getScheduleFormatDate } from "@ax/helpers";
|
|
22
18
|
import { useContextMenu, useModal, usePermissionsForPage } from "@ax/hooks";
|
|
23
19
|
import type {
|
|
24
20
|
ICheck,
|
|
@@ -220,11 +216,13 @@ const StructuredDataItem = (props: IStructuredDataItemProps): JSX.Element => {
|
|
|
220
216
|
"Not translatable"
|
|
221
217
|
);
|
|
222
218
|
|
|
223
|
-
const menuOptions = [
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
219
|
+
const menuOptions = [
|
|
220
|
+
{
|
|
221
|
+
label: "Open in new tab",
|
|
222
|
+
icon: "openOutside",
|
|
223
|
+
action: handleOpenInNewTab,
|
|
224
|
+
},
|
|
225
|
+
];
|
|
228
226
|
|
|
229
227
|
if (!isDisabled && isEditable && isAllowedTo.duplicatePages) {
|
|
230
228
|
menuOptions.push({
|
|
@@ -2,10 +2,13 @@ import CreatePass from "./../modules/CreatePass";
|
|
|
2
2
|
import Login from "./../modules/Login";
|
|
3
3
|
import PublicPreview from "./../modules/PublicPreview";
|
|
4
4
|
import ResetPass from "./../modules/ResetPass";
|
|
5
|
+
import SsoDenied from "./../modules/SsoDenied";
|
|
5
6
|
|
|
6
7
|
const publicRoutes = [
|
|
7
8
|
{ path: "/login/:petitionId", component: Login, name: "Login", hideNav: true },
|
|
8
9
|
{ path: "/login", component: Login, name: "Login", hideNav: true },
|
|
10
|
+
// Fuera de `/login/*`: `/login/:petitionId` capturaría el segmento como uuid y llamaría a `POST /login_check`.
|
|
11
|
+
{ path: "/sso-denied", component: SsoDenied, name: "SSO denied", hideNav: true },
|
|
9
12
|
{ path: "/new-password/:id/:token", component: ResetPass, name: "Reset Password", hideNav: true },
|
|
10
13
|
{ path: "/set-password/:id/:token", component: CreatePass, name: "Create Password", hideNav: true },
|
|
11
14
|
{ path: "/page-preview/:id/:entity/:token?", component: PublicPreview, name: "Preview", hideNav: true },
|