washday-sdk 0.0.196 → 0.0.198
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/api/customers/get.js +14 -0
- package/dist/api/index.js +3 -0
- package/dist/api/users/post.js +23 -0
- package/package.json +1 -1
- package/src/api/customers/get.ts +13 -0
- package/src/api/index.ts +3 -0
- package/src/api/users/post.ts +17 -0
- package/src/interfaces/Api.ts +3 -0
|
@@ -90,3 +90,17 @@ export const getCustomerByIdCustomersApp = function (customerId) {
|
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
+
export const getCustomerLoyaltyHistory = function (customerId) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
try {
|
|
96
|
+
const config = {
|
|
97
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
98
|
+
};
|
|
99
|
+
return yield axiosInstance.get(`${GET_SET_CUSTOMERS}/${customerId}/loyalty-history`, config);
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error('Error fetching getCustomerLoyaltyHistory:', error);
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
};
|
package/dist/api/index.js
CHANGED
|
@@ -39,6 +39,7 @@ import { deleteUserById } from "./users/delete";
|
|
|
39
39
|
import * as partnersEndpoints from './partners';
|
|
40
40
|
import * as outsourcedOrdersEndpoints from './outsourcedOrders';
|
|
41
41
|
import * as publicsEndpoints from './publics';
|
|
42
|
+
import { validateUserPin } from "./users/post";
|
|
42
43
|
function bindMethods(instance, methods) {
|
|
43
44
|
const boundMethods = {};
|
|
44
45
|
for (const key in methods) {
|
|
@@ -141,6 +142,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
141
142
|
getCustomerHighlightsById: customersEndpoints.getModule.getCustomerHighlightsById,
|
|
142
143
|
getCustomerOrders: customersEndpoints.getModule.getCustomerOrders,
|
|
143
144
|
getCustomerByIdCustomersApp: customersEndpoints.getModule.getCustomerByIdCustomersApp,
|
|
145
|
+
getCustomerLoyaltyHistory: customersEndpoints.getModule.getCustomerLoyaltyHistory,
|
|
144
146
|
create: customersEndpoints.postModule.create,
|
|
145
147
|
bulkCreate: customersEndpoints.postModule.bulkCreate,
|
|
146
148
|
updateById: customersEndpoints.putModule.updateById,
|
|
@@ -174,6 +176,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
174
176
|
this.users = bindMethods(this, {
|
|
175
177
|
updateUserById: updateUserById,
|
|
176
178
|
deleteUserById: deleteUserById,
|
|
179
|
+
validateUserPin: validateUserPin,
|
|
177
180
|
});
|
|
178
181
|
this.countries = bindMethods(this, {
|
|
179
182
|
getCountries: getCountries,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_USER = 'api/users';
|
|
12
|
+
export const validateUserPin = function (data) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {};
|
|
16
|
+
return yield axiosInstance.post(`${GET_SET_USER}/validate-pin`, data, config);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.error('Error fetching validateUserPin:', error);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
package/package.json
CHANGED
package/src/api/customers/get.ts
CHANGED
|
@@ -88,4 +88,17 @@ export const getCustomerByIdCustomersApp = async function (this: WashdayClientIn
|
|
|
88
88
|
console.error('Error fetching customer:', error);
|
|
89
89
|
throw error;
|
|
90
90
|
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
export const getCustomerLoyaltyHistory = async function (this: WashdayClientInstance, customerId: string): Promise<any> {
|
|
95
|
+
try {
|
|
96
|
+
const config = {
|
|
97
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
98
|
+
};
|
|
99
|
+
return await axiosInstance.get(`${GET_SET_CUSTOMERS}/${customerId}/loyalty-history`, config);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error('Error fetching getCustomerLoyaltyHistory:', error);
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
91
104
|
};
|
package/src/api/index.ts
CHANGED
|
@@ -41,6 +41,7 @@ import { customersAppChangePassword } from './auth/post';
|
|
|
41
41
|
import * as partnersEndpoints from './partners';
|
|
42
42
|
import * as outsourcedOrdersEndpoints from './outsourcedOrders';
|
|
43
43
|
import * as publicsEndpoints from './publics';
|
|
44
|
+
import { validateUserPin } from "./users/post";
|
|
44
45
|
|
|
45
46
|
type WashdayClientConstructor = {
|
|
46
47
|
new(apiToken: string): WashdayClientInstance
|
|
@@ -148,6 +149,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
148
149
|
getCustomerHighlightsById: customersEndpoints.getModule.getCustomerHighlightsById,
|
|
149
150
|
getCustomerOrders: customersEndpoints.getModule.getCustomerOrders,
|
|
150
151
|
getCustomerByIdCustomersApp: customersEndpoints.getModule.getCustomerByIdCustomersApp,
|
|
152
|
+
getCustomerLoyaltyHistory: customersEndpoints.getModule.getCustomerLoyaltyHistory,
|
|
151
153
|
create: customersEndpoints.postModule.create,
|
|
152
154
|
bulkCreate: customersEndpoints.postModule.bulkCreate,
|
|
153
155
|
updateById: customersEndpoints.putModule.updateById,
|
|
@@ -181,6 +183,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
181
183
|
this.users = bindMethods(this, {
|
|
182
184
|
updateUserById: updateUserById,
|
|
183
185
|
deleteUserById: deleteUserById,
|
|
186
|
+
validateUserPin: validateUserPin,
|
|
184
187
|
});
|
|
185
188
|
this.countries = bindMethods(this, {
|
|
186
189
|
getCountries: getCountries,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
|
|
4
|
+
const GET_SET_USER = 'api/users';
|
|
5
|
+
|
|
6
|
+
export const validateUserPin = async function (this: WashdayClientInstance, data: {
|
|
7
|
+
userId: string,
|
|
8
|
+
pin: string
|
|
9
|
+
}): Promise<any> {
|
|
10
|
+
try {
|
|
11
|
+
const config = {};
|
|
12
|
+
return await axiosInstance.post(`${GET_SET_USER}/validate-pin`, data, config);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.error('Error fetching validateUserPin:', error);
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -39,6 +39,7 @@ import { deleteUserById } from "../api/users/delete";
|
|
|
39
39
|
import * as partnersEndpoints from '../api/partners';
|
|
40
40
|
import * as outsourcedOrdersEndpoints from '../api/outsourcedOrders';
|
|
41
41
|
import * as publicsEndpoints from '../api/publics';
|
|
42
|
+
import { validateUserPin } from "../api/users/post";
|
|
42
43
|
|
|
43
44
|
export interface WashdayClientInstance {
|
|
44
45
|
apiToken: string;
|
|
@@ -133,6 +134,7 @@ export interface WashdayClientInstance {
|
|
|
133
134
|
getCustomerHighlightsById: typeof customersEndpoints.getModule.getCustomerHighlightsById;
|
|
134
135
|
getCustomerOrders: typeof customersEndpoints.getModule.getCustomerOrders;
|
|
135
136
|
getCustomerByIdCustomersApp: typeof customersEndpoints.getModule.getCustomerByIdCustomersApp;
|
|
137
|
+
getCustomerLoyaltyHistory: typeof customersEndpoints.getModule.getCustomerLoyaltyHistory;
|
|
136
138
|
create: typeof customersEndpoints.postModule.create;
|
|
137
139
|
bulkCreate: typeof customersEndpoints.postModule.bulkCreate;
|
|
138
140
|
updateById: typeof customersEndpoints.putModule.updateById;
|
|
@@ -166,6 +168,7 @@ export interface WashdayClientInstance {
|
|
|
166
168
|
users: {
|
|
167
169
|
updateUserById: typeof updateUserById;
|
|
168
170
|
deleteUserById: typeof deleteUserById;
|
|
171
|
+
validateUserPin: typeof validateUserPin;
|
|
169
172
|
};
|
|
170
173
|
countries: {
|
|
171
174
|
getCountries: typeof getCountries;
|