@open-tender/cloud 0.4.10 → 0.4.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.
|
@@ -160,7 +160,7 @@ declare class OpenTenderAPI {
|
|
|
160
160
|
getCustomerLoyaltyV2(token: string): Promise<unknown>;
|
|
161
161
|
getCustomerThanx(token: string): Promise<unknown>;
|
|
162
162
|
getThanxCardSignature(token: string, acct: string): Promise<unknown>;
|
|
163
|
-
postCustomerTplsVerify(): Promise<unknown>;
|
|
163
|
+
postCustomerTplsVerify(token: string): Promise<unknown>;
|
|
164
164
|
getCustomerTpls(token: string): Promise<unknown>;
|
|
165
165
|
getCustomerTplsHistory(token: string): Promise<unknown>;
|
|
166
166
|
getCustomerHouseAccounts(token: string): Promise<unknown>;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -696,8 +696,8 @@ class OpenTenderAPI {
|
|
|
696
696
|
getThanxCardSignature(token, acct) {
|
|
697
697
|
return this.request(`/customer/thanx-card-signature?acct=${acct}`, 'GET', null, null, token);
|
|
698
698
|
}
|
|
699
|
-
postCustomerTplsVerify() {
|
|
700
|
-
return this.request(`/customer/tpls/email-verify`, 'POST',
|
|
699
|
+
postCustomerTplsVerify(token) {
|
|
700
|
+
return this.request(`/customer/tpls/email-verify`, 'POST', null, null, token);
|
|
701
701
|
}
|
|
702
702
|
getCustomerTpls(token) {
|
|
703
703
|
return this.request(`/customer/tpls`, 'GET', null, null, token);
|
|
@@ -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
|
tpls: null,
|
|
11
12
|
error: null,
|
|
@@ -30,10 +31,15 @@ exports.fetchCustomerTpls = (0, toolkit_1.createAsyncThunk)(CustomerTplsActionTy
|
|
|
30
31
|
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
31
32
|
}
|
|
32
33
|
}));
|
|
33
|
-
exports.verifyCustomerTpls = (0, toolkit_1.createAsyncThunk)(CustomerTplsActionType.VerifyCustomerTpls, (_, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
exports.verifyCustomerTpls = (0, toolkit_1.createAsyncThunk)(CustomerTplsActionType.VerifyCustomerTpls, (_, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
34
35
|
try {
|
|
35
36
|
const api = getState().config.api;
|
|
36
|
-
|
|
37
|
+
const token = (0, account_1.selectToken)(getState());
|
|
38
|
+
if (!token)
|
|
39
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
40
|
+
yield api.postCustomerTplsVerify(token);
|
|
41
|
+
dispatch((0, notifications_1.showNotification)('Verification email sent!'));
|
|
42
|
+
return;
|
|
37
43
|
}
|
|
38
44
|
catch (err) {
|
|
39
45
|
return rejectWithValue(err);
|
|
@@ -160,7 +160,7 @@ declare class OpenTenderAPI {
|
|
|
160
160
|
getCustomerLoyaltyV2(token: string): Promise<unknown>;
|
|
161
161
|
getCustomerThanx(token: string): Promise<unknown>;
|
|
162
162
|
getThanxCardSignature(token: string, acct: string): Promise<unknown>;
|
|
163
|
-
postCustomerTplsVerify(): Promise<unknown>;
|
|
163
|
+
postCustomerTplsVerify(token: string): Promise<unknown>;
|
|
164
164
|
getCustomerTpls(token: string): Promise<unknown>;
|
|
165
165
|
getCustomerTplsHistory(token: string): Promise<unknown>;
|
|
166
166
|
getCustomerHouseAccounts(token: string): Promise<unknown>;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -694,8 +694,8 @@ class OpenTenderAPI {
|
|
|
694
694
|
getThanxCardSignature(token, acct) {
|
|
695
695
|
return this.request(`/customer/thanx-card-signature?acct=${acct}`, 'GET', null, null, token);
|
|
696
696
|
}
|
|
697
|
-
postCustomerTplsVerify() {
|
|
698
|
-
return this.request(`/customer/tpls/email-verify`, 'POST',
|
|
697
|
+
postCustomerTplsVerify(token) {
|
|
698
|
+
return this.request(`/customer/tpls/email-verify`, 'POST', null, null, token);
|
|
699
699
|
}
|
|
700
700
|
getCustomerTpls(token) {
|
|
701
701
|
return this.request(`/customer/tpls`, 'GET', null, null, token);
|
|
@@ -3,6 +3,7 @@ import { createAsyncThunk, createSelector, createSlice } from '@reduxjs/toolkit'
|
|
|
3
3
|
import { ReducerType } from '../types';
|
|
4
4
|
import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
5
5
|
import { checkAuth, selectToken } from './account';
|
|
6
|
+
import { showNotification } from '../notifications';
|
|
6
7
|
const initialState = {
|
|
7
8
|
tpls: null,
|
|
8
9
|
error: null,
|
|
@@ -27,10 +28,15 @@ export const fetchCustomerTpls = createAsyncThunk(CustomerTplsActionType.FetchCu
|
|
|
27
28
|
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
28
29
|
}
|
|
29
30
|
}));
|
|
30
|
-
export const verifyCustomerTpls = createAsyncThunk(CustomerTplsActionType.VerifyCustomerTpls, (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
export const verifyCustomerTpls = createAsyncThunk(CustomerTplsActionType.VerifyCustomerTpls, (_, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
32
|
try {
|
|
32
33
|
const api = getState().config.api;
|
|
33
|
-
|
|
34
|
+
const token = selectToken(getState());
|
|
35
|
+
if (!token)
|
|
36
|
+
throw new Error(MISSING_CUSTOMER);
|
|
37
|
+
yield api.postCustomerTplsVerify(token);
|
|
38
|
+
dispatch(showNotification('Verification email sent!'));
|
|
39
|
+
return;
|
|
34
40
|
}
|
|
35
41
|
catch (err) {
|
|
36
42
|
return rejectWithValue(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.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",
|