@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
package/README.md CHANGED
@@ -6,62 +6,198 @@
6
6
  [![Node.js Version](https://img.shields.io/node/v/@congminh1254/shopee-sdk.svg)](https://www.npmjs.com/package/@congminh1254/shopee-sdk)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
8
 
9
- A TypeScript SDK for interacting with the Shopee Open API, maintained by the community.
9
+ 🎉 **The most complete, production-ready TypeScript SDK for Shopee Open API** 🎉
10
+
11
+ Build powerful Shopee integrations with confidence using our fully-featured SDK that covers **100% of Shopee's API endpoints**. Trusted by developers, built by the community.
12
+
13
+ ## 📚 Documentation
14
+
15
+ **[Complete Documentation](./docs/README.md)** - Comprehensive guides and API references
16
+
17
+ ### Quick Links
18
+
19
+ **Getting Started:**
20
+ - [Setup Guide](./docs/guides/setup.md) - Installation and configuration
21
+ - [Authentication](./docs/guides/authentication.md) - OAuth flow and token management
22
+ - [Token Storage](./docs/guides/token-storage.md) - Managing access tokens
23
+ - [Proxy Configuration](./docs/guides/proxy.md) - Using HTTP/HTTPS proxies
24
+
25
+ **API Managers:**
26
+ - [AuthManager](./docs/managers/auth.md) - Authentication operations
27
+ - [ProductManager](./docs/managers/product.md) - Product catalog management
28
+ - [OrderManager](./docs/managers/order.md) - Order processing
29
+ - [LogisticsManager](./docs/managers/logistics.md) - Shipping operations
30
+ - [PaymentManager](./docs/managers/payment.md) - Payment information
31
+ - [VoucherManager](./docs/managers/voucher.md) - Discount management
32
+ - [PushManager](./docs/managers/push.md) - Webhooks and notifications
33
+ - [PublicManager](./docs/managers/public.md) - Public API endpoints
34
+ - [AdsManager](./docs/managers/ads.md) - Advertising campaigns
35
+ - [AccountHealthManager](./docs/managers/account-health.md) - Performance metrics
36
+ - [ShopManager](./docs/managers/shop.md) - Shop information and settings
37
+ - [MediaManager](./docs/managers/media.md) - Image and video upload
38
+ - [MediaSpaceManager](./docs/managers/media-space.md) - Media uploads (images and videos)
39
+ - [MerchantManager](./docs/managers/merchant.md) - Merchant information and warehouses
40
+ - [GlobalProductManager](./docs/managers/global-product.md) - Global product management
41
+ - [FirstMileManager](./docs/managers/first-mile.md) - First mile logistics
42
+ - [DiscountManager](./docs/managers/discount.md) - Discount campaigns
43
+ - [BundleDealManager](./docs/managers/bundle-deal.md) - Bundle deal promotions
44
+ - [AddOnDealManager](./docs/managers/add-on-deal.md) - Add-on deal promotions
45
+ - [ShopFlashSaleManager](./docs/managers/shop-flash-sale.md) - Flash sale campaigns
46
+ - [FollowPrizeManager](./docs/managers/follow-prize.md) - Follow prize activities
47
+ - [TopPicksManager](./docs/managers/top-picks.md) - Top picks collections
48
+ - [ShopCategoryManager](./docs/managers/shop-category.md) - Shop category management
49
+ - [ReturnsManager](./docs/managers/returns.md) - Return and refund management
50
+ - [SbsManager](./docs/managers/sbs.md) - Shopee Business Services (SBS) warehouse inventory
51
+ - [FbsManager](./docs/managers/fbs.md) - Fulfillment by Shopee operations
52
+ - [LivestreamManager](./docs/managers/livestream.md) - Live streaming features
10
53
 
11
54
  ## Installation
12
55
 
13
56
  ```bash
14
- npm install shopee-sdk
57
+ npm install @congminh1254/shopee-sdk
15
58
  ```
16
59
 
17
- ## Usage
60
+ **Requirements:** Node.js >= 18.0.0
61
+
62
+ ### What You Get
63
+ ✅ Complete TypeScript definitions for all 27 API managers
64
+ ✅ Automatic token refresh and management
65
+ ✅ Built-in error handling and retry logic
66
+ ✅ Zero dependencies (except node-fetch)
67
+ ✅ Full documentation and examples
68
+
69
+ ## Quick Start
70
+
71
+ Get up and running in minutes! Here's how easy it is to integrate with Shopee:
18
72
 
19
73
  ```typescript
20
- import { ShopeeClient } from "shopee-sdk";
74
+ import { ShopeeSDK, ShopeeRegion } from '@congminh1254/shopee-sdk';
21
75
 
22
- // Initialize the client
23
- const client = new ShopeeClient({
76
+ // 1. Initialize the SDK with your credentials
77
+ const sdk = new ShopeeSDK({
24
78
  partner_id: 123456,
25
- partner_key: "your-partner-key",
26
- base_url: "https://partner.test-stable.shopeemobile.com", // For sandbox
27
- // base_url: 'https://partner.shopeemobile.com', // For production
79
+ partner_key: 'your-partner-key',
80
+ region: ShopeeRegion.GLOBAL,
81
+ shop_id: 789012, // Optional for shop-specific operations
28
82
  });
29
83
 
30
- // Authenticate (if working with shop-level APIs)
31
- await client.auth.getToken({
32
- code: "authorization-code",
33
- shop_id: 123456,
34
- });
84
+ // 2. Authenticate your shop (OAuth flow)
85
+ const authUrl = sdk.getAuthorizationUrl('https://your-app.com/callback');
86
+ console.log('Visit:', authUrl);
87
+
88
+ // After user authorizes, exchange code for token (automatic token storage!)
89
+ await sdk.authenticateWithCode('auth-code-from-callback');
90
+
91
+ // 3. Start using the API - it's that simple!
35
92
 
36
- // Example: Get product list
37
- const products = await client.product.getItemList({
93
+ // Manage your products
94
+ const products = await sdk.product.getItemList({
38
95
  offset: 0,
39
- page_size: 10,
96
+ page_size: 20,
40
97
  });
41
98
 
42
- // Example: Add a voucher
43
- const voucher = await client.voucher.addVoucher({
44
- voucher_name: "Special Discount",
45
- voucher_code: "SAVE10",
46
- start_time: Math.floor(Date.now() / 1000),
47
- end_time: Math.floor(Date.now() / 1000) + 7 * 24 * 60 * 60, // 7 days
48
- voucher_type: 1, // shop voucher
49
- reward_type: 1, // fixed amount
50
- usage_quantity: 100,
51
- min_basket_price: 20,
52
- discount_amount: 10,
99
+ // Process orders
100
+ const orders = await sdk.order.getOrderList({
101
+ time_range_field: 'create_time',
102
+ time_from: Math.floor(Date.now() / 1000) - 86400,
103
+ time_to: Math.floor(Date.now() / 1000),
104
+ page_size: 50,
53
105
  });
54
106
 
55
- // Example: Get lost push messages (partner-level API, no auth required)
56
- const lostMessages = await client.push.getLostPushMessage();
57
- ```
107
+ // Track shipments
108
+ const shipping = await sdk.logistics.getShippingParameter({
109
+ order_sn: '220615ABCDEF',
110
+ });
58
111
 
59
- ## Features
112
+ // Handle returns
113
+ const returns = await sdk.returns.getReturnList({
114
+ page_size: 20,
115
+ });
116
+
117
+ // And much more - all with full TypeScript support! 🎉
118
+ ```
60
119
 
61
- - TypeScript support with full type definitions
62
- - Support for all Shopee Open API endpoints
63
- - Authentication flow helpers
64
- - Automatic token refresh
120
+ **That's it!** The SDK handles token refresh, request signing, error handling, and more automatically.
121
+
122
+ See the [Setup Guide](./docs/guides/setup.md) and [Authentication Guide](./docs/guides/authentication.md) for detailed instructions.
123
+
124
+ ## Why Choose This SDK?
125
+
126
+ ### 🚀 Production-Ready & Battle-Tested
127
+ - **75%+ test coverage** with 86 comprehensive tests - ensuring reliability in production
128
+ - **Zero compromises** - Every Shopee API endpoint is implemented and documented
129
+ - **Type-safe** - Full TypeScript definitions prevent errors before they happen
130
+ - **Actively maintained** - Regular updates to stay in sync with Shopee API changes
131
+
132
+ ### 💪 Complete API Coverage - All 27 Managers Implemented
133
+ Unlike other SDKs with partial coverage, we provide **complete access** to every Shopee API:
134
+
135
+ **Core Commerce:**
136
+ - 📦 **ProductManager** - Full product catalog management with 55+ endpoints
137
+ - 🛒 **OrderManager** - Complete order processing and fulfillment workflow
138
+ - 🚚 **LogisticsManager** - Comprehensive shipping and tracking operations
139
+ - 💳 **PaymentManager** - Payment and escrow information management
140
+
141
+ **Marketing & Promotions:**
142
+ - 🎟️ **VoucherManager** - Discount voucher campaigns
143
+ - 💥 **DiscountManager** - Discount promotion campaigns
144
+ - 🎁 **BundleDealManager** - Bundle deal promotions
145
+ - ➕ **AddOnDealManager** - Add-on deal promotions
146
+ - ⚡ **ShopFlashSaleManager** - Flash sale campaigns
147
+ - 🎯 **FollowPrizeManager** - Follow prize activities
148
+ - ⭐ **TopPicksManager** - Top picks product collections
149
+
150
+ **Store Management:**
151
+ - 🏪 **ShopManager** - Shop information and profile management
152
+ - 🏢 **MerchantManager** - Merchant information, warehouses, and multi-shop management
153
+ - 📂 **ShopCategoryManager** - Shop category organization
154
+ - 🖼️ **MediaManager** & **MediaSpaceManager** - Image and video upload operations
155
+
156
+ **Advanced Features:**
157
+ - 🔐 **AuthManager** - OAuth flow and token lifecycle management
158
+ - 📢 **PushManager** - Webhooks and real-time notifications
159
+ - 🌍 **GlobalProductManager** - Cross-border product management
160
+ - 🔄 **ReturnsManager** - Return and refund request handling
161
+ - 📊 **AdsManager** - Advertising campaign management
162
+ - 📈 **AccountHealthManager** - Performance metrics and analytics
163
+ - 🌐 **PublicManager** - Public API endpoints (no auth required)
164
+ - 📍 **FirstMileManager** - First mile logistics operations
165
+ - 🏭 **SbsManager** - Shopee Business Services warehouse inventory
166
+ - 📦 **FbsManager** - Fulfillment by Shopee operations
167
+ - 📹 **LivestreamManager** - Live streaming features
168
+
169
+ ### ✨ Developer Experience First
170
+ - **Intuitive API design** - Clean, consistent interfaces across all managers
171
+ - **Automatic token refresh** - Built-in token management, never worry about expiration
172
+ - **Flexible storage** - File-based storage included, easy to implement custom solutions
173
+ - **Multi-region support** - Works seamlessly across all 12 Shopee regions
174
+ - **Proxy support** - Enterprise-ready HTTP/HTTPS proxy configuration
175
+ - **Comprehensive docs** - Detailed guides and real-world examples for every feature
176
+ - **Full type safety** - Complete TypeScript definitions for autocomplete and error prevention
177
+
178
+ ## Real-World Use Cases
179
+
180
+ This SDK is perfect for building:
181
+
182
+ - 🏪 **Multi-channel E-commerce Platforms** - Sync inventory, orders, and products across multiple sales channels
183
+ - 📊 **Analytics Dashboards** - Track sales performance, customer behavior, and business metrics
184
+ - 🤖 **Automation Tools** - Automate order processing, inventory updates, and customer communications
185
+ - 🔄 **ERP Integrations** - Connect Shopee with your existing business systems
186
+ - 📱 **Mobile Apps** - Build native mobile experiences for shop management
187
+ - 🎯 **Marketing Automation** - Manage promotions, vouchers, and advertising campaigns programmatically
188
+ - 📦 **Inventory Management Systems** - Real-time stock tracking across warehouses
189
+ - 🚀 **Custom Storefronts** - Create unique shopping experiences powered by Shopee's infrastructure
190
+
191
+ ## Migrating from Other SDKs?
192
+
193
+ Switching is easy! Our SDK offers:
194
+ - **More complete coverage** - Every endpoint is implemented, not just the basics
195
+ - **Better TypeScript support** - Full type safety from end to end
196
+ - **Simpler API** - Intuitive, well-organized manager classes
197
+ - **Active maintenance** - Regular updates and community support
198
+ - **Production-ready** - Battle-tested with comprehensive test coverage
199
+
200
+ Check our [Migration Guide](./docs/guides/setup.md) to get started.
65
201
 
66
202
  ## Contributing
67
203
 
package/lib/fetch.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import fetch, { Headers } from "node-fetch";
2
2
  import { ShopeeApiError, ShopeeSdkError } from "./errors.js";
3
3
  import { generateSignature } from "./utils/signature.js";
4
+ import { SDK_VERSION } from "./version.js";
4
5
  export class ShopeeFetch {
5
6
  static async fetch(config, path, options = {}) {
6
7
  const { method = "GET", params = {}, body } = options;
@@ -53,6 +54,7 @@ export class ShopeeFetch {
53
54
  // Prepare headers
54
55
  const headers = new Headers();
55
56
  headers.set("Content-Type", "application/json");
57
+ headers.set("User-Agent", `congminh1254/shopee-sdk/v${SDK_VERSION}`);
56
58
  if (options.headers) {
57
59
  Object.entries(options.headers).forEach(([key, value]) => {
58
60
  headers.set(key, value);
@@ -95,6 +97,10 @@ export class ShopeeFetch {
95
97
  }
96
98
  catch (error) {
97
99
  if (error instanceof Error) {
100
+ // Re-throw our custom errors as-is
101
+ if (error instanceof ShopeeApiError || error instanceof ShopeeSdkError) {
102
+ throw error;
103
+ }
98
104
  if (error.name === "FetchError") {
99
105
  // Network error
100
106
  throw new ShopeeSdkError(`Network error: ${error.message}`);
package/lib/fetch.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAyB,OAAO,EAAe,MAAM,YAAY,CAAC;AAGhF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,OAAO,WAAW;IACf,MAAM,CAAC,KAAK,CAAC,KAAK,CACvB,MAAoB,EACpB,IAAY,EACZ,UAAwB,EAAE;QAE1B,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACtD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,GAAG,IAAI,EAAE,CAAC,CAAC;QACjD,0BAA0B;QAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QAChD,IAAI,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,EAAE;YACpD,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE;YAC5B,GAAG,CAAC,QAAQ;YACZ,SAAS,CAAC,QAAQ,EAAE;SACrB,CAAC,CAAC;QAEH,uBAAuB;QACvB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SA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,OAAO,EAAE,CAAC,CAAC;YACjE,CAAC;YACD,MAAM,IAAI,cAAc,CAAC,wBAAwB,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,140 @@
1
+ import { ShopeeConfig } from "../sdk.js";
2
+ import { BaseManager } from "./base.manager.js";
3
+ import { AddAddOnDealParams, AddAddOnDealResponse, AddAddOnDealMainItemParams, AddAddOnDealMainItemResponse, AddAddOnDealSubItemParams, AddAddOnDealSubItemResponse, DeleteAddOnDealParams, DeleteAddOnDealResponse, DeleteAddOnDealMainItemParams, DeleteAddOnDealMainItemResponse, DeleteAddOnDealSubItemParams, DeleteAddOnDealSubItemResponse, EndAddOnDealParams, EndAddOnDealResponse, GetAddOnDealParams, GetAddOnDealResponse, GetAddOnDealListParams, GetAddOnDealListResponse, GetAddOnDealMainItemParams, GetAddOnDealMainItemResponse, GetAddOnDealSubItemParams, GetAddOnDealSubItemResponse, UpdateAddOnDealParams, UpdateAddOnDealResponse, UpdateAddOnDealMainItemParams, UpdateAddOnDealMainItemResponse, UpdateAddOnDealSubItemParams, UpdateAddOnDealSubItemResponse } from "../schemas/add-on-deal.js";
4
+ export declare class AddOnDealManager extends BaseManager {
5
+ constructor(config: ShopeeConfig);
6
+ /**
7
+ * Create a new add-on deal activity
8
+ * @param {AddAddOnDealParams} params - Parameters for creating a new add-on deal
9
+ * @returns {Promise<AddAddOnDealResponse>} The response containing the created add-on deal ID
10
+ *
11
+ * Note: A maximum of 1000 add-on deals can be created.
12
+ * The start time must be 1 hour later than current time.
13
+ * The end time must be 1 hour later than start time.
14
+ */
15
+ addAddOnDeal(params: AddAddOnDealParams): Promise<AddAddOnDealResponse>;
16
+ /**
17
+ * Add main items to an existing add-on deal activity
18
+ * @param {AddAddOnDealMainItemParams} params - Parameters for adding main items to an add-on deal
19
+ * @returns {Promise<AddAddOnDealMainItemResponse>} The response containing the list of added main items
20
+ *
21
+ * Main items are the products that customers must purchase to be eligible for the add-on deal.
22
+ */
23
+ addAddOnDealMainItem(params: AddAddOnDealMainItemParams): Promise<AddAddOnDealMainItemResponse>;
24
+ /**
25
+ * Add sub items (discounted or gift items) to an existing add-on deal activity
26
+ * @param {AddAddOnDealSubItemParams} params - Parameters for adding sub items to an add-on deal
27
+ * @returns {Promise<AddAddOnDealSubItemResponse>} The response containing any failed sub items
28
+ *
29
+ * Sub items are the products offered at a discount or as gifts when customers purchase main items.
30
+ * The response includes a list of items that failed to be added with error details.
31
+ */
32
+ addAddOnDealSubItem(params: AddAddOnDealSubItemParams): Promise<AddAddOnDealSubItemResponse>;
33
+ /**
34
+ * Delete an existing add-on deal activity
35
+ * @param {DeleteAddOnDealParams} params - Parameters for deleting an add-on deal
36
+ * @returns {Promise<DeleteAddOnDealResponse>} The response containing the deleted add-on deal ID
37
+ *
38
+ * Note: Can only delete upcoming add-on deals that haven't started yet.
39
+ * Will return an error if attempting to delete an add-on deal that has already started.
40
+ */
41
+ deleteAddOnDeal(params: DeleteAddOnDealParams): Promise<DeleteAddOnDealResponse>;
42
+ /**
43
+ * Delete main items from an existing add-on deal activity
44
+ * @param {DeleteAddOnDealMainItemParams} params - Parameters for deleting main items from an add-on deal
45
+ * @returns {Promise<DeleteAddOnDealMainItemResponse>} The response containing any failed item deletions
46
+ *
47
+ * The response includes:
48
+ * - add_on_deal_id: The ID of the add-on deal
49
+ * - failed_item_id_list: List of item IDs that failed to be deleted
50
+ */
51
+ deleteAddOnDealMainItem(params: DeleteAddOnDealMainItemParams): Promise<DeleteAddOnDealMainItemResponse>;
52
+ /**
53
+ * Delete sub items from an existing add-on deal activity
54
+ * @param {DeleteAddOnDealSubItemParams} params - Parameters for deleting sub items from an add-on deal
55
+ * @returns {Promise<DeleteAddOnDealSubItemResponse>} The response containing any failed sub item deletions
56
+ *
57
+ * The response includes a list of sub items that failed to be deleted with error details.
58
+ * Note: At least one sub item should remain in the add-on deal.
59
+ */
60
+ deleteAddOnDealSubItem(params: DeleteAddOnDealSubItemParams): Promise<DeleteAddOnDealSubItemResponse>;
61
+ /**
62
+ * End an ongoing add-on deal activity immediately
63
+ * @param {EndAddOnDealParams} params - Parameters for ending an add-on deal
64
+ * @returns {Promise<EndAddOnDealResponse>} The response containing the ended add-on deal ID
65
+ *
66
+ * Note: Can only end add-on deals that are currently ongoing/active.
67
+ * Will return an error if attempting to end an upcoming or expired add-on deal.
68
+ */
69
+ endAddOnDeal(params: EndAddOnDealParams): Promise<EndAddOnDealResponse>;
70
+ /**
71
+ * Get detailed information about an add-on deal activity
72
+ * @param {GetAddOnDealParams} params - Parameters for getting add-on deal details
73
+ * @returns {Promise<GetAddOnDealResponse>} The response containing comprehensive add-on deal information
74
+ *
75
+ * The response includes:
76
+ * - Basic add-on deal details (ID, name, start/end time, etc.)
77
+ * - Promotion type and configuration
78
+ * - Purchase limits and requirements
79
+ * - Sub item display priority
80
+ * - Source information
81
+ */
82
+ getAddOnDeal(params: GetAddOnDealParams): Promise<GetAddOnDealResponse>;
83
+ /**
84
+ * Get a list of add-on deal activities with pagination
85
+ * @param {GetAddOnDealListParams} params - Parameters for retrieving add-on deal list
86
+ * @param {AddOnDealPromotionStatus} params.promotion_status - Filter by promotion status (all, ongoing, upcoming, expired)
87
+ * @param {number} [params.page_no] - Page number to retrieve (default: 1, max: 1000)
88
+ * @param {number} [params.page_size] - Number of items per page (default: 100, max: 100)
89
+ * @returns {Promise<GetAddOnDealListResponse>} The response containing a paginated list of add-on deals
90
+ *
91
+ * The response includes:
92
+ * - add_on_deal_list: List of add-on deals with full details
93
+ * - more: Boolean indicating if there are more pages
94
+ */
95
+ getAddOnDealList(params: GetAddOnDealListParams): Promise<GetAddOnDealListResponse>;
96
+ /**
97
+ * Get main items in an add-on deal activity
98
+ * @param {GetAddOnDealMainItemParams} params - Parameters for getting main items
99
+ * @returns {Promise<GetAddOnDealMainItemResponse>} The response containing the list of main items
100
+ *
101
+ * Main items are the products that customers must purchase to be eligible for the add-on deal.
102
+ */
103
+ getAddOnDealMainItem(params: GetAddOnDealMainItemParams): Promise<GetAddOnDealMainItemResponse>;
104
+ /**
105
+ * Get sub items (discounted or gift items) in an add-on deal activity
106
+ * @param {GetAddOnDealSubItemParams} params - Parameters for getting sub items
107
+ * @returns {Promise<GetAddOnDealSubItemResponse>} The response containing the list of sub items
108
+ *
109
+ * Sub items are the products offered at a discount or as gifts when customers purchase main items.
110
+ */
111
+ getAddOnDealSubItem(params: GetAddOnDealSubItemParams): Promise<GetAddOnDealSubItemResponse>;
112
+ /**
113
+ * Update an existing add-on deal activity
114
+ * @param {UpdateAddOnDealParams} params - Parameters for updating an add-on deal
115
+ * @returns {Promise<UpdateAddOnDealResponse>} The response containing the updated add-on deal information
116
+ *
117
+ * Note: For ongoing add-on deals, update capabilities may be limited.
118
+ * Only certain fields can be modified depending on the add-on deal status.
119
+ * The start time of upcoming add-on deals cannot be shortened.
120
+ * Promotion end time can only be changed to an earlier timing.
121
+ */
122
+ updateAddOnDeal(params: UpdateAddOnDealParams): Promise<UpdateAddOnDealResponse>;
123
+ /**
124
+ * Update main items in an existing add-on deal activity
125
+ * @param {UpdateAddOnDealMainItemParams} params - Parameters for updating main items
126
+ * @returns {Promise<UpdateAddOnDealMainItemResponse>} The response containing the updated main items
127
+ *
128
+ * Main items are the products that customers must purchase to be eligible for the add-on deal.
129
+ */
130
+ updateAddOnDealMainItem(params: UpdateAddOnDealMainItemParams): Promise<UpdateAddOnDealMainItemResponse>;
131
+ /**
132
+ * Update sub items in an existing add-on deal activity
133
+ * @param {UpdateAddOnDealSubItemParams} params - Parameters for updating sub items
134
+ * @returns {Promise<UpdateAddOnDealSubItemResponse>} The response containing any failed sub item updates
135
+ *
136
+ * Sub items are the products offered at a discount or as gifts when customers purchase main items.
137
+ * The response includes a list of sub items that failed to be updated with error details.
138
+ */
139
+ updateAddOnDealSubItem(params: UpdateAddOnDealSubItemParams): Promise<UpdateAddOnDealSubItemResponse>;
140
+ }
@@ -0,0 +1,240 @@
1
+ import { BaseManager } from "./base.manager.js";
2
+ import { ShopeeFetch } from "../fetch.js";
3
+ export class AddOnDealManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ /**
8
+ * Create a new add-on deal activity
9
+ * @param {AddAddOnDealParams} params - Parameters for creating a new add-on deal
10
+ * @returns {Promise<AddAddOnDealResponse>} The response containing the created add-on deal ID
11
+ *
12
+ * Note: A maximum of 1000 add-on deals can be created.
13
+ * The start time must be 1 hour later than current time.
14
+ * The end time must be 1 hour later than start time.
15
+ */
16
+ async addAddOnDeal(params) {
17
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/add_add_on_deal", {
18
+ method: "POST",
19
+ auth: true,
20
+ body: params,
21
+ });
22
+ return response;
23
+ }
24
+ /**
25
+ * Add main items to an existing add-on deal activity
26
+ * @param {AddAddOnDealMainItemParams} params - Parameters for adding main items to an add-on deal
27
+ * @returns {Promise<AddAddOnDealMainItemResponse>} The response containing the list of added main items
28
+ *
29
+ * Main items are the products that customers must purchase to be eligible for the add-on deal.
30
+ */
31
+ async addAddOnDealMainItem(params) {
32
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/add_add_on_deal_main_item", {
33
+ method: "POST",
34
+ auth: true,
35
+ body: params,
36
+ });
37
+ return response;
38
+ }
39
+ /**
40
+ * Add sub items (discounted or gift items) to an existing add-on deal activity
41
+ * @param {AddAddOnDealSubItemParams} params - Parameters for adding sub items to an add-on deal
42
+ * @returns {Promise<AddAddOnDealSubItemResponse>} The response containing any failed sub items
43
+ *
44
+ * Sub items are the products offered at a discount or as gifts when customers purchase main items.
45
+ * The response includes a list of items that failed to be added with error details.
46
+ */
47
+ async addAddOnDealSubItem(params) {
48
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/add_add_on_deal_sub_item", {
49
+ method: "POST",
50
+ auth: true,
51
+ body: params,
52
+ });
53
+ return response;
54
+ }
55
+ /**
56
+ * Delete an existing add-on deal activity
57
+ * @param {DeleteAddOnDealParams} params - Parameters for deleting an add-on deal
58
+ * @returns {Promise<DeleteAddOnDealResponse>} The response containing the deleted add-on deal ID
59
+ *
60
+ * Note: Can only delete upcoming add-on deals that haven't started yet.
61
+ * Will return an error if attempting to delete an add-on deal that has already started.
62
+ */
63
+ async deleteAddOnDeal(params) {
64
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/delete_add_on_deal", {
65
+ method: "POST",
66
+ auth: true,
67
+ body: params,
68
+ });
69
+ return response;
70
+ }
71
+ /**
72
+ * Delete main items from an existing add-on deal activity
73
+ * @param {DeleteAddOnDealMainItemParams} params - Parameters for deleting main items from an add-on deal
74
+ * @returns {Promise<DeleteAddOnDealMainItemResponse>} The response containing any failed item deletions
75
+ *
76
+ * The response includes:
77
+ * - add_on_deal_id: The ID of the add-on deal
78
+ * - failed_item_id_list: List of item IDs that failed to be deleted
79
+ */
80
+ async deleteAddOnDealMainItem(params) {
81
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/delete_add_on_deal_main_item", {
82
+ method: "POST",
83
+ auth: true,
84
+ body: params,
85
+ });
86
+ return response;
87
+ }
88
+ /**
89
+ * Delete sub items from an existing add-on deal activity
90
+ * @param {DeleteAddOnDealSubItemParams} params - Parameters for deleting sub items from an add-on deal
91
+ * @returns {Promise<DeleteAddOnDealSubItemResponse>} The response containing any failed sub item deletions
92
+ *
93
+ * The response includes a list of sub items that failed to be deleted with error details.
94
+ * Note: At least one sub item should remain in the add-on deal.
95
+ */
96
+ async deleteAddOnDealSubItem(params) {
97
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/delete_add_on_deal_sub_item", {
98
+ method: "POST",
99
+ auth: true,
100
+ body: params,
101
+ });
102
+ return response;
103
+ }
104
+ /**
105
+ * End an ongoing add-on deal activity immediately
106
+ * @param {EndAddOnDealParams} params - Parameters for ending an add-on deal
107
+ * @returns {Promise<EndAddOnDealResponse>} The response containing the ended add-on deal ID
108
+ *
109
+ * Note: Can only end add-on deals that are currently ongoing/active.
110
+ * Will return an error if attempting to end an upcoming or expired add-on deal.
111
+ */
112
+ async endAddOnDeal(params) {
113
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/end_add_on_deal", {
114
+ method: "POST",
115
+ auth: true,
116
+ body: params,
117
+ });
118
+ return response;
119
+ }
120
+ /**
121
+ * Get detailed information about an add-on deal activity
122
+ * @param {GetAddOnDealParams} params - Parameters for getting add-on deal details
123
+ * @returns {Promise<GetAddOnDealResponse>} The response containing comprehensive add-on deal information
124
+ *
125
+ * The response includes:
126
+ * - Basic add-on deal details (ID, name, start/end time, etc.)
127
+ * - Promotion type and configuration
128
+ * - Purchase limits and requirements
129
+ * - Sub item display priority
130
+ * - Source information
131
+ */
132
+ async getAddOnDeal(params) {
133
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/get_add_on_deal", {
134
+ method: "GET",
135
+ auth: true,
136
+ params,
137
+ });
138
+ return response;
139
+ }
140
+ /**
141
+ * Get a list of add-on deal activities with pagination
142
+ * @param {GetAddOnDealListParams} params - Parameters for retrieving add-on deal list
143
+ * @param {AddOnDealPromotionStatus} params.promotion_status - Filter by promotion status (all, ongoing, upcoming, expired)
144
+ * @param {number} [params.page_no] - Page number to retrieve (default: 1, max: 1000)
145
+ * @param {number} [params.page_size] - Number of items per page (default: 100, max: 100)
146
+ * @returns {Promise<GetAddOnDealListResponse>} The response containing a paginated list of add-on deals
147
+ *
148
+ * The response includes:
149
+ * - add_on_deal_list: List of add-on deals with full details
150
+ * - more: Boolean indicating if there are more pages
151
+ */
152
+ async getAddOnDealList(params) {
153
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/get_add_on_deal_list", {
154
+ method: "GET",
155
+ auth: true,
156
+ params,
157
+ });
158
+ return response;
159
+ }
160
+ /**
161
+ * Get main items in an add-on deal activity
162
+ * @param {GetAddOnDealMainItemParams} params - Parameters for getting main items
163
+ * @returns {Promise<GetAddOnDealMainItemResponse>} The response containing the list of main items
164
+ *
165
+ * Main items are the products that customers must purchase to be eligible for the add-on deal.
166
+ */
167
+ async getAddOnDealMainItem(params) {
168
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/get_add_on_deal_main_item", {
169
+ method: "GET",
170
+ auth: true,
171
+ params,
172
+ });
173
+ return response;
174
+ }
175
+ /**
176
+ * Get sub items (discounted or gift items) in an add-on deal activity
177
+ * @param {GetAddOnDealSubItemParams} params - Parameters for getting sub items
178
+ * @returns {Promise<GetAddOnDealSubItemResponse>} The response containing the list of sub items
179
+ *
180
+ * Sub items are the products offered at a discount or as gifts when customers purchase main items.
181
+ */
182
+ async getAddOnDealSubItem(params) {
183
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/get_add_on_deal_sub_item", {
184
+ method: "GET",
185
+ auth: true,
186
+ params,
187
+ });
188
+ return response;
189
+ }
190
+ /**
191
+ * Update an existing add-on deal activity
192
+ * @param {UpdateAddOnDealParams} params - Parameters for updating an add-on deal
193
+ * @returns {Promise<UpdateAddOnDealResponse>} The response containing the updated add-on deal information
194
+ *
195
+ * Note: For ongoing add-on deals, update capabilities may be limited.
196
+ * Only certain fields can be modified depending on the add-on deal status.
197
+ * The start time of upcoming add-on deals cannot be shortened.
198
+ * Promotion end time can only be changed to an earlier timing.
199
+ */
200
+ async updateAddOnDeal(params) {
201
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/update_add_on_deal", {
202
+ method: "POST",
203
+ auth: true,
204
+ body: params,
205
+ });
206
+ return response;
207
+ }
208
+ /**
209
+ * Update main items in an existing add-on deal activity
210
+ * @param {UpdateAddOnDealMainItemParams} params - Parameters for updating main items
211
+ * @returns {Promise<UpdateAddOnDealMainItemResponse>} The response containing the updated main items
212
+ *
213
+ * Main items are the products that customers must purchase to be eligible for the add-on deal.
214
+ */
215
+ async updateAddOnDealMainItem(params) {
216
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/update_add_on_deal_main_item", {
217
+ method: "POST",
218
+ auth: true,
219
+ body: params,
220
+ });
221
+ return response;
222
+ }
223
+ /**
224
+ * Update sub items in an existing add-on deal activity
225
+ * @param {UpdateAddOnDealSubItemParams} params - Parameters for updating sub items
226
+ * @returns {Promise<UpdateAddOnDealSubItemResponse>} The response containing any failed sub item updates
227
+ *
228
+ * Sub items are the products offered at a discount or as gifts when customers purchase main items.
229
+ * The response includes a list of sub items that failed to be updated with error details.
230
+ */
231
+ async updateAddOnDealSubItem(params) {
232
+ const response = await ShopeeFetch.fetch(this.config, "/add_on_deal/update_add_on_deal_sub_item", {
233
+ method: "POST",
234
+ auth: true,
235
+ body: params,
236
+ });
237
+ return response;
238
+ }
239
+ }
240
+ //# sourceMappingURL=add-on-deal.manager.js.map