@congminh1254/shopee-sdk 0.4.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.
Files changed (108) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +85 -0
  3. package/lib/errors.d.ts +8 -0
  4. package/lib/errors.js +15 -0
  5. package/lib/errors.js.map +1 -0
  6. package/lib/fetch.d.ts +5 -0
  7. package/lib/fetch.js +105 -0
  8. package/lib/fetch.js.map +1 -0
  9. package/lib/managers/ads.manager.d.ts +53 -0
  10. package/lib/managers/ads.manager.js +74 -0
  11. package/lib/managers/ads.manager.js.map +1 -0
  12. package/lib/managers/auth.manager.d.ts +9 -0
  13. package/lib/managers/auth.manager.js +58 -0
  14. package/lib/managers/auth.manager.js.map +1 -0
  15. package/lib/managers/base.manager.d.ts +5 -0
  16. package/lib/managers/base.manager.js +7 -0
  17. package/lib/managers/base.manager.js.map +1 -0
  18. package/lib/managers/index.d.ts +10 -0
  19. package/lib/managers/index.js +11 -0
  20. package/lib/managers/index.js.map +1 -0
  21. package/lib/managers/logistics.manager.d.ts +33 -0
  22. package/lib/managers/logistics.manager.js +42 -0
  23. package/lib/managers/logistics.manager.js.map +1 -0
  24. package/lib/managers/order.manager.d.ts +105 -0
  25. package/lib/managers/order.manager.js +173 -0
  26. package/lib/managers/order.manager.js.map +1 -0
  27. package/lib/managers/payment.manager.d.ts +30 -0
  28. package/lib/managers/payment.manager.js +39 -0
  29. package/lib/managers/payment.manager.js.map +1 -0
  30. package/lib/managers/product.manager.d.ts +114 -0
  31. package/lib/managers/product.manager.js +147 -0
  32. package/lib/managers/product.manager.js.map +1 -0
  33. package/lib/managers/public.manager.d.ts +9 -0
  34. package/lib/managers/public.manager.js +34 -0
  35. package/lib/managers/public.manager.js.map +1 -0
  36. package/lib/managers/push.manager.d.ts +36 -0
  37. package/lib/managers/push.manager.js +60 -0
  38. package/lib/managers/push.manager.js.map +1 -0
  39. package/lib/managers/voucher.manager.d.ts +70 -0
  40. package/lib/managers/voucher.manager.js +114 -0
  41. package/lib/managers/voucher.manager.js.map +1 -0
  42. package/lib/schemas/access-token.d.ts +27 -0
  43. package/lib/schemas/access-token.js +2 -0
  44. package/lib/schemas/access-token.js.map +1 -0
  45. package/lib/schemas/ads.d.ts +62 -0
  46. package/lib/schemas/ads.js +2 -0
  47. package/lib/schemas/ads.js.map +1 -0
  48. package/lib/schemas/api-range.d.ts +1 -0
  49. package/lib/schemas/api-range.js +2 -0
  50. package/lib/schemas/api-range.js.map +1 -0
  51. package/lib/schemas/attribute.d.ts +33 -0
  52. package/lib/schemas/attribute.js +2 -0
  53. package/lib/schemas/attribute.js.map +1 -0
  54. package/lib/schemas/authed-merchant.d.ts +6 -0
  55. package/lib/schemas/authed-merchant.js +2 -0
  56. package/lib/schemas/authed-merchant.js.map +1 -0
  57. package/lib/schemas/authed-shop.d.ts +11 -0
  58. package/lib/schemas/authed-shop.js +2 -0
  59. package/lib/schemas/authed-shop.js.map +1 -0
  60. package/lib/schemas/base.d.ts +11 -0
  61. package/lib/schemas/base.js +2 -0
  62. package/lib/schemas/base.js.map +1 -0
  63. package/lib/schemas/category.d.ts +12 -0
  64. package/lib/schemas/category.js +2 -0
  65. package/lib/schemas/category.js.map +1 -0
  66. package/lib/schemas/fetch.d.ts +13 -0
  67. package/lib/schemas/fetch.js +2 -0
  68. package/lib/schemas/fetch.js.map +1 -0
  69. package/lib/schemas/index.d.ts +11 -0
  70. package/lib/schemas/index.js +12 -0
  71. package/lib/schemas/index.js.map +1 -0
  72. package/lib/schemas/logistics.d.ts +157 -0
  73. package/lib/schemas/logistics.js +115 -0
  74. package/lib/schemas/logistics.js.map +1 -0
  75. package/lib/schemas/order.d.ts +592 -0
  76. package/lib/schemas/order.js +2 -0
  77. package/lib/schemas/order.js.map +1 -0
  78. package/lib/schemas/payment.d.ts +298 -0
  79. package/lib/schemas/payment.js +2 -0
  80. package/lib/schemas/payment.js.map +1 -0
  81. package/lib/schemas/product.d.ts +604 -0
  82. package/lib/schemas/product.js +14 -0
  83. package/lib/schemas/product.js.map +1 -0
  84. package/lib/schemas/public.d.ts +25 -0
  85. package/lib/schemas/public.js +2 -0
  86. package/lib/schemas/public.js.map +1 -0
  87. package/lib/schemas/push.d.ts +64 -0
  88. package/lib/schemas/push.js +2 -0
  89. package/lib/schemas/push.js.map +1 -0
  90. package/lib/schemas/region.d.ts +14 -0
  91. package/lib/schemas/region.js +16 -0
  92. package/lib/schemas/region.js.map +1 -0
  93. package/lib/schemas/voucher.d.ts +241 -0
  94. package/lib/schemas/voucher.js +15 -0
  95. package/lib/schemas/voucher.js.map +1 -0
  96. package/lib/sdk.d.ts +42 -0
  97. package/lib/sdk.js +77 -0
  98. package/lib/sdk.js.map +1 -0
  99. package/lib/storage/custom-token-storage.d.ts +10 -0
  100. package/lib/storage/custom-token-storage.js +47 -0
  101. package/lib/storage/custom-token-storage.js.map +1 -0
  102. package/lib/storage/token-storage.interface.d.ts +6 -0
  103. package/lib/storage/token-storage.interface.js +2 -0
  104. package/lib/storage/token-storage.interface.js.map +1 -0
  105. package/lib/utils/signature.d.ts +1 -0
  106. package/lib/utils/signature.js +9 -0
  107. package/lib/utils/signature.js.map +1 -0
  108. package/package.json +84 -0
