@everymatrix/lottery-oddsbom-latest-result-group 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.
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/helper-date-navigator_6.cjs.entry.js +10586 -0
- package/dist/cjs/index-6e8dce5e.js +1265 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/lottery-oddsbom-latest-result-group-51987144.js +451 -0
- package/dist/cjs/lottery-oddsbom-latest-result-group.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +43 -0
- package/dist/collection/components/lottery-oddsbom-latest-result-group/index.js +1 -0
- package/dist/collection/components/lottery-oddsbom-latest-result-group/lottery-oddsbom-latest-result-group.css +64 -0
- package/dist/collection/components/lottery-oddsbom-latest-result-group/lottery-oddsbom-latest-result-group.js +306 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/models/index.js +1 -0
- package/dist/collection/utils/api.js +39 -0
- package/dist/collection/utils/utils.js +134 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/helper-date-navigator_6.entry.js +10578 -0
- package/dist/esm/index-f1cb78c1.js +1237 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/lottery-oddsbom-latest-result-group-7f3fc378.js +442 -0
- package/dist/esm/lottery-oddsbom-latest-result-group.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/lottery-oddsbom-latest-result-group/app-globals-0f993ce5.js +1 -0
- package/dist/lottery-oddsbom-latest-result-group/helper-date-navigator_6.entry.js +6657 -0
- package/dist/lottery-oddsbom-latest-result-group/index-f1cb78c1.js +2 -0
- package/dist/lottery-oddsbom-latest-result-group/index.esm.js +1 -0
- package/dist/lottery-oddsbom-latest-result-group/lottery-oddsbom-latest-result-group-7f3fc378.js +1 -0
- package/dist/lottery-oddsbom-latest-result-group/lottery-oddsbom-latest-result-group.esm.js +1 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +19 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result-group/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result-group/.stencil/packages/stencil/lottery-oddsbom-latest-result-group/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result-group/.stencil/packages/stencil/lottery-oddsbom-latest-result-group/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result-group/.stencil/packages/stencil/lottery-oddsbom-latest-result-group/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result-group/.stencil/packages/stencil/lottery-oddsbom-latest-result-group/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result-group/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result-group/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result-group/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result-group/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-latest-result-group/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/lottery-oddsbom-latest-result-group/index.d.ts +1 -0
- package/dist/types/components/lottery-oddsbom-latest-result-group/lottery-oddsbom-latest-result-group.d.ts +60 -0
- package/dist/types/components.d.ts +103 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/index.d.ts +156 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/api.d.ts +7 -0
- package/dist/types/utils/utils.d.ts +7 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +27 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { b as bootstrapLazy } from './index-f1cb78c1.js';
|
|
2
|
+
export { s as setNonce } from './index-f1cb78c1.js';
|
|
3
|
+
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
4
|
+
|
|
5
|
+
const defineCustomElements = async (win, options) => {
|
|
6
|
+
if (typeof window === 'undefined') return undefined;
|
|
7
|
+
await globalScripts();
|
|
8
|
+
return bootstrapLazy([["helper-date-navigator_6",[[1,"lottery-oddsbom-latest-result-group",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"endpoint":[513],"sessionId":[513,"session-id"],"playerId":[513,"player-id"],"gameIds":[513,"game-ids"],"gameIdArr":[32],"drawDatesOptions":[32],"curDate":[32],"isLoading":[32],"drawResultsObj":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"gameIds":["handleGameIdStringChange"]}],[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,"helper-date-navigator",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"date":[1],"defaultHighlightDates":[1,"default-highlight-dates"],"highlightDates":[32],"weeks":[32],"days":[32],"alterDate":[32],"curDate":[32],"recordInfo":[32],"showCalendar":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"defaultHighlightDates":["handleGameIdStringChange"],"date":["handleDateChange"]}],[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);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { defineCustomElements };
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { r as registerInstance, h } from './index-f1cb78c1.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 findLatestDateIdx(dateArr) {
|
|
260
|
+
const currentDate = new Date();
|
|
261
|
+
let closestIndex = 0;
|
|
262
|
+
let minDiff = Infinity;
|
|
263
|
+
dateArr.forEach((dateStr, index) => {
|
|
264
|
+
const date = new Date(dateStr);
|
|
265
|
+
const diff = Math.abs(differenceInMilliseconds(currentDate, date));
|
|
266
|
+
if (diff < minDiff) {
|
|
267
|
+
minDiff = diff;
|
|
268
|
+
closestIndex = index;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
return closestIndex;
|
|
272
|
+
}
|
|
273
|
+
function getUniqueDatesOptions(preDates = [], dates = []) {
|
|
274
|
+
const dateSet = new Set();
|
|
275
|
+
dates.forEach((date) => {
|
|
276
|
+
if (!dateSet.has(date)) {
|
|
277
|
+
dateSet.add(date);
|
|
278
|
+
preDates.push(date);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
return preDates.length ? [...sortDates(preDates)] : [];
|
|
282
|
+
}
|
|
283
|
+
function sortDates(dateArray) {
|
|
284
|
+
return dateArray.slice().sort((a, b) => a.localeCompare(b));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
async function fetchDrawsInfo({ endpoint, gameId }) {
|
|
288
|
+
if (!(endpoint && gameId))
|
|
289
|
+
return;
|
|
290
|
+
const GAME_DRAW_LIMIT = 9999;
|
|
291
|
+
const filterData = { status: 'PAYABLE', limit: GAME_DRAW_LIMIT };
|
|
292
|
+
const { items: drawList } = await fetchRequest(`${endpoint}/games/${gameId}/draws${toQueryParams(filterData)}`);
|
|
293
|
+
if (!drawList || drawList.length === 0)
|
|
294
|
+
return {};
|
|
295
|
+
const settledDrawList = drawList.sort((a, b) => a === null || a === void 0 ? void 0 : a.date.localeCompare(b === null || b === void 0 ? void 0 : b.date));
|
|
296
|
+
const drawDatesOptions = settledDrawList.map((item) => item.date);
|
|
297
|
+
return {
|
|
298
|
+
drawDatesOptions,
|
|
299
|
+
drawResultsList: settledDrawList
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function fetchData({ endpoint, gameIds }) {
|
|
303
|
+
if (!(endpoint && gameIds))
|
|
304
|
+
return;
|
|
305
|
+
return Promise.allSettled(gameIds.map((gameId) => fetchDrawsInfo({ endpoint, gameId })
|
|
306
|
+
.then((res) => {
|
|
307
|
+
return { gameId, drawResultsList: res.drawResultsList, drawDatesOptions: res.drawDatesOptions };
|
|
308
|
+
})
|
|
309
|
+
.catch((error) => {
|
|
310
|
+
console.error(`Failed to fetch data for gameId: ${gameId}`, error);
|
|
311
|
+
return { gameId, drawResultsList: [], drawDatesOptions: [] };
|
|
312
|
+
}))).then((results) => {
|
|
313
|
+
return results.reduce((pre, cur) => {
|
|
314
|
+
if (cur.status === 'fulfilled') {
|
|
315
|
+
const { gameId, drawResultsList, drawDatesOptions } = cur.value;
|
|
316
|
+
pre[gameId] = {
|
|
317
|
+
drawResultsList,
|
|
318
|
+
drawDatesOptions
|
|
319
|
+
};
|
|
320
|
+
return pre;
|
|
321
|
+
}
|
|
322
|
+
}, {});
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const lotteryOddsbomLatestResultGroupCss = ".lottery-tipping-latest-result-group{container-type:inline-size;padding:16px;background-color:var(--emw--color-background, #fff);height:100%}.games-container{display:flex;flex-direction:column;gap:24px;max-width:800px;margin:0 auto;margin-top:24px}.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)}}";
|
|
327
|
+
const LotteryOddsbomLatestResultGroupStyle0 = lotteryOddsbomLatestResultGroupCss;
|
|
328
|
+
|
|
329
|
+
const LotteryOddsbomLatestResultGroup = class {
|
|
330
|
+
constructor(hostRef) {
|
|
331
|
+
registerInstance(this, hostRef);
|
|
332
|
+
this.mbSource = undefined;
|
|
333
|
+
this.clientStyling = undefined;
|
|
334
|
+
this.clientStylingUrl = undefined;
|
|
335
|
+
this.translationUrl = '';
|
|
336
|
+
this.language = 'en';
|
|
337
|
+
this.endpoint = undefined;
|
|
338
|
+
this.sessionId = undefined;
|
|
339
|
+
this.playerId = '';
|
|
340
|
+
this.gameIds = undefined;
|
|
341
|
+
this.gameIdArr = [];
|
|
342
|
+
this.drawDatesOptions = [];
|
|
343
|
+
this.curDate = undefined;
|
|
344
|
+
this.isLoading = false;
|
|
345
|
+
this.drawResultsObj = {};
|
|
346
|
+
}
|
|
347
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
348
|
+
if (newValue != oldValue) {
|
|
349
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
353
|
+
if (newValue != oldValue) {
|
|
354
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
358
|
+
if (newValue != oldValue) {
|
|
359
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
handleGameIdStringChange(newValue, oldValue) {
|
|
363
|
+
var _a;
|
|
364
|
+
if (newValue != oldValue) {
|
|
365
|
+
this.gameIdArr = ((_a = this.gameIds) === null || _a === void 0 ? void 0 : _a.split(',')) || [];
|
|
366
|
+
this.getData();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
componentDidLoad() {
|
|
370
|
+
var _a;
|
|
371
|
+
this.gameIdArr = ((_a = this.gameIds) === null || _a === void 0 ? void 0 : _a.split(',')) || [];
|
|
372
|
+
this.getData();
|
|
373
|
+
if (this.stylingContainer) {
|
|
374
|
+
if (this.mbSource)
|
|
375
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
376
|
+
if (this.clientStyling)
|
|
377
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
378
|
+
if (this.clientStylingUrl)
|
|
379
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
disconnectedCallback() {
|
|
383
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
384
|
+
}
|
|
385
|
+
getData() {
|
|
386
|
+
this.isLoading = true;
|
|
387
|
+
fetchData({ endpoint: this.endpoint, gameIds: this.gameIdArr })
|
|
388
|
+
.then((res) => {
|
|
389
|
+
this.drawResultsObj = res;
|
|
390
|
+
const dates = Object.values(res)
|
|
391
|
+
.map((i) => i.drawDatesOptions)
|
|
392
|
+
.filter(Boolean)
|
|
393
|
+
.flat();
|
|
394
|
+
this.drawDatesOptions = getUniqueDatesOptions([], dates);
|
|
395
|
+
this.curDate = this.drawDatesOptions[findLatestDateIdx(this.drawDatesOptions)];
|
|
396
|
+
})
|
|
397
|
+
.finally(() => {
|
|
398
|
+
this.isLoading = false;
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
handleChange(e) {
|
|
402
|
+
const idx = e.detail;
|
|
403
|
+
this.curDate = this.drawDatesOptions[idx];
|
|
404
|
+
}
|
|
405
|
+
handleNext() {
|
|
406
|
+
if (this.curDate) {
|
|
407
|
+
const idx = this.drawDatesOptions.findIndex((v) => v === this.curDate);
|
|
408
|
+
if (idx < this.drawDatesOptions.length - 1) {
|
|
409
|
+
this.curDate = this.drawDatesOptions[idx + 1];
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
handlePrev() {
|
|
414
|
+
if (this.curDate) {
|
|
415
|
+
const idx = this.drawDatesOptions.findIndex((v) => v === this.curDate);
|
|
416
|
+
if (idx > 0) {
|
|
417
|
+
this.curDate = this.drawDatesOptions[idx - 1];
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
renderLoading() {
|
|
422
|
+
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" }))));
|
|
423
|
+
}
|
|
424
|
+
renderMainContent() {
|
|
425
|
+
return (h("div", null, this.curDate && (h("helper-date-navigator", { language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "translation-url": this.translationUrl, date: this.curDate, "default-highlight-dates": JSON.stringify(this.drawDatesOptions || []), onNext: this.handleNext.bind(this), onPrev: this.handlePrev.bind(this), onChangeDate: this.handleChange.bind(this) })), h("div", { class: "games-container" }, this.gameIdArr.map((gameId) => {
|
|
426
|
+
var _a, _b;
|
|
427
|
+
return (h("lottery-oddsbom-latest-result", { endpoint: this.endpoint, "game-id": gameId, "cur-date": this.curDate, drawResults: JSON.stringify((_b = (_a = this.drawResultsObj) === null || _a === void 0 ? void 0 : _a[gameId]) === null || _b === void 0 ? void 0 : _b.drawResultsList), "is-passing-data": true, "show-loading": false, "hide-wrapper-empty": true, language: this.language, "translation-url": this.translationUrl, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "mb-source": this.mbSource, "session-id": this.sessionId, "player-id": this.playerId }));
|
|
428
|
+
}))));
|
|
429
|
+
}
|
|
430
|
+
render() {
|
|
431
|
+
return (h("div", { key: 'e576645b260f4a713cce833aae814ce7edad137e', ref: (el) => (this.stylingContainer = el), class: "lottery-tipping-latest-result-group" }, this.isLoading ? this.renderLoading() : this.renderMainContent()));
|
|
432
|
+
}
|
|
433
|
+
static get watchers() { return {
|
|
434
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
435
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
436
|
+
"mbSource": ["handleMbSourceChange"],
|
|
437
|
+
"gameIds": ["handleGameIdStringChange"]
|
|
438
|
+
}; }
|
|
439
|
+
};
|
|
440
|
+
LotteryOddsbomLatestResultGroup.style = LotteryOddsbomLatestResultGroupStyle0;
|
|
441
|
+
|
|
442
|
+
export { LotteryOddsbomLatestResultGroup as L, _typeof as _, setClientStylingURL as a, setStreamStyling as b, differenceInMilliseconds as d, requiredArgs as r, setClientStyling as s, toDate as t };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-f1cb78c1.js';
|
|
2
|
+
export { s as setNonce } from './index-f1cb78c1.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([["helper-date-navigator_6",[[1,"lottery-oddsbom-latest-result-group",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"endpoint":[513],"sessionId":[513,"session-id"],"playerId":[513,"player-id"],"gameIds":[513,"game-ids"],"gameIdArr":[32],"drawDatesOptions":[32],"curDate":[32],"isLoading":[32],"drawResultsObj":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"gameIds":["handleGameIdStringChange"]}],[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,"helper-date-navigator",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"date":[1],"defaultHighlightDates":[1,"default-highlight-dates"],"highlightDates":[32],"weeks":[32],"days":[32],"alterDate":[32],"curDate":[32],"recordInfo":[32],"showCalendar":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"defaultHighlightDates":["handleGameIdStringChange"],"date":["handleDateChange"]}],[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}
|