react-memory-optimization 0.0.46 → 0.0.47

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.
@@ -1,3 +1,4 @@
1
1
  export { Socket } from './socket';
2
2
  export { experimentalFeatures } from './service/experimental';
3
3
  export { getCurrencyInfoByIdOrName } from './utils/shader';
4
+ export { api } from './service/api';
@@ -0,0 +1,17 @@
1
+ import { EApiPath } from './types';
2
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
3
+ interface ApiRequestConfig extends RequestInit {
4
+ method: HttpMethod;
5
+ headers?: HeadersInit;
6
+ }
7
+ declare class Api {
8
+ private baseUrl;
9
+ private defaultConfig;
10
+ constructor();
11
+ setToken(token: string): void;
12
+ private request;
13
+ get<T>(url: EApiPath, config?: Partial<ApiRequestConfig>): Promise<T | null>;
14
+ post<T, U = unknown>(url: EApiPath, body: U, config?: Partial<ApiRequestConfig>): Promise<T | null>;
15
+ }
16
+ export declare const api: Api;
17
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare enum EApiPath {
2
+ AccrualHistory = "/ref_service/api/v1/client/accural_bonus"
3
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EApiPath = void 0;
4
+ var EApiPath;
5
+ (function (EApiPath) {
6
+ EApiPath["AccrualHistory"] = "/ref_service/api/v1/client/accural_bonus";
7
+ })(EApiPath || (exports.EApiPath = EApiPath = {}));
@@ -69,12 +69,12 @@ export declare class Socket implements SocketInterface {
69
69
  subscribeEntity(method: () => boolean): boolean;
70
70
  logout(): void;
71
71
  subscribeUserEntity(props: BaseObservableSubscriber & SubscribeUserKeys): boolean;
72
+ unsubscribeUserEntity(uid: string): boolean;
72
73
  subscribeBazarFrameUrl(props: BaseObservableSubscriber & {
73
74
  gameId: number;
74
75
  }): boolean;
75
76
  unsubscribeBazarFrameUrl(uid: string): boolean;
76
77
  subscribeStories(props: BaseObservableSubscriber): boolean;
77
- unsubscribeUserEntity(uid: string): boolean;
78
78
  subscribeBalanceInfo(props: BaseObservableSubscriber): boolean;
79
79
  subscribeBonusBalanceCoins(props: BaseObservableSubscriber): boolean;
80
80
  unsubscribeBalanceEntity(uid: string): boolean;
@@ -115,6 +115,8 @@ export declare class Socket implements SocketInterface {
115
115
  isActive?: boolean;
116
116
  }): boolean;
117
117
  unsubscribeTournamentBonuses(uid: string): boolean;
118
+ subscribeAccrualHistory(props: BaseObservableSubscriber): boolean;
119
+ unsubscribeAccrualHistory(uid: string): boolean;
118
120
  saveToFavoriteEntities(props: PrepareFavoriteEntitiesForSavingProps): boolean;
119
121
  subscribeIsFavoriteGame(props: SubscribeFavoriteGameProps): boolean;
120
122
  subscribeFavoriteGames(props: SubscribeFavoriteGamesProps): boolean;
@@ -179,6 +179,8 @@ export interface SocketInterface {
179
179
  isActive: boolean;
180
180
  }) => boolean;
181
181
  unsubscribeTournamentBonuses: (uid: string) => void;
182
+ subscribeAccrualHistory: (props: BaseObservableSubscriber) => boolean;
183
+ unsubscribeAccrualHistory: (uid: string) => void;
182
184
  subscribeIsFavoriteGame: (props: SubscribeFavoriteGameProps) => boolean;
183
185
  subscribeFavoriteGames: (props: SubscribeFavoriteGamesProps) => boolean;
184
186
  saveToFavoriteEntities: (data: PrepareFavoriteEntitiesForSavingProps) => void;
@@ -13,5 +13,6 @@ export declare enum ENotifications {
13
13
  BalanceIsNotAvailable = 11,
14
14
  PromoCodeError = 12,
15
15
  PromoCodeSuccess = 13,
16
- LootBoxTakeMonthly = 14
16
+ LootBoxTakeMonthly = 14,
17
+ AccrualHistoryError = 15
17
18
  }
@@ -18,4 +18,5 @@ var ENotifications;
18
18
  ENotifications[ENotifications["PromoCodeError"] = 12] = "PromoCodeError";
19
19
  ENotifications[ENotifications["PromoCodeSuccess"] = 13] = "PromoCodeSuccess";
20
20
  ENotifications[ENotifications["LootBoxTakeMonthly"] = 14] = "LootBoxTakeMonthly";
21
+ ENotifications[ENotifications["AccrualHistoryError"] = 15] = "AccrualHistoryError";
21
22
  })(ENotifications || (exports.ENotifications = ENotifications = {}));
