@mitumba/sdk 5.32.0 → 5.34.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.js CHANGED
@@ -2252,6 +2252,31 @@ var NotificationsModule = class {
2252
2252
  async markRead(ids, options) {
2253
2253
  return this.client.post("/notify/notifications/read", ids ? { ids } : {}, options);
2254
2254
  }
2255
+ /**
2256
+ * The caller's notification settings: categories with their channels, which channels can reach
2257
+ * them now, quiet hours, muted pop-ups and marketing consent.
2258
+ */
2259
+ async getPreferences(options) {
2260
+ return this.client.get("/notify/notifications/preferences", void 0, options);
2261
+ }
2262
+ /**
2263
+ * Set (or, with `enabled: null`, reset to default) 1 to 64 category × channel cells. A cell
2264
+ * applies to every event in its category. Answers the whole updated preferences.
2265
+ */
2266
+ async updatePreferences(cells, options) {
2267
+ return this.client.put("/notify/notifications/preferences", { cells }, options);
2268
+ }
2269
+ /** Change quiet hours, muted pop-up kinds, or both. Answers the whole updated preferences. */
2270
+ async updatePreferenceSettings(input, options) {
2271
+ return this.client.put("/notify/notifications/preferences/settings", input, options);
2272
+ }
2273
+ /**
2274
+ * Opt in to or out of marketing on one channel. The server records its own consent wording
2275
+ * (shown to the person as `consentWording`). Answers the whole updated preferences.
2276
+ */
2277
+ async setMarketingConsent(input, options) {
2278
+ return this.client.put("/notify/notifications/preferences/consent", { channel: input.channel, granted: input.granted }, options);
2279
+ }
2255
2280
  /** Create an inert live notification stream. Register listeners before `start()`. */
2256
2281
  stream(options) {
2257
2282
  return new ManagedNotificationStream(this.client, options);
@@ -2314,7 +2339,8 @@ var StoresModule = class {
2314
2339
  );
2315
2340
  }
2316
2341
  /**
2317
- * Get all stores owned by the authenticated user.
2342
+ * The shops the authenticated user works in, owned or joined, each with their role in it and the
2343
+ * permissions it grants. Show only the actions those permissions allow.
2318
2344
  */
2319
2345
  async getMyStores(options) {
2320
2346
  return this.client.get("/listings/stores/mine", void 0, options);
@@ -2474,6 +2500,112 @@ var StoresModule = class {
2474
2500
  destinationPath(storeId, destinationId, suffix) {
2475
2501
  return `/listings/stores/${encodeURIComponent(storeId)}/payout-destinations/${encodeURIComponent(destinationId)}${suffix}`;
2476
2502
  }
2503
+ // ── Team ──────────────────────────────────────────────────────────────────
2504
+ /**
2505
+ * The shop's members, and the roles the caller may give. `store:members.manage`.
2506
+ *
2507
+ * Errors: 403 store_forbidden; 404 not_found.
2508
+ */
2509
+ async getMembers(storeId, options) {
2510
+ return this.client.get(`${this.storePath(storeId)}/members`, void 0, options);
2511
+ }
2512
+ /**
2513
+ * Change a member's role. The owner manages every role; a manager, the roles below manager.
2514
+ * Needs a second factor used in the last 10 minutes.
2515
+ *
2516
+ * Errors: 400 invalid_input; 403 store_forbidden, step_up_required, role_not_allowed; 404 member_not_found.
2517
+ */
2518
+ async changeMemberRole(storeId, memberId, role, options) {
2519
+ return this.client.patch(`${this.storePath(storeId)}/members/${encodeURIComponent(memberId)}`, { role }, options);
2520
+ }
2521
+ /**
2522
+ * Remove a member. They lose access on their next request. Needs a recent second factor.
2523
+ *
2524
+ * Errors: 403 store_forbidden, step_up_required, role_not_allowed; 404 member_not_found.
2525
+ */
2526
+ async removeMember(storeId, memberId, options) {
2527
+ return this.client.delete(`${this.storePath(storeId)}/members/${encodeURIComponent(memberId)}`, void 0, options);
2528
+ }
2529
+ /**
2530
+ * Leave a shop's team. The owner cannot leave their own shop.
2531
+ *
2532
+ * Errors: 404 member_not_found; 409 owner_cannot_leave.
2533
+ */
2534
+ async leave(storeId, options) {
2535
+ return this.client.post(`${this.storePath(storeId)}/leave`, void 0, options);
2536
+ }
2537
+ /**
2538
+ * Invite someone by email address or Kenyan phone number. The answer is the same whether or not an
2539
+ * account uses the address. Needs a recent second factor. The invitation lasts 7 days.
2540
+ *
2541
+ * Errors: 400 invalid_input, invalid_address; 403 store_forbidden, step_up_required, role_not_allowed;
2542
+ * 404 not_found; 409 too_many_invitations.
2543
+ */
2544
+ async invite(storeId, input, options) {
2545
+ return this.client.post(`${this.storePath(storeId)}/invitations`, input, options);
2546
+ }
2547
+ /**
2548
+ * The shop's open invitations, newest first. `store:members.manage`.
2549
+ *
2550
+ * Errors: 403 store_forbidden; 404 not_found.
2551
+ */
2552
+ async getInvitations(storeId, options) {
2553
+ return this.client.get(`${this.storePath(storeId)}/invitations`, void 0, options);
2554
+ }
2555
+ /**
2556
+ * Revoke an open invitation. Needs a recent second factor.
2557
+ *
2558
+ * Errors: 403 store_forbidden, step_up_required, role_not_allowed; 404 invitation_not_found.
2559
+ */
2560
+ async revokeInvitation(storeId, invitationId, options) {
2561
+ return this.client.delete(`${this.storePath(storeId)}/invitations/${encodeURIComponent(invitationId)}`, void 0, options);
2562
+ }
2563
+ /** Invitations the caller received and can still answer, newest first. */
2564
+ async getReceivedInvitations(options) {
2565
+ return this.client.get("/listings/store-invitations", void 0, options);
2566
+ }
2567
+ /**
2568
+ * Join a shop. Needs a verified phone number; the manager role also needs a recent second factor.
2569
+ *
2570
+ * Errors: 403 step_up_required; 404 invitation_not_found, not_found; 409 phone_not_verified,
2571
+ * membership_limit, already_member.
2572
+ */
2573
+ async acceptInvitation(invitationId, options) {
2574
+ return this.client.post(`/listings/store-invitations/${encodeURIComponent(invitationId)}/accept`, void 0, options);
2575
+ }
2576
+ /**
2577
+ * Decline an invitation.
2578
+ *
2579
+ * Errors: 404 invitation_not_found.
2580
+ */
2581
+ async declineInvitation(invitationId, options) {
2582
+ return this.client.post(`/listings/store-invitations/${encodeURIComponent(invitationId)}/decline`, void 0, options);
2583
+ }
2584
+ /**
2585
+ * The shop's audit log, newest first, 50 per page. `store:audit.read`.
2586
+ *
2587
+ * Errors: 403 store_forbidden; 404 not_found.
2588
+ */
2589
+ async getAuditLog(storeId, params, options) {
2590
+ return this.client.get(`${this.storePath(storeId)}/audit`, params, options);
2591
+ }
2592
+ // ── Shop limit ────────────────────────────────────────────────────────────
2593
+ /** The caller's shop limit, how many shops they own, and their latest request for more. */
2594
+ async getStoreLimit(options) {
2595
+ return this.client.get("/listings/store-limit-request", void 0, options);
2596
+ }
2597
+ /**
2598
+ * Ask for a higher shop limit, at the limit, with a reason of at least 30 characters. One request
2599
+ * at a time.
2600
+ *
2601
+ * Errors: 400 invalid_input; 403 not_a_retail_seller; 409 not_at_limit, request_pending.
2602
+ */
2603
+ async requestStoreLimit(input, options) {
2604
+ return this.client.post("/listings/store-limit-request", input, options);
2605
+ }
2606
+ storePath(storeId) {
2607
+ return `/listings/stores/${encodeURIComponent(storeId)}`;
2608
+ }
2477
2609
  };
2478
2610
  function stepUpRequired(error) {
2479
2611
  return error instanceof APIError && error.code === "step_up_required";
@@ -2858,6 +2990,13 @@ var AdminModule = class {
2858
2990
  return this.client.post(`/admin/stores/${storeId}/unverify`, void 0, options);
2859
2991
  }
2860
2992
  // ── Verification Queue ──
2993
+ /**
2994
+ * Read a private document as an operator. Dispute evidence needs `admin:read`; identity documents
2995
+ * and wholesale verification photos need `sellers:verify`.
2996
+ */
2997
+ async getDocument(documentId, options) {
2998
+ return this.client.getFile(`/admin/documents/${encodeURIComponent(documentId)}`, void 0, options);
2999
+ }
2861
3000
  async listVerifications(params, options) {
2862
3001
  return this.client.get("/admin/verifications", params, options);
2863
3002
  }
@@ -2922,6 +3061,24 @@ var AdminModule = class {
2922
3061
  async sendRefund(refundId, options) {
2923
3062
  return this.client.post(`/admin/refunds/${encodeURIComponent(refundId)}/send`, void 0, options);
2924
3063
  }
3064
+ /**
3065
+ * Requests for a higher shop limit, 25 per page: pending oldest first, decided latest first.
3066
+ * `admin:read`.
3067
+ *
3068
+ * Errors: 400 invalid_input (unknown status).
3069
+ */
3070
+ async listShopLimitRequests(params, options) {
3071
+ return this.client.get("/admin/shop-limit-requests", params, options);
3072
+ }
3073
+ /**
3074
+ * Approve a request with a new limit (above the current one, at most 50), or reject it with a note
3075
+ * of at least 10 characters. The owner is told. `sellers:verify`.
3076
+ *
3077
+ * Errors: 400 invalid_input; 403 forbidden; 404 not_found (not pending).
3078
+ */
3079
+ async decideShopLimitRequest(requestId, input, options) {
3080
+ return this.client.post(`/admin/shop-limit-requests/${encodeURIComponent(requestId)}/decide`, input, options);
3081
+ }
2925
3082
  // ── Reports Moderation ──
2926
3083
  async listReports(params, options) {
2927
3084
  return this.client.get("/admin/reports", params, options);
@@ -3201,6 +3358,28 @@ var UploadsModule = class {
3201
3358
  }
3202
3359
  };
3203
3360
 
3361
+ // src/modules/documents.ts
3362
+ function isDocumentId(value) {
3363
+ return /^doc_[a-z0-9]{1,60}$/.test(value);
3364
+ }
3365
+ var DocumentsModule = class {
3366
+ constructor(client) {
3367
+ this.client = client;
3368
+ }
3369
+ /** Upload a private document. Returns its id; the file itself is never public. */
3370
+ async upload(input, options) {
3371
+ const formData = new FormData();
3372
+ formData.append("purpose", input.purpose);
3373
+ formData.append("subject_id", input.subjectId);
3374
+ formData.append("file", input.file);
3375
+ return this.client.post("/listings/documents", formData, options);
3376
+ }
3377
+ /** Read a private document the signed-in user may see. 404 for any other. */
3378
+ async get(documentId, options) {
3379
+ return this.client.getFile(`/listings/documents/${encodeURIComponent(documentId)}`, void 0, options);
3380
+ }
3381
+ };
3382
+
3204
3383
  // src/modules/reports.ts
3205
3384
  var ReportsModule = class {
3206
3385
  constructor(client) {
@@ -3581,6 +3760,9 @@ var DISPUTE_REASONS = ["not_received", "not_as_described", "damaged", "counterfe
3581
3760
  var DESIRED_RESOLUTIONS = ["refund", "replacement", "partial_refund"];
3582
3761
  var DISPUTE_STATUSES = ["open", "seller_responded", "under_review", "resolved_refund", "resolved_release", "resolved_partial", "withdrawn"];
3583
3762
 
3763
+ // src/types/documents.ts
3764
+ var DOCUMENT_PURPOSES = ["dispute_evidence", "identity_document", "wholesale_verification"];
3765
+
3584
3766
  // src/types/wholesale.ts
3585
3767
  var BALE_ORDER_STATUSES = ["pending_payment", "paid", "confirmed", "in_transit", "delivered", "completed", "cancelled"];
3586
3768
 
@@ -3789,6 +3971,7 @@ var MitumbaClient = class {
3789
3971
  admin;
3790
3972
  disputes;
3791
3973
  uploads;
3974
+ documents;
3792
3975
  reports;
3793
3976
  wholesale;
3794
3977
  iam;
@@ -3815,6 +3998,7 @@ var MitumbaClient = class {
3815
3998
  this.admin = new AdminModule(this.api);
3816
3999
  this.disputes = new DisputesModule(this.api);
3817
4000
  this.uploads = new UploadsModule(this.api);
4001
+ this.documents = new DocumentsModule(this.api);
3818
4002
  this.reports = new ReportsModule(this.api);
3819
4003
  this.wholesale = new WholesaleModule(this.api);
3820
4004
  this.iam = new IamModule(this.api);
@@ -3872,7 +4056,9 @@ exports.DEFAULT_SHARE_ORIGIN = DEFAULT_SHARE_ORIGIN;
3872
4056
  exports.DESIRED_RESOLUTIONS = DESIRED_RESOLUTIONS;
3873
4057
  exports.DISPUTE_REASONS = DISPUTE_REASONS;
3874
4058
  exports.DISPUTE_STATUSES = DISPUTE_STATUSES;
4059
+ exports.DOCUMENT_PURPOSES = DOCUMENT_PURPOSES;
3875
4060
  exports.DisputesModule = DisputesModule;
4061
+ exports.DocumentsModule = DocumentsModule;
3876
4062
  exports.IDBTokenStore = IDBTokenStore;
3877
4063
  exports.IamModule = IamModule;
3878
4064
  exports.LISTING_STATUSES = LISTING_STATUSES;
@@ -3916,6 +4102,7 @@ exports.formatPhone = formatPhone;
3916
4102
  exports.isCartLineBuyable = isCartLineBuyable;
3917
4103
  exports.isConditionAllowed = isConditionAllowed;
3918
4104
  exports.isConsentRequired = isConsentRequired;
4105
+ exports.isDocumentId = isDocumentId;
3919
4106
  exports.isMessagingAPIError = isMessagingAPIError;
3920
4107
  exports.isNewOnlyCategory = isNewOnlyCategory;
3921
4108
  exports.isValidPhone = isValidPhone;