@everymatrix/lottery-oddsbom-latest-result 0.0.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.
Files changed (61) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-1c32912a.js +1265 -0
  3. package/dist/cjs/index.cjs.js +10 -0
  4. package/dist/cjs/loader.cjs.js +15 -0
  5. package/dist/cjs/lottery-oddsbom-bullet_4.cjs.entry.js +3153 -0
  6. package/dist/cjs/lottery-oddsbom-latest-result-04622cbf.js +634 -0
  7. package/dist/cjs/lottery-oddsbom-latest-result.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +31 -0
  9. package/dist/collection/components/lottery-oddsbom-latest-result/index.js +1 -0
  10. package/dist/collection/components/lottery-oddsbom-latest-result/lottery-oddsbom-latest-result.css +100 -0
  11. package/dist/collection/components/lottery-oddsbom-latest-result/lottery-oddsbom-latest-result.js +470 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/models/index.js +1 -0
  14. package/dist/collection/utils/api.js +36 -0
  15. package/dist/collection/utils/locale.utils.js +49 -0
  16. package/dist/collection/utils/utils.js +191 -0
  17. package/dist/esm/app-globals-0f993ce5.js +3 -0
  18. package/dist/esm/index-0068c174.js +1237 -0
  19. package/dist/esm/index.js +2 -0
  20. package/dist/esm/loader.js +11 -0
  21. package/dist/esm/lottery-oddsbom-bullet_4.entry.js +3147 -0
  22. package/dist/esm/lottery-oddsbom-latest-result-825abc49.js +626 -0
  23. package/dist/esm/lottery-oddsbom-latest-result.js +20 -0
  24. package/dist/index.cjs.js +1 -0
  25. package/dist/index.js +1 -0
  26. package/dist/lottery-oddsbom-latest-result/app-globals-0f993ce5.js +1 -0
  27. package/dist/lottery-oddsbom-latest-result/index-0068c174.js +2 -0
  28. package/dist/lottery-oddsbom-latest-result/index.esm.js +1 -0
  29. package/dist/lottery-oddsbom-latest-result/lottery-oddsbom-bullet_4.entry.js +1 -0
  30. package/dist/lottery-oddsbom-latest-result/lottery-oddsbom-latest-result-825abc49.js +1 -0
  31. package/dist/lottery-oddsbom-latest-result/lottery-oddsbom-latest-result.esm.js +1 -0
  32. package/dist/stencil.config.dev.js +19 -0
  33. package/dist/stencil.config.js +19 -0
  34. package/dist/storybook/main.js +43 -0
  35. package/dist/storybook/preview.js +9 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result/.stencil/packages/stencil/lottery-oddsbom-latest-result/stencil.config.d.ts +2 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result/.stencil/packages/stencil/lottery-oddsbom-latest-result/stencil.config.dev.d.ts +2 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result/.stencil/packages/stencil/lottery-oddsbom-latest-result/storybook/main.d.ts +3 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result/.stencil/packages/stencil/lottery-oddsbom-latest-result/storybook/preview.d.ts +70 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result/.stencil/tools/plugins/index.d.ts +4 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  45. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  46. package/dist/types/components/lottery-oddsbom-latest-result/index.d.ts +1 -0
  47. package/dist/types/components/lottery-oddsbom-latest-result/lottery-oddsbom-latest-result.d.ts +67 -0
  48. package/dist/types/components.d.ts +115 -0
  49. package/dist/types/index.d.ts +1 -0
  50. package/dist/types/models/index.d.ts +172 -0
  51. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  52. package/dist/types/utils/api.d.ts +14 -0
  53. package/dist/types/utils/locale.utils.d.ts +3 -0
  54. package/dist/types/utils/utils.d.ts +8 -0
  55. package/loader/cdn.js +1 -0
  56. package/loader/index.cjs.js +1 -0
  57. package/loader/index.d.ts +24 -0
  58. package/loader/index.es2017.js +1 -0
  59. package/loader/index.js +2 -0
  60. package/loader/package.json +11 -0
  61. package/package.json +27 -0
