feeef 0.8.3 → 0.8.4
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/build/index.js +125 -51
- package/build/index.js.map +1 -1
- package/build/src/feeef/feeef.d.ts +5 -0
- package/build/src/feeef/repositories/apps.d.ts +24 -1
- package/build/src/feeef/repositories/promos.d.ts +77 -0
- package/build/src/feeef/repositories/store_invites_repository.d.ts +48 -0
- package/build/src/feeef/repositories/stores.d.ts +8 -38
- package/build/src/index.d.ts +3 -0
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -318,6 +318,65 @@ var ProductRepository = class extends ModelRepository {
|
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
320
|
|
|
321
|
+
// src/feeef/repositories/store_invites_repository.ts
|
|
322
|
+
var StoreInvitesRepository = class {
|
|
323
|
+
constructor(client, resource) {
|
|
324
|
+
this.client = client;
|
|
325
|
+
this.resource = resource;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Lists invites for a store.
|
|
329
|
+
* @param storeId - The store ID.
|
|
330
|
+
* @param params - Optional filters (e.g. status).
|
|
331
|
+
* @returns A Promise that resolves to the list of invites.
|
|
332
|
+
*/
|
|
333
|
+
async list(storeId, params) {
|
|
334
|
+
const res = await this.client.get(`/${this.resource}/${storeId}/invites`, { params });
|
|
335
|
+
return res.data;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Creates a store invite (sends email to invitee).
|
|
339
|
+
* @param storeId - The store ID.
|
|
340
|
+
* @param data - The invite data.
|
|
341
|
+
* @returns A Promise that resolves to the created invite.
|
|
342
|
+
*/
|
|
343
|
+
async create(storeId, data) {
|
|
344
|
+
const res = await this.client.post(`/${this.resource}/${storeId}/invites`, data);
|
|
345
|
+
return res.data;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Gets invite details (public or full if authorized).
|
|
349
|
+
* @param storeId - The store ID.
|
|
350
|
+
* @param inviteId - The invite ID.
|
|
351
|
+
* @returns A Promise that resolves to the invite.
|
|
352
|
+
*/
|
|
353
|
+
async get(storeId, inviteId) {
|
|
354
|
+
const res = await this.client.get(`/${this.resource}/${storeId}/invites/${inviteId}`);
|
|
355
|
+
return res.data;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Revokes a pending invite.
|
|
359
|
+
* @param storeId - The store ID.
|
|
360
|
+
* @param inviteId - The invite ID.
|
|
361
|
+
*/
|
|
362
|
+
async revoke(storeId, inviteId) {
|
|
363
|
+
await this.client.delete(`/${this.resource}/${storeId}/invites/${inviteId}`);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Accepts an invite (authenticated user's email must match invite email).
|
|
367
|
+
* @param storeId - The store ID.
|
|
368
|
+
* @param inviteId - The invite ID.
|
|
369
|
+
* @param token - The invite token from the email link.
|
|
370
|
+
* @returns A Promise that resolves to the created store member.
|
|
371
|
+
*/
|
|
372
|
+
async accept(storeId, inviteId, token) {
|
|
373
|
+
const res = await this.client.post(`/${this.resource}/${storeId}/invites/${inviteId}/accept`, {
|
|
374
|
+
token
|
|
375
|
+
});
|
|
376
|
+
return res.data;
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
|
|
321
380
|
// src/feeef/repositories/stores.ts
|
|
322
381
|
var StoreRepository = class extends ModelRepository {
|
|
323
382
|
/**
|
|
@@ -410,67 +469,24 @@ var StoreRepository = class extends ModelRepository {
|
|
|
410
469
|
await this.client.delete(`/${this.resource}/${storeId}/members/${memberId}`);
|
|
411
470
|
}
|
|
412
471
|
/**
|
|
413
|
-
*
|
|
414
|
-
* @param storeId - The store ID.
|
|
415
|
-
* @param data - The invite data.
|
|
416
|
-
* @returns A Promise that resolves to the created invite.
|
|
472
|
+
* Repository for store invites. Use e.g. `ff.stores.invites.list(storeId)`, `ff.stores.invites.create(storeId, data)`.
|
|
417
473
|
*/
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
return res.data;
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Lists invites for a store.
|
|
424
|
-
* @param storeId - The store ID.
|
|
425
|
-
* @param params - Optional filters (e.g. status).
|
|
426
|
-
* @returns A Promise that resolves to the list of invites.
|
|
427
|
-
*/
|
|
428
|
-
async listInvites(storeId, params) {
|
|
429
|
-
const res = await this.client.get(`/${this.resource}/${storeId}/invites`, { params });
|
|
430
|
-
return res.data;
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Revokes a pending invite.
|
|
434
|
-
* @param storeId - The store ID.
|
|
435
|
-
* @param inviteId - The invite ID.
|
|
436
|
-
*/
|
|
437
|
-
async revokeInvite(storeId, inviteId) {
|
|
438
|
-
await this.client.delete(`/${this.resource}/${storeId}/invites/${inviteId}`);
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Gets invite details (public or full if authorized).
|
|
442
|
-
* @param storeId - The store ID.
|
|
443
|
-
* @param inviteId - The invite ID.
|
|
444
|
-
* @returns A Promise that resolves to the invite.
|
|
445
|
-
*/
|
|
446
|
-
async getInvite(storeId, inviteId) {
|
|
447
|
-
const res = await this.client.get(`/${this.resource}/${storeId}/invites/${inviteId}`);
|
|
448
|
-
return res.data;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Accepts an invite (authenticated user's email must match invite email).
|
|
452
|
-
* @param storeId - The store ID.
|
|
453
|
-
* @param inviteId - The invite ID.
|
|
454
|
-
* @param token - The invite token from the email link.
|
|
455
|
-
* @returns A Promise that resolves to the created store member.
|
|
456
|
-
*/
|
|
457
|
-
async acceptInvite(storeId, inviteId, token) {
|
|
458
|
-
const res = await this.client.post(`/${this.resource}/${storeId}/invites/${inviteId}/accept`, {
|
|
459
|
-
token
|
|
460
|
-
});
|
|
461
|
-
return res.data;
|
|
474
|
+
get invites() {
|
|
475
|
+
return new StoreInvitesRepository(this.client, this.resource);
|
|
462
476
|
}
|
|
463
477
|
/**
|
|
464
478
|
* Upgrades or renews a store's subscription plan.
|
|
465
479
|
* @param id - The store ID.
|
|
466
480
|
* @param plan - The plan type to upgrade to.
|
|
467
481
|
* @param months - The number of months (1-12).
|
|
468
|
-
* @
|
|
482
|
+
* @param code - Optional promo code.
|
|
469
483
|
*/
|
|
470
|
-
async upgrade(id, plan, months) {
|
|
484
|
+
async upgrade(id, plan, months, options) {
|
|
471
485
|
await this.client.post(`/${this.resource}/${id}/subscription/upgrade`, {
|
|
472
486
|
plan,
|
|
473
|
-
months
|
|
487
|
+
months,
|
|
488
|
+
// eslint-disable-next-line eqeqeq
|
|
489
|
+
...options?.code != null && options.code !== "" && { code: options.code }
|
|
474
490
|
});
|
|
475
491
|
}
|
|
476
492
|
/**
|
|
@@ -796,6 +812,22 @@ var AppRepository = class extends ModelRepository {
|
|
|
796
812
|
constructor(client) {
|
|
797
813
|
super("apps", client);
|
|
798
814
|
}
|
|
815
|
+
/**
|
|
816
|
+
* Lists apps with optional pagination and filterator.
|
|
817
|
+
* @param options - Page, limit, filterator, q, and extra params forwarded to the API.
|
|
818
|
+
*/
|
|
819
|
+
async list(options) {
|
|
820
|
+
const params = { ...options?.params };
|
|
821
|
+
if (options) {
|
|
822
|
+
if (options.page !== void 0) params.page = options.page;
|
|
823
|
+
if (options.limit !== void 0) params.limit = options.limit;
|
|
824
|
+
if (options.q !== void 0) params.q = options.q;
|
|
825
|
+
if (options.filterator !== void 0) params.filterator = options.filterator;
|
|
826
|
+
if (options.userId !== void 0) params.userId = options.userId;
|
|
827
|
+
if (options.active !== void 0) params.active = options.active;
|
|
828
|
+
}
|
|
829
|
+
return super.list({ page: options?.page, limit: options?.limit, params });
|
|
830
|
+
}
|
|
799
831
|
/**
|
|
800
832
|
* Regenerates the client secret for the app. Returns the app with
|
|
801
833
|
* clientSecret set once; store it securely.
|
|
@@ -972,6 +1004,41 @@ var DepositRepository = class extends ModelRepository {
|
|
|
972
1004
|
}
|
|
973
1005
|
};
|
|
974
1006
|
|
|
1007
|
+
// src/feeef/repositories/promos.ts
|
|
1008
|
+
var PromoRepository = class {
|
|
1009
|
+
constructor(client) {
|
|
1010
|
+
this.client = client;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Lists promos with optional pagination and validNow filter.
|
|
1014
|
+
*/
|
|
1015
|
+
async list(params) {
|
|
1016
|
+
const query = {};
|
|
1017
|
+
if (params?.page != null) query.page = params.page;
|
|
1018
|
+
if (params?.limit != null) query.limit = params.limit;
|
|
1019
|
+
if (params?.validNow === true) query.validNow = "1";
|
|
1020
|
+
const res = await this.client.get("/promos", { params: query });
|
|
1021
|
+
return res.data;
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Validates a promo code. Returns validation result with discount info or reason.
|
|
1025
|
+
*/
|
|
1026
|
+
async validate(params) {
|
|
1027
|
+
const res = await this.client.post("/promos/validate", {
|
|
1028
|
+
code: params.code,
|
|
1029
|
+
storeId: params.storeId
|
|
1030
|
+
});
|
|
1031
|
+
return res.data;
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Creates a promo (admin). Returns the created promo.
|
|
1035
|
+
*/
|
|
1036
|
+
async create(data) {
|
|
1037
|
+
const res = await this.client.post("/promos", data);
|
|
1038
|
+
return res.data;
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
|
|
975
1042
|
// src/feeef/repositories/transfers.ts
|
|
976
1043
|
var TransferRepository = class extends ModelRepository {
|
|
977
1044
|
/**
|
|
@@ -3458,6 +3525,10 @@ var FeeeF = class {
|
|
|
3458
3525
|
* The repository for managing transfers.
|
|
3459
3526
|
*/
|
|
3460
3527
|
transfers;
|
|
3528
|
+
/**
|
|
3529
|
+
* The repository for managing promo codes (list, validate, create).
|
|
3530
|
+
*/
|
|
3531
|
+
promos;
|
|
3461
3532
|
/**
|
|
3462
3533
|
* The repository for managing categories.
|
|
3463
3534
|
*/
|
|
@@ -3536,6 +3607,7 @@ var FeeeF = class {
|
|
|
3536
3607
|
this.orders = new OrderRepository(this.client);
|
|
3537
3608
|
this.deposits = new DepositRepository(this.client);
|
|
3538
3609
|
this.transfers = new TransferRepository(this.client);
|
|
3610
|
+
this.promos = new PromoRepository(this.client);
|
|
3539
3611
|
this.categories = new CategoryRepository(this.client);
|
|
3540
3612
|
this.countries = new CountryRepository(this.client);
|
|
3541
3613
|
this.states = new StateRepository(this.client);
|
|
@@ -4004,6 +4076,7 @@ export {
|
|
|
4004
4076
|
ProductStatus,
|
|
4005
4077
|
ProductType,
|
|
4006
4078
|
ProductVariantView,
|
|
4079
|
+
PromoRepository,
|
|
4007
4080
|
ShippingMethodPolicy,
|
|
4008
4081
|
ShippingMethodRepository,
|
|
4009
4082
|
ShippingMethodStatus,
|
|
@@ -4014,6 +4087,7 @@ export {
|
|
|
4014
4087
|
StorageService,
|
|
4015
4088
|
StoreActionType,
|
|
4016
4089
|
StoreInviteStatus,
|
|
4090
|
+
StoreInvitesRepository,
|
|
4017
4091
|
StoreMemberRole,
|
|
4018
4092
|
StoreRepository,
|
|
4019
4093
|
StoreSubscriptionStatus,
|