@congminh1254/shopee-sdk 0.5.0 → 0.7.0
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/README.md +7 -6
- package/lib/errors.js +2 -2
- package/lib/fetch.d.ts +2 -2
- package/lib/fetch.js +17 -14
- package/lib/fetch.js.map +1 -1
- package/lib/managers/account-health.manager.d.ts +208 -0
- package/lib/managers/account-health.manager.js +257 -0
- package/lib/managers/account-health.manager.js.map +1 -0
- package/lib/managers/ads.manager.js +22 -22
- package/lib/managers/ads.manager.js.map +1 -1
- package/lib/managers/auth.manager.d.ts +3 -3
- package/lib/managers/auth.manager.js +21 -12
- package/lib/managers/auth.manager.js.map +1 -1
- package/lib/managers/base.manager.d.ts +1 -1
- package/lib/managers/index.d.ts +11 -10
- package/lib/managers/index.js +11 -10
- package/lib/managers/index.js.map +1 -1
- package/lib/managers/logistics.manager.js +2 -2
- package/lib/managers/logistics.manager.js.map +1 -1
- package/lib/managers/order.manager.d.ts +3 -3
- package/lib/managers/order.manager.js +25 -25
- package/lib/managers/order.manager.js.map +1 -1
- package/lib/managers/payment.manager.js +2 -2
- package/lib/managers/payment.manager.js.map +1 -1
- package/lib/managers/product.manager.d.ts +3 -3
- package/lib/managers/product.manager.js +10 -10
- package/lib/managers/product.manager.js.map +1 -1
- package/lib/managers/public.manager.d.ts +3 -3
- package/lib/managers/public.manager.js +8 -8
- package/lib/managers/push.manager.d.ts +3 -3
- package/lib/managers/push.manager.js +11 -11
- package/lib/managers/push.manager.js.map +1 -1
- package/lib/managers/voucher.manager.js +12 -12
- package/lib/managers/voucher.manager.js.map +1 -1
- package/lib/schemas/access-token.d.ts +2 -1
- package/lib/schemas/account-health.d.ts +734 -0
- package/lib/schemas/account-health.js +200 -0
- package/lib/schemas/account-health.js.map +1 -0
- package/lib/schemas/attribute.d.ts +4 -4
- package/lib/schemas/fetch.d.ts +2 -2
- package/lib/schemas/index.d.ts +13 -12
- package/lib/schemas/index.js +13 -12
- package/lib/schemas/index.js.map +1 -1
- package/lib/schemas/logistics.d.ts +1 -1
- package/lib/schemas/order.d.ts +26 -26
- package/lib/schemas/order.js +1 -1
- package/lib/schemas/payment.d.ts +1 -1
- package/lib/schemas/product.d.ts +1 -1
- package/lib/schemas/product.js +0 -1
- package/lib/schemas/product.js.map +1 -1
- package/lib/schemas/push.d.ts +1 -1
- package/lib/schemas/region.js +5 -5
- package/lib/schemas/voucher.js.map +1 -1
- package/lib/sdk.d.ts +14 -12
- package/lib/sdk.js +17 -19
- package/lib/sdk.js.map +1 -1
- package/lib/storage/custom-token-storage.d.ts +2 -2
- package/lib/storage/custom-token-storage.js +11 -11
- package/lib/storage/custom-token-storage.js.map +1 -1
- package/lib/storage/token-storage.interface.d.ts +1 -1
- package/lib/utils/signature.js +3 -6
- package/lib/utils/signature.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -11,19 +11,19 @@ npm install shopee-sdk
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { ShopeeClient } from
|
|
14
|
+
import { ShopeeClient } from "shopee-sdk";
|
|
15
15
|
|
|
16
16
|
// Initialize the client
|
|
17
17
|
const client = new ShopeeClient({
|
|
18
18
|
partner_id: 123456,
|
|
19
|
-
partner_key:
|
|
20
|
-
base_url:
|
|
19
|
+
partner_key: "your-partner-key",
|
|
20
|
+
base_url: "https://partner.test-stable.shopeemobile.com", // For sandbox
|
|
21
21
|
// base_url: 'https://partner.shopeemobile.com', // For production
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
// Authenticate (if working with shop-level APIs)
|
|
25
25
|
await client.auth.getToken({
|
|
26
|
-
code:
|
|
26
|
+
code: "authorization-code",
|
|
27
27
|
shop_id: 123456,
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -43,7 +43,7 @@ const voucher = await client.voucher.addVoucher({
|
|
|
43
43
|
reward_type: 1, // fixed amount
|
|
44
44
|
usage_quantity: 100,
|
|
45
45
|
min_basket_price: 20,
|
|
46
|
-
discount_amount: 10
|
|
46
|
+
discount_amount: 10,
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
// Example: Get lost push messages (partner-level API, no auth required)
|
|
@@ -73,6 +73,7 @@ Examples of commit messages:
|
|
|
73
73
|
This project uses [Release Please](https://github.com/googleapis/release-please) to automate version management and releases.
|
|
74
74
|
|
|
75
75
|
The release process follows these steps:
|
|
76
|
+
|
|
76
77
|
1. Commits to the main branch are automatically analyzed
|
|
77
78
|
2. When conventional commit messages are detected, Release Please creates or updates a release PR
|
|
78
79
|
3. When the release PR is merged:
|
|
@@ -82,4 +83,4 @@ The release process follows these steps:
|
|
|
82
83
|
|
|
83
84
|
## License
|
|
84
85
|
|
|
85
|
-
MIT
|
|
86
|
+
MIT
|
package/lib/errors.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export class ShopeeSdkError extends Error {
|
|
2
2
|
constructor(message) {
|
|
3
3
|
super(message);
|
|
4
|
-
this.name =
|
|
4
|
+
this.name = "ShopeeSdkError";
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
export class ShopeeApiError extends Error {
|
|
8
8
|
constructor(status, data) {
|
|
9
9
|
super(`API Error: ${status} - ${JSON.stringify(data)}`);
|
|
10
|
-
this.name =
|
|
10
|
+
this.name = "ShopeeApiError";
|
|
11
11
|
this.status = status;
|
|
12
12
|
this.data = data;
|
|
13
13
|
}
|
package/lib/fetch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ShopeeConfig } from
|
|
2
|
-
import { FetchOptions } from
|
|
1
|
+
import { ShopeeConfig } from "./sdk.js";
|
|
2
|
+
import { FetchOptions } from "./schemas/fetch.js";
|
|
3
3
|
export declare class ShopeeFetch {
|
|
4
4
|
static fetch<T>(config: ShopeeConfig, path: string, options?: FetchOptions): Promise<T>;
|
|
5
5
|
}
|
package/lib/fetch.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import fetch, { Headers } from
|
|
2
|
-
import { ShopeeApiError, ShopeeSdkError } from
|
|
3
|
-
import { generateSignature } from
|
|
1
|
+
import fetch, { Headers } from "node-fetch";
|
|
2
|
+
import { ShopeeApiError, ShopeeSdkError } from "./errors.js";
|
|
3
|
+
import { generateSignature } from "./utils/signature.js";
|
|
4
4
|
export class ShopeeFetch {
|
|
5
5
|
static async fetch(config, path, options = {}) {
|
|
6
|
-
const { method =
|
|
6
|
+
const { method = "GET", params = {}, body } = options;
|
|
7
7
|
const url = new URL(`${config.base_url}${path}`);
|
|
8
8
|
// Add required parameters
|
|
9
9
|
const timestamp = Math.floor(Date.now() / 1000);
|
|
@@ -21,9 +21,12 @@ export class ShopeeFetch {
|
|
|
21
21
|
};
|
|
22
22
|
let authParams = {};
|
|
23
23
|
if (options.auth) {
|
|
24
|
-
|
|
24
|
+
let token = await config.sdk?.getAuthToken();
|
|
25
|
+
if (token?.expired_at && token.expired_at < Date.now()) {
|
|
26
|
+
token = await config.sdk?.refreshToken();
|
|
27
|
+
}
|
|
25
28
|
if (!token) {
|
|
26
|
-
throw new ShopeeSdkError(
|
|
29
|
+
throw new ShopeeSdkError("No access token found");
|
|
27
30
|
}
|
|
28
31
|
authParams = {
|
|
29
32
|
access_token: token?.access_token,
|
|
@@ -39,7 +42,7 @@ export class ShopeeFetch {
|
|
|
39
42
|
}
|
|
40
43
|
Object.entries({ ...allParams, ...authParams, sign: signature }).forEach(([key, value]) => {
|
|
41
44
|
if (Array.isArray(value)) {
|
|
42
|
-
value.forEach(item => {
|
|
45
|
+
value.forEach((item) => {
|
|
43
46
|
url.searchParams.append(key, String(item));
|
|
44
47
|
});
|
|
45
48
|
}
|
|
@@ -49,7 +52,7 @@ export class ShopeeFetch {
|
|
|
49
52
|
});
|
|
50
53
|
// Prepare headers
|
|
51
54
|
const headers = new Headers();
|
|
52
|
-
headers.set(
|
|
55
|
+
headers.set("Content-Type", "application/json");
|
|
53
56
|
if (options.headers) {
|
|
54
57
|
Object.entries(options.headers).forEach(([key, value]) => {
|
|
55
58
|
headers.set(key, value);
|
|
@@ -63,14 +66,14 @@ export class ShopeeFetch {
|
|
|
63
66
|
};
|
|
64
67
|
try {
|
|
65
68
|
const response = await fetch(url.toString(), requestOptions);
|
|
66
|
-
const responseType = response.headers.get(
|
|
67
|
-
const responseData = responseType?.indexOf(
|
|
69
|
+
const responseType = response.headers.get("Content-Type");
|
|
70
|
+
const responseData = responseType?.indexOf("application/json") !== -1
|
|
68
71
|
? await response.json()
|
|
69
72
|
: await response.text();
|
|
70
|
-
if (responseType?.indexOf(
|
|
73
|
+
if (responseType?.indexOf("application/json") !== -1) {
|
|
71
74
|
if (responseData.error) {
|
|
72
75
|
// Handle invalid access token error
|
|
73
|
-
if (responseData.error ===
|
|
76
|
+
if (responseData.error === "invalid_acceess_token" && options.auth) {
|
|
74
77
|
try {
|
|
75
78
|
// Attempt to refresh the access token
|
|
76
79
|
await config.sdk?.refreshToken();
|
|
@@ -91,14 +94,14 @@ export class ShopeeFetch {
|
|
|
91
94
|
}
|
|
92
95
|
catch (error) {
|
|
93
96
|
if (error instanceof Error) {
|
|
94
|
-
if (error.name ===
|
|
97
|
+
if (error.name === "FetchError") {
|
|
95
98
|
// Network error
|
|
96
99
|
throw new ShopeeSdkError(`Network error: ${error.message}`);
|
|
97
100
|
}
|
|
98
101
|
// Other errors
|
|
99
102
|
throw new ShopeeSdkError(`Unexpected error: ${error.message}`);
|
|
100
103
|
}
|
|
101
|
-
throw new ShopeeSdkError(
|
|
104
|
+
throw new ShopeeSdkError("Unknown error occurred");
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
}
|
package/lib/fetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAyB,OAAO,EAAe,MAAM,YAAY,CAAC;AAGhF,OAAO,EAAE,cAAc,E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cAAc,CAAC,wBAAwB,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { ShopeeConfig } from "../sdk.js";
|
|
2
|
+
import { BaseManager } from "./base.manager.js";
|
|
3
|
+
import { GetShopPenaltyResponse, GetShopPerformanceResponse, GetMetricSourceDetailParams, GetMetricSourceDetailResponse, GetPenaltyPointHistoryParams, GetPenaltyPointHistoryResponse, GetPunishmentHistoryParams, GetPunishmentHistoryResponse, GetListingsWithIssuesParams, GetListingsWithIssuesResponse, GetLateOrdersParams, GetLateOrdersResponse } from "../schemas/account-health.js";
|
|
4
|
+
export declare class AccountHealthManager extends BaseManager {
|
|
5
|
+
constructor(config: ShopeeConfig);
|
|
6
|
+
/**
|
|
7
|
+
* Get the information of shop penalty
|
|
8
|
+
* @returns {Promise<GetShopPenaltyResponse>} Response containing penalty points and ongoing punishments
|
|
9
|
+
*
|
|
10
|
+
* This API returns the seller's shop penalty information, including:
|
|
11
|
+
*
|
|
12
|
+
* - Penalty points that remain on record till the end of a quarter (reset on the first Monday of each quarter)
|
|
13
|
+
* - Overall penalty points total
|
|
14
|
+
* - Points from non-fulfillment rate issues
|
|
15
|
+
* - Points from late shipment issues
|
|
16
|
+
* - Points from listing violations
|
|
17
|
+
* - Points from OPFR (Order Pick-up Failure Rate) violations
|
|
18
|
+
* - Points from other violations
|
|
19
|
+
*
|
|
20
|
+
* - List of ongoing punishments with details about:
|
|
21
|
+
* - Punishment tier (1-5)
|
|
22
|
+
* - Days left in the punishment period
|
|
23
|
+
* - Name of the punishment (e.g., "deboost")
|
|
24
|
+
*
|
|
25
|
+
* Use this API to monitor your shop's health status and take proactive measures
|
|
26
|
+
* to address any issues that could affect your shop's performance.
|
|
27
|
+
*/
|
|
28
|
+
getShopPenalty(): Promise<GetShopPenaltyResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Get data metrics of shop performance
|
|
31
|
+
* @returns {Promise<GetShopPerformanceResponse>} Response containing shop performance metrics
|
|
32
|
+
*
|
|
33
|
+
* This API returns comprehensive data metrics about a shop's performance across three
|
|
34
|
+
* key dimensions:
|
|
35
|
+
*
|
|
36
|
+
* 1. Fulfillment Performance - Metrics related to order processing and logistics:
|
|
37
|
+
* - Late Shipment Rate
|
|
38
|
+
* - Non-Fulfillment Rate
|
|
39
|
+
* - Preparation Time
|
|
40
|
+
* - Fast Handover Rate
|
|
41
|
+
* - Cancellation Rate
|
|
42
|
+
* - Return-refund Rate
|
|
43
|
+
* - On-time Pickup Failure Rate
|
|
44
|
+
*
|
|
45
|
+
* 2. Listing Performance - Metrics related to product listings quality:
|
|
46
|
+
* - Severe Listing Violations (Prohibited, Counterfeit/IP infringement, Spam)
|
|
47
|
+
* - Pre-order Listing percentage and days in violation
|
|
48
|
+
* - Other Listing Violations
|
|
49
|
+
*
|
|
50
|
+
* 3. Customer Service Performance - Metrics related to customer interactions:
|
|
51
|
+
* - Chat Response Rate
|
|
52
|
+
* - Response Time
|
|
53
|
+
* - Shop Rating
|
|
54
|
+
* - Non-Responded Chats
|
|
55
|
+
*
|
|
56
|
+
* The response includes both overall performance ratings and detailed metrics with:
|
|
57
|
+
* - Current and previous period performance values
|
|
58
|
+
* - Target values with comparators (e.g., "<", ">=") to meet performance standards
|
|
59
|
+
* - Units of measurement (percentage, number, days, etc.)
|
|
60
|
+
* - Parent-child relationship between metrics
|
|
61
|
+
*
|
|
62
|
+
* Use this API to gain insights into shop performance and identify areas
|
|
63
|
+
* for improvement to maintain good shop health.
|
|
64
|
+
*/
|
|
65
|
+
getShopPerformance(): Promise<GetShopPerformanceResponse>;
|
|
66
|
+
/**
|
|
67
|
+
* Get the Affected Orders / Relevant Listings / Relevant Violations details of metrics
|
|
68
|
+
* @param {GetMetricSourceDetailParams} params Request parameters
|
|
69
|
+
* @param {number} params.metric_id ID of metric to get details for
|
|
70
|
+
* @param {number} [params.page_no] Page number, starting from 1 (default: 1)
|
|
71
|
+
* @param {number} [params.page_size] Number of items per page, 1-100 (default: 10)
|
|
72
|
+
* @returns {Promise<GetMetricSourceDetailResponse>} Response containing detailed information about the metric
|
|
73
|
+
*
|
|
74
|
+
* This API returns detailed information about specific metrics, including affected orders,
|
|
75
|
+
* relevant listings, or violation details. The response structure varies based on the
|
|
76
|
+
* metric_id provided:
|
|
77
|
+
*
|
|
78
|
+
* - Non-Fulfillment Rate metrics (3, 88): Returns `nfr_order_list` with affected orders
|
|
79
|
+
* - Cancellation Rate metrics (42, 91): Returns `cancellation_order_list` with affected orders
|
|
80
|
+
* - Return-refund Rate metrics (43, 92): Returns `return_refund_order_list` with affected orders
|
|
81
|
+
* - Late Shipment Rate metrics (1, 85): Returns `lsr_order_list` with late shipment details
|
|
82
|
+
* - Fast Handover Rate metrics (25, 2001-2003): Returns `fhr_order_list` with handover details
|
|
83
|
+
* - On-time Pickup Failure Rate (28): Returns `opfr_day_detail_data_list` with daily violation data
|
|
84
|
+
* - Listing Violations (52, 53): Returns `violation_listing_list` with problematic listings
|
|
85
|
+
* - Pre-order Listing Violation (15): Returns `pre_order_listing_violation_data_list` with daily data
|
|
86
|
+
* - Pre-order Listing % (12): Returns `pre_order_listing_list` with pre-order listings
|
|
87
|
+
* - NDD Listings % (97): Returns `ndd_listing_list` with NDD-enabled listings
|
|
88
|
+
*
|
|
89
|
+
* The response is paginated - use page_no and page_size to navigate through the results.
|
|
90
|
+
* The total_count field indicates the total number of items available across all pages.
|
|
91
|
+
*
|
|
92
|
+
* Use this API to identify specific orders or listings that are affecting your shop's
|
|
93
|
+
* performance metrics and take corrective actions.
|
|
94
|
+
*/
|
|
95
|
+
getMetricSourceDetail(params: GetMetricSourceDetailParams): Promise<GetMetricSourceDetailResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* Get the penalty point records generated in the current quarter
|
|
98
|
+
* @param {GetPenaltyPointHistoryParams} [params] Optional request parameters
|
|
99
|
+
* @param {number} [params.page_no] Page number, starting from 1 (default: 1)
|
|
100
|
+
* @param {number} [params.page_size] Number of items per page, 1-100 (default: 10)
|
|
101
|
+
* @param {number} [params.violation_type] Filter by specific violation type (see ViolationType enum)
|
|
102
|
+
* @returns {Promise<GetPenaltyPointHistoryResponse>} Response containing penalty point records
|
|
103
|
+
*
|
|
104
|
+
* This API returns detailed records of penalty points that have been issued to the shop
|
|
105
|
+
* during the current quarter. Each record includes:
|
|
106
|
+
*
|
|
107
|
+
* - The time when the penalty points were issued
|
|
108
|
+
* - The number of points (both original and current after any adjustments via appeals)
|
|
109
|
+
* - A unique reference ID for the penalty
|
|
110
|
+
* - The type of violation that triggered the penalty
|
|
111
|
+
*
|
|
112
|
+
* Use this API to track and analyze penalty points history, which can help in:
|
|
113
|
+
* - Understanding what types of violations are impacting your shop health
|
|
114
|
+
* - Monitoring the effects of appeals on penalty points
|
|
115
|
+
* - Tracking progress over time in reducing violations
|
|
116
|
+
*
|
|
117
|
+
* The response is paginated - use page_no and page_size to navigate through the results.
|
|
118
|
+
* You can also filter by violation_type to focus on specific types of issues.
|
|
119
|
+
*
|
|
120
|
+
* Note: Penalty points reset at the beginning of each quarter (on the first Monday).
|
|
121
|
+
*/
|
|
122
|
+
getPenaltyPointHistory(params?: GetPenaltyPointHistoryParams): Promise<GetPenaltyPointHistoryResponse>;
|
|
123
|
+
/**
|
|
124
|
+
* Get the punishment records generated in the current quarter
|
|
125
|
+
* @param {GetPunishmentHistoryParams} params Request parameters
|
|
126
|
+
* @param {number} params.punishment_status Status of punishments to retrieve (1=Ongoing, 2=Ended)
|
|
127
|
+
* @param {number} [params.page_no] Page number, starting from 1 (default: 1)
|
|
128
|
+
* @param {number} [params.page_size] Number of items per page, 1-100 (default: 10)
|
|
129
|
+
* @returns {Promise<GetPunishmentHistoryResponse>} Response containing punishment records
|
|
130
|
+
*
|
|
131
|
+
* This API returns detailed records of punishments that have been applied to the shop
|
|
132
|
+
* during the current quarter. Each punishment record includes:
|
|
133
|
+
*
|
|
134
|
+
* - The time when the punishment was issued
|
|
135
|
+
* - Start and end times of the punishment period
|
|
136
|
+
* - Type of punishment (e.g., listing restrictions, marketing restrictions)
|
|
137
|
+
* - Reason for the punishment (typically indicates the tier level)
|
|
138
|
+
* - A unique reference ID for the punishment
|
|
139
|
+
* - For listing limit punishments: the specific listing limit value
|
|
140
|
+
* - For order limit punishments: the percentage applied to order limits
|
|
141
|
+
*
|
|
142
|
+
* You can retrieve either ongoing punishments (punishment_status=1) or
|
|
143
|
+
* ended punishments (punishment_status=2).
|
|
144
|
+
*
|
|
145
|
+
* Common punishment types include:
|
|
146
|
+
* - Listings not displayed in search or category browsing
|
|
147
|
+
* - Unable to create or edit listings
|
|
148
|
+
* - Unable to join marketing campaigns
|
|
149
|
+
* - No shipping subsidies
|
|
150
|
+
* - Account suspension
|
|
151
|
+
* - Listing limit reductions
|
|
152
|
+
* - Order limits
|
|
153
|
+
*
|
|
154
|
+
* The response is paginated - use page_no and page_size to navigate through the results.
|
|
155
|
+
*
|
|
156
|
+
* Use this API to understand current restrictions on your shop and when they will expire.
|
|
157
|
+
*/
|
|
158
|
+
getPunishmentHistory(params: GetPunishmentHistoryParams): Promise<GetPunishmentHistoryResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* Get the listings that have issues and need improvement
|
|
161
|
+
* @param {GetListingsWithIssuesParams} [params] Optional request parameters
|
|
162
|
+
* @param {number} [params.page_no] Page number, starting from 1 (default: 1)
|
|
163
|
+
* @param {number} [params.page_size] Number of items per page, 1-100 (default: 10)
|
|
164
|
+
* @returns {Promise<GetListingsWithIssuesResponse>} Response containing listings with issues
|
|
165
|
+
*
|
|
166
|
+
* This API returns details of problematic listings that need improvement. Each listing record includes:
|
|
167
|
+
*
|
|
168
|
+
* - The item ID of the problematic listing
|
|
169
|
+
* - The reason for the issue, with possible values including:
|
|
170
|
+
* - Prohibited (1): Listing violates Shopee's prohibited items policy
|
|
171
|
+
* - Counterfeit (2): Listing is flagged as potentially counterfeit
|
|
172
|
+
* - Spam (3): Listing is identified as spam content
|
|
173
|
+
* - Inappropriate Image (4): Listing contains inappropriate images
|
|
174
|
+
* - Insufficient Info (5): Listing lacks required information
|
|
175
|
+
* - Mall Listing Improvement (6): Mall listing requiring improvement
|
|
176
|
+
* - Other Listing Improvement (7): Other issues requiring attention
|
|
177
|
+
*
|
|
178
|
+
* The response is paginated - use page_no and page_size to navigate through the results.
|
|
179
|
+
* The total_count field indicates the total number of listings with issues across all pages.
|
|
180
|
+
*
|
|
181
|
+
* Use this API to identify listings that need improvement to maintain good shop health
|
|
182
|
+
* and avoid potential penalties or restrictions on your shop.
|
|
183
|
+
*/
|
|
184
|
+
getListingsWithIssues(params?: GetListingsWithIssuesParams): Promise<GetListingsWithIssuesResponse>;
|
|
185
|
+
/**
|
|
186
|
+
* Get the late orders to take action to avoid order cancellation and penalty points
|
|
187
|
+
* @param {GetLateOrdersParams} [params] Optional request parameters
|
|
188
|
+
* @param {number} [params.page_no] Page number, starting from 1 (default: 1)
|
|
189
|
+
* @param {number} [params.page_size] Number of items per page, 1-100 (default: 10)
|
|
190
|
+
* @returns {Promise<GetLateOrdersResponse>} Response containing late orders information
|
|
191
|
+
*
|
|
192
|
+
* This API returns a list of orders that are late for shipping and require immediate
|
|
193
|
+
* attention to avoid potential cancellations and resulting penalty points.
|
|
194
|
+
* Each late order record includes:
|
|
195
|
+
*
|
|
196
|
+
* - The order SN (order number)
|
|
197
|
+
* - The shipping deadline timestamp
|
|
198
|
+
* - The number of days the order is late by
|
|
199
|
+
*
|
|
200
|
+
* The response is paginated - use page_no and page_size to navigate through the results.
|
|
201
|
+
* The total_count field indicates the total number of late orders across all pages.
|
|
202
|
+
*
|
|
203
|
+
* Use this API to prioritize shipping for late orders and take action to minimize
|
|
204
|
+
* late shipment rates, which can affect your shop's performance metrics and potentially
|
|
205
|
+
* result in penalties or restrictions on your shop.
|
|
206
|
+
*/
|
|
207
|
+
getLateOrders(params?: GetLateOrdersParams): Promise<GetLateOrdersResponse>;
|
|
208
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { BaseManager } from "./base.manager.js";
|
|
2
|
+
import { ShopeeFetch } from "../fetch.js";
|
|
3
|
+
export class AccountHealthManager extends BaseManager {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
super(config);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Get the information of shop penalty
|
|
9
|
+
* @returns {Promise<GetShopPenaltyResponse>} Response containing penalty points and ongoing punishments
|
|
10
|
+
*
|
|
11
|
+
* This API returns the seller's shop penalty information, including:
|
|
12
|
+
*
|
|
13
|
+
* - Penalty points that remain on record till the end of a quarter (reset on the first Monday of each quarter)
|
|
14
|
+
* - Overall penalty points total
|
|
15
|
+
* - Points from non-fulfillment rate issues
|
|
16
|
+
* - Points from late shipment issues
|
|
17
|
+
* - Points from listing violations
|
|
18
|
+
* - Points from OPFR (Order Pick-up Failure Rate) violations
|
|
19
|
+
* - Points from other violations
|
|
20
|
+
*
|
|
21
|
+
* - List of ongoing punishments with details about:
|
|
22
|
+
* - Punishment tier (1-5)
|
|
23
|
+
* - Days left in the punishment period
|
|
24
|
+
* - Name of the punishment (e.g., "deboost")
|
|
25
|
+
*
|
|
26
|
+
* Use this API to monitor your shop's health status and take proactive measures
|
|
27
|
+
* to address any issues that could affect your shop's performance.
|
|
28
|
+
*/
|
|
29
|
+
async getShopPenalty() {
|
|
30
|
+
const response = await ShopeeFetch.fetch(this.config, "/account_health/shop_penalty", {
|
|
31
|
+
method: "GET",
|
|
32
|
+
auth: true,
|
|
33
|
+
});
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get data metrics of shop performance
|
|
38
|
+
* @returns {Promise<GetShopPerformanceResponse>} Response containing shop performance metrics
|
|
39
|
+
*
|
|
40
|
+
* This API returns comprehensive data metrics about a shop's performance across three
|
|
41
|
+
* key dimensions:
|
|
42
|
+
*
|
|
43
|
+
* 1. Fulfillment Performance - Metrics related to order processing and logistics:
|
|
44
|
+
* - Late Shipment Rate
|
|
45
|
+
* - Non-Fulfillment Rate
|
|
46
|
+
* - Preparation Time
|
|
47
|
+
* - Fast Handover Rate
|
|
48
|
+
* - Cancellation Rate
|
|
49
|
+
* - Return-refund Rate
|
|
50
|
+
* - On-time Pickup Failure Rate
|
|
51
|
+
*
|
|
52
|
+
* 2. Listing Performance - Metrics related to product listings quality:
|
|
53
|
+
* - Severe Listing Violations (Prohibited, Counterfeit/IP infringement, Spam)
|
|
54
|
+
* - Pre-order Listing percentage and days in violation
|
|
55
|
+
* - Other Listing Violations
|
|
56
|
+
*
|
|
57
|
+
* 3. Customer Service Performance - Metrics related to customer interactions:
|
|
58
|
+
* - Chat Response Rate
|
|
59
|
+
* - Response Time
|
|
60
|
+
* - Shop Rating
|
|
61
|
+
* - Non-Responded Chats
|
|
62
|
+
*
|
|
63
|
+
* The response includes both overall performance ratings and detailed metrics with:
|
|
64
|
+
* - Current and previous period performance values
|
|
65
|
+
* - Target values with comparators (e.g., "<", ">=") to meet performance standards
|
|
66
|
+
* - Units of measurement (percentage, number, days, etc.)
|
|
67
|
+
* - Parent-child relationship between metrics
|
|
68
|
+
*
|
|
69
|
+
* Use this API to gain insights into shop performance and identify areas
|
|
70
|
+
* for improvement to maintain good shop health.
|
|
71
|
+
*/
|
|
72
|
+
async getShopPerformance() {
|
|
73
|
+
const response = await ShopeeFetch.fetch(this.config, "/account_health/get_shop_performance", {
|
|
74
|
+
method: "GET",
|
|
75
|
+
auth: true,
|
|
76
|
+
});
|
|
77
|
+
return response;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get the Affected Orders / Relevant Listings / Relevant Violations details of metrics
|
|
81
|
+
* @param {GetMetricSourceDetailParams} params Request parameters
|
|
82
|
+
* @param {number} params.metric_id ID of metric to get details for
|
|
83
|
+
* @param {number} [params.page_no] Page number, starting from 1 (default: 1)
|
|
84
|
+
* @param {number} [params.page_size] Number of items per page, 1-100 (default: 10)
|
|
85
|
+
* @returns {Promise<GetMetricSourceDetailResponse>} Response containing detailed information about the metric
|
|
86
|
+
*
|
|
87
|
+
* This API returns detailed information about specific metrics, including affected orders,
|
|
88
|
+
* relevant listings, or violation details. The response structure varies based on the
|
|
89
|
+
* metric_id provided:
|
|
90
|
+
*
|
|
91
|
+
* - Non-Fulfillment Rate metrics (3, 88): Returns `nfr_order_list` with affected orders
|
|
92
|
+
* - Cancellation Rate metrics (42, 91): Returns `cancellation_order_list` with affected orders
|
|
93
|
+
* - Return-refund Rate metrics (43, 92): Returns `return_refund_order_list` with affected orders
|
|
94
|
+
* - Late Shipment Rate metrics (1, 85): Returns `lsr_order_list` with late shipment details
|
|
95
|
+
* - Fast Handover Rate metrics (25, 2001-2003): Returns `fhr_order_list` with handover details
|
|
96
|
+
* - On-time Pickup Failure Rate (28): Returns `opfr_day_detail_data_list` with daily violation data
|
|
97
|
+
* - Listing Violations (52, 53): Returns `violation_listing_list` with problematic listings
|
|
98
|
+
* - Pre-order Listing Violation (15): Returns `pre_order_listing_violation_data_list` with daily data
|
|
99
|
+
* - Pre-order Listing % (12): Returns `pre_order_listing_list` with pre-order listings
|
|
100
|
+
* - NDD Listings % (97): Returns `ndd_listing_list` with NDD-enabled listings
|
|
101
|
+
*
|
|
102
|
+
* The response is paginated - use page_no and page_size to navigate through the results.
|
|
103
|
+
* The total_count field indicates the total number of items available across all pages.
|
|
104
|
+
*
|
|
105
|
+
* Use this API to identify specific orders or listings that are affecting your shop's
|
|
106
|
+
* performance metrics and take corrective actions.
|
|
107
|
+
*/
|
|
108
|
+
async getMetricSourceDetail(params) {
|
|
109
|
+
const response = await ShopeeFetch.fetch(this.config, "/account_health/get_metric_source_detail", {
|
|
110
|
+
method: "GET",
|
|
111
|
+
auth: true,
|
|
112
|
+
params,
|
|
113
|
+
});
|
|
114
|
+
return response;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get the penalty point records generated in the current quarter
|
|
118
|
+
* @param {GetPenaltyPointHistoryParams} [params] Optional request parameters
|
|
119
|
+
* @param {number} [params.page_no] Page number, starting from 1 (default: 1)
|
|
120
|
+
* @param {number} [params.page_size] Number of items per page, 1-100 (default: 10)
|
|
121
|
+
* @param {number} [params.violation_type] Filter by specific violation type (see ViolationType enum)
|
|
122
|
+
* @returns {Promise<GetPenaltyPointHistoryResponse>} Response containing penalty point records
|
|
123
|
+
*
|
|
124
|
+
* This API returns detailed records of penalty points that have been issued to the shop
|
|
125
|
+
* during the current quarter. Each record includes:
|
|
126
|
+
*
|
|
127
|
+
* - The time when the penalty points were issued
|
|
128
|
+
* - The number of points (both original and current after any adjustments via appeals)
|
|
129
|
+
* - A unique reference ID for the penalty
|
|
130
|
+
* - The type of violation that triggered the penalty
|
|
131
|
+
*
|
|
132
|
+
* Use this API to track and analyze penalty points history, which can help in:
|
|
133
|
+
* - Understanding what types of violations are impacting your shop health
|
|
134
|
+
* - Monitoring the effects of appeals on penalty points
|
|
135
|
+
* - Tracking progress over time in reducing violations
|
|
136
|
+
*
|
|
137
|
+
* The response is paginated - use page_no and page_size to navigate through the results.
|
|
138
|
+
* You can also filter by violation_type to focus on specific types of issues.
|
|
139
|
+
*
|
|
140
|
+
* Note: Penalty points reset at the beginning of each quarter (on the first Monday).
|
|
141
|
+
*/
|
|
142
|
+
async getPenaltyPointHistory(params) {
|
|
143
|
+
const response = await ShopeeFetch.fetch(this.config, "/account_health/get_penalty_point_history", {
|
|
144
|
+
method: "GET",
|
|
145
|
+
auth: true,
|
|
146
|
+
params,
|
|
147
|
+
});
|
|
148
|
+
return response;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get the punishment records generated in the current quarter
|
|
152
|
+
* @param {GetPunishmentHistoryParams} params Request parameters
|
|
153
|
+
* @param {number} params.punishment_status Status of punishments to retrieve (1=Ongoing, 2=Ended)
|
|
154
|
+
* @param {number} [params.page_no] Page number, starting from 1 (default: 1)
|
|
155
|
+
* @param {number} [params.page_size] Number of items per page, 1-100 (default: 10)
|
|
156
|
+
* @returns {Promise<GetPunishmentHistoryResponse>} Response containing punishment records
|
|
157
|
+
*
|
|
158
|
+
* This API returns detailed records of punishments that have been applied to the shop
|
|
159
|
+
* during the current quarter. Each punishment record includes:
|
|
160
|
+
*
|
|
161
|
+
* - The time when the punishment was issued
|
|
162
|
+
* - Start and end times of the punishment period
|
|
163
|
+
* - Type of punishment (e.g., listing restrictions, marketing restrictions)
|
|
164
|
+
* - Reason for the punishment (typically indicates the tier level)
|
|
165
|
+
* - A unique reference ID for the punishment
|
|
166
|
+
* - For listing limit punishments: the specific listing limit value
|
|
167
|
+
* - For order limit punishments: the percentage applied to order limits
|
|
168
|
+
*
|
|
169
|
+
* You can retrieve either ongoing punishments (punishment_status=1) or
|
|
170
|
+
* ended punishments (punishment_status=2).
|
|
171
|
+
*
|
|
172
|
+
* Common punishment types include:
|
|
173
|
+
* - Listings not displayed in search or category browsing
|
|
174
|
+
* - Unable to create or edit listings
|
|
175
|
+
* - Unable to join marketing campaigns
|
|
176
|
+
* - No shipping subsidies
|
|
177
|
+
* - Account suspension
|
|
178
|
+
* - Listing limit reductions
|
|
179
|
+
* - Order limits
|
|
180
|
+
*
|
|
181
|
+
* The response is paginated - use page_no and page_size to navigate through the results.
|
|
182
|
+
*
|
|
183
|
+
* Use this API to understand current restrictions on your shop and when they will expire.
|
|
184
|
+
*/
|
|
185
|
+
async getPunishmentHistory(params) {
|
|
186
|
+
const response = await ShopeeFetch.fetch(this.config, "/account_health/get_punishment_history", {
|
|
187
|
+
method: "GET",
|
|
188
|
+
auth: true,
|
|
189
|
+
params,
|
|
190
|
+
});
|
|
191
|
+
return response;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get the listings that have issues and need improvement
|
|
195
|
+
* @param {GetListingsWithIssuesParams} [params] Optional request parameters
|
|
196
|
+
* @param {number} [params.page_no] Page number, starting from 1 (default: 1)
|
|
197
|
+
* @param {number} [params.page_size] Number of items per page, 1-100 (default: 10)
|
|
198
|
+
* @returns {Promise<GetListingsWithIssuesResponse>} Response containing listings with issues
|
|
199
|
+
*
|
|
200
|
+
* This API returns details of problematic listings that need improvement. Each listing record includes:
|
|
201
|
+
*
|
|
202
|
+
* - The item ID of the problematic listing
|
|
203
|
+
* - The reason for the issue, with possible values including:
|
|
204
|
+
* - Prohibited (1): Listing violates Shopee's prohibited items policy
|
|
205
|
+
* - Counterfeit (2): Listing is flagged as potentially counterfeit
|
|
206
|
+
* - Spam (3): Listing is identified as spam content
|
|
207
|
+
* - Inappropriate Image (4): Listing contains inappropriate images
|
|
208
|
+
* - Insufficient Info (5): Listing lacks required information
|
|
209
|
+
* - Mall Listing Improvement (6): Mall listing requiring improvement
|
|
210
|
+
* - Other Listing Improvement (7): Other issues requiring attention
|
|
211
|
+
*
|
|
212
|
+
* The response is paginated - use page_no and page_size to navigate through the results.
|
|
213
|
+
* The total_count field indicates the total number of listings with issues across all pages.
|
|
214
|
+
*
|
|
215
|
+
* Use this API to identify listings that need improvement to maintain good shop health
|
|
216
|
+
* and avoid potential penalties or restrictions on your shop.
|
|
217
|
+
*/
|
|
218
|
+
async getListingsWithIssues(params) {
|
|
219
|
+
const response = await ShopeeFetch.fetch(this.config, "/account_health/get_listings_with_issues", {
|
|
220
|
+
method: "GET",
|
|
221
|
+
auth: true,
|
|
222
|
+
params,
|
|
223
|
+
});
|
|
224
|
+
return response;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Get the late orders to take action to avoid order cancellation and penalty points
|
|
228
|
+
* @param {GetLateOrdersParams} [params] Optional request parameters
|
|
229
|
+
* @param {number} [params.page_no] Page number, starting from 1 (default: 1)
|
|
230
|
+
* @param {number} [params.page_size] Number of items per page, 1-100 (default: 10)
|
|
231
|
+
* @returns {Promise<GetLateOrdersResponse>} Response containing late orders information
|
|
232
|
+
*
|
|
233
|
+
* This API returns a list of orders that are late for shipping and require immediate
|
|
234
|
+
* attention to avoid potential cancellations and resulting penalty points.
|
|
235
|
+
* Each late order record includes:
|
|
236
|
+
*
|
|
237
|
+
* - The order SN (order number)
|
|
238
|
+
* - The shipping deadline timestamp
|
|
239
|
+
* - The number of days the order is late by
|
|
240
|
+
*
|
|
241
|
+
* The response is paginated - use page_no and page_size to navigate through the results.
|
|
242
|
+
* The total_count field indicates the total number of late orders across all pages.
|
|
243
|
+
*
|
|
244
|
+
* Use this API to prioritize shipping for late orders and take action to minimize
|
|
245
|
+
* late shipment rates, which can affect your shop's performance metrics and potentially
|
|
246
|
+
* result in penalties or restrictions on your shop.
|
|
247
|
+
*/
|
|
248
|
+
async getLateOrders(params) {
|
|
249
|
+
const response = await ShopeeFetch.fetch(this.config, "/account_health/get_late_orders", {
|
|
250
|
+
method: "GET",
|
|
251
|
+
auth: true,
|
|
252
|
+
params,
|
|
253
|
+
});
|
|
254
|
+
return response;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=account-health.manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-health.manager.js","sourceRoot":"","sources":["../../src/managers/account-health.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAgB1C,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IACnD,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,cAAc;QAClB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,8BAA8B,EAC9B;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;SACX,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,KAAK,CAAC,kBAAkB;QACtB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MA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