washday-sdk 1.0.2 → 1.1.1

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.
Files changed (254) hide show
  1. package/README.md +127 -0
  2. package/babel.config.js +8 -0
  3. package/dist/api/attendance/delete.js +2 -0
  4. package/dist/api/attendance/get.js +89 -0
  5. package/dist/api/attendance/index.js +4 -0
  6. package/dist/api/attendance/post.js +39 -0
  7. package/dist/api/attendance/put.js +25 -0
  8. package/dist/api/auth/index.js +3 -0
  9. package/dist/api/auth/post.js +170 -0
  10. package/dist/api/axiosInstance.js +15 -11
  11. package/dist/api/cashierbox/delete.js +40 -0
  12. package/dist/api/cashierbox/get.js +63 -0
  13. package/dist/api/cashierbox/post.js +42 -0
  14. package/dist/api/cashierbox/put.js +42 -0
  15. package/dist/api/cashups/delete.js +25 -0
  16. package/dist/api/cashups/get.js +60 -0
  17. package/dist/api/cashups/index.js +4 -0
  18. package/dist/api/cashups/post.js +25 -0
  19. package/dist/api/cashups/put.js +52 -0
  20. package/dist/api/cfdi/delete.js +25 -0
  21. package/dist/api/cfdi/get.js +126 -0
  22. package/dist/api/cfdi/index.js +4 -0
  23. package/dist/api/cfdi/post.js +41 -0
  24. package/dist/api/cfdi/put.js +52 -0
  25. package/dist/api/companies/get.js +29 -0
  26. package/dist/api/companies/post.js +41 -0
  27. package/dist/api/companies/put.js +57 -0
  28. package/dist/api/countries/get.js +29 -0
  29. package/dist/api/countries/post.js +1 -0
  30. package/dist/api/countries/put.js +1 -0
  31. package/dist/api/csv/get.js +325 -0
  32. package/dist/api/csv/index.js +1 -0
  33. package/dist/api/customers/delete.js +40 -0
  34. package/dist/api/customers/get.js +75 -20
  35. package/dist/api/customers/index.js +4 -1
  36. package/dist/api/customers/post.js +41 -0
  37. package/dist/api/customers/put.js +52 -0
  38. package/dist/api/discounts/get.js +120 -0
  39. package/dist/api/discounts/post.js +40 -0
  40. package/dist/api/discounts/put.js +68 -0
  41. package/dist/api/index.js +316 -8
  42. package/dist/api/inventory/delete.js +26 -0
  43. package/dist/api/inventory/get.js +62 -0
  44. package/dist/api/inventory/index.js +4 -0
  45. package/dist/api/inventory/post.js +26 -0
  46. package/dist/api/inventory/put.js +41 -0
  47. package/dist/api/order/delete.js +40 -0
  48. package/dist/api/order/get.js +181 -0
  49. package/dist/api/order/index.js +4 -0
  50. package/dist/api/order/post.js +115 -0
  51. package/dist/api/order/put.js +202 -0
  52. package/dist/api/outsourcedOrders/delete.js +25 -0
  53. package/dist/api/outsourcedOrders/get.js +62 -0
  54. package/dist/api/outsourcedOrders/index.js +4 -0
  55. package/dist/api/outsourcedOrders/post.js +25 -0
  56. package/dist/api/outsourcedOrders/put.js +25 -0
  57. package/dist/api/partners/delete.js +25 -0
  58. package/dist/api/partners/get.js +40 -0
  59. package/dist/api/partners/index.js +4 -0
  60. package/dist/api/partners/post.js +25 -0
  61. package/dist/api/partners/put.js +25 -0
  62. package/dist/api/pdf/get.js +43 -0
  63. package/dist/api/pdf/index.js +1 -0
  64. package/dist/api/products/delete.js +40 -0
  65. package/dist/api/products/get.js +25 -0
  66. package/dist/api/products/index.js +4 -0
  67. package/dist/api/products/post.js +60 -0
  68. package/dist/api/products/put.js +40 -0
  69. package/dist/api/publics/get.js +26 -0
  70. package/dist/api/publics/index.js +1 -0
  71. package/dist/api/reports/get.js +303 -0
  72. package/dist/api/reports/index.js +1 -0
  73. package/dist/api/reviews/delete.js +15 -0
  74. package/dist/api/reviews/get.js +41 -0
  75. package/dist/api/reviews/index.js +4 -0
  76. package/dist/api/reviews/post.js +20 -0
  77. package/dist/api/reviews/put.js +52 -0
  78. package/dist/api/routes/delete.js +25 -0
  79. package/dist/api/routes/get.js +95 -0
  80. package/dist/api/routes/index.js +4 -0
  81. package/dist/api/routes/post.js +67 -0
  82. package/dist/api/routes/put.js +54 -0
  83. package/dist/api/sections/delete.js +25 -0
  84. package/dist/api/sections/get.js +71 -0
  85. package/dist/api/sections/index.js +4 -0
  86. package/dist/api/sections/post.js +26 -0
  87. package/dist/api/sections/put.js +25 -0
  88. package/dist/api/staff/delete.js +26 -0
  89. package/dist/api/staff/get.js +40 -0
  90. package/dist/api/staff/post.js +26 -0
  91. package/dist/api/staff/put.js +26 -0
  92. package/dist/api/stores/get.js +110 -0
  93. package/dist/api/stores/post.js +61 -0
  94. package/dist/api/stores/put.js +44 -0
  95. package/dist/api/stripe/get.js +1 -0
  96. package/dist/api/stripe/post.js +71 -0
  97. package/dist/api/stripe/put.js +1 -0
  98. package/dist/api/supplies/delete.js +26 -0
  99. package/dist/api/supplies/get.js +62 -0
  100. package/dist/api/supplies/post.js +26 -0
  101. package/dist/api/supplies/put.js +41 -0
  102. package/dist/api/users/delete.js +26 -0
  103. package/dist/api/users/post.js +25 -0
  104. package/dist/api/users/put.js +29 -0
  105. package/dist/enum/index.js +12 -7
  106. package/dist/index.js +3 -33
  107. package/dist/interfaces/Api.js +1 -3
  108. package/dist/interfaces/Apple.js +16 -0
  109. package/dist/interfaces/Attendance.js +1 -0
  110. package/dist/interfaces/Customer.js +1 -2
  111. package/dist/interfaces/Order.js +1 -2
  112. package/dist/interfaces/Permission.js +1 -2
  113. package/dist/interfaces/Product.js +1 -2
  114. package/dist/interfaces/Section.js +1 -2
  115. package/dist/interfaces/Store.js +1 -2
  116. package/dist/interfaces/StoreImage.js +1 -2
  117. package/dist/interfaces/User.js +1 -2
  118. package/dist/utils/apiUtils.js +9 -0
  119. package/dist/utils/index.js +2 -17
  120. package/dist/utils/orders/calculateOrderTotal.js +30 -21
  121. package/dist/utils/orders/calculateTotalTaxesIncluded.js +55 -29
  122. package/dist/utils/orders/calculateTotalTaxesOverPrice.js +56 -45
  123. package/dist/utils/orders/helpers.js +126 -17
  124. package/dist/utils/orders/index.js +3 -5
  125. package/dist/utils/receipt/generateReceiptHTML.js +157 -0
  126. package/dist/utils/util.js +63 -0
  127. package/docs/README.md +67 -0
  128. package/docs/examples/common-use-cases.md +487 -0
  129. package/docs/getting-started.md +237 -0
  130. package/docs/modules/attendance.md +404 -0
  131. package/jest.config.js +0 -0
  132. package/package.json +12 -4
  133. package/src/api/attendance/delete.ts +1 -0
  134. package/src/api/attendance/get.ts +88 -0
  135. package/src/api/attendance/index.ts +4 -0
  136. package/src/api/attendance/post.ts +38 -0
  137. package/src/api/attendance/put.ts +20 -0
  138. package/src/api/auth/index.ts +3 -0
  139. package/src/api/auth/post.ts +198 -0
  140. package/src/api/axiosInstance.ts +13 -3
  141. package/src/api/cashierbox/delete.ts +28 -0
  142. package/src/api/cashierbox/get.ts +53 -0
  143. package/src/api/cashierbox/post.ts +39 -0
  144. package/src/api/cashierbox/put.ts +32 -0
  145. package/src/api/cashups/delete.ts +15 -0
  146. package/src/api/cashups/get.ts +52 -0
  147. package/src/api/cashups/index.ts +4 -0
  148. package/src/api/cashups/post.ts +23 -0
  149. package/src/api/cashups/put.ts +53 -0
  150. package/src/api/cfdi/delete.ts +21 -0
  151. package/src/api/cfdi/get.ts +119 -0
  152. package/src/api/cfdi/index.ts +4 -0
  153. package/src/api/cfdi/post.ts +60 -0
  154. package/src/api/cfdi/put.ts +53 -0
  155. package/src/api/companies/get.ts +23 -0
  156. package/src/api/companies/post.ts +29 -0
  157. package/src/api/companies/put.ts +43 -0
  158. package/src/api/countries/get.ts +23 -0
  159. package/src/api/countries/post.ts +0 -0
  160. package/src/api/countries/put.ts +0 -0
  161. package/src/api/csv/get.ts +354 -0
  162. package/src/api/csv/index.ts +1 -0
  163. package/src/api/customers/delete.ts +29 -0
  164. package/src/api/customers/get.ts +80 -8
  165. package/src/api/customers/index.ts +4 -0
  166. package/src/api/customers/post.ts +48 -0
  167. package/src/api/customers/put.ts +68 -0
  168. package/src/api/discounts/get.ts +100 -0
  169. package/src/api/discounts/post.ts +35 -0
  170. package/src/api/discounts/put.ts +66 -0
  171. package/src/api/index.ts +318 -11
  172. package/src/api/inventory/delete.ts +16 -0
  173. package/src/api/inventory/get.ts +53 -0
  174. package/src/api/inventory/index.ts +4 -0
  175. package/src/api/inventory/post.ts +22 -0
  176. package/src/api/inventory/put.ts +35 -0
  177. package/src/api/order/delete.ts +29 -0
  178. package/src/api/order/get.ts +207 -0
  179. package/src/api/order/index.ts +4 -0
  180. package/src/api/order/post.ts +118 -0
  181. package/src/api/order/put.ts +224 -0
  182. package/src/api/outsourcedOrders/delete.ts +15 -0
  183. package/src/api/outsourcedOrders/get.ts +54 -0
  184. package/src/api/outsourcedOrders/index.ts +4 -0
  185. package/src/api/outsourcedOrders/post.ts +24 -0
  186. package/src/api/outsourcedOrders/put.ts +21 -0
  187. package/src/api/partners/delete.ts +15 -0
  188. package/src/api/partners/get.ts +28 -0
  189. package/src/api/partners/index.ts +4 -0
  190. package/src/api/partners/post.ts +21 -0
  191. package/src/api/partners/put.ts +21 -0
  192. package/src/api/pdf/get.ts +43 -0
  193. package/src/api/pdf/index.ts +1 -0
  194. package/src/api/products/delete.ts +28 -0
  195. package/src/api/products/get.ts +16 -0
  196. package/src/api/products/index.ts +4 -0
  197. package/src/api/products/post.ts +73 -0
  198. package/src/api/products/put.ts +49 -0
  199. package/src/api/publics/get.ts +16 -0
  200. package/src/api/publics/index.ts +1 -0
  201. package/src/api/reports/get.ts +329 -0
  202. package/src/api/reports/index.ts +1 -0
  203. package/src/api/reviews/delete.ts +15 -0
  204. package/src/api/reviews/get.ts +31 -0
  205. package/src/api/reviews/index.ts +4 -0
  206. package/src/api/reviews/post.ts +20 -0
  207. package/src/api/reviews/put.ts +53 -0
  208. package/src/api/routes/delete.ts +15 -0
  209. package/src/api/routes/get.ts +86 -0
  210. package/src/api/routes/index.ts +4 -0
  211. package/src/api/routes/post.ts +60 -0
  212. package/src/api/routes/put.ts +44 -0
  213. package/src/api/sections/delete.ts +15 -0
  214. package/src/api/sections/get.ts +67 -0
  215. package/src/api/sections/index.ts +4 -0
  216. package/src/api/sections/post.ts +22 -0
  217. package/src/api/sections/put.ts +23 -0
  218. package/src/api/staff/delete.ts +16 -0
  219. package/src/api/staff/get.ts +29 -0
  220. package/src/api/staff/post.ts +17 -0
  221. package/src/api/staff/put.ts +17 -0
  222. package/src/api/stores/get.ts +93 -0
  223. package/src/api/stores/post.ts +49 -0
  224. package/src/api/stores/put.ts +35 -0
  225. package/src/api/stripe/get.ts +0 -0
  226. package/src/api/stripe/post.ts +59 -0
  227. package/src/api/stripe/put.ts +0 -0
  228. package/src/api/supplies/delete.ts +16 -0
  229. package/src/api/supplies/get.ts +53 -0
  230. package/src/api/supplies/post.ts +26 -0
  231. package/src/api/supplies/put.ts +33 -0
  232. package/src/api/users/delete.ts +16 -0
  233. package/src/api/users/post.ts +18 -0
  234. package/src/api/users/put.ts +36 -0
  235. package/src/enum/index.ts +9 -1
  236. package/src/index.ts +1 -4
  237. package/src/interfaces/Api.ts +307 -2
  238. package/src/interfaces/Apple.ts +74 -0
  239. package/src/interfaces/Attendance.ts +45 -0
  240. package/src/interfaces/Customer.ts +15 -11
  241. package/src/interfaces/Order.ts +38 -1
  242. package/src/interfaces/Product.ts +1 -0
  243. package/src/interfaces/Store.ts +41 -0
  244. package/src/utils/apiUtils.ts +11 -0
  245. package/src/utils/index.ts +6 -1
  246. package/src/utils/orders/calculateOrderTotal.test.js +930 -0
  247. package/src/utils/orders/calculateOrderTotal.ts +60 -15
  248. package/src/utils/orders/calculateTotalTaxesIncluded.ts +57 -25
  249. package/src/utils/orders/calculateTotalTaxesOverPrice.ts +57 -41
  250. package/src/utils/orders/helpers.ts +195 -47
  251. package/src/utils/orders/index.ts +3 -1
  252. package/src/utils/receipt/generateReceiptHTML.ts +163 -0
  253. package/src/utils/util.ts +65 -0
  254. package/tsconfig.json +13 -9