@@ -0,0 +1,634 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-1c32912a.js');
4
+
5
+ /**
6
+ * @name setClientStyling
7
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
8
+ * @param {HTMLElement} stylingContainer The reference element of the widget
9
+ * @param {string} clientStyling The style content
10
+ */
11
+ function setClientStyling(stylingContainer, clientStyling) {
12
+ if (stylingContainer) {
13
+ const sheet = document.createElement('style');
14
+ sheet.innerHTML = clientStyling;
15
+ stylingContainer.appendChild(sheet);
16
+ }
17
+ }
18
+
19
+ /**
20
+ * @name setClientStylingURL
21
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
22
+ * @param {HTMLElement} stylingContainer The reference element of the widget
23
+ * @param {string} clientStylingUrl The URL of the style content
24
+ */
25
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
26
+ if (!stylingContainer || !clientStylingUrl) return;
27
+
28
+ const url = new URL(clientStylingUrl);
29
+
30
+ fetch(url.href)
31
+ .then((res) => res.text())
32
+ .then((data) => {
33
+ const cssFile = document.createElement('style');
34
+ cssFile.innerHTML = data;
35
+ if (stylingContainer) {
36
+ stylingContainer.appendChild(cssFile);
37
+ }
38
+ })
39
+ .catch((err) => {
40
+ console.error('There was an error while trying to load client styling from URL', err);
41
+ });
42
+ }
43
+
44
+ /**
45
+ * @name setStreamLibrary
46
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
47
+ * @param {HTMLElement} stylingContainer The highest element of the widget
48
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
49
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
50
+ */
51
+ function setStreamStyling(stylingContainer, domain, subscription) {
52
+ if (window.emMessageBus) {
53
+ const sheet = document.createElement('style');
54
+
55
+ window.emMessageBus.subscribe(domain, (data) => {
56
+ sheet.innerHTML = data;
57
+ if (stylingContainer) {
58
+ stylingContainer.appendChild(sheet);
59
+ }
60
+ });
61
+ }
62
+ }
63
+
64
+ function _typeof(o) {
65
+ "@babel/helpers - typeof";
66
+
67
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
68
+ return typeof o;
69
+ } : function (o) {
70
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
71
+ }, _typeof(o);
72
+ }
73
+
74
+ function requiredArgs(required, args) {
75
+ if (args.length < required) {
76
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
77
+ }
78
+ }
79
+
80
+ /**
81
+ * @name toDate
82
+ * @category Common Helpers
83
+ * @summary Convert the given argument to an instance of Date.
84
+ *
85
+ * @description
86
+ * Convert the given argument to an instance of Date.
87
+ *
88
+ * If the argument is an instance of Date, the function returns its clone.
89
+ *
90
+ * If the argument is a number, it is treated as a timestamp.
91
+ *
92
+ * If the argument is none of the above, the function returns Invalid Date.
93
+ *
94
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
95
+ *
96
+ * @param {Date|Number} argument - the value to convert
97
+ * @returns {Date} the parsed date in the local time zone
98
+ * @throws {TypeError} 1 argument required
99
+ *
100
+ * @example
101
+ * // Clone the date:
102
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
103
+ * //=> Tue Feb 11 2014 11:30:30
104
+ *
105
+ * @example
106
+ * // Convert the timestamp to date:
107
+ * const result = toDate(1392098430000)
108
+ * //=> Tue Feb 11 2014 11:30:30
109
+ */
110
+ function toDate(argument) {
111
+ requiredArgs(1, arguments);
112
+ var argStr = Object.prototype.toString.call(argument);
113
+
114
+ // Clone the date
115
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
116
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
117
+ return new Date(argument.getTime());
118
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
119
+ return new Date(argument);
120
+ } else {
121
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
122
+ // eslint-disable-next-line no-console
123
+ 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");
124
+ // eslint-disable-next-line no-console
125
+ console.warn(new Error().stack);
126
+ }
127
+ return new Date(NaN);
128
+ }
129
+ }
130
+
131
+ /**
132
+ * @name differenceInMilliseconds
133
+ * @category Millisecond Helpers
134
+ * @summary Get the number of milliseconds between the given dates.
135
+ *
136
+ * @description
137
+ * Get the number of milliseconds between the given dates.
138
+ *
139
+ * @param {Date|Number} dateLeft - the later date
140
+ * @param {Date|Number} dateRight - the earlier date
141
+ * @returns {Number} the number of milliseconds
142
+ * @throws {TypeError} 2 arguments required
143
+ *
144
+ * @example
145
+ * // How many milliseconds are between
146
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
147
+ * const result = differenceInMilliseconds(
148
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
149
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
150
+ * )
151
+ * //=> 1100
152
+ */
153
+ function differenceInMilliseconds(dateLeft, dateRight) {
154
+ requiredArgs(2, arguments);
155
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
156
+ }
157
+
158
+ const generateUUID = () => {
159
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
160
+ var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
161
+ return v.toString(16);
162
+ });
163
+ };
164
+ function fetchRequest(url, method = 'GET', body = null, headers = {}) {
165
+ return new Promise((resolve, reject) => {
166
+ const uuid = generateUUID();
167
+ const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
168
+ if (method !== 'GET' && method !== 'HEAD') {
169
+ headersOrigin['X-Idempotency-Key'] = uuid;
170
+ }
171
+ const options = {
172
+ method,
173
+ headers: headersOrigin,
174
+ body: null
175
+ };
176
+ if (body && method !== 'GET' && method !== 'HEAD') {
177
+ options.body = JSON.stringify(body);
178
+ }
179
+ else {
180
+ delete options.body;
181
+ }
182
+ fetch(url, options)
183
+ .then((response) => {
184
+ if (!response.ok) {
185
+ reject(`HTTP error! Status: ${response.status}`);
186
+ throw new Error(`HTTP error! Status: ${response.status}`);
187
+ }
188
+ return response.json();
189
+ })
190
+ .then((data) => resolve(data))
191
+ .catch((error) => reject(error));
192
+ });
193
+ }
194
+ function toQueryParams(params) {
195
+ function isEmptyValueOfArray(arr) {
196
+ if (arr.length === 0) {
197
+ return true;
198
+ }
199
+ const len = arr.length;
200
+ let count = 0;
201
+ for (let i = 0; i < len; i++) {
202
+ if (isEmptyValue(arr[i])) {
203
+ count++;
204
+ }
205
+ else {
206
+ return false;
207
+ }
208
+ }
209
+ if (count === len) {
210
+ return true;
211
+ }
212
+ return false;
213
+ }
214
+ function isEmptyValueOfObject(obj) {
215
+ if (Object.keys(obj).length === 0) {
216
+ return true;
217
+ }
218
+ const len = Object.keys(obj).length;
219
+ let count = 0;
220
+ for (const val of Object.values(obj)) {
221
+ if (isEmptyValue(val)) {
222
+ count++;
223
+ }
224
+ else {
225
+ return false;
226
+ }
227
+ }
228
+ if (count === len) {
229
+ return true;
230
+ }
231
+ return false;
232
+ }
233
+ function isEmptyValue(value, allowZero) {
234
+ if (value === null || value === undefined || value === '') {
235
+ return true;
236
+ }
237
+ else if (value === 0 && allowZero) {
238
+ return false;
239
+ }
240
+ else if (Array.isArray(value)) {
241
+ return isEmptyValueOfArray(value);
242
+ }
243
+ else if (Object.prototype.toString.call(value) === '[object Object]') {
244
+ return isEmptyValueOfObject(value);
245
+ }
246
+ else {
247
+ return !value;
248
+ }
249
+ }
250
+ const finalParams = {};
251
+ Object.entries(params).forEach(([key, value]) => {
252
+ if (!isEmptyValue(value, true)) {
253
+ finalParams[key] = value;
254
+ }
255
+ });
256
+ const queryString = Object.entries(finalParams)
257
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
258
+ .join('&');
259
+ return queryString ? `?${queryString}` : '';
260
+ }
261
+ function transformResults(results) {
262
+ if (results && results.length > 0) {
263
+ return results.map((i) => i === null || i === void 0 ? void 0 : i[0]);
264
+ }
265
+ return [[]];
266
+ }
267
+ function thousandSeparator(value) {
268
+ if (value === 0) {
269
+ return '0';
270
+ }
271
+ if (!value) {
272
+ return '';
273
+ }
274
+ value = value.toString();
275
+ const parts = value.split('.');
276
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
277
+ return parts.join('.');
278
+ }
279
+ function changeCurDrawItemByDate(date, drawList) {
280
+ var _a, _b, _c;
281
+ const curDrawItem = drawList.find((i) => i.date === date);
282
+ if (!curDrawItem) {
283
+ // NO DATA
284
+ return Promise.reject();
285
+ }
286
+ const curDrawSelectionBettingType = curDrawItem.winningNumbers[0].winning_type;
287
+ const curDrawSelectionMap = {};
288
+ curDrawItem.winningNumbers.forEach((item) => {
289
+ curDrawSelectionMap[item.winning_type] = transformResults(item.poolGameOutcomes);
290
+ });
291
+ const results = curDrawSelectionMap[curDrawSelectionBettingType];
292
+ const curPrizeMap = {};
293
+ curDrawItem.prizes.forEach((prize) => {
294
+ const winningType = prize.winningType;
295
+ if (!curPrizeMap[winningType]) {
296
+ curPrizeMap[winningType] = [prize];
297
+ }
298
+ else {
299
+ curPrizeMap[winningType].push(prize);
300
+ curPrizeMap[winningType].sort((a, b) => { var _a; return ((_a = b.totalAmount) === null || _a === void 0 ? void 0 : _a.value) - (a === null || a === void 0 ? void 0 : a.totalAmount.value); });
301
+ }
302
+ });
303
+ const prizes = (((_a = Object.values(curPrizeMap)) === null || _a === void 0 ? void 0 : _a[0]) || []);
304
+ const currency = ((_c = (_b = prizes[0]) === null || _b === void 0 ? void 0 : _b.totalAmount) === null || _c === void 0 ? void 0 : _c.currency) || '';
305
+ const { turnOver, winNumber, winTurnOver } = prizes.reduce((pre, cur) => {
306
+ var _a;
307
+ const { turnOver: _turnOver, winNumber: _winNumber, winTurnOver: _winTurnOver } = pre;
308
+ // FIXME: no turnover
309
+ const turnOver = 0;
310
+ const winNumber = _winNumber + Number(cur === null || cur === void 0 ? void 0 : cur.players);
311
+ const winTurnOver = _turnOver + Number((_a = cur === null || cur === void 0 ? void 0 : cur.totalAmount) === null || _a === void 0 ? void 0 : _a.value);
312
+ return {
313
+ turnOver,
314
+ winNumber,
315
+ winTurnOver
316
+ };
317
+ }, {
318
+ turnOver: 0,
319
+ winNumber: 0,
320
+ winTurnOver: 0
321
+ });
322
+ return Promise.resolve({
323
+ date,
324
+ formattedTurnOver: currency + ' ' + thousandSeparator(turnOver),
325
+ winNumber,
326
+ formattedWinTurnOver: currency + ' ' + thousandSeparator(winTurnOver),
327
+ drawId: curDrawItem.id,
328
+ results
329
+ });
330
+ }
331
+ function findLatestDateIdx(dateArr) {
332
+ const currentDate = new Date();
333
+ let closestIndex = 0;
334
+ let minDiff = Infinity;
335
+ dateArr.forEach((dateStr, index) => {
336
+ const date = new Date(dateStr);
337
+ const diff = Math.abs(differenceInMilliseconds(currentDate, date));
338
+ if (diff < minDiff) {
339
+ minDiff = diff;
340
+ closestIndex = index;
341
+ }
342
+ });
343
+ return closestIndex;
344
+ }
345
+
346
+ async function fetchGameInfo({ endpoint, gameId }) {
347
+ if (!(endpoint && gameId))
348
+ return;
349
+ const gameInfo = await fetchRequest(`${endpoint}/games/${gameId}`, 'GET', {});
350
+ return {
351
+ vendorGameId: gameInfo === null || gameInfo === void 0 ? void 0 : gameInfo.type,
352
+ gameName: gameInfo.name
353
+ };
354
+ }
355
+ async function fetchDrawsInfo({ endpoint, gameId }) {
356
+ if (!(endpoint && gameId))
357
+ return;
358
+ const GAME_DRAW_LIMIT = 9999;
359
+ const filterData = { status: 'PAYABLE', limit: GAME_DRAW_LIMIT };
360
+ const { items: drawList } = await fetchRequest(`${endpoint}/games/${gameId}/draws${toQueryParams(filterData)}`);
361
+ if (!drawList || drawList.length === 0)
362
+ return {};
363
+ const settledDrawList = drawList
364
+ .filter((item) => item.winningNumbers.length > 0)
365
+ .sort((a, b) => a === null || a === void 0 ? void 0 : a.date.localeCompare(b === null || b === void 0 ? void 0 : b.date));
366
+ const drawDatesOptions = settledDrawList.map((item) => item.date);
367
+ return {
368
+ drawDatesOptions,
369
+ drawResultsList: settledDrawList
370
+ };
371
+ }
372
+ async function fetchSaleStatistics({ endpoint, gameId, drawId }) {
373
+ try {
374
+ const res = await fetchRequest(`${endpoint}/games/${gameId}/draws/${drawId}/saleStatistics`);
375
+ return res;
376
+ }
377
+ catch (error) {
378
+ return Promise.reject(error);
379
+ }
380
+ }
381
+
382
+ const DEFAULT_LANGUAGE = 'en';
383
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
384
+ const TRANSLATIONS = {
385
+ en: {
386
+ weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
387
+ bettingType: 'Betting Type:',
388
+ prizeAllocation: 'Prize Allocation (Turnover: €{turnover})',
389
+ prizes: 'Prizes',
390
+ numberOfWinners: 'Number of Winners',
391
+ prizeMoney: 'Prize Money',
392
+ noLatestResult: 'No latest result.',
393
+ loading: 'Loading....',
394
+ turnover: 'Turnover:',
395
+ winners: 'winners,',
396
+ prize: 'Prize:',
397
+ },
398
+ };
399
+ const translate = (key, customLang, replacements) => {
400
+ const lang = customLang;
401
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
402
+ if (replacements) {
403
+ Object.keys(replacements).forEach((placeholder) => {
404
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
405
+ });
406
+ }
407
+ return translation;
408
+ };
409
+ const getTranslations = (data) => {
410
+ Object.keys(data).forEach((item) => {
411
+ for (let key in data[item]) {
412
+ TRANSLATIONS[item][key] = data[item][key];
413
+ }
414
+ });
415
+ };
416
+ const resolveTranslationUrl = async (translationUrl) => {
417
+ if (translationUrl) {
418
+ try {
419
+ const response = await fetch(translationUrl);
420
+ if (!response.ok) {
421
+ throw new Error(`HTTP error! status: ${response.status}`);
422
+ }
423
+ const translations = await response.json();
424
+ getTranslations(translations);
425
+ }
426
+ catch (error) {
427
+ console.error('Failed to fetch or parse translations from URL:', error);
428
+ }
429
+ }
430
+ };
431
+
432
+ const lotteryOddsbomLatestResultCss = ".lottery-tipping-latest-result{container-type:inline-size;background:var(--emw--color-background, #fff);color:var(--emw--color-typography, #000)}.lottery-tipping-latest-result .header-section{display:flex;justify-content:center;align-items:center}.lottery-tipping-latest-result .match-info-section{justify-content:space-between;padding:15px 0px;height:18px}.lottery-tipping-latest-result .match-details,.lottery-tipping-latest-result .prize-details{font-weight:600;display:flex;align-items:center}.lottery-tipping-latest-result .match-details .title-icon{margin-right:8px;display:flex}.lottery-tipping-latest-result .match-details .title-text__extra{margin-left:5px}.lottery-tipping-latest-result .prize-details .winners-count{margin-right:5px}.loading-wrap{margin:20px 0;display:flex;align-items:center;justify-content:center;min-height:100px}.loading-wrap .dots-container{display:flex;align-items:center;justify-content:center;height:100%;width:100%}.loading-wrap .dot{height:14px;width:14px;margin-right:14px;border-radius:14px;background-color:var(--emw--color-gray-300, #333);animation:pulse 1.5s infinite ease-in-out}.loading-wrap .dot:last-child{margin-right:0}.loading-wrap .dot:nth-child(1){animation-delay:-0.3s}.loading-wrap .dot:nth-child(2){animation-delay:-0.1s}.loading-wrap .dot:nth-child(3){animation-delay:0.1s}@keyframes pulse{0%{transform:scale(0.8);background-color:var(--emw--color-gray-300, #333)}50%{transform:scale(1.2);background-color:var(--emw--color-gray-100, #e6e6e6)}100%{transform:scale(0.8);background-color:var(--emw--color-gray-150, #6f6f6f)}}.latest-result-wrapper{background:var(--emw--color-background, #fff)}.latest-result-wrapper.game-wrapper{border:1px solid var(--emw--color-background-tertiary, #ccc);border-radius:8px;box-shadow:0 2px 4px var(--emw--color-background-tertiary, #ccc);overflow-x:auto;transition:box-shadow 0.3s ease;padding:20px}.latest-result-wrapper.game-wrapper:hover{box-shadow:0 4px 12px var(--emw--color-background-tertiary, #ccc)}.loading-turnOver{display:inline-flex;align-items:center}";
433
+ const LotteryOddsbomLatestResultStyle0 = lotteryOddsbomLatestResultCss;
434
+
435
+ const BombIcons = {
436
+ ['Football']: (index.h("svg", { height: "18px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", class: "text-sm" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M19.063 19.072l-.81-.97-.117.083.385-2.43.136-.211 2.23-3.464.037-.057h1.075a9.964 9.964 0 01-2.936 7.049zM4.769 5.112l2.8.877-.072 3.246-2.427 2.95-1.561-.153L2.39 9.26a9.977 9.977 0 012.378-4.148zm7.745-3.086l-.72 1.645-3.798 1.404-2.395-.75A9.953 9.953 0 0112 2c.174 0 .343.017.514.026zm7.346 3.812l-1.128 1.29-3.402-.755-.033-.008-2.446-2.241.057.016.862-1.973a9.996 9.996 0 016.09 3.67zm-1.87 8.894l-3.385-.493-1.358-4.067 2.173-2.755 3.144.698 1.347 3.634-1.921 2.983zm-4.64 5.787l4.304-1.486.62.742a9.945 9.945 0 01-5.878 2.205l.954-1.461zm-6.314-2.84l3.91.873-.001.003 1.509 1.507-1.24 1.898a9.946 9.946 0 01-5.908-2.553l1.73-1.728zm1.16-7.72l4.168.725 1.302 3.9-2.552 2.98-3.97-.885-1.412-3.724L8.196 9.96zM2 12c0-.31.019-.615.047-.92l.485 1.203-.454.907A9.934 9.934 0 012 11.999zM12 1C5.934 1 1 5.935 1 12c0 6.067 4.935 11 11 11 6.066 0 11-4.933 11-11 0-6.065-4.934-11-11-11z", fill: "currentColor" })))
437
+ };
438
+ const LotteryOddsbomLatestResult = class {
439
+ constructor(hostRef) {
440
+ index.registerInstance(this, hostRef);
441
+ this.getGameDrawInfoEvent = index.createEvent(this, "getGameDrawInfo", 7);
442
+ this.mbSource = undefined;
443
+ this.clientStyling = undefined;
444
+ this.clientStylingUrl = undefined;
445
+ this.translationUrl = '';
446
+ this.language = 'en';
447
+ this.endpoint = undefined;
448
+ this.gameId = undefined;
449
+ this.curDate = undefined;
450
+ this.showLoading = true;
451
+ this.hideWrapperEmpty = false;
452
+ this.isPassingData = false;
453
+ this.drawResults = '';
454
+ this.isEmpty = true;
455
+ this._curDate = undefined;
456
+ this.drawResultsList = [];
457
+ this.curDrawItem = {};
458
+ this.curTurnOver = 0;
459
+ this.isLoadingTurnover = false;
460
+ this.vendorGameId = undefined;
461
+ this.gameName = undefined;
462
+ this.isLoading = false;
463
+ }
464
+ handleClientStylingChange(newValue, oldValue) {
465
+ if (newValue != oldValue) {
466
+ setClientStyling(this.stylingContainer, this.clientStyling);
467
+ }
468
+ }
469
+ handleClientStylingUrlChange(newValue, oldValue) {
470
+ if (newValue != oldValue) {
471
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
472
+ }
473
+ }
474
+ handleMbSourceChange(newValue, oldValue) {
475
+ if (newValue != oldValue) {
476
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
477
+ }
478
+ }
479
+ async handleDateChange(n, o) {
480
+ if (n !== o) {
481
+ await this.setCurItem(n);
482
+ if (this.curDrawItem && this.curDrawItem.drawId) {
483
+ this.getTurnOver();
484
+ }
485
+ }
486
+ }
487
+ async handleDrawResultsChange(n, o) {
488
+ if (n !== o) {
489
+ await this.setDrawResults();
490
+ }
491
+ }
492
+ async getTurnOver() {
493
+ var _a, _b;
494
+ try {
495
+ this.isLoadingTurnover = true;
496
+ const res = await fetchSaleStatistics({
497
+ endpoint: this.endpoint,
498
+ gameId: this.vendorGameId,
499
+ drawId: this.curDrawItem.drawId
500
+ });
501
+ this.curTurnOver = (_b = (_a = res === null || res === void 0 ? void 0 : res.wagerSegment) === null || _a === void 0 ? void 0 : _a.totalSalesCrossDraw) !== null && _b !== void 0 ? _b : 0;
502
+ }
503
+ catch (e) {
504
+ console.error(e);
505
+ }
506
+ finally {
507
+ this.isLoadingTurnover = false;
508
+ }
509
+ }
510
+ get formattedTurnover() {
511
+ const turnover = this.curTurnOver;
512
+ const unit = '€';
513
+ if (turnover === null || turnover === undefined)
514
+ return '';
515
+ return `${unit}${turnover ? thousandSeparator(turnover) : 0}`;
516
+ }
517
+ async setCurItem(curDate) {
518
+ var _a;
519
+ try {
520
+ if (curDate && ((_a = this.drawResultsList) === null || _a === void 0 ? void 0 : _a.length)) {
521
+ this.curDrawItem = await changeCurDrawItemByDate(curDate, this.drawResultsList);
522
+ this.isEmpty = false;
523
+ }
524
+ else {
525
+ this.isEmpty = true;
526
+ }
527
+ }
528
+ catch (_b) {
529
+ this.isEmpty = true;
530
+ }
531
+ }
532
+ async setDrawResults() {
533
+ try {
534
+ if (this.drawResults) {
535
+ this.drawResultsList = JSON.parse(this.drawResults);
536
+ await this.setCurItem(this.curDate);
537
+ }
538
+ }
539
+ catch (err) {
540
+ console.error(err);
541
+ }
542
+ }
543
+ componentDidLoad() {
544
+ if (this.stylingContainer) {
545
+ if (this.mbSource)
546
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
547
+ if (this.clientStyling)
548
+ setClientStyling(this.stylingContainer, this.clientStyling);
549
+ if (this.clientStylingUrl)
550
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
551
+ }
552
+ }
553
+ disconnectedCallback() {
554
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
555
+ }
556
+ async getDrawData() {
557
+ if (this.isPassingData) {
558
+ this.setDrawResults();
559
+ }
560
+ else {
561
+ this.fetchData();
562
+ }
563
+ }
564
+ async getGameInfo() {
565
+ return fetchGameInfo({ endpoint: this.endpoint, gameId: this.gameId }).then(({ vendorGameId, gameName }) => {
566
+ this.vendorGameId = vendorGameId;
567
+ this.gameName = gameName;
568
+ });
569
+ }
570
+ async componentWillLoad() {
571
+ resolveTranslationUrl(this.translationUrl);
572
+ await Promise.all([this.getDrawData(), this.getGameInfo()]);
573
+ if (this.curDrawItem && this.curDrawItem.drawId) {
574
+ this.getTurnOver();
575
+ }
576
+ }
577
+ async fetchData() {
578
+ this.isLoading = true;
579
+ try {
580
+ const res = await fetchDrawsInfo({ endpoint: this.endpoint, gameId: this.gameId });
581
+ this.getGameDrawInfoEvent.emit({
582
+ drawDatesOptions: res.drawDatesOptions,
583
+ gameId: this.gameId
584
+ });
585
+ this.drawResultsList = res.drawResultsList;
586
+ this._curDate = res.drawDatesOptions[findLatestDateIdx(res.drawDatesOptions)];
587
+ await this.setCurItem(this._curDate);
588
+ }
589
+ catch (error) {
590
+ this.getGameDrawInfoEvent.emit({
591
+ drawDatesOptions: [],
592
+ gameId: this.gameId
593
+ });
594
+ }
595
+ finally {
596
+ this.isLoading = false;
597
+ }
598
+ }
599
+ renderLoading() {
600
+ return (index.h("div", { class: "loading-wrap" }, index.h("section", { class: "dots-container" }, index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }))));
601
+ }
602
+ renderEmpty() {
603
+ return null;
604
+ }
605
+ renderMainContent() {
606
+ var _a, _b, _c, _d, _e, _f;
607
+ if (!(this.curDate || this._curDate) || this.isEmpty) {
608
+ return this.renderEmpty();
609
+ }
610
+ return (index.h("div", { class: "lottery-tipping-latest-result" }, index.h("div", { class: "header-section match-info-section" }, index.h("div", { class: "match-details" }, index.h("span", { class: "title-icon" }, BombIcons.Football), index.h("span", { class: "title-text" }, this.gameName, ' ', this.isLoadingTurnover ? (index.h("div", { class: "loading-turnOver" }, index.h("ui-skeleton", { structure: "rectangle", width: "100px", height: "16px" }))) : (index.h("span", { class: "title-text__extra" }, "(", translate('turnover', this.language) + ' ' + this.formattedTurnover || 0, ")")))), index.h("div", { class: "prize-details" }, index.h("span", { class: "winners-count" }, (((_a = this.curDrawItem) === null || _a === void 0 ? void 0 : _a.winNumber) || 0) + ' ' + translate('winners', this.language)), index.h("span", { class: "prize-amount" }, translate('prize', this.language) + ' ' + (((_b = this.curDrawItem) === null || _b === void 0 ? void 0 : _b.formattedWinTurnOver) || 0)))), !!(((_c = this.curDrawItem) === null || _c === void 0 ? void 0 : _c.drawId) || (((_d = this.curDrawItem) === null || _d === void 0 ? void 0 : _d.results) || []).length) && (index.h("lottery-oddsbom-ticket-result", { language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "translation-url": this.translationUrl, endpoint: this.endpoint, "game-id": this.vendorGameId, "draw-id": (_e = this.curDrawItem) === null || _e === void 0 ? void 0 : _e.drawId, "default-results": JSON.stringify(((_f = this.curDrawItem) === null || _f === void 0 ? void 0 : _f.results) || []), "split-view": false }))));
611
+ }
612
+ render() {
613
+ return (index.h("div", { key: '08c7308433c4d55f4cec1540002a03596155fe98', ref: (el) => (this.stylingContainer = el), class: {
614
+ 'latest-result-wrapper': true,
615
+ 'game-wrapper': !(this.hideWrapperEmpty && this.isEmpty)
616
+ } }, this.isLoading && this.showLoading ? this.renderLoading() : this.renderMainContent()));
617
+ }
618
+ static get watchers() { return {
619
+ "clientStyling": ["handleClientStylingChange"],
620
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
621
+ "mbSource": ["handleMbSourceChange"],
622
+ "curDate": ["handleDateChange"],
623
+ "drawResults": ["handleDrawResultsChange"]
624
+ }; }
625
+ };
626
+ LotteryOddsbomLatestResult.style = LotteryOddsbomLatestResultStyle0;
627
+
628
+ exports.LotteryOddsbomLatestResult = LotteryOddsbomLatestResult;
629
+ exports._typeof = _typeof;
630
+ exports.requiredArgs = requiredArgs;
631
+ exports.setClientStyling = setClientStyling;
632
+ exports.setClientStylingURL = setClientStylingURL;
633
+ exports.setStreamStyling = setStreamStyling;
634
+ exports.toDate = toDate;
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-1c32912a.js');
6
+ const appGlobals = require('./app-globals-3a1e7e63.js');
7
+
8
+ /*
9
+ Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
10
+ */
11
+ var patchBrowser = () => {
12
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('lottery-oddsbom-latest-result.cjs.js', document.baseURI).href));
13
+ const opts = {};
14
+ if (importMeta !== "") {
15
+ opts.resourcesUrl = new URL(".", importMeta).href;
16
+ }
17
+ return index.promiseResolve(opts);
18
+ };
19
+
20
+ patchBrowser().then(async (options) => {
21
+ await appGlobals.globalScripts();
22
+ return index.bootstrapLazy([["lottery-oddsbom-bullet_4.cjs",[[1,"lottery-oddsbom-latest-result",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"endpoint":[513],"gameId":[513,"game-id"],"curDate":[513,"cur-date"],"showLoading":[516,"show-loading"],"hideWrapperEmpty":[516,"hide-wrapper-empty"],"isPassingData":[516,"is-passing-data"],"drawResults":[513,"draw-results"],"isEmpty":[32],"_curDate":[32],"drawResultsList":[32],"curDrawItem":[32],"curTurnOver":[32],"isLoadingTurnover":[32],"vendorGameId":[32],"gameName":[32],"isLoading":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"curDate":["handleDateChange"],"drawResults":["handleDrawResultsChange"]}],[1,"lottery-oddsbom-ticket-result",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"sessionId":[513,"session-id"],"endpoint":[513],"gameId":[513,"game-id"],"drawId":[513,"draw-id"],"defaultResults":[513,"default-results"],"splitView":[516,"split-view"],"allResults":[32],"ticketBetDataSource":[32],"isLoading":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"gameId":["fetchMatchData"],"drawId":["fetchMatchData"],"defaultResults":["fetchMatchData"]}],[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[8,"border-radius"],"marginBottom":[8,"margin-bottom"],"marginTop":[8,"margin-top"],"marginLeft":[8,"margin-left"],"marginRight":[8,"margin-right"],"animation":[4],"rows":[2],"size":[1]},null,{"structure":["handleStructureChange"]}],[1,"lottery-oddsbom-bullet",{"isSelected":[516,"is-selected"],"disabled":[516],"text":[513],"idx":[514],"isReading":[516,"is-reading"],"isDeleteByIcon":[516,"is-delete-by-icon"],"isCallDialogBtn":[516,"is-call-dialog-btn"],"isAddedByMoreBtn":[516,"is-added-by-more-btn"],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
23
+ });
24
+
25
+ exports.setNonce = index.setNonce;