@congminh1254/shopee-sdk 0.10.0 → 1.1.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 (136) hide show
  1. package/README.md +172 -36
  2. package/lib/fetch.js +6 -0
  3. package/lib/fetch.js.map +1 -1
  4. package/lib/managers/add-on-deal.manager.d.ts +140 -0
  5. package/lib/managers/add-on-deal.manager.js +240 -0
  6. package/lib/managers/add-on-deal.manager.js.map +1 -0
  7. package/lib/managers/ads.manager.d.ts +217 -1
  8. package/lib/managers/ads.manager.js +312 -0
  9. package/lib/managers/ads.manager.js.map +1 -1
  10. package/lib/managers/bundle-deal.manager.d.ts +106 -0
  11. package/lib/managers/bundle-deal.manager.js +178 -0
  12. package/lib/managers/bundle-deal.manager.js.map +1 -0
  13. package/lib/managers/discount.manager.d.ts +102 -0
  14. package/lib/managers/discount.manager.js +167 -0
  15. package/lib/managers/discount.manager.js.map +1 -0
  16. package/lib/managers/fbs.manager.d.ts +115 -0
  17. package/lib/managers/fbs.manager.js +145 -0
  18. package/lib/managers/fbs.manager.js.map +1 -0
  19. package/lib/managers/first-mile.manager.d.ts +150 -0
  20. package/lib/managers/first-mile.manager.js +264 -0
  21. package/lib/managers/first-mile.manager.js.map +1 -0
  22. package/lib/managers/follow-prize.manager.d.ts +108 -0
  23. package/lib/managers/follow-prize.manager.js +152 -0
  24. package/lib/managers/follow-prize.manager.js.map +1 -0
  25. package/lib/managers/global-product.manager.d.ts +664 -0
  26. package/lib/managers/global-product.manager.js +904 -0
  27. package/lib/managers/global-product.manager.js.map +1 -0
  28. package/lib/managers/index.d.ts +17 -1
  29. package/lib/managers/index.js +17 -1
  30. package/lib/managers/index.js.map +1 -1
  31. package/lib/managers/livestream.manager.d.ts +377 -0
  32. package/lib/managers/livestream.manager.js +529 -0
  33. package/lib/managers/livestream.manager.js.map +1 -0
  34. package/lib/managers/logistics.manager.d.ts +267 -1
  35. package/lib/managers/logistics.manager.js +544 -0
  36. package/lib/managers/logistics.manager.js.map +1 -1
  37. package/lib/managers/media-space.manager.d.ts +179 -0
  38. package/lib/managers/media-space.manager.js +220 -0
  39. package/lib/managers/media-space.manager.js.map +1 -0
  40. package/lib/managers/media.manager.d.ts +226 -0
  41. package/lib/managers/media.manager.js +274 -0
  42. package/lib/managers/media.manager.js.map +1 -0
  43. package/lib/managers/merchant.manager.d.ts +100 -0
  44. package/lib/managers/merchant.manager.js +144 -0
  45. package/lib/managers/merchant.manager.js.map +1 -0
  46. package/lib/managers/order.manager.d.ts +213 -1
  47. package/lib/managers/order.manager.js +305 -0
  48. package/lib/managers/order.manager.js.map +1 -1
  49. package/lib/managers/payment.manager.d.ts +186 -1
  50. package/lib/managers/payment.manager.js +288 -0
  51. package/lib/managers/payment.manager.js.map +1 -1
  52. package/lib/managers/returns.manager.d.ts +200 -0
  53. package/lib/managers/returns.manager.js +300 -0
  54. package/lib/managers/returns.manager.js.map +1 -0
  55. package/lib/managers/sbs.manager.d.ts +112 -0
  56. package/lib/managers/sbs.manager.js +149 -0
  57. package/lib/managers/sbs.manager.js.map +1 -0
  58. package/lib/managers/shop-category.manager.d.ts +207 -0
  59. package/lib/managers/shop-category.manager.js +258 -0
  60. package/lib/managers/shop-category.manager.js.map +1 -0
  61. package/lib/managers/shop-flash-sale.manager.d.ts +242 -0
  62. package/lib/managers/shop-flash-sale.manager.js +321 -0
  63. package/lib/managers/shop-flash-sale.manager.js.map +1 -0
  64. package/lib/managers/shop.manager.d.ts +173 -0
  65. package/lib/managers/shop.manager.js +217 -0
  66. package/lib/managers/shop.manager.js.map +1 -0
  67. package/lib/managers/top-picks.manager.d.ts +62 -0
  68. package/lib/managers/top-picks.manager.js +91 -0
  69. package/lib/managers/top-picks.manager.js.map +1 -0
  70. package/lib/schemas/add-on-deal.d.ts +390 -0
  71. package/lib/schemas/add-on-deal.js +45 -0
  72. package/lib/schemas/add-on-deal.js.map +1 -0
  73. package/lib/schemas/ads.d.ts +437 -0
  74. package/lib/schemas/bundle-deal.d.ts +300 -0
  75. package/lib/schemas/bundle-deal.js +27 -0
  76. package/lib/schemas/bundle-deal.js.map +1 -0
  77. package/lib/schemas/discount.d.ts +334 -0
  78. package/lib/schemas/discount.js +15 -0
  79. package/lib/schemas/discount.js.map +1 -0
  80. package/lib/schemas/fbs.d.ts +117 -0
  81. package/lib/schemas/fbs.js +2 -0
  82. package/lib/schemas/fbs.js.map +1 -0
  83. package/lib/schemas/first-mile.d.ts +551 -0
  84. package/lib/schemas/first-mile.js +2 -0
  85. package/lib/schemas/first-mile.js.map +1 -0
  86. package/lib/schemas/follow-prize.d.ts +198 -0
  87. package/lib/schemas/follow-prize.js +27 -0
  88. package/lib/schemas/follow-prize.js.map +1 -0
  89. package/lib/schemas/global-product.d.ts +1127 -0
  90. package/lib/schemas/global-product.js +2 -0
  91. package/lib/schemas/global-product.js.map +1 -0
  92. package/lib/schemas/index.d.ts +13 -0
  93. package/lib/schemas/index.js +17 -0
  94. package/lib/schemas/index.js.map +1 -1
  95. package/lib/schemas/livestream.d.ts +649 -0
  96. package/lib/schemas/livestream.js +2 -0
  97. package/lib/schemas/livestream.js.map +1 -0
  98. package/lib/schemas/logistics.d.ts +979 -0
  99. package/lib/schemas/logistics.js +13 -0
  100. package/lib/schemas/logistics.js.map +1 -1
  101. package/lib/schemas/media-space.d.ts +189 -0
  102. package/lib/schemas/media-space.js +2 -0
  103. package/lib/schemas/media-space.js.map +1 -0
  104. package/lib/schemas/media.d.ts +230 -0
  105. package/lib/schemas/media.js +2 -0
  106. package/lib/schemas/media.js.map +1 -0
  107. package/lib/schemas/merchant.d.ts +236 -0
  108. package/lib/schemas/merchant.js +2 -0
  109. package/lib/schemas/merchant.js.map +1 -0
  110. package/lib/schemas/order.d.ts +431 -0
  111. package/lib/schemas/payment.d.ts +397 -0
  112. package/lib/schemas/returns.d.ts +632 -0
  113. package/lib/schemas/returns.js +63 -0
  114. package/lib/schemas/returns.js.map +1 -0
  115. package/lib/schemas/sbs.d.ts +484 -0
  116. package/lib/schemas/sbs.js +2 -0
  117. package/lib/schemas/sbs.js.map +1 -0
  118. package/lib/schemas/shop-category.d.ts +176 -0
  119. package/lib/schemas/shop-category.js +2 -0
  120. package/lib/schemas/shop-category.js.map +1 -0
  121. package/lib/schemas/shop-flash-sale.d.ts +473 -0
  122. package/lib/schemas/shop-flash-sale.js +43 -0
  123. package/lib/schemas/shop-flash-sale.js.map +1 -0
  124. package/lib/schemas/shop.d.ts +250 -0
  125. package/lib/schemas/shop.js +2 -0
  126. package/lib/schemas/shop.js.map +1 -0
  127. package/lib/schemas/top-picks.d.ts +99 -0
  128. package/lib/schemas/top-picks.js +2 -0
  129. package/lib/schemas/top-picks.js.map +1 -0
  130. package/lib/sdk.d.ts +34 -0
  131. package/lib/sdk.js +34 -0
  132. package/lib/sdk.js.map +1 -1
  133. package/lib/version.d.ts +1 -0
  134. package/lib/version.js +3 -0
  135. package/lib/version.js.map +1 -0
  136. package/package.json +4 -5
