@everymatrix/lottery-tipping-ticket-buy 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/app-tooltip_11.cjs.entry.js +3998 -0
- package/dist/cjs/index-8a0b513b.js +1364 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/lottery-tipping-ticket-buy-164a217a.js +7953 -0
- package/dist/cjs/lottery-tipping-ticket-buy.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +63 -0
- package/dist/collection/components/lottery-segmented/lottery-segmented.css +52 -0
- package/dist/collection/components/lottery-segmented/lottery-segmented.js +151 -0
- package/dist/collection/components/lottery-tipping-ticket-buy/index.js +1 -0
- package/dist/collection/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.css +122 -0
- package/dist/collection/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.js +806 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/model/type.js +6 -0
- package/dist/collection/utils/api.js +72 -0
- package/dist/collection/utils/locale.utils.js +118 -0
- package/dist/collection/utils/utils.js +114 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/app-tooltip_11.entry.js +3985 -0
- package/dist/esm/index-c24f96b9.js +1335 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/lottery-tipping-ticket-buy-04819204.js +7941 -0
- package/dist/esm/lottery-tipping-ticket-buy.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/lottery-tipping-ticket-buy/app-globals-0f993ce5.js +1 -0
- package/dist/lottery-tipping-ticket-buy/app-tooltip_11.entry.js +1 -0
- package/dist/lottery-tipping-ticket-buy/index-c24f96b9.js +2 -0
- package/dist/lottery-tipping-ticket-buy/index.esm.js +1 -0
- package/dist/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy-04819204.js +6657 -0
- package/dist/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.esm.js +1 -0
- package/dist/static/poolGameLogo.webp +0 -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-tipping-ticket-buy/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/lottery-segmented/lottery-segmented.d.ts +34 -0
- package/dist/types/components/lottery-tipping-ticket-buy/index.d.ts +1 -0
- package/dist/types/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.d.ts +165 -0
- package/dist/types/components.d.ts +228 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/model/type.d.ts +203 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/api.d.ts +9 -0
- package/dist/types/utils/locale.utils.d.ts +3 -0
- package/dist/types/utils/utils.d.ts +13 -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 @@
|
|
|
1
|
+
export * from './components/lottery-tipping-ticket-buy';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { isEmptyValue } from "./utils";
|
|
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', 'X-APP-KEY': '123456' }, 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 async function fetchSaleStatistics({ endpoint, gameId, drawId }) {
|
|
53
|
+
try {
|
|
54
|
+
const res = await fetchRequest(`${endpoint}/games/${gameId}/draws/${drawId}/saleStatistics`);
|
|
55
|
+
return res;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
return Promise.reject(error);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function toQueryParams(params) {
|
|
62
|
+
const finalParams = {};
|
|
63
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
64
|
+
if (!isEmptyValue(value, true)) {
|
|
65
|
+
finalParams[key] = value;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const queryString = Object.entries(finalParams)
|
|
69
|
+
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
70
|
+
.join('&');
|
|
71
|
+
return queryString ? `?${queryString}` : '';
|
|
72
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
3
|
+
const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
stop: 'Stop',
|
|
6
|
+
at: 'at',
|
|
7
|
+
turnover: 'Turnover: ',
|
|
8
|
+
selectionCleared: 'Your selection will be cleared.',
|
|
9
|
+
selectionOnLineCleared: 'Your selection on this line will be cleared.',
|
|
10
|
+
ticketSubmitted: 'Ticket submitted successfully.',
|
|
11
|
+
ticketFailed: 'Failed to purchase the ticket. Please try again.',
|
|
12
|
+
lines: 'Lines',
|
|
13
|
+
line: 'Line',
|
|
14
|
+
bettingType: 'Betting Type',
|
|
15
|
+
playingMode: 'Playing Mode',
|
|
16
|
+
orderSummaryTitle: 'Order Summary',
|
|
17
|
+
orderSummaryTickets: 'Tickets',
|
|
18
|
+
orderSummaryTotal: 'Total',
|
|
19
|
+
orderSummarySubmit: 'Submit',
|
|
20
|
+
cancel: 'Cancel',
|
|
21
|
+
confirm: 'Confirm',
|
|
22
|
+
stakePerLine: 'Stake per Line:',
|
|
23
|
+
error: 'Error!',
|
|
24
|
+
gameNotAvailable: 'Sorry. The Game is not available now.'
|
|
25
|
+
},
|
|
26
|
+
ro: {
|
|
27
|
+
selectionCleared: 'Selecția dvs. va fi ștearsă.',
|
|
28
|
+
ticketSubmitted: 'Bilet trimis cu succes.',
|
|
29
|
+
ticketFailed: 'Nu s-a putut achiziționa biletul. Vă rugăm să încercați din nou.',
|
|
30
|
+
lines: 'Linii',
|
|
31
|
+
line: 'Linie',
|
|
32
|
+
bettingType: 'Tip de pariu',
|
|
33
|
+
playingMode: 'Mod de joc',
|
|
34
|
+
orderSummaryTitle: 'Sumar comandă',
|
|
35
|
+
orderSummaryTickets: 'Bilete',
|
|
36
|
+
orderSummaryTotal: 'Total',
|
|
37
|
+
orderSummarySubmit: 'Trimite',
|
|
38
|
+
cancel: 'Anulează',
|
|
39
|
+
confirm: 'Confirmă'
|
|
40
|
+
},
|
|
41
|
+
fr: {
|
|
42
|
+
selectionCleared: 'Votre sélection sera effacée.',
|
|
43
|
+
ticketSubmitted: 'Billet soumis avec succès.',
|
|
44
|
+
ticketFailed: "Échec de l'achat du billet. Veuillez réessayer.",
|
|
45
|
+
lines: 'Lignes',
|
|
46
|
+
line: 'Ligne',
|
|
47
|
+
bettingType: 'Type de pari',
|
|
48
|
+
playingMode: 'Mode de jeu',
|
|
49
|
+
orderSummaryTitle: 'Résumé de la commande',
|
|
50
|
+
orderSummaryTickets: 'Billets',
|
|
51
|
+
orderSummaryTotal: 'Total',
|
|
52
|
+
orderSummarySubmit: 'Soumettre',
|
|
53
|
+
cancel: 'Annuler',
|
|
54
|
+
confirm: 'Confirmer'
|
|
55
|
+
},
|
|
56
|
+
ar: {
|
|
57
|
+
selectionCleared: 'سيتم مسح اختيارك.',
|
|
58
|
+
ticketSubmitted: 'تم إرسال التذكرة بنجاح.',
|
|
59
|
+
ticketFailed: 'فشل شراء التذكرة. يرجى المحاولة مرة أخرى.',
|
|
60
|
+
lines: 'خطوط',
|
|
61
|
+
line: 'خط',
|
|
62
|
+
bettingType: 'نوع الرهان',
|
|
63
|
+
playingMode: 'وضع اللعب',
|
|
64
|
+
orderSummaryTitle: 'ملخص الطلب',
|
|
65
|
+
orderSummaryTickets: 'التذاكر',
|
|
66
|
+
orderSummaryTotal: 'المجموع',
|
|
67
|
+
orderSummarySubmit: 'إرسال',
|
|
68
|
+
cancel: 'إلغاء',
|
|
69
|
+
confirm: 'تأكيد'
|
|
70
|
+
},
|
|
71
|
+
hr: {
|
|
72
|
+
selectionCleared: 'Vaš odabir bit će obrisan.',
|
|
73
|
+
ticketSubmitted: 'Listić je uspješno predan.',
|
|
74
|
+
ticketFailed: 'Kupnja listića nije uspjela. Molimo pokušajte ponovo.',
|
|
75
|
+
lines: 'Linije',
|
|
76
|
+
line: 'Linija',
|
|
77
|
+
bettingType: 'Vrsta oklade',
|
|
78
|
+
playingMode: 'Način igranja',
|
|
79
|
+
orderSummaryTitle: 'Sažetak narudžbe',
|
|
80
|
+
orderSummaryTickets: 'Listići',
|
|
81
|
+
orderSummaryTotal: 'Ukupno',
|
|
82
|
+
orderSummarySubmit: 'Pošalji',
|
|
83
|
+
cancel: 'Odustani',
|
|
84
|
+
confirm: 'Potvrdi'
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
export const translate = (key, customLang, replacements) => {
|
|
88
|
+
const lang = customLang;
|
|
89
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
90
|
+
if (replacements) {
|
|
91
|
+
Object.keys(replacements).forEach((placeholder) => {
|
|
92
|
+
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return translation;
|
|
96
|
+
};
|
|
97
|
+
export const getTranslations = (data) => {
|
|
98
|
+
Object.keys(data).forEach((item) => {
|
|
99
|
+
for (let key in data[item]) {
|
|
100
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
export const resolveTranslationUrl = async (translationUrl) => {
|
|
105
|
+
if (translationUrl) {
|
|
106
|
+
try {
|
|
107
|
+
const response = await fetch(translationUrl);
|
|
108
|
+
if (!response.ok) {
|
|
109
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
110
|
+
}
|
|
111
|
+
const translations = await response.json();
|
|
112
|
+
getTranslations(translations);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.error('Failed to fetch or parse translations from URL:', error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export function format(first, middle, last) {
|
|
2
|
+
return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
|
|
3
|
+
}
|
|
4
|
+
export const showNotification = ({ message, theme = 'success', renderOne = false }) => {
|
|
5
|
+
window.postMessage({
|
|
6
|
+
type: 'ShowNotificationToast',
|
|
7
|
+
message,
|
|
8
|
+
theme,
|
|
9
|
+
renderOne
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export function isEmptyValue(value, allowZero) {
|
|
13
|
+
if (value === null || value === undefined || value === '') {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
else if (value === 0 && allowZero) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
else if (Array.isArray(value)) {
|
|
20
|
+
return isEmptyValueOfArray(value);
|
|
21
|
+
}
|
|
22
|
+
else if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
23
|
+
return isEmptyValueOfObject(value);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return !value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function isEmptyValueOfArray(arr) {
|
|
30
|
+
if (arr.length === 0) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
const len = arr.length;
|
|
34
|
+
let count = 0;
|
|
35
|
+
for (let i = 0; i < len; i++) {
|
|
36
|
+
if (isEmptyValue(arr[i])) {
|
|
37
|
+
count++;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (count === len) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
function isEmptyValueOfObject(obj) {
|
|
49
|
+
if (Object.keys(obj).length === 0) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
const len = Object.keys(obj).length;
|
|
53
|
+
let count = 0;
|
|
54
|
+
for (const val of Object.values(obj)) {
|
|
55
|
+
if (isEmptyValue(val)) {
|
|
56
|
+
count++;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (count === len) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
export function thousandSeparator(value) {
|
|
68
|
+
if (value === 0) {
|
|
69
|
+
return '0';
|
|
70
|
+
}
|
|
71
|
+
if (!value) {
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
74
|
+
value = value.toString();
|
|
75
|
+
const parts = value.split('.');
|
|
76
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
77
|
+
return parts.join('.');
|
|
78
|
+
}
|
|
79
|
+
export function formattedTurnover(turnover, unit = '€') {
|
|
80
|
+
if (turnover === null || turnover === undefined)
|
|
81
|
+
return '';
|
|
82
|
+
return `${unit}${turnover ? thousandSeparator(turnover) : 0}`;
|
|
83
|
+
}
|
|
84
|
+
function calculateCombinationInLine(selectionsInLine = [[]], matchNum) {
|
|
85
|
+
let res = 1;
|
|
86
|
+
for (let i = 0; i < matchNum; i++) {
|
|
87
|
+
const curMatchSelections = (selectionsInLine[i] || []).filter((i) => i);
|
|
88
|
+
res *= curMatchSelections.length;
|
|
89
|
+
if (res === 0)
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
92
|
+
return res;
|
|
93
|
+
}
|
|
94
|
+
export function getTotalLinesAndCheckIfNotComplete(bulletSelectionsLineGroup, matchNum, minCombinations, maxCombinations) {
|
|
95
|
+
const isEffectivelyEmpty = !bulletSelectionsLineGroup ||
|
|
96
|
+
bulletSelectionsLineGroup.length === 0 ||
|
|
97
|
+
bulletSelectionsLineGroup.every((board) => !board.some((match) => match && match.length > 0));
|
|
98
|
+
if (isEffectivelyEmpty || matchNum === undefined || matchNum === null) {
|
|
99
|
+
return {
|
|
100
|
+
totalLines: 0,
|
|
101
|
+
notComplete: true
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
// total line combination is sum of all the line's combination
|
|
105
|
+
const _totalLines = bulletSelectionsLineGroup.reduce((pre, cur) => pre + calculateCombinationInLine(cur, matchNum), 0);
|
|
106
|
+
// each line's combination should within in [minCombinations, maxCombinations]
|
|
107
|
+
return {
|
|
108
|
+
totalLines: _totalLines,
|
|
109
|
+
notComplete: bulletSelectionsLineGroup.some((selectionsInLine) => {
|
|
110
|
+
const curCombination = calculateCombinationInLine(selectionsInLine, matchNum);
|
|
111
|
+
return curCombination < minCombinations || curCombination > maxCombinations;
|
|
112
|
+
})
|
|
113
|
+
};
|
|
114
|
+
}
|