@congminh1254/shopee-sdk 1.1.0 → 1.3.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/lib/fetch.js +6 -4
- package/lib/fetch.js.map +1 -1
- package/lib/managers/discount.manager.d.ts +47 -1
- package/lib/managers/discount.manager.js +67 -0
- package/lib/managers/discount.manager.js.map +1 -1
- package/lib/managers/returns.manager.d.ts +31 -1
- package/lib/managers/returns.manager.js +37 -0
- package/lib/managers/returns.manager.js.map +1 -1
- package/lib/schemas/discount.d.ts +67 -0
- package/lib/schemas/returns.d.ts +53 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +7 -8
package/lib/fetch.js
CHANGED
|
@@ -74,9 +74,11 @@ export class ShopeeFetch {
|
|
|
74
74
|
? await response.json()
|
|
75
75
|
: await response.text();
|
|
76
76
|
if (responseType?.indexOf("application/json") !== -1) {
|
|
77
|
-
|
|
77
|
+
// Type guard for JSON response with error field
|
|
78
|
+
const jsonData = responseData;
|
|
79
|
+
if (jsonData.error) {
|
|
78
80
|
// Handle invalid access token error
|
|
79
|
-
if (
|
|
81
|
+
if (jsonData.error === "invalid_acceess_token" && options.auth) {
|
|
80
82
|
try {
|
|
81
83
|
// Attempt to refresh the access token
|
|
82
84
|
await config.sdk?.refreshToken();
|
|
@@ -85,10 +87,10 @@ export class ShopeeFetch {
|
|
|
85
87
|
}
|
|
86
88
|
catch (refreshError) {
|
|
87
89
|
// If refresh fails, throw the original error
|
|
88
|
-
throw new ShopeeApiError(response.status,
|
|
90
|
+
throw new ShopeeApiError(response.status, jsonData);
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
|
-
throw new ShopeeApiError(response.status,
|
|
93
|
+
throw new ShopeeApiError(response.status, jsonData);
|
|
92
94
|
}
|
|
93
95
|
const data = responseData;
|
|
94
96
|
return data;
|
package/lib/fetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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BAAqB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACjE,CAAC;YACD,MAAM,IAAI,cAAc,CAAC,wBAAwB,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ShopeeConfig } from "../sdk.js";
|
|
2
2
|
import { BaseManager } from "./base.manager.js";
|
|
3
|
-
import { AddDiscountParams, AddDiscountResponse, AddDiscountItemParams, AddDiscountItemResponse, DeleteDiscountParams, DeleteDiscountResponse, DeleteDiscountItemParams, DeleteDiscountItemResponse, EndDiscountParams, EndDiscountResponse, GetDiscountParams, GetDiscountResponse, GetDiscountListParams, GetDiscountListResponse, UpdateDiscountParams, UpdateDiscountResponse, UpdateDiscountItemParams, UpdateDiscountItemResponse } from "../schemas/discount.js";
|
|
3
|
+
import { AddDiscountParams, AddDiscountResponse, AddDiscountItemParams, AddDiscountItemResponse, DeleteDiscountParams, DeleteDiscountResponse, DeleteDiscountItemParams, DeleteDiscountItemResponse, EndDiscountParams, EndDiscountResponse, GetDiscountParams, GetDiscountResponse, GetDiscountListParams, GetDiscountListResponse, UpdateDiscountParams, UpdateDiscountResponse, UpdateDiscountItemParams, UpdateDiscountItemResponse, GetSipDiscountsParams, GetSipDiscountsResponse, SetSipDiscountParams, SetSipDiscountResponse, DeleteSipDiscountParams, DeleteSipDiscountResponse } from "../schemas/discount.js";
|
|
4
4
|
export declare class DiscountManager extends BaseManager {
|
|
5
5
|
constructor(config: ShopeeConfig);
|
|
6
6
|
/**
|
|
@@ -99,4 +99,50 @@ export declare class DiscountManager extends BaseManager {
|
|
|
99
99
|
* - warning: Warning message if any
|
|
100
100
|
*/
|
|
101
101
|
updateDiscountItem(params: UpdateDiscountItemParams): Promise<UpdateDiscountItemResponse>;
|
|
102
|
+
/**
|
|
103
|
+
* Get SIP Overseas Discounts
|
|
104
|
+
* @param {GetSipDiscountsParams} [params] - Optional parameters for filtering by region
|
|
105
|
+
* @returns {Promise<GetSipDiscountsResponse>} The response containing a list of SIP discounts
|
|
106
|
+
*
|
|
107
|
+
* Only regions that have upcoming/ongoing discounts will be returned.
|
|
108
|
+
* Use Primary shop's Shop ID to request - the API will return the list of Affiliate shops
|
|
109
|
+
* under this Primary shop that have set discounts, along with the discount details.
|
|
110
|
+
*
|
|
111
|
+
* The response includes:
|
|
112
|
+
* - discount_list: Array of discount information for each region
|
|
113
|
+
* - region: The region of the SIP affiliate shop
|
|
114
|
+
* - status: The status of the discount (upcoming/ongoing)
|
|
115
|
+
* - sip_discount_rate: The discount rate percentage
|
|
116
|
+
* - start_time: When the discount starts (UNIX timestamp)
|
|
117
|
+
* - end_time: When the discount ends (UNIX timestamp)
|
|
118
|
+
* - create_time: When the discount was created (UNIX timestamp)
|
|
119
|
+
* - update_time: When the discount was last updated (UNIX timestamp)
|
|
120
|
+
*/
|
|
121
|
+
getSipDiscounts(params?: GetSipDiscountsParams): Promise<GetSipDiscountsResponse>;
|
|
122
|
+
/**
|
|
123
|
+
* Set SIP Overseas Discount for SIP affiliate region
|
|
124
|
+
* @param {SetSipDiscountParams} params - Parameters for setting the SIP discount
|
|
125
|
+
* @returns {Promise<SetSipDiscountResponse>} The response containing the created/updated discount details
|
|
126
|
+
*
|
|
127
|
+
* Use Primary shop's Shop ID to request. Provide the region and discount rate of the Affiliate shop
|
|
128
|
+
* to be set or update - the API will set or update the discount rate for that region's Affiliate shop.
|
|
129
|
+
*
|
|
130
|
+
* Notes:
|
|
131
|
+
* - The start time is 30 minutes after the discount is set
|
|
132
|
+
* - The end time is 180 days after the start time
|
|
133
|
+
* - Cannot edit the promotion within 15 minutes after an update
|
|
134
|
+
* - In VN region, discount rate cannot exceed 50%
|
|
135
|
+
*/
|
|
136
|
+
setSipDiscount(params: SetSipDiscountParams): Promise<SetSipDiscountResponse>;
|
|
137
|
+
/**
|
|
138
|
+
* Delete SIP Overseas Discount for SIP affiliate region
|
|
139
|
+
* @param {DeleteSipDiscountParams} params - Parameters for deleting the SIP discount
|
|
140
|
+
* @returns {Promise<DeleteSipDiscountResponse>} The response containing the deleted region
|
|
141
|
+
*
|
|
142
|
+
* Use Primary shop's Shop ID to request. Provide the region of the Affiliate shop to be deleted,
|
|
143
|
+
* and the API will delete the discount from that region's Affiliate shop.
|
|
144
|
+
*
|
|
145
|
+
* Note: Cannot edit the promotion within 15 minutes after an update
|
|
146
|
+
*/
|
|
147
|
+
deleteSipDiscount(params: DeleteSipDiscountParams): Promise<DeleteSipDiscountResponse>;
|
|
102
148
|
}
|
|
@@ -163,5 +163,72 @@ export class DiscountManager extends BaseManager {
|
|
|
163
163
|
});
|
|
164
164
|
return response;
|
|
165
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Get SIP Overseas Discounts
|
|
168
|
+
* @param {GetSipDiscountsParams} [params] - Optional parameters for filtering by region
|
|
169
|
+
* @returns {Promise<GetSipDiscountsResponse>} The response containing a list of SIP discounts
|
|
170
|
+
*
|
|
171
|
+
* Only regions that have upcoming/ongoing discounts will be returned.
|
|
172
|
+
* Use Primary shop's Shop ID to request - the API will return the list of Affiliate shops
|
|
173
|
+
* under this Primary shop that have set discounts, along with the discount details.
|
|
174
|
+
*
|
|
175
|
+
* The response includes:
|
|
176
|
+
* - discount_list: Array of discount information for each region
|
|
177
|
+
* - region: The region of the SIP affiliate shop
|
|
178
|
+
* - status: The status of the discount (upcoming/ongoing)
|
|
179
|
+
* - sip_discount_rate: The discount rate percentage
|
|
180
|
+
* - start_time: When the discount starts (UNIX timestamp)
|
|
181
|
+
* - end_time: When the discount ends (UNIX timestamp)
|
|
182
|
+
* - create_time: When the discount was created (UNIX timestamp)
|
|
183
|
+
* - update_time: When the discount was last updated (UNIX timestamp)
|
|
184
|
+
*/
|
|
185
|
+
async getSipDiscounts(params) {
|
|
186
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/get_sip_discounts", {
|
|
187
|
+
method: "GET",
|
|
188
|
+
auth: true,
|
|
189
|
+
params,
|
|
190
|
+
});
|
|
191
|
+
return response;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Set SIP Overseas Discount for SIP affiliate region
|
|
195
|
+
* @param {SetSipDiscountParams} params - Parameters for setting the SIP discount
|
|
196
|
+
* @returns {Promise<SetSipDiscountResponse>} The response containing the created/updated discount details
|
|
197
|
+
*
|
|
198
|
+
* Use Primary shop's Shop ID to request. Provide the region and discount rate of the Affiliate shop
|
|
199
|
+
* to be set or update - the API will set or update the discount rate for that region's Affiliate shop.
|
|
200
|
+
*
|
|
201
|
+
* Notes:
|
|
202
|
+
* - The start time is 30 minutes after the discount is set
|
|
203
|
+
* - The end time is 180 days after the start time
|
|
204
|
+
* - Cannot edit the promotion within 15 minutes after an update
|
|
205
|
+
* - In VN region, discount rate cannot exceed 50%
|
|
206
|
+
*/
|
|
207
|
+
async setSipDiscount(params) {
|
|
208
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/set_sip_discount", {
|
|
209
|
+
method: "POST",
|
|
210
|
+
auth: true,
|
|
211
|
+
body: params,
|
|
212
|
+
});
|
|
213
|
+
return response;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Delete SIP Overseas Discount for SIP affiliate region
|
|
217
|
+
* @param {DeleteSipDiscountParams} params - Parameters for deleting the SIP discount
|
|
218
|
+
* @returns {Promise<DeleteSipDiscountResponse>} The response containing the deleted region
|
|
219
|
+
*
|
|
220
|
+
* Use Primary shop's Shop ID to request. Provide the region of the Affiliate shop to be deleted,
|
|
221
|
+
* and the API will delete the discount from that region's Affiliate shop.
|
|
222
|
+
*
|
|
223
|
+
* Note: Cannot edit the promotion within 15 minutes after an update
|
|
224
|
+
*/
|
|
225
|
+
async deleteSipDiscount(params) {
|
|
226
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/delete_sip_discount", {
|
|
227
|
+
method: "POST",
|
|
228
|
+
auth: true,
|
|
229
|
+
body: params,
|
|
230
|
+
});
|
|
231
|
+
return response;
|
|
232
|
+
}
|
|
166
233
|
}
|
|
167
234
|
//# sourceMappingURL=discount.manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discount.manager.js","sourceRoot":"","sources":["../../src/managers/discount.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"discount.manager.js","sourceRoot":"","sources":["../../src/managers/discount.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA2BhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,WAAW,CAAC,MAAyB;QACzC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,wBAAwB,EACxB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,eAAe,CAAC,MAA6B;QACjD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,6BAA6B,EAC7B;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,cAAc,CAAC,MAA4B;QAC/C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,2BAA2B,EAC3B;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MA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AAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ShopeeConfig } from "../sdk.js";
|
|
2
2
|
import { BaseManager } from "./base.manager.js";
|
|
3
|
-
import { GetReturnListParams, GetReturnListResponse, GetReturnDetailParams, GetReturnDetailResponse, ConfirmParams, ConfirmResponse, DisputeParams, DisputeResponse, OfferParams, OfferResponse, AcceptOfferParams, AcceptOfferResponse, GetAvailableSolutionsParams, GetAvailableSolutionsResponse, CancelDisputeParams, CancelDisputeResponse, GetReturnDisputeReasonParams, GetReturnDisputeReasonResponse, ConvertImageParams, ConvertImageResponse, UploadProofParams, UploadProofResponse, QueryProofParams, QueryProofResponse, GetShippingCarrierParams, GetShippingCarrierResponse, UploadShippingProofParams, UploadShippingProofResponse } from "../schemas/returns.js";
|
|
3
|
+
import { GetReturnListParams, GetReturnListResponse, GetReturnDetailParams, GetReturnDetailResponse, ConfirmParams, ConfirmResponse, DisputeParams, DisputeResponse, OfferParams, OfferResponse, AcceptOfferParams, AcceptOfferResponse, GetAvailableSolutionsParams, GetAvailableSolutionsResponse, CancelDisputeParams, CancelDisputeResponse, GetReturnDisputeReasonParams, GetReturnDisputeReasonResponse, ConvertImageParams, ConvertImageResponse, UploadProofParams, UploadProofResponse, QueryProofParams, QueryProofResponse, GetShippingCarrierParams, GetShippingCarrierResponse, UploadShippingProofParams, UploadShippingProofResponse, GetReverseTrackingInfoParams, GetReverseTrackingInfoResponse } from "../schemas/returns.js";
|
|
4
4
|
export declare class ReturnsManager extends BaseManager {
|
|
5
5
|
constructor(config: ShopeeConfig);
|
|
6
6
|
/**
|
|
@@ -197,4 +197,34 @@ export declare class ReturnsManager extends BaseManager {
|
|
|
197
197
|
* @throws {Error} When the API request fails or returns an error
|
|
198
198
|
*/
|
|
199
199
|
uploadShippingProof(params: UploadShippingProofParams): Promise<UploadShippingProofResponse>;
|
|
200
|
+
/**
|
|
201
|
+
* Get reverse and post-return logistics information of return request.
|
|
202
|
+
*
|
|
203
|
+
* For Normal RR, returns complete reverse logistics information. For In-transit RR and Return-on-the-Spot,
|
|
204
|
+
* only returns latest reverse logistics status without providing complete reverse logistics information.
|
|
205
|
+
*
|
|
206
|
+
* For seller_validation, only one segment of reverse (buyer to seller), use tracking_info.
|
|
207
|
+
* For warehouse_validation, two segments of reverse (buyer to warehouse and warehouse to seller),
|
|
208
|
+
* use post_return_logistics_tracking_info for the second segment.
|
|
209
|
+
*
|
|
210
|
+
* @param params - Parameters for getting reverse tracking info
|
|
211
|
+
* @param params.return_sn - Shopee's unique identifier for a return/refund request (required)
|
|
212
|
+
*
|
|
213
|
+
* @returns A promise that resolves to the reverse tracking info response containing:
|
|
214
|
+
* - return_sn: Return serial number
|
|
215
|
+
* - return_refund_request_type: Type of return refund request (0=Normal RR, 1=In-transit RR, 2=Return-on-the-Spot)
|
|
216
|
+
* - validation_type: Whether seller or warehouse validates (seller_validation/warehouse_validation)
|
|
217
|
+
* - reverse_logistics_status: Latest reverse logistic status
|
|
218
|
+
* - reverse_logistics_update_time: Last update time of reverse logistics status
|
|
219
|
+
* - estimated_delivery_date_max/min: Estimated delivery dates (for Normal RR with integrated reverse logistics)
|
|
220
|
+
* - tracking_number: Tracking number for reverse logistics
|
|
221
|
+
* - tracking_info: Detailed tracking information list
|
|
222
|
+
* - post_return_logistics_status: Status for warehouse to seller logistics (warehouse_validation only)
|
|
223
|
+
* - post_return_logistics_update_time: Update time for post-return logistics
|
|
224
|
+
* - rts_tracking_number: Return to Seller tracking number
|
|
225
|
+
* - post_return_logistics_tracking_info: Tracking info for warehouse to seller logistics
|
|
226
|
+
*
|
|
227
|
+
* @throws {Error} When the API request fails or returns an error
|
|
228
|
+
*/
|
|
229
|
+
getReverseTrackingInfo(params: GetReverseTrackingInfoParams): Promise<GetReverseTrackingInfoResponse>;
|
|
200
230
|
}
|
|
@@ -296,5 +296,42 @@ export class ReturnsManager extends BaseManager {
|
|
|
296
296
|
});
|
|
297
297
|
return response;
|
|
298
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Get reverse and post-return logistics information of return request.
|
|
301
|
+
*
|
|
302
|
+
* For Normal RR, returns complete reverse logistics information. For In-transit RR and Return-on-the-Spot,
|
|
303
|
+
* only returns latest reverse logistics status without providing complete reverse logistics information.
|
|
304
|
+
*
|
|
305
|
+
* For seller_validation, only one segment of reverse (buyer to seller), use tracking_info.
|
|
306
|
+
* For warehouse_validation, two segments of reverse (buyer to warehouse and warehouse to seller),
|
|
307
|
+
* use post_return_logistics_tracking_info for the second segment.
|
|
308
|
+
*
|
|
309
|
+
* @param params - Parameters for getting reverse tracking info
|
|
310
|
+
* @param params.return_sn - Shopee's unique identifier for a return/refund request (required)
|
|
311
|
+
*
|
|
312
|
+
* @returns A promise that resolves to the reverse tracking info response containing:
|
|
313
|
+
* - return_sn: Return serial number
|
|
314
|
+
* - return_refund_request_type: Type of return refund request (0=Normal RR, 1=In-transit RR, 2=Return-on-the-Spot)
|
|
315
|
+
* - validation_type: Whether seller or warehouse validates (seller_validation/warehouse_validation)
|
|
316
|
+
* - reverse_logistics_status: Latest reverse logistic status
|
|
317
|
+
* - reverse_logistics_update_time: Last update time of reverse logistics status
|
|
318
|
+
* - estimated_delivery_date_max/min: Estimated delivery dates (for Normal RR with integrated reverse logistics)
|
|
319
|
+
* - tracking_number: Tracking number for reverse logistics
|
|
320
|
+
* - tracking_info: Detailed tracking information list
|
|
321
|
+
* - post_return_logistics_status: Status for warehouse to seller logistics (warehouse_validation only)
|
|
322
|
+
* - post_return_logistics_update_time: Update time for post-return logistics
|
|
323
|
+
* - rts_tracking_number: Return to Seller tracking number
|
|
324
|
+
* - post_return_logistics_tracking_info: Tracking info for warehouse to seller logistics
|
|
325
|
+
*
|
|
326
|
+
* @throws {Error} When the API request fails or returns an error
|
|
327
|
+
*/
|
|
328
|
+
async getReverseTrackingInfo(params) {
|
|
329
|
+
const response = await ShopeeFetch.fetch(this.config, "/returns/get_reverse_tracking_info", {
|
|
330
|
+
method: "GET",
|
|
331
|
+
auth: true,
|
|
332
|
+
params,
|
|
333
|
+
});
|
|
334
|
+
return response;
|
|
335
|
+
}
|
|
299
336
|
}
|
|
300
337
|
//# sourceMappingURL=returns.manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"returns.manager.js","sourceRoot":"","sources":["../../src/managers/returns.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"returns.manager.js","sourceRoot":"","sources":["../../src/managers/returns.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAiChD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,0BAA0B,EAC1B;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACP,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,eAAe,CAAC,MAA6B;QACjD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,4BAA4B,EAC5B;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACP,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,OAAO,CAAC,MAAqB;QACjC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CAAkB,IAAI,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EACX,sBAAsB,EACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACP,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,kBAAkB,CAAC,MAAgC;QACvD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,+BAA+B,EAC/B;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACP,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,mBAAmB,CACvB,MAAiC;QAEjC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,gCAAgC,EAChC;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,KAAK,CAAC,sBAAsB,CAC1B,MAAoC;QAEpC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,oCAAoC,EACpC;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACP,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -332,3 +332,70 @@ export interface UpdateDiscountItemResponse extends BaseResponse {
|
|
|
332
332
|
/** Warning message if any */
|
|
333
333
|
warning?: string;
|
|
334
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* SIP discount information
|
|
337
|
+
*/
|
|
338
|
+
export interface SipDiscountInfo {
|
|
339
|
+
/** The region of SIP affiliate shop */
|
|
340
|
+
region: string;
|
|
341
|
+
/** The status of discount for SIP affiliate shop in current region, can be upcoming/ongoing, excluding expired discounts */
|
|
342
|
+
status: string;
|
|
343
|
+
/** The discount rate set for SIP affiliate shop in current region */
|
|
344
|
+
sip_discount_rate: number;
|
|
345
|
+
/** The start time of discount for SIP affiliate shop in current region, in UNIX seconds */
|
|
346
|
+
start_time: number;
|
|
347
|
+
/** The end time of discount for SIP affiliate shop in current region, in UNIX seconds */
|
|
348
|
+
end_time: number;
|
|
349
|
+
/** The create time of discount for SIP affiliate shop in current region, in UNIX seconds */
|
|
350
|
+
create_time: number;
|
|
351
|
+
/** The latest update time of discount for SIP affiliate shop in current region, in UNIX seconds */
|
|
352
|
+
update_time: number;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Parameters for getting SIP discounts
|
|
356
|
+
*/
|
|
357
|
+
export interface GetSipDiscountsParams {
|
|
358
|
+
/** The region of SIP affiliate shop that needs to get discount information. If not passed, will return the discount information set for all SIP affiliate shops */
|
|
359
|
+
region?: string;
|
|
360
|
+
[key: string]: string | number | boolean | undefined;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Parameters for setting SIP discount
|
|
364
|
+
*/
|
|
365
|
+
export interface SetSipDiscountParams {
|
|
366
|
+
/** The region of SIP affiliate shop that needs to set discount */
|
|
367
|
+
region: string;
|
|
368
|
+
/** The overall market discount rate that will apply to all items for SIP affiliate shop in current region */
|
|
369
|
+
sip_discount_rate: number;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Parameters for deleting SIP discount
|
|
373
|
+
*/
|
|
374
|
+
export interface DeleteSipDiscountParams {
|
|
375
|
+
/** The region of SIP affiliate shop that needs to delete discount */
|
|
376
|
+
region: string;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Response for the get SIP discounts API
|
|
380
|
+
*/
|
|
381
|
+
export interface GetSipDiscountsResponse extends BaseResponse {
|
|
382
|
+
response: {
|
|
383
|
+
/** List of discounts in each region */
|
|
384
|
+
discount_list: SipDiscountInfo[];
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Response for the set SIP discount API
|
|
389
|
+
*/
|
|
390
|
+
export interface SetSipDiscountResponse extends BaseResponse {
|
|
391
|
+
response: SipDiscountInfo;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Response for the delete SIP discount API
|
|
395
|
+
*/
|
|
396
|
+
export interface DeleteSipDiscountResponse extends BaseResponse {
|
|
397
|
+
response: {
|
|
398
|
+
/** The region of SIP affiliate shop that was deleted */
|
|
399
|
+
region: string;
|
|
400
|
+
};
|
|
401
|
+
}
|
package/lib/schemas/returns.d.ts
CHANGED
|
@@ -630,3 +630,56 @@ export interface UploadShippingProofResponse extends BaseResponse {
|
|
|
630
630
|
return_sn: string;
|
|
631
631
|
};
|
|
632
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Parameters for getting reverse tracking info
|
|
635
|
+
*/
|
|
636
|
+
export type GetReverseTrackingInfoParams = {
|
|
637
|
+
/** Shopee's unique identifier for a return/refund request (serial number of return) */
|
|
638
|
+
return_sn: string;
|
|
639
|
+
};
|
|
640
|
+
/**
|
|
641
|
+
* Tracking information detail
|
|
642
|
+
*/
|
|
643
|
+
export interface TrackingInfo {
|
|
644
|
+
/** The timestamps when reverse logistics info has been updated */
|
|
645
|
+
update_time: number;
|
|
646
|
+
/** The description of reverse logistics tracking info */
|
|
647
|
+
tracking_description: string;
|
|
648
|
+
/** Image URLs of electronic proof of pickup (ePOP) after return parcel has been picked up */
|
|
649
|
+
epop_image_list?: string[];
|
|
650
|
+
/** Image URLs of electronic proof of delivery (ePOD) after return parcel has been delivered */
|
|
651
|
+
epod_image_list?: string[];
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Response for get reverse tracking info API
|
|
655
|
+
*/
|
|
656
|
+
export interface GetReverseTrackingInfoResponse extends BaseResponse {
|
|
657
|
+
response: {
|
|
658
|
+
/** Shopee's unique identifier for a return/refund request (serial number of return) */
|
|
659
|
+
return_sn: string;
|
|
660
|
+
/** Return refund request type: 0 = Normal RR, 1 = In-transit RR, 2 = Return-on-the-Spot */
|
|
661
|
+
return_refund_request_type: number;
|
|
662
|
+
/** Validation type: seller_validation or warehouse_validation */
|
|
663
|
+
validation_type: string;
|
|
664
|
+
/** Latest reverse logistic status */
|
|
665
|
+
reverse_logistics_status: string;
|
|
666
|
+
/** The last update time of the reverse logistics status */
|
|
667
|
+
reverse_logistics_update_time: number;
|
|
668
|
+
/** The maximum estimated delivery date for the reverse logistics */
|
|
669
|
+
estimated_delivery_date_max?: number;
|
|
670
|
+
/** The minimum estimated delivery date for the reverse logistics */
|
|
671
|
+
estimated_delivery_date_min?: number;
|
|
672
|
+
/** The tracking number for the reverse logistics */
|
|
673
|
+
tracking_number?: string;
|
|
674
|
+
/** The detailed tracking information list for the reverse logistics */
|
|
675
|
+
tracking_info?: TrackingInfo[];
|
|
676
|
+
/** Post-return logistics status */
|
|
677
|
+
post_return_logistics_status?: string;
|
|
678
|
+
/** The last update time of the post-return logistics status */
|
|
679
|
+
post_return_logistics_update_time?: number;
|
|
680
|
+
/** The tracking number for the post-return logistics (Return to Seller) */
|
|
681
|
+
rts_tracking_number?: string;
|
|
682
|
+
/** The detailed tracking information for post-return logistics */
|
|
683
|
+
post_return_logistics_tracking_info?: TrackingInfo[];
|
|
684
|
+
};
|
|
685
|
+
}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.3.0";
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@congminh1254/shopee-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Shopee SDK maintaining by community",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/sdk.js",
|
|
@@ -68,22 +68,21 @@
|
|
|
68
68
|
},
|
|
69
69
|
"homepage": "https://github.com/congminh1254/shopee-sdk#readme",
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@
|
|
72
|
-
"@commitlint/
|
|
73
|
-
"@
|
|
74
|
-
"@types/jest": "^29.5.14",
|
|
71
|
+
"@commitlint/cli": "^20.1.0",
|
|
72
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
73
|
+
"@types/jest": "^30.0.0",
|
|
75
74
|
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
76
75
|
"@typescript-eslint/parser": "^7.0.1",
|
|
77
76
|
"eslint": "^8.56.0",
|
|
78
77
|
"eslint-config-prettier": "^10.1.5",
|
|
79
|
-
"husky": "^
|
|
80
|
-
"jest": "^
|
|
78
|
+
"husky": "^9.1.7",
|
|
79
|
+
"jest": "^30.2.0",
|
|
81
80
|
"prettier": "^3.2.5",
|
|
82
81
|
"ts-jest": "^29.3.2",
|
|
83
82
|
"ts-node": "^10.9.2",
|
|
84
83
|
"typescript": "^5.7.3"
|
|
85
84
|
},
|
|
86
85
|
"dependencies": {
|
|
87
|
-
"node-fetch": "^
|
|
86
|
+
"node-fetch": "^3.3.2"
|
|
88
87
|
}
|
|
89
88
|
}
|