@larisarozin/dodone-shared 1.0.0 → 1.0.1
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.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/Subscription.d.ts +82 -0
- package/dist/types/Subscription.js +20 -0
- package/dist/utils/ApiClient.d.ts +16 -0
- package/dist/utils/ApiClient.js +44 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -48,3 +48,4 @@ __exportStar(require("./types/AllowanceHistory"), exports);
|
|
|
48
48
|
__exportStar(require("./types/UserNotificationPreferences"), exports);
|
|
49
49
|
__exportStar(require("./types/AllowanceInterval"), exports);
|
|
50
50
|
__exportStar(require("./types/Team"), exports);
|
|
51
|
+
__exportStar(require("./types/Subscription"), exports);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare enum SubscriptionTier {
|
|
2
|
+
Free = 0,
|
|
3
|
+
Pro = 1
|
|
4
|
+
}
|
|
5
|
+
export declare enum SubscriptionAction {
|
|
6
|
+
AddTeamMember = 0,
|
|
7
|
+
AddAllowanceInterval = 1,
|
|
8
|
+
AddTaskItem = 2
|
|
9
|
+
}
|
|
10
|
+
export declare const UNLIMITED = -1;
|
|
11
|
+
export interface FeatureLimit {
|
|
12
|
+
max: number;
|
|
13
|
+
current: number;
|
|
14
|
+
canAdd: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface SubscriptionLimitsResponse {
|
|
17
|
+
subscriptionTier: SubscriptionTier;
|
|
18
|
+
teamMembersLimit: FeatureLimit;
|
|
19
|
+
taskItemsLimit: FeatureLimit;
|
|
20
|
+
allowanceIntervalsLimit: FeatureLimit;
|
|
21
|
+
bonuses: boolean;
|
|
22
|
+
gradeConfiguration: boolean;
|
|
23
|
+
multiselect: boolean;
|
|
24
|
+
privateTasks: boolean;
|
|
25
|
+
proposedTasks: boolean;
|
|
26
|
+
taskComments: boolean;
|
|
27
|
+
imageAvatars: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface ValidateSubscriptionActionRequest {
|
|
30
|
+
action: SubscriptionAction;
|
|
31
|
+
}
|
|
32
|
+
export interface ValidateSubscriptionActionResponse {
|
|
33
|
+
isAllowed: boolean;
|
|
34
|
+
reason?: string;
|
|
35
|
+
upgradeRequired: SubscriptionTier;
|
|
36
|
+
currentTier: SubscriptionTier;
|
|
37
|
+
}
|
|
38
|
+
export interface SubscriptionStatusResponse {
|
|
39
|
+
currentTier: SubscriptionTier;
|
|
40
|
+
expirationDate?: Date;
|
|
41
|
+
isTrialActive: boolean;
|
|
42
|
+
trialEndsAt?: Date;
|
|
43
|
+
platform?: string;
|
|
44
|
+
isActive: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface VerifyPurchaseRequest {
|
|
47
|
+
platform: string;
|
|
48
|
+
productId: string;
|
|
49
|
+
purchaseToken?: string;
|
|
50
|
+
receiptData?: string;
|
|
51
|
+
transactionId?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface VerifyPurchaseResponse {
|
|
54
|
+
success: boolean;
|
|
55
|
+
message?: string;
|
|
56
|
+
subscriptionTier?: SubscriptionTier;
|
|
57
|
+
expirationDate?: Date;
|
|
58
|
+
}
|
|
59
|
+
export interface CancelSubscriptionRequest {
|
|
60
|
+
platform: string;
|
|
61
|
+
}
|
|
62
|
+
export interface CancelSubscriptionResponse {
|
|
63
|
+
success: boolean;
|
|
64
|
+
message?: string;
|
|
65
|
+
expirationDate?: Date;
|
|
66
|
+
cancellationUrl?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface PurchaseReceiptItem {
|
|
69
|
+
id: number;
|
|
70
|
+
platform: string;
|
|
71
|
+
productId: string;
|
|
72
|
+
subscriptionTier: SubscriptionTier;
|
|
73
|
+
purchaseDate: Date;
|
|
74
|
+
expiryDate?: Date;
|
|
75
|
+
isActive: boolean;
|
|
76
|
+
isCancelled: boolean;
|
|
77
|
+
cancelledAt?: Date;
|
|
78
|
+
}
|
|
79
|
+
export interface PurchaseReceiptResponse {
|
|
80
|
+
purchases: PurchaseReceiptItem[];
|
|
81
|
+
currentPlatform?: string;
|
|
82
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Larisa Rozin
|
|
4
|
+
* dodone-shared - Task Management, Allowance & Bonus Tracking Application Package
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.UNLIMITED = exports.SubscriptionAction = exports.SubscriptionTier = void 0;
|
|
9
|
+
var SubscriptionTier;
|
|
10
|
+
(function (SubscriptionTier) {
|
|
11
|
+
SubscriptionTier[SubscriptionTier["Free"] = 0] = "Free";
|
|
12
|
+
SubscriptionTier[SubscriptionTier["Pro"] = 1] = "Pro";
|
|
13
|
+
})(SubscriptionTier || (exports.SubscriptionTier = SubscriptionTier = {}));
|
|
14
|
+
var SubscriptionAction;
|
|
15
|
+
(function (SubscriptionAction) {
|
|
16
|
+
SubscriptionAction[SubscriptionAction["AddTeamMember"] = 0] = "AddTeamMember";
|
|
17
|
+
SubscriptionAction[SubscriptionAction["AddAllowanceInterval"] = 1] = "AddAllowanceInterval";
|
|
18
|
+
SubscriptionAction[SubscriptionAction["AddTaskItem"] = 2] = "AddTaskItem";
|
|
19
|
+
})(SubscriptionAction || (exports.SubscriptionAction = SubscriptionAction = {}));
|
|
20
|
+
exports.UNLIMITED = -1;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AllowanceHistoryApprovalRequest, AllowanceHistoryClaimRequest, AllowanceHistoryResponse, AllowanceHistoryTaskItemResponse, PagedAllowanceHistoriesListRequest, PagedAllowanceHistoryTaskItemsListRequest } from "../types/AllowanceHistory";
|
|
2
2
|
import { DataResponse, ResponseBase } from "../types/ApiResponse";
|
|
3
3
|
import { DeviceRegistrationRequest } from "../types/DeviceRegistration";
|
|
4
|
+
import { CancelSubscriptionRequest, CancelSubscriptionResponse, PurchaseReceiptResponse, SubscriptionLimitsResponse, SubscriptionStatusResponse, ValidateSubscriptionActionRequest, ValidateSubscriptionActionResponse, VerifyPurchaseRequest, VerifyPurchaseResponse } from "../types/Subscription";
|
|
4
5
|
import { BonusApprovalRequest, TaskItemAllowanceApprovalRequest, TaskCommentCreateRequest, TaskCommentUpdateRequest, TaskItemTaskDetailsUpdateRequest } from "../types/TaskItem";
|
|
5
6
|
import { TeamAllowanceIntervalCreateRequest, TeamAllowanceIntervalListResponse, TeamAllowanceIntervalResponse, TeamAllowanceIntervalUpdateRequest, TeamDetailsResponse, TeamDetailsUpdateRequest } from "../types/Team";
|
|
6
7
|
import { ForgotPasswordRequest, ForgotPasswordResponse, RegisterRequest, ResetPasswordRequest, ResetPasswordResponse, SendPasswordResetEmailRequest, SendPasswordResetEmailResponse, User } from "../types/User";
|
|
@@ -70,7 +71,9 @@ export declare class ApiClient {
|
|
|
70
71
|
private _teams?;
|
|
71
72
|
private _avatar?;
|
|
72
73
|
private _allowanceHistories?;
|
|
74
|
+
private _subscriptions?;
|
|
73
75
|
get clientConfig(): ApiClientConfig;
|
|
76
|
+
get subscriptions(): Subscriptions;
|
|
74
77
|
get allowanceHistories(): AllowanceHistories;
|
|
75
78
|
get avatar(): Avatar;
|
|
76
79
|
get notifications(): Notifications;
|
|
@@ -185,6 +188,19 @@ declare class Tasks {
|
|
|
185
188
|
getPagedList(request: PagedTaskItemListRequest): Promise<PagedTaskItemListResponse<any>>;
|
|
186
189
|
getPagedListDetails(request: PagedTaskItemListRequest): Promise<PagedTaskItemDetailsListResponse<any>>;
|
|
187
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Subscriptions API operations class
|
|
193
|
+
*/
|
|
194
|
+
declare class Subscriptions {
|
|
195
|
+
private client;
|
|
196
|
+
constructor(client: ApiClient);
|
|
197
|
+
getLimits(): Promise<SubscriptionLimitsResponse>;
|
|
198
|
+
validateAction(request: ValidateSubscriptionActionRequest): Promise<ValidateSubscriptionActionResponse>;
|
|
199
|
+
getStatus(): Promise<SubscriptionStatusResponse>;
|
|
200
|
+
verifyPurchase(request: VerifyPurchaseRequest): Promise<VerifyPurchaseResponse>;
|
|
201
|
+
cancelSubscription(request: CancelSubscriptionRequest): Promise<CancelSubscriptionResponse>;
|
|
202
|
+
getPurchaseReceipt(): Promise<PurchaseReceiptResponse>;
|
|
203
|
+
}
|
|
188
204
|
/**
|
|
189
205
|
* Functional approach - creates an API client instance
|
|
190
206
|
* @param baseUrl - Base URL for the API
|
package/dist/utils/ApiClient.js
CHANGED
|
@@ -197,6 +197,12 @@ class ApiClient {
|
|
|
197
197
|
get clientConfig() {
|
|
198
198
|
return this.config;
|
|
199
199
|
}
|
|
200
|
+
get subscriptions() {
|
|
201
|
+
if (!this._subscriptions) {
|
|
202
|
+
this._subscriptions = new Subscriptions(this);
|
|
203
|
+
}
|
|
204
|
+
return this._subscriptions;
|
|
205
|
+
}
|
|
200
206
|
get allowanceHistories() {
|
|
201
207
|
if (!this._allowanceHistories) {
|
|
202
208
|
this._allowanceHistories = new AllowanceHistories(this);
|
|
@@ -583,6 +589,44 @@ class Tasks {
|
|
|
583
589
|
});
|
|
584
590
|
}
|
|
585
591
|
}
|
|
592
|
+
/**
|
|
593
|
+
* Subscriptions API operations class
|
|
594
|
+
*/
|
|
595
|
+
class Subscriptions {
|
|
596
|
+
constructor(client) {
|
|
597
|
+
this.client = client;
|
|
598
|
+
}
|
|
599
|
+
getLimits() {
|
|
600
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
601
|
+
return this.client.get('/api/subscription/limits', {}, false);
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
validateAction(request) {
|
|
605
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
606
|
+
return this.client.postDontProcess('/api/subscription/validate-action', request);
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
getStatus() {
|
|
610
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
611
|
+
return this.client.get('/api/subscription/status', {}, false);
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
verifyPurchase(request) {
|
|
615
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
616
|
+
return this.client.postDontProcess('/api/subscription/verify', request);
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
cancelSubscription(request) {
|
|
620
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
621
|
+
return this.client.postDontProcess('/api/subscription/cancel', request);
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
getPurchaseReceipt() {
|
|
625
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
626
|
+
return this.client.get('/api/subscription/receipt', {}, false);
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
}
|
|
586
630
|
/**
|
|
587
631
|
* Functional approach - creates an API client instance
|
|
588
632
|
* @param baseUrl - Base URL for the API
|