@wrcb/cb-common 1.0.569 → 1.0.571

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.
Files changed (36) hide show
  1. package/build/events/politica-bet/disputeCreatedEvent.d.ts +14 -0
  2. package/build/events/politica-bet/disputeResolvedEvent.d.ts +14 -0
  3. package/build/events/politica-bet/disputeResolvedEvent.js +2 -0
  4. package/build/events/politica-bet/predictionCancelledEvent.d.ts +15 -0
  5. package/build/events/politica-bet/predictionCancelledEvent.js +2 -0
  6. package/build/events/politica-bet/predictionClosedEvent.d.ts +14 -0
  7. package/build/events/politica-bet/predictionClosedEvent.js +2 -0
  8. package/build/events/politica-bet/predictionCreatedEvent.d.ts +29 -0
  9. package/build/events/politica-bet/predictionCreatedEvent.js +2 -0
  10. package/build/events/politica-bet/predictionResolvedEvent.d.ts +20 -0
  11. package/build/events/politica-bet/predictionResolvedEvent.js +2 -0
  12. package/build/events/politica-bet/predictionUpdatedEvent.d.ts +16 -0
  13. package/build/events/politica-bet/predictionUpdatedEvent.js +2 -0
  14. package/build/events/politica-bet/suggestionApprovedEvent.d.ts +13 -0
  15. package/build/events/politica-bet/suggestionApprovedEvent.js +2 -0
  16. package/build/events/politica-bet/suggestionCreatedEvent.d.ts +15 -0
  17. package/build/events/politica-bet/suggestionCreatedEvent.js +2 -0
  18. package/build/events/politica-bet/suggestionRejectedEvent.d.ts +12 -0
  19. package/build/events/politica-bet/suggestionRejectedEvent.js +2 -0
  20. package/build/events/subjects.d.ts +11 -1
  21. package/build/events/subjects.js +11 -0
  22. package/build/index.d.ts +4 -2
  23. package/build/index.js +5 -2
  24. package/build/services/TenantDataService.d.ts +74 -9
  25. package/build/services/TenantDataService.js +241 -23
  26. package/build/types/disputeStatus.d.ts +5 -0
  27. package/build/types/disputeStatus.js +9 -0
  28. package/build/types/politicaBetCategory.d.ts +10 -0
  29. package/build/types/politicaBetCategory.js +14 -0
  30. package/build/types/predictionStatus.d.ts +22 -5
  31. package/build/types/predictionStatus.js +51 -6
  32. package/build/types/suggestionStatus.d.ts +5 -0
  33. package/build/types/suggestionStatus.js +9 -0
  34. package/package.json +1 -1
  35. package/build/types/predictions.d.ts +0 -25
  36. /package/build/{types/predictions.js → events/politica-bet/disputeCreatedEvent.js} +0 -0
