@bigbinary/neeto-redirect-urls-frontend 2.2.8 → 2.2.10
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/app/javascript/src/translations/de.json +54 -0
- package/app/javascript/src/translations/en.json +3 -2
- package/app/javascript/src/translations/es.json +54 -0
- package/app/javascript/src/translations/fr.json +54 -0
- package/dist/RedirectUrls.js +160 -134
- package/dist/RedirectUrls.js.map +1 -1
- package/dist/cjs/RedirectUrls.js +161 -135
- package/dist/cjs/RedirectUrls.js.map +1 -1
- package/dist/cjs/index.js +4 -4
- package/dist/index.js +4 -4
- package/package.json +12 -12
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"neetoRedirectUrls": {
|
|
3
|
+
"titles": {
|
|
4
|
+
"dashboard": "Dashboard"
|
|
5
|
+
},
|
|
6
|
+
"common": {
|
|
7
|
+
"delete": "Löschen",
|
|
8
|
+
"edit": "Bearbeiten",
|
|
9
|
+
"placeholder": {
|
|
10
|
+
"relativeUrl": "/articles/welcome",
|
|
11
|
+
"url": "https://example.com"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"settings": {
|
|
15
|
+
"title": "Admin-Panel",
|
|
16
|
+
"redirecturl": {
|
|
17
|
+
"title": "Weiterleitungs-URLs",
|
|
18
|
+
"description": "Weiterleitungs-URLs anzeigen und verwalten"
|
|
19
|
+
},
|
|
20
|
+
"general": {
|
|
21
|
+
"title": "Allgemein"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"emptyState": {
|
|
25
|
+
"redirectURLs": {
|
|
26
|
+
"title": "Es gibt keine Weiterleitungs-URLs anzuzeigen.",
|
|
27
|
+
"description": "Hier ist, wie Sie <helpLink>Weiterleitungs-URLs</helpLink> erstellen können."
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"alerts": {
|
|
31
|
+
"delete": {
|
|
32
|
+
"title": "Weiterleitungs-URL löschen?",
|
|
33
|
+
"confirm": "Sie löschen die Weiterleitung von <strong>{{ from_path }}</strong> zu <strong>{{ to_path }}</strong> dauerhaft. Dies kann nicht rückgängig gemacht werden."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"redirect": {
|
|
37
|
+
"source": "Quelle",
|
|
38
|
+
"destination": "Ziel",
|
|
39
|
+
"add": "Neue Weiterleitungs-URL hinzufügen",
|
|
40
|
+
"edit": "Weiterleitungs-URL bearbeiten",
|
|
41
|
+
"search": "Weiterleitungs-URL suchen",
|
|
42
|
+
"domainLevelRedirect": {
|
|
43
|
+
"label": "Domainebene-Weiterleitung hinzufügen",
|
|
44
|
+
"description": "Dieses Feature ermöglicht es Ihnen, alle Ihre {{entity}} URLs von {{app, anyCase}} auf eine neue Domain umzuleiten. <Link>Hilfeartikel anzeigen</Link> für weitere Informationen."
|
|
45
|
+
},
|
|
46
|
+
"validations": {
|
|
47
|
+
"source": "Der Quellpfad muss gültig sein",
|
|
48
|
+
"destination": "Die Ziel-URL muss gültig sein",
|
|
49
|
+
"required": "{{entity}} ist erforderlich",
|
|
50
|
+
"duplicateDomain": "Die gleiche Domain kann nicht für die Weiterleitung verwendet werden"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"settings": {
|
|
15
|
-
"title": "
|
|
15
|
+
"title": "Admin panel",
|
|
16
16
|
"redirecturl": {
|
|
17
17
|
"title": "Redirect URLs",
|
|
18
18
|
"description": "View and manage redirect URLs"
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"source": "Source path must be valid",
|
|
48
48
|
"destination": "Destination url must be valid",
|
|
49
49
|
"required": "{{entity}} is required",
|
|
50
|
-
"duplicateDomain": "Cannot use same domain for redirection"
|
|
50
|
+
"duplicateDomain": "Cannot use same domain for redirection",
|
|
51
|
+
"samePaths": "Source and destination paths cannot be the same"
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"neetoRedirectUrls": {
|
|
3
|
+
"titles": {
|
|
4
|
+
"dashboard": "Tablero"
|
|
5
|
+
},
|
|
6
|
+
"common": {
|
|
7
|
+
"delete": "Eliminar",
|
|
8
|
+
"edit": "Editar",
|
|
9
|
+
"placeholder": {
|
|
10
|
+
"relativeUrl": "/articles/welcome",
|
|
11
|
+
"url": "https://example.com"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"settings": {
|
|
15
|
+
"title": "Panel de administración",
|
|
16
|
+
"redirecturl": {
|
|
17
|
+
"title": "URLs de redirección",
|
|
18
|
+
"description": "Ver y gestionar URLs de redirección"
|
|
19
|
+
},
|
|
20
|
+
"general": {
|
|
21
|
+
"title": "General"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"emptyState": {
|
|
25
|
+
"redirectURLs": {
|
|
26
|
+
"title": "No hay URLs de redirección para mostrar.",
|
|
27
|
+
"description": "Así es como puedes crear <helpLink>URLs de redirección</helpLink>."
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"alerts": {
|
|
31
|
+
"delete": {
|
|
32
|
+
"title": "¿Eliminar URL de redirección?",
|
|
33
|
+
"confirm": "Estás eliminando permanentemente la redirección de <strong>{{ from_path }}</strong> a <strong>{{ to_path }}</strong>. Esto no se puede deshacer."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"redirect": {
|
|
37
|
+
"source": "Fuente",
|
|
38
|
+
"destination": "Destino",
|
|
39
|
+
"add": "Agregar nueva URL de redirección",
|
|
40
|
+
"edit": "Editar URL de redirección",
|
|
41
|
+
"search": "Buscar URL de redirección",
|
|
42
|
+
"domainLevelRedirect": {
|
|
43
|
+
"label": "Agregar redirección a nivel de dominio",
|
|
44
|
+
"description": "Esta función te permite redirigir todas tus URLs de {{entity}} de {{app, anyCase}} a un nuevo dominio. <Link>Ver artículo de ayuda</Link> para más información."
|
|
45
|
+
},
|
|
46
|
+
"validations": {
|
|
47
|
+
"source": "La ruta de la fuente debe ser válida",
|
|
48
|
+
"destination": "La URL de destino debe ser válida",
|
|
49
|
+
"required": "{{entity}} es requerido",
|
|
50
|
+
"duplicateDomain": "No se puede usar el mismo dominio para la redirección"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"neetoRedirectUrls": {
|
|
3
|
+
"titles": {
|
|
4
|
+
"dashboard": "Tableau de bord"
|
|
5
|
+
},
|
|
6
|
+
"common": {
|
|
7
|
+
"delete": "Supprimer",
|
|
8
|
+
"edit": "Modifier",
|
|
9
|
+
"placeholder": {
|
|
10
|
+
"relativeUrl": "/articles/welcome",
|
|
11
|
+
"url": "https://example.com"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"settings": {
|
|
15
|
+
"title": "Panneau d'administration",
|
|
16
|
+
"redirecturl": {
|
|
17
|
+
"title": "URLs de redirection",
|
|
18
|
+
"description": "Voir et gérer les URL de redirection"
|
|
19
|
+
},
|
|
20
|
+
"general": {
|
|
21
|
+
"title": "Général"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"emptyState": {
|
|
25
|
+
"redirectURLs": {
|
|
26
|
+
"title": "Il n'y a pas d'URLs de redirection à afficher.",
|
|
27
|
+
"description": "Voici comment vous pouvez créer <helpLink>des URLs de redirection</helpLink>."
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"alerts": {
|
|
31
|
+
"delete": {
|
|
32
|
+
"title": "Supprimer l'URL de redirection ?",
|
|
33
|
+
"confirm": "Vous êtes en train de supprimer définitivement la redirection de <strong>{{ from_path }}</strong> à <strong>{{ to_path }}</strong>. Cela ne peut pas être annulé."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"redirect": {
|
|
37
|
+
"source": "Source",
|
|
38
|
+
"destination": "Destination",
|
|
39
|
+
"add": "Ajouter une nouvelle URL de redirection",
|
|
40
|
+
"edit": "Modifier l'URL de redirection",
|
|
41
|
+
"search": "Rechercher l'URL de redirection",
|
|
42
|
+
"domainLevelRedirect": {
|
|
43
|
+
"label": "Ajouter une redirection au niveau du domaine",
|
|
44
|
+
"description": "Cette fonctionnalité vous permet de rediriger toutes vos URL {{entity}} de {{app, anyCase}} vers un nouveau domaine. <Link>Voir l'article d'aide</Link> pour plus d'informations."
|
|
45
|
+
},
|
|
46
|
+
"validations": {
|
|
47
|
+
"source": "Le chemin source doit être valide",
|
|
48
|
+
"destination": "L'URL de destination doit être valide",
|
|
49
|
+
"required": "{{entity}} est requis",
|
|
50
|
+
"duplicateDomain": "Impossible d'utiliser le même domaine pour la redirection"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
package/dist/RedirectUrls.js
CHANGED
|
@@ -3,6 +3,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
3
3
|
import { useState, useEffect, useRef } from 'react';
|
|
4
4
|
import { noop, isPresent } from '@bigbinary/neeto-cist';
|
|
5
5
|
import { useMutationWithInvalidation, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
|
+
import { buildUrl, showThumbsUpToastr } from '@bigbinary/neeto-commons-frontend/utils';
|
|
6
7
|
import Container from '@bigbinary/neeto-molecules/Container';
|
|
7
8
|
import Header from '@bigbinary/neeto-molecules/Header';
|
|
8
9
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
@@ -17,7 +18,10 @@ import Typography from '@bigbinary/neetoui/Typography';
|
|
|
17
18
|
import Input from '@bigbinary/neetoui/formik/Input';
|
|
18
19
|
import Form from '@bigbinary/neetoui/formik/Form';
|
|
19
20
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
20
|
-
import
|
|
21
|
+
import { t } from 'i18next';
|
|
22
|
+
import { VALID_URL_REGEX, DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-frontend/constants';
|
|
23
|
+
import * as yup from 'yup';
|
|
24
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
21
25
|
import { useQuery } from '@tanstack/react-query';
|
|
22
26
|
import axios from 'axios';
|
|
23
27
|
import Edit from '@bigbinary/neeto-icons/Edit';
|
|
@@ -25,13 +29,9 @@ import CardLayout from '@bigbinary/neeto-molecules/CardLayout';
|
|
|
25
29
|
import { FormikInlineInput } from '@bigbinary/neeto-molecules/InlineInput';
|
|
26
30
|
import Label from '@bigbinary/neetoui/Label';
|
|
27
31
|
import Switch from '@bigbinary/neetoui/formik/Switch';
|
|
28
|
-
import { t } from 'i18next';
|
|
29
|
-
import { DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-frontend/constants';
|
|
30
32
|
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
31
33
|
import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
|
|
32
34
|
import Table from '@bigbinary/neetoui/Table';
|
|
33
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
34
|
-
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
35
35
|
|
|
36
36
|
var DeleteRedirectUrlModal = function DeleteRedirectUrlModal(_ref) {
|
|
37
37
|
var handleClose = _ref.handleClose,
|
|
@@ -63,9 +63,21 @@ var DeleteRedirectUrlModal = function DeleteRedirectUrlModal(_ref) {
|
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
var URL_WITH_PROTOCOL_REGEX = /^(http(s)?):\/\/[(www.)?a-zA-Z0-9@:%._+~#=-]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/g;
|
|
67
66
|
var URL_PATHNAME_REGEX = /^\/[-a-zA-Z0-9@:%_+.~#?&//=]*$/g;
|
|
68
67
|
|
|
68
|
+
var REDIRECT_URL_VALIDATION_SCHEMA = yup.object().shape({
|
|
69
|
+
fromPath: yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
70
|
+
entity: "Source"
|
|
71
|
+
})).matches(URL_PATHNAME_REGEX, t("neetoRedirectUrls.redirect.validations.source")),
|
|
72
|
+
toPath: yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
73
|
+
entity: "Destination"
|
|
74
|
+
})).matches(new RegExp("".concat(VALID_URL_REGEX.source, "|").concat(URL_PATHNAME_REGEX.source)), t("neetoRedirectUrls.redirect.validations.destination")).test("paths-not-same", t("neetoRedirectUrls.redirect.validations.samePaths"), function (value, context) {
|
|
75
|
+
var fromPath = context.parent.fromPath;
|
|
76
|
+
if (!value || !fromPath) return true;
|
|
77
|
+
return value !== fromPath;
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
|
|
69
81
|
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
70
82
|
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
71
83
|
var RedirectUrlPane = function RedirectUrlPane(_ref) {
|
|
@@ -90,16 +102,9 @@ var RedirectUrlPane = function RedirectUrlPane(_ref) {
|
|
|
90
102
|
fromPath: "",
|
|
91
103
|
toPath: ""
|
|
92
104
|
},
|
|
93
|
-
validationSchema:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
})).matches(URL_PATHNAME_REGEX, t("neetoRedirectUrls.redirect.validations.source")),
|
|
97
|
-
toPath: Yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
98
|
-
entity: "Destination"
|
|
99
|
-
})).matches(new RegExp("".concat(URL_WITH_PROTOCOL_REGEX.source, "|").concat(URL_PATHNAME_REGEX.source)), t("neetoRedirectUrls.redirect.validations.destination"))
|
|
100
|
-
}),
|
|
101
|
-
onSubmit: function onSubmit(values) {
|
|
102
|
-
handleSubmit(_objectSpread$2({}, values));
|
|
105
|
+
validationSchema: REDIRECT_URL_VALIDATION_SCHEMA,
|
|
106
|
+
onSubmit: function onSubmit(values, formikBag) {
|
|
107
|
+
handleSubmit(_objectSpread$2({}, values), formikBag);
|
|
103
108
|
}
|
|
104
109
|
},
|
|
105
110
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -107,12 +112,14 @@ var RedirectUrlPane = function RedirectUrlPane(_ref) {
|
|
|
107
112
|
children: /*#__PURE__*/jsxs("div", {
|
|
108
113
|
className: "w-full space-y-4",
|
|
109
114
|
children: [/*#__PURE__*/jsx(Input, {
|
|
115
|
+
required: true,
|
|
110
116
|
id: "fromPath",
|
|
111
117
|
label: t("neetoRedirectUrls.redirect.source"),
|
|
112
118
|
name: "fromPath",
|
|
113
119
|
ref: setInitialFocusField,
|
|
114
120
|
placeholder: t("neetoRedirectUrls.common.placeholder.relativeUrl")
|
|
115
121
|
}), /*#__PURE__*/jsx(Input, {
|
|
122
|
+
required: true,
|
|
116
123
|
id: "toPath",
|
|
117
124
|
label: t("neetoRedirectUrls.redirect.destination"),
|
|
118
125
|
name: "toPath",
|
|
@@ -131,6 +138,89 @@ var RedirectUrlPane = function RedirectUrlPane(_ref) {
|
|
|
131
138
|
});
|
|
132
139
|
};
|
|
133
140
|
|
|
141
|
+
var SETTINGS_CATEGORIES = {
|
|
142
|
+
GENERAL: "GENERAL"
|
|
143
|
+
};
|
|
144
|
+
var SETTINGS_CATEGORIES_LABELS = _defineProperty({}, SETTINGS_CATEGORIES.GENERAL, t("neetoRedirectUrls.settings.general.title"));
|
|
145
|
+
var SHOW_TOASTR_CONFIG = {
|
|
146
|
+
showToastr: false
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
var routes = {
|
|
150
|
+
admin: {
|
|
151
|
+
index: "/admin",
|
|
152
|
+
courses: {
|
|
153
|
+
chapters: {
|
|
154
|
+
show: "/admin/courses/:courseId/chapters/:chapterId",
|
|
155
|
+
chapterVersions: {
|
|
156
|
+
show: "/admin/courses/:courseId/chapters/:chapterId/chapter-versions/:chapterVersionId"
|
|
157
|
+
},
|
|
158
|
+
pages: {
|
|
159
|
+
show: "/admin/courses/:courseId/chapters/:chapterId/pages/:pageId",
|
|
160
|
+
pageVersions: {
|
|
161
|
+
show: "/admin/courses/:courseId/chapters/:chapterId/pages/:pageId/page-versions/:pageVersionId"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
index: "/admin/courses",
|
|
166
|
+
show: "/admin/courses/:courseId",
|
|
167
|
+
deployments: {
|
|
168
|
+
index: "/admin/courses/:courseId/deployments",
|
|
169
|
+
show: "/admin/courses/:courseId/deployments/:deploymentId"
|
|
170
|
+
},
|
|
171
|
+
configure: {
|
|
172
|
+
index: "/admin/courses/:courseId/configure",
|
|
173
|
+
security: "/admin/courses/:courseId/configure/security",
|
|
174
|
+
certificateConfiguration: "/admin/courses/:courseId/configure/certificate_configuration"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
pullRequestApps: {
|
|
178
|
+
index: "/admin/pull_request_apps",
|
|
179
|
+
show: "/admin/pull_request_apps/:pullRequestAppId",
|
|
180
|
+
courseDeployments: {
|
|
181
|
+
show: "/admin/pull_request_apps/:pullRequestAppId/course-deployments/:courseDeploymentId"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
members: "/admin/members",
|
|
185
|
+
adminPanel: "/admin/admin-panel",
|
|
186
|
+
reports: {
|
|
187
|
+
index: "/admin/reports",
|
|
188
|
+
invalidUrls: "/admin/reports/invalid-urls"
|
|
189
|
+
},
|
|
190
|
+
assets: {
|
|
191
|
+
index: "/admin/assets",
|
|
192
|
+
databases: "/admin/assets/databases",
|
|
193
|
+
videos: "/admin/assets/videos",
|
|
194
|
+
audios: "/admin/assets/audios",
|
|
195
|
+
resources: "/admin/assets/resources"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
home: "/"
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
var buildSettingsBreadcrumbs = function buildSettingsBreadcrumbs(category, pageTitle) {
|
|
202
|
+
return [{
|
|
203
|
+
link: routes.admin.adminPanel,
|
|
204
|
+
text: t("neetoRedirectUrls.settings.title")
|
|
205
|
+
}, {
|
|
206
|
+
link: buildUrl(routes.admin.adminPanel, {
|
|
207
|
+
category: category.toLowerCase()
|
|
208
|
+
}),
|
|
209
|
+
text: SETTINGS_CATEGORIES_LABELS[category]
|
|
210
|
+
}].concat(_toConsumableArray(pageTitle ? [{
|
|
211
|
+
text: pageTitle
|
|
212
|
+
}] : []));
|
|
213
|
+
};
|
|
214
|
+
var normalizeURL = function normalizeURL(url) {
|
|
215
|
+
return url ? url.replace(/\/+$/, "") : "";
|
|
216
|
+
};
|
|
217
|
+
var handleError = function handleError(setStatus, error) {
|
|
218
|
+
var response = error.response;
|
|
219
|
+
if (response && response.data && response.data.errors) {
|
|
220
|
+
setStatus(response.data.errors);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
134
224
|
var REDIRECT_URLS_BASE_URL = "/neeto_redirect_urls_engine/api/v1/redirect_urls";
|
|
135
225
|
|
|
136
226
|
var fetch = function fetch() {
|
|
@@ -139,13 +229,16 @@ var fetch = function fetch() {
|
|
|
139
229
|
var fetchAll = function fetchAll(params) {
|
|
140
230
|
return axios.get(REDIRECT_URLS_BASE_URL, params);
|
|
141
231
|
};
|
|
142
|
-
var create = function create(
|
|
143
|
-
|
|
232
|
+
var create = function create(_ref) {
|
|
233
|
+
var payload = _ref.payload,
|
|
234
|
+
config = _ref.config;
|
|
235
|
+
return axios.post(REDIRECT_URLS_BASE_URL, payload, config);
|
|
144
236
|
};
|
|
145
|
-
var update = function update(
|
|
146
|
-
var id =
|
|
147
|
-
payload =
|
|
148
|
-
|
|
237
|
+
var update = function update(_ref2) {
|
|
238
|
+
var id = _ref2.id,
|
|
239
|
+
payload = _ref2.payload,
|
|
240
|
+
config = _ref2.config;
|
|
241
|
+
return axios.put("".concat(REDIRECT_URLS_BASE_URL, "/").concat(id), payload, config);
|
|
149
242
|
};
|
|
150
243
|
var destroy = function destroy(id) {
|
|
151
244
|
return axios["delete"]("".concat(REDIRECT_URLS_BASE_URL, "/").concat(id));
|
|
@@ -192,18 +285,22 @@ var DOC_BASE_URL = "https://help.".concat(globalProps.appName.toLowerCase(), ".c
|
|
|
192
285
|
var CREATE_REDIRECT_URL_HELP_DOC_URL = "".concat(DOC_BASE_URL, "/creating-a-redirect-url");
|
|
193
286
|
var DOMAIN_LEVEL_REDIRECT_HELP_DOC_URL = "".concat(DOC_BASE_URL, "/domain-level-redirection");
|
|
194
287
|
|
|
195
|
-
var DOMAIN_REDIRECTION_VALIDATION_SCHEMA =
|
|
196
|
-
toPath:
|
|
288
|
+
var DOMAIN_REDIRECTION_VALIDATION_SCHEMA = yup.object().shape({
|
|
289
|
+
toPath: yup.string().nullable().when("domainRedirectionActive", {
|
|
197
290
|
is: true,
|
|
198
|
-
then:
|
|
291
|
+
then: yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
199
292
|
entity: "Destination"
|
|
200
|
-
})).matches(
|
|
293
|
+
})).matches(VALID_URL_REGEX, t("neetoRedirectUrls.redirect.validations.destination")).test("not-duplicate-domain", t("neetoRedirectUrls.redirect.validations.duplicateDomain"), function (value) {
|
|
294
|
+
if (!value) return true;
|
|
295
|
+
return normalizeURL(value) !== normalizeURL(location.origin);
|
|
296
|
+
})
|
|
201
297
|
})
|
|
202
298
|
});
|
|
203
299
|
|
|
204
300
|
var DomainRedirection = function DomainRedirection(_ref) {
|
|
205
301
|
var domainRedirectUrl = _ref.domainRedirectUrl,
|
|
206
|
-
entity = _ref.entity
|
|
302
|
+
entity = _ref.entity,
|
|
303
|
+
helpDocUrls = _ref.helpDocUrls;
|
|
207
304
|
var _useState = useState(true),
|
|
208
305
|
_useState2 = _slicedToArray(_useState, 2),
|
|
209
306
|
isEditingDomainRedirect = _useState2[0],
|
|
@@ -228,7 +325,9 @@ var DomainRedirection = function DomainRedirection(_ref) {
|
|
|
228
325
|
return domainRedirectUrl ? updateLink({
|
|
229
326
|
id: domainRedirectUrl.id,
|
|
230
327
|
payload: payload
|
|
231
|
-
}) : createLink(
|
|
328
|
+
}) : createLink({
|
|
329
|
+
payload: payload
|
|
330
|
+
});
|
|
232
331
|
};
|
|
233
332
|
var handleRemoveRedirection = function handleRemoveRedirection(domainLinkActive) {
|
|
234
333
|
if (!(domainLinkActive && domainRedirectUrl)) {
|
|
@@ -287,9 +386,9 @@ var DomainRedirection = function DomainRedirection(_ref) {
|
|
|
287
386
|
Link: /*#__PURE__*/jsx(Button, {
|
|
288
387
|
className: "text-sm",
|
|
289
388
|
"data-cy": "domain-level-redirections-help-button",
|
|
290
|
-
href: DOMAIN_LEVEL_REDIRECT_HELP_DOC_URL,
|
|
291
389
|
style: "link",
|
|
292
|
-
target: "_blank"
|
|
390
|
+
target: "_blank",
|
|
391
|
+
href: helpDocUrls.domainLevelRedirectUrl || DOMAIN_LEVEL_REDIRECT_HELP_DOC_URL
|
|
293
392
|
})
|
|
294
393
|
}
|
|
295
394
|
})
|
|
@@ -330,102 +429,6 @@ var DomainRedirection = function DomainRedirection(_ref) {
|
|
|
330
429
|
});
|
|
331
430
|
};
|
|
332
431
|
|
|
333
|
-
var SETTINGS_CATEGORIES = {
|
|
334
|
-
GENERAL: "GENERAL"
|
|
335
|
-
};
|
|
336
|
-
var SETTINGS_CATEGORIES_LABELS = _defineProperty({}, SETTINGS_CATEGORIES.GENERAL, t("neetoRedirectUrls.settings.general.title"));
|
|
337
|
-
|
|
338
|
-
var routes = {
|
|
339
|
-
admin: {
|
|
340
|
-
index: "/admin",
|
|
341
|
-
courses: {
|
|
342
|
-
chapters: {
|
|
343
|
-
show: "/admin/courses/:courseId/chapters/:chapterId",
|
|
344
|
-
chapterVersions: {
|
|
345
|
-
show: "/admin/courses/:courseId/chapters/:chapterId/chapter-versions/:chapterVersionId"
|
|
346
|
-
},
|
|
347
|
-
pages: {
|
|
348
|
-
show: "/admin/courses/:courseId/chapters/:chapterId/pages/:pageId",
|
|
349
|
-
pageVersions: {
|
|
350
|
-
show: "/admin/courses/:courseId/chapters/:chapterId/pages/:pageId/page-versions/:pageVersionId"
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
index: "/admin/courses",
|
|
355
|
-
show: "/admin/courses/:courseId",
|
|
356
|
-
deployments: {
|
|
357
|
-
index: "/admin/courses/:courseId/deployments",
|
|
358
|
-
show: "/admin/courses/:courseId/deployments/:deploymentId"
|
|
359
|
-
},
|
|
360
|
-
configure: {
|
|
361
|
-
index: "/admin/courses/:courseId/configure",
|
|
362
|
-
security: "/admin/courses/:courseId/configure/security",
|
|
363
|
-
certificateConfiguration: "/admin/courses/:courseId/configure/certificate_configuration"
|
|
364
|
-
}
|
|
365
|
-
},
|
|
366
|
-
pullRequestApps: {
|
|
367
|
-
index: "/admin/pull_request_apps",
|
|
368
|
-
show: "/admin/pull_request_apps/:pullRequestAppId",
|
|
369
|
-
courseDeployments: {
|
|
370
|
-
show: "/admin/pull_request_apps/:pullRequestAppId/course-deployments/:courseDeploymentId"
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
members: "/admin/members",
|
|
374
|
-
settings: {
|
|
375
|
-
index: "/admin/settings",
|
|
376
|
-
general: {
|
|
377
|
-
apiSettings: "/admin/settings/general/api-settings",
|
|
378
|
-
redirectUrls: "/admin/settings/general/redirect-urls",
|
|
379
|
-
basicInfos: "/admin/settings/general/basic-infos",
|
|
380
|
-
customDomains: {
|
|
381
|
-
index: "/admin/settings/general/custom-domains"
|
|
382
|
-
},
|
|
383
|
-
security: {
|
|
384
|
-
index: "/admin/settings/general/security"
|
|
385
|
-
},
|
|
386
|
-
roles: "/admin/settings/general/roles"
|
|
387
|
-
},
|
|
388
|
-
integrations: {
|
|
389
|
-
index: "/admin/settings/integrations",
|
|
390
|
-
stripe: {
|
|
391
|
-
index: "/admin/settings/integrations/stripe",
|
|
392
|
-
manage: "/admin/settings/integrations/stripe/manage"
|
|
393
|
-
},
|
|
394
|
-
googleAnalytics: {
|
|
395
|
-
index: "/admin/settings/integrations/google-analytics",
|
|
396
|
-
manage: "/admin/settings/integrations/google-analytics/manage"
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
},
|
|
400
|
-
reports: {
|
|
401
|
-
index: "/admin/reports",
|
|
402
|
-
invalidUrls: "/admin/reports/invalid-urls"
|
|
403
|
-
},
|
|
404
|
-
assets: {
|
|
405
|
-
index: "/admin/assets",
|
|
406
|
-
databases: "/admin/assets/databases",
|
|
407
|
-
videos: "/admin/assets/videos",
|
|
408
|
-
audios: "/admin/assets/audios",
|
|
409
|
-
resources: "/admin/assets/resources"
|
|
410
|
-
}
|
|
411
|
-
},
|
|
412
|
-
home: "/"
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
var buildSettingsBreadcrumbs = function buildSettingsBreadcrumbs(category, pageTitle) {
|
|
416
|
-
return [{
|
|
417
|
-
link: routes.admin.settings.index,
|
|
418
|
-
text: t("neetoRedirectUrls.settings.title")
|
|
419
|
-
}, {
|
|
420
|
-
link: buildUrl(routes.admin.settings.index, {
|
|
421
|
-
category: category.toLowerCase()
|
|
422
|
-
}),
|
|
423
|
-
text: SETTINGS_CATEGORIES_LABELS[category]
|
|
424
|
-
}].concat(_toConsumableArray(pageTitle ? [{
|
|
425
|
-
text: pageTitle
|
|
426
|
-
}] : []));
|
|
427
|
-
};
|
|
428
|
-
|
|
429
432
|
var buildBreadcrumbs = function buildBreadcrumbs(pageTitle) {
|
|
430
433
|
return buildSettingsBreadcrumbs(SETTINGS_CATEGORIES.GENERAL, pageTitle);
|
|
431
434
|
};
|
|
@@ -529,7 +532,9 @@ var RedirectUrlsTable = function RedirectUrlsTable(_ref) {
|
|
|
529
532
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
530
533
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
531
534
|
var RedirectUrls = function RedirectUrls(_ref) {
|
|
532
|
-
var entity = _ref.entity
|
|
535
|
+
var entity = _ref.entity,
|
|
536
|
+
_ref$helpDocUrls = _ref.helpDocUrls,
|
|
537
|
+
helpDocUrls = _ref$helpDocUrls === void 0 ? {} : _ref$helpDocUrls;
|
|
533
538
|
var _useTranslation = useTranslation(),
|
|
534
539
|
t = _useTranslation.t;
|
|
535
540
|
var _useQueryParams = useQueryParams(),
|
|
@@ -574,18 +579,38 @@ var RedirectUrls = function RedirectUrls(_ref) {
|
|
|
574
579
|
updateRedirectUrl = _useUpdateRedirectUrl.mutate;
|
|
575
580
|
var _useDestroyRedirectUr = useDestroyRedirectUrl(),
|
|
576
581
|
deleteRedirectUrl = _useDestroyRedirectUr.mutate;
|
|
577
|
-
var handleCreateRedirectUrl = function handleCreateRedirectUrl(redirectUrl) {
|
|
578
|
-
|
|
582
|
+
var handleCreateRedirectUrl = function handleCreateRedirectUrl(redirectUrl, _ref2) {
|
|
583
|
+
var setSubmitting = _ref2.setSubmitting,
|
|
584
|
+
setStatus = _ref2.setStatus;
|
|
585
|
+
createRedirectUrl({
|
|
586
|
+
payload: redirectUrl,
|
|
587
|
+
config: SHOW_TOASTR_CONFIG
|
|
588
|
+
}, {
|
|
589
|
+
onError: function onError(error) {
|
|
590
|
+
handleError(setStatus, error);
|
|
591
|
+
setSubmitting(false);
|
|
592
|
+
},
|
|
579
593
|
onSuccess: function onSuccess() {
|
|
594
|
+
showThumbsUpToastr();
|
|
580
595
|
setIsModalOpen(false);
|
|
581
596
|
}
|
|
582
597
|
});
|
|
583
598
|
};
|
|
584
|
-
var handleRedirectUrlUpdate = function handleRedirectUrlUpdate(redirectUrl) {
|
|
599
|
+
var handleRedirectUrlUpdate = function handleRedirectUrlUpdate(redirectUrl, _ref3) {
|
|
600
|
+
var setSubmitting = _ref3.setSubmitting,
|
|
601
|
+
setStatus = _ref3.setStatus;
|
|
585
602
|
updateRedirectUrl({
|
|
586
603
|
id: redirectUrl.id,
|
|
587
|
-
payload: redirectUrl
|
|
604
|
+
payload: redirectUrl,
|
|
605
|
+
config: SHOW_TOASTR_CONFIG
|
|
588
606
|
}, {
|
|
607
|
+
onError: function onError(error) {
|
|
608
|
+
handleError(setStatus, error);
|
|
609
|
+
setSubmitting(false);
|
|
610
|
+
},
|
|
611
|
+
onSuccess: function onSuccess() {
|
|
612
|
+
showThumbsUpToastr();
|
|
613
|
+
},
|
|
589
614
|
onSettled: function onSettled() {
|
|
590
615
|
setUrlDetailsToEdit(null);
|
|
591
616
|
}
|
|
@@ -627,9 +652,9 @@ var RedirectUrls = function RedirectUrls(_ref) {
|
|
|
627
652
|
i18nKey: "neetoRedirectUrls.emptyState.redirectURLs.description",
|
|
628
653
|
components: {
|
|
629
654
|
helpLink: /*#__PURE__*/jsx(Button, {
|
|
630
|
-
href: CREATE_REDIRECT_URL_HELP_DOC_URL,
|
|
631
655
|
style: "link",
|
|
632
|
-
target: "_blank"
|
|
656
|
+
target: "_blank",
|
|
657
|
+
href: helpDocUrls.createRedirectUrl || CREATE_REDIRECT_URL_HELP_DOC_URL
|
|
633
658
|
})
|
|
634
659
|
}
|
|
635
660
|
}),
|
|
@@ -645,7 +670,8 @@ var RedirectUrls = function RedirectUrls(_ref) {
|
|
|
645
670
|
className: "w-full",
|
|
646
671
|
children: /*#__PURE__*/jsx(DomainRedirection, {
|
|
647
672
|
domainRedirectUrl: domainRedirectUrl,
|
|
648
|
-
entity: entity
|
|
673
|
+
entity: entity,
|
|
674
|
+
helpDocUrls: helpDocUrls
|
|
649
675
|
})
|
|
650
676
|
}), /*#__PURE__*/jsx(RedirectUrlsTable, {
|
|
651
677
|
currentPageNumber: currentPageNumber,
|