@open-tender/cloud 0.1.109 → 0.1.111
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/dist/cjs/services/api.d.ts +2 -2
- package/dist/cjs/services/api.js +1 -1
- package/dist/cjs/slices/oneTimePasscode.d.ts +17 -3
- package/dist/cjs/slices/oneTimePasscode.js +28 -2
- package/dist/esm/services/api.d.ts +2 -2
- package/dist/esm/services/api.js +1 -1
- package/dist/esm/slices/oneTimePasscode.d.ts +17 -3
- package/dist/esm/slices/oneTimePasscode.js +27 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Auth, ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrdersExpanded,
|
|
1
|
+
import { Auth, ConfigApp, Customer, CustomerCreate, CustomerSignIn, GroupOrder, GroupOrdersExpanded, OrderType, RevenueCenterType, ServiceType, TPLSTerms, Weekday } from '@open-tender/types';
|
|
2
2
|
declare class OpenTenderAPI {
|
|
3
3
|
brandId?: string;
|
|
4
4
|
clientId?: string;
|
|
@@ -104,7 +104,7 @@ declare class OpenTenderAPI {
|
|
|
104
104
|
getSubscriber(email: string): Promise<unknown>;
|
|
105
105
|
postSubscriber(email: string): Promise<unknown>;
|
|
106
106
|
postSignUp(data: CustomerCreate): Promise<Customer | null | undefined>;
|
|
107
|
-
|
|
107
|
+
postCustomerSignIn(data: CustomerSignIn): Promise<void | Auth | null | undefined>;
|
|
108
108
|
postThanxLogin(email: string, origin?: string): Promise<unknown>;
|
|
109
109
|
postThanxAuth(code: string, path: string, origin?: string): Promise<unknown>;
|
|
110
110
|
postLogin(email: string, password: string): Promise<unknown>;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -504,7 +504,7 @@ class OpenTenderAPI {
|
|
|
504
504
|
postSignUp(data) {
|
|
505
505
|
return this.request(`/customer`, 'POST', data);
|
|
506
506
|
}
|
|
507
|
-
|
|
507
|
+
postCustomerSignIn(data) {
|
|
508
508
|
return this.request(`/customer/sign-in`, 'POST', data);
|
|
509
509
|
}
|
|
510
510
|
postThanxLogin(email, origin) {
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import { AppState } from '../app';
|
|
2
|
-
import {
|
|
2
|
+
import { CustomerSignIn, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
3
|
export interface OneTimePasscodeState {
|
|
4
4
|
otpSent: boolean;
|
|
5
5
|
loading: RequestStatus;
|
|
6
6
|
error: RequestError;
|
|
7
7
|
}
|
|
8
8
|
export declare enum OneTimePasscodeActionType {
|
|
9
|
-
OneTimePasscodeCustomer = "oneTimePasscode/oneTimePasscodeCustomer"
|
|
9
|
+
OneTimePasscodeCustomer = "oneTimePasscode/oneTimePasscodeCustomer",
|
|
10
|
+
SignInCustomer = "oneTimePasscode/signInCustomer"
|
|
10
11
|
}
|
|
11
12
|
export declare const sendOneTimePasscode: import("@reduxjs/toolkit").AsyncThunk<boolean, {
|
|
12
|
-
data:
|
|
13
|
+
data: CustomerSignIn;
|
|
14
|
+
callback?: (() => void) | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
state: AppState;
|
|
17
|
+
rejectValue: RequestError;
|
|
18
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
19
|
+
extra?: unknown;
|
|
20
|
+
serializedErrorType?: unknown;
|
|
21
|
+
pendingMeta?: unknown;
|
|
22
|
+
fulfilledMeta?: unknown;
|
|
23
|
+
rejectedMeta?: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const signInCustomer: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
26
|
+
data: CustomerSignIn;
|
|
13
27
|
callback?: (() => void) | undefined;
|
|
14
28
|
}, {
|
|
15
29
|
state: AppState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.oneTimePasscodeReducer = exports.selectOneTimePasscode = exports.toggleOtpSent = exports.resetOneTimePasscode = exports.sendOneTimePasscode = exports.OneTimePasscodeActionType = void 0;
|
|
4
|
+
exports.oneTimePasscodeReducer = exports.selectOneTimePasscode = exports.toggleOtpSent = exports.resetOneTimePasscode = exports.signInCustomer = exports.sendOneTimePasscode = exports.OneTimePasscodeActionType = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
7
|
const types_1 = require("./types");
|
|
@@ -14,11 +14,12 @@ const initialState = {
|
|
|
14
14
|
var OneTimePasscodeActionType;
|
|
15
15
|
(function (OneTimePasscodeActionType) {
|
|
16
16
|
OneTimePasscodeActionType["OneTimePasscodeCustomer"] = "oneTimePasscode/oneTimePasscodeCustomer";
|
|
17
|
+
OneTimePasscodeActionType["SignInCustomer"] = "oneTimePasscode/signInCustomer";
|
|
17
18
|
})(OneTimePasscodeActionType = exports.OneTimePasscodeActionType || (exports.OneTimePasscodeActionType = {}));
|
|
18
19
|
exports.sendOneTimePasscode = (0, toolkit_1.createAsyncThunk)(OneTimePasscodeActionType.OneTimePasscodeCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
19
20
|
try {
|
|
20
21
|
const api = getState().config.api;
|
|
21
|
-
const response = yield api.
|
|
22
|
+
const response = yield api.postCustomerSignIn(data);
|
|
22
23
|
if (data.one_time_passcode) {
|
|
23
24
|
dispatch((0, customer_1.setCustomerAuth)(response));
|
|
24
25
|
yield dispatch((0, customer_1.fetchCustomer)());
|
|
@@ -34,6 +35,20 @@ exports.sendOneTimePasscode = (0, toolkit_1.createAsyncThunk)(OneTimePasscodeAct
|
|
|
34
35
|
return rejectWithValue(err);
|
|
35
36
|
}
|
|
36
37
|
}));
|
|
38
|
+
exports.signInCustomer = (0, toolkit_1.createAsyncThunk)(OneTimePasscodeActionType.SignInCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
try {
|
|
40
|
+
const api = getState().config.api;
|
|
41
|
+
const response = yield api.postCustomerSignIn(data);
|
|
42
|
+
dispatch((0, customer_1.setCustomerAuth)(response));
|
|
43
|
+
yield dispatch((0, customer_1.fetchCustomer)());
|
|
44
|
+
if (callback)
|
|
45
|
+
callback();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
return rejectWithValue(err);
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
37
52
|
const oneTimePasscodeSlice = (0, toolkit_1.createSlice)({
|
|
38
53
|
name: types_1.ReducerType.OneTimePasscode,
|
|
39
54
|
initialState,
|
|
@@ -56,6 +71,17 @@ const oneTimePasscodeSlice = (0, toolkit_1.createSlice)({
|
|
|
56
71
|
.addCase(exports.sendOneTimePasscode.rejected, (state, action) => {
|
|
57
72
|
state.loading = 'idle';
|
|
58
73
|
state.error = action.payload;
|
|
74
|
+
})
|
|
75
|
+
.addCase(exports.signInCustomer.fulfilled, state => {
|
|
76
|
+
state.loading = 'idle';
|
|
77
|
+
state.error = null;
|
|
78
|
+
})
|
|
79
|
+
.addCase(exports.signInCustomer.pending, state => {
|
|
80
|
+
state.loading = 'pending';
|
|
81
|
+
})
|
|
82
|
+
.addCase(exports.signInCustomer.rejected, (state, action) => {
|
|
83
|
+
state.loading = 'idle';
|
|
84
|
+
state.error = action.payload;
|
|
59
85
|
});
|
|
60
86
|
}
|
|
61
87
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Auth, ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrdersExpanded,
|
|
1
|
+
import { Auth, ConfigApp, Customer, CustomerCreate, CustomerSignIn, GroupOrder, GroupOrdersExpanded, OrderType, RevenueCenterType, ServiceType, TPLSTerms, Weekday } from '@open-tender/types';
|
|
2
2
|
declare class OpenTenderAPI {
|
|
3
3
|
brandId?: string;
|
|
4
4
|
clientId?: string;
|
|
@@ -104,7 +104,7 @@ declare class OpenTenderAPI {
|
|
|
104
104
|
getSubscriber(email: string): Promise<unknown>;
|
|
105
105
|
postSubscriber(email: string): Promise<unknown>;
|
|
106
106
|
postSignUp(data: CustomerCreate): Promise<Customer | null | undefined>;
|
|
107
|
-
|
|
107
|
+
postCustomerSignIn(data: CustomerSignIn): Promise<void | Auth | null | undefined>;
|
|
108
108
|
postThanxLogin(email: string, origin?: string): Promise<unknown>;
|
|
109
109
|
postThanxAuth(code: string, path: string, origin?: string): Promise<unknown>;
|
|
110
110
|
postLogin(email: string, password: string): Promise<unknown>;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -502,7 +502,7 @@ class OpenTenderAPI {
|
|
|
502
502
|
postSignUp(data) {
|
|
503
503
|
return this.request(`/customer`, 'POST', data);
|
|
504
504
|
}
|
|
505
|
-
|
|
505
|
+
postCustomerSignIn(data) {
|
|
506
506
|
return this.request(`/customer/sign-in`, 'POST', data);
|
|
507
507
|
}
|
|
508
508
|
postThanxLogin(email, origin) {
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import { AppState } from '../app';
|
|
2
|
-
import {
|
|
2
|
+
import { CustomerSignIn, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
3
|
export interface OneTimePasscodeState {
|
|
4
4
|
otpSent: boolean;
|
|
5
5
|
loading: RequestStatus;
|
|
6
6
|
error: RequestError;
|
|
7
7
|
}
|
|
8
8
|
export declare enum OneTimePasscodeActionType {
|
|
9
|
-
OneTimePasscodeCustomer = "oneTimePasscode/oneTimePasscodeCustomer"
|
|
9
|
+
OneTimePasscodeCustomer = "oneTimePasscode/oneTimePasscodeCustomer",
|
|
10
|
+
SignInCustomer = "oneTimePasscode/signInCustomer"
|
|
10
11
|
}
|
|
11
12
|
export declare const sendOneTimePasscode: import("@reduxjs/toolkit").AsyncThunk<boolean, {
|
|
12
|
-
data:
|
|
13
|
+
data: CustomerSignIn;
|
|
14
|
+
callback?: (() => void) | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
state: AppState;
|
|
17
|
+
rejectValue: RequestError;
|
|
18
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
19
|
+
extra?: unknown;
|
|
20
|
+
serializedErrorType?: unknown;
|
|
21
|
+
pendingMeta?: unknown;
|
|
22
|
+
fulfilledMeta?: unknown;
|
|
23
|
+
rejectedMeta?: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const signInCustomer: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
26
|
+
data: CustomerSignIn;
|
|
13
27
|
callback?: (() => void) | undefined;
|
|
14
28
|
}, {
|
|
15
29
|
state: AppState;
|
|
@@ -10,11 +10,12 @@ const initialState = {
|
|
|
10
10
|
export var OneTimePasscodeActionType;
|
|
11
11
|
(function (OneTimePasscodeActionType) {
|
|
12
12
|
OneTimePasscodeActionType["OneTimePasscodeCustomer"] = "oneTimePasscode/oneTimePasscodeCustomer";
|
|
13
|
+
OneTimePasscodeActionType["SignInCustomer"] = "oneTimePasscode/signInCustomer";
|
|
13
14
|
})(OneTimePasscodeActionType || (OneTimePasscodeActionType = {}));
|
|
14
15
|
export const sendOneTimePasscode = createAsyncThunk(OneTimePasscodeActionType.OneTimePasscodeCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
16
|
try {
|
|
16
17
|
const api = getState().config.api;
|
|
17
|
-
const response = yield api.
|
|
18
|
+
const response = yield api.postCustomerSignIn(data);
|
|
18
19
|
if (data.one_time_passcode) {
|
|
19
20
|
dispatch(setCustomerAuth(response));
|
|
20
21
|
yield dispatch(fetchCustomer());
|
|
@@ -30,6 +31,20 @@ export const sendOneTimePasscode = createAsyncThunk(OneTimePasscodeActionType.On
|
|
|
30
31
|
return rejectWithValue(err);
|
|
31
32
|
}
|
|
32
33
|
}));
|
|
34
|
+
export const signInCustomer = createAsyncThunk(OneTimePasscodeActionType.SignInCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
try {
|
|
36
|
+
const api = getState().config.api;
|
|
37
|
+
const response = yield api.postCustomerSignIn(data);
|
|
38
|
+
dispatch(setCustomerAuth(response));
|
|
39
|
+
yield dispatch(fetchCustomer());
|
|
40
|
+
if (callback)
|
|
41
|
+
callback();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
return rejectWithValue(err);
|
|
46
|
+
}
|
|
47
|
+
}));
|
|
33
48
|
const oneTimePasscodeSlice = createSlice({
|
|
34
49
|
name: ReducerType.OneTimePasscode,
|
|
35
50
|
initialState,
|
|
@@ -52,6 +67,17 @@ const oneTimePasscodeSlice = createSlice({
|
|
|
52
67
|
.addCase(sendOneTimePasscode.rejected, (state, action) => {
|
|
53
68
|
state.loading = 'idle';
|
|
54
69
|
state.error = action.payload;
|
|
70
|
+
})
|
|
71
|
+
.addCase(signInCustomer.fulfilled, state => {
|
|
72
|
+
state.loading = 'idle';
|
|
73
|
+
state.error = null;
|
|
74
|
+
})
|
|
75
|
+
.addCase(signInCustomer.pending, state => {
|
|
76
|
+
state.loading = 'pending';
|
|
77
|
+
})
|
|
78
|
+
.addCase(signInCustomer.rejected, (state, action) => {
|
|
79
|
+
state.loading = 'idle';
|
|
80
|
+
state.error = action.payload;
|
|
55
81
|
});
|
|
56
82
|
}
|
|
57
83
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.111",
|
|
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",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"typescript": "^4.8.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@open-tender/types": "^0.2.
|
|
53
|
-
"@open-tender/utils": "^0.1.
|
|
52
|
+
"@open-tender/types": "^0.2.102",
|
|
53
|
+
"@open-tender/utils": "^0.1.171",
|
|
54
54
|
"@reduxjs/toolkit": "^1.8.5",
|
|
55
55
|
"react": "^18.2.0"
|
|
56
56
|
}
|