@open-tender/cloud 0.5.11 → 0.5.12
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.
|
@@ -6,6 +6,7 @@ const toolkit_1 = require("@reduxjs/toolkit");
|
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
const types_2 = require("@open-tender/types");
|
|
8
8
|
const account_1 = require("./account");
|
|
9
|
+
const notifications_1 = require("../notifications");
|
|
9
10
|
const initialState = {
|
|
10
11
|
entities: [],
|
|
11
12
|
data: null,
|
|
@@ -31,7 +32,7 @@ exports.fetchPointsShop = (0, toolkit_1.createAsyncThunk)(PointsShopActionType.F
|
|
|
31
32
|
return rejectWithValue(err);
|
|
32
33
|
}
|
|
33
34
|
}));
|
|
34
|
-
exports.exchangePointsShopReward = (0, toolkit_1.createAsyncThunk)(PointsShopActionType.ExchangePointsShopReward, (rewardId, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
exports.exchangePointsShopReward = (0, toolkit_1.createAsyncThunk)(PointsShopActionType.ExchangePointsShopReward, (rewardId, { getState, dispatch, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
36
|
try {
|
|
36
37
|
const { api } = getState().config;
|
|
37
38
|
if (!api)
|
|
@@ -40,6 +41,7 @@ exports.exchangePointsShopReward = (0, toolkit_1.createAsyncThunk)(PointsShopAct
|
|
|
40
41
|
if (!token)
|
|
41
42
|
throw new Error(types_2.MISSING_CUSTOMER);
|
|
42
43
|
yield api.postPointsShopReward(token, rewardId);
|
|
44
|
+
dispatch((0, notifications_1.showNotification)('Reward successfully redeemed!'));
|
|
43
45
|
return yield api.getPointsShop(token);
|
|
44
46
|
}
|
|
45
47
|
catch (err) {
|
|
@@ -6,6 +6,7 @@ const toolkit_1 = require("@reduxjs/toolkit");
|
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
const types_2 = require("@open-tender/types");
|
|
8
8
|
const account_1 = require("./account");
|
|
9
|
+
const notifications_1 = require("../notifications");
|
|
9
10
|
const initialState = {
|
|
10
11
|
entities: [],
|
|
11
12
|
data: null,
|
|
@@ -31,7 +32,7 @@ exports.fetchTplsPointsShop = (0, toolkit_1.createAsyncThunk)(TplsPointsShopActi
|
|
|
31
32
|
return rejectWithValue(err);
|
|
32
33
|
}
|
|
33
34
|
}));
|
|
34
|
-
exports.exchangeTplsPointsShopReward = (0, toolkit_1.createAsyncThunk)(TplsPointsShopActionType.ExchangeTplsPointsShopReward, (rewardId, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
exports.exchangeTplsPointsShopReward = (0, toolkit_1.createAsyncThunk)(TplsPointsShopActionType.ExchangeTplsPointsShopReward, (rewardId, { getState, dispatch, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
36
|
try {
|
|
36
37
|
const { api } = getState().config;
|
|
37
38
|
if (!api)
|
|
@@ -40,6 +41,7 @@ exports.exchangeTplsPointsShopReward = (0, toolkit_1.createAsyncThunk)(TplsPoint
|
|
|
40
41
|
if (!token)
|
|
41
42
|
throw new Error(types_2.MISSING_CUSTOMER);
|
|
42
43
|
const data = yield api.postTplsPointsShopReward(token, rewardId);
|
|
44
|
+
dispatch((0, notifications_1.showNotification)('Reward successfully redeemed!'));
|
|
43
45
|
const entities = yield api.getTplsPointsShop(token);
|
|
44
46
|
return { data, entities };
|
|
45
47
|
}
|
|
@@ -3,6 +3,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
3
3
|
import { ReducerType } from '../types';
|
|
4
4
|
import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
5
5
|
import { selectToken } from './account';
|
|
6
|
+
import { showNotification } from '../notifications';
|
|
6
7
|
const initialState = {
|
|
7
8
|
entities: [],
|
|
8
9
|
data: null,
|
|
@@ -28,7 +29,7 @@ export const fetchPointsShop = createAsyncThunk(PointsShopActionType.FetchPoints
|
|
|
28
29
|
return rejectWithValue(err);
|
|
29
30
|
}
|
|
30
31
|
}));
|
|
31
|
-
export const exchangePointsShopReward = createAsyncThunk(PointsShopActionType.ExchangePointsShopReward, (rewardId, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
export const exchangePointsShopReward = createAsyncThunk(PointsShopActionType.ExchangePointsShopReward, (rewardId, { getState, dispatch, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
33
|
try {
|
|
33
34
|
const { api } = getState().config;
|
|
34
35
|
if (!api)
|
|
@@ -37,6 +38,7 @@ export const exchangePointsShopReward = createAsyncThunk(PointsShopActionType.Ex
|
|
|
37
38
|
if (!token)
|
|
38
39
|
throw new Error(MISSING_CUSTOMER);
|
|
39
40
|
yield api.postPointsShopReward(token, rewardId);
|
|
41
|
+
dispatch(showNotification('Reward successfully redeemed!'));
|
|
40
42
|
return yield api.getPointsShop(token);
|
|
41
43
|
}
|
|
42
44
|
catch (err) {
|
|
@@ -3,6 +3,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
3
3
|
import { ReducerType } from '../types';
|
|
4
4
|
import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
5
5
|
import { selectToken } from './account';
|
|
6
|
+
import { showNotification } from '../notifications';
|
|
6
7
|
const initialState = {
|
|
7
8
|
entities: [],
|
|
8
9
|
data: null,
|
|
@@ -28,7 +29,7 @@ export const fetchTplsPointsShop = createAsyncThunk(TplsPointsShopActionType.Fet
|
|
|
28
29
|
return rejectWithValue(err);
|
|
29
30
|
}
|
|
30
31
|
}));
|
|
31
|
-
export const exchangeTplsPointsShopReward = createAsyncThunk(TplsPointsShopActionType.ExchangeTplsPointsShopReward, (rewardId, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
export const exchangeTplsPointsShopReward = createAsyncThunk(TplsPointsShopActionType.ExchangeTplsPointsShopReward, (rewardId, { getState, dispatch, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
33
|
try {
|
|
33
34
|
const { api } = getState().config;
|
|
34
35
|
if (!api)
|
|
@@ -37,6 +38,7 @@ export const exchangeTplsPointsShopReward = createAsyncThunk(TplsPointsShopActio
|
|
|
37
38
|
if (!token)
|
|
38
39
|
throw new Error(MISSING_CUSTOMER);
|
|
39
40
|
const data = yield api.postTplsPointsShopReward(token, rewardId);
|
|
41
|
+
dispatch(showNotification('Reward successfully redeemed!'));
|
|
40
42
|
const entities = yield api.getTplsPointsShop(token);
|
|
41
43
|
return { data, entities };
|
|
42
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
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",
|