feeef 0.8.1 → 0.8.3
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 +122 -2
- package/build/index.js.map +1 -1
- package/build/src/core/entities/store.d.ts +45 -0
- package/build/src/feeef/feeef.d.ts +5 -0
- package/build/src/feeef/repositories/apps.d.ts +78 -0
- package/build/src/feeef/repositories/stores.d.ts +38 -1
- package/build/src/index.d.ts +2 -0
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -409,6 +409,57 @@ var StoreRepository = class extends ModelRepository {
|
|
|
409
409
|
async removeMember(storeId, memberId) {
|
|
410
410
|
await this.client.delete(`/${this.resource}/${storeId}/members/${memberId}`);
|
|
411
411
|
}
|
|
412
|
+
/**
|
|
413
|
+
* Creates a store invite (sends email to invitee).
|
|
414
|
+
* @param storeId - The store ID.
|
|
415
|
+
* @param data - The invite data.
|
|
416
|
+
* @returns A Promise that resolves to the created invite.
|
|
417
|
+
*/
|
|
418
|
+
async createInvite(storeId, data) {
|
|
419
|
+
const res = await this.client.post(`/${this.resource}/${storeId}/invites`, data);
|
|
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;
|
|
462
|
+
}
|
|
412
463
|
/**
|
|
413
464
|
* Upgrades or renews a store's subscription plan.
|
|
414
465
|
* @param id - The store ID.
|
|
@@ -740,6 +791,52 @@ var UserRepository = class extends ModelRepository {
|
|
|
740
791
|
}
|
|
741
792
|
};
|
|
742
793
|
|
|
794
|
+
// src/feeef/repositories/apps.ts
|
|
795
|
+
var AppRepository = class extends ModelRepository {
|
|
796
|
+
constructor(client) {
|
|
797
|
+
super("apps", client);
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Regenerates the client secret for the app. Returns the app with
|
|
801
|
+
* clientSecret set once; store it securely.
|
|
802
|
+
*
|
|
803
|
+
* @param id - The app id.
|
|
804
|
+
* @returns The app including clientSecret.
|
|
805
|
+
*/
|
|
806
|
+
async regenerateSecret(id) {
|
|
807
|
+
const res = await this.client.post(`/${this.resource}/${id}/regenerate-secret`);
|
|
808
|
+
return res.data;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Builds the OAuth authorize URL to which the user should be redirected.
|
|
812
|
+
*
|
|
813
|
+
* @param params - Parameters for the authorize URL.
|
|
814
|
+
* @param params.baseUrl - API base URL (e.g. https://api.feeef.org/api/v1).
|
|
815
|
+
* @param params.clientId - The app client id.
|
|
816
|
+
* @param params.redirectUri - Redirect URI registered for the app.
|
|
817
|
+
* @param params.responseType - Must be 'code' for authorization code flow.
|
|
818
|
+
* @param params.scope - Optional list of scopes (space-separated in URL).
|
|
819
|
+
* @param params.state - Optional state for CSRF protection.
|
|
820
|
+
* @param params.codeChallenge - Optional PKCE code challenge.
|
|
821
|
+
* @param params.codeChallengeMethod - Optional 'S256' or 'plain'.
|
|
822
|
+
* @returns The full authorize URL.
|
|
823
|
+
*/
|
|
824
|
+
static buildAuthorizeUrl(params) {
|
|
825
|
+
const base = params.baseUrl.endsWith("/") ? params.baseUrl : `${params.baseUrl}/`;
|
|
826
|
+
const url = new URL("oauth/authorize", base);
|
|
827
|
+
url.searchParams.set("client_id", params.clientId);
|
|
828
|
+
url.searchParams.set("redirect_uri", params.redirectUri);
|
|
829
|
+
url.searchParams.set("response_type", params.responseType);
|
|
830
|
+
if (params.scope?.length) url.searchParams.set("scope", params.scope.join(" "));
|
|
831
|
+
if (params.state) url.searchParams.set("state", params.state);
|
|
832
|
+
if (params.codeChallenge) url.searchParams.set("code_challenge", params.codeChallenge);
|
|
833
|
+
if (params.codeChallengeMethod) {
|
|
834
|
+
url.searchParams.set("code_challenge_method", params.codeChallengeMethod);
|
|
835
|
+
}
|
|
836
|
+
return url.toString();
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
|
|
743
840
|
// src/feeef/repositories/deposits.ts
|
|
744
841
|
var DepositRepository = class extends ModelRepository {
|
|
745
842
|
/**
|
|
@@ -3345,6 +3442,10 @@ var FeeeF = class {
|
|
|
3345
3442
|
* The repository for managing users.
|
|
3346
3443
|
*/
|
|
3347
3444
|
users;
|
|
3445
|
+
/**
|
|
3446
|
+
* The repository for managing developer-registered apps (OAuth clients).
|
|
3447
|
+
*/
|
|
3448
|
+
apps;
|
|
3348
3449
|
/**
|
|
3349
3450
|
* The repository for managing orders.
|
|
3350
3451
|
*/
|
|
@@ -3431,6 +3532,7 @@ var FeeeF = class {
|
|
|
3431
3532
|
this.imagePromptTemplates = new ImagePromptTemplatesRepository(this.client);
|
|
3432
3533
|
this.imageGenerations = new ImageGenerationsRepository(this.client);
|
|
3433
3534
|
this.users = new UserRepository(this.client);
|
|
3535
|
+
this.apps = new AppRepository(this.client);
|
|
3434
3536
|
this.orders = new OrderRepository(this.client);
|
|
3435
3537
|
this.deposits = new DepositRepository(this.client);
|
|
3436
3538
|
this.transfers = new TransferRepository(this.client);
|
|
@@ -3523,7 +3625,8 @@ var generatePublicStoreIntegrationMetaPixel = (metaPixel) => {
|
|
|
3523
3625
|
})),
|
|
3524
3626
|
active: metaPixel.active,
|
|
3525
3627
|
objective: metaPixel.objective,
|
|
3526
|
-
draftObjective: metaPixel.draftObjective
|
|
3628
|
+
draftObjective: metaPixel.draftObjective,
|
|
3629
|
+
mode: metaPixel.mode
|
|
3527
3630
|
};
|
|
3528
3631
|
};
|
|
3529
3632
|
var generatePublicStoreIntegrationTiktokPixel = (tiktokPixel) => {
|
|
@@ -3534,7 +3637,8 @@ var generatePublicStoreIntegrationTiktokPixel = (tiktokPixel) => {
|
|
|
3534
3637
|
})),
|
|
3535
3638
|
active: tiktokPixel.active,
|
|
3536
3639
|
objective: tiktokPixel.objective,
|
|
3537
|
-
draftObjective: tiktokPixel.draftObjective
|
|
3640
|
+
draftObjective: tiktokPixel.draftObjective,
|
|
3641
|
+
mode: tiktokPixel.mode
|
|
3538
3642
|
};
|
|
3539
3643
|
};
|
|
3540
3644
|
var generatePublicStoreIntegrationGoogleAnalytics = (googleAnalytics) => {
|
|
@@ -3610,6 +3714,13 @@ var StoreMemberRole = /* @__PURE__ */ ((StoreMemberRole2) => {
|
|
|
3610
3714
|
StoreMemberRole2["confermer"] = "confermer";
|
|
3611
3715
|
return StoreMemberRole2;
|
|
3612
3716
|
})(StoreMemberRole || {});
|
|
3717
|
+
var StoreInviteStatus = /* @__PURE__ */ ((StoreInviteStatus2) => {
|
|
3718
|
+
StoreInviteStatus2["pending"] = "pending";
|
|
3719
|
+
StoreInviteStatus2["accepted"] = "accepted";
|
|
3720
|
+
StoreInviteStatus2["revoked"] = "revoked";
|
|
3721
|
+
StoreInviteStatus2["expired"] = "expired";
|
|
3722
|
+
return StoreInviteStatus2;
|
|
3723
|
+
})(StoreInviteStatus || {});
|
|
3613
3724
|
var StoreActionType = /* @__PURE__ */ ((StoreActionType2) => {
|
|
3614
3725
|
StoreActionType2["link"] = "link";
|
|
3615
3726
|
StoreActionType2["whatsapp"] = "whatsapp";
|
|
@@ -3617,6 +3728,12 @@ var StoreActionType = /* @__PURE__ */ ((StoreActionType2) => {
|
|
|
3617
3728
|
StoreActionType2["phone"] = "phone";
|
|
3618
3729
|
return StoreActionType2;
|
|
3619
3730
|
})(StoreActionType || {});
|
|
3731
|
+
var PixelReportMode = /* @__PURE__ */ ((PixelReportMode2) => {
|
|
3732
|
+
PixelReportMode2["server"] = "server";
|
|
3733
|
+
PixelReportMode2["client"] = "client";
|
|
3734
|
+
PixelReportMode2["both"] = "both";
|
|
3735
|
+
return PixelReportMode2;
|
|
3736
|
+
})(PixelReportMode || {});
|
|
3620
3737
|
var WebhookEvent = /* @__PURE__ */ ((WebhookEvent2) => {
|
|
3621
3738
|
WebhookEvent2["ORDER_CREATED"] = "orderCreated";
|
|
3622
3739
|
WebhookEvent2["ORDER_UPDATED"] = "orderUpdated";
|
|
@@ -3854,6 +3971,7 @@ function validatePhoneNumber(phone) {
|
|
|
3854
3971
|
export {
|
|
3855
3972
|
ATTACHMENT_TYPES,
|
|
3856
3973
|
ActionsService,
|
|
3974
|
+
AppRepository,
|
|
3857
3975
|
CartService,
|
|
3858
3976
|
CategoryRepository,
|
|
3859
3977
|
CityRepository,
|
|
@@ -3880,6 +3998,7 @@ export {
|
|
|
3880
3998
|
OrderRepository,
|
|
3881
3999
|
OrderStatus,
|
|
3882
4000
|
PaymentStatus,
|
|
4001
|
+
PixelReportMode,
|
|
3883
4002
|
ProcolisDeliveryIntegrationApi,
|
|
3884
4003
|
ProductRepository,
|
|
3885
4004
|
ProductStatus,
|
|
@@ -3894,6 +4013,7 @@ export {
|
|
|
3894
4013
|
StateRepository,
|
|
3895
4014
|
StorageService,
|
|
3896
4015
|
StoreActionType,
|
|
4016
|
+
StoreInviteStatus,
|
|
3897
4017
|
StoreMemberRole,
|
|
3898
4018
|
StoreRepository,
|
|
3899
4019
|
StoreSubscriptionStatus,
|