@bigbinary/neeto-redirect-urls-frontend 2.1.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 +105 -0
- package/app/javascript/src/translations/en.json +54 -0
- package/app/javascript/src/translations/index.js +3 -0
- package/dist/RedirectUrls.js +790 -0
- package/dist/RedirectUrls.js.map +1 -0
- package/dist/cjs/RedirectUrls.js +832 -0
- package/dist/cjs/RedirectUrls.js.map +1 -0
- package/dist/cjs/index.js +40 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/package.json +209 -0
- package/types.d.ts +3 -0
|
@@ -0,0 +1,790 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { noop, isPresent } from '@bigbinary/neeto-cist';
|
|
3
|
+
import { useMutationWithInvalidation, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
4
|
+
import Container from '@bigbinary/neeto-molecules/Container';
|
|
5
|
+
import Header from '@bigbinary/neeto-molecules/Header';
|
|
6
|
+
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
7
|
+
import Pane from '@bigbinary/neetoui/Pane';
|
|
8
|
+
import NoData from '@bigbinary/neetoui/NoData';
|
|
9
|
+
import Button from '@bigbinary/neetoui/Button';
|
|
10
|
+
import { isEmpty, isNotNil } from 'ramda';
|
|
11
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
12
|
+
import Alert from '@bigbinary/neetoui/Alert';
|
|
13
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
|
+
import Typography from '@bigbinary/neetoui/Typography';
|
|
15
|
+
import Input from '@bigbinary/neetoui/formik/Input';
|
|
16
|
+
import Form from '@bigbinary/neetoui/formik/Form';
|
|
17
|
+
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
18
|
+
import * as Yup from 'yup';
|
|
19
|
+
import { useQuery } from '@tanstack/react-query';
|
|
20
|
+
import axios from 'axios';
|
|
21
|
+
import Edit from '@bigbinary/neeto-icons/Edit';
|
|
22
|
+
import { FormikInlineInput } from '@bigbinary/neeto-molecules/InlineInput';
|
|
23
|
+
import Label from '@bigbinary/neetoui/Label';
|
|
24
|
+
import Switch from '@bigbinary/neetoui/formik/Switch';
|
|
25
|
+
import { t } from 'i18next';
|
|
26
|
+
import { DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-frontend/constants';
|
|
27
|
+
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
28
|
+
import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
|
|
29
|
+
import Table from '@bigbinary/neetoui/Table';
|
|
30
|
+
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
31
|
+
|
|
32
|
+
function _typeof(o) {
|
|
33
|
+
"@babel/helpers - typeof";
|
|
34
|
+
|
|
35
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
36
|
+
return typeof o;
|
|
37
|
+
} : function (o) {
|
|
38
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
39
|
+
}, _typeof(o);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function _toPrimitive(input, hint) {
|
|
43
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
44
|
+
var prim = input[Symbol.toPrimitive];
|
|
45
|
+
if (prim !== undefined) {
|
|
46
|
+
var res = prim.call(input, hint || "default");
|
|
47
|
+
if (_typeof(res) !== "object") return res;
|
|
48
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
49
|
+
}
|
|
50
|
+
return (hint === "string" ? String : Number)(input);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function _toPropertyKey(arg) {
|
|
54
|
+
var key = _toPrimitive(arg, "string");
|
|
55
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _defineProperty(obj, key, value) {
|
|
59
|
+
key = _toPropertyKey(key);
|
|
60
|
+
if (key in obj) {
|
|
61
|
+
Object.defineProperty(obj, key, {
|
|
62
|
+
value: value,
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
writable: true
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
obj[key] = value;
|
|
69
|
+
}
|
|
70
|
+
return obj;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function _arrayWithHoles(arr) {
|
|
74
|
+
if (Array.isArray(arr)) return arr;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function _iterableToArrayLimit(r, l) {
|
|
78
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
79
|
+
if (null != t) {
|
|
80
|
+
var e,
|
|
81
|
+
n,
|
|
82
|
+
i,
|
|
83
|
+
u,
|
|
84
|
+
a = [],
|
|
85
|
+
f = !0,
|
|
86
|
+
o = !1;
|
|
87
|
+
try {
|
|
88
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
89
|
+
if (Object(t) !== t) return;
|
|
90
|
+
f = !1;
|
|
91
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
92
|
+
} catch (r) {
|
|
93
|
+
o = !0, n = r;
|
|
94
|
+
} finally {
|
|
95
|
+
try {
|
|
96
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
97
|
+
} finally {
|
|
98
|
+
if (o) throw n;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return a;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function _arrayLikeToArray(arr, len) {
|
|
106
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
107
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
108
|
+
return arr2;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
112
|
+
if (!o) return;
|
|
113
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
114
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
115
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
116
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
117
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function _nonIterableRest() {
|
|
121
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function _slicedToArray(arr, i) {
|
|
125
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
var DeleteRedirectUrlModal = function DeleteRedirectUrlModal(_ref) {
|
|
129
|
+
var handleClose = _ref.handleClose,
|
|
130
|
+
handleSubmit = _ref.handleSubmit,
|
|
131
|
+
detailsToDelete = _ref.detailsToDelete,
|
|
132
|
+
isOpen = _ref.isOpen;
|
|
133
|
+
var _useTranslation = useTranslation(),
|
|
134
|
+
t = _useTranslation.t;
|
|
135
|
+
if (detailsToDelete === null) return null;
|
|
136
|
+
var id = detailsToDelete.id,
|
|
137
|
+
toPath = detailsToDelete.toPath,
|
|
138
|
+
fromPath = detailsToDelete.fromPath;
|
|
139
|
+
var title = t("neetoRedirectUrls.alerts.delete.title");
|
|
140
|
+
return /*#__PURE__*/jsx(Alert, {
|
|
141
|
+
isOpen: isOpen,
|
|
142
|
+
title: title,
|
|
143
|
+
submitButtonLabel: t("neetoRedirectUrls.common.delete"),
|
|
144
|
+
message: /*#__PURE__*/jsx(Trans, {
|
|
145
|
+
i18nKey: "neetoRedirectUrls.alerts.delete.confirm",
|
|
146
|
+
values: {
|
|
147
|
+
from_path: fromPath,
|
|
148
|
+
to_path: toPath
|
|
149
|
+
}
|
|
150
|
+
}),
|
|
151
|
+
onClose: handleClose,
|
|
152
|
+
onSubmit: function onSubmit() {
|
|
153
|
+
return handleSubmit(id);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
var URL_WITH_PROTOCOL_REGEX = /^(http(s)?):\/\/[(www.)?a-zA-Z0-9@:%._+~#=-]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/g;
|
|
159
|
+
var URL_PATHNAME_REGEX = /^\/[-a-zA-Z0-9@:%_+.~#?&//=]*$/g;
|
|
160
|
+
|
|
161
|
+
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; }
|
|
162
|
+
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; }
|
|
163
|
+
var RedirectUrlPane = function RedirectUrlPane(_ref) {
|
|
164
|
+
var handleClose = _ref.handleClose,
|
|
165
|
+
handleSubmit = _ref.handleSubmit,
|
|
166
|
+
_ref$initialValues = _ref.initialValues,
|
|
167
|
+
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
168
|
+
_ref$setInitialFocusF = _ref.setInitialFocusField,
|
|
169
|
+
setInitialFocusField = _ref$setInitialFocusF === void 0 ? noop : _ref$setInitialFocusF;
|
|
170
|
+
var _useTranslation = useTranslation(),
|
|
171
|
+
t = _useTranslation.t;
|
|
172
|
+
var redirectUrlId = initialValues === null || initialValues === void 0 ? void 0 : initialValues.id;
|
|
173
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
174
|
+
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
175
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
176
|
+
style: "h2",
|
|
177
|
+
children: redirectUrlId ? t("neetoRedirectUrls.redirect.edit") : t("neetoRedirectUrls.redirect.add")
|
|
178
|
+
})
|
|
179
|
+
}), /*#__PURE__*/jsx(Form, {
|
|
180
|
+
formikProps: {
|
|
181
|
+
initialValues: initialValues || {
|
|
182
|
+
fromPath: "",
|
|
183
|
+
toPath: ""
|
|
184
|
+
},
|
|
185
|
+
validationSchema: Yup.object().shape({
|
|
186
|
+
fromPath: Yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
187
|
+
entity: "Source"
|
|
188
|
+
})).matches(URL_PATHNAME_REGEX, t("neetoRedirectUrls.redirect.validations.source")),
|
|
189
|
+
toPath: Yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
190
|
+
entity: "Destination"
|
|
191
|
+
})).matches(new RegExp("".concat(URL_WITH_PROTOCOL_REGEX.source, "|").concat(URL_PATHNAME_REGEX.source)), t("neetoRedirectUrls.redirect.validations.destination"))
|
|
192
|
+
}),
|
|
193
|
+
onSubmit: function onSubmit(values) {
|
|
194
|
+
handleSubmit(_objectSpread$2({}, values));
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
children: /*#__PURE__*/jsxs(Fragment, {
|
|
198
|
+
children: [/*#__PURE__*/jsx(Pane.Body, {
|
|
199
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
200
|
+
className: "w-full space-y-4",
|
|
201
|
+
children: [/*#__PURE__*/jsx(Input, {
|
|
202
|
+
id: "fromPath",
|
|
203
|
+
label: t("neetoRedirectUrls.redirect.source"),
|
|
204
|
+
name: "fromPath",
|
|
205
|
+
ref: setInitialFocusField,
|
|
206
|
+
placeholder: t("neetoRedirectUrls.common.placeholder.relativeUrl")
|
|
207
|
+
}), /*#__PURE__*/jsx(Input, {
|
|
208
|
+
id: "toPath",
|
|
209
|
+
label: t("neetoRedirectUrls.redirect.destination"),
|
|
210
|
+
name: "toPath",
|
|
211
|
+
placeholder: window.location.origin
|
|
212
|
+
})]
|
|
213
|
+
})
|
|
214
|
+
}), /*#__PURE__*/jsx(Pane.Footer, {
|
|
215
|
+
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
216
|
+
cancelButtonProps: {
|
|
217
|
+
onClick: handleClose
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
})]
|
|
221
|
+
})
|
|
222
|
+
})]
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
var REDIRECT_URLS_BASE_URL = "/neeto_redirect_urls_engine/api/v1/redirect_urls";
|
|
227
|
+
|
|
228
|
+
var fetch = function fetch() {
|
|
229
|
+
return axios.get(REDIRECT_URLS_BASE_URL);
|
|
230
|
+
};
|
|
231
|
+
var fetchAll = function fetchAll(params) {
|
|
232
|
+
return axios.get(REDIRECT_URLS_BASE_URL, params);
|
|
233
|
+
};
|
|
234
|
+
var create = function create(payload) {
|
|
235
|
+
return axios.post(REDIRECT_URLS_BASE_URL, payload);
|
|
236
|
+
};
|
|
237
|
+
var update = function update(_ref) {
|
|
238
|
+
var id = _ref.id,
|
|
239
|
+
payload = _ref.payload;
|
|
240
|
+
return axios.put("".concat(REDIRECT_URLS_BASE_URL, "/").concat(id), payload);
|
|
241
|
+
};
|
|
242
|
+
var destroy = function destroy(id) {
|
|
243
|
+
return axios["delete"]("".concat(REDIRECT_URLS_BASE_URL, "/").concat(id));
|
|
244
|
+
};
|
|
245
|
+
var redirectUrlApi = {
|
|
246
|
+
fetch: fetch,
|
|
247
|
+
fetchAll: fetchAll,
|
|
248
|
+
create: create,
|
|
249
|
+
update: update,
|
|
250
|
+
destroy: destroy
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
var QUERY_KEYS = {
|
|
254
|
+
REDIRECT_URLS: "redirect_urls"
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
function ownKeys$1(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; }
|
|
258
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
259
|
+
var useFetchAllRedirectUrls = function useFetchAllRedirectUrls(searchQuery, options) {
|
|
260
|
+
return useQuery(_objectSpread$1({
|
|
261
|
+
queryKey: [QUERY_KEYS.REDIRECT_URLS, searchQuery],
|
|
262
|
+
queryFn: function queryFn() {
|
|
263
|
+
return redirectUrlApi.fetchAll(searchQuery);
|
|
264
|
+
}
|
|
265
|
+
}, options));
|
|
266
|
+
};
|
|
267
|
+
var useCreateRedirectUrl = function useCreateRedirectUrl(options) {
|
|
268
|
+
return useMutationWithInvalidation(redirectUrlApi.create, _objectSpread$1({
|
|
269
|
+
keysToInvalidate: [QUERY_KEYS.REDIRECT_URLS]
|
|
270
|
+
}, options));
|
|
271
|
+
};
|
|
272
|
+
var useUpdateRedirectUrl = function useUpdateRedirectUrl(options) {
|
|
273
|
+
return useMutationWithInvalidation(redirectUrlApi.update, _objectSpread$1({
|
|
274
|
+
keysToInvalidate: [QUERY_KEYS.REDIRECT_URLS]
|
|
275
|
+
}, options));
|
|
276
|
+
};
|
|
277
|
+
var useDestroyRedirectUrl = function useDestroyRedirectUrl(options) {
|
|
278
|
+
return useMutationWithInvalidation(redirectUrlApi.destroy, _objectSpread$1({
|
|
279
|
+
keysToInvalidate: [QUERY_KEYS.REDIRECT_URLS]
|
|
280
|
+
}, options));
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
var DOC_BASE_URL = "https://neetocoursehelp.neetokb.com/p";
|
|
284
|
+
var CREATE_REDIRECT_URL_HELP_DOC_URL = "".concat(DOC_BASE_URL, "/a-45af9cf1");
|
|
285
|
+
var DOMAIN_LEVEL_REDIRECT_HELP_DOC_URL = "".concat(DOC_BASE_URL, "/a-7bbd89c5");
|
|
286
|
+
|
|
287
|
+
var DOMAIN_REDIRECTION_VALIDATION_SCHEMA = Yup.object().shape({
|
|
288
|
+
toPath: Yup.string().nullable().when("domainRedirectionActive", {
|
|
289
|
+
is: true,
|
|
290
|
+
then: Yup.string().required(t("neetoRedirectUrls.redirect.validations.required", {
|
|
291
|
+
entity: "Destination"
|
|
292
|
+
})).matches(URL_WITH_PROTOCOL_REGEX, t("neetoRedirectUrls.redirect.validations.destination")).notOneOf([location.origin], t("neetoRedirectUrls.redirect.validations.duplicateDomain"))
|
|
293
|
+
})
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
var DomainRedirection = function DomainRedirection(_ref) {
|
|
297
|
+
var domainRedirectUrl = _ref.domainRedirectUrl;
|
|
298
|
+
var _useState = useState(true),
|
|
299
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
300
|
+
isEditingDomainRedirect = _useState2[0],
|
|
301
|
+
setIsEditingDomainRedirect = _useState2[1];
|
|
302
|
+
var _useTranslation = useTranslation(),
|
|
303
|
+
t = _useTranslation.t;
|
|
304
|
+
var _useCreateRedirectUrl = useCreateRedirectUrl(),
|
|
305
|
+
createLink = _useCreateRedirectUrl.mutateAsync;
|
|
306
|
+
var _useUpdateRedirectUrl = useUpdateRedirectUrl(),
|
|
307
|
+
updateLink = _useUpdateRedirectUrl.mutateAsync;
|
|
308
|
+
var _useDestroyRedirectUr = useDestroyRedirectUrl(),
|
|
309
|
+
destroyLink = _useDestroyRedirectUr.mutate;
|
|
310
|
+
var initialValues = {
|
|
311
|
+
domainRedirectionActive: isPresent(domainRedirectUrl === null || domainRedirectUrl === void 0 ? void 0 : domainRedirectUrl.toPath),
|
|
312
|
+
toPath: domainRedirectUrl === null || domainRedirectUrl === void 0 ? void 0 : domainRedirectUrl.toPath
|
|
313
|
+
};
|
|
314
|
+
var handleSubmit = function handleSubmit(values) {
|
|
315
|
+
var payload = {
|
|
316
|
+
toPath: values.toPath,
|
|
317
|
+
redirection_type: "domain"
|
|
318
|
+
};
|
|
319
|
+
return domainRedirectUrl ? updateLink({
|
|
320
|
+
id: domainRedirectUrl.id,
|
|
321
|
+
payload: payload
|
|
322
|
+
}) : createLink(payload);
|
|
323
|
+
};
|
|
324
|
+
var handleRemoveRedirection = function handleRemoveRedirection(domainLinkActive) {
|
|
325
|
+
if (!(domainLinkActive && domainRedirectUrl)) {
|
|
326
|
+
setIsEditingDomainRedirect(true);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
destroyLink(domainRedirectUrl.id);
|
|
330
|
+
};
|
|
331
|
+
useEffect(function () {
|
|
332
|
+
if (isPresent(domainRedirectUrl === null || domainRedirectUrl === void 0 ? void 0 : domainRedirectUrl.toPath)) {
|
|
333
|
+
setIsEditingDomainRedirect(false);
|
|
334
|
+
}
|
|
335
|
+
}, [domainRedirectUrl]);
|
|
336
|
+
return /*#__PURE__*/jsx("div", {
|
|
337
|
+
className: "neeto-ui-border-gray-200 mb-8 border-b ",
|
|
338
|
+
children: /*#__PURE__*/jsx(Form, {
|
|
339
|
+
className: "mb-2 w-full",
|
|
340
|
+
formikProps: {
|
|
341
|
+
initialValues: initialValues,
|
|
342
|
+
validationSchema: DOMAIN_REDIRECTION_VALIDATION_SCHEMA,
|
|
343
|
+
enableReinitialize: true,
|
|
344
|
+
onSubmit: handleSubmit
|
|
345
|
+
},
|
|
346
|
+
children: function children(_ref2) {
|
|
347
|
+
var domainRedirectionActive = _ref2.values.domainRedirectionActive,
|
|
348
|
+
dirty = _ref2.dirty;
|
|
349
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
350
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
351
|
+
className: "flex items-center justify-between py-3",
|
|
352
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
353
|
+
className: "flex flex-col space-y-2",
|
|
354
|
+
children: [/*#__PURE__*/jsxs(Label, {
|
|
355
|
+
className: "flex items-center gap-2",
|
|
356
|
+
children: [/*#__PURE__*/jsx(Switch, {
|
|
357
|
+
"data-cy": "domain-level-redirection-switch",
|
|
358
|
+
name: "domainRedirectionActive",
|
|
359
|
+
onClick: function onClick() {
|
|
360
|
+
return handleRemoveRedirection(domainRedirectionActive);
|
|
361
|
+
}
|
|
362
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
363
|
+
component: "span",
|
|
364
|
+
"data-cy": "domain-level-redirection-heading",
|
|
365
|
+
style: "h5",
|
|
366
|
+
weight: "medium",
|
|
367
|
+
children: t("neetoRedirectUrls.redirect.domainLevelRedirect.label")
|
|
368
|
+
})]
|
|
369
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
370
|
+
component: "p",
|
|
371
|
+
style: "body2",
|
|
372
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
373
|
+
i18nKey: "neetoRedirectUrls.redirect.domainLevelRedirect.description",
|
|
374
|
+
components: {
|
|
375
|
+
Link: /*#__PURE__*/jsx(Button, {
|
|
376
|
+
className: "text-sm",
|
|
377
|
+
"data-cy": "domain-level-redirections-help-button",
|
|
378
|
+
href: DOMAIN_LEVEL_REDIRECT_HELP_DOC_URL,
|
|
379
|
+
style: "link",
|
|
380
|
+
target: "_blank"
|
|
381
|
+
})
|
|
382
|
+
}
|
|
383
|
+
})
|
|
384
|
+
})]
|
|
385
|
+
})
|
|
386
|
+
}), domainRedirectionActive && /*#__PURE__*/jsx("div", {
|
|
387
|
+
className: "my-2 flex w-1/2 items-start space-x-3",
|
|
388
|
+
children: isEditingDomainRedirect ? /*#__PURE__*/jsx(FormikInlineInput, {
|
|
389
|
+
"data-cy": "domain-level-redirection-link-text-field",
|
|
390
|
+
handleCancel: function handleCancel() {
|
|
391
|
+
return dirty;
|
|
392
|
+
},
|
|
393
|
+
name: "toPath",
|
|
394
|
+
placeholder: t("neetoRedirectUrls.common.placeholder.url"),
|
|
395
|
+
cancelButtonProps: {
|
|
396
|
+
disabled: !dirty,
|
|
397
|
+
"data-cy": "domain-level-redirection-link-cancel-button"
|
|
398
|
+
},
|
|
399
|
+
submitButtonProps: {
|
|
400
|
+
"data-cy": "domain-level-redirection-link-submit-button"
|
|
401
|
+
}
|
|
402
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
403
|
+
children: [/*#__PURE__*/jsx(Input, {
|
|
404
|
+
disabled: true,
|
|
405
|
+
name: "toPath"
|
|
406
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
407
|
+
icon: Edit,
|
|
408
|
+
style: "link",
|
|
409
|
+
onClick: function onClick() {
|
|
410
|
+
return setIsEditingDomainRedirect(true);
|
|
411
|
+
}
|
|
412
|
+
})]
|
|
413
|
+
})
|
|
414
|
+
})]
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
})
|
|
418
|
+
});
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
var SETTINGS_CATEGORIES = {
|
|
422
|
+
GENERAL: "GENERAL"
|
|
423
|
+
};
|
|
424
|
+
var SETTINGS_CATEGORIES_LABELS = _defineProperty({}, SETTINGS_CATEGORIES.GENERAL, t("neetoRedirectUrls.settings.general.title"));
|
|
425
|
+
|
|
426
|
+
function _arrayWithoutHoles(arr) {
|
|
427
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function _iterableToArray(iter) {
|
|
431
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function _nonIterableSpread() {
|
|
435
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function _toConsumableArray(arr) {
|
|
439
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
var routes = {
|
|
443
|
+
admin: {
|
|
444
|
+
index: "/admin",
|
|
445
|
+
courses: {
|
|
446
|
+
chapters: {
|
|
447
|
+
show: "/admin/courses/:courseId/chapters/:chapterId",
|
|
448
|
+
chapterVersions: {
|
|
449
|
+
show: "/admin/courses/:courseId/chapters/:chapterId/chapter-versions/:chapterVersionId"
|
|
450
|
+
},
|
|
451
|
+
pages: {
|
|
452
|
+
show: "/admin/courses/:courseId/chapters/:chapterId/pages/:pageId",
|
|
453
|
+
pageVersions: {
|
|
454
|
+
show: "/admin/courses/:courseId/chapters/:chapterId/pages/:pageId/page-versions/:pageVersionId"
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
index: "/admin/courses",
|
|
459
|
+
show: "/admin/courses/:courseId",
|
|
460
|
+
deployments: {
|
|
461
|
+
index: "/admin/courses/:courseId/deployments",
|
|
462
|
+
show: "/admin/courses/:courseId/deployments/:deploymentId"
|
|
463
|
+
},
|
|
464
|
+
configure: {
|
|
465
|
+
index: "/admin/courses/:courseId/configure",
|
|
466
|
+
security: "/admin/courses/:courseId/configure/security",
|
|
467
|
+
certificateConfiguration: "/admin/courses/:courseId/configure/certificate_configuration"
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
pullRequestApps: {
|
|
471
|
+
index: "/admin/pull_request_apps",
|
|
472
|
+
show: "/admin/pull_request_apps/:pullRequestAppId",
|
|
473
|
+
courseDeployments: {
|
|
474
|
+
show: "/admin/pull_request_apps/:pullRequestAppId/course-deployments/:courseDeploymentId"
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
members: "/admin/members",
|
|
478
|
+
settings: {
|
|
479
|
+
index: "/admin/settings",
|
|
480
|
+
general: {
|
|
481
|
+
apiSettings: "/admin/settings/general/api-settings",
|
|
482
|
+
redirectUrls: "/admin/settings/general/redirect-urls",
|
|
483
|
+
basicInfos: "/admin/settings/general/basic-infos",
|
|
484
|
+
customDomains: {
|
|
485
|
+
index: "/admin/settings/general/custom-domains"
|
|
486
|
+
},
|
|
487
|
+
security: {
|
|
488
|
+
index: "/admin/settings/general/security"
|
|
489
|
+
},
|
|
490
|
+
roles: "/admin/settings/general/roles"
|
|
491
|
+
},
|
|
492
|
+
integrations: {
|
|
493
|
+
index: "/admin/settings/integrations",
|
|
494
|
+
stripe: {
|
|
495
|
+
index: "/admin/settings/integrations/stripe",
|
|
496
|
+
manage: "/admin/settings/integrations/stripe/manage"
|
|
497
|
+
},
|
|
498
|
+
googleAnalytics: {
|
|
499
|
+
index: "/admin/settings/integrations/google-analytics",
|
|
500
|
+
manage: "/admin/settings/integrations/google-analytics/manage"
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
reports: {
|
|
505
|
+
index: "/admin/reports",
|
|
506
|
+
invalidUrls: "/admin/reports/invalid-urls"
|
|
507
|
+
},
|
|
508
|
+
assets: {
|
|
509
|
+
index: "/admin/assets",
|
|
510
|
+
databases: "/admin/assets/databases",
|
|
511
|
+
videos: "/admin/assets/videos",
|
|
512
|
+
audios: "/admin/assets/audios",
|
|
513
|
+
resources: "/admin/assets/resources"
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
home: "/"
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
var buildSettingsBreadcrumbs = function buildSettingsBreadcrumbs(category, pageTitle) {
|
|
520
|
+
return [{
|
|
521
|
+
link: routes.admin.settings.index,
|
|
522
|
+
text: t("neetoRedirectUrls.settings.title")
|
|
523
|
+
}, {
|
|
524
|
+
link: buildUrl(routes.admin.settings.index, {
|
|
525
|
+
category: category.toLowerCase()
|
|
526
|
+
}),
|
|
527
|
+
text: SETTINGS_CATEGORIES_LABELS[category]
|
|
528
|
+
}].concat(_toConsumableArray(pageTitle ? [{
|
|
529
|
+
text: pageTitle
|
|
530
|
+
}] : []));
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
var buildBreadcrumbs = function buildBreadcrumbs(pageTitle) {
|
|
534
|
+
return buildSettingsBreadcrumbs(SETTINGS_CATEGORIES.GENERAL, pageTitle);
|
|
535
|
+
};
|
|
536
|
+
var buildMoreMenuItems = function buildMoreMenuItems(_ref) {
|
|
537
|
+
var redirectUrl = _ref.redirectUrl,
|
|
538
|
+
setUrlDetailsToEdit = _ref.setUrlDetailsToEdit,
|
|
539
|
+
setUrlDetailsToDelete = _ref.setUrlDetailsToDelete;
|
|
540
|
+
var id = redirectUrl.id,
|
|
541
|
+
fromPath = redirectUrl.fromPath,
|
|
542
|
+
toPath = redirectUrl.toPath;
|
|
543
|
+
return [{
|
|
544
|
+
key: "edit-menu",
|
|
545
|
+
label: t("neetoRedirectUrls.common.edit"),
|
|
546
|
+
onClick: function onClick() {
|
|
547
|
+
setUrlDetailsToEdit({
|
|
548
|
+
id: id,
|
|
549
|
+
fromPath: fromPath,
|
|
550
|
+
toPath: toPath
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
}, {
|
|
554
|
+
key: "delete-menu",
|
|
555
|
+
label: t("neetoRedirectUrls.common.delete"),
|
|
556
|
+
onClick: function onClick() {
|
|
557
|
+
setUrlDetailsToDelete({
|
|
558
|
+
id: id,
|
|
559
|
+
fromPath: fromPath,
|
|
560
|
+
toPath: toPath
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
}];
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
var RedirectUrlsTable = function RedirectUrlsTable(_ref) {
|
|
567
|
+
var _ref$redirectUrls = _ref.redirectUrls,
|
|
568
|
+
redirectUrls = _ref$redirectUrls === void 0 ? [] : _ref$redirectUrls,
|
|
569
|
+
currentPageNumber = _ref.currentPageNumber,
|
|
570
|
+
setCurrentPageNumber = _ref.setCurrentPageNumber,
|
|
571
|
+
recordsCount = _ref.recordsCount,
|
|
572
|
+
setUrlDetailsToEdit = _ref.setUrlDetailsToEdit,
|
|
573
|
+
setUrlDetailsToDelete = _ref.setUrlDetailsToDelete,
|
|
574
|
+
isFetching = _ref.isFetching;
|
|
575
|
+
var truncateUrl = function truncateUrl(url) {
|
|
576
|
+
var urlString = String(url);
|
|
577
|
+
return urlString.length <= 50 ? urlString : "".concat(urlString.slice(0, 50), "...");
|
|
578
|
+
};
|
|
579
|
+
var _useTranslation = useTranslation(),
|
|
580
|
+
t = _useTranslation.t;
|
|
581
|
+
var columnData = [{
|
|
582
|
+
title: t("neetoRedirectUrls.redirect.source"),
|
|
583
|
+
dataIndex: "source",
|
|
584
|
+
key: "name",
|
|
585
|
+
render: function render(_, redirectUrl) {
|
|
586
|
+
var fromPath = redirectUrl.fromPath;
|
|
587
|
+
return /*#__PURE__*/jsxs("div", {
|
|
588
|
+
className: "flex items-center justify-between gap-x-3",
|
|
589
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
590
|
+
children: fromPath && truncateUrl(fromPath)
|
|
591
|
+
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
592
|
+
dropdownProps: {
|
|
593
|
+
strategy: "fixed"
|
|
594
|
+
},
|
|
595
|
+
menuItems: buildMoreMenuItems({
|
|
596
|
+
redirectUrl: redirectUrl,
|
|
597
|
+
setUrlDetailsToEdit: setUrlDetailsToEdit,
|
|
598
|
+
setUrlDetailsToDelete: setUrlDetailsToDelete
|
|
599
|
+
})
|
|
600
|
+
})]
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
}, {
|
|
604
|
+
title: t("neetoRedirectUrls.redirect.destination"),
|
|
605
|
+
dataIndex: "toPath",
|
|
606
|
+
key: "toPath",
|
|
607
|
+
render: function render(toPath) {
|
|
608
|
+
return toPath && truncateUrl(toPath);
|
|
609
|
+
}
|
|
610
|
+
}];
|
|
611
|
+
return /*#__PURE__*/jsx(TableWrapper, {
|
|
612
|
+
hasPagination: recordsCount > DEFAULT_PAGE_SIZE,
|
|
613
|
+
children: /*#__PURE__*/jsx(Table, {
|
|
614
|
+
columnData: columnData,
|
|
615
|
+
currentPageNumber: currentPageNumber,
|
|
616
|
+
fixedHeight: true,
|
|
617
|
+
handlePageChange: function handlePageChange(page) {
|
|
618
|
+
return setCurrentPageNumber(page);
|
|
619
|
+
},
|
|
620
|
+
loading: isFetching,
|
|
621
|
+
rowData: redirectUrls,
|
|
622
|
+
totalCount: recordsCount,
|
|
623
|
+
paginationProps: {
|
|
624
|
+
hideOnSinglePage: recordsCount < DEFAULT_PAGE_SIZE + 1,
|
|
625
|
+
showSizeChanger: recordsCount > DEFAULT_PAGE_SIZE
|
|
626
|
+
}
|
|
627
|
+
})
|
|
628
|
+
});
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
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; }
|
|
632
|
+
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; }
|
|
633
|
+
var RedirectUrls = function RedirectUrls() {
|
|
634
|
+
var _useTranslation = useTranslation(),
|
|
635
|
+
t = _useTranslation.t;
|
|
636
|
+
var _useQueryParams = useQueryParams(),
|
|
637
|
+
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
638
|
+
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
639
|
+
var initialFocusField = useRef();
|
|
640
|
+
var _useState = useState(1),
|
|
641
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
642
|
+
currentPageNumber = _useState2[0],
|
|
643
|
+
setCurrentPageNumber = _useState2[1];
|
|
644
|
+
var _useState3 = useState(null),
|
|
645
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
646
|
+
urlDetailsToDelete = _useState4[0],
|
|
647
|
+
setUrlDetailsToDelete = _useState4[1];
|
|
648
|
+
var _useState5 = useState(null),
|
|
649
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
650
|
+
urlDetailsToEdit = _useState6[0],
|
|
651
|
+
setUrlDetailsToEdit = _useState6[1];
|
|
652
|
+
var _useState7 = useState(false),
|
|
653
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
654
|
+
isModalOpen = _useState8[0],
|
|
655
|
+
setIsModalOpen = _useState8[1];
|
|
656
|
+
var _useCreateRedirectUrl = useCreateRedirectUrl(),
|
|
657
|
+
createRedirectUrl = _useCreateRedirectUrl.mutate;
|
|
658
|
+
var searchQuery = _objectSpread({
|
|
659
|
+
page: currentPageNumber
|
|
660
|
+
}, isEmpty(searchTerm) ? {} : {
|
|
661
|
+
searchTerm: searchTerm
|
|
662
|
+
});
|
|
663
|
+
var _useFetchAllRedirectU = useFetchAllRedirectUrls({
|
|
664
|
+
params: searchQuery
|
|
665
|
+
}),
|
|
666
|
+
_useFetchAllRedirectU2 = _useFetchAllRedirectU.data,
|
|
667
|
+
_useFetchAllRedirectU3 = _useFetchAllRedirectU2 === void 0 ? {} : _useFetchAllRedirectU2,
|
|
668
|
+
_useFetchAllRedirectU4 = _useFetchAllRedirectU3.count,
|
|
669
|
+
urlCount = _useFetchAllRedirectU4 === void 0 ? 0 : _useFetchAllRedirectU4,
|
|
670
|
+
_useFetchAllRedirectU5 = _useFetchAllRedirectU3.redirectUrls,
|
|
671
|
+
redirectUrls = _useFetchAllRedirectU5 === void 0 ? [] : _useFetchAllRedirectU5,
|
|
672
|
+
domainRedirectUrl = _useFetchAllRedirectU3.domainRedirectUrl,
|
|
673
|
+
isLoading = _useFetchAllRedirectU.isLoading,
|
|
674
|
+
isFetching = _useFetchAllRedirectU.isFetching;
|
|
675
|
+
var isFiltersVisible = urlCount > 0 || isPresent(searchTerm);
|
|
676
|
+
var _useUpdateRedirectUrl = useUpdateRedirectUrl(),
|
|
677
|
+
updateRedirectUrl = _useUpdateRedirectUrl.mutate;
|
|
678
|
+
var _useDestroyRedirectUr = useDestroyRedirectUrl(),
|
|
679
|
+
deleteRedirectUrl = _useDestroyRedirectUr.mutate;
|
|
680
|
+
var handleCreateRedirectUrl = function handleCreateRedirectUrl(redirectUrl) {
|
|
681
|
+
createRedirectUrl(redirectUrl, {
|
|
682
|
+
onSuccess: function onSuccess() {
|
|
683
|
+
setIsModalOpen(false);
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
};
|
|
687
|
+
var handleRedirectUrlUpdate = function handleRedirectUrlUpdate(redirectUrl) {
|
|
688
|
+
updateRedirectUrl({
|
|
689
|
+
id: redirectUrl.id,
|
|
690
|
+
payload: redirectUrl
|
|
691
|
+
}, {
|
|
692
|
+
onSettled: function onSettled() {
|
|
693
|
+
setUrlDetailsToEdit(null);
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
};
|
|
697
|
+
var handleRedirectUrlDelete = function handleRedirectUrlDelete(urlId) {
|
|
698
|
+
deleteRedirectUrl(urlId, {
|
|
699
|
+
onSettled: function onSettled() {
|
|
700
|
+
setUrlDetailsToDelete(null);
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
};
|
|
704
|
+
var pageTitle = t("neetoRedirectUrls.settings.redirecturl.title");
|
|
705
|
+
var setInitialFocusField = function setInitialFocusField(fieldRef) {
|
|
706
|
+
return initialFocusField.current = fieldRef;
|
|
707
|
+
};
|
|
708
|
+
return /*#__PURE__*/jsx(Container, {
|
|
709
|
+
className: "w-full",
|
|
710
|
+
children: isLoading ? /*#__PURE__*/jsx(PageLoader, {}) : /*#__PURE__*/jsxs(Fragment, {
|
|
711
|
+
children: [" ", /*#__PURE__*/jsx(Header, {
|
|
712
|
+
breadcrumbs: buildBreadcrumbs(pageTitle),
|
|
713
|
+
title: pageTitle,
|
|
714
|
+
actionBlock: /*#__PURE__*/jsx(Button, {
|
|
715
|
+
label: t("neetoRedirectUrls.redirect.add"),
|
|
716
|
+
onClick: function onClick() {
|
|
717
|
+
return setIsModalOpen(true);
|
|
718
|
+
}
|
|
719
|
+
}),
|
|
720
|
+
searchProps: isFiltersVisible && {
|
|
721
|
+
placeholder: t("neetoRedirectUrls.redirect.search")
|
|
722
|
+
}
|
|
723
|
+
}), /*#__PURE__*/jsxs(Fragment, {
|
|
724
|
+
children: [isEmpty(redirectUrls) ? /*#__PURE__*/jsx("div", {
|
|
725
|
+
className: "flex h-full w-full items-center justify-center",
|
|
726
|
+
children: /*#__PURE__*/jsx(NoData, {
|
|
727
|
+
title: t("neetoRedirectUrls.emptyState.redirectURLs.title"),
|
|
728
|
+
helpText: /*#__PURE__*/jsx(Trans, {
|
|
729
|
+
i18nKey: "neetoRedirectUrls.emptyState.redirectURLs.description",
|
|
730
|
+
components: {
|
|
731
|
+
helpLink: /*#__PURE__*/jsx("a", {
|
|
732
|
+
className: "text-blue-600 underline",
|
|
733
|
+
href: CREATE_REDIRECT_URL_HELP_DOC_URL,
|
|
734
|
+
rel: "noreferrer",
|
|
735
|
+
target: "_blank"
|
|
736
|
+
})
|
|
737
|
+
}
|
|
738
|
+
}),
|
|
739
|
+
primaryButtonProps: {
|
|
740
|
+
label: t("neetoRedirectUrls.redirect.add"),
|
|
741
|
+
onClick: function onClick() {
|
|
742
|
+
return setIsModalOpen(true);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
})
|
|
746
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
747
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
748
|
+
className: "w-full",
|
|
749
|
+
children: /*#__PURE__*/jsx(DomainRedirection, {
|
|
750
|
+
domainRedirectUrl: domainRedirectUrl
|
|
751
|
+
})
|
|
752
|
+
}), /*#__PURE__*/jsx(RedirectUrlsTable, {
|
|
753
|
+
currentPageNumber: currentPageNumber,
|
|
754
|
+
isFetching: isFetching,
|
|
755
|
+
redirectUrls: redirectUrls,
|
|
756
|
+
setCurrentPageNumber: setCurrentPageNumber,
|
|
757
|
+
setUrlDetailsToDelete: setUrlDetailsToDelete,
|
|
758
|
+
setUrlDetailsToEdit: setUrlDetailsToEdit,
|
|
759
|
+
recordsCount: urlCount
|
|
760
|
+
})]
|
|
761
|
+
}), /*#__PURE__*/jsx(DeleteRedirectUrlModal, {
|
|
762
|
+
detailsToDelete: urlDetailsToDelete,
|
|
763
|
+
handleClose: function handleClose() {
|
|
764
|
+
return setUrlDetailsToDelete(null);
|
|
765
|
+
},
|
|
766
|
+
handleSubmit: handleRedirectUrlDelete,
|
|
767
|
+
isOpen: urlDetailsToDelete !== null
|
|
768
|
+
}), /*#__PURE__*/jsx(Pane, {
|
|
769
|
+
initialFocusRef: initialFocusField,
|
|
770
|
+
isOpen: isModalOpen || isNotNil(urlDetailsToEdit),
|
|
771
|
+
onClose: function onClose() {
|
|
772
|
+
setIsModalOpen(false);
|
|
773
|
+
setUrlDetailsToEdit(null);
|
|
774
|
+
},
|
|
775
|
+
children: /*#__PURE__*/jsx(RedirectUrlPane, {
|
|
776
|
+
setInitialFocusField: setInitialFocusField,
|
|
777
|
+
handleClose: function handleClose() {
|
|
778
|
+
return setIsModalOpen(false);
|
|
779
|
+
},
|
|
780
|
+
initialValues: urlDetailsToEdit !== null && urlDetailsToEdit !== void 0 ? urlDetailsToEdit : {},
|
|
781
|
+
handleSubmit: isNotNil(urlDetailsToEdit) ? handleRedirectUrlUpdate : handleCreateRedirectUrl
|
|
782
|
+
})
|
|
783
|
+
})]
|
|
784
|
+
})]
|
|
785
|
+
})
|
|
786
|
+
});
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
export { RedirectUrls as default };
|
|
790
|
+
//# sourceMappingURL=RedirectUrls.js.map
|