@everymatrix/lottery-oddsbom-ticket-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-2be14604.js +1241 -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_2.cjs.entry.js +146 -0
  6. package/dist/cjs/lottery-oddsbom-ticket-result-5893a77e.js +2963 -0
  7. package/dist/cjs/lottery-oddsbom-ticket-result.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +19 -0
  9. package/dist/collection/components/lottery-oddsbom-ticket-result/index.js +1 -0
  10. package/dist/collection/components/lottery-oddsbom-ticket-result/lottery-oddsbom-ticket-result.css +221 -0
  11. package/dist/collection/components/lottery-oddsbom-ticket-result/lottery-oddsbom-ticket-result.js +413 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/models/index.js +2 -0
  14. package/dist/collection/utils/api.js +55 -0
  15. package/dist/collection/utils/locale.utils.js +142 -0
  16. package/dist/collection/utils/utils.js +133 -0
  17. package/dist/esm/app-globals-0f993ce5.js +3 -0
  18. package/dist/esm/index-3d5460b3.js +1214 -0
  19. package/dist/esm/index.js +2 -0
  20. package/dist/esm/loader.js +11 -0
  21. package/dist/esm/lottery-oddsbom-bullet_2.entry.js +142 -0
  22. package/dist/esm/lottery-oddsbom-ticket-result-11fceed5.js +2958 -0
  23. package/dist/esm/lottery-oddsbom-ticket-result.js +20 -0
  24. package/dist/index.cjs.js +1 -0
  25. package/dist/index.js +1 -0
  26. package/dist/lottery-oddsbom-ticket-result/app-globals-0f993ce5.js +1 -0
  27. package/dist/lottery-oddsbom-ticket-result/index-3d5460b3.js +2 -0
  28. package/dist/lottery-oddsbom-ticket-result/index.esm.js +1 -0
  29. package/dist/lottery-oddsbom-ticket-result/lottery-oddsbom-bullet_2.entry.js +1 -0
  30. package/dist/lottery-oddsbom-ticket-result/lottery-oddsbom-ticket-result-11fceed5.js +1 -0
  31. package/dist/lottery-oddsbom-ticket-result/lottery-oddsbom-ticket-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-ticket-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-ticket-result/.stencil/packages/stencil/lottery-oddsbom-ticket-result/stencil.config.d.ts +2 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-result/.stencil/packages/stencil/lottery-oddsbom-ticket-result/stencil.config.dev.d.ts +2 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-result/.stencil/packages/stencil/lottery-oddsbom-ticket-result/storybook/main.d.ts +3 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-result/.stencil/packages/stencil/lottery-oddsbom-ticket-result/storybook/preview.d.ts +70 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-result/.stencil/tools/plugins/index.d.ts +4 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-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-ticket-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-ticket-result/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  45. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-result/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  46. package/dist/types/components/lottery-oddsbom-ticket-result/index.d.ts +1 -0
  47. package/dist/types/components/lottery-oddsbom-ticket-result/lottery-oddsbom-ticket-result.d.ts +61 -0
  48. package/dist/types/components.d.ts +113 -0
  49. package/dist/types/index.d.ts +1 -0
  50. package/dist/types/models/index.d.ts +16 -0
  51. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  52. package/dist/types/utils/api.d.ts +8 -0
  53. package/dist/types/utils/locale.utils.d.ts +2 -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,55 @@