@@ -1,3 +1,308 @@
1
- export type WashdayClientInstance = {
1
+ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "../api/cashierbox/delete";
2
+ import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "../api/cashierbox/get";
3
+ import { addCashierBoxMovement, createCashierBox } from "../api/cashierbox/post";
4
+ import { updateCashierBoxById, updateCashierBoxMovementById } from "../api/cashierbox/put";
5
+ import { getCompanyById } from "../api/companies/get";
6
+ import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "../api/companies/post";
7
+ import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "../api/companies/put";
8
+ import { getCountries } from "../api/countries/get";
9
+ import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from '../api/discounts/get';
10
+ import { createAutomaticDiscount, createDiscountCode } from "../api/discounts/post";
11
+ import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById, updateDiscountCodeById } from "../api/discounts/put";
12
+ import { deleteStoreStaffById } from "../api/staff/delete";
13
+ import { getStoreStaff, getStoreStaffById } from "../api/staff/get";
14
+ import { createStoreStaff } from "../api/staff/post";
15
+ import { updateStoreStaffById } from "../api/staff/put";
16
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByIdCustomersApp, getStoresByName } from "../api/stores/get";
17
+ import { copyStore, createStore, createStoreImage } from "../api/stores/post";
18
+ import { deleteStoreById, updateStoreById } from "../api/stores/put";
19
+ import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "../api/stripe/post";
20
+ import { deleteSupplyById } from "../api/supplies/delete";
21
+ import { getSupplies, getSupplyById, getSupplyHistory } from "../api/supplies/get";
22
+ import { createSupply } from "../api/supplies/post";
23
+ import { addSupplyStock, updateSupplyById } from "../api/supplies/put";
24
+ import { updateUserById } from "../api/users/put";
25
+ import * as inventoryEndpoints from '../api/inventory';
26
+ import * as sectionsEndpoints from '../api/sections';
27
+ import * as productsEndpoints from '../api/products';
28
+ import * as customersEndpoints from '../api/customers';
29
+ import * as csvExportEndpoints from '../api/csv';
30
+ import * as pdfExportEndpoints from '../api/pdf';
31
+ import * as reportsExportEndpoints from '../api/reports';
32
+ import * as ordersEndpoints from '../api/order';
33
+ import * as routesEndpoints from '../api/routes';
34
+ import * as reviewsEndpoints from '../api/reviews';
35
+ import * as cfdiEndpoints from '../api/cfdi';
36
+ import * as cashupsEndpoints from '../api/cashups';
37
+ import * as authEndpoints from '../api/auth';
38
+ import * as attendanceEndpoints from '../api/attendance';
39
+ import { deleteUserById } from "../api/users/delete";
40
+ import * as partnersEndpoints from '../api/partners';
41
+ import * as outsourcedOrdersEndpoints from '../api/outsourcedOrders';
42
+ import * as publicsEndpoints from '../api/publics';
43
+ import { validateUserPin } from "../api/users/post";
44
+
45
+ export interface WashdayClientInstance {
2
46
  apiToken: string;
3
- };
47
+ cashup: {
48
+ getList: typeof cashupsEndpoints.getModule.getList;
49
+ getById: typeof cashupsEndpoints.getModule.getById;
50
+ getPreviewDataForCashClose: typeof cashupsEndpoints.getModule.getPreviewDataForCashClose;
51
+ create: typeof cashupsEndpoints.postModule.create,
52
+ deleteCashUpReport: typeof cashupsEndpoints.deleteModule.deleteCashUpReport,
53
+ }
54
+ cfdi: {
55
+ getList: typeof cfdiEndpoints.getModule.getList,
56
+ downloadCFDIPDF: typeof cfdiEndpoints.getModule.downloadCFDIPDF,
57
+ downloadCFDIZIP: typeof cfdiEndpoints.getModule.downloadCFDIZIP,
58
+ sendCFDIByEmail: typeof cfdiEndpoints.getModule.sendCFDIByEmail,
59
+ getCFDIPreview: typeof cfdiEndpoints.getModule.getCFDIPreview,
60
+ getCFDIPreviewByOrderId: typeof cfdiEndpoints.getModule.getCFDIPreviewByOrderId,
61
+ createCFDI: typeof cfdiEndpoints.postModule.createCFDI,
62
+ createGlobalCFDI: typeof cfdiEndpoints.postModule.createGlobalCFDI
63
+ cancelCFDI: typeof cfdiEndpoints.deleteModule.cancelCFDI
64
+ }
65
+ auth: {
66
+ customerLoginToken: typeof authEndpoints.postModule.customerLoginToken;
67
+ googleLogin: typeof authEndpoints.postModule.googleLogin;
68
+ appleLogin: typeof authEndpoints.postModule.appleLogin;
69
+ facebookLogin: typeof authEndpoints.postModule.facebookLogin;
70
+ customerRegularLogin: typeof authEndpoints.postModule.customerRegularLogin;
71
+ customerSignUp: typeof authEndpoints.postModule.customerSignUp;
72
+ regularUserLogin: typeof authEndpoints.postModule.regularUserLogin;
73
+ pinLogin: typeof authEndpoints.postModule.pinLogin;
74
+ regularUserTokenLogin: typeof authEndpoints.postModule.regularUserTokenLogin;
75
+ forgotPassword: typeof authEndpoints.postModule.forgotPassword;
76
+ customersAppForgotPassword: typeof authEndpoints.postModule.customersAppForgotPassword;
77
+ customersAppChangePassword: typeof authEndpoints.postModule.customersAppChangePassword;
78
+ companySignUp: typeof authEndpoints.postModule.companySignUp;
79
+ }
80
+ review: {
81
+ getList: typeof reviewsEndpoints.getModule.getList;
82
+ requestStoreReviewByCustomerId: typeof reviewsEndpoints.getModule.requestStoreReviewByCustomerId;
83
+ }
84
+ routes: {
85
+
86
+ getOrdersForRoute: typeof routesEndpoints.getModule.getOrdersForRoute,
87
+ getStoreRoutesList: typeof routesEndpoints.getModule.getStoreRoutesList,
88
+ createRoute: typeof routesEndpoints.postModule.createRoute,
89
+ closeStoreRoutes: typeof routesEndpoints.putModule.closeStoreRoutes,
90
+ //NEW V2 ENDPOINTS
91
+ getRoutesByStore: typeof routesEndpoints.getModule.getRoutesByStore,
92
+ createRouteV2: typeof routesEndpoints.postModule.createRouteV2,
93
+ getRouteByIdV2: typeof routesEndpoints.getModule.getRouteByIdV2,
94
+ deleteRouteById: typeof routesEndpoints.deleteModule.deleteRouteById,
95
+ closeRouteById: typeof routesEndpoints.putModule.closeRouteById,
96
+ updateRouteById: typeof routesEndpoints.putModule.updateRouteById,
97
+ getRoutesByDriver: typeof routesEndpoints.getModule.getRoutesByDriver,
98
+ startRoute: typeof routesEndpoints.postModule.startRoute,
99
+ },
100
+ publics: {
101
+ getOrderPublicReceipt: typeof publicsEndpoints.getModule.getOrderPublicReceipt,
102
+ },
103
+ orders: {
104
+ getList: typeof ordersEndpoints.getModule.getList;
105
+ getOrdersHeaderSummary: typeof ordersEndpoints.getModule.getOrdersHeaderSummary;
106
+ getById: typeof ordersEndpoints.getModule.getById;
107
+ fetchOrdersForCFDI: typeof ordersEndpoints.getModule.fetchOrdersForCFDI;
108
+ updateById: typeof ordersEndpoints.putModule.updateById;
109
+ updatePaymentLineById: typeof ordersEndpoints.putModule.updatePaymentLineById;
110
+ setOrderCancelledBySequence: typeof ordersEndpoints.putModule.setOrderCancelledBySequence,
111
+ setOrderCleaningBySequence: typeof ordersEndpoints.putModule.setOrderCleaningBySequence,
112
+ setOrderCleanedBySequence: typeof ordersEndpoints.putModule.setOrderCleanedBySequence,
113
+ setOrderCollectedBySequence: typeof ordersEndpoints.putModule.setOrderCollectedBySequence,
114
+ setOrdePickingBySequence: typeof ordersEndpoints.putModule.setOrdePickingBySequence,
115
+ setOrdeDeliveringBySequence: typeof ordersEndpoints.putModule.setOrdeDeliveringBySequence,
116
+ setOrdeDeliveredBySequence: typeof ordersEndpoints.putModule.setOrdeDeliveredBySequence,
117
+ createPaymentLine: typeof ordersEndpoints.postModule.createPaymentLine;
118
+ createOrderCustomersApp: typeof ordersEndpoints.postModule.createOrderCustomersApp,
119
+ createOrderUsersApp: typeof ordersEndpoints.postModule.createOrderUsersApp,
120
+ bulkCreatePaymentLines: typeof ordersEndpoints.postModule.bulkCreatePaymentLines,
121
+ createOrderEvidence: typeof ordersEndpoints.postModule.createOrderEvidence,
122
+ getRedeemPointsPreview: typeof ordersEndpoints.postModule.getRedeemPointsPreview,
123
+ deletePaymentLineById: typeof ordersEndpoints.deleteModule.deletePaymentLineById;
124
+ getListCustomersApp: typeof ordersEndpoints.getModule.getListCustomersApp;
125
+ getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
126
+ setOrderAcceptedBySequence: typeof ordersEndpoints.putModule.setOrderAcceptedBySequence,
127
+ getRequestedOrdersSummary: typeof ordersEndpoints.getModule.getRequestedOrdersSummary;
128
+ bulkCancel: typeof ordersEndpoints.putModule.bulkCancel,
129
+ bulkClean: typeof ordersEndpoints.putModule.bulkClean,
130
+ bulkCollect: typeof ordersEndpoints.putModule.bulkCollect,
131
+ cancelOrderByIdCustomersApp: typeof ordersEndpoints.deleteModule.cancelOrderByIdCustomersApp;
132
+ };
133
+ customers: {
134
+ getCustomers: typeof customersEndpoints.getModule.getList;
135
+ getCustomerById: typeof customersEndpoints.getModule.getCustomerById;
136
+ getCustomerHighlightsById: typeof customersEndpoints.getModule.getCustomerHighlightsById;
137
+ getCustomerOrders: typeof customersEndpoints.getModule.getCustomerOrders;
138
+ getCustomerByIdCustomersApp: typeof customersEndpoints.getModule.getCustomerByIdCustomersApp;
139
+ getCustomerLoyaltyHistory: typeof customersEndpoints.getModule.getCustomerLoyaltyHistory;
140
+ create: typeof customersEndpoints.postModule.create;
141
+ bulkCreate: typeof customersEndpoints.postModule.bulkCreate;
142
+ updateById: typeof customersEndpoints.putModule.updateById;
143
+ deleteById: typeof customersEndpoints.deleteModule.deleteById;
144
+ deleteByIdCustomersApp: typeof customersEndpoints.deleteModule.deleteByIdCustomersApp;
145
+ updateByIdCustomersApp: typeof customersEndpoints.putModule.updateByIdCustomersApp;
146
+ };
147
+ stores: {
148
+ getStores: typeof getStores;
149
+ getStoreById: typeof getStoreById;
150
+ getStoreImages: typeof getStoreImages;
151
+ getStoresByName: typeof getStoresByName;
152
+ getStoresByIdCustomersApp: typeof getStoresByIdCustomersApp;
153
+ createStore: typeof createStore;
154
+ copyStore: typeof copyStore;
155
+ updateStoreById: typeof updateStoreById;
156
+ createStoreImage: typeof createStoreImage;
157
+ getStoreReviewLink: typeof getStoreReviewLink;
158
+ deleteStoreById: typeof deleteStoreById;
159
+ };
160
+ products: {
161
+ getById: typeof productsEndpoints.getModule.getById;
162
+ create: typeof productsEndpoints.postModule.create;
163
+ createProductSupply: typeof productsEndpoints.postModule.createProductSupply;
164
+ bulkCreate: typeof productsEndpoints.postModule.bulkCreate;
165
+ deleteById: typeof productsEndpoints.deleteModule.deleteById;
166
+ deleteProductSupplyById: typeof productsEndpoints.deleteModule.deleteProductSupplyById;
167
+ updateById: typeof productsEndpoints.putModule.updateById;
168
+ bulkUpdate: typeof productsEndpoints.putModule.bulkUpdate;
169
+ };
170
+ users: {
171
+ updateUserById: typeof updateUserById;
172
+ deleteUserById: typeof deleteUserById;
173
+ validateUserPin: typeof validateUserPin;
174
+ };
175
+ countries: {
176
+ getCountries: typeof getCountries;
177
+ };
178
+ supplies: {
179
+ getSupplies: typeof getSupplies;
180
+ getSupplyById: typeof getSupplyById;
181
+ getSupplyHistory: typeof getSupplyHistory;
182
+ createSupply: typeof createSupply;
183
+ updateSupplyById: typeof updateSupplyById;
184
+ addSupplyStock: typeof addSupplyStock;
185
+ deleteSupplyById: typeof deleteSupplyById;
186
+ };
187
+ sections: {
188
+ getSections: typeof sectionsEndpoints.getModule.getList;
189
+ getById: typeof sectionsEndpoints.getModule.getById;
190
+ getSectionsByStoreCustomersApp: typeof sectionsEndpoints.getModule.getSectionsByStoreCustomersApp;
191
+ create: typeof sectionsEndpoints.postModule.create;
192
+ deleteById: typeof sectionsEndpoints.deleteModule.deleteById;
193
+ updateById: typeof sectionsEndpoints.putModule.updateById;
194
+ };
195
+ inventory: {
196
+ getInventory: typeof inventoryEndpoints.getModule.getInventory;
197
+ getById: typeof inventoryEndpoints.getModule.getInventoryById;
198
+ getHistoryById: typeof inventoryEndpoints.getModule.getHistoryById;
199
+ create: typeof inventoryEndpoints.postModule.create;
200
+ deleteById: typeof inventoryEndpoints.deleteModule.deleteById;
201
+ updateById: typeof inventoryEndpoints.putModule.updateById;
202
+ addStock: typeof inventoryEndpoints.putModule.addStock;
203
+ };
204
+ cashierboxes: {
205
+ getCashierboxesByStoreId: typeof getCashierboxesByStoreId;
206
+ getCashierboxesById: typeof getCashierboxesById;
207
+ getCashierBoxMovementsHistory: typeof getCashierBoxMovementsHistory;
208
+ createCashierBox: typeof createCashierBox;
209
+ updateCashierBoxById: typeof updateCashierBoxById;
210
+ updateCashierBoxMovementById: typeof updateCashierBoxMovementById;
211
+ deleteCashierBoxById: typeof deleteCashierBoxById;
212
+ addCashierBoxMovement: typeof addCashierBoxMovement;
213
+ deleteCashierBoxMovementById: typeof deleteCashierBoxMovementById;
214
+ };
215
+ companies: {
216
+ getCompanyById: typeof getCompanyById;
217
+ updateCompanyById: typeof updateCompanyById;
218
+ updateCompanyLogoById: typeof updateCompanyLogoById;
219
+ updateCompanyTaxInfoById: typeof updateCompanyTaxInfoById;
220
+ updateCompanyTaxInfoCertificates: typeof updateCompanyTaxInfoCertificates;
221
+ updateCFDIOrgLogo: typeof updateCFDIOrgLogo;
222
+ };
223
+ stripe: {
224
+ createCreateSuscriptionCheckoutSession: typeof createCreateSuscriptionCheckoutSession;
225
+ createCFDISuscrptionCheckoutSession: typeof createCFDISuscrptionCheckoutSession;
226
+ createGetMoreCheckoutSession: typeof createGetMoreCheckoutSession;
227
+ createCustomerPortalSession: typeof createCustomerPortalSession;
228
+ };
229
+ staff: {
230
+ getStoreStaff: typeof getStoreStaff;
231
+ getStoreStaffById: typeof getStoreStaffById;
232
+ updateStoreStaffById: typeof updateStoreStaffById;
233
+ createStoreStaff: typeof createStoreStaff;
234
+ deleteStoreStaffById: typeof deleteStoreStaffById;
235
+ };
236
+ discountCodes: {
237
+ getDiscountCodes: typeof getDiscountCodes;
238
+ getDiscountCodeById: typeof getDiscountCodeById;
239
+ verifyDiscountCode: typeof verifyDiscountCode;
240
+ verifyDiscountCodeCustomersApp: typeof verifyDiscountCodeCustomersApp;
241
+ createDiscountCode: typeof createDiscountCode;
242
+ deleteDiscountCodeById: typeof deleteDiscountCodeById;
243
+ updateDiscountCodeById: typeof updateDiscountCodeById;
244
+ };
245
+ automaticDiscount: {
246
+ getAutomaticDiscounts: typeof getAutomaticDiscounts;
247
+ getAvailableAutomaticDiscounts: typeof getAvailableAutomaticDiscounts,
248
+ getAutomaticDiscountById: typeof getAutomaticDiscountById;
249
+ createAutomaticDiscount: typeof createAutomaticDiscount;
250
+ deleteAutomaticDiscountById: typeof deleteAutomaticDiscountById;
251
+ updateAutomaticDiscountById: typeof updateAutomaticDiscountById;
252
+ };
253
+ csv: {
254
+ exportCustomersList: typeof csvExportEndpoints.getModule.exportCustomersList;
255
+ exportCustomersReport: typeof csvExportEndpoints.getModule.exportCustomersReport;
256
+ exportSuppliesReport: typeof csvExportEndpoints.getModule.exportSuppliesReport;
257
+ exportDiscountCodesReport: typeof csvExportEndpoints.getModule.exportDiscountCodesReport;
258
+ exportProductSalesReport: typeof csvExportEndpoints.getModule.exportProductSalesReport;
259
+ exportPaymentLinesReport: typeof csvExportEndpoints.getModule.exportPaymentLinesReport;
260
+ exportUnpaidOrdersReportCSV: typeof csvExportEndpoints.getModule.exportUnpaidOrdersReportCSV;
261
+ exportOrdersList: typeof csvExportEndpoints.getModule.exportOrdersList,
262
+ exportProductsList: typeof csvExportEndpoints.getModule.exportProductsList,
263
+ exportCleanedOrdersReport: typeof csvExportEndpoints.getModule.exportCleanedOrdersReport,
264
+ exportSalesReport: typeof csvExportEndpoints.getModule.exportSalesReport,
265
+ exportStaffReport: typeof csvExportEndpoints.getModule.exportStaffReport,
266
+ };
267
+ pdf: {
268
+ exportUnpaidOrdersReportPDF: typeof pdfExportEndpoints.getModule.exportUnpaidOrdersReportPDF;
269
+ };
270
+ reports: {
271
+ getCleanedOrdersReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersReport;
272
+ getCleanedOrdersGraphDataReport: typeof reportsExportEndpoints.getModule.getCleanedOrdersGraphDataReport;
273
+ getSalesReport: typeof reportsExportEndpoints.getModule.getSalesReport;
274
+ getCustomersReport: typeof reportsExportEndpoints.getModule.getCustomersReport;
275
+ getSuppliesReport: typeof reportsExportEndpoints.getModule.getSuppliesReport;
276
+ getDiscountCodesReport: typeof reportsExportEndpoints.getModule.getDiscountCodesReport;
277
+ getStaffReport: typeof reportsExportEndpoints.getModule.getStaffReport;
278
+ getProductSalesReport: typeof reportsExportEndpoints.getModule.getProductSalesReport;
279
+ getPaymentLinesReport: typeof reportsExportEndpoints.getModule.getPaymentLinesReport;
280
+ getUnpaidOrdersReport: typeof reportsExportEndpoints.getModule.getUnpaidOrdersReport;
281
+ getAnnualSalesStatistics: typeof reportsExportEndpoints.getModule.getAnnualSalesStatistics;
282
+ getPaymentMethodStatistics: typeof reportsExportEndpoints.getModule.getPaymentMethodStatistics;
283
+ getProductsStatistics: typeof reportsExportEndpoints.getModule.getProductsStatistics;
284
+ getMonthSalesStatistics: typeof reportsExportEndpoints.getModule.getMonthSalesStatistics;
285
+ getPopularDaysStatistics: typeof reportsExportEndpoints.getModule.getPopularDaysStatistics;
286
+ };
287
+ partners: {
288
+ getPartners: typeof partnersEndpoints.getModule.getPartners;
289
+ getPartnerById: typeof partnersEndpoints.getModule.getPartnerById;
290
+ createPartner: typeof partnersEndpoints.postModule.createPartner;
291
+ updatePartnerById: typeof partnersEndpoints.putModule.updatePartnerById;
292
+ };
293
+ outsourcedOrders: {
294
+ getOutsourcedOrdersByOrder: typeof outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByOrder;
295
+ getOutsourcedOrdersByStore: typeof outsourcedOrdersEndpoints.getModule.getOutsourcedOrdersByStore;
296
+ getOutsourcedOrderById: typeof outsourcedOrdersEndpoints.getModule.getOutsourcedOrderById;
297
+ createOutsourcedOrder: typeof outsourcedOrdersEndpoints.postModule.createOutsourcedOrder;
298
+ updateOutsourcedOrderById: typeof outsourcedOrdersEndpoints.putModule.updateOutsourcedOrderById;
299
+ };
300
+ attendance: {
301
+ getHistory: typeof attendanceEndpoints.getModule.getHistory;
302
+ getStatus: typeof attendanceEndpoints.getModule.getStatus;
303
+ getStoreReport: typeof attendanceEndpoints.getModule.getStoreReport;
304
+ clockIn: typeof attendanceEndpoints.postModule.clockIn;
305
+ clockOut: typeof attendanceEndpoints.postModule.clockOut;
306
+ updateById: typeof attendanceEndpoints.putModule.updateById;
307
+ };
308
+ }
@@ -0,0 +1,74 @@
1
+
2
+ export type AppleAuthenticationFullName = {
3
+ namePrefix: string | null;
4
+ givenName: string | null;
5
+ middleName: string | null;
6
+ familyName: string | null;
7
+ nameSuffix: string | null;
8
+ nickname: string | null;
9
+ };
10
+
11
+ enum AppleAuthenticationUserDetectionStatus {
12
+ /**
13
+ * The system does not support this determination and there is no data.
14
+ */
15
+ UNSUPPORTED = 0,
16
+ /**
17
+ * The system has not determined whether the user might be a real person.
18
+ */
19
+ UNKNOWN = 1,
20
+ /**
21
+ * The user appears to be a real person.
22
+ */
23
+ LIKELY_REAL = 2,
24
+ }
25
+
26
+ export type AppleAuthenticationCredential = {
27
+ /**
28
+ * An identifier associated with the authenticated user. You can use this to check if the user is
29
+ * still authenticated later. This is stable and can be shared across apps released under the same
30
+ * development team. The same user will have a different identifier for apps released by other
31
+ * developers.
32
+ */
33
+ user: string;
34
+
35
+ /**
36
+ * An arbitrary string that your app provided as `state` in the request that generated the
37
+ * credential. Used to verify that the response was from the request you made. Can be used to
38
+ * avoid replay attacks. If you did not provide `state` when making the sign-in request, this field
39
+ * will be `null`.
40
+ */
41
+ state: string | null;
42
+
43
+ /**
44
+ * The user's name. May be `null` or contain `null` values if you didn't request the `FULL_NAME`
45
+ * scope, if the user denied access, or if this is not the first time the user has signed into
46
+ * your app.
47
+ */
48
+ fullName: AppleAuthenticationFullName | null;
49
+
50
+ /**
51
+ * The user's email address. Might not be present if you didn't request the `EMAIL` scope. May
52
+ * also be null if this is not the first time the user has signed into your app. If the user chose
53
+ * to withhold their email address, this field will instead contain an obscured email address with
54
+ * an Apple domain.
55
+ */
56
+ email: string | null;
57
+
58
+ /**
59
+ * A value that indicates whether the user appears to the system to be a real person.
60
+ */
61
+ realUserStatus: AppleAuthenticationUserDetectionStatus;
62
+
63
+ /**
64
+ * A JSON Web Token (JWT) that securely communicates information about the user to your app.
65
+ */
66
+ identityToken: string | null;
67
+
68
+ /**
69
+ * A short-lived session token used by your app for proof of authorization when interacting with
70
+ * the app's server counterpart. Unlike `user`, this is ephemeral and will change each session.
71
+ */
72
+ authorizationCode: string | null;
73
+ };
74
+
@@ -0,0 +1,45 @@
1
+ import { IUser } from "./User";
2
+ import { IStore } from "./Store";
3
+
4
+ export interface IAttendanceRecord {
5
+ _id?: string;
6
+ employee: IUser | string;
7
+ store: IStore | string;
8
+ type: 'IN' | 'OUT';
9
+ timestamp: Date;
10
+ ipAddress?: string;
11
+ notes?: string;
12
+ editedBy?: IUser | string;
13
+ editedAt?: Date;
14
+ autoClosed?: boolean;
15
+ createdAt?: Date;
16
+ updatedAt?: Date;
17
+ }
18
+
19
+ export interface IAttendanceHistory {
20
+ attendanceRecords: IAttendanceRecord[];
21
+ totalRecords?: number;
22
+ currentPage?: number;
23
+ totalPages?: number;
24
+ }
25
+
26
+ export interface IAttendanceStatus {
27
+ active: boolean;
28
+ clockInTime?: Date;
29
+ clockInStore?: IStore | string;
30
+ }
31
+
32
+ export interface IAttendanceReport {
33
+ storeId: string;
34
+ storeName?: string;
35
+ employees: {
36
+ employee: IUser | string;
37
+ records: IAttendanceRecord[];
38
+ totalHours?: number;
39
+ totalShifts?: number;
40
+ }[];
41
+ dateRange?: {
42
+ startDate: Date;
43
+ endDate: Date;
44
+ };
45
+ }
@@ -7,15 +7,6 @@ interface IInvoiceInfo {
7
7
  zipCode: string
8
8
  }
