@open-tender/cloud 0.1.17 → 0.1.18

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.
@@ -16,7 +16,10 @@ export declare const fetchGuest: import("@reduxjs/toolkit").AsyncThunk<Partial<G
16
16
  callback?: (() => void) | undefined;
17
17
  }, {
18
18
  state: AppState;
19
- rejectValue: RequestError;
19
+ rejectValue: {
20
+ error: RequestError;
21
+ email: string;
22
+ };
20
23
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
21
24
  extra?: unknown;
22
25
  serializedErrorType?: unknown;
@@ -31,7 +34,10 @@ export declare const fetchGuestThanx: import("@reduxjs/toolkit").AsyncThunk<void
31
34
  callback?: (() => void) | null | undefined;
32
35
  }, {
33
36
  state: AppState;
34
- rejectValue: RequestError;
37
+ rejectValue: {
38
+ error: RequestError;
39
+ email: string;
40
+ };
35
41
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
36
42
  extra?: unknown;
37
43
  serializedErrorType?: unknown;
@@ -28,7 +28,8 @@ exports.fetchGuest = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchGuest,
28
28
  return response;
29
29
  }
30
30
  catch (err) {
31
- return rejectWithValue(err);
31
+ const error = { error: err, email };
32
+ return rejectWithValue(error);
32
33
  }
33
34
  }));
34
35
  exports.fetchGuestThanx = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchGuestThanx, ({ email, callback }, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
@@ -42,7 +43,8 @@ exports.fetchGuestThanx = (0, toolkit_1.createAsyncThunk)(GuestActionType.FetchG
42
43
  return { email: email };
43
44
  }
44
45
  catch (err) {
45
- return rejectWithValue(err);
46
+ const error = { error: err, email };
47
+ return rejectWithValue(error);
46
48
  }
47
49
  }));
48
50
  const guestSlice = (0, toolkit_1.createSlice)({
@@ -68,10 +70,7 @@ const guestSlice = (0, toolkit_1.createSlice)({
68
70
  state.loading = 'pending';
69
71
  })
70
72
  .addCase(exports.fetchGuest.rejected, (state, action) => {
71
- state.error = action.payload;
72
- // state.email = action.payload?.email
73
- state.loading = 'idle';
74
- state.brands = null;
73
+ return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', brands: null }), action.payload);
75
74
  })
76
75
  .addCase(exports.fetchGuestThanx.fulfilled, (state, action) => {
77
76
  return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', errors: null, showMagicLink: true }), action.payload);
@@ -80,10 +79,7 @@ const guestSlice = (0, toolkit_1.createSlice)({
80
79
  state.loading = 'pending';
81
80
  })
82
81
  .addCase(exports.fetchGuestThanx.rejected, (state, action) => {
83
- state.error = action.payload;
84
- state.loading = 'idle';
85
- state.showMagicLink = false;
86
- state.brands = null;
82
+ return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', showMagicLink: false, brands: null }), action.payload);
87
83
  });
88
84
  }
89
85
  });
@@ -16,7 +16,10 @@ export declare const fetchGuest: import("@reduxjs/toolkit").AsyncThunk<Partial<G
16
16
  callback?: (() => void) | undefined;
17
17
  }, {
18
18
  state: AppState;
19
- rejectValue: RequestError;
19
+ rejectValue: {
20
+ error: RequestError;
21
+ email: string;
22
+ };
20
23
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
21
24
  extra?: unknown;
22
25
  serializedErrorType?: unknown;
@@ -31,7 +34,10 @@ export declare const fetchGuestThanx: import("@reduxjs/toolkit").AsyncThunk<void
31
34
  callback?: (() => void) | null | undefined;
32
35
  }, {
33
36
  state: AppState;
34
- rejectValue: RequestError;
37
+ rejectValue: {
38
+ error: RequestError;
39
+ email: string;
40
+ };
35
41
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
36
42
  extra?: unknown;
37
43
  serializedErrorType?: unknown;
@@ -24,7 +24,8 @@ export const fetchGuest = createAsyncThunk(GuestActionType.FetchGuest, ({ email,
24
24
  return response;
25
25
  }
26
26
  catch (err) {
27
- return rejectWithValue(err);
27
+ const error = { error: err, email };
28
+ return rejectWithValue(error);
28
29
  }
29
30
  }));
30
31
  export const fetchGuestThanx = createAsyncThunk(GuestActionType.FetchGuestThanx, ({ email, callback }, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
@@ -38,7 +39,8 @@ export const fetchGuestThanx = createAsyncThunk(GuestActionType.FetchGuestThanx,
38
39
  return { email: email };
39
40
  }
40
41
  catch (err) {
41
- return rejectWithValue(err);
42
+ const error = { error: err, email };
43
+ return rejectWithValue(error);
42
44
  }
43
45
  }));
44
46
  const guestSlice = createSlice({
@@ -64,10 +66,7 @@ const guestSlice = createSlice({
64
66
  state.loading = 'pending';
65
67
  })
66
68
  .addCase(fetchGuest.rejected, (state, action) => {
67
- state.error = action.payload;
68
- // state.email = action.payload?.email
69
- state.loading = 'idle';
70
- state.brands = null;
69
+ return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', brands: null }), action.payload);
71
70
  })
72
71
  .addCase(fetchGuestThanx.fulfilled, (state, action) => {
73
72
  return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', errors: null, showMagicLink: true }), action.payload);
@@ -76,10 +75,7 @@ const guestSlice = createSlice({
76
75
  state.loading = 'pending';
77
76
  })
78
77
  .addCase(fetchGuestThanx.rejected, (state, action) => {
79
- state.error = action.payload;
80
- state.loading = 'idle';
81
- state.showMagicLink = false;
82
- state.brands = null;
78
+ return Object.assign(Object.assign(Object.assign({}, state), { loading: 'idle', showMagicLink: false, brands: null }), action.payload);
83
79
  });
84
80
  }
85
81
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/cloud",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",