@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,626 @@
1
+ import { h, r as registerInstance, c as createEvent } from './index-0068c174.js';
2
+
3
+ /**
4
+ * @name setClientStyling
5
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
6
+ * @param {HTMLElement} stylingContainer The reference element of the widget
7
+ * @param {string} clientStyling The style content
8
+ */
9
+ function setClientStyling(stylingContainer, clientStyling) {
10
+ if (stylingContainer) {
11
+ const sheet = document.createElement('style');
12
+ sheet.innerHTML = clientStyling;
13
+ stylingContainer.appendChild(sheet);
14
+ }
15
+ }
16
+
17
+ /**
18
+ * @name setClientStylingURL
19
+ * @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
20
+ * @param {HTMLElement} stylingContainer The reference element of the widget
21
+ * @param {string} clientStylingUrl The URL of the style content
22
+ */
23
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
24
+ if (!stylingContainer || !clientStylingUrl) return;
25
+
26
+ const url = new URL(clientStylingUrl);
27
+
28
+ fetch(url.href)
29
+ .then((res) => res.text())
30
+ .then((data) => {
31
+ const cssFile = document.createElement('style');
32
+ cssFile.innerHTML = data;
33
+ if (stylingContainer) {
34
+ stylingContainer.appendChild(cssFile);
35
+ }
36
+ })
37
+ .catch((err) => {
38
+ console.error('There was an error while trying to load client styling from URL', err);
39
+ });
40
+ }
41
+
42
+ /**
43
+ * @name setStreamLibrary
44
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
45
+ * @param {HTMLElement} stylingContainer The highest element of the widget
46
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
47
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
48
+ */
49
+ function setStreamStyling(stylingContainer, domain, subscription) {
50
+ if (window.emMessageBus) {
51
+ const sheet = document.createElement('style');
52
+
53
+ window.emMessageBus.subscribe(domain, (data) => {
54
+ sheet.innerHTML = data;
55
+ if (stylingContainer) {
56
+ stylingContainer.appendChild(sheet);
57
+ }
58
+ });
59
+ }
60
+ }
61
+
62
+ function _typeof(o) {
63
+ "@babel/helpers - typeof";
64
+
65
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
66
+ return typeof o;
67
+ } : function (o) {
68
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
69
+ }, _typeof(o);
70
+ }
71
+
72
+ function requiredArgs(required, args) {
73
+ if (args.length < required) {
74
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
75
+ }
76
+ }
77
+
78
+ /**
79
+ * @name toDate
80
+ * @category Common Helpers
81
+ * @summary Convert the given argument to an instance of Date.
82
+ *
83
+ * @description
84
+ * Convert the given argument to an instance of Date.
85
+ *
86
+ * If the argument is an instance of Date, the function returns its clone.
87
+ *
88
+ * If the argument is a number, it is treated as a timestamp.
89
+ *
90
+ * If the argument is none of the above, the function returns Invalid Date.
91
+ *
92
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
93
+ *
94
+ * @param {Date|Number} argument - the value to convert
95
+ * @returns {Date} the parsed date in the local time zone
96
+ * @throws {TypeError} 1 argument required
97
+ *
98
+ * @example
99
+ * // Clone the date:
100
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
101
+ * //=> Tue Feb 11 2014 11:30:30
102
+ *
103
+ * @example
104
+ * // Convert the timestamp to date:
105
+ * const result = toDate(1392098430000)
106
+ * //=> Tue Feb 11 2014 11:30:30
107
+ */
108
+ function toDate(argument) {
109
+ requiredArgs(1, arguments);
110
+ var argStr = Object.prototype.toString.call(argument);
111
+
112
+ // Clone the date
113
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
114
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
115
+ return new Date(argument.getTime());
116
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
117
+ return new Date(argument);
118
+ } else {
119
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
120
+ // eslint-disable-next-line no-console
121
+ 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");
122
+ // eslint-disable-next-line no-console
123
+ console.warn(new Error().stack);
124
+ }
125
+ return new Date(NaN);
126
+ }
127
+ }
128
+
129
+ /**
130
+ * @name differenceInMilliseconds
131
+ * @category Millisecond Helpers
132
+ * @summary Get the number of milliseconds between the given dates.
133
+ *
134
+ * @description
135
+ * Get the number of milliseconds between the given dates.
136
+ *
137
+ * @param {Date|Number} dateLeft - the later date
138
+ * @param {Date|Number} dateRight - the earlier date
139
+ * @returns {Number} the number of milliseconds
140
+ * @throws {TypeError} 2 arguments required
141
+ *
142
+ * @example
143
+ * // How many milliseconds are between
144
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
145
+ * const result = differenceInMilliseconds(
146
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
147
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
148
+ * )
149
+ * //=> 1100
150
+ */
151
+ function differenceInMilliseconds(dateLeft, dateRight) {
152
+ requiredArgs(2, arguments);
153
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
154
+ }
155
+
156
+ const generateUUID = () => {
157
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
158
+ var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
159
+ return v.toString(16);
160
+ });
161
+ };
162
+ function fetchRequest(url, method = 'GET', body = null, headers = {}) {
163
+ return new Promise((resolve, reject) => {
164
+ const uuid = generateUUID();
165
+ const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
166
+ if (method !== 'GET' && method !== 'HEAD') {
167
+ headersOrigin['X-Idempotency-Key'] = uuid;
168
+ }
169
+ const options = {
170
+ method,
171
+ headers: headersOrigin,
172
+ body: null
173
+ };
174
+ if (body && method !== 'GET' && method !== 'HEAD') {
175
+ options.body = JSON.stringify(body);
176
+ }
177
+ else {
178
+ delete options.body;
179
+ }
180
+ fetch(url, options)
181
+ .then((response) => {
182
+ if (!response.ok) {
183
+ reject(`HTTP error! Status: ${response.status}`);
184
+ throw new Error(`HTTP error! Status: ${response.status}`);
185
+ }
186
+ return response.json();
187
+ })
188
+ .then((data) => resolve(data))
189
+ .catch((error) => reject(error));
190
+ });
191
+ }
192
+ function toQueryParams(params) {
193
+ function isEmptyValueOfArray(arr) {
194
+ if (arr.length === 0) {
195
+ return true;
196
+ }
197
+ const len = arr.length;
198
+ let count = 0;
199
+ for (let i = 0; i < len; i++) {
200
+ if (isEmptyValue(arr[i])) {
201
+ count++;
202
+ }
203
+ else {
204
+ return false;
205
+ }
206
+ }
207
+ if (count === len) {
208
+ return true;
209
+ }
210
+ return false;
211
+ }
212
+ function isEmptyValueOfObject(obj) {
213
+ if (Object.keys(obj).length === 0) {
214
+ return true;
215
+ }
216
+ const len = Object.keys(obj).length;
217
+ let count = 0;
218
+ for (const val of Object.values(obj)) {
219
+ if (isEmptyValue(val)) {
220
+ count++;
221
+ }
222
+ else {
223
+ return false;
224
+ }
225
+ }
226
+ if (count === len) {
227
+ return true;
228
+ }
229
+ return false;
230
+ }
231
+ function isEmptyValue(value, allowZero) {
232
+ if (value === null || value === undefined || value === '') {
233
+ return true;
234
+ }
235
+ else if (value === 0 && allowZero) {
236
+ return false;
237
+ }
238
+ else if (Array.isArray(value)) {
239
+ return isEmptyValueOfArray(value);
240
+ }
241
+ else if (Object.prototype.toString.call(value) === '[object Object]') {
242
+ return isEmptyValueOfObject(value);
243
+ }
244
+ else {
245
+ return !value;
246
+ }
247
+ }
248
+ const finalParams = {};
249
+ Object.entries(params).forEach(([key, value]) => {
250
+ if (!isEmptyValue(value, true)) {
251
+ finalParams[key] = value;
252
+ }
253
+ });
254
+ const queryString = Object.entries(finalParams)
255
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
256
+ .join('&');
257
+ return queryString ? `?${queryString}` : '';
258
+ }
259
+ function transformResults(results) {
260
+ if (results && results.length > 0) {
261
+ return results.map((i) => i === null || i === void 0 ? void 0 : i[0]);
262
+ }
263
+ return [[]];
264
+ }
265
+ function thousandSeparator(value) {
266
+ if (value === 0) {
267
+ return '0';
268
+ }
269
+ if (!value) {
270
+ return '';
271
+ }
272
+ value = value.toString();
273
+ const parts = value.split('.');
274
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
275
+ return parts.join('.');
276
+ }
277
+ function changeCurDrawItemByDate(date, drawList) {
278
+ var _a, _b, _c;
279
+ const curDrawItem = drawList.find((i) => i.date === date);
280
+ if (!curDrawItem) {
281
+ // NO DATA
282
+ return Promise.reject();
283
+ }
284
+ const curDrawSelectionBettingType = curDrawItem.winningNumbers[0].winning_type;
285
+ const curDrawSelectionMap = {};
286
+ curDrawItem.winningNumbers.forEach((item) => {
287
+ curDrawSelectionMap[item.winning_type] = transformResults(item.poolGameOutcomes);
288
+ });
289
+ const results = curDrawSelectionMap[curDrawSelectionBettingType];
290
+ const curPrizeMap = {};
291
+ curDrawItem.prizes.forEach((prize) => {
292
+ const winningType = prize.winningType;
293
+ if (!curPrizeMap[winningType]) {
294
+ curPrizeMap[winningType] = [prize];
295
+ }
296
+ else {
297
+ curPrizeMap[winningType].push(prize);
298
+ 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); });
299
+ }
300
+ });
301
+ const prizes = (((_a = Object.values(curPrizeMap)) === null || _a === void 0 ? void 0 : _a[0]) || []);
302
+ const currency = ((_c = (_b = prizes[0]) === null || _b === void 0 ? void 0 : _b.totalAmount) === null || _c === void 0 ? void 0 : _c.currency) || '';
303
+ const { turnOver, winNumber, winTurnOver } = prizes.reduce((pre, cur) => {
304
+ var _a;
305
+ const { turnOver: _turnOver, winNumber: _winNumber, winTurnOver: _winTurnOver } = pre;
306
+ // FIXME: no turnover
307
+ const turnOver = 0;
308
+ const winNumber = _winNumber + Number(cur === null || cur === void 0 ? void 0 : cur.players);
309
+ const winTurnOver = _turnOver + Number((_a = cur === null || cur === void 0 ? void 0 : cur.totalAmount) === null || _a === void 0 ? void 0 : _a.value);
310
+ return {
311
+ turnOver,
312
+ winNumber,
313
+ winTurnOver
314
+ };
315
+ }, {
316
+ turnOver: 0,
317
+ winNumber: 0,
318
+ winTurnOver: 0
319
+ });
320
+ return Promise.resolve({
321
+ date,
322
+ formattedTurnOver: currency + ' ' + thousandSeparator(turnOver),
323
+ winNumber,
324
+ formattedWinTurnOver: currency + ' ' + thousandSeparator(winTurnOver),
325
+ drawId: curDrawItem.id,
326
+ results
327
+ });
328
+ }
329
+ function findLatestDateIdx(dateArr) {
330
+ const currentDate = new Date();
331
+ let closestIndex = 0;
332
+ let minDiff = Infinity;
333
+ dateArr.forEach((dateStr, index) => {
334
+ const date = new Date(dateStr);
335
+ const diff = Math.abs(differenceInMilliseconds(currentDate, date));
336
+ if (diff < minDiff) {
337
+ minDiff = diff;
338
+ closestIndex = index;
339
+ }
340
+ });
341
+ return closestIndex;
342
+ }
343
+
344
+ async function fetchGameInfo({ endpoint, gameId }) {
345
+ if (!(endpoint && gameId))
346
+ return;
347
+ const gameInfo = await fetchRequest(`${endpoint}/games/${gameId}`, 'GET', {});
348
+ return {
349
+ vendorGameId: gameInfo === null || gameInfo === void 0 ? void 0 : gameInfo.type,
350
+ gameName: gameInfo.name
351
+ };
352
+ }
353
+ async function fetchDrawsInfo({ endpoint, gameId }) {
354
+ if (!(endpoint && gameId))
355
+ return;
356
+ const GAME_DRAW_LIMIT = 9999;
357
+ const filterData = { status: 'PAYABLE', limit: GAME_DRAW_LIMIT };
358
+ const { items: drawList } = await fetchRequest(`${endpoint}/games/${gameId}/draws${toQueryParams(filterData)}`);
359
+ if (!drawList || drawList.length === 0)
360
+ return {};
361
+ const settledDrawList = drawList
362
+ .filter((item) => item.winningNumbers.length > 0)
363
+ .sort((a, b) => a === null || a === void 0 ? void 0 : a.date.localeCompare(b === null || b === void 0 ? void 0 : b.date));
364
+ const drawDatesOptions = settledDrawList.map((item) => item.date);
365
+ return {
366
+ drawDatesOptions,
367
+ drawResultsList: settledDrawList
368
+ };
369
+ }
370
+ async function fetchSaleStatistics({ endpoint, gameId, drawId }) {
371
+ try {
372
+ const res = await fetchRequest(`${endpoint}/games/${gameId}/draws/${drawId}/saleStatistics`);
373
+ return res;
374
+ }
375
+ catch (error) {
376
+ return Promise.reject(error);
377
+ }
378
+ }
379
+
380
+ const DEFAULT_LANGUAGE = 'en';
381
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
382
+ const TRANSLATIONS = {
383
+ en: {
384
+ weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
385
+ bettingType: 'Betting Type:',
386
+ prizeAllocation: 'Prize Allocation (Turnover: €{turnover})',
387
+ prizes: 'Prizes',
388
+ numberOfWinners: 'Number of Winners',
389
+ prizeMoney: 'Prize Money',
390
+ noLatestResult: 'No latest result.',
391
+ loading: 'Loading....',
392
+ turnover: 'Turnover:',
393
+ winners: 'winners,',
394
+ prize: 'Prize:',
395
+ },
396
+ };
397
+ const translate = (key, customLang, replacements) => {
398
+ const lang = customLang;
399
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
400
+ if (replacements) {
401
+ Object.keys(replacements).forEach((placeholder) => {
402
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
403
+ });
404
+ }
405
+ return translation;
406
+ };
407
+ const getTranslations = (data) => {
408
+ Object.keys(data).forEach((item) => {
409
+ for (let key in data[item]) {
410
+ TRANSLATIONS[item][key] = data[item][key];
411
+ }
412
+ });
413
+ };
414
+ const resolveTranslationUrl = async (translationUrl) => {
415
+ if (translationUrl) {
416
+ try {
417
+ const response = await fetch(translationUrl);
418
+ if (!response.ok) {
419
+ throw new Error(`HTTP error! status: ${response.status}`);
420
+ }
421
+ const translations = await response.json();
422
+ getTranslations(translations);
423
+ }
424
+ catch (error) {
425
+ console.error('Failed to fetch or parse translations from URL:', error);
426
+ }
427
+ }
428
+ };
429
+
430
+ 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}";
431
+ const LotteryOddsbomLatestResultStyle0 = lotteryOddsbomLatestResultCss;
432
+
433
+ const BombIcons = {
434
+ ['Football']: (h("svg", { height: "18px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", class: "text-sm" }, 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" })))
435
+ };
436
+ const LotteryOddsbomLatestResult = class {
437
+ constructor(hostRef) {
438
+ registerInstance(this, hostRef);
439
+ this.getGameDrawInfoEvent = createEvent(this, "getGameDrawInfo", 7);
440
+ this.mbSource = undefined;
441
+ this.clientStyling = undefined;
442
+ this.clientStylingUrl = undefined;
443
+ this.translationUrl = '';
444
+ this.language = 'en';
445
+ this.endpoint = undefined;
446
+ this.gameId = undefined;
447
+ this.curDate = undefined;
448
+ this.showLoading = true;
449
+ this.hideWrapperEmpty = false;
450
+ this.isPassingData = false;
451
+ this.drawResults = '';
452
+ this.isEmpty = true;
453
+ this._curDate = undefined;
454
+ this.drawResultsList = [];
455
+ this.curDrawItem = {};
456
+ this.curTurnOver = 0;
457
+ this.isLoadingTurnover = false;
458
+ this.vendorGameId = undefined;
459
+ this.gameName = undefined;
460
+ this.isLoading = false;
461
+ }
462
+ handleClientStylingChange(newValue, oldValue) {
463
+ if (newValue != oldValue) {
464
+ setClientStyling(this.stylingContainer, this.clientStyling);
465
+ }
466
+ }
467
+ handleClientStylingUrlChange(newValue, oldValue) {
468
+ if (newValue != oldValue) {
469
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
470
+ }
471
+ }
472
+ handleMbSourceChange(newValue, oldValue) {
473
+ if (newValue != oldValue) {
474
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
475
+ }
476
+ }
477
+ async handleDateChange(n, o) {
478
+ if (n !== o) {
479
+ await this.setCurItem(n);
480
+ if (this.curDrawItem && this.curDrawItem.drawId) {
481
+ this.getTurnOver();
482
+ }
483
+ }
484
+ }
485
+ async handleDrawResultsChange(n, o) {
486
+ if (n !== o) {
487
+ await this.setDrawResults();
488
+ }
489
+ }
490
+ async getTurnOver() {
491
+ var _a, _b;
492
+ try {
493
+ this.isLoadingTurnover = true;
494
+ const res = await fetchSaleStatistics({
495
+ endpoint: this.endpoint,
496
+ gameId: this.vendorGameId,
497
+ drawId: this.curDrawItem.drawId
498
+ });
499
+ 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;
500
+ }
501
+ catch (e) {
502
+ console.error(e);
503
+ }
504
+ finally {
505
+ this.isLoadingTurnover = false;
506
+ }
507
+ }
508
+ get formattedTurnover() {
509
+ const turnover = this.curTurnOver;
510
+ const unit = '€';
511
+ if (turnover === null || turnover === undefined)
512
+ return '';
513
+ return `${unit}${turnover ? thousandSeparator(turnover) : 0}`;
514
+ }
515
+ async setCurItem(curDate) {
516
+ var _a;
517
+ try {
518
+ if (curDate && ((_a = this.drawResultsList) === null || _a === void 0 ? void 0 : _a.length)) {
519
+ this.curDrawItem = await changeCurDrawItemByDate(curDate, this.drawResultsList);
520
+ this.isEmpty = false;
521
+ }
522
+ else {
523
+ this.isEmpty = true;
524
+ }
525
+ }
526
+ catch (_b) {
527
+ this.isEmpty = true;
528
+ }
529
+ }
530
+ async setDrawResults() {
531
+ try {
532
+ if (this.drawResults) {
533
+ this.drawResultsList = JSON.parse(this.drawResults);
534
+ await this.setCurItem(this.curDate);
535
+ }
536
+ }
537
+ catch (err) {
538
+ console.error(err);
539
+ }
540
+ }
541
+ componentDidLoad() {
542
+ if (this.stylingContainer) {
543
+ if (this.mbSource)
544
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
545
+ if (this.clientStyling)
546
+ setClientStyling(this.stylingContainer, this.clientStyling);
547
+ if (this.clientStylingUrl)
548
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
549
+ }
550
+ }
551
+ disconnectedCallback() {
552
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
553
+ }
554
+ async getDrawData() {
555
+ if (this.isPassingData) {
556
+ this.setDrawResults();
557
+ }
558
+ else {
559
+ this.fetchData();
560
+ }
561
+ }
562
+ async getGameInfo() {
563
+ return fetchGameInfo({ endpoint: this.endpoint, gameId: this.gameId }).then(({ vendorGameId, gameName }) => {
564
+ this.vendorGameId = vendorGameId;
565
+ this.gameName = gameName;
566
+ });
567
+ }
568
+ async componentWillLoad() {
569
+ resolveTranslationUrl(this.translationUrl);
570
+ await Promise.all([this.getDrawData(), this.getGameInfo()]);
571
+ if (this.curDrawItem && this.curDrawItem.drawId) {
572
+ this.getTurnOver();
573
+ }
574
+ }
575
+ async fetchData() {
576
+ this.isLoading = true;
577
+ try {
578
+ const res = await fetchDrawsInfo({ endpoint: this.endpoint, gameId: this.gameId });
579
+ this.getGameDrawInfoEvent.emit({
580
+ drawDatesOptions: res.drawDatesOptions,
581
+ gameId: this.gameId
582
+ });
583
+ this.drawResultsList = res.drawResultsList;
584
+ this._curDate = res.drawDatesOptions[findLatestDateIdx(res.drawDatesOptions)];
585
+ await this.setCurItem(this._curDate);
586
+ }
587
+ catch (error) {
588
+ this.getGameDrawInfoEvent.emit({
589
+ drawDatesOptions: [],
590
+ gameId: this.gameId
591
+ });
592
+ }
593
+ finally {
594
+ this.isLoading = false;
595
+ }
596
+ }
597
+ renderLoading() {
598
+ return (h("div", { class: "loading-wrap" }, h("section", { class: "dots-container" }, h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }))));
599
+ }
600
+ renderEmpty() {
601
+ return null;
602
+ }
603
+ renderMainContent() {
604
+ var _a, _b, _c, _d, _e, _f;
605
+ if (!(this.curDate || this._curDate) || this.isEmpty) {
606
+ return this.renderEmpty();
607
+ }
608
+ return (h("div", { class: "lottery-tipping-latest-result" }, h("div", { class: "header-section match-info-section" }, h("div", { class: "match-details" }, h("span", { class: "title-icon" }, BombIcons.Football), h("span", { class: "title-text" }, this.gameName, ' ', this.isLoadingTurnover ? (h("div", { class: "loading-turnOver" }, h("ui-skeleton", { structure: "rectangle", width: "100px", height: "16px" }))) : (h("span", { class: "title-text__extra" }, "(", translate('turnover', this.language) + ' ' + this.formattedTurnover || 0, ")")))), h("div", { class: "prize-details" }, h("span", { class: "winners-count" }, (((_a = this.curDrawItem) === null || _a === void 0 ? void 0 : _a.winNumber) || 0) + ' ' + translate('winners', this.language)), 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) && (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 }))));
609
+ }
610
+ render() {
611
+ return (h("div", { key: '08c7308433c4d55f4cec1540002a03596155fe98', ref: (el) => (this.stylingContainer = el), class: {
612
+ 'latest-result-wrapper': true,
613
+ 'game-wrapper': !(this.hideWrapperEmpty && this.isEmpty)
614
+ } }, this.isLoading && this.showLoading ? this.renderLoading() : this.renderMainContent()));
615
+ }
616
+ static get watchers() { return {
617
+ "clientStyling": ["handleClientStylingChange"],
618
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
619
+ "mbSource": ["handleMbSourceChange"],
620
+ "curDate": ["handleDateChange"],
621
+ "drawResults": ["handleDrawResultsChange"]
622
+ }; }
623
+ };
624
+ LotteryOddsbomLatestResult.style = LotteryOddsbomLatestResultStyle0;
625
+
626
+ export { LotteryOddsbomLatestResult as L, _typeof as _, setClientStylingURL as a, setStreamStyling as b, requiredArgs as r, setClientStyling as s, toDate as t };
@@ -0,0 +1,20 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-0068c174.js';
2
+ export { s as setNonce } from './index-0068c174.js';
3
+ import { g as globalScripts } from './app-globals-0f993ce5.js';
4
+
5
+ /*
6
+ Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ var patchBrowser = () => {
9
+ const importMeta = import.meta.url;
10
+ const opts = {};
11
+ if (importMeta !== "") {
12
+ opts.resourcesUrl = new URL(".", importMeta).href;
13
+ }
14
+ return promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(async (options) => {
18
+ await globalScripts();
19
+ return bootstrapLazy([["lottery-oddsbom-bullet_4",[[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);
20
+ });
@@ -0,0 +1 @@
1
+ module.exports = require('./cjs/index.cjs.js');
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './esm/index.js';
@@ -0,0 +1 @@
1
+ const o=()=>{};export{o as g}