@@ -0,0 +1 @@
1
+ export declare const POLLING_DELAY = 10000;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.POLLING_DELAY = void 0;
4
+ exports.POLLING_DELAY = 10000; // 10 sec
@@ -0,0 +1,17 @@
1
+ import { BaseObservableSubscriber, UpdateData } from 'service/observable/type';
2
+ import { ObservableEntity } from 'service/observableEntity';
3
+ import { UserOperationServices } from 'store/operations/services';
4
+ import { AccrualHistoryCamelCaseType, AccrualHistoryRequestInfo } from './types';
5
+ export declare class AccrualHistory extends ObservableEntity<undefined> {
6
+ services: UserOperationServices;
7
+ throttling: number;
8
+ _info: AccrualHistoryCamelCaseType | null;
9
+ requestInfo: AccrualHistoryRequestInfo;
10
+ constructor(services: UserOperationServices);
11
+ set info(data: AccrualHistoryCamelCaseType | null);
12
+ get info(): AccrualHistoryCamelCaseType | null;
13
+ prepareAccrualHistory(): UpdateData | null;
14
+ sendUpdateEntity(d: BaseObservableSubscriber & {
15
+ [key: string]: unknown;
16
+ }): UpdateData | null;
17
+ }
@@ -0,0 +1,21 @@
1
+ export type AccrualHistoryType = {
2
+ deposit_bonus: number;
3
+ rakeback: number;
4
+ free_spins: number;
5
+ weekly_bonus: number;
6
+ monthly_bonus: number;
7
+ weekly_battles: number;
8
+ bonus_from_support: number;
9
+ cash_bonus: number;
10
+ new_loyalty_level: number;
11
+ key: string;
12
+ };
13
+ type SnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<SnakeToCamelCase<U>>}` : S;
14
+ export type AccrualHistoryCamelCaseType = {
15
+ [K in keyof AccrualHistoryType as SnakeToCamelCase<K>]: AccrualHistoryType[K];
16
+ };
17
+ export type AccrualHistoryRequestInfo = {
18
+ requestTime: number;
19
+ isRequesting: boolean;
20
+ };
21
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { AccrualHistoryCamelCaseType, AccrualHistoryType } from './types';
2
+ export declare const transformKeysToCamelCase: (obj: AccrualHistoryType) => AccrualHistoryCamelCaseType;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformKeysToCamelCase = void 0;
4
+ function snakeToCamel(str) {
5
+ return str.replace(/(_\w)/g, (match) => match[1].toUpperCase());
6
+ }
7
+ const transformKeysToCamelCase = (obj) => {
8
+ const result = {};
9
+ for (const key in obj) {
10
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
11
+ const camelKey = snakeToCamel(key);
12
+ result[camelKey] = obj[key];
13
+ }
14
+ }
15
+ return result;
16
+ };
17
+ exports.transformKeysToCamelCase = transformKeysToCamelCase;
@@ -14,6 +14,7 @@ import { UpdateData } from 'service/observable/type';
14
14
  import { CashBonuses } from './entities/cashBonuses';
15
15
  import { CasinoHistoryBet } from './entities/casinoHistory/types';
16
16
  import { ResponseAdapterService } from 'service/responseAdapter/services';
17
+ import { AccrualHistory } from './entities/accrualHistory';
17
18
  export declare class UserOperations extends ObservableEntity<undefined> {
18
19
  availableBonuses: AvailableBonuses;
19
20
  activeBonuses: ActiveBonuses;
@@ -25,6 +26,7 @@ export declare class UserOperations extends ObservableEntity<undefined> {
25
26
  vipClub: VipClub;
26
27
  tournaments: TournamentOperations;
27
28
  referralOperations: ReferralOperation;
29
+ accrualHistory: AccrualHistory;
28
30
  availableBonusOnDeposit: Operation[];
29
31
  availableFreeSpins: Operation[];
30
32
  activeBonusOnDeposit: Operation[];
@@ -1,4 +1,5 @@
1
1
  import { UserOperations } from '..';
2
+ import { AccrualHistoryCamelCaseType } from '../entities/accrualHistory/types';
2
3
  import { MixerTransactionResponse } from '../types';
3
4
  export declare class UserOperationServices {
4
5
  parent: UserOperations;
@@ -15,4 +16,6 @@ export declare class UserOperationServices {
15
16
  handleWeekly(isActive?: boolean): MixerTransactionResponse;
16
17
  handleMonthly(isActive?: boolean): MixerTransactionResponse;
17
18
  handleTournamentOperation(isActive?: boolean): MixerTransactionResponse;
19
+ fetchingAccrualHistory(): Promise<void>;
20
+ getAccrualHistoryData(): AccrualHistoryCamelCaseType | null;
18
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-memory-optimization",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "description": "react memory optimization library",
5
5
  "sideEffects": false,
6
6
  "files": [