@frontegg/redux-store 7.11.0 → 7.12.0

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.11.0
1
+ /** @license Frontegg v7.12.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/interfaces.d.ts CHANGED
@@ -29,6 +29,17 @@ export interface FronteggStore {
29
29
  store: FronteggState;
30
30
  actions: FronteggActions;
31
31
  stateActions: FronteggStateActions;
32
+ /**
33
+ * Using redux store subscribe causes unpredictable callback calls: https://redux.js.org/api/store#subscribelistener
34
+ *
35
+ * This function aim to prevent unnecessary update by calling the callback with the updated frontegg state only on state reference change.
36
+ * This function protect from redux unnecessary updates by reference comparison
37
+ * Developed for vanilla js SDK
38
+ *
39
+ * @param callback called with the updated frontegg state for every store refresh
40
+ * @returns redux unsubscribe function
41
+ */
42
+ subscribeStateChanged: (callback: (state: FronteggState) => void) => () => void;
32
43
  }
33
44
  export interface RootState {
34
45
  appName: string;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.11.0
1
+ /** @license Frontegg v7.12.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -180,6 +180,7 @@ const createStore = options => {
180
180
  },
181
181
  getState: () => store,
182
182
  subscribe: callback => (0, _valtio.subscribe)(store, callback),
183
+ subscribeStateChanged: callback => (0, _valtio.subscribe)(store, () => callback(store)),
183
184
  store,
184
185
  actions,
185
186
  stateActions
@@ -224,6 +225,7 @@ const createStore = options => {
224
225
  },
225
226
  getState: () => store,
226
227
  subscribe: callback => (0, _valtio.subscribe)(store, callback),
228
+ subscribeStateChanged: callback => (0, _valtio.subscribe)(store, () => callback(store)),
227
229
  store,
228
230
  actions,
229
231
  stateActions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "7.11.0",
3
+ "version": "7.12.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
@@ -9,9 +9,9 @@
9
9
  "@frontegg/entitlements-javascript-commons": "1.1.2",
10
10
  "@frontegg/rest-api": "3.2.1",
11
11
  "fast-deep-equal": "3.1.3",
12
+ "get-value": "^3.0.1",
12
13
  "proxy-compare": "^3.0.0",
13
14
  "set-value": "^4.1.0",
14
- "get-value": "^3.0.1",
15
15
  "uuid": "^10.0.0"
16
16
  },
17
17
  "sideEffects": false,
package/toolkit/store.js CHANGED
@@ -146,6 +146,7 @@ export const createStore = options => {
146
146
  },
147
147
  getState: () => store,
148
148
  subscribe: callback => subscribe(store, callback),
149
+ subscribeStateChanged: callback => subscribe(store, () => callback(store)),
149
150
  store,
150
151
  actions,
151
152
  stateActions
@@ -190,6 +191,7 @@ export const createStore = options => {
190
191
  },
191
192
  getState: () => store,
192
193
  subscribe: callback => subscribe(store, callback),
194
+ subscribeStateChanged: callback => subscribe(store, () => callback(store)),
193
195
  store,
194
196
  actions,
195
197
  stateActions