1
+ import { fetchRequest } from "./utils";
2
+ async function fetchTicketMatch({ endpoint, gameId, drawId }) {
3
+ try {
4
+ const res = await fetchRequest(`${endpoint}/games/${gameId}/draws/${drawId}/findDrawEvents`);
5
+ return res || [];
6
+ }
7
+ catch (e) {
8
+ console.log(e);
9
+ }
10
+ }
11
+ function getTeamsFromEventName(eventName) {
12
+ if (!eventName)
13
+ return '';
14
+ return eventName.split('vs').map((i) => i.trim());
15
+ }
16
+ function resolveSelections(resInMatch) {
17
+ const mySet1 = new Set();
18
+ const mySet2 = new Set();
19
+ for (const resInLine of resInMatch) {
20
+ const [team1Score, team2Score] = resInLine.split(':');
21
+ if (!mySet1.has(team1Score))
22
+ mySet1.add(team1Score);
23
+ if (!mySet2.has(team1Score))
24
+ mySet2.add(team2Score);
25
+ }
26
+ return [Array.from(mySet1), Array.from(mySet2)];
27
+ }
28
+ export async function buildTicketBetDataSource({ endpoint, gameId, drawId, results, splitView = false }) {
29
+ const res = await fetchTicketMatch({ endpoint, gameId, drawId });
30
+ if (splitView) {
31
+ return (res.reduce((pre, item, index) => {
32
+ const [team1Name, team2Name] = getTeamsFromEventName(item.eventName);
33
+ const [team1Res, team2Res] = resolveSelections(results[index] || []);
34
+ pre === null || pre === void 0 ? void 0 : pre.push({
35
+ index: index + 1,
36
+ teamName: team1Name,
37
+ startTime: item.startTime,
38
+ results: team1Res
39
+ });
40
+ pre === null || pre === void 0 ? void 0 : pre.push({
41
+ index: index + 1,
42
+ teamName: team2Name,
43
+ startTime: item.startTime,
44
+ results: team2Res
45
+ });
46
+ return pre;
47
+ }, []) || []);
48
+ }
49
+ return res.map((item, index) => ({
50
+ index: index + 1,
51
+ eventName: item.eventName,
52
+ startTime: item.startTime,
53
+ results: results[index] || []
54
+ }));
55
+ }
@@ -0,0 +1,142 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ filter: 'Filter',
6
+ clear: 'Clear',
7
+ searchByTicketId: 'Search by Ticket ID',
8
+ enterTicketId: 'Enter Ticket ID',
9
+ searchByTicketType: 'Search by Ticket Type',
10
+ selectTicketType: 'Select Ticket Type',
11
+ searchByDate: 'Search by Date',
12
+ from: 'From',
13
+ to: 'To',
14
+ normal: 'Normal',
15
+ subscription: 'Subscription',
16
+ ticketsHistory: 'Tickets History',
17
+ settled: 'Settled',
18
+ purchased: 'Purchased',
19
+ canceled: 'Canceled',
20
+ noData: 'No data Avaliable.',
21
+ ticketId: 'Ticket ID:',
22
+ ticketType: 'Ticket Type:',
23
+ ticketAmount: 'Ticket Amount:',
24
+ lineDetail: 'Line Detail:',
25
+ seeDetails: 'See Details',
26
+ numberOfDraw: 'Number of Draw:',
27
+ ticketResult: 'Ticket Result:',
28
+ drawId: 'Draw ID:',
29
+ drawDate: 'Draw Date:',
30
+ result: 'Result:',
31
+ prize: 'Prize:',
32
+ bettingType: 'Betting Type:'
33
+ },
34
+ ro: {
35
+ ticketsHistory: 'Istoric bilete',
36
+ settled: 'Decontat',
37
+ purchased: 'Achiziționat',
38
+ canceled: 'Anulat',
39
+ noData: 'Nu sunt date disponibile.',
40
+ ticketId: 'ID bilet:',
41
+ ticketType: 'Tip bilet:',
42
+ ticketAmount: 'Suma biletului:',
43
+ lineDetail: 'Detaliu linie:',
44
+ seeDetails: 'Vezi detalii',
45
+ numberOfDraw: 'Număr de extrageri:',
46
+ ticketResult: 'Rezultat bilet:',
47
+ drawId: 'ID extragere:',
48
+ drawDate: 'Data extragerii:',
49
+ result: 'Rezultat:',
50
+ prize: 'Premiu:',
51
+ bettingType: 'Tip de pariu:'
52
+ },
53
+ fr: {
54
+ ticketsHistory: 'Historique des billets',
55
+ settled: 'Réglé',
56
+ purchased: 'Acheté',
57
+ canceled: 'Annulé',
58
+ noData: 'Aucune donnée disponible.',
59
+ ticketId: 'ID du billet:',
60
+ ticketType: 'Type de billet:',
61
+ ticketAmount: 'Montant du billet:',
62
+ lineDetail: 'Détail de la ligne:',
63
+ seeDetails: 'Voir les détails',
64
+ numberOfDraw: 'Nombre de tirages:',
65
+ ticketResult: 'Résultat du billet:',
66
+ drawId: 'ID du tirage:',
67
+ drawDate: 'Date du tirage:',
68
+ result: 'Résultat:',
69
+ prize: 'Prix:',
70
+ bettingType: 'Type de pari:'
71
+ },
72
+ ar: {
73
+ ticketsHistory: 'سجل التذاكر',
74
+ settled: 'تمت التسوية',
75
+ purchased: 'تم شراؤها',
76
+ canceled: 'تم الإلغاء',
77
+ noData: 'لا توجد بيانات متاحة.',
78
+ ticketId: 'معرف التذكرة:',
79
+ ticketType: 'نوع التذكرة:',
80
+ ticketAmount: 'مبلغ التذكرة:',
81
+ lineDetail: 'تفاصيل الخط:',
82
+ seeDetails: 'انظر التفاصيل',
83
+ numberOfDraw: 'عدد السحوبات:',
84
+ ticketResult: 'نتيجة التذكرة:',
85
+ drawId: 'معرف السحب:',
86
+ drawDate: 'تاريخ السحب:',
87
+ result: 'النتيجة:',
88
+ prize: 'الجائزة:',
89
+ bettingType: 'نوع الرهان:'
90
+ },
91
+ hr: {
92
+ ticketsHistory: 'Povijest listića',
93
+ settled: 'Riješeno',
94
+ purchased: 'Kupljeno',
95
+ canceled: 'Otkazano',
96
+ noData: 'Nema dostupnih podataka.',
97
+ ticketId: 'ID listića:',
98
+ ticketType: 'Vrsta listića:',
99
+ ticketAmount: 'Iznos listića:',
100
+ lineDetail: 'Detalji linije:',
101
+ seeDetails: 'Vidi detalje',
102
+ numberOfDraw: 'Broj izvlačenja:',
103
+ ticketResult: 'Rezultat listića:',
104
+ drawId: 'ID izvlačenja:',
105
+ drawDate: 'Datum izvlačenja:',
106
+ result: 'Rezultat:',
107
+ prize: 'Nagrada:',
108
+ bettingType: 'Vrsta oklade:'
109
+ }
110
+ };
111
+ export const translate = (key, customLang, replacements) => {
112
+ const lang = customLang;
113
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
114
+ if (replacements) {
115
+ Object.keys(replacements).forEach((placeholder) => {
116
+ translation = translation === null || translation === void 0 ? void 0 : translation.replace(`{${placeholder}}`, replacements[placeholder]);
117
+ });
118
+ }
119
+ return translation;
120
+ };
121
+ const getTranslations = (data) => {
122
+ Object.keys(data).forEach((item) => {
123
+ for (let key in data[item]) {
124
+ TRANSLATIONS[item][key] = data[item][key];
125
+ }
126
+ });
127
+ };
128
+ export const resolveTranslationUrl = async (translationUrl) => {
129
+ if (translationUrl) {
130
+ try {
131
+ const response = await fetch(translationUrl);
132
+ if (!response.ok) {
133
+ throw new Error(`HTTP error! status: ${response.status}`);
134
+ }
135
+ const translations = await response.json();
136
+ getTranslations(translations);
137
+ }
138
+ catch (error) {
139
+ console.error('Failed to fetch or parse translations from URL:', error);
140
+ }
141
+ }
142
+ };
@@ -0,0 +1,133 @@
1
+ import { format as _format, parseISO } from "date-fns";
2
+ export function format(first, middle, last) {
3
+ return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
4
+ }
5
+ export const formatDate = ({ date, type = 'date', format }) => {
6
+ try {
7
+ const parsedDate = parseISO(date);
8
+ if (isNaN(parsedDate.getTime())) {
9
+ throw new Error(`Invalid date: ${date}`);
10
+ }
11
+ if (format)
12
+ return _format(parsedDate, format);
13
+ let formatStr = 'dd/MM/yyyy';
14
+ if (type === 'time') {
15
+ formatStr = 'dd/MM/yyyy HH:mm:ss';
16
+ }
17
+ else if (type === 'week') {
18
+ formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
19
+ }
20
+ return _format(parsedDate, formatStr);
21
+ }
22
+ catch (error) {
23
+ console.error('Error formatting date:', error.message);
24
+ return '';
25
+ }
26
+ };
27
+ export function toQueryParams(params) {
28
+ const finalParams = {};
29
+ Object.entries(params).forEach(([key, value]) => {
30
+ if (!isEmptyValue(value, true)) {
31
+ finalParams[key] = value;
32
+ }
33
+ });
34
+ const queryString = Object.entries(finalParams)
35
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
36
+ .join('&');
37
+ return queryString ? `?${queryString}` : '';
38
+ }
39
+ function isEmptyValue(value, allowZero) {
40
+ if (value === null || value === undefined || value === '') {
41
+ return true;
42
+ }
43
+ else if (value === 0 && allowZero) {
44
+ return false;
45
+ }
46
+ else if (Array.isArray(value)) {
47
+ return isEmptyValueOfArray(value);
48
+ }
49
+ else if (Object.prototype.toString.call(value) === '[object Object]') {
50
+ return isEmptyValueOfObject(value);
51
+ }
52
+ else {
53
+ return !value;
54
+ }
55
+ }
56
+ function isEmptyValueOfArray(arr) {
57
+ if (arr.length === 0) {
58
+ return true;
59
+ }
60
+ const len = arr.length;
61
+ let count = 0;
62
+ for (let i = 0; i < len; i++) {
63
+ if (isEmptyValue(arr[i])) {
64
+ count++;
65
+ }
66
+ else {
67
+ return false;
68
+ }
69
+ }
70
+ if (count === len) {
71
+ return true;
72
+ }
73
+ return false;
74
+ }
75
+ function isEmptyValueOfObject(obj) {
76
+ if (Object.keys(obj).length === 0) {
77
+ return true;
78
+ }
79
+ const len = Object.keys(obj).length;
80
+ let count = 0;
81
+ for (const val of Object.values(obj)) {
82
+ if (isEmptyValue(val)) {
83
+ count++;
84
+ }
85
+ else {
86
+ return false;
87
+ }
88
+ }
89
+ if (count === len) {
90
+ return true;
91
+ }
92
+ return false;
93
+ }
94
+ export function fetchRequest(url, method = 'GET', body = null, headers = {}) {
95
+ return new Promise((resolve, reject) => {
96
+ const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
97
+ const options = {
98
+ method,
99
+ headers: headersOrigin,
100
+ body: null
101
+ };
102
+ if (body && method !== 'GET' && method !== 'HEAD') {
103
+ options.body = JSON.stringify(body);
104
+ }
105
+ else {
106
+ delete options.body;
107
+ }
108
+ fetch(url, options)
109
+ .then((response) => {
110
+ if (!response.ok) {
111
+ return response.json().then((errorData) => {
112
+ const error = {
113
+ status: response.status,
114
+ statusText: response.statusText,
115
+ code: errorData.code || 'UNKNOWN_ERROR',
116
+ message: errorData.message || 'An unknown error occurred',
117
+ data: errorData.data || null
118
+ };
119
+ reject(error);
120
+ }, () => reject({
121
+ status: response.status,
122
+ statusText: response.statusText,
123
+ code: 'PARSE_ERROR',
124
+ message: 'Failed to parse error response'
125
+ }));
126
+ }
127
+ else {
128
+ return response.json();
129
+ }
130
+ })
131
+ .then((data) => resolve(data), (error) => reject(error));
132
+ });
133
+ }
@@ -0,0 +1,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };