washday-sdk 1.6.44 → 1.6.46

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.
@@ -38,3 +38,18 @@ export const getCompanyOrdersMetrics = function () {
38
38
  }
39
39
  });
40
40
  };
41
+ export const getGarmentAttributeCatalogs = function (companyId) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ try {
44
+ const config = {
45
+ headers: { Authorization: `Bearer ${this.apiToken}` }
46
+ };
47
+ const response = yield this.axiosInstance.get(`${GET_SET_COMPANIES}/${companyId}/garment-attribute-catalogs`, config);
48
+ return response;
49
+ }
50
+ catch (error) {
51
+ console.error('Error fetching getGarmentAttributeCatalogs:', error);
52
+ throw error;
53
+ }
54
+ });
55
+ };
@@ -69,3 +69,18 @@ export const updateCompanySubscriptionBillingInfoById = function (companyId, dat
69
69
  }
70
70
  });
71
71
  };
72
+ export const updateGarmentAttributeCatalogsById = function (companyId, data) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ try {
75
+ const config = {
76
+ headers: { Authorization: `Bearer ${this.apiToken}` }
77
+ };
78
+ const response = yield this.axiosInstance.patch(`${GET_SET_COMPANIES}/${companyId}/garment-attribute-catalogs`, data, config);
79
+ return response;
80
+ }
81
+ catch (error) {
82
+ console.error('Error fetching updateGarmentAttributeCatalogsById:', error);
83
+ throw error;
84
+ }
85
+ });
86
+ };
package/dist/api/index.js CHANGED
@@ -2,9 +2,9 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "./cashierbox
2
2
  import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
3
3
  import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
4
4
  import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
5
- import { getCompanyById, getCompanyOrdersMetrics } from "./companies/get";
5
+ import { getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "./companies/get";
6
6
  import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
7
- import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById } from "./companies/put";
7
+ import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById, updateGarmentAttributeCatalogsById } from "./companies/put";
8
8
  import { getCountries } from "./countries/get";
9
9
  import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
10
10
  import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
@@ -95,11 +95,14 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
95
95
  getRoutesByStore: routesEndpoints.getModule.getRoutesByStore,
96
96
  createRouteV2: routesEndpoints.postModule.createRouteV2,
97
97
  getRouteByIdV2: routesEndpoints.getModule.getRouteByIdV2,
98
+ getClosePreview: routesEndpoints.getModule.getClosePreview,
98
99
  deleteRouteById: routesEndpoints.deleteModule.deleteRouteById,
99
100
  closeRouteById: routesEndpoints.putModule.closeRouteById,
101
+ closeRouteByIdV2: routesEndpoints.putModule.closeRouteByIdV2,
100
102
  updateRouteById: routesEndpoints.putModule.updateRouteById,
101
103
  getRoutesByDriver: routesEndpoints.getModule.getRoutesByDriver,
102
104
  startRoute: routesEndpoints.postModule.startRoute,
105
+ reorderRouteOrders: routesEndpoints.patchModule.reorderRouteOrders,
103
106
  });
