sea-react-components 1.3.14 → 1.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/comments-container/comment-event-bus/index.d.ts.map +1 -1
- package/dist/components/comments-container/comment-event-bus/index.js +1 -0
- package/dist/components/comments-container/comment-form/index.d.ts.map +1 -1
- package/dist/components/comments-container/comment-item/index.d.ts.map +1 -1
- package/dist/components/comments-container/comments-list/index.d.ts.map +1 -1
- package/dist/components/comments-container/constants/index.d.ts.map +1 -1
- package/dist/components/comments-container/constants/index.js +1 -0
- package/dist/components/comments-container/index.d.ts.map +1 -1
- package/dist/components/comments-container/index.js +8 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/auth-axios/index.d.ts.map +1 -1
- package/dist/utils/auth-axios/index.js +2 -0
- package/dist/utils/axios/index.d.ts +1 -0
- package/dist/utils/axios/index.d.ts.map +1 -1
- package/dist/utils/axios/index.js +20 -5
- package/dist/utils/cookie/index.d.ts +8 -0
- package/dist/utils/cookie/index.d.ts.map +1 -1
- package/dist/utils/cookie/index.js +31 -0
- package/dist/utils/device/index.d.ts +2 -0
- package/dist/utils/device/index.d.ts.map +1 -0
- package/dist/utils/device/index.js +12 -0
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-event-bus/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-event-bus/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,QAAA,MAAM,QAAQ,uBAAqB,CAAC;AAEpC,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-form/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-form/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAK3B,eAAO,MAAM,0BAA0B;;;;MAItC,CAAC;AASF,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;IAExB,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACrC,gBAAgB,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IAEtE,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACtC,iBAAiB,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IAEvE,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;IACjE,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;CAChE,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,GACrB,EAAE,KAAK,2CA4GP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-item/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comment-item/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAS,MAAM,sBAAsB,CAAC;AAKlD,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACpE,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,WAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,eAAe,EACf,QAAQ,EACR,KAAK,GACN,EAAE,KAAK,2CAuGP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comments-list/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/comments-list/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAQ3C,KAAK,KAAK,GAAG;IACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACjE,cAAc,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,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,EAAE,MAAM,CAAC;QACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,KACE,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,eAAe,EACf,QAAQ,EACR,eAAe,EACf,KAAU,EACV,iBAAiB,GAClB,EAAE,KAAK,2CAkGP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/constants/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/comments-container/constants/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;CAG1B,CAAC"}
|
|
@@ -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;
|
|
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;AAQtD,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,EAAE,MAAM,CAAC;QACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,KACE,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,eAAe,EACf,QAAQ,EACR,KAAK,EACL,KAAU,EACV,kBAAkB,EAClB,iBAAiB,GAClB,EAAE,KAAK,2CAkDP"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
4
|
import { CONSTANTS } from "sea-platform-helpers";
|
|
5
5
|
import { getCookie } from "../../utils/cookie";
|
|
6
6
|
import { jwtDecode } from "../../utils/jwt";
|
|
7
7
|
import CommentForm from "./comment-form";
|
|
8
8
|
import CommentsList from "./comments-list";
|
|
9
9
|
import CommentItem from "./comment-item";
|
|
10
|
-
const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
|
|
11
|
-
const payload = jwtDecode(accessToken);
|
|
12
|
-
const accountId = payload.id;
|
|
13
10
|
export default function CommentsContainer({ commentsBaseUrl, objectId, model, limit = 10, highlightCommentId, renderCommentItem, }) {
|
|
11
|
+
const [accountId, setAccountId] = useState("");
|
|
14
12
|
const [commentToEdit, setCommentToEdit] = useState();
|
|
15
13
|
const [replyOnComment, setReplyOnComment] = useState();
|
|
14
|
+
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
|
+
}, []);
|
|
16
20
|
return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx(CommentForm, { commentsBaseUrl: commentsBaseUrl, objectId: objectId, model: model, commentToEdit: commentToEdit, setCommentToEdit: setCommentToEdit, replyOnComment: replyOnComment, setReplyOnComment: setReplyOnComment, onCreateCommentSuccess: () => {
|
|
17
21
|
setCommentToEdit(undefined);
|
|
18
22
|
setReplyOnComment(undefined);
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * as AxiosUtils from "./utils/axios";
|
|
|
6
6
|
export * as FileUtils from "./utils/file";
|
|
7
7
|
export * as CookieUtils from "./utils/cookie";
|
|
8
8
|
export * as FirebaseUtils from "./utils/firebase-client";
|
|
9
|
+
export * as DeviceUtils from "./utils/device";
|
|
9
10
|
export { default as MustAuth } from "./middleware/must-auth";
|
|
10
11
|
export { useHasApplicationAccess } from "./hooks/user-has-application-access";
|
|
11
12
|
export { useHasOneOfPermissions, useHasPermission, } from "./hooks/use-has-permission-access";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,aAAa,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,aAAa,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,w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index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * as AxiosUtils from "./utils/axios";
|
|
|
8
8
|
export * as FileUtils from "./utils/file";
|
|
9
9
|
export * as CookieUtils from "./utils/cookie";
|
|
10
10
|
export * as FirebaseUtils from "./utils/firebase-client";
|
|
11
|
+
export * as DeviceUtils from "./utils/device";
|
|
11
12
|
// middleware
|
|
12
13
|
export { default as MustAuth } from "./middleware/must-auth";
|
|
13
14
|
// hooks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/hoc/can-access-application/index.tsx","../src/hoc/with-authorization/index.tsx","../src/components/accordion/index.tsx","../src/components/activity-message/index.tsx","../src/components/alert/index.tsx","../src/components/auto-complete-input/index.tsx","../src/components/avatar/index.tsx","../src/components/badge/index.tsx","../src/components/breadcrumb/index.tsx","../src/components/button/index.tsx","../src/components/calendar/index.tsx","../src/components/cards-list/index.tsx","../src/components/carousel/index.tsx","../src/components/checkbox/index.tsx","../src/components/color-picker/index.tsx","../src/components/comments-container/index.tsx","../src/components/comments-container/comment-event-bus/index.ts","../src/components/comments-container/comment-form/index.tsx","../src/components/comments-container/comment-item/index.tsx","../src/components/comments-container/comments-list/index.tsx","../src/components/comments-container/constants/index.ts","../src/components/comments-container/use-comments/index.tsx","../src/components/count-down/index.tsx","../src/components/day-calendar/index.tsx","../src/components/drawer/index.tsx","../src/components/editable-text/index.tsx","../src/components/expandable-text/index.tsx","../src/components/file-input/index.tsx","../src/components/file-input/components/file-item/index.tsx","../src/components/firebase-token-handler/index.tsx","../src/components/icon/index.tsx","../src/components/input/index.tsx","../src/components/item-not-found/index.tsx","../src/components/list-item/index.tsx","../src/components/list-item/components/page-button/index.tsx","../src/components/list-item/components/pagination/index.tsx","../src/components/loader/index.tsx","../src/components/menu/index.tsx","../src/components/menu/menu-item/index.tsx","../src/components/modal/index.tsx","../src/components/month-calendar/index.tsx","../src/components/native-menu/index.tsx","../src/components/native-menu/native-menu-item/index.tsx","../src/components/not-authorized/index.tsx","../src/components/notifications-menu/index.tsx","../src/components/otp-input/index.tsx","../src/components/paper/index.tsx","../src/components/progress-bar/index.tsx","../src/components/radio-button/index.tsx","../src/components/search-input/index.tsx","../src/components/select/index.tsx","../src/components/skeleton/index.tsx","../src/components/stacked-avatars/index.tsx","../src/components/tab/index.tsx","../src/components/table/index.tsx","../src/components/text-editor/index.tsx","../src/components/text-editor/components/toolbar/index.tsx","../src/components/text-editor/utils/index.ts","../src/components/textarea/index.tsx","../src/components/toggle/index.tsx","../src/components/tooltip/index.tsx","../src/components/tree-checkbox/index.tsx","../src/components/tree-checkbox/components/tree-checkbox-item/index.tsx","../src/components/tree-checkbox/utils/index.ts","../src/components/week-calendar/index.tsx","../src/constants/index.ts","../src/hooks/list-items-hook/types.ts","../src/hooks/list-items-hook/usebulkactions.ts","../src/hooks/list-items-hook/usefilters.ts","../src/hooks/list-items-hook/usepagination.ts","../src/hooks/use-has-permission-access/index.ts","../src/hooks/user-has-application-access/index.ts","../src/middleware/must-auth/index.tsx","../src/utils/auth-axios/index.ts","../src/utils/axios/index.ts","../src/utils/color/index.ts","../src/utils/cookie/index.ts","../src/utils/file/index.ts","../src/utils/firebase-client/firebase.ts","../src/utils/firebase-client/index.ts","../src/utils/firebase-client/types.ts","../src/utils/jwt/index.ts","../src/utils/notification-localstorage/index.ts","../src/utils/validation/index.ts"],"version":"5.6.3"}
|
|
1
|
+
{"root":["../src/index.ts","../src/hoc/can-access-application/index.tsx","../src/hoc/with-authorization/index.tsx","../src/components/accordion/index.tsx","../src/components/activity-message/index.tsx","../src/components/alert/index.tsx","../src/components/auto-complete-input/index.tsx","../src/components/avatar/index.tsx","../src/components/badge/index.tsx","../src/components/breadcrumb/index.tsx","../src/components/button/index.tsx","../src/components/calendar/index.tsx","../src/components/cards-list/index.tsx","../src/components/carousel/index.tsx","../src/components/checkbox/index.tsx","../src/components/color-picker/index.tsx","../src/components/comments-container/index.tsx","../src/components/comments-container/comment-event-bus/index.ts","../src/components/comments-container/comment-form/index.tsx","../src/components/comments-container/comment-item/index.tsx","../src/components/comments-container/comments-list/index.tsx","../src/components/comments-container/constants/index.ts","../src/components/comments-container/use-comments/index.tsx","../src/components/count-down/index.tsx","../src/components/day-calendar/index.tsx","../src/components/drawer/index.tsx","../src/components/editable-text/index.tsx","../src/components/expandable-text/index.tsx","../src/components/file-input/index.tsx","../src/components/file-input/components/file-item/index.tsx","../src/components/firebase-token-handler/index.tsx","../src/components/icon/index.tsx","../src/components/input/index.tsx","../src/components/item-not-found/index.tsx","../src/components/list-item/index.tsx","../src/components/list-item/components/page-button/index.tsx","../src/components/list-item/components/pagination/index.tsx","../src/components/loader/index.tsx","../src/components/menu/index.tsx","../src/components/menu/menu-item/index.tsx","../src/components/modal/index.tsx","../src/components/month-calendar/index.tsx","../src/components/native-menu/index.tsx","../src/components/native-menu/native-menu-item/index.tsx","../src/components/not-authorized/index.tsx","../src/components/notifications-menu/index.tsx","../src/components/otp-input/index.tsx","../src/components/paper/index.tsx","../src/components/progress-bar/index.tsx","../src/components/radio-button/index.tsx","../src/components/search-input/index.tsx","../src/components/select/index.tsx","../src/components/skeleton/index.tsx","../src/components/stacked-avatars/index.tsx","../src/components/tab/index.tsx","../src/components/table/index.tsx","../src/components/text-editor/index.tsx","../src/components/text-editor/components/toolbar/index.tsx","../src/components/text-editor/utils/index.ts","../src/components/textarea/index.tsx","../src/components/toggle/index.tsx","../src/components/tooltip/index.tsx","../src/components/tree-checkbox/index.tsx","../src/components/tree-checkbox/components/tree-checkbox-item/index.tsx","../src/components/tree-checkbox/utils/index.ts","../src/components/week-calendar/index.tsx","../src/constants/index.ts","../src/hooks/list-items-hook/types.ts","../src/hooks/list-items-hook/usebulkactions.ts","../src/hooks/list-items-hook/usefilters.ts","../src/hooks/list-items-hook/usepagination.ts","../src/hooks/use-has-permission-access/index.ts","../src/hooks/user-has-application-access/index.ts","../src/middleware/must-auth/index.tsx","../src/utils/auth-axios/index.ts","../src/utils/axios/index.ts","../src/utils/color/index.ts","../src/utils/cookie/index.ts","../src/utils/device/index.ts","../src/utils/file/index.ts","../src/utils/firebase-client/firebase.ts","../src/utils/firebase-client/index.ts","../src/utils/firebase-client/types.ts","../src/utils/jwt/index.ts","../src/utils/notification-localstorage/index.ts","../src/utils/validation/index.ts"],"version":"5.6.3"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/auth-axios/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/auth-axios/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,iBAAiB,+BAK5B,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CONSTANTS } from "sea-platform-helpers";
|
|
2
2
|
import { getCookie } from "../cookie";
|
|
3
3
|
import axios from "axios";
|
|
4
|
+
import { getDeviceId } from "../device";
|
|
4
5
|
const accessToken = getCookie(CONSTANTS.JWT.JWTCookieKey);
|
|
5
6
|
export const authAxiosInstance = axios.create({
|
|
6
7
|
headers: {
|
|
7
8
|
Authorization: `Bearer ${accessToken}`,
|
|
9
|
+
[CONSTANTS.Server.DEVICE_ID_HEADER_KEY]: getDeviceId(),
|
|
8
10
|
},
|
|
9
11
|
});
|
|
@@ -3,6 +3,7 @@ type AxiosOptions = {
|
|
|
3
3
|
JWTTokenKey?: string;
|
|
4
4
|
withCredentials?: boolean;
|
|
5
5
|
storage?: "localStorage" | "cookie";
|
|
6
|
+
deviceIdKey?: string;
|
|
6
7
|
};
|
|
7
8
|
export declare const createInstance: (baseURL: string, options?: AxiosOptions) => import("axios").AxiosInstance;
|
|
8
9
|
export default axios;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/axios/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,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,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,cAAc,GAAG,QAAQ,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,cAAc,YAChB,MAAM,YACN,YAAY,kCA6DtB,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import { getCookie } from "../cookie";
|
|
2
|
+
import { getCookie, removeCookie } from "../cookie";
|
|
3
|
+
import { CONSTANTS } from "sea-platform-helpers";
|
|
4
|
+
import { getDeviceId } from "../device";
|
|
3
5
|
export const createInstance = (baseURL, options = {
|
|
4
6
|
withCredentials: true,
|
|
5
7
|
JWTTokenKey: "JWTToken",
|
|
6
8
|
storage: "localStorage",
|
|
9
|
+
deviceIdKey: CONSTANTS.Server.DEVICE_ID_HEADER_KEY,
|
|
7
10
|
}) => {
|
|
8
11
|
const axiosInstance = axios.create({
|
|
9
12
|
baseURL,
|
|
10
13
|
withCredentials: options.withCredentials,
|
|
11
14
|
});
|
|
15
|
+
console.log("Creating axios instance with options:", options);
|
|
12
16
|
axiosInstance.interceptors.request.use((config) => {
|
|
13
|
-
|
|
17
|
+
var _a;
|
|
18
|
+
const deviceId = getDeviceId();
|
|
14
19
|
let token = undefined;
|
|
15
20
|
if (options.storage === "localStorage") {
|
|
16
21
|
token = localStorage.getItem(options.JWTTokenKey);
|
|
@@ -18,7 +23,9 @@ export const createInstance = (baseURL, options = {
|
|
|
18
23
|
else if (options.storage === "cookie") {
|
|
19
24
|
token = getCookie(options.JWTTokenKey);
|
|
20
25
|
}
|
|
26
|
+
console.log("deviceId:", deviceId);
|
|
21
27
|
config.headers["Authorization"] = `Bearer ${token}`;
|
|
28
|
+
config.headers[(_a = options.deviceIdKey) !== null && _a !== void 0 ? _a : CONSTANTS.Server.DEVICE_ID_HEADER_KEY] = deviceId;
|
|
22
29
|
return config;
|
|
23
30
|
}, (error) => {
|
|
24
31
|
// Handle request error
|
|
@@ -27,9 +34,17 @@ export const createInstance = (baseURL, options = {
|
|
|
27
34
|
axiosInstance.interceptors.response.use((response) => {
|
|
28
35
|
return response.data;
|
|
29
36
|
}, (error) => {
|
|
30
|
-
var _a;
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
var _a, _b, _c, _d;
|
|
38
|
+
const message = (_c = String((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message)) !== null && _c !== void 0 ? _c : error.message;
|
|
39
|
+
console.log(`Error: ${message}`);
|
|
40
|
+
if ([
|
|
41
|
+
CONSTANTS.Server.ERROR_MESSAGES.UNAUTHENTICATED,
|
|
42
|
+
CONSTANTS.Server.ERROR_MESSAGES.REVOKED_TOKEN,
|
|
43
|
+
].includes(message)) {
|
|
44
|
+
console.log("Unauthenticated or invalid input - logging out");
|
|
45
|
+
removeCookie(options.JWTTokenKey);
|
|
46
|
+
}
|
|
47
|
+
return Promise.reject((_d = error.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
33
48
|
});
|
|
34
49
|
return axiosInstance;
|
|
35
50
|
};
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
export declare const getCookie: (name: string) => string | undefined;
|
|
2
|
+
export declare const setCookie: (name: string, value: string, options?: {
|
|
3
|
+
days?: number;
|
|
4
|
+
path?: string;
|
|
5
|
+
domain?: string;
|
|
6
|
+
secure?: boolean;
|
|
7
|
+
sameSite?: "Strict" | "Lax" | "None";
|
|
8
|
+
}) => void;
|
|
9
|
+
export declare const removeCookie: (name: string) => void;
|
|
2
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/cookie/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MAAM,GAAG,SAMjD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/cookie/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MAAM,GAAG,SAMjD,CAAC;AAEF,eAAO,MAAM,SAAS,SACd,MAAM,SACL,MAAM,YACH;IACR,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CACtC,KACA,IAiBF,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,KAAG,IAa3C,CAAC"}
|
|
@@ -6,3 +6,34 @@ export const getCookie = (name) => {
|
|
|
6
6
|
return (_a = parts.pop()) === null || _a === void 0 ? void 0 : _a.split(";").shift();
|
|
7
7
|
}
|
|
8
8
|
};
|
|
9
|
+
export const setCookie = (name, value, options) => {
|
|
10
|
+
var _a;
|
|
11
|
+
let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)};`;
|
|
12
|
+
// Expiration
|
|
13
|
+
if (options === null || options === void 0 ? void 0 : options.days) {
|
|
14
|
+
const date = new Date();
|
|
15
|
+
date.setTime(date.getTime() + options.days * 24 * 60 * 60 * 1000);
|
|
16
|
+
cookie += ` expires=${date.toUTCString()};`;
|
|
17
|
+
}
|
|
18
|
+
// Path, Domain, Security, SameSite
|
|
19
|
+
cookie += ` path=${(_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : "/"};`;
|
|
20
|
+
if (options === null || options === void 0 ? void 0 : options.domain)
|
|
21
|
+
cookie += ` domain=${options.domain};`;
|
|
22
|
+
if (options === null || options === void 0 ? void 0 : options.secure)
|
|
23
|
+
cookie += ` secure;`;
|
|
24
|
+
if (options === null || options === void 0 ? void 0 : options.sameSite)
|
|
25
|
+
cookie += ` SameSite=${options.sameSite};`;
|
|
26
|
+
document.cookie = cookie;
|
|
27
|
+
};
|
|
28
|
+
export const removeCookie = (name) => {
|
|
29
|
+
// Try removing it for all common scopes
|
|
30
|
+
const domains = [window.location.hostname, `.${window.location.hostname}`];
|
|
31
|
+
const paths = ["/", ""];
|
|
32
|
+
domains.forEach((domain) => {
|
|
33
|
+
paths.forEach((path) => {
|
|
34
|
+
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=${path}; domain=${domain};`;
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
// Also try without domain (just in case)
|
|
38
|
+
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;`;
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/device/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAAO,MAS9B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from "uuid";
|
|
2
|
+
import { getCookie, setCookie } from "../cookie";
|
|
3
|
+
export const getDeviceId = () => {
|
|
4
|
+
if (typeof window === "undefined")
|
|
5
|
+
return ""; // SSR safety
|
|
6
|
+
let deviceId = getCookie("deviceId");
|
|
7
|
+
if (!deviceId) {
|
|
8
|
+
deviceId = uuidv4();
|
|
9
|
+
setCookie("deviceId", deviceId, { days: 3650, path: "/" });
|
|
10
|
+
}
|
|
11
|
+
return deviceId;
|
|
12
|
+
};
|
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.
|
|
4
|
+
"version": "1.3.15",
|
|
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,8 +48,9 @@
|
|
|
48
48
|
"jwt-decode": "^4.0.0",
|
|
49
49
|
"lowlight": "^3.3.0",
|
|
50
50
|
"react-dom": "^18.3.1",
|
|
51
|
-
"sea-platform-helpers": "^1.5.
|
|
51
|
+
"sea-platform-helpers": "^1.5.12",
|
|
52
52
|
"sea-react-components": "file:",
|
|
53
|
+
"uuid": "^13.0.0",
|
|
53
54
|
"yup": "^1.5.0"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|