@zauru-sdk/redux 1.0.49 → 1.0.51

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.
Files changed (51) hide show
  1. package/dist/cjs/index.js +18 -0
  2. package/dist/{slices → cjs/slices}/agency.slice.js +8 -4
  3. package/dist/{slices → cjs/slices}/automaticNumbers.slice.js +8 -4
  4. package/dist/{slices → cjs/slices}/catalogs.slice.js +8 -4
  5. package/dist/cjs/slices/formValidation.slice.js +19 -0
  6. package/dist/cjs/slices/index.js +27 -0
  7. package/dist/{slices → cjs/slices}/profile.slice.js +8 -4
  8. package/dist/{slices → cjs/slices}/reception.slice.js +8 -4
  9. package/dist/cjs/slices/session.slice.js +16 -0
  10. package/dist/cjs/slices/tables.slice.js +20 -0
  11. package/dist/{slices → cjs/slices}/templates.slice.js +8 -4
  12. package/dist/{slices → cjs/slices}/user.slice.js +8 -4
  13. package/dist/cjs/slices/webapp-tables.slice.js +24 -0
  14. package/dist/{store.js → cjs/store.js} +46 -39
  15. package/dist/esm/index.js +18 -0
  16. package/dist/esm/slices/agency.slice.js +24 -0
  17. package/dist/esm/slices/automaticNumbers.slice.js +24 -0
  18. package/dist/esm/slices/catalogs.slice.js +65 -0
  19. package/dist/esm/slices/formValidation.slice.js +19 -0
  20. package/dist/esm/slices/index.js +27 -0
  21. package/dist/esm/slices/profile.slice.js +26 -0
  22. package/dist/esm/slices/reception.slice.js +61 -0
  23. package/dist/esm/slices/session.slice.js +16 -0
  24. package/dist/esm/slices/tables.slice.js +20 -0
  25. package/dist/esm/slices/templates.slice.js +23 -0
  26. package/dist/esm/slices/user.slice.js +42 -0
  27. package/dist/esm/slices/webapp-tables.slice.js +24 -0
  28. package/dist/esm/store.js +135 -0
  29. package/package.json +13 -11
  30. package/CHANGELOG.md +0 -184
  31. package/dist/index.js +0 -2
  32. package/dist/slices/formValidation.slice.js +0 -16
  33. package/dist/slices/index.js +0 -11
  34. package/dist/slices/session.slice.js +0 -13
  35. package/dist/slices/tables.slice.js +0 -17
  36. package/dist/slices/webapp-tables.slice.js +0 -20
  37. package/src/index.ts +0 -3
  38. package/src/slices/agency.slice.ts +0 -32
  39. package/src/slices/automaticNumbers.slice.ts +0 -41
  40. package/src/slices/catalogs.slice.ts +0 -178
  41. package/src/slices/formValidation.slice.ts +0 -32
  42. package/src/slices/index.ts +0 -11
  43. package/src/slices/profile.slice.ts +0 -49
  44. package/src/slices/reception.slice.ts +0 -118
  45. package/src/slices/session.slice.ts +0 -25
  46. package/src/slices/tables.slice.ts +0 -33
  47. package/src/slices/templates.slice.ts +0 -34
  48. package/src/slices/user.slice.ts +0 -64
  49. package/src/slices/webapp-tables.slice.ts +0 -35
  50. package/src/store.ts +0 -162
  51. package/tsconfig.json +0 -24
@@ -0,0 +1,18 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./slices/index.js"), exports);
18
+ __exportStar(require("./store.js"), exports);
@@ -1,9 +1,13 @@
1
- import { createSlice } from "@reduxjs/toolkit";
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.setLoadingAgencyProfile = exports.setAgencyProfile = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
2
6
  const initialState = {
3
7
  agencyProfile: {},
4
8
  loadingAgencyProfile: false,
5
9
  };
