washday-sdk 0.0.120 → 0.0.122

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,7 +1,7 @@
1
1
  import axios from 'axios';
2
2
  // Define the type for the Axios instance
3
3
  let axiosInstance = null;
4
- // const BASE_URL: string = 'http://localhost:5555/';
4
+ //const BASE_URL: string = 'http://localhost:5555/';
5
5
  const BASE_URL = 'https://washday-backend.herokuapp.com/';
6
6
  // Function to create or return the singleton instance
7
7
  const getAxiosInstance = () => {
package/dist/api/index.js CHANGED
@@ -94,9 +94,11 @@ const WashdayClient = function WashdayClient(apiToken) {
94
94
  setOrdeDeliveredBySequence: ordersEndpoints.putModule.setOrdeDeliveredBySequence,
95
95
  createPaymentLine: ordersEndpoints.postModule.createPaymentLine,
96
96
  sendEmailReceipt: ordersEndpoints.postModule.sendEmailReceipt,
97
+ createOrderCustomersApp: ordersEndpoints.postModule.createOrderCustomersApp,
97
98
  deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
98
99
  getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
99
100
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
101
+ setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
100
102
  });
101
103
  this.customers = bindMethods(this, {
102
104
  getCustomers: customersEndpoints.getModule.getList,
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import axiosInstance from "../axiosInstance";
11
11
  const GET_SET_ORDER_PAYMENTLINES = (orderId) => `/api/v2/order/${orderId}/paymentLines`;
12
12
  const GET_SET_ORDER = 'api/v2/order';
13
+ const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
13
14
  export const createPaymentLine = function (id, data) {
14
15
  return __awaiter(this, void 0, void 0, function* () {
15
16
  try {
@@ -38,3 +39,17 @@ export const sendEmailReceipt = function (id) {
38
39
  }
39
40
  });
40
41
  };
42
+ export const createOrderCustomersApp = function (data) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ try {
45
+ const config = {
46
+ headers: { Authorization: `Bearer ${this.apiToken}` }
47
+ };
48
+ return yield axiosInstance.post(`${GET_SET_ORDER_CUSTOMERS_APP}`, data, config);
49
+ }
50
+ catch (error) {
51
+ console.error('Error fetching createOrderCustomersApp:', error);
52
+ throw error;
53
+ }
54
+ });
55
+ };
@@ -137,3 +137,17 @@ export const setOrdeDeliveredBySequence = function (sequence, storeId, data) {
137
137
  }
138
138
  });
139
139
  };
