@mitumba/sdk 1.32.1 → 1.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +73 -1
- package/dist/index.d.ts +73 -1
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2313,6 +2313,33 @@ var WholesaleModule = class {
|
|
|
2313
2313
|
async myBales(options) {
|
|
2314
2314
|
return this.client.get("/listings/wholesale/mine/bales", void 0, options);
|
|
2315
2315
|
}
|
|
2316
|
+
// ── Bale Images ──
|
|
2317
|
+
/**
|
|
2318
|
+
* Presign a bale image upload slot (requires the owning wholesale store).
|
|
2319
|
+
*
|
|
2320
|
+
* @param baleId - The bale to attach the image to
|
|
2321
|
+
* @param index - The slot index; slot 0 is the cover
|
|
2322
|
+
* @returns The storage key and image id for the slot
|
|
2323
|
+
* @throws {APIError} On network or server errors
|
|
2324
|
+
*/
|
|
2325
|
+
async presignBaleImage(baleId, index, options) {
|
|
2326
|
+
return this.client.post(`/listings/bales/${baleId}/images/presign`, { index }, options);
|
|
2327
|
+
}
|
|
2328
|
+
/**
|
|
2329
|
+
* Upload a bale image file directly. Uses multipart/form-data. Slot 0 is the cover.
|
|
2330
|
+
*
|
|
2331
|
+
* @param baleId - The bale to attach the image to
|
|
2332
|
+
* @param file - The image file as a `Blob` (React Native passes a `{ uri, name, type }` part)
|
|
2333
|
+
* @param index - The slot index; slot 0 is the cover
|
|
2334
|
+
* @returns The storage key, image id, and public URL
|
|
2335
|
+
* @throws {APIError} On network or server errors
|
|
2336
|
+
*/
|
|
2337
|
+
async uploadBaleImage(baleId, file, index, options) {
|
|
2338
|
+
const formData = new FormData();
|
|
2339
|
+
formData.append("file", file);
|
|
2340
|
+
formData.append("index", String(index));
|
|
2341
|
+
return this.client.post(`/listings/bales/${baleId}/images/upload`, formData, options);
|
|
2342
|
+
}
|
|
2316
2343
|
// ── Feed ──
|
|
2317
2344
|
/** Browse the wholesale bale feed (public). */
|
|
2318
2345
|
async wholesaleFeed(params, options) {
|
|
@@ -2343,6 +2370,25 @@ var WholesaleModule = class {
|
|
|
2343
2370
|
async transitionBaleOrder(id, action, options) {
|
|
2344
2371
|
return this.client.post(`/listings/bale-orders/${id}/transition`, { action }, options);
|
|
2345
2372
|
}
|
|
2373
|
+
// ── Analytics ──
|
|
2374
|
+
/**
|
|
2375
|
+
* Get performance analytics for the current user's wholesale store (bale_seller only).
|
|
2376
|
+
*
|
|
2377
|
+
* The wholesale store is resolved server-side from the session, so no store id is passed — the
|
|
2378
|
+
* same way `getWholesaleStore`, `myBales`, and `incomingBaleOrders` work.
|
|
2379
|
+
*
|
|
2380
|
+
* @param period - Optional granularity; defaults to the server's default window
|
|
2381
|
+
* @returns Revenue series, order breakdown, top bales, and totals
|
|
2382
|
+
* @throws {APIError} On network or server errors
|
|
2383
|
+
*
|
|
2384
|
+
* @example
|
|
2385
|
+
* ```typescript
|
|
2386
|
+
* const analytics = await sdk.wholesale.getAnalytics('weekly')
|
|
2387
|
+
* ```
|
|
2388
|
+
*/
|
|
2389
|
+
async getAnalytics(period, options) {
|
|
2390
|
+
return this.client.get("/listings/wholesale/analytics", period ? { period } : void 0, options);
|
|
2391
|
+
}
|
|
2346
2392
|
};
|
|
2347
2393
|
|
|
2348
2394
|
// src/types/auth.ts
|