6
- const agencySlice = createSlice({
10
+ const agencySlice = (0, toolkit_1.createSlice)({
7
11
  name: "agency",
8
12
  initialState,
9
13
  reducers: {
@@ -16,5 +20,5 @@ const agencySlice = createSlice({
16
20
  },
17
21
  },
18
22
  });
19
- export const { setAgencyProfile, setLoadingAgencyProfile } = agencySlice.actions;
20
- export default agencySlice.reducer;
23
+ _a = agencySlice.actions, exports.setAgencyProfile = _a.setAgencyProfile, exports.setLoadingAgencyProfile = _a.setLoadingAgencyProfile;
24
+ exports.default = agencySlice.reducer;
@@ -1,9 +1,13 @@
1
- import { createSlice } from "@reduxjs/toolkit";
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.automaticNumberFetchSuccess = exports.automaticNumberFetchStart = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
2
6
  const initialState = {
3
7
  purchaseOrderIdNumber: { data: "", loading: false },
4
8
  dischargeIdNumber: { data: "NCB00000", loading: false },
5
9
  };
6
- const automaticNumbersSlice = createSlice({
10
+ const automaticNumbersSlice = (0, toolkit_1.createSlice)({
7
11
  name: "automaticNumbers",
8
12
  initialState,
9
13
  reducers: {
@@ -16,5 +20,5 @@ const automaticNumbersSlice = createSlice({
16
20
  },
17
21
  },
18
22
  });
19
- export const { automaticNumberFetchStart, automaticNumberFetchSuccess } = automaticNumbersSlice.actions;
20
- export default automaticNumbersSlice.reducer;
23
+ _a = automaticNumbersSlice.actions, exports.automaticNumberFetchStart = _a.automaticNumberFetchStart, exports.automaticNumberFetchSuccess = _a.automaticNumberFetchSuccess;
24
+ exports.default = automaticNumbersSlice.reducer;
@@ -1,4 +1,8 @@
1
- import { createSlice } from "@reduxjs/toolkit";
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.catalogsSetReFetch = exports.catalogsFetchSuccess = exports.catalogsFetchStart = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
2
6
  const createLoadingState = (initialData) => ({
3
7
  data: initialData,
4
8
  loading: false,
@@ -40,7 +44,7 @@ const initialState = {
40
44
  myAgencyLotStocks: createLoadingState([]),
41
45
  shipmentsToMyAgency: createLoadingState([]),
42
46
  };
43
- const catalogsSlice = createSlice({
47
+ const catalogsSlice = (0, toolkit_1.createSlice)({
44
48
  name: "catalogs",
45
49
  initialState,
46
50
  reducers: {
@@ -57,5 +61,5 @@ const catalogsSlice = createSlice({
57
61
  },
58
62
  },
59
63
  });
60
- export const { catalogsFetchStart, catalogsFetchSuccess, catalogsSetReFetch } = catalogsSlice.actions;
61
- export default catalogsSlice.reducer;
64
+ _a = catalogsSlice.actions, exports.catalogsFetchStart = _a.catalogsFetchStart, exports.catalogsFetchSuccess = _a.catalogsFetchSuccess, exports.catalogsSetReFetch = _a.catalogsSetReFetch;
65
+ exports.default = catalogsSlice.reducer;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setFieldError = void 0;
4
+ const toolkit_1 = require("@reduxjs/toolkit");
5
+ const initialState = {
6
+ formValidations: {},
7
+ };
8
+ const formValidationsSlice = (0, toolkit_1.createSlice)({
9
+ name: "formValidations",
10
+ initialState,
11
+ reducers: {
12
+ setFieldError: (state, action) => {
13
+ state.formValidations[action.payload.formName][action.payload.name] =
14
+ action.payload.error;
15
+ },
16
+ },
17
+ });
18
+ exports.setFieldError = formValidationsSlice.actions.setFieldError;
19
+ exports.default = formValidationsSlice.reducer;
@@ -0,0 +1,27 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./agency.slice.js"), exports);
18
+ __exportStar(require("./automaticNumbers.slice.js"), exports);
19
+ __exportStar(require("./catalogs.slice.js"), exports);
20
+ __exportStar(require("./formValidation.slice.js"), exports);
21
+ __exportStar(require("./profile.slice.js"), exports);
22
+ __exportStar(require("./reception.slice.js"), exports);
23
+ __exportStar(require("./session.slice.js"), exports);
24
+ __exportStar(require("./tables.slice.js"), exports);
25
+ __exportStar(require("./templates.slice.js"), exports);
26
+ __exportStar(require("./user.slice.js"), exports);
27
+ __exportStar(require("./webapp-tables.slice.js"), exports);
@@ -1,11 +1,15 @@
1
- import { createSlice } from "@reduxjs/toolkit";
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.profileFetchSuccess = exports.profileFetchStart = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
2
6
  const initialState = {
3
7
  userProfile: { data: {}, loading: false },
4
8
  oauthProfile: { data: {}, loading: false },
5
9
  employeeProfile: { data: {}, loading: false },
6
10
  agencyProfile: { data: {}, loading: false },
7
11
  };
8
- const profileSlice = createSlice({
12
+ const profileSlice = (0, toolkit_1.createSlice)({
9
13
  name: "profile",
10
14
  initialState,
11
15
  reducers: {
@@ -18,5 +22,5 @@ const profileSlice = createSlice({
18
22
  },
19
23
  },
20
24
  });
21
- export const { profileFetchStart, profileFetchSuccess } = profileSlice.actions;
22
- export default profileSlice.reducer;
25
+ _a = profileSlice.actions, exports.profileFetchStart = _a.profileFetchStart, exports.profileFetchSuccess = _a.profileFetchSuccess;
26
+ exports.default = profileSlice.reducer;
@@ -1,4 +1,8 @@
1
- import { createSlice } from "@reduxjs/toolkit";
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.receptionConcatToArray = exports.receptionFetchSuccess = exports.receptionFetchStart = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
2
6
  const initialState = {
3
7
  basketLots: {
4
8
  data: {},
@@ -31,7 +35,7 @@ const initialState = {
31
35
  reFetch: false,
32
36
  },
33
37
  };
34
- const receptionSlice = createSlice({
38
+ const receptionSlice = (0, toolkit_1.createSlice)({
35
39
  name: "reception",
36
40
  initialState,
37
41
  reducers: {
@@ -53,5 +57,5 @@ const receptionSlice = createSlice({
53
57
  },
54
58
  },
55
59
  });
56
- export const { receptionFetchStart, receptionFetchSuccess, receptionConcatToArray, } = receptionSlice.actions;
57
- export default receptionSlice.reducer;
60
+ _a = receptionSlice.actions, exports.receptionFetchStart = _a.receptionFetchStart, exports.receptionFetchSuccess = _a.receptionFetchSuccess, exports.receptionConcatToArray = _a.receptionConcatToArray;
61
+ exports.default = receptionSlice.reducer;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setSessionValue = void 0;
4
+ const toolkit_1 = require("@reduxjs/toolkit");
5
+ const initialState = {};
6
+ const sessionSlice = (0, toolkit_1.createSlice)({
7
+ name: "session",
8
+ initialState,
9
+ reducers: {
10
+ setSessionValue: (state, action) => {
11
+ state[action.payload.name] = action.payload.data;
12
+ },
13
+ },
14
+ });
15
+ exports.setSessionValue = sessionSlice.actions.setSessionValue;
16
+ exports.default = sessionSlice.reducer;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tableSetPage = void 0;
4
+ const toolkit_1 = require("@reduxjs/toolkit");
5
+ const initialState = {
6
+ pageTable1: 1,
7
+ pageTable2: 1,
8
+ pageTable3: 1,
9
+ };
10
+ const tableSlice = (0, toolkit_1.createSlice)({
11
+ name: "table",
12
+ initialState,
13
+ reducers: {
14
+ tableSetPage: (state, action) => {
15
+ state[action.payload.name] = action.payload.data;
16
+ },
17
+ },
18
+ });
19
+ exports.tableSetPage = tableSlice.actions.tableSetPage;
20
+ exports.default = tableSlice.reducer;
@@ -1,8 +1,12 @@
1
- import { createSlice } from "@reduxjs/toolkit";
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.templateFetchSuccess = exports.templateFetchStart = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
2
6
  const initialState = {
3
7
  receptionTemplate: { data: "", loading: false },
4
8
  };
5
- const templateSlice = createSlice({
9
+ const templateSlice = (0, toolkit_1.createSlice)({
6
10
  name: "template",
7
11
  initialState,
8
12
  reducers: {
@@ -15,5 +19,5 @@ const templateSlice = createSlice({
15
19
  },
16
20
  },
17
21
  });
18
- export const { templateFetchStart, templateFetchSuccess } = templateSlice.actions;
19
- export default templateSlice.reducer;
22
+ _a = templateSlice.actions, exports.templateFetchStart = _a.templateFetchStart, exports.templateFetchSuccess = _a.templateFetchSuccess;
23
+ exports.default = templateSlice.reducer;
@@ -1,4 +1,8 @@
1
- import { createSlice } from "@reduxjs/toolkit";
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.setLoadingUserProfile = exports.setLoadingOauthProfile = exports.setLoadingEmployeeProfile = exports.setOauthProfile = exports.setEmployeeProfile = exports.setUserProfile = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
2
6
  const initialState = {
3
7
  userProfile: {},
4
8
  loadingUserProfile: false,
@@ -7,7 +11,7 @@ const initialState = {
7
11
  employeeProfile: {},
8
12
  loadingEmployeeInfo: false,
9
13
  };
10
- const userSlice = createSlice({
14
+ const userSlice = (0, toolkit_1.createSlice)({
11
15
  name: "user",
12
16
  initialState,
13
17
  reducers: {
@@ -34,5 +38,5 @@ const userSlice = createSlice({
34
38
  },
35
39
  },
36
40
  });
37
- export const { setUserProfile, setEmployeeProfile, setOauthProfile, setLoadingEmployeeProfile, setLoadingOauthProfile, setLoadingUserProfile, } = userSlice.actions;
38
- export default userSlice.reducer;
41
+ _a = userSlice.actions, exports.setUserProfile = _a.setUserProfile, exports.setEmployeeProfile = _a.setEmployeeProfile, exports.setOauthProfile = _a.setOauthProfile, exports.setLoadingEmployeeProfile = _a.setLoadingEmployeeProfile, exports.setLoadingOauthProfile = _a.setLoadingOauthProfile, exports.setLoadingUserProfile = _a.setLoadingUserProfile;
42
+ exports.default = userSlice.reducer;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.setSpecialItems = exports.setLoadingSpecialItems = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const initialState = {
7
+ specialItems: [],
8
+ loadingSpecialItems: false,
9
+ };
10
+ const webappTablesSlice = (0, toolkit_1.createSlice)({
11
+ name: "webappTables",
12
+ initialState,
13
+ reducers: {
14
+ setLoadingSpecialItems: (state, action) => {
15
+ state.loadingSpecialItems = action.payload;
16
+ },
17
+ setSpecialItems: (state, action) => {
18
+ state.specialItems = action.payload;
19
+ state.loadingSpecialItems = false;
20
+ },
21
+ },
22
+ });
23
+ _a = webappTablesSlice.actions, exports.setLoadingSpecialItems = _a.setLoadingSpecialItems, exports.setSpecialItems = _a.setSpecialItems;
24
+ exports.default = webappTablesSlice.reducer;
@@ -1,26 +1,32 @@
1
- import { useDispatch, useSelector } from "react-redux";
2
- import { Tuple, configureStore } from "@reduxjs/toolkit";
3
- import catalogsReducer from "./slices/catalogs.slice.js";
4
- import profilesReducer from "./slices/profile.slice.js";
5
- import webappTablesReducer from "./slices/webapp-tables.slice.js";
6
- import receptionsReducer from "./slices/reception.slice.js";
7
- import sessionReducer from "./slices/session.slice.js";
8
- import templateReducer from "./slices/templates.slice.js";
9
- import automaticNumberReducer from "./slices/automaticNumbers.slice.js";
10
- import tableReducer from "./slices/tables.slice.js";
11
- import formValidationReducer from "./slices/formValidation.slice.js";
12
- export const LOCAL_STORAGE_REDUX_NAME = "___redux__state__v2";
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.useAppDispatch = exports.useAppSelector = exports.store = exports.cleanLocalStorage = exports.LOCAL_STORAGE_REDUX_NAME = void 0;
7
+ const react_redux_1 = require("react-redux");
8
+ const toolkit_1 = require("@reduxjs/toolkit");
9
+ const catalogs_slice_js_1 = __importDefault(require("./slices/catalogs.slice.js"));
10
+ const profile_slice_js_1 = __importDefault(require("./slices/profile.slice.js"));
11
+ const webapp_tables_slice_js_1 = __importDefault(require("./slices/webapp-tables.slice.js"));
12
+ const reception_slice_js_1 = __importDefault(require("./slices/reception.slice.js"));
13
+ const session_slice_js_1 = __importDefault(require("./slices/session.slice.js"));
14
+ const templates_slice_js_1 = __importDefault(require("./slices/templates.slice.js"));
15
+ const automaticNumbers_slice_js_1 = __importDefault(require("./slices/automaticNumbers.slice.js"));
16
+ const tables_slice_js_1 = __importDefault(require("./slices/tables.slice.js"));
17
+ const formValidation_slice_js_1 = __importDefault(require("./slices/formValidation.slice.js"));
18
+ exports.LOCAL_STORAGE_REDUX_NAME = "___redux__state__v2";
13
19
  const persistanceLocalStorageMiddleware = (store) => (next) => (action) => {
14
20
  const result = next(action);
15
21
  if (!(typeof document === "undefined")) {
16
- localStorage.setItem(LOCAL_STORAGE_REDUX_NAME, JSON.stringify(store.getState()));
22
+ localStorage.setItem(exports.LOCAL_STORAGE_REDUX_NAME, JSON.stringify(store.getState()));
17
23
  }
18
24
  return result;
19
25
  };
20
26
  const preloadedState = (() => {
21
27
  try {
22
28
  if (!(typeof document === "undefined")) {
23
- const savedState = localStorage.getItem(LOCAL_STORAGE_REDUX_NAME);
29
+ const savedState = localStorage.getItem(exports.LOCAL_STORAGE_REDUX_NAME);
24
30
  if (savedState) {
25
31
  return JSON.parse(savedState);
26
32
  }
@@ -30,8 +36,8 @@ const preloadedState = (() => {
30
36
  // Ignorar los errores, se utiliza el estado inicial definido en cada reducer
31
37
  }
32
38
  })();
33
- export const cleanLocalStorage = () => {
34
- const savedState = localStorage.getItem(LOCAL_STORAGE_REDUX_NAME);
39
+ const cleanLocalStorage = () => {
40
+ const savedState = localStorage.getItem(exports.LOCAL_STORAGE_REDUX_NAME);
35
41
  const state = JSON.parse(savedState ?? "{}");
36
42
  try {
37
43
  //delete all cookies
@@ -69,15 +75,15 @@ export const cleanLocalStorage = () => {
69
75
  };
70
76
  if (!(typeof document === "undefined") && Object.keys(state)?.length > 0) {
71
77
  const initialState = {
72
- catalogs: catalogsReducer(undefined, { type: "" }),
73
- profiles: profilesReducer(undefined, { type: "" }),
74
- webappTables: webappTablesReducer(undefined, { type: "" }),
75
- receptions: receptionsReducer(undefined, { type: "" }),
76
- session: sessionReducer(undefined, { type: "" }),
77
- templates: templateReducer(undefined, { type: "" }),
78
- automaticNumbers: automaticNumberReducer(undefined, { type: "" }),
79
- tables: tableReducer(undefined, { type: "" }),
80
- formValidation: formValidationReducer(undefined, { type: "" }),
78
+ catalogs: (0, catalogs_slice_js_1.default)(undefined, { type: "" }),
79
+ profiles: (0, profile_slice_js_1.default)(undefined, { type: "" }),
80
+ webappTables: (0, webapp_tables_slice_js_1.default)(undefined, { type: "" }),
81
+ receptions: (0, reception_slice_js_1.default)(undefined, { type: "" }),
82
+ session: (0, session_slice_js_1.default)(undefined, { type: "" }),
83
+ templates: (0, templates_slice_js_1.default)(undefined, { type: "" }),
84
+ automaticNumbers: (0, automaticNumbers_slice_js_1.default)(undefined, { type: "" }),
85
+ tables: (0, tables_slice_js_1.default)(undefined, { type: "" }),
86
+ formValidation: (0, formValidation_slice_js_1.default)(undefined, { type: "" }),
81
87
  };
82
88
  const newState = { ...initialState };
83
89
  for (const reducerName in whitelist) {
@@ -102,27 +108,28 @@ export const cleanLocalStorage = () => {
102
108
  }
103
109
  }
104
110
  // Guarda el nuevo estado en el almacenamiento local
105
- localStorage.setItem(LOCAL_STORAGE_REDUX_NAME, JSON.stringify(newState));
111
+ localStorage.setItem(exports.LOCAL_STORAGE_REDUX_NAME, JSON.stringify(newState));
106
112
  }
107
113
  }
108
114
  catch (e) {
109
115
  console.error("Ocurrió un error al clonar y eliminar el viejo localStorage");
110
116
  }
111
117
  };
112
- export const store = configureStore({
118
+ exports.cleanLocalStorage = cleanLocalStorage;
119
+ exports.store = (0, toolkit_1.configureStore)({
113
120
  reducer: {
114
- catalogs: catalogsReducer,
115
- profiles: profilesReducer,
116
- webappTables: webappTablesReducer,
117
- receptions: receptionsReducer,
118
- session: sessionReducer,
119
- templates: templateReducer,
120
- automaticNumbers: automaticNumberReducer,
121
- tables: tableReducer,
122
- formValidation: formValidationReducer,
121
+ catalogs: catalogs_slice_js_1.default,
122
+ profiles: profile_slice_js_1.default,
123
+ webappTables: webapp_tables_slice_js_1.default,
124
+ receptions: reception_slice_js_1.default,
125
+ session: session_slice_js_1.default,
126
+ templates: templates_slice_js_1.default,
127
+ automaticNumbers: automaticNumbers_slice_js_1.default,
128
+ tables: tables_slice_js_1.default,
129
+ formValidation: formValidation_slice_js_1.default,
123
130
  },
124
131
  preloadedState,
125
- middleware: (getDefaultMiddleware) => new Tuple(persistanceLocalStorageMiddleware),
132
+ middleware: (getDefaultMiddleware) => new toolkit_1.Tuple(persistanceLocalStorageMiddleware),
126
133
  });
127
- export const useAppSelector = useSelector;
128
- export const useAppDispatch = useDispatch;
134
+ exports.useAppSelector = react_redux_1.useSelector;
135
+ exports.useAppDispatch = react_redux_1.useDispatch;
@@ -0,0 +1,18 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./slices/index.js"), exports);
18
+ __exportStar(require("./store.js"), exports);
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.setLoadingAgencyProfile = exports.setAgencyProfile = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const initialState = {
7
+ agencyProfile: {},
8
+ loadingAgencyProfile: false,
9
+ };
10
+ const agencySlice = (0, toolkit_1.createSlice)({
11
+ name: "agency",
12
+ initialState,
13
+ reducers: {
14
+ setAgencyProfile: (state, action) => {
15
+ state.agencyProfile = action.payload;
16
+ },
17
+ setLoadingAgencyProfile: (state, action) => {
18
+ state.loadingAgencyProfile = action.payload;
19
+ state.loadingAgencyProfile = false;
20
+ },
21
+ },
22
+ });
23
+ _a = agencySlice.actions, exports.setAgencyProfile = _a.setAgencyProfile, exports.setLoadingAgencyProfile = _a.setLoadingAgencyProfile;
24
+ exports.default = agencySlice.reducer;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.automaticNumberFetchSuccess = exports.automaticNumberFetchStart = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const initialState = {
7
+ purchaseOrderIdNumber: { data: "", loading: false },
8
+ dischargeIdNumber: { data: "NCB00000", loading: false },
9
+ };
10
+ const automaticNumbersSlice = (0, toolkit_1.createSlice)({
11
+ name: "automaticNumbers",
12
+ initialState,
13
+ reducers: {
14
+ automaticNumberFetchStart: (state, action) => {
15
+ state[action.payload].loading = true;
16
+ },
17
+ automaticNumberFetchSuccess: (state, action) => {
18
+ state[action.payload.name].data = action.payload.data;
19
+ state[action.payload.name].loading = false;
20
+ },
21
+ },
22
+ });
23
+ _a = automaticNumbersSlice.actions, exports.automaticNumberFetchStart = _a.automaticNumberFetchStart, exports.automaticNumberFetchSuccess = _a.automaticNumberFetchSuccess;
24
+ exports.default = automaticNumbersSlice.reducer;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.catalogsSetReFetch = exports.catalogsFetchSuccess = exports.catalogsFetchStart = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const createLoadingState = (initialData) => ({
7
+ data: initialData,
8
+ loading: false,
9
+ reFetch: false,
10
+ });
11
+ const initialState = {
12
+ agencies: createLoadingState([]),
13
+ suggestedPrices: createLoadingState([]),
14
+ providers: createLoadingState([]),
15
+ providerCategories: createLoadingState([]),
16
+ receptionTypes: createLoadingState([]),
17
+ tiposDeMuestra: createLoadingState([]),
18
+ templates: createLoadingState([]),
19
+ shipments: createLoadingState([]),
20
+ bookings: createLoadingState([]),
21
+ motivosRechazo: createLoadingState([]),
22
+ bitacoraRechazoMasivo: createLoadingState([]),
23
+ items: createLoadingState([]),
24
+ itemsByReception: createLoadingState([]),
25
+ payees: createLoadingState([]),
26
+ payeesForLab: createLoadingState([]),
27
+ itemCategoriesForLab: createLoadingState([]),
28
+ payeeCategoriesLabPrices: createLoadingState([]),
29
+ clientCategories: createLoadingState([]),
30
+ itemsByLab: createLoadingState([]),
31
+ itemServicesByLab: createLoadingState([]),
32
+ bundlesRecipForLab: createLoadingState([]),
33
+ bundlesForLab: createLoadingState([]),
34
+ currencies: createLoadingState([]),
35
+ paymentTerms: createLoadingState([]),
36
+ employeesByLab: createLoadingState([]),
37
+ employeesByCurrentAgency: createLoadingState([]),
38
+ invoicesByLab: createLoadingState([]),
39
+ invoiceForms: createLoadingState([]),
40
+ caseForms: createLoadingState([]),
41
+ invoiceFormSubmissions: createLoadingState([]),
42
+ myCases: createLoadingState([]),
43
+ myCaseFormSubmissions: createLoadingState([]),
44
+ myAgencyLotStocks: createLoadingState([]),
45
+ shipmentsToMyAgency: createLoadingState([]),
46
+ };
47
+ const catalogsSlice = (0, toolkit_1.createSlice)({
48
+ name: "catalogs",
49
+ initialState,
50
+ reducers: {
51
+ catalogsSetReFetch: (state, action) => {
52
+ state[action.payload].reFetch = true;
53
+ },
54
+ catalogsFetchStart: (state, action) => {
55
+ state[action.payload].loading = true;
56
+ },
57
+ catalogsFetchSuccess: (state, action) => {
58
+ state[action.payload.name].data = action.payload.data;
59
+ state[action.payload.name].loading = false;
60
+ state[action.payload.name].reFetch = false;
61
+ },
62
+ },
63
+ });
64
+ _a = catalogsSlice.actions, exports.catalogsFetchStart = _a.catalogsFetchStart, exports.catalogsFetchSuccess = _a.catalogsFetchSuccess, exports.catalogsSetReFetch = _a.catalogsSetReFetch;
65
+ exports.default = catalogsSlice.reducer;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setFieldError = void 0;
4
+ const toolkit_1 = require("@reduxjs/toolkit");
5
+ const initialState = {
6
+ formValidations: {},
7
+ };
8
+ const formValidationsSlice = (0, toolkit_1.createSlice)({
9
+ name: "formValidations",
10
+ initialState,
11
+ reducers: {
12
+ setFieldError: (state, action) => {
13
+ state.formValidations[action.payload.formName][action.payload.name] =
14
+ action.payload.error;
15
+ },
16
+ },
17
+ });
18
+ exports.setFieldError = formValidationsSlice.actions.setFieldError;
19
+ exports.default = formValidationsSlice.reducer;
@@ -0,0 +1,27 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./agency.slice.js"), exports);
18
+ __exportStar(require("./automaticNumbers.slice.js"), exports);
19
+ __exportStar(require("./catalogs.slice.js"), exports);
20
+ __exportStar(require("./formValidation.slice.js"), exports);
21
+ __exportStar(require("./profile.slice.js"), exports);
22
+ __exportStar(require("./reception.slice.js"), exports);
23
+ __exportStar(require("./session.slice.js"), exports);
24
+ __exportStar(require("./tables.slice.js"), exports);
25
+ __exportStar(require("./templates.slice.js"), exports);
26
+ __exportStar(require("./user.slice.js"), exports);
27
+ __exportStar(require("./webapp-tables.slice.js"), exports);