104
107
  this.publics = bindMethods(this, {
105
108
  getOrderPublicReceipt: publicsEndpoints.getModule.getOrderPublicReceipt,
@@ -253,10 +256,12 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
253
256
  this.companies = bindMethods(this, {
254
257
  getCompanyById: getCompanyById,
255
258
  getCompanyOrdersMetrics: getCompanyOrdersMetrics,
259
+ getGarmentAttributeCatalogs: getGarmentAttributeCatalogs,
256
260
  updateCompanyById: updateCompanyById,
257
261
  updateCompanyLogoById: updateCompanyLogoById,
258
262
  updateCompanySubscriptionBillingInfoById: updateCompanySubscriptionBillingInfoById,
259
263
  updateCompanyTaxInfoById: updateCompanyTaxInfoById,
264
+ updateGarmentAttributeCatalogsById: updateGarmentAttributeCatalogsById,
260
265
  updateCompanyTaxInfoCertificates: updateCompanyTaxInfoCertificates,
261
266
  updateCFDIOrgLogo: updateCFDIOrgLogo,
262
267
  enableBillingOverage: enableBillingOverage,
@@ -75,6 +75,20 @@ export const getRouteByIdV2 = function (routeId) {
75
75
  }
76
76
  });
77
77
  };
78
+ export const getClosePreview = function (routeId) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ try {
81
+ const config = {
82
+ headers: { Authorization: `Bearer ${this.apiToken}` }
83
+ };
84
+ return yield this.axiosInstance.get(`${GET_ROUTE}/${routeId}/close-preview`, config);
85
+ }
86
+ catch (error) {
87
+ console.error('Error fetching getClosePreview:', error);
88
+ throw error;
89
+ }
90
+ });
91
+ };
78
92
  export const getRoutesByDriver = function (query) {
79
93
  return __awaiter(this, void 0, void 0, function* () {
80
94
  try {
@@ -1,4 +1,5 @@
1
1
  export * as getModule from './get';
2
2
  export * as postModule from './post';
3
3
  export * as putModule from './put';
4
+ export * as patchModule from './patch';
4
5
  export * as deleteModule from './delete';
@@ -0,0 +1,24 @@
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
+ const GET_ROUTE = "api/routes";
11
+ export const reorderRouteOrders = function (routeId, data) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ try {
14
+ const config = {
15
+ headers: { Authorization: `Bearer ${this.apiToken}` }
16
+ };
17
+ return yield this.axiosInstance.patch(`${GET_ROUTE}/${routeId}/orders/reorder`, data, config);
18
+ }
19
+ catch (error) {
20
+ console.error('Error fetching reorderRouteOrders:', error);
21
+ throw error;
22
+ }
23
+ });
24
+ };
@@ -37,6 +37,20 @@ export const closeRouteById = function (routeId) {
37
37
  }
38
38
  });
39
39
  };