140
+ export const setOrderAcceptedBySequence = function (sequence, storeId) {
141
+ return __awaiter(this, void 0, void 0, function* () {
142
+ try {
143
+ const config = {
144
+ headers: { Authorization: `Bearer ${this.apiToken}` }
145
+ };
146
+ return yield axiosInstance.put(`${GET_SET_ORDER}/${sequence}/${storeId}/accepted`, {}, config);
147
+ }
148
+ catch (error) {
149
+ console.error('Error fetching setOrderAcceptedBySequence:', error);
150
+ throw error;
151
+ }
152
+ });
153
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.120",
3
+ "version": "0.0.122",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -3,7 +3,7 @@ import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
3
3
  // Define the type for the Axios instance
4
4
  let axiosInstance: AxiosInstance | null = null;
5
5
 
6
- // const BASE_URL: string = 'http://localhost:5555/';
6
+ //const BASE_URL: string = 'http://localhost:5555/';
7
7
  const BASE_URL: string = 'https://washday-backend.herokuapp.com/';
8
8
 
9
9
  // Function to create or return the singleton instance
@@ -6,6 +6,8 @@ export const create = async function (this: WashdayClientInstance, data: {
6
6
  name: string;
7
7
  lastName?: string;
8
8
  phone?: string;
9
+ phoneCountryCode?: string;
10
+ phoneCountryName?: string;
9
11
  email?: string;
10
12
  address?: string;
11
13
  notes?: string;
@@ -19,6 +19,8 @@ export const updateById = async function (this: WashdayClientInstance, id: strin
19
19
  name?: string;
20
20
  lastName?: string;
21
21
  phone?: string;
22
+ phoneCountryCode?: string;
23
+ phoneCountryName?: string;
22
24
  email?: string;
23
25
  address?: string;
24
26
  notes?: string;
@@ -48,6 +50,8 @@ export const updateByIdCustomersApp = async function (this: WashdayClientInstanc
48
50
  name?: string;
49
51
  lastName?: string;
50
52
  phone?: string;
53
+ phoneCountryCode?: string;
54
+ phoneCountryName?: string;
51
55
  address?: string;
52
56
  notes?: string;
53
57
  customersAppPushNotificationToken?: string;
package/src/api/index.ts CHANGED
@@ -100,9 +100,11 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
100
100
  setOrdeDeliveredBySequence: ordersEndpoints.putModule.setOrdeDeliveredBySequence,
101
101
  createPaymentLine: ordersEndpoints.postModule.createPaymentLine,
102
102
  sendEmailReceipt: ordersEndpoints.postModule.sendEmailReceipt,
103
+ createOrderCustomersApp: ordersEndpoints.postModule.createOrderCustomersApp,
103
104
  deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
104
105
  getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
105
106
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
107
+ setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
106
108
  });
107
109
  this.customers = bindMethods(this, {
108
110
  getCustomers: customersEndpoints.getModule.getList,
@@ -1,7 +1,9 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import { OrderDto } from "../../interfaces/Order";
2
3
  import axiosInstance from "../axiosInstance";
3
4
  const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
4
5
  const GET_SET_ORDER = 'api/v2/order';
6
+ const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
5
7
 
6
8
  export const createPaymentLine = async function (this: WashdayClientInstance, id: string, data: {
7
9
  amountPaid: number,
@@ -31,4 +33,16 @@ export const sendEmailReceipt = async function (this: WashdayClientInstance, id:
31
33
  console.error('Error fetching create:', error);
32
34
  throw error;
33
35
  }
36
+ };
37
+
38
+ export const createOrderCustomersApp = async function (this: WashdayClientInstance, data: OrderDto): Promise<any> {
39
+ try {
40
+ const config = {
41
+ headers: { Authorization: `Bearer ${this.apiToken}` }
42
+ };
43
+ return await axiosInstance.post(`${GET_SET_ORDER_CUSTOMERS_APP}`, data, config);
44
+ } catch (error) {
45
+ console.error('Error fetching createOrderCustomersApp:', error);
46
+ throw error;
47
+ }
34
48
  };
@@ -149,4 +149,16 @@ export const setOrdeDeliveredBySequence = async function (this: WashdayClientIns
149
149
  console.error('Error fetching setOrdeDeliveredBySequence:', error);
150
150
  throw error;
151
151
  }
152
+ };
153
+
154
+ export const setOrderAcceptedBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string): Promise<any> {
155
+ try {
156
+ const config = {
157
+ headers: { Authorization: `Bearer ${this.apiToken}` }
158
+ };
159
+ return await axiosInstance.put(`${GET_SET_ORDER}/${sequence}/${storeId}/accepted`, {}, config);
160
+ } catch (error) {
161
+ console.error('Error fetching setOrderAcceptedBySequence:', error);
162
+ throw error;
163
+ }
152
164
  };
@@ -86,9 +86,11 @@ export interface WashdayClientInstance {
86
86
  setOrdeDeliveringBySequence: typeof ordersEndpoints.putModule.setOrdeDeliveringBySequence,
87
87
  setOrdeDeliveredBySequence: typeof ordersEndpoints.putModule.setOrdeDeliveredBySequence,
88
88
  createPaymentLine: typeof ordersEndpoints.postModule.createPaymentLine;
89
+ createOrderCustomersApp: typeof ordersEndpoints.postModule.createOrderCustomersApp,
89
90
  deletePaymentLineById: typeof ordersEndpoints.deleteModule.deletePaymentLineById;
90
91
  getListCustomersApp: typeof ordersEndpoints.getModule.getListCustomersApp;
91
92
  getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
93
+ setOrderAcceptedBySequence: typeof ordersEndpoints.putModule.setOrderAcceptedBySequence,
92
94
  };
93
95
  customers: {
94
96
  getCustomers: typeof customersEndpoints.getModule.getList;
@@ -1,6 +1,6 @@
1
1
  import { ICustomer } from "./Customer";
2
2
  import { IOrderProduct, IProduct } from "./Product";
3
- import { ICashierBox, IStore, ITaxConfig } from "./Store";
3
+ import { ICashierBox, IStore, IStoreDiscount, ITaxConfig } from "./Store";
4
4
  import { IUser } from "./User";
5
5
 
6
6
  interface IDeliveryInfo {
@@ -93,4 +93,41 @@ export interface IOrderInfo {
93
93
  paid: number;
94
94
  unpaid: number;
95
95
  lastOrderDate: Date;
96
+ }
97
+
98
+ export interface OrderDto {
99
+ delivery: boolean,
100
+ pickup: boolean,
101
+ express: boolean,
102
+ deliveryInfo: IDeliveryInfo,
103
+ pickupInfo?: IPickupInfo,
104
+ phone: string,
105
+ email?: string,
106
+ address: string,
107
+ notes?: string,
108
+ privateNotes?: string,
109
+ taxesType: string,
110
+ products: Array<IOrderProduct> | any,
111
+ creditApplied: number,
112
+ amountPaid: number,
113
+ customer: string,
114
+ pickingUpDateTime: Date | null,
115
+ cleanedDateTime: Date | null,
116
+ readyDateTime: Date | null,
117
+ deliveringDateTime: Date | null,
118
+ collectedDateTime: Date | null,
119
+ cancelledDateTime: Date | null,
120
+ paidDateTime: Date | null,
121
+ status: string,
122
+ store: string,
123
+ paymentMethod: string | null,
124
+ prepaidAmount: number | null,
125
+ prepaidPaymentMethod: string | null,
126
+ notifyBy: string,
127
+ discountsToApply: Array<IStoreDiscount> | null,
128
+ cashierBox: string | null,
129
+ buyAndGetProducts: Array<IOrderProduct>,
130
+ discountCode: string | null,
131
+ createdDate?: Date | null,
132
+ updatedDate?: Date | null
96
133
  }