@gamelobby/common 1.0.322 → 1.0.323

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,155 @@
1
+ export interface ICurrency {
2
+ id: number;
3
+ code: string;
4
+ name: string;
5
+ description: string;
6
+ icon: string;
7
+ exchangeRate: number;
8
+ isActive: boolean;
9
+ isPremium: boolean;
10
+ isTransferable: boolean;
11
+ expiresAt?: Date;
12
+ }
13
+ export interface IWallet {
14
+ id: number;
15
+ userId: string;
16
+ currencyId: number;
17
+ balance: number;
18
+ heldBalance: number;
19
+ availableBalance: number;
20
+ lifetimeEarned: number;
21
+ lifetimeSpent: number;
22
+ isFrozen: boolean;
23
+ frozenReason?: string;
24
+ lastTransactionAt?: Date;
25
+ }
26
+ export declare enum TransactionType {
27
+ DEPOSIT = "deposit",
28
+ WITHDRAW = "withdraw",
29
+ TRANSFER = "transfer",
30
+ PURCHASE = "purchase",
31
+ REWARD = "reward",
32
+ REFUND = "refund",
33
+ ESCROW_HOLD = "escrow_hold",
34
+ ESCROW_RELEASE = "escrow_release",
35
+ PROMOTION = "promotion",
36
+ CASHBACK = "cashback",
37
+ MISSION_REWARD = "mission_reward",
38
+ LOYALTY_REWARD = "loyalty_reward"
39
+ }
40
+ export declare enum TransactionStatus {
41
+ PENDING = "pending",
42
+ COMPLETED = "completed",
43
+ FAILED = "failed",
44
+ CANCELLED = "cancelled",
45
+ HELD = "held",
46
+ DISPUTED = "disputed",
47
+ REFUNDED = "refunded"
48
+ }
49
+ export interface ITransaction {
50
+ id: number;
51
+ fromWalletId?: number;
52
+ toWalletId?: number;
53
+ amount: number;
54
+ type: TransactionType;
55
+ status: TransactionStatus;
56
+ description: string;
57
+ idempotencyKey: string;
58
+ referenceType?: string;
59
+ referenceId?: string;
60
+ metadata?: any;
61
+ failureReason?: string;
62
+ processedAt?: Date;
63
+ }
64
+ export declare enum LoyaltyTierCode {
65
+ BRONZE = "bronze",
66
+ SILVER = "silver",
67
+ GOLD = "gold",
68
+ PLATINUM = "platinum",
69
+ DIAMOND = "diamond"
70
+ }
71
+ export interface ILoyaltyTier {
72
+ id: number;
73
+ code: LoyaltyTierCode;
74
+ name: string;
75
+ description: string;
76
+ level: number;
77
+ minPoints: number;
78
+ coinsMultiplier: number;
79
+ discountPercentage: number;
80
+ monthlyGems: number;
81
+ hasVipAccess: boolean;
82
+ hasPrioritySupport: boolean;
83
+ color: string;
84
+ icon?: string;
85
+ }
86
+ export interface IUserLoyalty {
87
+ id: number;
88
+ userId: string;
89
+ currentTierId: number;
90
+ currentPoints: number;
91
+ lifetimePoints: number;
92
+ pointsToNextTier: number;
93
+ progressPercentage: number;
94
+ lastTierUpgradeAt?: Date;
95
+ tierDowngradeProtectionUntil?: Date;
96
+ lastMonthlyRewardClaimedAt?: Date;
97
+ statistics?: any;
98
+ }
99
+ export declare enum MissionType {
100
+ DAILY = "daily",
101
+ WEEKLY = "weekly",
102
+ SPECIAL = "special",
103
+ EVENT = "event"
104
+ }
105
+ export declare enum MissionRequirementType {
106
+ PLAY_MATCHES = "play_matches",
107
+ WIN_MATCHES = "win_matches",
108
+ JOIN_ROOMS = "join_rooms",
109
+ SPEND_CURRENCY = "spend_currency",
110
+ EARN_COINS = "earn_coins",
111
+ LOGIN_DAYS = "login_days",
112
+ INVITE_FRIENDS = "invite_friends",
113
+ COMPLETE_TOURNAMENTS = "complete_tournaments"
114
+ }
115
+ export interface IMission {
116
+ id: number;
117
+ name: string;
118
+ description: string;
119
+ type: MissionType;
120
+ requirementType: MissionRequirementType;
121
+ requirementTarget: number;
122
+ rewardCurrency?: string;
123
+ rewardAmount?: number;
124
+ rewardLoyaltyPoints?: number;
125
+ isActive: boolean;
126
+ startDate?: Date;
127
+ endDate?: Date;
128
+ }
129
+ export declare enum PromotionType {
130
+ PERCENTAGE_DISCOUNT = "percentage_discount",
131
+ FIXED_DISCOUNT = "fixed_discount",
132
+ CASHBACK = "cashback",
133
+ BUY_X_GET_Y = "buy_x_get_y",
134
+ FIRST_PURCHASE = "first_purchase",
135
+ LOYALTY_TIER_BONUS = "loyalty_tier_bonus",
136
+ BUNDLE_DISCOUNT = "bundle_discount"
137
+ }
138
+ export interface IPromotion {
139
+ id: number;
140
+ name: string;
141
+ description: string;
142
+ type: PromotionType;
143
+ status: string;
144
+ discountPercentage?: number;
145
+ discountAmount?: number;
146
+ cashbackPercentage?: number;
147
+ applicableCurrency?: string;
148
+ minPurchaseAmount?: number;
149
+ maxDiscountAmount?: number;
150
+ isCombinable: boolean;
151
+ priority: number;
152
+ isActive: boolean;
153
+ startDate?: Date;
154
+ endDate?: Date;
155
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ // Wallet & Loyalty Interfaces
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PromotionType = exports.MissionRequirementType = exports.MissionType = exports.LoyaltyTierCode = exports.TransactionStatus = exports.TransactionType = void 0;
5
+ var TransactionType;
6
+ (function (TransactionType) {
7
+ TransactionType["DEPOSIT"] = "deposit";
8
+ TransactionType["WITHDRAW"] = "withdraw";
9
+ TransactionType["TRANSFER"] = "transfer";
10
+ TransactionType["PURCHASE"] = "purchase";
11
+ TransactionType["REWARD"] = "reward";
12
+ TransactionType["REFUND"] = "refund";
13
+ TransactionType["ESCROW_HOLD"] = "escrow_hold";
14
+ TransactionType["ESCROW_RELEASE"] = "escrow_release";
15
+ TransactionType["PROMOTION"] = "promotion";
16
+ TransactionType["CASHBACK"] = "cashback";
17
+ TransactionType["MISSION_REWARD"] = "mission_reward";
18
+ TransactionType["LOYALTY_REWARD"] = "loyalty_reward";
19
+ })(TransactionType = exports.TransactionType || (exports.TransactionType = {}));
20
+ var TransactionStatus;
21
+ (function (TransactionStatus) {
22
+ TransactionStatus["PENDING"] = "pending";
23
+ TransactionStatus["COMPLETED"] = "completed";
24
+ TransactionStatus["FAILED"] = "failed";
25
+ TransactionStatus["CANCELLED"] = "cancelled";
26
+ TransactionStatus["HELD"] = "held";
27
+ TransactionStatus["DISPUTED"] = "disputed";
28
+ TransactionStatus["REFUNDED"] = "refunded";
29
+ })(TransactionStatus = exports.TransactionStatus || (exports.TransactionStatus = {}));
30
+ var LoyaltyTierCode;
31
+ (function (LoyaltyTierCode) {
32
+ LoyaltyTierCode["BRONZE"] = "bronze";
33
+ LoyaltyTierCode["SILVER"] = "silver";
34
+ LoyaltyTierCode["GOLD"] = "gold";
35
+ LoyaltyTierCode["PLATINUM"] = "platinum";
36
+ LoyaltyTierCode["DIAMOND"] = "diamond";
37
+ })(LoyaltyTierCode = exports.LoyaltyTierCode || (exports.LoyaltyTierCode = {}));
38
+ var MissionType;
39
+ (function (MissionType) {
40
+ MissionType["DAILY"] = "daily";
41
+ MissionType["WEEKLY"] = "weekly";
42
+ MissionType["SPECIAL"] = "special";
43
+ MissionType["EVENT"] = "event";
44
+ })(MissionType = exports.MissionType || (exports.MissionType = {}));
45
+ var MissionRequirementType;
46
+ (function (MissionRequirementType) {
47
+ MissionRequirementType["PLAY_MATCHES"] = "play_matches";
48
+ MissionRequirementType["WIN_MATCHES"] = "win_matches";
49
+ MissionRequirementType["JOIN_ROOMS"] = "join_rooms";
50
+ MissionRequirementType["SPEND_CURRENCY"] = "spend_currency";
51
+ MissionRequirementType["EARN_COINS"] = "earn_coins";
52
+ MissionRequirementType["LOGIN_DAYS"] = "login_days";
53
+ MissionRequirementType["INVITE_FRIENDS"] = "invite_friends";
54
+ MissionRequirementType["COMPLETE_TOURNAMENTS"] = "complete_tournaments";
55
+ })(MissionRequirementType = exports.MissionRequirementType || (exports.MissionRequirementType = {}));
56
+ var PromotionType;
57
+ (function (PromotionType) {
58
+ PromotionType["PERCENTAGE_DISCOUNT"] = "percentage_discount";
59
+ PromotionType["FIXED_DISCOUNT"] = "fixed_discount";
60
+ PromotionType["CASHBACK"] = "cashback";
61
+ PromotionType["BUY_X_GET_Y"] = "buy_x_get_y";
62
+ PromotionType["FIRST_PURCHASE"] = "first_purchase";
63
+ PromotionType["LOYALTY_TIER_BONUS"] = "loyalty_tier_bonus";
64
+ PromotionType["BUNDLE_DISCOUNT"] = "bundle_discount";
65
+ })(PromotionType = exports.PromotionType || (exports.PromotionType = {}));
@@ -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.323",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",