@replyke/core 5.1.5-beta.2 → 5.1.5-beta.4
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/cjs/context/index.d.ts +1 -1
- package/dist/cjs/context/index.js +5 -3
- package/dist/cjs/context/index.js.map +1 -1
- package/dist/cjs/context/replyke-context.d.ts +0 -1
- package/dist/cjs/context/replyke-context.js +2 -3
- package/dist/cjs/context/replyke-context.js.map +1 -1
- package/dist/cjs/context/replyke-store-context.d.ts +3 -2
- package/dist/cjs/context/replyke-store-context.js +23 -6
- package/dist/cjs/context/replyke-store-context.js.map +1 -1
- package/dist/cjs/hooks/auth-redux/index.d.ts +2 -0
- package/dist/cjs/hooks/auth-redux/index.js +11 -0
- package/dist/cjs/hooks/auth-redux/index.js.map +1 -0
- package/dist/cjs/hooks/auth-redux/useAuthRedux.d.ts +32 -0
- package/dist/cjs/hooks/auth-redux/useAuthRedux.js +180 -0
- package/dist/cjs/hooks/auth-redux/useAuthRedux.js.map +1 -0
- package/dist/cjs/hooks/auth-redux/useUserRedux.d.ts +6 -0
- package/dist/cjs/hooks/auth-redux/useUserRedux.js +20 -0
- package/dist/cjs/hooks/auth-redux/useUserRedux.js.map +1 -0
- package/dist/cjs/index.d.ts +7 -5
- package/dist/cjs/index.js +15 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/store/api/baseApi.js +12 -4
- package/dist/cjs/store/api/baseApi.js.map +1 -1
- package/dist/cjs/store/index.d.ts +2 -0
- package/dist/cjs/store/middleware.js +6 -8
- package/dist/cjs/store/middleware.js.map +1 -1
- package/dist/cjs/store/rootReducer.d.ts +2 -0
- package/dist/cjs/store/rootReducer.js +5 -0
- package/dist/cjs/store/rootReducer.js.map +1 -1
- package/dist/cjs/store/slices/authSlice.d.ts +24 -0
- package/dist/cjs/store/slices/authSlice.js +79 -0
- package/dist/cjs/store/slices/authSlice.js.map +1 -0
- package/dist/cjs/store/slices/authThunks.d.ts +40 -0
- package/dist/cjs/store/slices/authThunks.js +357 -0
- package/dist/cjs/store/slices/authThunks.js.map +1 -0
- package/dist/esm/context/index.d.ts +1 -1
- package/dist/esm/context/index.js +3 -1
- package/dist/esm/context/index.js.map +1 -1
- package/dist/esm/context/replyke-context.d.ts +0 -1
- package/dist/esm/context/replyke-context.js +2 -3
- package/dist/esm/context/replyke-context.js.map +1 -1
- package/dist/esm/context/replyke-store-context.d.ts +3 -2
- package/dist/esm/context/replyke-store-context.js +25 -8
- package/dist/esm/context/replyke-store-context.js.map +1 -1
- package/dist/esm/hooks/auth-redux/index.d.ts +2 -0
- package/dist/esm/hooks/auth-redux/index.js +3 -0
- package/dist/esm/hooks/auth-redux/index.js.map +1 -0
- package/dist/esm/hooks/auth-redux/useAuthRedux.d.ts +32 -0
- package/dist/esm/hooks/auth-redux/useAuthRedux.js +174 -0
- package/dist/esm/hooks/auth-redux/useAuthRedux.js.map +1 -0
- package/dist/esm/hooks/auth-redux/useUserRedux.d.ts +6 -0
- package/dist/esm/hooks/auth-redux/useUserRedux.js +17 -0
- package/dist/esm/hooks/auth-redux/useUserRedux.js.map +1 -0
- package/dist/esm/index.d.ts +7 -5
- package/dist/esm/index.js +13 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/store/api/baseApi.js +12 -4
- package/dist/esm/store/api/baseApi.js.map +1 -1
- package/dist/esm/store/index.d.ts +2 -0
- package/dist/esm/store/middleware.js +6 -8
- package/dist/esm/store/middleware.js.map +1 -1
- package/dist/esm/store/rootReducer.d.ts +2 -0
- package/dist/esm/store/rootReducer.js +2 -0
- package/dist/esm/store/rootReducer.js.map +1 -1
- package/dist/esm/store/slices/authSlice.d.ts +24 -0
- package/dist/esm/store/slices/authSlice.js +69 -0
- package/dist/esm/store/slices/authSlice.js.map +1 -0
- package/dist/esm/store/slices/authThunks.d.ts +40 -0
- package/dist/esm/store/slices/authThunks.js +351 -0
- package/dist/esm/store/slices/authThunks.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { ReplykeProvider } from "./replyke-context";
|
|
2
2
|
export { ReplykeStoreProvider } from "./replyke-store-context";
|
|
3
|
-
export { AuthProvider } from "./auth-context";
|
|
4
3
|
export { EntityListProvider } from "./entity-list-context";
|
|
5
4
|
export { EntityProvider } from "./entity-context";
|
|
6
5
|
export { ListsProvider } from "./lists-context";
|
|
7
6
|
export { AppNotificationsProvider } from "./app-notifications-context";
|
|
8
7
|
export { CommentSectionProvider } from "./comment-section-context";
|
|
8
|
+
export { AuthProvider } from "./auth-context";
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommentSectionProvider = exports.AppNotificationsProvider = exports.ListsProvider = exports.EntityProvider = exports.EntityListProvider = exports.
|
|
3
|
+
exports.AuthProvider = exports.CommentSectionProvider = exports.AppNotificationsProvider = exports.ListsProvider = exports.EntityProvider = exports.EntityListProvider = exports.ReplykeStoreProvider = exports.ReplykeProvider = void 0;
|
|
4
4
|
var replyke_context_1 = require("./replyke-context");
|
|
5
5
|
Object.defineProperty(exports, "ReplykeProvider", { enumerable: true, get: function () { return replyke_context_1.ReplykeProvider; } });
|
|
6
6
|
var replyke_store_context_1 = require("./replyke-store-context");
|
|
7
7
|
Object.defineProperty(exports, "ReplykeStoreProvider", { enumerable: true, get: function () { return replyke_store_context_1.ReplykeStoreProvider; } });
|
|
8
|
-
var auth_context_1 = require("./auth-context");
|
|
9
|
-
Object.defineProperty(exports, "AuthProvider", { enumerable: true, get: function () { return auth_context_1.AuthProvider; } });
|
|
10
8
|
var entity_list_context_1 = require("./entity-list-context");
|
|
11
9
|
Object.defineProperty(exports, "EntityListProvider", { enumerable: true, get: function () { return entity_list_context_1.EntityListProvider; } });
|
|
12
10
|
var entity_context_1 = require("./entity-context");
|
|
@@ -17,4 +15,8 @@ var app_notifications_context_1 = require("./app-notifications-context");
|
|
|
17
15
|
Object.defineProperty(exports, "AppNotificationsProvider", { enumerable: true, get: function () { return app_notifications_context_1.AppNotificationsProvider; } });
|
|
18
16
|
var comment_section_context_1 = require("./comment-section-context");
|
|
19
17
|
Object.defineProperty(exports, "CommentSectionProvider", { enumerable: true, get: function () { return comment_section_context_1.CommentSectionProvider; } });
|
|
18
|
+
// Legacy Context providers (kept for reference but not recommended for new implementations)
|
|
19
|
+
// Use Redux-powered equivalents instead
|
|
20
|
+
var auth_context_1 = require("./auth-context");
|
|
21
|
+
Object.defineProperty(exports, "AuthProvider", { enumerable: true, get: function () { return auth_context_1.AuthProvider; } });
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,iEAA+D;AAAtD,6HAAA,oBAAoB,OAAA;AAC7B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,iEAA+D;AAAtD,6HAAA,oBAAoB,OAAA;AAC7B,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAC3B,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,yEAAuE;AAA9D,qIAAA,wBAAwB,OAAA;AACjC,qEAAmE;AAA1D,iIAAA,sBAAsB,OAAA;AAE/B,4FAA4F;AAC5F,wCAAwC;AACxC,+CAA8C;AAArC,4GAAA,YAAY,OAAA"}
|
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
import { UseProjectDataProps, UseProjectDataValues } from "../hooks/projects/useProjectData";
|
|
3
3
|
export interface ReplykeContextProps extends UseProjectDataProps {
|
|
4
4
|
signedToken?: string | null | undefined;
|
|
5
|
-
enableRedux?: boolean;
|
|
6
5
|
children: React.ReactNode;
|
|
7
6
|
}
|
|
8
7
|
export interface ReplykeContextValues extends UseProjectDataValues {
|
|
@@ -7,18 +7,17 @@ exports.ReplykeProvider = exports.ReplykeContext = void 0;
|
|
|
7
7
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
var react_1 = require("react");
|
|
9
9
|
var useProjectData_1 = __importDefault(require("../hooks/projects/useProjectData"));
|
|
10
|
-
var auth_context_1 = require("./auth-context");
|
|
11
10
|
var replyke_store_context_1 = require("./replyke-store-context");
|
|
12
11
|
exports.ReplykeContext = (0, react_1.createContext)({
|
|
13
12
|
projectId: "",
|
|
14
13
|
project: null,
|
|
15
14
|
});
|
|
16
15
|
var ReplykeProvider = function (_a) {
|
|
17
|
-
var projectId = _a.projectId, signedToken = _a.signedToken,
|
|
16
|
+
var projectId = _a.projectId, signedToken = _a.signedToken, children = _a.children;
|
|
18
17
|
var data = (0, useProjectData_1.default)({ projectId: projectId });
|
|
19
18
|
if (!projectId)
|
|
20
19
|
throw new Error("projectId in ReplykeProvider is " + typeof projectId);
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(exports.ReplykeContext.Provider, { value: data, children: (0, jsx_runtime_1.jsx)(
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(exports.ReplykeContext.Provider, { value: data, children: (0, jsx_runtime_1.jsx)(replyke_store_context_1.ReplykeStoreProvider, { projectId: projectId, signedToken: signedToken, children: children }) }));
|
|
22
21
|
};
|
|
23
22
|
exports.ReplykeProvider = ReplykeProvider;
|
|
24
23
|
//# sourceMappingURL=replyke-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replyke-context.js","sourceRoot":"","sources":["../../../src/context/replyke-context.tsx"],"names":[],"mappings":";;;;;;;AAAA,+BAA6C;AAC7C,oFAG0C;AAC1C
|
|
1
|
+
{"version":3,"file":"replyke-context.js","sourceRoot":"","sources":["../../../src/context/replyke-context.tsx"],"names":[],"mappings":";;;;;;;AAAA,+BAA6C;AAC7C,oFAG0C;AAC1C,iEAA+D;AASlD,QAAA,cAAc,GAAG,IAAA,qBAAa,EAAuB;IAChE,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAEI,IAAM,eAAe,GAAkC,UAAC,EAIzC;QAHpB,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,QAAQ,cAAA;IAER,IAAM,IAAI,GAAG,IAAA,wBAAc,EAAC,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC;IAE3C,IAAI,CAAC,SAAS;QACZ,MAAM,IAAI,KAAK,CAAC,kCAAkC,GAAG,OAAO,SAAS,CAAC,CAAC;IAEzE,OAAO,CACL,uBAAC,sBAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YAClC,uBAAC,4CAAoB,IAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,YACjE,QAAQ,GACY,GACC,CAC3B,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,eAAe,mBAiB1B"}
|
|
@@ -2,11 +2,12 @@ import React from "react";
|
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
export interface ReplykeStoreProviderProps {
|
|
4
4
|
children: ReactNode;
|
|
5
|
+
projectId: string;
|
|
6
|
+
signedToken?: string | null;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* Redux store provider for Replyke
|
|
8
|
-
* This component provides the Redux store
|
|
9
|
-
* Can be used standalone or wrapped around the existing ReplykeProvider
|
|
10
|
+
* This component provides the Redux store and initializes auth state
|
|
10
11
|
*/
|
|
11
12
|
export declare const ReplykeStoreProvider: React.FC<ReplykeStoreProviderProps>;
|
|
12
13
|
export default ReplykeStoreProvider;
|
|
@@ -2,19 +2,36 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReplykeStoreProvider = void 0;
|
|
4
4
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
var react_1 = require("react");
|
|
5
6
|
var react_redux_1 = require("react-redux");
|
|
6
7
|
var store_1 = require("../store");
|
|
8
|
+
var authThunks_1 = require("../store/slices/authThunks");
|
|
9
|
+
/**
|
|
10
|
+
* Component that initializes auth state in Redux
|
|
11
|
+
* Must be inside the Redux Provider to dispatch actions
|
|
12
|
+
*/
|
|
13
|
+
var AuthInitializer = function (_a) {
|
|
14
|
+
var children = _a.children, projectId = _a.projectId, signedToken = _a.signedToken;
|
|
15
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
|
16
|
+
(0, react_1.useEffect)(function () {
|
|
17
|
+
// Initialize auth with project and signed token
|
|
18
|
+
dispatch((0, authThunks_1.initializeAuthThunk)({
|
|
19
|
+
projectId: projectId,
|
|
20
|
+
signedToken: signedToken
|
|
21
|
+
}));
|
|
22
|
+
}, [dispatch, projectId, signedToken]);
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
24
|
+
};
|
|
7
25
|
/**
|
|
8
26
|
* Redux store provider for Replyke
|
|
9
|
-
* This component provides the Redux store
|
|
10
|
-
* Can be used standalone or wrapped around the existing ReplykeProvider
|
|
27
|
+
* This component provides the Redux store and initializes auth state
|
|
11
28
|
*/
|
|
12
29
|
var ReplykeStoreProvider = function (_a) {
|
|
13
|
-
var children = _a.children;
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(react_redux_1.Provider, { store: store_1.replykeStore, children: children }));
|
|
30
|
+
var children = _a.children, projectId = _a.projectId, signedToken = _a.signedToken;
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(react_redux_1.Provider, { store: store_1.replykeStore, children: (0, jsx_runtime_1.jsx)(AuthInitializer, { projectId: projectId, signedToken: signedToken, children: children }) }));
|
|
15
32
|
};
|
|
16
33
|
exports.ReplykeStoreProvider = ReplykeStoreProvider;
|
|
17
|
-
//
|
|
18
|
-
//
|
|
34
|
+
// Clean Redux-only architecture
|
|
35
|
+
// Always integrated with ReplykeProvider
|
|
19
36
|
exports.default = exports.ReplykeStoreProvider;
|
|
20
37
|
//# sourceMappingURL=replyke-store-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replyke-store-context.js","sourceRoot":"","sources":["../../../src/context/replyke-store-context.tsx"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"replyke-store-context.js","sourceRoot":"","sources":["../../../src/context/replyke-store-context.tsx"],"names":[],"mappings":";;;;AAAA,+BAAyC;AACzC,2CAAoD;AACpD,kCAAwC;AAGxC,yDAAiE;AAQjE;;;GAGG;AACH,IAAM,eAAe,GAIhB,UAAC,EAAoC;QAAlC,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,WAAW,iBAAA;IACtC,IAAM,QAAQ,GAAG,IAAA,yBAAW,GAAe,CAAC;IAE5C,IAAA,iBAAS,EAAC;QACR,gDAAgD;QAChD,QAAQ,CAAC,IAAA,gCAAmB,EAAC;YAC3B,SAAS,WAAA;YACT,WAAW,aAAA;SACZ,CAAC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;IAEvC,OAAO,2DAAG,QAAQ,GAAI,CAAC;AACzB,CAAC,CAAC;AAEF;;;GAGG;AACI,IAAM,oBAAoB,GAAwC,UAAC,EAIzE;QAHC,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,WAAW,iBAAA;IAEX,OAAO,CACL,uBAAC,sBAAQ,IAAC,KAAK,EAAE,oBAAY,YAC3B,uBAAC,eAAe,IAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,YAC5D,QAAQ,GACO,GACT,CACZ,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B;AAEF,gCAAgC;AAChC,yCAAyC;AAEzC,kBAAe,4BAAoB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useUserRedux = exports.useAuthRedux = void 0;
|
|
7
|
+
var useAuthRedux_1 = require("./useAuthRedux");
|
|
8
|
+
Object.defineProperty(exports, "useAuthRedux", { enumerable: true, get: function () { return __importDefault(useAuthRedux_1).default; } });
|
|
9
|
+
var useUserRedux_1 = require("./useUserRedux");
|
|
10
|
+
Object.defineProperty(exports, "useUserRedux", { enumerable: true, get: function () { return __importDefault(useUserRedux_1).default; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/auth-redux/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAkF;AAAzE,6HAAA,OAAO,OAAgB;AAChC,+CAAkF;AAAzE,6HAAA,OAAO,OAAgB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface UseAuthReduxValues {
|
|
2
|
+
loadingInitial: boolean;
|
|
3
|
+
accessToken: string | null;
|
|
4
|
+
refreshToken: string | null;
|
|
5
|
+
setRefreshToken: React.Dispatch<React.SetStateAction<string | null>>;
|
|
6
|
+
signUpWithEmailAndPassword: (props: {
|
|
7
|
+
email: string;
|
|
8
|
+
password: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
username?: string;
|
|
11
|
+
avatar?: string;
|
|
12
|
+
bio?: string;
|
|
13
|
+
location?: {
|
|
14
|
+
latitude: number;
|
|
15
|
+
longitude: number;
|
|
16
|
+
};
|
|
17
|
+
birthdate?: Date;
|
|
18
|
+
metadata?: Record<string, any>;
|
|
19
|
+
secureMetadata?: Record<string, any>;
|
|
20
|
+
}) => Promise<void>;
|
|
21
|
+
signInWithEmailAndPassword: (props: {
|
|
22
|
+
email: string;
|
|
23
|
+
password: string;
|
|
24
|
+
}) => Promise<void>;
|
|
25
|
+
signOut: () => Promise<void>;
|
|
26
|
+
changePassword: (props: {
|
|
27
|
+
password: string;
|
|
28
|
+
newPassword: string;
|
|
29
|
+
}) => Promise<void>;
|
|
30
|
+
requestNewAccessToken: () => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export default function useAuthRedux(): UseAuthReduxValues;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.default = useAuthRedux;
|
|
54
|
+
var react_redux_1 = require("react-redux");
|
|
55
|
+
var react_1 = require("react");
|
|
56
|
+
var authSlice_1 = require("../../store/slices/authSlice");
|
|
57
|
+
var authThunks_1 = require("../../store/slices/authThunks");
|
|
58
|
+
var useProject_1 = __importDefault(require("../projects/useProject"));
|
|
59
|
+
function useAuthRedux() {
|
|
60
|
+
var _this = this;
|
|
61
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
|
62
|
+
var projectId = (0, useProject_1.default)().projectId;
|
|
63
|
+
// Selectors
|
|
64
|
+
var loadingInitial = (0, react_redux_1.useSelector)(function (state) { return (0, authSlice_1.selectLoadingInitial)(state); });
|
|
65
|
+
var accessToken = (0, react_redux_1.useSelector)(function (state) { return (0, authSlice_1.selectAccessToken)(state); });
|
|
66
|
+
var refreshToken = (0, react_redux_1.useSelector)(function (state) { return (0, authSlice_1.selectRefreshToken)(state); });
|
|
67
|
+
// Actions
|
|
68
|
+
var handleSignUpWithEmailAndPassword = (0, react_1.useCallback)(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
69
|
+
var result;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
if (!projectId) {
|
|
74
|
+
throw new Error("No projectId available.");
|
|
75
|
+
}
|
|
76
|
+
return [4 /*yield*/, dispatch((0, authThunks_1.signUpWithEmailAndPasswordThunk)(__assign({ projectId: projectId }, props)))];
|
|
77
|
+
case 1:
|
|
78
|
+
result = _a.sent();
|
|
79
|
+
if (authThunks_1.signUpWithEmailAndPasswordThunk.rejected.match(result)) {
|
|
80
|
+
throw new Error(result.payload);
|
|
81
|
+
}
|
|
82
|
+
return [2 /*return*/];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}); }, [dispatch, projectId]);
|
|
86
|
+
var handleSignInWithEmailAndPassword = (0, react_1.useCallback)(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
87
|
+
var result;
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
switch (_a.label) {
|
|
90
|
+
case 0:
|
|
91
|
+
if (!projectId) {
|
|
92
|
+
throw new Error("No projectId available.");
|
|
93
|
+
}
|
|
94
|
+
return [4 /*yield*/, dispatch((0, authThunks_1.signInWithEmailAndPasswordThunk)(__assign({ projectId: projectId }, props)))];
|
|
95
|
+
case 1:
|
|
96
|
+
result = _a.sent();
|
|
97
|
+
if (authThunks_1.signInWithEmailAndPasswordThunk.rejected.match(result)) {
|
|
98
|
+
throw new Error(result.payload);
|
|
99
|
+
}
|
|
100
|
+
return [2 /*return*/];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}); }, [dispatch, projectId]);
|
|
104
|
+
var handleSignOut = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
105
|
+
var result;
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
switch (_a.label) {
|
|
108
|
+
case 0:
|
|
109
|
+
if (!projectId) {
|
|
110
|
+
throw new Error("No projectId available.");
|
|
111
|
+
}
|
|
112
|
+
return [4 /*yield*/, dispatch((0, authThunks_1.signOutThunk)({ projectId: projectId }))];
|
|
113
|
+
case 1:
|
|
114
|
+
result = _a.sent();
|
|
115
|
+
if (authThunks_1.signOutThunk.rejected.match(result)) {
|
|
116
|
+
throw new Error(result.payload);
|
|
117
|
+
}
|
|
118
|
+
return [2 /*return*/];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}); }, [dispatch, projectId]);
|
|
122
|
+
var handleChangePassword = (0, react_1.useCallback)(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
123
|
+
var result;
|
|
124
|
+
return __generator(this, function (_a) {
|
|
125
|
+
switch (_a.label) {
|
|
126
|
+
case 0:
|
|
127
|
+
if (!projectId) {
|
|
128
|
+
throw new Error("No projectId available.");
|
|
129
|
+
}
|
|
130
|
+
return [4 /*yield*/, dispatch((0, authThunks_1.changePasswordThunk)(__assign({ projectId: projectId }, props)))];
|
|
131
|
+
case 1:
|
|
132
|
+
result = _a.sent();
|
|
133
|
+
if (authThunks_1.changePasswordThunk.rejected.match(result)) {
|
|
134
|
+
throw new Error(result.payload);
|
|
135
|
+
}
|
|
136
|
+
return [2 /*return*/];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}); }, [dispatch, projectId]);
|
|
140
|
+
var handleRequestNewAccessToken = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
141
|
+
var result;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0:
|
|
145
|
+
if (!projectId)
|
|
146
|
+
return [2 /*return*/];
|
|
147
|
+
return [4 /*yield*/, dispatch((0, authThunks_1.requestNewAccessTokenThunk)({ projectId: projectId }))];
|
|
148
|
+
case 1:
|
|
149
|
+
result = _a.sent();
|
|
150
|
+
if (authThunks_1.requestNewAccessTokenThunk.fulfilled.match(result)) {
|
|
151
|
+
return [2 /*return*/, result.payload];
|
|
152
|
+
}
|
|
153
|
+
return [2 /*return*/];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}); }, [dispatch, projectId]);
|
|
157
|
+
var handleSetRefreshToken = (0, react_1.useCallback)(function (token) {
|
|
158
|
+
// Handle both direct value and function setter patterns
|
|
159
|
+
if (typeof token === 'function') {
|
|
160
|
+
var currentToken = refreshToken;
|
|
161
|
+
var newToken = token(currentToken);
|
|
162
|
+
dispatch((0, authSlice_1.setRefreshToken)(newToken));
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
dispatch((0, authSlice_1.setRefreshToken)(token));
|
|
166
|
+
}
|
|
167
|
+
}, [dispatch, refreshToken]);
|
|
168
|
+
return {
|
|
169
|
+
loadingInitial: loadingInitial,
|
|
170
|
+
accessToken: accessToken,
|
|
171
|
+
refreshToken: refreshToken,
|
|
172
|
+
setRefreshToken: handleSetRefreshToken,
|
|
173
|
+
signUpWithEmailAndPassword: handleSignUpWithEmailAndPassword,
|
|
174
|
+
signInWithEmailAndPassword: handleSignInWithEmailAndPassword,
|
|
175
|
+
signOut: handleSignOut,
|
|
176
|
+
changePassword: handleChangePassword,
|
|
177
|
+
requestNewAccessToken: handleRequestNewAccessToken,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=useAuthRedux.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAuthRedux.js","sourceRoot":"","sources":["../../../../src/hooks/auth-redux/useAuthRedux.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,+BA0HC;AA9KD,2CAAuD;AACvD,+BAAoC;AAGpC,0DAKsC;AACtC,4DAMuC;AACvC,sEAAgD;AAmChD,SAAwB,YAAY;IAApC,iBA0HC;IAzHC,IAAM,QAAQ,GAAG,IAAA,yBAAW,GAAe,CAAC;IACpC,IAAA,SAAS,GAAK,IAAA,oBAAU,GAAE,UAAjB,CAAkB;IAEnC,YAAY;IACZ,IAAM,cAAc,GAAG,IAAA,yBAAW,EAAC,UAAC,KAAgB,IAAK,OAAA,IAAA,gCAAoB,EAAC,KAAK,CAAC,EAA3B,CAA2B,CAAC,CAAC;IACtF,IAAM,WAAW,GAAG,IAAA,yBAAW,EAAC,UAAC,KAAgB,IAAK,OAAA,IAAA,6BAAiB,EAAC,KAAK,CAAC,EAAxB,CAAwB,CAAC,CAAC;IAChF,IAAM,YAAY,GAAG,IAAA,yBAAW,EAAC,UAAC,KAAgB,IAAK,OAAA,IAAA,8BAAkB,EAAC,KAAK,CAAC,EAAzB,CAAyB,CAAC,CAAC;IAElF,UAAU;IACV,IAAM,gCAAgC,GAAG,IAAA,mBAAW,EAClD,UAAO,KAcN;;;;;oBACC,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAEc,qBAAM,QAAQ,CAAC,IAAA,4CAA+B,aAC3D,SAAS,WAAA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e,EAAC,KAAK,CAAC,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAE7B,OAAO;QACL,cAAc,gBAAA;QACd,WAAW,aAAA;QACX,YAAY,cAAA;QACZ,eAAe,EAAE,qBAAqB;QACtC,0BAA0B,EAAE,gCAAgC;QAC5D,0BAA0B,EAAE,gCAAgC;QAC5D,OAAO,EAAE,aAAa;QACtB,cAAc,EAAE,oBAAoB;QACpC,qBAAqB,EAAE,2BAA2B;KACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = useUserRedux;
|
|
4
|
+
var react_redux_1 = require("react-redux");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var authSlice_1 = require("../../store/slices/authSlice");
|
|
7
|
+
function useUserRedux() {
|
|
8
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
|
9
|
+
// Selectors
|
|
10
|
+
var user = (0, react_redux_1.useSelector)(function (state) { return (0, authSlice_1.selectUser)(state); });
|
|
11
|
+
// Actions
|
|
12
|
+
var handleSetUser = (0, react_1.useCallback)(function (newUser) {
|
|
13
|
+
dispatch((0, authSlice_1.setUser)(newUser));
|
|
14
|
+
}, [dispatch]);
|
|
15
|
+
return {
|
|
16
|
+
user: user,
|
|
17
|
+
setUser: handleSetUser,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=useUserRedux.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUserRedux.js","sourceRoot":"","sources":["../../../../src/hooks/auth-redux/useUserRedux.ts"],"names":[],"mappings":";;AAeA,+BAeC;AA9BD,2CAAuD;AACvD,+BAAoC;AAGpC,0DAGsC;AAQtC,SAAwB,YAAY;IAClC,IAAM,QAAQ,GAAG,IAAA,yBAAW,GAAe,CAAC;IAE5C,YAAY;IACZ,IAAM,IAAI,GAAG,IAAA,yBAAW,EAAC,UAAC,KAAgB,IAAK,OAAA,IAAA,sBAAU,EAAC,KAAK,CAAC,EAAjB,CAAiB,CAAC,CAAC;IAElE,UAAU;IACV,IAAM,aAAa,GAAG,IAAA,mBAAW,EAAC,UAAC,OAAiB;QAClD,QAAQ,CAAC,IAAA,mBAAO,EAAC,OAAO,CAAC,CAAC,CAAC;IAC7B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,EAAE,aAAa;KACvB,CAAC;AACJ,CAAC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -4,18 +4,20 @@ export { getUserName } from "./helpers/getUserName";
|
|
|
4
4
|
export { default as getPublicFileUrl } from "./helpers/getPublicFileUrl";
|
|
5
5
|
export { reportReasons } from "./constants/reportReasons";
|
|
6
6
|
export type { ReportReasonKey } from "./constants/reportReasons";
|
|
7
|
-
export { ReplykeProvider, //
|
|
8
|
-
EntityListProvider, EntityProvider, ListsProvider, AppNotificationsProvider, CommentSectionProvider, } from "./context";
|
|
9
|
-
export {
|
|
7
|
+
export { ReplykeProvider, // Always includes Redux auth and notification management
|
|
8
|
+
EntityListProvider, EntityProvider, ListsProvider, AppNotificationsProvider, CommentSectionProvider, ReplykeStoreProvider, } from "./context";
|
|
9
|
+
export { AuthProvider, } from "./context";
|
|
10
10
|
export { useProject, useProjectData } from "./hooks/projects";
|
|
11
11
|
export { useSignTestingJwt } from "./hooks/crypto";
|
|
12
|
-
export { useAuth,
|
|
12
|
+
export { useAuthRedux as useAuth, useUserRedux as useUser, type UseAuthReduxValues as UseAuthValues, type UseUserReduxValues as UseUserValues, } from "./hooks/auth-redux";
|
|
13
|
+
export { useAuth as useAuthContext, useAuthData, useRequestNewAccessToken, useSignUpWithEmailAndPassword, useSignInWithEmailAndPassword, useSignOut, useChangePassword, useVerifyExternalUser, } from "./hooks/auth";
|
|
13
14
|
export { useAppNotifications, useAppNotificationsData, useCountUnreadNotifications, useFetchAppNotifications, useMarkNotificationAsRead, } from "./hooks/app-notifications";
|
|
14
15
|
export { useAppNotificationsRedux, useAppNotificationsDataRedux, type UseAppNotificationsDataProps, type UseAppNotificationsDataValues, } from "./hooks/app-notifications-redux";
|
|
15
16
|
export { useEntity, useEntityData, useCreateEntity, useFetchEntity, useFetchEntityByForeignId, useFetchEntityByShortId, useUpdateEntity, useEntityVotes, useDeleteEntity, useEntityList, useEntityListData, useInfusedData, } from "./hooks/entities";
|
|
16
17
|
export { useCommentSection, useCommentSectionData, useCreateComment, useFetchManyComments, useFetchComment, useFetchCommentByForeignId, useReplies, useUpdateComment, useCommentVotes, useDeleteComment, useEntityComments, useProfileComments, } from "./hooks/comments";
|
|
17
18
|
export { useLists, useListsData, useCreateList, useFetchRootList, useFetchSubLists, useIsEntitySaved, useUpdateList, useAddToList, useRemoveFromList, useDeleteList, } from "./hooks/lists";
|
|
18
|
-
export {
|
|
19
|
+
export { useUserData, useFetchUser, useFetchUserByForeignId, useFetchUserFollowersCount, useFetchUserFollowingCount, useCheckUsernameAvailability, useFetchUserSuggestions, useMentions, useUpdateUser, useFetchFollow, useFollowUser, useUnfollowUser, } from "./hooks/users";
|
|
20
|
+
export { useUser as useUserContext, } from "./hooks/users";
|
|
19
21
|
export { useCreateReport } from "./hooks/reports";
|
|
20
22
|
export { useGetMetadata } from "./hooks/utils";
|
|
21
23
|
export { useUploadFile } from "./hooks/storage";
|
package/dist/cjs/index.js
CHANGED
|
@@ -36,8 +36,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
exports.AppNotification = exports.useUploadFile = exports.useGetMetadata = exports.useCreateReport = exports.useUnfollowUser = exports.useFollowUser = exports.useFetchFollow = exports.useUpdateUser = exports.useMentions = exports.useFetchUserSuggestions = exports.useCheckUsernameAvailability = exports.useFetchUserFollowingCount = exports.useFetchUserFollowersCount = exports.useFetchUserByForeignId = exports.useFetchUser = exports.useUserData = exports.
|
|
39
|
+
exports.useFetchComment = exports.useFetchManyComments = exports.useCreateComment = exports.useCommentSectionData = exports.useCommentSection = exports.useInfusedData = exports.useEntityListData = exports.useEntityList = exports.useDeleteEntity = exports.useEntityVotes = exports.useUpdateEntity = exports.useFetchEntityByShortId = exports.useFetchEntityByForeignId = exports.useFetchEntity = exports.useCreateEntity = exports.useEntityData = exports.useEntity = exports.useAppNotificationsDataRedux = exports.useAppNotificationsRedux = exports.useMarkNotificationAsRead = exports.useFetchAppNotifications = exports.useCountUnreadNotifications = exports.useAppNotificationsData = exports.useAppNotifications = exports.useVerifyExternalUser = exports.useChangePassword = exports.useSignOut = exports.useSignInWithEmailAndPassword = exports.useSignUpWithEmailAndPassword = exports.useRequestNewAccessToken = exports.useAuthData = exports.useAuthContext = exports.useUser = exports.useAuth = exports.useSignTestingJwt = exports.useProjectData = exports.useProject = exports.AuthProvider = exports.ReplykeStoreProvider = exports.CommentSectionProvider = exports.AppNotificationsProvider = exports.ListsProvider = exports.EntityProvider = exports.EntityListProvider = exports.ReplykeProvider = exports.reportReasons = exports.getPublicFileUrl = exports.getUserName = exports.safeMergeStyleProps = exports.handleError = void 0;
|
|
40
|
+
exports.AppNotification = exports.useUploadFile = exports.useGetMetadata = exports.useCreateReport = exports.useUserContext = exports.useUnfollowUser = exports.useFollowUser = exports.useFetchFollow = exports.useUpdateUser = exports.useMentions = exports.useFetchUserSuggestions = exports.useCheckUsernameAvailability = exports.useFetchUserFollowingCount = exports.useFetchUserFollowersCount = exports.useFetchUserByForeignId = exports.useFetchUser = exports.useUserData = exports.useDeleteList = exports.useRemoveFromList = exports.useAddToList = exports.useUpdateList = exports.useIsEntitySaved = exports.useFetchSubLists = exports.useFetchRootList = exports.useCreateList = exports.useListsData = exports.useLists = exports.useProfileComments = exports.useEntityComments = exports.useDeleteComment = exports.useCommentVotes = exports.useUpdateComment = exports.useReplies = exports.useFetchCommentByForeignId = void 0;
|
|
41
41
|
// Helpers & Utilities
|
|
42
42
|
var handleError_1 = require("./utils/handleError");
|
|
43
43
|
Object.defineProperty(exports, "handleError", { enumerable: true, get: function () { return handleError_1.handleError; } });
|
|
@@ -50,7 +50,7 @@ Object.defineProperty(exports, "getPublicFileUrl", { enumerable: true, get: func
|
|
|
50
50
|
// Constants
|
|
51
51
|
var reportReasons_1 = require("./constants/reportReasons");
|
|
52
52
|
Object.defineProperty(exports, "reportReasons", { enumerable: true, get: function () { return reportReasons_1.reportReasons; } });
|
|
53
|
-
// Context providers
|
|
53
|
+
// Context providers (now Redux-powered by default)
|
|
54
54
|
var context_1 = require("./context");
|
|
55
55
|
Object.defineProperty(exports, "ReplykeProvider", { enumerable: true, get: function () { return context_1.ReplykeProvider; } });
|
|
56
56
|
Object.defineProperty(exports, "EntityListProvider", { enumerable: true, get: function () { return context_1.EntityListProvider; } });
|
|
@@ -58,9 +58,10 @@ Object.defineProperty(exports, "EntityProvider", { enumerable: true, get: functi
|
|
|
58
58
|
Object.defineProperty(exports, "ListsProvider", { enumerable: true, get: function () { return context_1.ListsProvider; } });
|
|
59
59
|
Object.defineProperty(exports, "AppNotificationsProvider", { enumerable: true, get: function () { return context_1.AppNotificationsProvider; } });
|
|
60
60
|
Object.defineProperty(exports, "CommentSectionProvider", { enumerable: true, get: function () { return context_1.CommentSectionProvider; } });
|
|
61
|
-
|
|
61
|
+
Object.defineProperty(exports, "ReplykeStoreProvider", { enumerable: true, get: function () { return context_1.ReplykeStoreProvider; } });
|
|
62
|
+
// Legacy Context providers (for reference)
|
|
62
63
|
var context_2 = require("./context");
|
|
63
|
-
Object.defineProperty(exports, "
|
|
64
|
+
Object.defineProperty(exports, "AuthProvider", { enumerable: true, get: function () { return context_2.AuthProvider; } });
|
|
64
65
|
// -- projects
|
|
65
66
|
var projects_1 = require("./hooks/projects");
|
|
66
67
|
Object.defineProperty(exports, "useProject", { enumerable: true, get: function () { return projects_1.useProject; } });
|
|
@@ -68,9 +69,13 @@ Object.defineProperty(exports, "useProjectData", { enumerable: true, get: functi
|
|
|
68
69
|
// -- crypto
|
|
69
70
|
var crypto_1 = require("./hooks/crypto");
|
|
70
71
|
Object.defineProperty(exports, "useSignTestingJwt", { enumerable: true, get: function () { return crypto_1.useSignTestingJwt; } });
|
|
71
|
-
// -- authentication
|
|
72
|
+
// -- authentication (now Redux-powered)
|
|
73
|
+
var auth_redux_1 = require("./hooks/auth-redux");
|
|
74
|
+
Object.defineProperty(exports, "useAuth", { enumerable: true, get: function () { return auth_redux_1.useAuthRedux; } });
|
|
75
|
+
Object.defineProperty(exports, "useUser", { enumerable: true, get: function () { return auth_redux_1.useUserRedux; } });
|
|
76
|
+
// Legacy auth exports (for reference - keep existing Context implementation available)
|
|
72
77
|
var auth_1 = require("./hooks/auth");
|
|
73
|
-
Object.defineProperty(exports, "
|
|
78
|
+
Object.defineProperty(exports, "useAuthContext", { enumerable: true, get: function () { return auth_1.useAuth; } });
|
|
74
79
|
Object.defineProperty(exports, "useAuthData", { enumerable: true, get: function () { return auth_1.useAuthData; } });
|
|
75
80
|
Object.defineProperty(exports, "useRequestNewAccessToken", { enumerable: true, get: function () { return auth_1.useRequestNewAccessToken; } });
|
|
76
81
|
Object.defineProperty(exports, "useSignUpWithEmailAndPassword", { enumerable: true, get: function () { return auth_1.useSignUpWithEmailAndPassword; } });
|
|
@@ -131,7 +136,6 @@ Object.defineProperty(exports, "useRemoveFromList", { enumerable: true, get: fun
|
|
|
131
136
|
Object.defineProperty(exports, "useDeleteList", { enumerable: true, get: function () { return lists_1.useDeleteList; } });
|
|
132
137
|
// -- users
|
|
133
138
|
var users_1 = require("./hooks/users");
|
|
134
|
-
Object.defineProperty(exports, "useUser", { enumerable: true, get: function () { return users_1.useUser; } });
|
|
135
139
|
Object.defineProperty(exports, "useUserData", { enumerable: true, get: function () { return users_1.useUserData; } });
|
|
136
140
|
Object.defineProperty(exports, "useFetchUser", { enumerable: true, get: function () { return users_1.useFetchUser; } });
|
|
137
141
|
Object.defineProperty(exports, "useFetchUserByForeignId", { enumerable: true, get: function () { return users_1.useFetchUserByForeignId; } });
|
|
@@ -144,6 +148,9 @@ Object.defineProperty(exports, "useUpdateUser", { enumerable: true, get: functio
|
|
|
144
148
|
Object.defineProperty(exports, "useFetchFollow", { enumerable: true, get: function () { return users_1.useFetchFollow; } });
|
|
145
149
|
Object.defineProperty(exports, "useFollowUser", { enumerable: true, get: function () { return users_1.useFollowUser; } });
|
|
146
150
|
Object.defineProperty(exports, "useUnfollowUser", { enumerable: true, get: function () { return users_1.useUnfollowUser; } });
|
|
151
|
+
// Legacy user exports (for reference - keep existing Context implementation available)
|
|
152
|
+
var users_2 = require("./hooks/users");
|
|
153
|
+
Object.defineProperty(exports, "useUserContext", { enumerable: true, get: function () { return users_2.useUser; } });
|
|
147
154
|
// -- reports
|
|
148
155
|
var reports_1 = require("./hooks/reports");
|
|
149
156
|
Object.defineProperty(exports, "useCreateReport", { enumerable: true, get: function () { return reports_1.useCreateReport; } });
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sBAAsB;AACtB,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,qEAAoE;AAA3D,0HAAA,mBAAmB,OAAA;AAC5B,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,+DAAyE;AAAhE,qIAAA,OAAO,OAAoB;AAEpC,YAAY;AACZ,2DAA0D;AAAjD,8GAAA,aAAa,OAAA;AAGtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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,cAAc,OAAA;AACd,sGAAA,aAAa,OAAA;AACb,wGAAA,eAAe,OAAA;AAGjB,uFAAuF;AACvF,uCAEuB;AADrB,uGAAA,OAAO,OAAkB;AAG3B,aAAa;AACb,2CAAkD;AAAzC,0GAAA,eAAe,OAAA;AAExB,aAAa;AACb,uCAA+C;AAAtC,uGAAA,cAAc,OAAA;AAEvB,aAAa;AACb,2CAAgD;AAAvC,wGAAA,aAAa,OAAA;AAKtB,uFAAuE"}
|
|
@@ -6,11 +6,19 @@ var react_1 = require("@reduxjs/toolkit/query/react");
|
|
|
6
6
|
// Base query that uses the current project context and auth
|
|
7
7
|
var createBaseQuery = function () {
|
|
8
8
|
return (0, react_1.fetchBaseQuery)({
|
|
9
|
-
baseUrl: process.env.REACT_APP_API_BASE_URL || 'https://api.replyke.com',
|
|
9
|
+
baseUrl: process.env.REACT_APP_API_BASE_URL || 'https://api.replyke.com/api/v5',
|
|
10
10
|
credentials: 'include', // Equivalent to withCredentials: true
|
|
11
|
-
prepareHeaders: function (headers) {
|
|
12
|
-
|
|
13
|
-
//
|
|
11
|
+
prepareHeaders: function (headers, _a) {
|
|
12
|
+
var getState = _a.getState;
|
|
13
|
+
// Add Content-Type header
|
|
14
|
+
headers.set('Content-Type', 'application/json');
|
|
15
|
+
// Get access token from Redux state
|
|
16
|
+
var state = getState();
|
|
17
|
+
var accessToken = state.auth.accessToken;
|
|
18
|
+
// Add Authorization header if we have a token
|
|
19
|
+
if (accessToken) {
|
|
20
|
+
headers.set('Authorization', "Bearer ".concat(accessToken));
|
|
21
|
+
}
|
|
14
22
|
return headers;
|
|
15
23
|
},
|
|
16
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseApi.js","sourceRoot":"","sources":["../../../../src/store/api/baseApi.ts"],"names":[],"mappings":";;;;AAAA,sDAAyE;
|
|
1
|
+
{"version":3,"file":"baseApi.js","sourceRoot":"","sources":["../../../../src/store/api/baseApi.ts"],"names":[],"mappings":";;;;AAAA,sDAAyE;AAGzE,4DAA4D;AAC5D,IAAM,eAAe,GAAG;IACtB,OAAO,IAAA,sBAAc,EAAC;QACpB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,gCAAgC;QAC/E,WAAW,EAAE,SAAS,EAAE,sCAAsC;QAC9D,cAAc,EAAE,UAAC,OAAO,EAAE,EAAY;gBAAV,QAAQ,cAAA;YAClC,0BAA0B;YAC1B,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;YAEhD,oCAAoC;YACpC,IAAM,KAAK,GAAG,QAAQ,EAAe,CAAC;YACtC,IAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC;YAE3C,8CAA8C;YAC9C,IAAI,WAAW,EAAE,CAAC;gBAChB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,iBAAU,WAAW,CAAE,CAAC,CAAC;YACxD,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4BAA4B;AACf,QAAA,OAAO,GAAG,IAAA,iBAAS,EAAC;IAC/B,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,eAAe,EAAE;IAC5B,QAAQ,EAAE;QACR,iBAAiB;QACjB,oBAAoB;QACpB,YAAY;QACZ,cAAc;QACd,UAAU;QACV,UAAU;KACX;IACD,SAAS,EAAE,cAAM,OAAA,CAAC,EAAE,CAAC,EAAJ,CAAI,EAAE,6CAA6C;CACrE,CAAC,CAAC;AAEH,+EAA+E;AAC/E,aAAa,KAAK,eAAO,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
2
2
|
api: import("@reduxjs/toolkit/query").CombinedState<{}, "AppNotification", "api">;
|
|
3
|
+
auth: import("./slices/authSlice").AuthState;
|
|
3
4
|
appNotifications: import("./slices").AppNotificationsState;
|
|
4
5
|
}, import("@reduxjs/toolkit").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("@reduxjs/toolkit").StoreEnhancer<{
|
|
5
6
|
dispatch: import("@reduxjs/toolkit").ThunkDispatch<{
|
|
6
7
|
api: import("@reduxjs/toolkit/query").CombinedState<{}, "AppNotification", "api">;
|
|
8
|
+
auth: import("./slices/authSlice").AuthState;
|
|
7
9
|
appNotifications: import("./slices").AppNotificationsState;
|
|
8
10
|
}, undefined, import("@reduxjs/toolkit").UnknownAction>;
|
|
9
11
|
}>, import("@reduxjs/toolkit").StoreEnhancer]>>;
|
|
@@ -22,16 +22,14 @@ var errorMiddleware = function (store) { return function (next) { return functio
|
|
|
22
22
|
}
|
|
23
23
|
}; }; };
|
|
24
24
|
exports.errorMiddleware = errorMiddleware;
|
|
25
|
-
//
|
|
25
|
+
// Selective logger middleware for development - only logs important actions
|
|
26
26
|
var loggerMiddleware = function (store) { return function (next) { return function (action) {
|
|
27
|
-
if (process.env.NODE_ENV === 'development') {
|
|
28
|
-
console.group("\uD83D\uDD04 Redux Action: ".concat(action.type));
|
|
29
|
-
console.log('Previous State:', store.getState());
|
|
30
|
-
console.log('Action:', action);
|
|
31
|
-
}
|
|
32
27
|
var result = next(action);
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
// Only log failed API calls and errors in development
|
|
29
|
+
if (process.env.NODE_ENV === 'development' && action.type.includes('/rejected')) {
|
|
30
|
+
console.group("\u274C Redux Action Failed: ".concat(action.type));
|
|
31
|
+
console.log('Error:', action.payload);
|
|
32
|
+
console.log('Action:', action);
|
|
35
33
|
console.groupEnd();
|
|
36
34
|
}
|
|
37
35
|
return result;
|