@open-tender/cloud 0.1.10 → 0.1.11

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.
@@ -1,4 +1,4 @@
1
- import { ConfigApp, GroupOrder, GroupOrders, OrderType, RevenueCenterType, ServiceType, Weekday } from '@open-tender/types';
1
+ import { ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrders, OrderType, RevenueCenterType, ServiceType, Weekday } from '@open-tender/types';
2
2
  declare class OpenTenderAPI {
3
3
  brandId?: string;
4
4
  clientId?: string;
@@ -101,7 +101,7 @@ declare class OpenTenderAPI {
101
101
  getGuest(email: string): Promise<unknown>;
102
102
  getSubscriber(email: string): Promise<unknown>;
103
103
  postSubscriber(email: string): Promise<unknown>;
104
- postSignUp(data: any): Promise<unknown>;
104
+ postSignUp(data: CustomerCreate): Promise<Customer | null | undefined>;
105
105
  postLevelUp(data: any): Promise<unknown>;
106
106
  postThanxLogin(email: string): Promise<unknown>;
107
107
  postThanxAuth(code: string, path: string): Promise<unknown>;
@@ -1,5 +1,5 @@
1
1
  import { AppState } from '../app';
2
- import { LoginData, RequestError, RequestStatus } from '@open-tender/types';
2
+ import { Customer, CustomerCreate, RequestError, RequestStatus } from '@open-tender/types';
3
3
  export interface SignUpState {
4
4
  loading: RequestStatus;
5
5
  error: RequestError;
@@ -8,8 +8,8 @@ export declare enum SignUpActionType {
8
8
  SignUpCustomer = "signUp/signUpCustomer"
9
9
  }
10
10
  export declare const signUpCustomer: import("@reduxjs/toolkit").AsyncThunk<void, {
11
- data: Partial<LoginData>;
12
- callback?: ((data: any) => void) | undefined;
11
+ data: CustomerCreate;
12
+ callback?: ((data: Customer) => void) | undefined;
13
13
  }, {
14
14
  state: AppState;
15
15
  rejectValue: RequestError;
@@ -13,17 +13,17 @@ var SignUpActionType;
13
13
  (function (SignUpActionType) {
14
14
  SignUpActionType["SignUpCustomer"] = "signUp/signUpCustomer";
15
15
  })(SignUpActionType = exports.SignUpActionType || (exports.SignUpActionType = {}));
16
- exports.signUpCustomer = (0, toolkit_1.createAsyncThunk)(SignUpActionType.SignUpCustomer, (data, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
16
+ exports.signUpCustomer = (0, toolkit_1.createAsyncThunk)(SignUpActionType.SignUpCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
17
17
  var _a, _b;
18
18
  try {
19
19
  const api = getState().config.api;
20
20
  const response = yield api.postSignUp(data);
21
21
  dispatch((0, customer_1.loginCustomer)({
22
- email: (_a = data.data.email) !== null && _a !== void 0 ? _a : '',
23
- password: (_b = data.data.password) !== null && _b !== void 0 ? _b : ''
22
+ email: (_a = data.email) !== null && _a !== void 0 ? _a : '',
23
+ password: (_b = data.password) !== null && _b !== void 0 ? _b : ''
24
24
  }));
25
- if (data.callback)
26
- data.callback(response);
25
+ if (callback)
26
+ callback(response);
27
27
  return;
28
28
  }
29
29
  catch (err) {
@@ -1,4 +1,4 @@
1
- import { ConfigApp, GroupOrder, GroupOrders, OrderType, RevenueCenterType, ServiceType, Weekday } from '@open-tender/types';
1
+ import { ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrders, OrderType, RevenueCenterType, ServiceType, Weekday } from '@open-tender/types';
2
2
  declare class OpenTenderAPI {
3
3
  brandId?: string;
4
4
  clientId?: string;
@@ -101,7 +101,7 @@ declare class OpenTenderAPI {
101
101
  getGuest(email: string): Promise<unknown>;
102
102
  getSubscriber(email: string): Promise<unknown>;
103
103
  postSubscriber(email: string): Promise<unknown>;
104
- postSignUp(data: any): Promise<unknown>;
104
+ postSignUp(data: CustomerCreate): Promise<Customer | null | undefined>;
105
105
  postLevelUp(data: any): Promise<unknown>;
106
106
  postThanxLogin(email: string): Promise<unknown>;
107
107
  postThanxAuth(code: string, path: string): Promise<unknown>;
@@ -1,5 +1,5 @@
1
1
  import { AppState } from '../app';
2
- import { LoginData, RequestError, RequestStatus } from '@open-tender/types';
2
+ import { Customer, CustomerCreate, RequestError, RequestStatus } from '@open-tender/types';
3
3
  export interface SignUpState {
4
4
  loading: RequestStatus;
5
5
  error: RequestError;
@@ -8,8 +8,8 @@ export declare enum SignUpActionType {
8
8
  SignUpCustomer = "signUp/signUpCustomer"
9
9
  }
10
10
  export declare const signUpCustomer: import("@reduxjs/toolkit").AsyncThunk<void, {
11
- data: Partial<LoginData>;
12
- callback?: ((data: any) => void) | undefined;
11
+ data: CustomerCreate;
12
+ callback?: ((data: Customer) => void) | undefined;
13
13
  }, {
14
14
  state: AppState;
15
15
  rejectValue: RequestError;
@@ -10,17 +10,17 @@ export var SignUpActionType;
10
10
  (function (SignUpActionType) {
11
11
  SignUpActionType["SignUpCustomer"] = "signUp/signUpCustomer";
12
12
  })(SignUpActionType || (SignUpActionType = {}));
13
- export const signUpCustomer = createAsyncThunk(SignUpActionType.SignUpCustomer, (data, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
13
+ export const signUpCustomer = createAsyncThunk(SignUpActionType.SignUpCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
14
14
  var _a, _b;
15
15
  try {
16
16
  const api = getState().config.api;
17
17
  const response = yield api.postSignUp(data);
18
18
  dispatch(loginCustomer({
19
- email: (_a = data.data.email) !== null && _a !== void 0 ? _a : '',
20
- password: (_b = data.data.password) !== null && _b !== void 0 ? _b : ''
19
+ email: (_a = data.email) !== null && _a !== void 0 ? _a : '',
20
+ password: (_b = data.password) !== null && _b !== void 0 ? _b : ''
21
21
  }));
22
- if (data.callback)
23
- data.callback(response);
22
+ if (callback)
23
+ callback(response);
24
24
  return;
25
25
  }
26
26
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/cloud",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
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",