@griddo/ax 12.15.0-beta.1 → 12.15.0
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 +0 -1
- package/package.json +4 -7
- package/src/GlobalStore.tsx +25 -32
- package/src/__tests__/components/Fields/FileField/FileField.test.tsx +6 -33
- package/src/__tests__/components/FieldsBehavior/FieldsBehavior.test.tsx +3 -5
- package/src/__tests__/modules/GlobalSettings/Llms/Llms.uc.test.tsx +2861 -0
- package/src/__tests__/modules/Redirects/Redirects/Redirects.create.test.tsx +0 -19
- package/src/__tests__/modules/Redirects/Redirects/Redirects.edit.test.tsx +0 -19
- package/src/__tests__/modules/Redirects/Redirects/Redirects.filter.test.tsx +0 -19
- package/src/api/domains.tsx +98 -2
- package/src/api/global.tsx +1 -24
- package/src/api/utils.tsx +12 -22
- package/src/components/FieldsBehavior/index.tsx +1 -3
- package/src/components/Login/LoginForm/index.tsx +2 -7
- package/src/components/Login/index.tsx +1 -13
- package/src/components/index.tsx +7 -11
- package/src/containers/App/actions.tsx +5 -110
- package/src/containers/App/interfaces.tsx +2 -2
- package/src/containers/App/reducer.tsx +0 -9
- package/src/containers/Users/actions.tsx +24 -28
- package/src/{components/CategoryCell/buildCategoryColumns.tsx → helpers/categoryColumns.tsx} +2 -3
- package/src/{components/FieldsBehavior/getFieldByPath.tsx → helpers/fields.tsx} +1 -1
- package/src/helpers/index.tsx +5 -4
- package/src/locales/en-US.ts +0 -7
- package/src/locales/es-ES.ts +0 -7
- package/src/locales/index.ts +0 -10
- package/src/modules/App/Routing/NavMenu/index.tsx +4 -4
- package/src/modules/Content/PageItem/index.tsx +8 -6
- package/src/modules/GlobalSettings/Llms/AutomaticSelection/index.tsx +317 -0
- package/src/modules/GlobalSettings/Llms/DomainList/index.tsx +65 -0
- package/src/modules/GlobalSettings/Llms/IndexModelEditor/index.tsx +325 -0
- package/src/modules/GlobalSettings/Llms/MirrorExample/index.tsx +61 -0
- package/src/modules/GlobalSettings/Llms/MirrorOptions/index.tsx +82 -0
- package/src/modules/GlobalSettings/Llms/Outline/index.tsx +183 -0
- package/src/modules/GlobalSettings/Llms/PagePicker/index.tsx +105 -0
- package/src/modules/GlobalSettings/Llms/Preview/index.tsx +65 -0
- package/src/modules/GlobalSettings/Llms/ResolvedPages/index.tsx +191 -0
- package/src/modules/GlobalSettings/Llms/SectionEditor/index.tsx +262 -0
- package/src/modules/GlobalSettings/Llms/atoms.tsx +37 -0
- package/src/modules/GlobalSettings/Llms/index.tsx +383 -0
- package/src/modules/GlobalSettings/Llms/style.tsx +541 -0
- package/src/modules/GlobalSettings/Llms/utils.tsx +307 -0
- package/src/modules/GlobalSettings/index.tsx +7 -0
- package/src/modules/Login/index.tsx +2 -12
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +8 -6
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +11 -9
- package/src/routes/multisite.tsx +8 -1
- package/src/routes/publicRoutes.tsx +0 -3
- package/src/schemas/pages/GlobalPage.ts +2 -2
- package/src/schemas/pages/Page.ts +2 -2
- package/src/types/index.tsx +80 -12
- package/src/types/llms.tsx +315 -0
- package/src/__tests__/GlobalStore.session.test.tsx +0 -98
- package/src/__tests__/api/global.test.ts +0 -64
- package/src/__tests__/api/session.test.ts +0 -311
- package/src/__tests__/api/sessionRenewal.test.ts +0 -705
- package/src/__tests__/api/utils.test.ts +0 -373
- package/src/__tests__/components/Login/LoginGriddoId.test.tsx +0 -195
- package/src/__tests__/components/SsoDenied/SsoDenied.test.tsx +0 -86
- package/src/__tests__/containers/App/reducer.griddoId.test.ts +0 -18
- package/src/__tests__/containers/App/session.test.ts +0 -397
- package/src/__tests__/helpers/griddoId.test.ts +0 -56
- package/src/__tests__/locales/loginLocale.test.ts +0 -52
- package/src/__tests__/modules/App/Routing/NavMenu.test.tsx +0 -54
- package/src/__tests__/modules/Login/Login.test.tsx +0 -151
- package/src/__tests__/modules/SsoDenied/SsoDenied.test.tsx +0 -30
- package/src/__tests__/routes/publicRoutes.test.ts +0 -36
- package/src/api/session.tsx +0 -197
- package/src/api/sessionRenewal.tsx +0 -114
- package/src/components/Login/LoginGriddoId/index.tsx +0 -46
- package/src/components/Login/LoginGriddoId/style.tsx +0 -35
- package/src/components/SsoDenied/index.tsx +0 -46
- package/src/components/SsoDenied/style.tsx +0 -37
- package/src/helpers/griddoId.ts +0 -28
- package/src/modules/SsoDenied/index.tsx +0 -9
|
@@ -7,7 +7,6 @@ import type { AxiosResponse } from "axios";
|
|
|
7
7
|
import differenceInSeconds from "date-fns/differenceInSeconds";
|
|
8
8
|
import type { Dispatch } from "redux";
|
|
9
9
|
|
|
10
|
-
import { clearSession, getSession, type ISession, markSessionEnded, setSession } from "../../api/session";
|
|
11
10
|
import history from "../../routes/history";
|
|
12
11
|
import {
|
|
13
12
|
IS_LOGGING_IN,
|
|
@@ -83,116 +82,15 @@ function setToken(token: string): ISetTokenAction {
|
|
|
83
82
|
return { type: SET_TOKEN, payload: { token } };
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
function setSessionTokens(session: ISession): ISetTokenAction {
|
|
88
|
-
return {
|
|
89
|
-
type: SET_TOKEN,
|
|
90
|
-
payload: { token: session.token, refreshToken: session.refreshToken ?? "", sessionUpdatedAt: session.updatedAt },
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Guarda un par de sesión nuevo (login, SSO, creación o cambio de contraseña) en memoria y disco, y lo
|
|
96
|
-
* refleja en el store. `refreshToken` ausente = API antigua: el 401 cerrará sesión sin renovar.
|
|
97
|
-
*/
|
|
98
|
-
function applySession(token: string, refreshToken?: string | null): (dispatch: Dispatch) => void {
|
|
99
|
-
return (dispatch) => {
|
|
100
|
-
dispatch(setSessionTokens(setSession(token, refreshToken ?? null)));
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** Limpia el estado local de la sesión (almacenamiento y memoria) y devuelve la acción que vacía el store. */
|
|
105
|
-
function clearLocalSession(): ILogoutAction {
|
|
85
|
+
function logout(): ILogoutAction {
|
|
106
86
|
const listConfig = localStorage.getItem("sitesConfig") || "";
|
|
107
87
|
localStorage.clear();
|
|
108
88
|
localStorage.setItem("sitesConfig", listConfig);
|
|
109
|
-
|
|
110
|
-
return { type: LOGOUT, payload: { token: "", refreshToken: "", sessionUpdatedAt: 0 } };
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Limpia la sesión local y avisa a la API en segundo plano (revoca la familia de refresh). El cierre local
|
|
115
|
-
* no espera ni depende de la respuesta; un 401 del logout no dispara renovación ni otro cierre.
|
|
116
|
-
*/
|
|
117
|
-
function logout(): ILogoutAction {
|
|
118
|
-
const session = getSession();
|
|
119
|
-
if (session) {
|
|
120
|
-
Promise.resolve(global.logout({ token: session.token, refreshToken: session.refreshToken })).catch(() => undefined);
|
|
121
|
-
}
|
|
122
|
-
return clearLocalSession();
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** Espera máxima de `POST /logout` en el cierre manual: más allá, AX cierra solo en local. */
|
|
126
|
-
const END_SESSION_TIMEOUT_MS = 5000;
|
|
127
|
-
|
|
128
|
-
/** `endSessionUrl` de la respuesta de `POST /logout` si es una URL http(s); `null` si no hay o no vale. */
|
|
129
|
-
function readEndSessionUrl(
|
|
130
|
-
response: { status?: number; data?: { endSessionUrl?: unknown } } | undefined,
|
|
131
|
-
): string | null {
|
|
132
|
-
const url = response?.status === 200 ? response.data?.endSessionUrl : undefined;
|
|
133
|
-
|
|
134
|
-
if (typeof url !== "string" || !URL.canParse(url)) return null;
|
|
135
|
-
|
|
136
|
-
return ["https:", "http:"].includes(new URL(url).protocol) ? url : null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* «Logout» del menú. Avisa a la API esperando la respuesta (máximo 5 s) para saber si la sesión nació de
|
|
141
|
-
* `auth.griddo.io`: en ese caso limpia lo local y navega a la URL de cierre de la sesión central (la persona acaba en
|
|
142
|
-
* «Sesión cerrada» de auth.griddo.io; Hydra avisa a las demás instancias). En cualquier otro caso (sesión con
|
|
143
|
-
* contraseña, error, timeout, URL no válida) se comporta como `logoutAndNavigate`. Solo con `GriddoIdEnabled`: sin él
|
|
144
|
-
* (SSO de Comillas o contraseña) es exactamente `logoutAndNavigate`. La expiración por 401 y el logout por broadcast
|
|
145
|
-
* siguen siendo solo locales.
|
|
146
|
-
*/
|
|
147
|
-
function logoutAndEndCentralSession(): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
148
|
-
return async (dispatch, getState) => {
|
|
149
|
-
// Sin Griddo ID (SSO de Comillas o contraseña) el logout es el de siempre: local, sin esperar a la API.
|
|
150
|
-
if (!getState().app.globalSettings.GriddoIdEnabled) {
|
|
151
|
-
await logoutAndNavigate()(dispatch);
|
|
152
|
-
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
markSessionEnded();
|
|
157
|
-
|
|
158
|
-
const session = getSession();
|
|
159
|
-
let endSessionUrl: string | null = null;
|
|
160
|
-
|
|
161
|
-
if (session) {
|
|
162
|
-
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
163
|
-
|
|
164
|
-
try {
|
|
165
|
-
const response = await Promise.race([
|
|
166
|
-
Promise.resolve(global.logout({ token: session.token, refreshToken: session.refreshToken })),
|
|
167
|
-
new Promise<undefined>((resolve) => {
|
|
168
|
-
timer = setTimeout(() => resolve(undefined), END_SESSION_TIMEOUT_MS);
|
|
169
|
-
}),
|
|
170
|
-
]);
|
|
171
|
-
|
|
172
|
-
endSessionUrl = readEndSessionUrl(response as Parameters<typeof readEndSessionUrl>[0]);
|
|
173
|
-
} catch {
|
|
174
|
-
endSessionUrl = null;
|
|
175
|
-
} finally {
|
|
176
|
-
clearTimeout(timer);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
dispatch(clearLocalSession());
|
|
181
|
-
|
|
182
|
-
if (endSessionUrl) {
|
|
183
|
-
window.location.assign(endSessionUrl);
|
|
184
|
-
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
await setHistoryPush("/logout")(dispatch);
|
|
189
|
-
};
|
|
89
|
+
return { type: LOGOUT, payload: { token: "" } };
|
|
190
90
|
}
|
|
191
91
|
|
|
192
92
|
function logoutAndNavigate(): (dispatch: Dispatch) => Promise<void> {
|
|
193
93
|
return async (dispatch) => {
|
|
194
|
-
// Cierre manual, por 401 o recibido por broadcast: un 401 en vuelo no debe despachar otro.
|
|
195
|
-
markSessionEnded();
|
|
196
94
|
await setHistoryPush("/logout")(dispatch);
|
|
197
95
|
};
|
|
198
96
|
}
|
|
@@ -270,7 +168,7 @@ function login(loginData: {
|
|
|
270
168
|
return async (dispatch, setState) => {
|
|
271
169
|
dispatch(setIsLogging(true));
|
|
272
170
|
const { email, password, rememberMe, petitionId } = loginData;
|
|
273
|
-
const loginResponse: AxiosResponse<{ id: number; token: string
|
|
171
|
+
const loginResponse: AxiosResponse<{ id: number; token: string }> = await global.login({
|
|
274
172
|
username: email,
|
|
275
173
|
password,
|
|
276
174
|
petitionId,
|
|
@@ -279,11 +177,11 @@ function login(loginData: {
|
|
|
279
177
|
switch (loginResponse?.status) {
|
|
280
178
|
case 200: {
|
|
281
179
|
const {
|
|
282
|
-
data: { id, token
|
|
180
|
+
data: { id, token },
|
|
283
181
|
} = loginResponse;
|
|
284
182
|
const langResponse = await languages.getLanguages(token);
|
|
285
183
|
isReqOk(langResponse.status) && dispatch(setGlobalLanguages(langResponse.data.items));
|
|
286
|
-
|
|
184
|
+
dispatch(setToken(loginResponse.data.token));
|
|
287
185
|
await usersActions.getUser(id, token, false)(dispatch, setState);
|
|
288
186
|
dispatch(setSessionStartedAt(new Date()));
|
|
289
187
|
dispatch(setHasAnimation(true));
|
|
@@ -369,14 +267,12 @@ function checkUserSession(): (dispatch: Dispatch, getState: () => IRootState) =>
|
|
|
369
267
|
}
|
|
370
268
|
|
|
371
269
|
export {
|
|
372
|
-
applySession,
|
|
373
270
|
checkUserSession,
|
|
374
271
|
getGlobalSettings,
|
|
375
272
|
handleError,
|
|
376
273
|
login,
|
|
377
274
|
loginSSO,
|
|
378
275
|
logout,
|
|
379
|
-
logoutAndEndCentralSession,
|
|
380
276
|
logoutAndNavigate,
|
|
381
277
|
resetError,
|
|
382
278
|
setError,
|
|
@@ -388,7 +284,6 @@ export {
|
|
|
388
284
|
setIsLogging,
|
|
389
285
|
setIsSaving,
|
|
390
286
|
setLanguage,
|
|
391
|
-
setSessionTokens,
|
|
392
287
|
setToken,
|
|
393
288
|
setUser,
|
|
394
289
|
};
|
|
@@ -17,12 +17,12 @@ import type { IUser } from "./reducer";
|
|
|
17
17
|
|
|
18
18
|
export interface ISetTokenAction {
|
|
19
19
|
type: typeof SET_TOKEN;
|
|
20
|
-
payload: { token: string
|
|
20
|
+
payload: { token: string };
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface ILogoutAction {
|
|
24
24
|
type: typeof LOGOUT;
|
|
25
|
-
payload: { token: string
|
|
25
|
+
payload: { token: string };
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export interface IIsLoggingInAction {
|
|
@@ -26,10 +26,6 @@ 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;
|
|
33
29
|
isLoggingIn: boolean;
|
|
34
30
|
lang: { locale: string; id: number };
|
|
35
31
|
globalLangs: ILanguage[];
|
|
@@ -64,8 +60,6 @@ export interface IGlobalSettings {
|
|
|
64
60
|
autoSummary: boolean;
|
|
65
61
|
autoTranslation: boolean;
|
|
66
62
|
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;
|
|
69
63
|
SSOWelcomeText: string;
|
|
70
64
|
useForms: boolean;
|
|
71
65
|
}
|
|
@@ -83,8 +77,6 @@ export const initialState = {
|
|
|
83
77
|
email: "",
|
|
84
78
|
},
|
|
85
79
|
token: "",
|
|
86
|
-
refreshToken: "",
|
|
87
|
-
sessionUpdatedAt: 0,
|
|
88
80
|
isLoggingIn: false,
|
|
89
81
|
lang: {
|
|
90
82
|
locale: "en-GB",
|
|
@@ -102,7 +94,6 @@ export const initialState = {
|
|
|
102
94
|
autoSummary: false,
|
|
103
95
|
autoTranslation: false,
|
|
104
96
|
SSOActivated: false,
|
|
105
|
-
GriddoIdEnabled: false,
|
|
106
97
|
SSOWelcomeText: "",
|
|
107
98
|
useForms: false,
|
|
108
99
|
},
|
|
@@ -1,26 +1,25 @@
|
|
|
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
|
-
|
|
6
1
|
import type { Dispatch } from "redux";
|
|
7
|
-
|
|
8
2
|
import {
|
|
9
|
-
|
|
3
|
+
SET_USERS,
|
|
4
|
+
SET_USER_FORM,
|
|
10
5
|
SET_CURRENT_USER,
|
|
11
|
-
SET_GLOBAL_PERMISSIONS,
|
|
12
6
|
SET_ROLES,
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
SET_CURRENT_PERMISSIONS,
|
|
8
|
+
SET_GLOBAL_PERMISSIONS,
|
|
15
9
|
} from "./constants";
|
|
10
|
+
|
|
16
11
|
import type {
|
|
17
|
-
|
|
12
|
+
ISetUsers,
|
|
18
13
|
ISetCurrentUser,
|
|
19
|
-
ISetGlobalPermissions,
|
|
20
|
-
ISetRoles,
|
|
21
14
|
ISetUserForm,
|
|
22
|
-
|
|
15
|
+
ISetRoles,
|
|
16
|
+
ISetCurrentPermissions,
|
|
17
|
+
ISetGlobalPermissions,
|
|
23
18
|
} 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";
|
|
24
23
|
|
|
25
24
|
function setUsers(users: IUser[]): ISetUsers {
|
|
26
25
|
return { type: SET_USERS, payload: { users } };
|
|
@@ -139,10 +138,7 @@ function updatePassword(id: number | null, data: any): (dispatch: Dispatch) => P
|
|
|
139
138
|
const callback = async () => users.updatePassword(id, data);
|
|
140
139
|
|
|
141
140
|
const responseActions = {
|
|
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
|
-
},
|
|
141
|
+
handleSuccess: (response: any) => isReqOk(response.status),
|
|
146
142
|
handleError: (response: any) => appActions.handleError(response)(dispatch),
|
|
147
143
|
};
|
|
148
144
|
|
|
@@ -182,7 +178,7 @@ function createPassword(
|
|
|
182
178
|
|
|
183
179
|
const responseActions = {
|
|
184
180
|
handleSuccess: async (response: any) => {
|
|
185
|
-
appActions.
|
|
181
|
+
dispatch(appActions.setToken(response.token));
|
|
186
182
|
await getRoles({ siteId: "global" }, response.token, false)(dispatch);
|
|
187
183
|
await getUser(id, response.token, false)(dispatch, getState);
|
|
188
184
|
},
|
|
@@ -361,18 +357,18 @@ function getUserCurrentPermissions(
|
|
|
361
357
|
}
|
|
362
358
|
|
|
363
359
|
export {
|
|
364
|
-
|
|
365
|
-
|
|
360
|
+
getUsers,
|
|
361
|
+
updateUser,
|
|
362
|
+
updatePassword,
|
|
363
|
+
getUser,
|
|
364
|
+
setUserForm,
|
|
366
365
|
createUser,
|
|
366
|
+
setCurrentUser,
|
|
367
367
|
deleteUser,
|
|
368
|
+
resendInvitation,
|
|
368
369
|
getRoles,
|
|
369
|
-
|
|
370
|
+
activateRoles,
|
|
371
|
+
createPassword,
|
|
370
372
|
getUserCurrentPermissions,
|
|
371
|
-
getUsers,
|
|
372
373
|
removeUserFromSite,
|
|
373
|
-
resendInvitation,
|
|
374
|
-
setCurrentUser,
|
|
375
|
-
setUserForm,
|
|
376
|
-
updatePassword,
|
|
377
|
-
updateUser,
|
|
378
374
|
};
|
package/src/{components/CategoryCell/buildCategoryColumns.tsx → helpers/categoryColumns.tsx}
RENAMED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
+
import { CategoryCell } from "@ax/components";
|
|
4
|
+
import { Cell } from "@ax/components/TableList/TableItem/style";
|
|
3
5
|
import type { ISchemaField } from "@ax/types";
|
|
4
6
|
|
|
5
7
|
import styled from "styled-components";
|
|
6
8
|
|
|
7
|
-
import { Cell } from "../TableList/TableItem/style";
|
|
8
|
-
import CategoryCell from "./index";
|
|
9
|
-
|
|
10
9
|
const ColumnCell = styled(Cell)`
|
|
11
10
|
flex: 0 0 215px;
|
|
12
11
|
position: relative;
|
package/src/helpers/index.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { arrayInsert, isEmptyArray, moveArrayElement } from "./arrays";
|
|
2
|
+
import { buildCategoryColumns } from "./categoryColumns";
|
|
2
3
|
import {
|
|
3
4
|
areAllComponentsEmpty,
|
|
4
5
|
areEqual,
|
|
@@ -24,9 +25,9 @@ import {
|
|
|
24
25
|
stringToDate,
|
|
25
26
|
} from "./dates";
|
|
26
27
|
import { isDevelopment } from "./environment";
|
|
28
|
+
import { getFieldByPath } from "./fields";
|
|
27
29
|
import { getFileIcon, getNewBreadcrumb, updatePropertyById } from "./files";
|
|
28
30
|
import { protectFormKeys } from "./forms";
|
|
29
|
-
import { buildGriddoIdStartUrl, MAX_LOGIN_HINT_LENGTH } from "./griddoId";
|
|
30
31
|
import { compressImage, imageResizeCropAndCompress } from "./imageResize";
|
|
31
32
|
import { formatBytes, getCroppedImg, getImageFromHtml, getImageFromIFrame, imageToBase64 } from "./images";
|
|
32
33
|
import {
|
|
@@ -117,12 +118,11 @@ export {
|
|
|
117
118
|
areEqualDates,
|
|
118
119
|
areEquals,
|
|
119
120
|
arrayInsert,
|
|
120
|
-
|
|
121
|
+
buildCategoryColumns,
|
|
121
122
|
camelize,
|
|
122
123
|
capitalize,
|
|
123
124
|
compressImage,
|
|
124
125
|
copyTextToClipboard,
|
|
125
|
-
DEV_NOW,
|
|
126
126
|
dateToString,
|
|
127
127
|
decodeEntities,
|
|
128
128
|
deepClone,
|
|
@@ -150,6 +150,7 @@ export {
|
|
|
150
150
|
getDefaultTemplate,
|
|
151
151
|
getDefaultTheme,
|
|
152
152
|
getDisplayName,
|
|
153
|
+
getFieldByPath,
|
|
153
154
|
getFileExtension,
|
|
154
155
|
getFileIcon,
|
|
155
156
|
getFormattedDateWithTimezone,
|
|
@@ -176,6 +177,7 @@ export {
|
|
|
176
177
|
getSchemaFormCategories,
|
|
177
178
|
getSchemaThumbnails,
|
|
178
179
|
getSchemaType,
|
|
180
|
+
DEV_NOW,
|
|
179
181
|
getShareTokenInfo,
|
|
180
182
|
getSlugFromUrl,
|
|
181
183
|
getStringifyDateRange,
|
|
@@ -206,7 +208,6 @@ export {
|
|
|
206
208
|
isTemplateExcludedFromTheme,
|
|
207
209
|
isValidDate,
|
|
208
210
|
isValidDateRange,
|
|
209
|
-
MAX_LOGIN_HINT_LENGTH,
|
|
210
211
|
moveArrayElement,
|
|
211
212
|
parseTheme,
|
|
212
213
|
protectFormKeys,
|
package/src/locales/en-US.ts
CHANGED
|
@@ -28,13 +28,6 @@ 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
|
-
},
|
|
38
31
|
fields: {
|
|
39
32
|
tags: {
|
|
40
33
|
helptext: "Type a tag and press enter to create it",
|
package/src/locales/es-ES.ts
CHANGED
|
@@ -28,13 +28,6 @@ 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
|
-
},
|
|
38
31
|
fields: {
|
|
39
32
|
tags: {
|
|
40
33
|
helptext: "Escribe una etiqueta y pulsa enter para crearla",
|
package/src/locales/index.ts
CHANGED
|
@@ -34,14 +34,4 @@ 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
|
-
|
|
47
37
|
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
|
+
logoutAndNavigate,
|
|
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: logoutAndNavigate,
|
|
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
|
+
logoutAndNavigate(): 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
|
+
logoutAndNavigate: appActions.logoutAndNavigate,
|
|
262
262
|
setHistoryPush: appActions.setHistoryPush,
|
|
263
263
|
};
|
|
264
264
|
|
|
@@ -2,7 +2,6 @@ import { type MouseEvent as ReactMouseEvent, useState } from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
buildCategoryColumns,
|
|
6
5
|
CheckField,
|
|
7
6
|
ContextMenu,
|
|
8
7
|
Flag,
|
|
@@ -16,7 +15,13 @@ import {
|
|
|
16
15
|
import { appActions } from "@ax/containers/App";
|
|
17
16
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
18
17
|
import { pageStatus } from "@ax/containers/PageEditor/interfaces";
|
|
19
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
buildCategoryColumns,
|
|
20
|
+
getHumanLastModifiedDate,
|
|
21
|
+
getScheduleFormatDate,
|
|
22
|
+
getTemplateDisplayName,
|
|
23
|
+
slugify,
|
|
24
|
+
} from "@ax/helpers";
|
|
20
25
|
import { useContextMenu, useModals, usePermissionsForPage } from "@ax/hooks";
|
|
21
26
|
import type {
|
|
22
27
|
ICheck,
|
|
@@ -455,10 +460,7 @@ const PageItem = (props: IPageItemProps): JSX.Element => {
|
|
|
455
460
|
|
|
456
461
|
menuOptions = page.haveDraftPage ? [...editOptions, ...menuOptions] : menuOptions;
|
|
457
462
|
|
|
458
|
-
menuOptions =
|
|
459
|
-
page.liveStatus?.status === pageStatus.PUBLISHED
|
|
460
|
-
? [viewOption, newTabOption, ...menuOptions]
|
|
461
|
-
: [newTabOption, ...menuOptions];
|
|
463
|
+
menuOptions = page.liveStatus?.status === pageStatus.PUBLISHED ? [viewOption, newTabOption, ...menuOptions] : [newTabOption, ...menuOptions];
|
|
462
464
|
|
|
463
465
|
const GlobalMark = () => (
|
|
464
466
|
<Tooltip content="Global Page">
|