@everymatrix/lottery-oddsbom-ticket-bet 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 (76) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-b8e9c8e4.js +1327 -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_9.cjs.entry.js +1064 -0
  6. package/dist/cjs/lottery-oddsbom-ticket-bet-402dc005.js +10038 -0
  7. package/dist/cjs/lottery-oddsbom-ticket-bet.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +36 -0
  9. package/dist/collection/components/lottery-oddsbom-oddschart/lottery-oddsbom-oddschart.css +221 -0
  10. package/dist/collection/components/lottery-oddsbom-oddschart/lottery-oddsbom-oddschart.js +609 -0
  11. package/dist/collection/components/lottery-oddsbom-oddschart-input/lottery-oddsbom-oddschart-input.css +40 -0
  12. package/dist/collection/components/lottery-oddsbom-oddschart-input/lottery-oddsbom-oddschart-input.js +213 -0
  13. package/dist/collection/components/lottery-oddsbom-ticket-bet/index.js +1 -0
  14. package/dist/collection/components/lottery-oddsbom-ticket-bet/lottery-oddsbom-ticket-bet.css +193 -0
  15. package/dist/collection/components/lottery-oddsbom-ticket-bet/lottery-oddsbom-ticket-bet.js +782 -0
  16. package/dist/collection/components/lottery-oddsbom-ticket-board/lottery-oddsbom-ticket-board.css +82 -0
  17. package/dist/collection/components/lottery-oddsbom-ticket-board/lottery-oddsbom-ticket-board.js +350 -0
  18. package/dist/collection/components/lottery-oddsbom-ticket-button/lottery-oddsbom-ticket-button.css +168 -0
  19. package/dist/collection/components/lottery-oddsbom-ticket-button/lottery-oddsbom-ticket-button.js +299 -0
  20. package/dist/collection/components/lottery-oddsbom-ticket-selection/lottery-oddsbom-ticket-selection.css +104 -0
  21. package/dist/collection/components/lottery-oddsbom-ticket-selection/lottery-oddsbom-ticket-selection.js +233 -0
  22. package/dist/collection/index.js +1 -0
  23. package/dist/collection/model/index.type.js +1 -0
  24. package/dist/collection/utils/api.js +10 -0
  25. package/dist/collection/utils/locale.utils.js +73 -0
  26. package/dist/collection/utils/utils.js +200 -0
  27. package/dist/esm/app-globals-0f993ce5.js +3 -0
  28. package/dist/esm/index-9dee9d86.js +1299 -0
  29. package/dist/esm/index.js +2 -0
  30. package/dist/esm/loader.js +11 -0
  31. package/dist/esm/lottery-oddsbom-bullet_9.entry.js +1053 -0
  32. package/dist/esm/lottery-oddsbom-ticket-bet-e46dbb50.js +10026 -0
  33. package/dist/esm/lottery-oddsbom-ticket-bet.js +20 -0
  34. package/dist/index.cjs.js +1 -0
  35. package/dist/index.js +1 -0
  36. package/dist/lottery-oddsbom-ticket-bet/app-globals-0f993ce5.js +1 -0
  37. package/dist/lottery-oddsbom-ticket-bet/index-9dee9d86.js +2 -0
  38. package/dist/lottery-oddsbom-ticket-bet/index.esm.js +1 -0
  39. package/dist/lottery-oddsbom-ticket-bet/lottery-oddsbom-bullet_9.entry.js +1 -0
  40. package/dist/lottery-oddsbom-ticket-bet/lottery-oddsbom-ticket-bet-e46dbb50.js +6657 -0
  41. package/dist/lottery-oddsbom-ticket-bet/lottery-oddsbom-ticket-bet.esm.js +1 -0
  42. package/dist/stencil.config.dev.js +19 -0
  43. package/dist/stencil.config.js +19 -0
  44. package/dist/storybook/main.js +43 -0
  45. package/dist/storybook/preview.js +9 -0
  46. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-bet/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  47. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-bet/.stencil/packages/stencil/lottery-oddsbom-ticket-bet/stencil.config.d.ts +2 -0
  48. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-bet/.stencil/packages/stencil/lottery-oddsbom-ticket-bet/stencil.config.dev.d.ts +2 -0
  49. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-bet/.stencil/packages/stencil/lottery-oddsbom-ticket-bet/storybook/main.d.ts +3 -0
  50. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-bet/.stencil/packages/stencil/lottery-oddsbom-ticket-bet/storybook/preview.d.ts +70 -0
  51. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-bet/.stencil/tools/plugins/index.d.ts +4 -0
  52. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-bet/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  53. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-bet/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  54. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-bet/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  55. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-ticket-bet/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  56. package/dist/types/components/lottery-oddsbom-oddschart/lottery-oddsbom-oddschart.d.ts +51 -0
  57. package/dist/types/components/lottery-oddsbom-oddschart-input/lottery-oddsbom-oddschart-input.d.ts +21 -0
  58. package/dist/types/components/lottery-oddsbom-ticket-bet/index.d.ts +1 -0
  59. package/dist/types/components/lottery-oddsbom-ticket-bet/lottery-oddsbom-ticket-bet.d.ts +95 -0
  60. package/dist/types/components/lottery-oddsbom-ticket-board/lottery-oddsbom-ticket-board.d.ts +51 -0
  61. package/dist/types/components/lottery-oddsbom-ticket-button/lottery-oddsbom-ticket-button.d.ts +40 -0
  62. package/dist/types/components/lottery-oddsbom-ticket-selection/lottery-oddsbom-ticket-selection.d.ts +25 -0
  63. package/dist/types/components.d.ts +298 -0
  64. package/dist/types/index.d.ts +1 -0
  65. package/dist/types/model/index.type.d.ts +198 -0
  66. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  67. package/dist/types/utils/api.d.ts +6 -0
  68. package/dist/types/utils/locale.utils.d.ts +3 -0
  69. package/dist/types/utils/utils.d.ts +17 -0
  70. package/loader/cdn.js +1 -0
  71. package/loader/index.cjs.js +1 -0
  72. package/loader/index.d.ts +24 -0
  73. package/loader/index.es2017.js +1 -0
  74. package/loader/index.js +2 -0
  75. package/loader/package.json +11 -0
  76. package/package.json +27 -0
