@replyke/core 7.0.0-beta.49 → 7.0.0-beta.50

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.
@@ -1,5 +1,6 @@
1
+ import { Context } from "react";
1
2
  import { ReactReduxContextValue } from "react-redux";
2
- export declare const ReplykeReduxContext: import("react").Context<ReactReduxContextValue<any, import("@reduxjs/toolkit").UnknownAction> | null>;
3
+ export declare const ReplykeReduxContext: Context<ReactReduxContextValue<any, import("@reduxjs/toolkit").UnknownAction> | null>;
3
4
  export declare const useReplykeDispatch: import("react-redux").UseDispatch<import("@reduxjs/toolkit").Dispatch<import("@reduxjs/toolkit").UnknownAction>>;
4
5
  export declare const useReplykeSelector: import("react-redux").UseSelector<unknown>;
5
6
  export declare const useReplykeStore: import("react-redux").UseStore<import("@reduxjs/toolkit").Store<any, import("@reduxjs/toolkit").UnknownAction, unknown>>;
@@ -3,9 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useReplykeStore = exports.useReplykeSelector = exports.useReplykeDispatch = exports.ReplykeReduxContext = void 0;
4
4
  var react_1 = require("react");
5
5
  var react_redux_1 = require("react-redux");
6
+ // Global key for singleton context
7
+ var REPLYKE_REDUX_CONTEXT_KEY = "__REPLYKE_REDUX_CONTEXT__";
8
+ /**
9
+ * Get or create the Replyke Redux context as a singleton.
10
+ * This prevents duplicate context instances when the module is loaded
11
+ * multiple times (e.g., CJS and ESM builds in Next.js).
12
+ */
13
+ function getOrCreateReplykeReduxContext() {
14
+ var globalObj = (typeof globalThis !== "undefined"
15
+ ? globalThis
16
+ : typeof window !== "undefined"
17
+ ? window
18
+ : typeof global !== "undefined"
19
+ ? global
20
+ : {});
21
+ if (!globalObj[REPLYKE_REDUX_CONTEXT_KEY]) {
22
+ globalObj[REPLYKE_REDUX_CONTEXT_KEY] = (0, react_1.createContext)(null);
23
+ }
24
+ return globalObj[REPLYKE_REDUX_CONTEXT_KEY];
25
+ }
6
26
  // Custom context for Replyke's Redux store
7
- // This isolates Replyke's Redux from any external Redux stores users may have
8
- exports.ReplykeReduxContext = (0, react_1.createContext)(null);
27
+ // Uses singleton pattern to prevent duplication across CJS/ESM module boundaries
28
+ exports.ReplykeReduxContext = getOrCreateReplykeReduxContext();
9
29
  // Custom hooks bound to Replyke's context (not the default React-Redux context)
10
30
  // These ensure Replyke's internal state management doesn't interfere with
11
31
  // external Redux stores
