@logora/debate 0.4.83 → 0.4.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,104 +1,107 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useAuthInterceptor as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { jsx as A, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k, useEffect as C } from "react";
|
|
3
|
+
import { useConfig as T } from "../../data/config_provider/useConfig.js";
|
|
4
|
+
import { useAuthInterceptor as I } from "../use_auth/useAuthInterceptor.js";
|
|
5
|
+
import { useAuth as S } from "../use_auth/useAuth.js";
|
|
6
|
+
import { authTokenHandler as q } from "../use_auth/authTokenHandler.js";
|
|
7
|
+
import { useAuthActions as B } from "../use_auth/useAuthActions.js";
|
|
8
|
+
import { useAuthRequired as D } from "../../hooks/use_auth_required/useAuthRequired.js";
|
|
9
|
+
import { AuthProviderFactory as F } from "../providers/AuthProviderFactory.js";
|
|
10
|
+
import { OnboardingModal as J } from "../../user/onboarding_modal/OnboardingModal.js";
|
|
11
|
+
import { saveOnboardingBeforeLogin as M } from "../../user/onboarding_modal/useOnboarding.js";
|
|
11
12
|
import { httpClient as d } from "../../data/axios_client/httpClient.js";
|
|
12
|
-
const
|
|
13
|
+
const j = (e) => {
|
|
13
14
|
const t = e.replace(/-/g, "+").replace(/_/g, "/"), a = t.padEnd(t.length + (4 - t.length % 4) % 4, "=");
|
|
14
15
|
return new TextDecoder().decode(Uint8Array.from(atob(a), (r) => r.charCodeAt(0)));
|
|
15
|
-
},
|
|
16
|
+
}, x = (e) => {
|
|
16
17
|
if (!e || typeof e != "string")
|
|
17
18
|
return null;
|
|
18
19
|
const t = e.split(".");
|
|
19
20
|
if (t.length < 2)
|
|
20
21
|
return null;
|
|
21
22
|
try {
|
|
22
|
-
return JSON.parse(
|
|
23
|
+
return JSON.parse(j(t[1]));
|
|
23
24
|
} catch {
|
|
24
25
|
return null;
|
|
25
26
|
}
|
|
26
|
-
},
|
|
27
|
+
}, z = (e, t) => {
|
|
27
28
|
if (!e || typeof e != "object")
|
|
28
29
|
return {};
|
|
29
30
|
const a = t || {}, r = (u) => {
|
|
30
31
|
const o = a[u];
|
|
31
|
-
return typeof o == "string" && o.length > 0 ? o.split(".").reduce((
|
|
32
|
+
return typeof o == "string" && o.length > 0 ? o.split(".").reduce((i, c) => i == null ? i : i[c], e) : e[u];
|
|
32
33
|
};
|
|
33
34
|
return {
|
|
34
35
|
first_name: r("first_name"),
|
|
35
36
|
last_name: r("last_name"),
|
|
36
37
|
image_url: r("image_url")
|
|
37
38
|
};
|
|
38
|
-
},
|
|
39
|
-
const u = "logora_user_token", o =
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
39
|
+
}, ee = ({ authUrl: e, authType: t, provider: a, assertion: r }) => {
|
|
40
|
+
const u = "logora_user_token", o = T();
|
|
41
|
+
I(d, e, u);
|
|
42
|
+
const i = z(
|
|
43
|
+
x(r),
|
|
43
44
|
o.auth?.userProfileMapping
|
|
44
|
-
), [
|
|
45
|
+
), [c, m] = k(!1), { setAuthError: b } = S(), { getToken: P, removeToken: U, fetchToken: y } = q(
|
|
45
46
|
d,
|
|
46
47
|
e,
|
|
47
48
|
u
|
|
48
|
-
), { loginUser:
|
|
49
|
+
), { loginUser: g, logoutUser: E, fetchUser: p } = B(
|
|
49
50
|
d,
|
|
50
51
|
e,
|
|
51
52
|
u
|
|
52
|
-
),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, []),
|
|
53
|
+
), w = D();
|
|
54
|
+
C(() => {
|
|
55
|
+
h();
|
|
56
|
+
}, []), C(() => {
|
|
56
57
|
if (typeof window < "u")
|
|
57
|
-
return window.addEventListener("logora:authentication:require",
|
|
58
|
-
window.removeEventListener("logora:authentication:require",
|
|
58
|
+
return window.addEventListener("logora:authentication:require", w), window.addEventListener("logora:authentication:refresh", h), () => {
|
|
59
|
+
window.removeEventListener("logora:authentication:require", w), window.removeEventListener("logora:authentication:refresh", h);
|
|
59
60
|
};
|
|
60
61
|
}, []);
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
const
|
|
65
|
-
|
|
62
|
+
const h = () => {
|
|
63
|
+
const s = v(), n = P();
|
|
64
|
+
if (n) {
|
|
65
|
+
const f = n.session_id;
|
|
66
|
+
s.isSameUser(f) ? p() : (U(), _(s));
|
|
66
67
|
} else
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
-
if (
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
68
|
+
_(s);
|
|
69
|
+
}, _ = (s) => {
|
|
70
|
+
if (s.shouldInitAuth()) {
|
|
71
|
+
const n = s.getAuthorizationParams();
|
|
72
|
+
if (n) {
|
|
72
73
|
if (t !== "social" && t !== "oauth2_server" && o.auth?.showOnboardingBeforeLogin === !0) {
|
|
73
|
-
|
|
74
|
+
y({ ...n, create_user: !1 }).then(() => p()).catch((l) => {
|
|
75
|
+
l?.response?.data?.error_description === "user_not_found" ? m(!0) : b(l);
|
|
76
|
+
});
|
|
74
77
|
return;
|
|
75
78
|
}
|
|
76
|
-
|
|
79
|
+
g(n);
|
|
77
80
|
}
|
|
78
81
|
} else
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
return /* @__PURE__ */
|
|
85
|
-
|
|
82
|
+
E();
|
|
83
|
+
}, L = (s, n) => {
|
|
84
|
+
const l = v().getAuthorizationParams();
|
|
85
|
+
M(o.shortname, n), m(!1), g(l);
|
|
86
|
+
}, v = () => F.create(t, a, r);
|
|
87
|
+
return /* @__PURE__ */ A(O, { children: c && /* @__PURE__ */ A(
|
|
88
|
+
J,
|
|
86
89
|
{
|
|
87
90
|
pendingAuth: !0,
|
|
88
|
-
onConsentConfirmed:
|
|
91
|
+
onConsentConfirmed: L,
|
|
89
92
|
showCloseButton: o.auth?.allowCloseOnboardingBeforeLogin === !0,
|
|
90
|
-
onClose: () =>
|
|
93
|
+
onClose: () => m(!1),
|
|
91
94
|
showTerms: o.auth?.hideCgu !== !0,
|
|
92
95
|
showEmailConsent: o.auth?.showEmailConsent,
|
|
93
|
-
initialFirstName:
|
|
94
|
-
initialLastName:
|
|
95
|
-
initialImageUrl:
|
|
96
|
+
initialFirstName: i.first_name,
|
|
97
|
+
initialLastName: i.last_name,
|
|
98
|
+
initialImageUrl: i.image_url,
|
|
96
99
|
termsUrl: o.provider?.cguUrl || "https://www.logora.com/blog-posts/cgu",
|
|
97
100
|
privacyUrl: o.provider?.privacyUrl || "https://www.logora.com/blog-posts/privacy-policy"
|
|
98
101
|
}
|
|
99
102
|
) });
|
|
100
103
|
};
|
|
101
104
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
ee as AuthInitializer,
|
|
106
|
+
x as decodeJwtPayload
|
|
104
107
|
};
|
|
@@ -1,256 +1,257 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import { useLocation as
|
|
7
|
-
import
|
|
8
|
-
import { ActionBar as
|
|
9
|
-
import { useList as
|
|
10
|
-
import { useDataProvider as
|
|
11
|
-
import { useResponsive as
|
|
12
|
-
import { useData as
|
|
13
|
-
import { uniqueBy as
|
|
14
|
-
import { Pagination as
|
|
15
|
-
import { StandardErrorBoundary as
|
|
16
|
-
const
|
|
17
|
-
query:
|
|
1
|
+
import { jsxs as I, jsx as u, Fragment as Ie } from "react/jsx-runtime";
|
|
2
|
+
import We from "@rooks/use-previous";
|
|
3
|
+
import ze from "classnames";
|
|
4
|
+
import Ge, { useState as f, useEffect as y } from "react";
|
|
5
|
+
import { useIntl as Ve } from "react-intl";
|
|
6
|
+
import { useLocation as Xe } from "react-router";
|
|
7
|
+
import a from "./PaginatedList.module.scss.js";
|
|
8
|
+
import { ActionBar as Ye } from "./action_bar/ActionBar.js";
|
|
9
|
+
import { useList as Ze } from "../list_provider/useList.js";
|
|
10
|
+
import { useDataProvider as He } from "../../data/data_provider/useDataProvider.js";
|
|
11
|
+
import { useResponsive as Pe } from "../../hooks/use_responsive/useResponsive.js";
|
|
12
|
+
import { useData as Ke } from "../../data/data_provider/useData.js";
|
|
13
|
+
import { uniqueBy as L } from "../../util/unique_by/uniqueBy.js";
|
|
14
|
+
import { Pagination as Oe } from "../pagination/Pagination.js";
|
|
15
|
+
import { StandardErrorBoundary as qe } from "../../error/standard_error_boundary/StandardErrorBoundary.js";
|
|
16
|
+
const Et = ({
|
|
17
|
+
query: w,
|
|
18
18
|
sortOptions: o,
|
|
19
|
-
sort:
|
|
19
|
+
sort: R,
|
|
20
20
|
filters: m,
|
|
21
|
-
tagList:
|
|
22
|
-
pinnedTagList:
|
|
23
|
-
currentPage:
|
|
24
|
-
resource:
|
|
25
|
-
currentListId:
|
|
26
|
-
withToken:
|
|
27
|
-
perPage:
|
|
28
|
-
perPageParam:
|
|
29
|
-
pageParam:
|
|
30
|
-
sortParam:
|
|
31
|
-
queryParam:
|
|
32
|
-
tagParam:
|
|
33
|
-
totalHeaderParam:
|
|
34
|
-
onUpdateTotal:
|
|
35
|
-
onElementsLoad:
|
|
36
|
-
transformData:
|
|
21
|
+
tagList: ie,
|
|
22
|
+
pinnedTagList: oe,
|
|
23
|
+
currentPage: b,
|
|
24
|
+
resource: D,
|
|
25
|
+
currentListId: n,
|
|
26
|
+
withToken: me,
|
|
27
|
+
perPage: E,
|
|
28
|
+
perPageParam: re = "per_page",
|
|
29
|
+
pageParam: de = "page",
|
|
30
|
+
sortParam: fe = "sort",
|
|
31
|
+
queryParam: ce = "query",
|
|
32
|
+
tagParam: ge = "tag_id",
|
|
33
|
+
totalHeaderParam: J = "total",
|
|
34
|
+
onUpdateTotal: W,
|
|
35
|
+
onElementsLoad: k,
|
|
36
|
+
transformData: z,
|
|
37
37
|
uniqueIdKey: S = "id",
|
|
38
|
-
children:
|
|
39
|
-
resourcePropName:
|
|
40
|
-
loadingComponent:
|
|
41
|
-
searchBar:
|
|
42
|
-
title:
|
|
43
|
-
subtitle:
|
|
44
|
-
showDebateConsultationSubtitle:
|
|
45
|
-
emptyListComponent:
|
|
46
|
-
emptyText:
|
|
47
|
-
display:
|
|
48
|
-
elementsPerLine:
|
|
49
|
-
indexLayout:
|
|
50
|
-
gap:
|
|
51
|
-
withPagination:
|
|
52
|
-
numberElements:
|
|
53
|
-
countless:
|
|
54
|
-
onElementClick:
|
|
55
|
-
withUrlParams:
|
|
56
|
-
onLoadNewPage:
|
|
38
|
+
children: ue,
|
|
39
|
+
resourcePropName: Ee,
|
|
40
|
+
loadingComponent: G,
|
|
41
|
+
searchBar: he = !1,
|
|
42
|
+
title: pe,
|
|
43
|
+
subtitle: ve,
|
|
44
|
+
showDebateConsultationSubtitle: ye = !1,
|
|
45
|
+
emptyListComponent: V,
|
|
46
|
+
emptyText: X,
|
|
47
|
+
display: Y,
|
|
48
|
+
elementsPerLine: Z,
|
|
49
|
+
indexLayout: Se = !1,
|
|
50
|
+
gap: Me = "1em",
|
|
51
|
+
withPagination: Ne = !0,
|
|
52
|
+
numberElements: H,
|
|
53
|
+
countless: C,
|
|
54
|
+
onElementClick: we,
|
|
55
|
+
withUrlParams: Re = !1,
|
|
56
|
+
onLoadNewPage: P
|
|
57
57
|
}) => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
), [
|
|
58
|
+
const j = Ve(), t = Ze(), K = He(), O = Xe(), { isMobile: q, isTablet: be, isDesktop: B } = Pe(), r = new URLSearchParams(O.search), [T, h] = f(!1), [ke, Ce] = f(!1), [c, M] = Ke(n, []), [ee, Te] = f(
|
|
59
|
+
c?.length || 0
|
|
60
|
+
), [te, Ae] = f(!0), [p, Q] = f(b || 1), [N, U] = f(w || null), [A, se] = f(
|
|
61
61
|
r.get("tagId") ? Number.parseInt(r.get("tagId"), 10) : null
|
|
62
|
-
), [
|
|
62
|
+
), [Fe, ne] = f(null), _e = () => o && o[0].type === "sort" && o[0].value || R || "", xe = () => {
|
|
63
63
|
let e = {};
|
|
64
64
|
return o && o[0].type === "filter" && (e[o[0].name] = o[0].value), m && (e = Object.assign({}, e, m)), e;
|
|
65
|
-
}, [
|
|
66
|
-
|
|
67
|
-
if (r.get("tagId") &&
|
|
68
|
-
|
|
65
|
+
}, [F, _] = f(_e()), [$, x] = f(xe()), ae = We(m);
|
|
66
|
+
b && b !== p && Q(b), w !== void 0 && w !== N && U(w), R !== void 0 && R !== F && _(R), ae && JSON.stringify(m) !== JSON.stringify(ae) && JSON.stringify(m) !== JSON.stringify($) && x(m), y(() => {
|
|
67
|
+
if (r.get("tagId") && se(Number.parseInt(r.get("tagId"))), r.get("search") && U(r.get("search")), r.get("sort")) {
|
|
68
|
+
_(r.get("sort"));
|
|
69
69
|
for (const e of r.values()) {
|
|
70
70
|
o?.map((s) => {
|
|
71
|
-
s.value === e &&
|
|
71
|
+
s.value === e && ne(s.name);
|
|
72
72
|
});
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
for (const e of r.keys()) {
|
|
77
77
|
o?.map((s) => {
|
|
78
|
-
s.name === e && (
|
|
78
|
+
s.name === e && (x({
|
|
79
79
|
...m,
|
|
80
80
|
[s.name]: s.value
|
|
81
|
-
}),
|
|
81
|
+
}), ne(s.name));
|
|
82
82
|
});
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
|
-
}, [
|
|
86
|
-
|
|
85
|
+
}, [O.search]), y(() => {
|
|
86
|
+
D ? (Q(1), M([]), h(!0), le(1)) : h(!1);
|
|
87
87
|
}, [
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
F,
|
|
89
|
+
$,
|
|
90
90
|
N,
|
|
91
|
+
D,
|
|
91
92
|
A,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Ae(t.addElements[a]);
|
|
93
|
+
E
|
|
94
|
+
]), y(() => {
|
|
95
|
+
p > 1 && (h(!0), le(p));
|
|
96
|
+
}, [p]), y(() => {
|
|
97
|
+
if (t.addElements && n in t.addElements && t.addElements[n].length > 0) {
|
|
98
|
+
Je(t.addElements[n]);
|
|
99
99
|
const e = t.addElements;
|
|
100
|
-
delete e[
|
|
100
|
+
delete e[n], t.setAddElements(e);
|
|
101
101
|
}
|
|
102
|
-
}, [t.addElements]),
|
|
103
|
-
if (t.updateElements &&
|
|
104
|
-
const e = t.updateElements[
|
|
102
|
+
}, [t.addElements]), y(() => {
|
|
103
|
+
if (t.updateElements && n in t.updateElements) {
|
|
104
|
+
const e = t.updateElements[n];
|
|
105
105
|
if (e.length > 0) {
|
|
106
106
|
const s = e.filter(
|
|
107
|
-
(i) =>
|
|
107
|
+
(i) => c.some((l) => l.id === i.id)
|
|
108
108
|
);
|
|
109
109
|
if (s.length > 0) {
|
|
110
|
-
|
|
110
|
+
je(s);
|
|
111
111
|
const i = e.filter(
|
|
112
|
-
(
|
|
113
|
-
),
|
|
114
|
-
i.length > 0 ? n
|
|
112
|
+
(d) => !c.some((v) => v.id === d.id)
|
|
113
|
+
), l = { ...t.updateElements };
|
|
114
|
+
i.length > 0 ? l[n] = i : delete l[n], t.setUpdateElements(l);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
}, [t.updateElements,
|
|
119
|
-
if (t.removeElements &&
|
|
120
|
-
|
|
118
|
+
}, [t.updateElements, c]), y(() => {
|
|
119
|
+
if (t.removeElements && n in t.removeElements && t.removeElements[n].length > 0 && c.length > 0) {
|
|
120
|
+
Be(t.removeElements[n]);
|
|
121
121
|
const e = { ...t.removeElements };
|
|
122
|
-
delete e[
|
|
122
|
+
delete e[n], t.setRemoveElements(e);
|
|
123
123
|
}
|
|
124
|
-
}, [t.removeElements,
|
|
125
|
-
const
|
|
126
|
-
e.type === "filter" ? (
|
|
124
|
+
}, [t.removeElements, c]);
|
|
125
|
+
const Le = (e) => {
|
|
126
|
+
e.type === "filter" ? (_(""), x({
|
|
127
127
|
...m,
|
|
128
128
|
[e.name]: e.value
|
|
129
|
-
})) : (
|
|
130
|
-
},
|
|
131
|
-
typeof
|
|
132
|
-
},
|
|
133
|
-
const s =
|
|
134
|
-
if ((e - 1) *
|
|
135
|
-
const
|
|
136
|
-
[
|
|
137
|
-
[
|
|
138
|
-
...
|
|
139
|
-
...N && { [
|
|
140
|
-
...
|
|
141
|
-
|
|
142
|
-
...
|
|
129
|
+
})) : (_(e.value), x(m ? { ...m } : {}));
|
|
130
|
+
}, De = () => {
|
|
131
|
+
typeof P == "function" && P() !== null || Q(p + 1);
|
|
132
|
+
}, le = (e) => {
|
|
133
|
+
const s = me ? K.getListWithToken : K.getList;
|
|
134
|
+
if (C === !0 ? te || e === 1 : (e - 1) * E <= (H || ee) || e === 1) {
|
|
135
|
+
const l = {
|
|
136
|
+
[de]: e,
|
|
137
|
+
[re]: E,
|
|
138
|
+
...F && !N && { [fe]: F },
|
|
139
|
+
...N && { [ce]: N },
|
|
140
|
+
...C === !0 && { countless: !0 },
|
|
141
|
+
...$,
|
|
142
|
+
...A && { [ge]: A }
|
|
143
143
|
};
|
|
144
|
-
s(
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
Number.parseInt(
|
|
148
|
-
),
|
|
149
|
-
let g =
|
|
150
|
-
|
|
151
|
-
}).catch((
|
|
152
|
-
console.error(
|
|
144
|
+
s(D, l).then((d) => {
|
|
145
|
+
const v = d.headers;
|
|
146
|
+
v && J in v && (Te(
|
|
147
|
+
Number.parseInt(v[J || "total"], 10)
|
|
148
|
+
), W && W(v[J || "total"]));
|
|
149
|
+
let g = d?.data?.data;
|
|
150
|
+
C === !0 && Array.isArray(g) && Ae(g.length >= E), k && k(g), z && (g = g.filter(z)), t.addElements && n in t.addElements && t.addElements[n].length > 0 && (g = [...t.addElements[n], g]), Qe(g), h(!1);
|
|
151
|
+
}).catch((d) => {
|
|
152
|
+
console.error(d), d?.response?.status !== 404 && Ce(!0), h(!1);
|
|
153
153
|
});
|
|
154
154
|
} else
|
|
155
|
-
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
(s) =>
|
|
159
|
-
),
|
|
160
|
-
},
|
|
161
|
-
|
|
155
|
+
h(!1);
|
|
156
|
+
}, Je = (e) => {
|
|
157
|
+
M(
|
|
158
|
+
(s) => L([...e, ...s], S || "id")
|
|
159
|
+
), k && k(e);
|
|
160
|
+
}, je = (e) => {
|
|
161
|
+
M((s) => {
|
|
162
162
|
let i = s;
|
|
163
163
|
return e.forEach(
|
|
164
|
-
(
|
|
165
|
-
(
|
|
164
|
+
(l) => i = i.map(
|
|
165
|
+
(d) => d.id === l.id ? l : d
|
|
166
166
|
)
|
|
167
|
-
),
|
|
167
|
+
), L(i, S || "id");
|
|
168
168
|
});
|
|
169
|
-
},
|
|
170
|
-
const s = e.map((
|
|
171
|
-
(
|
|
169
|
+
}, Be = (e) => {
|
|
170
|
+
const s = e.map((l) => l.id), i = c.filter(
|
|
171
|
+
(l) => s.indexOf(l.id) === -1
|
|
172
172
|
);
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
(s) =>
|
|
173
|
+
M(L(i, S || "id"));
|
|
174
|
+
}, Qe = (e) => {
|
|
175
|
+
M(
|
|
176
|
+
(s) => L([...s, ...e], S || "id")
|
|
177
177
|
);
|
|
178
|
-
},
|
|
178
|
+
}, Ue = (e, s) => e !== void 0 ? /* @__PURE__ */ u(
|
|
179
179
|
"li",
|
|
180
180
|
{
|
|
181
|
-
className:
|
|
181
|
+
className: a.paginatedListItem,
|
|
182
182
|
"data-testid": "list-item",
|
|
183
|
-
onClick:
|
|
184
|
-
children: /* @__PURE__ */ u(
|
|
183
|
+
onClick: we,
|
|
184
|
+
children: /* @__PURE__ */ u(qe, { hideMessage: !0, children: Ge.cloneElement(ue, {
|
|
185
185
|
index: s,
|
|
186
|
-
[
|
|
186
|
+
[Ee]: e
|
|
187
187
|
}) })
|
|
188
188
|
},
|
|
189
189
|
`${e[S || "id"]}_${e.updated_at || e.content}`
|
|
190
|
-
) : null,
|
|
191
|
-
if (
|
|
190
|
+
) : null, $e = (e) => G ? /* @__PURE__ */ u("li", { className: a.paginatedListItem, children: G }, e) : null;
|
|
191
|
+
if (ke)
|
|
192
192
|
throw new Error(
|
|
193
|
-
|
|
193
|
+
j.formatMessage({
|
|
194
194
|
id: "error.list",
|
|
195
195
|
defaultMessage: "Error when loading content."
|
|
196
196
|
})
|
|
197
197
|
);
|
|
198
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ I("div", { className: a.listContainer, children: [
|
|
199
199
|
/* @__PURE__ */ u(
|
|
200
|
-
|
|
200
|
+
Ye,
|
|
201
201
|
{
|
|
202
|
-
title:
|
|
203
|
-
subtitle:
|
|
204
|
-
showDebateConsultationSubtitle:
|
|
202
|
+
title: pe,
|
|
203
|
+
subtitle: ve,
|
|
204
|
+
showDebateConsultationSubtitle: ye,
|
|
205
205
|
sortOptions: o,
|
|
206
|
-
defaultSelectOption:
|
|
207
|
-
searchBar:
|
|
208
|
-
tagList:
|
|
209
|
-
pinnedTagList:
|
|
210
|
-
activeTagId:
|
|
211
|
-
onSearch: (e) =>
|
|
212
|
-
onSortChange:
|
|
213
|
-
onTagChange: (e) =>
|
|
214
|
-
withUrlParams:
|
|
206
|
+
defaultSelectOption: Fe,
|
|
207
|
+
searchBar: he,
|
|
208
|
+
tagList: ie,
|
|
209
|
+
pinnedTagList: oe,
|
|
210
|
+
activeTagId: A,
|
|
211
|
+
onSearch: (e) => U(e),
|
|
212
|
+
onSortChange: Le,
|
|
213
|
+
onTagChange: (e) => se(e),
|
|
214
|
+
withUrlParams: Re
|
|
215
215
|
}
|
|
216
216
|
),
|
|
217
|
-
!
|
|
217
|
+
!T && c.length === 0 ? V ? /* @__PURE__ */ u("div", { className: a.emptyListElement, children: V }) : /* @__PURE__ */ u("div", { className: a.emptyList, children: X || j.formatMessage({
|
|
218
218
|
id: "info.emptyList",
|
|
219
219
|
defaultMessage: "No items for now."
|
|
220
|
-
}) }) : /* @__PURE__ */
|
|
221
|
-
/* @__PURE__ */
|
|
220
|
+
}) }) : /* @__PURE__ */ I(Ie, { children: [
|
|
221
|
+
/* @__PURE__ */ I(
|
|
222
222
|
"ul",
|
|
223
223
|
{
|
|
224
|
-
className:
|
|
225
|
-
[
|
|
226
|
-
[
|
|
227
|
-
[
|
|
228
|
-
[
|
|
229
|
-
[
|
|
230
|
-
[
|
|
231
|
-
[
|
|
232
|
-
[
|
|
233
|
-
[
|
|
224
|
+
className: ze(a.paginatedList, {
|
|
225
|
+
[a.paginatedListIsTablet]: !q && !B,
|
|
226
|
+
[a.centeredList]: Y === "column",
|
|
227
|
+
[a.column]: Y === "column",
|
|
228
|
+
[a.twoElementsPerLine]: Z === 2,
|
|
229
|
+
[a.oneElementPerLine]: Z === 1,
|
|
230
|
+
[a.indexLayoutList]: Se,
|
|
231
|
+
[a.listIsDesktop]: B,
|
|
232
|
+
[a.listIsTablet]: be && !B,
|
|
233
|
+
[a.listIsMobile]: q
|
|
234
234
|
}),
|
|
235
|
-
style: { gap:
|
|
235
|
+
style: { gap: Me },
|
|
236
236
|
children: [
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
c.map(Ue),
|
|
238
|
+
T ? Array(E).fill().map((e, s) => s).map($e) : null
|
|
239
239
|
]
|
|
240
240
|
}
|
|
241
241
|
),
|
|
242
|
-
!
|
|
243
|
-
|
|
242
|
+
!T && Ne !== !1 && /* @__PURE__ */ u(
|
|
243
|
+
Oe,
|
|
244
244
|
{
|
|
245
|
-
buttonText:
|
|
245
|
+
buttonText: j.formatMessage({
|
|
246
246
|
id: "action.see_more",
|
|
247
247
|
defaultMessage: "See more"
|
|
248
248
|
}),
|
|
249
|
-
currentPage:
|
|
250
|
-
perPage:
|
|
251
|
-
totalElements:
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
currentPage: p,
|
|
250
|
+
perPage: E,
|
|
251
|
+
totalElements: H || ee,
|
|
252
|
+
hasMore: C === !0 ? te : void 0,
|
|
253
|
+
onLoad: De,
|
|
254
|
+
isLoading: T,
|
|
254
255
|
hideLoader: !0,
|
|
255
256
|
"data-tid": "list_read_more"
|
|
256
257
|
}
|
|
@@ -259,5 +260,5 @@ const ct = ({
|
|
|
259
260
|
] });
|
|
260
261
|
};
|
|
261
262
|
export {
|
|
262
|
-
|
|
263
|
+
Et as PaginatedList
|
|
263
264
|
};
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import { jsx as i, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Loader as
|
|
7
|
-
const
|
|
8
|
-
currentPage:
|
|
9
|
-
perPage:
|
|
1
|
+
import { jsx as i, Fragment as p } from "react/jsx-runtime";
|
|
2
|
+
import { useState as s, useEffect as a } from "react";
|
|
3
|
+
import g from "./Pagination.module.scss.js";
|
|
4
|
+
import { Button as x } from "../../action/button/Button.js";
|
|
5
|
+
import { Icon as u } from "../../icons/icon/Icon.js";
|
|
6
|
+
import { Loader as N } from "../../progress/loader/Loader.js";
|
|
7
|
+
const y = ({
|
|
8
|
+
currentPage: t,
|
|
9
|
+
perPage: n,
|
|
10
10
|
totalElements: o,
|
|
11
|
-
buttonText:
|
|
12
|
-
onLoad:
|
|
13
|
-
isLoading:
|
|
14
|
-
hideLoader:
|
|
15
|
-
|
|
11
|
+
buttonText: f,
|
|
12
|
+
onLoad: c,
|
|
13
|
+
isLoading: d,
|
|
14
|
+
hideLoader: e,
|
|
15
|
+
hasMore: r,
|
|
16
|
+
...h
|
|
16
17
|
}) => {
|
|
17
|
-
const [
|
|
18
|
-
r
|
|
18
|
+
const [l, m] = s(
|
|
19
|
+
r ?? t * n < o
|
|
19
20
|
);
|
|
20
|
-
return
|
|
21
|
-
o > 0 &&
|
|
22
|
-
}, [o, r]), /* @__PURE__ */ i(
|
|
23
|
-
|
|
21
|
+
return a(() => {
|
|
22
|
+
r !== void 0 ? m(r) : o > 0 && m(t * n < o);
|
|
23
|
+
}, [o, t, r]), /* @__PURE__ */ i(p, { children: l ? /* @__PURE__ */ i("div", { className: g.paginationBox, children: d ? e ? null : /* @__PURE__ */ i(N, {}) : /* @__PURE__ */ i(
|
|
24
|
+
x,
|
|
24
25
|
{
|
|
25
|
-
handleClick:
|
|
26
|
-
...
|
|
27
|
-
rightIcon: /* @__PURE__ */ i(
|
|
28
|
-
children:
|
|
26
|
+
handleClick: c,
|
|
27
|
+
...h,
|
|
28
|
+
rightIcon: /* @__PURE__ */ i(u, { name: "lightArrow", height: 10, width: 10 }),
|
|
29
|
+
children: f
|
|
29
30
|
}
|
|
30
31
|
) }) : null });
|
|
31
32
|
};
|
|
32
33
|
export {
|
|
33
|
-
|
|
34
|
+
y as Pagination
|
|
34
35
|
};
|