9
9
 
10
- interface IAddresses {
11
- addressString: string,
12
- addressName: string,
13
- location: {
14
- latitude: string,
15
- longitude: string
16
- }
17
- }
18
-
19
10
  interface IPaymentMethod {
20
11
  stripeId: string,
21
12
  brand: string,
@@ -24,10 +15,24 @@ interface IPaymentMethod {
24
15
  last4: string,
25
16
  }
26
17
 
18
+ export interface IAddress {
19
+ formattedAddress?: string; // A field to store the full address as a single string
20
+ street?: string;
21
+ neighborhood?: string;
22
+ postalCode?: string;
23
+ city?: string;
24
+ state?: string;
25
+ country?: string;
26
+ coordinates?: {
27
+ lat: number;
28
+ lng: number;
29
+ };
30
+ }
31
+
27
32
  export interface ICustomer {
28
33
  name: string,
29
34
  phone: string,
30
- address: string,
35
+ address: IAddress,
31
36
  rfc?: string,
32
37
  email: string,
33
38
  notes?: string,
@@ -44,7 +49,6 @@ export interface ICustomer {
44
49
  facebook?: boolean,
45
50
  apple?: boolean,
46
51
  useStoreApp?: boolean,
47
- addresses?: [IAddresses],
48
52
  paymentMethods?: [IPaymentMethod],
49
53
  stripeCustomerId?: string,
50
54
  invoiceInfo?: IInvoiceInfo,
@@ -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
  }
@@ -9,6 +9,7 @@ export interface ProductLineTotals {
9
9
  productLineTotalWithDiscount: number,
10
10
  productLineTaxesTotal: number,
11
11
  lineDiscountAmount: number
12
+ productLineSubtotal: number
12
13
  }
13
14
 
14
15
 
@@ -4,6 +4,43 @@ import { IStoreImage } from "./StoreImage"
4
4
  import { IUser, IStaff } from "./User"
5
5
  import { IOrder, IOrderPaymentLines } from "./Order"
6
6
 
7
+ export interface ITimeSlot {
8
+ start: string; // Representing the start time in 24-hour format or any format you prefer
9
+ end: string; // Representing the end time in the same format as start
10
+ }
11
+
12
+ // Define the Availability type for each day
13
+ export interface IAvailability {
14
+ monday: ITimeSlot[]; // Array of time slots for Monday
15
+ tuesday: ITimeSlot[]; // Array of time slots for Tuesday
16
+ wednesday: ITimeSlot[]; // Array of time slots for Wednesday
17
+ thursday: ITimeSlot[]; // Array of time slots for Thursday
18
+ friday: ITimeSlot[]; // Array of time slots for Friday
19
+ saturday: ITimeSlot[]; // Array of time slots for Saturday
20
+ sunday: ITimeSlot[]; // Array of time slots for Sunday
21
+ }
22
+
23
+ export interface ICustomersAppConfig {
24
+ showInApp: boolean,
25
+ allowProductSelection: boolean,
26
+ notifyOrderRequestedByEmail: boolean,
27
+ notifyOrderRequestedByPushNotification: boolean,
28
+ requestedOrderNotificationEmails: string;
29
+ availability: IAvailability; // Reference the IAvailability type
30
+ homeCards: {
31
+ type: 'redirect' | 'copyText' | 'openModal',
32
+ title: string,
33
+ subTitle: string,
34
+ buttonText: string,
35
+ cardBackgroundColor: string,
36
+ buttonBackgroundColor: string,
37
+ titleTextColor: string,
38
+ subTitleTextColor: string,
39
+ buttonTextColor: string,
40
+ onButtonClick: string
41
+ }[]
42
+ }
43
+
7
44
  export interface IStore {
8
45
  name: string,
9
46
  streetAddress?: string,
@@ -15,6 +52,8 @@ export interface IStore {
15
52
  state: string,
16
53
  country: string,
17
54
  phone: string,
55
+ phoneCountryCode?: string,
56
+ phoneCountryName?: string,
18
57
  taxesType: string,
19
58
  taxOne?: ITax,
20
59
  isActive: boolean,
@@ -24,6 +63,7 @@ export interface IStore {
24
63
  paymentConfig: IPaymentConfig,
25
64
  orderPageConfig: IOrderPageConfig,
26
65
  printingConfig: IPrintingConfig,
66
+ customersAppConfig: ICustomersAppConfig
27
67
  notificationConfig: INotificationConfig,
28
68
  schedule?: ISchedule,
29
69
  pickupDeliverySchedule?: IPickupDeliverySchedule,
@@ -203,6 +243,7 @@ export interface ITax {
203
243
 
204
244
  export interface INotificationConfig {
205
245
  notifyOrderCreated: boolean,
246
+ notifyOrderAccepted: boolean,
206
247
  notifyPickedUp: boolean,
207
248
  notifyCleaned: boolean,
208
249
  notifyCollected: boolean,
@@ -0,0 +1,11 @@
1
+ export const generateQueryParamsStr = (availableQueryParamsList: Array<string> = [], receivedParamsObj: {
2
+ [key: string]: any
3
+ } = {}) => {
4
+ let queryParams = [];
5
+ for (let availableParam of availableQueryParamsList) {
6
+ if (receivedParamsObj.hasOwnProperty(availableParam)) {
7
+ queryParams.push(`${availableParam}=${receivedParamsObj[availableParam]}`)
8
+ }
9
+ }
10
+ return queryParams.join('&');
11
+ }
@@ -1 +1,6 @@
1
- export * from './orders';
1
+ export {
2
+ applyDiscountToProducts,
3
+ calculateOrderTotal
4
+ } from './orders';
5
+
6
+ export { getFormattedAddress } from './util';