@replyke/core 7.0.0-beta.52 → 7.0.0-beta.53
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/replyke-store-context.d.ts +1 -1
- package/dist/cjs/context/replyke-store-context.js +8 -2
- package/dist/cjs/context/replyke-store-context.js.map +1 -1
- package/dist/cjs/store/index.d.ts +4 -4
- package/dist/cjs/store/index.js +50 -62
- package/dist/cjs/store/index.js.map +1 -1
- package/dist/cjs/store/replykeReduxContext.d.ts +1 -2
- package/dist/cjs/store/replykeReduxContext.js +3 -32
- package/dist/cjs/store/replykeReduxContext.js.map +1 -1
- package/dist/cjs/store/types/index.d.ts +0 -3
- package/dist/esm/context/replyke-store-context.d.ts +1 -1
- package/dist/esm/context/replyke-store-context.js +10 -4
- package/dist/esm/context/replyke-store-context.js.map +1 -1
- package/dist/esm/store/index.d.ts +4 -4
- package/dist/esm/store/index.js +48 -48
- package/dist/esm/store/index.js.map +1 -1
- package/dist/esm/store/replykeReduxContext.d.ts +1 -2
- package/dist/esm/store/replykeReduxContext.js +3 -32
- package/dist/esm/store/replykeReduxContext.js.map +1 -1
- package/dist/esm/store/types/index.d.ts +0 -3
- package/package.json +7 -5
|
@@ -7,7 +7,7 @@ export interface ReplykeStoreProviderProps {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Redux store provider for Replyke
|
|
10
|
-
*
|
|
10
|
+
* Creates a store instance per provider (prevents SSR state leakage)
|
|
11
11
|
*/
|
|
12
12
|
export declare const ReplykeStoreProvider: React.FC<ReplykeStoreProviderProps>;
|
|
13
13
|
export default ReplykeStoreProvider;
|
|
@@ -26,11 +26,17 @@ var AuthInitializer = function (_a) {
|
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
28
|
* Redux store provider for Replyke
|
|
29
|
-
*
|
|
29
|
+
* Creates a store instance per provider (prevents SSR state leakage)
|
|
30
30
|
*/
|
|
31
31
|
var ReplykeStoreProvider = function (_a) {
|
|
32
32
|
var children = _a.children, projectId = _a.projectId, signedToken = _a.signedToken;
|
|
33
|
-
|
|
33
|
+
// Create store once per provider instance using useRef
|
|
34
|
+
// This pattern is recommended for SSR to prevent state leakage between requests
|
|
35
|
+
var storeRef = (0, react_1.useRef)(null);
|
|
36
|
+
if (!storeRef.current) {
|
|
37
|
+
storeRef.current = (0, store_1.makeStore)();
|
|
38
|
+
}
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(react_redux_1.Provider, { store: storeRef.current, context: replykeReduxContext_1.ReplykeReduxContext, children: (0, jsx_runtime_1.jsx)(AuthInitializer, { projectId: projectId, signedToken: signedToken, children: children }) }));
|
|
34
40
|
};
|
|
35
41
|
exports.ReplykeStoreProvider = ReplykeStoreProvider;
|
|
36
42
|
// Clean Redux-only architecture
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replyke-store-context.js","sourceRoot":"","sources":["../../../src/context/replyke-store-context.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAEb,+
|
|
1
|
+
{"version":3,"file":"replyke-store-context.js","sourceRoot":"","sources":["../../../src/context/replyke-store-context.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAEb,+BAAiD;AACjD,2CAAuC;AACvC,kCAAqC;AAGrC,yDAAiE;AACjE,oEAGsC;AAQtC;;;GAGG;AACH,IAAM,eAAe,GAIhB,UAAC,EAAoC;QAAlC,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,WAAW,iBAAA;IACtC,IAAM,QAAQ,GAAG,IAAA,wCAAkB,GAAiB,CAAC;IAErD,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,uDAAuD;IACvD,gFAAgF;IAChF,IAAM,QAAQ,GAAG,IAAA,cAAM,EAAkB,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtB,QAAQ,CAAC,OAAO,GAAG,IAAA,iBAAS,GAAE,CAAC;IACjC,CAAC;IAED,OAAO,CACL,uBAAC,sBAAQ,IAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,yCAAmB,YAC7D,uBAAC,eAAe,IAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,YAC5D,QAAQ,GACO,GACT,CACZ,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,oBAAoB,wBAmB/B;AAEF,gCAAgC;AAChC,yCAAyC;AAEzC,kBAAe,4BAAoB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const makeStore: () => import("@reduxjs/toolkit").EnhancedStore<{
|
|
2
2
|
api: import("@reduxjs/toolkit/query").CombinedState<{}, "AppNotification" | "Collection" | "CollectionEntities" | "User" | "Entity" | "Space" | "SpaceMember", "api">;
|
|
3
3
|
auth: import("./slices/authSlice").AuthState;
|
|
4
4
|
appNotifications: import("./slices/appNotificationsSlice").AppNotificationsState;
|
|
@@ -17,7 +17,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
17
17
|
spaceLists: import("./slices/spaceListsSlice").SpaceListsState;
|
|
18
18
|
}, undefined, import("@reduxjs/toolkit").UnknownAction>;
|
|
19
19
|
}>, import("@reduxjs/toolkit").StoreEnhancer]>>;
|
|
20
|
-
export type
|
|
21
|
-
export
|
|
20
|
+
export type AppStore = ReturnType<typeof makeStore>;
|
|
21
|
+
export type AppDispatch = AppStore['dispatch'];
|
|
22
|
+
export type { RootState, AppThunk, TypedSelector } from "./types";
|
|
22
23
|
export { rootReducer } from "./rootReducer";
|
|
23
|
-
export * from "./types";
|
package/dist/cjs/store/index.js
CHANGED
|
@@ -1,73 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.rootReducer = exports.
|
|
3
|
+
exports.rootReducer = exports.makeStore = void 0;
|
|
18
4
|
var toolkit_1 = require("@reduxjs/toolkit");
|
|
19
5
|
var rootReducer_1 = require("./rootReducer");
|
|
20
6
|
var middleware_1 = require("./middleware");
|
|
21
7
|
var baseApi_1 = require("./api/baseApi");
|
|
22
8
|
var env_1 = require("../utils/env");
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
9
|
+
// Store factory function - creates a new store instance
|
|
10
|
+
// This pattern is required for SSR to prevent state leakage between requests
|
|
11
|
+
var makeStore = function () {
|
|
12
|
+
return (0, toolkit_1.configureStore)({
|
|
13
|
+
reducer: rootReducer_1.rootReducer,
|
|
14
|
+
middleware: function (getDefaultMiddleware) {
|
|
15
|
+
return getDefaultMiddleware({
|
|
16
|
+
serializableCheck: {
|
|
17
|
+
// Ignore these action types for serializable check
|
|
18
|
+
ignoredActions: [
|
|
19
|
+
'persist/PERSIST',
|
|
20
|
+
'persist/REHYDRATE',
|
|
21
|
+
// RTK Query actions that might contain functions
|
|
22
|
+
'appNotificationsApi/executeQuery/pending',
|
|
23
|
+
'appNotificationsApi/executeQuery/fulfilled',
|
|
24
|
+
'appNotificationsApi/executeQuery/rejected',
|
|
25
|
+
'appNotificationsApi/executeMutation/pending',
|
|
26
|
+
'appNotificationsApi/executeMutation/fulfilled',
|
|
27
|
+
'appNotificationsApi/executeMutation/rejected',
|
|
28
|
+
],
|
|
29
|
+
// Ignore these field paths in all actions
|
|
30
|
+
ignoredActionsPaths: [
|
|
31
|
+
'meta.arg',
|
|
32
|
+
'payload.timestamp',
|
|
33
|
+
// RTK Query meta fields that may contain functions
|
|
34
|
+
'meta.baseQueryMeta',
|
|
35
|
+
'meta.arg.originalArgs',
|
|
36
|
+
'meta.arg.endpointName',
|
|
37
|
+
'payload.meta',
|
|
38
|
+
],
|
|
39
|
+
// Ignore these paths in the state
|
|
40
|
+
ignoredPaths: [
|
|
41
|
+
'items.dates',
|
|
42
|
+
// RTK Query state paths that may contain functions/metadata
|
|
43
|
+
'api',
|
|
44
|
+
'appNotificationsApi',
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
// Add RTK Query middleware
|
|
49
|
+
.concat(baseApi_1.baseApi.middleware)
|
|
50
|
+
// Add custom middleware
|
|
51
|
+
.concat(middleware_1.customMiddleware);
|
|
52
|
+
},
|
|
53
|
+
// Enable Redux DevTools in development
|
|
54
|
+
devTools: !(0, env_1.isProduction)(),
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
exports.makeStore = makeStore;
|
|
69
58
|
// Export for advanced users who need direct access
|
|
70
59
|
var rootReducer_2 = require("./rootReducer");
|
|
71
60
|
Object.defineProperty(exports, "rootReducer", { enumerable: true, get: function () { return rootReducer_2.rootReducer; } });
|
|
72
|
-
__exportStar(require("./types"), exports);
|
|
73
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":";;;AAAA,4CAAkD;AAClD,6CAA4C;AAC5C,2CAAgD;AAChD,yCAAwC;AACxC,oCAA4C;AAE5C,wDAAwD;AACxD,6EAA6E;AACtE,IAAM,SAAS,GAAG;IACvB,OAAO,IAAA,wBAAc,EAAC;QACpB,OAAO,EAAE,yBAAW;QACpB,UAAU,EAAE,UAAC,oBAAoB;YAC/B,OAAA,oBAAoB,CAAC;gBACnB,iBAAiB,EAAE;oBACjB,mDAAmD;oBACnD,cAAc,EAAE;wBACd,iBAAiB;wBACjB,mBAAmB;wBACnB,iDAAiD;wBACjD,0CAA0C;wBAC1C,4CAA4C;wBAC5C,2CAA2C;wBAC3C,6CAA6C;wBAC7C,+CAA+C;wBAC/C,8CAA8C;qBAC/C;oBACD,0CAA0C;oBAC1C,mBAAmB,EAAE;wBACnB,UAAU;wBACV,mBAAmB;wBACnB,mDAAmD;wBACnD,oBAAoB;wBACpB,uBAAuB;wBACvB,uBAAuB;wBACvB,cAAc;qBACf;oBACD,kCAAkC;oBAClC,YAAY,EAAE;wBACZ,aAAa;wBACb,4DAA4D;wBAC5D,KAAK;wBACL,qBAAqB;qBACtB;iBACF;aACF,CAAC;gBACA,2BAA2B;iBAC1B,MAAM,CAAC,iBAAO,CAAC,UAAU,CAAC;gBAC3B,wBAAwB;iBACvB,MAAM,CAAC,6BAAgB,CAAC;QApC3B,CAoC2B;QAE7B,uCAAuC;QACvC,QAAQ,EAAE,CAAC,IAAA,kBAAY,GAAE;KAC1B,CAAC,CAAC;AACL,CAAC,CAAC;AA7CW,QAAA,SAAS,aA6CpB;AASF,mDAAmD;AACnD,6CAA4C;AAAnC,0GAAA,WAAW,OAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Context } from "react";
|
|
2
1
|
import { ReactReduxContextValue } from "react-redux";
|
|
3
|
-
export declare const ReplykeReduxContext: Context<ReactReduxContextValue<any, import("@reduxjs/toolkit").UnknownAction> | null>;
|
|
2
|
+
export declare const ReplykeReduxContext: import("react").Context<ReactReduxContextValue<any, import("@reduxjs/toolkit").UnknownAction> | null>;
|
|
4
3
|
export declare const useReplykeDispatch: import("react-redux").UseDispatch<import("@reduxjs/toolkit").Dispatch<import("@reduxjs/toolkit").UnknownAction>>;
|
|
5
4
|
export declare const useReplykeSelector: import("react-redux").UseSelector<unknown>;
|
|
6
5
|
export declare const useReplykeStore: import("react-redux").UseStore<import("@reduxjs/toolkit").Store<any, import("@reduxjs/toolkit").UnknownAction, unknown>>;
|
|
@@ -4,39 +4,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.useReplykeStore = exports.useReplykeSelector = exports.useReplykeDispatch = exports.ReplykeReduxContext = void 0;
|
|
5
5
|
var react_1 = require("react");
|
|
6
6
|
var react_redux_1 = require("react-redux");
|
|
7
|
-
// Global key for singleton context
|
|
8
|
-
var REPLYKE_REDUX_CONTEXT_KEY = "__REPLYKE_REDUX_CONTEXT__";
|
|
9
|
-
/**
|
|
10
|
-
* Get or create the Replyke Redux context as a singleton.
|
|
11
|
-
* This prevents duplicate context instances when the module is loaded
|
|
12
|
-
* multiple times (e.g., CJS and ESM builds in Next.js).
|
|
13
|
-
*/
|
|
14
|
-
function getOrCreateReplykeReduxContext() {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
var globalObj = (typeof globalThis !== "undefined"
|
|
17
|
-
? globalThis
|
|
18
|
-
: typeof window !== "undefined"
|
|
19
|
-
? window
|
|
20
|
-
: typeof global !== "undefined"
|
|
21
|
-
? global
|
|
22
|
-
: {});
|
|
23
|
-
var isNew = !globalObj[REPLYKE_REDUX_CONTEXT_KEY];
|
|
24
|
-
if (isNew) {
|
|
25
|
-
globalObj[REPLYKE_REDUX_CONTEXT_KEY] = (0, react_1.createContext)(null);
|
|
26
|
-
}
|
|
27
|
-
// Debug logging - remove after debugging
|
|
28
|
-
if (typeof window !== "undefined") {
|
|
29
|
-
console.log("[ReplykeReduxContext] getOrCreate called:", {
|
|
30
|
-
isNew: isNew,
|
|
31
|
-
contextId: (_b = (_a = globalObj[REPLYKE_REDUX_CONTEXT_KEY]) === null || _a === void 0 ? void 0 : _a._currentValue2) !== null && _b !== void 0 ? _b : "N/A",
|
|
32
|
-
globalObjType: globalObj === window ? "window" : globalObj === globalThis ? "globalThis" : "other",
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return globalObj[REPLYKE_REDUX_CONTEXT_KEY];
|
|
36
|
-
}
|
|
37
7
|
// Custom context for Replyke's Redux store
|
|
38
|
-
//
|
|
39
|
-
|
|
8
|
+
// This isolates Replyke's Redux from any external Redux stores users may have
|
|
9
|
+
// Note: react-redux must be a peer dependency to ensure a single instance
|
|
10
|
+
exports.ReplykeReduxContext = (0, react_1.createContext)(null);
|
|
40
11
|
// Custom hooks bound to Replyke's context (not the default React-Redux context)
|
|
41
12
|
// These ensure Replyke's internal state management doesn't interfere with
|
|
42
13
|
// external Redux stores
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replykeReduxContext.js","sourceRoot":"","sources":["../../../src/store/replykeReduxContext.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,+
|
|
1
|
+
{"version":3,"file":"replykeReduxContext.js","sourceRoot":"","sources":["../../../src/store/replykeReduxContext.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,+BAAsC;AACtC,2CAKqB;AAErB,2CAA2C;AAC3C,8EAA8E;AAC9E,0EAA0E;AAC7D,QAAA,mBAAmB,GAAG,IAAA,qBAAa,EAAgC,IAAI,CAAC,CAAC;AAEtF,gFAAgF;AAChF,0EAA0E;AAC1E,wBAAwB;AACX,QAAA,kBAAkB,GAAG,IAAA,gCAAkB,EAAC,2BAAmB,CAAC,CAAC;AAC7D,QAAA,kBAAkB,GAAG,IAAA,gCAAkB,EAAC,2BAAmB,CAAC,CAAC;AAC7D,QAAA,eAAe,GAAG,IAAA,6BAAe,EAAC,2BAAmB,CAAC,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { Action, ThunkAction } from "@reduxjs/toolkit";
|
|
2
2
|
import type { RootState } from "../rootReducer";
|
|
3
|
-
import type { store } from "../index";
|
|
4
|
-
export type AppStore = typeof store;
|
|
5
3
|
export type { RootState };
|
|
6
|
-
export type AppDispatch = AppStore['dispatch'];
|
|
7
4
|
export type AppThunk<ReturnType = void> = ThunkAction<ReturnType, RootState, unknown, Action<string>>;
|
|
8
5
|
export type TypedSelector<T> = (state: RootState) => T;
|
|
@@ -7,7 +7,7 @@ export interface ReplykeStoreProviderProps {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Redux store provider for Replyke
|
|
10
|
-
*
|
|
10
|
+
* Creates a store instance per provider (prevents SSR state leakage)
|
|
11
11
|
*/
|
|
12
12
|
export declare const ReplykeStoreProvider: React.FC<ReplykeStoreProviderProps>;
|
|
13
13
|
export default ReplykeStoreProvider;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect } from "react";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
4
|
import { Provider } from "react-redux";
|
|
5
|
-
import {
|
|
5
|
+
import { makeStore } from "../store";
|
|
6
6
|
import { initializeAuthThunk } from "../store/slices/authThunks";
|
|
7
7
|
import { ReplykeReduxContext, useReplykeDispatch, } from "../store/replykeReduxContext";
|
|
8
8
|
/**
|
|
@@ -23,11 +23,17 @@ var AuthInitializer = function (_a) {
|
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* Redux store provider for Replyke
|
|
26
|
-
*
|
|
26
|
+
* Creates a store instance per provider (prevents SSR state leakage)
|
|
27
27
|
*/
|
|
28
28
|
export var ReplykeStoreProvider = function (_a) {
|
|
29
29
|
var children = _a.children, projectId = _a.projectId, signedToken = _a.signedToken;
|
|
30
|
-
|
|
30
|
+
// Create store once per provider instance using useRef
|
|
31
|
+
// This pattern is recommended for SSR to prevent state leakage between requests
|
|
32
|
+
var storeRef = useRef(null);
|
|
33
|
+
if (!storeRef.current) {
|
|
34
|
+
storeRef.current = makeStore();
|
|
35
|
+
}
|
|
36
|
+
return (_jsx(Provider, { store: storeRef.current, context: ReplykeReduxContext, children: _jsx(AuthInitializer, { projectId: projectId, signedToken: signedToken, children: children }) }));
|
|
31
37
|
};
|
|
32
38
|
// Clean Redux-only architecture
|
|
33
39
|
// Always integrated with ReplykeProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replyke-store-context.js","sourceRoot":"","sources":["../../../src/context/replyke-store-context.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"replyke-store-context.js","sourceRoot":"","sources":["../../../src/context/replyke-store-context.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAQtC;;;GAGG;AACH,IAAM,eAAe,GAIhB,UAAC,EAAoC;QAAlC,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,WAAW,iBAAA;IACtC,IAAM,QAAQ,GAAG,kBAAkB,EAAiB,CAAC;IAErD,SAAS,CAAC;QACR,gDAAgD;QAChD,QAAQ,CAAC,mBAAmB,CAAC;YAC3B,SAAS,WAAA;YACT,WAAW,aAAA;SACZ,CAAC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;IAEvC,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,IAAM,oBAAoB,GAAwC,UAAC,EAIzE;QAHC,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,WAAW,iBAAA;IAEX,uDAAuD;IACvD,gFAAgF;IAChF,IAAM,QAAQ,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtB,QAAQ,CAAC,OAAO,GAAG,SAAS,EAAE,CAAC;IACjC,CAAC;IAED,OAAO,CACL,KAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,YAC7D,KAAC,eAAe,IAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,YAC5D,QAAQ,GACO,GACT,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,gCAAgC;AAChC,yCAAyC;AAEzC,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const makeStore: () => import("@reduxjs/toolkit").EnhancedStore<{
|
|
2
2
|
api: import("@reduxjs/toolkit/query").CombinedState<{}, "AppNotification" | "Collection" | "CollectionEntities" | "User" | "Entity" | "Space" | "SpaceMember", "api">;
|
|
3
3
|
auth: import("./slices/authSlice").AuthState;
|
|
4
4
|
appNotifications: import("./slices/appNotificationsSlice").AppNotificationsState;
|
|
@@ -17,7 +17,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
17
17
|
spaceLists: import("./slices/spaceListsSlice").SpaceListsState;
|
|
18
18
|
}, undefined, import("@reduxjs/toolkit").UnknownAction>;
|
|
19
19
|
}>, import("@reduxjs/toolkit").StoreEnhancer]>>;
|
|
20
|
-
export type
|
|
21
|
-
export
|
|
20
|
+
export type AppStore = ReturnType<typeof makeStore>;
|
|
21
|
+
export type AppDispatch = AppStore['dispatch'];
|
|
22
|
+
export type { RootState, AppThunk, TypedSelector } from "./types";
|
|
22
23
|
export { rootReducer } from "./rootReducer";
|
|
23
|
-
export * from "./types";
|
package/dist/esm/store/index.js
CHANGED
|
@@ -3,54 +3,54 @@ import { rootReducer } from "./rootReducer";
|
|
|
3
3
|
import { customMiddleware } from "./middleware";
|
|
4
4
|
import { baseApi } from "./api/baseApi";
|
|
5
5
|
import { isProduction } from "../utils/env";
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
6
|
+
// Store factory function - creates a new store instance
|
|
7
|
+
// This pattern is required for SSR to prevent state leakage between requests
|
|
8
|
+
export var makeStore = function () {
|
|
9
|
+
return configureStore({
|
|
10
|
+
reducer: rootReducer,
|
|
11
|
+
middleware: function (getDefaultMiddleware) {
|
|
12
|
+
return getDefaultMiddleware({
|
|
13
|
+
serializableCheck: {
|
|
14
|
+
// Ignore these action types for serializable check
|
|
15
|
+
ignoredActions: [
|
|
16
|
+
'persist/PERSIST',
|
|
17
|
+
'persist/REHYDRATE',
|
|
18
|
+
// RTK Query actions that might contain functions
|
|
19
|
+
'appNotificationsApi/executeQuery/pending',
|
|
20
|
+
'appNotificationsApi/executeQuery/fulfilled',
|
|
21
|
+
'appNotificationsApi/executeQuery/rejected',
|
|
22
|
+
'appNotificationsApi/executeMutation/pending',
|
|
23
|
+
'appNotificationsApi/executeMutation/fulfilled',
|
|
24
|
+
'appNotificationsApi/executeMutation/rejected',
|
|
25
|
+
],
|
|
26
|
+
// Ignore these field paths in all actions
|
|
27
|
+
ignoredActionsPaths: [
|
|
28
|
+
'meta.arg',
|
|
29
|
+
'payload.timestamp',
|
|
30
|
+
// RTK Query meta fields that may contain functions
|
|
31
|
+
'meta.baseQueryMeta',
|
|
32
|
+
'meta.arg.originalArgs',
|
|
33
|
+
'meta.arg.endpointName',
|
|
34
|
+
'payload.meta',
|
|
35
|
+
],
|
|
36
|
+
// Ignore these paths in the state
|
|
37
|
+
ignoredPaths: [
|
|
38
|
+
'items.dates',
|
|
39
|
+
// RTK Query state paths that may contain functions/metadata
|
|
40
|
+
'api',
|
|
41
|
+
'appNotificationsApi',
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
// Add RTK Query middleware
|
|
46
|
+
.concat(baseApi.middleware)
|
|
47
|
+
// Add custom middleware
|
|
48
|
+
.concat(customMiddleware);
|
|
49
|
+
},
|
|
50
|
+
// Enable Redux DevTools in development
|
|
51
|
+
devTools: !isProduction(),
|
|
52
|
+
});
|
|
53
|
+
};
|
|
53
54
|
// Export for advanced users who need direct access
|
|
54
55
|
export { rootReducer } from "./rootReducer";
|
|
55
|
-
export * from "./types";
|
|
56
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,wDAAwD;AACxD,6EAA6E;AAC7E,MAAM,CAAC,IAAM,SAAS,GAAG;IACvB,OAAO,cAAc,CAAC;QACpB,OAAO,EAAE,WAAW;QACpB,UAAU,EAAE,UAAC,oBAAoB;YAC/B,OAAA,oBAAoB,CAAC;gBACnB,iBAAiB,EAAE;oBACjB,mDAAmD;oBACnD,cAAc,EAAE;wBACd,iBAAiB;wBACjB,mBAAmB;wBACnB,iDAAiD;wBACjD,0CAA0C;wBAC1C,4CAA4C;wBAC5C,2CAA2C;wBAC3C,6CAA6C;wBAC7C,+CAA+C;wBAC/C,8CAA8C;qBAC/C;oBACD,0CAA0C;oBAC1C,mBAAmB,EAAE;wBACnB,UAAU;wBACV,mBAAmB;wBACnB,mDAAmD;wBACnD,oBAAoB;wBACpB,uBAAuB;wBACvB,uBAAuB;wBACvB,cAAc;qBACf;oBACD,kCAAkC;oBAClC,YAAY,EAAE;wBACZ,aAAa;wBACb,4DAA4D;wBAC5D,KAAK;wBACL,qBAAqB;qBACtB;iBACF;aACF,CAAC;gBACA,2BAA2B;iBAC1B,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;gBAC3B,wBAAwB;iBACvB,MAAM,CAAC,gBAAgB,CAAC;QApC3B,CAoC2B;QAE7B,uCAAuC;QACvC,QAAQ,EAAE,CAAC,YAAY,EAAE;KAC1B,CAAC,CAAC;AACL,CAAC,CAAC;AASF,mDAAmD;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Context } from "react";
|
|
2
1
|
import { ReactReduxContextValue } from "react-redux";
|
|
3
|
-
export declare const ReplykeReduxContext: Context<ReactReduxContextValue<any, import("@reduxjs/toolkit").UnknownAction> | null>;
|
|
2
|
+
export declare const ReplykeReduxContext: import("react").Context<ReactReduxContextValue<any, import("@reduxjs/toolkit").UnknownAction> | null>;
|
|
4
3
|
export declare const useReplykeDispatch: import("react-redux").UseDispatch<import("@reduxjs/toolkit").Dispatch<import("@reduxjs/toolkit").UnknownAction>>;
|
|
5
4
|
export declare const useReplykeSelector: import("react-redux").UseSelector<unknown>;
|
|
6
5
|
export declare const useReplykeStore: import("react-redux").UseStore<import("@reduxjs/toolkit").Store<any, import("@reduxjs/toolkit").UnknownAction, unknown>>;
|
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createContext } from "react";
|
|
3
3
|
import { createDispatchHook, createSelectorHook, createStoreHook, } from "react-redux";
|
|
4
|
-
// Global key for singleton context
|
|
5
|
-
var REPLYKE_REDUX_CONTEXT_KEY = "__REPLYKE_REDUX_CONTEXT__";
|
|
6
|
-
/**
|
|
7
|
-
* Get or create the Replyke Redux context as a singleton.
|
|
8
|
-
* This prevents duplicate context instances when the module is loaded
|
|
9
|
-
* multiple times (e.g., CJS and ESM builds in Next.js).
|
|
10
|
-
*/
|
|
11
|
-
function getOrCreateReplykeReduxContext() {
|
|
12
|
-
var _a, _b;
|
|
13
|
-
var globalObj = (typeof globalThis !== "undefined"
|
|
14
|
-
? globalThis
|
|
15
|
-
: typeof window !== "undefined"
|
|
16
|
-
? window
|
|
17
|
-
: typeof global !== "undefined"
|
|
18
|
-
? global
|
|
19
|
-
: {});
|
|
20
|
-
var isNew = !globalObj[REPLYKE_REDUX_CONTEXT_KEY];
|
|
21
|
-
if (isNew) {
|
|
22
|
-
globalObj[REPLYKE_REDUX_CONTEXT_KEY] = createContext(null);
|
|
23
|
-
}
|
|
24
|
-
// Debug logging - remove after debugging
|
|
25
|
-
if (typeof window !== "undefined") {
|
|
26
|
-
console.log("[ReplykeReduxContext] getOrCreate called:", {
|
|
27
|
-
isNew: isNew,
|
|
28
|
-
contextId: (_b = (_a = globalObj[REPLYKE_REDUX_CONTEXT_KEY]) === null || _a === void 0 ? void 0 : _a._currentValue2) !== null && _b !== void 0 ? _b : "N/A",
|
|
29
|
-
globalObjType: globalObj === window ? "window" : globalObj === globalThis ? "globalThis" : "other",
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return globalObj[REPLYKE_REDUX_CONTEXT_KEY];
|
|
33
|
-
}
|
|
34
4
|
// Custom context for Replyke's Redux store
|
|
35
|
-
//
|
|
36
|
-
|
|
5
|
+
// This isolates Replyke's Redux from any external Redux stores users may have
|
|
6
|
+
// Note: react-redux must be a peer dependency to ensure a single instance
|
|
7
|
+
export var ReplykeReduxContext = createContext(null);
|
|
37
8
|
// Custom hooks bound to Replyke's context (not the default React-Redux context)
|
|
38
9
|
// These ensure Replyke's internal state management doesn't interfere with
|
|
39
10
|
// external Redux stores
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replykeReduxContext.js","sourceRoot":"","sources":["../../../src/store/replykeReduxContext.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"replykeReduxContext.js","sourceRoot":"","sources":["../../../src/store/replykeReduxContext.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,GAEhB,MAAM,aAAa,CAAC;AAErB,2CAA2C;AAC3C,8EAA8E;AAC9E,0EAA0E;AAC1E,MAAM,CAAC,IAAM,mBAAmB,GAAG,aAAa,CAAgC,IAAI,CAAC,CAAC;AAEtF,gFAAgF;AAChF,0EAA0E;AAC1E,wBAAwB;AACxB,MAAM,CAAC,IAAM,kBAAkB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;AAC1E,MAAM,CAAC,IAAM,kBAAkB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;AAC1E,MAAM,CAAC,IAAM,eAAe,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { Action, ThunkAction } from "@reduxjs/toolkit";
|
|
2
2
|
import type { RootState } from "../rootReducer";
|
|
3
|
-
import type { store } from "../index";
|
|
4
|
-
export type AppStore = typeof store;
|
|
5
3
|
export type { RootState };
|
|
6
|
-
export type AppDispatch = AppStore['dispatch'];
|
|
7
4
|
export type AppThunk<ReturnType = void> = ThunkAction<ReturnType, RootState, unknown, Action<string>>;
|
|
8
5
|
export type TypedSelector<T> = (state: RootState) => T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replyke/core",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.53",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Replyke, maintained by Yanay Tsabary",
|
|
@@ -40,13 +40,12 @@
|
|
|
40
40
|
"dist"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@reduxjs/toolkit": "^2.0.1",
|
|
44
43
|
"axios": "^1.4.0",
|
|
45
44
|
"js-cookie": "^3.0.5",
|
|
46
|
-
"lodash": "^4.17.21"
|
|
47
|
-
"react-redux": "^9.0.4"
|
|
45
|
+
"lodash": "^4.17.21"
|
|
48
46
|
},
|
|
49
47
|
"devDependencies": {
|
|
48
|
+
"@reduxjs/toolkit": "^2.0.1",
|
|
50
49
|
"@types/js-cookie": "^3.0.6",
|
|
51
50
|
"@types/lodash": "^4.17.9",
|
|
52
51
|
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
|
@@ -56,11 +55,14 @@
|
|
|
56
55
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
57
56
|
"eslint-plugin-react-refresh": "^0.3.4",
|
|
58
57
|
"prop-types": "^15.8.1",
|
|
58
|
+
"react-redux": "^9.0.4",
|
|
59
59
|
"vite": "^4.3.9",
|
|
60
60
|
"vite-plugin-dts": "^2.3.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"
|
|
63
|
+
"@reduxjs/toolkit": "^2.0.1",
|
|
64
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
65
|
+
"react-redux": "^9.0.4"
|
|
64
66
|
},
|
|
65
67
|
"scripts": {
|
|
66
68
|
"build:esm": "tsc -p tsconfig.esm.json",
|