shufflecom-calculations 6.1.0 → 6.2.0

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 (29) hide show
  1. package/lib/games/{paginated-game-no-auth.d.ts → resolved-paginated-game.d.ts} +5 -4
  2. package/lib/games/{paginated-game-no-auth.js → resolved-paginated-game.js} +1 -1
  3. package/lib/games/resolved-paginated-game.js.map +1 -0
  4. package/lib/regex/index.d.ts +3 -0
  5. package/lib/regex/index.js +4 -1
  6. package/lib/regex/index.js.map +1 -1
  7. package/lib/sports/sports-bet.types.d.ts +32 -1
  8. package/lib/sports/sports-competition-fixture.types.d.ts +1 -0
  9. package/lib/sports/sports-competition-fixture.types.js.map +1 -1
  10. package/lib/sports/sports-content-home-page.types.d.ts +1 -9
  11. package/lib/sports/sports-content-home-page.types.js +1 -4
  12. package/lib/sports/sports-content-home-page.types.js.map +1 -1
  13. package/lib/sports/sports-selection.types.d.ts +0 -4
  14. package/lib/sports/sports-selection.types.js +0 -4
  15. package/lib/sports/sports-selection.types.js.map +1 -1
  16. package/lib/sports/sports.types.d.ts +18 -3
  17. package/lib/sports/sports.types.js +17 -2
  18. package/lib/sports/sports.types.js.map +1 -1
  19. package/lib/tsconfig.tsbuildinfo +1 -1
  20. package/package.json +2 -2
  21. package/src/games/{paginated-game-no-auth.ts → resolved-paginated-game.ts} +5 -4
  22. package/src/regex/index.ts +7 -0
  23. package/src/regex/regex.spec.ts +20 -0
  24. package/src/sports/sports-bet.types.ts +39 -0
  25. package/src/sports/sports-competition-fixture.types.ts +1 -0
  26. package/src/sports/sports-content-home-page.types.ts +1 -12
  27. package/src/sports/sports-selection.types.ts +0 -5
  28. package/src/sports/sports.types.ts +19 -2
  29. package/lib/games/paginated-game-no-auth.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shufflecom-calculations",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "description": "",
5
5
  "types": "lib/index.d.ts",
6
6
  "main": "lib/index.js",
@@ -16,5 +16,5 @@
16
16
  },
17
17
  "author": "",
18
18
  "license": "ISC",
19
- "gitHead": "cf8a037f371d7155f6aa0d69c936ba0e8e54d2d8"
19
+ "gitHead": "fdea251fdf77e057a786892dc8697e8b8f288eb2"
20
20
  }
