@gamelobby/common 1.0.322 → 1.0.324

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.
@@ -70,3 +70,4 @@ export * from './requestStates.enum';
70
70
  export * from './awardNew.interface';
71
71
  export * from './awardType.enum';
72
72
  export * from './bracketBackend.interface';
73
+ export * from './wallet.interface';
@@ -82,3 +82,4 @@ __exportStar(require("./requestStates.enum"), exports);
82
82
  __exportStar(require("./awardNew.interface"), exports);
83
83
  __exportStar(require("./awardType.enum"), exports);
84
84
  __exportStar(require("./bracketBackend.interface"), exports);
85
+ __exportStar(require("./wallet.interface"), exports);
@@ -0,0 +1,214 @@
1
+ export declare enum CurrencyType {
2
+ COINS = "coins",
3
+ GEMS = "gems",
4
+ PREMIUM_TOKENS = "premium_tokens",
5
+ EVENT_TOKENS = "event_tokens"
6
+ }
7
+ export interface ICurrency {
8
+ id: number;
9
+ code: string;
10
+ name: string;
11
+ description: string;
12
+ icon: string;
13
+ exchangeRate: number;
14
+ isActive: boolean;
15
+ isPremium: boolean;
16
+ isTransferable: boolean;
17
+ expiresAt?: Date;
18
+ }
19
+ export interface IWallet {
20
+ id: number;
21
+ userId: string;
22
+ currencyId: number;
23
+ balance: number;
24
+ heldBalance: number;
25
+ availableBalance: number;
26
+ lifetimeEarned: number;
27
+ lifetimeSpent: number;
28
+ isFrozen: boolean;
29
+ frozenReason?: string;
30
+ lastTransactionAt?: Date;
31
+ }
32
+ export declare enum TransactionType {
33
+ DEPOSIT = "deposit",
34
+ WITHDRAW = "withdraw",
35
+ TRANSFER = "transfer",
36
+ PURCHASE = "purchase",
37
+ REWARD = "reward",
38
+ REFUND = "refund",
39
+ ESCROW_HOLD = "escrow_hold",
40
+ ESCROW_RELEASE = "escrow_release",
41
+ PROMOTION = "promotion",
42
+ CASHBACK = "cashback",
43
+ MISSION_REWARD = "mission_reward",
44
+ LOYALTY_REWARD = "loyalty_reward"
45
+ }
46
+ export declare enum TransactionStatus {
47
+ PENDING = "pending",
48
+ COMPLETED = "completed",
49
+ FAILED = "failed",
50
+ CANCELLED = "cancelled",
51
+ HELD = "held",
52
+ DISPUTED = "disputed",
53
+ REFUNDED = "refunded"
54
+ }
55
+ export declare enum HoldStatus {
56
+ ACTIVE = "active",
57
+ RELEASED = "released",
58
+ REFUNDED = "refunded",
59
+ DISPUTED = "disputed",
60
+ EXPIRED = "expired"
61
+ }
62
+ export interface ITransaction {
63
+ id: number;
64
+ fromWalletId?: number;
65
+ toWalletId?: number;
66
+ amount: number;
67
+ type: TransactionType;
68
+ status: TransactionStatus;
69
+ description: string;
70
+ idempotencyKey: string;
71
+ referenceType?: string;
72
+ referenceId?: string;
73
+ metadata?: any;
74
+ failureReason?: string;
75
+ processedAt?: Date;
76
+ }
77
+ export declare enum LoyaltyTierCode {
78
+ BRONZE = "bronze",
79
+ SILVER = "silver",
80
+ GOLD = "gold",
81
+ PLATINUM = "platinum",
82
+ DIAMOND = "diamond"
83
+ }
84
+ export declare enum LoyaltyTransactionType {
85
+ EARNED = "earned",
86
+ SPENT = "spent",
87
+ EXPIRED = "expired",
88
+ BONUS = "bonus",
89
+ ADJUSTED = "adjusted"
90
+ }
91
+ export interface ILoyaltyTier {
92
+ id: number;
93
+ code: LoyaltyTierCode;
94
+ name: string;
95
+ description: string;
96
+ level: number;
97
+ minPoints: number;
98
+ coinsMultiplier: number;
99
+ discountPercentage: number;
100
+ monthlyGems: number;
101
+ hasVipAccess: boolean;
102
+ hasPrioritySupport: boolean;
103
+ color: string;
104
+ icon?: string;
105
+ }
106
+ export interface IUserLoyalty {
107
+ id: number;
108
+ userId: string;
109
+ currentTierId: number;
110
+ currentPoints: number;
111
+ lifetimePoints: number;
112
+ pointsToNextTier: number;
113
+ progressPercentage: number;
114
+ lastTierUpgradeAt?: Date;
115
+ tierDowngradeProtectionUntil?: Date;
116
+ lastMonthlyRewardClaimedAt?: Date;
117
+ statistics?: any;
118
+ }
119
+ export declare enum MissionType {
120
+ DAILY = "daily",
121
+ WEEKLY = "weekly",
122
+ SPECIAL = "special",
123
+ EVENT = "event"
124
+ }
125
+ export declare enum MissionRequirementType {
126
+ PLAY_MATCHES = "play_matches",
127
+ WIN_MATCHES = "win_matches",
128
+ JOIN_ROOMS = "join_rooms",
129
+ SPEND_CURRENCY = "spend_currency",
130
+ EARN_COINS = "earn_coins",
131
+ LOGIN_DAYS = "login_days",
132
+ INVITE_FRIENDS = "invite_friends",
133
+ COMPLETE_TOURNAMENTS = "complete_tournaments"
134
+ }
135
+ export interface IMission {
136
+ id: number;
137
+ name: string;
138
+ description: string;
139
+ type: MissionType;
140
+ requirementType: MissionRequirementType;
141
+ requirementTarget: number;
142
+ rewardCurrency?: string;
143
+ rewardAmount?: number;
144
+ rewardLoyaltyPoints?: number;
145
+ isActive: boolean;
146
+ startDate?: Date;
147
+ endDate?: Date;
148
+ }
149
+ export declare enum PromotionType {
150
+ PERCENTAGE_DISCOUNT = "percentage_discount",
151
+ FIXED_DISCOUNT = "fixed_discount",
152
+ CASHBACK = "cashback",
153
+ BUY_X_GET_Y = "buy_x_get_y",
154
+ FIRST_PURCHASE = "first_purchase",
155
+ LOYALTY_TIER_BONUS = "loyalty_tier_bonus",
156
+ BUNDLE_DISCOUNT = "bundle_discount"
157
+ }
158
+ export declare enum PromotionStatus {
159
+ DRAFT = "draft",
160
+ ACTIVE = "active",
161
+ PAUSED = "paused",
162
+ EXPIRED = "expired",
163
+ ENDED = "ended"
164
+ }
165
+ export declare enum PromoCodeStatus {
166
+ ACTIVE = "active",
167
+ INACTIVE = "inactive",
168
+ EXPIRED = "expired",
169
+ DEPLETED = "depleted"
170
+ }
171
+ export declare enum DiscountRuleCondition {
172
+ MIN_PURCHASE = "min_purchase",
173
+ USER_TIER = "user_tier",
174
+ FIRST_PURCHASE = "first_purchase",
175
+ TIME_RANGE = "time_range",
176
+ SPECIFIC_CURRENCY = "specific_currency"
177
+ }
178
+ export declare enum RewardType {
179
+ CURRENCY = "currency",
180
+ DISCOUNT_COUPON = "discount_coupon",
181
+ VIP_ACCESS = "vip_access",
182
+ COSMETIC = "cosmetic",
183
+ SPECIAL_EVENT = "special_event",
184
+ BONUS_MULTIPLIER = "bonus_multiplier"
185
+ }
186
+ export declare enum UserRewardStatus {
187
+ ACTIVE = "active",
188
+ USED = "used",
189
+ EXPIRED = "expired"
190
+ }
191
+ export declare enum UserMissionStatus {
192
+ IN_PROGRESS = "in_progress",
193
+ COMPLETED = "completed",
194
+ CLAIMED = "claimed",
195
+ EXPIRED = "expired"
196
+ }
197
+ export interface IPromotion {
198
+ id: number;
199
+ name: string;
200
+ description: string;
201
+ type: PromotionType;
202
+ status: string;
203
+ discountPercentage?: number;
204
+ discountAmount?: number;
205
+ cashbackPercentage?: number;
206
+ applicableCurrency?: string;
207
+ minPurchaseAmount?: number;
208
+ maxDiscountAmount?: number;
209
+ isCombinable: boolean;
210
+ priority: number;
211
+ isActive: boolean;
212
+ startDate?: Date;
213
+ endDate?: Date;
214
+ }
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ // Wallet & Loyalty Interfaces
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.UserMissionStatus = exports.UserRewardStatus = exports.RewardType = exports.DiscountRuleCondition = exports.PromoCodeStatus = exports.PromotionStatus = exports.PromotionType = exports.MissionRequirementType = exports.MissionType = exports.LoyaltyTransactionType = exports.LoyaltyTierCode = exports.HoldStatus = exports.TransactionStatus = exports.TransactionType = exports.CurrencyType = void 0;
5
+ // Currency Enums
6
+ var CurrencyType;
7
+ (function (CurrencyType) {
8
+ CurrencyType["COINS"] = "coins";
9
+ CurrencyType["GEMS"] = "gems";
10
+ CurrencyType["PREMIUM_TOKENS"] = "premium_tokens";
11
+ CurrencyType["EVENT_TOKENS"] = "event_tokens";
12
+ })(CurrencyType = exports.CurrencyType || (exports.CurrencyType = {}));
13
+ var TransactionType;
14
+ (function (TransactionType) {
15
+ TransactionType["DEPOSIT"] = "deposit";
16
+ TransactionType["WITHDRAW"] = "withdraw";
17
+ TransactionType["TRANSFER"] = "transfer";
18
+ TransactionType["PURCHASE"] = "purchase";
19
+ TransactionType["REWARD"] = "reward";
20
+ TransactionType["REFUND"] = "refund";
21
+ TransactionType["ESCROW_HOLD"] = "escrow_hold";
22
+ TransactionType["ESCROW_RELEASE"] = "escrow_release";
23
+ TransactionType["PROMOTION"] = "promotion";
24
+ TransactionType["CASHBACK"] = "cashback";
25
+ TransactionType["MISSION_REWARD"] = "mission_reward";
26
+ TransactionType["LOYALTY_REWARD"] = "loyalty_reward";
27
+ })(TransactionType = exports.TransactionType || (exports.TransactionType = {}));
28
+ var TransactionStatus;
29
+ (function (TransactionStatus) {
30
+ TransactionStatus["PENDING"] = "pending";
31
+ TransactionStatus["COMPLETED"] = "completed";
32
+ TransactionStatus["FAILED"] = "failed";
33
+ TransactionStatus["CANCELLED"] = "cancelled";
34
+ TransactionStatus["HELD"] = "held";
35
+ TransactionStatus["DISPUTED"] = "disputed";
36
+ TransactionStatus["REFUNDED"] = "refunded";
37
+ })(TransactionStatus = exports.TransactionStatus || (exports.TransactionStatus = {}));
38
+ // Transaction Hold Enums
39
+ var HoldStatus;
40
+ (function (HoldStatus) {
41
+ HoldStatus["ACTIVE"] = "active";
42
+ HoldStatus["RELEASED"] = "released";
43
+ HoldStatus["REFUNDED"] = "refunded";
44
+ HoldStatus["DISPUTED"] = "disputed";
45
+ HoldStatus["EXPIRED"] = "expired";
46
+ })(HoldStatus = exports.HoldStatus || (exports.HoldStatus = {}));
47
+ var LoyaltyTierCode;
48
+ (function (LoyaltyTierCode) {
49
+ LoyaltyTierCode["BRONZE"] = "bronze";
50
+ LoyaltyTierCode["SILVER"] = "silver";
51
+ LoyaltyTierCode["GOLD"] = "gold";
52
+ LoyaltyTierCode["PLATINUM"] = "platinum";
53
+ LoyaltyTierCode["DIAMOND"] = "diamond";
54
+ })(LoyaltyTierCode = exports.LoyaltyTierCode || (exports.LoyaltyTierCode = {}));
55
+ // Loyalty Transaction Enums
56
+ var LoyaltyTransactionType;
57
+ (function (LoyaltyTransactionType) {
58
+ LoyaltyTransactionType["EARNED"] = "earned";
59
+ LoyaltyTransactionType["SPENT"] = "spent";
60
+ LoyaltyTransactionType["EXPIRED"] = "expired";
61
+ LoyaltyTransactionType["BONUS"] = "bonus";
62
+ LoyaltyTransactionType["ADJUSTED"] = "adjusted";
63
+ })(LoyaltyTransactionType = exports.LoyaltyTransactionType || (exports.LoyaltyTransactionType = {}));
64
+ var MissionType;
65
+ (function (MissionType) {
66
+ MissionType["DAILY"] = "daily";
67
+ MissionType["WEEKLY"] = "weekly";
68
+ MissionType["SPECIAL"] = "special";
69
+ MissionType["EVENT"] = "event";
70
+ })(MissionType = exports.MissionType || (exports.MissionType = {}));
71
+ var MissionRequirementType;
72
+ (function (MissionRequirementType) {
73
+ MissionRequirementType["PLAY_MATCHES"] = "play_matches";
74
+ MissionRequirementType["WIN_MATCHES"] = "win_matches";
75
+ MissionRequirementType["JOIN_ROOMS"] = "join_rooms";
76
+ MissionRequirementType["SPEND_CURRENCY"] = "spend_currency";
77
+ MissionRequirementType["EARN_COINS"] = "earn_coins";
78
+ MissionRequirementType["LOGIN_DAYS"] = "login_days";
79
+ MissionRequirementType["INVITE_FRIENDS"] = "invite_friends";
80
+ MissionRequirementType["COMPLETE_TOURNAMENTS"] = "complete_tournaments";
81
+ })(MissionRequirementType = exports.MissionRequirementType || (exports.MissionRequirementType = {}));
82
+ var PromotionType;
83
+ (function (PromotionType) {
84
+ PromotionType["PERCENTAGE_DISCOUNT"] = "percentage_discount";
85
+ PromotionType["FIXED_DISCOUNT"] = "fixed_discount";
86
+ PromotionType["CASHBACK"] = "cashback";
87
+ PromotionType["BUY_X_GET_Y"] = "buy_x_get_y";
88
+ PromotionType["FIRST_PURCHASE"] = "first_purchase";
89
+ PromotionType["LOYALTY_TIER_BONUS"] = "loyalty_tier_bonus";
90
+ PromotionType["BUNDLE_DISCOUNT"] = "bundle_discount";
91
+ })(PromotionType = exports.PromotionType || (exports.PromotionType = {}));
92
+ var PromotionStatus;
93
+ (function (PromotionStatus) {
94
+ PromotionStatus["DRAFT"] = "draft";
95
+ PromotionStatus["ACTIVE"] = "active";
96
+ PromotionStatus["PAUSED"] = "paused";
97
+ PromotionStatus["EXPIRED"] = "expired";
98
+ PromotionStatus["ENDED"] = "ended";
99
+ })(PromotionStatus = exports.PromotionStatus || (exports.PromotionStatus = {}));
100
+ // PromoCode Enums
101
+ var PromoCodeStatus;
102
+ (function (PromoCodeStatus) {
103
+ PromoCodeStatus["ACTIVE"] = "active";
104
+ PromoCodeStatus["INACTIVE"] = "inactive";
105
+ PromoCodeStatus["EXPIRED"] = "expired";
106
+ PromoCodeStatus["DEPLETED"] = "depleted";
107
+ })(PromoCodeStatus = exports.PromoCodeStatus || (exports.PromoCodeStatus = {}));
108
+ // Discount Rule Enums
109
+ var DiscountRuleCondition;
110
+ (function (DiscountRuleCondition) {
111
+ DiscountRuleCondition["MIN_PURCHASE"] = "min_purchase";
112
+ DiscountRuleCondition["USER_TIER"] = "user_tier";
113
+ DiscountRuleCondition["FIRST_PURCHASE"] = "first_purchase";
114
+ DiscountRuleCondition["TIME_RANGE"] = "time_range";
115
+ DiscountRuleCondition["SPECIFIC_CURRENCY"] = "specific_currency";
116
+ })(DiscountRuleCondition = exports.DiscountRuleCondition || (exports.DiscountRuleCondition = {}));
117
+ // Reward Enums
118
+ var RewardType;
119
+ (function (RewardType) {
120
+ RewardType["CURRENCY"] = "currency";
121
+ RewardType["DISCOUNT_COUPON"] = "discount_coupon";
122
+ RewardType["VIP_ACCESS"] = "vip_access";
123
+ RewardType["COSMETIC"] = "cosmetic";
124
+ RewardType["SPECIAL_EVENT"] = "special_event";
125
+ RewardType["BONUS_MULTIPLIER"] = "bonus_multiplier";
126
+ })(RewardType = exports.RewardType || (exports.RewardType = {}));
127
+ var UserRewardStatus;
128
+ (function (UserRewardStatus) {
129
+ UserRewardStatus["ACTIVE"] = "active";
130
+ UserRewardStatus["USED"] = "used";
131
+ UserRewardStatus["EXPIRED"] = "expired";
132
+ })(UserRewardStatus = exports.UserRewardStatus || (exports.UserRewardStatus = {}));
133
+ // User Mission Enums
134
+ var UserMissionStatus;
135
+ (function (UserMissionStatus) {
136
+ UserMissionStatus["IN_PROGRESS"] = "in_progress";
137
+ UserMissionStatus["COMPLETED"] = "completed";
138
+ UserMissionStatus["CLAIMED"] = "claimed";
139
+ UserMissionStatus["EXPIRED"] = "expired";
140
+ })(UserMissionStatus = exports.UserMissionStatus || (exports.UserMissionStatus = {}));
@@ -4,3 +4,4 @@ export * from './invitationstopics';
4
4
  export * from './notificationsTopics';
