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