react-memory-optimization 0.0.61 → 0.0.63
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.
- package/dist/bundle.js +1 -1
- package/dist/lib/store/casino/entities/promotions/index.d.ts +3 -1
- package/dist/lib/store/casino/entities/promotions/types.d.ts +12 -0
- package/dist/lib/store/casino/entities/promotions/types.js +8 -0
- package/dist/lib/utils/shader.d.ts +7 -0
- package/dist/lib/utils/shader.js +46 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ObservableEntity } from 'service/observableEntity';
|
|
2
2
|
import { CasinoServices } from 'store/casino/services';
|
|
3
|
-
import { CasinoPromotionSettings, PromotionEntity } from './types';
|
|
3
|
+
import { CasinoPromotionSettings, PromotionEntity, PromotionSubscribeProps } from './types';
|
|
4
4
|
import { BaseObservableSubscriber, UpdateData } from 'service/observable/type';
|
|
5
5
|
export declare class Promotions extends ObservableEntity<unknown> {
|
|
6
6
|
service: CasinoServices;
|
|
@@ -15,4 +15,6 @@ export declare class Promotions extends ObservableEntity<unknown> {
|
|
|
15
15
|
sendUpdateEntity(d: BaseObservableSubscriber & {
|
|
16
16
|
[key: string]: unknown;
|
|
17
17
|
}): UpdateData | null;
|
|
18
|
+
private battleSubscribes;
|
|
19
|
+
subscribeEntity(props: PromotionSubscribeProps): void;
|
|
18
20
|
}
|
|
@@ -35,7 +35,19 @@ export type PromotionAdaptedEntity = {
|
|
|
35
35
|
ruleTranslates: RuleTranslate;
|
|
36
36
|
participateTranslate: ParticipateTranslate;
|
|
37
37
|
bannerTranslate: TranslateBox;
|
|
38
|
+
battleIds: number[];
|
|
39
|
+
battleId: number | null;
|
|
40
|
+
duration: number;
|
|
41
|
+
startTime: number;
|
|
42
|
+
endTime: number;
|
|
43
|
+
status: EPromotionStatus;
|
|
38
44
|
};
|
|
45
|
+
export declare enum EPromotionStatus {
|
|
46
|
+
Unknown = 0,
|
|
47
|
+
Finished = 1,
|
|
48
|
+
Upcoming = 2,
|
|
49
|
+
Coming = 3
|
|
50
|
+
}
|
|
39
51
|
export type FileType = {
|
|
40
52
|
filename: string;
|
|
41
53
|
id: number;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EPromotionStatus = void 0;
|
|
4
|
+
var EPromotionStatus;
|
|
5
|
+
(function (EPromotionStatus) {
|
|
6
|
+
EPromotionStatus[EPromotionStatus["Unknown"] = 0] = "Unknown";
|
|
7
|
+
EPromotionStatus[EPromotionStatus["Finished"] = 1] = "Finished";
|
|
8
|
+
EPromotionStatus[EPromotionStatus["Upcoming"] = 2] = "Upcoming";
|
|
9
|
+
EPromotionStatus[EPromotionStatus["Coming"] = 3] = "Coming";
|
|
10
|
+
})(EPromotionStatus || (exports.EPromotionStatus = EPromotionStatus = {}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EPromotionStatus } from 'store/casino/entities/promotions/types';
|
|
1
2
|
export declare const isNumber: (value: any) => boolean;
|
|
2
3
|
export declare const getRandomArbitrary: (min: number, max: number) => number;
|
|
3
4
|
export declare const getRandomInt: (min: number, max: number) => number;
|
|
@@ -13,4 +14,10 @@ export declare const getCurrencyInfoByIdOrName: ({ id, name, }: GetCurrencyInfoB
|
|
|
13
14
|
shortView: string;
|
|
14
15
|
};
|
|
15
16
|
export declare const getDayOfMonth: (month: number, isFirstDay: boolean) => number;
|
|
17
|
+
export declare const getPromotionInfo: (currentId: number, battleIds: number[]) => {
|
|
18
|
+
status: EPromotionStatus;
|
|
19
|
+
startTime: number;
|
|
20
|
+
endTime: number;
|
|
21
|
+
duration: number;
|
|
22
|
+
};
|
|
16
23
|
export {};
|
package/dist/lib/utils/shader.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDayOfMonth = exports.getCurrencyInfoByIdOrName = exports.getRandomMultipleOfFive = exports.getRandomInt = exports.getRandomArbitrary = exports.isNumber = void 0;
|
|
3
|
+
exports.getPromotionInfo = exports.getDayOfMonth = exports.getCurrencyInfoByIdOrName = exports.getRandomMultipleOfFive = exports.getRandomInt = exports.getRandomArbitrary = exports.isNumber = void 0;
|
|
4
|
+
const types_1 = require("store/casino/entities/promotions/types");
|
|
4
5
|
const constants_1 = require("../store/user/constants");
|
|
5
6
|
const isNumber = (value) => typeof value === 'number' && !isNaN(value);
|
|
6
7
|
exports.isNumber = isNumber;
|
|
@@ -25,3 +26,47 @@ const getDayOfMonth = (month, isFirstDay) => {
|
|
|
25
26
|
return firstDayOfMonth.getTime();
|
|
26
27
|
};
|
|
27
28
|
exports.getDayOfMonth = getDayOfMonth;
|
|
29
|
+
const getPromotionInfo = (currentId, battleIds) => {
|
|
30
|
+
if (!battleIds.length) {
|
|
31
|
+
return {
|
|
32
|
+
status: types_1.EPromotionStatus.Unknown,
|
|
33
|
+
startTime: 0,
|
|
34
|
+
endTime: 0,
|
|
35
|
+
duration: 0,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const minId = Math.min(...battleIds);
|
|
39
|
+
const maxId = Math.max(...battleIds);
|
|
40
|
+
const durationWeeks = battleIds.length; // длительность акции равна количеству батлов
|
|
41
|
+
// начало акции — понедельник 00:00 недели minId
|
|
42
|
+
const now = new Date();
|
|
43
|
+
const mondayThisWeek = new Date(now);
|
|
44
|
+
mondayThisWeek.setUTCHours(0, 0, 0, 0);
|
|
45
|
+
mondayThisWeek.setUTCDate(mondayThisWeek.getUTCDate() - ((mondayThisWeek.getUTCDay() + 6) % 7));
|
|
46
|
+
// базовый id (например, currentId = 140 — это эта неделя)
|
|
47
|
+
const baseId = currentId;
|
|
48
|
+
const baseMonday = mondayThisWeek;
|
|
49
|
+
// смещение между currentId и minId
|
|
50
|
+
const diffWeeks = minId - baseId;
|
|
51
|
+
const startTime = new Date(baseMonday);
|
|
52
|
+
startTime.setUTCDate(startTime.getUTCDate() + diffWeeks * 7);
|
|
53
|
+
const endTime = new Date(startTime);
|
|
54
|
+
endTime.setUTCDate(endTime.getUTCDate() + durationWeeks * 7);
|
|
55
|
+
let status;
|
|
56
|
+
if (currentId < minId) {
|
|
57
|
+
status = types_1.EPromotionStatus.Upcoming;
|
|
58
|
+
}
|
|
59
|
+
else if (currentId >= minId && currentId <= maxId) {
|
|
60
|
+
status = types_1.EPromotionStatus.Coming;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
status = types_1.EPromotionStatus.Finished;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
status,
|
|
67
|
+
duration: durationWeeks,
|
|
68
|
+
startTime: startTime.getTime(),
|
|
69
|
+
endTime: endTime.getTime(),
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
exports.getPromotionInfo = getPromotionInfo;
|