@@ -0,0 +1,106 @@
1
+ import { ShopeeConfig } from "../sdk.js";
2
+ import { BaseManager } from "./base.manager.js";
3
+ import { AddBundleDealParams, AddBundleDealResponse, AddBundleDealItemParams, AddBundleDealItemResponse, DeleteBundleDealParams, DeleteBundleDealResponse, DeleteBundleDealItemParams, DeleteBundleDealItemResponse, EndBundleDealParams, EndBundleDealResponse, GetBundleDealParams, GetBundleDealResponse, GetBundleDealItemParams, GetBundleDealItemResponse, GetBundleDealListParams, GetBundleDealListResponse, UpdateBundleDealParams, UpdateBundleDealResponse, UpdateBundleDealItemParams, UpdateBundleDealItemResponse } from "../schemas/bundle-deal.js";
4
+ export declare class BundleDealManager extends BaseManager {
5
+ constructor(config: ShopeeConfig);
6
+ /**
7
+ * Create a new bundle deal activity
8
+ * @param {AddBundleDealParams} params - Parameters for creating a new bundle deal
9
+ * @returns {Promise<AddBundleDealResponse>} The response containing the created bundle deal ID
10
+ *
11
+ * Note: A maximum of 1000 bundle deals can be created.
12
+ * The bundle deal must follow the pricing rules based on rule_type.
13
+ */
14
+ addBundleDeal(params: AddBundleDealParams): Promise<AddBundleDealResponse>;
15
+ /**
16
+ * Add items to an existing bundle deal activity
17
+ * @param {AddBundleDealItemParams} params - Parameters for adding items to a bundle deal
18
+ * @returns {Promise<AddBundleDealItemResponse>} The response containing lists of successful and failed items
19
+ *
20
+ * The response includes:
21
+ * - success_list: Array of item IDs that were successfully added
22
+ * - failed_list: Array of items that failed to be added with error details
23
+ */
24
+ addBundleDealItem(params: AddBundleDealItemParams): Promise<AddBundleDealItemResponse>;
25
+ /**
26
+ * Delete an existing bundle deal activity
27
+ * @param {DeleteBundleDealParams} params - Parameters for deleting a bundle deal
28
+ * @returns {Promise<DeleteBundleDealResponse>} The response containing the deleted bundle deal ID
29
+ *
30
+ * Note: Can only delete upcoming bundle deals that haven't started yet.
31
+ * Will return an error if attempting to delete a bundle deal that has already started.
32
+ */
33
+ deleteBundleDeal(params: DeleteBundleDealParams): Promise<DeleteBundleDealResponse>;
34
+ /**
35
+ * Delete items from an existing bundle deal activity
36
+ * @param {DeleteBundleDealItemParams} params - Parameters for deleting items from a bundle deal
37
+ * @returns {Promise<DeleteBundleDealItemResponse>} The response containing lists of successful and failed deletions
38
+ *
39
+ * The response includes:
40
+ * - success_list: Array of item IDs that were successfully deleted
41
+ * - failed_list: Array of items that failed to be deleted with error details
42
+ */
43
+ deleteBundleDealItem(params: DeleteBundleDealItemParams): Promise<DeleteBundleDealItemResponse>;
44
+ /**
45
+ * End an ongoing bundle deal activity immediately
46
+ * @param {EndBundleDealParams} params - Parameters for ending a bundle deal
47
+ * @returns {Promise<EndBundleDealResponse>} The response containing the ended bundle deal ID
48
+ *
49
+ * Note: Can only end bundle deals that are currently ongoing/active.
50
+ * Will return an error if attempting to end an upcoming or expired bundle deal.
51
+ */
52
+ endBundleDeal(params: EndBundleDealParams): Promise<EndBundleDealResponse>;
53
+ /**
54
+ * Get detailed information about a bundle deal activity
55
+ * @param {GetBundleDealParams} params - Parameters for getting bundle deal details
56
+ * @returns {Promise<GetBundleDealResponse>} The response containing comprehensive bundle deal information
57
+ *
58
+ * The response includes:
59
+ * - Basic bundle deal details (ID, name, timing, etc.)
60
+ * - Bundle deal rule configuration (type, pricing, min amount, etc.)
61
+ * - Purchase limits
62
+ * - Additional tiers if configured
63
+ */
64
+ getBundleDeal(params: GetBundleDealParams): Promise<GetBundleDealResponse>;
65
+ /**
66
+ * Get the list of items in a bundle deal
67
+ * @param {GetBundleDealItemParams} params - Parameters for getting bundle deal items
68
+ * @returns {Promise<GetBundleDealItemResponse>} The response containing the list of item IDs
69
+ *
70
+ * The response includes:
71
+ * - item_list: Array of item IDs that are part of the bundle deal
72
+ */
73
+ getBundleDealItem(params: GetBundleDealItemParams): Promise<GetBundleDealItemResponse>;
74
+ /**
75
+ * Get a list of bundle deal activities with pagination
76
+ * @param {GetBundleDealListParams} params - Parameters for retrieving bundle deal list
77
+ * @param {BundleDealTimeStatus} [params.time_status] - Filter by bundle deal status (default: ALL)
78
+ * @param {number} [params.page_no] - Page number to retrieve (default: 1)
79
+ * @param {number} [params.page_size] - Number of items per page (default: 20, max: 1000)
80
+ * @returns {Promise<GetBundleDealListResponse>} The response containing a paginated list of bundle deals
81
+ *
82
+ * The response includes:
83
+ * - bundle_deal_list: List of bundle deals with full details
84
+ * - more: Boolean indicating if there are more pages
85
+ */
86
+ getBundleDealList(params?: GetBundleDealListParams): Promise<GetBundleDealListResponse>;
87
+ /**
88
+ * Update an existing bundle deal activity
89
+ * @param {UpdateBundleDealParams} params - Parameters for updating a bundle deal
90
+ * @returns {Promise<UpdateBundleDealResponse>} The response containing the updated bundle deal information
91
+ *
92
+ * Note: For ongoing bundle deals, update capabilities may be limited.
93
+ * Only certain fields can be modified depending on the bundle deal status.
94
+ */
95
+ updateBundleDeal(params: UpdateBundleDealParams): Promise<UpdateBundleDealResponse>;
96
+ /**
97
+ * Update items in an existing bundle deal activity
98
+ * @param {UpdateBundleDealItemParams} params - Parameters for updating bundle deal items
99
+ * @returns {Promise<UpdateBundleDealItemResponse>} The response containing lists of successful and failed updates
100
+ *
101
+ * The response includes:
102
+ * - success_list: Array of item IDs that were successfully updated
103
+ * - failed_list: Array of items that failed to be updated with error details
104
+ */
105
+ updateBundleDealItem(params: UpdateBundleDealItemParams): Promise<UpdateBundleDealItemResponse>;
106
+ }
@@ -0,0 +1,178 @@
1
+ import { BaseManager } from "./base.manager.js";
2
+ import { ShopeeFetch } from "../fetch.js";
3
+ export class BundleDealManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ /**
8
+ * Create a new bundle deal activity
9
+ * @param {AddBundleDealParams} params - Parameters for creating a new bundle deal
10
+ * @returns {Promise<AddBundleDealResponse>} The response containing the created bundle deal ID
11
+ *
12
+ * Note: A maximum of 1000 bundle deals can be created.
13
+ * The bundle deal must follow the pricing rules based on rule_type.
14
+ */
15
+ async addBundleDeal(params) {
16
+ const response = await ShopeeFetch.fetch(this.config, "/bundle_deal/add_bundle_deal", {
17
+ method: "POST",
18
+ auth: true,
19
+ body: params,
20
+ });
21
+ return response;
22
+ }
23
+ /**
24
+ * Add items to an existing bundle deal activity
25
+ * @param {AddBundleDealItemParams} params - Parameters for adding items to a bundle deal
26
+ * @returns {Promise<AddBundleDealItemResponse>} The response containing lists of successful and failed items
27
+ *
28
+ * The response includes:
29
+ * - success_list: Array of item IDs that were successfully added
30
+ * - failed_list: Array of items that failed to be added with error details
31
+ */
32
+ async addBundleDealItem(params) {
33
+ const response = await ShopeeFetch.fetch(this.config, "/bundle_deal/add_bundle_deal_item", {
34
+ method: "POST",
35
+ auth: true,
36
+ body: params,
37
+ });
38
+ return response;
39
+ }
40
+ /**
41
+ * Delete an existing bundle deal activity
42
+ * @param {DeleteBundleDealParams} params - Parameters for deleting a bundle deal
43
+ * @returns {Promise<DeleteBundleDealResponse>} The response containing the deleted bundle deal ID
44
+ *
45
+ * Note: Can only delete upcoming bundle deals that haven't started yet.
46
+ * Will return an error if attempting to delete a bundle deal that has already started.
47
+ */
48
+ async deleteBundleDeal(params) {
49
+ const response = await ShopeeFetch.fetch(this.config, "/bundle_deal/delete_bundle_deal", {
50
+ method: "POST",
51
+ auth: true,
52
+ body: params,
53
+ });
54
+ return response;
55
+ }
56
+ /**
57
+ * Delete items from an existing bundle deal activity
58
+ * @param {DeleteBundleDealItemParams} params - Parameters for deleting items from a bundle deal
59
+ * @returns {Promise<DeleteBundleDealItemResponse>} The response containing lists of successful and failed deletions
60
+ *
61
+ * The response includes:
62
+ * - success_list: Array of item IDs that were successfully deleted
63
+ * - failed_list: Array of items that failed to be deleted with error details
64
+ */
65
+ async deleteBundleDealItem(params) {
66
+ const response = await ShopeeFetch.fetch(this.config, "/bundle_deal/delete_bundle_deal_item", {
67
+ method: "POST",
68
+ auth: true,
69
+ body: params,
70
+ });
71
+ return response;
72
+ }
73
+ /**
74
+ * End an ongoing bundle deal activity immediately
75
+ * @param {EndBundleDealParams} params - Parameters for ending a bundle deal
76
+ * @returns {Promise<EndBundleDealResponse>} The response containing the ended bundle deal ID
77
+ *
78
+ * Note: Can only end bundle deals that are currently ongoing/active.
79
+ * Will return an error if attempting to end an upcoming or expired bundle deal.
80
+ */
81
+ async endBundleDeal(params) {
82
+ const response = await ShopeeFetch.fetch(this.config, "/bundle_deal/end_bundle_deal", {
83
+ method: "POST",
84
+ auth: true,
85
+ body: params,
86
+ });
87
+ return response;
88
+ }
89
+ /**
90
+ * Get detailed information about a bundle deal activity
91
+ * @param {GetBundleDealParams} params - Parameters for getting bundle deal details
92
+ * @returns {Promise<GetBundleDealResponse>} The response containing comprehensive bundle deal information
93
+ *
94
+ * The response includes:
95
+ * - Basic bundle deal details (ID, name, timing, etc.)
96
+ * - Bundle deal rule configuration (type, pricing, min amount, etc.)
97
+ * - Purchase limits
98
+ * - Additional tiers if configured
99
+ */
100
+ async getBundleDeal(params) {
101
+ const response = await ShopeeFetch.fetch(this.config, "/bundle_deal/get_bundle_deal", {
102
+ method: "POST",
103
+ auth: true,
104
+ body: params,
105
+ });
106
+ return response;
107
+ }
108
+ /**
109
+ * Get the list of items in a bundle deal
110
+ * @param {GetBundleDealItemParams} params - Parameters for getting bundle deal items
111
+ * @returns {Promise<GetBundleDealItemResponse>} The response containing the list of item IDs
112
+ *
113
+ * The response includes:
114
+ * - item_list: Array of item IDs that are part of the bundle deal
115
+ */
116
+ async getBundleDealItem(params) {
117
+ const response = await ShopeeFetch.fetch(this.config, "/bundle_deal/get_bundle_deal_item", {
118
+ method: "POST",
119
+ auth: true,
120
+ body: params,
121
+ });
122
+ return response;
123
+ }
124
+ /**
125
+ * Get a list of bundle deal activities with pagination
126
+ * @param {GetBundleDealListParams} params - Parameters for retrieving bundle deal list
127
+ * @param {BundleDealTimeStatus} [params.time_status] - Filter by bundle deal status (default: ALL)
128
+ * @param {number} [params.page_no] - Page number to retrieve (default: 1)
129
+ * @param {number} [params.page_size] - Number of items per page (default: 20, max: 1000)
130
+ * @returns {Promise<GetBundleDealListResponse>} The response containing a paginated list of bundle deals
131
+ *
132
+ * The response includes:
133
+ * - bundle_deal_list: List of bundle deals with full details
134
+ * - more: Boolean indicating if there are more pages
135
+ */
136
+ async getBundleDealList(params = {}) {
137
+ const response = await ShopeeFetch.fetch(this.config, "/bundle_deal/get_bundle_deal_list", {
138
+ method: "POST",
139
+ auth: true,
140
+ body: params,
141
+ });
142
+ return response;
143
+ }
144
+ /**
145
+ * Update an existing bundle deal activity
146
+ * @param {UpdateBundleDealParams} params - Parameters for updating a bundle deal
147
+ * @returns {Promise<UpdateBundleDealResponse>} The response containing the updated bundle deal information
148
+ *
149
+ * Note: For ongoing bundle deals, update capabilities may be limited.
150
+ * Only certain fields can be modified depending on the bundle deal status.
151
+ */
152
+ async updateBundleDeal(params) {
153
+ const response = await ShopeeFetch.fetch(this.config, "/bundle_deal/update_bundle_deal", {
154
+ method: "POST",
155
+ auth: true,
156
+ body: params,
157
+ });
158
+ return response;
159
+ }
160
+ /**
161
+ * Update items in an existing bundle deal activity
162
+ * @param {UpdateBundleDealItemParams} params - Parameters for updating bundle deal items
163
+ * @returns {Promise<UpdateBundleDealItemResponse>} The response containing lists of successful and failed updates
164
+ *
165
+ * The response includes:
166
+ * - success_list: Array of item IDs that were successfully updated
167
+ * - failed_list: Array of items that failed to be updated with error details
168
+ */
169
+ async updateBundleDealItem(params) {
170
+ const response = await ShopeeFetch.fetch(this.config, "/bundle_deal/update_bundle_deal_item", {
171
+ method: "POST",
172
+ auth: true,
173
+ body: params,
174
+ });
175
+ return response;
176
+ }
177
+ }
178
+ //# sourceMappingURL=bundle-deal.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle-deal.manager.js","sourceRoot":"","sources":["../../src/managers/bundle-deal.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAuBhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAChD,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,8BAA8B,EAC9B;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,iBAAiB,CAAC,MAA+B;QACrD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,mCAAmC,EACnC;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,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ACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,iBAAiB,CACrB,SAAkC,EAAE;QAEpC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,mCAAmC,EACnC;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,gBAAgB,CAAC,MAA8B;QACnD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,iCAAiC,EACjC;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,oBAAoB,CACxB,MAAkC;QAElC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,sCAAsC,EACtC;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,102 @@
1
+ import { ShopeeConfig } from "../sdk.js";
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";
4
+ export declare class DiscountManager extends BaseManager {
5
+ constructor(config: ShopeeConfig);
6
+ /**
7
+ * Add a new shop discount activity
8
+ * @param {AddDiscountParams} params - Parameters for creating a new discount
9
+ * @returns {Promise<AddDiscountResponse>} The response containing the created discount ID
10
+ *
11
+ * Note: The start time must be 1 hour later than current time.
12
+ * The end time must be 1 hour later than start time, and the discount period must be less than 180 days.
13
+ */
14
+ addDiscount(params: AddDiscountParams): Promise<AddDiscountResponse>;
15
+ /**
16
+ * Add items to an existing discount activity
17
+ * @param {AddDiscountItemParams} params - Parameters for adding items to a discount
18
+ * @returns {Promise<AddDiscountItemResponse>} The response containing the count of added items and any errors
19
+ *
20
+ * The response includes:
21
+ * - discount_id: The ID of the discount activity
22
+ * - count: Number of items successfully added
23
+ * - error_list: List of items that failed to be added with error details
24
+ * - warning: Warning message if any
25
+ */
26
+ addDiscountItem(params: AddDiscountItemParams): Promise<AddDiscountItemResponse>;
27
+ /**
28
+ * Delete an existing discount activity
29
+ * @param {DeleteDiscountParams} params - Parameters for deleting a discount
30
+ * @returns {Promise<DeleteDiscountResponse>} The response containing the deleted discount ID and modification time
31
+ *
32
+ * Note: Can only delete upcoming discounts that haven't started yet.
33
+ * Will return an error if attempting to delete a discount that has already started.
34
+ */
35
+ deleteDiscount(params: DeleteDiscountParams): Promise<DeleteDiscountResponse>;
36
+ /**
37
+ * Delete items from an existing discount activity
38
+ * @param {DeleteDiscountItemParams} params - Parameters for deleting items from a discount
39
+ * @returns {Promise<DeleteDiscountItemResponse>} The response containing the discount ID and any errors
40
+ *
41
+ * The response includes:
42
+ * - discount_id: The ID of the discount activity
43
+ * - error_list: List of items that failed to be deleted with error details
44
+ */
45
+ deleteDiscountItem(params: DeleteDiscountItemParams): Promise<DeleteDiscountItemResponse>;
46
+ /**
47
+ * End an ongoing discount activity immediately
48
+ * @param {EndDiscountParams} params - Parameters for ending a discount
49
+ * @returns {Promise<EndDiscountResponse>} The response containing the ended discount ID and modification time
50
+ *
51
+ * Note: Can only end discounts that are currently ongoing/active.
52
+ * Will return an error if attempting to end an upcoming or expired discount.
53
+ */
54
+ endDiscount(params: EndDiscountParams): Promise<EndDiscountResponse>;
55
+ /**
56
+ * Get detailed information about a discount activity
57
+ * @param {GetDiscountParams} params - Parameters for getting discount details
58
+ * @returns {Promise<GetDiscountResponse>} The response containing comprehensive discount information
59
+ *
60
+ * The response includes:
61
+ * - Basic discount details (ID, name, status, timing, etc.)
62
+ * - Item list with detailed pricing information (original price, promotion price, stock, etc.)
63
+ * - For items with variations: detailed model information
64
+ * - Purchase limits for each item
65
+ * - Pagination info (more: boolean indicating if there are more pages)
66
+ */
67
+ getDiscount(params: GetDiscountParams): Promise<GetDiscountResponse>;
68
+ /**
69
+ * Get a list of discount activities with pagination
70
+ * @param {GetDiscountListParams} params - Parameters for retrieving discount list
71
+ * @param {DiscountStatus} params.discount_status - Filter by discount status (UPCOMING, ONGOING, EXPIRED, or ALL)
72
+ * @param {number} [params.page_no] - Page number to retrieve (default: 1)
73
+ * @param {number} [params.page_size] - Number of items per page (default: 100, max: 100)
74
+ * @returns {Promise<GetDiscountListResponse>} The response containing a paginated list of discounts
75
+ *
76
+ * The response includes:
77
+ * - Pagination information (more: boolean indicating if there are more pages)
78
+ * - A list of discounts with basic details such as ID, name, status, start/end time, and source
79
+ */
80
+ getDiscountList(params: GetDiscountListParams): Promise<GetDiscountListResponse>;
81
+ /**
82
+ * Update an existing discount activity
83
+ * @param {UpdateDiscountParams} params - Parameters for updating a discount
84
+ * @returns {Promise<UpdateDiscountResponse>} The response containing the updated discount ID and modification time
85
+ *
86
+ * Note: For ongoing discounts, update capabilities may be limited.
87
+ * Only certain fields can be modified depending on the discount status.
88
+ */
89
+ updateDiscount(params: UpdateDiscountParams): Promise<UpdateDiscountResponse>;
90
+ /**
91
+ * Update items in an existing discount activity
92
+ * @param {UpdateDiscountItemParams} params - Parameters for updating discount items
93
+ * @returns {Promise<UpdateDiscountItemResponse>} The response containing the count of updated items and any errors
94
+ *
95
+ * The response includes:
96
+ * - discount_id: The ID of the discount activity
97
+ * - count: Number of items successfully updated
98
+ * - error_list: List of items that failed to be updated with error details
99
+ * - warning: Warning message if any
100
+ */
101
+ updateDiscountItem(params: UpdateDiscountItemParams): Promise<UpdateDiscountItemResponse>;
102
+ }
@@ -0,0 +1,167 @@
1
+ import { BaseManager } from "./base.manager.js";
2
+ import { ShopeeFetch } from "../fetch.js";
3
+ export class DiscountManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ /**
8
+ * Add a new shop discount activity
9
+ * @param {AddDiscountParams} params - Parameters for creating a new discount
10
+ * @returns {Promise<AddDiscountResponse>} The response containing the created discount ID
11
+ *
12
+ * Note: The start time must be 1 hour later than current time.
13
+ * The end time must be 1 hour later than start time, and the discount period must be less than 180 days.
14
+ */
15
+ async addDiscount(params) {
16
+ const response = await ShopeeFetch.fetch(this.config, "/discount/add_discount", {
17
+ method: "POST",
18
+ auth: true,
19
+ body: params,
20
+ });
21
+ return response;
22
+ }
23
+ /**
24
+ * Add items to an existing discount activity
25
+ * @param {AddDiscountItemParams} params - Parameters for adding items to a discount
26
+ * @returns {Promise<AddDiscountItemResponse>} The response containing the count of added items and any errors
27
+ *
28
+ * The response includes:
29
+ * - discount_id: The ID of the discount activity
30
+ * - count: Number of items successfully added
31
+ * - error_list: List of items that failed to be added with error details
32
+ * - warning: Warning message if any
33
+ */
34
+ async addDiscountItem(params) {
35
+ const response = await ShopeeFetch.fetch(this.config, "/discount/add_discount_item", {
36
+ method: "POST",
37
+ auth: true,
38
+ body: params,
39
+ });
40
+ return response;
41
+ }
42
+ /**
43
+ * Delete an existing discount activity
44
+ * @param {DeleteDiscountParams} params - Parameters for deleting a discount
45
+ * @returns {Promise<DeleteDiscountResponse>} The response containing the deleted discount ID and modification time
46
+ *
47
+ * Note: Can only delete upcoming discounts that haven't started yet.
48
+ * Will return an error if attempting to delete a discount that has already started.
49
+ */
50
+ async deleteDiscount(params) {
51
+ const response = await ShopeeFetch.fetch(this.config, "/discount/delete_discount", {
52
+ method: "POST",
53
+ auth: true,
54
+ body: params,
55
+ });
56
+ return response;
57
+ }
58
+ /**
59
+ * Delete items from an existing discount activity
60
+ * @param {DeleteDiscountItemParams} params - Parameters for deleting items from a discount
61
+ * @returns {Promise<DeleteDiscountItemResponse>} The response containing the discount ID and any errors
62
+ *
63
+ * The response includes:
64
+ * - discount_id: The ID of the discount activity
65
+ * - error_list: List of items that failed to be deleted with error details
66
+ */
67
+ async deleteDiscountItem(params) {
68
+ const response = await ShopeeFetch.fetch(this.config, "/discount/delete_discount_item", {
69
+ method: "POST",
70
+ auth: true,
71
+ body: params,
72
+ });
73
+ return response;
74
+ }
75
+ /**
76
+ * End an ongoing discount activity immediately
77
+ * @param {EndDiscountParams} params - Parameters for ending a discount
78
+ * @returns {Promise<EndDiscountResponse>} The response containing the ended discount ID and modification time
79
+ *
80
+ * Note: Can only end discounts that are currently ongoing/active.
81
+ * Will return an error if attempting to end an upcoming or expired discount.
82
+ */
83
+ async endDiscount(params) {
84
+ const response = await ShopeeFetch.fetch(this.config, "/discount/end_discount", {
85
+ method: "POST",
86
+ auth: true,
87
+ body: params,
88
+ });
89
+ return response;
90
+ }
91
+ /**
92
+ * Get detailed information about a discount activity
93
+ * @param {GetDiscountParams} params - Parameters for getting discount details
94
+ * @returns {Promise<GetDiscountResponse>} The response containing comprehensive discount information
95
+ *
96
+ * The response includes:
97
+ * - Basic discount details (ID, name, status, timing, etc.)
98
+ * - Item list with detailed pricing information (original price, promotion price, stock, etc.)
99
+ * - For items with variations: detailed model information
100
+ * - Purchase limits for each item
101
+ * - Pagination info (more: boolean indicating if there are more pages)
102
+ */
103
+ async getDiscount(params) {
104
+ const response = await ShopeeFetch.fetch(this.config, "/discount/get_discount", {
105
+ method: "GET",
106
+ auth: true,
107
+ params,
108
+ });
109
+ return response;
110
+ }
111
+ /**
112
+ * Get a list of discount activities with pagination
113
+ * @param {GetDiscountListParams} params - Parameters for retrieving discount list
114
+ * @param {DiscountStatus} params.discount_status - Filter by discount status (UPCOMING, ONGOING, EXPIRED, or ALL)
115
+ * @param {number} [params.page_no] - Page number to retrieve (default: 1)
116
+ * @param {number} [params.page_size] - Number of items per page (default: 100, max: 100)
117
+ * @returns {Promise<GetDiscountListResponse>} The response containing a paginated list of discounts
118
+ *
119
+ * The response includes:
120
+ * - Pagination information (more: boolean indicating if there are more pages)
121
+ * - A list of discounts with basic details such as ID, name, status, start/end time, and source
122
+ */
123
+ async getDiscountList(params) {
124
+ const response = await ShopeeFetch.fetch(this.config, "/discount/get_discount_list", {
125
+ method: "GET",
126
+ auth: true,
127
+ params,
128
+ });
129
+ return response;
130
+ }
131
+ /**
132
+ * Update an existing discount activity
133
+ * @param {UpdateDiscountParams} params - Parameters for updating a discount
134
+ * @returns {Promise<UpdateDiscountResponse>} The response containing the updated discount ID and modification time
135
+ *
136
+ * Note: For ongoing discounts, update capabilities may be limited.
137
+ * Only certain fields can be modified depending on the discount status.
138
+ */
139
+ async updateDiscount(params) {
140
+ const response = await ShopeeFetch.fetch(this.config, "/discount/update_discount", {
141
+ method: "POST",
142
+ auth: true,
143
+ body: params,
144
+ });
145
+ return response;
146
+ }
147
+ /**
148
+ * Update items in an existing discount activity
149
+ * @param {UpdateDiscountItemParams} params - Parameters for updating discount items
150
+ * @returns {Promise<UpdateDiscountItemResponse>} The response containing the count of updated items and any errors
151
+ *
152
+ * The response includes:
153
+ * - discount_id: The ID of the discount activity
154
+ * - count: Number of items successfully updated
155
+ * - error_list: List of items that failed to be updated with error details
156
+ * - warning: Warning message if any
157
+ */
158
+ async updateDiscountItem(params) {
159
+ const response = await ShopeeFetch.fetch(this.config, "/discount/update_discount_item", {
160
+ method: "POST",
161
+ auth: true,
162
+ body: params,
163
+ });
164
+ return response;
165
+ }
166
+ }
167
+ //# sourceMappingURL=discount.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discount.manager.js","sourceRoot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