@@ -1 +1 @@
1
- {"version":3,"file":"replykeReduxContext.js","sourceRoot":"","sources":["../../../src/store/replykeReduxContext.ts"],"names":[],"mappings":";;;AAAA,+BAAsC;AACtC,2CAKqB;AAErB,2CAA2C;AAC3C,8EAA8E;AACjE,QAAA,mBAAmB,GAAG,IAAA,qBAAa,EAC9C,IAAI,CACL,CAAC;AAEF,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
+ {"version":3,"file":"replykeReduxContext.js","sourceRoot":"","sources":["../../../src/store/replykeReduxContext.ts"],"names":[],"mappings":";;;AAAA,+BAA+C;AAC/C,2CAKqB;AAErB,mCAAmC;AACnC,IAAM,yBAAyB,GAAG,2BAA2B,CAAC;AAO9D;;;;GAIG;AACH,SAAS,8BAA8B;IACrC,IAAM,SAAS,GAAG,CAChB,OAAO,UAAU,KAAK,WAAW;QAC/B,CAAC,CAAC,UAAU;QACZ,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW;YAC7B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW;gBAC7B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,EAAE,CACiB,CAAC;IAE9B,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,EAAE,CAAC;QAC1C,SAAS,CAAC,yBAAyB,CAAC,GAAG,IAAA,qBAAa,EAAgC,IAAI,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,SAAS,CAAC,yBAAyB,CAAC,CAAC;AAC9C,CAAC;AAED,2CAA2C;AAC3C,iFAAiF;AACpE,QAAA,mBAAmB,GAAG,8BAA8B,EAAE,CAAC;AAEpE,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,5 +1,6 @@
1
+ import { Context } from "react";
1
2
  import { ReactReduxContextValue } from "react-redux";
2
- export declare const ReplykeReduxContext: import("react").Context<ReactReduxContextValue<any, import("@reduxjs/toolkit").UnknownAction> | null>;
3
+ export declare const ReplykeReduxContext: Context<ReactReduxContextValue<any, import("@reduxjs/toolkit").UnknownAction> | null>;
3
4
  export declare const useReplykeDispatch: import("react-redux").UseDispatch<import("@reduxjs/toolkit").Dispatch<import("@reduxjs/toolkit").UnknownAction>>;
4
5
  export declare const useReplykeSelector: import("react-redux").UseSelector<unknown>;
5
6
  export declare const useReplykeStore: import("react-redux").UseStore<import("@reduxjs/toolkit").Store<any, import("@reduxjs/toolkit").UnknownAction, unknown>>;
@@ -1,8 +1,28 @@
1
1
  import { createContext } from "react";
2
2
  import { createDispatchHook, createSelectorHook, createStoreHook, } from "react-redux";
3
+ // Global key for singleton context
4
+ var REPLYKE_REDUX_CONTEXT_KEY = "__REPLYKE_REDUX_CONTEXT__";
5
+ /**
6
+ * Get or create the Replyke Redux context as a singleton.
7
+ * This prevents duplicate context instances when the module is loaded
8
+ * multiple times (e.g., CJS and ESM builds in Next.js).
9
+ */
10
+ function getOrCreateReplykeReduxContext() {
11
+ var globalObj = (typeof globalThis !== "undefined"
12
+ ? globalThis
13
+ : typeof window !== "undefined"
14
+ ? window
15
+ : typeof global !== "undefined"
16
+ ? global
17
+ : {});
18
+ if (!globalObj[REPLYKE_REDUX_CONTEXT_KEY]) {
19
+ globalObj[REPLYKE_REDUX_CONTEXT_KEY] = createContext(null);
20
+ }
21
+ return globalObj[REPLYKE_REDUX_CONTEXT_KEY];
22
+ }
3
23
  // Custom context for Replyke's Redux store
4
- // This isolates Replyke's Redux from any external Redux stores users may have
5
- export var ReplykeReduxContext = createContext(null);
24
+ // Uses singleton pattern to prevent duplication across CJS/ESM module boundaries
25
+ export var ReplykeReduxContext = getOrCreateReplykeReduxContext();
6
26
  // Custom hooks bound to Replyke's context (not the default React-Redux context)
7
27
  // These ensure Replyke's internal state management doesn't interfere with
8
28
  // external Redux stores
@@ -1 +1 @@
1
- {"version":3,"file":"replykeReduxContext.js","sourceRoot":"","sources":["../../../src/store/replykeReduxContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,GAEhB,MAAM,aAAa,CAAC;AAErB,2CAA2C;AAC3C,8EAA8E;AAC9E,MAAM,CAAC,IAAM,mBAAmB,GAAG,aAAa,CAC9C,IAAI,CACL,CAAC;AAEF,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
+ {"version":3,"file":"replykeReduxContext.js","sourceRoot":"","sources":["../../../src/store/replykeReduxContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAW,MAAM,OAAO,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,GAEhB,MAAM,aAAa,CAAC;AAErB,mCAAmC;AACnC,IAAM,yBAAyB,GAAG,2BAA2B,CAAC;AAO9D;;;;GAIG;AACH,SAAS,8BAA8B;IACrC,IAAM,SAAS,GAAG,CAChB,OAAO,UAAU,KAAK,WAAW;QAC/B,CAAC,CAAC,UAAU;QACZ,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW;YAC7B,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW;gBAC7B,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,EAAE,CACiB,CAAC;IAE9B,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,EAAE,CAAC;QAC1C,SAAS,CAAC,yBAAyB,CAAC,GAAG,aAAa,CAAgC,IAAI,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,SAAS,CAAC,yBAAyB,CAAC,CAAC;AAC9C,CAAC;AAED,2CAA2C;AAC3C,iFAAiF;AACjF,MAAM,CAAC,IAAM,mBAAmB,GAAG,8BAA8B,EAAE,CAAC;AAEpE,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replyke/core",
3
- "version": "7.0.0-beta.49",
3
+ "version": "7.0.0-beta.50",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "author": "Replyke, maintained by Yanay Tsabary",