sea-react-components 1.3.40 → 1.3.41

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.
Files changed (57) hide show
  1. package/dist/HOC/can-access-application/index.d.ts +3 -2
  2. package/dist/HOC/can-access-application/index.d.ts.map +1 -1
  3. package/dist/HOC/can-access-application/index.js +2 -2
  4. package/dist/HOC/with-authorization/index.d.ts +3 -2
  5. package/dist/HOC/with-authorization/index.d.ts.map +1 -1
  6. package/dist/HOC/with-authorization/index.js +5 -5
  7. package/dist/components/comments-container/comment-form/index.d.ts +2 -1
  8. package/dist/components/comments-container/comment-form/index.d.ts.map +1 -1
  9. package/dist/components/comments-container/comment-form/index.js +5 -3
  10. package/dist/components/comments-container/index.d.ts +2 -1
  11. package/dist/components/comments-container/index.d.ts.map +1 -1
  12. package/dist/components/comments-container/index.js +11 -9
  13. package/dist/components/comments-container/use-comments/index.d.ts +2 -1
  14. package/dist/components/comments-container/use-comments/index.d.ts.map +1 -1
  15. package/dist/components/comments-container/use-comments/index.js +3 -3
  16. package/dist/components/firebase-token-handler/index.d.ts +2 -1
  17. package/dist/components/firebase-token-handler/index.d.ts.map +1 -1
  18. package/dist/components/firebase-token-handler/index.js +18 -17
  19. package/dist/components/log-activities-container/index.d.ts +2 -1
  20. package/dist/components/log-activities-container/index.d.ts.map +1 -1
  21. package/dist/components/log-activities-container/index.js +2 -2
  22. package/dist/components/log-activities-container/log-activities-list/index.d.ts +2 -1
  23. package/dist/components/log-activities-container/log-activities-list/index.d.ts.map +1 -1
  24. package/dist/components/log-activities-container/log-activities-list/index.js +4 -2
  25. package/dist/components/log-activities-container/use-log-activities/index.d.ts +2 -1
  26. package/dist/components/log-activities-container/use-log-activities/index.d.ts.map +1 -1
  27. package/dist/components/log-activities-container/use-log-activities/index.js +5 -3
  28. package/dist/components/not-authorized/index.d.ts +5 -1
  29. package/dist/components/not-authorized/index.d.ts.map +1 -1
  30. package/dist/components/not-authorized/index.js +27 -2
  31. package/dist/components/notifications-menu/index.d.ts +2 -1
  32. package/dist/components/notifications-menu/index.d.ts.map +1 -1
  33. package/dist/components/notifications-menu/index.js +48 -27
  34. package/dist/components/skeleton/index.d.ts +4 -2
  35. package/dist/components/skeleton/index.d.ts.map +1 -1
  36. package/dist/components/skeleton/index.js +3 -3
  37. package/dist/hooks/use-has-permission-access/index.d.ts +2 -2
  38. package/dist/hooks/use-has-permission-access/index.d.ts.map +1 -1
  39. package/dist/hooks/use-has-permission-access/index.js +2 -6
  40. package/dist/hooks/user-has-application-access/index.d.ts +1 -1
  41. package/dist/hooks/user-has-application-access/index.d.ts.map +1 -1
  42. package/dist/hooks/user-has-application-access/index.js +1 -4
  43. package/dist/middleware/must-auth/index.d.ts +2 -1
  44. package/dist/middleware/must-auth/index.d.ts.map +1 -1
  45. package/dist/middleware/must-auth/index.js +2 -5
  46. package/dist/providers/socket-provider/index.d.ts +2 -1
  47. package/dist/providers/socket-provider/index.d.ts.map +1 -1
  48. package/dist/providers/socket-provider/index.js +1 -4
  49. package/dist/services/remote-service/index.d.ts +1 -0
  50. package/dist/services/remote-service/index.d.ts.map +1 -1
  51. package/dist/services/remote-service/index.js +0 -1
  52. package/dist/utils/auth-axios/index.d.ts +1 -1
  53. package/dist/utils/auth-axios/index.d.ts.map +1 -1
  54. package/dist/utils/auth-axios/index.js +1 -3
  55. package/dist/utils/axios/index.d.ts +1 -1
  56. package/dist/utils/axios/index.d.ts.map +1 -1
  57. package/package.json +2 -2
@@ -3,7 +3,8 @@ import { CONSTANTS } from "sea-platform-helpers";
3
3
  export interface Props {
4
4
  applicationKey: CONSTANTS.Application.ApplicationKeys;
5
5
  fallback?: React.ReactNode;
6
- hasApplicationAccess: (key: CONSTANTS.Application.ApplicationKeys) => boolean;
6
+ hasApplicationAccess: (key: CONSTANTS.Application.ApplicationKeys, accessToken: string) => boolean;
7
+ accessToken: string;
7
8
  }
