washday-sdk 1.6.47 → 1.6.49
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/auth/get.js +22 -0
- package/dist/api/auth/index.js +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/order/get.js +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/Auth.js +1 -0
- package/docs/domain-audit-app-washday-mx.md +90 -0
- package/package.json +1 -1
- package/src/api/auth/get.ts +18 -0
- package/src/api/auth/index.ts +1 -0
- package/src/api/index.ts +1 -0
- package/src/api/order/get.ts +2 -0
- package/src/index.ts +1 -0
- package/src/interfaces/Api.ts +1 -0
- package/src/interfaces/Auth.ts +9 -0
- package/src/interfaces/Product.ts +1 -0
- package/test/auth.signupCountrySuggestionBinding.test.ts +44 -0
- package/test/orders.getListAssignedEmployee.test.ts +56 -0
|
@@ -0,0 +1,22 @@
|
|
|
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 REGULAR_USER_AUTH = "api/auth";
|
|
11
|
+
export const getSignupCountrySuggestion = function () {
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
try {
|
|
14
|
+
const config = {};
|
|
15
|
+
return yield this.axiosInstance.get(`${REGULAR_USER_AUTH}/signup-country-suggestion`, config);
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
console.error("Error fetching getSignupCountrySuggestion:", error);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
package/dist/api/auth/index.js
CHANGED
package/dist/api/index.js
CHANGED
|
@@ -124,6 +124,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
124
124
|
customersAppForgotPassword: authEndpoints.postModule.customersAppForgotPassword,
|
|
125
125
|
customersAppChangePassword: authEndpoints.postModule.customersAppChangePassword,
|
|
126
126
|
companySignUp: authEndpoints.postModule.companySignUp,
|
|
127
|
+
getSignupCountrySuggestion: authEndpoints.getModule.getSignupCountrySuggestion,
|
|
127
128
|
});
|
|
128
129
|
this.orders = bindMethods(this, {
|
|
129
130
|
getList: ordersEndpoints.getModule.getList,
|
package/dist/api/order/get.js
CHANGED
|
@@ -43,6 +43,7 @@ export const getList = function (params, options) {
|
|
|
43
43
|
'fetchSection',
|
|
44
44
|
'cfdiId',
|
|
45
45
|
'customerId',
|
|
46
|
+
'assignedEmployee',
|
|
46
47
|
], params);
|
|
47
48
|
// ], { ...params, q: params.q ? encodeURIComponent(params.q) : undefined });
|
|
48
49
|
return yield this.axiosInstance.get(`${GET_SET_ORDER}?${queryParams}`, config);
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Domain Audit — app.washday.mx
|
|
2
|
+
|
|
3
|
+
## Repo
|
|
4
|
+
|
|
5
|
+
washday-sdk
|
|
6
|
+
|
|
7
|
+
## Summary
|
|
8
|
+
|
|
9
|
+
- Total direct `app.washday.mx` references: 0
|
|
10
|
+
- Total `washday.mx` references: 2
|
|
11
|
+
- Total `washdaypos.com` references: 0
|
|
12
|
+
- Highest-risk areas: no `app.washday.mx` usage found; SDK API base URLs are hardcoded to Heroku backend hosts and should be reviewed separately from the app-domain migration.
|
|
13
|
+
- Recommended next step: No app-domain change is needed in this repo for the current audit; keep redirect URI support compatible with frontend/backend migration work.
|
|
14
|
+
|
|
15
|
+
## Findings by category
|
|
16
|
+
|
|
17
|
+
### 1. Production app links / redirects
|
|
18
|
+
|
|
19
|
+
| File | Line | Reference | Usage | Risk | Recommendation |
|
|
20
|
+
|---|---:|---|---|---|---|
|
|
21
|
+
| _None found_ | | | No `app.washday.mx` production app links found. | | |
|
|
22
|
+
|
|
23
|
+
### 2. Auth / OAuth / callback URLs
|
|
24
|
+
|
|
25
|
+
| File | Line | Reference | Usage | Risk | Recommendation |
|
|
26
|
+
|---|---:|---|---|---|---|
|
|
27
|
+
| `src/api/integrations/post.ts` | 7 | `redirectUri` | SDK method accepts caller-provided redirect URI for integration OAuth. | Low | Support both app.washday.mx and app.washdaypos.com |
|
|
28
|
+
|
|
29
|
+
### 3. Payments / billing redirects
|
|
30
|
+
|
|
31
|
+
| File | Line | Reference | Usage | Risk | Recommendation |
|
|
32
|
+
|---|---:|---|---|---|---|
|
|
33
|
+
| _None found_ | | | No Washday app-domain payment redirects found. | | |
|
|
34
|
+
|
|
35
|
+
### 4. Emails / notifications / templates
|
|
36
|
+
|
|
37
|
+
| File | Line | Reference | Usage | Risk | Recommendation |
|
|
38
|
+
|---|---:|---|---|---|---|
|
|
39
|
+
| `test/auth.forgotPasswordBinding.test.ts` | 33, 38 | `rene@washday.mx` | Test email fixture for forgot-password binding. | Low | Email domain — keep washday.mx for now |
|
|
40
|
+
|
|
41
|
+
### 5. CORS / allowed origins / security
|
|
42
|
+
|
|
43
|
+
| File | Line | Reference | Usage | Risk | Recommendation |
|
|
44
|
+
|---|---:|---|---|---|---|
|
|
45
|
+
| `src/api/axiosInstance.ts` | 7-10 | `DEV_BASE_URL`, `STAGE_BASE_URL`, `PROD_BASE_URL`, `BASE_URL` | Hardcoded backend API base URLs; no app-domain usage. | Medium | Leave unchanged for now |
|
|
46
|
+
|
|
47
|
+
### 6. Analytics / support / third-party integrations
|
|
48
|
+
|
|
49
|
+
| File | Line | Reference | Usage | Risk | Recommendation |
|
|
50
|
+
|---|---:|---|---|---|---|
|
|
51
|
+
| _None found_ | | | No Washday app-domain reference found in third-party integration files searched. | | |
|
|
52
|
+
|
|
53
|
+
### 7. Documentation-only references
|
|
54
|
+
|
|
55
|
+
| File | Line | Reference | Usage | Risk | Recommendation |
|
|
56
|
+
|---|---:|---|---|---|---|
|
|
57
|
+
| _None found_ | | | No documentation-only `app.washday.mx` reference found. | | |
|
|
58
|
+
|
|
59
|
+
### 8. Email references — keep for now
|
|
60
|
+
|
|
61
|
+
These references use `@washday.mx` or email-related domain values. We are intentionally keeping these for now.
|
|
62
|
+
|
|
63
|
+
| File | Line | Reference | Usage | Action |
|
|
64
|
+
|---|---:|---|---|---|
|
|
65
|
+
| `test/auth.forgotPasswordBinding.test.ts` | 33, 38 | `rene@washday.mx` | Test email fixture for forgot-password binding. | Email domain — keep washday.mx for now |
|
|
66
|
+
|
|
67
|
+
## Recommended migration plan for this repo
|
|
68
|
+
|
|
69
|
+
### Safe to leave unchanged for now
|
|
70
|
+
|
|
71
|
+
- Test email fixture using `@washday.mx`.
|
|
72
|
+
- Existing SDK behavior for caller-provided `redirectUri`.
|
|
73
|
+
|
|
74
|
+
### Should become environment/config driven
|
|
75
|
+
|
|
76
|
+
- No `app.washday.mx` value found. Separately consider whether SDK backend API base URLs should be configurable.
|
|
77
|
+
|
|
78
|
+
### Needs provider whitelist/callback update before changing
|
|
79
|
+
|
|
80
|
+
- No provider callback hardcoding found in this repo. Backend and frontend provider changes should happen before SDK callers switch redirect URIs.
|
|
81
|
+
|
|
82
|
+
### Needs product decision before changing
|
|
83
|
+
|
|
84
|
+
- Whether SDK default backend hosts should remain Heroku-specific is outside this app-domain audit.
|
|
85
|
+
|
|
86
|
+
## Notes
|
|
87
|
+
|
|
88
|
+
- Do not change runtime behavior in this audit PR.
|
|
89
|
+
- Do not replace `app.washday.mx` yet.
|
|
90
|
+
- Do not migrate email sender domains yet.
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
|
|
3
|
+
const REGULAR_USER_AUTH = "api/auth";
|
|
4
|
+
|
|
5
|
+
export const getSignupCountrySuggestion = async function (
|
|
6
|
+
this: WashdayClientInstance,
|
|
7
|
+
): Promise<any> {
|
|
8
|
+
try {
|
|
9
|
+
const config = {};
|
|
10
|
+
return await this.axiosInstance.get(
|
|
11
|
+
`${REGULAR_USER_AUTH}/signup-country-suggestion`,
|
|
12
|
+
config,
|
|
13
|
+
);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error("Error fetching getSignupCountrySuggestion:", error);
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
};
|
package/src/api/auth/index.ts
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -131,6 +131,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
131
131
|
customersAppForgotPassword: authEndpoints.postModule.customersAppForgotPassword,
|
|
132
132
|
customersAppChangePassword: authEndpoints.postModule.customersAppChangePassword,
|
|
133
133
|
companySignUp: authEndpoints.postModule.companySignUp,
|
|
134
|
+
getSignupCountrySuggestion: authEndpoints.getModule.getSignupCountrySuggestion,
|
|
134
135
|
});
|
|
135
136
|
this.orders = bindMethods(this, {
|
|
136
137
|
getList: ordersEndpoints.getModule.getList,
|
package/src/api/order/get.ts
CHANGED
|
@@ -33,6 +33,7 @@ export const getList = async function (this: WashdayClientInstance, params: {
|
|
|
33
33
|
fetchSection?: string,
|
|
34
34
|
cfdiId?: string,
|
|
35
35
|
customerId?: string,
|
|
36
|
+
assignedEmployee?: string,
|
|
36
37
|
}, options?: { signal?: GenericAbortSignal }): Promise<any> {
|
|
37
38
|
try {
|
|
38
39
|
const config = {
|
|
@@ -63,6 +64,7 @@ export const getList = async function (this: WashdayClientInstance, params: {
|
|
|
63
64
|
'fetchSection',
|
|
64
65
|
'cfdiId',
|
|
65
66
|
'customerId',
|
|
67
|
+
'assignedEmployee',
|
|
66
68
|
], params);
|
|
67
69
|
// ], { ...params, q: params.q ? encodeURIComponent(params.q) : undefined });
|
|
68
70
|
return await this.axiosInstance.get(`${GET_SET_ORDER}?${queryParams}`, config);
|
package/src/index.ts
CHANGED
package/src/interfaces/Api.ts
CHANGED
|
@@ -89,6 +89,7 @@ export interface WashdayClientInstance {
|
|
|
89
89
|
customersAppForgotPassword: typeof authEndpoints.postModule.customersAppForgotPassword;
|
|
90
90
|
customersAppChangePassword: typeof authEndpoints.postModule.customersAppChangePassword;
|
|
91
91
|
companySignUp: typeof authEndpoints.postModule.companySignUp;
|
|
92
|
+
getSignupCountrySuggestion: typeof authEndpoints.getModule.getSignupCountrySuggestion;
|
|
92
93
|
}
|
|
93
94
|
review: {
|
|
94
95
|
getList: typeof reviewsEndpoints.getModule.getList;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type SignupCountryIso = "MX" | "PE";
|
|
2
|
+
export type SignupCountrySuggestionSource = "ip" | "fallback" | "unknown";
|
|
3
|
+
export type SignupCountrySuggestionConfidence = "medium" | "low";
|
|
4
|
+
|
|
5
|
+
export interface SignupCountrySuggestion {
|
|
6
|
+
countryIso: SignupCountryIso;
|
|
7
|
+
source: SignupCountrySuggestionSource;
|
|
8
|
+
confidence: SignupCountrySuggestionConfidence;
|
|
9
|
+
}
|
|
@@ -74,6 +74,7 @@ export interface IOrderProduct extends IProduct {
|
|
|
74
74
|
qty?: number
|
|
75
75
|
|
|
76
76
|
// Operational line-level status fields (added 2026-04-04)
|
|
77
|
+
assignedEmployee?: IUser | string | null,
|
|
77
78
|
status?: OrderProductLineStatus,
|
|
78
79
|
cleanedDateTime?: Date | null, // set on → ready (cleaning completed)
|
|
79
80
|
readyDateTime?: Date | null, // set on → ready; currently always equals cleanedDateTime
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const mockGet = jest.fn().mockResolvedValue({
|
|
2
|
+
data: {
|
|
3
|
+
data: {
|
|
4
|
+
countryIso: "PE",
|
|
5
|
+
source: "ip",
|
|
6
|
+
confidence: "medium",
|
|
7
|
+
},
|
|
8
|
+
errors: null,
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
jest.mock("../src/api/axiosInstance", () => ({
|
|
13
|
+
__esModule: true,
|
|
14
|
+
getAxiosInstance: jest.fn(() => ({
|
|
15
|
+
get: mockGet,
|
|
16
|
+
interceptors: {
|
|
17
|
+
request: {
|
|
18
|
+
use: jest.fn(),
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
})),
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
import WashdayClient from "../src/api";
|
|
25
|
+
|
|
26
|
+
describe("WashdayClient signup country suggestion binding", () => {
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
jest.clearAllMocks();
|
|
29
|
+
mockGet.mockClear();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("binds auth.getSignupCountrySuggestion to the public GET endpoint", async () => {
|
|
33
|
+
const client = new (WashdayClient as any)("token-that-should-not-be-used");
|
|
34
|
+
|
|
35
|
+
const result = await client.auth.getSignupCountrySuggestion();
|
|
36
|
+
|
|
37
|
+
expect(mockGet).toHaveBeenCalledWith(
|
|
38
|
+
"api/auth/signup-country-suggestion",
|
|
39
|
+
{}
|
|
40
|
+
);
|
|
41
|
+
expect(result.data.data.countryIso).toBe("PE");
|
|
42
|
+
expect(result.data.errors).toBeNull();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getList } from "../src/api/order/get";
|
|
2
|
+
|
|
3
|
+
describe("orders.getList assignedEmployee filter", () => {
|
|
4
|
+
it("passes assignedEmployee through the order list query string", async () => {
|
|
5
|
+
const get = jest.fn().mockResolvedValue({
|
|
6
|
+
data: {
|
|
7
|
+
data: {
|
|
8
|
+
orders: [],
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
const client = {
|
|
13
|
+
apiToken: "token-123",
|
|
14
|
+
axiosInstance: { get },
|
|
15
|
+
} as any;
|
|
16
|
+
|
|
17
|
+
const result = await getList.call(client, {
|
|
18
|
+
store: undefined,
|
|
19
|
+
storeId: "store-1",
|
|
20
|
+
status: undefined,
|
|
21
|
+
name: undefined,
|
|
22
|
+
phone: undefined,
|
|
23
|
+
email: undefined,
|
|
24
|
+
fromDate: undefined,
|
|
25
|
+
toDate: undefined,
|
|
26
|
+
sequence: undefined,
|
|
27
|
+
pageNum: "0",
|
|
28
|
+
limit: "20",
|
|
29
|
+
sequenceSort: "-1",
|
|
30
|
+
cleanedDateTime: undefined,
|
|
31
|
+
readyDateTime: undefined,
|
|
32
|
+
collectedDateTime: undefined,
|
|
33
|
+
q: undefined,
|
|
34
|
+
pickupFromDate: undefined,
|
|
35
|
+
pickupToDate: undefined,
|
|
36
|
+
deliveryFromDate: undefined,
|
|
37
|
+
deliveryToDate: undefined,
|
|
38
|
+
assignedEmployee: "employee-1",
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
expect(get).toHaveBeenCalledWith(
|
|
42
|
+
"api/v2/order?store=undefined&storeId=store-1&status=undefined&name=undefined&phone=undefined&email=undefined&fromDate=undefined&toDate=undefined&sequence=undefined&pageNum=0&limit=20&sequenceSort=-1&cleanedDateTime=undefined&readyDateTime=undefined&collectedDateTime=undefined&q=undefined&pickupFromDate=undefined&pickupToDate=undefined&deliveryFromDate=undefined&deliveryToDate=undefined&assignedEmployee=employee-1",
|
|
43
|
+
{
|
|
44
|
+
headers: { Authorization: "Bearer token-123" },
|
|
45
|
+
signal: undefined,
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
expect(result).toEqual({
|
|
49
|
+
data: {
|
|
50
|
+
data: {
|
|
51
|
+
orders: [],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|