5
5
  export * from './rankingtopics';
6
6
  export * from './chatstopics';
7
+ export * from './walletLoyaltyTopics';
@@ -16,3 +16,4 @@ __exportStar(require("./invitationstopics"), exports);
16
16
  __exportStar(require("./notificationsTopics"), exports);
17
17
  __exportStar(require("./rankingtopics"), exports);
18
18
  __exportStar(require("./chatstopics"), exports);
19
+ __exportStar(require("./walletLoyaltyTopics"), exports);
@@ -0,0 +1,27 @@
1
+ export declare enum Subjects {
2
+ WalletBalanceUpdated = "wallet:balance-updated",
3
+ TransactionCompleted = "transaction:completed",
4
+ TransactionFailed = "transaction:failed",
5
+ LoyaltyPointsEarned = "loyalty:points-earned",
6
+ LoyaltyPointsSpent = "loyalty:points-spent",
7
+ LoyaltyTierUpgraded = "loyalty:tier-upgraded",
8
+ LoyaltyTierDowngraded = "loyalty:tier-downgraded",
9
+ RewardClaimed = "reward:claimed",
10
+ RewardUsed = "reward:used",
11
+ RewardExpired = "reward:expired",
12
+ MissionStarted = "mission:started",
13
+ MissionProgressUpdated = "mission:progress-updated",
14
+ MissionCompleted = "mission:completed",
15
+ MissionRewardClaimed = "mission:reward-claimed",
16
+ PromotionApplied = "promotion:applied",
17
+ PromoCodeUsed = "promocode:used",
18
+ EscrowHoldCreated = "escrow:hold-created",
19
+ EscrowHoldReleased = "escrow:hold-released",
20
+ EscrowHoldRefunded = "escrow:hold-refunded",
21
+ EscrowHoldDisputed = "escrow:hold-disputed",
22
+ MatchCreated = "match:created",
23
+ MatchFinished = "match:finished",
24
+ UserRegistered = "user:registered",
25
+ RoomJoined = "room:joined",
26
+ PurchaseCompleted = "purchase:completed"
27
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Subjects = void 0;
4
+ var Subjects;
5
+ (function (Subjects) {
6
+ // Wallet Topics
7
+ Subjects["WalletBalanceUpdated"] = "wallet:balance-updated";
8
+ Subjects["TransactionCompleted"] = "transaction:completed";
9
+ Subjects["TransactionFailed"] = "transaction:failed";
10
+ // Loyalty Topics
11
+ Subjects["LoyaltyPointsEarned"] = "loyalty:points-earned";
12
+ Subjects["LoyaltyPointsSpent"] = "loyalty:points-spent";
13
+ Subjects["LoyaltyTierUpgraded"] = "loyalty:tier-upgraded";
14
+ Subjects["LoyaltyTierDowngraded"] = "loyalty:tier-downgraded";
15
+ // Rewards Topics
16
+ Subjects["RewardClaimed"] = "reward:claimed";
17
+ Subjects["RewardUsed"] = "reward:used";
18
+ Subjects["RewardExpired"] = "reward:expired";
19
+ // Missions Topics
20
+ Subjects["MissionStarted"] = "mission:started";
21
+ Subjects["MissionProgressUpdated"] = "mission:progress-updated";
22
+ Subjects["MissionCompleted"] = "mission:completed";
23
+ Subjects["MissionRewardClaimed"] = "mission:reward-claimed";
24
+ // Promotions Topics
25
+ Subjects["PromotionApplied"] = "promotion:applied";
26
+ Subjects["PromoCodeUsed"] = "promocode:used";
27
+ // Escrow Topics
28
+ Subjects["EscrowHoldCreated"] = "escrow:hold-created";
29
+ Subjects["EscrowHoldReleased"] = "escrow:hold-released";
30
+ Subjects["EscrowHoldRefunded"] = "escrow:hold-refunded";
31
+ Subjects["EscrowHoldDisputed"] = "escrow:hold-disputed";
32
+ // Existing topics from other services
33
+ Subjects["MatchCreated"] = "match:created";
34
+ Subjects["MatchFinished"] = "match:finished";
35
+ Subjects["UserRegistered"] = "user:registered";
36
+ Subjects["RoomJoined"] = "room:joined";
37
+ Subjects["PurchaseCompleted"] = "purchase:completed";
38
+ })(Subjects = exports.Subjects || (exports.Subjects = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamelobby/common",
3
- "version": "1.0.322",
3
+ "version": "1.0.324",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",