@frontegg/redux-store 6.4.0 → 6.5.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 v6.4.0
1
+ /** @license Frontegg v6.5.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/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.4.0
1
+ /** @license Frontegg v6.5.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.
@@ -16,7 +16,7 @@ var _toolkit = require("@reduxjs/toolkit");
16
16
  var _VendorState = require("./VendorState");
17
17
 
18
18
  const initialState = {
19
- whiteLabelMode: false
19
+ loading: false
20
20
  };
21
21
  exports.initialState = initialState;
22
22
  const {
@@ -16,14 +16,22 @@ var _reducer = require("./reducer");
16
16
  var _utils = require("../auth/utils");
17
17
 
18
18
  function* loadVendorPublicInfo() {
19
+ yield (0, _effects.put)(_reducer.actions.setVendorState({
20
+ loading: true
21
+ }));
22
+
19
23
  try {
20
24
  const {
21
25
  whiteLabelMode = false
22
26
  } = yield _restApi.api.vendor.getVendorPublicInfo();
23
27
  yield (0, _effects.put)(_reducer.actions.setVendorState({
24
- whiteLabelMode
28
+ whiteLabelMode,
29
+ loading: false
25
30
  }));
26
31
  } catch (e) {
32
+ yield (0, _effects.put)(_reducer.actions.setVendorState({
33
+ loading: false
34
+ }));
27
35
  console.error('failed to getVendorPublicInfo - ', e);
28
36
  }
29
37
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "6.4.0",
3
+ "version": "6.5.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
- "@frontegg/rest-api": "3.0.24",
9
+ "@frontegg/rest-api": "3.0.25",
10
10
  "@reduxjs/toolkit": "^1.8.5",
11
11
  "redux-saga": "^1.2.1",
12
12
  "uuid": "^8.3.2"
@@ -2,7 +2,8 @@ import { VendorState } from '../interfaces';
2
2
  import { PayloadAction } from '@reduxjs/toolkit';
3
3
  declare const reducers: {
4
4
  setVendorState: (state: VendorState, { payload }: PayloadAction<Partial<VendorState>>) => {
5
- whiteLabelMode: boolean;
5
+ whiteLabelMode?: boolean | undefined;
6
+ loading: boolean;
6
7
  };
7
8
  };
8
9
  declare const actions: {
@@ -1,3 +1,4 @@
1
1
  export interface VendorState {
2
- whiteLabelMode: boolean;
2
+ whiteLabelMode?: boolean;
3
+ loading: boolean;
3
4
  }
package/vendor/reducer.js CHANGED
@@ -3,7 +3,7 @@ import { vendorStoreName } from '../constants';
3
3
  import { createSlice } from '@reduxjs/toolkit';
4
4
  import { vendorActions, vendorReducers } from './VendorState';
5
5
  export const initialState = {
6
- whiteLabelMode: false
6
+ loading: false
7
7
  };
8
8
  const {
9
9
  reducer,
package/vendor/saga.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export declare function loadVendorPublicInfo(): Generator<Promise<import("@frontegg/rest-api").IVendorPublicInfoResponse> | import("redux-saga/effects").PutEffect<{
1
+ export declare function loadVendorPublicInfo(): Generator<import("redux-saga/effects").PutEffect<{
2
2
  payload: Partial<import("./interfaces").VendorState>;
3
3
  type: string;
4
- }>, void, {
4
+ }> | Promise<import("@frontegg/rest-api").IVendorPublicInfoResponse>, void, {
5
5
  whiteLabelMode?: false | undefined;
6
6
  }>;
7
7
  export declare function vendorSagasMock(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
package/vendor/saga.js CHANGED
@@ -3,14 +3,22 @@ import { api } from '@frontegg/rest-api';
3
3
  import { actions } from './reducer';
4
4
  import { delay } from '../auth/utils';
5
5
  export function* loadVendorPublicInfo() {
6
+ yield put(actions.setVendorState({
7
+ loading: true
8
+ }));
9
+
6
10
  try {
7
11
  const {
8
12
  whiteLabelMode = false
9
13
  } = yield api.vendor.getVendorPublicInfo();
10
14
  yield put(actions.setVendorState({
11
- whiteLabelMode
15
+ whiteLabelMode,
16
+ loading: false
12
17
  }));
13
18
  } catch (e) {
19
+ yield put(actions.setVendorState({
20
+ loading: false
21
+ }));
14
22
  console.error('failed to getVendorPublicInfo - ', e);
15
23
  }
16
24
  }