@@ -48,8 +48,8 @@ export interface ResolvedGame {
48
48
  image: ResolvedGameImage | null;
49
49
  icon: ResolvedGameImage | null;
50
50
  provider: ResolvedGameProvider | null;
51
- tags: ResolvedGameTag[];
52
- gameAndGameCategories: ResolvedGameAndGameCategory[];
51
+ tags: ResolvedGameTag[] | null;
52
+ gameAndGameCategories: ResolvedGameAndGameCategory[] | null;
53
53
  originalGame: string | null;
54
54
  isFavourite: boolean;
55
55
  demoMode: boolean;
@@ -69,13 +69,14 @@ export interface ResolvedGame {
69
69
  rolloverRestricted: boolean;
70
70
  sweepStakesPlaythroughRate: number;
71
71
  gameSources?: ResolvedGameSource[];
72
- localizations?: ResolvedGameLocalization[];
72
+ localizations: ResolvedGameLocalization[] | null;
73
73
  completed?: boolean;
74
74
  tournamentId?: string;
75
75
  targetMultiplier?: number;
76
+ recentPlayAt?: Date | null;
76
77
  }
77
78
 
78
- export interface PaginatedGameNoAuth {
79
+ export interface ResolvedPaginatedGame {
79
80
  totalCount: number | null;
80
81
  nodes: ResolvedGame[];
81
82
  }
@@ -25,3 +25,10 @@ export const NO_INVISIBLE_CHAR_REGEX = /^[^\u2800\uFFA0\u115F\u1160\u3164]*$/;
25
25
  export const US_PHONE_NUMBER_REGEX = /^\+1\d{10}$/;
26
26
  // E.164 international phone number: leading +, first digit 1-9, total 7-15 digits
27
27
  export const E164_PHONE_NUMBER_REGEX = /^\+[1-9]\d{6,14}$/;
28
+ // Brazilian CPF (digits only, no formatting)
29
+ export const CPF_REGEX = /^\d{11}$/;
30
+ // Mexican CURP (18 alphanumeric chars)
31
+ export const CURP_REGEX = /^[A-Z0-9]{18}$/i;
32
+ // Argentine CUIL/CUIT: 11 digits, no formatting, leading with a valid person/entity
33
+ // prefix (20-27 individuals, 30/33/34 legal entities)
34
+ export const CUIL_CUIT_REGEX = /^(20|23|24|25|26|27|30|33|34)\d{9}$/;
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  ADDRESS_URL_REGEX,
3
+ CUIL_CUIT_REGEX,
3
4
  HEX_COLOR_CODE_REGEX,
4
5
  NO_INVISIBLE_CHAR_REGEX,
5
6
  PROMOTION_CODE_REGEX,
@@ -11,6 +12,25 @@ import {
11
12
  } from '.';
12
13
 
13
14
  describe('regex', () => {
15
+ describe('CUIL_CUIT_REGEX', () => {
16
+ it('accepts 11 digits with a valid individual or entity prefix', () => {
17
+ expect(CUIL_CUIT_REGEX.test('20123456789')).toBe(true);
18
+ expect(CUIL_CUIT_REGEX.test('27123456789')).toBe(true);
19
+ expect(CUIL_CUIT_REGEX.test('30123456789')).toBe(true);
20
+ });
21
+
22
+ it('rejects an invalid leading prefix', () => {
23
+ expect(CUIL_CUIT_REGEX.test('19123456789')).toBe(false);
24
+ expect(CUIL_CUIT_REGEX.test('28123456789')).toBe(false);
25
+ });
26
+
27
+ it('rejects wrong length or non-digits', () => {
28
+ expect(CUIL_CUIT_REGEX.test('2012345678')).toBe(false); // 10 digits
29
+ expect(CUIL_CUIT_REGEX.test('201234567890')).toBe(false); // 12 digits
30
+ expect(CUIL_CUIT_REGEX.test('20-12345678-9')).toBe(false); // formatted
31
+ });
32
+ });
33
+
14
34
  describe('PWD_REGEX', () => {
15
35
  it('should not allow passwords with less than 8 characters', () => {
16
36
  expect(PWD_REGEX.test('abcdef1')).toBe(false);
@@ -3,6 +3,7 @@ import { Currency } from '../utils/currency';
3
3
  import {
4
4
  MatchStatusParts,
5
5
  Sports,
6
+ SportsBetCashoutButtonState,
6
7
  SportsBetLegType,
7
8
  SportsBetSelectionStatus,
8
9
  SportsBetStatus,
@@ -80,6 +81,7 @@ export interface SportsBetSelectionMatchSummaryV3 {
80
81
  awayScore: string | null;
81
82
  possession: SportsMatchPhaseHomeAway | null;
82
83
  currentRound: string | null;
84
+ currentOver: string | null;
83
85
  timeRemaining: number | null;
84
86
  stoppageTime: number | null;
85
87
  stoppageTimeAnnounced: number | null;
@@ -133,11 +135,38 @@ export interface SportsBetSettlementV3 {
133
135
  createdAt: string;
134
136
  }
135
137
 
138
+ /**
139
+ * @deprecated use SportsBetCashoutInfoV3
140
+ */
136
141
  export interface SportsBetCashoutAvailableV3 {
137
142
  canCashout: boolean;
138
143
  reason: SportsCashoutFailedReason | null;
139
144
  }
140
145
 
146
+ export interface SportsBetCashoutInfoV3 {
147
+ /** Non-null exactly when playerCashoutEnabled is ENABLED. */
148
+ cashoutOddsDecimal: string | null;
149
+ playerCashoutEnabled: SportsBetCashoutButtonState;
150
+ }
151
+
152
+ export interface CashoutSportsBetPayloadV2 {
153
+ id: string; // bs58
154
+ currency: Currency;
155
+ amount: string;
156
+ status: SportsBetStatus;
157
+ settlement: { payoutOddsDecimal: string; payout: string };
158
+ }
159
+
160
+ export interface SportsBetUpdatedPayloadV2 {
161
+ id: string; // bs58
162
+ status: SportsBetStatus;
163
+ settlement: { payout: string; payoutOddsDecimal: string } | null;
164
+ legs: {
165
+ displayStatus: SportsBetSelectionStatus;
166
+ selections: { id: string; status: SportsBetSelectionStatus }[];
167
+ }[];
168
+ }
169
+
141
170
  export interface SportsBetUserV3 {
142
171
  id: string;
143
172
  username: string;
@@ -157,9 +186,19 @@ export interface SportsBetPayloadV3 {
157
186
  updatedAt: string;
158
187
  createdAt: string;
159
188
  actualOddsDecimal: string;
189
+ cashoutInfo: SportsBetCashoutInfoV3;
190
+ /**
191
+ * @deprecated use cashoutInfo.cashoutOddsDecimal
192
+ */
160
193
  cashoutOddsDecimal: string | null;
194
+ /**
195
+ * @deprecated folded into cashoutInfo.playerCashoutEnabled as OUTRIGHT_NOT_ALLOWED_CASHOUT
196
+ */
161
197
  providerCashoutDisabled: boolean;
162
198
  settlement: SportsBetSettlementV3 | null;
199
+ /**
200
+ * @deprecated use cashoutInfo
201
+ */
163
202
  cashoutAvailable: SportsBetCashoutAvailableV3;
164
203
  user: SportsBetUserV3 | null;
165
204
  legs: SportsBetLegV3[];
@@ -36,6 +36,7 @@ export class MatchStateInfo {
36
36
  awayScore?: string | null;
37
37
  possession?: SportsMatchPhaseHomeAway | null;
38
38
  currentRound?: string | null;
39
+ currentOver?: string | null;
39
40
  timeElapsed?: number | null;
40
41
  providerMessageTimestamp?: string | null;
41
42
  timeRemaining?: number | null;
@@ -1,7 +1,7 @@
1
1
  import { PrebuildBetFeaturedPrebuilds } from './prebuild-bet.types';
2
2
  import { PopularSportsCompetitionsV2Info } from './sports-competition-fixture.types';
3
3
  import { SportsContentFeaturedEvents, SportsContentFeaturedOutright } from './sports-content-fixture.types';
4
- import { PaginatedSportsBoostedSelectionsInfo, SportsCustomBoostMarketSelectionType } from './sports-selection.types';
4
+ import { SportsCustomBoostMarketSelectionType } from './sports-selection.types';
5
5
  import { Nullable, SportsContentType } from './sports.types';
6
6
 
7
7
  export class SportsContentWeight {
@@ -9,17 +9,6 @@ export class SportsContentWeight {
9
9
  weight: number;
10
10
  }
11
11
 
12
- /** @deprecated Use v2 */
13
- export class SportsContentHomePage {
14
- featuredEvents: Nullable<SportsContentFeaturedEvents>;
15
- featuredOutright: Nullable<SportsContentFeaturedOutright>;
16
- popularCompetitions: Nullable<PopularSportsCompetitionsV2Info>;
17
- featuredPrebuilds: Nullable<PrebuildBetFeaturedPrebuilds>;
18
- sportsCustomBoosts: Nullable<PaginatedSportsBoostedSelectionsInfo>;
19
- /** Enabled content types with their weights, ordered by weight DESC. */
20
- weights: SportsContentWeight[];
21
- }
22
-
23
12
  export class SportsContentHomePageV2 {
24
13
  featuredEvents: Nullable<SportsContentFeaturedEvents>;
25
14
  featuredOutright: Nullable<SportsContentFeaturedOutright>;
@@ -46,8 +46,3 @@ export type SportsMarketSelectionType = {
46
46
  export type SportsCustomBoostMarketSelectionType = SportsMarketSelectionType & {
47
47
  boost: SportsMarketSelectionOddsBoost;
48
48
  };
49
-
50
- export class PaginatedSportsBoostedSelectionsInfo {
51
- nodes: SportsCustomBoostMarketSelectionType[];
52
- nextCursor: string | null;
53
- }
@@ -97,6 +97,18 @@ export enum SportsCashoutFailedReason {
97
97
  SPORTS_MARKET_CASHOUT_NOT_ENABLED = 'SPORTS_MARKET_CASHOUT_NOT_ENABLED',
98
98
  BOOSTED_BET_NOT_ALLOWED_CASHOUT = 'BOOSTED_BET_NOT_ALLOWED_CASHOUT',
99
99
  CUSTOM_BET_NOT_ALLOWED_CASHOUT = 'CUSTOM_BET_NOT_ALLOWED_CASHOUT',
100
+ OTC_BET_NOT_ALLOWED_CASHOUT = 'OTC_BET_NOT_ALLOWED_CASHOUT',
101
+ CROSS_PROVIDERS_NOT_ALLOWED_CASHOUT = 'CROSS_PROVIDERS_NOT_ALLOWED_CASHOUT',
102
+ OUTRIGHT_NOT_ALLOWED_CASHOUT = 'OUTRIGHT_NOT_ALLOWED_CASHOUT',
103
+ SPORTS_CASHOUT_DISABLED = 'SPORTS_CASHOUT_DISABLED',
104
+ SPORTS_MAINTENANCE = 'SPORTS_MAINTENANCE',
105
+ CASHOUT_MARGIN_CAP_HIT = 'CASHOUT_MARGIN_CAP_HIT',
106
+ }
107
+
108
+ export enum SportsBetCashoutButtonState {
109
+ ENABLED = 'ENABLED',
110
+ SUSPENDED = 'SUSPENDED',
111
+ HIDDEN = 'HIDDEN',
100
112
  }
101
113
 
102
114
  export enum SportsBetType {
@@ -291,8 +303,12 @@ export class EventOddsUpdate {
291
303
  fixtureId: string;
292
304
  fixtureStatus: SportsFixtureStatus;
293
305
  markets: SportsMarketOddsUpdate[];
294
- messageTime: Date;
295
- publishedAt: Date;
306
+ messageTime: string;
307
+ publishedAt: string;
308
+ }
309
+
310
+ export class EventOddsUpdateV2 extends EventOddsUpdate {
311
+ matchState: Nullable<SportsMatchStateUpdatedPayloadType>;
296
312
  }
297
313
 
298
314
  export const SportsBetVoidedStatuses = [SportsBetSelectionStatus.VOIDED, SportsBetSelectionStatus.PROVIDER_VOIDED, SportsBetSelectionStatus.PUSHED];
@@ -521,6 +537,7 @@ export class MatchSummary {
521
537
  awayScore?: Nullable<string>;
522
538
  possession?: Nullable<SportsMatchPhaseHomeAway>;
523
539
  currentRound?: Nullable<string>;
540
+ currentOver?: Nullable<string>; // only for cricket - over.delivery
524
541
  currentPhase?: Nullable<SportsMatchPhaseSummary>;
525
542
  phases?: Nullable<SportsMatchPhaseSummary[]>;
526
543
  statistics?: Nullable<SportsMatchStatistics>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"paginated-game-no-auth.js","sourceRoot":"","sources":["../../src/games/paginated-game-no-auth.ts"],"names":[],"mappings":""}