react-memory-optimization 0.0.1 → 0.0.3

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.
@@ -0,0 +1,5 @@
1
+ export declare enum ESortType {
2
+ Unknown = "base",
3
+ Az = "az",
4
+ Za = "za"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ESortType = void 0;
4
+ var ESortType;
5
+ (function (ESortType) {
6
+ ESortType["Unknown"] = "base";
7
+ ESortType["Az"] = "az";
8
+ ESortType["Za"] = "za";
9
+ })(ESortType || (exports.ESortType = ESortType = {}));
@@ -1,5 +1,6 @@
1
1
  export type BaseObservableSubscriber = {
2
2
  uid: string;
3
+ isMobile?: boolean;
3
4
  callback: <T>(value: T) => void;
4
5
  };
5
6
  export type UpdateData = {
@@ -10,8 +10,8 @@ import { SubscribeBettingEventsByTournamentIdProps, SubscribeBettingTopEventsPro
10
10
  import { SubscriberCategoriesProps, SubscriberCategoryProps } from '../store/betting/entities/categories/types';
11
11
  import { SubscribeLiveScoreProps } from 'store/betting/entities/events/live/types';
12
12
  import { AddBetProps, RemoveBetProps, SetBetSlipStakeProps, SubscribeBetSlipBaseProps, SubscribeBetSlipMaxToWinProps, SubscribeBettingBetSlipCounterProps, SubscribeSelectedOdd, SubscribeSpecialBetOdd } from '../store/betting/entities/betslip/types';
13
- import { SubscribeCasinoCategoriesHomePageProps, SubscribeCasinoCategoriesProps, SubscribeCasinoSubCategoriesProps } from 'store/casino/entities/categories/types';
14
- import { SubscribeCasinoGameInfoSetting, SubscribeCasinoGameSetting, SubscribeCasinoProviderGamesSetting, SubscribeGameDemoModeProps } from 'store/casino/entities/games/types';
13
+ import { SubscribeCasinoCategoriesInfoProps } from 'store/casino/entities/categories/types';
14
+ import { SubscribeCasinoGamesProps } from 'store/casino/entities/games/types';
15
15
  import { ObservableProviderGameCountSetting, ObservableProviderInfoSetting, ObservableProvidersSetting } from 'store/casino/entities/providers/types';
16
16
  import { PrepareFavoriteEntitiesForSavingProps, SubscribeFavoriteGameProps, SubscribeFavoriteGamesProps } from 'store/user/entities/favorites/types';
17
17
  import { SocketServices } from './services';
@@ -80,21 +80,12 @@ export declare class Socket implements SocketInterface {
80
80
  unsubscribeBalanceEntity(uid: string): boolean;
81
81
  subscribeJackpotsEntity(props: BaseObservableSubscriber & JackpotSettings): boolean;
82
82
  unsubscribeJackpotsEntity(uid: string): boolean;
83
- subscribeCasinoCategories(props: SubscribeCasinoCategoriesProps): boolean;
84
- subscribeCasinoSubCategories(props: SubscribeCasinoSubCategoriesProps): boolean;
85
- subscribeCasinoGames(props: SubscribeCasinoGameSetting): boolean;
86
- unsubscribeCasinoGames(uid: string): boolean;
87
- subscribeCasinoGameInfo(props: SubscribeCasinoGameInfoSetting): boolean;
88
- unsubscribeCasinoGameInfo(uid: string): boolean;
89
- subscribeProviderGames(props: SubscribeCasinoProviderGamesSetting): boolean;
90
- unsubscribeProviderGames(uid: string): boolean;
91
- subscribeGameDemoMode(props: SubscribeGameDemoModeProps): boolean;
92
- unsubscribeGameDemoMode(uid: string): boolean;
83
+ subscribeCasinoCategories(props: SubscribeCasinoCategoriesInfoProps): boolean;
84
+ unsubscribeCasinoCategories(uid: string): boolean;
85
+ subscribeCasinoGamesInfo(props: SubscribeCasinoGamesProps): boolean;
86
+ unsubscribeCasinoGamesInfo(uid: string): boolean;
93
87
  subscribeCasinoProviders(data: BaseObservableSubscriber | ObservableProvidersSetting | ObservableProviderInfoSetting | ObservableProviderGameCountSetting): boolean;
94
88
  unsubscribeCasinoProviders(uid: string): boolean;
95
- subscribeCasinoCategoryInfo(props: any): boolean;
96
- unsubscribeCasinoCategoryEntity(uid: string): boolean;
97
- subscribeCasinoCategoriesHomePage(props: SubscribeCasinoCategoriesHomePageProps): boolean;
98
89
  subscribeCasinoLastWinners(props: SubscribeCasinoLastWinnersProps): boolean;
99
90
  unsubscribeCasinoLastWinnerEntities(uid: string): boolean;
100
91
  subscribeCasinoBattles(props: BaseObservableSubscriber & {
@@ -7,8 +7,7 @@ import { SubscribeBettingStatusProps } from '../store/betting/types';
7
7
  import { SubscribeBettingEventsByTournamentIdProps, SubscribeBettingTopEventsProps, SubscribeEventDetailsMarketTabs, SubscribeEventDetailsMarketsByGroupIdProps, SubscribeEventEntitiesProps, SubscribeEventShortInfoProps, SubscribeLineEntitiesProps, SubscribeOdd } from '../store/betting/entities/events/types';
8
8
  import { SubscribeLiveScoreProps } from '../store/betting/entities/events/live/types';
9
9
  import { AddBetProps, RemoveBetProps, SetBetSlipStakeProps, SubscribeBetSlipBaseProps, SubscribeBetSlipMaxToWinProps, SubscribeBettingBetSlipCounterProps, SubscribeSelectedOdd, SubscribeSpecialBetOdd } from '../store/betting/entities/betslip/types';
10
- import { SubscribeCasinoCategoriesHomePageProps, SubscribeCasinoCategoriesProps, SubscribeCasinoSubCategoriesProps } from 'store/casino/entities/categories/types';
11
- import { SubscribeCasinoGameInfoSetting, SubscribeCasinoGameSetting, SubscribeCasinoProviderGamesSetting, SubscribeGameDemoModeProps } from 'store/casino/entities/games/types';
10
+ import { SubscribeCasinoGamesProps } from 'store/casino/entities/games/types';
12
11
  import { ObservableProviderGameCountSetting, ObservableProviderInfoSetting, ObservableProvidersSetting } from 'store/casino/entities/providers/types';
13
12
  import { PrepareFavoriteEntitiesForSavingProps, SubscribeFavoriteGameProps, SubscribeFavoriteGamesProps } from 'store/user/entities/favorites/types';
14
13
  import { SubscribeFilterMarketNamesProps, SubscribeFilterMarketsProps } from 'store/betting/entities/markets/types';
@@ -27,6 +26,7 @@ import { CashBonusChannelType } from 'store/operations/entities/cashBonuses/type
27
26
  import { TournamentSettings, TournamentSubscribeProps } from 'store/casino/entities/casinoTournaments/types';
28
27
  import { JackpotSettings, JackpotSubscribes } from 'store/casino/entities/jackpots/types';
29
28
  import { CasinoHistoryGamesSubscriber } from 'store/operations/entities/casinoHistory/types';
29
+ import { SubscribeCasinoCategoriesInfoProps } from 'store/casino/entities/categories/types';
30
30
  export declare enum ESocketCallbackStep {
31
31
  Unknown = 0,
32
32
  Init = 1,
@@ -142,21 +142,12 @@ export interface SocketInterface {
142
142
  subscribeBalanceInfo: (props: BaseObservableSubscriber) => boolean;
143
143
  subscribeBonusBalanceCoins: (props: BaseObservableSubscriber) => boolean;
144
144
  unsubscribeBalanceEntity: (uid: string) => boolean;
145
- subscribeCasinoCategoryInfo: (props: any) => boolean;
146
- unsubscribeCasinoCategoryEntity: (uid: string) => boolean;
145
+ subscribeCasinoCategories: (data: SubscribeCasinoCategoriesInfoProps) => boolean;
146
+ unsubscribeCasinoCategories: (uid: string) => boolean;
147
147
  subscribeJackpotsEntity: (props: JackpotSubscribes) => boolean;
148
148
  unsubscribeJackpotsEntity: (uid: string) => boolean;
149
- subscribeCasinoCategoriesHomePage: (props: SubscribeCasinoCategoriesHomePageProps) => boolean;
150
- subscribeCasinoCategories: (props: SubscribeCasinoCategoriesProps) => boolean;
151
- subscribeCasinoSubCategories: (props: SubscribeCasinoSubCategoriesProps) => boolean;
152
- subscribeCasinoGames: (data: SubscribeCasinoGameSetting) => boolean;
153
- unsubscribeCasinoGames: (id: string) => boolean;
154
- subscribeCasinoGameInfo: (data: SubscribeCasinoGameInfoSetting) => boolean;
155
- unsubscribeCasinoGameInfo: (id: string) => boolean;
156
- subscribeProviderGames: (props: SubscribeCasinoProviderGamesSetting) => boolean;
157
- unsubscribeProviderGames: (uid: string) => boolean;
158
- subscribeGameDemoMode: (props: SubscribeGameDemoModeProps) => boolean;
159
- unsubscribeGameDemoMode: (uid: string) => boolean;
149
+ subscribeCasinoGamesInfo: (props: SubscribeCasinoGamesProps) => boolean;
150
+ unsubscribeCasinoGamesInfo: (uid: string) => boolean;
160
151
  subscribeCasinoProviders: (props: BaseObservableSubscriber | ObservableProvidersSetting | ObservableProviderInfoSetting | ObservableProviderGameCountSetting) => boolean;
161
152
  unsubscribeCasinoProviders: (uid: string) => boolean;
162
153
  subscribeCasinoBattles: (props: TournamentSubscribeProps) => boolean;
@@ -105,6 +105,7 @@ export type TournamentSubscribeProps = BaseObservableSubscriber & (TournamentsSu
105
105
  isMobile: boolean;
106
106
  });
107
107
  export type BattleHookInfo = Omit<TournamentInfo, 'status' | 'amount' | 'players'> & {
108
+ name: string;
108
109
  isInHouse: boolean;
109
110
  mobileImagePath: string;
110
111
  desktopImagePath: string;
@@ -1,9 +1,8 @@
1
- import { Observable } from 'service/observable';
2
- import { CategoriesInfo, ObservableSettings, ResponseEncodeConfig, SubscribeCasinoCategoriesHomePageProps, SubscribeCasinoCategoriesProps, SubscribeCasinoCategoryInfoProps, SubscribeCasinoSubCategoriesProps, UpdateCategoriesProps } from './types';
1
+ import { CategoriesInfo, ResponseEncodeConfig, SubscribeCasinoCategoriesInfoProps, UpdateCategoriesProps } from './types';
3
2
  import { CasinoServices } from 'store/casino/services';
4
- export declare class CasinoCategories {
5
- categoriesObservable: Observable;
6
- observableSettings: ObservableSettings;
3
+ import { ObservableEntity } from 'service/observableEntity';
4
+ import { UpdateData } from 'service/observable/type';
5
+ export declare class CasinoCategories extends ObservableEntity<undefined> {
7
6
  services: CasinoServices;
8
7
  mobileCategoriesInfo: CategoriesInfo;
9
8
  desktopCategoriesInfo: CategoriesInfo;
@@ -24,10 +23,5 @@ export declare class CasinoCategories {
24
23
  private sendCategoriesUpdate;
25
24
  private sendHomeCategoriesUpdate;
26
25
  private sendSubCategoriesUpdate;
27
- sendUpdates(): void;
28
- subscribeCasinoCategories(props: SubscribeCasinoCategoriesProps): void;
29
- subscribeCasinoCategoriesHomePage(props: SubscribeCasinoCategoriesHomePageProps): void;
30
- subscribeCasinoSubCategories(props: SubscribeCasinoSubCategoriesProps): void;
31
- subscribeCasinoCategoryInfo(props: SubscribeCasinoCategoryInfoProps): void;
32
- unsubscribeCasinoCategoryEntity(uid: string): void;
26
+ sendUpdateEntity(d: SubscribeCasinoCategoriesInfoProps): UpdateData | null;
33
27
  }
@@ -1,4 +1,6 @@
1
1
  import { BinaryConvertToObjType } from 'binary/types';
2
+ import { ESortType } from 'globalTypes/utils';
3
+ import { BaseObservableSubscriber } from 'service/observable/type';
2
4
  export type CasinoCategory = {
3
5
  id: number;
4
6
  gameIds: number[];
@@ -40,52 +42,22 @@ export declare enum ECasinoCategoryIds {
40
42
  SubSlotsTop = 104,
41
43
  SubGameShow = 124
42
44
  }
43
- export type ObservableSettings = {
44
- [uid: string]: CategoryObservable | CategoriesObservableSetting | CategoriesHomePage | SubCategoriesObservable;
45
- };
45
+ export type SubscribeCasinoCategoriesInfoProps = BaseObservableSubscriber & ObservableSettings;
46
+ type ObservableSettings = CategoryObservable | CategoriesObservableSetting | CategoriesHomePage | SubCategoriesObservable;
46
47
  export type CategoryObservable = {
47
48
  isCategory: boolean;
48
49
  categoryId: number;
49
- isMobile: boolean;
50
- };
51
- export type SubCategoriesObservable = {
52
- isSubCategories: boolean;
53
- isMobile: boolean;
54
- categoryId: number;
55
50
  };
56
51
  export type CategoriesObservableSetting = {
57
52
  isCategories: boolean;
58
- isMobile: boolean;
53
+ sortType: ESortType;
59
54
  };
60
55
  export type CategoriesHomePage = {
61
56
  isHome: boolean;
62
- isMobile: boolean;
63
- };
64
- export type SubscribeCasinoCategoriesProps = {
65
- uid: string;
66
- callback: (d: CasinoCategory[]) => void;
67
- isMobile: boolean;
68
- };
69
- export type ResponseHomePageInfo = {
70
- rows: (CasinoCategory | CasinoSubCategory)[];
71
- subCategoriesInx: number[];
72
57
  };
73
- export type SubscribeCasinoCategoriesHomePageProps = {
74
- uid: string;
75
- isMobile: boolean;
76
- callback: (d: ResponseHomePageInfo) => void;
77
- };
78
- export type SubscribeCasinoSubCategoriesProps = {
79
- uid: string;
80
- isMobile: boolean;
81
- categoryId: number;
82
- callback: (d: ResponseHomePageInfo) => void;
83
- };
84
- export type SubscribeCasinoCategoryInfoProps = {
85
- uid: string;
86
- isMobile: boolean;
58
+ export type SubCategoriesObservable = {
59
+ isSubCategories: boolean;
87
60
  categoryId: number;
88
- callback: (d: CasinoCategory) => void;
89
61
  };
90
62
  export type ResponseCategoryName = {
91
63
  nameKey: string;
@@ -150,3 +122,8 @@ export type SubCategoryWithGame = {
150
122
  subCategoryId: number;
151
123
  gameIds: ResponseGameIds;
152
124
  };
125
+ export type ResponseHomePageInfo = {
126
+ rows: (CasinoCategory | CasinoSubCategory)[];
127
+ subCategoriesInx: number[];
128
+ };
129
+ export {};
@@ -1,7 +1,8 @@
1
1
  import { CasinoServices } from 'store/casino/services';
2
- import { AdaptedGame, AdaptedGames, AllGames, InitialGames, SubscribeCasinoGameInfoSetting, SubscribeCasinoGameSetting, SubscribeCasinoProviderGamesSetting, SubscribeGameDemoModeProps, UpdatePlatformGamesProps } from './types';
3
- import { Observable } from 'service/observable';
4
- export declare class CasinoGames {
2
+ import { AdaptedGame, AdaptedGames, AllGames, InitialGames, SubscribeCasinoGamesProps, UpdatePlatformGamesProps } from './types';
3
+ import { ObservableEntity } from 'service/observableEntity';
4
+ import { UpdateData } from 'service/observable/type';
5
+ export declare class CasinoGames extends ObservableEntity<undefined> {
5
6
  allGames: InitialGames;
6
7
  desktopGames: AdaptedGames;
7
8
  mobileGames: AdaptedGames;
@@ -9,9 +10,7 @@ export declare class CasinoGames {
9
10
  mobile: AdaptedGame[];
10
11
  desktop: AdaptedGame[];
11
12
  };
12
- observableSettings: any;
13
13
  initialGames: AllGames;
14
- gameObservable: Observable;
15
14
  services: CasinoServices;
16
15
  constructor(services: CasinoServices);
17
16
  updatePlatformGames({ mobile, desktop }: UpdatePlatformGamesProps): void;
@@ -20,13 +19,5 @@ export declare class CasinoGames {
20
19
  private sendGameInfoUpdates;
21
20
  private sendGameDemoModeUpdates;
22
21
  private sendProviderGames;
23
- sendUpdates(): void;
24
- subscribeCasinoGames(props: SubscribeCasinoGameSetting): void;
25
- unsubscribeGames(uid: string): void;
26
- subscribeCasinoGameDemoMode(props: SubscribeGameDemoModeProps): void;
27
- unsubscribeCasinoGameDemoMode(uid: string): void;
28
- subscribeProviderGames(props: SubscribeCasinoProviderGamesSetting): void;
29
- unsubscribeProviderGames(uid: string): void;
30
- subscribeCasinoGameInfo(props: SubscribeCasinoGameInfoSetting): void;
31
- unsubscribeCasinoGameInfo(uid: string): void;
22
+ sendUpdateEntity(d: SubscribeCasinoGamesProps): UpdateData | null;
32
23
  }
@@ -1,3 +1,5 @@
1
+ import { ESortType } from 'globalTypes/utils';
2
+ import { BaseObservableSubscriber } from 'service/observable/type';
1
3
  export type InitialGames = CasinoGame[];
2
4
  export type AllGames = {
3
5
  [id: number]: AdaptedGame;
@@ -43,21 +45,17 @@ export type CasinoGamesResponse = {
43
45
  compareKey?: string;
44
46
  totalPages: number;
45
47
  };
46
- export type ObservableSettings = {
47
- [uid: string]: ObservableSetting;
48
- };
49
- type ObservableSetting = ObservableSettingGame | ObservableSettingGames | ObservableSettingGameDemoMode | ObservableCasinoProviderGamesSetting;
50
- type ObservableSettingGame = {
48
+ export type SubscribeCasinoGamesProps = BaseObservableSubscriber & (ObservableSettingGame | ObservableSettingGames | ObservableSettingGameDemoMode | ObservableCasinoProviderGamesSetting);
49
+ export type ObservableSettingGame = {
51
50
  isGameInfo: true;
52
51
  gameId: number;
53
- isMobile: boolean;
52
+ force?: boolean;
54
53
  };
55
- type ObservableSettingGameDemoMode = {
54
+ export type ObservableSettingGameDemoMode = {
56
55
  isGameDemoMode: true;
57
56
  gameId: number;
58
- isMobile: boolean;
59
57
  };
60
- type ObservableSettingGames = {
58
+ export type ObservableSettingGames = {
61
59
  isGames: boolean;
62
60
  isMobile: boolean;
63
61
  categoryId: number | null;
@@ -66,6 +64,8 @@ type ObservableSettingGames = {
66
64
  providerId: number | null;
67
65
  limit: number;
68
66
  excludeGameId?: number;
67
+ search: string;
68
+ sortType?: ESortType;
69
69
  };
70
70
  export type GetSearchingGamesProps = {
71
71
  providerId: number;
@@ -82,7 +82,7 @@ export type ObservableCasinoProviderGamesSetting = {
82
82
  excludeGameId?: number;
83
83
  limit: number;
84
84
  isMobile: boolean;
85
- sortFn?: (a: AdaptedGame, b: AdaptedGame) => number;
85
+ sortType?: ESortType;
86
86
  };
87
87
  export type SubscribeCasinoGamesSetting = {
88
88
  categoryId: number | null;
@@ -118,11 +118,3 @@ export type SubscribeCasinoProviderGamesSetting = {
118
118
  callback: (games: any) => void;
119
119
  uid: string;
120
120
  };
121
- export type SubscribeCasinoGameInfoSetting = {
122
- uid: string;
123
- isMobile: boolean;
124
- force: boolean;
125
- gameId: number;
126
- callback: (d: CasinoGamesResponse) => void;
127
- };
128
- export {};
@@ -1,7 +1,6 @@
1
+ import { BaseObservableSubscriber } from 'service/observable/type';
1
2
  import { AdaptedGame } from '../games/types';
2
- export type SubscribeCasinoLastWinnersProps = {
3
- uid: string;
4
- callback: (d: ReturnSubscribeCasinoLastWinnersProps[]) => void;
3
+ export type SubscribeCasinoLastWinnersProps = BaseObservableSubscriber & {
5
4
  limit: number;
6
5
  type: 'vipBet' | 'base';
7
6
  fullUpdateTime?: number;
@@ -1,4 +1,3 @@
1
- import { Observable } from '../../service/observable';
2
1
  import { TCasinoSettings } from '../../socket/types';
3
2
  import { TFilerDataProps, InitProps } from './types';
4
3
  import { CasinoCategories } from './entities/categories';
@@ -9,8 +8,6 @@ import { LastWinners } from './entities/lastWinners';
9
8
  import { ResponseAdapterService } from 'service/responseAdapter/services';
10
9
  import { Jackpots } from './entities/jackpots';
11
10
  export declare class Casino {
12
- gamesObservable: Observable;
13
- providersObservable: Observable;
14
11
  categories: CasinoCategories;
15
12
  games: CasinoGames;
16
13
  providers: CasinoProviders;
@@ -5,6 +5,7 @@ import { GetProviderInfo, Provider, Providers } from '../entities/providers/type
5
5
  import { InitialProviders, InstanceProviders } from '../types';
6
6
  import { ResponseAdapterService } from 'service/responseAdapter/services';
7
7
  import { JackpotHookInfo, JackpotInfo, JackpotResponse } from '../entities/jackpots/types';
8
+ import { ESortType } from 'globalTypes/utils';
8
9
  export declare class CasinoServices {
9
10
  parent: Casino;
10
11
  mainService: ResponseAdapterService;
@@ -64,4 +65,5 @@ export declare class CasinoServices {
64
65
  getSpecLabel(isBonusWager: boolean, isTournamentWager: boolean): EAdaptedGameSpecialLabel;
65
66
  configureCasinoData(): any;
66
67
  decodeCasinoData(stream: Uint8Array): ResponseEncodeConfig;
68
+ getGamesSortFnByType(type: ESortType): (a: AdaptedGame, b: AdaptedGame) => number;
67
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-memory-optimization",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "react memory optimization library",
5
5
  "sideEffects": false,
6
6
  "files": [