@@ -0,0 +1,73 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ noTicketBoard: 'No ticket board available.',
6
+ selectionCleared: 'Your selection has been cleared.',
7
+ clearAll: 'Clear All',
8
+ stopAt: 'Stop at',
9
+ turnover: 'Turnover: ',
10
+ pleaseFillIn: 'Please fill in all the selection input!',
11
+ fillIn: 'Fill in',
12
+ noBets: 'Sorry. No bets have been placed so far. Check back later!',
13
+ search: 'Search',
14
+ clear: 'Clear',
15
+ oddsChart: 'Odds Chart',
16
+ ticketSuccess: 'Ticket purchased successfully.',
17
+ stakePerLine: 'Stake per Line:',
18
+ lowestOdds: 'Lowest Odds:',
19
+ highestOdds: 'Highest Odds:',
20
+ orderSummary: 'ORDER SUMMARY',
21
+ ticket: 'Ticket',
22
+ lines: 'Lines',
23
+ total: 'Total',
24
+ submit: 'Submit',
25
+ loading: 'Loading',
26
+ enterValidNumber: 'Please enter a valid number.',
27
+ enterNumberBetween: 'Please enter a number between {min} and {max}.',
28
+ numberAlreadySelected: 'This number has already been selected.',
29
+ enterScoreUpTo: 'Please enter the score (Up to {maxScore})',
30
+ myChoices: 'My Choices',
31
+ teams: 'Teams',
32
+ scores: 'Scores',
33
+ euro: 'Euro',
34
+ cancel: 'Cancel',
35
+ confirm: 'Confirm'
36
+ },
37
+ ro: {},
38
+ fr: {},
39
+ ar: {},
40
+ hr: {}
41
+ };
42
+ export const translate = (key, customLang, replacements) => {
43
+ const lang = customLang;
44
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
45
+ if (replacements) {
46
+ Object.keys(replacements).forEach((placeholder) => {
47
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
48
+ });
49
+ }
50
+ return translation;
51
+ };
52
+ export const getTranslations = (data) => {
53
+ Object.keys(data).forEach((item) => {
54
+ for (let key in data[item]) {
55
+ TRANSLATIONS[item][key] = data[item][key];
56
+ }
57
+ });
58
+ };
59
+ export const resolveTranslationUrl = async (translationUrl) => {
60
+ if (translationUrl) {
61
+ try {
62
+ const response = await fetch(translationUrl);
63
+ if (!response.ok) {
64
+ throw new Error(`HTTP error! status: ${response.status}`);
65
+ }
66
+ const translations = await response.json();
67
+ getTranslations(translations);
68
+ }
69
+ catch (error) {
70
+ console.error('Failed to fetch or parse translations from URL:', error);
71
+ }
72
+ }
73
+ };
@@ -0,0 +1,200 @@
1
+ import { format as _format, parseISO } from "date-fns";
2
+ export const generateUUID = () => {
3
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
4
+ var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
5
+ return v.toString(16);
6
+ });
7
+ };
8
+ export function fetchRequest(url, method = 'GET', body = null, headers = {}) {
9
+ return new Promise((resolve, reject) => {
10
+ const uuid = generateUUID();
11
+ const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
12
+ if (method !== 'GET' && method !== 'HEAD') {
13
+ headersOrigin['X-Idempotency-Key'] = uuid;
14
+ }
15
+ const options = {
16
+ method,
17
+ headers: headersOrigin,
18
+ body: null
19
+ };
20
+ if (body && method !== 'GET' && method !== 'HEAD') {
21
+ options.body = JSON.stringify(body);
22
+ }
23
+ else {
24
+ delete options.body;
25
+ }
26
+ fetch(url, options)
27
+ .then((response) => {
28
+ if (!response.ok) {
29
+ return response.json().then((errorData) => {
30
+ const error = {
31
+ status: response.status,
32
+ statusText: response.statusText,
33
+ code: errorData.code || 'UNKNOWN_ERROR',
34
+ message: errorData.message || 'An unknown error occurred',
35
+ data: errorData.data || null
36
+ };
37
+ reject(error);
38
+ }, () => reject({
39
+ status: response.status,
40
+ statusText: response.statusText,
41
+ code: 'PARSE_ERROR',
42
+ message: 'Failed to parse error response'
43
+ }));
44
+ }
45
+ else {
46
+ return response.json();
47
+ }
48
+ })
49
+ .then((data) => resolve(data), (error) => reject(error));
50
+ });
51
+ }
52
+ export const showNotification = ({ message, theme = 'success' }) => {
53
+ window.postMessage({
54
+ type: 'ShowNotificationToast',
55
+ message,
56
+ theme
57
+ });
58
+ };
59
+ export const generateCombinations = (arr1, arr2) => {
60
+ const result = [];
61
+ for (const num1 of arr1) {
62
+ for (const num2 of arr2) {
63
+ result.push(`${num1}:${num2}`);
64
+ }
65
+ }
66
+ return result;
67
+ };
68
+ export const formatDate = ({ date, type = 'date', format }) => {
69
+ try {
70
+ const parsedDate = parseISO(date);
71
+ if (isNaN(parsedDate.getTime())) {
72
+ throw new Error(`Invalid date: ${date}`);
73
+ }
74
+ if (format)
75
+ return _format(parsedDate, format);
76
+ let formatStr = 'dd/MM/yyyy';
77
+ if (type === 'time') {
78
+ formatStr = 'dd/MM/yyyy HH:mm:ss';
79
+ }
80
+ else if (type === 'week') {
81
+ formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
82
+ }
83
+ return _format(parsedDate, formatStr);
84
+ }
85
+ catch (error) {
86
+ console.error('Error formatting date:', error.message);
87
+ return '';
88
+ }
89
+ };
90
+ function isEmptyValueOfArray(arr) {
91
+ if (arr.length === 0) {
92
+ return true;
93
+ }
94
+ const len = arr.length;
95
+ let count = 0;
96
+ for (let i = 0; i < len; i++) {
97
+ if (isEmptyValue(arr[i])) {
98
+ count++;
99
+ }
100
+ else {
101
+ return false;
102
+ }
103
+ }
104
+ if (count === len) {
105
+ return true;
106
+ }
107
+ return false;
108
+ }
109
+ function isEmptyValueOfObject(obj) {
110
+ if (Object.keys(obj).length === 0) {
111
+ return true;
112
+ }
113
+ const len = Object.keys(obj).length;
114
+ let count = 0;
115
+ for (const val of Object.values(obj)) {
116
+ if (isEmptyValue(val)) {
117
+ count++;
118
+ }
119
+ else {
120
+ return false;
121
+ }
122
+ }
123
+ if (count === len) {
124
+ return true;
125
+ }
126
+ return false;
127
+ }
128
+ export function isEmptyValue(value, allowZero) {
129
+ if (value === null || value === undefined || value === '') {
130
+ return true;
131
+ }
132
+ else if (value === 0 && allowZero) {
133
+ return false;
134
+ }
135
+ else if (value === false) {
136
+ return false;
137
+ }
138
+ else if (Array.isArray(value)) {
139
+ return isEmptyValueOfArray(value);
140
+ }
141
+ else if (Object.prototype.toString.call(value) === '[object Object]') {
142
+ return isEmptyValueOfObject(value);
143
+ }
144
+ else {
145
+ return !value;
146
+ }
147
+ }
148
+ export function toQueryParams(params) {
149
+ const finalParams = {};
150
+ Object.entries(params).forEach(([key, value]) => {
151
+ if (!isEmptyValue(value, true)) {
152
+ finalParams[key] = value;
153
+ }
154
+ });
155
+ const queryString = Object.entries(finalParams)
156
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
157
+ .join('&');
158
+ return queryString ? `?${queryString}` : '';
159
+ }
160
+ export function stringToBase64(str) {
161
+ return new Promise((resolve, reject) => {
162
+ try {
163
+ // 将字符串转换为Blob
164
+ const blob = new Blob([str], { type: 'text/plain;charset=utf-8' });
165
+ // 使用FileReader读取Blob并转换为DataURL
166
+ const reader = new FileReader();
167
+ reader.onload = () => {
168
+ if (typeof reader.result === 'string') {
169
+ // DataURL格式为"data:...;base64,...",提取base64部分
170
+ const base64 = reader.result.split(',')[1];
171
+ resolve(base64);
172
+ }
173
+ else {
174
+ reject(new Error('无法转换为Base64编码'));
175
+ }
176
+ };
177
+ reader.onerror = () => reject(reader.error);
178
+ reader.readAsDataURL(blob);
179
+ }
180
+ catch (error) {
181
+ reject(error);
182
+ }
183
+ });
184
+ }
185
+ export function formatNumber(str, decimals = 2) {
186
+ const num = Number(str);
187
+ return num.toFixed(decimals);
188
+ }
189
+ export function thousandSeparator(value) {
190
+ if (value === 0) {
191
+ return '0';
192
+ }
193
+ if (!value) {
194
+ return '';
195
+ }
196
+ value = value.toString();
197
+ const parts = value.split('.');
198
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
199
+ return parts.join('.');
200
+ }
@@ -0,0 +1,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };