@ukpc-lib/react 0.4.5 → 0.4.7

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.
@@ -5356,7 +5356,6 @@ const Ap = {
5356
5356
  closeButton: N_,
5357
5357
  toastId: "notify",
5358
5358
  position: "top-right",
5359
- closeOnClick: !1,
5360
5359
  hideProgressBar: !0,
5361
5360
  containerId: "toastifyNotification",
5362
5361
  style: {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.module-dfdd3688.cjs"),m=require("axios"),u=require("react"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");const l=require("react-router-dom");require("@mui/material");const c=s=>{const[t,o]=u.useState([]);return u.useEffect(()=>{m.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(r=>o(r.data)).catch(r=>{console.error("Getting user permission error:",r)})},[s]),t},a=s=>(t,o)=>{const r=c(s);return o?t.every(n=>r==null?void 0:r.includes(n)):t.some(n=>r==null?void 0:r.includes(n))},h=({baseUrl:s,accessWith:t,requireAll:o,children:r})=>a(s)(t,o)?i.jsx(i.Fragment,{children:r}):null,P=({accessWith:s,requireAll:t,baseUrl:o,unAuthorizedPath:r,children:n})=>a(o)(s,t)?i.jsx(i.Fragment,{children:n}):i.jsx(l.Navigate,{to:r,replace:!0});exports.AuthContext=e.AuthContext;exports.AuthProvider=e.AuthProvider;exports.ERROR_MESSAGE=e.ERROR_MESSAGE;exports.SaasThemeProvider=e.SaasThemeProvider;exports.TranslationProvider=e.TranslationProvider;exports.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.login=e.login;exports.logout=e.logout;exports.responseInterceptor=e.responseInterceptor;exports.search=e.search;exports.translate=e.translate;exports.translationConfig=e.translationConfig;exports.useAuth=e.useAuth;exports.useCustomTranslation=e.useCustomTranslation;exports.useTheme=e.useTheme;exports.useTranslation=e.useTranslation$1;exports.HasPermission=h;exports.PermissionRoute=P;exports.getUseHasPermission=a;exports.useGetPermission=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.module-1f5dd982.cjs"),m=require("axios"),u=require("react"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");const l=require("react-router-dom");require("@mui/material");const c=s=>{const[t,o]=u.useState([]);return u.useEffect(()=>{m.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(r=>o(r.data)).catch(r=>{console.error("Getting user permission error:",r)})},[s]),t},a=s=>(t,o)=>{const r=c(s);return o?t.every(n=>r==null?void 0:r.includes(n)):t.some(n=>r==null?void 0:r.includes(n))},h=({baseUrl:s,accessWith:t,requireAll:o,children:r})=>a(s)(t,o)?i.jsx(i.Fragment,{children:r}):null,P=({accessWith:s,requireAll:t,baseUrl:o,unAuthorizedPath:r,children:n})=>a(o)(s,t)?i.jsx(i.Fragment,{children:n}):i.jsx(l.Navigate,{to:r,replace:!0});exports.AuthContext=e.AuthContext;exports.AuthProvider=e.AuthProvider;exports.ERROR_MESSAGE=e.ERROR_MESSAGE;exports.SaasThemeProvider=e.SaasThemeProvider;exports.TranslationProvider=e.TranslationProvider;exports.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.login=e.login;exports.logout=e.logout;exports.responseInterceptor=e.responseInterceptor;exports.search=e.search;exports.translate=e.translate;exports.translationConfig=e.translationConfig;exports.useAuth=e.useAuth;exports.useCustomTranslation=e.useCustomTranslation;exports.useTheme=e.useTheme;exports.useTranslation=e.useTranslation$1;exports.HasPermission=h;exports.PermissionRoute=P;exports.getUseHasPermission=a;exports.useGetPermission=c;