8
- export default function CanAccessApplication<P>(WrappedComponent: React.ComponentType<P>, { applicationKey, fallback, hasApplicationAccess, }: Props): (props: P) => import("react/jsx-runtime").JSX.Element;
9
+ export default function CanAccessApplication<P>(WrappedComponent: React.ComponentType<P>, { applicationKey, fallback, hasApplicationAccess, accessToken, }: Props): (props: P) => import("react/jsx-runtime").JSX.Element;
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/HOC/can-access-application/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,MAAM,WAAW,KAAK;IACpB,cAAc,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC;IACtD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,oBAAoB,EAAE,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,KAAK,OAAO,CAAC;CAC/E;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,CAAC,EAC5C,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACxC,EACE,cAAc,EACd,QAIC,EACD,oBAAoB,GACrB,EAAE,KAAK,IAEA,OAAO,CAAC,6CAMjB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/HOC/can-access-application/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,MAAM,WAAW,KAAK;IACpB,cAAc,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC;IACtD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,oBAAoB,EAAE,CACpB,GAAG,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,EAC1C,WAAW,EAAE,MAAM,KAChB,OAAO,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,CAAC,EAC5C,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACxC,EACE,cAAc,EACd,QAIC,EACD,oBAAoB,EACpB,WAAW,GACZ,EAAE,KAAK,IAEA,OAAO,CAAC,6CAMjB"}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import NotAuthorized from "../../components/not-authorized";
4
- export default function CanAccessApplication(WrappedComponent, { applicationKey, fallback = (_jsx("div", { className: "flex items-center justify-center h-screen", children: _jsx(NotAuthorized, {}) })), hasApplicationAccess, }) {
4
+ export default function CanAccessApplication(WrappedComponent, { applicationKey, fallback = (_jsx("div", { className: "flex items-center justify-center h-screen", children: _jsx(NotAuthorized, {}) })), hasApplicationAccess, accessToken, }) {
5
5
  return (props) => {
6
- const canAccess = hasApplicationAccess(applicationKey);
6
+ const canAccess = hasApplicationAccess(applicationKey, accessToken);
7
7
  if (!canAccess)
8
8
  return _jsx(_Fragment, { children: fallback });
9
9
  return _jsx(WrappedComponent, { ...props });
@@ -5,8 +5,9 @@ export interface Props {
5
5
  requiredPermissions: CONSTANTS.Permission.PermissionKeys[];
6
6
  strategy?: ValidationStrategy;
7
7
  fallback?: React.ReactNode;
8
- hasPermission: (key: CONSTANTS.Permission.PermissionKeys) => boolean;
8
+ hasPermission: (key: CONSTANTS.Permission.PermissionKeys, accessToken: string) => boolean;
9
+ accessToken: string;
9
10
  }
10
- export default function WithAuthorization<P>(WrappedComponent: React.ComponentType<P>, { requiredPermissions, strategy, fallback, hasPermission, }: Props): (props: P) => import("react/jsx-runtime").JSX.Element;
11
+ export default function WithAuthorization<P>(WrappedComponent: React.ComponentType<P>, { requiredPermissions, strategy, fallback, hasPermission, accessToken, }: Props): (props: P) => import("react/jsx-runtime").JSX.Element;
11
12
  export {};
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/HOC/with-authorization/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,KAAK,kBAAkB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjD,MAAM,WAAW,KAAK;IACpB,mBAAmB,EAAE,SAAS,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;IAC3D,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,EAAE,CAAC,GAAG,EAAE,SAAS,CAAC,UAAU,CAAC,cAAc,KAAK,OAAO,CAAC;CACtE;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,EACzC,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACxC,EACE,mBAAmB,EACnB,QAAgB,EAChB,QAA4B,EAC5B,aAAa,GACd,EAAE,KAAK,IAEA,OAAO,CAAC,6CAWjB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/HOC/with-authorization/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,KAAK,kBAAkB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjD,MAAM,WAAW,KAAK;IACpB,mBAAmB,EAAE,SAAS,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;IAC3D,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,EAAE,CACb,GAAG,EAAE,SAAS,CAAC,UAAU,CAAC,cAAc,EACxC,WAAW,EAAE,MAAM,KAChB,OAAO,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,EACzC,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACxC,EACE,mBAAmB,EACnB,QAAgB,EAChB,QAA4B,EAC5B,aAAa,EACb,WAAW,GACZ,EAAE,KAAK,IAEA,OAAO,CAAC,6CAYjB"}
@@ -1,21 +1,21 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import NotAuthorized from "../../components/not-authorized";
4
- export default function WithAuthorization(WrappedComponent, { requiredPermissions, strategy = "all", fallback = _jsx(NotAuthorized, {}), hasPermission, }) {
4
+ export default function WithAuthorization(WrappedComponent, { requiredPermissions, strategy = "all", fallback = _jsx(NotAuthorized, {}), hasPermission, accessToken, }) {
5
5
  return (props) => {
6
- const isAuthorized = validatePermissions(requiredPermissions, strategy, hasPermission);
6
+ const isAuthorized = validatePermissions(requiredPermissions, strategy, hasPermission, accessToken);
7
7
  if (!isAuthorized)
8
8
  return _jsx(_Fragment, { children: fallback });
9
9
  return _jsx(WrappedComponent, { ...props });
10
10
  };
11
11
  }
12
- function validatePermissions(requiredPermissions, strategy, hasPermission) {
12
+ function validatePermissions(requiredPermissions, strategy, hasPermission, accessToken) {
13
13
  switch (strategy) {
14
14
  case "all":
15
- return requiredPermissions.every((key) => hasPermission(key));
15
+ return requiredPermissions.every((key) => hasPermission(key, accessToken));
16
16
  case "some":
17
17
  case "one":
18
- return requiredPermissions.some((key) => hasPermission(key));
18
+ return requiredPermissions.some((key) => hasPermission(key, accessToken));
19
19
  default:
20
20
  return false;
21
21
  }
@@ -33,7 +33,8 @@ export type Props = {
33
33
  onCreateCommentSuccess?: (comment: DTO.Comment.IComment) => void;
34
34
  onEditCommentSuccess?: (comment: DTO.Comment.IComment) => void;
35
35
  renderForm?: (props: CommentFormRenderProps) => React.ReactNode;
36
+ accessToken?: string;
36
37
  };
37
- export default function CommentForm({ objectId, model, commentsBaseUrl, commentToEdit, setCommentToEdit, replyOnComment, setReplyOnComment, onCreateCommentSuccess, onEditCommentSuccess, renderForm, }: Props): import("react/jsx-runtime").JSX.Element;
38
+ export default function CommentForm({ objectId, model, commentsBaseUrl, commentToEdit, setCommentToEdit, replyOnComment, setReplyOnComment, onCreateCommentSuccess, onEditCommentSuccess, renderForm, accessToken, }: Props): import("react/jsx-runtime").JSX.Element;
38
39
  export {};
39
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-form/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAiB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAK3B,eAAO,MAAM,0BAA0B;;;;MAQtC,CAAC;AAEF,KAAK,MAAM,GAAG;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACtC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KAAK,I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AoB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;IAE/D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,SAAS,CAAC;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,KAAK,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,WAAW,GACZ,EAAE,KAAK,2CAsIP"}
@@ -16,7 +16,7 @@ export const createNewCommentValidation = () => {
16
16
  .required("Required"),
17
17
  });
18
18
  };
19
- export default function CommentForm({ objectId, model, commentsBaseUrl, commentToEdit, setCommentToEdit, replyOnComment, setReplyOnComment, onCreateCommentSuccess, onEditCommentSuccess, renderForm, }) {
19
+ export default function CommentForm({ objectId, model, commentsBaseUrl, commentToEdit, setCommentToEdit, replyOnComment, setReplyOnComment, onCreateCommentSuccess, onEditCommentSuccess, renderForm, accessToken, }) {
20
20
  var _a;
21
21
  const initialValues = {
22
22
  model,
@@ -27,12 +27,14 @@ export default function CommentForm({ objectId, model, commentsBaseUrl, commentT
27
27
  const onSubmit = async (values, helpers) => {
28
28
  try {
29
29
  if (commentToEdit) {
30
- const response = await authAxiosInstance.put(`${commentsBaseUrl}/${commentToEdit.id}`, { description: values.description });
30
+ const response = await authAxiosInstance(accessToken).put(`${commentsBaseUrl}/${commentToEdit.id}`, {
31
+ description: values.description,
32
+ });
31
33
  eventBus.emit(COMMENT_EVENTS.UpdateComment, response.data);
32
34
  onEditCommentSuccess === null || onEditCommentSuccess === void 0 ? void 0 : onEditCommentSuccess(response.data);
33
35
  }
34
36
  else {
35
- const response = await authAxiosInstance.post(commentsBaseUrl, {
37
+ const response = await authAxiosInstance(accessToken).post(commentsBaseUrl, {
36
38
  objectId: values.objectId,
37
39
  model: values.model,
38
40
  description: values.description,
@@ -16,6 +16,7 @@ export type Props = {
16
16
  highlightCommentId?: string;
17
17
  }) => React.ReactNode;
18
18
  renderForm?: (props: CommentFormRenderProps) => React.ReactNode;
19
+ accessToken?: string;
19
20
  };
20
- export default function CommentsContainer({ commentsBaseUrl, objectId, model, limit, highlightCommentId, renderCommentItem, renderForm, }: Props): import("react/jsx-runtime").JSX.Element;
21
+ export default function CommentsContainer({ commentsBaseUrl, objectId, model, limit, highlightCommentId, renderCommentItem, renderForm, accessToken, }: Props): import("react/jsx-runtime").JSX.Element;
21
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/comments-container/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAa,MAAM,sBAAsB,CAAC;AAItD,OAAoB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAIrE,MAAM,MAAM,KAAK,GAAG;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,iBAAiB,CAAC,EAAE,CAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,EAC7B,WAAW,EAAE;QACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACjE,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;QACpE,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC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CAAC,SAAS,CAAC;IAErB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,SAAS,CAAC;IAEhE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,eAAe,EACf,QAAQ,EACR,KAAK,EACL,KAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,WAAW,GACZ,EAAE,KAAK,2CA6DP"}
@@ -1,27 +1,29 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useEffect } from "react";
4
- import { CONSTANTS } from "sea-platform-helpers";
5
- import { getCookie } from "../../utils/cookie";
6
4
  import { jwtDecode } from "../../utils/jwt";
7
5
  import CommentForm from "./comment-form";
8
6
  import CommentsList from "./comments-list";
9
7
  import CommentItem from "./comment-item";
10
- export default function CommentsContainer({ commentsBaseUrl, objectId, model, limit = 10, highlightCommentId, renderCommentItem, renderForm, }) {
8
+ export default function CommentsContainer({ commentsBaseUrl, objectId, model, limit = 10, highlightCommentId, renderCommentItem, renderForm, accessToken, }) {
11
9
  const [accountId, setAccountId] = useState("");
12
10
  const [commentToEdit, setCommentToEdit] = useState();
13
11
  const [replyOnComment, setReplyOnComment] = useState();
14
12
  useEffect(() => {
15
- var _a, _b;
16
- const accessToken = (_a = getCookie(CONSTANTS.JWT.JWTCookieKey)) !== null && _a !== void 0 ? _a : "";
17
- const payload = (_b = jwtDecode(accessToken)) !== null && _b !== void 0 ? _b : null;
18
- setAccountId((payload === null || payload === void 0 ? void 0 : payload.id) || "");
19
- }, []);
13
+ var _a;
14
+ if (accessToken) {
15
+ const payload = (_a = jwtDecode(accessToken)) !== null && _a !== void 0 ? _a : null;
16
+ setAccountId((payload === null || payload === void 0 ? void 0 : payload.id) || "");
17
+ }
18
+ }, [accessToken]);
19
+ if (!accessToken) {
20
+ return (_jsx("p", { className: "p-4 text-center text-sm text-gray-500", children: "Please provide an access token to view and interact with comments." }));
21
+ }
20
22
  return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(CommentForm, { commentsBaseUrl: commentsBaseUrl, objectId: objectId, model: model, commentToEdit: commentToEdit, setCommentToEdit: setCommentToEdit, replyOnComment: replyOnComment, setReplyOnComment: setReplyOnComment, onCreateCommentSuccess: () => {
21
23
  setCommentToEdit(undefined);
22
24
  setReplyOnComment(undefined);
23
25
  }, onEditCommentSuccess: () => {
24
26
  setCommentToEdit(undefined);
25
27
  setReplyOnComment(undefined);
26
- }, renderForm: renderForm }), _jsx(CommentsList, { editComment: setCommentToEdit, replyOnComment: setReplyOnComment, highlightCommentId: highlightCommentId, currentAccountId: accountId, commentsBaseUrl: commentsBaseUrl, objectId: objectId, limit: limit, renderCommentItem: renderCommentItem !== null && renderCommentItem !== void 0 ? renderCommentItem : ((comment, props) => (_jsx(CommentItem, { comment: comment, ...props }, comment.id))) })] }));
28
+ }, renderForm: renderForm, accessToken: accessToken }), _jsx(CommentsList, { editComment: setCommentToEdit, replyOnComment: setReplyOnComment, highlightCommentId: highlightCommentId, currentAccountId: accountId, commentsBaseUrl: commentsBaseUrl, objectId: objectId, limit: limit, renderCommentItem: renderCommentItem !== null && renderCommentItem !== void 0 ? renderCommentItem : ((comment, props) => (_jsx(CommentItem, { comment: comment, ...props }, comment.id))) })] }));
27
29
  }
@@ -1,9 +1,10 @@
1
1
  import { DTO } from "sea-platform-helpers";
2
- export declare function useComments({ commentsBaseUrl, objectId, limit, parentCommentId, }: {
2
+ export declare function useComments({ commentsBaseUrl, objectId, limit, parentCommentId, accessToken, }: {
3
3
  commentsBaseUrl: string;
4
4
  objectId: string;
5
5
  limit?: number;
6
6
  parentCommentId?: string;
7
+ accessToken?: string;
7
8
  }): {
8
9
  comments: DTO.Comment.IComment[];
9
10
  loading: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/use-comments/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAGlD,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,QAAQ,EACR,KAAU,EACV,eAAe,GAChB,EAAE;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;;;;;8BA0CkC,GAAG,CAAC,OAAO,CAAC,QAAQ;6BAkBrB,GAAG,CAAC,OAAO,CAAC,QAAQ;;;EAkBrD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/use-comments/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAGlD,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,QAAQ,EACR,KAAU,EACV,eAAe,EACf,WAAW,GACZ,EAAE;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;;8BA0CkC,GAAG,CAAC,OAAO,CAAC,QAAQ;6BAkBrB,GAAG,CAAC,OAAO,CAAC,QAAQ;;;EAkBrD"}
@@ -2,7 +2,7 @@
2
2
  import { useEffect, useState } from "react";
3
3
  import { Utils } from "sea-platform-helpers";
4
4
  import { authAxiosInstance } from "../../../utils/auth-axios";
5
- export function useComments({ commentsBaseUrl, objectId, limit = 10, parentCommentId, }) {
5
+ export function useComments({ commentsBaseUrl, objectId, limit = 10, parentCommentId, accessToken, }) {
6
6
  const [loading, setLoading] = useState(false);
7
7
  const [page, setPage] = useState(1);
8
8
  const [totalCount, setTotalCount] = useState(0);
@@ -16,7 +16,7 @@ export function useComments({ commentsBaseUrl, objectId, limit = 10, parentComme
16
16
  objectId,
17
17
  ...(parentCommentId ? { parentCommentId } : {}),
18
18
  });
19
- authAxiosInstance
19
+ authAxiosInstance(accessToken)
20
20
  .get(`${commentsBaseUrl}?${params.toString()}`)
21
21
  .then((response) => {
22
22
  const { data, totalCount: tc, totalPages: tp } = response.data;
@@ -27,7 +27,7 @@ export function useComments({ commentsBaseUrl, objectId, limit = 10, parentComme
27
27
  .finally(() => {
28
28
  setLoading(false);
29
29
  });
30
- }, [commentsBaseUrl, limit, objectId, page]);
30
+ }, [commentsBaseUrl, limit, objectId, page, accessToken]);
31
31
  const pushNewComment = (comment) => {
32
32
  setComments((prev) => {
33
33
  if (comment.isReply && !parentCommentId) {
@@ -1,11 +1,12 @@
1
1
  import { CONSTANTS } from "sea-platform-helpers";
2
2
  import { FirebaseConfig, NotificationPayload } from "../../utils/firebase-client";
3
- export default function FirebaseTokenHandler({ config, updateFirebaseTokenUrl, applicationKey, firebaseSWPath, _onForegroundMessage, _onGetToken, }: Readonly<{
3
+ export default function FirebaseTokenHandler({ config, updateFirebaseTokenUrl, applicationKey, firebaseSWPath, _onForegroundMessage, _onGetToken, accessToken, }: Readonly<{
4
4
  config: FirebaseConfig;
5
5
  updateFirebaseTokenUrl: string;
6
6
  applicationKey: CONSTANTS.Application.ApplicationKeys;
7
7
  firebaseSWPath?: string;
8
8
  _onForegroundMessage?: (notification: NotificationPayload) => void;
9
9
  _onGetToken?: (token: string) => void;
10
+ accessToken?: string;
10
11
  }>): import("react/jsx-runtime").JSX.Element;
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/firebase-token-handler/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAS,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAIL,cAAc,EACd,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AASrC,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,MAAM,EACN,sBAAsB,EACtB,cAAc,EACd,cAA4C,EAC5C,oBAAoB,EACpB,WAAW,GACZ,EAAE,QAAQ,CAAC;IACV,MAAM,EAAE,cAAc,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC;IACtD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACnE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC,2CAwBD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/firebase-token-handler/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAIL,cAAc,EACd,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AAGrC,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,MAAM,EACN,sBAAsB,EACtB,cAAc,EACd,cAA4C,EAC5C,oBAAoB,EACpB,WAAW,EACX,WAAW,GACZ,EAAE,QAAQ,CAAC;IACV,MAAM,EAAE,cAAc,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC;IACtD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACnE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC,2CA8BD"}
@@ -6,25 +6,26 @@ import { CONSTANTS } from "sea-platform-helpers";
6
6
  import { getCookie } from "../../utils/cookie";
7
7
  import { initFirebase, requestForToken, onForegroundMessage, } from "../../utils/firebase-client";
8
8
  import * as NotificationLocalStorageUtils from "../../utils/notification-localstorage";
9
- const axiosOptions = {
10
- headers: {
11
- Authorization: `Bearer ${getCookie(CONSTANTS.JWT.JWTCookieKey)}`,
12
- },
13
- };
14
- export default function FirebaseTokenHandler({ config, updateFirebaseTokenUrl, applicationKey, firebaseSWPath = "/firebase-messaging-sw.js", _onForegroundMessage, _onGetToken, }) {
9
+ export default function FirebaseTokenHandler({ config, updateFirebaseTokenUrl, applicationKey, firebaseSWPath = "/firebase-messaging-sw.js", _onForegroundMessage, _onGetToken, accessToken, }) {
15
10
  useEffect(() => {
16
11
  initFirebase(config);
17
- requestForToken(config.vapidKey, firebaseSWPath).then((token) => {
18
- if (token) {
19
- axios.put(updateFirebaseTokenUrl, { token, applicationKey }, axiosOptions);
20
- _onGetToken && _onGetToken(token);
21
- }
22
- });
23
- onForegroundMessage((notification) => {
24
- console.log("Foreground notification:", notification);
25
- NotificationLocalStorageUtils.pushNewNotificationId(notification.id);
26
- _onForegroundMessage && _onForegroundMessage(notification);
27
- });
12
+ if (accessToken) {
13
+ requestForToken(config.vapidKey, firebaseSWPath).then((token) => {
14
+ if (token) {
15
+ axios.put(updateFirebaseTokenUrl, { token, applicationKey }, {
16
+ headers: {
17
+ Authorization: `Bearer ${getCookie(CONSTANTS.JWT.JWTCookieKey)}`,
18
+ },
19
+ });
20
+ _onGetToken && _onGetToken(token);
21
+ }
22
+ });
23
+ onForegroundMessage((notification) => {
24
+ console.log("Foreground notification:", notification);
25
+ NotificationLocalStorageUtils.pushNewNotificationId(notification.id);
26
+ _onForegroundMessage && _onForegroundMessage(notification);
27
+ });
28
+ }
28
29
  }, [config]);
29
30
  return _jsx(_Fragment, {});
30
31
  }
@@ -5,6 +5,7 @@ export type Props = {
5
5
  objectId: string;
6
6
  limit?: number;
7
7
  renderLogActivityItem?: (logActivity: DTO.Activity.IActivity) => React.ReactNode;
8
+ accessToken?: string;
8
9
  };
9
- export default function LogActivitiesContainer({ logActivitiesBaseUrl, objectId, limit, renderLogActivityItem, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export default function LogActivitiesContainer({ logActivitiesBaseUrl, objectId, limit, renderLogActivityItem, accessToken, }: Props): import("react/jsx-runtime").JSX.Element;
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/log-activities-container/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD,MAAM,MAAM,KAAK,GAAG;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,CACtB,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS,KAChC,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,oBAAoB,EACpB,QAAQ,EACR,KAAU,EACV,qBAAqB,GACtB,EAAE,KAAK,2CAaP"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/log-activities-container/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD,MAAM,MAAM,KAAK,GAAG;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,CACtB,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS,KAChC,KAAK,CAAC,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,oBAAoB,EACpB,QAAQ,EACR,KAAU,EACV,qBAAqB,EACrB,WAAW,GACZ,EAAE,KAAK,2CAcP"}
@@ -2,8 +2,8 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import LogActivitiesList from "./log-activities-list";
4
4
  import LogActivityItem from "./log-activity-item";
5
- export default function LogActivitiesContainer({ logActivitiesBaseUrl, objectId, limit = 10, renderLogActivityItem, }) {
5
+ export default function LogActivitiesContainer({ logActivitiesBaseUrl, objectId, limit = 10, renderLogActivityItem, accessToken, }) {
6
6
  return (_jsx(LogActivitiesList, { logActivitiesBaseUrl: logActivitiesBaseUrl, objectId: objectId, limit: limit, renderLogActivityItem: renderLogActivityItem
7
7
  ? renderLogActivityItem
8
- : (activity) => _jsx(LogActivityItem, { activity: activity }) }));
8
+ : (activity) => _jsx(LogActivityItem, { activity: activity }), accessToken: accessToken }));
9
9
  }
@@ -5,7 +5,8 @@ type Props = {
5
5
  objectId: string;
6
6
  limit?: number;
7
7
  renderLogActivityItem?: (logActivity: DTO.Activity.IActivity) => React.ReactNode;
8
+ accessToken?: string;
8
9
  };
9
- export default function LogActivitiesList({ logActivitiesBaseUrl, objectId, limit, renderLogActivityItem, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export default function LogActivitiesList({ logActivitiesBaseUrl, objectId, limit, renderLogActivityItem, accessToken, }: Props): import("react/jsx-runtime").JSX.Element;
10
11
  export {};
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/log-activities-list/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD,KAAK,KAAK,GAAG;IACX,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,CACtB,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS,KAChC,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,oBAAoB,EACpB,QAAQ,EACR,KAAU,EACV,qBAAqB,GACtB,EAAE,KAAK,2CAuDP"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/log-activities-list/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD,KAAK,KAAK,GAAG;IACX,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,CACtB,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS,KAChC,KAAK,CAAC,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,oBAAoB,EACpB,QAAQ,EACR,KAAU,EACV,qBAAqB,EACrB,WAAW,GACZ,EAAE,KAAK,2CA8DP"}
@@ -5,8 +5,10 @@ import Button from "../../button";
5
5
  import { useLogActivities } from "../use-log-activities";
6
6
  import clsx from "clsx";
7
7
  import LogActivityItem from "../log-activity-item";
8
- export default function LogActivitiesList({ logActivitiesBaseUrl, objectId, limit = 10, renderLogActivityItem, }) {
9
- const { logActivities, loading, totalCount, loadMoreLogActivities, hasMoreLogActivities, } = useLogActivities({ logActivitiesBaseUrl, objectId, limit });
8
+ export default function LogActivitiesList({ logActivitiesBaseUrl, objectId, limit = 10, renderLogActivityItem, accessToken, }) {
9
+ const { logActivities, loading, totalCount, loadMoreLogActivities, hasMoreLogActivities, } = useLogActivities({ logActivitiesBaseUrl, objectId, limit, accessToken });
10
+ if (!accessToken)
11
+ return (_jsx("p", { className: "text-gray-500 text-sm text-center py-4", children: "Access token is required to view activities" }));
10
12
  return (_jsx("div", { className: clsx("flex flex-col gap-3"), children: logActivities.length === 0 && !loading ? (_jsx("p", { className: "text-gray-500 text-sm text-center py-4", children: "There are no activities yet" })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex flex-col gap-3", children: logActivities.map((logActivity) => renderLogActivityItem ? (renderLogActivityItem(logActivity)) : (_jsx(LogActivityItem, { activity: logActivity }, logActivity.id))) }), loading && (_jsx("div", { className: "flex flex-col gap-3", children: Array(3)
11
13
  .fill(null)
12
14
  .map((_, i) => (_jsx(Skeleton, { className: "h-20 w-full rounded-lg" }, `logActivity-loading-${i}`))) })), hasMoreLogActivities && !loading && (_jsx("div", { className: clsx("flex justify-center mt-2"), children: _jsx(Button, { type: "button", onClick: loadMoreLogActivities, variant: "secondary", children: "Load More" }) }))] })) }));
@@ -1,8 +1,9 @@
1
1
  import { DTO } from "sea-platform-helpers";
2
- export declare function useLogActivities({ logActivitiesBaseUrl, objectId, limit, }: {
2
+ export declare function useLogActivities({ logActivitiesBaseUrl, objectId, limit, accessToken, }: {
3
3
  logActivitiesBaseUrl: string;
4
4
  objectId: string;
5
5
  limit?: number;
6
+ accessToken?: string;
6
7
  }): {
7
8
  logActivities: DTO.Activity.IActivity[];
8
9
  loading: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/use-log-activities/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAGlD,wBAAgB,gBAAgB,CAAC,EAC/B,oBAAoB,EACpB,QAAQ,EACR,KAAU,GACX,EAAE;IACD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;;;;;;EAuDA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/log-activities-container/use-log-activities/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAGlD,wBAAgB,gBAAgB,CAAC,EAC/B,oBAAoB,EACpB,QAAQ,EACR,KAAU,EACV,WAAW,GACZ,EAAE;IACD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;;;;EAyDA"}
@@ -2,20 +2,22 @@
2
2
  import { useEffect, useState } from "react";
3
3
  import { Utils } from "sea-platform-helpers";
4
4
  import { authAxiosInstance } from "../../../utils/auth-axios";
5
- export function useLogActivities({ logActivitiesBaseUrl, objectId, limit = 10, }) {
5
+ export function useLogActivities({ logActivitiesBaseUrl, objectId, limit = 10, accessToken, }) {
6
6
  const [loading, setLoading] = useState(false);
7
7
  const [page, setPage] = useState(1);
8
8
  const [totalCount, setTotalCount] = useState(0);
9
9
  const [totalPages, setTotalPages] = useState(1);
10
10
  const [logActivities, setLogActivities] = useState([]);
11
11
  useEffect(() => {
12
+ if (!accessToken)
13
+ return;
12
14
  setLoading(true);
13
15
  const params = new URLSearchParams({
14
16
  page: String(page),
15
17
  limit: String(limit),
16
18
  objectId,
17
19
  });
18
- authAxiosInstance
20
+ authAxiosInstance(accessToken)
19
21
  .get(`${logActivitiesBaseUrl}?${params.toString()}`)
20
22
  .then((response) => {
21
23
  const { data, totalCount: tc, totalPages: tp } = response.data;
@@ -26,7 +28,7 @@ export function useLogActivities({ logActivitiesBaseUrl, objectId, limit = 10, }
26
28
  .finally(() => {
27
29
  setLoading(false);
28
30
  });
29
- }, [logActivitiesBaseUrl, limit, objectId, page]);
31
+ }, [logActivitiesBaseUrl, limit, objectId, page, accessToken]);
30
32
  const loadMoreLogActivities = () => {
31
33
  setPage((prev) => Math.min(prev + 1, totalPages));
32
34
  };
@@ -1,2 +1,6 @@
1
- export default function NotAuthorized(): import("react/jsx-runtime").JSX.Element;
1
+ type Props = {
2
+ defaultLogoutPath?: string;
3
+ };
4
+ export default function NotAuthorized({ defaultLogoutPath }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
2
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/not-authorized/index.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,aAAa,4CA6CpC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/not-authorized/index.tsx"],"names":[],"mappings":"AACA,KAAK,KAAK,GAAG;IACX,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,iBAAiB,EAAE,EAAE,KAAK,2CA6EjE"}
@@ -1,5 +1,30 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Icon from "../icon";
3
- export default function NotAuthorized() {
4
- return (_jsxs("div", { className: "flex flex-col items-center justify-center min-h-screen px-6 text-center space-y-10", children: [_jsx(Icon, { icon: "fluent-mdl2:protect-restrict", className: "text-warning text-opacity-80 h-48 w-48 md:h-56 md:w-56" }), _jsxs("div", { className: "max-w-xl space-y-4", children: [_jsx("h1", { className: "text-3xl md:text-4xl font-bold text-warning", children: "Not Authorized" }), _jsxs("p", { className: "text-base text-text md:text-lg text-muted-foreground", children: ["You don\u2019t have the necessary permissions to access this page. ", _jsx("br", {}), "Please contact your administrator if you believe this is a mistake."] })] }), _jsx("p", { className: "text-sm md:text-base text-muted-foreground", children: "\u2014 or \u2014" }), _jsxs("div", { className: "flex flex-wrap justify-center gap-4", children: [_jsxs("button", { type: "button", onClick: () => window.history.back(), className: "flex items-center gap-2 rounded-xl bg-primary px-5 py-2.5 text-white text-sm md:text-base font-medium shadow hover:bg-primary/90 transition", children: [_jsx(Icon, { icon: "material-symbols:arrow-back-rounded" }), "Go Back"] }), _jsxs("button", { type: "button", onClick: () => (window.location.href = "/force-logout"), className: "flex items-center gap-2 rounded-xl bg-error px-5 py-2.5 text-white text-sm md:text-base font-medium shadow hover:bg-error/90 transition", children: [_jsx(Icon, { icon: "material-symbols:logout-rounded" }), "Logout"] })] })] }));
3
+ export default function NotAuthorized({ defaultLogoutPath }) {
4
+ function goToLogout() {
5
+ // Get the current pathname: "/student-attendance/faculty/today"
6
+ const pathname = window.location.pathname;
7
+ const isLocalhost = pathname.includes("localhost");
8
+ if (isLocalhost) {
9
+ window.location.href = "/logout";
10
+ return;
11
+ }
12
+ // optional special case for logging out from the root path (e.g., "/")
13
+ if (defaultLogoutPath && !isLocalhost) {
14
+ window.location.href = defaultLogoutPath;
15
+ return;
16
+ }
17
+ // Production logic to determine logout path:
18
+ // Split by '/' and get the first two segments: ["", "student-attendance", "faculty", "today"]
19
+ const segments = pathname.split("/");
20
+ // Output: ["", "student-attendance", "faculty", "today"]
21
+ // ↑
22
+ // Empty string at index 0
23
+ const basePath = "/" + segments[1]; // "/student-attendance"
24
+ // Navigate to logout (go up one level from faculty)
25
+ window.location.href = basePath + "/logout";
26
+ // Results in: /student-attendance/logout
27
+ return;
28
+ }
29
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center min-h-screen px-6 text-center space-y-10", children: [_jsx(Icon, { icon: "fluent-mdl2:protect-restrict", className: "text-warning text-opacity-80 h-48 w-48 md:h-56 md:w-56" }), _jsxs("div", { className: "max-w-xl space-y-4", children: [_jsx("h1", { className: "text-3xl md:text-4xl font-bold text-warning", children: "Not Authorized" }), _jsxs("p", { className: "text-base text-text md:text-lg text-muted-foreground", children: ["You don\u2019t have the necessary permissions to access this page. ", _jsx("br", {}), "Please contact your administrator if you believe this is a mistake."] })] }), _jsx("p", { className: "text-sm md:text-base text-muted-foreground", children: "\u2014 or \u2014" }), _jsxs("div", { className: "flex flex-wrap justify-center gap-4", children: [_jsxs("button", { type: "button", onClick: () => window.history.back(), className: "flex items-center gap-2 rounded-xl bg-primary px-5 py-2.5 text-white text-sm md:text-base font-medium shadow hover:bg-primary/90 transition", children: [_jsx(Icon, { icon: "material-symbols:arrow-back-rounded" }), "Go Back"] }), _jsxs("button", { type: "button", onClick: goToLogout, className: "flex items-center gap-2 rounded-xl bg-error px-5 py-2.5 text-white text-sm md:text-base font-medium shadow hover:bg-error/90 transition", children: [_jsx(Icon, { icon: "material-symbols:logout-rounded" }), "Logout"] })] })] }));
5
30
  }
@@ -5,6 +5,7 @@ export type Props = {
5
5
  notificationBaseUrl: string;
6
6
  applicationsBaseUrls: Partial<Record<CONSTANTS.Application.ApplicationKeys, string>>;
7
7
  navigate?: (to: string) => void;
8
+ accessToken?: string;
8
9
  };
9
- export default function NotificationMenu({ applicationKey, notificationBaseUrl, limit, applicationsBaseUrls, navigate, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export default function NotificationMenu({ applicationKey, notificationBaseUrl, limit, applicationsBaseUrls, navigate, accessToken, }: Props): import("react/jsx-runtime").JSX.Element;
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/notifications-menu/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAc,MAAM,sBAAsB,CAAC;AAmB7D,MAAM,MAAM,KAAK,GAAG;IAClB,cAAc,EACV,SAAS,CAAC,WAAW,CAAC,eAAe,GACrC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAC3B,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE,MAAM,CAAC,CACtD,CAAC;IACF,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,cAAc,EACd,mBAAmB,EACnB,KAAyC,EACzC,oBAAoB,EACpB,QAAQ,GACT,EAAE,KAAK,2CAuaP"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/notifications-menu/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAc,MAAM,sBAAsB,CAAC;AAY7D,MAAM,MAAM,KAAK,GAAG;IAClB,cAAc,EACV,SAAS,CAAC,WAAW,CAAC,eAAe,GACrC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAC3B,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE,MAAM,CAAC,CACtD,CAAC;IACF,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,cAAc,EACd,mBAAmB,EACnB,KAAyC,EACzC,oBAAoB,EACpB,QAAQ,EACR,WAAW,GACZ,EAAE,KAAK,2CAocP"}
@@ -6,18 +6,12 @@ import clsx from "clsx";
6
6
  import Icon from "../icon";
7
7
  import NativeMenu from "../native-menu";
8
8
  import NativeMenuItem from "../native-menu/native-menu-item";
9
- import { getCookie } from "../../utils/cookie";
10
9
  import axios from "axios";
11
10
  import Skeleton from "../skeleton";
12
11
  import * as NotificationLocalStorageUtils from "../../utils/notification-localstorage";
13
12
  const DEFAULT_FETCH_NOTIFICATIONS_LIMIT = 50;
14
13
  const ICON_SIZE = "h-5 w-5";
15
- const axiosOptions = {
16
- headers: {
17
- Authorization: `Bearer ${getCookie(CONSTANTS.JWT.JWTCookieKey)}`,
18
- },
19
- };
20
- export default function NotificationMenu({ applicationKey, notificationBaseUrl, limit = DEFAULT_FETCH_NOTIFICATIONS_LIMIT, applicationsBaseUrls, navigate, }) {
14
+ export default function NotificationMenu({ applicationKey, notificationBaseUrl, limit = DEFAULT_FETCH_NOTIFICATIONS_LIMIT, applicationsBaseUrls, navigate, accessToken, }) {
21
15
  const [closeMenu, setCloseMenu] = useState(true);
22
16
  const [loading, setLoading] = useState(false);
23
17
  const [page, setPage] = useState(1);
@@ -26,24 +20,30 @@ export default function NotificationMenu({ applicationKey, notificationBaseUrl,
26
20
  const [unreadCount, setUnreadCount] = useState(0);
27
21
  const [notifications, setNotifications] = useState([]);
28
22
  useEffect(() => {
29
- setLoading(true);
30
- axios
31
- .get(`${notificationBaseUrl}?applicationKey=${applicationKey}&page=${page}&limit=${limit}`, axiosOptions)
32
- .then((response) => {
33
- const { data, page: p, totalCount: tc, totalPages: tp, unreadCount, } = response.data;
34
- setTotalCount(tc);
35
- setTotalPages(tp);
36
- setUnreadCount(unreadCount);
37
- setNotifications((prev) => {
38
- const all = Utils.Array.concatWithoutDuplicates(prev, data, (a, b) => a.id === b.id);
39
- return all;
23
+ if (accessToken) {
24
+ setLoading(true);
25
+ axios
26
+ .get(`${notificationBaseUrl}?applicationKey=${applicationKey}&page=${page}&limit=${limit}`, {
27
+ headers: {
28
+ Authorization: `Bearer ${accessToken}`,
29
+ },
30
+ })
31
+ .then((response) => {
32
+ const { data, page: p, totalCount: tc, totalPages: tp, unreadCount, } = response.data;
33
+ setTotalCount(tc);
34
+ setTotalPages(tp);
35
+ setUnreadCount(unreadCount);
36
+ setNotifications((prev) => {
37
+ const all = Utils.Array.concatWithoutDuplicates(prev, data, (a, b) => a.id === b.id);
38
+ return all;
39
+ });
40
+ return response;
41
+ })
42
+ .finally(() => {
43
+ setLoading(false);
40
44
  });
41
- return response;
42
- })
43
- .finally(() => {
44
- setLoading(false);
45
- });
46
- }, [applicationKey, notificationBaseUrl, limit, page]);
45
+ }
46
+ }, [applicationKey, notificationBaseUrl, limit, page, accessToken]);
47
47
  useEffect(() => {
48
48
  const handler = () => {
49
49
  const notificationIds = NotificationLocalStorageUtils.getNewNotificationIds();
@@ -56,10 +56,16 @@ export default function NotificationMenu({ applicationKey, notificationBaseUrl,
56
56
  return () => window.removeEventListener(NotificationLocalStorageUtils.NEW_NOTIFICATION_EVENT_NAME, handler);
57
57
  }, []);
58
58
  const handleNewNotificationCome = (notificationId) => {
59
+ if (!accessToken)
60
+ return;
59
61
  const exist = notifications.find((n) => n.id === notificationId);
60
62
  if (!exist) {
61
63
  axios
62
- .get(`${notificationBaseUrl}/${notificationId}`, axiosOptions)
64
+ .get(`${notificationBaseUrl}/${notificationId}`, {
65
+ headers: {
66
+ Authorization: `Bearer ${accessToken}`,
67
+ },
68
+ })
63
69
  .then((response) => {
64
70
  setUnreadCount((prev) => prev + 1);
65
71
  setTotalCount((prev) => prev + 1);
@@ -69,8 +75,14 @@ export default function NotificationMenu({ applicationKey, notificationBaseUrl,
69
75
  NotificationLocalStorageUtils.removeNotificationId(notificationId);
70
76
  };
71
77
  const markAsRead = (notification) => {
78
+ if (!accessToken)
79
+ return;
72
80
  axios
73
- .put(`${notificationBaseUrl}/${notification.id}/read`, {}, axiosOptions)
81
+ .put(`${notificationBaseUrl}/${notification.id}/read`, {}, {
82
+ headers: {
83
+ Authorization: `Bearer ${accessToken}`,
84
+ },
85
+ })
74
86
  .then((response) => {
75
87
  const readed = response.data;
76
88
  setNotifications((prev) => {
@@ -85,8 +97,14 @@ export default function NotificationMenu({ applicationKey, notificationBaseUrl,
85
97
  });
86
98
  };
87
99
  const markAllAsRead = () => {
100
+ if (!accessToken)
101
+ return;
88
102
  axios
89
- .put(`${notificationBaseUrl}/read-all`, {}, axiosOptions)
103
+ .put(`${notificationBaseUrl}/read-all`, {}, {
104
+ headers: {
105
+ Authorization: `Bearer ${accessToken}`,
106
+ },
107
+ })
90
108
  .then(() => {
91
109
  setNotifications((prev) => {
92
110
  return prev.map((n) => {
@@ -205,6 +223,9 @@ export default function NotificationMenu({ applicationKey, notificationBaseUrl,
205
223
  }, 200);
206
224
  }, children: _jsxs("div", { className: "flex-1 p-2", children: [_jsxs("div", { className: "flex flex-row items-center justify-between ", children: [_jsxs("div", { className: "flex flex-row items-center gap-2", children: [_jsx("div", { className: "font-semibold", children: icon }), " ", _jsxs("span", { className: "text-sm", children: [" ", title] })] }), _jsx("div", { className: "flex justify-end", children: _jsx("p", { className: "text-text text-xs", children: Utils.Moment.formatDateAsLabel(notification.createdAt) }) })] }), _jsx("div", { children: description })] }) }));
207
225
  };
226
+ if (!accessToken) {
227
+ return (_jsx("p", { className: "p-4 text-center text-sm text-gray-500", children: "Please provide an access token to view notifications." }));
228
+ }
208
229
  return (_jsx(NativeMenu, { size: "xl", menuButton: _jsxs("div", { className: "relative", children: [_jsx(Icon, { icon: "mingcute:notification-line", className: " hover:text-opacity-50 w-5 h-5 custom-animation" }), unreadCount !== 0 && (_jsx("div", { className: "absolute -top-2 -right-2 w-5 h-5 text-center rounded-full text-white bg-error shadow-md flex items-center justify-center", children: _jsx("p", { className: "text-xs select-none", children: unreadCount }) }))] }), maxHeight: 350, onReachBottom: () => LoadMoreNotifications(), closeMenu: closeMenu, setCloseMenu: setCloseMenu, children: _jsxs("div", { className: "flex flex-col ", children: [_jsxs("div", { className: "flex items-center justify-between gap-1 p-2", children: [_jsx("p", { className: "text-xl font-bold", children: "Notifications" }), _jsxs("button", { type: "button", className: "flex items-center gap-1 px-2 text-primary custom-animation hover:text-opacity-75", onClick: () => markAllAsRead(), children: [_jsx("p", { children: "Mare all as read" }), _jsx(Icon, { icon: "solar:check-read-linear", className: ICON_SIZE })] })] }), _jsxs("div", { className: "flex flex-col ", children: [notifications.map((notification) => (_jsx(NativeMenuItem, { children: renderNotificationItem(notification) }, `notification-${notification.id}`))), loading && (_jsx(_Fragment, { children: Array(3)
209
230
  .fill({})
210
231
  .map((_, i) => (_jsx(Skeleton, { className: "h-24 w-full" }, `notification-loading-${i}`))) }))] }), !loading && notifications.length === 0 && (_jsx("p", { className: "text-text text-center text-xs", children: "There are no more notifications" }))] }) }));
@@ -1,4 +1,6 @@
1
1
  import React from "react";
2
- export type Props = {} & React.HTMLAttributes<HTMLDivElement>;
3
- export default function Skeleton({ className, ...props }: Props): import("react/jsx-runtime").JSX.Element;
2
+ export type Props = {
3
+ count?: number;
4
+ } & React.HTMLAttributes<HTMLDivElement>;
5
+ export default function Skeleton({ className, count, ...props }: Props): import("react/jsx-runtime").JSX.Element;
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/skeleton/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,KAAK,GAAG,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAE9D,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,2CAO9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/skeleton/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAE9E,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,2CAYzE"}
@@ -1,5 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import clsx from "clsx";
3
- export default function Skeleton({ className, ...props }) {
4
- return (_jsx("div", { className: clsx("bg-gray-300 animate-pulse rounded-md", className), ...props }));
3
+ export default function Skeleton({ className, count = 1, ...props }) {
4
+ return (_jsx(_Fragment, { children: Array.from({ length: count }).map((_, index) => (_jsx("div", { className: clsx("bg-gray-300 animate-pulse rounded-md", className), ...props }, index))) }));
5
5
  }
@@ -1,4 +1,4 @@
1
1
  import { CONSTANTS } from "sea-platform-helpers";
2
- export declare function useHasPermission(permission: CONSTANTS.Permission.PermissionKeys): boolean;
3
- export declare function useHasOneOfPermissions(permissions: CONSTANTS.Permission.PermissionKeys[]): boolean;
2
+ export declare function useHasPermission(permission: CONSTANTS.Permission.PermissionKeys, accessToken: string): boolean;
3
+ export declare function useHasOneOfPermissions(permissions: CONSTANTS.Permission.PermissionKeys[], accessToken: string): boolean;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-has-permission-access/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAIjD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,SAAS,CAAC,UAAU,CAAC,cAAc,GAC9C,OAAO,CAQT;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,SAAS,CAAC,UAAU,CAAC,cAAc,EAAE,GACjD,OAAO,CAUT"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-has-permission-access/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,SAAS,CAAC,UAAU,CAAC,cAAc,EAC/C,WAAW,EAAE,MAAM,GAClB,OAAO,CAOT;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,SAAS,CAAC,UAAU,CAAC,cAAc,EAAE,EAClD,WAAW,EAAE,MAAM,GAClB,OAAO,CAST"}
@@ -1,18 +1,14 @@
1
1
  "use client";
2
- import { CONSTANTS } from "sea-platform-helpers";
3
- import { getCookie } from "../../utils/cookie";
4
2
  import { jwtDecode } from "../../utils/jwt";
5
- export function useHasPermission(permission) {
3
+ export function useHasPermission(permission, accessToken) {
6
4
  var _a, _b;
7
- const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
8
5
  if (!accessToken || accessToken === undefined)
9
6
  return false;
10
7
  const payload = jwtDecode(accessToken);
11
8
  return (_b = (_a = payload === null || payload === void 0 ? void 0 : payload.permissionKeys) === null || _a === void 0 ? void 0 : _a.includes(permission)) !== null && _b !== void 0 ? _b : false;
12
9
  }
13
- export function useHasOneOfPermissions(permissions) {
10
+ export function useHasOneOfPermissions(permissions, accessToken) {
14
11
  var _a, _b;
15
- const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
16
12
  if (!accessToken || accessToken === undefined)
17
13
  return false;
18
14
  const payload = jwtDecode(accessToken);
@@ -1,3 +1,3 @@
1
1
  import { CONSTANTS } from "sea-platform-helpers";
2
- export declare function useHasApplicationAccess(applicationKey: CONSTANTS.Application.ApplicationKeys): boolean;
2
+ export declare function useHasApplicationAccess(applicationKey: CONSTANTS.Application.ApplicationKeys, accessToken: string): boolean;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/user-has-application-access/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAIjD,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,GACpD,OAAO,CAST"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/user-has-application-access/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,EACrD,WAAW,EAAE,MAAM,GAClB,OAAO,CAOT"}
@@ -1,10 +1,7 @@
1
1
  "use client";
2
- import { CONSTANTS } from "sea-platform-helpers";
3
- import { getCookie } from "../../utils/cookie";
4
2
  import { jwtDecode } from "../../utils/jwt";
5
- export function useHasApplicationAccess(applicationKey) {
3
+ export function useHasApplicationAccess(applicationKey, accessToken) {
6
4
  var _a, _b;
7
- const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
8
5
  if (!accessToken || accessToken === undefined)
9
6
  return false;
10
7
  const payload = jwtDecode(accessToken);
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
- export default function MustAuth({ children, noTokenHandler, hasTokenHandler, }: Readonly<{
2
+ export default function MustAuth({ children, noTokenHandler, hasTokenHandler, accessToken, }: Readonly<{
3
3
  children: React.ReactNode;
4
4
  noTokenHandler?: () => void;
5
5
  hasTokenHandler?: () => void;
6
+ accessToken?: string;
6
7
  }>): import("react/jsx-runtime").JSX.Element;
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/middleware/must-auth/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,EAAE,QAAQ,CAAC;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC,2CAoBD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/middleware/must-auth/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,QAAQ,EACR,cAAc,EACd,eAAe,EACf,WAAW,GACZ,EAAE,QAAQ,CAAC;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC,2CAmBD"}
@@ -1,12 +1,9 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useEffect, useState } from "react";
4
- import { CONSTANTS } from "sea-platform-helpers";
5
- import { getCookie } from "../../utils/cookie";
6
- export default function MustAuth({ children, noTokenHandler, hasTokenHandler, }) {
4
+ export default function MustAuth({ children, noTokenHandler, hasTokenHandler, accessToken, }) {
7
5
  const [isCheckingAuth, setIsCheckingAuth] = useState(true);
8
6
  useEffect(() => {
9
- const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
10
7
  if (!accessToken) {
11
8
  noTokenHandler();
12
9
  }
@@ -17,7 +14,7 @@ export default function MustAuth({ children, noTokenHandler, hasTokenHandler, })
17
14
  else {
18
15
  setIsCheckingAuth(false);
19
16
  }
20
- }, [noTokenHandler, hasTokenHandler]);
17
+ }, [noTokenHandler, hasTokenHandler, accessToken]);
21
18
  if (isCheckingAuth) {
22
19
  return null;
23
20
  }
@@ -11,7 +11,8 @@ export type SocketProviderProps = {
11
11
  link: string;
12
12
  autoConnect?: boolean;
13
13
  options?: Parameters<typeof io>[1];
14
+ accessToken?: string;
14
15
  };
15
- export default function SocketProvider({ children, link, autoConnect, options, }: Readonly<SocketProviderProps>): import("react/jsx-runtime").JSX.Element;
16
+ export default function SocketProvider({ children, link, autoConnect, options, accessToken, }: Readonly<SocketProviderProps>): import("react/jsx-runtime").JSX.Element;
16
17
  export declare function useSocket(): SocketContextValue;
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/socket-provider/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAON,MAAM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IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,QAAQ,EACR,IAAI,EACJ,WAAkB,EAClB,OAAO,EACP,WAAW,GACZ,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CA0D/B;AAED,wBAAgB,SAAS,uBAMxB"}
@@ -2,11 +2,8 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from "react";
4
4
  import { io } from "socket.io-client";
5
- import { getCookie } from "../../utils/cookie";
6
- import { CONSTANTS } from "sea-platform-helpers";
7
5
  const SocketContext = createContext(null);
8
- export default function SocketProvider({ children, link, autoConnect = true, options, }) {
9
- const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
6
+ export default function SocketProvider({ children, link, autoConnect = true, options, accessToken, }) {
10
7
  const [socket, setSocket] = useState(null);
11
8
  const [status, setStatus] = useState("idle");
12
9
  const [error, setError] = useState(null);
@@ -13,6 +13,7 @@ export declare class RemoteService<TItem, TCreate = Partial<TItem>, TUpdate = Pa
13
13
  protected resource: string;
14
14
  protected model: string;
15
15
  constructor(baseUrl: string, resource: string, options: {
16
+ JWTTokenKey: string;
16
17
  cookieDomain?: string;
17
18
  onError?: (message: string) => void;
18
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/remote-service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAGtD,MAAM,WAAW,aAAa,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;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AAM;;;IAuDV,QAAQ,CACN,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,GAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAKhD,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAIpC,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;IAIrC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;IAIjD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;CAGnC"}
@@ -5,7 +5,6 @@ export class RemoteService {
5
5
  this.baseUrl = baseUrl;
6
6
  this.resource = resource;
7
7
  this.http = AxiosUtils.createInstance(`${baseUrl}/${resource}`, {
8
- JWTTokenKey: CONSTANTS.JWT.JWTCookieKey,
9
8
  withCredentials: true,
10
9
  storage: "cookie", // Use cookie storage for JWT token
11
10
  deviceIdKey: CONSTANTS.Server.DEVICE_ID_HEADER_KEY,
@@ -1,2 +1,2 @@
1
- export declare const authAxiosInstance: import("axios").AxiosInstance;
1
+ export declare const authAxiosInstance: (accessToken: string) => import("axios").AxiosInstance;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/auth-axios/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,iBAAiB,+BAK5B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/auth-axios/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,kCAMjD,CAAC"}
@@ -1,9 +1,7 @@
1
1
  import { CONSTANTS } from "sea-platform-helpers";
2
- import { getCookie } from "../cookie";
3
2
  import axios from "axios";
4
3
  import { getDeviceId } from "../device";
5
- const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
6
- export const authAxiosInstance = axios.create({
4
+ export const authAxiosInstance = (accessToken) => axios.create({
7
5
  headers: {
8
6
  Authorization: `Bearer ${accessToken}`,
9
7
  [CONSTANTS.Server.DEVICE_ID_HEADER_KEY]: getDeviceId(),
@@ -1,6 +1,6 @@
1
1
  import axios from "axios";
2
2
  type AxiosOptions = {
3
- JWTTokenKey?: string;
3
+ JWTTokenKey: string;
4
4
  withCredentials?: boolean;
5
5
  storage?: "localStorage" | "cookie";
6
6
  deviceIdKey?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/axios/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAKzD,KAAK,YAAY,GAAG;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,cAAc,GAAG,QAAQ,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,SAAS,MAAM,EACf,UAAS,YAQR,kCAoEF,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/axios/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAKzD,KAAK,YAAY,GAAG;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,cAAc,GAAG,QAAQ,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,SAAS,MAAM,EACf,UAAS,YAQR,kCAoEF,CAAC;AAEF,eAAe,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sea-react-components",
3
3
  "description": "SEA react components library",
4
- "version": "1.3.40",
4
+ "version": "1.3.41",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "build": "tsc --build && npx postcss src/styles.css -o dist/styles.css && npx postcss src/components/text-editor/style.css -o dist/components/text-editor/style.css",
@@ -48,7 +48,7 @@
48
48
  "jwt-decode": "^4.0.0",
49
49
  "lowlight": "^3.3.0",
50
50
  "react-dom": "^19.2.3",
51
- "sea-platform-helpers": "^1.5.32",
51
+ "sea-platform-helpers": "^1.5.33",
52
52
  "sea-react-components": "file:",
53
53
  "socket.io-client": "^4.8.3",
54
54
  "uuid": "^13.0.0",