40
+ export const closeRouteByIdV2 = function (routeId, data) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ try {
43
+ const config = {
44
+ headers: { Authorization: `Bearer ${this.apiToken}` }
45
+ };
46
+ return yield this.axiosInstance.put(`${GET_ROUTE}/${routeId}/close`, data || {}, config);
47
+ }
48
+ catch (error) {
49
+ console.error('Error fetching closeRouteByIdV2:', error);
50
+ throw error;
51
+ }
52
+ });
53
+ };
40
54
  export const updateRouteById = function (routeId, data) {
41
55
  return __awaiter(this, void 0, void 0, function* () {
42
56
  try {
@@ -0,0 +1,21 @@
1
+ const type = "brand";
2
+ const catalog = {
3
+ type,
4
+ values: ["Nike"],
5
+ };
6
+ const getResponse = {
7
+ garmentAttributeCatalogs: [catalog],
8
+ };
9
+ const updateRequest = {
10
+ garmentAttributeCatalogs: [catalog],
11
+ };
12
+ const updateResponse = {
13
+ garmentAttributeCatalogs: updateRequest.garmentAttributeCatalogs,
14
+ };
15
+ if (getResponse.garmentAttributeCatalogs[0].type !== "brand") {
16
+ throw new Error("Garment attribute catalog type export was not preserved");
17
+ }
18
+ if (updateResponse.garmentAttributeCatalogs[0].values[0] !== "Nike") {
19
+ throw new Error("Garment attribute catalog response export was not preserved");
20
+ }
21
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/jest.config.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  module.exports = {
2
2
  testEnvironment: "node",
3
+ testMatch: ["<rootDir>/test/**/*.test.ts"],
3
4
  transform: {
4
5
  "^.+\\.(ts|tsx)$": [
5
6
  "babel-jest",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.44",
3
+ "version": "1.6.46",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -26,4 +26,17 @@ export const getCompanyOrdersMetrics = async function (this: WashdayClientInstan
26
26
  console.error('Error fetching getCompanyOrdersMetrics:', error);
27
27
  throw error;
28
28
  }
29
- };
29
+ };
30
+
31
+ export const getGarmentAttributeCatalogs = async function (this: WashdayClientInstance, companyId: string): Promise<any> {
32
+ try {
33
+ const config = {
34
+ headers: { Authorization: `Bearer ${this.apiToken}` }
35
+ };
36
+ const response = await this.axiosInstance.get(`${GET_SET_COMPANIES}/${companyId}/garment-attribute-catalogs`, config);
37
+ return response;
38
+ } catch (error) {
39
+ console.error('Error fetching getGarmentAttributeCatalogs:', error);
40
+ throw error;
41
+ }
42
+ };
@@ -1,6 +1,8 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
- import { UpdateCompanySubscriptionBillingInfoPayload } from "../../interfaces/Company";
3
- import axiosInstance from "../axiosInstance";
2
+ import {
3
+ UpdateCompanySubscriptionBillingInfoPayload,
4
+ UpdateGarmentAttributeCatalogsRequest,
5
+ } from "../../interfaces/Company";
4
6
  const GET_SET_COMPANIES = 'api/company';
5
7
 
6
8
  export const updateCompanyById = async function (this: WashdayClientInstance, companyId: string, data: any): Promise<any> {
@@ -59,3 +61,20 @@ export const updateCompanySubscriptionBillingInfoById = async function (
59
61
  throw error;
60
62
  }
61
63
  };
64
+
65
+ export const updateGarmentAttributeCatalogsById = async function (
66
+ this: WashdayClientInstance,
67
+ companyId: string,
68
+ data: UpdateGarmentAttributeCatalogsRequest,
69
+ ): Promise<any> {
70
+ try {
71
+ const config = {
72
+ headers: { Authorization: `Bearer ${this.apiToken}` }
73
+ };
74
+ const response = await this.axiosInstance.patch(`${GET_SET_COMPANIES}/${companyId}/garment-attribute-catalogs`, data, config);
75
+ return response;
76
+ } catch (error) {
77
+ console.error('Error fetching updateGarmentAttributeCatalogsById:', error);
78
+ throw error;
79
+ }
80
+ };
package/src/api/index.ts CHANGED
@@ -3,9 +3,9 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "./cashierbox
3
3
  import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "./cashierbox/get";
4
4
  import { addCashierBoxMovement, createCashierBox } from "./cashierbox/post";
5
5
  import { updateCashierBoxById, updateCashierBoxMovementById } from "./cashierbox/put";
6
- import { getCompanyById, getCompanyOrdersMetrics } from "./companies/get";
6
+ import { getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "./companies/get";
7
7
  import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
8
- import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById } from "./companies/put";
8
+ import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById, updateGarmentAttributeCatalogsById } from "./companies/put";
9
9
  import { getCountries } from "./countries/get";
10
10
  import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
11
11
  import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
@@ -102,11 +102,14 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
102
102
  getRoutesByStore: routesEndpoints.getModule.getRoutesByStore,
103
103
  createRouteV2: routesEndpoints.postModule.createRouteV2,
104
104
  getRouteByIdV2: routesEndpoints.getModule.getRouteByIdV2,
105
+ getClosePreview: routesEndpoints.getModule.getClosePreview,
105
106
  deleteRouteById: routesEndpoints.deleteModule.deleteRouteById,
106
107
  closeRouteById: routesEndpoints.putModule.closeRouteById,
108
+ closeRouteByIdV2: routesEndpoints.putModule.closeRouteByIdV2,
107
109
  updateRouteById: routesEndpoints.putModule.updateRouteById,
108
110
  getRoutesByDriver: routesEndpoints.getModule.getRoutesByDriver,
109
111
  startRoute: routesEndpoints.postModule.startRoute,
112
+ reorderRouteOrders: routesEndpoints.patchModule.reorderRouteOrders,
110
113
  });
111
114
  this.publics = bindMethods(this, {
112
115
  getOrderPublicReceipt: publicsEndpoints.getModule.getOrderPublicReceipt,
@@ -260,10 +263,12 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
260
263
  this.companies = bindMethods(this, {
261
264
  getCompanyById: getCompanyById,
262
265
  getCompanyOrdersMetrics: getCompanyOrdersMetrics,
266
+ getGarmentAttributeCatalogs: getGarmentAttributeCatalogs,
263
267
  updateCompanyById: updateCompanyById,
264
268
  updateCompanyLogoById: updateCompanyLogoById,
265
269
  updateCompanySubscriptionBillingInfoById: updateCompanySubscriptionBillingInfoById,
266
270
  updateCompanyTaxInfoById: updateCompanyTaxInfoById,
271
+ updateGarmentAttributeCatalogsById: updateGarmentAttributeCatalogsById,
267
272
  updateCompanyTaxInfoCertificates: updateCompanyTaxInfoCertificates,
268
273
  updateCFDIOrgLogo: updateCFDIOrgLogo,
269
274
  enableBillingOverage: enableBillingOverage,
@@ -1,5 +1,5 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
- import { IOrder } from "../../interfaces/Order";
2
+ import { IRoute, IRouteClosePreview } from "../../interfaces/Route";
3
3
  import { generateQueryParamsStr } from "../../utils/apiUtils";
4
4
  import axiosInstance from "../axiosInstance";
5
5
  const GET_SET_ROUTES_ORDERS = 'api/routes/orders';
@@ -54,7 +54,7 @@ export const getRoutesByStore = async function (this: WashdayClientInstance, sto
54
54
  }
55
55
  };
56
56
 
57
- export const getRouteByIdV2 = async function (this: WashdayClientInstance, routeId: string): Promise<any> {
57
+ export const getRouteByIdV2 = async function (this: WashdayClientInstance, routeId: string): Promise<{ data: { data: IRoute } }> {
58
58
  try {
59
59
  const config = {
60
60
  headers: { Authorization: `Bearer ${this.apiToken}` }
@@ -66,9 +66,21 @@ export const getRouteByIdV2 = async function (this: WashdayClientInstance, route
66
66
  }
67
67
  };
68
68
 
69
+ export const getClosePreview = async function (this: WashdayClientInstance, routeId: string): Promise<{ data: { data: IRouteClosePreview } }> {
70
+ try {
71
+ const config = {
72
+ headers: { Authorization: `Bearer ${this.apiToken}` }
73
+ };
74
+ return await this.axiosInstance.get(`${GET_ROUTE}/${routeId}/close-preview`, config);
75
+ } catch (error) {
76
+ console.error('Error fetching getClosePreview:', error);
77
+ throw error;
78
+ }
79
+ };
80
+
69
81
  export const getRoutesByDriver = async function (this: WashdayClientInstance, query: {
70
82
  status?: string,
71
- }): Promise<any> {
83
+ }): Promise<{ data: { data: IRoute[] } }> {
72
84
  try {
73
85
  const config = {
74
86
  headers: { Authorization: `Bearer ${this.apiToken}` }
@@ -83,4 +95,3 @@ export const getRoutesByDriver = async function (this: WashdayClientInstance, qu
83
95
  }
84
96
  };
85
97
 
86
-
@@ -1,4 +1,5 @@
1
1
  export * as getModule from './get';
2
2
  export * as postModule from './post';
3
3
  export * as putModule from './put';
4
- export * as deleteModule from './delete';
4
+ export * as patchModule from './patch';
5
+ export * as deleteModule from './delete';
@@ -0,0 +1,21 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+
3
+ const GET_ROUTE = "api/routes";
4
+
5
+ export const reorderRouteOrders = async function (
6
+ this: WashdayClientInstance,
7
+ routeId: string,
8
+ data: {
9
+ orders: Array<{ orderId: string; sortOrder: number }>,
10
+ }
11
+ ): Promise<any> {
12
+ try {
13
+ const config = {
14
+ headers: { Authorization: `Bearer ${this.apiToken}` }
15
+ };
16
+ return await this.axiosInstance.patch(`${GET_ROUTE}/${routeId}/orders/reorder`, data, config);
17
+ } catch (error) {
18
+ console.error('Error fetching reorderRouteOrders:', error);
19
+ throw error;
20
+ }
21
+ };
@@ -29,6 +29,20 @@ export const closeRouteById = async function (this: WashdayClientInstance, route
29
29
  }
30
30
  };
31
31
 
32
+ export const closeRouteByIdV2 = async function (this: WashdayClientInstance, routeId: string, data?: {
33
+ confirmAutoCompletePendingOrders?: boolean,
34
+ }): Promise<any> {
35
+ try {
36
+ const config = {
37
+ headers: { Authorization: `Bearer ${this.apiToken}` }
38
+ };
39
+ return await this.axiosInstance.put(`${GET_ROUTE}/${routeId}/close`, data || {}, config);
40
+ } catch (error) {
41
+ console.error('Error fetching closeRouteByIdV2:', error);
42
+ throw error;
43
+ }
44
+ };
45
+
32
46
  export const updateRouteById = async function (this: WashdayClientInstance, routeId: string, data: {
33
47
  driver?: string,
34
48
  }): Promise<any> {
@@ -2,9 +2,9 @@ import { deleteCashierBoxById, deleteCashierBoxMovementById } from "../api/cashi
2
2
  import { getCashierBoxMovementsHistory, getCashierboxesById, getCashierboxesByStoreId } from "../api/cashierbox/get";
3
3
  import { addCashierBoxMovement, createCashierBox } from "../api/cashierbox/post";
4
4
  import { updateCashierBoxById, updateCashierBoxMovementById } from "../api/cashierbox/put";
5
- import { getCompanyById, getCompanyOrdersMetrics } from "../api/companies/get";
5
+ import { getCompanyById, getCompanyOrdersMetrics, getGarmentAttributeCatalogs } from "../api/companies/get";
6
6
  import { disableBillingOverage, enableBillingOverage, updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "../api/companies/post";
7
- import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById } from "../api/companies/put";
7
+ import { updateCompanyById, updateCompanyLogoById, updateCompanySubscriptionBillingInfoById, updateCompanyTaxInfoById, updateGarmentAttributeCatalogsById } from "../api/companies/put";
8
8
  import { getCountries } from "../api/countries/get";
9
9
  import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from '../api/discounts/get';
10
10
  import { createAutomaticDiscount, createDiscountCode } from "../api/discounts/post";
@@ -103,11 +103,14 @@ export interface WashdayClientInstance {
103
103
  getRoutesByStore: typeof routesEndpoints.getModule.getRoutesByStore,
104
104
  createRouteV2: typeof routesEndpoints.postModule.createRouteV2,
105
105
  getRouteByIdV2: typeof routesEndpoints.getModule.getRouteByIdV2,
106
+ getClosePreview: typeof routesEndpoints.getModule.getClosePreview,
106
107
  deleteRouteById: typeof routesEndpoints.deleteModule.deleteRouteById,
107
108
  closeRouteById: typeof routesEndpoints.putModule.closeRouteById,
109
+ closeRouteByIdV2: typeof routesEndpoints.putModule.closeRouteByIdV2,
108
110
  updateRouteById: typeof routesEndpoints.putModule.updateRouteById,
109
111
  getRoutesByDriver: typeof routesEndpoints.getModule.getRoutesByDriver,
110
112
  startRoute: typeof routesEndpoints.postModule.startRoute,
113
+ reorderRouteOrders: typeof routesEndpoints.patchModule.reorderRouteOrders,
111
114
  },
112
115
  publics: {
113
116
  getOrderPublicReceipt: typeof publicsEndpoints.getModule.getOrderPublicReceipt,
@@ -245,10 +248,12 @@ export interface WashdayClientInstance {
245
248
  companies: {
246
249
  getCompanyById: typeof getCompanyById;
247
250
  getCompanyOrdersMetrics: typeof getCompanyOrdersMetrics;
251
+ getGarmentAttributeCatalogs: typeof getGarmentAttributeCatalogs;
248
252
  updateCompanyById: typeof updateCompanyById;
249
253
  updateCompanyLogoById: typeof updateCompanyLogoById;
250
254
  updateCompanySubscriptionBillingInfoById: typeof updateCompanySubscriptionBillingInfoById;
251
255
  updateCompanyTaxInfoById: typeof updateCompanyTaxInfoById;
256
+ updateGarmentAttributeCatalogsById: typeof updateGarmentAttributeCatalogsById;
252
257
  updateCompanyTaxInfoCertificates: typeof updateCompanyTaxInfoCertificates;
253
258
  updateCFDIOrgLogo: typeof updateCFDIOrgLogo;
254
259
  enableBillingOverage: typeof enableBillingOverage;
@@ -0,0 +1,34 @@
1
+ import {
2
+ GarmentAttributeCatalog,
3
+ GarmentAttributeType,
4
+ GetGarmentAttributeCatalogsResponse,
5
+ UpdateGarmentAttributeCatalogsRequest,
6
+ UpdateGarmentAttributeCatalogsResponse,
7
+ } from "./Company";
8
+
9
+ const type: GarmentAttributeType = "brand";
10
+
11
+ const catalog: GarmentAttributeCatalog = {
12
+ type,
13
+ values: ["Nike"],
14
+ };
15
+
16
+ const getResponse: GetGarmentAttributeCatalogsResponse = {
17
+ garmentAttributeCatalogs: [catalog],
18
+ };
19
+
20
+ const updateRequest: UpdateGarmentAttributeCatalogsRequest = {
21
+ garmentAttributeCatalogs: [catalog],
22
+ };
23
+
24
+ const updateResponse: UpdateGarmentAttributeCatalogsResponse = {
25
+ garmentAttributeCatalogs: updateRequest.garmentAttributeCatalogs,
26
+ };
27
+
28
+ if (getResponse.garmentAttributeCatalogs[0].type !== "brand") {
29
+ throw new Error("Garment attribute catalog type export was not preserved");
30
+ }
31
+
32
+ if (updateResponse.garmentAttributeCatalogs[0].values[0] !== "Nike") {
33
+ throw new Error("Garment attribute catalog response export was not preserved");
34
+ }
@@ -1,5 +1,24 @@
1
1
  import { GlobalPaymentMethodCfdiSettings } from "./Cfdi";
2
2
 
3
+ export type GarmentAttributeType = "color" | "damage" | "stain" | "brand";
4
+
5
+ export interface GarmentAttributeCatalog {
6
+ type: GarmentAttributeType;
7
+ values: string[];
8
+ }
9
+
10
+ export interface GetGarmentAttributeCatalogsResponse {
11
+ garmentAttributeCatalogs: GarmentAttributeCatalog[];
12
+ }
13
+
14
+ export interface UpdateGarmentAttributeCatalogsRequest {
15
+ garmentAttributeCatalogs: GarmentAttributeCatalog[];
16
+ }
17
+
18
+ export interface UpdateGarmentAttributeCatalogsResponse {
19
+ garmentAttributeCatalogs: GarmentAttributeCatalog[];
20
+ }
21
+
3
22
  export interface ISubscriptionBillingInfo {
4
23
  legalName: string;
5
24
  rfc: string;
@@ -3,6 +3,7 @@ import { IOrderProduct, IProduct } from "./Product";
3
3
  import { ICashierBox, IStore, IStoreDiscount, ITaxConfig } from "./Store";
4
4
  import { IUser } from "./User";
5
5
  import { OrderProductLineStatus } from "../enum";
6
+ import { RouteOrderCompletionSource } from "./Route";
6
7
 
7
8
  interface IDeliveryInfo {
8
9
  date: Date,
@@ -45,6 +46,13 @@ export interface IOrderPaymentLines {
45
46
  facturapiPaymentInvoiceID?: string | null,
46
47
  }
47
48
 
49
+ export interface IOrderPhaseCompletion {
50
+ source: RouteOrderCompletionSource,
51
+ confirmedAt?: Date | null,
52
+ confirmedBy?: IUser | string | null,
53
+ routeId?: string | null,
54
+ }
55
+
48
56
  export interface IOrder {
49
57
  delivery: boolean,
50
58
  pickup: boolean,
@@ -90,6 +98,8 @@ export interface IOrder {
90
98
  status: string,
91
99
  pickupRoute: string | null,
92
100
  deliveryRoute: string | null,
101
+ pickupCompletion?: IOrderPhaseCompletion | null,
102
+ deliveryCompletion?: IOrderPhaseCompletion | null,
93
103
  sequence?: string | null,
94
104
  notifyBy: string,
95
105
  stripePaymentIntentId?: string | null,
@@ -0,0 +1,69 @@
1
+ import { IOrder } from "./Order";
2
+ import { IStore } from "./Store";
3
+ import { IUser } from "./User";
4
+
5
+ export type RouteStatus = "created" | "in_progress" | "finished" | "cancelled";
6
+ export type RouteOrderType = "pickup" | "delivery" | "legacy_unknown";
7
+ export type RouteOrderResult =
8
+ | "pending"
9
+ | "completed"
10
+ | "failed_attempt"
11
+ | "cancelled"
12
+ | "legacy_unknown";
13
+ export type RouteOrderCompletionSource =
14
+ | "driver_confirmed"
15
+ | "route_close_sweep"
16
+ | "legacy_unknown";
17
+
18
+ export interface IRouteOrder {
19
+ _id?: string;
20
+ order: IOrder | string;
21
+ type: RouteOrderType;
22
+ sortOrder: number;
23
+ active: boolean;
24
+ result: RouteOrderResult;
25
+ assignedAt: Date | string;
26
+ assignedBy?: IUser | string | null;
27
+ startedAt?: Date | string | null;
28
+ resolvedAt?: Date | string | null;
29
+ resolvedBy?: IUser | string | null;
30
+ completionSource?: RouteOrderCompletionSource | null;
31
+ completionConfirmedAt?: Date | string | null;
32
+ completionConfirmedBy?: IUser | string | null;
33
+ }
34
+
35
+ export interface IRoute {
36
+ _id: string;
37
+ routeSequence?: number;
38
+ closedDate?: Date | string | null;
39
+ createdBy: IUser | string;
40
+ createdDate?: Date | string;
41
+ driver: IUser | string;
42
+ isActive: boolean;
43
+ orders: IRouteOrder[];
44
+ status: RouteStatus | string;
45
+ store: IStore | string;
46
+ startedDate?: Date | string | null;
47
+ }
48
+
49
+ export interface IRouteClosePreviewPendingOrder {
50
+ routeOrderId: string;
51
+ orderId: string;
52
+ type: RouteOrderType;
53
+ sequence?: string | number | null;
54
+ status?: string | null;
55
+ willBecome?: string | null;
56
+ }
57
+
58
+ export interface IRouteClosePreview {
59
+ routeId: string;
60
+ canClose: boolean;
61
+ summary: {
62
+ confirmed: number;
63
+ failed: number;
64
+ cancelled: number;
65
+ pendingActive: number;
66
+ };
67
+ pendingActiveOrders: IRouteClosePreviewPendingOrder[];
68
+ requiresExplicitConfirmation: boolean;
69
+ }
@@ -0,0 +1,20 @@
1
+ import { getGarmentAttributeCatalogs } from "../src/api/companies/get";
2
+
3
+ describe("getGarmentAttributeCatalogs", () => {
4
+ it("calls the garment attribute catalogs endpoint with auth headers", async () => {
5
+ const get = jest.fn().mockResolvedValue({ data: { data: { garmentAttributeCatalogs: [] } } });
6
+ const client = {
7
+ apiToken: "token-1",
8
+ axiosInstance: { get },
9
+ } as any;
10
+
11
+ await getGarmentAttributeCatalogs.call(client, "company-1");
12
+
13
+ expect(get).toHaveBeenCalledWith(
14
+ "api/company/company-1/garment-attribute-catalogs",
15
+ {
16
+ headers: { Authorization: "Bearer token-1" },
17
+ }
18
+ );
19
+ });
20
+ });
@@ -0,0 +1,29 @@
1
+ import { updateGarmentAttributeCatalogsById } from "../src/api/companies/put";
2
+
3
+ describe("updateGarmentAttributeCatalogsById", () => {
4
+ it("sends a full replacement payload with PATCH and auth headers", async () => {
5
+ const patch = jest.fn().mockResolvedValue({ data: { data: { garmentAttributeCatalogs: [] } } });
6
+ const client = {
7
+ apiToken: "token-1",
8
+ axiosInstance: { patch },
9
+ } as any;
10
+ const payload = {
11
+ garmentAttributeCatalogs: [
12
+ { type: "color", values: ["Rojo", "Azul"] },
13
+ { type: "damage", values: ["Rasgado"] },
14
+ { type: "stain", values: [] },
15
+ { type: "brand", values: ["Nike"] },
16
+ ],
17
+ };
18
+
19
+ await updateGarmentAttributeCatalogsById.call(client, "company-1", payload);
20
+
21
+ expect(patch).toHaveBeenCalledWith(
22
+ "api/company/company-1/garment-attribute-catalogs",
23
+ payload,
24
+ {
25
+ headers: { Authorization: "Bearer token-1" },
26
+ }
27
+ );
28
+ });
29
+ });