@fluid-topics/ft-wc-utils
Advanced tools
Comparing version 1.1.45 to 1.1.46
@@ -25,11 +25,9 @@ import { configureStore, createSlice } from "@reduxjs/toolkit"; | ||
reducer: (state, action) => { | ||
var _a; | ||
switch (action.type) { | ||
case "CLEAR_FT_REDUX_STORE": | ||
return reduxSlice.getInitialState(); | ||
case "DEFAULT_STATE_FIELDS_VALUES_SETTER": | ||
return { ...state, ...((_a = action.overwrites) !== null && _a !== void 0 ? _a : {}) }; | ||
default: | ||
return reduxSlice.reducer(state, action); | ||
if (action.type === "CLEAR_FT_REDUX_STORE") { | ||
return reduxSlice.getInitialState(); | ||
} | ||
else if (typeof action.type === "string" && action.type.startsWith("DEFAULT_VALUE_SETTER__")) { | ||
return { ...state, ...(action.overwrites) }; | ||
} | ||
return reduxSlice.reducer(state, action); | ||
} | ||
@@ -47,5 +45,5 @@ }); | ||
this.actions = new Proxy(this.reduxSlice.actions, { | ||
get: (target, p, receiver) => { | ||
get: (actions, p, receiver) => { | ||
const actionName = p; | ||
const action = target[actionName]; | ||
const action = actions[actionName]; | ||
if (action) { | ||
@@ -71,3 +69,3 @@ return (...args) => { | ||
this.reduxStore.dispatch({ | ||
type: "DEFAULT_STATE_FIELDS_VALUES_SETTER", | ||
type: "DEFAULT_VALUE_SETTER__" + Object.keys(state).join("_"), | ||
overwrites: state | ||
@@ -74,0 +72,0 @@ }); |
@@ -22,5 +22,5 @@ import { PropertyDeclaration } from "lit"; | ||
export declare function isFtReduxStore<State, CR extends SliceCaseReducers<State>, A extends Action>(o: any): o is FtReduxStore<State, CR, A>; | ||
export type DefaultSetStateFieldsValuesAction = { | ||
type: "DEFAULT_STATE_FIELDS_VALUES_SETTER"; | ||
overwrites: Record<string, any>; | ||
export type DefaultValueSetterAction<State = any> = { | ||
type: string; | ||
overwrites: Partial<State>; | ||
}; | ||
@@ -38,3 +38,3 @@ export type DefaultClearStoreAction = { | ||
} | ||
export type FtReduxStoreActions<A> = A | DefaultSetStateFieldsValuesAction | DefaultClearStoreAction; | ||
export type FtReduxStoreActions<A, State = any> = A | DefaultValueSetterAction<State> | DefaultClearStoreAction; | ||
export {}; |
{ | ||
"name": "@fluid-topics/ft-wc-utils", | ||
"version": "1.1.45", | ||
"version": "1.1.46", | ||
"description": "Internal web components tools", | ||
@@ -26,3 +26,3 @@ "author": "Fluid Topics <devtopics@antidot.net>", | ||
}, | ||
"gitHead": "6f166986bd8187f17e3d5a70f366596807be03c1" | ||
"gitHead": "023f346e70fcbd9980c41b0c7ede0c199ca699bc" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82884
1673