@replyke/core 5.1.5-beta.3 → 5.1.5-beta.5
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 +0 -1
- package/dist/cjs/context/index.js +1 -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 +15 -20
- 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 +5 -4
- package/dist/cjs/index.js +11 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/store/slices/authSlice.d.ts +12 -1
- package/dist/cjs/store/slices/authSlice.js +48 -2
- package/dist/cjs/store/slices/authSlice.js.map +1 -1
- 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 +0 -1
- package/dist/esm/context/index.js +0 -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 +16 -18
- 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 +5 -4
- package/dist/esm/index.js +8 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/store/slices/authSlice.d.ts +12 -1
- package/dist/esm/store/slices/authSlice.js +42 -1
- package/dist/esm/store/slices/authSlice.js.map +1 -1
- 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,6 +1,5 @@
|
|
|
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";
|
|
@@ -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.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");
|
|
@@ -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"}
|
|
@@ -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;
|
|
@@ -1,42 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ReplykeStoreProvider = void 0;
|
|
7
4
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
var react_1 = require("react");
|
|
9
6
|
var react_redux_1 = require("react-redux");
|
|
10
7
|
var store_1 = require("../store");
|
|
11
|
-
var
|
|
12
|
-
var authSlice_1 = require("../store/slices/authSlice");
|
|
8
|
+
var authThunks_1 = require("../store/slices/authThunks");
|
|
13
9
|
/**
|
|
14
|
-
* Component that
|
|
10
|
+
* Component that initializes auth state in Redux
|
|
15
11
|
* Must be inside the Redux Provider to dispatch actions
|
|
16
12
|
*/
|
|
17
|
-
var
|
|
18
|
-
var children = _a.children;
|
|
19
|
-
var
|
|
13
|
+
var AuthInitializer = function (_a) {
|
|
14
|
+
var children = _a.children, projectId = _a.projectId, signedToken = _a.signedToken;
|
|
15
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
|
20
16
|
(0, react_1.useEffect)(function () {
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
// Initialize auth with project and signed token
|
|
18
|
+
dispatch((0, authThunks_1.initializeAuthThunk)({
|
|
19
|
+
projectId: projectId,
|
|
20
|
+
signedToken: signedToken
|
|
25
21
|
}));
|
|
26
|
-
}, [
|
|
22
|
+
}, [dispatch, projectId, signedToken]);
|
|
27
23
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
28
24
|
};
|
|
29
25
|
/**
|
|
30
26
|
* Redux store provider for Replyke
|
|
31
|
-
* This component provides the Redux store
|
|
32
|
-
* Can be used standalone or wrapped around the existing ReplykeProvider
|
|
27
|
+
* This component provides the Redux store and initializes auth state
|
|
33
28
|
*/
|
|
34
29
|
var ReplykeStoreProvider = function (_a) {
|
|
35
|
-
var children = _a.children;
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(react_redux_1.Provider, { store: store_1.replykeStore, children: (0, jsx_runtime_1.jsx)(
|
|
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 }) }));
|
|
37
32
|
};
|
|
38
33
|
exports.ReplykeStoreProvider = ReplykeStoreProvider;
|
|
39
|
-
//
|
|
40
|
-
//
|
|
34
|
+
// Clean Redux-only architecture
|
|
35
|
+
// Always integrated with ReplykeProvider
|
|
41
36
|
exports.default = exports.ReplykeStoreProvider;
|
|
42
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,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CAAC;;;;SACF,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAE1B,IAAM,qBAAqB,GAAG,IAAA,mBAAW,EAAC,UAAC,KAA0C;QACnF,wDAAwD;QACxD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAChC,IAAM,YAAY,GAAG,YAAY,CAAC;YAClC,IAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;YACrC,QAAQ,CAAC,IAAA,2BAAe,EAAC,QAAQ,CAAC,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAA,2BAAe,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,19 @@ 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, //
|
|
7
|
+
export { ReplykeProvider, // Always includes Redux auth and notification management
|
|
8
|
+
ReplykeStoreProvider, // Advanced: standalone Redux provider
|
|
8
9
|
EntityListProvider, EntityProvider, ListsProvider, AppNotificationsProvider, CommentSectionProvider, } from "./context";
|
|
9
|
-
export { ReplykeStoreProvider, } from "./context";
|
|
10
10
|
export { useProject, useProjectData } from "./hooks/projects";
|
|
11
11
|
export { useSignTestingJwt } from "./hooks/crypto";
|
|
12
|
-
export {
|
|
12
|
+
export { useAuthRedux, useUserRedux, type UseAuthReduxValues, type UseUserReduxValues, } from "./hooks/auth-redux";
|
|
13
13
|
export { useAppNotifications, useAppNotificationsData, useCountUnreadNotifications, useFetchAppNotifications, useMarkNotificationAsRead, } from "./hooks/app-notifications";
|
|
14
14
|
export { useAppNotificationsRedux, useAppNotificationsDataRedux, type UseAppNotificationsDataProps, type UseAppNotificationsDataValues, } from "./hooks/app-notifications-redux";
|
|
15
15
|
export { useEntity, useEntityData, useCreateEntity, useFetchEntity, useFetchEntityByForeignId, useFetchEntityByShortId, useUpdateEntity, useEntityVotes, useDeleteEntity, useEntityList, useEntityListData, useInfusedData, } from "./hooks/entities";
|
|
16
16
|
export { useCommentSection, useCommentSectionData, useCreateComment, useFetchManyComments, useFetchComment, useFetchCommentByForeignId, useReplies, useUpdateComment, useCommentVotes, useDeleteComment, useEntityComments, useProfileComments, } from "./hooks/comments";
|
|
17
17
|
export { useLists, useListsData, useCreateList, useFetchRootList, useFetchSubLists, useIsEntitySaved, useUpdateList, useAddToList, useRemoveFromList, useDeleteList, } from "./hooks/lists";
|
|
18
|
-
export {
|
|
18
|
+
export { useUserData, useFetchUser, useFetchUserByForeignId, useFetchUserFollowersCount, useFetchUserFollowingCount, useCheckUsernameAvailability, useFetchUserSuggestions, useMentions, useUpdateUser, useFetchFollow, useFollowUser, useUnfollowUser, } from "./hooks/users";
|
|
19
|
+
export { useUser as useUserContext } from "./hooks/users";
|
|
19
20
|
export { useCreateReport } from "./hooks/reports";
|
|
20
21
|
export { useGetMetadata } from "./hooks/utils";
|
|
21
22
|
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.useListsData = exports.useLists = exports.useProfileComments = exports.useEntityComments = exports.useDeleteComment = exports.useCommentVotes = exports.useUpdateComment = exports.useReplies = exports.useFetchCommentByForeignId = 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.useUserRedux = exports.useAuthRedux = exports.useSignTestingJwt = exports.useProjectData = exports.useProject = exports.CommentSectionProvider = exports.AppNotificationsProvider = exports.ListsProvider = exports.EntityProvider = exports.EntityListProvider = exports.ReplykeStoreProvider = 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 = 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,17 +50,15 @@ 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
|
+
Object.defineProperty(exports, "ReplykeStoreProvider", { enumerable: true, get: function () { return context_1.ReplykeStoreProvider; } });
|
|
56
57
|
Object.defineProperty(exports, "EntityListProvider", { enumerable: true, get: function () { return context_1.EntityListProvider; } });
|
|
57
58
|
Object.defineProperty(exports, "EntityProvider", { enumerable: true, get: function () { return context_1.EntityProvider; } });
|
|
58
59
|
Object.defineProperty(exports, "ListsProvider", { enumerable: true, get: function () { return context_1.ListsProvider; } });
|
|
59
60
|
Object.defineProperty(exports, "AppNotificationsProvider", { enumerable: true, get: function () { return context_1.AppNotificationsProvider; } });
|
|
60
61
|
Object.defineProperty(exports, "CommentSectionProvider", { enumerable: true, get: function () { return context_1.CommentSectionProvider; } });
|
|
61
|
-
// Advanced Redux providers (for advanced use cases)
|
|
62
|
-
var context_2 = require("./context");
|
|
63
|
-
Object.defineProperty(exports, "ReplykeStoreProvider", { enumerable: true, get: function () { return context_2.ReplykeStoreProvider; } });
|
|
64
62
|
// -- projects
|
|
65
63
|
var projects_1 = require("./hooks/projects");
|
|
66
64
|
Object.defineProperty(exports, "useProject", { enumerable: true, get: function () { return projects_1.useProject; } });
|
|
@@ -68,16 +66,10 @@ Object.defineProperty(exports, "useProjectData", { enumerable: true, get: functi
|
|
|
68
66
|
// -- crypto
|
|
69
67
|
var crypto_1 = require("./hooks/crypto");
|
|
70
68
|
Object.defineProperty(exports, "useSignTestingJwt", { enumerable: true, get: function () { return crypto_1.useSignTestingJwt; } });
|
|
71
|
-
// -- authentication
|
|
72
|
-
var
|
|
73
|
-
Object.defineProperty(exports, "
|
|
74
|
-
Object.defineProperty(exports, "
|
|
75
|
-
Object.defineProperty(exports, "useRequestNewAccessToken", { enumerable: true, get: function () { return auth_1.useRequestNewAccessToken; } });
|
|
76
|
-
Object.defineProperty(exports, "useSignUpWithEmailAndPassword", { enumerable: true, get: function () { return auth_1.useSignUpWithEmailAndPassword; } });
|
|
77
|
-
Object.defineProperty(exports, "useSignInWithEmailAndPassword", { enumerable: true, get: function () { return auth_1.useSignInWithEmailAndPassword; } });
|
|
78
|
-
Object.defineProperty(exports, "useSignOut", { enumerable: true, get: function () { return auth_1.useSignOut; } });
|
|
79
|
-
Object.defineProperty(exports, "useChangePassword", { enumerable: true, get: function () { return auth_1.useChangePassword; } });
|
|
80
|
-
Object.defineProperty(exports, "useVerifyExternalUser", { enumerable: true, get: function () { return auth_1.useVerifyExternalUser; } });
|
|
69
|
+
// -- authentication (now Redux-powered)
|
|
70
|
+
var auth_redux_1 = require("./hooks/auth-redux");
|
|
71
|
+
Object.defineProperty(exports, "useAuthRedux", { enumerable: true, get: function () { return auth_redux_1.useAuthRedux; } });
|
|
72
|
+
Object.defineProperty(exports, "useUserRedux", { enumerable: true, get: function () { return auth_redux_1.useUserRedux; } });
|
|
81
73
|
// -- app notifications
|
|
82
74
|
var app_notifications_1 = require("./hooks/app-notifications");
|
|
83
75
|
Object.defineProperty(exports, "useAppNotifications", { enumerable: true, get: function () { return app_notifications_1.useAppNotifications; } });
|
|
@@ -131,7 +123,6 @@ Object.defineProperty(exports, "useRemoveFromList", { enumerable: true, get: fun
|
|
|
131
123
|
Object.defineProperty(exports, "useDeleteList", { enumerable: true, get: function () { return lists_1.useDeleteList; } });
|
|
132
124
|
// -- users
|
|
133
125
|
var users_1 = require("./hooks/users");
|
|
134
|
-
Object.defineProperty(exports, "useUser", { enumerable: true, get: function () { return users_1.useUser; } });
|
|
135
126
|
Object.defineProperty(exports, "useUserData", { enumerable: true, get: function () { return users_1.useUserData; } });
|
|
136
127
|
Object.defineProperty(exports, "useFetchUser", { enumerable: true, get: function () { return users_1.useFetchUser; } });
|
|
137
128
|
Object.defineProperty(exports, "useFetchUserByForeignId", { enumerable: true, get: function () { return users_1.useFetchUserByForeignId; } });
|
|
@@ -144,6 +135,9 @@ Object.defineProperty(exports, "useUpdateUser", { enumerable: true, get: functio
|
|
|
144
135
|
Object.defineProperty(exports, "useFetchFollow", { enumerable: true, get: function () { return users_1.useFetchFollow; } });
|
|
145
136
|
Object.defineProperty(exports, "useFollowUser", { enumerable: true, get: function () { return users_1.useFollowUser; } });
|
|
146
137
|
Object.defineProperty(exports, "useUnfollowUser", { enumerable: true, get: function () { return users_1.useUnfollowUser; } });
|
|
138
|
+
// Legacy user exports (for reference - keep existing Context implementation available)
|
|
139
|
+
var users_2 = require("./hooks/users");
|
|
140
|
+
Object.defineProperty(exports, "useUserContext", { enumerable: true, get: function () { return users_2.useUser; } });
|
|
147
141
|
// -- reports
|
|
148
142
|
var reports_1 = require("./hooks/reports");
|
|
149
143
|
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,OA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;AACb,uGAAA,cAAc,OAAA;AACd,sGAAA,aAAa,OAAA;AACb,wGAAA,eAAe,OAAA;AAGjB,uFAAuF;AACvF,uCAA0D;AAAjD,uGAAA,OAAO,OAAkB;AAElC,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"}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import type { RootState } from '../index';
|
|
2
|
+
import type { AuthUser } from '../../interfaces/models/User';
|
|
2
3
|
export interface AuthState {
|
|
3
4
|
accessToken: string | null;
|
|
4
5
|
refreshToken: string | null;
|
|
6
|
+
user: AuthUser | null;
|
|
7
|
+
loadingInitial: boolean;
|
|
8
|
+
isAuthenticating: boolean;
|
|
9
|
+
initialized: boolean;
|
|
10
|
+
signedToken: string | null;
|
|
5
11
|
}
|
|
6
12
|
export declare const setTokens: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
7
13
|
accessToken: string | null;
|
|
8
14
|
refreshToken?: string | null;
|
|
9
|
-
}, "auth/setTokens">, clearTokens: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"auth/clearTokens">;
|
|
15
|
+
}, "auth/setTokens">, clearTokens: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"auth/clearTokens">, setUser: import("@reduxjs/toolkit").ActionCreatorWithPayload<AuthUser | null, "auth/setUser">, setLoadingInitial: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "auth/setLoadingInitial">, setAuthenticating: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "auth/setAuthenticating">, setInitialized: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "auth/setInitialized">, setSignedToken: import("@reduxjs/toolkit").ActionCreatorWithPayload<string | null, "auth/setSignedToken">, resetAuth: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"auth/resetAuth">, setRefreshToken: import("@reduxjs/toolkit").ActionCreatorWithPayload<string | null, "auth/setRefreshToken">;
|
|
10
16
|
export declare const selectAccessToken: (state: RootState) => string | null;
|
|
11
17
|
export declare const selectRefreshToken: (state: RootState) => string | null;
|
|
18
|
+
export declare const selectUser: (state: RootState) => AuthUser | null;
|
|
19
|
+
export declare const selectLoadingInitial: (state: RootState) => boolean;
|
|
20
|
+
export declare const selectIsAuthenticating: (state: RootState) => boolean;
|
|
21
|
+
export declare const selectInitialized: (state: RootState) => boolean;
|
|
22
|
+
export declare const selectSignedToken: (state: RootState) => string | null;
|
|
12
23
|
declare const _default: import("@reduxjs/toolkit").Reducer<AuthState>;
|
|
13
24
|
export default _default;
|