@@ -0,0 +1,14 @@
1
+ import { Tenant } from 'src/types/tenant';
2
+ import { Subjects } from '../subjects';
3
+ export interface DisputeCreatedEvent {
4
+ subject: Subjects.DisputeCreated;
5
+ data: {
6
+ id: string;
7
+ predictionId: string;
8
+ predictionTitle: string;
9
+ tenant: Tenant;
10
+ userId: string;
11
+ userNickName: string;
12
+ reason: string;
13
+ };
14
+ }
@@ -0,0 +1,14 @@
1
+ import { Tenant } from 'src/types/tenant';
2
+ import { Subjects } from '../subjects';
3
+ export interface DisputeResolvedEvent {
4
+ subject: Subjects.DisputeResolved;
5
+ data: {
6
+ id: string;
7
+ predictionId: string;
8
+ tenant: Tenant;
9
+ userId: string;
10
+ resolvedBy: string;
11
+ wasAccepted: boolean;
12
+ adminResponse: string;
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { Tenant } from 'src/types/tenant';
2
+ import { Subjects } from '../subjects';
3
+ import { PoliticaBetCategory } from 'src/types/politicaBetCategory';
4
+ export interface PredictionCancelledEvent {
5
+ subject: Subjects.PredictionCancelled;
6
+ data: {
7
+ id: string;
8
+ tenant: Tenant;
9
+ category: PoliticaBetCategory;
10
+ title: string;
11
+ cancelledAt: Date;
12
+ cancelledBy: string;
13
+ reason?: string;
14
+ };
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import { Tenant } from 'src/types/tenant';
2
+ import { Subjects } from '../subjects';
3
+ import { PoliticaBetCategory } from 'src/types/politicaBetCategory';
4
+ export interface PredictionClosedEvent {
5
+ subject: Subjects.PredictionClosed;
6
+ data: {
7
+ id: string;
8
+ tenant: Tenant;
9
+ category: PoliticaBetCategory;
10
+ title: string;
11
+ closedAt: Date;
12
+ closedBy: string | null;
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ import { Tenant } from 'src/types/tenant';
2
+ import { Subjects } from '../subjects';
3
+ import { PoliticaBetCategory } from 'src/types/politicaBetCategory';
4
+ import { PoliticaBetTags } from 'src/services/TenantDataService';
5
+ import { PredictionStatus } from 'src/types/predictionStatus';
6
+ export interface PredictionCreatedEvent {
7
+ subject: Subjects.PredictionCreated;
8
+ data: {
9
+ id: string;
10
+ tenant: Tenant;
11
+ category: PoliticaBetCategory;
12
+ title: string;
13
+ description: string;
14
+ imageUrl: string | null;
15
+ tags: PoliticaBetTags[];
16
+ status: PredictionStatus;
17
+ closeDate: Date;
18
+ feePercentage: number;
19
+ minBetAmount: number;
20
+ maxBetAmount: number;
21
+ createdBy: string;
22
+ options: Array<{
23
+ id: string;
24
+ name: string;
25
+ poolVirtualYes: number;
26
+ poolVirtualNo: number;
27
+ }>;
28
+ };
29
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ import { Tenant } from 'src/types/tenant';
2
+ import { Subjects } from '../subjects';
3
+ import { PoliticaBetCategory } from 'src/types/politicaBetCategory';
4
+ export interface PredictionResolvedEvent {
5
+ subject: Subjects.PredictionResolved;
6
+ data: {
7
+ id: string;
8
+ tenant: Tenant;
9
+ category: PoliticaBetCategory;
10
+ title: string;
11
+ resolvedAt: Date;
12
+ resolvedBy: string;
13
+ resolutionNotes?: string;
14
+ optionsResults: Array<{
15
+ optionId: string;
16
+ optionName: string;
17
+ result: 'yes' | 'no';
18
+ }>;
19
+ };
20
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import { Tenant } from 'src/types/tenant';
2
+ import { Subjects } from '../subjects';
3
+ import { PoliticaBetTags } from 'src/services/TenantDataService';
4
+ export interface PredictionUpdatedEvent {
5
+ subject: Subjects.PredictionUpdated;
6
+ data: {
7
+ id: string;
8
+ tenant: Tenant;
9
+ title?: string;
10
+ description?: string;
11
+ imageUrl?: string | null;
12
+ tags?: PoliticaBetTags[];
13
+ closeDate?: Date;
14
+ updatedBy: string;
15
+ };
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { Tenant } from 'src/types/tenant';
2
+ import { Subjects } from '../subjects';
3
+ export interface SuggestionApprovedEvent {
4
+ subject: Subjects.SuggestionApproved;
5
+ data: {
6
+ suggestionId: string;
7
+ predictionId: string;
8
+ tenant: Tenant;
9
+ userId: string;
10
+ approvedBy: string;
11
+ adminNotes?: string;
12
+ };
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { Tenant } from 'src/types/tenant';
2
+ import { Subjects } from '../subjects';
3
+ import { PoliticaBetCategory } from 'src/types/politicaBetCategory';
4
+ export interface SuggestionCreatedEvent {
5
+ subject: Subjects.SuggestionCreated;
6
+ data: {
7
+ id: string;
8
+ tenant: Tenant;
9
+ userId: string;
10
+ userNickName: string;
11
+ category: PoliticaBetCategory;
12
+ title: string;
13
+ description: string;
14
+ };
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { Tenant } from 'src/types/tenant';
2
+ import { Subjects } from '../subjects';
3
+ export interface SuggestionRejectedEvent {
4
+ subject: Subjects.SuggestionRejected;
5
+ data: {
6
+ suggestionId: string;
7
+ tenant: Tenant;
8
+ userId: string;
9
+ rejectedBy: string;
10
+ reason?: string;
11
+ };
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -30,5 +30,15 @@ export declare enum Subjects {
30
30
  SubscriptionCreated = "SubscriptionCreated",
31
31
  SubscriptionUpdated = "SubscriptionUpdated",
32
32
  SubscriptionCancelled = "SubscriptionCancelled",
33
- GiftSent = "GiftSent"
33
+ GiftSent = "GiftSent",
34
+ PredictionCreated = "PredictionCreated",
35
+ PredictionCancelled = "PredictionCancelled",
36
+ SuggestionCreated = "SuggestionCreated",
37
+ SuggestionRejected = "SuggestionRejected",
38
+ DisputeCreated = "DisputeCreated",
39
+ DisputeResolved = "DisputeResolved",
40
+ SuggestionApproved = "SuggestionApproved",
41
+ PredictionUpdated = "PredictionUpdated",
42
+ PredictionClosed = "PredictionClosed",
43
+ PredictionResolved = "PredictionResolved"
34
44
  }
@@ -36,4 +36,15 @@ var Subjects;
36
36
  Subjects["SubscriptionUpdated"] = "SubscriptionUpdated";
37
37
  Subjects["SubscriptionCancelled"] = "SubscriptionCancelled";
38
38
  Subjects["GiftSent"] = "GiftSent";
39
+ // politicabet
40
+ Subjects["PredictionCreated"] = "PredictionCreated";
41
+ Subjects["PredictionCancelled"] = "PredictionCancelled";
42
+ Subjects["SuggestionCreated"] = "SuggestionCreated";
43
+ Subjects["SuggestionRejected"] = "SuggestionRejected";
44
+ Subjects["DisputeCreated"] = "DisputeCreated";
45
+ Subjects["DisputeResolved"] = "DisputeResolved";
46
+ Subjects["SuggestionApproved"] = "SuggestionApproved";
47
+ Subjects["PredictionUpdated"] = "PredictionUpdated";
48
+ Subjects["PredictionClosed"] = "PredictionClosed";
49
+ Subjects["PredictionResolved"] = "PredictionResolved";
39
50
  })(Subjects || (exports.Subjects = Subjects = {}));
package/build/index.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  export * from './types/marketStatus';
2
2
  export * from './types/callFinishReason';
3
- export * from './types/predictionStatus';
4
3
  export * from './types/transactionOperation';
5
4
  export * from './types/transactionOperationMode';
6
5
  export * from './types/transactionStatus';
7
6
  export * from './types/country';
8
7
  export * from './types/userRole';
9
8
  export * from './types/oddType';
10
- export * from './types/predictions';
11
9
  export * from './types/userPayload';
12
10
  export * from './types/userProvider';
13
11
  export * from './types/bankAccountType';
@@ -29,6 +27,10 @@ export * from './types/subscriptionPlan';
29
27
  export * from './types/giftType';
30
28
  export * from './types/paymentProviderType';
31
29
  export * from './types/endLiveReason';
30
+ export * from './types/politicaBetCategory';
31
+ export * from './types/predictionStatus';
32
+ export * from './types/disputeStatus';
33
+ export * from './types/suggestionStatus';
32
34
  export * from './events/subjects';
33
35
  export * from './services/TenantDataService';
34
36
  export * from './services/CurrencyService';
package/build/index.js CHANGED
@@ -16,14 +16,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./types/marketStatus"), exports);
18
18
  __exportStar(require("./types/callFinishReason"), exports);
19
- __exportStar(require("./types/predictionStatus"), exports);
20
19
  __exportStar(require("./types/transactionOperation"), exports);
21
20
  __exportStar(require("./types/transactionOperationMode"), exports);
22
21
  __exportStar(require("./types/transactionStatus"), exports);
23
22
  __exportStar(require("./types/country"), exports);
24
23
  __exportStar(require("./types/userRole"), exports);
25
24
  __exportStar(require("./types/oddType"), exports);
26
- __exportStar(require("./types/predictions"), exports);
27
25
  __exportStar(require("./types/userPayload"), exports);
28
26
  __exportStar(require("./types/userProvider"), exports);
29
27
  __exportStar(require("./types/bankAccountType"), exports);
@@ -45,6 +43,11 @@ __exportStar(require("./types/subscriptionPlan"), exports);
45
43
  __exportStar(require("./types/giftType"), exports);
46
44
  __exportStar(require("./types/paymentProviderType"), exports);
47
45
  __exportStar(require("./types/endLiveReason"), exports);
46
+ // politicabet
47
+ __exportStar(require("./types/politicaBetCategory"), exports);
48
+ __exportStar(require("./types/predictionStatus"), exports);
49
+ __exportStar(require("./types/disputeStatus"), exports);
50
+ __exportStar(require("./types/suggestionStatus"), exports);
48
51
  __exportStar(require("./events/subjects"), exports);
49
52
  __exportStar(require("./services/TenantDataService"), exports);
50
53
  __exportStar(require("./services/CurrencyService"), exports);
@@ -4,8 +4,68 @@ import { UserCategory } from '../types/userCategory';
4
4
  import { UserTags } from '../types/userTags';
5
5
  import { ProductTypes } from '../types/productTypes';
6
6
  import { MediaConfiguration } from '../storage/interfaces/MediaConfiguration';
7
+ export declare enum PoliticaBetMarket {
8
+ Politics = "Politics",
9
+ Sports = "Sports",
10
+ Crypto = "Crypto",
11
+ PopCulture = "PopCulture",
12
+ Business = "Business",
13
+ Science = "Science",
14
+ Weather = "Weather",
15
+ Entertainment = "Entertainment"
16
+ }
17
+ export declare enum PoliticaBetTags {
18
+ Brazil = "Brazil",
19
+ USA = "USA",
20
+ Europe = "Europe",
21
+ Asia = "Asia",
22
+ LatinAmerica = "LatinAmerica",
23
+ MiddleEast = "MiddleEast",
24
+ Africa = "Africa",
25
+ Elections = "Elections",
26
+ Government = "Government",
27
+ InternationalRelations = "InternationalRelations",
28
+ Legislation = "Legislation",
29
+ Football = "Football",
30
+ Basketball = "Basketball",
31
+ Tennis = "Tennis",
32
+ Fighting = "Fighting",
33
+ Olympics = "Olympics",
34
+ Bitcoin = "Bitcoin",
35
+ Ethereum = "Ethereum",
36
+ Altcoins = "Altcoins",
37
+ DeFi = "DeFi",
38
+ NFT = "NFT",
39
+ Movies = "Movies",
40
+ Music = "Music",
41
+ TVShows = "TVShows",
42
+ Awards = "Awards",
43
+ Celebrities = "Celebrities",
44
+ StockMarket = "StockMarket",
45
+ Economy = "Economy",
46
+ Companies = "Companies",
47
+ Startups = "Startups",
48
+ Technology = "Technology",
49
+ Space = "Space",
50
+ Medicine = "Medicine",
51
+ Climate = "Climate",
52
+ Temperature = "Temperature",
53
+ Precipitation = "Precipitation",
54
+ NaturalDisasters = "NaturalDisasters",
55
+ Gaming = "Gaming",
56
+ Streaming = "Streaming",
57
+ SocialMedia = "SocialMedia"
58
+ }
59
+ export declare const POLITICABET_POLITICS_TAGS: PoliticaBetTags[];
60
+ export declare const POLITICABET_SPORTS_TAGS: PoliticaBetTags[];
61
+ export declare const POLITICABET_CRYPTO_TAGS: PoliticaBetTags[];
62
+ export declare const POLITICABET_POPCULTURE_TAGS: PoliticaBetTags[];
63
+ export declare const POLITICABET_BUSINESS_TAGS: PoliticaBetTags[];
64
+ export declare const POLITICABET_SCIENCE_TAGS: PoliticaBetTags[];
65
+ export declare const POLITICABET_WEATHER_TAGS: PoliticaBetTags[];
66
+ export declare const POLITICABET_ENTERTAINMENT_TAGS: PoliticaBetTags[];
7
67
  export interface CategoryConfiguration {
8
- allowedTags: UserTags[];
68
+ allowedTags: UserTags[] | PoliticaBetTags[];
9
69
  allowedProducts: ProductTypes[];
10
70
  }
11
71
  export interface RatingCriteria {
@@ -23,7 +83,7 @@ export interface TenantData {
23
83
  SOCIAL_YOUTUBE: string;
24
84
  SOCIAL_INSTAGRAM: string;
25
85
  SOCIAL_FACEBOOK: string;
26
- USER_CATEGORIES_CONFIG: Partial<Record<UserCategory, CategoryConfiguration>>;
86
+ USER_CATEGORIES_CONFIG: Partial<Record<UserCategory | PoliticaBetMarket, CategoryConfiguration>>;
27
87
  COUPONS_TYPE_ALLOWED_TO_BE_CREATED_BY_SELLER: CouponType[];
28
88
  COUPONS_TYPE_ALLOWED_TO_BE_CREATED_BY_ADMIN: CouponType[];
29
89
  EMAIL_HOST: string;
@@ -40,14 +100,19 @@ export interface TenantData {
40
100
  export declare class TenantDataService {
41
101
  private static tenantDataMap;
42
102
  static getTenantData(tenant: Tenant): TenantData;
43
- static getCategoriesForTenant(tenant: Tenant): UserCategory[];
44
- static getCategoryConfig(tenant: Tenant, category: UserCategory): CategoryConfiguration | undefined;
45
- static isTagAllowedForCategory(tenant: Tenant, category: UserCategory, tag: UserTags): boolean;
46
- static isProductAllowedForCategory(tenant: Tenant, category: UserCategory, product: ProductTypes): boolean;
47
- static getTagsForCategory(tenant: Tenant, category: UserCategory): UserTags[];
48
- static getProductsForCategory(tenant: Tenant, category: UserCategory): ProductTypes[];
103
+ static getCategoriesForTenant(tenant: Tenant): (UserCategory | PoliticaBetMarket)[];
104
+ static getCategoryConfig(tenant: Tenant, category: UserCategory | PoliticaBetMarket): CategoryConfiguration | undefined;
105
+ static isTagAllowedForCategory(tenant: Tenant, category: UserCategory | PoliticaBetMarket, tag: UserTags | PoliticaBetTags): boolean;
106
+ static isProductAllowedForCategory(tenant: Tenant, category: UserCategory | PoliticaBetMarket, product: ProductTypes): boolean;
107
+ static getTagsForCategory(tenant: Tenant, category: UserCategory | PoliticaBetMarket): (UserTags | PoliticaBetTags)[];
108
+ static getProductsForCategory(tenant: Tenant, category: UserCategory | PoliticaBetMarket): ProductTypes[];
49
109
  static getAllProductsForTenant(tenant: Tenant): ProductTypes[];
50
- static getAllTagsForTenant(tenant: Tenant): UserTags[];
110
+ static getAllTagsForTenant(tenant: Tenant): (UserTags | PoliticaBetTags)[];
111
+ static getPoliticaBetMarkets(): PoliticaBetMarket[];
112
+ static isPoliticaBetMarket(category: string): category is PoliticaBetMarket;
113
+ static getPoliticaBetTagsForMarket(market: PoliticaBetMarket): PoliticaBetTags[];
114
+ static getAllPoliticaBetTags(): PoliticaBetTags[];
115
+ static getMarketsForTag(tag: PoliticaBetTags): PoliticaBetMarket[];
51
116
  static getRatingCriteria(tenant: Tenant): RatingCriteria | null;
52
117
  static getAvailableCriteriaOptions(tenant: Tenant): string[];
53
118
  static isRatingEnabledForTenant(tenant: Tenant): boolean;
@@ -1,13 +1,158 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TenantDataService = void 0;
3
+ exports.TenantDataService = exports.POLITICABET_ENTERTAINMENT_TAGS = exports.POLITICABET_WEATHER_TAGS = exports.POLITICABET_SCIENCE_TAGS = exports.POLITICABET_BUSINESS_TAGS = exports.POLITICABET_POPCULTURE_TAGS = exports.POLITICABET_CRYPTO_TAGS = exports.POLITICABET_SPORTS_TAGS = exports.POLITICABET_POLITICS_TAGS = exports.PoliticaBetTags = exports.PoliticaBetMarket = void 0;
4
4
  const couponType_1 = require("../types/couponType");
5
5
  const tenant_1 = require("../types/tenant");
6
6
  const userCategory_1 = require("../types/userCategory");
7
7
  const userTags_1 = require("../types/userTags");
8
8
  const productTypes_1 = require("../types/productTypes");
9
+ // ============================================
10
+ // POLITICABET - MARKETS E TAGS
11
+ // ============================================
12
+ // Markets (Categorias) do PoliticaBet
13
+ var PoliticaBetMarket;
14
+ (function (PoliticaBetMarket) {
15
+ PoliticaBetMarket["Politics"] = "Politics";
16
+ PoliticaBetMarket["Sports"] = "Sports";
17
+ PoliticaBetMarket["Crypto"] = "Crypto";
18
+ PoliticaBetMarket["PopCulture"] = "PopCulture";
19
+ PoliticaBetMarket["Business"] = "Business";
20
+ PoliticaBetMarket["Science"] = "Science";
21
+ PoliticaBetMarket["Weather"] = "Weather";
22
+ PoliticaBetMarket["Entertainment"] = "Entertainment";
23
+ })(PoliticaBetMarket || (exports.PoliticaBetMarket = PoliticaBetMarket = {}));
24
+ // Tags compartilhadas entre markets
25
+ var PoliticaBetTags;
26
+ (function (PoliticaBetTags) {
27
+ // Regiões Geográficas (podem ser usadas em vários markets)
28
+ PoliticaBetTags["Brazil"] = "Brazil";
29
+ PoliticaBetTags["USA"] = "USA";
30
+ PoliticaBetTags["Europe"] = "Europe";
31
+ PoliticaBetTags["Asia"] = "Asia";
32
+ PoliticaBetTags["LatinAmerica"] = "LatinAmerica";
33
+ PoliticaBetTags["MiddleEast"] = "MiddleEast";
34
+ PoliticaBetTags["Africa"] = "Africa";
35
+ // Política
36
+ PoliticaBetTags["Elections"] = "Elections";
37
+ PoliticaBetTags["Government"] = "Government";
38
+ PoliticaBetTags["InternationalRelations"] = "InternationalRelations";
39
+ PoliticaBetTags["Legislation"] = "Legislation";
40
+ // Esportes
41
+ PoliticaBetTags["Football"] = "Football";
42
+ PoliticaBetTags["Basketball"] = "Basketball";
43
+ PoliticaBetTags["Tennis"] = "Tennis";
44
+ PoliticaBetTags["Fighting"] = "Fighting";
45
+ PoliticaBetTags["Olympics"] = "Olympics";
46
+ // Cripto
47
+ PoliticaBetTags["Bitcoin"] = "Bitcoin";
48
+ PoliticaBetTags["Ethereum"] = "Ethereum";
49
+ PoliticaBetTags["Altcoins"] = "Altcoins";
50
+ PoliticaBetTags["DeFi"] = "DeFi";
51
+ PoliticaBetTags["NFT"] = "NFT";
52
+ // Pop Culture
53
+ PoliticaBetTags["Movies"] = "Movies";
54
+ PoliticaBetTags["Music"] = "Music";
55
+ PoliticaBetTags["TVShows"] = "TVShows";
56
+ PoliticaBetTags["Awards"] = "Awards";
57
+ PoliticaBetTags["Celebrities"] = "Celebrities";
58
+ // Business
59
+ PoliticaBetTags["StockMarket"] = "StockMarket";
60
+ PoliticaBetTags["Economy"] = "Economy";
61
+ PoliticaBetTags["Companies"] = "Companies";
62
+ PoliticaBetTags["Startups"] = "Startups";
63
+ // Science
64
+ PoliticaBetTags["Technology"] = "Technology";
65
+ PoliticaBetTags["Space"] = "Space";
66
+ PoliticaBetTags["Medicine"] = "Medicine";
67
+ PoliticaBetTags["Climate"] = "Climate";
68
+ // Weather
69
+ PoliticaBetTags["Temperature"] = "Temperature";
70
+ PoliticaBetTags["Precipitation"] = "Precipitation";
71
+ PoliticaBetTags["NaturalDisasters"] = "NaturalDisasters";
72
+ // Entertainment
73
+ PoliticaBetTags["Gaming"] = "Gaming";
74
+ PoliticaBetTags["Streaming"] = "Streaming";
75
+ PoliticaBetTags["SocialMedia"] = "SocialMedia";
76
+ })(PoliticaBetTags || (exports.PoliticaBetTags = PoliticaBetTags = {}));
77
+ // Mapeamento de tags permitidas por Market
78
+ exports.POLITICABET_POLITICS_TAGS = [
79
+ PoliticaBetTags.Brazil,
80
+ PoliticaBetTags.USA,
81
+ PoliticaBetTags.Europe,
82
+ PoliticaBetTags.Asia,
83
+ PoliticaBetTags.LatinAmerica,
84
+ PoliticaBetTags.MiddleEast,
85
+ PoliticaBetTags.Africa,
86
+ PoliticaBetTags.Elections,
87
+ PoliticaBetTags.Government,
88
+ PoliticaBetTags.InternationalRelations,
89
+ PoliticaBetTags.Legislation
90
+ ];
91
+ exports.POLITICABET_SPORTS_TAGS = [
92
+ PoliticaBetTags.Brazil,
93
+ PoliticaBetTags.USA,
94
+ PoliticaBetTags.Europe,
95
+ PoliticaBetTags.Asia,
96
+ PoliticaBetTags.LatinAmerica,
97
+ PoliticaBetTags.Football,
98
+ PoliticaBetTags.Basketball,
99
+ PoliticaBetTags.Tennis,
100
+ PoliticaBetTags.Fighting,
101
+ PoliticaBetTags.Olympics
102
+ ];
103
+ exports.POLITICABET_CRYPTO_TAGS = [
104
+ PoliticaBetTags.Bitcoin,
105
+ PoliticaBetTags.Ethereum,
106
+ PoliticaBetTags.Altcoins,
107
+ PoliticaBetTags.DeFi,
108
+ PoliticaBetTags.NFT,
109
+ PoliticaBetTags.Technology
110
+ ];
111
+ exports.POLITICABET_POPCULTURE_TAGS = [
112
+ PoliticaBetTags.Brazil,
113
+ PoliticaBetTags.USA,
114
+ PoliticaBetTags.Movies,
115
+ PoliticaBetTags.Music,
116
+ PoliticaBetTags.TVShows,
117
+ PoliticaBetTags.Awards,
118
+ PoliticaBetTags.Celebrities
119
+ ];
120
+ exports.POLITICABET_BUSINESS_TAGS = [
121
+ PoliticaBetTags.Brazil,
122
+ PoliticaBetTags.USA,
123
+ PoliticaBetTags.Europe,
124
+ PoliticaBetTags.Asia,
125
+ PoliticaBetTags.LatinAmerica,
126
+ PoliticaBetTags.StockMarket,
127
+ PoliticaBetTags.Economy,
128
+ PoliticaBetTags.Companies,
129
+ PoliticaBetTags.Startups
130
+ ];
131
+ exports.POLITICABET_SCIENCE_TAGS = [
132
+ PoliticaBetTags.Technology,
133
+ PoliticaBetTags.Space,
134
+ PoliticaBetTags.Medicine,
135
+ PoliticaBetTags.Climate
136
+ ];
137
+ exports.POLITICABET_WEATHER_TAGS = [
138
+ PoliticaBetTags.Brazil,
139
+ PoliticaBetTags.USA,
140
+ PoliticaBetTags.Europe,
141
+ PoliticaBetTags.Temperature,
142
+ PoliticaBetTags.Precipitation,
143
+ PoliticaBetTags.NaturalDisasters,
144
+ PoliticaBetTags.Climate
145
+ ];
146
+ exports.POLITICABET_ENTERTAINMENT_TAGS = [
147
+ PoliticaBetTags.Gaming,
148
+ PoliticaBetTags.Streaming,
149
+ PoliticaBetTags.SocialMedia,
150
+ PoliticaBetTags.Celebrities
151
+ ];
9
152
  class TenantDataService {
10
- // Métodos existentes
153
+ // ============================================
154
+ // MÉTODOS GERAIS
155
+ // ============================================
11
156
  static getTenantData(tenant) {
12
157
  const data = this.tenantDataMap[tenant];
13
158
  if (!data) {
@@ -15,7 +160,6 @@ class TenantDataService {
15
160
  }
16
161
  return data;
17
162
  }
18
- // Novos métodos utilitários
19
163
  static getCategoriesForTenant(tenant) {
20
164
  const data = this.getTenantData(tenant);
21
165
  return Object.keys(data.USER_CATEGORIES_CONFIG);
@@ -26,7 +170,9 @@ class TenantDataService {
26
170
  }
27
171
  static isTagAllowedForCategory(tenant, category, tag) {
28
172
  const config = this.getCategoryConfig(tenant, category);
29
- return config ? config.allowedTags.includes(tag) : false;
173
+ if (!config)
174
+ return false;
175
+ return config.allowedTags.includes(tag);
30
176
  }
31
177
  static isProductAllowedForCategory(tenant, category, product) {
32
178
  const config = this.getCategoryConfig(tenant, category);
@@ -40,7 +186,6 @@ class TenantDataService {
40
186
  const config = this.getCategoryConfig(tenant, category);
41
187
  return config ? config.allowedProducts : [];
42
188
  }
43
- // Obtém todos os produtos únicos disponíveis em um tenant
44
189
  static getAllProductsForTenant(tenant) {
45
190
  const data = this.getTenantData(tenant);
46
191
  const allProducts = new Set();
@@ -49,7 +194,6 @@ class TenantDataService {
49
194
  });
50
195
  return Array.from(allProducts);
51
196
  }
52
- // Obtém todas as tags únicas disponíveis em um tenant
53
197
  static getAllTagsForTenant(tenant) {
54
198
  const data = this.getTenantData(tenant);
55
199
  const allTags = new Set();
@@ -58,6 +202,44 @@ class TenantDataService {
58
202
  });
59
203
  return Array.from(allTags);
60
204
  }
205
+ // ============================================
206
+ // MÉTODOS ESPECÍFICOS POLITICABET
207
+ // ============================================
208
+ static getPoliticaBetMarkets() {
209
+ return Object.values(PoliticaBetMarket);
210
+ }
211
+ static isPoliticaBetMarket(category) {
212
+ return Object.values(PoliticaBetMarket).includes(category);
213
+ }
214
+ static getPoliticaBetTagsForMarket(market) {
215
+ const tagMap = {
216
+ [PoliticaBetMarket.Politics]: exports.POLITICABET_POLITICS_TAGS,
217
+ [PoliticaBetMarket.Sports]: exports.POLITICABET_SPORTS_TAGS,
218
+ [PoliticaBetMarket.Crypto]: exports.POLITICABET_CRYPTO_TAGS,
219
+ [PoliticaBetMarket.PopCulture]: exports.POLITICABET_POPCULTURE_TAGS,
220
+ [PoliticaBetMarket.Business]: exports.POLITICABET_BUSINESS_TAGS,
221
+ [PoliticaBetMarket.Science]: exports.POLITICABET_SCIENCE_TAGS,
222
+ [PoliticaBetMarket.Weather]: exports.POLITICABET_WEATHER_TAGS,
223
+ [PoliticaBetMarket.Entertainment]: exports.POLITICABET_ENTERTAINMENT_TAGS
224
+ };
225
+ return tagMap[market];
226
+ }
227
+ static getAllPoliticaBetTags() {
228
+ return Object.values(PoliticaBetTags);
229
+ }
230
+ static getMarketsForTag(tag) {
231
+ const markets = [];
232
+ Object.values(PoliticaBetMarket).forEach(market => {
233
+ const tags = this.getPoliticaBetTagsForMarket(market);
234
+ if (tags.includes(tag)) {
235
+ markets.push(market);
236
+ }
237
+ });
238
+ return markets;
239
+ }
240
+ // ============================================
241
+ // MÉTODOS DE RATING
242
+ // ============================================
61
243
  static getRatingCriteria(tenant) {
62
244
  const data = this.getTenantData(tenant);
63
245
  return data.RATING_CRITERIA || null;
@@ -71,7 +253,6 @@ class TenantDataService {
71
253
  }
72
254
  static validateRatingCriteria(tenant, criteria) {
73
255
  const config = this.getRatingCriteria(tenant);
74
- // Se não há configuração de rating para este tenant
75
256
  if (!config) {
76
257
  return {
77
258
  isValid: false,
@@ -80,14 +261,12 @@ class TenantDataService {
80
261
  }
81
262
  const errors = [];
82
263
  const criteriaKeys = Object.keys(criteria);
83
- // Validar quantidade
84
264
  if (criteriaKeys.length < config.minCriteriaCount) {
85
265
  errors.push(`Mínimo ${config.minCriteriaCount} critérios necessários`);
86
266
  }
87
267
  if (criteriaKeys.length > config.maxCriteriaCount) {
88
268
  errors.push(`Máximo ${config.maxCriteriaCount} critérios permitidos`);
89
269
  }
90
- // Validar critérios permitidos
91
270
  const invalidCriteria = criteriaKeys.filter(key => !config.criteriaOptions.includes(key));
92
271
  if (invalidCriteria.length > 0) {
93
272
  errors.push(`Critérios inválidos: ${invalidCriteria.join(', ')}`);
@@ -102,16 +281,55 @@ exports.TenantDataService = TenantDataService;
102
281
  TenantDataService.tenantDataMap = {
103
282
  [tenant_1.Tenant.PoliticaBet]: {
104
283
  TENANT: tenant_1.Tenant.PoliticaBet,
105
- SITE_NAME: 'Bet',
106
- SITE_URL: 'https://criptobet.dev',
107
- SITE_DESCRIPTION: 'Site de previsões políticas!!',
108
- KEYWORDS: ['apostas', 'política', 'previsões', 'geopolítica'],
109
- SOCIAL_X: 'https://x.com',
110
- SOCIAL_YOUTUBE: 'https://youtube.com',
111
- SOCIAL_INSTAGRAM: 'https://instagram.com',
112
- SOCIAL_FACEBOOK: 'https://facebook.com',
284
+ SITE_NAME: 'PoliticaBet',
285
+ SITE_URL: 'https://politicabet.com',
286
+ SITE_DESCRIPTION: 'Mercado de predições sobre política, esportes, cripto e muito mais!',
287
+ KEYWORDS: [
288
+ 'apostas',
289
+ 'política',
290
+ 'previsões',
291
+ 'geopolítica',
292
+ 'esportes',
293
+ 'cripto',
294
+ 'eventos'
295
+ ],
296
+ SOCIAL_X: 'https://x.com/politicabet',
297
+ SOCIAL_YOUTUBE: 'https://youtube.com/politicabet',
298
+ SOCIAL_INSTAGRAM: 'https://instagram.com/politicabet',
299
+ SOCIAL_FACEBOOK: 'https://facebook.com/politicabet',
113
300
  USER_CATEGORIES_CONFIG: {
114
- // Defina aqui as categorias específicas para PoliticaBet se houver
301
+ [PoliticaBetMarket.Politics]: {
302
+ allowedTags: exports.POLITICABET_POLITICS_TAGS,
303
+ allowedProducts: [] // Sem produtos físicos, apenas predictions
304
+ },
305
+ [PoliticaBetMarket.Sports]: {
306
+ allowedTags: exports.POLITICABET_SPORTS_TAGS,
307
+ allowedProducts: []
308
+ },
309
+ [PoliticaBetMarket.Crypto]: {
310
+ allowedTags: exports.POLITICABET_CRYPTO_TAGS,
311
+ allowedProducts: []
312
+ },
313
+ [PoliticaBetMarket.PopCulture]: {
314
+ allowedTags: exports.POLITICABET_POPCULTURE_TAGS,
315
+ allowedProducts: []
316
+ },
317
+ [PoliticaBetMarket.Business]: {
318
+ allowedTags: exports.POLITICABET_BUSINESS_TAGS,
319
+ allowedProducts: []
320
+ },
321
+ [PoliticaBetMarket.Science]: {
322
+ allowedTags: exports.POLITICABET_SCIENCE_TAGS,
323
+ allowedProducts: []
324
+ },
325
+ [PoliticaBetMarket.Weather]: {
326
+ allowedTags: exports.POLITICABET_WEATHER_TAGS,
327
+ allowedProducts: []
328
+ },
329
+ [PoliticaBetMarket.Entertainment]: {
330
+ allowedTags: exports.POLITICABET_ENTERTAINMENT_TAGS,
331
+ allowedProducts: []
332
+ }
115
333
  },
116
334
  COUPONS_TYPE_ALLOWED_TO_BE_CREATED_BY_SELLER: [],
117
335
  COUPONS_TYPE_ALLOWED_TO_BE_CREATED_BY_ADMIN: [
@@ -120,14 +338,14 @@ TenantDataService.tenantDataMap = {
120
338
  ],
121
339
  EMAIL_HOST: 'smtp.gmail.com',
122
340
  EMAIL_PORT: '587',
123
- EMAIL_USER: 'privateshowbr@gmail.com',
124
- AUTH_FACEBOOK_APP_ID: '702257899370-o4qa3kvuqpgls58lkqdn5s9u3mhdjfme.apps.googleusercontent.com',
125
- AUTH_GOOGLE_ID: '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',
341
+ EMAIL_USER: 'contato@politicabet.com',
342
+ AUTH_FACEBOOK_APP_ID: '',
343
+ AUTH_GOOGLE_ID: '',
126
344
  AUTH_GOOGLE_SECRET: '',
127
345
  GOOGLE_ANALYTICS_MEASUREMENT_ID: '',
128
- GOOGLE_VERIFICATION: 'MxMj1CaliRbJ6G7cp0eIYXug0QF6hyugQ1P74T6sCzc',
346
+ GOOGLE_VERIFICATION: '',
129
347
  MEDIA_CONFIG: {
130
- maxPhotoSizeMB: 3,
348
+ maxPhotoSizeMB: 5,
131
349
  maxVideoSizeMB: 50,
132
350
  allowedImageFormats: ['jpg', 'jpeg', 'png', 'webp'],
133
351
  allowedVideoFormats: ['mp4', 'webm', 'mov'],
@@ -0,0 +1,5 @@
1
+ export declare enum DisputeStatus {
2
+ Open = "Open",
3
+ Reviewing = "Reviewing",
4
+ Resolved = "Resolved"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DisputeStatus = void 0;
4
+ var DisputeStatus;
5
+ (function (DisputeStatus) {
6
+ DisputeStatus["Open"] = "Open";
7
+ DisputeStatus["Reviewing"] = "Reviewing";
8
+ DisputeStatus["Resolved"] = "Resolved";
9
+ })(DisputeStatus || (exports.DisputeStatus = DisputeStatus = {}));
@@ -0,0 +1,10 @@
1
+ export declare enum PoliticaBetCategory {
2
+ Politics = "Politics",
3
+ Sports = "Sports",
4
+ Crypto = "Crypto",
5
+ PopCulture = "PopCulture",
6
+ Business = "Business",
7
+ Science = "Science",
8
+ Weather = "Weather",
9
+ Entertainment = "Entertainment"
10
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PoliticaBetCategory = void 0;
4
+ var PoliticaBetCategory;
5
+ (function (PoliticaBetCategory) {
6
+ PoliticaBetCategory["Politics"] = "Politics";
7
+ PoliticaBetCategory["Sports"] = "Sports";
8
+ PoliticaBetCategory["Crypto"] = "Crypto";
9
+ PoliticaBetCategory["PopCulture"] = "PopCulture";
10
+ PoliticaBetCategory["Business"] = "Business";
11
+ PoliticaBetCategory["Science"] = "Science";
12
+ PoliticaBetCategory["Weather"] = "Weather";
13
+ PoliticaBetCategory["Entertainment"] = "Entertainment";
14
+ })(PoliticaBetCategory || (exports.PoliticaBetCategory = PoliticaBetCategory = {}));
@@ -1,7 +1,24 @@
1
+ /**
2
+ * Status possíveis de uma Prediction no ciclo de vida
3
+ */
1
4
  export declare enum PredictionStatus {
2
- Created = "created",
3
- Started = "started",
4
- Paused = "paused",
5
- Finished = "finished",
6
- PaymentProcessed = "payment:processed"
5
+ Draft = "Draft",// Em criação, não visível publicamente
6
+ Open = "Open",// Aberta para apostas
7
+ Closed = "Closed",// Fechada, aguardando resolução
8
+ InDispute = "InDispute",// Em período de disputa (24h)
9
+ Resolved = "Resolved",// Resolvida, prêmios distribuídos
10
+ Cancelled = "Cancelled"
7
11
  }
12
+ /**
13
+ * Transições válidas de status
14
+ * Define quais mudanças de status são permitidas
15
+ */
16
+ export declare const VALID_STATUS_TRANSITIONS: Record<PredictionStatus, PredictionStatus[]>;
17
+ /**
18
+ * Verifica se uma transição de status é válida
19
+ */
20
+ export declare function isValidStatusTransition(currentStatus: PredictionStatus, newStatus: PredictionStatus): boolean;
21
+ /**
22
+ * Retorna erro descritivo caso transição seja inválida
23
+ */
24
+ export declare function getStatusTransitionError(currentStatus: PredictionStatus, newStatus: PredictionStatus): string | null;
@@ -1,11 +1,56 @@
1
1
  "use strict";
2
+ // cb-common/types/predictionStatus.ts
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PredictionStatus = void 0;
4
+ exports.VALID_STATUS_TRANSITIONS = exports.PredictionStatus = void 0;
5
+ exports.isValidStatusTransition = isValidStatusTransition;
6
+ exports.getStatusTransitionError = getStatusTransitionError;
7
+ /**
8
+ * Status possíveis de uma Prediction no ciclo de vida
9
+ */
4
10
  var PredictionStatus;
5
11
  (function (PredictionStatus) {
6
- PredictionStatus["Created"] = "created";
7
- PredictionStatus["Started"] = "started";
8
- PredictionStatus["Paused"] = "paused";
9
- PredictionStatus["Finished"] = "finished";
10
- PredictionStatus["PaymentProcessed"] = "payment:processed";
12
+ PredictionStatus["Draft"] = "Draft";
13
+ PredictionStatus["Open"] = "Open";
14
+ PredictionStatus["Closed"] = "Closed";
15
+ PredictionStatus["InDispute"] = "InDispute";
16
+ PredictionStatus["Resolved"] = "Resolved";
17
+ PredictionStatus["Cancelled"] = "Cancelled"; // Cancelada, apostas reembolsadas
11
18
  })(PredictionStatus || (exports.PredictionStatus = PredictionStatus = {}));
19
+ /**
20
+ * Transições válidas de status
21
+ * Define quais mudanças de status são permitidas
22
+ */
23
+ exports.VALID_STATUS_TRANSITIONS = {
24
+ [PredictionStatus.Draft]: [PredictionStatus.Open, PredictionStatus.Cancelled],
25
+ [PredictionStatus.Open]: [
26
+ PredictionStatus.Closed,
27
+ PredictionStatus.Cancelled
28
+ ],
29
+ [PredictionStatus.Closed]: [
30
+ PredictionStatus.InDispute,
31
+ PredictionStatus.Resolved,
32
+ PredictionStatus.Cancelled
33
+ ],
34
+ [PredictionStatus.InDispute]: [
35
+ PredictionStatus.Resolved,
36
+ PredictionStatus.Cancelled
37
+ ],
38
+ [PredictionStatus.Resolved]: [], // Estado final - não pode mudar
39
+ [PredictionStatus.Cancelled]: [] // Estado final - não pode mudar
40
+ };
41
+ /**
42
+ * Verifica se uma transição de status é válida
43
+ */
44
+ function isValidStatusTransition(currentStatus, newStatus) {
45
+ const allowedTransitions = exports.VALID_STATUS_TRANSITIONS[currentStatus];
46
+ return allowedTransitions.includes(newStatus);
47
+ }
48
+ /**
49
+ * Retorna erro descritivo caso transição seja inválida
50
+ */
51
+ function getStatusTransitionError(currentStatus, newStatus) {
52
+ if (isValidStatusTransition(currentStatus, newStatus)) {
53
+ return null;
54
+ }
55
+ return `Invalid status transition from ${currentStatus} to ${newStatus}`;
56
+ }
@@ -0,0 +1,5 @@
1
+ export declare enum SuggestionStatus {
2
+ Pending = "Pending",
3
+ Approved = "Approved",
4
+ Rejected = "Rejected"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SuggestionStatus = void 0;
4
+ var SuggestionStatus;
5
+ (function (SuggestionStatus) {
6
+ SuggestionStatus["Pending"] = "Pending";
7
+ SuggestionStatus["Approved"] = "Approved";
8
+ SuggestionStatus["Rejected"] = "Rejected";
9
+ })(SuggestionStatus || (exports.SuggestionStatus = SuggestionStatus = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrcb/cb-common",
3
- "version": "1.0.569",
3
+ "version": "1.0.571",
4
4
  "description": "Common resources between services",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -1,25 +0,0 @@
1
- import { Market } from './market';
2
- import { OddType } from './oddType';
3
- import { PredictionStatus } from './predictionStatus';
4
- export interface Prediction {
5
- market: Market;
6
- title: string;
7
- details: string;
8
- image: string;
9
- rules: string;
10
- slug: string;
11
- status: PredictionStatus;
12
- deadLine: Date;
13
- oddType: OddType;
14
- predictionOptions: PredictionOptions[];
15
- }
16
- export interface PredictionOptions {
17
- description: string;
18
- options: Options[];
19
- }
20
- export interface Options {
21
- optionId: string;
22
- optionLabel: string;
23
- optionWinner: boolean;
24
- optionInitialOdd: number;
25
- }