@@ -0,0 +1,34 @@
1
+ import { ShopeeFetch } from '../fetch.js';
2
+ import { BaseManager } from './base.manager.js';
3
+ export class PublicManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ async getShopsByPartner(params) {
8
+ const response = await ShopeeFetch.fetch(this.config, '/public/get_shops_by_partner', {
9
+ method: 'GET',
10
+ params: {
11
+ partner_id: this.config.partner_id,
12
+ ...params,
13
+ },
14
+ });
15
+ return response;
16
+ }
17
+ async getMerchantsByPartner(params) {
18
+ const response = await ShopeeFetch.fetch(this.config, '/public/get_merchants_by_partner', {
19
+ method: 'GET',
20
+ params: {
21
+ partner_id: this.config.partner_id,
22
+ ...params,
23
+ },
24
+ });
25
+ return response;
26
+ }
27
+ async getShopeeIpRange() {
28
+ const response = await ShopeeFetch.fetch(this.config, '/public/get_shopee_ip_ranges', {
29
+ method: 'GET',
30
+ });
31
+ return response;
32
+ }
33
+ }
34
+ //# sourceMappingURL=public.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.manager.js","sourceRoot":"","sources":["../../src/managers/public.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC5B,MAAgC;QAEhC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,8BAA8B,EAC9B;YACE,MAAM,EAAE,KAAK;YACb,MAAM,EAAE;gBACN,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;gBAClC,GAAG,MAAM;aACV;SACF,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAChC,MAAoC;QAEpC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,kCAAkC,EAClC;YACE,MAAM,EAAE,KAAK;YACb,MAAM,EAAE;gBACN,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;gBAClC,GAAG,MAAM;aACV;SACF,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC3B,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,8BAA8B,EAC9B;YACE,MAAM,EAAE,KAAK;SACd,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import { ShopeeConfig } from '../sdk.js';
2
+ import { SetAppPushConfigParams, SetAppPushConfigResponse, GetAppPushConfigResponse, GetLostPushMessageResponse, ConfirmConsumedLostPushMessageParams, ConfirmConsumedLostPushMessageResponse } from '../schemas/push.js';
3
+ import { BaseManager } from './base.manager.js';
4
+ export declare class PushManager extends BaseManager {
5
+ constructor(config: ShopeeConfig);
6
+ setAppPushConfig(params: SetAppPushConfigParams): Promise<SetAppPushConfigResponse>;
7
+ getAppPushConfig(): Promise<GetAppPushConfigResponse>;
8
+ /**
9
+ * Get the lost push messages that were lost within 3 days of the current time and not confirmed to have been consumed
10
+ * @returns {Promise<GetLostPushMessageResponse>} Response containing up to 100 lost push messages
11
+ *
12
+ * This API retrieves the earliest 100 lost push messages from the past 3 days that haven't been confirmed as consumed.
13
+ * If there are more than 100 messages, the response will indicate this via the has_next_page field,
14
+ * and you'll need to make additional calls to retrieve the remaining messages.
15
+ *
16
+ * The returned messages contain:
17
+ * - shop_id: The shop identifier (absent for partner level pushes)
18
+ * - code: The push notification identifier
19
+ * - timestamp: When the message was lost
20
+ * - data: The actual push message content (as a JSON string)
21
+ */
22
+ getLostPushMessage(): Promise<GetLostPushMessageResponse>;
23
+ /**
24
+ * Confirm that lost push messages have been consumed up to a specific message ID
25
+ * @param {ConfirmConsumedLostPushMessageParams} params - Parameters for confirming consumed lost push messages
26
+ * @param {number} params.last_message_id - The last_message_id returned by getLostPushMessage
27
+ * @returns {Promise<ConfirmConsumedLostPushMessageResponse>} Response indicating the confirmation result
28
+ *
29
+ * This API confirms that all lost push messages up to and including the specified last_message_id
30
+ * have been successfully consumed/processed by your application. After confirmation, these messages
31
+ * will no longer be returned by the getLostPushMessage API.
32
+ *
33
+ * Use this method after you have successfully processed the messages returned by getLostPushMessage.
34
+ */
35
+ confirmConsumedLostPushMessage(params: ConfirmConsumedLostPushMessageParams): Promise<ConfirmConsumedLostPushMessageResponse>;
36
+ }
@@ -0,0 +1,60 @@
1
+ import { ShopeeFetch } from '../fetch.js';
2
+ import { BaseManager } from './base.manager.js';
3
+ export class PushManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ async setAppPushConfig(params) {
8
+ const response = await ShopeeFetch.fetch(this.config, '/push/set_app_push_config', {
9
+ method: 'POST',
10
+ body: params
11
+ });
12
+ return response;
13
+ }
14
+ async getAppPushConfig() {
15
+ const response = await ShopeeFetch.fetch(this.config, '/push/get_app_push_config', {
16
+ method: 'GET',
17
+ });
18
+ return response;
19
+ }
20
+ /**
21
+ * Get the lost push messages that were lost within 3 days of the current time and not confirmed to have been consumed
22
+ * @returns {Promise<GetLostPushMessageResponse>} Response containing up to 100 lost push messages
23
+ *
24
+ * This API retrieves the earliest 100 lost push messages from the past 3 days that haven't been confirmed as consumed.
25
+ * If there are more than 100 messages, the response will indicate this via the has_next_page field,
26
+ * and you'll need to make additional calls to retrieve the remaining messages.
27
+ *
28
+ * The returned messages contain:
29
+ * - shop_id: The shop identifier (absent for partner level pushes)
30
+ * - code: The push notification identifier
31
+ * - timestamp: When the message was lost
32
+ * - data: The actual push message content (as a JSON string)
33
+ */
34
+ async getLostPushMessage() {
35
+ const response = await ShopeeFetch.fetch(this.config, '/push/get_lost_push_message', {
36
+ method: 'GET',
37
+ });
38
+ return response;
39
+ }
40
+ /**
41
+ * Confirm that lost push messages have been consumed up to a specific message ID
42
+ * @param {ConfirmConsumedLostPushMessageParams} params - Parameters for confirming consumed lost push messages
43
+ * @param {number} params.last_message_id - The last_message_id returned by getLostPushMessage
44
+ * @returns {Promise<ConfirmConsumedLostPushMessageResponse>} Response indicating the confirmation result
45
+ *
46
+ * This API confirms that all lost push messages up to and including the specified last_message_id
47
+ * have been successfully consumed/processed by your application. After confirmation, these messages
48
+ * will no longer be returned by the getLostPushMessage API.
49
+ *
50
+ * Use this method after you have successfully processed the messages returned by getLostPushMessage.
51
+ */
52
+ async confirmConsumedLostPushMessage(params) {
53
+ const response = await ShopeeFetch.fetch(this.config, '/push/confirm_consumed_lost_push_message', {
54
+ method: 'POST',
55
+ body: params,
56
+ });
57
+ return response;
58
+ }
59
+ }
60
+ //# sourceMappingURL=push.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.manager.js","sourceRoot":"","sources":["../../src/managers/push.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,WAAY,SAAQ,WAAW;IACxC,YAAY,MAAoB;QAC5B,KAAK,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,MAA8B;QACxD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACpC,IAAI,CAAC,MAAM,EACX,2BAA2B,EAC3B;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAmD;SAC5D,CACJ,CAAC;QAEF,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEM,KAAK,CAAC,gBAAgB;QACzB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACpC,IAAI,CAAC,MAAM,EACX,2BAA2B,EAC3B;YACI,MAAM,EAAE,KAAK;SAChB,CACJ,CAAC;QAEF,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,KAAK,CAAC,kBAAkB;QAC3B,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACpC,IAAI,CAAC,MAAM,EACX,6BAA6B,EAC7B;YACI,MAAM,EAAE,KAAK;SAChB,CACJ,CAAC;QAEF,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,8BAA8B,CACvC,MAA4C;QAE5C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACpC,IAAI,CAAC,MAAM,EACX,0CAA0C,EAC1C;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM;SACf,CACJ,CAAC;QAEF,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"}
@@ -0,0 +1,70 @@
1
+ import { ShopeeConfig } from "../sdk.js";
2
+ import { BaseManager } from "./base.manager.js";
3
+ import { AddVoucherParams, AddVoucherResponse, DeleteVoucherParams, DeleteVoucherResponse, EndVoucherParams, EndVoucherResponse, UpdateVoucherParams, UpdateVoucherResponse, GetVoucherParams, GetVoucherResponse, GetVoucherListParams, GetVoucherListResponse } from "../schemas/voucher.js";
4
+ export declare class VoucherManager extends BaseManager {
5
+ constructor(config: ShopeeConfig);
6
+ /**
7
+ * Add a new voucher
8
+ * @param {AddVoucherParams} params - Parameters for creating a new voucher
9
+ * @returns {Promise<AddVoucherResponse>} The response containing the created voucher ID
10
+ */
11
+ addVoucher(params: AddVoucherParams): Promise<AddVoucherResponse>;
12
+ /**
13
+ * Delete an existing voucher
14
+ * @param {DeleteVoucherParams} params - Parameters for deleting a voucher
15
+ * @returns {Promise<DeleteVoucherResponse>} The response containing the deleted voucher ID
16
+ *
17
+ * Note: Can only delete upcoming vouchers that haven't started yet.
18
+ * Will return an error if attempting to delete a voucher that has already started.
19
+ */
20
+ deleteVoucher(params: DeleteVoucherParams): Promise<DeleteVoucherResponse>;
21
+ /**
22
+ * End an ongoing voucher immediately
23
+ * @param {EndVoucherParams} params - Parameters for ending a voucher
24
+ * @returns {Promise<EndVoucherResponse>} The response containing the ended voucher ID
25
+ *
26
+ * Note: Can only end vouchers that are currently ongoing/active.
27
+ * Will return an error if attempting to end an upcoming or expired voucher.
28
+ */
29
+ endVoucher(params: EndVoucherParams): Promise<EndVoucherResponse>;
30
+ /**
31
+ * Update an existing voucher
32
+ * @param {UpdateVoucherParams} params - Parameters for updating a voucher
33
+ * @returns {Promise<UpdateVoucherResponse>} The response containing the updated voucher ID
34
+ *
35
+ * Note: For ongoing vouchers, only these fields can be modified:
36
+ * - voucher_name
37
+ * - usage_quantity (can only be increased)
38
+ * - end_time (can only be shortened, not extended)
39
+ * - display_channel_list
40
+ * - item_id_list
41
+ */
42
+ updateVoucher(params: UpdateVoucherParams): Promise<UpdateVoucherResponse>;
43
+ /**
44
+ * Get detailed information about a voucher
45
+ * @param {GetVoucherParams} params - Parameters for getting voucher details
46
+ * @returns {Promise<GetVoucherResponse>} The response containing comprehensive voucher information
47
+ *
48
+ * The response includes:
49
+ * - Basic voucher details (ID, code, name, type, etc.)
50
+ * - Usage information (total quantity, current usage)
51
+ * - Timing details (start time, end time, display time)
52
+ * - Reward specifics (reward type, discount amount/percentage, min basket price)
53
+ * - Display settings (channels where voucher is shown)
54
+ * - For product vouchers: list of applicable items
55
+ */
56
+ getVoucher(params: GetVoucherParams): Promise<GetVoucherResponse>;
57
+ /**
58
+ * Get a list of vouchers with pagination
59
+ * @param {GetVoucherListParams} params - Parameters for retrieving voucher list
60
+ * @param {VoucherStatus} params.status - Filter by voucher status (UPCOMING, ONGOING, EXPIRED, or ALL)
61
+ * @param {number} [params.page_no] - Page number to retrieve (default: 1, range: 1-5000)
62
+ * @param {number} [params.page_size] - Number of items per page (default: 20, range: 1-100)
63
+ * @returns {Promise<GetVoucherListResponse>} The response containing a paginated list of vouchers
64
+ *
65
+ * The response includes:
66
+ * - Pagination information (more: boolean indicating if there are more pages)
67
+ * - A list of vouchers with details such as ID, code, name, type, usage statistics, timing, and reward information
68
+ */
69
+ getVoucherList(params: GetVoucherListParams): Promise<GetVoucherListResponse>;
70
+ }
@@ -0,0 +1,114 @@
1
+ import { BaseManager } from "./base.manager.js";
2
+ import { ShopeeFetch } from "../fetch.js";
3
+ export class VoucherManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ /**
8
+ * Add a new voucher
9
+ * @param {AddVoucherParams} params - Parameters for creating a new voucher
10
+ * @returns {Promise<AddVoucherResponse>} The response containing the created voucher ID
11
+ */
12
+ async addVoucher(params) {
13
+ const response = await ShopeeFetch.fetch(this.config, '/voucher/add_voucher', {
14
+ method: 'POST',
15
+ auth: true,
16
+ body: params,
17
+ });
18
+ return response;
19
+ }
20
+ /**
21
+ * Delete an existing voucher
22
+ * @param {DeleteVoucherParams} params - Parameters for deleting a voucher
23
+ * @returns {Promise<DeleteVoucherResponse>} The response containing the deleted voucher ID
24
+ *
25
+ * Note: Can only delete upcoming vouchers that haven't started yet.
26
+ * Will return an error if attempting to delete a voucher that has already started.
27
+ */
28
+ async deleteVoucher(params) {
29
+ const response = await ShopeeFetch.fetch(this.config, '/voucher/delete_voucher', {
30
+ method: 'POST',
31
+ auth: true,
32
+ body: params,
33
+ });
34
+ return response;
35
+ }
36
+ /**
37
+ * End an ongoing voucher immediately
38
+ * @param {EndVoucherParams} params - Parameters for ending a voucher
39
+ * @returns {Promise<EndVoucherResponse>} The response containing the ended voucher ID
40
+ *
41
+ * Note: Can only end vouchers that are currently ongoing/active.
42
+ * Will return an error if attempting to end an upcoming or expired voucher.
43
+ */
44
+ async endVoucher(params) {
45
+ const response = await ShopeeFetch.fetch(this.config, '/voucher/end_voucher', {
46
+ method: 'POST',
47
+ auth: true,
48
+ body: params,
49
+ });
50
+ return response;
51
+ }
52
+ /**
53
+ * Update an existing voucher
54
+ * @param {UpdateVoucherParams} params - Parameters for updating a voucher
55
+ * @returns {Promise<UpdateVoucherResponse>} The response containing the updated voucher ID
56
+ *
57
+ * Note: For ongoing vouchers, only these fields can be modified:
58
+ * - voucher_name
59
+ * - usage_quantity (can only be increased)
60
+ * - end_time (can only be shortened, not extended)
61
+ * - display_channel_list
62
+ * - item_id_list
63
+ */
64
+ async updateVoucher(params) {
65
+ const response = await ShopeeFetch.fetch(this.config, '/voucher/update_voucher', {
66
+ method: 'POST',
67
+ auth: true,
68
+ body: params,
69
+ });
70
+ return response;
71
+ }
72
+ /**
73
+ * Get detailed information about a voucher
74
+ * @param {GetVoucherParams} params - Parameters for getting voucher details
75
+ * @returns {Promise<GetVoucherResponse>} The response containing comprehensive voucher information
76
+ *
77
+ * The response includes:
78
+ * - Basic voucher details (ID, code, name, type, etc.)
79
+ * - Usage information (total quantity, current usage)
80
+ * - Timing details (start time, end time, display time)
81
+ * - Reward specifics (reward type, discount amount/percentage, min basket price)
82
+ * - Display settings (channels where voucher is shown)
83
+ * - For product vouchers: list of applicable items
84
+ */
85
+ async getVoucher(params) {
86
+ const response = await ShopeeFetch.fetch(this.config, '/voucher/get_voucher', {
87
+ method: 'GET',
88
+ auth: true,
89
+ params,
90
+ });
91
+ return response;
92
+ }
93
+ /**
94
+ * Get a list of vouchers with pagination
95
+ * @param {GetVoucherListParams} params - Parameters for retrieving voucher list
96
+ * @param {VoucherStatus} params.status - Filter by voucher status (UPCOMING, ONGOING, EXPIRED, or ALL)
97
+ * @param {number} [params.page_no] - Page number to retrieve (default: 1, range: 1-5000)
98
+ * @param {number} [params.page_size] - Number of items per page (default: 20, range: 1-100)
99
+ * @returns {Promise<GetVoucherListResponse>} The response containing a paginated list of vouchers
100
+ *
101
+ * The response includes:
102
+ * - Pagination information (more: boolean indicating if there are more pages)
103
+ * - A list of vouchers with details such as ID, code, name, type, usage statistics, timing, and reward information
104
+ */
105
+ async getVoucherList(params) {
106
+ const response = await ShopeeFetch.fetch(this.config, '/voucher/get_voucher_list', {
107
+ method: 'GET',
108
+ auth: true,
109
+ params,
110
+ });
111
+ return response;
112
+ }
113
+ }
114
+ //# sourceMappingURL=voucher.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voucher.manager.js","sourceRoot":"","sources":["../../src/managers/voucher.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgBhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC3C,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,MAAwB;QACvC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,sBAAsB,EACtB;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACf,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,yBAAyB,EACzB;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACf,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CAAC,MAAwB;QACvC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,sBAAsB,EACtB;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACf,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,yBAAyB,EACzB;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACf,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,UAAU,CAAC,MAAwB;QACvC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,sBAAsB,EACtB;YACI,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACT,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,cAAc,CAAC,MAA4B;QAC/C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,2BAA2B,EAC3B;YACI,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACT,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACJ"}
@@ -0,0 +1,27 @@
1
+ export interface AccessToken {
2
+ refresh_token: string;
3
+ access_token: string;
4
+ expire_in: number;
5
+ request_id: string;
6
+ error: string;
7
+ message: string;
8
+ shop_id?: number;
9
+ merchant_id_list?: number[];
10
+ shop_id_list?: number[];
11
+ supplier_id_list?: number[];
12
+ }
13
+ export interface RefreshedAccessToken extends Omit<AccessToken, 'merchant_id_list' | 'shop_id_list' | 'supplier_id_list'> {
14
+ partner_id: number;
15
+ shop_id?: number;
16
+ merchant_id?: number;
17
+ }
18
+ export interface TokenByResendCode {
19
+ request_id: string;
20
+ error: string;
21
+ message: string;
22
+ shop_id_list?: number[];
23
+ merchant_id_list?: number[];
24
+ refresh_token: string;
25
+ access_token: string;
26
+ expire_in: number;
27
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=access-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access-token.js","sourceRoot":"","sources":["../../src/schemas/access-token.ts"],"names":[],"mappings":""}
@@ -0,0 +1,62 @@
1
+ import { BaseResponse } from "./base.js";
2
+ /**
3
+ * Response for the get total balance API
4
+ */
5
+ export interface GetTotalBalanceResponse extends BaseResponse {
6
+ response: {
7
+ /** Timestamp indicating when the total balance snapshot was taken */
8
+ data_timestamp: number;
9
+ /** Seller's total ads credit balance, including paid credits and free credits */
10
+ total_balance: number;
11
+ };
12
+ /** Optional warning message if some data cannot be responded normally */
13
+ warning?: string;
14
+ }
15
+ /**
16
+ * Response for the get shop toggle info API
17
+ */
18
+ export interface GetShopToggleInfoResponse extends BaseResponse {
19
+ response: {
20
+ /** Timestamp of data in response */
21
+ data_timestamp: number;
22
+ /** Auto top-up toggle on/off */
23
+ auto_top_up: boolean;
24
+ /** Campaign surge toggle on/off */
25
+ campaign_surge: boolean;
26
+ };
27
+ /** Optional warning message if some data cannot be responded normally */
28
+ warning?: string;
29
+ }
30
+ /**
31
+ * Parameters for the get recommended keyword list API
32
+ */
33
+ export type GetRecommendedKeywordListParams = {
34
+ /** Shopee's unique identifier for an item */
35
+ item_id: number;
36
+ /** The keyword seller typed in the manually add keyword window */
37
+ input_keyword?: string;
38
+ };
39
+ /**
40
+ * Response for the get recommended keyword list API
41
+ */
42
+ export interface GetRecommendedKeywordListResponse extends BaseResponse {
43
+ response: {
44
+ /** Shopee's unique identifier for an item */
45
+ item_id: number;
46
+ /** The keyword seller typed in the manually add keyword window */
47
+ input_keyword?: string;
48
+ /** Suggested keywords recommended from product */
49
+ suggested_keywords: Array<{
50
+ /** Keyword value (Only return the highly recommended keywords, will be sightly different from Seller Center) */
51
+ keyword: string;
52
+ /** This is a measure of how attractive your ad is and its relevance to the keyword. The higher the quality score, the higher your ad rank. Ad rank is based on this score and your bid price. */
53
+ quality_score: number;
54
+ /** The number of times the keyword has been searched on Shopee in the last 30 days. The larger the search volume, the more impressions your ad will receive. */
55
+ search_volume: number;
56
+ /** This is bid price suggested by Shopee algorithm for the keyword in local currency. */
57
+ suggested_bid: number;
58
+ }>;
59
+ };
60
+ /** Optional warning message if some data cannot be responded normally */
61
+ warning?: string;
62
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ads.js","sourceRoot":"","sources":["../../src/schemas/ads.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export type ApiRange = string[];
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=api-range.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-range.js","sourceRoot":"","sources":["../../src/schemas/api-range.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ export type InputValidationType = 'INT_TYPE' | 'STRING_TYPE' | 'ENUM_TYPE' | 'FLOAT_TYPE' | 'DATE_TYPE' | 'TIMESTAMP_TYPE';
2
+ export type FormatType = 'NORMAL' | 'QUANTITATIVE';
3
+ export type DateFormatType = 'YEAR_MONTH_DATE' | 'YEAR_MONTH';
4
+ export type InputType = 'DROP_DOWN' | 'MULTIPLE_SELECT' | 'TEXT_FILED' | 'COMBO_BOX' | 'MULTIPLE_SELECT_COMBO_BOX';
5
+ export interface AttributeValue {
6
+ value_id: number;
7
+ original_value_name: string;
8
+ display_value_name: string;
9
+ value_unit?: string;
10
+ parent_attribute_list: ParentAttribute[];
11
+ parent_brand_list: ParentBrand[];
12
+ }
13
+ export interface ParentAttribute {
14
+ parent_attribute_id: number;
15
+ parent_value_id: number;
16
+ }
17
+ export interface ParentBrand {
18
+ parent_brand_id: number;
19
+ }
20
+ export interface Attribute {
21
+ attribute_id: number;
22
+ original_attribute_name: string;
23
+ display_attribute_name: string;
24
+ is_mandatory: boolean;
25
+ input_validation_type: InputValidationType;
26
+ format_type: FormatType;
27
+ date_format_type?: DateFormatType;
28
+ input_type: InputType;
29
+ attribute_unit: string[];
30
+ attribute_value_list: AttributeValue[];
31
+ max_input_value_number: number;
32
+ introduction?: string;
33
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=attribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute.js","sourceRoot":"","sources":["../../src/schemas/attribute.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export interface AuthedMerchant {
2
+ region: string;
3
+ merchant_id: number;
4
+ auth_time: number;
5
+ expire_time: number;
6
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=authed-merchant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authed-merchant.js","sourceRoot":"","sources":["../../src/schemas/authed-merchant.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ export interface SipAffiliateShop {
2
+ region: string;
3
+ affi_shop_id: number;
4
+ }
5
+ export interface AuthedShop {
6
+ region: string;
7
+ shop_id: number;
8
+ auth_time: number;
9
+ expire_time: number;
10
+ sip_affi_shops: SipAffiliateShop[];
11
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=authed-shop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authed-shop.js","sourceRoot":"","sources":["../../src/schemas/authed-shop.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Base response interface that all API responses extend
3
+ */
4
+ export interface BaseResponse {
5
+ /** The identifier for an API request for error tracking */
6
+ request_id: string;
7
+ /** Error code if any error occurred */
8
+ error: string;
9
+ /** Error message if any error occurred */
10
+ message: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/schemas/base.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ export interface Category {
2
+ category_id: number;
3
+ parent_category_id: number;
4
+ original_category_name: string;
5
+ display_category_name: string;
6
+ has_children: boolean;
7
+ children?: Category[];
8
+ }
9
+ export interface GetCategoryParams {
10
+ language?: string;
11
+ shopId?: number;
12
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=category.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category.js","sourceRoot":"","sources":["../../src/schemas/category.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { RequestInit } from 'node-fetch';
2
+ export type FetchOptions = Omit<RequestInit, 'body'> & {
3
+ params?: Record<string, string | number | boolean | undefined | null | (string | number | boolean)[]>;
4
+ body?: unknown;
5
+ auth?: boolean;
6
+ };
7
+ export interface FetchResponse<T> {
8
+ result: T;
9
+ response: T;
10
+ request_id: string;
11
+ error: string;
12
+ message: string;
13
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/schemas/fetch.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ export * from './access-token.js';
2
+ export * from './attribute.js';
3
+ export * from './authed-merchant.js';
4
+ export * from './authed-shop.js';
5
+ export * from './category.js';
6
+ export * from './fetch.js';
7
+ export * from './order.js';
8
+ export * from './product.js';
9
+ export * from './public.js';
10
+ export * from './push.js';
11
+ export * from './region.js';
@@ -0,0 +1,12 @@
1
+ export * from './access-token.js';
2
+ export * from './attribute.js';
3
+ export * from './authed-merchant.js';
4
+ export * from './authed-shop.js';
5
+ export * from './category.js';
6
+ export * from './fetch.js';
7
+ export * from './order.js';
8
+ export * from './product.js';
9
+ export * from './public.js';
10
+ export * from './push.js';
11
+ export * from './region.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}