@everymatrix/casino-game-thumb-view 1.62.4 → 1.63.1
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/casino-game-thumb-view/casino-game-thumb-view.esm.js +1 -1
- package/dist/casino-game-thumb-view/p-2099000e.entry.js +1 -0
- package/dist/casino-game-thumb-view/{p-358a4af8.entry.js → p-624d7d36.entry.js} +1 -1
- package/dist/casino-game-thumb-view/p-62abf08e.js +1 -0
- package/dist/cjs/casino-game-thumb-view_2.cjs.entry.js +1 -1
- package/dist/cjs/casino-game-thumbnail-betlimit_2.cjs.entry.js +2131 -5
- package/dist/cjs/utils-d65e7a9f.js +215 -0
- package/dist/collection/components/casino-game-thumbnail-extrainfo/casino-game-thumbnail-extrainfo.js +2 -5
- package/dist/collection/utils/utils.js +4 -4
- package/dist/esm/casino-game-thumb-view_2.entry.js +1 -1
- package/dist/esm/casino-game-thumbnail-betlimit_2.entry.js +2131 -5
- package/dist/esm/utils-0ac47409.js +207 -0
- package/package.json +1 -1
- package/dist/casino-game-thumb-view/p-4ece4698.js +0 -8
- package/dist/casino-game-thumb-view/p-74a4ae4a.entry.js +0 -1
- package/dist/cjs/utils-21e506f8.js +0 -5745
- package/dist/esm/utils-d11d0845.js +0 -5739
@@ -0,0 +1,215 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
function _typeof(o) {
|
4
|
+
"@babel/helpers - typeof";
|
5
|
+
|
6
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
7
|
+
return typeof o;
|
8
|
+
} : function (o) {
|
9
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
10
|
+
}, _typeof(o);
|
11
|
+
}
|
12
|
+
|
13
|
+
function requiredArgs(required, args) {
|
14
|
+
if (args.length < required) {
|
15
|
+
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
/**
|
20
|
+
* @name toDate
|
21
|
+
* @category Common Helpers
|
22
|
+
* @summary Convert the given argument to an instance of Date.
|
23
|
+
*
|
24
|
+
* @description
|
25
|
+
* Convert the given argument to an instance of Date.
|
26
|
+
*
|
27
|
+
* If the argument is an instance of Date, the function returns its clone.
|
28
|
+
*
|
29
|
+
* If the argument is a number, it is treated as a timestamp.
|
30
|
+
*
|
31
|
+
* If the argument is none of the above, the function returns Invalid Date.
|
32
|
+
*
|
33
|
+
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
34
|
+
*
|
35
|
+
* @param {Date|Number} argument - the value to convert
|
36
|
+
* @returns {Date} the parsed date in the local time zone
|
37
|
+
* @throws {TypeError} 1 argument required
|
38
|
+
*
|
39
|
+
* @example
|
40
|
+
* // Clone the date:
|
41
|
+
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
42
|
+
* //=> Tue Feb 11 2014 11:30:30
|
43
|
+
*
|
44
|
+
* @example
|
45
|
+
* // Convert the timestamp to date:
|
46
|
+
* const result = toDate(1392098430000)
|
47
|
+
* //=> Tue Feb 11 2014 11:30:30
|
48
|
+
*/
|
49
|
+
function toDate(argument) {
|
50
|
+
requiredArgs(1, arguments);
|
51
|
+
var argStr = Object.prototype.toString.call(argument);
|
52
|
+
|
53
|
+
// Clone the date
|
54
|
+
if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
|
55
|
+
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
56
|
+
return new Date(argument.getTime());
|
57
|
+
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
58
|
+
return new Date(argument);
|
59
|
+
} else {
|
60
|
+
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
61
|
+
// eslint-disable-next-line no-console
|
62
|
+
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
|
63
|
+
// eslint-disable-next-line no-console
|
64
|
+
console.warn(new Error().stack);
|
65
|
+
}
|
66
|
+
return new Date(NaN);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* @name differenceInMilliseconds
|
72
|
+
* @category Millisecond Helpers
|
73
|
+
* @summary Get the number of milliseconds between the given dates.
|
74
|
+
*
|
75
|
+
* @description
|
76
|
+
* Get the number of milliseconds between the given dates.
|
77
|
+
*
|
78
|
+
* @param {Date|Number} dateLeft - the later date
|
79
|
+
* @param {Date|Number} dateRight - the earlier date
|
80
|
+
* @returns {Number} the number of milliseconds
|
81
|
+
* @throws {TypeError} 2 arguments required
|
82
|
+
*
|
83
|
+
* @example
|
84
|
+
* // How many milliseconds are between
|
85
|
+
* // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
|
86
|
+
* const result = differenceInMilliseconds(
|
87
|
+
* new Date(2014, 6, 2, 12, 30, 21, 700),
|
88
|
+
* new Date(2014, 6, 2, 12, 30, 20, 600)
|
89
|
+
* )
|
90
|
+
* //=> 1100
|
91
|
+
*/
|
92
|
+
function differenceInMilliseconds(dateLeft, dateRight) {
|
93
|
+
requiredArgs(2, arguments);
|
94
|
+
return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* @name isAfter
|
99
|
+
* @category Common Helpers
|
100
|
+
* @summary Is the first date after the second one?
|
101
|
+
*
|
102
|
+
* @description
|
103
|
+
* Is the first date after the second one?
|
104
|
+
*
|
105
|
+
* @param {Date|Number} date - the date that should be after the other one to return true
|
106
|
+
* @param {Date|Number} dateToCompare - the date to compare with
|
107
|
+
* @returns {Boolean} the first date is after the second date
|
108
|
+
* @throws {TypeError} 2 arguments required
|
109
|
+
*
|
110
|
+
* @example
|
111
|
+
* // Is 10 July 1989 after 11 February 1987?
|
112
|
+
* const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
113
|
+
* //=> true
|
114
|
+
*/
|
115
|
+
function isAfter(dirtyDate, dirtyDateToCompare) {
|
116
|
+
requiredArgs(2, arguments);
|
117
|
+
var date = toDate(dirtyDate);
|
118
|
+
var dateToCompare = toDate(dirtyDateToCompare);
|
119
|
+
return date.getTime() > dateToCompare.getTime();
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* @name isBefore
|
124
|
+
* @category Common Helpers
|
125
|
+
* @summary Is the first date before the second one?
|
126
|
+
*
|
127
|
+
* @description
|
128
|
+
* Is the first date before the second one?
|
129
|
+
*
|
130
|
+
* @param {Date|Number} date - the date that should be before the other one to return true
|
131
|
+
* @param {Date|Number} dateToCompare - the date to compare with
|
132
|
+
* @returns {Boolean} the first date is before the second date
|
133
|
+
* @throws {TypeError} 2 arguments required
|
134
|
+
*
|
135
|
+
* @example
|
136
|
+
* // Is 10 July 1989 before 11 February 1987?
|
137
|
+
* const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
138
|
+
* //=> false
|
139
|
+
*/
|
140
|
+
function isBefore(dirtyDate, dirtyDateToCompare) {
|
141
|
+
requiredArgs(2, arguments);
|
142
|
+
var date = toDate(dirtyDate);
|
143
|
+
var dateToCompare = toDate(dirtyDateToCompare);
|
144
|
+
return date.getTime() < dateToCompare.getTime();
|
145
|
+
}
|
146
|
+
|
147
|
+
const DEFAULT_AMOUNT_SEPARATOR = ',';
|
148
|
+
/**
|
149
|
+
* @name numberWithSeparators
|
150
|
+
* @description A method that format number with seperator
|
151
|
+
* @param {number} value value to format
|
152
|
+
* @param {String} sep separator,default ','
|
153
|
+
* @returns {String} formated value
|
154
|
+
*/
|
155
|
+
const numberWithSeparators = (value, sep = DEFAULT_AMOUNT_SEPARATOR) => {
|
156
|
+
if (value !== undefined && value !== null) {
|
157
|
+
return `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, sep);
|
158
|
+
}
|
159
|
+
return '';
|
160
|
+
};
|
161
|
+
/**
|
162
|
+
* @name isMobile
|
163
|
+
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
164
|
+
* @param {String} userAgent window.navigator.userAgent
|
165
|
+
* @returns {Boolean} true or false
|
166
|
+
*/
|
167
|
+
const isMobile = (userAgent) => {
|
168
|
+
return !!(userAgent.toLowerCase().match(/android/i) ||
|
169
|
+
userAgent.toLowerCase().match(/blackberry|bb/i) ||
|
170
|
+
userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
|
171
|
+
userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
|
172
|
+
};
|
173
|
+
const addGameTag = (tags) => {
|
174
|
+
if ((tags === null || tags === void 0 ? void 0 : tags.length) === 0)
|
175
|
+
return '';
|
176
|
+
let tagName;
|
177
|
+
let differenceOfTime = 99999999999;
|
178
|
+
let firstToExpire;
|
179
|
+
const currentDate = new Date(Date.now());
|
180
|
+
tags.forEach((tag, index) => {
|
181
|
+
const startDateOfTag = new Date(tag.schedules[0].startTime);
|
182
|
+
const endDateOfTag = new Date(tag.schedules[0].endTime);
|
183
|
+
if (differenceInMilliseconds(new Date(endDateOfTag), new Date(currentDate)) < differenceOfTime) {
|
184
|
+
differenceOfTime = differenceInMilliseconds(new Date(endDateOfTag), new Date(currentDate));
|
185
|
+
firstToExpire = index;
|
186
|
+
}
|
187
|
+
if (isAfter(new Date(currentDate), new Date(startDateOfTag)) && isBefore(new Date(currentDate), new Date(endDateOfTag))) {
|
188
|
+
tagName = tags[firstToExpire].name;
|
189
|
+
}
|
190
|
+
});
|
191
|
+
return tagName;
|
192
|
+
};
|
193
|
+
const convertGicBaccaratUpdateItem = (oriItem) => {
|
194
|
+
var _a, _b;
|
195
|
+
return {
|
196
|
+
winner: oriItem.Winner,
|
197
|
+
color: oriItem.Color,
|
198
|
+
location: {
|
199
|
+
column: (_a = oriItem.Location) === null || _a === void 0 ? void 0 : _a.Column,
|
200
|
+
row: (_b = oriItem.Location) === null || _b === void 0 ? void 0 : _b.Row
|
201
|
+
},
|
202
|
+
ties: (oriItem.Ties) | 0,
|
203
|
+
score: oriItem.Score,
|
204
|
+
playerPair: oriItem.PlayerPair,
|
205
|
+
bankerPair: oriItem.BankerPair
|
206
|
+
};
|
207
|
+
};
|
208
|
+
|
209
|
+
exports._typeof = _typeof;
|
210
|
+
exports.addGameTag = addGameTag;
|
211
|
+
exports.convertGicBaccaratUpdateItem = convertGicBaccaratUpdateItem;
|
212
|
+
exports.isMobile = isMobile;
|
213
|
+
exports.numberWithSeparators = numberWithSeparators;
|
214
|
+
exports.requiredArgs = requiredArgs;
|
215
|
+
exports.toDate = toDate;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { h } from "@stencil/core";
|
2
|
-
import moment from "moment";
|
3
2
|
import { translate } from "../../utils/locale.utils";
|
4
3
|
import { addGameTag } from "../../utils/utils";
|
5
4
|
import { WIDGETTYPE_GAMECATEGORY, WIDGETTYPE_CLASS, } from "../../constants/game-thumbnail";
|
5
|
+
import { format } from "date-fns";
|
6
6
|
export class CasinoGameThumbnailExtrainfo {
|
7
7
|
constructor() {
|
8
8
|
this.isNewGame = false;
|
@@ -56,10 +56,7 @@ export class CasinoGameThumbnailExtrainfo {
|
|
56
56
|
return '';
|
57
57
|
}
|
58
58
|
return (h("div", { class: "GameExtraInfo", part: "GameExtraInfo" }, this.isNewGame && (h("span", { class: "GameExtraInfoLabel NewGameTag", part: "GameExtraInfoLabel NewGameTag" }, translate('new', this.language))), this.gameTag && (h("span", { class: "GameExtraInfoLabel PopularGameTag", part: "GameExtraInfoLabel PopularGameTag" }, this.gameTag)), this.gameDetails && (h("div", { class: `GameProp LiveProps ${WIDGETTYPE_CLASS[this.gameDetails.category.toLowerCase()]} ${this.isDouble ? ' Double' : ''}`, part: `GameProp LiveProps ${WIDGETTYPE_CLASS[this.gameDetails.category.toLowerCase()]} ${this.isDouble ? ' Double' : ''}` }, this.gameDetails.isOpen ? (h("slot", { name: "category-details" })) : (this.gameStartTime &&
|
59
|
-
this.gameTimeFormat && (h("div", { class: "ClosedGame", part: "ClosedGame" }, translate('opens', this.language), h("span", null, ' ',
|
60
|
-
.utc(this.gameStartTime)
|
61
|
-
.local()
|
62
|
-
.format(this.gameTimeFormat), ' ')))), ((_a = this.gameDetails.dealer) === null || _a === void 0 ? void 0 : _a.DealerName) && (h("p", { class: "LiveLimits" }, h("span", { class: "DealerName" }, translate('dealer', this.language), ":", ' ', (_b = this.gameDetails) === null || _b === void 0 ? void 0 :
|
59
|
+
this.gameTimeFormat && (h("div", { class: "ClosedGame", part: "ClosedGame" }, translate('opens', this.language), h("span", null, ' ', format(new Date(this.gameStartTime), Intl.DateTimeFormat().resolvedOptions().timeZone), ' ')))), ((_a = this.gameDetails.dealer) === null || _a === void 0 ? void 0 : _a.DealerName) && (h("p", { class: "LiveLimits" }, h("span", { class: "DealerName" }, translate('dealer', this.language), ":", ' ', (_b = this.gameDetails) === null || _b === void 0 ? void 0 :
|
63
60
|
_b.dealer.DealerName, ' '))), h("casino-game-thumbnail-betlimit", { betLimit: this.betLimit, numberOfPlayers: (_c = this.gameDetails) === null || _c === void 0 ? void 0 : _c.numberOfPlayers })))));
|
64
61
|
}
|
65
62
|
static get is() { return "casino-game-thumbnail-extrainfo"; }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { differenceInMilliseconds, isAfter, isBefore } from "date-fns";
|
2
2
|
export function format(first, middle, last) {
|
3
3
|
return ((first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''));
|
4
4
|
}
|
@@ -38,11 +38,11 @@ export const addGameTag = (tags) => {
|
|
38
38
|
tags.forEach((tag, index) => {
|
39
39
|
const startDateOfTag = new Date(tag.schedules[0].startTime);
|
40
40
|
const endDateOfTag = new Date(tag.schedules[0].endTime);
|
41
|
-
if (
|
42
|
-
differenceOfTime =
|
41
|
+
if (differenceInMilliseconds(new Date(endDateOfTag), new Date(currentDate)) < differenceOfTime) {
|
42
|
+
differenceOfTime = differenceInMilliseconds(new Date(endDateOfTag), new Date(currentDate));
|
43
43
|
firstToExpire = index;
|
44
44
|
}
|
45
|
-
if (
|
45
|
+
if (isAfter(new Date(currentDate), new Date(startDateOfTag)) && isBefore(new Date(currentDate), new Date(endDateOfTag))) {
|
46
46
|
tagName = tags[firstToExpire].name;
|
47
47
|
}
|
48
48
|
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-8058a16f.js';
|
2
|
-
import { c as convertGicBaccaratUpdateItem, i as isMobile } from './utils-
|
2
|
+
import { c as convertGicBaccaratUpdateItem, i as isMobile } from './utils-0ac47409.js';
|
3
3
|
import { G as GAME_CATEGORY, a as GAME_TYPE, W as WIDGETTYPE_GAMECATEGORY } from './game-thumbnail-035e97e2.js';
|
4
4
|
import { t as translate } from './locale.utils-0c514ca8.js';
|
5
5
|
|