@@ -1,4 +1,4 @@
1
- import { J as R, K as S, M as G, Z as y, X as H, a as I, c as M, Y as N, R as O, N as j, O as w, T as F, t as J, V as K, U, u as V, e as X, n as Y, W as Z } from "../index.module-d6a0a578.js";
1
+ import { J as R, K as S, M as G, Z as y, X as H, a as I, c as M, Y as N, R as O, N as j, O as w, T as F, t as J, V as K, U, u as V, e as X, n as Y, W as Z } from "../index.module-62a8833c.js";
2
2
  import u from "axios";
3
3
  import { useState as m, useEffect as c } from "react";
4
4
  import { jsx as a, Fragment as n } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.4.5",
4
+ "version": "0.4.7",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
1
  import "../index-a8aaf6f3.js";
2
- import { G as e } from "../index-ebb92b47.js";
2
+ import { G as e } from "../index-969731e4.js";
3
3
  export {
4
4
  e as GlobalMenu
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import "../index-a8aaf6f3.js";
2
- import { T as a } from "../index-ebb92b47.js";
2
+ import { T as a } from "../index-969731e4.js";
3
3
  export {
4
4
  a as TopBar
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import "../index-a8aaf6f3.js";
2
- import { H as o, g as r } from "../index-ebb92b47.js";
2
+ import { H as o, g as r } from "../index-969731e4.js";
3
3
  export {
4
4
  o as HasPermission,
5
5
  r as getUseHasPermission
@@ -10413,10 +10413,7 @@ const iV = ({
10413
10413
  }, { setNotiData: v } = $.useContext(vo), x = s0({ baseUrl: t, notiPath: n, setNotiData: v }), k = async (B, F) => {
10414
10414
  try {
10415
10415
  const Y = n || `/notification-management/api/v1/notifications/${B}`, G = t + Y;
10416
- await gi.put(
10417
- G,
10418
- { isRead: F }
10419
- );
10416
+ await gi.put(G, { isRead: F });
10420
10417
  } catch (Y) {
10421
10418
  console.log(Y), d({
10422
10419
  id: e.id,
@@ -10478,9 +10475,9 @@ const iV = ({
10478
10475
  /* @__PURE__ */ V.jsxs("div", { className: "notification-item__content-wrapper", children: [
10479
10476
  /* @__PURE__ */ V.jsxs("div", { className: "notification-item__content", children: [
10480
10477
  /* @__PURE__ */ V.jsx("p", { className: "notification-item__user-name", children: e.actorName }),
10481
- /* @__PURE__ */ V.jsxs("p", { children: [
10478
+ /* @__PURE__ */ V.jsxs("a", { href: e == null ? void 0 : e.contextUrl, style: { cursor: "pointer" }, children: [
10482
10479
  `${e.message} `,
10483
- /* @__PURE__ */ V.jsx("span", { children: e == null ? void 0 : e.context })
10480
+ /* @__PURE__ */ V.jsx("span", { className: "notification-item__context-link", children: e == null ? void 0 : e.context })
10484
10481
  ] }),
10485
10482
  (e == null ? void 0 : e.notificationType) === "deleteMultiple" && /* @__PURE__ */ V.jsxs(
10486
10483
  "button",
@@ -10818,7 +10815,7 @@ function $k({ children: e, styles: t = [], ...n }) {
10818
10815
  ] });
10819
10816
  }
10820
10817
  const lV = `.avatar-dropdown-item{padding:.5rem;font-size:.875rem;line-height:1.25rem;cursor:pointer;border-radius:.25rem}.avartarDropdownMenu{background-color:#fff;padding:.5rem;width:13rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);position:absolute;left:-10rem;top:3.2rem}.avartarDropdownMenu ul{list-style:none;padding-inline-start:0;margin-block-end:0}.navbar{display:flex;background:#292929;top:0;width:100%;padding-left:2.5rem;height:64px}.navbar-container{display:flex;flex-direction:row;align-items:center;width:100%;justify-content:space-between;position:relative}.logo-container{height:100%;display:flex;align-items:center}.right-side-container{display:flex;flex-direction:row;align-items:center;text-align:center;margin-right:2.5rem;gap:1rem}.userContainer{display:flex;align-items:center;gap:.5rem}.languageDropdown{height:100%;padding:0 8px;display:flex;flex-direction:row;gap:8px;border-radius:3px;align-items:center;justify-content:center;height:41px;background-color:#ffffff1a;cursor:pointer;transition:background-color .2s ease-in-out}.languageDropdown:hover{background-color:#fff3}.userFullName{color:#fff;font-weight:400;font-size:.875rem;line-height:1.25rem;transition:width .3s}.userAvatar{width:2.5rem;height:2.5rem;-o-object-fit:cover;object-fit:cover;border-radius:9999px;border:2px solid #FFFFFF}#userAvatarNull{width:2.5rem;height:2.5rem;background:#DDDDDD;border-radius:100%;color:#fff;font-size:20px;font-weight:400;display:flex;align-items:center;justify-content:center}.relative{position:relative}.cursor-pointer{cursor:pointer}
10821
- `, uV = `:root{--textPrimary: #292929;--textWhite: #fff;--primary500: #2E7D32;--grey100: #FAFAFA;--gray200: #EEEEEE;--gray600: #85858A;--link: #007BFF }.list-content{overflow-y:auto;overflow-x:hidden}.mark-all-read{text-align:right;color:#007bff;margin-bottom:12px;font-size:12px}.notification-items__wrapper{overflow:hidden}.notification-items__content{height:calc(100vh - 275px);overflow-x:hidden;overflow-y:auto;color:#292929}.notitification-item__container{display:flex;justify-content:space-between;padding:16px;border-bottom:#FAFAFA 1px solid;text-align:left;font-size:12px;position:relative;z-index:10;cursor:pointer;border-radius:4px;margin-bottom:8px}.notitification-item__container:hover{background-color:#fafafa}.notification-item__image-container{width:46px;height:40px;display:flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;margin-right:16px}.notification-item__image-container img{width:100%;height:100%;text-align:center;-o-object-fit:cover;object-fit:cover;color:transparent;text-indent:10000px}.notification-item__content-wrapper{width:100%;display:flex;align-items:center;justify-content:space-between}.notification-item__context-link{color:#007bff}.notification-item__content{width:68%;padding-right:16px}.notification-item__user-name{margin-bottom:2px;font-size:14px}.notification-item__time{margin-right:15px;text-align:right}.notification-item__read-at{border-width:2px;border-style:solid;border-radius:50%;width:10px;height:10px;display:block;position:relative}.notification-item__read-at:before{position:absolute;top:-30px;right:0;width:91px;background-color:#85858a;color:#fff;border-radius:4px;font-size:10px;text-align:center;padding:4px;opacity:0;visibility:hidden;transition:all .3s cubic-bezier(.39,.575,.565,1)}.notification-item__read-at:hover:before{opacity:1;visibility:visible}.notification-item__read-at.read:before{content:"Mark as unread"}.notification-item__read-at.unread:before{content:"Mark as read"}.notification-item__read-at.read{border-color:#eee}.notification-item__read-at.unread{border-color:#2e7d32;background-color:#2e7d32}.list-dot{border-radius:50%;width:8px;height:8px;margin-right:4px;display:block}
10818
+ `, uV = `:root{--textPrimary: #292929;--textWhite: #fff;--primary500: #2E7D32;--grey100: #FAFAFA;--gray200: #EEEEEE;--gray600: #85858A;--link: #007BFF }.list-content{overflow-y:auto;overflow-x:hidden}.mark-all-read{text-align:right;color:#007bff;margin-bottom:12px;font-size:12px}.notification-items__wrapper{overflow:hidden}.notification-items__content{height:calc(100vh - 275px);overflow-x:hidden;overflow-y:auto;color:#292929}.notitification-item__container{display:flex;justify-content:space-between;padding:16px;border-bottom:#FAFAFA 1px solid;text-align:left;font-size:12px;position:relative;z-index:10;border-radius:4px;margin-bottom:8px}.notitification-item__container:hover{background-color:#fafafa}.notification-item__image-container{width:46px;height:40px;display:flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;margin-right:16px}.notification-item__image-container img{width:100%;height:100%;text-align:center;-o-object-fit:cover;object-fit:cover;color:transparent;text-indent:10000px}.notification-item__content-wrapper{width:100%;display:flex;align-items:center;justify-content:space-between}.notification-item__context-link{color:#007bff}.notification-item__content{width:68%;padding-right:16px}.notification-item__user-name{margin-bottom:2px;font-size:14px}.notification-item__time{margin-right:15px;text-align:right}.notification-item__read-at{border-width:2px;border-style:solid;border-radius:50%;width:10px;height:10px;display:block;position:relative}.notification-item__read-at:before{position:absolute;top:-30px;right:0;width:91px;background-color:#85858a;color:#fff;border-radius:4px;font-size:10px;text-align:center;padding:4px;opacity:0;visibility:hidden;transition:all .3s cubic-bezier(.39,.575,.565,1)}.notification-item__read-at:hover:before{opacity:1;visibility:visible}.notification-item__read-at.read:before{content:"Mark as unread"}.notification-item__read-at.unread:before{content:"Mark as read"}.notification-item__read-at.read{border-color:#eee}.notification-item__read-at.unread{border-color:#2e7d32;background-color:#2e7d32}.list-dot{border-radius:50%;width:8px;height:8px;margin-right:4px;display:block}
10822
10819
  `, cV = `._subscription-diaglog_1bysb_2{position:fixed;width:100vw;height:100vh;top:0;left:0;background-color:#0006;z-index:10000;display:flex;align-items:center;justify-content:center}._subscription-container_1bysb_15{width:610px;height:222px;border-radius:8px;padding:32px 24px 40px;background:#fff;color:#292929}._subscription-title_1bysb_25{font-size:20px;font-weight:500;text-align:center;color:#292929}._subscription-title_1bysb_25,._subscription-text_1bysb_34{margin-bottom:24px}._subscription-btn__container_1bysb_38{display:flex;justify-content:space-between;align-items:center}._btn-success_1bysb_44,._btn-cancel_1bysb_45{width:150px;height:40px;display:flex;align-items:center;justify-content:center;padding:8px;color:#292929;border-radius:1px;transition:background-color .25s cubic-bezier(.4,0,.2,1) 0ms,box-shadow .25s cubic-bezier(.4,0,.2,1) 0ms,border-color .25s cubic-bezier(.4,0,.2,1) 0ms,color .25s cubic-bezier(.4,0,.2,1) 0ms}._btn-cancel_1bysb_45{background-color:#ddd}._btn-cancel_1bysb_45:hover{background-color:#c5c5c5}._btn-success_1bysb_44{background-color:#93d500}._btn-success_1bysb_44:hover{background-color:#2e7d32}
10823
10820
  `, fV = `._notification-massage_container_ql4az_1{background:#fff;padding:0 64px 0 84px;border-radius:8px;font-family:TT Firs Neue Trl,sans-serif}._notification-massage_container_ql4az_1:before{position:absolute;content:"";width:48px;height:48px;background:url(https://ukpcsaprod.blob.core.windows.net/saas/notification-icon.svg) no-repeat center/100%;top:12px;left:24px}._notification-name_ql4az_18{font-weight:500;font-size:14px}._notification-message_service_ql4az_23{font-size:12px}._notification-message_button-close_ql4az_27{position:absolute;top:12px;right:24px;width:24px;height:24px}
10824
10821
  `;
@@ -12070,7 +12067,6 @@ const fU = {
12070
12067
  closeButton: dU,
12071
12068
  toastId: "notify",
12072
12069
  position: "top-right",
12073
- closeOnClick: !1,
12074
12070
  hideProgressBar: !0,
12075
12071
  containerId: "toastifyNotification",
12076
12072
  style: {
@@ -23163,41 +23159,57 @@ const jT = (e) => {
23163
23159
  const [t, n] = $.useState({
23164
23160
  actorName: "",
23165
23161
  message: "",
23166
- context: ""
23162
+ context: "",
23163
+ contextUrl: ""
23167
23164
  });
23168
23165
  console.log(t);
23169
23166
  const { setNotiData: r } = $.useContext(vo);
23170
23167
  function i() {
23171
- return /* @__PURE__ */ V.jsx("div", { className: wf["notification-massage_container"], children: /* @__PURE__ */ V.jsxs("div", { className: wf["notification-massage_content"], children: [
23172
- /* @__PURE__ */ V.jsx("h6", { className: wf["notification-name"], children: t == null ? void 0 : t.actorName }),
23173
- /* @__PURE__ */ V.jsxs("div", { className: wf["notification-message_service"], children: [
23174
- /* @__PURE__ */ V.jsxs("span", { children: [
23175
- `${t == null ? void 0 : t.message} `,
23176
- " "
23177
- ] }),
23178
- /* @__PURE__ */ V.jsx("span", { children: t == null ? void 0 : t.context })
23179
- ] })
23180
- ] }) });
23168
+ return /* @__PURE__ */ V.jsx(
23169
+ "a",
23170
+ {
23171
+ className: wf["notification-massage_container"],
23172
+ href: t == null ? void 0 : t.contextUrl,
23173
+ style: { width: "100%", display: "block" },
23174
+ children: /* @__PURE__ */ V.jsxs(
23175
+ "div",
23176
+ {
23177
+ className: wf["notification-massage_content"],
23178
+ children: [
23179
+ /* @__PURE__ */ V.jsx("h6", { className: wf["notification-name"], children: t == null ? void 0 : t.actorName }),
23180
+ /* @__PURE__ */ V.jsxs("div", { className: wf["notification-message_service"], children: [
23181
+ /* @__PURE__ */ V.jsxs("span", { children: [
23182
+ `${t == null ? void 0 : t.message} `,
23183
+ " "
23184
+ ] }),
23185
+ /* @__PURE__ */ V.jsx("span", { children: t == null ? void 0 : t.context })
23186
+ ] })
23187
+ ]
23188
+ }
23189
+ )
23190
+ }
23191
+ );
23181
23192
  }
23182
23193
  return $.useEffect(() => {
23183
- t && Notification.permission === "granted" && (t.actorName || t.message || t.context) && hU(/* @__PURE__ */ V.jsx(i, {}));
23194
+ t && Notification.permission === "granted" && (t.actorName || t.message || t.context || t.contextUrl) && hU(/* @__PURE__ */ V.jsx(i, {}));
23184
23195
  }, [t]), $.useEffect(() => {
23185
23196
  Notification.permission === "granted" && jT(e);
23186
23197
  }, [Notification.permission]), $.useEffect(() => {
23187
23198
  yY(r);
23188
23199
  }, []), vY(e).then((s) => {
23189
- var a, c, d;
23200
+ var a, c, d, p;
23190
23201
  console.log("aaa", s), n({
23191
23202
  actorName: (a = s == null ? void 0 : s.data) == null ? void 0 : a.actorName,
23192
23203
  message: (c = s == null ? void 0 : s.data) == null ? void 0 : c.message,
23193
- context: (d = s == null ? void 0 : s.data) == null ? void 0 : d.context
23194
- }), r((p) => {
23195
- var m;
23204
+ context: (d = s == null ? void 0 : s.data) == null ? void 0 : d.context,
23205
+ contextUrl: (p = s == null ? void 0 : s.data) == null ? void 0 : p.contextUrl
23206
+ }), r((m) => {
23207
+ var v;
23196
23208
  return {
23197
- ...p,
23209
+ ...m,
23198
23210
  unread: {
23199
- ...p.unread,
23200
- total: ((m = p.unread) == null ? void 0 : m.total) + 1
23211
+ ...m.unread,
23212
+ total: ((v = m.unread) == null ? void 0 : v.total) + 1
23201
23213
  }
23202
23214
  };
23203
23215
  });